From e1531466e1ea4d929bfb0a2c23f5095a764eb02a Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 15 Aug 2019 08:01:31 +0200 Subject: [PATCH 001/294] Update to grub 2.04 This change updates grub to the 2.04 release. The new release changed how grub is built, so the bootstrap and bootstrap.conf files have to be added to the dist-git. Also, the gitignore file changed so it has to be updated. Since the patches have been forward ported to 2.04, there's no need for a logic to maintain a patch with the delta between the release and the grub master branch. So the release-to-master.patch is dropped and no longer is updated by the do-rebase script. Also since gnulib isn't part of the grub repository anymore and cloned by the boostrap tool, a gnulib tarball is included as other source file and copied before calling the bootstrap tool. That way grub can be built even in builders that only have access to the sources lookaside cache. Resolves: rhbz#1727279 Signed-off-by: Javier Martinez Canillas --- .gitignore | 1 + ...d-support-for-Linux-EFI-stub-loading.patch | 109 +- 0002-Rework-linux-command.patch | 31 +- 0003-Rework-linux16-command.patch | 15 +- ...ecureboot-support-on-efi-chainloader.patch | 60 +- ...loaders-that-link-in-efi-mode-honor-.patch | 54 +- ...rch-64-on-32-boot-in-linuxefi-loader.patch | 23 +- 0007-re-write-.gitignore.patch | 168 +- ...ient-architecture-CAS-reboot-support.patch | 18 +- ...video-support-for-IBM-power-machines.patch | 12 +- ...when-generating-configuration-by-gru.patch | 2 +- 0012-Move-bash-completion-script-922997.patch | 6 +- ...o-include-entries-by-title-not-just-.patch | 2 +- 0015-Add-GRUB_DISABLE_UUID.patch | 4 +- 0016-Make-exit-take-a-return-code.patch | 20 +- ...es-load-an-env-block-from-a-variable.patch | 4 +- ...HCP-client-ID-and-UUID-options-added.patch | 114 +- ...Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch | 2 +- 0022-Migrate-PPC-from-Yaboot-to-Grub2.patch | 4 +- 0023-Add-fw_path-variable-revised.patch | 4 +- ...-hex-hex-straight-through-unmolested.patch | 16 +- ...for-specific-config-file-for-netboot.patch | 10 +- ...g-module-to-parse-Boot-Loader-Specif.patch | 26 +- 0028-Add-devicetree-loading.patch | 4 +- 0029-Don-t-write-messages-to-the-screen.patch | 4 +- 0030-Don-t-print-GNU-GRUB-header.patch | 2 +- ...t-indentation-for-the-term-help-text.patch | 2 +- ...n-t-say-GNU-Linux-in-generated-menus.patch | 4 +- ...rame-to-list-of-relocations-stripped.patch | 2 +- ...spaces-when-we-re-doing-our-cmdline-.patch | 4 +- ...password-to-boot-entries-generated-b.patch | 2 +- 0046-Don-t-emit-Booting-.-message.patch | 4 +- ...f-man-pages-with-slightly-nicer-ones.patch | 10 +- ...ix-when-fallback-searching-for-grub-.patch | 2 +- ...-before-grub.cfg-on-tftp-config-file.patch | 100 +- 0051-Add-grub_util_readlink.patch | 3665 +--- ...se-symlinks-including-those-across-d.patch | 8 +- ...CLASS-in-10_linux-from-etc-os-releas.patch | 2 +- 0055-Try-prefix-if-fw_path-doesn-t-work.patch | 126 +- ...-grub.cfg-netboot-selection-order-11.patch | 2 +- ...-Package-Sort-for-grub2-mkconfig-112.patch | 30 +- ...fig-construct-titles-that-look-like-.patch | 2 +- ...ly-grub2-password-config-tool-985962.patch | 28 +- 0063-Add-a-url-parser.patch | 6 +- ...net-and-bootp-add-support-for-dhcpv6.patch | 26 +- ...rnel-settings-and-use-it-in-10_linux.patch | 30 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 2 +- 0068-Make-grub_fatal-also-backtrace.patch | 6 +- ...ix-up-some-man-pages-rpmdiff-noticed.patch | 6 +- ...fdt-has-address-cells-and-size-cells.patch | 4 +- ...fo-pages-say-grub2-where-appropriate.patch | 58 +- ...more-debug-info-in-our-module-loader.patch | 2 +- ...-Add-ability-to-boot-from-subvolumes.patch | 40 +- ...port-btrfs_subvol-and-btrfs_subvolid.patch | 4 +- 0076-grub2-btrfs-03-follow_default.patch | 20 +- 0077-grub2-btrfs-04-grub2-install.patch | 8 +- 0078-grub2-btrfs-05-grub2-mkconfig.patch | 6 +- 0079-grub2-btrfs-06-subvol-mount.patch | 28 +- ...subvol-name-scheme-to-support-old-sn.patch | 4 +- ...-correctly-with-btrfs-snapshots-bsc-.patch | 10 +- ...ocate_pool-and-grub_efi_free_pool-wr.patch | 2 +- ...fi_.-memory-helpers-where-reasonable.patch | 14 +- 0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 6 +- ...c-sized-arrays-since-we-don-t-build-.patch | 2 +- 0087-don-t-use-int-for-efi-status.patch | 2 +- ...INIT-declare-its-function-prototypes.patch | 2 +- 0089-editenv-handle-relative-symlinks.patch | 4 +- ...e-libgrub.pp-depend-on-config-util.h.patch | 2 +- ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 4 +- ...d-xen-or-multiboot-2-modules-as-need.patch | 10 +- 0094-align-struct-efi_variable-better.patch | 2 +- 0095-Add-BLS-support-to-grub-mkconfig.patch | 8 +- ...nux-and-initrd-commands-for-grub-emu.patch | 28 +- 0098-Add-grub2-switch-to-blscfg.patch | 20 +- 0099-Add-grub_debug_enabled.patch | 2 +- 0100-make-better-backtraces.patch | 36 +- ...w-our-startup-message-if-debug-is-se.patch | 2 +- ...it-possible-to-enabled-build-id-sha1.patch | 4 +- ...f-grub_dprintf-without-the-file-line.patch | 2 +- ...dprintf-that-tells-us-load-addresses.patch | 10 +- ...tch => 0106-Fixup-for-newer-compiler.patch | 4 +- 0106-TPM-support.patch | 891 - ...-export-the-start-and-_start-symbols.patch | 4 +- ...tch => 0108-Fixup-for-newer-compiler.patch | 2 +- ...pport-for-non-Ethernet-network-cards.patch | 61 +- 0110-Use-xid-to-match-DHCP-replies.patch | 65 - ...lid-character-recongition-in-strto-l.patch | 0 ...racketed-ipv6-addrs-and-port-numbers.patch | 4 +- ...=> 0112-bootp-New-net_bootp6-command.patch | 662 +- ...=> 0113-efinet-UEFI-IPv6-PXE-support.patch | 2 +- ...114-grub.texi-Add-net_bootp6-doument.patch | 6 +- ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 108 + ...etting-network-from-UEFI-device-path.patch | 2 +- ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 135 - ...etting-DNS-server-from-UEFI-protocol.patch | 6 +- ...0118-Fix-one-more-coverity-complaint.patch | 4 +- ...19-Support-UEFI-networking-protocols.patch | 46 +- ...> 0120-AUDIT-0-http-boot-tracker-bug.patch | 2 +- ...efi_gop.c-Add-support-for-BLT_ONLY-a.patch | 0 ... 0122-efi-uga-use-64-bit-for-fb_base.patch | 0 ...ot-set-text-mode-until-we-actually-n.patch | 0 ...grub_console_read_key_stroke-helper-.patch | 0 ...nsole-Implement-getkeystatus-support.patch | 0 ...status-helper-funtion-available-ever.patch | 0 ...d-holding-SHIFT-as-user-interrupt-ke.patch | 2 +- ...-incr-command-to-increment-integer-v.patch | 6 +- ...h => 0129-Add-auto-hide-menu-support.patch | 4 +- ...try-for-firmware-setup-on-UEFI-FastB.patch | 4 +- ...> 0131-Add-grub-set-bootflag-utility.patch | 24 +- ...b-boot-indeterminate.service-example.patch | 0 ...h => 0133-gentpl-add-disable-support.patch | 6 +- ... => 0134-gentpl-add-pc-firmware-type.patch | 12 +- ...e-the-firmware-acceleration-for-http.patch | 2 +- ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 12 +- ...make-it-possible-to-run-checkers-on-.patch | 2 +- 0139-Force-everything-to-use-python3.patch | 42 - ...39-Rework-how-the-fdt-command-builds.patch | 28 +- ...able-non-wordsize-allocations-on-arm.patch | 4 +- 0140-Fix-an-8-year-old-typo.patch | 23 - ...n-don-t-run-autoreconf-in-the-topdir.patch | 21 - ...-R-.note.gnu.property-at-more-places.patch | 6 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 0 ...ernel_header.hdr_offset-be-at-the-ri.patch | 2 +- ...=> 0144-Make-grub_error-more-verbose.patch | 6 +- ...fier-report-the-filename-or-modname-.patch | 250 - ...eset-an-alias-for-the-reboot-command.patch | 0 ...-debug-output-on-GOP-and-UGA-probing.patch | 0 ....patch => 0147-Add-a-version-command.patch | 8 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 6 +- ...-Better-memory-allocation-and-error-.patch | 62 +- ...tter-locations-for-kernel-and-initrd.patch | 18 +- ...p-all-the-places-Wsign-compare-error.patch | 396 + ...gn-compare-Wno-conversion-Wno-error-.patch | 12 +- ...ce-buffers-for-reading-to-addresses-.patch | 14 +- ...-arrange-grub_cmd_linux-a-little-bit.patch | 10 +- ...e-our-own-allocator-for-kernel-stuff.patch | 22 +- ...itrd-params-cmdline-allocations-abov.patch | 20 +- ...p-all-the-places-Wsign-compare-error.patch | 392 - ... => 0157-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 10 +- ...tch => 0159-Reimplement-boot_counter.patch | 8 +- ...l-end-pointer-have-the-right-constif.patch | 26 +- ...ntry-selection-based-on-ID-and-title.patch | 2 +- ...try-users-option-argument-to-be-opti.patch | 0 ...export-env-and-efi-load-env-commands.patch | 10 +- ...le-to-subtract-conditions-from-debug.patch | 0 ...bles-from-the-initial-context-when-c.patch | 2 +- ...g-up-grub.cfg-XXX-while-tftp-booting.patch | 2 +- ...-to-set-fPIE-and-friends-on-libgnu.a.patch | 37 +- ...strtoull-print-an-error-if-no-conver.patch | 0 ...69-Fix-the-type-of-grub_efi_status_t.patch | 2 +- ...-boot-success-reset-from-menu-auto-h.patch | 6 +- ...ix-systemctl-kexec-exit-status-check.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 2 +- ...ferences-for-fdt-when-building-with-.patch | 2 +- 0175-Do-better-in-bootstrap.conf.patch | 28 + 0176-Use-git-to-apply-gnulib-patches.patch | 474 + ...2_HEADER_SIZE-define-in-arm-efi-case.patch | 35 - ...find-wholename-for-long-path-matches.patch | 23 + ...ge-Align-efi-sections-on-4k-boundary.patch | 55 - ...ap.conf-don-t-clobber-AM_CFLAGS-here.patch | 23 + ...e-Clarify-file-alignment-in-efi-case.patch | 71 - ...m-Move-trampolines-into-code-section.patch | 78 - ...n-alignment-with-manual-relocation-o.patch | 41 - ...-efi-fdt.c-Do-not-copy-random-memory.patch | 29 - ...t-break-FDT-extra-allocation-space-o.patch | 48 - bootstrap | 1073 + bootstrap.conf | 91 + do-rebase | 18 +- gitignore | 34 +- grub.macros | 25 +- grub.patches | 155 +- grub2.spec | 30 +- release-to-master.patch | 16760 ---------------- sources | 3 +- 177 files changed, 3634 insertions(+), 24119 deletions(-) rename 0107-Fixup-for-newer-compiler.patch => 0106-Fixup-for-newer-compiler.patch (92%) delete mode 100644 0106-TPM-support.patch rename 0108-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0107-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (94%) rename 0109-Fixup-for-newer-compiler.patch => 0108-Fixup-for-newer-compiler.patch (96%) rename 0111-Add-support-for-non-Ethernet-network-cards.patch => 0109-Add-support-for-non-Ethernet-network-cards.patch (94%) delete mode 100644 0110-Use-xid-to-match-DHCP-replies.patch rename 0112-misc-fix-invalid-character-recongition-in-strto-l.patch => 0110-misc-fix-invalid-character-recongition-in-strto-l.patch (100%) rename 0113-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (99%) rename 0114-bootp-New-net_bootp6-command.patch => 0112-bootp-New-net_bootp6-command.patch (84%) rename 0115-efinet-UEFI-IPv6-PXE-support.patch => 0113-efinet-UEFI-IPv6-PXE-support.patch (99%) rename 0116-grub.texi-Add-net_bootp6-doument.patch => 0114-grub.texi-Add-net_bootp6-doument.patch (90%) create mode 100644 0115-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename 0118-efinet-Setting-network-from-UEFI-device-path.patch => 0116-efinet-Setting-network-from-UEFI-device-path.patch (99%) delete mode 100644 0117-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename 0119-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0117-efinet-Setting-DNS-server-from-UEFI-protocol.patch (99%) rename 0120-Fix-one-more-coverity-complaint.patch => 0118-Fix-one-more-coverity-complaint.patch (90%) rename 0121-Support-UEFI-networking-protocols.patch => 0119-Support-UEFI-networking-protocols.patch (99%) rename 0122-AUDIT-0-http-boot-tracker-bug.patch => 0120-AUDIT-0-http-boot-tracker-bug.patch (98%) rename 0123-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch => 0121-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch (100%) rename 0124-efi-uga-use-64-bit-for-fb_base.patch => 0122-efi-uga-use-64-bit-for-fb_base.patch (100%) rename 0125-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch => 0123-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch (100%) rename 0126-EFI-console-Add-grub_console_read_key_stroke-helper-.patch => 0124-EFI-console-Add-grub_console_read_key_stroke-helper-.patch (100%) rename 0127-EFI-console-Implement-getkeystatus-support.patch => 0125-EFI-console-Implement-getkeystatus-support.patch (100%) rename 0128-Make-grub_getkeystatus-helper-funtion-available-ever.patch => 0126-Make-grub_getkeystatus-helper-funtion-available-ever.patch (100%) rename 0129-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch => 0127-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch (98%) rename 0130-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0128-grub-editenv-Add-incr-command-to-increment-integer-v.patch (94%) rename 0131-Add-auto-hide-menu-support.patch => 0129-Add-auto-hide-menu-support.patch (98%) rename 0132-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch => 0130-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch (97%) rename 0133-Add-grub-set-bootflag-utility.patch => 0131-Add-grub-set-bootflag-utility.patch (93%) rename 0134-docs-Add-grub-boot-indeterminate.service-example.patch => 0132-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0135-gentpl-add-disable-support.patch => 0133-gentpl-add-disable-support.patch (89%) rename 0136-gentpl-add-pc-firmware-type.patch => 0134-gentpl-add-pc-firmware-type.patch (68%) rename 0137-efinet-also-use-the-firmware-acceleration-for-http.patch => 0135-efinet-also-use-the-firmware-acceleration-for-http.patch (96%) rename 0138-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0136-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0142-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0137-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (95%) rename 0143-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0138-module-verifier-make-it-possible-to-run-checkers-on-.patch (98%) delete mode 100644 0139-Force-everything-to-use-python3.patch rename 0145-Rework-how-the-fdt-command-builds.patch => 0139-Rework-how-the-fdt-command-builds.patch (86%) rename 0146-Disable-non-wordsize-allocations-on-arm.patch => 0140-Disable-non-wordsize-allocations-on-arm.patch (93%) delete mode 100644 0140-Fix-an-8-year-old-typo.patch delete mode 100644 0141-autogen-don-t-run-autoreconf-in-the-topdir.patch rename 0147-strip-R-.note.gnu.property-at-more-places.patch => 0141-strip-R-.note.gnu.property-at-more-places.patch (96%) rename 0148-Prepend-prefix-when-HTTP-path-is-relative.patch => 0142-Prepend-prefix-when-HTTP-path-is-relative.patch (100%) rename 0149-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch => 0143-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch (98%) rename 0150-Make-grub_error-more-verbose.patch => 0144-Make-grub_error-more-verbose.patch (96%) delete mode 100644 0144-grub-module-verifier-report-the-filename-or-modname-.patch rename 0151-Make-reset-an-alias-for-the-reboot-command.patch => 0145-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0152-EFI-more-debug-output-on-GOP-and-UGA-probing.patch => 0146-EFI-more-debug-output-on-GOP-and-UGA-probing.patch (100%) rename 0153-Add-a-version-command.patch => 0147-Add-a-version-command.patch (96%) rename 0154-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0148-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (94%) rename 0155-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0149-arm-arm64-loader-Better-memory-allocation-and-error-.patch (85%) rename 0156-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0150-Try-to-pick-better-locations-for-kernel-and-initrd.patch (94%) create mode 100644 0151-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename 0158-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0152-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (85%) rename 0159-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0153-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (88%) rename 0160-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0154-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (94%) rename 0161-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0155-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (93%) rename 0162-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (91%) delete mode 100644 0157-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename 0163-Fix-getroot.c-s-trampolines.patch => 0157-Fix-getroot.c-s-trampolines.patch (100%) rename 0164-Do-not-allow-stack-trampolines-anywhere.patch => 0158-Do-not-allow-stack-trampolines-anywhere.patch (81%) rename 0165-Reimplement-boot_counter.patch => 0159-Reimplement-boot_counter.patch (97%) rename 0166-Make-grub_strtoul-end-pointer-have-the-right-constif.patch => 0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch (97%) rename 0167-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0161-Fix-menu-entry-selection-based-on-ID-and-title.patch (99%) rename 0168-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0162-Make-the-menu-entry-users-option-argument-to-be-opti.patch (100%) rename 0169-Add-efi-export-env-and-efi-load-env-commands.patch => 0163-Add-efi-export-env-and-efi-load-env-commands.patch (98%) rename 0170-Make-it-possible-to-subtract-conditions-from-debug.patch => 0164-Make-it-possible-to-subtract-conditions-from-debug.patch (100%) rename 0171-Export-all-variables-from-the-initial-context-when-c.patch => 0165-Export-all-variables-from-the-initial-context-when-c.patch (97%) rename 0172-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch => 0166-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch (97%) rename 0173-Try-to-set-fPIE-and-friends-on-libgnu.a.patch => 0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch (51%) rename 0174-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch => 0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch (100%) rename 0175-Fix-the-type-of-grub_efi_status_t.patch => 0169-Fix-the-type-of-grub_efi_status_t.patch (98%) rename 0179-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0170-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (98%) rename 0180-Fix-systemctl-kexec-exit-status-check.patch => 0171-Fix-systemctl-kexec-exit-status-check.patch (100%) rename 0181-Print-grub-emu-linux-loader-messages-as-debug.patch => 0172-Print-grub-emu-linux-loader-messages-as-debug.patch (100%) rename 0182-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch (98%) rename 0183-Fix-undefined-references-for-fdt-when-building-with-.patch => 0174-Fix-undefined-references-for-fdt-when-building-with-.patch (98%) create mode 100644 0175-Do-better-in-bootstrap.conf.patch create mode 100644 0176-Use-git-to-apply-gnulib-patches.patch delete mode 100644 0176-mkimage-Use-EFI32_HEADER_SIZE-define-in-arm-efi-case.patch create mode 100644 0177-autogen.sh-use-find-wholename-for-long-path-matches.patch delete mode 100644 0177-mkimage-Align-efi-sections-on-4k-boundary.patch create mode 100644 0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch delete mode 100644 0178-mkimage-Clarify-file-alignment-in-efi-case.patch delete mode 100644 0184-arm-Move-trampolines-into-code-section.patch delete mode 100644 0185-arm-Align-section-alignment-with-manual-relocation-o.patch delete mode 100644 0186-grub-core-loader-efi-fdt.c-Do-not-copy-random-memory.patch delete mode 100644 0187-linux-efi-arm-fdt-break-FDT-extra-allocation-space-o.patch create mode 100755 bootstrap create mode 100644 bootstrap.conf delete mode 100644 release-to-master.patch diff --git a/.gitignore b/.gitignore index a592bada..19364b80 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ kojilogs tmp/ .*.sw? results_grub2/ +/gnulib-*.tar.?z diff --git a/0001-Add-support-for-Linux-EFI-stub-loading.patch b/0001-Add-support-for-Linux-EFI-stub-loading.patch index 88fae3cd..95c7cd5e 100644 --- a/0001-Add-support-for-Linux-EFI-stub-loading.patch +++ b/0001-Add-support-for-Linux-EFI-stub-loading.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Matthew Garrett -Date: Tue, 10 Jul 2012 11:58:52 -0400 +Date: Fri, 5 Jul 2019 18:36:44 +0200 Subject: [PATCH] Add support for Linux EFI stub loading. Also: @@ -38,17 +38,16 @@ moves the check into grub_dl_load_file. include/grub/arm64/linux.h | 10 ++ include/grub/efi/efi.h | 7 +- include/grub/efi/linux.h | 31 ++++ - include/grub/i386/linux.h | 1 + - 14 files changed, 620 insertions(+), 69 deletions(-) + 13 files changed, 619 insertions(+), 69 deletions(-) create mode 100644 grub-core/loader/efi/linux.c create mode 100644 grub-core/loader/i386/efi/linux.c create mode 100644 include/grub/efi/linux.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 9590e87d9c0..0b4b0c2122d 100644 +index 474a63e68c5..581d9dfc3b3 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1626,13 +1626,6 @@ module = { +@@ -1709,13 +1709,6 @@ module = { enable = i386_pc; }; @@ -62,7 +61,7 @@ index 9590e87d9c0..0b4b0c2122d 100644 module = { name = ntldr; i386_pc = loader/i386/pc/ntldr.c; -@@ -1685,7 +1678,9 @@ module = { +@@ -1771,7 +1764,9 @@ module = { module = { name = linux; @@ -70,13 +69,13 @@ index 9590e87d9c0..0b4b0c2122d 100644 + i386_pc = loader/i386/pc/linux.c; + x86_64_efi = loader/i386/efi/linux.c; + i386_efi = loader/i386/efi/linux.c; + i386_xen_pvh = loader/i386/linux.c; xen = loader/i386/xen.c; i386_pc = lib/i386/pc/vesa_modes_table.c; - mips = loader/mips/linux.c; -@@ -1696,9 +1691,14 @@ module = { - arm_efi = loader/arm64/linux.c; - arm_uboot = loader/arm/linux.c; +@@ -1786,9 +1781,14 @@ module = { arm64 = loader/arm64/linux.c; + riscv32 = loader/riscv/linux.c; + riscv64 = loader/riscv/linux.c; + emu = loader/emu/linux.c; + fdt = lib/fdt.c; + @@ -89,7 +88,7 @@ index 9590e87d9c0..0b4b0c2122d 100644 module = { diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index e394cd96f8c..04e804d1668 100644 +index 48eb5e7b627..896bebfd57e 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -38,6 +38,14 @@ @@ -126,9 +125,9 @@ index e394cd96f8c..04e804d1668 100644 + grub_boot_time ("Loading module %s", filename); - file = grub_file_open (filename); + file = grub_file_open (filename, GRUB_FILE_TYPE_GRUB_MODULE); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 708581fcbde..c8a9d8307c0 100644 +index 6e1ceb90516..a0faa40ecf0 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -273,6 +273,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -167,7 +166,7 @@ index 708581fcbde..c8a9d8307c0 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 42ad7c570a5..5cdf6c943f2 100644 +index b02fab1b102..a9e37108c6d 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address, @@ -210,7 +209,7 @@ index 42ad7c570a5..5cdf6c943f2 100644 void * grub_efi_allocate_pages_real (grub_efi_physical_address_t address, diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 1f86229f86b..6c00af98dce 100644 +index ef3e9f9444c..a312c668685 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -29,6 +29,7 @@ @@ -221,7 +220,7 @@ index 1f86229f86b..6c00af98dce 100644 #include #include #include -@@ -40,6 +41,7 @@ static int loaded; +@@ -41,6 +42,7 @@ static int loaded; static void *kernel_addr; static grub_uint64_t kernel_size; @@ -229,7 +228,7 @@ index 1f86229f86b..6c00af98dce 100644 static char *linux_args; static grub_uint32_t cmdline_size; -@@ -66,7 +68,8 @@ grub_armxx_efi_linux_check_image (struct linux_armxx_kernel_header * lh) +@@ -67,7 +69,8 @@ grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh) static grub_err_t finalize_params_linux (void) { @@ -239,7 +238,7 @@ index 1f86229f86b..6c00af98dce 100644 void *fdt; -@@ -101,79 +104,70 @@ finalize_params_linux (void) +@@ -102,79 +105,70 @@ finalize_params_linux (void) if (grub_fdt_install() != GRUB_ERR_NONE) goto failure; @@ -251,7 +250,7 @@ index 1f86229f86b..6c00af98dce 100644 -} - -grub_err_t --grub_armxx_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) +-grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) -{ - grub_efi_memory_mapped_device_path_t *mempath; - grub_efi_handle_t image_handle; @@ -284,7 +283,7 @@ index 1f86229f86b..6c00af98dce 100644 - - grub_dprintf ("linux", "linux command line: '%s'\n", args); + grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n", -+ fdt); ++ fdt); /* Convert command line to UCS-2 */ - loaded_image = grub_efi_get_loaded_image (image_handle); @@ -304,7 +303,7 @@ index 1f86229f86b..6c00af98dce 100644 loaded_image->load_options_size = 2 * grub_utf8_to_utf16 (loaded_image->load_options, len, - (grub_uint8_t *) args, len, NULL); -+ (grub_uint8_t *) linux_args, len, NULL); ++ (grub_uint8_t *) linux_args, len, NULL); - grub_dprintf ("linux", "starting image %p\n", image_handle); - status = b->start_image (image_handle, 0, NULL); @@ -329,15 +328,15 @@ index 1f86229f86b..6c00af98dce 100644 + if (loaded_image) + { + if (loaded_image->load_options) -+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_efi_uintn_t)loaded_image->load_options, -+ GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_efi_uintn_t)loaded_image->load_options, ++ GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); + loaded_image->load_options = NULL; + loaded_image->load_options_size = 0; + } +} + +grub_err_t -+grub_armxx_efi_linux_boot_image (grub_addr_t addr, char *args) ++grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) +{ + grub_err_t retval; + @@ -360,21 +359,21 @@ index 1f86229f86b..6c00af98dce 100644 - if (finalize_params_linux () != GRUB_ERR_NONE) - return grub_errno; - -- return (grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr, +- return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, - kernel_size, linux_args)); -+ return grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args); ++ return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args)); } static grub_err_t -@@ -287,6 +281,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -288,6 +282,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), { grub_file_t file = 0; - struct linux_armxx_kernel_header lh; + struct linux_arch_kernel_header lh; + struct grub_armxx_linux_pe_header *pe; + grub_err_t err; grub_dl_ref (my_mod); - -@@ -331,6 +326,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -333,6 +328,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); @@ -391,13 +390,13 @@ index 1f86229f86b..6c00af98dce 100644 linux_args = grub_malloc (cmdline_size); if (!linux_args) diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c -index 1003a0b9997..f35b16caa92 100644 +index 22cc25eccd9..d9b7a9ba400 100644 --- a/grub-core/loader/arm64/xen_boot.c +++ b/grub-core/loader/arm64/xen_boot.c @@ -266,7 +266,6 @@ xen_boot (void) return err; - return grub_armxx_efi_linux_boot_image (xen_hypervisor->start, + return grub_arch_efi_linux_boot_image (xen_hypervisor->start, - xen_hypervisor->size, xen_hypervisor->cmdline); } @@ -480,7 +479,7 @@ index 00000000000..c24202a5dd1 +#pragma GCC diagnostic pop diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c new file mode 100644 -index 00000000000..3db82e782df +index 00000000000..bb2616a8092 --- /dev/null +++ b/grub-core/loader/i386/efi/linux.c @@ -0,0 +1,335 @@ @@ -589,8 +588,7 @@ index 00000000000..3db82e782df + + for (i = 0; i < argc; i++) + { -+ grub_file_filter_disable_compression (); -+ files[i] = grub_file_open (argv[i]); ++ files[i] = grub_file_open (argv[i], GRUB_FILE_TYPE_LINUX_INITRD | GRUB_FILE_TYPE_NO_DECOMPRESS); + if (! files[i]) + goto fail; + nfiles++; @@ -643,7 +641,7 @@ index 00000000000..3db82e782df + int argc, char *argv[]) +{ + grub_file_t file = 0; -+ struct linux_kernel_header lh; ++ struct linux_i386_kernel_header lh; + grub_ssize_t len, start, filelen; + void *kernel = NULL; + @@ -655,7 +653,7 @@ index 00000000000..3db82e782df + goto fail; + } + -+ file = grub_file_open (argv[0]); ++ file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL); + if (! file) + goto fail; + @@ -731,7 +729,8 @@ index 00000000000..3db82e782df + grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); + grub_create_loader_cmdline (argc, argv, + linux_cmdline + sizeof (LINUX_IMAGE) - 1, -+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1)); ++ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1), ++ GRUB_VERIFY_KERNEL_CMDLINE); + + lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; + @@ -820,10 +819,10 @@ index 00000000000..3db82e782df + grub_unregister_command (cmd_initrdefi); +} diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index b69cb7a3a7f..a3c87cf2fc2 100644 +index 47ea2945e4f..eea25ea39ca 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c -@@ -468,14 +468,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -470,14 +470,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), return grub_errno; } @@ -845,7 +844,7 @@ index b69cb7a3a7f..a3c87cf2fc2 100644 grub_register_command ("initrd16", grub_cmd_initrd, 0, N_("Load initrd.")); my_mod = mod; -@@ -484,5 +490,7 @@ GRUB_MOD_INIT(linux16) +@@ -486,5 +492,7 @@ GRUB_MOD_INIT(linux16) GRUB_MOD_FINI(linux16) { grub_unregister_command (cmd_linux); @@ -854,7 +853,7 @@ index b69cb7a3a7f..a3c87cf2fc2 100644 + grub_unregister_command (cmd_initrd16); } diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index 712ba17b9ba..5900fc8a40c 100644 +index 2e98a668969..775297db869 100644 --- a/include/grub/arm/linux.h +++ b/include/grub/arm/linux.h @@ -20,6 +20,7 @@ @@ -878,13 +877,13 @@ index 712ba17b9ba..5900fc8a40c 100644 + #if defined(__arm__) # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE - # define linux_armxx_kernel_header linux_arm_kernel_header + # define linux_arch_kernel_header linux_arm_kernel_header +# define grub_armxx_linux_pe_header grub_arm_linux_pe_header #endif #if defined GRUB_MACHINE_UBOOT diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index 8655067e039..7b533b57139 100644 +index 4269adc6dae..a3be9dd7003 100644 --- a/include/grub/arm64/linux.h +++ b/include/grub/arm64/linux.h @@ -19,6 +19,8 @@ @@ -909,13 +908,13 @@ index 8655067e039..7b533b57139 100644 + #if defined(__aarch64__) # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE - # define linux_armxx_kernel_header linux_arm64_kernel_header + # define linux_arch_kernel_header linux_arm64_kernel_header +# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header #endif #endif /* ! GRUB_ARM64_LINUX_HEADER */ diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 2c6648d46fc..1061aee9726 100644 +index e90e00dc431..6840bfee9b7 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address, @@ -939,10 +938,10 @@ index 2c6648d46fc..1061aee9726 100644 @@ -95,8 +99,7 @@ void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); #include - grub_err_t grub_armxx_efi_linux_check_image(struct linux_armxx_kernel_header *lh); --grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, + grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); +-grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, - char *args); -+grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, char *args); ++grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args); #endif grub_addr_t grub_efi_modules_addr (void); @@ -983,15 +982,3 @@ index 00000000000..d9ede36773b + void *kernel_param); + +#endif /* ! GRUB_EFI_LINUX_HEADER */ -diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index 60c7c3b5e66..bb19dbd5a77 100644 ---- a/include/grub/i386/linux.h -+++ b/include/grub/i386/linux.h -@@ -142,6 +142,7 @@ struct linux_i386_kernel_header - grub_uint64_t setup_data; - grub_uint64_t pref_address; - grub_uint32_t init_size; -+ grub_uint32_t handover_offset; - } GRUB_PACKED; - - /* Boot parameters for Linux based on 2.6.12. This is used by the setup diff --git a/0002-Rework-linux-command.patch b/0002-Rework-linux-command.patch index 485541ff..bd136d69 100644 --- a/0002-Rework-linux-command.patch +++ b/0002-Rework-linux-command.patch @@ -1,20 +1,20 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Matthew Garrett -Date: Sun, 9 Aug 2015 16:12:39 -0700 +Date: Fri, 5 Jul 2019 20:54:51 +0200 Subject: [PATCH] Rework linux command We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel into it before pulling out the individual blocks later on. --- - grub-core/loader/i386/linux.c | 37 ++++++++++++++++++++++++------------- - 1 file changed, 24 insertions(+), 13 deletions(-) + grub-core/loader/i386/linux.c | 36 +++++++++++++++++++++++------------- + 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 9b53d3168f9..f7186be4002 100644 +index d0501e22957..b255c950526 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c -@@ -685,13 +685,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -641,13 +641,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), { grub_file_t file = 0; struct linux_i386_kernel_header lh; @@ -31,7 +31,7 @@ index 9b53d3168f9..f7186be4002 100644 grub_dl_ref (my_mod); -@@ -705,7 +707,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -661,7 +663,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (! file) goto fail; @@ -48,7 +48,7 @@ index 9b53d3168f9..f7186be4002 100644 { if (!grub_errno) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -713,6 +723,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -669,6 +679,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -58,7 +58,7 @@ index 9b53d3168f9..f7186be4002 100644 if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) { grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); -@@ -804,6 +817,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -760,6 +773,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), preferred_address)) goto fail; @@ -66,10 +66,10 @@ index 9b53d3168f9..f7186be4002 100644 grub_memset (&linux_params, 0, sizeof (linux_params)); grub_memcpy (&linux_params.setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1); -@@ -812,13 +826,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - linux_params.ps_mouse = linux_params.padding10 = 0; +@@ -782,13 +796,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + /* We've already read lh so there is no need to read it second time. */ + len -= sizeof(lh); - len = sizeof (linux_params) - sizeof (lh); - if (grub_file_read (file, (char *) &linux_params + sizeof (lh), len) != len) - { - if (!grub_errno) @@ -77,14 +77,13 @@ index 9b53d3168f9..f7186be4002 100644 - argv[0]); - goto fail; - } -+ + linux_params_ptr = (void *)&linux_params; + grub_memcpy (linux_params_ptr + sizeof (lh), kernel + kernel_offset, len); + kernel_offset += len; linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; -@@ -877,7 +888,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -847,7 +857,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), /* The other parameters are filled when booting. */ @@ -93,8 +92,8 @@ index 9b53d3168f9..f7186be4002 100644 grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n", (unsigned) real_size, (unsigned) prot_size); -@@ -1025,9 +1036,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - (sizeof (LINUX_IMAGE) - 1)); +@@ -1001,9 +1011,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } len = prot_file_size; - if (grub_file_read (file, prot_mode_mem, len) != len && !grub_errno) @@ -104,7 +103,7 @@ index 9b53d3168f9..f7186be4002 100644 if (grub_errno == GRUB_ERR_NONE) { -@@ -1038,6 +1047,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -1014,6 +1022,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), fail: diff --git a/0003-Rework-linux16-command.patch b/0003-Rework-linux16-command.patch index 99d6e7c2..e73423ba 100644 --- a/0003-Rework-linux16-command.patch +++ b/0003-Rework-linux16-command.patch @@ -1,17 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Matthew Garrett -Date: Sun, 9 Aug 2015 16:20:58 -0700 +Date: Fri, 5 Jul 2019 21:12:00 +0200 Subject: [PATCH] Rework linux16 command We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel int it before pulling out the individual blocks later on. --- - grub-core/loader/i386/pc/linux.c | 34 +++++++++++++++++++++------------- - 1 file changed, 21 insertions(+), 13 deletions(-) + grub-core/loader/i386/pc/linux.c | 33 +++++++++++++++++++++------------ + 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index a3c87cf2fc2..caa76bee8af 100644 +index eea25ea39ca..73fb91e0570 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -123,13 +123,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -74,12 +74,11 @@ index a3c87cf2fc2..caa76bee8af 100644 if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) || grub_le_to_cpu16 (lh.version) < 0x0200) -@@ -355,10 +363,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -358,9 +366,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } len = grub_linux16_prot_size; -- if (grub_file_read (file, grub_linux_prot_chunk, grub_linux16_prot_size) -- != (grub_ssize_t) grub_linux16_prot_size && !grub_errno) +- if (grub_file_read (file, grub_linux_prot_chunk, len) != len && !grub_errno) - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), - argv[0]); + grub_memcpy (grub_linux_prot_chunk, kernel + kernel_offset, len); @@ -87,7 +86,7 @@ index a3c87cf2fc2..caa76bee8af 100644 if (grub_errno == GRUB_ERR_NONE) { -@@ -368,6 +374,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -370,6 +377,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), fail: diff --git a/0004-Add-secureboot-support-on-efi-chainloader.patch b/0004-Add-secureboot-support-on-efi-chainloader.patch index 6a347d8a..092032b5 100644 --- a/0004-Add-secureboot-support-on-efi-chainloader.patch +++ b/0004-Add-secureboot-support-on-efi-chainloader.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Raymund Will -Date: Fri, 10 Apr 2015 01:45:02 -0400 +Date: Mon, 8 Jul 2019 11:55:18 +0200 Subject: [PATCH] Add secureboot support on efi chainloader Expand the chainloader to be able to verify the image by means of shim @@ -175,7 +175,7 @@ Signed-off-by: Laszlo Ersek 7 files changed, 840 insertions(+), 91 deletions(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index c8a9d8307c0..91129e33566 100644 +index a0faa40ecf0..3487b0623a4 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -283,14 +283,20 @@ grub_efi_secure_boot (void) @@ -204,18 +204,18 @@ index c8a9d8307c0..91129e33566 100644 if (*secure_boot && !*setup_mode) ret = 1; diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 6c00af98dce..a1ac7a38867 100644 +index a312c668685..04994d5c67d 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c -@@ -282,6 +282,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - grub_file_t file = 0; - struct linux_armxx_kernel_header lh; +@@ -284,6 +284,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + struct linux_arch_kernel_header lh; struct grub_armxx_linux_pe_header *pe; + grub_err_t err; + int rc; grub_dl_ref (my_mod); -@@ -326,7 +327,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -328,7 +329,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); @@ -226,7 +226,7 @@ index 6c00af98dce..a1ac7a38867 100644 grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); goto fail; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index adc85636633..af2189619a3 100644 +index cd92ea3f24b..ef87b06cf70 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -32,6 +32,8 @@ @@ -261,7 +261,7 @@ index adc85636633..af2189619a3 100644 grub_dl_unref (my_mod); return GRUB_ERR_NONE; -@@ -173,7 +181,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) +@@ -179,7 +187,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) /* Fill the file path for the directory. */ d = (grub_efi_device_path_t *) ((char *) file_path + ((char *) d - (char *) dp)); @@ -269,7 +269,7 @@ index adc85636633..af2189619a3 100644 copy_file_path ((grub_efi_file_path_device_path_t *) d, dir_start, dir_end - dir_start); -@@ -191,20 +198,690 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) +@@ -197,20 +204,690 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) return file_path; } @@ -963,7 +963,7 @@ index adc85636633..af2189619a3 100644 if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -216,15 +893,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -222,15 +899,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), address = 0; image_handle = 0; file_path = 0; @@ -997,7 +997,7 @@ index adc85636633..af2189619a3 100644 + *(--p16) = 0; + } + - file = grub_file_open (filename); + file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE); if (! file) goto fail; @@ -1011,7 +1011,7 @@ index adc85636633..af2189619a3 100644 if (! dev) goto fail; -@@ -261,17 +968,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -267,17 +974,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (! file_path) goto fail; @@ -1032,7 +1032,7 @@ index adc85636633..af2189619a3 100644 status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES, GRUB_EFI_LOADER_CODE, -@@ -285,7 +989,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -291,7 +995,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } boot_image = (void *) ((grub_addr_t) address); @@ -1041,7 +1041,7 @@ index adc85636633..af2189619a3 100644 { if (grub_errno == GRUB_ERR_NONE) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -295,7 +999,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -301,7 +1005,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } #if defined (__i386__) || defined (__x86_64__) @@ -1050,7 +1050,7 @@ index adc85636633..af2189619a3 100644 { struct grub_macho_fat_header *head = boot_image; if (head->magic -@@ -304,6 +1008,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -310,6 +1014,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_uint32_t i; struct grub_macho_fat_arch *archs = (struct grub_macho_fat_arch *) (head + 1); @@ -1065,7 +1065,7 @@ index adc85636633..af2189619a3 100644 for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++) { if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype)) -@@ -318,79 +1030,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -324,79 +1036,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), > ~grub_cpu_to_le32 (archs[i].size) || grub_cpu_to_le32 (archs[i].offset) + grub_cpu_to_le32 (archs[i].size) @@ -1162,7 +1162,7 @@ index adc85636633..af2189619a3 100644 if (dev) grub_device_close (dev); -@@ -402,6 +1074,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -408,6 +1080,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (address) efi_call_2 (b->free_pages, address, pages); @@ -1218,10 +1218,10 @@ index c24202a5dd1..c8ecce6dfd0 100644 #pragma GCC diagnostic push diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3db82e782df..8db228c5bf5 100644 +index bb2616a8092..6b24cbb9483 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -118,6 +118,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -117,6 +117,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -1230,15 +1230,15 @@ index 3db82e782df..8db228c5bf5 100644 params->ramdisk_size = size; params->ramdisk_image = (grub_uint32_t)(grub_addr_t) initrd_mem; -@@ -160,6 +162,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - struct linux_kernel_header lh; +@@ -159,6 +161,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + struct linux_i386_kernel_header lh; grub_ssize_t len, start, filelen; void *kernel = NULL; + int rc; grub_dl_ref (my_mod); -@@ -185,11 +188,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -184,11 +187,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (grub_file_read (file, kernel, filelen) != filelen) { @@ -1254,7 +1254,7 @@ index 3db82e782df..8db228c5bf5 100644 { grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); -@@ -204,6 +209,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -203,6 +208,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -1263,7 +1263,7 @@ index 3db82e782df..8db228c5bf5 100644 grub_memset (params, 0, 16384); grub_memcpy (&lh, kernel, sizeof (lh)); -@@ -242,6 +249,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -241,6 +248,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -1299,10 +1299,10 @@ index d9ede36773b..0033d9305a9 100644 grub_err_t EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index 7d44732d2c3..c03cc599f63 100644 +index 0ed8781f037..a43adf27464 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h -@@ -214,7 +214,11 @@ struct grub_pe64_optional_header +@@ -223,7 +223,11 @@ struct grub_pe64_optional_header struct grub_pe32_section_table { char name[8]; @@ -1315,7 +1315,7 @@ index 7d44732d2c3..c03cc599f63 100644 grub_uint32_t virtual_address; grub_uint32_t raw_data_size; grub_uint32_t raw_data_offset; -@@ -225,12 +229,18 @@ struct grub_pe32_section_table +@@ -234,12 +238,18 @@ struct grub_pe32_section_table grub_uint32_t characteristics; }; @@ -1338,7 +1338,7 @@ index 7d44732d2c3..c03cc599f63 100644 #define GRUB_PE32_SCN_ALIGN_1BYTES 0x00100000 #define GRUB_PE32_SCN_ALIGN_2BYTES 0x00200000 -@@ -239,10 +249,28 @@ struct grub_pe32_section_table +@@ -248,10 +258,28 @@ struct grub_pe32_section_table #define GRUB_PE32_SCN_ALIGN_16BYTES 0x00500000 #define GRUB_PE32_SCN_ALIGN_32BYTES 0x00600000 #define GRUB_PE32_SCN_ALIGN_64BYTES 0x00700000 @@ -1367,7 +1367,7 @@ index 7d44732d2c3..c03cc599f63 100644 #define GRUB_PE32_SIGNATURE_SIZE 4 struct grub_pe32_header -@@ -265,6 +293,20 @@ struct grub_pe32_header +@@ -274,6 +302,20 @@ struct grub_pe32_header #endif }; diff --git a/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 3c86beec..382fd234 100644 --- a/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -38,10 +38,10 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/sparc64/linux.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 0b4b0c2122d..e92a7ef322f 100644 +index 581d9dfc3b3..eb1088fd654 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -195,6 +195,7 @@ kernel = { +@@ -207,6 +207,7 @@ kernel = { i386_multiboot = kern/i386/pc/acpi.c; i386_coreboot = kern/acpi.c; i386_multiboot = kern/acpi.c; @@ -114,7 +114,7 @@ index 98769eadb34..088cbe9e2bc 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 04e804d1668..621070918d4 100644 +index 896bebfd57e..d7718d26abc 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -32,6 +32,7 @@ @@ -126,7 +126,7 @@ index 04e804d1668..621070918d4 100644 /* Platforms where modules are in a readonly area of memory. */ #if defined(GRUB_MACHINE_QEMU) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 91129e33566..708581fcbde 100644 +index 3487b0623a4..6e1ceb90516 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -273,40 +273,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -272,7 +272,7 @@ index 74888c463ba..69c2a10d351 100644 grub_unregister_command (cmd); } diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index af2189619a3..5cd9b6e08a8 100644 +index ef87b06cf70..5aa3a5dc7dd 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -34,6 +34,7 @@ @@ -284,10 +284,10 @@ index af2189619a3..5cd9b6e08a8 100644 #include #include diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 7f96515da65..87709aa23e8 100644 +index 3730ed38247..5b9b92d6ba5 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c -@@ -38,6 +38,7 @@ +@@ -39,6 +39,7 @@ #ifdef GRUB_MACHINE_PCBIOS #include #endif @@ -295,7 +295,7 @@ index 7f96515da65..87709aa23e8 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -2124,6 +2125,9 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk; +@@ -2130,6 +2131,9 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk; GRUB_MOD_INIT (bsd) { @@ -305,7 +305,7 @@ index 7f96515da65..87709aa23e8 100644 /* Net and OpenBSD kernels are often compressed. */ grub_dl_load ("gzio"); -@@ -2163,6 +2167,9 @@ GRUB_MOD_INIT (bsd) +@@ -2169,6 +2173,9 @@ GRUB_MOD_INIT (bsd) GRUB_MOD_FINI (bsd) { @@ -316,18 +316,18 @@ index 7f96515da65..87709aa23e8 100644 grub_unregister_extcmd (cmd_openbsd); grub_unregister_extcmd (cmd_netbsd); diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index f7186be4002..c84747ea857 100644 +index b255c950526..376c726928a 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c -@@ -35,6 +35,7 @@ - #include +@@ -36,6 +36,7 @@ #include #include + #include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -1156,6 +1157,9 @@ static grub_command_t cmd_linux, cmd_initrd; +@@ -1131,6 +1132,9 @@ static grub_command_t cmd_linux, cmd_initrd; GRUB_MOD_INIT(linux) { @@ -337,7 +337,7 @@ index f7186be4002..c84747ea857 100644 cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux.")); cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, -@@ -1165,6 +1169,9 @@ GRUB_MOD_INIT(linux) +@@ -1140,6 +1144,9 @@ GRUB_MOD_INIT(linux) GRUB_MOD_FINI(linux) { @@ -348,7 +348,7 @@ index f7186be4002..c84747ea857 100644 grub_unregister_command (cmd_initrd); } diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index caa76bee8af..783a3cd93bc 100644 +index 73fb91e0570..fe3e1d41d09 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -35,6 +35,7 @@ @@ -359,7 +359,7 @@ index caa76bee8af..783a3cd93bc 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -480,6 +481,9 @@ static grub_command_t cmd_linux, cmd_linux16, cmd_initrd, cmd_initrd16; +@@ -483,6 +484,9 @@ static grub_command_t cmd_linux, cmd_linux16, cmd_initrd, cmd_initrd16; GRUB_MOD_INIT(linux16) { @@ -369,7 +369,7 @@ index caa76bee8af..783a3cd93bc 100644 cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux.")); -@@ -497,6 +501,9 @@ GRUB_MOD_INIT(linux16) +@@ -500,6 +504,9 @@ GRUB_MOD_INIT(linux16) GRUB_MOD_FINI(linux16) { @@ -380,7 +380,7 @@ index caa76bee8af..783a3cd93bc 100644 grub_unregister_command (cmd_linux16); grub_unregister_command (cmd_initrd); diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index 40c67e82489..26df46a4161 100644 +index 4a98d708259..3e6ad166dc9 100644 --- a/grub-core/loader/multiboot.c +++ b/grub-core/loader/multiboot.c @@ -50,6 +50,7 @@ @@ -391,7 +391,7 @@ index 40c67e82489..26df46a4161 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -446,6 +447,9 @@ static grub_command_t cmd_multiboot, cmd_module; +@@ -444,6 +445,9 @@ static grub_command_t cmd_multiboot, cmd_module; GRUB_MOD_INIT(multiboot) { @@ -401,7 +401,7 @@ index 40c67e82489..26df46a4161 100644 cmd_multiboot = #ifdef GRUB_USE_MULTIBOOT2 grub_register_command ("multiboot2", grub_cmd_multiboot, -@@ -466,6 +470,9 @@ GRUB_MOD_INIT(multiboot) +@@ -464,6 +468,9 @@ GRUB_MOD_INIT(multiboot) GRUB_MOD_FINI(multiboot) { @@ -412,18 +412,18 @@ index 40c67e82489..26df46a4161 100644 grub_unregister_command (cmd_module); } diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index c9885b1bcd7..df8dfdb4ba0 100644 +index 7f74d1d6fc9..e0f47e72b06 100644 --- a/grub-core/loader/xnu.c +++ b/grub-core/loader/xnu.c -@@ -33,6 +33,7 @@ - #include +@@ -34,6 +34,7 @@ #include #include + #include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -1469,6 +1470,9 @@ static grub_extcmd_t cmd_splash; +@@ -1478,6 +1479,9 @@ static grub_extcmd_t cmd_splash; GRUB_MOD_INIT(xnu) { @@ -433,7 +433,7 @@ index c9885b1bcd7..df8dfdb4ba0 100644 cmd_kernel = grub_register_command ("xnu_kernel", grub_cmd_xnu_kernel, 0, N_("Load XNU image.")); cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64, -@@ -1509,6 +1513,9 @@ GRUB_MOD_INIT(xnu) +@@ -1518,6 +1522,9 @@ GRUB_MOD_INIT(xnu) GRUB_MOD_FINI(xnu) { @@ -444,7 +444,7 @@ index c9885b1bcd7..df8dfdb4ba0 100644 grub_unregister_command (cmd_resume); #endif diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 1061aee9726..39480b38674 100644 +index 6840bfee9b7..090c8621066 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -85,7 +85,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, @@ -503,7 +503,7 @@ diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index f4ff62b769a..9c69aa88626 100644 +index 3ea8e7ff45f..c6ba5b2d763 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -71,6 +71,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h diff --git a/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch b/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch index 76b1183d..274321e3 100644 --- a/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +++ b/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Tue, 14 Feb 2017 16:18:54 -0500 +Date: Mon, 8 Jul 2019 12:32:37 +0200 Subject: [PATCH] Handle multi-arch (64-on-32) boot in linuxefi loader. Allow booting 64-bit kernels on 32-bit EFI on x86. @@ -37,7 +37,7 @@ index c8ecce6dfd0..0622dfa48d4 100644 return GRUB_ERR_BUG; diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 8db228c5bf5..800c3e54022 100644 +index 6b24cbb9483..3017d0f3e52 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -44,14 +44,10 @@ static char *linux_cmdline; @@ -57,12 +57,12 @@ index 8db228c5bf5..800c3e54022 100644 params); } -@@ -154,14 +150,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -153,14 +149,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), return grub_errno; } +#define MIN(a, b) \ -+ ({ typeof (a) _a = (a); \ ++ ({ typeof (a) _a = (a); \ + typeof (b) _b = (b); \ + _a < _b ? _a : _b; }) + @@ -71,7 +71,7 @@ index 8db228c5bf5..800c3e54022 100644 int argc, char *argv[]) { grub_file_t file = 0; -- struct linux_kernel_header lh; +- struct linux_i386_kernel_header lh; - grub_ssize_t len, start, filelen; + struct linux_i386_kernel_header *lh = NULL; + grub_ssize_t start, filelen; @@ -80,7 +80,7 @@ index 8db228c5bf5..800c3e54022 100644 int rc; grub_dl_ref (my_mod); -@@ -201,48 +203,79 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -200,48 +202,79 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -172,12 +172,13 @@ index 8db228c5bf5..800c3e54022 100644 if (!linux_cmdline) { grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline")); -@@ -255,21 +288,23 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -254,22 +287,24 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); grub_create_loader_cmdline (argc, argv, linux_cmdline + sizeof (LINUX_IMAGE) - 1, -- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1)); -+ lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1)); +- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1), ++ lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1), + GRUB_VERIFY_KERNEL_CMDLINE); - lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; + grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline); @@ -244,10 +245,10 @@ index 8db228c5bf5..800c3e54022 100644 if (kernel_mem && !loaded) grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index bb19dbd5a77..8474a857ed2 100644 +index ce30e7fb01b..a093679cb80 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h -@@ -133,7 +133,12 @@ struct linux_i386_kernel_header +@@ -136,7 +136,12 @@ struct linux_i386_kernel_header grub_uint32_t kernel_alignment; grub_uint8_t relocatable; grub_uint8_t min_alignment; diff --git a/0007-re-write-.gitignore.patch b/0007-re-write-.gitignore.patch index 34deea72..25731397 100644 --- a/0007-re-write-.gitignore.patch +++ b/0007-re-write-.gitignore.patch @@ -1,33 +1,42 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Tue, 8 Aug 2017 12:48:04 -0400 +Date: Mon, 8 Jul 2019 12:55:29 +0200 Subject: [PATCH] re-write .gitignore --- - .gitignore | 357 +++++++++++++------------------------- - build-aux/.gitignore | 9 + - docs/.gitignore | 4 + - grub-core/.gitignore | 15 ++ - grub-core/gnulib/.gitignore | 22 +++ + .gitignore | 366 +++++++++++++++----------------------- + docs/.gitignore | 5 + + grub-core/.gitignore | 16 ++ grub-core/lib/.gitignore | 1 + include/grub/gcrypt/.gitignore | 2 + - po/.gitignore | 4 + - util/bash-completion.d/.gitignore | 1 + - 9 files changed, 175 insertions(+), 240 deletions(-) - create mode 100644 build-aux/.gitignore + po/.gitignore | 5 + + util/bash-completion.d/.gitignore | 2 + + 7 files changed, 171 insertions(+), 226 deletions(-) create mode 100644 docs/.gitignore create mode 100644 grub-core/.gitignore - create mode 100644 grub-core/gnulib/.gitignore create mode 100644 grub-core/lib/.gitignore create mode 100644 include/grub/gcrypt/.gitignore create mode 100644 po/.gitignore create mode 100644 util/bash-completion.d/.gitignore diff --git a/.gitignore b/.gitignore -index eca17bec9b8..43f04d47277 100644 +index 819cd185d44..b45a633f3d1 100644 --- a/.gitignore +++ b/.gitignore -@@ -1,249 +1,126 @@ +@@ -1,237 +1,151 @@ ++# things ./autogen.sh will create ++/Makefile.utilgcry.def ++/ABOUT-NLS ++/aclocal.m4 ++/autom4te.cache ++/build-aux ++/configure ++/gnulib ++/grub-core/lib/gnulib/ ++/Makefile ++ ++# things very common editors create that we never want + *~ -00_header -10_* -20_linux_xen @@ -36,11 +45,13 @@ index eca17bec9b8..43f04d47277 100644 -41_custom -*.1 -*.8 +-ABOUT-NLS -aclocal.m4 -ahci_test -ascii.bitmaps -ascii.h -autom4te.cache +-build-aux -build-grub-gen-asciih -build-grub-gen-widthspec -build-grub-mkfont @@ -64,26 +75,18 @@ index eca17bec9b8..43f04d47277 100644 -example_grub_script_test -example_scripted_test -example_unit_test -+# things ./autogen.sh will create -+/Makefile.utilgcry.def -+/aclocal.m4 -+/autom4te.cache -+/configure -+Makefile -+# we want to enable building in a subdirectory, but we don't want to exclude -+# /build-aux so explicitly don't ignore it. -+/build*/ -+!/build-aux/ -+ -+# things very common editors create that we never want -+*~ +.*.sw? +*.patch + ++# stuff you're likely to make while building test trees ++grub.cfg ++/build*/ ++ +# built objects across the whole tree +Makefile.in +*.a +*.am ++*.efi *.exec -*.exec.exe -fddboot_test @@ -92,6 +95,7 @@ index eca17bec9b8..43f04d47277 100644 -gentrigtables -gentrigtables.exe -gettext_strings_test +-/gnulib -grub-bin2h -/grub-bios-setup -/grub-bios-setup.exe @@ -184,6 +188,7 @@ index eca17bec9b8..43f04d47277 100644 -*.image.exe -include/grub/cpu -include/grub/machine +-INSTALL.grub -install-sh -lib/libgcrypt-grub -libgrub_a_init.c @@ -194,6 +199,7 @@ index eca17bec9b8..43f04d47277 100644 -lzocompress_test *.marker -Makefile + /m4 *.mod -mod-*.c -missing @@ -208,7 +214,11 @@ index eca17bec9b8..43f04d47277 100644 -*.pp -po/*.mo -po/grub.pot +-po/Makefile.in.in +-po/Makevars +-po/Makevars.template -po/POTFILES +-po/Rules-quot -po/stamp-po -printf_test -priority_queue_unit_test @@ -259,25 +269,7 @@ index eca17bec9b8..43f04d47277 100644 -grub-core/*.pp -grub-core/kernel.img.bin -util/bash-completion.d/grub --grub-core/gnulib/alloca.h --grub-core/gnulib/arg-nonnull.h --grub-core/gnulib/c++defs.h --grub-core/gnulib/charset.alias --grub-core/gnulib/configmake.h --grub-core/gnulib/float.h --grub-core/gnulib/getopt.h --grub-core/gnulib/langinfo.h --grub-core/gnulib/ref-add.sed --grub-core/gnulib/ref-del.sed --grub-core/gnulib/stdio.h --grub-core/gnulib/stdlib.h --grub-core/gnulib/string.h --grub-core/gnulib/strings.h --grub-core/gnulib/sys --grub-core/gnulib/unistd.h --grub-core/gnulib/warn-on-use.h --grub-core/gnulib/wchar.h --grub-core/gnulib/wctype.h +-grub-core/lib/gnulib -grub-core/rs_decoder.h -widthspec.bin -widthspec.h @@ -296,10 +288,6 @@ index eca17bec9b8..43f04d47277 100644 -/grub-render-label -/grub-glue-efi.exe -/grub-render-label.exe --grub-core/gnulib/locale.h --grub-core/gnulib/unitypes.h --grub-core/gnulib/uniwidth.h --build-aux/test-driver + +# next are things you get if you do ./configure in the topdir (for e.g. +# "make dist" invocation. @@ -307,9 +295,16 @@ index eca17bec9b8..43f04d47277 100644 +/config.h +/include/grub/cpu +/include/grub/machine ++/INSTALL ++/INSTALL.grub ++/po/Makefile.in.in ++/po/Makevars ++/po/Makevars.template +/po/POTFILES ++/po/Rules-quot +/stamp-h +/stamp-h1 ++bootstrap.log +config.log +config.status + @@ -338,6 +333,8 @@ index eca17bec9b8..43f04d47277 100644 +/grub*-fs-tester +/grub*-fstest +/grub*-fstest.1 ++/grub*-get-kernel-settings ++/grub*-get-kernel-settings.3 +/grub*-glue-efi +/grub*-glue-efi.1 +/grub*-install @@ -348,6 +345,8 @@ index eca17bec9b8..43f04d47277 100644 +/grub*-macbless.8 +/grub*-menulst2cfg +/grub*-menulst2cfg.1 ++/grub*-mount ++/grub*-mount.1 +/grub*-mkconfig +/grub*-mkconfig.8 +/grub*-mkconfig_lib @@ -375,16 +374,24 @@ index eca17bec9b8..43f04d47277 100644 +/grub*-reboot.8 +/grub*-render-label +/grub*-render-label.1 ++/grub*-rpm-sort ++/grub*-rpm-sort.8 +/grub*-script-check +/grub*-script-check.1 ++/grub*-set-bootflag ++/grub*-set-bootflag.1 +/grub*-set-default +/grub*-set-default.8 ++/grub*-set-password ++/grub*-set-password.8 +/grub*-shell +/grub*-shell-tester +/grub*-sparc64-setup +/grub*-sparc64-setup.8 +/grub*-syslinux2cfg +/grub*-syslinux2cfg.1 ++/grub*-switch-to-blscfg ++/grub*-switch-to-blscfg.8 +/grub_fstest.pp +/grub_fstest_init.c +/grub_fstest_init.lst @@ -394,38 +401,25 @@ index eca17bec9b8..43f04d47277 100644 +/libgrub_a_init.lst +/stamp-h.in +/widthspec.h -diff --git a/build-aux/.gitignore b/build-aux/.gitignore -new file mode 100644 -index 00000000000..f2f17aab9ff ---- /dev/null -+++ b/build-aux/.gitignore -@@ -0,0 +1,9 @@ -+/compile -+/config.guess -+/config.sub -+/depcomp -+/install-sh -+/mdate-sh -+/missing -+/test-driver -+/texinfo.tex diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 -index 00000000000..91aee84d3e9 +index 00000000000..e1d849ef95b --- /dev/null +++ b/docs/.gitignore -@@ -0,0 +1,4 @@ +@@ -0,0 +1,5 @@ +/*.in ++/Makefile +/stamp-1 +/stamp-vti +/version*.texi diff --git a/grub-core/.gitignore b/grub-core/.gitignore new file mode 100644 -index 00000000000..c738ac6c649 +index 00000000000..2acce281159 --- /dev/null +++ b/grub-core/.gitignore -@@ -0,0 +1,15 @@ +@@ -0,0 +1,16 @@ +/*.lst ++/Makefile +/Makefile.gcry.def +/unidata.c +/build-grub-module-verifier @@ -440,34 +434,6 @@ index 00000000000..c738ac6c649 +/symlist.c +/symlist.h +/trigtables.c -diff --git a/grub-core/gnulib/.gitignore b/grub-core/gnulib/.gitignore -new file mode 100644 -index 00000000000..29e199c2db4 ---- /dev/null -+++ b/grub-core/gnulib/.gitignore -@@ -0,0 +1,22 @@ -+/alloca.h -+/arg-nonnull.h -+/c++defs.h -+/charset.alias -+/configmake.h -+/getopt.h -+/langinfo.h -+/libgnu.a -+/locale.h -+/ref-add.sed -+/ref-del.sed -+/stdio.h -+/stdlib.h -+/string.h -+/strings.h -+/sys/ -+/unistd.h -+/unitypes.h -+/uniwidth.h -+/warn-on-use.h -+/wchar.h -+/wctype.h diff --git a/grub-core/lib/.gitignore b/grub-core/lib/.gitignore new file mode 100644 index 00000000000..68154591404 @@ -485,18 +451,20 @@ index 00000000000..8fbf5646246 +gcrypt.h diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 -index 00000000000..97b679c3138 +index 00000000000..f507e7741e3 --- /dev/null +++ b/po/.gitignore -@@ -0,0 +1,4 @@ +@@ -0,0 +1,5 @@ ++/Makefile +/POTFILES*.in +/grub.pot +/remove-potcdate.sed +/stamp-po diff --git a/util/bash-completion.d/.gitignore b/util/bash-completion.d/.gitignore new file mode 100644 -index 00000000000..b7e1eb12428 +index 00000000000..6813a527ad3 --- /dev/null +++ b/util/bash-completion.d/.gitignore -@@ -0,0 +1 @@ +@@ -0,0 +1,2 @@ ++Makefile +grub diff --git a/0008-IBM-client-architecture-CAS-reboot-support.patch b/0008-IBM-client-architecture-CAS-reboot-support.patch index 0dcaa0ad..4c12e5a7 100644 --- a/0008-IBM-client-architecture-CAS-reboot-support.patch +++ b/0008-IBM-client-architecture-CAS-reboot-support.patch @@ -25,10 +25,10 @@ parameters 4 files changed, 91 insertions(+) diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c -index 62929d983bf..2d53c0e8608 100644 +index 4d493ab7661..3a6689abb11 100644 --- a/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c -@@ -588,3 +588,66 @@ grub_ieee1275_get_boot_dev (void) +@@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void) return bootpath; } @@ -96,7 +96,7 @@ index 62929d983bf..2d53c0e8608 100644 + return 0; +} diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 78a70a8bf47..249e19bc788 100644 +index 1b03dfd57b9..222e239c1be 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -33,6 +33,9 @@ @@ -133,20 +133,20 @@ index 78a70a8bf47..249e19bc788 100644 grub_errno = GRUB_ERR_NONE; } diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index a8502d90711..ab78ca87f90 100644 +index ee299fd0ea6..0d05d6b0709 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c -@@ -27,6 +27,9 @@ - #include +@@ -28,6 +28,9 @@ #include #include + #include +#ifdef GRUB_MACHINE_IEEE1275 +#include +#endif /* Max digits for a char is 3 (0xFF is 255), similarly for an int it is sizeof (int) * 3, and one extra for a possible -ve sign. */ -@@ -877,6 +880,10 @@ grub_script_execute_sourcecode (const char *source) +@@ -878,6 +881,10 @@ grub_script_execute_sourcecode (const char *source) grub_err_t ret = 0; struct grub_script *parsed_script; @@ -158,10 +158,10 @@ index a8502d90711..ab78ca87f90 100644 { char *line; diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 8868f3a756f..2310f33dbc2 100644 +index 73e2f464475..0a599607f31 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h -@@ -252,6 +252,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali +@@ -254,6 +254,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias); void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath, struct grub_ieee1275_devalias *alias); diff --git a/0010-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0010-Disable-GRUB-video-support-for-IBM-power-machines.patch index ab411af3..430f6002 100644 --- a/0010-Disable-GRUB-video-support-for-IBM-power-machines.patch +++ b/0010-Disable-GRUB-video-support-for-IBM-power-machines.patch @@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=973205 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 3e12e6b24e1..3e14f539368 100644 +index 20cbbd761ec..04df9d2c667 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c @@ -90,7 +90,10 @@ grub_ieee1275_find_options (void) @@ -48,14 +48,14 @@ index 17a3dbbb575..b8e4b3feb32 100644 GRUB_MOD_FINI(ieee1275_fb) diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 2310f33dbc2..ca08bd96681 100644 +index 0a599607f31..b5a1d49bbc3 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h -@@ -146,6 +146,8 @@ enum grub_ieee1275_flag - GRUB_IEEE1275_FLAG_BROKEN_REPEAT, - +@@ -148,6 +148,8 @@ enum grub_ieee1275_flag GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN, -+ + + GRUB_IEEE1275_FLAG_RAW_DEVNAMES, ++ + GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT }; diff --git a/0011-Honor-a-symlink-when-generating-configuration-by-gru.patch b/0011-Honor-a-symlink-when-generating-configuration-by-gru.patch index 1ea476c3..2b953a6a 100644 --- a/0011-Honor-a-symlink-when-generating-configuration-by-gru.patch +++ b/0011-Honor-a-symlink-when-generating-configuration-by-gru.patch @@ -11,7 +11,7 @@ the -o option follows it rather than overwriting it with a regular file. 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 33332360eec..bc5a3f17541 100644 +index 9f477ff0546..523d4e029bb 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -287,7 +287,8 @@ and /etc/grub.d/* files or please file a bug report with diff --git a/0012-Move-bash-completion-script-922997.patch b/0012-Move-bash-completion-script-922997.patch index 6c3c773c..e3af5868 100644 --- a/0012-Move-bash-completion-script-922997.patch +++ b/0012-Move-bash-completion-script-922997.patch @@ -10,10 +10,10 @@ Apparently these go in a new place now. 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index c7888e40f66..783118ccdcd 100644 +index 7656f2434e5..d283af64c8c 100644 --- a/configure.ac +++ b/configure.ac -@@ -289,6 +289,14 @@ AC_SUBST(grubdirname) +@@ -305,6 +305,14 @@ AC_SUBST(grubdirname) AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", [Default grub directory name]) @@ -28,7 +28,7 @@ index c7888e40f66..783118ccdcd 100644 # # Checks for build programs. # -@@ -498,6 +506,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" +@@ -516,6 +524,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" # Check for target programs. # diff --git a/0014-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0014-Allow-fallback-to-include-entries-by-title-not-just-.patch index bee65ed2..ee5d1dae 100644 --- a/0014-Allow-fallback-to-include-entries-by-title-not-just-.patch +++ b/0014-Allow-fallback-to-include-entries-by-title-not-just-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index e7a83c2d6e2..d2f64b05e0a 100644 +index d5e0c79a70e..9175ad297d8 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -163,16 +163,41 @@ grub_menu_set_timeout (int timeout) diff --git a/0015-Add-GRUB_DISABLE_UUID.patch b/0015-Add-GRUB_DISABLE_UUID.patch index a6856d28..7051dd7b 100644 --- a/0015-Add-GRUB_DISABLE_UUID.patch +++ b/0015-Add-GRUB_DISABLE_UUID.patch @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 2adfa97bee8..2fd32608c01 100644 +index 87795075a87..6f524305085 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1441,6 +1441,13 @@ enable the use of partition UUIDs, set this option to @samp{false}. @@ -33,7 +33,7 @@ index 2adfa97bee8..2fd32608c01 100644 If graphical video support is required, either because the @samp{gfxterm} graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set, diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index bc5a3f17541..b0a8626dd1c 100644 +index 523d4e029bb..9ecbcfb5b43 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -133,12 +133,12 @@ fi diff --git a/0016-Make-exit-take-a-return-code.patch b/0016-Make-exit-take-a-return-code.patch index 40c848ff..0cd25b2f 100644 --- a/0016-Make-exit-take-a-return-code.patch +++ b/0016-Make-exit-take-a-return-code.patch @@ -27,10 +27,10 @@ Signed-off-by: Peter Jones 14 files changed, 48 insertions(+), 21 deletions(-) diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c -index a3a11824172..b25ca4b9f17 100644 +index 6bbce3128cf..6d66b7c453a 100644 --- a/grub-core/commands/minicmd.c +++ b/grub-core/commands/minicmd.c -@@ -176,12 +176,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), +@@ -179,12 +179,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), } /* exit */ @@ -60,7 +60,7 @@ index a3a11824172..b25ca4b9f17 100644 } diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 708581fcbde..e339f264b3a 100644 +index 6e1ceb90516..370ce03c5d7 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -164,11 +164,16 @@ grub_reboot (void) @@ -96,10 +96,10 @@ index 425bb960347..55ea5a11ccd 100644 grub_reboot (); } diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 76661337f10..82012a72fcb 100644 +index 65db79baa10..19cd007d448 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -137,9 +137,10 @@ xasprintf (const char *fmt, ...) +@@ -139,9 +139,10 @@ xasprintf (const char *fmt, ...) #if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL) void @@ -139,10 +139,10 @@ index 271b6fbfabd..9fafe98f015 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 0d8ebf58b95..f5423ce27d9 100644 +index d483e35eed2..e71d1584164 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -68,7 +68,7 @@ grub_addr_t grub_ieee1275_original_stack; +@@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack; #endif void @@ -240,10 +240,10 @@ index 3e338645c57..be2a5be1d07 100644 else if (ver > API_SIG_VERSION) { diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c -index 0559c033c3d..fce526d417b 100644 +index 782ca72952a..708b060f324 100644 --- a/grub-core/kern/xen/init.c +++ b/grub-core/kern/xen/init.c -@@ -549,7 +549,7 @@ grub_machine_init (void) +@@ -584,7 +584,7 @@ grub_machine_init (void) } void @@ -253,7 +253,7 @@ index 0559c033c3d..fce526d417b 100644 struct sched_shutdown arg; diff --git a/include/grub/misc.h b/include/grub/misc.h -index 372f009e84f..83fd69f4ada 100644 +index ee48eb7a726..f9135b62e35 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -334,7 +334,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, diff --git a/0018-Make-efi-machines-load-an-env-block-from-a-variable.patch b/0018-Make-efi-machines-load-an-env-block-from-a-variable.patch index 2748c1c6..9665d7bf 100644 --- a/0018-Make-efi-machines-load-an-env-block-from-a-variable.patch +++ b/0018-Make-efi-machines-load-an-env-block-from-a-variable.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index e92a7ef322f..f8065388213 100644 +index eb1088fd654..41b5e16a3ce 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -191,6 +191,7 @@ kernel = { +@@ -203,6 +203,7 @@ kernel = { efi = term/efi/console.c; efi = kern/acpi.c; efi = kern/efi/acpi.c; diff --git a/0019-DHCP-client-ID-and-UUID-options-added.patch b/0019-DHCP-client-ID-and-UUID-options-added.patch index ddc17fe8..6167b622 100644 --- a/0019-DHCP-client-ID-and-UUID-options-added.patch +++ b/0019-DHCP-client-ID-and-UUID-options-added.patch @@ -1,31 +1,31 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo -Date: Tue, 27 Nov 2012 17:18:53 -0200 +Date: Mon, 8 Jul 2019 14:10:58 +0200 Subject: [PATCH] DHCP client ID and UUID options added. --- - grub-core/net/bootp.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++----- + grub-core/net/bootp.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++----- include/grub/net.h | 2 ++ - 2 files changed, 81 insertions(+), 8 deletions(-) + 2 files changed, 79 insertions(+), 8 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 9e2fdb795f5..f03eeab2fb4 100644 +index 04cfbb04504..0e6e41a1699 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c -@@ -25,6 +25,49 @@ - #include - #include +@@ -95,6 +95,49 @@ enum + /* Max timeout when waiting for BOOTP/DHCP reply */ + #define GRUB_DHCP_MAX_PACKET_TIMEOUT 32 +static char * +grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)), -+ const char *val __attribute__ ((unused))) ++ const char *val __attribute__ ((unused))) +{ + return NULL; +} + +static void +set_env_limn_ro (const char *intername, const char *suffix, -+ const char *value, grub_size_t len) ++ const char *value, grub_size_t len) +{ + char *varname, *varvalue; + char *ptr; @@ -59,60 +59,58 @@ index 9e2fdb795f5..f03eeab2fb4 100644 + return val + 'a' - 10; +} + - static void - parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) - { -@@ -55,6 +98,9 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) - - taglength = *ptr++; + static const void * + find_dhcp_option (const struct grub_net_bootp_packet *bp, grub_size_t size, + grub_uint8_t opt_code, grub_uint8_t *opt_len) +@@ -152,6 +195,9 @@ again: + if (i + taglength >= size) + return NULL; + grub_dprintf("net", "DHCP option %u (0x%02x) found with length %u.\n", + tagtype, tagtype, taglength); + - switch (tagtype) + /* FIXME RFC 3396 options concatentation */ + if (tagtype == opt_code) { - case GRUB_NET_BOOTP_NETMASK: -@@ -120,6 +166,39 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) - taglength); - break; +@@ -354,6 +400,37 @@ grub_net_configure_by_dhcp_ack (const char *name, + } + grub_net_add_ipv4_local (inter, mask); -+ case GRUB_NET_BOOTP_CLIENT_ID: -+ set_env_limn_ro (name, "clientid", (char *) ptr, taglength); -+ break; ++ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_CLIENT_ID, &opt_len); ++ if (opt) ++ { ++ set_env_limn_ro (name, "clientid", (char *) opt, opt_len); ++ } + -+ case GRUB_NET_BOOTP_CLIENT_UUID: ++ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_CLIENT_UUID, &opt_len); ++ if (opt && opt_len == 17) ++ { ++ /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */ ++ ++ opt += 1; ++ opt_len -= 1; ++ ++ char *val = grub_malloc (2 * opt_len + 4 + 1); ++ int i = 0; ++ int j = 0; ++ for (i = 0; i < opt_len; i++) ++ { ++ val[2 * i + j] = hexdigit (opt[i] >> 4); ++ val[2 * i + 1 + j] = hexdigit (opt[i] & 0xf); ++ ++ if ((i == 3) || (i == 5) || (i == 7) || (i == 9)) + { -+ if (taglength != 17) -+ break; -+ -+ /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */ -+ -+ ptr += 1; -+ taglength -= 1; -+ -+ char *val = grub_malloc (2 * taglength + 4 + 1); -+ int i = 0; -+ int j = 0; -+ for (i = 0; i < taglength; i++) -+ { -+ val[2 * i + j] = hexdigit (ptr[i] >> 4); -+ val[2 * i + 1 + j] = hexdigit (ptr[i] & 0xf); -+ -+ if ((i == 3) || (i == 5) || (i == 7) || (i == 9)) -+ { -+ j++; -+ val[2 * i + 1+ j] = '-'; -+ } -+ } -+ -+ set_env_limn_ro (name, "clientuuid", (char *) val, 2 * taglength + 4); ++ j++; ++ val[2 * i + 1+ j] = '-'; + } -+ break; ++ } ++ set_env_limn_ro (name, "clientuuid", (char *) val, 2 * opt_len + 4); ++ } + - /* If you need any other options please contact GRUB - development team. */ - } -@@ -302,14 +381,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb, + /* We do not implement dead gateway detection and the first entry SHOULD + be preferred one */ + opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_ROUTER, &opt_len); +@@ -631,14 +708,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb, } } @@ -128,15 +126,15 @@ index 9e2fdb795f5..f03eeab2fb4 100644 grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), int argc, char **args) diff --git a/include/grub/net.h b/include/grub/net.h -index 1096b24322e..e266bae23f4 100644 +index 4a9069a1474..556c54e579f 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -457,6 +457,8 @@ enum +@@ -462,6 +462,8 @@ enum GRUB_NET_BOOTP_DOMAIN = 0x0f, GRUB_NET_BOOTP_ROOT_PATH = 0x11, GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, + GRUB_NET_BOOTP_CLIENT_ID = 0x3d, + GRUB_NET_BOOTP_CLIENT_UUID = 0x61, - GRUB_NET_BOOTP_END = 0xff - }; - + GRUB_NET_DHCP_REQUESTED_IP_ADDRESS = 50, + GRUB_NET_DHCP_OVERLOAD = 52, + GRUB_NET_DHCP_MESSAGE_TYPE = 53, diff --git a/0020-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch b/0020-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch index e219fa54..265e777f 100644 --- a/0020-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch +++ b/0020-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch @@ -20,7 +20,7 @@ Resolves: rhbz#1063414 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 61ebd7dc714..87a7da34982 100644 +index 4532266be68..58defdbd83f 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -261,7 +261,11 @@ while [ "x$list" != "x" ] ; do diff --git a/0022-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0022-Migrate-PPC-from-Yaboot-to-Grub2.patch index 7008926d..3fbb18a7 100644 --- a/0022-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0022-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -12,10 +12,10 @@ maximum screen size so that text is not overwritten. create mode 100644 util/grub.d/20_ppc_terminfo.in diff --git a/Makefile.util.def b/Makefile.util.def -index 3180ac880a9..c7b775bce73 100644 +index 969d32f0097..8717774d510 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -487,6 +487,13 @@ script = { +@@ -496,6 +496,13 @@ script = { condition = COND_HOST_LINUX; }; diff --git a/0023-Add-fw_path-variable-revised.patch b/0023-Add-fw_path-variable-revised.patch index 3126d2e7..36c3b1fe 100644 --- a/0023-Add-fw_path-variable-revised.patch +++ b/0023-Add-fw_path-variable-revised.patch @@ -41,7 +41,7 @@ index 9cad0c4485c..8ab7794c47b 100644 } diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 249e19bc788..759c475c4d9 100644 +index 222e239c1be..394bfbea868 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -338,7 +338,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -59,7 +59,7 @@ index 249e19bc788..759c475c4d9 100644 + { + grub_file_t file; + -+ file = grub_file_open (config); ++ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); + if (file) + { + grub_file_close (file); diff --git a/0024-Pass-x-hex-hex-straight-through-unmolested.patch b/0024-Pass-x-hex-hex-straight-through-unmolested.patch index 5f4884d0..4fd78113 100644 --- a/0024-Pass-x-hex-hex-straight-through-unmolested.patch +++ b/0024-Pass-x-hex-hex-straight-through-unmolested.patch @@ -10,7 +10,7 @@ Subject: [PATCH] Pass "\x[[:hex:]][[:hex:]]" straight through unmolested. 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index 9b4e72766ff..02c46f9fdfa 100644 +index 4a106ca040b..560d437cdc6 100644 --- a/grub-core/commands/wildcard.c +++ b/grub-core/commands/wildcard.c @@ -462,6 +462,12 @@ check_file (const char *dir, const char *basename) @@ -44,7 +44,7 @@ index 9b4e72766ff..02c46f9fdfa 100644 *optr++ = iptr[1]; iptr += 2; diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index d5e10ee8798..0a5b2afb94b 100644 +index ed0b149dca5..e0fb0a9e48a 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/lib/cmdline.c @@ -20,6 +20,12 @@ @@ -75,7 +75,7 @@ index d5e10ee8798..0a5b2afb94b 100644 size++; else if (*c == ' ') space = 1; -@@ -85,7 +97,25 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf, +@@ -86,7 +98,25 @@ grub_create_loader_cmdline (int argc, char *argv[], char *buf, while (*c) { @@ -103,10 +103,10 @@ index d5e10ee8798..0a5b2afb94b 100644 *buf++ = *c; diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index ab78ca87f90..cf6cd6601d6 100644 +index 0d05d6b0709..ba38b5e8aef 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c -@@ -55,6 +55,12 @@ static struct grub_script_scope *scope = 0; +@@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0; /* Wildcard translator for GRUB script. */ struct grub_script_wildcard_translator *grub_wildcard_translator; @@ -119,7 +119,7 @@ index ab78ca87f90..cf6cd6601d6 100644 static char* wildcard_escape (const char *s) { -@@ -71,7 +77,15 @@ wildcard_escape (const char *s) +@@ -72,7 +78,15 @@ wildcard_escape (const char *s) i = 0; while ((ch = *s++)) { @@ -136,7 +136,7 @@ index ab78ca87f90..cf6cd6601d6 100644 p[i++] = '\\'; p[i++] = ch; } -@@ -95,7 +109,14 @@ wildcard_unescape (const char *s) +@@ -96,7 +110,14 @@ wildcard_unescape (const char *s) i = 0; while ((ch = *s++)) { @@ -152,7 +152,7 @@ index ab78ca87f90..cf6cd6601d6 100644 p[i++] = *s++; else p[i++] = ch; -@@ -397,10 +418,20 @@ parse_string (const char *str, +@@ -398,10 +419,20 @@ parse_string (const char *str, switch (*ptr) { case '\\': diff --git a/0026-Search-for-specific-config-file-for-netboot.patch b/0026-Search-for-specific-config-file-for-netboot.patch index 7436e032..f94911cf 100644 --- a/0026-Search-for-specific-config-file-for-netboot.patch +++ b/0026-Search-for-specific-config-file-for-netboot.patch @@ -22,7 +22,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=873406 3 files changed, 135 insertions(+), 4 deletions(-) diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 10773fc3435..0769bf850d3 100644 +index d5d726a315e..06454564b8f 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1735,6 +1735,124 @@ grub_net_restore_hw (void) @@ -43,7 +43,7 @@ index 10773fc3435..0769bf850d3 100644 + grub_dprintf ("net", "probe %s\n", config); + + grub_file_t file; -+ file = grub_file_open (config); ++ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); + + if (file) + { @@ -151,7 +151,7 @@ index 10773fc3435..0769bf850d3 100644 static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 759c475c4d9..b2654ef62e8 100644 +index 394bfbea868..9ef98481f70 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -33,6 +33,7 @@ @@ -187,10 +187,10 @@ index 759c475c4d9..b2654ef62e8 100644 grub_enter_normal_mode (config); grub_free (config); diff --git a/include/grub/net.h b/include/grub/net.h -index e266bae23f4..50d62ab0c8c 100644 +index 556c54e579f..ff6d347f7da 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -566,4 +566,7 @@ extern char *grub_net_default_server; +@@ -578,4 +578,7 @@ extern char *grub_net_default_server; #define VLANTAG_IDENTIFIER 0x8100 diff --git a/0027-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0027-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index 107f16e4..ada4564e 100644 --- a/0027-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0027-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -28,10 +28,10 @@ Signed-off-by: Will Thompson create mode 100644 grub-core/commands/loadenv.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index f8065388213..8bd220a41ba 100644 +index 41b5e16a3ce..57e253ab1a1 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -768,6 +768,16 @@ module = { +@@ -811,6 +811,16 @@ module = { common = commands/blocklist.c; }; @@ -48,7 +48,7 @@ index f8065388213..8bd220a41ba 100644 module = { name = boot; common = commands/boot.c; -@@ -929,6 +939,7 @@ module = { +@@ -988,6 +998,7 @@ module = { module = { name = loadenv; common = commands/loadenv.c; @@ -58,7 +58,7 @@ index f8065388213..8bd220a41ba 100644 diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c new file mode 100644 -index 00000000000..26dbe873fe4 +index 00000000000..54458b14518 --- /dev/null +++ b/grub-core/commands/blscfg.c @@ -0,0 +1,1096 @@ @@ -500,7 +500,7 @@ index 00000000000..26dbe873fe4 + + p = grub_xasprintf ("(%s)%s/%s", info->devid, info->dirname, filename); + -+ f = grub_file_open (p); ++ f = grub_file_open (p, GRUB_FILE_TYPE_CONFIG); + if (!f) + goto finish; + } @@ -886,7 +886,7 @@ index 00000000000..26dbe873fe4 + } + + src = grub_xasprintf ("load_video\n" -+ "set gfx_payload=keep\n" ++ "set gfxpayload=keep\n" + "insmod gzio\n" + "linux %s%s%s%s\n" + "%s", @@ -943,8 +943,8 @@ index 00000000000..26dbe873fe4 + read_entry_info.devid = info->devid; + +read_fallback: -+ r = blsdir_fs->dir (blsdir_dev, read_entry_info.dirname, read_entry, -+ &read_entry_info); ++ r = blsdir_fs->fs_dir (blsdir_dev, read_entry_info.dirname, read_entry, ++ &read_entry_info); + if (r != 0) { + grub_dprintf ("blscfg", "read_entry returned error\n"); + grub_err_t e; @@ -987,7 +987,7 @@ index 00000000000..26dbe873fe4 + if (path) { + len = grub_strlen (path); + if (grub_strcmp (path + len - 5, ".conf") == 0) { -+ rei.file = grub_file_open (path); ++ rei.file = grub_file_open (path, GRUB_FILE_TYPE_CONFIG); + if (!rei.file) + return grub_errno; + /* @@ -1159,7 +1159,7 @@ index 00000000000..26dbe873fe4 + grub_unregister_extcmd (oldcmd); +} diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index b32f3c74cb1..ef8dd74c589 100644 +index db7a8f00273..891eac5a33f 100644 --- a/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c @@ -133,7 +133,7 @@ legacy_file (const char *filename) @@ -1182,7 +1182,7 @@ index b32f3c74cb1..ef8dd74c589 100644 } diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c -index acd93d123ed..91c99456091 100644 +index 3fd664aac33..163b9a09042 100644 --- a/grub-core/commands/loadenv.c +++ b/grub-core/commands/loadenv.c @@ -28,6 +28,8 @@ @@ -1194,7 +1194,7 @@ index acd93d123ed..91c99456091 100644 GRUB_MOD_LICENSE ("GPLv3+"); static const struct grub_arg_option options[] = -@@ -84,81 +86,6 @@ open_envblk_file (char *filename, int untrusted) +@@ -79,81 +81,6 @@ open_envblk_file (char *filename, return file; } @@ -1349,7 +1349,7 @@ index 2c5363da7f5..9faf2be0f64 100644 src[len - 1] = ch; args[argc - 1] = src; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index b2654ef62e8..5116aac6614 100644 +index 9ef98481f70..a326b192c89 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -20,6 +20,7 @@ diff --git a/0028-Add-devicetree-loading.patch b/0028-Add-devicetree-loading.patch index 4cb1a2a7..2558faa1 100644 --- a/0028-Add-devicetree-loading.patch +++ b/0028-Add-devicetree-loading.patch @@ -20,7 +20,7 @@ Signed-off-by: David A. Marlin 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index b0a8626dd1c..f68d4925ee6 100644 +index 9ecbcfb5b43..c645351dd2a 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -254,7 +254,8 @@ export GRUB_DEFAULT \ @@ -34,7 +34,7 @@ index b0a8626dd1c..f68d4925ee6 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 87a7da34982..233754ff296 100644 +index 58defdbd83f..dd3128440c4 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -153,6 +153,13 @@ EOF diff --git a/0029-Don-t-write-messages-to-the-screen.patch b/0029-Don-t-write-messages-to-the-screen.patch index e96a2340..56774342 100644 --- a/0029-Don-t-write-messages-to-the-screen.patch +++ b/0029-Don-t-write-messages-to-the-screen.patch @@ -15,7 +15,7 @@ very appealing. 5 files changed, 5 insertions(+), 40 deletions(-) diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c -index 4880cefe3f8..b22e1bcc94b 100644 +index 4d02e62c109..84d520cd494 100644 --- a/grub-core/gettext/gettext.c +++ b/grub-core/gettext/gettext.c @@ -434,16 +434,12 @@ static char * @@ -143,7 +143,7 @@ index c1addc0df29..68d31de0c4c 100644 movw $LOCAL(firstlist), %di diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 233754ff296..3a5aa0f8dc9 100644 +index dd3128440c4..ceb413fc2e3 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -138,27 +138,20 @@ linux_entry () diff --git a/0030-Don-t-print-GNU-GRUB-header.patch b/0030-Don-t-print-GNU-GRUB-header.patch index 505c6f75..ce45d4bd 100644 --- a/0030-Don-t-print-GNU-GRUB-header.patch +++ b/0030-Don-t-print-GNU-GRUB-header.patch @@ -9,7 +9,7 @@ No one cares. 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 5116aac6614..31b624a23cf 100644 +index a326b192c89..09d0dfe76f1 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -208,15 +208,16 @@ read_config_file (const char *config) diff --git a/0034-Use-the-correct-indentation-for-the-term-help-text.patch b/0034-Use-the-correct-indentation-for-the-term-help-text.patch index b20f0e9a..5a1f0b50 100644 --- a/0034-Use-the-correct-indentation-for-the-term-help-text.patch +++ b/0034-Use-the-correct-indentation-for-the-term-help-text.patch @@ -9,7 +9,7 @@ That is consistent with the menu help text 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 31b624a23cf..7f295e3946b 100644 +index 09d0dfe76f1..7f61c5b618b 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -432,8 +432,8 @@ grub_normal_reader_init (int nested) diff --git a/0040-Don-t-say-GNU-Linux-in-generated-menus.patch b/0040-Don-t-say-GNU-Linux-in-generated-menus.patch index 85b0cde7..ced25602 100644 --- a/0040-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0040-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus. 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 3a5aa0f8dc9..6299836b5cd 100644 +index ceb413fc2e3..2b402d85a52 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -25,7 +25,7 @@ index 3a5aa0f8dc9..6299836b5cd 100644 fi diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index e8143b079dc..972a4b5a03d 100644 +index 96179ea613c..47e0d3f5cd6 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0043-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0043-Add-.eh_frame-to-list-of-relocations-stripped.patch index d837061d..4ab92e52 100644 --- a/0043-Add-.eh_frame-to-list-of-relocations-stripped.patch +++ b/0043-Add-.eh_frame-to-list-of-relocations-stripped.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Add .eh_frame to list of relocations stripped 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 311da61c6c5..044ab3abe88 100644 +index 6cd71cbb2ab..4ba729e14d8 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding diff --git a/0044-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch b/0044-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch index 33bdad26..b8dbff50 100644 --- a/0044-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch +++ b/0044-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index 0a5b2afb94b..970ea868c14 100644 +index e0fb0a9e48a..8e2294d8ff6 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/lib/cmdline.c -@@ -97,16 +97,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf, +@@ -98,16 +98,7 @@ grub_create_loader_cmdline (int argc, char *argv[], char *buf, while (*c) { diff --git a/0045-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0045-Don-t-require-a-password-to-boot-entries-generated-b.patch index b0b2b0ef..c7370293 100644 --- a/0045-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0045-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 6299836b5cd..b744438e04a 100644 +index 2b402d85a52..d35b0f406bc 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -26,7 +26,7 @@ datarootdir="@datarootdir@" diff --git a/0046-Don-t-emit-Booting-.-message.patch b/0046-Don-t-emit-Booting-.-message.patch index 725ae098..63d1812e 100644 --- a/0046-Don-t-emit-Booting-.-message.patch +++ b/0046-Don-t-emit-Booting-.-message.patch @@ -14,10 +14,10 @@ Signed-off-by: Peter Jones 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d2f64b05e0a..5e2f5283d3d 100644 +index 9175ad297d8..783bde55b9e 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c -@@ -838,12 +838,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) +@@ -839,12 +839,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) /* Callback invoked immediately before a menu entry is executed. */ static void diff --git a/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch index d6169aa7..11d8a62f 100644 --- a/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +++ b/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch @@ -122,10 +122,10 @@ Replace a bunch of machine generated ones with ones that look nicer. create mode 100644 util/grub-sparc64-setup.8 diff --git a/configure.ac b/configure.ac -index 783118ccdcd..d5db2803ec4 100644 +index d283af64c8c..8df400e0a8b 100644 --- a/configure.ac +++ b/configure.ac -@@ -70,6 +70,29 @@ grub_TRANSFORM([grub-set-default]) +@@ -74,6 +74,29 @@ grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-sparc64-setup]) grub_TRANSFORM([grub-render-label]) grub_TRANSFORM([grub-file]) @@ -156,7 +156,7 @@ index 783118ccdcd..d5db2803ec4 100644 # Optimization flag. Allow user to override. if test "x$TARGET_CFLAGS" = x; then diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index b16bd925320..39eb94bded6 100644 +index 46c4e95e2fa..58d7d9540be 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -11,7 +11,6 @@ EXTRA_DIST += unicode @@ -498,10 +498,10 @@ index ad25c8ab753..00000000000 -[SEE ALSO] -.BR grub-menulst2cfg (8) diff --git a/gentpl.py b/gentpl.py -index da67965a41a..bf8439fa743 100644 +index 387588c0589..f05812eace3 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -802,10 +802,7 @@ def manpage(defn, adddeps): +@@ -805,10 +805,7 @@ def manpage(defn, adddeps): output("if COND_MAN_PAGES\n") gvar_add("man_MANS", name + "." + mansection) diff --git a/0048-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0048-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index bac4eee4..65b88553 100644 --- a/0048-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0048-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -17,7 +17,7 @@ Signed-off-by: Mark Salter 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 7f295e3946b..231f3f86371 100644 +index 7f61c5b618b..8add30e605f 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -349,7 +349,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0049-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0049-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index 2e8dffda..45a09827 100644 --- a/0049-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0049-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -1,15 +1,15 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Thu, 6 Mar 2014 11:51:33 -0500 +Date: Mon, 8 Jul 2019 17:33:22 +0200 Subject: [PATCH] Try mac/guid/etc before grub.cfg on tftp config files. Signed-off-by: Peter Jones --- - grub-core/normal/main.c | 80 ++++++++++++++++++++++++++----------------------- - 1 file changed, 43 insertions(+), 37 deletions(-) + grub-core/normal/main.c | 84 ++++++++++++++++++++++++++----------------------- + 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 231f3f86371..cf5c0b273ce 100644 +index 8add30e605f..d93bee613ac 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -347,53 +347,59 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -26,7 +26,7 @@ index 231f3f86371..cf5c0b273ce 100644 - { - grub_file_t file; - -- file = grub_file_open (config); +- file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); - if (file) - { - grub_file_close (file); @@ -47,65 +47,67 @@ index 231f3f86371..cf5c0b273ce 100644 prefix = grub_env_get ("prefix"); + if (prefix) -- { + { - grub_size_t config_len; - config_len = grub_strlen (prefix) + - sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); - config = grub_malloc (config_len); -+ { -+ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) -+ { -+ grub_size_t config_len; -+ config_len = grub_strlen (prefix) + -+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); -+ config = grub_malloc (config_len); - +- - if (! config) - goto quit; -+ if (! config) -+ goto quit; - +- - grub_snprintf (config, config_len, "%s/grub.cfg", prefix); -+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix); - -- if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) +- + if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) - grub_net_search_configfile (config); -+ grub_net_search_configfile (config); ++ { ++ grub_size_t config_len; ++ config_len = grub_strlen (prefix) + ++ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); ++ config = grub_malloc (config_len); - grub_enter_normal_mode (config); - grub_free (config); -+ grub_enter_normal_mode (config); -+ grub_free (config); -+ config = NULL; -+ } +- } ++ if (! config) ++ goto quit; + -+ if (!config) -+ { -+ config = grub_xasprintf ("%s/grub.cfg", prefix); -+ if (config) -+ { -+ grub_file_t file; ++ grub_snprintf (config, config_len, "%s/grub.cfg", prefix); + -+ file = grub_file_open (config); -+ if (file) -+ { -+ grub_file_close (file); -+ grub_enter_normal_mode (config); -+ } -+ else -+ { -+ /* Ignore all errors. */ -+ grub_errno = 0; -+ } -+ grub_free (config); -+ } -+ } - } ++ grub_net_search_configfile (config); ++ ++ grub_enter_normal_mode (config); ++ grub_free (config); ++ config = NULL; ++ } ++ ++ if (!config) ++ { ++ config = grub_xasprintf ("%s/grub.cfg", prefix); ++ if (config) ++ { ++ grub_file_t file; ++ ++ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); ++ if (file) ++ { ++ grub_file_close (file); ++ grub_enter_normal_mode (config); ++ } ++ else ++ { ++ /* Ignore all errors. */ ++ grub_errno = 0; ++ } ++ grub_free (config); ++ } ++ } ++ } else - grub_enter_normal_mode (0); -+ { -+ grub_enter_normal_mode (0); -+ } ++ { ++ grub_enter_normal_mode (0); ++ } } else grub_enter_normal_mode (argv[0]); diff --git a/0051-Add-grub_util_readlink.patch b/0051-Add-grub_util_readlink.patch index 6ea7df15..060a837b 100644 --- a/0051-Add-grub_util_readlink.patch +++ b/0051-Add-grub_util_readlink.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Wed, 3 Sep 2014 10:01:03 -0400 +Date: Mon, 8 Jul 2019 21:46:52 +0200 Subject: [PATCH] Add grub_util_readlink() Add grub_util_readlink(). This requires pulling in stat and readlink from @@ -10,437 +10,17 @@ implementation is straightforward. Signed-off-by: Peter Jones Reviewed-by: Adam Jackson --- - grub-core/gnulib/gettimeofday.c | 154 +++++++ - grub-core/gnulib/readlink.c | 74 ++++ - grub-core/gnulib/stat.c | 138 +++++++ - grub-core/osdep/windows/hostdisk.c | 6 + - grub-core/gnulib/pathmax.h | 83 ++++ - grub-core/gnulib/sys_stat.in.h | 732 ++++++++++++++++++++++++++++++++++ - grub-core/gnulib/sys_time.in.h | 213 ++++++++++ - grub-core/gnulib/sys_types.in.h | 2 + - grub-core/gnulib/time.h | 586 +++++++++++++++++++++++++++ - grub-core/gnulib/time.in.h | 274 +++++++++++++ - include/grub/osdep/hostfile_aros.h | 6 + - include/grub/osdep/hostfile_unix.h | 6 + - include/grub/osdep/hostfile_windows.h | 2 + - grub-core/gnulib/Makefile.am | 177 +++++++- - m4/gettimeofday.m4 | 138 +++++++ - m4/gnulib-cache.m4 | 3 +- - m4/gnulib-comp.m4 | 49 +++ - m4/largefile.m4 | 146 +++++++ - m4/pathmax.m4 | 42 ++ - m4/readlink.m4 | 71 ++++ - m4/stat.m4 | 71 ++++ - m4/sys_stat_h.m4 | 96 +++++ - m4/sys_time_h.m4 | 110 +++++ - m4/time_h.m4 | 118 ++++++ - 24 files changed, 3295 insertions(+), 2 deletions(-) - create mode 100644 grub-core/gnulib/gettimeofday.c - create mode 100644 grub-core/gnulib/readlink.c - create mode 100644 grub-core/gnulib/stat.c - create mode 100644 grub-core/gnulib/pathmax.h - create mode 100644 grub-core/gnulib/sys_stat.in.h - create mode 100644 grub-core/gnulib/sys_time.in.h - create mode 100644 grub-core/gnulib/time.h - create mode 100644 grub-core/gnulib/time.in.h - create mode 100644 m4/gettimeofday.m4 - create mode 100644 m4/largefile.m4 - create mode 100644 m4/pathmax.m4 - create mode 100644 m4/readlink.m4 - create mode 100644 m4/stat.m4 - create mode 100644 m4/sys_stat_h.m4 - create mode 100644 m4/sys_time_h.m4 - create mode 100644 m4/time_h.m4 + grub-core/osdep/windows/hostdisk.c | 6 ++++++ + include/grub/osdep/hostfile_aros.h | 6 ++++++ + include/grub/osdep/hostfile_unix.h | 6 ++++++ + include/grub/osdep/hostfile_windows.h | 2 ++ + 4 files changed, 20 insertions(+) -diff --git a/grub-core/gnulib/gettimeofday.c b/grub-core/gnulib/gettimeofday.c -new file mode 100644 -index 00000000000..8b2058e8c87 ---- /dev/null -+++ b/grub-core/gnulib/gettimeofday.c -@@ -0,0 +1,154 @@ -+/* Provide gettimeofday for systems that don't have it or for which it's broken. -+ -+ Copyright (C) 2001-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3, or (at your option) -+ any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . */ -+ -+/* written by Jim Meyering */ -+ -+#include -+ -+/* Specification. */ -+#include -+ -+#include -+ -+#if HAVE_SYS_TIMEB_H -+# include -+#endif -+ -+#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME -+ -+/* Work around the bug in some systems whereby gettimeofday clobbers -+ the static buffer that localtime uses for its return value. The -+ gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has -+ this problem. The tzset replacement is necessary for at least -+ Solaris 2.5, 2.5.1, and 2.6. */ -+ -+static struct tm tm_zero_buffer; -+static struct tm *localtime_buffer_addr = &tm_zero_buffer; -+ -+# undef localtime -+extern struct tm *localtime (time_t const *); -+ -+# undef gmtime -+extern struct tm *gmtime (time_t const *); -+ -+/* This is a wrapper for localtime. It is used only on systems for which -+ gettimeofday clobbers the static buffer used for localtime's result. -+ -+ On the first call, record the address of the static buffer that -+ localtime uses for its result. */ -+ -+struct tm * -+rpl_localtime (time_t const *timep) -+{ -+ struct tm *tm = localtime (timep); -+ -+ if (localtime_buffer_addr == &tm_zero_buffer) -+ localtime_buffer_addr = tm; -+ -+ return tm; -+} -+ -+/* Same as above, since gmtime and localtime use the same buffer. */ -+struct tm * -+rpl_gmtime (time_t const *timep) -+{ -+ struct tm *tm = gmtime (timep); -+ -+ if (localtime_buffer_addr == &tm_zero_buffer) -+ localtime_buffer_addr = tm; -+ -+ return tm; -+} -+ -+#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */ -+ -+#if TZSET_CLOBBERS_LOCALTIME -+ -+# undef tzset -+extern void tzset (void); -+ -+/* This is a wrapper for tzset, for systems on which tzset may clobber -+ the static buffer used for localtime's result. */ -+void -+rpl_tzset (void) -+{ -+ /* Save and restore the contents of the buffer used for localtime's -+ result around the call to tzset. */ -+ struct tm save = *localtime_buffer_addr; -+ tzset (); -+ *localtime_buffer_addr = save; -+} -+#endif -+ -+/* This is a wrapper for gettimeofday. It is used only on systems -+ that lack this function, or whose implementation of this function -+ causes problems. */ -+ -+int -+gettimeofday (struct timeval *restrict tv, void *restrict tz) -+{ -+#undef gettimeofday -+#if HAVE_GETTIMEOFDAY -+# if GETTIMEOFDAY_CLOBBERS_LOCALTIME -+ /* Save and restore the contents of the buffer used for localtime's -+ result around the call to gettimeofday. */ -+ struct tm save = *localtime_buffer_addr; -+# endif -+ -+# if defined timeval /* 'struct timeval' overridden by gnulib? */ -+# undef timeval -+ struct timeval otv; -+ int result = gettimeofday (&otv, (struct timezone *) tz); -+ if (result == 0) -+ { -+ tv->tv_sec = otv.tv_sec; -+ tv->tv_usec = otv.tv_usec; -+ } -+# else -+ int result = gettimeofday (tv, (struct timezone *) tz); -+# endif -+ -+# if GETTIMEOFDAY_CLOBBERS_LOCALTIME -+ *localtime_buffer_addr = save; -+# endif -+ -+ return result; -+ -+#else -+ -+# if HAVE__FTIME -+ -+ struct _timeb timebuf; -+ _ftime (&timebuf); -+ tv->tv_sec = timebuf.time; -+ tv->tv_usec = timebuf.millitm * 1000; -+ -+# else -+ -+# if !defined OK_TO_USE_1S_CLOCK -+# error "Only 1-second nominal clock resolution found. Is that intended?" \ -+ "If so, compile with the -DOK_TO_USE_1S_CLOCK option." -+# endif -+ tv->tv_sec = time (NULL); -+ tv->tv_usec = 0; -+ -+# endif -+ -+ return 0; -+ -+#endif -+} -diff --git a/grub-core/gnulib/readlink.c b/grub-core/gnulib/readlink.c -new file mode 100644 -index 00000000000..4c496395176 ---- /dev/null -+++ b/grub-core/gnulib/readlink.c -@@ -0,0 +1,74 @@ -+/* Stub for readlink(). -+ Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+/* Specification. */ -+#include -+ -+#include -+#include -+#include -+ -+#if !HAVE_READLINK -+ -+/* readlink() substitute for systems that don't have a readlink() function, -+ such as DJGPP 2.03 and mingw32. */ -+ -+ssize_t -+readlink (const char *name, char *buf _GL_UNUSED, -+ size_t bufsize _GL_UNUSED) -+{ -+ struct stat statbuf; -+ -+ /* In general we should use lstat() here, not stat(). But on platforms -+ without symbolic links, lstat() - if it exists - would be equivalent to -+ stat(), therefore we can use stat(). This saves us a configure check. */ -+ if (stat (name, &statbuf) >= 0) -+ errno = EINVAL; -+ return -1; -+} -+ -+#else /* HAVE_READLINK */ -+ -+# undef readlink -+ -+/* readlink() wrapper that uses correct types, for systems like cygwin -+ 1.5.x where readlink returns int, and which rejects trailing slash, -+ for Solaris 9. */ -+ -+ssize_t -+rpl_readlink (const char *name, char *buf, size_t bufsize) -+{ -+# if READLINK_TRAILING_SLASH_BUG -+ size_t len = strlen (name); -+ if (len && name[len - 1] == '/') -+ { -+ /* Even if name without the slash is a symlink to a directory, -+ both lstat() and stat() must resolve the trailing slash to -+ the directory rather than the symlink. We can therefore -+ safely use stat() to distinguish between EINVAL and -+ ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat(). */ -+ struct stat st; -+ if (stat (name, &st) == 0) -+ errno = EINVAL; -+ return -1; -+ } -+# endif /* READLINK_TRAILING_SLASH_BUG */ -+ return readlink (name, buf, bufsize); -+} -+ -+#endif /* HAVE_READLINK */ -diff --git a/grub-core/gnulib/stat.c b/grub-core/gnulib/stat.c -new file mode 100644 -index 00000000000..35f4b0b1a51 ---- /dev/null -+++ b/grub-core/gnulib/stat.c -@@ -0,0 +1,138 @@ -+/* Work around platform bugs in stat. -+ Copyright (C) 2009-2014 Free Software Foundation, Inc. -+ -+ This program is free software: you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* written by Eric Blake */ -+ -+/* If the user's config.h happens to include , let it include only -+ the system's here, so that orig_stat doesn't recurse to -+ rpl_stat. */ -+#define __need_system_sys_stat_h -+#include -+ -+/* Get the original definition of stat. It might be defined as a macro. */ -+#include -+#include -+#undef __need_system_sys_stat_h -+ -+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -+# if _GL_WINDOWS_64_BIT_ST_SIZE -+# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */ -+# define stat _stati64 -+# define REPLACE_FUNC_STAT_DIR 1 -+# undef REPLACE_FUNC_STAT_FILE -+# elif REPLACE_FUNC_STAT_FILE -+/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a. -+ Bypass it. */ -+# define stat _stat -+# define REPLACE_FUNC_STAT_DIR 1 -+# undef REPLACE_FUNC_STAT_FILE -+# endif -+#endif -+ -+static int -+orig_stat (const char *filename, struct stat *buf) -+{ -+ return stat (filename, buf); -+} -+ -+/* Specification. */ -+/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc -+ eliminates this include because of the preliminary #include -+ above. */ -+#include "sys/stat.h" -+ -+#include -+#include -+#include -+#include -+#include "dosname.h" -+#include "verify.h" -+ -+#if REPLACE_FUNC_STAT_DIR -+# include "pathmax.h" -+ /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also -+ have a constant PATH_MAX. */ -+# ifndef PATH_MAX -+# error "Please port this replacement to your platform" -+# endif -+#endif -+ -+/* Store information about NAME into ST. Work around bugs with -+ trailing slashes. Mingw has other bugs (such as st_ino always -+ being 0 on success) which this wrapper does not work around. But -+ at least this implementation provides the ability to emulate fchdir -+ correctly. */ -+ -+int -+rpl_stat (char const *name, struct stat *st) -+{ -+ int result = orig_stat (name, st); -+#if REPLACE_FUNC_STAT_FILE -+ /* Solaris 9 mistakenly succeeds when given a non-directory with a -+ trailing slash. */ -+ if (result == 0 && !S_ISDIR (st->st_mode)) -+ { -+ size_t len = strlen (name); -+ if (ISSLASH (name[len - 1])) -+ { -+ errno = ENOTDIR; -+ return -1; -+ } -+ } -+#endif /* REPLACE_FUNC_STAT_FILE */ -+#if REPLACE_FUNC_STAT_DIR -+ -+ if (result == -1 && errno == ENOENT) -+ { -+ /* Due to mingw's oddities, there are some directories (like -+ c:\) where stat() only succeeds with a trailing slash, and -+ other directories (like c:\windows) where stat() only -+ succeeds without a trailing slash. But we want the two to be -+ synonymous, since chdir() manages either style. Likewise, Mingw also -+ reports ENOENT for names longer than PATH_MAX, when we want -+ ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR. -+ Fortunately, mingw PATH_MAX is small enough for stack -+ allocation. */ -+ char fixed_name[PATH_MAX + 1] = {0}; -+ size_t len = strlen (name); -+ bool check_dir = false; -+ verify (PATH_MAX <= 4096); -+ if (PATH_MAX <= len) -+ errno = ENAMETOOLONG; -+ else if (len) -+ { -+ strcpy (fixed_name, name); -+ if (ISSLASH (fixed_name[len - 1])) -+ { -+ check_dir = true; -+ while (len && ISSLASH (fixed_name[len - 1])) -+ fixed_name[--len] = '\0'; -+ if (!len) -+ fixed_name[0] = '/'; -+ } -+ else -+ fixed_name[len++] = '/'; -+ result = orig_stat (fixed_name, st); -+ if (result == 0 && check_dir && !S_ISDIR (st->st_mode)) -+ { -+ result = -1; -+ errno = ENOTDIR; -+ } -+ } -+ } -+#endif /* REPLACE_FUNC_STAT_DIR */ -+ return result; -+} diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c -index 85507af88e3..6f49df465d7 100644 +index 355100789a7..87a106c9b82 100644 --- a/grub-core/osdep/windows/hostdisk.c +++ b/grub-core/osdep/windows/hostdisk.c -@@ -353,6 +353,12 @@ grub_util_mkdir (const char *dir) +@@ -365,6 +365,12 @@ grub_util_mkdir (const char *dir) free (windows_name); } @@ -453,1938 +33,6 @@ index 85507af88e3..6f49df465d7 100644 int grub_util_rename (const char *from, const char *to) { -diff --git a/grub-core/gnulib/pathmax.h b/grub-core/gnulib/pathmax.h -new file mode 100644 -index 00000000000..33fc3553d75 ---- /dev/null -+++ b/grub-core/gnulib/pathmax.h -@@ -0,0 +1,83 @@ -+/* Define PATH_MAX somehow. Requires sys/types.h. -+ Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software -+ Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3, or (at your option) -+ any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . */ -+ -+#ifndef _PATHMAX_H -+# define _PATHMAX_H -+ -+/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename, -+ including the terminating NUL byte. -+ -+ PATH_MAX is not defined on systems which have no limit on filename length, -+ such as GNU/Hurd. -+ -+ This file does *not* define PATH_MAX always. Programs that use this file -+ can handle the GNU/Hurd case in several ways: -+ - Either with a package-wide handling, or with a per-file handling, -+ - Either through a -+ #ifdef PATH_MAX -+ or through a fallback like -+ #ifndef PATH_MAX -+ # define PATH_MAX 8192 -+ #endif -+ or through a fallback like -+ #ifndef PATH_MAX -+ # define PATH_MAX pathconf ("/", _PC_PATH_MAX) -+ #endif -+ */ -+ -+# include -+ -+# include -+ -+# ifndef _POSIX_PATH_MAX -+# define _POSIX_PATH_MAX 256 -+# endif -+ -+/* Don't include sys/param.h if it already has been. */ -+# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN -+# include -+# endif -+ -+# if !defined PATH_MAX && defined MAXPATHLEN -+# define PATH_MAX MAXPATHLEN -+# endif -+ -+# ifdef __hpux -+/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename, -+ *not* including the terminating NUL byte, and is set to 1023. -+ Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is -+ not defined at all any more. */ -+# undef PATH_MAX -+# define PATH_MAX 1024 -+# endif -+ -+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -+/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, -+ section "Maximum Path Length Limitation", -+ -+ explains that the maximum size of a filename, including the terminating -+ NUL byte, is 260 = 3 + 256 + 1. -+ This is the same value as -+ - FILENAME_MAX in , -+ - _MAX_PATH in , -+ - MAX_PATH in . -+ Undefine the original value, because mingw's gets it wrong. */ -+# undef PATH_MAX -+# define PATH_MAX 260 -+# endif -+ -+#endif /* _PATHMAX_H */ -diff --git a/grub-core/gnulib/sys_stat.in.h b/grub-core/gnulib/sys_stat.in.h -new file mode 100644 -index 00000000000..b47a7ff0ae7 ---- /dev/null -+++ b/grub-core/gnulib/sys_stat.in.h -@@ -0,0 +1,732 @@ -+/* Provide a more complete sys/stat header file. -+ Copyright (C) 2005-2014 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3, or (at your option) -+ any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . */ -+ -+/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ -+ -+/* This file is supposed to be used on platforms where is -+ incomplete. It is intended to provide definitions and prototypes -+ needed by an application. Start with what the system provides. */ -+ -+#if __GNUC__ >= 3 -+@PRAGMA_SYSTEM_HEADER@ -+#endif -+@PRAGMA_COLUMNS@ -+ -+#if defined __need_system_sys_stat_h -+/* Special invocation convention. */ -+ -+#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ -+ -+#else -+/* Normal invocation convention. */ -+ -+#ifndef _@GUARD_PREFIX@_SYS_STAT_H -+ -+/* Get nlink_t. -+ May also define off_t to a 64-bit type on native Windows. */ -+#include -+ -+/* Get struct timespec. */ -+#include -+ -+/* The include_next requires a split double-inclusion guard. */ -+#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ -+ -+#ifndef _@GUARD_PREFIX@_SYS_STAT_H -+#define _@GUARD_PREFIX@_SYS_STAT_H -+ -+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -+ -+/* The definition of _GL_ARG_NONNULL is copied here. */ -+ -+/* The definition of _GL_WARN_ON_USE is copied here. */ -+ -+/* Before doing "#define mkdir rpl_mkdir" below, we need to include all -+ headers that may declare mkdir(). Native Windows platforms declare mkdir -+ in and/or , not in . */ -+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -+# include /* mingw32, mingw64 */ -+# include /* mingw64, MSVC 9 */ -+#endif -+ -+/* Native Windows platforms declare umask() in . */ -+#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) -+# include -+#endif -+ -+/* Large File Support on native Windows. */ -+#if @WINDOWS_64_BIT_ST_SIZE@ -+# define stat _stati64 -+#endif -+ -+#ifndef S_IFIFO -+# ifdef _S_IFIFO -+# define S_IFIFO _S_IFIFO -+# endif -+#endif -+ -+#ifndef S_IFMT -+# define S_IFMT 0170000 -+#endif -+ -+#if STAT_MACROS_BROKEN -+# undef S_ISBLK -+# undef S_ISCHR -+# undef S_ISDIR -+# undef S_ISFIFO -+# undef S_ISLNK -+# undef S_ISNAM -+# undef S_ISMPB -+# undef S_ISMPC -+# undef S_ISNWK -+# undef S_ISREG -+# undef S_ISSOCK -+#endif -+ -+#ifndef S_ISBLK -+# ifdef S_IFBLK -+# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -+# else -+# define S_ISBLK(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISCHR -+# ifdef S_IFCHR -+# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -+# else -+# define S_ISCHR(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISDIR -+# ifdef S_IFDIR -+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -+# else -+# define S_ISDIR(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISDOOR /* Solaris 2.5 and up */ -+# define S_ISDOOR(m) 0 -+#endif -+ -+#ifndef S_ISFIFO -+# ifdef S_IFIFO -+# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -+# else -+# define S_ISFIFO(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISLNK -+# ifdef S_IFLNK -+# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -+# else -+# define S_ISLNK(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISMPB /* V7 */ -+# ifdef S_IFMPB -+# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) -+# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) -+# else -+# define S_ISMPB(m) 0 -+# define S_ISMPC(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISMPX /* AIX */ -+# define S_ISMPX(m) 0 -+#endif -+ -+#ifndef S_ISNAM /* Xenix */ -+# ifdef S_IFNAM -+# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) -+# else -+# define S_ISNAM(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISNWK /* HP/UX */ -+# ifdef S_IFNWK -+# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) -+# else -+# define S_ISNWK(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISPORT /* Solaris 10 and up */ -+# define S_ISPORT(m) 0 -+#endif -+ -+#ifndef S_ISREG -+# ifdef S_IFREG -+# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -+# else -+# define S_ISREG(m) 0 -+# endif -+#endif -+ -+#ifndef S_ISSOCK -+# ifdef S_IFSOCK -+# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -+# else -+# define S_ISSOCK(m) 0 -+# endif -+#endif -+ -+ -+#ifndef S_TYPEISMQ -+# define S_TYPEISMQ(p) 0 -+#endif -+ -+#ifndef S_TYPEISTMO -+# define S_TYPEISTMO(p) 0 -+#endif -+ -+ -+#ifndef S_TYPEISSEM -+# ifdef S_INSEM -+# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) -+# else -+# define S_TYPEISSEM(p) 0 -+# endif -+#endif -+ -+#ifndef S_TYPEISSHM -+# ifdef S_INSHD -+# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) -+# else -+# define S_TYPEISSHM(p) 0 -+# endif -+#endif -+ -+/* high performance ("contiguous data") */ -+#ifndef S_ISCTG -+# define S_ISCTG(p) 0 -+#endif -+ -+/* Cray DMF (data migration facility): off line, with data */ -+#ifndef S_ISOFD -+# define S_ISOFD(p) 0 -+#endif -+ -+/* Cray DMF (data migration facility): off line, with no data */ -+#ifndef S_ISOFL -+# define S_ISOFL(p) 0 -+#endif -+ -+/* 4.4BSD whiteout */ -+#ifndef S_ISWHT -+# define S_ISWHT(m) 0 -+#endif -+ -+/* If any of the following are undefined, -+ define them to their de facto standard values. */ -+#if !S_ISUID -+# define S_ISUID 04000 -+#endif -+#if !S_ISGID -+# define S_ISGID 02000 -+#endif -+ -+/* S_ISVTX is a common extension to POSIX. */ -+#ifndef S_ISVTX -+# define S_ISVTX 01000 -+#endif -+ -+#if !S_IRUSR && S_IREAD -+# define S_IRUSR S_IREAD -+#endif -+#if !S_IRUSR -+# define S_IRUSR 00400 -+#endif -+#if !S_IRGRP -+# define S_IRGRP (S_IRUSR >> 3) -+#endif -+#if !S_IROTH -+# define S_IROTH (S_IRUSR >> 6) -+#endif -+ -+#if !S_IWUSR && S_IWRITE -+# define S_IWUSR S_IWRITE -+#endif -+#if !S_IWUSR -+# define S_IWUSR 00200 -+#endif -+#if !S_IWGRP -+# define S_IWGRP (S_IWUSR >> 3) -+#endif -+#if !S_IWOTH -+# define S_IWOTH (S_IWUSR >> 6) -+#endif -+ -+#if !S_IXUSR && S_IEXEC -+# define S_IXUSR S_IEXEC -+#endif -+#if !S_IXUSR -+# define S_IXUSR 00100 -+#endif -+#if !S_IXGRP -+# define S_IXGRP (S_IXUSR >> 3) -+#endif -+#if !S_IXOTH -+# define S_IXOTH (S_IXUSR >> 6) -+#endif -+ -+#if !S_IRWXU -+# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) -+#endif -+#if !S_IRWXG -+# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) -+#endif -+#if !S_IRWXO -+# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) -+#endif -+ -+/* S_IXUGO is a common extension to POSIX. */ -+#if !S_IXUGO -+# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) -+#endif -+ -+#ifndef S_IRWXUGO -+# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) -+#endif -+ -+/* Macros for futimens and utimensat. */ -+#ifndef UTIME_NOW -+# define UTIME_NOW (-1) -+# define UTIME_OMIT (-2) -+#endif -+ -+ -+#if @GNULIB_FCHMODAT@ -+# if !@HAVE_FCHMODAT@ -+_GL_FUNCDECL_SYS (fchmodat, int, -+ (int fd, char const *file, mode_t mode, int flag) -+ _GL_ARG_NONNULL ((2))); -+# endif -+_GL_CXXALIAS_SYS (fchmodat, int, -+ (int fd, char const *file, mode_t mode, int flag)); -+_GL_CXXALIASWARN (fchmodat); -+#elif defined GNULIB_POSIXCHECK -+# undef fchmodat -+# if HAVE_RAW_DECL_FCHMODAT -+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " -+ "use gnulib module openat for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_FSTAT@ -+# if @REPLACE_FSTAT@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef fstat -+# define fstat rpl_fstat -+# endif -+_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); -+_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); -+# else -+_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); -+# endif -+_GL_CXXALIASWARN (fstat); -+#elif @WINDOWS_64_BIT_ST_SIZE@ -+/* Above, we define stat to _stati64. */ -+# define fstat _fstati64 -+#elif defined GNULIB_POSIXCHECK -+# undef fstat -+# if HAVE_RAW_DECL_FSTAT -+_GL_WARN_ON_USE (fstat, "fstat has portability problems - " -+ "use gnulib module fstat for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_FSTATAT@ -+# if @REPLACE_FSTATAT@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef fstatat -+# define fstatat rpl_fstatat -+# endif -+_GL_FUNCDECL_RPL (fstatat, int, -+ (int fd, char const *name, struct stat *st, int flags) -+ _GL_ARG_NONNULL ((2, 3))); -+_GL_CXXALIAS_RPL (fstatat, int, -+ (int fd, char const *name, struct stat *st, int flags)); -+# else -+# if !@HAVE_FSTATAT@ -+_GL_FUNCDECL_SYS (fstatat, int, -+ (int fd, char const *name, struct stat *st, int flags) -+ _GL_ARG_NONNULL ((2, 3))); -+# endif -+_GL_CXXALIAS_SYS (fstatat, int, -+ (int fd, char const *name, struct stat *st, int flags)); -+# endif -+_GL_CXXALIASWARN (fstatat); -+#elif defined GNULIB_POSIXCHECK -+# undef fstatat -+# if HAVE_RAW_DECL_FSTATAT -+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - " -+ "use gnulib module openat for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_FUTIMENS@ -+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens -+ implementation relies on futimesat, which on Solaris 10 makes an invocation -+ to futimens that is meant to invoke the libc's futimens(), not gnulib's -+ futimens(). */ -+# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun) -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef futimens -+# define futimens rpl_futimens -+# endif -+_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); -+_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); -+# else -+# if !@HAVE_FUTIMENS@ -+_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); -+# endif -+_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); -+# endif -+# if @HAVE_FUTIMENS@ -+_GL_CXXALIASWARN (futimens); -+# endif -+#elif defined GNULIB_POSIXCHECK -+# undef futimens -+# if HAVE_RAW_DECL_FUTIMENS -+_GL_WARN_ON_USE (futimens, "futimens is not portable - " -+ "use gnulib module futimens for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_LCHMOD@ -+/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME -+ denotes a symbolic link. */ -+# if !@HAVE_LCHMOD@ -+/* The lchmod replacement follows symbolic links. Callers should take -+ this into account; lchmod should be applied only to arguments that -+ are known to not be symbolic links. On hosts that lack lchmod, -+ this can lead to race conditions between the check and the -+ invocation of lchmod, but we know of no workarounds that are -+ reliable in general. You might try requesting support for lchmod -+ from your operating system supplier. */ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define lchmod chmod -+# endif -+/* Need to cast, because on mingw, the second parameter of chmod is -+ int mode. */ -+_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, -+ (const char *filename, mode_t mode)); -+# else -+# if 0 /* assume already declared */ -+_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) -+ _GL_ARG_NONNULL ((1))); -+# endif -+_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); -+# endif -+# if @HAVE_LCHMOD@ -+_GL_CXXALIASWARN (lchmod); -+# endif -+#elif defined GNULIB_POSIXCHECK -+# undef lchmod -+# if HAVE_RAW_DECL_LCHMOD -+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - " -+ "use gnulib module lchmod for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_LSTAT@ -+# if ! @HAVE_LSTAT@ -+/* mingw does not support symlinks, therefore it does not have lstat. But -+ without links, stat does just fine. */ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define lstat stat -+# endif -+_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf)); -+# elif @REPLACE_LSTAT@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef lstat -+# define lstat rpl_lstat -+# endif -+_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf) -+ _GL_ARG_NONNULL ((1, 2))); -+_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf)); -+# else -+_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); -+# endif -+# if @HAVE_LSTAT@ -+_GL_CXXALIASWARN (lstat); -+# endif -+#elif defined GNULIB_POSIXCHECK -+# undef lstat -+# if HAVE_RAW_DECL_LSTAT -+_GL_WARN_ON_USE (lstat, "lstat is unportable - " -+ "use gnulib module lstat for portability"); -+# endif -+#endif -+ -+ -+#if @REPLACE_MKDIR@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef mkdir -+# define mkdir rpl_mkdir -+# endif -+_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); -+#else -+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. -+ Additionally, it declares _mkdir (and depending on compile flags, an -+ alias mkdir), only in the nonstandard includes and , -+ which are included above. */ -+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -+ -+# if !GNULIB_defined_rpl_mkdir -+static int -+rpl_mkdir (char const *name, mode_t mode) -+{ -+ return _mkdir (name); -+} -+# define GNULIB_defined_rpl_mkdir 1 -+# endif -+ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define mkdir rpl_mkdir -+# endif -+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); -+# else -+_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); -+# endif -+#endif -+_GL_CXXALIASWARN (mkdir); -+ -+ -+#if @GNULIB_MKDIRAT@ -+# if !@HAVE_MKDIRAT@ -+_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) -+ _GL_ARG_NONNULL ((2))); -+# endif -+_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); -+_GL_CXXALIASWARN (mkdirat); -+#elif defined GNULIB_POSIXCHECK -+# undef mkdirat -+# if HAVE_RAW_DECL_MKDIRAT -+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " -+ "use gnulib module openat for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_MKFIFO@ -+# if @REPLACE_MKFIFO@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef mkfifo -+# define mkfifo rpl_mkfifo -+# endif -+_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); -+# else -+# if !@HAVE_MKFIFO@ -+_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) -+ _GL_ARG_NONNULL ((1))); -+# endif -+_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); -+# endif -+_GL_CXXALIASWARN (mkfifo); -+#elif defined GNULIB_POSIXCHECK -+# undef mkfifo -+# if HAVE_RAW_DECL_MKFIFO -+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " -+ "use gnulib module mkfifo for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_MKFIFOAT@ -+# if !@HAVE_MKFIFOAT@ -+_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) -+ _GL_ARG_NONNULL ((2))); -+# endif -+_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); -+_GL_CXXALIASWARN (mkfifoat); -+#elif defined GNULIB_POSIXCHECK -+# undef mkfifoat -+# if HAVE_RAW_DECL_MKFIFOAT -+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " -+ "use gnulib module mkfifoat for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_MKNOD@ -+# if @REPLACE_MKNOD@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef mknod -+# define mknod rpl_mknod -+# endif -+_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); -+# else -+# if !@HAVE_MKNOD@ -+_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) -+ _GL_ARG_NONNULL ((1))); -+# endif -+/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ -+_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); -+# endif -+_GL_CXXALIASWARN (mknod); -+#elif defined GNULIB_POSIXCHECK -+# undef mknod -+# if HAVE_RAW_DECL_MKNOD -+_GL_WARN_ON_USE (mknod, "mknod is not portable - " -+ "use gnulib module mknod for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_MKNODAT@ -+# if !@HAVE_MKNODAT@ -+_GL_FUNCDECL_SYS (mknodat, int, -+ (int fd, char const *file, mode_t mode, dev_t dev) -+ _GL_ARG_NONNULL ((2))); -+# endif -+_GL_CXXALIAS_SYS (mknodat, int, -+ (int fd, char const *file, mode_t mode, dev_t dev)); -+_GL_CXXALIASWARN (mknodat); -+#elif defined GNULIB_POSIXCHECK -+# undef mknodat -+# if HAVE_RAW_DECL_MKNODAT -+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - " -+ "use gnulib module mkfifoat for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_STAT@ -+# if @REPLACE_STAT@ -+/* We can't use the object-like #define stat rpl_stat, because of -+ struct stat. This means that rpl_stat will not be used if the user -+ does (stat)(a,b). Oh well. */ -+# if defined _AIX && defined stat && defined _LARGE_FILES -+ /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, -+ so we have to replace stat64() instead of stat(). */ -+# undef stat64 -+# define stat64(name, st) rpl_stat (name, st) -+# elif @WINDOWS_64_BIT_ST_SIZE@ -+ /* Above, we define stat to _stati64. */ -+# if defined __MINGW32__ && defined _stati64 -+# ifndef _USE_32BIT_TIME_T -+ /* The system headers define _stati64 to _stat64. */ -+# undef _stat64 -+# define _stat64(name, st) rpl_stat (name, st) -+# endif -+# elif defined _MSC_VER && defined _stati64 -+# ifdef _USE_32BIT_TIME_T -+ /* The system headers define _stati64 to _stat32i64. */ -+# undef _stat32i64 -+# define _stat32i64(name, st) rpl_stat (name, st) -+# else -+ /* The system headers define _stati64 to _stat64. */ -+# undef _stat64 -+# define _stat64(name, st) rpl_stat (name, st) -+# endif -+# else -+# undef _stati64 -+# define _stati64(name, st) rpl_stat (name, st) -+# endif -+# elif defined __MINGW32__ && defined stat -+# ifdef _USE_32BIT_TIME_T -+ /* The system headers define stat to _stat32i64. */ -+# undef _stat32i64 -+# define _stat32i64(name, st) rpl_stat (name, st) -+# else -+ /* The system headers define stat to _stat64. */ -+# undef _stat64 -+# define _stat64(name, st) rpl_stat (name, st) -+# endif -+# elif defined _MSC_VER && defined stat -+# ifdef _USE_32BIT_TIME_T -+ /* The system headers define stat to _stat32. */ -+# undef _stat32 -+# define _stat32(name, st) rpl_stat (name, st) -+# else -+ /* The system headers define stat to _stat64i32. */ -+# undef _stat64i32 -+# define _stat64i32(name, st) rpl_stat (name, st) -+# endif -+# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */ -+# undef stat -+# define stat(name, st) rpl_stat (name, st) -+# endif /* !_LARGE_FILES */ -+_GL_EXTERN_C int stat (const char *name, struct stat *buf) -+ _GL_ARG_NONNULL ((1, 2)); -+# endif -+#elif defined GNULIB_POSIXCHECK -+# undef stat -+# if HAVE_RAW_DECL_STAT -+_GL_WARN_ON_USE (stat, "stat is unportable - " -+ "use gnulib module stat for portability"); -+# endif -+#endif -+ -+ -+#if @GNULIB_UTIMENSAT@ -+/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat -+ implementation relies on futimesat, which on Solaris 10 makes an invocation -+ to utimensat that is meant to invoke the libc's utimensat(), not gnulib's -+ utimensat(). */ -+# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun) -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef utimensat -+# define utimensat rpl_utimensat -+# endif -+_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, -+ struct timespec const times[2], int flag) -+ _GL_ARG_NONNULL ((2))); -+_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, -+ struct timespec const times[2], int flag)); -+# else -+# if !@HAVE_UTIMENSAT@ -+_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, -+ struct timespec const times[2], int flag) -+ _GL_ARG_NONNULL ((2))); -+# endif -+_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, -+ struct timespec const times[2], int flag)); -+# endif -+# if @HAVE_UTIMENSAT@ -+_GL_CXXALIASWARN (utimensat); -+# endif -+#elif defined GNULIB_POSIXCHECK -+# undef utimensat -+# if HAVE_RAW_DECL_UTIMENSAT -+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - " -+ "use gnulib module utimensat for portability"); -+# endif -+#endif -+ -+ -+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */ -+#endif /* _@GUARD_PREFIX@_SYS_STAT_H */ -+#endif -diff --git a/grub-core/gnulib/sys_time.in.h b/grub-core/gnulib/sys_time.in.h -new file mode 100644 -index 00000000000..30057ad49fd ---- /dev/null -+++ b/grub-core/gnulib/sys_time.in.h -@@ -0,0 +1,213 @@ -+/* Provide a more complete sys/time.h. -+ -+ Copyright (C) 2007-2014 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3, or (at your option) -+ any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . */ -+ -+/* Written by Paul Eggert. */ -+ -+#ifndef _@GUARD_PREFIX@_SYS_TIME_H -+ -+#if __GNUC__ >= 3 -+@PRAGMA_SYSTEM_HEADER@ -+#endif -+@PRAGMA_COLUMNS@ -+ -+/* On Cygwin and on many BSDish systems, includes itself -+ recursively via . -+ Simply delegate to the system's header in this case; it is a no-op. -+ Without this extra ifdef, the C++ gettimeofday declaration below -+ would be a forward declaration in gnulib's nested . */ -+#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_ -+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ -+#else -+ -+/* The include_next requires a split double-inclusion guard. */ -+#if @HAVE_SYS_TIME_H@ -+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ -+#endif -+ -+#ifndef _@GUARD_PREFIX@_SYS_TIME_H -+#define _@GUARD_PREFIX@_SYS_TIME_H -+ -+#if ! @HAVE_SYS_TIME_H@ -+# include -+#endif -+ -+/* On native Windows with MSVC, get the 'struct timeval' type. -+ Also, on native Windows with a 64-bit time_t, where we are overriding the -+ 'struct timeval' type, get all declarations of system functions whose -+ signature contains 'struct timeval'. */ -+#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H -+# define _GL_INCLUDING_WINSOCK2_H -+# include -+# undef _GL_INCLUDING_WINSOCK2_H -+#endif -+ -+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -+ -+/* The definition of _GL_ARG_NONNULL is copied here. */ -+ -+/* The definition of _GL_WARN_ON_USE is copied here. */ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@ -+ -+# if @REPLACE_STRUCT_TIMEVAL@ -+# define timeval rpl_timeval -+# endif -+ -+# if !GNULIB_defined_struct_timeval -+struct timeval -+{ -+ time_t tv_sec; -+ long int tv_usec; -+}; -+# define GNULIB_defined_struct_timeval 1 -+# endif -+ -+#endif -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#if @GNULIB_GETTIMEOFDAY@ -+# if @REPLACE_GETTIMEOFDAY@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef gettimeofday -+# define gettimeofday rpl_gettimeofday -+# endif -+_GL_FUNCDECL_RPL (gettimeofday, int, -+ (struct timeval *restrict, void *restrict) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (gettimeofday, int, -+ (struct timeval *restrict, void *restrict)); -+# else -+# if !@HAVE_GETTIMEOFDAY@ -+_GL_FUNCDECL_SYS (gettimeofday, int, -+ (struct timeval *restrict, void *restrict) -+ _GL_ARG_NONNULL ((1))); -+# endif -+/* Need to cast, because on glibc systems, by default, the second argument is -+ struct timezone *. */ -+_GL_CXXALIAS_SYS_CAST (gettimeofday, int, -+ (struct timeval *restrict, void *restrict)); -+# endif -+_GL_CXXALIASWARN (gettimeofday); -+#elif defined GNULIB_POSIXCHECK -+# undef gettimeofday -+# if HAVE_RAW_DECL_GETTIMEOFDAY -+_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " -+ "use gnulib module gettimeofday for portability"); -+# endif -+#endif -+ -+/* Hide some function declarations from . */ -+ -+#if defined _MSC_VER && @HAVE_WINSOCK2_H@ -+# if !defined _@GUARD_PREFIX@_UNISTD_H -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef close -+# define close close_used_without_including_unistd_h -+# else -+ _GL_WARN_ON_USE (close, -+ "close() used without including "); -+# endif -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef gethostname -+# define gethostname gethostname_used_without_including_unistd_h -+# else -+ _GL_WARN_ON_USE (gethostname, -+ "gethostname() used without including "); -+# endif -+# endif -+# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef socket -+# define socket socket_used_without_including_sys_socket_h -+# undef connect -+# define connect connect_used_without_including_sys_socket_h -+# undef accept -+# define accept accept_used_without_including_sys_socket_h -+# undef bind -+# define bind bind_used_without_including_sys_socket_h -+# undef getpeername -+# define getpeername getpeername_used_without_including_sys_socket_h -+# undef getsockname -+# define getsockname getsockname_used_without_including_sys_socket_h -+# undef getsockopt -+# define getsockopt getsockopt_used_without_including_sys_socket_h -+# undef listen -+# define listen listen_used_without_including_sys_socket_h -+# undef recv -+# define recv recv_used_without_including_sys_socket_h -+# undef send -+# define send send_used_without_including_sys_socket_h -+# undef recvfrom -+# define recvfrom recvfrom_used_without_including_sys_socket_h -+# undef sendto -+# define sendto sendto_used_without_including_sys_socket_h -+# undef setsockopt -+# define setsockopt setsockopt_used_without_including_sys_socket_h -+# undef shutdown -+# define shutdown shutdown_used_without_including_sys_socket_h -+# else -+ _GL_WARN_ON_USE (socket, -+ "socket() used without including "); -+ _GL_WARN_ON_USE (connect, -+ "connect() used without including "); -+ _GL_WARN_ON_USE (accept, -+ "accept() used without including "); -+ _GL_WARN_ON_USE (bind, -+ "bind() used without including "); -+ _GL_WARN_ON_USE (getpeername, -+ "getpeername() used without including "); -+ _GL_WARN_ON_USE (getsockname, -+ "getsockname() used without including "); -+ _GL_WARN_ON_USE (getsockopt, -+ "getsockopt() used without including "); -+ _GL_WARN_ON_USE (listen, -+ "listen() used without including "); -+ _GL_WARN_ON_USE (recv, -+ "recv() used without including "); -+ _GL_WARN_ON_USE (send, -+ "send() used without including "); -+ _GL_WARN_ON_USE (recvfrom, -+ "recvfrom() used without including "); -+ _GL_WARN_ON_USE (sendto, -+ "sendto() used without including "); -+ _GL_WARN_ON_USE (setsockopt, -+ "setsockopt() used without including "); -+ _GL_WARN_ON_USE (shutdown, -+ "shutdown() used without including "); -+# endif -+# endif -+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef select -+# define select select_used_without_including_sys_select_h -+# else -+ _GL_WARN_ON_USE (select, -+ "select() used without including "); -+# endif -+# endif -+#endif -+ -+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */ -+#endif /* _CYGWIN_SYS_TIME_H */ -+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */ -diff --git a/grub-core/gnulib/sys_types.in.h b/grub-core/gnulib/sys_types.in.h -index d7da35623b1..9520c09030c 100644 ---- a/grub-core/gnulib/sys_types.in.h -+++ b/grub-core/gnulib/sys_types.in.h -@@ -23,7 +23,9 @@ - #ifndef _@GUARD_PREFIX@_SYS_TYPES_H - - /* The include_next requires a split double-inclusion guard. */ -+# define _GL_INCLUDING_SYS_TYPES_H - #@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ -+# undef _GL_INCLUDING_SYS_TYPES_H - - #ifndef _@GUARD_PREFIX@_SYS_TYPES_H - #define _@GUARD_PREFIX@_SYS_TYPES_H -diff --git a/grub-core/gnulib/time.h b/grub-core/gnulib/time.h -new file mode 100644 -index 00000000000..b9203d5569a ---- /dev/null -+++ b/grub-core/gnulib/time.h -@@ -0,0 +1,586 @@ -+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ -+/* A more-standard . -+ -+ Copyright (C) 2007-2014 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3, or (at your option) -+ any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . */ -+ -+#if __GNUC__ >= 3 -+#pragma GCC system_header -+#endif -+ -+ -+/* Don't get in the way of glibc when it includes time.h merely to -+ declare a few standard symbols, rather than to declare all the -+ symbols. Also, Solaris 8 eventually includes itself -+ recursively; if that is happening, just include the system -+ without adding our own declarations. */ -+#if (defined __need_time_t || defined __need_clock_t \ -+ || defined __need_timespec \ -+ || defined _GL_TIME_H) -+ -+# include_next -+ -+#else -+ -+# define _GL_TIME_H -+ -+# include_next -+ -+/* NetBSD 5.0 mis-defines NULL. */ -+# include -+ -+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -+#ifndef _GL_CXXDEFS_H -+#define _GL_CXXDEFS_H -+ -+/* The three most frequent use cases of these macros are: -+ -+ * For providing a substitute for a function that is missing on some -+ platforms, but is declared and works fine on the platforms on which -+ it exists: -+ -+ #if @GNULIB_FOO@ -+ # if !@HAVE_FOO@ -+ _GL_FUNCDECL_SYS (foo, ...); -+ # endif -+ _GL_CXXALIAS_SYS (foo, ...); -+ _GL_CXXALIASWARN (foo); -+ #elif defined GNULIB_POSIXCHECK -+ ... -+ #endif -+ -+ * For providing a replacement for a function that exists on all platforms, -+ but is broken/insufficient and needs to be replaced on some platforms: -+ -+ #if @GNULIB_FOO@ -+ # if @REPLACE_FOO@ -+ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+ # undef foo -+ # define foo rpl_foo -+ # endif -+ _GL_FUNCDECL_RPL (foo, ...); -+ _GL_CXXALIAS_RPL (foo, ...); -+ # else -+ _GL_CXXALIAS_SYS (foo, ...); -+ # endif -+ _GL_CXXALIASWARN (foo); -+ #elif defined GNULIB_POSIXCHECK -+ ... -+ #endif -+ -+ * For providing a replacement for a function that exists on some platforms -+ but is broken/insufficient and needs to be replaced on some of them and -+ is additionally either missing or undeclared on some other platforms: -+ -+ #if @GNULIB_FOO@ -+ # if @REPLACE_FOO@ -+ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+ # undef foo -+ # define foo rpl_foo -+ # endif -+ _GL_FUNCDECL_RPL (foo, ...); -+ _GL_CXXALIAS_RPL (foo, ...); -+ # else -+ # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ -+ _GL_FUNCDECL_SYS (foo, ...); -+ # endif -+ _GL_CXXALIAS_SYS (foo, ...); -+ # endif -+ _GL_CXXALIASWARN (foo); -+ #elif defined GNULIB_POSIXCHECK -+ ... -+ #endif -+*/ -+ -+/* _GL_EXTERN_C declaration; -+ performs the declaration with C linkage. */ -+#if defined __cplusplus -+# define _GL_EXTERN_C extern "C" -+#else -+# define _GL_EXTERN_C extern -+#endif -+ -+/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); -+ declares a replacement function, named rpl_func, with the given prototype, -+ consisting of return type, parameters, and attributes. -+ Example: -+ _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) -+ _GL_ARG_NONNULL ((1))); -+ */ -+#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ -+ _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) -+#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ -+ _GL_EXTERN_C rettype rpl_func parameters_and_attributes -+ -+/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); -+ declares the system function, named func, with the given prototype, -+ consisting of return type, parameters, and attributes. -+ Example: -+ _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) -+ _GL_ARG_NONNULL ((1))); -+ */ -+#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ -+ _GL_EXTERN_C rettype func parameters_and_attributes -+ -+/* _GL_CXXALIAS_RPL (func, rettype, parameters); -+ declares a C++ alias called GNULIB_NAMESPACE::func -+ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. -+ Example: -+ _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); -+ */ -+#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ -+ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) -+#if defined __cplusplus && defined GNULIB_NAMESPACE -+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ -+ namespace GNULIB_NAMESPACE \ -+ { \ -+ rettype (*const func) parameters = ::rpl_func; \ -+ } \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#else -+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#endif -+ -+/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); -+ is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); -+ except that the C function rpl_func may have a slightly different -+ declaration. A cast is used to silence the "invalid conversion" error -+ that would otherwise occur. */ -+#if defined __cplusplus && defined GNULIB_NAMESPACE -+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ -+ namespace GNULIB_NAMESPACE \ -+ { \ -+ rettype (*const func) parameters = \ -+ reinterpret_cast(::rpl_func); \ -+ } \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#else -+# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#endif -+ -+/* _GL_CXXALIAS_SYS (func, rettype, parameters); -+ declares a C++ alias called GNULIB_NAMESPACE::func -+ that redirects to the system provided function func, if GNULIB_NAMESPACE -+ is defined. -+ Example: -+ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); -+ */ -+#if defined __cplusplus && defined GNULIB_NAMESPACE -+ /* If we were to write -+ rettype (*const func) parameters = ::func; -+ like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls -+ better (remove an indirection through a 'static' pointer variable), -+ but then the _GL_CXXALIASWARN macro below would cause a warning not only -+ for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ -+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ -+ namespace GNULIB_NAMESPACE \ -+ { \ -+ static rettype (*func) parameters = ::func; \ -+ } \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#else -+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#endif -+ -+/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); -+ is like _GL_CXXALIAS_SYS (func, rettype, parameters); -+ except that the C function func may have a slightly different declaration. -+ A cast is used to silence the "invalid conversion" error that would -+ otherwise occur. */ -+#if defined __cplusplus && defined GNULIB_NAMESPACE -+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ -+ namespace GNULIB_NAMESPACE \ -+ { \ -+ static rettype (*func) parameters = \ -+ reinterpret_cast(::func); \ -+ } \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#else -+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#endif -+ -+/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); -+ is like _GL_CXXALIAS_SYS (func, rettype, parameters); -+ except that the C function is picked among a set of overloaded functions, -+ namely the one with rettype2 and parameters2. Two consecutive casts -+ are used to silence the "cannot find a match" and "invalid conversion" -+ errors that would otherwise occur. */ -+#if defined __cplusplus && defined GNULIB_NAMESPACE -+ /* The outer cast must be a reinterpret_cast. -+ The inner cast: When the function is defined as a set of overloaded -+ functions, it works as a static_cast<>, choosing the designated variant. -+ When the function is defined as a single variant, it works as a -+ reinterpret_cast<>. The parenthesized cast syntax works both ways. */ -+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ -+ namespace GNULIB_NAMESPACE \ -+ { \ -+ static rettype (*func) parameters = \ -+ reinterpret_cast( \ -+ (rettype2(*)parameters2)(::func)); \ -+ } \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#else -+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#endif -+ -+/* _GL_CXXALIASWARN (func); -+ causes a warning to be emitted when ::func is used but not when -+ GNULIB_NAMESPACE::func is used. func must be defined without overloaded -+ variants. */ -+#if defined __cplusplus && defined GNULIB_NAMESPACE -+# define _GL_CXXALIASWARN(func) \ -+ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) -+# define _GL_CXXALIASWARN_1(func,namespace) \ -+ _GL_CXXALIASWARN_2 (func, namespace) -+/* To work around GCC bug , -+ we enable the warning only when not optimizing. */ -+# if !__OPTIMIZE__ -+# define _GL_CXXALIASWARN_2(func,namespace) \ -+ _GL_WARN_ON_USE (func, \ -+ "The symbol ::" #func " refers to the system function. " \ -+ "Use " #namespace "::" #func " instead.") -+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -+# define _GL_CXXALIASWARN_2(func,namespace) \ -+ extern __typeof__ (func) func -+# else -+# define _GL_CXXALIASWARN_2(func,namespace) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+# endif -+#else -+# define _GL_CXXALIASWARN(func) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#endif -+ -+/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); -+ causes a warning to be emitted when the given overloaded variant of ::func -+ is used but not when GNULIB_NAMESPACE::func is used. */ -+#if defined __cplusplus && defined GNULIB_NAMESPACE -+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ -+ _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ -+ GNULIB_NAMESPACE) -+# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ -+ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) -+/* To work around GCC bug , -+ we enable the warning only when not optimizing. */ -+# if !__OPTIMIZE__ -+# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ -+ _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ -+ "The symbol ::" #func " refers to the system function. " \ -+ "Use " #namespace "::" #func " instead.") -+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -+# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ -+ extern __typeof__ (func) func -+# else -+# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+# endif -+#else -+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ -+ _GL_EXTERN_C int _gl_cxxalias_dummy -+#endif -+ -+#endif /* _GL_CXXDEFS_H */ -+ -+/* The definition of _GL_ARG_NONNULL is copied here. */ -+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools -+ that the values passed as arguments n, ..., m must be non-NULL pointers. -+ n = 1 stands for the first argument, n = 2 for the second argument etc. */ -+#ifndef _GL_ARG_NONNULL -+# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 -+# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) -+# else -+# define _GL_ARG_NONNULL(params) -+# endif -+#endif -+ -+/* The definition of _GL_WARN_ON_USE is copied here. */ -+#ifndef _GL_WARN_ON_USE -+ -+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) -+/* A compiler attribute is available in gcc versions 4.3.0 and later. */ -+# define _GL_WARN_ON_USE(function, message) \ -+extern __typeof__ (function) function __attribute__ ((__warning__ (message))) -+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -+/* Verify the existence of the function. */ -+# define _GL_WARN_ON_USE(function, message) \ -+extern __typeof__ (function) function -+# else /* Unsupported. */ -+# define _GL_WARN_ON_USE(function, message) \ -+_GL_WARN_EXTERN_C int _gl_warn_on_use -+# endif -+#endif -+ -+/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") -+ is like _GL_WARN_ON_USE (function, "string"), except that the function is -+ declared with the given prototype, consisting of return type, parameters, -+ and attributes. -+ This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does -+ not work in this case. */ -+#ifndef _GL_WARN_ON_USE_CXX -+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) -+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -+extern rettype function parameters_and_attributes \ -+ __attribute__ ((__warning__ (msg))) -+# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -+/* Verify the existence of the function. */ -+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -+extern rettype function parameters_and_attributes -+# else /* Unsupported. */ -+# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -+_GL_WARN_EXTERN_C int _gl_warn_on_use -+# endif -+#endif -+ -+/* _GL_WARN_EXTERN_C declaration; -+ performs the declaration with C linkage. */ -+#ifndef _GL_WARN_EXTERN_C -+# if defined __cplusplus -+# define _GL_WARN_EXTERN_C extern "C" -+# else -+# define _GL_WARN_EXTERN_C extern -+# endif -+#endif -+ -+/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). -+ Or they define it with the wrong member names or define it in -+ (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, -+ but the pthreads-win32 library defines it in . */ -+# if ! 1 -+# if 0 -+# include -+# elif 0 -+# include -+# else -+ -+# ifdef __cplusplus -+extern "C" { -+# endif -+ -+# if !GNULIB_defined_struct_timespec -+# undef timespec -+# define timespec rpl_timespec -+struct timespec -+{ -+ time_t tv_sec; -+ long int tv_nsec; -+}; -+# define GNULIB_defined_struct_timespec 1 -+# endif -+ -+# ifdef __cplusplus -+} -+# endif -+ -+# endif -+# endif -+ -+# if !GNULIB_defined_struct_time_t_must_be_integral -+/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires -+ time_t to be an integer type, even though C99 permits floating -+ point. We don't know of any implementation that uses floating -+ point, and it is much easier to write code that doesn't have to -+ worry about that corner case, so we force the issue. */ -+struct __time_t_must_be_integral { -+ unsigned int __floating_time_t_unsupported : (time_t) 1; -+}; -+# define GNULIB_defined_struct_time_t_must_be_integral 1 -+# endif -+ -+/* Sleep for at least RQTP seconds unless interrupted, If interrupted, -+ return -1 and store the remaining time into RMTP. See -+ . */ -+# if 0 -+# if GNULIB_PORTCHECK -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define nanosleep rpl_nanosleep -+# endif -+_GL_FUNCDECL_RPL (nanosleep, int, -+ (struct timespec const *__rqtp, struct timespec *__rmtp) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (nanosleep, int, -+ (struct timespec const *__rqtp, struct timespec *__rmtp)); -+# else -+# if ! 1 -+_GL_FUNCDECL_SYS (nanosleep, int, -+ (struct timespec const *__rqtp, struct timespec *__rmtp) -+ _GL_ARG_NONNULL ((1))); -+# endif -+_GL_CXXALIAS_SYS (nanosleep, int, -+ (struct timespec const *__rqtp, struct timespec *__rmtp)); -+# endif -+_GL_CXXALIASWARN (nanosleep); -+# endif -+ -+/* Return the 'time_t' representation of TP and normalize TP. */ -+# if 0 -+# if GNULIB_PORTCHECK -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define mktime rpl_mktime -+# endif -+_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); -+# else -+_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); -+# endif -+_GL_CXXALIASWARN (mktime); -+# endif -+ -+/* Convert TIMER to RESULT, assuming local time and UTC respectively. See -+ and -+ . */ -+# if 0 -+# if GNULIB_PORTCHECK -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef localtime_r -+# define localtime_r rpl_localtime_r -+# endif -+_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result) -+ _GL_ARG_NONNULL ((1, 2))); -+_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result)); -+# else -+# if ! 1 -+_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result) -+ _GL_ARG_NONNULL ((1, 2))); -+# endif -+_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result)); -+# endif -+# if 1 -+_GL_CXXALIASWARN (localtime_r); -+# endif -+# if GNULIB_PORTCHECK -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef gmtime_r -+# define gmtime_r rpl_gmtime_r -+# endif -+_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result) -+ _GL_ARG_NONNULL ((1, 2))); -+_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result)); -+# else -+# if ! 1 -+_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result) -+ _GL_ARG_NONNULL ((1, 2))); -+# endif -+_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result)); -+# endif -+# if 1 -+_GL_CXXALIASWARN (gmtime_r); -+# endif -+# endif -+ -+/* Convert TIMER to RESULT, assuming local time and UTC respectively. See -+ and -+ . */ -+# if 1 -+# if 0 -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef localtime -+# define localtime rpl_localtime -+# endif -+_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); -+# else -+_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); -+# endif -+_GL_CXXALIASWARN (localtime); -+# endif -+ -+# if 1 -+# if 0 -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef gmtime -+# define gmtime rpl_gmtime -+# endif -+_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); -+# else -+_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); -+# endif -+_GL_CXXALIASWARN (gmtime); -+# endif -+ -+/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store -+ the resulting broken-down time into TM. See -+ . */ -+# if 0 -+# if ! 1 -+_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, -+ char const *restrict __format, -+ struct tm *restrict __tm) -+ _GL_ARG_NONNULL ((1, 2, 3))); -+# endif -+_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, -+ char const *restrict __format, -+ struct tm *restrict __tm)); -+_GL_CXXALIASWARN (strptime); -+# endif -+ -+/* Convert TM to a time_t value, assuming UTC. */ -+# if 0 -+# if GNULIB_PORTCHECK -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef timegm -+# define timegm rpl_timegm -+# endif -+_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); -+# else -+# if ! 1 -+_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); -+# endif -+_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); -+# endif -+_GL_CXXALIASWARN (timegm); -+# endif -+ -+/* Encourage applications to avoid unsafe functions that can overrun -+ buffers when given outlandish struct tm values. Portable -+ applications should use strftime (or even sprintf) instead. */ -+# if defined GNULIB_POSIXCHECK -+# undef asctime -+_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " -+ "better use strftime (or even sprintf) instead"); -+# endif -+# if defined GNULIB_POSIXCHECK -+# undef asctime_r -+_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - " -+ "better use strftime (or even sprintf) instead"); -+# endif -+# if defined GNULIB_POSIXCHECK -+# undef ctime -+_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - " -+ "better use strftime (or even sprintf) instead"); -+# endif -+# if defined GNULIB_POSIXCHECK -+# undef ctime_r -+_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - " -+ "better use strftime (or even sprintf) instead"); -+# endif -+ -+#endif -diff --git a/grub-core/gnulib/time.in.h b/grub-core/gnulib/time.in.h -new file mode 100644 -index 00000000000..81abdf46e0b ---- /dev/null -+++ b/grub-core/gnulib/time.in.h -@@ -0,0 +1,274 @@ -+/* A more-standard . -+ -+ Copyright (C) 2007-2014 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3, or (at your option) -+ any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, see . */ -+ -+#if __GNUC__ >= 3 -+@PRAGMA_SYSTEM_HEADER@ -+#endif -+@PRAGMA_COLUMNS@ -+ -+/* Don't get in the way of glibc when it includes time.h merely to -+ declare a few standard symbols, rather than to declare all the -+ symbols. Also, Solaris 8 eventually includes itself -+ recursively; if that is happening, just include the system -+ without adding our own declarations. */ -+#if (defined __need_time_t || defined __need_clock_t \ -+ || defined __need_timespec \ -+ || defined _@GUARD_PREFIX@_TIME_H) -+ -+# @INCLUDE_NEXT@ @NEXT_TIME_H@ -+ -+#else -+ -+# define _@GUARD_PREFIX@_TIME_H -+ -+# @INCLUDE_NEXT@ @NEXT_TIME_H@ -+ -+/* NetBSD 5.0 mis-defines NULL. */ -+# include -+ -+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -+ -+/* The definition of _GL_ARG_NONNULL is copied here. */ -+ -+/* The definition of _GL_WARN_ON_USE is copied here. */ -+ -+/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3). -+ Or they define it with the wrong member names or define it in -+ (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, -+ but the pthreads-win32 library defines it in . */ -+# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ -+# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ -+# include -+# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ -+# include -+# else -+ -+# ifdef __cplusplus -+extern "C" { -+# endif -+ -+# if !GNULIB_defined_struct_timespec -+# undef timespec -+# define timespec rpl_timespec -+struct timespec -+{ -+ time_t tv_sec; -+ long int tv_nsec; -+}; -+# define GNULIB_defined_struct_timespec 1 -+# endif -+ -+# ifdef __cplusplus -+} -+# endif -+ -+# endif -+# endif -+ -+# if !GNULIB_defined_struct_time_t_must_be_integral -+/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires -+ time_t to be an integer type, even though C99 permits floating -+ point. We don't know of any implementation that uses floating -+ point, and it is much easier to write code that doesn't have to -+ worry about that corner case, so we force the issue. */ -+struct __time_t_must_be_integral { -+ unsigned int __floating_time_t_unsupported : (time_t) 1; -+}; -+# define GNULIB_defined_struct_time_t_must_be_integral 1 -+# endif -+ -+/* Sleep for at least RQTP seconds unless interrupted, If interrupted, -+ return -1 and store the remaining time into RMTP. See -+ . */ -+# if @GNULIB_NANOSLEEP@ -+# if @REPLACE_NANOSLEEP@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define nanosleep rpl_nanosleep -+# endif -+_GL_FUNCDECL_RPL (nanosleep, int, -+ (struct timespec const *__rqtp, struct timespec *__rmtp) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (nanosleep, int, -+ (struct timespec const *__rqtp, struct timespec *__rmtp)); -+# else -+# if ! @HAVE_NANOSLEEP@ -+_GL_FUNCDECL_SYS (nanosleep, int, -+ (struct timespec const *__rqtp, struct timespec *__rmtp) -+ _GL_ARG_NONNULL ((1))); -+# endif -+_GL_CXXALIAS_SYS (nanosleep, int, -+ (struct timespec const *__rqtp, struct timespec *__rmtp)); -+# endif -+_GL_CXXALIASWARN (nanosleep); -+# endif -+ -+/* Return the 'time_t' representation of TP and normalize TP. */ -+# if @GNULIB_MKTIME@ -+# if @REPLACE_MKTIME@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define mktime rpl_mktime -+# endif -+_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); -+# else -+_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); -+# endif -+_GL_CXXALIASWARN (mktime); -+# endif -+ -+/* Convert TIMER to RESULT, assuming local time and UTC respectively. See -+ and -+ . */ -+# if @GNULIB_TIME_R@ -+# if @REPLACE_LOCALTIME_R@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef localtime_r -+# define localtime_r rpl_localtime_r -+# endif -+_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result) -+ _GL_ARG_NONNULL ((1, 2))); -+_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result)); -+# else -+# if ! @HAVE_DECL_LOCALTIME_R@ -+_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result) -+ _GL_ARG_NONNULL ((1, 2))); -+# endif -+_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result)); -+# endif -+# if @HAVE_DECL_LOCALTIME_R@ -+_GL_CXXALIASWARN (localtime_r); -+# endif -+# if @REPLACE_LOCALTIME_R@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef gmtime_r -+# define gmtime_r rpl_gmtime_r -+# endif -+_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result) -+ _GL_ARG_NONNULL ((1, 2))); -+_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result)); -+# else -+# if ! @HAVE_DECL_LOCALTIME_R@ -+_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result) -+ _GL_ARG_NONNULL ((1, 2))); -+# endif -+_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, -+ struct tm *restrict __result)); -+# endif -+# if @HAVE_DECL_LOCALTIME_R@ -+_GL_CXXALIASWARN (gmtime_r); -+# endif -+# endif -+ -+/* Convert TIMER to RESULT, assuming local time and UTC respectively. See -+ and -+ . */ -+# if @GNULIB_GETTIMEOFDAY@ -+# if @REPLACE_LOCALTIME@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef localtime -+# define localtime rpl_localtime -+# endif -+_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); -+# else -+_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); -+# endif -+_GL_CXXALIASWARN (localtime); -+# endif -+ -+# if @GNULIB_GETTIMEOFDAY@ -+# if @REPLACE_GMTIME@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef gmtime -+# define gmtime rpl_gmtime -+# endif -+_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); -+# else -+_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); -+# endif -+_GL_CXXALIASWARN (gmtime); -+# endif -+ -+/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store -+ the resulting broken-down time into TM. See -+ . */ -+# if @GNULIB_STRPTIME@ -+# if ! @HAVE_STRPTIME@ -+_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, -+ char const *restrict __format, -+ struct tm *restrict __tm) -+ _GL_ARG_NONNULL ((1, 2, 3))); -+# endif -+_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, -+ char const *restrict __format, -+ struct tm *restrict __tm)); -+_GL_CXXALIASWARN (strptime); -+# endif -+ -+/* Convert TM to a time_t value, assuming UTC. */ -+# if @GNULIB_TIMEGM@ -+# if @REPLACE_TIMEGM@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef timegm -+# define timegm rpl_timegm -+# endif -+_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); -+# else -+# if ! @HAVE_TIMEGM@ -+_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); -+# endif -+_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); -+# endif -+_GL_CXXALIASWARN (timegm); -+# endif -+ -+/* Encourage applications to avoid unsafe functions that can overrun -+ buffers when given outlandish struct tm values. Portable -+ applications should use strftime (or even sprintf) instead. */ -+# if defined GNULIB_POSIXCHECK -+# undef asctime -+_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " -+ "better use strftime (or even sprintf) instead"); -+# endif -+# if defined GNULIB_POSIXCHECK -+# undef asctime_r -+_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - " -+ "better use strftime (or even sprintf) instead"); -+# endif -+# if defined GNULIB_POSIXCHECK -+# undef ctime -+_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - " -+ "better use strftime (or even sprintf) instead"); -+# endif -+# if defined GNULIB_POSIXCHECK -+# undef ctime_r -+_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - " -+ "better use strftime (or even sprintf) instead"); -+# endif -+ -+#endif diff --git a/include/grub/osdep/hostfile_aros.h b/include/grub/osdep/hostfile_aros.h index a059c0fa40a..161fbb7bdfd 100644 --- a/include/grub/osdep/hostfile_aros.h @@ -2432,1300 +80,3 @@ index bf6451b6db4..8c92d0591bb 100644 int grub_util_unlink (const char *name); void -diff --git a/grub-core/gnulib/Makefile.am b/grub-core/gnulib/Makefile.am -index 3444397fe37..b7c5e60e1c3 100644 ---- a/grub-core/gnulib/Makefile.am -+++ b/grub-core/gnulib/Makefile.am -@@ -21,7 +21,7 @@ - # the same distribution terms as the rest of that program. - # - # Generated by gnulib-tool. --# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname regex -+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname readlink regex - - AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects - -@@ -326,6 +326,15 @@ libgnu_a_SOURCES += gettext.h - - ## end gnulib module gettext-h - -+## begin gnulib module gettimeofday -+ -+ -+EXTRA_DIST += gettimeofday.c -+ -+EXTRA_libgnu_a_SOURCES += gettimeofday.c -+ -+## end gnulib module gettimeofday -+ - ## begin gnulib module havelib - - -@@ -596,6 +605,13 @@ EXTRA_libgnu_a_SOURCES += nl_langinfo.c - - ## end gnulib module nl_langinfo - -+## begin gnulib module pathmax -+ -+ -+EXTRA_DIST += pathmax.h -+ -+## end gnulib module pathmax -+ - ## begin gnulib module progname - - libgnu_a_SOURCES += progname.h progname.c -@@ -611,6 +627,15 @@ EXTRA_libgnu_a_SOURCES += rawmemchr.c - - ## end gnulib module rawmemchr - -+## begin gnulib module readlink -+ -+ -+EXTRA_DIST += readlink.c -+ -+EXTRA_libgnu_a_SOURCES += readlink.c -+ -+## end gnulib module readlink -+ - ## begin gnulib module realloc-posix - - -@@ -725,6 +750,15 @@ EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h - - ## end gnulib module snippet/warn-on-use - -+## begin gnulib module stat -+ -+ -+EXTRA_DIST += stat.c -+ -+EXTRA_libgnu_a_SOURCES += stat.c -+ -+## end gnulib module stat -+ - ## begin gnulib module stdalign - - BUILT_SOURCES += $(STDALIGN_H) -@@ -1280,6 +1314,102 @@ libgnu_a_SOURCES += strnlen1.h strnlen1.c - - ## end gnulib module strnlen1 - -+## begin gnulib module sys_stat -+ -+BUILT_SOURCES += sys/stat.h -+ -+# We need the following in order to create when the system -+# has one that is incomplete. -+sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -+ $(AM_V_at)$(MKDIR_P) sys -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -+ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -+ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ -+ -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ -+ -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ -+ -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ -+ -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ -+ -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ -+ -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \ -+ -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \ -+ -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \ -+ -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \ -+ -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \ -+ -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ -+ -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ -+ -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ -+ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -+ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -+ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ -+ -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ -+ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -+ -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ -+ -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ -+ -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ -+ -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ -+ -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ -+ -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ -+ -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ -+ -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ -+ -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ -+ -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ -+ -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ -+ -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ -+ -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ -+ -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ -+ -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ -+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ -+ < $(srcdir)/sys_stat.in.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t -+MOSTLYCLEANDIRS += sys -+ -+EXTRA_DIST += sys_stat.in.h -+ -+## end gnulib module sys_stat -+ -+## begin gnulib module sys_time -+ -+BUILT_SOURCES += sys/time.h -+ -+# We need the following in order to create when the system -+# doesn't have one that works with the given compiler. -+sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -+ $(AM_V_at)$(MKDIR_P) sys -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -+ -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \ -+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -+ -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ -+ -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ -+ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -+ -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \ -+ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ -+ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ -+ -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \ -+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ -+ < $(srcdir)/sys_time.in.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+MOSTLYCLEANFILES += sys/time.h sys/time.h-t -+ -+EXTRA_DIST += sys_time.in.h -+ -+## end gnulib module sys_time -+ - ## begin gnulib module sys_types - - BUILT_SOURCES += sys/types.h -@@ -1334,6 +1464,51 @@ EXTRA_DIST += sysexits.in.h - - ## end gnulib module sysexits - -+## begin gnulib module time -+ -+BUILT_SOURCES += time.h -+ -+# We need the following in order to create when the system -+# doesn't have one that works with the given compiler. -+time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ -+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -+ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ -+ -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ -+ -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ -+ -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ -+ -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ -+ -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ -+ -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ -+ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -+ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -+ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -+ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ -+ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -+ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -+ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ -+ -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ -+ -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ -+ -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ -+ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -+ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -+ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ -+ < $(srcdir)/time.in.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+MOSTLYCLEANFILES += time.h time.h-t -+ -+EXTRA_DIST += time.in.h -+ -+## end gnulib module time -+ - ## begin gnulib module unistd - - BUILT_SOURCES += unistd.h -diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4 -new file mode 100644 -index 00000000000..1c2d66ee261 ---- /dev/null -+++ b/m4/gettimeofday.m4 -@@ -0,0 +1,138 @@ -+# serial 21 -+ -+# Copyright (C) 2001-2003, 2005, 2007, 2009-2014 Free Software Foundation, Inc. -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+dnl From Jim Meyering. -+ -+AC_DEFUN([gl_FUNC_GETTIMEOFDAY], -+[ -+ AC_REQUIRE([AC_C_RESTRICT]) -+ AC_REQUIRE([gl_HEADER_SYS_TIME_H]) -+ AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) -+ AC_CHECK_FUNCS_ONCE([gettimeofday]) -+ -+ gl_gettimeofday_timezone=void -+ if test $ac_cv_func_gettimeofday != yes; then -+ HAVE_GETTIMEOFDAY=0 -+ else -+ gl_FUNC_GETTIMEOFDAY_CLOBBER -+ AC_CACHE_CHECK([for gettimeofday with POSIX signature], -+ [gl_cv_func_gettimeofday_posix_signature], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ struct timeval c; -+ int gettimeofday (struct timeval *restrict, void *restrict); -+ ]], -+ [[/* glibc uses struct timezone * rather than the POSIX void * -+ if _GNU_SOURCE is defined. However, since the only portable -+ use of gettimeofday uses NULL as the second parameter, and -+ since the glibc definition is actually more typesafe, it is -+ not worth wrapping this to get a compliant signature. */ -+ int (*f) (struct timeval *restrict, void *restrict) -+ = gettimeofday; -+ int x = f (&c, 0); -+ return !(x | c.tv_sec | c.tv_usec); -+ ]])], -+ [gl_cv_func_gettimeofday_posix_signature=yes], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+int gettimeofday (struct timeval *restrict, struct timezone *restrict); -+ ]])], -+ [gl_cv_func_gettimeofday_posix_signature=almost], -+ [gl_cv_func_gettimeofday_posix_signature=no])])]) -+ if test $gl_cv_func_gettimeofday_posix_signature = almost; then -+ gl_gettimeofday_timezone='struct timezone' -+ elif test $gl_cv_func_gettimeofday_posix_signature != yes; then -+ REPLACE_GETTIMEOFDAY=1 -+ fi -+ dnl If we override 'struct timeval', we also have to override gettimeofday. -+ if test $REPLACE_STRUCT_TIMEVAL = 1; then -+ REPLACE_GETTIMEOFDAY=1 -+ fi -+ m4_ifdef([gl_FUNC_TZSET_CLOBBER], [ -+ gl_FUNC_TZSET_CLOBBER -+ case "$gl_cv_func_tzset_clobber" in -+ *yes) -+ REPLACE_GETTIMEOFDAY=1 -+ gl_GETTIMEOFDAY_REPLACE_LOCALTIME -+ AC_DEFINE([tzset], [rpl_tzset], -+ [Define to rpl_tzset if the wrapper function should be used.]) -+ AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1], -+ [Define if tzset clobbers localtime's static buffer.]) -+ ;; -+ esac -+ ]) -+ fi -+ AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone], -+ [Define this to 'void' or 'struct timezone' to match the system's -+ declaration of the second argument to gettimeofday.]) -+]) -+ -+ -+dnl See if gettimeofday clobbers the static buffer that localtime uses -+dnl for its return value. The gettimeofday function from Mac OS X 10.0.4 -+dnl (i.e., Darwin 1.3.7) has this problem. -+dnl -+dnl If it does, then arrange to use gettimeofday and localtime only via -+dnl the wrapper functions that work around the problem. -+ -+AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER], -+[ -+ AC_REQUIRE([gl_HEADER_SYS_TIME_H]) -+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles -+ -+ AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer], -+ [gl_cv_func_gettimeofday_clobber], -+ [AC_RUN_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ #include -+ #include -+ #include -+ ]], -+ [[ -+ time_t t = 0; -+ struct tm *lt; -+ struct tm saved_lt; -+ struct timeval tv; -+ lt = localtime (&t); -+ saved_lt = *lt; -+ gettimeofday (&tv, NULL); -+ return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0; -+ ]])], -+ [gl_cv_func_gettimeofday_clobber=no], -+ [gl_cv_func_gettimeofday_clobber=yes], -+ [# When cross-compiling: -+ case "$host_os" in -+ # Guess all is fine on glibc systems. -+ *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; -+ # If we don't know, assume the worst. -+ *) gl_cv_func_gettimeofday_clobber="guessing yes" ;; -+ esac -+ ])]) -+ -+ case "$gl_cv_func_gettimeofday_clobber" in -+ *yes) -+ REPLACE_GETTIMEOFDAY=1 -+ gl_GETTIMEOFDAY_REPLACE_LOCALTIME -+ AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1], -+ [Define if gettimeofday clobbers the localtime buffer.]) -+ ;; -+ esac -+]) -+ -+AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [ -+ REPLACE_GMTIME=1 -+ REPLACE_LOCALTIME=1 -+]) -+ -+# Prerequisites of lib/gettimeofday.c. -+AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [ -+ AC_CHECK_HEADERS([sys/timeb.h]) -+ AC_CHECK_FUNCS([_ftime]) -+]) -diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 -index 408918440b6..ef2ec5bcce0 100644 ---- a/m4/gnulib-cache.m4 -+++ b/m4/gnulib-cache.m4 -@@ -27,7 +27,7 @@ - - - # Specification in the form of a command-line invocation: --# gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname regex -+# gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname readlink regex - - # Specification in the form of a few gnulib-tool.m4 macro invocations: - gl_LOCAL_DIR([]) -@@ -39,6 +39,7 @@ gl_MODULES([ - getline - gettext - progname -+ readlink - regex - ]) - gl_AVOID([]) -diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 -index 7a19f60d85e..66fd0eda901 100644 ---- a/m4/gnulib-comp.m4 -+++ b/m4/gnulib-comp.m4 -@@ -60,10 +60,13 @@ AC_DEFUN([gl_EARLY], - # Code from module getopt-posix: - # Code from module gettext: - # Code from module gettext-h: -+ # Code from module gettimeofday: - # Code from module havelib: - # Code from module include_next: - # Code from module intprops: - # Code from module langinfo: -+ # Code from module largefile: -+ AC_REQUIRE([AC_SYS_LARGEFILE]) - # Code from module localcharset: - # Code from module locale: - # Code from module localeconv: -@@ -81,8 +84,10 @@ AC_DEFUN([gl_EARLY], - # Code from module multiarch: - # Code from module nl_langinfo: - # Code from module nocrash: -+ # Code from module pathmax: - # Code from module progname: - # Code from module rawmemchr: -+ # Code from module readlink: - # Code from module realloc-posix: - # Code from module regex: - # Code from module size_max: -@@ -92,6 +97,7 @@ AC_DEFUN([gl_EARLY], - # Code from module snippet/c++defs: - # Code from module snippet/warn-on-use: - # Code from module ssize_t: -+ # Code from module stat: - # Code from module stdalign: - # Code from module stdbool: - # Code from module stddef: -@@ -108,8 +114,11 @@ AC_DEFUN([gl_EARLY], - # Code from module strndup: - # Code from module strnlen: - # Code from module strnlen1: -+ # Code from module sys_stat: -+ # Code from module sys_time: - # Code from module sys_types: - # Code from module sysexits: -+ # Code from module time: - # Code from module unistd: - # Code from module unitypes: - # Code from module uniwidth/base: -@@ -211,7 +220,14 @@ AC_DEFUN([gl_INIT], - AM_GNU_GETTEXT_VERSION([0.18.1]) - AC_SUBST([LIBINTL]) - AC_SUBST([LTLIBINTL]) -+ gl_FUNC_GETTIMEOFDAY -+ if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then -+ AC_LIBOBJ([gettimeofday]) -+ gl_PREREQ_GETTIMEOFDAY -+ fi -+ gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) - gl_LANGINFO_H -+ AC_REQUIRE([gl_LARGEFILE]) - gl_LOCALCHARSET - LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\"" - AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) -@@ -284,6 +300,7 @@ AC_DEFUN([gl_INIT], - AC_LIBOBJ([nl_langinfo]) - fi - gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) -+ gl_PATHMAX - AC_CHECK_DECLS([program_invocation_name], [], [], [#include ]) - AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include ]) - gl_FUNC_RAWMEMCHR -@@ -292,6 +309,12 @@ AC_DEFUN([gl_INIT], - gl_PREREQ_RAWMEMCHR - fi - gl_STRING_MODULE_INDICATOR([rawmemchr]) -+ gl_FUNC_READLINK -+ if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then -+ AC_LIBOBJ([readlink]) -+ gl_PREREQ_READLINK -+ fi -+ gl_UNISTD_MODULE_INDICATOR([readlink]) - gl_FUNC_REALLOC_POSIX - if test $REPLACE_REALLOC = 1; then - AC_LIBOBJ([realloc]) -@@ -309,6 +332,12 @@ AC_DEFUN([gl_INIT], - fi - gl_UNISTD_MODULE_INDICATOR([sleep]) - gt_TYPE_SSIZE_T -+ gl_FUNC_STAT -+ if test $REPLACE_STAT = 1; then -+ AC_LIBOBJ([stat]) -+ gl_PREREQ_STAT -+ fi -+ gl_SYS_STAT_MODULE_INDICATOR([stat]) - gl_STDALIGN_H - AM_STDBOOL_H - gl_STDDEF_H -@@ -355,9 +384,14 @@ AC_DEFUN([gl_INIT], - gl_PREREQ_STRNLEN - fi - gl_STRING_MODULE_INDICATOR([strnlen]) -+ gl_HEADER_SYS_STAT_H -+ AC_PROG_MKDIR_P -+ gl_HEADER_SYS_TIME_H -+ AC_PROG_MKDIR_P - gl_SYS_TYPES_H - AC_PROG_MKDIR_P - gl_SYSEXITS -+ gl_HEADER_TIME_H - gl_UNISTD_H - gl_LIBUNISTRING_LIBHEADER([0.9], [unitypes.h]) - gl_LIBUNISTRING_LIBHEADER([0.9], [uniwidth.h]) -@@ -562,6 +596,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/getopt1.c - lib/getopt_int.h - lib/gettext.h -+ lib/gettimeofday.c - lib/intprops.h - lib/itold.c - lib/langinfo.in.h -@@ -587,6 +622,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/msvc-nothrow.c - lib/msvc-nothrow.h - lib/nl_langinfo.c -+ lib/pathmax.h - lib/printf-args.c - lib/printf-args.h - lib/printf-parse.c -@@ -595,6 +631,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/progname.h - lib/rawmemchr.c - lib/rawmemchr.valgrind -+ lib/readlink.c - lib/realloc.c - lib/ref-add.sin - lib/ref-del.sin -@@ -606,6 +643,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/regexec.c - lib/size_max.h - lib/sleep.c -+ lib/stat.c - lib/stdalign.in.h - lib/stdbool.in.h - lib/stddef.in.h -@@ -627,8 +665,11 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/strnlen.c - lib/strnlen1.c - lib/strnlen1.h -+ lib/sys_stat.in.h -+ lib/sys_time.in.h - lib/sys_types.in.h - lib/sysexits.in.h -+ lib/time.in.h - lib/unistd.c - lib/unistd.in.h - lib/unitypes.in.h -@@ -667,6 +708,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/getline.m4 - m4/getopt.m4 - m4/gettext.m4 -+ m4/gettimeofday.m4 - m4/glibc2.m4 - m4/glibc21.m4 - m4/gnulib-common.m4 -@@ -681,6 +723,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/inttypes-pri.m4 - m4/inttypes_h.m4 - m4/langinfo_h.m4 -+ m4/largefile.m4 - m4/lcmessage.m4 - m4/lib-ld.m4 - m4/lib-link.m4 -@@ -712,16 +755,19 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/nls.m4 - m4/nocrash.m4 - m4/off_t.m4 -+ m4/pathmax.m4 - m4/po.m4 - m4/printf-posix.m4 - m4/printf.m4 - m4/progtest.m4 - m4/rawmemchr.m4 -+ m4/readlink.m4 - m4/realloc.m4 - m4/regex.m4 - m4/size_max.m4 - m4/sleep.m4 - m4/ssize_t.m4 -+ m4/stat.m4 - m4/stdalign.m4 - m4/stdbool.m4 - m4/stddef_h.m4 -@@ -737,9 +783,12 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/strndup.m4 - m4/strnlen.m4 - m4/sys_socket_h.m4 -+ m4/sys_stat_h.m4 -+ m4/sys_time_h.m4 - m4/sys_types_h.m4 - m4/sysexits.m4 - m4/threadlib.m4 -+ m4/time_h.m4 - m4/uintmax_t.m4 - m4/unistd_h.m4 - m4/vasnprintf.m4 -diff --git a/m4/largefile.m4 b/m4/largefile.m4 -new file mode 100644 -index 00000000000..a1b564ad9af ---- /dev/null -+++ b/m4/largefile.m4 -@@ -0,0 +1,146 @@ -+# Enable large files on systems where this is not the default. -+ -+# Copyright 1992-1996, 1998-2014 Free Software Foundation, Inc. -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# The following implementation works around a problem in autoconf <= 2.69; -+# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, -+# or configures them incorrectly in some cases. -+m4_version_prereq([2.70], [] ,[ -+ -+# _AC_SYS_LARGEFILE_TEST_INCLUDES -+# ------------------------------- -+m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], -+[@%:@include -+ /* Check that off_t can represent 2**63 - 1 correctly. -+ We can't simply define LARGE_OFF_T to be 9223372036854775807, -+ since some C++ compilers masquerading as C compilers -+ incorrectly reject 9223372036854775807. */ -+@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) -+ int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 -+ && LARGE_OFF_T % 2147483647 == 1) -+ ? 1 : -1]];[]dnl -+]) -+ -+ -+# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, -+# CACHE-VAR, -+# DESCRIPTION, -+# PROLOGUE, [FUNCTION-BODY]) -+# -------------------------------------------------------- -+m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], -+[AC_CACHE_CHECK([for $1 value needed for large files], [$3], -+[while :; do -+ m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( -+ [AC_LANG_PROGRAM([$5], [$6])], -+ [$3=no; break]) -+ m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( -+ [AC_LANG_PROGRAM([@%:@define $1 $2 -+$5], [$6])], -+ [$3=$2; break]) -+ $3=unknown -+ break -+done]) -+case $$3 in #( -+ no | unknown) ;; -+ *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);; -+esac -+rm -rf conftest*[]dnl -+])# _AC_SYS_LARGEFILE_MACRO_VALUE -+ -+ -+# AC_SYS_LARGEFILE -+# ---------------- -+# By default, many hosts won't let programs access large files; -+# one must use special compiler options to get large-file access to work. -+# For more details about this brain damage please see: -+# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html -+AC_DEFUN([AC_SYS_LARGEFILE], -+[AC_ARG_ENABLE(largefile, -+ [ --disable-largefile omit support for large files]) -+if test "$enable_largefile" != no; then -+ -+ AC_CACHE_CHECK([for special C compiler options needed for large files], -+ ac_cv_sys_largefile_CC, -+ [ac_cv_sys_largefile_CC=no -+ if test "$GCC" != yes; then -+ ac_save_CC=$CC -+ while :; do -+ # IRIX 6.2 and later do not support large files by default, -+ # so use the C compiler's -n32 option if that helps. -+ AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])]) -+ AC_COMPILE_IFELSE([], [break]) -+ CC="$CC -n32" -+ AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break]) -+ break -+ done -+ CC=$ac_save_CC -+ rm -f conftest.$ac_ext -+ fi]) -+ if test "$ac_cv_sys_largefile_CC" != no; then -+ CC=$CC$ac_cv_sys_largefile_CC -+ fi -+ -+ _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, -+ ac_cv_sys_file_offset_bits, -+ [Number of bits in a file offset, on hosts where this is settable.], -+ [_AC_SYS_LARGEFILE_TEST_INCLUDES]) -+ if test $ac_cv_sys_file_offset_bits = unknown; then -+ _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, -+ ac_cv_sys_large_files, -+ [Define for large files, on AIX-style hosts.], -+ [_AC_SYS_LARGEFILE_TEST_INCLUDES]) -+ fi -+ -+ AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1], -+ [Enable large inode numbers on Mac OS X 10.5.]) -+fi -+])# AC_SYS_LARGEFILE -+])# m4_version_prereq 2.70 -+ -+# Enable large files on systems where this is implemented by Gnulib, not by the -+# system headers. -+# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib -+# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively. -+AC_DEFUN([gl_LARGEFILE], -+[ -+ AC_REQUIRE([AC_CANONICAL_HOST]) -+ case "$host_os" in -+ mingw*) -+ dnl Native Windows. -+ dnl mingw64 defines off_t to a 64-bit type already, if -+ dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. -+ AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; -+ ]], -+ [[]])], -+ [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no]) -+ ]) -+ if test $gl_cv_type_off_t_64 = no; then -+ WINDOWS_64_BIT_OFF_T=1 -+ else -+ WINDOWS_64_BIT_OFF_T=0 -+ fi -+ dnl But all native Windows platforms (including mingw64) have a 32-bit -+ dnl st_size member in 'struct stat'. -+ WINDOWS_64_BIT_ST_SIZE=1 -+ ;; -+ *) -+ dnl Nothing to do on gnulib's side. -+ dnl A 64-bit off_t is -+ dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX, -+ dnl OSF/1, Cygwin, -+ dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on -+ dnl glibc, HP-UX, Solaris, -+ dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX, -+ dnl - impossible to achieve on Minix 3.1.8. -+ WINDOWS_64_BIT_OFF_T=0 -+ WINDOWS_64_BIT_ST_SIZE=0 -+ ;; -+ esac -+]) -diff --git a/m4/pathmax.m4 b/m4/pathmax.m4 -new file mode 100644 -index 00000000000..114f91f04b5 ---- /dev/null -+++ b/m4/pathmax.m4 -@@ -0,0 +1,42 @@ -+# pathmax.m4 serial 10 -+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation, -+dnl Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_PATHMAX], -+[ -+ dnl Prerequisites of lib/pathmax.h. -+ AC_CHECK_HEADERS_ONCE([sys/param.h]) -+]) -+ -+# Expands to a piece of C program that defines PATH_MAX in the same way as -+# "pathmax.h" will do. -+AC_DEFUN([gl_PATHMAX_SNIPPET], [[ -+/* Arrange to define PATH_MAX, like "pathmax.h" does. */ -+#if HAVE_UNISTD_H -+# include -+#endif -+#include -+#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN -+# include -+#endif -+#if !defined PATH_MAX && defined MAXPATHLEN -+# define PATH_MAX MAXPATHLEN -+#endif -+#ifdef __hpux -+# undef PATH_MAX -+# define PATH_MAX 1024 -+#endif -+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -+# undef PATH_MAX -+# define PATH_MAX 260 -+#endif -+]]) -+ -+# Prerequisites of gl_PATHMAX_SNIPPET. -+AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ], -+[ -+ AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) -+]) -diff --git a/m4/readlink.m4 b/m4/readlink.m4 -new file mode 100644 -index 00000000000..f9ce868c2e4 ---- /dev/null -+++ b/m4/readlink.m4 -@@ -0,0 +1,71 @@ -+# readlink.m4 serial 12 -+dnl Copyright (C) 2003, 2007, 2009-2014 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_FUNC_READLINK], -+[ -+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) -+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles -+ AC_CHECK_FUNCS_ONCE([readlink]) -+ if test $ac_cv_func_readlink = no; then -+ HAVE_READLINK=0 -+ else -+ AC_CACHE_CHECK([whether readlink signature is correct], -+ [gl_cv_decl_readlink_works], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ /* Cause compilation failure if original declaration has wrong type. */ -+ ssize_t readlink (const char *, char *, size_t);]])], -+ [gl_cv_decl_readlink_works=yes], [gl_cv_decl_readlink_works=no])]) -+ dnl Solaris 9 ignores trailing slash. -+ dnl FreeBSD 7.2 dereferences only one level of links with trailing slash. -+ AC_CACHE_CHECK([whether readlink handles trailing slash correctly], -+ [gl_cv_func_readlink_works], -+ [# We have readlink, so assume ln -s works. -+ ln -s conftest.no-such conftest.link -+ ln -s conftest.link conftest.lnk2 -+ AC_RUN_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+]], [[char buf[20]; -+ return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])], -+ [gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no], -+ [case "$host_os" in -+ # Guess yes on glibc systems. -+ *-gnu*) gl_cv_func_readlink_works="guessing yes" ;; -+ # If we don't know, assume the worst. -+ *) gl_cv_func_readlink_works="guessing no" ;; -+ esac -+ ]) -+ rm -f conftest.link conftest.lnk2]) -+ case "$gl_cv_func_readlink_works" in -+ *yes) -+ if test "$gl_cv_decl_readlink_works" != yes; then -+ REPLACE_READLINK=1 -+ fi -+ ;; -+ *) -+ AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink -+ fails to recognize a trailing slash.]) -+ REPLACE_READLINK=1 -+ ;; -+ esac -+ fi -+]) -+ -+# Like gl_FUNC_READLINK, except prepare for separate compilation -+# (no REPLACE_READLINK, no AC_LIBOBJ). -+AC_DEFUN([gl_FUNC_READLINK_SEPARATE], -+[ -+ AC_CHECK_FUNCS_ONCE([readlink]) -+ gl_PREREQ_READLINK -+]) -+ -+# Prerequisites of lib/readlink.c. -+AC_DEFUN([gl_PREREQ_READLINK], -+[ -+ : -+]) -diff --git a/m4/stat.m4 b/m4/stat.m4 -new file mode 100644 -index 00000000000..1ae327b3684 ---- /dev/null -+++ b/m4/stat.m4 -@@ -0,0 +1,71 @@ -+# serial 11 -+ -+# Copyright (C) 2009-2014 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_FUNC_STAT], -+[ -+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles -+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) -+ AC_CHECK_FUNCS_ONCE([lstat]) -+ dnl mingw is the only known platform where stat(".") and stat("./") differ -+ AC_CACHE_CHECK([whether stat handles trailing slashes on directories], -+ [gl_cv_func_stat_dir_slash], -+ [AC_RUN_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])], -+ [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no], -+ [case $host_os in -+ mingw*) gl_cv_func_stat_dir_slash="guessing no";; -+ *) gl_cv_func_stat_dir_slash="guessing yes";; -+ esac])]) -+ dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). -+ dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) -+ dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). -+ AC_CACHE_CHECK([whether stat handles trailing slashes on files], -+ [gl_cv_func_stat_file_slash], -+ [touch conftest.tmp -+ # Assume that if we have lstat, we can also check symlinks. -+ if test $ac_cv_func_lstat = yes; then -+ ln -s conftest.tmp conftest.lnk -+ fi -+ AC_RUN_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+]], [[int result = 0; -+ struct stat st; -+ if (!stat ("conftest.tmp/", &st)) -+ result |= 1; -+#if HAVE_LSTAT -+ if (!stat ("conftest.lnk/", &st)) -+ result |= 2; -+#endif -+ return result; -+ ]])], -+ [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], -+ [case "$host_os" in -+ # Guess yes on glibc systems. -+ *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; -+ # If we don't know, assume the worst. -+ *) gl_cv_func_stat_file_slash="guessing no" ;; -+ esac -+ ]) -+ rm -f conftest.tmp conftest.lnk]) -+ case $gl_cv_func_stat_dir_slash in -+ *no) REPLACE_STAT=1 -+ AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs -+ help when passed a directory name with a trailing slash]);; -+ esac -+ case $gl_cv_func_stat_file_slash in -+ *no) REPLACE_STAT=1 -+ AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs -+ help when passed a file name with a trailing slash]);; -+ esac -+]) -+ -+# Prerequisites of lib/stat.c. -+AC_DEFUN([gl_PREREQ_STAT], [:]) -diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 -new file mode 100644 -index 00000000000..eaa7642ba31 ---- /dev/null -+++ b/m4/sys_stat_h.m4 -@@ -0,0 +1,96 @@ -+# sys_stat_h.m4 serial 28 -*- Autoconf -*- -+dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Eric Blake. -+dnl Provide a GNU-like . -+ -+AC_DEFUN([gl_HEADER_SYS_STAT_H], -+[ -+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) -+ -+ dnl Check for broken stat macros. -+ AC_REQUIRE([AC_HEADER_STAT]) -+ -+ gl_CHECK_NEXT_HEADERS([sys/stat.h]) -+ -+ dnl Ensure the type mode_t gets defined. -+ AC_REQUIRE([AC_TYPE_MODE_T]) -+ -+ dnl Whether to override 'struct stat'. -+ m4_ifdef([gl_LARGEFILE], [ -+ AC_REQUIRE([gl_LARGEFILE]) -+ ], [ -+ WINDOWS_64_BIT_ST_SIZE=0 -+ ]) -+ AC_SUBST([WINDOWS_64_BIT_ST_SIZE]) -+ if test $WINDOWS_64_BIT_ST_SIZE = 1; then -+ AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1], -+ [Define to 1 if Gnulib overrides 'struct stat' on Windows so that -+ struct stat.st_size becomes 64-bit.]) -+ fi -+ -+ dnl Define types that are supposed to be defined in or -+ dnl . -+ AC_CHECK_TYPE([nlink_t], [], -+ [AC_DEFINE([nlink_t], [int], -+ [Define to the type of st_nlink in struct stat, or a supertype.])], -+ [#include -+ #include ]) -+ -+ dnl Check for declarations of anything we want to poison if the -+ dnl corresponding gnulib module is not in use. -+ gl_WARN_ON_USE_PREPARE([[#include -+ ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat -+ mknod mknodat stat utimensat]) -+]) # gl_HEADER_SYS_STAT_H -+ -+AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], -+[ -+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) -+ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -+ dnl Define it also as a C macro, for the benefit of the unit tests. -+ gl_MODULE_INDICATOR_FOR_TESTS([$1]) -+]) -+ -+AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], -+[ -+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR -+ GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) -+ GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT]) -+ GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) -+ GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) -+ GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) -+ GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) -+ GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) -+ GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) -+ GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) -+ GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) -+ GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) -+ GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) -+ GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) -+ dnl Assume proper GNU behavior unless another module says otherwise. -+ HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) -+ HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) -+ HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) -+ HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) -+ HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) -+ HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) -+ HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) -+ HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) -+ HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) -+ HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) -+ HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) -+ REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) -+ REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) -+ REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) -+ REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) -+ REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) -+ REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) -+ REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) -+ REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) -+ REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) -+]) -diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4 -new file mode 100644 -index 00000000000..5c79300f8ec ---- /dev/null -+++ b/m4/sys_time_h.m4 -@@ -0,0 +1,110 @@ -+# Configure a replacement for . -+# serial 8 -+ -+# Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc. -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# Written by Paul Eggert and Martin Lambers. -+ -+AC_DEFUN([gl_HEADER_SYS_TIME_H], -+[ -+ dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement -+ dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1 -+ dnl statements that occur in other macros. -+ AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY]) -+]) -+ -+AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], -+[ -+ AC_REQUIRE([AC_C_RESTRICT]) -+ AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) -+ AC_CHECK_HEADERS_ONCE([sys/time.h]) -+ gl_CHECK_NEXT_HEADERS([sys/time.h]) -+ -+ if test $ac_cv_header_sys_time_h != yes; then -+ HAVE_SYS_TIME_H=0 -+ fi -+ -+ dnl On native Windows with MSVC, 'struct timeval' is defined in -+ dnl only. So include that header in the list. -+ gl_PREREQ_SYS_H_WINSOCK2 -+ AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#if HAVE_SYS_TIME_H -+ #include -+ #endif -+ #include -+ #if HAVE_WINSOCK2_H -+ # include -+ #endif -+ ]], -+ [[static struct timeval x; x.tv_sec = x.tv_usec;]])], -+ [gl_cv_sys_struct_timeval=yes], -+ [gl_cv_sys_struct_timeval=no]) -+ ]) -+ if test $gl_cv_sys_struct_timeval != yes; then -+ HAVE_STRUCT_TIMEVAL=0 -+ else -+ dnl On native Windows with a 64-bit 'time_t', 'struct timeval' is defined -+ dnl (in and for mingw64, in only -+ dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is -+ dnl smaller than the 'time_t' type mandated by POSIX. -+ dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but -+ dnl that is good enough. -+ AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member], -+ [gl_cv_sys_struct_timeval_tv_sec], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#if HAVE_SYS_TIME_H -+ #include -+ #endif -+ #include -+ #if HAVE_WINSOCK2_H -+ # include -+ #endif -+ ]], -+ [[static struct timeval x; -+ typedef int verify_tv_sec_type[ -+ sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1 -+ ]; -+ ]])], -+ [gl_cv_sys_struct_timeval_tv_sec=yes], -+ [gl_cv_sys_struct_timeval_tv_sec=no]) -+ ]) -+ if test $gl_cv_sys_struct_timeval_tv_sec != yes; then -+ REPLACE_STRUCT_TIMEVAL=1 -+ fi -+ fi -+ -+ dnl Check for declarations of anything we want to poison if the -+ dnl corresponding gnulib module is not in use. -+ gl_WARN_ON_USE_PREPARE([[ -+#if HAVE_SYS_TIME_H -+# include -+#endif -+#include -+ ]], [gettimeofday]) -+]) -+ -+AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR], -+[ -+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -+ AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) -+ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -+ dnl Define it also as a C macro, for the benefit of the unit tests. -+ gl_MODULE_INDICATOR_FOR_TESTS([$1]) -+]) -+ -+AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS], -+[ -+ GNULIB_GETTIMEOFDAY=0; AC_SUBST([GNULIB_GETTIMEOFDAY]) -+ dnl Assume POSIX behavior unless another module says otherwise. -+ HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY]) -+ HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL]) -+ HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H]) -+ REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY]) -+ REPLACE_STRUCT_TIMEVAL=0; AC_SUBST([REPLACE_STRUCT_TIMEVAL]) -+]) -diff --git a/m4/time_h.m4 b/m4/time_h.m4 -new file mode 100644 -index 00000000000..9852778f9a5 ---- /dev/null -+++ b/m4/time_h.m4 -@@ -0,0 +1,118 @@ -+# Configure a more-standard replacement for . -+ -+# Copyright (C) 2000-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc. -+ -+# serial 8 -+ -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# Written by Paul Eggert and Jim Meyering. -+ -+AC_DEFUN([gl_HEADER_TIME_H], -+[ -+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded -+ dnl once only, before all statements that occur in other macros. -+ AC_REQUIRE([gl_HEADER_TIME_H_BODY]) -+]) -+ -+AC_DEFUN([gl_HEADER_TIME_H_BODY], -+[ -+ AC_REQUIRE([AC_C_RESTRICT]) -+ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) -+ gl_NEXT_HEADERS([time.h]) -+ AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) -+]) -+ -+dnl Check whether 'struct timespec' is declared -+dnl in time.h, sys/time.h, or pthread.h. -+ -+AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], -+[ -+ AC_CHECK_HEADERS_ONCE([sys/time.h]) -+ AC_CACHE_CHECK([for struct timespec in ], -+ [gl_cv_sys_struct_timespec_in_time_h], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ ]], -+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], -+ [gl_cv_sys_struct_timespec_in_time_h=yes], -+ [gl_cv_sys_struct_timespec_in_time_h=no])]) -+ -+ TIME_H_DEFINES_STRUCT_TIMESPEC=0 -+ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 -+ PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 -+ if test $gl_cv_sys_struct_timespec_in_time_h = yes; then -+ TIME_H_DEFINES_STRUCT_TIMESPEC=1 -+ else -+ AC_CACHE_CHECK([for struct timespec in ], -+ [gl_cv_sys_struct_timespec_in_sys_time_h], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ ]], -+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], -+ [gl_cv_sys_struct_timespec_in_sys_time_h=yes], -+ [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) -+ if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then -+ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 -+ else -+ AC_CACHE_CHECK([for struct timespec in ], -+ [gl_cv_sys_struct_timespec_in_pthread_h], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ ]], -+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], -+ [gl_cv_sys_struct_timespec_in_pthread_h=yes], -+ [gl_cv_sys_struct_timespec_in_pthread_h=no])]) -+ if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then -+ PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 -+ fi -+ fi -+ fi -+ AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) -+ AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) -+ AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) -+]) -+ -+AC_DEFUN([gl_TIME_MODULE_INDICATOR], -+[ -+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -+ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) -+ gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -+ dnl Define it also as a C macro, for the benefit of the unit tests. -+ gl_MODULE_INDICATOR_FOR_TESTS([$1]) -+]) -+ -+AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], -+[ -+ GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME]) -+ GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP]) -+ GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) -+ GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) -+ GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) -+ dnl Assume proper GNU behavior unless another module says otherwise. -+ HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) -+ HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) -+ HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) -+ HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) -+ dnl If another module says to replace or to not replace, do that. -+ dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; -+ dnl this lets maintainers check for portability. -+ REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) -+ REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) -+ REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) -+ REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) -+ -+ dnl Hack so that the time module doesn't depend on the sys_time module. -+ dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent. -+ : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY]) -+ dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME -+ dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier -+ dnl is no longer a big deal. -+ REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) -+ REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) -+]) diff --git a/0052-Make-editenv-chase-symlinks-including-those-across-d.patch b/0052-Make-editenv-chase-symlinks-including-those-across-d.patch index 2f23fda2..288febac 100644 --- a/0052-Make-editenv-chase-symlinks-including-those-across-d.patch +++ b/0052-Make-editenv-chase-symlinks-including-those-across-d.patch @@ -16,10 +16,10 @@ Reviewed-by: Adam Jackson 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/Makefile.util.def b/Makefile.util.def -index c7b775bce73..3efc5718ae8 100644 +index 8717774d510..1f298d05f3d 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -231,8 +231,19 @@ program = { +@@ -240,8 +240,19 @@ program = { common = util/grub-editenv.c; common = util/editenv.c; @@ -40,7 +40,7 @@ index c7b775bce73..3efc5718ae8 100644 ldadd = libgrubgcry.a; ldadd = libgrubkern.a; diff --git a/util/editenv.c b/util/editenv.c -index c6f8d2298c3..d8d1dad6ab9 100644 +index eb2d0c03a98..e61dc1283a4 100644 --- a/util/editenv.c +++ b/util/editenv.c @@ -37,6 +37,7 @@ grub_util_create_envblk_file (const char *name) @@ -51,7 +51,7 @@ index c6f8d2298c3..d8d1dad6ab9 100644 buf = xmalloc (DEFAULT_ENVBLK_SIZE); -@@ -59,7 +60,48 @@ grub_util_create_envblk_file (const char *name) +@@ -60,7 +61,48 @@ grub_util_create_envblk_file (const char *name) free (buf); fclose (fp); diff --git a/0053-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0053-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index 81e0e527..6acd50e9 100644 --- a/0053-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0053-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index b744438e04a..43d98476b88 100644 +index d35b0f406bc..d12d2d784dc 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0055-Try-prefix-if-fw_path-doesn-t-work.patch b/0055-Try-prefix-if-fw_path-doesn-t-work.patch index 6878d1aa..6c167e99 100644 --- a/0055-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0055-Try-prefix-if-fw_path-doesn-t-work.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Fri, 3 Oct 2014 11:08:03 -0400 +Date: Tue, 9 Jul 2019 10:35:16 +0200 Subject: [PATCH] Try $prefix if $fw_path doesn't work. Related: rhbz#1148652 @@ -13,10 +13,10 @@ Signed-off-by: Peter Jones 3 files changed, 75 insertions(+), 75 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index f5423ce27d9..e01bc6eab19 100644 +index e71d1584164..0cd2a627231 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -124,23 +124,25 @@ grub_machine_get_bootlocation (char **device, char **path) +@@ -127,23 +127,25 @@ grub_machine_get_bootlocation (char **device, char **path) grub_free (canon); } else @@ -56,7 +56,7 @@ index f5423ce27d9..e01bc6eab19 100644 } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0769bf850d3..16d2ce06d5a 100644 +index 06454564b8f..4b7972b8e7e 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1850,7 +1850,7 @@ grub_net_search_configfile (char *config) @@ -69,7 +69,7 @@ index 0769bf850d3..16d2ce06d5a 100644 static struct grub_preboot *fini_hnd; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index cf5c0b273ce..ea749f26fd5 100644 +index d93bee613ac..2fe6743399d 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -337,74 +337,72 @@ grub_enter_normal_mode (const char *config) @@ -89,31 +89,31 @@ index cf5c0b273ce..ea749f26fd5 100644 + + if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) + { -+ grub_size_t config_len; -+ config_len = grub_strlen (prefix) + -+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); -+ config = grub_malloc (config_len); ++ grub_size_t config_len; ++ config_len = grub_strlen (prefix) + ++ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); ++ config = grub_malloc (config_len); + -+ if (! config) -+ return GRUB_ERR_FILE_NOT_FOUND; ++ if (! config) ++ return GRUB_ERR_FILE_NOT_FOUND; + -+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix); -+ err = grub_net_search_configfile (config); ++ grub_snprintf (config, config_len, "%s/grub.cfg", prefix); ++ err = grub_net_search_configfile (config); + } + + if (err != GRUB_ERR_NONE) + { -+ config = grub_xasprintf ("%s/grub.cfg", prefix); -+ if (config) -+ { -+ grub_file_t file; -+ file = grub_file_open (config); -+ if (file) -+ { -+ grub_file_close (file); -+ err = GRUB_ERR_NONE; -+ } -+ } ++ config = grub_xasprintf ("%s/grub.cfg", prefix); ++ if (config) ++ { ++ grub_file_t file; ++ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); ++ if (file) ++ { ++ grub_file_close (file); ++ err = GRUB_ERR_NONE; ++ } ++ } + } + + if (err == GRUB_ERR_NONE) @@ -141,52 +141,52 @@ index cf5c0b273ce..ea749f26fd5 100644 - prefix = grub_env_get ("prefix"); - - if (prefix) -- { -- if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) -- { -- grub_size_t config_len; -- config_len = grub_strlen (prefix) + -- sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); -- config = grub_malloc (config_len); +- { +- if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) +- { +- grub_size_t config_len; +- config_len = grub_strlen (prefix) + +- sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); +- config = grub_malloc (config_len); - -- if (! config) -- goto quit; +- if (! config) +- goto quit; - -- grub_snprintf (config, config_len, "%s/grub.cfg", prefix); +- grub_snprintf (config, config_len, "%s/grub.cfg", prefix); - -- grub_net_search_configfile (config); +- grub_net_search_configfile (config); - -- grub_enter_normal_mode (config); -- grub_free (config); -- config = NULL; -- } +- grub_enter_normal_mode (config); +- grub_free (config); +- config = NULL; +- } - -- if (!config) -- { -- config = grub_xasprintf ("%s/grub.cfg", prefix); -- if (config) -- { -- grub_file_t file; +- if (!config) +- { +- config = grub_xasprintf ("%s/grub.cfg", prefix); +- if (config) +- { +- grub_file_t file; - -- file = grub_file_open (config); -- if (file) -- { -- grub_file_close (file); -- grub_enter_normal_mode (config); -- } -- else -- { -- /* Ignore all errors. */ -- grub_errno = 0; -- } -- grub_free (config); -- } -- } -- } +- file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); +- if (file) +- { +- grub_file_close (file); +- grub_enter_normal_mode (config); +- } +- else +- { +- /* Ignore all errors. */ +- grub_errno = 0; +- } +- grub_free (config); +- } +- } +- } - else -- { -- grub_enter_normal_mode (0); -- } +- { +- grub_enter_normal_mode (0); +- } - } - else + if (argc) diff --git a/0056-Update-info-with-grub.cfg-netboot-selection-order-11.patch b/0056-Update-info-with-grub.cfg-netboot-selection-order-11.patch index 26de3f42..afa32036 100644 --- a/0056-Update-info-with-grub.cfg-netboot-selection-order-11.patch +++ b/0056-Update-info-with-grub.cfg-netboot-selection-order-11.patch @@ -12,7 +12,7 @@ Resolves rhbz#1148650 1 file changed, 42 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 2fd32608c01..a7155c22ffe 100644 +index 6f524305085..221064b5679 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2493,6 +2493,48 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 diff --git a/0057-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/0057-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch index 305480a1..bfebe38c 100644 --- a/0057-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +++ b/0057-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch @@ -17,18 +17,17 @@ Signed-off-by: Peter Jones configure.ac | 29 +++++ Makefile.util.def | 16 +++ util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ - .gitignore | 2 + util/grub-mkconfig_lib.in | 11 +- util/grub-rpm-sort.8 | 12 ++ - 6 files changed, 350 insertions(+), 1 deletion(-) + 5 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 util/grub-rpm-sort.c create mode 100644 util/grub-rpm-sort.8 diff --git a/configure.ac b/configure.ac -index d5db2803ec4..00f1db29b1a 100644 +index 8df400e0a8b..6927615819b 100644 --- a/configure.ac +++ b/configure.ac -@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) +@@ -69,6 +69,7 @@ grub_TRANSFORM([grub-mkrelpath]) grub_TRANSFORM([grub-mkrescue]) grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-reboot]) @@ -36,7 +35,7 @@ index d5db2803ec4..00f1db29b1a 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-sparc64-setup]) -@@ -88,6 +89,7 @@ grub_TRANSFORM([grub-mkrescue.1]) +@@ -92,6 +93,7 @@ grub_TRANSFORM([grub-mkrescue.1]) grub_TRANSFORM([grub-mkstandalone.3]) grub_TRANSFORM([grub-ofpathname.3]) grub_TRANSFORM([grub-probe.3]) @@ -44,7 +43,7 @@ index d5db2803ec4..00f1db29b1a 100644 grub_TRANSFORM([grub-reboot.3]) grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) -@@ -1790,6 +1792,33 @@ fi +@@ -1802,6 +1804,33 @@ fi AC_SUBST([LIBDEVMAPPER]) @@ -79,10 +78,10 @@ index d5db2803ec4..00f1db29b1a 100644 if test x$host_kernel = xkfreebsd; then AC_CHECK_LIB([geom], [geom_gettree], [], diff --git a/Makefile.util.def b/Makefile.util.def -index 3efc5718ae8..bb21c87c8ed 100644 +index 1f298d05f3d..843ce092b94 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -687,6 +687,22 @@ program = { +@@ -696,6 +696,22 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -97,8 +96,8 @@ index 3efc5718ae8..bb21c87c8ed 100644 + common = util/misc.c; + common = util/grub-rpm-sort.c; + -+ ldadd = grub-core/gnulib/libgnu.a; + ldadd = libgrubkern.a; ++ ldadd = grub-core/lib/gnulib/libgnu.a; + ldadd = '$(LIBDEVMAPPER) $(LIBRPM)'; +}; + @@ -392,19 +391,6 @@ index 00000000000..f33bd1ed568 + + return 0; +} -diff --git a/.gitignore b/.gitignore -index 43f04d47277..fa2e5b609b1 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -105,6 +105,8 @@ grub-*.tar.* - /grub*-reboot.8 - /grub*-render-label - /grub*-render-label.1 -+/grub*-rpm-sort -+/grub*-rpm-sort.8 - /grub*-script-check - /grub*-script-check.1 - /grub*-set-default diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index 1a4a57898f9..113a41f9409 100644 --- a/util/grub-mkconfig_lib.in diff --git a/0059-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0059-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index 3bbaa1d9..635a234d 100644 --- a/0059-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0059-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 43d98476b88..a8a8e2cf325 100644 +index d12d2d784dc..12a20c9ad73 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -78,6 +78,32 @@ case x"$GRUB_FS" in diff --git a/0060-Add-friendly-grub2-password-config-tool-985962.patch b/0060-Add-friendly-grub2-password-config-tool-985962.patch index 838d2f4a..5374425f 100644 --- a/0060-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0060-Add-friendly-grub2-password-config-tool-985962.patch @@ -17,21 +17,20 @@ Andy Lutomirski --- configure.ac | 1 + Makefile.util.def | 13 +++++ - .gitignore | 2 + util/grub-mkconfig.in | 2 + util/grub-set-password.8 | 28 ++++++++++ util/grub-set-password.in | 128 ++++++++++++++++++++++++++++++++++++++++++++++ util/grub.d/01_users.in | 11 ++++ - 7 files changed, 185 insertions(+) + 6 files changed, 183 insertions(+) create mode 100644 util/grub-set-password.8 create mode 100644 util/grub-set-password.in create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index 00f1db29b1a..1cb6a9615db 100644 +index 6927615819b..68501662e8d 100644 --- a/configure.ac +++ b/configure.ac -@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) +@@ -69,6 +69,7 @@ grub_TRANSFORM([grub-mkrelpath]) grub_TRANSFORM([grub-mkrescue]) grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-reboot]) @@ -40,10 +39,10 @@ index 00f1db29b1a..1cb6a9615db 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) diff --git a/Makefile.util.def b/Makefile.util.def -index bb21c87c8ed..7729e65c607 100644 +index 843ce092b94..e50436a4987 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -442,6 +442,12 @@ script = { +@@ -451,6 +451,12 @@ script = { installdir = grubconf; }; @@ -56,7 +55,7 @@ index bb21c87c8ed..7729e65c607 100644 script = { name = '10_windows'; common = util/grub.d/10_windows.in; -@@ -724,6 +730,13 @@ script = { +@@ -733,6 +739,13 @@ script = { installdir = sbin; }; @@ -70,21 +69,8 @@ index bb21c87c8ed..7729e65c607 100644 script = { name = grub-mkconfig_lib; common = util/grub-mkconfig_lib.in; -diff --git a/.gitignore b/.gitignore -index fa2e5b609b1..141684867d1 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -111,6 +111,8 @@ grub-*.tar.* - /grub*-script-check.1 - /grub*-set-default - /grub*-set-default.8 -+/grub*-set-password -+/grub*-set-password.8 - /grub*-shell - /grub*-shell-tester - /grub*-sparc64-setup diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f68d4925ee6..bdb9982aefb 100644 +index c645351dd2a..4e7a875309e 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -282,6 +282,8 @@ for i in "${grub_mkconfig_dir}"/* ; do diff --git a/0063-Add-a-url-parser.patch b/0063-Add-a-url-parser.patch index 34edd4e5..d6047fba 100644 --- a/0063-Add-a-url-parser.patch +++ b/0063-Add-a-url-parser.patch @@ -20,10 +20,10 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/net/url.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 8bd220a41ba..d0c8a8b1908 100644 +index 57e253ab1a1..99466b1e47e 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2188,6 +2188,7 @@ module = { +@@ -2284,6 +2284,7 @@ module = { common = net/ethernet.c; common = net/arp.c; common = net/netbuff.c; @@ -923,7 +923,7 @@ index 00000000000..146858284cd +} +#endif diff --git a/include/grub/misc.h b/include/grub/misc.h -index 83fd69f4ada..fcaf1201e39 100644 +index f9135b62e35..b4339222ecb 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -85,6 +85,7 @@ int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n); diff --git a/0064-efinet-and-bootp-add-support-for-dhcpv6.patch b/0064-efinet-and-bootp-add-support-for-dhcpv6.patch index 8c97d2c3..3f190ff4 100644 --- a/0064-efinet-and-bootp-add-support-for-dhcpv6.patch +++ b/0064-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Wed, 8 Jun 2016 21:03:37 -0400 +Date: Tue, 9 Jul 2019 11:47:37 +0200 Subject: [PATCH] efinet and bootp: add support for dhcpv6 Signed-off-by: Peter Jones @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 6 files changed, 479 insertions(+), 14 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index f03eeab2fb4..da3e454466b 100644 +index 0e6e41a1699..8c969595a7b 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -23,6 +23,7 @@ @@ -24,10 +24,10 @@ index f03eeab2fb4..da3e454466b 100644 +#include #include - static char * -@@ -349,6 +350,179 @@ grub_net_configure_by_dhcp_ack (const char *name, - return inter; - } + struct grub_dhcp_discover_options +@@ -935,6 +936,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), + + static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp; +struct grub_net_network_level_interface * +grub_net_configure_by_dhcpv6_ack (const char *name, @@ -203,8 +203,8 @@ index f03eeab2fb4..da3e454466b 100644 + + void - grub_net_process_dhcp (struct grub_net_buff *nb, - struct grub_net_card *card) + grub_bootp_init (void) + { diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c index 5388f952ba9..a57189e8bb3 100644 --- a/grub-core/net/drivers/efi/efinet.c @@ -316,7 +316,7 @@ index 5388f952ba9..a57189e8bb3 100644 } } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 16d2ce06d5a..4be228d9576 100644 +index 4b7972b8e7e..f24f1fd63f6 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -955,6 +955,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa @@ -427,7 +427,7 @@ index 7d90bf66e76..1157524fc50 100644 grub_free (data); return grub_errno; diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index c7c9f0e1db1..28b6adf7648 100644 +index addcbfa8fb7..d97cdf98c80 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -572,10 +572,16 @@ typedef void *grub_efi_handle_t; @@ -582,10 +582,10 @@ index c7c9f0e1db1..28b6adf7648 100644 typedef struct grub_efi_pxe diff --git a/include/grub/net.h b/include/grub/net.h -index 50d62ab0c8c..f8f3ec13acc 100644 +index ff6d347f7da..3647012374b 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -442,6 +442,51 @@ struct grub_net_bootp_packet +@@ -447,6 +447,51 @@ struct grub_net_bootp_packet grub_uint8_t vendor[0]; } GRUB_PACKED; @@ -637,7 +637,7 @@ index 50d62ab0c8c..f8f3ec13acc 100644 #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 #define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82 #define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53 -@@ -470,6 +515,21 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -482,6 +527,21 @@ grub_net_configure_by_dhcp_ack (const char *name, grub_size_t size, int is_def, char **device, char **path); diff --git a/0065-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0065-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index ab50e84c..00611dc8 100644 --- a/0065-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0065-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -13,21 +13,20 @@ Resolves: rhbz#1226325 --- configure.ac | 2 + Makefile.util.def | 7 ++ - .gitignore | 2 + util/bash-completion.d/grub-completion.bash.in | 22 +++++++ util/grub-get-kernel-settings.3 | 20 ++++++ util/grub-get-kernel-settings.in | 88 ++++++++++++++++++++++++++ util/grub-mkconfig.in | 3 + util/grub.d/10_linux.in | 23 +++++-- - 8 files changed, 162 insertions(+), 5 deletions(-) + 7 files changed, 160 insertions(+), 5 deletions(-) create mode 100644 util/grub-get-kernel-settings.3 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 1cb6a9615db..2a6fde5be81 100644 +index 68501662e8d..fc3c2b44d60 100644 --- a/configure.ac +++ b/configure.ac -@@ -58,6 +58,7 @@ grub_TRANSFORM([grub-install]) +@@ -62,6 +62,7 @@ grub_TRANSFORM([grub-install]) grub_TRANSFORM([grub-mkconfig]) grub_TRANSFORM([grub-mkfont]) grub_TRANSFORM([grub-mkimage]) @@ -35,7 +34,7 @@ index 1cb6a9615db..2a6fde5be81 100644 grub_TRANSFORM([grub-glue-efi]) grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) -@@ -75,6 +76,7 @@ grub_TRANSFORM([grub-file]) +@@ -79,6 +80,7 @@ grub_TRANSFORM([grub-file]) grub_TRANSFORM([grub-bios-setup.3]) grub_TRANSFORM([grub-editenv.1]) grub_TRANSFORM([grub-fstest.3]) @@ -44,10 +43,10 @@ index 1cb6a9615db..2a6fde5be81 100644 grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) diff --git a/Makefile.util.def b/Makefile.util.def -index 7729e65c607..c39b3ce6aa9 100644 +index e50436a4987..2215cc759c0 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -716,6 +716,13 @@ script = { +@@ -725,6 +725,13 @@ script = { installdir = sbin; }; @@ -61,19 +60,6 @@ index 7729e65c607..c39b3ce6aa9 100644 script = { name = grub-set-default; common = util/grub-set-default.in; -diff --git a/.gitignore b/.gitignore -index 141684867d1..096eeff7de8 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -68,6 +68,8 @@ grub-*.tar.* - /grub*-fs-tester - /grub*-fstest - /grub*-fstest.1 -+/grub*-get-kernel-settings -+/grub*-get-kernel-settings.3 - /grub*-glue-efi - /grub*-glue-efi.1 - /grub*-install diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in index 44bf135b9f8..5c4acd496d4 100644 --- a/util/bash-completion.d/grub-completion.bash.in @@ -228,7 +214,7 @@ index 00000000000..7e87dfccc0e + echo export GRUB_UPDATE_DEFAULT_KERNEL +fi diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index bdb9982aefb..8218f3d477f 100644 +index 4e7a875309e..6247a0ba850 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@" @@ -249,7 +235,7 @@ index bdb9982aefb..8218f3d477f 100644 if [ -z "$GRUB_DEVICE_UUID" ]; then GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index a8a8e2cf325..4e49ccdf742 100644 +index 12a20c9ad73..55f4aa783cf 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -111,7 +111,8 @@ linux_entry () diff --git a/0067-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0067-bz1374141-fix-incorrect-mask-for-ppc64.patch index 628ff7e9..1bb26586 100644 --- a/0067-bz1374141-fix-incorrect-mask-for-ppc64.patch +++ b/0067-bz1374141-fix-incorrect-mask-for-ppc64.patch @@ -30,7 +30,7 @@ The count of zero with __builtin_clz can be 22. (clz counts the number of one bi 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index 002446be1c3..3df75357a70 100644 +index ac4e62a95c9..3860b6f78d8 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -220,8 +220,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, diff --git a/0068-Make-grub_fatal-also-backtrace.patch b/0068-Make-grub_fatal-also-backtrace.patch index ee0b5c17..de1de205 100644 --- a/0068-Make-grub_fatal-also-backtrace.patch +++ b/0068-Make-grub_fatal-also-backtrace.patch @@ -13,10 +13,10 @@ Subject: [PATCH] Make grub_fatal() also backtrace. create mode 100644 grub-core/lib/arm64/backtrace.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index d0c8a8b1908..8bb5eb0f47f 100644 +index 99466b1e47e..ebc558019cd 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -175,6 +175,9 @@ kernel = { +@@ -186,6 +186,9 @@ kernel = { softdiv = lib/division.c; @@ -25,7 +25,7 @@ index d0c8a8b1908..8bb5eb0f47f 100644 + i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; - + i386_xen_pvh = kern/i386/dl.c; diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c index 1c560ea570a..04371ac49f2 100644 --- a/grub-core/kern/misc.c diff --git a/0069-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0069-Fix-up-some-man-pages-rpmdiff-noticed.patch index 1b2caa62..80257e35 100644 --- a/0069-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0069-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -13,10 +13,10 @@ Subject: [PATCH] Fix up some man pages rpmdiff noticed. create mode 100644 util/grub-syslinux2cfg.1 diff --git a/configure.ac b/configure.ac -index 2a6fde5be81..9318c281108 100644 +index fc3c2b44d60..eb851b8d722 100644 --- a/configure.ac +++ b/configure.ac -@@ -80,6 +80,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) +@@ -84,6 +84,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) grub_TRANSFORM([grub-glue-efi.3]) grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) @@ -24,7 +24,7 @@ index 2a6fde5be81..9318c281108 100644 grub_TRANSFORM([grub-menulst2cfg.1]) grub_TRANSFORM([grub-mkconfig.1]) grub_TRANSFORM([grub-mkfont.3]) -@@ -98,6 +99,7 @@ grub_TRANSFORM([grub-render-label.3]) +@@ -102,6 +103,7 @@ grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) grub_TRANSFORM([grub-set-default.1]) grub_TRANSFORM([grub-sparc64-setup.3]) diff --git a/0070-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch b/0070-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch index e8323376..f0e491e0 100644 --- a/0070-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch +++ b/0070-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch @@ -14,10 +14,10 @@ make sure they exist. 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index a1ac7a38867..93b5cd306eb 100644 +index 04994d5c67d..4c0a09c06de 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c -@@ -80,7 +80,21 @@ finalize_params_linux (void) +@@ -81,7 +81,21 @@ finalize_params_linux (void) node = grub_fdt_find_subnode (fdt, 0, "chosen"); if (node < 0) diff --git a/0071-Make-our-info-pages-say-grub2-where-appropriate.patch b/0071-Make-our-info-pages-say-grub2-where-appropriate.patch index 800f7f1b..eea4e6f9 100644 --- a/0071-Make-our-info-pages-say-grub2-where-appropriate.patch +++ b/0071-Make-our-info-pages-say-grub2-where-appropriate.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Fri, 6 May 2016 18:43:08 -0400 +Date: Tue, 9 Jul 2019 12:59:58 +0200 Subject: [PATCH] Make our info pages say "grub2" where appropriate. This needs to be hooked up to --program-transform=, but I haven't had @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 2 files changed, 161 insertions(+), 161 deletions(-) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index a9f4de6318c..3ce827ab726 100644 +index ee389fd83c3..e3fed7312a3 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1,7 +1,7 @@ @@ -35,7 +35,7 @@ index a9f4de6318c..3ce827ab726 100644 @setchapternewpage odd diff --git a/docs/grub.texi b/docs/grub.texi -index a7155c22ffe..2b7b7faf847 100644 +index 221064b5679..960e5f3ba41 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1,7 +1,7 @@ @@ -609,7 +609,7 @@ index a7155c22ffe..2b7b7faf847 100644 @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}). -@@ -4396,7 +4396,7 @@ Translate @var{string} into the current language. +@@ -4398,7 +4398,7 @@ Translate @var{string} into the current language. The current language code is stored in the @samp{lang} variable in GRUB's environment (@pxref{lang}). Translation files in MO format are read from @@ -618,7 +618,7 @@ index a7155c22ffe..2b7b7faf847 100644 @end deffn -@@ -4791,7 +4791,7 @@ Define a user named @var{user} with password @var{clear-password}. +@@ -4793,7 +4793,7 @@ Define a user named @var{user} with password @var{clear-password}. @deffn Command password_pbkdf2 user hashed-password Define a user named @var{user} with password hash @var{hashed-password}. @@ -627,7 +627,7 @@ index a7155c22ffe..2b7b7faf847 100644 to generate password hashes. @xref{Security}. @end deffn -@@ -5614,8 +5614,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} +@@ -5651,8 +5651,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} which has an associated password. @samp{password} sets the password in plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2} sets the password hashed using the Password-Based Key Derivation Function @@ -638,7 +638,7 @@ index a7155c22ffe..2b7b7faf847 100644 In order to enable authentication support, the @samp{superusers} environment variable must be set to a list of usernames, separated by any of spaces, -@@ -5659,7 +5659,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ +@@ -5696,7 +5696,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ @end group @end example @@ -647,7 +647,7 @@ index a7155c22ffe..2b7b7faf847 100644 generating configuration files with authentication. You can use @file{/etc/grub.d/40_custom} to add simple superuser authentication, by adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} -@@ -5684,15 +5684,15 @@ verified with a public key currently trusted by GRUB +@@ -5721,15 +5721,15 @@ verified with a public key currently trusted by GRUB validation fails, then file @file{foo} cannot be opened. This failure may halt or otherwise impact the boot process. @@ -668,7 +668,7 @@ index a7155c22ffe..2b7b7faf847 100644 GRUB uses GPG-style detached signatures (meaning that a file @file{foo.sig} will be produced when file @file{foo} is signed), and -@@ -5712,8 +5712,8 @@ gpg --detach-sign /path/to/file +@@ -5749,8 +5749,8 @@ gpg --detach-sign /path/to/file For successful validation of all of GRUB's subcomponents and the loaded OS kernel, they must all be signed. One way to accomplish this is the following (after having already produced the desired @@ -679,7 +679,7 @@ index a7155c22ffe..2b7b7faf847 100644 @example @group -@@ -5735,7 +5735,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, +@@ -5772,7 +5772,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, Note that internally signature enforcement is controlled by setting the environment variable @code{check_signatures} equal to @code{enforce}. Passing one or more @code{--pubkey} options to @@ -688,7 +688,7 @@ index a7155c22ffe..2b7b7faf847 100644 equal to @code{enforce} in @file{core.img} prior to processing any configuration files. -@@ -6092,10 +6092,10 @@ Required files are: +@@ -6189,10 +6189,10 @@ Required files are: GRUB's normal start-up procedure involves setting the @samp{prefix} environment variable to a value set in the core image by @@ -701,7 +701,7 @@ index a7155c22ffe..2b7b7faf847 100644 things GRUB is supposed to do. If, instead, you only get a rescue shell, this usually means that GRUB -@@ -6121,8 +6121,8 @@ normal +@@ -6218,8 +6218,8 @@ normal However, any problem that leaves you in the rescue shell probably means that GRUB was not correctly installed. It may be more useful to try to reinstall @@ -712,7 +712,7 @@ index a7155c22ffe..2b7b7faf847 100644 @itemize @bullet{} @item -@@ -6134,7 +6134,7 @@ is usually better to use UUIDs or file system labels and avoid depending on +@@ -6231,7 +6231,7 @@ is usually better to use UUIDs or file system labels and avoid depending on drive ordering entirely. @item @@ -721,8 +721,8 @@ index a7155c22ffe..2b7b7faf847 100644 to a partition but GRUB has already been installed in the master boot record, then the GRUB installation in the partition will be ignored. -@@ -6154,21 +6154,21 @@ support has not yet been added to GRUB. - @end itemize +@@ -6262,21 +6262,21 @@ entry which claims partition start at block 0. This change will not hamper + bootability on other machines. -@node Invoking grub-install @@ -749,7 +749,7 @@ index a7155c22ffe..2b7b7faf847 100644 @table @option @item --help -@@ -6184,13 +6184,13 @@ separate partition or a removable disk. +@@ -6292,13 +6292,13 @@ separate partition or a removable disk. If this option is not specified then it defaults to @file{/boot}, so @example @@ -765,7 +765,7 @@ index a7155c22ffe..2b7b7faf847 100644 @end example Here is an example in which you have a separate @dfn{boot} partition which is -@@ -6198,16 +6198,16 @@ mounted on +@@ -6306,16 +6306,16 @@ mounted on @file{/mnt/boot}: @example @@ -785,7 +785,7 @@ index a7155c22ffe..2b7b7faf847 100644 extra space in the bootloader embedding area for Reed-Solomon error-correcting codes. This enables GRUB to still boot successfully if some blocks are corrupted. The exact amount of protection offered -@@ -6220,17 +6220,17 @@ installation}) where GRUB does not reside in any unpartitioned space +@@ -6328,17 +6328,17 @@ installation}) where GRUB does not reside in any unpartitioned space outside of the MBR. Disable the Reed-Solomon codes with this option. @end table @@ -808,7 +808,7 @@ index a7155c22ffe..2b7b7faf847 100644 @table @option @item --help -@@ -6246,17 +6246,17 @@ it to standard output. +@@ -6354,17 +6354,17 @@ it to standard output. @end table @@ -830,7 +830,7 @@ index a7155c22ffe..2b7b7faf847 100644 @table @option @item -c @var{number} -@@ -6274,23 +6274,23 @@ Length of the salt. Defaults to 64. +@@ -6382,23 +6382,23 @@ Length of the salt. Defaults to 64. @end table @@ -860,7 +860,7 @@ index a7155c22ffe..2b7b7faf847 100644 @table @option @item --help -@@ -6301,17 +6301,17 @@ Print the version number of GRUB and exit. +@@ -6409,17 +6409,17 @@ Print the version number of GRUB and exit. @end table @@ -882,7 +882,7 @@ index a7155c22ffe..2b7b7faf847 100644 passed on directly to @command{xorriso} in @command{mkisofs} emulation mode. Options passed to @command{xorriso} will normally be interpreted as @command{mkisofs} options; if the option @samp{--} is used, then anything -@@ -6326,7 +6326,7 @@ mkdir -p disk/boot/grub +@@ -6434,7 +6434,7 @@ mkdir -p disk/boot/grub grub-mkrescue -o grub.iso disk @end example @@ -891,7 +891,7 @@ index a7155c22ffe..2b7b7faf847 100644 @table @option @item --help -@@ -6354,15 +6354,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in +@@ -6462,15 +6462,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in default. @item --grub-mkimage=@var{file} @@ -911,7 +911,7 @@ index a7155c22ffe..2b7b7faf847 100644 system or file system image that GRUB understands, using GRUB's file system drivers via FUSE. (It is only available if FUSE development files were present when GRUB was built.) This has a number of uses: -@@ -6394,13 +6394,13 @@ even if nobody has yet written a FUSE module specifically for that file +@@ -6502,13 +6502,13 @@ even if nobody has yet written a FUSE module specifically for that file system type. @end itemize @@ -927,7 +927,7 @@ index a7155c22ffe..2b7b7faf847 100644 non-option arguments (if it is given more than one image, it will treat them as a RAID set), and also accepts the following options: -@@ -6422,13 +6422,13 @@ Show debugging output for conditions matching @var{string}. +@@ -6530,13 +6530,13 @@ Show debugging output for conditions matching @var{string}. @item -K prompt|@var{file} @itemx --zfs-key=prompt|@var{file} Load a ZFS encryption key. If you use @samp{prompt} as the argument, @@ -943,7 +943,7 @@ index a7155c22ffe..2b7b7faf847 100644 root of the supplied file system. If @var{device} is just a number, then it will be treated as a partition -@@ -6446,10 +6446,10 @@ Print verbose messages. +@@ -6554,10 +6554,10 @@ Print verbose messages. @end table @@ -957,7 +957,7 @@ index a7155c22ffe..2b7b7faf847 100644 or device. @example -@@ -6457,7 +6457,7 @@ grub-probe --target=fs /boot/grub +@@ -6565,7 +6565,7 @@ grub-probe --target=fs /boot/grub grub-probe --target=drive --device /dev/sda1 @end example @@ -966,7 +966,7 @@ index a7155c22ffe..2b7b7faf847 100644 argument, and also accepts the following options: @table @option -@@ -6470,16 +6470,16 @@ Print the version number of GRUB and exit. +@@ -6578,16 +6578,16 @@ Print the version number of GRUB and exit. @item -d @itemx --device If this option is given, then the non-option argument is a system device @@ -986,7 +986,7 @@ index a7155c22ffe..2b7b7faf847 100644 @item -t @var{target} @itemx --target=@var{target} -@@ -6532,19 +6532,19 @@ Print verbose messages. +@@ -6640,19 +6640,19 @@ Print verbose messages. @end table diff --git a/0072-print-more-debug-info-in-our-module-loader.patch b/0072-print-more-debug-info-in-our-module-loader.patch index bf2c42f9..48f48e3e 100644 --- a/0072-print-more-debug-info-in-our-module-loader.patch +++ b/0072-print-more-debug-info-in-our-module-loader.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index e339f264b3a..562d6887e0e 100644 +index 370ce03c5d7..a1af9b46559 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -313,13 +313,23 @@ grub_efi_modules_addr (void) diff --git a/0074-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0074-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch index eafb894f..41616b0f 100644 --- a/0074-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +++ b/0074-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeff Mahoney -Date: Wed, 18 Dec 2013 09:57:04 +0000 +Date: Tue, 9 Jul 2019 13:39:45 +0200 Subject: [PATCH] grub2/btrfs: Add ability to boot from subvolumes This patch adds the ability to specify a different root on a btrfs @@ -24,20 +24,20 @@ Signed-off-by: Jeff Mahoney 2 files changed, 533 insertions(+), 20 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index be195448dbe..51ed63d429b 100644 +index 48bd3d04a5e..6823d9765c4 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -29,6 +29,9 @@ - #include +@@ -38,6 +38,9 @@ + #include #include #include +#include +#include +#include + #include + #include - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -64,9 +67,11 @@ struct grub_btrfs_superblock +@@ -78,9 +81,11 @@ struct grub_btrfs_superblock grub_uint64_t generation; grub_uint64_t root_tree; grub_uint64_t chunk_tree; @@ -51,7 +51,7 @@ index be195448dbe..51ed63d429b 100644 struct grub_btrfs_device this_device; char label[0x100]; grub_uint8_t dummy4[0x100]; -@@ -105,6 +110,7 @@ struct grub_btrfs_data +@@ -120,6 +125,7 @@ struct grub_btrfs_data grub_uint64_t exttree; grub_size_t extsize; struct grub_btrfs_extent_data *extent; @@ -59,7 +59,7 @@ index be195448dbe..51ed63d429b 100644 }; struct grub_btrfs_chunk_item -@@ -171,6 +177,14 @@ struct grub_btrfs_leaf_descriptor +@@ -188,6 +194,14 @@ struct grub_btrfs_leaf_descriptor } *data; }; @@ -74,7 +74,7 @@ index be195448dbe..51ed63d429b 100644 struct grub_btrfs_time { grub_int64_t sec; -@@ -215,6 +229,14 @@ struct grub_btrfs_extent_data +@@ -233,6 +247,14 @@ struct grub_btrfs_extent_data #define GRUB_BTRFS_OBJECT_ID_CHUNK 0x100 @@ -89,7 +89,7 @@ index be195448dbe..51ed63d429b 100644 static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2, 256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2 }; -@@ -837,6 +859,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, +@@ -1153,6 +1175,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, return GRUB_ERR_NONE; } @@ -152,7 +152,7 @@ index be195448dbe..51ed63d429b 100644 static struct grub_btrfs_data * grub_btrfs_mount (grub_device_t dev) { -@@ -872,6 +950,13 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1188,6 +1266,13 @@ grub_btrfs_mount (grub_device_t dev) data->devices_attached[0].dev = dev; data->devices_attached[0].id = data->sblock.this_device.device_id; @@ -166,7 +166,7 @@ index be195448dbe..51ed63d429b 100644 return data; } -@@ -1232,6 +1317,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, +@@ -1653,6 +1738,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, return GRUB_ERR_NONE; } @@ -258,7 +258,7 @@ index be195448dbe..51ed63d429b 100644 static grub_err_t find_path (struct grub_btrfs_data *data, const char *path, struct grub_btrfs_key *key, -@@ -1250,14 +1420,26 @@ find_path (struct grub_btrfs_data *data, +@@ -1671,14 +1841,26 @@ find_path (struct grub_btrfs_data *data, char *origpath = NULL; unsigned symlinks_max = 32; @@ -289,7 +289,7 @@ index be195448dbe..51ed63d429b 100644 while (1) { while (path[0] == '/') -@@ -1430,9 +1612,21 @@ find_path (struct grub_btrfs_data *data, +@@ -1851,9 +2033,21 @@ find_path (struct grub_btrfs_data *data, path = path_alloc = tmp; if (path[0] == '/') { @@ -314,7 +314,7 @@ index be195448dbe..51ed63d429b 100644 } continue; } -@@ -1673,18 +1867,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len) +@@ -2094,18 +2288,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len) data->tree, file->offset, buf, len); } @@ -336,7 +336,7 @@ index be195448dbe..51ed63d429b 100644 grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]), grub_be_to_cpu16 (data->sblock.uuid[2]), -@@ -1693,6 +1879,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid) +@@ -2114,6 +2300,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid) grub_be_to_cpu16 (data->sblock.uuid[5]), grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[7])); @@ -357,7 +357,7 @@ index be195448dbe..51ed63d429b 100644 grub_btrfs_unmount (data); -@@ -1749,6 +1949,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), +@@ -2170,6 +2370,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), } #endif @@ -599,8 +599,8 @@ index be195448dbe..51ed63d429b 100644 + static struct grub_fs grub_btrfs_fs = { .name = "btrfs", - .dir = grub_btrfs_dir, -@@ -1764,12 +2200,88 @@ static struct grub_fs grub_btrfs_fs = { + .fs_dir = grub_btrfs_dir, +@@ -2185,12 +2621,88 @@ static struct grub_fs grub_btrfs_fs = { #endif }; diff --git a/0075-export-btrfs_subvol-and-btrfs_subvolid.patch b/0075-export-btrfs_subvol-and-btrfs_subvolid.patch index a0989e81..5af81e78 100644 --- a/0075-export-btrfs_subvol-and-btrfs_subvolid.patch +++ b/0075-export-btrfs_subvol-and-btrfs_subvolid.patch @@ -12,10 +12,10 @@ Signed-off-by: Michael Chang 1 file changed, 2 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 51ed63d429b..88d727d161f 100644 +index 6823d9765c4..2d099b18ea1 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -2273,6 +2273,8 @@ GRUB_MOD_INIT (btrfs) +@@ -2694,6 +2694,8 @@ GRUB_MOD_INIT (btrfs) subvol_set_env); grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, subvolid_set_env); diff --git a/0076-grub2-btrfs-03-follow_default.patch b/0076-grub2-btrfs-03-follow_default.patch index 26e91f18..b28aa781 100644 --- a/0076-grub2-btrfs-03-follow_default.patch +++ b/0076-grub2-btrfs-03-follow_default.patch @@ -8,10 +8,10 @@ Subject: [PATCH] grub2-btrfs-03-follow_default 1 file changed, 76 insertions(+), 31 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 88d727d161f..a47d297567f 100644 +index 2d099b18ea1..2db89f71ea5 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -920,6 +920,7 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1236,6 +1236,7 @@ grub_btrfs_mount (grub_device_t dev) { struct grub_btrfs_data *data; grub_err_t err; @@ -19,7 +19,7 @@ index 88d727d161f..a47d297567f 100644 if (!dev->disk) { -@@ -950,11 +951,14 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1266,11 +1267,14 @@ grub_btrfs_mount (grub_device_t dev) data->devices_attached[0].dev = dev; data->devices_attached[0].id = data->sblock.this_device.device_id; @@ -38,7 +38,7 @@ index 88d727d161f..a47d297567f 100644 } return data; -@@ -1414,24 +1418,39 @@ find_path (struct grub_btrfs_data *data, +@@ -1835,24 +1839,39 @@ find_path (struct grub_btrfs_data *data, grub_size_t allocated = 0; struct grub_btrfs_dir_item *direl = NULL; struct grub_btrfs_key key_out; @@ -85,7 +85,7 @@ index 88d727d161f..a47d297567f 100644 } else { -@@ -1442,15 +1461,23 @@ find_path (struct grub_btrfs_data *data, +@@ -1863,15 +1882,23 @@ find_path (struct grub_btrfs_data *data, while (1) { @@ -118,7 +118,7 @@ index 88d727d161f..a47d297567f 100644 if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) { -@@ -1461,7 +1488,9 @@ find_path (struct grub_btrfs_data *data, +@@ -1882,7 +1909,9 @@ find_path (struct grub_btrfs_data *data, if (ctokenlen == 1 && ctoken[0] == '.') { @@ -129,7 +129,7 @@ index 88d727d161f..a47d297567f 100644 continue; } if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.') -@@ -1492,8 +1521,9 @@ find_path (struct grub_btrfs_data *data, +@@ -1913,8 +1942,9 @@ find_path (struct grub_btrfs_data *data, *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; key->object_id = key_out.offset; @@ -141,7 +141,7 @@ index 88d727d161f..a47d297567f 100644 continue; } -@@ -1562,7 +1592,9 @@ find_path (struct grub_btrfs_data *data, +@@ -1983,7 +2013,9 @@ find_path (struct grub_btrfs_data *data, return err; } @@ -152,7 +152,7 @@ index 88d727d161f..a47d297567f 100644 if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK) { struct grub_btrfs_inode inode; -@@ -1612,14 +1644,26 @@ find_path (struct grub_btrfs_data *data, +@@ -2033,14 +2065,26 @@ find_path (struct grub_btrfs_data *data, path = path_alloc = tmp; if (path[0] == '/') { @@ -186,7 +186,7 @@ index 88d727d161f..a47d297567f 100644 } else { -@@ -2275,6 +2319,7 @@ GRUB_MOD_INIT (btrfs) +@@ -2696,6 +2740,7 @@ GRUB_MOD_INIT (btrfs) subvolid_set_env); grub_env_export ("btrfs_subvol"); grub_env_export ("btrfs_subvolid"); diff --git a/0077-grub2-btrfs-04-grub2-install.patch b/0077-grub2-btrfs-04-grub2-install.patch index af816164..b490f8d3 100644 --- a/0077-grub2-btrfs-04-grub2-install.patch +++ b/0077-grub2-btrfs-04-grub2-install.patch @@ -94,10 +94,10 @@ index ebcdd8f5e22..f044a880a76 100644 sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) { diff --git a/util/grub-install.c b/util/grub-install.c -index 78d0138cb0a..4375c161955 100644 +index 8a55ad4b8dc..0e807b09c36 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -816,6 +816,8 @@ fill_core_services (const char *core_services) +@@ -819,6 +819,8 @@ fill_core_services (const char *core_services) free (sysv_plist); } @@ -106,7 +106,7 @@ index 78d0138cb0a..4375c161955 100644 int main (int argc, char *argv[]) { -@@ -849,6 +851,9 @@ main (int argc, char *argv[]) +@@ -852,6 +854,9 @@ main (int argc, char *argv[]) grub_util_load_config (&config); @@ -116,7 +116,7 @@ index 78d0138cb0a..4375c161955 100644 if (!bootloader_id && config.grub_distributor) { char *ptr; -@@ -1321,6 +1326,16 @@ main (int argc, char *argv[]) +@@ -1344,6 +1349,16 @@ main (int argc, char *argv[]) fprintf (load_cfg_f, "set debug='%s'\n", debug_image); } diff --git a/0078-grub2-btrfs-05-grub2-mkconfig.patch b/0078-grub2-btrfs-05-grub2-mkconfig.patch index d99bee43..2320e89d 100644 --- a/0078-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0078-grub2-btrfs-05-grub2-mkconfig.patch @@ -13,7 +13,7 @@ Signed-off-by: Michael Chang 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 8218f3d477f..4248b9341ab 100644 +index 6247a0ba850..4649e92eb0f 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -258,7 +258,8 @@ export GRUB_DEFAULT \ @@ -90,7 +90,7 @@ index 858b526c925..de727e6ee6b 100644 +EOF +fi diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 4e49ccdf742..d9a05937e46 100644 +index 55f4aa783cf..5cab299dc08 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -66,10 +66,14 @@ fi @@ -109,7 +109,7 @@ index 4e49ccdf742..d9a05937e46 100644 xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 972a4b5a03d..bcdc3ceac02 100644 +index 47e0d3f5cd6..1519ec692fe 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -73,10 +73,14 @@ fi diff --git a/0079-grub2-btrfs-06-subvol-mount.patch b/0079-grub2-btrfs-06-subvol-mount.patch index 493f1331..36824c8b 100644 --- a/0079-grub2-btrfs-06-subvol-mount.patch +++ b/0079-grub2-btrfs-06-subvol-mount.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Michael Chang -Date: Fri, 22 May 2015 11:45:25 +0000 +Date: Tue, 9 Jul 2019 13:56:16 +0200 Subject: [PATCH] grub2-btrfs-06-subvol-mount --- @@ -11,18 +11,18 @@ Subject: [PATCH] grub2-btrfs-06-subvol-mount 4 files changed, 392 insertions(+), 5 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index a47d297567f..2e36ac47e8a 100644 +index 2db89f71ea5..162723423ca 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -32,6 +32,7 @@ +@@ -41,6 +41,7 @@ #include #include #include +#include + #include + #include - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -245,6 +246,12 @@ static grub_err_t +@@ -263,6 +264,12 @@ static grub_err_t grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, void *buf, grub_size_t size, int recursion_depth); @@ -35,7 +35,7 @@ index a47d297567f..2e36ac47e8a 100644 static grub_err_t read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) -@@ -887,9 +894,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) +@@ -1203,9 +1210,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) grub_err_t err; grub_uint64_t tree = 0; grub_uint8_t type; @@ -62,7 +62,7 @@ index a47d297567f..2e36ac47e8a 100644 if (err) return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); -@@ -1758,11 +1782,20 @@ grub_btrfs_dir (grub_device_t device, const char *path, +@@ -2179,11 +2203,20 @@ grub_btrfs_dir (grub_device_t device, const char *path, int r = 0; grub_uint64_t tree; grub_uint8_t type; @@ -84,7 +84,7 @@ index a47d297567f..2e36ac47e8a 100644 if (err) { grub_btrfs_unmount (data); -@@ -1864,11 +1897,21 @@ grub_btrfs_open (struct grub_file *file, const char *name) +@@ -2285,11 +2318,21 @@ grub_btrfs_open (struct grub_file *file, const char *name) struct grub_btrfs_inode inode; grub_uint8_t type; struct grub_btrfs_key key_in; @@ -107,7 +107,7 @@ index a47d297567f..2e36ac47e8a 100644 if (err) { grub_btrfs_unmount (data); -@@ -2039,6 +2082,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, +@@ -2460,6 +2503,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, return 0; } @@ -258,7 +258,7 @@ index a47d297567f..2e36ac47e8a 100644 static grub_err_t get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, grub_uint64_t objectid, grub_uint64_t offset, -@@ -2245,6 +2432,7 @@ static struct grub_fs grub_btrfs_fs = { +@@ -2666,6 +2853,7 @@ static struct grub_fs grub_btrfs_fs = { }; static grub_command_t cmd_info; @@ -266,7 +266,7 @@ index a47d297567f..2e36ac47e8a 100644 static grub_extcmd_t cmd_list_subvols; static char * -@@ -2308,6 +2496,9 @@ GRUB_MOD_INIT (btrfs) +@@ -2729,6 +2917,9 @@ GRUB_MOD_INIT (btrfs) cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, "DEVICE", "Print BtrFS info about DEVICE."); @@ -460,10 +460,10 @@ index 5d50dd6f8dc..4c5a13022dc 100644 grub_make_system_path_relative_to_its_root_os (const char *path) { diff --git a/util/grub-install.c b/util/grub-install.c -index 4375c161955..a0ad99729fd 100644 +index 0e807b09c36..3e718b9e3fb 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -1535,6 +1535,55 @@ main (int argc, char *argv[]) +@@ -1561,6 +1561,55 @@ main (int argc, char *argv[]) prefix_drive = xasprintf ("(%s)", grub_drives[0]); } diff --git a/0080-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0080-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch index a4134460..f023ca2f 100644 --- a/0080-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +++ b/0080-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch @@ -10,10 +10,10 @@ Ref: bsc#953538 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 2e36ac47e8a..4a31d39ee74 100644 +index 162723423ca..69c30e62354 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -924,11 +924,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) +@@ -1240,11 +1240,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) return GRUB_ERR_NONE; } diff --git a/0081-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0081-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch index 0f4ce500..f88b8916 100644 --- a/0081-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +++ b/0081-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch @@ -8,10 +8,10 @@ Subject: [PATCH] Grub not working correctly with btrfs snapshots (bsc#1026511) 1 file changed, 238 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 4a31d39ee74..7002ad81b7e 100644 +index 69c30e62354..ba99d04f8ed 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -2446,6 +2446,238 @@ out: +@@ -2867,6 +2867,238 @@ out: return 0; } @@ -249,8 +249,8 @@ index 4a31d39ee74..7002ad81b7e 100644 + static struct grub_fs grub_btrfs_fs = { .name = "btrfs", - .dir = grub_btrfs_dir, -@@ -2464,6 +2696,7 @@ static struct grub_fs grub_btrfs_fs = { + .fs_dir = grub_btrfs_dir, +@@ -2885,6 +3117,7 @@ static struct grub_fs grub_btrfs_fs = { static grub_command_t cmd_info; static grub_command_t cmd_mount_subvol; static grub_extcmd_t cmd_list_subvols; @@ -258,7 +258,7 @@ index 4a31d39ee74..7002ad81b7e 100644 static char * subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)), -@@ -2534,6 +2767,11 @@ GRUB_MOD_INIT (btrfs) +@@ -2955,6 +3188,11 @@ GRUB_MOD_INIT (btrfs) "[-p|-n] [-o var] DEVICE", "Print list of BtrFS subvolumes on " "DEVICE.", options); diff --git a/0082-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0082-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch index 9a4a5c20..ccb1947b 100644 --- a/0082-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +++ b/0082-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 39480b38674..09a18e56302 100644 +index 090c8621066..5e2b479daec 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -24,6 +24,10 @@ diff --git a/0083-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0083-Use-grub_efi_.-memory-helpers-where-reasonable.patch index 0dc026f4..a9e1a2b6 100644 --- a/0083-Use-grub_efi_.-memory-helpers-where-reasonable.patch +++ b/0083-Use-grub_efi_.-memory-helpers-where-reasonable.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 5cd9b6e08a8..106eb10a362 100644 +index 5aa3a5dc7dd..3a724a9fcbf 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -65,7 +65,7 @@ grub_chainloader_unload (void) @@ -34,7 +34,7 @@ index 5cd9b6e08a8..106eb10a362 100644 grub_loader_unset (); -@@ -500,10 +500,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) +@@ -506,10 +506,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) static grub_efi_boolean_t handle_image (void *data, grub_efi_uint32_t datasize) { @@ -46,7 +46,7 @@ index 5cd9b6e08a8..106eb10a362 100644 char *buffer_aligned = NULL; grub_efi_uint32_t i; struct grub_pe32_section_table *section; -@@ -514,8 +513,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -520,8 +519,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) int found_entry_point = 0; int rc; @@ -55,7 +55,7 @@ index 5cd9b6e08a8..106eb10a362 100644 rc = read_header (data, datasize, &context); if (rc < 0) { -@@ -555,8 +552,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -561,8 +558,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n", context.image_size, datasize); @@ -66,7 +66,7 @@ index 5cd9b6e08a8..106eb10a362 100644 if (efi_status != GRUB_EFI_SUCCESS) { -@@ -788,14 +785,14 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -794,14 +791,14 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_dprintf ("chain", "entry_point returned %ld\n", efi_status); grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); @@ -83,7 +83,7 @@ index 5cd9b6e08a8..106eb10a362 100644 return 0; } -@@ -803,10 +800,7 @@ error_exit: +@@ -809,10 +806,7 @@ error_exit: static grub_err_t grub_secureboot_chainloader_unload (void) { @@ -95,7 +95,7 @@ index 5cd9b6e08a8..106eb10a362 100644 grub_free (file_path); grub_free (cmdline); cmdline = 0; -@@ -1073,7 +1067,7 @@ fail: +@@ -1079,7 +1073,7 @@ fail: grub_free (file_path); if (address) diff --git a/0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch index 004fced7..d438465b 100644 --- a/0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +++ b/0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch @@ -12,10 +12,10 @@ Signed-off-by: Peter Jones 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 106eb10a362..3630b0cbf2d 100644 +index 3a724a9fcbf..f4ddbeda687 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -783,7 +783,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -789,7 +789,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) efi_status = efi_call_2 (entry_point, grub_efi_image_handle, grub_efi_system_table); @@ -26,7 +26,7 @@ index 106eb10a362..3630b0cbf2d 100644 efi_status = grub_efi_free_pool (buffer); diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 28b6adf7648..e5b521bd9be 100644 +index d97cdf98c80..955973ed484 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -527,6 +527,14 @@ typedef grub_uint8_t grub_efi_char8_t; diff --git a/0085-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch b/0085-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch index 882cf5d7..a53ecb40 100644 --- a/0085-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch +++ b/0085-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Don't use dynamic sized arrays since we don't build with 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 4be228d9576..fa3e2912643 100644 +index f24f1fd63f6..5366e443d2a 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1853,14 +1853,25 @@ grub_net_search_configfile (char *config) diff --git a/0087-don-t-use-int-for-efi-status.patch b/0087-don-t-use-int-for-efi-status.patch index 6328df96..9cdf63e0 100644 --- a/0087-don-t-use-int-for-efi-status.patch +++ b/0087-don-t-use-int-for-efi-status.patch @@ -8,7 +8,7 @@ Subject: [PATCH] don't use int for efi status 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 562d6887e0e..bcae7f4699d 100644 +index a1af9b46559..2cf6a5ad526 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -166,7 +166,7 @@ grub_reboot (void) diff --git a/0088-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0088-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch index 1d6f4c4f..993034fc 100644 --- a/0088-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +++ b/0088-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch @@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes. 1 file changed, 2 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index 2bca56ce0e8..b1ed3c33317 100644 +index f03c03561a1..90dc9bb1017 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -54,6 +54,7 @@ grub_mod_fini (void) diff --git a/0089-editenv-handle-relative-symlinks.patch b/0089-editenv-handle-relative-symlinks.patch index 20e16864..06adca7f 100644 --- a/0089-editenv-handle-relative-symlinks.patch +++ b/0089-editenv-handle-relative-symlinks.patch @@ -14,7 +14,7 @@ Signed-off-by: Jonathan Lebon 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/util/editenv.c b/util/editenv.c -index d8d1dad6ab9..41bc7cb1c9a 100644 +index e61dc1283a4..1f7f6f3ae18 100644 --- a/util/editenv.c +++ b/util/editenv.c @@ -28,6 +28,7 @@ @@ -25,7 +25,7 @@ index d8d1dad6ab9..41bc7cb1c9a 100644 #define DEFAULT_ENVBLK_SIZE 1024 -@@ -87,9 +88,20 @@ grub_util_create_envblk_file (const char *name) +@@ -88,9 +89,20 @@ grub_util_create_envblk_file (const char *name) continue; } diff --git a/0090-Make-libgrub.pp-depend-on-config-util.h.patch b/0090-Make-libgrub.pp-depend-on-config-util.h.patch index dc24fb12..9a7d85f4 100644 --- a/0090-Make-libgrub.pp-depend-on-config-util.h.patch +++ b/0090-Make-libgrub.pp-depend-on-config-util.h.patch @@ -31,7 +31,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am -index 7795baeb654..c7b0e6a9c46 100644 +index 1f4bb9b8c5a..bf9c1ba64c9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,7 +37,7 @@ grub_script.yy.c: grub_script.yy.h diff --git a/0091-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0091-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch index 51f54589..1e8743a1 100644 --- a/0091-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +++ b/0091-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch @@ -16,10 +16,10 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index a0ad99729fd..16f137ca854 100644 +index 3e718b9e3fb..37fcdac12cc 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -1159,18 +1159,8 @@ main (int argc, char *argv[]) +@@ -1182,18 +1182,8 @@ main (int argc, char *argv[]) char *d; is_guess = 1; diff --git a/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch index c26a3d56..c8e8c4ac 100644 --- a/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +++ b/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Thu, 19 Oct 2017 11:29:11 -0400 +Date: Tue, 9 Jul 2019 14:31:19 +0200 Subject: [PATCH] 20_linux_xen: load xen or multiboot{,2} modules as needed. Signed-off-by: Peter Jones @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index bcdc3ceac02..2bc03fd36b9 100644 +index 1519ec692fe..9aa23bc7d51 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -136,6 +136,8 @@ linux_entry () @@ -21,11 +21,11 @@ index bcdc3ceac02..2bc03fd36b9 100644 ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} echo '$(echo "$lmessage" | grub_quote)' ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} -@@ -145,6 +147,7 @@ EOF - message="$(gettext_printf "Loading initial ramdisk ...")" +@@ -149,6 +151,7 @@ EOF + done sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' + insmod ${module_loader} - ${module_loader} --nounzip ${rel_dirname}/${initrd} + ${module_loader} --nounzip $(echo $initrd_path) EOF fi diff --git a/0094-align-struct-efi_variable-better.patch b/0094-align-struct-efi_variable-better.patch index 65bc91b8..0afd9357 100644 --- a/0094-align-struct-efi_variable-better.patch +++ b/0094-align-struct-efi_variable-better.patch @@ -20,7 +20,7 @@ index 36d2dedf47e..9d93ba88bac 100644 +} GRUB_PACKED GRUB_ALIGNED(8); #endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */ diff --git a/include/grub/types.h b/include/grub/types.h -index b93e4820194..f6a9723971d 100644 +index 035a4b528fc..2fc4be4039a 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -29,6 +29,7 @@ diff --git a/0095-Add-BLS-support-to-grub-mkconfig.patch b/0095-Add-BLS-support-to-grub-mkconfig.patch index b99daf93..70277efb 100644 --- a/0095-Add-BLS-support-to-grub-mkconfig.patch +++ b/0095-Add-BLS-support-to-grub-mkconfig.patch @@ -32,10 +32,10 @@ Signed-off-by: Javier Martinez Canillas create mode 100644 util/grub.d/10_linux_bls.in diff --git a/Makefile.util.def b/Makefile.util.def -index c39b3ce6aa9..c16c2ca545a 100644 +index 2215cc759c0..a61613656d1 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -490,6 +490,13 @@ script = { +@@ -499,6 +499,13 @@ script = { condition = COND_HOST_LINUX; }; @@ -64,7 +64,7 @@ index a2d1f577b9b..434fa4deda4 100644 .SH SEE ALSO .BR "info grub" diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 4248b9341ab..5e643e16973 100644 +index 4649e92eb0f..2601bdc0711 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@" @@ -157,7 +157,7 @@ index b3aae534ddc..bc11df2bd84 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index d9a05937e46..3919b8aff4e 100644 +index 5cab299dc08..301594a0c9e 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -82,6 +82,67 @@ case x"$GRUB_FS" in diff --git a/0097-Add-linux-and-initrd-commands-for-grub-emu.patch b/0097-Add-linux-and-initrd-commands-for-grub-emu.patch index 6b758f62..f956667d 100644 --- a/0097-Add-linux-and-initrd-commands-for-grub-emu.patch +++ b/0097-Add-linux-and-initrd-commands-for-grub-emu.patch @@ -18,10 +18,10 @@ to the kexec command line tool, to allow booting the selected menu entry. create mode 100644 grub-core/loader/emu/linux.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 8bb5eb0f47f..e70558a800a 100644 +index ebc558019cd..528f76a8c8e 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1712,7 +1712,6 @@ module = { +@@ -1802,7 +1802,6 @@ module = { common = loader/linux.c; common = lib/cmdline.c; @@ -52,10 +52,10 @@ index 55ea5a11ccd..846fe9715ec 100644 case ARGP_KEY_ARG: { diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 82012a72fcb..3d3a4a4a975 100644 +index 19cd007d448..245b69cab51 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -37,6 +37,7 @@ +@@ -39,6 +39,7 @@ #include int verbosity; @@ -63,7 +63,7 @@ index 82012a72fcb..3d3a4a4a975 100644 void grub_util_warn (const char *fmt, ...) -@@ -80,7 +81,7 @@ grub_util_error (const char *fmt, ...) +@@ -82,7 +83,7 @@ grub_util_error (const char *fmt, ...) vfprintf (stderr, fmt, ap); va_end (ap); fprintf (stderr, ".\n"); @@ -72,7 +72,7 @@ index 82012a72fcb..3d3a4a4a975 100644 } void * -@@ -140,6 +141,9 @@ void +@@ -142,6 +143,9 @@ void __attribute__ ((noreturn)) grub_exit (int rc) { @@ -82,7 +82,7 @@ index 82012a72fcb..3d3a4a4a975 100644 exit (rc < 0 ? 1 : rc); } #endif -@@ -201,3 +205,15 @@ grub_util_load_image (const char *path, char *buf) +@@ -203,3 +207,15 @@ grub_util_load_image (const char *path, char *buf) fclose (fp); } @@ -299,7 +299,7 @@ index d1073ef86af..1b61b4a2e5d 100644 grub_util_exec_redirect (const char *const *argv, const char *stdin_file, const char *stdout_file); diff --git a/include/grub/emu/hostfile.h b/include/grub/emu/hostfile.h -index 8e37d5acb42..12c937a1af9 100644 +index cfb1e2b5661..a61568e36e9 100644 --- a/include/grub/emu/hostfile.h +++ b/include/grub/emu/hostfile.h @@ -22,6 +22,7 @@ @@ -320,12 +320,12 @@ index 8e37d5acb42..12c937a1af9 100644 char * grub_util_path_concat (size_t n, ...); diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index df6085bcb7c..a653132e36a 100644 +index ce464cfd007..5ef4f79e689 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h -@@ -60,6 +60,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format ( - void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); - void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2), noreturn)); +@@ -56,6 +56,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format ( + void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); + void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2), noreturn)); +void EXPORT_FUNC(grub_util_set_kexecute) (void); +int EXPORT_FUNC(grub_util_get_kexecute) (void) WARN_UNUSED_RESULT; @@ -334,10 +334,10 @@ index df6085bcb7c..a653132e36a 100644 #ifdef HAVE_DEVICE_MAPPER diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 9c69aa88626..0108c0d4233 100644 +index c6ba5b2d763..5ff3afd62fa 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am -@@ -274,6 +274,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h +@@ -304,6 +304,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h diff --git a/0098-Add-grub2-switch-to-blscfg.patch b/0098-Add-grub2-switch-to-blscfg.patch index ec9e766b..80c4042d 100644 --- a/0098-Add-grub2-switch-to-blscfg.patch +++ b/0098-Add-grub2-switch-to-blscfg.patch @@ -9,19 +9,18 @@ Signed-off-by: Javier Martinez Canillas Signed-off-by: Jan Hlavac --- Makefile.util.def | 7 + - .gitignore | 2 + util/grub-set-password.in | 2 +- util/grub-switch-to-blscfg.8 | 33 +++++ util/grub-switch-to-blscfg.in | 314 ++++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 357 insertions(+), 1 deletion(-) + 4 files changed, 355 insertions(+), 1 deletion(-) create mode 100644 util/grub-switch-to-blscfg.8 create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index c16c2ca545a..aa59418ff2c 100644 +index a61613656d1..f55473c76aa 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1355,6 +1355,13 @@ program = { +@@ -1364,6 +1364,13 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -35,19 +34,6 @@ index c16c2ca545a..aa59418ff2c 100644 program = { name = grub-glue-efi; mansection = 1; -diff --git a/.gitignore b/.gitignore -index 096eeff7de8..7aaae594d51 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -121,6 +121,8 @@ grub-*.tar.* - /grub*-sparc64-setup.8 - /grub*-syslinux2cfg - /grub*-syslinux2cfg.1 -+/grub*-switch-to-blscfg -+/grub*-switch-to-blscfg.8 - /grub_fstest.pp - /grub_fstest_init.c - /grub_fstest_init.lst diff --git a/util/grub-set-password.in b/util/grub-set-password.in index 5ebf50576d6..c0b5ebbfdc5 100644 --- a/util/grub-set-password.in diff --git a/0099-Add-grub_debug_enabled.patch b/0099-Add-grub_debug_enabled.patch index 480628a7..838913ca 100644 --- a/0099-Add-grub_debug_enabled.patch +++ b/0099-Add-grub_debug_enabled.patch @@ -47,7 +47,7 @@ index 636f97e1ba1..e758ab3416d 100644 grub_printf ("%s:%d: ", file, line); va_start (args, fmt); diff --git a/include/grub/misc.h b/include/grub/misc.h -index fcaf1201e39..0f5abc4638e 100644 +index b4339222ecb..4a4f485a5f6 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -367,6 +367,7 @@ grub_puts (const char *s) diff --git a/0100-make-better-backtraces.patch b/0100-make-better-backtraces.patch index 8751441b..56f4c4b5 100644 --- a/0100-make-better-backtraces.patch +++ b/0100-make-better-backtraces.patch @@ -1,12 +1,12 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Mon, 6 Nov 2017 18:31:56 -0500 +Date: Tue, 9 Jul 2019 17:05:03 +0200 Subject: [PATCH] make better backtraces Signed-off-by: Peter Jones --- Makefile.util.def | 6 ++ - grub-core/Makefile.core.def | 15 ++-- + grub-core/Makefile.core.def | 16 ++-- grub-core/{lib => commands}/backtrace.c | 2 +- grub-core/gdb/cstub.c | 1 - grub-core/kern/arm64/backtrace.c | 94 ++++++++++++++++++++++++ @@ -29,7 +29,7 @@ Signed-off-by: Peter Jones grub-core/kern/ia64/efi/startup.S | 3 +- grub-core/kern/sparc64/ieee1275/crt0.S | 3 +- grub-core/Makefile.am | 1 + - 24 files changed, 414 insertions(+), 166 deletions(-) + 24 files changed, 414 insertions(+), 167 deletions(-) rename grub-core/{lib => commands}/backtrace.c (98%) create mode 100644 grub-core/kern/arm64/backtrace.c create mode 100644 grub-core/kern/backtrace.c @@ -38,7 +38,7 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index aa59418ff2c..4e722ab766b 100644 +index f55473c76aa..c13ca685ce1 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -49,6 +49,12 @@ library = { @@ -55,10 +55,10 @@ index aa59418ff2c..4e722ab766b 100644 library = { diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index e70558a800a..63b33490b11 100644 +index 528f76a8c8e..49c5dc4c3b7 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -129,6 +129,12 @@ kernel = { +@@ -140,6 +140,12 @@ kernel = { common = kern/rescue_parser.c; common = kern/rescue_reader.c; common = kern/term.c; @@ -71,7 +71,7 @@ index e70558a800a..63b33490b11 100644 noemu = kern/compiler-rt.c; noemu = kern/mm.c; -@@ -175,9 +181,6 @@ kernel = { +@@ -186,9 +192,6 @@ kernel = { softdiv = lib/division.c; @@ -80,17 +80,19 @@ index e70558a800a..63b33490b11 100644 - i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; - -@@ -2279,13 +2282,11 @@ module = { + i386_xen_pvh = kern/i386/dl.c; +@@ -2376,15 +2379,12 @@ module = { module = { name = backtrace; - x86 = lib/i386/backtrace.c; +- i386_xen_pvh = lib/i386/backtrace.c; - i386_xen = lib/i386/backtrace.c; - x86_64_xen = lib/i386/backtrace.c; - common = lib/backtrace.c; + common = commands/backtrace.c; enable = x86; + enable = i386_xen_pvh; enable = i386_xen; enable = x86_64_xen; + enable = arm64; @@ -329,7 +331,7 @@ index 00000000000..4a82e865cc6 + grub_backtrace (skip + 1); +} diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 621070918d4..5028d157c46 100644 +index d7718d26abc..2e57e5e6829 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name) @@ -545,10 +547,10 @@ index 27bc68b8a53..b51d0abfa6e 100644 /* Initialize the console as early as possible. */ grub_console_init (); diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index e01bc6eab19..e731a57a47b 100644 +index 0cd2a627231..937c1bc44cb 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -60,7 +60,6 @@ +@@ -63,7 +63,6 @@ #define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024) #endif @@ -785,10 +787,10 @@ index 395519762f0..275cf85e2d3 100644 #endif diff --git a/include/grub/dl.h b/include/grub/dl.h -index b1ed3c33317..7b5bfb07ce6 100644 +index 90dc9bb1017..4fe2b524f73 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h -@@ -244,6 +244,8 @@ grub_dl_get (const char *name) +@@ -257,6 +257,8 @@ grub_dl_is_persistent (grub_dl_t mod) #endif @@ -798,10 +800,10 @@ index b1ed3c33317..7b5bfb07ce6 100644 int isfunc, grub_dl_t mod); diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index ecd88ca72c6..ae69218af20 100644 +index 133a37c8d03..e5a5f436709 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h -@@ -108,6 +108,9 @@ grub_addr_t grub_modules_get_end (void); +@@ -110,6 +110,9 @@ grub_addr_t grub_modules_get_end (void); #endif @@ -895,7 +897,7 @@ index 03b916f0534..701bf63abcf 100644 ba codestart mov %o4, %o0 diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 0108c0d4233..f36200bd688 100644 +index 5ff3afd62fa..d9ad30052f1 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h diff --git a/0101-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0101-normal-don-t-draw-our-startup-message-if-debug-is-se.patch index 22da7de2..67776367 100644 --- a/0101-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +++ b/0101-normal-don-t-draw-our-startup-message-if-debug-is-se.patch @@ -8,7 +8,7 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set 1 file changed, 3 insertions(+) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index ea749f26fd5..4117317c4c4 100644 +index 2fe6743399d..f7ee912e715 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -425,6 +425,9 @@ grub_normal_reader_init (int nested) diff --git a/0103-Make-it-possible-to-enabled-build-id-sha1.patch b/0103-Make-it-possible-to-enabled-build-id-sha1.patch index a2418857..d77b6f67 100644 --- a/0103-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0103-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index 9318c281108..5f47a9265f3 100644 +index eb851b8d722..8ee18ba159a 100644 --- a/configure.ac +++ b/configure.ac -@@ -1386,7 +1386,15 @@ grub_PROG_TARGET_CC +@@ -1414,7 +1414,15 @@ grub_PROG_TARGET_CC if test "x$TARGET_APPLE_LINKER" != x1 ; then grub_PROG_OBJCOPY_ABSOLUTE fi diff --git a/0104-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0104-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch index e5048f92..b434d4c5 100644 --- a/0104-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +++ b/0104-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch @@ -42,7 +42,7 @@ index 5c2d2039d0b..0e89c483d5e 100644 int diff --git a/include/grub/misc.h b/include/grub/misc.h -index 0f5abc4638e..de9016ab709 100644 +index 4a4f485a5f6..960097fbd06 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -372,6 +372,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, diff --git a/0105-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0105-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch index f3e24d5a..09cc7c6d 100644 --- a/0105-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +++ b/0105-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -20,7 +20,7 @@ Signed-off-by: Peter Jones 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 5028d157c46..eb8b969cded 100644 +index 2e57e5e6829..6a5e7706143 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -501,6 +501,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) @@ -95,7 +95,7 @@ index 5028d157c46..eb8b969cded 100644 { grub_dl_unload (mod); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index bcae7f4699d..a2a732ffc0d 100644 +index 2cf6a5ad526..19054b1465f 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -283,7 +283,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -164,11 +164,11 @@ index 71d2279a0c1..e6183a4c44d 100644 } diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 09a18e56302..570a69361a5 100644 +index 5e2b479daec..8ca3981d7a1 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -132,7 +132,7 @@ grub_err_t grub_armxx_efi_linux_check_image(struct linux_armxx_kernel_header *lh - grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, char *args); +@@ -132,7 +132,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); + grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args); #endif -grub_addr_t grub_efi_modules_addr (void); diff --git a/0107-Fixup-for-newer-compiler.patch b/0106-Fixup-for-newer-compiler.patch similarity index 92% rename from 0107-Fixup-for-newer-compiler.patch rename to 0106-Fixup-for-newer-compiler.patch index a63ca6bd..ae5ac893 100644 --- a/0107-Fixup-for-newer-compiler.patch +++ b/0106-Fixup-for-newer-compiler.patch @@ -9,10 +9,10 @@ Subject: [PATCH] Fixup for newer compiler 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 7002ad81b7e..dac73b2fa8b 100644 +index ba99d04f8ed..9cd7f4bdf65 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -198,7 +198,7 @@ struct grub_btrfs_inode +@@ -215,7 +215,7 @@ struct grub_btrfs_inode grub_uint64_t size; grub_uint8_t dummy2[0x70]; struct grub_btrfs_time mtime; diff --git a/0106-TPM-support.patch b/0106-TPM-support.patch deleted file mode 100644 index 5656da47..00000000 --- a/0106-TPM-support.patch +++ /dev/null @@ -1,891 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Tue, 14 Jul 2015 17:06:35 -0700 -Subject: [PATCH] TPM support - -Add support for performing basic TPM measurements. Right now this only -supports extending PCRs statically and only on UEFI, but will measure -all modules as they're loaded, kernel and initrd images, command line, -grub commands and multiboot images. - -Signed-off-by: Matthew Garrett -[hdegoede: fix hash_log_extend_event prototype and compile warnings] -Signed-off-by: Hans de Goede -[michael.marineau: fix warnings when compiling for other platforms] -Michael Marineau -[javierm: squash in a single patch and drop legacy BIOS support] -Javier Martinez Canillas ---- - grub-core/Makefile.core.def | 2 + - grub-core/kern/dl.c | 4 + - grub-core/kern/efi/tpm.c | 274 ++++++++++++++++++++++++++++++++++ - grub-core/kern/tpm.c | 19 +++ - grub-core/lib/cmdline.c | 7 +- - grub-core/loader/i386/efi/linux.c | 6 + - grub-core/loader/i386/linux.c | 6 + - grub-core/loader/i386/multiboot_mbi.c | 4 + - grub-core/loader/linux.c | 4 + - grub-core/loader/multiboot.c | 3 + - grub-core/loader/multiboot_mbi2.c | 5 +- - grub-core/script/execute.c | 26 +++- - include/grub/efi/tpm.h | 153 +++++++++++++++++++ - include/grub/tpm.h | 94 ++++++++++++ - grub-core/Makefile.am | 1 + - 15 files changed, 604 insertions(+), 4 deletions(-) - create mode 100644 grub-core/kern/efi/tpm.c - create mode 100644 grub-core/kern/tpm.c - create mode 100644 include/grub/efi/tpm.h - create mode 100644 include/grub/tpm.h - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 63b33490b11..3be42a95195 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -130,6 +130,7 @@ kernel = { - common = kern/rescue_reader.c; - common = kern/term.c; - common = kern/backtrace.c; -+ common = kern/tpm.c; - - x86 = kern/i386/backtrace.c; - i386_xen = kern/i386/backtrace.c; -@@ -198,6 +199,7 @@ kernel = { - efi = kern/acpi.c; - efi = kern/efi/acpi.c; - efi = lib/envblk.c; -+ efi = kern/efi/tpm.c; - i386_coreboot = kern/i386/pc/acpi.c; - i386_multiboot = kern/i386/pc/acpi.c; - i386_coreboot = kern/acpi.c; -diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index eb8b969cded..91105bc4677 100644 ---- a/grub-core/kern/dl.c -+++ b/grub-core/kern/dl.c -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - - /* Platforms where modules are in a readonly area of memory. */ - #if defined(GRUB_MACHINE_QEMU) -@@ -829,6 +830,9 @@ grub_dl_load_file (const char *filename) - opens of the same device. */ - grub_file_close (file); - -+ grub_tpm_measure(core, size, GRUB_BINARY_PCR, "grub_module", filename); -+ grub_print_error(); -+ - mod = grub_dl_load_core (core, size); - grub_free (core); - if (! mod) -diff --git a/grub-core/kern/efi/tpm.c b/grub-core/kern/efi/tpm.c -new file mode 100644 -index 00000000000..0d3ebe22e57 ---- /dev/null -+++ b/grub-core/kern/efi/tpm.c -@@ -0,0 +1,274 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static grub_efi_guid_t tpm_guid = EFI_TPM_GUID; -+static grub_efi_guid_t tpm2_guid = EFI_TPM2_GUID; -+ -+static grub_efi_boolean_t grub_tpm_present(grub_efi_tpm_protocol_t *tpm) -+{ -+ grub_efi_status_t status; -+ TCG_EFI_BOOT_SERVICE_CAPABILITY caps; -+ grub_uint32_t flags; -+ grub_efi_physical_address_t eventlog, lastevent; -+ -+ caps.Size = (grub_uint8_t)sizeof(caps); -+ -+ status = efi_call_5(tpm->status_check, tpm, &caps, &flags, &eventlog, -+ &lastevent); -+ -+ if (status != GRUB_EFI_SUCCESS || caps.TPMDeactivatedFlag -+ || !caps.TPMPresentFlag) -+ return 0; -+ -+ return 1; -+} -+ -+static grub_efi_boolean_t grub_tpm2_present(grub_efi_tpm2_protocol_t *tpm) -+{ -+ grub_efi_status_t status; -+ EFI_TCG2_BOOT_SERVICE_CAPABILITY caps; -+ -+ caps.Size = (grub_uint8_t)sizeof(caps); -+ -+ status = efi_call_2(tpm->get_capability, tpm, &caps); -+ -+ if (status != GRUB_EFI_SUCCESS || !caps.TPMPresentFlag) -+ return 0; -+ -+ return 1; -+} -+ -+static grub_efi_boolean_t grub_tpm_handle_find(grub_efi_handle_t *tpm_handle, -+ grub_efi_uint8_t *protocol_version) -+{ -+ grub_efi_handle_t *handles; -+ grub_efi_uintn_t num_handles; -+ -+ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &tpm_guid, NULL, -+ &num_handles); -+ if (handles && num_handles > 0) { -+ *tpm_handle = handles[0]; -+ *protocol_version = 1; -+ return 1; -+ } -+ -+ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &tpm2_guid, NULL, -+ &num_handles); -+ if (handles && num_handles > 0) { -+ *tpm_handle = handles[0]; -+ *protocol_version = 2; -+ return 1; -+ } -+ -+ return 0; -+} -+ -+static grub_err_t -+grub_tpm1_execute(grub_efi_handle_t tpm_handle, -+ PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) -+{ -+ grub_efi_status_t status; -+ grub_efi_tpm_protocol_t *tpm; -+ grub_uint32_t inhdrsize = sizeof(*inbuf) - sizeof(inbuf->TPMOperandIn); -+ grub_uint32_t outhdrsize = sizeof(*outbuf) - sizeof(outbuf->TPMOperandOut); -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!grub_tpm_present(tpm)) -+ return 0; -+ -+ /* UEFI TPM protocol takes the raw operand block, no param block header */ -+ status = efi_call_5 (tpm->pass_through_to_tpm, tpm, -+ inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn, -+ outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut); -+ -+ switch (status) { -+ case GRUB_EFI_SUCCESS: -+ return 0; -+ case GRUB_EFI_DEVICE_ERROR: -+ return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ case GRUB_EFI_INVALID_PARAMETER: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ case GRUB_EFI_BUFFER_TOO_SMALL: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ case GRUB_EFI_NOT_FOUND: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); -+ default: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ } -+} -+ -+static grub_err_t -+grub_tpm2_execute(grub_efi_handle_t tpm_handle, -+ PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) -+{ -+ grub_efi_status_t status; -+ grub_efi_tpm2_protocol_t *tpm; -+ grub_uint32_t inhdrsize = sizeof(*inbuf) - sizeof(inbuf->TPMOperandIn); -+ grub_uint32_t outhdrsize = sizeof(*outbuf) - sizeof(outbuf->TPMOperandOut); -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!grub_tpm2_present(tpm)) -+ return 0; -+ -+ /* UEFI TPM protocol takes the raw operand block, no param block header */ -+ status = efi_call_5 (tpm->submit_command, tpm, -+ inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn, -+ outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut); -+ -+ switch (status) { -+ case GRUB_EFI_SUCCESS: -+ return 0; -+ case GRUB_EFI_DEVICE_ERROR: -+ return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ case GRUB_EFI_INVALID_PARAMETER: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ case GRUB_EFI_BUFFER_TOO_SMALL: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ case GRUB_EFI_NOT_FOUND: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); -+ default: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ } -+} -+ -+grub_err_t -+grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) -+{ -+ grub_efi_handle_t tpm_handle; -+ grub_uint8_t protocol_version; -+ -+ /* It's not a hard failure for there to be no TPM */ -+ if (!grub_tpm_handle_find(&tpm_handle, &protocol_version)) -+ return 0; -+ -+ if (protocol_version == 1) { -+ return grub_tpm1_execute(tpm_handle, inbuf, outbuf); -+ } else { -+ return grub_tpm2_execute(tpm_handle, inbuf, outbuf); -+ } -+} -+ -+static grub_err_t -+grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf, -+ grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ TCG_PCR_EVENT *event; -+ grub_efi_status_t status; -+ grub_efi_tpm_protocol_t *tpm; -+ grub_efi_physical_address_t lastevent; -+ grub_uint32_t algorithm; -+ grub_uint32_t eventnum = 0; -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!grub_tpm_present(tpm)) -+ return 0; -+ -+ event = grub_zalloc(sizeof (TCG_PCR_EVENT) + grub_strlen(description) + 1); -+ if (!event) -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ N_("cannot allocate TPM event buffer")); -+ -+ event->PCRIndex = pcr; -+ event->EventType = EV_IPL; -+ event->EventSize = grub_strlen(description) + 1; -+ grub_memcpy(event->Event, description, event->EventSize); -+ -+ algorithm = TCG_ALG_SHA; -+ status = efi_call_7 (tpm->log_extend_event, tpm, -+ (unsigned long) buf, (grub_uint64_t) size, -+ algorithm, event, &eventnum, &lastevent); -+ -+ switch (status) { -+ case GRUB_EFI_SUCCESS: -+ return 0; -+ case GRUB_EFI_DEVICE_ERROR: -+ return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ case GRUB_EFI_INVALID_PARAMETER: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ case GRUB_EFI_BUFFER_TOO_SMALL: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ case GRUB_EFI_NOT_FOUND: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); -+ default: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ } -+} -+ -+static grub_err_t -+grub_tpm2_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf, -+ grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ EFI_TCG2_EVENT *event; -+ grub_efi_status_t status; -+ grub_efi_tpm2_protocol_t *tpm; -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!grub_tpm2_present(tpm)) -+ return 0; -+ -+ event = grub_zalloc(sizeof (EFI_TCG2_EVENT) + grub_strlen(description) + 1); -+ if (!event) -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ N_("cannot allocate TPM event buffer")); -+ -+ event->Header.HeaderSize = sizeof(EFI_TCG2_EVENT_HEADER); -+ event->Header.HeaderVersion = 1; -+ event->Header.PCRIndex = pcr; -+ event->Header.EventType = EV_IPL; -+ event->Size = sizeof(*event) - sizeof(event->Event) + grub_strlen(description) + 1; -+ grub_memcpy(event->Event, description, grub_strlen(description) + 1); -+ -+ status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (unsigned long) buf, -+ (grub_uint64_t) size, event); -+ -+ switch (status) { -+ case GRUB_EFI_SUCCESS: -+ return 0; -+ case GRUB_EFI_DEVICE_ERROR: -+ return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ case GRUB_EFI_INVALID_PARAMETER: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ case GRUB_EFI_BUFFER_TOO_SMALL: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ case GRUB_EFI_NOT_FOUND: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); -+ default: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ } -+} -+ -+grub_err_t -+grub_tpm_log_event(unsigned char *buf, grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ grub_efi_handle_t tpm_handle; -+ grub_efi_uint8_t protocol_version; -+ -+ if (!grub_tpm_handle_find(&tpm_handle, &protocol_version)) -+ return 0; -+ -+ if (protocol_version == 1) { -+ return grub_tpm1_log_event(tpm_handle, buf, size, pcr, description); -+ } else { -+ return grub_tpm2_log_event(tpm_handle, buf, size, pcr, description); -+ } -+} -diff --git a/grub-core/kern/tpm.c b/grub-core/kern/tpm.c -new file mode 100644 -index 00000000000..e5e8fced624 ---- /dev/null -+++ b/grub-core/kern/tpm.c -@@ -0,0 +1,19 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+grub_err_t -+grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, -+ const char *kind, const char *description) -+{ -+ grub_err_t ret; -+ char *desc = grub_xasprintf("%s %s", kind, description); -+ if (!desc) -+ return GRUB_ERR_OUT_OF_MEMORY; -+ ret = grub_tpm_log_event(buf, size, pcr, desc); -+ grub_free(desc); -+ return ret; -+} -diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index 970ea868c14..d5c12957cad 100644 ---- a/grub-core/lib/cmdline.c -+++ b/grub-core/lib/cmdline.c -@@ -19,6 +19,7 @@ - - #include - #include -+#include - - static int - is_hex(char c) -@@ -79,7 +80,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf, - { - int i, space; - unsigned int arg_size; -- char *c; -+ char *c, *orig = buf; - - for (i = 0; i < argc; i++) - { -@@ -125,5 +126,9 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf, - - *buf = 0; - -+ grub_tpm_measure ((void *)orig, grub_strlen (orig), GRUB_ASCII_PCR, -+ "grub_kernel_cmdline", orig); -+ grub_print_error(); -+ - return i; - } -diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 800c3e54022..ea9f5134e67 100644 ---- a/grub-core/loader/i386/efi/linux.c -+++ b/grub-core/loader/i386/efi/linux.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -131,6 +132,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - argv[i]); - goto fail; - } -+ grub_tpm_measure (ptr, cursize, GRUB_BINARY_PCR, "grub_linuxefi", "Initrd"); -+ grub_print_error(); - ptr += cursize; - grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); - ptr += ALIGN_UP_OVERHEAD (cursize, 4); -@@ -195,6 +198,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - goto fail; - } - -+ grub_tpm_measure (kernel, filelen, GRUB_BINARY_PCR, "grub_linuxefi", "Kernel"); -+ grub_print_error(); -+ - rc = grub_linuxefi_secure_validate (kernel, filelen); - if (rc < 0) - { -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index c84747ea857..76304f05700 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -724,7 +725,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - goto fail; - } - -+ grub_tpm_measure (kernel, len, GRUB_BINARY_PCR, "grub_linux", "Kernel"); -+ grub_print_error(); -+ - grub_memcpy (&lh, kernel, sizeof (lh)); -+ - kernel_offset = sizeof (lh); - - if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) -@@ -1038,6 +1043,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - len = prot_file_size; - grub_memcpy (prot_mode_mem, kernel + kernel_offset, len); -+ kernel_offset += len; - - if (grub_errno == GRUB_ERR_NONE) - { -diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c -index dc98dbcae25..ca85358f771 100644 ---- a/grub-core/loader/i386/multiboot_mbi.c -+++ b/grub-core/loader/i386/multiboot_mbi.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - #ifdef GRUB_MACHINE_EFI - #include -@@ -173,6 +174,9 @@ grub_multiboot_load (grub_file_t file, const char *filename) - return grub_errno; - } - -+ grub_tpm_measure((unsigned char*)buffer, len, GRUB_BINARY_PCR, "grub_multiboot", filename); -+ grub_print_error(); -+ - header = find_header (buffer, len); - - if (header == 0) -diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c -index be6fa0f4d45..c2c7cfcd0fd 100644 ---- a/grub-core/loader/linux.c -+++ b/grub-core/loader/linux.c -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - - struct newc_head - { -@@ -288,6 +289,9 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx, - grub_initrd_close (initrd_ctx); - return grub_errno; - } -+ grub_tpm_measure (ptr, cursize, GRUB_BINARY_PCR, "grub_initrd", "Initrd"); -+ grub_print_error(); -+ - ptr += cursize; - } - if (newc) -diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index 26df46a4161..9a8dae5565b 100644 ---- a/grub-core/loader/multiboot.c -+++ b/grub-core/loader/multiboot.c -@@ -51,6 +51,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -440,6 +441,8 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), - } - - grub_file_close (file); -+ grub_tpm_measure (module, size, GRUB_BINARY_PCR, "grub_multiboot", argv[0]); -+ grub_print_error(); - return GRUB_ERR_NONE; - } - -diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c -index 4df6595954d..54078455e2f 100644 ---- a/grub-core/loader/multiboot_mbi2.c -+++ b/grub-core/loader/multiboot_mbi2.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - #if defined (GRUB_MACHINE_EFI) - #include -@@ -131,8 +132,10 @@ grub_multiboot2_load (grub_file_t file, const char *filename) - - COMPILE_TIME_ASSERT (MULTIBOOT_HEADER_ALIGN % 4 == 0); - -+ grub_tpm_measure ((unsigned char *)mld.buffer, len, GRUB_BINARY_PCR, "grub_multiboot", filename); -+ grub_print_error(); -+ - header = find_header (mld.buffer, len); -- - if (header == 0) - { - grub_free (mld.buffer); -diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index cf6cd6601d6..93965777138 100644 ---- a/grub-core/script/execute.c -+++ b/grub-core/script/execute.c -@@ -30,6 +30,7 @@ - #ifdef GRUB_MACHINE_IEEE1275 - #include - #endif -+#include - - /* Max digits for a char is 3 (0xFF is 255), similarly for an int it - is sizeof (int) * 3, and one extra for a possible -ve sign. */ -@@ -967,8 +968,9 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd) - grub_err_t ret = 0; - grub_script_function_t func = 0; - char errnobuf[18]; -- char *cmdname; -- int argc; -+ char *cmdname, *cmdstring; -+ int argc, offset = 0, cmdlen = 0; -+ unsigned int i; - char **args; - int invert; - struct grub_script_argv argv = { 0, 0, 0 }; -@@ -977,6 +979,26 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd) - if (grub_script_arglist_to_argv (cmdline->arglist, &argv) || ! argv.args[0]) - return grub_errno; - -+ for (i = 0; i < argv.argc; i++) { -+ cmdlen += grub_strlen (argv.args[i]) + 1; -+ } -+ -+ cmdstring = grub_malloc (cmdlen); -+ if (!cmdstring) -+ { -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ N_("cannot allocate command buffer")); -+ } -+ -+ for (i = 0; i < argv.argc; i++) { -+ offset += grub_snprintf (cmdstring + offset, cmdlen - offset, "%s ", -+ argv.args[i]); -+ } -+ cmdstring[cmdlen-1]= '\0'; -+ grub_tpm_measure ((unsigned char *)cmdstring, cmdlen, GRUB_ASCII_PCR, -+ "grub_cmd", cmdstring); -+ grub_print_error(); -+ grub_free(cmdstring); - invert = 0; - argc = argv.argc - 1; - args = argv.args + 1; -diff --git a/include/grub/efi/tpm.h b/include/grub/efi/tpm.h -new file mode 100644 -index 00000000000..63d8a0fe714 ---- /dev/null -+++ b/include/grub/efi/tpm.h -@@ -0,0 +1,153 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2015 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_EFI_TPM_HEADER -+#define GRUB_EFI_TPM_HEADER 1 -+ -+#define EFI_TPM_GUID {0xf541796d, 0xa62e, 0x4954, {0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd }}; -+#define EFI_TPM2_GUID {0x607f766c, 0x7455, 0x42be, {0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}; -+ -+typedef struct { -+ grub_efi_uint8_t Major; -+ grub_efi_uint8_t Minor; -+ grub_efi_uint8_t RevMajor; -+ grub_efi_uint8_t RevMinor; -+} TCG_VERSION; -+ -+typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY { -+ grub_efi_uint8_t Size; /// Size of this structure. -+ TCG_VERSION StructureVersion; -+ TCG_VERSION ProtocolSpecVersion; -+ grub_efi_uint8_t HashAlgorithmBitmap; /// Hash algorithms . -+ char TPMPresentFlag; /// 00h = TPM not present. -+ char TPMDeactivatedFlag; /// 01h = TPM currently deactivated. -+} TCG_EFI_BOOT_SERVICE_CAPABILITY; -+ -+typedef struct { -+ grub_efi_uint32_t PCRIndex; -+ grub_efi_uint32_t EventType; -+ grub_efi_uint8_t digest[20]; -+ grub_efi_uint32_t EventSize; -+ grub_efi_uint8_t Event[1]; -+} TCG_PCR_EVENT; -+ -+struct grub_efi_tpm_protocol -+{ -+ grub_efi_status_t (*status_check) (struct grub_efi_tpm_protocol *this, -+ TCG_EFI_BOOT_SERVICE_CAPABILITY *ProtocolCapability, -+ grub_efi_uint32_t *TCGFeatureFlags, -+ grub_efi_physical_address_t *EventLogLocation, -+ grub_efi_physical_address_t *EventLogLastEntry); -+ grub_efi_status_t (*hash_all) (struct grub_efi_tpm_protocol *this, -+ grub_efi_uint8_t *HashData, -+ grub_efi_uint64_t HashLen, -+ grub_efi_uint32_t AlgorithmId, -+ grub_efi_uint64_t *HashedDataLen, -+ grub_efi_uint8_t **HashedDataResult); -+ grub_efi_status_t (*log_event) (struct grub_efi_tpm_protocol *this, -+ TCG_PCR_EVENT *TCGLogData, -+ grub_efi_uint32_t *EventNumber, -+ grub_efi_uint32_t Flags); -+ grub_efi_status_t (*pass_through_to_tpm) (struct grub_efi_tpm_protocol *this, -+ grub_efi_uint32_t TpmInputParameterBlockSize, -+ grub_efi_uint8_t *TpmInputParameterBlock, -+ grub_efi_uint32_t TpmOutputParameterBlockSize, -+ grub_efi_uint8_t *TpmOutputParameterBlock); -+ grub_efi_status_t (*log_extend_event) (struct grub_efi_tpm_protocol *this, -+ grub_efi_physical_address_t HashData, -+ grub_efi_uint64_t HashDataLen, -+ grub_efi_uint32_t AlgorithmId, -+ TCG_PCR_EVENT *TCGLogData, -+ grub_efi_uint32_t *EventNumber, -+ grub_efi_physical_address_t *EventLogLastEntry); -+}; -+ -+typedef struct grub_efi_tpm_protocol grub_efi_tpm_protocol_t; -+ -+typedef grub_efi_uint32_t EFI_TCG2_EVENT_LOG_BITMAP; -+typedef grub_efi_uint32_t EFI_TCG2_EVENT_LOG_FORMAT; -+typedef grub_efi_uint32_t EFI_TCG2_EVENT_ALGORITHM_BITMAP; -+ -+typedef struct tdEFI_TCG2_VERSION { -+ grub_efi_uint8_t Major; -+ grub_efi_uint8_t Minor; -+} GRUB_PACKED EFI_TCG2_VERSION; -+ -+typedef struct tdEFI_TCG2_BOOT_SERVICE_CAPABILITY { -+ grub_efi_uint8_t Size; -+ EFI_TCG2_VERSION StructureVersion; -+ EFI_TCG2_VERSION ProtocolVersion; -+ EFI_TCG2_EVENT_ALGORITHM_BITMAP HashAlgorithmBitmap; -+ EFI_TCG2_EVENT_LOG_BITMAP SupportedEventLogs; -+ grub_efi_boolean_t TPMPresentFlag; -+ grub_efi_uint16_t MaxCommandSize; -+ grub_efi_uint16_t MaxResponseSize; -+ grub_efi_uint32_t ManufacturerID; -+ grub_efi_uint32_t NumberOfPcrBanks; -+ EFI_TCG2_EVENT_ALGORITHM_BITMAP ActivePcrBanks; -+} EFI_TCG2_BOOT_SERVICE_CAPABILITY; -+ -+typedef grub_efi_uint32_t TCG_PCRINDEX; -+typedef grub_efi_uint32_t TCG_EVENTTYPE; -+ -+typedef struct tdEFI_TCG2_EVENT_HEADER { -+ grub_efi_uint32_t HeaderSize; -+ grub_efi_uint16_t HeaderVersion; -+ TCG_PCRINDEX PCRIndex; -+ TCG_EVENTTYPE EventType; -+} GRUB_PACKED EFI_TCG2_EVENT_HEADER; -+ -+typedef struct tdEFI_TCG2_EVENT { -+ grub_efi_uint32_t Size; -+ EFI_TCG2_EVENT_HEADER Header; -+ grub_efi_uint8_t Event[1]; -+} GRUB_PACKED EFI_TCG2_EVENT; -+ -+struct grub_efi_tpm2_protocol -+{ -+ grub_efi_status_t (*get_capability) (struct grub_efi_tpm2_protocol *this, -+ EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability); -+ grub_efi_status_t (*get_event_log) (struct grub_efi_tpm2_protocol *this, -+ EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat, -+ grub_efi_physical_address_t *EventLogLocation, -+ grub_efi_physical_address_t *EventLogLastEntry, -+ grub_efi_boolean_t *EventLogTruncated); -+ grub_efi_status_t (*hash_log_extend_event) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint64_t Flags, -+ grub_efi_physical_address_t DataToHash, -+ grub_efi_uint64_t DataToHashLen, -+ EFI_TCG2_EVENT *EfiTcgEvent); -+ grub_efi_status_t (*submit_command) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint32_t InputParameterBlockSize, -+ grub_efi_uint8_t *InputParameterBlock, -+ grub_efi_uint32_t OutputParameterBlockSize, -+ grub_efi_uint8_t *OutputParameterBlock); -+ grub_efi_status_t (*get_active_pcr_blanks) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint32_t *ActivePcrBanks); -+ grub_efi_status_t (*set_active_pcr_banks) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint32_t ActivePcrBanks); -+ grub_efi_status_t (*get_result_of_set_active_pcr_banks) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint32_t *OperationPresent, -+ grub_efi_uint32_t *Response); -+}; -+ -+typedef struct grub_efi_tpm2_protocol grub_efi_tpm2_protocol_t; -+ -+#define TCG_ALG_SHA 0x00000004 -+ -+#endif -diff --git a/include/grub/tpm.h b/include/grub/tpm.h -new file mode 100644 -index 00000000000..ce52be4ff7f ---- /dev/null -+++ b/include/grub/tpm.h -@@ -0,0 +1,94 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2015 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_TPM_HEADER -+#define GRUB_TPM_HEADER 1 -+ -+#define SHA1_DIGEST_SIZE 20 -+ -+#define TPM_BASE 0x0 -+#define TPM_SUCCESS TPM_BASE -+#define TPM_AUTHFAIL (TPM_BASE + 0x1) -+#define TPM_BADINDEX (TPM_BASE + 0x2) -+ -+#define GRUB_ASCII_PCR 8 -+#define GRUB_BINARY_PCR 9 -+ -+#define TPM_TAG_RQU_COMMAND 0x00C1 -+#define TPM_ORD_Extend 0x14 -+ -+#define EV_IPL 0x0d -+ -+/* TCG_PassThroughToTPM Input Parameter Block */ -+typedef struct { -+ grub_uint16_t IPBLength; -+ grub_uint16_t Reserved1; -+ grub_uint16_t OPBLength; -+ grub_uint16_t Reserved2; -+ grub_uint8_t TPMOperandIn[1]; -+} GRUB_PACKED PassThroughToTPM_InputParamBlock; -+ -+/* TCG_PassThroughToTPM Output Parameter Block */ -+typedef struct { -+ grub_uint16_t OPBLength; -+ grub_uint16_t Reserved; -+ grub_uint8_t TPMOperandOut[1]; -+} GRUB_PACKED PassThroughToTPM_OutputParamBlock; -+ -+typedef struct { -+ grub_uint16_t tag; -+ grub_uint32_t paramSize; -+ grub_uint32_t ordinal; -+ grub_uint32_t pcrNum; -+ grub_uint8_t inDigest[SHA1_DIGEST_SIZE]; /* The 160 bit value representing the event to be recorded. */ -+} GRUB_PACKED ExtendIncoming; -+ -+/* TPM_Extend Outgoing Operand */ -+typedef struct { -+ grub_uint16_t tag; -+ grub_uint32_t paramSize; -+ grub_uint32_t returnCode; -+ grub_uint8_t outDigest[SHA1_DIGEST_SIZE]; /* The PCR value after execution of the command. */ -+} GRUB_PACKED ExtendOutgoing; -+ -+grub_err_t EXPORT_FUNC(grub_tpm_measure) (unsigned char *buf, grub_size_t size, -+ grub_uint8_t pcr, const char *kind, -+ const char *description); -+#if defined (GRUB_MACHINE_EFI) -+grub_err_t grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf); -+grub_err_t grub_tpm_log_event(unsigned char *buf, grub_size_t size, -+ grub_uint8_t pcr, const char *description); -+#else -+static inline grub_err_t grub_tpm_execute( -+ PassThroughToTPM_InputParamBlock *inbuf __attribute__ ((unused)), -+ PassThroughToTPM_OutputParamBlock *outbuf __attribute__ ((unused))) -+{ -+ return 0; -+}; -+static inline grub_err_t grub_tpm_log_event( -+ unsigned char *buf __attribute__ ((unused)), -+ grub_size_t size __attribute__ ((unused)), -+ grub_uint8_t pcr __attribute__ ((unused)), -+ const char *description __attribute__ ((unused))) -+{ -+ return 0; -+}; -+#endif -+ -+#endif -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index f36200bd688..3781bb9cbb9 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -94,6 +94,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/tpm.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h - - if COND_i386_pc diff --git a/0108-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0107-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 94% rename from 0108-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0107-Don-t-attempt-to-export-the-start-and-_start-symbols.patch index 33ceb3d4..f6c1185f 100644 --- a/0108-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +++ b/0107-Don-t-attempt-to-export-the-start-and-_start-symbols.patch @@ -26,10 +26,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+) diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index ae69218af20..9548d552aad 100644 +index e5a5f436709..de48cd44ccb 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h -@@ -108,8 +108,10 @@ grub_addr_t grub_modules_get_end (void); +@@ -110,8 +110,10 @@ grub_addr_t grub_modules_get_end (void); #endif diff --git a/0109-Fixup-for-newer-compiler.patch b/0108-Fixup-for-newer-compiler.patch similarity index 96% rename from 0109-Fixup-for-newer-compiler.patch rename to 0108-Fixup-for-newer-compiler.patch index e518af8f..e35dbdb7 100644 --- a/0109-Fixup-for-newer-compiler.patch +++ b/0108-Fixup-for-newer-compiler.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Fixup for newer compiler 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 044ab3abe88..c75848f5c06 100644 +index 4ba729e14d8..5e8ba2ae3b0 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding diff --git a/0111-Add-support-for-non-Ethernet-network-cards.patch b/0109-Add-support-for-non-Ethernet-network-cards.patch similarity index 94% rename from 0111-Add-support-for-non-Ethernet-network-cards.patch rename to 0109-Add-support-for-non-Ethernet-network-cards.patch index f1b76567..dc89c990 100644 --- a/0111-Add-support-for-non-Ethernet-network-cards.patch +++ b/0109-Add-support-for-non-Ethernet-network-cards.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Andrzej Kacprowski -Date: Fri, 21 Apr 2017 10:06:20 +0200 +Date: Wed, 10 Jul 2019 15:22:29 +0200 Subject: [PATCH] Add support for non-Ethernet network cards This patch replaces fixed 6-byte link layer address with @@ -24,7 +24,7 @@ Signed-off-by: Andrzej Kacprowski Signed-off-by: Mark Salter --- grub-core/net/arp.c | 155 ++++++++++++++++++++++----------- - grub-core/net/bootp.c | 14 ++- + grub-core/net/bootp.c | 15 ++-- grub-core/net/drivers/efi/efinet.c | 8 +- grub-core/net/drivers/emu/emunet.c | 1 + grub-core/net/drivers/i386/pc/pxe.c | 13 +-- @@ -35,7 +35,7 @@ Signed-off-by: Mark Salter grub-core/net/ip.c | 4 +- grub-core/net/net.c | 50 ++++++----- include/grub/net.h | 19 ++-- - 12 files changed, 218 insertions(+), 152 deletions(-) + 12 files changed, 219 insertions(+), 152 deletions(-) diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c index 54306e3b16d..67b409a8acc 100644 @@ -271,10 +271,10 @@ index 54306e3b16d..67b409a8acc 100644 /* Change operation to REPLY and send packet */ send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 2869482fe06..4e55adc557b 100644 +index 8c969595a7b..3cf6dbf0e72 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c -@@ -219,7 +219,6 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -269,7 +269,6 @@ grub_net_configure_by_dhcp_ack (const char *name, int is_def, char **device, char **path) { grub_net_network_level_address_t addr; @@ -282,7 +282,7 @@ index 2869482fe06..4e55adc557b 100644 struct grub_net_network_level_interface *inter; int mask = -1; char server_ip[sizeof ("xxx.xxx.xxx.xxx")]; -@@ -232,12 +231,8 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -286,12 +285,8 @@ grub_net_configure_by_dhcp_ack (const char *name, if (path) *path = 0; @@ -297,24 +297,25 @@ index 2869482fe06..4e55adc557b 100644 if (!inter) return 0; -@@ -770,7 +765,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), - grub_memset (pack, 0, sizeof (*pack) + 64); - pack->opcode = 1; - pack->hw_type = 1; -- pack->hw_len = 6; -+ pack->hw_len = ifaces[j].hwaddress.len > 16 ? 0 -+ : ifaces[j].hwaddress.len; - err = grub_get_datetime (&date); - if (err || !grub_datetime2unixtime (&date, &t)) - { -@@ -781,7 +777,7 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), - ifaces[j].dhcp_xid = pack->xid; - pack->seconds = grub_cpu_to_be16 (t); +@@ -601,7 +596,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) + grub_memset (pack, 0, sizeof (*pack)); + pack->opcode = 1; + pack->hw_type = 1; +- pack->hw_len = 6; ++ pack->hw_len = iface->hwaddress.len > 16 ? 0 ++ : iface->hwaddress.len; ++ + err = grub_get_datetime (&date); + if (err || !grub_datetime2unixtime (&date, &t)) + { +@@ -614,7 +611,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) + else + pack->ident = iface->xid; -- grub_memcpy (&pack->mac_addr, &ifaces[j].hwaddress.mac, 6); -+ grub_memcpy (&pack->mac_addr, &ifaces[j].hwaddress.mac, pack->hw_len); +- grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, 6); ++ grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, pack->hw_len); - grub_netbuff_push (nb, sizeof (*udph)); + grub_netbuff_push (nb, sizeof (*udph)); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c index a57189e8bb3..4444e8e60ee 100644 @@ -389,7 +390,7 @@ index 3f4152d036c..9f8fb4b6d2b 100644 grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index 3df75357a70..ba50415f5f6 100644 +index 3860b6f78d8..bcb3f9ea02d 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -160,6 +160,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, @@ -611,22 +612,22 @@ index 2cbd95dce25..56a3ec5c8e8 100644 } if (ohdr->type == OPTION_PREFIX && ohdr->len == 4) diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index 8411e0ecca3..b2ca74b6eb1 100644 +index ea5edf8f1f6..a5896f6dc26 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c -@@ -277,8 +277,8 @@ handle_dgram (struct grub_net_buff *nb, +@@ -276,8 +276,8 @@ handle_dgram (struct grub_net_buff *nb, + if (inf->card == card && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV - && inf->dhcp_xid == bootp->xid && inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET - && grub_memcmp (inf->hwaddress.mac, &bootp->mac_addr, - sizeof (inf->hwaddress.mac)) == 0) + && (grub_memcmp (inf->hwaddress.mac, &bootp->mac_addr, + bootp->hw_len) == 0 || bootp->hw_len == 0)) { - grub_net_process_dhcp (nb, inf->card); + grub_net_process_dhcp (nb, inf); grub_netbuff_free (nb); diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index fa3e2912643..9700e2d09a2 100644 +index 5366e443d2a..6468eb24596 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -128,8 +128,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, @@ -712,7 +713,7 @@ index fa3e2912643..9700e2d09a2 100644 int diff --git a/include/grub/net.h b/include/grub/net.h -index de51894cbbf..e9ebc6a1b4f 100644 +index 3647012374b..fc1fc44baef 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -29,7 +29,8 @@ @@ -745,7 +746,7 @@ index de51894cbbf..e9ebc6a1b4f 100644 }; } grub_net_link_level_address_t; -@@ -555,11 +558,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a, +@@ -566,11 +569,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a, #define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX") /* diff --git a/0110-Use-xid-to-match-DHCP-replies.patch b/0110-Use-xid-to-match-DHCP-replies.patch deleted file mode 100644 index 657ebb78..00000000 --- a/0110-Use-xid-to-match-DHCP-replies.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Andrzej Kacprowski -Date: Fri, 21 Apr 2017 09:20:38 +0200 -Subject: [PATCH] Use xid to match DHCP replies - -Transaction identifier (xid) from DHCP request -packet is stored in network level interface and used -to match request with the responses it generates. - -Resolves: rhbz#1370642 - -Signed-off-by: Andrzej Kacprowski ---- - grub-core/net/bootp.c | 3 ++- - grub-core/net/ip.c | 1 + - include/grub/net.h | 3 ++- - 3 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index da3e454466b..2869482fe06 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -777,7 +777,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), - grub_errno = GRUB_ERR_NONE; - t = 0; - } -- pack->ident = grub_cpu_to_be32 (t); -+ pack->xid = grub_cpu_to_be32 (t); -+ ifaces[j].dhcp_xid = pack->xid; - pack->seconds = grub_cpu_to_be16 (t); - - grub_memcpy (&pack->mac_addr, &ifaces[j].hwaddress.mac, 6); -diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index 7c95cc7464a..8411e0ecca3 100644 ---- a/grub-core/net/ip.c -+++ b/grub-core/net/ip.c -@@ -275,6 +275,7 @@ handle_dgram (struct grub_net_buff *nb, - FOR_NET_NETWORK_LEVEL_INTERFACES (inf) - if (inf->card == card - && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV -+ && inf->dhcp_xid == bootp->xid - && inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET - && grub_memcmp (inf->hwaddress.mac, &bootp->mac_addr, - sizeof (inf->hwaddress.mac)) == 0) -diff --git a/include/grub/net.h b/include/grub/net.h -index f8f3ec13acc..de51894cbbf 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -292,6 +292,7 @@ struct grub_net_network_level_interface - struct grub_net_bootp_packet *dhcp_ack; - grub_size_t dhcp_acklen; - grub_uint16_t vlantag; -+ grub_uint32_t dhcp_xid; - void *data; - }; - -@@ -429,7 +430,7 @@ struct grub_net_bootp_packet - grub_uint8_t hw_type; /* hardware type. */ - grub_uint8_t hw_len; /* hardware addr len. */ - grub_uint8_t gate_hops; /* zero it. */ -- grub_uint32_t ident; /* random number chosen by client. */ -+ grub_uint32_t xid; /* transaction id chosen by client. */ - grub_uint16_t seconds; /* seconds since did initial bootstrap. */ - grub_uint16_t flags; - grub_uint32_t client_ip; diff --git a/0112-misc-fix-invalid-character-recongition-in-strto-l.patch b/0110-misc-fix-invalid-character-recongition-in-strto-l.patch similarity index 100% rename from 0112-misc-fix-invalid-character-recongition-in-strto-l.patch rename to 0110-misc-fix-invalid-character-recongition-in-strto-l.patch diff --git a/0113-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 99% rename from 0113-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch index 9199fe8b..e014e612 100644 --- a/0113-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +++ b/0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch @@ -89,7 +89,7 @@ index 5aa4ad3befc..00737c52750 100644 if (!data->sock) { diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 9700e2d09a2..191e8e41bd6 100644 +index 6468eb24596..2734f70d22f 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -439,6 +439,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) @@ -260,7 +260,7 @@ index f90071353ad..e267af354f4 100644 if (!data->sock) { diff --git a/include/grub/net.h b/include/grub/net.h -index e9ebc6a1b4f..f4cd86e582f 100644 +index fc1fc44baef..fa7a8c39704 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -273,6 +273,7 @@ typedef struct grub_net diff --git a/0114-bootp-New-net_bootp6-command.patch b/0112-bootp-New-net_bootp6-command.patch similarity index 84% rename from 0114-bootp-New-net_bootp6-command.patch rename to 0112-bootp-New-net_bootp6-command.patch index ae025634..8cb4ed82 100644 --- a/0114-bootp-New-net_bootp6-command.patch +++ b/0112-bootp-New-net_bootp6-command.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Michael Chang -Date: Sun, 10 Jul 2016 23:46:06 +0800 +Date: Wed, 10 Jul 2019 15:42:36 +0200 Subject: [PATCH] bootp: New net_bootp6 command Implement new net_bootp6 command for IPv6 network auto configuration via the @@ -11,15 +11,15 @@ Signed-off-by: Ken Lin [pjones: Put back our code to add a local route] Signed-off-by: Peter Jones --- - grub-core/net/bootp.c | 1053 ++++++++++++++++++++++++++++++------ + grub-core/net/bootp.c | 1059 ++++++++++++++++++++++++++++++------ grub-core/net/drivers/efi/efinet.c | 20 +- grub-core/net/ip.c | 39 ++ include/grub/efi/api.h | 2 +- include/grub/net.h | 91 ++-- - 5 files changed, 999 insertions(+), 206 deletions(-) + 5 files changed, 1002 insertions(+), 209 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 4e55adc557b..242cd1f4cbd 100644 +index 3cf6dbf0e72..85adc9cb447 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -25,6 +25,98 @@ @@ -119,26 +119,12 @@ index 4e55adc557b..242cd1f4cbd 100644 + return 1; +} - static char * - grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)), -@@ -345,178 +437,583 @@ grub_net_configure_by_dhcp_ack (const char *name, - return inter; + struct grub_dhcp_discover_options + { +@@ -638,6 +730,584 @@ out: + return err; } --struct grub_net_network_level_interface * --grub_net_configure_by_dhcpv6_ack (const char *name, -- struct grub_net_card *card, -- grub_net_interface_flags_t flags -- __attribute__((__unused__)), -- const grub_net_link_level_address_t *hwaddr, -- const struct grub_net_dhcpv6_packet *packet, -- int is_def, char **device, char **path) --{ -- struct grub_net_network_level_interface *inter = NULL; -- struct grub_net_network_level_address addr; -- int mask = -1; -- -- if (!device || !path) +/* The default netbuff size for sending DHCPv6 packets which should be + large enough to hold the information */ +#define GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE 512 @@ -356,19 +342,8 @@ index 4e55adc557b..242cd1f4cbd 100644 + + options = grub_zalloc (sizeof(*options)); + if (!options) - return NULL; - -- *device = 0; -- *path = 0; -- -- grub_dprintf ("net", "mac address is %02x:%02x:%02x:%02x:%02x:%02x\n", -- hwaddr->mac[0], hwaddr->mac[1], hwaddr->mac[2], -- hwaddr->mac[3], hwaddr->mac[4], hwaddr->mac[5]); -- -- if (is_def) -- grub_net_default_server = 0; -- -- if (is_def && !grub_net_default_server && packet) ++ return NULL; ++ + foreach_dhcp6_option ((const struct grub_net_dhcp6_option *)v6h->dhcp_options, + size - sizeof (*v6h), parse_dhcp6_option, options); + @@ -412,165 +387,37 @@ index 4e55adc557b..242cd1f4cbd 100644 + struct grub_net_network_level_interface *inf; + + if (dhcp6->ia_addr) - { -- const grub_uint8_t *options = packet->dhcp_options; -- unsigned int option_max = 1024 - OFFSET_OF (dhcp_options, packet); -- unsigned int i; -- -- for (i = 0; i < option_max - sizeof (grub_net_dhcpv6_option_t); ) -- { -- grub_uint16_t num, len; -- grub_net_dhcpv6_option_t *opt = -- (grub_net_dhcpv6_option_t *)(options + i); -- -- num = grub_be_to_cpu16(opt->option_num); -- len = grub_be_to_cpu16(opt->option_len); -- -- grub_dprintf ("net", "got dhcpv6 option %d len %d\n", num, len); -- -- if (len == 0) -- break; -- -- if (len + i > 1024) -- break; -- -- if (num == GRUB_NET_DHCP6_BOOTFILE_URL) -- { -- char *scheme, *userinfo, *host, *file; -- char *tmp; -- int hostlen; -- int port; -- int rc = extract_url_info ((const char *)opt->option_data, -- (grub_size_t)len, -- &scheme, &userinfo, &host, &port, -- &file); -- if (rc < 0) -- continue; -- -- /* right now this only handles tftp. */ -- if (grub_strcmp("tftp", scheme)) -- { -- grub_free (scheme); -- grub_free (userinfo); -- grub_free (host); -- grub_free (file); -- continue; -- } -- grub_free (userinfo); -- -- hostlen = grub_strlen (host); -- if (hostlen > 2 && host[0] == '[' && host[hostlen-1] == ']') -- { -- tmp = host+1; -- host[hostlen-1] = '\0'; -- } -- else -- tmp = host; ++ { + inf = grub_net_add_addr (name, card, dhcp6->ia_addr, &card->default_address, flags); - -- *device = grub_xasprintf ("%s,%s", scheme, tmp); -- grub_free (scheme); -- grub_free (host); ++ + netaddr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; + netaddr.ipv6.base[0] = dhcp6->ia_addr->ipv6[0]; + netaddr.ipv6.base[1] = 0; + netaddr.ipv6.masksize = 64; + grub_net_add_route (name, netaddr, inf); - -- if (file && *file) -- { -- tmp = grub_strrchr (file, '/'); -- if (tmp) -- *(tmp+1) = '\0'; -- else -- file[0] = '\0'; -- } -- else if (!file) -- file = grub_strdup (""); -- -- if (file[0] == '/') -- { -- *path = grub_strdup (file+1); -- grub_free (file); -- } -- else -- *path = file; -- } -- else if (num == GRUB_NET_DHCP6_IA_NA) -- { -- const grub_net_dhcpv6_option_t *ia_na_opt; -- const grub_net_dhcpv6_opt_ia_na_t *ia_na = -- (const grub_net_dhcpv6_opt_ia_na_t *)opt; -- unsigned int left = len - OFFSET_OF (options, ia_na); -- unsigned int j; -- -- if ((grub_uint8_t *)ia_na + left > -- (grub_uint8_t *)options + option_max) -- left -= ((grub_uint8_t *)ia_na + left) -- - ((grub_uint8_t *)options + option_max); -- -- if (len < OFFSET_OF (option_data, opt) -- + sizeof (grub_net_dhcpv6_option_t)) -- { -- grub_dprintf ("net", -- "found dhcpv6 ia_na option with no address\n"); -- continue; -- } -- -- for (j = 0; left > sizeof (grub_net_dhcpv6_option_t); ) -- { -- ia_na_opt = (const grub_net_dhcpv6_option_t *) -- (ia_na->options + j); -- grub_uint16_t ia_na_opt_num, ia_na_opt_len; -- -- ia_na_opt_num = grub_be_to_cpu16 (ia_na_opt->option_num); -- ia_na_opt_len = grub_be_to_cpu16 (ia_na_opt->option_len); -- if (ia_na_opt_len == 0) -- break; -- if (j + ia_na_opt_len > left) -- break; -- if (ia_na_opt_num == GRUB_NET_DHCP6_IA_ADDRESS) -- { -- const grub_net_dhcpv6_opt_ia_address_t *ia_addr; -- -- ia_addr = (const grub_net_dhcpv6_opt_ia_address_t *) -- ia_na_opt; -- addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -- grub_memcpy(addr.ipv6, ia_addr->ipv6_address, -- sizeof (ia_addr->ipv6_address)); -- inter = grub_net_add_addr (name, card, &addr, hwaddr, 0); -- } -- -- j += ia_na_opt_len; -- left -= ia_na_opt_len; -- } -- } ++ + if (ret_inf) + *ret_inf = inf; + } - -- i += len + 4; -- } ++ + if (dhcp6->dns_server_addrs) + { + grub_uint16_t i; - -- grub_print_error (); ++ + for (i = 0; i < dhcp6->num_dns_server; ++i) + grub_net_add_dns_server (dhcp6->dns_server_addrs + i); - } - -- if (is_def) ++ } ++ + if (dhcp6->boot_file_path) + grub_env_set_net_property (name, "boot_file", dhcp6->boot_file_path, + grub_strlen (dhcp6->boot_file_path)); + + if (is_def && dhcp6->boot_file_server_ip) - { ++ { + grub_net_default_server = grub_strdup (dhcp6->boot_file_server_ip); - grub_env_set ("net_default_interface", name); - grub_env_export ("net_default_interface"); - } ++ grub_env_set ("net_default_interface", name); ++ grub_env_export ("net_default_interface"); ++ } +} + +static void @@ -590,10 +437,7 @@ index 4e55adc557b..242cd1f4cbd 100644 + grub_errno = GRUB_ERR_NONE; + t = 0; + } - -- if (inter) -- grub_net_add_ipv6_local (inter, mask); -- return inter; ++ + se->iface = iface; + se->iaid = iaid; + se->transaction_id = t; @@ -604,8 +448,8 @@ index 4e55adc557b..242cd1f4cbd 100644 + se->adv = NULL; + se->reply = NULL; + grub_list_push (GRUB_AS_LIST_P (&grub_dhcp6_sessions), GRUB_AS_LIST (se)); - } - ++} ++ +static void +grub_dhcp6_session_remove (grub_dhcp6_session_t se) +{ @@ -858,16 +702,17 @@ index 4e55adc557b..242cd1f4cbd 100644 + + return inf; +} - - void - grub_net_process_dhcp (struct grub_net_buff *nb, -@@ -550,6 +1047,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb, ++ + /* + * This is called directly from net/ip.c:handle_dgram(), because those + * BOOTP/DHCP packets are a bit special due to their improper +@@ -706,6 +1376,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb, } } +grub_err_t +grub_net_process_dhcp6 (struct grub_net_buff *nb, -+ struct grub_net_card *card __attribute__ ((unused))) ++ struct grub_net_card *card __attribute__ ((unused))) +{ + const struct grub_net_dhcp6_packet *v6h; + grub_dhcp6_session_t se; @@ -890,9 +735,9 @@ index 4e55adc557b..242cd1f4cbd 100644 + FOR_DHCP6_SESSIONS (se) + { + if (se->transaction_id == v6h->transaction_id && -+ grub_memcmp (options->client_duid, &se->duid, sizeof (se->duid)) == 0 && -+ se->iaid == options->iaid) -+ break; ++ grub_memcmp (options->client_duid, &se->duid, sizeof (se->duid)) == 0 && ++ se->iaid == options->iaid) ++ break; + } + + if (!se) @@ -905,11 +750,11 @@ index 4e55adc557b..242cd1f4cbd 100644 + if (v6h->message_type == GRUB_NET_DHCP6_ADVERTISE) + { + if (se->adv) -+ { -+ grub_dprintf ("bootp", "Skipped DHCPv6 Advertised .. \n"); -+ grub_dhcp6_options_free (options); -+ return GRUB_ERR_NONE; -+ } ++ { ++ grub_dprintf ("bootp", "Skipped DHCPv6 Advertised .. \n"); ++ grub_dhcp6_options_free (options); ++ return GRUB_ERR_NONE; ++ } + + se->adv = options; + return grub_dhcp6_session_send_request (se); @@ -917,11 +762,11 @@ index 4e55adc557b..242cd1f4cbd 100644 + else if (v6h->message_type == GRUB_NET_DHCP6_REPLY) + { + if (!se->adv) -+ { -+ grub_dprintf ("bootp", "Skipped DHCPv6 Reply .. \n"); -+ grub_dhcp6_options_free (options); -+ return GRUB_ERR_NONE; -+ } ++ { ++ grub_dprintf ("bootp", "Skipped DHCPv6 Reply .. \n"); ++ grub_dhcp6_options_free (options); ++ return GRUB_ERR_NONE; ++ } + + se->reply = options; + grub_dhcp6_session_configure_network (se); @@ -939,183 +784,342 @@ index 4e55adc557b..242cd1f4cbd 100644 static grub_err_t grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), int argc, char **args) -@@ -824,7 +1392,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), +@@ -931,180 +1672,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), return err; } --static grub_command_t cmd_getdhcp, cmd_bootp; +-static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp; +- +-struct grub_net_network_level_interface * +-grub_net_configure_by_dhcpv6_ack (const char *name, +- struct grub_net_card *card, +- grub_net_interface_flags_t flags +- __attribute__((__unused__)), +- const grub_net_link_level_address_t *hwaddr, +- const struct grub_net_dhcpv6_packet *packet, +- int is_def, char **device, char **path) +static grub_err_t +grub_cmd_bootp6 (struct grub_command *cmd __attribute__ ((unused)), -+ int argc, char **args) -+{ ++ int argc, char **args) + { +- struct grub_net_network_level_interface *inter = NULL; +- struct grub_net_network_level_address addr; +- int mask = -1; + struct grub_net_card *card; + grub_uint32_t iaid = 0; + int interval; + grub_err_t err; + grub_dhcp6_session_t se; -+ + +- if (!device || !path) +- return NULL; + err = GRUB_ERR_NONE; -+ + +- *device = 0; +- *path = 0; + FOR_NET_CARDS (card) + { + struct grub_net_network_level_interface *iface; -+ + +- grub_dprintf ("net", "mac address is %02x:%02x:%02x:%02x:%02x:%02x\n", +- hwaddr->mac[0], hwaddr->mac[1], hwaddr->mac[2], +- hwaddr->mac[3], hwaddr->mac[4], hwaddr->mac[5]); + if (argc > 0 && grub_strcmp (card->name, args[0]) != 0) + continue; -+ + +- if (is_def) +- grub_net_default_server = 0; + iface = grub_net_ipv6_get_link_local (card, &card->default_address); + if (!iface) + { -+ grub_dhcp6_session_remove_all (); -+ return grub_errno; ++ grub_dhcp6_session_remove_all (); ++ return grub_errno; + } -+ + +- if (is_def && !grub_net_default_server && packet) + grub_dhcp6_session_add (iface, iaid++); + } + + for (interval = 200; interval < 10000; interval *= 2) -+ { + { +- const grub_uint8_t *options = packet->dhcp_options; +- unsigned int option_max = 1024 - OFFSET_OF (dhcp_options, packet); +- unsigned int i; +- +- for (i = 0; i < option_max - sizeof (grub_net_dhcpv6_option_t); ) +- { +- grub_uint16_t num, len; +- grub_net_dhcpv6_option_t *opt = +- (grub_net_dhcpv6_option_t *)(options + i); +- +- num = grub_be_to_cpu16(opt->option_num); +- len = grub_be_to_cpu16(opt->option_len); +- +- grub_dprintf ("net", "got dhcpv6 option %d len %d\n", num, len); +- +- if (len == 0) +- break; +- +- if (len + i > 1024) +- break; +- +- if (num == GRUB_NET_DHCP6_BOOTFILE_URL) +- { +- char *scheme, *userinfo, *host, *file; +- char *tmp; +- int hostlen; +- int port; +- int rc = extract_url_info ((const char *)opt->option_data, +- (grub_size_t)len, +- &scheme, &userinfo, &host, &port, +- &file); +- if (rc < 0) +- continue; +- +- /* right now this only handles tftp. */ +- if (grub_strcmp("tftp", scheme)) +- { +- grub_free (scheme); +- grub_free (userinfo); +- grub_free (host); +- grub_free (file); +- continue; +- } +- grub_free (userinfo); +- +- hostlen = grub_strlen (host); +- if (hostlen > 2 && host[0] == '[' && host[hostlen-1] == ']') +- { +- tmp = host+1; +- host[hostlen-1] = '\0'; +- } +- else +- tmp = host; +- +- *device = grub_xasprintf ("%s,%s", scheme, tmp); +- grub_free (scheme); +- grub_free (host); +- +- if (file && *file) +- { +- tmp = grub_strrchr (file, '/'); +- if (tmp) +- *(tmp+1) = '\0'; +- else +- file[0] = '\0'; +- } +- else if (!file) +- file = grub_strdup (""); +- +- if (file[0] == '/') +- { +- *path = grub_strdup (file+1); +- grub_free (file); +- } +- else +- *path = file; +- } +- else if (num == GRUB_NET_DHCP6_IA_NA) +- { +- const grub_net_dhcpv6_option_t *ia_na_opt; +- const grub_net_dhcpv6_opt_ia_na_t *ia_na = +- (const grub_net_dhcpv6_opt_ia_na_t *)opt; +- unsigned int left = len - OFFSET_OF (options, ia_na); +- unsigned int j; +- +- if ((grub_uint8_t *)ia_na + left > +- (grub_uint8_t *)options + option_max) +- left -= ((grub_uint8_t *)ia_na + left) +- - ((grub_uint8_t *)options + option_max); +- +- if (len < OFFSET_OF (option_data, opt) +- + sizeof (grub_net_dhcpv6_option_t)) +- { +- grub_dprintf ("net", +- "found dhcpv6 ia_na option with no address\n"); +- continue; +- } +- +- for (j = 0; left > sizeof (grub_net_dhcpv6_option_t); ) +- { +- ia_na_opt = (const grub_net_dhcpv6_option_t *) +- (ia_na->options + j); +- grub_uint16_t ia_na_opt_num, ia_na_opt_len; +- +- ia_na_opt_num = grub_be_to_cpu16 (ia_na_opt->option_num); +- ia_na_opt_len = grub_be_to_cpu16 (ia_na_opt->option_len); +- if (ia_na_opt_len == 0) +- break; +- if (j + ia_na_opt_len > left) +- break; +- if (ia_na_opt_num == GRUB_NET_DHCP6_IA_ADDRESS) +- { +- const grub_net_dhcpv6_opt_ia_address_t *ia_addr; +- +- ia_addr = (const grub_net_dhcpv6_opt_ia_address_t *) +- ia_na_opt; +- addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; +- grub_memcpy(addr.ipv6, ia_addr->ipv6_address, +- sizeof (ia_addr->ipv6_address)); +- inter = grub_net_add_addr (name, card, &addr, hwaddr, 0); +- } +- +- j += ia_na_opt_len; +- left -= ia_na_opt_len; +- } +- } +- +- i += len + 4; +- } +- +- grub_print_error (); + int done = 1; + + FOR_DHCP6_SESSIONS (se) -+ { -+ struct grub_net_buff *nb; -+ struct grub_net_dhcp6_option *opt; -+ struct grub_net_dhcp6_packet *v6h; -+ struct grub_net_dhcp6_option_duid_ll *duid; -+ struct grub_net_dhcp6_option_iana *ia_na; -+ grub_net_network_level_address_t multicast; -+ grub_net_link_level_address_t ll_multicast; -+ struct udphdr *udph; ++ { ++ struct grub_net_buff *nb; ++ struct grub_net_dhcp6_option *opt; ++ struct grub_net_dhcp6_packet *v6h; ++ struct grub_net_dhcp6_option_duid_ll *duid; ++ struct grub_net_dhcp6_option_iana *ia_na; ++ grub_net_network_level_address_t multicast; ++ grub_net_link_level_address_t ll_multicast; ++ struct udphdr *udph; + -+ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -+ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48); -+ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x10002ULL); ++ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48); ++ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x10002ULL); + -+ err = grub_net_link_layer_resolve (se->iface, -+ &multicast, &ll_multicast); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ return err; -+ } ++ err = grub_net_link_layer_resolve (se->iface, ++ &multicast, &ll_multicast); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ return err; ++ } + -+ nb = grub_netbuff_alloc (GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); ++ nb = grub_netbuff_alloc (GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); + -+ if (!nb) -+ { -+ grub_dhcp6_session_remove_all (); -+ return grub_errno; -+ } ++ if (!nb) ++ { ++ grub_dhcp6_session_remove_all (); ++ return grub_errno; ++ } + -+ err = grub_netbuff_reserve (nb, GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } ++ err = grub_netbuff_reserve (nb, GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } + -+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (grub_uint16_t)); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } ++ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (grub_uint16_t)); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } + -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ELAPSED_TIME); -+ opt->len = grub_cpu_to_be16_compile_time (sizeof (grub_uint16_t)); -+ grub_set_unaligned16 (opt->data, 0); ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ELAPSED_TIME); ++ opt->len = grub_cpu_to_be16_compile_time (sizeof (grub_uint16_t)); ++ grub_set_unaligned16 (opt->data, 0); + -+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*duid)); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } ++ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*duid)); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } + -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_CLIENTID); -+ opt->len = grub_cpu_to_be16 (sizeof (*duid)); ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_CLIENTID); ++ opt->len = grub_cpu_to_be16 (sizeof (*duid)); + -+ duid = (struct grub_net_dhcp6_option_duid_ll *) opt->data; -+ grub_memcpy (duid, &se->duid, sizeof (*duid)); ++ duid = (struct grub_net_dhcp6_option_duid_ll *) opt->data; ++ grub_memcpy (duid, &se->duid, sizeof (*duid)); + -+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*ia_na)); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } ++ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*ia_na)); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } + -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA); -+ opt->len = grub_cpu_to_be16 (sizeof (*ia_na)); -+ ia_na = (struct grub_net_dhcp6_option_iana *)opt->data; -+ ia_na->iaid = grub_cpu_to_be32 (se->iaid); -+ ia_na->t1 = 0; -+ ia_na->t2 = 0; ++ opt = (struct grub_net_dhcp6_option *)nb->data; ++ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA); ++ opt->len = grub_cpu_to_be16 (sizeof (*ia_na)); ++ ia_na = (struct grub_net_dhcp6_option_iana *)opt->data; ++ ia_na->iaid = grub_cpu_to_be32 (se->iaid); ++ ia_na->t1 = 0; ++ ia_na->t2 = 0; + -+ err = grub_netbuff_push (nb, sizeof (*v6h)); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } ++ err = grub_netbuff_push (nb, sizeof (*v6h)); ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ grub_netbuff_free (nb); ++ return err; ++ } + -+ v6h = (struct grub_net_dhcp6_packet *)nb->data; -+ v6h->message_type = GRUB_NET_DHCP6_SOLICIT; -+ v6h->transaction_id = se->transaction_id; ++ v6h = (struct grub_net_dhcp6_packet *)nb->data; ++ v6h->message_type = GRUB_NET_DHCP6_SOLICIT; ++ v6h->transaction_id = se->transaction_id; + -+ grub_netbuff_push (nb, sizeof (*udph)); ++ grub_netbuff_push (nb, sizeof (*udph)); + -+ udph = (struct udphdr *) nb->data; -+ udph->src = grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT); -+ udph->dst = grub_cpu_to_be16_compile_time (DHCP6_SERVER_PORT); -+ udph->chksum = 0; -+ udph->len = grub_cpu_to_be16 (nb->tail - nb->data); ++ udph = (struct udphdr *) nb->data; ++ udph->src = grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT); ++ udph->dst = grub_cpu_to_be16_compile_time (DHCP6_SERVER_PORT); ++ udph->chksum = 0; ++ udph->len = grub_cpu_to_be16 (nb->tail - nb->data); + -+ udph->chksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_UDP, -+ &se->iface->address, &multicast); ++ udph->chksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_UDP, ++ &se->iface->address, &multicast); + -+ err = grub_net_send_ip_packet (se->iface, &multicast, -+ &ll_multicast, nb, GRUB_NET_IP_UDP); -+ done = 0; -+ grub_netbuff_free (nb); ++ err = grub_net_send_ip_packet (se->iface, &multicast, ++ &ll_multicast, nb, GRUB_NET_IP_UDP); ++ done = 0; ++ grub_netbuff_free (nb); + -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ return err; -+ } -+ } ++ if (err) ++ { ++ grub_dhcp6_session_remove_all (); ++ return err; ++ } ++ } + if (!done) -+ grub_net_poll_cards (interval, 0); -+ } -+ ++ grub_net_poll_cards (interval, 0); + } + +- if (is_def) + FOR_DHCP6_SESSIONS (se) -+ { + { +- grub_env_set ("net_default_interface", name); +- grub_env_export ("net_default_interface"); + grub_error_push (); + err = grub_error (GRUB_ERR_FILE_NOT_FOUND, -+ N_("couldn't autoconfigure %s"), -+ se->iface->card->name); -+ } -+ ++ N_("couldn't autoconfigure %s"), ++ se->iface->card->name); + } + +- if (inter) +- grub_net_add_ipv6_local (inter, mask); +- return inter; + grub_dhcp6_session_remove_all (); + + return err; -+} -+ -+static grub_command_t cmd_getdhcp, cmd_bootp, cmd_bootp6; + } + ++static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp, cmd_bootp6; void grub_bootp_init (void) -@@ -835,6 +1570,9 @@ grub_bootp_init (void) +@@ -1118,11 +1853,15 @@ grub_bootp_init (void) cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt, N_("VAR INTERFACE NUMBER DESCRIPTION"), N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value.")); @@ -1125,12 +1129,12 @@ index 4e55adc557b..242cd1f4cbd 100644 } void -@@ -842,4 +1580,5 @@ grub_bootp_fini (void) + grub_bootp_fini (void) { ++ grub_unregister_command (cmd_bootp6); grub_unregister_command (cmd_getdhcp); grub_unregister_command (cmd_bootp); -+ grub_unregister_command (cmd_bootp6); - } + grub_unregister_command (cmd_dhcp); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c index 4444e8e60ee..00d7d37b8de 100644 --- a/grub-core/net/drivers/efi/efinet.c @@ -1170,7 +1174,7 @@ index 4444e8e60ee..00d7d37b8de 100644 } else diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index b2ca74b6eb1..9a4e589aa39 100644 +index a5896f6dc26..ce6bdc75c6d 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c @@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb, @@ -1220,7 +1224,7 @@ index b2ca74b6eb1..9a4e589aa39 100644 { const struct grub_net_bootp_packet *bootp; diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index e5b521bd9be..1250d493e25 100644 +index 955973ed484..71d972a3d89 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1507,7 +1507,7 @@ typedef struct grub_efi_pxe_ip_filter @@ -1233,10 +1237,10 @@ index e5b521bd9be..1250d493e25 100644 } grub_efi_pxe_ip_filter_t; diff --git a/include/grub/net.h b/include/grub/net.h -index f4cd86e582f..5f78b22e109 100644 +index fa7a8c39704..aedf4b59cfe 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -447,50 +447,65 @@ struct grub_net_bootp_packet +@@ -451,50 +451,65 @@ struct grub_net_bootp_packet grub_uint8_t vendor[0]; } GRUB_PACKED; @@ -1332,7 +1336,7 @@ index f4cd86e582f..5f78b22e109 100644 #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 #define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82 -@@ -521,12 +536,12 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -532,12 +547,12 @@ grub_net_configure_by_dhcp_ack (const char *name, int is_def, char **device, char **path); struct grub_net_network_level_interface * @@ -1351,9 +1355,9 @@ index f4cd86e582f..5f78b22e109 100644 int grub_ipv6_get_masksize(grub_uint16_t *mask); -@@ -543,6 +558,10 @@ void +@@ -554,6 +569,10 @@ void grub_net_process_dhcp (struct grub_net_buff *nb, - struct grub_net_card *card); + struct grub_net_network_level_interface *iface); +grub_err_t +grub_net_process_dhcp6 (struct grub_net_buff *nb, diff --git a/0115-efinet-UEFI-IPv6-PXE-support.patch b/0113-efinet-UEFI-IPv6-PXE-support.patch similarity index 99% rename from 0115-efinet-UEFI-IPv6-PXE-support.patch rename to 0113-efinet-UEFI-IPv6-PXE-support.patch index 0c387824..50d680ab 100644 --- a/0115-efinet-UEFI-IPv6-PXE-support.patch +++ b/0113-efinet-UEFI-IPv6-PXE-support.patch @@ -28,7 +28,7 @@ index 00d7d37b8de..c3db3285b97 100644 else { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 1250d493e25..2f164d4209c 100644 +index 71d972a3d89..186cf398840 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1499,31 +1499,6 @@ typedef union diff --git a/0116-grub.texi-Add-net_bootp6-doument.patch b/0114-grub.texi-Add-net_bootp6-doument.patch similarity index 90% rename from 0116-grub.texi-Add-net_bootp6-doument.patch rename to 0114-grub.texi-Add-net_bootp6-doument.patch index b66a80c0..fdca976e 100644 --- a/0116-grub.texi-Add-net_bootp6-doument.patch +++ b/0114-grub.texi-Add-net_bootp6-doument.patch @@ -12,10 +12,10 @@ Signed-off-by: Ken Lin 1 file changed, 17 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 2b7b7faf847..c54bee31679 100644 +index 960e5f3ba41..495462b8e48 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5303,6 +5303,7 @@ This command is only available on AArch64 systems. +@@ -5338,6 +5338,7 @@ This command is only available on AArch64 systems. * net_add_dns:: Add a DNS server * net_add_route:: Add routing entry * net_bootp:: Perform a bootp autoconfiguration @@ -23,7 +23,7 @@ index 2b7b7faf847..c54bee31679 100644 * net_del_addr:: Remove IP address from interface * net_del_dns:: Remove a DNS server * net_del_route:: Remove a route entry -@@ -5384,6 +5385,22 @@ Sets environment variable @samp{net_}@var{}@samp{_dhcp_extensionspath} +@@ -5419,6 +5420,22 @@ Sets environment variable @samp{net_}@var{}@samp{_dhcp_extensionspath} @end deffn diff --git a/0115-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0115-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch new file mode 100644 index 00000000..301e781e --- /dev/null +++ b/0115-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch @@ -0,0 +1,108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Wed, 10 Jul 2019 23:58:28 +0200 +Subject: [PATCH] bootp: Add processing DHCPACK packet from HTTP Boot + +The vendor class identifier with the string "HTTPClient" is used to denote the +packet as responding to HTTP boot request. In DHCP4 config, the filename for +HTTP boot is the URL of the boot file while for PXE boot it is the path to the +boot file. As a consequence, the next-server becomes obseleted because the HTTP +URL already contains the server address for the boot file. For DHCP6 config, +there's no difference definition in existing config as dhcp6.bootfile-url can +be used to specify URL for both HTTP and PXE boot file. + +This patch adds processing for "HTTPClient" vendor class identifier in DHCPACK +packet by treating it as HTTP format, not as the PXE format. + +Signed-off-by: Michael Chang +Signed-off-by: Ken Lin +--- + grub-core/net/bootp.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ + include/grub/net.h | 1 + + 2 files changed, 56 insertions(+) + +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index 85adc9cb447..2e46842e829 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -567,6 +568,60 @@ grub_net_configure_by_dhcp_ack (const char *name, + if (opt && opt_len) + grub_env_set_net_property (name, "rootpath", (const char *) opt, opt_len); + ++ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER, &opt_len); ++ if (opt && opt_len) ++ { ++ grub_env_set_net_property (name, "vendor_class_identifier", (const char *) opt, opt_len); ++ if (opt && grub_strcmp (opt, "HTTPClient") == 0) ++ { ++ char *proto, *ip, *pa; ++ ++ if (!dissect_url (bp->boot_file, &proto, &ip, &pa)) ++ return inter; ++ ++ grub_env_set_net_property (name, "boot_file", pa, grub_strlen (pa)); ++ if (is_def) ++ { ++ grub_net_default_server = grub_strdup (ip); ++ grub_env_set ("net_default_interface", name); ++ grub_env_export ("net_default_interface"); ++ } ++ if (device && !*device) ++ { ++ *device = grub_xasprintf ("%s,%s", proto, ip); ++ grub_print_error (); ++ } ++ if (path) ++ { ++ *path = grub_strdup (pa); ++ grub_print_error (); ++ if (*path) ++ { ++ char *slash; ++ slash = grub_strrchr (*path, '/'); ++ if (slash) ++ *slash = 0; ++ else ++ **path = 0; ++ } ++ } ++ grub_net_add_ipv4_local (inter, mask); ++ inter->dhcp_ack = grub_malloc (size); ++ if (inter->dhcp_ack) ++ { ++ grub_memcpy (inter->dhcp_ack, bp, size); ++ inter->dhcp_acklen = size; ++ } ++ else ++ grub_errno = GRUB_ERR_NONE; ++ ++ grub_free (proto); ++ grub_free (ip); ++ grub_free (pa); ++ return inter; ++ } ++ } ++ + opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_EXTENSIONS_PATH, &opt_len); + if (opt && opt_len) + grub_env_set_net_property (name, "extensionspath", (const char *) opt, opt_len); +diff --git a/include/grub/net.h b/include/grub/net.h +index aedf4b59cfe..ebb569bd86e 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -526,6 +526,7 @@ enum + GRUB_NET_BOOTP_DOMAIN = 0x0f, + GRUB_NET_BOOTP_ROOT_PATH = 0x11, + GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, ++ GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 0x3C, + GRUB_NET_BOOTP_CLIENT_ID = 0x3d, + GRUB_NET_BOOTP_CLIENT_UUID = 0x61, + GRUB_NET_DHCP_REQUESTED_IP_ADDRESS = 50, diff --git a/0118-efinet-Setting-network-from-UEFI-device-path.patch b/0116-efinet-Setting-network-from-UEFI-device-path.patch similarity index 99% rename from 0118-efinet-Setting-network-from-UEFI-device-path.patch rename to 0116-efinet-Setting-network-from-UEFI-device-path.patch index 120f2e9a..f0172953 100644 --- a/0118-efinet-Setting-network-from-UEFI-device-path.patch +++ b/0116-efinet-Setting-network-from-UEFI-device-path.patch @@ -375,7 +375,7 @@ index c3db3285b97..2817b6f8fb9 100644 } } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 2f164d4209c..eb6bb50857c 100644 +index 186cf398840..0d4839a41f1 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -839,6 +839,8 @@ struct grub_efi_ipv4_device_path diff --git a/0117-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0117-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch deleted file mode 100644 index 1874107d..00000000 --- a/0117-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 14 Jul 2016 18:45:14 +0800 -Subject: [PATCH] bootp: Add processing DHCPACK packet from HTTP Boot - -The vendor class identifier with the string "HTTPClient" is used to denote the -packet as responding to HTTP boot request. In DHCP4 config, the filename for -HTTP boot is the URL of the boot file while for PXE boot it is the path to the -boot file. As a consequence, the next-server becomes obseleted because the HTTP -URL already contains the server address for the boot file. For DHCP6 config, -there's no difference definition in existing config as dhcp6.bootfile-url can -be used to specify URL for both HTTP and PXE boot file. - -This patch adds processing for "HTTPClient" vendor class identifier in DHCPACK -packet by treating it as HTTP format, not as the PXE format. - -Signed-off-by: Michael Chang -Signed-off-by: Ken Lin ---- - grub-core/net/bootp.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++-- - include/grub/net.h | 1 + - 2 files changed, 67 insertions(+), 2 deletions(-) - -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 242cd1f4cbd..8b6fc9f2411 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -254,6 +255,11 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) - taglength); - break; - -+ case GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER: -+ grub_env_set_net_property (name, "vendor_class_identifier", (const char *) ptr, -+ taglength); -+ break; -+ - case GRUB_NET_BOOTP_EXTENSIONS_PATH: - grub_env_set_net_property (name, "extensionspath", (const char *) ptr, - taglength); -@@ -357,6 +363,66 @@ grub_net_configure_by_dhcp_ack (const char *name, - } - #endif - -+ if (size > OFFSET_OF (vendor, bp)) -+ { -+ char *cidvar; -+ const char *cid; -+ -+ parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask); -+ cidvar = grub_xasprintf ("net_%s_%s", name, "vendor_class_identifier"); -+ cid = grub_env_get (cidvar); -+ grub_free (cidvar); -+ -+ if (cid && grub_strcmp (cid, "HTTPClient") == 0) -+ { -+ char *proto, *ip, *pa; -+ -+ if (!dissect_url (bp->boot_file, &proto, &ip, &pa)) -+ return inter; -+ -+ grub_env_set_net_property (name, "boot_file", pa, grub_strlen (pa)); -+ if (is_def) -+ { -+ grub_net_default_server = grub_strdup (ip); -+ grub_env_set ("net_default_interface", name); -+ grub_env_export ("net_default_interface"); -+ } -+ if (device && !*device) -+ { -+ *device = grub_xasprintf ("%s,%s", proto, ip); -+ grub_print_error (); -+ } -+ if (path) -+ { -+ *path = grub_strdup (pa); -+ grub_print_error (); -+ if (*path) -+ { -+ char *slash; -+ slash = grub_strrchr (*path, '/'); -+ if (slash) -+ *slash = 0; -+ else -+ **path = 0; -+ } -+ } -+ grub_net_add_ipv4_local (inter, mask); -+ inter->dhcp_ack = grub_malloc (size); -+ if (inter->dhcp_ack) -+ { -+ grub_memcpy (inter->dhcp_ack, bp, size); -+ inter->dhcp_acklen = size; -+ } -+ else -+ grub_errno = GRUB_ERR_NONE; -+ -+ grub_free (proto); -+ grub_free (ip); -+ grub_free (pa); -+ return inter; -+ } -+ } -+ - if (size > OFFSET_OF (boot_file, bp)) - grub_env_set_net_property (name, "boot_file", bp->boot_file, - sizeof (bp->boot_file)); -@@ -421,8 +487,6 @@ grub_net_configure_by_dhcp_ack (const char *name, - **path = 0; - } - } -- if (size > OFFSET_OF (vendor, bp)) -- parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask); - grub_net_add_ipv4_local (inter, mask); - - inter->dhcp_ack = grub_malloc (size); -diff --git a/include/grub/net.h b/include/grub/net.h -index 5f78b22e109..9cf6da68973 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -522,6 +522,7 @@ enum - GRUB_NET_BOOTP_DOMAIN = 0x0f, - GRUB_NET_BOOTP_ROOT_PATH = 0x11, - GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, -+ GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 0x3C, - GRUB_NET_BOOTP_CLIENT_ID = 0x3d, - GRUB_NET_BOOTP_CLIENT_UUID = 0x61, - GRUB_NET_BOOTP_END = 0xff diff --git a/0119-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0117-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 99% rename from 0119-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0117-efinet-Setting-DNS-server-from-UEFI-protocol.patch index b1859376..d79b34a6 100644 --- a/0119-efinet-Setting-DNS-server-from-UEFI-protocol.patch +++ b/0117-efinet-Setting-DNS-server-from-UEFI-protocol.patch @@ -242,7 +242,7 @@ index 2817b6f8fb9..c843654b830 100644 } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index eb6bb50857c..dd3b07eac97 100644 +index 0d4839a41f1..716f121728b 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -334,6 +334,16 @@ @@ -333,5 +333,5 @@ index eb6bb50857c..dd3b07eac97 100644 +typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t; + #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ - || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) - + || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ + || defined(__riscv) diff --git a/0120-Fix-one-more-coverity-complaint.patch b/0118-Fix-one-more-coverity-complaint.patch similarity index 90% rename from 0120-Fix-one-more-coverity-complaint.patch rename to 0118-Fix-one-more-coverity-complaint.patch index ba00fbd1..41f4d0aa 100644 --- a/0120-Fix-one-more-coverity-complaint.patch +++ b/0118-Fix-one-more-coverity-complaint.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/normal/completion.c b/grub-core/normal/completion.c -index 2c9b9e9312a..93aa0d8eda8 100644 +index 596102848c1..c07100a8de3 100644 --- a/grub-core/normal/completion.c +++ b/grub-core/normal/completion.c @@ -284,7 +284,8 @@ complete_file (void) @@ -24,4 +24,4 @@ index 2c9b9e9312a..93aa0d8eda8 100644 + dirfile[1] = '\0'; /* Iterate the directory. */ - (fs->dir) (dev, dir, iterate_dir, NULL); + (fs->fs_dir) (dev, dir, iterate_dir, NULL); diff --git a/0121-Support-UEFI-networking-protocols.patch b/0119-Support-UEFI-networking-protocols.patch similarity index 99% rename from 0121-Support-UEFI-networking-protocols.patch rename to 0119-Support-UEFI-networking-protocols.patch index 6675e2cb..3b0ff4ab 100644 --- a/0121-Support-UEFI-networking-protocols.patch +++ b/0119-Support-UEFI-networking-protocols.patch @@ -57,10 +57,10 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/net/efi.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 3be42a95195..4168ec5d3ff 100644 +index 49c5dc4c3b7..48491b50683 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2182,6 +2182,12 @@ module = { +@@ -2276,6 +2276,12 @@ module = { common = hook/datehook.c; }; @@ -73,7 +73,7 @@ index 3be42a95195..4168ec5d3ff 100644 module = { name = net; common = net/net.c; -@@ -2196,6 +2202,12 @@ module = { +@@ -2290,6 +2296,12 @@ module = { common = net/arp.c; common = net/netbuff.c; common = net/url.c; @@ -87,7 +87,7 @@ index 3be42a95195..4168ec5d3ff 100644 module = { diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c -index dbed6474431..6118bade50d 100644 +index a458c3aca78..1637731535e 100644 --- a/grub-core/io/bufio.c +++ b/grub-core/io/bufio.c @@ -139,7 +139,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len) @@ -100,10 +100,10 @@ index dbed6474431..6118bade50d 100644 if (file->offset + res < next_buf) { diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index a2a732ffc0d..4d36fe31177 100644 +index 19054b1465f..ada3004cfba 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -696,7 +696,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -709,7 +709,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) { grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) dp; @@ -112,7 +112,7 @@ index a2a732ffc0d..4d36fe31177 100644 (unsigned) ipv4->local_ip_address[0], (unsigned) ipv4->local_ip_address[1], (unsigned) ipv4->local_ip_address[2], -@@ -709,33 +709,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -722,33 +722,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) (unsigned) ipv4->remote_port, (unsigned) ipv4->protocol, (unsigned) ipv4->static_ip_address); @@ -190,7 +190,7 @@ index a2a732ffc0d..4d36fe31177 100644 } break; case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE: -@@ -775,6 +802,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -788,6 +815,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) dump_vendor_path ("Messaging", (grub_efi_vendor_device_path_t *) dp); break; @@ -2027,7 +2027,7 @@ index 00000000000..017c4d05bc7 + }; diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c new file mode 100644 -index 00000000000..9e0078ac1c6 +index 00000000000..86bce6535d3 --- /dev/null +++ b/grub-core/net/efi/net.c @@ -0,0 +1,1428 @@ @@ -3324,13 +3324,13 @@ index 00000000000..9e0078ac1c6 +static struct grub_fs grub_efi_netfs = + { + .name = "efi netfs", -+ .dir = grub_efi_netfs_dir, -+ .open = grub_efi_netfs_open, -+ .read = grub_efi_netfs_read, -+ .close = grub_efi_netfs_close, -+ .label = NULL, -+ .uuid = NULL, -+ .mtime = NULL, ++ .fs_dir = grub_efi_netfs_dir, ++ .fs_open = grub_efi_netfs_open, ++ .fs_read = grub_efi_netfs_read, ++ .fs_close = grub_efi_netfs_close, ++ .fs_label = NULL, ++ .fs_uuid = NULL, ++ .fs_mtime = NULL, + }; + +int @@ -3890,7 +3890,7 @@ index 00000000000..531949cba5c + }; + diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 191e8e41bd6..a571ee92efa 100644 +index 2734f70d22f..27a0a1d6961 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -32,6 +32,9 @@ @@ -4000,7 +4000,7 @@ index 191e8e41bd6..a571ee92efa 100644 +#endif } diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c -index 82073d5cc94..ae31271bbc0 100644 +index 602574d52e8..1a61e05c6ec 100644 --- a/util/grub-mknetdir.c +++ b/util/grub-mknetdir.c @@ -32,13 +32,15 @@ @@ -4055,7 +4055,7 @@ index 82073d5cc94..ae31271bbc0 100644 { const char *mkimage_target; const char *netmodule; -@@ -154,6 +159,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) +@@ -156,6 +161,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) grub_install_push_module (targets[platform].netmodule); output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext); @@ -4063,7 +4063,7 @@ index 82073d5cc94..ae31271bbc0 100644 grub_install_make_image_wrap (input_dir, prefix, output, 0, load_cfg, targets[platform].mkimage_target, 0); -@@ -190,7 +196,16 @@ main (int argc, char *argv[]) +@@ -192,7 +198,16 @@ main (int argc, char *argv[]) grub_install_mkdir_p (base); @@ -4082,7 +4082,7 @@ index 82073d5cc94..ae31271bbc0 100644 if (!grub_install_source_directory) { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index dd3b07eac97..b337e1a193d 100644 +index 716f121728b..2ed9c26a450 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -602,6 +602,23 @@ typedef union @@ -4329,8 +4329,8 @@ index dd3b07eac97..b337e1a193d 100644 +typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t; + #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ - || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) - + || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ + || defined(__riscv) diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h new file mode 100644 index 00000000000..fdb88eb810e diff --git a/0122-AUDIT-0-http-boot-tracker-bug.patch b/0120-AUDIT-0-http-boot-tracker-bug.patch similarity index 98% rename from 0122-AUDIT-0-http-boot-tracker-bug.patch rename to 0120-AUDIT-0-http-boot-tracker-bug.patch index 3d8d96b3..78a78e4d 100644 --- a/0122-AUDIT-0-http-boot-tracker-bug.patch +++ b/0120-AUDIT-0-http-boot-tracker-bug.patch @@ -22,7 +22,7 @@ Signed-off-by: Michael Chang 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 9e0078ac1c6..2bf15447fd5 100644 +index 86bce6535d3..4bb308026ce 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -645,8 +645,10 @@ grub_efihttp_chunk_read (grub_file_t file, char *buf, diff --git a/0123-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch b/0121-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch similarity index 100% rename from 0123-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch rename to 0121-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch diff --git a/0124-efi-uga-use-64-bit-for-fb_base.patch b/0122-efi-uga-use-64-bit-for-fb_base.patch similarity index 100% rename from 0124-efi-uga-use-64-bit-for-fb_base.patch rename to 0122-efi-uga-use-64-bit-for-fb_base.patch diff --git a/0125-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch b/0123-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch similarity index 100% rename from 0125-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch rename to 0123-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch diff --git a/0126-EFI-console-Add-grub_console_read_key_stroke-helper-.patch b/0124-EFI-console-Add-grub_console_read_key_stroke-helper-.patch similarity index 100% rename from 0126-EFI-console-Add-grub_console_read_key_stroke-helper-.patch rename to 0124-EFI-console-Add-grub_console_read_key_stroke-helper-.patch diff --git a/0127-EFI-console-Implement-getkeystatus-support.patch b/0125-EFI-console-Implement-getkeystatus-support.patch similarity index 100% rename from 0127-EFI-console-Implement-getkeystatus-support.patch rename to 0125-EFI-console-Implement-getkeystatus-support.patch diff --git a/0128-Make-grub_getkeystatus-helper-funtion-available-ever.patch b/0126-Make-grub_getkeystatus-helper-funtion-available-ever.patch similarity index 100% rename from 0128-Make-grub_getkeystatus-helper-funtion-available-ever.patch rename to 0126-Make-grub_getkeystatus-helper-funtion-available-ever.patch diff --git a/0129-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch b/0127-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch similarity index 98% rename from 0129-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch rename to 0127-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch index 2945fd62..e62a619e 100644 --- a/0129-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch +++ b/0127-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch @@ -68,7 +68,7 @@ index 93bd3378d18..6cae4c23e7a 100644 grub_refresh (void) { diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 5e2f5283d3d..6cb2a071490 100644 +index 783bde55b9e..046a1fb2c84 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -655,7 +655,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) diff --git a/0130-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0128-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 94% rename from 0130-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0128-grub-editenv-Add-incr-command-to-increment-integer-v.patch index d8362740..5da986fa 100644 --- a/0130-grub-editenv-Add-incr-command-to-increment-integer-v.patch +++ b/0128-grub-editenv-Add-incr-command-to-increment-integer-v.patch @@ -17,7 +17,7 @@ Signed-off-by: Hans de Goede 1 file changed, 50 insertions(+) diff --git a/util/grub-editenv.c b/util/grub-editenv.c -index 118e89fe57f..2918bb71cfe 100644 +index f3662c95ba6..d848038abea 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -53,6 +53,9 @@ static struct argp_option options[] = { @@ -30,7 +30,7 @@ index 118e89fe57f..2918bb71cfe 100644 {0, 0, 0, OPTION_DOC, N_("Options:"), -1}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, -@@ -246,6 +249,51 @@ unset_variables (const char *name, int argc, char *argv[]) +@@ -247,6 +250,51 @@ unset_variables (const char *name, int argc, char *argv[]) grub_envblk_close (envblk); } @@ -82,7 +82,7 @@ index 118e89fe57f..2918bb71cfe 100644 int main (int argc, char *argv[]) { -@@ -285,6 +333,8 @@ main (int argc, char *argv[]) +@@ -286,6 +334,8 @@ main (int argc, char *argv[]) set_variables (filename, argc - curindex, argv + curindex); else if (strcmp (command, "unset") == 0) unset_variables (filename, argc - curindex, argv + curindex); diff --git a/0131-Add-auto-hide-menu-support.patch b/0129-Add-auto-hide-menu-support.patch similarity index 98% rename from 0131-Add-auto-hide-menu-support.patch rename to 0129-Add-auto-hide-menu-support.patch index 06ca8da9..0afa74a9 100644 --- a/0131-Add-auto-hide-menu-support.patch +++ b/0129-Add-auto-hide-menu-support.patch @@ -49,10 +49,10 @@ Changes in v2: create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index 4e722ab766b..8b376d6e740 100644 +index c13ca685ce1..026b458bb85 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -448,6 +448,12 @@ script = { +@@ -457,6 +457,12 @@ script = { installdir = grubconf; }; diff --git a/0132-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch b/0130-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch similarity index 97% rename from 0132-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch rename to 0130-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch index b0215a40..e461de9b 100644 --- a/0132-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch +++ b/0130-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch @@ -24,10 +24,10 @@ Signed-off-by: Hans de Goede create mode 100644 util/grub.d/30_uefi-firmware.in diff --git a/Makefile.util.def b/Makefile.util.def -index 8b376d6e740..56bf1159a42 100644 +index 026b458bb85..89a9da1b9f7 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -536,6 +536,12 @@ script = { +@@ -545,6 +545,12 @@ script = { installdir = grubconf; }; diff --git a/0133-Add-grub-set-bootflag-utility.patch b/0131-Add-grub-set-bootflag-utility.patch similarity index 93% rename from 0133-Add-grub-set-bootflag-utility.patch rename to 0131-Add-grub-set-bootflag-utility.patch index 2b4174e9..d5fd2628 100644 --- a/0133-Add-grub-set-bootflag-utility.patch +++ b/0131-Add-grub-set-bootflag-utility.patch @@ -34,23 +34,22 @@ Signed-off-by: Hans de Goede --- Makefile.util.def | 7 ++ util/grub-set-bootflag.c | 160 +++++++++++++++++++++++++++++++++++++++++ - .gitignore | 2 + conf/Makefile.extra-dist | 3 + docs/grub-boot-success.service | 6 ++ docs/grub-boot-success.timer | 6 ++ util/grub-set-bootflag.1 | 20 ++++++ - 7 files changed, 204 insertions(+) + 6 files changed, 202 insertions(+) create mode 100644 util/grub-set-bootflag.c create mode 100644 docs/grub-boot-success.service create mode 100644 docs/grub-boot-success.timer create mode 100644 util/grub-set-bootflag.1 diff --git a/Makefile.util.def b/Makefile.util.def -index 56bf1159a42..08cc98ddb8b 100644 +index 89a9da1b9f7..125ad6209b2 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1442,3 +1442,10 @@ program = { - ldadd = grub-core/gnulib/libgnu.a; +@@ -1451,3 +1451,10 @@ program = { + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; + @@ -226,21 +225,8 @@ index 00000000000..bb198f02351 + + return 0; +} -diff --git a/.gitignore b/.gitignore -index 7aaae594d51..a999024652e 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -111,6 +111,8 @@ grub-*.tar.* - /grub*-rpm-sort.8 - /grub*-script-check - /grub*-script-check.1 -+/grub*-set-bootflag -+/grub*-set-bootflag.1 - /grub*-set-default - /grub*-set-default.8 - /grub*-set-password diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 39eb94bded6..5946ec24a65 100644 +index 58d7d9540be..375b1bf9b02 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -14,6 +14,9 @@ EXTRA_DIST += util/import_unicode.py diff --git a/0134-docs-Add-grub-boot-indeterminate.service-example.patch b/0132-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0134-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0132-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0135-gentpl-add-disable-support.patch b/0133-gentpl-add-disable-support.patch similarity index 89% rename from 0135-gentpl-add-disable-support.patch rename to 0133-gentpl-add-disable-support.patch index d82d6331..90308d88 100644 --- a/0135-gentpl-add-disable-support.patch +++ b/0133-gentpl-add-disable-support.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gentpl.py b/gentpl.py -index bf8439fa743..a8cd540550f 100644 +index f05812eace3..3a0c04963aa 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -589,11 +589,21 @@ def platform_conditional(platform, closure): +@@ -592,11 +592,21 @@ def platform_conditional(platform, closure): # }; # def foreach_enabled_platform(defn, closure): @@ -35,7 +35,7 @@ index bf8439fa743..a8cd540550f 100644 for platform in GRUB_PLATFORMS: platform_conditional(platform, closure) -@@ -652,6 +662,8 @@ def first_time(defn, snippet): +@@ -655,6 +665,8 @@ def first_time(defn, snippet): def is_platform_independent(defn): if 'enable' in defn: return False diff --git a/0136-gentpl-add-pc-firmware-type.patch b/0134-gentpl-add-pc-firmware-type.patch similarity index 68% rename from 0136-gentpl-add-pc-firmware-type.patch rename to 0134-gentpl-add-pc-firmware-type.patch index 94737b3b..9f0fd473 100644 --- a/0136-gentpl-add-pc-firmware-type.patch +++ b/0134-gentpl-add-pc-firmware-type.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Wed, 11 Jul 2018 13:43:34 -0400 +Date: Thu, 11 Jul 2019 11:04:24 +0200 Subject: [PATCH] gentpl: add 'pc' firmware type Signed-off-by: Peter Jones @@ -9,14 +9,14 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+) diff --git a/gentpl.py b/gentpl.py -index a8cd540550f..baac6a2af69 100644 +index 3a0c04963aa..1d9dda430e7 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -49,6 +49,7 @@ GROUPS["arm"] = [ "arm_uboot", "arm_efi", "arm_coreboot" ] - GROUPS["arm64"] = [ "arm64_efi" ] +@@ -51,6 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ] + GROUPS["riscv64"] = [ "riscv64_efi" ] # Groups based on firmware +GROUPS["pc"] = [ "i386_pc" ] - GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi" ] + GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi", + "riscv32_efi", "riscv64_efi" ] GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] - GROUPS["uboot"] = [ "arm_uboot" ] diff --git a/0137-efinet-also-use-the-firmware-acceleration-for-http.patch b/0135-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 96% rename from 0137-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0135-efinet-also-use-the-firmware-acceleration-for-http.patch index 5771c8a5..915b5aa1 100644 --- a/0137-efinet-also-use-the-firmware-acceleration-for-http.patch +++ b/0135-efinet-also-use-the-firmware-acceleration-for-http.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 2bf15447fd5..f208d1b180c 100644 +index 4bb308026ce..6603cd83edc 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -1324,7 +1324,9 @@ grub_efi_net_boot_from_https (void) diff --git a/0138-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0136-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0138-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0136-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0142-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0137-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 95% rename from 0142-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0137-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index 292e5658..403412ba 100644 --- a/0142-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0137-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index 9ab683fefac..819212095ff 100644 +index 8ee18ba159a..cf327482e8a 100644 --- a/configure.ac +++ b/configure.ac -@@ -850,11 +850,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p +@@ -868,11 +868,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" fi @@ -45,7 +45,7 @@ index 9ab683fefac..819212095ff 100644 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ grub_cv_target_cc_soft_float=no if test "x$target_cpu" = xarm64; then -@@ -1939,6 +1951,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +@@ -1951,6 +1963,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" @@ -88,7 +88,7 @@ index 9ab683fefac..819212095ff 100644 GRUB_PLATFORM="${platform}" diff --git a/conf/Makefile.common b/conf/Makefile.common -index 1ecb921db65..b93879804c0 100644 +index 5e8ba2ae3b0..bbf33b0bc4a 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 @@ -129,10 +129,10 @@ index 1ecb921db65..b93879804c0 100644 # Other variables diff --git a/gentpl.py b/gentpl.py -index 6409736e81c..1e4635f4426 100644 +index 1d9dda430e7..95fe1a24d8a 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -694,10 +694,10 @@ def module(defn, platform): +@@ -697,10 +697,10 @@ def module(defn, platform): var_set(cname(defn) + "_SOURCES", platform_sources(defn, platform) + " ## platform sources") var_set("nodist_" + cname(defn) + "_SOURCES", platform_nodist_sources(defn, platform) + " ## platform nodist sources") var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform)) diff --git a/0143-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0138-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 98% rename from 0143-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0138-module-verifier-make-it-possible-to-run-checkers-on-.patch index 0bdfca1e..e31b38f6 100644 --- a/0143-module-verifier-make-it-possible-to-run-checkers-on-.patch +++ b/0138-module-verifier-make-it-possible-to-run-checkers-on-.patch @@ -40,7 +40,7 @@ index 4db6b4bedd1..fc23ef800b3 100644 #include "grub-module-verifierXX.c" +#endif diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c -index 1feaafc9b9e..597ded14362 100644 +index ceb24309aec..a98e2f9b1ac 100644 --- a/util/grub-module-verifierXX.c +++ b/util/grub-module-verifierXX.c @@ -1,3 +1,12 @@ diff --git a/0139-Force-everything-to-use-python3.patch b/0139-Force-everything-to-use-python3.patch deleted file mode 100644 index b4b0d74c..00000000 --- a/0139-Force-everything-to-use-python3.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 10 Jul 2018 16:54:02 -0400 -Subject: [PATCH] Force everything to use python3 - -But this still means you need to do PYTHON=python=3 ./autogen.sh if you -run the world's worst tooling before you patch. - -Signed-off-by: Peter Jones ---- - conf/Makefile.common | 4 ++-- - gentpl.py | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/conf/Makefile.common b/conf/Makefile.common -index c75848f5c06..1ecb921db65 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -128,11 +128,11 @@ BUILT_SOURCES = - - .PRECIOUS: $(top_srcdir)/Makefile.util.am - $(top_srcdir)/Makefile.util.am: $(top_srcdir)/gentpl.py $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def -- python $^ > $@.new || (rm -f $@.new; exit 1) -+ python3 $^ > $@.new || (rm -f $@.new; exit 1) - mv $@.new $@ - - .PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am - $(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/gentpl.py $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def - if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi -- python $^ > $@.new || (rm -f $@.new; exit 1) -+ python3 $^ > $@.new || (rm -f $@.new; exit 1) - mv $@.new $@ -diff --git a/gentpl.py b/gentpl.py -index baac6a2af69..6409736e81c 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -1,4 +1,4 @@ --#! /usr/bin/python -+#! /usr/bin/env python3 - # GRUB -- GRand Unified Bootloader - # Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc. - # diff --git a/0145-Rework-how-the-fdt-command-builds.patch b/0139-Rework-how-the-fdt-command-builds.patch similarity index 86% rename from 0145-Rework-how-the-fdt-command-builds.patch rename to 0139-Rework-how-the-fdt-command-builds.patch index 34b2d3c8..9936858c 100644 --- a/0145-Rework-how-the-fdt-command-builds.patch +++ b/0139-Rework-how-the-fdt-command-builds.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Thu, 12 Jul 2018 11:00:45 -0400 +Date: Thu, 11 Jul 2019 13:01:41 +0200 Subject: [PATCH] Rework how the fdt command builds. Trying to avoid all variants of: @@ -22,10 +22,10 @@ Signed-off-by: Peter Jones 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 4168ec5d3ff..144734e39e1 100644 +index 48491b50683..556adca7074 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -165,7 +165,6 @@ kernel = { +@@ -175,7 +175,6 @@ kernel = { arm_coreboot = kern/arm/coreboot/init.c; arm_coreboot = kern/arm/coreboot/timer.c; arm_coreboot = kern/arm/coreboot/coreboot.S; @@ -33,24 +33,24 @@ index 4168ec5d3ff..144734e39e1 100644 arm_coreboot = bus/fdt.c; arm_coreboot = term/ps2.c; arm_coreboot = term/arm/pl050.c; -@@ -315,6 +314,8 @@ kernel = { - arm64 = kern/arm64/dl.c; - arm64 = kern/arm64/dl_helper.c; +@@ -348,6 +347,8 @@ kernel = { + riscv64 = kern/riscv/cache_flush.S; + riscv64 = kern/riscv/dl.c; + fdt = lib/fdt.c; + emu = disk/host.c; emu = kern/emu/cache_s.S; emu = kern/emu/hostdisk.c; -@@ -1713,7 +1714,6 @@ module = { - arm_uboot = loader/arm/linux.c; - arm64 = loader/arm64/linux.c; +@@ -1801,7 +1802,6 @@ module = { + riscv32 = loader/riscv/linux.c; + riscv64 = loader/riscv/linux.c; emu = loader/emu/linux.c; - fdt = lib/fdt.c; common = loader/linux.c; common = lib/cmdline.c; -@@ -1724,7 +1724,6 @@ module = { +@@ -1812,7 +1812,6 @@ module = { module = { name = fdt; efi = loader/efi/fdt.c; @@ -72,7 +72,7 @@ index 0d371c5633e..37e04bd69e7 100644 #define FDT_BEGIN_NODE 0x00000001 diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c -index a4c6e803645..a9dbcfdfeaf 100644 +index ee9c5592c70..37ca407bb36 100644 --- a/grub-core/loader/efi/fdt.c +++ b/grub-core/loader/efi/fdt.c @@ -26,6 +26,8 @@ @@ -85,7 +85,7 @@ index a4c6e803645..a9dbcfdfeaf 100644 static void *fdt; diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index 158b1bc4b3a..6ee57e11ab3 100644 +index e609c7e4111..22b7c5463fc 100644 --- a/include/grub/fdt.h +++ b/include/grub/fdt.h @@ -19,6 +19,8 @@ @@ -97,7 +97,7 @@ index 158b1bc4b3a..6ee57e11ab3 100644 #include #include -@@ -141,4 +143,6 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch +@@ -144,4 +146,6 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16); \ }) @@ -105,7 +105,7 @@ index 158b1bc4b3a..6ee57e11ab3 100644 + #endif /* ! GRUB_FDT_HEADER */ diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 3781bb9cbb9..4062652506d 100644 +index d9ad30052f1..ee9c4e4eb88 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h diff --git a/0146-Disable-non-wordsize-allocations-on-arm.patch b/0140-Disable-non-wordsize-allocations-on-arm.patch similarity index 93% rename from 0146-Disable-non-wordsize-allocations-on-arm.patch rename to 0140-Disable-non-wordsize-allocations-on-arm.patch index 5c627a37..64da8e67 100644 --- a/0146-Disable-non-wordsize-allocations-on-arm.patch +++ b/0140-Disable-non-wordsize-allocations-on-arm.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index 819212095ff..9323c125469 100644 +index cf327482e8a..9b0946c27bf 100644 --- a/configure.ac +++ b/configure.ac -@@ -1234,6 +1234,26 @@ if test "x$target_cpu" = xarm; then +@@ -1262,6 +1262,26 @@ if test "x$target_cpu" = xarm; then done ]) diff --git a/0140-Fix-an-8-year-old-typo.patch b/0140-Fix-an-8-year-old-typo.patch deleted file mode 100644 index 642e46a7..00000000 --- a/0140-Fix-an-8-year-old-typo.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 26 Jul 2018 14:54:44 -0400 -Subject: [PATCH] Fix an 8 year old typo. - -Signed-off-by: Peter Jones ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 5f47a9265f3..9ab683fefac 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -307,7 +307,7 @@ fi - - AC_SUBST(bootdirname) - AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname", -- [Default boot directory name]") -+ [Default boot directory name]) - - AC_ARG_WITH([grubdir], - AS_HELP_STRING([--with-grubdir=DIR], diff --git a/0141-autogen-don-t-run-autoreconf-in-the-topdir.patch b/0141-autogen-don-t-run-autoreconf-in-the-topdir.patch deleted file mode 100644 index e5b7c33d..00000000 --- a/0141-autogen-don-t-run-autoreconf-in-the-topdir.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 26 Jul 2018 15:47:48 -0400 -Subject: [PATCH] autogen: don't run autoreconf in the topdir - -Signed-off-by: Peter Jones ---- - autogen.sh | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/autogen.sh b/autogen.sh -index 7537561ad0d..f608b9467a0 100755 ---- a/autogen.sh -+++ b/autogen.sh -@@ -82,6 +82,4 @@ done - echo "Saving timestamps..." - echo timestamp > stamp-h.in - --echo "Running autoreconf..." --autoreconf -vi - exit 0 diff --git a/0147-strip-R-.note.gnu.property-at-more-places.patch b/0141-strip-R-.note.gnu.property-at-more-places.patch similarity index 96% rename from 0147-strip-R-.note.gnu.property-at-more-places.patch rename to 0141-strip-R-.note.gnu.property-at-more-places.patch index 0bd0be09..d5684227 100644 --- a/0147-strip-R-.note.gnu.property-at-more-places.patch +++ b/0141-strip-R-.note.gnu.property-at-more-places.patch @@ -55,7 +55,7 @@ Signed-off-by: Peter Jones 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am -index c7b0e6a9c46..287fff66b20 100644 +index bf9c1ba64c9..0d4dd7c2e90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -209,7 +209,7 @@ pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub- @@ -68,10 +68,10 @@ index c7b0e6a9c46..287fff66b20 100644 ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0 -m32 diff --git a/gentpl.py b/gentpl.py -index 1e4635f4426..d662c305f66 100644 +index 95fe1a24d8a..32cf7456b72 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -776,7 +776,7 @@ def image(defn, platform): +@@ -779,7 +779,7 @@ def image(defn, platform): if test x$(TARGET_APPLE_LINKER) = x1; then \ $(MACHO2IMG) $< $@; \ else \ diff --git a/0148-Prepend-prefix-when-HTTP-path-is-relative.patch b/0142-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 100% rename from 0148-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0142-Prepend-prefix-when-HTTP-path-is-relative.patch diff --git a/0149-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch b/0143-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch similarity index 98% rename from 0149-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch rename to 0143-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch index e0becd6e..a3c32139 100644 --- a/0149-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch +++ b/0143-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch @@ -57,7 +57,7 @@ index 0622dfa48d4..b56ea0bc041 100644 return GRUB_ERR_BUG; diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index 5900fc8a40c..bed308f22cb 100644 +index 775297db869..b582f67f661 100644 --- a/include/grub/arm/linux.h +++ b/include/grub/arm/linux.h @@ -31,7 +31,7 @@ struct linux_arm_kernel_header { diff --git a/0150-Make-grub_error-more-verbose.patch b/0144-Make-grub_error-more-verbose.patch similarity index 96% rename from 0150-Make-grub_error-more-verbose.patch rename to 0144-Make-grub_error-more-verbose.patch index 6fffdeb7..ec4a3ebc 100644 --- a/0150-Make-grub_error-more-verbose.patch +++ b/0144-Make-grub_error-more-verbose.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 5cdf6c943f2..7692e63ba24 100644 +index a9e37108c6d..15595a46e23 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -157,12 +157,20 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, @@ -81,10 +81,10 @@ index 53c734de70e..aebfe0cf839 100644 return n; diff --git a/include/grub/err.h b/include/grub/err.h -index 1590c688e1d..9b830757d35 100644 +index 24ba9f5f592..b68bbec3c72 100644 --- a/include/grub/err.h +++ b/include/grub/err.h -@@ -84,7 +84,10 @@ struct grub_error_saved +@@ -85,7 +85,10 @@ struct grub_error_saved extern grub_err_t EXPORT_VAR(grub_errno); extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG]; diff --git a/0144-grub-module-verifier-report-the-filename-or-modname-.patch b/0144-grub-module-verifier-report-the-filename-or-modname-.patch deleted file mode 100644 index c27d0654..00000000 --- a/0144-grub-module-verifier-report-the-filename-or-modname-.patch +++ /dev/null @@ -1,250 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 1 Aug 2018 10:12:47 -0400 -Subject: [PATCH] grub-module-verifier: report the filename or modname in - errors. - -Make it so that when grub-module-verifier complains of an issue, it tells you -which module the issue was with. - -Signed-off-by: Peter Jones ---- - util/grub-module-verifier.c | 6 ++--- - util/grub-module-verifierXX.c | 58 ++++++++++++++++++++++-------------------- - include/grub/module_verifier.h | 4 +-- - 3 files changed, 36 insertions(+), 32 deletions(-) - -diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c -index a79271f6631..03ba1ab437a 100644 ---- a/util/grub-module-verifier.c -+++ b/util/grub-module-verifier.c -@@ -157,7 +157,7 @@ main (int argc, char **argv) - if (strcmp(archs[arch].name, argv[2]) == 0) - break; - if (arch == ARRAY_SIZE(archs)) -- grub_util_error("unknown arch: %s", argv[2]); -+ grub_util_error("%s: unknown arch: %s", argv[1], argv[2]); - - for (whitelist = 0; whitelist < ARRAY_SIZE(whitelists); whitelist++) - if (strcmp(whitelists[whitelist].arch, argv[2]) == 0 -@@ -169,8 +169,8 @@ main (int argc, char **argv) - module_size = grub_util_get_image_size (argv[1]); - module_img = grub_util_read_image (argv[1]); - if (archs[arch].voidp_sizeof == 8) -- grub_module_verify64(module_img, module_size, &archs[arch], whitelist_empty); -+ grub_module_verify64(argv[1], module_img, module_size, &archs[arch], whitelist_empty); - else -- grub_module_verify32(module_img, module_size, &archs[arch], whitelist_empty); -+ grub_module_verify32(argv[1], module_img, module_size, &archs[arch], whitelist_empty); - return 0; - } -diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c -index 597ded14362..a98e2f9b1ac 100644 ---- a/util/grub-module-verifierXX.c -+++ b/util/grub-module-verifierXX.c -@@ -160,14 +160,15 @@ find_section (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e, const c - } - - static void --check_license (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e) -+check_license (const char * const filename, -+ const struct grub_module_verifier_arch *arch, Elf_Ehdr *e) - { - Elf_Shdr *s = find_section (arch, e, ".module_license"); - if (s && (strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv3") == 0 - || strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv3+") == 0 - || strcmp ((char *) e + grub_target_to_host(s->sh_offset), "LICENSE=GPLv2+") == 0)) - return; -- grub_util_error ("incompatible license"); -+ grub_util_error ("%s: incompatible license", filename); - } - - static Elf_Sym * -@@ -233,10 +234,10 @@ check_symbols (const struct grub_module_verifier_arch *arch, - s = find_section (arch, e, ".moddeps"); - - if (!s) -- grub_util_error ("no symbol table and no .moddeps section"); -+ grub_util_error ("%s: no symbol table and no .moddeps section", modname); - - if (!s->sh_size) -- grub_util_error ("no symbol table and empty .moddeps section"); -+ grub_util_error ("%s: no symbol table and empty .moddeps section", modname); - - return; - } -@@ -257,7 +258,7 @@ check_symbols (const struct grub_module_verifier_arch *arch, - break; - - default: -- return grub_util_error ("unknown symbol type `%d'", (int) type); -+ return grub_util_error ("%s: unknown symbol type `%d'", modname, (int) type); - } - } - } -@@ -283,7 +284,8 @@ is_symbol_local(Elf_Sym *sym) - } - - static void --section_check_relocations (const struct grub_module_verifier_arch *arch, void *ehdr, -+section_check_relocations (const char * const modname, -+ const struct grub_module_verifier_arch *arch, void *ehdr, - Elf_Shdr *s, size_t target_seg_size) - { - Elf_Rel *rel, *max; -@@ -292,7 +294,7 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e - - symtab = get_symtab (arch, ehdr, &symtabsize, &symtabentsize); - if (!symtab) -- grub_util_error ("relocation without symbol table"); -+ grub_util_error ("%s: relocation without symbol table", modname); - - for (rel = (Elf_Rel *) ((char *) ehdr + grub_target_to_host (s->sh_offset)), - max = (Elf_Rel *) ((char *) rel + grub_target_to_host (s->sh_size)); -@@ -303,7 +305,7 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e - unsigned i; - - if (target_seg_size < grub_target_to_host (rel->r_offset)) -- grub_util_error ("reloc offset is out of the segment"); -+ grub_util_error ("%s: reloc offset is out of the segment", modname); - - grub_uint32_t type = ELF_R_TYPE (grub_target_to_host (rel->r_info)); - -@@ -316,17 +318,17 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e - if (arch->supported_relocations[i] != -1) - continue; - if (!arch->short_relocations) -- grub_util_error ("unsupported relocation 0x%x", type); -+ grub_util_error ("%s: unsupported relocation 0x%x", modname, type); - for (i = 0; arch->short_relocations[i] != -1; i++) - if (type == arch->short_relocations[i]) - break; - if (arch->short_relocations[i] == -1) -- grub_util_error ("unsupported relocation 0x%x", type); -+ grub_util_error ("%s: unsupported relocation 0x%x", modname, type); - sym = (Elf_Sym *) ((char *) symtab + symtabentsize * ELF_R_SYM (grub_target_to_host (rel->r_info))); - - if (is_symbol_local (sym)) - continue; -- grub_util_error ("relocation 0x%x is not module-local", type); -+ grub_util_error ("%s: relocation 0x%x is not module-local", modname, type); - } - #if defined(MODULEVERIFIER_ELF64) - if (arch->machine == EM_AARCH64) -@@ -351,11 +353,11 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e - && ELF_R_TYPE (rel2->r_info) == R_AARCH64_LD64_GOT_LO12_NC) - break; - if (rel2 >= (Elf_Rela *) max) -- grub_util_error ("ADR_GOT_PAGE without matching LD64_GOT_LO12_NC"); -+ grub_util_error ("%s: ADR_GOT_PAGE without matching LD64_GOT_LO12_NC", modname); - break; - case R_AARCH64_LD64_GOT_LO12_NC: - if (unmatched_adr_got_page == 0) -- grub_util_error ("LD64_GOT_LO12_NC without matching ADR_GOT_PAGE"); -+ grub_util_error ("%s: LD64_GOT_LO12_NC without matching ADR_GOT_PAGE", modname); - unmatched_adr_got_page--; - break; - } -@@ -365,7 +367,8 @@ section_check_relocations (const struct grub_module_verifier_arch *arch, void *e - } - - static void --check_relocations (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e) -+check_relocations (const char * const modname, -+ const struct grub_module_verifier_arch *arch, Elf_Ehdr *e) - { - Elf_Shdr *s; - unsigned i; -@@ -378,21 +381,22 @@ check_relocations (const struct grub_module_verifier_arch *arch, Elf_Ehdr *e) - Elf_Shdr *ts; - - if (grub_target_to_host32 (s->sh_type) == SHT_REL && !(arch->flags & GRUB_MODULE_VERIFY_SUPPORTS_REL)) -- grub_util_error ("unsupported SHT_REL"); -+ grub_util_error ("%s: unsupported SHT_REL", modname); - if (grub_target_to_host32 (s->sh_type) == SHT_RELA && !(arch->flags & GRUB_MODULE_VERIFY_SUPPORTS_RELA)) -- grub_util_error ("unsupported SHT_RELA"); -+ grub_util_error ("%s: unsupported SHT_RELA", modname); - - /* Find the target segment. */ - if (grub_target_to_host32 (s->sh_info) >= grub_target_to_host16 (e->e_shnum)) -- grub_util_error ("orphaned reloc section"); -+ grub_util_error ("%s: orphaned reloc section", modname); - ts = (Elf_Shdr *) ((char *) e + grub_target_to_host (e->e_shoff) + grub_target_to_host32 (s->sh_info) * grub_target_to_host16 (e->e_shentsize)); - -- section_check_relocations (arch, e, s, grub_target_to_host (ts->sh_size)); -+ section_check_relocations (modname, arch, e, s, grub_target_to_host (ts->sh_size)); - } - } - - void --SUFFIX(grub_module_verify) (void *module_img, size_t size, -+SUFFIX(grub_module_verify) (const char * const filename, -+ void *module_img, size_t size, - const struct grub_module_verifier_arch *arch, - const char **whitelist_empty) - { -@@ -400,7 +404,7 @@ SUFFIX(grub_module_verify) (void *module_img, size_t size, - - /* Check the header size. */ - if (size < sizeof (Elf_Ehdr)) -- grub_util_error ("ELF header smaller than expected"); -+ grub_util_error ("%s: ELF header smaller than expected", filename); - - /* Check the magic numbers. */ - if (e->e_ident[EI_MAG0] != ELFMAG0 -@@ -409,36 +413,36 @@ SUFFIX(grub_module_verify) (void *module_img, size_t size, - || e->e_ident[EI_MAG3] != ELFMAG3 - || e->e_ident[EI_VERSION] != EV_CURRENT - || grub_target_to_host32 (e->e_version) != EV_CURRENT) -- grub_util_error ("invalid arch-independent ELF magic"); -+ grub_util_error ("%s: invalid arch-independent ELF magic", filename); - - if (e->e_ident[EI_CLASS] != ELFCLASSXX - || e->e_ident[EI_DATA] != (arch->bigendian ? ELFDATA2MSB : ELFDATA2LSB) - || grub_target_to_host16 (e->e_machine) != arch->machine) -- grub_util_error ("invalid arch-dependent ELF magic"); -+ grub_util_error ("%s: invalid arch-dependent ELF magic", filename); - - if (grub_target_to_host16 (e->e_type) != ET_REL) - { -- grub_util_error ("this ELF file is not of the right type"); -+ grub_util_error ("%s: this ELF file is not of the right type", filename); - } - - /* Make sure that every section is within the core. */ - if (size < grub_target_to_host (e->e_shoff) - + (grub_uint32_t) grub_target_to_host16 (e->e_shentsize) * grub_target_to_host16(e->e_shnum)) - { -- grub_util_error ("ELF sections outside core"); -+ grub_util_error ("%s: ELF sections outside core", filename); - } - -- check_license (arch, e); -+ check_license (filename, arch, e); - - Elf_Shdr *s; - const char *modname; - - s = find_section (arch, e, ".modname"); - if (!s) -- grub_util_error ("no module name found"); -+ grub_util_error ("%s: no module name found", filename); - - modname = (const char *) e + grub_target_to_host (s->sh_offset); - - check_symbols(arch, e, modname, whitelist_empty); -- check_relocations(arch, e); -+ check_relocations(modname, arch, e); - } -diff --git a/include/grub/module_verifier.h b/include/grub/module_verifier.h -index f4870cb9c2d..ba21c75e2eb 100644 ---- a/include/grub/module_verifier.h -+++ b/include/grub/module_verifier.h -@@ -16,5 +16,5 @@ struct grub_module_verifier_arch { - const int *short_relocations; - }; - --void grub_module_verify64(void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty); --void grub_module_verify32(void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty); -+void grub_module_verify64(const char * const filename, void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty); -+void grub_module_verify32(const char * const filename, void *module_img, size_t module_size, const struct grub_module_verifier_arch *arch, const char **whitelist_empty); diff --git a/0151-Make-reset-an-alias-for-the-reboot-command.patch b/0145-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0151-Make-reset-an-alias-for-the-reboot-command.patch rename to 0145-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0152-EFI-more-debug-output-on-GOP-and-UGA-probing.patch b/0146-EFI-more-debug-output-on-GOP-and-UGA-probing.patch similarity index 100% rename from 0152-EFI-more-debug-output-on-GOP-and-UGA-probing.patch rename to 0146-EFI-more-debug-output-on-GOP-and-UGA-probing.patch diff --git a/0153-Add-a-version-command.patch b/0147-Add-a-version-command.patch similarity index 96% rename from 0153-Add-a-version-command.patch rename to 0147-Add-a-version-command.patch index 47da68f0..f08559b4 100644 --- a/0153-Add-a-version-command.patch +++ b/0147-Add-a-version-command.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index 9323c125469..61c4683cb76 100644 +index 9b0946c27bf..bca7c2818af 100644 --- a/configure.ac +++ b/configure.ac -@@ -287,6 +287,19 @@ AC_SUBST(target_cpu) +@@ -303,6 +303,19 @@ AC_SUBST(target_cpu) AC_SUBST(platform) # Define default variables @@ -41,10 +41,10 @@ index 9323c125469..61c4683cb76 100644 have_with_bootdir=n AC_ARG_WITH([bootdir], diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 144734e39e1..59ead422028 100644 +index 556adca7074..8bb1dafd0ac 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -535,6 +535,11 @@ image = { +@@ -576,6 +576,11 @@ image = { enable = mips_loongson; }; diff --git a/0154-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0148-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 94% rename from 0154-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0148-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch index a86e6da7..ac8ed7fb 100644 --- a/0154-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +++ b/0148-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 4 files changed, 10 insertions(+) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 6f901c0adf7..66f6b992604 100644 +index c3b578acf25..1a3eb6b8d77 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter) @@ -33,10 +33,10 @@ index 6f901c0adf7..66f6b992604 100644 if (!pv->disk) return grub_errno; diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index 5d2400f66f2..4bc51877f04 100644 +index 9e20af70ee0..54c227b1c84 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c -@@ -846,6 +846,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) +@@ -855,6 +855,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) return 0; } diff --git a/0155-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0149-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 85% rename from 0155-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0149-arm-arm64-loader-Better-memory-allocation-and-error-.patch index 3cf7d154..c912d24c 100644 --- a/0155-arm-arm64-loader-Better-memory-allocation-and-error-.patch +++ b/0149-arm-arm64-loader-Better-memory-allocation-and-error-.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Tue, 14 Aug 2018 14:07:44 -0400 +Date: Thu, 11 Jul 2019 14:38:57 +0200 Subject: [PATCH] arm/arm64 loader: Better memory allocation and error messages. @@ -54,16 +54,8 @@ MMIO 0000000010548000-0000000010549fff 00000002 8KiB RT MMIO 0000000017000000-0000000017001fff 00000002 8KiB RT MMIO 000000001c025000-000000001c025fff 00000001 4KiB RT -When we're trying to find the base of ram, if we start with GRUB_UINT_MAX -(0xffffffff on all platforms) and always use min(), that means we eventually -decide that the base of ram is GRUB_UINT_MAX, which is lower than our first -memory address, and thus our allocation of the initramfs, which specifies this -value as the maximum possible address it can be at, fails. - -This patch changes it to start at GRUB_EFI_MAX_USABLE_ADDRESS, which is always -at least 0xffffffff on 32-bit platforms and at least 0x7ffffffffffffff on -64-bit platforms. Additionally, this adds a requirement that the memory we -choose is actually /allocatable/ conventional memory, not merely +This patch adds a requirement when we're trying to find the base of ram, that +the memory we choose is actually /allocatable/ conventional memory, not merely write-combining. On this machine that means we wind up with an allocation around 0x4392XXXXXX, which is a reasonable address. @@ -74,12 +66,12 @@ per-platform constraints on its given address are maintained. Signed-off-by: Peter Jones --- - grub-core/kern/efi/mm.c | 35 ++++++++++++++----- + grub-core/kern/efi/mm.c | 33 +++++++++++++----- grub-core/loader/arm64/linux.c | 78 ++++++++++++++++++++++++++++++++---------- - 2 files changed, 85 insertions(+), 28 deletions(-) + 2 files changed, 84 insertions(+), 27 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 7692e63ba24..2c41a528f27 100644 +index 15595a46e23..1b14fa0694c 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, @@ -129,27 +121,23 @@ index 7692e63ba24..2c41a528f27 100644 } void * -@@ -696,11 +700,24 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) - if (ret < 1) - return GRUB_ERR_BUG; - -- for (desc = memory_map, *base_addr = GRUB_UINT_MAX; -+ for (desc = memory_map, *base_addr = GRUB_EFI_MAX_USABLE_ADDRESS; +@@ -699,8 +703,21 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) + for (desc = memory_map, *base_addr = GRUB_EFI_MAX_USABLE_ADDRESS; (grub_addr_t) desc < ((grub_addr_t) memory_map + memory_map_size); desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) - if (desc->attribute & GRUB_EFI_MEMORY_WB) - *base_addr = grub_min (*base_addr, desc->physical_start); + { + if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY && -+ (desc->attribute & GRUB_EFI_MEMORY_WB)) -+ { -+ *base_addr = grub_min (*base_addr, desc->physical_start); -+ grub_dprintf ("efi", "setting base_addr=0x%016lx\n", *base_addr); -+ } ++ (desc->attribute & GRUB_EFI_MEMORY_WB)) ++ { ++ *base_addr = grub_min (*base_addr, desc->physical_start); ++ grub_dprintf ("efi", "setting base_addr=0x%016lx\n", *base_addr); ++ } + else -+ { -+ grub_dprintf ("efi", "ignoring address 0x%016lx\n", desc->physical_start); -+ } ++ { ++ grub_dprintf ("efi", "ignoring address 0x%016lx\n", desc->physical_start); ++ } + } + + if (*base_addr == GRUB_EFI_MAX_USABLE_ADDRESS) @@ -158,10 +146,10 @@ index 7692e63ba24..2c41a528f27 100644 grub_free(memory_map); diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 93b5cd306eb..e1110749eb9 100644 +index 4c0a09c06de..8791b35b6fe 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c -@@ -70,13 +70,15 @@ finalize_params_linux (void) +@@ -71,13 +71,15 @@ finalize_params_linux (void) { grub_efi_loaded_image_t *loaded_image = NULL; int node, retval, len; @@ -169,7 +157,7 @@ index 93b5cd306eb..e1110749eb9 100644 + grub_err_t err = GRUB_ERR_NONE; void *fdt; - fdt = grub_fdt_load (0x400); + fdt = grub_fdt_load (GRUB_EFI_LINUX_FDT_EXTRA_SPACE); - if (!fdt) - goto failure; @@ -180,7 +168,7 @@ index 93b5cd306eb..e1110749eb9 100644 node = grub_fdt_find_subnode (fdt, 0, "chosen"); if (node < 0) -@@ -87,17 +89,26 @@ finalize_params_linux (void) +@@ -88,17 +90,26 @@ finalize_params_linux (void) */ retval = grub_fdt_set_prop32(fdt, 0, "#address-cells", 2); if (retval) @@ -210,7 +198,7 @@ index 93b5cd306eb..e1110749eb9 100644 /* Set initrd info */ if (initrd_start && initrd_end > initrd_start) -@@ -108,15 +119,26 @@ finalize_params_linux (void) +@@ -109,15 +120,26 @@ finalize_params_linux (void) retval = grub_fdt_set_prop64 (fdt, node, "linux,initrd-start", initrd_start); if (retval) @@ -240,8 +228,8 @@ index 93b5cd306eb..e1110749eb9 100644 + } grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n", - fdt); -@@ -124,14 +146,20 @@ finalize_params_linux (void) + fdt); +@@ -125,14 +147,20 @@ finalize_params_linux (void) /* Convert command line to UCS-2 */ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); if (!loaded_image) @@ -264,7 +252,7 @@ index 93b5cd306eb..e1110749eb9 100644 loaded_image->load_options_size = 2 * grub_utf8_to_utf16 (loaded_image->load_options, len, -@@ -141,7 +169,7 @@ finalize_params_linux (void) +@@ -142,7 +170,7 @@ finalize_params_linux (void) failure: grub_fdt_unload(); @@ -273,7 +261,7 @@ index 93b5cd306eb..e1110749eb9 100644 } static void -@@ -225,16 +253,28 @@ grub_linux_unload (void) +@@ -226,16 +254,28 @@ grub_linux_unload (void) static void * allocate_initrd_mem (int initrd_pages) { diff --git a/0156-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0150-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 94% rename from 0156-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0150-Try-to-pick-better-locations-for-kernel-and-initrd.patch index 6ae19816..25ad6498 100644 --- a/0156-Try-to-pick-better-locations-for-kernel-and-initrd.patch +++ b/0150-Try-to-pick-better-locations-for-kernel-and-initrd.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Mon, 27 Aug 2018 14:31:37 -0400 +Date: Thu, 11 Jul 2019 17:17:02 +0200 Subject: [PATCH] Try to pick better locations for kernel and initrd - Don't limit allocations on 64-bit platforms to < 0x[37f]fffffff if @@ -34,7 +34,7 @@ Signed-off-by: Peter Jones 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 2c41a528f27..cac775fc935 100644 +index 1b14fa0694c..d70e5b45b7c 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, @@ -68,18 +68,18 @@ index 2c41a528f27..cac775fc935 100644 #endif diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index ea9f5134e67..851bce77f12 100644 +index 3017d0f3e52..33e981e76e7 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -28,6 +28,7 @@ +@@ -27,6 +27,7 @@ + #include #include #include - #include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -108,7 +109,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -106,7 +107,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), size += ALIGN_UP (grub_file_size (files[i]), 4); } @@ -90,7 +90,7 @@ index ea9f5134e67..851bce77f12 100644 if (!initrd_mem) { grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd")); -@@ -209,8 +212,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -202,8 +205,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -103,7 +103,7 @@ index ea9f5134e67..851bce77f12 100644 if (! params) { grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters"); -@@ -280,8 +286,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -273,8 +279,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), #endif grub_dprintf ("linux", "setting up cmdline\n"); @@ -117,7 +117,7 @@ index ea9f5134e67..851bce77f12 100644 if (!linux_cmdline) { grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline")); -@@ -307,11 +316,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -301,11 +310,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), kernel_mem = grub_efi_allocate_pages_max(lh->pref_address, BYTES_TO_PAGES(lh->init_size)); diff --git a/0151-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0151-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch new file mode 100644 index 00000000..db05a0f9 --- /dev/null +++ b/0151-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -0,0 +1,396 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 11 Jul 2019 18:03:25 +0200 +Subject: [PATCH] Attempt to fix up all the places -Wsign-compare=error finds. + +Signed-off-by: Peter Jones +--- + grub-core/kern/emu/misc.c | 2 +- + grub-core/lib/reed_solomon.c | 4 +- + grub-core/osdep/linux/blocklist.c | 2 +- + grub-core/osdep/linux/getroot.c | 2 +- + grub-core/osdep/linux/hostdisk.c | 2 +- + util/grub-fstest.c | 2 +- + util/grub-menulst2cfg.c | 2 +- + util/grub-mkfont.c | 13 +- + util/grub-probe.c | 2 +- + util/grub-rpm-sort.c | 2 +- + util/setup.c | 2 +- + bootstrap.conf | 2 +- + .../gnulib-patches/fix-sign-compare-errors.patch | 161 +++++++++++++++++++++ + 13 files changed, 180 insertions(+), 18 deletions(-) + create mode 100644 grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch + +diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c +index 245b69cab51..7a8d9e62300 100644 +--- a/grub-core/kern/emu/misc.c ++++ b/grub-core/kern/emu/misc.c +@@ -177,7 +177,7 @@ grub_util_get_image_size (const char *path) + sz = ftello (f); + if (sz < 0) + grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); +- if (sz != (size_t) sz) ++ if (sz > (off_t)(GRUB_SIZE_MAX >> 1)) + grub_util_error (_("file `%s' is too big"), path); + ret = (size_t) sz; + +diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c +index ee9fa7b4feb..19c20085279 100644 +--- a/grub-core/lib/reed_solomon.c ++++ b/grub-core/lib/reed_solomon.c +@@ -156,7 +156,7 @@ static void + rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs) + { + gf_single_t *rs_polynomial; +- int i, j; ++ unsigned int i, j; + gf_single_t *m; + m = xmalloc ((s + rs) * sizeof (gf_single_t)); + grub_memcpy (m, data, s * sizeof (gf_single_t)); +@@ -325,7 +325,7 @@ static void + encode_block (gf_single_t *ptr, grub_size_t s, + gf_single_t *rptr, grub_size_t rs) + { +- int i, j; ++ unsigned int i, j; + for (i = 0; i < SECTOR_SIZE; i++) + { + grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE; +diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c +index c77d6085ccb..42a315031ff 100644 +--- a/grub-core/osdep/linux/blocklist.c ++++ b/grub-core/osdep/linux/blocklist.c +@@ -109,7 +109,7 @@ grub_install_get_blocklist (grub_device_t root_dev, + else + { + struct fiemap *fie2; +- int i; ++ unsigned int i; + fie2 = xmalloc (sizeof (*fie2) + + fie1.fm_mapped_extents + * sizeof (fie1.fm_extents[1])); +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index 4c5a13022dc..2b7a626d5ea 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -236,7 +236,7 @@ grub_find_root_devices_from_btrfs (const char *dir) + { + int fd; + struct btrfs_ioctl_fs_info_args fsi; +- int i, j = 0; ++ unsigned int i, j = 0; + char **ret; + + fd = open (dir, 0); +diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c +index 8b92f8528f9..370d02787cd 100644 +--- a/grub-core/osdep/linux/hostdisk.c ++++ b/grub-core/osdep/linux/hostdisk.c +@@ -83,7 +83,7 @@ grub_util_get_fd_size_os (grub_util_fd_t fd, const char *name, unsigned *log_sec + if (sector_size & (sector_size - 1) || !sector_size) + return -1; + for (log_sector_size = 0; +- (1 << log_sector_size) < sector_size; ++ (1U << log_sector_size) < sector_size; + log_sector_size++); + + if (log_secsize) +diff --git a/util/grub-fstest.c b/util/grub-fstest.c +index f14e02d9727..88f9c5d4ad8 100644 +--- a/util/grub-fstest.c ++++ b/util/grub-fstest.c +@@ -323,7 +323,7 @@ cmd_cmp (char *src, char *dest) + read_file (src, cmp_hook, ff); + + { +- grub_uint64_t pre; ++ long long pre; + pre = ftell (ff); + fseek (ff, 0, SEEK_END); + if (pre != ftell (ff)) +diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c +index a39f8693947..358d604210b 100644 +--- a/util/grub-menulst2cfg.c ++++ b/util/grub-menulst2cfg.c +@@ -34,7 +34,7 @@ main (int argc, char **argv) + char *buf = NULL; + size_t bufsize = 0; + char *suffix = xstrdup (""); +- int suffixlen = 0; ++ size_t suffixlen = 0; + const char *out_fname = 0; + + grub_util_host_init (&argc, &argv); +diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c +index 0fe45a6103d..3e09240b99f 100644 +--- a/util/grub-mkfont.c ++++ b/util/grub-mkfont.c +@@ -138,7 +138,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, + int width, height; + int cuttop, cutbottom, cutleft, cutright; + grub_uint8_t *data; +- int mask, i, j, bitmap_size; ++ int mask, i, bitmap_size; ++ unsigned int j; + FT_GlyphSlot glyph; + int flag = FT_LOAD_RENDER | FT_LOAD_MONOCHROME; + FT_Error err; +@@ -183,7 +184,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, + cuttop = cutbottom = cutleft = cutright = 0; + else + { +- for (cuttop = 0; cuttop < glyph->bitmap.rows; cuttop++) ++ for (cuttop = 0; cuttop < (long)glyph->bitmap.rows; cuttop++) + { + for (j = 0; j < glyph->bitmap.width; j++) + if (glyph->bitmap.buffer[j / 8 + cuttop * glyph->bitmap.pitch] +@@ -203,10 +204,10 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, + break; + } + cutbottom = glyph->bitmap.rows - 1 - cutbottom; +- if (cutbottom + cuttop >= glyph->bitmap.rows) ++ if (cutbottom + cuttop >= (long)glyph->bitmap.rows) + cutbottom = 0; + +- for (cutleft = 0; cutleft < glyph->bitmap.width; cutleft++) ++ for (cutleft = 0; cutleft < (long)glyph->bitmap.width; cutleft++) + { + for (j = 0; j < glyph->bitmap.rows; j++) + if (glyph->bitmap.buffer[cutleft / 8 + j * glyph->bitmap.pitch] +@@ -225,7 +226,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, + break; + } + cutright = glyph->bitmap.width - 1 - cutright; +- if (cutright + cutleft >= glyph->bitmap.width) ++ if (cutright + cutleft >= (long)glyph->bitmap.width) + cutright = 0; + } + +@@ -262,7 +263,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, + + mask = 0; + data = &glyph_info->bitmap[0] - 1; +- for (j = cuttop; j < height + cuttop; j++) ++ for (j = cuttop; j < (long)height + cuttop; j++) + for (i = cutleft; i < width + cutleft; i++) + add_pixel (&data, &mask, + glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] & +diff --git a/util/grub-probe.c b/util/grub-probe.c +index 81d27eead59..7481e487211 100644 +--- a/util/grub-probe.c ++++ b/util/grub-probe.c +@@ -798,7 +798,7 @@ argp_parser (int key, char *arg, struct argp_state *state) + + case 't': + { +- int i; ++ unsigned int i; + + for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) + if (strcmp (arg, targets[i]) == 0) +diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c +index f33bd1ed568..8345944105f 100644 +--- a/util/grub-rpm-sort.c ++++ b/util/grub-rpm-sort.c +@@ -232,7 +232,7 @@ main (int argc, char *argv[]) + struct arguments arguments; + char **package_names = NULL; + size_t n_package_names = 0; +- int i; ++ unsigned int i; + + grub_util_host_init (&argc, &argv); + +diff --git a/util/setup.c b/util/setup.c +index 6f88f3cc43f..864094de682 100644 +--- a/util/setup.c ++++ b/util/setup.c +@@ -402,7 +402,7 @@ SETUP (const char *dir, + int is_ldm; + grub_err_t err; + grub_disk_addr_t *sectors; +- int i; ++ unsigned int i; + grub_fs_t fs; + unsigned int nsec, maxsec; + +diff --git a/bootstrap.conf b/bootstrap.conf +index 988dda099ac..8804d5beb89 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -78,7 +78,7 @@ cp -a INSTALL INSTALL.grub + + bootstrap_post_import_hook () { + set -e +- for patchname in fix-null-deref fix-width no-abort; do ++ for patchname in fix-null-deref fix-width no-abort fix-sign-compare-errors; do + patch -d grub-core/lib/gnulib -p2 \ + < "grub-core/lib/gnulib-patches/$patchname.patch" + done +diff --git a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch b/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch +new file mode 100644 +index 00000000000..479029c0565 +--- /dev/null ++++ b/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch +@@ -0,0 +1,161 @@ ++diff --git a/lib/regcomp.c b/lib/regcomp.c ++index cc85f35ac58..361079d82d6 100644 ++--- a/lib/regcomp.c +++++ b/lib/regcomp.c ++@@ -322,7 +322,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, ++ *p++ = dfa->nodes[node].opr.c; ++ memset (&state, '\0', sizeof (state)); ++ if (__mbrtowc (&wc, (const char *) buf, p - buf, ++- &state) == p - buf +++ &state) == (size_t)(p - buf) ++ && (__wcrtomb ((char *) buf, __towlower (wc), &state) ++ != (size_t) -1)) ++ re_set_fastmap (fastmap, false, buf[0]); ++@@ -3778,7 +3778,7 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) ++ num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2) ++ ? -2 ++ : num == -1 ++- ? c - '0' +++ ? (Idx)(c - '0') ++ : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); ++ } ++ return num; ++diff --git a/lib/regex_internal.c b/lib/regex_internal.c ++index 9004ce809eb..193a1e3d332 100644 ++--- a/lib/regex_internal.c +++++ b/lib/regex_internal.c ++@@ -233,7 +233,7 @@ build_wcs_buffer (re_string_t *pstr) ++ /* Apply the translation if we need. */ ++ if (__glibc_unlikely (pstr->trans != NULL)) ++ { ++- int i, ch; +++ unsigned int i, ch; ++ ++ for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) ++ { ++@@ -376,7 +376,7 @@ build_wcs_upper_buffer (re_string_t *pstr) ++ prev_st = pstr->cur_state; ++ if (__glibc_unlikely (pstr->trans != NULL)) ++ { ++- int i, ch; +++ unsigned int i, ch; ++ ++ for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) ++ { ++@@ -754,7 +754,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) ++ memset (&cur_state, 0, sizeof (cur_state)); ++ mbclen = __mbrtowc (&wc2, (const char *) pp, mlen, ++ &cur_state); ++- if (raw + offset - p <= mbclen +++ if ((size_t)(raw + offset - p) <= mbclen ++ && mbclen < (size_t) -2) ++ { ++ memset (&pstr->cur_state, '\0', ++diff --git a/lib/regex_internal.h b/lib/regex_internal.h ++index 5462419b787..e0f8292395d 100644 ++--- a/lib/regex_internal.h +++++ b/lib/regex_internal.h ++@@ -425,7 +425,7 @@ struct re_string_t ++ unsigned char offsets_needed; ++ unsigned char newline_anchor; ++ unsigned char word_ops_used; ++- int mb_cur_max; +++ unsigned int mb_cur_max; ++ }; ++ typedef struct re_string_t re_string_t; ++ ++@@ -702,7 +702,7 @@ struct re_dfa_t ++ unsigned int is_utf8 : 1; ++ unsigned int map_notascii : 1; ++ unsigned int word_ops_used : 1; ++- int mb_cur_max; +++ unsigned int mb_cur_max; ++ bitset_t word_char; ++ reg_syntax_t syntax; ++ Idx *subexp_map; ++diff --git a/lib/regexec.c b/lib/regexec.c ++index 0a7a27b772e..b57d4f9141d 100644 ++--- a/lib/regexec.c +++++ b/lib/regexec.c ++@@ -443,7 +443,7 @@ re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, ++ { ++ if (ret_len) ++ { ++- assert (pmatch[0].rm_so == start); +++ assert (pmatch[0].rm_so == (long)start); ++ rval = pmatch[0].rm_eo - start; ++ } ++ else ++@@ -877,11 +877,11 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, ++ if (__glibc_unlikely (mctx.input.offsets_needed != 0)) ++ { ++ pmatch[reg_idx].rm_so = ++- (pmatch[reg_idx].rm_so == mctx.input.valid_len +++ (pmatch[reg_idx].rm_so == (long)mctx.input.valid_len ++ ? mctx.input.valid_raw_len ++ : mctx.input.offsets[pmatch[reg_idx].rm_so]); ++ pmatch[reg_idx].rm_eo = ++- (pmatch[reg_idx].rm_eo == mctx.input.valid_len +++ (pmatch[reg_idx].rm_eo == (long)mctx.input.valid_len ++ ? mctx.input.valid_raw_len ++ : mctx.input.offsets[pmatch[reg_idx].rm_eo]); ++ } ++@@ -1418,11 +1418,11 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, ++ } ++ memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); ++ ++- for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) +++ for (idx = pmatch[0].rm_so; idx <= (long)pmatch[0].rm_eo ;) ++ { ++ update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); ++ ++- if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) +++ if (idx == (long)pmatch[0].rm_eo && cur_node == mctx->last_node) ++ { ++ Idx reg_idx; ++ if (fs) ++@@ -1519,7 +1519,7 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, ++ if (reg_num < nmatch) ++ { ++ /* We are at the last node of this sub expression. */ ++- if (pmatch[reg_num].rm_so < cur_idx) +++ if (pmatch[reg_num].rm_so < (long)cur_idx) ++ { ++ pmatch[reg_num].rm_eo = cur_idx; ++ /* This is a non-empty match or we are not inside an optional ++@@ -2938,7 +2938,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, ++ mctx->state_log[str_idx] = cur_state; ++ } ++ ++- for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;) +++ for (null_cnt = 0; str_idx < last_str && null_cnt <= (long)mctx->max_mb_elem_len;) ++ { ++ re_node_set_empty (&next_nodes); ++ if (mctx->state_log[str_idx + 1]) ++@@ -3718,7 +3718,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, ++ const re_string_t *input, Idx str_idx) ++ { ++ const re_token_t *node = dfa->nodes + node_idx; ++- int char_len, elem_len; +++ unsigned int char_len, elem_len; ++ Idx i; ++ ++ if (__glibc_unlikely (node->type == OP_UTF8_PERIOD)) ++@@ -4066,7 +4066,7 @@ extend_buffers (re_match_context_t *mctx, int min_len) ++ /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ ++ ret = re_string_realloc_buffers (pstr, ++ MAX (min_len, ++- MIN (pstr->len, pstr->bufs_len * 2))); +++ MIN ((long)pstr->len, pstr->bufs_len * 2))); ++ if (__glibc_unlikely (ret != REG_NOERROR)) ++ return ret; ++ ++@@ -4236,7 +4236,7 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, ++ = (from == to ? -1 : 0); ++ ++ mctx->bkref_ents[mctx->nbkref_ents++].more = 0; ++- if (mctx->max_mb_elem_len < to - from) +++ if (mctx->max_mb_elem_len < (long)(to - from)) ++ mctx->max_mb_elem_len = to - from; ++ return REG_NOERROR; ++ } diff --git a/0158-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0152-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 85% rename from 0158-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0152-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index dae1ea5e..b2e5de04 100644 --- a/0158-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0152-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Tue, 11 Sep 2018 15:59:39 -0400 +Date: Thu, 11 Jul 2019 18:20:37 +0200 Subject: [PATCH] Don't use -Wno-sign-compare -Wno-conversion -Wno-error, do use -Wextra. @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index 61c4683cb76..40fcf567ae7 100644 +index bca7c2818af..38d978bd650 100644 --- a/configure.ac +++ b/configure.ac -@@ -1396,11 +1396,11 @@ fi +@@ -1424,11 +1424,11 @@ fi # Set them to their new values for the tests below. CC="$TARGET_CC" if test x"$platform" = xemu ; then @@ -29,7 +29,7 @@ index 61c4683cb76..40fcf567ae7 100644 fi CPPFLAGS="$TARGET_CPPFLAGS" -@@ -1975,6 +1975,14 @@ if test x"$enable_werror" != xno ; then +@@ -1987,6 +1987,14 @@ if test x"$enable_werror" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Werror" fi @@ -45,7 +45,7 @@ index 61c4683cb76..40fcf567ae7 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index b93879804c0..0d9910d7875 100644 +index bbf33b0bc4a..b867691f125 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d @@ -54,6 +54,6 @@ index b93879804c0..0d9910d7875 100644 -CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion +CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code - CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib + CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib CFLAGS_POSIX = -fno-builtin diff --git a/0159-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0153-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 88% rename from 0159-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0153-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch index 7e2d2a6e..fdd30965 100644 --- a/0159-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +++ b/0153-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Fri, 14 Sep 2018 13:34:55 -0400 +Date: Fri, 12 Jul 2019 09:53:32 +0200 Subject: [PATCH] x86-efi: Use bounce buffers for reading to addresses > 4GB Lots of machines apparently can't DMA correctly above 4GB during UEFI, @@ -12,10 +12,10 @@ Signed-off-by: Peter Jones 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 851bce77f12..06d19b9fc0e 100644 +index 33e981e76e7..2f0336809e7 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -36,11 +36,16 @@ static grub_dl_t my_mod; +@@ -35,11 +35,16 @@ static grub_dl_t my_mod; static int loaded; static void *kernel_mem; static grub_uint64_t kernel_size; @@ -33,7 +33,7 @@ index 851bce77f12..06d19b9fc0e 100644 #define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12) static grub_err_t -@@ -74,6 +79,44 @@ grub_linuxefi_unload (void) +@@ -73,6 +78,44 @@ grub_linuxefi_unload (void) return GRUB_ERR_NONE; } @@ -78,7 +78,7 @@ index 851bce77f12..06d19b9fc0e 100644 static grub_err_t grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) -@@ -128,7 +171,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -126,7 +169,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), for (i = 0; i < nfiles; i++) { grub_ssize_t cursize = grub_file_size (files[i]); @@ -87,12 +87,12 @@ index 851bce77f12..06d19b9fc0e 100644 { if (!grub_errno) grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"), -@@ -156,11 +199,6 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -152,11 +195,6 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), return grub_errno; } -#define MIN(a, b) \ -- ({ typeof (a) _a = (a); \ +- ({ typeof (a) _a = (a); \ - typeof (b) _b = (b); \ - _a < _b ? _a : _b; }) - diff --git a/0160-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0154-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 94% rename from 0160-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0154-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch index 6fb194fe..f8284ec2 100644 --- a/0160-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +++ b/0154-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 06d19b9fc0e..de5f839ff0f 100644 +index 2f0336809e7..5f48fa55619 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -250,32 +250,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -243,32 +243,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -49,7 +49,7 @@ index 06d19b9fc0e..de5f839ff0f 100644 grub_dprintf ("linux", "checking lh->boot_flag\n"); if (lh->boot_flag != grub_cpu_to_le16 (0xaa55)) { -@@ -323,6 +300,34 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -316,6 +293,34 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } #endif @@ -84,7 +84,7 @@ index 06d19b9fc0e..de5f839ff0f 100644 grub_dprintf ("linux", "setting up cmdline\n"); linux_cmdline = grub_efi_allocate_pages_max(GRUB_EFI_MAX_ALLOCATION_ADDRESS, BYTES_TO_PAGES(lh->cmdline_size + 1)); -@@ -347,8 +352,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -341,8 +346,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "setting lh->cmd_line_ptr\n"); lh->cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; @@ -94,7 +94,7 @@ index 06d19b9fc0e..de5f839ff0f 100644 start = (lh->setup_sects + 1) * 512; -@@ -365,26 +370,28 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -359,26 +364,28 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel")); goto fail; } diff --git a/0161-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0155-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 93% rename from 0161-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0155-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch index eadc4a5f..3bfb4829 100644 --- a/0161-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +++ b/0155-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 1 file changed, 94 insertions(+), 73 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index de5f839ff0f..1811f4b3d56 100644 +index 5f48fa55619..075b77eb3e4 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -48,6 +48,65 @@ static char *linux_cmdline; +@@ -47,6 +47,65 @@ static char *linux_cmdline; #define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12) @@ -80,7 +80,7 @@ index de5f839ff0f..1811f4b3d56 100644 static grub_err_t grub_linuxefi_boot (void) { -@@ -63,19 +122,12 @@ grub_linuxefi_unload (void) +@@ -62,19 +121,12 @@ grub_linuxefi_unload (void) { grub_dl_unref (my_mod); loaded = 0; @@ -106,7 +106,7 @@ index de5f839ff0f..1811f4b3d56 100644 return GRUB_ERR_NONE; } -@@ -152,19 +204,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -150,19 +202,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), size += ALIGN_UP (grub_file_size (files[i]), 4); } @@ -131,7 +131,7 @@ index de5f839ff0f..1811f4b3d56 100644 ptr = initrd_mem; -@@ -225,7 +271,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -221,7 +267,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), filelen = grub_file_size (file); kernel = grub_malloc(filelen); @@ -139,7 +139,7 @@ index de5f839ff0f..1811f4b3d56 100644 if (!kernel) { grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer")); -@@ -281,7 +326,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -274,7 +319,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -148,7 +148,7 @@ index de5f839ff0f..1811f4b3d56 100644 grub_dprintf ("linux", "checking lh->xloadflags\n"); if (!(lh->xloadflags & LINUX_XLF_KERNEL_64)) { -@@ -300,17 +345,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -293,17 +338,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } #endif @@ -168,7 +168,7 @@ index de5f839ff0f..1811f4b3d56 100644 grub_dprintf ("linux", "params = %p\n", params); grub_memset (params, 0, sizeof(*params)); -@@ -329,19 +366,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -322,19 +359,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "new lh is at %p\n", lh); grub_dprintf ("linux", "setting up cmdline\n"); @@ -191,8 +191,8 @@ index de5f839ff0f..1811f4b3d56 100644 grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); grub_create_loader_cmdline (argc, argv, -@@ -349,27 +377,24 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1)); +@@ -343,27 +371,24 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + GRUB_VERIFY_KERNEL_CMDLINE); grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline); - grub_dprintf ("linux", "setting lh->cmd_line_ptr\n"); @@ -230,7 +230,7 @@ index de5f839ff0f..1811f4b3d56 100644 grub_dprintf("linux", "kernel_mem = %p\n", kernel_mem); grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0); -@@ -404,18 +429,14 @@ fail: +@@ -398,18 +423,14 @@ fail: loaded = 0; } diff --git a/0162-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 91% rename from 0162-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch index 95f8f471..f545a060 100644 --- a/0162-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +++ b/0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch @@ -14,10 +14,10 @@ Signed-off-by: Peter Jones 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 1811f4b3d56..65d1b5cc034 100644 +index 075b77eb3e4..50b7798d6e5 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -53,13 +53,22 @@ struct allocation_choice { +@@ -52,13 +52,22 @@ struct allocation_choice { grub_efi_allocate_type_t alloc_type; }; @@ -41,7 +41,7 @@ index 1811f4b3d56..65d1b5cc034 100644 static inline void kernel_free(void *addr, grub_efi_uintn_t size) -@@ -81,6 +90,11 @@ kernel_alloc(grub_efi_uintn_t size, const char * const errmsg) +@@ -80,6 +89,11 @@ kernel_alloc(grub_efi_uintn_t size, const char * const errmsg) grub_uint64_t max = max_addresses[i].addr; grub_efi_uintn_t pages; @@ -53,7 +53,7 @@ index 1811f4b3d56..65d1b5cc034 100644 if (max == prev_max) continue; -@@ -169,6 +183,9 @@ read(grub_file_t file, grub_uint8_t *bufp, grub_size_t len) +@@ -168,6 +182,9 @@ read(grub_file_t file, grub_uint8_t *bufp, grub_size_t len) return bufpos; } @@ -63,7 +63,7 @@ index 1811f4b3d56..65d1b5cc034 100644 static grub_err_t grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) -@@ -209,8 +226,12 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -207,8 +224,12 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), goto fail; grub_dprintf ("linux", "initrd_mem = %p\n", initrd_mem); @@ -78,7 +78,7 @@ index 1811f4b3d56..65d1b5cc034 100644 ptr = initrd_mem; -@@ -345,6 +366,18 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -338,6 +359,18 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } #endif @@ -97,7 +97,7 @@ index 1811f4b3d56..65d1b5cc034 100644 params = kernel_alloc (sizeof(*params), "cannot allocate kernel parameters"); if (!params) goto fail; -@@ -378,21 +411,40 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -372,21 +405,40 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline); grub_dprintf ("linux", "setting lh->cmd_line_ptr to 0x%08x\n", @@ -140,7 +140,7 @@ index 1811f4b3d56..65d1b5cc034 100644 if (!kernel_mem) goto fail; grub_dprintf("linux", "kernel_mem = %p\n", kernel_mem); -@@ -401,8 +453,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -395,8 +447,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), loaded = 1; @@ -153,10 +153,10 @@ index 1811f4b3d56..65d1b5cc034 100644 grub_memcpy (kernel_mem, (char *)kernel + start, filelen - start); diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index 8474a857ed2..a4b37dcced5 100644 +index a093679cb80..91123b1eb5c 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h -@@ -230,7 +230,11 @@ struct linux_kernel_params +@@ -234,7 +234,11 @@ struct linux_kernel_params grub_uint32_t ofw_cif_handler; /* b8 */ grub_uint32_t ofw_idt; /* bc */ diff --git a/0157-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0157-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch deleted file mode 100644 index fc0af799..00000000 --- a/0157-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ /dev/null @@ -1,392 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 11 Sep 2018 16:41:30 -0400 -Subject: [PATCH] Attempt to fix up all the places -Wsign-compare=error finds. - -Signed-off-by: Peter Jones ---- - grub-core/gnulib/regcomp.c | 4 ++-- - grub-core/gnulib/regex_internal.c | 6 +++--- - grub-core/gnulib/regexec.c | 20 ++++++++++---------- - grub-core/kern/emu/misc.c | 2 +- - grub-core/lib/reed_solomon.c | 4 ++-- - grub-core/osdep/linux/blocklist.c | 2 +- - grub-core/osdep/linux/getroot.c | 2 +- - grub-core/osdep/linux/hostdisk.c | 2 +- - util/grub-fstest.c | 2 +- - util/grub-menulst2cfg.c | 2 +- - util/grub-mkfont.c | 13 +++++++------ - util/grub-probe.c | 2 +- - util/grub-rpm-sort.c | 2 +- - util/setup.c | 2 +- - grub-core/gnulib/regex.h | 2 +- - grub-core/gnulib/regex_internal.h | 4 ++-- - 16 files changed, 36 insertions(+), 35 deletions(-) - -diff --git a/grub-core/gnulib/regcomp.c b/grub-core/gnulib/regcomp.c -index 596e0cf3ef7..e0ebd8d497a 100644 ---- a/grub-core/gnulib/regcomp.c -+++ b/grub-core/gnulib/regcomp.c -@@ -334,7 +334,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, - *p++ = dfa->nodes[node].opr.c; - memset (&state, '\0', sizeof (state)); - if (__mbrtowc (&wc, (const char *) buf, p - buf, -- &state) == p - buf -+ &state) == (size_t)(p - buf) - && (__wcrtomb ((char *) buf, towlower (wc), &state) - != (size_t) -1)) - re_set_fastmap (fastmap, false, buf[0]); -@@ -3760,7 +3760,7 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) - || num == REG_ERROR) - ? REG_ERROR - : num == REG_MISSING -- ? c - '0' -+ ? (Idx)(c - '0') - : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); - } - return num; -diff --git a/grub-core/gnulib/regex_internal.c b/grub-core/gnulib/regex_internal.c -index 899b0ae67e1..836ea5d0ca7 100644 ---- a/grub-core/gnulib/regex_internal.c -+++ b/grub-core/gnulib/regex_internal.c -@@ -224,7 +224,7 @@ build_wcs_buffer (re_string_t *pstr) - /* Apply the translation if we need. */ - if (BE (pstr->trans != NULL, 0)) - { -- int i, ch; -+ unsigned int i, ch; - - for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) - { -@@ -367,7 +367,7 @@ build_wcs_upper_buffer (re_string_t *pstr) - prev_st = pstr->cur_state; - if (BE (pstr->trans != NULL, 0)) - { -- int i, ch; -+ unsigned int i, ch; - - for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) - { -@@ -751,7 +751,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) - memset (&cur_state, 0, sizeof (cur_state)); - mbclen = __mbrtowc (&wc2, (const char *) pp, mlen, - &cur_state); -- if (raw + offset - p <= mbclen -+ if ((size_t)(raw + offset - p) <= mbclen - && mbclen < (size_t) -2) - { - memset (&pstr->cur_state, '\0', -diff --git a/grub-core/gnulib/regexec.c b/grub-core/gnulib/regexec.c -index a7776f088f2..402a85c9c6a 100644 ---- a/grub-core/gnulib/regexec.c -+++ b/grub-core/gnulib/regexec.c -@@ -490,7 +490,7 @@ re_search_stub (struct re_pattern_buffer *bufp, - { - if (ret_len) - { -- assert (pmatch[0].rm_so == start); -+ assert (pmatch[0].rm_so == (long)start); - rval = pmatch[0].rm_eo - start; - } - else -@@ -928,11 +928,11 @@ re_search_internal (const regex_t *preg, - if (BE (mctx.input.offsets_needed != 0, 0)) - { - pmatch[reg_idx].rm_so = -- (pmatch[reg_idx].rm_so == mctx.input.valid_len -+ (pmatch[reg_idx].rm_so == (long)mctx.input.valid_len - ? mctx.input.valid_raw_len - : mctx.input.offsets[pmatch[reg_idx].rm_so]); - pmatch[reg_idx].rm_eo = -- (pmatch[reg_idx].rm_eo == mctx.input.valid_len -+ (pmatch[reg_idx].rm_eo == (long)mctx.input.valid_len - ? mctx.input.valid_raw_len - : mctx.input.offsets[pmatch[reg_idx].rm_eo]); - } -@@ -1472,11 +1472,11 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, - } - memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); - -- for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) -+ for (idx = pmatch[0].rm_so; idx <= (long)pmatch[0].rm_eo ;) - { - update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); - -- if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) -+ if (idx == (long)pmatch[0].rm_eo && cur_node == mctx->last_node) - { - Idx reg_idx; - if (fs) -@@ -1575,7 +1575,7 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, - if (reg_num < nmatch) - { - /* We are at the last node of this sub expression. */ -- if (pmatch[reg_num].rm_so < cur_idx) -+ if (pmatch[reg_num].rm_so < (long)cur_idx) - { - pmatch[reg_num].rm_eo = cur_idx; - /* This is a non-empty match or we are not inside an optional -@@ -3006,7 +3006,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, - mctx->state_log[str_idx] = cur_state; - } - -- for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;) -+ for (null_cnt = 0; str_idx < last_str && null_cnt <= (long)mctx->max_mb_elem_len;) - { - re_node_set_empty (&next_nodes); - if (mctx->state_log[str_idx + 1]) -@@ -3786,7 +3786,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, - const re_string_t *input, Idx str_idx) - { - const re_token_t *node = dfa->nodes + node_idx; -- int char_len, elem_len; -+ unsigned int char_len, elem_len; - Idx i; - - if (BE (node->type == OP_UTF8_PERIOD, 0)) -@@ -4144,7 +4144,7 @@ extend_buffers (re_match_context_t *mctx, int min_len) - /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ - ret = re_string_realloc_buffers (pstr, - MAX (min_len, -- MIN (pstr->len, pstr->bufs_len * 2))); -+ MIN ((long)pstr->len, (long)(pstr->bufs_len * 2)))); - if (BE (ret != REG_NOERROR, 0)) - return ret; - -@@ -4316,7 +4316,7 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, - = (from == to ? -1 : 0); - - mctx->bkref_ents[mctx->nbkref_ents++].more = 0; -- if (mctx->max_mb_elem_len < to - from) -+ if (mctx->max_mb_elem_len < (long)(to - from)) - mctx->max_mb_elem_len = to - from; - return REG_NOERROR; - } -diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 3d3a4a4a975..9367caf763c 100644 ---- a/grub-core/kern/emu/misc.c -+++ b/grub-core/kern/emu/misc.c -@@ -175,7 +175,7 @@ grub_util_get_image_size (const char *path) - sz = ftello (f); - if (sz < 0) - grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); -- if (sz != (size_t) sz) -+ if (sz > (off_t)(GRUB_SIZE_MAX >> 1)) - grub_util_error (_("file `%s' is too big"), path); - ret = (size_t) sz; - -diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c -index ee9fa7b4feb..19c20085279 100644 ---- a/grub-core/lib/reed_solomon.c -+++ b/grub-core/lib/reed_solomon.c -@@ -156,7 +156,7 @@ static void - rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs) - { - gf_single_t *rs_polynomial; -- int i, j; -+ unsigned int i, j; - gf_single_t *m; - m = xmalloc ((s + rs) * sizeof (gf_single_t)); - grub_memcpy (m, data, s * sizeof (gf_single_t)); -@@ -325,7 +325,7 @@ static void - encode_block (gf_single_t *ptr, grub_size_t s, - gf_single_t *rptr, grub_size_t rs) - { -- int i, j; -+ unsigned int i, j; - for (i = 0; i < SECTOR_SIZE; i++) - { - grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE; -diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c -index c77d6085ccb..42a315031ff 100644 ---- a/grub-core/osdep/linux/blocklist.c -+++ b/grub-core/osdep/linux/blocklist.c -@@ -109,7 +109,7 @@ grub_install_get_blocklist (grub_device_t root_dev, - else - { - struct fiemap *fie2; -- int i; -+ unsigned int i; - fie2 = xmalloc (sizeof (*fie2) - + fie1.fm_mapped_extents - * sizeof (fie1.fm_extents[1])); -diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 4c5a13022dc..2b7a626d5ea 100644 ---- a/grub-core/osdep/linux/getroot.c -+++ b/grub-core/osdep/linux/getroot.c -@@ -236,7 +236,7 @@ grub_find_root_devices_from_btrfs (const char *dir) - { - int fd; - struct btrfs_ioctl_fs_info_args fsi; -- int i, j = 0; -+ unsigned int i, j = 0; - char **ret; - - fd = open (dir, 0); -diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c -index 06179fca725..bee732c2133 100644 ---- a/grub-core/osdep/linux/hostdisk.c -+++ b/grub-core/osdep/linux/hostdisk.c -@@ -83,7 +83,7 @@ grub_util_get_fd_size_os (grub_util_fd_t fd, const char *name, unsigned *log_sec - if (sector_size & (sector_size - 1) || !sector_size) - return -1; - for (log_sector_size = 0; -- (1 << log_sector_size) < sector_size; -+ (1U << log_sector_size) < sector_size; - log_sector_size++); - - if (log_secsize) -diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index a358ae47152..f82f9504054 100644 ---- a/util/grub-fstest.c -+++ b/util/grub-fstest.c -@@ -323,7 +323,7 @@ cmd_cmp (char *src, char *dest) - read_file (src, cmp_hook, ff); - - { -- grub_uint64_t pre; -+ long long pre; - pre = ftell (ff); - fseek (ff, 0, SEEK_END); - if (pre != ftell (ff)) -diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c -index a39f8693947..358d604210b 100644 ---- a/util/grub-menulst2cfg.c -+++ b/util/grub-menulst2cfg.c -@@ -34,7 +34,7 @@ main (int argc, char **argv) - char *buf = NULL; - size_t bufsize = 0; - char *suffix = xstrdup (""); -- int suffixlen = 0; -+ size_t suffixlen = 0; - const char *out_fname = 0; - - grub_util_host_init (&argc, &argv); -diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c -index 0fe45a6103d..3e09240b99f 100644 ---- a/util/grub-mkfont.c -+++ b/util/grub-mkfont.c -@@ -138,7 +138,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, - int width, height; - int cuttop, cutbottom, cutleft, cutright; - grub_uint8_t *data; -- int mask, i, j, bitmap_size; -+ int mask, i, bitmap_size; -+ unsigned int j; - FT_GlyphSlot glyph; - int flag = FT_LOAD_RENDER | FT_LOAD_MONOCHROME; - FT_Error err; -@@ -183,7 +184,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, - cuttop = cutbottom = cutleft = cutright = 0; - else - { -- for (cuttop = 0; cuttop < glyph->bitmap.rows; cuttop++) -+ for (cuttop = 0; cuttop < (long)glyph->bitmap.rows; cuttop++) - { - for (j = 0; j < glyph->bitmap.width; j++) - if (glyph->bitmap.buffer[j / 8 + cuttop * glyph->bitmap.pitch] -@@ -203,10 +204,10 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, - break; - } - cutbottom = glyph->bitmap.rows - 1 - cutbottom; -- if (cutbottom + cuttop >= glyph->bitmap.rows) -+ if (cutbottom + cuttop >= (long)glyph->bitmap.rows) - cutbottom = 0; - -- for (cutleft = 0; cutleft < glyph->bitmap.width; cutleft++) -+ for (cutleft = 0; cutleft < (long)glyph->bitmap.width; cutleft++) - { - for (j = 0; j < glyph->bitmap.rows; j++) - if (glyph->bitmap.buffer[cutleft / 8 + j * glyph->bitmap.pitch] -@@ -225,7 +226,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, - break; - } - cutright = glyph->bitmap.width - 1 - cutright; -- if (cutright + cutleft >= glyph->bitmap.width) -+ if (cutright + cutleft >= (long)glyph->bitmap.width) - cutright = 0; - } - -@@ -262,7 +263,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, - - mask = 0; - data = &glyph_info->bitmap[0] - 1; -- for (j = cuttop; j < height + cuttop; j++) -+ for (j = cuttop; j < (long)height + cuttop; j++) - for (i = cutleft; i < width + cutleft; i++) - add_pixel (&data, &mask, - glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] & -diff --git a/util/grub-probe.c b/util/grub-probe.c -index e45dbf9e049..e50bd43699d 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -798,7 +798,7 @@ argp_parser (int key, char *arg, struct argp_state *state) - - case 't': - { -- int i; -+ unsigned int i; - - for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) - if (strcmp (arg, targets[i]) == 0) -diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c -index f33bd1ed568..8345944105f 100644 ---- a/util/grub-rpm-sort.c -+++ b/util/grub-rpm-sort.c -@@ -232,7 +232,7 @@ main (int argc, char *argv[]) - struct arguments arguments; - char **package_names = NULL; - size_t n_package_names = 0; -- int i; -+ unsigned int i; - - grub_util_host_init (&argc, &argv); - -diff --git a/util/setup.c b/util/setup.c -index 9c1e1b7da6a..b0bb71eaaed 100644 ---- a/util/setup.c -+++ b/util/setup.c -@@ -407,7 +407,7 @@ SETUP (const char *dir, - int is_ldm; - grub_err_t err; - grub_disk_addr_t *sectors; -- int i; -+ unsigned int i; - grub_fs_t fs; - unsigned int nsec, maxsec; - -diff --git a/grub-core/gnulib/regex.h b/grub-core/gnulib/regex.h -index 854c6edaf75..9e754c637e6 100644 ---- a/grub-core/gnulib/regex.h -+++ b/grub-core/gnulib/regex.h -@@ -58,7 +58,7 @@ typedef size_t __re_long_size_t; - - /* The traditional GNU regex implementation mishandles strings longer - than INT_MAX. */ --typedef int __re_idx_t; -+typedef unsigned int __re_idx_t; - typedef unsigned int __re_size_t; - typedef unsigned long int __re_long_size_t; - -diff --git a/grub-core/gnulib/regex_internal.h b/grub-core/gnulib/regex_internal.h -index c467b290708..c3103844eda 100644 ---- a/grub-core/gnulib/regex_internal.h -+++ b/grub-core/gnulib/regex_internal.h -@@ -399,7 +399,7 @@ struct re_string_t - unsigned char offsets_needed; - unsigned char newline_anchor; - unsigned char word_ops_used; -- int mb_cur_max; -+ unsigned int mb_cur_max; - }; - typedef struct re_string_t re_string_t; - -@@ -691,7 +691,7 @@ struct re_dfa_t - unsigned int is_utf8 : 1; - unsigned int map_notascii : 1; - unsigned int word_ops_used : 1; -- int mb_cur_max; -+ unsigned int mb_cur_max; - bitset_t word_char; - reg_syntax_t syntax; - Idx *subexp_map; diff --git a/0163-Fix-getroot.c-s-trampolines.patch b/0157-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0163-Fix-getroot.c-s-trampolines.patch rename to 0157-Fix-getroot.c-s-trampolines.patch diff --git a/0164-Do-not-allow-stack-trampolines-anywhere.patch b/0158-Do-not-allow-stack-trampolines-anywhere.patch similarity index 81% rename from 0164-Do-not-allow-stack-trampolines-anywhere.patch rename to 0158-Do-not-allow-stack-trampolines-anywhere.patch index 6fcaab5f..62b9463d 100644 --- a/0164-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0158-Do-not-allow-stack-trampolines-anywhere.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Fri, 28 Sep 2018 15:48:09 -0400 +Date: Fri, 12 Jul 2019 10:06:50 +0200 Subject: [PATCH] Do not allow stack trampolines, anywhere. Signed-off-by: Peter Jones @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 40fcf567ae7..077df917593 100644 +index 38d978bd650..5076d635c57 100644 --- a/configure.ac +++ b/configure.ac -@@ -1983,6 +1983,9 @@ if test x"$enable_wextra" != xno ; then +@@ -1995,6 +1995,9 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi @@ -24,7 +24,7 @@ index 40fcf567ae7..077df917593 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index 0d9910d7875..38375a7891c 100644 +index b867691f125..87c1f0e809b 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d @@ -33,6 +33,6 @@ index 0d9910d7875..38375a7891c 100644 -CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code +CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Werror=trampolines -fno-trampolines - CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib + CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib CFLAGS_POSIX = -fno-builtin diff --git a/0165-Reimplement-boot_counter.patch b/0159-Reimplement-boot_counter.patch similarity index 97% rename from 0165-Reimplement-boot_counter.patch rename to 0159-Reimplement-boot_counter.patch index 032ddeda..08c8c586 100644 --- a/0165-Reimplement-boot_counter.patch +++ b/0159-Reimplement-boot_counter.patch @@ -23,10 +23,10 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index 08cc98ddb8b..eca3dfa753f 100644 +index 125ad6209b2..2019ebd0207 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -448,6 +448,12 @@ script = { +@@ -457,6 +457,12 @@ script = { installdir = grubconf; }; @@ -40,10 +40,10 @@ index 08cc98ddb8b..eca3dfa753f 100644 name = '01_menu_auto_hide'; common = util/grub.d/01_menu_auto_hide.in; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 59ead422028..ceb6fc677a0 100644 +index 8bb1dafd0ac..65ca74f9ad9 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -362,6 +362,11 @@ kernel = { +@@ -395,6 +395,11 @@ kernel = { extra_dist = kern/mips/cache_flush.S; }; diff --git a/0166-Make-grub_strtoul-end-pointer-have-the-right-constif.patch b/0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch similarity index 97% rename from 0166-Make-grub_strtoul-end-pointer-have-the-right-constif.patch rename to 0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch index 3358f649..234f32a0 100644 --- a/0166-Make-grub_strtoul-end-pointer-have-the-right-constif.patch +++ b/0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch @@ -101,7 +101,7 @@ index 4be8107d553..016a4d81835 100644 ctx.width = grub_strtoul (ptr, &ptr, 0); if (grub_errno) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 66f6b992604..5447e04e702 100644 +index 1a3eb6b8d77..3f264be77d1 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -971,7 +971,8 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) @@ -153,7 +153,7 @@ index 7b265c780c3..0cbd0dd1629 100644 struct grub_lvm_pv_header *pvh; struct grub_lvm_disk_locn *dlocn; diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c -index 9085895b6fe..1bd748be83b 100644 +index 2b85f4950bd..88d39360da0 100644 --- a/grub-core/kern/fs.c +++ b/grub-core/kern/fs.c @@ -134,7 +134,7 @@ struct grub_fs_block @@ -244,10 +244,10 @@ index ef56150ac77..05719ab2ccb 100644 { subpart = rest[1] - 'a'; diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 28ba3aef0bb..21ca040ada7 100644 +index 4afa99279a2..de9fda06f52 100644 --- a/grub-core/lib/syslinux_parse.c +++ b/grub-core/lib/syslinux_parse.c -@@ -1058,7 +1058,7 @@ write_entry (struct output_buffer *outbuf, +@@ -1062,7 +1062,7 @@ write_entry (struct output_buffer *outbuf, if (ptr[0] == 'h' && ptr[1] == 'd') { is_fd = 0; @@ -256,7 +256,7 @@ index 28ba3aef0bb..21ca040ada7 100644 continue; } if (grub_strncasecmp (ptr, "file=", 5) == 0) -@@ -1082,12 +1082,12 @@ write_entry (struct output_buffer *outbuf, +@@ -1086,12 +1086,12 @@ write_entry (struct output_buffer *outbuf, if (ptr[0] == 'f' && ptr[1] == 'd') { is_fd = 1; @@ -272,7 +272,7 @@ index 28ba3aef0bb..21ca040ada7 100644 } /* FIXME: isolinux, ntldr, cmldr, *dos, seg, hide diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c -index fb66e66fe96..293f1ad5c3e 100644 +index 6329ec01038..27afcaacbce 100644 --- a/grub-core/loader/i386/xen_fileXX.c +++ b/grub-core/loader/i386/xen_fileXX.c @@ -25,7 +25,7 @@ parse_xen_guest (grub_elf_t elf, struct grub_xen_file_info *xi, @@ -311,7 +311,7 @@ index 017c4d05bc7..e0e00c23d21 100644 { grub_errno = GRUB_ERR_NONE; diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index f208d1b180c..4c70fc4da2a 100644 +index 6603cd83edc..cdb8fd111a7 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -729,7 +729,7 @@ grub_efi_net_parse_address (const char *address, @@ -386,7 +386,7 @@ index c9c59690a98..b52b558d631 100644 return GRUB_ERR_NONE; } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index a571ee92efa..a011b940100 100644 +index 27a0a1d6961..aa56393e1c4 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -411,7 +411,7 @@ parse_ip (const char *val, grub_uint32_t *ip, const char **rest) @@ -452,7 +452,7 @@ index a697bcb4d8d..a8afc0c9408 100644 int first = 1; grub_disk_addr_t partstart = 0; diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index 93965777138..7d327f59d92 100644 +index ba38b5e8aef..c6d2c365c9a 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -146,7 +146,7 @@ replace_scope (struct grub_script_scope *new_scope) @@ -522,7 +522,7 @@ index 7da615ff33e..5488ab26b43 100644 grub_errno = 0; value = grub_strtoull(input, &output, base); diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index f82f9504054..5095fa8356c 100644 +index 88f9c5d4ad8..39bad1f432f 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -538,7 +538,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; @@ -558,10 +558,10 @@ index 9c642ae3fe3..80b96b972d0 100644 grub_make_system_path_relative_to_its_root_os (const char *path); char *grub_util_get_grub_dev (const char *os_dev); diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index a653132e36a..1ca4c78de97 100644 +index 5ef4f79e689..8e241c9298a 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h -@@ -40,6 +40,9 @@ void grub_find_zpool_from_dir (const char *dir, +@@ -41,6 +41,9 @@ void grub_find_zpool_from_dir (const char *dir, char *grub_make_system_path_relative_to_its_root (const char *path) WARN_UNUSED_RESULT; @@ -572,7 +572,7 @@ index a653132e36a..1ca4c78de97 100644 grub_util_device_is_mapped (const char *dev); diff --git a/include/grub/misc.h b/include/grub/misc.h -index de9016ab709..1258ec6bbf3 100644 +index 960097fbd06..b7fc9c6a792 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -288,11 +288,11 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n) diff --git a/0167-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0161-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 99% rename from 0167-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0161-Fix-menu-entry-selection-based-on-ID-and-title.patch index 9de7cc52..2105e759 100644 --- a/0167-Fix-menu-entry-selection-based-on-ID-and-title.patch +++ b/0161-Fix-menu-entry-selection-based-on-ID-and-title.patch @@ -24,7 +24,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 72 insertions(+), 71 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 6cb2a071490..7e32c498aa8 100644 +index 046a1fb2c84..920b44a8aed 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -164,12 +164,12 @@ grub_menu_set_timeout (int timeout) diff --git a/0168-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0162-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 100% rename from 0168-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0162-Make-the-menu-entry-users-option-argument-to-be-opti.patch diff --git a/0169-Add-efi-export-env-and-efi-load-env-commands.patch b/0163-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 98% rename from 0169-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0163-Add-efi-export-env-and-efi-load-env-commands.patch index 0e35e0b8..9b2ab56c 100644 --- a/0169-Add-efi-export-env-and-efi-load-env-commands.patch +++ b/0163-Add-efi-export-env-and-efi-load-env-commands.patch @@ -22,10 +22,10 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/efi/env.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index ceb6fc677a0..b662312ca6f 100644 +index 65ca74f9ad9..661994686e6 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -776,6 +776,12 @@ module = { +@@ -817,6 +817,12 @@ module = { enable = efi; }; @@ -213,7 +213,7 @@ index 00000000000..a69079786aa + grub_unregister_command (loadenv_cmd); +} diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 4d36fe31177..1079ac74a47 100644 +index ada3004cfba..279394d85eb 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -224,6 +224,9 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid, @@ -297,7 +297,7 @@ index 230e0e9d9ab..f89d86d4e8d 100644 grub_envblk_iterate (grub_envblk_t envblk, void *hook_data, diff --git a/util/editenv.c b/util/editenv.c -index 41bc7cb1c9a..844a14d90da 100644 +index 1f7f6f3ae18..66f99f988ff 100644 --- a/util/editenv.c +++ b/util/editenv.c @@ -30,8 +30,6 @@ @@ -322,7 +322,7 @@ index bb198f02351..6a79ee67444 100644 #include #include diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 570a69361a5..2778b95df17 100644 +index 8ca3981d7a1..d24afbadbf6 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -24,6 +24,11 @@ diff --git a/0170-Make-it-possible-to-subtract-conditions-from-debug.patch b/0164-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 100% rename from 0170-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0164-Make-it-possible-to-subtract-conditions-from-debug.patch diff --git a/0171-Export-all-variables-from-the-initial-context-when-c.patch b/0165-Export-all-variables-from-the-initial-context-when-c.patch similarity index 97% rename from 0171-Export-all-variables-from-the-initial-context-when-c.patch rename to 0165-Export-all-variables-from-the-initial-context-when-c.patch index 24e35809..bd61eff6 100644 --- a/0171-Export-all-variables-from-the-initial-context-when-c.patch +++ b/0165-Export-all-variables-from-the-initial-context-when-c.patch @@ -30,7 +30,7 @@ index ee53d4a68e5..87edd254c44 100644 int grub_extractor_level = 0; diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 7e32c498aa8..d087153f276 100644 +index 920b44a8aed..341228f87c9 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -376,8 +376,6 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) diff --git a/0172-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch b/0166-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch similarity index 97% rename from 0172-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch rename to 0166-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch index 3469f7a5..2cef9b9d 100644 --- a/0172-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch +++ b/0166-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch @@ -22,7 +22,7 @@ Resolves: rhbz#1658500 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index a011b940100..19ff2d486a1 100644 +index aa56393e1c4..15073dde1c4 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1942,11 +1942,9 @@ grub_net_search_configfile (char *config) diff --git a/0173-Try-to-set-fPIE-and-friends-on-libgnu.a.patch b/0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch similarity index 51% rename from 0173-Try-to-set-fPIE-and-friends-on-libgnu.a.patch rename to 0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch index 17f5179b..837da31f 100644 --- a/0173-Try-to-set-fPIE-and-friends-on-libgnu.a.patch +++ b/0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Tue, 15 Jan 2019 14:57:25 -0500 +Date: Fri, 12 Jul 2019 17:45:51 +0200 Subject: [PATCH] Try to set -fPIE and friends on libgnu.a In order to make sure UTIL_CFLAGS and UTIL_LDFLAGS can correctly get @@ -18,22 +18,23 @@ Fixes an rpmdiff check. Related: rhbz#1658500 Signed-off-by: Peter Jones +[javierm: replace from bootstrap instead patching generated Makefile.am] +Signed-off-by: Javier Martinez Canillas --- - grub-core/gnulib/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + bootstrap.conf | 3 +++ + 1 file changed, 3 insertions(+) -diff --git a/grub-core/gnulib/Makefile.am b/grub-core/gnulib/Makefile.am -index b7c5e60e1c3..bd3621930ff 100644 ---- a/grub-core/gnulib/Makefile.am -+++ b/grub-core/gnulib/Makefile.am -@@ -38,8 +38,8 @@ CLEANFILES = - DISTCLEANFILES = - MAINTAINERCLEANFILES = - --AM_CPPFLAGS = --AM_CFLAGS = -+AM_CPPFLAGS = $(HOST_CPPFLAGS) -+AM_CFLAGS = $(HOST_CFLAGS) - - noinst_LIBRARIES += libgnu.a - +diff --git a/bootstrap.conf b/bootstrap.conf +index 8804d5beb89..29a6a3e90e2 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -82,6 +82,9 @@ bootstrap_post_import_hook () { + patch -d grub-core/lib/gnulib -p2 \ + < "grub-core/lib/gnulib-patches/$patchname.patch" + done ++ for flagvar in CPPFLAGS CFLAGS; do ++ sed -i -e "s/^AM_$flagvar =/AM_$flagvar = \$(HOST_$flagvar)/" grub-core/lib/gnulib/Makefile.am ++ done + FROM_BOOTSTRAP=1 ./autogen.sh + set +e # bootstrap expects this + } diff --git a/0174-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch b/0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch similarity index 100% rename from 0174-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch rename to 0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch diff --git a/0175-Fix-the-type-of-grub_efi_status_t.patch b/0169-Fix-the-type-of-grub_efi_status_t.patch similarity index 98% rename from 0175-Fix-the-type-of-grub_efi_status_t.patch rename to 0169-Fix-the-type-of-grub_efi_status_t.patch index e937c27a..fba3f3d1 100644 --- a/0175-Fix-the-type-of-grub_efi_status_t.patch +++ b/0169-Fix-the-type-of-grub_efi_status_t.patch @@ -65,7 +65,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index b337e1a193d..0c15cffa23c 100644 +index 2ed9c26a450..dec7b06083e 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -536,7 +536,7 @@ typedef grub_uint64_t grub_efi_uint64_t; diff --git a/0179-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0170-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 98% rename from 0179-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0170-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index 82df575e..5c6c28e9 100644 --- a/0179-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0170-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -18,10 +18,10 @@ In menu auto hide script, rename last_boot_ok var to menu_hide_ok rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index eca3dfa753f..5062a0e50fa 100644 +index 2019ebd0207..1fa92caad4d 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -449,14 +449,14 @@ script = { +@@ -458,14 +458,14 @@ script = { }; script = { @@ -40,7 +40,7 @@ index eca3dfa753f..5062a0e50fa 100644 installdir = grubconf; }; -@@ -515,6 +515,12 @@ script = { +@@ -524,6 +524,12 @@ script = { condition = COND_HOST_LINUX; }; diff --git a/0180-Fix-systemctl-kexec-exit-status-check.patch b/0171-Fix-systemctl-kexec-exit-status-check.patch similarity index 100% rename from 0180-Fix-systemctl-kexec-exit-status-check.patch rename to 0171-Fix-systemctl-kexec-exit-status-check.patch diff --git a/0181-Print-grub-emu-linux-loader-messages-as-debug.patch b/0172-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 100% rename from 0181-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0172-Print-grub-emu-linux-loader-messages-as-debug.patch diff --git a/0182-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 98% rename from 0182-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch index 1d071bd6..707c1e93 100644 --- a/0182-Don-t-assume-that-boot-commands-will-only-return-on-.patch +++ b/0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch @@ -17,7 +17,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d087153f276..050d0adf6ce 100644 +index 341228f87c9..6ef7e2f8e6f 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -286,7 +286,7 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) diff --git a/0183-Fix-undefined-references-for-fdt-when-building-with-.patch b/0174-Fix-undefined-references-for-fdt-when-building-with-.patch similarity index 98% rename from 0183-Fix-undefined-references-for-fdt-when-building-with-.patch rename to 0174-Fix-undefined-references-for-fdt-when-building-with-.patch index 36989b42..9065da8a 100644 --- a/0183-Fix-undefined-references-for-fdt-when-building-with-.patch +++ b/0174-Fix-undefined-references-for-fdt-when-building-with-.patch @@ -27,7 +27,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index 6ee57e11ab3..e34644631e1 100644 +index 22b7c5463fc..2041341fd68 100644 --- a/include/grub/fdt.h +++ b/include/grub/fdt.h @@ -19,7 +19,7 @@ diff --git a/0175-Do-better-in-bootstrap.conf.patch b/0175-Do-better-in-bootstrap.conf.patch new file mode 100644 index 00000000..3547c784 --- /dev/null +++ b/0175-Do-better-in-bootstrap.conf.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 29 Jul 2019 10:58:52 -0400 +Subject: [PATCH] Do better in bootstrap.conf + +--- + bootstrap.conf | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/bootstrap.conf b/bootstrap.conf +index 29a6a3e90e2..417cfe405f4 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -16,7 +16,13 @@ + # along with this program. If not, see . + + +-GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 ++# GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 ++if [[ -z "${GNULIB_REVISION}" ]] ;then ++ GNULIB_REVISION=fixes ++fi ++if [[ -z "${GNULIB_URL}" ]] ;then ++ GNULIB_URL=https://github.com/rhboot/gnulib.git ++fi + + # gnulib modules used by this package. + # mbswidth is used by gnulib-fix-width.diff's changes to argp rather than diff --git a/0176-Use-git-to-apply-gnulib-patches.patch b/0176-Use-git-to-apply-gnulib-patches.patch new file mode 100644 index 00000000..0813badb --- /dev/null +++ b/0176-Use-git-to-apply-gnulib-patches.patch @@ -0,0 +1,474 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 29 Jul 2019 11:21:27 -0400 +Subject: [PATCH] Use git to apply gnulib patches. + +Signed-off-by: Peter Jones +--- + bootstrap.conf | 4 - + grub-core/lib/gnulib-patches/fix-null-deref.patch | 13 -- + .../gnulib-patches/fix-sign-compare-errors.patch | 161 --------------- + grub-core/lib/gnulib-patches/fix-width.patch | 217 --------------------- + grub-core/lib/gnulib-patches/no-abort.patch | 26 --- + 5 files changed, 421 deletions(-) + delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-width.patch + delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch + +diff --git a/bootstrap.conf b/bootstrap.conf +index 417cfe405f4..24ea40b2fc5 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -84,10 +84,6 @@ cp -a INSTALL INSTALL.grub + + bootstrap_post_import_hook () { + set -e +- for patchname in fix-null-deref fix-width no-abort fix-sign-compare-errors; do +- patch -d grub-core/lib/gnulib -p2 \ +- < "grub-core/lib/gnulib-patches/$patchname.patch" +- done + for flagvar in CPPFLAGS CFLAGS; do + sed -i -e "s/^AM_$flagvar =/AM_$flagvar = \$(HOST_$flagvar)/" grub-core/lib/gnulib/Makefile.am + done +diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch +deleted file mode 100644 +index 8fafa153a47..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-null-deref.patch ++++ /dev/null +@@ -1,13 +0,0 @@ +-diff --git a/lib/argp-parse.c b/lib/argp-parse.c +-index 6dec57310..900adad54 100644 +---- a/lib/argp-parse.c +-+++ b/lib/argp-parse.c +-@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse) +- void * +- __argp_input (const struct argp *argp, const struct argp_state *state) +- { +-- if (state) +-+ if (state && state->pstate) +- { +- struct group *group; +- struct parser *parser = state->pstate; +diff --git a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch b/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch +deleted file mode 100644 +index 479029c0565..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch ++++ /dev/null +@@ -1,161 +0,0 @@ +-diff --git a/lib/regcomp.c b/lib/regcomp.c +-index cc85f35ac58..361079d82d6 100644 +---- a/lib/regcomp.c +-+++ b/lib/regcomp.c +-@@ -322,7 +322,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, +- *p++ = dfa->nodes[node].opr.c; +- memset (&state, '\0', sizeof (state)); +- if (__mbrtowc (&wc, (const char *) buf, p - buf, +-- &state) == p - buf +-+ &state) == (size_t)(p - buf) +- && (__wcrtomb ((char *) buf, __towlower (wc), &state) +- != (size_t) -1)) +- re_set_fastmap (fastmap, false, buf[0]); +-@@ -3778,7 +3778,7 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) +- num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2) +- ? -2 +- : num == -1 +-- ? c - '0' +-+ ? (Idx)(c - '0') +- : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); +- } +- return num; +-diff --git a/lib/regex_internal.c b/lib/regex_internal.c +-index 9004ce809eb..193a1e3d332 100644 +---- a/lib/regex_internal.c +-+++ b/lib/regex_internal.c +-@@ -233,7 +233,7 @@ build_wcs_buffer (re_string_t *pstr) +- /* Apply the translation if we need. */ +- if (__glibc_unlikely (pstr->trans != NULL)) +- { +-- int i, ch; +-+ unsigned int i, ch; +- +- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) +- { +-@@ -376,7 +376,7 @@ build_wcs_upper_buffer (re_string_t *pstr) +- prev_st = pstr->cur_state; +- if (__glibc_unlikely (pstr->trans != NULL)) +- { +-- int i, ch; +-+ unsigned int i, ch; +- +- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) +- { +-@@ -754,7 +754,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) +- memset (&cur_state, 0, sizeof (cur_state)); +- mbclen = __mbrtowc (&wc2, (const char *) pp, mlen, +- &cur_state); +-- if (raw + offset - p <= mbclen +-+ if ((size_t)(raw + offset - p) <= mbclen +- && mbclen < (size_t) -2) +- { +- memset (&pstr->cur_state, '\0', +-diff --git a/lib/regex_internal.h b/lib/regex_internal.h +-index 5462419b787..e0f8292395d 100644 +---- a/lib/regex_internal.h +-+++ b/lib/regex_internal.h +-@@ -425,7 +425,7 @@ struct re_string_t +- unsigned char offsets_needed; +- unsigned char newline_anchor; +- unsigned char word_ops_used; +-- int mb_cur_max; +-+ unsigned int mb_cur_max; +- }; +- typedef struct re_string_t re_string_t; +- +-@@ -702,7 +702,7 @@ struct re_dfa_t +- unsigned int is_utf8 : 1; +- unsigned int map_notascii : 1; +- unsigned int word_ops_used : 1; +-- int mb_cur_max; +-+ unsigned int mb_cur_max; +- bitset_t word_char; +- reg_syntax_t syntax; +- Idx *subexp_map; +-diff --git a/lib/regexec.c b/lib/regexec.c +-index 0a7a27b772e..b57d4f9141d 100644 +---- a/lib/regexec.c +-+++ b/lib/regexec.c +-@@ -443,7 +443,7 @@ re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, +- { +- if (ret_len) +- { +-- assert (pmatch[0].rm_so == start); +-+ assert (pmatch[0].rm_so == (long)start); +- rval = pmatch[0].rm_eo - start; +- } +- else +-@@ -877,11 +877,11 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, +- if (__glibc_unlikely (mctx.input.offsets_needed != 0)) +- { +- pmatch[reg_idx].rm_so = +-- (pmatch[reg_idx].rm_so == mctx.input.valid_len +-+ (pmatch[reg_idx].rm_so == (long)mctx.input.valid_len +- ? mctx.input.valid_raw_len +- : mctx.input.offsets[pmatch[reg_idx].rm_so]); +- pmatch[reg_idx].rm_eo = +-- (pmatch[reg_idx].rm_eo == mctx.input.valid_len +-+ (pmatch[reg_idx].rm_eo == (long)mctx.input.valid_len +- ? mctx.input.valid_raw_len +- : mctx.input.offsets[pmatch[reg_idx].rm_eo]); +- } +-@@ -1418,11 +1418,11 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, +- } +- memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); +- +-- for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) +-+ for (idx = pmatch[0].rm_so; idx <= (long)pmatch[0].rm_eo ;) +- { +- update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); +- +-- if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) +-+ if (idx == (long)pmatch[0].rm_eo && cur_node == mctx->last_node) +- { +- Idx reg_idx; +- if (fs) +-@@ -1519,7 +1519,7 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, +- if (reg_num < nmatch) +- { +- /* We are at the last node of this sub expression. */ +-- if (pmatch[reg_num].rm_so < cur_idx) +-+ if (pmatch[reg_num].rm_so < (long)cur_idx) +- { +- pmatch[reg_num].rm_eo = cur_idx; +- /* This is a non-empty match or we are not inside an optional +-@@ -2938,7 +2938,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, +- mctx->state_log[str_idx] = cur_state; +- } +- +-- for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;) +-+ for (null_cnt = 0; str_idx < last_str && null_cnt <= (long)mctx->max_mb_elem_len;) +- { +- re_node_set_empty (&next_nodes); +- if (mctx->state_log[str_idx + 1]) +-@@ -3718,7 +3718,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, +- const re_string_t *input, Idx str_idx) +- { +- const re_token_t *node = dfa->nodes + node_idx; +-- int char_len, elem_len; +-+ unsigned int char_len, elem_len; +- Idx i; +- +- if (__glibc_unlikely (node->type == OP_UTF8_PERIOD)) +-@@ -4066,7 +4066,7 @@ extend_buffers (re_match_context_t *mctx, int min_len) +- /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ +- ret = re_string_realloc_buffers (pstr, +- MAX (min_len, +-- MIN (pstr->len, pstr->bufs_len * 2))); +-+ MIN ((long)pstr->len, pstr->bufs_len * 2))); +- if (__glibc_unlikely (ret != REG_NOERROR)) +- return ret; +- +-@@ -4236,7 +4236,7 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, +- = (from == to ? -1 : 0); +- +- mctx->bkref_ents[mctx->nbkref_ents++].more = 0; +-- if (mctx->max_mb_elem_len < to - from) +-+ if (mctx->max_mb_elem_len < (long)(to - from)) +- mctx->max_mb_elem_len = to - from; +- return REG_NOERROR; +- } +diff --git a/grub-core/lib/gnulib-patches/fix-width.patch b/grub-core/lib/gnulib-patches/fix-width.patch +deleted file mode 100644 +index 0a208ad08b5..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-width.patch ++++ /dev/null +@@ -1,217 +0,0 @@ +-diff --git a/lib/argp-fmtstream.c b/lib/argp-fmtstream.c +-index ba6a407f7..d0685b3d4 100644 +---- a/lib/argp-fmtstream.c +-+++ b/lib/argp-fmtstream.c +-@@ -28,9 +28,11 @@ +- #include +- #include +- #include +-+#include +- +- #include "argp-fmtstream.h" +- #include "argp-namefrob.h" +-+#include "mbswidth.h" +- +- #ifndef ARGP_FMTSTREAM_USE_LINEWRAP +- +-@@ -115,6 +117,51 @@ weak_alias (__argp_fmtstream_free, argp_fmtstream_free) +- #endif +- #endif +- +-+ +-+/* Return the pointer to the first character that doesn't fit in l columns. */ +-+static inline const ptrdiff_t +-+add_width (const char *ptr, const char *end, size_t l) +-+{ +-+ mbstate_t ps; +-+ const char *ptr0 = ptr; +-+ +-+ memset (&ps, 0, sizeof (ps)); +-+ +-+ while (ptr < end) +-+ { +-+ wchar_t wc; +-+ size_t s, k; +-+ +-+ s = mbrtowc (&wc, ptr, end - ptr, &ps); +-+ if (s == (size_t) -1) +-+ break; +-+ if (s == (size_t) -2) +-+ { +-+ if (1 >= l) +-+ break; +-+ l--; +-+ ptr++; +-+ continue; +-+ } +-+ +-+ if (wc == '\e' && ptr + 3 < end +-+ && ptr[1] == '[' && (ptr[2] == '0' || ptr[2] == '1') +-+ && ptr[3] == 'm') +-+ { +-+ ptr += 4; +-+ continue; +-+ } +-+ +-+ k = wcwidth (wc); +-+ +-+ if (k >= l) +-+ break; +-+ l -= k; +-+ ptr += s; +-+ } +-+ return ptr - ptr0; +-+} +-+ +- /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the +- end of its buffer. This code is mostly from glibc stdio/linewrap.c. */ +- void +-@@ -168,13 +215,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs) +- if (!nl) +- { +- /* The buffer ends in a partial line. */ +-+ size_t display_width = mbsnwidth (buf, fs->p - buf, +-+ MBSW_STOP_AT_NUL); +- +-- if (fs->point_col + len < fs->rmargin) +-+ if (fs->point_col + display_width < fs->rmargin) +- { +- /* The remaining buffer text is a partial line and fits +- within the maximum line width. Advance point for the +- characters to be written and stop scanning. */ +-- fs->point_col += len; +-+ fs->point_col += display_width; +- break; +- } +- else +-@@ -182,14 +231,18 @@ __argp_fmtstream_update (argp_fmtstream_t fs) +- the end of the buffer. */ +- nl = fs->p; +- } +-- else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin) +-- { +-- /* The buffer contains a full line that fits within the maximum +-- line width. Reset point and scan the next line. */ +-- fs->point_col = 0; +-- buf = nl + 1; +-- continue; +-- } +-+ else +-+ { +-+ size_t display_width = mbsnwidth (buf, nl - buf, MBSW_STOP_AT_NUL); +-+ if (display_width < (ssize_t) fs->rmargin) +-+ { +-+ /* The buffer contains a full line that fits within the maximum +-+ line width. Reset point and scan the next line. */ +-+ fs->point_col = 0; +-+ buf = nl + 1; +-+ continue; +-+ } +-+ } +- +- /* This line is too long. */ +- r = fs->rmargin - 1; +-@@ -225,7 +278,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) +- char *p, *nextline; +- int i; +- +-- p = buf + (r + 1 - fs->point_col); +-+ p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); +- while (p >= buf && !isblank ((unsigned char) *p)) +- --p; +- nextline = p + 1; /* This will begin the next line. */ +-@@ -243,7 +296,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) +- { +- /* A single word that is greater than the maximum line width. +- Oh well. Put it on an overlong line by itself. */ +-- p = buf + (r + 1 - fs->point_col); +-+ p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); +- /* Find the end of the long word. */ +- if (p < nl) +- do +-@@ -277,7 +330,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs) +- && fs->p > nextline) +- { +- /* The margin needs more blanks than we removed. */ +-- if (fs->end - fs->p > fs->wmargin + 1) +-+ if (mbsnwidth (fs->p, fs->end - fs->p, MBSW_STOP_AT_NUL) +-+ > fs->wmargin + 1) +- /* Make some space for them. */ +- { +- size_t mv = fs->p - nextline; +-diff --git a/lib/argp-help.c b/lib/argp-help.c +-index e5375a0f0..5d8f451ec 100644 +---- a/lib/argp-help.c +-+++ b/lib/argp-help.c +-@@ -51,6 +51,7 @@ +- #include "argp.h" +- #include "argp-fmtstream.h" +- #include "argp-namefrob.h" +-+#include "mbswidth.h" +- +- #ifndef SIZE_MAX +- # define SIZE_MAX ((size_t) -1) +-@@ -1432,7 +1433,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, +- +- /* Manually do line wrapping so that it (probably) won't get wrapped at +- any embedded spaces. */ +-- space (stream, 1 + nl - cp); +-+ space (stream, 1 + mbsnwidth (cp, nl - cp, MBSW_STOP_AT_NUL)); +- +- __argp_fmtstream_write (stream, cp, nl - cp); +- } +-diff --git a/lib/mbswidth.c b/lib/mbswidth.c +-index 408a15e34..b3fb7f83a 100644 +---- a/lib/mbswidth.c +-+++ b/lib/mbswidth.c +-@@ -38,6 +38,14 @@ +- /* Get INT_MAX. */ +- #include +- +-+#ifndef FALLTHROUGH +-+# if __GNUC__ < 7 +-+# define FALLTHROUGH ((void) 0) +-+# else +-+# define FALLTHROUGH __attribute__ ((__fallthrough__)) +-+# endif +-+#endif +-+ +- /* Returns the number of columns needed to represent the multibyte +- character string pointed to by STRING. If a non-printable character +- occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. +-@@ -90,6 +98,10 @@ mbsnwidth (const char *string, size_t nbytes, int flags) +- p++; +- width++; +- break; +-+ case '\0': +-+ if (flags & MBSW_STOP_AT_NUL) +-+ return width; +-+ FALLTHROUGH; +- default: +- /* If we have a multibyte sequence, scan it up to its end. */ +- { +-@@ -168,6 +180,9 @@ mbsnwidth (const char *string, size_t nbytes, int flags) +- { +- unsigned char c = (unsigned char) *p++; +- +-+ if (c == 0 && (flags & MBSW_STOP_AT_NUL)) +-+ return width; +-+ +- if (isprint (c)) +- { +- if (width == INT_MAX) +-diff --git a/lib/mbswidth.h b/lib/mbswidth.h +-index 2b5c53c37..45a123e63 100644 +---- a/lib/mbswidth.h +-+++ b/lib/mbswidth.h +-@@ -45,6 +45,10 @@ extern "C" { +- control characters and 1 otherwise. */ +- #define MBSW_REJECT_UNPRINTABLE 2 +- +-+/* If this bit is set \0 is treated as the end of string. +-+ Otherwise it's treated as a normal one column width character. */ +-+#define MBSW_STOP_AT_NUL 4 +-+ +- +- /* Returns the number of screen columns needed for STRING. */ +- #define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */ +diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch +deleted file mode 100644 +index e469c4762eb..00000000000 +--- a/grub-core/lib/gnulib-patches/no-abort.patch ++++ /dev/null +@@ -1,26 +0,0 @@ +-diff --git a/lib/regcomp.c b/lib/regcomp.c +-index cc85f35ac..de45ebb5c 100644 +---- a/lib/regcomp.c +-+++ b/lib/regcomp.c +-@@ -528,9 +528,9 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf, +- to this routine. If we are given anything else, or if other regex +- code generates an invalid error code, then the program has a bug. +- Dump core so we can fix it. */ +-- abort (); +-- +-- msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); +-+ msg = gettext ("unknown regexp error"); +-+ else +-+ msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); +- +- msg_size = strlen (msg) + 1; /* Includes the null. */ +- +-@@ -1136,7 +1136,7 @@ optimize_utf8 (re_dfa_t *dfa) +- } +- break; +- default: +-- abort (); +-+ break; +- } +- +- if (mb_chars || has_period) diff --git a/0176-mkimage-Use-EFI32_HEADER_SIZE-define-in-arm-efi-case.patch b/0176-mkimage-Use-EFI32_HEADER_SIZE-define-in-arm-efi-case.patch deleted file mode 100644 index 34575e99..00000000 --- a/0176-mkimage-Use-EFI32_HEADER_SIZE-define-in-arm-efi-case.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Mon, 28 Jan 2019 14:35:27 +0100 -Subject: [PATCH] mkimage: Use EFI32_HEADER_SIZE define in arm-efi case - -The efi-arm case was defining its own header size calculation, even though it's -100% identical to the common EFI32_HEADER_SIZE definition. - -So let's clean it up to use the common define. - -Signed-off-by: Alexander Graf -Reviewed-by: Daniel Kiper -Tested-by: Julien ROBIN ---- - util/mkimage.c | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/util/mkimage.c b/util/mkimage.c -index e22d82afa61..d18ce87a55d 100644 ---- a/util/mkimage.c -+++ b/util/mkimage.c -@@ -584,12 +584,7 @@ static const struct grub_install_image_target_desc image_targets[] = - .decompressor_uncompressed_size = TARGET_NO_FIELD, - .decompressor_uncompressed_addr = TARGET_NO_FIELD, - .section_align = GRUB_PE32_SECTION_ALIGNMENT, -- .vaddr_offset = ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE -- + GRUB_PE32_SIGNATURE_SIZE -- + sizeof (struct grub_pe32_coff_header) -- + sizeof (struct grub_pe32_optional_header) -- + 4 * sizeof (struct grub_pe32_section_table), -- GRUB_PE32_SECTION_ALIGNMENT), -+ .vaddr_offset = EFI32_HEADER_SIZE, - .pe_target = GRUB_PE32_MACHINE_ARMTHUMB_MIXED, - .elf_target = EM_ARM, - }, diff --git a/0177-autogen.sh-use-find-wholename-for-long-path-matches.patch b/0177-autogen.sh-use-find-wholename-for-long-path-matches.patch new file mode 100644 index 00000000..1ac3f16e --- /dev/null +++ b/0177-autogen.sh-use-find-wholename-for-long-path-matches.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 29 Jul 2019 14:01:50 -0400 +Subject: [PATCH] autogen.sh: use find -wholename for long path matches + +Signed-off-by: Peter Jones +--- + autogen.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/autogen.sh b/autogen.sh +index ef43270fca0..a1783d62c26 100755 +--- a/autogen.sh ++++ b/autogen.sh +@@ -13,7 +13,7 @@ fi + export LC_COLLATE=C + unset LC_ALL + +-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -ipath './gnulib/*' ! -iname './grub-core/lib/gnulib/*' |sort > po/POTFILES.in ++find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -ipath './gnulib/*' ! -wholename './grub-core/lib/gnulib/*' |sort > po/POTFILES.in + find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in + + echo "Importing unicode..." diff --git a/0177-mkimage-Align-efi-sections-on-4k-boundary.patch b/0177-mkimage-Align-efi-sections-on-4k-boundary.patch deleted file mode 100644 index 1f2d0823..00000000 --- a/0177-mkimage-Align-efi-sections-on-4k-boundary.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Mon, 28 Jan 2019 14:35:28 +0100 -Subject: [PATCH] mkimage: Align efi sections on 4k boundary - -There is UEFI firmware popping up in the wild now that implements stricter -permission checks using NX and write protect page table entry bits. - -This means that firmware now may fail to load binaries if its individual -sections are not page aligned, as otherwise it can not ensure permission -boundaries. - -So let's bump all efi section alignments up to 4k (EFI page size). That way -we will stay compatible going forward. - -Unfortunately our internals can't deal very well with a mismatch of alignment -between the virtual and file offsets, so we have to also pad our target -binary a bit. - -Signed-off-by: Alexander Graf -Reviewed-by: Daniel Kiper -Tested-by: Julien ROBIN ---- - include/grub/efi/pe32.h | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index c03cc599f63..f71da19f2f5 100644 ---- a/include/grub/efi/pe32.h -+++ b/include/grub/efi/pe32.h -@@ -20,6 +20,7 @@ - #define GRUB_EFI_PE32_HEADER 1 - - #include -+#include - - /* The MSDOS compatibility stub. This was copied from the output of - objcopy, and it is not necessary to care about what this means. */ -@@ -50,8 +51,14 @@ - /* According to the spec, the minimal alignment is 512 bytes... - But some examples (such as EFI drivers in the Intel - Sample Implementation) use 32 bytes (0x20) instead, and it seems -- to be working. For now, GRUB uses 512 bytes for safety. */ --#define GRUB_PE32_SECTION_ALIGNMENT 0x200 -+ to be working. -+ -+ However, there is firmware showing up in the field now with -+ page alignment constraints to guarantee that page protection -+ bits take effect. Because currently existing GRUB code can not -+ properly distinguish between in-memory and in-file layout, let's -+ bump all alignment to GRUB_EFI_PAGE_SIZE. */ -+#define GRUB_PE32_SECTION_ALIGNMENT GRUB_EFI_PAGE_SIZE - #define GRUB_PE32_FILE_ALIGNMENT GRUB_PE32_SECTION_ALIGNMENT - - struct grub_pe32_coff_header diff --git a/0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch b/0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch new file mode 100644 index 00000000..3a0e5bcf --- /dev/null +++ b/0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 29 Jul 2019 14:02:11 -0400 +Subject: [PATCH] bootstrap.conf: don't clobber AM_CFLAGS here + +--- + bootstrap.conf | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/bootstrap.conf b/bootstrap.conf +index 24ea40b2fc5..274c55a5568 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -84,9 +84,6 @@ cp -a INSTALL INSTALL.grub + + bootstrap_post_import_hook () { + set -e +- for flagvar in CPPFLAGS CFLAGS; do +- sed -i -e "s/^AM_$flagvar =/AM_$flagvar = \$(HOST_$flagvar)/" grub-core/lib/gnulib/Makefile.am +- done + FROM_BOOTSTRAP=1 ./autogen.sh + set +e # bootstrap expects this + } diff --git a/0178-mkimage-Clarify-file-alignment-in-efi-case.patch b/0178-mkimage-Clarify-file-alignment-in-efi-case.patch deleted file mode 100644 index 373b5ce6..00000000 --- a/0178-mkimage-Clarify-file-alignment-in-efi-case.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Mon, 28 Jan 2019 14:35:29 +0100 -Subject: [PATCH] mkimage: Clarify file alignment in efi case - -There are a few spots in the PE generation code for EFI binaries that uses -the section alignment rather than file alignment, even though the alignment -is really only file bound. - -Replace those cases with the file alignment constant instead. - -Reported-by: Daniel Kiper -Signed-off-by: Alexander Graf -Reviewed-by: Daniel Kiper -Tested-by: Julien ROBIN ---- - util/mkimage.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/util/mkimage.c b/util/mkimage.c -index d18ce87a55d..b5272bc1b01 100644 ---- a/util/mkimage.c -+++ b/util/mkimage.c -@@ -66,14 +66,14 @@ - + sizeof (struct grub_pe32_coff_header) \ - + sizeof (struct grub_pe32_optional_header) \ - + 4 * sizeof (struct grub_pe32_section_table), \ -- GRUB_PE32_SECTION_ALIGNMENT) -+ GRUB_PE32_FILE_ALIGNMENT) - - #define EFI64_HEADER_SIZE ALIGN_UP (GRUB_PE32_MSDOS_STUB_SIZE \ - + GRUB_PE32_SIGNATURE_SIZE \ - + sizeof (struct grub_pe32_coff_header) \ - + sizeof (struct grub_pe64_optional_header) \ - + 4 * sizeof (struct grub_pe32_section_table), \ -- GRUB_PE32_SECTION_ALIGNMENT) -+ GRUB_PE32_FILE_ALIGNMENT) - - static const struct grub_install_image_target_desc image_targets[] = - { -@@ -1207,10 +1207,10 @@ grub_install_generate_image (const char *dir, const char *prefix, - header_size = EFI64_HEADER_SIZE; - - reloc_addr = ALIGN_UP (header_size + core_size, -- image_target->section_align); -+ GRUB_PE32_FILE_ALIGNMENT); - - pe_size = ALIGN_UP (reloc_addr + layout.reloc_size, -- image_target->section_align); -+ GRUB_PE32_FILE_ALIGNMENT); - pe_img = xmalloc (reloc_addr + layout.reloc_size); - memset (pe_img, 0, header_size); - memcpy ((char *) pe_img + header_size, core_img, core_size); -@@ -1260,7 +1260,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - - o->image_base = 0; - o->section_alignment = grub_host_to_target32 (image_target->section_align); -- o->file_alignment = grub_host_to_target32 (image_target->section_align); -+ o->file_alignment = grub_host_to_target32 (GRUB_PE32_FILE_ALIGNMENT); - o->image_size = grub_host_to_target32 (pe_size); - o->header_size = grub_host_to_target32 (header_size); - o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION); -@@ -1295,7 +1295,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - o->code_base = grub_cpu_to_le32 (header_size); - o->image_base = 0; - o->section_alignment = grub_host_to_target32 (image_target->section_align); -- o->file_alignment = grub_host_to_target32 (image_target->section_align); -+ o->file_alignment = grub_host_to_target32 (GRUB_PE32_FILE_ALIGNMENT); - o->image_size = grub_host_to_target32 (pe_size); - o->header_size = grub_host_to_target32 (header_size); - o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION); diff --git a/0184-arm-Move-trampolines-into-code-section.patch b/0184-arm-Move-trampolines-into-code-section.patch deleted file mode 100644 index 7d15e510..00000000 --- a/0184-arm-Move-trampolines-into-code-section.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Tue, 30 Apr 2019 22:43:56 +0200 -Subject: [PATCH] arm: Move trampolines into code section - -When creating T32->A32 transition jumps, the relocation code in grub -will generate trampolines. These trampolines live in the .data section -of our PE binary which means they are not marked as executable. - -This misbehavior was unmasked by commit a51f953f4ee87 ("mkimage: Align -efi sections on 4k boundary") which made the X/NX boundary more obvious -because everything became page aligned. - -To put things into proper order, let's move the arm trampolines into the -.text section instead. That way everyone knows they are executable. - -Fixes: a51f953f4ee87 ("mkimage: Align efi sections on 4k boundary") -Reported-by: Julien ROBIN -Reported-by: Leif Lindholm -Signed-off-by: Alexander Graf -Tested-by: Julien ROBIN -Reviewed-by: Leif Lindholm -Tested-by: Leif Lindholm -Reviewed-by: Daniel Kiper ---- - util/grub-mkimagexx.c | 32 +++++++++++++++----------------- - 1 file changed, 15 insertions(+), 17 deletions(-) - -diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index a483c674c49..86e6254a27e 100644 ---- a/util/grub-mkimagexx.c -+++ b/util/grub-mkimagexx.c -@@ -1900,6 +1900,21 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, - } - } - -+#ifdef MKIMAGE_ELF32 -+ if (image_target->elf_target == EM_ARM) -+ { -+ grub_size_t tramp; -+ -+ layout->kernel_size = ALIGN_UP (layout->kernel_size, 16); -+ -+ tramp = arm_get_trampoline_size (e, smd->sections, smd->section_entsize, -+ smd->num_sections, image_target); -+ -+ layout->tramp_off = layout->kernel_size; -+ layout->kernel_size += ALIGN_UP (tramp, 16); -+ } -+#endif -+ - layout->kernel_size = ALIGN_UP (layout->kernel_size + image_target->vaddr_offset, - image_target->section_align) - - image_target->vaddr_offset; -@@ -1913,23 +1928,6 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, - layout->kernel_size = SUFFIX (put_section) (s, i, layout->kernel_size, smd, - image_target); - --#ifdef MKIMAGE_ELF32 -- if (image_target->elf_target == EM_ARM) -- { -- grub_size_t tramp; -- layout->kernel_size = ALIGN_UP (layout->kernel_size + image_target->vaddr_offset, -- image_target->section_align) - image_target->vaddr_offset; -- -- layout->kernel_size = ALIGN_UP (layout->kernel_size, 16); -- -- tramp = arm_get_trampoline_size (e, smd->sections, smd->section_entsize, -- smd->num_sections, image_target); -- -- layout->tramp_off = layout->kernel_size; -- layout->kernel_size += ALIGN_UP (tramp, 16); -- } --#endif -- - layout->bss_start = layout->kernel_size; - layout->end = layout->kernel_size; - diff --git a/0185-arm-Align-section-alignment-with-manual-relocation-o.patch b/0185-arm-Align-section-alignment-with-manual-relocation-o.patch deleted file mode 100644 index 52285fbf..00000000 --- a/0185-arm-Align-section-alignment-with-manual-relocation-o.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Tue, 30 Apr 2019 22:43:57 +0200 -Subject: [PATCH] arm: Align section alignment with manual relocation offset - code - -The arm relocation code has a manual special case for EFI binaries to -add the natural alignment to its own relocation awareness. - -Since commit a51f953f4ee87 ("mkimage: Align efi sections on 4k -boundary") we changed that alignment from 0x400 to 0x1000 bytes. Reflect -the change in that branch that we forgot as well. - -This fixes running 32bit arm grub efi binaries for me again. - -Fixes: a51f953f4ee87 ("mkimage: Align efi sections on 4k boundary") -Reported-by: Heinrich Schuchardt -Reported-by: Steve McIntyre -Signed-off-by: Alexander Graf -Reviewed-by: Daniel Kiper -Tested-by: Julien ROBIN -Reviewed-by: Leif Lindholm -Tested-by: Leif Lindholm -Reviewed-by: Daniel Kiper ---- - util/grub-mkimagexx.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index 86e6254a27e..75773446d0f 100644 ---- a/util/grub-mkimagexx.c -+++ b/util/grub-mkimagexx.c -@@ -1099,7 +1099,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd, - (int) sym_addr, (int) sym_addr); - /* Data will be naturally aligned */ - if (image_target->id == IMAGE_EFI) -- sym_addr += 0x400; -+ sym_addr += GRUB_PE32_SECTION_ALIGNMENT; - *target = grub_host_to_target32 (grub_target_to_host32 (*target) + sym_addr); - } - break; diff --git a/0186-grub-core-loader-efi-fdt.c-Do-not-copy-random-memory.patch b/0186-grub-core-loader-efi-fdt.c-Do-not-copy-random-memory.patch deleted file mode 100644 index a4851be6..00000000 --- a/0186-grub-core-loader-efi-fdt.c-Do-not-copy-random-memory.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Heinrich Schuchardt -Date: Mon, 17 Dec 2018 22:00:24 +0100 -Subject: [PATCH] grub-core/loader/efi/fdt.c: Do not copy random memory - -We should not try to copy any memory area which is outside of the original -fdt. If this extra memory is controlled by a hypervisor this might end -with a crash. - -Signed-off-by: Heinrich Schuchardt -Reviewed-by: Leif Lindholm -Reviewed-by: Daniel Kiper ---- - grub-core/loader/efi/fdt.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c -index a9dbcfdfeaf..cecd617dccc 100644 ---- a/grub-core/loader/efi/fdt.c -+++ b/grub-core/loader/efi/fdt.c -@@ -68,7 +68,7 @@ grub_fdt_load (grub_size_t additional_size) - - if (raw_fdt) - { -- grub_memmove (fdt, raw_fdt, size); -+ grub_memmove (fdt, raw_fdt, size - additional_size); - grub_fdt_set_totalsize (fdt, size); - } - else diff --git a/0187-linux-efi-arm-fdt-break-FDT-extra-allocation-space-o.patch b/0187-linux-efi-arm-fdt-break-FDT-extra-allocation-space-o.patch deleted file mode 100644 index 164de665..00000000 --- a/0187-linux-efi-arm-fdt-break-FDT-extra-allocation-space-o.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Thu, 20 Jun 2019 16:21:48 +0100 -Subject: [PATCH] linux, efi, arm*, fdt: break FDT extra allocation space out - into a #define - -A certain amount of dynamic space is required for the handover from -GRUB/Linux-EFI-stub. This entails things like initrd addresses, -address-cells entries and associated strings. - -But move this into a proper centralised #define rather than live-code -it in the loader. - -Signed-off-by: Leif Lindholm -Reviewed-by: Daniel Kiper -Signed-off-by: Peter Robinson ---- - grub-core/loader/arm64/linux.c | 2 +- - include/grub/fdt.h | 3 +++ - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index e1110749eb9..628b320618c 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -73,7 +73,7 @@ finalize_params_linux (void) - grub_err_t err = GRUB_ERR_NONE; - void *fdt; - -- fdt = grub_fdt_load (0x400); -+ fdt = grub_fdt_load (GRUB_EFI_LINUX_FDT_EXTRA_SPACE); - if (!fdt) - { - err = grub_error(GRUB_ERR_BAD_OS, "failed to load FDT"); -diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index e34644631e1..2041341fd68 100644 ---- a/include/grub/fdt.h -+++ b/include/grub/fdt.h -@@ -24,6 +24,9 @@ - #include - #include - -+/* Space required when preparing the /chosen node after boot has been called. */ -+#define GRUB_EFI_LINUX_FDT_EXTRA_SPACE 0x400 -+ - #define FDT_MAGIC 0xD00DFEED - - typedef struct { diff --git a/bootstrap b/bootstrap new file mode 100755 index 00000000..5b08e7e2 --- /dev/null +++ b/bootstrap @@ -0,0 +1,1073 @@ +#! /bin/sh +# Print a version string. +scriptversion=2019-01-04.17; # UTC + +# Bootstrap this package from checked-out sources. + +# Copyright (C) 2003-2019 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Originally written by Paul Eggert. The canonical version of this +# script is maintained as build-aux/bootstrap in gnulib, however, to +# be useful to your project, you should place a copy of it under +# version control in the top-level directory of your project. The +# intent is that all customization can be done with a bootstrap.conf +# file also maintained in your version control; gnulib comes with a +# template build-aux/bootstrap.conf to get you started. + +# Please report bugs or propose patches to bug-gnulib@gnu.org. + +nl=' +' + +# Ensure file names are sorted consistently across platforms. +LC_ALL=C +export LC_ALL + +# Ensure that CDPATH is not set. Otherwise, the output from cd +# would cause trouble in at least one use below. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +local_gl_dir=gl + +# Honor $PERL, but work even if there is none. +PERL="${PERL-perl}" + +me=$0 + +default_gnulib_url=git://git.sv.gnu.org/gnulib + +usage() { + cat <&2 +} + +# warn_ WORD1... +warn_ () +{ + # If IFS does not start with ' ', set it and emit the warning in a subshell. + case $IFS in + ' '*) warnf_ '%s\n' "$*";; + *) (IFS=' '; warn_ "$@");; + esac +} + +# die WORD1... +die() { warn_ "$@"; exit 1; } + +# Configuration. + +# Name of the Makefile.am +gnulib_mk=gnulib.mk + +# List of gnulib modules needed. +gnulib_modules= + +# Any gnulib files needed that are not in modules. +gnulib_files= + +: ${AUTOPOINT=autopoint} +: ${AUTORECONF=autoreconf} + +# A function to be called right after gnulib-tool is run. +# Override it via your own definition in bootstrap.conf. +bootstrap_post_import_hook() { :; } + +# A function to be called after everything else in this script. +# Override it via your own definition in bootstrap.conf. +bootstrap_epilogue() { :; } + +# The command to download all .po files for a specified domain into a +# specified directory. Fill in the first %s with the destination +# directory and the second with the domain name. +po_download_command_format=\ +"wget --mirror --level=1 -nd -q -A.po -P '%s' \ + https://translationproject.org/latest/%s/" + +# Prefer a non-empty tarname (4th argument of AC_INIT if given), else +# fall back to the package name (1st argument with munging) +extract_package_name=' + /^AC_INIT(\[*/{ + s/// + /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{ + s//\1/ + s/[],)].*// + p + q + } + s/[],)].*// + s/^GNU // + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g + p + } +' +package=$(sed -n "$extract_package_name" configure.ac) \ + || die 'cannot find package name in configure.ac' +gnulib_name=lib$package + +build_aux=build-aux +source_base=lib +m4_base=m4 +doc_base=doc +tests_base=tests +gnulib_extra_files=" + build-aux/install-sh + build-aux/mdate-sh + build-aux/texinfo.tex + build-aux/depcomp + build-aux/config.guess + build-aux/config.sub + doc/INSTALL +" + +# Additional gnulib-tool options to use. Use "\newline" to break lines. +gnulib_tool_option_extras= + +# Other locale categories that need message catalogs. +EXTRA_LOCALE_CATEGORIES= + +# Additional xgettext options to use. Use "\\\newline" to break lines. +XGETTEXT_OPTIONS='\\\ + --flag=_:1:pass-c-format\\\ + --flag=N_:1:pass-c-format\\\ + --flag=error:3:c-format --flag=error_at_line:5:c-format\\\ +' + +# Package bug report address and copyright holder for gettext files +COPYRIGHT_HOLDER='Free Software Foundation, Inc.' +MSGID_BUGS_ADDRESS=bug-$package@gnu.org + +# Files we don't want to import. +excluded_files= + +# File that should exist in the top directory of a checked out hierarchy, +# but not in a distribution tarball. +checkout_only_file=README-hacking + +# Whether to use copies instead of symlinks. +copy=false + +# Set this to '.cvsignore .gitignore' in bootstrap.conf if you want +# those files to be generated in directories like lib/, m4/, and po/. +# Or set it to 'auto' to make this script select which to use based +# on which version control system (if any) is used in the source directory. +vc_ignore=auto + +# Set this to true in bootstrap.conf to enable --bootstrap-sync by +# default. +bootstrap_sync=false + +# Use git to update gnulib sources +use_git=true + +check_exists() { + if test "$1" = "--verbose"; then + ($2 --version /dev/null 2>&1 + if test $? -ge 126; then + # If not found, run with diagnostics as one may be + # presented with env variables to set to find the right version + ($2 --version /dev/null 2>&1 + fi + + test $? -lt 126 +} + +# find_tool ENVVAR NAMES... +# ------------------------- +# Search for a required program. Use the value of ENVVAR, if set, +# otherwise find the first of the NAMES that can be run. +# If found, set ENVVAR to the program name, die otherwise. +# +# FIXME: code duplication, see also gnu-web-doc-update. +find_tool () +{ + find_tool_envvar=$1 + shift + find_tool_names=$@ + eval "find_tool_res=\$$find_tool_envvar" + if test x"$find_tool_res" = x; then + for i; do + if check_exists $i; then + find_tool_res=$i + break + fi + done + fi + if test x"$find_tool_res" = x; then + warn_ "one of these is required: $find_tool_names;" + die "alternatively set $find_tool_envvar to a compatible tool" + fi + eval "$find_tool_envvar=\$find_tool_res" + eval "export $find_tool_envvar" +} + +# Override the default configuration, if necessary. +# Make sure that bootstrap.conf is sourced from the current directory +# if we were invoked as "sh bootstrap". +case "$0" in + */*) test -r "$0.conf" && . "$0.conf" ;; + *) test -r "$0.conf" && . ./"$0.conf" ;; +esac + +if test "$vc_ignore" = auto; then + vc_ignore= + test -d .git && vc_ignore=.gitignore + test -d CVS && vc_ignore="$vc_ignore .cvsignore" +fi + +if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then + use_gnulib=false +else + use_gnulib=true +fi + +# Translate configuration into internal form. + +# Parse options. + +for option +do + case $option in + --help) + usage + exit;; + --gnulib-srcdir=*) + GNULIB_SRCDIR=${option#--gnulib-srcdir=};; + --skip-po) + SKIP_PO=t;; + --force) + checkout_only_file=;; + --copy) + copy=true;; + --bootstrap-sync) + bootstrap_sync=true;; + --no-bootstrap-sync) + bootstrap_sync=false;; + --no-git) + use_git=false;; + *) + die "$option: unknown option";; + esac +done + +$use_git || test -d "$GNULIB_SRCDIR" \ + || die "Error: --no-git requires --gnulib-srcdir" + +if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then + die "Bootstrapping from a non-checked-out distribution is risky." +fi + +# Strip blank and comment lines to leave significant entries. +gitignore_entries() { + sed '/^#/d; /^$/d' "$@" +} + +# If $STR is not already on a line by itself in $FILE, insert it at the start. +# Entries are inserted at the start of the ignore list to ensure existing +# entries starting with ! are not overridden. Such entries support +# whitelisting exceptions after a more generic blacklist pattern. +insert_if_absent() { + file=$1 + str=$2 + test -f $file || touch $file + test -r $file || die "Error: failed to read ignore file: $file" + duplicate_entries=$(gitignore_entries $file | sort | uniq -d) + if [ "$duplicate_entries" ] ; then + die "Error: Duplicate entries in $file: " $duplicate_entries + fi + linesold=$(gitignore_entries $file | wc -l) + linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) + if [ $linesold != $linesnew ] ; then + { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ + || die "insert_if_absent $file $str: failed" + fi +} + +# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with +# insert_if_absent. +insert_vc_ignore() { + vc_ignore_file="$1" + pattern="$2" + case $vc_ignore_file in + *.gitignore) + # A .gitignore entry that does not start with '/' applies + # recursively to subdirectories, so prepend '/' to every + # .gitignore entry. + pattern=$(echo "$pattern" | sed s,^,/,);; + esac + insert_if_absent "$vc_ignore_file" "$pattern" +} + +# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. +found_aux_dir=no +grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ + >/dev/null && found_aux_dir=yes +grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \ + >/dev/null && found_aux_dir=yes +test $found_aux_dir = yes \ + || die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it" + +# If $build_aux doesn't exist, create it now, otherwise some bits +# below will malfunction. If creating it, also mark it as ignored. +if test ! -d $build_aux; then + mkdir $build_aux + for dot_ig in x $vc_ignore; do + test $dot_ig = x && continue + insert_vc_ignore $dot_ig $build_aux + done +fi + +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +sort_ver() { # sort -V is not generally available + ver1="$1" + ver2="$2" + + # split on '.' and compare each component + i=1 + while : ; do + p1=$(echo "$ver1" | cut -d. -f$i) + p2=$(echo "$ver2" | cut -d. -f$i) + if [ ! "$p1" ]; then + echo "$1 $2" + break + elif [ ! "$p2" ]; then + echo "$2 $1" + break + elif [ ! "$p1" = "$p2" ]; then + if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison + echo "$2 $1" + elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison + echo "$1 $2" + else # numeric, then lexicographic comparison + lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1) + if [ "$lp" = "$p2" ]; then + echo "$1 $2" + else + echo "$2 $1" + fi + fi + break + fi + i=$(($i+1)) + done +} + +get_version_sed=' +# Move version to start of line. +s/.*[v ]\([0-9]\)/\1/ + +# Skip lines that do not start with version. +/^[0-9]/!d + +# Remove characters after the version. +s/[^.a-z0-9-].*// + +# The first component must be digits only. +s/^\([0-9]*\)[a-z-].*/\1/ + +#the following essentially does s/5.005/5.5/ +s/\.0*\([1-9]\)/.\1/g +p +q' + +get_version() { + app=$1 + + $app --version >/dev/null 2>&1 || { $app --version; return 1; } + + $app --version 2>&1 | sed -n "$get_version_sed" +} + +check_versions() { + ret=0 + + while read app req_ver; do + # We only need libtoolize from the libtool package. + if test "$app" = libtool; then + app=libtoolize + fi + # Exempt git if --no-git is in effect. + if test "$app" = git; then + $use_git || continue + fi + # Honor $APP variables ($TAR, $AUTOCONF, etc.) + appvar=$(echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_') + test "$appvar" = TAR && appvar=AMTAR + case $appvar in + GZIP) ;; # Do not use $GZIP: it contains gzip options. + PERL::*) ;; # Keep perl modules as-is + *) eval "app=\${$appvar-$app}" ;; + esac + + # Handle the still-experimental Automake-NG programs specially. + # They remain named as the mainstream Automake programs ("automake", + # and "aclocal") to avoid gratuitous incompatibilities with + # pre-existing usages (by, say, autoreconf, or custom autogen.sh + # scripts), but correctly identify themselves (as being part of + # "GNU automake-ng") when asked their version. + case $app in + automake-ng|aclocal-ng) + app=${app%-ng} + ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || { + warn_ "Error: '$app' not found or not from Automake-NG" + ret=1 + continue + } ;; + # Another check is for perl modules. These can be written as + # e.g. perl::XML::XPath in case of XML::XPath module, etc. + perl::*) + # Extract module name + app="${app#perl::}" + if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then + warn_ "Error: perl module '$app' not found" + ret=1 + fi + continue + ;; + esac + if [ "$req_ver" = "-" ]; then + # Merely require app to exist; not all prereq apps are well-behaved + # so we have to rely on $? rather than get_version. + if ! check_exists --verbose $app; then + warn_ "Error: '$app' not found" + ret=1 + fi + else + # Require app to produce a new enough version string. + inst_ver=$(get_version $app) + if [ ! "$inst_ver" ]; then + warn_ "Error: '$app' not found" + ret=1 + else + latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2) + if [ ! "$latest_ver" = "$inst_ver" ]; then + warnf_ '%s\n' \ + "Error: '$app' version == $inst_ver is too old" \ + " '$app' version >= $req_ver is required" + ret=1 + fi + fi + fi + done + + return $ret +} + +print_versions() { + echo "Program Min_version" + echo "----------------------" + printf %s "$buildreq" + echo "----------------------" + # can't depend on column -t +} + +# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6. +# Also find the compatible sha1 utility on the BSDs +if test x"$SKIP_PO" = x; then + find_tool SHA1SUM sha1sum gsha1sum shasum sha1 +fi + +use_libtool=0 +# We'd like to use grep -E, to see if any of LT_INIT, +# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, +# but that's not portable enough (e.g., for Solaris). +grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ + && use_libtool=1 +grep '^[ ]*LT_INIT' configure.ac >/dev/null \ + && use_libtool=1 +if test $use_libtool = 1; then + find_tool LIBTOOLIZE glibtoolize libtoolize +fi + +# gnulib-tool requires at least automake and autoconf. +# If either is not listed, add it (with minimum version) as a prerequisite. +case $buildreq in + *automake*) ;; + *) buildreq="automake 1.9 +$buildreq" ;; +esac +case $buildreq in + *autoconf*) ;; + *) buildreq="autoconf 2.59 +$buildreq" ;; +esac + +# When we can deduce that gnulib-tool will require patch, +# and when patch is not already listed as a prerequisite, add it, too. +if test -d "$local_gl_dir" \ + && ! find "$local_gl_dir" -name '*.diff' -exec false {} +; then + case $buildreq in + *patch*) ;; + *) buildreq="patch - +$buildreq" ;; + esac +fi + +if ! printf "$buildreq" | check_versions; then + echo >&2 + if test -f README-prereq; then + die "See README-prereq for how to get the prerequisite programs" + else + die "Please install the prerequisite programs" + fi +fi + +# Warn the user if autom4te appears to be broken; this causes known +# issues with at least gettext 0.18.3. +probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -) +if test "x$probe" != xhi; then + warn_ "WARNING: your autom4te wrapper eats stdin;" + warn_ "if bootstrap fails, consider upgrading your autotools" +fi + +echo "$0: Bootstrapping from checked-out $package sources..." + +# See if we can use gnulib's git-merge-changelog merge driver. +if $use_git && test -d .git && check_exists git; then + if git config merge.merge-changelog.driver >/dev/null ; then + : + elif check_exists git-merge-changelog; then + echo "$0: initializing git-merge-changelog driver" + git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' + git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' + else + echo "$0: consider installing git-merge-changelog from gnulib" + fi +fi + + +cleanup_gnulib() { + status=$? + rm -fr "$gnulib_path" + exit $status +} + +git_modules_config () { + test -f .gitmodules && git config --file .gitmodules "$@" +} + +if $use_gnulib; then + if $use_git; then + gnulib_path=$(git_modules_config submodule.gnulib.path) + test -z "$gnulib_path" && gnulib_path=gnulib + fi + + # Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a + # submodule, for use in the rest of the script. + + case ${GNULIB_SRCDIR--} in + -) + # Note that $use_git is necessarily true in this case. + if git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + git submodule init -- "$gnulib_path" || exit $? + git submodule update -- "$gnulib_path" || exit $? + + elif [ ! -d "$gnulib_path" ]; then + echo "$0: getting gnulib files..." + + trap cleanup_gnulib 1 2 13 15 + + shallow= + if test -z "$GNULIB_REVISION"; then + git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' + fi + git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ + || cleanup_gnulib + + trap - 1 2 13 15 + fi + GNULIB_SRCDIR=$gnulib_path + ;; + *) + # Use GNULIB_SRCDIR directly or as a reference. + if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ + git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + if git submodule -h|grep -- --reference > /dev/null; then + # Prefer the one-liner available in git 1.6.4 or newer. + git submodule update --init --reference "$GNULIB_SRCDIR" \ + "$gnulib_path" || exit $? + else + # This fallback allows at least git 1.5.5. + if test -f "$gnulib_path"/gnulib-tool; then + # Since file already exists, assume submodule init already complete. + git submodule update -- "$gnulib_path" || exit $? + else + # Older git can't clone into an empty directory. + rmdir "$gnulib_path" 2>/dev/null + git clone --reference "$GNULIB_SRCDIR" \ + "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ + && git submodule init -- "$gnulib_path" \ + && git submodule update -- "$gnulib_path" \ + || exit $? + fi + fi + GNULIB_SRCDIR=$gnulib_path + fi + ;; + esac + + if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \ + && ! git_modules_config submodule.gnulib.url >/dev/null; then + (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib + fi + + # $GNULIB_SRCDIR now points to the version of gnulib to use, and + # we no longer need to use git or $gnulib_path below here. + + if $bootstrap_sync; then + cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { + echo "$0: updating bootstrap and restarting..." + case $(sh -c 'echo "$1"' -- a) in + a) ignored=--;; + *) ignored=ignored;; + esac + exec sh -c \ + 'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \ + $ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \ + "$0" "$@" --no-bootstrap-sync + } + fi + + gnulib_tool=$GNULIB_SRCDIR/gnulib-tool + <$gnulib_tool || exit $? +fi + +# Get translations. + +download_po_files() { + subdir=$1 + domain=$2 + echo "$me: getting translations into $subdir for $domain..." + cmd=$(printf "$po_download_command_format" "$subdir" "$domain") + eval "$cmd" +} + +# Mirror .po files to $po_dir/.reference and copy only the new +# or modified ones into $po_dir. Also update $po_dir/LINGUAS. +# Note po files that exist locally only are left in $po_dir but will +# not be included in LINGUAS and hence will not be distributed. +update_po_files() { + # Directory containing primary .po files. + # Overwrite them only when we're sure a .po file is new. + po_dir=$1 + domain=$2 + + # Mirror *.po files into this dir. + # Usually contains *.s1 checksum files. + ref_po_dir="$po_dir/.reference" + + test -d $ref_po_dir || mkdir $ref_po_dir || return + download_po_files $ref_po_dir $domain \ + && ls "$ref_po_dir"/*.po 2>/dev/null | + sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return + + langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g') + test "$langs" = '*' && langs=x + for po in $langs; do + case $po in x) continue;; esac + new_po="$ref_po_dir/$po.po" + cksum_file="$ref_po_dir/$po.s1" + if ! test -f "$cksum_file" || + ! test -f "$po_dir/$po.po" || + ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then + echo "$me: updated $po_dir/$po.po..." + cp "$new_po" "$po_dir/$po.po" \ + && $SHA1SUM < "$new_po" > "$cksum_file" || return + fi + done +} + +case $SKIP_PO in +'') + if test -d po; then + update_po_files po $package || exit + fi + + if test -d runtime-po; then + update_po_files runtime-po $package-runtime || exit + fi;; +esac + +symlink_to_dir() +{ + src=$1/$2 + dst=${3-$2} + + test -f "$src" && { + + # If the destination directory doesn't exist, create it. + # This is required at least for "lib/uniwidth/cjk.h". + dst_dir=$(dirname "$dst") + if ! test -d "$dst_dir"; then + mkdir -p "$dst_dir" + + # If we've just created a directory like lib/uniwidth, + # tell version control system(s) it's ignorable. + # FIXME: for now, this does only one level + parent=$(dirname "$dst_dir") + for dot_ig in x $vc_ignore; do + test $dot_ig = x && continue + ig=$parent/$dot_ig + insert_vc_ignore $ig "${dst_dir##*/}" + done + fi + + if $copy; then + { + test ! -h "$dst" || { + echo "$me: rm -f $dst" && + rm -f "$dst" + } + } && + test -f "$dst" && + cmp -s "$src" "$dst" || { + echo "$me: cp -fp $src $dst" && + cp -fp "$src" "$dst" + } + else + # Leave any existing symlink alone, if it already points to the source, + # so that broken build tools that care about symlink times + # aren't confused into doing unnecessary builds. Conversely, if the + # existing symlink's timestamp is older than the source, make it afresh, + # so that broken tools aren't confused into skipping needed builds. See + # . + test -h "$dst" && + src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && + dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && + test "$src_i" = "$dst_i" && + both_ls=$(ls -dt "$src" "$dst") && + test "X$both_ls" = "X$dst$nl$src" || { + dot_dots= + case $src in + /*) ;; + *) + case /$dst/ in + *//* | */../* | */./* | /*/*/*/*/*/) + die "invalid symlink calculation: $src -> $dst";; + /*/*/*/*/) dot_dots=../../../;; + /*/*/*/) dot_dots=../../;; + /*/*/) dot_dots=../;; + esac;; + esac + + echo "$me: ln -fs $dot_dots$src $dst" && + ln -fs "$dot_dots$src" "$dst" + } + fi + } +} + +version_controlled_file() { + parent=$1 + file=$2 + if test -d .git; then + git rm -n "$file" > /dev/null 2>&1 + elif test -d .svn; then + svn log -r HEAD "$file" > /dev/null 2>&1 + elif test -d CVS; then + grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null | + grep '^/[^/]*/[0-9]' > /dev/null + else + warn_ "no version control for $file?" + false + fi +} + +# NOTE: we have to be careful to run both autopoint and libtoolize +# before gnulib-tool, since gnulib-tool is likely to provide newer +# versions of files "installed" by these two programs. +# Then, *after* gnulib-tool (see below), we have to be careful to +# run autoreconf in such a way that it does not run either of these +# two just-pre-run programs. + +# Import from gettext. +with_gettext=yes +grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \ + with_gettext=no + +if test $with_gettext = yes || test $use_libtool = 1; then + + tempbase=.bootstrap$$ + trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15 + + > $tempbase.0 > $tempbase.1 && + find . ! -type d -print | sort > $tempbase.0 || exit + + if test $with_gettext = yes; then + # Released autopoint has the tendency to install macros that have been + # obsoleted in current gnulib, so run this before gnulib-tool. + echo "$0: $AUTOPOINT --force" + $AUTOPOINT --force || exit + fi + + # Autoreconf runs aclocal before libtoolize, which causes spurious + # warnings if the initial aclocal is confused by the libtoolized + # (or worse out-of-date) macro directory. + # libtoolize 1.9b added the --install option; but we support back + # to libtoolize 1.5.22, where the install action was default. + if test $use_libtool = 1; then + install= + case $($LIBTOOLIZE --help) in + *--install*) install=--install ;; + esac + echo "running: $LIBTOOLIZE $install --copy" + $LIBTOOLIZE $install --copy + fi + + find . ! -type d -print | sort >$tempbase.1 + old_IFS=$IFS + IFS=$nl + for file in $(comm -13 $tempbase.0 $tempbase.1); do + IFS=$old_IFS + parent=${file%/*} + version_controlled_file "$parent" "$file" || { + for dot_ig in x $vc_ignore; do + test $dot_ig = x && continue + ig=$parent/$dot_ig + insert_vc_ignore "$ig" "${file##*/}" + done + } + done + IFS=$old_IFS + + rm -f $tempbase.0 $tempbase.1 + trap - 1 2 13 15 +fi + +# Import from gnulib. + +if $use_gnulib; then + gnulib_tool_options="\ + --no-changelog\ + --aux-dir=$build_aux\ + --doc-base=$doc_base\ + --lib=$gnulib_name\ + --m4-base=$m4_base/\ + --source-base=$source_base/\ + --tests-base=$tests_base\ + --local-dir=$local_gl_dir\ + $gnulib_tool_option_extras\ + " + if test $use_libtool = 1; then + case "$gnulib_tool_options " in + *' --libtool '*) ;; + *) gnulib_tool_options="$gnulib_tool_options --libtool" ;; + esac + fi + echo "$0: $gnulib_tool $gnulib_tool_options --import ..." + $gnulib_tool $gnulib_tool_options --import $gnulib_modules \ + || die "gnulib-tool failed" + + for file in $gnulib_files; do + symlink_to_dir "$GNULIB_SRCDIR" $file \ + || die "failed to symlink $file" + done +fi + +bootstrap_post_import_hook \ + || die "bootstrap_post_import_hook failed" + +# Don't proceed if there are uninitialized submodules. In particular, +# the next step will remove dangling links, which might be links into +# uninitialized submodules. +# +# Uninitialized submodules are listed with an initial dash. +if $use_git && git submodule | grep '^-' >/dev/null; then + die "some git submodules are not initialized. " \ + "Run 'git submodule init' and bootstrap again." +fi + +# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some +# gnulib-populated directories. Such .m4 files would cause aclocal to fail. +# The following requires GNU find 4.2.3 or newer. Considering the usual +# portability constraints of this script, that may seem a very demanding +# requirement, but it should be ok. Ignore any failure, which is fine, +# since this is only a convenience to help developers avoid the relatively +# unusual case in which a symlinked-to .m4 file is git-removed from gnulib +# between successive runs of this script. +find "$m4_base" "$source_base" \ + -depth \( -name '*.m4' -o -name '*.[ch]' \) \ + -type l -xtype l -delete > /dev/null 2>&1 + +# Invoke autoreconf with --force --install to ensure upgrades of tools +# such as ylwrap. +AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS" + +# Some systems (RHEL 5) are using ancient autotools, for which the +# --no-recursive option had not been invented. Detect that lack and +# omit the option when it's not supported. FIXME in 2017: remove this +# hack when RHEL 5 autotools are updated, or when they become irrelevant. +case $($AUTORECONF --help) in + *--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";; +esac + +# Tell autoreconf not to invoke autopoint or libtoolize; they were run above. +echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS" +AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \ + || die "autoreconf failed" + +# Get some extra files from gnulib, overriding existing files. +for file in $gnulib_extra_files; do + case $file in + */INSTALL) dst=INSTALL;; + build-aux/*) dst=$build_aux/${file#build-aux/};; + *) dst=$file;; + esac + symlink_to_dir "$GNULIB_SRCDIR" $file $dst \ + || die "failed to symlink $file" +done + +if test $with_gettext = yes; then + # Create gettext configuration. + echo "$0: Creating po/Makevars from po/Makevars.template ..." + rm -f po/Makevars + sed ' + /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/ + /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/ + /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'| + /^XGETTEXT_OPTIONS *=/{ + s/$/ \\/ + a\ + '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+} + } + ' po/Makevars.template >po/Makevars \ + || die 'cannot generate po/Makevars' + + # If the 'gettext' module is in use, grab the latest Makefile.in.in. + # If only the 'gettext-h' module is in use, assume autopoint already + # put the correct version of this file into place. + case $gnulib_modules in + *gettext-h*) ;; + *gettext*) + cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \ + || die "cannot create po/Makefile.in.in" + ;; + esac + + if test -d runtime-po; then + # Similarly for runtime-po/Makevars, but not quite the same. + rm -f runtime-po/Makevars + sed ' + /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/ + /^subdir *=.*/s/=.*/= runtime-po/ + /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/ + /^XGETTEXT_OPTIONS *=/{ + s/$/ \\/ + a\ + '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+} + } + ' po/Makevars.template >runtime-po/Makevars \ + || die 'cannot generate runtime-po/Makevars' + + # Copy identical files from po to runtime-po. + (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po) + fi +fi + +bootstrap_epilogue + +echo "$0: done. Now you can run './configure'." + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/bootstrap.conf b/bootstrap.conf new file mode 100644 index 00000000..988dda09 --- /dev/null +++ b/bootstrap.conf @@ -0,0 +1,91 @@ +# Bootstrap configuration. + +# Copyright (C) 2006-2019 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 + +# gnulib modules used by this package. +# mbswidth is used by gnulib-fix-width.diff's changes to argp rather than +# directly. +gnulib_modules=" + argp + error + fnmatch + getdelim + getline + gettext-h + gitlog-to-changelog + mbswidth + progname + realloc-gnu + regex + save-cwd +" + +gnulib_tool_option_extras="\ + --no-conditional-dependencies \ + --no-vc-files \ +" + +gnulib_name=libgnu +source_base=grub-core/lib/gnulib +gnulib_extra_files=" + build-aux/install-sh + build-aux/mdate-sh + build-aux/texinfo.tex + build-aux/depcomp + build-aux/config.guess + build-aux/config.sub +" + +# Additional xgettext options to use. Use "\\\newline" to break lines. +XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\ + --from-code=UTF-8\\\ +' + +checkout_only_file= +copy=true +vc_ignore= + +SKIP_PO=t + +# Build prerequisites +buildreq="\ +autoconf 2.63 +automake 1.11 +gettext 0.18.3 +git 1.5.5 +tar - +" + +# bootstrap doesn't give us a reasonable way to stop Automake from +# overwriting this, so we just copy our version aside and put it back later. +cp -a INSTALL INSTALL.grub + +bootstrap_post_import_hook () { + set -e + for patchname in fix-null-deref fix-width no-abort; do + patch -d grub-core/lib/gnulib -p2 \ + < "grub-core/lib/gnulib-patches/$patchname.patch" + done + FROM_BOOTSTRAP=1 ./autogen.sh + set +e # bootstrap expects this +} + +bootstrap_epilogue () { + mv INSTALL.grub INSTALL +} diff --git a/do-rebase b/do-rebase index ca10bf94..1f9b21c2 100755 --- a/do-rebase +++ b/do-rebase @@ -155,9 +155,21 @@ fi unset LC_ALL git rm -q 0*.patch -> release-to-master.patch -othergit diff --full-index --binary $diff_ops grub-2.02..refs/remotes/rhboot/master > release-to-master.patch -git add release-to-master.patch +# No need for this patch anymore, the package is rebased on latest release now. +#> release-to-master.patch +#othergit diff --full-index --binary $diff_ops grub-2.04..refs/remotes/rhboot/master > release-to-master.patch +#git add release-to-master.patch + +fedpkg sources +curl -L https://github.com/rhboot/gnulib/archive/fixes.tar.gz > gnulib-fixes.tar.gz.new +if cmp -s gnulib-fixes.tar.gz gnulib-fixes.tar.gz.new; then + rm gnulib-fixes.tar.gz.new +else + mv gnulib-fixes.tar.gz.new gnulib-fixes.tar.gz + sed -i -e '/gnulib-/d' sources + fedpkg upload gnulib-fixes.tar.gz + git add sources +fi > grub.patches patches=$(formatpatch refs/remotes/rhboot/master..refs/remotes/rhboot/${releasever}) diff --git a/gitignore b/gitignore index eca17bec..819cd185 100644 --- a/gitignore +++ b/gitignore @@ -1,3 +1,4 @@ +*~ 00_header 10_* 20_linux_xen @@ -6,11 +7,13 @@ 41_custom *.1 *.8 +ABOUT-NLS aclocal.m4 ahci_test ascii.bitmaps ascii.h autom4te.cache +build-aux build-grub-gen-asciih build-grub-gen-widthspec build-grub-mkfont @@ -42,6 +45,7 @@ gensymlist.sh gentrigtables gentrigtables.exe gettext_strings_test +/gnulib grub-bin2h /grub-bios-setup /grub-bios-setup.exe @@ -134,6 +138,7 @@ help_test *.image.exe include/grub/cpu include/grub/machine +INSTALL.grub install-sh lib/libgcrypt-grub libgrub_a_init.c @@ -142,6 +147,7 @@ libgrub_a_init.c lzocompress_test *.marker Makefile +/m4 *.mod mod-*.c missing @@ -155,7 +161,11 @@ pata_test *.pp po/*.mo po/grub.pot +po/Makefile.in.in +po/Makevars +po/Makevars.template po/POTFILES +po/Rules-quot po/stamp-po printf_test priority_queue_unit_test @@ -202,25 +212,7 @@ grub-core/*.module.exe grub-core/*.pp grub-core/kernel.img.bin util/bash-completion.d/grub -grub-core/gnulib/alloca.h -grub-core/gnulib/arg-nonnull.h -grub-core/gnulib/c++defs.h -grub-core/gnulib/charset.alias -grub-core/gnulib/configmake.h -grub-core/gnulib/float.h -grub-core/gnulib/getopt.h -grub-core/gnulib/langinfo.h -grub-core/gnulib/ref-add.sed -grub-core/gnulib/ref-del.sed -grub-core/gnulib/stdio.h -grub-core/gnulib/stdlib.h -grub-core/gnulib/string.h -grub-core/gnulib/strings.h -grub-core/gnulib/sys -grub-core/gnulib/unistd.h -grub-core/gnulib/warn-on-use.h -grub-core/gnulib/wchar.h -grub-core/gnulib/wctype.h +grub-core/lib/gnulib grub-core/rs_decoder.h widthspec.bin widthspec.h @@ -239,10 +231,6 @@ po/POTFILES-shell.in /grub-render-label /grub-glue-efi.exe /grub-render-label.exe -grub-core/gnulib/locale.h -grub-core/gnulib/unitypes.h -grub-core/gnulib/uniwidth.h -build-aux/test-driver /garbage-gen /garbage-gen.exe /grub-fs-tester diff --git a/grub.macros b/grub.macros index 6b9c0052..5da3592e 100644 --- a/grub.macros +++ b/grub.macros @@ -312,7 +312,12 @@ This subpackage provides optional components of grub used with removeable media %setup -q -n grub-%{tarversion} \ rm -fv docs/*.info \ cp %{SOURCE6} .gitignore \ -cp %{SOURCE8} ./grub-core/tests/strtoull_test.c \ +cp %{SOURCE7} bootstrap \ +cp %{SOURCE8} bootstrap.conf \ +cp %{SOURCE9} ./grub-core/tests/strtoull_test.c \ +cp %{SOURCE12} gnulib-%{gnulibversion}.tar.gz \ +tar -zxf gnulib-%{gnulibversion}.tar.gz \ +mv gnulib-%{gnulibversion} gnulib \ git init \ echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore \ echo '!*.[[:digit:]]' > util/.gitignore \ @@ -323,14 +328,12 @@ git config gc.auto 0 \ rm -f configure \ git add . \ git commit -a -q -m "%{tarversion} baseline." \ -git apply --index --whitespace=nowarn %{SOURCE3} \ -git commit -a -q -m "%{tarversion} master." \ +#git apply --index --whitespace=nowarn %{SOURCE3} \ +#git commit -a -q -m "%{tarversion} master." \ git am --whitespace=nowarn %%{patches} - 2.04-1 +- Update to 2.04 + Resolves: rhbz#1727279 + * Wed Aug 07 2019 Javier Martinez Canillas - 2.02-97 - Include regexp module in EFI builds diff --git a/release-to-master.patch b/release-to-master.patch deleted file mode 100644 index a1b6e6a0..00000000 --- a/release-to-master.patch +++ /dev/null @@ -1,16760 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index edd184154f7e9aad556b6437b8ec22bc79d5a057..c7888e40f6695ee23a43fb98420d6cbcd3d86622 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -31,7 +31,7 @@ dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables - dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are - dnl used for the target type. See INSTALL for full list of variables. - --AC_INIT([GRUB],[2.02],[bug-grub@gnu.org]) -+AC_INIT([GRUB],[2.03],[bug-grub@gnu.org]) - - AC_CONFIG_AUX_DIR([build-aux]) - -@@ -167,6 +167,7 @@ case "$target_cpu"-"$platform" in - mipsel-fuloong) platform=loongson ;; - mipsel-loongson) ;; - arm-uboot) ;; -+ arm-coreboot) ;; - arm-efi) ;; - arm64-efi) ;; - *-emu) ;; -@@ -203,7 +204,8 @@ case "$host_os" in - esac - - case "$host_os" in -- cygwin | windows* | mingw32*) have_exec=n ;; -+ cygwin) have_exec=y ;; -+ windows* | mingw32*) have_exec=n ;; - aros*) have_exec=n ;; - *) have_exec=y;; - esac -@@ -373,7 +375,10 @@ case "$host_os" in - ;; - *) - AC_CHECK_SIZEOF(off_t) -- test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);; -+ if test x"$ac_cv_sizeof_off_t" != x8 ; then -+ AC_CHECK_SIZEOF(off64_t) -+ test x"$ac_cv_sizeof_off64_t" = x8 || AC_MSG_ERROR([Large file support is required]) -+ fi;; - esac - - if test x$USE_NLS = xno; then -@@ -456,6 +461,16 @@ case "$build_os" in - esac - AC_SUBST(BUILD_EXEEXT) - -+# In some build environments like termux /bin/sh is not a valid -+# shebang. Use $SHELL instead if it's executable and /bin/sh isn't -+BUILD_SHEBANG=/bin/sh -+for she in /bin/sh "$SHELL"; do -+ if test -x "$she" ; then -+ BUILD_SHEBANG="$she" -+ fi -+done -+AC_SUBST(BUILD_SHEBANG) -+ - # For gnulib. - gl_INIT - -@@ -1905,6 +1920,7 @@ AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel]) - AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips]) - AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ]) - AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot]) -+AM_CONDITIONAL([COND_arm_coreboot], [test x$target_cpu = xarm -a x$platform = xcoreboot]) - AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi]) - AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ]) - AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi]) -diff --git a/Makefile.util.def b/Makefile.util.def -index f9caccb9780ffe8d4b31c8a19399ba7bbd308e56..3180ac880a9aa86e94fb47a7386bfa324425bff0 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -99,6 +99,7 @@ library = { - common = grub-core/fs/ext2.c; - common = grub-core/fs/fat.c; - common = grub-core/fs/exfat.c; -+ common = grub-core/fs/f2fs.c; - common = grub-core/fs/fshelp.c; - common = grub-core/fs/hfs.c; - common = grub-core/fs/hfsplus.c; -@@ -774,6 +775,12 @@ script = { - common = tests/xfs_test.in; - }; - -+script = { -+ testcase; -+ name = f2fs_test; -+ common = tests/f2fs_test.in; -+}; -+ - script = { - testcase; - name = nilfs2_test; -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 2dfa22a9271bd6624fad9b91ce051ac12202dfbd..9590e87d9c080d6675a9521d91ef6a47d39f2751 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -68,11 +68,11 @@ kernel = { - i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000'; - i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; -- i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8200'; -+ i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000'; - i386_coreboot_ldflags = '$(TARGET_IMG_LDFLAGS)'; -- i386_coreboot_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8200'; -+ i386_coreboot_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000'; - i386_multiboot_ldflags = '$(TARGET_IMG_LDFLAGS)'; -- i386_multiboot_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8200'; -+ i386_multiboot_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000'; - i386_ieee1275_ldflags = '$(TARGET_IMG_LDFLAGS)'; - i386_ieee1275_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x10000'; - i386_xen_ldflags = '$(TARGET_IMG_LDFLAGS)'; -@@ -92,6 +92,8 @@ kernel = { - emu_cppflags = '$(CPPFLAGS_GNULIB)'; - arm_uboot_ldflags = '-Wl,-r,-d'; - arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; -+ arm_coreboot_ldflags = '-Wl,-r,-d'; -+ arm_coreboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version'; - - i386_pc_startup = kern/i386/pc/startup.S; - i386_efi_startup = kern/i386/efi/startup.S; -@@ -105,7 +107,8 @@ kernel = { - mips_startup = kern/mips/startup.S; - sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S; - powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S; -- arm_uboot_startup = kern/arm/uboot/startup.S; -+ arm_uboot_startup = kern/arm/startup.S; -+ arm_coreboot_startup = kern/arm/startup.S; - arm_efi_startup = kern/arm/efi/startup.S; - arm64_efi_startup = kern/arm64/efi/startup.S; - -@@ -149,6 +152,21 @@ kernel = { - uboot = kern/uboot/init.c; - uboot = kern/uboot/hw.c; - uboot = term/uboot/console.c; -+ arm_uboot = kern/arm/uboot/init.c; -+ arm_uboot = kern/arm/uboot/uboot.S; -+ -+ arm_coreboot = kern/arm/coreboot/init.c; -+ arm_coreboot = kern/arm/coreboot/timer.c; -+ arm_coreboot = kern/arm/coreboot/coreboot.S; -+ arm_coreboot = lib/fdt.c; -+ arm_coreboot = bus/fdt.c; -+ arm_coreboot = term/ps2.c; -+ arm_coreboot = term/arm/pl050.c; -+ arm_coreboot = term/arm/cros.c; -+ arm_coreboot = term/arm/cros_ec.c; -+ arm_coreboot = bus/spi/rk3288_spi.c; -+ arm_coreboot = commands/keylayouts.c; -+ arm_coreboot = kern/arm/coreboot/dma.c; - - terminfoinkernel = term/terminfo.c; - terminfoinkernel = term/tparm.c; -@@ -164,7 +182,7 @@ kernel = { - i386_multiboot = kern/i386/coreboot/init.c; - i386_qemu = kern/i386/qemu/init.c; - i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c; -- i386_coreboot = video/i386/coreboot/cbfb.c; -+ coreboot = video/coreboot/cbfb.c; - - efi = disk/efi/efidisk.c; - efi = kern/efi/efi.c; -@@ -211,7 +229,6 @@ kernel = { - ia64_efi = kern/ia64/cache.c; - - arm_efi = kern/arm/efi/init.c; -- arm_efi = kern/arm/efi/misc.c; - arm_efi = kern/efi/fdt.c; - - arm64_efi = kern/arm64/efi/init.c; -@@ -225,8 +242,10 @@ kernel = { - i386_qemu = kern/vga_init.c; - i386_qemu = kern/i386/qemu/mmap.c; - -- i386_coreboot = kern/i386/coreboot/mmap.c; -+ coreboot = kern/coreboot/mmap.c; - i386_coreboot = kern/i386/coreboot/cbtable.c; -+ coreboot = kern/coreboot/cbtable.c; -+ arm_coreboot = kern/arm/coreboot/cbtable.c; - - i386_multiboot = kern/i386/multiboot_mmap.c; - -@@ -238,6 +257,7 @@ kernel = { - mips_qemu_mips = term/ns8250.c; - mips_qemu_mips = term/serial.c; - mips_qemu_mips = term/at_keyboard.c; -+ mips_qemu_mips = term/ps2.c; - mips_qemu_mips = commands/boot.c; - mips_qemu_mips = commands/keylayouts.c; - mips_qemu_mips = term/i386/pc/vga_text.c; -@@ -253,6 +273,7 @@ kernel = { - mips_loongson = bus/pci.c; - mips_loongson = kern/mips/loongson/init.c; - mips_loongson = term/at_keyboard.c; -+ mips_loongson = term/ps2.c; - mips_loongson = commands/boot.c; - mips_loongson = term/serial.c; - mips_loongson = video/sm712.c; -@@ -574,7 +595,10 @@ module = { - module = { - name = ehci; - common = bus/usb/ehci.c; -+ arm_coreboot = bus/usb/ehci-fdt.c; -+ pci = bus/usb/ehci-pci.c; - enable = pci; -+ enable = arm_coreboot; - }; - - module = { -@@ -641,6 +665,7 @@ module = { - module = { - name = cbtable; - common = kern/i386/coreboot/cbtable.c; -+ common = kern/coreboot/cbtable.c; - enable = i386_pc; - enable = i386_efi; - enable = i386_qemu; -@@ -754,6 +779,7 @@ module = { - enable = arm_efi; - enable = arm64_efi; - enable = arm_uboot; -+ enable = arm_coreboot; - }; - - module = { -@@ -837,17 +863,14 @@ module = { - efi = lib/efi/halt.c; - ieee1275 = lib/ieee1275/halt.c; - emu = lib/emu/halt.c; -- uboot = lib/uboot/halt.c; -+ uboot = lib/dummy/halt.c; -+ arm_coreboot = lib/dummy/halt.c; - }; - - module = { - name = reboot; - i386 = lib/i386/reboot.c; - i386 = lib/i386/reboot_trampoline.S; -- ia64_efi = lib/efi/reboot.c; -- x86_64_efi = lib/efi/reboot.c; -- arm_efi = lib/efi/reboot.c; -- arm64_efi = lib/efi/reboot.c; - powerpc_ieee1275 = lib/ieee1275/reboot.c; - sparc64_ieee1275 = lib/ieee1275/reboot.c; - mips_arc = lib/mips/arc/reboot.c; -@@ -855,6 +878,7 @@ module = { - mips_qemu_mips = lib/mips/qemu_mips/reboot.c; - xen = lib/xen/reboot.c; - uboot = lib/uboot/reboot.c; -+ arm_coreboot = lib/dummy/reboot.c; - common = commands/reboot.c; - }; - -@@ -873,7 +897,6 @@ module = { - module = { - name = hdparm; - common = commands/hdparm.c; -- common = lib/hexdump.c; - enable = pci; - enable = mips_qemu_mips; - }; -@@ -1290,6 +1313,11 @@ module = { - common = fs/exfat.c; - }; - -+module = { -+ name = f2fs; -+ common = fs/f2fs.c; -+}; -+ - module = { - name = fshelp; - common = fs/fshelp.c; -@@ -1548,7 +1576,8 @@ module = { - name = datetime; - cmos = lib/cmos_datetime.c; - efi = lib/efi/datetime.c; -- uboot = lib/uboot/datetime.c; -+ uboot = lib/dummy/datetime.c; -+ arm_coreboot = lib/dummy/datetime.c; - sparc64_ieee1275 = lib/ieee1275/datetime.c; - powerpc_ieee1275 = lib/ieee1275/datetime.c; - sparc64_ieee1275 = lib/ieee1275/cmos.c; -@@ -1601,8 +1630,6 @@ module = { - module = { - name = linux16; - common = loader/i386/pc/linux.c; -- common = loader/linux.c; -- common = lib/cmdline.c; - enable = x86; - }; - -@@ -1637,7 +1664,6 @@ module = { - cppflags = "-DGRUB_USE_MULTIBOOT2"; - - common = loader/multiboot.c; -- common = lib/cmdline.c; - common = loader/multiboot_mbi2.c; - enable = x86; - enable = mips; -@@ -1646,7 +1672,6 @@ module = { - module = { - name = multiboot; - common = loader/multiboot.c; -- common = lib/cmdline.c; - x86 = loader/i386/multiboot_mbi.c; - extra_dist = loader/multiboot_elfxx.c; - enable = x86; -@@ -1654,7 +1679,6 @@ module = { - - module = { - name = xen_boot; -- common = lib/cmdline.c; - arm64 = loader/arm64/xen_boot.c; - enable = arm64; - }; -@@ -1668,7 +1692,9 @@ module = { - powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c; - sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c; - ia64_efi = loader/ia64/efi/linux.c; -- arm = loader/arm/linux.c; -+ arm_coreboot = loader/arm/linux.c; -+ arm_efi = loader/arm64/linux.c; -+ arm_uboot = loader/arm/linux.c; - arm64 = loader/arm64/linux.c; - common = loader/linux.c; - common = lib/cmdline.c; -@@ -1677,7 +1703,7 @@ module = { - - module = { - name = fdt; -- arm64 = loader/arm64/fdt.c; -+ efi = loader/efi/fdt.c; - common = lib/fdt.c; - enable = fdt; - }; -@@ -1869,6 +1895,7 @@ module = { - module = { - name = at_keyboard; - common = term/at_keyboard.c; -+ common = term/ps2.c; - enable = x86; - }; - -@@ -1961,6 +1988,11 @@ module = { - common = tests/example_functional_test.c; - }; - -+module = { -+ name = strtoull_test; -+ common = tests/strtoull_test.c; -+}; -+ - module = { - name = setjmp_test; - common = tests/setjmp_test.c; -diff --git a/grub-core/bus/fdt.c b/grub-core/bus/fdt.c -new file mode 100644 -index 0000000000000000000000000000000000000000..135da497ba67e7545490e0e73ee3a1fa676a6069 ---- /dev/null -+++ b/grub-core/bus/fdt.c -@@ -0,0 +1,256 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+ -+static const void *dtb; -+static grub_size_t root_address_cells, root_size_cells; -+/* Pointer to this symbol signals invalid mapping. */ -+char grub_fdtbus_invalid_mapping[1]; -+ -+struct grub_fdtbus_dev *devs; -+struct grub_fdtbus_driver *drivers; -+ -+int -+grub_fdtbus_is_compatible (const char *compat_string, -+ const struct grub_fdtbus_dev *dev) -+{ -+ grub_size_t compatible_size; -+ const char *compatible = grub_fdt_get_prop (dtb, dev->node, "compatible", -+ &compatible_size); -+ if (!compatible) -+ return 0; -+ const char *compatible_end = compatible + compatible_size; -+ while (compatible < compatible_end) -+ { -+ if (grub_strcmp (compat_string, compatible) == 0) -+ return 1; -+ compatible += grub_strlen (compatible) + 1; -+ } -+ return 0; -+} -+ -+static void -+fdtbus_scan (struct grub_fdtbus_dev *parent) -+{ -+ int node; -+ for (node = grub_fdt_first_node (dtb, parent ? parent->node : 0); node >= 0; -+ node = grub_fdt_next_node (dtb, node)) -+ { -+ struct grub_fdtbus_dev *dev; -+ struct grub_fdtbus_driver *driver; -+ dev = grub_zalloc (sizeof (*dev)); -+ if (!dev) -+ { -+ grub_print_error (); -+ return; -+ } -+ dev->node = node; -+ dev->next = devs; -+ dev->parent = parent; -+ devs = dev; -+ FOR_LIST_ELEMENTS(driver, drivers) -+ if (!dev->driver && grub_fdtbus_is_compatible (driver->compatible, dev)) -+ { -+ grub_dprintf ("fdtbus", "Attaching %s\n", driver->compatible); -+ if (driver->attach (dev) == GRUB_ERR_NONE) -+ { -+ grub_dprintf ("fdtbus", "Attached %s\n", driver->compatible); -+ dev->driver = driver; -+ break; -+ } -+ grub_print_error (); -+ } -+ fdtbus_scan (dev); -+ } -+} -+ -+void -+grub_fdtbus_register (struct grub_fdtbus_driver *driver) -+{ -+ struct grub_fdtbus_dev *dev; -+ grub_dprintf ("fdtbus", "Registering %s\n", driver->compatible); -+ grub_list_push (GRUB_AS_LIST_P (&drivers), -+ GRUB_AS_LIST (driver)); -+ for (dev = devs; dev; dev = dev->next) -+ if (!dev->driver && grub_fdtbus_is_compatible (driver->compatible, dev)) -+ { -+ grub_dprintf ("fdtbus", "Attaching %s (%p)\n", driver->compatible, dev); -+ if (driver->attach (dev) == GRUB_ERR_NONE) -+ { -+ grub_dprintf ("fdtbus", "Attached %s\n", driver->compatible); -+ dev->driver = driver; -+ } -+ grub_print_error (); -+ } -+} -+ -+void -+grub_fdtbus_unregister (struct grub_fdtbus_driver *driver) -+{ -+ grub_list_remove (GRUB_AS_LIST (driver)); -+ struct grub_fdtbus_dev *dev; -+ for (dev = devs; dev; dev = dev->next) -+ if (dev->driver == driver) -+ { -+ if (driver->detach) -+ driver->detach(dev); -+ dev->driver = 0; -+ } -+} -+ -+void -+grub_fdtbus_init (const void *dtb_in, grub_size_t size) -+{ -+ if (!dtb_in || grub_fdt_check_header (dtb_in, size) < 0) -+ grub_fatal ("invalid FDT"); -+ dtb = dtb_in; -+ const grub_uint32_t *prop = grub_fdt_get_prop (dtb, 0, "#address-cells", 0); -+ if (prop) -+ root_address_cells = grub_be_to_cpu32 (*prop); -+ else -+ root_address_cells = 1; -+ -+ prop = grub_fdt_get_prop (dtb, 0, "#size-cells", 0); -+ if (prop) -+ root_size_cells = grub_be_to_cpu32 (*prop); -+ else -+ root_size_cells = 1; -+ -+ fdtbus_scan (0); -+} -+ -+static int -+get_address_cells (const struct grub_fdtbus_dev *dev) -+{ -+ const grub_uint32_t *prop; -+ if (!dev) -+ return root_address_cells; -+ prop = grub_fdt_get_prop (dtb, dev->node, "#address-cells", 0); -+ if (prop) -+ return grub_be_to_cpu32 (*prop); -+ return 1; -+} -+ -+static int -+get_size_cells (const struct grub_fdtbus_dev *dev) -+{ -+ const grub_uint32_t *prop; -+ if (!dev) -+ return root_size_cells; -+ prop = grub_fdt_get_prop (dtb, dev->node, "#size-cells", 0); -+ if (prop) -+ return grub_be_to_cpu32 (*prop); -+ return 1; -+} -+ -+static grub_uint64_t -+get64 (const grub_uint32_t *reg, grub_size_t cells) -+{ -+ grub_uint64_t val = 0; -+ if (cells >= 1) -+ val = grub_be_to_cpu32 (reg[cells - 1]); -+ if (cells >= 2) -+ val |= ((grub_uint64_t) grub_be_to_cpu32 (reg[cells - 2])) << 32; -+ return val; -+} -+ -+static volatile void * -+translate (const struct grub_fdtbus_dev *dev, const grub_uint32_t *reg) -+{ -+ volatile void *ret; -+ const grub_uint32_t *ranges; -+ grub_size_t ranges_size, cells_per_mapping; -+ grub_size_t parent_address_cells, child_address_cells, child_size_cells; -+ grub_size_t nmappings, i; -+ if (dev == 0) -+ { -+ grub_uint64_t val; -+ val = get64 (reg, root_address_cells); -+ if (sizeof (void *) == 4 && (val >> 32)) -+ return grub_fdtbus_invalid_mapping; -+ return (void *) (grub_addr_t) val; -+ } -+ ranges = grub_fdt_get_prop (dtb, dev->node, "ranges", &ranges_size); -+ if (!ranges) -+ return grub_fdtbus_invalid_mapping; -+ if (ranges_size == 0) -+ return translate (dev->parent, reg); -+ parent_address_cells = get_address_cells (dev->parent); -+ child_address_cells = get_address_cells (dev); -+ child_size_cells = get_size_cells (dev); -+ cells_per_mapping = parent_address_cells + child_address_cells + child_size_cells; -+ nmappings = ranges_size / 4 / cells_per_mapping; -+ for (i = 0; i < nmappings; i++) -+ { -+ const grub_uint32_t *child_addr = &ranges[i * cells_per_mapping]; -+ const grub_uint32_t *parent_addr = child_addr + child_address_cells; -+ grub_uint64_t child_size = get64 (parent_addr + parent_address_cells, child_size_cells); -+ -+ if (child_address_cells > 2 && grub_memcmp (reg, child_addr, (child_address_cells - 2) * 4) != 0) -+ continue; -+ if (get64 (reg, child_address_cells) < get64 (child_addr, child_address_cells)) -+ continue; -+ -+ grub_uint64_t offset = get64 (reg, child_address_cells) - get64 (child_addr, child_address_cells); -+ if (offset >= child_size) -+ continue; -+ -+ ret = translate (dev->parent, parent_addr); -+ if (grub_fdtbus_is_mapping_valid (ret)) -+ ret = (volatile char *) ret + offset; -+ return ret; -+ } -+ return grub_fdtbus_invalid_mapping; -+} -+ -+volatile void * -+grub_fdtbus_map_reg (const struct grub_fdtbus_dev *dev, int regno, grub_size_t *size) -+{ -+ grub_size_t address_cells, size_cells; -+ address_cells = get_address_cells (dev->parent); -+ size_cells = get_size_cells (dev->parent); -+ const grub_uint32_t *reg = grub_fdt_get_prop (dtb, dev->node, "reg", 0); -+ if (size && size_cells) -+ *size = reg[(address_cells + size_cells) * regno + address_cells]; -+ if (size && !size_cells) -+ *size = 0; -+ return translate (dev->parent, reg + (address_cells + size_cells) * regno); -+} -+ -+const char * -+grub_fdtbus_get_name (const struct grub_fdtbus_dev *dev) -+{ -+ return grub_fdt_get_nodename (dtb, dev->node); -+} -+ -+const void * -+grub_fdtbus_get_prop (const struct grub_fdtbus_dev *dev, -+ const char *name, -+ grub_uint32_t *len) -+{ -+ return grub_fdt_get_prop (dtb, dev->node, name, len); -+} -+ -+const void * -+grub_fdtbus_get_fdt (void) -+{ -+ return dtb; -+} -diff --git a/grub-core/bus/spi/rk3288_spi.c b/grub-core/bus/spi/rk3288_spi.c -new file mode 100644 -index 0000000000000000000000000000000000000000..aacb79ffef103bdbff1bb66dd70229b85b1e8030 ---- /dev/null -+++ b/grub-core/bus/spi/rk3288_spi.c -@@ -0,0 +1,103 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * -+ * Copyright (C) 2012 Google Inc. -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * This is based on depthcharge code. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static grub_err_t -+spi_send (const struct grub_fdtbus_dev *dev, const void *data, grub_size_t sz) -+{ -+ const grub_uint8_t *ptr = data, *end = ptr + sz; -+ volatile grub_uint32_t *spi = grub_fdtbus_map_reg (dev, 0, 0); -+ spi[2] = 0; -+ spi[1] = sz - 1; -+ spi[0] = ((1 << 18) | spi[0]) & ~(1 << 19); -+ spi[2] = 1; -+ while (ptr < end) -+ { -+ while (spi[9] & 2); -+ spi[256] = *ptr++; -+ } -+ while (spi[9] & 1); -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+spi_receive (const struct grub_fdtbus_dev *dev, void *data, grub_size_t sz) -+{ -+ grub_uint8_t *ptr = data, *end = ptr + sz; -+ volatile grub_uint32_t *spi = grub_fdtbus_map_reg (dev, 0, 0); -+ spi[2] = 0; -+ spi[1] = sz - 1; -+ spi[0] = ((1 << 19) | spi[0]) & ~(1 << 18); -+ spi[2] = 1; -+ while (ptr < end) -+ { -+ while (spi[9] & 8); -+ *ptr++ = spi[512]; -+ } -+ while (spi[9] & 1); -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+spi_start (const struct grub_fdtbus_dev *dev) -+{ -+ volatile grub_uint32_t *spi = grub_fdtbus_map_reg (dev, 0, 0); -+ spi[3] = 1; -+ return GRUB_ERR_NONE; -+} -+ -+static void -+spi_stop (const struct grub_fdtbus_dev *dev) -+{ -+ volatile grub_uint32_t *spi = grub_fdtbus_map_reg (dev, 0, 0); -+ spi[3] = 0; -+} -+ -+static grub_err_t -+spi_attach(const struct grub_fdtbus_dev *dev) -+{ -+ if (!grub_fdtbus_is_mapping_valid (grub_fdtbus_map_reg (dev, 0, 0))) -+ return GRUB_ERR_IO; -+ -+ return GRUB_ERR_NONE; -+} -+ -+static struct grub_fdtbus_driver spi = -+{ -+ .compatible = "rockchip,rk3288-spi", -+ .attach = spi_attach, -+ .send = spi_send, -+ .receive = spi_receive, -+ .start = spi_start, -+ .stop = spi_stop, -+}; -+ -+void -+grub_rk3288_spi_init (void) -+{ -+ grub_fdtbus_register (&spi); -+} -diff --git a/grub-core/bus/usb/ehci-fdt.c b/grub-core/bus/usb/ehci-fdt.c -new file mode 100644 -index 0000000000000000000000000000000000000000..29b50bdd5c30d192cc3cba1d7f466a9bcf321d92 ---- /dev/null -+++ b/grub-core/bus/usb/ehci-fdt.c -@@ -0,0 +1,45 @@ -+/* ehci.c - EHCI Support. */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2011 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static grub_err_t -+ehci_attach(const struct grub_fdtbus_dev *dev) -+{ -+ grub_dprintf ("ehci", "Found generic-ehci\n"); -+ -+ grub_ehci_init_device (grub_fdtbus_map_reg (dev, 0, 0)); -+ return 0; -+} -+ -+struct grub_fdtbus_driver ehci = -+{ -+ .compatible = "generic-ehci", -+ .attach = ehci_attach -+}; -+ -+void -+grub_ehci_pci_scan (void) -+{ -+ grub_fdtbus_register (&ehci); -+} -diff --git a/grub-core/bus/usb/ehci-pci.c b/grub-core/bus/usb/ehci-pci.c -new file mode 100644 -index 0000000000000000000000000000000000000000..65e6cb57438b7dfa35b80bbbe36a1e50629f025f ---- /dev/null -+++ b/grub-core/bus/usb/ehci-pci.c -@@ -0,0 +1,208 @@ -+/* ehci.c - EHCI Support. */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2011 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define GRUB_EHCI_PCI_SBRN_REG 0x60 -+#define GRUB_EHCI_ADDR_MEM_MASK (~0xff) -+ -+/* USBLEGSUP bits and related OS OWNED byte offset */ -+enum -+{ -+ GRUB_EHCI_BIOS_OWNED = (1 << 16), -+ GRUB_EHCI_OS_OWNED = (1 << 24) -+}; -+ -+/* PCI iteration function... */ -+static int -+grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, -+ void *data __attribute__ ((unused))) -+{ -+ volatile grub_uint32_t *regs; -+ grub_uint32_t base, base_h; -+ grub_uint32_t eecp_offset; -+ grub_uint32_t usblegsup = 0; -+ grub_uint64_t maxtime; -+ grub_uint32_t interf; -+ grub_uint32_t subclass; -+ grub_uint32_t class; -+ grub_uint8_t release; -+ grub_uint32_t class_code; -+ -+ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: begin\n"); -+ -+ if (pciid == GRUB_CS5536_PCIID) -+ { -+ grub_uint64_t basereg; -+ -+ basereg = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE); -+ if (!(basereg & GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE)) -+ { -+ /* Shouldn't happen. */ -+ grub_dprintf ("ehci", "No EHCI address is assigned\n"); -+ return 0; -+ } -+ base = (basereg & GRUB_CS5536_MSR_USB_BASE_ADDR_MASK); -+ basereg |= GRUB_CS5536_MSR_USB_BASE_BUS_MASTER; -+ basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_ENABLED; -+ basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_STATUS; -+ basereg &= ~GRUB_CS5536_MSR_USB_BASE_SMI_ENABLE; -+ grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE, basereg); -+ } -+ else -+ { -+ grub_pci_address_t addr; -+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); -+ class_code = grub_pci_read (addr) >> 8; -+ interf = class_code & 0xFF; -+ subclass = (class_code >> 8) & 0xFF; -+ class = class_code >> 16; -+ -+ /* If this is not an EHCI controller, just return. */ -+ if (class != 0x0c || subclass != 0x03 || interf != 0x20) -+ return 0; -+ -+ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: class OK\n"); -+ -+ /* Check Serial Bus Release Number */ -+ addr = grub_pci_make_address (dev, GRUB_EHCI_PCI_SBRN_REG); -+ release = grub_pci_read_byte (addr); -+ if (release != 0x20) -+ { -+ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: Wrong SBRN: %0x\n", -+ release); -+ return 0; -+ } -+ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: bus rev. num. OK\n"); -+ -+ /* Determine EHCI EHCC registers base address. */ -+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0); -+ base = grub_pci_read (addr); -+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG1); -+ base_h = grub_pci_read (addr); -+ /* Stop if registers are mapped above 4G - GRUB does not currently -+ * work with registers mapped above 4G */ -+ if (((base & GRUB_PCI_ADDR_MEM_TYPE_MASK) != GRUB_PCI_ADDR_MEM_TYPE_32) -+ && (base_h != 0)) -+ { -+ grub_dprintf ("ehci", -+ "EHCI grub_ehci_pci_iter: registers above 4G are not supported\n"); -+ return 0; -+ } -+ base &= GRUB_PCI_ADDR_MEM_MASK; -+ if (!base) -+ { -+ grub_dprintf ("ehci", -+ "EHCI: EHCI is not mapped\n"); -+ return 0; -+ } -+ -+ /* Set bus master - needed for coreboot, VMware, broken BIOSes etc. */ -+ addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); -+ grub_pci_write_word(addr, -+ GRUB_PCI_COMMAND_MEM_ENABLED -+ | GRUB_PCI_COMMAND_BUS_MASTER -+ | grub_pci_read_word(addr)); -+ -+ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: 32-bit EHCI OK\n"); -+ } -+ -+ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: iobase of EHCC: %08x\n", -+ (base & GRUB_EHCI_ADDR_MEM_MASK)); -+ -+ regs = grub_pci_device_map_range (dev, -+ (base & GRUB_EHCI_ADDR_MEM_MASK), -+ 0x100); -+ -+ /* Is there EECP ? */ -+ eecp_offset = (grub_le_to_cpu32 (regs[2]) >> 8) & 0xff; -+ -+ /* Determine and change ownership. */ -+ /* EECP offset valid in HCCPARAMS */ -+ /* Ownership can be changed via EECP only */ -+ if (pciid != GRUB_CS5536_PCIID && eecp_offset >= 0x40) -+ { -+ grub_pci_address_t pciaddr_eecp; -+ pciaddr_eecp = grub_pci_make_address (dev, eecp_offset); -+ -+ usblegsup = grub_pci_read (pciaddr_eecp); -+ if (usblegsup & GRUB_EHCI_BIOS_OWNED) -+ { -+ grub_boot_time ("Taking ownership of EHCI controller"); -+ grub_dprintf ("ehci", -+ "EHCI grub_ehci_pci_iter: EHCI owned by: BIOS\n"); -+ /* Ownership change - set OS_OWNED bit */ -+ grub_pci_write (pciaddr_eecp, usblegsup | GRUB_EHCI_OS_OWNED); -+ /* Ensure PCI register is written */ -+ grub_pci_read (pciaddr_eecp); -+ -+ /* Wait for finish of ownership change, EHCI specification -+ * doesn't say how long it can take... */ -+ maxtime = grub_get_time_ms () + 1000; -+ while ((grub_pci_read (pciaddr_eecp) & GRUB_EHCI_BIOS_OWNED) -+ && (grub_get_time_ms () < maxtime)); -+ if (grub_pci_read (pciaddr_eecp) & GRUB_EHCI_BIOS_OWNED) -+ { -+ grub_dprintf ("ehci", -+ "EHCI grub_ehci_pci_iter: EHCI change ownership timeout"); -+ /* Change ownership in "hard way" - reset BIOS ownership */ -+ grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED); -+ /* Ensure PCI register is written */ -+ grub_pci_read (pciaddr_eecp); -+ } -+ } -+ else if (usblegsup & GRUB_EHCI_OS_OWNED) -+ /* XXX: What to do in this case - nothing ? Can it happen ? */ -+ grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: EHCI owned by: OS\n"); -+ else -+ { -+ grub_dprintf ("ehci", -+ "EHCI grub_ehci_pci_iter: EHCI owned by: NONE\n"); -+ /* XXX: What to do in this case ? Can it happen ? -+ * Is code below correct ? */ -+ /* Ownership change - set OS_OWNED bit */ -+ grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED); -+ /* Ensure PCI register is written */ -+ grub_pci_read (pciaddr_eecp); -+ } -+ -+ /* Disable SMI, just to be sure. */ -+ pciaddr_eecp = grub_pci_make_address (dev, eecp_offset + 4); -+ grub_pci_write (pciaddr_eecp, 0); -+ /* Ensure PCI register is written */ -+ grub_pci_read (pciaddr_eecp); -+ } -+ -+ grub_dprintf ("ehci", "inithw: EHCI grub_ehci_pci_iter: ownership OK\n"); -+ -+ grub_ehci_init_device (regs); -+ return 0; -+} -+ -+void -+grub_ehci_pci_scan (void) -+{ -+ grub_pci_iterate (grub_ehci_pci_iter, NULL); -+} -diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c -index 5f4297bb21ec4c28824abb0c442a87a3dd4a872e..d966fc21002602fab3f1b68668ddcb5bfa639442 100644 ---- a/grub-core/bus/usb/ehci.c -+++ b/grub-core/bus/usb/ehci.c -@@ -22,13 +22,10 @@ - #include - #include - #include --#include --#include --#include - #include - #include --#include - #include -+#include - #include - - GRUB_MOD_LICENSE ("GPLv3+"); -@@ -39,8 +36,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); - * - is not supporting interrupt transfers - */ - --#define GRUB_EHCI_PCI_SBRN_REG 0x60 -- - /* Capability registers offsets */ - enum - { -@@ -54,7 +49,6 @@ enum - #define GRUB_EHCI_EECP_MASK (0xff << 8) - #define GRUB_EHCI_EECP_SHIFT 8 - --#define GRUB_EHCI_ADDR_MEM_MASK (~0xff) - #define GRUB_EHCI_POINTER_MASK (~0x1f) - - /* Capability register SPARAMS bits */ -@@ -85,13 +79,6 @@ enum - - #define GRUB_EHCI_QH_EMPTY 1 - --/* USBLEGSUP bits and related OS OWNED byte offset */ --enum --{ -- GRUB_EHCI_BIOS_OWNED = (1 << 16), -- GRUB_EHCI_OS_OWNED = (1 << 24) --}; -- - /* Operational registers offsets */ - enum - { -@@ -455,9 +442,10 @@ grub_ehci_reset (struct grub_ehci *e) - - sync_all_caches (e); - -+ grub_dprintf ("ehci", "reset\n"); -+ - grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND, -- GRUB_EHCI_CMD_HC_RESET -- | grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); -+ GRUB_EHCI_CMD_HC_RESET); - /* Ensure command is written */ - grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND); - /* XXX: How long time could take reset of HC ? */ -@@ -473,116 +461,24 @@ grub_ehci_reset (struct grub_ehci *e) - } - - /* PCI iteration function... */ --static int --grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, -- void *data __attribute__ ((unused))) -+void -+grub_ehci_init_device (volatile void *regs) - { -- grub_uint8_t release; -- grub_uint32_t class_code; -- grub_uint32_t interf; -- grub_uint32_t subclass; -- grub_uint32_t class; -- grub_uint32_t base, base_h; - struct grub_ehci *e; -- grub_uint32_t eecp_offset; - grub_uint32_t fp; - int i; -- grub_uint32_t usblegsup = 0; -- grub_uint64_t maxtime; - grub_uint32_t n_ports; - grub_uint8_t caplen; - -- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: begin\n"); -- -- if (pciid == GRUB_CS5536_PCIID) -- { -- grub_uint64_t basereg; -- -- basereg = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE); -- if (!(basereg & GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE)) -- { -- /* Shouldn't happen. */ -- grub_dprintf ("ehci", "No EHCI address is assigned\n"); -- return 0; -- } -- base = (basereg & GRUB_CS5536_MSR_USB_BASE_ADDR_MASK); -- basereg |= GRUB_CS5536_MSR_USB_BASE_BUS_MASTER; -- basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_ENABLED; -- basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_STATUS; -- basereg &= ~GRUB_CS5536_MSR_USB_BASE_SMI_ENABLE; -- grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE, basereg); -- } -- else -- { -- grub_pci_address_t addr; -- addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); -- class_code = grub_pci_read (addr) >> 8; -- interf = class_code & 0xFF; -- subclass = (class_code >> 8) & 0xFF; -- class = class_code >> 16; -- -- /* If this is not an EHCI controller, just return. */ -- if (class != 0x0c || subclass != 0x03 || interf != 0x20) -- return 0; -- -- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: class OK\n"); -- -- /* Check Serial Bus Release Number */ -- addr = grub_pci_make_address (dev, GRUB_EHCI_PCI_SBRN_REG); -- release = grub_pci_read_byte (addr); -- if (release != 0x20) -- { -- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: Wrong SBRN: %0x\n", -- release); -- return 0; -- } -- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: bus rev. num. OK\n"); -- -- /* Determine EHCI EHCC registers base address. */ -- addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0); -- base = grub_pci_read (addr); -- addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG1); -- base_h = grub_pci_read (addr); -- /* Stop if registers are mapped above 4G - GRUB does not currently -- * work with registers mapped above 4G */ -- if (((base & GRUB_PCI_ADDR_MEM_TYPE_MASK) != GRUB_PCI_ADDR_MEM_TYPE_32) -- && (base_h != 0)) -- { -- grub_dprintf ("ehci", -- "EHCI grub_ehci_pci_iter: registers above 4G are not supported\n"); -- return 0; -- } -- base &= GRUB_PCI_ADDR_MEM_MASK; -- if (!base) -- { -- grub_dprintf ("ehci", -- "EHCI: EHCI is not mapped\n"); -- return 0; -- } -- -- /* Set bus master - needed for coreboot, VMware, broken BIOSes etc. */ -- addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); -- grub_pci_write_word(addr, -- GRUB_PCI_COMMAND_MEM_ENABLED -- | GRUB_PCI_COMMAND_BUS_MASTER -- | grub_pci_read_word(addr)); -- -- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: 32-bit EHCI OK\n"); -- } -- - /* Allocate memory for the controller and fill basic values. */ - e = grub_zalloc (sizeof (*e)); - if (!e) -- return 1; -+ return; - e->framelist_chunk = NULL; - e->td_chunk = NULL; - e->qh_chunk = NULL; -- e->iobase_ehcc = grub_pci_device_map_range (dev, -- (base & GRUB_EHCI_ADDR_MEM_MASK), -- 0x100); -+ e->iobase_ehcc = regs; - -- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: iobase of EHCC: %08x\n", -- (base & GRUB_EHCI_ADDR_MEM_MASK)); - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: CAPLEN: %02x\n", - grub_ehci_ehcc_read8 (e, GRUB_EHCI_EHCC_CAPLEN)); - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: VERSION: %04x\n", -@@ -598,7 +494,7 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - if (caplen & (sizeof (grub_uint32_t) - 1)) - { - grub_dprintf ("ehci", "Unaligned caplen\n"); -- return 0; -+ return; - } - e->iobase = ((volatile grub_uint32_t *) e->iobase_ehcc - + (caplen / sizeof (grub_uint32_t))); -@@ -608,8 +504,8 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - #endif - - grub_dprintf ("ehci", -- "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08x\n", -- (base & GRUB_EHCI_ADDR_MEM_MASK) + caplen); -+ "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08llxx\n", -+ (unsigned long long) (grub_addr_t) e->iobase_ehcc + caplen); - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: COMMAND: %08x\n", - grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", -@@ -625,10 +521,6 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: CONFIG_FLAG: %08x\n", - grub_ehci_oper_read32 (e, GRUB_EHCI_CONFIG_FLAG)); - -- /* Is there EECP ? */ -- eecp_offset = (grub_ehci_ehcc_read32 (e, GRUB_EHCI_EHCC_CPARAMS) -- & GRUB_EHCI_EECP_MASK) >> GRUB_EHCI_EECP_SHIFT; -- - /* Check format of data structures requested by EHCI */ - /* XXX: In fact it is not used at any place, it is prepared for future - * This implementation uses 32-bits pointers only */ -@@ -732,65 +624,6 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: QH/TD init. OK\n"); - -- /* Determine and change ownership. */ -- /* EECP offset valid in HCCPARAMS */ -- /* Ownership can be changed via EECP only */ -- if (pciid != GRUB_CS5536_PCIID && eecp_offset >= 0x40) -- { -- grub_pci_address_t pciaddr_eecp; -- pciaddr_eecp = grub_pci_make_address (dev, eecp_offset); -- -- usblegsup = grub_pci_read (pciaddr_eecp); -- if (usblegsup & GRUB_EHCI_BIOS_OWNED) -- { -- grub_boot_time ("Taking ownership of EHCI controller"); -- grub_dprintf ("ehci", -- "EHCI grub_ehci_pci_iter: EHCI owned by: BIOS\n"); -- /* Ownership change - set OS_OWNED bit */ -- grub_pci_write (pciaddr_eecp, usblegsup | GRUB_EHCI_OS_OWNED); -- /* Ensure PCI register is written */ -- grub_pci_read (pciaddr_eecp); -- -- /* Wait for finish of ownership change, EHCI specification -- * doesn't say how long it can take... */ -- maxtime = grub_get_time_ms () + 1000; -- while ((grub_pci_read (pciaddr_eecp) & GRUB_EHCI_BIOS_OWNED) -- && (grub_get_time_ms () < maxtime)); -- if (grub_pci_read (pciaddr_eecp) & GRUB_EHCI_BIOS_OWNED) -- { -- grub_dprintf ("ehci", -- "EHCI grub_ehci_pci_iter: EHCI change ownership timeout"); -- /* Change ownership in "hard way" - reset BIOS ownership */ -- grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED); -- /* Ensure PCI register is written */ -- grub_pci_read (pciaddr_eecp); -- } -- } -- else if (usblegsup & GRUB_EHCI_OS_OWNED) -- /* XXX: What to do in this case - nothing ? Can it happen ? */ -- grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: EHCI owned by: OS\n"); -- else -- { -- grub_dprintf ("ehci", -- "EHCI grub_ehci_pci_iter: EHCI owned by: NONE\n"); -- /* XXX: What to do in this case ? Can it happen ? -- * Is code below correct ? */ -- /* Ownership change - set OS_OWNED bit */ -- grub_pci_write (pciaddr_eecp, GRUB_EHCI_OS_OWNED); -- /* Ensure PCI register is written */ -- grub_pci_read (pciaddr_eecp); -- } -- -- /* Disable SMI, just to be sure. */ -- pciaddr_eecp = grub_pci_make_address (dev, eecp_offset + 4); -- grub_pci_write (pciaddr_eecp, 0); -- /* Ensure PCI register is written */ -- grub_pci_read (pciaddr_eecp); -- -- } -- -- grub_dprintf ("ehci", "inithw: EHCI grub_ehci_pci_iter: ownership OK\n"); -- - /* Now we can setup EHCI (maybe...) */ - - /* Check if EHCI is halted and halt it if not */ -@@ -863,8 +696,8 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: OK at all\n"); - - grub_dprintf ("ehci", -- "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08x\n", -- (base & GRUB_EHCI_ADDR_MEM_MASK)); -+ "EHCI grub_ehci_pci_iter: iobase of oper. regs: %08llx\n", -+ (unsigned long long) (grub_addr_t) regs); - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: COMMAND: %08x\n", - grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: STATUS: %08x\n", -@@ -880,7 +713,7 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, - grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: CONFIG_FLAG: %08x\n", - grub_ehci_oper_read32 (e, GRUB_EHCI_CONFIG_FLAG)); - -- return 0; -+ return; - - fail: - if (e) -@@ -894,7 +727,7 @@ fail: - } - grub_free (e); - -- return 0; -+ return; - } - - static int -@@ -1891,12 +1724,6 @@ grub_ehci_detect_dev (grub_usb_controller_t dev, int port, int *changed) - } - } - --static void --grub_ehci_inithw (void) --{ -- grub_pci_iterate (grub_ehci_pci_iter, NULL); --} -- - static grub_err_t - grub_ehci_restore_hw (void) - { -@@ -1997,7 +1824,7 @@ GRUB_MOD_INIT (ehci) - grub_stop_disk_firmware (); - - grub_boot_time ("Initing EHCI hardware"); -- grub_ehci_inithw (); -+ grub_ehci_pci_scan (); - grub_boot_time ("Registering EHCI driver"); - grub_usb_controller_dev_register (&usb_controller); - grub_boot_time ("EHCI driver registered"); -diff --git a/grub-core/bus/usb/usbtrans.c b/grub-core/bus/usb/usbtrans.c -index 9266e49311c4471d0915aebf9fae05509d0fa5c7..85f081fffb3a2aa7354816c79977ae45a79b1c80 100644 ---- a/grub-core/bus/usb/usbtrans.c -+++ b/grub-core/bus/usb/usbtrans.c -@@ -18,7 +18,7 @@ - */ - - #include --#include -+#include - #include - #include - #include -diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c -index d901c3892630f2500eda9822c712aae278017907..d1ce99af438914692d1b71b0017050689dd73db9 100644 ---- a/grub-core/commands/efi/lsefi.c -+++ b/grub-core/commands/efi/lsefi.c -@@ -109,8 +109,10 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)), - - status = efi_call_3 (grub_efi_system_table->boot_services->protocols_per_handle, - handle, &protocols, &num_protocols); -- if (status != GRUB_EFI_SUCCESS) -+ if (status != GRUB_EFI_SUCCESS) { - grub_printf ("Unable to retrieve protocols\n"); -+ continue; -+ } - for (j = 0; j < num_protocols; j++) - { - for (k = 0; k < ARRAY_SIZE (known_protocols); k++) -diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c -index 12fba99e06a23cb72af67fc4bfb758d97bfa0e67..3ff6d5522d2d572c2af16fec371faeb8e4b28f9d 100644 ---- a/grub-core/commands/file.c -+++ b/grub-core/commands/file.c -@@ -27,6 +27,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -383,21 +385,19 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) - } - case IS_ARM_LINUX: - { -- grub_uint32_t sig, sig_pi; -- if (grub_file_read (file, &sig_pi, 4) != 4) -+ struct linux_arm_kernel_header lh; -+ -+ if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) - break; -- /* Raspberry pi. */ -- if (sig_pi == grub_cpu_to_le32_compile_time (0xea000006)) -+ /* Short forward branch in A32 state (for Raspberry pi kernels). */ -+ if (lh.code0 == grub_cpu_to_le32_compile_time (0xea000006)) - { - ret = 1; - break; - } - -- if (grub_file_seek (file, 0x24) == (grub_size_t) -1) -- break; -- if (grub_file_read (file, &sig, 4) != 4) -- break; -- if (sig == grub_cpu_to_le32_compile_time (0x016f2818)) -+ if (lh.magic == -+ grub_cpu_to_le32_compile_time (GRUB_LINUX_ARM_MAGIC_SIGNATURE)) - { - ret = 1; - break; -@@ -406,13 +406,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) - } - case IS_ARM64_LINUX: - { -- grub_uint32_t sig; -+ struct linux_arm64_kernel_header lh; - -- if (grub_file_seek (file, 0x38) == (grub_size_t) -1) -+ if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) - break; -- if (grub_file_read (file, &sig, 4) != 4) -- break; -- if (sig == grub_cpu_to_le32_compile_time (0x644d5241)) -+ -+ if (lh.magic == -+ grub_cpu_to_le32_compile_time (GRUB_LINUX_ARM64_MAGIC_SIGNATURE)) - { - ret = 1; - break; -@@ -497,7 +497,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) - case IS_X86_LINUX32: - case IS_X86_LINUX: - { -- struct linux_kernel_header lh; -+ struct linux_i386_kernel_header lh; - if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) - break; - if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) -@@ -508,7 +508,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) - - /* FIXME: some really old kernels (< 1.3.73) will fail this. */ - if (lh.header != -- grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) -+ grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0200) - break; - -@@ -521,7 +521,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) - /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and - still not support 32-bit boot. */ - if (lh.header != -- grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) -+ grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0203) - break; - -diff --git a/grub-core/commands/i386/coreboot/cb_timestamps.c b/grub-core/commands/i386/coreboot/cb_timestamps.c -index e72f38d6e057dccfb981d6bbc483d2bdd8a06c98..e97ea6bed98b42d4f03f06ab5bc076fadbfee67f 100644 ---- a/grub-core/commands/i386/coreboot/cb_timestamps.c -+++ b/grub-core/commands/i386/coreboot/cb_timestamps.c -@@ -20,7 +20,7 @@ - #include - #include - #include --#include -+#include - #include - - GRUB_MOD_LICENSE ("GPLv3+"); -diff --git a/grub-core/commands/i386/coreboot/cbls.c b/grub-core/commands/i386/coreboot/cbls.c -index e0a10596fe279331cca94172e1f452fdfe18394f..102291f424ab782c6cd3bcd4ae1effd836cd832e 100644 ---- a/grub-core/commands/i386/coreboot/cbls.c -+++ b/grub-core/commands/i386/coreboot/cbls.c -@@ -20,7 +20,7 @@ - #include - #include - #include --#include -+#include - #include - - GRUB_MOD_LICENSE ("GPLv3+"); -diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c -index f4b7730208ab8ffafb1b0283294a140248839d7a..f35d3a369bad7125cb04e25f0e32c01c00c673b0 100644 ---- a/grub-core/commands/keylayouts.c -+++ b/grub-core/commands/keylayouts.c -@@ -40,7 +40,7 @@ static struct grub_keyboard_layout layout_us = { - /* 0x10 */ 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - /* 0x18 */ 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', - /* 0x20 */ '3', '4', '5', '6', '7', '8', '9', '0', -- /* 0x28 */ '\n', '\e', '\b', '\t', ' ', '-', '=', '[', -+ /* 0x28 */ '\n', GRUB_TERM_ESC, GRUB_TERM_BACKSPACE, GRUB_TERM_TAB, ' ', '-', '=', '[', - /* According to usage table 0x31 should be mapped to '/' - but testing with real keyboard shows that 0x32 is remapped to '/'. - Map 0x31 to 0. -@@ -82,8 +82,8 @@ static struct grub_keyboard_layout layout_us = { - /* 0x10 */ 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - /* 0x18 */ 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', - /* 0x20 */ '#', '$', '%', '^', '&', '*', '(', ')', -- /* 0x28 */ '\n' | GRUB_TERM_SHIFT, '\e' | GRUB_TERM_SHIFT, -- /* 0x2a */ '\b' | GRUB_TERM_SHIFT, '\t' | GRUB_TERM_SHIFT, -+ /* 0x28 */ '\n' | GRUB_TERM_SHIFT, GRUB_TERM_ESC | GRUB_TERM_SHIFT, -+ /* 0x2a */ GRUB_TERM_BACKSPACE | GRUB_TERM_SHIFT, GRUB_TERM_TAB | GRUB_TERM_SHIFT, - /* 0x2c */ ' ' | GRUB_TERM_SHIFT, '_', '+', '{', - /* According to usage table 0x31 should be mapped to '/' - but testing with real keyboard shows that 0x32 is remapped to '/'. -diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c -index 0eaf836527944ba69d499050ad080f919d3e57ef..c25161cc4f2c6d4fce6781bfac9bf7796fceb0c7 100644 ---- a/grub-core/commands/ls.c -+++ b/grub-core/commands/ls.c -@@ -201,6 +201,15 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human) - if (grub_errno == GRUB_ERR_UNKNOWN_FS) - grub_errno = GRUB_ERR_NONE; - -+#ifdef GRUB_MACHINE_IEEE1275 -+ /* -+ * Close device to prevent a double open in grub_normal_print_device_info(). -+ * Otherwise it may lead to hangs on some IEEE 1275 platforms. -+ */ -+ grub_device_close (dev); -+ dev = NULL; -+#endif -+ - grub_normal_print_device_info (device_name); - } - else if (fs) -diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index 58d4dadf6ee4ec392a09d433802803520704cd7b..2c5363da7f549b85ae04d1d88a78db0b85504c51 100644 ---- a/grub-core/commands/menuentry.c -+++ b/grub-core/commands/menuentry.c -@@ -52,8 +52,8 @@ static struct - int key; - } hotkey_aliases[] = - { -- {"backspace", '\b'}, -- {"tab", '\t'}, -+ {"backspace", GRUB_TERM_BACKSPACE}, -+ {"tab", GRUB_TERM_TAB}, - {"delete", GRUB_TERM_KEY_DC}, - {"insert", GRUB_TERM_KEY_INSERT}, - {"f1", GRUB_TERM_KEY_F1}, -diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c -index 494a1b7734ef44fef6e887f62b6eb30d0a494284..f2f606423aca4f842f5b16b797a1084cc5791cbb 100644 ---- a/grub-core/disk/ahci.c -+++ b/grub-core/disk/ahci.c -@@ -82,6 +82,20 @@ enum grub_ahci_hba_port_command - GRUB_AHCI_HBA_PORT_CMD_FR = 0x4000, - }; - -+enum grub_ahci_hba_port_int_status -+ { -+ GRUB_AHCI_HBA_PORT_IS_IFS = (1UL << 27), -+ GRUB_AHCI_HBA_PORT_IS_HBDS = (1UL << 28), -+ GRUB_AHCI_HBA_PORT_IS_HBFS = (1UL << 29), -+ GRUB_AHCI_HBA_PORT_IS_TFES = (1UL << 30), -+ }; -+ -+#define GRUB_AHCI_HBA_PORT_IS_FATAL_MASK ( \ -+ GRUB_AHCI_HBA_PORT_IS_IFS | \ -+ GRUB_AHCI_HBA_PORT_IS_HBDS | \ -+ GRUB_AHCI_HBA_PORT_IS_HBFS | \ -+ GRUB_AHCI_HBA_PORT_IS_TFES) -+ - struct grub_ahci_hba - { - grub_uint32_t cap; -@@ -1026,7 +1040,8 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, - - endtime = grub_get_time_ms () + (spinup ? 20000 : 20000); - while ((dev->hba->ports[dev->port].command_issue & 1)) -- if (grub_get_time_ms () > endtime) -+ if (grub_get_time_ms () > endtime || -+ (dev->hba->ports[dev->port].intstatus & GRUB_AHCI_HBA_PORT_IS_FATAL_MASK)) - { - grub_dprintf ("ahci", "AHCI status <%x %x %x %x>\n", - dev->hba->ports[dev->port].command_issue, -@@ -1034,7 +1049,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, - dev->hba->ports[dev->port].intstatus, - dev->hba->ports[dev->port].task_file_data); - dev->hba->ports[dev->port].command_issue = 0; -- err = grub_error (GRUB_ERR_IO, "AHCI transfer timed out"); -+ if (dev->hba->ports[dev->port].intstatus & GRUB_AHCI_HBA_PORT_IS_FATAL_MASK) -+ err = grub_error (GRUB_ERR_IO, "AHCI transfer error"); -+ else -+ err = grub_error (GRUB_ERR_IO, "AHCI transfer timed out"); - if (!reset) - grub_ahci_reset_port (dev, 1); - break; -diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c -index 0f978ad05079c9535d7ef9bb16462c7d7adeb80e..2a22d2d6c1c3121ec889f33f2aaaf3077723a6c1 100644 ---- a/grub-core/disk/ldm.c -+++ b/grub-core/disk/ldm.c -@@ -135,7 +135,7 @@ msdos_has_ldm_partition (grub_disk_t dsk) - return has_ldm; - } - --static const grub_gpt_part_type_t ldm_type = GRUB_GPT_PARTITION_TYPE_LDM; -+static const grub_gpt_part_guid_t ldm_type = GRUB_GPT_PARTITION_TYPE_LDM; - - /* Helper for gpt_ldm_sector. */ - static int -diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c -index e49d0b6ff17e02e22e09b306d0a6a32a3b083b78..18facf47fd7678007deb730fb71256edff6292ad 100644 ---- a/grub-core/efiemu/i386/loadcore64.c -+++ b/grub-core/efiemu/i386/loadcore64.c -@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - err = grub_efiemu_write_value (addr, - *addr32 + rel->r_addend - + sym.off -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 4849c1ceb6533c1b19eb64d754d45d44282b5acb..be195448dbeb55abcfb117723cd2fc6d75e6e344 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -175,7 +175,7 @@ struct grub_btrfs_time - { - grub_int64_t sec; - grub_uint32_t nanosec; --} __attribute__ ((aligned (4))); -+} GRUB_PACKED; - - struct grub_btrfs_inode - { -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index cdce63bcc9d57e82b7a4f6a644803a1d8320935d..b8ad75a0ff7c4f72b67bef123510d99231531daf 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -102,6 +102,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 - #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 - #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 -+#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000 - - /* The set of back-incompatible features this driver DOES support. Add (OR) - * flags here as the related features are implemented into the driver. */ -@@ -109,7 +110,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); - | EXT4_FEATURE_INCOMPAT_EXTENTS \ - | EXT4_FEATURE_INCOMPAT_FLEX_BG \ - | EXT2_FEATURE_INCOMPAT_META_BG \ -- | EXT4_FEATURE_INCOMPAT_64BIT) -+ | EXT4_FEATURE_INCOMPAT_64BIT \ -+ | EXT4_FEATURE_INCOMPAT_ENCRYPT) - /* List of rationales for the ignored "incompatible" features: - * needs_recovery: Not really back-incompatible - was added as such to forbid - * ext2 drivers from mounting an ext3 volume with a dirty -@@ -138,6 +140,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define EXT3_JOURNAL_FLAG_DELETED 4 - #define EXT3_JOURNAL_FLAG_LAST_TAG 8 - -+#define EXT4_ENCRYPT_FLAG 0x800 - #define EXT4_EXTENTS_FLAG 0x80000 - - /* The ext2 superblock. */ -@@ -706,6 +709,12 @@ grub_ext2_read_symlink (grub_fshelp_node_t node) - grub_ext2_read_inode (diro->data, diro->ino, &diro->inode); - if (grub_errno) - return 0; -+ -+ if (diro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) -+ { -+ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "symlink is encrypted"); -+ return 0; -+ } - } - - symlink = grub_malloc (grub_le_to_cpu32 (diro->inode.size) + 1); -@@ -749,6 +758,12 @@ grub_ext2_iterate_dir (grub_fshelp_node_t dir, - return 0; - } - -+ if (diro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) -+ { -+ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "directory is encrypted"); -+ return 0; -+ } -+ - /* Search the file. */ - while (fpos < grub_le_to_cpu32 (diro->inode.size)) - { -@@ -859,6 +874,12 @@ grub_ext2_open (struct grub_file *file, const char *name) - goto fail; - } - -+ if (fdiro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG)) -+ { -+ err = grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "file is encrypted"); -+ goto fail; -+ } -+ - grub_memcpy (data->inode, &fdiro->inode, sizeof (struct grub_ext2_inode)); - grub_free (fdiro); - -diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c -new file mode 100644 -index 0000000000000000000000000000000000000000..1cad2615f3c9e65e57a12d18b76f4ecc1caa31d8 ---- /dev/null -+++ b/grub-core/fs/f2fs.c -@@ -0,0 +1,1314 @@ -+/* -+ * f2fs.c - Flash-Friendly File System -+ * -+ * Written by Jaegeuk Kim -+ * -+ * Copyright (C) 2015 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+/* F2FS Magic Number. */ -+#define F2FS_SUPER_MAGIC 0xf2f52010 -+ -+#define CHECKSUM_OFFSET 4092 /* Must be aligned 4 bytes. */ -+#define U32_CHECKSUM_OFFSET (CHECKSUM_OFFSET >> 2) -+#define CRCPOLY_LE 0xedb88320 -+ -+/* Byte-size offset. */ -+#define F2FS_SUPER_OFFSET ((grub_disk_addr_t)1024) -+#define F2FS_SUPER_OFFSET0 (F2FS_SUPER_OFFSET >> GRUB_DISK_SECTOR_BITS) -+#define F2FS_SUPER_OFFSET1 ((F2FS_SUPER_OFFSET + F2FS_BLKSIZE) >> \ -+ GRUB_DISK_SECTOR_BITS) -+ -+/* 9 bits for 512 bytes. */ -+#define F2FS_MIN_LOG_SECTOR_SIZE 9 -+ -+/* Support only 4KB block. */ -+#define F2FS_BLK_BITS 12 -+#define F2FS_BLKSIZE (1 << F2FS_BLK_BITS) -+#define F2FS_BLK_SEC_BITS (F2FS_BLK_BITS - GRUB_DISK_SECTOR_BITS) -+ -+#define VERSION_LEN 256 -+#define F2FS_MAX_EXTENSION 64 -+ -+#define CP_COMPACT_SUM_FLAG 0x00000004 -+#define CP_UMOUNT_FLAG 0x00000001 -+ -+#define MAX_ACTIVE_LOGS 16 -+#define MAX_ACTIVE_NODE_LOGS 8 -+#define MAX_ACTIVE_DATA_LOGS 8 -+#define NR_CURSEG_DATA_TYPE 3 -+#define NR_CURSEG_NODE_TYPE 3 -+#define NR_CURSEG_TYPE (NR_CURSEG_DATA_TYPE + NR_CURSEG_NODE_TYPE) -+ -+#define ENTRIES_IN_SUM 512 -+#define SUMMARY_SIZE 7 -+#define SUM_FOOTER_SIZE 5 -+#define JENTRY_SIZE (sizeof(struct grub_f2fs_nat_jent)) -+#define SUM_ENTRIES_SIZE (SUMMARY_SIZE * ENTRIES_IN_SUM) -+#define SUM_JOURNAL_SIZE (F2FS_BLKSIZE - SUM_FOOTER_SIZE - SUM_ENTRIES_SIZE) -+#define NAT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) / JENTRY_SIZE) -+#define NAT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) % JENTRY_SIZE) -+ -+#define NAT_ENTRY_SIZE (sizeof(struct grub_f2fs_nat_entry)) -+#define NAT_ENTRY_PER_BLOCK (F2FS_BLKSIZE / NAT_ENTRY_SIZE) -+ -+#define F2FS_NAME_LEN 255 -+#define F2FS_SLOT_LEN 8 -+#define NR_DENTRY_IN_BLOCK 214 -+#define SIZE_OF_DIR_ENTRY 11 /* By byte. */ -+#define BITS_PER_BYTE 8 -+#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \ -+ BITS_PER_BYTE) -+#define SIZE_OF_RESERVED (F2FS_BLKSIZE - \ -+ ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \ -+ NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP)) -+ -+#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs. */ -+#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode. */ -+ -+#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block. */ -+#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block. */ -+#define NODE_DIR1_BLOCK (DEF_ADDRS_PER_INODE + 1) -+#define NODE_DIR2_BLOCK (DEF_ADDRS_PER_INODE + 2) -+#define NODE_IND1_BLOCK (DEF_ADDRS_PER_INODE + 3) -+#define NODE_IND2_BLOCK (DEF_ADDRS_PER_INODE + 4) -+#define NODE_DIND_BLOCK (DEF_ADDRS_PER_INODE + 5) -+ -+#define MAX_INLINE_DATA (4 * (DEF_ADDRS_PER_INODE - \ -+ F2FS_INLINE_XATTR_ADDRS - 1)) -+#define NR_INLINE_DENTRY (MAX_INLINE_DATA * BITS_PER_BYTE / \ -+ ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \ -+ BITS_PER_BYTE + 1)) -+#define INLINE_DENTRY_BITMAP_SIZE ((NR_INLINE_DENTRY + BITS_PER_BYTE - 1) / \ -+ BITS_PER_BYTE) -+#define INLINE_RESERVED_SIZE (MAX_INLINE_DATA - \ -+ ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \ -+ NR_INLINE_DENTRY + \ -+ INLINE_DENTRY_BITMAP_SIZE)) -+#define CURSEG_HOT_DATA 0 -+ -+#define CKPT_FLAG_SET(ckpt, f) (ckpt)->ckpt_flags & \ -+ grub_cpu_to_le32_compile_time (f) -+ -+#define F2FS_INLINE_XATTR 0x01 /* File inline xattr flag. */ -+#define F2FS_INLINE_DATA 0x02 /* File inline data flag. */ -+#define F2FS_INLINE_DENTRY 0x04 /* File inline dentry flag. */ -+#define F2FS_DATA_EXIST 0x08 /* File inline data exist flag. */ -+#define F2FS_INLINE_DOTS 0x10 /* File having implicit dot dentries. */ -+ -+#define MAX_VOLUME_NAME 512 -+ -+enum FILE_TYPE -+{ -+ F2FS_FT_UNKNOWN, -+ F2FS_FT_REG_FILE = 1, -+ F2FS_FT_DIR = 2, -+ F2FS_FT_SYMLINK = 7 -+}; -+ -+struct grub_f2fs_superblock -+{ -+ grub_uint32_t magic; -+ grub_uint16_t dummy1[2]; -+ grub_uint32_t log_sectorsize; -+ grub_uint32_t log_sectors_per_block; -+ grub_uint32_t log_blocksize; -+ grub_uint32_t log_blocks_per_seg; -+ grub_uint32_t segs_per_sec; -+ grub_uint32_t secs_per_zone; -+ grub_uint32_t checksum_offset; -+ grub_uint8_t dummy2[40]; -+ grub_uint32_t cp_blkaddr; -+ grub_uint32_t sit_blkaddr; -+ grub_uint32_t nat_blkaddr; -+ grub_uint32_t ssa_blkaddr; -+ grub_uint32_t main_blkaddr; -+ grub_uint32_t root_ino; -+ grub_uint32_t node_ino; -+ grub_uint32_t meta_ino; -+ grub_uint8_t uuid[16]; -+ grub_uint16_t volume_name[MAX_VOLUME_NAME]; -+ grub_uint32_t extension_count; -+ grub_uint8_t extension_list[F2FS_MAX_EXTENSION][8]; -+ grub_uint32_t cp_payload; -+ grub_uint8_t version[VERSION_LEN]; -+ grub_uint8_t init_version[VERSION_LEN]; -+} GRUB_PACKED; -+ -+struct grub_f2fs_checkpoint -+{ -+ grub_uint64_t checkpoint_ver; -+ grub_uint64_t user_block_count; -+ grub_uint64_t valid_block_count; -+ grub_uint32_t rsvd_segment_count; -+ grub_uint32_t overprov_segment_count; -+ grub_uint32_t free_segment_count; -+ grub_uint32_t cur_node_segno[MAX_ACTIVE_NODE_LOGS]; -+ grub_uint16_t cur_node_blkoff[MAX_ACTIVE_NODE_LOGS]; -+ grub_uint32_t cur_data_segno[MAX_ACTIVE_DATA_LOGS]; -+ grub_uint16_t cur_data_blkoff[MAX_ACTIVE_DATA_LOGS]; -+ grub_uint32_t ckpt_flags; -+ grub_uint32_t cp_pack_total_block_count; -+ grub_uint32_t cp_pack_start_sum; -+ grub_uint32_t valid_node_count; -+ grub_uint32_t valid_inode_count; -+ grub_uint32_t next_free_nid; -+ grub_uint32_t sit_ver_bitmap_bytesize; -+ grub_uint32_t nat_ver_bitmap_bytesize; -+ grub_uint32_t checksum_offset; -+ grub_uint64_t elapsed_time; -+ grub_uint8_t alloc_type[MAX_ACTIVE_LOGS]; -+ grub_uint8_t sit_nat_version_bitmap[3900]; -+ grub_uint32_t checksum; -+} GRUB_PACKED; -+ -+struct grub_f2fs_nat_entry { -+ grub_uint8_t version; -+ grub_uint32_t ino; -+ grub_uint32_t block_addr; -+} GRUB_PACKED; -+ -+struct grub_f2fs_nat_jent -+{ -+ grub_uint32_t nid; -+ struct grub_f2fs_nat_entry ne; -+} GRUB_PACKED; -+ -+struct grub_f2fs_nat_journal { -+ grub_uint16_t n_nats; -+ struct grub_f2fs_nat_jent entries[NAT_JOURNAL_ENTRIES]; -+ grub_uint8_t reserved[NAT_JOURNAL_RESERVED]; -+} GRUB_PACKED; -+ -+struct grub_f2fs_nat_block { -+ struct grub_f2fs_nat_entry ne[NAT_ENTRY_PER_BLOCK]; -+} GRUB_PACKED; -+ -+struct grub_f2fs_dir_entry -+{ -+ grub_uint32_t hash_code; -+ grub_uint32_t ino; -+ grub_uint16_t name_len; -+ grub_uint8_t file_type; -+} GRUB_PACKED; -+ -+struct grub_f2fs_inline_dentry -+{ -+ grub_uint8_t dentry_bitmap[INLINE_DENTRY_BITMAP_SIZE]; -+ grub_uint8_t reserved[INLINE_RESERVED_SIZE]; -+ struct grub_f2fs_dir_entry dentry[NR_INLINE_DENTRY]; -+ grub_uint8_t filename[NR_INLINE_DENTRY][F2FS_SLOT_LEN]; -+} GRUB_PACKED; -+ -+struct grub_f2fs_dentry_block { -+ grub_uint8_t dentry_bitmap[SIZE_OF_DENTRY_BITMAP]; -+ grub_uint8_t reserved[SIZE_OF_RESERVED]; -+ struct grub_f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK]; -+ grub_uint8_t filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN]; -+} GRUB_PACKED; -+ -+struct grub_f2fs_inode -+{ -+ grub_uint16_t i_mode; -+ grub_uint8_t i_advise; -+ grub_uint8_t i_inline; -+ grub_uint32_t i_uid; -+ grub_uint32_t i_gid; -+ grub_uint32_t i_links; -+ grub_uint64_t i_size; -+ grub_uint64_t i_blocks; -+ grub_uint64_t i_atime; -+ grub_uint64_t i_ctime; -+ grub_uint64_t i_mtime; -+ grub_uint32_t i_atime_nsec; -+ grub_uint32_t i_ctime_nsec; -+ grub_uint32_t i_mtime_nsec; -+ grub_uint32_t i_generation; -+ grub_uint32_t i_current_depth; -+ grub_uint32_t i_xattr_nid; -+ grub_uint32_t i_flags; -+ grub_uint32_t i_pino; -+ grub_uint32_t i_namelen; -+ grub_uint8_t i_name[F2FS_NAME_LEN]; -+ grub_uint8_t i_dir_level; -+ grub_uint8_t i_ext[12]; -+ grub_uint32_t i_addr[DEF_ADDRS_PER_INODE]; -+ grub_uint32_t i_nid[5]; -+} GRUB_PACKED; -+ -+struct grub_direct_node { -+ grub_uint32_t addr[ADDRS_PER_BLOCK]; -+} GRUB_PACKED; -+ -+struct grub_indirect_node { -+ grub_uint32_t nid[NIDS_PER_BLOCK]; -+} GRUB_PACKED; -+ -+struct grub_f2fs_node -+{ -+ union -+ { -+ struct grub_f2fs_inode i; -+ struct grub_direct_node dn; -+ struct grub_indirect_node in; -+ /* Should occupy F2FS_BLKSIZE totally. */ -+ char buf[F2FS_BLKSIZE - 40]; -+ }; -+ grub_uint8_t dummy[40]; -+} GRUB_PACKED; -+ -+struct grub_fshelp_node -+{ -+ struct grub_f2fs_data *data; -+ struct grub_f2fs_node inode; -+ grub_uint32_t ino; -+ int inode_read; -+}; -+ -+struct grub_f2fs_data -+{ -+ struct grub_f2fs_superblock sblock; -+ struct grub_f2fs_checkpoint ckpt; -+ -+ grub_uint32_t root_ino; -+ grub_uint32_t blocks_per_seg; -+ grub_uint32_t cp_blkaddr; -+ grub_uint32_t nat_blkaddr; -+ -+ struct grub_f2fs_nat_journal nat_j; -+ char *nat_bitmap; -+ -+ grub_disk_t disk; -+ struct grub_f2fs_node *inode; -+ struct grub_fshelp_node diropen; -+}; -+ -+struct grub_f2fs_dir_iter_ctx -+{ -+ struct grub_f2fs_data *data; -+ grub_fshelp_iterate_dir_hook_t hook; -+ void *hook_data; -+ grub_uint8_t *bitmap; -+ grub_uint8_t (*filename)[F2FS_SLOT_LEN]; -+ struct grub_f2fs_dir_entry *dentry; -+ int max; -+}; -+ -+struct grub_f2fs_dir_ctx -+{ -+ grub_fs_dir_hook_t hook; -+ void *hook_data; -+ struct grub_f2fs_data *data; -+}; -+ -+static grub_dl_t my_mod; -+ -+static int -+grub_f2fs_test_bit_le (int nr, const grub_uint8_t *addr) -+{ -+ return addr[nr >> 3] & (1 << (nr & 7)); -+} -+ -+static char * -+get_inline_addr (struct grub_f2fs_inode *inode) -+{ -+ return (char *) &inode->i_addr[1]; -+} -+ -+static grub_uint64_t -+grub_f2fs_file_size (struct grub_f2fs_inode *inode) -+{ -+ return grub_le_to_cpu64 (inode->i_size); -+} -+ -+static grub_uint32_t -+start_cp_addr (struct grub_f2fs_data *data) -+{ -+ struct grub_f2fs_checkpoint *ckpt = &data->ckpt; -+ grub_uint32_t start_addr = data->cp_blkaddr; -+ -+ if (!(ckpt->checkpoint_ver & grub_cpu_to_le64_compile_time(1))) -+ return start_addr + data->blocks_per_seg; -+ -+ return start_addr; -+} -+ -+static grub_uint32_t -+start_sum_block (struct grub_f2fs_data *data) -+{ -+ struct grub_f2fs_checkpoint *ckpt = &data->ckpt; -+ -+ return start_cp_addr (data) + grub_le_to_cpu32 (ckpt->cp_pack_start_sum); -+} -+ -+static grub_uint32_t -+sum_blk_addr (struct grub_f2fs_data *data, int base, int type) -+{ -+ struct grub_f2fs_checkpoint *ckpt = &data->ckpt; -+ -+ return start_cp_addr (data) + -+ grub_le_to_cpu32 (ckpt->cp_pack_total_block_count) - -+ (base + 1) + type; -+} -+ -+static void * -+nat_bitmap_ptr (struct grub_f2fs_data *data) -+{ -+ struct grub_f2fs_checkpoint *ckpt = &data->ckpt; -+ grub_uint32_t offset; -+ -+ if (grub_le_to_cpu32 (data->sblock.cp_payload) > 0) -+ return ckpt->sit_nat_version_bitmap; -+ -+ offset = grub_le_to_cpu32 (ckpt->sit_ver_bitmap_bytesize); -+ -+ return ckpt->sit_nat_version_bitmap + offset; -+} -+ -+static grub_uint32_t -+get_node_id (struct grub_f2fs_node *rn, int off, int inode_block) -+{ -+ if (inode_block) -+ return grub_le_to_cpu32 (rn->i.i_nid[off - NODE_DIR1_BLOCK]); -+ -+ return grub_le_to_cpu32 (rn->in.nid[off]); -+} -+ -+static grub_err_t -+grub_f2fs_block_read (struct grub_f2fs_data *data, grub_uint32_t blkaddr, -+ void *buf) -+{ -+ return grub_disk_read (data->disk, -+ ((grub_disk_addr_t)blkaddr) << F2FS_BLK_SEC_BITS, -+ 0, F2FS_BLKSIZE, buf); -+} -+ -+/* CRC32 */ -+static grub_uint32_t -+grub_f2fs_cal_crc32 (const void *buf, const grub_uint32_t len) -+{ -+ grub_uint32_t crc = F2FS_SUPER_MAGIC; -+ unsigned char *p = (unsigned char *)buf; -+ grub_uint32_t tmp = len; -+ int i; -+ -+ while (tmp--) -+ { -+ crc ^= *p++; -+ for (i = 0; i < 8; i++) -+ crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0); -+ } -+ -+ return crc; -+} -+ -+static int -+grub_f2fs_crc_valid (grub_uint32_t blk_crc, void *buf, const grub_uint32_t len) -+{ -+ grub_uint32_t cal_crc = 0; -+ -+ cal_crc = grub_f2fs_cal_crc32 (buf, len); -+ -+ return (cal_crc == blk_crc) ? 1 : 0; -+} -+ -+static int -+grub_f2fs_test_bit (grub_uint32_t nr, const char *p) -+{ -+ int mask; -+ -+ p += (nr >> 3); -+ mask = 1 << (7 - (nr & 0x07)); -+ -+ return mask & *p; -+} -+ -+static int -+grub_f2fs_sanity_check_sb (struct grub_f2fs_superblock *sb) -+{ -+ grub_uint32_t log_sectorsize, log_sectors_per_block; -+ -+ if (sb->magic != grub_cpu_to_le32_compile_time (F2FS_SUPER_MAGIC)) -+ return -1; -+ -+ if (sb->log_blocksize != grub_cpu_to_le32_compile_time (F2FS_BLK_BITS)) -+ return -1; -+ -+ log_sectorsize = grub_le_to_cpu32 (sb->log_sectorsize); -+ log_sectors_per_block = grub_le_to_cpu32 (sb->log_sectors_per_block); -+ -+ if (log_sectorsize > F2FS_BLK_BITS) -+ return -1; -+ -+ if (log_sectorsize < F2FS_MIN_LOG_SECTOR_SIZE) -+ return -1; -+ -+ if (log_sectors_per_block + log_sectorsize != F2FS_BLK_BITS) -+ return -1; -+ -+ return 0; -+} -+ -+static int -+grub_f2fs_read_sb (struct grub_f2fs_data *data, grub_disk_addr_t offset) -+{ -+ grub_disk_t disk = data->disk; -+ grub_err_t err; -+ -+ /* Read first super block. */ -+ err = grub_disk_read (disk, offset, 0, sizeof (data->sblock), &data->sblock); -+ if (err) -+ return -1; -+ -+ return grub_f2fs_sanity_check_sb (&data->sblock); -+} -+ -+static void * -+validate_checkpoint (struct grub_f2fs_data *data, grub_uint32_t cp_addr, -+ grub_uint64_t *version) -+{ -+ grub_uint32_t *cp_page_1, *cp_page_2; -+ struct grub_f2fs_checkpoint *cp_block; -+ grub_uint64_t cur_version = 0, pre_version = 0; -+ grub_uint32_t crc = 0; -+ grub_uint32_t crc_offset; -+ grub_err_t err; -+ -+ /* Read the 1st cp block in this CP pack. */ -+ cp_page_1 = grub_malloc (F2FS_BLKSIZE); -+ if (!cp_page_1) -+ return NULL; -+ -+ err = grub_f2fs_block_read (data, cp_addr, cp_page_1); -+ if (err) -+ goto invalid_cp1; -+ -+ cp_block = (struct grub_f2fs_checkpoint *)cp_page_1; -+ crc_offset = grub_le_to_cpu32 (cp_block->checksum_offset); -+ if (crc_offset != CHECKSUM_OFFSET) -+ goto invalid_cp1; -+ -+ crc = grub_le_to_cpu32 (*(cp_page_1 + U32_CHECKSUM_OFFSET)); -+ if (!grub_f2fs_crc_valid (crc, cp_block, crc_offset)) -+ goto invalid_cp1; -+ -+ pre_version = grub_le_to_cpu64 (cp_block->checkpoint_ver); -+ -+ /* Read the 2nd cp block in this CP pack. */ -+ cp_page_2 = grub_malloc (F2FS_BLKSIZE); -+ if (!cp_page_2) -+ goto invalid_cp1; -+ -+ cp_addr += grub_le_to_cpu32 (cp_block->cp_pack_total_block_count) - 1; -+ -+ err = grub_f2fs_block_read (data, cp_addr, cp_page_2); -+ if (err) -+ goto invalid_cp2; -+ -+ cp_block = (struct grub_f2fs_checkpoint *)cp_page_2; -+ crc_offset = grub_le_to_cpu32 (cp_block->checksum_offset); -+ if (crc_offset != CHECKSUM_OFFSET) -+ goto invalid_cp2; -+ -+ crc = grub_le_to_cpu32 (*(cp_page_2 + U32_CHECKSUM_OFFSET)); -+ if (!grub_f2fs_crc_valid (crc, cp_block, crc_offset)) -+ goto invalid_cp2; -+ -+ cur_version = grub_le_to_cpu64 (cp_block->checkpoint_ver); -+ if (cur_version == pre_version) -+ { -+ *version = cur_version; -+ grub_free (cp_page_2); -+ -+ return cp_page_1; -+ } -+ -+ invalid_cp2: -+ grub_free (cp_page_2); -+ -+ invalid_cp1: -+ grub_free (cp_page_1); -+ -+ return NULL; -+} -+ -+static grub_err_t -+grub_f2fs_read_cp (struct grub_f2fs_data *data) -+{ -+ void *cp1, *cp2, *cur_page; -+ grub_uint64_t cp1_version = 0, cp2_version = 0; -+ grub_uint64_t cp_start_blk_no; -+ -+ /* -+ * Finding out valid cp block involves read both -+ * sets (cp pack1 and cp pack 2). -+ */ -+ cp_start_blk_no = data->cp_blkaddr; -+ cp1 = validate_checkpoint (data, cp_start_blk_no, &cp1_version); -+ if (!cp1 && grub_errno) -+ return grub_errno; -+ -+ /* The second checkpoint pack should start at the next segment. */ -+ cp_start_blk_no += data->blocks_per_seg; -+ cp2 = validate_checkpoint (data, cp_start_blk_no, &cp2_version); -+ if (!cp2 && grub_errno) -+ { -+ grub_free (cp1); -+ return grub_errno; -+ } -+ -+ if (cp1 && cp2) -+ cur_page = (cp2_version > cp1_version) ? cp2 : cp1; -+ else if (cp1) -+ cur_page = cp1; -+ else if (cp2) -+ cur_page = cp2; -+ else -+ return grub_error (GRUB_ERR_BAD_FS, "no checkpoints"); -+ -+ grub_memcpy (&data->ckpt, cur_page, F2FS_BLKSIZE); -+ -+ grub_free (cp1); -+ grub_free (cp2); -+ -+ return 0; -+} -+ -+static grub_err_t -+get_nat_journal (struct grub_f2fs_data *data) -+{ -+ grub_uint32_t block; -+ char *buf; -+ grub_err_t err; -+ -+ buf = grub_malloc (F2FS_BLKSIZE); -+ if (!buf) -+ return grub_errno; -+ -+ if (CKPT_FLAG_SET(&data->ckpt, CP_COMPACT_SUM_FLAG)) -+ block = start_sum_block (data); -+ else if (CKPT_FLAG_SET (&data->ckpt, CP_UMOUNT_FLAG)) -+ block = sum_blk_addr (data, NR_CURSEG_TYPE, CURSEG_HOT_DATA); -+ else -+ block = sum_blk_addr (data, NR_CURSEG_DATA_TYPE, CURSEG_HOT_DATA); -+ -+ err = grub_f2fs_block_read (data, block, buf); -+ if (err) -+ goto fail; -+ -+ if (CKPT_FLAG_SET (&data->ckpt, CP_COMPACT_SUM_FLAG)) -+ grub_memcpy (&data->nat_j, buf, SUM_JOURNAL_SIZE); -+ else -+ grub_memcpy (&data->nat_j, buf + SUM_ENTRIES_SIZE, SUM_JOURNAL_SIZE); -+ -+ fail: -+ grub_free (buf); -+ -+ return err; -+} -+ -+static grub_uint32_t -+get_blkaddr_from_nat_journal (struct grub_f2fs_data *data, grub_uint32_t nid) -+{ -+ grub_uint16_t n = grub_le_to_cpu16 (data->nat_j.n_nats); -+ grub_uint32_t blkaddr = 0; -+ grub_uint16_t i; -+ -+ for (i = 0; i < n; i++) -+ { -+ if (grub_le_to_cpu32 (data->nat_j.entries[i].nid) == nid) -+ { -+ blkaddr = grub_le_to_cpu32 (data->nat_j.entries[i].ne.block_addr); -+ break; -+ } -+ } -+ -+ return blkaddr; -+} -+ -+static grub_uint32_t -+get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid) -+{ -+ struct grub_f2fs_nat_block *nat_block; -+ grub_uint32_t seg_off, block_off, entry_off, block_addr; -+ grub_uint32_t blkaddr; -+ grub_err_t err; -+ -+ blkaddr = get_blkaddr_from_nat_journal (data, nid); -+ if (blkaddr) -+ return blkaddr; -+ -+ nat_block = grub_malloc (F2FS_BLKSIZE); -+ if (!nat_block) -+ return 0; -+ -+ block_off = nid / NAT_ENTRY_PER_BLOCK; -+ entry_off = nid % NAT_ENTRY_PER_BLOCK; -+ -+ seg_off = block_off / data->blocks_per_seg; -+ block_addr = data->nat_blkaddr + -+ ((seg_off * data->blocks_per_seg) << 1) + -+ (block_off & (data->blocks_per_seg - 1)); -+ -+ if (grub_f2fs_test_bit (block_off, data->nat_bitmap)) -+ block_addr += data->blocks_per_seg; -+ -+ err = grub_f2fs_block_read (data, block_addr, nat_block); -+ if (err) -+ { -+ grub_free (nat_block); -+ return 0; -+ } -+ -+ blkaddr = grub_le_to_cpu32 (nat_block->ne[entry_off].block_addr); -+ -+ grub_free (nat_block); -+ -+ return blkaddr; -+} -+ -+static int -+grub_get_node_path (struct grub_f2fs_inode *inode, grub_uint32_t block, -+ grub_uint32_t offset[4], grub_uint32_t noffset[4]) -+{ -+ grub_uint32_t direct_blks = ADDRS_PER_BLOCK; -+ grub_uint32_t dptrs_per_blk = NIDS_PER_BLOCK; -+ grub_uint32_t indirect_blks = ADDRS_PER_BLOCK * NIDS_PER_BLOCK; -+ grub_uint32_t dindirect_blks = indirect_blks * NIDS_PER_BLOCK; -+ grub_uint32_t direct_index = DEF_ADDRS_PER_INODE; -+ int n = 0; -+ int level = 0; -+ -+ if (inode->i_inline & F2FS_INLINE_XATTR) -+ direct_index -= F2FS_INLINE_XATTR_ADDRS; -+ -+ noffset[0] = 0; -+ -+ if (block < direct_index) -+ { -+ offset[n] = block; -+ goto got; -+ } -+ -+ block -= direct_index; -+ if (block < direct_blks) -+ { -+ offset[n++] = NODE_DIR1_BLOCK; -+ noffset[n] = 1; -+ offset[n] = block; -+ level = 1; -+ goto got; -+ } -+ -+ block -= direct_blks; -+ if (block < direct_blks) -+ { -+ offset[n++] = NODE_DIR2_BLOCK; -+ noffset[n] = 2; -+ offset[n] = block; -+ level = 1; -+ goto got; -+ } -+ -+ block -= direct_blks; -+ if (block < indirect_blks) -+ { -+ offset[n++] = NODE_IND1_BLOCK; -+ noffset[n] = 3; -+ offset[n++] = block / direct_blks; -+ noffset[n] = 4 + offset[n - 1]; -+ offset[n] = block % direct_blks; -+ level = 2; -+ goto got; -+ } -+ -+ block -= indirect_blks; -+ if (block < indirect_blks) -+ { -+ offset[n++] = NODE_IND2_BLOCK; -+ noffset[n] = 4 + dptrs_per_blk; -+ offset[n++] = block / direct_blks; -+ noffset[n] = 5 + dptrs_per_blk + offset[n - 1]; -+ offset[n] = block % direct_blks; -+ level = 2; -+ goto got; -+ } -+ -+ block -= indirect_blks; -+ if (block < dindirect_blks) -+ { -+ offset[n++] = NODE_DIND_BLOCK; -+ noffset[n] = 5 + (dptrs_per_blk * 2); -+ offset[n++] = block / indirect_blks; -+ noffset[n] = 6 + (dptrs_per_blk * 2) + -+ offset[n - 1] * (dptrs_per_blk + 1); -+ offset[n++] = (block / direct_blks) % dptrs_per_blk; -+ noffset[n] = 7 + (dptrs_per_blk * 2) + -+ offset[n - 2] * (dptrs_per_blk + 1) + offset[n - 1]; -+ offset[n] = block % direct_blks; -+ level = 3; -+ goto got; -+ } -+ -+ got: -+ return level; -+} -+ -+static grub_err_t -+grub_f2fs_read_node (struct grub_f2fs_data *data, -+ grub_uint32_t nid, struct grub_f2fs_node *np) -+{ -+ grub_uint32_t blkaddr; -+ -+ blkaddr = get_node_blkaddr (data, nid); -+ if (!blkaddr) -+ return grub_errno; -+ -+ return grub_f2fs_block_read (data, blkaddr, np); -+} -+ -+static struct grub_f2fs_data * -+grub_f2fs_mount (grub_disk_t disk) -+{ -+ struct grub_f2fs_data *data; -+ grub_err_t err; -+ -+ data = grub_malloc (sizeof (*data)); -+ if (!data) -+ return NULL; -+ -+ data->disk = disk; -+ -+ if (grub_f2fs_read_sb (data, F2FS_SUPER_OFFSET0)) -+ { -+ if (grub_f2fs_read_sb (data, F2FS_SUPER_OFFSET1)) -+ { -+ if (grub_errno == GRUB_ERR_NONE) -+ grub_error (GRUB_ERR_BAD_FS, -+ "not a F2FS filesystem (no superblock)"); -+ goto fail; -+ } -+ } -+ -+ data->root_ino = grub_le_to_cpu32 (data->sblock.root_ino); -+ data->cp_blkaddr = grub_le_to_cpu32 (data->sblock.cp_blkaddr); -+ data->nat_blkaddr = grub_le_to_cpu32 (data->sblock.nat_blkaddr); -+ data->blocks_per_seg = 1 << -+ grub_le_to_cpu32 (data->sblock.log_blocks_per_seg); -+ -+ err = grub_f2fs_read_cp (data); -+ if (err) -+ goto fail; -+ -+ data->nat_bitmap = nat_bitmap_ptr (data); -+ -+ err = get_nat_journal (data); -+ if (err) -+ goto fail; -+ -+ data->diropen.data = data; -+ data->diropen.ino = data->root_ino; -+ data->diropen.inode_read = 1; -+ data->inode = &data->diropen.inode; -+ -+ err = grub_f2fs_read_node (data, data->root_ino, data->inode); -+ if (err) -+ goto fail; -+ -+ return data; -+ -+ fail: -+ grub_free (data); -+ -+ return NULL; -+} -+ -+/* Guarantee inline_data was handled by caller. */ -+static grub_disk_addr_t -+grub_f2fs_get_block (grub_fshelp_node_t node, grub_disk_addr_t block_ofs) -+{ -+ struct grub_f2fs_data *data = node->data; -+ struct grub_f2fs_inode *inode = &node->inode.i; -+ grub_uint32_t offset[4], noffset[4], nids[4]; -+ struct grub_f2fs_node *node_block; -+ grub_uint32_t block_addr = -1; -+ int level, i; -+ -+ level = grub_get_node_path (inode, block_ofs, offset, noffset); -+ if (level == 0) -+ return grub_le_to_cpu32 (inode->i_addr[offset[0]]); -+ -+ node_block = grub_malloc (F2FS_BLKSIZE); -+ if (!node_block) -+ return -1; -+ -+ nids[1] = get_node_id (&node->inode, offset[0], 1); -+ -+ /* Get indirect or direct nodes. */ -+ for (i = 1; i <= level; i++) -+ { -+ grub_f2fs_read_node (data, nids[i], node_block); -+ if (grub_errno) -+ goto fail; -+ -+ if (i < level) -+ nids[i + 1] = get_node_id (node_block, offset[i], 0); -+ } -+ -+ block_addr = grub_le_to_cpu32 (node_block->dn.addr[offset[level]]); -+ -+ fail: -+ grub_free (node_block); -+ -+ return block_addr; -+} -+ -+static grub_ssize_t -+grub_f2fs_read_file (grub_fshelp_node_t node, -+ grub_disk_read_hook_t read_hook, void *read_hook_data, -+ grub_off_t pos, grub_size_t len, char *buf) -+{ -+ struct grub_f2fs_inode *inode = &node->inode.i; -+ grub_off_t filesize = grub_f2fs_file_size (inode); -+ char *inline_addr = get_inline_addr (inode); -+ -+ if (inode->i_inline & F2FS_INLINE_DATA) -+ { -+ if (filesize > MAX_INLINE_DATA) -+ return -1; -+ -+ if (len > filesize - pos) -+ len = filesize - pos; -+ -+ grub_memcpy (buf, inline_addr + pos, len); -+ return len; -+ } -+ -+ return grub_fshelp_read_file (node->data->disk, node, -+ read_hook, read_hook_data, -+ pos, len, buf, grub_f2fs_get_block, -+ filesize, -+ F2FS_BLK_SEC_BITS, 0); -+} -+ -+static char * -+grub_f2fs_read_symlink (grub_fshelp_node_t node) -+{ -+ char *symlink; -+ struct grub_fshelp_node *diro = node; -+ grub_uint64_t filesize; -+ -+ if (!diro->inode_read) -+ { -+ grub_f2fs_read_node (diro->data, diro->ino, &diro->inode); -+ if (grub_errno) -+ return 0; -+ } -+ -+ filesize = grub_f2fs_file_size(&diro->inode.i); -+ -+ symlink = grub_malloc (filesize + 1); -+ if (!symlink) -+ return 0; -+ -+ grub_f2fs_read_file (diro, 0, 0, 0, filesize, symlink); -+ if (grub_errno) -+ { -+ grub_free (symlink); -+ return 0; -+ } -+ -+ symlink[filesize] = '\0'; -+ -+ return symlink; -+} -+ -+static int -+grub_f2fs_check_dentries (struct grub_f2fs_dir_iter_ctx *ctx) -+{ -+ struct grub_fshelp_node *fdiro; -+ int i; -+ -+ for (i = 0; i < ctx->max;) -+ { -+ char *filename; -+ enum grub_fshelp_filetype type = GRUB_FSHELP_UNKNOWN; -+ enum FILE_TYPE ftype; -+ int name_len; -+ int ret; -+ -+ if (grub_f2fs_test_bit_le (i, ctx->bitmap) == 0) -+ { -+ i++; -+ continue; -+ } -+ -+ ftype = ctx->dentry[i].file_type; -+ name_len = grub_le_to_cpu16 (ctx->dentry[i].name_len); -+ filename = grub_malloc (name_len + 1); -+ if (!filename) -+ return 0; -+ -+ grub_memcpy (filename, ctx->filename[i], name_len); -+ filename[name_len] = 0; -+ -+ fdiro = grub_malloc (sizeof (struct grub_fshelp_node)); -+ if (!fdiro) -+ { -+ grub_free(filename); -+ return 0; -+ } -+ -+ if (ftype == F2FS_FT_DIR) -+ type = GRUB_FSHELP_DIR; -+ else if (ftype == F2FS_FT_SYMLINK) -+ type = GRUB_FSHELP_SYMLINK; -+ else if (ftype == F2FS_FT_REG_FILE) -+ type = GRUB_FSHELP_REG; -+ -+ fdiro->data = ctx->data; -+ fdiro->ino = grub_le_to_cpu32 (ctx->dentry[i].ino); -+ fdiro->inode_read = 0; -+ -+ ret = ctx->hook (filename, type, fdiro, ctx->hook_data); -+ grub_free(filename); -+ if (ret) -+ return 1; -+ -+ i += (name_len + F2FS_SLOT_LEN - 1) / F2FS_SLOT_LEN; -+ } -+ -+ return 0; -+} -+ -+static int -+grub_f2fs_iterate_inline_dir (struct grub_f2fs_inode *dir, -+ struct grub_f2fs_dir_iter_ctx *ctx) -+{ -+ struct grub_f2fs_inline_dentry *de_blk; -+ -+ de_blk = (struct grub_f2fs_inline_dentry *) get_inline_addr (dir); -+ -+ ctx->bitmap = de_blk->dentry_bitmap; -+ ctx->dentry = de_blk->dentry; -+ ctx->filename = de_blk->filename; -+ ctx->max = NR_INLINE_DENTRY; -+ -+ return grub_f2fs_check_dentries (ctx); -+} -+ -+static int -+grub_f2fs_iterate_dir (grub_fshelp_node_t dir, -+ grub_fshelp_iterate_dir_hook_t hook, void *hook_data) -+{ -+ struct grub_fshelp_node *diro = (struct grub_fshelp_node *) dir; -+ struct grub_f2fs_inode *inode; -+ struct grub_f2fs_dir_iter_ctx ctx = { -+ .data = diro->data, -+ .hook = hook, -+ .hook_data = hook_data -+ }; -+ grub_off_t fpos = 0; -+ -+ if (!diro->inode_read) -+ { -+ grub_f2fs_read_node (diro->data, diro->ino, &diro->inode); -+ if (grub_errno) -+ return 0; -+ } -+ -+ inode = &diro->inode.i; -+ -+ if (inode->i_inline & F2FS_INLINE_DENTRY) -+ return grub_f2fs_iterate_inline_dir (inode, &ctx); -+ -+ while (fpos < grub_f2fs_file_size (inode)) -+ { -+ struct grub_f2fs_dentry_block *de_blk; -+ char *buf; -+ int ret; -+ -+ buf = grub_zalloc (F2FS_BLKSIZE); -+ if (!buf) -+ return 0; -+ -+ grub_f2fs_read_file (diro, 0, 0, fpos, F2FS_BLKSIZE, buf); -+ if (grub_errno) -+ { -+ grub_free (buf); -+ return 0; -+ } -+ -+ de_blk = (struct grub_f2fs_dentry_block *) buf; -+ -+ ctx.bitmap = de_blk->dentry_bitmap; -+ ctx.dentry = de_blk->dentry; -+ ctx.filename = de_blk->filename; -+ ctx.max = NR_DENTRY_IN_BLOCK; -+ -+ ret = grub_f2fs_check_dentries (&ctx); -+ grub_free (buf); -+ if (ret) -+ return 1; -+ -+ fpos += F2FS_BLKSIZE; -+ } -+ -+ return 0; -+} -+ -+static int -+grub_f2fs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype, -+ grub_fshelp_node_t node, void *data) -+{ -+ struct grub_f2fs_dir_ctx *ctx = data; -+ struct grub_dirhook_info info; -+ -+ grub_memset (&info, 0, sizeof (info)); -+ if (!node->inode_read) -+ { -+ grub_f2fs_read_node (ctx->data, node->ino, &node->inode); -+ if (!grub_errno) -+ node->inode_read = 1; -+ grub_errno = GRUB_ERR_NONE; -+ } -+ if (node->inode_read) -+ { -+ info.mtimeset = 1; -+ info.mtime = grub_le_to_cpu64 (node->inode.i.i_mtime); -+ } -+ -+ info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR); -+ grub_free (node); -+ -+ return ctx->hook (filename, &info, ctx->hook_data); -+} -+ -+static grub_err_t -+grub_f2fs_dir (grub_device_t device, const char *path, -+ grub_fs_dir_hook_t hook, void *hook_data) -+{ -+ struct grub_f2fs_dir_ctx ctx = { -+ .hook = hook, -+ .hook_data = hook_data -+ }; -+ struct grub_fshelp_node *fdiro = 0; -+ -+ grub_dl_ref (my_mod); -+ -+ ctx.data = grub_f2fs_mount (device->disk); -+ if (!ctx.data) -+ goto fail; -+ -+ grub_fshelp_find_file (path, &ctx.data->diropen, &fdiro, -+ grub_f2fs_iterate_dir, grub_f2fs_read_symlink, -+ GRUB_FSHELP_DIR); -+ if (grub_errno) -+ goto fail; -+ -+ grub_f2fs_iterate_dir (fdiro, grub_f2fs_dir_iter, &ctx); -+ -+ fail: -+ if (fdiro != &ctx.data->diropen) -+ grub_free (fdiro); -+ grub_free (ctx.data); -+ grub_dl_unref (my_mod); -+ -+ return grub_errno; -+} -+ -+/* Open a file named NAME and initialize FILE. */ -+static grub_err_t -+grub_f2fs_open (struct grub_file *file, const char *name) -+{ -+ struct grub_f2fs_data *data = NULL; -+ struct grub_fshelp_node *fdiro = 0; -+ struct grub_f2fs_inode *inode; -+ -+ grub_dl_ref (my_mod); -+ -+ data = grub_f2fs_mount (file->device->disk); -+ if (!data) -+ goto fail; -+ -+ grub_fshelp_find_file (name, &data->diropen, &fdiro, -+ grub_f2fs_iterate_dir, grub_f2fs_read_symlink, -+ GRUB_FSHELP_REG); -+ if (grub_errno) -+ goto fail; -+ -+ if (!fdiro->inode_read) -+ { -+ grub_f2fs_read_node (data, fdiro->ino, &fdiro->inode); -+ if (grub_errno) -+ goto fail; -+ } -+ -+ grub_memcpy (data->inode, &fdiro->inode, sizeof (*data->inode)); -+ grub_free (fdiro); -+ -+ inode = &(data->inode->i); -+ file->size = grub_f2fs_file_size (inode); -+ file->data = data; -+ file->offset = 0; -+ -+ if (inode->i_inline & F2FS_INLINE_DATA && file->size > MAX_INLINE_DATA) -+ grub_error (GRUB_ERR_BAD_FS, "corrupted inline_data: need fsck"); -+ -+ return 0; -+ -+ fail: -+ if (fdiro != &data->diropen) -+ grub_free (fdiro); -+ grub_free (data); -+ -+ grub_dl_unref (my_mod); -+ -+ return grub_errno; -+} -+ -+static grub_ssize_t -+grub_f2fs_read (grub_file_t file, char *buf, grub_size_t len) -+{ -+ struct grub_f2fs_data *data = (struct grub_f2fs_data *) file->data; -+ -+ return grub_f2fs_read_file (&data->diropen, -+ file->read_hook, file->read_hook_data, -+ file->offset, len, buf); -+} -+ -+static grub_err_t -+grub_f2fs_close (grub_file_t file) -+{ -+ struct grub_f2fs_data *data = (struct grub_f2fs_data *) file->data; -+ -+ grub_free (data); -+ -+ grub_dl_unref (my_mod); -+ -+ return GRUB_ERR_NONE; -+} -+ -+static grub_uint8_t * -+grub_f2fs_utf16_to_utf8 (grub_uint16_t *in_buf_le) -+{ -+ grub_uint16_t in_buf[MAX_VOLUME_NAME]; -+ grub_uint8_t *out_buf; -+ int len = 0; -+ -+ out_buf = grub_malloc (MAX_VOLUME_NAME * GRUB_MAX_UTF8_PER_UTF16 + 1); -+ if (!out_buf) -+ return NULL; -+ -+ while (*in_buf_le != 0 && len < MAX_VOLUME_NAME) { -+ in_buf[len] = grub_le_to_cpu16 (in_buf_le[len]); -+ len++; -+ } -+ -+ *grub_utf16_to_utf8 (out_buf, in_buf, len) = '\0'; -+ -+ return out_buf; -+} -+ -+static grub_err_t -+grub_f2fs_label (grub_device_t device, char **label) -+{ -+ struct grub_f2fs_data *data; -+ grub_disk_t disk = device->disk; -+ -+ grub_dl_ref (my_mod); -+ -+ data = grub_f2fs_mount (disk); -+ if (data) -+ *label = (char *) grub_f2fs_utf16_to_utf8 (data->sblock.volume_name); -+ else -+ *label = NULL; -+ -+ grub_free (data); -+ grub_dl_unref (my_mod); -+ -+ return grub_errno; -+} -+ -+static grub_err_t -+grub_f2fs_uuid (grub_device_t device, char **uuid) -+{ -+ struct grub_f2fs_data *data; -+ grub_disk_t disk = device->disk; -+ -+ grub_dl_ref (my_mod); -+ -+ data = grub_f2fs_mount (disk); -+ if (data) -+ { -+ *uuid = -+ grub_xasprintf -+ ("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", -+ data->sblock.uuid[0], data->sblock.uuid[1], -+ data->sblock.uuid[2], data->sblock.uuid[3], -+ data->sblock.uuid[4], data->sblock.uuid[5], -+ data->sblock.uuid[6], data->sblock.uuid[7], -+ data->sblock.uuid[8], data->sblock.uuid[9], -+ data->sblock.uuid[10], data->sblock.uuid[11], -+ data->sblock.uuid[12], data->sblock.uuid[13], -+ data->sblock.uuid[14], data->sblock.uuid[15]); -+ } -+ else -+ *uuid = NULL; -+ -+ grub_free (data); -+ grub_dl_unref (my_mod); -+ -+ return grub_errno; -+} -+ -+static struct grub_fs grub_f2fs_fs = { -+ .name = "f2fs", -+ .dir = grub_f2fs_dir, -+ .open = grub_f2fs_open, -+ .read = grub_f2fs_read, -+ .close = grub_f2fs_close, -+ .label = grub_f2fs_label, -+ .uuid = grub_f2fs_uuid, -+#ifdef GRUB_UTIL -+ .reserved_first_sector = 1, -+ .blocklist_install = 0, -+#endif -+ .next = 0 -+}; -+ -+GRUB_MOD_INIT (f2fs) -+{ -+ grub_fs_register (&grub_f2fs_fs); -+ my_mod = mod; -+} -+ -+GRUB_MOD_FINI (f2fs) -+{ -+ grub_fs_unregister (&grub_f2fs_fs); -+} -diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c -index 839bff88963baba7730d788869e1f50481a66a30..00a16098b47aff52a352fa9433e279beae261329 100644 ---- a/grub-core/fs/udf.c -+++ b/grub-core/fs/udf.c -@@ -321,6 +321,32 @@ struct grub_udf_partmap - }; - } GRUB_PACKED; - -+struct grub_udf_pvd -+{ -+ struct grub_udf_tag tag; -+ grub_uint32_t seq_num; -+ grub_uint32_t pvd_num; -+ grub_uint8_t ident[32]; -+ grub_uint16_t vol_seq_num; -+ grub_uint16_t max_vol_seq_num; -+ grub_uint16_t interchange_level; -+ grub_uint16_t max_interchange_level; -+ grub_uint32_t charset_list; -+ grub_uint32_t max_charset_list; -+ grub_uint8_t volset_ident[128]; -+ struct grub_udf_charspec desc_charset; -+ struct grub_udf_charspec expl_charset; -+ struct grub_udf_extent_ad vol_abstract; -+ struct grub_udf_extent_ad vol_copyright; -+ struct grub_udf_regid app_ident; -+ struct grub_udf_timestamp recording_time; -+ struct grub_udf_regid imp_ident; -+ grub_uint8_t imp_use[64]; -+ grub_uint32_t pred_vds_loc; -+ grub_uint16_t flags; -+ grub_uint8_t reserved[22]; -+} GRUB_PACKED; -+ - struct grub_udf_lvd - { - struct grub_udf_tag tag; -@@ -348,6 +374,7 @@ struct grub_udf_aed - struct grub_udf_data - { - grub_disk_t disk; -+ struct grub_udf_pvd pvd; - struct grub_udf_lvd lvd; - struct grub_udf_pd pds[GRUB_UDF_MAX_PDS]; - struct grub_udf_partmap *pms[GRUB_UDF_MAX_PMS]; -@@ -692,7 +719,17 @@ grub_udf_mount (grub_disk_t disk) - } - - tag.tag_ident = U16 (tag.tag_ident); -- if (tag.tag_ident == GRUB_UDF_TAG_IDENT_PD) -+ if (tag.tag_ident == GRUB_UDF_TAG_IDENT_PVD) -+ { -+ if (grub_disk_read (disk, block << lbshift, 0, -+ sizeof (struct grub_udf_pvd), -+ &data->pvd)) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem"); -+ goto fail; -+ } -+ } -+ else if (tag.tag_ident == GRUB_UDF_TAG_IDENT_PD) - { - if (data->npd >= GRUB_UDF_MAX_PDS) - { -@@ -860,6 +897,25 @@ read_string (const grub_uint8_t *raw, grub_size_t sz, char *outbuf) - return outbuf; - } - -+static char * -+read_dstring (const grub_uint8_t *raw, grub_size_t sz) -+{ -+ grub_size_t len; -+ -+ if (raw[0] == 0) { -+ char *outbuf = grub_malloc (1); -+ if (!outbuf) -+ return NULL; -+ outbuf[0] = 0; -+ return outbuf; -+ } -+ -+ len = raw[sz - 1]; -+ if (len > sz - 1) -+ len = sz - 1; -+ return read_string (raw, len, NULL); -+} -+ - static int - grub_udf_iterate_dir (grub_fshelp_node_t dir, - grub_fshelp_iterate_dir_hook_t hook, void *hook_data) -@@ -1197,7 +1253,7 @@ grub_udf_label (grub_device_t device, char **label) - - if (data) - { -- *label = read_string (data->lvd.ident, sizeof (data->lvd.ident), 0); -+ *label = read_dstring (data->lvd.ident, sizeof (data->lvd.ident)); - grub_free (data); - } - else -@@ -1206,6 +1262,87 @@ grub_udf_label (grub_device_t device, char **label) - return grub_errno; - } - -+static char * -+gen_uuid_from_volset (char *volset_ident) -+{ -+ grub_size_t i; -+ grub_size_t len; -+ grub_size_t nonhexpos; -+ grub_uint8_t buf[17]; -+ char *uuid; -+ -+ len = grub_strlen (volset_ident); -+ if (len < 8) -+ return NULL; -+ -+ uuid = grub_malloc (17); -+ if (!uuid) -+ return NULL; -+ -+ if (len > 16) -+ len = 16; -+ -+ grub_memset (buf, 0, sizeof (buf)); -+ grub_memcpy (buf, volset_ident, len); -+ -+ nonhexpos = 16; -+ for (i = 0; i < 16; ++i) -+ { -+ if (!grub_isxdigit (buf[i])) -+ { -+ nonhexpos = i; -+ break; -+ } -+ } -+ -+ if (nonhexpos < 8) -+ { -+ grub_snprintf (uuid, 17, "%02x%02x%02x%02x%02x%02x%02x%02x", -+ buf[0], buf[1], buf[2], buf[3], -+ buf[4], buf[5], buf[6], buf[7]); -+ } -+ else if (nonhexpos < 16) -+ { -+ for (i = 0; i < 8; ++i) -+ uuid[i] = grub_tolower (buf[i]); -+ grub_snprintf (uuid+8, 9, "%02x%02x%02x%02x", -+ buf[8], buf[9], buf[10], buf[11]); -+ } -+ else -+ { -+ for (i = 0; i < 16; ++i) -+ uuid[i] = grub_tolower (buf[i]); -+ uuid[16] = 0; -+ } -+ -+ return uuid; -+} -+ -+static grub_err_t -+grub_udf_uuid (grub_device_t device, char **uuid) -+{ -+ char *volset_ident; -+ struct grub_udf_data *data; -+ data = grub_udf_mount (device->disk); -+ -+ if (data) -+ { -+ volset_ident = read_dstring (data->pvd.volset_ident, sizeof (data->pvd.volset_ident)); -+ if (volset_ident) -+ { -+ *uuid = gen_uuid_from_volset (volset_ident); -+ grub_free (volset_ident); -+ } -+ else -+ *uuid = 0; -+ grub_free (data); -+ } -+ else -+ *uuid = 0; -+ -+ return grub_errno; -+} -+ - static struct grub_fs grub_udf_fs = { - .name = "udf", - .dir = grub_udf_dir, -@@ -1213,6 +1350,7 @@ static struct grub_fs grub_udf_fs = { - .read = grub_udf_read, - .close = grub_udf_close, - .label = grub_udf_label, -+ .uuid = grub_udf_uuid, - #ifdef GRUB_UTIL - .reserved_first_sector = 1, - .blocklist_install = 1, -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 9f66dd6e4c6491e6b2cbfc7866335b432c824502..3b00c744e23c34243df781baa96e5b1b0d88417d 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -79,9 +79,18 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ - #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ - --/* We do not currently verify metadata UUID so it is safe to read such filesystem */ -+/* -+ * Directory entries with ftype are explicitly handled by GRUB code. -+ * -+ * We do not currently read the inode btrees, so it is safe to read filesystems -+ * with the XFS_SB_FEAT_INCOMPAT_SPINODES feature. -+ * -+ * We do not currently verify metadata UUID, so it is safe to read filesystems -+ * with the XFS_SB_FEAT_INCOMPAT_META_UUID feature. -+ */ - #define XFS_SB_FEAT_INCOMPAT_SUPPORTED \ - (XFS_SB_FEAT_INCOMPAT_FTYPE | \ -+ XFS_SB_FEAT_INCOMPAT_SPINODES | \ - XFS_SB_FEAT_INCOMPAT_META_UUID) - - struct grub_xfs_sblock -@@ -828,6 +837,9 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - entries = (grub_be_to_cpu32 (tail->leaf_count) - - grub_be_to_cpu32 (tail->leaf_stale)); - -+ if (!entries) -+ continue; -+ - /* Iterate over all entries within this block. */ - while ((char *)direntry < (char *)tail) - { -diff --git a/grub-core/fs/zfs/zfs_lz4.c b/grub-core/fs/zfs/zfs_lz4.c -index 2f73449f0d4c63cadc7b5b4388250a4d474594b6..5453822d0258527ba751e551cbb54753f0331043 100644 ---- a/grub-core/fs/zfs/zfs_lz4.c -+++ b/grub-core/fs/zfs/zfs_lz4.c -@@ -73,7 +73,6 @@ static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, - #define U32 grub_uint32_t - #define S32 grub_int32_t - #define U64 grub_uint64_t --typedef grub_size_t size_t; - - typedef struct _U16_S { - U16 v; -@@ -133,10 +132,10 @@ typedef struct _U64_S { - - /* Decompression functions */ - grub_err_t --lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len); -+lz4_decompress(void *s_start, void *d_start, grub_size_t s_len, grub_size_t d_len); - - grub_err_t --lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len) -+lz4_decompress(void *s_start, void *d_start, grub_size_t s_len, grub_size_t d_len) - { - const BYTE *src = s_start; - U32 bufsiz = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | -@@ -167,7 +166,7 @@ LZ4_uncompress_unknownOutputSize(const char *source, - BYTE *const oend = op + maxOutputSize; - BYTE *cpy; - -- size_t dec[] = { 0, 3, 2, 3, 0, 0, 0, 0 }; -+ grub_size_t dec[] = { 0, 3, 2, 3, 0, 0, 0, 0 }; - - /* Main Loop */ - while (ip < iend) { -@@ -237,8 +236,8 @@ LZ4_uncompress_unknownOutputSize(const char *source, - /* copy repeated sequence */ - if unlikely(op - ref < STEPSIZE) { - #if LZ4_ARCH64 -- size_t dec2table[] = { 0, 0, 0, -1, 0, 1, 2, 3 }; -- size_t dec2 = dec2table[op - ref]; -+ grub_size_t dec2table[] = { 0, 0, 0, -1, 0, 1, 2, 3 }; -+ grub_size_t dec2 = dec2table[op - ref]; - #else - const int dec2 = 0; - #endif -diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c -index 22438277d7456358dfc6bcbb51317fd704987738..dbed64744317c2f849fb2bda8fd5a6b142affe91 100644 ---- a/grub-core/io/bufio.c -+++ b/grub-core/io/bufio.c -@@ -61,6 +61,13 @@ grub_bufio_open (grub_file_t io, int size) - size = ((io->size > GRUB_BUFIO_MAX_SIZE) ? GRUB_BUFIO_MAX_SIZE : - io->size); - -+ /* -+ * Round up size to power of 2 which the binary math to -+ * calculate next_buf in grub_bufio_read() requires. -+ */ -+ while (size & (size - 1)) -+ size = (size | (size - 1)) + 1; -+ - bufio = grub_zalloc (sizeof (struct grub_bufio) + size); - if (! bufio) - { -diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c -index 0f2ea6bd845227265eef205c212e7c52ee03ebcf..86ea8cfdea2e0abd1f73c6df4dca58806c8f2d9b 100644 ---- a/grub-core/io/gzio.c -+++ b/grub-core/io/gzio.c -@@ -43,6 +43,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -94,6 +95,14 @@ struct grub_gzio - struct huft *tl; - /* The distance code table. */ - struct huft *td; -+ /* The checksum algorithm */ -+ const gcry_md_spec_t *hdesc; -+ /* The wanted checksum */ -+ grub_uint32_t orig_checksum; -+ /* The uncompressed length */ -+ grub_size_t orig_len; -+ /* Context for checksum calculation */ -+ grub_uint8_t *hcontext; - /* The lookup bits for the literal/length code table. */ - int bl; - /* The lookup bits for the distance code table. */ -@@ -140,24 +149,24 @@ eat_field (grub_file_t file, int len) - #define OLD_GZIP_MAGIC grub_le_to_cpu16 (0x9E1F) - - /* Compression methods (see algorithm.doc) */ --#define STORED 0 --#define COMPRESSED 1 --#define PACKED 2 --#define LZHED 3 -+#define GRUB_GZ_STORED 0 -+#define GRUB_GZ_COMPRESSED 1 -+#define GRUB_GZ_PACKED 2 -+#define GRUB_GZ_LZHED 3 - /* methods 4 to 7 reserved */ --#define DEFLATED 8 --#define MAX_METHODS 9 -+#define GRUB_GZ_DEFLATED 8 -+#define GRUB_GZ_MAX_METHODS 9 - - /* gzip flag byte */ --#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ --#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ --#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ --#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ --#define COMMENT 0x10 /* bit 4 set: file comment present */ --#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ --#define RESERVED 0xC0 /* bit 6,7: reserved */ -+#define GRUB_GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -+#define GRUB_GZ_CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ -+#define GRUB_GZ_EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -+#define GRUB_GZ_ORIG_NAME 0x08 /* bit 3 set: original file name present */ -+#define GRUB_GZ_COMMENT 0x10 /* bit 4 set: file comment present */ -+#define GRUB_GZ_ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ -+#define GRUB_GZ_RESERVED 0xC0 /* bit 6,7: reserved */ - --#define UNSUPPORTED_FLAGS (CONTINUATION | ENCRYPTED | RESERVED) -+#define GRUB_GZ_UNSUPPORTED_FLAGS (GRUB_GZ_CONTINUATION | GRUB_GZ_ENCRYPTED | GRUB_GZ_RESERVED) - - /* inflate block codes */ - #define INFLATE_STORED 0 -@@ -180,7 +189,7 @@ test_gzip_header (grub_file_t file) - grub_uint8_t os_type; - } hdr; - grub_uint16_t extra_len; -- grub_uint32_t orig_len; -+ grub_uint32_t crc32; - grub_gzio_t gzio = file->data; - - if (grub_file_tell (gzio->file) != 0) -@@ -201,26 +210,29 @@ test_gzip_header (grub_file_t file) - * problem occurs from here on, then we have corrupt or otherwise - * bad data, and the error should be reported to the user. - */ -- if (hdr.method != DEFLATED -- || (hdr.flags & UNSUPPORTED_FLAGS) -- || ((hdr.flags & EXTRA_FIELD) -+ if (hdr.method != GRUB_GZ_DEFLATED -+ || (hdr.flags & GRUB_GZ_UNSUPPORTED_FLAGS) -+ || ((hdr.flags & GRUB_GZ_EXTRA_FIELD) - && (grub_file_read (gzio->file, &extra_len, 2) != 2 - || eat_field (gzio->file, - grub_le_to_cpu16 (extra_len)))) -- || ((hdr.flags & ORIG_NAME) && eat_field (gzio->file, -1)) -- || ((hdr.flags & COMMENT) && eat_field (gzio->file, -1))) -+ || ((hdr.flags & GRUB_GZ_ORIG_NAME) && eat_field (gzio->file, -1)) -+ || ((hdr.flags & GRUB_GZ_COMMENT) && eat_field (gzio->file, -1))) - return 0; - - gzio->data_offset = grub_file_tell (gzio->file); - - /* FIXME: don't do this on not easily seekable files. */ - { -- grub_file_seek (gzio->file, grub_file_size (gzio->file) - 4); -- if (grub_file_read (gzio->file, &orig_len, 4) != 4) -+ grub_file_seek (gzio->file, grub_file_size (gzio->file) - 8); -+ if (grub_file_read (gzio->file, &crc32, 4) != 4) -+ return 0; -+ gzio->orig_checksum = grub_le_to_cpu32 (crc32); -+ if (grub_file_read (gzio->file, &gzio->orig_len, 4) != 4) - return 0; - /* FIXME: this does not handle files whose original size is over 4GB. - But how can we know the real original size? */ -- file->size = grub_le_to_cpu32 (orig_len); -+ file->size = grub_le_to_cpu32 (gzio->orig_len); - } - - initialize_tables (gzio); -@@ -1095,7 +1107,23 @@ inflate_window (grub_gzio_t gzio) - - gzio->saved_offset += gzio->wp; - -- /* XXX do CRC calculation here! */ -+ if (gzio->hcontext) -+ { -+ gzio->hdesc->write (gzio->hcontext, gzio->slide, gzio->wp); -+ -+ if (gzio->saved_offset == gzio->orig_len) -+ { -+ grub_uint32_t csum; -+ -+ gzio->hdesc->final (gzio->hcontext); -+ csum = grub_get_unaligned32 (gzio->hdesc->read (gzio->hcontext)); -+ csum = grub_be_to_cpu32 (csum); -+ if (csum != gzio->orig_checksum) -+ grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, -+ "checksum mismatch %08x/%08x", -+ gzio->orig_checksum, csum); -+ } -+ } - } - - -@@ -1118,6 +1146,9 @@ initialize_tables (grub_gzio_t gzio) - huft_free (gzio->td); - gzio->tl = NULL; - gzio->td = NULL; -+ -+ if (gzio->hcontext) -+ gzio->hdesc->init(gzio->hcontext); - } - - -@@ -1143,6 +1174,9 @@ grub_gzio_open (grub_file_t io, const char *name __attribute__ ((unused))) - - gzio->file = io; - -+ gzio->hdesc = GRUB_MD_CRC32; -+ gzio->hcontext = grub_malloc(gzio->hdesc->contextsize); -+ - file->device = io->device; - file->data = gzio; - file->fs = &grub_gzio_fs; -@@ -1151,6 +1185,7 @@ grub_gzio_open (grub_file_t io, const char *name __attribute__ ((unused))) - if (! test_gzip_header (file)) - { - grub_errno = GRUB_ERR_NONE; -+ grub_free (gzio->hcontext); - grub_free (gzio); - grub_free (file); - grub_file_seek (io, 0); -@@ -1183,7 +1218,7 @@ test_zlib_header (grub_gzio_t gzio) - flg = get_byte (gzio); - - /* Check that compression method is DEFLATE. */ -- if ((cmf & 0xf) != DEFLATED) -+ if ((cmf & 0xf) != GRUB_GZ_DEFLATED) - { - /* TRANSLATORS: It's about given file having some strange format, not - complete lack of gzip support. */ -@@ -1287,6 +1322,7 @@ grub_gzio_close (grub_file_t file) - grub_file_close (gzio->file); - huft_free (gzio->tl); - huft_free (gzio->td); -+ grub_free (gzio->hcontext); - grub_free (gzio); - - /* No need to close the same device twice. */ -diff --git a/grub-core/kern/arm/cache.c b/grub-core/kern/arm/cache.c -index 34154ccdb0e09d7d9fd91c4164fe8577ce449260..af1c4bbf544f0ebcca5c0f58c847c8dddc1f2e91 100644 ---- a/grub-core/kern/arm/cache.c -+++ b/grub-core/kern/arm/cache.c -@@ -29,6 +29,8 @@ void grub_arm_clean_dcache_range_armv6 (grub_addr_t start, grub_addr_t end, - grub_addr_t dlinesz); - void grub_arm_clean_dcache_range_armv7 (grub_addr_t start, grub_addr_t end, - grub_addr_t dlinesz); -+void grub_arm_clean_dcache_range_poc_armv7 (grub_addr_t start, grub_addr_t end, -+ grub_addr_t dlinesz); - void grub_arm_invalidate_icache_range_armv6 (grub_addr_t start, grub_addr_t end, - grub_addr_t dlinesz); - void grub_arm_invalidate_icache_range_armv7 (grub_addr_t start, grub_addr_t end, -@@ -252,6 +254,38 @@ grub_arch_sync_caches (void *address, grub_size_t len) - } - } - -+void -+grub_arch_sync_dma_caches (volatile void *address, grub_size_t len) -+{ -+ grub_addr_t start = (grub_addr_t) address; -+ grub_addr_t end = start + len; -+ -+ if (type == ARCH_UNKNOWN) -+ probe_caches (); -+ start = ALIGN_DOWN (start, grub_arch_cache_max_linesz); -+ end = ALIGN_UP (end, grub_arch_cache_max_linesz); -+ switch (type) -+ { -+ case ARCH_ARMV6: -+ grub_arm_clean_dcache_range_armv6 (start, end, grub_arch_cache_dlinesz); -+ grub_arm_invalidate_icache_range_armv6 (start, end, -+ grub_arch_cache_ilinesz); -+ break; -+ case ARCH_ARMV5_WRITE_THROUGH: -+ case ARCH_ARMV6_UNIFIED: -+ grub_arm_clean_dcache_range_armv6 (start, end, grub_arch_cache_dlinesz); -+ break; -+ case ARCH_ARMV7: -+ grub_arm_clean_dcache_range_poc_armv7 (start, end, grub_arch_cache_dlinesz); -+ grub_arm_invalidate_icache_range_armv7 (start, end, -+ grub_arch_cache_ilinesz); -+ break; -+ /* Pacify GCC. */ -+ case ARCH_UNKNOWN: -+ break; -+ } -+} -+ - void - grub_arm_disable_caches_mmu (void) - { -diff --git a/grub-core/kern/arm/coreboot/cbtable.c b/grub-core/kern/arm/coreboot/cbtable.c -new file mode 100644 -index 0000000000000000000000000000000000000000..8a655bb5cc28fb013674dc792531d8a9ba1c4b85 ---- /dev/null -+++ b/grub-core/kern/arm/coreboot/cbtable.c -@@ -0,0 +1,40 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2007,2008,2013 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+#pragma GCC diagnostic ignored "-Wcast-align" -+ -+grub_linuxbios_table_header_t -+grub_linuxbios_get_tables (void) -+{ -+ grub_linuxbios_table_header_t table_header -+ = (grub_linuxbios_table_header_t) grub_arm_saved_registers.r[0]; -+ -+ if (!grub_linuxbios_check_signature (table_header)) -+ return 0; -+ -+ return table_header; -+} -diff --git a/grub-core/kern/arm/coreboot/dma.c b/grub-core/kern/arm/coreboot/dma.c -new file mode 100644 -index 0000000000000000000000000000000000000000..2c2a6278904631c91bd29b3c4338c606471672fe ---- /dev/null -+++ b/grub-core/kern/arm/coreboot/dma.c -@@ -0,0 +1,59 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2007,2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct grub_pci_dma_chunk * -+grub_memalign_dma32 (grub_size_t align, grub_size_t size) -+{ -+ void *ret; -+ if (align < 64) -+ align = 64; -+ size = ALIGN_UP (size, align); -+ ret = grub_memalign (align, size); -+ if (!ret) -+ return 0; -+ grub_arch_sync_dma_caches (ret, size); -+ return ret; -+} -+ -+void -+grub_dma_free (struct grub_pci_dma_chunk *ch) -+{ -+ grub_size_t size = (((struct grub_mm_header *) ch) - 1)->size * GRUB_MM_ALIGN; -+ grub_arch_sync_dma_caches (ch, size); -+ grub_free (ch); -+} -+ -+volatile void * -+grub_dma_get_virt (struct grub_pci_dma_chunk *ch) -+{ -+ return (void *) ch; -+} -+ -+grub_uint32_t -+grub_dma_get_phys (struct grub_pci_dma_chunk *ch) -+{ -+ return (grub_uint32_t) (grub_addr_t) ch; -+} -+ -diff --git a/grub-core/kern/arm/coreboot/init.c b/grub-core/kern/arm/coreboot/init.c -new file mode 100644 -index 0000000000000000000000000000000000000000..8d8c5b8291eff9743b0325b76f851d52509b1f4f ---- /dev/null -+++ b/grub-core/kern/arm/coreboot/init.c -@@ -0,0 +1,151 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2013 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+extern grub_uint8_t _start[]; -+extern grub_uint8_t _end[]; -+extern grub_uint8_t _edata[]; -+grub_addr_t start_of_ram = ~(grub_addr_t)0; -+ -+void __attribute__ ((noreturn)) -+grub_exit (void) -+{ -+ /* We can't use grub_fatal() in this function. This would create an infinite -+ loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ -+ while (1) -+ grub_cpu_idle (); -+} -+ -+static grub_uint64_t modend; -+static int have_memory = 0; -+ -+/* Helper for grub_machine_init. */ -+static int -+heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, -+ void *data __attribute__ ((unused))) -+{ -+ grub_uint64_t begin = addr, end = addr + size; -+ -+#if GRUB_CPU_SIZEOF_VOID_P == 4 -+ /* Restrict ourselves to 32-bit memory space. */ -+ if (begin > GRUB_ULONG_MAX) -+ return 0; -+ if (end > GRUB_ULONG_MAX) -+ end = GRUB_ULONG_MAX; -+#endif -+ -+ if (start_of_ram > begin) -+ start_of_ram = begin; -+ -+ if (type != GRUB_MEMORY_AVAILABLE) -+ return 0; -+ -+ if (modend && begin < modend) -+ { -+ if (begin < (grub_addr_t)_start) -+ { -+ grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) ((grub_addr_t)_start - begin)); -+ have_memory = 1; -+ } -+ begin = modend; -+ } -+ -+ /* Avoid DMA problems. */ -+ if (end >= 0xfe000000) -+ end = 0xfe000000; -+ -+ if (end <= begin) -+ return 0; -+ -+ grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) (end - begin)); -+ -+ have_memory = 1; -+ -+ return 0; -+} -+ -+void -+grub_machine_init (void) -+{ -+ struct grub_module_header *header; -+ void *dtb = 0; -+ grub_size_t dtb_size = 0; -+ -+ modend = grub_modules_get_end (); -+ -+ grub_video_coreboot_fb_early_init (); -+ -+ grub_machine_mmap_iterate (heap_init, NULL); -+ if (!have_memory) -+ grub_fatal ("No memory found"); -+ -+ grub_video_coreboot_fb_late_init (); -+ -+ grub_font_init (); -+ grub_gfxterm_init (); -+ -+ FOR_MODULES (header) -+ if (header->type == OBJ_TYPE_DTB) -+ { -+ char *dtb_orig_addr, *dtb_copy; -+ dtb_orig_addr = (char *) header + sizeof (struct grub_module_header); -+ -+ dtb_size = header->size - sizeof (struct grub_module_header); -+ dtb = dtb_copy = grub_malloc (dtb_size); -+ grub_memmove (dtb_copy, dtb_orig_addr, dtb_size); -+ break; -+ } -+ if (!dtb) -+ grub_fatal ("No DTB found"); -+ grub_fdtbus_init (dtb, dtb_size); -+ -+ grub_rk3288_spi_init (); -+ -+ grub_machine_timer_init (); -+ grub_cros_init (); -+ grub_pl050_init (); -+} -+ -+void -+grub_machine_get_bootlocation (char **device __attribute__ ((unused)), -+ char **path __attribute__ ((unused))) -+{ -+} -+ -+void -+grub_machine_fini (int flags __attribute__ ((unused))) -+{ -+} -diff --git a/grub-core/kern/arm/coreboot/timer.c b/grub-core/kern/arm/coreboot/timer.c -new file mode 100644 -index 0000000000000000000000000000000000000000..d97b844f8487c064922a552a5ea4d5f220031dba ---- /dev/null -+++ b/grub-core/kern/arm/coreboot/timer.c -@@ -0,0 +1,101 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+grub_uint64_t -+grub_armv7_get_timer_value(void); -+ -+grub_uint32_t -+grub_armv7_get_timer_frequency(void); -+ -+grub_uint32_t -+grub_arm_pfr1(void); -+ -+static int have_timer = 0; -+static volatile grub_uint32_t *sp804_regs; -+ -+static grub_uint64_t -+sp804_get_time_ms (void) -+{ -+ static grub_uint32_t high, last_low; -+ grub_uint32_t low = ~sp804_regs[1]; -+ if (last_low > low) -+ high++; -+ last_low = low; -+ return grub_divmod64 ((((grub_uint64_t) high) << 32) | low, -+ 1000, 0); -+} -+ -+static grub_err_t -+sp804_attach(const struct grub_fdtbus_dev *dev) -+{ -+ if (have_timer) -+ return GRUB_ERR_NONE; -+ sp804_regs = grub_fdtbus_map_reg (dev, 0, 0); -+ if (!grub_fdtbus_is_mapping_valid (sp804_regs)) -+ return grub_error (GRUB_ERR_IO, "could not map sp804: %p", sp804_regs); -+ grub_install_get_time_ms (sp804_get_time_ms); -+ have_timer = 1; -+ return GRUB_ERR_NONE; -+} -+ -+struct grub_fdtbus_driver sp804 = -+{ -+ .compatible = "arm,sp804", -+ .attach = sp804_attach -+}; -+ -+static grub_uint32_t timer_frequency_in_khz; -+ -+static grub_uint64_t -+generic_get_time_ms (void) -+{ -+ return grub_divmod64 (grub_armv7_get_timer_value(), timer_frequency_in_khz, 0); -+} -+ -+static int -+try_generic_timer (void) -+{ -+ if (((grub_arm_pfr1 () >> 16) & 0xf) != 1) -+ return 0; -+ grub_printf ("freq = %x\n", grub_armv7_get_timer_frequency()); -+ timer_frequency_in_khz = 0x016e3600 / 1000; //grub_armv7_get_timer_frequency() / 1000; -+ if (timer_frequency_in_khz == 0) -+ return 0; -+ grub_install_get_time_ms (generic_get_time_ms); -+ have_timer = 1; -+ return 1; -+} -+ -+void -+grub_machine_timer_init (void) -+{ -+ grub_fdtbus_register (&sp804); -+ -+ if (!have_timer) -+ try_generic_timer (); -+ if (!have_timer) -+ grub_fatal ("No timer found"); -+} -diff --git a/grub-core/kern/arm/efi/misc.c b/grub-core/kern/arm/efi/misc.c -deleted file mode 100644 -index 7cd41842ae7662018c2ce5ff847aeb250572ec85..0000000000000000000000000000000000000000 ---- a/grub-core/kern/arm/efi/misc.c -+++ /dev/null -@@ -1,202 +0,0 @@ --/* misc.c - various system functions for an arm-based EFI system */ --/* -- * GRUB -- GRand Unified Bootloader -- * Copyright (C) 2013 Free Software Foundation, Inc. -- * -- * GRUB is free software: you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation, either version 3 of the License, or -- * (at your option) any later version. -- * -- * GRUB is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with GRUB. If not, see . -- */ -- --#include --#include --#include --#include --#include --#include -- --static inline grub_size_t --page_align (grub_size_t size) --{ -- return (size + (1 << 12) - 1) & (~((1 << 12) - 1)); --} -- --/* Find the optimal number of pages for the memory map. Is it better to -- move this code to efi/mm.c? */ --static grub_efi_uintn_t --find_mmap_size (void) --{ -- static grub_efi_uintn_t mmap_size = 0; -- -- if (mmap_size != 0) -- return mmap_size; -- -- mmap_size = (1 << 12); -- while (1) -- { -- int ret; -- grub_efi_memory_descriptor_t *mmap; -- grub_efi_uintn_t desc_size; -- -- mmap = grub_malloc (mmap_size); -- if (! mmap) -- return 0; -- -- ret = grub_efi_get_memory_map (&mmap_size, mmap, 0, &desc_size, 0); -- grub_free (mmap); -- -- if (ret < 0) -- { -- grub_error (GRUB_ERR_IO, "cannot get memory map"); -- return 0; -- } -- else if (ret > 0) -- break; -- -- mmap_size += (1 << 12); -- } -- -- /* Increase the size a bit for safety, because GRUB allocates more on -- later, and EFI itself may allocate more. */ -- mmap_size += (1 << 12); -- -- return page_align (mmap_size); --} -- --#define NEXT_MEMORY_DESCRIPTOR(desc, size) \ -- ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size))) --#define PAGE_SHIFT 12 -- --void * --grub_efi_allocate_loader_memory (grub_uint32_t min_offset, grub_uint32_t size) --{ -- grub_efi_uintn_t desc_size; -- grub_efi_memory_descriptor_t *mmap, *mmap_end; -- grub_efi_uintn_t mmap_size, tmp_mmap_size; -- grub_efi_memory_descriptor_t *desc; -- void *mem = NULL; -- grub_addr_t min_start = 0; -- -- mmap_size = find_mmap_size(); -- if (!mmap_size) -- return NULL; -- -- mmap = grub_malloc(mmap_size); -- if (!mmap) -- return NULL; -- -- tmp_mmap_size = mmap_size; -- if (grub_efi_get_memory_map (&tmp_mmap_size, mmap, 0, &desc_size, 0) <= 0) -- { -- grub_error (GRUB_ERR_IO, "cannot get memory map"); -- goto fail; -- } -- -- mmap_end = NEXT_MEMORY_DESCRIPTOR (mmap, tmp_mmap_size); -- /* Find lowest accessible RAM location */ -- { -- int found = 0; -- for (desc = mmap ; !found && (desc < mmap_end) ; -- desc = NEXT_MEMORY_DESCRIPTOR(desc, desc_size)) -- { -- switch (desc->type) -- { -- case GRUB_EFI_CONVENTIONAL_MEMORY: -- case GRUB_EFI_LOADER_CODE: -- case GRUB_EFI_LOADER_DATA: -- min_start = desc->physical_start + min_offset; -- found = 1; -- break; -- default: -- break; -- } -- } -- } -- -- /* First, find free pages for the real mode code -- and the memory map buffer. */ -- for (desc = mmap ; desc < mmap_end ; -- desc = NEXT_MEMORY_DESCRIPTOR(desc, desc_size)) -- { -- grub_uint64_t start, end; -- -- grub_dprintf("mm", "%s: 0x%08x bytes @ 0x%08x\n", -- __FUNCTION__, -- (grub_uint32_t) (desc->num_pages << PAGE_SHIFT), -- (grub_uint32_t) (desc->physical_start)); -- -- if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY) -- continue; -- -- start = desc->physical_start; -- end = start + (desc->num_pages << PAGE_SHIFT); -- grub_dprintf("mm", "%s: start=0x%016llx, end=0x%016llx\n", -- __FUNCTION__, start, end); -- start = start < min_start ? min_start : start; -- if (start + size > end) -- continue; -- grub_dprintf("mm", "%s: let's allocate some (0x%x) pages @ 0x%08x...\n", -- __FUNCTION__, (size >> PAGE_SHIFT), (grub_addr_t) start); -- mem = grub_efi_allocate_pages (start, (size >> PAGE_SHIFT) + 1); -- grub_dprintf("mm", "%s: retval=0x%08x\n", -- __FUNCTION__, (grub_addr_t) mem); -- if (! mem) -- { -- grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory"); -- goto fail; -- } -- break; -- } -- -- if (! mem) -- { -- grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory"); -- goto fail; -- } -- -- grub_free (mmap); -- return mem; -- -- fail: -- grub_free (mmap); -- return NULL; --} -- --grub_err_t --grub_efi_prepare_platform (void) --{ -- grub_efi_uintn_t mmap_size; -- grub_efi_uintn_t map_key; -- grub_efi_uintn_t desc_size; -- grub_efi_uint32_t desc_version; -- grub_efi_memory_descriptor_t *mmap_buf; -- grub_err_t err; -- -- /* -- * Cloned from IA64 -- * Must be done after grub_machine_fini because map_key is used by -- *exit_boot_services. -- */ -- mmap_size = find_mmap_size (); -- if (! mmap_size) -- return GRUB_ERR_OUT_OF_MEMORY; -- mmap_buf = grub_efi_allocate_pages (0, page_align (mmap_size) >> 12); -- if (! mmap_buf) -- return GRUB_ERR_OUT_OF_MEMORY; -- -- err = grub_efi_finish_boot_services (&mmap_size, mmap_buf, &map_key, -- &desc_size, &desc_version); -- if (err != GRUB_ERR_NONE) -- return err; -- -- return GRUB_ERR_NONE; --} -diff --git a/grub-core/kern/arm/uboot/init.c b/grub-core/kern/arm/uboot/init.c -new file mode 100644 -index 0000000000000000000000000000000000000000..2a6aa3fdd3dd049848015f6c67dfc0f30a79a9c4 ---- /dev/null -+++ b/grub-core/kern/arm/uboot/init.c -@@ -0,0 +1,70 @@ -+/* init.c - generic U-Boot initialization and finalization */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+ -+extern int (*grub_uboot_syscall_ptr) (int, int *, ...); -+ -+grub_uint32_t -+grub_uboot_get_machine_type (void) -+{ -+ return grub_arm_saved_registers.r[1]; -+} -+ -+grub_addr_t -+grub_uboot_get_boot_data (void) -+{ -+ return grub_arm_saved_registers.r[2]; -+} -+ -+int -+grub_uboot_api_init (void) -+{ -+ struct api_signature *start, *end; -+ struct api_signature *p; -+ grub_addr_t grub_uboot_search_hint = grub_arm_saved_registers.sp; -+ if (grub_uboot_search_hint) -+ { -+ /* Extended search range to work around Trim Slice U-Boot issue */ -+ start = (struct api_signature *) ((grub_uboot_search_hint & ~0x000fffff) -+ - 0x00500000); -+ end = -+ (struct api_signature *) ((grub_addr_t) start + UBOOT_API_SEARCH_LEN - -+ API_SIG_MAGLEN + 0x00500000); -+ } -+ else -+ { -+ start = 0; -+ end = (struct api_signature *) (256 * 1024 * 1024); -+ } -+ -+ /* Structure alignment is (at least) 8 bytes */ -+ for (p = start; p < end; p = (void *) ((grub_addr_t) p + 8)) -+ { -+ if (grub_memcmp (&(p->magic), API_SIG_MAGIC, API_SIG_MAGLEN) == 0) -+ { -+ grub_uboot_syscall_ptr = p->syscall; -+ return p->version; -+ } -+ } -+ -+ return 0; -+} -diff --git a/grub-core/kern/coreboot/cbtable.c b/grub-core/kern/coreboot/cbtable.c -new file mode 100644 -index 0000000000000000000000000000000000000000..aec63dbd1209e4c3cbbe165d54a78277ea72f361 ---- /dev/null -+++ b/grub-core/kern/coreboot/cbtable.c -@@ -0,0 +1,72 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2007,2008,2013 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#pragma GCC diagnostic ignored "-Wcast-align" -+ -+/* Helper for grub_linuxbios_table_iterate. */ -+int -+grub_linuxbios_check_signature (grub_linuxbios_table_header_t tbl_header) -+{ -+ if (! grub_memcmp (tbl_header->signature, "LBIO", 4)) -+ return 1; -+ -+ return 0; -+} -+ -+grub_err_t -+grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t, -+ void *), -+ void *hook_data) -+{ -+ grub_linuxbios_table_header_t table_header = grub_linuxbios_get_tables (); -+ grub_linuxbios_table_item_t table_item; -+ -+ if (!table_header) -+ return 0; -+ -+signature_found: -+ -+ table_item = -+ (grub_linuxbios_table_item_t) ((char *) table_header + -+ table_header->header_size); -+ for (; table_item < (grub_linuxbios_table_item_t) ((char *) table_header -+ + table_header->header_size -+ + table_header->table_size); -+ table_item = (grub_linuxbios_table_item_t) ((char *) table_item + table_item->size)) -+ { -+ if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK -+ && grub_linuxbios_check_signature ((grub_linuxbios_table_header_t) (grub_addr_t) -+ *(grub_uint64_t *) (table_item + 1))) -+ { -+ table_header = (grub_linuxbios_table_header_t) (grub_addr_t) -+ *(grub_uint64_t *) (table_item + 1); -+ goto signature_found; -+ } -+ if (hook (table_item, hook_data)) -+ return 1; -+ } -+ -+ return 0; -+} -diff --git a/grub-core/kern/i386/coreboot/mmap.c b/grub-core/kern/coreboot/mmap.c -similarity index 97% -rename from grub-core/kern/i386/coreboot/mmap.c -rename to grub-core/kern/coreboot/mmap.c -index 4d29f6b7d90591939cf5d837b39c5d259a55efb0..caf8f7cef1b4552c720eb3b7ca355eb6cec32955 100644 ---- a/grub-core/kern/i386/coreboot/mmap.c -+++ b/grub-core/kern/coreboot/mmap.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include --#include -+#include -+#include - #include - #include - #include -@@ -49,6 +49,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) - { - grub_uint64_t start = mem_region->addr; - grub_uint64_t end = mem_region->addr + mem_region->size; -+#ifdef __i386__ - /* Mark region 0xa0000 - 0x100000 as reserved. */ - if (start < 0x100000 && end >= 0xa0000 - && mem_region->type == GRUB_MACHINE_MEMORY_AVAILABLE) -@@ -75,6 +76,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) - if (end <= start) - continue; - } -+#endif - if (ctx->hook (start, end - start, - /* Multiboot mmaps match with the coreboot mmap - definition. Therefore, we can just pass type -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index d467785fc6ce0763ec1392a65d6b30f1747ab5c4..708581fcbde007fc0174be636771b401d5e69ea2 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -154,6 +154,15 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) - GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); - } - -+void -+grub_reboot (void) -+{ -+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); -+ efi_call_4 (grub_efi_system_table->runtime_services->reset_system, -+ GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL); -+ for (;;) ; -+} -+ - void - grub_exit (void) - { -diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 2c31847bf6db77fab377c90e7ed36897439d6027..3dfdf2d22b02ae8847a3e19a175517d2d71544fa 100644 ---- a/grub-core/kern/efi/init.c -+++ b/grub-core/kern/efi/init.c -@@ -80,4 +80,5 @@ grub_efi_fini (void) - { - grub_efidisk_fini (); - grub_console_fini (); -+ grub_efi_memory_fini (); - } -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 20a47aaf5d0df376090510ddb8337ecc8aa18e98..42ad7c570a5532c4f6a5bef9d1ff3295f413aa11 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -49,38 +49,86 @@ static grub_efi_uintn_t finish_desc_size; - static grub_efi_uint32_t finish_desc_version; - int grub_efi_is_finished = 0; - -+/* -+ * We need to roll back EFI allocations on exit. Remember allocations that -+ * we'll free on exit. -+ */ -+struct efi_allocation; -+struct efi_allocation { -+ grub_efi_physical_address_t address; -+ grub_efi_uint64_t pages; -+ struct efi_allocation *next; -+}; -+static struct efi_allocation *efi_allocated_memory; -+ -+static void -+grub_efi_store_alloc (grub_efi_physical_address_t address, -+ grub_efi_uintn_t pages) -+{ -+ grub_efi_boot_services_t *b; -+ struct efi_allocation *alloc; -+ grub_efi_status_t status; -+ -+ b = grub_efi_system_table->boot_services; -+ status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA, -+ sizeof(*alloc), (void**)&alloc); -+ -+ if (status == GRUB_EFI_SUCCESS) -+ { -+ alloc->next = efi_allocated_memory; -+ alloc->address = address; -+ alloc->pages = pages; -+ efi_allocated_memory = alloc; -+ } -+ else -+ grub_printf ("Could not malloc memory to remember EFI allocation. " -+ "Exiting GRUB won't free all memory.\n"); -+} -+ -+static void -+grub_efi_drop_alloc (grub_efi_physical_address_t address, -+ grub_efi_uintn_t pages) -+{ -+ struct efi_allocation *ea, *eap; -+ grub_efi_boot_services_t *b; -+ -+ b = grub_efi_system_table->boot_services; -+ -+ for (eap = NULL, ea = efi_allocated_memory; ea; eap = ea, ea = ea->next) -+ { -+ if (ea->address != address || ea->pages != pages) -+ continue; -+ -+ /* Remove the current entry from the list. */ -+ if (eap) -+ eap->next = ea->next; -+ else -+ efi_allocated_memory = ea->next; -+ -+ /* Then free the memory backing it. */ -+ efi_call_1 (b->free_pool, ea); -+ -+ /* And leave, we're done. */ -+ break; -+ } -+} -+ - /* Allocate pages. Return the pointer to the first of allocated pages. */ - void * --grub_efi_allocate_pages (grub_efi_physical_address_t address, -- grub_efi_uintn_t pages) -+grub_efi_allocate_pages_real (grub_efi_physical_address_t address, -+ grub_efi_uintn_t pages, -+ grub_efi_allocate_type_t alloctype, -+ grub_efi_memory_type_t memtype) - { -- grub_efi_allocate_type_t type; - grub_efi_status_t status; - grub_efi_boot_services_t *b; - --#if 1 - /* Limit the memory access to less than 4GB for 32-bit platforms. */ - if (address > GRUB_EFI_MAX_USABLE_ADDRESS) - return 0; --#endif -- --#if 1 -- if (address == 0) -- { -- type = GRUB_EFI_ALLOCATE_MAX_ADDRESS; -- address = GRUB_EFI_MAX_USABLE_ADDRESS; -- } -- else -- type = GRUB_EFI_ALLOCATE_ADDRESS; --#else -- if (address == 0) -- type = GRUB_EFI_ALLOCATE_ANY_PAGES; -- else -- type = GRUB_EFI_ALLOCATE_ADDRESS; --#endif - - b = grub_efi_system_table->boot_services; -- status = efi_call_4 (b->allocate_pages, type, GRUB_EFI_LOADER_DATA, pages, &address); -+ status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address); - if (status != GRUB_EFI_SUCCESS) - return 0; - -@@ -89,15 +137,34 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address, - /* Uggh, the address 0 was allocated... This is too annoying, - so reallocate another one. */ - address = GRUB_EFI_MAX_USABLE_ADDRESS; -- status = efi_call_4 (b->allocate_pages, type, GRUB_EFI_LOADER_DATA, pages, &address); -+ status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address); - grub_efi_free_pages (0, pages); - if (status != GRUB_EFI_SUCCESS) - return 0; - } - -+ grub_efi_store_alloc (address, pages); -+ - return (void *) ((grub_addr_t) address); - } - -+void * -+grub_efi_allocate_any_pages (grub_efi_uintn_t pages) -+{ -+ return grub_efi_allocate_pages_real (GRUB_EFI_MAX_USABLE_ADDRESS, -+ pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, -+ GRUB_EFI_LOADER_DATA); -+} -+ -+void * -+grub_efi_allocate_fixed (grub_efi_physical_address_t address, -+ grub_efi_uintn_t pages) -+{ -+ return grub_efi_allocate_pages_real (address, pages, -+ GRUB_EFI_ALLOCATE_ADDRESS, -+ GRUB_EFI_LOADER_DATA); -+} -+ - /* Free pages starting from ADDRESS. */ - void - grub_efi_free_pages (grub_efi_physical_address_t address, -@@ -107,6 +174,8 @@ grub_efi_free_pages (grub_efi_physical_address_t address, - - b = grub_efi_system_table->boot_services; - efi_call_2 (b->free_pages, address, pages); -+ -+ grub_efi_drop_alloc (address, pages); - } - - #if defined (__i386__) || defined (__x86_64__) -@@ -217,6 +286,30 @@ grub_efi_finish_boot_services (grub_efi_uintn_t *outbuf_size, void *outbuf, - return GRUB_ERR_NONE; - } - -+/* -+ * To obtain the UEFI memory map, we must pass a buffer of sufficient size -+ * to hold the entire map. This function returns a sane start value for -+ * buffer size. -+ */ -+grub_efi_uintn_t -+grub_efi_find_mmap_size (void) -+{ -+ grub_efi_uintn_t mmap_size = 0; -+ grub_efi_uintn_t desc_size; -+ -+ if (grub_efi_get_memory_map (&mmap_size, NULL, NULL, &desc_size, 0) < 0) -+ { -+ grub_error (GRUB_ERR_IO, "cannot get EFI memory map size"); -+ return 0; -+ } -+ -+ /* -+ * Add an extra page, since UEFI can alter the memory map itself on -+ * callbacks or explicit calls, including console output. -+ */ -+ return ALIGN_UP (mmap_size + GRUB_EFI_PAGE_SIZE, GRUB_EFI_PAGE_SIZE); -+} -+ - /* Get the memory map as defined in the EFI spec. Return 1 if successful, - return 0 if partial, or return -1 if an error occurs. */ - int -@@ -402,7 +495,9 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, - pages = required_pages; - } - -- addr = grub_efi_allocate_pages (start, pages); -+ addr = grub_efi_allocate_pages_real (start, pages, -+ GRUB_EFI_ALLOCATE_ADDRESS, -+ GRUB_EFI_LOADER_CODE); - if (! addr) - grub_fatal ("cannot allocate conventional memory %p with %u pages", - (void *) ((grub_addr_t) start), -@@ -419,6 +514,20 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, - grub_fatal ("too little memory"); - } - -+void -+grub_efi_memory_fini (void) -+{ -+ /* -+ * Free all stale allocations. grub_efi_free_pages() will remove -+ * the found entry from the list and it will always find the first -+ * list entry (efi_allocated_memory is the list start). Hence we -+ * remove all entries from the list until none is left altogether. -+ */ -+ while (efi_allocated_memory) -+ grub_efi_free_pages (efi_allocated_memory->address, -+ efi_allocated_memory->pages); -+} -+ - #if 0 - /* Print the memory map. */ - static void -@@ -454,8 +563,7 @@ grub_efi_mm_init (void) - int mm_status; - - /* Prepare a memory region to store two memory maps. */ -- memory_map = grub_efi_allocate_pages (0, -- 2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); -+ memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); - if (! memory_map) - grub_fatal ("cannot allocate memory"); - -@@ -473,7 +581,7 @@ grub_efi_mm_init (void) - /* Freeing/allocating operations may increase memory map size. */ - map_size += desc_size * 32; - -- memory_map = grub_efi_allocate_pages (0, 2 * BYTES_TO_PAGES (map_size)); -+ memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES (map_size)); - if (! memory_map) - grub_fatal ("cannot allocate memory"); - -@@ -525,3 +633,34 @@ grub_efi_mm_init (void) - grub_efi_free_pages ((grub_addr_t) memory_map, - 2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); - } -+ -+#if defined (__aarch64__) || defined (__arm__) -+grub_err_t -+grub_efi_get_ram_base(grub_addr_t *base_addr) -+{ -+ grub_efi_memory_descriptor_t *memory_map, *desc; -+ grub_efi_uintn_t memory_map_size, desc_size; -+ int ret; -+ -+ memory_map_size = grub_efi_find_mmap_size(); -+ -+ memory_map = grub_malloc (memory_map_size); -+ if (! memory_map) -+ return GRUB_ERR_OUT_OF_MEMORY; -+ ret = grub_efi_get_memory_map (&memory_map_size, memory_map, NULL, -+ &desc_size, NULL); -+ -+ if (ret < 1) -+ return GRUB_ERR_BUG; -+ -+ for (desc = memory_map, *base_addr = GRUB_UINT_MAX; -+ (grub_addr_t) desc < ((grub_addr_t) memory_map + memory_map_size); -+ desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) -+ if (desc->attribute & GRUB_EFI_MEMORY_WB) -+ *base_addr = grub_min (*base_addr, desc->physical_start); -+ -+ grub_free(memory_map); -+ -+ return GRUB_ERR_NONE; -+} -+#endif -diff --git a/grub-core/kern/i386/coreboot/cbtable.c b/grub-core/kern/i386/coreboot/cbtable.c -index 1669bc0ca23a2fe5dcfb8e2b6c973ddb5e27e880..34a2b59be1ffa926e9dcc931140695cc82be223c 100644 ---- a/grub-core/kern/i386/coreboot/cbtable.c -+++ b/grub-core/kern/i386/coreboot/cbtable.c -@@ -17,7 +17,7 @@ - */ - - #include --#include -+#include - #include - #include - #include -@@ -25,59 +25,20 @@ - - GRUB_MOD_LICENSE ("GPLv3+"); - --/* Helper for grub_linuxbios_table_iterate. */ --static int --check_signature (grub_linuxbios_table_header_t tbl_header) --{ -- if (! grub_memcmp (tbl_header->signature, "LBIO", 4)) -- return 1; -- -- return 0; --} -- --grub_err_t --grub_linuxbios_table_iterate (int (*hook) (grub_linuxbios_table_item_t, -- void *), -- void *hook_data) -+grub_linuxbios_table_header_t -+grub_linuxbios_get_tables (void) - { - grub_linuxbios_table_header_t table_header; -- grub_linuxbios_table_item_t table_item; -- - /* Assuming table_header is aligned to its size (8 bytes). */ -- - for (table_header = (grub_linuxbios_table_header_t) 0x500; - table_header < (grub_linuxbios_table_header_t) 0x1000; table_header++) -- if (check_signature (table_header)) -- goto signature_found; -+ if (grub_linuxbios_check_signature (table_header)) -+ return table_header; - - for (table_header = (grub_linuxbios_table_header_t) 0xf0000; - table_header < (grub_linuxbios_table_header_t) 0x100000; table_header++) -- if (check_signature (table_header)) -- goto signature_found; -- -- return 0; -- --signature_found: -- -- table_item = -- (grub_linuxbios_table_item_t) ((char *) table_header + -- table_header->header_size); -- for (; table_item < (grub_linuxbios_table_item_t) ((char *) table_header -- + table_header->header_size -- + table_header->table_size); -- table_item = (grub_linuxbios_table_item_t) ((char *) table_item + table_item->size)) -- { -- if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK -- && check_signature ((grub_linuxbios_table_header_t) (grub_addr_t) -- *(grub_uint64_t *) (table_item + 1))) -- { -- table_header = (grub_linuxbios_table_header_t) (grub_addr_t) -- *(grub_uint64_t *) (table_item + 1); -- goto signature_found; -- } -- if (hook (table_item, hook_data)) -- return 1; -- } -+ if (grub_linuxbios_check_signature (table_header)) -+ return table_header; - - return 0; - } -diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c -index 2e85289d848946da8260b826ed36114557299278..f266eb13185f20dd4c8f67fdffa9a4790d9e01da 100644 ---- a/grub-core/kern/i386/tsc.c -+++ b/grub-core/kern/i386/tsc.c -@@ -68,7 +68,7 @@ grub_tsc_init (void) - #ifdef GRUB_MACHINE_XEN - (void) (grub_tsc_calibrate_from_xen () || calibrate_tsc_hardcode()); - #elif defined (GRUB_MACHINE_EFI) -- (void) (grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode()); -+ (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode()); - #elif defined (GRUB_MACHINE_COREBOOT) - (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode()); - #else -diff --git a/grub-core/kern/ieee1275/ieee1275.c b/grub-core/kern/ieee1275/ieee1275.c -index 98217029f458dcef3a5b227b300762ff14cf8c52..86f81a3c4671be293d823cd3235a66dff9774faa 100644 ---- a/grub-core/kern/ieee1275/ieee1275.c -+++ b/grub-core/kern/ieee1275/ieee1275.c -@@ -19,6 +19,7 @@ - - #include - #include -+#include - - #define IEEE1275_PHANDLE_INVALID ((grub_ieee1275_cell_t) -1) - #define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_cell_t) 0) -@@ -482,6 +483,91 @@ grub_ieee1275_close (grub_ieee1275_ihandle_t ihandle) - return 0; - } - -+int -+grub_ieee1275_decode_unit4 (grub_ieee1275_ihandle_t ihandle, -+ void *addr, grub_size_t size, -+ grub_uint32_t *phy_lo, grub_uint32_t *phy_hi, -+ grub_uint32_t *lun_lo, grub_uint32_t *lun_hi) -+{ -+ struct decode_args -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t size; -+ grub_ieee1275_cell_t addr; -+ grub_ieee1275_cell_t catch_result; -+ grub_ieee1275_cell_t tgt_h; -+ grub_ieee1275_cell_t tgt_l; -+ grub_ieee1275_cell_t lun_h; -+ grub_ieee1275_cell_t lun_l; -+ } -+ args; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 4, 5); -+ args.method = (grub_ieee1275_cell_t) "decode-unit"; -+ args.ihandle = ihandle; -+ args.size = size; -+ args.addr = (grub_ieee1275_cell_t) addr; -+ args.catch_result = 1; -+ -+ if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.catch_result)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, "decode-unit failed\n"); -+ return -1; -+ } -+ -+ *phy_lo = args.tgt_l; -+ *phy_hi = args.tgt_h; -+ *lun_lo = args.lun_l; -+ *lun_hi = args.lun_h; -+ return 0; -+} -+ -+char * -+grub_ieee1275_encode_uint4 (grub_ieee1275_ihandle_t ihandle, -+ grub_uint32_t phy_lo, grub_uint32_t phy_hi, -+ grub_uint32_t lun_lo, grub_uint32_t lun_hi, -+ grub_size_t *size) -+{ -+ char *addr; -+ struct encode_args -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t tgt_h; -+ grub_ieee1275_cell_t tgt_l; -+ grub_ieee1275_cell_t lun_h; -+ grub_ieee1275_cell_t lun_l; -+ grub_ieee1275_cell_t catch_result; -+ grub_ieee1275_cell_t size; -+ grub_ieee1275_cell_t addr; -+ } -+ args; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 3); -+ args.method = (grub_ieee1275_cell_t) "encode-unit"; -+ args.ihandle = ihandle; -+ -+ args.tgt_l = phy_lo; -+ args.tgt_h = phy_hi; -+ args.lun_l = lun_lo; -+ args.lun_h = lun_hi; -+ args.catch_result = 1; -+ -+ if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.catch_result)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, "encode-unit failed\n"); -+ return 0; -+ } -+ -+ addr = (void *)args.addr; -+ *size = args.size; -+ addr = grub_strdup ((char *)args.addr); -+ return addr; -+} -+ - int - grub_ieee1275_claim (grub_addr_t addr, grub_size_t size, unsigned int align, - grub_addr_t *result) -@@ -607,3 +693,117 @@ grub_ieee1275_milliseconds (grub_uint32_t *msecs) - *msecs = args.msecs; - return 0; - } -+ -+int -+grub_ieee1275_set_address (grub_ieee1275_ihandle_t ihandle, -+ grub_uint32_t target, grub_uint32_t lun) -+{ -+ struct set_address -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t tgt; -+ grub_ieee1275_cell_t lun; -+ grub_ieee1275_cell_t catch_result; -+ } -+ args; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 4, 1); -+ -+ /* -+ * IEEE 1275-1994 Standard for Boot (Initialization Configuration) -+ * Firmware: Core Requirements and Practices -+ * E.3.2.2 Bus-specific methods for bus nodes -+ * -+ * A package implementing the scsi-2 device type shall implement the -+ * following bus-specific method: -+ * -+ * set-address ( unit# target# -- ) -+ * Sets the SCSI target number (0x0..0xf) and unit number (0..7) to which -+ * subsequent commands apply. -+ */ -+ args.method = (grub_ieee1275_cell_t) "set-address"; -+ args.ihandle = ihandle; -+ args.tgt = target; -+ args.lun = lun; -+ -+ if (IEEE1275_CALL_ENTRY_FN (&args) == -1) -+ return -1; -+ -+ return args.catch_result; -+} -+ -+int -+grub_ieee1275_no_data_command (grub_ieee1275_ihandle_t ihandle, -+ const void *cmd_addr, grub_ssize_t *result) -+{ -+ struct set_address -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t cmd_addr; -+ grub_ieee1275_cell_t error; -+ grub_ieee1275_cell_t catch_result; -+ } -+ args; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); -+ -+ /* -+ * IEEE 1275-1994 Standard for Boot (Initialization Configuration) -+ * Firmware: Core Requirements and Practices -+ * -+ * E.3.2.2 Bus-specific methods for bus nodes -+ * -+ * A package implementing the scsi-2 device type shall implement the -+ * following bus-specific method: -+ * -+ * no-data-command ( cmd-addr -- error? ) -+ * Executes a simple SCSI command, automatically retrying under -+ * certain conditions. cmd-addr is the address of a 6-byte command buffer -+ * containing an SCSI command that does not have a data transfer phase. -+ * Executes the command, retrying indefinitely with the same retry criteria -+ * as retry-command. -+ * -+ * error? is nonzero if an error occurred, zero otherwise. -+ * NOTE no-data-command is a convenience function. It provides -+ * no capabilities that are not present in retry-command, but for -+ * those commands that meet its restrictions, it is easier to use. -+ */ -+ args.method = (grub_ieee1275_cell_t) "no-data-command"; -+ args.ihandle = ihandle; -+ args.cmd_addr = (grub_ieee1275_cell_t) cmd_addr; -+ -+ if (IEEE1275_CALL_ENTRY_FN (&args) == -1) -+ return -1; -+ -+ if (result) -+ *result = args.error; -+ -+ return args.catch_result; -+} -+ -+int -+grub_ieee1275_get_block_size (grub_ieee1275_ihandle_t ihandle) -+{ -+ struct size_args_ieee1275 -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t result; -+ grub_ieee1275_cell_t size; -+ } args; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 2); -+ args.method = (grub_ieee1275_cell_t) "block-size"; -+ args.ihandle = ihandle; -+ args.result = 1; -+ -+ if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result)) -+ return 0; -+ -+ return args.size; -+} -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 12590225eca1483066ea5e7b7443cea3198f6d9b..0d8ebf58b95e220b233e043d2b380007b48e1235 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -94,28 +94,12 @@ void - grub_machine_get_bootlocation (char **device, char **path) - { - char *bootpath; -- grub_ssize_t bootpath_size; - char *filename; - char *type; - -- if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath", -- &bootpath_size) -- || bootpath_size <= 0) -- { -- /* Should never happen. */ -- grub_printf ("/chosen/bootpath property missing!\n"); -- return; -- } -- -- bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64); -+ bootpath = grub_ieee1275_get_boot_dev (); - if (! bootpath) -- { -- grub_print_error (); -- return; -- } -- grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath, -- (grub_size_t) bootpath_size + 1, 0); -- bootpath[bootpath_size] = '\0'; -+ return; - - /* Transform an OF device path to a GRUB path. */ - -@@ -126,6 +110,8 @@ grub_machine_get_bootlocation (char **device, char **path) - char *ptr; - dev = grub_ieee1275_get_aliasdevname (bootpath); - canon = grub_ieee1275_canonicalise_devname (dev); -+ if (! canon) -+ return; - ptr = canon + grub_strlen (canon) - 1; - while (ptr > canon && (*ptr == ',' || *ptr == ':')) - ptr--; -diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c -index ddb778340e4ab74148898b32cd27139fd4f1465b..62929d983bfaa2c83158ee4fe6797125c6d6b844 100644 ---- a/grub-core/kern/ieee1275/openfw.c -+++ b/grub-core/kern/ieee1275/openfw.c -@@ -561,3 +561,30 @@ grub_ieee1275_canonicalise_devname (const char *path) - return NULL; - } - -+char * -+grub_ieee1275_get_boot_dev (void) -+{ -+ char *bootpath; -+ grub_ssize_t bootpath_size; -+ -+ if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath", -+ &bootpath_size) -+ || bootpath_size <= 0) -+ { -+ /* Should never happen. */ -+ grub_printf ("/chosen/bootpath property missing!\n"); -+ return NULL; -+ } -+ -+ bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64); -+ if (! bootpath) -+ { -+ grub_print_error (); -+ return NULL; -+ } -+ grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath, -+ (grub_size_t) bootpath_size + 1, 0); -+ bootpath[bootpath_size] = '\0'; -+ -+ return bootpath; -+} -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index d1a54df6c12e3358e07aa86366c65af22ca3af5c..3b633d51f4c63e2983e8b3419dc057437224fb93 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -391,12 +391,13 @@ grub_strtoull (const char *str, char **end, int base) - unsigned long digit; - - digit = grub_tolower (*str) - '0'; -- if (digit > 9) -- { -- digit += '0' - 'a' + 10; -- if (digit >= (unsigned long) base) -- break; -- } -+ if (digit >= 'a' - '0') -+ digit += '0' - 'a' + 10; -+ else if (digit > 9) -+ break; -+ -+ if (digit >= (unsigned long) base) -+ break; - - found = 1; - -diff --git a/grub-core/kern/sparc64/ieee1275/ieee1275.c b/grub-core/kern/sparc64/ieee1275/ieee1275.c -index 53be692c3d88940572d423ceb09e4187372fcb5b..5a59aaf06193442fa5ec7a537c9cfb10dd3081aa 100644 ---- a/grub-core/kern/sparc64/ieee1275/ieee1275.c -+++ b/grub-core/kern/sparc64/ieee1275/ieee1275.c -@@ -89,3 +89,59 @@ grub_ieee1275_alloc_physmem (grub_addr_t *paddr, grub_size_t size, - - return args.catch_result; - } -+ -+grub_uint64_t -+grub_ieee1275_num_blocks (grub_ieee1275_ihandle_t ihandle) -+{ -+ struct nblocks_args_ieee1275 -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t catch_result; -+ grub_ieee1275_cell_t blocks; -+ } -+ args; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 2); -+ args.method = (grub_ieee1275_cell_t) "#blocks"; -+ args.ihandle = ihandle; -+ args.catch_result = 1; -+ -+ if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.catch_result != 0)) -+ return -1; -+ -+ /* -+ * If the number of blocks exceeds the range of an unsigned number, -+ * return 0 to alert the caller to try the #blocks64 command. -+ */ -+ if (args.blocks >= 0xffffffffULL) -+ return 0; -+ -+ return args.blocks; -+} -+ -+grub_uint64_t -+grub_ieee1275_num_blocks64 (grub_ieee1275_ihandle_t ihandle) -+{ -+ struct nblocks_args_ieee1275 -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t catch_result; -+ grub_ieee1275_cell_t hi_blocks; -+ grub_ieee1275_cell_t lo_blocks; -+ } -+ args; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 3); -+ args.method = (grub_ieee1275_cell_t) "#blocks64"; -+ args.ihandle = ihandle; -+ args.catch_result = 1; -+ -+ if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.catch_result != 0)) -+ return -1; -+ -+ return ((args.hi_blocks << 32) | (args.lo_blocks)); -+} -diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c -index 5dcc106ed9bcc1fa2cdbe2ba6cbb9e709420ceb3..3e338645c573aa707343235029d9fc45d515a9dc 100644 ---- a/grub-core/kern/uboot/init.c -+++ b/grub-core/kern/uboot/init.c -@@ -36,30 +36,14 @@ - extern char __bss_start[]; - extern char _end[]; - extern grub_size_t grub_total_module_size; --extern int (*grub_uboot_syscall_ptr) (int, int *, ...); - static unsigned long timer_start; - --extern grub_uint32_t grub_uboot_machine_type; --extern grub_addr_t grub_uboot_boot_data; -- - void - grub_exit (void) - { - grub_uboot_return (0); - } - --grub_uint32_t --grub_uboot_get_machine_type (void) --{ -- return grub_uboot_machine_type; --} -- --grub_addr_t --grub_uboot_get_boot_data (void) --{ -- return grub_uboot_boot_data; --} -- - static grub_uint64_t - uboot_timer_ms (void) - { -diff --git a/grub-core/kern/uboot/uboot.c b/grub-core/kern/uboot/uboot.c -index 6800a4beb1c4e83ef9f4ac5da872d2557d8471e1..cf0168e62ddd26db50efd2351499fa7f74fce26c 100644 ---- a/grub-core/kern/uboot/uboot.c -+++ b/grub-core/kern/uboot/uboot.c -@@ -39,48 +39,13 @@ - * returns: 0 if the call not found, 1 if serviced - */ - --extern int (*grub_uboot_syscall_ptr) (int, int *, ...); - extern int grub_uboot_syscall (int, int *, ...); --extern grub_addr_t grub_uboot_search_hint; - - static struct sys_info uboot_sys_info; - static struct mem_region uboot_mem_info[5]; - static struct device_info * devices; - static int num_devices; - --int --grub_uboot_api_init (void) --{ -- struct api_signature *start, *end; -- struct api_signature *p; -- -- if (grub_uboot_search_hint) -- { -- /* Extended search range to work around Trim Slice U-Boot issue */ -- start = (struct api_signature *) ((grub_uboot_search_hint & ~0x000fffff) -- - 0x00500000); -- end = -- (struct api_signature *) ((grub_addr_t) start + UBOOT_API_SEARCH_LEN - -- API_SIG_MAGLEN + 0x00500000); -- } -- else -- { -- start = 0; -- end = (struct api_signature *) (256 * 1024 * 1024); -- } -- -- /* Structure alignment is (at least) 8 bytes */ -- for (p = start; p < end; p = (void *) ((grub_addr_t) p + 8)) -- { -- if (grub_memcmp (&(p->magic), API_SIG_MAGIC, API_SIG_MAGLEN) == 0) -- { -- grub_uboot_syscall_ptr = p->syscall; -- return p->version; -- } -- } -- -- return 0; --} - - /* - * All functions below are wrappers around the grub_uboot_syscall() function -diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c -index 44069067312a890b4e3ebb5130861ed23572bc54..3a73e6e6ce2c5aefc33313e583cb259ea9bc2645 100644 ---- a/grub-core/kern/x86_64/dl.c -+++ b/grub-core/kern/x86_64/dl.c -@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - { - grub_int64_t value; - value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value - -diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index 683a8aaa711c4eab0208d116cd7275a6ac678986..ca334d5a40e0716bdc9afbb79135c47d174532da 100644 ---- a/grub-core/lib/crypto.c -+++ b/grub-core/lib/crypto.c -@@ -462,7 +462,7 @@ grub_password_get (char buf[], unsigned buf_size) - if (key == '\n' || key == '\r') - break; - -- if (key == '\e') -+ if (key == GRUB_TERM_ESC) - { - cur_len = 0; - break; -@@ -487,7 +487,7 @@ grub_password_get (char buf[], unsigned buf_size) - grub_xputs ("\n"); - grub_refresh (); - -- return (key != '\e'); -+ return (key != GRUB_TERM_ESC); - } - #endif - -diff --git a/grub-core/lib/uboot/datetime.c b/grub-core/lib/dummy/datetime.c -similarity index 91% -rename from grub-core/lib/uboot/datetime.c -rename to grub-core/lib/dummy/datetime.c -index 4be716928a55b789510dfdcdd1833e29e5cd11fe..cf693fc6b621376b5cae0ca0a74b4421799b5a9e 100644 ---- a/grub-core/lib/uboot/datetime.c -+++ b/grub-core/lib/dummy/datetime.c -@@ -18,7 +18,6 @@ - - #include - #include --#include - #include - #include - -@@ -30,12 +29,12 @@ grub_err_t - grub_get_datetime (struct grub_datetime *datetime __attribute__ ((unused))) - { - return grub_error (GRUB_ERR_INVALID_COMMAND, -- "can\'t get datetime using U-Boot"); -+ "can\'t get datetime on this machine"); - } - - grub_err_t - grub_set_datetime (struct grub_datetime * datetime __attribute__ ((unused))) - { - return grub_error (GRUB_ERR_INVALID_COMMAND, -- "can\'t set datetime using U-Boot"); -+ "can\'t set datetime on this machine"); - } -diff --git a/grub-core/lib/uboot/halt.c b/grub-core/lib/dummy/halt.c -similarity index 100% -rename from grub-core/lib/uboot/halt.c -rename to grub-core/lib/dummy/halt.c -diff --git a/grub-core/lib/efi/reboot.c b/grub-core/lib/dummy/reboot.c -similarity index 77% -rename from grub-core/lib/efi/reboot.c -rename to grub-core/lib/dummy/reboot.c -index 7de8bcb5d6ea128dd406001d970d18ff00ea0f3c..b8cbed8f8117ca9c53cc2087dee87ae68876d64f 100644 ---- a/grub-core/lib/efi/reboot.c -+++ b/grub-core/lib/dummy/reboot.c -@@ -1,6 +1,6 @@ - /* - * GRUB -- GRand Unified Bootloader -- * Copyright (C) 2011 Free Software Foundation, Inc. -+ * Copyright (C) 2013 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by -@@ -16,10 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include --#include --#include - #include -+#include - #include - #include - -@@ -27,7 +25,8 @@ void - grub_reboot (void) - { - grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); -- efi_call_4 (grub_efi_system_table->runtime_services->reset_system, -- GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL); -- for (;;) ; -+ -+ /* Just stop here */ -+ -+ while (1); - } -diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c -index b5d520f208886aa663d4aac36cec9b43a2d0da42..0d371c5633e84bbf47114bfe2c23427982e25192 100644 ---- a/grub-core/lib/fdt.c -+++ b/grub-core/lib/fdt.c -@@ -41,11 +41,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); - (2 * sizeof(grub_uint32_t) \ - + ALIGN_UP (grub_strlen (name) + 1, sizeof(grub_uint32_t))) - --/* Size needed by a property entry: 1 token (FDT_PROPERTY), plus len and nameoff -- fields, plus the property value, plus padding if needed. */ --#define prop_entry_size(prop_len) \ -- (3 * sizeof(grub_uint32_t) + ALIGN_UP(prop_len, sizeof(grub_uint32_t))) -- - #define SKIP_NODE_NAME(name, token, end) \ - name = (char *) ((token) + 1); \ - while (name < (char *) end) \ -@@ -86,7 +81,7 @@ static grub_uint32_t *get_next_node (const void *fdt, char *node_name) - case FDT_PROP: - /* Skip property token and following data (len, nameoff and property - value). */ -- token += prop_entry_size(grub_be_to_cpu32(*(token + 1))) -+ token += grub_fdt_prop_entry_size(grub_be_to_cpu32(*(token + 1))) - / sizeof(*token); - break; - case FDT_NOP: -@@ -102,13 +97,13 @@ static grub_uint32_t *get_next_node (const void *fdt, char *node_name) - static int get_mem_rsvmap_size (const void *fdt) - { - int size = 0; -- grub_uint64_t *ptr = (void *) ((grub_addr_t) fdt -- + grub_fdt_get_off_mem_rsvmap (fdt)); -+ grub_unaligned_uint64_t *ptr = (void *) ((grub_addr_t) fdt -+ + grub_fdt_get_off_mem_rsvmap (fdt)); - - do - { - size += 2 * sizeof(*ptr); -- if (!*ptr && !*(ptr + 1)) -+ if (!ptr[0].val && !ptr[1].val) - return size; - ptr += 2; - } while ((grub_addr_t) ptr <= (grub_addr_t) fdt + grub_fdt_get_totalsize (fdt) -@@ -150,7 +145,7 @@ static int add_subnode (void *fdt, int parentoffset, const char *name) - { - case FDT_PROP: - /* Skip len, nameoff and property value. */ -- token += prop_entry_size(grub_be_to_cpu32(*(token + 1))) -+ token += grub_fdt_prop_entry_size(grub_be_to_cpu32(*(token + 1))) - / sizeof(*token); - break; - case FDT_BEGIN_NODE: -@@ -229,7 +224,7 @@ static int rearrange_blocks (void *fdt, unsigned int clearance) - return 0; - } - --static grub_uint32_t *find_prop (void *fdt, unsigned int nodeoffset, -+static grub_uint32_t *find_prop (const void *fdt, unsigned int nodeoffset, - const char *name) - { - grub_uint32_t *prop = (void *) ((grub_addr_t) fdt -@@ -249,12 +244,12 @@ static grub_uint32_t *find_prop (void *fdt, unsigned int nodeoffset, - && !grub_strcmp (name, (char *) fdt + - grub_fdt_get_off_dt_strings (fdt) + nameoff)) - { -- if (prop + prop_entry_size(grub_be_to_cpu32(*(prop + 1))) -+ if (prop + grub_fdt_prop_entry_size(grub_be_to_cpu32(*(prop + 1))) - / sizeof (*prop) >= end) - return NULL; - return prop; - } -- prop += prop_entry_size(grub_be_to_cpu32(*(prop + 1))) / sizeof (*prop); -+ prop += grub_fdt_prop_entry_size(grub_be_to_cpu32(*(prop + 1))) / sizeof (*prop); - } - else if (grub_be_to_cpu32(*prop) == FDT_NOP) - prop++; -@@ -268,9 +263,9 @@ static grub_uint32_t *find_prop (void *fdt, unsigned int nodeoffset, - the size allocated for the FDT; if this function is called before the other - functions in this file and returns success, the other functions are - guaranteed not to access memory locations outside the allocated memory. */ --int grub_fdt_check_header_nosize (void *fdt) -+int grub_fdt_check_header_nosize (const void *fdt) - { -- if (((grub_addr_t) fdt & 0x7) || (grub_fdt_get_magic (fdt) != FDT_MAGIC) -+ if (((grub_addr_t) fdt & 0x3) || (grub_fdt_get_magic (fdt) != FDT_MAGIC) - || (grub_fdt_get_version (fdt) < FDT_SUPPORTED_VERSION) - || (grub_fdt_get_last_comp_version (fdt) > FDT_SUPPORTED_VERSION) - || (grub_fdt_get_off_dt_struct (fdt) & 0x00000003) -@@ -286,7 +281,7 @@ int grub_fdt_check_header_nosize (void *fdt) - return 0; - } - --int grub_fdt_check_header (void *fdt, unsigned int size) -+int grub_fdt_check_header (const void *fdt, unsigned int size) - { - if (size < sizeof (grub_fdt_header_t) - || (grub_fdt_get_totalsize (fdt) > size) -@@ -295,52 +290,105 @@ int grub_fdt_check_header (void *fdt, unsigned int size) - return 0; - } - -+static const grub_uint32_t * -+advance_token (const void *fdt, const grub_uint32_t *token, const grub_uint32_t *end, int skip_current) -+{ -+ for (; token < end; skip_current = 0) -+ { -+ switch (grub_be_to_cpu32 (*token)) -+ { -+ case FDT_BEGIN_NODE: -+ if (skip_current) -+ { -+ token = get_next_node (fdt, (char *) (token + 1)); -+ continue; -+ } -+ char *ptr; -+ for (ptr = (char *) (token + 1); *ptr && ptr < (char *) end; ptr++) -+ ; -+ if (ptr >= (char *) end) -+ return 0; -+ return token; -+ case FDT_PROP: -+ /* Skip property token and following data (len, nameoff and property -+ value). */ -+ if (token >= end - 1) -+ return 0; -+ token += grub_fdt_prop_entry_size(grub_be_to_cpu32(*(token + 1))) -+ / sizeof(*token); -+ break; -+ case FDT_NOP: -+ token++; -+ break; -+ default: -+ return 0; -+ } -+ } -+ return 0; -+} -+ -+int grub_fdt_next_node (const void *fdt, unsigned int currentoffset) -+{ -+ const grub_uint32_t *token = (const grub_uint32_t *) fdt + (currentoffset + grub_fdt_get_off_dt_struct (fdt)) / 4; -+ token = advance_token (fdt, token, (const void *) struct_end (fdt), 1); -+ if (!token) -+ return -1; -+ return (int) ((grub_addr_t) token - (grub_addr_t) fdt -+ - grub_fdt_get_off_dt_struct (fdt)); -+} -+ -+int grub_fdt_first_node (const void *fdt, unsigned int parentoffset) -+{ -+ const grub_uint32_t *token, *end; -+ char *node_name; -+ -+ if (parentoffset & 0x3) -+ return -1; -+ token = (const void *) ((grub_addr_t) fdt + grub_fdt_get_off_dt_struct(fdt) -+ + parentoffset); -+ end = (const void *) struct_end (fdt); -+ if ((token >= end) || (grub_be_to_cpu32(*token) != FDT_BEGIN_NODE)) -+ return -1; -+ SKIP_NODE_NAME(node_name, token, end); -+ token = advance_token (fdt, token, end, 0); -+ if (!token) -+ return -1; -+ return (int) ((grub_addr_t) token - (grub_addr_t) fdt -+ - grub_fdt_get_off_dt_struct (fdt)); -+} -+ - /* Find a direct sub-node of a given parent node. */ - int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset, - const char *name) - { -- grub_uint32_t *token, *end; -- char *node_name; -+ const grub_uint32_t *token, *end; -+ const char *node_name; -+ int skip_current = 0; - - if (parentoffset & 0x3) - return -1; -- token = (void *) ((grub_addr_t) fdt + grub_fdt_get_off_dt_struct(fdt) -+ token = (const void *) ((grub_addr_t) fdt + grub_fdt_get_off_dt_struct(fdt) - + parentoffset); -- end = (void *) struct_end (fdt); -+ end = (const void *) struct_end (fdt); - if ((token >= end) || (grub_be_to_cpu32(*token) != FDT_BEGIN_NODE)) - return -1; - SKIP_NODE_NAME(node_name, token, end); -- while (token < end) -- { -- switch (grub_be_to_cpu32(*token)) -- { -- case FDT_BEGIN_NODE: -- node_name = (char *) (token + 1); -- if (node_name + grub_strlen (name) >= (char *) end) -- return -1; -- if (!grub_strcmp (node_name, name)) -- return (int) ((grub_addr_t) token - (grub_addr_t) fdt -- - grub_fdt_get_off_dt_struct (fdt)); -- token = get_next_node (fdt, node_name); -- if (!token) -- return -1; -- break; -- case FDT_PROP: -- /* Skip property token and following data (len, nameoff and property -- value). */ -- if (token >= end - 1) -- return -1; -- token += prop_entry_size(grub_be_to_cpu32(*(token + 1))) -- / sizeof(*token); -- break; -- case FDT_NOP: -- token++; -- break; -- default: -- return -1; -- } -+ while (1) { -+ token = advance_token (fdt, token, end, skip_current); -+ if (!token) -+ return -1; -+ skip_current = 1; -+ node_name = (const char *) token + 4; -+ if (grub_strcmp (node_name, name) == 0) -+ return (int) ((grub_addr_t) token - (grub_addr_t) fdt -+ - grub_fdt_get_off_dt_struct (fdt)); - } -- return -1; -+} -+ -+const char * -+grub_fdt_get_nodename (const void *fdt, unsigned int nodeoffset) -+{ -+ return (const char *) fdt + grub_fdt_get_off_dt_struct(fdt) + nodeoffset + 4; - } - - int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset, -@@ -359,6 +407,24 @@ int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset, - return add_subnode (fdt, parentoffset, name); - } - -+const void * -+grub_fdt_get_prop (const void *fdt, unsigned int nodeoffset, const char *name, -+ grub_uint32_t *len) -+{ -+ grub_uint32_t *prop; -+ if ((nodeoffset >= grub_fdt_get_size_dt_struct (fdt)) || (nodeoffset & 0x3) -+ || (grub_be_to_cpu32(*(grub_uint32_t *) ((grub_addr_t) fdt -+ + grub_fdt_get_off_dt_struct (fdt) + nodeoffset)) -+ != FDT_BEGIN_NODE)) -+ return 0; -+ prop = find_prop (fdt, nodeoffset, name); -+ if (!prop) -+ return 0; -+ if (len) -+ *len = grub_be_to_cpu32 (*(prop + 1)); -+ return prop + 3; -+} -+ - int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, - const void *val, grub_uint32_t len) - { -@@ -396,12 +462,12 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, - unsigned int needed_space = 0; - - if (!prop) -- needed_space = prop_entry_size(len); -+ needed_space = grub_fdt_prop_entry_size(len); - if (!prop_name_present) - needed_space += grub_strlen (name) + 1; - if (needed_space > get_free_space (fdt)) - return -1; -- if (rearrange_blocks (fdt, !prop ? prop_entry_size(len) : 0) < 0) -+ if (rearrange_blocks (fdt, !prop ? grub_fdt_prop_entry_size(len) : 0) < 0) - return -1; - } - if (!prop_name_present) { -@@ -418,10 +484,10 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, - + sizeof(grub_uint32_t)); - - prop = (void *) (node_name + ALIGN_UP(grub_strlen(node_name) + 1, 4)); -- grub_memmove (prop + prop_entry_size(len) / sizeof(*prop), prop, -+ grub_memmove (prop + grub_fdt_prop_entry_size(len) / sizeof(*prop), prop, - struct_end(fdt) - (grub_addr_t) prop); - grub_fdt_set_size_dt_struct (fdt, grub_fdt_get_size_dt_struct (fdt) -- + prop_entry_size(len)); -+ + grub_fdt_prop_entry_size(len)); - *prop = grub_cpu_to_be32_compile_time (FDT_PROP); - *(prop + 2) = grub_cpu_to_be32 (nameoff); - } -@@ -429,7 +495,7 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, - - /* Insert padding bytes at the end of the value; if they are not needed, they - will be overwritten by the following memcpy. */ -- *(prop + prop_entry_size(len) / sizeof(grub_uint32_t) - 1) = 0; -+ *(prop + grub_fdt_prop_entry_size(len) / sizeof(grub_uint32_t) - 1) = 0; - - grub_memcpy (prop + 3, val, len); - return 0; -diff --git a/grub-core/lib/i386/reboot.c b/grub-core/lib/i386/reboot.c -index a234244dce5b4c5afd5c68e579c4519a870cda36..dce0b563dcd39ce7acc6d5ec0cc759e67c8c8b87 100644 ---- a/grub-core/lib/i386/reboot.c -+++ b/grub-core/lib/i386/reboot.c -@@ -16,6 +16,8 @@ - * along with GRUB. If not, see . - */ - -+#ifndef GRUB_MACHINE_EFI -+ - #include - #include - #include -@@ -58,3 +60,5 @@ grub_reboot (void) - - while (1); - } -+ -+#endif /* GRUB_MACHINE_EFI */ -diff --git a/grub-core/lib/libgcrypt/cipher/crc.c b/grub-core/lib/libgcrypt/cipher/crc.c -index 9e406f1b19b4d1d49c1ba5140c47d630972c0d8e..28454f8ab728c657d0b440371765030deb35a407 100644 ---- a/grub-core/lib/libgcrypt/cipher/crc.c -+++ b/grub-core/lib/libgcrypt/cipher/crc.c -@@ -28,116 +28,8 @@ - #include "cipher.h" - - #include "bithelp.h" -+#include "bufhelp.h" - --/* Table of CRCs of all 8-bit messages. Generated by running code -- from RFC 1952 modified to print out the table. */ --static u32 crc32_table[256] = { -- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, -- 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, -- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, -- 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, -- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, -- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, -- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, -- 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, -- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, -- 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, -- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, -- 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, -- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, -- 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, -- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, -- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, -- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, -- 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, -- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, -- 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, -- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, -- 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, -- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, -- 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, -- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, -- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, -- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, -- 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, -- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, -- 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, -- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, -- 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, -- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, -- 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, -- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, -- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, -- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, -- 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, -- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, -- 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, -- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, -- 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, -- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d --}; -- --/* -- * The following function was extracted from RFC 1952 by Simon -- * Josefsson, for the Shishi project, and modified to be compatible -- * with the modified CRC-32 used by RFC 1510, and subsequently -- * modified for GNU Libgcrypt to allow it to be used for calculating -- * both unmodified CRC-32 and modified CRC-32 values. Original -- * copyright and notice from the document follows: -- * -- * Copyright (c) 1996 L. Peter Deutsch -- * -- * Permission is granted to copy and distribute this document for -- * any purpose and without charge, including translations into -- * other languages and incorporation into compilations, provided -- * that the copyright notice and this notice are preserved, and -- * that any substantive changes or deletions from the original are -- * clearly marked. -- * -- * The copyright on RFCs, and consequently the function below, are -- * supposedly also retroactively claimed by the Internet Society -- * (according to rfc-editor@rfc-editor.org), with the following -- * copyright notice: -- * -- * Copyright (C) The Internet Society. All Rights Reserved. -- * -- * This document and translations of it may be copied and furnished -- * to others, and derivative works that comment on or otherwise -- * explain it or assist in its implementation may be prepared, -- * copied, published and distributed, in whole or in part, without -- * restriction of any kind, provided that the above copyright -- * notice and this paragraph are included on all such copies and -- * derivative works. However, this document itself may not be -- * modified in any way, such as by removing the copyright notice or -- * references to the Internet Society or other Internet -- * organizations, except as needed for the purpose of developing -- * Internet standards in which case the procedures for copyrights -- * defined in the Internet Standards process must be followed, or -- * as required to translate it into languages other than English. -- * -- * The limited permissions granted above are perpetual and will not be -- * revoked by the Internet Society or its successors or assigns. -- * -- * This document and the information contained herein is provided -- * on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET -- * ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR -- * IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE -- * OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY -- * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A -- * PARTICULAR PURPOSE. -- * -- */ --static u32 --update_crc32 (u32 crc, const void *buf_arg, size_t len) --{ -- const char *buf = buf_arg; -- size_t n; -- -- for (n = 0; n < len; n++) -- crc = crc32_table[(crc ^ buf[n]) & 0xff] ^ (crc >> 8); -- -- return crc; --} - - typedef struct - { -@@ -146,8 +38,302 @@ typedef struct - } - CRC_CONTEXT; - -+ -+/* -+ * Code generated by universal_crc by Danjel McGougan -+ * -+ * CRC parameters used: -+ * bits: 32 -+ * poly: 0x04c11db7 -+ * init: 0xffffffff -+ * xor: 0xffffffff -+ * reverse: true -+ * non-direct: false -+ * -+ * CRC of the string "123456789" is 0xcbf43926 -+ */ -+ -+static const u32 crc32_table[1024] = { -+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, -+ 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, -+ 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, -+ 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, -+ 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, -+ 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, -+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, -+ 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, -+ 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, -+ 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, -+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, -+ 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, -+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, -+ 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, -+ 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, -+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, -+ 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, -+ 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, -+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, -+ 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, -+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, -+ 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, -+ 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, -+ 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, -+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, -+ 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, -+ 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, -+ 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, -+ 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, -+ 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, -+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, -+ 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, -+ 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, -+ 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, -+ 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, -+ 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, -+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, -+ 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, -+ 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, -+ 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, -+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, -+ 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, -+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, -+ 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, -+ 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, -+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, -+ 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, -+ 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, -+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, -+ 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, -+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, -+ 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, -+ 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, -+ 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, -+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, -+ 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, -+ 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, -+ 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, -+ 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, -+ 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, -+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, -+ 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, -+ 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, -+ 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, -+ 0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, -+ 0x646cc504, 0x7d77f445, 0x565aa786, 0x4f4196c7, -+ 0xc8d98a08, 0xd1c2bb49, 0xfaefe88a, 0xe3f4d9cb, -+ 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, 0x87981ccf, -+ 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, -+ 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, -+ 0x821b9859, 0x9b00a918, 0xb02dfadb, 0xa936cb9a, -+ 0xe6775d5d, 0xff6c6c1c, 0xd4413fdf, 0xcd5a0e9e, -+ 0x958424a2, 0x8c9f15e3, 0xa7b24620, 0xbea97761, -+ 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, -+ 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, -+ 0x39316bae, 0x202a5aef, 0x0b07092c, 0x121c386d, -+ 0xdf4636f3, 0xc65d07b2, 0xed705471, 0xf46b6530, -+ 0xbb2af3f7, 0xa231c2b6, 0x891c9175, 0x9007a034, -+ 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, -+ 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, -+ 0xf0794f05, 0xe9627e44, 0xc24f2d87, 0xdb541cc6, -+ 0x94158a01, 0x8d0ebb40, 0xa623e883, 0xbf38d9c2, -+ 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, 0x138d96ce, -+ 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, -+ 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, -+ 0xded79850, 0xc7cca911, 0xece1fad2, 0xf5facb93, -+ 0x7262d75c, 0x6b79e61d, 0x4054b5de, 0x594f849f, -+ 0x160e1258, 0x0f152319, 0x243870da, 0x3d23419b, -+ 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, -+ 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, -+ 0xad24e1af, 0xb43fd0ee, 0x9f12832d, 0x8609b26c, -+ 0xc94824ab, 0xd05315ea, 0xfb7e4629, 0xe2657768, -+ 0x2f3f79f6, 0x362448b7, 0x1d091b74, 0x04122a35, -+ 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, -+ 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, -+ 0x838a36fa, 0x9a9107bb, 0xb1bc5478, 0xa8a76539, -+ 0x3b83984b, 0x2298a90a, 0x09b5fac9, 0x10aecb88, -+ 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, 0x74c20e8c, -+ 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, -+ 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, -+ 0x71418a1a, 0x685abb5b, 0x4377e898, 0x5a6cd9d9, -+ 0x152d4f1e, 0x0c367e5f, 0x271b2d9c, 0x3e001cdd, -+ 0xb9980012, 0xa0833153, 0x8bae6290, 0x92b553d1, -+ 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, -+ 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, -+ 0xca6b79ed, 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, -+ 0x66de36e1, 0x7fc507a0, 0x54e85463, 0x4df36522, -+ 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, 0x299fa026, -+ 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, -+ 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, -+ 0x2c1c24b0, 0x350715f1, 0x1e2a4632, 0x07317773, -+ 0x4870e1b4, 0x516bd0f5, 0x7a468336, 0x635db277, -+ 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, 0xe0d7848d, -+ 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, -+ 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, -+ 0x674f9842, 0x7e54a903, 0x5579fac0, 0x4c62cb81, -+ 0x8138c51f, 0x9823f45e, 0xb30ea79d, 0xaa1596dc, -+ 0xe554001b, 0xfc4f315a, 0xd7626299, 0xce7953d8, -+ 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, -+ 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, -+ 0x5e7ef3ec, 0x4765c2ad, 0x6c48916e, 0x7553a02f, -+ 0x3a1236e8, 0x230907a9, 0x0824546a, 0x113f652b, -+ 0x96a779e4, 0x8fbc48a5, 0xa4911b66, 0xbd8a2a27, -+ 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, -+ 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, -+ 0x70d024b9, 0x69cb15f8, 0x42e6463b, 0x5bfd777a, -+ 0xdc656bb5, 0xc57e5af4, 0xee530937, 0xf7483876, -+ 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, 0x9324fd72, -+ 0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, -+ 0x0709a8dc, 0x06cbc2eb, 0x048d7cb2, 0x054f1685, -+ 0x0e1351b8, 0x0fd13b8f, 0x0d9785d6, 0x0c55efe1, -+ 0x091af964, 0x08d89353, 0x0a9e2d0a, 0x0b5c473d, -+ 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, -+ 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, -+ 0x1235f2c8, 0x13f798ff, 0x11b126a6, 0x10734c91, -+ 0x153c5a14, 0x14fe3023, 0x16b88e7a, 0x177ae44d, -+ 0x384d46e0, 0x398f2cd7, 0x3bc9928e, 0x3a0bf8b9, -+ 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, -+ 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, -+ 0x3157bf84, 0x3095d5b3, 0x32d36bea, 0x331101dd, -+ 0x246be590, 0x25a98fa7, 0x27ef31fe, 0x262d5bc9, -+ 0x23624d4c, 0x22a0277b, 0x20e69922, 0x2124f315, -+ 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, -+ 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, -+ 0x709a8dc0, 0x7158e7f7, 0x731e59ae, 0x72dc3399, -+ 0x7793251c, 0x76514f2b, 0x7417f172, 0x75d59b45, -+ 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, 0x7ccf6221, -+ 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, -+ 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, -+ 0x6bb5866c, 0x6a77ec5b, 0x68315202, 0x69f33835, -+ 0x62af7f08, 0x636d153f, 0x612bab66, 0x60e9c151, -+ 0x65a6d7d4, 0x6464bde3, 0x662203ba, 0x67e0698d, -+ 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, -+ 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, -+ 0x46c49a98, 0x4706f0af, 0x45404ef6, 0x448224c1, -+ 0x41cd3244, 0x400f5873, 0x4249e62a, 0x438b8c1d, -+ 0x54f16850, 0x55330267, 0x5775bc3e, 0x56b7d609, -+ 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, -+ 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, -+ 0x5deb9134, 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, -+ 0xe1351b80, 0xe0f771b7, 0xe2b1cfee, 0xe373a5d9, -+ 0xe63cb35c, 0xe7fed96b, 0xe5b86732, 0xe47a0d05, -+ 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, -+ 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, -+ 0xfd13b8f0, 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, -+ 0xfa1a102c, 0xfbd87a1b, 0xf99ec442, 0xf85cae75, -+ 0xf300e948, 0xf2c2837f, 0xf0843d26, 0xf1465711, -+ 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, -+ 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, -+ 0xde71f5bc, 0xdfb39f8b, 0xddf521d2, 0xdc374be5, -+ 0xd76b0cd8, 0xd6a966ef, 0xd4efd8b6, 0xd52db281, -+ 0xd062a404, 0xd1a0ce33, 0xd3e6706a, 0xd2241a5d, -+ 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, -+ 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, -+ 0xcb4dafa8, 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, -+ 0xcc440774, 0xcd866d43, 0xcfc0d31a, 0xce02b92d, -+ 0x91af9640, 0x906dfc77, 0x922b422e, 0x93e92819, -+ 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, -+ 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, -+ 0x98b56f24, 0x99770513, 0x9b31bb4a, 0x9af3d17d, -+ 0x8d893530, 0x8c4b5f07, 0x8e0de15e, 0x8fcf8b69, -+ 0x8a809dec, 0x8b42f7db, 0x89044982, 0x88c623b5, -+ 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, -+ 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, -+ 0xa9e2d0a0, 0xa820ba97, 0xaa6604ce, 0xaba46ef9, -+ 0xaeeb787c, 0xaf29124b, 0xad6fac12, 0xacadc625, -+ 0xa7f18118, 0xa633eb2f, 0xa4755576, 0xa5b73f41, -+ 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, -+ 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, -+ 0xb2cddb0c, 0xb30fb13b, 0xb1490f62, 0xb08b6555, -+ 0xbbd72268, 0xba15485f, 0xb853f606, 0xb9919c31, -+ 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, 0xbe9834ed, -+ 0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, -+ 0x8f629757, 0x37def032, 0x256b5fdc, 0x9dd738b9, -+ 0xc5b428ef, 0x7d084f8a, 0x6fbde064, 0xd7018701, -+ 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, 0x58631056, -+ 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, -+ 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, -+ 0x95ad7f70, 0x2d111815, 0x3fa4b7fb, 0x8718d09e, -+ 0x1acfe827, 0xa2738f42, 0xb0c620ac, 0x087a47c9, -+ 0xa032af3e, 0x188ec85b, 0x0a3b67b5, 0xb28700d0, -+ 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, -+ 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, -+ 0xeae41086, 0x525877e3, 0x40edd80d, 0xf851bf68, -+ 0xf02bf8a1, 0x48979fc4, 0x5a22302a, 0xe29e574f, -+ 0x7f496ff6, 0xc7f50893, 0xd540a77d, 0x6dfcc018, -+ 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, -+ 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, -+ 0x9b14583d, 0x23a83f58, 0x311d90b6, 0x89a1f7d3, -+ 0x1476cf6a, 0xaccaa80f, 0xbe7f07e1, 0x06c36084, -+ 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, 0x4c15df3c, -+ 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, -+ 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, -+ 0x446f98f5, 0xfcd3ff90, 0xee66507e, 0x56da371b, -+ 0x0eb9274d, 0xb6054028, 0xa4b0efc6, 0x1c0c88a3, -+ 0x81dbb01a, 0x3967d77f, 0x2bd27891, 0x936e1ff4, -+ 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, -+ 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, -+ 0xfe92dfec, 0x462eb889, 0x549b1767, 0xec277002, -+ 0x71f048bb, 0xc94c2fde, 0xdbf98030, 0x6345e755, -+ 0x6b3fa09c, 0xd383c7f9, 0xc1366817, 0x798a0f72, -+ 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, -+ 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, -+ 0x21e91f24, 0x99557841, 0x8be0d7af, 0x335cb0ca, -+ 0xed59b63b, 0x55e5d15e, 0x47507eb0, 0xffec19d5, -+ 0x623b216c, 0xda874609, 0xc832e9e7, 0x708e8e82, -+ 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, -+ 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, -+ 0xbd40e1a4, 0x05fc86c1, 0x1749292f, 0xaff54e4a, -+ 0x322276f3, 0x8a9e1196, 0x982bbe78, 0x2097d91d, -+ 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, 0x6a4166a5, -+ 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, -+ 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, -+ 0xc2098e52, 0x7ab5e937, 0x680046d9, 0xd0bc21bc, -+ 0x88df31ea, 0x3063568f, 0x22d6f961, 0x9a6a9e04, -+ 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, 0x15080953, -+ 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, -+ 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, -+ 0xd8c66675, 0x607a0110, 0x72cfaefe, 0xca73c99b, -+ 0x57a4f122, 0xef189647, 0xfdad39a9, 0x45115ecc, -+ 0x764dee06, 0xcef18963, 0xdc44268d, 0x64f841e8, -+ 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, -+ 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, -+ 0x3c9b51be, 0x842736db, 0x96929935, 0x2e2efe50, -+ 0x2654b999, 0x9ee8defc, 0x8c5d7112, 0x34e11677, -+ 0xa9362ece, 0x118a49ab, 0x033fe645, 0xbb838120, -+ 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, -+ 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, -+ 0xd67f4138, 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, -+ 0x591dd66f, 0xe1a1b10a, 0xf3141ee4, 0x4ba87981, -+ 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, 0x017ec639, -+ 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, -+ 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, -+ 0x090481f0, 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, -+ 0x43d23e48, 0xfb6e592d, 0xe9dbf6c3, 0x516791a6, -+ 0xccb0a91f, 0x740cce7a, 0x66b96194, 0xde0506f1 -+}; -+ - /* CRC32 */ - -+static inline u32 -+crc32_next (u32 crc, byte data) -+{ -+ return (crc >> 8) ^ crc32_table[(crc & 0xff) ^ data]; -+} -+ -+/* -+ * Process 4 bytes in one go -+ */ -+static inline u32 -+crc32_next4 (u32 crc, u32 data) -+{ -+ crc ^= data; -+ crc = crc32_table[(crc & 0xff) + 0x300] ^ -+ crc32_table[((crc >> 8) & 0xff) + 0x200] ^ -+ crc32_table[((crc >> 16) & 0xff) + 0x100] ^ -+ crc32_table[(crc >> 24) & 0xff]; -+ return crc; -+} -+ - static void - crc32_init (void *context) - { -@@ -156,12 +342,40 @@ crc32_init (void *context) - } - - static void --crc32_write (void *context, const void *inbuf, size_t inlen) -+crc32_write (void *context, const void *inbuf_arg, size_t inlen) - { - CRC_CONTEXT *ctx = (CRC_CONTEXT *) context; -- if (!inbuf) -+ const byte *inbuf = inbuf_arg; -+ u32 crc; -+ -+ if (!inbuf || !inlen) - return; -- ctx->CRC = update_crc32 (ctx->CRC, inbuf, inlen); -+ -+ crc = ctx->CRC; -+ -+ while (inlen >= 16) -+ { -+ inlen -= 16; -+ crc = crc32_next4(crc, buf_get_le32(&inbuf[0])); -+ crc = crc32_next4(crc, buf_get_le32(&inbuf[4])); -+ crc = crc32_next4(crc, buf_get_le32(&inbuf[8])); -+ crc = crc32_next4(crc, buf_get_le32(&inbuf[12])); -+ inbuf += 16; -+ } -+ -+ while (inlen >= 4) -+ { -+ inlen -= 4; -+ crc = crc32_next4(crc, buf_get_le32(inbuf)); -+ inbuf += 4; -+ } -+ -+ while (inlen--) -+ { -+ crc = crc32_next(crc, *inbuf++); -+ } -+ -+ ctx->CRC = crc; - } - - static byte * -@@ -176,13 +390,12 @@ crc32_final (void *context) - { - CRC_CONTEXT *ctx = (CRC_CONTEXT *) context; - ctx->CRC ^= 0xffffffffL; -- ctx->buf[0] = (ctx->CRC >> 24) & 0xFF; -- ctx->buf[1] = (ctx->CRC >> 16) & 0xFF; -- ctx->buf[2] = (ctx->CRC >> 8) & 0xFF; -- ctx->buf[3] = (ctx->CRC ) & 0xFF; -+ buf_put_be32 (ctx->buf, ctx->CRC); - } - - /* CRC32 a'la RFC 1510 */ -+/* CRC of the string "123456789" is 0x2dfd2d88 */ -+ - static void - crc32rfc1510_init (void *context) - { -@@ -194,82 +407,366 @@ static void - crc32rfc1510_final (void *context) - { - CRC_CONTEXT *ctx = (CRC_CONTEXT *) context; -- ctx->buf[0] = (ctx->CRC >> 24) & 0xFF; -- ctx->buf[1] = (ctx->CRC >> 16) & 0xFF; -- ctx->buf[2] = (ctx->CRC >> 8) & 0xFF; -- ctx->buf[3] = (ctx->CRC ) & 0xFF; -+ buf_put_be32(ctx->buf, ctx->CRC); - } - - /* CRC24 a'la RFC 2440 */ - /* -- * The following CRC 24 routines are adapted from RFC 2440, which has -- * the following copyright notice: -+ * Code generated by universal_crc by Danjel McGougan - * -- * Copyright (C) The Internet Society (1998). All Rights Reserved. -+ * CRC parameters used: -+ * bits: 24 -+ * poly: 0x864cfb -+ * init: 0xb704ce -+ * xor: 0x000000 -+ * reverse: false -+ * non-direct: false - * -- * This document and translations of it may be copied and furnished -- * to others, and derivative works that comment on or otherwise -- * explain it or assist in its implementation may be prepared, -- * copied, published and distributed, in whole or in part, without -- * restriction of any kind, provided that the above copyright notice -- * and this paragraph are included on all such copies and derivative -- * works. However, this document itself may not be modified in any -- * way, such as by removing the copyright notice or references to -- * the Internet Society or other Internet organizations, except as -- * needed for the purpose of developing Internet standards in which -- * case the procedures for copyrights defined in the Internet -- * Standards process must be followed, or as required to translate -- * it into languages other than English. -- * -- * The limited permissions granted above are perpetual and will not be -- * revoked by the Internet Society or its successors or assigns. -- * -- * This document and the information contained herein is provided on -- * an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET -- * ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR -- * IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE -- * OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY -- * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR -- * PURPOSE. -+ * CRC of the string "123456789" is 0x21cf02 -+ */ -+ -+static const u32 crc24_table[1024] = -+{ -+ 0x00000000, 0x00fb4c86, 0x000dd58a, 0x00f6990c, -+ 0x00e1e693, 0x001aaa15, 0x00ec3319, 0x00177f9f, -+ 0x003981a1, 0x00c2cd27, 0x0034542b, 0x00cf18ad, -+ 0x00d86732, 0x00232bb4, 0x00d5b2b8, 0x002efe3e, -+ 0x00894ec5, 0x00720243, 0x00849b4f, 0x007fd7c9, -+ 0x0068a856, 0x0093e4d0, 0x00657ddc, 0x009e315a, -+ 0x00b0cf64, 0x004b83e2, 0x00bd1aee, 0x00465668, -+ 0x005129f7, 0x00aa6571, 0x005cfc7d, 0x00a7b0fb, -+ 0x00e9d10c, 0x00129d8a, 0x00e40486, 0x001f4800, -+ 0x0008379f, 0x00f37b19, 0x0005e215, 0x00feae93, -+ 0x00d050ad, 0x002b1c2b, 0x00dd8527, 0x0026c9a1, -+ 0x0031b63e, 0x00cafab8, 0x003c63b4, 0x00c72f32, -+ 0x00609fc9, 0x009bd34f, 0x006d4a43, 0x009606c5, -+ 0x0081795a, 0x007a35dc, 0x008cacd0, 0x0077e056, -+ 0x00591e68, 0x00a252ee, 0x0054cbe2, 0x00af8764, -+ 0x00b8f8fb, 0x0043b47d, 0x00b52d71, 0x004e61f7, -+ 0x00d2a319, 0x0029ef9f, 0x00df7693, 0x00243a15, -+ 0x0033458a, 0x00c8090c, 0x003e9000, 0x00c5dc86, -+ 0x00eb22b8, 0x00106e3e, 0x00e6f732, 0x001dbbb4, -+ 0x000ac42b, 0x00f188ad, 0x000711a1, 0x00fc5d27, -+ 0x005beddc, 0x00a0a15a, 0x00563856, 0x00ad74d0, -+ 0x00ba0b4f, 0x004147c9, 0x00b7dec5, 0x004c9243, -+ 0x00626c7d, 0x009920fb, 0x006fb9f7, 0x0094f571, -+ 0x00838aee, 0x0078c668, 0x008e5f64, 0x007513e2, -+ 0x003b7215, 0x00c03e93, 0x0036a79f, 0x00cdeb19, -+ 0x00da9486, 0x0021d800, 0x00d7410c, 0x002c0d8a, -+ 0x0002f3b4, 0x00f9bf32, 0x000f263e, 0x00f46ab8, -+ 0x00e31527, 0x001859a1, 0x00eec0ad, 0x00158c2b, -+ 0x00b23cd0, 0x00497056, 0x00bfe95a, 0x0044a5dc, -+ 0x0053da43, 0x00a896c5, 0x005e0fc9, 0x00a5434f, -+ 0x008bbd71, 0x0070f1f7, 0x008668fb, 0x007d247d, -+ 0x006a5be2, 0x00911764, 0x00678e68, 0x009cc2ee, -+ 0x00a44733, 0x005f0bb5, 0x00a992b9, 0x0052de3f, -+ 0x0045a1a0, 0x00beed26, 0x0048742a, 0x00b338ac, -+ 0x009dc692, 0x00668a14, 0x00901318, 0x006b5f9e, -+ 0x007c2001, 0x00876c87, 0x0071f58b, 0x008ab90d, -+ 0x002d09f6, 0x00d64570, 0x0020dc7c, 0x00db90fa, -+ 0x00ccef65, 0x0037a3e3, 0x00c13aef, 0x003a7669, -+ 0x00148857, 0x00efc4d1, 0x00195ddd, 0x00e2115b, -+ 0x00f56ec4, 0x000e2242, 0x00f8bb4e, 0x0003f7c8, -+ 0x004d963f, 0x00b6dab9, 0x004043b5, 0x00bb0f33, -+ 0x00ac70ac, 0x00573c2a, 0x00a1a526, 0x005ae9a0, -+ 0x0074179e, 0x008f5b18, 0x0079c214, 0x00828e92, -+ 0x0095f10d, 0x006ebd8b, 0x00982487, 0x00636801, -+ 0x00c4d8fa, 0x003f947c, 0x00c90d70, 0x003241f6, -+ 0x00253e69, 0x00de72ef, 0x0028ebe3, 0x00d3a765, -+ 0x00fd595b, 0x000615dd, 0x00f08cd1, 0x000bc057, -+ 0x001cbfc8, 0x00e7f34e, 0x00116a42, 0x00ea26c4, -+ 0x0076e42a, 0x008da8ac, 0x007b31a0, 0x00807d26, -+ 0x009702b9, 0x006c4e3f, 0x009ad733, 0x00619bb5, -+ 0x004f658b, 0x00b4290d, 0x0042b001, 0x00b9fc87, -+ 0x00ae8318, 0x0055cf9e, 0x00a35692, 0x00581a14, -+ 0x00ffaaef, 0x0004e669, 0x00f27f65, 0x000933e3, -+ 0x001e4c7c, 0x00e500fa, 0x001399f6, 0x00e8d570, -+ 0x00c62b4e, 0x003d67c8, 0x00cbfec4, 0x0030b242, -+ 0x0027cddd, 0x00dc815b, 0x002a1857, 0x00d154d1, -+ 0x009f3526, 0x006479a0, 0x0092e0ac, 0x0069ac2a, -+ 0x007ed3b5, 0x00859f33, 0x0073063f, 0x00884ab9, -+ 0x00a6b487, 0x005df801, 0x00ab610d, 0x00502d8b, -+ 0x00475214, 0x00bc1e92, 0x004a879e, 0x00b1cb18, -+ 0x00167be3, 0x00ed3765, 0x001bae69, 0x00e0e2ef, -+ 0x00f79d70, 0x000cd1f6, 0x00fa48fa, 0x0001047c, -+ 0x002ffa42, 0x00d4b6c4, 0x00222fc8, 0x00d9634e, -+ 0x00ce1cd1, 0x00355057, 0x00c3c95b, 0x003885dd, -+ 0x00000000, 0x00488f66, 0x00901ecd, 0x00d891ab, -+ 0x00db711c, 0x0093fe7a, 0x004b6fd1, 0x0003e0b7, -+ 0x00b6e338, 0x00fe6c5e, 0x0026fdf5, 0x006e7293, -+ 0x006d9224, 0x00251d42, 0x00fd8ce9, 0x00b5038f, -+ 0x006cc771, 0x00244817, 0x00fcd9bc, 0x00b456da, -+ 0x00b7b66d, 0x00ff390b, 0x0027a8a0, 0x006f27c6, -+ 0x00da2449, 0x0092ab2f, 0x004a3a84, 0x0002b5e2, -+ 0x00015555, 0x0049da33, 0x00914b98, 0x00d9c4fe, -+ 0x00d88ee3, 0x00900185, 0x0048902e, 0x00001f48, -+ 0x0003ffff, 0x004b7099, 0x0093e132, 0x00db6e54, -+ 0x006e6ddb, 0x0026e2bd, 0x00fe7316, 0x00b6fc70, -+ 0x00b51cc7, 0x00fd93a1, 0x0025020a, 0x006d8d6c, -+ 0x00b44992, 0x00fcc6f4, 0x0024575f, 0x006cd839, -+ 0x006f388e, 0x0027b7e8, 0x00ff2643, 0x00b7a925, -+ 0x0002aaaa, 0x004a25cc, 0x0092b467, 0x00da3b01, -+ 0x00d9dbb6, 0x009154d0, 0x0049c57b, 0x00014a1d, -+ 0x004b5141, 0x0003de27, 0x00db4f8c, 0x0093c0ea, -+ 0x0090205d, 0x00d8af3b, 0x00003e90, 0x0048b1f6, -+ 0x00fdb279, 0x00b53d1f, 0x006dacb4, 0x002523d2, -+ 0x0026c365, 0x006e4c03, 0x00b6dda8, 0x00fe52ce, -+ 0x00279630, 0x006f1956, 0x00b788fd, 0x00ff079b, -+ 0x00fce72c, 0x00b4684a, 0x006cf9e1, 0x00247687, -+ 0x00917508, 0x00d9fa6e, 0x00016bc5, 0x0049e4a3, -+ 0x004a0414, 0x00028b72, 0x00da1ad9, 0x009295bf, -+ 0x0093dfa2, 0x00db50c4, 0x0003c16f, 0x004b4e09, -+ 0x0048aebe, 0x000021d8, 0x00d8b073, 0x00903f15, -+ 0x00253c9a, 0x006db3fc, 0x00b52257, 0x00fdad31, -+ 0x00fe4d86, 0x00b6c2e0, 0x006e534b, 0x0026dc2d, -+ 0x00ff18d3, 0x00b797b5, 0x006f061e, 0x00278978, -+ 0x002469cf, 0x006ce6a9, 0x00b47702, 0x00fcf864, -+ 0x0049fbeb, 0x0001748d, 0x00d9e526, 0x00916a40, -+ 0x00928af7, 0x00da0591, 0x0002943a, 0x004a1b5c, -+ 0x0096a282, 0x00de2de4, 0x0006bc4f, 0x004e3329, -+ 0x004dd39e, 0x00055cf8, 0x00ddcd53, 0x00954235, -+ 0x002041ba, 0x0068cedc, 0x00b05f77, 0x00f8d011, -+ 0x00fb30a6, 0x00b3bfc0, 0x006b2e6b, 0x0023a10d, -+ 0x00fa65f3, 0x00b2ea95, 0x006a7b3e, 0x0022f458, -+ 0x002114ef, 0x00699b89, 0x00b10a22, 0x00f98544, -+ 0x004c86cb, 0x000409ad, 0x00dc9806, 0x00941760, -+ 0x0097f7d7, 0x00df78b1, 0x0007e91a, 0x004f667c, -+ 0x004e2c61, 0x0006a307, 0x00de32ac, 0x0096bdca, -+ 0x00955d7d, 0x00ddd21b, 0x000543b0, 0x004dccd6, -+ 0x00f8cf59, 0x00b0403f, 0x0068d194, 0x00205ef2, -+ 0x0023be45, 0x006b3123, 0x00b3a088, 0x00fb2fee, -+ 0x0022eb10, 0x006a6476, 0x00b2f5dd, 0x00fa7abb, -+ 0x00f99a0c, 0x00b1156a, 0x006984c1, 0x00210ba7, -+ 0x00940828, 0x00dc874e, 0x000416e5, 0x004c9983, -+ 0x004f7934, 0x0007f652, 0x00df67f9, 0x0097e89f, -+ 0x00ddf3c3, 0x00957ca5, 0x004ded0e, 0x00056268, -+ 0x000682df, 0x004e0db9, 0x00969c12, 0x00de1374, -+ 0x006b10fb, 0x00239f9d, 0x00fb0e36, 0x00b38150, -+ 0x00b061e7, 0x00f8ee81, 0x00207f2a, 0x0068f04c, -+ 0x00b134b2, 0x00f9bbd4, 0x00212a7f, 0x0069a519, -+ 0x006a45ae, 0x0022cac8, 0x00fa5b63, 0x00b2d405, -+ 0x0007d78a, 0x004f58ec, 0x0097c947, 0x00df4621, -+ 0x00dca696, 0x009429f0, 0x004cb85b, 0x0004373d, -+ 0x00057d20, 0x004df246, 0x009563ed, 0x00ddec8b, -+ 0x00de0c3c, 0x0096835a, 0x004e12f1, 0x00069d97, -+ 0x00b39e18, 0x00fb117e, 0x002380d5, 0x006b0fb3, -+ 0x0068ef04, 0x00206062, 0x00f8f1c9, 0x00b07eaf, -+ 0x0069ba51, 0x00213537, 0x00f9a49c, 0x00b12bfa, -+ 0x00b2cb4d, 0x00fa442b, 0x0022d580, 0x006a5ae6, -+ 0x00df5969, 0x0097d60f, 0x004f47a4, 0x0007c8c2, -+ 0x00042875, 0x004ca713, 0x009436b8, 0x00dcb9de, -+ 0x00000000, 0x00d70983, 0x00555f80, 0x00825603, -+ 0x0051f286, 0x0086fb05, 0x0004ad06, 0x00d3a485, -+ 0x0059a88b, 0x008ea108, 0x000cf70b, 0x00dbfe88, -+ 0x00085a0d, 0x00df538e, 0x005d058d, 0x008a0c0e, -+ 0x00491c91, 0x009e1512, 0x001c4311, 0x00cb4a92, -+ 0x0018ee17, 0x00cfe794, 0x004db197, 0x009ab814, -+ 0x0010b41a, 0x00c7bd99, 0x0045eb9a, 0x0092e219, -+ 0x0041469c, 0x00964f1f, 0x0014191c, 0x00c3109f, -+ 0x006974a4, 0x00be7d27, 0x003c2b24, 0x00eb22a7, -+ 0x00388622, 0x00ef8fa1, 0x006dd9a2, 0x00bad021, -+ 0x0030dc2f, 0x00e7d5ac, 0x006583af, 0x00b28a2c, -+ 0x00612ea9, 0x00b6272a, 0x00347129, 0x00e378aa, -+ 0x00206835, 0x00f761b6, 0x007537b5, 0x00a23e36, -+ 0x00719ab3, 0x00a69330, 0x0024c533, 0x00f3ccb0, -+ 0x0079c0be, 0x00aec93d, 0x002c9f3e, 0x00fb96bd, -+ 0x00283238, 0x00ff3bbb, 0x007d6db8, 0x00aa643b, -+ 0x0029a4ce, 0x00fead4d, 0x007cfb4e, 0x00abf2cd, -+ 0x00785648, 0x00af5fcb, 0x002d09c8, 0x00fa004b, -+ 0x00700c45, 0x00a705c6, 0x002553c5, 0x00f25a46, -+ 0x0021fec3, 0x00f6f740, 0x0074a143, 0x00a3a8c0, -+ 0x0060b85f, 0x00b7b1dc, 0x0035e7df, 0x00e2ee5c, -+ 0x00314ad9, 0x00e6435a, 0x00641559, 0x00b31cda, -+ 0x003910d4, 0x00ee1957, 0x006c4f54, 0x00bb46d7, -+ 0x0068e252, 0x00bfebd1, 0x003dbdd2, 0x00eab451, -+ 0x0040d06a, 0x0097d9e9, 0x00158fea, 0x00c28669, -+ 0x001122ec, 0x00c62b6f, 0x00447d6c, 0x009374ef, -+ 0x001978e1, 0x00ce7162, 0x004c2761, 0x009b2ee2, -+ 0x00488a67, 0x009f83e4, 0x001dd5e7, 0x00cadc64, -+ 0x0009ccfb, 0x00dec578, 0x005c937b, 0x008b9af8, -+ 0x00583e7d, 0x008f37fe, 0x000d61fd, 0x00da687e, -+ 0x00506470, 0x00876df3, 0x00053bf0, 0x00d23273, -+ 0x000196f6, 0x00d69f75, 0x0054c976, 0x0083c0f5, -+ 0x00a9041b, 0x007e0d98, 0x00fc5b9b, 0x002b5218, -+ 0x00f8f69d, 0x002fff1e, 0x00ada91d, 0x007aa09e, -+ 0x00f0ac90, 0x0027a513, 0x00a5f310, 0x0072fa93, -+ 0x00a15e16, 0x00765795, 0x00f40196, 0x00230815, -+ 0x00e0188a, 0x00371109, 0x00b5470a, 0x00624e89, -+ 0x00b1ea0c, 0x0066e38f, 0x00e4b58c, 0x0033bc0f, -+ 0x00b9b001, 0x006eb982, 0x00ecef81, 0x003be602, -+ 0x00e84287, 0x003f4b04, 0x00bd1d07, 0x006a1484, -+ 0x00c070bf, 0x0017793c, 0x00952f3f, 0x004226bc, -+ 0x00918239, 0x00468bba, 0x00c4ddb9, 0x0013d43a, -+ 0x0099d834, 0x004ed1b7, 0x00cc87b4, 0x001b8e37, -+ 0x00c82ab2, 0x001f2331, 0x009d7532, 0x004a7cb1, -+ 0x00896c2e, 0x005e65ad, 0x00dc33ae, 0x000b3a2d, -+ 0x00d89ea8, 0x000f972b, 0x008dc128, 0x005ac8ab, -+ 0x00d0c4a5, 0x0007cd26, 0x00859b25, 0x005292a6, -+ 0x00813623, 0x00563fa0, 0x00d469a3, 0x00036020, -+ 0x0080a0d5, 0x0057a956, 0x00d5ff55, 0x0002f6d6, -+ 0x00d15253, 0x00065bd0, 0x00840dd3, 0x00530450, -+ 0x00d9085e, 0x000e01dd, 0x008c57de, 0x005b5e5d, -+ 0x0088fad8, 0x005ff35b, 0x00dda558, 0x000aacdb, -+ 0x00c9bc44, 0x001eb5c7, 0x009ce3c4, 0x004bea47, -+ 0x00984ec2, 0x004f4741, 0x00cd1142, 0x001a18c1, -+ 0x009014cf, 0x00471d4c, 0x00c54b4f, 0x001242cc, -+ 0x00c1e649, 0x0016efca, 0x0094b9c9, 0x0043b04a, -+ 0x00e9d471, 0x003eddf2, 0x00bc8bf1, 0x006b8272, -+ 0x00b826f7, 0x006f2f74, 0x00ed7977, 0x003a70f4, -+ 0x00b07cfa, 0x00677579, 0x00e5237a, 0x00322af9, -+ 0x00e18e7c, 0x003687ff, 0x00b4d1fc, 0x0063d87f, -+ 0x00a0c8e0, 0x0077c163, 0x00f59760, 0x00229ee3, -+ 0x00f13a66, 0x002633e5, 0x00a465e6, 0x00736c65, -+ 0x00f9606b, 0x002e69e8, 0x00ac3feb, 0x007b3668, -+ 0x00a892ed, 0x007f9b6e, 0x00fdcd6d, 0x002ac4ee, -+ 0x00000000, 0x00520936, 0x00a4126c, 0x00f61b5a, -+ 0x004825d8, 0x001a2cee, 0x00ec37b4, 0x00be3e82, -+ 0x006b0636, 0x00390f00, 0x00cf145a, 0x009d1d6c, -+ 0x002323ee, 0x00712ad8, 0x00873182, 0x00d538b4, -+ 0x00d60c6c, 0x0084055a, 0x00721e00, 0x00201736, -+ 0x009e29b4, 0x00cc2082, 0x003a3bd8, 0x006832ee, -+ 0x00bd0a5a, 0x00ef036c, 0x00191836, 0x004b1100, -+ 0x00f52f82, 0x00a726b4, 0x00513dee, 0x000334d8, -+ 0x00ac19d8, 0x00fe10ee, 0x00080bb4, 0x005a0282, -+ 0x00e43c00, 0x00b63536, 0x00402e6c, 0x0012275a, -+ 0x00c71fee, 0x009516d8, 0x00630d82, 0x003104b4, -+ 0x008f3a36, 0x00dd3300, 0x002b285a, 0x0079216c, -+ 0x007a15b4, 0x00281c82, 0x00de07d8, 0x008c0eee, -+ 0x0032306c, 0x0060395a, 0x00962200, 0x00c42b36, -+ 0x00111382, 0x00431ab4, 0x00b501ee, 0x00e708d8, -+ 0x0059365a, 0x000b3f6c, 0x00fd2436, 0x00af2d00, -+ 0x00a37f36, 0x00f17600, 0x00076d5a, 0x0055646c, -+ 0x00eb5aee, 0x00b953d8, 0x004f4882, 0x001d41b4, -+ 0x00c87900, 0x009a7036, 0x006c6b6c, 0x003e625a, -+ 0x00805cd8, 0x00d255ee, 0x00244eb4, 0x00764782, -+ 0x0075735a, 0x00277a6c, 0x00d16136, 0x00836800, -+ 0x003d5682, 0x006f5fb4, 0x009944ee, 0x00cb4dd8, -+ 0x001e756c, 0x004c7c5a, 0x00ba6700, 0x00e86e36, -+ 0x005650b4, 0x00045982, 0x00f242d8, 0x00a04bee, -+ 0x000f66ee, 0x005d6fd8, 0x00ab7482, 0x00f97db4, -+ 0x00474336, 0x00154a00, 0x00e3515a, 0x00b1586c, -+ 0x006460d8, 0x003669ee, 0x00c072b4, 0x00927b82, -+ 0x002c4500, 0x007e4c36, 0x0088576c, 0x00da5e5a, -+ 0x00d96a82, 0x008b63b4, 0x007d78ee, 0x002f71d8, -+ 0x00914f5a, 0x00c3466c, 0x00355d36, 0x00675400, -+ 0x00b26cb4, 0x00e06582, 0x00167ed8, 0x004477ee, -+ 0x00fa496c, 0x00a8405a, 0x005e5b00, 0x000c5236, -+ 0x0046ff6c, 0x0014f65a, 0x00e2ed00, 0x00b0e436, -+ 0x000edab4, 0x005cd382, 0x00aac8d8, 0x00f8c1ee, -+ 0x002df95a, 0x007ff06c, 0x0089eb36, 0x00dbe200, -+ 0x0065dc82, 0x0037d5b4, 0x00c1ceee, 0x0093c7d8, -+ 0x0090f300, 0x00c2fa36, 0x0034e16c, 0x0066e85a, -+ 0x00d8d6d8, 0x008adfee, 0x007cc4b4, 0x002ecd82, -+ 0x00fbf536, 0x00a9fc00, 0x005fe75a, 0x000dee6c, -+ 0x00b3d0ee, 0x00e1d9d8, 0x0017c282, 0x0045cbb4, -+ 0x00eae6b4, 0x00b8ef82, 0x004ef4d8, 0x001cfdee, -+ 0x00a2c36c, 0x00f0ca5a, 0x0006d100, 0x0054d836, -+ 0x0081e082, 0x00d3e9b4, 0x0025f2ee, 0x0077fbd8, -+ 0x00c9c55a, 0x009bcc6c, 0x006dd736, 0x003fde00, -+ 0x003cead8, 0x006ee3ee, 0x0098f8b4, 0x00caf182, -+ 0x0074cf00, 0x0026c636, 0x00d0dd6c, 0x0082d45a, -+ 0x0057ecee, 0x0005e5d8, 0x00f3fe82, 0x00a1f7b4, -+ 0x001fc936, 0x004dc000, 0x00bbdb5a, 0x00e9d26c, -+ 0x00e5805a, 0x00b7896c, 0x00419236, 0x00139b00, -+ 0x00ada582, 0x00ffacb4, 0x0009b7ee, 0x005bbed8, -+ 0x008e866c, 0x00dc8f5a, 0x002a9400, 0x00789d36, -+ 0x00c6a3b4, 0x0094aa82, 0x0062b1d8, 0x0030b8ee, -+ 0x00338c36, 0x00618500, 0x00979e5a, 0x00c5976c, -+ 0x007ba9ee, 0x0029a0d8, 0x00dfbb82, 0x008db2b4, -+ 0x00588a00, 0x000a8336, 0x00fc986c, 0x00ae915a, -+ 0x0010afd8, 0x0042a6ee, 0x00b4bdb4, 0x00e6b482, -+ 0x00499982, 0x001b90b4, 0x00ed8bee, 0x00bf82d8, -+ 0x0001bc5a, 0x0053b56c, 0x00a5ae36, 0x00f7a700, -+ 0x00229fb4, 0x00709682, 0x00868dd8, 0x00d484ee, -+ 0x006aba6c, 0x0038b35a, 0x00cea800, 0x009ca136, -+ 0x009f95ee, 0x00cd9cd8, 0x003b8782, 0x00698eb4, -+ 0x00d7b036, 0x0085b900, 0x0073a25a, 0x0021ab6c, -+ 0x00f493d8, 0x00a69aee, 0x005081b4, 0x00028882, -+ 0x00bcb600, 0x00eebf36, 0x0018a46c, 0x004aad5a -+}; -+ -+static inline -+u32 crc24_init (void) -+{ -+ return 0xce04b7; -+} -+ -+static inline -+u32 crc24_next (u32 crc, byte data) -+{ -+ return (crc >> 8) ^ crc24_table[(crc & 0xff) ^ data]; -+} -+ -+/* -+ * Process 4 bytes in one go - */ -+static inline -+u32 crc24_next4 (u32 crc, u32 data) -+{ -+ crc ^= data; -+ crc = crc24_table[(crc & 0xff) + 0x300] ^ -+ crc24_table[((crc >> 8) & 0xff) + 0x200] ^ -+ crc24_table[((crc >> 16) & 0xff) + 0x100] ^ -+ crc24_table[(crc >> 24) & 0xff]; -+ return crc; -+} - --#define CRC24_INIT 0xb704ceL --#define CRC24_POLY 0x1864cfbL -+static inline -+u32 crc24_final (u32 crc) -+{ -+ return crc & 0xffffff; -+} - - static void - crc24rfc2440_init (void *context) - { - CRC_CONTEXT *ctx = (CRC_CONTEXT *) context; -- ctx->CRC = CRC24_INIT; -+ ctx->CRC = crc24_init(); - } - - static void - crc24rfc2440_write (void *context, const void *inbuf_arg, size_t inlen) - { - const unsigned char *inbuf = inbuf_arg; -- int i; - CRC_CONTEXT *ctx = (CRC_CONTEXT *) context; -+ u32 crc; - -- if (!inbuf) -+ if (!inbuf || !inlen) - return; - -- while (inlen--) { -- ctx->CRC ^= (*inbuf++) << 16; -- for (i = 0; i < 8; i++) { -- ctx->CRC <<= 1; -- if (ctx->CRC & 0x1000000) -- ctx->CRC ^= CRC24_POLY; -+ crc = ctx->CRC; -+ -+ while (inlen >= 16) -+ { -+ inlen -= 16; -+ crc = crc24_next4(crc, buf_get_le32(&inbuf[0])); -+ crc = crc24_next4(crc, buf_get_le32(&inbuf[4])); -+ crc = crc24_next4(crc, buf_get_le32(&inbuf[8])); -+ crc = crc24_next4(crc, buf_get_le32(&inbuf[12])); -+ inbuf += 16; - } -- } -+ -+ while (inlen >= 4) -+ { -+ inlen -= 4; -+ crc = crc24_next4(crc, buf_get_le32(inbuf)); -+ inbuf += 4; -+ } -+ -+ while (inlen--) -+ { -+ crc = crc24_next(crc, *inbuf++); -+ } -+ -+ ctx->CRC = crc; - } - - static void - crc24rfc2440_final (void *context) - { - CRC_CONTEXT *ctx = (CRC_CONTEXT *) context; -- ctx->buf[0] = (ctx->CRC >> 16) & 0xFF; -- ctx->buf[1] = (ctx->CRC >> 8) & 0xFF; -- ctx->buf[2] = (ctx->CRC ) & 0xFF; -+ ctx->CRC = crc24_final(ctx->CRC); -+ buf_put_le32 (ctx->buf, ctx->CRC); - } - - gcry_md_spec_t _gcry_digest_spec_crc32 = -diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c -index 5b39f02bb2e592d85639891db6eb68a97ce12dfa..b4f609d2d01184b8d0a3e5aff448725f80a36a93 100644 ---- a/grub-core/loader/arm/linux.c -+++ b/grub-core/loader/arm/linux.c -@@ -42,21 +42,18 @@ static grub_size_t linux_size; - static char *linux_args; - - static grub_uint32_t machine_type; --static void *fdt_addr; -+static const void *current_fdt; - - typedef void (*kernel_entry_t) (int, unsigned long, void *); - --#define LINUX_ZIMAGE_OFFSET 0x24 --#define LINUX_ZIMAGE_MAGIC 0x016f2818 -- - #define LINUX_PHYS_OFFSET (0x00008000) - #define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000) - #define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000) - - static grub_size_t --get_atag_size (grub_uint32_t *atag) -+get_atag_size (const grub_uint32_t *atag) - { -- grub_uint32_t *atag0 = atag; -+ const grub_uint32_t *atag0 = atag; - while (atag[0] && atag[1]) - atag += atag[0]; - return atag - atag0; -@@ -68,10 +65,11 @@ get_atag_size (grub_uint32_t *atag) - * Merges in command line parameters and sets up initrd addresses. - */ - static grub_err_t --linux_prepare_atag (void) -+linux_prepare_atag (void *target_atag) - { -- grub_uint32_t *atag_orig = (grub_uint32_t *) fdt_addr; -- grub_uint32_t *tmp_atag, *from, *to; -+ const grub_uint32_t *atag_orig = (const grub_uint32_t *) current_fdt; -+ grub_uint32_t *tmp_atag, *to; -+ const grub_uint32_t *from; - grub_size_t tmp_size; - grub_size_t arg_size = grub_strlen (linux_args); - char *cmdline_orig = NULL; -@@ -142,7 +140,7 @@ linux_prepare_atag (void) - to += 2; - - /* Copy updated FDT to its launch location */ -- grub_memcpy (atag_orig, tmp_atag, sizeof (grub_uint32_t) * (to - tmp_atag)); -+ grub_memcpy (target_atag, tmp_atag, sizeof (grub_uint32_t) * (to - tmp_atag)); - grub_free (tmp_atag); - - grub_dprintf ("loader", "ATAG updated for Linux boot\n"); -@@ -156,19 +154,19 @@ linux_prepare_atag (void) - * Merges in command line parameters and sets up initrd addresses. - */ - static grub_err_t --linux_prepare_fdt (void) -+linux_prepare_fdt (void *target_fdt) - { - int node; - int retval; - int tmp_size; - void *tmp_fdt; - -- tmp_size = grub_fdt_get_totalsize (fdt_addr) + 0x100 + grub_strlen (linux_args); -+ tmp_size = grub_fdt_get_totalsize (current_fdt) + 0x100 + grub_strlen (linux_args); - tmp_fdt = grub_malloc (tmp_size); - if (!tmp_fdt) - return grub_errno; - -- grub_memcpy (tmp_fdt, fdt_addr, grub_fdt_get_totalsize (fdt_addr)); -+ grub_memcpy (tmp_fdt, current_fdt, grub_fdt_get_totalsize (current_fdt)); - grub_fdt_set_totalsize (tmp_fdt, tmp_size); - - /* Find or create '/chosen' node */ -@@ -209,7 +207,7 @@ linux_prepare_fdt (void) - } - - /* Copy updated FDT to its launch location */ -- grub_memcpy (fdt_addr, tmp_fdt, tmp_size); -+ grub_memcpy (target_fdt, tmp_fdt, tmp_size); - grub_free (tmp_fdt); - - grub_dprintf ("loader", "FDT updated for Linux boot\n"); -@@ -226,16 +224,17 @@ linux_boot (void) - { - kernel_entry_t linuxmain; - int fdt_valid, atag_valid; -+ void *target_fdt = 0; - -- fdt_valid = (fdt_addr && grub_fdt_check_header_nosize (fdt_addr) == 0); -- atag_valid = ((((grub_uint16_t *) fdt_addr)[3] & ~3) == 0x5440 -- && *((grub_uint32_t *) fdt_addr)); -+ fdt_valid = (current_fdt && grub_fdt_check_header_nosize (current_fdt) == 0); -+ atag_valid = ((((const grub_uint16_t *) current_fdt)[3] & ~3) == 0x5440 -+ && *((const grub_uint32_t *) current_fdt)); - grub_dprintf ("loader", "atag: %p, %x, %x, %s, %s\n", -- fdt_addr, -- ((grub_uint16_t *) fdt_addr)[3], -- *((grub_uint32_t *) fdt_addr), -- (char *) fdt_addr, -- (char *) fdt_addr + 1); -+ current_fdt, -+ ((const grub_uint16_t *) current_fdt)[3], -+ *((const grub_uint32_t *) current_fdt), -+ (const char *) current_fdt, -+ (const char *) current_fdt + 1); - - if (!fdt_valid && machine_type == GRUB_ARM_MACHINE_TYPE_FDT) - return grub_error (GRUB_ERR_FILE_NOT_FOUND, -@@ -245,23 +244,40 @@ linux_boot (void) - - grub_dprintf ("loader", "Kernel at: 0x%x\n", linux_addr); - -+ if (fdt_valid || atag_valid) -+ { -+#ifdef GRUB_MACHINE_EFI -+ grub_size_t size; -+ if (fdt_valid) -+ size = grub_fdt_get_totalsize (current_fdt); -+ else -+ size = 4 * get_atag_size (current_fdt); -+ size += grub_strlen (linux_args) + 256; -+ target_fdt = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size); -+ if (!target_fdt) -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -+#else -+ target_fdt = (void *) LINUX_FDT_ADDRESS; -+#endif -+ } -+ - if (fdt_valid) - { - grub_err_t err; - -- err = linux_prepare_fdt (); -+ err = linux_prepare_fdt (target_fdt); - if (err) - return err; -- grub_dprintf ("loader", "FDT @ 0x%p\n", fdt_addr); -+ grub_dprintf ("loader", "FDT @ %p\n", target_fdt); - } - else if (atag_valid) - { - grub_err_t err; - -- err = linux_prepare_atag (); -+ err = linux_prepare_atag (target_fdt); - if (err) - return err; -- grub_dprintf ("loader", "ATAG @ 0x%p\n", fdt_addr); -+ grub_dprintf ("loader", "ATAG @ %p\n", target_fdt); - } - - grub_dprintf ("loader", "Jumping to Linux...\n"); -@@ -274,18 +290,9 @@ linux_boot (void) - */ - linuxmain = (kernel_entry_t) linux_addr; - --#ifdef GRUB_MACHINE_EFI -- { -- grub_err_t err; -- err = grub_efi_prepare_platform(); -- if (err != GRUB_ERR_NONE) -- return err; -- } --#endif -- - grub_arm_disable_caches_mmu (); - -- linuxmain (0, machine_type, fdt_addr); -+ linuxmain (0, machine_type, target_fdt); - - return grub_error (GRUB_ERR_BAD_OS, "Linux call returned"); - } -@@ -296,17 +303,12 @@ linux_boot (void) - static grub_err_t - linux_load (const char *filename, grub_file_t file) - { -+ struct linux_arm_kernel_header *lh; - int size; - - size = grub_file_size (file); - --#ifdef GRUB_MACHINE_EFI -- linux_addr = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_PHYS_OFFSET, size); -- if (!linux_addr) -- return grub_errno; --#else - linux_addr = LINUX_ADDRESS; --#endif - grub_dprintf ("loader", "Loading Linux to 0x%08x\n", - (grub_addr_t) linux_addr); - -@@ -318,9 +320,10 @@ linux_load (const char *filename, grub_file_t file) - return grub_errno; - } - -- if (size > LINUX_ZIMAGE_OFFSET + 4 -- && *(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET) -- == LINUX_ZIMAGE_MAGIC) -+ lh = (void *) linux_addr; -+ -+ if ((grub_size_t) size > sizeof (*lh) && -+ lh->magic == GRUB_LINUX_ARM_MAGIC_SIGNATURE) - ; - else if (size > 0x8000 && *(grub_uint32_t *) (linux_addr) == 0xea000006 - && machine_type == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI) -@@ -410,20 +413,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - - size = grub_get_initrd_size (&initrd_ctx); - --#ifdef GRUB_MACHINE_EFI -- if (initrd_start) -- grub_efi_free_pages (initrd_start, -- (initrd_end - initrd_start + 0xfff) >> 12); -- initrd_start = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_INITRD_PHYS_OFFSET, size); -- -- if (!initrd_start) -- { -- grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -- goto fail; -- } --#else - initrd_start = LINUX_INITRD_ADDRESS; --#endif - - grub_dprintf ("loader", "Loading initrd to 0x%08x\n", - (grub_addr_t) initrd_start); -@@ -444,11 +434,26 @@ fail: - static grub_err_t - load_dtb (grub_file_t dtb, int size) - { -- if ((grub_file_read (dtb, fdt_addr, size) != size) -- || (grub_fdt_check_header (fdt_addr, size) != 0)) -- return grub_error (GRUB_ERR_BAD_OS, N_("invalid device tree")); -+ void *new_fdt = grub_zalloc (size); -+ if (!new_fdt) -+ return grub_errno; -+ grub_dprintf ("loader", "Loading device tree to %p\n", -+ new_fdt); -+ if ((grub_file_read (dtb, new_fdt, size) != size) -+ || (grub_fdt_check_header (new_fdt, size) != 0)) -+ { -+ grub_free (new_fdt); -+ return grub_error (GRUB_ERR_BAD_OS, N_("invalid device tree")); -+ } -+ -+ grub_fdt_set_totalsize (new_fdt, size); -+ current_fdt = new_fdt; -+ /* -+ * We've successfully loaded an FDT, so any machine type passed -+ * from firmware is now obsolete. -+ */ -+ machine_type = GRUB_ARM_MACHINE_TYPE_FDT; - -- grub_fdt_set_totalsize (fdt_addr, size); - return GRUB_ERR_NONE; - } - -@@ -464,42 +469,13 @@ grub_cmd_devicetree (grub_command_t cmd __attribute__ ((unused)), - - dtb = grub_file_open (argv[0]); - if (!dtb) -- goto out; -+ return grub_errno; - - size = grub_file_size (dtb); - if (size == 0) -- { -- grub_error (GRUB_ERR_BAD_OS, "empty file"); -- goto out; -- } -- --#ifdef GRUB_MACHINE_EFI -- fdt_addr = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size); -- if (!fdt_addr) -- { -- grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -- goto out; -- } --#else -- fdt_addr = (void *) LINUX_FDT_ADDRESS; --#endif -- -- grub_dprintf ("loader", "Loading device tree to 0x%08x\n", -- (grub_addr_t) fdt_addr); -- load_dtb (dtb, size); -- if (grub_errno != GRUB_ERR_NONE) -- { -- fdt_addr = NULL; -- goto out; -- } -- -- /* -- * We've successfully loaded an FDT, so any machine type passed -- * from firmware is now obsolete. -- */ -- machine_type = GRUB_ARM_MACHINE_TYPE_FDT; -- -- out: -+ grub_error (GRUB_ERR_BAD_OS, "empty file"); -+ else -+ load_dtb (dtb, size); - grub_file_close (dtb); - - return grub_errno; -@@ -517,7 +493,7 @@ GRUB_MOD_INIT (linux) - /* TRANSLATORS: DTB stands for device tree blob. */ - 0, N_("Load DTB file.")); - my_mod = mod; -- fdt_addr = (void *) grub_arm_firmware_get_boot_data (); -+ current_fdt = (const void *) grub_arm_firmware_get_boot_data (); - machine_type = grub_arm_firmware_get_machine_type (); - } - -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 9519d2e4d3ec1229a76eb4bce773c78c7af24a6e..1f86229f86b01e4700bb13c9f936490ea9ac859f 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -26,8 +26,9 @@ - #include - #include - #include --#include - #include -+#include -+#include - #include - #include - #include -@@ -47,18 +48,16 @@ static grub_addr_t initrd_start; - static grub_addr_t initrd_end; - - grub_err_t --grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header * lh) -+grub_armxx_efi_linux_check_image (struct linux_armxx_kernel_header * lh) - { -- if (lh->magic != GRUB_ARM64_LINUX_MAGIC) -+ if (lh->magic != GRUB_LINUX_ARMXX_MAGIC_SIGNATURE) - return grub_error(GRUB_ERR_BAD_OS, "invalid magic number"); - -- if ((lh->code0 & 0xffff) != GRUB_EFI_PE_MAGIC) -+ 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")); - - grub_dprintf ("linux", "UEFI stub kernel:\n"); -- grub_dprintf ("linux", "text_offset = 0x%012llx\n", -- (long long unsigned) lh->text_offset); - grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset); - - return GRUB_ERR_NONE; -@@ -86,8 +85,8 @@ finalize_params_linux (void) - /* Set initrd info */ - if (initrd_start && initrd_end > initrd_start) - { -- grub_dprintf ("linux", "Initrd @ 0x%012lx-0x%012lx\n", -- initrd_start, initrd_end); -+ grub_dprintf ("linux", "Initrd @ %p-%p\n", -+ (void *) initrd_start, (void *) initrd_end); - - retval = grub_fdt_set_prop64 (fdt, node, "linux,initrd-start", - initrd_start); -@@ -110,7 +109,7 @@ failure: - } - - grub_err_t --grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, char *args) -+grub_armxx_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) - { - grub_efi_memory_mapped_device_path_t *mempath; - grub_efi_handle_t image_handle; -@@ -148,8 +147,7 @@ grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, char *args) - loaded_image->load_options_size = len = - (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t); - loaded_image->load_options = -- grub_efi_allocate_pages (0, -- GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); -+ grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); - if (!loaded_image->load_options) - return grub_errno; - -@@ -162,7 +160,7 @@ grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, char *args) - - /* When successful, not reached */ - b->unload_image (image_handle); -- grub_efi_free_pages ((grub_efi_physical_address_t) loaded_image->load_options, -+ grub_efi_free_pages ((grub_addr_t) loaded_image->load_options, - GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); - - return grub_errno; -@@ -174,8 +172,8 @@ grub_linux_boot (void) - if (finalize_params_linux () != GRUB_ERR_NONE) - return grub_errno; - -- return (grub_arm64_uefi_boot_image((grub_addr_t)kernel_addr, -- kernel_size, linux_args)); -+ return (grub_armxx_efi_linux_boot_image((grub_addr_t)kernel_addr, -+ kernel_size, linux_args)); - } - - static grub_err_t -@@ -189,12 +187,48 @@ grub_linux_unload (void) - initrd_start = initrd_end = 0; - grub_free (linux_args); - if (kernel_addr) -- grub_efi_free_pages ((grub_efi_physical_address_t) kernel_addr, -+ grub_efi_free_pages ((grub_addr_t) kernel_addr, - GRUB_EFI_BYTES_TO_PAGES (kernel_size)); - grub_fdt_unload (); - return GRUB_ERR_NONE; - } - -+/* -+ * As per linux/Documentation/arm/Booting -+ * ARM initrd needs to be covered by kernel linear mapping, -+ * so place it in the first 512MB of DRAM. -+ * -+ * As per linux/Documentation/arm64/booting.txt -+ * ARM64 initrd needs to be contained entirely within a 1GB aligned window -+ * of up to 32GB of size that covers the kernel image as well. -+ * Since the EFI stub loader will attempt to load the kernel near start of -+ * RAM, place the buffer in the first 32GB of RAM. -+ */ -+#ifdef __arm__ -+#define INITRD_MAX_ADDRESS_OFFSET (512U * 1024 * 1024) -+#else /* __aarch64__ */ -+#define INITRD_MAX_ADDRESS_OFFSET (32ULL * 1024 * 1024 * 1024) -+#endif -+ -+/* -+ * This function returns a pointer to a legally allocated initrd buffer, -+ * or NULL if unsuccessful -+ */ -+static void * -+allocate_initrd_mem (int initrd_pages) -+{ -+ grub_addr_t max_addr; -+ -+ if (grub_efi_get_ram_base (&max_addr) != GRUB_ERR_NONE) -+ return NULL; -+ -+ max_addr += INITRD_MAX_ADDRESS_OFFSET - 1; -+ -+ return grub_efi_allocate_pages_real (max_addr, initrd_pages, -+ GRUB_EFI_ALLOCATE_MAX_ADDRESS, -+ GRUB_EFI_LOADER_DATA); -+} -+ - static grub_err_t - grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) -@@ -223,7 +257,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - grub_dprintf ("linux", "Loading initrd\n"); - - initrd_pages = (GRUB_EFI_BYTES_TO_PAGES (initrd_size)); -- initrd_mem = grub_efi_allocate_pages (0, initrd_pages); -+ initrd_mem = allocate_initrd_mem (initrd_pages); -+ - if (!initrd_mem) - { - grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -@@ -241,8 +276,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - fail: - grub_initrd_close (&initrd_ctx); - if (initrd_mem && !initrd_start) -- grub_efi_free_pages ((grub_efi_physical_address_t) initrd_mem, -- initrd_pages); -+ grub_efi_free_pages ((grub_addr_t) initrd_mem, initrd_pages); - - return grub_errno; - } -@@ -252,7 +286,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { - grub_file_t file = 0; -- struct grub_arm64_linux_kernel_header lh; -+ struct linux_armxx_kernel_header lh; - - grub_dl_ref (my_mod); - -@@ -271,13 +305,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh)) - return grub_errno; - -- if (grub_arm64_uefi_check_image (&lh) != GRUB_ERR_NONE) -+ if (grub_armxx_efi_linux_check_image (&lh) != GRUB_ERR_NONE) - goto fail; - - grub_loader_unset(); - - grub_dprintf ("linux", "kernel file size: %lld\n", (long long) kernel_size); -- kernel_addr = grub_efi_allocate_pages (0, GRUB_EFI_BYTES_TO_PAGES (kernel_size)); -+ kernel_addr = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (kernel_size)); - grub_dprintf ("linux", "kernel numpages: %lld\n", - (long long) GRUB_EFI_BYTES_TO_PAGES (kernel_size)); - if (!kernel_addr) -@@ -329,7 +363,7 @@ fail: - grub_free (linux_args); - - if (kernel_addr && !loaded) -- grub_efi_free_pages ((grub_efi_physical_address_t) kernel_addr, -+ grub_efi_free_pages ((grub_addr_t) kernel_addr, - GRUB_EFI_BYTES_TO_PAGES (kernel_size)); - - return grub_errno; -diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c -index a914eb8e2df24ebaab41a2eb0ed205bcebafcf5d..1003a0b9997a46ea7e5106da02ef77e9be3a21fc 100644 ---- a/grub-core/loader/arm64/xen_boot.c -+++ b/grub-core/loader/arm64/xen_boot.c -@@ -27,9 +27,10 @@ - #include - #include - #include --#include - #include - #include -+#include -+#include - #include /* required by struct xen_hypervisor_header */ - #include - #include -@@ -66,7 +67,7 @@ typedef enum module_type module_type_t; - - struct xen_hypervisor_header - { -- struct grub_arm64_linux_kernel_header efi_head; -+ struct linux_arm64_kernel_header efi_head; - - /* This is always PE\0\0. */ - grub_uint8_t signature[GRUB_PE32_SIGNATURE_SIZE]; -@@ -115,6 +116,17 @@ prepare_xen_hypervisor_params (void *xen_boot_fdt) - if (chosen_node < 1) - return grub_error (GRUB_ERR_IO, "failed to get chosen node in FDT"); - -+ /* -+ * The address and size are always written using 64-bits value. Set -+ * #address-cells and #size-cells accordingly. -+ */ -+ retval = grub_fdt_set_prop32 (xen_boot_fdt, chosen_node, "#address-cells", 2); -+ if (retval) -+ return grub_error (GRUB_ERR_IO, "failed to set #address-cells"); -+ retval = grub_fdt_set_prop32 (xen_boot_fdt, chosen_node, "#size-cells", 2); -+ if (retval) -+ return grub_error (GRUB_ERR_IO, "failed to set #size-cells"); -+ - grub_dprintf ("xen_loader", - "Xen Hypervisor cmdline : %s @ %p size:%d\n", - xen_hypervisor->cmdline, xen_hypervisor->cmdline, -@@ -156,7 +168,7 @@ prepare_xen_module_params (struct xen_boot_binary *module, void *xen_boot_fdt) - grub_fdt_add_subnode (xen_boot_fdt, chosen_node, module_name); - - retval = grub_fdt_set_prop (xen_boot_fdt, module_node, "compatible", -- MODULE_CUSTOM_COMPATIBLE, sizeof(MODULE_CUSTOM_COMPATIBLE) - 1); -+ MODULE_CUSTOM_COMPATIBLE, sizeof(MODULE_CUSTOM_COMPATIBLE)); - if (retval) - return grub_error (GRUB_ERR_IO, "failed to update FDT"); - -@@ -253,9 +265,9 @@ xen_boot (void) - if (err) - return err; - -- return grub_arm64_uefi_boot_image (xen_hypervisor->start, -- xen_hypervisor->size, -- xen_hypervisor->cmdline); -+ return grub_armxx_efi_linux_boot_image (xen_hypervisor->start, -+ xen_hypervisor->size, -+ xen_hypervisor->cmdline); - } - - static void -@@ -324,10 +336,9 @@ xen_boot_binary_load (struct xen_boot_binary *binary, grub_file_t file, - grub_dprintf ("xen_loader", "Xen_boot file size: 0x%lx\n", binary->size); - - binary->start -- = (grub_addr_t) grub_efi_allocate_pages (0, -- GRUB_EFI_BYTES_TO_PAGES -- (binary->size + -- binary->align)); -+ = (grub_addr_t) grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES -+ (binary->size + -+ binary->align)); - if (!binary->start) - { - grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -@@ -379,6 +390,20 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)), - - struct xen_boot_binary *module = NULL; - grub_file_t file = 0; -+ int nounzip = 0; -+ -+ if (!argc) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -+ goto fail; -+ } -+ -+ if (grub_strcmp (argv[0], "--nounzip") == 0) -+ { -+ argv++; -+ argc--; -+ nounzip = 1; -+ } - - if (!argc) - { -@@ -403,6 +428,8 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)), - - grub_dprintf ("xen_loader", "Init module and node info\n"); - -+ if (nounzip) -+ grub_file_filter_disable_compression (); - file = grub_file_open (argv[0]); - if (!file) - goto fail; -@@ -441,8 +468,8 @@ grub_cmd_xen_hypervisor (grub_command_t cmd __attribute__ ((unused)), - - if (grub_file_read (file, &sh, sizeof (sh)) != (long) sizeof (sh)) - goto fail; -- if (grub_arm64_uefi_check_image -- ((struct grub_arm64_linux_kernel_header *) &sh) != GRUB_ERR_NONE) -+ if (grub_armxx_efi_linux_check_image -+ ((struct linux_armxx_kernel_header *) &sh) != GRUB_ERR_NONE) - goto fail; - grub_file_seek (file, 0); - -diff --git a/grub-core/loader/arm64/fdt.c b/grub-core/loader/efi/fdt.c -similarity index 79% -rename from grub-core/loader/arm64/fdt.c -rename to grub-core/loader/efi/fdt.c -index db49cf64991764686c3f643e5289abbd4874a559..a4c6e8036454c1a53deefad791133488281462ea 100644 ---- a/grub-core/loader/arm64/fdt.c -+++ b/grub-core/loader/efi/fdt.c -@@ -18,26 +18,33 @@ - - #include - #include --#include - #include - #include - #include - #include - #include -+#include -+#include - - static void *loaded_fdt; - static void *fdt; - -+#define FDT_ADDR_CELLS_STRING "#address-cells" -+#define FDT_SIZE_CELLS_STRING "#size-cells" -+#define FDT_ADDR_SIZE_EXTRA ((2 * grub_fdt_prop_entry_size (sizeof(grub_uint32_t))) + \ -+ sizeof (FDT_ADDR_CELLS_STRING) + \ -+ sizeof (FDT_SIZE_CELLS_STRING)) -+ - void * - grub_fdt_load (grub_size_t additional_size) - { - void *raw_fdt; -- grub_size_t size; -+ unsigned int size; - - if (fdt) - { - size = GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt)); -- grub_efi_free_pages ((grub_efi_physical_address_t) fdt, size); -+ grub_efi_free_pages ((grub_addr_t) fdt, size); - } - - if (loaded_fdt) -@@ -45,12 +52,15 @@ grub_fdt_load (grub_size_t additional_size) - else - raw_fdt = grub_efi_get_firmware_fdt(); - -- size = -- raw_fdt ? grub_fdt_get_totalsize (raw_fdt) : GRUB_FDT_EMPTY_TREE_SZ; -+ if (raw_fdt) -+ size = grub_fdt_get_totalsize (raw_fdt); -+ else -+ size = GRUB_FDT_EMPTY_TREE_SZ + FDT_ADDR_SIZE_EXTRA; -+ - size += additional_size; - -- grub_dprintf ("linux", "allocating %ld bytes for fdt\n", size); -- fdt = grub_efi_allocate_pages (0, GRUB_EFI_BYTES_TO_PAGES (size)); -+ grub_dprintf ("linux", "allocating %d bytes for fdt\n", size); -+ fdt = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (size)); - if (!fdt) - return NULL; - -@@ -62,6 +72,8 @@ grub_fdt_load (grub_size_t additional_size) - else - { - grub_fdt_create_empty_tree (fdt, size); -+ grub_fdt_set_prop32 (fdt, 0, FDT_ADDR_CELLS_STRING, 2); -+ grub_fdt_set_prop32 (fdt, 0, FDT_SIZE_CELLS_STRING, 2); - } - return fdt; - } -@@ -88,7 +100,7 @@ grub_fdt_unload (void) { - if (!fdt) { - return; - } -- grub_efi_free_pages ((grub_efi_physical_address_t) fdt, -+ grub_efi_free_pages ((grub_addr_t) fdt, - GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt))); - fdt = NULL; - } -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 083f9417cb65e509e673dba09a71616c5661ab05..9b53d3168f9bb78eab7a124518e83915183912b9 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -306,6 +306,12 @@ grub_linux_setup_video (struct linux_kernel_params *params) - params->lfb_line_len = mode_info.pitch; - - params->lfb_base = (grub_size_t) framebuffer; -+ -+#if defined (GRUB_MACHINE_EFI) && defined (__x86_64__) -+ params->ext_lfb_base = (grub_size_t) (((grub_uint64_t)(grub_size_t) framebuffer) >> 32); -+ params->capabilities |= VIDEO_CAPABILITY_64BIT_BASE; -+#endif -+ - params->lfb_size = ALIGN_UP (params->lfb_line_len * params->lfb_height, 65536); - - params->red_mask_size = mode_info.red_mask_size; -@@ -678,7 +684,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { - grub_file_t file = 0; -- struct linux_kernel_header lh; -+ struct linux_i386_kernel_header lh; - grub_uint8_t setup_sects; - grub_size_t real_size, prot_size, prot_file_size; - grub_ssize_t len; -@@ -721,7 +727,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and - still not support 32-bit boot. */ -- if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0203) - { - grub_error (GRUB_ERR_BAD_OS, "version too old for 32-bit boot" -diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c -index fd7b41b0cad4f26d1170d70692ac1ac27fd6bd73..dc98dbcae258b340e155c64f1f73213ac724806a 100644 ---- a/grub-core/loader/i386/multiboot_mbi.c -+++ b/grub-core/loader/i386/multiboot_mbi.c -@@ -239,7 +239,7 @@ grub_multiboot_get_mbi_size (void) - ret = sizeof (struct multiboot_info) + ALIGN_UP (cmdline_size, 4) - + modcnt * sizeof (struct multiboot_mod_list) + total_modcmd - + ALIGN_UP (sizeof(PACKAGE_STRING), 4) -- + grub_get_multiboot_mmap_count () * sizeof (struct multiboot_mmap_entry) -+ + grub_multiboot_get_mmap_count () * sizeof (struct multiboot_mmap_entry) - + elf_sec_entsize * elf_sec_num - + 256 * sizeof (struct multiboot_color) - #if GRUB_MACHINE_HAS_VBE || GRUB_MACHINE_HAS_VGA_TEXT -@@ -542,7 +542,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target) - mbi->mods_count = 0; - } - -- mmap_size = grub_get_multiboot_mmap_count () -+ mmap_size = grub_multiboot_get_mmap_count () - * sizeof (struct multiboot_mmap_entry); - grub_fill_multiboot_mmap ((struct multiboot_mmap_entry *) ptrorig); - mbi->mmap_length = mmap_size; -diff --git a/grub-core/loader/i386/pc/chainloader.c b/grub-core/loader/i386/pc/chainloader.c -index c79c4fe0fc99a876b3e92f0a24f16cd636e00a0d..ef3a322b78cf10a406c0420780f821e2e1d1b284 100644 ---- a/grub-core/loader/i386/pc/chainloader.c -+++ b/grub-core/loader/i386/pc/chainloader.c -@@ -19,6 +19,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -86,9 +87,16 @@ grub_chainloader_unload (void) - void - grub_chainloader_patch_bpb (void *bs, grub_device_t dev, grub_uint8_t dl) - { -- grub_uint32_t part_start = 0; -+ grub_uint32_t part_start = 0, heads = 0, sectors = 0; - if (dev && dev->disk) -- part_start = grub_partition_get_start (dev->disk->partition); -+ { -+ part_start = grub_partition_get_start (dev->disk->partition); -+ if (dev->disk->data) -+ { -+ heads = ((struct grub_biosdisk_data *)(dev->disk->data))->heads; -+ sectors = ((struct grub_biosdisk_data *)(dev->disk->data))->sectors; -+ } -+ } - if (grub_memcmp ((char *) &((struct grub_ntfs_bpb *) bs)->oem_name, - "NTFS", 4) == 0) - { -@@ -117,7 +125,7 @@ grub_chainloader_patch_bpb (void *bs, grub_device_t dev, grub_uint8_t dl) - - if (bpb->num_reserved_sectors == 0) - break; -- if (bpb->num_total_sectors_16 == 0 || bpb->num_total_sectors_32 == 0) -+ if (bpb->num_total_sectors_16 == 0 && bpb->num_total_sectors_32 == 0) - break; - - if (bpb->num_fats == 0) -@@ -127,12 +135,20 @@ grub_chainloader_patch_bpb (void *bs, grub_device_t dev, grub_uint8_t dl) - { - bpb->num_hidden_sectors = grub_cpu_to_le32 (part_start); - bpb->version_specific.fat12_or_fat16.num_ph_drive = dl; -+ if (sectors) -+ bpb->sectors_per_track = grub_cpu_to_le16 (sectors); -+ if (heads) -+ bpb->num_heads = grub_cpu_to_le16 (heads); - return; - } - if (bpb->version_specific.fat32.sectors_per_fat_32) - { - bpb->num_hidden_sectors = grub_cpu_to_le32 (part_start); - bpb->version_specific.fat32.num_ph_drive = dl; -+ if (sectors) -+ bpb->sectors_per_track = grub_cpu_to_le16 (sectors); -+ if (heads) -+ bpb->num_heads = grub_cpu_to_le16 (heads); - return; - } - break; -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index a293b17aa101b308635bbed4086ae1547b91b884..b69cb7a3a7f8a9ca96a91a78c47fa1515e628699 100644 ---- a/grub-core/loader/i386/pc/linux.c -+++ b/grub-core/loader/i386/pc/linux.c -@@ -121,7 +121,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { - grub_file_t file = 0; -- struct linux_kernel_header lh; -+ struct linux_i386_kernel_header lh; - grub_uint8_t setup_sects; - grub_size_t real_size; - grub_ssize_t len; -@@ -169,7 +169,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - maximal_cmdline_size = 256; - -- if (lh.header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (lh.header == grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) - && grub_le_to_cpu16 (lh.version) >= 0x0200) - { - grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL); -@@ -322,7 +322,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - goto fail; - } - -- if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0200) - /* Clear the heap space. */ - grub_memset (grub_linux_real_chunk -@@ -387,7 +387,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - { - grub_size_t size = 0; - grub_addr_t addr_max, addr_min; -- struct linux_kernel_header *lh; -+ struct linux_i386_kernel_header *lh; - grub_uint8_t *initrd_chunk; - grub_addr_t initrd_addr; - grub_err_t err; -@@ -405,9 +405,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - goto fail; - } - -- lh = (struct linux_kernel_header *) grub_linux_real_chunk; -+ lh = (struct linux_i386_kernel_header *) grub_linux_real_chunk; - -- if (!(lh->header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) -+ if (!(lh->header == grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) - && grub_le_to_cpu16 (lh->version) >= 0x0200)) - { - grub_error (GRUB_ERR_BAD_OS, "the kernel is too old for initrd"); -diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c -index 99fad4cadae42ab09497babca15cd9606557fcd2..77a93e7b228316e1df731e01e51e67f9225b4482 100644 ---- a/grub-core/loader/i386/xen_file.c -+++ b/grub-core/loader/i386/xen_file.c -@@ -26,7 +26,7 @@ grub_elf_t - grub_xen_file (grub_file_t file) - { - grub_elf_t elf; -- struct linux_kernel_header lh; -+ struct linux_i386_kernel_header lh; - grub_file_t off_file; - grub_uint32_t payload_offset, payload_length; - grub_uint8_t magic[6]; -@@ -43,7 +43,7 @@ grub_xen_file (grub_file_t file) - goto fail; - - if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55) -- || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) -+ || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0208) - { - grub_error (GRUB_ERR_BAD_OS, "version too old for xen boot"); -diff --git a/grub-core/loader/ia64/efi/linux.c b/grub-core/loader/ia64/efi/linux.c -index efaa42ccdd2bf74321de20cf5033a80676cc7dc3..750330d4572d0dcd09d02b4b75c1f03045fa897b 100644 ---- a/grub-core/loader/ia64/efi/linux.c -+++ b/grub-core/loader/ia64/efi/linux.c -@@ -252,7 +252,7 @@ allocate_pages (grub_uint64_t align, grub_uint64_t size_pages, - aligned_start += align; - if (aligned_start + size > end) - continue; -- mem = grub_efi_allocate_pages (aligned_start, size_pages); -+ mem = grub_efi_allocate_fixed (aligned_start, size_pages); - if (! mem) - { - grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory"); -@@ -326,7 +326,7 @@ grub_linux_boot (void) - mmap_size = find_mmap_size (); - if (! mmap_size) - return grub_errno; -- mmap_buf = grub_efi_allocate_pages (0, page_align (mmap_size) >> 12); -+ mmap_buf = grub_efi_allocate_any_pages (page_align (mmap_size) >> 12); - if (! mmap_buf) - return grub_error (GRUB_ERR_IO, "cannot allocate memory map"); - err = grub_efi_finish_boot_services (&mmap_size, mmap_buf, &map_key, -@@ -422,7 +422,7 @@ grub_load_elf64 (grub_file_t file, void *buffer, const char *filename) - relocate = grub_env_get ("linux_relocate"); - if (!relocate || grub_strcmp (relocate, "force") != 0) - { -- kernel_mem = grub_efi_allocate_pages (low_addr, kernel_pages); -+ kernel_mem = grub_efi_allocate_fixed (low_addr, kernel_pages); - reloc_offset = 0; - } - /* Try to relocate. */ -@@ -524,7 +524,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - len += grub_strlen (argv[i]) + 1; - len += sizeof (struct ia64_boot_param) + 512; /* Room for extensions. */ - boot_param_pages = page_align (len) >> 12; -- boot_param = grub_efi_allocate_pages (0, boot_param_pages); -+ boot_param = grub_efi_allocate_any_pages (boot_param_pages); - if (boot_param == 0) - { - grub_error (GRUB_ERR_OUT_OF_MEMORY, -@@ -589,7 +589,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - grub_dprintf ("linux", "Loading initrd\n"); - - initrd_pages = (page_align (initrd_size) >> 12); -- initrd_mem = grub_efi_allocate_pages (0, initrd_pages); -+ initrd_mem = grub_efi_allocate_any_pages (initrd_pages); - if (! initrd_mem) - { - grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate pages"); -diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index bd9d5b3e698588db594a2c334d715e0e883bab92..40c67e82489ec3ecf891ae564cde810bf280b242 100644 ---- a/grub-core/loader/multiboot.c -+++ b/grub-core/loader/multiboot.c -@@ -28,7 +28,15 @@ - - #include - #include -+#ifdef GRUB_USE_MULTIBOOT2 -+#include -+#define GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER GRUB_MULTIBOOT2_CONSOLE_FRAMEBUFFER -+#define GRUB_MULTIBOOT_CONSOLE_EGA_TEXT GRUB_MULTIBOOT2_CONSOLE_EGA_TEXT -+#define GRUB_MULTIBOOT(x) grub_multiboot2_ ## x -+#else - #include -+#define GRUB_MULTIBOOT(x) grub_multiboot_ ## x -+#endif - #include - #include - #include -@@ -49,8 +57,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #include - #endif - --struct grub_relocator *grub_multiboot_relocator = NULL; --grub_uint32_t grub_multiboot_payload_eip; -+struct grub_relocator *GRUB_MULTIBOOT (relocator) = NULL; -+grub_uint32_t GRUB_MULTIBOOT (payload_eip); - #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) - #define DEFAULT_VIDEO_MODE "text" - #else -@@ -78,7 +86,7 @@ count_hook (grub_uint64_t addr __attribute__ ((unused)), - /* Return the length of the Multiboot mmap that will be needed to allocate - our platform's map. */ - grub_uint32_t --grub_get_multiboot_mmap_count (void) -+GRUB_MULTIBOOT (get_mmap_count) (void) - { - grub_size_t count = 0; - -@@ -88,7 +96,7 @@ grub_get_multiboot_mmap_count (void) - } - - grub_err_t --grub_multiboot_set_video_mode (void) -+GRUB_MULTIBOOT (set_video_mode) (void) - { - grub_err_t err; - const char *modevar; -@@ -130,9 +138,12 @@ static void - efi_boot (struct grub_relocator *rel, - grub_uint32_t target) - { -+#ifdef GRUB_USE_MULTIBOOT2 -+ struct grub_relocator_efi_state state_efi = MULTIBOOT2_EFI_INITIAL_STATE; -+#else - struct grub_relocator_efi_state state_efi = MULTIBOOT_EFI_INITIAL_STATE; -- -- state_efi.MULTIBOOT_EFI_ENTRY_REGISTER = grub_multiboot_payload_eip; -+#endif -+ state_efi.MULTIBOOT_EFI_ENTRY_REGISTER = GRUB_MULTIBOOT (payload_eip); - state_efi.MULTIBOOT_EFI_MBI_REGISTER = target; - - grub_relocator_efi_boot (rel, state_efi); -@@ -164,19 +175,23 @@ static grub_err_t - grub_multiboot_boot (void) - { - grub_err_t err; -+ -+#ifdef GRUB_USE_MULTIBOOT2 -+ struct grub_relocator32_state state = MULTIBOOT2_INITIAL_STATE; -+#else - struct grub_relocator32_state state = MULTIBOOT_INITIAL_STATE; -+#endif -+ state.MULTIBOOT_ENTRY_REGISTER = GRUB_MULTIBOOT (payload_eip); - -- state.MULTIBOOT_ENTRY_REGISTER = grub_multiboot_payload_eip; -- -- err = grub_multiboot_make_mbi (&state.MULTIBOOT_MBI_REGISTER); -+ err = GRUB_MULTIBOOT (make_mbi) (&state.MULTIBOOT_MBI_REGISTER); - - if (err) - return err; - - if (grub_efi_is_finished) -- normal_boot (grub_multiboot_relocator, state); -+ normal_boot (GRUB_MULTIBOOT (relocator), state); - else -- efi_boot (grub_multiboot_relocator, state.MULTIBOOT_MBI_REGISTER); -+ efi_boot (GRUB_MULTIBOOT (relocator), state.MULTIBOOT_MBI_REGISTER); - - /* Not reached. */ - return GRUB_ERR_NONE; -@@ -185,10 +200,10 @@ grub_multiboot_boot (void) - static grub_err_t - grub_multiboot_unload (void) - { -- grub_multiboot_free_mbi (); -+ GRUB_MULTIBOOT (free_mbi) (); - -- grub_relocator_unload (grub_multiboot_relocator); -- grub_multiboot_relocator = NULL; -+ grub_relocator_unload (GRUB_MULTIBOOT (relocator)); -+ GRUB_MULTIBOOT (relocator) = NULL; - - grub_dl_unref (my_mod); - -@@ -207,7 +222,7 @@ static grub_uint64_t highest_load; - - /* Load ELF32 or ELF64. */ - grub_err_t --grub_multiboot_load_elf (mbi_load_data_t *mld) -+GRUB_MULTIBOOT (load_elf) (mbi_load_data_t *mld) - { - if (grub_multiboot_is_elf32 (mld->buffer)) - return grub_multiboot_load_elf32 (mld); -@@ -218,9 +233,9 @@ grub_multiboot_load_elf (mbi_load_data_t *mld) - } - - grub_err_t --grub_multiboot_set_console (int console_type, int accepted_consoles, -- int width, int height, int depth, -- int console_req) -+GRUB_MULTIBOOT (set_console) (int console_type, int accepted_consoles, -+ int width, int height, int depth, -+ int console_req) - { - console_required = console_req; - if (!(accepted_consoles -@@ -313,19 +328,19 @@ grub_cmd_multiboot (grub_command_t cmd __attribute__ ((unused)), - grub_dl_ref (my_mod); - - /* Skip filename. */ -- grub_multiboot_init_mbi (argc - 1, argv + 1); -+ GRUB_MULTIBOOT (init_mbi) (argc - 1, argv + 1); - -- grub_relocator_unload (grub_multiboot_relocator); -- grub_multiboot_relocator = grub_relocator_new (); -+ grub_relocator_unload (GRUB_MULTIBOOT (relocator)); -+ GRUB_MULTIBOOT (relocator) = grub_relocator_new (); - -- if (!grub_multiboot_relocator) -+ if (!GRUB_MULTIBOOT (relocator)) - goto fail; - -- err = grub_multiboot_load (file, argv[0]); -+ err = GRUB_MULTIBOOT (load) (file, argv[0]); - if (err) - goto fail; - -- grub_multiboot_set_bootdev (); -+ GRUB_MULTIBOOT (set_bootdev) (); - - grub_loader_set (grub_multiboot_boot, grub_multiboot_unload, 0); - -@@ -335,8 +350,8 @@ grub_cmd_multiboot (grub_command_t cmd __attribute__ ((unused)), - - if (grub_errno != GRUB_ERR_NONE) - { -- grub_relocator_unload (grub_multiboot_relocator); -- grub_multiboot_relocator = NULL; -+ grub_relocator_unload (GRUB_MULTIBOOT (relocator)); -+ GRUB_MULTIBOOT (relocator) = NULL; - grub_dl_unref (my_mod); - } - -@@ -368,7 +383,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), - if (argc == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); - -- if (!grub_multiboot_relocator) -+ if (!GRUB_MULTIBOOT (relocator)) - return grub_error (GRUB_ERR_BAD_ARGUMENT, - N_("you need to load the kernel first")); - -@@ -389,7 +404,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), - if (size) - { - grub_relocator_chunk_t ch; -- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, -+ err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, - lowest_addr, (0xffffffff - size) + 1, - size, MULTIBOOT_MOD_ALIGN, - GRUB_RELOCATOR_PREFERENCE_NONE, 1); -@@ -407,7 +422,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), - target = 0; - } - -- err = grub_multiboot_add_module (target, size, argc - 1, argv + 1); -+ err = GRUB_MULTIBOOT (add_module) (target, size, argc - 1, argv + 1); - if (err) - { - grub_file_close (file); -diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c -index 5e649ed2545bee3fbe9602c9d97079160dc6420a..70cd1db513e679f0e02e06dc2de24747a62b88ba 100644 ---- a/grub-core/loader/multiboot_elfxx.c -+++ b/grub-core/loader/multiboot_elfxx.c -@@ -57,9 +57,9 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - char *phdr_base; - grub_err_t err; - grub_relocator_chunk_t ch; -- grub_uint32_t load_offset, load_size; -+ grub_uint32_t load_offset = 0, load_size; - int i; -- void *source; -+ void *source = NULL; - - if (ehdr->e_ident[EI_MAG0] != ELFMAG0 - || ehdr->e_ident[EI_MAG1] != ELFMAG1 -@@ -97,38 +97,38 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - return grub_error (GRUB_ERR_BAD_OS, "segment crosses 4 GiB border"); - #endif - -- load_size = highest_load - mld->link_base_addr; -- - if (mld->relocatable) - { -+ load_size = highest_load - mld->link_base_addr; -+ -+ grub_dprintf ("multiboot_loader", "align=0x%lx, preference=0x%x, " -+ "load_size=0x%x, avoid_efi_boot_services=%d\n", -+ (long) mld->align, mld->preference, load_size, -+ mld->avoid_efi_boot_services); -+ - if (load_size > mld->max_addr || mld->min_addr > mld->max_addr - load_size) - return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size"); - -- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, -+ err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, - mld->min_addr, mld->max_addr - load_size, - load_size, mld->align ? mld->align : 1, - mld->preference, mld->avoid_efi_boot_services); -+ -+ if (err) -+ { -+ grub_dprintf ("multiboot_loader", "Cannot allocate memory for OS image\n"); -+ return err; -+ } -+ -+ mld->load_base_addr = get_physical_target_address (ch); -+ source = get_virtual_current_address (ch); - } - else -- err = grub_relocator_alloc_chunk_addr (grub_multiboot_relocator, &ch, -- mld->link_base_addr, load_size); -+ mld->load_base_addr = mld->link_base_addr; - -- if (err) -- { -- grub_dprintf ("multiboot_loader", "Cannot allocate memory for OS image\n"); -- return err; -- } -- -- mld->load_base_addr = get_physical_target_address (ch); -- source = get_virtual_current_address (ch); -- -- grub_dprintf ("multiboot_loader", "link_base_addr=0x%x, load_base_addr=0x%x, " -- "load_size=0x%x, relocatable=%d\n", mld->link_base_addr, -- mld->load_base_addr, load_size, mld->relocatable); -- -- if (mld->relocatable) -- grub_dprintf ("multiboot_loader", "align=0x%lx, preference=0x%x, avoid_efi_boot_services=%d\n", -- (long) mld->align, mld->preference, mld->avoid_efi_boot_services); -+ grub_dprintf ("multiboot_loader", "relocatable=%d, link_base_addr=0x%x, " -+ "load_base_addr=0x%x\n", mld->relocatable, -+ mld->link_base_addr, mld->load_base_addr); - - /* Load every loadable segment in memory. */ - for (i = 0; i < ehdr->e_phnum; i++) -@@ -139,7 +139,24 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - grub_dprintf ("multiboot_loader", "segment %d: paddr=0x%lx, memsz=0x%lx, vaddr=0x%lx\n", - i, (long) phdr(i)->p_paddr, (long) phdr(i)->p_memsz, (long) phdr(i)->p_vaddr); - -- load_offset = phdr(i)->p_paddr - mld->link_base_addr; -+ if (mld->relocatable) -+ { -+ load_offset = phdr(i)->p_paddr - mld->link_base_addr; -+ grub_dprintf ("multiboot_loader", "segment %d: load_offset=0x%x\n", i, load_offset); -+ } -+ else -+ { -+ err = grub_relocator_alloc_chunk_addr (GRUB_MULTIBOOT (relocator), &ch, -+ phdr(i)->p_paddr, phdr(i)->p_memsz); -+ -+ if (err) -+ { -+ grub_dprintf ("multiboot_loader", "Cannot allocate memory for OS image\n"); -+ return err; -+ } -+ -+ source = get_virtual_current_address (ch); -+ } - - if (phdr(i)->p_filesz != 0) - { -@@ -167,7 +184,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - if (phdr(i)->p_vaddr <= ehdr->e_entry - && phdr(i)->p_vaddr + phdr(i)->p_memsz > ehdr->e_entry) - { -- grub_multiboot_payload_eip = (ehdr->e_entry - phdr(i)->p_vaddr) -+ GRUB_MULTIBOOT (payload_eip) = (ehdr->e_entry - phdr(i)->p_vaddr) - + phdr(i)->p_paddr; - #ifdef MULTIBOOT_LOAD_ELF64 - # ifdef __mips -@@ -191,7 +208,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - #if defined (__i386__) || defined (__x86_64__) - - #elif defined (__mips) -- grub_multiboot_payload_eip |= 0x80000000; -+ GRUB_MULTIBOOT (payload_eip) |= 0x80000000; - #else - #error Please complete this - #endif -@@ -238,7 +255,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - if (sh->sh_size == 0) - continue; - -- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, 0, -+ err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, 0, - (0xffffffff - sh->sh_size) + 1, - sh->sh_size, sh->sh_addralign, - GRUB_RELOCATOR_PREFERENCE_NONE, -@@ -264,8 +281,8 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - } - sh->sh_addr = target; - } -- grub_multiboot_add_elfsyms (ehdr->e_shnum, ehdr->e_shentsize, -- ehdr->e_shstrndx, shdr); -+ GRUB_MULTIBOOT (add_elfsyms) (ehdr->e_shnum, ehdr->e_shentsize, -+ ehdr->e_shstrndx, shdr); - } - - #undef phdr -diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c -index b0679a9f6c9848d81cb74cf799ad3a7b235d937c..4df6595954d889028e4525bb66b42cf391f4c9ce 100644 ---- a/grub-core/loader/multiboot_mbi2.c -+++ b/grub-core/loader/multiboot_mbi2.c -@@ -22,7 +22,7 @@ - #include - #include - #endif --#include -+#include - #include - #include - #include -@@ -71,7 +71,7 @@ static int keep_bs = 0; - static grub_uint32_t load_base_addr; - - void --grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize, -+grub_multiboot2_add_elfsyms (grub_size_t num, grub_size_t entsize, - unsigned shndx, void *data) - { - elf_sec_num = num; -@@ -90,17 +90,17 @@ find_header (grub_properly_aligned_t *buffer, grub_ssize_t len) - ((char *) header <= (char *) buffer + len - 12); - header = (struct multiboot_header *) ((grub_uint32_t *) header + MULTIBOOT_HEADER_ALIGN / 4)) - { -- if (header->magic == MULTIBOOT_HEADER_MAGIC -+ if (header->magic == MULTIBOOT2_HEADER_MAGIC - && !(header->magic + header->architecture - + header->header_length + header->checksum) -- && header->architecture == MULTIBOOT_ARCHITECTURE_CURRENT) -+ && header->architecture == MULTIBOOT2_ARCHITECTURE_CURRENT) - return header; - } - return NULL; - } - - grub_err_t --grub_multiboot_load (grub_file_t file, const char *filename) -+grub_multiboot2_load (grub_file_t file, const char *filename) - { - grub_ssize_t len; - struct multiboot_header *header; -@@ -112,7 +112,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) - grub_addr_t entry = 0, efi_entry = 0; - grub_uint32_t console_required = 0; - struct multiboot_header_tag_framebuffer *fbtag = NULL; -- int accepted_consoles = GRUB_MULTIBOOT_CONSOLE_EGA_TEXT; -+ int accepted_consoles = GRUB_MULTIBOOT2_CONSOLE_EGA_TEXT; - mbi_load_data_t mld; - - mld.mbi_ver = 2; -@@ -210,7 +210,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) - case MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS: - if (!(((struct multiboot_header_tag_console_flags *) tag)->console_flags - & MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED)) -- accepted_consoles &= ~GRUB_MULTIBOOT_CONSOLE_EGA_TEXT; -+ accepted_consoles &= ~GRUB_MULTIBOOT2_CONSOLE_EGA_TEXT; - if (((struct multiboot_header_tag_console_flags *) tag)->console_flags - & MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED) - console_required = 1; -@@ -218,7 +218,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) - - case MULTIBOOT_HEADER_TAG_FRAMEBUFFER: - fbtag = (struct multiboot_header_tag_framebuffer *) tag; -- accepted_consoles |= GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER; -+ accepted_consoles |= GRUB_MULTIBOOT2_CONSOLE_FRAMEBUFFER; - break; - - case MULTIBOOT_HEADER_TAG_RELOCATABLE: -@@ -295,13 +295,13 @@ grub_multiboot_load (grub_file_t file, const char *filename) - return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size"); - } - -- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, -+ err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch, - mld.min_addr, mld.max_addr - code_size, - code_size, mld.align ? mld.align : 1, - mld.preference, keep_bs); - } - else -- err = grub_relocator_alloc_chunk_addr (grub_multiboot_relocator, -+ err = grub_relocator_alloc_chunk_addr (grub_multiboot2_relocator, - &ch, load_addr, code_size); - if (err) - { -@@ -343,7 +343,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) - mld.file = file; - mld.filename = filename; - mld.avoid_efi_boot_services = keep_bs; -- err = grub_multiboot_load_elf (&mld); -+ err = grub_multiboot2_load_elf (&mld); - if (err) - { - grub_free (mld.buffer); -@@ -354,9 +354,9 @@ grub_multiboot_load (grub_file_t file, const char *filename) - load_base_addr = mld.load_base_addr; - - if (keep_bs && efi_entry_specified) -- grub_multiboot_payload_eip = efi_entry; -+ grub_multiboot2_payload_eip = efi_entry; - else if (entry_specified) -- grub_multiboot_payload_eip = entry; -+ grub_multiboot2_payload_eip = entry; - - if (mld.relocatable) - { -@@ -370,20 +370,20 @@ grub_multiboot_load (grub_file_t file, const char *filename) - * 64-bit int here. - */ - if (mld.load_base_addr >= mld.link_base_addr) -- grub_multiboot_payload_eip += mld.load_base_addr - mld.link_base_addr; -+ grub_multiboot2_payload_eip += mld.load_base_addr - mld.link_base_addr; - else -- grub_multiboot_payload_eip -= mld.link_base_addr - mld.load_base_addr; -+ grub_multiboot2_payload_eip -= mld.link_base_addr - mld.load_base_addr; - } - - if (fbtag) -- err = grub_multiboot_set_console (GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER, -- accepted_consoles, -- fbtag->width, fbtag->height, -- fbtag->depth, console_required); -+ err = grub_multiboot2_set_console (GRUB_MULTIBOOT2_CONSOLE_FRAMEBUFFER, -+ accepted_consoles, -+ fbtag->width, fbtag->height, -+ fbtag->depth, console_required); - else -- err = grub_multiboot_set_console (GRUB_MULTIBOOT_CONSOLE_EGA_TEXT, -- accepted_consoles, -- 0, 0, 0, console_required); -+ err = grub_multiboot2_set_console (GRUB_MULTIBOOT2_CONSOLE_EGA_TEXT, -+ accepted_consoles, -+ 0, 0, 0, console_required); - return err; - } - -@@ -459,7 +459,7 @@ net_size (void) - } - - static grub_size_t --grub_multiboot_get_mbi_size (void) -+grub_multiboot2_get_mbi_size (void) - { - #ifdef GRUB_MACHINE_EFI - if (!keep_bs && !efi_mmap_size) -@@ -478,7 +478,7 @@ grub_multiboot_get_mbi_size (void) - + ALIGN_UP (sizeof (struct multiboot_tag_elf_sections), MULTIBOOT_TAG_ALIGN) - + ALIGN_UP (elf_sec_entsize * elf_sec_num, MULTIBOOT_TAG_ALIGN) - + ALIGN_UP ((sizeof (struct multiboot_tag_mmap) -- + grub_get_multiboot_mmap_count () -+ + grub_multiboot2_get_mmap_count () - * sizeof (struct multiboot_mmap_entry)), MULTIBOOT_TAG_ALIGN) - + ALIGN_UP (sizeof (struct multiboot_tag_framebuffer), MULTIBOOT_TAG_ALIGN) - + ALIGN_UP (sizeof (struct multiboot_tag_old_acpi) -@@ -522,7 +522,7 @@ grub_fill_multiboot_mmap (struct multiboot_tag_mmap *tag) - - tag->type = MULTIBOOT_TAG_TYPE_MMAP; - tag->size = sizeof (struct multiboot_tag_mmap) -- + sizeof (struct multiboot_mmap_entry) * grub_get_multiboot_mmap_count (); -+ + sizeof (struct multiboot_mmap_entry) * grub_multiboot2_get_mmap_count (); - tag->entry_size = sizeof (struct multiboot_mmap_entry); - tag->entry_version = 0; - -@@ -588,7 +588,7 @@ retrieve_video_parameters (grub_properly_aligned_t **ptrorig) - struct multiboot_tag_framebuffer *tag - = (struct multiboot_tag_framebuffer *) *ptrorig; - -- err = grub_multiboot_set_video_mode (); -+ err = grub_multiboot2_set_video_mode (); - if (err) - { - grub_print_error (); -@@ -731,7 +731,7 @@ retrieve_video_parameters (grub_properly_aligned_t **ptrorig) - } - - grub_err_t --grub_multiboot_make_mbi (grub_uint32_t *target) -+grub_multiboot2_make_mbi (grub_uint32_t *target) - { - grub_properly_aligned_t *ptrorig; - grub_properly_aligned_t *mbistart; -@@ -739,11 +739,11 @@ grub_multiboot_make_mbi (grub_uint32_t *target) - grub_size_t bufsize; - grub_relocator_chunk_t ch; - -- bufsize = grub_multiboot_get_mbi_size (); -+ bufsize = grub_multiboot2_get_mbi_size (); - - COMPILE_TIME_ASSERT (MULTIBOOT_TAG_ALIGN % sizeof (grub_properly_aligned_t) == 0); - -- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, -+ err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch, - 0, 0xffffffff - bufsize, - bufsize, MULTIBOOT_TAG_ALIGN, - GRUB_RELOCATOR_PREFERENCE_NONE, 1); -@@ -1039,7 +1039,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target) - } - - void --grub_multiboot_free_mbi (void) -+grub_multiboot2_free_mbi (void) - { - struct module *cur, *next; - -@@ -1061,11 +1061,11 @@ grub_multiboot_free_mbi (void) - } - - grub_err_t --grub_multiboot_init_mbi (int argc, char *argv[]) -+grub_multiboot2_init_mbi (int argc, char *argv[]) - { - grub_ssize_t len = 0; - -- grub_multiboot_free_mbi (); -+ grub_multiboot2_free_mbi (); - - len = grub_loader_cmdline_size (argc, argv); - -@@ -1081,7 +1081,7 @@ grub_multiboot_init_mbi (int argc, char *argv[]) - } - - grub_err_t --grub_multiboot_add_module (grub_addr_t start, grub_size_t size, -+grub_multiboot2_add_module (grub_addr_t start, grub_size_t size, - int argc, char *argv[]) - { - struct module *newmod; -@@ -1119,7 +1119,7 @@ grub_multiboot_add_module (grub_addr_t start, grub_size_t size, - } - - void --grub_multiboot_set_bootdev (void) -+grub_multiboot2_set_bootdev (void) - { - grub_device_t dev; - -diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index 4b68c4151a11db214602f74e111e7552801d8450..54306e3b16d25fe5d3bdf9502683822237be488d 100644 ---- a/grub-core/net/arp.c -+++ b/grub-core/net/arp.c -@@ -111,8 +111,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf, - } - - grub_err_t --grub_net_arp_receive (struct grub_net_buff *nb, -- struct grub_net_card *card) -+grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, -+ grub_uint16_t *vlantag) - { - struct arppkt *arp_packet = (struct arppkt *) nb->data; - grub_net_network_level_address_t sender_addr, target_addr; -@@ -138,6 +138,14 @@ grub_net_arp_receive (struct grub_net_buff *nb, - - FOR_NET_NETWORK_LEVEL_INTERFACES (inf) - { -+ /* Verify vlantag id */ -+ if (inf->card == card && inf->vlantag != *vlantag) -+ { -+ grub_dprintf ("net", "invalid vlantag! %x != %x\n", -+ inf->vlantag, *vlantag); -+ break; -+ } -+ - /* Am I the protocol address target? */ - if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 - && arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST)) -diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index a78d164db1a0abbaf0417f70dc7180b9b2c4df76..002446be1c385934762824a965806ffb75f422a0 100644 ---- a/grub-core/net/drivers/ieee1275/ofnet.c -+++ b/grub-core/net/drivers/ieee1275/ofnet.c -@@ -153,11 +153,11 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, - char *comma_char = 0; - char *equal_char = 0; - grub_size_t field_counter = 0; -- - grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask; - grub_net_link_level_address_t hw_addr; - grub_net_interface_flags_t flags = 0; - struct grub_net_network_level_interface *inter = NULL; -+ grub_uint16_t vlantag = 0; - - hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; - -@@ -175,6 +175,11 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, - *equal_char = 0; - grub_env_set_net_property ((*card)->name, args, equal_char + 1, - grub_strlen(equal_char + 1)); -+ -+ if ((grub_strcmp (args, "vtag") == 0) && -+ (grub_strlen (equal_char + 1) == 8)) -+ vlantag = grub_strtoul (equal_char + 1 + 4, 0, 16); -+ - *equal_char = '='; - } - else -@@ -213,8 +218,10 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, - hw_addr.mac, sizeof(hw_addr.mac), 0); - inter = grub_net_add_addr ((*card)->name, *card, &client_addr, &hw_addr, - flags); -+ inter->vlantag = vlantag; - grub_net_add_ipv4_local (inter, - __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4))); -+ - } - - if (gateway_addr.ipv4 != 0) -diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c -index c397b1b348ce559070cabe1e0b6e28e4dbf254d8..4d7ceed6f93c7e87019546b544a4365a504f5f9f 100644 ---- a/grub-core/net/ethernet.c -+++ b/grub-core/net/ethernet.c -@@ -18,6 +18,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -56,10 +57,17 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, - { - struct etherhdr *eth; - grub_err_t err; -+ grub_uint8_t etherhdr_size; -+ grub_uint16_t vlantag_id = VLANTAG_IDENTIFIER; - -- COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE); -+ etherhdr_size = sizeof (*eth); -+ COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE); - -- err = grub_netbuff_push (nb, sizeof (*eth)); -+ /* Increase ethernet header in case of vlantag */ -+ if (inf->vlantag != 0) -+ etherhdr_size += 4; -+ -+ err = grub_netbuff_push (nb, etherhdr_size); - if (err) - return err; - eth = (struct etherhdr *) nb->data; -@@ -76,6 +84,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, - return err; - inf->card->opened = 1; - } -+ -+ /* Check and add a vlan-tag if needed. */ -+ if (inf->vlantag != 0) -+ { -+ /* Move eth type to the right */ -+ grub_memcpy ((char *) nb->data + etherhdr_size - 2, -+ (char *) nb->data + etherhdr_size - 6, 2); -+ -+ /* Add the tag in the middle */ -+ grub_memcpy ((char *) nb->data + etherhdr_size - 6, &vlantag_id, 2); -+ grub_memcpy ((char *) nb->data + etherhdr_size - 4, (char *) &(inf->vlantag), 2); -+ } -+ - return inf->card->driver->send (inf->card, nb); - } - -@@ -90,10 +111,25 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, - grub_net_link_level_address_t hwaddress; - grub_net_link_level_address_t src_hwaddress; - grub_err_t err; -+ grub_uint8_t etherhdr_size = sizeof (*eth); -+ grub_uint16_t vlantag = 0; -+ -+ -+ /* Check if a vlan-tag is present. If so, the ethernet header is 4 bytes */ -+ /* longer than the original one. The vlantag id is extracted and the header */ -+ /* is reseted to the original size. */ -+ if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == VLANTAG_IDENTIFIER) -+ { -+ vlantag = grub_get_unaligned16 (nb->data + etherhdr_size); -+ etherhdr_size += 4; -+ /* Move eth type to the original position */ -+ grub_memcpy((char *) nb->data + etherhdr_size - 6, -+ (char *) nb->data + etherhdr_size - 2, 2); -+ } - - eth = (struct etherhdr *) nb->data; - type = grub_be_to_cpu16 (eth->type); -- err = grub_netbuff_pull (nb, sizeof (*eth)); -+ err = grub_netbuff_pull (nb, etherhdr_size); - if (err) - return err; - -@@ -121,13 +157,14 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, - { - /* ARP packet. */ - case GRUB_NET_ETHERTYPE_ARP: -- grub_net_arp_receive (nb, card); -+ grub_net_arp_receive (nb, card, &vlantag); - grub_netbuff_free (nb); - return GRUB_ERR_NONE; - /* IP packet. */ - case GRUB_NET_ETHERTYPE_IP: - case GRUB_NET_ETHERTYPE_IP6: -- return grub_net_recv_ip_packets (nb, card, &hwaddress, &src_hwaddress); -+ return grub_net_recv_ip_packets (nb, card, &hwaddress, &src_hwaddress, -+ &vlantag); - } - grub_netbuff_free (nb); - return GRUB_ERR_NONE; -diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index aba4f89087bc14b1fe28a77794dd6792beb0bf36..7c95cc7464a09af4b223c94d6653a03f0dbee062 100644 ---- a/grub-core/net/ip.c -+++ b/grub-core/net/ip.c -@@ -228,12 +228,13 @@ handle_dgram (struct grub_net_buff *nb, - grub_net_ip_protocol_t proto, - const grub_net_network_level_address_t *source, - const grub_net_network_level_address_t *dest, -+ grub_uint16_t *vlantag, - grub_uint8_t ttl) - { - struct grub_net_network_level_interface *inf = NULL; - grub_err_t err; - int multicast = 0; -- -+ - /* DHCP needs special treatment since we don't know IP yet. */ - { - struct udphdr *udph; -@@ -293,6 +294,15 @@ handle_dgram (struct grub_net_buff *nb, - && grub_net_addr_cmp (&inf->address, dest) == 0 - && grub_net_hwaddr_cmp (&inf->hwaddress, hwaddress) == 0) - break; -+ -+ /* Verify vlantag id */ -+ if (inf->card == card && inf->vlantag != *vlantag) -+ { -+ grub_dprintf ("net", "invalid vlantag! %x != %x\n", -+ inf->vlantag, *vlantag); -+ break; -+ } -+ - /* Solicited node multicast. */ - if (inf->card == card - && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6 -@@ -383,7 +393,8 @@ static grub_err_t - grub_net_recv_ip4_packets (struct grub_net_buff *nb, - struct grub_net_card *card, - const grub_net_link_level_address_t *hwaddress, -- const grub_net_link_level_address_t *src_hwaddress) -+ const grub_net_link_level_address_t *src_hwaddress, -+ grub_uint16_t *vlantag) - { - struct iphdr *iph = (struct iphdr *) nb->data; - grub_err_t err; -@@ -458,7 +469,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, - dest.ipv4 = iph->dest; - - return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol, -- &source, &dest, iph->ttl); -+ &source, &dest, vlantag, iph->ttl); - } - - for (prev = &reassembles, rsm = *prev; rsm; prev = &rsm->next, rsm = *prev) -@@ -594,7 +605,7 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, - dest.ipv4 = dst; - - return handle_dgram (ret, card, src_hwaddress, -- hwaddress, proto, &source, &dest, -+ hwaddress, proto, &source, &dest, vlantag, - ttl); - } - } -@@ -652,7 +663,8 @@ static grub_err_t - grub_net_recv_ip6_packets (struct grub_net_buff *nb, - struct grub_net_card *card, - const grub_net_link_level_address_t *hwaddress, -- const grub_net_link_level_address_t *src_hwaddress) -+ const grub_net_link_level_address_t *src_hwaddress, -+ grub_uint16_t *vlantag) - { - struct ip6hdr *iph = (struct ip6hdr *) nb->data; - grub_err_t err; -@@ -703,21 +715,24 @@ grub_net_recv_ip6_packets (struct grub_net_buff *nb, - grub_memcpy (dest.ipv6, &iph->dest, sizeof (dest.ipv6)); - - return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol, -- &source, &dest, iph->ttl); -+ &source, &dest, vlantag, iph->ttl); - } - - grub_err_t - grub_net_recv_ip_packets (struct grub_net_buff *nb, - struct grub_net_card *card, - const grub_net_link_level_address_t *hwaddress, -- const grub_net_link_level_address_t *src_hwaddress) -+ const grub_net_link_level_address_t *src_hwaddress, -+ grub_uint16_t *vlantag) - { - struct iphdr *iph = (struct iphdr *) nb->data; - - if ((iph->verhdrlen >> 4) == 4) -- return grub_net_recv_ip4_packets (nb, card, hwaddress, src_hwaddress); -+ return grub_net_recv_ip4_packets (nb, card, hwaddress, src_hwaddress, -+ vlantag); - if ((iph->verhdrlen >> 4) == 6) -- return grub_net_recv_ip6_packets (nb, card, hwaddress, src_hwaddress); -+ return grub_net_recv_ip6_packets (nb, card, hwaddress, src_hwaddress, -+ vlantag); - grub_dprintf ("net", "Bad IP version: %d\n", (iph->verhdrlen >> 4)); - grub_netbuff_free (nb); - return GRUB_ERR_NONE; -diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c -index 7338f8245e3a9bbe47e821fb43c2b699b9527ffb..6be678c0de1ac236b60f765e767ae43d113b1117 100644 ---- a/grub-core/normal/auth.c -+++ b/grub-core/normal/auth.c -@@ -166,13 +166,13 @@ grub_username_get (char buf[], unsigned buf_size) - if (key == '\n' || key == '\r') - break; - -- if (key == '\e') -+ if (key == GRUB_TERM_ESC) - { - cur_len = 0; - break; - } - -- if (key == '\b') -+ if (key == GRUB_TERM_BACKSPACE) - { - if (cur_len) - { -@@ -197,7 +197,7 @@ grub_username_get (char buf[], unsigned buf_size) - grub_xputs ("\n"); - grub_refresh (); - -- return (key != '\e'); -+ return (key != GRUB_TERM_ESC); - } - - grub_err_t -diff --git a/grub-core/normal/cmdline.c b/grub-core/normal/cmdline.c -index a36180d75305f421e96903a46acb9dd99af06572..c037d5050ed2b34fa3b2ac0c7564e4208ca143c4 100644 ---- a/grub-core/normal/cmdline.c -+++ b/grub-core/normal/cmdline.c -@@ -626,12 +626,12 @@ grub_cmdline_get (const char *prompt_translated) - cl_insert (cl_terms, nterms, &lpos, &llen, &max_len, &buf, kill_buf); - break; - -- case '\e': -+ case GRUB_TERM_ESC: - grub_free (cl_terms); - grub_free (buf); - return 0; - -- case '\b': -+ case GRUB_TERM_BACKSPACE: - if (lpos > 0) - { - lpos--; -diff --git a/grub-core/normal/crypto.c b/grub-core/normal/crypto.c -index 2bfd67c8ef388097701a7415df3cd7321c6a1e57..e6d345f33458a167e703235d611afdd8c2a245b0 100644 ---- a/grub-core/normal/crypto.c -+++ b/grub-core/normal/crypto.c -@@ -147,8 +147,8 @@ read_crypto_list (const char *prefix) - if (! cur->modname) - { - grub_errno = GRUB_ERR_NONE; -- grub_free (cur); - grub_free (cur->name); -+ grub_free (cur); - continue; - } - cur->next = crypto_specs; -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 719e2fb1c260b16d96cea2b787d7f7e592b428b7..e7a83c2d6e2aaa8248ed739b28f2c6be76622eb4 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -763,7 +763,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) - *auto_boot = 0; - return current_entry; - -- case '\e': -+ case GRUB_TERM_ESC: - if (nested) - { - menu_fini (); -diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index eeeee5580abea9798278ef85cf417366cf4f0e0a..cdf3590a3646ce4be0caf99cafedcbc38cbe51e4 100644 ---- a/grub-core/normal/menu_entry.c -+++ b/grub-core/normal/menu_entry.c -@@ -1403,7 +1403,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) - goto fail; - break; - -- case '\e': -+ case GRUB_TERM_ESC: - destroy_screen (screen); - return; - -diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index a79682a5e31e1b4e77d9b99f55cc5a1fca9e159b..a6153d359546d237933cba0f300e7d59fdb1007b 100644 ---- a/grub-core/osdep/linux/ofpath.c -+++ b/grub-core/osdep/linux/ofpath.c -@@ -38,6 +38,46 @@ - #include - #include - -+#ifdef __sparc__ -+typedef enum -+ { -+ GRUB_OFPATH_SPARC_WWN_ADDR = 1, -+ GRUB_OFPATH_SPARC_TGT_LUN, -+ } ofpath_sparc_addressing; -+ -+struct ofpath_sparc_hba -+{ -+ grub_uint32_t device_id; -+ ofpath_sparc_addressing addressing; -+}; -+ -+static struct ofpath_sparc_hba sparc_lsi_hba[] = { -+ /* Rhea, Jasper 320, LSI53C1020/1030. */ -+ {0x30, GRUB_OFPATH_SPARC_TGT_LUN}, -+ /* SAS-1068E. */ -+ {0x50, GRUB_OFPATH_SPARC_TGT_LUN}, -+ /* SAS-1064E. */ -+ {0x56, GRUB_OFPATH_SPARC_TGT_LUN}, -+ /* Pandora SAS-1068E. */ -+ {0x58, GRUB_OFPATH_SPARC_TGT_LUN}, -+ /* Aspen, Invader, LSI SAS-3108. */ -+ {0x5d, GRUB_OFPATH_SPARC_TGT_LUN}, -+ /* Niwot, SAS 2108. */ -+ {0x79, GRUB_OFPATH_SPARC_TGT_LUN}, -+ /* Erie, Falcon, LSI SAS 2008. */ -+ {0x72, GRUB_OFPATH_SPARC_WWN_ADDR}, -+ /* LSI WarpDrive 6203. */ -+ {0x7e, GRUB_OFPATH_SPARC_WWN_ADDR}, -+ /* LSI SAS 2308. */ -+ {0x87, GRUB_OFPATH_SPARC_WWN_ADDR}, -+ /* LSI SAS 3008. */ -+ {0x97, GRUB_OFPATH_SPARC_WWN_ADDR}, -+ {0, 0} -+}; -+ -+static const int LSI_VENDOR_ID = 0x1000; -+#endif -+ - #ifdef OFPATH_STANDALONE - #define xmalloc malloc - void -@@ -120,6 +160,8 @@ find_obppath (const char *sysfs_path_orig) - #endif - - fd = open(path, O_RDONLY); -+ -+#ifndef __sparc__ - if (fd < 0 || fstat (fd, &st) < 0) - { - if (fd >= 0) -@@ -127,6 +169,7 @@ find_obppath (const char *sysfs_path_orig) - snprintf(path, path_size, "%s/devspec", sysfs_path); - fd = open(path, O_RDONLY); - } -+#endif - - if (fd < 0 || fstat (fd, &st) < 0) - { -@@ -307,6 +350,55 @@ of_path_of_ide(const char *sys_devname __attribute__((unused)), const char *devi - return ret; - } - -+#ifdef __sparc__ -+static char * -+of_path_of_nvme(const char *sys_devname __attribute__((unused)), -+ const char *device, -+ const char *devnode __attribute__((unused)), -+ const char *devicenode) -+{ -+ char *sysfs_path, *of_path, disk[MAX_DISK_CAT]; -+ const char *digit_string, *part_end; -+ -+ digit_string = trailing_digits (device); -+ part_end = devicenode + strlen (devicenode) - 1; -+ -+ if ((*digit_string != '\0') && (*part_end == 'p')) -+ { -+ /* We have a partition number, strip it off. */ -+ int part; -+ char *nvmedev, *end; -+ -+ nvmedev = strdup (devicenode); -+ -+ if (!nvmedev) -+ return NULL; -+ -+ end = nvmedev + strlen (nvmedev) - 1; -+ /* Remove the p. */ -+ *end = '\0'; -+ sscanf (digit_string, "%d", &part); -+ snprintf (disk, sizeof (disk), "/disk@1:%c", 'a' + (part - 1)); -+ sysfs_path = block_device_get_sysfs_path_and_link (nvmedev); -+ free (nvmedev); -+ } -+ else -+ { -+ /* We do not have the parition. */ -+ snprintf (disk, sizeof (disk), "/disk@1"); -+ sysfs_path = block_device_get_sysfs_path_and_link (device); -+ } -+ -+ of_path = find_obppath (sysfs_path); -+ -+ if (of_path) -+ strcat (of_path, disk); -+ -+ free (sysfs_path); -+ return of_path; -+} -+#endif -+ - static int - vendor_is_ATA(const char *path) - { -@@ -335,6 +427,64 @@ vendor_is_ATA(const char *path) - return (memcmp(bufcont, "ATA", 3) == 0); - } - -+#ifdef __sparc__ -+static void -+check_hba_identifiers (const char *sysfs_path, int *vendor, int *device_id) -+{ -+ char *ed = strstr (sysfs_path, "host"); -+ size_t path_size; -+ char *p, *path; -+ char buf[8]; -+ int fd; -+ -+ if (!ed) -+ return; -+ -+ p = xstrdup (sysfs_path); -+ ed = strstr (p, "host"); -+ -+ *ed = '\0'; -+ -+ path_size = (strlen (p) + sizeof ("vendor")); -+ path = xmalloc (path_size); -+ -+ if (!path) -+ goto out; -+ -+ snprintf (path, path_size, "%svendor", p); -+ fd = open (path, O_RDONLY); -+ -+ if (fd < 0) -+ goto out; -+ -+ memset (buf, 0, sizeof (buf)); -+ -+ if (read (fd, buf, sizeof (buf) - 1) < 0) -+ goto out; -+ -+ close (fd); -+ sscanf (buf, "%x", vendor); -+ -+ snprintf (path, path_size, "%sdevice", p); -+ fd = open (path, O_RDONLY); -+ -+ if (fd < 0) -+ goto out; -+ -+ memset (buf, 0, sizeof (buf)); -+ -+ if (read (fd, buf, sizeof (buf) - 1) < 0) -+ goto out; -+ -+ close (fd); -+ sscanf (buf, "%x", device_id); -+ -+ out: -+ free (path); -+ free (p); -+} -+#endif -+ - static void - check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address) - { -@@ -396,7 +546,7 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev - { - const char *p, *digit_string, *disk_name; - int host, bus, tgt, lun; -- unsigned long int sas_address; -+ unsigned long int sas_address = 0; - char *sysfs_path, disk[MAX_DISK_CAT - sizeof ("/fp@0,0")]; - char *of_path; - -@@ -413,9 +563,8 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev - } - - of_path = find_obppath(sysfs_path); -- free (sysfs_path); - if (!of_path) -- return NULL; -+ goto out; - - if (strstr (of_path, "qlc")) - strcat (of_path, "/fp@0,0"); -@@ -444,6 +593,46 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev - } - else - { -+#ifdef __sparc__ -+ ofpath_sparc_addressing addressing = GRUB_OFPATH_SPARC_TGT_LUN; -+ int vendor = 0, device_id = 0; -+ char *optr = disk; -+ -+ check_hba_identifiers (sysfs_path, &vendor, &device_id); -+ -+ if (vendor == LSI_VENDOR_ID) -+ { -+ struct ofpath_sparc_hba *lsi_hba; -+ -+ /* -+ * Over time different OF addressing schemes have been supported. -+ * There is no generic addressing scheme that works across -+ * every HBA. -+ */ -+ for (lsi_hba = sparc_lsi_hba; lsi_hba->device_id; lsi_hba++) -+ if (lsi_hba->device_id == device_id) -+ { -+ addressing = lsi_hba->addressing; -+ break; -+ } -+ } -+ -+ if (addressing == GRUB_OFPATH_SPARC_WWN_ADDR) -+ optr += snprintf (disk, sizeof (disk), "/%s@w%lx,%x", disk_name, -+ sas_address, lun); -+ else -+ optr += snprintf (disk, sizeof (disk), "/%s@%x,%x", disk_name, tgt, -+ lun); -+ -+ if (*digit_string != '\0') -+ { -+ int part; -+ -+ sscanf (digit_string, "%d", &part); -+ snprintf (optr, sizeof (disk) - (optr - disk - 1), ":%c", 'a' -+ + (part - 1)); -+ } -+#else - if (lun == 0) - { - int sas_id = 0; -@@ -491,8 +680,12 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev - } - free (lunstr); - } -+#endif - } - strcat(of_path, disk); -+ -+ out: -+ free (sysfs_path); - return of_path; - } - -@@ -537,6 +730,11 @@ grub_util_devname_to_ofpath (const char *sys_devname) - /* All the models I've seen have a devalias "floppy". - New models have no floppy at all. */ - ofpath = xstrdup ("floppy"); -+#ifdef __sparc__ -+ else if (device[0] == 'n' && device[1] == 'v' && device[2] == 'm' -+ && device[3] == 'e') -+ ofpath = of_path_of_nvme (name_buf, device, devnode, devicenode); -+#endif - else - { - grub_util_warn (_("unknown device type %s"), device); -diff --git a/grub-core/osdep/unix/exec.c b/grub-core/osdep/unix/exec.c -index 935ff120ebe117f7492715813789db364ef1b12f..db3259f6504d5d5958cfa330bfd4a8b12b64f970 100644 ---- a/grub-core/osdep/unix/exec.c -+++ b/grub-core/osdep/unix/exec.c -@@ -99,7 +99,7 @@ grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, - { - fd = open (stdin_file, O_RDONLY); - if (fd < 0) -- exit (127); -+ _exit (127); - dup2 (fd, STDIN_FILENO); - close (fd); - } -@@ -108,7 +108,7 @@ grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, - { - fd = open (stdout_file, O_WRONLY | O_CREAT, 0700); - if (fd < 0) -- exit (127); -+ _exit (127); - dup2 (fd, STDOUT_FILENO); - close (fd); - } -@@ -117,7 +117,7 @@ grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, - { - fd = open (stderr_file, O_WRONLY | O_CREAT, 0700); - if (fd < 0) -- exit (127); -+ _exit (127); - dup2 (fd, STDERR_FILENO); - close (fd); - } -@@ -126,7 +126,7 @@ grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, - setenv ("LC_ALL", "C", 1); - - execvp ((char *) argv[0], (char **) argv); -- exit (127); -+ _exit (127); - } - waitpid (pid, &status, 0); - if (!WIFEXITED (status)) -diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c -index 4bf37b027be660a14994fb316f08dd478490c4e2..3046e22cc012d1012add87931a018043e3ecc714 100644 ---- a/grub-core/osdep/unix/getroot.c -+++ b/grub-core/osdep/unix/getroot.c -@@ -428,8 +428,11 @@ grub_find_device (const char *dir, dev_t dev) - { - #ifdef __linux__ - /* Skip device names like /dev/dm-0, which are short-hand aliases -- to more descriptive device names, e.g. those under /dev/mapper */ -- if (ent->d_name[0] == 'd' && -+ to more descriptive device names, e.g. those under /dev/mapper. -+ Also, don't skip devices which names start with dm-[0-9] in -+ directories below /dev, e.g. /dev/mapper/dm-0-luks. */ -+ if (strcmp (dir, "/dev") == 0 && -+ ent->d_name[0] == 'd' && - ent->d_name[1] == 'm' && - ent->d_name[2] == '-' && - ent->d_name[3] >= '0' && -diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c -index 2a8c5882e3d10b98bc305a116f8cca06acfe89f5..5450cf4166e04c2cfab806e93dfa63c6abdb9698 100644 ---- a/grub-core/osdep/unix/hostdisk.c -+++ b/grub-core/osdep/unix/hostdisk.c -@@ -77,11 +77,19 @@ grub_util_get_fd_size (grub_util_fd_t fd, const char *name, unsigned *log_secsiz - int - grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off) - { -+#if SIZEOF_OFF_T == 8 - off_t offset = (off_t) off; - - if (lseek (fd, offset, SEEK_SET) != offset) - return -1; -+#elif SIZEOF_OFF64_T == 8 -+ off64_t offset = (off64_t) off; - -+ if (lseek64 (fd, offset, SEEK_SET) != offset) -+ return -1; -+#else -+#error "No large file support" -+#endif - return 0; - } - -diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c -index a3fcfcacaa814d3ab62104f0dd406ef0c2163613..ca448bc11a05b9e0c6203a799ff62ab1dd75274f 100644 ---- a/grub-core/osdep/unix/platform.c -+++ b/grub-core/osdep/unix/platform.c -@@ -78,19 +78,20 @@ get_ofpathname (const char *dev) - dev); - } - --static void -+static int - grub_install_remove_efi_entries_by_distributor (const char *efi_distributor) - { - int fd; - pid_t pid = grub_util_exec_pipe ((const char * []){ "efibootmgr", NULL }, &fd); - char *line = NULL; - size_t len = 0; -+ int rc; - - if (!pid) - { - grub_util_warn (_("Unable to open stream from %s: %s"), - "efibootmgr", strerror (errno)); -- return; -+ return errno; - } - - FILE *fp = fdopen (fd, "r"); -@@ -98,7 +99,7 @@ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor) - { - grub_util_warn (_("Unable to open stream from %s: %s"), - "efibootmgr", strerror (errno)); -- return; -+ return errno; - } - - line = xmalloc (80); -@@ -119,23 +120,25 @@ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor) - bootnum = line + sizeof ("Boot") - 1; - bootnum[4] = '\0'; - if (!verbosity) -- grub_util_exec ((const char * []){ "efibootmgr", "-q", -+ rc = grub_util_exec ((const char * []){ "efibootmgr", "-q", - "-b", bootnum, "-B", NULL }); - else -- grub_util_exec ((const char * []){ "efibootmgr", -+ rc = grub_util_exec ((const char * []){ "efibootmgr", - "-b", bootnum, "-B", NULL }); - } - - free (line); -+ return rc; - } - --void -+int - grub_install_register_efi (grub_device_t efidir_grub_dev, - const char *efifile_path, - const char *efi_distributor) - { - const char * efidir_disk; - int efidir_part; -+ int ret; - efidir_disk = grub_util_biosdisk_get_osdev (efidir_grub_dev->disk); - efidir_part = efidir_grub_dev->disk->partition ? efidir_grub_dev->disk->partition->number + 1 : 1; - -@@ -151,23 +154,26 @@ grub_install_register_efi (grub_device_t efidir_grub_dev, - grub_util_exec ((const char * []){ "modprobe", "-q", "efivars", NULL }); - #endif - /* Delete old entries from the same distributor. */ -- grub_install_remove_efi_entries_by_distributor (efi_distributor); -+ ret = grub_install_remove_efi_entries_by_distributor (efi_distributor); -+ if (ret) -+ return ret; - - char *efidir_part_str = xasprintf ("%d", efidir_part); - - if (!verbosity) -- grub_util_exec ((const char * []){ "efibootmgr", "-q", -+ ret = grub_util_exec ((const char * []){ "efibootmgr", "-q", - "-c", "-d", efidir_disk, - "-p", efidir_part_str, "-w", - "-L", efi_distributor, "-l", - efifile_path, NULL }); - else -- grub_util_exec ((const char * []){ "efibootmgr", -+ ret = grub_util_exec ((const char * []){ "efibootmgr", - "-c", "-d", efidir_disk, - "-p", efidir_part_str, "-w", - "-L", efi_distributor, "-l", - efifile_path, NULL }); - free (efidir_part_str); -+ return ret; - } - - void -diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c -index 83bcba7791421825da6922a7ee346f4fd5fcd7a4..103f6796f39f38209b0f554842aa6697faa5df2f 100644 ---- a/grub-core/partmap/gpt.c -+++ b/grub-core/partmap/gpt.c -@@ -33,10 +33,10 @@ static grub_uint8_t grub_gpt_magic[8] = - 0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54 - }; - --static const grub_gpt_part_type_t grub_gpt_partition_type_empty = GRUB_GPT_PARTITION_TYPE_EMPTY; -+static const grub_gpt_part_guid_t grub_gpt_partition_type_empty = GRUB_GPT_PARTITION_TYPE_EMPTY; - - #ifdef GRUB_UTIL --static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT; -+static const grub_gpt_part_guid_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT; - #endif - - /* 512 << 7 = 65536 byte sectors. */ -diff --git a/grub-core/term/arm/cros.c b/grub-core/term/arm/cros.c -new file mode 100644 -index 0000000000000000000000000000000000000000..1ff9f8ccfb8270884ba962a05ca99df4c6ed1f41 ---- /dev/null -+++ b/grub-core/term/arm/cros.c -@@ -0,0 +1,125 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * -+ * Copyright (C) 2012 Google Inc. -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * This is based on depthcharge code. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct grub_ps2_state ps2_state; -+ -+struct grub_cros_ec_keyscan old_scan; -+ -+static const struct grub_fdtbus_dev *cros_ec; -+ -+static grub_uint8_t map_code[GRUB_CROS_EC_KEYSCAN_COLS][GRUB_CROS_EC_KEYSCAN_ROWS]; -+ -+static grub_uint8_t e0_translate[16] = -+ { -+ 0x1c, 0x1d, 0x35, 0x00, -+ 0x38, 0x00, 0x47, 0x48, -+ 0x49, 0x4b, 0x4d, 0x4f, -+ 0x50, 0x51, 0x52, 0x53, -+ }; -+ -+/* If there is a character pending, return it; -+ otherwise return GRUB_TERM_NO_KEY. */ -+static int -+grub_cros_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) -+{ -+ struct grub_cros_ec_keyscan scan; -+ int i, j; -+ if (grub_cros_ec_scan_keyboard (cros_ec, &scan) < 0) -+ return GRUB_TERM_NO_KEY; -+ for (i = 0; i < GRUB_CROS_EC_KEYSCAN_COLS; i++) -+ if (scan.data[i] ^ old_scan.data[i]) -+ for (j = 0; j < GRUB_CROS_EC_KEYSCAN_ROWS; j++) -+ if ((scan.data[i] ^ old_scan.data[i]) & (1 << j)) -+ { -+ grub_uint8_t code = map_code[i][j]; -+ int ret; -+ grub_uint8_t brk = 0; -+ if (!(scan.data[i] & (1 << j))) -+ brk = 0x80; -+ grub_dprintf ("cros_keyboard", "key <%d, %d> code %x\n", i, j, code); -+ if (code < 0x60) -+ ret = grub_ps2_process_incoming_byte (&ps2_state, code | brk); -+ else if (code >= 0x60 && code < 0x70 && e0_translate[code - 0x60]) -+ { -+ grub_ps2_process_incoming_byte (&ps2_state, 0xe0); -+ ret = grub_ps2_process_incoming_byte (&ps2_state, e0_translate[code - 0x60] | brk); -+ } -+ else -+ ret = GRUB_TERM_NO_KEY; -+ old_scan.data[i] ^= (1 << j); -+ if (ret != GRUB_TERM_NO_KEY) -+ return ret; -+ } -+ return GRUB_TERM_NO_KEY; -+} -+ -+static struct grub_term_input grub_cros_keyboard_term = -+ { -+ .name = "cros_keyboard", -+ .getkey = grub_cros_keyboard_getkey -+ }; -+ -+static grub_err_t -+cros_attach (const struct grub_fdtbus_dev *dev) -+{ -+ grub_size_t keymap_size, i; -+ const grub_uint8_t *keymap = grub_fdtbus_get_prop (dev, "linux,keymap", &keymap_size); -+ -+ if (!dev->parent || !grub_cros_ec_validate (dev->parent)) -+ return GRUB_ERR_IO; -+ -+ if (keymap) -+ { -+ for (i = 0; i + 3 < keymap_size; i += 4) -+ if (keymap[i+1] < GRUB_CROS_EC_KEYSCAN_COLS && keymap[i] < GRUB_CROS_EC_KEYSCAN_ROWS -+ && keymap[i+2] == 0 && keymap[i+3] < 0x80) -+ map_code[keymap[i+1]][keymap[i]] = keymap[i+3]; -+ } -+ -+ cros_ec = dev->parent; -+ ps2_state.current_set = 1; -+ ps2_state.at_keyboard_status = 0; -+ grub_term_register_input ("cros_keyboard", &grub_cros_keyboard_term); -+ return GRUB_ERR_NONE; -+} -+ -+static struct grub_fdtbus_driver cros = -+{ -+ .compatible = "google,cros-ec-keyb", -+ .attach = cros_attach -+}; -+ -+void -+grub_cros_init (void) -+{ -+ grub_fdtbus_register (&cros); -+} -diff --git a/grub-core/term/arm/cros_ec.c b/grub-core/term/arm/cros_ec.c -new file mode 100644 -index 0000000000000000000000000000000000000000..f4144818b5bfdb9a512316ccc321586d539653ac ---- /dev/null -+++ b/grub-core/term/arm/cros_ec.c -@@ -0,0 +1,238 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * -+ * Copyright (C) 2012 Google Inc. -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * This is based on depthcharge code. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static const grub_uint64_t FRAMING_TIMEOUT_MS = 300; -+ -+static const grub_uint8_t EC_FRAMING_BYTE = 0xec; -+ -+#define EC_CMD_MKBP_STATE 0x60 -+#define EC_CMD_VERSION0 0xdc -+ -+static grub_uint64_t last_transfer; -+ -+static void -+stop_bus (const struct grub_fdtbus_dev *spi) -+{ -+ spi->driver->stop (spi); -+ last_transfer = grub_get_time_ms (); -+} -+ -+static int -+wait_for_frame (const struct grub_fdtbus_dev *spi) -+{ -+ grub_uint64_t start = grub_get_time_ms (); -+ grub_uint8_t byte; -+ do -+ { -+ if (spi->driver->receive (spi, &byte, 1)) -+ return -1; -+ if (byte != EC_FRAMING_BYTE && -+ grub_get_time_ms () - start > FRAMING_TIMEOUT_MS) -+ { -+ grub_dprintf ("cros", "Timeout waiting for framing byte.\n"); -+ return -1; -+ } -+ } -+ while (byte != EC_FRAMING_BYTE); -+ return 0; -+} -+ -+/* -+ * Calculate a simple 8-bit checksum of a data block -+ * -+ * @param data Data block to checksum -+ * @param size Size of data block in bytes -+ * @return checksum value (0 to 255) -+ */ -+static grub_uint8_t -+cros_ec_calc_checksum (const void *data, int size) -+{ -+ grub_uint8_t csum; -+ const grub_uint8_t *bytes = data; -+ int i; -+ -+ for (i = csum = 0; i < size; i++) -+ csum += bytes[i]; -+ return csum & 0xff; -+} -+ -+enum -+{ -+ /* response, arglen */ -+ CROS_EC_SPI_IN_HDR_SIZE = 2, -+ /* version, cmd, arglen */ -+ CROS_EC_SPI_OUT_HDR_SIZE = 3 -+}; -+ -+static grub_uint8_t busbuf[256]; -+#define MSG_BYTES ((int)sizeof (busbuf)) -+ -+static int -+ec_command (const struct grub_fdtbus_dev *dev, int cmd, int cmd_version, -+ const void *dout, int dout_len, void *din, int din_len) -+{ -+ const struct grub_fdtbus_dev *spi = dev->parent; -+ grub_uint8_t *bytes; -+ -+ /* Header + data + checksum. */ -+ grub_uint32_t out_bytes = CROS_EC_SPI_OUT_HDR_SIZE + dout_len + 1; -+ grub_uint32_t in_bytes = CROS_EC_SPI_IN_HDR_SIZE + din_len + 1; -+ -+ /* -+ * Sanity-check I/O sizes given transaction overhead in internal -+ * buffers. -+ */ -+ if (out_bytes > MSG_BYTES) -+ { -+ grub_dprintf ("cros", "Cannot send %d bytes\n", dout_len); -+ return -1; -+ } -+ if (in_bytes > MSG_BYTES) -+ { -+ grub_dprintf ("cros", "Cannot receive %d bytes\n", din_len); -+ return -1; -+ } -+ -+ /* Prepare the output. */ -+ bytes = busbuf; -+ *bytes++ = EC_CMD_VERSION0 + cmd_version; -+ *bytes++ = cmd; -+ *bytes++ = dout_len; -+ grub_memcpy (bytes, dout, dout_len); -+ bytes += dout_len; -+ -+ *bytes++ = cros_ec_calc_checksum (busbuf, -+ CROS_EC_SPI_OUT_HDR_SIZE + dout_len); -+ -+ /* Depthcharge uses 200 us here but GRUB timer resolution is only 1ms, -+ decrease this when we increase timer resolution. */ -+ while (grub_get_time_ms () - last_transfer < 1) -+ ; -+ -+ if (spi->driver->start (spi)) -+ return -1; -+ -+ /* Allow EC to ramp up clock after being awoken. */ -+ /* Depthcharge only waits 100 us here but GRUB timer resolution is only 1ms, -+ decrease this when we increase timer resolution. */ -+ grub_millisleep (1); -+ -+ if (spi->driver->send (spi, busbuf, out_bytes)) -+ { -+ stop_bus (spi); -+ return -1; -+ } -+ -+ /* Wait until the EC is ready. */ -+ if (wait_for_frame (spi)) -+ { -+ stop_bus (spi); -+ return -1; -+ } -+ -+ /* Read the response code and the data length. */ -+ bytes = busbuf; -+ if (spi->driver->receive (spi, bytes, 2)) -+ { -+ stop_bus (spi); -+ return -1; -+ } -+ grub_uint8_t result = *bytes++; -+ grub_uint8_t length = *bytes++; -+ -+ /* Make sure there's enough room for the data. */ -+ if (CROS_EC_SPI_IN_HDR_SIZE + length + 1 > MSG_BYTES) -+ { -+ grub_dprintf ("cros", "Received length %#02x too large\n", length); -+ stop_bus (spi); -+ return -1; -+ } -+ -+ /* Read the data and the checksum, and finish up. */ -+ if (spi->driver->receive (spi, bytes, length + 1)) -+ { -+ stop_bus (spi); -+ return -1; -+ } -+ bytes += length; -+ int expected = *bytes++; -+ stop_bus (spi); -+ -+ /* Check the integrity of the response. */ -+ if (result != 0) -+ { -+ grub_dprintf ("cros", "Received bad result code %d\n", result); -+ return -result; -+ } -+ -+ int csum = cros_ec_calc_checksum (busbuf, -+ CROS_EC_SPI_IN_HDR_SIZE + length); -+ -+ if (csum != expected) -+ { -+ grub_dprintf ("cros", "Invalid checksum rx %#02x, calced %#02x\n", -+ expected, csum); -+ return -1; -+ } -+ -+ /* If the caller wants the response, copy it out for them. */ -+ if (length < din_len) -+ din_len = length; -+ if (din) -+ { -+ grub_memcpy (din, (grub_uint8_t *) busbuf + CROS_EC_SPI_IN_HDR_SIZE, din_len); -+ } -+ -+ return din_len; -+} -+ -+int -+grub_cros_ec_scan_keyboard (const struct grub_fdtbus_dev *dev, struct grub_cros_ec_keyscan *scan) -+{ -+ if (ec_command (dev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan, -+ sizeof (*scan)) < (int) sizeof (*scan)) -+ return -1; -+ -+ return 0; -+} -+ -+int -+grub_cros_ec_validate (const struct grub_fdtbus_dev *dev) -+{ -+ if (!grub_fdtbus_is_compatible("google,cros-ec-spi", dev)) -+ return 0; -+ if (!dev->parent) -+ return 0; -+ if (!dev->parent->driver) -+ return 0; -+ if (!dev->parent->driver->send -+ || !dev->parent->driver->receive) -+ return 0; -+ return 1; -+} -+ -diff --git a/grub-core/term/arm/pl050.c b/grub-core/term/arm/pl050.c -new file mode 100644 -index 0000000000000000000000000000000000000000..e4cda305666df20eba26e10d74b879361e83d6ea ---- /dev/null -+++ b/grub-core/term/arm/pl050.c -@@ -0,0 +1,189 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static volatile grub_uint32_t *pl050_regs; -+ -+struct grub_ps2_state ps2_state; -+ -+static void -+keyboard_controller_wait_until_ready (void) -+{ -+ while (! (pl050_regs[1] & 0x40)); -+} -+ -+static grub_uint8_t -+wait_ack (void) -+{ -+ grub_uint64_t endtime; -+ grub_uint8_t ack; -+ -+ endtime = grub_get_time_ms () + 20; -+ do -+ ack = pl050_regs[2]; -+ while (ack != GRUB_AT_ACK && ack != GRUB_AT_NACK -+ && grub_get_time_ms () < endtime); -+ return ack; -+} -+ -+ -+static int -+write_mode (int mode) -+{ -+ unsigned i; -+ for (i = 0; i < GRUB_AT_TRIES; i++) -+ { -+ grub_uint8_t ack; -+ keyboard_controller_wait_until_ready (); -+ pl050_regs[2] = 0xf0; -+ keyboard_controller_wait_until_ready (); -+ pl050_regs[2] = mode; -+ keyboard_controller_wait_until_ready (); -+ ack = wait_ack (); -+ if (ack == GRUB_AT_NACK) -+ continue; -+ if (ack == GRUB_AT_ACK) -+ break; -+ return 0; -+ } -+ -+ return (i != GRUB_AT_TRIES); -+} -+ -+static int -+query_mode (void) -+{ -+ grub_uint8_t ret; -+ int e; -+ -+ e = write_mode (0); -+ if (!e) -+ return 0; -+ -+ keyboard_controller_wait_until_ready (); -+ -+ do -+ ret = pl050_regs[2]; -+ while (ret == GRUB_AT_ACK); -+ -+ /* QEMU translates the set even in no-translate mode. */ -+ if (ret == 0x43 || ret == 1) -+ return 1; -+ if (ret == 0x41 || ret == 2) -+ return 2; -+ if (ret == 0x3f || ret == 3) -+ return 3; -+ return 0; -+} -+ -+static void -+set_scancodes (void) -+{ -+ write_mode (2); -+ ps2_state.current_set = query_mode (); -+ grub_dprintf ("atkeyb", "returned set %d\n", ps2_state.current_set); -+ if (ps2_state.current_set == 2) -+ return; -+ -+ write_mode (1); -+ ps2_state.current_set = query_mode (); -+ grub_dprintf ("atkeyb", "returned set %d\n", ps2_state.current_set); -+ if (ps2_state.current_set == 1) -+ return; -+ grub_dprintf ("atkeyb", "no supported scancode set found\n"); -+} -+ -+static void -+keyboard_controller_led (grub_uint8_t leds) -+{ -+ keyboard_controller_wait_until_ready (); -+ pl050_regs[2] = 0xed; -+ keyboard_controller_wait_until_ready (); -+ pl050_regs[2] = leds & 0x7; -+} -+ -+/* If there is a character pending, return it; -+ otherwise return GRUB_TERM_NO_KEY. */ -+static int -+grub_pl050_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) -+{ -+ grub_uint8_t at_key; -+ int ret; -+ grub_uint8_t old_led; -+ -+ if (!(pl050_regs[1] & 0x10)) -+ return -1; -+ at_key = pl050_regs[2]; -+ old_led = ps2_state.led_status; -+ -+ ret = grub_ps2_process_incoming_byte (&ps2_state, at_key); -+ if (old_led != ps2_state.led_status) -+ keyboard_controller_led (ps2_state.led_status); -+ return ret; -+} -+ -+static struct grub_term_input grub_pl050_keyboard_term = -+ { -+ .name = "pl050_keyboard", -+ .getkey = grub_pl050_keyboard_getkey -+ }; -+ -+static grub_err_t -+pl050_attach(const struct grub_fdtbus_dev *dev) -+{ -+ const grub_uint32_t *reg; -+ reg = grub_fdtbus_get_prop (dev, "reg", 0); -+ -+ /* Mouse. Nothing to do. */ -+ if (grub_be_to_cpu32 (*reg) == 0x7000) -+ return 0; -+ -+ pl050_regs = grub_fdtbus_map_reg (dev, 0, 0); -+ -+ if (!grub_fdtbus_is_mapping_valid (pl050_regs)) -+ return grub_error (GRUB_ERR_IO, "could not map pl050"); -+ -+ ps2_state.at_keyboard_status = 0; -+ set_scancodes (); -+ keyboard_controller_led (ps2_state.led_status); -+ -+ grub_term_register_input ("pl050_keyboard", &grub_pl050_keyboard_term); -+ return GRUB_ERR_NONE; -+} -+ -+struct grub_fdtbus_driver pl050 = -+{ -+ .compatible = "arm,pl050", -+ .attach = pl050_attach -+}; -+ -+void -+grub_pl050_init (void) -+{ -+ grub_fdtbus_register (&pl050); -+} -diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index b4ea9ff7e637f59c653b86cea79d4d664c78af84..f0a986eb176aef6c4fe3f5a65c646756e5bbde56 100644 ---- a/grub-core/term/at_keyboard.c -+++ b/grub-core/term/at_keyboard.c -@@ -22,215 +22,26 @@ - #include - #include - #include --#include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - --static short at_keyboard_status = 0; --static int e0_received = 0; --static int f0_received = 0; -- --static grub_uint8_t led_status; -- --#define KEYBOARD_LED_SCROLL (1 << 0) --#define KEYBOARD_LED_NUM (1 << 1) --#define KEYBOARD_LED_CAPS (1 << 2) -- - static grub_uint8_t grub_keyboard_controller_orig; - static grub_uint8_t grub_keyboard_orig_set; --static grub_uint8_t current_set; -- --static void --grub_keyboard_controller_init (void); -- --static const grub_uint8_t set1_mapping[128] = -- { -- /* 0x00 */ 0 /* Unused */, GRUB_KEYBOARD_KEY_ESCAPE, -- /* 0x02 */ GRUB_KEYBOARD_KEY_1, GRUB_KEYBOARD_KEY_2, -- /* 0x04 */ GRUB_KEYBOARD_KEY_3, GRUB_KEYBOARD_KEY_4, -- /* 0x06 */ GRUB_KEYBOARD_KEY_5, GRUB_KEYBOARD_KEY_6, -- /* 0x08 */ GRUB_KEYBOARD_KEY_7, GRUB_KEYBOARD_KEY_8, -- /* 0x0a */ GRUB_KEYBOARD_KEY_9, GRUB_KEYBOARD_KEY_0, -- /* 0x0c */ GRUB_KEYBOARD_KEY_DASH, GRUB_KEYBOARD_KEY_EQUAL, -- /* 0x0e */ GRUB_KEYBOARD_KEY_BACKSPACE, GRUB_KEYBOARD_KEY_TAB, -- /* 0x10 */ GRUB_KEYBOARD_KEY_Q, GRUB_KEYBOARD_KEY_W, -- /* 0x12 */ GRUB_KEYBOARD_KEY_E, GRUB_KEYBOARD_KEY_R, -- /* 0x14 */ GRUB_KEYBOARD_KEY_T, GRUB_KEYBOARD_KEY_Y, -- /* 0x16 */ GRUB_KEYBOARD_KEY_U, GRUB_KEYBOARD_KEY_I, -- /* 0x18 */ GRUB_KEYBOARD_KEY_O, GRUB_KEYBOARD_KEY_P, -- /* 0x1a */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_RBRACKET, -- /* 0x1c */ GRUB_KEYBOARD_KEY_ENTER, GRUB_KEYBOARD_KEY_LEFT_CTRL, -- /* 0x1e */ GRUB_KEYBOARD_KEY_A, GRUB_KEYBOARD_KEY_S, -- /* 0x20 */ GRUB_KEYBOARD_KEY_D, GRUB_KEYBOARD_KEY_F, -- /* 0x22 */ GRUB_KEYBOARD_KEY_G, GRUB_KEYBOARD_KEY_H, -- /* 0x24 */ GRUB_KEYBOARD_KEY_J, GRUB_KEYBOARD_KEY_K, -- /* 0x26 */ GRUB_KEYBOARD_KEY_L, GRUB_KEYBOARD_KEY_SEMICOLON, -- /* 0x28 */ GRUB_KEYBOARD_KEY_DQUOTE, GRUB_KEYBOARD_KEY_RQUOTE, -- /* 0x2a */ GRUB_KEYBOARD_KEY_LEFT_SHIFT, GRUB_KEYBOARD_KEY_BACKSLASH, -- /* 0x2c */ GRUB_KEYBOARD_KEY_Z, GRUB_KEYBOARD_KEY_X, -- /* 0x2e */ GRUB_KEYBOARD_KEY_C, GRUB_KEYBOARD_KEY_V, -- /* 0x30 */ GRUB_KEYBOARD_KEY_B, GRUB_KEYBOARD_KEY_N, -- /* 0x32 */ GRUB_KEYBOARD_KEY_M, GRUB_KEYBOARD_KEY_COMMA, -- /* 0x34 */ GRUB_KEYBOARD_KEY_DOT, GRUB_KEYBOARD_KEY_SLASH, -- /* 0x36 */ GRUB_KEYBOARD_KEY_RIGHT_SHIFT, GRUB_KEYBOARD_KEY_NUMMUL, -- /* 0x38 */ GRUB_KEYBOARD_KEY_LEFT_ALT, GRUB_KEYBOARD_KEY_SPACE, -- /* 0x3a */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_F1, -- /* 0x3c */ GRUB_KEYBOARD_KEY_F2, GRUB_KEYBOARD_KEY_F3, -- /* 0x3e */ GRUB_KEYBOARD_KEY_F4, GRUB_KEYBOARD_KEY_F5, -- /* 0x40 */ GRUB_KEYBOARD_KEY_F6, GRUB_KEYBOARD_KEY_F7, -- /* 0x42 */ GRUB_KEYBOARD_KEY_F8, GRUB_KEYBOARD_KEY_F9, -- /* 0x44 */ GRUB_KEYBOARD_KEY_F10, GRUB_KEYBOARD_KEY_NUM_LOCK, -- /* 0x46 */ GRUB_KEYBOARD_KEY_SCROLL_LOCK, GRUB_KEYBOARD_KEY_NUM7, -- /* 0x48 */ GRUB_KEYBOARD_KEY_NUM8, GRUB_KEYBOARD_KEY_NUM9, -- /* 0x4a */ GRUB_KEYBOARD_KEY_NUMMINUS, GRUB_KEYBOARD_KEY_NUM4, -- /* 0x4c */ GRUB_KEYBOARD_KEY_NUM5, GRUB_KEYBOARD_KEY_NUM6, -- /* 0x4e */ GRUB_KEYBOARD_KEY_NUMPLUS, GRUB_KEYBOARD_KEY_NUM1, -- /* 0x50 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM3, -- /* 0x52 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, -- /* 0x54 */ 0, 0, -- /* 0x56 */ GRUB_KEYBOARD_KEY_102ND, GRUB_KEYBOARD_KEY_F11, -- /* 0x58 */ GRUB_KEYBOARD_KEY_F12, 0, -- /* 0x5a */ 0, 0, -- /* 0x5c */ 0, 0, -- /* 0x5e */ 0, 0, -- /* 0x60 */ 0, 0, -- /* 0x62 */ 0, 0, -- /* OLPC keys. Just mapped to normal keys. */ -- /* 0x64 */ 0, GRUB_KEYBOARD_KEY_UP, -- /* 0x66 */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_LEFT, -- /* 0x68 */ GRUB_KEYBOARD_KEY_RIGHT, 0, -- /* 0x6a */ 0, 0, -- /* 0x6c */ 0, 0, -- /* 0x6e */ 0, 0, -- /* 0x70 */ 0, 0, -- /* 0x72 */ 0, GRUB_KEYBOARD_KEY_JP_RO, -- /* 0x74 */ 0, 0, -- /* 0x76 */ 0, 0, -- /* 0x78 */ 0, 0, -- /* 0x7a */ 0, 0, -- /* 0x7c */ 0, GRUB_KEYBOARD_KEY_JP_YEN, -- /* 0x7e */ GRUB_KEYBOARD_KEY_KPCOMMA -- }; -- --static const struct --{ -- grub_uint8_t from, to; --} set1_e0_mapping[] = -- { -- {0x1c, GRUB_KEYBOARD_KEY_NUMENTER}, -- {0x1d, GRUB_KEYBOARD_KEY_RIGHT_CTRL}, -- {0x35, GRUB_KEYBOARD_KEY_NUMSLASH }, -- {0x38, GRUB_KEYBOARD_KEY_RIGHT_ALT}, -- {0x47, GRUB_KEYBOARD_KEY_HOME}, -- {0x48, GRUB_KEYBOARD_KEY_UP}, -- {0x49, GRUB_KEYBOARD_KEY_PPAGE}, -- {0x4b, GRUB_KEYBOARD_KEY_LEFT}, -- {0x4d, GRUB_KEYBOARD_KEY_RIGHT}, -- {0x4f, GRUB_KEYBOARD_KEY_END}, -- {0x50, GRUB_KEYBOARD_KEY_DOWN}, -- {0x51, GRUB_KEYBOARD_KEY_NPAGE}, -- {0x52, GRUB_KEYBOARD_KEY_INSERT}, -- {0x53, GRUB_KEYBOARD_KEY_DELETE}, -- }; -- --static const grub_uint8_t set2_mapping[256] = -- { -- /* 0x00 */ 0, GRUB_KEYBOARD_KEY_F9, -- /* 0x02 */ 0, GRUB_KEYBOARD_KEY_F5, -- /* 0x04 */ GRUB_KEYBOARD_KEY_F3, GRUB_KEYBOARD_KEY_F1, -- /* 0x06 */ GRUB_KEYBOARD_KEY_F2, GRUB_KEYBOARD_KEY_F12, -- /* 0x08 */ 0, GRUB_KEYBOARD_KEY_F10, -- /* 0x0a */ GRUB_KEYBOARD_KEY_F8, GRUB_KEYBOARD_KEY_F6, -- /* 0x0c */ GRUB_KEYBOARD_KEY_F4, GRUB_KEYBOARD_KEY_TAB, -- /* 0x0e */ GRUB_KEYBOARD_KEY_RQUOTE, 0, -- /* 0x10 */ 0, GRUB_KEYBOARD_KEY_LEFT_ALT, -- /* 0x12 */ GRUB_KEYBOARD_KEY_LEFT_SHIFT, 0, -- /* 0x14 */ GRUB_KEYBOARD_KEY_LEFT_CTRL, GRUB_KEYBOARD_KEY_Q, -- /* 0x16 */ GRUB_KEYBOARD_KEY_1, 0, -- /* 0x18 */ 0, 0, -- /* 0x1a */ GRUB_KEYBOARD_KEY_Z, GRUB_KEYBOARD_KEY_S, -- /* 0x1c */ GRUB_KEYBOARD_KEY_A, GRUB_KEYBOARD_KEY_W, -- /* 0x1e */ GRUB_KEYBOARD_KEY_2, 0, -- /* 0x20 */ 0, GRUB_KEYBOARD_KEY_C, -- /* 0x22 */ GRUB_KEYBOARD_KEY_X, GRUB_KEYBOARD_KEY_D, -- /* 0x24 */ GRUB_KEYBOARD_KEY_E, GRUB_KEYBOARD_KEY_4, -- /* 0x26 */ GRUB_KEYBOARD_KEY_3, 0, -- /* 0x28 */ 0, GRUB_KEYBOARD_KEY_SPACE, -- /* 0x2a */ GRUB_KEYBOARD_KEY_V, GRUB_KEYBOARD_KEY_F, -- /* 0x2c */ GRUB_KEYBOARD_KEY_T, GRUB_KEYBOARD_KEY_R, -- /* 0x2e */ GRUB_KEYBOARD_KEY_5, 0, -- /* 0x30 */ 0, GRUB_KEYBOARD_KEY_N, -- /* 0x32 */ GRUB_KEYBOARD_KEY_B, GRUB_KEYBOARD_KEY_H, -- /* 0x34 */ GRUB_KEYBOARD_KEY_G, GRUB_KEYBOARD_KEY_Y, -- /* 0x36 */ GRUB_KEYBOARD_KEY_6, 0, -- /* 0x38 */ 0, 0, -- /* 0x3a */ GRUB_KEYBOARD_KEY_M, GRUB_KEYBOARD_KEY_J, -- /* 0x3c */ GRUB_KEYBOARD_KEY_U, GRUB_KEYBOARD_KEY_7, -- /* 0x3e */ GRUB_KEYBOARD_KEY_8, 0, -- /* 0x40 */ 0, GRUB_KEYBOARD_KEY_COMMA, -- /* 0x42 */ GRUB_KEYBOARD_KEY_K, GRUB_KEYBOARD_KEY_I, -- /* 0x44 */ GRUB_KEYBOARD_KEY_O, GRUB_KEYBOARD_KEY_0, -- /* 0x46 */ GRUB_KEYBOARD_KEY_9, 0, -- /* 0x48 */ 0, GRUB_KEYBOARD_KEY_DOT, -- /* 0x4a */ GRUB_KEYBOARD_KEY_SLASH, GRUB_KEYBOARD_KEY_L, -- /* 0x4c */ GRUB_KEYBOARD_KEY_SEMICOLON, GRUB_KEYBOARD_KEY_P, -- /* 0x4e */ GRUB_KEYBOARD_KEY_DASH, 0, -- /* 0x50 */ 0, GRUB_KEYBOARD_KEY_JP_RO, -- /* 0x52 */ GRUB_KEYBOARD_KEY_DQUOTE, 0, -- /* 0x54 */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_EQUAL, -- /* 0x56 */ 0, 0, -- /* 0x58 */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_RIGHT_SHIFT, -- /* 0x5a */ GRUB_KEYBOARD_KEY_ENTER, GRUB_KEYBOARD_KEY_RBRACKET, -- /* 0x5c */ 0, GRUB_KEYBOARD_KEY_BACKSLASH, -- /* 0x5e */ 0, 0, -- /* 0x60 */ 0, GRUB_KEYBOARD_KEY_102ND, -- /* 0x62 */ 0, 0, -- /* 0x64 */ 0, 0, -- /* 0x66 */ GRUB_KEYBOARD_KEY_BACKSPACE, 0, -- /* 0x68 */ 0, GRUB_KEYBOARD_KEY_NUM1, -- /* 0x6a */ GRUB_KEYBOARD_KEY_JP_YEN, GRUB_KEYBOARD_KEY_NUM4, -- /* 0x6c */ GRUB_KEYBOARD_KEY_NUM7, GRUB_KEYBOARD_KEY_KPCOMMA, -- /* 0x6e */ 0, 0, -- /* 0x70 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, -- /* 0x72 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM5, -- /* 0x74 */ GRUB_KEYBOARD_KEY_NUM6, GRUB_KEYBOARD_KEY_NUM8, -- /* 0x76 */ GRUB_KEYBOARD_KEY_ESCAPE, GRUB_KEYBOARD_KEY_NUM_LOCK, -- /* 0x78 */ GRUB_KEYBOARD_KEY_F11, GRUB_KEYBOARD_KEY_NUMPLUS, -- /* 0x7a */ GRUB_KEYBOARD_KEY_NUM3, GRUB_KEYBOARD_KEY_NUMMINUS, -- /* 0x7c */ GRUB_KEYBOARD_KEY_NUMMUL, GRUB_KEYBOARD_KEY_NUM9, -- /* 0x7e */ GRUB_KEYBOARD_KEY_SCROLL_LOCK, 0, -- /* 0x80 */ 0, 0, -- /* 0x82 */ 0, GRUB_KEYBOARD_KEY_F7, -- }; -- --static const struct --{ -- grub_uint8_t from, to; --} set2_e0_mapping[] = -- { -- {0x11, GRUB_KEYBOARD_KEY_RIGHT_ALT}, -- {0x14, GRUB_KEYBOARD_KEY_RIGHT_CTRL}, -- {0x4a, GRUB_KEYBOARD_KEY_NUMSLASH}, -- {0x5a, GRUB_KEYBOARD_KEY_NUMENTER}, -- {0x69, GRUB_KEYBOARD_KEY_END}, -- {0x6b, GRUB_KEYBOARD_KEY_LEFT}, -- {0x6c, GRUB_KEYBOARD_KEY_HOME}, -- {0x70, GRUB_KEYBOARD_KEY_INSERT}, -- {0x71, GRUB_KEYBOARD_KEY_DELETE}, -- {0x72, GRUB_KEYBOARD_KEY_DOWN}, -- {0x74, GRUB_KEYBOARD_KEY_RIGHT}, -- {0x75, GRUB_KEYBOARD_KEY_UP}, -- {0x7a, GRUB_KEYBOARD_KEY_NPAGE}, -- {0x7d, GRUB_KEYBOARD_KEY_PPAGE}, -- }; -+struct grub_ps2_state ps2_state; - - static int ping_sent; - -+static void -+grub_keyboard_controller_init (void); -+ - static void - keyboard_controller_wait_until_ready (void) - { -+ /* 50 us would be enough but our current time resolution is 1ms. */ -+ grub_millisleep (1); - while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))); - } - -@@ -241,10 +52,11 @@ wait_ack (void) - grub_uint8_t ack; - - endtime = grub_get_time_ms () + 20; -- do -+ do { -+ keyboard_controller_wait_until_ready (); - ack = grub_inb (KEYBOARD_REG_DATA); -- while (ack != GRUB_AT_ACK && ack != GRUB_AT_NACK -- && grub_get_time_ms () < endtime); -+ } while (ack != GRUB_AT_ACK && ack != GRUB_AT_NACK -+ && grub_get_time_ms () < endtime); - return ack; - } - -@@ -326,12 +138,10 @@ query_mode (void) - if (!e) - return 0; - -- keyboard_controller_wait_until_ready (); -- -- do -+ do { -+ keyboard_controller_wait_until_ready (); - ret = grub_inb (KEYBOARD_REG_DATA); -- while (ret == GRUB_AT_ACK); -- -+ } while (ret == GRUB_AT_ACK); - /* QEMU translates the set even in no-translate mode. */ - if (ret == 0x43 || ret == 1) - return 1; -@@ -350,28 +160,32 @@ set_scancodes (void) - if (!grub_keyboard_orig_set) - { - grub_dprintf ("atkeyb", "No sets support assumed\n"); -- current_set = 1; -+ ps2_state.current_set = 1; - return; - } - - #if !USE_SCANCODE_SET -- current_set = 1; -+ ps2_state.current_set = 1; - return; - #else - - grub_keyboard_controller_write (grub_keyboard_controller_orig -- & ~KEYBOARD_AT_TRANSLATE); -+ & ~KEYBOARD_AT_TRANSLATE -+ & ~KEYBOARD_AT_DISABLE); -+ -+ keyboard_controller_wait_until_ready (); -+ grub_outb (KEYBOARD_COMMAND_ENABLE, KEYBOARD_REG_DATA); - - write_mode (2); -- current_set = query_mode (); -- grub_dprintf ("atkeyb", "returned set %d\n", current_set); -- if (current_set == 2) -+ ps2_state.current_set = query_mode (); -+ grub_dprintf ("atkeyb", "returned set %d\n", ps2_state.current_set); -+ if (ps2_state.current_set == 2) - return; - - write_mode (1); -- current_set = query_mode (); -- grub_dprintf ("atkeyb", "returned set %d\n", current_set); -- if (current_set == 1) -+ ps2_state.current_set = query_mode (); -+ grub_dprintf ("atkeyb", "returned set %d\n", ps2_state.current_set); -+ if (ps2_state.current_set == 1) - return; - grub_dprintf ("atkeyb", "no supported scancode set found\n"); - #endif -@@ -386,164 +200,10 @@ keyboard_controller_led (grub_uint8_t leds) - grub_outb (leds & 0x7, KEYBOARD_REG_DATA); - } - --static int --fetch_key (int *is_break) --{ -- int was_ext = 0; -- grub_uint8_t at_key; -- int ret = 0; -- -- if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) -- return -1; -- at_key = grub_inb (KEYBOARD_REG_DATA); -- /* May happen if no keyboard is connected. Just ignore this. */ -- if (at_key == 0xff) -- return -1; -- if (at_key == 0xe0) -- { -- e0_received = 1; -- return -1; -- } -- -- if ((current_set == 2 || current_set == 3) && at_key == 0xf0) -- { -- f0_received = 1; -- return -1; -- } -- -- /* Setting LEDs may generate ACKs. */ -- if (at_key == GRUB_AT_ACK) -- return -1; -- -- was_ext = e0_received; -- e0_received = 0; -- -- switch (current_set) -- { -- case 1: -- *is_break = !!(at_key & 0x80); -- if (!was_ext) -- ret = set1_mapping[at_key & 0x7f]; -- else -- { -- unsigned i; -- for (i = 0; i < ARRAY_SIZE (set1_e0_mapping); i++) -- if (set1_e0_mapping[i].from == (at_key & 0x7f)) -- { -- ret = set1_e0_mapping[i].to; -- break; -- } -- } -- break; -- case 2: -- *is_break = f0_received; -- f0_received = 0; -- if (!was_ext) -- ret = set2_mapping[at_key]; -- else -- { -- unsigned i; -- for (i = 0; i < ARRAY_SIZE (set2_e0_mapping); i++) -- if (set2_e0_mapping[i].from == at_key) -- { -- ret = set2_e0_mapping[i].to; -- break; -- } -- } -- break; -- default: -- return -1; -- } -- if (!ret) -- { -- if (was_ext) -- grub_dprintf ("atkeyb", "Unknown key 0xe0+0x%02x from set %d\n", -- at_key, current_set); -- else -- grub_dprintf ("atkeyb", "Unknown key 0x%02x from set %d\n", -- at_key, current_set); -- return -1; -- } -- return ret; --} -- --/* FIXME: This should become an interrupt service routine. For now -- it's just used to catch events from control keys. */ --static int --grub_keyboard_isr (grub_keyboard_key_t key, int is_break) --{ -- if (!is_break) -- switch (key) -- { -- case GRUB_KEYBOARD_KEY_LEFT_SHIFT: -- at_keyboard_status |= GRUB_TERM_STATUS_LSHIFT; -- return 1; -- case GRUB_KEYBOARD_KEY_RIGHT_SHIFT: -- at_keyboard_status |= GRUB_TERM_STATUS_RSHIFT; -- return 1; -- case GRUB_KEYBOARD_KEY_LEFT_CTRL: -- at_keyboard_status |= GRUB_TERM_STATUS_LCTRL; -- return 1; -- case GRUB_KEYBOARD_KEY_RIGHT_CTRL: -- at_keyboard_status |= GRUB_TERM_STATUS_RCTRL; -- return 1; -- case GRUB_KEYBOARD_KEY_RIGHT_ALT: -- at_keyboard_status |= GRUB_TERM_STATUS_RALT; -- return 1; -- case GRUB_KEYBOARD_KEY_LEFT_ALT: -- at_keyboard_status |= GRUB_TERM_STATUS_LALT; -- return 1; -- default: -- return 0; -- } -- else -- switch (key) -- { -- case GRUB_KEYBOARD_KEY_LEFT_SHIFT: -- at_keyboard_status &= ~GRUB_TERM_STATUS_LSHIFT; -- return 1; -- case GRUB_KEYBOARD_KEY_RIGHT_SHIFT: -- at_keyboard_status &= ~GRUB_TERM_STATUS_RSHIFT; -- return 1; -- case GRUB_KEYBOARD_KEY_LEFT_CTRL: -- at_keyboard_status &= ~GRUB_TERM_STATUS_LCTRL; -- return 1; -- case GRUB_KEYBOARD_KEY_RIGHT_CTRL: -- at_keyboard_status &= ~GRUB_TERM_STATUS_RCTRL; -- return 1; -- case GRUB_KEYBOARD_KEY_RIGHT_ALT: -- at_keyboard_status &= ~GRUB_TERM_STATUS_RALT; -- return 1; -- case GRUB_KEYBOARD_KEY_LEFT_ALT: -- at_keyboard_status &= ~GRUB_TERM_STATUS_LALT; -- return 1; -- default: -- return 0; -- } --} -- --/* If there is a raw key pending, return it; otherwise return -1. */ --static int --grub_keyboard_getkey (void) --{ -- int key; -- int is_break = 0; -- -- key = fetch_key (&is_break); -- if (key == -1) -- return -1; -- -- if (grub_keyboard_isr (key, is_break)) -- return -1; -- if (is_break) -- return -1; -- return key; --} -- - int - grub_at_keyboard_is_alive (void) - { -- if (current_set != 0) -+ if (ps2_state.current_set != 0) - return 1; - if (ping_sent - && KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)) -@@ -566,51 +226,28 @@ grub_at_keyboard_is_alive (void) - static int - grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) - { -- int code; -+ grub_uint8_t at_key; -+ int ret; -+ grub_uint8_t old_led; - - if (!grub_at_keyboard_is_alive ()) - return GRUB_TERM_NO_KEY; - -- code = grub_keyboard_getkey (); -- if (code == -1) -- return GRUB_TERM_NO_KEY; --#ifdef DEBUG_AT_KEYBOARD -- grub_dprintf ("atkeyb", "Detected key 0x%x\n", code); --#endif -- switch (code) -- { -- case GRUB_KEYBOARD_KEY_CAPS_LOCK: -- at_keyboard_status ^= GRUB_TERM_STATUS_CAPS; -- led_status ^= KEYBOARD_LED_CAPS; -- keyboard_controller_led (led_status); -+ if (! KEYBOARD_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) -+ return -1; -+ at_key = grub_inb (KEYBOARD_REG_DATA); -+ old_led = ps2_state.led_status; - --#ifdef DEBUG_AT_KEYBOARD -- grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(at_keyboard_status & GRUB_KEYBOARD_STATUS_CAPS_LOCK)); --#endif -- return GRUB_TERM_NO_KEY; -- case GRUB_KEYBOARD_KEY_NUM_LOCK: -- at_keyboard_status ^= GRUB_TERM_STATUS_NUM; -- led_status ^= KEYBOARD_LED_NUM; -- keyboard_controller_led (led_status); -- --#ifdef DEBUG_AT_KEYBOARD -- grub_dprintf ("atkeyb", "num_lock = %d\n", !!(at_keyboard_status & GRUB_KEYBOARD_STATUS_NUM_LOCK)); --#endif -- return GRUB_TERM_NO_KEY; -- case GRUB_KEYBOARD_KEY_SCROLL_LOCK: -- at_keyboard_status ^= GRUB_TERM_STATUS_SCROLL; -- led_status ^= KEYBOARD_LED_SCROLL; -- keyboard_controller_led (led_status); -- return GRUB_TERM_NO_KEY; -- default: -- return grub_term_map_key (code, at_keyboard_status); -- } -+ ret = grub_ps2_process_incoming_byte (&ps2_state, at_key); -+ if (old_led != ps2_state.led_status) -+ keyboard_controller_led (ps2_state.led_status); -+ return ret; - } - - static void - grub_keyboard_controller_init (void) - { -- at_keyboard_status = 0; -+ ps2_state.at_keyboard_status = 0; - /* Drain input buffer. */ - while (1) - { -@@ -632,13 +269,13 @@ grub_keyboard_controller_init (void) - grub_keyboard_orig_set = query_mode (); - #endif - set_scancodes (); -- keyboard_controller_led (led_status); -+ keyboard_controller_led (ps2_state.led_status); - } - - static grub_err_t - grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused))) - { -- if (current_set == 0) -+ if (ps2_state.current_set == 0) - return GRUB_ERR_NONE; - if (grub_keyboard_orig_set) - write_mode (grub_keyboard_orig_set); -@@ -655,7 +292,7 @@ grub_at_fini_hw (int noreturn __attribute__ ((unused))) - static grub_err_t - grub_at_restore_hw (void) - { -- if (current_set == 0) -+ if (ps2_state.current_set == 0) - return GRUB_ERR_NONE; - - /* Drain input buffer. */ -@@ -668,7 +305,7 @@ grub_at_restore_hw (void) - grub_inb (KEYBOARD_REG_DATA); - } - set_scancodes (); -- keyboard_controller_led (led_status); -+ keyboard_controller_led (ps2_state.led_status); - - return GRUB_ERR_NONE; - } -diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index 7d31095b1ef8d01886a0516343f2e5c5601265dd..4840cc59d3f68944fb2ca6b40cc6488e74b5da02 100644 ---- a/grub-core/term/efi/console.c -+++ b/grub-core/term/efi/console.c -@@ -104,7 +104,7 @@ const unsigned efi_codes[] = - GRUB_TERM_KEY_DC, GRUB_TERM_KEY_PPAGE, GRUB_TERM_KEY_NPAGE, GRUB_TERM_KEY_F1, - GRUB_TERM_KEY_F2, GRUB_TERM_KEY_F3, GRUB_TERM_KEY_F4, GRUB_TERM_KEY_F5, - GRUB_TERM_KEY_F6, GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, GRUB_TERM_KEY_F9, -- GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12, '\e' -+ GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12, GRUB_TERM_ESC - }; - - static int -@@ -122,6 +122,9 @@ grub_efi_translate_key (grub_efi_input_key_t key) - else - return key.unicode_char; - } -+ /* Some devices send enter with scan_code 0x0d (F3) and unicode_char 0x0d. */ -+ else if (key.scan_code == '\r' && key.unicode_char == '\r') -+ return key.unicode_char; - else if (key.scan_code < ARRAY_SIZE (efi_codes)) - return efi_codes[key.scan_code]; - -diff --git a/grub-core/term/i386/coreboot/cbmemc.c b/grub-core/term/i386/coreboot/cbmemc.c -index 25e64a05c03286f644b39398e9e68cbdde333510..cea9b84315bdaf3b1238acc915f35ba6148ffbcf 100644 ---- a/grub-core/term/i386/coreboot/cbmemc.c -+++ b/grub-core/term/i386/coreboot/cbmemc.c -@@ -23,17 +23,20 @@ - #include - #include - #include --#include -+#include - #include - #include - - GRUB_MOD_LICENSE ("GPLv3+"); - -+#define CURSOR_MASK ((1 << 28) - 1) -+#define OVERFLOW (1 << 31) -+ - struct grub_linuxbios_cbmemc - { - grub_uint32_t size; -- grub_uint32_t pointer; -- char data[0]; -+ grub_uint32_t cursor; -+ char body[0]; - }; - - static struct grub_linuxbios_cbmemc *cbmemc; -@@ -41,11 +44,20 @@ static struct grub_linuxbios_cbmemc *cbmemc; - static void - put (struct grub_term_output *term __attribute__ ((unused)), const int c) - { -+ grub_uint32_t flags, cursor; - if (!cbmemc) - return; -- if (cbmemc->pointer < cbmemc->size) -- cbmemc->data[cbmemc->pointer] = c; -- cbmemc->pointer++; -+ flags = cbmemc->cursor & ~CURSOR_MASK; -+ cursor = cbmemc->cursor & CURSOR_MASK; -+ if (cursor >= cbmemc->size) -+ return; -+ cbmemc->body[cursor++] = c; -+ if (cursor >= cbmemc->size) -+ { -+ cursor = 0; -+ flags |= OVERFLOW; -+ } -+ cbmemc->cursor = flags | cursor; - } - - struct grub_terminfo_output_state grub_cbmemc_terminfo_output = -@@ -87,21 +99,29 @@ grub_cmd_cbmemc (struct grub_command *cmd __attribute__ ((unused)), - int argc __attribute__ ((unused)), - char *argv[] __attribute__ ((unused))) - { -- grub_size_t len; -- char *str; -- struct grub_linuxbios_cbmemc *cbmemc_saved; -+ grub_size_t size, cursor; -+ struct grub_linuxbios_cbmemc *real_cbmemc; - - if (!cbmemc) - return grub_error (GRUB_ERR_IO, "no CBMEM console found"); - -- len = cbmemc->pointer; -- if (len > cbmemc->size) -- len = cbmemc->size; -- str = cbmemc->data; -- cbmemc_saved = cbmemc; -+ real_cbmemc = cbmemc; - cbmemc = 0; -- grub_xnputs (str, len); -- cbmemc = cbmemc_saved; -+ cursor = real_cbmemc->cursor & CURSOR_MASK; -+ if (!(real_cbmemc->cursor & OVERFLOW) && cursor < real_cbmemc->size) -+ size = cursor; -+ else -+ size = real_cbmemc->size; -+ if (real_cbmemc->cursor & OVERFLOW) -+ { -+ if (cursor > size) -+ cursor = 0; -+ grub_xnputs(real_cbmemc->body + cursor, size - cursor); -+ grub_xnputs(real_cbmemc->body, cursor); -+ } -+ else -+ grub_xnputs(real_cbmemc->body, size); -+ cbmemc = real_cbmemc; - return 0; - } - -diff --git a/grub-core/term/i386/pc/console.c b/grub-core/term/i386/pc/console.c -index 28de46b576a667fd40c5852b16a4bcc3ea681849..f6142a2dea8036f5301c81a9e2fbd5ddbff5fd90 100644 ---- a/grub-core/term/i386/pc/console.c -+++ b/grub-core/term/i386/pc/console.c -@@ -204,7 +204,7 @@ static int - grub_console_getkey (struct grub_term_input *term __attribute__ ((unused))) - { - const grub_uint16_t bypass_table[] = { -- 0x0100 | '\e', 0x0f00 | '\t', 0x0e00 | '\b', 0x1c00 | '\r', 0x1c00 | '\n' -+ 0x0100 | GRUB_TERM_ESC, 0x0f00 | GRUB_TERM_TAB, 0x0e00 | GRUB_TERM_BACKSPACE, 0x1c00 | '\r', 0x1c00 | '\n' - }; - struct grub_bios_int_registers regs; - unsigned i; -diff --git a/grub-core/term/ps2.c b/grub-core/term/ps2.c -new file mode 100644 -index 0000000000000000000000000000000000000000..7ae4e9f2f8cd4a0ba4405c21581f906f7b458379 ---- /dev/null -+++ b/grub-core/term/ps2.c -@@ -0,0 +1,387 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define KEYBOARD_LED_SCROLL (1 << 0) -+#define KEYBOARD_LED_NUM (1 << 1) -+#define KEYBOARD_LED_CAPS (1 << 2) -+ -+static const grub_uint8_t set1_mapping[128] = -+ { -+ /* 0x00 */ 0 /* Unused */, GRUB_KEYBOARD_KEY_ESCAPE, -+ /* 0x02 */ GRUB_KEYBOARD_KEY_1, GRUB_KEYBOARD_KEY_2, -+ /* 0x04 */ GRUB_KEYBOARD_KEY_3, GRUB_KEYBOARD_KEY_4, -+ /* 0x06 */ GRUB_KEYBOARD_KEY_5, GRUB_KEYBOARD_KEY_6, -+ /* 0x08 */ GRUB_KEYBOARD_KEY_7, GRUB_KEYBOARD_KEY_8, -+ /* 0x0a */ GRUB_KEYBOARD_KEY_9, GRUB_KEYBOARD_KEY_0, -+ /* 0x0c */ GRUB_KEYBOARD_KEY_DASH, GRUB_KEYBOARD_KEY_EQUAL, -+ /* 0x0e */ GRUB_KEYBOARD_KEY_BACKSPACE, GRUB_KEYBOARD_KEY_TAB, -+ /* 0x10 */ GRUB_KEYBOARD_KEY_Q, GRUB_KEYBOARD_KEY_W, -+ /* 0x12 */ GRUB_KEYBOARD_KEY_E, GRUB_KEYBOARD_KEY_R, -+ /* 0x14 */ GRUB_KEYBOARD_KEY_T, GRUB_KEYBOARD_KEY_Y, -+ /* 0x16 */ GRUB_KEYBOARD_KEY_U, GRUB_KEYBOARD_KEY_I, -+ /* 0x18 */ GRUB_KEYBOARD_KEY_O, GRUB_KEYBOARD_KEY_P, -+ /* 0x1a */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_RBRACKET, -+ /* 0x1c */ GRUB_KEYBOARD_KEY_ENTER, GRUB_KEYBOARD_KEY_LEFT_CTRL, -+ /* 0x1e */ GRUB_KEYBOARD_KEY_A, GRUB_KEYBOARD_KEY_S, -+ /* 0x20 */ GRUB_KEYBOARD_KEY_D, GRUB_KEYBOARD_KEY_F, -+ /* 0x22 */ GRUB_KEYBOARD_KEY_G, GRUB_KEYBOARD_KEY_H, -+ /* 0x24 */ GRUB_KEYBOARD_KEY_J, GRUB_KEYBOARD_KEY_K, -+ /* 0x26 */ GRUB_KEYBOARD_KEY_L, GRUB_KEYBOARD_KEY_SEMICOLON, -+ /* 0x28 */ GRUB_KEYBOARD_KEY_DQUOTE, GRUB_KEYBOARD_KEY_RQUOTE, -+ /* 0x2a */ GRUB_KEYBOARD_KEY_LEFT_SHIFT, GRUB_KEYBOARD_KEY_BACKSLASH, -+ /* 0x2c */ GRUB_KEYBOARD_KEY_Z, GRUB_KEYBOARD_KEY_X, -+ /* 0x2e */ GRUB_KEYBOARD_KEY_C, GRUB_KEYBOARD_KEY_V, -+ /* 0x30 */ GRUB_KEYBOARD_KEY_B, GRUB_KEYBOARD_KEY_N, -+ /* 0x32 */ GRUB_KEYBOARD_KEY_M, GRUB_KEYBOARD_KEY_COMMA, -+ /* 0x34 */ GRUB_KEYBOARD_KEY_DOT, GRUB_KEYBOARD_KEY_SLASH, -+ /* 0x36 */ GRUB_KEYBOARD_KEY_RIGHT_SHIFT, GRUB_KEYBOARD_KEY_NUMMUL, -+ /* 0x38 */ GRUB_KEYBOARD_KEY_LEFT_ALT, GRUB_KEYBOARD_KEY_SPACE, -+ /* 0x3a */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_F1, -+ /* 0x3c */ GRUB_KEYBOARD_KEY_F2, GRUB_KEYBOARD_KEY_F3, -+ /* 0x3e */ GRUB_KEYBOARD_KEY_F4, GRUB_KEYBOARD_KEY_F5, -+ /* 0x40 */ GRUB_KEYBOARD_KEY_F6, GRUB_KEYBOARD_KEY_F7, -+ /* 0x42 */ GRUB_KEYBOARD_KEY_F8, GRUB_KEYBOARD_KEY_F9, -+ /* 0x44 */ GRUB_KEYBOARD_KEY_F10, GRUB_KEYBOARD_KEY_NUM_LOCK, -+ /* 0x46 */ GRUB_KEYBOARD_KEY_SCROLL_LOCK, GRUB_KEYBOARD_KEY_NUM7, -+ /* 0x48 */ GRUB_KEYBOARD_KEY_NUM8, GRUB_KEYBOARD_KEY_NUM9, -+ /* 0x4a */ GRUB_KEYBOARD_KEY_NUMMINUS, GRUB_KEYBOARD_KEY_NUM4, -+ /* 0x4c */ GRUB_KEYBOARD_KEY_NUM5, GRUB_KEYBOARD_KEY_NUM6, -+ /* 0x4e */ GRUB_KEYBOARD_KEY_NUMPLUS, GRUB_KEYBOARD_KEY_NUM1, -+ /* 0x50 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM3, -+ /* 0x52 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, -+ /* 0x54 */ 0, 0, -+ /* 0x56 */ GRUB_KEYBOARD_KEY_102ND, GRUB_KEYBOARD_KEY_F11, -+ /* 0x58 */ GRUB_KEYBOARD_KEY_F12, 0, -+ /* 0x5a */ 0, 0, -+ /* 0x5c */ 0, 0, -+ /* 0x5e */ 0, 0, -+ /* 0x60 */ 0, 0, -+ /* 0x62 */ 0, 0, -+ /* OLPC keys. Just mapped to normal keys. */ -+ /* 0x64 */ 0, GRUB_KEYBOARD_KEY_UP, -+ /* 0x66 */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_LEFT, -+ /* 0x68 */ GRUB_KEYBOARD_KEY_RIGHT, 0, -+ /* 0x6a */ 0, 0, -+ /* 0x6c */ 0, 0, -+ /* 0x6e */ 0, 0, -+ /* 0x70 */ 0, 0, -+ /* 0x72 */ 0, GRUB_KEYBOARD_KEY_JP_RO, -+ /* 0x74 */ 0, 0, -+ /* 0x76 */ 0, 0, -+ /* 0x78 */ 0, 0, -+ /* 0x7a */ 0, 0, -+ /* 0x7c */ 0, GRUB_KEYBOARD_KEY_JP_YEN, -+ /* 0x7e */ GRUB_KEYBOARD_KEY_KPCOMMA -+ }; -+ -+static const struct -+{ -+ grub_uint8_t from, to; -+} set1_e0_mapping[] = -+ { -+ {0x1c, GRUB_KEYBOARD_KEY_NUMENTER}, -+ {0x1d, GRUB_KEYBOARD_KEY_RIGHT_CTRL}, -+ {0x35, GRUB_KEYBOARD_KEY_NUMSLASH }, -+ {0x38, GRUB_KEYBOARD_KEY_RIGHT_ALT}, -+ {0x47, GRUB_KEYBOARD_KEY_HOME}, -+ {0x48, GRUB_KEYBOARD_KEY_UP}, -+ {0x49, GRUB_KEYBOARD_KEY_PPAGE}, -+ {0x4b, GRUB_KEYBOARD_KEY_LEFT}, -+ {0x4d, GRUB_KEYBOARD_KEY_RIGHT}, -+ {0x4f, GRUB_KEYBOARD_KEY_END}, -+ {0x50, GRUB_KEYBOARD_KEY_DOWN}, -+ {0x51, GRUB_KEYBOARD_KEY_NPAGE}, -+ {0x52, GRUB_KEYBOARD_KEY_INSERT}, -+ {0x53, GRUB_KEYBOARD_KEY_DELETE}, -+ }; -+ -+static const grub_uint8_t set2_mapping[256] = -+ { -+ /* 0x00 */ 0, GRUB_KEYBOARD_KEY_F9, -+ /* 0x02 */ 0, GRUB_KEYBOARD_KEY_F5, -+ /* 0x04 */ GRUB_KEYBOARD_KEY_F3, GRUB_KEYBOARD_KEY_F1, -+ /* 0x06 */ GRUB_KEYBOARD_KEY_F2, GRUB_KEYBOARD_KEY_F12, -+ /* 0x08 */ 0, GRUB_KEYBOARD_KEY_F10, -+ /* 0x0a */ GRUB_KEYBOARD_KEY_F8, GRUB_KEYBOARD_KEY_F6, -+ /* 0x0c */ GRUB_KEYBOARD_KEY_F4, GRUB_KEYBOARD_KEY_TAB, -+ /* 0x0e */ GRUB_KEYBOARD_KEY_RQUOTE, 0, -+ /* 0x10 */ 0, GRUB_KEYBOARD_KEY_LEFT_ALT, -+ /* 0x12 */ GRUB_KEYBOARD_KEY_LEFT_SHIFT, 0, -+ /* 0x14 */ GRUB_KEYBOARD_KEY_LEFT_CTRL, GRUB_KEYBOARD_KEY_Q, -+ /* 0x16 */ GRUB_KEYBOARD_KEY_1, 0, -+ /* 0x18 */ 0, 0, -+ /* 0x1a */ GRUB_KEYBOARD_KEY_Z, GRUB_KEYBOARD_KEY_S, -+ /* 0x1c */ GRUB_KEYBOARD_KEY_A, GRUB_KEYBOARD_KEY_W, -+ /* 0x1e */ GRUB_KEYBOARD_KEY_2, 0, -+ /* 0x20 */ 0, GRUB_KEYBOARD_KEY_C, -+ /* 0x22 */ GRUB_KEYBOARD_KEY_X, GRUB_KEYBOARD_KEY_D, -+ /* 0x24 */ GRUB_KEYBOARD_KEY_E, GRUB_KEYBOARD_KEY_4, -+ /* 0x26 */ GRUB_KEYBOARD_KEY_3, 0, -+ /* 0x28 */ 0, GRUB_KEYBOARD_KEY_SPACE, -+ /* 0x2a */ GRUB_KEYBOARD_KEY_V, GRUB_KEYBOARD_KEY_F, -+ /* 0x2c */ GRUB_KEYBOARD_KEY_T, GRUB_KEYBOARD_KEY_R, -+ /* 0x2e */ GRUB_KEYBOARD_KEY_5, 0, -+ /* 0x30 */ 0, GRUB_KEYBOARD_KEY_N, -+ /* 0x32 */ GRUB_KEYBOARD_KEY_B, GRUB_KEYBOARD_KEY_H, -+ /* 0x34 */ GRUB_KEYBOARD_KEY_G, GRUB_KEYBOARD_KEY_Y, -+ /* 0x36 */ GRUB_KEYBOARD_KEY_6, 0, -+ /* 0x38 */ 0, 0, -+ /* 0x3a */ GRUB_KEYBOARD_KEY_M, GRUB_KEYBOARD_KEY_J, -+ /* 0x3c */ GRUB_KEYBOARD_KEY_U, GRUB_KEYBOARD_KEY_7, -+ /* 0x3e */ GRUB_KEYBOARD_KEY_8, 0, -+ /* 0x40 */ 0, GRUB_KEYBOARD_KEY_COMMA, -+ /* 0x42 */ GRUB_KEYBOARD_KEY_K, GRUB_KEYBOARD_KEY_I, -+ /* 0x44 */ GRUB_KEYBOARD_KEY_O, GRUB_KEYBOARD_KEY_0, -+ /* 0x46 */ GRUB_KEYBOARD_KEY_9, 0, -+ /* 0x48 */ 0, GRUB_KEYBOARD_KEY_DOT, -+ /* 0x4a */ GRUB_KEYBOARD_KEY_SLASH, GRUB_KEYBOARD_KEY_L, -+ /* 0x4c */ GRUB_KEYBOARD_KEY_SEMICOLON, GRUB_KEYBOARD_KEY_P, -+ /* 0x4e */ GRUB_KEYBOARD_KEY_DASH, 0, -+ /* 0x50 */ 0, GRUB_KEYBOARD_KEY_JP_RO, -+ /* 0x52 */ GRUB_KEYBOARD_KEY_DQUOTE, 0, -+ /* 0x54 */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_EQUAL, -+ /* 0x56 */ 0, 0, -+ /* 0x58 */ GRUB_KEYBOARD_KEY_CAPS_LOCK, GRUB_KEYBOARD_KEY_RIGHT_SHIFT, -+ /* 0x5a */ GRUB_KEYBOARD_KEY_ENTER, GRUB_KEYBOARD_KEY_RBRACKET, -+ /* 0x5c */ 0, GRUB_KEYBOARD_KEY_BACKSLASH, -+ /* 0x5e */ 0, 0, -+ /* 0x60 */ 0, GRUB_KEYBOARD_KEY_102ND, -+ /* 0x62 */ 0, 0, -+ /* 0x64 */ 0, 0, -+ /* 0x66 */ GRUB_KEYBOARD_KEY_BACKSPACE, 0, -+ /* 0x68 */ 0, GRUB_KEYBOARD_KEY_NUM1, -+ /* 0x6a */ GRUB_KEYBOARD_KEY_JP_YEN, GRUB_KEYBOARD_KEY_NUM4, -+ /* 0x6c */ GRUB_KEYBOARD_KEY_NUM7, GRUB_KEYBOARD_KEY_KPCOMMA, -+ /* 0x6e */ 0, 0, -+ /* 0x70 */ GRUB_KEYBOARD_KEY_NUM0, GRUB_KEYBOARD_KEY_NUMDOT, -+ /* 0x72 */ GRUB_KEYBOARD_KEY_NUM2, GRUB_KEYBOARD_KEY_NUM5, -+ /* 0x74 */ GRUB_KEYBOARD_KEY_NUM6, GRUB_KEYBOARD_KEY_NUM8, -+ /* 0x76 */ GRUB_KEYBOARD_KEY_ESCAPE, GRUB_KEYBOARD_KEY_NUM_LOCK, -+ /* 0x78 */ GRUB_KEYBOARD_KEY_F11, GRUB_KEYBOARD_KEY_NUMPLUS, -+ /* 0x7a */ GRUB_KEYBOARD_KEY_NUM3, GRUB_KEYBOARD_KEY_NUMMINUS, -+ /* 0x7c */ GRUB_KEYBOARD_KEY_NUMMUL, GRUB_KEYBOARD_KEY_NUM9, -+ /* 0x7e */ GRUB_KEYBOARD_KEY_SCROLL_LOCK, 0, -+ /* 0x80 */ 0, 0, -+ /* 0x82 */ 0, GRUB_KEYBOARD_KEY_F7, -+ }; -+ -+static const struct -+{ -+ grub_uint8_t from, to; -+} set2_e0_mapping[] = -+ { -+ {0x11, GRUB_KEYBOARD_KEY_RIGHT_ALT}, -+ {0x14, GRUB_KEYBOARD_KEY_RIGHT_CTRL}, -+ {0x4a, GRUB_KEYBOARD_KEY_NUMSLASH}, -+ {0x5a, GRUB_KEYBOARD_KEY_NUMENTER}, -+ {0x69, GRUB_KEYBOARD_KEY_END}, -+ {0x6b, GRUB_KEYBOARD_KEY_LEFT}, -+ {0x6c, GRUB_KEYBOARD_KEY_HOME}, -+ {0x70, GRUB_KEYBOARD_KEY_INSERT}, -+ {0x71, GRUB_KEYBOARD_KEY_DELETE}, -+ {0x72, GRUB_KEYBOARD_KEY_DOWN}, -+ {0x74, GRUB_KEYBOARD_KEY_RIGHT}, -+ {0x75, GRUB_KEYBOARD_KEY_UP}, -+ {0x7a, GRUB_KEYBOARD_KEY_NPAGE}, -+ {0x7d, GRUB_KEYBOARD_KEY_PPAGE}, -+ }; -+ -+static int -+fetch_key (struct grub_ps2_state *ps2_state, grub_uint8_t at_key, int *is_break) -+{ -+ int was_ext = 0; -+ int ret = 0; -+ -+ /* May happen if no keyboard is connected. Just ignore this. */ -+ if (at_key == 0xff) -+ return -1; -+ if (at_key == 0xe0) -+ { -+ ps2_state->e0_received = 1; -+ return -1; -+ } -+ -+ if ((ps2_state->current_set == 2 || ps2_state->current_set == 3) && at_key == 0xf0) -+ { -+ ps2_state->f0_received = 1; -+ return -1; -+ } -+ -+ /* Setting LEDs may generate ACKs. */ -+ if (at_key == GRUB_AT_ACK) -+ return -1; -+ -+ was_ext = ps2_state->e0_received; -+ ps2_state->e0_received = 0; -+ -+ switch (ps2_state->current_set) -+ { -+ case 1: -+ *is_break = !!(at_key & 0x80); -+ if (!was_ext) -+ ret = set1_mapping[at_key & 0x7f]; -+ else -+ { -+ unsigned i; -+ for (i = 0; i < ARRAY_SIZE (set1_e0_mapping); i++) -+ if (set1_e0_mapping[i].from == (at_key & 0x7f)) -+ { -+ ret = set1_e0_mapping[i].to; -+ break; -+ } -+ } -+ break; -+ case 2: -+ *is_break = ps2_state->f0_received; -+ ps2_state->f0_received = 0; -+ if (!was_ext) -+ ret = set2_mapping[at_key]; -+ else -+ { -+ unsigned i; -+ for (i = 0; i < ARRAY_SIZE (set2_e0_mapping); i++) -+ if (set2_e0_mapping[i].from == at_key) -+ { -+ ret = set2_e0_mapping[i].to; -+ break; -+ } -+ } -+ break; -+ default: -+ return -1; -+ } -+ if (!ret) -+ { -+ if (was_ext) -+ grub_dprintf ("atkeyb", "Unknown key 0xe0+0x%02x from set %d\n", -+ at_key, ps2_state->current_set); -+ else -+ grub_dprintf ("atkeyb", "Unknown key 0x%02x from set %d\n", -+ at_key, ps2_state->current_set); -+ return -1; -+ } -+ return ret; -+} -+ -+/* FIXME: This should become an interrupt service routine. For now -+ it's just used to catch events from control keys. */ -+static int -+grub_keyboard_isr (struct grub_ps2_state *ps2_state, -+ grub_keyboard_key_t key, int is_break) -+{ -+ if (!is_break) -+ switch (key) -+ { -+ case GRUB_KEYBOARD_KEY_LEFT_SHIFT: -+ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_LSHIFT; -+ return 1; -+ case GRUB_KEYBOARD_KEY_RIGHT_SHIFT: -+ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_RSHIFT; -+ return 1; -+ case GRUB_KEYBOARD_KEY_LEFT_CTRL: -+ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_LCTRL; -+ return 1; -+ case GRUB_KEYBOARD_KEY_RIGHT_CTRL: -+ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_RCTRL; -+ return 1; -+ case GRUB_KEYBOARD_KEY_RIGHT_ALT: -+ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_RALT; -+ return 1; -+ case GRUB_KEYBOARD_KEY_LEFT_ALT: -+ ps2_state->at_keyboard_status |= GRUB_TERM_STATUS_LALT; -+ return 1; -+ default: -+ return 0; -+ } -+ else -+ switch (key) -+ { -+ case GRUB_KEYBOARD_KEY_LEFT_SHIFT: -+ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_LSHIFT; -+ return 1; -+ case GRUB_KEYBOARD_KEY_RIGHT_SHIFT: -+ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_RSHIFT; -+ return 1; -+ case GRUB_KEYBOARD_KEY_LEFT_CTRL: -+ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_LCTRL; -+ return 1; -+ case GRUB_KEYBOARD_KEY_RIGHT_CTRL: -+ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_RCTRL; -+ return 1; -+ case GRUB_KEYBOARD_KEY_RIGHT_ALT: -+ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_RALT; -+ return 1; -+ case GRUB_KEYBOARD_KEY_LEFT_ALT: -+ ps2_state->at_keyboard_status &= ~GRUB_TERM_STATUS_LALT; -+ return 1; -+ default: -+ return 0; -+ } -+} -+ -+/* If there is a key pending, return it; otherwise return GRUB_TERM_NO_KEY. */ -+int -+grub_ps2_process_incoming_byte (struct grub_ps2_state *ps2_state, -+ grub_uint8_t at_key) -+{ -+ int code; -+ int is_break = 0; -+ -+ code = fetch_key (ps2_state, at_key, &is_break); -+ if (code == -1) -+ return GRUB_TERM_NO_KEY; -+ -+ if (grub_keyboard_isr (ps2_state, code, is_break)) -+ return GRUB_TERM_NO_KEY; -+ if (is_break) -+ return GRUB_TERM_NO_KEY; -+#ifdef DEBUG_AT_KEYBOARD -+ grub_dprintf ("atkeyb", "Detected key 0x%x\n", code); -+#endif -+ switch (code) -+ { -+ case GRUB_KEYBOARD_KEY_CAPS_LOCK: -+ ps2_state->at_keyboard_status ^= GRUB_TERM_STATUS_CAPS; -+ ps2_state->led_status ^= KEYBOARD_LED_CAPS; -+ -+#ifdef DEBUG_AT_KEYBOARD -+ grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(ps2_state->at_keyboard_status & GRUB_KEYBOARD_STATUS_CAPS_LOCK)); -+#endif -+ return GRUB_TERM_NO_KEY; -+ case GRUB_KEYBOARD_KEY_NUM_LOCK: -+ ps2_state->at_keyboard_status ^= GRUB_TERM_STATUS_NUM; -+ ps2_state->led_status ^= KEYBOARD_LED_NUM; -+ -+#ifdef DEBUG_AT_KEYBOARD -+ grub_dprintf ("atkeyb", "num_lock = %d\n", !!(ps2_state->at_keyboard_status & GRUB_KEYBOARD_STATUS_NUM_LOCK)); -+#endif -+ return GRUB_TERM_NO_KEY; -+ case GRUB_KEYBOARD_KEY_SCROLL_LOCK: -+ ps2_state->at_keyboard_status ^= GRUB_TERM_STATUS_SCROLL; -+ ps2_state->led_status ^= KEYBOARD_LED_SCROLL; -+ return GRUB_TERM_NO_KEY; -+ default: -+ return grub_term_map_key (code, ps2_state->at_keyboard_status); -+ } -+} -diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index f0d3e3debc60aa8dd04a5643a8a0537ffb88ec26..d317efa368d846963743a243fd672026a2221933 100644 ---- a/grub-core/term/terminfo.c -+++ b/grub-core/term/terminfo.c -@@ -426,12 +426,12 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, - } - *len = 1; - keys[0] = c; -- if (c != ANSI_CSI && c != '\e') -+ if (c != ANSI_CSI && c != GRUB_TERM_ESC) - { - /* Backspace: Ctrl-h. */ - if (c == 0x7f) -- c = '\b'; -- if (c < 0x20 && c != '\t' && c!= '\b' && c != '\n' && c != '\r') -+ c = GRUB_TERM_BACKSPACE; -+ if (c < 0x20 && c != GRUB_TERM_TAB && c!= GRUB_TERM_BACKSPACE && c != '\n' && c != '\r') - c = GRUB_TERM_CTRL | (c - 1 + 'a'); - *len = 1; - keys[0] = c; -@@ -487,7 +487,7 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, - GRUB_TERM_KEY_HOME, GRUB_TERM_KEY_END }; - unsigned i; - -- if (c == '\e') -+ if (c == GRUB_TERM_ESC) - { - CONTINUE_READ; - -@@ -606,7 +606,7 @@ grub_terminfo_getkey (struct grub_term_input *termi) - &data->npending, data->readkey); - - #if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275) -- if (data->npending == 1 && data->input_buf[0] == '\e' -+ if (data->npending == 1 && data->input_buf[0] == GRUB_TERM_ESC - && grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_REPEAT) - && grub_get_time_ms () - data->last_key_time < 1000 - && (data->last_key & GRUB_TERM_EXTENDED)) -diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c -index f1e21439e2be229d386cb310d62164fc9a5f4f92..baea7688a1d3c49d37a2c03e585109ccd04328f8 100644 ---- a/grub-core/tests/cmdline_cat_test.c -+++ b/grub-core/tests/cmdline_cat_test.c -@@ -103,7 +103,7 @@ cmdline_cat_test (void) - '/', 't', 'e', 's', 't', '.', - 't', 'x', 't', '\n', - GRUB_TERM_NO_KEY, -- GRUB_TERM_NO_KEY, '\e'}, -+ GRUB_TERM_NO_KEY, GRUB_TERM_ESC}, - 23); - - grub_video_checksum ("cmdline_cat"); -diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c -index 8f63dc27a35bd769ecb5d94599de3ba9e97cf5dc..12836fb96598d98b5cbf371a953e6ec702eb50de 100644 ---- a/grub-core/tests/gfxterm_menu.c -+++ b/grub-core/tests/gfxterm_menu.c -@@ -146,7 +146,7 @@ gfxterm_menu (void) - return; - } - grub_terminal_input_fake_sequence ((int []) { -1, -1, -1, GRUB_TERM_KEY_DOWN, -1, 'e', -- -1, GRUB_TERM_KEY_RIGHT, -1, 'x', -1, '\e', -1, '\e' }, 14); -+ -1, GRUB_TERM_KEY_RIGHT, -1, 'x', -1, GRUB_TERM_ESC, -1, GRUB_TERM_ESC }, 14); - - grub_video_checksum (tests[j].name); - -diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c -index d4822a12456525e4abc5f587bc897364db4e52b7..96781fb39b5f37b201345f60fe4297629bb672cf 100644 ---- a/grub-core/tests/lib/functional_test.c -+++ b/grub-core/tests/lib/functional_test.c -@@ -26,14 +26,23 @@ GRUB_MOD_LICENSE ("GPLv3+"); - - static grub_err_t - grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)), -- int argc __attribute__ ((unused)), -- char **args __attribute__ ((unused))) -+ int argc, -+ char **args) - { - grub_test_t test; - int ok = 1; -+ int i; - - FOR_LIST_ELEMENTS (test, grub_test_list) - { -+ if (argc != 0) -+ { -+ for (i = 0; i < argc; i++) -+ if (grub_strcmp(args[i], test->name) == 0) -+ break; -+ if (i == argc) -+ continue; -+ } - grub_errno = 0; - ok = ok && !grub_test_run (test); - grub_errno = 0; -diff --git a/grub-core/video/i386/coreboot/cbfb.c b/grub-core/video/coreboot/cbfb.c -similarity index 99% -rename from grub-core/video/i386/coreboot/cbfb.c -rename to grub-core/video/coreboot/cbfb.c -index dede0c37ea3e8a8948cd6535d26d008e117206bc..9af81fa5b01b63677d97ba9a242e60080df84e5a 100644 ---- a/grub-core/video/i386/coreboot/cbfb.c -+++ b/grub-core/video/coreboot/cbfb.c -@@ -25,7 +25,7 @@ - #include - #include - #include --#include -+#include - #include - - struct grub_linuxbios_table_framebuffer *grub_video_coreboot_fbtable; -diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c -index 464ede874daff480fb4199927cb30d48f0558e8b..044af1d20d38f08e3b5c5dcec4281c0b452cf8ea 100644 ---- a/grub-core/video/efi_uga.c -+++ b/grub-core/video/efi_uga.c -@@ -94,10 +94,19 @@ static int - find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) - { - struct find_framebuf_ctx *ctx = data; -- grub_pci_address_t addr; -+ grub_pci_address_t addr, rcaddr; -+ grub_uint32_t subclass; - - addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); -- if (grub_pci_read (addr) >> 24 == 0x3) -+ subclass = (grub_pci_read (addr) >> 16) & 0xffff; -+ -+ if (subclass != GRUB_PCI_CLASS_SUBCLASS_VGA) -+ return 0; -+ -+ /* Enable MEM address spaces */ -+ rcaddr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); -+ grub_pci_write_word (rcaddr, grub_pci_read_word (rcaddr) | GRUB_PCI_COMMAND_MEM_ENABLED); -+ - { - int i; - -diff --git a/tests/printf_unit_test.c b/tests/printf_unit_test.c -index d7b12c6dbee6e84ace9d9f81d476622194810b26..098c29fd9ce2d28a5b83b74afc0f9e40b7c401ec 100644 ---- a/tests/printf_unit_test.c -+++ b/tests/printf_unit_test.c -@@ -23,6 +23,10 @@ - - #define MSG "printf test failed: %s, %s", real, expected - -+#if defined(__GNUC__) && __GNUC__ >= 7 -+#pragma GCC diagnostic ignored "-Wformat-truncation=" -+#endif -+ - static void - printf_test (void) - { -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 452b230daedc3db0296cab014e89ddacf1c21347..0a2e24a79f11916527650d124e38c6184c4ceb93 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -73,6 +73,7 @@ grub_install_help_filter (int key, const char *text, - - static int (*compress_func) (const char *src, const char *dest) = NULL; - char *grub_install_copy_buffer; -+static char *dtb; - - int - grub_install_copy_file (const char *src, -@@ -364,6 +365,11 @@ grub_install_parse (int key, char *arg) - case GRUB_INSTALL_OPTIONS_INSTALL_FONTS: - handle_install_list (&install_fonts, arg, 0); - return 1; -+ case GRUB_INSTALL_OPTIONS_DTB: -+ if (dtb) -+ free (dtb); -+ dtb = xstrdup (arg); -+ return 1; - case GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS: - if (strcmp (arg, "no") == 0 - || strcmp (arg, "none") == 0) -@@ -486,9 +492,10 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, - - grub_util_info ("grub-mkimage --directory '%s' --prefix '%s'" - " --output '%s' " -+ " --dtb '%s' " - "--format '%s' --compression '%s' %s %s\n", - dir, prefix, -- outname, mkimage_target, -+ outname, dtb ? : "", mkimage_target, - compnames[compression], note ? "--note" : "", s); - free (s); - -@@ -499,7 +506,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, - grub_install_generate_image (dir, prefix, fp, outname, - modules.entries, memdisk_path, - pubkeys, npubkeys, config_path, tgt, -- note, compression); -+ note, compression, dtb); - while (dc--) - grub_install_pop_module (); - } -@@ -585,6 +592,7 @@ copy_all (const char *srcd, - grub_util_fd_closedir (d); - } - -+#if !(defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS) - static const char * - get_localedir (void) - { -@@ -639,6 +647,59 @@ copy_locales (const char *dstd) - } - grub_util_fd_closedir (d); - } -+#endif -+ -+static void -+grub_install_copy_nls(const char *src __attribute__ ((unused)), -+ const char *dst __attribute__ ((unused))) -+{ -+#if !(defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS) -+ char *dst_locale; -+ -+ dst_locale = grub_util_path_concat (2, dst, "locale"); -+ grub_install_mkdir_p (dst_locale); -+ clean_grub_dir (dst_locale); -+ -+ if (install_locales.is_default) -+ { -+ char *srcd = grub_util_path_concat (2, src, "po"); -+ copy_by_ext (srcd, dst_locale, ".mo", 0); -+ copy_locales (dst_locale); -+ free (srcd); -+ } -+ else -+ { -+ size_t i; -+ const char *locale_dir = get_localedir (); -+ -+ for (i = 0; i < install_locales.n_entries; i++) -+ { -+ char *srcf = grub_util_path_concat_ext (3, src, "po", -+ install_locales.entries[i], -+ ".mo"); -+ char *dstf = grub_util_path_concat_ext (2, dst_locale, -+ install_locales.entries[i], -+ ".mo"); -+ if (grub_install_compress_file (srcf, dstf, 0)) -+ { -+ free (srcf); -+ free (dstf); -+ continue; -+ } -+ free (srcf); -+ srcf = grub_util_path_concat_ext (4, locale_dir, -+ install_locales.entries[i], -+ "LC_MESSAGES", PACKAGE, ".mo"); -+ if (grub_install_compress_file (srcf, dstf, 0) == 0) -+ grub_util_error (_("cannot find locale `%s'"), -+ install_locales.entries[i]); -+ free (srcf); -+ free (dstf); -+ } -+ } -+ free (dst_locale); -+#endif -+} - - static struct - { -@@ -666,6 +727,7 @@ static struct - [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" }, - [GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64", "efi" }, - [GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" }, -+ [GRUB_INSTALL_PLATFORM_ARM_COREBOOT] = { "arm", "coreboot" }, - }; - - char * -@@ -723,7 +785,7 @@ grub_install_copy_files (const char *src, - const char *dst, - enum grub_install_plat platid) - { -- char *dst_platform, *dst_locale, *dst_fonts; -+ char *dst_platform, *dst_fonts; - const char *pkgdatadir = grub_util_get_pkgdatadir (); - char *themes_dir; - -@@ -734,13 +796,12 @@ grub_install_copy_files (const char *src, - dst_platform = grub_util_path_concat (2, dst, platform); - free (platform); - } -- dst_locale = grub_util_path_concat (2, dst, "locale"); - dst_fonts = grub_util_path_concat (2, dst, "fonts"); - grub_install_mkdir_p (dst_platform); -- grub_install_mkdir_p (dst_locale); - clean_grub_dir (dst); - clean_grub_dir (dst_platform); -- clean_grub_dir (dst_locale); -+ -+ grub_install_copy_nls(src, dst); - - if (install_modules.is_default) - copy_by_ext (src, dst_platform, ".mod", 1); -@@ -789,50 +850,6 @@ grub_install_copy_files (const char *src, - free (dstf); - } - -- if (install_locales.is_default) -- { -- char *srcd = grub_util_path_concat (2, src, "po"); -- copy_by_ext (srcd, dst_locale, ".mo", 0); -- copy_locales (dst_locale); -- free (srcd); -- } -- else -- { -- const char *locale_dir = get_localedir (); -- -- for (i = 0; i < install_locales.n_entries; i++) -- { -- char *srcf = grub_util_path_concat_ext (3, src, -- "po", -- install_locales.entries[i], -- ".mo"); -- char *dstf = grub_util_path_concat_ext (2, dst_locale, -- install_locales.entries[i], -- ".mo"); -- if (grub_install_compress_file (srcf, dstf, 0)) -- { -- free (srcf); -- free (dstf); -- continue; -- } -- free (srcf); -- srcf = grub_util_path_concat_ext (4, -- locale_dir, -- install_locales.entries[i], -- "LC_MESSAGES", -- PACKAGE, -- ".mo"); -- if (grub_install_compress_file (srcf, dstf, 0)) -- { -- free (srcf); -- free (dstf); -- continue; -- } -- grub_util_error (_("cannot find locale `%s'"), -- install_locales.entries[i]); -- } -- } -- - if (install_themes.is_default) - { - install_themes.is_default = 0; -@@ -895,7 +912,6 @@ grub_install_copy_files (const char *src, - } - - free (dst_platform); -- free (dst_locale); - free (dst_fonts); - } - -diff --git a/util/grub-install.c b/util/grub-install.c -index 9074d3e9e52d2a2e215a10b2f8b3cf627ca80db3..78d0138cb0a8c891f8140f1804d68d275eb690f6 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -486,6 +486,7 @@ have_bootdev (enum grub_install_plat pl) - - case GRUB_INSTALL_PLATFORM_I386_QEMU: - case GRUB_INSTALL_PLATFORM_I386_COREBOOT: -+ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: - case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: - case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: - case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: -@@ -713,7 +714,7 @@ is_prep_partition (grub_device_t dev) - if (grub_disk_read (dev->disk, p->offset, p->index, - sizeof (gptdata), &gptdata) == 0) - { -- const grub_gpt_part_type_t template = { -+ const grub_gpt_part_guid_t template = { - grub_cpu_to_le32_compile_time (0x9e1a2d38), - grub_cpu_to_le16_compile_time (0xc612), - grub_cpu_to_le16_compile_time (0x4316), -@@ -911,6 +912,7 @@ main (int argc, char *argv[]) - - case GRUB_INSTALL_PLATFORM_I386_QEMU: - case GRUB_INSTALL_PLATFORM_I386_COREBOOT: -+ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: - case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: - case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: - case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: -@@ -946,6 +948,7 @@ main (int argc, char *argv[]) - case GRUB_INSTALL_PLATFORM_ARM_UBOOT: - case GRUB_INSTALL_PLATFORM_I386_QEMU: - case GRUB_INSTALL_PLATFORM_I386_COREBOOT: -+ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: - case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: - case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: - case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: -@@ -1448,6 +1451,7 @@ main (int argc, char *argv[]) - case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: - case GRUB_INSTALL_PLATFORM_I386_QEMU: - case GRUB_INSTALL_PLATFORM_I386_COREBOOT: -+ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: - case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: - case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: - case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: -@@ -1468,6 +1472,7 @@ main (int argc, char *argv[]) - { - grub_util_fprint_full_disk_name (load_cfg_f, g, dev); - fprintf (load_cfg_f, " "); -+ free (g); - } - if (dev != grub_dev) - grub_device_close (dev); -@@ -1542,6 +1547,7 @@ main (int argc, char *argv[]) - break; - - case GRUB_INSTALL_PLATFORM_I386_COREBOOT: -+ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: - case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: - case GRUB_INSTALL_PLATFORM_I386_IEEE1275: - case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275: -@@ -1629,6 +1635,7 @@ main (int argc, char *argv[]) - case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: - case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: - case GRUB_INSTALL_PLATFORM_I386_COREBOOT: -+ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: - case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: - case GRUB_INSTALL_PLATFORM_I386_PC: - case GRUB_INSTALL_PLATFORM_MIPSEL_ARC: -@@ -1841,9 +1848,13 @@ main (int argc, char *argv[]) - if (!removable && update_nvram) - { - /* Try to make this image bootable using the EFI Boot Manager, if available. */ -- grub_install_register_efi (efidir_grub_dev, -- "\\System\\Library\\CoreServices", -- efi_distributor); -+ int ret; -+ ret = grub_install_register_efi (efidir_grub_dev, -+ "\\System\\Library\\CoreServices", -+ efi_distributor); -+ if (ret) -+ grub_util_error (_("efibootmgr failed to register the boot entry: %s"), -+ strerror (ret)); - } - - grub_device_close (ins_dev); -@@ -1864,6 +1875,7 @@ main (int argc, char *argv[]) - { - char * efifile_path; - char * part; -+ int ret; - - /* Try to make this image bootable using the EFI Boot Manager, if available. */ - if (!efi_distributor || efi_distributor[0] == '\0') -@@ -1880,8 +1892,11 @@ main (int argc, char *argv[]) - efidir_grub_dev->disk->name, - (part ? ",": ""), (part ? : "")); - grub_free (part); -- grub_install_register_efi (efidir_grub_dev, -- efifile_path, efi_distributor); -+ ret = grub_install_register_efi (efidir_grub_dev, -+ efifile_path, efi_distributor); -+ if (ret) -+ grub_util_error (_("efibootmgr failed to register the boot entry: %s"), -+ strerror (ret)); - } - break; - -@@ -1889,6 +1904,7 @@ main (int argc, char *argv[]) - case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: - case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: - case GRUB_INSTALL_PLATFORM_I386_COREBOOT: -+ case GRUB_INSTALL_PLATFORM_ARM_COREBOOT: - case GRUB_INSTALL_PLATFORM_I386_MULTIBOOT: - case GRUB_INSTALL_PLATFORM_MIPSEL_ARC: - case GRUB_INSTALL_PLATFORM_ARM_UBOOT: -diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index aba19d21b9a774e63ad49f166554d90f8c667e36..98d24cc06ea57b88a4f02f38f177f44ec4f38f3f 100644 ---- a/util/grub-mkimage.c -+++ b/util/grub-mkimage.c -@@ -71,6 +71,7 @@ static struct argp_option options[] = { - N_("embed FILE as a memdisk image\n" - "Implies `-p (memdisk)/boot/grub' and overrides any prefix supplied previously," - " but the prefix itself can be overridden by later options"), 0}, -+ {"dtb", 'D', N_("FILE"), 0, N_("embed FILE as a device tree (DTB)\n"), 0}, - /* TRANSLATORS: "embed" is a verb (command description). "*/ - {"config", 'c', N_("FILE"), 0, N_("embed FILE as an early config"), 0}, - /* TRANSLATORS: "embed" is a verb (command description). "*/ -@@ -117,6 +118,7 @@ struct arguments - char *dir; - char *prefix; - char *memdisk; -+ char *dtb; - char **pubkeys; - size_t npubkeys; - char *font; -@@ -176,6 +178,13 @@ argp_parser (int key, char *arg, struct argp_state *state) - arguments->prefix = xstrdup ("(memdisk)/boot/grub"); - break; - -+ case 'D': -+ if (arguments->dtb) -+ free (arguments->dtb); -+ -+ arguments->dtb = xstrdup (arg); -+ break; -+ - case 'k': - arguments->pubkeys = xrealloc (arguments->pubkeys, - sizeof (arguments->pubkeys[0]) -@@ -300,7 +309,7 @@ main (int argc, char *argv[]) - arguments.memdisk, arguments.pubkeys, - arguments.npubkeys, arguments.config, - arguments.image_target, arguments.note, -- arguments.comp); -+ arguments.comp, arguments.dtb); - - grub_util_file_sync (fp); - fclose (fp); -diff --git a/util/grub-mkimage32.c b/util/grub-mkimage32.c -index 9b31397bc40b95b69a1edc4f2d4c4b5d6eaa63cd..1f2ccccd225bbbb32e7e38801ddafeb90d9a69bb 100644 ---- a/util/grub-mkimage32.c -+++ b/util/grub-mkimage32.c -@@ -19,4 +19,6 @@ - # define ELF_ST_TYPE(val) ELF32_ST_TYPE(val) - #define XEN_NOTE_SIZE 132 - -+#ifndef GRUB_MKIMAGEXX - #include "grub-mkimagexx.c" -+#endif -diff --git a/util/grub-mkimage64.c b/util/grub-mkimage64.c -index d83345924705353b3c20a1e4dd087371ec5383ec..4ff72a625e0030d05cee0675a481b0803cda081e 100644 ---- a/util/grub-mkimage64.c -+++ b/util/grub-mkimage64.c -@@ -19,4 +19,6 @@ - # define ELF_ST_TYPE(val) ELF64_ST_TYPE(val) - #define XEN_NOTE_SIZE 120 - -+#ifndef GRUB_MKIMAGEXX - #include "grub-mkimagexx.c" -+#endif -diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index e63f148e48cf6f66852b15063405f81371d95ae9..a483c674c4908bca02ecda73de78d04456667a37 100644 ---- a/util/grub-mkimagexx.c -+++ b/util/grub-mkimagexx.c -@@ -50,6 +50,15 @@ - - #pragma GCC diagnostic ignored "-Wcast-align" - -+#define GRUB_MKIMAGEXX -+#if !defined(MKIMAGE_ELF32) && !defined(MKIMAGE_ELF64) -+#if __SIZEOF_POINTER__ == 8 -+#include "grub-mkimage64.c" -+#else -+#include "grub-mkimage32.c" -+#endif -+#endif -+ - /* These structures are defined according to the CHRP binding to IEEE1275, - "Client Program Format" section. */ - -@@ -84,10 +93,22 @@ struct fixup_block_list - - #define ALIGN_ADDR(x) (ALIGN_UP((x), image_target->voidp_sizeof)) - -+struct section_metadata -+{ -+ Elf_Half num_sections; -+ Elf_Shdr *sections; -+ Elf_Addr *addrs; -+ Elf_Addr *vaddrs; -+ Elf_Half section_entsize; -+ Elf_Shdr *symtab; -+ const char *strtab; -+}; -+ - static int - is_relocatable (const struct grub_install_image_target_desc *image_target) - { -- return image_target->id == IMAGE_EFI || image_target->id == IMAGE_UBOOT; -+ return image_target->id == IMAGE_EFI || image_target->id == IMAGE_UBOOT -+ || (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM); - } - - #ifdef MKIMAGE_ELF32 -@@ -185,8 +206,8 @@ grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr sym_addr) - void - SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc *image_target, - int note, char **core_img, size_t *core_size, -- Elf_Addr target_addr, grub_size_t align, -- size_t kernel_size, size_t bss_size) -+ Elf_Addr target_addr, -+ struct grub_mkimage_layout *layout) - { - char *elf_img; - size_t program_size; -@@ -214,7 +235,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc - footer_size += XEN_NOTE_SIZE; - } - header_size = ALIGN_UP (sizeof (*ehdr) + phnum * sizeof (*phdr) -- + shnum * sizeof (*shdr) + string_size, align); -+ + shnum * sizeof (*shdr) + string_size, layout->align); - - program_size = ALIGN_ADDR (*core_size); - -@@ -258,7 +279,8 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc - ehdr->e_entry = grub_host_to_target32 (target_addr); - phdr->p_vaddr = grub_host_to_target32 (target_addr); - phdr->p_paddr = grub_host_to_target32 (target_addr); -- phdr->p_align = grub_host_to_target32 (align > image_target->link_align ? align : image_target->link_align); -+ phdr->p_align = grub_host_to_target32 (layout->align > image_target->link_align ? -+ layout->align : image_target->link_align); - if (image_target->id == IMAGE_LOONGSON_ELF) - ehdr->e_flags = grub_host_to_target32 (0x1000 | EF_MIPS_NOREORDER - | EF_MIPS_PIC | EF_MIPS_CPIC); -@@ -272,27 +294,34 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc - else - { - grub_uint32_t target_addr_mods; -- phdr->p_filesz = grub_host_to_target32 (kernel_size); -- phdr->p_memsz = grub_host_to_target32 (kernel_size + bss_size); -+ phdr->p_filesz = grub_host_to_target32 (layout->kernel_size); -+ if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM) -+ phdr->p_memsz = grub_host_to_target32 (layout->kernel_size); -+ else -+ phdr->p_memsz = grub_host_to_target32 (layout->kernel_size + layout->bss_size); - - phdr++; - phdr->p_type = grub_host_to_target32 (PT_GNU_STACK); -- phdr->p_offset = grub_host_to_target32 (header_size + kernel_size); -+ phdr->p_offset = grub_host_to_target32 (header_size + layout->kernel_size); - phdr->p_paddr = phdr->p_vaddr = phdr->p_filesz = phdr->p_memsz = 0; - phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X); - phdr->p_align = grub_host_to_target32 (image_target->link_align); - - phdr++; - phdr->p_type = grub_host_to_target32 (PT_LOAD); -- phdr->p_offset = grub_host_to_target32 (header_size + kernel_size); -+ phdr->p_offset = grub_host_to_target32 (header_size + layout->kernel_size); - phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X); - phdr->p_filesz = phdr->p_memsz -- = grub_host_to_target32 (*core_size - kernel_size); -+ = grub_host_to_target32 (*core_size - layout->kernel_size); - -- if (image_target->id == IMAGE_COREBOOT) -+ if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_386) - target_addr_mods = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR; -+ else if (image_target->id == IMAGE_COREBOOT && image_target->elf_target == EM_ARM) -+ target_addr_mods = ALIGN_UP (target_addr + layout->end -+ + image_target->mod_gap, -+ image_target->mod_align); - else -- target_addr_mods = ALIGN_UP (target_addr + kernel_size + bss_size -+ target_addr_mods = ALIGN_UP (target_addr + layout->kernel_size + layout->bss_size - + image_target->mod_gap, - image_target->mod_align); - phdr->p_vaddr = grub_host_to_target_addr (target_addr_mods); -@@ -434,7 +463,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc - shdr->sh_size = grub_host_to_target32 (string_size); - shdr->sh_link = grub_host_to_target32 (0); - shdr->sh_info = grub_host_to_target32 (0); -- shdr->sh_addralign = grub_host_to_target32 (align); -+ shdr->sh_addralign = grub_host_to_target32 (layout->align); - shdr->sh_entsize = grub_host_to_target32 (0); - shdr++; - -@@ -445,10 +474,10 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc - shdr->sh_type = grub_host_to_target32 (SHT_PROGBITS); - shdr->sh_addr = grub_host_to_target_addr (target_addr); - shdr->sh_offset = grub_host_to_target_addr (header_size); -- shdr->sh_size = grub_host_to_target32 (kernel_size); -+ shdr->sh_size = grub_host_to_target32 (layout->kernel_size); - shdr->sh_link = grub_host_to_target32 (0); - shdr->sh_info = grub_host_to_target32 (0); -- shdr->sh_addralign = grub_host_to_target32 (align); -+ shdr->sh_addralign = grub_host_to_target32 (layout->align); - shdr->sh_entsize = grub_host_to_target32 (0); - shdr++; - -@@ -456,9 +485,9 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc - shdr->sh_name = grub_host_to_target32 (ptr - str_start); - ptr += sizeof ("mods"); - shdr->sh_type = grub_host_to_target32 (SHT_PROGBITS); -- shdr->sh_addr = grub_host_to_target_addr (target_addr + kernel_size); -- shdr->sh_offset = grub_host_to_target_addr (header_size + kernel_size); -- shdr->sh_size = grub_host_to_target32 (*core_size - kernel_size); -+ shdr->sh_addr = grub_host_to_target_addr (target_addr + layout->kernel_size); -+ shdr->sh_offset = grub_host_to_target_addr (header_size + layout->kernel_size); -+ shdr->sh_size = grub_host_to_target32 (*core_size - layout->kernel_size); - shdr->sh_link = grub_host_to_target32 (0); - shdr->sh_info = grub_host_to_target32 (0); - shdr->sh_addralign = grub_host_to_target32 (image_target->voidp_sizeof); -@@ -471,7 +500,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc - shdr->sh_name = grub_host_to_target32 (ptr - str_start); - ptr += sizeof (".xen"); - shdr->sh_type = grub_host_to_target32 (SHT_PROGBITS); -- shdr->sh_addr = grub_host_to_target_addr (target_addr + kernel_size); -+ shdr->sh_addr = grub_host_to_target_addr (target_addr + layout->kernel_size); - shdr->sh_offset = grub_host_to_target_addr (program_size + header_size); - shdr->sh_size = grub_host_to_target32 (XEN_NOTE_SIZE); - shdr->sh_link = grub_host_to_target32 (0); -@@ -490,9 +519,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc - /* Relocate symbols; note that this function overwrites the symbol table. - Return the address of a start symbol. */ - static Elf_Addr --SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, -- Elf_Shdr *symtab_section, Elf_Addr *section_addresses, -- Elf_Half section_entsize, Elf_Half num_sections, -+SUFFIX (relocate_symbols) (Elf_Ehdr *e, struct section_metadata *smd, - void *jumpers, Elf_Addr jumpers_addr, - Elf_Addr bss_start, Elf_Addr end, - const struct grub_install_image_target_desc *image_target) -@@ -502,19 +529,18 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, - Elf_Addr start_address = (Elf_Addr) -1; - Elf_Sym *sym; - Elf_Word i; -- Elf_Shdr *strtab_section; -- const char *strtab; -+ Elf_Shdr *symtab_section; -+ const char *symtab; - grub_uint64_t *jptr = jumpers; - -- strtab_section -- = (Elf_Shdr *) ((char *) sections -- + (grub_target_to_host32 (symtab_section->sh_link) -- * section_entsize)); -- strtab = (char *) e + grub_target_to_host (strtab_section->sh_offset); -+ symtab_section = (Elf_Shdr *) ((char *) smd->sections -+ + grub_target_to_host32 (smd->symtab->sh_link) -+ * smd->section_entsize); -+ symtab = (char *) e + grub_target_to_host (symtab_section->sh_offset); - -- symtab_size = grub_target_to_host (symtab_section->sh_size); -- sym_size = grub_target_to_host (symtab_section->sh_entsize); -- symtab_offset = grub_target_to_host (symtab_section->sh_offset); -+ symtab_size = grub_target_to_host (smd->symtab->sh_size); -+ sym_size = grub_target_to_host (smd->symtab->sh_entsize); -+ symtab_offset = grub_target_to_host (smd->symtab->sh_offset); - num_syms = symtab_size / sym_size; - - for (i = 0, sym = (Elf_Sym *) ((char *) e + symtab_offset); -@@ -524,7 +550,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, - Elf_Section cur_index; - const char *name; - -- name = strtab + grub_target_to_host32 (sym->st_name); -+ name = symtab + grub_target_to_host32 (sym->st_name); - - cur_index = grub_target_to_host16 (sym->st_shndx); - if (cur_index == STN_ABS) -@@ -542,12 +568,12 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, - else - continue; - } -- else if (cur_index >= num_sections) -+ else if (cur_index >= smd->num_sections) - grub_util_error ("section %d does not exist", cur_index); - else - { - sym->st_value = (grub_target_to_host (sym->st_value) -- + section_addresses[cur_index]); -+ + smd->vaddrs[cur_index]); - } - - if (image_target->elf_target == EM_IA_64 && ELF_ST_TYPE (sym->st_info) -@@ -562,7 +588,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, - grub_util_info ("locating %s at 0x%" GRUB_HOST_PRIxLONG_LONG - " (0x%" GRUB_HOST_PRIxLONG_LONG ")", name, - (unsigned long long) sym->st_value, -- (unsigned long long) section_addresses[cur_index]); -+ (unsigned long long) smd->vaddrs[cur_index]); - - if (start_address == (Elf_Addr)-1) - if (strcmp (name, "_start") == 0 || strcmp (name, "start") == 0) -@@ -699,17 +725,19 @@ arm_get_trampoline_size (Elf_Ehdr *e, - } - #endif - -+static int -+SUFFIX (is_kept_section) (Elf_Shdr *s, const struct grub_install_image_target_desc *image_target); -+static int -+SUFFIX (is_kept_reloc_section) (Elf_Shdr *s, const struct grub_install_image_target_desc *image_target, -+ struct section_metadata *smd); -+ - /* Deal with relocation information. This function relocates addresses - within the virtual address space starting from 0. So only relative - addresses can be fully resolved. Absolute addresses must be relocated - again by a PE32 relocator when loaded. */ - static void --SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, -- Elf_Addr *section_addresses, -- Elf_Half section_entsize, Elf_Half num_sections, -- const char *strtab, -- char *pe_target, Elf_Addr tramp_off, -- Elf_Addr got_off, -+SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd, -+ char *pe_target, Elf_Addr tramp_off, Elf_Addr got_off, - const struct grub_install_image_target_desc *image_target) - { - Elf_Half i; -@@ -723,33 +751,37 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, - grub_uint32_t *tr = (void *) (pe_target + tramp_off); - #endif - -- for (i = 0, s = sections; -- i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -+ for (i = 0, s = smd->sections; -+ i < smd->num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd->section_entsize)) - if ((s->sh_type == grub_host_to_target32 (SHT_REL)) || - (s->sh_type == grub_host_to_target32 (SHT_RELA))) - { - Elf_Rela *r; - Elf_Word rtab_size, r_size, num_rs; - Elf_Off rtab_offset; -- Elf_Shdr *symtab_section; - Elf_Word target_section_index; - Elf_Addr target_section_addr; - Elf_Shdr *target_section; - Elf_Word j; - -- symtab_section = (Elf_Shdr *) ((char *) sections -- + (grub_target_to_host32 (s->sh_link) -- * section_entsize)); -+ if (!SUFFIX (is_kept_section) (s, image_target) && -+ !SUFFIX (is_kept_reloc_section) (s, image_target, smd)) -+ { -+ grub_util_info ("not translating relocations for omitted section %s", -+ smd->strtab + grub_le_to_cpu32 (s->sh_name)); -+ continue; -+ } -+ - target_section_index = grub_target_to_host32 (s->sh_info); -- target_section_addr = section_addresses[target_section_index]; -- target_section = (Elf_Shdr *) ((char *) sections -+ target_section_addr = smd->addrs[target_section_index]; -+ target_section = (Elf_Shdr *) ((char *) smd->sections - + (target_section_index -- * section_entsize)); -+ * smd->section_entsize)); - - grub_util_info ("dealing with the relocation section %s for %s", -- strtab + grub_target_to_host32 (s->sh_name), -- strtab + grub_target_to_host32 (target_section->sh_name)); -+ smd->strtab + grub_target_to_host32 (s->sh_name), -+ smd->strtab + grub_target_to_host32 (target_section->sh_name)); - - rtab_size = grub_target_to_host (s->sh_size); - r_size = grub_target_to_host (s->sh_entsize); -@@ -770,7 +802,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, - target = SUFFIX (get_target_address) (e, target_section, - offset, image_target); - info = grub_target_to_host (r->r_info); -- sym_addr = SUFFIX (get_symbol_address) (e, symtab_section, -+ sym_addr = SUFFIX (get_symbol_address) (e, smd->symtab, - ELF_R_SYM (info), image_target); - - addend = (s->sh_type == grub_target_to_host32 (SHT_RELA)) ? -@@ -832,6 +864,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - { - grub_uint32_t *t32 = (grub_uint32_t *) target; - *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32) -@@ -900,8 +933,8 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, - Elf_Sym *sym; - - sym = (Elf_Sym *) ((char *) e -- + grub_target_to_host (symtab_section->sh_offset) -- + ELF_R_SYM (info) * grub_target_to_host (symtab_section->sh_entsize)); -+ + grub_target_to_host (smd->symtab->sh_offset) -+ + ELF_R_SYM (info) * grub_target_to_host (smd->symtab->sh_entsize)); - if (ELF_ST_TYPE (sym->st_info) == STT_FUNC) - sym_addr = grub_target_to_host64 (*(grub_uint64_t *) (pe_target - + sym->st_value -@@ -1086,8 +1119,8 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, - - (char *) e), - sym_addr); - sym = (Elf_Sym *) ((char *) e -- + grub_target_to_host (symtab_section->sh_offset) -- + ELF_R_SYM (info) * grub_target_to_host (symtab_section->sh_entsize)); -+ + grub_target_to_host (smd->symtab->sh_offset) -+ + ELF_R_SYM (info) * grub_target_to_host (smd->symtab->sh_entsize)); - if (ELF_ST_TYPE (sym->st_info) != STT_FUNC) - sym_addr |= 1; - if (!(sym_addr & 1)) -@@ -1625,9 +1658,7 @@ create_u64_fixups (struct translate_context *ctx, - /* Make a .reloc section. */ - static void - make_reloc_section (Elf_Ehdr *e, struct grub_mkimage_layout *layout, -- Elf_Addr *section_addresses, Elf_Shdr *sections, -- Elf_Half section_entsize, Elf_Half num_sections, -- const char *strtab, -+ struct section_metadata *smd, - const struct grub_install_image_target_desc *image_target) - { - unsigned i; -@@ -1636,8 +1667,8 @@ make_reloc_section (Elf_Ehdr *e, struct grub_mkimage_layout *layout, - - translate_reloc_start (&ctx, image_target); - -- for (i = 0, s = sections; i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -+ for (i = 0, s = smd->sections; i < smd->num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd->section_entsize)) - if ((grub_target_to_host32 (s->sh_type) == SHT_REL) || - (grub_target_to_host32 (s->sh_type) == SHT_RELA)) - { -@@ -1647,15 +1678,22 @@ make_reloc_section (Elf_Ehdr *e, struct grub_mkimage_layout *layout, - Elf_Addr section_address; - Elf_Word j; - -+ if (!SUFFIX (is_kept_reloc_section) (s, image_target, smd)) -+ { -+ grub_util_info ("not translating the skipped relocation section %s", -+ smd->strtab + grub_le_to_cpu32 (s->sh_name)); -+ continue; -+ } -+ - grub_util_info ("translating the relocation section %s", -- strtab + grub_le_to_cpu32 (s->sh_name)); -+ smd->strtab + grub_le_to_cpu32 (s->sh_name)); - - rtab_size = grub_target_to_host (s->sh_size); - r_size = grub_target_to_host (s->sh_entsize); - rtab_offset = grub_target_to_host (s->sh_offset); - num_rs = rtab_size / r_size; - -- section_address = section_addresses[grub_le_to_cpu32 (s->sh_info)]; -+ section_address = smd->vaddrs[grub_le_to_cpu32 (s->sh_info)]; - - for (j = 0, r = (Elf_Rel *) ((char *) e + rtab_offset); - j < num_rs; -@@ -1722,6 +1760,56 @@ SUFFIX (is_bss_section) (Elf_Shdr *s, const struct grub_install_image_target_des - == SHF_ALLOC) && (grub_target_to_host32 (s->sh_type) == SHT_NOBITS); - } - -+/* Determine if a section is going to be in the final output */ -+static int -+SUFFIX (is_kept_section) (Elf_Shdr *s, const struct grub_install_image_target_desc *image_target) -+{ -+ /* We keep .text and .data */ -+ if (SUFFIX (is_text_section) (s, image_target) -+ || SUFFIX (is_data_section) (s, image_target)) -+ return 1; -+ -+ /* -+ * And we keep .bss if we're producing PE binaries or the target doesn't -+ * have a relocating loader. Platforms other than EFI and U-boot shouldn't -+ * have .bss in their binaries as we build with -Wl,-Ttext. -+ */ -+ if (SUFFIX (is_bss_section) (s, image_target) -+ && (image_target->id == IMAGE_EFI || !is_relocatable (image_target))) -+ return 1; -+ -+ /* Otherwise this is not a section we're keeping in the final output. */ -+ return 0; -+} -+ -+static int -+SUFFIX (is_kept_reloc_section) (Elf_Shdr *s, const struct grub_install_image_target_desc *image_target, -+ struct section_metadata *smd) -+{ -+ int i; -+ int r = 0; -+ const char *name = smd->strtab + grub_host_to_target32 (s->sh_name); -+ -+ if (!strncmp (name, ".rela.", 6)) -+ name += 5; -+ else if (!strncmp (name, ".rel.", 5)) -+ name += 4; -+ else -+ return 1; -+ -+ for (i = 0, s = smd->sections; i < smd->num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd->section_entsize)) -+ { -+ const char *sname = smd->strtab + grub_host_to_target32 (s->sh_name); -+ if (strcmp (sname, name)) -+ continue; -+ -+ return SUFFIX (is_kept_section) (s, image_target); -+ } -+ -+ return r; -+} -+ - /* Return if the ELF header is valid. */ - static int - SUFFIX (check_elf_header) (Elf_Ehdr *e, size_t size, const struct grub_install_image_target_desc *image_target) -@@ -1742,12 +1830,11 @@ SUFFIX (check_elf_header) (Elf_Ehdr *e, size_t size, const struct grub_install_i - static Elf_Addr - SUFFIX (put_section) (Elf_Shdr *s, int i, - Elf_Addr current_address, -- Elf_Addr *section_addresses, -- const char *strtab, -+ struct section_metadata *smd, - const struct grub_install_image_target_desc *image_target) - { - Elf_Word align = grub_host_to_target_addr (s->sh_addralign); -- const char *name = strtab + grub_host_to_target32 (s->sh_name); -+ const char *name = smd->strtab + grub_host_to_target32 (s->sh_name); - - if (align) - current_address = ALIGN_UP (current_address + image_target->vaddr_offset, -@@ -1759,24 +1846,23 @@ SUFFIX (put_section) (Elf_Shdr *s, int i, - name, (unsigned long long) current_address); - if (!is_relocatable (image_target)) - current_address = grub_host_to_target_addr (s->sh_addr) -- - image_target->link_addr; -- section_addresses[i] = current_address; -+ - image_target->link_addr; -+ smd->addrs[i] = current_address; - current_address += grub_host_to_target_addr (s->sh_size); - return current_address; - } - --/* Locate section addresses by merging code sections and data sections -- into .text and .data, respectively. Return the array of section -- addresses. */ --static Elf_Addr * -+/* -+ * Locate section addresses by merging code sections and data sections -+ * into .text and .data, respectively. -+ */ -+static void - SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, -- Elf_Shdr *sections, Elf_Half section_entsize, -- Elf_Half num_sections, const char *strtab, -+ struct section_metadata *smd, - struct grub_mkimage_layout *layout, - const struct grub_install_image_target_desc *image_target) - { - int i; -- Elf_Addr *section_addresses; - Elf_Shdr *s; - - layout->align = 1; -@@ -1784,30 +1870,23 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, - if (image_target->elf_target == EM_AARCH64) - layout->align = 4096; - -- section_addresses = xmalloc (sizeof (*section_addresses) * num_sections); -- memset (section_addresses, 0, sizeof (*section_addresses) * num_sections); -- - layout->kernel_size = 0; - -- for (i = 0, s = sections; -- i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -- if ((grub_target_to_host (s->sh_flags) & SHF_ALLOC) -+ for (i = 0, s = smd->sections; -+ i < smd->num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd->section_entsize)) -+ if ((grub_target_to_host (s->sh_flags) & SHF_ALLOC) - && grub_host_to_target32 (s->sh_addralign) > layout->align) - layout->align = grub_host_to_target32 (s->sh_addralign); - -- - /* .text */ -- for (i = 0, s = sections; -- i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -+ for (i = 0, s = smd->sections; -+ i < smd->num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd->section_entsize)) - if (SUFFIX (is_text_section) (s, image_target)) - { -- layout->kernel_size = SUFFIX (put_section) (s, i, -- layout->kernel_size, -- section_addresses, -- strtab, -- image_target); -+ layout->kernel_size = SUFFIX (put_section) (s, i, layout->kernel_size, -+ smd, image_target); - if (!is_relocatable (image_target) && - grub_host_to_target_addr (s->sh_addr) != image_target->link_addr) - { -@@ -1827,15 +1906,12 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, - layout->exec_size = layout->kernel_size; - - /* .data */ -- for (i = 0, s = sections; -- i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -+ for (i = 0, s = smd->sections; -+ i < smd->num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd->section_entsize)) - if (SUFFIX (is_data_section) (s, image_target)) -- layout->kernel_size = SUFFIX (put_section) (s, i, -- layout->kernel_size, -- section_addresses, -- strtab, -- image_target); -+ layout->kernel_size = SUFFIX (put_section) (s, i, layout->kernel_size, smd, -+ image_target); - - #ifdef MKIMAGE_ELF32 - if (image_target->elf_target == EM_ARM) -@@ -1846,8 +1922,8 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, - - layout->kernel_size = ALIGN_UP (layout->kernel_size, 16); - -- tramp = arm_get_trampoline_size (e, sections, section_entsize, -- num_sections, image_target); -+ tramp = arm_get_trampoline_size (e, smd->sections, smd->section_entsize, -+ smd->num_sections, image_target); - - layout->tramp_off = layout->kernel_size; - layout->kernel_size += ALIGN_UP (tramp, 16); -@@ -1858,15 +1934,18 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, - layout->end = layout->kernel_size; - - /* .bss */ -- for (i = 0, s = sections; -- i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -- if (SUFFIX (is_bss_section) (s, image_target)) -- layout->end = SUFFIX (put_section) (s, i, -- layout->end, -- section_addresses, -- strtab, -- image_target); -+ for (i = 0, s = smd->sections; -+ i < smd->num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd->section_entsize)) -+ { -+ if (SUFFIX (is_bss_section) (s, image_target)) -+ layout->end = SUFFIX (put_section) (s, i, layout->end, smd, image_target); -+ -+ /* -+ * This must to be in the last time this function passes through the loop. -+ */ -+ smd->vaddrs[i] = smd->addrs[i] + image_target->vaddr_offset; -+ } - - layout->end = ALIGN_UP (layout->end + image_target->vaddr_offset, - image_target->section_align) - image_target->vaddr_offset; -@@ -1875,10 +1954,8 @@ SUFFIX (locate_sections) (Elf_Ehdr *e, const char *kernel_path, - Platforms other than EFI and U-boot shouldn't have .bss in - their binaries as we build with -Wl,-Ttext. - */ -- if (image_target->id != IMAGE_UBOOT) -+ if (image_target->id == IMAGE_EFI || !is_relocatable (image_target)) - layout->kernel_size = layout->end; -- -- return section_addresses; - } - - char * -@@ -1888,18 +1965,12 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, - const struct grub_install_image_target_desc *image_target) - { - char *kernel_img, *out_img; -- const char *strtab; -+ struct section_metadata smd = { 0, 0, 0, 0, 0, 0, 0 }; - Elf_Ehdr *e; -- Elf_Shdr *sections; -- Elf_Addr *section_addresses; -- Elf_Addr *section_vaddresses; - int i; - Elf_Shdr *s; -- Elf_Half num_sections; - Elf_Off section_offset; -- Elf_Half section_entsize; - grub_size_t kernel_size; -- Elf_Shdr *symtab_section = 0; - - grub_memset (layout, 0, sizeof (*layout)); - -@@ -1914,48 +1985,45 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, - grub_util_error ("invalid ELF header"); - - section_offset = grub_target_to_host (e->e_shoff); -- section_entsize = grub_target_to_host16 (e->e_shentsize); -- num_sections = grub_target_to_host16 (e->e_shnum); -+ smd.section_entsize = grub_target_to_host16 (e->e_shentsize); -+ smd.num_sections = grub_target_to_host16 (e->e_shnum); - -- if (kernel_size < section_offset + (grub_uint32_t) section_entsize * num_sections) -+ if (kernel_size < section_offset -+ + (grub_uint32_t) smd.section_entsize * smd.num_sections) - grub_util_error (_("premature end of file %s"), kernel_path); - -- sections = (Elf_Shdr *) (kernel_img + section_offset); -+ smd.sections = (Elf_Shdr *) (kernel_img + section_offset); - - /* Relocate sections then symbols in the virtual address space. */ -- s = (Elf_Shdr *) ((char *) sections -- + grub_host_to_target16 (e->e_shstrndx) * section_entsize); -- strtab = (char *) e + grub_host_to_target_addr (s->sh_offset); -+ s = (Elf_Shdr *) ((char *) smd.sections -+ + grub_host_to_target16 (e->e_shstrndx) * smd.section_entsize); -+ smd.strtab = (char *) e + grub_host_to_target_addr (s->sh_offset); - -- section_addresses = SUFFIX (locate_sections) (e, kernel_path, -- sections, section_entsize, -- num_sections, strtab, -- layout, -- image_target); -+ smd.addrs = xmalloc (sizeof (*smd.addrs) * smd.num_sections); -+ memset (smd.addrs, 0, sizeof (*smd.addrs) * smd.num_sections); -+ smd.vaddrs = xmalloc (sizeof (*smd.vaddrs) * smd.num_sections); -+ memset (smd.vaddrs, 0, sizeof (*smd.vaddrs) * smd.num_sections); - -- section_vaddresses = xmalloc (sizeof (*section_addresses) * num_sections); -- -- for (i = 0; i < num_sections; i++) -- section_vaddresses[i] = section_addresses[i] + image_target->vaddr_offset; -+ SUFFIX (locate_sections) (e, kernel_path, &smd, layout, image_target); - - if (!is_relocatable (image_target)) - { - Elf_Addr current_address = layout->kernel_size; - -- for (i = 0, s = sections; -- i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -+ for (i = 0, s = smd.sections; -+ i < smd.num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd.section_entsize)) - if (grub_target_to_host32 (s->sh_type) == SHT_NOBITS) - { - Elf_Word sec_align = grub_host_to_target_addr (s->sh_addralign); -- const char *name = strtab + grub_host_to_target32 (s->sh_name); -+ const char *name = smd.strtab + grub_host_to_target32 (s->sh_name); - - if (sec_align) - current_address = ALIGN_UP (current_address - + image_target->vaddr_offset, - sec_align) - - image_target->vaddr_offset; -- -+ - grub_util_info ("locating the section %s at 0x%" - GRUB_HOST_PRIxLONG_LONG, - name, (unsigned long long) current_address); -@@ -1963,7 +2031,7 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, - current_address = grub_host_to_target_addr (s->sh_addr) - - image_target->link_addr; - -- section_vaddresses[i] = current_address -+ smd.vaddrs[i] = current_address - + image_target->vaddr_offset; - current_address += grub_host_to_target_addr (s->sh_size); - } -@@ -1978,21 +2046,22 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, - if (image_target->id == IMAGE_SPARC64_AOUT - || image_target->id == IMAGE_SPARC64_RAW - || image_target->id == IMAGE_UBOOT -+ || image_target->id == IMAGE_COREBOOT - || image_target->id == IMAGE_SPARC64_CDCORE) - layout->kernel_size = ALIGN_UP (layout->kernel_size, image_target->mod_align); - - if (is_relocatable (image_target)) - { -- symtab_section = NULL; -- for (i = 0, s = sections; -- i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -+ smd.symtab = NULL; -+ for (i = 0, s = smd.sections; -+ i < smd.num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd.section_entsize)) - if (s->sh_type == grub_host_to_target32 (SHT_SYMTAB)) - { -- symtab_section = s; -+ smd.symtab = s; - break; - } -- if (! symtab_section) -+ if (! smd.symtab) - grub_util_error ("%s", _("no symbol table")); - #ifdef MKIMAGE_ELF64 - if (image_target->elf_target == EM_IA_64) -@@ -2007,7 +2076,7 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, - layout->kernel_size += ALIGN_UP (tramp, 16); - - layout->ia64jmp_off = layout->kernel_size; -- layout->ia64jmpnum = SUFFIX (count_funcs) (e, symtab_section, -+ layout->ia64jmpnum = SUFFIX (count_funcs) (e, smd.symtab, - image_target); - layout->kernel_size += 16 * layout->ia64jmpnum; - -@@ -2038,31 +2107,19 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, - - if (is_relocatable (image_target)) - { -- layout->start_address = SUFFIX (relocate_symbols) (e, sections, symtab_section, -- section_vaddresses, section_entsize, -- num_sections, -- (char *) out_img + layout->ia64jmp_off, -- layout->ia64jmp_off -- + image_target->vaddr_offset, -- layout->bss_start, -- layout->end, -- image_target); -+ layout->start_address = SUFFIX (relocate_symbols) (e, &smd, -+ (char *) out_img + layout->ia64jmp_off, -+ layout->ia64jmp_off + image_target->vaddr_offset, -+ layout->bss_start, layout->end, image_target); -+ - if (layout->start_address == (Elf_Addr) -1) - grub_util_error ("start symbol is not defined"); - -- /* Resolve addresses in the virtual address space. */ -- SUFFIX (relocate_addresses) (e, sections, section_addresses, -- section_entsize, -- num_sections, strtab, -- out_img, layout->tramp_off, -- layout->got_off, -- image_target); -+ /* Resolve addrs in the virtual address space. */ -+ SUFFIX (relocate_addrs) (e, &smd, out_img, layout->tramp_off, -+ layout->got_off, image_target); - -- make_reloc_section (e, layout, -- section_vaddresses, sections, -- section_entsize, num_sections, -- strtab, -- image_target); -+ make_reloc_section (e, layout, &smd, image_target); - if (image_target->id != IMAGE_EFI) - { - out_img = xrealloc (out_img, layout->kernel_size + total_module_size -@@ -2074,30 +2131,25 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, - } - } - -- for (i = 0, s = sections; -- i < num_sections; -- i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) -- if (SUFFIX (is_data_section) (s, image_target) -- /* Explicitly initialize BSS -- when producing PE32 to avoid a bug in EFI implementations. -- Platforms other than EFI and U-boot shouldn't have .bss in -- their binaries as we build with -Wl,-Ttext. -- */ -- || (SUFFIX (is_bss_section) (s, image_target) && (image_target->id != IMAGE_UBOOT)) -- || SUFFIX (is_text_section) (s, image_target)) -+ for (i = 0, s = smd.sections; -+ i < smd.num_sections; -+ i++, s = (Elf_Shdr *) ((char *) s + smd.section_entsize)) -+ if (SUFFIX (is_kept_section) (s, image_target)) - { - if (grub_target_to_host32 (s->sh_type) == SHT_NOBITS) -- memset (out_img + section_addresses[i], 0, -+ memset (out_img + smd.addrs[i], 0, - grub_host_to_target_addr (s->sh_size)); - else -- memcpy (out_img + section_addresses[i], -+ memcpy (out_img + smd.addrs[i], - kernel_img + grub_host_to_target_addr (s->sh_offset), - grub_host_to_target_addr (s->sh_size)); - } - free (kernel_img); - -- free (section_vaddresses); -- free (section_addresses); -+ free (smd.vaddrs); -+ smd.vaddrs = NULL; -+ free (smd.addrs); -+ smd.addrs = NULL; - - return out_img; - } -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index 238d4840e2f9613c6392e16cb88e7f413cae41c4..9545945d8f3b1a85dea8404fe1a0c9b3a3b84ba1 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -323,6 +323,7 @@ check_xorriso (const char *val) - char *buf = NULL; - size_t len = 0; - int ret = 0; -+ int wstatus = 0; - - argv[0] = xorriso; - argv[1] = "-as"; -@@ -347,8 +348,10 @@ check_xorriso (const char *val) - } - - close (fd); -- waitpid (pid, NULL, 0); -+ waitpid (pid, &wstatus, 0); - free (buf); -+ if (!WIFEXITED (wstatus) || WEXITSTATUS(wstatus) != 0) -+ return 0; - return ret; - } - -@@ -426,6 +429,7 @@ main (int argc, char *argv[]) - char **argp_argv; - int xorriso_tail_argc; - char **xorriso_tail_argv; -+ int rv; - - grub_util_host_init (&argc, &argv); - grub_util_disable_fd_syncs (); -@@ -478,6 +482,10 @@ main (int argc, char *argv[]) - if (!output_image) - grub_util_error ("%s", _("output file must be specified")); - -+ if (!check_xorriso ("graft-points")) { -+ grub_util_error ("%s", _("xorriso not found")); -+ } -+ - grub_init_all (); - grub_hostfs_init (); - grub_host_init (); -@@ -787,7 +795,6 @@ main (int argc, char *argv[]) - free (efidir_efi_boot); - - efiimgfat = grub_util_path_concat (2, iso9660_dir, "efi.img"); -- int rv; - rv = grub_util_exec ((const char * []) { "mformat", "-C", "-f", "2880", "-L", "16", "-i", - efiimgfat, "::", NULL }); - if (rv != 0) -@@ -960,7 +967,9 @@ main (int argc, char *argv[]) - - xorriso_argv[xorriso_argc] = NULL; - -- grub_util_exec ((const char *const *)xorriso_argv); -+ rv = grub_util_exec ((const char *const *)xorriso_argv); -+ if (rv != 0) -+ grub_util_error ("`%s` invocation failed\n", "xorriso"); - - grub_util_unlink_recursive (iso9660_dir); - -diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c -index 9179285a5ffe5d641a4c2726ce8367dba623d29e..a79271f663166f4d302e1f73d1bcd400c9e8604e 100644 ---- a/util/grub-module-verifier.c -+++ b/util/grub-module-verifier.c -@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = { - -1 - }, (int[]){ - R_X86_64_PC32, -+ R_X86_64_PLT32, - -1 - } - }, -diff --git a/util/grub-probe.c b/util/grub-probe.c -index 8ac527d2f2a17142c5cf873d27c5818477d2c1a4..e45dbf9e049bd41f3122793330b2d0f7bcc844f8 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -62,6 +63,7 @@ enum { - PRINT_DRIVE, - PRINT_DEVICE, - PRINT_PARTMAP, -+ PRINT_PARTUUID, - PRINT_ABSTRACTION, - PRINT_CRYPTODISK_UUID, - PRINT_HINT_STR, -@@ -85,6 +87,7 @@ static const char *targets[] = - [PRINT_DRIVE] = "drive", - [PRINT_DEVICE] = "device", - [PRINT_PARTMAP] = "partmap", -+ [PRINT_PARTUUID] = "partuuid", - [PRINT_ABSTRACTION] = "abstraction", - [PRINT_CRYPTODISK_UUID] = "cryptodisk_uuid", - [PRINT_HINT_STR] = "hints_string", -@@ -129,6 +132,20 @@ get_targets_string (void) - return str; - } - -+static int -+print_gpt_guid (grub_gpt_part_guid_t guid) -+{ -+ guid.data1 = grub_le_to_cpu32 (guid.data1); -+ guid.data2 = grub_le_to_cpu16 (guid.data2); -+ guid.data3 = grub_le_to_cpu16 (guid.data3); -+ -+ return grub_printf ("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", -+ guid.data1, guid.data2, guid.data3, guid.data4[0], -+ guid.data4[1], guid.data4[2], guid.data4[3], -+ guid.data4[4], guid.data4[5], guid.data4[6], -+ guid.data4[7]); -+} -+ - static void - do_print (const char *x, void *data) - { -@@ -167,6 +184,45 @@ probe_partmap (grub_disk_t disk, char delim) - } - } - -+static void -+probe_partuuid (grub_disk_t disk, char delim) -+{ -+ grub_partition_t p = disk->partition; -+ -+ /* -+ * Nested partitions not supported for now. -+ * Non-nested partitions must have disk->partition->parent == NULL -+ */ -+ if (p && p->parent == NULL) -+ { -+ disk->partition = p->parent; -+ -+ if (strcmp(p->partmap->name, "msdos") == 0) -+ { -+ /* -+ * The partition GUID for MSDOS is the partition number (starting -+ * with 1) prepended with the NT disk signature. -+ */ -+ grub_uint32_t nt_disk_sig; -+ -+ if (grub_disk_read (disk, 0, GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC, -+ sizeof(nt_disk_sig), &nt_disk_sig) == 0) -+ grub_printf ("%08x-%02x", -+ grub_le_to_cpu32(nt_disk_sig), 1 + p->number); -+ } -+ else if (strcmp(p->partmap->name, "gpt") == 0) -+ { -+ struct grub_gpt_partentry gptdata; -+ -+ if (grub_disk_read (disk, p->offset, p->index, -+ sizeof(gptdata), &gptdata) == 0) -+ print_gpt_guid(gptdata.guid); -+ } -+ -+ disk->partition = p; -+ } -+} -+ - static void - probe_cryptodisk_uuid (grub_disk_t disk, char delim) - { -@@ -621,6 +677,12 @@ probe (const char *path, char **device_names, char delim) - /* Check if dev->disk itself is contained in a partmap. */ - probe_partmap (dev->disk, delim); - -+ else if (print == PRINT_PARTUUID) -+ { -+ probe_partuuid (dev->disk, delim); -+ putchar (delim); -+ } -+ - else if (print == PRINT_MSDOS_PARTTYPE) - { - if (dev->disk->partition -@@ -641,21 +703,7 @@ probe (const char *path, char **device_names, char delim) - - if (grub_disk_read (dev->disk, p->offset, p->index, - sizeof (gptdata), &gptdata) == 0) -- { -- grub_gpt_part_type_t gpttype; -- gpttype.data1 = grub_le_to_cpu32 (gptdata.type.data1); -- gpttype.data2 = grub_le_to_cpu16 (gptdata.type.data2); -- gpttype.data3 = grub_le_to_cpu16 (gptdata.type.data3); -- grub_memcpy (gpttype.data4, gptdata.type.data4, 8); -- -- grub_printf ("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", -- gpttype.data1, gpttype.data2, -- gpttype.data3, gpttype.data4[0], -- gpttype.data4[1], gpttype.data4[2], -- gpttype.data4[3], gpttype.data4[4], -- gpttype.data4[5], gpttype.data4[6], -- gpttype.data4[7]); -- } -+ print_gpt_guid(gptdata.type); - dev->disk->partition = p; - } - putchar (delim); -diff --git a/util/ieee1275/grub-ofpathname.c b/util/ieee1275/grub-ofpathname.c -index 8e5d766cb63871c1479a42626c8cfa7fddd6f771..300fbddad7c54e2b52d90a7de5eb868a9a1ae705 100644 ---- a/util/ieee1275/grub-ofpathname.c -+++ b/util/ieee1275/grub-ofpathname.c -@@ -46,7 +46,9 @@ int main(int argc, char **argv) - } - - of_path = grub_util_devname_to_ofpath (argv[1]); -- printf("%s\n", of_path); -+ -+ if (of_path) -+ printf ("%s\n", of_path); - - free (of_path); - -diff --git a/util/mkimage.c b/util/mkimage.c -index 9ad4cfe4223b661c11ab9d3783cb13c88100631c..e22d82afa61a6aa4209c7ab6d2aa5b58f95e1bfe 100644 ---- a/util/mkimage.c -+++ b/util/mkimage.c -@@ -533,6 +533,45 @@ static const struct grub_install_image_target_desc image_targets[] = - .mod_align = GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN, - .link_align = 4 - }, -+ /* For coreboot versions that don't support self-relocating images. */ -+ { -+ .dirname = "arm-coreboot-vexpress", -+ .names = { "arm-coreboot-vexpress", NULL }, -+ .voidp_sizeof = 4, -+ .bigendian = 0, -+ .id = IMAGE_COREBOOT, -+ .flags = PLATFORM_FLAGS_NONE, -+ .total_module_size = GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE, -+ .decompressor_compressed_size = TARGET_NO_FIELD, -+ .decompressor_uncompressed_size = TARGET_NO_FIELD, -+ .decompressor_uncompressed_addr = TARGET_NO_FIELD, -+ .section_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN, -+ .vaddr_offset = 0, -+ .elf_target = EM_ARM, -+ .mod_gap = GRUB_KERNEL_ARM_COREBOOT_MOD_GAP, -+ .mod_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN, -+ .link_align = 4, -+ .link_addr = 0x62000000, -+ }, -+ { -+ .dirname = "arm-coreboot-veyron", -+ .names = { "arm-coreboot-veyron", NULL }, -+ .voidp_sizeof = 4, -+ .bigendian = 0, -+ .id = IMAGE_COREBOOT, -+ .flags = PLATFORM_FLAGS_NONE, -+ .total_module_size = GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE, -+ .decompressor_compressed_size = TARGET_NO_FIELD, -+ .decompressor_uncompressed_size = TARGET_NO_FIELD, -+ .decompressor_uncompressed_addr = TARGET_NO_FIELD, -+ .section_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN, -+ .vaddr_offset = 0, -+ .elf_target = EM_ARM, -+ .mod_gap = GRUB_KERNEL_ARM_COREBOOT_MOD_GAP, -+ .mod_align = GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN, -+ .link_align = 4, -+ .link_addr = 0x43000000, -+ }, - { - .dirname = "arm-efi", - .names = { "arm-efi", NULL }, -@@ -738,13 +777,12 @@ grub_install_generate_image (const char *dir, const char *prefix, - char *memdisk_path, char **pubkey_paths, - size_t npubkeys, char *config_path, - const struct grub_install_image_target_desc *image_target, -- int note, -- grub_compression_t comp) -+ int note, grub_compression_t comp, const char *dtb_path) - { - char *kernel_img, *core_img; - size_t total_module_size, core_size; - size_t memdisk_size = 0, config_size = 0; -- size_t prefix_size = 0; -+ size_t prefix_size = 0, dtb_size = 0; - char *kernel_path; - size_t offset; - struct grub_util_path_list *path_list, *p; -@@ -789,6 +827,12 @@ grub_install_generate_image (const char *dir, const char *prefix, - total_module_size += memdisk_size + sizeof (struct grub_module_header); - } - -+ if (dtb_path) -+ { -+ dtb_size = ALIGN_UP(grub_util_get_image_size (dtb_path), 4); -+ total_module_size += dtb_size + sizeof (struct grub_module_header); -+ } -+ - if (config_path) - { - config_size = ALIGN_ADDR (grub_util_get_image_size (config_path) + 1); -@@ -911,6 +955,19 @@ grub_install_generate_image (const char *dir, const char *prefix, - offset += memdisk_size; - } - -+ if (dtb_path) -+ { -+ struct grub_module_header *header; -+ -+ header = (struct grub_module_header *) (kernel_img + offset); -+ header->type = grub_host_to_target32 (OBJ_TYPE_DTB); -+ header->size = grub_host_to_target32 (dtb_size + sizeof (*header)); -+ offset += sizeof (*header); -+ -+ grub_util_load_image (dtb_path, kernel_img + offset); -+ offset += dtb_size; -+ } -+ - if (config_path) - { - struct grub_module_header *header; -@@ -1033,7 +1090,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - /* fallthrough */ - case IMAGE_COREBOOT: - case IMAGE_QEMU: -- if (layout.kernel_size + layout.bss_size + GRUB_KERNEL_I386_PC_LINK_ADDR > 0x68000) -+ if (image_target->elf_target != EM_ARM && layout.kernel_size + layout.bss_size + GRUB_KERNEL_I386_PC_LINK_ADDR > 0x68000) - grub_util_error (_("kernel image is too big (0x%x > 0x%x)"), - (unsigned) layout.kernel_size + (unsigned) layout.bss_size - + GRUB_KERNEL_I386_PC_LINK_ADDR, -@@ -1638,10 +1695,10 @@ grub_install_generate_image (const char *dir, const char *prefix, - target_addr = image_target->link_addr; - if (image_target->voidp_sizeof == 4) - grub_mkimage_generate_elf32 (image_target, note, &core_img, &core_size, -- target_addr, layout.align, layout.kernel_size, layout.bss_size); -+ target_addr, &layout); - else - grub_mkimage_generate_elf64 (image_target, note, &core_img, &core_size, -- target_addr, layout.align, layout.kernel_size, layout.bss_size); -+ target_addr, &layout); - } - break; - } -diff --git a/util/setup.c b/util/setup.c -index 8aa5a39a79465c33b0ff6a5a6b1bc82128df2e18..9c1e1b7da6a85ea7aece6433f2eaf81a6ccde451 100644 ---- a/util/setup.c -+++ b/util/setup.c -@@ -137,6 +137,9 @@ struct blocklists - struct grub_boot_blocklist *first_block, *block; - #ifdef GRUB_SETUP_BIOS - grub_uint16_t current_segment; -+#endif -+#ifdef GRUB_SETUP_SPARC64 -+ grub_uint64_t gpt_offset; - #endif - grub_uint16_t last_length; - grub_disk_addr_t first_sector; -@@ -151,6 +154,10 @@ save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length, - struct grub_boot_blocklist *prev = bl->block + 1; - grub_uint64_t seclen; - -+#ifdef GRUB_SETUP_SPARC64 -+ sector -= bl->gpt_offset; -+#endif -+ - grub_util_info ("saving <%" GRUB_HOST_PRIuLONG_LONG ",%u,%u>", - (unsigned long long) sector, offset, length); - -@@ -298,9 +305,8 @@ SETUP (const char *dir, - bl.first_block = (struct grub_boot_blocklist *) (core_img - + GRUB_DISK_SECTOR_SIZE - - sizeof (*bl.block)); -- grub_util_info ("root is `%s', dest is `%s'", root, dest); - -- grub_util_info ("Opening dest"); -+ grub_util_info ("Opening dest `%s'", dest); - dest_dev = grub_device_open (dest); - if (! dest_dev) - grub_util_error ("%s", grub_errmsg); -@@ -662,6 +668,16 @@ unable_to_embed: - - bl.block = bl.first_block; - -+#ifdef GRUB_SETUP_SPARC64 -+ { -+ grub_partition_t container = root_dev->disk->partition; -+ bl.gpt_offset = 0; -+ -+ if (grub_strstr (container->partmap->name, "gpt")) -+ bl.gpt_offset = grub_partition_get_start (container); -+ } -+#endif -+ - grub_install_get_blocklist (root_dev, core_path, core_img, core_size, - save_blocklists, &bl); - -@@ -721,15 +737,18 @@ unable_to_embed: - { - char *buf, *ptr = core_img; - size_t len = core_size; -- grub_uint64_t blk; -+ grub_uint64_t blk, offset = 0; - grub_partition_t container = core_dev->disk->partition; - grub_err_t err; - - core_dev->disk->partition = 0; -+#ifdef GRUB_SETUP_SPARC64 -+ offset = bl.gpt_offset; -+#endif - - buf = xmalloc (core_size); - blk = bl.first_sector; -- err = grub_disk_read (core_dev->disk, blk, 0, GRUB_DISK_SECTOR_SIZE, buf); -+ err = grub_disk_read (core_dev->disk, blk + offset, 0, GRUB_DISK_SECTOR_SIZE, buf); - if (err) - grub_util_error (_("cannot read `%s': %s"), core_dev->disk->name, - grub_errmsg); -@@ -748,7 +767,7 @@ unable_to_embed: - if (cur > len) - cur = len; - -- err = grub_disk_read (core_dev->disk, blk, 0, cur, buf); -+ err = grub_disk_read (core_dev->disk, blk + offset, 0, cur, buf); - if (err) - grub_util_error (_("cannot read `%s': %s"), core_dev->disk->name, - grub_errmsg); -diff --git a/grub-core/lib/libgcrypt/cipher/bufhelp.h b/grub-core/lib/libgcrypt/cipher/bufhelp.h -new file mode 100644 -index 0000000000000000000000000000000000000000..df3559472312d8c6c0c038e27571c546ce489283 ---- /dev/null -+++ b/grub-core/lib/libgcrypt/cipher/bufhelp.h -@@ -0,0 +1,432 @@ -+/* bufhelp.h - Some buffer manipulation helpers -+ * Copyright (C) 2012 Jussi Kivilinna -+ * -+ * This file is part of Libgcrypt. -+ * -+ * Libgcrypt is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU Lesser General Public License as -+ * published by the Free Software Foundation; either version 2.1 of -+ * the License, or (at your option) any later version. -+ * -+ * Libgcrypt is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this program; if not, see . -+ */ -+#ifndef GCRYPT_BUFHELP_H -+#define GCRYPT_BUFHELP_H -+ -+ -+#include "bithelp.h" -+ -+ -+#undef BUFHELP_FAST_UNALIGNED_ACCESS -+#if defined(HAVE_GCC_ATTRIBUTE_PACKED) && \ -+ defined(HAVE_GCC_ATTRIBUTE_ALIGNED) && \ -+ (defined(__i386__) || defined(__x86_64__) || \ -+ (defined(__arm__) && defined(__ARM_FEATURE_UNALIGNED)) || \ -+ defined(__aarch64__)) -+/* These architectures are able of unaligned memory accesses and can -+ handle those fast. -+ */ -+# define BUFHELP_FAST_UNALIGNED_ACCESS 1 -+#endif -+ -+ -+#ifdef BUFHELP_FAST_UNALIGNED_ACCESS -+/* Define type with one-byte alignment on architectures with fast unaligned -+ memory accesses. -+ */ -+typedef struct bufhelp_int_s -+{ -+ uintptr_t a; -+} __attribute__((packed, aligned(1))) bufhelp_int_t; -+#else -+/* Define type with default alignment for other architectures (unaligned -+ accessed handled in per byte loops). -+ */ -+typedef struct bufhelp_int_s -+{ -+ uintptr_t a; -+} bufhelp_int_t; -+#endif -+ -+ -+/* Optimized function for small buffer copying */ -+static inline void -+buf_cpy(void *_dst, const void *_src, size_t len) -+{ -+#if __GNUC__ >= 4 && (defined(__x86_64__) || defined(__i386__)) -+ /* For AMD64 and i386, memcpy is faster. */ -+ memcpy(_dst, _src, len); -+#else -+ byte *dst = _dst; -+ const byte *src = _src; -+ bufhelp_int_t *ldst; -+ const bufhelp_int_t *lsrc; -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+ const unsigned int longmask = sizeof(bufhelp_int_t) - 1; -+ -+ /* Skip fast processing if buffers are unaligned. */ -+ if (((uintptr_t)dst | (uintptr_t)src) & longmask) -+ goto do_bytes; -+#endif -+ -+ ldst = (bufhelp_int_t *)(void *)dst; -+ lsrc = (const bufhelp_int_t *)(const void *)src; -+ -+ for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) -+ (ldst++)->a = (lsrc++)->a; -+ -+ dst = (byte *)ldst; -+ src = (const byte *)lsrc; -+ -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+do_bytes: -+#endif -+ /* Handle tail. */ -+ for (; len; len--) -+ *dst++ = *src++; -+#endif /*__GNUC__ >= 4 && (__x86_64__ || __i386__)*/ -+} -+ -+ -+/* Optimized function for buffer xoring */ -+static inline void -+buf_xor(void *_dst, const void *_src1, const void *_src2, size_t len) -+{ -+ byte *dst = _dst; -+ const byte *src1 = _src1; -+ const byte *src2 = _src2; -+ bufhelp_int_t *ldst; -+ const bufhelp_int_t *lsrc1, *lsrc2; -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+ const unsigned int longmask = sizeof(bufhelp_int_t) - 1; -+ -+ /* Skip fast processing if buffers are unaligned. */ -+ if (((uintptr_t)dst | (uintptr_t)src1 | (uintptr_t)src2) & longmask) -+ goto do_bytes; -+#endif -+ -+ ldst = (bufhelp_int_t *)(void *)dst; -+ lsrc1 = (const bufhelp_int_t *)(const void *)src1; -+ lsrc2 = (const bufhelp_int_t *)(const void *)src2; -+ -+ for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) -+ (ldst++)->a = (lsrc1++)->a ^ (lsrc2++)->a; -+ -+ dst = (byte *)ldst; -+ src1 = (const byte *)lsrc1; -+ src2 = (const byte *)lsrc2; -+ -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+do_bytes: -+#endif -+ /* Handle tail. */ -+ for (; len; len--) -+ *dst++ = *src1++ ^ *src2++; -+} -+ -+ -+/* Optimized function for in-place buffer xoring. */ -+static inline void -+buf_xor_1(void *_dst, const void *_src, size_t len) -+{ -+ byte *dst = _dst; -+ const byte *src = _src; -+ bufhelp_int_t *ldst; -+ const bufhelp_int_t *lsrc; -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+ const unsigned int longmask = sizeof(bufhelp_int_t) - 1; -+ -+ /* Skip fast processing if buffers are unaligned. */ -+ if (((uintptr_t)dst | (uintptr_t)src) & longmask) -+ goto do_bytes; -+#endif -+ -+ ldst = (bufhelp_int_t *)(void *)dst; -+ lsrc = (const bufhelp_int_t *)(const void *)src; -+ -+ for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) -+ (ldst++)->a ^= (lsrc++)->a; -+ -+ dst = (byte *)ldst; -+ src = (const byte *)lsrc; -+ -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+do_bytes: -+#endif -+ /* Handle tail. */ -+ for (; len; len--) -+ *dst++ ^= *src++; -+} -+ -+ -+/* Optimized function for buffer xoring with two destination buffers. Used -+ mainly by CFB mode encryption. */ -+static inline void -+buf_xor_2dst(void *_dst1, void *_dst2, const void *_src, size_t len) -+{ -+ byte *dst1 = _dst1; -+ byte *dst2 = _dst2; -+ const byte *src = _src; -+ bufhelp_int_t *ldst1, *ldst2; -+ const bufhelp_int_t *lsrc; -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+ const unsigned int longmask = sizeof(bufhelp_int_t) - 1; -+ -+ /* Skip fast processing if buffers are unaligned. */ -+ if (((uintptr_t)src | (uintptr_t)dst1 | (uintptr_t)dst2) & longmask) -+ goto do_bytes; -+#endif -+ -+ ldst1 = (bufhelp_int_t *)(void *)dst1; -+ ldst2 = (bufhelp_int_t *)(void *)dst2; -+ lsrc = (const bufhelp_int_t *)(const void *)src; -+ -+ for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) -+ (ldst1++)->a = ((ldst2++)->a ^= (lsrc++)->a); -+ -+ dst1 = (byte *)ldst1; -+ dst2 = (byte *)ldst2; -+ src = (const byte *)lsrc; -+ -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+do_bytes: -+#endif -+ /* Handle tail. */ -+ for (; len; len--) -+ *dst1++ = (*dst2++ ^= *src++); -+} -+ -+ -+/* Optimized function for combined buffer xoring and copying. Used by mainly -+ CBC mode decryption. */ -+static inline void -+buf_xor_n_copy_2(void *_dst_xor, const void *_src_xor, void *_srcdst_cpy, -+ const void *_src_cpy, size_t len) -+{ -+ byte *dst_xor = _dst_xor; -+ byte *srcdst_cpy = _srcdst_cpy; -+ const byte *src_xor = _src_xor; -+ const byte *src_cpy = _src_cpy; -+ byte temp; -+ bufhelp_int_t *ldst_xor, *lsrcdst_cpy; -+ const bufhelp_int_t *lsrc_cpy, *lsrc_xor; -+ uintptr_t ltemp; -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+ const unsigned int longmask = sizeof(bufhelp_int_t) - 1; -+ -+ /* Skip fast processing if buffers are unaligned. */ -+ if (((uintptr_t)src_cpy | (uintptr_t)src_xor | (uintptr_t)dst_xor | -+ (uintptr_t)srcdst_cpy) & longmask) -+ goto do_bytes; -+#endif -+ -+ ldst_xor = (bufhelp_int_t *)(void *)dst_xor; -+ lsrc_xor = (const bufhelp_int_t *)(void *)src_xor; -+ lsrcdst_cpy = (bufhelp_int_t *)(void *)srcdst_cpy; -+ lsrc_cpy = (const bufhelp_int_t *)(const void *)src_cpy; -+ -+ for (; len >= sizeof(bufhelp_int_t); len -= sizeof(bufhelp_int_t)) -+ { -+ ltemp = (lsrc_cpy++)->a; -+ (ldst_xor++)->a = (lsrcdst_cpy)->a ^ (lsrc_xor++)->a; -+ (lsrcdst_cpy++)->a = ltemp; -+ } -+ -+ dst_xor = (byte *)ldst_xor; -+ src_xor = (const byte *)lsrc_xor; -+ srcdst_cpy = (byte *)lsrcdst_cpy; -+ src_cpy = (const byte *)lsrc_cpy; -+ -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+do_bytes: -+#endif -+ /* Handle tail. */ -+ for (; len; len--) -+ { -+ temp = *src_cpy++; -+ *dst_xor++ = *srcdst_cpy ^ *src_xor++; -+ *srcdst_cpy++ = temp; -+ } -+} -+ -+ -+/* Optimized function for combined buffer xoring and copying. Used by mainly -+ CFB mode decryption. */ -+static inline void -+buf_xor_n_copy(void *_dst_xor, void *_srcdst_cpy, const void *_src, size_t len) -+{ -+ buf_xor_n_copy_2(_dst_xor, _src, _srcdst_cpy, _src, len); -+} -+ -+ -+/* Constant-time compare of two buffers. Returns 1 if buffers are equal, -+ and 0 if buffers differ. */ -+static inline int -+buf_eq_const(const void *_a, const void *_b, size_t len) -+{ -+ const byte *a = _a; -+ const byte *b = _b; -+ size_t diff, i; -+ -+ /* Constant-time compare. */ -+ for (i = 0, diff = 0; i < len; i++) -+ diff -= !!(a[i] - b[i]); -+ -+ return !diff; -+} -+ -+ -+#ifndef BUFHELP_FAST_UNALIGNED_ACCESS -+ -+/* Functions for loading and storing unaligned u32 values of different -+ endianness. */ -+static inline u32 buf_get_be32(const void *_buf) -+{ -+ const byte *in = _buf; -+ return ((u32)in[0] << 24) | ((u32)in[1] << 16) | \ -+ ((u32)in[2] << 8) | (u32)in[3]; -+} -+ -+static inline u32 buf_get_le32(const void *_buf) -+{ -+ const byte *in = _buf; -+ return ((u32)in[3] << 24) | ((u32)in[2] << 16) | \ -+ ((u32)in[1] << 8) | (u32)in[0]; -+} -+ -+static inline void buf_put_be32(void *_buf, u32 val) -+{ -+ byte *out = _buf; -+ out[0] = val >> 24; -+ out[1] = val >> 16; -+ out[2] = val >> 8; -+ out[3] = val; -+} -+ -+static inline void buf_put_le32(void *_buf, u32 val) -+{ -+ byte *out = _buf; -+ out[3] = val >> 24; -+ out[2] = val >> 16; -+ out[1] = val >> 8; -+ out[0] = val; -+} -+ -+ -+/* Functions for loading and storing unaligned u64 values of different -+ endianness. */ -+static inline u64 buf_get_be64(const void *_buf) -+{ -+ const byte *in = _buf; -+ return ((u64)in[0] << 56) | ((u64)in[1] << 48) | \ -+ ((u64)in[2] << 40) | ((u64)in[3] << 32) | \ -+ ((u64)in[4] << 24) | ((u64)in[5] << 16) | \ -+ ((u64)in[6] << 8) | (u64)in[7]; -+} -+ -+static inline u64 buf_get_le64(const void *_buf) -+{ -+ const byte *in = _buf; -+ return ((u64)in[7] << 56) | ((u64)in[6] << 48) | \ -+ ((u64)in[5] << 40) | ((u64)in[4] << 32) | \ -+ ((u64)in[3] << 24) | ((u64)in[2] << 16) | \ -+ ((u64)in[1] << 8) | (u64)in[0]; -+} -+ -+static inline void buf_put_be64(void *_buf, u64 val) -+{ -+ byte *out = _buf; -+ out[0] = val >> 56; -+ out[1] = val >> 48; -+ out[2] = val >> 40; -+ out[3] = val >> 32; -+ out[4] = val >> 24; -+ out[5] = val >> 16; -+ out[6] = val >> 8; -+ out[7] = val; -+} -+ -+static inline void buf_put_le64(void *_buf, u64 val) -+{ -+ byte *out = _buf; -+ out[7] = val >> 56; -+ out[6] = val >> 48; -+ out[5] = val >> 40; -+ out[4] = val >> 32; -+ out[3] = val >> 24; -+ out[2] = val >> 16; -+ out[1] = val >> 8; -+ out[0] = val; -+} -+ -+#else /*BUFHELP_FAST_UNALIGNED_ACCESS*/ -+ -+typedef struct bufhelp_u32_s -+{ -+ u32 a; -+} __attribute__((packed, aligned(1))) bufhelp_u32_t; -+ -+/* Functions for loading and storing unaligned u32 values of different -+ endianness. */ -+static inline u32 buf_get_be32(const void *_buf) -+{ -+ return be_bswap32(((const bufhelp_u32_t *)_buf)->a); -+} -+ -+static inline u32 buf_get_le32(const void *_buf) -+{ -+ return le_bswap32(((const bufhelp_u32_t *)_buf)->a); -+} -+ -+static inline void buf_put_be32(void *_buf, u32 val) -+{ -+ bufhelp_u32_t *out = _buf; -+ out->a = be_bswap32(val); -+} -+ -+static inline void buf_put_le32(void *_buf, u32 val) -+{ -+ bufhelp_u32_t *out = _buf; -+ out->a = le_bswap32(val); -+} -+ -+ -+typedef struct bufhelp_u64_s -+{ -+ u64 a; -+} __attribute__((packed, aligned(1))) bufhelp_u64_t; -+ -+/* Functions for loading and storing unaligned u64 values of different -+ endianness. */ -+static inline u64 buf_get_be64(const void *_buf) -+{ -+ return be_bswap64(((const bufhelp_u64_t *)_buf)->a); -+} -+ -+static inline u64 buf_get_le64(const void *_buf) -+{ -+ return le_bswap64(((const bufhelp_u64_t *)_buf)->a); -+} -+ -+static inline void buf_put_be64(void *_buf, u64 val) -+{ -+ bufhelp_u64_t *out = _buf; -+ out->a = be_bswap64(val); -+} -+ -+static inline void buf_put_le64(void *_buf, u64 val) -+{ -+ bufhelp_u64_t *out = _buf; -+ out->a = le_bswap64(val); -+} -+ -+ -+#endif /*BUFHELP_FAST_UNALIGNED_ACCESS*/ -+ -+#endif /*GCRYPT_BUFHELP_H*/ -diff --git a/grub-core/tests/checksums.h b/grub-core/tests/checksums.h -index 68d8ce7c7753ff721ab0d5a12d40b2aff20c694c..8273bd105deec0bf21f507e0eddb867f104afc5d 100644 ---- a/grub-core/tests/checksums.h -+++ b/grub-core/tests/checksums.h -@@ -1,129 +1,129 @@ -- { "cmdline_cat", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xcd5fc34e, 0xcd5fc34e, 0xeabbecab, 0xeabbecab, 0xc9950151, 0xc9950151, 0x2be222b6, 0x2be222b6, 0xe88c769e, 0xe88c769e, 0x6be4910e, 0x6be4910e, 0x1dc1fe4f, 0x1dc1fe4f, 0xd7613e8f, 0xd7613e8f, 0xf8124196, 0xf8124196, 0x130f5935, 0x130f5935, 0x2872330e, 0x2872330e, 0xaa7b7868, 0xaa7b7868, 0x558eaeea, 0x558eaeea, 0x92f7960f, 0x92f7960f, 0xc5bfc709, 0xc5bfc709, 0x699732fe, 0x699732fe, 0xc859125f, 0xc859125f, 0xfc6ac729, 0xfc6ac729, 0xcdab6cd4, 0xcdab6cd4, 0x58a8b7f8, 0x58a8b7f8, 0xc0e73385, 0x6560d6ef, 0x3be8bb5d, 0x3be8bb5d, }, 45 }, -- { "cmdline_cat", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x13029f94, 0x13029f94, 0x7785fdab, 0x7785fdab, 0x95a7c1e8, 0x95a7c1e8, 0x315ab3e3, 0x315ab3e3, 0x6787f012, 0x6787f012, 0x79b1ecdc, 0x79b1ecdc, 0xdbc67810, 0xdbc67810, 0xafaa982e, 0xafaa982e, 0xc5cd0157, 0xc5cd0157, 0x3c50dd64, 0x3c50dd64, 0x1056cac0, 0x1056cac0, 0x1d7a41fa, 0x1d7a41fa, 0x5690b1e8, 0x5690b1e8, 0x616831d6, 0x616831d6, 0xfaf8e726, 0xfaf8e726, 0xd1ec5e26, 0xd1ec5e26, 0x3c269e1f, 0x3c269e1f, 0x1aa7952d, 0x1aa7952d, 0x6e7e2f99, 0x6e7e2f99, 0x98f4c02, 0x98f4c02, 0xc3f1abf2, 0xe348bb73, 0xea53cd60, 0xea53cd60, }, 45 }, -- { "cmdline_cat", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x8fbb4f4c, 0x8fbb4f4c, 0x5dc00167, 0x5dc00167, 0xbc124df8, 0xbc124df8, 0x31cf0f8e, 0x31cf0f8e, 0x798cc4ed, 0x798cc4ed, 0xc5d2a091, 0xc5d2a091, 0xb58a0591, 0xb58a0591, 0x4d118aca, 0x4d118aca, 0xbb06c7ee, 0xbb06c7ee, 0x42179db7, 0x42179db7, 0x65f2d81e, 0x65f2d81e, 0xa2628bcb, 0xa2628bcb, 0xbdb7f4b, 0xbdb7f4b, 0x66b10309, 0x66b10309, 0x1a550ea9, 0x1a550ea9, 0x377a297d, 0x377a297d, 0x2ea99015, 0x2ea99015, 0x4e20d7bc, 0x4e20d7bc, 0x8ecbde02, 0x8ecbde02, 0xdfa2195a, 0xdfa2195a, 0xe113d2a, 0xe204ee5b, 0x734679c1, 0x734679c1, }, 45 }, -- { "cmdline_cat", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xe2f6bfe1, 0xe2f6bfe1, 0xf18aee15, 0xf18aee15, 0x5e83b689, 0x5e83b689, 0xb7e8b42c, 0xb7e8b42c, 0x85d78f92, 0x85d78f92, 0xd56fadae, 0xd56fadae, 0x7632f5bf, 0x7632f5bf, 0x2769a748, 0x2769a748, 0x4a6112cd, 0x4a6112cd, 0x4f9b66a4, 0x4f9b66a4, 0x70457d38, 0x70457d38, 0x8cadb1a7, 0x8cadb1a7, 0x451341f, 0x451341f, 0x8a62e741, 0x8a62e741, 0x1b1f9031, 0x1b1f9031, 0x75ab630e, 0x75ab630e, 0xd5ff53ac, 0xd5ff53ac, 0x73a2b3c7, 0x73a2b3c7, 0x7b52acd5, 0x7b52acd5, 0xf6f3e48c, 0xf6f3e48c, 0x8d0db133, 0x8db24310, 0x7aef56d4, 0x7aef56d4, }, 45 }, -- { "cmdline_cat", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x838a3f40, 0x838a3f40, 0x7351ba96, 0x7351ba96, 0x660963bb, 0x660963bb, 0x6f3362a6, 0x6f3362a6, 0x915d35d9, 0x915d35d9, 0xc7edaee9, 0xc7edaee9, 0xbc8ec24c, 0xbc8ec24c, 0xeb120ffd, 0xeb120ffd, 0x8f6d8232, 0x8f6d8232, 0x2de5d515, 0x2de5d515, 0x4f2ecd91, 0x4f2ecd91, 0x555a9b90, 0x555a9b90, 0x8f7b0d77, 0x8f7b0d77, 0x5f9536af, 0x5f9536af, 0x3dd79dbe, 0x3dd79dbe, 0xb555a0, 0xb555a0, 0x75aec882, 0x75aec882, 0xd5da89cb, 0xd5da89cb, 0xb47b3257, 0xb47b3257, 0x7c97c046, 0x7c97c046, 0x726a7abe, 0x4c8b8a56, 0xcffa0854, 0xcffa0854, }, 45 }, -- { "cmdline_cat", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7bf761e, 0x7bf761e, 0xaf0b6dae, 0xaf0b6dae, 0x7db15930, 0x7db15930, 0xc9720d56, 0xc9720d56, 0x55590d6c, 0x55590d6c, 0xa0d193d9, 0xa0d193d9, 0x728987b2, 0x728987b2, 0x28aecde6, 0x28aecde6, 0xa59bb094, 0xa59bb094, 0x2d0b049d, 0x2d0b049d, 0xd8421240, 0xd8421240, 0x51fa339, 0x51fa339, 0xc625cc46, 0xc625cc46, 0x2c9e6fcc, 0x2c9e6fcc, 0x3d06ffd5, 0x3d06ffd5, 0x8dd72816, 0x8dd72816, 0xfcf2a982, 0xfcf2a982, 0x6ef2870f, 0x6ef2870f, 0xba2caab7, 0xba2caab7, 0x8e5a5872, 0x8e5a5872, 0x62b2fedc, 0x2bd3b588, 0x34ebdb15, 0x34ebdb15, }, 45 }, -- { "cmdline_cat", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xa133280a, 0xa133280a, 0x1e8f4227, 0x1e8f4227, 0xa01cd911, 0xa01cd911, 0xdcb3d617, 0xdcb3d617, 0x51200351, 0x51200351, 0x609ba305, 0x609ba305, 0x5d96abfd, 0x5d96abfd, 0xd855cc70, 0xd855cc70, 0xdbfaf18d, 0xdbfaf18d, 0x84814843, 0x84814843, 0x4b00e630, 0x4b00e630, 0xd362b0f5, 0xd362b0f5, 0xec863355, 0xec863355, 0x195898d0, 0x195898d0, 0xe8c698c7, 0xe8c698c7, 0x884229e7, 0x884229e7, 0xb41ed3a9, 0xb41ed3a9, 0x2be1ce40, 0x2be1ce40, 0x8c33eb7c, 0x8c33eb7c, 0xbbce1da, 0xbbce1da, 0xef9415fa, 0x22fbc0d, 0xd82c182c, 0xd82c182c, }, 45 }, -- { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xbe029c, 0x6671ee1f, 0xbe029c, 0x4348cfdb, 0x59c36f00, 0x59c36f00, 0x3ad73295, 0x3ad73295, 0x3ad73295, 0x44575ff3, 0x44575ff3, 0x44575ff3, 0x26a14a21, 0x26a14a21, 0x26a14a21, 0x59c36f00, 0x4348cfdb, 0x4348cfdb, 0x59c36f00, }, 20 }, -- { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x14e228ef, 0xb0c8af57, 0x14e228ef, 0x3ae7ad90, 0xaa4593fe, 0xaa4593fe, 0xbec19c1b, 0xbec19c1b, 0xbec19c1b, 0x1834917c, 0x1834917c, 0x1834917c, 0x350c3a04, 0x350c3a04, 0x350c3a04, 0xaa4593fe, 0x3ae7ad90, 0x3ae7ad90, 0xaa4593fe, }, 20 }, -- { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x651fb144, 0xdf93ee9c, 0x651fb144, 0x3808dcc0, 0xc9cbf769, 0xc9cbf769, 0xe4861949, 0xe4861949, 0xe4861949, 0x1a5ed885, 0x1a5ed885, 0x1a5ed885, 0xf314678d, 0xf314678d, 0xf314678d, 0xc9cbf769, 0x3808dcc0, 0x3808dcc0, 0xc9cbf769, }, 20 }, -- { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xdfd0119e, 0x6c7018a9, 0xdfd0119e, 0x71865846, 0x9813a416, 0x9813a416, 0xb5e8801c, 0xb5e8801c, 0xb5e8801c, 0x2433062f, 0x2433062f, 0x2433062f, 0x3d893bff, 0x3d893bff, 0x3d893bff, 0x9813a416, 0x71865846, 0x71865846, 0x9813a416, }, 20 }, -- { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x4e4844e0, 0x5ebe5f81, 0x4e4844e0, 0x38ee7153, 0x5fcf013d, 0x5fcf013d, 0x819b5c4e, 0x819b5c4e, 0x819b5c4e, 0x538b4438, 0x538b4438, 0x538b4438, 0x45f87ba7, 0x45f87ba7, 0x45f87ba7, 0x5fcf013d, 0x38ee7153, 0x38ee7153, 0x5fcf013d, }, 20 }, -- { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x701427d4, 0x246c830a, 0x701427d4, 0x6b11fdd3, 0xdd28f52b, 0xdd28f52b, 0xcd83646c, 0xcd83646c, 0xcd83646c, 0xecbf9d88, 0xecbf9d88, 0xecbf9d88, 0x91075604, 0x91075604, 0x91075604, 0xdd28f52b, 0x6b11fdd3, 0x6b11fdd3, 0xdd28f52b, }, 20 }, -- { "gfxterm_menu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x7b5bd4c, 0xac246af1, 0x7b5bd4c, 0xf80aa6cc, 0x43d1f34, 0x43d1f34, 0xb200c08a, 0xb200c08a, 0xb200c08a, 0xcd0a6922, 0xcd0a6922, 0xcd0a6922, 0x545b6ca4, 0x545b6ca4, 0x545b6ca4, 0x43d1f34, 0xf80aa6cc, 0xf80aa6cc, 0x43d1f34, }, 20 }, -- { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x1027210c, 0x64e51c81, 0x1027210c, 0x45ca4a8a, 0x9a2e0d26, 0x12fd0f21, 0x12fd0f21, 0x12fd0f21, 0x4e25f9e1, 0x4e25f9e1, 0x4e25f9e1, 0x67bd3773, 0x67bd3773, 0x67bd3773, 0x59c36f00, 0x45ca4a8a, 0x45ca4a8a, }, 18 }, -- { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x8d12f697, 0xc5b32248, 0x8d12f697, 0x56720aa4, 0xa9d58ccd, 0xf766a14d, 0xf766a14d, 0xf766a14d, 0xa2390b47, 0xa2390b47, 0xa2390b47, 0xcb0ac30e, 0xcb0ac30e, 0xcb0ac30e, 0xaa4593fe, 0x56720aa4, 0x56720aa4, }, 18 }, -- { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xa5ec9f45, 0xdb7085d8, 0xa5ec9f45, 0x9caf1d3f, 0x5411be8b, 0xedc0ad83, 0xedc0ad83, 0xedc0ad83, 0x927e0b17, 0x927e0b17, 0x927e0b17, 0xd00a6b6f, 0xd00a6b6f, 0xd00a6b6f, 0xc9cbf769, 0x9caf1d3f, 0x9caf1d3f, }, 18 }, -- { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xce8e83bf, 0xeb96c838, 0xce8e83bf, 0x73cb3bc1, 0x740d78cf, 0xb35c7e64, 0xb35c7e64, 0xb35c7e64, 0x58f99418, 0x58f99418, 0x58f99418, 0x5eb294e8, 0x5eb294e8, 0x5eb294e8, 0x1c3742c9, 0x73cb3bc1, 0x73cb3bc1, }, 18 }, -- { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x56a03e51, 0xee7d8d4b, 0x56a03e51, 0x5bdf9413, 0xbcda144c, 0x220f7a5e, 0x220f7a5e, 0x220f7a5e, 0x4d46a64f, 0x4d46a64f, 0x4d46a64f, 0x40b0384c, 0x40b0384c, 0x40b0384c, 0xcc5a7bed, 0x5bdf9413, 0x5bdf9413, }, 18 }, -- { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0xea8a9cf0, 0x8929e522, 0xea8a9cf0, 0x78f3dfbc, 0x5d55a141, 0x377f1aeb, 0x377f1aeb, 0x377f1aeb, 0xf1cd5ef5, 0xf1cd5ef5, 0xf1cd5ef5, 0xe5a88e4a, 0xe5a88e4a, 0xe5a88e4a, 0xef4a3312, 0x78f3dfbc, 0x78f3dfbc, }, 18 }, -- { "gfxmenu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x54e48d80, 0x6dcf1d57, 0x925a4c8f, 0x6dcf1d57, 0x69005b38, 0x6d6bb4bc, 0x756a36b9, 0x756a36b9, 0x756a36b9, 0xf499c068, 0xf499c068, 0xf499c068, 0x623d7907, 0x623d7907, 0x623d7907, 0x54e48d80, 0x69005b38, 0x69005b38, }, 18 }, -- { "gfxterm_ar", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa49d26b0, 0xaa7d9b28, 0xa49d26b0, 0xe76bebf7, 0x59c36f00, 0x59c36f00, 0xea6ab252, 0xea6ab252, 0xea6ab252, 0x94eadf34, 0x94eadf34, 0x94eadf34, 0xf61ccae6, 0xf61ccae6, 0xf61ccae6, 0x59c36f00, 0xe76bebf7, 0xe76bebf7, 0x59c36f00, }, 20 }, -- { "gfxterm_ar", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x7a277db, 0xf3bf80f7, 0x7a277db, 0x29a7f2a4, 0xaa4593fe, 0xaa4593fe, 0xf1cd57e3, 0xf1cd57e3, 0xf1cd57e3, 0x57385a84, 0x57385a84, 0x57385a84, 0x7a00f1fc, 0x7a00f1fc, 0x7a00f1fc, 0xaa4593fe, 0x29a7f2a4, 0x29a7f2a4, 0xaa4593fe, }, 20 }, -- { "gfxterm_ar", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x631edf85, 0x71926408, 0x631edf85, 0x3e09b201, 0xc9cbf769, 0xc9cbf769, 0xf224ab3, 0xf224ab3, 0xf224ab3, 0xf1fa8b7f, 0xf1fa8b7f, 0xf1fa8b7f, 0x18b03477, 0x18b03477, 0x18b03477, 0xc9cbf769, 0x3e09b201, 0x3e09b201, 0xc9cbf769, }, 20 }, -- { "gfxterm_ar", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xfbaf4635, 0xe69ef474, 0xfbaf4635, 0x55f90fed, 0x9813a416, 0x9813a416, 0x3aad8f41, 0x3aad8f41, 0x3aad8f41, 0xab760972, 0xab760972, 0xab760972, 0xb2cc34a2, 0xb2cc34a2, 0xb2cc34a2, 0x9813a416, 0x55f90fed, 0x55f90fed, 0x9813a416, }, 20 }, -- { "gfxterm_ar", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xdce50745, 0x1d8009e4, 0xdce50745, 0xaa4332f6, 0x5fcf013d, 0x5fcf013d, 0x354e5749, 0x354e5749, 0x354e5749, 0xe75e4f3f, 0xe75e4f3f, 0xe75e4f3f, 0xf12d70a0, 0xf12d70a0, 0xf12d70a0, 0x5fcf013d, 0xaa4332f6, 0xaa4332f6, 0x5fcf013d, }, 20 }, -- { "gfxterm_ar", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x3efebeff, 0xf101dfe2, 0x3efebeff, 0x25fb64f8, 0xdd28f52b, 0xdd28f52b, 0x70c69ebd, 0x70c69ebd, 0x70c69ebd, 0x51fa6759, 0x51fa6759, 0x51fa6759, 0x2c42acd5, 0x2c42acd5, 0x2c42acd5, 0xdd28f52b, 0x25fb64f8, 0x25fb64f8, 0xdd28f52b, }, 20 }, -- { "gfxterm_ar", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x59a34c64, 0x281cca78, 0x59a34c64, 0xa61c57e4, 0x43d1f34, 0x43d1f34, 0x95131d4, 0x95131d4, 0x95131d4, 0x765b987c, 0x765b987c, 0x765b987c, 0xef0a9dfa, 0xef0a9dfa, 0xef0a9dfa, 0x43d1f34, 0xa61c57e4, 0xa61c57e4, 0x43d1f34, }, 20 }, -- { "gfxterm_cyr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa37c165, 0x72063383, 0xa37c165, 0x49c10c22, 0x59c36f00, 0x59c36f00, 0x4e53de8e, 0x4e53de8e, 0x4e53de8e, 0x30d3b3e8, 0x30d3b3e8, 0x30d3b3e8, 0x5225a63a, 0x5225a63a, 0x5225a63a, 0x59c36f00, 0x49c10c22, 0x49c10c22, 0x59c36f00, }, 20 }, -- { "gfxterm_cyr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x45bba0ba, 0xe60fd0b6, 0x45bba0ba, 0x6bbe25c5, 0xaa4593fe, 0xaa4593fe, 0x28de2b41, 0x28de2b41, 0x28de2b41, 0x8e2b2626, 0x8e2b2626, 0x8e2b2626, 0xa3138d5e, 0xa3138d5e, 0xa3138d5e, 0xaa4593fe, 0x6bbe25c5, 0x6bbe25c5, 0xaa4593fe, }, 20 }, -- { "gfxterm_cyr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xb43d4e9d, 0x16f88820, 0xb43d4e9d, 0xe92a2319, 0xc9cbf769, 0xc9cbf769, 0xb8959ec7, 0xb8959ec7, 0xb8959ec7, 0x464d5f0b, 0x464d5f0b, 0x464d5f0b, 0xaf07e003, 0xaf07e003, 0xaf07e003, 0xc9cbf769, 0xe92a2319, 0xe92a2319, 0xc9cbf769, }, 20 }, -- { "gfxterm_cyr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x46760365, 0x685ae30e, 0x46760365, 0xe8204abd, 0x9813a416, 0x9813a416, 0x8896050a, 0x8896050a, 0x8896050a, 0x194d8339, 0x194d8339, 0x194d8339, 0xf7bee9, 0xf7bee9, 0xf7bee9, 0x9813a416, 0xe8204abd, 0xe8204abd, 0x9813a416, }, 20 }, -- { "gfxterm_cyr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6859aa86, 0xf3f11deb, 0x6859aa86, 0x1eff9f35, 0x5fcf013d, 0x5fcf013d, 0xd72b1482, 0xd72b1482, 0xd72b1482, 0x53b0cf4, 0x53b0cf4, 0x53b0cf4, 0x1348336b, 0x1348336b, 0x1348336b, 0x5fcf013d, 0x1eff9f35, 0x1eff9f35, 0x5fcf013d, }, 20 }, -- { "gfxterm_cyr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x688451e7, 0xf6936b72, 0x688451e7, 0x73818be0, 0xdd28f52b, 0xdd28f52b, 0xf12a65ac, 0xf12a65ac, 0xf12a65ac, 0xd0169c48, 0xd0169c48, 0xd0169c48, 0xadae57c4, 0xadae57c4, 0xadae57c4, 0xdd28f52b, 0x73818be0, 0x73818be0, 0xdd28f52b, }, 20 }, -- { "gfxterm_cyr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x9616af94, 0xd466be40, 0x9616af94, 0x69a9b414, 0x43d1f34, 0x43d1f34, 0xf3bb3240, 0xf3bb3240, 0xf3bb3240, 0x8cb19be8, 0x8cb19be8, 0x8cb19be8, 0x15e09e6e, 0x15e09e6e, 0x15e09e6e, 0x43d1f34, 0x69a9b414, 0x69a9b414, 0x43d1f34, }, 20 }, -- { "gfxterm_heb", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x8708d1bd, 0x85dd5e9c, 0x8708d1bd, 0xc4fe1cfa, 0x59c36f00, 0x59c36f00, 0x7ae8aced, 0x7ae8aced, 0x7ae8aced, 0x468c18b, 0x468c18b, 0x468c18b, 0x669ed459, 0x669ed459, 0x669ed459, 0x59c36f00, 0xc4fe1cfa, 0xc4fe1cfa, 0x59c36f00, }, 20 }, -- { "gfxterm_heb", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xa72b1043, 0x147d4ce0, 0xa72b1043, 0x892e953c, 0xaa4593fe, 0xaa4593fe, 0xb7b1dd40, 0xb7b1dd40, 0xb7b1dd40, 0x1144d027, 0x1144d027, 0x1144d027, 0x3c7c7b5f, 0x3c7c7b5f, 0x3c7c7b5f, 0xaa4593fe, 0x892e953c, 0x892e953c, 0xaa4593fe, }, 20 }, -- { "gfxterm_heb", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xc5fb1817, 0x745fb26c, 0xc5fb1817, 0x98ec7593, 0xc9cbf769, 0xc9cbf769, 0xf5f17e2d, 0xf5f17e2d, 0xf5f17e2d, 0xb29bfe1, 0xb29bfe1, 0xb29bfe1, 0xe26300e9, 0xe26300e9, 0xe26300e9, 0xc9cbf769, 0x98ec7593, 0x98ec7593, 0xc9cbf769, }, 20 }, -- { "gfxterm_heb", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4be837e1, 0xbf4963ca, 0x4be837e1, 0xe5be7e39, 0x9813a416, 0x9813a416, 0xd886fca0, 0xd886fca0, 0xd886fca0, 0x495d7a93, 0x495d7a93, 0x495d7a93, 0x50e74743, 0x50e74743, 0x50e74743, 0x9813a416, 0xe5be7e39, 0xe5be7e39, 0x9813a416, }, 20 }, -- { "gfxterm_heb", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x21a8ccb8, 0x17719be, 0x21a8ccb8, 0x570ef90b, 0x5fcf013d, 0x5fcf013d, 0x2a7b5333, 0x2a7b5333, 0x2a7b5333, 0xf86b4b45, 0xf86b4b45, 0xf86b4b45, 0xee1874da, 0xee1874da, 0xee1874da, 0x5fcf013d, 0x570ef90b, 0x570ef90b, 0x5fcf013d, }, 20 }, -- { "gfxterm_heb", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7001fe50, 0x4798153f, 0x7001fe50, 0x6b042457, 0xdd28f52b, 0xdd28f52b, 0x46489369, 0x46489369, 0x46489369, 0x67746a8d, 0x67746a8d, 0x67746a8d, 0x1acca101, 0x1acca101, 0x1acca101, 0xdd28f52b, 0x6b042457, 0x6b042457, 0xdd28f52b, }, 20 }, -- { "gfxterm_heb", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x6e10591c, 0x48bd926e, 0x6e10591c, 0x91af429c, 0x43d1f34, 0x43d1f34, 0x59cb829, 0x59cb829, 0x59cb829, 0x7a961181, 0x7a961181, 0x7a961181, 0xe3c71407, 0xe3c71407, 0xe3c71407, 0x43d1f34, 0x91af429c, 0x91af429c, 0x43d1f34, }, 20 }, -- { "gfxterm_gre", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x67627ed5, 0xdb276cef, 0x67627ed5, 0x2494b392, 0x59c36f00, 0x59c36f00, 0x43f511f3, 0x43f511f3, 0x43f511f3, 0x3d757c95, 0x3d757c95, 0x3d757c95, 0x5f836947, 0x5f836947, 0x5f836947, 0x59c36f00, 0x2494b392, 0x2494b392, 0x59c36f00, }, 20 }, -- { "gfxterm_gre", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x987cbf71, 0x6e4c645c, 0x987cbf71, 0xb6793a0e, 0xaa4593fe, 0xaa4593fe, 0xb943d716, 0xb943d716, 0xb943d716, 0x1fb6da71, 0x1fb6da71, 0x1fb6da71, 0x328e7109, 0x328e7109, 0x328e7109, 0xaa4593fe, 0xb6793a0e, 0xb6793a0e, 0xaa4593fe, }, 20 }, -- { "gfxterm_gre", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xf9987c07, 0x4a92eed9, 0xf9987c07, 0xa48f1183, 0xc9cbf769, 0xc9cbf769, 0x5eb3ddf4, 0x5eb3ddf4, 0x5eb3ddf4, 0xa06b1c38, 0xa06b1c38, 0xa06b1c38, 0x4921a330, 0x4921a330, 0x4921a330, 0xc9cbf769, 0xa48f1183, 0xa48f1183, 0xc9cbf769, }, 20 }, -- { "gfxterm_gre", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xccd804e2, 0xb99e8d91, 0xccd804e2, 0x628e4d3a, 0x9813a416, 0x9813a416, 0x5aec5acc, 0x5aec5acc, 0x5aec5acc, 0xcb37dcff, 0xcb37dcff, 0xcb37dcff, 0xd28de12f, 0xd28de12f, 0xd28de12f, 0x9813a416, 0x628e4d3a, 0x628e4d3a, 0x9813a416, }, 20 }, -- { "gfxterm_gre", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x4990d896, 0x2b3aa242, 0x4990d896, 0x3f36ed25, 0x5fcf013d, 0x5fcf013d, 0x3cc6048d, 0x3cc6048d, 0x3cc6048d, 0xeed61cfb, 0xeed61cfb, 0xeed61cfb, 0xf8a52364, 0xf8a52364, 0xf8a52364, 0x5fcf013d, 0x3f36ed25, 0x3f36ed25, 0x5fcf013d, }, 20 }, -- { "gfxterm_gre", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x4ff5c69f, 0x66586489, 0x4ff5c69f, 0x54f01c98, 0xdd28f52b, 0xdd28f52b, 0xc3ff0bf5, 0xc3ff0bf5, 0xc3ff0bf5, 0xe2c3f211, 0xe2c3f211, 0xe2c3f211, 0x9f7b399d, 0x9f7b399d, 0x9f7b399d, 0xdd28f52b, 0x54f01c98, 0x54f01c98, 0xdd28f52b, }, 20 }, -- { "gfxterm_gre", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x909b7bb4, 0x2bb2a58c, 0x909b7bb4, 0x6f246034, 0x43d1f34, 0x43d1f34, 0x2df40751, 0x2df40751, 0x2df40751, 0x52feaef9, 0x52feaef9, 0x52feaef9, 0xcbafab7f, 0xcbafab7f, 0xcbafab7f, 0x43d1f34, 0x6f246034, 0x6f246034, 0x43d1f34, }, 20 }, -- { "gfxterm_ru", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xc77bfcc6, 0xffcdf45d, 0xc77bfcc6, 0x848d3181, 0x59c36f00, 0x59c36f00, 0xd79cd5e, 0xd79cd5e, 0xd79cd5e, 0x73f9a038, 0x73f9a038, 0x73f9a038, 0x110fb5ea, 0x110fb5ea, 0x110fb5ea, 0x59c36f00, 0x848d3181, 0x848d3181, 0x59c36f00, }, 20 }, -- { "gfxterm_ru", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd5494aa5, 0xa0924ec, 0xd5494aa5, 0xfb4ccfda, 0xaa4593fe, 0xaa4593fe, 0x8692c636, 0x8692c636, 0x8692c636, 0x2067cb51, 0x2067cb51, 0x2067cb51, 0xd5f6029, 0xd5f6029, 0xd5f6029, 0xaa4593fe, 0xfb4ccfda, 0xfb4ccfda, 0xaa4593fe, }, 20 }, -- { "gfxterm_ru", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x2436c4f, 0x2cde4e0c, 0x2436c4f, 0x5f5401cb, 0xc9cbf769, 0xc9cbf769, 0x558f50ae, 0x558f50ae, 0x558f50ae, 0xab579162, 0xab579162, 0xab579162, 0x421d2e6a, 0x421d2e6a, 0x421d2e6a, 0xc9cbf769, 0x5f5401cb, 0x5f5401cb, 0xc9cbf769, }, 20 }, -- { "gfxterm_ru", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x86f8a68c, 0xf4116451, 0x86f8a68c, 0x28aeef54, 0x9813a416, 0x9813a416, 0x7befbe43, 0x7befbe43, 0x7befbe43, 0xea343870, 0xea343870, 0xea343870, 0xf38e05a0, 0xf38e05a0, 0xf38e05a0, 0x9813a416, 0x28aeef54, 0x28aeef54, 0x9813a416, }, 20 }, -- { "gfxterm_ru", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x156c292f, 0x3c8eb473, 0x156c292f, 0x63ca1c9c, 0x5fcf013d, 0x5fcf013d, 0x895ea16b, 0x895ea16b, 0x895ea16b, 0x5b4eb91d, 0x5b4eb91d, 0x5b4eb91d, 0x4d3d8682, 0x4d3d8682, 0x4d3d8682, 0x5fcf013d, 0x63ca1c9c, 0x63ca1c9c, 0x5fcf013d, }, 20 }, -- { "gfxterm_ru", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf57ebf12, 0x798b299b, 0xf57ebf12, 0xee7b6515, 0xdd28f52b, 0xdd28f52b, 0x22563fc6, 0x22563fc6, 0x22563fc6, 0x36ac622, 0x36ac622, 0x36ac622, 0x7ed20dae, 0x7ed20dae, 0x7ed20dae, 0xdd28f52b, 0xee7b6515, 0xee7b6515, 0xdd28f52b, }, 20 }, -- { "gfxterm_ru", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x2bc82eb1, 0x94064cc8, 0x2bc82eb1, 0xd4773531, 0x43d1f34, 0x43d1f34, 0x44cbf2f0, 0x44cbf2f0, 0x44cbf2f0, 0x3bc15b58, 0x3bc15b58, 0x3bc15b58, 0xa2905ede, 0xa2905ede, 0xa2905ede, 0x43d1f34, 0xd4773531, 0xd4773531, 0x43d1f34, }, 20 }, -- { "gfxterm_fr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7f6dd146, 0x548af474, 0x7f6dd146, 0x3c9b1c01, 0x59c36f00, 0x59c36f00, 0x7d913e8d, 0x7d913e8d, 0x7d913e8d, 0x31153eb, 0x31153eb, 0x31153eb, 0x61e74639, 0x61e74639, 0x61e74639, 0x59c36f00, 0x3c9b1c01, 0x3c9b1c01, 0x59c36f00, }, 20 }, -- { "gfxterm_fr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xf29ad079, 0x50d47c0, 0xf29ad079, 0xdc9f5506, 0xaa4593fe, 0xaa4593fe, 0x6bcf4c90, 0x6bcf4c90, 0x6bcf4c90, 0xcd3a41f7, 0xcd3a41f7, 0xcd3a41f7, 0xe002ea8f, 0xe002ea8f, 0xe002ea8f, 0xaa4593fe, 0xdc9f5506, 0xdc9f5506, 0xaa4593fe, }, 20 }, -- { "gfxterm_fr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xb25e3082, 0x2ed845dd, 0xb25e3082, 0xef495d06, 0xc9cbf769, 0xc9cbf769, 0xd5322575, 0xd5322575, 0xd5322575, 0x2beae4b9, 0x2beae4b9, 0x2beae4b9, 0xc2a05bb1, 0xc2a05bb1, 0xc2a05bb1, 0xc9cbf769, 0xef495d06, 0xef495d06, 0xc9cbf769, }, 20 }, -- { "gfxterm_fr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4cdfcd2e, 0x8bf091f, 0x4cdfcd2e, 0xe28984f6, 0x9813a416, 0x9813a416, 0x8217f630, 0x8217f630, 0x8217f630, 0x13cc7003, 0x13cc7003, 0x13cc7003, 0xa764dd3, 0xa764dd3, 0xa764dd3, 0x9813a416, 0xe28984f6, 0xe28984f6, 0x9813a416, }, 20 }, -- { "gfxterm_fr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xf2b49f88, 0x2eff252d, 0xf2b49f88, 0x8412aa3b, 0x5fcf013d, 0x5fcf013d, 0x5d3b9fe7, 0x5d3b9fe7, 0x5d3b9fe7, 0x8f2b8791, 0x8f2b8791, 0x8f2b8791, 0x9958b80e, 0x9958b80e, 0x9958b80e, 0x5fcf013d, 0x8412aa3b, 0x8412aa3b, 0x5fcf013d, }, 20 }, -- { "gfxterm_fr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x786673be, 0x536f1359, 0x786673be, 0x6363a9b9, 0xdd28f52b, 0xdd28f52b, 0x38653b12, 0x38653b12, 0x38653b12, 0x1959c2f6, 0x1959c2f6, 0x1959c2f6, 0x64e1097a, 0x64e1097a, 0x64e1097a, 0xdd28f52b, 0x6363a9b9, 0x6363a9b9, 0xdd28f52b, }, 20 }, -- { "gfxterm_fr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xac4a1127, 0x699c2ad8, 0xac4a1127, 0x53f50aa7, 0x43d1f34, 0x43d1f34, 0xfa47dfba, 0xfa47dfba, 0xfa47dfba, 0x854d7612, 0x854d7612, 0x854d7612, 0x1c1c7394, 0x1c1c7394, 0x1c1c7394, 0x43d1f34, 0x53f50aa7, 0x53f50aa7, 0x43d1f34, }, 20 }, -- { "gfxterm_quot", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xbc5f6633, 0xda908ab0, 0xbc5f6633, 0xffa9ab74, 0x59c36f00, 0x59c36f00, 0x3ad73295, 0x3ad73295, 0x3ad73295, 0x44575ff3, 0x44575ff3, 0x44575ff3, 0x26a14a21, 0x26a14a21, 0x26a14a21, 0x59c36f00, 0xffa9ab74, 0xffa9ab74, 0x59c36f00, }, 20 }, -- { "gfxterm_quot", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xad820d6b, 0x9a88ad3, 0xad820d6b, 0x83878814, 0xaa4593fe, 0xaa4593fe, 0xbec19c1b, 0xbec19c1b, 0xbec19c1b, 0x1834917c, 0x1834917c, 0x1834917c, 0x350c3a04, 0x350c3a04, 0x350c3a04, 0xaa4593fe, 0x83878814, 0x83878814, 0xaa4593fe, }, 20 }, -- { "gfxterm_quot", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe5774112, 0x5ffb1eca, 0xe5774112, 0xb8602c96, 0xc9cbf769, 0xc9cbf769, 0xe4861949, 0xe4861949, 0xe4861949, 0x1a5ed885, 0x1a5ed885, 0x1a5ed885, 0xf314678d, 0xf314678d, 0xf314678d, 0xc9cbf769, 0xb8602c96, 0xb8602c96, 0xc9cbf769, }, 20 }, -- { "gfxterm_quot", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x6af1a2bc, 0xd951ab8b, 0x6af1a2bc, 0xc4a7eb64, 0x9813a416, 0x9813a416, 0xb5e8801c, 0xb5e8801c, 0xb5e8801c, 0x2433062f, 0x2433062f, 0x2433062f, 0x3d893bff, 0x3d893bff, 0x3d893bff, 0x9813a416, 0xc4a7eb64, 0xc4a7eb64, 0x9813a416, }, 20 }, -- { "gfxterm_quot", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xc6baa18, 0x1c9db179, 0xc6baa18, 0x7acd9fab, 0x5fcf013d, 0x5fcf013d, 0x819b5c4e, 0x819b5c4e, 0x819b5c4e, 0x538b4438, 0x538b4438, 0x538b4438, 0x45f87ba7, 0x45f87ba7, 0x45f87ba7, 0x5fcf013d, 0x7acd9fab, 0x7acd9fab, 0x5fcf013d, }, 20 }, -- { "gfxterm_quot", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xe424a6ab, 0xb05c0275, 0xe424a6ab, 0xff217cac, 0xdd28f52b, 0xdd28f52b, 0xcd83646c, 0xcd83646c, 0xcd83646c, 0xecbf9d88, 0xecbf9d88, 0xecbf9d88, 0x91075604, 0x91075604, 0x91075604, 0xdd28f52b, 0xff217cac, 0xff217cac, 0xdd28f52b, }, 20 }, -- { "gfxterm_quot", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x4a7dff41, 0xe1ec28fc, 0x4a7dff41, 0xb5c2e4c1, 0x43d1f34, 0x43d1f34, 0xb200c08a, 0xb200c08a, 0xb200c08a, 0xcd0a6922, 0xcd0a6922, 0xcd0a6922, 0x545b6ca4, 0x545b6ca4, 0x545b6ca4, 0x43d1f34, 0xb5c2e4c1, 0xb5c2e4c1, 0x43d1f34, }, 20 }, -- { "gfxterm_piglatin", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd3d3e4a2, 0x9c635046, 0xd3d3e4a2, 0x902529e5, 0x59c36f00, 0x59c36f00, 0x85e713, 0x85e713, 0x85e713, 0x7e058a75, 0x7e058a75, 0x7e058a75, 0x1cf39fa7, 0x1cf39fa7, 0x1cf39fa7, 0x59c36f00, 0x902529e5, 0x902529e5, 0x59c36f00, }, 20 }, -- { "gfxterm_piglatin", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd61c80f5, 0xdf78b496, 0xd61c80f5, 0xf819058a, 0xaa4593fe, 0xaa4593fe, 0xefc0f7e7, 0xefc0f7e7, 0xefc0f7e7, 0x4935fa80, 0x4935fa80, 0x4935fa80, 0x640d51f8, 0x640d51f8, 0x640d51f8, 0xaa4593fe, 0xf819058a, 0xf819058a, 0xaa4593fe, }, 20 }, -- { "gfxterm_piglatin", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x936bc89d, 0x523a3e80, 0x936bc89d, 0xce7ca519, 0xc9cbf769, 0xc9cbf769, 0xaa99ffb1, 0xaa99ffb1, 0xaa99ffb1, 0x54413e7d, 0x54413e7d, 0x54413e7d, 0xbd0b8175, 0xbd0b8175, 0xbd0b8175, 0xc9cbf769, 0xce7ca519, 0xce7ca519, 0xc9cbf769, }, 20 }, -- { "gfxterm_piglatin", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4fdd0291, 0x133fa83d, 0x4fdd0291, 0xe18b4b49, 0x9813a416, 0x9813a416, 0x74c38e90, 0x74c38e90, 0x74c38e90, 0xe51808a3, 0xe51808a3, 0xe51808a3, 0xfca23573, 0xfca23573, 0xfca23573, 0x9813a416, 0xe18b4b49, 0xe18b4b49, 0x9813a416, }, 20 }, -- { "gfxterm_piglatin", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x538203b0, 0x2a92e789, 0x538203b0, 0x25243603, 0x5fcf013d, 0x5fcf013d, 0x5e4d3dd8, 0x5e4d3dd8, 0x5e4d3dd8, 0x8c5d25ae, 0x8c5d25ae, 0x8c5d25ae, 0x9a2e1a31, 0x9a2e1a31, 0x9a2e1a31, 0x5fcf013d, 0x25243603, 0x25243603, 0x5fcf013d, }, 20 }, -- { "gfxterm_piglatin", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xcfc85125, 0xa5b0e11b, 0xcfc85125, 0xd4cd8b22, 0xdd28f52b, 0xdd28f52b, 0x1af8cddc, 0x1af8cddc, 0x1af8cddc, 0x3bc43438, 0x3bc43438, 0x3bc43438, 0x467cffb4, 0x467cffb4, 0x467cffb4, 0xdd28f52b, 0xd4cd8b22, 0xd4cd8b22, 0xdd28f52b, }, 20 }, -- { "gfxterm_piglatin", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xf2469ffb, 0x1d0c1d2, 0xf2469ffb, 0xdf9847b, 0x43d1f34, 0x43d1f34, 0xa2837c7a, 0xa2837c7a, 0xa2837c7a, 0xdd89d5d2, 0xdd89d5d2, 0xdd89d5d2, 0x44d8d054, 0x44d8d054, 0x44d8d054, 0x43d1f34, 0xdf9847b, 0xdf9847b, 0x43d1f34, }, 20 }, -- { "gfxterm_ch", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x27851cc1, 0x15f731b5, 0x27851cc1, 0x6473d186, 0x59c36f00, 0x59c36f00, 0x125bcddf, 0x125bcddf, 0x125bcddf, 0x6cdba0b9, 0x6cdba0b9, 0x6cdba0b9, 0xe2db56b, 0xe2db56b, 0xe2db56b, 0x59c36f00, 0x6473d186, 0x6473d186, 0x59c36f00, }, 20 }, -- { "gfxterm_ch", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xfcb223c, 0x2c2e18b9, 0xfcb223c, 0x21cea743, 0xaa4593fe, 0xaa4593fe, 0xd700be1a, 0xd700be1a, 0xd700be1a, 0x71f5b37d, 0x71f5b37d, 0x71f5b37d, 0x5ccd1805, 0x5ccd1805, 0x5ccd1805, 0xaa4593fe, 0x21cea743, 0x21cea743, 0xaa4593fe, }, 20 }, -- { "gfxterm_ch", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x807efaa5, 0xb673036a, 0x807efaa5, 0xdd699721, 0xc9cbf769, 0xc9cbf769, 0xdca3ed4b, 0xdca3ed4b, 0xdca3ed4b, 0x227b2c87, 0x227b2c87, 0x227b2c87, 0xcb31938f, 0xcb31938f, 0xcb31938f, 0xc9cbf769, 0xdd699721, 0xdd699721, 0xc9cbf769, }, 20 }, -- { "gfxterm_ch", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x651d0d50, 0xf0dc38fc, 0x651d0d50, 0xcb4b4488, 0x9813a416, 0x9813a416, 0x80d03ee8, 0x80d03ee8, 0x80d03ee8, 0x110bb8db, 0x110bb8db, 0x110bb8db, 0x8b1850b, 0x8b1850b, 0x8b1850b, 0x9813a416, 0xcb4b4488, 0xcb4b4488, 0x9813a416, }, 20 }, -- { "gfxterm_ch", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xb9b068f, 0xdc68ac3c, 0xb9b068f, 0x7d3d333c, 0x5fcf013d, 0x5fcf013d, 0xa1f0a6e4, 0xa1f0a6e4, 0xa1f0a6e4, 0x73e0be92, 0x73e0be92, 0x73e0be92, 0x6593810d, 0x6593810d, 0x6593810d, 0x5fcf013d, 0x7d3d333c, 0x7d3d333c, 0x5fcf013d, }, 20 }, -- { "gfxterm_ch", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf0789d7e, 0x6f2f2b61, 0xf0789d7e, 0xeb7d4779, 0xdd28f52b, 0xdd28f52b, 0xb995630, 0xb995630, 0xb995630, 0x2aa5afd4, 0x2aa5afd4, 0x2aa5afd4, 0x571d6458, 0x571d6458, 0x571d6458, 0xdd28f52b, 0xeb7d4779, 0xeb7d4779, 0xdd28f52b, }, 20 }, -- { "gfxterm_ch", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x819821ff, 0xdd19128c, 0x819821ff, 0x7e273a7f, 0x43d1f34, 0x43d1f34, 0xf35981d3, 0xf35981d3, 0xf35981d3, 0x8c53287b, 0x8c53287b, 0x8c53287b, 0x15022dfd, 0x15022dfd, 0x15022dfd, 0x43d1f34, 0x7e273a7f, 0x7e273a7f, 0x43d1f34, }, 20 }, -- { "gfxterm_red", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa99604d1, 0xcf59e852, 0xa99604d1, 0xfebbba0f, 0x59c36f00, 0x59c36f00, 0x53767ce3, 0x53767ce3, 0x53767ce3, 0x2df61185, 0x2df61185, 0x2df61185, 0x4f000457, 0x4f000457, 0x4f000457, 0x59c36f00, 0xfebbba0f, 0xfebbba0f, 0x59c36f00, }, 20 }, -- { "gfxterm_red", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x7d0a218, 0xa3fa25a0, 0x7d0a218, 0xb777784e, 0xaa4593fe, 0xaa4593fe, 0x35db26e1, 0x35db26e1, 0x35db26e1, 0x932e2b86, 0x932e2b86, 0x932e2b86, 0xbe1680fe, 0xbe1680fe, 0xbe1680fe, 0xaa4593fe, 0xb777784e, 0xb777784e, 0xaa4593fe, }, 20 }, -- { "gfxterm_red", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x63be90f4, 0xd932cf2c, 0x63be90f4, 0x739b8e5a, 0xc9cbf769, 0xc9cbf769, 0x70a00efe, 0x70a00efe, 0x70a00efe, 0x8e78cf32, 0x8e78cf32, 0x8e78cf32, 0x6732703a, 0x6732703a, 0x6732703a, 0xc9cbf769, 0x739b8e5a, 0x739b8e5a, 0xc9cbf769, }, 20 }, -- { "gfxterm_red", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x53460c90, 0xe0e605a7, 0x53460c90, 0x6337f0bf, 0x9813a416, 0x9813a416, 0x4161864c, 0x4161864c, 0x4161864c, 0xd0ba007f, 0xd0ba007f, 0xd0ba007f, 0xc9003daf, 0xc9003daf, 0xc9003daf, 0x9813a416, 0x6337f0bf, 0x6337f0bf, 0x9813a416, }, 20 }, -- { "gfxterm_red", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xf54761a0, 0xe5b17ac1, 0xf54761a0, 0x5b408e55, 0x5fcf013d, 0x5fcf013d, 0x580fda0e, 0x580fda0e, 0x580fda0e, 0x8a1fc278, 0x8a1fc278, 0x8a1fc278, 0x9c6cfde7, 0x9c6cfde7, 0x9c6cfde7, 0x5fcf013d, 0x5b408e55, 0x5b408e55, 0x5fcf013d, }, 20 }, -- { "gfxterm_red", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xec78b0c1, 0xb800141f, 0xec78b0c1, 0x621c7b1b, 0xdd28f52b, 0xdd28f52b, 0x8f60179, 0x8f60179, 0x8f60179, 0x29caf89d, 0x29caf89d, 0x29caf89d, 0x54723311, 0x54723311, 0x54723311, 0xdd28f52b, 0x621c7b1b, 0x621c7b1b, 0xdd28f52b, }, 20 }, -- { "gfxterm_red", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xf209411b, 0x599896a6, 0xf209411b, 0x6551c7bb, 0x43d1f34, 0x43d1f34, 0x5ac6bb4a, 0x5ac6bb4a, 0x5ac6bb4a, 0x25cc12e2, 0x25cc12e2, 0x25cc12e2, 0xbc9d1764, 0xbc9d1764, 0xbc9d1764, 0x43d1f34, 0x6551c7bb, 0x6551c7bb, 0x43d1f34, }, 20 }, -- { "gfxterm_high", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x93b4fcd8, 0xf57b105b, 0x93b4fcd8, 0x2bfe5312, 0x59c36f00, 0x59c36f00, 0x3ad73295, 0x3ad73295, 0x3ad73295, 0x44575ff3, 0x44575ff3, 0x44575ff3, 0x26a14a21, 0x26a14a21, 0x26a14a21, 0x59c36f00, 0x2bfe5312, 0x2bfe5312, 0x59c36f00, }, 20 }, -- { "gfxterm_high", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x656c9044, 0xc14617fc, 0x656c9044, 0xa6ea58cb, 0xaa4593fe, 0xaa4593fe, 0xbec19c1b, 0xbec19c1b, 0xbec19c1b, 0x1834917c, 0x1834917c, 0x1834917c, 0x350c3a04, 0x350c3a04, 0x350c3a04, 0xaa4593fe, 0xa6ea58cb, 0xa6ea58cb, 0xaa4593fe, }, 20 }, -- { "gfxterm_high", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xa11479ed, 0x1b982635, 0xa11479ed, 0xe37185d0, 0xc9cbf769, 0xc9cbf769, 0xe4861949, 0xe4861949, 0xe4861949, 0x1a5ed885, 0x1a5ed885, 0x1a5ed885, 0xf314678d, 0xf314678d, 0xf314678d, 0xc9cbf769, 0xe37185d0, 0xe37185d0, 0xc9cbf769, }, 20 }, -- { "gfxterm_high", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x244770a7, 0x97e77990, 0x244770a7, 0x6a54d2ee, 0x9813a416, 0x9813a416, 0xb5e8801c, 0xb5e8801c, 0xb5e8801c, 0x2433062f, 0x2433062f, 0x2433062f, 0x3d893bff, 0x3d893bff, 0x3d893bff, 0x9813a416, 0x6a54d2ee, 0x6a54d2ee, 0x9813a416, }, 20 }, -- { "gfxterm_high", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x8ca34476, 0x9c555f17, 0x8ca34476, 0x1fc54b41, 0x5fcf013d, 0x5fcf013d, 0x819b5c4e, 0x819b5c4e, 0x819b5c4e, 0x538b4438, 0x538b4438, 0x538b4438, 0x45f87ba7, 0x45f87ba7, 0x45f87ba7, 0x5fcf013d, 0x1fc54b41, 0x1fc54b41, 0x5fcf013d, }, 20 }, -- { "gfxterm_high", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf19f6af8, 0xa5e7ce26, 0xf19f6af8, 0x1619aea6, 0xdd28f52b, 0xdd28f52b, 0xcd83646c, 0xcd83646c, 0xcd83646c, 0xecbf9d88, 0xecbf9d88, 0xecbf9d88, 0x91075604, 0x91075604, 0x91075604, 0xdd28f52b, 0x1619aea6, 0x1619aea6, 0xdd28f52b, }, 20 }, -- { "gfxterm_high", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x5f75414f, 0xf4e496f2, 0x5f75414f, 0x27fd1fe0, 0x43d1f34, 0x43d1f34, 0xb200c08a, 0xb200c08a, 0xb200c08a, 0xcd0a6922, 0xcd0a6922, 0xcd0a6922, 0x545b6ca4, 0x545b6ca4, 0x545b6ca4, 0x43d1f34, 0x27fd1fe0, 0x27fd1fe0, 0x43d1f34, }, 20 }, -- { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x1368a483, 0x1368a483, 0x1368a483, 0x1368a483, 0x1368a483, }, 5 }, -- { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0x7033079c, 0x7033079c, 0x7033079c, 0x7033079c, 0x7033079c, }, 5 }, -- { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xff583fbf, 0xff583fbf, 0xff583fbf, 0xff583fbf, 0xff583fbf, }, 5 }, -- { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x4c2cef83, 0x1b215a88, 0xe2378595, 0xb53a309e, 0x15f64d5e, }, 5 }, -- { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x758f388c, 0xd4442397, 0x33f5784b, 0x923e6350, 0xf97bb902, }, 5 }, -- { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xb9f6f52a, 0x4e24e8b7, 0x53beb8e1, 0xa46ca57c, 0x688a184d, }, 5 }, -- { "videotest", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x5bd98ce3, 0x15df7962, 0xc7d467e1, 0x89d29260, 0x662e2c16, }, 5 }, -- { "videotest", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0xf9847b65, 0xf9847b65, 0xf9847b65, 0xf9847b65, 0xf9847b65, }, 5 }, -- { "videotest", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xc421716d, 0xc421716d, 0xc421716d, 0xc421716d, 0xc421716d, }, 5 }, -- { "videotest", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0x5d46f2a8, 0x5d46f2a8, 0x5d46f2a8, 0x5d46f2a8, 0x5d46f2a8, }, 5 }, -- { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x25690db2, 0x25690db2, 0x25690db2, 0x25690db2, 0x25690db2, }, 5 }, -- { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0x7333f220, 0x7333f220, 0x7333f220, 0x7333f220, 0x7333f220, }, 5 }, -- { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0xac52d537, 0xac52d537, 0xac52d537, 0xac52d537, 0xac52d537, }, 5 }, -- { "videotest", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0xd4cbcd66, 0xd4cbcd66, 0xd4cbcd66, 0xd4cbcd66, 0xd4cbcd66, }, 5 }, -- { "videotest", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0x9d23f9d1, 0x9d23f9d1, 0x9d23f9d1, 0x9d23f9d1, 0x9d23f9d1, }, 5 }, -- { "videotest", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x89acbf88, 0x89acbf88, 0x89acbf88, 0x89acbf88, 0x89acbf88, }, 5 }, -- { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x335fadcb, 0x1f517b5c, 0x6b4200e5, 0x474cd672, 0x8364f797, }, 5 }, -- { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0xcf9985f8, 0x1d92c7fc, 0x6e637701, 0xbc683505, 0x898016fb, }, 5 }, -- { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0xdb824190, 0x378d05dc, 0x670bff9, 0xea7ffbb5, 0x658bcbb3, }, 5 }, -- { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x18ed532e, 0x18ed532e, 0x18ed532e, 0x18ed532e, 0x18ed532e, }, 5 }, -- { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0x2b35b09f, 0x2b35b09f, 0x2b35b09f, 0x2b35b09f, 0x2b35b09f, }, 5 }, -- { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0xa24c4d98, 0xa24c4d98, 0xa24c4d98, 0xa24c4d98, 0xa24c4d98, }, 5 }, -- { "videotest", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0xc07dde33, 0xc07dde33, 0xc07dde33, 0xc07dde33, 0xc07dde33, }, 5 }, -- { "videotest", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0x7e6ed757, 0x7e6ed757, 0x7e6ed757, 0x7e6ed757, 0x7e6ed757, }, 5 }, -- { "videotest", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x700255dd, 0x700255dd, 0x700255dd, 0x700255dd, 0x700255dd, }, 5 }, -- { "videotest", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x157232bd, 0x5e6bdacd, 0x8341e25d, 0xc8580a2d, 0x3cf9e58c, }, 5 }, -- { "videotest", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0xbfafd7cd, 0x51650951, 0x67d61c04, 0x891cc298, 0xab036ae, }, 5 }, -- { "videotest", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x760580c9, 0xdc6d8205, 0x2739f3a0, 0x8d51f16c, 0xd47d661b, }, 5 }, -- { "videotest", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0xada3b5f, 0x24cd61a6, 0x56f48ead, 0x78e3d454, 0xb28750bb, }, 5 }, -- { "videotest", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x827694e2, 0x9d97c3dd, 0xbdb43a9c, 0xa2556da3, 0xfdf3c81e, }, 5 }, -- { "videotest", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0x664534a5, 0xcd0979a0, 0x3531d85e, 0x9e7d955b, 0xc0aced53, }, 5 }, -+ { "cmdline_cat", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xc69be699, 0xc69be699, 0xe17fc97c, 0xe17fc97c, 0xc2512486, 0xc2512486, 0x20260761, 0x20260761, 0xe3485349, 0xe3485349, 0x6020b4d9, 0x6020b4d9, 0x1605db98, 0x1605db98, 0xdca51b58, 0xdca51b58, 0xf3d66441, 0xf3d66441, 0x18cb7ce2, 0x18cb7ce2, 0x23b616d9, 0x23b616d9, 0xa1bf5dbf, 0xa1bf5dbf, 0x5e4a8b3d, 0x5e4a8b3d, 0x9933b3d8, 0x9933b3d8, 0xce7be2de, 0xce7be2de, 0x62531729, 0x62531729, 0xc39d3788, 0xc39d3788, 0xf7aee2fe, 0xf7aee2fe, 0xc66f4903, 0xc66f4903, 0x536c922f, 0x536c922f, 0xcb231652, 0x4ae07b67, 0x146816d5, 0x146816d5, }, 45 }, -+ { "cmdline_cat", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x29d0cfb7, 0x29d0cfb7, 0x4d57ad88, 0x4d57ad88, 0xaf7591cb, 0xaf7591cb, 0xb88e3c0, 0xb88e3c0, 0x5d55a031, 0x5d55a031, 0x4363bcff, 0x4363bcff, 0xe1142833, 0xe1142833, 0x9578c80d, 0x9578c80d, 0xff1f5174, 0xff1f5174, 0x6828d47, 0x6828d47, 0x2a849ae3, 0x2a849ae3, 0x27a811d9, 0x27a811d9, 0x6c42e1cb, 0x6c42e1cb, 0x5bba61f5, 0x5bba61f5, 0xc02ab705, 0xc02ab705, 0xeb3e0e05, 0xeb3e0e05, 0x6f4ce3c, 0x6f4ce3c, 0x2075c50e, 0x2075c50e, 0x54ac7fba, 0x54ac7fba, 0x335d1c21, 0x335d1c21, 0xf923fbd1, 0x1b489d4d, 0x1253eb5e, 0x1253eb5e, }, 45 }, -+ { "cmdline_cat", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x6ff92a98, 0x6ff92a98, 0xbd8264b3, 0xbd8264b3, 0x5c50282c, 0x5c50282c, 0xd18d6a5a, 0xd18d6a5a, 0x99cea139, 0x99cea139, 0x2590c545, 0x2590c545, 0x55c86045, 0x55c86045, 0xad53ef1e, 0xad53ef1e, 0x5b44a23a, 0x5b44a23a, 0xa255f863, 0xa255f863, 0x85b0bdca, 0x85b0bdca, 0x4220ee1f, 0x4220ee1f, 0xeb991a9f, 0xeb991a9f, 0x86f366dd, 0x86f366dd, 0xfa176b7d, 0xfa176b7d, 0xd7384ca9, 0xd7384ca9, 0xceebf5c1, 0xceebf5c1, 0xae62b268, 0xae62b268, 0x6e89bbd6, 0x6e89bbd6, 0x3fe07c8e, 0x3fe07c8e, 0xee5358fe, 0x162d1a8a, 0x876f8d10, 0x876f8d10, }, 45 }, -+ { "cmdline_cat", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xb96afaea, 0xb96afaea, 0xaa16ab1e, 0xaa16ab1e, 0x51ff382, 0x51ff382, 0xec74f127, 0xec74f127, 0xde4bca99, 0xde4bca99, 0x8ef3e8a5, 0x8ef3e8a5, 0x2daeb0b4, 0x2daeb0b4, 0x7cf5e243, 0x7cf5e243, 0x11fd57c6, 0x11fd57c6, 0x140723af, 0x140723af, 0x2bd93833, 0x2bd93833, 0xd731f4ac, 0xd731f4ac, 0x5fcd7114, 0x5fcd7114, 0xd1fea24a, 0xd1fea24a, 0x4083d53a, 0x4083d53a, 0x2e372605, 0x2e372605, 0x8e6316a7, 0x8e6316a7, 0x283ef6cc, 0x283ef6cc, 0x20cee9de, 0x20cee9de, 0xad6fa187, 0xad6fa187, 0xd691f438, 0xf3257e63, 0x4786ba7, 0x4786ba7, }, 45 }, -+ { "cmdline_cat", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x48acf1bf, 0x48acf1bf, 0xb8777469, 0xb8777469, 0xad2fad44, 0xad2fad44, 0xa415ac59, 0xa415ac59, 0x5a7bfb26, 0x5a7bfb26, 0xccb6016, 0xccb6016, 0x77a80cb3, 0x77a80cb3, 0x2034c102, 0x2034c102, 0x444b4ccd, 0x444b4ccd, 0xe6c31bea, 0xe6c31bea, 0x8408036e, 0x8408036e, 0x9e7c556f, 0x9e7c556f, 0x445dc388, 0x445dc388, 0x94b3f850, 0x94b3f850, 0xf6f15341, 0xf6f15341, 0xcb939b5f, 0xcb939b5f, 0xbe88067d, 0xbe88067d, 0x1efc4734, 0x1efc4734, 0x7f5dfca8, 0x7f5dfca8, 0xb7b10eb9, 0xb7b10eb9, 0xb94cb441, 0x9571329, 0x8a26912b, 0x8a26912b, }, 45 }, -+ { "cmdline_cat", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xc508d04e, 0xc508d04e, 0x6dbccbfe, 0x6dbccbfe, 0xbf06ff60, 0xbf06ff60, 0xbc5ab06, 0xbc5ab06, 0x97eeab3c, 0x97eeab3c, 0x62663589, 0x62663589, 0xb03e21e2, 0xb03e21e2, 0xea196bb6, 0xea196bb6, 0x672c16c4, 0x672c16c4, 0xefbca2cd, 0xefbca2cd, 0x1af5b410, 0x1af5b410, 0xc7a80569, 0xc7a80569, 0x4926a16, 0x4926a16, 0xee29c99c, 0xee29c99c, 0xffb15985, 0xffb15985, 0x4f608e46, 0x4f608e46, 0x3e450fd2, 0x3e450fd2, 0xac45215f, 0xac45215f, 0x789b0ce7, 0x789b0ce7, 0x4cedfe22, 0x4cedfe22, 0xa005588c, 0x701da05c, 0x6f25cec1, 0x6f25cec1, }, 45 }, -+ { "cmdline_cat", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x29e7a7f, 0x29e7a7f, 0xbd221052, 0xbd221052, 0x3b18b64, 0x3b18b64, 0x7f1e8462, 0x7f1e8462, 0xf28d5124, 0xf28d5124, 0xc336f170, 0xc336f170, 0xfe3bf988, 0xfe3bf988, 0x7bf89e05, 0x7bf89e05, 0x7857a3f8, 0x7857a3f8, 0x272c1a36, 0x272c1a36, 0xe8adb445, 0xe8adb445, 0x70cfe280, 0x70cfe280, 0x4f2b6120, 0x4f2b6120, 0xbaf5caa5, 0xbaf5caa5, 0x4b6bcab2, 0x4b6bcab2, 0x2bef7b92, 0x2bef7b92, 0x17b381dc, 0x17b381dc, 0x884c9c35, 0x884c9c35, 0x2f9eb909, 0x2f9eb909, 0xa811b3af, 0xa811b3af, 0x4c39478f, 0x5a72c3ab, 0x8071678a, 0x8071678a, }, 45 }, -+ { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd9f04953, 0xbf3fa5d0, 0xd9f04953, 0x9a068414, 0x59c36f00, 0x59c36f00, 0x620c0067, 0x620c0067, 0x620c0067, 0x1c8c6d01, 0x1c8c6d01, 0x1c8c6d01, 0xc3269013, 0xc3269013, 0xc3269013, 0x59c36f00, 0x9a068414, 0x9a068414, 0x59c36f00, }, 20 }, -+ { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x9254157f, 0x367e92c7, 0x9254157f, 0xbc519000, 0xaa4593fe, 0xaa4593fe, 0xa8a596c8, 0xa8a596c8, 0xa8a596c8, 0xe509baf, 0xe509baf, 0xe509baf, 0x16f0dc06, 0x16f0dc06, 0x16f0dc06, 0xaa4593fe, 0xbc519000, 0xbc519000, 0xaa4593fe, }, 20 }, -+ { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x354b1976, 0x8fc746ae, 0x354b1976, 0x685c74f2, 0xc9cbf769, 0xc9cbf769, 0x3ce35e1d, 0x3ce35e1d, 0x3ce35e1d, 0xc23b9fd1, 0xc23b9fd1, 0xc23b9fd1, 0x5b18528e, 0x5b18528e, 0x5b18528e, 0xc9cbf769, 0x685c74f2, 0x685c74f2, 0xc9cbf769, }, 20 }, -+ { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x1c9ec014, 0xaf3ec923, 0x1c9ec014, 0x43f5296, 0x9813a416, 0x9813a416, 0x43fda3fa, 0x43fda3fa, 0x43fda3fa, 0xd22625c9, 0xd22625c9, 0xd22625c9, 0x76a62c0a, 0x76a62c0a, 0x76a62c0a, 0x9813a416, 0x43f5296, 0x43f5296, 0x9813a416, }, 20 }, -+ { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xa704f7ea, 0xb7f2ec8b, 0xa704f7ea, 0xb279bf59, 0x5fcf013d, 0x5fcf013d, 0xf3582c48, 0xf3582c48, 0xf3582c48, 0x2148343e, 0x2148343e, 0x2148343e, 0x9c719024, 0x9c719024, 0x9c719024, 0x5fcf013d, 0xb279bf59, 0xb279bf59, 0x5fcf013d, }, 20 }, -+ { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf293ce36, 0xa6eb6ae8, 0xf293ce36, 0xcd87647e, 0xdd28f52b, 0xdd28f52b, 0xb3c7ef80, 0xb3c7ef80, 0xb3c7ef80, 0x92fb1664, 0x92fb1664, 0x92fb1664, 0xd15b5e2e, 0xd15b5e2e, 0xd15b5e2e, 0xdd28f52b, 0xcd87647e, 0xcd87647e, 0xdd28f52b, }, 20 }, -+ { "gfxterm_menu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x31e75bd7, 0x9a768c6a, 0x31e75bd7, 0xa8fc31a6, 0x43d1f34, 0x43d1f34, 0xa0717008, 0xa0717008, 0xa0717008, 0xdf7bd9a0, 0xdf7bd9a0, 0xdf7bd9a0, 0x8e5a9312, 0x8e5a9312, 0x8e5a9312, 0x43d1f34, 0xa8fc31a6, 0xa8fc31a6, 0x43d1f34, }, 20 }, -+ { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x1ce7bd78, 0x682580f5, 0x1ce7bd78, 0x490ad6fe, 0x9a2e0d26, 0x64eb71ba, 0x64eb71ba, 0x64eb71ba, 0x3833877a, 0x3833877a, 0x3833877a, 0xcfc14f0a, 0xcfc14f0a, 0xcfc14f0a, 0x59c36f00, 0x490ad6fe, 0x490ad6fe, }, 18 }, -+ { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2b6ff87d, 0x63ce2ca2, 0x2b6ff87d, 0xf00f044e, 0xa9d58ccd, 0xe2c46577, 0xe2c46577, 0xe2c46577, 0xb79bcf7d, 0xb79bcf7d, 0xb79bcf7d, 0xbc30ed71, 0xbc30ed71, 0xbc30ed71, 0xaa4593fe, 0xf00f044e, 0xf00f044e, }, 18 }, -+ { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe61cadba, 0x9880b727, 0xe61cadba, 0xdf5f2fc0, 0x5411be8b, 0x4449774e, 0x4449774e, 0x4449774e, 0x3bf7d1da, 0x3bf7d1da, 0x3bf7d1da, 0xd2ddee01, 0xd2ddee01, 0xd2ddee01, 0xc9cbf769, 0xdf5f2fc0, 0xdf5f2fc0, }, 18 }, -+ { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xbe54acf7, 0x9b4ce770, 0xbe54acf7, 0x3111489, 0x740d78cf, 0x314c4c59, 0x314c4c59, 0x314c4c59, 0xdae9a625, 0xdae9a625, 0xdae9a625, 0xcbf8af57, 0xcbf8af57, 0xcbf8af57, 0x1c3742c9, 0x3111489, 0x3111489, }, 18 }, -+ { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0xee571de5, 0x568aaeff, 0xee571de5, 0xe328b7a7, 0xbcda144c, 0xf56e1b60, 0xf56e1b60, 0xf56e1b60, 0x9a27c771, 0x9a27c771, 0x9a27c771, 0xd6d05397, 0xd6d05397, 0xd6d05397, 0xcc5a7bed, 0xe328b7a7, 0xe328b7a7, }, 18 }, -+ { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0x1db9877c, 0x7e1afeae, 0x1db9877c, 0x8fc0c430, 0x5d55a141, 0x96f335c6, 0x96f335c6, 0x96f335c6, 0x504171d8, 0x504171d8, 0x504171d8, 0x69f71c0, 0x69f71c0, 0x69f71c0, 0xef4a3312, 0x8fc0c430, 0x8fc0c430, }, 18 }, -+ { "gfxmenu", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x54e48d80, 0x151819bd, 0xea8d4865, 0x151819bd, 0x11d75fd2, 0x6d6bb4bc, 0x650ccd09, 0x650ccd09, 0x650ccd09, 0xe4ff3bd8, 0xe4ff3bd8, 0xe4ff3bd8, 0xc5308b73, 0xc5308b73, 0xc5308b73, 0x54e48d80, 0x11d75fd2, 0x11d75fd2, }, 18 }, -+ { "gfxterm_ar", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd0b06c3d, 0xde50d1a5, 0xd0b06c3d, 0x9346a17a, 0x59c36f00, 0x59c36f00, 0xacff5d47, 0xacff5d47, 0xacff5d47, 0xd27f3021, 0xd27f3021, 0xd27f3021, 0xdd5cd33, 0xdd5cd33, 0xdd5cd33, 0x59c36f00, 0x9346a17a, 0x9346a17a, 0x59c36f00, }, 20 }, -+ { "gfxterm_ar", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xf32d50c1, 0x730a7ed, 0xf32d50c1, 0xdd28d5be, 0xaa4593fe, 0xaa4593fe, 0xba8a2d4c, 0xba8a2d4c, 0xba8a2d4c, 0x1c7f202b, 0x1c7f202b, 0x1c7f202b, 0x4df6782, 0x4df6782, 0x4df6782, 0xaa4593fe, 0xdd28d5be, 0xdd28d5be, 0xaa4593fe, }, 20 }, -+ { "gfxterm_ar", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x711a4ac1, 0x6396f14c, 0x711a4ac1, 0x2c0d2745, 0xc9cbf769, 0xc9cbf769, 0x6b6ccbb0, 0x6b6ccbb0, 0x6b6ccbb0, 0x95b40a7c, 0x95b40a7c, 0x95b40a7c, 0xc97c723, 0xc97c723, 0xc97c723, 0xc9cbf769, 0x2c0d2745, 0x2c0d2745, 0xc9cbf769, }, 20 }, -+ { "gfxterm_ar", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x29baad6a, 0x348b1f2b, 0x29baad6a, 0x311b3fe8, 0x9813a416, 0x9813a416, 0xe8e982cc, 0xe8e982cc, 0xe8e982cc, 0x793204ff, 0x793204ff, 0x793204ff, 0xddb20d3c, 0xddb20d3c, 0xddb20d3c, 0x9813a416, 0x311b3fe8, 0x311b3fe8, 0x9813a416, }, 20 }, -+ { "gfxterm_ar", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xf834b3bb, 0x3951bd1a, 0xf834b3bb, 0xed49fb08, 0x5fcf013d, 0x5fcf013d, 0x5aefa2a7, 0x5aefa2a7, 0x5aefa2a7, 0x88ffbad1, 0x88ffbad1, 0x88ffbad1, 0x35c61ecb, 0x35c61ecb, 0x35c61ecb, 0x5fcf013d, 0xed49fb08, 0xed49fb08, 0x5fcf013d, }, 20 }, -+ { "gfxterm_ar", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7e9a7a47, 0xb1651b5a, 0x7e9a7a47, 0x418ed00f, 0xdd28f52b, 0xdd28f52b, 0x83f9db69, 0x83f9db69, 0x83f9db69, 0xa2c5228d, 0xa2c5228d, 0xa2c5228d, 0xe1656ac7, 0xe1656ac7, 0xe1656ac7, 0xdd28f52b, 0x418ed00f, 0x418ed00f, 0xdd28f52b, }, 20 }, -+ { "gfxterm_ar", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xc6a0340, 0x7dd5855c, 0xc6a0340, 0x95716931, 0x43d1f34, 0x43d1f34, 0x5f1c24c0, 0x5f1c24c0, 0x5f1c24c0, 0x20168d68, 0x20168d68, 0x20168d68, 0x7137c7da, 0x7137c7da, 0x7137c7da, 0x43d1f34, 0x95716931, 0x95716931, 0x43d1f34, }, 20 }, -+ { "gfxterm_cyr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xd3798aaa, 0xab48784c, 0xd3798aaa, 0x908f47ed, 0x59c36f00, 0x59c36f00, 0x1688ec7c, 0x1688ec7c, 0x1688ec7c, 0x6808811a, 0x6808811a, 0x6808811a, 0xb7a27c08, 0xb7a27c08, 0xb7a27c08, 0x59c36f00, 0x908f47ed, 0x908f47ed, 0x59c36f00, }, 20 }, -+ { "gfxterm_cyr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xc30d9d2a, 0x60b9ed26, 0xc30d9d2a, 0xed081855, 0xaa4593fe, 0xaa4593fe, 0x3eba2192, 0x3eba2192, 0x3eba2192, 0x984f2cf5, 0x984f2cf5, 0x984f2cf5, 0x80ef6b5c, 0x80ef6b5c, 0x80ef6b5c, 0xaa4593fe, 0xed081855, 0xed081855, 0xaa4593fe, }, 20 }, -+ { "gfxterm_cyr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe469e6af, 0x46ac2012, 0xe469e6af, 0xb97e8b2b, 0xc9cbf769, 0xc9cbf769, 0x60f0d993, 0x60f0d993, 0x60f0d993, 0x9e28185f, 0x9e28185f, 0x9e28185f, 0x70bd500, 0x70bd500, 0x70bd500, 0xc9cbf769, 0xb97e8b2b, 0xb97e8b2b, 0xc9cbf769, }, 20 }, -+ { "gfxterm_cyr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x8538d2ef, 0xab143284, 0x8538d2ef, 0x9d99406d, 0x9813a416, 0x9813a416, 0x7e8326ec, 0x7e8326ec, 0x7e8326ec, 0xef58a0df, 0xef58a0df, 0xef58a0df, 0x4bd8a91c, 0x4bd8a91c, 0x4bd8a91c, 0x9813a416, 0x9d99406d, 0x9d99406d, 0x9813a416, }, 20 }, -+ { "gfxterm_cyr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x8115198c, 0x1abdaee1, 0x8115198c, 0x9468513f, 0x5fcf013d, 0x5fcf013d, 0xa5e86484, 0xa5e86484, 0xa5e86484, 0x77f87cf2, 0x77f87cf2, 0x77f87cf2, 0xcac1d8e8, 0xcac1d8e8, 0xcac1d8e8, 0x5fcf013d, 0x9468513f, 0x9468513f, 0x5fcf013d, }, 20 }, -+ { "gfxterm_cyr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xea03b805, 0x74148290, 0xea03b805, 0xd517124d, 0xdd28f52b, 0xdd28f52b, 0x8f6eee40, 0x8f6eee40, 0x8f6eee40, 0xae5217a4, 0xae5217a4, 0xae5217a4, 0xedf25fee, 0xedf25fee, 0xedf25fee, 0xdd28f52b, 0xd517124d, 0xd517124d, 0xdd28f52b, }, 20 }, -+ { "gfxterm_cyr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xa044490f, 0xe23458db, 0xa044490f, 0x395f237e, 0x43d1f34, 0x43d1f34, 0xe1ca82c2, 0xe1ca82c2, 0xe1ca82c2, 0x9ec02b6a, 0x9ec02b6a, 0x9ec02b6a, 0xcfe161d8, 0xcfe161d8, 0xcfe161d8, 0x43d1f34, 0x395f237e, 0x395f237e, 0x43d1f34, }, 20 }, -+ { "gfxterm_heb", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xf3259b30, 0xf1f01411, 0xf3259b30, 0xb0d35677, 0x59c36f00, 0x59c36f00, 0x97895f8e, 0x97895f8e, 0x97895f8e, 0xe90932e8, 0xe90932e8, 0xe90932e8, 0x36a3cffa, 0x36a3cffa, 0x36a3cffa, 0x59c36f00, 0xb0d35677, 0xb0d35677, 0x59c36f00, }, 20 }, -+ { "gfxterm_heb", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x53a43759, 0xe0f26bfa, 0x53a43759, 0x7da1b226, 0xaa4593fe, 0xaa4593fe, 0xbf482a4e, 0xbf482a4e, 0xbf482a4e, 0x19bd2729, 0x19bd2729, 0x19bd2729, 0x11d6080, 0x11d6080, 0x11d6080, 0xaa4593fe, 0x7da1b226, 0x7da1b226, 0xaa4593fe, }, 20 }, -+ { "gfxterm_heb", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd7ff8d53, 0x665b2728, 0xd7ff8d53, 0x8ae8e0d7, 0xc9cbf769, 0xc9cbf769, 0x5a693e73, 0x5a693e73, 0x5a693e73, 0xa4b1ffbf, 0xa4b1ffbf, 0xa4b1ffbf, 0x3d9232e0, 0x3d9232e0, 0x3d9232e0, 0xc9cbf769, 0x8ae8e0d7, 0x8ae8e0d7, 0xc9cbf769, }, 20 }, -+ { "gfxterm_heb", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x99fddcbe, 0x6d5c8895, 0x99fddcbe, 0x815c4e3c, 0x9813a416, 0x9813a416, 0x9bcf9821, 0x9bcf9821, 0x9bcf9821, 0xa141e12, 0xa141e12, 0xa141e12, 0xae9417d1, 0xae9417d1, 0xae9417d1, 0x9813a416, 0x815c4e3c, 0x815c4e3c, 0x9813a416, }, 20 }, -+ { "gfxterm_heb", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x5797846, 0x25a6ad40, 0x5797846, 0x100430f5, 0x5fcf013d, 0x5fcf013d, 0xddc86daf, 0xddc86daf, 0xddc86daf, 0xfd875d9, 0xfd875d9, 0xfd875d9, 0xb2e1d1c3, 0xb2e1d1c3, 0xb2e1d1c3, 0x5fcf013d, 0x100430f5, 0x100430f5, 0x5fcf013d, }, 20 }, -+ { "gfxterm_heb", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x30653ae8, 0x7fcd187, 0x30653ae8, 0xf7190a0, 0xdd28f52b, 0xdd28f52b, 0x24c3d325, 0x24c3d325, 0x24c3d325, 0x5ff2ac1, 0x5ff2ac1, 0x5ff2ac1, 0x465f628b, 0x465f628b, 0x465f628b, 0xdd28f52b, 0xf7190a0, 0xf7190a0, 0xdd28f52b, }, 20 }, -+ { "gfxterm_heb", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x3bd91638, 0x1d74dd4a, 0x3bd91638, 0xa2c27c49, 0x43d1f34, 0x43d1f34, 0x53d1ad3d, 0x53d1ad3d, 0x53d1ad3d, 0x2cdb0495, 0x2cdb0495, 0x2cdb0495, 0x7dfa4e27, 0x7dfa4e27, 0x7dfa4e27, 0x43d1f34, 0xa2c27c49, 0xa2c27c49, 0x43d1f34, }, 20 }, -+ { "gfxterm_gre", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xbe2c351a, 0x2692720, 0xbe2c351a, 0xfddaf85d, 0x59c36f00, 0x59c36f00, 0x1b2e2301, 0x1b2e2301, 0x1b2e2301, 0x65ae4e67, 0x65ae4e67, 0x65ae4e67, 0xba04b375, 0xba04b375, 0xba04b375, 0x59c36f00, 0xfddaf85d, 0xfddaf85d, 0x59c36f00, }, 20 }, -+ { "gfxterm_gre", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x1eca82e1, 0xe8fa59cc, 0x1eca82e1, 0x30cf079e, 0xaa4593fe, 0xaa4593fe, 0xaf27ddc5, 0xaf27ddc5, 0xaf27ddc5, 0x9d2d0a2, 0x9d2d0a2, 0x9d2d0a2, 0x1172970b, 0x1172970b, 0x1172970b, 0xaa4593fe, 0x30cf079e, 0x30cf079e, 0xaa4593fe, }, 20 }, -+ { "gfxterm_gre", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xa9ccd435, 0x1ac646eb, 0xa9ccd435, 0xf4dbb9b1, 0xc9cbf769, 0xc9cbf769, 0x86d69aa0, 0x86d69aa0, 0x86d69aa0, 0x780e5b6c, 0x780e5b6c, 0x780e5b6c, 0xe12d9633, 0xe12d9633, 0xe12d9633, 0xc9cbf769, 0xf4dbb9b1, 0xf4dbb9b1, 0xc9cbf769, }, 20 }, -+ { "gfxterm_gre", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xf96d568, 0x7ad05c1b, 0xf96d568, 0x173747ea, 0x9813a416, 0x9813a416, 0xacf9792a, 0xacf9792a, 0xacf9792a, 0x3d22ff19, 0x3d22ff19, 0x3d22ff19, 0x99a2f6da, 0x99a2f6da, 0x99a2f6da, 0x9813a416, 0x173747ea, 0x173747ea, 0x9813a416, }, 20 }, -+ { "gfxterm_gre", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xa0dc6b9c, 0xc2761148, 0xa0dc6b9c, 0xb5a1232f, 0x5fcf013d, 0x5fcf013d, 0x4e05748b, 0x4e05748b, 0x4e05748b, 0x9c156cfd, 0x9c156cfd, 0x9c156cfd, 0x212cc8e7, 0x212cc8e7, 0x212cc8e7, 0x5fcf013d, 0xb5a1232f, 0xb5a1232f, 0x5fcf013d, }, 20 }, -+ { "gfxterm_gre", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xcd722f7d, 0xe4df8d6b, 0xcd722f7d, 0xf2668535, 0xdd28f52b, 0xdd28f52b, 0xbdbb8019, 0xbdbb8019, 0xbdbb8019, 0x9c8779fd, 0x9c8779fd, 0x9c8779fd, 0xdf2731b7, 0xdf2731b7, 0xdf2731b7, 0xdd28f52b, 0xf2668535, 0xf2668535, 0xdd28f52b, }, 20 }, -+ { "gfxterm_gre", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xa6c99d2f, 0x1de04317, 0xa6c99d2f, 0x3fd2f75e, 0x43d1f34, 0x43d1f34, 0x3f85b7d3, 0x3f85b7d3, 0x3f85b7d3, 0x408f1e7b, 0x408f1e7b, 0x408f1e7b, 0x11ae54c9, 0x11ae54c9, 0x11ae54c9, 0x43d1f34, 0x3fd2f75e, 0x3fd2f75e, 0x43d1f34, }, 20 }, -+ { "gfxterm_ru", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x1e35b709, 0x2683bf92, 0x1e35b709, 0x5dc37a4e, 0x59c36f00, 0x59c36f00, 0xd697967f, 0xd697967f, 0xd697967f, 0xa817fb19, 0xa817fb19, 0xa817fb19, 0x77bd060b, 0x77bd060b, 0x77bd060b, 0x59c36f00, 0x5dc37a4e, 0x5dc37a4e, 0x59c36f00, }, 20 }, -+ { "gfxterm_ru", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x53ff7735, 0x8cbf197c, 0x53ff7735, 0x7dfaf24a, 0xaa4593fe, 0xaa4593fe, 0x389a922, 0x389a922, 0x389a922, 0xa57ca445, 0xa57ca445, 0xa57ca445, 0xbddce3ec, 0xbddce3ec, 0xbddce3ec, 0xaa4593fe, 0x7dfaf24a, 0x7dfaf24a, 0xaa4593fe, }, 20 }, -+ { "gfxterm_ru", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x5217c47d, 0x7c8ae63e, 0x5217c47d, 0xf00a9f9, 0xc9cbf769, 0xc9cbf769, 0x3995409, 0x3995409, 0x3995409, 0xfd4195c5, 0xfd4195c5, 0xfd4195c5, 0x6462589a, 0x6462589a, 0x6462589a, 0xc9cbf769, 0xf00a9f9, 0xf00a9f9, 0xc9cbf769, }, 20 }, -+ { "gfxterm_ru", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x45b67706, 0x375fb5db, 0x45b67706, 0x5d17e584, 0x9813a416, 0x9813a416, 0x8195719b, 0x8195719b, 0x8195719b, 0x104ef7a8, 0x104ef7a8, 0x104ef7a8, 0xb4cefe6b, 0xb4cefe6b, 0xb4cefe6b, 0x9813a416, 0x5d17e584, 0x5d17e584, 0x9813a416, }, 20 }, -+ { "gfxterm_ru", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xfc209a25, 0xd5c20779, 0xfc209a25, 0xe95dd296, 0x5fcf013d, 0x5fcf013d, 0xe5699efe, 0xe5699efe, 0xe5699efe, 0x37798688, 0x37798688, 0x37798688, 0x8a402292, 0x8a402292, 0x8a402292, 0x5fcf013d, 0xe95dd296, 0xe95dd296, 0x5fcf013d, }, 20 }, -+ { "gfxterm_ru", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x77f956f0, 0xfb0cc079, 0x77f956f0, 0x48edfcb8, 0xdd28f52b, 0xdd28f52b, 0xd51b1dc9, 0xd51b1dc9, 0xd51b1dc9, 0xf427e42d, 0xf427e42d, 0xf427e42d, 0xb787ac67, 0xb787ac67, 0xb787ac67, 0xdd28f52b, 0x48edfcb8, 0x48edfcb8, 0xdd28f52b, }, 20 }, -+ { "gfxterm_ru", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x1d9ac82a, 0xa254aa53, 0x1d9ac82a, 0x8481a25b, 0x43d1f34, 0x43d1f34, 0xc304df68, 0xc304df68, 0xc304df68, 0xbc0e76c0, 0xbc0e76c0, 0xbc0e76c0, 0xed2f3c72, 0xed2f3c72, 0xed2f3c72, 0x43d1f34, 0x8481a25b, 0x8481a25b, 0x43d1f34, }, 20 }, -+ { "gfxterm_fr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa6239a89, 0x8dc4bfbb, 0xa6239a89, 0xe5d557ce, 0x59c36f00, 0x59c36f00, 0x244cf807, 0x244cf807, 0x244cf807, 0x5acc9561, 0x5acc9561, 0x5acc9561, 0x85666873, 0x85666873, 0x85666873, 0x59c36f00, 0xe5d557ce, 0xe5d557ce, 0x59c36f00, }, 20 }, -+ { "gfxterm_fr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x742cede9, 0x83bb7a50, 0x742cede9, 0x5a296896, 0xaa4593fe, 0xaa4593fe, 0xd83f8aeb, 0xd83f8aeb, 0xd83f8aeb, 0x7eca878c, 0x7eca878c, 0x7eca878c, 0x666ac025, 0x666ac025, 0x666ac025, 0xaa4593fe, 0x5a296896, 0x5a296896, 0xaa4593fe, }, 20 }, -+ { "gfxterm_fr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe20a98b0, 0x7e8cedef, 0xe20a98b0, 0xbf1df534, 0xc9cbf769, 0xc9cbf769, 0x2748b88c, 0x2748b88c, 0x2748b88c, 0xd9907940, 0xd9907940, 0xd9907940, 0x40b3b41f, 0x40b3b41f, 0x40b3b41f, 0xc9cbf769, 0xbf1df534, 0xbf1df534, 0xc9cbf769, }, 20 }, -+ { "gfxterm_fr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x8f911ca4, 0xcbf1d895, 0x8f911ca4, 0x97308e26, 0x9813a416, 0x9813a416, 0x5b359bf4, 0x5b359bf4, 0x5b359bf4, 0xcaee1dc7, 0xcaee1dc7, 0xcaee1dc7, 0x6e6e1404, 0x6e6e1404, 0x6e6e1404, 0x9813a416, 0x97308e26, 0x97308e26, 0x9813a416, }, 20 }, -+ { "gfxterm_fr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x1bf82c82, 0xc7b39627, 0x1bf82c82, 0xe856431, 0x5fcf013d, 0x5fcf013d, 0xa9dbae99, 0xa9dbae99, 0xa9dbae99, 0x7bcbb6ef, 0x7bcbb6ef, 0x7bcbb6ef, 0xc6f212f5, 0xc6f212f5, 0xc6f212f5, 0x5fcf013d, 0xe856431, 0xe856431, 0x5fcf013d, }, 20 }, -+ { "gfxterm_fr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xfae19a5c, 0xd1e8fabb, 0xfae19a5c, 0xc5f53014, 0xdd28f52b, 0xdd28f52b, 0xfa2c5565, 0xfa2c5565, 0xfa2c5565, 0xdb10ac81, 0xdb10ac81, 0xdb10ac81, 0x98b0e4cb, 0x98b0e4cb, 0x98b0e4cb, 0xdd28f52b, 0xc5f53014, 0xc5f53014, 0xdd28f52b, }, 20 }, -+ { "gfxterm_fr", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x9a18f7bc, 0x5fcecc43, 0x9a18f7bc, 0x3039dcd, 0x43d1f34, 0x43d1f34, 0x287a2b96, 0x287a2b96, 0x287a2b96, 0x5770823e, 0x5770823e, 0x5770823e, 0x651c88c, 0x651c88c, 0x651c88c, 0x43d1f34, 0x3039dcd, 0x3039dcd, 0x43d1f34, }, 20 }, -+ { "gfxterm_quot", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x65112dfc, 0x3dec17f, 0x65112dfc, 0x26e7e0bb, 0x59c36f00, 0x59c36f00, 0x620c0067, 0x620c0067, 0x620c0067, 0x1c8c6d01, 0x1c8c6d01, 0x1c8c6d01, 0xc3269013, 0xc3269013, 0xc3269013, 0x59c36f00, 0x26e7e0bb, 0x26e7e0bb, 0x59c36f00, }, 20 }, -+ { "gfxterm_quot", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2b3430fb, 0x8f1eb743, 0x2b3430fb, 0x531b584, 0xaa4593fe, 0xaa4593fe, 0xa8a596c8, 0xa8a596c8, 0xa8a596c8, 0xe509baf, 0xe509baf, 0xe509baf, 0x16f0dc06, 0x16f0dc06, 0x16f0dc06, 0xaa4593fe, 0x531b584, 0x531b584, 0xaa4593fe, }, 20 }, -+ { "gfxterm_quot", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xb523e920, 0xfafb6f8, 0xb523e920, 0xe83484a4, 0xc9cbf769, 0xc9cbf769, 0x3ce35e1d, 0x3ce35e1d, 0x3ce35e1d, 0xc23b9fd1, 0xc23b9fd1, 0xc23b9fd1, 0x5b18528e, 0x5b18528e, 0x5b18528e, 0xc9cbf769, 0xe83484a4, 0xe83484a4, 0xc9cbf769, }, 20 }, -+ { "gfxterm_quot", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xa9bf7336, 0x1a1f7a01, 0xa9bf7336, 0xb11ee1b4, 0x9813a416, 0x9813a416, 0x43fda3fa, 0x43fda3fa, 0x43fda3fa, 0xd22625c9, 0xd22625c9, 0xd22625c9, 0x76a62c0a, 0x76a62c0a, 0x76a62c0a, 0x9813a416, 0xb11ee1b4, 0xb11ee1b4, 0x9813a416, }, 20 }, -+ { "gfxterm_quot", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xe5271912, 0xf5d10273, 0xe5271912, 0xf05a51a1, 0x5fcf013d, 0x5fcf013d, 0xf3582c48, 0xf3582c48, 0xf3582c48, 0x2148343e, 0x2148343e, 0x2148343e, 0x9c719024, 0x9c719024, 0x9c719024, 0x5fcf013d, 0xf05a51a1, 0xf05a51a1, 0x5fcf013d, }, 20 }, -+ { "gfxterm_quot", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x66a34f49, 0x32dbeb97, 0x66a34f49, 0x59b7e501, 0xdd28f52b, 0xdd28f52b, 0xb3c7ef80, 0xb3c7ef80, 0xb3c7ef80, 0x92fb1664, 0x92fb1664, 0x92fb1664, 0xd15b5e2e, 0xd15b5e2e, 0xd15b5e2e, 0xdd28f52b, 0x59b7e501, 0x59b7e501, 0xdd28f52b, }, 20 }, -+ { "gfxterm_quot", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x7c2f19da, 0xd7bece67, 0x7c2f19da, 0xe53473ab, 0x43d1f34, 0x43d1f34, 0xa0717008, 0xa0717008, 0xa0717008, 0xdf7bd9a0, 0xdf7bd9a0, 0xdf7bd9a0, 0x8e5a9312, 0x8e5a9312, 0x8e5a9312, 0x43d1f34, 0xe53473ab, 0xe53473ab, 0x43d1f34, }, 20 }, -+ { "gfxterm_piglatin", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x37943894, 0x78248c70, 0x37943894, 0x7462f5d3, 0x59c36f00, 0x59c36f00, 0xf4be229a, 0xf4be229a, 0xf4be229a, 0x8a3e4ffc, 0x8a3e4ffc, 0x8a3e4ffc, 0x5594b2ee, 0x5594b2ee, 0x5594b2ee, 0x59c36f00, 0x7462f5d3, 0x7462f5d3, 0x59c36f00, }, 20 }, -+ { "gfxterm_piglatin", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd5158e6c, 0xdc71ba0f, 0xd5158e6c, 0xfb100b13, 0xaa4593fe, 0xaa4593fe, 0xd3ed72a3, 0xd3ed72a3, 0xd3ed72a3, 0x75187fc4, 0x75187fc4, 0x75187fc4, 0x6db8386d, 0x6db8386d, 0x6db8386d, 0xaa4593fe, 0xfb100b13, 0xfb100b13, 0xaa4593fe, }, 20 }, -+ { "gfxterm_piglatin", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x6277a9e6, 0xa3265ffb, 0x6277a9e6, 0x3f60c462, 0xc9cbf769, 0xc9cbf769, 0x2dcf8a8d, 0x2dcf8a8d, 0x2dcf8a8d, 0xd3174b41, 0xd3174b41, 0xd3174b41, 0x4a34861e, 0x4a34861e, 0x4a34861e, 0xc9cbf769, 0x3f60c462, 0x3f60c462, 0xc9cbf769, }, 20 }, -+ { "gfxterm_piglatin", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x81115dc4, 0xddf3f768, 0x81115dc4, 0x99b0cf46, 0x9813a416, 0x9813a416, 0x9b9d96df, 0x9b9d96df, 0x9b9d96df, 0xa4610ec, 0xa4610ec, 0xa4610ec, 0xaec6192f, 0xaec6192f, 0xaec6192f, 0x9813a416, 0x99b0cf46, 0x99b0cf46, 0x9813a416, }, 20 }, -+ { "gfxterm_piglatin", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x5e96a904, 0x27864d3d, 0x5e96a904, 0x4bebe1b7, 0x5fcf013d, 0x5fcf013d, 0x18cae7f4, 0x18cae7f4, 0x18cae7f4, 0xcadaff82, 0xcadaff82, 0xcadaff82, 0x77e35b98, 0x77e35b98, 0x77e35b98, 0x5fcf013d, 0x4bebe1b7, 0x4bebe1b7, 0x5fcf013d, }, 20 }, -+ { "gfxterm_piglatin", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xd00b19f8, 0xba73a9c6, 0xd00b19f8, 0xef1fb3b0, 0xdd28f52b, 0xdd28f52b, 0xb660046d, 0xb660046d, 0xb660046d, 0x975cfd89, 0x975cfd89, 0x975cfd89, 0xd4fcb5c3, 0xd4fcb5c3, 0xd4fcb5c3, 0xdd28f52b, 0xef1fb3b0, 0xef1fb3b0, 0xdd28f52b, }, 20 }, -+ { "gfxterm_piglatin", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x8b4b98cd, 0x78ddc6e4, 0x8b4b98cd, 0x1250f2bc, 0x43d1f34, 0x43d1f34, 0x4889d3fd, 0x4889d3fd, 0x4889d3fd, 0x37837a55, 0x37837a55, 0x37837a55, 0x66a230e7, 0x66a230e7, 0x66a230e7, 0x43d1f34, 0x1250f2bc, 0x1250f2bc, 0x43d1f34, }, 20 }, -+ { "gfxterm_ch", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xfecb570e, 0xccb97a7a, 0xfecb570e, 0xbd3d9a49, 0x59c36f00, 0x59c36f00, 0x40281258, 0x40281258, 0x40281258, 0x3ea87f3e, 0x3ea87f3e, 0x3ea87f3e, 0xe102822c, 0xe102822c, 0xe102822c, 0x59c36f00, 0xbd3d9a49, 0xbd3d9a49, 0x59c36f00, }, 20 }, -+ { "gfxterm_ch", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x897d1fac, 0xaa982529, 0x897d1fac, 0xa7789ad3, 0xaa4593fe, 0xaa4593fe, 0xa482510, 0xa482510, 0xa482510, 0xacbd2877, 0xacbd2877, 0xacbd2877, 0xb41d6fde, 0xb41d6fde, 0xb41d6fde, 0xaa4593fe, 0xa7789ad3, 0xa7789ad3, 0xaa4593fe, }, 20 }, -+ { "gfxterm_ch", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd02a5297, 0xe627ab58, 0xd02a5297, 0x8d3d3f13, 0xc9cbf769, 0xc9cbf769, 0xbf0a8b7f, 0xbf0a8b7f, 0xbf0a8b7f, 0x41d24ab3, 0x41d24ab3, 0x41d24ab3, 0xd8f187ec, 0xd8f187ec, 0xd8f187ec, 0xc9cbf769, 0x8d3d3f13, 0x8d3d3f13, 0xc9cbf769, }, 20 }, -+ { "gfxterm_ch", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xa653dcda, 0x3392e976, 0xa653dcda, 0xbef24e58, 0x9813a416, 0x9813a416, 0x4f2bc106, 0x4f2bc106, 0x4f2bc106, 0xdef04735, 0xdef04735, 0xdef04735, 0x7a704ef6, 0x7a704ef6, 0x7a704ef6, 0x9813a416, 0xbef24e58, 0xbef24e58, 0x9813a416, }, 20 }, -+ { "gfxterm_ch", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xe2d7b585, 0x35241f36, 0xe2d7b585, 0xf7aafd36, 0x5fcf013d, 0x5fcf013d, 0xf2bd04db, 0xf2bd04db, 0xf2bd04db, 0x20ad1cad, 0x20ad1cad, 0x20ad1cad, 0x9d94b8b7, 0x9d94b8b7, 0x9d94b8b7, 0x5fcf013d, 0xf7aafd36, 0xf7aafd36, 0x5fcf013d, }, 20 }, -+ { "gfxterm_ch", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x72ff749c, 0xeda8c283, 0x72ff749c, 0x4debded4, 0xdd28f52b, 0xdd28f52b, 0xb8c9cc22, 0xb8c9cc22, 0xb8c9cc22, 0x99f535c6, 0x99f535c6, 0x99f535c6, 0xda557d8c, 0xda557d8c, 0xda557d8c, 0xdd28f52b, 0x4debded4, 0x4debded4, 0xdd28f52b, }, 20 }, -+ { "gfxterm_ch", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0xb7cac764, 0xeb4bf417, 0xb7cac764, 0x2ed1ad15, 0x43d1f34, 0x43d1f34, 0xce718801, 0xce718801, 0xce718801, 0xb17b21a9, 0xb17b21a9, 0xb17b21a9, 0xe05a6b1b, 0xe05a6b1b, 0xe05a6b1b, 0x43d1f34, 0x2ed1ad15, 0x2ed1ad15, 0x43d1f34, }, 20 }, -+ { "gfxterm_red", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x930e8e13, 0xf5c16290, 0x930e8e13, 0x27f5f1c0, 0x59c36f00, 0x59c36f00, 0xbad4e11, 0xbad4e11, 0xbad4e11, 0x752d2377, 0x752d2377, 0x752d2377, 0xaa87de65, 0xaa87de65, 0xaa87de65, 0x59c36f00, 0x27f5f1c0, 0x27f5f1c0, 0x59c36f00, }, 20 }, -+ { "gfxterm_red", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xff9301f2, 0x5bb9864a, 0xff9301f2, 0x31c145de, 0xaa4593fe, 0xaa4593fe, 0x23bf2c32, 0x23bf2c32, 0x23bf2c32, 0x854a2155, 0x854a2155, 0x854a2155, 0x9dea66fc, 0x9dea66fc, 0x9dea66fc, 0xaa4593fe, 0x31c145de, 0x31c145de, 0xaa4593fe, }, 20 }, -+ { "gfxterm_red", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xfc5938ef, 0x46d56737, 0xfc5938ef, 0x23cf2668, 0xc9cbf769, 0xc9cbf769, 0xa8c549aa, 0xa8c549aa, 0xa8c549aa, 0x561d8866, 0x561d8866, 0x561d8866, 0xcf3e4539, 0xcf3e4539, 0xcf3e4539, 0xc9cbf769, 0x23cf2668, 0x23cf2668, 0xc9cbf769, }, 20 }, -+ { "gfxterm_red", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xe7160822, 0x54b60115, 0xe7160822, 0x168efa6f, 0x9813a416, 0x9813a416, 0xb774a5aa, 0xb774a5aa, 0xb774a5aa, 0x26af2399, 0x26af2399, 0x26af2399, 0x822f2a5a, 0x822f2a5a, 0x822f2a5a, 0x9813a416, 0x168efa6f, 0x168efa6f, 0x9813a416, }, 20 }, -+ { "gfxterm_red", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xf655f9b2, 0xe6a3e2d3, 0xf655f9b2, 0xd1d7405f, 0x5fcf013d, 0x5fcf013d, 0x2accaa08, 0x2accaa08, 0x2accaa08, 0xf8dcb27e, 0xf8dcb27e, 0xf8dcb27e, 0x45e51664, 0x45e51664, 0x45e51664, 0x5fcf013d, 0xd1d7405f, 0xd1d7405f, 0x5fcf013d, }, 20 }, -+ { "gfxterm_red", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x2d85ebdc, 0x79fd4f02, 0x2d85ebdc, 0xc48ae2b6, 0xdd28f52b, 0xdd28f52b, 0x76b28a95, 0x76b28a95, 0x76b28a95, 0x578e7371, 0x578e7371, 0x578e7371, 0x142e3b3b, 0x142e3b3b, 0x142e3b3b, 0xdd28f52b, 0xc48ae2b6, 0xc48ae2b6, 0xdd28f52b, }, 20 }, -+ { "gfxterm_red", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x29c00f98, 0x8251d825, 0x29c00f98, 0x35a750d1, 0x43d1f34, 0x43d1f34, 0x48b70bc8, 0x48b70bc8, 0x48b70bc8, 0x37bda260, 0x37bda260, 0x37bda260, 0x669ce8d2, 0x669ce8d2, 0x669ce8d2, 0x43d1f34, 0x35a750d1, 0x35a750d1, 0x43d1f34, }, 20 }, -+ { "gfxterm_high", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x4afab717, 0x2c355b94, 0x4afab717, 0x1166d9d0, 0x59c36f00, 0x59c36f00, 0x620c0067, 0x620c0067, 0x620c0067, 0x1c8c6d01, 0x1c8c6d01, 0x1c8c6d01, 0xc3269013, 0xc3269013, 0xc3269013, 0x59c36f00, 0x1166d9d0, 0x1166d9d0, 0x59c36f00, }, 20 }, -+ { "gfxterm_high", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xe3daadd4, 0x47f02a6c, 0xe3daadd4, 0x5ea9fb21, 0xaa4593fe, 0xaa4593fe, 0xa8a596c8, 0xa8a596c8, 0xa8a596c8, 0xe509baf, 0xe509baf, 0xe509baf, 0x16f0dc06, 0x16f0dc06, 0x16f0dc06, 0xaa4593fe, 0x5ea9fb21, 0x5ea9fb21, 0xaa4593fe, }, 20 }, -+ { "gfxterm_high", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xf140d1df, 0x4bcc8e07, 0xf140d1df, 0x7c962dcb, 0xc9cbf769, 0xc9cbf769, 0x3ce35e1d, 0x3ce35e1d, 0x3ce35e1d, 0xc23b9fd1, 0xc23b9fd1, 0xc23b9fd1, 0x5b18528e, 0x5b18528e, 0x5b18528e, 0xc9cbf769, 0x7c962dcb, 0x7c962dcb, 0xc9cbf769, }, 20 }, -+ { "gfxterm_high", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xe709a12d, 0x54a9a81a, 0xe709a12d, 0xde04d65c, 0x9813a416, 0x9813a416, 0x43fda3fa, 0x43fda3fa, 0x43fda3fa, 0xd22625c9, 0xd22625c9, 0xd22625c9, 0x76a62c0a, 0x76a62c0a, 0x76a62c0a, 0x9813a416, 0xde04d65c, 0xde04d65c, 0x9813a416, }, 20 }, -+ { "gfxterm_high", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x65eff77c, 0x7519ec1d, 0x65eff77c, 0x1cd7d353, 0x5fcf013d, 0x5fcf013d, 0xf3582c48, 0xf3582c48, 0xf3582c48, 0x2148343e, 0x2148343e, 0x2148343e, 0x9c719024, 0x9c719024, 0x9c719024, 0x5fcf013d, 0x1cd7d353, 0x1cd7d353, 0x5fcf013d, }, 20 }, -+ { "gfxterm_high", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7318831a, 0x276027c4, 0x7318831a, 0xd7e4f5bb, 0xdd28f52b, 0xdd28f52b, 0xb3c7ef80, 0xb3c7ef80, 0xb3c7ef80, 0x92fb1664, 0x92fb1664, 0x92fb1664, 0xd15b5e2e, 0xd15b5e2e, 0xd15b5e2e, 0xdd28f52b, 0xd7e4f5bb, 0xd7e4f5bb, 0xdd28f52b, }, 20 }, -+ { "gfxterm_high", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x43d1f34, 0x6927a7d4, 0xc2b67069, 0x6927a7d4, 0xfc345163, 0x43d1f34, 0x43d1f34, 0xa0717008, 0xa0717008, 0xa0717008, 0xdf7bd9a0, 0xdf7bd9a0, 0xdf7bd9a0, 0x8e5a9312, 0x8e5a9312, 0x8e5a9312, 0x43d1f34, 0xfc345163, 0xfc345163, 0x43d1f34, }, 20 }, -+ { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0xe6012f70, 0xe6012f70, 0xe6012f70, 0xe6012f70, 0xe6012f70, }, 5 }, -+ { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xfb6be77b, 0xfb6be77b, 0xfb6be77b, 0xfb6be77b, 0xfb6be77b, }, 5 }, -+ { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0x67c0629f, 0x67c0629f, 0x67c0629f, 0x67c0629f, 0x67c0629f, }, 5 }, -+ { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x8f20afbb, 0xd8f7abc, 0x8f937344, 0xd3ca643, 0x8e471645, }, 5 }, -+ { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xdca764da, 0x9f76da9a, 0x5b04185a, 0x18d5a61a, 0xd60deb2b, }, 5 }, -+ { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0x7b87af36, 0x7cb96093, 0x75fa307c, 0x72c4ffd9, 0x677c91a2, }, 5 }, -+ { "videotest", 2560, 1440, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 2560x1440xrgba8888 */, (grub_uint32_t []) { 0x72981c65, 0x50120635, 0x378c28c5, 0x15063295, 0xf8b07525, }, 5 }, -+ { "videotest", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0xc8f64b58, 0xc8f64b58, 0xc8f64b58, 0xc8f64b58, 0xc8f64b58, }, 5 }, -+ { "videotest", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0x2b499dfa, 0x2b499dfa, 0x2b499dfa, 0x2b499dfa, 0x2b499dfa, }, 5 }, -+ { "videotest", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0x6156b420, 0x6156b420, 0x6156b420, 0x6156b420, 0x6156b420, }, 5 }, -+ { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x363285ca, 0x363285ca, 0x363285ca, 0x363285ca, 0x363285ca, }, 5 }, -+ { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0x25bb37f4, 0x25bb37f4, 0x25bb37f4, 0x25bb37f4, 0x25bb37f4, }, 5 }, -+ { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0xeeab9e91, 0xeeab9e91, 0xeeab9e91, 0xeeab9e91, 0xeeab9e91, }, 5 }, -+ { "videotest", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x26a9a50b, 0x26a9a50b, 0x26a9a50b, 0x26a9a50b, 0x26a9a50b, }, 5 }, -+ { "videotest", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0x2c0f4fe7, 0x2c0f4fe7, 0x2c0f4fe7, 0x2c0f4fe7, 0x2c0f4fe7, }, 5 }, -+ { "videotest", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x46c11052, 0x46c11052, 0x46c11052, 0x46c11052, 0x46c11052, }, 5 }, -+ { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0xe56cf615, 0xcd2be572, 0xb5e2d0db, 0x9da5c3bc, 0x4470bb89, }, 5 }, -+ { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x2a25b871, 0x4bf85361, 0xe99e6e51, 0x88438541, 0xa8be62c0, }, 5 }, -+ { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x81523037, 0xd8c0bfd3, 0x32772fff, 0x6be5a01b, 0xe2f47956, }, 5 }, -+ { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x1833bb41, 0x1833bb41, 0x1833bb41, 0x1833bb41, 0x1833bb41, }, 5 }, -+ { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0x2c39a0e8, 0x2c39a0e8, 0x2c39a0e8, 0x2c39a0e8, 0x2c39a0e8, }, 5 }, -+ { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0xf0d4c23, 0xf0d4c23, 0xf0d4c23, 0xf0d4c23, 0xf0d4c23, }, 5 }, -+ { "videotest", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x456d063c, 0x456d063c, 0x456d063c, 0x456d063c, 0x456d063c, }, 5 }, -+ { "videotest", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0x47e15a2e, 0x47e15a2e, 0x47e15a2e, 0x47e15a2e, 0x47e15a2e, }, 5 }, -+ { "videotest", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x54d7300d, 0x54d7300d, 0x54d7300d, 0x54d7300d, 0x54d7300d, }, 5 }, -+ { "videotest", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x770da211, 0x8ef2528e, 0x811e35de, 0x78e1c541, 0x9ec6fb7e, }, 5 }, -+ { "videotest", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0xeb181fbc, 0xae648cc1, 0x61e13946, 0x249daa3b, 0xfb0624b9, }, 5 }, -+ { "videotest", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x2b6f64dc, 0xc25f8431, 0xfce2d3f7, 0x15d2331a, 0x81987c7b, }, 5 }, -+ { "videotest", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0xa260f7dd, 0x3e2f4980, 0x9f13fd96, 0x35c43cb, 0xd886e34b, }, 5 }, -+ { "videotest", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x41a9bff8, 0xa0d3f7c3, 0x86b1597f, 0x67cb1144, 0xca740407, }, 5 }, -+ { "videotest", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0x8f7a3b6d, 0xcb84c6e3, 0x687c071, 0x42793dff, 0x996dbba4, }, 5 }, -diff --git a/include/grub/aout.h b/include/grub/aout.h -index 10d7dde61ececf0e980c6ad62420764fcefd5e67..c8c1d94eca518042992a6fc5e3777f81a39b431d 100644 ---- a/include/grub/aout.h -+++ b/include/grub/aout.h -@@ -52,6 +52,7 @@ - #define GRUB_AOUT_HEADER 1 - - #include -+#include - - struct grub_aout32_header - { -diff --git a/include/grub/arc/arc.h b/include/grub/arc/arc.h -index 7615a49a92cac0ac16326c188e438b789b09acec..999de7196753b58781a02c5311c9bc3834408021 100644 ---- a/include/grub/arc/arc.h -+++ b/include/grub/arc/arc.h -@@ -53,7 +53,7 @@ enum grub_arc_memory_type - #ifndef GRUB_CPU_WORDS_BIGENDIAN - GRUB_ARC_MEMORY_FREE_CONTIGUOUS, - #endif -- } grub_arc_memory_type_t; -+ }; - - struct grub_arc_timeinfo - { -diff --git a/include/grub/arm/coreboot/console.h b/include/grub/arm/coreboot/console.h -new file mode 100644 -index 0000000000000000000000000000000000000000..13a14b783839a6cae96845973ae3087bcaef670e ---- /dev/null -+++ b/include/grub/arm/coreboot/console.h -@@ -0,0 +1,29 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_MACHINE_CONSOLE_HEADER -+#define GRUB_MACHINE_CONSOLE_HEADER 1 -+ -+void grub_video_coreboot_fb_init (void); -+void grub_video_coreboot_fb_early_init (void); -+void grub_video_coreboot_fb_late_init (void); -+void grub_video_coreboot_fb_fini (void); -+ -+extern struct grub_linuxbios_table_framebuffer *grub_video_coreboot_fbtable; -+ -+#endif /* ! GRUB_MACHINE_CONSOLE_HEADER */ -diff --git a/include/grub/arm/coreboot/kernel.h b/include/grub/arm/coreboot/kernel.h -new file mode 100644 -index 0000000000000000000000000000000000000000..2695053427050f306b8ca86ba066df90c519e8e0 ---- /dev/null -+++ b/include/grub/arm/coreboot/kernel.h -@@ -0,0 +1,44 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2013 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_KERNEL_MACHINE_HEADER -+#define GRUB_KERNEL_MACHINE_HEADER 1 -+ -+#ifndef ASM_FILE -+ -+#include -+#include -+ -+struct grub_fdt_board -+{ -+ const char *vendor, *part; -+ const grub_uint8_t *dtb; -+ grub_size_t dtb_size; -+}; -+ -+extern struct grub_fdt_board grub_fdt_boards[]; -+void grub_machine_timer_init (void); -+void grub_pl050_init (void); -+void grub_cros_init (void); -+void grub_rk3288_spi_init (void); -+extern grub_addr_t EXPORT_VAR (start_of_ram); -+#endif /* ! ASM_FILE */ -+ -+#define GRUB_KERNEL_MACHINE_STACK_SIZE GRUB_KERNEL_ARM_STACK_SIZE -+ -+#endif /* ! GRUB_KERNEL_MACHINE_HEADER */ -diff --git a/include/grub/arm/cros_ec.h b/include/grub/arm/cros_ec.h -new file mode 100644 -index 0000000000000000000000000000000000000000..45a372572a5c3c411c9b2b7f328135f5cbe551c8 ---- /dev/null -+++ b/include/grub/arm/cros_ec.h -@@ -0,0 +1,21 @@ -+#ifndef GRUB_ARM_CROS_EC_H -+#define GRUB_ARM_CROS_EC_H 1 -+ -+#include -+#include -+ -+#define GRUB_CROS_EC_KEYSCAN_COLS 13 -+#define GRUB_CROS_EC_KEYSCAN_ROWS 8 -+ -+struct grub_cros_ec_keyscan { -+ grub_uint8_t data[GRUB_CROS_EC_KEYSCAN_COLS]; -+}; -+ -+int -+grub_cros_ec_scan_keyboard (const struct grub_fdtbus_dev *dev, -+ struct grub_cros_ec_keyscan *scan); -+ -+int -+grub_cros_ec_validate (const struct grub_fdtbus_dev *dev); -+ -+#endif -diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index a66caad13db8c5c3b0da10f624d01a81640eab44..712ba17b9ba30cf850b6a9011d08a04d57816227 100644 ---- a/include/grub/arm/linux.h -+++ b/include/grub/arm/linux.h -@@ -17,14 +17,28 @@ - * along with GRUB. If not, see . - */ - --#ifndef GRUB_LINUX_CPU_HEADER --#define GRUB_LINUX_CPU_HEADER 1 -- --#define LINUX_ZIMAGE_OFFSET 0x24 --#define LINUX_ZIMAGE_MAGIC 0x016f2818 -+#ifndef GRUB_ARM_LINUX_HEADER -+#define GRUB_ARM_LINUX_HEADER 1 - - #include "system.h" - -+#define GRUB_LINUX_ARM_MAGIC_SIGNATURE 0x016f2818 -+ -+struct linux_arm_kernel_header { -+ grub_uint32_t code0; -+ grub_uint32_t reserved1[8]; -+ grub_uint32_t magic; -+ grub_uint32_t start; /* _start */ -+ grub_uint32_t end; /* _edata */ -+ grub_uint32_t reserved2[4]; -+ grub_uint32_t hdr_offset; -+}; -+ -+#if defined(__arm__) -+# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE -+# define linux_armxx_kernel_header linux_arm_kernel_header -+#endif -+ - #if defined GRUB_MACHINE_UBOOT - # include - # define LINUX_ADDRESS (start_of_ram + 0x8000) -@@ -32,15 +46,17 @@ - # define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000) - # define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data - # define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type --#elif defined GRUB_MACHINE_EFI --# include --# include --/* On UEFI platforms - load the images at the lowest available address not -- less than *_PHYS_OFFSET from the first available memory location. */ --# define LINUX_PHYS_OFFSET (0x00008000) --# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000) --# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000) --# define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt -+#elif defined (GRUB_MACHINE_COREBOOT) -+#include -+#include -+# define LINUX_ADDRESS (start_of_ram + 0x8000) -+# define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000) -+# define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000) -+static inline const void * -+grub_arm_firmware_get_boot_data (void) -+{ -+ return grub_fdtbus_get_fdt (); -+} - static inline grub_uint32_t - grub_arm_firmware_get_machine_type (void) - { -@@ -48,6 +64,4 @@ grub_arm_firmware_get_machine_type (void) - } - #endif - --#define FDT_ADDITIONAL_ENTRIES_SIZE 0x300 -- --#endif /* ! GRUB_LINUX_CPU_HEADER */ -+#endif /* ! GRUB_ARM_LINUX_HEADER */ -diff --git a/include/grub/arm/startup.h b/include/grub/arm/startup.h -new file mode 100644 -index 0000000000000000000000000000000000000000..9afb6c57c0bc4c53e96f711bf545d94a8ed07aa5 ---- /dev/null -+++ b/include/grub/arm/startup.h -@@ -0,0 +1,16 @@ -+#ifndef GRUB_STARTUP_CPU_HEADER -+#define GRUB_STARTUP_CPU_HEADER -+ -+struct grub_arm_startup_registers -+{ -+ /* registers 0-11 */ -+ /* for U-boot r[1] is machine type */ -+ /* for U-boot r[2] is boot data */ -+ grub_uint32_t r[12]; -+ grub_uint32_t sp; -+ grub_uint32_t lr; -+}; -+ -+extern struct grub_arm_startup_registers grub_arm_saved_registers; -+ -+#endif -diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index 1ea23696e7a096e53075af2314da11ecce91f8d7..8655067e03924793293ba86cb1bae2e44efa5fee 100644 ---- a/include/grub/arm64/linux.h -+++ b/include/grub/arm64/linux.h -@@ -16,17 +16,13 @@ - * along with GRUB. If not, see . - */ - --#ifndef GRUB_LINUX_CPU_HEADER --#define GRUB_LINUX_CPU_HEADER 1 -+#ifndef GRUB_ARM64_LINUX_HEADER -+#define GRUB_ARM64_LINUX_HEADER 1 - --#include -- --#define GRUB_ARM64_LINUX_MAGIC 0x644d5241 /* 'ARM\x64' */ -- --#define GRUB_EFI_PE_MAGIC 0x5A4D -+#define GRUB_LINUX_ARM64_MAGIC_SIGNATURE 0x644d5241 /* 'ARM\x64' */ - - /* From linux/Documentation/arm64/booting.txt */ --struct grub_arm64_linux_kernel_header -+struct linux_arm64_kernel_header - { - grub_uint32_t code0; /* Executable code */ - grub_uint32_t code1; /* Executable code */ -@@ -40,9 +36,9 @@ struct grub_arm64_linux_kernel_header - grub_uint32_t hdr_offset; /* Offset of PE/COFF header */ - }; - --grub_err_t grub_arm64_uefi_check_image (struct grub_arm64_linux_kernel_header -- *lh); --grub_err_t grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, -- char *args); -+#if defined(__aarch64__) -+# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE -+# define linux_armxx_kernel_header linux_arm64_kernel_header -+#endif - --#endif /* ! GRUB_LINUX_CPU_HEADER */ -+#endif /* ! GRUB_ARM64_LINUX_HEADER */ -diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h -index b4f8ff0a06117756a770129683796edf0050b867..bcb4d9ba78f1376bdaa82249418f847eb4e543a6 100644 ---- a/include/grub/at_keyboard.h -+++ b/include/grub/at_keyboard.h -@@ -23,13 +23,11 @@ - #define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02) - #define KEYBOARD_COMMAND_READ 0x20 - #define KEYBOARD_COMMAND_WRITE 0x60 -+#define KEYBOARD_COMMAND_ENABLE 0xf4 - #define KEYBOARD_COMMAND_REBOOT 0xfe - - #define KEYBOARD_AT_TRANSLATE 0x40 -- --#define GRUB_AT_ACK 0xfa --#define GRUB_AT_NACK 0xfe --#define GRUB_AT_TRIES 5 -+#define KEYBOARD_AT_DISABLE 0x10 - - #define KEYBOARD_ISMAKE(x) !((x) & 0x80) - #define KEYBOARD_ISREADY(x) ((x) & 0x01) -diff --git a/include/grub/autoefi.h b/include/grub/autoefi.h -index b75591176eb9d785de3f2867e32edc1b9a626280..b7a252e079e2137b4d27639b5c981e9085cb8a82 100644 ---- a/include/grub/autoefi.h -+++ b/include/grub/autoefi.h -@@ -55,7 +55,7 @@ static inline grub_err_t grub_autoefi_prepare (void) - # define SYSTEM_TABLE_PTR GRUB_EFIEMU_SYSTEM_TABLE_PTR - # define SIZEOF_OF_UINTN GRUB_EFIEMU_SIZEOF_OF_UINTN - # define SYSTEM_TABLE GRUB_EFIEMU_SYSTEM_TABLE --# define grub_efi_allocate_pages(x,y) (x) -+# define grub_efi_allocate_fixed(x,y) (x) - # define grub_efi_free_pages(x,y) GRUB_EFI_SUCCESS - # define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services - # define EFI_PRESENT 1 -diff --git a/include/grub/cache.h b/include/grub/cache.h -index fc669dfd1892c14bb43c6230e48067a0ff8e7c23..ccfa717e669625e0db96df0692c65f5a4c5ff916 100644 ---- a/include/grub/cache.h -+++ b/include/grub/cache.h -@@ -34,15 +34,16 @@ void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len); - #endif - - #ifndef GRUB_MACHINE_EMU --#ifdef _mips --void EXPORT_FUNC(grub_arch_sync_dma_caches) (volatile void *address, -- grub_size_t len); --#else -+#if defined (__aarch64__) || defined (__powerpc__) || defined (__sparc__) -+ -+#elif defined (__i386__) || defined (__x86_64__) - static inline void - grub_arch_sync_dma_caches (volatile void *address __attribute__ ((unused)), - grub_size_t len __attribute__ ((unused))) - { - } -+#else -+void EXPORT_FUNC(grub_arch_sync_dma_caches) (volatile void *address, grub_size_t len); - #endif - #endif - -diff --git a/include/grub/i386/coreboot/lbio.h b/include/grub/coreboot/lbio.h -similarity index 93% -rename from include/grub/i386/coreboot/lbio.h -rename to include/grub/coreboot/lbio.h -index 1c3fa6f1953c3a6b41ea3644c30f000c98524224..5076d36c71ba32e5c55a6242287e5fe159e09b4f 100644 ---- a/include/grub/i386/coreboot/lbio.h -+++ b/include/grub/coreboot/lbio.h -@@ -20,6 +20,9 @@ - #ifndef _GRUB_MACHINE_LBIO_HEADER - #define _GRUB_MACHINE_LBIO_HEADER 1 - -+#include -+#include -+ - struct grub_linuxbios_table_header - { - grub_uint8_t signature[4]; -@@ -102,4 +105,10 @@ EXPORT_FUNC(grub_linuxbios_table_iterate) (int (*hook) (grub_linuxbios_table_ite - void *), - void *hook_data); - -+grub_linuxbios_table_header_t -+grub_linuxbios_get_tables (void); -+ -+int -+grub_linuxbios_check_signature (grub_linuxbios_table_header_t tbl_header); -+ - #endif -diff --git a/include/grub/dma.h b/include/grub/dma.h -new file mode 100644 -index 0000000000000000000000000000000000000000..19992ebc131d4fc93a45f31992ad3c03b9de2821 ---- /dev/null -+++ b/include/grub/dma.h -@@ -0,0 +1,44 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2008,2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_DMA_H -+#define GRUB_DMA_H 1 -+ -+struct grub_pci_dma_chunk; -+ -+struct grub_pci_dma_chunk *EXPORT_FUNC(grub_memalign_dma32) (grub_size_t align, -+ grub_size_t size); -+void EXPORT_FUNC(grub_dma_free) (struct grub_pci_dma_chunk *ch); -+volatile void *EXPORT_FUNC(grub_dma_get_virt) (struct grub_pci_dma_chunk *ch); -+grub_uint32_t EXPORT_FUNC(grub_dma_get_phys) (struct grub_pci_dma_chunk *ch); -+ -+static inline void * -+grub_dma_phys2virt (grub_uint32_t phys, struct grub_pci_dma_chunk *chunk) -+{ -+ return ((grub_uint8_t *) grub_dma_get_virt (chunk) -+ + (phys - grub_dma_get_phys (chunk))); -+} -+ -+static inline grub_uint32_t -+grub_dma_virt2phys (volatile void *virt, struct grub_pci_dma_chunk *chunk) -+{ -+ return (((grub_uint8_t *) virt - (grub_uint8_t *) grub_dma_get_virt (chunk)) -+ + grub_dma_get_phys (chunk)); -+} -+ -+#endif -diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index e9c601f34103ae1a4ced7e93be8204970bfef193..2c6648d46fc1a377312c81220c38470d9d1cc99a 100644 ---- a/include/grub/efi/efi.h -+++ b/include/grub/efi/efi.h -@@ -38,16 +38,25 @@ void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle, - int EXPORT_FUNC(grub_efi_set_text_mode) (int on); - void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds); - void * --EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address, -+EXPORT_FUNC(grub_efi_allocate_pages_real) (grub_efi_physical_address_t address, -+ grub_efi_uintn_t pages, -+ grub_efi_allocate_type_t alloctype, -+ grub_efi_memory_type_t memtype); -+void * -+EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address, - grub_efi_uintn_t pages); -+void * -+EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages); - void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address, - grub_efi_uintn_t pages); -+grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void); - int - EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, - grub_efi_memory_descriptor_t *memory_map, - grub_efi_uintn_t *map_key, - grub_efi_uintn_t *descriptor_size, - grub_efi_uint32_t *descriptor_version); -+void grub_efi_memory_fini (void); - grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle); - void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp); - char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp); -@@ -83,6 +92,11 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, - - #if defined(__arm__) || defined(__aarch64__) - void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); -+grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); -+#include -+grub_err_t grub_armxx_efi_linux_check_image(struct linux_armxx_kernel_header *lh); -+grub_err_t grub_armxx_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, -+ char *args); - #endif - - grub_addr_t grub_efi_modules_addr (void); -diff --git a/include/grub/arm64/fdtload.h b/include/grub/efi/fdtload.h -similarity index 89% -rename from include/grub/arm64/fdtload.h -rename to include/grub/efi/fdtload.h -index 7b9ddba916d9980fbad51e7b02d99f0737ebc3fa..713c9424d0a9ebe47b1923a247e691566842b2d0 100644 ---- a/include/grub/arm64/fdtload.h -+++ b/include/grub/efi/fdtload.h -@@ -29,7 +29,4 @@ grub_fdt_unload (void); - grub_err_t - grub_fdt_install (void); - --#define GRUB_EFI_PAGE_SHIFT 12 --#define GRUB_EFI_BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> GRUB_EFI_PAGE_SHIFT) -- - #endif -diff --git a/include/grub/efi/memory.h b/include/grub/efi/memory.h -index 20526b14676de9295d17968f5ddc837a06bc56b6..08fe62277839dde3434e506cde78174f1977e9c9 100644 ---- a/include/grub/efi/memory.h -+++ b/include/grub/efi/memory.h -@@ -22,6 +22,13 @@ - #include - #include - -+/* The term "page" in UEFI refers only to a 4 KiB-aligned 4 KiB size region of -+ memory. It is not concerned with underlying translation management concepts, -+ but only used as the granule for memory allocations. */ -+#define GRUB_EFI_PAGE_SHIFT 12 -+#define GRUB_EFI_PAGE_SIZE (1 << GRUB_EFI_PAGE_SHIFT) -+#define GRUB_EFI_BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> GRUB_EFI_PAGE_SHIFT) -+ - #define GRUB_MMAP_REGISTER_BY_FIRMWARE 1 - - grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size, -diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index f79c36c026e0a518b3f9edaca36251d6d4943757..7d44732d2c353b74271262a1cf094d4aafd8dd10 100644 ---- a/include/grub/efi/pe32.h -+++ b/include/grub/efi/pe32.h -@@ -45,6 +45,8 @@ - - #define GRUB_PE32_MSDOS_STUB_SIZE 0x80 - -+#define GRUB_PE32_MAGIC 0x5a4d -+ - /* According to the spec, the minimal alignment is 512 bytes... - But some examples (such as EFI drivers in the Intel - Sample Implementation) use 32 bytes (0x20) instead, and it seems -diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h -index 9b6b729f4ccde7274678b1324c16c9f6854477a2..36d2dedf47e4346b86f17882dc554207201b6401 100644 ---- a/include/grub/efiemu/runtime.h -+++ b/include/grub/efiemu/runtime.h -@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel - - struct efi_variable - { -- grub_efi_guid_t guid; -+ grub_efi_packed_guid_t guid; - grub_uint32_t namelen; - grub_uint32_t size; - grub_efi_uint32_t attributes; -diff --git a/include/grub/fat.h b/include/grub/fat.h -index 4a5aab7934652cfde20c6fb291e00c29170b8753..8d7e4a1e54d644e6d70bb249802c699d5092728e 100644 ---- a/include/grub/fat.h -+++ b/include/grub/fat.h -@@ -28,20 +28,15 @@ struct grub_fat_bpb - grub_uint16_t bytes_per_sector; - grub_uint8_t sectors_per_cluster; - grub_uint16_t num_reserved_sectors; -- grub_uint8_t num_fats; -- /* 0x10 */ -+ grub_uint8_t num_fats; /* 0x10 */ - grub_uint16_t num_root_entries; - grub_uint16_t num_total_sectors_16; -- grub_uint8_t media; -- /*0 x15 */ -+ grub_uint8_t media; /* 0x15 */ - grub_uint16_t sectors_per_fat_16; -- grub_uint16_t sectors_per_track; -- /*0 x19 */ -- grub_uint16_t num_heads; -- /*0 x1b */ -- grub_uint32_t num_hidden_sectors; -- /* 0x1f */ -- grub_uint32_t num_total_sectors_32; -+ grub_uint16_t sectors_per_track; /* 0x18 */ -+ grub_uint16_t num_heads; /* 0x1A */ -+ grub_uint32_t num_hidden_sectors; /* 0x1C */ -+ grub_uint32_t num_total_sectors_32; /* 0x20 */ - union - { - struct -diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index fdfca75bf487f17e8621fee5d1642f4874a2bf16..158b1bc4b3ad8bac60860e298b816781d6c57090 100644 ---- a/include/grub/fdt.h -+++ b/include/grub/fdt.h -@@ -20,6 +20,7 @@ - #define GRUB_FDT_HEADER 1 - - #include -+#include - - #define FDT_MAGIC 0xD00DFEED - -@@ -49,6 +50,11 @@ struct grub_fdt_empty_tree { - - #define GRUB_FDT_EMPTY_TREE_SZ sizeof (struct grub_fdt_empty_tree) - -+/* Size needed by a property entry: 1 token (FDT_PROPERTY), plus len and nameoff -+ fields, plus the property value, plus padding if needed. */ -+#define grub_fdt_prop_entry_size(prop_len) \ -+ (3 * sizeof(grub_uint32_t) + ALIGN_UP(prop_len, sizeof(grub_uint32_t))) -+ - #define grub_fdt_get_header(fdt, field) \ - grub_be_to_cpu32(((const grub_fdt_header_t *)(fdt))->field) - #define grub_fdt_set_header(fdt, field, value) \ -@@ -95,16 +101,22 @@ struct grub_fdt_empty_tree { - #define grub_fdt_set_size_dt_struct(fdt, value) \ - grub_fdt_set_header(fdt, size_dt_struct, value) - --int grub_fdt_create_empty_tree (void *fdt, unsigned int size); --int grub_fdt_check_header (void *fdt, unsigned int size); --int grub_fdt_check_header_nosize (void *fdt); --int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset, -- const char *name); --int grub_fdt_add_subnode (void *fdt, unsigned int parentoffset, -+int EXPORT_FUNC(grub_fdt_create_empty_tree) (void *fdt, unsigned int size); -+int EXPORT_FUNC(grub_fdt_check_header) (const void *fdt, unsigned int size); -+int EXPORT_FUNC(grub_fdt_check_header_nosize) (const void *fdt); -+int EXPORT_FUNC(grub_fdt_find_subnode) (const void *fdt, unsigned int parentoffset, -+ const char *name); -+int EXPORT_FUNC(grub_fdt_first_node) (const void *fdt, unsigned int parentoffset); -+int EXPORT_FUNC(grub_fdt_next_node) (const void *fdt, unsigned int currentoffset); -+int EXPORT_FUNC(grub_fdt_add_subnode) (void *fdt, unsigned int parentoffset, - const char *name); -+const char * -+EXPORT_FUNC(grub_fdt_get_nodename) (const void *fdt, unsigned int nodeoffset); -+const void *EXPORT_FUNC(grub_fdt_get_prop) (const void *fdt, unsigned int nodeoffset, const char *name, -+ grub_uint32_t *len); - --int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name, -- const void *val, grub_uint32_t len); -+int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const char *name, -+ const void *val, grub_uint32_t len); - #define grub_fdt_set_prop32(fdt, nodeoffset, name, val) \ - ({ \ - grub_uint32_t _val = grub_cpu_to_be32(val); \ -diff --git a/include/grub/fdtbus.h b/include/grub/fdtbus.h -new file mode 100644 -index 0000000000000000000000000000000000000000..f519c40ec35faea9aeedca055164012d9d9b3fb5 ---- /dev/null -+++ b/include/grub/fdtbus.h -@@ -0,0 +1,89 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_FDTBUS_HEADER -+#define GRUB_FDTBUS_HEADER 1 -+ -+#include -+#include -+ -+struct grub_fdtbus_dev -+{ -+ struct grub_fdtbus_dev *next; -+ struct grub_fdtbus_dev *parent; -+ int node; -+ struct grub_fdtbus_driver *driver; -+}; -+ -+struct grub_fdtbus_driver -+{ -+ struct grub_fdtbus_driver *next; -+ struct grub_fdtbus_driver **prev; -+ -+ const char *compatible; -+ -+ grub_err_t (*attach) (const struct grub_fdtbus_dev *dev); -+ void (*detach) (const struct grub_fdtbus_dev *dev); -+ -+ /* Message bus operations. */ -+ grub_err_t (*send) (const struct grub_fdtbus_dev *dev, const void *data, grub_size_t sz); -+ grub_err_t (*receive) (const struct grub_fdtbus_dev *dev, void *data, grub_size_t sz); -+ grub_err_t (*start) (const struct grub_fdtbus_dev *dev); -+ void (*stop) (const struct grub_fdtbus_dev *dev); -+}; -+ -+extern char EXPORT_VAR(grub_fdtbus_invalid_mapping)[1]; -+ -+static inline int -+grub_fdtbus_is_mapping_valid (volatile void *m) -+{ -+ return m != grub_fdtbus_invalid_mapping; -+} -+ -+volatile void * -+EXPORT_FUNC(grub_fdtbus_map_reg) (const struct grub_fdtbus_dev *dev, int reg, grub_size_t *size); -+ -+const void * -+EXPORT_FUNC(grub_fdtbus_get_fdt) (void); -+ -+const char * -+EXPORT_FUNC(grub_fdtbus_get_name) (const struct grub_fdtbus_dev *dev); -+ -+const void * -+EXPORT_FUNC(grub_fdtbus_get_prop) (const struct grub_fdtbus_dev *dev, -+ const char *name, -+ grub_uint32_t *len); -+ -+void -+EXPORT_FUNC(grub_fdtbus_register) (struct grub_fdtbus_driver *driver); -+ -+void -+EXPORT_FUNC(grub_fdtbus_unregister) (struct grub_fdtbus_driver *driver); -+ -+int -+EXPORT_FUNC(grub_fdtbus_is_compatible) (const char *compat_string, -+ const struct grub_fdtbus_dev *dev); -+ -+/* Must be called before any register(). */ -+/* dtb is assumed to be unfreeable and must remain -+ valid for lifetime of GRUB. -+ */ -+void -+grub_fdtbus_init (const void *dtb, grub_size_t size); -+ -+#endif -diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h -index 1b32f6725a498f16941991771efe6a7a04ed6f5e..7a93f43291cce490cbaecc140ef2e5e0577ae274 100644 ---- a/include/grub/gpt_partition.h -+++ b/include/grub/gpt_partition.h -@@ -22,14 +22,14 @@ - #include - #include - --struct grub_gpt_part_type -+struct grub_gpt_part_guid - { - grub_uint32_t data1; - grub_uint16_t data2; - grub_uint16_t data3; - grub_uint8_t data4[8]; --} __attribute__ ((aligned(8))); --typedef struct grub_gpt_part_type grub_gpt_part_type_t; -+} GRUB_PACKED; -+typedef struct grub_gpt_part_guid grub_gpt_part_guid_t; - - #define GRUB_GPT_PARTITION_TYPE_EMPTY \ - { 0x0, 0x0, 0x0, \ -@@ -70,8 +70,8 @@ struct grub_gpt_header - - struct grub_gpt_partentry - { -- grub_gpt_part_type_t type; -- grub_uint8_t guid[16]; -+ grub_gpt_part_guid_t type; -+ grub_gpt_part_guid_t guid; - grub_uint64_t start; - grub_uint64_t end; - grub_uint64_t attrib; -diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index da0ca3b83cdc7355fc5b9815415ad7fc8732d153..60c7c3b5e660276dc11d23f4a53ccc2f1e5536a5 100644 ---- a/include/grub/i386/linux.h -+++ b/include/grub/i386/linux.h -@@ -16,10 +16,10 @@ - * along with GRUB. If not, see . - */ - --#ifndef GRUB_LINUX_MACHINE_HEADER --#define GRUB_LINUX_MACHINE_HEADER 1 -+#ifndef GRUB_I386_LINUX_HEADER -+#define GRUB_I386_LINUX_HEADER 1 - --#define GRUB_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */ -+#define GRUB_LINUX_I386_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */ - #define GRUB_LINUX_DEFAULT_SETUP_SECTS 4 - #define GRUB_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF - #define GRUB_LINUX_MAX_SETUP_SECTS 64 -@@ -43,6 +43,9 @@ - - #define GRUB_LINUX_CL_MAGIC 0xA33F - -+#define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0) -+#define VIDEO_CAPABILITY_64BIT_BASE (1 << 1) /* Frame buffer base is 64-bit. */ -+ - #ifdef __x86_64__ - - #define GRUB_LINUX_EFI_SIGNATURE \ -@@ -85,7 +88,7 @@ enum - }; - - /* For the Linux/i386 boot protocol version 2.10. */ --struct linux_kernel_header -+struct linux_i386_kernel_header - { - grub_uint8_t code1[0x0020]; - grub_uint16_t cl_magic; /* Magic number 0xA33F */ -@@ -188,8 +191,9 @@ struct linux_kernel_params - grub_uint16_t lfb_pages; /* 32 */ - grub_uint16_t vesa_attrib; /* 34 */ - grub_uint32_t capabilities; /* 36 */ -+ grub_uint32_t ext_lfb_base; /* 3a */ - -- grub_uint8_t padding3[0x40 - 0x3a]; -+ grub_uint8_t padding3[0x40 - 0x3e]; - - grub_uint16_t apm_version; /* 40 */ - grub_uint16_t apm_code_segment; /* 42 */ -@@ -312,4 +316,4 @@ struct linux_kernel_params - } GRUB_PACKED; - #endif /* ! ASM_FILE */ - --#endif /* ! GRUB_LINUX_MACHINE_HEADER */ -+#endif /* ! GRUB_I386_LINUX_HEADER */ -diff --git a/include/grub/i386/multiboot.h b/include/grub/i386/multiboot.h -index 807a1de27f900c8393476736051e20ee1af6717c..0b596fc2060a63f2fd9e1c67cb002279454aebe5 100644 ---- a/include/grub/i386/multiboot.h -+++ b/include/grub/i386/multiboot.h -@@ -19,6 +19,13 @@ - #ifndef GRUB_MULTIBOOT_CPU_HEADER - #define GRUB_MULTIBOOT_CPU_HEADER 1 - -+#define MULTIBOOT2_INITIAL_STATE { .eax = MULTIBOOT2_BOOTLOADER_MAGIC, \ -+ .ecx = 0, \ -+ .edx = 0, \ -+ /* Set esp to some random location in low memory to avoid breaking */ \ -+ /* non-compliant kernels. */ \ -+ .esp = 0x7ff00 \ -+ } - #define MULTIBOOT_INITIAL_STATE { .eax = MULTIBOOT_BOOTLOADER_MAGIC, \ - .ecx = 0, \ - .edx = 0, \ -@@ -28,7 +35,7 @@ - } - #define MULTIBOOT_ENTRY_REGISTER eip - #define MULTIBOOT_MBI_REGISTER ebx --#define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_I386 -+#define MULTIBOOT2_ARCHITECTURE_CURRENT MULTIBOOT2_ARCHITECTURE_I386 - - #ifdef GRUB_MACHINE_EFI - #ifdef __x86_64__ -@@ -36,6 +43,10 @@ - .rcx = 0, \ - .rdx = 0, \ - } -+#define MULTIBOOT2_EFI_INITIAL_STATE { .rax = MULTIBOOT2_BOOTLOADER_MAGIC, \ -+ .rcx = 0, \ -+ .rdx = 0, \ -+ } - #define MULTIBOOT_EFI_ENTRY_REGISTER rip - #define MULTIBOOT_EFI_MBI_REGISTER rbx - #endif -diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 8e425130327e193af1c1e34760e7255c9d6e6223..8868f3a756fe57b90188e25aaba2b203edacde13 100644 ---- a/include/grub/ieee1275/ieee1275.h -+++ b/include/grub/ieee1275/ieee1275.h -@@ -210,7 +210,25 @@ int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle, - int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle, - int index, int r, int g, int b); - int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs); -- -+int EXPORT_FUNC(grub_ieee1275_set_address) (grub_ieee1275_ihandle_t ihandle, -+ grub_uint32_t target, -+ grub_uint32_t lun); -+int EXPORT_FUNC(grub_ieee1275_no_data_command) (grub_ieee1275_ihandle_t ihandle, -+ const void *cmd_addr, -+ grub_ssize_t *result); -+int EXPORT_FUNC(grub_ieee1275_decode_unit4) (grub_ieee1275_ihandle_t ihandle, -+ void *addr, grub_size_t size, -+ grub_uint32_t *phy_lo, -+ grub_uint32_t *phy_hi, -+ grub_uint32_t *lun_lo, -+ grub_uint32_t *lun_hi); -+char *EXPORT_FUNC(grub_ieee1275_encode_uint4) (grub_ieee1275_ihandle_t ihandle, -+ grub_uint32_t phy_lo, -+ grub_uint32_t phy_hi, -+ grub_uint32_t lun_lo, -+ grub_uint32_t lun_hi, -+ grub_size_t *size); -+int EXPORT_FUNC(grub_ieee1275_get_block_size) (grub_ieee1275_ihandle_t ihandle); - - grub_err_t EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size); - -@@ -235,6 +253,8 @@ void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *al - void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath, - struct grub_ieee1275_devalias *alias); - -+char *EXPORT_FUNC(grub_ieee1275_get_boot_dev) (void); -+ - #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));) - - #define FOR_IEEE1275_DEVCHILDREN(devpath, alias) for (grub_ieee1275_children_first ((devpath), &(alias)); \ -diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index 20ddf2da297d5c883ed5b5542f2cfd99ee9c18da..ecd88ca72c6dea39be9f046463e7c51c874cb351 100644 ---- a/include/grub/kernel.h -+++ b/include/grub/kernel.h -@@ -28,7 +28,8 @@ enum - OBJ_TYPE_MEMDISK, - OBJ_TYPE_CONFIG, - OBJ_TYPE_PREFIX, -- OBJ_TYPE_PUBKEY -+ OBJ_TYPE_PUBKEY, -+ OBJ_TYPE_DTB - }; - - /* The module header. */ -diff --git a/include/grub/mips/multiboot.h b/include/grub/mips/multiboot.h -index 4aebf29e73240b575bb90c699fd02e8185ab5171..cdfb41e315af4aa22d549f76fb0131835abd957e 100644 ---- a/include/grub/mips/multiboot.h -+++ b/include/grub/mips/multiboot.h -@@ -19,11 +19,11 @@ - #ifndef GRUB_MULTIBOOT_CPU_HEADER - #define GRUB_MULTIBOOT_CPU_HEADER 1 - --#define MULTIBOOT_INITIAL_STATE { .gpr[4] = MULTIBOOT_BOOTLOADER_MAGIC, \ -+#define MULTIBOOT2_INITIAL_STATE { .gpr[4] = MULTIBOOT2_BOOTLOADER_MAGIC, \ - .jumpreg = 1 } - #define MULTIBOOT_ENTRY_REGISTER gpr[1] - #define MULTIBOOT_MBI_REGISTER gpr[5] --#define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_MIPS32 -+#define MULTIBOOT2_ARCHITECTURE_CURRENT MULTIBOOT2_ARCHITECTURE_MIPS32 - - #define MULTIBOOT_ELF32_MACHINE EM_MIPS - #define MULTIBOOT_ELF64_MACHINE EM_MIPS -diff --git a/include/grub/misc.h b/include/grub/misc.h -index 2a9f87cc255eda94476733513807ec757c6d9cd9..372f009e84f12a58c3185dda63216bab7325be8f 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -396,7 +396,8 @@ grub_abs (int x) - } - - /* Reboot the machine. */ --#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS) -+#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS) || \ -+ defined (GRUB_MACHINE_EFI) - void EXPORT_FUNC(grub_reboot) (void) __attribute__ ((noreturn)); - #else - void grub_reboot (void) __attribute__ ((noreturn)); -diff --git a/include/grub/multiboot.h b/include/grub/multiboot.h -index c96492bb5fa771831a62d4ab1bac3798328093f0..bd0a9873e6c158f77190c38546007c544cb0d6c9 100644 ---- a/include/grub/multiboot.h -+++ b/include/grub/multiboot.h -@@ -22,19 +22,11 @@ - - #include - --#ifdef GRUB_USE_MULTIBOOT2 --#include --/* Same thing as far as our loader is concerned. */ --#define MULTIBOOT_BOOTLOADER_MAGIC MULTIBOOT2_BOOTLOADER_MAGIC --#define MULTIBOOT_HEADER_MAGIC MULTIBOOT2_HEADER_MAGIC --#else - #include --#endif - - #include - #include - --#ifndef GRUB_USE_MULTIBOOT2 - typedef enum - { - GRUB_MULTIBOOT_QUIRKS_NONE = 0, -@@ -42,7 +34,6 @@ typedef enum - GRUB_MULTIBOOT_QUIRK_MODULES_AFTER_KERNEL = 2 - } grub_multiboot_quirks_t; - extern grub_multiboot_quirks_t grub_multiboot_quirks; --#endif - - extern struct grub_relocator *grub_multiboot_relocator; - -@@ -60,7 +51,7 @@ void - grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize, - unsigned shndx, void *data); - --grub_uint32_t grub_get_multiboot_mmap_count (void); -+grub_uint32_t grub_multiboot_get_mmap_count (void); - grub_err_t grub_multiboot_set_video_mode (void); - - /* FIXME: support coreboot as well. */ -diff --git a/include/grub/multiboot2.h b/include/grub/multiboot2.h -new file mode 100644 -index 0000000000000000000000000000000000000000..502d34ef18045e898680f2198522139c3066b587 ---- /dev/null -+++ b/include/grub/multiboot2.h -@@ -0,0 +1,104 @@ -+/* multiboot.h - multiboot header file with grub definitions. */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2003,2007,2008,2010 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_MULTIBOOT2_HEADER -+#define GRUB_MULTIBOOT2_HEADER 1 -+ -+#include -+ -+#include -+ -+#include -+#include -+ -+extern struct grub_relocator *grub_multiboot2_relocator; -+ -+void grub_multiboot2 (int argc, char *argv[]); -+void grub_module2 (int argc, char *argv[]); -+ -+void grub_multiboot2_set_accepts_video (int val); -+grub_err_t grub_multiboot2_make_mbi (grub_uint32_t *target); -+void grub_multiboot2_free_mbi (void); -+grub_err_t grub_multiboot2_init_mbi (int argc, char *argv[]); -+grub_err_t grub_multiboot2_add_module (grub_addr_t start, grub_size_t size, -+ int argc, char *argv[]); -+void grub_multiboot2_set_bootdev (void); -+void -+grub_multiboot2_add_elfsyms (grub_size_t num, grub_size_t entsize, -+ unsigned shndx, void *data); -+ -+grub_uint32_t grub_multiboot2_get_mmap_count (void); -+grub_err_t grub_multiboot2_set_video_mode (void); -+ -+/* FIXME: support coreboot as well. */ -+#if defined (GRUB_MACHINE_PCBIOS) -+#define GRUB_MACHINE_HAS_VBE 1 -+#else -+#define GRUB_MACHINE_HAS_VBE 0 -+#endif -+ -+#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU) -+#define GRUB_MACHINE_HAS_VGA_TEXT 1 -+#else -+#define GRUB_MACHINE_HAS_VGA_TEXT 0 -+#endif -+ -+#if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) -+#define GRUB_MACHINE_HAS_ACPI 1 -+#else -+#define GRUB_MACHINE_HAS_ACPI 0 -+#endif -+ -+#define GRUB_MULTIBOOT2_CONSOLE_EGA_TEXT 1 -+#define GRUB_MULTIBOOT2_CONSOLE_FRAMEBUFFER 2 -+ -+grub_err_t -+grub_multiboot2_set_console (int console_type, int accepted_consoles, -+ int width, int height, int depth, -+ int console_required); -+grub_err_t -+grub_multiboot2_load (grub_file_t file, const char *filename); -+ -+struct mbi_load_data -+{ -+ grub_file_t file; -+ const char *filename; -+ void *buffer; -+ unsigned int mbi_ver; -+ int relocatable; -+ grub_uint32_t min_addr; -+ grub_uint32_t max_addr; -+ grub_size_t align; -+ grub_uint32_t preference; -+ grub_uint32_t link_base_addr; -+ grub_uint32_t load_base_addr; -+ int avoid_efi_boot_services; -+}; -+typedef struct mbi_load_data mbi_load_data_t; -+ -+/* Load ELF32 or ELF64. */ -+grub_err_t -+grub_multiboot2_load_elf (mbi_load_data_t *mld); -+ -+extern grub_size_t grub_multiboot2_pure_size; -+extern grub_size_t grub_multiboot2_alloc_mbi; -+extern grub_uint32_t grub_multiboot2_payload_eip; -+ -+ -+#endif /* ! GRUB_MULTIBOOT_HEADER */ -diff --git a/include/grub/net.h b/include/grub/net.h -index 2192fa18628862e8e3a6046d854b12613e914ff9..1096b24322eb1ba36e8c996872fce2a255e6bccc 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -291,6 +291,7 @@ struct grub_net_network_level_interface - grub_net_interface_flags_t flags; - struct grub_net_bootp_packet *dhcp_ack; - grub_size_t dhcp_acklen; -+ grub_uint16_t vlantag; - void *data; - }; - -@@ -561,4 +562,6 @@ extern char *grub_net_default_server; - #define GRUB_NET_INTERVAL 400 - #define GRUB_NET_INTERVAL_ADDITION 20 - -+#define VLANTAG_IDENTIFIER 0x8100 -+ - #endif /* ! GRUB_NET_HEADER */ -diff --git a/include/grub/net/arp.h b/include/grub/net/arp.h -index bb1703622e1529479618e7f71b0d5e88adb631d1..8d9d081134f52e2d33c23928baae7f6b4c08470f 100644 ---- a/include/grub/net/arp.h -+++ b/include/grub/net/arp.h -@@ -22,10 +22,11 @@ - #include - - extern grub_err_t grub_net_arp_receive (struct grub_net_buff *nb, -- struct grub_net_card *card); -+ struct grub_net_card *card, -+ grub_uint16_t *vlantag); - - grub_err_t - grub_net_arp_send_request (struct grub_net_network_level_interface *inf, -- const grub_net_network_level_address_t *proto_addr); -+ const grub_net_network_level_address_t *proto_addr); - - #endif -diff --git a/include/grub/net/ip.h b/include/grub/net/ip.h -index dcceaa56894605a39f87858964da7af11951ff11..ab9d68f98252b9772853a712ff1e8556162002ee 100644 ---- a/include/grub/net/ip.h -+++ b/include/grub/net/ip.h -@@ -48,7 +48,8 @@ grub_err_t - grub_net_recv_ip_packets (struct grub_net_buff *nb, - struct grub_net_card *card, - const grub_net_link_level_address_t *hwaddress, -- const grub_net_link_level_address_t *src_hwaddress); -+ const grub_net_link_level_address_t *src_hwaddress, -+ grub_uint16_t *vlantag); - - grub_err_t - grub_net_send_ip_packet (struct grub_net_network_level_interface *inf, -diff --git a/include/grub/offsets.h b/include/grub/offsets.h -index c88c86d4d2ebddddb23f25c50ad2c29b52e54ccb..330e4c70738abcacc3c1d53fb16ae1ec8896d9e3 100644 ---- a/include/grub/offsets.h -+++ b/include/grub/offsets.h -@@ -50,7 +50,7 @@ - /* The offset of GRUB_CORE_ENTRY_ADDR. */ - #define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR 0x8 - --#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200 -+#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x9000 - - /* The offset of GRUB_TOTAL_MODULE_SIZE. */ - #define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8 -@@ -91,7 +91,7 @@ - - #define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08 - --#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200 -+#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x9000 - #define GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR 0x100000 - - #define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000 -@@ -122,6 +122,12 @@ - #define GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN 0x8 - #define GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE 0x4 - -+#define GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN 0x8 -+#define GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE 0x4 -+ -+#define GRUB_KERNEL_ARM_STACK_SIZE 0x40000 -+#define GRUB_KERNEL_ARM_COREBOOT_MOD_GAP (GRUB_KERNEL_ARM_STACK_SIZE + 1024) -+ - /* Minimal gap between _end and the start of the modules. It's a hack - for PowerMac to prevent "CLAIM failed" error. The real fix is to - rewrite grub-mkimage to generate valid ELF files. */ -diff --git a/include/grub/pci.h b/include/grub/pci.h -index 70d9a05131b240bbe3c7fe12df899c8e3de237ce..262c89b748bbfccc98ffa27912ce7e2a5005f545 100644 ---- a/include/grub/pci.h -+++ b/include/grub/pci.h -@@ -142,27 +142,7 @@ grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (grub_pci_device_t dev, - void EXPORT_FUNC(grub_pci_iterate) (grub_pci_iteratefunc_t hook, - void *hook_data); - --struct grub_pci_dma_chunk; -- --struct grub_pci_dma_chunk *EXPORT_FUNC(grub_memalign_dma32) (grub_size_t align, -- grub_size_t size); --void EXPORT_FUNC(grub_dma_free) (struct grub_pci_dma_chunk *ch); --volatile void *EXPORT_FUNC(grub_dma_get_virt) (struct grub_pci_dma_chunk *ch); --grub_uint32_t EXPORT_FUNC(grub_dma_get_phys) (struct grub_pci_dma_chunk *ch); -- --static inline void * --grub_dma_phys2virt (grub_uint32_t phys, struct grub_pci_dma_chunk *chunk) --{ -- return ((grub_uint8_t *) grub_dma_get_virt (chunk) -- + (phys - grub_dma_get_phys (chunk))); --} -- --static inline grub_uint32_t --grub_dma_virt2phys (volatile void *virt, struct grub_pci_dma_chunk *chunk) --{ -- return (((grub_uint8_t *) virt - (grub_uint8_t *) grub_dma_get_virt (chunk)) -- + grub_dma_get_phys (chunk)); --} -+#include - - grub_uint8_t - EXPORT_FUNC (grub_pci_find_capability) (grub_pci_device_t dev, grub_uint8_t cap); -diff --git a/include/grub/ps2.h b/include/grub/ps2.h -new file mode 100644 -index 0000000000000000000000000000000000000000..4f2e527e49767c297646f1ea3d0e09bdc2855892 ---- /dev/null -+++ b/include/grub/ps2.h -@@ -0,0 +1,43 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_PS2_HEADER -+#define GRUB_PS2_HEADER 1 -+ -+#include -+ -+#define GRUB_AT_ACK 0xfa -+#define GRUB_AT_NACK 0xfe -+#define GRUB_AT_TRIES 5 -+ -+/* Make sure it's zeroed-out and set current_set at init. */ -+struct grub_ps2_state -+{ -+ int e0_received; -+ int f0_received; -+ grub_uint8_t led_status; -+ short at_keyboard_status; -+ grub_uint8_t current_set; -+}; -+ -+/* If there is a key pending, return it; otherwise return GRUB_TERM_NO_KEY. */ -+int -+grub_ps2_process_incoming_byte (struct grub_ps2_state *ps2_state, -+ grub_uint8_t data); -+ -+#endif -diff --git a/include/grub/sparc64/ieee1275/ieee1275.h b/include/grub/sparc64/ieee1275/ieee1275.h -index 32c77f80f1a136c0127aecb6d5643ebd64cb5e88..4b18468d8d654bb3fe62050e7a4f439e1544889c 100644 ---- a/include/grub/sparc64/ieee1275/ieee1275.h -+++ b/include/grub/sparc64/ieee1275/ieee1275.h -@@ -42,6 +42,8 @@ extern int EXPORT_FUNC(grub_ieee1275_claim_vaddr) (grub_addr_t vaddr, - extern int EXPORT_FUNC(grub_ieee1275_alloc_physmem) (grub_addr_t *paddr, - grub_size_t size, - grub_uint32_t align); -+extern grub_uint64_t EXPORT_FUNC(grub_ieee1275_num_blocks) (grub_uint32_t ihandle); -+extern grub_uint64_t EXPORT_FUNC(grub_ieee1275_num_blocks64) (grub_uint32_t ihandle); - - extern grub_addr_t EXPORT_VAR (grub_ieee1275_original_stack); - -diff --git a/include/grub/term.h b/include/grub/term.h -index 5ffb38f69aaa8911a66bdc6f417a72666b19e514..8117e2a24dac3f270d05408f1897fae9f0fa1593 100644 ---- a/include/grub/term.h -+++ b/include/grub/term.h -@@ -55,7 +55,8 @@ - #define GRUB_TERM_KEY_INSERT (GRUB_TERM_EXTENDED | 0x52) - #define GRUB_TERM_KEY_CENTER (GRUB_TERM_EXTENDED | 0x4c) - --#define GRUB_TERM_ESC '\e' -+/* Hex value is used for ESC, since '\e' is nonstandard */ -+#define GRUB_TERM_ESC 0x1b - #define GRUB_TERM_TAB '\t' - #define GRUB_TERM_BACKSPACE '\b' - -diff --git a/include/grub/usb.h b/include/grub/usb.h -index 11d96481ff6b58cc43f468bcb2020475663fa098..512ae1dd0e64931c852847c9d52efdbd6b2caccb 100644 ---- a/include/grub/usb.h -+++ b/include/grub/usb.h -@@ -321,5 +321,9 @@ grub_usb_err_t - grub_usb_check_transfer (grub_usb_transfer_t trans, grub_size_t *actual); - void - grub_usb_cancel_transfer (grub_usb_transfer_t trans); -+void -+grub_ehci_init_device (volatile void *regs); -+void -+grub_ehci_pci_scan (void); - - #endif /* GRUB_USB_H */ -diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index 5ca4811cd130f6810f07e6fbce89af1de36827c7..0dba8b67f93d44f875f2d1065ed5bf745f7813a5 100644 ---- a/include/grub/util/install.h -+++ b/include/grub/util/install.h -@@ -29,6 +29,8 @@ - #define GRUB_INSTALL_OPTIONS \ - { "modules", GRUB_INSTALL_OPTIONS_MODULES, N_("MODULES"), \ - 0, N_("pre-load specified modules MODULES"), 1 }, \ -+ { "dtb", GRUB_INSTALL_OPTIONS_DTB, N_("FILE"), \ -+ 0, N_("embed a specific DTB"), 1 }, \ - { "install-modules", GRUB_INSTALL_OPTIONS_INSTALL_MODULES, \ - N_("MODULES"), 0, \ - N_("install only MODULES and their dependencies [default=all]"), 1 }, \ -@@ -99,6 +101,7 @@ enum grub_install_plat - GRUB_INSTALL_PLATFORM_I386_XEN, - GRUB_INSTALL_PLATFORM_X86_64_XEN, - GRUB_INSTALL_PLATFORM_ARM64_EFI, -+ GRUB_INSTALL_PLATFORM_ARM_COREBOOT, - GRUB_INSTALL_PLATFORM_MAX - }; - -@@ -115,7 +118,8 @@ enum grub_install_options { - GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, - GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, - GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, -- GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS -+ GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, -+ GRUB_INSTALL_OPTIONS_DTB - }; - - extern char *grub_install_source_directory; -@@ -176,7 +180,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - char *config_path, - const struct grub_install_image_target_desc *image_target, - int note, -- grub_compression_t comp); -+ grub_compression_t comp, const char *dtb_file); - - const struct grub_install_image_target_desc * - grub_install_get_image_target (const char *arg); -@@ -206,7 +210,7 @@ grub_install_create_envblk_file (const char *name); - const char * - grub_install_get_default_x86_platform (void); - --void -+int - grub_install_register_efi (grub_device_t efidir_grub_dev, - const char *efifile_path, - const char *efi_distributor); -diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h -index 1a18708a89c6e5503dd29b0b76f5098cef3ac893..b3a5ca132bc4d336f8d85158726bcce77fd7cd37 100644 ---- a/include/grub/util/mkimage.h -+++ b/include/grub/util/mkimage.h -@@ -51,13 +51,13 @@ grub_mkimage_load_image64 (const char *kernel_path, - void - grub_mkimage_generate_elf32 (const struct grub_install_image_target_desc *image_target, - int note, char **core_img, size_t *core_size, -- Elf32_Addr target_addr, grub_size_t align, -- size_t kernel_size, size_t bss_size); -+ Elf32_Addr target_addr, -+ struct grub_mkimage_layout *layout); - void - grub_mkimage_generate_elf64 (const struct grub_install_image_target_desc *image_target, - int note, char **core_img, size_t *core_size, -- Elf64_Addr target_addr, grub_size_t align, -- size_t kernel_size, size_t bss_size); -+ Elf64_Addr target_addr, -+ struct grub_mkimage_layout *layout); - - struct grub_install_image_target_desc - { -diff --git a/include/multiboot2.h b/include/multiboot2.h -index 5a3db5a7cae38c26be516dc76a4fa6a9ad4ed354..5693923c014f2fa9e855dcc89c7328a19e0e6408 100644 ---- a/include/multiboot2.h -+++ b/include/multiboot2.h -@@ -75,8 +75,8 @@ - #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9 - #define MULTIBOOT_HEADER_TAG_RELOCATABLE 10 - --#define MULTIBOOT_ARCHITECTURE_I386 0 --#define MULTIBOOT_ARCHITECTURE_MIPS32 4 -+#define MULTIBOOT2_ARCHITECTURE_I386 0 -+#define MULTIBOOT2_ARCHITECTURE_MIPS32 4 - #define MULTIBOOT_HEADER_TAG_OPTIONAL 1 - - #define MULTIBOOT_LOAD_PREFERENCE_NONE 0 -diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S -index 1ee4cf5b2e0fd03ba177e953fafdaf5e0ca457a6..c1addc0df29bc78009238690a9514ea301bf3a29 100644 ---- a/grub-core/boot/i386/pc/diskboot.S -+++ b/grub-core/boot/i386/pc/diskboot.S -@@ -37,8 +37,8 @@ - start: - _start: - /* -- * _start is loaded at 0x2000 and is jumped to with -- * CS:IP 0:0x2000 in kernel. -+ * _start is loaded at 0x8000 and is jumped to with -+ * CS:IP 0:0x8000 in kernel. - */ - - /* -diff --git a/grub-core/boot/sparc64/ieee1275/boot.S b/grub-core/boot/sparc64/ieee1275/boot.S -index 586efb4014e8648e560fb43eee8eea8b09da669b..9ea9b4e06627bbd8b7da422ffba3357b4fba0a6a 100644 ---- a/grub-core/boot/sparc64/ieee1275/boot.S -+++ b/grub-core/boot/sparc64/ieee1275/boot.S -@@ -69,6 +69,10 @@ prom_seek_name: .asciz "seek" - prom_read_name: .asciz "read" - prom_exit_name: .asciz "exit" - grub_name: .asciz "GRUB " -+#ifdef CDBOOT -+prom_close_name: .asciz "close" -+#endif -+ - #define GRUB_NAME_LEN 5 - - .align 4 -@@ -213,6 +217,12 @@ bootpath_known: - call prom_call_3_1_o1 - #ifdef CDBOOT - LDUW_ABS(kernel_size, 0x00, %o3) -+ -+ GET_ABS(prom_close_name, %o0) -+ mov 1, %g1 -+ mov 0, %o5 -+ call prom_call -+ mov BOOTDEV_REG, %o1 - #else - mov 512, %o3 - #endif -diff --git a/grub-core/kern/arm/cache_armv7.S b/grub-core/kern/arm/cache_armv7.S -index 1ef2754af8a7612c35c26011fab442dbba074dfd..5ae76a3d819c002676f54db3311f517791e0c4e8 100644 ---- a/grub-core/kern/arm/cache_armv7.S -+++ b/grub-core/kern/arm/cache_armv7.S -@@ -33,6 +33,18 @@ - # define ISB isb - #define ARMV7 1 - -+FUNCTION(grub_arm_clean_dcache_range_poc_armv7) -+ DSB -+ @ Clean data cache for range to point-of-coherence -+1: cmp r0, r1 -+ bge 2f -+ mcr p15, 0, r0, c7, c14, 1 @ DCCMVAC -+ add r0, r0, r2 @ Next line -+ b 1b -+2: DSB -+ bx lr -+ -+ - @ r0 - CLIDR - @ r1 - LoC - @ r2 - current level -diff --git a/include/grub/arm/efi/loader.h b/grub-core/kern/arm/coreboot/coreboot.S -similarity index 62% -rename from include/grub/arm/efi/loader.h -rename to grub-core/kern/arm/coreboot/coreboot.S -index 4bab18e83ee833d6932fea917d839fe7dcc212d1..a1104526c154bd5a9dfd9e3680d8bb787c1088ef 100644 ---- a/include/grub/arm/efi/loader.h -+++ b/grub-core/kern/arm/coreboot/coreboot.S -@@ -1,6 +1,6 @@ - /* - * GRUB -- GRand Unified Bootloader -- * Copyright (C) 2013 Free Software Foundation, Inc. -+ * Copyright (C) 2016 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by -@@ -16,11 +16,29 @@ - * along with GRUB. If not, see . - */ - --#ifndef GRUB_LOADER_MACHINE_HEADER --#define GRUB_LOADER_MACHINE_HEADER 1 -+#include - --grub_err_t EXPORT_FUNC (grub_efi_prepare_platform) (void); --void * EXPORT_FUNC (grub_efi_allocate_loader_memory) (grub_uint32_t min_offset, -- grub_uint32_t size); -+ .file "coreboot.S" -+ .text -+ .syntax unified -+#if !defined (__thumb2__) -+ .arch armv7a -+ .arm -+#else -+ .arch armv7 -+ .thumb -+#endif -+ -+FUNCTION(grub_arm_pfr1) -+ mrc p15, 0, r0, c0, c1, 1 -+ bx lr -+ -+FUNCTION(grub_armv7_get_timer_value) -+ isb -+ mrrc p15, 1, r0, r1, c14 -+ bx lr -+ -+FUNCTION(grub_armv7_get_timer_frequency) -+ mrc p15, 0, r0, c14, c0, 0 -+ bx lr - --#endif /* ! GRUB_LOADER_MACHINE_HEADER */ -diff --git a/grub-core/kern/arm/uboot/startup.S b/grub-core/kern/arm/startup.S -similarity index 77% -rename from grub-core/kern/arm/uboot/startup.S -rename to grub-core/kern/arm/startup.S -index 5efaae16e838b48dd4d9a5debfc2937a558c65ba..3946fe8e183023f80e3a90ae4ee7b942f02f204d 100644 ---- a/grub-core/kern/arm/uboot/startup.S -+++ b/grub-core/kern/arm/startup.S -@@ -24,6 +24,7 @@ - * GRUB is called from U-Boot as a Linux Kernel type image, which - * means among other things that it always enters in ARM state. - * -+ * coreboot starts in ARM mode as well. - * - * Overview of GRUB image layout: - * -@@ -86,7 +87,7 @@ FUNCTION(codestart) - @ Stack pointer used as start address for signature probing - mov r12, sp - adr sp, entry_state -- push {r1-r12,lr} @ store U-Boot context (sp in r12) -+ push {r0-r12,lr} @ store U-Boot context (sp in r12) - - adr r1, _start - ldr r0, bss_start_ptr @ src -@@ -127,6 +128,8 @@ reloc_done: - - str r1, EXT_C(grub_modbase) - -+ /* Coreboot already places modules at right place. */ -+#ifndef GRUB_MACHINE_COREBOOT - add r1, r1, r2 - add r0, r0, r2 - sub r1, r1, #4 -@@ -136,6 +139,7 @@ reloc_done: - str r3, [r1], #-4 @ *dst-- = r3 - subs r2, #4 @ remaining -= 4 - bne 1b @ while remaining != 0 -+#endif - - @ Since we _are_ the C run-time, we need to manually zero the BSS - @ region before continuing -@@ -153,69 +157,21 @@ reloc_done: - - b EXT_C(grub_main) - -- /* -- * uboot_syscall(): -- * This function is effectively a veneer, so it cannot -- * modify the stack or corrupt any registers other than -- * r12 (ip). Furthermore it needs to restore r8 for -- * U-Boot (Global Data Pointer) and preserve it for Grub. -- */ --FUNCTION(grub_uboot_syscall) -- str r8, transition_space -- str lr, transition_space + 4 -- str r9, transition_space + 8 -- -- ldr r8, gd_backup -- ldr r9, gd_backup + 4 -- -- bl do_syscall -- -- ldr r8, transition_space -- ldr lr, transition_space + 4 -- ldr r9, transition_space + 8 -- -- bx lr --do_syscall: -- -- ldr ip, grub_uboot_syscall_ptr -- bx ip -- --FUNCTION(grub_uboot_return) -- adr sp, entry_state_end -- pop {r4-r12, lr} -- mov sp, r12 -- bx lr -- -- - .align 3 --@ U-boot context stack space --entry_state_end: --VARIABLE(grub_uboot_machine_type) -+@ U-boot/coreboot context stack space -+VARIABLE(grub_arm_saved_registers) -+ .long 0 @ r0 - .long 0 @ r1 --VARIABLE(grub_uboot_boot_data) - .long 0 @ r2 - .long 0 @ r3 - .long 0 @ r4 - .long 0 @ r5 - .long 0 @ r6 - .long 0 @ r7 --gd_backup: -- .long 0 @ r8 - U-Boot global data pointer up to 2013-09-21 -- .long 0 @ r9 - U-Boot global data pointer 2013-09-21 onwards -- .long 0 @ r10 -- .long 0 @ r11 --VARIABLE(grub_uboot_search_hint)@ U-Boot stack pointer - -- .long 0 @ also API signature address hint. -- .long 0 @ lr --entry_state: @ backup for U-Boot context -- --@ GRUB context stack space --transition_space: - .long 0 @ r8 -- .long 0 @ lr - .long 0 @ r9 -- --VARIABLE(grub_uboot_syscall_ptr) -- .long 0 @ -- -- END -+ .long 0 @ r10 -+ .long 0 @ r11 -+ .long 0 @ sp -+ .long 0 @ lr -+entry_state: -diff --git a/grub-core/kern/arm/uboot/uboot.S b/grub-core/kern/arm/uboot/uboot.S -new file mode 100644 -index 0000000000000000000000000000000000000000..d128775f19ea1f862b46bc82b05b453be577d741 ---- /dev/null -+++ b/grub-core/kern/arm/uboot/uboot.S -@@ -0,0 +1,73 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2013 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+ -+ /* -+ * uboot_syscall(): -+ * This function is effectively a veneer, so it cannot -+ * modify the stack or corrupt any registers other than -+ * r12 (ip). Furthermore it needs to restore r8 for -+ * U-Boot (Global Data Pointer) and preserve it for Grub. -+ */ -+FUNCTION(grub_uboot_syscall) -+ str r8, transition_space -+ str lr, transition_space + 4 -+ str r9, transition_space + 8 -+ -+ ldr ip, saved_registers_ptr -+ ldr r8, [ip, #4 * 8] -+ ldr r9, [ip, #4 * 9] -+ -+ bl do_syscall -+ -+ ldr r8, transition_space -+ ldr lr, transition_space + 4 -+ ldr r9, transition_space + 8 -+ -+ bx lr -+do_syscall: -+ -+ ldr ip, grub_uboot_syscall_ptr -+ bx ip -+ -+FUNCTION(grub_uboot_return) -+ ldr ip, saved_registers_ptr -+ ldr sp, [ip, #4 * 4] -+ pop {r4-r12, lr} -+ mov sp, r12 -+ bx lr -+ -+ -+ .align 3 -+ -+@ GRUB context stack space -+transition_space: -+ .long 0 @ r8 -+ .long 0 @ lr -+ .long 0 @ r9 -+ -+saved_registers_ptr: -+ .long EXT_C(grub_arm_saved_registers) -+ -+VARIABLE(grub_uboot_syscall_ptr) -+ .long 0 @ -+ -+ END -diff --git a/conf/Makefile.common b/conf/Makefile.common -index 11296b550a7cd40ded498613620f556d78c67d84..311da61c6c59fed3de8cba06c2c581b217d8273f 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -86,9 +86,11 @@ CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST - CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)' - CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)' - CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)' -+CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)' - CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \ - $(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \ -- $(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST) -+ $(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST) \ -+ $(CPPFLAGS_FDT_LIST) - - # Define these variables to calm down automake - -diff --git a/docs/grub.texi b/docs/grub.texi -index e935af33ea5e24d832e588d1345e3721b826d5a0..2adfa97bee8f8b2dcd53ead368dfd6f115b8cb82 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -360,8 +360,9 @@ blocklist notation. The currently supported filesystem types are @dfn{Amiga - Fast FileSystem (AFFS)}, @dfn{AtheOS fs}, @dfn{BeFS}, - @dfn{BtrFS} (including raid0, raid1, raid10, gzip and lzo), - @dfn{cpio} (little- and big-endian bin, odc and newc variants), --@dfn{Linux ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32}, @dfn{exFAT}, @dfn{HFS}, --@dfn{HFS+}, @dfn{ISO9660} (including Joliet, Rock-ridge and multi-chunk files), -+@dfn{Linux ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32}, -+@dfn{exFAT}, @dfn{F2FS}, @dfn{HFS}, @dfn{HFS+}, -+@dfn{ISO9660} (including Joliet, Rock-ridge and multi-chunk files), - @dfn{JFS}, @dfn{Minix fs} (versions 1, 2 and 3), @dfn{nilfs2}, - @dfn{NTFS} (including compression), @dfn{ReiserFS}, @dfn{ROMFS}, - @dfn{Amiga Smart FileSystem (SFS)}, @dfn{Squash4}, @dfn{tar}, @dfn{UDF}, -@@ -1213,10 +1214,11 @@ GRUB is configured using @file{grub.cfg}, usually located under - need to write the whole thing by hand. - - @menu --* Simple configuration:: Recommended for most users --* Shell-like scripting:: For power users and developers --* Multi-boot manual config:: For non-standard multi-OS scenarios --* Embedded configuration:: Embedding a configuration file into GRUB -+* Simple configuration:: Recommended for most users -+* Root Identifcation Heuristics:: Summary on how the root file system is identified. -+* Shell-like scripting:: For power users and developers -+* Multi-boot manual config:: For non-standard multi-OS scenarios -+* Embedded configuration:: Embedding a configuration file into GRUB - @end menu - - -@@ -1398,6 +1400,25 @@ for all respectively normal entries. - The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX} - and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries. - -+@item GRUB_EARLY_INITRD_LINUX_CUSTOM -+@itemx GRUB_EARLY_INITRD_LINUX_STOCK -+List of space-separated early initrd images to be loaded from @samp{/boot}. -+This is for loading things like CPU microcode, firmware, ACPI tables, crypto -+keys, and so on. These early images will be loaded in the order declared, -+and all will be loaded before the actual functional initrd image. -+ -+@samp{GRUB_EARLY_INITRD_LINUX_STOCK} is for your distribution to declare -+images that are provided by the distribution. It should not be modified -+without understanding the consequences. They will be loaded first. -+ -+@samp{GRUB_EARLY_INITRD_LINUX_CUSTOM} is for your custom created images. -+ -+The default stock images are as follows, though they may be overridden by -+your distribution: -+@example -+intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode.cpio -+@end example -+ - @item GRUB_DISABLE_LINUX_UUID - Normally, @command{grub-mkconfig} will generate menu entries that use - universally-unique identifiers (UUIDs) to identify the root filesystem to -@@ -1405,6 +1426,17 @@ the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is - usually more reliable, but in some cases it may not be appropriate. To - disable the use of UUIDs, set this option to @samp{true}. - -+@item GRUB_DISABLE_LINUX_PARTUUID -+If @command{grub-mkconfig} cannot identify the root filesystem via its -+universally-unique indentifier (UUID), @command{grub-mkconfig} can use the UUID -+of the partition containing the filesystem to identify the root filesystem to -+the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not -+as reliable as using the filesystem UUID, but is more reliable than using the -+Linux device names. When @samp{GRUB_DISABLE_LINUX_PARTUUID} is set to -+@samp{false}, the Linux kernel version must be 2.6.37 (3.10 for systems using -+the MSDOS partition scheme) or newer. This option defaults to @samp{true}. To -+enable the use of partition UUIDs, set this option to @samp{false}. -+ - @item GRUB_DISABLE_RECOVERY - If this option is set to @samp{true}, disable the generation of recovery - mode menu entries. -@@ -1536,6 +1568,53 @@ edit the scripts in @file{/etc/grub.d} directly. - menu entries; simply type the menu entries you want to add at the end of - that file, making sure to leave at least the first two lines intact. - -+@node Root Identifcation Heuristics -+@section Root Identifcation Heuristics -+If the target operating system uses the Linux kernel, @command{grub-mkconfig} -+attempts to identify the root file system via a heuristic algoirthm. This -+algorithm selects the identification method of the root file system by -+considering three factors. The first is if an initrd for the target operating -+system is also present. The second is @samp{GRUB_DISABLE_LINUX_UUID} and if set -+to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file -+system by its UUID. The third is @samp{GRUB_DISABLE_LINUX_PARTUUID} and if set -+to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file -+system via the UUID of its enclosing partition. If the variables are assigned -+any other value, that value is considered equivalent to @samp{false}. The -+variables are also considered to be set to @samp{false} if they are not set. -+ -+When booting, the Linux kernel will delegate the task of mounting the root -+filesystem to the initrd. Most initrd images determine the root file system by -+checking the Linux kernel's command-line for the @samp{root} key and use its -+value as the identification method of the root file system. To improve the -+reliability of booting, most initrd images also allow the root file system to be -+identified by its UUID. Because of this behavior, the @command{grub-mkconfig} -+command will set @samp{root} to @samp{root=UUID=...} to provide the initrd with -+the filesystem UUID of the root file system. -+ -+If no initrd is detected or @samp{GRUB_DISABLE_LINUX_UUID} is set to @samp{true} -+then @command{grub-command} will identify the root filesystem by setting the -+kernel command-line variable @samp{root} to @samp{root=PARTUUID=...} unless -+@samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}. If -+@samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}, -+@command{grub-command} will identify by its Linux device name. -+ -+The following table summarizes the behavior of the @command{grub-mkconfig} -+command. -+ -+@multitable {detected} {GRUB_DISABLE_LINUX_PARTUUID} {GRUB_DISABLE_LINUX_UUID} {Linux Root} -+@headitem Initrd detected @tab GRUB_DISABLE_LINUX_PARTUUID Set To @tab GRUB_DISABLE_LINUX_UUID Set To @tab Linux Root ID Method -+@item false @tab false @tab false @tab part UUID -+@item false @tab false @tab true @tab part UUID -+@item false @tab true @tab false @tab dev name -+@item false @tab true @tab true @tab dev name -+@item true @tab false @tab false @tab fs UUID -+@item true @tab false @tab true @tab part UUID -+@item true @tab true @tab false @tab fs UUID -+@item true @tab true @tab true @tab dev name -+@end multitable -+ -+Remember, @samp{GRUB_DISABLE_LINUX_PARTUUID} and @samp{GRUB_DISABLE_LINUX_UUID} -+are also considered to be set to @samp{false} when they are unset. - - @node Shell-like scripting - @section Writing full configuration files directly -@@ -3873,11 +3952,9 @@ you forget a command, you can run the command @command{help} - @comment * vbeinfo:: List available video modes - * verify_detached:: Verify detached digital signature - * videoinfo:: List available video modes --@comment * xen_*:: Xen boot commands --* xen_hypervisor:: Load xen hypervisor binary --* xen_linux:: Load dom0 kernel for xen hypervisor --* xen_initrd:: Load dom0 initrd for dom0 kernel --* xen_xsm:: Load xen security module for xen hypervisor -+@comment * xen_*:: Xen boot commands for AArch64 -+* xen_hypervisor:: Load xen hypervisor binary (only on AArch64) -+* xen_module:: Load xen modules for xen hypervisor (only on AArch64) - @end menu - - -@@ -4645,7 +4722,7 @@ range 0-0xFF (prefix with @samp{0x} to enter it in hexadecimal). - When enabled, this hides the selected partition by setting the @dfn{hidden} - bit in its partition type code; when disabled, unhides the selected - partition by clearing this bit. This is useful only when booting DOS or --Wwindows and multiple primary FAT partitions exist in one disk. See also -+Windows and multiple primary FAT partitions exist in one disk. See also - @ref{DOS/Windows}. - @end table - @end deffn -@@ -5153,32 +5230,22 @@ List available video modes. If resolution is given, show only matching modes. - Load a Xen hypervisor binary from @var{file}. The rest of the line is passed - verbatim as the @dfn{kernel command-line}. Any other binaries must be - reloaded after using this command. -+This command is only available on AArch64 systems. - @end deffn - --@node xen_linux --@subsection xen_linux -+@node xen_module -+@subsection xen_module - --@deffn Command xen_linux file [arguments] --Load a dom0 kernel image for xen hypervisor at the booting process of xen. -+@deffn Command xen_module [--nounzip] file [arguments] -+Load a module for xen hypervisor at the booting process of xen. - The rest of the line is passed verbatim as the module command line. -+Modules should be loaded in the following order: -+ - dom0 kernel image -+ - dom0 ramdisk if present -+ - XSM policy if present -+This command is only available on AArch64 systems. - @end deffn - --@node xen_initrd --@subsection xen_initrd -- --@deffn Command xen_initrd file --Load a initrd image for dom0 kernel at the booting process of xen. --@end deffn -- --@node xen_xsm --@subsection xen_xsm -- --@deffn Command xen_xsm file --Load a xen security module for xen hypervisor at the booting process of xen. --See @uref{http://wiki.xen.org/wiki/XSM} for more detail. --@end deffn -- -- - @node Networking commands - @section The list of networking commands - -@@ -5368,7 +5435,7 @@ NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of - ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read - as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix, - minix2, minix3, ROMFS, ReiserFS, XFS, ext2, ext3, ext4, FAT (short names), --RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed -+F2FS, RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed - to be UTF-8. This might be false on systems configured with legacy charset - but as long as the charset used is superset of ASCII you should be able to - access ASCII-named files. And it's recommended to configure your system to use -diff --git a/gentpl.py b/gentpl.py -index f08bcc404f6a8bd8c3b13a6d5bb041ee32422776..da67965a41a40cde7c987b719fea39cd02ba10e5 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -31,7 +31,8 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", - "i386_xen", "x86_64_xen", - "mips_loongson", "sparc64_ieee1275", - "powerpc_ieee1275", "mips_arc", "ia64_efi", -- "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi" ] -+ "mips_qemu_mips", "arm_uboot", "arm_efi", "arm64_efi", -+ "arm_coreboot"] - - GROUPS = {} - -@@ -44,7 +45,7 @@ GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] - GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ] - GROUPS["sparc64"] = [ "sparc64_ieee1275" ] - GROUPS["powerpc"] = [ "powerpc_ieee1275" ] --GROUPS["arm"] = [ "arm_uboot", "arm_efi" ] -+GROUPS["arm"] = [ "arm_uboot", "arm_efi", "arm_coreboot" ] - GROUPS["arm64"] = [ "arm64_efi" ] - - # Groups based on firmware -@@ -52,6 +53,7 @@ GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi" - GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] - GROUPS["uboot"] = [ "arm_uboot" ] - GROUPS["xen"] = [ "i386_xen", "x86_64_xen" ] -+GROUPS["coreboot"] = [ "i386_coreboot", "arm_coreboot" ] - - # emu is a special case so many core functionality isn't needed on this platform - GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu") -@@ -61,10 +63,10 @@ GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson", "mips_qemu_mips", - "sparc64_ieee1275", "powerpc_ieee1275"] - GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi"); - GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"] --GROUPS["usb"] = GROUPS["pci"] -+GROUPS["usb"] = GROUPS["pci"] + ["arm_coreboot"] - - # If gfxterm is main output console integrate it into kernel --GROUPS["videoinkernel"] = ["mips_loongson", "i386_coreboot" ] -+GROUPS["videoinkernel"] = ["mips_loongson", "i386_coreboot", "arm_coreboot" ] - GROUPS["videomodules"] = GRUB_PLATFORMS[:]; - for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i) - -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 04e9395fd949460672c1113c3d49c90a5d4471ec..f4ff62b769ae99f1d9b2fadf51378966c93d835c 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -112,7 +112,7 @@ endif - - if COND_i386_coreboot - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h --KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/coreboot/lbio.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/coreboot/lbio.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h -@@ -239,8 +239,21 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h - endif - -+if COND_arm_coreboot -+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdt.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dma.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/coreboot/kernel.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fdtbus.h -+endif -+ - if COND_arm_efi --KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h -@@ -278,7 +291,7 @@ BUILT_SOURCES += symlist.h - - symlist.c: symlist.h gensymlist.sh - $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1) -- cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) -+ cat symlist.p | $(SHELL) $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) - rm -f symlist.p - CLEANFILES += symlist.c - BUILT_SOURCES += symlist.c -@@ -358,6 +371,16 @@ terminal.lst: $(MARKER_FILES) - platform_DATA += terminal.lst - CLEANFILES += terminal.lst - -+fdt.lst: $(MARKER_FILES) -+ (for pp in $^; do \ -+ b=`basename $$pp .marker`; \ -+ sed -n \ -+ -e "/FDT_DRIVER_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \ -+ -e "/FDT_DRIVER_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}" $$pp; \ -+ done) | sort -u > $@ -+platform_DATA += fdt.lst -+CLEANFILES += fdt.lst -+ - parttool.lst: $(MARKER_FILES) - (for pp in $^; do \ - b=`basename $$pp .marker`; \ -diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in -index 03cc3b7f69ed3cfb69b744f8114895fd0e14fde7..1250589b3f5f88b52d7ea6de361427339fe7e578 100644 ---- a/grub-core/genmod.sh.in -+++ b/grub-core/genmod.sh.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - set -e - - # Copyright (C) 2010 Free Software Foundation, Inc. -@@ -58,6 +58,10 @@ if test x@TARGET_APPLE_LINKER@ != x1; then - -K grub_mod_init -K grub_mod_fini \ - -K _grub_mod_init -K _grub_mod_fini \ - -R .note.gnu.gold-version -R .note.GNU-stack \ -+ -R .gnu.build.attributes \ -+ -R .rel.gnu.build.attributes \ -+ -R .rela.gnu.build.attributes \ -+ -R .eh_frame -R .rela.eh_frame -R .rel.eh_frame \ - -R .note -R .comment -R .ARM.exidx $tmpfile || exit 1 - fi - if ! test -z "${TARGET_OBJ2ELF}"; then -diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk -index bd98d84cdd7427eef2f3651f455377d469955250..04c2863e5abfa4d950df2c41d579dea03a361927 100644 ---- a/grub-core/genmoddep.awk -+++ b/grub-core/genmoddep.awk -@@ -18,6 +18,10 @@ BEGIN { - - { - if ($1 == "defined") { -+ if ($3 !~ /^\.refptr\./ && $3 in symtab) { -+ printf "%s in %s is duplicated in %s\n", $3, $2, symtab[$3] >"/dev/stderr"; -+ error++; -+ } - symtab[$3] = $2; - modtab[$2] = "" modtab[$2] - } else if ($1 == "undefined") { -diff --git a/grub-core/gensyminfo.sh.in b/grub-core/gensyminfo.sh.in -index 2e8716b425cb04d9379ef5e2c629283d0f346c90..9bc7675327a6d9229492548671dd004054282434 100644 ---- a/grub-core/gensyminfo.sh.in -+++ b/grub-core/gensyminfo.sh.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - set -e - - # Copyright (C) 2010 Free Software Foundation, Inc. -diff --git a/grub-core/modinfo.sh.in b/grub-core/modinfo.sh.in -index faf0ad30edbe878270a185add45aa70e245d8b3a..f6cd657ce0f8307547fc5d011efa35622c318e63 100644 ---- a/grub-core/modinfo.sh.in -+++ b/grub-core/modinfo.sh.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - # User-controllable options - grub_modinfo_target_cpu=@target_cpu@ -diff --git a/grub-core/script/yylex.l b/grub-core/script/yylex.l -index 95b2191705ac826833e0951fa323242a9f8859d1..7b44c37b76ffa87f24b6f04260b9519f0c8654c0 100644 ---- a/grub-core/script/yylex.l -+++ b/grub-core/script/yylex.l -@@ -91,7 +91,7 @@ typedef size_t yy_size_t; - #define stdin 0 - #define stdout 0 - --#define fprintf(...) 0 -+#define fprintf(...) (void)0 - #define exit(...) grub_fatal("fatal error in lexer") - #endif - -diff --git a/po/Makefile.in.in b/po/Makefile.in.in -index 3619458e85f2bed3f92a76a9d919c26a30116dee..e68e9da843d927bfb6bbd519f4b3923c733abd7c 100644 ---- a/po/Makefile.in.in -+++ b/po/Makefile.in.in -@@ -15,7 +15,7 @@ PACKAGE = @PACKAGE@ - VERSION = @VERSION@ - PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ - --SHELL = /bin/sh -+SHELL = @SHELL@ - @SET_MAKE@ - - srcdir = @srcdir@ -diff --git a/po/exclude.pot b/po/exclude.pot -index 0a9b215eaf1971bf2a2af8a36e9605043de38e36..816089c30cbd36939b2a72724b3d591a0ac8a290 100644 -GIT binary patch -delta 49 -zcmaEUhNJl`#|G_WNh^i)qS7SY?UJ|KB{OOs -F1^~&~5lR36 - -delta 27 -jcmZoZ%klgS#|G`>=`Ng%LX#(mur$XeZ;wr8R67g+m_Q0B - -diff --git a/tests/ahci_test.in b/tests/ahci_test.in -index 1d01d1f59a0aac8911ff7ca3e62565f2dee5954d..7df56046201e4c2e4a55bdcdd403853cde902268 100644 ---- a/tests/ahci_test.in -+++ b/tests/ahci_test.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - # Copyright (C) 2013 Free Software Foundation, Inc. - # - # GRUB is free software: you can redistribute it and/or modify -diff --git a/tests/btrfs_test.in b/tests/btrfs_test.in -index c55d9477f78e01b6556bc0da9695f038523936f4..2b37ddd3324cc77f1edeb03feb369c22d03204a2 100644 ---- a/tests/btrfs_test.in -+++ b/tests/btrfs_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - set -e - -diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in -index 1cc901977c229dcf839bf58bede2b34f04252d57..75acdfedb7fe4a634d4122e44b3cd01778ed6f35 100644 ---- a/tests/cdboot_test.in -+++ b/tests/cdboot_test.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - # Copyright (C) 2013 Free Software Foundation, Inc. - # - # GRUB is free software: you can redistribute it and/or modify -diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in -index 1003587ccca65616b0c7e3c1b90353ef7f459299..9d216ebcff60bfce04e3be4dbd1f8834800a6948 100644 ---- a/tests/core_compress_test.in -+++ b/tests/core_compress_test.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - # Copyright (C) 2013 Free Software Foundation, Inc. - # - # GRUB is free software: you can redistribute it and/or modify -diff --git a/tests/cpio_test.in b/tests/cpio_test.in -index 0b09db549f07868a524376f0eb25fd6a2cac9e40..5742cf17b9d8f587d00590d481f0a00aaf6cada8 100644 ---- a/tests/cpio_test.in -+++ b/tests/cpio_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - set -e - -diff --git a/tests/ehci_test.in b/tests/ehci_test.in -index 7dd8d3e8fbd4a76b8efb88d69ecd8989546dc543..b197f8cdc922628ed35863dfa384eeef4cc4cc09 100644 ---- a/tests/ehci_test.in -+++ b/tests/ehci_test.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - # Copyright (C) 2013 Free Software Foundation, Inc. - # - # GRUB is free software: you can redistribute it and/or modify -diff --git a/tests/example_scripted_test.in b/tests/example_scripted_test.in -index 09633e89341e079a05fda7461d867e1541df4287..783b7f13853f39f9ec63b8da1da6e8a1b3a887a5 100644 ---- a/tests/example_scripted_test.in -+++ b/tests/example_scripted_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - set -e - - true -diff --git a/tests/exfat_test.in b/tests/exfat_test.in -index fc1a0fe5ec0306434434f0b49b20c44a1736dca1..cd3cd4cb2f70bb99df7edbfa8b5697f4316548ac 100644 ---- a/tests/exfat_test.in -+++ b/tests/exfat_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - set -e - -diff --git a/tests/ext234_test.in b/tests/ext234_test.in -index c986960a8bec696deb37a55cba00915219d77215..4f1eb527eb2ed41095266dba6d5013ead77d9be3 100644 ---- a/tests/ext234_test.in -+++ b/tests/ext234_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - set -e - -@@ -30,3 +30,4 @@ fi - "@builddir@/grub-fs-tester" ext3 - "@builddir@/grub-fs-tester" ext4 - "@builddir@/grub-fs-tester" ext4_metabg -+"@builddir@/grub-fs-tester" ext4_encrypt -diff --git a/tests/f2fs_test.in b/tests/f2fs_test.in -new file mode 100644 -index 0000000000000000000000000000000000000000..1ea77c826d32bd01e33d13ea7ad6639eb1cb77b0 ---- /dev/null -+++ b/tests/f2fs_test.in -@@ -0,0 +1,19 @@ -+#!/bin/sh -+ -+set -e -+ -+if [ "x$EUID" = "x" ] ; then -+ EUID=`id -u` -+fi -+ -+if [ "$EUID" != 0 ] ; then -+ exit 77 -+fi -+ -+if ! which mkfs.f2fs >/dev/null 2>&1; then -+ echo "mkfs.f2fs not installed; cannot test f2fs." -+ exit 77 -+fi -+ -+ -+"@builddir@/grub-fs-tester" f2fs -diff --git a/tests/fat_test.in b/tests/fat_test.in -index 1d132b51703c43e269d5500ca1740fa1e6b9a42c..b6b4748ca694b59337441a2f3111863e01799884 100644 ---- a/tests/fat_test.in -+++ b/tests/fat_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - set -e - -diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in -index a59645b7f873872490ac2474a30420c2df7a5caf..2d7dfc8891f6d7fdf42f88dea1213428e23b6f2e 100644 ---- a/tests/fddboot_test.in -+++ b/tests/fddboot_test.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - # Copyright (C) 2013 Free Software Foundation, Inc. - # - # GRUB is free software: you can redistribute it and/or modify -diff --git a/tests/file_filter_test.in b/tests/file_filter_test.in -index 8909e4021fb1d507cd5bf3b63319824fdc005dd5..bfb6382274e48d409d6cf6f918fc252f993f717f 100644 ---- a/tests/file_filter_test.in -+++ b/tests/file_filter_test.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - # Copyright (C) 2014 Free Software Foundation, Inc. - # - # GRUB is free software: you can redistribute it and/or modify -diff --git a/tests/gettext_strings_test.in b/tests/gettext_strings_test.in -index 5c305e75b7e9583f6be8a23d389051cf1fe2c243..813999ebe6ea5ee35796669e58baa57d0a2ace95 100644 ---- a/tests/gettext_strings_test.in -+++ b/tests/gettext_strings_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - cd '@srcdir@' - -diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in -index a459353e8a51c22fb966a842af532cff904de2a3..f7c9ca00432fa3307a2fb53ac88ca11115d7f73f 100644 ---- a/tests/grub_cmd_date.in -+++ b/tests/grub_cmd_date.in -@@ -1,4 +1,4 @@ --#! /bin/bash -+#! @BUILD_SHEBANG@ - set -e - - . "@builddir@/grub-core/modinfo.sh" -@@ -9,7 +9,7 @@ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; - fi - - pdt="$(date -u +%s)" --dt=`echo date | @builddir@/grub-shell` -+dt=`echo date | @builddir@/grub-shell | sed 's, [A-Z][a-z]*$,,'` - dtg="$(date -u -d "$dt" +%s)" - ndt="$(date -u +%s)" - -diff --git a/tests/grub_cmd_regexp.in b/tests/grub_cmd_regexp.in -index e7e6257011525ee42ca6945485208155fe717d24..6520bd6d79acc0c8f5bfddc443912d74e826a0c8 100644 ---- a/tests/grub_cmd_regexp.in -+++ b/tests/grub_cmd_regexp.in -@@ -1,4 +1,4 @@ --#! /bin/bash -+#! @BUILD_SHEBANG@ - set -e - - # Run GRUB script in a Qemu instance -diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in -index c594ae3fc14ebf7a6be86b90f4d048747383a69f..aac120a6c52731649678549d34372af14fef52d9 100644 ---- a/tests/grub_cmd_set_date.in -+++ b/tests/grub_cmd_set_date.in -@@ -1,4 +1,4 @@ --#! /bin/bash -+#! @BUILD_SHEBANG@ - set -e - - . "@builddir@/grub-core/modinfo.sh" -diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in -index eb362aa2439d713bf4246e2c56932bbc6200d710..8797f6632845f5a76ac22b813c223897ceddd672 100644 ---- a/tests/grub_cmd_sleep.in -+++ b/tests/grub_cmd_sleep.in -@@ -1,4 +1,4 @@ --#! /bin/bash -+#! @BUILD_SHEBANG@ - set -e - - . "@builddir@/grub-core/modinfo.sh" -@@ -11,8 +11,8 @@ fi - # Compare RTC with interval timer. - # Not 100% proper but should check that timer is running ok - dt=`echo 'date; sleep 10; date' | @builddir@/grub-shell` --dt1="$(date -u -d "$(echo "$dt" | head -n 1)" +%s)" --dt2="$(date -u -d "$(echo "$dt" | tail -n 1)" +%s)" -+dt1="$(date -u -d "$(echo "$dt" | head -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)" -+dt2="$(date -u -d "$(echo "$dt" | tail -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)" - - # Ignore QEMU bug - if [ "${grub_modinfo_target_cpu}" = arm ] && [ $((dt2 - dt1)) -ge 15 ] && [ $((dt2 - dt1)) -le 17 ]; then -diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in -index 6269891c9eeddb70f42da372e5636089e666818d..3399eb2929408570e9dad99db8dbc7215b41aea4 100644 ---- a/tests/grub_cmd_test.in -+++ b/tests/grub_cmd_test.in -@@ -1,4 +1,4 @@ --#! /bin/bash -+#! @BUILD_SHEBANG@ - - # create a randome file - empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 -diff --git a/tests/grub_cmd_tr.in b/tests/grub_cmd_tr.in -index 3fb15e35c8ac3ac218abf580f8ff5cdcaa2925ca..bed469c03ddc9a762112896d75af399678af711e 100644 ---- a/tests/grub_cmd_tr.in -+++ b/tests/grub_cmd_tr.in -@@ -1,4 +1,4 @@ --#! /bin/bash -e -+#! @BUILD_SHEBANG@ -e - - # Run GRUB script in a Qemu instance - # Copyright (C) 2010 Free Software Foundation, Inc. -diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in -index c8cc263763377fd23d6c7f1eca49c1edafe530a7..c67f9e422534a402614eb280fe67d165fd0bb906 100644 ---- a/tests/grub_func_test.in -+++ b/tests/grub_func_test.in -@@ -1,4 +1,4 @@ --#! /bin/bash -+#! @BUILD_SHEBANG@ - set -e - - . "@builddir@/grub-core/modinfo.sh" -diff --git a/tests/grub_script_blanklines.in b/tests/grub_script_blanklines.in -index 89ed763d3f4e0bb2a3ac3a61de9e0ec49b2eaccf..bd8735491be3b947c72fffbf5767d7ab6bcf91ae 100644 ---- a/tests/grub_script_blanklines.in -+++ b/tests/grub_script_blanklines.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - set -e - - @builddir@/grub-script-check < 4096 - MAXBLKSIZE=4096;; -@@ -169,7 +196,12 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - MINBLKSIZE=1024 - MAXBLKSIZE=4096;; - esac -- for ((BLKSIZE=MINBLKSIZE;BLKSIZE<=MAXBLKSIZE;BLKSIZE=BLKSTEP?BLKSIZE+BLKSTEP:2*BLKSIZE)); do -+ if test "$BLKSTEP" -eq 0; then -+ blksizes="$(powrange "$MINBLKSIZE" "$MAXBLKSIZE")" -+ else -+ blksizes="$(range "$MINBLKSIZE" "$MAXBLKSIZE" "$BLKSTEP")" -+ fi -+ for BLKSIZE in $blksizes; do - MAXDEVICES=1 - MINDEVICES=1 - export fs -@@ -199,13 +231,11 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - MAXDEVICES=7;; - esac - -- for ((NDEVICES=MINDEVICES; NDEVICES <= MAXDEVICES; NDEVICES++)); do -+ for NDEVICES in $(range "$MINDEVICES" "$MAXDEVICES" 1); do - export NDEVICES -- unset FSIMAGES -- for ((i=0; i < NDEVICES; i++)); do -- FSIMAGES[i]="${tempdir}/${fs}_${SECSIZE}_${BLKSIZE}_${NDEVICES}_$i.img" -- done -- export FSIMAGES -+ unset FSIMAGEP -+ FSIMAGEP="${tempdir}/${fs}_${SECSIZE}_${BLKSIZE}_${NDEVICES}_" -+ export FSIMAGEP - unset NEED_IMAGES; - - case x$fs in -@@ -226,11 +256,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - *) - NEED_IMAGES_N=$NDEVICES;; - esac -- for ((i=0;i < NEED_IMAGES_N; i++)); do -- NEED_IMAGES[i]="${FSIMAGES[i]}"; -- done - export NEED_IMAGES_N -- export NEED_IMAGES - - MNTPOINTRO="${tempdir}/${fs}_ro" - MNTPOINTRW="${tempdir}/${fs}_rw" -@@ -238,20 +264,25 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - MOUNTFS="$fs" - MASTER="${tempdir}/master" - FSLABEL="grub_;/testé莭莽茝😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewrewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfew" -- CFILESN=1 -- if test -f /usr/share/dict/american-english; then -- CFILESSRC[0]="/usr/share/dict/american-english" -- else -- CFILESSRC[0]="/usr/share/dict/linux.words" -+ CFILESRC= -+ for cand in /usr/share/dict/american-english /usr/share/dict/linux.words /data/data/com.termux/files/usr/share/hunspell/en_US.dic; do -+ if test -f "$cand" ; then -+ CFILESRC="$cand" -+ break -+ fi -+ done -+ if test "$CFILESRC" = "" ; then -+ echo "Couldn't find compressible file" >&2 -+ exit 1 - fi - case x"$fs" in - # FS LIMITATION: 8.3 names - xmsdos*) -- CFILES[0]="american.eng";; -+ CFILE="american.eng";; - xiso9660) -- CFILES[0]="american_english";; -+ CFILE="american_english";; - *) -- CFILES[0]="american-english";; -+ CFILE="american-english";; - esac - # OS LIMITATION: Limited by NAME_MAX (usually 255) in GNU/Linux - LONGNAME="qwertzuiopasdfghjklyxcvbnm1234567890qwertzuiopasdfghjklyxcvbnm1234567890oiewqfiewioqoiqoiurqruewqoiuwoieoiiuewqroreqiufieiuwrnureweriuvceoiroiewqoiricdsalkcndsakfirefoiwqeoircorejwoijfreoijojoiewjfwnfcoirenfoirefnreoifenoiwfnoi" -@@ -268,6 +299,10 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - x"btrfs"*) - FSLABEL="grub_;/testé莭莽😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoi";; - -+ # FS LIMITATION: f2fs label is at most 512 UTF-16 chars -+ x"f2fs") -+ FSLABEL="grub_;/testé䏌䐓䏕киритiurewfceniuewruewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoirvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoircreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoiq";; -+ - # FS LIMITATION: exfat is at most 15 UTF-16 chars - x"exfat") - FSLABEL="géт ;/莭莽😁кир";; -@@ -388,8 +423,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - ;; - x"vfat16" | xmsdos16) - BIGBLOCKCNT=$((25000 * BLKSIZE)) -- if [ $BIGBLOCKCNT -gt $((16#ffffffff)) ]; then -- BIGBLOCKCNT=$((16#ffffffff)) -+ if [ $BIGBLOCKCNT -gt 4294967295 ]; then -+ BIGBLOCKCNT=4294967295 - fi - ;; - x"minix") -@@ -410,7 +445,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - BIGBLOCKCNT=$((4000 * 1048576));; - # FS LIMITATION: These FS have uint32 as file size field - x"vfat"* | xmsdos* | x"cpio_crc" | x"cpio_newc" | x"cpio_bin" | x"cpio_hpbin" | xsfs*) -- BIGBLOCKCNT=$((16#ffffffff));; -+ BIGBLOCKCNT=4294967295;; - # FS LIMITATION: These FS have int32 as file size field - # FIXME: not so sure about AFFS - # OS LIMITATION: minix2/minix3 could be formatted in a way to permit more. -@@ -477,7 +512,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - # FIXME: Not sure about BtrFS, NTFS, JFS, AFS, UDF and SFS. Check it. - # FS LIMITATION: as far as I know those FS don't store their last modification date. - x"jfs_caseins" | x"jfs" | x"xfs" | x"xfs_crc" | x"btrfs"* | x"reiserfs_old" | x"reiserfs" \ -- | x"bfs" | x"afs" \ -+ | x"bfs" | x"afs" | x"f2fs" \ - | x"tarfs" | x"cpio_"* | x"minix" | x"minix2" \ - | x"minix3" | x"ntfs"* | x"udf" | x"sfs"*) - NOFSTIME=y;; -@@ -543,18 +578,18 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - - PDIR="" - # OS LIMITATION: Limited by PATH_MAX (usually 1024) -- for ((i=0;i /dev/null -- LODEVICES[i]=`losetup -f` -- losetup "${LODEVICES[i]}" "${FSIMAGES[i]}" -+ for i in $(range 0 $((NDEVICES-1)) 1); do -+ dd if=/dev/zero of="$FSIMAGEP${i}.img" count=1 bs=1 seek=$((DISKSIZE-1)) &> /dev/null -+ LODEVICE=$(losetup --find --show "$FSIMAGEP${i}.img") -+ LODEVICES="$LODEVICES $LODEVICE" -+ if test "$i" = 0; then -+ MOUNTDEVICE="$LODEVICE" -+ fi - done ;; - esac - -- MOUNTDEVICE="${LODEVICES[0]}" - case x"$fs" in - x"afs") - ;; - x"btrfs") -- "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${LODEVICES[0]}" ;; -+ "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${MOUNTDEVICE}" ;; - x"btrfs_zlib" | x"btrfs_lzo") -- "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${LODEVICES[0]}" -+ "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${MOUNTDEVICE}" - MOUNTOPTS="compress=${fs/btrfs_/}," - MOUNTFS="btrfs" - ;; - x"btrfs_raid0") -- "mkfs.btrfs" -s $SECSIZE -d raid0 -m raid0 -L "$FSLABEL" "${LODEVICES[@]}" -+ "mkfs.btrfs" -s $SECSIZE -d raid0 -m raid0 -L "$FSLABEL" $LODEVICES - MOUNTFS="btrfs" - ;; - x"btrfs_raid1") -- "mkfs.btrfs" -s $SECSIZE -d raid1 -m raid1 -L "$FSLABEL" "${LODEVICES[@]}" -+ "mkfs.btrfs" -s $SECSIZE -d raid1 -m raid1 -L "$FSLABEL" $LODEVICES - MOUNTFS="btrfs" - ;; - x"btrfs_raid10") -- "mkfs.btrfs" -s $SECSIZE -d raid10 -m raid10 -L "$FSLABEL" "${LODEVICES[@]}" -+ "mkfs.btrfs" -s $SECSIZE -d raid10 -m raid10 -L "$FSLABEL" $LODEVICES - MOUNTFS="btrfs" - ;; - x"btrfs_single") -- "mkfs.btrfs" -s $SECSIZE -d single -L "$FSLABEL" "${LODEVICES[@]}" -+ "mkfs.btrfs" -s $SECSIZE -d single -L "$FSLABEL" $LODEVICES - MOUNTFS="btrfs" - ;; - x"exfat") -- "mkfs.$fs" -s $((BLKSIZE/512)) -n "$FSLABEL" "${LODEVICES[0]}" -+ "mkfs.$fs" -s $((BLKSIZE/512)) -n "$FSLABEL" "${MOUNTDEVICE}" - MOUNTOPTS="iocharset=utf8," - MOUNTFS="exfat-fuse";; - x"minix") -- "mkfs.minix" "${LODEVICES[0]}" -+ "mkfs.minix" "${MOUNTDEVICE}" - ;; - # mkfs.hfs and mkfs.hfsplus don't fill UUID. - x"hfsplus") -- "mkfs.hfsplus" -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" -- dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 ;; -+ "mkfs.hfsplus" -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" -+ dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 ;; - x"hfsplus_wrap") -- "mkfs.hfsplus" -w -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" -- dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 -+ "mkfs.hfsplus" -w -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" -+ dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 - MOUNTFS="hfsplus";; - x"hfsplus_casesens") -- "mkfs.hfsplus" -s -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" -- dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 -+ "mkfs.hfsplus" -s -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" -+ dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 - MOUNTFS="hfsplus";; - x"hfs") -- "mkfs.hfs" -b $BLKSIZE -v "`echo $FSLABEL |recode utf8..macroman`" -h "${LODEVICES[0]}" -- dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#474)) conv=notrunc count=8 -+ "mkfs.hfs" -b $BLKSIZE -v "`echo $FSLABEL |recode utf8..macroman`" -h "${MOUNTDEVICE}" -+ dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#474)) conv=notrunc count=8 - MOUNTOPTS="iocharset=utf8,codepage=macroman," - ;; - x"vfat"*|xmsdos*) -@@ -643,98 +682,98 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - A= - fi -- "mkfs.vfat" -a $A -S $SECSIZE -s $((BLKSIZE/SECSIZE)) -F "${BITS:0:2}" -n "$FSLABEL" "${FSIMAGES[0]}" -+ "mkfs.vfat" -a $A -S $SECSIZE -s $((BLKSIZE/SECSIZE)) -F "${BITS:0:2}" -n "$FSLABEL" "${MOUNTDEVICE}" - MOUNTOPTS="iocharset=utf8,codepage=437," - MOUNTFS="$(echo "$fs"|sed 's,[0-9]*a\?$,,')";; - x"minix2") -- "mkfs.minix" -v "${LODEVICES[0]}" -+ "mkfs.minix" -v "${MOUNTDEVICE}" - MOUNTFS="minix";; - x"minix3") -- "mkfs.minix" -B $BLKSIZE -3 "${LODEVICES[0]}" -+ "mkfs.minix" -B $BLKSIZE -3 "${MOUNTDEVICE}" - MOUNTFS="minix";; - x"ntfs"*) -- "mkfs.ntfs" -s "$SECSIZE" -c "$BLKSIZE" -L "$FSLABEL" -Q -q "${LODEVICES[0]}" -+ "mkfs.ntfs" -s "$SECSIZE" -c "$BLKSIZE" -L "$FSLABEL" -Q -q "${MOUNTDEVICE}" - MOUNTOPTS="iocharset=utf8,compression," - MOUNTFS="ntfs-3g";; - x"udf") -- "mkudffs" --utf8 -b $BLKSIZE --lvid="$FSLABEL" "${LODEVICES[0]}" -+ "mkudffs" --utf8 -b $BLKSIZE --lvid="$FSLABEL" "${MOUNTDEVICE}" - MOUNTOPTS="iocharset=utf8,bs=$BLKSIZE,";; - x"ufs2") -- "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 2 "${LODEVICES[0]}" -+ "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 2 "${MOUNTDEVICE}" - MOUNTOPTS="ufstype=ufs2," - MOUNTFS="ufs";; - x"ufs1") -- "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${LODEVICES[0]}" -+ "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${MOUNTDEVICE}" - MOUNTOPTS="ufstype=44bsd," - MOUNTFS="ufs";; - x"ufs1_sun") -- "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${LODEVICES[0]}" -+ "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${MOUNTDEVICE}" - MOUNTOPTS="ufstype=sun," - MOUNTFS="ufs";; - x"zfs") -- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" -+ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" - sleep 1 - "zfs" create "$FSLABEL"/"grub fs" - sleep 1;; - x"zfs_caseins") -- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" -+ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" - sleep 1 - "zfs" create -o casesensitivity=insensitive "$FSLABEL"/"grub fs" - sleep 1;; - x"zfs_lzjb" | xzfs_gzip | xzfs_zle) -- "zpool" create -O compression=${fs/zfs_/} -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" -+ "zpool" create -O compression=${fs/zfs_/} -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" - sleep 1 - "zfs" create -o compression=${fs/zfs_/} "$FSLABEL"/"grub fs" - sleep 1;; - x"zfs_raidz") -- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz1 "${LODEVICES[@]}" -+ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz1 $LODEVICES - sleep 1 - "zfs" create "$FSLABEL"/"grub fs" - sleep 1;; - x"zfs_raidz2") -- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz2 "${LODEVICES[@]}" -+ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz2 $LODEVICES - sleep 1 - "zfs" create "$FSLABEL"/"grub fs" - sleep 1;; - x"zfs_raidz3") -- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz3 "${LODEVICES[@]}" -+ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz3 $LODEVICES - sleep 1 - "zfs" create "$FSLABEL"/"grub fs" - sleep 1;; - x"zfs_mirror") -- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" mirror "${LODEVICES[@]}" -+ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" mirror $LODEVICES - sleep 1 - "zfs" create "$FSLABEL"/"grub fs" - sleep 1;; - x"zfs_stripe") -- "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[@]}" -+ "zpool" create -R "$MNTPOINTRW" "$FSLABEL" $LODEVICES - sleep 1 - "zfs" create "$FSLABEL"/"grub fs" - sleep 1;; - x"tarfs" | x"cpio_"* | x"iso9660" | xjoliet | xrockridge | xrockridge_joliet | x"iso9660_1999" | xjoliet_1999 | xrockridge_1999 | xrockridge_joliet_1999 | x"ziso9660" | x"romfs" | x"squash4_"*) - INSTDEVICE=/dev/null;; - x"reiserfs") -- "mkfs.reiserfs" --format=3.6 -b $BLKSIZE -l "$FSLABEL" -q "${LODEVICES[0]}" ;; -+ "mkfs.reiserfs" --format=3.6 -b $BLKSIZE -l "$FSLABEL" -q "${MOUNTDEVICE}" ;; - x"reiserfs_old") -- "mkfs.reiserfs" --format=3.5 -b $BLKSIZE -l "$FSLABEL" -q "${LODEVICES[0]}" -+ "mkfs.reiserfs" --format=3.5 -b $BLKSIZE -l "$FSLABEL" -q "${MOUNTDEVICE}" - MOUNTFS=reiserfs;; - x"jfs") -- "mkfs.jfs" -L "$FSLABEL" -q "${LODEVICES[0]}" -+ "mkfs.jfs" -L "$FSLABEL" -q "${MOUNTDEVICE}" - MOUNTOPTS="iocharset=utf8,";; - x"jfs_caseins") -- "mkfs.jfs" -O -L "$FSLABEL" -q "${LODEVICES[0]}" -+ "mkfs.jfs" -O -L "$FSLABEL" -q "${MOUNTDEVICE}" - MOUNTFS=jfs - MOUNTOPTS="iocharset=utf8,";; - x"mdraid"*) -- mdadm -C --chunk=$((BLKSIZE/1024)) --force -e "${fs:6:1}.${fs:7:1}" "/dev/md/${fs}_${NDEVICES}" --level="${fs:13}" --raid-devices="$NDEVICES" "${LODEVICES[@]}" -+ mdadm -C --chunk=$((BLKSIZE/1024)) --force -e "${fs:6:1}.${fs:7:1}" "/dev/md/${fs}_${NDEVICES}" --level="${fs:13}" --raid-devices="$NDEVICES" $LODEVICES - MOUNTDEVICE="/dev/md/${fs}_${NDEVICES}" - MOUNTFS=ext2 - "mkfs.ext2" -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; - x"lvm"*) -- for ((i=0;i /dev/null; -+ cp "${CFILESRC}" "$MNTPOINTRW/$OSDIR/${CFILE}" &> /dev/null; - else -- for ((i=0;i<$CFILESN;i++)); do -- cp "${CFILESSRC[i]}" "$MNTPOINTRW/$OSDIR/${CFILES[i]}"; -- done -+ -+ cp "${CFILESRC}" "$MNTPOINTRW/$OSDIR/${CFILE}"; -+ - fi - - if [ x$NOSYMLINK != xy ]; then -@@ -968,48 +1015,48 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - sleep 2 - ;; - x"tarfs") -- (cd "$MASTER"; tar cf "${FSIMAGES[0]}" .) ;; -+ (cd "$MASTER"; tar cf "${FSIMAGEP}0.img" .) ;; - x"cpio_"*) -- (cd "$MASTER"; find . | cpio -o -H "${fs/cpio_/}" > "${FSIMAGES[0]}" ) ;; -+ (cd "$MASTER"; find . | cpio -o -H "$(echo ${fs} | sed 's@^cpio_@@')" > "${FSIMAGEP}0.img" ) ;; - x"ziso9660") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso -compliance rec_mtime -set_filter_r --zisofs -- -zisofs default -as mkisofs -iso-level 3 -graft-points -R -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" -- -set_filter_r --zisofs -- -zisofs default -add /="$MASTER" ;; -+ xorriso -compliance rec_mtime -set_filter_r --zisofs -- -zisofs default -as mkisofs -iso-level 3 -graft-points -R -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" -- -set_filter_r --zisofs -- -zisofs default -add /="$MASTER" ;; - x"iso9660") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; -+ xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; - x"joliet") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; -+ xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; - x"rockridge") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; -+ xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; - x"rockridge_joliet") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; -+ xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; - x"iso9660_1999") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; -+ xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; - x"joliet_1999") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; -+ xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; - x"rockridge_1999") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; -+ xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; - x"rockridge_joliet_1999") - FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); -- xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; -+ xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; - x"romfs") -- genromfs -V "$FSLABEL" -f "${FSIMAGES[0]}" -d "$MASTER" ;; -+ genromfs -V "$FSLABEL" -f "${FSIMAGEP}0.img" -d "$MASTER" ;; - xsquash4_*) -- echo mksquashfs "$MASTER" "${FSIMAGES[0]}" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE -- mksquashfs "$MASTER" "${FSIMAGES[0]}" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE ;; -+ echo mksquashfs "$MASTER" "${FSIMAGEP}0.img" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE -+ mksquashfs "$MASTER" "${FSIMAGEP}0.img" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE ;; - x"bfs") - sleep 1 - fusermount -u "$MNTPOINTRW" - ;; - xlvm*) - sleep 1 -- for ((try=0;try < 20; try++)); do -+ for try in $(range 0 20 1); do - if umount "$MNTPOINTRW" ; then - break; - fi -@@ -1021,7 +1068,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - ;; - xmdraid*) - sleep 1 -- for ((try=0;try < 20; try++)); do -+ for try in $(range 0 20 1); do - if umount "$MNTPOINTRW" ; then - break; - fi -@@ -1033,7 +1080,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - ;; - *) - sleep 1 -- for ((try=0;try < 20; try++)); do -+ for try in $(range 0 20 1); do - if umount "$MNTPOINTRW" ; then - break; - fi -@@ -1066,7 +1113,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - sleep 1 - mount -t "$MOUNTFS" "${MOUNTDEVICE}" "$MNTPOINTRO" -o ${MOUNTOPTS}${SELINUXOPTS}ro ;; - xmdraid*) -- mdadm --assemble /dev/md/"${fs}_$NDEVICES" "${LODEVICES[@]}" -+ mdadm --assemble /dev/md/"${fs}_$NDEVICES" $LODEVICES - sleep 1 - mount -t "$MOUNTFS" "${MOUNTDEVICE}" "$MNTPOINTRO" -o ${MOUNTOPTS}${SELINUXOPTS}ro ;; - *) -@@ -1085,7 +1132,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo LIST FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" -+ TZ=UTC ls -l "$MNTPOINTRO" - exit 1 - fi - -@@ -1094,7 +1141,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo NLIST FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -lA "$MNTPOINTRO" -+ TZ=UTC ls -lA "$MNTPOINTRO" - exit 1 - fi - -@@ -1103,7 +1150,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo ILIST FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" -+ TZ=UTC ls -l "$MNTPOINTRO" - exit 1 - fi - -@@ -1112,7 +1159,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo LONG LIST FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" -+ TZ=UTC ls -l "$MNTPOINTRO" - exit 1 - fi - -@@ -1123,7 +1170,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo TIME FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" -+ TZ=UTC ls -l "$MNTPOINTRO" - exit 1 - fi - -@@ -1133,7 +1180,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo LONG TIME FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" -+ TZ=UTC ls -l "$MNTPOINTRO" - exit 1 - fi - fi -@@ -1149,7 +1196,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo DOT IN ROOTDIR FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" -+ TZ=UTC ls -l "$MNTPOINTRO" - exit 1 - fi - -@@ -1163,7 +1210,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo DOTDOT IN ROOTDIR FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" -+ TZ=UTC ls -l "$MNTPOINTRO" - exit 1 - fi - ;; -@@ -1180,7 +1227,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo SLIST FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/sdir" -+ TZ=UTC ls -l "$MNTPOINTRO/sdir" - exit 1 - fi - -@@ -1195,7 +1242,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo PLIST FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$PDIR" -+ TZ=UTC ls -l "$MNTPOINTRO/$PDIR" - exit 1 - fi - -@@ -1210,7 +1257,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo DOT IN SUBDIR FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$OSDIR/sdir" -+ TZ=UTC ls -l "$MNTPOINTRO/$OSDIR/sdir" - exit 1 - fi - -@@ -1225,7 +1272,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - else - echo DOTDOT IN SUBDIR FAIL - echo "$LSROUT" -- TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$OSDIR/ssdir" -+ TZ=UTC ls -l "$MNTPOINTRO/$OSDIR/ssdir" - exit 1 - fi - -@@ -1245,8 +1292,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - case x"$fs" in - x"iso9660" | x"ziso9660" | xrockridge | xjoliet | xrockridge_joliet | x"iso9660_1999" | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) ;; - x"zfs"*) -- for ((i=0;i /dev/null || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM1" > /dev/null || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM2" || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM3" > /dev/null; then -- : -- else -- echo FSTIME FAIL -- echo "$FSTIME" -- echo "$LSOUT" -- exit 1 -+ if echo "$LSOUT" | grep -F 'Last modification time '"$FSTIME" > /dev/null || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM1" > /dev/null || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM2" || echo "$LSOUT" | grep -F 'Last modification time '"$FSTIMEM3" > /dev/null; then -+ : -+ else -+ echo FSTIME FAIL -+ echo "$FSTIME" -+ echo "$LSOUT" -+ exit 1 -+ fi - fi - - if [ x$NOHARDLINK != xy ]; then -@@ -1410,11 +1457,9 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - exit 1 - fi - ok=true -- for ((i=0;i<$CFILESN;i++)); do -- if ! run_grubfstest cmp "$GRUBDIR/${CFILES[i]}" "$MNTPOINTRO/$OSDIR/${CFILES[i]}" ; then -- ok=false; -- fi -- done -+ if ! run_grubfstest cmp "$GRUBDIR/${CFILE}" "$MNTPOINTRO/$OSDIR/${CFILE}" ; then -+ ok=false; -+ fi - if test x$ok = xtrue; then - : - else -@@ -1503,15 +1548,17 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + - sleep 1 - ;; - esac -- for ((i=0; i < NDEVICES; i++)); do -- case x"$fs" in -- x"tarfs" | x"cpio_"* | x"iso9660" | xrockridge | xjoliet | xrockridge_joliet | x"ziso9660" | x"romfs" | x"squash4_"* | x"iso9660_1999" | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) ;; -- *) -- while ! losetup -d "${LODEVICES[i]}"; do -+ case x"$fs" in -+ x"tarfs" | x"cpio_"* | x"iso9660" | xrockridge | xjoliet | xrockridge_joliet | x"ziso9660" | x"romfs" | x"squash4_"* | x"iso9660_1999" | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) ;; -+ *) -+ for lodev in $LODEVICES; do -+ while ! losetup -d "$lodev"; do - sleep 1 -- done;; -- esac -- rm "${FSIMAGES[i]}" -+ done -+ done;; -+ esac -+ for i in $(range 0 $((NDEVICES-1)) 1); do -+ rm "$FSIMAGEP${i}.img" - done - if [ x"$fs" = x"zfs" ]; then - rmdir "$MNTPOINTRW"/"grub fs" || true -diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in -index 5adce0a47fe3208e14bbbf4820685d67b43ef9bb..8a87109b15240de9d61f2ac02becfcb5300582f1 100644 ---- a/tests/util/grub-shell-tester.in -+++ b/tests/util/grub-shell-tester.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - set -e - - # Compares GRUB script output with BASH output. -diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in -index 814f36c6bd2438b7f9c59f5f4a9777e95b9e38db..d690d6734efb82109f7635c4688b6fc7417a5751 100644 ---- a/tests/util/grub-shell.in -+++ b/tests/util/grub-shell.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - set -e - - # Run GRUB script in a Qemu instance -diff --git a/tests/xfs_test.in b/tests/xfs_test.in -index 3807e2e5c77e244f8b2f0d43ec28b86b3f2f9e9b..03a3513595dc719cd72b4d9b7198f22b338cb588 100644 ---- a/tests/xfs_test.in -+++ b/tests/xfs_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - set -e - -diff --git a/tests/xzcompress_test.in b/tests/xzcompress_test.in -index b2bd999ec071c24205533e50cf51f46ec59a2218..03bfb5e951dd8dfb7ccb15fb6a31dd4aea639df9 100644 ---- a/tests/xzcompress_test.in -+++ b/tests/xzcompress_test.in -@@ -1,4 +1,4 @@ --#! /bin/sh -+#! @BUILD_SHEBANG@ - # Copyright (C) 2013 Free Software Foundation, Inc. - # - # GRUB is free software: you can redistribute it and/or modify -diff --git a/tests/zfs_test.in b/tests/zfs_test.in -index 047120e47a0e042f0540d6762666edf4cb0b37fb..eee62c10d704ec42b090eba5ac16b4966ff760ad 100644 ---- a/tests/zfs_test.in -+++ b/tests/zfs_test.in -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!@BUILD_SHEBANG@ - - set -e - -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f8496d28bdf7f4bcbc2413888330834c1e252a64..33332360eecf954fc2952df944fe171006fc4143 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -134,6 +134,7 @@ fi - # Device containing our userland. Typically used for root= parameter. - GRUB_DEVICE="`${grub_probe} --target=device /`" - GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true -+GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true - - # Device containing our /boot partition. Usually the same as GRUB_DEVICE. - GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`" -@@ -147,6 +148,12 @@ if [ x"$GRUB_FS" = xunknown ]; then - GRUB_FS="$(stat -f --printf=%T / || echo unknown)" - fi - -+# Provide a default set of stock linux early initrd images. -+# Define here so the list can be modified in the sourced config file. -+if [ "x${GRUB_EARLY_INITRD_LINUX_STOCK}" = "x" ]; then -+ GRUB_EARLY_INITRD_LINUX_STOCK="intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode.cpio" -+fi -+ - if test -f ${sysconfdir}/default/grub ; then - . ${sysconfdir}/default/grub - fi -@@ -182,6 +189,7 @@ if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub - # override them. - export GRUB_DEVICE \ - GRUB_DEVICE_UUID \ -+ GRUB_DEVICE_PARTUUID \ - GRUB_DEVICE_BOOT \ - GRUB_DEVICE_BOOT_UUID \ - GRUB_FS \ -@@ -211,10 +219,13 @@ export GRUB_DEFAULT \ - GRUB_CMDLINE_NETBSD \ - GRUB_CMDLINE_NETBSD_DEFAULT \ - GRUB_CMDLINE_GNUMACH \ -+ GRUB_EARLY_INITRD_LINUX_CUSTOM \ -+ GRUB_EARLY_INITRD_LINUX_STOCK \ - GRUB_TERMINAL_INPUT \ - GRUB_TERMINAL_OUTPUT \ - GRUB_SERIAL_COMMAND \ - GRUB_DISABLE_LINUX_UUID \ -+ GRUB_DISABLE_LINUX_PARTUUID \ - GRUB_DISABLE_RECOVERY \ - GRUB_VIDEO_BACKEND \ - GRUB_GFXMODE \ -diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 60b31caddeb42b5db338897dc18acdc156dd2c22..0f801cab3e4d05efface62c7fcb9b787c69995c3 100644 ---- a/util/grub-mkconfig_lib.in -+++ b/util/grub-mkconfig_lib.in -@@ -188,6 +188,7 @@ grub_file_is_not_garbage () - *.dpkg-*) return 1 ;; # debian dpkg - *.rpmsave|*.rpmnew) return 1 ;; - README*|*/README*) return 1 ;; # documentation -+ *.sig) return 1 ;; # signatures - esac - else - return 1 -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index de9044c7f28611d56358f581ac52ca2d2b7fc982..61ebd7dc714e87aedb167345729f574426d69b77 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -43,12 +43,22 @@ case ${GRUB_DEVICE} in - ;; - esac - -+# Default to disabling partition uuid support to maintian compatibility with -+# older kernels. -+GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true} -+ - # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter - # and mounting btrfs requires user space scanning, so force UUID in this case. --if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ -- || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -+if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \ -+ || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ -+ && [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \ -+ || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -+ && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \ - || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} -+elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \ -+ || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then -+ LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID} - else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} - fi -@@ -136,9 +146,13 @@ EOF - if test -n "${initrd}" ; then - # TRANSLATORS: ramdisk isn't identifier. Should be translated. - message="$(gettext_printf "Loading initial ramdisk ...")" -+ initrd_path= -+ for i in ${initrd}; do -+ initrd_path="${initrd_path} ${rel_dirname}/${i}" -+ done - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' -- initrd ${rel_dirname}/${initrd} -+ initrd $(echo $initrd_path) - EOF - fi - sed "s/^/$submenu_indentation/" << EOF -@@ -188,7 +202,15 @@ while [ "x$list" != "x" ] ; do - alt_version=`echo $version | sed -e "s,\.old$,,g"` - linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" - -- initrd= -+ initrd_early= -+ for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \ -+ ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do -+ if test -e "${dirname}/${i}" ; then -+ initrd_early="${initrd_early} ${i}" -+ fi -+ done -+ -+ initrd_real= - for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ - "initrd-${version}" "initramfs-${version}.img" \ - "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ -@@ -198,11 +220,22 @@ while [ "x$list" != "x" ] ; do - "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ - "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do - if test -e "${dirname}/${i}" ; then -- initrd="$i" -+ initrd_real="${i}" - break - fi - done - -+ initrd= -+ if test -n "${initrd_early}" || test -n "${initrd_real}"; then -+ initrd="${initrd_early} ${initrd_real}" -+ -+ initrd_display= -+ for i in ${initrd}; do -+ initrd_display="${initrd_display} ${dirname}/${i}" -+ done -+ gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 -+ fi -+ - config= - for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do - if test -e "${i}" ; then -@@ -216,12 +249,16 @@ while [ "x$list" != "x" ] ; do - initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` - fi - -- if test -n "${initrd}" ; then -- gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 -- elif test -z "${initramfs}" ; then -+ if test -z "${initramfs}" && test -z "${initrd_real}" ; then - # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's - # no initrd or builtin initramfs, it can't work here. -- linux_root_device_thisversion=${GRUB_DEVICE} -+ if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \ -+ || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then -+ -+ linux_root_device_thisversion=${GRUB_DEVICE} -+ else -+ linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID} -+ fi - fi - - if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then -diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index c48af948d6ecdf672aa341f713912ba15de8f27d..e8143b079dc8bcdf21ec8a763b19a356c863a5e3 100644 ---- a/util/grub.d/20_linux_xen.in -+++ b/util/grub.d/20_linux_xen.in -@@ -43,12 +43,22 @@ case ${GRUB_DEVICE} in - ;; - esac - -+# Default to disabling partition uuid support to maintian compatibility with -+# older kernels. -+GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true} -+ - # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter - # and mounting btrfs requires user space scanning, so force UUID in this case. --if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ -- || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -+if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \ -+ || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ -+ && [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \ -+ || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -+ && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \ - || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} -+elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \ -+ || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then -+ LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID} - else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} - fi -@@ -122,16 +132,16 @@ linux_entry () - else - xen_rm_opts="no-real-mode edd=off" - fi -- multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} -+ ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} - echo '$(echo "$lmessage" | grub_quote)' -- module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} -+ ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} - EOF - if test -n "${initrd}" ; then - # TRANSLATORS: ramdisk isn't identifier. Should be translated. - message="$(gettext_printf "Loading initial ramdisk ...")" - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' -- module --nounzip ${rel_dirname}/${initrd} -+ ${module_loader} --nounzip ${rel_dirname}/${initrd} - EOF - fi - sed "s/^/$submenu_indentation/" << EOF -@@ -206,6 +216,18 @@ while [ "x${xen_list}" != "x" ] ; do - if [ "x$is_top_level" != xtrue ]; then - echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" - fi -+ if ($grub_file --is-arm64-efi $current_xen); then -+ xen_loader="xen_hypervisor" -+ module_loader="xen_module" -+ else -+ if ($grub_file --is-x86-multiboot2 $current_xen); then -+ xen_loader="multiboot2" -+ module_loader="module2" -+ else -+ xen_loader="multiboot" -+ module_loader="module" -+ fi -+ fi - while [ "x$list" != "x" ] ; do - linux=`version_find_latest $list` - gettext_printf "Found linux image: %s\n" "$linux" >&2 -@@ -234,7 +256,13 @@ while [ "x${xen_list}" != "x" ] ; do - gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 - else - # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. -- linux_root_device_thisversion=${GRUB_DEVICE} -+ if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \ -+ || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then -+ -+ linux_root_device_thisversion=${GRUB_DEVICE} -+ else -+ linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID} -+ fi - fi - - if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then diff --git a/sources b/sources index b00976af..9bd1834c 100644 --- a/sources +++ b/sources @@ -1,3 +1,4 @@ -SHA512 (grub-2.02.tar.xz) = cc6eb0a42b5c8df2f671cc128ff725afb3ff1f8832a196022e433cf0d3b75decfca2316d0aa5fabea75747d55e88f3d021dd93508563f8ca80fd7b9e7fe1f088 SHA512 (unifont-5.1.20080820.pcf.gz) = 8939e2bc82ca97b60e6678f3ff079a2be7ba9b702f2e8ee289e853af5823695f7baafbf14b674fc5e41071f2a6de4f2dadd56bf8b4653849dd756d59622f1649 SHA512 (theme.tar.bz2) = 0f6f914d5f801509403094b28b8cfe5169cb56ae9bdd808ae21a6780a8236b434161a068351508dd78729c25ee2fed066c124c1eef9e15102750b409b4576a5c +SHA512 (grub-2.04.tar.xz) = 9c15c42d0cf5d61446b752194e3b628bb04be0fe6ea0240ab62b3d753784712744846e1f7c3651d8e0968d22012e6d713c38c44936d4004ded3ca4d4007babbb +SHA512 (gnulib-fixes.tar.gz) = c45de2126598485bcf2fee81a66e64afa0e253aa04fc796c9201dd50229a93cc086d635a21d4644cb454ad6f71fa342494573aa86478fca19059cf71836b0619 From be6e591e0f740dddbbad1ac47f6d3c64c4fdae0e Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 18 Sep 2019 10:01:25 +0200 Subject: [PATCH 002/294] Add BLS devicetree support and a couple of RISC-V fixes - A couple of RISC-V fixes - Remove grub2-tools %%posttrans scriptlet that migrates to a BLS config - Add blscfg device tree support Resolves: rhbz#1751307 Signed-off-by: Javier Martinez Canillas --- ...-error-with-the-fdt-module-on-risc-v.patch | 40 ++++++ ...tation-of-pc-relative-relocation-off.patch | 36 +++++ ...Add-support-for-the-devicetree-field.patch | 132 ++++++++++++++++++ ...-var-in-a-BLS-config-if-GRUB_DEFAULT.patch | 38 +++++ grub.patches | 4 + grub2.spec | 15 +- 6 files changed, 257 insertions(+), 8 deletions(-) create mode 100644 0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch create mode 100644 0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch create mode 100644 0181-blscfg-Add-support-for-the-devicetree-field.patch create mode 100644 0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch diff --git a/0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch b/0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch new file mode 100644 index 00000000..35f2878b --- /dev/null +++ b/0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 27 Aug 2019 10:34:24 +0200 +Subject: [PATCH] Fix build error with the fdt module on risc-v + +The risc-v architecture also uses Device Trees, but the symbols in the +fdt header aren't defined for this arch which lead to following error: + +BUILDSTDERR: ../../grub-core/loader/efi/fdt.c: In function 'grub_fdt_load': +BUILDSTDERR: ../../grub-core/loader/efi/fdt.c:48:39: warning: implicit declaration of function 'grub_fdt_get_totalsize' [-Wimplicit-function-declaration] +BUILDSTDERR: 48 | size = GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt)); + +Signed-off-by: Javier Martinez Canillas +--- + include/grub/fdt.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/include/grub/fdt.h b/include/grub/fdt.h +index 2041341fd68..3514aa4a5b6 100644 +--- a/include/grub/fdt.h ++++ b/include/grub/fdt.h +@@ -19,7 +19,8 @@ + #ifndef GRUB_FDT_HEADER + #define GRUB_FDT_HEADER 1 + +-#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__aarch64__)) ++#if !defined(GRUB_MACHINE_EMU) && \ ++ (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) + + #include + #include +@@ -146,6 +147,7 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch + grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16); \ + }) + +-#endif /* defined(__arm__) || defined(__aarch64__) */ ++#endif /* !defined(GRUB_MACHINE_EMU) && \ ++ (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) */ + + #endif /* ! GRUB_FDT_HEADER */ diff --git a/0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch b/0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch new file mode 100644 index 00000000..582cadbd --- /dev/null +++ b/0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Wed, 26 Jun 2019 16:50:03 +0200 +Subject: [PATCH] RISC-V: Fix computation of pc-relative relocation offset + +The offset calculation was missing the relocation addend. + +Signed-off-by: Andreas Schwab +Tested-by: Chester Lin +Reviewed-by: Daniel Kiper +--- + util/grub-mkimagexx.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index bc087c2b57f..d16ec63a16f 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -1232,8 +1232,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd, + grub_uint32_t *t32 = (grub_uint32_t *) target; + grub_uint16_t *t16 = (grub_uint16_t *) target; + grub_uint8_t *t8 = (grub_uint8_t *) target; +- grub_int64_t off = (long)sym_addr - target_section_addr - offset +- - image_target->vaddr_offset; ++ grub_int64_t off; + + /* + * Instructions and instruction encoding are documented in the RISC-V +@@ -1243,6 +1242,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd, + */ + + sym_addr += addend; ++ off = sym_addr - target_section_addr - offset - image_target->vaddr_offset; + + switch (ELF_R_TYPE (info)) + { diff --git a/0181-blscfg-Add-support-for-the-devicetree-field.patch b/0181-blscfg-Add-support-for-the-devicetree-field.patch new file mode 100644 index 00000000..8c971af5 --- /dev/null +++ b/0181-blscfg-Add-support-for-the-devicetree-field.patch @@ -0,0 +1,132 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Sun, 15 Sep 2019 09:37:45 +0200 +Subject: [PATCH] blscfg: Add support for the devicetree field + +The BootLoaderSpec mentions that a devicetree field can be used to pass a +Device Tree (DT) to the kernel, for the platforms that use it to describe +information about the hardware. + +Allow the blscfg module to parse this field and call the grub2 devicetree +command in that case. If there is a devicetree grub2 environment variable +defined, this will be used if the field is not defined in the BLS snippet. + +Resolves: rhbz#1751307 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 60 ++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 57 insertions(+), 3 deletions(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 54458b14518..1ec89870483 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -698,6 +698,8 @@ static void create_entry (struct bls_entry *entry) + const char *early_initrd = NULL; + char **early_initrds = NULL; + char *initrd_prefix = NULL; ++ char *devicetree = NULL; ++ char *dt = NULL; + char *id = entry->filename; + char *dotconf = id; + char *hotkey = NULL; +@@ -709,6 +711,7 @@ static void create_entry (struct bls_entry *entry) + + char *src = NULL; + int i, index; ++ bool add_dt_prefix = false; + + grub_dprintf("blscfg", "%s got here\n", __func__); + clinux = bls_get_val (entry, "linux", NULL); +@@ -736,6 +739,14 @@ static void create_entry (struct bls_entry *entry) + + initrds = bls_make_list (entry, "initrd", NULL); + ++ devicetree = expand_val (bls_get_val (entry, "devicetree", NULL)); ++ ++ if (!devicetree) ++ { ++ devicetree = expand_val (grub_env_get("devicetree")); ++ add_dt_prefix = true; ++ } ++ + hotkey = bls_get_val (entry, "grub_hotkey", NULL); + users = expand_val (bls_get_val (entry, "grub_users", NULL)); + classes = bls_make_list (entry, "grub_class", NULL); +@@ -801,7 +812,6 @@ static void create_entry (struct bls_entry *entry) + goto finish; + } + +- + tmp = grub_stpcpy(initrd, "initrd"); + for (i = 0; early_initrds != NULL && early_initrds[i] != NULL; i++) + { +@@ -821,21 +831,65 @@ static void create_entry (struct bls_entry *entry) + tmp = grub_stpcpy (tmp, "\n"); + } + ++ if (devicetree) ++ { ++ char *prefix = NULL; ++ int dt_size; ++ ++ if (add_dt_prefix) ++ { ++ prefix = grub_strrchr (clinux, '/'); ++ prefix = grub_strndup(clinux, prefix - clinux + 1); ++ if (!prefix) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ goto finish; ++ } ++ } ++ ++ dt_size = sizeof("devicetree " GRUB_BOOT_DEVICE) + grub_strlen(devicetree) + 1; ++ ++ if (add_dt_prefix) ++ { ++ dt_size += grub_strlen(prefix); ++ } ++ ++ dt = grub_malloc (dt_size); ++ if (!dt) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ goto finish; ++ } ++ char *tmp = dt; ++ tmp = grub_stpcpy (dt, "devicetree"); ++ tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); ++ if (add_dt_prefix) ++ tmp = grub_stpcpy (tmp, prefix); ++ tmp = grub_stpcpy (tmp, devicetree); ++ tmp = grub_stpcpy (tmp, "\n"); ++ ++ grub_free(prefix); ++ } ++ ++ grub_dprintf ("blscfg2", "devicetree %s for id:\"%s\"\n", dt, id); ++ + src = grub_xasprintf ("load_video\n" + "set gfxpayload=keep\n" + "insmod gzio\n" + "linux %s%s%s%s\n" +- "%s", ++ "%s%s", + GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", +- initrd ? initrd : ""); ++ initrd ? initrd : "", dt ? dt : ""); + + grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry); + grub_dprintf ("blscfg", "Added entry %d id:\"%s\"\n", index, id); + + finish: ++ grub_free (dt); + grub_free (initrd); + grub_free (initrd_prefix); + grub_free (early_initrds); ++ grub_free (devicetree); + grub_free (initrds); + grub_free (options); + grub_free (classes); diff --git a/0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch b/0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch new file mode 100644 index 00000000..2da87d63 --- /dev/null +++ b/0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Sun, 15 Sep 2019 10:05:29 +0200 +Subject: [PATCH] Set a devicetree var in a BLS config if GRUB_DEFAULT_DTB is + present + +The BootLoaderSpec mentions that a devicetree field can be used to pass a +Device Tree (DT) to the kernel, for the platforms that use it to describe +information about the hardware. + +The blscfg module supports parsing the field from the BLS snippets but it +allows to set a DT for all the entries if a devicetree env var is defined. + +Make the grub2-mkconfig tool to set this variable if GRUB_DEFAULT_DTB was +defined in the /etc/default/grub file. + +Resolves: rhbz#1751307 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 301594a0c9e..1520b7e47c1 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -138,6 +138,10 @@ EOF + if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then + ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" + fi ++ ++ if [ -n "${GRUB_DEFAULT_DTB}" ]; then ++ ${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}" ++ fi + fi + + exit 0 diff --git a/grub.patches b/grub.patches index 55e8f81e..81fa7d8a 100644 --- a/grub.patches +++ b/grub.patches @@ -176,3 +176,7 @@ Patch0175: 0175-Do-better-in-bootstrap.conf.patch Patch0176: 0176-Use-git-to-apply-gnulib-patches.patch Patch0177: 0177-autogen.sh-use-find-wholename-for-long-path-matches.patch Patch0178: 0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch +Patch0179: 0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch +Patch0180: 0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch +Patch0181: 0181-blscfg-Add-support-for-the-devicetree-field.patch +Patch0182: 0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch diff --git a/grub2.spec b/grub2.spec index f536e71c..c7e95ea6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -311,13 +311,6 @@ elif [ -f /etc/grub.d/01_users ] && \ fi fi -%posttrans tools - -if [ -f /etc/default/grub ]; then - ! grep -q '^GRUB_ENABLE_BLSCFG=.*' /etc/default/grub && \ - /sbin/grub2-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || : -fi - %triggerun -- grub2 < 1:1.99-4 # grub2 < 1.99-4 removed a number of essential files in postun. To fix upgrades # from the affected grub2 packages, we first back up the files in triggerun and @@ -522,6 +515,12 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Wed Sep 18 2019 Javier Martinez Canillas - 2.04-2 +- A couple of RISC-V fixes +- Remove grub2-tools %%posttrans scriptlet that migrates to a BLS config +- Add blscfg device tree support + Resolves: rhbz#1751307 + * Thu Aug 15 2019 Javier Martinez Canillas - 2.04-1 - Update to 2.04 Resolves: rhbz#1727279 From 7ea60527554d336084c88288e57beb35022891d0 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 14 Oct 2019 17:33:56 +0200 Subject: [PATCH 003/294] 20-grub-install: Don't add an id field to generated BLS snippets The id field isn't used anymore by the blscfg module and instead the BLS filename without the .conf is used as the id for the generated menu entry. Signed-off-by: Javier Martinez Canillas --- 20-grub.install | 1 - 1 file changed, 1 deletion(-) diff --git a/20-grub.install b/20-grub.install index cd58c48b..ff36b1b3 100755 --- a/20-grub.install +++ b/20-grub.install @@ -43,7 +43,6 @@ version ${kernelver}${debugid} linux /vmlinuz-${kernelver} initrd /initramfs-${kernelver}.img options \$kernelopts -id ${ID}-${datetime}-${kernelver} grub_users \$grub_users grub_arg --unrestricted grub_class kernel${flavor} From 897e3887631156182ef342c7d428fea1a522d1ae Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 9 Oct 2019 11:11:56 +0200 Subject: [PATCH 004/294] 99-grub-mkconfig: Disable BLS usage for Xen machines PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support. Also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from 10_linux. So BLS support needs to be disabled for both Xen Dom0 and DomU and use a traditional grub.cfg file generated by the grub2-mkconfig tool. Resolves: rhbz#1703700 Signed-off-by: Javier Martinez Canillas Tested-by: Steven Haigh --- 99-grub-mkconfig.install | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index e3708993..339b3c77 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -4,10 +4,30 @@ if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then exit 0 fi -ARCH=$(uname -m) +# PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support, +# also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from +# 10_linux. So BLS support needs to be disabled for both Xen Dom0 and DomU. +if [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then + RUN_MKCONFIG=true + DISABLE_BLS=true +fi -# Is only needed for ppc64* since we can't assume a BLS capable bootloader there -if [[ $ARCH != "ppc64" && $ARCH != "ppc64le" ]]; then +ARCH=$(uname -m) +# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to +# be run to generate a GRUB config file that contains menuentry commands. +if [[ $ARCH = "ppc64le" ]]; then + RUN_MKCONFIG=true +fi + +if [[ $DISABLE_BLS = "true" ]]; then + if grep -q '^GRUB_ENABLE_BLSCFG="*true"*\s*$' /etc/default/grub; then + sed -i 's/^GRUB_ENABLE_BLSCFG=.*/GRUB_ENABLE_BLSCFG=false/' /etc/default/grub + fi +fi + +# A traditional grub configuration file needs to be generated only in the case when +# the bootloaders are not capable of populating a menu entry from the BLS fragments. +if [[ $RUN_MKCONFIG != "true" ]]; then exit 0 fi From d3ceae4bfd5a758e80daaf9adf46d5fd89ef86b2 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 17 Oct 2019 13:36:25 +0200 Subject: [PATCH 005/294] Some BLS cleanups and fixes - 20-grub-install: Don't add an id field to generated BLS snippets - 99-grub-mkconfig: Disable BLS usage for Xen machines Resolves: rhbz#1703700 - Don't add a class option to menu entries generated for ppc64le Resolves: rhbz#1758225 - 10_linux.in: Also use GRUB_CMDLINE_LINUX_DEFAULT to set kernelopts - blscfg: Don't hardcode an env var as fallback for the BLS options field Resolves: rhbz#1710483 Signed-off-by: Javier Martinez Canillas --- ...s-option-to-menu-entries-generated-f.patch | 78 +++++++++++++++++++ ...-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch | 45 +++++++++++ ...dcode-an-env-var-as-fallback-for-the.patch | 63 +++++++++++++++ grub.patches | 3 + grub2.spec | 12 ++- 5 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch create mode 100644 0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch create mode 100644 0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch diff --git a/0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch b/0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch new file mode 100644 index 00000000..d1366182 --- /dev/null +++ b/0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Fri, 4 Oct 2019 16:43:05 +0200 +Subject: [PATCH] Don't add a class option to menu entries generated for + ppc64le + +For ppc64le a grub config file with menuentry commands is still generated +even when BLS support is enabled. That's because BLS support was added to +Petitboot 1.8.0 and any previous version won't be able to parse BLS files. + +To make the BLS snippets the source of truth, these are used to generate +the menuentry commands in the grub config file. + +And to keep it consistent across all ppc64le machines regardless of the +firmware used, the grub config file is also generated for machines with +OF that use grub2 and would have BLS support. + +The BLS snippets created by the kernel package have fields that are used +to specify the generated menuentry command users and class options. These +fields are not present in BLS snippets created by OSTree though, so the +script generating the menuentry commands will add options with an empty +argument which will lead to grub failing to parse them. + +We could check if the field is defined before attempting to add those, but +since the grub2 blscfg module also supports setting these to variables, it +could lead to an empty argument even if was defined in the BLS snippet if +the variable doesn't exist. + +So to make more robust, just don't add a class to the menuentry commands +generated by the script. It's better to not have a class for the menuentry +than grub2 failing to parse the command and not populating the boot menu. + +Resolves: rhbz#1758225 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux_bls.in | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in +index 1b7536435f1..68fbedf2129 100644 +--- a/util/grub.d/10_linux_bls.in ++++ b/util/grub.d/10_linux_bls.in +@@ -127,9 +127,7 @@ read_config() + initrd="" + options="" + linux="" +- grub_users="" + grub_arg="" +- grub_class="" + + while read -r line + do +@@ -148,15 +146,9 @@ read_config() + "options") + options=${value} + ;; +- "grub_users") +- grub_users=${value} +- ;; + "grub_arg") + grub_arg=${value} + ;; +- "grub_class") +- grub_class=${value} +- ;; + esac + done < ${config_file} + } +@@ -180,7 +172,7 @@ populate_menu() + for bls in "${files[@]}" ; do + read_config "${blsdir}/${bls}.conf" + +- menu="${menu}menuentry '${title}' --class ${grub_class} ${grub_arg} --id=${bls} {\n" ++ menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" + menu="${menu}\t linux ${linux} ${options}\n" + if [ -n "${initrd}" ] ; then + menu="${menu}\t initrd ${boot_prefix}${initrd}\n" diff --git a/0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch b/0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch new file mode 100644 index 00000000..f4aa0084 --- /dev/null +++ b/0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 15 Oct 2019 09:08:25 +0200 +Subject: [PATCH] 10_linux.in: Also use GRUB_CMDLINE_LINUX_DEFAULT to set + kernelopts + +The GRUB documentation mentions that there are two variables to set the +linux kernel cmdline: GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT. + +The former is added to all the menuentry commands and the latter is not +added to the recovery mode menu entries. But the blscfg module doesn't +populate recovery entries from the BLS snippets, so the values set in the +GRUB_CMDLINE_LINUX_DEFAULT variable should also be included in kernelopts. + +This is needed because the GRUB_CMDLINE_LINUX_DEFAULT option is mentioned +in the GRUB documentation so users assume that the kernel cmdline options +can be changed by setting this option and running the grub2-mkconfig tool. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 1520b7e47c1..0471464e68e 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -118,7 +118,7 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + populate_header_warn + + cat << EOF +-set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}" ++set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + + insmod blscfg + blscfg +@@ -134,7 +134,7 @@ EOF + fi + fi + +- ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}" ++ ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then + ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" + fi diff --git a/0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch b/0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch new file mode 100644 index 00000000..669c7709 --- /dev/null +++ b/0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 14 Oct 2019 17:37:26 +0200 +Subject: [PATCH] blscfg: Don't hardcode an env var as fallback for the BLS + options field + +If the BLS fragments don't have an options field or if this was set to an +environment variable that was not defined in the grubenv file, the blscfg +module searches for an default_kernelopts variable that is defined in the +grub.cfg file. + +But the blscfg module shouldn't hardcode fallbacks variables and instead +this logic should be handled in the GRUB config file itself. + +Also, add a comment explaining where the kernelopts variable is supposed +to be defined and what is the process for the user to change its value. + +Resolves: rhbz#1710483 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 4 ---- + util/grub.d/10_linux.in | 12 +++++++++++- + 2 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 1ec89870483..471975fd2e5 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -733,10 +733,6 @@ static void create_entry (struct bls_entry *entry) + + title = bls_get_val (entry, "title", NULL); + options = expand_val (bls_get_val (entry, "options", NULL)); +- +- if (!options) +- options = expand_val (grub_env_get("default_kernelopts")); +- + initrds = bls_make_list (entry, "initrd", NULL); + + devicetree = expand_val (bls_get_val (entry, "devicetree", NULL)); +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 0471464e68e..21a6915dca3 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -118,7 +118,17 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + populate_header_warn + + cat << EOF +-set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++# The kernelopts variable should be defined in the grubenv file. But to ensure that menu ++# entries populated from BootLoaderSpec files that use this variable work correctly even ++# without a grubenv file, define a fallback kernelopts variable if this has not been set. ++# ++# The kernelopts variable in the grubenv file can be modified using the grubby tool or by ++# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX ++# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both ++# the kernelopts variable in the grubenv file and the fallback kernelopts variable. ++if [ -z "\${kernelopts}" ]; then ++ set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++fi + + insmod blscfg + blscfg diff --git a/grub.patches b/grub.patches index 81fa7d8a..7c802fe4 100644 --- a/grub.patches +++ b/grub.patches @@ -180,3 +180,6 @@ Patch0179: 0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch Patch0180: 0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch Patch0181: 0181-blscfg-Add-support-for-the-devicetree-field.patch Patch0182: 0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch +Patch0183: 0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch +Patch0184: 0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch +Patch0185: 0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch diff --git a/grub2.spec b/grub2.spec index c7e95ea6..c474bb25 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -515,6 +515,16 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Oct 17 2019 Javier Martinez Canillas - 2.04-3 +- 20-grub-install: Don't add an id field to generated BLS snippets +- 99-grub-mkconfig: Disable BLS usage for Xen machines + Resolves: rhbz#1703700 +- Don't add a class option to menu entries generated for ppc64le + Resolves: rhbz#1758225 +- 10_linux.in: Also use GRUB_CMDLINE_LINUX_DEFAULT to set kernelopts +- blscfg: Don't hardcode an env var as fallback for the BLS options field + Resolves: rhbz#1710483 + * Wed Sep 18 2019 Javier Martinez Canillas - 2.04-2 - A couple of RISC-V fixes - Remove grub2-tools %%posttrans scriptlet that migrates to a BLS config From eeeca9c900350ef75724781ab8765fc1c65c88cf Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 26 Nov 2019 11:37:19 +0100 Subject: [PATCH 006/294] grub-set-bootflag: Write new env to tmpfile and then rename Resolves: CVE-2019-14865 Resolves: rhbz#1776580 Signed-off-by: Javier Martinez Canillas --- ...g-Update-comment-about-running-as-ro.patch | 27 ++++ ...g-Write-new-env-to-tmpfile-and-then-.patch | 152 ++++++++++++++++++ grub.patches | 2 + grub2.spec | 7 +- 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch create mode 100644 0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch new file mode 100644 index 00000000..cd4ef775 --- /dev/null +++ b/0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 13 Nov 2019 12:15:43 +0100 +Subject: [PATCH] grub-set-bootflag: Update comment about running as root + through pkexec + +We have stopped using pkexec for grub-set-bootflag, instead it is now +installed suid root, update the comment accordingly. + +Signed-off-by: Hans de Goede +--- + util/grub-set-bootflag.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c +index 6a79ee67444..65d74ce010f 100644 +--- a/util/grub-set-bootflag.c ++++ b/util/grub-set-bootflag.c +@@ -18,7 +18,7 @@ + */ + + /* +- * NOTE this gets run by users as root (through pkexec), so this does not ++ * NOTE this gets run by users as root (its suid root), so this does not + * use any grub library / util functions to allow for easy auditing. + * The grub headers are only included to get certain defines. + */ diff --git a/0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch new file mode 100644 index 00000000..122bf686 --- /dev/null +++ b/0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch @@ -0,0 +1,152 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 13 Nov 2019 13:02:01 +0100 +Subject: [PATCH] grub-set-bootflag: Write new env to tmpfile and then rename + +Make the grubenv writing code in grub-set-bootflag more robust by +writing the modified grubenv to a tmpfile first and then renaming the +tmpfile over the old grubenv (following symlinks). + +Signed-off-by: Hans de Goede +--- + util/grub-set-bootflag.c | 87 +++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 78 insertions(+), 9 deletions(-) + +diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c +index 65d74ce010f..d1c5e28862b 100644 +--- a/util/grub-set-bootflag.c ++++ b/util/grub-set-bootflag.c +@@ -28,7 +28,9 @@ + #include + #include /* For GRUB_ENVBLK_DEFCFG define */ + #include ++#include + #include ++#include + #include + #include + +@@ -54,8 +56,10 @@ int main(int argc, char *argv[]) + { + /* NOTE buf must be at least the longest bootflag length + 4 bytes */ + char env[GRUBENV_SIZE + 1], buf[64], *s; ++ /* +1 for 0 termination, +6 for "XXXXXX" in tmp filename */ ++ char env_filename[PATH_MAX + 1], tmp_filename[PATH_MAX + 6 + 1]; + const char *bootflag; +- int i, len, ret; ++ int i, fd, len, ret; + FILE *f; + + if (argc != 2) +@@ -77,7 +81,32 @@ int main(int argc, char *argv[]) + bootflag = bootflags[i]; + len = strlen (bootflag); + +- f = fopen (GRUBENV, "r"); ++ /* ++ * Really become root. setuid avoids an user killing us, possibly leaking ++ * the tmpfile. setgid avoids the new grubenv's gid being that of the user. ++ */ ++ ret = setuid(0); ++ if (ret) ++ { ++ perror ("Error setuid(0) failed"); ++ return 1; ++ } ++ ++ ret = setgid(0); ++ if (ret) ++ { ++ perror ("Error setgid(0) failed"); ++ return 1; ++ } ++ ++ /* Canonicalize GRUBENV filename, resolving symlinks, etc. */ ++ if (!realpath(GRUBENV, env_filename)) ++ { ++ perror ("Error canonicalizing " GRUBENV " filename"); ++ return 1; ++ } ++ ++ f = fopen (env_filename, "r"); + if (!f) + { + perror ("Error opening " GRUBENV " for reading"); +@@ -132,30 +161,70 @@ int main(int argc, char *argv[]) + snprintf(buf, sizeof(buf), "%s=1\n", bootflag); + memcpy(s, buf, len + 3); + +- /* "r+", don't truncate so that the diskspace stays reserved */ +- f = fopen (GRUBENV, "r+"); ++ ++ /* ++ * Create a tempfile for writing the new env. Use the canonicalized filename ++ * for the template so that the tmpfile is in the same dir / on same fs. ++ */ ++ snprintf(tmp_filename, sizeof(tmp_filename), "%sXXXXXX", env_filename); ++ fd = mkstemp(tmp_filename); ++ if (fd == -1) ++ { ++ perror ("Creating tmpfile failed"); ++ return 1; ++ } ++ ++ f = fdopen (fd, "w"); + if (!f) + { +- perror ("Error opening " GRUBENV " for writing"); ++ perror ("Error fdopen of tmpfile failed"); ++ unlink(tmp_filename); + return 1; + } + + ret = fwrite (env, 1, GRUBENV_SIZE, f); + if (ret != GRUBENV_SIZE) + { +- perror ("Error writing to " GRUBENV); ++ perror ("Error writing tmpfile"); ++ unlink(tmp_filename); + return 1; + } + + ret = fflush (f); + if (ret) + { +- perror ("Error flushing " GRUBENV); ++ perror ("Error flushing tmpfile"); ++ unlink(tmp_filename); + return 1; + } + +- fsync (fileno (f)); +- fclose (f); ++ ret = fsync (fileno (f)); ++ if (ret) ++ { ++ perror ("Error syncing tmpfile"); ++ unlink(tmp_filename); ++ return 1; ++ } ++ ++ ret = fclose (f); ++ if (ret) ++ { ++ perror ("Error closing tmpfile"); ++ unlink(tmp_filename); ++ return 1; ++ } ++ ++ /* ++ * And finally rename the tmpfile with the new env over the old env, the ++ * linux kernel guarantees that this is atomic (from a syscall pov). ++ */ ++ ret = rename(tmp_filename, env_filename); ++ if (ret) ++ { ++ perror ("Error renaming tmpfile to " GRUBENV " failed"); ++ unlink(tmp_filename); ++ return 1; ++ } + + return 0; + } diff --git a/grub.patches b/grub.patches index 7c802fe4..ca20509d 100644 --- a/grub.patches +++ b/grub.patches @@ -183,3 +183,5 @@ Patch0182: 0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch Patch0183: 0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch Patch0184: 0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch Patch0185: 0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch +Patch0186: 0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0187: 0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/grub2.spec b/grub2.spec index c474bb25..27d050c2 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -515,6 +515,11 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Tue Nov 26 2019 Javier Martinez Canillas - 2.04-4 +- grub-set-bootflag: Write new env to tmpfile and then rename (hdegoede) + Resolves: CVE-2019-14865 + Resolves: rhbz#1776580 + * Thu Oct 17 2019 Javier Martinez Canillas - 2.04-3 - 20-grub-install: Don't add an id field to generated BLS snippets - 99-grub-mkconfig: Disable BLS usage for Xen machines From 5db4bc774e6074c63ff9833024811dc51bd59fc6 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 27 Nov 2019 12:10:51 +0100 Subject: [PATCH 007/294] Fix a grub hidden-menu regression and a bug in blscfg variable expansion Signed-off-by: Javier Martinez Canillas --- ...ce-char-when-appending-fields-for-va.patch | 51 +++++++++++++ ...indeterminate-getting-set-on-boot_su.patch | 75 +++++++++++++++++++ grub.patches | 2 + grub2.spec | 6 +- 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch create mode 100644 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch b/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch new file mode 100644 index 00000000..30314a5b --- /dev/null +++ b/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 26 Nov 2019 09:51:41 +0100 +Subject: [PATCH] blscfg: add a space char when appending fields for variable + expansion + +The GRUB variables are expanded and replaced by their values before adding +menu entries, but they didn't include space characters after the values so +the result was not correct. + +For the common case this wasn't a problem but it is if there are variables +that are part of the values of other variables. + +Resolves: rhbz#1669252 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 471975fd2e5..32d3252502e 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -602,17 +602,16 @@ static char *field_append(bool is_var, char *buffer, char *start, char *end) + return buffer; + } + +- if (!buffer) { +- buffer = grub_strdup(field); +- if (!buffer) +- return NULL; +- } else { +- buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field)); +- if (!buffer) +- return NULL; ++ if (!buffer) ++ buffer = grub_zalloc (grub_strlen(field) + 1); ++ else ++ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field) + 1); + +- grub_stpcpy (buffer + grub_strlen(buffer), field); +- } ++ if (!buffer) ++ return NULL; ++ ++ grub_stpcpy (buffer + grub_strlen(buffer), field); ++ grub_stpcpy (buffer + grub_strlen(buffer), " "); + + return buffer; + } diff --git a/0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch new file mode 100644 index 00000000..54b73e6c --- /dev/null +++ b/0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 26 Nov 2019 09:51:41 +0100 +Subject: [PATCH] grub.d: Fix boot_indeterminate getting set on boot_success=0 + boot + +The "grub.d: Split out boot success reset from menu auto hide script" +not only moved the code to clear boot_success and boot_indeterminate +but for some reason also mixed in some broken changes to the +boot_indeterminate handling. + +The boot_indeterminate var is meant to suppress the boot menu after +a reboot from either a selinux-relabel or offline-updates. These +2 special boot scenarios do not set boot_success since there is no +successfull interaction with the user. Instead they increment +boot_indeterminate, and if it is 1 and only when it is 1, so the +first reboot after a "special" boot we suppress the menu. + +To ensure that we do show the menu if we somehow get stuck in a +"special" boot loop where we do special-boots without them +incrementing boot_indeterminate, the code before the +"grub.d: Split out boot success reset from menu auto hide script" +commit would increment boot_indeterminate once when it is 1, so that +even if the "special" boot reboot-loop immediately we would show the +menu on the next boot. + +That commit broke this however, because it not only moves the code, +it also changes it from only "incrementing" boot_indeterminate once to +always incrementing it, except when boot_success == 1 (and we reset it). + +This broken behavior causes the following problem: + +1. Boot a broken kernel, system hangs, power-cycle +2. boot_success now != 1, so we increment boot_indeterminate from 0 + (unset!) to 1. User either simply tries again, or makes some changes + but the end-result still is a system hang, power-cycle +3. Now boot_indeterminate==1 so we do not show the menu even though the + previous boot failed -> BAD + +This commit fixes this by restoring the behavior of setting +boot_indeterminate to 2 when it was 1 before. + +Fixes: "grub.d: Split out boot success reset from menu auto hide script" +Signed-off-by: Hans de Goede +--- + util/grub.d/10_reset_boot_success.in | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in +index 6c88d933dde..737e1ae5b68 100644 +--- a/util/grub.d/10_reset_boot_success.in ++++ b/util/grub.d/10_reset_boot_success.in +@@ -6,18 +6,18 @@ + # + # The boot_success var needs to be set to 1 from userspace to mark a boot successful. + cat << EOF +-insmod increment + # Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry + if [ "\${boot_success}" = "1" -o "\${boot_indeterminate}" = "1" ]; then + set menu_hide_ok=1 + else + set menu_hide_ok=0 + fi +-# Reset boot_indeterminate after a successful boot, increment otherwise ++# Reset boot_indeterminate after a successful boot + if [ "\${boot_success}" = "1" ] ; then + set boot_indeterminate=0 +-else +- increment boot_indeterminate ++# Avoid boot_indeterminate causing the menu to be hidden more then once ++elif [ "\${boot_indeterminate}" = "1" ]; then ++ set boot_indeterminate=2 + fi + # Reset boot_success for current boot + set boot_success=0 diff --git a/grub.patches b/grub.patches index ca20509d..afac6437 100644 --- a/grub.patches +++ b/grub.patches @@ -185,3 +185,5 @@ Patch0184: 0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch Patch0185: 0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch Patch0186: 0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch Patch0187: 0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0188: 0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch +Patch0189: 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/grub2.spec b/grub2.spec index 27d050c2..cfa434bd 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -515,6 +515,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Wed Nov 27 2019 Javier Martinez Canillas - 2.04-5 +- blscfg: add a space char when appending fields for variable expansion +- grub.d: Fix boot_indeterminate getting set on boot_success=0 boot + * Tue Nov 26 2019 Javier Martinez Canillas - 2.04-4 - grub-set-bootflag: Write new env to tmpfile and then rename (hdegoede) Resolves: CVE-2019-14865 From 8733281382c3c3509d8abb68611712afd17eb58a Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 4 Dec 2019 19:42:12 +0000 Subject: [PATCH 008/294] various grub2 cleanups - drop deprecated groups from the macros file, already gone from main spec. - don't ship arch specific bits in tools-extra that are already special cased in tools - move grub2-glue-efi to tools-efi, it's Mac specific and there's othe Mac efi tools there - drop tools-extra dep for efi binaries, all in tools-efi and anaconda deals with that - put grub2-install man page in the right package with the util - other minor cleanups --- grub.macros | 7 ------- grub2.spec | 30 ++++++++++++++---------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/grub.macros b/grub.macros index 5da3592e..5e88439d 100644 --- a/grub.macros +++ b/grub.macros @@ -224,7 +224,6 @@ %define define_legacy_variant() \ %{expand:%%package %%{1}} \ Summary: Bootloader with support for Linux, Multiboot, and more \ -Group: System Environment/Base \ Provides: %{name} = %{evr} \ Obsoletes: %{name} < %{evr} \ Requires: %{name}-common = %{evr} \ @@ -243,7 +242,6 @@ This subpackage provides support for %{1} systems. \ %{expand:%%if 0%%{with_legacy_modules} \ %%package %%{1}-modules \ Summary: Modules used to build custom grub images \ -Group: System Environment/Base \ BuildArch: noarch \ Requires: %%{name}-common = %%{evr} \ %%description %%{1}-modules \ @@ -255,7 +253,6 @@ This subpackage provides support for rebuilding your own grub.efi. \ %{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\ %{expand:%%package %%{1}-tools} \ Summary: Support tools for GRUB. \ -Group: System Environment/Base \ Requires: gettext os-prober which file system-logos \ Requires: %{name}-common = %{evr} \ Requires: %{name}-tools-minimal = %{evr} \ @@ -270,11 +267,9 @@ This subpackage provides tools for support of %%{1} platforms. \ %define define_efi_variant(o) \ %{expand:%%package %{1}} \ Summary: GRUB for EFI systems. \ -Group: System Environment/Base \ Requires: efi-filesystem \ Requires: %{name}-common = %{evr} \ Requires: %{name}-tools-minimal >= %{evr} \ -Requires: %{name}-tools-extra = %{evr} \ Requires: %{name}-tools = %{evr} \ Provides: %{name}-efi = %{evr} \ %{?legacy_provides:Provides: %{name} = %{evr}} \ @@ -288,7 +283,6 @@ This subpackage provides support for %{1} systems. \ %{expand:%if 0%{?with_efi_modules} \ %{expand:%%package %{1}-modules} \ Summary: Modules used to build custom grub.efi images \ -Group: System Environment/Base \ BuildArch: noarch \ Requires: %{name}-common = %{evr} \ Provides: %{name}-efi-modules = %{evr} \ @@ -300,7 +294,6 @@ This subpackage provides support for rebuilding your own grub.efi. \ \ %{expand:%%package %{1}-cdboot} \ Summary: Files used to boot removeable media with EFI \ -Group: System Environment/Base \ Requires: %{name}-common = %{evr} \ Provides: %{name}-efi-cdboot = %{evr} \ %{expand:%%description %{1}-cdboot} \ diff --git a/grub2.spec b/grub2.spec index cfa434bd..c627c0ff 100644 --- a/grub2.spec +++ b/grub2.spec @@ -354,13 +354,9 @@ rm -r /boot/grub2.tmp/ || : %exclude /boot/grub2/* %dir %attr(0700,root,root) %{efi_esp_dir} %exclude %{efi_esp_dir}/* -%license COPYING %ghost %config(noreplace) /boot/grub2/grubenv -%doc INSTALL -%doc NEWS -%doc README +%license COPYING %doc THANKS -%doc TODO %doc docs/grub.html %doc docs/grub-dev.html %doc docs/font_char_metrics.png @@ -384,10 +380,12 @@ rm -r /boot/grub2.tmp/ || : %ifarch x86_64 %files tools-efi -%{_sbindir}/%{name}-macbless +%{_bindir}/%{name}-glue-efi %{_bindir}/%{name}-render-label -%{_datadir}/man/man8/%{name}-macbless* +%{_sbindir}/%{name}-macbless +%{_datadir}/man/man1/%{name}-glue-efi* %{_datadir}/man/man1/%{name}-render-label* +%{_datadir}/man/man8/%{name}-macbless* %endif %files tools @@ -423,7 +421,6 @@ rm -r /boot/grub2.tmp/ || : # exclude man pages from tools-extra %exclude %{_datadir}/man/man8/%{name}-sparc64-setup* -%exclude %{_datadir}/man/man8/%{name}-install* %exclude %{_datadir}/man/man1/%{name}-fstest* %exclude %{_datadir}/man/man1/%{name}-glue-efi* %exclude %{_datadir}/man/man1/%{name}-kbdcomp* @@ -466,32 +463,33 @@ rm -r /boot/grub2.tmp/ || : %endif %files tools-extra -%{_sbindir}/%{name}-sparc64-setup -%{_sbindir}/%{name}-ofpathname %{_bindir}/%{name}-fstest -%{_bindir}/%{name}-glue-efi %{_bindir}/%{name}-kbdcomp %{_bindir}/%{name}-mkfont %{_bindir}/%{name}-mklayout %{_bindir}/%{name}-mknetdir %ifnarch %{sparc} %{_bindir}/%{name}-mkrescue +%{_datadir}/man/man1/%{name}-mkrescue* +%else +%exclude %{_datadir}/man/man1/%{name}-mkrescue* %endif %{_bindir}/%{name}-mkstandalone %{_bindir}/%{name}-syslinux2cfg %{_sysconfdir}/sysconfig/grub -%{_datadir}/man/man8/%{name}-sparc64-setup* -%{_datadir}/man/man8/%{name}-install* %{_datadir}/man/man1/%{name}-fstest* -%{_datadir}/man/man1/%{name}-glue-efi* %{_datadir}/man/man1/%{name}-kbdcomp* %{_datadir}/man/man1/%{name}-mkfont* %{_datadir}/man/man1/%{name}-mklayout* %{_datadir}/man/man1/%{name}-mknetdir* -%{_datadir}/man/man1/%{name}-mkrescue* %{_datadir}/man/man1/%{name}-mkstandalone* -%{_datadir}/man/man8/%{name}-ofpathname* %{_datadir}/man/man1/%{name}-syslinux2cfg* +%exclude %{_bindir}/%{name}-glue-efi +%exclude %{_sbindir}/%{name}-sparc64-setup +%exclude %{_sbindir}/%{name}-ofpathname +%exclude %{_datadir}/man/man1/%{name}-glue-efi* +%exclude %{_datadir}/man/man8/%{name}-ofpathname* +%exclude %{_datadir}/man/man8/%{name}-sparc64-setup* %exclude %{_datarootdir}/grub/themes/starfield %if 0%{with_efi_arch} From 3f3dfd400691a90398296f01532b106e7185037e Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 5 Dec 2019 17:03:13 +0100 Subject: [PATCH 009/294] A couple BLS fixes and various grub2 cleanups - Various grub2 cleanups (pbrobinson) - Another fix for blscfg variable expansion support - blscfg: Add support for sorting the plus ('+') higher than base version Resolves: rhbz#1767395 Signed-off-by: Javier Martinez Canillas --- ...ce-char-when-appending-fields-for-va.patch | 41 ++++++++++--- ...rt-for-sorting-the-plus-higher-than-.patch | 59 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 8 ++- 4 files changed, 100 insertions(+), 9 deletions(-) create mode 100644 0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch diff --git a/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch b/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch index 30314a5b..9f692382 100644 --- a/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch +++ b/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch @@ -15,14 +15,27 @@ Resolves: rhbz#1669252 Signed-off-by: Javier Martinez Canillas --- - grub-core/commands/blscfg.c | 19 +++++++++---------- - 1 file changed, 9 insertions(+), 10 deletions(-) + grub-core/commands/blscfg.c | 31 ++++++++++++++++++------------- + 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 471975fd2e5..32d3252502e 100644 +index 471975fd2e5..d78cff79f97 100644 --- a/grub-core/commands/blscfg.c +++ b/grub-core/commands/blscfg.c -@@ -602,17 +602,16 @@ static char *field_append(bool is_var, char *buffer, char *start, char *end) +@@ -593,26 +593,29 @@ static char **bls_make_list (struct bls_entry *entry, const char *key, int *num) + + static char *field_append(bool is_var, char *buffer, char *start, char *end) + { +- char *temp = grub_strndup(start, end - start + 1); +- const char *field = temp; ++ char *tmp = grub_strndup(start, end - start + 1); ++ const char *field = tmp; ++ int term = is_var ? 2 : 1; + + if (is_var) { +- field = grub_env_get (temp); ++ field = grub_env_get (tmp); + if (!field) return buffer; } @@ -35,17 +48,29 @@ index 471975fd2e5..32d3252502e 100644 - if (!buffer) - return NULL; + if (!buffer) -+ buffer = grub_zalloc (grub_strlen(field) + 1); ++ buffer = grub_zalloc (grub_strlen(field) + term); + else -+ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field) + 1); ++ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field) + term); - grub_stpcpy (buffer + grub_strlen(buffer), field); - } + if (!buffer) + return NULL; + -+ grub_stpcpy (buffer + grub_strlen(buffer), field); -+ grub_stpcpy (buffer + grub_strlen(buffer), " "); ++ tmp = buffer + grub_strlen(buffer); ++ tmp = grub_stpcpy (tmp, field); ++ ++ if (is_var) ++ tmp = grub_stpcpy (tmp, " "); return buffer; } +@@ -642,6 +645,8 @@ static char *expand_val(char *value) + buffer = field_append(is_var, buffer, start, end); + is_var = false; + start = value; ++ if (*start == ' ') ++ start++; + } + } + diff --git a/0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch b/0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch new file mode 100644 index 00000000..2df15bf5 --- /dev/null +++ b/0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 4 Nov 2019 17:33:30 +0100 +Subject: [PATCH] blscfg: Add support for sorting the plus ('+') higher than + base version + +Handle plus separator. Concept is the same as tilde, except that if one of +the strings ends (base version), the other is considered as higher version. + +A plus character is used for example by the Linux kernel build system to +denote that is the base version plus some changes on top of it. + +Currently for example rpmvercmp("5.3.0", "5.3.0+") will return 0 even when +the two versions are not the same. + +Resolves: rhbz#1767395 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index d78cff79f97..83b33c1cd93 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -163,8 +163,8 @@ static int vercmp(const char * a, const char * b) + + /* loop through each version segment of str1 and str2 and compare them */ + while (*one || *two) { +- while (*one && !grub_isalnum(*one) && *one != '~') one++; +- while (*two && !grub_isalnum(*two) && *two != '~') two++; ++ while (*one && !grub_isalnum(*one) && *one != '~' && *one != '+') one++; ++ while (*two && !grub_isalnum(*two) && *two != '~' && *two != '+') two++; + + /* handle the tilde separator, it sorts before everything else */ + if (*one == '~' || *two == '~') { +@@ -175,6 +175,21 @@ static int vercmp(const char * a, const char * b) + continue; + } + ++ /* ++ * Handle plus separator. Concept is the same as tilde, ++ * except that if one of the strings ends (base version), ++ * the other is considered as higher version. ++ */ ++ if (*one == '+' || *two == '+') { ++ if (!*one) return -1; ++ if (!*two) return 1; ++ if (*one != '+') goto_return (1); ++ if (*two != '+') goto_return (-1); ++ one++; ++ two++; ++ continue; ++ } ++ + /* If we ran to the end of either, we are finished with the loop */ + if (!(*one && *two)) break; + diff --git a/grub.patches b/grub.patches index afac6437..26cd85e0 100644 --- a/grub.patches +++ b/grub.patches @@ -187,3 +187,4 @@ Patch0186: 0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch Patch0187: 0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch Patch0188: 0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch Patch0189: 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0190: 0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch diff --git a/grub2.spec b/grub2.spec index c627c0ff..e5175f5c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -513,6 +513,12 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Dec 05 2019 Javier Martinez Canillas - 2.04-6 +- Various grub2 cleanups (pbrobinson) +- Another fix for blscfg variable expansion support +- blscfg: Add support for sorting the plus ('+') higher than base version + Resolves: rhbz#1767395 + * Wed Nov 27 2019 Javier Martinez Canillas - 2.04-5 - blscfg: add a space char when appending fields for variable expansion - grub.d: Fix boot_indeterminate getting set on boot_success=0 boot From af4ccfff6b8c74af904688697cf555617b8ec470 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 12 Dec 2019 02:04:27 +0000 Subject: [PATCH 010/294] drop tools-extra from grub2-pc dependencies --- grub.macros | 1 - 1 file changed, 1 deletion(-) diff --git a/grub.macros b/grub.macros index 5e88439d..d2735cfd 100644 --- a/grub.macros +++ b/grub.macros @@ -230,7 +230,6 @@ Requires: %{name}-common = %{evr} \ Requires: %{name}-tools-minimal = %{evr} \ Requires: %{name}-%{1}-modules = %{evr} \ Requires: gettext which file \ -Requires: %{name}-tools-extra = %{evr} \ Requires: %{name}-tools = %{evr} \ Requires(pre): dracut \ Requires(post): dracut \ From 0cb30b7d2bffe8e4d8793af99530bb26779350e1 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 26 Sep 2019 12:49:22 -0400 Subject: [PATCH 011/294] Renumber sources This gets rid of the vestigial remnants of the now-obsolete release-to-master.patch , and moves gnulib to be earlier in our source list. Signed-off-by: Peter Jones --- grub.macros | 2 +- grub2.spec | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/grub.macros b/grub.macros index d2735cfd..a2184178 100644 --- a/grub.macros +++ b/grub.macros @@ -307,7 +307,7 @@ cp %{SOURCE6} .gitignore \ cp %{SOURCE7} bootstrap \ cp %{SOURCE8} bootstrap.conf \ cp %{SOURCE9} ./grub-core/tests/strtoull_test.c \ -cp %{SOURCE12} gnulib-%{gnulibversion}.tar.gz \ +cp %{SOURCE2} gnulib-%{gnulibversion}.tar.gz \ tar -zxf gnulib-%{gnulibversion}.tar.gz \ mv gnulib-%{gnulibversion} gnulib \ git init \ diff --git a/grub2.spec b/grub2.spec index e5175f5c..47498ab9 100644 --- a/grub2.spec +++ b/grub2.spec @@ -16,8 +16,8 @@ URL: http://www.gnu.org/software/grub/ Obsoletes: grub < 1:0.98 Source0: https://ftp.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz Source1: grub.macros -Source2: grub.patches -#Source3: release-to-master.patch +Source2: gnulib-%{gnulibversion}.tar.gz +Source3: 99-grub-mkconfig.install Source4: http://unifoundry.com/unifont-5.1.20080820.pcf.gz Source5: theme.tar.bz2 Source6: gitignore @@ -25,14 +25,10 @@ Source7: bootstrap Source8: bootstrap.conf Source9: strtoull_test.c Source10: 20-grub.install -Source11: 99-grub-mkconfig.install -Source12: gnulib-%{gnulibversion}.tar.gz +Source11: grub.patches %include %{SOURCE1} -# generate with do-rebase -%include %{SOURCE2} - BuildRequires: gcc efi-srpm-macros BuildRequires: flex bison binutils python3 BuildRequires: ncurses-devel xz-devel bzip2-devel @@ -69,6 +65,9 @@ variety of kernel formats, file systems, computer architectures and \ hardware devices.\ %{nil} +# generate with do-rebase +%include %{SOURCE11} + %description %{desc} @@ -248,7 +247,7 @@ EOF # Install kernel-install scripts install -d -m 0755 %{buildroot}%{_prefix}/lib/kernel/install.d/ install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE10} -install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE11} +install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE3} install -d -m 0755 %{buildroot}%{_sysconfdir}/kernel/install.d/ # Install systemd user service to set the boot_success flag install -D -m 0755 -t %{buildroot}%{_userunitdir} \ From 190e583e94000adff67def56409e4411ecaf4fd3 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 6 Jan 2020 10:23:51 -0500 Subject: [PATCH 012/294] Add zstd to the EFI module list. cmurf and javierm noticed[0] that we don't have zstd enabled, and that could cause issues in some cases for /boot on btrfs subvolumes. This adds it to our module list. [0] https://github.com/rhinstaller/anaconda/pull/2255#discussion_r359123085 Related: rhbz#1418336 Signed-off-by: Peter Jones --- grub.macros | 2 +- grub2.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/grub.macros b/grub.macros index a2184178..9ac42a20 100644 --- a/grub.macros +++ b/grub.macros @@ -394,7 +394,7 @@ GRUB_MODULES=" all_video boot blscfg btrfs \\\ password_pbkdf2 pgp png reboot \\\ regexp search search_fs_uuid search_fs_file \\\ search_label serial sleep syslinuxcfg test tftp \\\ - version video xfs" \ + version video xfs zstd " \ GRUB_MODULES+=%{efi_modules} \ %{expand:%%{mkimage %{1} %{2} %{3} %{4}}} \ %{nil} diff --git a/grub2.spec b/grub2.spec index 47498ab9..4a2d5fc1 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -512,6 +512,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Jan 06 2020 Peter Jones - 2.04-7 +- Add zstd to the EFI module list. + Related: rhbz#1418336 + * Thu Dec 05 2019 Javier Martinez Canillas - 2.04-6 - Various grub2 cleanups (pbrobinson) - Another fix for blscfg variable expansion support From 89bc295877ee4e91e1c566c7aacefc89f833ec76 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 13 Jan 2020 19:48:23 +0100 Subject: [PATCH 013/294] Make blscfg to support the GRUB_SAVEDEFAULT option This option was not supported on a BLS configuration. Resolves: rhbz#1704926 Signed-off-by: Javier Martinez Canillas --- 0191-Fix-savedefault-with-blscfg.patch | 50 ++++++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 0191-Fix-savedefault-with-blscfg.patch diff --git a/0191-Fix-savedefault-with-blscfg.patch b/0191-Fix-savedefault-with-blscfg.patch new file mode 100644 index 00000000..51d5b822 --- /dev/null +++ b/0191-Fix-savedefault-with-blscfg.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fritz Elfert +Date: Mon, 13 Jan 2020 19:29:58 +0100 +Subject: [PATCH] Fix savedefault with blscfg + +The GRUB_SAVEDEFAULT option was ignored on a BLS configuration. Fix it by +making the menu entries populated from the BLS files to call savedefault +if a save_default environment variable has been set to "true". + +This variable is set by grub2-mkconfig to the value in GRUB_SAVEDEFAULT. +--- + grub-core/commands/blscfg.c | 5 ++++- + util/grub.d/10_linux.in | 4 ++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 83b33c1cd93..069db721bec 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -889,11 +889,14 @@ static void create_entry (struct bls_entry *entry) + + grub_dprintf ("blscfg2", "devicetree %s for id:\"%s\"\n", dt, id); + +- src = grub_xasprintf ("load_video\n" ++ const char *sdval = grub_env_get("save_default"); ++ bool savedefault = ((NULL != sdval) && (grub_strcmp(sdval, "true") == 0)); ++ src = grub_xasprintf ("%sload_video\n" + "set gfxpayload=keep\n" + "insmod gzio\n" + "linux %s%s%s%s\n" + "%s%s", ++ savedefault ? "savedefault\n" : "", + GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", + initrd ? initrd : "", dt ? dt : ""); + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 21a6915dca3..b70dca27567 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -152,6 +152,10 @@ EOF + if [ -n "${GRUB_DEFAULT_DTB}" ]; then + ${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}" + fi ++ ++ if [ -n "${GRUB_SAVEDEFAULT}" ]; then ++ ${grub_editenv} - set save_default="${GRUB_SAVEDEFAULT}" ++ fi + fi + + exit 0 diff --git a/grub.patches b/grub.patches index 26cd85e0..3b3c6a26 100644 --- a/grub.patches +++ b/grub.patches @@ -188,3 +188,4 @@ Patch0187: 0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch Patch0188: 0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch Patch0189: 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch Patch0190: 0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch +Patch0191: 0191-Fix-savedefault-with-blscfg.patch diff --git a/grub2.spec b/grub2.spec index 4a2d5fc1..f3703653 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -512,6 +512,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Jan 13 2020 Javier Martinez Canillas - 2.04-8 +- Make the blscfg module honour the GRUB_SAVEDEFAULT option (fritz) + Resolves: rhbz#1704926 + * Mon Jan 06 2020 Peter Jones - 2.04-7 - Add zstd to the EFI module list. Related: rhbz#1418336 From b888fb3a328c665133f293240e26718973998f1c Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Fri, 23 Aug 2019 13:38:09 -0700 Subject: [PATCH 014/294] Add RISC-V (riscv64) support to grub.macros Signed-off-by: David Abdurachmanov --- grub.macros | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/grub.macros b/grub.macros index 9ac42a20..bb560e59 100644 --- a/grub.macros +++ b/grub.macros @@ -94,7 +94,7 @@ %endif -%global efi_only aarch64 %{arm} +%global efi_only aarch64 %{arm} riscv64 %global efi_arch x86_64 ia64 %{efi_only} %ifarch %{efi_arch} %global with_efi_arch 1 @@ -112,13 +112,13 @@ %{?with_efi_only:%global without_efi_only 1} ### fixme -%ifarch aarch64 %{arm} +%ifarch aarch64 %{arm} riscv64 %global efi_modules " " %else %global efi_modules " backtrace chain usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug " %endif -%ifarch aarch64 %{arm} +%ifarch aarch64 %{arm} riscv64 %global legacy_provides -l %endif @@ -165,6 +165,14 @@ %global package_arch efi-aa64 %endif +%ifarch riscv64 +%global emuarch riscv64 +%global efiarch riscv64 +%global target_cpu_name riscv64 +%global grub_target_name riscv64-efi +%global package_arch efi-riscv64 +%endif + %ifarch %{arm} %global efiarch arm %global target_cpu_name arm @@ -362,7 +370,7 @@ for x in grub-mkimage ; do \\\ done \ %{nil} -%ifarch x86_64 aarch64 %{arm} +%ifarch x86_64 aarch64 %{arm} riscv64 %define mkimage() \ %{4}./grub-mkimage -O %{1} -o %{2}.orig \\\ -p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \ From fbe5a8c26a09f7f516a8661e24d9ea54bbe76d57 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 15 Jan 2020 10:00:00 +0100 Subject: [PATCH 015/294] A bunch of RISC-V build fixes and some cleanups - Add riscv64 support to grub.macros and RISC-V build fixes (davidlt) - blscfg: Always use the root variable to search for BLS snippets - bootstrap.conf: Force autogen.sh to use python3 Signed-off-by: Javier Martinez Canillas --- ..._EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch | 24 ++++++++++ ...ader-Define-machine-types-for-RISC-V.patch | 31 ++++++++++++ 0194-Add-start-symbol-for-RISC-V.patch | 28 +++++++++++ 0195-RISC-V-Add-__clzdi2-symbol.patch | 43 +++++++++++++++++ ...l-Define-default-platform-for-RISC-V.patch | 31 ++++++++++++ ...e-the-root-variable-to-search-for-BL.patch | 47 +++++++++++++++++++ ...conf-Force-autogen.sh-to-use-python3.patch | 33 +++++++++++++ grub.patches | 7 +++ grub2.spec | 7 ++- 9 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch create mode 100644 0193-chainloader-Define-machine-types-for-RISC-V.patch create mode 100644 0194-Add-start-symbol-for-RISC-V.patch create mode 100644 0195-RISC-V-Add-__clzdi2-symbol.patch create mode 100644 0196-grub-install-Define-default-platform-for-RISC-V.patch create mode 100644 0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch create mode 100644 0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch b/0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch new file mode 100644 index 00000000..b694ec9c --- /dev/null +++ b/0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Thu, 16 Jan 2020 13:10:10 +0100 +Subject: [PATCH] Also define GRUB_EFI_MAX_ALLOCATION_ADDRESS for RISC-V + +The commit "Try to pick better locations for kernel and initrd" missed to +define this macro for the RISC-V (riscv64) architecture, so add it there. + +Signed-off-by: David Abdurachmanov +--- + include/grub/riscv64/efi/memory.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/grub/riscv64/efi/memory.h b/include/grub/riscv64/efi/memory.h +index c6cb3241714..acb61dca44b 100644 +--- a/include/grub/riscv64/efi/memory.h ++++ b/include/grub/riscv64/efi/memory.h +@@ -2,5 +2,6 @@ + #include + + #define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffffffffULL ++#define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS + + #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/0193-chainloader-Define-machine-types-for-RISC-V.patch b/0193-chainloader-Define-machine-types-for-RISC-V.patch new file mode 100644 index 00000000..2ec71003 --- /dev/null +++ b/0193-chainloader-Define-machine-types-for-RISC-V.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Sat, 9 Nov 2019 18:06:32 +0000 +Subject: [PATCH] chainloader: Define machine types for RISC-V + +The commit "Add secureboot support on efi chainloader" didn't add machine +types for RISC-V, so this patch adds them. + +Note, that grub-core/loader/riscv/linux.c is skipped because Linux is not +supported yet. This patch might need a new revision once that's the case. + +Signed-off-by: David Abdurachmanov +--- + grub-core/loader/efi/chainloader.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index f4ddbeda687..2c529f71471 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -316,6 +316,10 @@ static const grub_uint16_t machine_type __attribute__((__unused__)) = + GRUB_PE32_MACHINE_I386; + #elif defined(__ia64__) + GRUB_PE32_MACHINE_IA64; ++#elif defined(__riscv) && (__riscv_xlen == 32) ++ GRUB_PE32_MACHINE_RISCV32; ++#elif defined(__riscv) && (__riscv_xlen == 64) ++ GRUB_PE32_MACHINE_RISCV64; + #else + #error this architecture is not supported by grub2 + #endif diff --git a/0194-Add-start-symbol-for-RISC-V.patch b/0194-Add-start-symbol-for-RISC-V.patch new file mode 100644 index 00000000..677efae0 --- /dev/null +++ b/0194-Add-start-symbol-for-RISC-V.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Sat, 9 Nov 2019 19:51:57 +0000 +Subject: [PATCH] Add start symbol for RISC-V + +All other architectures have start symbol. + +Hopefully this resolves: + + BUILDSTDERR: ././grub-mkimage: error: undefined symbol start. + +Signed-off-by: David Abdurachmanov +--- + grub-core/kern/riscv/efi/startup.S | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/grub-core/kern/riscv/efi/startup.S b/grub-core/kern/riscv/efi/startup.S +index f2a7b2b1ede..781773136e8 100644 +--- a/grub-core/kern/riscv/efi/startup.S ++++ b/grub-core/kern/riscv/efi/startup.S +@@ -29,6 +29,7 @@ + + .file "startup.S" + .text ++FUNCTION(start) + FUNCTION(_start) + /* + * EFI_SYSTEM_TABLE and EFI_HANDLE are passed in a1/a0. diff --git a/0195-RISC-V-Add-__clzdi2-symbol.patch b/0195-RISC-V-Add-__clzdi2-symbol.patch new file mode 100644 index 00000000..492aaef3 --- /dev/null +++ b/0195-RISC-V-Add-__clzdi2-symbol.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Thu, 19 Sep 2019 09:39:04 +0200 +Subject: [PATCH] RISC-V: Add __clzdi2 symbol + +This is needed for the zstd module build for riscv64-emu. + +Signed-off-by: Andreas Schwab +Reviewed-by: Daniel Kiper +--- + configure.ac | 2 +- + include/grub/compiler-rt-emu.h | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 5076d635c57..eff160b6931 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1444,7 +1444,7 @@ fi + + # Check for libgcc symbols + if test x"$platform" = xemu; then +-AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms) ++AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __clzdi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms) + fi + + if test "x$TARGET_APPLE_LINKER" = x1 ; then +diff --git a/include/grub/compiler-rt-emu.h b/include/grub/compiler-rt-emu.h +index b21425d9eb8..fde620ac186 100644 +--- a/include/grub/compiler-rt-emu.h ++++ b/include/grub/compiler-rt-emu.h +@@ -74,6 +74,11 @@ unsigned + EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); + #endif + ++#ifdef HAVE___CLZDI2 ++int ++EXPORT_FUNC (__clzdi2) (grub_uint64_t x); ++#endif ++ + #ifdef HAVE___AEABI_UIDIV + grub_uint32_t + EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); diff --git a/0196-grub-install-Define-default-platform-for-RISC-V.patch b/0196-grub-install-Define-default-platform-for-RISC-V.patch new file mode 100644 index 00000000..962c0803 --- /dev/null +++ b/0196-grub-install-Define-default-platform-for-RISC-V.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Thu, 15 Aug 2019 16:55:13 +0200 +Subject: [PATCH] grub-install: Define default platform for RISC-V + +Signed-off-by: Andreas Schwab +Reviewed-by: Daniel Kiper +Reviewed-by: Alexander Graf +--- + util/grub-install.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/util/grub-install.c b/util/grub-install.c +index 37fcdac12cc..8b6a037903e 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -324,6 +324,14 @@ get_default_platform (void) + return "arm64-efi"; + #elif defined (__amd64__) || defined (__x86_64__) || defined (__i386__) + return grub_install_get_default_x86_platform (); ++#elif defined (__riscv) ++#if __riscv_xlen == 32 ++ return "riscv32-efi"; ++#elif __riscv_xlen == 64 ++ return "riscv64-efi"; ++#else ++ return NULL; ++#endif + #else + return NULL; + #endif diff --git a/0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch b/0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch new file mode 100644 index 00000000..55efdaa1 --- /dev/null +++ b/0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 14 Jan 2020 17:41:29 +0100 +Subject: [PATCH] blscfg: Always use the root variable to search for BLS + snippets + +The boot and root variables are set by grub2-mkconfig to tell GRUB what +are the devices and partitions used as the EFI System Partition (ESP) +and to store the /boot directory (or used as the /boot mount point). + +But the boot variable is not needed anymore, this was added because the +blscfg module used to search for the BLS snippets in the ESP, but was +later changed to always search for the BLS files in /boot even for EFI. + +When doing that change, the logic was made backwards and so the boot +variable is wrongly used for legacy BIOS. This only works because this +is set to the same value as the root variable. + +So the correct thing to do is to always use the root variable to search +the BLS snippets, since that is set to the partition that stores them. + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 069db721bec..24e35a40f24 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -1018,14 +1018,12 @@ bls_load_entries (const char *path) + if (!devid) { + #ifdef GRUB_MACHINE_EMU + devid = "host"; +-#elif defined(GRUB_MACHINE_EFI) ++#else + devid = grub_env_get ("root"); +-#else +- devid = grub_env_get ("boot"); + #endif + if (!devid) + return grub_error (GRUB_ERR_FILE_NOT_FOUND, +- N_("variable `%s' isn't set"), "boot"); ++ N_("variable `%s' isn't set"), "root"); + } + + grub_dprintf ("blscfg", "opening %s\n", devid); diff --git a/0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch new file mode 100644 index 00000000..d63a24ef --- /dev/null +++ b/0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 15 Jan 2020 12:47:46 +0100 +Subject: [PATCH] bootstrap.conf: Force autogen.sh to use python3 + +The python-unversioned-command package is not installed in the buildroot, +but the bootstrap script expects the python command to be present if one +is not defined. So building the package leads to the following error: + +./autogen.sh: line 20: python: command not found + +This is harmless since gnulib is included as a source anyways, because the +builders can't download. But still the issue should be fixed by forcing to +use python3 that's the default in Fedora now. + +Signed-off-by: Javier Martinez Canillas +--- + bootstrap.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bootstrap.conf b/bootstrap.conf +index 274c55a5568..5665c83351d 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -84,7 +84,7 @@ cp -a INSTALL INSTALL.grub + + bootstrap_post_import_hook () { + set -e +- FROM_BOOTSTRAP=1 ./autogen.sh ++ PYTHON=python3 FROM_BOOTSTRAP=1 ./autogen.sh + set +e # bootstrap expects this + } + diff --git a/grub.patches b/grub.patches index 3b3c6a26..369b6484 100644 --- a/grub.patches +++ b/grub.patches @@ -189,3 +189,10 @@ Patch0188: 0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch Patch0189: 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch Patch0190: 0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch Patch0191: 0191-Fix-savedefault-with-blscfg.patch +Patch0192: 0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch +Patch0193: 0193-chainloader-Define-machine-types-for-RISC-V.patch +Patch0194: 0194-Add-start-symbol-for-RISC-V.patch +Patch0195: 0195-RISC-V-Add-__clzdi2-symbol.patch +Patch0196: 0196-grub-install-Define-default-platform-for-RISC-V.patch +Patch0197: 0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch +Patch0198: 0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/grub2.spec b/grub2.spec index f3703653..d01388ac 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -512,6 +512,11 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Jan 16 2020 Javier Martinez Canillas - 2.04-9 +- Add riscv64 support to grub.macros and RISC-V build fixes (davidlt) +- blscfg: Always use the root variable to search for BLS snippets +- bootstrap.conf: Force autogen.sh to use python3 + * Mon Jan 13 2020 Javier Martinez Canillas - 2.04-8 - Make the blscfg module honour the GRUB_SAVEDEFAULT option (fritz) Resolves: rhbz#1704926 From 1ac3b7869ab66ec7bfe6dc2b99737988a32107c8 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 21 Jan 2020 13:34:34 -0500 Subject: [PATCH 016/294] Add a noautobuild file Signed-off-by: Peter Jones --- noautobuild | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 noautobuild diff --git a/noautobuild b/noautobuild new file mode 100644 index 00000000..e69de29b From 904d351ffdb8425a3e369014fac0c0489edc4971 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 17 Mar 2020 15:18:34 +0100 Subject: [PATCH 017/294] Fix for entries having an empty initrd command and HTTP boot issues Resolves: rhbz#1806022 Signed-off-by: Javier Martinez Canillas --- ...-end-pointers-have-safer-const-quali.patch | 987 ++++++++++++++++++ ...l-end-pointer-have-the-right-constif.patch | 592 ----------- ...ntry-selection-based-on-ID-and-title.patch | 19 +- ...le-to-subtract-conditions-from-debug.patch | 2 +- ...bles-from-the-initial-context-when-c.patch | 4 +- ...strtoull-print-an-error-if-no-conver.patch | 4 +- ...t-boot-commands-will-only-return-on-.patch | 12 +- ...fw-http-_path-variables-to-make-them.patch | 50 + ...-literal-IPv6-addresses-in-square-br.patch | 114 ++ ...o-specify-a-port-number-in-addresses.patch | 48 + ...mprove-check-to-detect-literal-IPv6-.patch | 48 + ...debug-message-if-parsing-the-address.patch | 68 ++ ...LL-instead-of-a-zero-length-array-in.patch | 38 + grub.patches | 8 +- grub2.spec | 9 +- 15 files changed, 1384 insertions(+), 619 deletions(-) create mode 100644 0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch delete mode 100644 0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch create mode 100644 0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch create mode 100644 0200-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch create mode 100644 0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch create mode 100644 0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch create mode 100644 0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch create mode 100644 0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch diff --git a/0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch b/0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch new file mode 100644 index 00000000..30c0828a --- /dev/null +++ b/0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch @@ -0,0 +1,987 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 19 Oct 2018 13:41:48 -0400 +Subject: [PATCH] Make grub_strtol() "end" pointers have safer const + qualifiers. (v2) + +Currently the string functions grub_strtol(), grub_strtoul(), and +grub_strtoull() don't declare the "end" pointer in such a way as to +require the pointer itself or the character array to be immutable to the +implementation, nor does the C standard do so in its similar functions, +though it does require us not to change any of it. + +The typical declarations of these functions follow this pattern: + +long +strtol(const char * restrict nptr, char ** restrict endptr, int base); + +Much of the reason for this is historic, and a discussion of that +follows below, after the explanation of this change. (GRUB currently +does not include the "restrict" qualifiers, and we name the arguments a +bit differently.) + +The implementation is semantically required to treat the character array +as immutable, but such accidental modifications aren't stopped by the +compiler, and the semantics for both the callers and the implementation +of these functions are sometimes also helped by adding that requirement. + +This patch changes these declarations to follow this pattern instead: + +long +strtol(const char * restrict nptr, + const char ** const restrict endptr, + int base); + +This means that if any modification to these functions accidentally +introduces either an errant modification to the underlying character +array, or an accidental assignment to endptr rather than *endptr, the +compiler should generate an error. (The two uses of "restrict" in this +case basically mean strtol() isn't allowed to modify the character array +by going through *endptr, and endptr isn't allowed to point inside the +array.) + +It also means the typical use case changes to: + + char *s = ...; + const char *end; + long l; + + l = strtol(s, &end, 10); + +Or even: + + const char *p = str; + while (p && *p) { + long l = strtol(p, &p, 10); + ... + } + +This fixes 26 places where we discard our attempts at treating the data +safely by doing: + + const char *p = str; + long l; + + l = strtol(p, (char **)&ptr, 10); + +It also adds 5 places where we do: + + char *p = str; + while (p && *p) { + long l = strtol(p, (const char ** const)&p, 10); + ... + /* more calls that need p not to be pointer-to-const */ + } + +While moderately distasteful, this is a better problem to have. + +With one minor exception, I have tested that all of this compiles +without relevant warnings or errors, and that /much/ of it behaves +correctly, with gcc 9 using 'gcc -W -Wall -Wextra'. The one exception +is the changes in grub-core/osdep/aros/hostdisk.c , which I have no idea +how to build. + +Because the C standard defined type-qualifiers in a way that can be +confusing, in the past there's been a slow but fairly regular stream of +churn within our patches, which add and remove the const qualifier in many +of the users of these functions. This change should help avoid that in +the future, and in order to help ensure this, I've added an explanation +in misc.h so that when someone does get a compiler warning about a type +error, they have the fix at hand. + +The reason we don't have "const" in these calls in the standard is +purely anachronistic: C78 (de facto) did not have type qualifiers in the +syntax, and the "const" type qualifier was added for C89 (I think; it +may have been later). strtol() appears to date from 4.3BSD in 1986, +which means it could not be added to those functions in the standard +without breaking compatibility, which is usually avoided. + +The syntax chosen for type qualifiers is what has led to the churn +regarding usage of const, and is especially confusing on string +functions due to the lack of a string type. Quoting from C99, the +syntax is: + + declarator: + pointer[opt] direct-declarator + direct-declarator: + identifier + ( declarator ) + direct-declarator [ type-qualifier-list[opt] assignment-expression[opt] ] + ... + direct-declarator [ type-qualifier-list[opt] * ] + ... + pointer: + * type-qualifier-list[opt] + * type-qualifier-list[opt] pointer + type-qualifier-list: + type-qualifier + type-qualifier-list type-qualifier + ... + type-qualifier: + const + restrict + volatile + +So the examples go like: + +const char foo; // immutable object +const char *foo; // mutable pointer to object +char * const foo; // immutable pointer to mutable object +const char * const foo; // immutable pointer to immutable object +const char const * const foo; // XXX extra const keyword in the middle +const char * const * const foo; // immutable pointer to immutable + // pointer to immutable object +const char ** const foo; // immutable pointer to mutable pointer + // to immutable object + +Making const left-associative for * and right-associative for everything +else may not have been the best choice ever, but here we are, and the +inevitable result is people using trying to use const (as they should!), +putting it at the wrong place, fighting with the compiler for a bit, and +then either removing it or typecasting something in a bad way. I won't +go into describing restrict, but its syntax has exactly the same issue +as with const. + +Anyway, the last example above actually represents the *behavior* that's +required of strtol()-like functions, so that's our choice for the "end" +pointer. + +Signed-off-by: Peter Jones +--- + grub-core/commands/date.c | 3 ++- + grub-core/commands/i386/cmostest.c | 2 +- + grub-core/commands/i386/pc/play.c | 2 +- + grub-core/commands/i386/rdmsr.c | 2 +- + grub-core/commands/i386/wrmsr.c | 2 +- + grub-core/commands/password_pbkdf2.c | 2 +- + grub-core/commands/pcidump.c | 13 ++++++------- + grub-core/commands/regexp.c | 2 +- + grub-core/commands/setpci.c | 21 ++++++++++----------- + grub-core/commands/test.c | 2 +- + grub-core/commands/videoinfo.c | 2 +- + grub-core/disk/diskfilter.c | 3 ++- + grub-core/disk/lvm.c | 9 +++++---- + grub-core/efiemu/pnvram.c | 5 +++-- + grub-core/gfxmenu/gui_circular_progress.c | 2 +- + grub-core/gfxmenu/theme_loader.c | 2 +- + grub-core/kern/fs.c | 2 +- + grub-core/kern/misc.c | 10 ++++++---- + grub-core/kern/partition.c | 2 +- + grub-core/lib/arg.c | 2 +- + grub-core/lib/legacy_parse.c | 2 +- + grub-core/lib/syslinux_parse.c | 6 +++--- + grub-core/loader/i386/bsd.c | 6 +++--- + grub-core/loader/i386/linux.c | 2 +- + grub-core/loader/i386/pc/linux.c | 2 +- + grub-core/loader/i386/xen_fileXX.c | 2 +- + grub-core/mmap/mmap.c | 4 ++-- + grub-core/net/http.c | 4 ++-- + grub-core/net/net.c | 8 ++++---- + grub-core/normal/menu.c | 3 +-- + grub-core/osdep/aros/hostdisk.c | 2 +- + grub-core/osdep/devmapper/hostdisk.c | 2 +- + grub-core/script/execute.c | 6 +++--- + grub-core/term/serial.c | 2 +- + grub-core/term/terminfo.c | 2 +- + grub-core/tests/strtoull_test.c | 2 +- + util/grub-fstest.c | 2 +- + include/grub/misc.h | 24 +++++++++++++++++++++--- + 38 files changed, 96 insertions(+), 75 deletions(-) + +diff --git a/grub-core/commands/date.c b/grub-core/commands/date.c +index 8e1f41f141b..5cb4fafd454 100644 +--- a/grub-core/commands/date.c ++++ b/grub-core/commands/date.c +@@ -59,7 +59,8 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)), + + for (; argc; argc--, args++) + { +- char *p, c; ++ const char *p; ++ char c; + int m1, ofs, n, cur_mask; + + p = args[0]; +diff --git a/grub-core/commands/i386/cmostest.c b/grub-core/commands/i386/cmostest.c +index c839b704dc5..9f6b56a2f0c 100644 +--- a/grub-core/commands/i386/cmostest.c ++++ b/grub-core/commands/i386/cmostest.c +@@ -27,7 +27,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + static grub_err_t + parse_args (int argc, char *argv[], int *byte, int *bit) + { +- char *rest; ++ const char *rest; + + if (argc != 1) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required"); +diff --git a/grub-core/commands/i386/pc/play.c b/grub-core/commands/i386/pc/play.c +index c8181310515..a980e46883c 100644 +--- a/grub-core/commands/i386/pc/play.c ++++ b/grub-core/commands/i386/pc/play.c +@@ -132,7 +132,7 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), + } + else + { +- char *end; ++ const char *end; + unsigned tempo; + struct note note; + int i; +diff --git a/grub-core/commands/i386/rdmsr.c b/grub-core/commands/i386/rdmsr.c +index 15b9adfca67..46c4346da1b 100644 +--- a/grub-core/commands/i386/rdmsr.c ++++ b/grub-core/commands/i386/rdmsr.c +@@ -44,7 +44,7 @@ grub_cmd_msr_read (grub_extcmd_context_t ctxt, int argc, char **argv) + { + grub_uint32_t manufacturer[3], max_cpuid, a, b, c, features, addr; + grub_uint64_t value; +- char *ptr; ++ const char *ptr; + char buf[sizeof("1122334455667788")]; + + /* +diff --git a/grub-core/commands/i386/wrmsr.c b/grub-core/commands/i386/wrmsr.c +index 9c5e510eb44..fa76f5aed11 100644 +--- a/grub-core/commands/i386/wrmsr.c ++++ b/grub-core/commands/i386/wrmsr.c +@@ -37,7 +37,7 @@ grub_cmd_msr_write (grub_command_t cmd __attribute__ ((unused)), int argc, char + { + grub_uint32_t manufacturer[3], max_cpuid, a, b, c, features, addr; + grub_uint64_t value; +- char *ptr; ++ const char *ptr; + + /* + * The CPUID instruction should be used to determine whether MSRs +diff --git a/grub-core/commands/password_pbkdf2.c b/grub-core/commands/password_pbkdf2.c +index da636e6217a..ab845d25eb3 100644 +--- a/grub-core/commands/password_pbkdf2.c ++++ b/grub-core/commands/password_pbkdf2.c +@@ -86,7 +86,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)), + int argc, char **args) + { + grub_err_t err; +- char *ptr, *ptr2; ++ const char *ptr, *ptr2; + grub_uint8_t *ptro; + struct pbkdf2_password *pass; + +diff --git a/grub-core/commands/pcidump.c b/grub-core/commands/pcidump.c +index f99ad4a216f..f72628fce2d 100644 +--- a/grub-core/commands/pcidump.c ++++ b/grub-core/commands/pcidump.c +@@ -95,7 +95,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, + if (ctxt->state[0].set) + { + ptr = ctxt->state[0].arg; +- ctx.pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff); ++ ctx.pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff); + if (grub_errno == GRUB_ERR_BAD_NUMBER) + { + grub_errno = GRUB_ERR_NONE; +@@ -108,8 +108,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, + if (*ptr != ':') + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':'); + ptr++; +- ctx.pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff) +- << 16; ++ ctx.pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff) << 16; + if (grub_errno == GRUB_ERR_BAD_NUMBER) + grub_errno = GRUB_ERR_NONE; + else +@@ -121,10 +120,10 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, + if (ctxt->state[1].set) + { + const char *optr; +- ++ + ptr = ctxt->state[1].arg; + optr = ptr; +- ctx.bus = grub_strtoul (ptr, (char **) &ptr, 16); ++ ctx.bus = grub_strtoul (ptr, &ptr, 16); + if (grub_errno == GRUB_ERR_BAD_NUMBER) + { + grub_errno = GRUB_ERR_NONE; +@@ -138,7 +137,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':'); + ptr++; + optr = ptr; +- ctx.device = grub_strtoul (ptr, (char **) &ptr, 16); ++ ctx.device = grub_strtoul (ptr, &ptr, 16); + if (grub_errno == GRUB_ERR_BAD_NUMBER) + { + grub_errno = GRUB_ERR_NONE; +@@ -149,7 +148,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, + if (*ptr == '.') + { + ptr++; +- ctx.function = grub_strtoul (ptr, (char **) &ptr, 16); ++ ctx.function = grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + return grub_errno; + ctx.check_function = 1; +diff --git a/grub-core/commands/regexp.c b/grub-core/commands/regexp.c +index f00b184c81e..7c5c72fe460 100644 +--- a/grub-core/commands/regexp.c ++++ b/grub-core/commands/regexp.c +@@ -64,7 +64,7 @@ set_matches (char **varnames, char *str, grub_size_t nmatches, + { + int i; + char *p; +- char *q; ++ const char * q; + grub_err_t err; + unsigned long j; + +diff --git a/grub-core/commands/setpci.c b/grub-core/commands/setpci.c +index d5bc97d60b2..e966af080a6 100644 +--- a/grub-core/commands/setpci.c ++++ b/grub-core/commands/setpci.c +@@ -169,7 +169,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) + if (ctxt->state[0].set) + { + ptr = ctxt->state[0].arg; +- pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff); ++ pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff); + if (grub_errno == GRUB_ERR_BAD_NUMBER) + { + grub_errno = GRUB_ERR_NONE; +@@ -182,8 +182,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) + if (*ptr != ':') + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':'); + ptr++; +- pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff) +- << 16; ++ pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff) << 16; + if (grub_errno == GRUB_ERR_BAD_NUMBER) + grub_errno = GRUB_ERR_NONE; + else +@@ -197,10 +196,10 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) + if (ctxt->state[1].set) + { + const char *optr; +- ++ + ptr = ctxt->state[1].arg; + optr = ptr; +- bus = grub_strtoul (ptr, (char **) &ptr, 16); ++ bus = grub_strtoul (ptr, &ptr, 16); + if (grub_errno == GRUB_ERR_BAD_NUMBER) + { + grub_errno = GRUB_ERR_NONE; +@@ -214,7 +213,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':'); + ptr++; + optr = ptr; +- device = grub_strtoul (ptr, (char **) &ptr, 16); ++ device = grub_strtoul (ptr, &ptr, 16); + if (grub_errno == GRUB_ERR_BAD_NUMBER) + { + grub_errno = GRUB_ERR_NONE; +@@ -225,7 +224,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) + if (*ptr == '.') + { + ptr++; +- function = grub_strtoul (ptr, (char **) &ptr, 16); ++ function = grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + return grub_errno; + check_function = 1; +@@ -253,7 +252,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) + if (i == ARRAY_SIZE (pci_registers)) + { + regsize = 0; +- regaddr = grub_strtoul (ptr, (char **) &ptr, 16); ++ regaddr = grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown register"); + } +@@ -270,7 +269,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) + if (*ptr == '+') + { + ptr++; +- regaddr += grub_strtoul (ptr, (char **) &ptr, 16); ++ regaddr += grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + return grub_errno; + } +@@ -302,14 +301,14 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) + if (*ptr == '=') + { + ptr++; +- regwrite = grub_strtoul (ptr, (char **) &ptr, 16); ++ regwrite = grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + return grub_errno; + write_mask = 0xffffffff; + if (*ptr == ':') + { + ptr++; +- write_mask = grub_strtoul (ptr, (char **) &ptr, 16); ++ write_mask = grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + return grub_errno; + write_mask = 0xffffffff; +diff --git a/grub-core/commands/test.c b/grub-core/commands/test.c +index 4e929e0452e..62d3fb3988f 100644 +--- a/grub-core/commands/test.c ++++ b/grub-core/commands/test.c +@@ -31,7 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + /* A simple implementation for signed numbers. */ + static int +-grub_strtosl (char *arg, char **end, int base) ++grub_strtosl (char *arg, const char ** const end, int base) + { + if (arg[0] == '-') + return -grub_strtoul (arg + 1, end, base); +diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c +index 4be8107d553..016a4d81835 100644 +--- a/grub-core/commands/videoinfo.c ++++ b/grub-core/commands/videoinfo.c +@@ -136,7 +136,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)), + ctx.height = ctx.width = ctx.depth = 0; + if (argc) + { +- char *ptr; ++ const char *ptr; + ptr = args[0]; + ctx.width = grub_strtoul (ptr, &ptr, 0); + if (grub_errno) +diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c +index 1a3eb6b8d77..3f264be77d1 100644 +--- a/grub-core/disk/diskfilter.c ++++ b/grub-core/disk/diskfilter.c +@@ -971,7 +971,8 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) + for (p = vgp->lvs; p; p = p->next) + { + int cur_num; +- char *num, *end; ++ char *num; ++ const char *end; + if (!p->fullname) + continue; + if (grub_strncmp (p->fullname, lv->fullname, len) != 0) +diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c +index 7b265c780c3..0cbd0dd1629 100644 +--- a/grub-core/disk/lvm.c ++++ b/grub-core/disk/lvm.c +@@ -38,7 +38,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + at the number. In case STR is not found, *P will be NULL and the + return value will be 0. */ + static grub_uint64_t +-grub_lvm_getvalue (char **p, const char *str) ++grub_lvm_getvalue (const char ** const p, const char *str) + { + *p = grub_strstr (*p, str); + if (! *p) +@@ -63,12 +63,12 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl) + #endif + + static int +-grub_lvm_check_flag (char *p, const char *str, const char *flag) ++grub_lvm_check_flag (const char *p, const char *str, const char *flag) + { + grub_size_t len_str = grub_strlen (str), len_flag = grub_strlen (flag); + while (1) + { +- char *q; ++ const char *q; + p = grub_strstr (p, str); + if (! p) + return 0; +@@ -105,7 +105,8 @@ grub_lvm_detect (grub_disk_t disk, + char buf[GRUB_LVM_LABEL_SIZE]; + char vg_id[GRUB_LVM_ID_STRLEN+1]; + char pv_id[GRUB_LVM_ID_STRLEN+1]; +- char *metadatabuf, *p, *q, *vgname; ++ char *metadatabuf, *vgname; ++ const char *p, *q; + struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf; + struct grub_lvm_pv_header *pvh; + struct grub_lvm_disk_locn *dlocn; +diff --git a/grub-core/efiemu/pnvram.c b/grub-core/efiemu/pnvram.c +index c5c3d4bd3d5..dd42bc69116 100644 +--- a/grub-core/efiemu/pnvram.c ++++ b/grub-core/efiemu/pnvram.c +@@ -39,7 +39,7 @@ static grub_size_t nvramsize; + + /* Parse signed value */ + static int +-grub_strtosl (const char *arg, char **end, int base) ++grub_strtosl (const char *arg, const char ** const end, int base) + { + if (arg[0] == '-') + return -grub_strtoul (arg + 1, end, base); +@@ -120,7 +120,8 @@ nvram_set (void * data __attribute__ ((unused))) + grub_memset (nvram, 0, nvramsize); + FOR_SORTED_ENV (var) + { +- char *guid, *attr, *name, *varname; ++ const char *guid; ++ char *attr, *name, *varname; + struct efi_variable *efivar; + int len = 0; + int i; +diff --git a/grub-core/gfxmenu/gui_circular_progress.c b/grub-core/gfxmenu/gui_circular_progress.c +index 354dd7b73ee..7578bfbec92 100644 +--- a/grub-core/gfxmenu/gui_circular_progress.c ++++ b/grub-core/gfxmenu/gui_circular_progress.c +@@ -230,7 +230,7 @@ circprog_set_state (void *vself, int visible, int start, + static int + parse_angle (const char *value) + { +- char *ptr; ++ const char *ptr; + int angle; + + angle = grub_strtol (value, &ptr, 10); +diff --git a/grub-core/gfxmenu/theme_loader.c b/grub-core/gfxmenu/theme_loader.c +index d6829bb5e90..eae83086bcc 100644 +--- a/grub-core/gfxmenu/theme_loader.c ++++ b/grub-core/gfxmenu/theme_loader.c +@@ -484,7 +484,7 @@ parse_proportional_spec (const char *value, signed *abs, grub_fixed_signed_t *pr + ptr++; + } + +- num = grub_strtoul (ptr, (char **) &ptr, 0); ++ num = grub_strtoul (ptr, &ptr, 0); + if (grub_errno) + return grub_errno; + if (sig) +diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c +index 2b85f4950bd..88d39360da0 100644 +--- a/grub-core/kern/fs.c ++++ b/grub-core/kern/fs.c +@@ -134,7 +134,7 @@ struct grub_fs_block + static grub_err_t + grub_fs_blocklist_open (grub_file_t file, const char *name) + { +- char *p = (char *) name; ++ const char *p = name; + unsigned num = 0; + unsigned i; + grub_disk_t disk = file->device->disk; +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 5c3899f0e5b..e21dd44c7cf 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -383,7 +383,8 @@ grub_isspace (int c) + } + + unsigned long +-grub_strtoul (const char *str, char **end, int base) ++grub_strtoul (const char * restrict str, const char ** const restrict end, ++ int base) + { + unsigned long long num; + +@@ -400,7 +401,8 @@ grub_strtoul (const char *str, char **end, int base) + } + + unsigned long long +-grub_strtoull (const char *str, char **end, int base) ++grub_strtoull (const char * restrict str, const char ** const restrict end, ++ int base) + { + unsigned long long num = 0; + int found = 0; +@@ -901,14 +903,14 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, + { + if (fmt[0] == '0') + zerofill = '0'; +- format1 = grub_strtoul (fmt, (char **) &fmt, 10); ++ format1 = grub_strtoul (fmt, &fmt, 10); + } + + if (*fmt == '.') + fmt++; + + if (grub_isdigit (*fmt)) +- format2 = grub_strtoul (fmt, (char **) &fmt, 10); ++ format2 = grub_strtoul (fmt, &fmt, 10); + + if (*fmt == '$') + { +diff --git a/grub-core/kern/partition.c b/grub-core/kern/partition.c +index e499147cbcb..2c401b866c4 100644 +--- a/grub-core/kern/partition.c ++++ b/grub-core/kern/partition.c +@@ -126,7 +126,7 @@ grub_partition_probe (struct grub_disk *disk, const char *str) + while (*ptr && grub_isalpha (*ptr)) + ptr++; + partname_end = ptr; +- num = grub_strtoul (ptr, (char **) &ptr, 0) - 1; ++ num = grub_strtoul (ptr, &ptr, 0) - 1; + + curpart = 0; + /* Use the first partition map type found. */ +diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c +index fd7744a6ff6..ccc185017ee 100644 +--- a/grub-core/lib/arg.c ++++ b/grub-core/lib/arg.c +@@ -375,7 +375,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv, + + case ARG_TYPE_INT: + { +- char *tail; ++ const char * tail; + + grub_strtoull (option, &tail, 0); + if (tail == 0 || tail == option || *tail != '\0' || grub_errno) +diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c +index ef56150ac77..05719ab2ccb 100644 +--- a/grub-core/lib/legacy_parse.c ++++ b/grub-core/lib/legacy_parse.c +@@ -418,7 +418,7 @@ adjust_file (const char *in, grub_size_t len) + } + if (*comma != ',') + return grub_legacy_escape (in, len); +- part = grub_strtoull (comma + 1, (char **) &rest, 0); ++ part = grub_strtoull (comma + 1, &rest, 0); + if (rest[0] == ',' && rest[1] >= 'a' && rest[1] <= 'z') + { + subpart = rest[1] - 'a'; +diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c +index 4afa99279a2..de9fda06f52 100644 +--- a/grub-core/lib/syslinux_parse.c ++++ b/grub-core/lib/syslinux_parse.c +@@ -1062,7 +1062,7 @@ write_entry (struct output_buffer *outbuf, + if (ptr[0] == 'h' && ptr[1] == 'd') + { + is_fd = 0; +- devn = grub_strtoul (ptr + 2, &ptr, 0); ++ devn = grub_strtoul (ptr + 2, (const char **)&ptr, 0); + continue; + } + if (grub_strncasecmp (ptr, "file=", 5) == 0) +@@ -1086,12 +1086,12 @@ write_entry (struct output_buffer *outbuf, + if (ptr[0] == 'f' && ptr[1] == 'd') + { + is_fd = 1; +- devn = grub_strtoul (ptr + 2, &ptr, 0); ++ devn = grub_strtoul (ptr + 2, (const char **)&ptr, 0); + continue; + } + if (grub_isdigit (ptr[0])) + { +- part = grub_strtoul (ptr, &ptr, 0); ++ part = grub_strtoul (ptr, (const char **)&ptr, 0); + continue; + } + /* FIXME: isolinux, ntldr, cmldr, *dos, seg, hide +diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c +index 5b9b92d6ba5..50cca304fd0 100644 +--- a/grub-core/loader/i386/bsd.c ++++ b/grub-core/loader/i386/bsd.c +@@ -1616,7 +1616,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) + return grub_error (GRUB_ERR_BAD_ARGUMENT, + "unknown disk type name"); + +- unit = grub_strtoul (arg, (char **) &arg, 10); ++ unit = grub_strtoul (arg, &arg, 10); + if (! (arg && *arg >= 'a' && *arg <= 'z')) + return grub_error (GRUB_ERR_BAD_ARGUMENT, + "only device specifications of form " +@@ -1634,7 +1634,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) + if (ctxt->state[OPENBSD_SERIAL_ARG].set) + { + struct grub_openbsd_bootarg_console serial; +- char *ptr; ++ const char *ptr; + unsigned port = 0; + unsigned speed = 9600; + +@@ -1736,7 +1736,7 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) + if (ctxt->state[NETBSD_SERIAL_ARG].set) + { + struct grub_netbsd_btinfo_serial serial; +- char *ptr; ++ const char *ptr; + + grub_memset (&serial, 0, sizeof (serial)); + grub_strcpy (serial.devname, "com"); +diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c +index 376c726928a..201e6597c6d 100644 +--- a/grub-core/loader/i386/linux.c ++++ b/grub-core/loader/i386/linux.c +@@ -954,7 +954,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + #endif /* GRUB_MACHINE_PCBIOS */ + if (grub_memcmp (argv[i], "mem=", 4) == 0) + { +- char *val = argv[i] + 4; ++ const char *val = argv[i] + 4; + + linux_mem_size = grub_strtoul (val, &val, 0); + +diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c +index fe3e1d41d09..0bf0e13d647 100644 +--- a/grub-core/loader/i386/pc/linux.c ++++ b/grub-core/loader/i386/pc/linux.c +@@ -272,7 +272,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } + else if (grub_memcmp (argv[i], "mem=", 4) == 0) + { +- char *val = argv[i] + 4; ++ const char *val = argv[i] + 4; + + linux_mem_size = grub_strtoul (val, &val, 0); + +diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c +index 6329ec01038..27afcaacbce 100644 +--- a/grub-core/loader/i386/xen_fileXX.c ++++ b/grub-core/loader/i386/xen_fileXX.c +@@ -25,7 +25,7 @@ parse_xen_guest (grub_elf_t elf, struct grub_xen_file_info *xi, + grub_off_t off, grub_size_t sz) + { + char *buf; +- char *ptr; ++ const char *ptr; + int has_paddr = 0; + + grub_errno = GRUB_ERR_NONE; +diff --git a/grub-core/mmap/mmap.c b/grub-core/mmap/mmap.c +index 6a31cbae325..b569cb23b5a 100644 +--- a/grub-core/mmap/mmap.c ++++ b/grub-core/mmap/mmap.c +@@ -423,7 +423,7 @@ static grub_err_t + grub_cmd_badram (grub_command_t cmd __attribute__ ((unused)), + int argc, char **args) + { +- char * str; ++ const char *str; + struct badram_entry entry; + + if (argc != 1) +@@ -465,7 +465,7 @@ static grub_uint64_t + parsemem (const char *str) + { + grub_uint64_t ret; +- char *ptr; ++ const char *ptr; + + ret = grub_strtoul (str, &ptr, 0); + +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index c9c59690a98..b52b558d631 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -110,7 +110,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) + return GRUB_ERR_NONE; + } + ptr += sizeof ("HTTP/1.1 ") - 1; +- code = grub_strtoul (ptr, &ptr, 10); ++ code = grub_strtoul (ptr, (const char **)&ptr, 10); + if (grub_errno) + return grub_errno; + switch (code) +@@ -137,7 +137,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) + == 0 && !data->size_recv) + { + ptr += sizeof ("Content-Length: ") - 1; +- file->size = grub_strtoull (ptr, &ptr, 10); ++ file->size = grub_strtoull (ptr, (const char **)&ptr, 10); + data->size_recv = 1; + return GRUB_ERR_NONE; + } +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 27a0a1d6961..aa56393e1c4 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -411,7 +411,7 @@ parse_ip (const char *val, grub_uint32_t *ip, const char **rest) + for (i = 0; i < 4; i++) + { + unsigned long t; +- t = grub_strtoul (ptr, (char **) &ptr, 0); ++ t = grub_strtoul (ptr, &ptr, 0); + if (grub_errno) + { + grub_errno = GRUB_ERR_NONE; +@@ -465,7 +465,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) + ptr++; + continue; + } +- t = grub_strtoul (ptr, (char **) &ptr, 16); ++ t = grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + { + grub_errno = GRUB_ERR_NONE; +@@ -577,7 +577,7 @@ grub_net_resolve_net_address (const char *name, + addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; + if (*rest == '/') + { +- addr->ipv4.masksize = grub_strtoul (rest + 1, (char **) &rest, 0); ++ addr->ipv4.masksize = grub_strtoul (rest + 1, &rest, 0); + if (!grub_errno && *rest == 0) + return GRUB_ERR_NONE; + grub_errno = GRUB_ERR_NONE; +@@ -593,7 +593,7 @@ grub_net_resolve_net_address (const char *name, + addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; + if (*rest == '/') + { +- addr->ipv6.masksize = grub_strtoul (rest + 1, (char **) &rest, 0); ++ addr->ipv6.masksize = grub_strtoul (rest + 1, &rest, 0); + if (!grub_errno && *rest == 0) + return GRUB_ERR_NONE; + grub_errno = GRUB_ERR_NONE; +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +index 046a1fb2c84..37d753d8081 100644 +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -194,8 +194,7 @@ menuentry_eq (const char *id, const char *spec) + static int + get_and_remove_first_entry_number (grub_menu_t menu, const char *name) + { +- const char *val; +- char *tail; ++ const char *val, *tail; + int entry; + int sz = 0; + +diff --git a/grub-core/osdep/aros/hostdisk.c b/grub-core/osdep/aros/hostdisk.c +index 2be654ca3bd..3b2c9de2496 100644 +--- a/grub-core/osdep/aros/hostdisk.c ++++ b/grub-core/osdep/aros/hostdisk.c +@@ -194,7 +194,7 @@ grub_util_fd_open (const char *dev, int flg) + p1 = dev + strlen (dev); + else + { +- unit = grub_strtoul (p1 + 1, (char **) &p2, 16); ++ unit = grub_strtoul (p1 + 1, &p2, 16); + if (p2 && *p2 == '/') + flags = grub_strtoul (p2 + 1, 0, 16); + } +diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c +index a697bcb4d8d..a8afc0c9408 100644 +--- a/grub-core/osdep/devmapper/hostdisk.c ++++ b/grub-core/osdep/devmapper/hostdisk.c +@@ -113,7 +113,7 @@ grub_util_get_dm_node_linear_info (dev_t dev, + void *next = NULL; + uint64_t length, start; + char *target, *params; +- char *ptr; ++ const char *ptr; + int major = 0, minor = 0; + int first = 1; + grub_disk_addr_t partstart = 0; +diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c +index ba38b5e8aef..c6d2c365c9a 100644 +--- a/grub-core/script/execute.c ++++ b/grub-core/script/execute.c +@@ -146,7 +146,7 @@ replace_scope (struct grub_script_scope *new_scope) + grub_err_t + grub_script_break (grub_command_t cmd, int argc, char *argv[]) + { +- char *p = 0; ++ const char *p = NULL; + unsigned long count; + + if (argc == 0) +@@ -178,7 +178,7 @@ grub_err_t + grub_script_shift (grub_command_t cmd __attribute__((unused)), + int argc, char *argv[]) + { +- char *p = 0; ++ const char *p = NULL; + unsigned long n = 0; + + if (! scope) +@@ -239,7 +239,7 @@ grub_err_t + grub_script_return (grub_command_t cmd __attribute__((unused)), + int argc, char *argv[]) + { +- char *p; ++ const char *p = NULL; + unsigned long n; + + if (! scope || argc > 1) +diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c +index db80b3ba0fb..f9271b09239 100644 +--- a/grub-core/term/serial.c ++++ b/grub-core/term/serial.c +@@ -269,7 +269,7 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) + + if (state[OPTION_BASE_CLOCK].set) + { +- char *ptr; ++ const char *ptr; + config.base_clock = grub_strtoull (state[OPTION_BASE_CLOCK].arg, &ptr, 0); + if (grub_errno) + return grub_errno; +diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c +index 29df35e6d20..537a5c0cb0b 100644 +--- a/grub-core/term/terminfo.c ++++ b/grub-core/term/terminfo.c +@@ -737,7 +737,7 @@ grub_cmd_terminfo (grub_extcmd_context_t ctxt, int argc, char **args) + + if (state[OPTION_GEOMETRY].set) + { +- char *ptr = state[OPTION_GEOMETRY].arg; ++ const char *ptr = state[OPTION_GEOMETRY].arg; + w = grub_strtoul (ptr, &ptr, 0); + if (grub_errno) + return grub_errno; +diff --git a/grub-core/tests/strtoull_test.c b/grub-core/tests/strtoull_test.c +index 7da615ff33e..5488ab26b43 100644 +--- a/grub-core/tests/strtoull_test.c ++++ b/grub-core/tests/strtoull_test.c +@@ -25,7 +25,7 @@ static void + strtoull_testcase (const char *input, int base, unsigned long long expected, + int num_digits, grub_err_t error) + { +- char *output; ++ const char *output; + unsigned long long value; + grub_errno = 0; + value = grub_strtoull(input, &output, base); +diff --git a/util/grub-fstest.c b/util/grub-fstest.c +index 88f9c5d4ad8..39bad1f432f 100644 +--- a/util/grub-fstest.c ++++ b/util/grub-fstest.c +@@ -538,7 +538,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + static error_t + argp_parser (int key, char *arg, struct argp_state *state) + { +- char *p; ++ const char *p; + + switch (key) + { +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 960097fbd06..998e47e0ccf 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -288,11 +288,29 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n) + - (int) grub_tolower ((grub_uint8_t) *s2); + } + +-unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base); +-unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base); ++/* ++ * Note that these differ from the C standard's definitions of strtol, ++ * strtoul(), and strtoull() by the addition of two const qualifiers on the end ++ * pointer, which make the declaration match the *semantic* requirements of ++ * their behavior. This means that instead of: ++ * ++ * char *s = "1234 abcd"; ++ * char *end; ++ * unsigned long l; ++ * ++ * l = grub_strtoul(s, &end, 10); ++ * ++ * We must one of: ++ * ++ * const char *end; ++ * ... or ... ++ * l = grub_strtoul(s, (const char ** const)&end, 10); ++ */ ++unsigned long EXPORT_FUNC(grub_strtoul) (const char * restrict str, const char ** const restrict end, int base); ++unsigned long long EXPORT_FUNC(grub_strtoull) (const char * restrict str, const char ** const restrict end, int base); + + static inline long +-grub_strtol (const char *str, char **end, int base) ++grub_strtol (const char * restrict str, const char ** const restrict end, int base) + { + int negative = 0; + unsigned long long magnitude; diff --git a/0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch b/0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch deleted file mode 100644 index 234f32a0..00000000 --- a/0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch +++ /dev/null @@ -1,592 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 19 Oct 2018 13:41:48 -0400 -Subject: [PATCH] Make grub_strtoul "end" pointer have the right - constification. - -Related: rhbz#1640979 -Signed-off-by: Peter Jones ---- - grub-core/commands/date.c | 5 +++-- - grub-core/commands/password_pbkdf2.c | 2 +- - grub-core/commands/regexp.c | 2 +- - grub-core/commands/videoinfo.c | 2 +- - grub-core/disk/diskfilter.c | 3 ++- - grub-core/disk/lvm.c | 9 +++++---- - grub-core/kern/fs.c | 2 +- - grub-core/kern/misc.c | 8 ++++---- - grub-core/kern/partition.c | 2 +- - grub-core/lib/arg.c | 2 +- - grub-core/lib/legacy_parse.c | 2 +- - grub-core/lib/syslinux_parse.c | 6 +++--- - grub-core/loader/i386/xen_fileXX.c | 2 +- - grub-core/net/efi/ip4_config.c | 2 +- - grub-core/net/efi/ip6_config.c | 2 +- - grub-core/net/efi/net.c | 4 ++-- - grub-core/net/efi/pxe.c | 6 +++--- - grub-core/net/http.c | 4 ++-- - grub-core/net/net.c | 8 ++++---- - grub-core/net/url.c | 2 +- - grub-core/osdep/devmapper/hostdisk.c | 2 +- - grub-core/script/execute.c | 6 +++--- - grub-core/term/serial.c | 2 +- - grub-core/term/terminfo.c | 2 +- - grub-core/tests/strtoull_test.c | 2 +- - util/grub-fstest.c | 2 +- - include/grub/emu/getroot.h | 4 ++++ - include/grub/emu/misc.h | 3 +++ - include/grub/misc.h | 6 +++--- - 29 files changed, 57 insertions(+), 47 deletions(-) - -diff --git a/grub-core/commands/date.c b/grub-core/commands/date.c -index 8e1f41f141b..0ff0f132c28 100644 ---- a/grub-core/commands/date.c -+++ b/grub-core/commands/date.c -@@ -35,7 +35,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - - static grub_err_t - grub_cmd_date (grub_command_t cmd __attribute__ ((unused)), -- int argc, char **args) -+ int argc, char ** args) - { - struct grub_datetime datetime; - int limit[6][2] = {{1980, 2079}, {1, 12}, {1, 31}, {0, 23}, {0, 59}, {0, 59}}; -@@ -59,7 +59,8 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)), - - for (; argc; argc--, args++) - { -- char *p, c; -+ const char *p; -+ char c; - int m1, ofs, n, cur_mask; - - p = args[0]; -diff --git a/grub-core/commands/password_pbkdf2.c b/grub-core/commands/password_pbkdf2.c -index da636e6217a..ab845d25eb3 100644 ---- a/grub-core/commands/password_pbkdf2.c -+++ b/grub-core/commands/password_pbkdf2.c -@@ -86,7 +86,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)), - int argc, char **args) - { - grub_err_t err; -- char *ptr, *ptr2; -+ const char *ptr, *ptr2; - grub_uint8_t *ptro; - struct pbkdf2_password *pass; - -diff --git a/grub-core/commands/regexp.c b/grub-core/commands/regexp.c -index f00b184c81e..7c5c72fe460 100644 ---- a/grub-core/commands/regexp.c -+++ b/grub-core/commands/regexp.c -@@ -64,7 +64,7 @@ set_matches (char **varnames, char *str, grub_size_t nmatches, - { - int i; - char *p; -- char *q; -+ const char * q; - grub_err_t err; - unsigned long j; - -diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c -index 4be8107d553..016a4d81835 100644 ---- a/grub-core/commands/videoinfo.c -+++ b/grub-core/commands/videoinfo.c -@@ -136,7 +136,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)), - ctx.height = ctx.width = ctx.depth = 0; - if (argc) - { -- char *ptr; -+ const char *ptr; - ptr = args[0]; - ctx.width = grub_strtoul (ptr, &ptr, 0); - if (grub_errno) -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 1a3eb6b8d77..3f264be77d1 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -971,7 +971,8 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) - for (p = vgp->lvs; p; p = p->next) - { - int cur_num; -- char *num, *end; -+ char *num; -+ const char *end; - if (!p->fullname) - continue; - if (grub_strncmp (p->fullname, lv->fullname, len) != 0) -diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c -index 7b265c780c3..0cbd0dd1629 100644 ---- a/grub-core/disk/lvm.c -+++ b/grub-core/disk/lvm.c -@@ -38,7 +38,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - at the number. In case STR is not found, *P will be NULL and the - return value will be 0. */ - static grub_uint64_t --grub_lvm_getvalue (char **p, const char *str) -+grub_lvm_getvalue (const char ** const p, const char *str) - { - *p = grub_strstr (*p, str); - if (! *p) -@@ -63,12 +63,12 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl) - #endif - - static int --grub_lvm_check_flag (char *p, const char *str, const char *flag) -+grub_lvm_check_flag (const char *p, const char *str, const char *flag) - { - grub_size_t len_str = grub_strlen (str), len_flag = grub_strlen (flag); - while (1) - { -- char *q; -+ const char *q; - p = grub_strstr (p, str); - if (! p) - return 0; -@@ -105,7 +105,8 @@ grub_lvm_detect (grub_disk_t disk, - char buf[GRUB_LVM_LABEL_SIZE]; - char vg_id[GRUB_LVM_ID_STRLEN+1]; - char pv_id[GRUB_LVM_ID_STRLEN+1]; -- char *metadatabuf, *p, *q, *vgname; -+ char *metadatabuf, *vgname; -+ const char *p, *q; - struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf; - struct grub_lvm_pv_header *pvh; - struct grub_lvm_disk_locn *dlocn; -diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c -index 2b85f4950bd..88d39360da0 100644 ---- a/grub-core/kern/fs.c -+++ b/grub-core/kern/fs.c -@@ -134,7 +134,7 @@ struct grub_fs_block - static grub_err_t - grub_fs_blocklist_open (grub_file_t file, const char *name) - { -- char *p = (char *) name; -+ const char *p = name; - unsigned num = 0; - unsigned i; - grub_disk_t disk = file->device->disk; -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 5c3899f0e5b..aaae9aa0ab7 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -383,7 +383,7 @@ grub_isspace (int c) - } - - unsigned long --grub_strtoul (const char *str, char **end, int base) -+grub_strtoul (const char *str, const char ** const end, int base) - { - unsigned long long num; - -@@ -400,7 +400,7 @@ grub_strtoul (const char *str, char **end, int base) - } - - unsigned long long --grub_strtoull (const char *str, char **end, int base) -+grub_strtoull (const char *str, const char ** const end, int base) - { - unsigned long long num = 0; - int found = 0; -@@ -901,14 +901,14 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, - { - if (fmt[0] == '0') - zerofill = '0'; -- format1 = grub_strtoul (fmt, (char **) &fmt, 10); -+ format1 = grub_strtoul (fmt, &fmt, 10); - } - - if (*fmt == '.') - fmt++; - - if (grub_isdigit (*fmt)) -- format2 = grub_strtoul (fmt, (char **) &fmt, 10); -+ format2 = grub_strtoul (fmt, &fmt, 10); - - if (*fmt == '$') - { -diff --git a/grub-core/kern/partition.c b/grub-core/kern/partition.c -index e499147cbcb..2c401b866c4 100644 ---- a/grub-core/kern/partition.c -+++ b/grub-core/kern/partition.c -@@ -126,7 +126,7 @@ grub_partition_probe (struct grub_disk *disk, const char *str) - while (*ptr && grub_isalpha (*ptr)) - ptr++; - partname_end = ptr; -- num = grub_strtoul (ptr, (char **) &ptr, 0) - 1; -+ num = grub_strtoul (ptr, &ptr, 0) - 1; - - curpart = 0; - /* Use the first partition map type found. */ -diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c -index fd7744a6ff6..ccc185017ee 100644 ---- a/grub-core/lib/arg.c -+++ b/grub-core/lib/arg.c -@@ -375,7 +375,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv, - - case ARG_TYPE_INT: - { -- char *tail; -+ const char * tail; - - grub_strtoull (option, &tail, 0); - if (tail == 0 || tail == option || *tail != '\0' || grub_errno) -diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c -index ef56150ac77..05719ab2ccb 100644 ---- a/grub-core/lib/legacy_parse.c -+++ b/grub-core/lib/legacy_parse.c -@@ -418,7 +418,7 @@ adjust_file (const char *in, grub_size_t len) - } - if (*comma != ',') - return grub_legacy_escape (in, len); -- part = grub_strtoull (comma + 1, (char **) &rest, 0); -+ part = grub_strtoull (comma + 1, &rest, 0); - if (rest[0] == ',' && rest[1] >= 'a' && rest[1] <= 'z') - { - subpart = rest[1] - 'a'; -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 4afa99279a2..de9fda06f52 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -1062,7 +1062,7 @@ write_entry (struct output_buffer *outbuf, - if (ptr[0] == 'h' && ptr[1] == 'd') - { - is_fd = 0; -- devn = grub_strtoul (ptr + 2, &ptr, 0); -+ devn = grub_strtoul (ptr + 2, (const char **)&ptr, 0); - continue; - } - if (grub_strncasecmp (ptr, "file=", 5) == 0) -@@ -1086,12 +1086,12 @@ write_entry (struct output_buffer *outbuf, - if (ptr[0] == 'f' && ptr[1] == 'd') - { - is_fd = 1; -- devn = grub_strtoul (ptr + 2, &ptr, 0); -+ devn = grub_strtoul (ptr + 2, (const char **)&ptr, 0); - continue; - } - if (grub_isdigit (ptr[0])) - { -- part = grub_strtoul (ptr, &ptr, 0); -+ part = grub_strtoul (ptr, (const char **)&ptr, 0); - continue; - } - /* FIXME: isolinux, ntldr, cmldr, *dos, seg, hide -diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c -index 6329ec01038..27afcaacbce 100644 ---- a/grub-core/loader/i386/xen_fileXX.c -+++ b/grub-core/loader/i386/xen_fileXX.c -@@ -25,7 +25,7 @@ parse_xen_guest (grub_elf_t elf, struct grub_xen_file_info *xi, - grub_off_t off, grub_size_t sz) - { - char *buf; -- char *ptr; -+ const char *ptr; - int has_paddr = 0; - - grub_errno = GRUB_ERR_NONE; -diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index b711a5d9457..38e2a04747a 100644 ---- a/grub-core/net/efi/ip4_config.c -+++ b/grub-core/net/efi/ip4_config.c -@@ -62,7 +62,7 @@ grub_efi_string_to_ip4_address (const char *val, grub_efi_ipv4_address_t *addres - for (i = 0; i < 4; i++) - { - unsigned long t; -- t = grub_strtoul (ptr, (char **) &ptr, 0); -+ t = grub_strtoul (ptr, &ptr, 0); - if (grub_errno) - { - grub_errno = GRUB_ERR_NONE; -diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c -index 017c4d05bc7..e0e00c23d21 100644 ---- a/grub-core/net/efi/ip6_config.c -+++ b/grub-core/net/efi/ip6_config.c -@@ -84,7 +84,7 @@ grub_efi_string_to_ip6_address (const char *val, grub_efi_ipv6_address_t *addres - ptr++; - continue; - } -- t = grub_strtoul (ptr, (char **) &ptr, 16); -+ t = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - { - grub_errno = GRUB_ERR_NONE; -diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 6603cd83edc..cdb8fd111a7 100644 ---- a/grub-core/net/efi/net.c -+++ b/grub-core/net/efi/net.c -@@ -729,7 +729,7 @@ grub_efi_net_parse_address (const char *address, - { - grub_uint32_t subnet_mask_size; - -- subnet_mask_size = grub_strtoul (rest + 1, (char **) &rest, 0); -+ subnet_mask_size = grub_strtoul (rest + 1, &rest, 0); - - if (!grub_errno && subnet_mask_size <= 32 && *rest == 0) - { -@@ -758,7 +758,7 @@ grub_efi_net_parse_address (const char *address, - { - grub_efi_uint8_t prefix_length; - -- prefix_length = grub_strtoul (rest + 1, (char **) &rest, 0); -+ prefix_length = grub_strtoul (rest + 1, &rest, 0); - if (!grub_errno && prefix_length <= 128 && *rest == 0) - { - ip6->prefix_length = prefix_length; -diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c -index 531949cba5c..73e2bb01c1b 100644 ---- a/grub-core/net/efi/pxe.c -+++ b/grub-core/net/efi/pxe.c -@@ -187,7 +187,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) - ptr++; - continue; - } -- t = grub_strtoul (ptr, (char **) &ptr, 16); -+ t = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - { - grub_errno = GRUB_ERR_NONE; -@@ -225,7 +225,7 @@ pxe_open (struct grub_efi_net_device *dev, - int type __attribute__((unused))) - { - int i; -- char *p; -+ const char *p; - grub_efi_status_t status; - grub_efi_pxe_ip_address_t server_ip; - grub_efi_uint64_t file_size = 0; -@@ -313,7 +313,7 @@ pxe_read (struct grub_efi_net_device *dev, - grub_size_t len) - { - int i; -- char *p; -+ const char *p; - grub_efi_status_t status; - grub_efi_pxe_t *pxe = (prefer_ip6) ? dev->ip6_pxe : dev->ip4_pxe; - grub_efi_uint64_t bufsz = len; -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index c9c59690a98..b52b558d631 100644 ---- a/grub-core/net/http.c -+++ b/grub-core/net/http.c -@@ -110,7 +110,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) - return GRUB_ERR_NONE; - } - ptr += sizeof ("HTTP/1.1 ") - 1; -- code = grub_strtoul (ptr, &ptr, 10); -+ code = grub_strtoul (ptr, (const char **)&ptr, 10); - if (grub_errno) - return grub_errno; - switch (code) -@@ -137,7 +137,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) - == 0 && !data->size_recv) - { - ptr += sizeof ("Content-Length: ") - 1; -- file->size = grub_strtoull (ptr, &ptr, 10); -+ file->size = grub_strtoull (ptr, (const char **)&ptr, 10); - data->size_recv = 1; - return GRUB_ERR_NONE; - } -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 27a0a1d6961..aa56393e1c4 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -411,7 +411,7 @@ parse_ip (const char *val, grub_uint32_t *ip, const char **rest) - for (i = 0; i < 4; i++) - { - unsigned long t; -- t = grub_strtoul (ptr, (char **) &ptr, 0); -+ t = grub_strtoul (ptr, &ptr, 0); - if (grub_errno) - { - grub_errno = GRUB_ERR_NONE; -@@ -465,7 +465,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) - ptr++; - continue; - } -- t = grub_strtoul (ptr, (char **) &ptr, 16); -+ t = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - { - grub_errno = GRUB_ERR_NONE; -@@ -577,7 +577,7 @@ grub_net_resolve_net_address (const char *name, - addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; - if (*rest == '/') - { -- addr->ipv4.masksize = grub_strtoul (rest + 1, (char **) &rest, 0); -+ addr->ipv4.masksize = grub_strtoul (rest + 1, &rest, 0); - if (!grub_errno && *rest == 0) - return GRUB_ERR_NONE; - grub_errno = GRUB_ERR_NONE; -@@ -593,7 +593,7 @@ grub_net_resolve_net_address (const char *name, - addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; - if (*rest == '/') - { -- addr->ipv6.masksize = grub_strtoul (rest + 1, (char **) &rest, 0); -+ addr->ipv6.masksize = grub_strtoul (rest + 1, &rest, 0); - if (!grub_errno && *rest == 0) - return GRUB_ERR_NONE; - grub_errno = GRUB_ERR_NONE; -diff --git a/grub-core/net/url.c b/grub-core/net/url.c -index 146858284cd..d9d2fc9a9dc 100644 ---- a/grub-core/net/url.c -+++ b/grub-core/net/url.c -@@ -235,7 +235,7 @@ extract_http_url_info (char *url, int ssl, - c = *port_end; - *port_end = '\0'; - -- portul = grub_strtoul (port_off, &separator, 10); -+ portul = grub_strtoul (port_off, (const char **)&separator, 10); - *port_end = c; - #ifdef URL_TEST - if (portul == ULONG_MAX && errno == ERANGE) -diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c -index a697bcb4d8d..a8afc0c9408 100644 ---- a/grub-core/osdep/devmapper/hostdisk.c -+++ b/grub-core/osdep/devmapper/hostdisk.c -@@ -113,7 +113,7 @@ grub_util_get_dm_node_linear_info (dev_t dev, - void *next = NULL; - uint64_t length, start; - char *target, *params; -- char *ptr; -+ const char *ptr; - int major = 0, minor = 0; - int first = 1; - grub_disk_addr_t partstart = 0; -diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index ba38b5e8aef..c6d2c365c9a 100644 ---- a/grub-core/script/execute.c -+++ b/grub-core/script/execute.c -@@ -146,7 +146,7 @@ replace_scope (struct grub_script_scope *new_scope) - grub_err_t - grub_script_break (grub_command_t cmd, int argc, char *argv[]) - { -- char *p = 0; -+ const char *p = NULL; - unsigned long count; - - if (argc == 0) -@@ -178,7 +178,7 @@ grub_err_t - grub_script_shift (grub_command_t cmd __attribute__((unused)), - int argc, char *argv[]) - { -- char *p = 0; -+ const char *p = NULL; - unsigned long n = 0; - - if (! scope) -@@ -239,7 +239,7 @@ grub_err_t - grub_script_return (grub_command_t cmd __attribute__((unused)), - int argc, char *argv[]) - { -- char *p; -+ const char *p = NULL; - unsigned long n; - - if (! scope || argc > 1) -diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c -index db80b3ba0fb..f9271b09239 100644 ---- a/grub-core/term/serial.c -+++ b/grub-core/term/serial.c -@@ -269,7 +269,7 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) - - if (state[OPTION_BASE_CLOCK].set) - { -- char *ptr; -+ const char *ptr; - config.base_clock = grub_strtoull (state[OPTION_BASE_CLOCK].arg, &ptr, 0); - if (grub_errno) - return grub_errno; -diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index 29df35e6d20..537a5c0cb0b 100644 ---- a/grub-core/term/terminfo.c -+++ b/grub-core/term/terminfo.c -@@ -737,7 +737,7 @@ grub_cmd_terminfo (grub_extcmd_context_t ctxt, int argc, char **args) - - if (state[OPTION_GEOMETRY].set) - { -- char *ptr = state[OPTION_GEOMETRY].arg; -+ const char *ptr = state[OPTION_GEOMETRY].arg; - w = grub_strtoul (ptr, &ptr, 0); - if (grub_errno) - return grub_errno; -diff --git a/grub-core/tests/strtoull_test.c b/grub-core/tests/strtoull_test.c -index 7da615ff33e..5488ab26b43 100644 ---- a/grub-core/tests/strtoull_test.c -+++ b/grub-core/tests/strtoull_test.c -@@ -25,7 +25,7 @@ static void - strtoull_testcase (const char *input, int base, unsigned long long expected, - int num_digits, grub_err_t error) - { -- char *output; -+ const char *output; - unsigned long long value; - grub_errno = 0; - value = grub_strtoull(input, &output, base); -diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index 88f9c5d4ad8..39bad1f432f 100644 ---- a/util/grub-fstest.c -+++ b/util/grub-fstest.c -@@ -538,7 +538,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; - static error_t - argp_parser (int key, char *arg, struct argp_state *state) - { -- char *p; -+ const char *p; - - switch (key) - { -diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h -index 9c642ae3fe3..80b96b972d0 100644 ---- a/include/grub/emu/getroot.h -+++ b/include/grub/emu/getroot.h -@@ -19,6 +19,8 @@ - #ifndef GRUB_UTIL_GETROOT_HEADER - #define GRUB_UTIL_GETROOT_HEADER 1 - -+#define NEED_GRUB_MAKE_SYSTEM_PATH_RELATIVE -+ - #include - #include - -@@ -37,7 +39,9 @@ char *grub_find_device (const char *dir, dev_t dev); - void grub_util_pull_device (const char *osname); - char **grub_guess_root_devices (const char *dir); - int grub_util_get_dev_abstraction (const char *os_dev); -+#ifndef NEED_GRUB_MAKE_SYSTEM_PATH_RELATIVE - char *grub_make_system_path_relative_to_its_root (const char *path); -+#endif - char * - grub_make_system_path_relative_to_its_root_os (const char *path); - char *grub_util_get_grub_dev (const char *os_dev); -diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index 5ef4f79e689..8e241c9298a 100644 ---- a/include/grub/emu/misc.h -+++ b/include/grub/emu/misc.h -@@ -41,6 +41,9 @@ void grub_find_zpool_from_dir (const char *dir, - - char *grub_make_system_path_relative_to_its_root (const char *path) - WARN_UNUSED_RESULT; -+#ifdef NEED_GRUB_MAKE_SYSTEM_PATH_RELATIVE -+#undef NEED_GRUB_MAKE_SYSTEM_PATH_RELATIVE -+#endif - int - grub_util_device_is_mapped (const char *dev); - -diff --git a/include/grub/misc.h b/include/grub/misc.h -index 960097fbd06..b7fc9c6a792 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -288,11 +288,11 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n) - - (int) grub_tolower ((grub_uint8_t) *s2); - } - --unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base); --unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base); -+unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, const char ** const end, int base); -+unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, const char ** const end, int base); - - static inline long --grub_strtol (const char *str, char **end, int base) -+grub_strtol (const char *str, const char ** const end, int base) - { - int negative = 0; - unsigned long long magnitude; diff --git a/0161-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0161-Fix-menu-entry-selection-based-on-ID-and-title.patch index 2105e759..84c13706 100644 --- a/0161-Fix-menu-entry-selection-based-on-ID-and-title.patch +++ b/0161-Fix-menu-entry-selection-based-on-ID-and-title.patch @@ -20,11 +20,11 @@ Signed-off-by: Peter Jones [javierm: fix menu entry selection based on title] Signed-off-by: Javier Martinez Canillas --- - grub-core/normal/menu.c | 143 ++++++++++++++++++++++++------------------------ - 1 file changed, 72 insertions(+), 71 deletions(-) + grub-core/normal/menu.c | 141 ++++++++++++++++++++++++------------------------ + 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 046a1fb2c84..920b44a8aed 100644 +index 37d753d8081..ea714d27176 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -164,12 +164,12 @@ grub_menu_set_timeout (int timeout) @@ -114,18 +114,15 @@ index 046a1fb2c84..920b44a8aed 100644 /* Get the first entry number from the value of the environment variable NAME, which is a space-separated list of non-negative integers. The entry number which is returned is stripped from the value of NAME. If no entry number -@@ -195,9 +251,8 @@ static int - get_and_remove_first_entry_number (grub_menu_t menu, const char *name) +@@ -196,7 +252,6 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) { - const char *val; -- char *tail; -+ const char *tail; + const char *val, *tail; int entry; - int sz = 0; val = grub_env_get (name); if (! val) -@@ -205,50 +260,24 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) +@@ -204,50 +259,24 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) grub_error_push (); @@ -184,7 +181,7 @@ index 046a1fb2c84..920b44a8aed 100644 } grub_error_pop (); -@@ -525,6 +554,7 @@ static int +@@ -524,6 +553,7 @@ static int get_entry_number (grub_menu_t menu, const char *name) { const char *val; @@ -192,7 +189,7 @@ index 046a1fb2c84..920b44a8aed 100644 int entry; val = grub_env_get (name); -@@ -532,38 +562,9 @@ get_entry_number (grub_menu_t menu, const char *name) +@@ -531,38 +561,9 @@ get_entry_number (grub_menu_t menu, const char *name) return -1; grub_error_push (); diff --git a/0164-Make-it-possible-to-subtract-conditions-from-debug.patch b/0164-Make-it-possible-to-subtract-conditions-from-debug.patch index 24cc7246..c281ef62 100644 --- a/0164-Make-it-possible-to-subtract-conditions-from-debug.patch +++ b/0164-Make-it-possible-to-subtract-conditions-from-debug.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index aaae9aa0ab7..f6eaa7b4df8 100644 +index e21dd44c7cf..18a7dbf4cd7 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -163,12 +163,24 @@ int diff --git a/0165-Export-all-variables-from-the-initial-context-when-c.patch b/0165-Export-all-variables-from-the-initial-context-when-c.patch index bd61eff6..bfe31653 100644 --- a/0165-Export-all-variables-from-the-initial-context-when-c.patch +++ b/0165-Export-all-variables-from-the-initial-context-when-c.patch @@ -30,10 +30,10 @@ index ee53d4a68e5..87edd254c44 100644 int grub_extractor_level = 0; diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 920b44a8aed..341228f87c9 100644 +index ea714d27176..d4832f17699 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c -@@ -376,8 +376,6 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) +@@ -375,8 +375,6 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) if (ptr && ptr[0] && ptr[1]) grub_env_set ("default", ptr + 1); diff --git a/0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch b/0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch index 0dc6a975..21d242e4 100644 --- a/0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch +++ b/0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch @@ -16,10 +16,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index f6eaa7b4df8..2477eb609ba 100644 +index 18a7dbf4cd7..87afb43cd55 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -473,8 +473,7 @@ grub_strtoull (const char *str, const char ** const end, int base) +@@ -475,8 +475,7 @@ grub_strtoull (const char * restrict str, const char ** const restrict end, if (! found) { diff --git a/0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch index 707c1e93..34cff10f 100644 --- a/0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch +++ b/0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch @@ -17,10 +17,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 341228f87c9..6ef7e2f8e6f 100644 +index d4832f17699..9ea1f411814 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c -@@ -286,7 +286,7 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) +@@ -285,7 +285,7 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) } /* Run a menu entry. */ @@ -29,7 +29,7 @@ index 341228f87c9..6ef7e2f8e6f 100644 grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) { grub_err_t err = GRUB_ERR_NONE; -@@ -386,7 +386,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) +@@ -385,7 +385,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ()) /* Implicit execution of boot, only if something is loaded. */ @@ -38,7 +38,7 @@ index 341228f87c9..6ef7e2f8e6f 100644 if (errs_before != grub_err_printed_errors) grub_wait_after_message (); -@@ -409,6 +409,8 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) +@@ -408,6 +408,8 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) else grub_env_unset ("default"); grub_env_unset ("timeout"); @@ -47,7 +47,7 @@ index 341228f87c9..6ef7e2f8e6f 100644 } /* Execute ENTRY from the menu MENU, falling back to entries specified -@@ -423,10 +425,13 @@ grub_menu_execute_with_fallback (grub_menu_t menu, +@@ -422,10 +424,13 @@ grub_menu_execute_with_fallback (grub_menu_t menu, void *callback_data) { int fallback_entry; @@ -62,7 +62,7 @@ index 341228f87c9..6ef7e2f8e6f 100644 /* Deal with fallback entries. */ while ((fallback_entry = get_and_remove_first_entry_number (menu, "fallback")) -@@ -437,11 +442,9 @@ grub_menu_execute_with_fallback (grub_menu_t menu, +@@ -436,11 +441,9 @@ grub_menu_execute_with_fallback (grub_menu_t menu, entry = grub_menu_get_entry (menu, fallback_entry); callback->notify_fallback (entry, callback_data); diff --git a/0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch new file mode 100644 index 00000000..1f857605 --- /dev/null +++ b/0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 5 Mar 2020 16:21:47 +0100 +Subject: [PATCH] efi/http: Export {fw,http}_path variables to make them global + +The fw_path environment variable is used by http_configure() function to +determine the HTTP path that should be used as prefix when using relative +HTTP paths. And this is stored in the http_path environment variable. + +Later, that variable is looked up by grub_efihttp_open() to generate the +complete path to be used in the HTTP request. + +But these variables are not exported, which means that are not global and +so are only found in the initial context. + +This can cause commands like configfile that create a new context to fail +because the fw_path and http_path variables will not be found. + +Resolves: rhbz#1616395 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/kern/main.c | 1 + + grub-core/net/efi/http.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index dcf48726d54..9bf6a8b231a 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -142,6 +142,7 @@ grub_set_prefix_and_root (void) + if (fw_path) + { + grub_env_set ("fw_path", fw_path); ++ grub_env_export ("fw_path"); + grub_dprintf ("fw_path", "fw_path:\"%s\"\n", fw_path); + grub_free (fw_path); + } +diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c +index de351b2cd03..755b7a6d054 100644 +--- a/grub-core/net/efi/http.c ++++ b/grub-core/net/efi/http.c +@@ -39,6 +39,7 @@ http_configure (struct grub_efi_net_device *dev, int prefer_ip6) + http_path++; + grub_env_unset ("http_path"); + grub_env_set ("http_path", http_path); ++ grub_env_export ("http_path"); + } + } + diff --git a/0200-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0200-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch new file mode 100644 index 00000000..c3945498 --- /dev/null +++ b/0200-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch @@ -0,0 +1,114 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 5 Mar 2020 16:21:58 +0100 +Subject: [PATCH] efi/http: Enclose literal IPv6 addresses in square brackets + +According to RFC 2732 (https://www.ietf.org/rfc/rfc2732.txt), literal IPv6 +addresses must be enclosed in square brackets. But GRUB currently does not +do this and is causing HTTP servers to send Bad Request (400) responses. + +For example, the following is the HTTP stream when fetching a config file: + +HEAD /EFI/BOOT/grub.cfg HTTP/1.1 +Host: 2000:dead:beef:a::1 +Accept: */* +User-Agent: UefiHttpBoot/1.0 + +HTTP/1.1 400 Bad Request +Date: Thu, 05 Mar 2020 14:46:02 GMT +Server: Apache/2.4.41 (Fedora) OpenSSL/1.1.1d +Connection: close +Content-Type: text/html; charset=iso-8859-1 + +and after enclosing the IPv6 address the HTTP request is successful: + +HEAD /EFI/BOOT/grub.cfg HTTP/1.1 +Host: [2000:dead:beef:a::1] +Accept: */* +User-Agent: UefiHttpBoot/1.0 + +HTTP/1.1 200 OK +Date: Thu, 05 Mar 2020 14:48:04 GMT +Server: Apache/2.4.41 (Fedora) OpenSSL/1.1.1d +Last-Modified: Thu, 27 Feb 2020 17:45:58 GMT +ETag: "206-59f924b24b1da" +Accept-Ranges: bytes +Content-Length: 518 + +Resolves: rhbz#1732765 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/net/efi/http.c | 37 ++++++++++++++++++++++++++++--------- + 1 file changed, 28 insertions(+), 9 deletions(-) + +diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c +index 755b7a6d054..fc8cb25ae0a 100644 +--- a/grub-core/net/efi/http.c ++++ b/grub-core/net/efi/http.c +@@ -158,13 +158,7 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, + grub_efi_status_t status; + grub_efi_boot_services_t *b = grub_efi_system_table->boot_services; + char *url = NULL; +- +- request_headers[0].field_name = (grub_efi_char8_t *)"Host"; +- request_headers[0].field_value = (grub_efi_char8_t *)server; +- request_headers[1].field_name = (grub_efi_char8_t *)"Accept"; +- request_headers[1].field_value = (grub_efi_char8_t *)"*/*"; +- request_headers[2].field_name = (grub_efi_char8_t *)"User-Agent"; +- request_headers[2].field_value = (grub_efi_char8_t *)"UefiHttpBoot/1.0"; ++ char *hostname = NULL; + + { + grub_efi_ipv6_address_t address; +@@ -174,9 +168,24 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, + const char *protocol = (use_https == 1) ? "https" : "http"; + + if (grub_efi_string_to_ip6_address (server, &address, &rest) && *rest == 0) +- url = grub_xasprintf ("%s://[%s]%s", protocol, server, name); ++ { ++ hostname = grub_xasprintf ("[%s]", server); ++ if (!hostname) ++ return GRUB_ERR_OUT_OF_MEMORY; ++ ++ server = hostname; ++ ++ url = grub_xasprintf ("%s://%s%s", protocol, server, name); ++ if (!url) ++ { ++ grub_free (hostname); ++ return GRUB_ERR_OUT_OF_MEMORY; ++ } ++ } + else +- url = grub_xasprintf ("%s://%s%s", protocol, server, name); ++ { ++ url = grub_xasprintf ("%s://%s%s", protocol, server, name); ++ } + + if (!url) + { +@@ -199,6 +208,13 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, + request_data.url = ucs2_url; + } + ++ request_headers[0].field_name = (grub_efi_char8_t *)"Host"; ++ request_headers[0].field_value = (grub_efi_char8_t *)server; ++ request_headers[1].field_name = (grub_efi_char8_t *)"Accept"; ++ request_headers[1].field_value = (grub_efi_char8_t *)"*/*"; ++ request_headers[2].field_name = (grub_efi_char8_t *)"User-Agent"; ++ request_headers[2].field_value = (grub_efi_char8_t *)"UefiHttpBoot/1.0"; ++ + request_data.method = (headeronly > 0) ? GRUB_EFI_HTTPMETHODHEAD : GRUB_EFI_HTTPMETHODGET; + + request_message.data.request = &request_data; +@@ -228,6 +244,9 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, + + status = efi_call_2 (http->request, http, &request_token); + ++ if (hostname) ++ grub_free (hostname); ++ + if (status != GRUB_EFI_SUCCESS) + { + efi_call_1 (b->close_event, request_token.event); diff --git a/0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch new file mode 100644 index 00000000..209aed80 --- /dev/null +++ b/0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 9 Mar 2020 15:29:45 +0100 +Subject: [PATCH] efi/net: Allow to specify a port number in addresses + +The grub_efi_net_parse_address() function is not covering the case where a +port number is specified in an IPv4 or IPv6 address, so will fail to parse +the network address. + +For most cases the issue is harmless, because the function is only used to +match an address with a network interface and if fails the default is used. + +But still is a bug that has to be fixed and it causes error messages to be +printed like the following: + +error: net/efi/net.c:782:unrecognised network address '192.168.122.1:8080' + +error: net/efi/net.c:781:unrecognised network address '[2000:dead:beef:a::1]:8080' + +Resolves: rhbz#1732765 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/net/efi/net.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c +index 6603cd83edc..84573937b18 100644 +--- a/grub-core/net/efi/net.c ++++ b/grub-core/net/efi/net.c +@@ -742,7 +742,7 @@ grub_efi_net_parse_address (const char *address, + return GRUB_ERR_NONE; + } + } +- else if (*rest == 0) ++ else if (*rest == 0 || *rest == ':') + { + grub_uint32_t subnet_mask = 0xffffffffU; + grub_memcpy (ip4->subnet_mask, &subnet_mask, sizeof (ip4->subnet_mask)); +@@ -768,7 +768,7 @@ grub_efi_net_parse_address (const char *address, + return GRUB_ERR_NONE; + } + } +- else if (*rest == 0) ++ else if (*rest == 0 || *rest == ':') + { + ip6->prefix_length = 128; + ip6->is_anycast = 0; diff --git a/0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch new file mode 100644 index 00000000..f92dee44 --- /dev/null +++ b/0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 9 Mar 2020 15:30:05 +0100 +Subject: [PATCH] efi/ip4_config: Improve check to detect literal IPv6 + addresses + +The grub_efi_string_to_ip4_address() function wrongly assumes that an IPv6 +address is an IPv4 address, because it doesn't take into account the case +of a caller passing an IPv6 address as a string. + +This leads to the grub_efi_net_parse_address() function to fail and print +the following error message: + +error: net/efi/net.c:785:unrecognised network address '2000:dead:beef:a::1' + +Resolves: rhbz#1732765 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/net/efi/ip4_config.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c +index b711a5d9457..313c818b184 100644 +--- a/grub-core/net/efi/ip4_config.c ++++ b/grub-core/net/efi/ip4_config.c +@@ -56,9 +56,20 @@ int + grub_efi_string_to_ip4_address (const char *val, grub_efi_ipv4_address_t *address, const char **rest) + { + grub_uint32_t newip = 0; +- int i; ++ int i, ncolon = 0; + const char *ptr = val; + ++ /* Check that is not an IPv6 address */ ++ for (i = 0; i < grub_strlen(ptr); i++) ++ { ++ if (ptr[i] == '[' && i == 0) ++ return 0; ++ ++ if (ptr[i] == ':') ++ if (i == 0 || ++ncolon == 2) ++ return 0; ++ } ++ + for (i = 0; i < 4; i++) + { + unsigned long t; diff --git a/0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch new file mode 100644 index 00000000..33d8f886 --- /dev/null +++ b/0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 10 Mar 2020 11:23:49 +0100 +Subject: [PATCH] efi/net: Print a debug message if parsing the address fails + +Currently if parsing the address fails an error message is printed. But in +most cases this isn't a fatal error since the grub_efi_net_parse_address() +function is only used to match an address with a network interface to use. + +And if this fails, the default interface is used which is good enough for +most cases. So instead of printing an error that would pollute the console +just print a debug message if the address is not parsed correctly. + +A user can enable debug messages for the efinet driver to have information +about the failure and the fact that the default interface is being used. + +Related: rhbz#1732765 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/net/efi/net.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c +index 84573937b18..a3f0535d43c 100644 +--- a/grub-core/net/efi/net.c ++++ b/grub-core/net/efi/net.c +@@ -778,9 +778,9 @@ grub_efi_net_parse_address (const char *address, + } + } + +- return grub_error (GRUB_ERR_NET_BAD_ADDRESS, +- N_("unrecognised network address `%s'"), +- address); ++ grub_dprintf ("efinet", "unrecognised network address '%s'\n", address); ++ ++ return GRUB_ERR_NET_BAD_ADDRESS; + } + + static grub_efi_net_interface_t * +@@ -795,10 +795,7 @@ match_route (const char *server) + err = grub_efi_net_parse_address (server, &ip4, &ip6, &is_ip6, 0); + + if (err) +- { +- grub_print_error (); + return NULL; +- } + + if (is_ip6) + { +@@ -1233,8 +1230,15 @@ grub_net_open_real (const char *name __attribute__ ((unused))) + /*FIXME: Use DNS translate name to address */ + net_interface = match_route (server); + ++ if (!net_interface && net_default_interface) ++ { ++ net_interface = net_default_interface; ++ grub_dprintf ("efinet", "interface lookup failed, using default '%s'\n", ++ net_interface->name); ++ } ++ + /*XXX: should we check device with default gateway ? */ +- if (!net_interface && !(net_interface = net_default_interface)) ++ if (!net_interface) + { + grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' no route found"), + name); diff --git a/0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch b/0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch new file mode 100644 index 00000000..fa35f659 --- /dev/null +++ b/0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 16 Mar 2020 13:51:45 +0100 +Subject: [PATCH] blscfg: return NULL instead of a zero-length array in + bls_make_list() + +The bls_make_list() function returns a list of all the values for a given +key and if there is none a NULL pointer should be returned. But currently +is returnin a zero-length array instead. + +This makes the callers to wrongly assume that there are values for a key +and populate wrong menu entries. For example menu entries are populated +with an initrd command even if there is no initrd fiel in the BLS file. + +Resolves: rhbz#1806022 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 24e35a40f24..9263a5c1a02 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -600,6 +600,12 @@ static char **bls_make_list (struct bls_entry *entry, const char *key, int *num) + list[nlist] = NULL; + } + ++ if (!nlist) ++ { ++ grub_free (list); ++ return NULL; ++ } ++ + if (num) + *num = nlist; + diff --git a/grub.patches b/grub.patches index 369b6484..483aa8bf 100644 --- a/grub.patches +++ b/grub.patches @@ -157,7 +157,7 @@ Patch0156: 0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch Patch0157: 0157-Fix-getroot.c-s-trampolines.patch Patch0158: 0158-Do-not-allow-stack-trampolines-anywhere.patch Patch0159: 0159-Reimplement-boot_counter.patch -Patch0160: 0160-Make-grub_strtoul-end-pointer-have-the-right-constif.patch +Patch0160: 0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch Patch0161: 0161-Fix-menu-entry-selection-based-on-ID-and-title.patch Patch0162: 0162-Make-the-menu-entry-users-option-argument-to-be-opti.patch Patch0163: 0163-Add-efi-export-env-and-efi-load-env-commands.patch @@ -196,3 +196,9 @@ Patch0195: 0195-RISC-V-Add-__clzdi2-symbol.patch Patch0196: 0196-grub-install-Define-default-platform-for-RISC-V.patch Patch0197: 0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch Patch0198: 0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0199: 0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0200: 0200-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0201: 0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0202: 0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0203: 0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0204: 0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch diff --git a/grub2.spec b/grub2.spec index d01388ac..a3532221 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -338,8 +338,6 @@ rm -r /boot/grub2.tmp/ || : %files common -f grub.lang %dir %{_libdir}/grub/ %dir %{_datarootdir}/grub/ -%dir %{_datarootdir}/grub/themes/ -%exclude %{_datarootdir}/grub/themes/* %attr(0700,root,root) %dir %{_sysconfdir}/grub.d %{_prefix}/lib/kernel/install.d/20-grub.install %{_prefix}/lib/kernel/install.d/99-grub-mkconfig.install @@ -348,7 +346,6 @@ rm -r /boot/grub2.tmp/ || : %dir /boot/%{name} %dir /boot/%{name}/themes/ %dir /boot/%{name}/themes/system -%exclude /boot/%{name}/themes/system/* %attr(0700,root,root) %dir /boot/grub2 %exclude /boot/grub2/* %dir %attr(0700,root,root) %{efi_esp_dir} @@ -512,6 +509,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Tue Mar 17 2020 Javier Martinez Canillas - 2.04-10 +- Fix for entries having an empty initrd command and HTTP boot issues + Resolves: rhbz#1806022 + * Thu Jan 16 2020 Javier Martinez Canillas - 2.04-9 - Add riscv64 support to grub.macros and RISC-V build fixes (davidlt) - blscfg: Always use the root variable to search for BLS snippets From 7c2bab5e98d1f376ef9bea2cf2f8f0a6db3dc933 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 26 Mar 2020 18:19:43 +0100 Subject: [PATCH 018/294] grub-switch-to-blscfg: Update grub2 binary in ESP for OSTree systems Related: rhbz#1751272 Signed-off-by: Javier Martinez Canillas --- ...lscfg-Update-grub2-binary-in-ESP-for.patch | 37 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 ++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch diff --git a/0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch b/0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch new file mode 100644 index 00000000..5993a6ba --- /dev/null +++ b/0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 26 Mar 2020 15:08:30 +0100 +Subject: [PATCH] grub-switch-to-blscfg: Update grub2 binary in ESP for OSTree + systems + +The grub2 EFI binary in the ESP isn't updated as a part of an OSTree update +transaction. So let's make the script to update this and also create a file +to indicate that the installed version has support for the blscfg module. + +Related: rhbz#1751272 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-switch-to-blscfg.in | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in +index 49b3985fadb..a05a8d98554 100644 +--- a/util/grub-switch-to-blscfg.in ++++ b/util/grub-switch-to-blscfg.in +@@ -266,6 +266,15 @@ copy_bls() { + fi + } + ++# The grub2 EFI binary is not copied to the ESP as a part of an ostree ++# transaction. Make sure a grub2 version with BLS support is installed. ++if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars/; then ++ grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" ++ cp ${grub_binary} ${grubdir} || exit 1 ++ # Create a hidden file to indicate that grub2 now has BLS support. ++ touch /boot/grub2/.grub2-blscfg-supported ++fi ++ + GENERATE=0 + if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \ + | grep -vq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' ; then diff --git a/grub.patches b/grub.patches index 483aa8bf..1704303d 100644 --- a/grub.patches +++ b/grub.patches @@ -202,3 +202,4 @@ Patch0201: 0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch Patch0202: 0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch Patch0203: 0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch Patch0204: 0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch +Patch0205: 0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch diff --git a/grub2.spec b/grub2.spec index a3532221..0b74f16b 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -509,6 +509,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Mar 26 2020 Javier Martinez Canillas - 2.04-11 +- grub-switch-to-blscfg: Update grub2 binary in ESP for OSTree systems + Related: rhbz#1751272 + * Tue Mar 17 2020 Javier Martinez Canillas - 2.04-10 - Fix for entries having an empty initrd command and HTTP boot issues Resolves: rhbz#1806022 From 7509e59c4a99ff3b1cd479bcb102e5ab41123abf Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 2 Apr 2020 14:44:30 +0200 Subject: [PATCH 019/294] Drop 10_linux_bls and avoid corner case of blsdir set with ostree The logic to parse the BLS configs to generate a set of menuentry commands that's needed on ppc64le machines with bootloaders that don't have support to parse BLS config directly, was implemented in a 10_linux_bls script. But there's no need to have a separate script just for this and this logic can be merged into the 10_linux script to avoid code duplication. Also since the blscfg module will also now be used by ostree-based distros there is a possible corner case in which a user set the blsdir variable to a BLS directory path that is different than the default used by ostree. So to avoid possible issues, only drop the marker file to specify that the bootloader has support to parse BLS files if this variable hasn't been set. Signed-off-by: Javier Martinez Canillas --- ...lscfg-Only-mark-GRUB-as-BLS-supporte.patch | 37 + ...e-logic-from-10_linux_bls-and-drop-t.patch | 662 ++++++++++++++++++ 99-grub-mkconfig.install | 23 +- grub.patches | 2 + grub2.spec | 10 +- 5 files changed, 724 insertions(+), 10 deletions(-) create mode 100644 0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch create mode 100644 0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch diff --git a/0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch b/0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch new file mode 100644 index 00000000..27ef6e0a --- /dev/null +++ b/0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 2 Apr 2020 11:07:24 +0200 +Subject: [PATCH] grub-switch-to-blscfg: Only mark GRUB as BLS supported if + blsdir isn't set + +If the user set the blsdir environemnt variable to a path that is not the +default where ostree writes the BLS snippets, the blscfg module won't be +able to parse them and can lead to not having any menu entries on boot. + +So to minimize the risk of things going wrong when dropping the 15_ostree +script used by ostree to create the menu entries, only mark the bootloader +as BLS supported if the blsdir variable has not been set. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-switch-to-blscfg.in | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in +index a05a8d98554..4bbed8e4fe9 100644 +--- a/util/grub-switch-to-blscfg.in ++++ b/util/grub-switch-to-blscfg.in +@@ -267,8 +267,11 @@ copy_bls() { + } + + # The grub2 EFI binary is not copied to the ESP as a part of an ostree +-# transaction. Make sure a grub2 version with BLS support is installed. +-if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars/; then ++# transaction. Make sure a grub2 version with BLS support is installed ++# but only do this if the blsdir is not set, to make sure that the BLS ++# parsing module will search for the BLS snippets in the default path. ++if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \ ++ ! ${grub_editenv} - list | grep -q blsdir; then + grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" + cp ${grub_binary} ${grubdir} || exit 1 + # Create a hidden file to indicate that grub2 now has BLS support. diff --git a/0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch b/0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch new file mode 100644 index 00000000..cd4be69e --- /dev/null +++ b/0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch @@ -0,0 +1,662 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 31 Mar 2020 12:35:42 +0200 +Subject: [PATCH] 10_linux.in: Merge logic from 10_linux_bls and drop that + script + +There's a 10_linux_bls snippet that's used in ppc64le machines to generate +a set of menuentry commands by parsing BLS configs in /boot/loader/entries. + +This was made because on PowerNV ppc64le machines that boot using the OPAL +firmware, there could be an old version of the Petitboot bootloader that +doesn't have support to parse BLS snippets. + +But there is no need to have a separate GRUB script for that and the logic +could just be part of the usual 10_linux snippet. + +Also the BLS files could be used directly if the bootloader has support to +parse them, which is the case for GRUB that's used in ppc64le OF or if the +Petitboot used in ppc64le OPAL machines is version 1.8.0 or newer. + +So only generate the menuentry commands from the BLS snippets in the case +of OPAL machines with an old Petitboot version. + +Signed-off-by: Javier Martinez Canillas +--- + Makefile.util.def | 7 - + util/grub.d/10_linux.in | 97 ++++++++- + util/grub.d/10_linux_bls.in | 470 -------------------------------------------- + 3 files changed, 96 insertions(+), 478 deletions(-) + delete mode 100644 util/grub.d/10_linux_bls.in + +diff --git a/Makefile.util.def b/Makefile.util.def +index 1fa92caad4d..f3a699691bf 100644 +--- a/Makefile.util.def ++++ b/Makefile.util.def +@@ -517,13 +517,6 @@ script = { + condition = COND_HOST_LINUX; + }; + +-script = { +- name = '10_linux_bls'; +- common = util/grub.d/10_linux_bls.in; +- installdir = grubconf; +- condition = COND_HOST_LINUX; +-}; +- + script = { + name = '10_reset_boot_success'; + common = util/grub.d/10_reset_boot_success.in; +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index b70dca27567..c72cc3246bb 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -84,18 +84,86 @@ esac + + populate_header_warn() + { ++if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then ++ bls_parser="10_linux script" ++else ++ bls_parser="blscfg command" ++fi + cat <&2 ++ ++ files=($(for bls in ${blsdir}/*.conf ; do ++ if ! [[ -e "${bls}" ]] ; then ++ continue ++ fi ++ bls="${bls%.conf}" ++ bls="${bls##*/}" ++ echo "${bls}" ++ done | ${kernel_sort} | tac)) || : ++ ++ for bls in "${files[@]}" ; do ++ read_config "${blsdir}/${bls}.conf" ++ ++ menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" ++ menu="${menu}\t linux ${linux} ${options}\n" ++ if [ -n "${initrd}" ] ; then ++ menu="${menu}\t initrd ${boot_prefix}${initrd}\n" ++ fi ++ menu="${menu}}\n\n" ++ done ++ # The printf command seems to be more reliable across shells for special character (\n, \t) evaluation ++ printf "$menu" ++} ++ + if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + if [ x$dirname = x/ ]; then + if [ -z "${prepare_root_cache}" ]; then +@@ -115,6 +183,26 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + prepare_grub_to_access_device_with_variable boot ${boot_device} + fi + ++ arch="$(uname -m)" ++ if [ "x${arch}" = "xppc64le" ] && [ -d /sys/firmware/opal ]; then ++ ++ petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" ++ ++ if test -e ${petitboot_path}; then ++ read -a petitboot_version < ${petitboot_path} ++ petitboot_version="$(echo ${petitboot_version//v})" ++ major_version="$(echo ${petitboot_version} | cut -d . -f1)" ++ minor_version="$(echo ${petitboot_version} | cut -d . -f2)" ++ ++ if test -z ${petitboot_version} || test ${major_version} -lt 1 || \ ++ test ${major_version} -eq 1 -a ${minor_version} -lt 8; then ++ BLS_POPULATE_MENU="true" ++ fi ++ else ++ BLS_POPULATE_MENU="true" ++ fi ++ fi ++ + populate_header_warn + + cat << EOF +@@ -129,10 +217,17 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + if [ -z "\${kernelopts}" ]; then + set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + fi ++EOF ++ ++ if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then ++ populate_menu ++ else ++ cat << EOF + + insmod blscfg + blscfg + EOF ++ fi + + if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then + blsdir="/boot/loader/entries" +diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in +deleted file mode 100644 +index 68fbedf2129..00000000000 +--- a/util/grub.d/10_linux_bls.in ++++ /dev/null +@@ -1,470 +0,0 @@ +-#! /bin/sh +-set -e +- +-# grub-mkconfig helper script. +-# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. +-# +-# GRUB is free software: you can redistribute it and/or modify +-# it under the terms of the GNU General Public License as published by +-# the Free Software Foundation, either version 3 of the License, or +-# (at your option) any later version. +-# +-# GRUB is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with GRUB. If not, see . +- +-prefix="@prefix@" +-exec_prefix="@exec_prefix@" +-datarootdir="@datarootdir@" +- +-. "$pkgdatadir/grub-mkconfig_lib" +- +-export TEXTDOMAIN=@PACKAGE@ +-export TEXTDOMAINDIR="@localedir@" +- +-CLASS="--class gnu-linux --class gnu --class os --unrestricted" +- +-if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then +- OS="$(eval $(grep PRETTY_NAME /etc/os-release) ; echo ${PRETTY_NAME})" +- CLASS="--class $(eval $(grep '^ID_LIKE=\|^ID=' /etc/os-release) ; [ -n "${ID_LIKE}" ] && echo ${ID_LIKE} || echo ${ID}) ${CLASS}" +-else +- OS="${GRUB_DISTRIBUTOR}" +- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" +-fi +- +-# loop-AES arranges things so that /dev/loop/X can be our root device, but +-# the initrds that Linux uses don't like that. +-case ${GRUB_DEVICE} in +- /dev/loop/*|/dev/loop[0-9]) +- GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` +- ;; +-esac +- +-# Default to disabling partition uuid support to maintian compatibility with +-# older kernels. +-GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true} +- +-# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter +-# and mounting btrfs requires user space scanning, so force UUID in this case. +-if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \ +- || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ +- && [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \ +- || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ +- && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \ +- || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then +- LINUX_ROOT_DEVICE=${GRUB_DEVICE} +-elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \ +- || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then +- LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID} +-else +- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} +-fi +- +-case x"$GRUB_FS" in +- xbtrfs) +- if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then +- GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}" +- else +- rootsubvol="`make_system_path_relative_to_its_root /`" +- rootsubvol="${rootsubvol#/}" +- if [ "x${rootsubvol}" != x ]; then +- GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" +- fi +- fi;; +- xzfs) +- rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` +- bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" +- LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}" +- ;; +-esac +- +-mktitle () +-{ +- local title_type +- local version +- local OS_NAME +- local OS_VERS +- +- title_type=$1 && shift +- version=$1 && shift +- +- OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})" +- OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})" +- +- case $title_type in +- recovery) +- title=$(printf '%s (%s) %s (recovery mode)' \ +- "${OS_NAME}" "${version}" "${OS_VERS}") +- ;; +- *) +- title=$(printf '%s (%s) %s' \ +- "${OS_NAME}" "${version}" "${OS_VERS}") +- ;; +- esac +- echo -n ${title} +-} +- +-title_correction_code= +- +-populate_header_warn() +-{ +-cat <&2 +- +- files=($(for bls in ${blsdir}/*.conf ; do +- if ! [[ -e "${bls}" ]] ; then +- continue +- fi +- bls="${bls%.conf}" +- bls="${bls##*/}" +- echo "${bls}" +- done | ${kernel_sort} | tac)) || : +- +- for bls in "${files[@]}" ; do +- read_config "${blsdir}/${bls}.conf" +- +- menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" +- menu="${menu}\t linux ${linux} ${options}\n" +- if [ -n "${initrd}" ] ; then +- menu="${menu}\t initrd ${boot_prefix}${initrd}\n" +- fi +- menu="${menu}}\n\n" +- done +- # The printf command seems to be more reliable across shells for special character (\n, \t) evaluation +- printf "$menu" +-} +- +-linux_entry () +-{ +- os="$1" +- version="$2" +- type="$3" +- isdebug="$4" +- args="$5" +- +- if [ -z "$boot_device_id" ]; then +- boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" +- fi +- +- if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then +- if [ x$dirname = x/ ]; then +- if [ -z "${prepare_root_cache}" ]; then +- prepare_grub_to_access_device ${GRUB_DEVICE} +- fi +- else +- if [ -z "${prepare_boot_cache}" ]; then +- prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} +- fi +- fi +- +- if [ -d /sys/firmware/efi ]; then +- bootefi_device="`${grub_probe} --target=device /boot/efi/`" +- prepare_grub_to_access_device_with_variable boot ${bootefi_device} +- else +- boot_device="`${grub_probe} --target=device /boot/`" +- prepare_grub_to_access_device_with_variable boot ${boot_device} +- fi +- +- populate_header_warn +- populate_menu +- +- if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then +- blsdir="/boot/loader/entries" +- [ -d "${blsdir}" ] && GRUB_BLS_FS="$(${grub_probe} --target=fs ${blsdir})" +- if [ "x${GRUB_BLS_FS}" = "xbtrfs" ] || [ "x${GRUB_BLS_FS}" = "xzfs" ]; then +- blsdir=$(make_system_path_relative_to_its_root "${blsdir}") +- if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then +- ${grub_editenv} - set blsdir="${blsdir}" +- fi +- fi +- +- ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}" +- if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then +- ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" +- fi +- fi +- +- exit 0 +- fi +- +- if [ x$type != xsimple ] ; then +- title=$(mktitle "$type" "$version") +- if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then +- replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" +- quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" +- title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" +- fi +- if [ x$isdebug = xdebug ]; then +- title="$title${GRUB_LINUX_DEBUG_TITLE_POSTFIX}" +- fi +- echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" +- else +- echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" +- fi +- if [ x$type != xrecovery ] ; then +- save_default_entry | grub_add_tab +- fi +- +- # Use ELILO's generic "efifb" when it's known to be available. +- # FIXME: We need an interface to select vesafb in case efifb can't be used. +- if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then +- echo " load_video" | sed "s/^/$submenu_indentation/" +- if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \ +- && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then +- echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/" +- fi +- else +- if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then +- echo " load_video" | sed "s/^/$submenu_indentation/" +- fi +- echo " set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/" +- fi +- +- echo " insmod gzio" | sed "s/^/$submenu_indentation/" +- +- if [ x$dirname = x/ ]; then +- if [ -z "${prepare_root_cache}" ]; then +- prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)" +- fi +- printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/" +- else +- if [ -z "${prepare_boot_cache}" ]; then +- prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)" +- fi +- printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" +- fi +- sed "s/^/$submenu_indentation/" << EOF +- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} +-EOF +- if test -n "${initrd}" ; then +- initrd_path= +- for i in ${initrd}; do +- initrd_path="${initrd_path} ${rel_dirname}/${i}" +- done +- sed "s/^/$submenu_indentation/" << EOF +- initrd $(echo $initrd_path) +-EOF +- fi +- if test -n "${fdt}" ; then +- sed "s/^/$submenu_indentation/" << EOF +- devicetree ${rel_dirname}/${fdt} +-EOF +- fi +- sed "s/^/$submenu_indentation/" << EOF +-} +-EOF +-} +- +-machine=`uname -m` +-case "x$machine" in +- xi?86 | xx86_64) +- list= +- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do +- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi +- done ;; +- *) +- list= +- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do +- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi +- done ;; +-esac +- +-if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then +- for i in /boot/ostree/*/vmlinuz-* ; do +- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi +- done +-fi +- +-case "$machine" in +- i?86) GENKERNEL_ARCH="x86" ;; +- mips|mips64) GENKERNEL_ARCH="mips" ;; +- mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;; +- arm*) GENKERNEL_ARCH="arm" ;; +- *) GENKERNEL_ARCH="$machine" ;; +-esac +- +-prepare_boot_cache= +-prepare_root_cache= +-boot_device_id= +-title_correction_code= +- +-# Extra indentation to add to menu entries in a submenu. We're not in a submenu +-# yet, so it's empty. In a submenu it will be equal to '\t' (one tab). +-submenu_indentation="" +- +-is_top_level=true +-while [ "x$list" != "x" ] ; do +- linux=`version_find_latest $list` +- if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then +- gettext_printf "Found linux image: %s\n" "$linux" >&2 +- fi +- +- basename=`basename $linux` +- dirname=`dirname $linux` +- rel_dirname=`make_system_path_relative_to_its_root $dirname` +- version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` +- alt_version=`echo $version | sed -e "s,\.old$,,g"` +- linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" +- +- initrd_early= +- for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \ +- ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do +- if test -e "${dirname}/${i}" ; then +- initrd_early="${initrd_early} ${i}" +- fi +- done +- +- initrd_real= +- for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ +- "initrd-${version}" "initramfs-${version}.img" \ +- "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ +- "initrd-${alt_version}" "initramfs-${alt_version}.img" \ +- "initramfs-genkernel-${version}" \ +- "initramfs-genkernel-${alt_version}" \ +- "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ +- "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do +- if test -e "${dirname}/${i}" ; then +- initrd_real="${i}" +- break +- fi +- done +- +- initrd= +- if test -n "${initrd_early}" || test -n "${initrd_real}"; then +- initrd="${initrd_early} ${initrd_real}" +- +- initrd_display= +- for i in ${initrd}; do +- initrd_display="${initrd_display} ${dirname}/${i}" +- done +- if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then +- gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 +- fi +- fi +- +- fdt= +- for i in "dtb-${version}" "dtb-${alt_version}"; do +- if test -f "${dirname}/${i}/${GRUB_DEFAULT_DTB}" ; then +- fdt="${i}/${GRUB_DEFAULT_DTB}" +- break +- fi +- done +- +- config= +- for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do +- if test -e "${i}" ; then +- config="${i}" +- break +- fi +- done +- +- initramfs= +- if test -n "${config}" ; then +- initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` +- fi +- +- if test -z "${initramfs}" && test -z "${initrd_real}" ; then +- # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's +- # no initrd or builtin initramfs, it can't work here. +- if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \ +- || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then +- +- linux_root_device_thisversion=${GRUB_DEVICE} +- else +- linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID} +- fi +- fi +- +- if [ "x${GRUB_DISABLE_SUBMENU}" = "xyes" ] || [ "x${GRUB_DISABLE_SUBMENU}" = "xy" ]; then +- GRUB_DISABLE_SUBMENU="true" +- fi +- +- if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then +- linux_entry "${OS}" "${version}" simple standard \ +- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" +- if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then +- linux_entry "${OS}" "${version}" simple debug \ +- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_LINUX_DEBUG}" +- fi +- +- submenu_indentation="$grub_tab" +- +- if [ -z "$boot_device_id" ]; then +- boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" +- fi +- # TRANSLATORS: %s is replaced with an OS name +- echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" +- is_top_level=false +- fi +- +- linux_entry "${OS}" "${version}" advanced standard \ +- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" +- if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then +- linux_entry "${OS}" "${version}" advanced debug \ +- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_LINUX_DEBUG}" +- fi +- +- if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then +- linux_entry "${OS}" "${version}" recovery standard \ +- "single ${GRUB_CMDLINE_LINUX}" +- fi +- +- list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` +-done +- +-# If at least one kernel was found, then we need to +-# add a closing '}' for the submenu command. +-if [ x"$is_top_level" != xtrue ]; then +- echo '}' +-fi +- +-echo "$title_correction_code" diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index 339b3c77..f943da1e 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -13,10 +13,25 @@ if [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then fi ARCH=$(uname -m) -# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to -# be run to generate a GRUB config file that contains menuentry commands. -if [[ $ARCH = "ppc64le" ]]; then - RUN_MKCONFIG=true +# Older ppc64le OPAL firmware (petitboot version < 1.8.0) don't have BLS support +# so grub2-mkconfig has to be run to generate a config with menuentry commands. +if [[ $ARCH = "ppc64le" ]] && [ -d /sys/firmware/opal ]; then + + petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" + + if test -e ${petitboot_path}; then + read -a petitboot_version < ${petitboot_path} + petitboot_version="$(echo ${petitboot_version//v})" + major_version="$(echo ${petitboot_version} | cut -d . -f1)" + minor_version="$(echo ${petitboot_version} | cut -d . -f2)" + + if test -z ${petitboot_version} || test ${major_version} -lt 1 || \ + test ${major_version} -eq 1 -a ${minor_version} -lt 8; then + RUN_MKCONFIG=true + fi + else + RUN_MKCONFIG=true + fi fi if [[ $DISABLE_BLS = "true" ]]; then diff --git a/grub.patches b/grub.patches index 1704303d..5a75330a 100644 --- a/grub.patches +++ b/grub.patches @@ -203,3 +203,5 @@ Patch0202: 0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch Patch0203: 0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch Patch0204: 0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch Patch0205: 0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch +Patch0206: 0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch +Patch0207: 0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch diff --git a/grub2.spec b/grub2.spec index 0b74f16b..70d10cc5 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -387,11 +387,6 @@ rm -r /boot/grub2.tmp/ || : %files tools %attr(0644,root,root) %ghost %config(noreplace) %{_sysconfdir}/default/grub %config %{_sysconfdir}/grub.d/??_* -%ifarch ppc64 ppc64le -%exclude %{_sysconfdir}/grub.d/10_linux -%else -%exclude %{_sysconfdir}/grub.d/10_linux_bls -%endif %{_sysconfdir}/grub.d/README %{_userunitdir}/grub-boot-success.timer %{_userunitdir}/grub-boot-success.service @@ -509,6 +504,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Apr 02 2020 Javier Martinez Canillas - 2.04-12 +- Merge 10_linux_bls logic into 10_linux and avoid issues if blsdir is set + * Thu Mar 26 2020 Javier Martinez Canillas - 2.04-11 - grub-switch-to-blscfg: Update grub2 binary in ESP for OSTree systems Related: rhbz#1751272 From 5b188159a7aa20e5cdee6c69c3eacebe070932cd Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 16 Apr 2020 21:32:06 +0200 Subject: [PATCH 020/294] Make the grub-switch-to-blscfg and 10_linux scripts more robust Signed-off-by: Javier Martinez Canillas --- ...lscfg-Use-install-to-copy-GRUB-binar.patch | 46 +++++++++++++++++++ ...le-BLS-configuration-if-new-kernel-p.patch | 39 ++++++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch create mode 100644 0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch diff --git a/0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch b/0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch new file mode 100644 index 00000000..c131a7f6 --- /dev/null +++ b/0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 16 Apr 2020 18:53:03 +0200 +Subject: [PATCH] grub-switch-to-blscfg: Use install to copy GRUB binary, + modules and config + +By default the cp command truncates the destination before copying from the +source, so if interrupted it can lead to a file that's half written. + +This behavior can be modified using the --remove-destination option, but is +usually a better choice to use the install tool for this. So let's do that. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-switch-to-blscfg.in | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in +index 4bbed8e4fe9..3333a620c28 100644 +--- a/util/grub-switch-to-blscfg.in ++++ b/util/grub-switch-to-blscfg.in +@@ -273,7 +273,7 @@ copy_bls() { + if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \ + ! ${grub_editenv} - list | grep -q blsdir; then + grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" +- cp ${grub_binary} ${grubdir} || exit 1 ++ install -m 700 ${grub_binary} ${grubdir} || exit 1 + # Create a hidden file to indicate that grub2 now has BLS support. + touch /boot/grub2/.grub2-blscfg-supported + fi +@@ -307,13 +307,13 @@ if [ "${GENERATE}" -eq 1 ] ; then + + if [ -n "${mod_dir}" ]; then + for mod in blscfg increment; do +- cp ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1 ++ install -m 700 ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1 + done + fi + + cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}" + if ! grub2-mkconfig -o "${GRUB_CONFIG_FILE}" ; then +- cp -af "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}" ++ install -m 700 "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}" + sed -i"${backupsuffix}" \ + -e 's,^GRUB_ENABLE_BLSCFG=.*,GRUB_ENABLE_BLSCFG=false,' \ + "${etcdefaultgrub}" diff --git a/0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch b/0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch new file mode 100644 index 00000000..99c26dda --- /dev/null +++ b/0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 16 Apr 2020 18:53:05 +0200 +Subject: [PATCH] 10_linux.in: Enable BLS configuration if new-kernel-pkg isn't + present + +Currently if the the GRUB_ENABLE_BLSCFG option in /etc/default/grub hasn't +been set, the 10_linux script will generate a GRUB configuration that does +not include the blscfg command to populate the menu entries from BLS files. + +But on kernel install the /usr/lib/kernel/install.d/20-grub.install script +will only add menuentry commands to the GRUB config file if the old grubby +tool and new-kernel-pkg script are installed. + +So a configuration with the GRUB_ENABLE_BLSCFG option will lead to a setup +where new kernel entries are not added. Make a BLS config the default if +that option wasn't set and the new-kernel-pkg script is not present. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index c72cc3246bb..847646bd8a8 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -164,6 +164,11 @@ populate_menu() + printf "$menu" + } + ++# Make BLS the default if GRUB_ENABLE_BLSCFG was not set and grubby is not installed. ++if [ -z "${GRUB_ENABLE_BLSCFG}" ] && [ -z "$(which new-kernel-pkg 2> /dev/null)" ]; then ++ GRUB_ENABLE_BLSCFG="true" ++fi ++ + if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + if [ x$dirname = x/ ]; then + if [ -z "${prepare_root_cache}" ]; then diff --git a/grub.patches b/grub.patches index 5a75330a..e78e4d7f 100644 --- a/grub.patches +++ b/grub.patches @@ -205,3 +205,5 @@ Patch0204: 0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch Patch0205: 0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch Patch0206: 0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch Patch0207: 0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch +Patch0208: 0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch +Patch0209: 0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch diff --git a/grub2.spec b/grub2.spec index 70d10cc5..016165c1 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Apr 16 2020 Javier Martinez Canillas - 2.04-13 +- Make the grub-switch-to-blscfg and 10_linux scripts more robust + * Thu Apr 02 2020 Javier Martinez Canillas - 2.04-12 - Merge 10_linux_bls logic into 10_linux and avoid issues if blsdir is set From b28e5aa886c9466154ee73a619c7bac02fc4f351 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 23 Apr 2020 13:02:18 +0200 Subject: [PATCH 021/294] efi: Set image base address before jumping to the PE/COFF entry point Resolves: rhbz#1825411 Signed-off-by: Javier Martinez Canillas --- ...se-address-before-jumping-to-the-PE-.patch | 60 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch new file mode 100644 index 00000000..36915877 --- /dev/null +++ b/0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 23 Apr 2020 15:06:46 +0200 +Subject: [PATCH] efi: Set image base address before jumping to the PE/COFF + entry point + +Upstream GRUB uses the EFI LoadImage() and StartImage() to boot the Linux +kernel. But our custom EFI loader that supports Secure Boot instead uses +the EFI handover protocol (for x86) or jumping directly to the PE/COFF +entry point (for aarch64). + +This is done to allow the bootloader to verify the images using the shim +lock protocol to avoid booting untrusted binaries. + +Since the bootloader loads the kernel from the boot media instead of using +LoadImage(), it is responsible to set the Loaded Image base address before +booting the kernel. + +Otherwise the kernel EFI stub will complain that it was not set correctly +and print the following warning message: + +EFI stub: ERROR: FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value + +Resolves: rhbz#1825411 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/loader/efi/linux.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index b56ea0bc041..e09f824862b 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -72,6 +72,7 @@ grub_err_t + grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, + void *kernel_params) + { ++ grub_efi_loaded_image_t *loaded_image = NULL; + handover_func hf; + int offset = 0; + +@@ -79,6 +80,17 @@ grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, + offset = 512; + #endif + ++ /* ++ * Since the EFI loader is not calling the LoadImage() and StartImage() ++ * services for loading the kernel and booting respectively, it has to ++ * set the Loaded Image base address. ++ */ ++ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); ++ if (loaded_image) ++ loaded_image->image_base = kernel_addr; ++ else ++ grub_dprintf ("linux", "Loaded Image base address could not be set\n"); ++ + grub_dprintf ("linux", "kernel_addr: %p handover_offset: %p params: %p\n", + kernel_addr, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); + hf = (handover_func)((char *)kernel_addr + handover_offset + offset); diff --git a/grub.patches b/grub.patches index e78e4d7f..e325f5ca 100644 --- a/grub.patches +++ b/grub.patches @@ -207,3 +207,4 @@ Patch0206: 0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch Patch0207: 0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch Patch0208: 0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch Patch0209: 0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch +Patch0210: 0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/grub2.spec b/grub2.spec index 016165c1..13e54f4c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Apr 23 2020 Javier Martinez Canillas - 2.04-14 +- efi: Set image base address before jumping to the PE/COFF entry point + Resolves: rhbz#1825411 + * Thu Apr 16 2020 Javier Martinez Canillas - 2.04-13 - Make the grub-switch-to-blscfg and 10_linux scripts more robust From b914a7e168d18ba9e0131830ec26f161078d334e Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 30 Apr 2020 15:49:50 +0200 Subject: [PATCH 022/294] Fix bugs in the blscfg module and in the 10_linux script for ppc64le blscfg: Lookup default_kernelopts variable as fallback for options Related: rhbz#1765297 10_linux.in: fix early exit due error when reading petitboot version Resolves: rhbz#1827397 Signed-off-by: Javier Martinez Canillas --- ...fault_kernelopts-variable-as-fallbac.patch | 40 +++++++++++++++++++ ...early-exit-due-error-when-reading-pe.patch | 33 +++++++++++++++ 99-grub-mkconfig.install | 2 +- grub.patches | 2 + grub2.spec | 8 +++- 5 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch create mode 100644 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch diff --git a/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch b/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch new file mode 100644 index 00000000..483efc4c --- /dev/null +++ b/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 29 Apr 2020 20:08:27 +0200 +Subject: [PATCH] blscfg: Lookup default_kernelopts variable as fallback for + options + +The 10_linux script sets a variable that contains the kernel command line +parameters. This is done so the entries will still have a kernel cmdline +defined even if the grubenv can't be read. + +But older versions of the script used to set a default_kernelopts variable +while newer versions just sets the kernelopts, which is what's defined in +the BLS snippets. + +The blscfg module needs to keep looking for the default_kernelops since it +may be that a user doesn't have a grubenv file and has an older grub.cfg +that sets this variable instead of kernelopts. + +Related: rhbz#1765297 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 9263a5c1a02..4ec6504d9a4 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -759,6 +759,10 @@ static void create_entry (struct bls_entry *entry) + + title = bls_get_val (entry, "title", NULL); + options = expand_val (bls_get_val (entry, "options", NULL)); ++ ++ if (!options) ++ options = expand_val (grub_env_get("default_kernelopts")); ++ + initrds = bls_make_list (entry, "initrd", NULL); + + devicetree = expand_val (bls_get_val (entry, "devicetree", NULL)); diff --git a/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch b/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch new file mode 100644 index 00000000..75eb75ad --- /dev/null +++ b/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 30 Apr 2020 15:45:31 +0200 +Subject: [PATCH] 10_linux.in: fix early exit due error when reading petitboot + version + +The script uses bash's read built-in command to get the petitboot version +version, but this command has a non-zero exit status if the EOF is found. + +Since the /sys/firmware/devicetree/base/ibm,firmware-versions/petitboot +string ends with a NUL character, use the empty string as read delimiter +to prevent the command to read to the end-of-file and exit with an error. + +Resolves: rhbz#1827397 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 847646bd8a8..09adfce80fd 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -194,7 +194,7 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" + + if test -e ${petitboot_path}; then +- read -a petitboot_version < ${petitboot_path} ++ read -r -d '' petitboot_version < ${petitboot_path} + petitboot_version="$(echo ${petitboot_version//v})" + major_version="$(echo ${petitboot_version} | cut -d . -f1)" + minor_version="$(echo ${petitboot_version} | cut -d . -f2)" diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index f943da1e..d9686b51 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -20,7 +20,7 @@ if [[ $ARCH = "ppc64le" ]] && [ -d /sys/firmware/opal ]; then petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" if test -e ${petitboot_path}; then - read -a petitboot_version < ${petitboot_path} + read -r -d '' petitboot_version < ${petitboot_path} petitboot_version="$(echo ${petitboot_version//v})" major_version="$(echo ${petitboot_version} | cut -d . -f1)" minor_version="$(echo ${petitboot_version} | cut -d . -f2)" diff --git a/grub.patches b/grub.patches index e325f5ca..2b922ddb 100644 --- a/grub.patches +++ b/grub.patches @@ -208,3 +208,5 @@ Patch0207: 0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch Patch0208: 0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch Patch0209: 0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch Patch0210: 0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0211: 0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch +Patch0212: 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch diff --git a/grub2.spec b/grub2.spec index 13e54f4c..fe9f2f4b 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,12 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Apr 30 2020 Javier Martinez Canillas - 2.04-15 +- blscfg: Lookup default_kernelopts variable as fallback for options + Related: rhbz#1765297 +- 10_linux.in: fix early exit due error when reading petitboot version + Resolves: rhbz#1827397 + * Thu Apr 23 2020 Javier Martinez Canillas - 2.04-14 - efi: Set image base address before jumping to the PE/COFF entry point Resolves: rhbz#1825411 From 107dc9a693991e6bdd7ee9244d813d01483f9a9c Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 12 May 2020 20:16:59 +0200 Subject: [PATCH 023/294] Fix a segfault in grub2-editenv when attempting to shrink a variable Signed-off-by: Javier Martinez Canillas --- ...r-overrun-when-attempting-to-shrink-.patch | 60 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch diff --git a/0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch b/0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch new file mode 100644 index 00000000..09d378f2 --- /dev/null +++ b/0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 12 May 2020 01:00:51 +0200 +Subject: [PATCH] envblk: Fix buffer overrun when attempting to shrink a + variable value +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If an existing variable is set with a value whose length is smaller than +the current value, a memory corruption can happen due copying padding '#' +characters outside of the environment block buffer. + +This is caused by a wrong calculation of the previous free space position +after moving backward the characters that followed the old variable value. + +That position is calculated to fill the remaining of the buffer with the +padding '#' characters. But since isn't calculated correctly, it can lead +to copies outside of the buffer. + +The issue can be reproduced by creating a variable with a large value and +then try to set a new value that is much smaller: + +$ grub2-editenv --version +grub2-editenv (GRUB) 2.04 + +$ grub2-editenv env create + +$ grub2-editenv env set a="$(for i in {1..500}; do var="b$var"; done; echo $var)" + +$ wc -c env +1024 grubenv + +$ grub2-editenv env set a="$(for i in {1..50}; do var="b$var"; done; echo $var)" +malloc(): corrupted top size +Aborted (core dumped) + +$ wc -c env +0 grubenv + +Reported-by: Renaud Métrich +Signed-off-by: Javier Martinez Canillas +Patch-cc: Daniel Kiper +--- + grub-core/lib/envblk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/lib/envblk.c b/grub-core/lib/envblk.c +index f89d86d4e8d..874506da169 100644 +--- a/grub-core/lib/envblk.c ++++ b/grub-core/lib/envblk.c +@@ -143,7 +143,7 @@ grub_envblk_set (grub_envblk_t envblk, const char *name, const char *value) + /* Move the following characters backward, and fill the new + space with harmless characters. */ + grub_memmove (p + vl, p + len, pend - (p + len)); +- grub_memset (space + len - vl, '#', len - vl); ++ grub_memset (space - (len - vl), '#', len - vl); + } + else + /* Move the following characters forward. */ diff --git a/grub.patches b/grub.patches index 2b922ddb..ba6c8ec7 100644 --- a/grub.patches +++ b/grub.patches @@ -210,3 +210,4 @@ Patch0209: 0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch Patch0210: 0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch Patch0211: 0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch Patch0212: 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch +Patch0213: 0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch diff --git a/grub2.spec b/grub2.spec index fe9f2f4b..201cbbae 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 15%{?dist} +Release: 16%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Tue May 12 2020 Javier Martinez Canillas - 2.04-16 +- Fix a segfault in grub2-editenv when attempting to shrink a variable + * Thu Apr 30 2020 Javier Martinez Canillas - 2.04-15 - blscfg: Lookup default_kernelopts variable as fallback for options Related: rhbz#1765297 From 4a742183a39f344a7685bccdc76d5e64dea3766a Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 6 May 2020 19:13:01 +0200 Subject: [PATCH 024/294] Store cmdline in BLS snippets instead of using a grubenv variable The kernel cmdline was stored as a kernelopts variable in the grubenv file and the BLS snippets used that. But this turned out to be fragile since the grubenv file could be removed or get corrupted easily. To prevent the entries to not have a cmdline if the grubenv can't be read, a fallback variable was set in the GRUB config file. But this still caused issues since the config needs to be re-generated to change the parameters. Instead, let's store the cmdline in the BLS snippets. This will make the configuration more robust, since it will work even without the grubenv file and the BLS entries will contain all the information needed to boot. Signed-off-by: Javier Martinez Canillas --- ...e-cmdline-in-BLS-snippets-instead-of.patch | 160 ++++++++++++++++++ 20-grub.install | 38 +++-- grub.patches | 1 + grub2.spec | 5 +- 4 files changed, 188 insertions(+), 16 deletions(-) create mode 100644 0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch diff --git a/0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch b/0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch new file mode 100644 index 00000000..2b9b4436 --- /dev/null +++ b/0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch @@ -0,0 +1,160 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 13 May 2020 19:40:10 +0200 +Subject: [PATCH] 10_linux.in: Store cmdline in BLS snippets instead of using a + variable + +The kernel cmdline was stored as a kernelopts variable in the grubenv file +and the BLS snippets used that. But this turned out to be fragile since the +grubenv file could be removed or get corrupted easily. + +To prevent the entries to not have a cmdline if the grubenv can't be read, +a fallback variable was set in the GRUB config file. But this still caused +issues since the config needs to be re-generated to change the parameters. + +Instead, let's store the cmdline in the BLS snippets. This will make the +configuration more robust, since it will work even without the grubenv +file and the BLS entries will contain all the information needed to boot. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-switch-to-blscfg.in | 30 ++++++++++-------------------- + util/grub.d/10_linux.in | 41 +++++++++++++++++++++++++++++++---------- + 2 files changed, 41 insertions(+), 30 deletions(-) + +diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in +index 3333a620c28..cb229126128 100644 +--- a/util/grub-switch-to-blscfg.in ++++ b/util/grub-switch-to-blscfg.in +@@ -190,7 +190,7 @@ fi + mkbls() { + local kernelver=$1 && shift + local datetime=$1 && shift +- local bootprefix=$1 && shift ++ local kernelopts=$1 && shift + + local debugname="" + local debugid="" +@@ -209,10 +209,9 @@ mkbls() { + cat <"${bls_target}" +- fi ++ mkbls "${kernelver}" \ ++ "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" \ ++ "${bootprefix}" "${cmdline}" >"${bls_target}" + + if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then + bls_debug="$(echo ${bls_target} | sed -e "s/${kernelver}/${kernelver}~debug/")" + cp -aT "${bls_target}" "${bls_debug}" + title="$(grep '^title[ \t]' "${bls_debug}" | sed -e 's/^title[ \t]*//')" +- blsid="$(grep '^id[ \t]' "${bls_debug}" | sed -e "s/\.${ARCH}/-debug.${arch}/")" ++ options="$(echo "${cmdline} ${GRUB_CMDLINE_LINUX_DEBUG}" | sed -e 's/\//\\\//g')" + sed -i -e "s/^title.*/title ${title}${GRUB_LINUX_DEBUG_TITLE_POSTFIX}/" "${bls_debug}" +- sed -i -e "s/^id.*/${blsid}/" "${bls_debug}" +- sed -i -e "s/^options.*/options \$kernelopts ${GRUB_CMDLINE_LINUX_DEBUG}/" "${bls_debug}" ++ sed -i -e "s/^options.*/options ${options}/" "${bls_debug}" + fi + done + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 09adfce80fd..80299ecaf00 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -134,23 +134,43 @@ read_config() + done < ${config_file} + } + +-populate_menu() ++blsdir="/boot/loader/entries" ++ ++get_sorted_bls() + { +- blsdir="/boot/loader/entries" +- local -a files + local IFS=$'\n' +- gettext_printf "Generating boot entries from BLS files...\n" >&2 + +- files=($(for bls in ${blsdir}/*.conf ; do +- if ! [[ -e "${bls}" ]] ; then +- continue +- fi ++ files=($(for bls in ${blsdir}/*.conf; do + bls="${bls%.conf}" + bls="${bls##*/}" + echo "${bls}" + done | ${kernel_sort} | tac)) || : + +- for bls in "${files[@]}" ; do ++ echo "${files[@]}" ++} ++ ++update_bls_cmdline() ++{ ++ local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++ local -a files=($(get_sorted_bls)) ++ ++ for bls in "${files[@]}"; do ++ local options="${cmdline}" ++ if [ -z "${bls##*debug*}" ]; then ++ options="${options} ${GRUB_CMDLINE_LINUX_DEBUG}" ++ fi ++ options="$(echo "${options}" | sed -e 's/\//\\\//g')" ++ sed -i -e "s/^options.*/options ${options}/" "${blsdir}/${bls}.conf" ++ done ++} ++ ++populate_menu() ++{ ++ local -a files=($(get_sorted_bls)) ++ ++ gettext_printf "Generating boot entries from BLS files...\n" >&2 ++ ++ for bls in "${files[@]}"; do + read_config "${blsdir}/${bls}.conf" + + menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" +@@ -224,6 +244,8 @@ if [ -z "\${kernelopts}" ]; then + fi + EOF + ++ update_bls_cmdline ++ + if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then + populate_menu + else +@@ -244,7 +266,6 @@ EOF + fi + fi + +- ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then + ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" + fi diff --git a/20-grub.install b/20-grub.install index ff36b1b3..8ae38853 100755 --- a/20-grub.install +++ b/20-grub.install @@ -24,6 +24,7 @@ BLS_DIR="/boot/loader/entries" mkbls() { local kernelver=$1 && shift local datetime=$1 && shift + local kernelopts=$1 && shift local debugname="" local debugid="" @@ -42,7 +43,7 @@ title ${NAME} (${kernelver}) ${VERSION}${debugname} version ${kernelver}${debugid} linux /vmlinuz-${kernelver} initrd /initramfs-${kernelver}.img -options \$kernelopts +options ${kernelopts} grub_users \$grub_users grub_arg --unrestricted grub_class kernel${flavor} @@ -77,19 +78,29 @@ case "$COMMAND" in fi if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then + if [[ -f /etc/kernel/cmdline ]]; then + read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline + elif [[ -f /usr/lib/kernel/cmdline ]]; then + read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline + else + declare -a BOOT_OPTIONS + + read -r -d '' -a line < /proc/cmdline + for i in "${line[@]}"; do + [[ "${i#initrd=*}" != "$i" ]] && continue + [[ "${i#BOOT_IMAGE=*}" != "$i" ]] && continue + BOOT_OPTIONS+=("$i") + done + fi + eval "$(grub2-get-kernel-settings)" || true [[ -d "$BLS_DIR" ]] || mkdir -m 0700 -p "$BLS_DIR" BLS_ID="${MACHINE_ID}-${KERNEL_VERSION}" BLS_TARGET="${BLS_DIR}/${BLS_ID}.conf" - if [[ -f "${KERNEL_DIR}/bls.conf" ]]; then - cp -aT "${KERNEL_DIR}/bls.conf" "${BLS_TARGET}" || exit $? - else - mkbls "${KERNEL_VERSION}" \ - "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${KERNEL_DIR}")")" \ - >"${BLS_TARGET}" - fi - command -v restorecon &>/dev/null && \ - restorecon -R "${BLS_TARGET}" + mkbls "${KERNEL_VERSION}" \ + "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${KERNEL_DIR}")")" \ + "${BOOT_OPTIONS[*]}" >"${BLS_TARGET}" + command -v restorecon &>/dev/null && restorecon -R "${BLS_TARGET}" LINUX="$(grep '^linux[ \t]' "${BLS_TARGET}" | sed -e 's,^linux[ \t]*,,')" INITRD="$(grep '^initrd[ \t]' "${BLS_TARGET}" | sed -e 's,^initrd[ \t]*,,')" @@ -111,14 +122,12 @@ case "$COMMAND" in fi if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then - ARCH="$(uname -m)" - BLS_DEBUG_ID="$(echo ${BLS_ID} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" cp -aT "${BLS_TARGET}" "${BLS_DEBUG}" TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')" + OPTIONS="$(echo "${BOOT_OPTIONS[*]} ${GRUB_CMDLINE_LINUX_DEBUG}" | sed -e 's/\//\\\//g')" sed -i -e "s/^title.*/title ${TITLE}${GRUB_LINUX_DEBUG_TITLE_POSTFIX}/" "${BLS_DEBUG}" - sed -i -e "s/^id.*/id ${BLS_DEBUG_ID}/" "${BLS_DEBUG}" - sed -i -e "s/^options.*/options \$kernelopts ${GRUB_CMDLINE_LINUX_DEBUG}/" "${BLS_DEBUG}" + sed -i -e "s/^options.*/options ${OPTIONS}/" "${BLS_DEBUG}" if [ -n "$NEWDEFAULT" -a "x$GRUB_DEFAULT_TO_DEBUG" = "xtrue" ]; then NEWDEFAULT="${BLS_DEBUG_ID}" fi @@ -145,7 +154,6 @@ case "$COMMAND" in remove) if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then - ARCH="$(uname -m)" BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" rm -f "${BLS_TARGET}" "${BLS_DEBUG}" diff --git a/grub.patches b/grub.patches index ba6c8ec7..1ba1e265 100644 --- a/grub.patches +++ b/grub.patches @@ -211,3 +211,4 @@ Patch0210: 0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch Patch0211: 0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch Patch0212: 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch Patch0213: 0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch +Patch0214: 0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch diff --git a/grub2.spec b/grub2.spec index 201cbbae..e7728f97 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 16%{?dist} +Release: 17%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Wed May 13 2020 Javier Martinez Canillas - 2.04-17 +- Store cmdline in BLS snippets instead of using a grubenv variable + * Tue May 12 2020 Javier Martinez Canillas - 2.04-16 - Fix a segfault in grub2-editenv when attempting to shrink a variable From 4ff1f12e40f13aeb869122c434352fdfdf8971a4 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 14 May 2020 18:02:26 -0700 Subject: [PATCH 025/294] 10_linux.in: restore existence check in `get_sorted_bls` --- ...ore-existence-check-in-get_sorted_bl.patch | 36 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch diff --git a/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch b/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch new file mode 100644 index 00000000..10e823b6 --- /dev/null +++ b/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch @@ -0,0 +1,36 @@ +From 0cff1b8b056f408c0dd9f8e5f8071ea9f6193c6e Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Thu, 14 May 2020 17:52:53 -0700 +Subject: [PATCH 215/215] 10_linux.in: restore existence check in + `get_sorted_bls` + +This is necessary to handle `/boot/loader/entries` not existing +at all (or possibly existing but being empty - not sure about +that case). Without this check, this function gets pretty wacky +and winds up returning the contents of the current working +directory, which of course causes whatever called it to break. + +Resolves: rhbz#1836020 + +Signed-off-by: Adam Williamson +--- + util/grub.d/10_linux.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 80299ecaf..519e2d9e6 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -141,6 +141,9 @@ get_sorted_bls() + local IFS=$'\n' + + files=($(for bls in ${blsdir}/*.conf; do ++ if ! [[ -e "${bls}" ]] ; then ++ continue ++ fi + bls="${bls%.conf}" + bls="${bls##*/}" + echo "${bls}" +-- +2.26.2 + diff --git a/grub.patches b/grub.patches index 1ba1e265..717ec73c 100644 --- a/grub.patches +++ b/grub.patches @@ -212,3 +212,4 @@ Patch0211: 0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch Patch0212: 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch Patch0213: 0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch Patch0214: 0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch +Patch0215: 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch diff --git a/grub2.spec b/grub2.spec index e7728f97..34c1f1fc 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 17%{?dist} +Release: 18%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu May 14 2020 Adam Williamson - 2.04-18 +- 10_linux.in: restore existence check in `get_sorted_bls` + Resolves: rhbz#1836020 + * Wed May 13 2020 Javier Martinez Canillas - 2.04-17 - Store cmdline in BLS snippets instead of using a grubenv variable From 4cf8c08cf7ea5396039a02b31f5fb1e283369466 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Sat, 16 May 2020 12:02:46 +0200 Subject: [PATCH 026/294] Enable tpm module and make system to boot even if TPM measurements fail Since GRUB 2.04 there is support for TPM measurements in a tpm module that uses the verifiers framework. So this is used now instead of the previous downstream patches that we were carrying. But we forgot to enable this module when rebasing to 2.04 which leads to GRUB no longer measuring the kernel, initrd and command line parameters. One side effect of using the verifiers framework is that if measurements fail, GRUB won't be able to open the files since the errors from the tpm module are propagated. This means that a firmware with a buggy tpm support will prevent the machine to boot, which was not the case with the previous downstream patches. Don't propagate the measurement errors to prevent this. Resolves: rhbz#1836433 Signed-off-by: Javier Martinez Canillas --- ...ore-existence-check-in-get_sorted_bl.patch | 10 +-- ...ate-TPM-measurement-errors-to-the-ve.patch | 62 +++++++++++++++++++ grub.macros | 2 +- grub.patches | 1 + grub2.spec | 6 +- 5 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch b/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch index 10e823b6..4517745f 100644 --- a/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch +++ b/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch @@ -1,8 +1,7 @@ -From 0cff1b8b056f408c0dd9f8e5f8071ea9f6193c6e Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 14 May 2020 17:52:53 -0700 -Subject: [PATCH 215/215] 10_linux.in: restore existence check in - `get_sorted_bls` +Subject: [PATCH] 10_linux.in: restore existence check in `get_sorted_bls` This is necessary to handle `/boot/loader/entries` not existing at all (or possibly existing but being empty - not sure about @@ -18,7 +17,7 @@ Signed-off-by: Adam Williamson 1 file changed, 3 insertions(+) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 80299ecaf..519e2d9e6 100644 +index 80299ecaf00..519e2d9e616 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -141,6 +141,9 @@ get_sorted_bls() @@ -31,6 +30,3 @@ index 80299ecaf..519e2d9e6 100644 bls="${bls%.conf}" bls="${bls##*/}" echo "${bls}" --- -2.26.2 - diff --git a/0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch new file mode 100644 index 00000000..ca125c64 --- /dev/null +++ b/0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Sat, 16 May 2020 11:33:18 +0200 +Subject: [PATCH] tpm: Don't propagate TPM measurement errors to the verifiers + layer + +Currently if the EFI firmware fails to do a TPM measurement for a file, +the error will be propagated to the verifiers framework and so opening +the file will not succeed. + +This mean that buggy firmwares will prevent the system to boot since the +loader won't be able to open any file. But failing to do TPM measurements +shouldn't be a fatal error and the system should still be able to boot. + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/tpm.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/grub-core/commands/tpm.c b/grub-core/commands/tpm.c +index 1441c494d81..dbaeae46dfa 100644 +--- a/grub-core/commands/tpm.c ++++ b/grub-core/commands/tpm.c +@@ -49,7 +49,8 @@ grub_tpm_verify_init (grub_file_t io, + static grub_err_t + grub_tpm_verify_write (void *context, void *buf, grub_size_t size) + { +- return grub_tpm_measure (buf, size, GRUB_BINARY_PCR, context); ++ grub_tpm_measure (buf, size, GRUB_BINARY_PCR, context); ++ return GRUB_ERR_NONE; + } + + static grub_err_t +@@ -57,7 +58,6 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type) + { + const char *prefix = NULL; + char *description; +- grub_err_t status; + + switch (type) + { +@@ -73,15 +73,15 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type) + } + description = grub_malloc (grub_strlen (str) + grub_strlen (prefix) + 1); + if (!description) +- return grub_errno; ++ return GRUB_ERR_NONE; + grub_memcpy (description, prefix, grub_strlen (prefix)); + grub_memcpy (description + grub_strlen (prefix), str, + grub_strlen (str) + 1); +- status = +- grub_tpm_measure ((unsigned char *) str, grub_strlen (str), +- GRUB_STRING_PCR, description); ++ ++ grub_tpm_measure ((unsigned char *) str, grub_strlen (str), GRUB_STRING_PCR, ++ description); + grub_free (description); +- return status; ++ return GRUB_ERR_NONE; + } + + struct grub_file_verifier grub_tpm_verifier = { diff --git a/grub.macros b/grub.macros index bb560e59..fc6bfffe 100644 --- a/grub.macros +++ b/grub.macros @@ -402,7 +402,7 @@ GRUB_MODULES=" all_video boot blscfg btrfs \\\ password_pbkdf2 pgp png reboot \\\ regexp search search_fs_uuid search_fs_file \\\ search_label serial sleep syslinuxcfg test tftp \\\ - version video xfs zstd " \ + tpm version video xfs zstd " \ GRUB_MODULES+=%{efi_modules} \ %{expand:%%{mkimage %{1} %{2} %{3} %{4}}} \ %{nil} diff --git a/grub.patches b/grub.patches index 717ec73c..a833b9e5 100644 --- a/grub.patches +++ b/grub.patches @@ -213,3 +213,4 @@ Patch0212: 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch Patch0213: 0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch Patch0214: 0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch Patch0215: 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch +Patch0216: 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/grub2.spec b/grub2.spec index 34c1f1fc..591b7d52 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 18%{?dist} +Release: 19%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Sat May 16 2020 Javier Martinez Canillas - 2.04-19 +- Enable tpm module and make system to boot even if TPM measurements fail + Resolves: rhbz#1836433 + * Thu May 14 2020 Adam Williamson - 2.04-18 - 10_linux.in: restore existence check in `get_sorted_bls` Resolves: rhbz#1836020 From 68246dd73613dd450dd766acf2c3746acc8add0a Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 18 May 2020 10:39:14 +0200 Subject: [PATCH 027/294] Only enable the tpm module for EFI platforms The module is only built for EFI, so don't enable it for other platforms. Signed-off-by: Javier Martinez Canillas --- ...-Enable-module-for-all-EFI-platforms.patch | 26 +++++++++++++++++++ grub.macros | 4 +-- grub.patches | 1 + grub2.spec | 5 +++- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 0217-tpm-Enable-module-for-all-EFI-platforms.patch diff --git a/0217-tpm-Enable-module-for-all-EFI-platforms.patch b/0217-tpm-Enable-module-for-all-EFI-platforms.patch new file mode 100644 index 00000000..f1197850 --- /dev/null +++ b/0217-tpm-Enable-module-for-all-EFI-platforms.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 18 May 2020 12:56:27 +0200 +Subject: [PATCH] tpm: Enable module for all EFI platforms + +The tpm module is only enabled for x86_64, but there's nothing specific to +that architecture in the code and could be enabled for all EFI platforms. + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/Makefile.core.def | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 661994686e6..b283c502b9c 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2512,7 +2512,7 @@ module = { + name = tpm; + common = commands/tpm.c; + efi = commands/efi/tpm.c; +- enable = x86_64_efi; ++ enable = efi; + }; + + module = { diff --git a/grub.macros b/grub.macros index fc6bfffe..9c874916 100644 --- a/grub.macros +++ b/grub.macros @@ -115,7 +115,7 @@ %ifarch aarch64 %{arm} riscv64 %global efi_modules " " %else -%global efi_modules " backtrace chain usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug " +%global efi_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug " %endif %ifarch aarch64 %{arm} riscv64 @@ -402,7 +402,7 @@ GRUB_MODULES=" all_video boot blscfg btrfs \\\ password_pbkdf2 pgp png reboot \\\ regexp search search_fs_uuid search_fs_file \\\ search_label serial sleep syslinuxcfg test tftp \\\ - tpm version video xfs zstd " \ + version video xfs zstd " \ GRUB_MODULES+=%{efi_modules} \ %{expand:%%{mkimage %{1} %{2} %{3} %{4}}} \ %{nil} diff --git a/grub.patches b/grub.patches index a833b9e5..4cfe79ad 100644 --- a/grub.patches +++ b/grub.patches @@ -214,3 +214,4 @@ Patch0213: 0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch Patch0214: 0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch Patch0215: 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch Patch0216: 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0217: 0217-tpm-Enable-module-for-all-EFI-platforms.patch diff --git a/grub2.spec b/grub2.spec index 591b7d52..dc80982e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 19%{?dist} +Release: 20%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon May 18 2020 Javier Martinez Canillas - 2.04-20 +- Only enable the tpm module for EFI platforms + * Sat May 16 2020 Javier Martinez Canillas - 2.04-19 - Enable tpm module and make system to boot even if TPM measurements fail Resolves: rhbz#1836433 From 7fb7a6a7a52bb87714d5f9f4486b40fbaa906f39 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 20 May 2020 14:14:47 +0200 Subject: [PATCH 028/294] Don't update BLS files that aren't managed by GRUB scripts Resolves: rhbz#1837783 Signed-off-by: Javier Martinez Canillas --- ...t-update-BLS-files-that-aren-t-manag.patch | 56 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch diff --git a/0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch b/0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch new file mode 100644 index 00000000..945efc2c --- /dev/null +++ b/0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 20 May 2020 12:23:27 +0200 +Subject: [PATCH] 10_linux.in: Don't update BLS files that aren't managed by + GRUB scripts + +The script is updating all BLS files present in the /boot/loader/entries +directory, but it should only update the BLS that belong to the machine. + +Otherwise if a user is sharing the same boot partition between different +operating systems, the grub2-mkconfig tool will wrongly update BLS files +that were created by a different OS. + +There are also cases where the BLS snippets are not managed by the GRUB +scripts at all, for example in OSTree based systems. So it's also wrong +to update the BLS snippets created by OSTree. + +Resolves: rhbz#1837783 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 519e2d9e616..e61b6c94f11 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -138,16 +138,25 @@ blsdir="/boot/loader/entries" + + get_sorted_bls() + { ++ if ! [ -d "${blsdir}" ] || ! [ -e /etc/machine-id ]; then ++ return ++ fi ++ ++ read machine_id < /etc/machine-id ++ if [ -z "${machine_id}" ]; then ++ return ++ fi ++ + local IFS=$'\n' + +- files=($(for bls in ${blsdir}/*.conf; do ++ files=($(for bls in ${blsdir}/${machine_id}-*.conf; do + if ! [[ -e "${bls}" ]] ; then + continue + fi + bls="${bls%.conf}" + bls="${bls##*/}" + echo "${bls}" +- done | ${kernel_sort} | tac)) || : ++ done | ${kernel_sort} 2>/dev/null | tac)) || : + + echo "${files[@]}" + } diff --git a/grub.patches b/grub.patches index 4cfe79ad..58735cdf 100644 --- a/grub.patches +++ b/grub.patches @@ -215,3 +215,4 @@ Patch0214: 0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch Patch0215: 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch Patch0216: 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch Patch0217: 0217-tpm-Enable-module-for-all-EFI-platforms.patch +Patch0218: 0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch diff --git a/grub2.spec b/grub2.spec index dc80982e..172fd588 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 20%{?dist} +Release: 21%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Wed May 20 2020 Javier Martinez Canillas - 2.04-21 +- Don't update BLS files that aren't managed by GRUB scripts + Resolves: rhbz#1837783 + * Mon May 18 2020 Javier Martinez Canillas - 2.04-20 - Only enable the tpm module for EFI platforms From 098a8a9e99d4b32576e7af518e8e195059f985b9 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 26 May 2020 18:04:42 +0200 Subject: [PATCH 029/294] Fix an out of memory error when loading large initrd images Resolves: rhbz#1838633 Signed-off-by: Javier Martinez Canillas --- ...maximum-bounce-buffer-size-to-16-MiB.patch | 40 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch new file mode 100644 index 00000000..fd68d092 --- /dev/null +++ b/0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 26 May 2020 16:59:28 +0200 +Subject: [PATCH] x86-efi: Reduce maximum bounce buffer size to 16 MiB + +The EFI linux loader allocates a bounce buffer to copy the initrd since in +some machines doing DMA on addresses above 4GB is not possible during EFI. + +But the verifiers framework also allocates a buffer to copy the initrd in +its grub_file_open() handler. It does this since the data to verify has to +be passed as a single chunk to modules that use the verifiers framework. + +If the initrd image size is big there may not be enough memory in the heap +to allocate two buffers of that size. This causes an allocation failure in +the verifiers framework and leads to the initrd not being read. + +To prevent these allocation failures, let's reduce the maximum size of the +bounce buffer used in the EFI loader. Since the data read can be copied to +the actual initrd address in multilple chunks. + +Resolves: rhbz#1838633 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/loader/i386/efi/linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 50b7798d6e5..e5b2736b0ce 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -144,7 +144,7 @@ grub_linuxefi_unload (void) + return GRUB_ERR_NONE; + } + +-#define BOUNCE_BUFFER_MAX 0x10000000ull ++#define BOUNCE_BUFFER_MAX 0x1000000ull + + static grub_ssize_t + read(grub_file_t file, grub_uint8_t *bufp, grub_size_t len) diff --git a/grub.patches b/grub.patches index 58735cdf..22276ca6 100644 --- a/grub.patches +++ b/grub.patches @@ -216,3 +216,4 @@ Patch0215: 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch Patch0216: 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch Patch0217: 0217-tpm-Enable-module-for-all-EFI-platforms.patch Patch0218: 0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch +Patch0219: 0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/grub2.spec b/grub2.spec index 172fd588..b3f9a0f6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 21%{?dist} +Release: 22%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Tue May 26 2020 Javier Martinez Canillas - 2.04-22 +- Fix an out of memory error when loading large initrd images + Resolves: rhbz#1838633 + * Wed May 20 2020 Javier Martinez Canillas - 2.04-21 - Don't update BLS files that aren't managed by GRUB scripts Resolves: rhbz#1837783 From 0993459d926369264457bd22fa14d7aeca20713c Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 5 Jun 2020 12:52:02 +0200 Subject: [PATCH 030/294] Install GRUB as \EFI\BOOT\BOOTARM.EFI in armv7hl The Default Boot Behavior for EFI if no BootOrder and Boot#### variables are found is to look for an ESP and start \EFI\BOOT\BOOT{$arch}.efi. This is usually fallback.efi installed by the shim package, but since shim isn't used on armv7, there's no \EFI\BOOT\BOOTARM.EFI installed in the ESP. So install GRUB as \EFI\BOOT\BOOTARM.EFI for armv7 so there is a default EFI binary to be started. Signed-off-by: Javier Martinez Canillas --- grub.macros | 6 ++++++ grub2.spec | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index 9c874916..56d6bbdb 100644 --- a/grub.macros +++ b/grub.macros @@ -496,6 +496,9 @@ ln -sf ..%{efi_esp_dir}/grub.cfg \\\ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg \ install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ +%ifarch %{arm} \ +install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ +%endif \ install -D -m 700 unicode.pf2 \\\ $RPM_BUILD_ROOT%{efi_esp_dir}/fonts/unicode.pf2 \ ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ @@ -590,6 +593,9 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ %defattr(0700,root,root,-) \ %config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \ %attr(0700,root,root)%{efi_esp_dir}/%{2} \ +%ifarch %{arm} \ +%attr(0700,root,root)%{efi_esp_boot}/BOOTARM.EFI \ +%endif \ %dir %attr(0700,root,root)%{efi_esp_dir}/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ diff --git a/grub2.spec b/grub2.spec index b3f9a0f6..418260fd 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 22%{?dist} +Release: 23%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Fri Jun 05 2020 Javier Martinez Canillas - 2.04-23 +- Install GRUB as \EFI\BOOT\BOOTARM.EFI in armv7hl + * Tue May 26 2020 Javier Martinez Canillas - 2.04-22 - Fix an out of memory error when loading large initrd images Resolves: rhbz#1838633 From 9f83bf2258b6011acabfdc54ecf85821aa1fec00 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 8 Jun 2020 10:14:57 +0200 Subject: [PATCH 031/294] Fix build with rpm-4.16 and a HTTP boot issue with relative paths Signed-off-by: Javier Martinez Canillas --- ...fix-when-the-HTTP-path-is-relative-a.patch | 47 +++++++++++++++++++ 0221-fix-build-with-rpm-4.16.patch | 30 ++++++++++++ grub.patches | 2 + grub2.spec | 6 ++- 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch create mode 100644 0221-fix-build-with-rpm-4.16.patch diff --git a/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch new file mode 100644 index 00000000..97d2e06f --- /dev/null +++ b/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 2 Jun 2020 13:25:01 +0200 +Subject: [PATCH] http: Prepend prefix when the HTTP path is relative as done + in efi/http + +There are two different HTTP drivers that can be used when requesting an +HTTP resource: the efi/http that uses the EFI_HTTP_PROTOCOL and the http +that uses GRUB's HTTP and TCP/IP implementation. + +The efi/http driver appends a prefix that is defined in the variable +http_path, but the http driver doesn't. + +So using this driver and attempting to fetch a resource using a relative +path fails. + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/net/http.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index b52b558d631..7f878b56157 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -501,13 +501,20 @@ http_open (struct grub_file *file, const char *filename) + { + grub_err_t err; + struct http_data *data; ++ const char *http_path; + + data = grub_zalloc (sizeof (*data)); + if (!data) + return grub_errno; + file->size = GRUB_FILE_SIZE_UNKNOWN; + +- data->filename = grub_strdup (filename); ++ /* If path is relative, prepend http_path */ ++ http_path = grub_env_get ("http_path"); ++ if (http_path && filename[0] != '/') ++ data->filename = grub_xasprintf ("%s/%s", http_path, filename); ++ else ++ data->filename = grub_strdup (filename); ++ + if (!data->filename) + { + grub_free (data); diff --git a/0221-fix-build-with-rpm-4.16.patch b/0221-fix-build-with-rpm-4.16.patch new file mode 100644 index 00000000..2a2e3897 --- /dev/null +++ b/0221-fix-build-with-rpm-4.16.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thierry Vignaud +Date: Mon, 8 Jun 2020 06:50:21 +0200 +Subject: [PATCH] fix build with rpm-4.16 + +Signed-off-by: Thierry Vignaud +--- + configure.ac | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/configure.ac b/configure.ac +index eff160b6931..5d3316185da 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1887,6 +1887,15 @@ if test x"$rpm_sort_excuse" = x ; then + [Define to 1 if you have the rpm library.]) + fi + ++if test x"$LIBRPM" = x ; then ++ # Check for rpm library. ++ AC_CHECK_LIB([rpmio], [rpmvercmp], [], ++ [rpm_sort_excuse="rpmio missing rpmvercmp"]) ++ LIBRPM="-lrpmio"; ++ AC_DEFINE([HAVE_RPMIO], [1], ++ [Define to 1 if you have the rpm library.]) ++fi ++ + AC_SUBST([LIBRPM]) + + LIBGEOM= diff --git a/grub.patches b/grub.patches index 22276ca6..914eeabb 100644 --- a/grub.patches +++ b/grub.patches @@ -217,3 +217,5 @@ Patch0216: 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch Patch0217: 0217-tpm-Enable-module-for-all-EFI-platforms.patch Patch0218: 0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch Patch0219: 0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0220: 0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0221: 0221-fix-build-with-rpm-4.16.patch diff --git a/grub2.spec b/grub2.spec index 418260fd..ad650781 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 23%{?dist} +Release: 24%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Jun 08 2020 Javier Martinez Canillas - 2.04-24 +- http: Prepend prefix when the HTTP path is relative as done in efi/http +- Fix build with rpm-4.16 (thierry.vignaud) + * Fri Jun 05 2020 Javier Martinez Canillas - 2.04-23 - Install GRUB as \EFI\BOOT\BOOTARM.EFI in armv7hl From 51e876849c88ad6c2eb96fec736845b4954b4417 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 18 Jun 2020 15:13:22 +0200 Subject: [PATCH 032/294] Only mark GRUB as BLS supported in OSTree systems with a boot partition OSTree doesn't support installations that don't have a boot partition. The BLS snippets assume that there will be one, so this has to be checked and only mark GRUB as supporting BLS in OSTree systems have a boot partition. Signed-off-by: Javier Martinez Canillas --- ...s-BLS-supported-in-OSTree-systems-wi.patch | 35 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch diff --git a/0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch b/0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch new file mode 100644 index 00000000..dbb24f21 --- /dev/null +++ b/0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 18 Jun 2020 11:19:00 +0200 +Subject: [PATCH] Only mark GRUB as BLS supported in OSTree systems with a boot + partition + +The script grub2-switch-to-blscfg updates the grub2 EFI binary in OSTree +systems and marks that has BLS support, to indicate that's not necessary +to add menuentry commands since the BLS snippets can be used to populate +the GRUB boot menu. + +But OSTree doesn't support installations that don't have a boot partition, +the BLS snippets assume that there will be one so this has to be checked +and only mark the bootloader as supporting BLS in OSTree installations +that have /boot as a mountpoint. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-switch-to-blscfg.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in +index cb229126128..a851424beb2 100644 +--- a/util/grub-switch-to-blscfg.in ++++ b/util/grub-switch-to-blscfg.in +@@ -261,7 +261,8 @@ copy_bls() { + # but only do this if the blsdir is not set, to make sure that the BLS + # parsing module will search for the BLS snippets in the default path. + if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \ +- ! ${grub_editenv} - list | grep -q blsdir; then ++ ! ${grub_editenv} - list | grep -q blsdir && \ ++ mountpoint -q /boot; then + grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" + install -m 700 ${grub_binary} ${grubdir} || exit 1 + # Create a hidden file to indicate that grub2 now has BLS support. diff --git a/grub.patches b/grub.patches index 914eeabb..43421fc8 100644 --- a/grub.patches +++ b/grub.patches @@ -219,3 +219,4 @@ Patch0218: 0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch Patch0219: 0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch Patch0220: 0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch Patch0221: 0221-fix-build-with-rpm-4.16.patch +Patch0222: 0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch diff --git a/grub2.spec b/grub2.spec index ad650781..8d371981 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 24%{?dist} +Release: 25%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Jun 18 2020 Javier Martinez Canillas - 2.04-25 +- Only mark GRUB as BLS supported in OSTree systems with a boot partition + * Mon Jun 08 2020 Javier Martinez Canillas - 2.04-24 - http: Prepend prefix when the HTTP path is relative as done in efi/http - Fix build with rpm-4.16 (thierry.vignaud) From 95f5dd8a8206c005d5532a985eee61952b49f84f Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Tue, 30 Jun 2020 14:10:27 -0600 Subject: [PATCH 033/294] Disable LTO --- grub2.spec | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 8d371981..4385fb1e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 25%{?dist} +Release: 26%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -182,6 +182,11 @@ git add grub-emu-%{tarversion} git commit -m "After making subdirs" %build +# This package calls binutils components directly and would need to pass +# in flags to enable the LTO plugins +# Disable LTO +%define _lto_cflags %{nil} + %if 0%{with_efi_arch} %{expand:%do_primary_efi_build %%{grubefiarch} %%{grubefiname} %%{grubeficdname} %%{_target_platform} %%{efi_target_cflags} %%{efi_host_cflags}} %endif @@ -504,6 +509,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Tue Jun 30 2020 Jeff Law - 2.04-26 +Disable LTO + * Thu Jun 18 2020 Javier Martinez Canillas - 2.04-25 - Only mark GRUB as BLS supported in OSTree systems with a boot partition From dc2f1a03d9d6a0c503244bd62ae31330326ab227 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Tue, 21 Jul 2020 13:43:44 -0600 Subject: [PATCH 034/294] Move lto disablement to a point where it works for this package --- grub2.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/grub2.spec b/grub2.spec index 4385fb1e..f50174d0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,3 +1,8 @@ +# This package calls binutils components directly and would need to pass +# in flags to enable the LTO plugins +# Disable LTO +%global _lto_cflags %{nil} + %undefine _hardened_build %global tarversion 2.04 @@ -182,11 +187,6 @@ git add grub-emu-%{tarversion} git commit -m "After making subdirs" %build -# This package calls binutils components directly and would need to pass -# in flags to enable the LTO plugins -# Disable LTO -%define _lto_cflags %{nil} - %if 0%{with_efi_arch} %{expand:%do_primary_efi_build %%{grubefiarch} %%{grubefiname} %%{grubeficdname} %%{_target_platform} %%{efi_target_cflags} %%{efi_host_cflags}} %endif From 47cf63735cd44c6a1b9de8797933f730c5e4969e Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 10 Aug 2020 17:47:38 -0400 Subject: [PATCH 035/294] "Minor" bug fixes Resolves: CVE-2020-10713 Resolves: CVE-2020-14308 Resolves: CVE-2020-14309 Resolves: CVE-2020-14310 Resolves: CVE-2020-14311 Resolves: CVE-2020-15705 Resolves: CVE-2020-15706 Resolves: CVE-2020-15707 Signed-off-by: Peter Jones --- ...fix-when-the-HTTP-path-is-relative-a.patch | 16 +- ...t-boot-commands-will-only-return-on-.patch | 40 + ...turn-in-efi-export-env-and-efi-load-.patch | 27 + ...lexer-fatal-errors-actually-be-fatal.patch | 67 + ...e-arithmetic-primitives-that-check-f.patch | 124 ++ ...-we-always-have-an-overflow-checking.patch | 240 +++ 0228-calloc-Use-calloc-at-most-places.patch | 1834 +++++++++++++++++ ...low-checking-primitives-where-we-do-.patch | 1320 ++++++++++++ ...on-t-leak-memory-on-realloc-failures.patch | 66 + ...-not-load-more-than-one-NAME-section.patch | 35 + ...fxmenu-Fix-double-free-in-load_image.patch | 33 + ...ree-in-grub_xnu_devprop_add_property.patch | 53 + ...sure-we-don-t-dereference-past-array.patch | 49 + 0235-term-Fix-overflow-on-user-inputs.patch | 63 + 0236-udf-Fix-memory-leak.patch | 53 + ...emory-leak-if-grub_create_loader_cmd.patch | 32 + 0238-tftp-Do-not-use-priority-queue.patch | 278 +++ ...in-address-for-mbi-allocation-to-0x1.patch | 44 + ...t-grub_relocator_alloc_chunk_addr-in.patch | 147 ++ ...t-grub_relocator_alloc_chunk_align-m.patch | 335 +++ ...used-fields-from-grub_script_functio.patch | 30 + ...se-after-free-when-redefining-a-func.patch | 105 + ...ub_relocator_alloc_chunk_align-top-m.patch | 43 + 0245-hfsplus-fix-two-more-overflows.patch | 54 + ...-potential-data-dependent-alloc-over.patch | 108 + 0247-emu-make-grub_free-NULL-safe.patch | 31 + ...formed-device-path-arithmetic-errors.patch | 248 +++ ...-caused-by-efi-fix-some-malformed-de.patch | 84 + ...x-use-after-free-in-halt-reboot-path.patch | 162 ++ ...p-fix-some-allocation-error-checking.patch | 37 + ...p-fix-some-allocation-error-checking.patch | 39 + ...g.c-fix-some-potential-allocation-ov.patch | 127 ++ ...integer-overflows-in-grub_cmd_initrd.patch | 49 + ...x-use-after-free-in-halt-reboot-path.patch | 57 + ...id-overflow-on-initrd-size-calculati.patch | 25 + ...rnel-validation-without-shim-protoco.patch | 130 ++ ...er-overflows-in-initrd-size-handling.patch | 166 ++ ...ointers-in-grub-core-commands-blscfg.patch | 43 + ...ar-pointers-in-grub-core-net-bootp.c.patch | 37 + ...ointers-in-grub-core-net-efi-ip4_con.patch | 38 + ...ointers-in-grub-core-net-efi-ip6_con.patch | 28 + ...-pointers-in-grub-core-net-efi-net.c.patch | 37 + ...-pointers-in-grub-core-net-efi-pxe.c.patch | 46 + ...char-pointers-in-grub-core-net-url.c.patch | 28 + grub.macros | 9 +- grub.patches | 43 + grub2.spec | 16 +- 47 files changed, 6668 insertions(+), 8 deletions(-) create mode 100644 0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch create mode 100644 0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch create mode 100644 0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch create mode 100644 0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch create mode 100644 0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch create mode 100644 0228-calloc-Use-calloc-at-most-places.patch create mode 100644 0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch create mode 100644 0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch create mode 100644 0231-font-Do-not-load-more-than-one-NAME-section.patch create mode 100644 0232-gfxmenu-Fix-double-free-in-load_image.patch create mode 100644 0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch create mode 100644 0234-lzma-Make-sure-we-don-t-dereference-past-array.patch create mode 100644 0235-term-Fix-overflow-on-user-inputs.patch create mode 100644 0236-udf-Fix-memory-leak.patch create mode 100644 0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch create mode 100644 0238-tftp-Do-not-use-priority-queue.patch create mode 100644 0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch create mode 100644 0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch create mode 100644 0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch create mode 100644 0242-script-Remove-unused-fields-from-grub_script_functio.patch create mode 100644 0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch create mode 100644 0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch create mode 100644 0245-hfsplus-fix-two-more-overflows.patch create mode 100644 0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch create mode 100644 0247-emu-make-grub_free-NULL-safe.patch create mode 100644 0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch create mode 100644 0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch create mode 100644 0250-efi-Fix-use-after-free-in-halt-reboot-path.patch create mode 100644 0251-efi-dhcp-fix-some-allocation-error-checking.patch create mode 100644 0252-efi-http-fix-some-allocation-error-checking.patch create mode 100644 0253-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch create mode 100644 0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch create mode 100644 0255-efi-Fix-use-after-free-in-halt-reboot-path.patch create mode 100644 0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch create mode 100644 0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch create mode 100644 0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch create mode 100644 0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch create mode 100644 0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch create mode 100644 0261-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch create mode 100644 0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch create mode 100644 0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch create mode 100644 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch create mode 100644 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch diff --git a/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch index 97d2e06f..1c5e5990 100644 --- a/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +++ b/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch @@ -16,14 +16,22 @@ path fails. Signed-off-by: Javier Martinez Canillas --- - grub-core/net/http.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) + grub-core/net/http.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index b52b558d631..7f878b56157 100644 +index b52b558d631..598961afbb5 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c -@@ -501,13 +501,20 @@ http_open (struct grub_file *file, const char *filename) +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -501,13 +502,20 @@ http_open (struct grub_file *file, const char *filename) { grub_err_t err; struct http_data *data; diff --git a/0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch new file mode 100644 index 00000000..5dc6377e --- /dev/null +++ b/0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 9 Apr 2019 13:12:40 +0200 +Subject: [PATCH] Don't assume that boot commands will only return on fail + +While it's true that for most loaders the boot command never returns, it +may be the case that it does. For example the GRUB emulator boot command +calls to systemctl kexec which in turn does an asynchonous call to kexec. + +So in this case GRUB will wrongly assume that the boot command fails and +print a "Failed to boot both default and fallback entries" even when the +kexec call later succeeds. + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/normal/menu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +index 9ea1f411814..14ceb9bb060 100644 +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -302,7 +302,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) + { + grub_print_error (); + grub_errno = GRUB_ERR_NONE; +- return; ++ return grub_errno; + } + + errs_before = grub_err_printed_errors; +@@ -315,7 +315,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) + grub_env_context_open (); + menu = grub_zalloc (sizeof (*menu)); + if (! menu) +- return; ++ return grub_errno; + grub_env_set_menu (menu); + if (auto_boot) + grub_env_set ("timeout", "0"); diff --git a/0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch new file mode 100644 index 00000000..02528b51 --- /dev/null +++ b/0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 16 Jan 2019 13:21:46 -0500 +Subject: [PATCH] Fix a missing return in efi-export-env and efi-load-env + commands + +Somewhere along the way this got mis-merged to include a return without +a value. Fix it up. + +Signed-off-by: Peter Jones +--- + grub-core/commands/efi/env.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c +index a69079786aa..4838dac22e7 100644 +--- a/grub-core/commands/efi/env.c ++++ b/grub-core/commands/efi/env.c +@@ -149,6 +149,8 @@ grub_efi_load_env(grub_command_t cmd __attribute__ ((unused)), + + grub_envblk_iterate (envblk, NULL, set_var); + grub_free (envblk_s.buf); ++ ++ return GRUB_ERR_NONE; + } + + static grub_command_t export_cmd, loadenv_cmd; diff --git a/0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch b/0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch new file mode 100644 index 00000000..99b66f0b --- /dev/null +++ b/0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 15 Apr 2020 15:45:02 -0400 +Subject: [PATCH] yylex: Make lexer fatal errors actually be fatal + +When presented with a command that can't be tokenized to anything +smaller than YYLMAX characters, the parser calls YY_FATAL_ERROR(errmsg), +expecting that will stop further processing, as such: + + #define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + if ( yyleng >= YYLMAX ) \ + YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ + yy_flex_strncpy( yytext, yyg->yytext_ptr, yyleng + 1 , yyscanner); \ + yyg->yy_c_buf_p = yy_cp; + +The code flex generates expects that YY_FATAL_ERROR() will either return +for it or do some form of longjmp(), or handle the error in some way at +least, and so the strncpy() call isn't in an "else" clause, and thus if +YY_FATAL_ERROR() is *not* actually fatal, it does the call with the +questionable limit, and predictable results ensue. + +Unfortunately, our implementation of YY_FATAL_ERROR() is: + + #define YY_FATAL_ERROR(msg) \ + do { \ + grub_printf (_("fatal error: %s\n"), _(msg)); \ + } while (0) + +The same pattern exists in yyless(), and similar problems exist in users +of YY_INPUT(), several places in the main parsing loop, +yy_get_next_buffer(), yy_load_buffer_state(), yyensure_buffer_stack, +yy_scan_buffer(), etc. + +All of these callers expect YY_FATAL_ERROR() to actually be fatal, and +the things they do if it returns after calling it are wildly unsafe. + +Fixes: CVE-2020-10713 + +Signed-off-by: Peter Jones +Reviewed-by: Daniel Kiper +Upstream-commit-id: 926df817dc8 +--- + grub-core/script/yylex.l | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/script/yylex.l b/grub-core/script/yylex.l +index 7b44c37b76f..b7203c82309 100644 +--- a/grub-core/script/yylex.l ++++ b/grub-core/script/yylex.l +@@ -37,11 +37,11 @@ + + /* + * As we don't have access to yyscanner, we cannot do much except to +- * print the fatal error. ++ * print the fatal error and exit. + */ + #define YY_FATAL_ERROR(msg) \ + do { \ +- grub_printf (_("fatal error: %s\n"), _(msg)); \ ++ grub_fatal (_("fatal error: %s\n"), _(msg));\ + } while (0) + + #define COPY(str, hint) \ diff --git a/0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch b/0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch new file mode 100644 index 00000000..24786867 --- /dev/null +++ b/0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch @@ -0,0 +1,124 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 15 Jun 2020 10:58:42 -0400 +Subject: [PATCH] safemath: Add some arithmetic primitives that check for + overflow + +This adds a new header, include/grub/safemath.h, that includes easy to +use wrappers for __builtin_{add,sub,mul}_overflow() declared like: + + bool OP(a, b, res) + +where OP is grub_add, grub_sub or grub_mul. OP() returns true in the +case where the operation would overflow and res is not modified. +Otherwise, false is returned and the operation is executed. + +These arithmetic primitives require newer compiler versions. So, bump +these requirements in the INSTALL file too. + +Signed-off-by: Peter Jones +Reviewed-by: Daniel Kiper +Upstream-commit-id: de1c315841a +--- + include/grub/compiler.h | 8 ++++++++ + include/grub/safemath.h | 37 +++++++++++++++++++++++++++++++++++++ + INSTALL | 22 ++-------------------- + 3 files changed, 47 insertions(+), 20 deletions(-) + create mode 100644 include/grub/safemath.h + +diff --git a/include/grub/compiler.h b/include/grub/compiler.h +index 9859ff4cc79..ebafec68957 100644 +--- a/include/grub/compiler.h ++++ b/include/grub/compiler.h +@@ -48,6 +48,14 @@ + # define WARN_UNUSED_RESULT + #endif + ++#if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__) ++# define CLANG_PREREQ(maj,min) \ ++ ((__clang_major__ > (maj)) || \ ++ (__clang_major__ == (maj) && __clang_minor__ >= (min))) ++#else ++# define CLANG_PREREQ(maj,min) 0 ++#endif ++ + #define UNUSED __attribute__((__unused__)) + + #endif /* ! GRUB_COMPILER_HEADER */ +diff --git a/include/grub/safemath.h b/include/grub/safemath.h +new file mode 100644 +index 00000000000..c17b89bba17 +--- /dev/null ++++ b/include/grub/safemath.h +@@ -0,0 +1,37 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ * ++ * Arithmetic operations that protect against overflow. ++ */ ++ ++#ifndef GRUB_SAFEMATH_H ++#define GRUB_SAFEMATH_H 1 ++ ++#include ++ ++/* These appear in gcc 5.1 and clang 3.8. */ ++#if GNUC_PREREQ(5, 1) || CLANG_PREREQ(3, 8) ++ ++#define grub_add(a, b, res) __builtin_add_overflow(a, b, res) ++#define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res) ++#define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res) ++ ++#else ++#error gcc 5.1 or newer or clang 3.8 or newer is required ++#endif ++ ++#endif /* GRUB_SAFEMATH_H */ +diff --git a/INSTALL b/INSTALL +index 8acb4090235..dcb9b7d7b7a 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -11,27 +11,9 @@ GRUB depends on some software packages installed into your system. If + you don't have any of them, please obtain and install them before + configuring the GRUB. + +-* GCC 4.1.3 or later +- Note: older versions may work but support is limited +- +- Experimental support for clang 3.3 or later (results in much bigger binaries) ++* GCC 5.1.0 or later ++ Experimental support for clang 3.8.0 or later (results in much bigger binaries) + for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64 +- Note: clang 3.2 or later works for i386 and x86_64 targets but results in +- much bigger binaries. +- earlier versions not tested +- Note: clang 3.2 or later works for arm +- earlier versions not tested +- Note: clang on arm64 is not supported due to +- https://llvm.org/bugs/show_bug.cgi?id=26030 +- Note: clang 3.3 or later works for mips(el) +- earlier versions fail to generate .reginfo and hence gprel relocations +- fail. +- Note: clang 3.2 or later works for powerpc +- earlier versions not tested +- Note: clang 3.5 or later works for sparc64 +- earlier versions return "error: unable to interface with target machine" +- Note: clang has no support for ia64 and hence you can't compile GRUB +- for ia64 with clang + * GNU Make + * GNU Bison 2.3 or later + * GNU gettext 0.17 or later diff --git a/0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch b/0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch new file mode 100644 index 00000000..b44695b9 --- /dev/null +++ b/0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch @@ -0,0 +1,240 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 15 Jun 2020 12:15:29 -0400 +Subject: [PATCH] calloc: Make sure we always have an overflow-checking + calloc() available + +This tries to make sure that everywhere in this source tree, we always have +an appropriate version of calloc() (i.e. grub_calloc(), xcalloc(), etc.) +available, and that they all safely check for overflow and return NULL when +it would occur. + +Signed-off-by: Peter Jones +Reviewed-by: Daniel Kiper +Upstream-commit-id: 79e51ab7a9a +--- + grub-core/kern/emu/misc.c | 12 ++++++++++++ + grub-core/kern/emu/mm.c | 10 ++++++++++ + grub-core/kern/mm.c | 40 ++++++++++++++++++++++++++++++++++++++ + grub-core/lib/libgcrypt_wrap/mem.c | 11 +++++++++-- + grub-core/lib/posix_wrap/stdlib.h | 8 +++++++- + include/grub/emu/misc.h | 1 + + include/grub/mm.h | 6 ++++++ + 7 files changed, 85 insertions(+), 3 deletions(-) + +diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c +index 7a8d9e62300..f08a1bb8415 100644 +--- a/grub-core/kern/emu/misc.c ++++ b/grub-core/kern/emu/misc.c +@@ -86,6 +86,18 @@ grub_util_error (const char *fmt, ...) + grub_exit (1); + } + ++void * ++xcalloc (grub_size_t nmemb, grub_size_t size) ++{ ++ void *p; ++ ++ p = calloc (nmemb, size); ++ if (!p) ++ grub_util_error ("%s", _("out of memory")); ++ ++ return p; ++} ++ + void * + xmalloc (grub_size_t size) + { +diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c +index f262e95e388..145b01d3719 100644 +--- a/grub-core/kern/emu/mm.c ++++ b/grub-core/kern/emu/mm.c +@@ -25,6 +25,16 @@ + #include + #include + ++void * ++grub_calloc (grub_size_t nmemb, grub_size_t size) ++{ ++ void *ret; ++ ret = calloc (nmemb, size); ++ if (!ret) ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ return ret; ++} ++ + void * + grub_malloc (grub_size_t size) + { +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index 002cbfa4f3d..80d0720d005 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -67,8 +67,10 @@ + #include + #include + #include ++#include + + #ifdef MM_DEBUG ++# undef grub_calloc + # undef grub_malloc + # undef grub_zalloc + # undef grub_realloc +@@ -375,6 +377,30 @@ grub_memalign (grub_size_t align, grub_size_t size) + return 0; + } + ++/* ++ * Allocate NMEMB instances of SIZE bytes and return the pointer, or error on ++ * integer overflow. ++ */ ++void * ++grub_calloc (grub_size_t nmemb, grub_size_t size) ++{ ++ void *ret; ++ grub_size_t sz = 0; ++ ++ if (grub_mul (nmemb, size, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ return NULL; ++ } ++ ++ ret = grub_memalign (0, sz); ++ if (!ret) ++ return NULL; ++ ++ grub_memset (ret, 0, sz); ++ return ret; ++} ++ + /* Allocate SIZE bytes and return the pointer. */ + void * + grub_malloc (grub_size_t size) +@@ -561,6 +587,20 @@ grub_mm_dump (unsigned lineno) + grub_printf ("\n"); + } + ++void * ++grub_debug_calloc (const char *file, int line, grub_size_t nmemb, grub_size_t size) ++{ ++ void *ptr; ++ ++ if (grub_mm_debug) ++ grub_printf ("%s:%d: calloc (0x%" PRIxGRUB_SIZE ", 0x%" PRIxGRUB_SIZE ") = ", ++ file, line, size); ++ ptr = grub_calloc (nmemb, size); ++ if (grub_mm_debug) ++ grub_printf ("%p\n", ptr); ++ return ptr; ++} ++ + void * + grub_debug_malloc (const char *file, int line, grub_size_t size) + { +diff --git a/grub-core/lib/libgcrypt_wrap/mem.c b/grub-core/lib/libgcrypt_wrap/mem.c +index beeb661a3c8..74c6eafe525 100644 +--- a/grub-core/lib/libgcrypt_wrap/mem.c ++++ b/grub-core/lib/libgcrypt_wrap/mem.c +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -36,7 +37,10 @@ void * + gcry_xcalloc (size_t n, size_t m) + { + void *ret; +- ret = grub_zalloc (n * m); ++ size_t sz; ++ if (grub_mul (n, m, &sz)) ++ grub_fatal ("gcry_xcalloc would overflow"); ++ ret = grub_zalloc (sz); + if (!ret) + grub_fatal ("gcry_xcalloc failed"); + return ret; +@@ -56,7 +60,10 @@ void * + gcry_xcalloc_secure (size_t n, size_t m) + { + void *ret; +- ret = grub_zalloc (n * m); ++ size_t sz; ++ if (grub_mul (n, m, &sz)) ++ grub_fatal ("gcry_xcalloc would overflow"); ++ ret = grub_zalloc (sz); + if (!ret) + grub_fatal ("gcry_xcalloc failed"); + return ret; +diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h +index 3b46f47ff50..7a8d385e973 100644 +--- a/grub-core/lib/posix_wrap/stdlib.h ++++ b/grub-core/lib/posix_wrap/stdlib.h +@@ -21,6 +21,7 @@ + + #include + #include ++#include + + static inline void + free (void *ptr) +@@ -37,7 +38,12 @@ malloc (grub_size_t size) + static inline void * + calloc (grub_size_t size, grub_size_t nelem) + { +- return grub_zalloc (size * nelem); ++ grub_size_t sz; ++ ++ if (grub_mul (size, nelem, &sz)) ++ return NULL; ++ ++ return grub_zalloc (sz); + } + + static inline void * +diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h +index 5ef4f79e689..01056954b96 100644 +--- a/include/grub/emu/misc.h ++++ b/include/grub/emu/misc.h +@@ -47,6 +47,7 @@ grub_util_device_is_mapped (const char *dev); + #define GRUB_HOST_PRIuLONG_LONG "llu" + #define GRUB_HOST_PRIxLONG_LONG "llx" + ++void * EXPORT_FUNC(xcalloc) (grub_size_t nmemb, grub_size_t size) WARN_UNUSED_RESULT; + void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT; + void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT; + char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT; +diff --git a/include/grub/mm.h b/include/grub/mm.h +index 28e2e53eb32..9c38dd3ca5d 100644 +--- a/include/grub/mm.h ++++ b/include/grub/mm.h +@@ -29,6 +29,7 @@ + #endif + + void grub_mm_init_region (void *addr, grub_size_t size); ++void *EXPORT_FUNC(grub_calloc) (grub_size_t nmemb, grub_size_t size); + void *EXPORT_FUNC(grub_malloc) (grub_size_t size); + void *EXPORT_FUNC(grub_zalloc) (grub_size_t size); + void EXPORT_FUNC(grub_free) (void *ptr); +@@ -48,6 +49,9 @@ extern int EXPORT_VAR(grub_mm_debug); + void grub_mm_dump_free (void); + void grub_mm_dump (unsigned lineno); + ++#define grub_calloc(nmemb, size) \ ++ grub_debug_calloc (GRUB_FILE, __LINE__, nmemb, size) ++ + #define grub_malloc(size) \ + grub_debug_malloc (GRUB_FILE, __LINE__, size) + +@@ -63,6 +67,8 @@ void grub_mm_dump (unsigned lineno); + #define grub_free(ptr) \ + grub_debug_free (GRUB_FILE, __LINE__, ptr) + ++void *EXPORT_FUNC(grub_debug_calloc) (const char *file, int line, ++ grub_size_t nmemb, grub_size_t size); + void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line, + grub_size_t size); + void *EXPORT_FUNC(grub_debug_zalloc) (const char *file, int line, diff --git a/0228-calloc-Use-calloc-at-most-places.patch b/0228-calloc-Use-calloc-at-most-places.patch new file mode 100644 index 00000000..6d429300 --- /dev/null +++ b/0228-calloc-Use-calloc-at-most-places.patch @@ -0,0 +1,1834 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 15 Jun 2020 12:26:01 -0400 +Subject: [PATCH] calloc: Use calloc() at most places + +This modifies most of the places we do some form of: + + X = malloc(Y * Z); + +to use calloc(Y, Z) instead. + +Among other issues, this fixes: + - allocation of integer overflow in grub_png_decode_image_header() + reported by Chris Coulson, + - allocation of integer overflow in luks_recover_key() + reported by Chris Coulson, + - allocation of integer overflow in grub_lvm_detect() + reported by Chris Coulson. + +Fixes: CVE-2020-14308 + +Signed-off-by: Peter Jones +Reviewed-by: Daniel Kiper +Upstream-commit-id: 48eeedf1e4b +--- + grub-core/bus/usb/usbhub.c | 8 ++++---- + grub-core/commands/efi/lsefisystab.c | 3 ++- + grub-core/commands/legacycfg.c | 6 +++--- + grub-core/commands/menuentry.c | 2 +- + grub-core/commands/nativedisk.c | 2 +- + grub-core/commands/parttool.c | 12 +++++++++--- + grub-core/commands/regexp.c | 2 +- + grub-core/commands/search_wrap.c | 2 +- + grub-core/disk/diskfilter.c | 4 ++-- + grub-core/disk/ieee1275/ofdisk.c | 2 +- + grub-core/disk/ldm.c | 14 +++++++------- + grub-core/disk/luks.c | 2 +- + grub-core/disk/lvm.c | 8 ++++---- + grub-core/disk/xen/xendisk.c | 2 +- + grub-core/efiemu/loadcore.c | 2 +- + grub-core/efiemu/mm.c | 6 +++--- + grub-core/font/font.c | 3 +-- + grub-core/fs/affs.c | 6 +++--- + grub-core/fs/btrfs.c | 6 +++--- + grub-core/fs/hfs.c | 2 +- + grub-core/fs/hfsplus.c | 6 +++--- + grub-core/fs/iso9660.c | 2 +- + grub-core/fs/ntfs.c | 4 ++-- + grub-core/fs/sfs.c | 2 +- + grub-core/fs/tar.c | 2 +- + grub-core/fs/udf.c | 4 ++-- + grub-core/fs/zfs/zfs.c | 4 ++-- + grub-core/gfxmenu/gui_string_util.c | 2 +- + grub-core/gfxmenu/widget-box.c | 4 ++-- + grub-core/io/gzio.c | 2 +- + grub-core/kern/efi/efi.c | 6 +++--- + grub-core/kern/emu/hostdisk.c | 2 +- + grub-core/kern/fs.c | 2 +- + grub-core/kern/misc.c | 2 +- + grub-core/kern/parser.c | 2 +- + grub-core/kern/uboot/uboot.c | 2 +- + grub-core/lib/libgcrypt/cipher/ac.c | 8 ++++---- + grub-core/lib/libgcrypt/cipher/primegen.c | 4 ++-- + grub-core/lib/libgcrypt/cipher/pubkey.c | 4 ++-- + grub-core/lib/priority_queue.c | 2 +- + grub-core/lib/reed_solomon.c | 7 +++---- + grub-core/lib/relocator.c | 10 +++++----- + grub-core/lib/zstd/fse_decompress.c | 2 +- + grub-core/loader/arm/linux.c | 2 +- + grub-core/loader/efi/chainloader.c | 2 +- + grub-core/loader/i386/bsdXX.c | 2 +- + grub-core/loader/i386/xnu.c | 4 ++-- + grub-core/loader/macho.c | 2 +- + grub-core/loader/multiboot_elfxx.c | 2 +- + grub-core/loader/xnu.c | 2 +- + grub-core/mmap/mmap.c | 4 ++-- + grub-core/net/bootp.c | 2 +- + grub-core/net/dns.c | 10 +++++----- + grub-core/net/net.c | 4 ++-- + grub-core/normal/charset.c | 10 +++++----- + grub-core/normal/cmdline.c | 14 +++++++------- + grub-core/normal/menu_entry.c | 14 +++++++------- + grub-core/normal/menu_text.c | 4 ++-- + grub-core/normal/term.c | 4 ++-- + grub-core/osdep/linux/getroot.c | 6 +++--- + grub-core/osdep/unix/config.c | 2 +- + grub-core/osdep/windows/getroot.c | 2 +- + grub-core/osdep/windows/hostdisk.c | 4 ++-- + grub-core/osdep/windows/init.c | 2 +- + grub-core/osdep/windows/platform.c | 4 ++-- + grub-core/osdep/windows/relpath.c | 2 +- + grub-core/partmap/gpt.c | 2 +- + grub-core/partmap/msdos.c | 2 +- + grub-core/script/execute.c | 2 +- + grub-core/tests/fake_input.c | 2 +- + grub-core/tests/video_checksum.c | 6 +++--- + grub-core/video/capture.c | 2 +- + grub-core/video/emu/sdl.c | 2 +- + grub-core/video/i386/pc/vga.c | 2 +- + grub-core/video/readers/png.c | 2 +- + util/getroot.c | 2 +- + util/grub-file.c | 2 +- + util/grub-fstest.c | 4 ++-- + util/grub-install-common.c | 2 +- + util/grub-install.c | 4 ++-- + util/grub-mkimagexx.c | 6 ++---- + util/grub-mkrescue.c | 4 ++-- + util/grub-mkstandalone.c | 2 +- + util/grub-pe2elf.c | 12 +++++------- + util/grub-probe.c | 4 ++-- + include/grub/unicode.h | 4 ++-- + 86 files changed, 176 insertions(+), 175 deletions(-) + +diff --git a/grub-core/bus/usb/usbhub.c b/grub-core/bus/usb/usbhub.c +index 34a7ff1b5f8..a06cce302d2 100644 +--- a/grub-core/bus/usb/usbhub.c ++++ b/grub-core/bus/usb/usbhub.c +@@ -149,8 +149,8 @@ grub_usb_add_hub (grub_usb_device_t dev) + grub_usb_set_configuration (dev, 1); + + dev->nports = hubdesc.portcnt; +- dev->children = grub_zalloc (hubdesc.portcnt * sizeof (dev->children[0])); +- dev->ports = grub_zalloc (dev->nports * sizeof (dev->ports[0])); ++ dev->children = grub_calloc (hubdesc.portcnt, sizeof (dev->children[0])); ++ dev->ports = grub_calloc (dev->nports, sizeof (dev->ports[0])); + if (!dev->children || !dev->ports) + { + grub_free (dev->children); +@@ -268,8 +268,8 @@ grub_usb_controller_dev_register_iter (grub_usb_controller_t controller, void *d + + /* Query the number of ports the root Hub has. */ + hub->nports = controller->dev->hubports (controller); +- hub->devices = grub_zalloc (sizeof (hub->devices[0]) * hub->nports); +- hub->ports = grub_zalloc (sizeof (hub->ports[0]) * hub->nports); ++ hub->devices = grub_calloc (hub->nports, sizeof (hub->devices[0])); ++ hub->ports = grub_calloc (hub->nports, sizeof (hub->ports[0])); + if (!hub->devices || !hub->ports) + { + grub_free (hub->devices); +diff --git a/grub-core/commands/efi/lsefisystab.c b/grub-core/commands/efi/lsefisystab.c +index df103022188..cd81507f5d4 100644 +--- a/grub-core/commands/efi/lsefisystab.c ++++ b/grub-core/commands/efi/lsefisystab.c +@@ -71,7 +71,8 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)), + grub_printf ("Vendor: "); + + for (vendor_utf16 = st->firmware_vendor; *vendor_utf16; vendor_utf16++); +- vendor = grub_malloc (4 * (vendor_utf16 - st->firmware_vendor) + 1); ++ /* Allocate extra 3 bytes to simplify math. */ ++ vendor = grub_calloc (4, vendor_utf16 - st->firmware_vendor + 1); + if (!vendor) + return grub_errno; + *grub_utf16_to_utf8 ((grub_uint8_t *) vendor, st->firmware_vendor, +diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c +index 891eac5a33f..da5143d4360 100644 +--- a/grub-core/commands/legacycfg.c ++++ b/grub-core/commands/legacycfg.c +@@ -315,7 +315,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), + if (argc < 2) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); + +- cutargs = grub_malloc (sizeof (cutargs[0]) * (argc - 1)); ++ cutargs = grub_calloc (argc - 1, sizeof (cutargs[0])); + if (!cutargs) + return grub_errno; + cutargc = argc - 1; +@@ -437,7 +437,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), + { + char rbuf[3] = "-r"; + bsdargc = cutargc + 2; +- bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc); ++ bsdargs = grub_calloc (bsdargc, sizeof (bsdargs[0])); + if (!bsdargs) + { + err = grub_errno; +@@ -560,7 +560,7 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("can't find command `%s'"), + "module"); + +- newargs = grub_malloc ((argc + 1) * sizeof (newargs[0])); ++ newargs = grub_calloc (argc + 1, sizeof (newargs[0])); + if (!newargs) + return grub_errno; + grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0])); +diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c +index 29736f5cd03..84edfc06b7f 100644 +--- a/grub-core/commands/menuentry.c ++++ b/grub-core/commands/menuentry.c +@@ -157,7 +157,7 @@ grub_normal_add_menu_entry (int argc, const char **args, + grub_dprintf ("menu", "menu_id:\"%s\"\n", menu_id); + + /* Save argc, args to pass as parameters to block arg later. */ +- menu_args = grub_malloc (sizeof (char*) * (argc + 1)); ++ menu_args = grub_calloc (argc + 1, sizeof (char *)); + if (! menu_args) + goto fail; + +diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c +index 699447d11ec..7c8f97f6ad5 100644 +--- a/grub-core/commands/nativedisk.c ++++ b/grub-core/commands/nativedisk.c +@@ -195,7 +195,7 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)), + else + path_prefix = prefix; + +- mods = grub_malloc (argc * sizeof (mods[0])); ++ mods = grub_calloc (argc, sizeof (mods[0])); + if (!mods) + return grub_errno; + +diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c +index 22b46b18741..051e31320e9 100644 +--- a/grub-core/commands/parttool.c ++++ b/grub-core/commands/parttool.c +@@ -59,7 +59,13 @@ grub_parttool_register(const char *part_name, + for (nargs = 0; args[nargs].name != 0; nargs++); + cur->nargs = nargs; + cur->args = (struct grub_parttool_argdesc *) +- grub_malloc ((nargs + 1) * sizeof (struct grub_parttool_argdesc)); ++ grub_calloc (nargs + 1, sizeof (struct grub_parttool_argdesc)); ++ if (!cur->args) ++ { ++ grub_free (cur); ++ curhandle--; ++ return -1; ++ } + grub_memcpy (cur->args, args, + (nargs + 1) * sizeof (struct grub_parttool_argdesc)); + +@@ -257,7 +263,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), + return err; + } + +- parsed = (int *) grub_zalloc (argc * sizeof (int)); ++ parsed = (int *) grub_calloc (argc, sizeof (int)); + + for (i = 1; i < argc; i++) + if (! parsed[i]) +@@ -290,7 +296,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), + } + ptool = cur; + pargs = (struct grub_parttool_args *) +- grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args)); ++ grub_calloc (ptool->nargs, sizeof (struct grub_parttool_args)); + for (j = i; j < argc; j++) + if (! parsed[j]) + { +diff --git a/grub-core/commands/regexp.c b/grub-core/commands/regexp.c +index 7c5c72fe460..612003f94c8 100644 +--- a/grub-core/commands/regexp.c ++++ b/grub-core/commands/regexp.c +@@ -116,7 +116,7 @@ grub_cmd_regexp (grub_extcmd_context_t ctxt, int argc, char **args) + if (ret) + goto fail; + +- matches = grub_zalloc (sizeof (*matches) * (regex.re_nsub + 1)); ++ matches = grub_calloc (regex.re_nsub + 1, sizeof (*matches)); + if (! matches) + goto fail; + +diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c +index d7fd26b9405..47fc8eb9966 100644 +--- a/grub-core/commands/search_wrap.c ++++ b/grub-core/commands/search_wrap.c +@@ -122,7 +122,7 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) + for (i = 0; state[SEARCH_HINT_BAREMETAL].args[i]; i++) + nhints++; + +- hints = grub_malloc (sizeof (hints[0]) * nhints); ++ hints = grub_calloc (nhints, sizeof (hints[0])); + if (!hints) + return grub_errno; + j = 0; +diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c +index 3f264be77d1..88784dc440b 100644 +--- a/grub-core/disk/diskfilter.c ++++ b/grub-core/disk/diskfilter.c +@@ -1137,7 +1137,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + array->lvs->segments->node_count = nmemb; + array->lvs->segments->raid_member_size = disk_size; + array->lvs->segments->nodes +- = grub_zalloc (nmemb * sizeof (array->lvs->segments->nodes[0])); ++ = grub_calloc (nmemb, sizeof (array->lvs->segments->nodes[0])); + array->lvs->segments->stripe_size = stripe_size; + for (i = 0; i < nmemb; i++) + { +@@ -1230,7 +1230,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id, + grub_partition_t p; + for (p = disk->partition; p; p = p->parent) + s++; +- pv->partmaps = xmalloc (s * sizeof (pv->partmaps[0])); ++ pv->partmaps = xcalloc (s, sizeof (pv->partmaps[0])); + s = 0; + for (p = disk->partition; p; p = p->parent) + pv->partmaps[s++] = xstrdup (p->partmap->name); +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index f73257e66dc..03674cb477e 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -297,7 +297,7 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) + /* Power machines documentation specify 672 as maximum SAS disks in + one system. Using a slightly larger value to be safe. */ + table_size = 768; +- table = grub_malloc (table_size * sizeof (grub_uint64_t)); ++ table = grub_calloc (table_size, sizeof (grub_uint64_t)); + + if (!table) + { +diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c +index 2a22d2d6c1c..e6323701ab3 100644 +--- a/grub-core/disk/ldm.c ++++ b/grub-core/disk/ldm.c +@@ -323,8 +323,8 @@ make_vg (grub_disk_t disk, + lv->segments->type = GRUB_DISKFILTER_MIRROR; + lv->segments->node_count = 0; + lv->segments->node_alloc = 8; +- lv->segments->nodes = grub_zalloc (sizeof (*lv->segments->nodes) +- * lv->segments->node_alloc); ++ lv->segments->nodes = grub_calloc (lv->segments->node_alloc, ++ sizeof (*lv->segments->nodes)); + if (!lv->segments->nodes) + goto fail2; + ptr = vblk[i].dynamic; +@@ -543,8 +543,8 @@ make_vg (grub_disk_t disk, + { + comp->segment_alloc = 8; + comp->segment_count = 0; +- comp->segments = grub_malloc (sizeof (*comp->segments) +- * comp->segment_alloc); ++ comp->segments = grub_calloc (comp->segment_alloc, ++ sizeof (*comp->segments)); + if (!comp->segments) + goto fail2; + } +@@ -590,8 +590,8 @@ make_vg (grub_disk_t disk, + } + comp->segments->node_count = read_int (ptr + 1, *ptr); + comp->segments->node_alloc = comp->segments->node_count; +- comp->segments->nodes = grub_zalloc (sizeof (*comp->segments->nodes) +- * comp->segments->node_alloc); ++ comp->segments->nodes = grub_calloc (comp->segments->node_alloc, ++ sizeof (*comp->segments->nodes)); + if (!lv->segments->nodes) + goto fail2; + } +@@ -1017,7 +1017,7 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors, + *nsectors = lv->size; + if (*nsectors > max_nsectors) + *nsectors = max_nsectors; +- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); ++ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); + if (!*sectors) + return grub_errno; + for (i = 0; i < *nsectors; i++) +diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c +index 86c50c61217..18b3a8bb1d3 100644 +--- a/grub-core/disk/luks.c ++++ b/grub-core/disk/luks.c +@@ -336,7 +336,7 @@ luks_recover_key (grub_disk_t source, + && grub_be_to_cpu32 (header.keyblock[i].stripes) > max_stripes) + max_stripes = grub_be_to_cpu32 (header.keyblock[i].stripes); + +- split_key = grub_malloc (keysize * max_stripes); ++ split_key = grub_calloc (keysize, max_stripes); + if (!split_key) + return grub_errno; + +diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c +index 0cbd0dd1629..8e76d1ae121 100644 +--- a/grub-core/disk/lvm.c ++++ b/grub-core/disk/lvm.c +@@ -174,7 +174,7 @@ grub_lvm_detect (grub_disk_t disk, + first one. */ + + /* Allocate buffer space for the circular worst-case scenario. */ +- metadatabuf = grub_malloc (2 * mda_size); ++ metadatabuf = grub_calloc (2, mda_size); + if (! metadatabuf) + goto fail; + +@@ -427,7 +427,7 @@ grub_lvm_detect (grub_disk_t disk, + #endif + goto lvs_fail; + } +- lv->segments = grub_zalloc (sizeof (*seg) * lv->segment_count); ++ lv->segments = grub_calloc (lv->segment_count, sizeof (*seg)); + seg = lv->segments; + + for (i = 0; i < lv->segment_count; i++) +@@ -484,8 +484,8 @@ grub_lvm_detect (grub_disk_t disk, + if (seg->node_count != 1) + seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = "); + +- seg->nodes = grub_zalloc (sizeof (*stripe) +- * seg->node_count); ++ seg->nodes = grub_calloc (seg->node_count, ++ sizeof (*stripe)); + stripe = seg->nodes; + + p = grub_strstr (p, "stripes = ["); +diff --git a/grub-core/disk/xen/xendisk.c b/grub-core/disk/xen/xendisk.c +index 48476cbbf96..d6612eebd75 100644 +--- a/grub-core/disk/xen/xendisk.c ++++ b/grub-core/disk/xen/xendisk.c +@@ -426,7 +426,7 @@ grub_xendisk_init (void) + if (!ctr) + return; + +- virtdisks = grub_malloc (ctr * sizeof (virtdisks[0])); ++ virtdisks = grub_calloc (ctr, sizeof (virtdisks[0])); + if (!virtdisks) + return; + if (grub_xenstore_dir ("device/vbd", fill, &ctr)) +diff --git a/grub-core/efiemu/loadcore.c b/grub-core/efiemu/loadcore.c +index 44085ef818e..2b924623f51 100644 +--- a/grub-core/efiemu/loadcore.c ++++ b/grub-core/efiemu/loadcore.c +@@ -201,7 +201,7 @@ grub_efiemu_count_symbols (const Elf_Ehdr *e) + + grub_efiemu_nelfsyms = (unsigned) s->sh_size / (unsigned) s->sh_entsize; + grub_efiemu_elfsyms = (struct grub_efiemu_elf_sym *) +- grub_malloc (sizeof (struct grub_efiemu_elf_sym) * grub_efiemu_nelfsyms); ++ grub_calloc (grub_efiemu_nelfsyms, sizeof (struct grub_efiemu_elf_sym)); + + /* Relocators */ + for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); +diff --git a/grub-core/efiemu/mm.c b/grub-core/efiemu/mm.c +index 52a032f7b2e..9b8e0d0ad1a 100644 +--- a/grub-core/efiemu/mm.c ++++ b/grub-core/efiemu/mm.c +@@ -554,11 +554,11 @@ grub_efiemu_mmap_sort_and_uniq (void) + /* Initialize variables*/ + grub_memset (present, 0, sizeof (int) * GRUB_EFI_MAX_MEMORY_TYPE); + scanline_events = (struct grub_efiemu_mmap_scan *) +- grub_malloc (sizeof (struct grub_efiemu_mmap_scan) * 2 * mmap_num); ++ grub_calloc (mmap_num, sizeof (struct grub_efiemu_mmap_scan) * 2); + + /* Number of chunks can't increase more than by factor of 2 */ + result = (grub_efi_memory_descriptor_t *) +- grub_malloc (sizeof (grub_efi_memory_descriptor_t) * 2 * mmap_num); ++ grub_calloc (mmap_num, sizeof (grub_efi_memory_descriptor_t) * 2); + if (!result || !scanline_events) + { + grub_free (result); +@@ -660,7 +660,7 @@ grub_efiemu_mm_do_alloc (void) + + /* Preallocate mmap */ + efiemu_mmap = (grub_efi_memory_descriptor_t *) +- grub_malloc (mmap_reserved_size * sizeof (grub_efi_memory_descriptor_t)); ++ grub_calloc (mmap_reserved_size, sizeof (grub_efi_memory_descriptor_t)); + if (!efiemu_mmap) + { + grub_efiemu_unload (); +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 85a292557ac..8e118b315ce 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -293,8 +293,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct + font->num_chars = sect_length / FONT_CHAR_INDEX_ENTRY_SIZE; + + /* Allocate the character index array. */ +- font->char_index = grub_malloc (font->num_chars +- * sizeof (struct char_index_entry)); ++ font->char_index = grub_calloc (font->num_chars, sizeof (struct char_index_entry)); + if (!font->char_index) + return 1; + font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t)); +diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c +index 6b6a2bc9135..220b3712f2a 100644 +--- a/grub-core/fs/affs.c ++++ b/grub-core/fs/affs.c +@@ -301,7 +301,7 @@ grub_affs_read_symlink (grub_fshelp_node_t node) + return 0; + } + latin1[symlink_size] = 0; +- utf8 = grub_malloc (symlink_size * GRUB_MAX_UTF8_PER_LATIN1 + 1); ++ utf8 = grub_calloc (GRUB_MAX_UTF8_PER_LATIN1 + 1, symlink_size); + if (!utf8) + { + grub_free (latin1); +@@ -422,7 +422,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir, + return 1; + } + +- hashtable = grub_zalloc (data->htsize * sizeof (*hashtable)); ++ hashtable = grub_calloc (data->htsize, sizeof (*hashtable)); + if (!hashtable) + return 1; + +@@ -628,7 +628,7 @@ grub_affs_label (grub_device_t device, char **label) + len = file.namelen; + if (len > sizeof (file.name)) + len = sizeof (file.name); +- *label = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1); ++ *label = grub_calloc (GRUB_MAX_UTF8_PER_LATIN1 + 1, len); + if (*label) + *grub_latin1_to_utf8 ((grub_uint8_t *) *label, file.name, len) = '\0'; + } +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 9cd7f4bdf65..ba080fdc580 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -442,7 +442,7 @@ lower_bound (struct grub_btrfs_data *data, + { + desc->allocated = 16; + desc->depth = 0; +- desc->data = grub_malloc (sizeof (desc->data[0]) * desc->allocated); ++ desc->data = grub_calloc (desc->allocated, sizeof (desc->data[0])); + if (!desc->data) + return grub_errno; + } +@@ -781,7 +781,7 @@ raid56_read_retry (struct grub_btrfs_data *data, + grub_err_t ret = GRUB_ERR_OUT_OF_MEMORY; + grub_uint64_t i, failed_devices; + +- buffers = grub_zalloc (sizeof(*buffers) * nstripes); ++ buffers = grub_calloc (nstripes, sizeof (*buffers)); + if (!buffers) + goto cleanup; + +@@ -2477,7 +2477,7 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), + *nsectors = 64 * 2 - 1; + if (*nsectors > max_nsectors) + *nsectors = max_nsectors; +- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); ++ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); + if (!*sectors) + return grub_errno; + for (i = 0; i < *nsectors; i++) +diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c +index ac0a40990e0..3fe842b4d8b 100644 +--- a/grub-core/fs/hfs.c ++++ b/grub-core/fs/hfs.c +@@ -1360,7 +1360,7 @@ grub_hfs_label (grub_device_t device, char **label) + grub_size_t len = data->sblock.volname[0]; + if (len > sizeof (data->sblock.volname) - 1) + len = sizeof (data->sblock.volname) - 1; +- *label = grub_malloc (len * MAX_UTF8_PER_MAC_ROMAN + 1); ++ *label = grub_calloc (MAX_UTF8_PER_MAC_ROMAN + 1, len); + if (*label) + macroman_to_utf8 (*label, data->sblock.volname + 1, + len + 1, 0); +diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c +index 54786bb1c6d..dae43becc97 100644 +--- a/grub-core/fs/hfsplus.c ++++ b/grub-core/fs/hfsplus.c +@@ -720,7 +720,7 @@ list_nodes (void *record, void *hook_arg) + if (! filename) + return 0; + +- keyname = grub_malloc (grub_be_to_cpu16 (catkey->namelen) * sizeof (*keyname)); ++ keyname = grub_calloc (grub_be_to_cpu16 (catkey->namelen), sizeof (*keyname)); + if (!keyname) + { + grub_free (filename); +@@ -1007,7 +1007,7 @@ grub_hfsplus_label (grub_device_t device, char **label) + grub_hfsplus_btree_recptr (&data->catalog_tree, node, ptr); + + label_len = grub_be_to_cpu16 (catkey->namelen); +- label_name = grub_malloc (label_len * sizeof (*label_name)); ++ label_name = grub_calloc (label_len, sizeof (*label_name)); + if (!label_name) + { + grub_free (node); +@@ -1029,7 +1029,7 @@ grub_hfsplus_label (grub_device_t device, char **label) + } + } + +- *label = grub_malloc (label_len * GRUB_MAX_UTF8_PER_UTF16 + 1); ++ *label = grub_calloc (label_len, GRUB_MAX_UTF8_PER_UTF16 + 1); + if (! *label) + { + grub_free (label_name); +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index 49c0c632bf3..4f1b52a552a 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -331,7 +331,7 @@ grub_iso9660_convert_string (grub_uint8_t *us, int len) + int i; + grub_uint16_t t[MAX_NAMELEN / 2 + 1]; + +- p = grub_malloc (len * GRUB_MAX_UTF8_PER_UTF16 + 1); ++ p = grub_calloc (len, GRUB_MAX_UTF8_PER_UTF16 + 1); + if (! p) + return NULL; + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index fc4e1f678d6..2f34f76da88 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -556,8 +556,8 @@ get_utf8 (grub_uint8_t *in, grub_size_t len) + grub_uint16_t *tmp; + grub_size_t i; + +- buf = grub_malloc (len * GRUB_MAX_UTF8_PER_UTF16 + 1); +- tmp = grub_malloc (len * sizeof (tmp[0])); ++ buf = grub_calloc (len, GRUB_MAX_UTF8_PER_UTF16 + 1); ++ tmp = grub_calloc (len, sizeof (tmp[0])); + if (!buf || !tmp) + { + grub_free (buf); +diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c +index 50c1fe72f44..90f7fb37918 100644 +--- a/grub-core/fs/sfs.c ++++ b/grub-core/fs/sfs.c +@@ -266,7 +266,7 @@ grub_sfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + node->next_extent = node->block; + node->cache_size = 0; + +- node->cache = grub_malloc (sizeof (node->cache[0]) * cache_size); ++ node->cache = grub_calloc (cache_size, sizeof (node->cache[0])); + if (!node->cache) + { + grub_errno = 0; +diff --git a/grub-core/fs/tar.c b/grub-core/fs/tar.c +index 7d63e0c99c7..c551ed6b520 100644 +--- a/grub-core/fs/tar.c ++++ b/grub-core/fs/tar.c +@@ -120,7 +120,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + if (data->linkname_alloc < linksize + 1) + { + char *n; +- n = grub_malloc (2 * (linksize + 1)); ++ n = grub_calloc (2, linksize + 1); + if (!n) + return grub_errno; + grub_free (data->linkname); +diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c +index dc8b6e2d1c9..a83761674ad 100644 +--- a/grub-core/fs/udf.c ++++ b/grub-core/fs/udf.c +@@ -873,7 +873,7 @@ read_string (const grub_uint8_t *raw, grub_size_t sz, char *outbuf) + { + unsigned i; + utf16len = sz - 1; +- utf16 = grub_malloc (utf16len * sizeof (utf16[0])); ++ utf16 = grub_calloc (utf16len, sizeof (utf16[0])); + if (!utf16) + return NULL; + for (i = 0; i < utf16len; i++) +@@ -883,7 +883,7 @@ read_string (const grub_uint8_t *raw, grub_size_t sz, char *outbuf) + { + unsigned i; + utf16len = (sz - 1) / 2; +- utf16 = grub_malloc (utf16len * sizeof (utf16[0])); ++ utf16 = grub_calloc (utf16len, sizeof (utf16[0])); + if (!utf16) + return NULL; + for (i = 0; i < utf16len; i++) +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index 2f72e42bf80..381dde556d1 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -3325,7 +3325,7 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, + } + subvol->nkeys = 0; + zap_iterate (&keychain_dn, 8, count_zap_keys, &ctx, data); +- subvol->keyring = grub_zalloc (subvol->nkeys * sizeof (subvol->keyring[0])); ++ subvol->keyring = grub_calloc (subvol->nkeys, sizeof (subvol->keyring[0])); + if (!subvol->keyring) + { + grub_free (fsname); +@@ -4336,7 +4336,7 @@ grub_zfs_embed (grub_device_t device __attribute__ ((unused)), + *nsectors = (VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS); + if (*nsectors > max_nsectors) + *nsectors = max_nsectors; +- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); ++ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); + if (!*sectors) + return grub_errno; + for (i = 0; i < *nsectors; i++) +diff --git a/grub-core/gfxmenu/gui_string_util.c b/grub-core/gfxmenu/gui_string_util.c +index a9a415e3129..ba1e1eab319 100644 +--- a/grub-core/gfxmenu/gui_string_util.c ++++ b/grub-core/gfxmenu/gui_string_util.c +@@ -55,7 +55,7 @@ canonicalize_path (const char *path) + if (*p == '/') + components++; + +- char **path_array = grub_malloc (components * sizeof (*path_array)); ++ char **path_array = grub_calloc (components, sizeof (*path_array)); + if (! path_array) + return 0; + +diff --git a/grub-core/gfxmenu/widget-box.c b/grub-core/gfxmenu/widget-box.c +index b6060288914..470597ded2b 100644 +--- a/grub-core/gfxmenu/widget-box.c ++++ b/grub-core/gfxmenu/widget-box.c +@@ -303,10 +303,10 @@ grub_gfxmenu_create_box (const char *pixmaps_prefix, + box->content_height = 0; + box->raw_pixmaps = + (struct grub_video_bitmap **) +- grub_malloc (BOX_NUM_PIXMAPS * sizeof (struct grub_video_bitmap *)); ++ grub_calloc (BOX_NUM_PIXMAPS, sizeof (struct grub_video_bitmap *)); + box->scaled_pixmaps = + (struct grub_video_bitmap **) +- grub_malloc (BOX_NUM_PIXMAPS * sizeof (struct grub_video_bitmap *)); ++ grub_calloc (BOX_NUM_PIXMAPS, sizeof (struct grub_video_bitmap *)); + + /* Initialize all pixmap pointers to NULL so that proper destruction can + be performed if an error is encountered partway through construction. */ +diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c +index 6208a976363..43d98a7bdf4 100644 +--- a/grub-core/io/gzio.c ++++ b/grub-core/io/gzio.c +@@ -554,7 +554,7 @@ huft_build (unsigned *b, /* code lengths in bits (all assumed <= BMAX) */ + z = 1 << j; /* table entries for j-bit table */ + + /* allocate and link in new table */ +- q = (struct huft *) grub_zalloc ((z + 1) * sizeof (struct huft)); ++ q = (struct huft *) grub_calloc (z + 1, sizeof (struct huft)); + if (! q) + { + if (h) +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 279394d85eb..ab133fecce0 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -207,7 +207,7 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid, + + len = grub_strlen (var); + len16 = len * GRUB_MAX_UTF16_PER_UTF8; +- var16 = grub_malloc ((len16 + 1) * sizeof (var16[0])); ++ var16 = grub_calloc (len16 + 1, sizeof (var16[0])); + if (!var16) + return grub_errno; + len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL); +@@ -245,7 +245,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, + + len = grub_strlen (var); + len16 = len * GRUB_MAX_UTF16_PER_UTF8; +- var16 = grub_malloc ((len16 + 1) * sizeof (var16[0])); ++ var16 = grub_calloc (len16 + 1, sizeof (var16[0])); + if (!var16) + return NULL; + len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL); +@@ -401,7 +401,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) + while (len > 0 && fp->path_name[len - 1] == 0) + len--; + +- dup_name = grub_malloc (len * sizeof (*dup_name)); ++ dup_name = grub_calloc (len, sizeof (*dup_name)); + if (!dup_name) + { + grub_free (name); +diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c +index e9ec680cdbb..d975265b2e0 100644 +--- a/grub-core/kern/emu/hostdisk.c ++++ b/grub-core/kern/emu/hostdisk.c +@@ -615,7 +615,7 @@ static char * + grub_util_path_concat_real (size_t n, int ext, va_list ap) + { + size_t totlen = 0; +- char **l = xmalloc ((n + ext) * sizeof (l[0])); ++ char **l = xcalloc (n + ext, sizeof (l[0])); + char *r, *p, *pi; + size_t i; + int first = 1; +diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c +index 88d39360da0..fb30da9f404 100644 +--- a/grub-core/kern/fs.c ++++ b/grub-core/kern/fs.c +@@ -151,7 +151,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name) + while (p); + + /* Allocate a block list. */ +- blocks = grub_zalloc (sizeof (struct grub_fs_block) * (num + 1)); ++ blocks = grub_calloc (num + 1, sizeof (struct grub_fs_block)); + if (! blocks) + return 0; + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 87afb43cd55..dc5e10b651a 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -750,7 +750,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, + args->ptr = args->prealloc; + else + { +- args->ptr = grub_malloc (args->count * sizeof (args->ptr[0])); ++ args->ptr = grub_calloc (args->count, sizeof (args->ptr[0])); + if (!args->ptr) + { + grub_errno = GRUB_ERR_NONE; +diff --git a/grub-core/kern/parser.c b/grub-core/kern/parser.c +index 78175aac2d3..619db3122a0 100644 +--- a/grub-core/kern/parser.c ++++ b/grub-core/kern/parser.c +@@ -213,7 +213,7 @@ grub_parser_split_cmdline (const char *cmdline, + return grub_errno; + grub_memcpy (args, buffer, bp - buffer); + +- *argv = grub_malloc (sizeof (char *) * (*argc + 1)); ++ *argv = grub_calloc (*argc + 1, sizeof (char *)); + if (!*argv) + { + grub_free (args); +diff --git a/grub-core/kern/uboot/uboot.c b/grub-core/kern/uboot/uboot.c +index be4816fe6f5..aac8f9ae1fd 100644 +--- a/grub-core/kern/uboot/uboot.c ++++ b/grub-core/kern/uboot/uboot.c +@@ -133,7 +133,7 @@ grub_uboot_dev_enum (void) + return num_devices; + + max_devices = 2; +- enum_devices = grub_malloc (sizeof(struct device_info) * max_devices); ++ enum_devices = grub_calloc (max_devices, sizeof(struct device_info)); + if (!enum_devices) + return 0; + +diff --git a/grub-core/lib/libgcrypt/cipher/ac.c b/grub-core/lib/libgcrypt/cipher/ac.c +index f5e946a2d8f..63f6fcd11ef 100644 +--- a/grub-core/lib/libgcrypt/cipher/ac.c ++++ b/grub-core/lib/libgcrypt/cipher/ac.c +@@ -185,7 +185,7 @@ ac_data_mpi_copy (gcry_ac_mpi_t *data_mpis, unsigned int data_mpis_n, + gcry_mpi_t mpi; + char *label; + +- data_mpis_new = gcry_malloc (sizeof (*data_mpis_new) * data_mpis_n); ++ data_mpis_new = gcry_calloc (data_mpis_n, sizeof (*data_mpis_new)); + if (! data_mpis_new) + { + err = gcry_error_from_errno (errno); +@@ -572,7 +572,7 @@ _gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp, + } + + /* Add MPI list. */ +- arg_list = gcry_malloc (sizeof (*arg_list) * (data_n + 1)); ++ arg_list = gcry_calloc (data_n + 1, sizeof (*arg_list)); + if (! arg_list) + { + err = gcry_error_from_errno (errno); +@@ -1283,7 +1283,7 @@ ac_data_construct (const char *identifier, int include_flags, + /* We build a list of arguments to pass to + gcry_sexp_build_array(). */ + data_length = _gcry_ac_data_length (data); +- arg_list = gcry_malloc (sizeof (*arg_list) * (data_length * 2)); ++ arg_list = gcry_calloc (data_length, sizeof (*arg_list) * 2); + if (! arg_list) + { + err = gcry_error_from_errno (errno); +@@ -1593,7 +1593,7 @@ _gcry_ac_key_pair_generate (gcry_ac_handle_t handle, unsigned int nbits, + arg_list_n += 2; + + /* Allocate list. */ +- arg_list = gcry_malloc (sizeof (*arg_list) * arg_list_n); ++ arg_list = gcry_calloc (arg_list_n, sizeof (*arg_list)); + if (! arg_list) + { + err = gcry_error_from_errno (errno); +diff --git a/grub-core/lib/libgcrypt/cipher/primegen.c b/grub-core/lib/libgcrypt/cipher/primegen.c +index 2788e349fa9..b12e79b1922 100644 +--- a/grub-core/lib/libgcrypt/cipher/primegen.c ++++ b/grub-core/lib/libgcrypt/cipher/primegen.c +@@ -383,7 +383,7 @@ prime_generate_internal (int need_q_factor, + } + + /* Allocate an array to track pool usage. */ +- pool_in_use = gcry_malloc (n * sizeof *pool_in_use); ++ pool_in_use = gcry_calloc (n, sizeof *pool_in_use); + if (!pool_in_use) + { + err = gpg_err_code_from_errno (errno); +@@ -765,7 +765,7 @@ gen_prime (unsigned int nbits, int secret, int randomlevel, + if (nbits < 16) + log_fatal ("can't generate a prime with less than %d bits\n", 16); + +- mods = gcry_xmalloc( no_of_small_prime_numbers * sizeof *mods ); ++ mods = gcry_xcalloc( no_of_small_prime_numbers, sizeof *mods); + /* Make nbits fit into gcry_mpi_t implementation. */ + val_2 = mpi_alloc_set_ui( 2 ); + val_3 = mpi_alloc_set_ui( 3); +diff --git a/grub-core/lib/libgcrypt/cipher/pubkey.c b/grub-core/lib/libgcrypt/cipher/pubkey.c +index 910982141e0..ca087ad75b9 100644 +--- a/grub-core/lib/libgcrypt/cipher/pubkey.c ++++ b/grub-core/lib/libgcrypt/cipher/pubkey.c +@@ -2941,7 +2941,7 @@ gcry_pk_encrypt (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t s_pkey) + * array to a format string, so we have to do it this way :-(. */ + /* FIXME: There is now such a format specifier, so we can + change the code to be more clear. */ +- arg_list = malloc (nelem * sizeof *arg_list); ++ arg_list = calloc (nelem, sizeof *arg_list); + if (!arg_list) + { + rc = gpg_err_code_from_syserror (); +@@ -3233,7 +3233,7 @@ gcry_pk_sign (gcry_sexp_t *r_sig, gcry_sexp_t s_hash, gcry_sexp_t s_skey) + } + strcpy (p, "))"); + +- arg_list = malloc (nelem * sizeof *arg_list); ++ arg_list = calloc (nelem, sizeof *arg_list); + if (!arg_list) + { + rc = gpg_err_code_from_syserror (); +diff --git a/grub-core/lib/priority_queue.c b/grub-core/lib/priority_queue.c +index 659be0b7f40..7d5e7c05aab 100644 +--- a/grub-core/lib/priority_queue.c ++++ b/grub-core/lib/priority_queue.c +@@ -92,7 +92,7 @@ grub_priority_queue_new (grub_size_t elsize, + { + struct grub_priority_queue *ret; + void *els; +- els = grub_malloc (elsize * 8); ++ els = grub_calloc (8, elsize); + if (!els) + return 0; + ret = (struct grub_priority_queue *) grub_malloc (sizeof (*ret)); +diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c +index 19c20085279..79037c093f7 100644 +--- a/grub-core/lib/reed_solomon.c ++++ b/grub-core/lib/reed_solomon.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#define xcalloc calloc + #define xmalloc malloc + #define grub_memset memset + #define grub_memcpy memcpy +@@ -158,11 +159,9 @@ rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs) + gf_single_t *rs_polynomial; + unsigned int i, j; + gf_single_t *m; +- m = xmalloc ((s + rs) * sizeof (gf_single_t)); ++ m = xcalloc (s + rs, sizeof (gf_single_t)); + grub_memcpy (m, data, s * sizeof (gf_single_t)); +- grub_memset (m + s, 0, rs * sizeof (gf_single_t)); +- rs_polynomial = xmalloc ((rs + 1) * sizeof (gf_single_t)); +- grub_memset (rs_polynomial, 0, (rs + 1) * sizeof (gf_single_t)); ++ rs_polynomial = xcalloc (rs + 1, sizeof (gf_single_t)); + rs_polynomial[rs] = 1; + /* Multiply with X - a^r */ + for (j = 0; j < rs; j++) +diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c +index ea3ebc719b1..5847aac3643 100644 +--- a/grub-core/lib/relocator.c ++++ b/grub-core/lib/relocator.c +@@ -495,9 +495,9 @@ malloc_in_range (struct grub_relocator *rel, + } + #endif + +- eventt = grub_malloc (maxevents * sizeof (events[0])); ++ eventt = grub_calloc (maxevents, sizeof (events[0])); + counter = grub_malloc ((DIGITSORT_MASK + 2) * sizeof (counter[0])); +- events = grub_malloc (maxevents * sizeof (events[0])); ++ events = grub_calloc (maxevents, sizeof (events[0])); + if (!events || !eventt || !counter) + { + grub_dprintf ("relocator", "events or counter allocation failed %d\n", +@@ -963,7 +963,7 @@ malloc_in_range (struct grub_relocator *rel, + #endif + unsigned cural = 0; + int oom = 0; +- res->subchunks = grub_malloc (sizeof (res->subchunks[0]) * nallocs); ++ res->subchunks = grub_calloc (nallocs, sizeof (res->subchunks[0])); + if (!res->subchunks) + oom = 1; + res->nsubchunks = nallocs; +@@ -1562,8 +1562,8 @@ grub_relocator_prepare_relocs (struct grub_relocator *rel, grub_addr_t addr, + count[(chunk->src & 0xff) + 1]++; + } + } +- from = grub_malloc (nchunks * sizeof (sorted[0])); +- to = grub_malloc (nchunks * sizeof (sorted[0])); ++ from = grub_calloc (nchunks, sizeof (sorted[0])); ++ to = grub_calloc (nchunks, sizeof (sorted[0])); + if (!from || !to) + { + grub_free (from); +diff --git a/grub-core/lib/zstd/fse_decompress.c b/grub-core/lib/zstd/fse_decompress.c +index 72bbead5bee..2227b84bc7e 100644 +--- a/grub-core/lib/zstd/fse_decompress.c ++++ b/grub-core/lib/zstd/fse_decompress.c +@@ -82,7 +82,7 @@ + FSE_DTable* FSE_createDTable (unsigned tableLog) + { + if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX; +- return (FSE_DTable*)malloc( FSE_DTABLE_SIZE_U32(tableLog) * sizeof (U32) ); ++ return (FSE_DTable*)calloc( FSE_DTABLE_SIZE_U32(tableLog), sizeof (U32) ); + } + + void FSE_freeDTable (FSE_DTable* dt) +diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c +index 51684914cfc..d70c174868e 100644 +--- a/grub-core/loader/arm/linux.c ++++ b/grub-core/loader/arm/linux.c +@@ -78,7 +78,7 @@ linux_prepare_atag (void *target_atag) + + /* some place for cmdline, initrd and terminator. */ + tmp_size = get_atag_size (atag_orig) + 20 + (arg_size) / 4; +- tmp_atag = grub_malloc (tmp_size * sizeof (grub_uint32_t)); ++ tmp_atag = grub_calloc (tmp_size, sizeof (grub_uint32_t)); + if (!tmp_atag) + return grub_errno; + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 2c529f71471..736505173cb 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -125,7 +125,7 @@ copy_file_path (grub_efi_file_path_device_path_t *fp, + fp->header.type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE; + fp->header.subtype = GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE; + +- path_name = grub_malloc (len * GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); ++ path_name = grub_calloc (len, GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); + if (!path_name) + return; + +diff --git a/grub-core/loader/i386/bsdXX.c b/grub-core/loader/i386/bsdXX.c +index af6741d157c..a8d8bf7daed 100644 +--- a/grub-core/loader/i386/bsdXX.c ++++ b/grub-core/loader/i386/bsdXX.c +@@ -48,7 +48,7 @@ read_headers (grub_file_t file, const char *filename, Elf_Ehdr *e, char **shdr) + if (e->e_ident[EI_CLASS] != SUFFIX (ELFCLASS)) + return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF magic")); + +- *shdr = grub_malloc ((grub_uint32_t) e->e_shnum * e->e_shentsize); ++ *shdr = grub_calloc (e->e_shnum, e->e_shentsize); + if (! *shdr) + return grub_errno; + +diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c +index e64ed08f580..b7d176b5d30 100644 +--- a/grub-core/loader/i386/xnu.c ++++ b/grub-core/loader/i386/xnu.c +@@ -295,7 +295,7 @@ grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *d + return grub_errno; + + len = grub_strlen (name); +- utf16 = grub_malloc (sizeof (grub_uint16_t) * len); ++ utf16 = grub_calloc (len, sizeof (grub_uint16_t)); + if (!utf16) + { + grub_free (utf8); +@@ -331,7 +331,7 @@ grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor * + grub_uint16_t *utf16; + grub_err_t err; + +- utf16 = grub_malloc (sizeof (grub_uint16_t) * namelen); ++ utf16 = grub_calloc (namelen, sizeof (grub_uint16_t)); + if (!utf16) + return grub_errno; + grub_memcpy (utf16, name, sizeof (grub_uint16_t) * namelen); +diff --git a/grub-core/loader/macho.c b/grub-core/loader/macho.c +index 085f9c6890a..05710c48e06 100644 +--- a/grub-core/loader/macho.c ++++ b/grub-core/loader/macho.c +@@ -97,7 +97,7 @@ grub_macho_file (grub_file_t file, const char *filename, int is_64bit) + if (grub_file_seek (macho->file, sizeof (struct grub_macho_fat_header)) + == (grub_off_t) -1) + goto fail; +- archs = grub_malloc (sizeof (struct grub_macho_fat_arch) * narchs); ++ archs = grub_calloc (narchs, sizeof (struct grub_macho_fat_arch)); + if (!archs) + goto fail; + if (grub_file_read (macho->file, archs, +diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c +index 70cd1db513e..cc6853692a8 100644 +--- a/grub-core/loader/multiboot_elfxx.c ++++ b/grub-core/loader/multiboot_elfxx.c +@@ -217,7 +217,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) + { + grub_uint8_t *shdr, *shdrptr; + +- shdr = grub_malloc ((grub_uint32_t) ehdr->e_shnum * ehdr->e_shentsize); ++ shdr = grub_calloc (ehdr->e_shnum, ehdr->e_shentsize); + if (!shdr) + return grub_errno; + +diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c +index e0f47e72b06..2f0ebd0b8bf 100644 +--- a/grub-core/loader/xnu.c ++++ b/grub-core/loader/xnu.c +@@ -801,7 +801,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)), + if (grub_be_to_cpu32 (head.magic) == GRUB_MACHO_FAT_MAGIC) + { + narchs = grub_be_to_cpu32 (head.nfat_arch); +- archs = grub_malloc (sizeof (struct grub_macho_fat_arch) * narchs); ++ archs = grub_calloc (narchs, sizeof (struct grub_macho_fat_arch)); + if (! archs) + { + grub_file_close (file); +diff --git a/grub-core/mmap/mmap.c b/grub-core/mmap/mmap.c +index b569cb23b5a..64684c23d0d 100644 +--- a/grub-core/mmap/mmap.c ++++ b/grub-core/mmap/mmap.c +@@ -143,9 +143,9 @@ grub_mmap_iterate (grub_memory_hook_t hook, void *hook_data) + + /* Initialize variables. */ + ctx.scanline_events = (struct grub_mmap_scan *) +- grub_malloc (sizeof (struct grub_mmap_scan) * 2 * mmap_num); ++ grub_calloc (mmap_num, sizeof (struct grub_mmap_scan) * 2); + +- present = grub_zalloc (sizeof (present[0]) * current_priority); ++ present = grub_calloc (current_priority, sizeof (present[0])); + + if (! ctx.scanline_events || !present) + { +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index 2e46842e829..5a5ebbfb1aa 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -1629,7 +1629,7 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), + if (ncards == 0) + return grub_error (GRUB_ERR_NET_NO_CARD, N_("no network card found")); + +- ifaces = grub_zalloc (ncards * sizeof (ifaces[0])); ++ ifaces = grub_calloc (ncards, sizeof (ifaces[0])); + if (!ifaces) + return grub_errno; + +diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c +index 5d9afe093c0..e332d5eb4a4 100644 +--- a/grub-core/net/dns.c ++++ b/grub-core/net/dns.c +@@ -285,8 +285,8 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), + ptr++; + ptr += 4; + } +- *data->addresses = grub_malloc (sizeof ((*data->addresses)[0]) +- * grub_be_to_cpu16 (head->ancount)); ++ *data->addresses = grub_calloc (grub_be_to_cpu16 (head->ancount), ++ sizeof ((*data->addresses)[0])); + if (!*data->addresses) + { + grub_errno = GRUB_ERR_NONE; +@@ -406,8 +406,8 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), + dns_cache[h].addresses = 0; + dns_cache[h].name = grub_strdup (data->oname); + dns_cache[h].naddresses = *data->naddresses; +- dns_cache[h].addresses = grub_malloc (*data->naddresses +- * sizeof (dns_cache[h].addresses[0])); ++ dns_cache[h].addresses = grub_calloc (*data->naddresses, ++ sizeof (dns_cache[h].addresses[0])); + dns_cache[h].limit_time = grub_get_time_ms () + 1000 * ttl_all; + if (!dns_cache[h].addresses || !dns_cache[h].name) + { +@@ -479,7 +479,7 @@ grub_net_dns_lookup (const char *name, + } + } + +- sockets = grub_malloc (sizeof (sockets[0]) * n_servers); ++ sockets = grub_calloc (n_servers, sizeof (sockets[0])); + if (!sockets) + return grub_errno; + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 15073dde1c4..ad024c9ef7a 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -338,8 +338,8 @@ grub_cmd_ipv6_autoconf (struct grub_command *cmd __attribute__ ((unused)), + ncards++; + } + +- ifaces = grub_zalloc (ncards * sizeof (ifaces[0])); +- slaacs = grub_zalloc (ncards * sizeof (slaacs[0])); ++ ifaces = grub_calloc (ncards, sizeof (ifaces[0])); ++ slaacs = grub_calloc (ncards, sizeof (slaacs[0])); + if (!ifaces || !slaacs) + { + grub_free (ifaces); +diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c +index b0ab47d73fd..d57fb72faa8 100644 +--- a/grub-core/normal/charset.c ++++ b/grub-core/normal/charset.c +@@ -203,7 +203,7 @@ grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg, + { + grub_size_t msg_len = grub_strlen (msg); + +- *unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t)); ++ *unicode_msg = grub_calloc (msg_len, sizeof (grub_uint32_t)); + + if (!*unicode_msg) + return -1; +@@ -488,7 +488,7 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, + } + else + { +- n = grub_malloc (sizeof (n[0]) * (out->ncomb + 1)); ++ n = grub_calloc (out->ncomb + 1, sizeof (n[0])); + if (!n) + { + grub_errno = GRUB_ERR_NONE; +@@ -842,7 +842,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, + } \ + } + +- visual = grub_malloc (sizeof (visual[0]) * logical_len); ++ visual = grub_calloc (logical_len, sizeof (visual[0])); + if (!visual) + return -1; + +@@ -1165,8 +1165,8 @@ grub_bidi_logical_to_visual (const grub_uint32_t *logical, + { + const grub_uint32_t *line_start = logical, *ptr; + struct grub_unicode_glyph *visual_ptr; +- *visual_out = visual_ptr = grub_malloc (3 * sizeof (visual_ptr[0]) +- * (logical_len + 2)); ++ *visual_out = visual_ptr = grub_calloc (logical_len + 2, ++ 3 * sizeof (visual_ptr[0])); + if (!visual_ptr) + return -1; + for (ptr = logical; ptr <= logical + logical_len; ptr++) +diff --git a/grub-core/normal/cmdline.c b/grub-core/normal/cmdline.c +index c037d5050ed..c57242e2ea9 100644 +--- a/grub-core/normal/cmdline.c ++++ b/grub-core/normal/cmdline.c +@@ -41,7 +41,7 @@ grub_err_t + grub_set_history (int newsize) + { + grub_uint32_t **old_hist_lines = hist_lines; +- hist_lines = grub_malloc (sizeof (grub_uint32_t *) * newsize); ++ hist_lines = grub_calloc (newsize, sizeof (grub_uint32_t *)); + + /* Copy the old lines into the new buffer. */ + if (old_hist_lines) +@@ -114,7 +114,7 @@ static void + grub_history_set (int pos, grub_uint32_t *s, grub_size_t len) + { + grub_free (hist_lines[pos]); +- hist_lines[pos] = grub_malloc ((len + 1) * sizeof (grub_uint32_t)); ++ hist_lines[pos] = grub_calloc (len + 1, sizeof (grub_uint32_t)); + if (!hist_lines[pos]) + { + grub_print_error (); +@@ -349,7 +349,7 @@ grub_cmdline_get (const char *prompt_translated) + char *ret; + unsigned nterms; + +- buf = grub_malloc (max_len * sizeof (grub_uint32_t)); ++ buf = grub_calloc (max_len, sizeof (grub_uint32_t)); + if (!buf) + return 0; + +@@ -377,7 +377,7 @@ grub_cmdline_get (const char *prompt_translated) + FOR_ACTIVE_TERM_OUTPUTS(cur) + nterms++; + +- cl_terms = grub_malloc (sizeof (cl_terms[0]) * nterms); ++ cl_terms = grub_calloc (nterms, sizeof (cl_terms[0])); + if (!cl_terms) + { + grub_free (buf); +@@ -385,7 +385,7 @@ grub_cmdline_get (const char *prompt_translated) + } + cl_term_cur = cl_terms; + +- unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t)); ++ unicode_msg = grub_calloc (msg_len, sizeof (grub_uint32_t)); + if (!unicode_msg) + { + grub_free (buf); +@@ -495,7 +495,7 @@ grub_cmdline_get (const char *prompt_translated) + grub_uint32_t *insert; + + insertlen = grub_strlen (insertu8); +- insert = grub_malloc ((insertlen + 1) * sizeof (grub_uint32_t)); ++ insert = grub_calloc (insertlen + 1, sizeof (grub_uint32_t)); + if (!insert) + { + grub_free (insertu8); +@@ -602,7 +602,7 @@ grub_cmdline_get (const char *prompt_translated) + + grub_free (kill_buf); + +- kill_buf = grub_malloc ((n + 1) * sizeof(grub_uint32_t)); ++ kill_buf = grub_calloc (n + 1, sizeof (grub_uint32_t)); + if (grub_errno) + { + grub_print_error (); +diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c +index 5785f67ee1c..f31487c1f58 100644 +--- a/grub-core/normal/menu_entry.c ++++ b/grub-core/normal/menu_entry.c +@@ -95,8 +95,8 @@ init_line (struct screen *screen, struct line *linep) + { + linep->len = 0; + linep->max_len = 80; +- linep->buf = grub_malloc ((linep->max_len + 1) * sizeof (linep->buf[0])); +- linep->pos = grub_zalloc (screen->nterms * sizeof (linep->pos[0])); ++ linep->buf = grub_calloc (linep->max_len + 1, sizeof (linep->buf[0])); ++ linep->pos = grub_calloc (screen->nterms, sizeof (linep->pos[0])); + if (! linep->buf || !linep->pos) + { + grub_free (linep->buf); +@@ -287,7 +287,7 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen, + pos = linep->pos + (term_screen - screen->terms); + + if (!*pos) +- *pos = grub_zalloc ((linep->len + 1) * sizeof (**pos)); ++ *pos = grub_calloc (linep->len + 1, sizeof (**pos)); + + if (i == region_start || linep == screen->lines + screen->line + || (i > region_start && mode == ALL_LINES)) +@@ -471,7 +471,7 @@ insert_string (struct screen *screen, const char *s, int update) + + /* Insert the string. */ + current_linep = screen->lines + screen->line; +- unicode_msg = grub_malloc ((p - s) * sizeof (grub_uint32_t)); ++ unicode_msg = grub_calloc (p - s, sizeof (grub_uint32_t)); + + if (!unicode_msg) + return 0; +@@ -1023,7 +1023,7 @@ complete (struct screen *screen, int continuous, int update) + if (completion_buffer.buf) + { + buflen = grub_strlen (completion_buffer.buf); +- ucs4 = grub_malloc (sizeof (grub_uint32_t) * (buflen + 1)); ++ ucs4 = grub_calloc (buflen + 1, sizeof (grub_uint32_t)); + + if (!ucs4) + { +@@ -1265,7 +1265,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) + for (i = 0; i < (unsigned) screen->num_lines; i++) + { + grub_free (screen->lines[i].pos); +- screen->lines[i].pos = grub_zalloc (screen->nterms * sizeof (screen->lines[i].pos[0])); ++ screen->lines[i].pos = grub_calloc (screen->nterms, sizeof (screen->lines[i].pos[0])); + if (! screen->lines[i].pos) + { + grub_print_error (); +@@ -1275,7 +1275,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) + } + } + +- screen->terms = grub_zalloc (screen->nterms * sizeof (screen->terms[0])); ++ screen->terms = grub_calloc (screen->nterms, sizeof (screen->terms[0])); + if (!screen->terms) + { + grub_print_error (); +diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c +index 7681f7d2893..ca135624356 100644 +--- a/grub-core/normal/menu_text.c ++++ b/grub-core/normal/menu_text.c +@@ -78,7 +78,7 @@ grub_print_message_indented_real (const char *msg, int margin_left, + grub_size_t msg_len = grub_strlen (msg) + 2; + int ret = 0; + +- unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t)); ++ unicode_msg = grub_calloc (msg_len, sizeof (grub_uint32_t)); + + if (!unicode_msg) + return 0; +@@ -167,7 +167,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, + + title = entry ? entry->title : ""; + title_len = grub_strlen (title); +- unicode_title = grub_malloc (title_len * sizeof (*unicode_title)); ++ unicode_title = grub_calloc (title_len, sizeof (*unicode_title)); + if (! unicode_title) + /* XXX How to show this error? */ + return; +diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c +index a1e5c5a0daf..cc8c173b6e8 100644 +--- a/grub-core/normal/term.c ++++ b/grub-core/normal/term.c +@@ -264,7 +264,7 @@ grub_term_save_pos (void) + FOR_ACTIVE_TERM_OUTPUTS(cur) + cnt++; + +- ret = grub_malloc (cnt * sizeof (ret[0])); ++ ret = grub_calloc (cnt, sizeof (ret[0])); + if (!ret) + return NULL; + +@@ -1013,7 +1013,7 @@ grub_xnputs (const char *str, grub_size_t msg_len) + + grub_error_push (); + +- unicode_str = grub_malloc (msg_len * sizeof (grub_uint32_t)); ++ unicode_str = grub_calloc (msg_len, sizeof (grub_uint32_t)); + + grub_error_pop (); + +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index 36429a7cd25..f0c503f43d3 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -176,7 +176,7 @@ grub_util_raid_getmembers (const char *name, int bootable) + if (ret != 0) + grub_util_error (_("ioctl GET_ARRAY_INFO error: %s"), strerror (errno)); + +- devicelist = xmalloc ((info.nr_disks + 1) * sizeof (char *)); ++ devicelist = xcalloc (info.nr_disks + 1, sizeof (char *)); + + for (i = 0, j = 0; j < info.nr_disks; i++) + { +@@ -249,7 +249,7 @@ grub_find_root_devices_from_btrfs (const char *dir) + return NULL; + } + +- ret = xmalloc ((fsi.num_devices + 1) * sizeof (ret[0])); ++ ret = xcalloc (fsi.num_devices + 1, sizeof (ret[0])); + + for (i = 1; i <= fsi.max_id && j < fsi.num_devices; i++) + { +@@ -508,7 +508,7 @@ grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) + if (relroot) + *relroot = NULL; + +- entries = xmalloc (entry_max * sizeof (*entries)); ++ entries = xcalloc (entry_max, sizeof (*entries)); + + again: + fp = grub_util_fopen ("/proc/self/mountinfo", "r"); +diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c +index b637c58efb7..46a881530c0 100644 +--- a/grub-core/osdep/unix/config.c ++++ b/grub-core/osdep/unix/config.c +@@ -102,7 +102,7 @@ grub_util_load_config (struct grub_util_config *cfg) + argv[0] = "sh"; + argv[1] = "-c"; + +- script = xmalloc (4 * strlen (cfgfile) + 300); ++ script = xcalloc (4, strlen (cfgfile) + 300); + + ptr = script; + memcpy (ptr, ". '", 3); +diff --git a/grub-core/osdep/windows/getroot.c b/grub-core/osdep/windows/getroot.c +index 661d9546192..eada663b261 100644 +--- a/grub-core/osdep/windows/getroot.c ++++ b/grub-core/osdep/windows/getroot.c +@@ -59,7 +59,7 @@ grub_get_mount_point (const TCHAR *path) + + for (ptr = path; *ptr; ptr++); + allocsize = (ptr - path + 10) * 2; +- out = xmalloc (allocsize * sizeof (out[0])); ++ out = xcalloc (allocsize, sizeof (out[0])); + + /* When pointing to EFI system partition GetVolumePathName fails + for ESP root and returns abberant information for everything +diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c +index 87a106c9b82..29cf42788fe 100644 +--- a/grub-core/osdep/windows/hostdisk.c ++++ b/grub-core/osdep/windows/hostdisk.c +@@ -111,7 +111,7 @@ grub_util_get_windows_path_real (const char *path) + + while (1) + { +- fpa = xmalloc (alloc * sizeof (fpa[0])); ++ fpa = xcalloc (alloc, sizeof (fpa[0])); + + len = GetFullPathName (tpath, alloc, fpa, NULL); + if (len >= alloc) +@@ -405,7 +405,7 @@ grub_util_fd_opendir (const char *name) + for (l = 0; name_windows[l]; l++); + for (l--; l >= 0 && (name_windows[l] == '\\' || name_windows[l] == '/'); l--); + l++; +- pattern = xmalloc ((l + 3) * sizeof (pattern[0])); ++ pattern = xcalloc (l + 3, sizeof (pattern[0])); + memcpy (pattern, name_windows, l * sizeof (pattern[0])); + pattern[l] = '\\'; + pattern[l + 1] = '*'; +diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c +index e8ffd62c6a0..6297de6326a 100644 +--- a/grub-core/osdep/windows/init.c ++++ b/grub-core/osdep/windows/init.c +@@ -161,7 +161,7 @@ grub_util_host_init (int *argc __attribute__ ((unused)), + LPWSTR *targv; + + targv = CommandLineToArgvW (tcmdline, argc); +- *argv = xmalloc ((*argc + 1) * sizeof (argv[0])); ++ *argv = xcalloc (*argc + 1, sizeof (argv[0])); + + for (i = 0; i < *argc; i++) + (*argv)[i] = grub_util_tchar_to_utf8 (targv[i]); +diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c +index 7eb53fe01b4..1ef86bf5873 100644 +--- a/grub-core/osdep/windows/platform.c ++++ b/grub-core/osdep/windows/platform.c +@@ -225,8 +225,8 @@ grub_install_register_efi (grub_device_t efidir_grub_dev, + grub_util_error ("%s", _("no EFI routines are available when running in BIOS mode")); + + distrib8_len = grub_strlen (efi_distributor); +- distributor16 = xmalloc ((distrib8_len + 1) * GRUB_MAX_UTF16_PER_UTF8 +- * sizeof (grub_uint16_t)); ++ distributor16 = xcalloc (distrib8_len + 1, ++ GRUB_MAX_UTF16_PER_UTF8 * sizeof (grub_uint16_t)); + distrib16_len = grub_utf8_to_utf16 (distributor16, distrib8_len * GRUB_MAX_UTF16_PER_UTF8, + (const grub_uint8_t *) efi_distributor, + distrib8_len, 0); +diff --git a/grub-core/osdep/windows/relpath.c b/grub-core/osdep/windows/relpath.c +index cb0861744ae..478e8ef14d5 100644 +--- a/grub-core/osdep/windows/relpath.c ++++ b/grub-core/osdep/windows/relpath.c +@@ -72,7 +72,7 @@ grub_make_system_path_relative_to_its_root (const char *path) + if (dirwindows[0] && dirwindows[1] == ':') + offset = 2; + } +- ret = xmalloc (sizeof (ret[0]) * (flen - offset + 2)); ++ ret = xcalloc (flen - offset + 2, sizeof (ret[0])); + if (dirwindows[offset] != '\\' + && dirwindows[offset] != '/' + && dirwindows[offset]) +diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c +index 103f6796f39..72a2e37cd48 100644 +--- a/grub-core/partmap/gpt.c ++++ b/grub-core/partmap/gpt.c +@@ -199,7 +199,7 @@ gpt_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors, + *nsectors = ctx.len; + if (*nsectors > max_nsectors) + *nsectors = max_nsectors; +- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); ++ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); + if (!*sectors) + return grub_errno; + for (i = 0; i < *nsectors; i++) +diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c +index 7b8e4507625..ee3f24982b8 100644 +--- a/grub-core/partmap/msdos.c ++++ b/grub-core/partmap/msdos.c +@@ -337,7 +337,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors, + avail_nsectors = *nsectors; + if (*nsectors > max_nsectors) + *nsectors = max_nsectors; +- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); ++ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); + if (!*sectors) + return grub_errno; + for (i = 0; i < *nsectors; i++) +diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c +index c6d2c365c9a..b55e171c931 100644 +--- a/grub-core/script/execute.c ++++ b/grub-core/script/execute.c +@@ -587,7 +587,7 @@ gettext_append (struct grub_script_argv *result, const char *orig_str) + for (iptr = orig_str; *iptr; iptr++) + if (*iptr == '$') + dollar_cnt++; +- ctx.allowed_strings = grub_malloc (sizeof (ctx.allowed_strings[0]) * dollar_cnt); ++ ctx.allowed_strings = grub_calloc (dollar_cnt, sizeof (ctx.allowed_strings[0])); + + if (parse_string (orig_str, gettext_save_allow, &ctx, 0)) + goto fail; +diff --git a/grub-core/tests/fake_input.c b/grub-core/tests/fake_input.c +index 2d60852989c..b5eb516be2d 100644 +--- a/grub-core/tests/fake_input.c ++++ b/grub-core/tests/fake_input.c +@@ -49,7 +49,7 @@ grub_terminal_input_fake_sequence (int *seq_in, int nseq_in) + saved = grub_term_inputs; + if (seq) + grub_free (seq); +- seq = grub_malloc (nseq_in * sizeof (seq[0])); ++ seq = grub_calloc (nseq_in, sizeof (seq[0])); + if (!seq) + return; + +diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c +index 74d5b65e5c7..44d0810698a 100644 +--- a/grub-core/tests/video_checksum.c ++++ b/grub-core/tests/video_checksum.c +@@ -336,7 +336,7 @@ grub_video_capture_write_bmp (const char *fname, + { + case 4: + { +- grub_uint8_t *buffer = xmalloc (mode_info->width * 3); ++ grub_uint8_t *buffer = xcalloc (3, mode_info->width); + grub_uint32_t rmask = ((1 << mode_info->red_mask_size) - 1); + grub_uint32_t gmask = ((1 << mode_info->green_mask_size) - 1); + grub_uint32_t bmask = ((1 << mode_info->blue_mask_size) - 1); +@@ -367,7 +367,7 @@ grub_video_capture_write_bmp (const char *fname, + } + case 3: + { +- grub_uint8_t *buffer = xmalloc (mode_info->width * 3); ++ grub_uint8_t *buffer = xcalloc (3, mode_info->width); + grub_uint32_t rmask = ((1 << mode_info->red_mask_size) - 1); + grub_uint32_t gmask = ((1 << mode_info->green_mask_size) - 1); + grub_uint32_t bmask = ((1 << mode_info->blue_mask_size) - 1); +@@ -407,7 +407,7 @@ grub_video_capture_write_bmp (const char *fname, + } + case 2: + { +- grub_uint8_t *buffer = xmalloc (mode_info->width * 3); ++ grub_uint8_t *buffer = xcalloc (3, mode_info->width); + grub_uint16_t rmask = ((1 << mode_info->red_mask_size) - 1); + grub_uint16_t gmask = ((1 << mode_info->green_mask_size) - 1); + grub_uint16_t bmask = ((1 << mode_info->blue_mask_size) - 1); +diff --git a/grub-core/video/capture.c b/grub-core/video/capture.c +index 4f83c744116..4d3195e017b 100644 +--- a/grub-core/video/capture.c ++++ b/grub-core/video/capture.c +@@ -89,7 +89,7 @@ grub_video_capture_start (const struct grub_video_mode_info *mode_info, + framebuffer.mode_info = *mode_info; + framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info); + +- framebuffer.ptr = grub_malloc (framebuffer.mode_info.height * framebuffer.mode_info.pitch); ++ framebuffer.ptr = grub_calloc (framebuffer.mode_info.height, framebuffer.mode_info.pitch); + if (!framebuffer.ptr) + return grub_errno; + +diff --git a/grub-core/video/emu/sdl.c b/grub-core/video/emu/sdl.c +index a2f639f66de..0ebab6f57dd 100644 +--- a/grub-core/video/emu/sdl.c ++++ b/grub-core/video/emu/sdl.c +@@ -172,7 +172,7 @@ grub_video_sdl_set_palette (unsigned int start, unsigned int count, + if (start + count > mode_info.number_of_colors) + count = mode_info.number_of_colors - start; + +- tmp = grub_malloc (count * sizeof (tmp[0])); ++ tmp = grub_calloc (count, sizeof (tmp[0])); + for (i = 0; i < count; i++) + { + tmp[i].r = palette_data[i].r; +diff --git a/grub-core/video/i386/pc/vga.c b/grub-core/video/i386/pc/vga.c +index 01f47112d37..b2f776c997b 100644 +--- a/grub-core/video/i386/pc/vga.c ++++ b/grub-core/video/i386/pc/vga.c +@@ -127,7 +127,7 @@ grub_video_vga_setup (unsigned int width, unsigned int height, + + vga_height = height ? : 480; + +- framebuffer.temporary_buffer = grub_malloc (vga_height * VGA_WIDTH); ++ framebuffer.temporary_buffer = grub_calloc (vga_height, VGA_WIDTH); + framebuffer.front_page = 0; + framebuffer.back_page = 0; + if (!framebuffer.temporary_buffer) +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index 777e71334cb..61bd645379b 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -309,7 +309,7 @@ grub_png_decode_image_header (struct grub_png_data *data) + if (data->is_16bit || data->is_gray || data->is_palette) + #endif + { +- data->image_data = grub_malloc (data->image_height * data->row_bytes); ++ data->image_data = grub_calloc (data->image_height, data->row_bytes); + if (grub_errno) + return grub_errno; + +diff --git a/util/getroot.c b/util/getroot.c +index fa3460d6cd8..6feb2a4de40 100644 +--- a/util/getroot.c ++++ b/util/getroot.c +@@ -219,7 +219,7 @@ make_device_name (const char *drive) + char *ret, *ptr; + const char *iptr; + +- ret = xmalloc (strlen (drive) * 2); ++ ret = xcalloc (2, strlen (drive)); + ptr = ret; + for (iptr = drive; *iptr; iptr++) + { +diff --git a/util/grub-file.c b/util/grub-file.c +index 50c18b6835a..b2e7dd69f4c 100644 +--- a/util/grub-file.c ++++ b/util/grub-file.c +@@ -54,7 +54,7 @@ main (int argc, char *argv[]) + + grub_util_host_init (&argc, &argv); + +- argv2 = xmalloc (argc * sizeof (argv2[0])); ++ argv2 = xcalloc (argc, sizeof (argv2[0])); + + if (argc == 2 && strcmp (argv[1], "--version") == 0) + { +diff --git a/util/grub-fstest.c b/util/grub-fstest.c +index 39bad1f432f..bfcef852d83 100644 +--- a/util/grub-fstest.c ++++ b/util/grub-fstest.c +@@ -650,7 +650,7 @@ argp_parser (int key, char *arg, struct argp_state *state) + if (args_count < num_disks) + { + if (args_count == 0) +- images = xmalloc (num_disks * sizeof (images[0])); ++ images = xcalloc (num_disks, sizeof (images[0])); + images[args_count] = grub_canonicalize_file_name (arg); + args_count++; + return 0; +@@ -734,7 +734,7 @@ main (int argc, char *argv[]) + + grub_util_host_init (&argc, &argv); + +- args = xmalloc (argc * sizeof (args[0])); ++ args = xcalloc (argc, sizeof (args[0])); + + argp_parse (&argp, argc, argv, 0, 0, 0); + +diff --git a/util/grub-install-common.c b/util/grub-install-common.c +index ca0ac612ac5..0295d40f5e4 100644 +--- a/util/grub-install-common.c ++++ b/util/grub-install-common.c +@@ -286,7 +286,7 @@ handle_install_list (struct install_list *il, const char *val, + il->n_entries++; + } + il->n_alloc = il->n_entries + 1; +- il->entries = xmalloc (il->n_alloc * sizeof (il->entries[0])); ++ il->entries = xcalloc (il->n_alloc, sizeof (il->entries[0])); + ptr = val; + for (ce = il->entries; ; ce++) + { +diff --git a/util/grub-install.c b/util/grub-install.c +index 8b6a037903e..dddb7576c97 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -634,7 +634,7 @@ device_map_check_duplicates (const char *dev_map) + if (! fp) + return; + +- d = xmalloc (alloced * sizeof (d[0])); ++ d = xcalloc (alloced, sizeof (d[0])); + + while (fgets (buf, sizeof (buf), fp)) + { +@@ -1263,7 +1263,7 @@ main (int argc, char *argv[]) + ndev++; + } + +- grub_drives = xmalloc (sizeof (grub_drives[0]) * (ndev + 1)); ++ grub_drives = xcalloc (ndev + 1, sizeof (grub_drives[0])); + + for (curdev = grub_devices, curdrive = grub_drives; *curdev; curdev++, + curdrive++) +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index d16ec63a16f..52bc9c848d9 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -2294,10 +2294,8 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, + + grub_host_to_target16 (e->e_shstrndx) * smd.section_entsize); + smd.strtab = (char *) e + grub_host_to_target_addr (s->sh_offset); + +- smd.addrs = xmalloc (sizeof (*smd.addrs) * smd.num_sections); +- memset (smd.addrs, 0, sizeof (*smd.addrs) * smd.num_sections); +- smd.vaddrs = xmalloc (sizeof (*smd.vaddrs) * smd.num_sections); +- memset (smd.vaddrs, 0, sizeof (*smd.vaddrs) * smd.num_sections); ++ smd.addrs = xcalloc (smd.num_sections, sizeof (*smd.addrs)); ++ smd.vaddrs = xcalloc (smd.num_sections, sizeof (*smd.vaddrs)); + + SUFFIX (locate_sections) (e, kernel_path, &smd, layout, image_target); + +diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c +index ce2cbc4f100..51831027f72 100644 +--- a/util/grub-mkrescue.c ++++ b/util/grub-mkrescue.c +@@ -441,8 +441,8 @@ main (int argc, char *argv[]) + xorriso = xstrdup ("xorriso"); + label_font = grub_util_path_concat (2, pkgdatadir, "unicode.pf2"); + +- argp_argv = xmalloc (sizeof (argp_argv[0]) * argc); +- xorriso_tail_argv = xmalloc (sizeof (argp_argv[0]) * argc); ++ argp_argv = xcalloc (argc, sizeof (argp_argv[0])); ++ xorriso_tail_argv = xcalloc (argc, sizeof (argp_argv[0])); + + xorriso_tail_argc = 0; + /* Program name */ +diff --git a/util/grub-mkstandalone.c b/util/grub-mkstandalone.c +index 4907d44c0bd..edf309717c3 100644 +--- a/util/grub-mkstandalone.c ++++ b/util/grub-mkstandalone.c +@@ -296,7 +296,7 @@ main (int argc, char *argv[]) + grub_util_host_init (&argc, &argv); + grub_util_disable_fd_syncs (); + +- files = xmalloc ((argc + 1) * sizeof (files[0])); ++ files = xcalloc (argc + 1, sizeof (files[0])); + + argp_parse (&argp, argc, argv, 0, 0, 0); + +diff --git a/util/grub-pe2elf.c b/util/grub-pe2elf.c +index 0d4084a108e..11331294f1b 100644 +--- a/util/grub-pe2elf.c ++++ b/util/grub-pe2elf.c +@@ -100,9 +100,9 @@ write_section_data (FILE* fp, const char *name, char *image, + char *pe_strtab = (image + pe_chdr->symtab_offset + + pe_chdr->num_symbols * sizeof (struct grub_pe32_symbol)); + +- section_map = xmalloc ((2 * pe_chdr->num_sections + 5) * sizeof (int)); ++ section_map = xcalloc (2 * pe_chdr->num_sections + 5, sizeof (int)); + section_map[0] = 0; +- shdr = xmalloc ((2 * pe_chdr->num_sections + 5) * sizeof (shdr[0])); ++ shdr = xcalloc (2 * pe_chdr->num_sections + 5, sizeof (shdr[0])); + idx = 1; + idx_reloc = pe_chdr->num_sections + 1; + +@@ -233,7 +233,7 @@ write_reloc_section (FILE* fp, const char *name, char *image, + + pe_sec = pe_shdr + shdr[i].sh_link; + pe_rel = (struct grub_pe32_reloc *) (image + pe_sec->relocations_offset); +- rel = (elf_reloc_t *) xmalloc (pe_sec->num_relocations * sizeof (elf_reloc_t)); ++ rel = (elf_reloc_t *) xcalloc (pe_sec->num_relocations, sizeof (elf_reloc_t)); + num_rels = 0; + modified = 0; + +@@ -365,12 +365,10 @@ write_symbol_table (FILE* fp, const char *name, char *image, + pe_symtab = (struct grub_pe32_symbol *) (image + pe_chdr->symtab_offset); + pe_strtab = (char *) (pe_symtab + pe_chdr->num_symbols); + +- symtab = (Elf_Sym *) xmalloc ((pe_chdr->num_symbols + 1) * +- sizeof (Elf_Sym)); +- memset (symtab, 0, (pe_chdr->num_symbols + 1) * sizeof (Elf_Sym)); ++ symtab = (Elf_Sym *) xcalloc (pe_chdr->num_symbols + 1, sizeof (Elf_Sym)); + num_syms = 1; + +- symtab_map = (int *) xmalloc (pe_chdr->num_symbols * sizeof (int)); ++ symtab_map = (int *) xcalloc (pe_chdr->num_symbols, sizeof (int)); + + for (i = 0; i < (int) pe_chdr->num_symbols; + i += pe_symtab->num_aux + 1, pe_symtab += pe_symtab->num_aux + 1) +diff --git a/util/grub-probe.c b/util/grub-probe.c +index 7481e487211..cf4291c00a4 100644 +--- a/util/grub-probe.c ++++ b/util/grub-probe.c +@@ -361,8 +361,8 @@ probe (const char *path, char **device_names, char delim) + grub_util_pull_device (*curdev); + ndev++; + } +- +- drives_names = xmalloc (sizeof (drives_names[0]) * (ndev + 1)); ++ ++ drives_names = xcalloc (ndev + 1, sizeof (drives_names[0])); + + for (curdev = device_names, curdrive = drives_names; *curdev; curdev++, + curdrive++) +diff --git a/include/grub/unicode.h b/include/grub/unicode.h +index a0403e91f9a..4de986a8576 100644 +--- a/include/grub/unicode.h ++++ b/include/grub/unicode.h +@@ -293,7 +293,7 @@ grub_unicode_glyph_dup (const struct grub_unicode_glyph *in) + grub_memcpy (out, in, sizeof (*in)); + if (in->ncomb > ARRAY_SIZE (out->combining_inline)) + { +- out->combining_ptr = grub_malloc (in->ncomb * sizeof (out->combining_ptr[0])); ++ out->combining_ptr = grub_calloc (in->ncomb, sizeof (out->combining_ptr[0])); + if (!out->combining_ptr) + { + grub_free (out); +@@ -315,7 +315,7 @@ grub_unicode_set_glyph (struct grub_unicode_glyph *out, + grub_memcpy (out, in, sizeof (*in)); + if (in->ncomb > ARRAY_SIZE (out->combining_inline)) + { +- out->combining_ptr = grub_malloc (in->ncomb * sizeof (out->combining_ptr[0])); ++ out->combining_ptr = grub_calloc (in->ncomb, sizeof (out->combining_ptr[0])); + if (!out->combining_ptr) + return; + grub_memcpy (out->combining_ptr, in->combining_ptr, diff --git a/0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch b/0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch new file mode 100644 index 00000000..f840978e --- /dev/null +++ b/0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch @@ -0,0 +1,1320 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 15 Jun 2020 12:28:27 -0400 +Subject: [PATCH] malloc: Use overflow checking primitives where we do complex + allocations + +This attempts to fix the places where we do the following where +arithmetic_expr may include unvalidated data: + + X = grub_malloc(arithmetic_expr); + +It accomplishes this by doing the arithmetic ahead of time using grub_add(), +grub_sub(), grub_mul() and testing for overflow before proceeding. + +Among other issues, this fixes: + - allocation of integer overflow in grub_video_bitmap_create() + reported by Chris Coulson, + - allocation of integer overflow in grub_png_decode_image_header() + reported by Chris Coulson, + - allocation of integer overflow in grub_squash_read_symlink() + reported by Chris Coulson, + - allocation of integer overflow in grub_ext2_read_symlink() + reported by Chris Coulson, + - allocation of integer overflow in read_section_as_string() + reported by Chris Coulson. + +Fixes: CVE-2020-14309, CVE-2020-14310, CVE-2020-14311 + +Signed-off-by: Peter Jones +Reviewed-by: Daniel Kiper +Upstream-commit-id: 5fb2befbf04 +--- + grub-core/commands/legacycfg.c | 29 +++++++++++++++++++----- + grub-core/commands/wildcard.c | 36 ++++++++++++++++++++++++----- + grub-core/disk/ldm.c | 32 ++++++++++++++++++-------- + grub-core/font/font.c | 7 +++++- + grub-core/fs/btrfs.c | 28 +++++++++++++++-------- + grub-core/fs/ext2.c | 10 ++++++++- + grub-core/fs/iso9660.c | 51 +++++++++++++++++++++++++++++------------- + grub-core/fs/sfs.c | 27 +++++++++++++++++----- + grub-core/fs/squash4.c | 45 ++++++++++++++++++++++++++++--------- + grub-core/fs/udf.c | 41 +++++++++++++++++++++------------ + grub-core/fs/xfs.c | 11 +++++---- + grub-core/fs/zfs/zfs.c | 22 ++++++++++++------ + grub-core/fs/zfs/zfscrypt.c | 7 +++++- + grub-core/lib/arg.c | 20 +++++++++++++++-- + grub-core/loader/i386/bsd.c | 8 ++++++- + grub-core/net/dns.c | 9 +++++++- + grub-core/normal/charset.c | 10 +++++++-- + grub-core/normal/cmdline.c | 14 ++++++++++-- + grub-core/normal/menu_entry.c | 13 +++++++++-- + grub-core/script/argv.c | 16 +++++++++++-- + grub-core/script/lexer.c | 21 ++++++++++++++--- + grub-core/video/bitmap.c | 25 +++++++++++++-------- + grub-core/video/readers/png.c | 13 +++++++++-- + 23 files changed, 382 insertions(+), 113 deletions(-) + +diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c +index da5143d4360..782761c31aa 100644 +--- a/grub-core/commands/legacycfg.c ++++ b/grub-core/commands/legacycfg.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -104,13 +105,22 @@ legacy_file (const char *filename) + if (newsuffix) + { + char *t; +- ++ grub_size_t sz; ++ ++ if (grub_add (grub_strlen (suffix), grub_strlen (newsuffix), &sz) || ++ grub_add (sz, 1, &sz)) ++ { ++ grub_errno = GRUB_ERR_OUT_OF_RANGE; ++ goto fail_0; ++ } ++ + t = suffix; +- suffix = grub_realloc (suffix, grub_strlen (suffix) +- + grub_strlen (newsuffix) + 1); ++ suffix = grub_realloc (suffix, sz); + if (!suffix) + { + grub_free (t); ++ ++ fail_0: + grub_free (entrysrc); + grub_free (parsed); + grub_free (newsuffix); +@@ -154,13 +164,22 @@ legacy_file (const char *filename) + else + { + char *t; ++ grub_size_t sz; ++ ++ if (grub_add (grub_strlen (entrysrc), grub_strlen (parsed), &sz) || ++ grub_add (sz, 1, &sz)) ++ { ++ grub_errno = GRUB_ERR_OUT_OF_RANGE; ++ goto fail_1; ++ } + + t = entrysrc; +- entrysrc = grub_realloc (entrysrc, grub_strlen (entrysrc) +- + grub_strlen (parsed) + 1); ++ entrysrc = grub_realloc (entrysrc, sz); + if (!entrysrc) + { + grub_free (t); ++ ++ fail_1: + grub_free (parsed); + grub_free (suffix); + return grub_errno; +diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c +index 560d437cdc6..8f67a4be7f0 100644 +--- a/grub-core/commands/wildcard.c ++++ b/grub-core/commands/wildcard.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #include + +@@ -48,6 +49,7 @@ merge (char **dest, char **ps) + int i; + int j; + char **p; ++ grub_size_t sz; + + if (! dest) + return ps; +@@ -60,7 +62,12 @@ merge (char **dest, char **ps) + for (j = 0; ps[j]; j++) + ; + +- p = grub_realloc (dest, sizeof (char*) * (i + j + 1)); ++ if (grub_add (i, j, &sz) || ++ grub_add (sz, 1, &sz) || ++ grub_mul (sz, sizeof (char *), &sz)) ++ return dest; ++ ++ p = grub_realloc (dest, sz); + if (! p) + { + grub_free (dest); +@@ -115,8 +122,15 @@ make_regex (const char *start, const char *end, regex_t *regexp) + char ch; + int i = 0; + unsigned len = end - start; +- char *buffer = grub_malloc (len * 2 + 2 + 1); /* worst case size. */ ++ char *buffer; ++ grub_size_t sz; + ++ /* Worst case size is (len * 2 + 2 + 1). */ ++ if (grub_mul (len, 2, &sz) || ++ grub_add (sz, 3, &sz)) ++ return 1; ++ ++ buffer = grub_malloc (sz); + if (! buffer) + return 1; + +@@ -226,6 +240,7 @@ match_devices_iter (const char *name, void *data) + struct match_devices_ctx *ctx = data; + char **t; + char *buffer; ++ grub_size_t sz; + + /* skip partitions if asked to. */ + if (ctx->noparts && grub_strchr (name, ',')) +@@ -239,11 +254,16 @@ match_devices_iter (const char *name, void *data) + if (regexec (ctx->regexp, buffer, 0, 0, 0)) + { + grub_dprintf ("expand", "not matched\n"); ++ fail: + grub_free (buffer); + return 0; + } + +- t = grub_realloc (ctx->devs, sizeof (char*) * (ctx->ndev + 2)); ++ if (grub_add (ctx->ndev, 2, &sz) || ++ grub_mul (sz, sizeof (char *), &sz)) ++ goto fail; ++ ++ t = grub_realloc (ctx->devs, sz); + if (! t) + { + grub_free (buffer); +@@ -300,6 +320,7 @@ match_files_iter (const char *name, + struct match_files_ctx *ctx = data; + char **t; + char *buffer; ++ grub_size_t sz; + + /* skip . and .. names */ + if (grub_strcmp(".", name) == 0 || grub_strcmp("..", name) == 0) +@@ -315,9 +336,14 @@ match_files_iter (const char *name, + if (! buffer) + return 1; + +- t = grub_realloc (ctx->files, sizeof (char*) * (ctx->nfile + 2)); +- if (! t) ++ if (grub_add (ctx->nfile, 2, &sz) || ++ grub_mul (sz, sizeof (char *), &sz)) ++ goto fail; ++ ++ t = grub_realloc (ctx->files, sz); ++ if (!t) + { ++ fail: + grub_free (buffer); + return 1; + } +diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c +index e6323701ab3..58f8a53e1ab 100644 +--- a/grub-core/disk/ldm.c ++++ b/grub-core/disk/ldm.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #ifdef GRUB_UTIL + #include +@@ -289,6 +290,7 @@ make_vg (grub_disk_t disk, + struct grub_ldm_vblk vblk[GRUB_DISK_SECTOR_SIZE + / sizeof (struct grub_ldm_vblk)]; + unsigned i; ++ grub_size_t sz; + err = grub_disk_read (disk, cursec, 0, + sizeof(vblk), &vblk); + if (err) +@@ -350,7 +352,13 @@ make_vg (grub_disk_t disk, + grub_free (lv); + goto fail2; + } +- lv->name = grub_malloc (*ptr + 1); ++ if (grub_add (*ptr, 1, &sz)) ++ { ++ grub_free (lv->internal_id); ++ grub_free (lv); ++ goto fail2; ++ } ++ lv->name = grub_malloc (sz); + if (!lv->name) + { + grub_free (lv->internal_id); +@@ -599,10 +607,13 @@ make_vg (grub_disk_t disk, + if (lv->segments->node_alloc == lv->segments->node_count) + { + void *t; +- lv->segments->node_alloc *= 2; +- t = grub_realloc (lv->segments->nodes, +- sizeof (*lv->segments->nodes) +- * lv->segments->node_alloc); ++ grub_size_t sz; ++ ++ if (grub_mul (lv->segments->node_alloc, 2, &lv->segments->node_alloc) || ++ grub_mul (lv->segments->node_alloc, sizeof (*lv->segments->nodes), &sz)) ++ goto fail2; ++ ++ t = grub_realloc (lv->segments->nodes, sz); + if (!t) + goto fail2; + lv->segments->nodes = t; +@@ -723,10 +734,13 @@ make_vg (grub_disk_t disk, + if (comp->segment_alloc == comp->segment_count) + { + void *t; +- comp->segment_alloc *= 2; +- t = grub_realloc (comp->segments, +- comp->segment_alloc +- * sizeof (*comp->segments)); ++ grub_size_t sz; ++ ++ if (grub_mul (comp->segment_alloc, 2, &comp->segment_alloc) || ++ grub_mul (comp->segment_alloc, sizeof (*comp->segments), &sz)) ++ goto fail2; ++ ++ t = grub_realloc (comp->segments, sz); + if (!t) + goto fail2; + comp->segments = t; +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 8e118b315ce..5edb477ac2e 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -360,9 +361,13 @@ static char * + read_section_as_string (struct font_file_section *section) + { + char *str; ++ grub_size_t sz; + grub_ssize_t ret; + +- str = grub_malloc (section->length + 1); ++ if (grub_add (section->length, 1, &sz)) ++ return NULL; ++ ++ str = grub_malloc (sz); + if (!str) + return 0; + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index ba080fdc580..0d8c666aea1 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -44,6 +44,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -358,9 +359,13 @@ save_ref (struct grub_btrfs_leaf_descriptor *desc, + if (desc->allocated < desc->depth) + { + void *newdata; +- desc->allocated *= 2; +- newdata = grub_realloc (desc->data, sizeof (desc->data[0]) +- * desc->allocated); ++ grub_size_t sz; ++ ++ if (grub_mul (desc->allocated, 2, &desc->allocated) || ++ grub_mul (desc->allocated, sizeof (desc->data[0]), &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ ++ newdata = grub_realloc (desc->data, sz); + if (!newdata) + return grub_errno; + desc->data = newdata; +@@ -651,16 +656,21 @@ find_device (struct grub_btrfs_data *data, grub_uint64_t id) + if (data->n_devices_attached > data->n_devices_allocated) + { + void *tmp; +- data->n_devices_allocated = 2 * data->n_devices_attached + 1; +- data->devices_attached +- = grub_realloc (tmp = data->devices_attached, +- data->n_devices_allocated +- * sizeof (data->devices_attached[0])); ++ grub_size_t sz; ++ ++ if (grub_mul (data->n_devices_attached, 2, &data->n_devices_allocated) || ++ grub_add (data->n_devices_allocated, 1, &data->n_devices_allocated) || ++ grub_mul (data->n_devices_allocated, sizeof (data->devices_attached[0]), &sz)) ++ goto fail; ++ ++ data->devices_attached = grub_realloc (tmp = data->devices_attached, sz); + if (!data->devices_attached) + { ++ data->devices_attached = tmp; ++ ++ fail: + if (ctx.dev_found) + grub_device_close (ctx.dev_found); +- data->devices_attached = tmp; + return NULL; + } + } +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index 9b389802a35..ac33bcd68c4 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -46,6 +46,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -703,6 +704,7 @@ grub_ext2_read_symlink (grub_fshelp_node_t node) + { + char *symlink; + struct grub_fshelp_node *diro = node; ++ grub_size_t sz; + + if (! diro->inode_read) + { +@@ -717,7 +719,13 @@ grub_ext2_read_symlink (grub_fshelp_node_t node) + } + } + +- symlink = grub_malloc (grub_le_to_cpu32 (diro->inode.size) + 1); ++ if (grub_add (grub_le_to_cpu32 (diro->inode.size), 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ return NULL; ++ } ++ ++ symlink = grub_malloc (sz); + if (! symlink) + return 0; + +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index 4f1b52a552a..7ba5b300bc1 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -531,8 +532,13 @@ add_part (struct iterate_dir_ctx *ctx, + int len2) + { + int size = ctx->symlink ? grub_strlen (ctx->symlink) : 0; ++ grub_size_t sz; + +- ctx->symlink = grub_realloc (ctx->symlink, size + len2 + 1); ++ if (grub_add (size, len2, &sz) || ++ grub_add (sz, 1, &sz)) ++ return; ++ ++ ctx->symlink = grub_realloc (ctx->symlink, sz); + if (! ctx->symlink) + return; + +@@ -560,17 +566,24 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry, + { + grub_size_t off = 0, csize = 1; + char *old; ++ grub_size_t sz; ++ + csize = entry->len - 5; + old = ctx->filename; + if (ctx->filename_alloc) + { + off = grub_strlen (ctx->filename); +- ctx->filename = grub_realloc (ctx->filename, csize + off + 1); ++ if (grub_add (csize, off, &sz) || ++ grub_add (sz, 1, &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ ctx->filename = grub_realloc (ctx->filename, sz); + } + else + { + off = 0; +- ctx->filename = grub_zalloc (csize + 1); ++ if (grub_add (csize, 1, &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ ctx->filename = grub_zalloc (sz); + } + if (!ctx->filename) + { +@@ -776,14 +789,18 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir, + if (node->have_dirents >= node->alloc_dirents) + { + struct grub_fshelp_node *new_node; +- node->alloc_dirents *= 2; +- new_node = grub_realloc (node, +- sizeof (struct grub_fshelp_node) +- + ((node->alloc_dirents +- - ARRAY_SIZE (node->dirents)) +- * sizeof (node->dirents[0]))); ++ grub_size_t sz; ++ ++ if (grub_mul (node->alloc_dirents, 2, &node->alloc_dirents) || ++ grub_sub (node->alloc_dirents, ARRAY_SIZE (node->dirents), &sz) || ++ grub_mul (sz, sizeof (node->dirents[0]), &sz) || ++ grub_add (sz, sizeof (struct grub_fshelp_node), &sz)) ++ goto fail_0; ++ ++ new_node = grub_realloc (node, sz); + if (!new_node) + { ++ fail_0: + if (ctx.filename_alloc) + grub_free (ctx.filename); + grub_free (node); +@@ -799,14 +816,18 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir, + * sizeof (node->dirents[0]) < grub_strlen (ctx.symlink) + 1) + { + struct grub_fshelp_node *new_node; +- new_node = grub_realloc (node, +- sizeof (struct grub_fshelp_node) +- + ((node->alloc_dirents +- - ARRAY_SIZE (node->dirents)) +- * sizeof (node->dirents[0])) +- + grub_strlen (ctx.symlink) + 1); ++ grub_size_t sz; ++ ++ if (grub_sub (node->alloc_dirents, ARRAY_SIZE (node->dirents), &sz) || ++ grub_mul (sz, sizeof (node->dirents[0]), &sz) || ++ grub_add (sz, sizeof (struct grub_fshelp_node) + 1, &sz) || ++ grub_add (sz, grub_strlen (ctx.symlink), &sz)) ++ goto fail_1; ++ ++ new_node = grub_realloc (node, sz); + if (!new_node) + { ++ fail_1: + if (ctx.filename_alloc) + grub_free (ctx.filename); + grub_free (node); +diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c +index 90f7fb37918..de2b107a4a4 100644 +--- a/grub-core/fs/sfs.c ++++ b/grub-core/fs/sfs.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -307,10 +308,15 @@ grub_sfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + if (node->cache && node->cache_size >= node->cache_allocated) + { + struct cache_entry *e = node->cache; +- e = grub_realloc (node->cache,node->cache_allocated * 2 +- * sizeof (e[0])); ++ grub_size_t sz; ++ ++ if (grub_mul (node->cache_allocated, 2 * sizeof (e[0]), &sz)) ++ goto fail; ++ ++ e = grub_realloc (node->cache, sz); + if (!e) + { ++ fail: + grub_errno = 0; + grub_free (node->cache); + node->cache = 0; +@@ -477,10 +483,16 @@ grub_sfs_create_node (struct grub_fshelp_node **node, + grub_size_t len = grub_strlen (name); + grub_uint8_t *name_u8; + int ret; ++ grub_size_t sz; ++ ++ if (grub_mul (len, GRUB_MAX_UTF8_PER_LATIN1, &sz) || ++ grub_add (sz, 1, &sz)) ++ return 1; ++ + *node = grub_malloc (sizeof (**node)); + if (!*node) + return 1; +- name_u8 = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1); ++ name_u8 = grub_malloc (sz); + if (!name_u8) + { + grub_free (*node); +@@ -724,8 +736,13 @@ grub_sfs_label (grub_device_t device, char **label) + data = grub_sfs_mount (disk); + if (data) + { +- grub_size_t len = grub_strlen (data->label); +- *label = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1); ++ grub_size_t sz, len = grub_strlen (data->label); ++ ++ if (grub_mul (len, GRUB_MAX_UTF8_PER_LATIN1, &sz) || ++ grub_add (sz, 1, &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ ++ *label = grub_malloc (sz); + if (*label) + *grub_latin1_to_utf8 ((grub_uint8_t *) *label, + (const grub_uint8_t *) data->label, +diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c +index 95d5c1e1ff4..785123894e3 100644 +--- a/grub-core/fs/squash4.c ++++ b/grub-core/fs/squash4.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + + #include "xz.h" +@@ -459,7 +460,17 @@ grub_squash_read_symlink (grub_fshelp_node_t node) + { + char *ret; + grub_err_t err; +- ret = grub_malloc (grub_le_to_cpu32 (node->ino.symlink.namelen) + 1); ++ grub_size_t sz; ++ ++ if (grub_add (grub_le_to_cpu32 (node->ino.symlink.namelen), 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ return NULL; ++ } ++ ++ ret = grub_malloc (sz); ++ if (!ret) ++ return NULL; + + err = read_chunk (node->data, ret, + grub_le_to_cpu32 (node->ino.symlink.namelen), +@@ -506,11 +517,16 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, + + { + grub_fshelp_node_t node; +- node = grub_malloc (sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); ++ grub_size_t sz; ++ ++ if (grub_mul (dir->stsize, sizeof (dir->stack[0]), &sz) || ++ grub_add (sz, sizeof (*node), &sz)) ++ return 0; ++ ++ node = grub_malloc (sz); + if (!node) + return 0; +- grub_memcpy (node, dir, +- sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); ++ grub_memcpy (node, dir, sz); + if (hook (".", GRUB_FSHELP_DIR, node, hook_data)) + return 1; + +@@ -518,12 +534,15 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, + { + grub_err_t err; + +- node = grub_malloc (sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); ++ if (grub_mul (dir->stsize, sizeof (dir->stack[0]), &sz) || ++ grub_add (sz, sizeof (*node), &sz)) ++ return 0; ++ ++ node = grub_malloc (sz); + if (!node) + return 0; + +- grub_memcpy (node, dir, +- sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); ++ grub_memcpy (node, dir, sz); + + node->stsize--; + err = read_chunk (dir->data, &node->ino, sizeof (node->ino), +@@ -557,6 +576,7 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, + enum grub_fshelp_filetype filetype = GRUB_FSHELP_REG; + struct grub_squash_dirent di; + struct grub_squash_inode ino; ++ grub_size_t sz; + + err = read_chunk (dir->data, &di, sizeof (di), + grub_le_to_cpu64 (dir->data->sb.diroffset) +@@ -589,13 +609,16 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, + if (grub_le_to_cpu16 (di.type) == SQUASH_TYPE_SYMLINK) + filetype = GRUB_FSHELP_SYMLINK; + +- node = grub_malloc (sizeof (*node) +- + (dir->stsize + 1) * sizeof (dir->stack[0])); ++ if (grub_add (dir->stsize, 1, &sz) || ++ grub_mul (sz, sizeof (dir->stack[0]), &sz) || ++ grub_add (sz, sizeof (*node), &sz)) ++ return 0; ++ ++ node = grub_malloc (sz); + if (! node) + return 0; + +- grub_memcpy (node, dir, +- sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); ++ grub_memcpy (node, dir, sz - sizeof(dir->stack[0])); + + node->ino = ino; + node->stack[node->stsize].ino_chunk = grub_le_to_cpu32 (dh.ino_chunk); +diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c +index a83761674ad..21ac7f4460d 100644 +--- a/grub-core/fs/udf.c ++++ b/grub-core/fs/udf.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -890,9 +891,19 @@ read_string (const grub_uint8_t *raw, grub_size_t sz, char *outbuf) + utf16[i] = (raw[2 * i + 1] << 8) | raw[2*i + 2]; + } + if (!outbuf) +- outbuf = grub_malloc (utf16len * GRUB_MAX_UTF8_PER_UTF16 + 1); ++ { ++ grub_size_t size; ++ ++ if (grub_mul (utf16len, GRUB_MAX_UTF8_PER_UTF16, &size) || ++ grub_add (size, 1, &size)) ++ goto fail; ++ ++ outbuf = grub_malloc (size); ++ } + if (outbuf) + *grub_utf16_to_utf8 ((grub_uint8_t *) outbuf, utf16, utf16len) = '\0'; ++ ++ fail: + grub_free (utf16); + return outbuf; + } +@@ -1005,7 +1016,7 @@ grub_udf_read_symlink (grub_fshelp_node_t node) + grub_size_t sz = U64 (node->block.fe.file_size); + grub_uint8_t *raw; + const grub_uint8_t *ptr; +- char *out, *optr; ++ char *out = NULL, *optr; + + if (sz < 4) + return NULL; +@@ -1013,14 +1024,16 @@ grub_udf_read_symlink (grub_fshelp_node_t node) + if (!raw) + return NULL; + if (grub_udf_read_file (node, NULL, NULL, 0, sz, (char *) raw) < 0) +- { +- grub_free (raw); +- return NULL; +- } ++ goto fail_1; + +- out = grub_malloc (sz * 2 + 1); ++ if (grub_mul (sz, 2, &sz) || ++ grub_add (sz, 1, &sz)) ++ goto fail_0; ++ ++ out = grub_malloc (sz); + if (!out) + { ++ fail_0: + grub_free (raw); + return NULL; + } +@@ -1031,17 +1044,17 @@ grub_udf_read_symlink (grub_fshelp_node_t node) + { + grub_size_t s; + if ((grub_size_t) (ptr - raw + 4) > sz) +- goto fail; ++ goto fail_1; + if (!(ptr[2] == 0 && ptr[3] == 0)) +- goto fail; ++ goto fail_1; + s = 4 + ptr[1]; + if ((grub_size_t) (ptr - raw + s) > sz) +- goto fail; ++ goto fail_1; + switch (*ptr) + { + case 1: + if (ptr[1]) +- goto fail; ++ goto fail_1; + /* Fallthrough. */ + case 2: + /* in 4 bytes. out: 1 byte. */ +@@ -1066,11 +1079,11 @@ grub_udf_read_symlink (grub_fshelp_node_t node) + if (optr != out) + *optr++ = '/'; + if (!read_string (ptr + 4, s - 4, optr)) +- goto fail; ++ goto fail_1; + optr += grub_strlen (optr); + break; + default: +- goto fail; ++ goto fail_1; + } + ptr += s; + } +@@ -1078,7 +1091,7 @@ grub_udf_read_symlink (grub_fshelp_node_t node) + grub_free (raw); + return out; + +- fail: ++ fail_1: + grub_free (raw); + grub_free (out); + grub_error (GRUB_ERR_BAD_FS, "invalid symlink"); +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 96ffecbfc92..ea6590290b1 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -899,6 +900,7 @@ static struct grub_xfs_data * + grub_xfs_mount (grub_disk_t disk) + { + struct grub_xfs_data *data = 0; ++ grub_size_t sz; + + data = grub_zalloc (sizeof (struct grub_xfs_data)); + if (!data) +@@ -913,10 +915,11 @@ grub_xfs_mount (grub_disk_t disk) + if (!grub_xfs_sb_valid(data)) + goto fail; + +- data = grub_realloc (data, +- sizeof (struct grub_xfs_data) +- - sizeof (struct grub_xfs_inode) +- + grub_xfs_inode_size(data) + 1); ++ if (grub_add (grub_xfs_inode_size (data), ++ sizeof (struct grub_xfs_data) - sizeof (struct grub_xfs_inode) + 1, &sz)) ++ goto fail; ++ ++ data = grub_realloc (data, sz); + + if (! data) + goto fail; +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index 381dde556d1..36d0373a6a5 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -55,6 +55,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -773,11 +774,14 @@ fill_vdev_info (struct grub_zfs_data *data, + if (data->n_devices_attached > data->n_devices_allocated) + { + void *tmp; +- data->n_devices_allocated = 2 * data->n_devices_attached + 1; +- data->devices_attached +- = grub_realloc (tmp = data->devices_attached, +- data->n_devices_allocated +- * sizeof (data->devices_attached[0])); ++ grub_size_t sz; ++ ++ if (grub_mul (data->n_devices_attached, 2, &data->n_devices_allocated) || ++ grub_add (data->n_devices_allocated, 1, &data->n_devices_allocated) || ++ grub_mul (data->n_devices_allocated, sizeof (data->devices_attached[0]), &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ ++ data->devices_attached = grub_realloc (tmp = data->devices_attached, sz); + if (!data->devices_attached) + { + data->devices_attached = tmp; +@@ -3468,14 +3472,18 @@ grub_zfs_nvlist_lookup_nvlist (const char *nvlist, const char *name) + { + char *nvpair; + char *ret; +- grub_size_t size; ++ grub_size_t size, sz; + int found; + + found = nvlist_find_value (nvlist, name, DATA_TYPE_NVLIST, &nvpair, + &size, 0); + if (!found) + return 0; +- ret = grub_zalloc (size + 3 * sizeof (grub_uint32_t)); ++ ++ if (grub_add (size, 3 * sizeof (grub_uint32_t), &sz)) ++ return 0; ++ ++ ret = grub_zalloc (sz); + if (!ret) + return 0; + grub_memcpy (ret, nvlist, sizeof (grub_uint32_t)); +diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c +index 1402e0bc29b..de3b015f582 100644 +--- a/grub-core/fs/zfs/zfscrypt.c ++++ b/grub-core/fs/zfs/zfscrypt.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -82,9 +83,13 @@ grub_zfs_add_key (grub_uint8_t *key_in, + int passphrase) + { + struct grub_zfs_wrap_key *key; ++ grub_size_t sz; ++ + if (!passphrase && keylen > 32) + keylen = 32; +- key = grub_malloc (sizeof (*key) + keylen); ++ if (grub_add (sizeof (*key), keylen, &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ key = grub_malloc (sz); + if (!key) + return grub_errno; + key->is_passphrase = passphrase; +diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c +index ccc185017ee..8439a0062ff 100644 +--- a/grub-core/lib/arg.c ++++ b/grub-core/lib/arg.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + /* Built-in parser for default options. */ + static const struct grub_arg_option help_options[] = +@@ -216,7 +217,13 @@ static inline grub_err_t + add_arg (char ***argl, int *num, char *s) + { + char **p = *argl; +- *argl = grub_realloc (*argl, (++(*num) + 1) * sizeof (char *)); ++ grub_size_t sz; ++ ++ if (grub_add (++(*num), 1, &sz) || ++ grub_mul (sz, sizeof (char *), &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ ++ *argl = grub_realloc (*argl, sz); + if (! *argl) + { + grub_free (p); +@@ -431,6 +438,7 @@ grub_arg_list_alloc(grub_extcmd_t extcmd, int argc, + grub_size_t argcnt; + struct grub_arg_list *list; + const struct grub_arg_option *options; ++ grub_size_t sz0, sz1; + + options = extcmd->options; + if (! options) +@@ -443,7 +451,15 @@ grub_arg_list_alloc(grub_extcmd_t extcmd, int argc, + argcnt += ((grub_size_t) argc + 1) / 2 + 1; /* max possible for any option */ + } + +- list = grub_zalloc (sizeof (*list) * i + sizeof (char*) * argcnt); ++ if (grub_mul (sizeof (*list), i, &sz0) || ++ grub_mul (sizeof (char *), argcnt, &sz1) || ++ grub_add (sz0, sz1, &sz0)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ return 0; ++ } ++ ++ list = grub_zalloc (sz0); + if (! list) + return 0; + +diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c +index 50cca304fd0..ff98fb7b62b 100644 +--- a/grub-core/loader/i386/bsd.c ++++ b/grub-core/loader/i386/bsd.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + #include + #ifdef GRUB_MACHINE_PCBIOS + #include +@@ -1013,11 +1014,16 @@ grub_netbsd_add_modules (void) + struct grub_netbsd_btinfo_modules *mods; + unsigned i; + grub_err_t err; ++ grub_size_t sz; + + for (mod = netbsd_mods; mod; mod = mod->next) + modcnt++; + +- mods = grub_malloc (sizeof (*mods) + sizeof (mods->mods[0]) * modcnt); ++ if (grub_mul (modcnt, sizeof (mods->mods[0]), &sz) || ++ grub_add (sz, sizeof (*mods), &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ ++ mods = grub_malloc (sz); + if (!mods) + return grub_errno; + +diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c +index e332d5eb4a4..906ec7d6782 100644 +--- a/grub-core/net/dns.c ++++ b/grub-core/net/dns.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + struct dns_cache_element + { +@@ -51,9 +52,15 @@ grub_net_add_dns_server (const struct grub_net_network_level_address *s) + { + int na = dns_servers_alloc * 2; + struct grub_net_network_level_address *ns; ++ grub_size_t sz; ++ + if (na < 8) + na = 8; +- ns = grub_realloc (dns_servers, na * sizeof (ns[0])); ++ ++ if (grub_mul (na, sizeof (ns[0]), &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ ++ ns = grub_realloc (dns_servers, sz); + if (!ns) + return grub_errno; + dns_servers_alloc = na; +diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c +index d57fb72faa8..4dfcc31078d 100644 +--- a/grub-core/normal/charset.c ++++ b/grub-core/normal/charset.c +@@ -48,6 +48,7 @@ + #include + #include + #include ++#include + + #if HAVE_FONT_SOURCE + #include "widthspec.h" +@@ -464,6 +465,7 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, + { + struct grub_unicode_combining *n; + unsigned j; ++ grub_size_t sz; + + if (!haveout) + continue; +@@ -477,10 +479,14 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, + n = out->combining_inline; + else if (out->ncomb > (int) ARRAY_SIZE (out->combining_inline)) + { +- n = grub_realloc (out->combining_ptr, +- sizeof (n[0]) * (out->ncomb + 1)); ++ if (grub_add (out->ncomb, 1, &sz) || ++ grub_mul (sz, sizeof (n[0]), &sz)) ++ goto fail; ++ ++ n = grub_realloc (out->combining_ptr, sz); + if (!n) + { ++ fail: + grub_errno = GRUB_ERR_NONE; + continue; + } +diff --git a/grub-core/normal/cmdline.c b/grub-core/normal/cmdline.c +index c57242e2ea9..de03fe63b3d 100644 +--- a/grub-core/normal/cmdline.c ++++ b/grub-core/normal/cmdline.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + static grub_uint32_t *kill_buf; + +@@ -307,12 +308,21 @@ cl_insert (struct cmdline_term *cl_terms, unsigned nterms, + if (len + (*llen) >= (*max_len)) + { + grub_uint32_t *nbuf; +- (*max_len) *= 2; +- nbuf = grub_realloc ((*buf), sizeof (grub_uint32_t) * (*max_len)); ++ grub_size_t sz; ++ ++ if (grub_mul (*max_len, 2, max_len) || ++ grub_mul (*max_len, sizeof (grub_uint32_t), &sz)) ++ { ++ grub_errno = GRUB_ERR_OUT_OF_RANGE; ++ goto fail; ++ } ++ ++ nbuf = grub_realloc ((*buf), sz); + if (nbuf) + (*buf) = nbuf; + else + { ++ fail: + grub_print_error (); + grub_errno = GRUB_ERR_NONE; + (*max_len) /= 2; +diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c +index f31487c1f58..de64a367c4e 100644 +--- a/grub-core/normal/menu_entry.c ++++ b/grub-core/normal/menu_entry.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + enum update_mode + { +@@ -113,10 +114,18 @@ ensure_space (struct line *linep, int extra) + { + if (linep->max_len < linep->len + extra) + { +- linep->max_len = 2 * (linep->len + extra); +- linep->buf = grub_realloc (linep->buf, (linep->max_len + 1) * sizeof (linep->buf[0])); ++ grub_size_t sz0, sz1; ++ ++ if (grub_add (linep->len, extra, &sz0) || ++ grub_mul (sz0, 2, &sz0) || ++ grub_add (sz0, 1, &sz1) || ++ grub_mul (sz1, sizeof (linep->buf[0]), &sz1)) ++ return 0; ++ ++ linep->buf = grub_realloc (linep->buf, sz1); + if (! linep->buf) + return 0; ++ linep->max_len = sz0; + } + + return 1; +diff --git a/grub-core/script/argv.c b/grub-core/script/argv.c +index 217ec5d1e1b..5751fdd5708 100644 +--- a/grub-core/script/argv.c ++++ b/grub-core/script/argv.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + /* Return nearest power of two that is >= v. */ + static unsigned +@@ -81,11 +82,16 @@ int + grub_script_argv_next (struct grub_script_argv *argv) + { + char **p = argv->args; ++ grub_size_t sz; + + if (argv->args && argv->argc && argv->args[argv->argc - 1] == 0) + return 0; + +- p = grub_realloc (p, round_up_exp ((argv->argc + 2) * sizeof (char *))); ++ if (grub_add (argv->argc, 2, &sz) || ++ grub_mul (sz, sizeof (char *), &sz)) ++ return 1; ++ ++ p = grub_realloc (p, round_up_exp (sz)); + if (! p) + return 1; + +@@ -105,13 +111,19 @@ grub_script_argv_append (struct grub_script_argv *argv, const char *s, + { + grub_size_t a; + char *p = argv->args[argv->argc - 1]; ++ grub_size_t sz; + + if (! s) + return 0; + + a = p ? grub_strlen (p) : 0; + +- p = grub_realloc (p, round_up_exp ((a + slen + 1) * sizeof (char))); ++ if (grub_add (a, slen, &sz) || ++ grub_add (sz, 1, &sz) || ++ grub_mul (sz, sizeof (char), &sz)) ++ return 1; ++ ++ p = grub_realloc (p, round_up_exp (sz)); + if (! p) + return 1; + +diff --git a/grub-core/script/lexer.c b/grub-core/script/lexer.c +index c6bd3172fab..5fb0cbd0bc9 100644 +--- a/grub-core/script/lexer.c ++++ b/grub-core/script/lexer.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #define yytext_ptr char * + #include "grub_script.tab.h" +@@ -110,10 +111,14 @@ grub_script_lexer_record (struct grub_parser_param *parser, char *str) + old = lexer->recording; + if (lexer->recordlen < len) + lexer->recordlen = len; +- lexer->recordlen *= 2; ++ ++ if (grub_mul (lexer->recordlen, 2, &lexer->recordlen)) ++ goto fail; ++ + lexer->recording = grub_realloc (lexer->recording, lexer->recordlen); + if (!lexer->recording) + { ++ fail: + grub_free (old); + lexer->recordpos = 0; + lexer->recordlen = 0; +@@ -130,7 +135,7 @@ int + grub_script_lexer_yywrap (struct grub_parser_param *parserstate, + const char *input) + { +- grub_size_t len = 0; ++ grub_size_t len = 0, sz; + char *p = 0; + char *line = 0; + YY_BUFFER_STATE buffer; +@@ -168,12 +173,22 @@ grub_script_lexer_yywrap (struct grub_parser_param *parserstate, + } + else if (len && line[len - 1] != '\n') + { +- p = grub_realloc (line, len + 2); ++ if (grub_add (len, 2, &sz)) ++ { ++ grub_free (line); ++ grub_script_yyerror (parserstate, N_("overflow is detected")); ++ return 1; ++ } ++ ++ p = grub_realloc (line, sz); + if (p) + { + p[len++] = '\n'; + p[len] = '\0'; + } ++ else ++ grub_free (line); ++ + line = p; + } + +diff --git a/grub-core/video/bitmap.c b/grub-core/video/bitmap.c +index b2e0315665b..6256e209a6b 100644 +--- a/grub-core/video/bitmap.c ++++ b/grub-core/video/bitmap.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -58,7 +59,7 @@ grub_video_bitmap_create (struct grub_video_bitmap **bitmap, + enum grub_video_blit_format blit_format) + { + struct grub_video_mode_info *mode_info; +- unsigned int size; ++ grub_size_t size; + + if (!bitmap) + return grub_error (GRUB_ERR_BUG, "invalid argument"); +@@ -137,19 +138,25 @@ grub_video_bitmap_create (struct grub_video_bitmap **bitmap, + + mode_info->pitch = width * mode_info->bytes_per_pixel; + +- /* Calculate size needed for the data. */ +- size = (width * mode_info->bytes_per_pixel) * height; ++ /* Calculate size needed for the data. */ ++ if (grub_mul (width, mode_info->bytes_per_pixel, &size) || ++ grub_mul (size, height, &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ goto fail; ++ } + + (*bitmap)->data = grub_zalloc (size); + if (! (*bitmap)->data) +- { +- grub_free (*bitmap); +- *bitmap = 0; +- +- return grub_errno; +- } ++ goto fail; + + return GRUB_ERR_NONE; ++ ++ fail: ++ grub_free (*bitmap); ++ *bitmap = NULL; ++ ++ return grub_errno; + } + + /* Frees all resources allocated by bitmap. */ +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index 61bd645379b..0157ff7420b 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -301,9 +302,17 @@ grub_png_decode_image_header (struct grub_png_data *data) + data->bpp <<= 1; + + data->color_bits = color_bits; +- data->row_bytes = data->image_width * data->bpp; ++ ++ if (grub_mul (data->image_width, data->bpp, &data->row_bytes)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ + if (data->color_bits <= 4) +- data->row_bytes = (data->image_width * data->color_bits + 7) / 8; ++ { ++ if (grub_mul (data->image_width, data->color_bits + 7, &data->row_bytes)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ ++ data->row_bytes >>= 3; ++ } + + #ifndef GRUB_CPU_WORDS_BIGENDIAN + if (data->is_16bit || data->is_gray || data->is_palette) diff --git a/0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch b/0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch new file mode 100644 index 00000000..8ec24bde --- /dev/null +++ b/0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sat, 4 Jul 2020 12:25:09 -0400 +Subject: [PATCH] iso9660: Don't leak memory on realloc() failures + +Signed-off-by: Peter Jones +Reviewed-by: Daniel Kiper +Upstream-commit-id: f2bd30b2fe7 +--- + grub-core/fs/iso9660.c | 24 ++++++++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) + +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index 7ba5b300bc1..5ec4433b8f8 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -533,14 +533,20 @@ add_part (struct iterate_dir_ctx *ctx, + { + int size = ctx->symlink ? grub_strlen (ctx->symlink) : 0; + grub_size_t sz; ++ char *new; + + if (grub_add (size, len2, &sz) || + grub_add (sz, 1, &sz)) + return; + +- ctx->symlink = grub_realloc (ctx->symlink, sz); +- if (! ctx->symlink) +- return; ++ new = grub_realloc (ctx->symlink, sz); ++ if (!new) ++ { ++ grub_free (ctx->symlink); ++ ctx->symlink = NULL; ++ return; ++ } ++ ctx->symlink = new; + + grub_memcpy (ctx->symlink + size, part, len2); + ctx->symlink[size + len2] = 0; +@@ -634,7 +640,12 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry, + is the length. Both are part of the `Component + Record'. */ + if (ctx->symlink && !ctx->was_continue) +- add_part (ctx, "/", 1); ++ { ++ add_part (ctx, "/", 1); ++ if (grub_errno) ++ return grub_errno; ++ } ++ + add_part (ctx, (char *) &entry->data[pos + 2], + entry->data[pos + 1]); + ctx->was_continue = (entry->data[pos] & 1); +@@ -653,6 +664,11 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry, + add_part (ctx, "/", 1); + break; + } ++ ++ /* Check if grub_realloc() failed in add_part(). */ ++ if (grub_errno) ++ return grub_errno; ++ + /* In pos + 1 the length of the `Component Record' is + stored. */ + pos += entry->data[pos + 1] + 2; diff --git a/0231-font-Do-not-load-more-than-one-NAME-section.patch b/0231-font-Do-not-load-more-than-one-NAME-section.patch new file mode 100644 index 00000000..a1da6296 --- /dev/null +++ b/0231-font-Do-not-load-more-than-one-NAME-section.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Kiper +Date: Tue, 7 Jul 2020 15:36:26 +0200 +Subject: [PATCH] font: Do not load more than one NAME section + +The GRUB font file can have one NAME section only. Though if somebody +crafts a broken font file with many NAME sections and loads it then the +GRUB leaks memory. So, prevent against that by loading first NAME +section and failing in controlled way on following one. + +Reported-by: Chris Coulson +Signed-off-by: Daniel Kiper +Reviewed-by: Jan Setje-Eilers +Upstream-commit-id: 482814113dc +--- + grub-core/font/font.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 5edb477ac2e..d09bb38d896 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -532,6 +532,12 @@ grub_font_load (const char *filename) + if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FONT_NAME, + sizeof (FONT_FORMAT_SECTION_NAMES_FONT_NAME) - 1) == 0) + { ++ if (font->name != NULL) ++ { ++ grub_error (GRUB_ERR_BAD_FONT, "invalid font file: too many NAME sections"); ++ goto fail; ++ } ++ + font->name = read_section_as_string (§ion); + if (!font->name) + goto fail; diff --git a/0232-gfxmenu-Fix-double-free-in-load_image.patch b/0232-gfxmenu-Fix-double-free-in-load_image.patch new file mode 100644 index 00000000..97416b95 --- /dev/null +++ b/0232-gfxmenu-Fix-double-free-in-load_image.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Makhalov +Date: Wed, 8 Jul 2020 20:41:56 +0000 +Subject: [PATCH] gfxmenu: Fix double free in load_image() + +self->bitmap should be zeroed after free. Otherwise, there is a chance +to double free (USE_AFTER_FREE) it later in rescale_image(). + +Fixes: CID 292472 + +Signed-off-by: Alexey Makhalov +Reviewed-by: Daniel Kiper +Upstream-commit-id: 5d3e84b15a4 +--- + grub-core/gfxmenu/gui_image.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/grub-core/gfxmenu/gui_image.c b/grub-core/gfxmenu/gui_image.c +index 29784ed2d9a..6b2e976f16e 100644 +--- a/grub-core/gfxmenu/gui_image.c ++++ b/grub-core/gfxmenu/gui_image.c +@@ -195,7 +195,10 @@ load_image (grub_gui_image_t self, const char *path) + return grub_errno; + + if (self->bitmap && (self->bitmap != self->raw_bitmap)) +- grub_video_bitmap_destroy (self->bitmap); ++ { ++ grub_video_bitmap_destroy (self->bitmap); ++ self->bitmap = 0; ++ } + if (self->raw_bitmap) + grub_video_bitmap_destroy (self->raw_bitmap); + diff --git a/0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch b/0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch new file mode 100644 index 00000000..235376b0 --- /dev/null +++ b/0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Makhalov +Date: Wed, 8 Jul 2020 21:30:43 +0000 +Subject: [PATCH] xnu: Fix double free in grub_xnu_devprop_add_property() + +grub_xnu_devprop_add_property() should not free utf8 and utf16 as it get +allocated and freed in the caller. + +Minor improvement: do prop fields initialization after memory allocations. + +Fixes: CID 292442, CID 292457, CID 292460, CID 292466 + +Signed-off-by: Alexey Makhalov +Reviewed-by: Daniel Kiper +Upstream-commit-id: 4d5e2d13519 +--- + grub-core/loader/i386/xnu.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c +index b7d176b5d30..e9e11925972 100644 +--- a/grub-core/loader/i386/xnu.c ++++ b/grub-core/loader/i386/xnu.c +@@ -262,20 +262,19 @@ grub_xnu_devprop_add_property (struct grub_xnu_devprop_device_descriptor *dev, + if (!prop) + return grub_errno; + ++ prop->data = grub_malloc (datalen); ++ if (!prop->data) ++ { ++ grub_free (prop); ++ return grub_errno; ++ } ++ grub_memcpy (prop->data, data, datalen); ++ + prop->name = utf8; + prop->name16 = utf16; + prop->name16len = utf16len; +- + prop->length = datalen; +- prop->data = grub_malloc (prop->length); +- if (!prop->data) +- { +- grub_free (prop->name); +- grub_free (prop->name16); +- grub_free (prop); +- return grub_errno; +- } +- grub_memcpy (prop->data, data, prop->length); ++ + grub_list_push (GRUB_AS_LIST_P (&dev->properties), + GRUB_AS_LIST (prop)); + return GRUB_ERR_NONE; diff --git a/0234-lzma-Make-sure-we-don-t-dereference-past-array.patch b/0234-lzma-Make-sure-we-don-t-dereference-past-array.patch new file mode 100644 index 00000000..d5a31f5d --- /dev/null +++ b/0234-lzma-Make-sure-we-don-t-dereference-past-array.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Konrad Rzeszutek Wilk +Date: Thu, 9 Jul 2020 03:05:23 +0000 +Subject: [PATCH] lzma: Make sure we don't dereference past array + +The two dimensional array p->posSlotEncoder[4][64] is being dereferenced +using the GetLenToPosState() macro which checks if len is less than 5, +and if so subtracts 2 from it. If len = 0, that is 0 - 2 = 4294967294. +Obviously we don't want to dereference that far out so we check if the +position found is greater or equal kNumLenToPosStates (4) and bail out. + +N.B.: Upstream LZMA 18.05 and later has this function completely rewritten +without any history. + +Fixes: CID 51526 + +Signed-off-by: Konrad Rzeszutek Wilk +Reviewed-by: Daniel Kiper +Upstream-commit-id: f91e043bda4 +--- + grub-core/lib/LzmaEnc.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/grub-core/lib/LzmaEnc.c b/grub-core/lib/LzmaEnc.c +index f2ec04a8c28..753e56a95e3 100644 +--- a/grub-core/lib/LzmaEnc.c ++++ b/grub-core/lib/LzmaEnc.c +@@ -1877,13 +1877,19 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize + } + else + { +- UInt32 posSlot; ++ UInt32 posSlot, lenToPosState; + RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); + p->state = kMatchNextStates[p->state]; + LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); + pos -= LZMA_NUM_REPS; + GetPosSlot(pos, posSlot); +- RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); ++ lenToPosState = GetLenToPosState(len); ++ if (lenToPosState >= kNumLenToPosStates) ++ { ++ p->result = SZ_ERROR_DATA; ++ return CheckErrors(p); ++ } ++ RcTree_Encode(&p->rc, p->posSlotEncoder[lenToPosState], kNumPosSlotBits, posSlot); + + if (posSlot >= kStartPosModelIndex) + { diff --git a/0235-term-Fix-overflow-on-user-inputs.patch b/0235-term-Fix-overflow-on-user-inputs.patch new file mode 100644 index 00000000..b381e450 --- /dev/null +++ b/0235-term-Fix-overflow-on-user-inputs.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Konrad Rzeszutek Wilk +Date: Tue, 7 Jul 2020 15:12:25 -0400 +Subject: [PATCH] term: Fix overflow on user inputs + +This requires a very weird input from the serial interface but can cause +an overflow in input_buf (keys) overwriting the next variable (npending) +with the user choice: + +(pahole output) + +struct grub_terminfo_input_state { + int input_buf[6]; /* 0 24 */ + int npending; /* 24 4 */ <- CORRUPT + ...snip... + +The magic string requires causing this is "ESC,O,],0,1,2,q" and we overflow +npending with "q" (aka increase npending to 161). The simplest fix is to +just to disallow overwrites input_buf, which exactly what this patch does. + +Fixes: CID 292449 + +Signed-off-by: Konrad Rzeszutek Wilk +Reviewed-by: Daniel Kiper +Upstream-commit-id: 98dfa546777 +--- + grub-core/term/terminfo.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c +index 537a5c0cb0b..44d0b3b19fb 100644 +--- a/grub-core/term/terminfo.c ++++ b/grub-core/term/terminfo.c +@@ -398,7 +398,7 @@ grub_terminfo_getwh (struct grub_term_output *term) + } + + static void +-grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, ++grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, int max_len, + int (*readkey) (struct grub_term_input *term)) + { + int c; +@@ -414,6 +414,9 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, + if (c == -1) \ + return; \ + \ ++ if (*len >= max_len) \ ++ return; \ ++ \ + keys[*len] = c; \ + (*len)++; \ + } +@@ -602,8 +605,8 @@ grub_terminfo_getkey (struct grub_term_input *termi) + return ret; + } + +- grub_terminfo_readkey (termi, data->input_buf, +- &data->npending, data->readkey); ++ grub_terminfo_readkey (termi, data->input_buf, &data->npending, ++ GRUB_TERMINFO_READKEY_MAX_LEN, data->readkey); + + #if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275) + if (data->npending == 1 && data->input_buf[0] == GRUB_TERM_ESC diff --git a/0236-udf-Fix-memory-leak.patch b/0236-udf-Fix-memory-leak.patch new file mode 100644 index 00000000..6b8f0922 --- /dev/null +++ b/0236-udf-Fix-memory-leak.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Konrad Rzeszutek Wilk +Date: Tue, 7 Jul 2020 22:02:31 -0400 +Subject: [PATCH] udf: Fix memory leak + +Fixes: CID 73796 + +Signed-off-by: Konrad Rzeszutek Wilk +Reviewed-by: Daniel Kiper +Reviewed-by: Jan Setje-Eilers +Upstream-commit-id: 8da62d8183c +--- + grub-core/fs/udf.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c +index 21ac7f4460d..2ac5c1d0048 100644 +--- a/grub-core/fs/udf.c ++++ b/grub-core/fs/udf.c +@@ -965,8 +965,10 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir, + return 0; + + if (grub_udf_read_icb (dir->data, &dirent.icb, child)) +- return 0; +- ++ { ++ grub_free (child); ++ return 0; ++ } + if (dirent.characteristics & GRUB_UDF_FID_CHAR_PARENT) + { + /* This is the parent directory. */ +@@ -988,11 +990,18 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir, + dirent.file_ident_length, + (char *) raw)) + != dirent.file_ident_length) +- return 0; ++ { ++ grub_free (child); ++ return 0; ++ } + + filename = read_string (raw, dirent.file_ident_length, 0); + if (!filename) +- grub_print_error (); ++ { ++ /* As the hook won't get called. */ ++ grub_free (child); ++ grub_print_error (); ++ } + + if (filename && hook (filename, type, child, hook_data)) + { diff --git a/0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch b/0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch new file mode 100644 index 00000000..18c0a499 --- /dev/null +++ b/0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Konrad Rzeszutek Wilk +Date: Fri, 26 Jun 2020 10:51:43 -0400 +Subject: [PATCH] multiboot2: Fix memory leak if grub_create_loader_cmdline() + fails + +Fixes: CID 292468 + +Signed-off-by: Konrad Rzeszutek Wilk +Reviewed-by: Daniel Kiper +Upstream-commit-id: cd6760b6289 +--- + grub-core/loader/multiboot_mbi2.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c +index 53da7861516..0efc660620e 100644 +--- a/grub-core/loader/multiboot_mbi2.c ++++ b/grub-core/loader/multiboot_mbi2.c +@@ -1070,7 +1070,11 @@ grub_multiboot2_add_module (grub_addr_t start, grub_size_t size, + err = grub_create_loader_cmdline (argc, argv, newmod->cmdline, + newmod->cmdline_size, GRUB_VERIFY_MODULE_CMDLINE); + if (err) +- return err; ++ { ++ grub_free (newmod->cmdline); ++ grub_free (newmod); ++ return err; ++ } + + if (modules_last) + modules_last->next = newmod; diff --git a/0238-tftp-Do-not-use-priority-queue.patch b/0238-tftp-Do-not-use-priority-queue.patch new file mode 100644 index 00000000..59160d9a --- /dev/null +++ b/0238-tftp-Do-not-use-priority-queue.patch @@ -0,0 +1,278 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Makhalov +Date: Thu, 9 Jul 2020 08:10:40 +0000 +Subject: [PATCH] tftp: Do not use priority queue + +There is not need to reassemble the order of blocks. Per RFC 1350, +server must wait for the ACK, before sending next block. Data packets +can be served immediately without putting them to priority queue. + +Logic to handle incoming packet is this: + - if packet block id equal to expected block id, then + process the packet, + - if packet block id is less than expected - this is retransmit + of old packet, then ACK it and drop the packet, + - if packet block id is more than expected - that shouldn't + happen, just drop the packet. + +It makes the tftp receive path code simpler, smaller and faster. +As a benefit, this change fixes CID# 73624 and CID# 96690, caused +by following while loop: + + while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0) + +where tftph pointer is not moving from one iteration to another, causing +to serve same packet again. Luckily, double serving didn't happen due to +data->block++ during the first iteration. + +Fixes: CID 73624, CID 96690 + +Signed-off-by: Alexey Makhalov +Reviewed-by: Daniel Kiper +Upstream-commit-id: 8316694c4f7 +--- + grub-core/net/tftp.c | 162 ++++++++++++++++----------------------------------- + 1 file changed, 50 insertions(+), 112 deletions(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index e267af354f4..c2df3d7f6ab 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -25,7 +25,6 @@ + #include + #include + #include +-#include + #include + + GRUB_MOD_LICENSE ("GPLv3+"); +@@ -106,31 +105,8 @@ typedef struct tftp_data + int have_oack; + struct grub_error_saved save_err; + grub_net_udp_socket_t sock; +- grub_priority_queue_t pq; + } *tftp_data_t; + +-static int +-cmp_block (grub_uint16_t a, grub_uint16_t b) +-{ +- grub_int16_t i = (grub_int16_t) (a - b); +- if (i > 0) +- return +1; +- if (i < 0) +- return -1; +- return 0; +-} +- +-static int +-cmp (const void *a__, const void *b__) +-{ +- struct grub_net_buff *a_ = *(struct grub_net_buff **) a__; +- struct grub_net_buff *b_ = *(struct grub_net_buff **) b__; +- struct tftphdr *a = (struct tftphdr *) a_->data; +- struct tftphdr *b = (struct tftphdr *) b_->data; +- /* We want the first elements to be on top. */ +- return -cmp_block (grub_be_to_cpu16 (a->u.data.block), grub_be_to_cpu16 (b->u.data.block)); +-} +- + static grub_err_t + ack (tftp_data_t data, grub_uint64_t block) + { +@@ -207,73 +183,60 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), + return GRUB_ERR_NONE; + } + +- err = grub_priority_queue_push (data->pq, &nb); +- if (err) +- return err; ++ /* Ack old/retransmitted block. */ ++ if (grub_be_to_cpu16 (tftph->u.data.block) < data->block + 1) ++ ack (data, grub_be_to_cpu16 (tftph->u.data.block)); ++ /* Ignore unexpected block. */ ++ else if (grub_be_to_cpu16 (tftph->u.data.block) > data->block + 1) ++ grub_dprintf ("tftp", "TFTP unexpected block # %d\n", tftph->u.data.block); ++ else ++ { ++ unsigned size; + +- { +- struct grub_net_buff **nb_top_p, *nb_top; +- while (1) +- { +- nb_top_p = grub_priority_queue_top (data->pq); +- if (!nb_top_p) +- return GRUB_ERR_NONE; +- nb_top = *nb_top_p; +- tftph = (struct tftphdr *) nb_top->data; +- if (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) >= 0) +- break; +- ack (data, grub_be_to_cpu16 (tftph->u.data.block)); +- grub_netbuff_free (nb_top); +- grub_priority_queue_pop (data->pq); +- } +- while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0) +- { +- unsigned size; +- +- grub_priority_queue_pop (data->pq); +- +- if (file->device->net->packs.count < 50) ++ if (file->device->net->packs.count < 50) ++ { + err = ack (data, data->block + 1); +- else +- { +- file->device->net->stall = 1; +- err = 0; +- } +- if (err) +- return err; ++ if (err) ++ return err; ++ } ++ else ++ file->device->net->stall = 1; + +- err = grub_netbuff_pull (nb_top, sizeof (tftph->opcode) + +- sizeof (tftph->u.data.block)); +- if (err) +- return err; +- size = nb_top->tail - nb_top->data; ++ err = grub_netbuff_pull (nb, sizeof (tftph->opcode) + ++ sizeof (tftph->u.data.block)); ++ if (err) ++ return err; ++ size = nb->tail - nb->data; + +- data->block++; +- if (size < data->block_size) +- { +- if (data->ack_sent < data->block) +- ack (data, data->block); +- file->device->net->eof = 1; +- file->device->net->stall = 1; +- grub_net_udp_close (data->sock); +- data->sock = NULL; +- } +- /* Prevent garbage in broken cards. Is it still necessary +- given that IP implementation has been fixed? +- */ +- if (size > data->block_size) +- { +- err = grub_netbuff_unput (nb_top, size - data->block_size); +- if (err) +- return err; +- } +- /* If there is data, puts packet in socket list. */ +- if ((nb_top->tail - nb_top->data) > 0) +- grub_net_put_packet (&file->device->net->packs, nb_top); +- else +- grub_netbuff_free (nb_top); +- } +- } ++ data->block++; ++ if (size < data->block_size) ++ { ++ if (data->ack_sent < data->block) ++ ack (data, data->block); ++ file->device->net->eof = 1; ++ file->device->net->stall = 1; ++ grub_net_udp_close (data->sock); ++ data->sock = NULL; ++ } ++ /* ++ * Prevent garbage in broken cards. Is it still necessary ++ * given that IP implementation has been fixed? ++ */ ++ if (size > data->block_size) ++ { ++ err = grub_netbuff_unput (nb, size - data->block_size); ++ if (err) ++ return err; ++ } ++ /* If there is data, puts packet in socket list. */ ++ if ((nb->tail - nb->data) > 0) ++ { ++ grub_net_put_packet (&file->device->net->packs, nb); ++ /* Do not free nb. */ ++ return GRUB_ERR_NONE; ++ } ++ } ++ grub_netbuff_free (nb); + return GRUB_ERR_NONE; + case TFTP_ERROR: + data->have_oack = 1; +@@ -287,19 +250,6 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), + } + } + +-static void +-destroy_pq (tftp_data_t data) +-{ +- struct grub_net_buff **nb_p; +- while ((nb_p = grub_priority_queue_top (data->pq))) +- { +- grub_netbuff_free (*nb_p); +- grub_priority_queue_pop (data->pq); +- } +- +- grub_priority_queue_destroy (data->pq); +-} +- + /* Create a normalized copy of the filename. + Compress any string of consecutive forward slashes to a single forward + slash. */ +@@ -395,13 +345,6 @@ tftp_open (struct grub_file *file, const char *filename) + file->not_easily_seekable = 1; + file->data = data; + +- data->pq = grub_priority_queue_new (sizeof (struct grub_net_buff *), cmp); +- if (!data->pq) +- { +- grub_free (data); +- return grub_errno; +- } +- + grub_dprintf("tftp", "resolving address for %s\n", file->device->net->server); + err = grub_net_resolve_address (file->device->net->server, &addr); + if (err) +@@ -410,7 +353,6 @@ tftp_open (struct grub_file *file, const char *filename) + grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n", + (unsigned long long)data->file_size, + (unsigned long long)data->block_size); +- destroy_pq (data); + grub_free (data); + return err; + } +@@ -422,7 +364,6 @@ tftp_open (struct grub_file *file, const char *filename) + if (!data->sock) + { + grub_dprintf("tftp", "connection failed\n"); +- destroy_pq (data); + grub_free (data); + return grub_errno; + } +@@ -436,7 +377,6 @@ tftp_open (struct grub_file *file, const char *filename) + if (err) + { + grub_net_udp_close (data->sock); +- destroy_pq (data); + grub_free (data); + return err; + } +@@ -453,7 +393,6 @@ tftp_open (struct grub_file *file, const char *filename) + if (grub_errno) + { + grub_net_udp_close (data->sock); +- destroy_pq (data); + grub_free (data); + return grub_errno; + } +@@ -496,7 +435,6 @@ tftp_close (struct grub_file *file) + grub_print_error (); + grub_net_udp_close (data->sock); + } +- destroy_pq (data); + grub_free (data); + return GRUB_ERR_NONE; + } diff --git a/0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch b/0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch new file mode 100644 index 00000000..b68f3a16 --- /dev/null +++ b/0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lukasz Hawrylko +Date: Mon, 16 Dec 2019 11:15:55 +0100 +Subject: [PATCH] multiboot2: Set min address for mbi allocation to 0x1000 + +In some cases GRUB2 allocates multiboot2 structure at 0 address, that is +a confusing behavior. Consumers of that structure can have internal NULL-checks +that will throw an error when get a pointer to data allocated at address 0. +To prevent that, define min address for mbi allocation on x86 and x86_64 +platforms. + +Signed-off-by: Lukasz Hawrylko +Reviewed-by: Daniel Kiper +Upstream-commit-id: 0f3f5b7c13f +--- + grub-core/loader/multiboot_mbi2.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c +index 0efc660620e..e88c9f4884f 100644 +--- a/grub-core/loader/multiboot_mbi2.c ++++ b/grub-core/loader/multiboot_mbi2.c +@@ -48,6 +48,12 @@ + #define HAS_VGA_TEXT 0 + #endif + ++#if defined (__i386__) || defined (__x86_64__) ++#define MBI_MIN_ADDR 0x1000 ++#else ++#define MBI_MIN_ADDR 0 ++#endif ++ + struct module + { + struct module *next; +@@ -708,7 +714,7 @@ grub_multiboot2_make_mbi (grub_uint32_t *target) + COMPILE_TIME_ASSERT (MULTIBOOT_TAG_ALIGN % sizeof (grub_properly_aligned_t) == 0); + + err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch, +- 0, 0xffffffff - bufsize, ++ MBI_MIN_ADDR, 0xffffffff - bufsize, + bufsize, MULTIBOOT_TAG_ALIGN, + GRUB_RELOCATOR_PREFERENCE_NONE, 1); + if (err) diff --git a/0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch b/0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch new file mode 100644 index 00000000..3c054cc6 --- /dev/null +++ b/0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch @@ -0,0 +1,147 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Makhalov +Date: Wed, 15 Jul 2020 06:42:37 +0000 +Subject: [PATCH] relocator: Protect grub_relocator_alloc_chunk_addr() input + args against integer underflow/overflow + +Use arithmetic macros from safemath.h to accomplish it. In this commit, +I didn't want to be too paranoid to check every possible math equation +for overflow/underflow. Only obvious places (with non zero chance of +overflow/underflow) were refactored. + +Signed-off-by: Alexey Makhalov +Reviewed-by: Daniel Kiper +Upstream-commit-id: ebb15735f10 +--- + grub-core/loader/i386/linux.c | 9 +++++++-- + grub-core/loader/i386/pc/linux.c | 9 +++++++-- + grub-core/loader/i386/xen.c | 12 ++++++++++-- + grub-core/loader/xnu.c | 11 +++++++---- + 4 files changed, 31 insertions(+), 10 deletions(-) + +diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c +index 201e6597c6d..90f2315f847 100644 +--- a/grub-core/loader/i386/linux.c ++++ b/grub-core/loader/i386/linux.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -548,9 +549,13 @@ grub_linux_boot (void) + + { + grub_relocator_chunk_t ch; ++ grub_size_t sz; ++ ++ if (grub_add (ctx.real_size, efi_mmap_size, &sz)) ++ return GRUB_ERR_OUT_OF_RANGE; ++ + err = grub_relocator_alloc_chunk_addr (relocator, &ch, +- ctx.real_mode_target, +- (ctx.real_size + efi_mmap_size)); ++ ctx.real_mode_target, sz); + if (err) + return err; + real_mode_mem = get_virtual_current_address (ch); +diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c +index 0bf0e13d647..33d1196b1e2 100644 +--- a/grub-core/loader/i386/pc/linux.c ++++ b/grub-core/loader/i386/pc/linux.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -231,8 +232,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS; + + real_size = setup_sects << GRUB_DISK_SECTOR_BITS; +- grub_linux16_prot_size = grub_file_size (file) +- - real_size - GRUB_DISK_SECTOR_SIZE; ++ if (grub_sub (grub_file_size (file), real_size, &grub_linux16_prot_size) || ++ grub_sub (grub_linux16_prot_size, GRUB_DISK_SECTOR_SIZE, &grub_linux16_prot_size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ goto fail; ++ } + + if (! grub_linux_is_bzimage + && GRUB_LINUX_ZIMAGE_ADDR + grub_linux16_prot_size +diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c +index 8f662c8ac89..cd24874ca32 100644 +--- a/grub-core/loader/i386/xen.c ++++ b/grub-core/loader/i386/xen.c +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -636,6 +637,7 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)), + grub_relocator_chunk_t ch; + grub_addr_t kern_start; + grub_addr_t kern_end; ++ grub_size_t sz; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); +@@ -703,8 +705,14 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)), + + xen_state.max_addr = ALIGN_UP (kern_end, PAGE_SIZE); + +- err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch, kern_start, +- kern_end - kern_start); ++ ++ if (grub_sub (kern_end, kern_start, &sz)) ++ { ++ err = GRUB_ERR_OUT_OF_RANGE; ++ goto fail; ++ } ++ ++ err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch, kern_start, sz); + if (err) + goto fail; + kern_chunk_src = get_virtual_current_address (ch); +diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c +index 2f0ebd0b8bf..3fd653993f7 100644 +--- a/grub-core/loader/xnu.c ++++ b/grub-core/loader/xnu.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -60,15 +61,17 @@ grub_xnu_heap_malloc (int size, void **src, grub_addr_t *target) + { + grub_err_t err; + grub_relocator_chunk_t ch; ++ grub_addr_t tgt; ++ ++ if (grub_add (grub_xnu_heap_target_start, grub_xnu_heap_size, &tgt)) ++ return GRUB_ERR_OUT_OF_RANGE; + +- err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &ch, +- grub_xnu_heap_target_start +- + grub_xnu_heap_size, size); ++ err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &ch, tgt, size); + if (err) + return err; + + *src = get_virtual_current_address (ch); +- *target = grub_xnu_heap_target_start + grub_xnu_heap_size; ++ *target = tgt; + grub_xnu_heap_size += size; + grub_dprintf ("xnu", "val=%p\n", *src); + return GRUB_ERR_NONE; diff --git a/0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch b/0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch new file mode 100644 index 00000000..2ac53959 --- /dev/null +++ b/0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch @@ -0,0 +1,335 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Makhalov +Date: Wed, 8 Jul 2020 01:44:38 +0000 +Subject: [PATCH] relocator: Protect grub_relocator_alloc_chunk_align() + max_addr against integer underflow + +This commit introduces integer underflow mitigation in max_addr calculation +in grub_relocator_alloc_chunk_align() invocation. + +It consists of 2 fixes: + 1. Introduced grub_relocator_alloc_chunk_align_safe() wrapper function to perform + sanity check for min/max and size values, and to make safe invocation of + grub_relocator_alloc_chunk_align() with validated max_addr value. Replace all + invocations such as grub_relocator_alloc_chunk_align(..., min_addr, max_addr - size, size, ...) + by grub_relocator_alloc_chunk_align_safe(..., min_addr, max_addr, size, ...). + 2. Introduced UP_TO_TOP32(s) macro for the cases where max_addr is 32-bit top + address (0xffffffff - size + 1) or similar. + +Signed-off-by: Alexey Makhalov +Reviewed-by: Daniel Kiper +Upstream-commit-id: 10498c8ba17 +--- + grub-core/lib/i386/relocator.c | 28 +++++++++++----------------- + grub-core/lib/mips/relocator.c | 6 ++---- + grub-core/lib/powerpc/relocator.c | 6 ++---- + grub-core/lib/x86_64/efi/relocator.c | 7 +++---- + grub-core/loader/i386/linux.c | 5 ++--- + grub-core/loader/i386/multiboot_mbi.c | 7 +++---- + grub-core/loader/i386/pc/linux.c | 6 ++---- + grub-core/loader/mips/linux.c | 9 +++------ + grub-core/loader/multiboot.c | 2 +- + grub-core/loader/multiboot_elfxx.c | 10 +++++----- + grub-core/loader/multiboot_mbi2.c | 10 +++++----- + grub-core/loader/xnu_resume.c | 2 +- + include/grub/relocator.h | 29 +++++++++++++++++++++++++++++ + 13 files changed, 69 insertions(+), 58 deletions(-) + +diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c +index 71dd4f0ab0c..34cbe834fa3 100644 +--- a/grub-core/lib/i386/relocator.c ++++ b/grub-core/lib/i386/relocator.c +@@ -83,11 +83,10 @@ grub_relocator32_boot (struct grub_relocator *rel, + /* Specific memory range due to Global Descriptor Table for use by payload + that we will store in returned chunk. The address range and preference + are based on "THE LINUX/x86 BOOT PROTOCOL" specification. */ +- err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000, +- 0x9a000 - RELOCATOR_SIZEOF (32), +- RELOCATOR_SIZEOF (32), 16, +- GRUB_RELOCATOR_PREFERENCE_LOW, +- avoid_efi_bootservices); ++ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0x1000, 0x9a000, ++ RELOCATOR_SIZEOF (32), 16, ++ GRUB_RELOCATOR_PREFERENCE_LOW, ++ avoid_efi_bootservices); + if (err) + return err; + +@@ -125,13 +124,10 @@ grub_relocator16_boot (struct grub_relocator *rel, + grub_relocator_chunk_t ch; + + /* Put it higher than the byte it checks for A20 check. */ +- err = grub_relocator_alloc_chunk_align (rel, &ch, 0x8010, +- 0xa0000 - RELOCATOR_SIZEOF (16) +- - GRUB_RELOCATOR16_STACK_SIZE, +- RELOCATOR_SIZEOF (16) +- + GRUB_RELOCATOR16_STACK_SIZE, 16, +- GRUB_RELOCATOR_PREFERENCE_NONE, +- 0); ++ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0x8010, 0xa0000, ++ RELOCATOR_SIZEOF (16) + ++ GRUB_RELOCATOR16_STACK_SIZE, 16, ++ GRUB_RELOCATOR_PREFERENCE_NONE, 0); + if (err) + return err; + +@@ -183,11 +179,9 @@ grub_relocator64_boot (struct grub_relocator *rel, + void *relst; + grub_relocator_chunk_t ch; + +- err = grub_relocator_alloc_chunk_align (rel, &ch, min_addr, +- max_addr - RELOCATOR_SIZEOF (64), +- RELOCATOR_SIZEOF (64), 16, +- GRUB_RELOCATOR_PREFERENCE_NONE, +- 0); ++ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, min_addr, max_addr, ++ RELOCATOR_SIZEOF (64), 16, ++ GRUB_RELOCATOR_PREFERENCE_NONE, 0); + if (err) + return err; + +diff --git a/grub-core/lib/mips/relocator.c b/grub-core/lib/mips/relocator.c +index 9d5f49cb93a..743b213e695 100644 +--- a/grub-core/lib/mips/relocator.c ++++ b/grub-core/lib/mips/relocator.c +@@ -120,10 +120,8 @@ grub_relocator32_boot (struct grub_relocator *rel, + unsigned i; + grub_addr_t vtarget; + +- err = grub_relocator_alloc_chunk_align (rel, &ch, 0, +- (0xffffffff - stateset_size) +- + 1, stateset_size, +- sizeof (grub_uint32_t), ++ err = grub_relocator_alloc_chunk_align (rel, &ch, 0, UP_TO_TOP32 (stateset_size), ++ stateset_size, sizeof (grub_uint32_t), + GRUB_RELOCATOR_PREFERENCE_NONE, 0); + if (err) + return err; +diff --git a/grub-core/lib/powerpc/relocator.c b/grub-core/lib/powerpc/relocator.c +index bdf2b111be7..8ffb8b68683 100644 +--- a/grub-core/lib/powerpc/relocator.c ++++ b/grub-core/lib/powerpc/relocator.c +@@ -115,10 +115,8 @@ grub_relocator32_boot (struct grub_relocator *rel, + unsigned i; + grub_relocator_chunk_t ch; + +- err = grub_relocator_alloc_chunk_align (rel, &ch, 0, +- (0xffffffff - stateset_size) +- + 1, stateset_size, +- sizeof (grub_uint32_t), ++ err = grub_relocator_alloc_chunk_align (rel, &ch, 0, UP_TO_TOP32 (stateset_size), ++ stateset_size, sizeof (grub_uint32_t), + GRUB_RELOCATOR_PREFERENCE_NONE, 0); + if (err) + return err; +diff --git a/grub-core/lib/x86_64/efi/relocator.c b/grub-core/lib/x86_64/efi/relocator.c +index 3caef7a4021..7d200a125ee 100644 +--- a/grub-core/lib/x86_64/efi/relocator.c ++++ b/grub-core/lib/x86_64/efi/relocator.c +@@ -50,10 +50,9 @@ grub_relocator64_efi_boot (struct grub_relocator *rel, + * 64-bit relocator code may live above 4 GiB quite well. + * However, I do not want ask for problems. Just in case. + */ +- err = grub_relocator_alloc_chunk_align (rel, &ch, 0, +- 0x100000000 - RELOCATOR_SIZEOF (64_efi), +- RELOCATOR_SIZEOF (64_efi), 16, +- GRUB_RELOCATOR_PREFERENCE_NONE, 1); ++ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0, 0x100000000, ++ RELOCATOR_SIZEOF (64_efi), 16, ++ GRUB_RELOCATOR_PREFERENCE_NONE, 1); + if (err) + return err; + +diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c +index 90f2315f847..7d0c987cd91 100644 +--- a/grub-core/loader/i386/linux.c ++++ b/grub-core/loader/i386/linux.c +@@ -182,9 +182,8 @@ allocate_pages (grub_size_t prot_size, grub_size_t *align, + for (; err && *align + 1 > min_align; (*align)--) + { + grub_errno = GRUB_ERR_NONE; +- err = grub_relocator_alloc_chunk_align (relocator, &ch, +- 0x1000000, +- 0xffffffff & ~prot_size, ++ err = grub_relocator_alloc_chunk_align (relocator, &ch, 0x1000000, ++ UP_TO_TOP32 (prot_size), + prot_size, 1 << *align, + GRUB_RELOCATOR_PREFERENCE_LOW, + 1); +diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c +index ad3cc292fd1..a67d9d0a808 100644 +--- a/grub-core/loader/i386/multiboot_mbi.c ++++ b/grub-core/loader/i386/multiboot_mbi.c +@@ -466,10 +466,9 @@ grub_multiboot_make_mbi (grub_uint32_t *target) + + bufsize = grub_multiboot_get_mbi_size (); + +- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, +- 0x10000, 0xa0000 - bufsize, +- bufsize, 4, +- GRUB_RELOCATOR_PREFERENCE_NONE, 0); ++ err = grub_relocator_alloc_chunk_align_safe (grub_multiboot_relocator, &ch, ++ 0x10000, 0xa0000, bufsize, 4, ++ GRUB_RELOCATOR_PREFERENCE_NONE, 0); + if (err) + return err; + ptrorig = get_virtual_current_address (ch); +diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c +index 33d1196b1e2..f1ad185ddc2 100644 +--- a/grub-core/loader/i386/pc/linux.c ++++ b/grub-core/loader/i386/pc/linux.c +@@ -463,10 +463,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + + { + grub_relocator_chunk_t ch; +- err = grub_relocator_alloc_chunk_align (relocator, &ch, +- addr_min, addr_max - size, +- size, 0x1000, +- GRUB_RELOCATOR_PREFERENCE_HIGH, 0); ++ err = grub_relocator_alloc_chunk_align_safe (relocator, &ch, addr_min, addr_max, size, ++ 0x1000, GRUB_RELOCATOR_PREFERENCE_HIGH, 0); + if (err) + return err; + initrd_chunk = get_virtual_current_address (ch); +diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c +index 7b723bf189d..e4ed95921df 100644 +--- a/grub-core/loader/mips/linux.c ++++ b/grub-core/loader/mips/linux.c +@@ -442,12 +442,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + { + grub_relocator_chunk_t ch; + +- err = grub_relocator_alloc_chunk_align (relocator, &ch, +- (target_addr & 0x1fffffff) +- + linux_size + 0x10000, +- (0x10000000 - size), +- size, 0x10000, +- GRUB_RELOCATOR_PREFERENCE_NONE, 0); ++ err = grub_relocator_alloc_chunk_align_safe (relocator, &ch, (target_addr & 0x1fffffff) + ++ linux_size + 0x10000, 0x10000000, size, ++ 0x10000, GRUB_RELOCATOR_PREFERENCE_NONE, 0); + + if (err) + goto fail; +diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c +index 3e6ad166dc9..3e286908dda 100644 +--- a/grub-core/loader/multiboot.c ++++ b/grub-core/loader/multiboot.c +@@ -404,7 +404,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), + { + grub_relocator_chunk_t ch; + err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, +- lowest_addr, (0xffffffff - size) + 1, ++ lowest_addr, UP_TO_TOP32 (size), + size, MULTIBOOT_MOD_ALIGN, + GRUB_RELOCATOR_PREFERENCE_NONE, 1); + if (err) +diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c +index cc6853692a8..f2318e0d165 100644 +--- a/grub-core/loader/multiboot_elfxx.c ++++ b/grub-core/loader/multiboot_elfxx.c +@@ -109,10 +109,10 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) + if (load_size > mld->max_addr || mld->min_addr > mld->max_addr - load_size) + return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size"); + +- err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, +- mld->min_addr, mld->max_addr - load_size, +- load_size, mld->align ? mld->align : 1, +- mld->preference, mld->avoid_efi_boot_services); ++ err = grub_relocator_alloc_chunk_align_safe (GRUB_MULTIBOOT (relocator), &ch, ++ mld->min_addr, mld->max_addr, ++ load_size, mld->align ? mld->align : 1, ++ mld->preference, mld->avoid_efi_boot_services); + + if (err) + { +@@ -256,7 +256,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) + continue; + + err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, 0, +- (0xffffffff - sh->sh_size) + 1, ++ UP_TO_TOP32 (sh->sh_size), + sh->sh_size, sh->sh_addralign, + GRUB_RELOCATOR_PREFERENCE_NONE, + mld->avoid_efi_boot_services); +diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c +index e88c9f4884f..9a943d7bdd7 100644 +--- a/grub-core/loader/multiboot_mbi2.c ++++ b/grub-core/loader/multiboot_mbi2.c +@@ -301,10 +301,10 @@ grub_multiboot2_load (grub_file_t file, const char *filename) + return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size"); + } + +- err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch, +- mld.min_addr, mld.max_addr - code_size, +- code_size, mld.align ? mld.align : 1, +- mld.preference, keep_bs); ++ err = grub_relocator_alloc_chunk_align_safe (grub_multiboot2_relocator, &ch, ++ mld.min_addr, mld.max_addr, ++ code_size, mld.align ? mld.align : 1, ++ mld.preference, keep_bs); + } + else + err = grub_relocator_alloc_chunk_addr (grub_multiboot2_relocator, +@@ -714,7 +714,7 @@ grub_multiboot2_make_mbi (grub_uint32_t *target) + COMPILE_TIME_ASSERT (MULTIBOOT_TAG_ALIGN % sizeof (grub_properly_aligned_t) == 0); + + err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch, +- MBI_MIN_ADDR, 0xffffffff - bufsize, ++ MBI_MIN_ADDR, UP_TO_TOP32 (bufsize), + bufsize, MULTIBOOT_TAG_ALIGN, + GRUB_RELOCATOR_PREFERENCE_NONE, 1); + if (err) +diff --git a/grub-core/loader/xnu_resume.c b/grub-core/loader/xnu_resume.c +index 8089804d482..d648ef0cd3a 100644 +--- a/grub-core/loader/xnu_resume.c ++++ b/grub-core/loader/xnu_resume.c +@@ -129,7 +129,7 @@ grub_xnu_resume (char *imagename) + { + grub_relocator_chunk_t ch; + err = grub_relocator_alloc_chunk_align (grub_xnu_relocator, &ch, 0, +- (0xffffffff - hibhead.image_size) + 1, ++ UP_TO_TOP32 (hibhead.image_size), + hibhead.image_size, + GRUB_XNU_PAGESIZE, + GRUB_RELOCATOR_PREFERENCE_NONE, 0); +diff --git a/include/grub/relocator.h b/include/grub/relocator.h +index 24d8672d22c..1b3bdd92ac6 100644 +--- a/include/grub/relocator.h ++++ b/include/grub/relocator.h +@@ -49,6 +49,35 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel, + int preference, + int avoid_efi_boot_services); + ++/* ++ * Wrapper for grub_relocator_alloc_chunk_align() with purpose of ++ * protecting against integer underflow. ++ * ++ * Compare to its callee, max_addr has different meaning here. ++ * It covers entire chunk and not just start address of the chunk. ++ */ ++static inline grub_err_t ++grub_relocator_alloc_chunk_align_safe (struct grub_relocator *rel, ++ grub_relocator_chunk_t *out, ++ grub_phys_addr_t min_addr, ++ grub_phys_addr_t max_addr, ++ grub_size_t size, grub_size_t align, ++ int preference, ++ int avoid_efi_boot_services) ++{ ++ /* Sanity check and ensure following equation (max_addr - size) is safe. */ ++ if (max_addr < size || (max_addr - size) < min_addr) ++ return GRUB_ERR_OUT_OF_RANGE; ++ ++ return grub_relocator_alloc_chunk_align (rel, out, min_addr, ++ max_addr - size, ++ size, align, preference, ++ avoid_efi_boot_services); ++} ++ ++/* Top 32-bit address minus s bytes and plus 1 byte. */ ++#define UP_TO_TOP32(s) ((~(s) & 0xffffffff) + 1) ++ + #define GRUB_RELOCATOR_PREFERENCE_NONE 0 + #define GRUB_RELOCATOR_PREFERENCE_LOW 1 + #define GRUB_RELOCATOR_PREFERENCE_HIGH 2 diff --git a/0242-script-Remove-unused-fields-from-grub_script_functio.patch b/0242-script-Remove-unused-fields-from-grub_script_functio.patch new file mode 100644 index 00000000..93beaac0 --- /dev/null +++ b/0242-script-Remove-unused-fields-from-grub_script_functio.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Fri, 10 Jul 2020 11:21:14 +0100 +Subject: [PATCH] script: Remove unused fields from grub_script_function struct + +Signed-off-by: Chris Coulson +Reviewed-by: Daniel Kiper +Upstream-commit-id: d04089c8e52 +--- + include/grub/script_sh.h | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h +index 360c2be1f05..b382bcf09bc 100644 +--- a/include/grub/script_sh.h ++++ b/include/grub/script_sh.h +@@ -359,13 +359,8 @@ struct grub_script_function + /* The script function. */ + struct grub_script *func; + +- /* The flags. */ +- unsigned flags; +- + /* The next element. */ + struct grub_script_function *next; +- +- int references; + }; + typedef struct grub_script_function *grub_script_function_t; + diff --git a/0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch b/0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch new file mode 100644 index 00000000..4435a7d4 --- /dev/null +++ b/0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Fri, 10 Jul 2020 14:41:45 +0100 +Subject: [PATCH] script: Avoid a use-after-free when redefining a function + during execution + +Defining a new function with the same name as a previously defined +function causes the grub_script and associated resources for the +previous function to be freed. If the previous function is currently +executing when a function with the same name is defined, this results +in use-after-frees when processing subsequent commands in the original +function. + +Instead, reject a new function definition if it has the same name as +a previously defined function, and that function is currently being +executed. Although a behavioural change, this should be backwards +compatible with existing configurations because they can't be +dependent on the current behaviour without being broken. + +Signed-off-by: Chris Coulson +Reviewed-by: Daniel Kiper +Upstream-commit-id: f6253a1f540 +--- + grub-core/script/execute.c | 2 ++ + grub-core/script/function.c | 16 +++++++++++++--- + include/grub/script_sh.h | 2 ++ + grub-core/script/parser.y | 3 ++- + 4 files changed, 19 insertions(+), 4 deletions(-) + +diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c +index b55e171c931..d2f02cc5b38 100644 +--- a/grub-core/script/execute.c ++++ b/grub-core/script/execute.c +@@ -872,7 +872,9 @@ grub_script_function_call (grub_script_function_t func, int argc, char **args) + old_scope = scope; + scope = &new_scope; + ++ func->executing++; + ret = grub_script_execute (func->func); ++ func->executing--; + + function_return = 0; + active_loops = loops; +diff --git a/grub-core/script/function.c b/grub-core/script/function.c +index d36655e510f..3aad04bf9dd 100644 +--- a/grub-core/script/function.c ++++ b/grub-core/script/function.c +@@ -34,6 +34,7 @@ grub_script_function_create (struct grub_script_arg *functionname_arg, + func = (grub_script_function_t) grub_malloc (sizeof (*func)); + if (! func) + return 0; ++ func->executing = 0; + + func->name = grub_strdup (functionname_arg->str); + if (! func->name) +@@ -60,10 +61,19 @@ grub_script_function_create (struct grub_script_arg *functionname_arg, + grub_script_function_t q; + + q = *p; +- grub_script_free (q->func); +- q->func = cmd; + grub_free (func); +- func = q; ++ if (q->executing > 0) ++ { ++ grub_error (GRUB_ERR_BAD_ARGUMENT, ++ N_("attempt to redefine a function being executed")); ++ func = NULL; ++ } ++ else ++ { ++ grub_script_free (q->func); ++ q->func = cmd; ++ func = q; ++ } + } + else + { +diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h +index b382bcf09bc..6c48e075122 100644 +--- a/include/grub/script_sh.h ++++ b/include/grub/script_sh.h +@@ -361,6 +361,8 @@ struct grub_script_function + + /* The next element. */ + struct grub_script_function *next; ++ ++ unsigned executing; + }; + typedef struct grub_script_function *grub_script_function_t; + +diff --git a/grub-core/script/parser.y b/grub-core/script/parser.y +index 4f0ab8319e3..f80b86b6f15 100644 +--- a/grub-core/script/parser.y ++++ b/grub-core/script/parser.y +@@ -289,7 +289,8 @@ function: "function" "name" + grub_script_mem_free (state->func_mem); + else { + script->children = state->scripts; +- grub_script_function_create ($2, script); ++ if (!grub_script_function_create ($2, script)) ++ grub_script_free (script); + } + + state->scripts = $3; diff --git a/0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch b/0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch new file mode 100644 index 00000000..850fef76 --- /dev/null +++ b/0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Makhalov +Date: Fri, 17 Jul 2020 05:17:26 +0000 +Subject: [PATCH] relocator: Fix grub_relocator_alloc_chunk_align() top memory + allocation + +Current implementation of grub_relocator_alloc_chunk_align() +does not allow allocation of the top byte. + +Assuming input args are: + max_addr = 0xfffff000; + size = 0x1000; + +And this is valid. But following overflow protection will +unnecessarily move max_addr one byte down (to 0xffffefff): + if (max_addr > ~size) + max_addr = ~size; + +~size + 1 will fix the situation. In addition, check size +for non zero to do not zero max_addr. + +Signed-off-by: Alexey Makhalov +Reviewed-by: Daniel Kiper +Upstream-commit-id: ab80a97eb1f +--- + grub-core/lib/relocator.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c +index 5847aac3643..f2c1944c28d 100644 +--- a/grub-core/lib/relocator.c ++++ b/grub-core/lib/relocator.c +@@ -1386,8 +1386,8 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel, + }; + grub_addr_t min_addr2 = 0, max_addr2; + +- if (max_addr > ~size) +- max_addr = ~size; ++ if (size && (max_addr > ~size)) ++ max_addr = ~size + 1; + + #ifdef GRUB_MACHINE_PCBIOS + if (min_addr < 0x1000) diff --git a/0245-hfsplus-fix-two-more-overflows.patch b/0245-hfsplus-fix-two-more-overflows.patch new file mode 100644 index 00000000..937918f7 --- /dev/null +++ b/0245-hfsplus-fix-two-more-overflows.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 19 Jul 2020 14:43:31 -0400 +Subject: [PATCH] hfsplus: fix two more overflows + +Both node->size and node->namelen come from the supplied filesystem, +which may be user-supplied. We can't trust them for the math unless we +know they don't overflow; making sure they go through calloc() first +will give us that. + +Signed-off-by: Peter Jones +Reviewed-by: Darren Kenny +Upstream-commit-id: b4915078903 +--- + grub-core/fs/hfsplus.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c +index dae43becc97..9c4e4c88c99 100644 +--- a/grub-core/fs/hfsplus.c ++++ b/grub-core/fs/hfsplus.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -475,8 +476,12 @@ grub_hfsplus_read_symlink (grub_fshelp_node_t node) + { + char *symlink; + grub_ssize_t numread; ++ grub_size_t sz = node->size; + +- symlink = grub_malloc (node->size + 1); ++ if (grub_add (sz, 1, &sz)) ++ return NULL; ++ ++ symlink = grub_malloc (sz); + if (!symlink) + return 0; + +@@ -715,8 +720,8 @@ list_nodes (void *record, void *hook_arg) + if (type == GRUB_FSHELP_UNKNOWN) + return 0; + +- filename = grub_malloc (grub_be_to_cpu16 (catkey->namelen) +- * GRUB_MAX_UTF8_PER_UTF16 + 1); ++ filename = grub_calloc (grub_be_to_cpu16 (catkey->namelen), ++ GRUB_MAX_UTF8_PER_UTF16 + 1); + if (! filename) + return 0; + diff --git a/0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch b/0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch new file mode 100644 index 00000000..31e7f072 --- /dev/null +++ b/0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch @@ -0,0 +1,108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 19 Jul 2020 15:48:20 -0400 +Subject: [PATCH] lvm: fix two more potential data-dependent alloc overflows + +It appears to be possible to make a (possibly invalid) lvm PV with a +metadata size field that overflows our type when adding it to the +address we've allocated. Even if it doesn't, it may be possible to do +so with the math using the outcome of that as an operand. Check them +both. + +Signed-off-by: Peter Jones +Signed-off-by: Darren Kenny +Upstream-commit-id: 45ec6046ea0 +--- + grub-core/disk/lvm.c | 47 +++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 39 insertions(+), 8 deletions(-) + +diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c +index 8e76d1ae121..cca8ec668ba 100644 +--- a/grub-core/disk/lvm.c ++++ b/grub-core/disk/lvm.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #ifdef GRUB_UTIL + #include +@@ -102,10 +103,11 @@ grub_lvm_detect (grub_disk_t disk, + { + grub_err_t err; + grub_uint64_t mda_offset, mda_size; ++ grub_size_t ptr; + char buf[GRUB_LVM_LABEL_SIZE]; + char vg_id[GRUB_LVM_ID_STRLEN+1]; + char pv_id[GRUB_LVM_ID_STRLEN+1]; +- char *metadatabuf, *vgname; ++ char *metadatabuf, *mda_end, *vgname; + const char *p, *q; + struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf; + struct grub_lvm_pv_header *pvh; +@@ -206,19 +208,31 @@ grub_lvm_detect (grub_disk_t disk, + grub_le_to_cpu64 (rlocn->size) - + grub_le_to_cpu64 (mdah->size)); + } +- p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset); + +- while (*q != ' ' && q < metadatabuf + mda_size) +- q++; +- +- if (q == metadatabuf + mda_size) ++ if (grub_add ((grub_size_t)metadatabuf, ++ (grub_size_t)grub_le_to_cpu64 (rlocn->offset), ++ &ptr)) + { ++error_parsing_metadata: + #ifdef GRUB_UTIL + grub_util_info ("error parsing metadata"); + #endif + goto fail2; + } + ++ p = q = (char *)ptr; ++ ++ if (grub_add ((grub_size_t)metadatabuf, (grub_size_t)mda_size, &ptr)) ++ goto error_parsing_metadata; ++ ++ mda_end = (char *)ptr; ++ ++ while (*q != ' ' && q < mda_end) ++ q++; ++ ++ if (q == mda_end) ++ goto error_parsing_metadata; ++ + vgname_len = q - p; + vgname = grub_malloc (vgname_len + 1); + if (!vgname) +@@ -368,8 +382,25 @@ grub_lvm_detect (grub_disk_t disk, + { + const char *iptr; + char *optr; +- lv->fullname = grub_malloc (sizeof ("lvm/") - 1 + 2 * vgname_len +- + 1 + 2 * s + 1); ++ ++ /* this is kind of hard to read with our safe (but rather ++ * baroque) math primatives, but it boils down to: ++ * ++ * sz0 = vgname_len * 2 + 1 ++ * + s * 2 + 1 ++ * + sizeof ("lvm/") - 1; ++ */ ++ grub_size_t sz0 = vgname_len, sz1 = s; ++ ++ if (grub_mul (sz0, 2, &sz0) || ++ grub_add (sz0, 1, &sz0) || ++ grub_mul (sz1, 2, &sz1) || ++ grub_add (sz1, 1, &sz1) || ++ grub_add (sz0, sz1, &sz0) || ++ grub_add (sz0, sizeof ("lvm/") - 1, &sz0)) ++ goto lvs_fail; ++ ++ lv->fullname = grub_malloc (sz0); + if (!lv->fullname) + goto lvs_fail; + diff --git a/0247-emu-make-grub_free-NULL-safe.patch b/0247-emu-make-grub_free-NULL-safe.patch new file mode 100644 index 00000000..64ecc344 --- /dev/null +++ b/0247-emu-make-grub_free-NULL-safe.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 19 Jul 2020 16:08:08 -0400 +Subject: [PATCH] emu: make grub_free(NULL) safe + +The grub_free() implementation in kern/mm.c safely handles NULL +pointers, and code at many places depends on this. We don't know that +the same is true on all host OSes, so we need to handle the same +behavior in grub-emu's implementation. + +Signed-off-by: Peter Jones +Reviewed-by: Darren Kenny +Upstream-commit-id: 96bb109e658 +--- + grub-core/kern/emu/mm.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c +index 145b01d3719..4d1046a219e 100644 +--- a/grub-core/kern/emu/mm.c ++++ b/grub-core/kern/emu/mm.c +@@ -60,7 +60,8 @@ grub_zalloc (grub_size_t size) + void + grub_free (void *ptr) + { +- free (ptr); ++ if (ptr) ++ free (ptr); + } + + void * diff --git a/0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch b/0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch new file mode 100644 index 00000000..a18412ff --- /dev/null +++ b/0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch @@ -0,0 +1,248 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 19 Jul 2020 16:53:27 -0400 +Subject: [PATCH] efi: fix some malformed device path arithmetic errors. + +Several places we take the length of a device path and subtract 4 from +it, without ever checking that it's >= 4. There are also cases where +this kind of malformation will result in unpredictable iteration, +including treating the length from one dp node as the type in the next +node. These are all errors, no matter where the data comes from. + +This patch adds a checking macro, GRUB_EFI_DEVICE_PATH_VALID(), which +can be used in several places, and makes GRUB_EFI_NEXT_DEVICE_PATH() +return NULL and GRUB_EFI_END_ENTIRE_DEVICE_PATH() evaluate as true when +the length is too small. Additionally, it makes several places in the +code check for and return errors in these cases. + +Signed-off-by: Peter Jones +Upstream-commit-id: 23e68a83990 +--- + grub-core/kern/efi/efi.c | 67 ++++++++++++++++++++++++++++++++------ + grub-core/loader/efi/chainloader.c | 19 +++++++++-- + grub-core/loader/i386/xnu.c | 9 ++--- + include/grub/efi/api.h | 14 +++++--- + 4 files changed, 88 insertions(+), 21 deletions(-) + +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index ab133fecce0..8c09e60987d 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -350,7 +350,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) + + dp = dp0; + +- while (1) ++ while (dp) + { + grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); + grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); +@@ -360,9 +360,15 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) + if (type == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE + && subtype == GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE) + { +- grub_efi_uint16_t len; +- len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4) +- / sizeof (grub_efi_char16_t)); ++ grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp); ++ ++ if (len < 4) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "malformed EFI Device Path node has length=%d", len); ++ return NULL; ++ } ++ len = (len - 4) / sizeof (grub_efi_char16_t); + filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2; + } + +@@ -378,7 +384,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) + if (!name) + return NULL; + +- while (1) ++ while (dp) + { + grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); + grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); +@@ -394,8 +400,15 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) + + *p++ = '/'; + +- len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4) +- / sizeof (grub_efi_char16_t)); ++ len = GRUB_EFI_DEVICE_PATH_LENGTH (dp); ++ if (len < 4) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "malformed EFI Device Path node has length=%d", len); ++ return NULL; ++ } ++ ++ len = (len - 4) / sizeof (grub_efi_char16_t); + fp = (grub_efi_file_path_device_path_t *) dp; + /* According to EFI spec Path Name is NULL terminated */ + while (len > 0 && fp->path_name[len - 1] == 0) +@@ -470,7 +483,26 @@ grub_efi_duplicate_device_path (const grub_efi_device_path_t *dp) + ; + p = GRUB_EFI_NEXT_DEVICE_PATH (p)) + { +- total_size += GRUB_EFI_DEVICE_PATH_LENGTH (p); ++ grub_size_t len = GRUB_EFI_DEVICE_PATH_LENGTH (p); ++ ++ /* ++ * In the event that we find a node that's completely garbage, for ++ * example if we get to 0x7f 0x01 0x02 0x00 ... (EndInstance with a size ++ * of 2), GRUB_EFI_END_ENTIRE_DEVICE_PATH() will be true and ++ * GRUB_EFI_NEXT_DEVICE_PATH() will return NULL, so we won't continue, ++ * and neither should our consumers, but there won't be any error raised ++ * even though the device path is junk. ++ * ++ * This keeps us from passing junk down back to our caller. ++ */ ++ if (len < 4) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "malformed EFI Device Path node has length=%d", len); ++ return NULL; ++ } ++ ++ total_size += len; + if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (p)) + break; + } +@@ -515,7 +547,7 @@ dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor) + void + grub_efi_print_device_path (grub_efi_device_path_t *dp) + { +- while (1) ++ while (GRUB_EFI_DEVICE_PATH_VALID (dp)) + { + grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); + grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); +@@ -987,7 +1019,11 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1, + /* Return non-zero. */ + return 1; + +- while (1) ++ if (dp1 == dp2) ++ return 0; ++ ++ while (GRUB_EFI_DEVICE_PATH_VALID (dp1) ++ && GRUB_EFI_DEVICE_PATH_VALID (dp2)) + { + grub_efi_uint8_t type1, type2; + grub_efi_uint8_t subtype1, subtype2; +@@ -1023,5 +1059,16 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1, + dp2 = (grub_efi_device_path_t *) ((char *) dp2 + len2); + } + ++ /* ++ * There's no "right" answer here, but we probably don't want to call a valid ++ * dp and an invalid dp equal, so pick one way or the other. ++ */ ++ if (GRUB_EFI_DEVICE_PATH_VALID (dp1) && ++ !GRUB_EFI_DEVICE_PATH_VALID (dp2)) ++ return 1; ++ else if (!GRUB_EFI_DEVICE_PATH_VALID (dp1) && ++ GRUB_EFI_DEVICE_PATH_VALID (dp2)) ++ return -1; ++ + return 0; + } +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 736505173cb..5f7c6cfe105 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -125,6 +125,12 @@ copy_file_path (grub_efi_file_path_device_path_t *fp, + fp->header.type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE; + fp->header.subtype = GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE; + ++ if (!GRUB_EFI_DEVICE_PATH_VALID ((grub_efi_device_path_t *)fp)) ++ { ++ grub_error (GRUB_ERR_BAD_ARGUMENT, "EFI Device Path is invalid"); ++ return; ++ } ++ + path_name = grub_calloc (len, GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); + if (!path_name) + return; +@@ -165,9 +171,18 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) + + size = 0; + d = dp; +- while (1) ++ while (d) + { +- size += GRUB_EFI_DEVICE_PATH_LENGTH (d); ++ grub_size_t len = GRUB_EFI_DEVICE_PATH_LENGTH (d); ++ ++ if (len < 4) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "malformed EFI Device Path node has length=%d", len); ++ return NULL; ++ } ++ ++ size += len; + if ((GRUB_EFI_END_ENTIRE_DEVICE_PATH (d))) + break; + d = GRUB_EFI_NEXT_DEVICE_PATH (d); +diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c +index e9e11925972..a7009360732 100644 +--- a/grub-core/loader/i386/xnu.c ++++ b/grub-core/loader/i386/xnu.c +@@ -515,14 +515,15 @@ grub_cmd_devprop_load (grub_command_t cmd __attribute__ ((unused)), + + devhead = buf; + buf = devhead + 1; +- dpstart = buf; ++ dp = dpstart = buf; + +- do ++ while (GRUB_EFI_DEVICE_PATH_VALID (dp) && buf < bufend) + { +- dp = buf; + buf = (char *) buf + GRUB_EFI_DEVICE_PATH_LENGTH (dp); ++ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp)) ++ break; ++ dp = buf; + } +- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp) && buf < bufend); + + dev = grub_xnu_devprop_add_device (dpstart, (char *) buf + - (char *) dpstart); +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index dec7b06083e..fc8a564e94d 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -666,6 +666,7 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t; + #define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f) + #define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype) + #define GRUB_EFI_DEVICE_PATH_LENGTH(dp) ((dp)->length) ++#define GRUB_EFI_DEVICE_PATH_VALID(dp) ((dp) != NULL && GRUB_EFI_DEVICE_PATH_LENGTH (dp) >= 4) + + /* The End of Device Path nodes. */ + #define GRUB_EFI_END_DEVICE_PATH_TYPE (0xff & 0x7f) +@@ -674,13 +675,16 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t; + #define GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE 0x01 + + #define GRUB_EFI_END_ENTIRE_DEVICE_PATH(dp) \ +- (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \ +- && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \ +- == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)) ++ (!GRUB_EFI_DEVICE_PATH_VALID (dp) || \ ++ (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \ ++ && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \ ++ == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE))) + + #define GRUB_EFI_NEXT_DEVICE_PATH(dp) \ +- ((grub_efi_device_path_t *) ((char *) (dp) \ +- + GRUB_EFI_DEVICE_PATH_LENGTH (dp))) ++ (GRUB_EFI_DEVICE_PATH_VALID (dp) \ ++ ? ((grub_efi_device_path_t *) \ ++ ((char *) (dp) + GRUB_EFI_DEVICE_PATH_LENGTH (dp))) \ ++ : NULL) + + /* Hardware Device Path. */ + #define GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE 1 diff --git a/0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch b/0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch new file mode 100644 index 00000000..1bccfd67 --- /dev/null +++ b/0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Wed, 22 Jul 2020 17:06:04 +0100 +Subject: [PATCH] Fix a regression caused by "efi: fix some malformed device + path arithmetic errors" + +This commit introduced a bogus check inside copy_file_path to +determine whether the destination grub_efi_file_path_device_path_t +was valid before anything was copied to it. Depending on the +contents of the heap buffer, this check could fail which would +result in copy_file_path returning early. + +Without any error propagated to the caller, make_file_path would +then try to advance the invalid device path node with +GRUB_EFI_NEXT_DEVICE_PATH, which would also fail, returning a NULL +pointer that would subsequently be dereferenced. + +Remove the bogus check, and also propagate errors from copy_file_path. +--- + grub-core/loader/efi/chainloader.c | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 5f7c6cfe105..3dfa41bb49d 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -115,7 +115,7 @@ grub_chainloader_boot (void) + return grub_errno; + } + +-static void ++static grub_err_t + copy_file_path (grub_efi_file_path_device_path_t *fp, + const char *str, grub_efi_uint16_t len) + { +@@ -125,15 +125,9 @@ copy_file_path (grub_efi_file_path_device_path_t *fp, + fp->header.type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE; + fp->header.subtype = GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE; + +- if (!GRUB_EFI_DEVICE_PATH_VALID ((grub_efi_device_path_t *)fp)) +- { +- grub_error (GRUB_ERR_BAD_ARGUMENT, "EFI Device Path is invalid"); +- return; +- } +- + path_name = grub_calloc (len, GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); + if (!path_name) +- return; ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "failed to allocate path buffer"); + + size = grub_utf8_to_utf16 (path_name, len * GRUB_MAX_UTF16_PER_UTF8, + (const grub_uint8_t *) str, len, 0); +@@ -146,6 +140,7 @@ copy_file_path (grub_efi_file_path_device_path_t *fp, + fp->path_name[size++] = '\0'; + fp->header.length = size * sizeof (grub_efi_char16_t) + sizeof (*fp); + grub_free (path_name); ++ return GRUB_ERR_NONE; + } + + static grub_efi_device_path_t * +@@ -203,13 +198,19 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) + /* Fill the file path for the directory. */ + d = (grub_efi_device_path_t *) ((char *) file_path + + ((char *) d - (char *) dp)); +- copy_file_path ((grub_efi_file_path_device_path_t *) d, +- dir_start, dir_end - dir_start); ++ if (copy_file_path ((grub_efi_file_path_device_path_t *) d, ++ dir_start, dir_end - dir_start) != GRUB_ERR_NONE) ++ { ++ fail: ++ grub_free (file_path); ++ return 0; ++ } + + /* Fill the file path for the file. */ + d = GRUB_EFI_NEXT_DEVICE_PATH (d); +- copy_file_path ((grub_efi_file_path_device_path_t *) d, +- dir_end + 1, grub_strlen (dir_end + 1)); ++ if (copy_file_path ((grub_efi_file_path_device_path_t *) d, ++ dir_end + 1, grub_strlen (dir_end + 1)) != GRUB_ERR_NONE) ++ goto fail; + + /* Fill the end of device path nodes. */ + d = GRUB_EFI_NEXT_DEVICE_PATH (d); diff --git a/0250-efi-Fix-use-after-free-in-halt-reboot-path.patch b/0250-efi-Fix-use-after-free-in-halt-reboot-path.patch new file mode 100644 index 00000000..b0d52899 --- /dev/null +++ b/0250-efi-Fix-use-after-free-in-halt-reboot-path.patch @@ -0,0 +1,162 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Makhalov +Date: Mon, 20 Jul 2020 23:03:05 +0000 +Subject: [PATCH] efi: Fix use-after-free in halt/reboot path + +commit 92bfc33db984 ("efi: Free malloc regions on exit") +introduced memory freeing in grub_efi_fini(), which is +used not only by exit path but by halt/reboot one as well. +As result of memory freeing, code and data regions used by +modules, such as halt, reboot, acpi (used by halt) also got +freed. After return to module code, CPU executes, filled +by UEFI firmware (tested with edk2), 0xAFAFAFAF pattern as +a code. Which leads to #UD exception later. + +grub> halt +!!!! X64 Exception Type - 06(#UD - Invalid Opcode) CPU Apic ID - 00000000 !!!! +RIP - 0000000003F4EC28, CS - 0000000000000038, RFLAGS - 0000000000200246 +RAX - 0000000000000000, RCX - 00000000061DA188, RDX - 0A74C0854DC35D41 +RBX - 0000000003E10E08, RSP - 0000000007F0F860, RBP - 0000000000000000 +RSI - 00000000064DB768, RDI - 000000000832C5C3 +R8 - 0000000000000002, R9 - 0000000000000000, R10 - 00000000061E2E52 +R11 - 0000000000000020, R12 - 0000000003EE5C1F, R13 - 00000000061E0FF4 +R14 - 0000000003E10D80, R15 - 00000000061E2F60 +DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030 +GS - 0000000000000030, SS - 0000000000000030 +CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000 +CR4 - 0000000000000668, CR8 - 0000000000000000 +DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 +DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 +GDTR - 00000000079EEA98 0000000000000047, LDTR - 0000000000000000 +IDTR - 0000000007598018 0000000000000FFF, TR - 0000000000000000 +FXSAVE_STATE - 0000000007F0F4C0 + +Proposal here is to continue to free allocated memory for +exit boot services path but keep it for halt/reboot path +as it won't be much security concern here. +Introduced GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY +loader flag to be used by efi halt/reboot path. + +Signed-off-by: Alexey Makhalov +Reviewed-by: Darren Kenny +--- + grub-core/kern/arm/efi/init.c | 3 +++ + grub-core/kern/arm64/efi/init.c | 3 +++ + grub-core/kern/efi/efi.c | 3 ++- + grub-core/kern/efi/init.c | 1 - + grub-core/kern/i386/efi/init.c | 9 +++++++-- + grub-core/kern/ia64/efi/init.c | 9 +++++++-- + grub-core/lib/efi/halt.c | 3 ++- + include/grub/loader.h | 1 + + 8 files changed, 25 insertions(+), 7 deletions(-) + +diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c +index 06df60e2f0e..40c3b467fc6 100644 +--- a/grub-core/kern/arm/efi/init.c ++++ b/grub-core/kern/arm/efi/init.c +@@ -71,4 +71,7 @@ grub_machine_fini (int flags) + efi_call_1 (b->close_event, tmr_evt); + + grub_efi_fini (); ++ ++ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) ++ grub_efi_memory_fini (); + } +diff --git a/grub-core/kern/arm64/efi/init.c b/grub-core/kern/arm64/efi/init.c +index 6224999ec9c..5010caefd66 100644 +--- a/grub-core/kern/arm64/efi/init.c ++++ b/grub-core/kern/arm64/efi/init.c +@@ -57,4 +57,7 @@ grub_machine_fini (int flags) + return; + + grub_efi_fini (); ++ ++ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) ++ grub_efi_memory_fini (); + } +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 8c09e60987d..5ee739d51ae 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -157,7 +157,8 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) + void + grub_reboot (void) + { +- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); ++ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN | ++ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY); + efi_call_4 (grub_efi_system_table->runtime_services->reset_system, + GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL); + for (;;) ; +diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index d1afa3af11e..2ffb5205dda 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -131,5 +131,4 @@ grub_efi_fini (void) + { + grub_efidisk_fini (); + grub_console_fini (); +- grub_efi_memory_fini (); + } +diff --git a/grub-core/kern/i386/efi/init.c b/grub-core/kern/i386/efi/init.c +index da499aba04e..deb2eacd8d8 100644 +--- a/grub-core/kern/i386/efi/init.c ++++ b/grub-core/kern/i386/efi/init.c +@@ -39,6 +39,11 @@ grub_machine_init (void) + void + grub_machine_fini (int flags) + { +- if (flags & GRUB_LOADER_FLAG_NORETURN) +- grub_efi_fini (); ++ if (!(flags & GRUB_LOADER_FLAG_NORETURN)) ++ return; ++ ++ grub_efi_fini (); ++ ++ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) ++ grub_efi_memory_fini (); + } +diff --git a/grub-core/kern/ia64/efi/init.c b/grub-core/kern/ia64/efi/init.c +index b5ecbd09121..f1965571b1d 100644 +--- a/grub-core/kern/ia64/efi/init.c ++++ b/grub-core/kern/ia64/efi/init.c +@@ -70,6 +70,11 @@ grub_machine_init (void) + void + grub_machine_fini (int flags) + { +- if (flags & GRUB_LOADER_FLAG_NORETURN) +- grub_efi_fini (); ++ if (!(flags & GRUB_LOADER_FLAG_NORETURN)) ++ return; ++ ++ grub_efi_fini (); ++ ++ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) ++ grub_efi_memory_fini (); + } +diff --git a/grub-core/lib/efi/halt.c b/grub-core/lib/efi/halt.c +index 5859f0498a8..29d41364168 100644 +--- a/grub-core/lib/efi/halt.c ++++ b/grub-core/lib/efi/halt.c +@@ -28,7 +28,8 @@ + void + grub_halt (void) + { +- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); ++ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN | ++ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY); + #if !defined(__ia64__) && !defined(__arm__) && !defined(__aarch64__) && \ + !defined(__riscv) + grub_acpi_halt (); +diff --git a/include/grub/loader.h b/include/grub/loader.h +index 7f82a499fd9..b208642821b 100644 +--- a/include/grub/loader.h ++++ b/include/grub/loader.h +@@ -33,6 +33,7 @@ enum + { + GRUB_LOADER_FLAG_NORETURN = 1, + GRUB_LOADER_FLAG_PXE_NOT_UNLOAD = 2, ++ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY = 4, + }; + + void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void), diff --git a/0251-efi-dhcp-fix-some-allocation-error-checking.patch b/0251-efi-dhcp-fix-some-allocation-error-checking.patch new file mode 100644 index 00000000..75497338 --- /dev/null +++ b/0251-efi-dhcp-fix-some-allocation-error-checking.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 19 Jul 2020 17:11:06 -0400 +Subject: [PATCH] efi+dhcp: fix some allocation error checking. + +Signed-off-by: Peter Jones +--- + grub-core/net/efi/dhcp.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c +index dbef63d8c08..e5c79b748b0 100644 +--- a/grub-core/net/efi/dhcp.c ++++ b/grub-core/net/efi/dhcp.c +@@ -80,7 +80,7 @@ grub_efi_dhcp4_parse_dns (grub_efi_dhcp4_protocol_t *dhcp4, grub_efi_dhcp4_packe + if (status != GRUB_EFI_BUFFER_TOO_SMALL) + return NULL; + +- option_list = grub_malloc (option_count * sizeof(*option_list)); ++ option_list = grub_calloc (option_count, sizeof(*option_list)); + if (!option_list) + return NULL; + +@@ -360,8 +360,11 @@ grub_cmd_efi_bootp6 (struct grub_command *cmd __attribute__ ((unused)), + + if (status == GRUB_EFI_BUFFER_TOO_SMALL && count) + { +- options = grub_malloc (count * sizeof(*options)); +- status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options); ++ options = grub_calloc (count, sizeof(*options)); ++ if (options) ++ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options); ++ else ++ status = GRUB_EFI_OUT_OF_RESOURCES; + } + + if (status != GRUB_EFI_SUCCESS) diff --git a/0252-efi-http-fix-some-allocation-error-checking.patch b/0252-efi-http-fix-some-allocation-error-checking.patch new file mode 100644 index 00000000..4dffab9e --- /dev/null +++ b/0252-efi-http-fix-some-allocation-error-checking.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 19 Jul 2020 17:14:15 -0400 +Subject: [PATCH] efi+http: fix some allocation error checking. + +Signed-off-by: Peter Jones +--- + grub-core/net/efi/http.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c +index fc8cb25ae0a..26647a50fa4 100644 +--- a/grub-core/net/efi/http.c ++++ b/grub-core/net/efi/http.c +@@ -412,8 +412,8 @@ grub_efihttp_open (struct grub_efi_net_device *dev, + int type) + { + grub_err_t err; +- grub_off_t size; +- char *buf; ++ grub_off_t size = 0; ++ char *buf = NULL; + char *file_name = NULL; + const char *http_path; + +@@ -441,8 +441,11 @@ grub_efihttp_open (struct grub_efi_net_device *dev, + return err; + } + +- buf = grub_malloc (size); +- efihttp_read (dev, buf, size); ++ if (size) ++ { ++ buf = grub_malloc (size); ++ efihttp_read (dev, buf, size); ++ } + + file->size = size; + file->data = buf; diff --git a/0253-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0253-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch new file mode 100644 index 00000000..30c21a58 --- /dev/null +++ b/0253-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch @@ -0,0 +1,127 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Sun, 19 Jul 2020 17:27:00 -0400 +Subject: [PATCH] efi/ip[46]_config.c: fix some potential allocation overflows + +In theory all of this data comes from the firmware stack and it should +be safe, but it's better to be paranoid. + +Signed-off-by: Peter Jones +--- + grub-core/net/efi/ip4_config.c | 25 ++++++++++++++++++------- + grub-core/net/efi/ip6_config.c | 13 ++++++++++--- + 2 files changed, 28 insertions(+), 10 deletions(-) + +diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c +index 313c818b184..9725e928f7e 100644 +--- a/grub-core/net/efi/ip4_config.c ++++ b/grub-core/net/efi/ip4_config.c +@@ -4,15 +4,20 @@ + #include + #include + #include ++#include + + char * + grub_efi_hw_address_to_string (grub_efi_uint32_t hw_address_size, grub_efi_mac_address_t hw_address) + { + char *hw_addr, *p; +- int sz, s; +- int i; ++ grub_size_t sz, s, i; + +- sz = (int)hw_address_size * (sizeof ("XX:") - 1) + 1; ++ if (grub_mul (hw_address_size, sizeof ("XX:") - 1, &sz) || ++ grub_add (sz, 1, &sz)) ++ { ++ grub_errno = GRUB_ERR_OUT_OF_RANGE; ++ return NULL; ++ } + + hw_addr = grub_malloc (sz); + if (!hw_addr) +@@ -20,7 +25,7 @@ grub_efi_hw_address_to_string (grub_efi_uint32_t hw_address_size, grub_efi_mac_a + + p = hw_addr; + s = sz; +- for (i = 0; i < (int)hw_address_size; i++) ++ for (i = 0; i < hw_address_size; i++) + { + grub_snprintf (p, sz, "%02x:", hw_address[i]); + p += sizeof ("XX:") - 1; +@@ -238,14 +243,20 @@ grub_efi_ip4_interface_route_table (struct grub_efi_net_device *dev) + { + grub_efi_ip4_config2_interface_info_t *interface_info; + char **ret; +- int i, id; ++ int id; ++ grub_size_t i, nmemb; + + interface_info = efi_ip4_config_interface_info (dev->ip4_config); + if (!interface_info) + return NULL; + +- ret = grub_malloc (sizeof (*ret) * (interface_info->route_table_size + 1)); ++ if (grub_add (interface_info->route_table_size, 1, &nmemb)) ++ { ++ grub_errno = GRUB_ERR_OUT_OF_RANGE; ++ return NULL; ++ } + ++ ret = grub_calloc (nmemb, sizeof (*ret)); + if (!ret) + { + grub_free (interface_info); +@@ -253,7 +264,7 @@ grub_efi_ip4_interface_route_table (struct grub_efi_net_device *dev) + } + + id = 0; +- for (i = 0; i < (int)interface_info->route_table_size; i++) ++ for (i = 0; i < interface_info->route_table_size; i++) + { + char *subnet, *gateway, *mask; + grub_uint32_t u32_subnet, u32_gateway; +diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c +index 017c4d05bc7..a46f6f9b685 100644 +--- a/grub-core/net/efi/ip6_config.c ++++ b/grub-core/net/efi/ip6_config.c +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + + char * + grub_efi_ip6_address_to_string (grub_efi_pxe_ipv6_address_t *address) +@@ -228,14 +229,20 @@ grub_efi_ip6_interface_route_table (struct grub_efi_net_device *dev) + { + grub_efi_ip6_config_interface_info_t *interface_info; + char **ret; +- int i, id; ++ int id; ++ grub_size_t i, nmemb; + + interface_info = efi_ip6_config_interface_info (dev->ip6_config); + if (!interface_info) + return NULL; + +- ret = grub_malloc (sizeof (*ret) * (interface_info->route_count + 1)); ++ if (grub_add (interface_info->route_count, 1, &nmemb)) ++ { ++ grub_errno = GRUB_ERR_OUT_OF_RANGE; ++ return NULL; ++ } + ++ ret = grub_calloc (nmemb, sizeof (*ret)); + if (!ret) + { + grub_free (interface_info); +@@ -243,7 +250,7 @@ grub_efi_ip6_interface_route_table (struct grub_efi_net_device *dev) + } + + id = 0; +- for (i = 0; i < (int)interface_info->route_count ; i++) ++ for (i = 0; i < interface_info->route_count ; i++) + { + char *gateway, *destination; + grub_uint64_t u64_gateway[2]; diff --git a/0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch new file mode 100644 index 00000000..3f0b01d2 --- /dev/null +++ b/0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Colin Watson +Date: Fri, 24 Jul 2020 17:18:09 +0100 +Subject: [PATCH] efilinux: Fix integer overflows in grub_cmd_initrd + +These could be triggered by an extremely large number of arguments to +the initrd command on 32-bit architectures, or a crafted filesystem with +very large files on any architecture. + +Signed-off-by: Colin Watson +--- + grub-core/loader/i386/efi/linux.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index e5b2736b0ce..c0a98d152ff 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -28,6 +28,8 @@ + #include + #include + #include ++#include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -206,7 +208,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- files = grub_zalloc (argc * sizeof (files[0])); ++ files = grub_calloc (argc, sizeof (files[0])); + if (!files) + goto fail; + +@@ -216,7 +218,11 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + if (! files[i]) + goto fail; + nfiles++; +- size += ALIGN_UP (grub_file_size (files[i]), 4); ++ if (grub_add (size, ALIGN_UP (grub_file_size (files[i]), 4), &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ goto fail; ++ } + } + + initrd_mem = kernel_alloc(size, N_("can't allocate initrd")); diff --git a/0255-efi-Fix-use-after-free-in-halt-reboot-path.patch b/0255-efi-Fix-use-after-free-in-halt-reboot-path.patch new file mode 100644 index 00000000..93efaf67 --- /dev/null +++ b/0255-efi-Fix-use-after-free-in-halt-reboot-path.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexey Makhalov +Date: Mon, 20 Jul 2020 23:03:05 +0000 +Subject: [PATCH] efi: Fix use-after-free in halt/reboot path + +commit 92bfc33db984 ("efi: Free malloc regions on exit") +introduced memory freeing in grub_efi_fini(), which is +used not only by exit path but by halt/reboot one as well. +As result of memory freeing, code and data regions used by +modules, such as halt, reboot, acpi (used by halt) also got +freed. After return to module code, CPU executes, filled +by UEFI firmware (tested with edk2), 0xAFAFAFAF pattern as +a code. Which leads to #UD exception later. + +grub> halt +!!!! X64 Exception Type - 06(#UD - Invalid Opcode) CPU Apic ID - 00000000 !!!! +RIP - 0000000003F4EC28, CS - 0000000000000038, RFLAGS - 0000000000200246 +RAX - 0000000000000000, RCX - 00000000061DA188, RDX - 0A74C0854DC35D41 +RBX - 0000000003E10E08, RSP - 0000000007F0F860, RBP - 0000000000000000 +RSI - 00000000064DB768, RDI - 000000000832C5C3 +R8 - 0000000000000002, R9 - 0000000000000000, R10 - 00000000061E2E52 +R11 - 0000000000000020, R12 - 0000000003EE5C1F, R13 - 00000000061E0FF4 +R14 - 0000000003E10D80, R15 - 00000000061E2F60 +DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030 +GS - 0000000000000030, SS - 0000000000000030 +CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000 +CR4 - 0000000000000668, CR8 - 0000000000000000 +DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 +DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 +GDTR - 00000000079EEA98 0000000000000047, LDTR - 0000000000000000 +IDTR - 0000000007598018 0000000000000FFF, TR - 0000000000000000 +FXSAVE_STATE - 0000000007F0F4C0 + +Proposal here is to continue to free allocated memory for +exit boot services path but keep it for halt/reboot path +as it won't be much security concern here. +Introduced GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY +loader flag to be used by efi halt/reboot path. + +Signed-off-by: Alexey Makhalov +Reviewed-by: Darren Kenny +--- + grub-core/kern/riscv/efi/init.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/kern/riscv/efi/init.c b/grub-core/kern/riscv/efi/init.c +index 7eb1969d0b0..38795fe6741 100644 +--- a/grub-core/kern/riscv/efi/init.c ++++ b/grub-core/kern/riscv/efi/init.c +@@ -73,4 +73,7 @@ grub_machine_fini (int flags) + return; + + grub_efi_fini (); ++ ++ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) ++ grub_efi_memory_fini (); + } diff --git a/0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch b/0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch new file mode 100644 index 00000000..51f39e5d --- /dev/null +++ b/0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 24 Jul 2020 13:57:27 -0400 +Subject: [PATCH] linux loader: avoid overflow on initrd size calculation + +Signed-off-by: Peter Jones +--- + grub-core/loader/linux.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c +index 471b214d6c3..25624ebc114 100644 +--- a/grub-core/loader/linux.c ++++ b/grub-core/loader/linux.c +@@ -151,8 +151,8 @@ grub_initrd_init (int argc, char *argv[], + initrd_ctx->nfiles = 0; + initrd_ctx->components = 0; + +- initrd_ctx->components = grub_zalloc (argc +- * sizeof (initrd_ctx->components[0])); ++ initrd_ctx->components = grub_calloc (argc, ++ sizeof (initrd_ctx->components[0])); + if (!initrd_ctx->components) + return grub_errno; + diff --git a/0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch new file mode 100644 index 00000000..3d046722 --- /dev/null +++ b/0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch @@ -0,0 +1,130 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Wed, 22 Jul 2020 11:31:43 +0100 +Subject: [PATCH] linuxefi: fail kernel validation without shim protocol. + +If certificates that signed grub are installed into db, grub can be +booted directly. It will then boot any kernel without signature +validation. The booted kernel will think it was booted in secureboot +mode and will implement lockdown, yet it could have been tampered. + +This version of the patch skips calling verification, when booted +without secureboot. And is indented with gnu ident. + +CVE-2020-15705 + +Reported-by: Mathieu Trudel-Lapierre +Signed-off-by: Dimitri John Ledkov +--- + grub-core/loader/arm64/linux.c | 13 +++++++++---- + grub-core/loader/efi/chainloader.c | 1 + + grub-core/loader/efi/linux.c | 1 + + grub-core/loader/i386/efi/linux.c | 17 +++++++++++------ + 4 files changed, 22 insertions(+), 10 deletions(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index 8791b35b6fe..720eec075cd 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -383,11 +384,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); + +- rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size); +- if (rc < 0) ++ if (grub_efi_secure_boot ()) + { +- grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); +- goto fail; ++ rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size); ++ if (rc <= 0) ++ { ++ grub_error (GRUB_ERR_INVALID_COMMAND, ++ N_("%s has invalid signature"), argv[0]); ++ goto fail; ++ } + } + + pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 3dfa41bb49d..26f4fa9dc6a 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -1083,6 +1083,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + + return 0; + } ++ // -1 fall-through to fail + + fail: + if (dev) +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index e09f824862b..927d89a90d7 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -33,6 +33,7 @@ struct grub_efi_shim_lock + }; + typedef struct grub_efi_shim_lock grub_efi_shim_lock_t; + ++// Returns 1 on success, -1 on error, 0 when not available + int + grub_linuxefi_secure_validate (void *data, grub_uint32_t size) + { +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index c0a98d152ff..60ef7d12f07 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -101,7 +102,7 @@ kernel_alloc(grub_efi_uintn_t size, const char * const errmsg) + + pages = BYTES_TO_PAGES(size); + grub_dprintf ("linux", "Trying to allocate %lu pages from %p\n", +- pages, (void *)max); ++ (unsigned long)pages, (void *)(unsigned long)max); + + prev_max = max; + addr = grub_efi_allocate_pages_real (max, pages, +@@ -307,12 +308,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- rc = grub_linuxefi_secure_validate (kernel, filelen); +- if (rc < 0) ++ if (grub_efi_secure_boot ()) + { +- grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), +- argv[0]); +- goto fail; ++ rc = grub_linuxefi_secure_validate (kernel, filelen); ++ if (rc <= 0) ++ { ++ grub_error (GRUB_ERR_INVALID_COMMAND, ++ N_("%s has invalid signature"), argv[0]); ++ goto fail; ++ } + } + + lh = (struct linux_i386_kernel_header *)kernel; +@@ -386,6 +390,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + setup_header_end_offset = *((grub_uint8_t *)kernel + 0x201); + grub_dprintf ("linux", "copying %lu bytes from %p to %p\n", ++ (unsigned long) + MIN((grub_size_t)0x202+setup_header_end_offset, + sizeof (*params)) - 0x1f1, + (grub_uint8_t *)kernel + 0x1f1, diff --git a/0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch b/0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch new file mode 100644 index 00000000..b784faa9 --- /dev/null +++ b/0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch @@ -0,0 +1,166 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Colin Watson +Date: Sat, 25 Jul 2020 12:15:37 +0100 +Subject: [PATCH] linux: Fix integer overflows in initrd size handling + +These could be triggered by a crafted filesystem with very large files. + +Fixes: CVE-2020-15707 + +Signed-off-by: Colin Watson +Reviewed-by: Jan Setje-Eilers +--- + grub-core/loader/linux.c | 75 +++++++++++++++++++++++++++++++++++------------- + 1 file changed, 55 insertions(+), 20 deletions(-) + +diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c +index 25624ebc114..1af142f5760 100644 +--- a/grub-core/loader/linux.c ++++ b/grub-core/loader/linux.c +@@ -4,6 +4,8 @@ + #include + #include + #include ++#include ++#include + + struct newc_head + { +@@ -98,13 +100,13 @@ free_dir (struct dir *root) + grub_free (root); + } + +-static grub_size_t ++static grub_err_t + insert_dir (const char *name, struct dir **root, +- grub_uint8_t *ptr) ++ grub_uint8_t *ptr, grub_size_t *size) + { + struct dir *cur, **head = root; + const char *cb, *ce = name; +- grub_size_t size = 0; ++ *size = 0; + while (1) + { + for (cb = ce; *cb == '/'; cb++); +@@ -130,14 +132,22 @@ insert_dir (const char *name, struct dir **root, + ptr = make_header (ptr, name, ce - name, + 040777, 0); + } +- size += ALIGN_UP ((ce - (char *) name) +- + sizeof (struct newc_head), 4); ++ if (grub_add (*size, ++ ALIGN_UP ((ce - (char *) name) ++ + sizeof (struct newc_head), 4), ++ size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ grub_free (n->name); ++ grub_free (n); ++ return grub_errno; ++ } + *head = n; + cur = n; + } + root = &cur->next; + } +- return size; ++ return GRUB_ERR_NONE; + } + + grub_err_t +@@ -173,26 +183,33 @@ grub_initrd_init (int argc, char *argv[], + eptr = grub_strchr (ptr, ':'); + if (eptr) + { ++ grub_size_t dir_size, name_len; ++ + initrd_ctx->components[i].newc_name = grub_strndup (ptr, eptr - ptr); +- if (!initrd_ctx->components[i].newc_name) ++ if (!initrd_ctx->components[i].newc_name || ++ insert_dir (initrd_ctx->components[i].newc_name, &root, 0, ++ &dir_size)) + { + grub_initrd_close (initrd_ctx); + return grub_errno; + } +- initrd_ctx->size +- += ALIGN_UP (sizeof (struct newc_head) +- + grub_strlen (initrd_ctx->components[i].newc_name), +- 4); +- initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name, +- &root, 0); ++ name_len = grub_strlen (initrd_ctx->components[i].newc_name); ++ if (grub_add (initrd_ctx->size, ++ ALIGN_UP (sizeof (struct newc_head) + name_len, 4), ++ &initrd_ctx->size) || ++ grub_add (initrd_ctx->size, dir_size, &initrd_ctx->size)) ++ goto overflow; + newc = 1; + fname = eptr + 1; + } + } + else if (newc) + { +- initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head) +- + sizeof ("TRAILER!!!") - 1, 4); ++ if (grub_add (initrd_ctx->size, ++ ALIGN_UP (sizeof (struct newc_head) ++ + sizeof ("TRAILER!!!") - 1, 4), ++ &initrd_ctx->size)) ++ goto overflow; + free_dir (root); + root = 0; + newc = 0; +@@ -208,19 +225,29 @@ grub_initrd_init (int argc, char *argv[], + initrd_ctx->nfiles++; + initrd_ctx->components[i].size + = grub_file_size (initrd_ctx->components[i].file); +- initrd_ctx->size += initrd_ctx->components[i].size; ++ if (grub_add (initrd_ctx->size, initrd_ctx->components[i].size, ++ &initrd_ctx->size)) ++ goto overflow; + } + + if (newc) + { + initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4); +- initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head) +- + sizeof ("TRAILER!!!") - 1, 4); ++ if (grub_add (initrd_ctx->size, ++ ALIGN_UP (sizeof (struct newc_head) ++ + sizeof ("TRAILER!!!") - 1, 4), ++ &initrd_ctx->size)) ++ goto overflow; + free_dir (root); + root = 0; + } + + return GRUB_ERR_NONE; ++ ++overflow: ++ free_dir (root); ++ grub_initrd_close (initrd_ctx); ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); + } + + grub_size_t +@@ -261,8 +288,16 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx, + + if (initrd_ctx->components[i].newc_name) + { +- ptr += insert_dir (initrd_ctx->components[i].newc_name, +- &root, ptr); ++ grub_size_t dir_size; ++ ++ if (insert_dir (initrd_ctx->components[i].newc_name, &root, ptr, ++ &dir_size)) ++ { ++ free_dir (root); ++ grub_initrd_close (initrd_ctx); ++ return grub_errno; ++ } ++ ptr += dir_size; + ptr = make_header (ptr, initrd_ctx->components[i].newc_name, + grub_strlen (initrd_ctx->components[i].newc_name), + 0100777, diff --git a/0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch b/0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch new file mode 100644 index 00000000..62658d25 --- /dev/null +++ b/0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 20 Jul 2020 12:24:02 -0400 +Subject: [PATCH] Fix const char ** pointers in grub-core/commands/blscfg.c + +This will need to get folded back in the right place on the next rebase, +but it's before "Make grub_strtol() "end" pointers have safer const +qualifiers" currently, so for now I'm leaving it here instead of merging +it back with the original patch. + +Signed-off-by: Peter Jones +--- + grub-core/commands/blscfg.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 4ec6504d9a4..e907a6a5d28 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -612,7 +612,7 @@ static char **bls_make_list (struct bls_entry *entry, const char *key, int *num) + return list; + } + +-static char *field_append(bool is_var, char *buffer, char *start, char *end) ++static char *field_append(bool is_var, char *buffer, const char *start, const char *end) + { + char *tmp = grub_strndup(start, end - start + 1); + const char *field = tmp; +@@ -641,11 +641,11 @@ static char *field_append(bool is_var, char *buffer, char *start, char *end) + return buffer; + } + +-static char *expand_val(char *value) ++static char *expand_val(const char *value) + { + char *buffer = NULL; +- char *start = value; +- char *end = value; ++ const char *start = value; ++ const char *end = value; + bool is_var = false; + + if (!value) diff --git a/0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch new file mode 100644 index 00000000..b7e55d3f --- /dev/null +++ b/0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 20 Jul 2020 12:24:02 -0400 +Subject: [PATCH] Fix const char ** pointers in grub-core/net/bootp.c + +This will need to get folded back in the right place on the next rebase, +but it's before "Make grub_strtol() "end" pointers have safer const +qualifiers" currently, so for now I'm leaving it here instead of merging +it back with the original patch. + +Signed-off-by: Peter Jones +--- + grub-core/net/bootp.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index 5a5ebbfb1aa..2658a0cda4e 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -365,7 +365,7 @@ grub_net_configure_by_dhcp_ack (const char *name, + struct grub_net_network_level_interface *inter; + int mask = -1; + char server_ip[sizeof ("xxx.xxx.xxx.xxx")]; +- const grub_uint8_t *opt; ++ const char *opt; + grub_uint8_t opt_len, overload = 0; + const char *boot_file = 0, *server_name = 0; + grub_size_t boot_file_len, server_name_len; +@@ -572,7 +572,7 @@ grub_net_configure_by_dhcp_ack (const char *name, + if (opt && opt_len) + { + grub_env_set_net_property (name, "vendor_class_identifier", (const char *) opt, opt_len); +- if (opt && grub_strcmp (opt, "HTTPClient") == 0) ++ if (opt && grub_strcmp ((char *)opt, "HTTPClient") == 0) + { + char *proto, *ip, *pa; + diff --git a/0261-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0261-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch new file mode 100644 index 00000000..6c16e9ef --- /dev/null +++ b/0261-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 20 Jul 2020 12:24:02 -0400 +Subject: [PATCH] Fix const char ** pointers in grub-core/net/efi/ip4_config.c + +This will need to get folded back in the right place on the next rebase, +but it's before "Make grub_strtol() "end" pointers have safer const +qualifiers" currently, so for now I'm leaving it here instead of merging +it back with the original patch. + +Signed-off-by: Peter Jones +--- + grub-core/net/efi/ip4_config.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c +index 9725e928f7e..cb880fc3e8f 100644 +--- a/grub-core/net/efi/ip4_config.c ++++ b/grub-core/net/efi/ip4_config.c +@@ -61,7 +61,8 @@ int + grub_efi_string_to_ip4_address (const char *val, grub_efi_ipv4_address_t *address, const char **rest) + { + grub_uint32_t newip = 0; +- int i, ncolon = 0; ++ grub_size_t i; ++ int ncolon = 0; + const char *ptr = val; + + /* Check that is not an IPv6 address */ +@@ -78,7 +79,7 @@ grub_efi_string_to_ip4_address (const char *val, grub_efi_ipv4_address_t *addres + for (i = 0; i < 4; i++) + { + unsigned long t; +- t = grub_strtoul (ptr, (char **) &ptr, 0); ++ t = grub_strtoul (ptr, &ptr, 0); + if (grub_errno) + { + grub_errno = GRUB_ERR_NONE; diff --git a/0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch new file mode 100644 index 00000000..7c29683e --- /dev/null +++ b/0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 20 Jul 2020 12:24:02 -0400 +Subject: [PATCH] Fix const char ** pointers in grub-core/net/efi/ip6_config.c + +This will need to get folded back in the right place on the next rebase, +but it's before "Make grub_strtol() "end" pointers have safer const +qualifiers" currently, so for now I'm leaving it here instead of merging +it back with the original patch. + +Signed-off-by: Peter Jones +--- + grub-core/net/efi/ip6_config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c +index a46f6f9b685..1c5415d7185 100644 +--- a/grub-core/net/efi/ip6_config.c ++++ b/grub-core/net/efi/ip6_config.c +@@ -85,7 +85,7 @@ grub_efi_string_to_ip6_address (const char *val, grub_efi_ipv6_address_t *addres + ptr++; + continue; + } +- t = grub_strtoul (ptr, (char **) &ptr, 16); ++ t = grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + { + grub_errno = GRUB_ERR_NONE; diff --git a/0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch new file mode 100644 index 00000000..0fe90c8b --- /dev/null +++ b/0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 20 Jul 2020 12:24:02 -0400 +Subject: [PATCH] Fix const char ** pointers in grub-core/net/efi/net.c + +This will need to get folded back in the right place on the next rebase, +but it's before "Make grub_strtol() "end" pointers have safer const +qualifiers" currently, so for now I'm leaving it here instead of merging +it back with the original patch. + +Signed-off-by: Peter Jones +--- + grub-core/net/efi/net.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c +index a3f0535d43c..78e5442fc52 100644 +--- a/grub-core/net/efi/net.c ++++ b/grub-core/net/efi/net.c +@@ -729,7 +729,7 @@ grub_efi_net_parse_address (const char *address, + { + grub_uint32_t subnet_mask_size; + +- subnet_mask_size = grub_strtoul (rest + 1, (char **) &rest, 0); ++ subnet_mask_size = grub_strtoul (rest + 1, &rest, 0); + + if (!grub_errno && subnet_mask_size <= 32 && *rest == 0) + { +@@ -758,7 +758,7 @@ grub_efi_net_parse_address (const char *address, + { + grub_efi_uint8_t prefix_length; + +- prefix_length = grub_strtoul (rest + 1, (char **) &rest, 0); ++ prefix_length = grub_strtoul (rest + 1, &rest, 0); + if (!grub_errno && prefix_length <= 128 && *rest == 0) + { + ip6->prefix_length = prefix_length; diff --git a/0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch new file mode 100644 index 00000000..59f29e4f --- /dev/null +++ b/0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 20 Jul 2020 12:24:02 -0400 +Subject: [PATCH] Fix const char ** pointers in grub-core/net/efi/pxe.c + +This will need to get folded back in the right place on the next rebase, +but it's before "Make grub_strtol() "end" pointers have safer const +qualifiers" currently, so for now I'm leaving it here instead of merging +it back with the original patch. + +Signed-off-by: Peter Jones +--- + grub-core/net/efi/pxe.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c +index 531949cba5c..73e2bb01c1b 100644 +--- a/grub-core/net/efi/pxe.c ++++ b/grub-core/net/efi/pxe.c +@@ -187,7 +187,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) + ptr++; + continue; + } +- t = grub_strtoul (ptr, (char **) &ptr, 16); ++ t = grub_strtoul (ptr, &ptr, 16); + if (grub_errno) + { + grub_errno = GRUB_ERR_NONE; +@@ -225,7 +225,7 @@ pxe_open (struct grub_efi_net_device *dev, + int type __attribute__((unused))) + { + int i; +- char *p; ++ const char *p; + grub_efi_status_t status; + grub_efi_pxe_ip_address_t server_ip; + grub_efi_uint64_t file_size = 0; +@@ -313,7 +313,7 @@ pxe_read (struct grub_efi_net_device *dev, + grub_size_t len) + { + int i; +- char *p; ++ const char *p; + grub_efi_status_t status; + grub_efi_pxe_t *pxe = (prefer_ip6) ? dev->ip6_pxe : dev->ip4_pxe; + grub_efi_uint64_t bufsz = len; diff --git a/0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch b/0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch new file mode 100644 index 00000000..e3d1be4b --- /dev/null +++ b/0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 20 Jul 2020 12:24:02 -0400 +Subject: [PATCH] Fix const char ** pointers in grub-core/net/url.c + +This will need to get folded back in the right place on the next rebase, +but it's before "Make grub_strtol() "end" pointers have safer const +qualifiers" currently, so for now I'm leaving it here instead of merging +it back with the original patch. + +Signed-off-by: Peter Jones +--- + grub-core/net/url.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/net/url.c b/grub-core/net/url.c +index 146858284cd..d9d2fc9a9dc 100644 +--- a/grub-core/net/url.c ++++ b/grub-core/net/url.c +@@ -235,7 +235,7 @@ extract_http_url_info (char *url, int ssl, + c = *port_end; + *port_end = '\0'; + +- portul = grub_strtoul (port_off, &separator, 10); ++ portul = grub_strtoul (port_off, (const char **)&separator, 10); + *port_end = c; + #ifdef URL_TEST + if (portul == ULONG_MAX && errno == ERANGE) diff --git a/grub.macros b/grub.macros index 56d6bbdb..c451aadc 100644 --- a/grub.macros +++ b/grub.macros @@ -376,8 +376,13 @@ done \ -p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \ %{4}./grub-mkimage -O %{1} -o %{3}.orig \\\ -p /EFI/BOOT -d grub-core ${GRUB_MODULES} \ -%{expand:%%{pesign -s -i %%{2}.orig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \ -%{expand:%%{pesign -s -i %%{3}.orig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \ +%{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \ +%{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \ +%{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ +%{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ +%{expand:%%define __pesign_client_cert grub2-signer} \ +%{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \ +%{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \ %{nil} %else %define mkimage() \ diff --git a/grub.patches b/grub.patches index 43421fc8..1c006af1 100644 --- a/grub.patches +++ b/grub.patches @@ -220,3 +220,46 @@ Patch0219: 0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch Patch0220: 0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch Patch0221: 0221-fix-build-with-rpm-4.16.patch Patch0222: 0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch +Patch0223: 0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0224: 0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0225: 0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch +Patch0226: 0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch +Patch0227: 0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch +Patch0228: 0228-calloc-Use-calloc-at-most-places.patch +Patch0229: 0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch +Patch0230: 0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch +Patch0231: 0231-font-Do-not-load-more-than-one-NAME-section.patch +Patch0232: 0232-gfxmenu-Fix-double-free-in-load_image.patch +Patch0233: 0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch +Patch0234: 0234-lzma-Make-sure-we-don-t-dereference-past-array.patch +Patch0235: 0235-term-Fix-overflow-on-user-inputs.patch +Patch0236: 0236-udf-Fix-memory-leak.patch +Patch0237: 0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch +Patch0238: 0238-tftp-Do-not-use-priority-queue.patch +Patch0239: 0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch +Patch0240: 0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch +Patch0241: 0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch +Patch0242: 0242-script-Remove-unused-fields-from-grub_script_functio.patch +Patch0243: 0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch +Patch0244: 0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch +Patch0245: 0245-hfsplus-fix-two-more-overflows.patch +Patch0246: 0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch +Patch0247: 0247-emu-make-grub_free-NULL-safe.patch +Patch0248: 0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch +Patch0249: 0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch +Patch0250: 0250-efi-Fix-use-after-free-in-halt-reboot-path.patch +Patch0251: 0251-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0252: 0252-efi-http-fix-some-allocation-error-checking.patch +Patch0253: 0253-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0254: 0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0255: 0255-efi-Fix-use-after-free-in-halt-reboot-path.patch +Patch0256: 0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch +Patch0257: 0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0258: 0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch +Patch0259: 0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch +Patch0260: 0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0261: 0261-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0262: 0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0263: 0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0264: 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0265: 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch diff --git a/grub2.spec b/grub2.spec index f50174d0..d8d4dbe9 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 26%{?dist} +Release: 27%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -509,8 +509,20 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Aug 10 2020 Peter Jones - 2.04-27 +- Attempt to enable dual-signing in f33 +- "Minor" bug fixes. For f33: + Resolves: CVE-2020-10713 + Resolves: CVE-2020-14308 + Resolves: CVE-2020-14309 + Resolves: CVE-2020-14310 + Resolves: CVE-2020-14311 + Resolves: CVE-2020-15705 + Resolves: CVE-2020-15706 + Resolves: CVE-2020-15707 + * Tue Jun 30 2020 Jeff Law - 2.04-26 -Disable LTO +- Disable LTO * Thu Jun 18 2020 Javier Martinez Canillas - 2.04-25 - Only mark GRUB as BLS supported in OSTree systems with a boot partition From db0149e860e316ff1238cc5681d9948ca6ef26e3 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 12 Aug 2020 11:39:25 +0200 Subject: [PATCH 036/294] Add support for "systemctl reboot --boot-loader-menu=xx" Related: rhbz#1857389 Signed-off-by: Javier Martinez Canillas --- ...gration-scripts-to-make-systemctl-re.patch | 190 ++++++++++++++++++ ...ion.sh-Also-set-old-menu_show_once-g.patch | 32 +++ grub.patches | 2 + grub2.spec | 13 +- 4 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch create mode 100644 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch new file mode 100644 index 00000000..faf51393 --- /dev/null +++ b/0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -0,0 +1,190 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 22 Jul 2020 14:03:42 +0200 +Subject: [PATCH] Add systemd integration scripts to make "systemctl reboot + --boot-loader-menu=xxx" work with grub + +This commit adds a number of scripts / config files to make +"systemctl reboot --boot-loader-menu=xxx" work with grub: + +1. /lib/systemd/system/systemd-logind.service.d/10-grub.conf +This sets SYSTEMD_REBOOT_TO_BOOT_LOADER_MENU in the env. for logind, +indicating that the boot-loader which is used supports this feature, see: +https://github.com/systemd/systemd/blob/master/docs/ENVIRONMENT.md + +2. /lib/systemd/system/grub-systemd-integration.service + /lib/systemd/system/reboot.target.wants/grub-systemd-integration.service -> + ../grub-systemd-integration.service + /usr/libexec/grub/grub-systemd-integration.sh + +The symlink in the .wants dir causes the added service file to be started +by systemd just before rebooting the system. +If /run/systemd/reboot-to-boot-loader-menu exist then the service will run +the grub-systemd-integration.sh script. +This script sets the new menu_show_once_timeout grubenv variable to the +requested timeout in seconds. + +3. /etc/grub.d/14_menu_show_once + +This new grub-mkconfig snippet adds the necessary code to the generated +grub.conf to honor the new menu_show_once_timeout variable, and to +automatically clear it after consuming it. + +Note the service and libexec script use grub-systemd-integration as name +because in the future they may be used to add further integration with +systemctl reboot --foo options, e.g. support for --boot-loader-entry=NAME. + +A few notes about upstreaming this patch from the rhboot grub2 fork: +1. I have deliberately put the grub.conf bits for this in a new / separate + grub-mkconfig snippet generator for easy upstreaming +2. Even though the commit message mentions the .wants symlink for the .service + I have been unable to come up with a clean way to do this at "make install" + time, this should be fixed before upstreaming. + +Downstream notes: +1. Since make install does not add the .wants symlink, this needs to be done + in grub2.spec %install +2. This is keeping support for the "old" Fedora specific menu_show_once env + variable, which has a hardcoded timeout of 60 sec in 12_menu_auto_hide in + place for now. This can be dropped (eventually) in a follow-up patch once + GNOME has been converted to use the systemd dbus API equivalent of + "systemctl reboot --boot-loader-menu=xxx". + +Signed-off-by: Hans de Goede +--- + Makefile.util.def | 27 ++++++++++++++++++++++++ + conf/Makefile.common | 6 ++++++ + util/grub.d/14_menu_show_once.in | 13 ++++++++++++ + util/systemd/10-grub-logind-service.conf.in | 2 ++ + util/systemd/grub-systemd-integration.service.in | 8 +++++++ + util/systemd/systemd-integration.sh.in | 6 ++++++ + 6 files changed, 62 insertions(+) + create mode 100755 util/grub.d/14_menu_show_once.in + create mode 100644 util/systemd/10-grub-logind-service.conf.in + create mode 100644 util/systemd/grub-systemd-integration.service.in + create mode 100644 util/systemd/systemd-integration.sh.in + +diff --git a/Makefile.util.def b/Makefile.util.def +index f3a699691bf..dc8d1790ea5 100644 +--- a/Makefile.util.def ++++ b/Makefile.util.def +@@ -469,6 +469,12 @@ script = { + installdir = grubconf; + }; + ++script = { ++ name = '14_menu_show_once'; ++ common = util/grub.d/14_menu_show_once.in; ++ installdir = grubconf; ++}; ++ + script = { + name = '01_users'; + common = util/grub.d/01_users.in; +@@ -568,6 +574,27 @@ script = { + installdir = grubconf; + }; + ++script = { ++ name = 'grub-systemd-integration.service'; ++ common = util/systemd/grub-systemd-integration.service.in; ++ installdir = systemdunit; ++ condition = COND_HOST_LINUX; ++}; ++ ++script = { ++ name = 'systemd-integration.sh'; ++ common = util/systemd/systemd-integration.sh.in; ++ installdir = grublibexec; ++ condition = COND_HOST_LINUX; ++}; ++ ++script = { ++ name = '10-grub-logind-service.conf'; ++ common = util/systemd/10-grub-logind-service.conf.in; ++ installdir = systemd_logind_service_d; ++ condition = COND_HOST_LINUX; ++}; ++ + program = { + mansection = 1; + name = grub-mkrescue; +diff --git a/conf/Makefile.common b/conf/Makefile.common +index 87c1f0e809b..6b85eb394ce 100644 +--- a/conf/Makefile.common ++++ b/conf/Makefile.common +@@ -63,8 +63,11 @@ CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS) + # Other variables + + grubconfdir = $(sysconfdir)/grub.d ++grublibexecdir = $(libexecdir)/$(grubdirname) + platformdir = $(pkglibdir)/$(target_cpu)-$(platform) + starfielddir = $(pkgdatadir)/themes/starfield ++systemdunitdir = ${prefix}/lib/systemd/system ++systemd_logind_service_ddir = $(systemdunitdir)/systemd-logind.service.d + + CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Werror=trampolines -fno-trampolines + CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib +@@ -119,6 +122,9 @@ noinst_LIBRARIES = + dist_noinst_DATA = + platform_SCRIPTS = + platform_PROGRAMS = ++grublibexec_SCRIPTS = ++systemdunit_SCRIPTS = ++systemd_logind_service_d_SCRIPTS = + + TESTS = + EXTRA_DIST = +diff --git a/util/grub.d/14_menu_show_once.in b/util/grub.d/14_menu_show_once.in +new file mode 100755 +index 00000000000..1cd7f36142b +--- /dev/null ++++ b/util/grub.d/14_menu_show_once.in +@@ -0,0 +1,13 @@ ++#! /bin/sh ++# Force the menu to be shown once, with a timeout of ${menu_show_once_timeout} ++# if requested by ${menu_show_once_timeout} being set in the env. ++cat << EOF ++if [ x\$feature_timeout_style = xy ]; then ++ if [ "\${menu_show_once_timeout}" ]; then ++ set timeout_style=menu ++ set timeout="\${menu_show_once_timeout}" ++ unset menu_show_once_timeout ++ save_env menu_show_once_timeout ++ fi ++fi ++EOF +diff --git a/util/systemd/10-grub-logind-service.conf.in b/util/systemd/10-grub-logind-service.conf.in +new file mode 100644 +index 00000000000..f2d4ac00732 +--- /dev/null ++++ b/util/systemd/10-grub-logind-service.conf.in +@@ -0,0 +1,2 @@ ++[Service] ++Environment=SYSTEMD_REBOOT_TO_BOOT_LOADER_MENU=true +diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in +new file mode 100644 +index 00000000000..c81fb594ce1 +--- /dev/null ++++ b/util/systemd/grub-systemd-integration.service.in +@@ -0,0 +1,8 @@ ++[Unit] ++Description=Grub2 systemctl reboot --boot-loader-menu=... support ++Before=umount.target systemd-reboot.service ++DefaultDependencies=no ++ConditionPathExists=/run/systemd/reboot-to-boot-loader-menu ++ ++[Service] ++ExecStart=@libexecdir@/@grubdirname@/systemd-integration.sh +diff --git a/util/systemd/systemd-integration.sh.in b/util/systemd/systemd-integration.sh.in +new file mode 100644 +index 00000000000..dc1218597bc +--- /dev/null ++++ b/util/systemd/systemd-integration.sh.in +@@ -0,0 +1,6 @@ ++#!/bin/sh ++ ++TIMEOUT_USEC=$(cat /run/systemd/reboot-to-boot-loader-menu) ++TIMEOUT=$(((TIMEOUT_USEC + 500000) / 1000000)) ++ ++@grub_editenv@ - set menu_show_once_timeout=$TIMEOUT diff --git a/0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch new file mode 100644 index 00000000..9021de50 --- /dev/null +++ b/0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 23 Jul 2020 09:27:36 +0200 +Subject: [PATCH] systemd-integration.sh: Also set old menu_show_once grubenv + var + +Downstream RH / Fedora patch for compatibility with old, not (yet) +regenerated grub.cfg files which miss the menu_show_once_timeout check. +This older grubenv variable leads to a fixed timeout of 60 seconds. + +Note that the new menu_show_once_timeout will overrule these 60 seconds +if both are set and the grub.cfg does have the menu_show_once_timeout +check. + +Signed-off-by: Hans de Goede +--- + util/systemd/systemd-integration.sh.in | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/util/systemd/systemd-integration.sh.in b/util/systemd/systemd-integration.sh.in +index dc1218597bc..a4c071c5b0c 100644 +--- a/util/systemd/systemd-integration.sh.in ++++ b/util/systemd/systemd-integration.sh.in +@@ -4,3 +4,8 @@ TIMEOUT_USEC=$(cat /run/systemd/reboot-to-boot-loader-menu) + TIMEOUT=$(((TIMEOUT_USEC + 500000) / 1000000)) + + @grub_editenv@ - set menu_show_once_timeout=$TIMEOUT ++ ++# Downstream RH / Fedora patch for compatibility with old, not (yet) ++# regenerated grub.cfg files which miss the menu_show_once_timeout check ++# this older grubenv variable leads to a fixed timeout of 60 seconds ++@grub_editenv@ - set menu_show_once=1 diff --git a/grub.patches b/grub.patches index 1c006af1..5c8e8d28 100644 --- a/grub.patches +++ b/grub.patches @@ -263,3 +263,5 @@ Patch0262: 0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch Patch0263: 0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch Patch0264: 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch Patch0265: 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch +Patch0266: 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0267: 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/grub2.spec b/grub2.spec index d8d4dbe9..921a975e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 27%{?dist} +Release: 28%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -263,8 +263,11 @@ ln -s ../grub-boot-success.timer \ # Install systemd system-update unit to set boot_indeterminate for offline-upd install -D -m 0755 -t %{buildroot}%{_unitdir} docs/grub-boot-indeterminate.service install -d -m 0755 %{buildroot}%{_unitdir}/system-update.target.wants +install -d -m 0755 %{buildroot}%{_unitdir}/reboot.target.wants ln -s ../grub-boot-indeterminate.service \ %{buildroot}%{_unitdir}/system-update.target.wants +ln -s ../grub2-systemd-integration.service \ + %{buildroot}%{_unitdir}/reboot.target.wants # Don't run debuginfo on all the grub modules and whatnot; it just # rejects them, complains, and slows down extraction. @@ -398,6 +401,9 @@ rm -r /boot/grub2.tmp/ || : %{_userunitdir}/timers.target.wants %{_unitdir}/grub-boot-indeterminate.service %{_unitdir}/system-update.target.wants +%{_unitdir}/%{name}-systemd-integration.service +%{_unitdir}/reboot.target.wants +%{_unitdir}/systemd-logind.service.d %{_infodir}/%{name}* %{_datarootdir}/grub/* %{_sbindir}/%{name}-install @@ -413,6 +419,7 @@ rm -r /boot/grub2.tmp/ || : %{_bindir}/%{name}-mkimage %{_bindir}/%{name}-mkrelpath %{_bindir}/%{name}-script-check +%{_libexecdir}/%{name} %{_datadir}/man/man?/* # exclude man pages from tools-extra @@ -509,6 +516,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Wed Aug 12 2020 Javier Martinez Canillas - 2.04-28 +- Add support for "systemctl reboot --boot-loader-menu=xx" (hdegoede) + Related: rhbz#1857389 + * Mon Aug 10 2020 Peter Jones - 2.04-27 - Attempt to enable dual-signing in f33 - "Minor" bug fixes. For f33: From cc2f966c5533609cd2a21ffd050cf17f7a74e97f Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 21 Aug 2020 11:11:22 +0200 Subject: [PATCH 037/294] Fix TFTP timeouts when trying to fetch files larger than 65535 KiB Resolves: rhbz#1869335 Signed-off-by: Javier Martinez Canillas --- ...net-and-bootp-add-support-for-dhcpv6.patch | 8 +-- 0066-Normalize-slashes-in-tftp-paths.patch | 2 +- 0086-don-t-ignore-const.patch | 2 +- ...racketed-ipv6-addrs-and-port-numbers.patch | 4 +- 0238-tftp-Do-not-use-priority-queue.patch | 6 +-- ...e-blocksize-from-1024-to-2048-octets.patch | 49 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 ++- 8 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch diff --git a/0064-efinet-and-bootp-add-support-for-dhcpv6.patch b/0064-efinet-and-bootp-add-support-for-dhcpv6.patch index 3f190ff4..0e60b8a4 100644 --- a/0064-efinet-and-bootp-add-support-for-dhcpv6.patch +++ b/0064-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -399,14 +399,14 @@ index 4b7972b8e7e..f24f1fd63f6 100644 grub_err_t grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter, diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 7d90bf66e76..1157524fc50 100644 +index 7d90bf66e76..a5c5038130a 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -379,19 +379,23 @@ tftp_open (struct grub_file *file, const char *filename) return grub_errno; } -+ grub_dprintf("tftp", "resolving address for %s\n", file->device->net->server); ++ grub_dprintf ("tftp", "resolving address for %s\n", file->device->net->server); err = grub_net_resolve_address (file->device->net->server, &addr); if (err) { @@ -416,13 +416,13 @@ index 7d90bf66e76..1157524fc50 100644 return err; } -+ grub_dprintf("tftp", "opening connection\n"); ++ grub_dprintf ("tftp", "opening connection\n"); data->sock = grub_net_udp_open (addr, TFTP_SERVER_PORT, tftp_receive, file); if (!data->sock) { -+ grub_dprintf("tftp", "connection failed\n"); ++ grub_dprintf ("tftp", "connection failed\n"); destroy_pq (data); grub_free (data); return grub_errno; diff --git a/0066-Normalize-slashes-in-tftp-paths.patch b/0066-Normalize-slashes-in-tftp-paths.patch index bed0a5c0..57f5e5eb 100644 --- a/0066-Normalize-slashes-in-tftp-paths.patch +++ b/0066-Normalize-slashes-in-tftp-paths.patch @@ -14,7 +14,7 @@ Signed-off-by: Mark Salter 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 1157524fc50..dcd82494309 100644 +index a5c5038130a..e6d831f1bc9 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -300,6 +300,25 @@ destroy_pq (tftp_data_t data) diff --git a/0086-don-t-ignore-const.patch b/0086-don-t-ignore-const.patch index 6b4d390b..81a20250 100644 --- a/0086-don-t-ignore-const.patch +++ b/0086-don-t-ignore-const.patch @@ -8,7 +8,7 @@ Subject: [PATCH] don't ignore const 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index dcd82494309..f90071353ad 100644 +index e6d831f1bc9..0c02a00255b 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -307,7 +307,7 @@ static void diff --git a/0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch index e014e612..a2701b3d 100644 --- a/0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +++ b/0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch @@ -227,7 +227,7 @@ index 6468eb24596..2734f70d22f 100644 } diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index f90071353ad..e267af354f4 100644 +index 0c02a00255b..4920c3a9783 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -333,6 +333,7 @@ tftp_open (struct grub_file *file, const char *filename) @@ -252,7 +252,7 @@ index f90071353ad..e267af354f4 100644 return err; @@ -413,7 +417,7 @@ tftp_open (struct grub_file *file, const char *filename) - grub_dprintf("tftp", "opening connection\n"); + grub_dprintf ("tftp", "opening connection\n"); data->sock = grub_net_udp_open (addr, - TFTP_SERVER_PORT, tftp_receive, + port ? port : TFTP_SERVER_PORT, tftp_receive, diff --git a/0238-tftp-Do-not-use-priority-queue.patch b/0238-tftp-Do-not-use-priority-queue.patch index 59160d9a..9a1750e3 100644 --- a/0238-tftp-Do-not-use-priority-queue.patch +++ b/0238-tftp-Do-not-use-priority-queue.patch @@ -35,7 +35,7 @@ Upstream-commit-id: 8316694c4f7 1 file changed, 50 insertions(+), 112 deletions(-) diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index e267af354f4..c2df3d7f6ab 100644 +index 4920c3a9783..22badd74316 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -25,7 +25,6 @@ @@ -233,7 +233,7 @@ index e267af354f4..c2df3d7f6ab 100644 - return grub_errno; - } - - grub_dprintf("tftp", "resolving address for %s\n", file->device->net->server); + grub_dprintf ("tftp", "resolving address for %s\n", file->device->net->server); err = grub_net_resolve_address (file->device->net->server, &addr); if (err) @@ -410,7 +353,6 @@ tftp_open (struct grub_file *file, const char *filename) @@ -247,7 +247,7 @@ index e267af354f4..c2df3d7f6ab 100644 @@ -422,7 +364,6 @@ tftp_open (struct grub_file *file, const char *filename) if (!data->sock) { - grub_dprintf("tftp", "connection failed\n"); + grub_dprintf ("tftp", "connection failed\n"); - destroy_pq (data); grub_free (data); return grub_errno; diff --git a/0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch b/0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch new file mode 100644 index 00000000..79765483 --- /dev/null +++ b/0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 20 Aug 2020 13:19:00 +0200 +Subject: [PATCH] tftp: increase blocksize from 1024 to 2048 octets + +The RFC2348 [0] defines how the TFTP Blocksize Option should be negotiated +between the client and the server. GRUB just hardcodes this to 1024, which +limits the maximum file size to be fetched to 65535 KiB, since the block +number is stored in a 16-bit field. + +This limit is a problem when attempting to fetch large files (i.e: initrd +images) because the block number will overflow, and GRUB will never ack a +packet. This causes a timeout when trying to download the file over TFTP. + +Since the TFTP support in GRUB is used primarily to fetch the kernel and +initrd images, let's bump the blocksize to 2048 which would allow to get +files twice as large than the current limit. + +The TFTP support should be improved to define the blocksize dynamically +instead of hardcoding it, but until that happens is better to use a value +that at least allows to fetch a kernel and initrd image with the size that +are present in the install media that is used for network booting. + +[0]: https://tools.ietf.org/html/rfc2348 + +Resolves: rhbz#1869335 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/net/tftp.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index 22badd74316..816050bca43 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -322,9 +322,9 @@ tftp_open (struct grub_file *file, const char *filename) + rrqlen += grub_strlen ("blksize") + 1; + rrq += grub_strlen ("blksize") + 1; + +- grub_strcpy (rrq, "1024"); +- rrqlen += grub_strlen ("1024") + 1; +- rrq += grub_strlen ("1024") + 1; ++ grub_strcpy (rrq, "2048"); ++ rrqlen += grub_strlen ("2048") + 1; ++ rrq += grub_strlen ("2048") + 1; + + grub_strcpy (rrq, "tsize"); + rrqlen += grub_strlen ("tsize") + 1; diff --git a/grub.patches b/grub.patches index 5c8e8d28..8d48b1d3 100644 --- a/grub.patches +++ b/grub.patches @@ -265,3 +265,4 @@ Patch0264: 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch Patch0265: 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch Patch0266: 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch Patch0267: 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0268: 0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch diff --git a/grub2.spec b/grub2.spec index 921a975e..11d51a00 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 28%{?dist} +Release: 29%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -516,6 +516,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Fri Aug 21 2020 Javier Martinez Canillas - 2.04-29 +- Fix TFTP timeouts when trying to fetch files larger than 65535 KiB + Resolves: rhbz#1869335 + * Wed Aug 12 2020 Javier Martinez Canillas - 2.04-28 - Add support for "systemctl reboot --boot-loader-menu=xx" (hdegoede) Related: rhbz#1857389 From ae1167a78d1c61d408a52bffc17525d6620651df Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 21 Aug 2020 15:00:31 +0200 Subject: [PATCH 038/294] Set TFTP blocksize to 1428 instead of 2048 to avoid IP fragmentation Resolves: rhbz#1869335 Signed-off-by: Javier Martinez Canillas --- ...e-blocksize-from-1024-to-1428-octets.patch | 23 +++++++++++-------- grub.patches | 2 +- grub2.spec | 6 ++++- 3 files changed, 19 insertions(+), 12 deletions(-) rename 0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch => 0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch (70%) diff --git a/0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch b/0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch similarity index 70% rename from 0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch rename to 0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch index 79765483..42ae5913 100644 --- a/0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch +++ b/0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch @@ -1,24 +1,27 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 20 Aug 2020 13:19:00 +0200 -Subject: [PATCH] tftp: increase blocksize from 1024 to 2048 octets +Subject: [PATCH] tftp: increase blocksize from 1024 to 1428 octets The RFC2348 [0] defines how the TFTP Blocksize Option should be negotiated between the client and the server. GRUB just hardcodes this to 1024, which -limits the maximum file size to be fetched to 65535 KiB, since the block -number is stored in a 16-bit field. +limits the maximum file size to be downloaded to 67107840 byes, since the +block number is stored in a 16-bit field. This limit is a problem when attempting to fetch large files (i.e: initrd images) because the block number will overflow, and GRUB will never ack a packet. This causes a timeout when trying to download the file over TFTP. Since the TFTP support in GRUB is used primarily to fetch the kernel and -initrd images, let's bump the blocksize to 2048 which would allow to get -files twice as large than the current limit. +initrd images, let's bump the blocksize to 1428 which would allow to get +larger files. + +The value of 1428 is chosen to increase the maximum file size limit, while +avoiding IP packet fragmentation which could be a problem in some networks. The TFTP support should be improved to define the blocksize dynamically instead of hardcoding it, but until that happens is better to use a value -that at least allows to fetch a kernel and initrd image with the size that +that at least allows to fetch kernel and initrd images with the sizes that are present in the install media that is used for network booting. [0]: https://tools.ietf.org/html/rfc2348 @@ -31,7 +34,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 22badd74316..816050bca43 100644 +index 22badd74316..43920885411 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -322,9 +322,9 @@ tftp_open (struct grub_file *file, const char *filename) @@ -41,9 +44,9 @@ index 22badd74316..816050bca43 100644 - grub_strcpy (rrq, "1024"); - rrqlen += grub_strlen ("1024") + 1; - rrq += grub_strlen ("1024") + 1; -+ grub_strcpy (rrq, "2048"); -+ rrqlen += grub_strlen ("2048") + 1; -+ rrq += grub_strlen ("2048") + 1; ++ grub_strcpy (rrq, "1428"); ++ rrqlen += grub_strlen ("1428") + 1; ++ rrq += grub_strlen ("1428") + 1; grub_strcpy (rrq, "tsize"); rrqlen += grub_strlen ("tsize") + 1; diff --git a/grub.patches b/grub.patches index 8d48b1d3..62b22fb0 100644 --- a/grub.patches +++ b/grub.patches @@ -265,4 +265,4 @@ Patch0264: 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch Patch0265: 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch Patch0266: 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch Patch0267: 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0268: 0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch +Patch0268: 0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch diff --git a/grub2.spec b/grub2.spec index 11d51a00..2c038a59 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 29%{?dist} +Release: 30%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -516,6 +516,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Fri Aug 21 2020 Javier Martinez Canillas - 2.04-30 +- Set TFTP blocksize to 1428 instead of 2048 to avoid IP fragmentation + Resolves: rhbz#1869335 + * Fri Aug 21 2020 Javier Martinez Canillas - 2.04-29 - Fix TFTP timeouts when trying to fetch files larger than 65535 KiB Resolves: rhbz#1869335 From f7e054f3d693af43a903faf33b70673f7aca4508 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 31 Aug 2020 14:00:02 +0200 Subject: [PATCH 039/294] Roll over TFTP block counter to prevent timeouts with data packets Resolves: rhbz#1869335 Signed-off-by: Javier Martinez Canillas --- ...e-blocksize-from-1024-to-1428-octets.patch | 52 ------------------- ...lock-counter-to-prevent-timeouts-wit.patch | 51 ++++++++++++++++++ grub.patches | 2 +- grub2.spec | 6 ++- 4 files changed, 57 insertions(+), 54 deletions(-) delete mode 100644 0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch create mode 100644 0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch diff --git a/0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch b/0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch deleted file mode 100644 index 42ae5913..00000000 --- a/0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Thu, 20 Aug 2020 13:19:00 +0200 -Subject: [PATCH] tftp: increase blocksize from 1024 to 1428 octets - -The RFC2348 [0] defines how the TFTP Blocksize Option should be negotiated -between the client and the server. GRUB just hardcodes this to 1024, which -limits the maximum file size to be downloaded to 67107840 byes, since the -block number is stored in a 16-bit field. - -This limit is a problem when attempting to fetch large files (i.e: initrd -images) because the block number will overflow, and GRUB will never ack a -packet. This causes a timeout when trying to download the file over TFTP. - -Since the TFTP support in GRUB is used primarily to fetch the kernel and -initrd images, let's bump the blocksize to 1428 which would allow to get -larger files. - -The value of 1428 is chosen to increase the maximum file size limit, while -avoiding IP packet fragmentation which could be a problem in some networks. - -The TFTP support should be improved to define the blocksize dynamically -instead of hardcoding it, but until that happens is better to use a value -that at least allows to fetch kernel and initrd images with the sizes that -are present in the install media that is used for network booting. - -[0]: https://tools.ietf.org/html/rfc2348 - -Resolves: rhbz#1869335 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/net/tftp.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 22badd74316..43920885411 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -322,9 +322,9 @@ tftp_open (struct grub_file *file, const char *filename) - rrqlen += grub_strlen ("blksize") + 1; - rrq += grub_strlen ("blksize") + 1; - -- grub_strcpy (rrq, "1024"); -- rrqlen += grub_strlen ("1024") + 1; -- rrq += grub_strlen ("1024") + 1; -+ grub_strcpy (rrq, "1428"); -+ rrqlen += grub_strlen ("1428") + 1; -+ rrq += grub_strlen ("1428") + 1; - - grub_strcpy (rrq, "tsize"); - rrqlen += grub_strlen ("tsize") + 1; diff --git a/0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch b/0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch new file mode 100644 index 00000000..e7b5c6ec --- /dev/null +++ b/0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 24 Aug 2020 14:46:27 +0200 +Subject: [PATCH] tftp: roll over block counter to prevent timeouts with data + packets + +The block number is a 16-bit counter which only allows to fetch +files no bigger than 65535 * blksize. To avoid this limit, the +counter is rolled over. This behavior isn't defined in RFC 1350 +but is handled by many TFTP servers and it's what GRUB was doing +before implicitly due an overflow. + +Fixing that bug led to TFTP timeouts, since GRUB wasn't acking +data packets anymore for files with size bigger than the maximum +mentioned above. Restore the old behavior to prevent this issue. + +Resolves: rhbz#1869335 + +Suggested-by: Peter Jones +Signed-off-by: Javier Martinez Canillas +--- + grub-core/net/tftp.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index 22badd74316..acbb01c10e7 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -183,8 +183,20 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), + return GRUB_ERR_NONE; + } + +- /* Ack old/retransmitted block. */ +- if (grub_be_to_cpu16 (tftph->u.data.block) < data->block + 1) ++ /* ++ * Ack old/retransmitted block. ++ * ++ * The block number is a 16-bit counter which only allows to fetch ++ * files no bigger than 65535 * blksize. To avoid this limit, the ++ * counter is rolled over. This behavior isn't defined in RFC 1350 ++ * but is handled by many TFTP servers and it's what GRUB was doing ++ * before implicitly due an overflow. ++ * ++ * Fixing that bug led to TFTP timeouts, since GRUB wasn't acking ++ * data packets anymore for files with size bigger than the maximum ++ * mentioned above. Restore the old behavior to prevent this issue. ++ */ ++ if (grub_be_to_cpu16 (tftph->u.data.block) < ((data->block + 1) & 0xffffu)) + ack (data, grub_be_to_cpu16 (tftph->u.data.block)); + /* Ignore unexpected block. */ + else if (grub_be_to_cpu16 (tftph->u.data.block) > data->block + 1) diff --git a/grub.patches b/grub.patches index 62b22fb0..e5817390 100644 --- a/grub.patches +++ b/grub.patches @@ -265,4 +265,4 @@ Patch0264: 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch Patch0265: 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch Patch0266: 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch Patch0267: 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0268: 0268-tftp-increase-blocksize-from-1024-to-1428-octets.patch +Patch0268: 0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch diff --git a/grub2.spec b/grub2.spec index 2c038a59..646081d9 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 30%{?dist} +Release: 31%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -516,6 +516,10 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Aug 31 2020 Javier Martinez Canillas - 2.04-31 +- Roll over TFTP block counter to prevent timeouts with data packets + Resolves: rhbz#1869335 + * Fri Aug 21 2020 Javier Martinez Canillas - 2.04-30 - Set TFTP blocksize to 1428 instead of 2048 to avoid IP fragmentation Resolves: rhbz#1869335 From fac1a22c9eb2d54123d5bd28ee9c90bce03379f5 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 5 Nov 2020 11:58:00 +0100 Subject: [PATCH 040/294] Remove build dependency on autogen --- grub2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 646081d9..5cfe2199 100644 --- a/grub2.spec +++ b/grub2.spec @@ -40,7 +40,7 @@ BuildRequires: ncurses-devel xz-devel bzip2-devel BuildRequires: freetype-devel libusb-devel BuildRequires: fuse-devel BuildRequires: rpm-devel rpm-libs -BuildRequires: autoconf automake autogen device-mapper-devel +BuildRequires: autoconf automake device-mapper-devel BuildRequires: freetype-devel gettext-devel git BuildRequires: texinfo BuildRequires: dejavu-sans-fonts From 5a625020e29f368860dc80cbd50144955adc778e Mon Sep 17 00:00:00 2001 From: Peetz0r Date: Thu, 3 Dec 2020 05:53:58 +0000 Subject: [PATCH 041/294] Fixed some typos in grub-install.8 man page --- ...ace-a-lot-of-man-pages-with-slightly-nicer-ones.patch | 9 ++++----- grub2.spec | 7 +++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch index 11d8a62f..7a2aa9bf 100644 --- a/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +++ b/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch @@ -44,7 +44,7 @@ Replace a bunch of machine generated ones with ones that look nicer. util/grub-file.1 | 165 ++++++++++++++++++++++++++++++++++++++ util/grub-fstest.1 | 99 +++++++++++++++++++++++ util/grub-glue-efi.1 | 31 +++++++ - util/grub-install.8 | 129 +++++++++++++++++++++++++++++ + util/grub-install.8 | 128 +++++++++++++++++++++++++++++ util/grub-kbdcomp.1 | 19 +++++ util/grub-macbless.1 | 22 +++++ util/grub-menulst2cfg.1 | 12 +++ @@ -943,7 +943,7 @@ new file mode 100644 index 00000000000..76272a39d2e --- /dev/null +++ b/util/grub-install.8 -@@ -0,0 +1,129 @@ +@@ -0,0 +1,128 @@ +.TH GRUB-INSTALL 1 "Wed Feb 26 2014" +.SH NAME +\fBgrub-install\fR \(em Install GRUB on a device. @@ -1060,12 +1060,11 @@ index 00000000000..76272a39d2e + +.TP +\fB--bootloader-id\fR=\fIID\fR -+Use \fIID\fR as the bootloader ID. This opption is only available on the EFI target platform. ++Use \fIID\fR as the bootloader ID. This option is only available on the EFI target platform. + +.TP +\fB--efi-directory\fR=\fIDIR\fR -+Use \fIDIR\fR as the EFI System Partition root. This opption is only available on the EFI ta -+rget platform. ++Use \fIDIR\fR as the EFI System Partition root. This option is only available on the EFI target platform. + +.TP +\fIINSTALL_DEVICE\fR diff --git a/grub2.spec b/grub2.spec index 5cfe2199..477238ab 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 31%{?dist} +Release: 32%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -516,6 +516,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Nov 12 2020 Peter Hazenberg - 2.04-32 +- Fixed some typos in grub-install.8 man page + * Mon Aug 31 2020 Javier Martinez Canillas - 2.04-31 - Roll over TFTP block counter to prevent timeouts with data packets Resolves: rhbz#1869335 @@ -916,7 +919,7 @@ rm -r /boot/grub2.tmp/ || : Resolves: rhbz#1624532 * Thu Aug 30 2018 Peter Jones - 2.02-53 -- Fix AArch64 machines with no RAM latched lower than 1GB +- Fix AArch64 machines with no RAM latched lower than 1GB Resolves: rhbz#1615969 - Set http_path and http_url when HTTP booting - Hopefully slightly better error reporting in some cases From 96eeab8abddf6fae50467a5647d8d098aa74b6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20Ersen?= Date: Thu, 24 Dec 2020 10:14:04 +0000 Subject: [PATCH 042/294] Update 0131-Add-grub-set-bootflag-utility.patch Fix name of menu_show_once bootflag in man page. --- 0131-Add-grub-set-bootflag-utility.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0131-Add-grub-set-bootflag-utility.patch b/0131-Add-grub-set-bootflag-utility.patch index d5fd2628..d090af4d 100644 --- a/0131-Add-grub-set-bootflag-utility.patch +++ b/0131-Add-grub-set-bootflag-utility.patch @@ -284,7 +284,7 @@ index 00000000000..57801da22a0 +.TP +\fBBOOTFLAG\fR +.RS 7 -+Bootflag to set, one of \fIboot_success\fR or \fIshow_menu_once\fR. ++Bootflag to set, one of \fIboot_success\fR or \fImenu_show_once\fR. +.RE + +.SH SEE ALSO From ec73df1b6e64cfe50319326c242236890f23c7c3 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 30 Dec 2020 17:59:39 +0100 Subject: [PATCH 043/294] Fix tps-rpmtest failing due /boot/grub2/grubenv attributes mismatch The /boot/grub2/grubenv file is not installed by the grub2 packages but is either a symbolic link created on %install or a regular file created by Anaconda during installation. This is causing the tps-rpmtest to fail in some architectures since the file attributes don't match what's expected by the package. Because is a special file, make verification to ignore the size, mode, checksum and mtime attributes. Signed-off-by: Javier Martinez Canillas --- grub.macros | 2 +- grub2.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub.macros b/grub.macros index c451aadc..e6d28a13 100644 --- a/grub.macros +++ b/grub.macros @@ -604,7 +604,7 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ %dir %attr(0700,root,root)%{efi_esp_dir}/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ -%config(noreplace) /boot/grub2/grubenv \ +%config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grubenv \ %{expand:%if 0%{?without_efi_modules} \ %exclude %{_libdir}/grub/%{6} \ diff --git a/grub2.spec b/grub2.spec index 477238ab..8d126169 100644 --- a/grub2.spec +++ b/grub2.spec @@ -358,7 +358,7 @@ rm -r /boot/grub2.tmp/ || : %exclude /boot/grub2/* %dir %attr(0700,root,root) %{efi_esp_dir} %exclude %{efi_esp_dir}/* -%ghost %config(noreplace) /boot/grub2/grubenv +%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv %license COPYING %doc THANKS %doc docs/grub.html From c321e640dc7ae640914781ae7bd05978940d590c Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 30 Dec 2020 18:03:07 +0100 Subject: [PATCH 044/294] Include keylayouts and at_keyboard modules in EFI builds This is needed to support PC AT keyboards on machines using EFI. Signed-off-by: Javier Martinez Canillas --- grub.macros | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index e6d28a13..2643a7b2 100644 --- a/grub.macros +++ b/grub.macros @@ -115,7 +115,7 @@ %ifarch aarch64 %{arm} riscv64 %global efi_modules " " %else -%global efi_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug " +%global efi_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard " %endif %ifarch aarch64 %{arm} riscv64 From 8c2cf1c36843a2eb1e52c29f20ef4167463189ec Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 30 Dec 2020 19:31:02 +0100 Subject: [PATCH 045/294] Add DNF protected.d fragments for GRUB packages Users can unintentionally remove the grub2 packages and break their system by deleting the bootloader. To prevent this mark them as protected by DNF. Resolves: rhbz#1874541 Signed-off-by: Javier Martinez Canillas --- grub.macros | 13 +++++++++++++ grub2.spec | 2 ++ 2 files changed, 15 insertions(+) diff --git a/grub.macros b/grub.macros index 2643a7b2..775787d2 100644 --- a/grub.macros +++ b/grub.macros @@ -370,6 +370,14 @@ for x in grub-mkimage ; do \\\ done \ %{nil} +%define do_install_protected_file() \ +touch %{1}.conf \ +echo %{1} > %{1}.conf \ +install -d -m 755 ${RPM_BUILD_ROOT}/etc/dnf/protected.d/ \ +install -m 644 %{1}.conf ${RPM_BUILD_ROOT}/etc/dnf/protected.d/ \ +rm -f %{1}.conf \ +%{nil} + %ifarch x86_64 aarch64 %{arm} riscv64 %define mkimage() \ %{4}./grub-mkimage -O %{1} -o %{2}.orig \\\ @@ -483,6 +491,7 @@ find . '(' -iname gdb_grub \\\ find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \ install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ +%{expand:%%do_install_protected_file %{name}-%{alt_package_arch}} \ cd .. \ %{nil} @@ -510,6 +519,7 @@ ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ ${RPM_BUILD_ROOT}%{efi_esp_dir}/grubenv create \ ln -sf ../efi/EFI/%{efi_vendor}/grubenv \\\ $RPM_BUILD_ROOT/boot/grub2/grubenv \ +%{expand:%%do_install_protected_file %{name}-%{package_arch}} \ cd .. \ %{nil} @@ -532,6 +542,7 @@ if [ %{3} -eq 0 ]; then \ ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ ${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \ fi \ +%{expand:%%do_install_protected_file %{name}-%{legacy_package_arch}} \ cd .. \ %{nil} @@ -579,6 +590,7 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ %config(noreplace) %{_sysconfdir}/%{name}.cfg \ %ghost %config(noreplace) /boot/%{name}/grub.cfg \ %dir %attr(0700,root,root)/boot/loader/entries \ +%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ \ %{expand:%if 0%{?with_legacy_modules} \ %{expand:%%files %{1}-modules} \ @@ -606,6 +618,7 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grubenv \ +%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ %exclude %{_libdir}/grub/%{6} \ %exclude %{_libdir}/grub/%{6}/* \ diff --git a/grub2.spec b/grub2.spec index 8d126169..df311441 100644 --- a/grub2.spec +++ b/grub2.spec @@ -233,6 +233,7 @@ rm -vf ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-render-label rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/%{name}-bios-setup rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/%{name}-macbless %endif +%{expand:%%do_install_protected_file %{name}-tools-minimal} %find_lang grub @@ -375,6 +376,7 @@ rm -r /boot/grub2.tmp/ || : %{_bindir}/%{name}-editenv %{_bindir}/%{name}-mkpasswd-pbkdf2 %{_bindir}/%{name}-mount +%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-tools-minimal.conf %{_datadir}/man/man3/%{name}-get-kernel-settings* %{_datadir}/man/man8/%{name}-set-default* From d84350c121ac5da35a2d5aef42908ac420f4d05f Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 31 Dec 2020 16:03:56 +0100 Subject: [PATCH 046/294] Add DNF protected.d fragments and pull a few fixes and enhancements - Add DNF protected.d fragments for GRUB packages Resolves: rhbz#1874541 - Include keylayouts and at_keyboard modules in EFI builds - Add GRUB enhanced debugging features - ieee1275: Avoiding many unecessary open/close - ieee1275: device mapper and fibre channel discovery support - Fix tps-rpmtest failing due /boot/grub2/grubenv attributes mismatch Signed-off-by: Javier Martinez Canillas --- ...f-man-pages-with-slightly-nicer-ones.patch | 4 +- 0131-Add-grub-set-bootflag-utility.patch | 2 +- ...ll-disable-support-for-EFI-platforms.patch | 120 ++++++++++++++++ ...imestamps-configure-flag-to-prepend-.patch | 112 +++++++++++++++ ...ements-to-grub_disk_open-and-grub_di.patch | 47 ++++++ ...on-grub_debug_is_enabled-void-return.patch | 51 +++++++ ...ear-screen-when-debugging-is-enabled.patch | 27 ++++ ..._-instrumentation-new-file-debug-tag.patch | 71 +++++++++ ...-Avoiding-many-unecessary-open-close.patch | 136 ++++++++++++++++++ ...-implements-fibre-channel-discovery-.patch | 90 ++++++++++++ ...erpc-enables-device-mapper-discovery.patch | 106 ++++++++++++++ ...dd-support-for-new-RAID1C34-profiles.patch | 51 +++++++ grub.patches | 10 ++ grub2.spec | 11 +- 14 files changed, 834 insertions(+), 4 deletions(-) create mode 100644 0269-grub-install-disable-support-for-EFI-platforms.patch create mode 100644 0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch create mode 100644 0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch create mode 100644 0272-Introduce-function-grub_debug_is_enabled-void-return.patch create mode 100644 0273-Don-t-clear-screen-when-debugging-is-enabled.patch create mode 100644 0274-grub_file_-instrumentation-new-file-debug-tag.patch create mode 100644 0275-ieee1275-Avoiding-many-unecessary-open-close.patch create mode 100644 0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch create mode 100644 0277-ieee1275-powerpc-enables-device-mapper-discovery.patch create mode 100644 0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch diff --git a/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch index 7a2aa9bf..8c1bd8f9 100644 --- a/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +++ b/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch @@ -64,7 +64,7 @@ Replace a bunch of machine generated ones with ones that look nicer. util/grub-script-check.1 | 21 +++++ util/grub-set-default.8 | 21 +++++ util/grub-sparc64-setup.8 | 12 +++ - 59 files changed, 1319 insertions(+), 147 deletions(-) + 59 files changed, 1318 insertions(+), 147 deletions(-) delete mode 100644 docs/man/grub-bios-setup.h2m delete mode 100644 docs/man/grub-editenv.h2m delete mode 100644 docs/man/grub-emu.h2m @@ -940,7 +940,7 @@ index 00000000000..72bd555d577 +.BR "info grub" diff --git a/util/grub-install.8 b/util/grub-install.8 new file mode 100644 -index 00000000000..76272a39d2e +index 00000000000..1db89e94b3b --- /dev/null +++ b/util/grub-install.8 @@ -0,0 +1,128 @@ diff --git a/0131-Add-grub-set-bootflag-utility.patch b/0131-Add-grub-set-bootflag-utility.patch index d090af4d..ff66909c 100644 --- a/0131-Add-grub-set-bootflag-utility.patch +++ b/0131-Add-grub-set-bootflag-utility.patch @@ -265,7 +265,7 @@ index 00000000000..5d8fcba21aa +OnActiveSec=2min diff --git a/util/grub-set-bootflag.1 b/util/grub-set-bootflag.1 new file mode 100644 -index 00000000000..57801da22a0 +index 00000000000..f121226b416 --- /dev/null +++ b/util/grub-set-bootflag.1 @@ -0,0 +1,20 @@ diff --git a/0269-grub-install-disable-support-for-EFI-platforms.patch b/0269-grub-install-disable-support-for-EFI-platforms.patch new file mode 100644 index 00000000..e5104bf1 --- /dev/null +++ b/0269-grub-install-disable-support-for-EFI-platforms.patch @@ -0,0 +1,120 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jan Hlavac +Date: Fri, 20 Nov 2020 23:51:47 +0100 +Subject: [PATCH] grub-install: disable support for EFI platforms + +For each platform, GRUB is shipped as a kernel image and a set of +modules. These files are then used by the grub-install utility to +install GRUB on a specific device. However, in order to support UEFI +Secure Boot, the resulting EFI binary must be signed by a recognized +private key. For this reason, for EFI platforms, most distributions also +ship prebuilt EFI binaries signed by a distribution-specific private +key. In this case, however, the grub-install utility should not be used +because it would overwrite the signed EFI binary. + +The current fix is suboptimal because it preserves all EFI-related code. +A better solution could be to modularize the code and provide a +build-time option. + +Resolves: rhbz#1737444 + +Signed-off-by: Jan Hlavac +--- + util/grub-install.c | 37 ++++++++++++++++--------------------- + docs/grub.texi | 7 +++++++ + util/grub-install.8 | 4 +++- + 3 files changed, 26 insertions(+), 22 deletions(-) + +diff --git a/util/grub-install.c b/util/grub-install.c +index dddb7576c97..b3f5e414052 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -899,6 +899,22 @@ main (int argc, char *argv[]) + + platform = grub_install_get_target (grub_install_source_directory); + ++ switch (platform) ++ { ++ case GRUB_INSTALL_PLATFORM_ARM_EFI: ++ case GRUB_INSTALL_PLATFORM_ARM64_EFI: ++ case GRUB_INSTALL_PLATFORM_I386_EFI: ++ case GRUB_INSTALL_PLATFORM_IA64_EFI: ++ case GRUB_INSTALL_PLATFORM_X86_64_EFI: ++ is_efi = 1; ++ grub_util_error (_("this utility cannot be used for EFI platforms" ++ " because it does not support UEFI Secure Boot")); ++ break; ++ default: ++ is_efi = 0; ++ break; ++ } ++ + { + char *platname = grub_install_get_platform_name (platform); + fprintf (stderr, _("Installing for %s platform.\n"), platname); +@@ -1011,28 +1027,7 @@ main (int argc, char *argv[]) + grub_hostfs_init (); + grub_host_init (); + +- switch (platform) +- { +- case GRUB_INSTALL_PLATFORM_I386_EFI: +- case GRUB_INSTALL_PLATFORM_X86_64_EFI: +- case GRUB_INSTALL_PLATFORM_ARM_EFI: +- case GRUB_INSTALL_PLATFORM_ARM64_EFI: +- case GRUB_INSTALL_PLATFORM_RISCV32_EFI: +- case GRUB_INSTALL_PLATFORM_RISCV64_EFI: +- case GRUB_INSTALL_PLATFORM_IA64_EFI: +- is_efi = 1; +- break; +- default: +- is_efi = 0; +- break; +- +- /* pacify warning. */ +- case GRUB_INSTALL_PLATFORM_MAX: +- break; +- } +- + /* Find the EFI System Partition. */ +- + if (is_efi) + { + grub_fs_t fs; +diff --git a/docs/grub.texi b/docs/grub.texi +index 495462b8e48..085b9974cc5 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -6293,6 +6293,13 @@ grub2-install @var{install_device} + The device name @var{install_device} is an OS device name or a GRUB + device name. + ++In order to support UEFI Secure Boot, the resulting GRUB EFI binary must ++be signed by a recognized private key. For this reason, for EFI ++platforms, most distributions also ship prebuilt GRUB EFI binaries ++signed by a distribution-specific private key. In this case, however, ++@command{grub2-install} should not be used because it would overwrite ++the signed EFI binary. ++ + @command{grub2-install} accepts the following options: + + @table @option +diff --git a/util/grub-install.8 b/util/grub-install.8 +index 1db89e94b3b..811d441b16c 100644 +--- a/util/grub-install.8 ++++ b/util/grub-install.8 +@@ -1,4 +1,4 @@ +-.TH GRUB-INSTALL 1 "Wed Feb 26 2014" ++.TH GRUB-INSTALL 1 "Fri Nov 20 2020" + .SH NAME + \fBgrub-install\fR \(em Install GRUB on a device. + +@@ -31,6 +31,8 @@ + .SH DESCRIPTION + \fBgrub-install\fR installs GRUB onto a device. This includes copying GRUB images into the target directory (generally \fI/boot/grub\fR), and on some platforms may also include installing GRUB onto a boot sector. + ++In order to support UEFI Secure Boot, the resulting GRUB EFI binary must be signed by a recognized private key. For this reason, for EFI platforms, most distributions also ship prebuilt GRUB EFI binaries signed by a distribution-specific private key. In this case, however, the \fBgrub-install\fR utility should not be used because it would overwrite the signed EFI binary. ++ + .SH OPTIONS + .TP + \fB--modules\fR=\fIMODULES\fR\! diff --git a/0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch new file mode 100644 index 00000000..e3d09bcb --- /dev/null +++ b/0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -0,0 +1,112 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Sat, 23 Nov 2019 14:57:41 +0100 +Subject: [PATCH] New --with-debug-timestamps configure flag to prepend debug + traces with absolute and relative timestamp +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Renaud Métrich +--- + configure.ac | 18 ++++++++++++++++++ + grub-core/kern/misc.c | 20 ++++++++++++++++++++ + config.h.in | 1 + + 3 files changed, 39 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 5d3316185da..d150a2e4a9c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1555,6 +1555,17 @@ else + fi + AC_SUBST([BOOT_TIME_STATS]) + ++AC_ARG_WITH([debug-timestamps], ++ AS_HELP_STRING([--with-debug-timestamps], ++ [prepend debug traces with absolute and relative timestamps])) ++ ++if test x$with_debug_timestamps = xyes; then ++ DEBUG_WITH_TIMESTAMPS=1 ++else ++ DEBUG_WITH_TIMESTAMPS=0 ++fi ++AC_SUBST([DEBUG_WITH_TIMESTAMPS]) ++ + AC_ARG_ENABLE([grub-emu-sdl], + [AS_HELP_STRING([--enable-grub-emu-sdl], + [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) +@@ -2142,6 +2153,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) + AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) + AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) + AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) ++AM_CONDITIONAL([COND_DEBUG_WITH_TIMESTAMPS], [test x$DEBUG_WITH_TIMESTAMPS = x1]) + + AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) + +@@ -2237,6 +2249,12 @@ else + echo With boot time statistics: No + fi + ++if [ x"$with_debug_timestamps" = xyes ]; then ++echo Debug traces with timestamps: Yes ++else ++echo Debug traces with timestamps: No ++fi ++ + if [ x"$efiemu_excuse" = x ]; then + echo efiemu runtime: Yes + else +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index dc5e10b651a..bc23945a3c2 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -25,6 +25,9 @@ + #include + #include + #include ++#if DEBUG_WITH_TIMESTAMPS ++#include ++#endif + + union printf_arg + { +@@ -191,9 +194,26 @@ grub_real_dprintf (const char *file, const int line, const char *condition, + const char *fmt, ...) + { + va_list args; ++#if DEBUG_WITH_TIMESTAMPS ++ static long unsigned int last_time = 0; ++ static int last_had_cr = 1; ++#endif + + if (grub_debug_enabled (condition)) + { ++#if DEBUG_WITH_TIMESTAMPS ++ /* Don't print timestamp if last printed message isn't terminated yet */ ++ if (last_had_cr) { ++ long unsigned int tmabs = (long unsigned int) grub_get_time_ms(); ++ long unsigned int tmrel = tmabs - last_time; ++ last_time = tmabs; ++ grub_printf ("%3lu.%03lus +%2lu.%03lus ", tmabs / 1000, tmabs % 1000, tmrel / 1000, tmrel % 1000); ++ } ++ if (fmt[grub_strlen(fmt)-1] == '\n') ++ last_had_cr = 1; ++ else ++ last_had_cr = 0; ++#endif + grub_printf ("%s:%d: ", file, line); + va_start (args, fmt); + grub_vprintf (fmt, args); +diff --git a/config.h.in b/config.h.in +index c7e316f0f1f..c80e3e0aba3 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -12,6 +12,7 @@ + /* Define to 1 to enable disk cache statistics. */ + #define DISK_CACHE_STATS @DISK_CACHE_STATS@ + #define BOOT_TIME_STATS @BOOT_TIME_STATS@ ++#define DEBUG_WITH_TIMESTAMPS @DEBUG_WITH_TIMESTAMPS@ + + /* We don't need those. */ + #define MINILZO_CFG_SKIP_LZO_PTR 1 diff --git a/0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch new file mode 100644 index 00000000..94978402 --- /dev/null +++ b/0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Sat, 23 Nov 2019 15:22:16 +0100 +Subject: [PATCH] Added debug statements to grub_disk_open() and + grub_disk_close() on success +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Renaud Métrich +--- + grub-core/kern/disk.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c +index ffb09c8eefb..141b40de473 100644 +--- a/grub-core/kern/disk.c ++++ b/grub-core/kern/disk.c +@@ -285,6 +285,8 @@ grub_disk_open (const char *name) + return 0; + } + ++ grub_dprintf ("disk", "Opening `%s' succeeded.\n", name); ++ + return disk; + } + +@@ -292,7 +294,7 @@ void + grub_disk_close (grub_disk_t disk) + { + grub_partition_t part; +- grub_dprintf ("disk", "Closing `%s'.\n", disk->name); ++ grub_dprintf ("disk", "Closing `%s'...\n", disk->name); + + if (disk->dev && disk->dev->disk_close) + (disk->dev->disk_close) (disk); +@@ -306,8 +308,10 @@ grub_disk_close (grub_disk_t disk) + grub_free (disk->partition); + disk->partition = part; + } ++ grub_dprintf ("disk", "Closing `%s' succeeded.\n", disk->name); + grub_free ((void *) disk->name); + grub_free (disk); ++ + } + + /* Small read (less than cache size and not pass across cache unit boundaries). diff --git a/0272-Introduce-function-grub_debug_is_enabled-void-return.patch b/0272-Introduce-function-grub_debug_is_enabled-void-return.patch new file mode 100644 index 00000000..54248584 --- /dev/null +++ b/0272-Introduce-function-grub_debug_is_enabled-void-return.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Mon, 25 Nov 2019 09:29:53 +0100 +Subject: [PATCH] Introduce function grub_debug_is_enabled(void) returning 1 if + 'debug' is in the environment and not empty +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Renaud Métrich +--- + grub-core/kern/misc.c | 13 +++++++++++++ + include/grub/misc.h | 1 + + 2 files changed, 14 insertions(+) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index bc23945a3c2..d729b439072 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -162,6 +162,19 @@ int grub_err_printf (const char *fmt, ...) + __attribute__ ((alias("grub_printf"))); + #endif + ++/* Return 1 if 'debug' is set and not empty */ ++int ++grub_debug_is_enabled (void) ++{ ++ const char *debug; ++ ++ debug = grub_env_get ("debug"); ++ if (!debug || debug[0] == '\0') ++ return 0; ++ ++ return 1; ++} ++ + int + grub_debug_enabled (const char * condition) + { +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 998e47e0ccf..f05e1947c4a 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -385,6 +385,7 @@ grub_puts (const char *s) + } + + int EXPORT_FUNC(grub_puts_) (const char *s); ++int EXPORT_FUNC(grub_debug_is_enabled) (void); + int EXPORT_FUNC(grub_debug_enabled) (const char *condition); + void EXPORT_FUNC(grub_real_dprintf) (const char *file, + const int line, diff --git a/0273-Don-t-clear-screen-when-debugging-is-enabled.patch b/0273-Don-t-clear-screen-when-debugging-is-enabled.patch new file mode 100644 index 00000000..70f45e72 --- /dev/null +++ b/0273-Don-t-clear-screen-when-debugging-is-enabled.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Sat, 23 Nov 2019 16:23:54 +0100 +Subject: [PATCH] Don't clear screen when debugging is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Renaud Métrich +--- + grub-core/normal/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index f7ee912e715..abdccc86a59 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -210,7 +210,8 @@ void + grub_normal_init_page (struct grub_term_output *term, + int y __attribute__((__unused__))) + { +- grub_term_cls (term); ++ if (! grub_debug_is_enabled ()) ++ grub_term_cls (term); + + #if 0 + grub_ssize_t msg_len; diff --git a/0274-grub_file_-instrumentation-new-file-debug-tag.patch b/0274-grub_file_-instrumentation-new-file-debug-tag.patch new file mode 100644 index 00000000..0cc6b8c9 --- /dev/null +++ b/0274-grub_file_-instrumentation-new-file-debug-tag.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Fri, 29 Nov 2019 11:02:00 +0100 +Subject: [PATCH] grub_file_* instrumentation (new 'file' debug tag) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Renaud Métrich +--- + grub-core/kern/file.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c +index 58454458c47..e19aea3e514 100644 +--- a/grub-core/kern/file.c ++++ b/grub-core/kern/file.c +@@ -66,6 +66,8 @@ grub_file_open (const char *name, enum grub_file_type type) + const char *file_name; + grub_file_filter_id_t filter; + ++ grub_dprintf ("file", "Opening `%s' ...\n", name); ++ + device_name = grub_file_get_device_name (name); + if (grub_errno) + goto fail; +@@ -128,6 +130,8 @@ grub_file_open (const char *name, enum grub_file_type type) + if (!file) + grub_file_close (last_file); + ++ grub_dprintf ("file", "Opening `%s' succeeded.\n", name); ++ + return file; + + fail: +@@ -138,6 +142,8 @@ grub_file_open (const char *name, enum grub_file_type type) + + grub_free (file); + ++ grub_dprintf ("file", "Opening `%s' failed.\n", name); ++ + return 0; + } + +@@ -169,6 +175,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) + + if (len == 0) + return 0; ++ + read_hook = file->read_hook; + read_hook_data = file->read_hook_data; + if (!file->read_hook) +@@ -189,11 +196,18 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) + grub_err_t + grub_file_close (grub_file_t file) + { ++ grub_dprintf ("file", "Closing `%s' ...\n", file->name); + if (file->fs->fs_close) + (file->fs->fs_close) (file); + + if (file->device) + grub_device_close (file->device); ++ ++ if (grub_errno == GRUB_ERR_NONE) ++ grub_dprintf ("file", "Closing `%s' succeeded.\n", file->name); ++ else ++ grub_dprintf ("file", "Closing `%s' failed with %d.\n", file->name, grub_errno); ++ + grub_free (file->name); + grub_free (file); + return grub_errno; diff --git a/0275-ieee1275-Avoiding-many-unecessary-open-close.patch b/0275-ieee1275-Avoiding-many-unecessary-open-close.patch new file mode 100644 index 00000000..6a0ad75b --- /dev/null +++ b/0275-ieee1275-Avoiding-many-unecessary-open-close.patch @@ -0,0 +1,136 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Diego Domingos +Date: Mon, 14 Dec 2020 17:42:45 +0100 +Subject: [PATCH] ieee1275: Avoiding many unecessary open/close + +Signed-off-by: Diego Domingos +--- + grub-core/disk/ieee1275/ofdisk.c | 64 ++++++++++++++++++++++------------------ + 1 file changed, 35 insertions(+), 29 deletions(-) + +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index 03674cb477e..ea7f78ac7d8 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -44,7 +44,7 @@ struct ofdisk_hash_ent + }; + + static grub_err_t +-grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, ++grub_ofdisk_get_block_size (grub_uint32_t *block_size, + struct ofdisk_hash_ent *op); + + #define OFDISK_HASH_SZ 8 +@@ -461,6 +461,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) + grub_ssize_t actual; + grub_uint32_t block_size = 0; + grub_err_t err; ++ struct ofdisk_hash_ent *op; + + if (grub_strncmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) != 0) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, +@@ -471,6 +472,35 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) + + grub_dprintf ("disk", "Opening `%s'.\n", devpath); + ++ op = ofdisk_hash_find (devpath); ++ if (!op) ++ op = ofdisk_hash_add (devpath, NULL); ++ if (!op) ++ { ++ grub_free (devpath); ++ return grub_errno; ++ } ++ ++ /* Check if the call to open is the same to the last disk already opened */ ++ if (last_devpath && !grub_strcmp(op->open_path,last_devpath)) ++ { ++ goto finish; ++ } ++ ++ /* If not, we need to close the previous disk and open the new one */ ++ else { ++ if (last_ihandle){ ++ grub_ieee1275_close (last_ihandle); ++ } ++ last_ihandle = 0; ++ last_devpath = NULL; ++ ++ grub_ieee1275_open (op->open_path, &last_ihandle); ++ if (! last_ihandle) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); ++ last_devpath = op->open_path; ++ } ++ + if (grub_ieee1275_finddevice (devpath, &dev)) + { + grub_free (devpath); +@@ -491,25 +521,18 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a block device"); + } + ++ ++ finish: + /* XXX: There is no property to read the number of blocks. There + should be a property `#blocks', but it is not there. Perhaps it + is possible to use seek for this. */ + disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN; + + { +- struct ofdisk_hash_ent *op; +- op = ofdisk_hash_find (devpath); +- if (!op) +- op = ofdisk_hash_add (devpath, NULL); +- if (!op) +- { +- grub_free (devpath); +- return grub_errno; +- } + disk->id = (unsigned long) op; + disk->data = op->open_path; + +- err = grub_ofdisk_get_block_size (devpath, &block_size, op); ++ err = grub_ofdisk_get_block_size (&block_size, op); + if (err) + { + grub_free (devpath); +@@ -532,13 +555,6 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) + static void + grub_ofdisk_close (grub_disk_t disk) + { +- if (disk->data == last_devpath) +- { +- if (last_ihandle) +- grub_ieee1275_close (last_ihandle); +- last_ihandle = 0; +- last_devpath = NULL; +- } + disk->data = 0; + } + +@@ -685,7 +701,7 @@ grub_ofdisk_init (void) + } + + static grub_err_t +-grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, ++grub_ofdisk_get_block_size (grub_uint32_t *block_size, + struct ofdisk_hash_ent *op) + { + struct size_args_ieee1275 +@@ -698,16 +714,6 @@ grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, + grub_ieee1275_cell_t size2; + } args_ieee1275; + +- if (last_ihandle) +- grub_ieee1275_close (last_ihandle); +- +- last_ihandle = 0; +- last_devpath = NULL; +- +- grub_ieee1275_open (device, &last_ihandle); +- if (! last_ihandle) +- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); +- + *block_size = 0; + + if (op->block_size_fails >= 2) diff --git a/0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch new file mode 100644 index 00000000..9fa02bb1 --- /dev/null +++ b/0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch @@ -0,0 +1,90 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Diego Domingos +Date: Mon, 14 Dec 2020 17:45:28 +0100 +Subject: [PATCH] ieee1275/powerpc: implements fibre channel discovery for + ofpathname + +grub-ofpathname doesn't work with fibre channel because there is no +function currently implemented for it. +This patch enables it by prividing a function that looks for the port +name, building the entire path for OF devices. + +Signed-off-by: Diego Domingos +--- + grub-core/osdep/linux/ofpath.c | 49 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 49 insertions(+) + +diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c +index a6153d35954..0f5d54e9f2d 100644 +--- a/grub-core/osdep/linux/ofpath.c ++++ b/grub-core/osdep/linux/ofpath.c +@@ -350,6 +350,38 @@ of_path_of_ide(const char *sys_devname __attribute__((unused)), const char *devi + return ret; + } + ++ ++static void ++of_fc_port_name(const char *path, const char *subpath, char *port_name) ++{ ++ char *bname, *basepath, *p; ++ int fd; ++ ++ bname = xmalloc(sizeof(char)*150); ++ basepath = xmalloc(strlen(path)); ++ ++ /* Generate the path to get port name information from the drive */ ++ strncpy(basepath,path,subpath-path); ++ basepath[subpath-path-1] = '\0'; ++ p = get_basename(basepath); ++ snprintf(bname,sizeof(char)*150,"%s/fc_transport/%s/port_name",basepath,p); ++ ++ /* Read the information from the port name */ ++ fd = open (bname, O_RDONLY); ++ if (fd < 0) ++ grub_util_error (_("cannot open `%s': %s"), bname, strerror (errno)); ++ ++ if (read(fd,port_name,sizeof(char)*19) < 0) ++ grub_util_error (_("cannot read `%s': %s"), bname, strerror (errno)); ++ ++ sscanf(port_name,"0x%s",port_name); ++ ++ close(fd); ++ ++ free(bname); ++ free(basepath); ++} ++ + #ifdef __sparc__ + static char * + of_path_of_nvme(const char *sys_devname __attribute__((unused)), +@@ -577,6 +609,16 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev + digit_string = trailing_digits (device); + if (strncmp (of_path, "/vdevice/", sizeof ("/vdevice/") - 1) == 0) + { ++ if(strstr(of_path,"vfc-client")) ++ { ++ char * port_name = xmalloc(sizeof(char)*17); ++ of_fc_port_name(sysfs_path, p, port_name); ++ ++ snprintf(disk,sizeof(disk),"/%s@%s", disk_name, port_name); ++ free(port_name); ++ } ++ else ++ { + unsigned long id = 0x8000 | (tgt << 8) | (bus << 5) | lun; + if (*digit_string == '\0') + { +@@ -590,6 +632,13 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev + snprintf(disk, sizeof (disk), + "/%s@%04lx000000000000:%c", disk_name, id, 'a' + (part - 1)); + } ++ } ++ } else if (strstr(of_path,"fibre-channel")||(strstr(of_path,"vfc-client"))){ ++ char * port_name = xmalloc(sizeof(char)*17); ++ of_fc_port_name(sysfs_path, p, port_name); ++ ++ snprintf(disk,sizeof(disk),"/%s@%s", disk_name, port_name); ++ free(port_name); + } + else + { diff --git a/0277-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0277-ieee1275-powerpc-enables-device-mapper-discovery.patch new file mode 100644 index 00000000..6f1c21b3 --- /dev/null +++ b/0277-ieee1275-powerpc-enables-device-mapper-discovery.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Diego Domingos +Date: Mon, 14 Dec 2020 17:47:16 +0100 +Subject: [PATCH] ieee1275/powerpc: enables device mapper discovery + +this patch enables the device mapper discovery on ofpath.c. Currently, +when we are dealing with a device like /dev/dm-* the ofpath returns null +since there is no function implemented to handle this case. + +This patch implements a function that will look into /sys/block/dm-* +devices and search recursively inside slaves directory to find the root +disk. + +Signed-off-by: Diego Domingos +--- + grub-core/osdep/linux/ofpath.c | 64 +++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 63 insertions(+), 1 deletion(-) + +diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c +index 0f5d54e9f2d..cc849d9c94c 100644 +--- a/grub-core/osdep/linux/ofpath.c ++++ b/grub-core/osdep/linux/ofpath.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #ifdef __sparc__ + typedef enum +@@ -755,13 +756,74 @@ strip_trailing_digits (const char *p) + return new; + } + ++static char * ++get_slave_from_dm(const char * device){ ++ char *curr_device, *tmp; ++ char *directory; ++ char *ret = NULL; ++ ++ directory = grub_strdup (device); ++ tmp = get_basename(directory); ++ curr_device = grub_strdup (tmp); ++ *tmp = '\0'; ++ ++ /* Recursively check for slaves devices so we can find the root device */ ++ while ((curr_device[0] == 'd') && (curr_device[1] == 'm') && (curr_device[2] == '-')){ ++ DIR *dp; ++ struct dirent *ep; ++ char* device_path; ++ ++ device_path = grub_xasprintf ("/sys/block/%s/slaves", curr_device); ++ dp = opendir(device_path); ++ free(device_path); ++ ++ if (dp != NULL) ++ { ++ ep = readdir (dp); ++ while (ep != NULL){ ++ ++ /* avoid some system directories */ ++ if (!strcmp(ep->d_name,".")) ++ goto next_dir; ++ if (!strcmp(ep->d_name,"..")) ++ goto next_dir; ++ ++ free (curr_device); ++ free (ret); ++ curr_device = grub_strdup (ep->d_name); ++ ret = grub_xasprintf ("%s%s", directory, curr_device); ++ break; ++ ++ next_dir: ++ ep = readdir (dp); ++ continue; ++ } ++ closedir (dp); ++ } ++ else ++ grub_util_warn (_("cannot open directory `%s'"), device_path); ++ } ++ ++ free (directory); ++ free (curr_device); ++ ++ return ret; ++} ++ + char * + grub_util_devname_to_ofpath (const char *sys_devname) + { +- char *name_buf, *device, *devnode, *devicenode, *ofpath; ++ char *name_buf, *device, *devnode, *devicenode, *ofpath, *realname; + + name_buf = xrealpath (sys_devname); + ++ realname = get_slave_from_dm (name_buf); ++ if (realname) ++ { ++ free (name_buf); ++ name_buf = realname; ++ } ++ + device = get_basename (name_buf); + devnode = strip_trailing_digits (name_buf); + devicenode = strip_trailing_digits (device); diff --git a/0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch b/0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch new file mode 100644 index 00000000..d6abc6b4 --- /dev/null +++ b/0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Sterba +Date: Mon, 4 Nov 2019 17:23:22 +0100 +Subject: [PATCH] btrfs: Add support for new RAID1C34 profiles + +New 3- and 4-copy variants of RAID1 were merged into Linux kernel 5.5. +Add the two new profiles to the list of recognized ones. As this builds +on the same code as RAID1, only the redundancy level needs to be +adjusted, the rest is done by the existing code. + +Signed-off-by: David Sterba +Reviewed-by: Daniel Kiper +--- + grub-core/fs/btrfs.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 0d8c666aea1..78f5de37b27 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -144,6 +144,8 @@ struct grub_btrfs_chunk_item + #define GRUB_BTRFS_CHUNK_TYPE_RAID10 0x40 + #define GRUB_BTRFS_CHUNK_TYPE_RAID5 0x80 + #define GRUB_BTRFS_CHUNK_TYPE_RAID6 0x100 ++#define GRUB_BTRFS_CHUNK_TYPE_RAID1C3 0x200 ++#define GRUB_BTRFS_CHUNK_TYPE_RAID1C4 0x400 + grub_uint8_t dummy2[0xc]; + grub_uint16_t nstripes; + grub_uint16_t nsubstripes; +@@ -1003,14 +1005,19 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + csize = (stripen + 1) * stripe_length - off; + break; + } ++ case GRUB_BTRFS_CHUNK_TYPE_RAID1C4: ++ redundancy++; ++ /* fall through */ ++ case GRUB_BTRFS_CHUNK_TYPE_RAID1C3: ++ redundancy++; ++ /* fall through */ + case GRUB_BTRFS_CHUNK_TYPE_DUPLICATED: + case GRUB_BTRFS_CHUNK_TYPE_RAID1: + { +- grub_dprintf ("btrfs", "RAID1\n"); ++ grub_dprintf ("btrfs", "RAID1 (copies: %d)\n", ++redundancy); + stripen = 0; + stripe_offset = off; + csize = grub_le_to_cpu64 (chunk->size) - off; +- redundancy = 2; + break; + } + case GRUB_BTRFS_CHUNK_TYPE_RAID0: diff --git a/grub.patches b/grub.patches index e5817390..99e4d121 100644 --- a/grub.patches +++ b/grub.patches @@ -266,3 +266,13 @@ Patch0265: 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch Patch0266: 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch Patch0267: 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch Patch0268: 0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch +Patch0269: 0269-grub-install-disable-support-for-EFI-platforms.patch +Patch0270: 0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0271: 0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0272: 0272-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0273: 0273-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0274: 0274-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0275: 0275-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0276: 0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0277: 0277-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0278: 0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch diff --git a/grub2.spec b/grub2.spec index df311441..597e144e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 32%{?dist} +Release: 33%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -518,6 +518,15 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Dec 31 2020 Javier Martinez Canillas - 2.04-33 +- Add DNF protected.d fragments for GRUB packages + Resolves: rhbz#1874541 + - Include keylayouts and at_keyboard modules in EFI builds + - Add GRUB enhanced debugging features + - ieee1275: Avoiding many unecessary open/close + - ieee1275: device mapper and fibre channel discovery support + - Fix tps-rpmtest failing due /boot/grub2/grubenv attributes mismatch + * Thu Nov 12 2020 Peter Hazenberg - 2.04-32 - Fixed some typos in grub-install.8 man page From f9736ec08517869c0e2d4e3491da8abe09ab1d60 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 12 Jan 2021 16:58:29 +0100 Subject: [PATCH 047/294] at_keyboard: use set 1 when keyboard is in Translate mode Signed-off-by: Javier Martinez Canillas --- ...set-1-when-keyboard-is-in-Translate-.patch | 121 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch new file mode 100644 index 00000000..047b07ba --- /dev/null +++ b/0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch @@ -0,0 +1,121 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Thu, 3 Dec 2020 09:13:24 +0100 +Subject: [PATCH] at_keyboard: use set 1 when keyboard is in Translate mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When keyboard controller acts in Translate mode (0x40 mask), then use +set 1 since translation is done. +Otherwise use the mode queried from the controller (usually set 2). + +Added "atkeyb" debugging messages in at_keyboard module as well. + +Resolves: rhbz#1897587 + +Tested on: +- Asus N53SN (set 1 used) +- Dell Precision (set 1 used) +- HP Elitebook (set 2 used) +- HP G5430 (set 1 used, keyboard in XT mode!) +- Lenovo P71 & Lenovo T460s (set 2 used) +- QEMU/KVM (set 1 used) + +Signed-off-by: Renaud Métrich +--- + grub-core/term/at_keyboard.c | 29 ++++++++++++++++++++++++----- + include/grub/at_keyboard.h | 4 ++++ + 2 files changed, 28 insertions(+), 5 deletions(-) + +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index f0a986eb176..69d99b61df5 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -135,20 +135,28 @@ query_mode (void) + int e; + + e = write_mode (0); +- if (!e) ++ if (!e) { ++ grub_dprintf("atkeyb", "query_mode: write_mode(0) failed\n"); + return 0; ++ } + + do { + keyboard_controller_wait_until_ready (); + ret = grub_inb (KEYBOARD_REG_DATA); + } while (ret == GRUB_AT_ACK); + /* QEMU translates the set even in no-translate mode. */ +- if (ret == 0x43 || ret == 1) ++ if (ret == 0x43 || ret == 1) { ++ grub_dprintf("atkeyb", "query_mode: returning 1 (ret=0x%x)\n", ret); + return 1; +- if (ret == 0x41 || ret == 2) ++ } ++ if (ret == 0x41 || ret == 2) { ++ grub_dprintf("atkeyb", "query_mode: returning 2 (ret=0x%x)\n", ret); + return 2; +- if (ret == 0x3f || ret == 3) ++ } ++ if (ret == 0x3f || ret == 3) { ++ grub_dprintf("atkeyb", "query_mode: returning 3 (ret=0x%x)\n", ret); + return 3; ++ } + return 0; + } + +@@ -165,7 +173,13 @@ set_scancodes (void) + } + + #if !USE_SCANCODE_SET +- ps2_state.current_set = 1; ++ if ((grub_keyboard_controller_orig & KEYBOARD_AT_TRANSLATE) == KEYBOARD_AT_TRANSLATE) { ++ grub_dprintf ("atkeyb", "queried set is %d but keyboard in Translate mode, so actually in set 1\n", grub_keyboard_orig_set); ++ ps2_state.current_set = 1; ++ } else { ++ grub_dprintf ("atkeyb", "using queried set %d\n", grub_keyboard_orig_set); ++ ps2_state.current_set = grub_keyboard_orig_set; ++ } + return; + #else + +@@ -266,6 +280,7 @@ grub_keyboard_controller_init (void) + grub_keyboard_orig_set = 2; + #else + grub_keyboard_controller_orig = grub_keyboard_controller_read (); ++ grub_dprintf ("atkeyb", "grub_keyboard_controller_orig = 0x%x\n", grub_keyboard_controller_orig); + grub_keyboard_orig_set = query_mode (); + #endif + set_scancodes (); +@@ -275,11 +290,15 @@ grub_keyboard_controller_init (void) + static grub_err_t + grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused))) + { ++/* In !USE_SCANCODE_SET mode, we didn't change anything, so nothing to restore */ ++#if USE_SCANCODE_SET + if (ps2_state.current_set == 0) + return GRUB_ERR_NONE; ++ grub_dprintf ("atkeyb", "restoring set %d, controller 0x%x\n", grub_keyboard_orig_set, grub_keyboard_controller_orig); + if (grub_keyboard_orig_set) + write_mode (grub_keyboard_orig_set); + grub_keyboard_controller_write (grub_keyboard_controller_orig); ++#endif + return GRUB_ERR_NONE; + } + +diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h +index bcb4d9ba78f..9414dc1b996 100644 +--- a/include/grub/at_keyboard.h ++++ b/include/grub/at_keyboard.h +@@ -19,6 +19,10 @@ + #ifndef GRUB_AT_KEYBOARD_HEADER + #define GRUB_AT_KEYBOARD_HEADER 1 + ++/* ++ * Refer to https://wiki.osdev.org/%228042%22_PS/2_Controller for details. ++ */ ++ + /* Used for sending commands to the controller. */ + #define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02) + #define KEYBOARD_COMMAND_READ 0x20 diff --git a/grub.patches b/grub.patches index 99e4d121..eda1cf9a 100644 --- a/grub.patches +++ b/grub.patches @@ -276,3 +276,4 @@ Patch0275: 0275-ieee1275-Avoiding-many-unecessary-open-close.patch Patch0276: 0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch Patch0277: 0277-ieee1275-powerpc-enables-device-mapper-discovery.patch Patch0278: 0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch +Patch0279: 0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/grub2.spec b/grub2.spec index 597e144e..17f5b6b8 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 33%{?dist} +Release: 34%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -518,6 +518,9 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Tue Jan 12 2021 Javier Martinez Canillas - 2.04-34 +- at_keyboard: use set 1 when keyboard is in Translate mode (rmetrich) + * Thu Dec 31 2020 Javier Martinez Canillas - 2.04-33 - Add DNF protected.d fragments for GRUB packages Resolves: rhbz#1874541 From ca5becb9a3feb3ef8baccb650ef5ec4580e5363e Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 8 Feb 2021 13:30:04 +0100 Subject: [PATCH 048/294] Fix module loading in the 20_linux_xen script Resolves: rhbz#1858364 Signed-off-by: Javier Martinez Canillas --- ...d-xen-or-multiboot-2-modules-as-need.patch | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch index c8e8c4ac..b2c7519a 100644 --- a/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +++ b/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -5,27 +5,43 @@ Subject: [PATCH] 20_linux_xen: load xen or multiboot{,2} modules as needed. Signed-off-by: Peter Jones --- - util/grub.d/20_linux_xen.in | 3 +++ - 1 file changed, 3 insertions(+) + util/grub.d/20_linux_xen.in | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 1519ec692fe..9aa23bc7d51 100644 +index 1519ec692fe..b6e4608db6e 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in -@@ -136,6 +136,8 @@ linux_entry () +@@ -136,6 +136,7 @@ linux_entry () else xen_rm_opts="no-real-mode edd=off" fi -+ insmod ${module_loader} -+ insmod ${xen_loader} ++ insmod ${xen_module} ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} echo '$(echo "$lmessage" | grub_quote)' ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} -@@ -149,6 +151,7 @@ EOF +@@ -149,6 +150,7 @@ EOF done sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' -+ insmod ${module_loader} ++ insmod ${xen_module} ${module_loader} --nounzip $(echo $initrd_path) EOF fi +@@ -225,13 +227,16 @@ while [ "x${xen_list}" != "x" ] ; do + echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" + fi + if ($grub_file --is-arm64-efi $current_xen); then ++ xen_module="xen_boot" + xen_loader="xen_hypervisor" + module_loader="xen_module" + else + if ($grub_file --is-x86-multiboot2 $current_xen); then ++ xen_module="multiboot2" + xen_loader="multiboot2" + module_loader="module2" + else ++ xen_module="multiboot" + xen_loader="multiboot" + module_loader="module" + fi From 3a8f1e293b78c68e96e4c667827a542453d348ef Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 8 Feb 2021 19:41:49 +0100 Subject: [PATCH 049/294] Remove -fcf-protection compiler flag to allow i386 builds GRUB uses -march=i386 to build the x86 BIOS code but recent changes in the default %{optflags} enabled the -fcf-protection flag that's not compatible with pre-i686 CPUs. This led to a build error in the grub2 package. To avoid this failure and let the package to build again, remove the -fcf-protection flag for now. Related: rhbz#1915452 Signed-off-by: Jeff Law --- grub.macros | 1 + 1 file changed, 1 insertion(+) diff --git a/grub.macros b/grub.macros index 775787d2..52d5cae6 100644 --- a/grub.macros +++ b/grub.macros @@ -24,6 +24,7 @@ -e 's/--param=ssp-buffer-size=4//g' \\\ -e 's/-mregparm=3/-mregparm=4/g' \\\ -e 's/-fexceptions//g' \\\ + -e 's/-fcf-protection//g' \\\ -e 's/-fasynchronous-unwind-tables//g' \\\ -e 's/^/ -fno-strict-aliasing /' \\\ %{nil} From 4fe0f66632e0b0e3264f78a51b30ab89eb6d49e4 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 8 Feb 2021 19:50:49 +0100 Subject: [PATCH 050/294] Unify GRUB configuration file location across all platforms The GRUB configuration files layout on EFI platforms isn't consistent with other non-EFI platforms (e.g: legacy BIOS x86 and Open Firmware ppc64le). On platforms using EFI, the GRUB config file (grub.cfg) and environment variables block (grubenv) are stored in the EFI System Partition (ESP), while for non-EFI platforms these are stored in the boot partition (or /boot directory if not boot partition is used). The reason for this is that the path where the GRUB bootloader searches for its configuration file varies depending on the firmware interface. For EFI the GRUB binary is located in the ESP and it expects to find its config file in that location as well. But this creates the mentioned inconsistency, because the GRUB configuration file has to be stored in /boot/efi/EFI/fedora/grub.cfg while for non-EFI platforms it has to be stored in /boot/grub2/grub.cfg. To allow all platforms to have the GRUB config file in the same location, only a minimal config file could be stored in the ESP and this will load the one that is stored in /boot/grub2. Related: rhbz#1918817 Signed-off-by: Javier Martinez Canillas --- grub.macros | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/grub.macros b/grub.macros index 52d5cae6..0498daed 100644 --- a/grub.macros +++ b/grub.macros @@ -506,8 +506,7 @@ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ fi \ find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \ -touch $RPM_BUILD_ROOT%{efi_esp_dir}/grub.cfg \ -ln -sf ..%{efi_esp_dir}/grub.cfg \\\ +ln -s ../boot/%{name}/grub.cfg \\\ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg \ install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ @@ -517,9 +516,7 @@ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ install -D -m 700 unicode.pf2 \\\ $RPM_BUILD_ROOT%{efi_esp_dir}/fonts/unicode.pf2 \ ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ - ${RPM_BUILD_ROOT}%{efi_esp_dir}/grubenv create \ -ln -sf ../efi/EFI/%{efi_vendor}/grubenv \\\ - $RPM_BUILD_ROOT/boot/grub2/grubenv \ + ${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \ %{expand:%%do_install_protected_file %{name}-%{package_arch}} \ cd .. \ %{nil} @@ -533,8 +530,6 @@ fi \ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ fi \ -ln -s ../boot/%{name}/grub.cfg \\\ - ${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \ if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \ mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\ $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \ @@ -583,6 +578,8 @@ touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub \ ln -sf ../default/grub \\\ ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ +ln -s ../boot/%{name}/grub.cfg \\\ + ${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \ %{nil} %define define_legacy_variant_files() \ @@ -609,6 +606,7 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ %define define_efi_variant_files() \ %{expand:%%files %{1}} \ %defattr(0700,root,root,-) \ +%config(noreplace) %{_sysconfdir}/%{name}.cfg \ %config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \ %attr(0700,root,root)%{efi_esp_dir}/%{2} \ %ifarch %{arm} \ @@ -616,9 +614,9 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ %endif \ %dir %attr(0700,root,root)%{efi_esp_dir}/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ +%ghost %config(noreplace) /boot/%{name}/grub.cfg \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ -%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ %exclude %{_libdir}/grub/%{6} \ From b1411716293a399086585ec89428879fd1130e7b Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 8 Feb 2021 20:01:52 +0100 Subject: [PATCH 051/294] Appended signatures support, unify GRUB config location and some fixes - Remove -fcf-protection compiler flag to allow i386 builds (law) Related: rhbz#1915452 - Unify GRUB configuration file location across all platforms Related: rhbz#1918817 - Add 'at_keyboard_fallback_set' var to force the set manually (rmetrich) - Add appended signatures support for ppc64le LPAR Secure Boot (daxtens) Signed-off-by: Javier Martinez Canillas --- ...fallback_set-var-to-force-the-set-ma.patch | 251 + ...lling-uninitialized-function-pointer.patch | 41 + 0282-ieee1275-claim-up-to-256MB-memory.patch | 52 + ...igning-grub-with-an-appended-signatu.patch | 309 + ...rub-Document-signing-grub-under-UEFI.patch | 59 + ...nt-signing-grub-with-an-appended-sig.patch | 66 + ...-install-is-no-longer-a-shell-script.patch | 33 + ...key-has-been-supported-for-some-time.patch | 36 + ...e-grub_dl_set_persistent-for-the-emu.patch | 44 + ...verifiers-provide-unsafe-module-list.patch | 97 + 0290-pgp-factor-out-rsa_pad.patch | 191 + ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 71 + ...p-tweaks-in-preparation-for-libtasn1.patch | 64 + 0293-libtasn1-import-libtasn1-4.16.0.patch | 8934 +++++++++++++++++ ...asn1-disable-code-not-needed-in-grub.patch | 307 + ...tasn1-changes-for-grub-compatibility.patch | 202 + 0296-libtasn1-compile-into-asn1-module.patch | 70 + 0297-test_asn1-test-module-for-libtasn1.patch | 1455 +++ ...-support-embedding-x509-certificates.patch | 255 + ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 639 ++ ...res-parse-PKCS-7-signedData-and-X.50.patch | 1542 +++ ...res-support-verifying-appended-signa.patch | 719 ++ ...pended-signatures-verification-tests.patch | 897 ++ 0303-appended-signatures-documentation.patch | 333 + ...pended-signature-enforcement-to-ibm-.patch | 137 + grub.patches | 25 + grub2.spec | 10 +- 27 files changed, 16838 insertions(+), 1 deletion(-) create mode 100644 0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch create mode 100644 0281-verifiers-Fix-calling-uninitialized-function-pointer.patch create mode 100644 0282-ieee1275-claim-up-to-256MB-memory.patch create mode 100644 0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch create mode 100644 0284-docs-grub-Document-signing-grub-under-UEFI.patch create mode 100644 0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch create mode 100644 0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch create mode 100644 0287-docs-grub-pubkey-has-been-supported-for-some-time.patch create mode 100644 0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch create mode 100644 0289-verifiers-provide-unsafe-module-list.patch create mode 100644 0290-pgp-factor-out-rsa_pad.patch create mode 100644 0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch create mode 100644 0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch create mode 100644 0293-libtasn1-import-libtasn1-4.16.0.patch create mode 100644 0294-libtasn1-disable-code-not-needed-in-grub.patch create mode 100644 0295-libtasn1-changes-for-grub-compatibility.patch create mode 100644 0296-libtasn1-compile-into-asn1-module.patch create mode 100644 0297-test_asn1-test-module-for-libtasn1.patch create mode 100644 0298-grub-install-support-embedding-x509-certificates.patch create mode 100644 0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch create mode 100644 0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch create mode 100644 0301-appended-signatures-support-verifying-appended-signa.patch create mode 100644 0302-appended-signatures-verification-tests.patch create mode 100644 0303-appended-signatures-documentation.patch create mode 100644 0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch diff --git a/0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch new file mode 100644 index 00000000..11510f54 --- /dev/null +++ b/0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch @@ -0,0 +1,251 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Fri, 18 Dec 2020 15:39:26 +0100 +Subject: [PATCH] Add 'at_keyboard_fallback_set' var to force the set manually + +This seems required with HP DL380p Gen 8 systems. +Indeed, with this system, we can see the following sequence: + +1. controller is queried to get current configuration (returns 0x30 which is quite standard) +2. controller is queried to get the current keyboard set in used, using code 0xf0 (first part) +3. controller answers with 0xfa which means "ACK" (== ok) +4. then we send "0" to tell "we want to know which set your are supporting" +5. controller answers with 0xfa ("ACK") +6. controller should then give us 1, 2, 3 or 0x43, 0x41, 0x3f, but here it gives us 0xfe which means "NACK" + +Since there seems no way to determine the current set, and in fact the +controller expects set2 to be used, we need to rely on an environment +variable. +Everything has been tested on this system: using 0xFE (resend command), +making sure we wait for ACK in the 2 steps "write_mode", etc. + +Below is litterature I used to come up with "there is no other +solution": +- https://wiki.osdev.org/%228042%22_PS/2_Controller +- http://www-ug.eecg.toronto.edu/msl/nios_devices/datasheets/PS2%20Keyboard%20Protocol.htm +- http://www.s100computers.com/My%20System%20Pages/MSDOS%20Board/PC%20Keyboard.pdf +--- + grub-core/term/at_keyboard.c | 127 ++++++++++++++++++++++++++++++++++--------- + 1 file changed, 101 insertions(+), 26 deletions(-) + +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index 69d99b61df5..e7d51b249ad 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -31,6 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + static grub_uint8_t grub_keyboard_controller_orig; + static grub_uint8_t grub_keyboard_orig_set; + struct grub_ps2_state ps2_state; ++static int fallback_set; + + static int ping_sent; + +@@ -76,6 +77,8 @@ at_command (grub_uint8_t data) + break; + return 0; + } ++ if (i == GRUB_AT_TRIES) ++ grub_dprintf ("atkeyb", "at_command() timed out! (stopped after %d tries)\n", i); + return (i != GRUB_AT_TRIES); + } + +@@ -105,6 +108,21 @@ grub_keyboard_controller_read (void) + + #endif + ++static int ++resend_last_result (void) ++{ ++ grub_uint8_t ret; ++ keyboard_controller_wait_until_ready (); ++ grub_dprintf ("atkeyb", "resend_last_result: sending 0xfe\n"); ++ grub_outb (0xfe, KEYBOARD_REG_DATA); ++ ret = wait_ack (); ++ grub_dprintf ("atkeyb", "resend_last_result: wait_ack() returned 0x%x\n", ret); ++ keyboard_controller_wait_until_ready (); ++ ret = grub_inb (KEYBOARD_REG_DATA); ++ grub_dprintf ("atkeyb", "resend_last_result: read 0x%x from controller\n", ret); ++ return ret; ++} ++ + static int + write_mode (int mode) + { +@@ -113,11 +131,17 @@ write_mode (int mode) + { + grub_uint8_t ack; + keyboard_controller_wait_until_ready (); ++ grub_dprintf ("atkeyb", "write_mode: sending 0xf0\n"); + grub_outb (0xf0, KEYBOARD_REG_DATA); ++ ack = wait_ack (); ++ grub_dprintf ("atkeyb", "write_mode: wait_ack() returned 0x%x\n", ack); ++ if (ack != GRUB_AT_ACK) ++ continue; + keyboard_controller_wait_until_ready (); ++ grub_dprintf ("atkeyb", "write_mode: sending mode %d\n", mode); + grub_outb (mode, KEYBOARD_REG_DATA); +- keyboard_controller_wait_until_ready (); + ack = wait_ack (); ++ grub_dprintf ("atkeyb", "write_mode: wait_ack() returned 0x%x\n", ack); + if (ack == GRUB_AT_NACK) + continue; + if (ack == GRUB_AT_ACK) +@@ -125,6 +149,9 @@ write_mode (int mode) + return 0; + } + ++ if (i == GRUB_AT_TRIES) ++ grub_dprintf ("atkeyb", "write_mode() timed out! (stopped after %d tries)\n", i); ++ + return (i != GRUB_AT_TRIES); + } + +@@ -132,31 +159,66 @@ static int + query_mode (void) + { + grub_uint8_t ret; ++ grub_uint64_t endtime; ++ unsigned i; + int e; ++ char *envvar; + +- e = write_mode (0); +- if (!e) { +- grub_dprintf("atkeyb", "query_mode: write_mode(0) failed\n"); +- return 0; +- } ++ for (i = 0; i < GRUB_AT_TRIES; i++) { ++ grub_dprintf ("atkeyb", "query_mode: sending command to controller\n"); ++ e = write_mode (0); ++ if (!e) { ++ grub_dprintf ("atkeyb", "query_mode: write_mode(0) failed\n"); ++ return 0; ++ } + +- do { +- keyboard_controller_wait_until_ready (); +- ret = grub_inb (KEYBOARD_REG_DATA); +- } while (ret == GRUB_AT_ACK); +- /* QEMU translates the set even in no-translate mode. */ +- if (ret == 0x43 || ret == 1) { +- grub_dprintf("atkeyb", "query_mode: returning 1 (ret=0x%x)\n", ret); +- return 1; +- } +- if (ret == 0x41 || ret == 2) { +- grub_dprintf("atkeyb", "query_mode: returning 2 (ret=0x%x)\n", ret); +- return 2; ++ endtime = grub_get_time_ms () + 20; ++ do { ++ keyboard_controller_wait_until_ready (); ++ ret = grub_inb (KEYBOARD_REG_DATA); ++ grub_dprintf ("atkeyb", "query_mode/loop: read 0x%x from controller\n", ret); ++ } while ((ret == GRUB_AT_ACK || ret == GRUB_AT_NACK) && grub_get_time_ms () < endtime); ++ if (ret == 0xfe) { ++ grub_dprintf ("atkeyb", "query_mode: asking controller to resend last result\n"); ++ ret = resend_last_result(); ++ grub_dprintf ("atkeyb", "query_mode: read 0x%x from controller\n", ret); ++ } ++ /* QEMU translates the set even in no-translate mode. */ ++ if (ret == 0x43 || ret == 1) { ++ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 1\n", ret); ++ return 1; ++ } ++ if (ret == 0x41 || ret == 2) { ++ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 2\n", ret); ++ return 2; ++ } ++ if (ret == 0x3f || ret == 3) { ++ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 3\n", ret); ++ return 3; ++ } ++ grub_dprintf ("atkeyb", "query_mode: controller returned unexpected value 0x%x, retrying\n", ret); + } +- if (ret == 0x3f || ret == 3) { +- grub_dprintf("atkeyb", "query_mode: returning 3 (ret=0x%x)\n", ret); +- return 3; ++ ++ /* ++ * Falling here means we tried querying and the controller returned something ++ * we don't understand, try to use 'at_keyboard_fallback_set' if it exists, ++ * otherwise return 0. ++ */ ++ envvar = grub_env_get ("at_keyboard_fallback_set"); ++ if (envvar) { ++ fallback_set = grub_strtoul (envvar, 0, 10); ++ if ((grub_errno) || (fallback_set < 1) || (fallback_set > 3)) { ++ grub_dprintf ("atkeyb", "WARNING: ignoring unexpected value '%s' for '%s' variable\n", ++ envvar, "at_keyboard_fallback_set"); ++ fallback_set = 0; ++ } else { ++ grub_dprintf ("atkeyb", "query_mode: '%s' specified in environment, returning %d\n", ++ "at_keyboard_fallback_set", fallback_set); ++ } ++ return fallback_set; + } ++ grub_dprintf ("atkeyb", "WARNING: no '%s' specified in environment, returning 0\n", ++ "at_keyboard_fallback_set"); + return 0; + } + +@@ -165,14 +227,25 @@ set_scancodes (void) + { + /* You must have visited computer museum. Keyboard without scancode set + knowledge. Assume XT. */ +- if (!grub_keyboard_orig_set) +- { +- grub_dprintf ("atkeyb", "No sets support assumed\n"); +- ps2_state.current_set = 1; ++ if (!grub_keyboard_orig_set) { ++ if (fallback_set) { ++ grub_dprintf ("atkeyb", "No sets support assumed but set forced to %d\n", fallback_set); ++ ps2_state.current_set = fallback_set; + return; + } ++ grub_dprintf ("atkeyb", "No sets support assumed, forcing to set 1\n"); ++ ps2_state.current_set = 1; ++ return; ++ } + + #if !USE_SCANCODE_SET ++ if (fallback_set) { ++ grub_dprintf ("atkeyb", "queried set is %d but set forced to %d\n", ++ grub_keyboard_orig_set, fallback_set); ++ ps2_state.current_set = fallback_set; ++ return; ++ } ++ + if ((grub_keyboard_controller_orig & KEYBOARD_AT_TRANSLATE) == KEYBOARD_AT_TRANSLATE) { + grub_dprintf ("atkeyb", "queried set is %d but keyboard in Translate mode, so actually in set 1\n", grub_keyboard_orig_set); + ps2_state.current_set = 1; +@@ -229,6 +302,7 @@ grub_at_keyboard_is_alive (void) + + if (KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) + { ++ grub_dprintf ("atkeyb", "grub_at_keyboard_is_alive: controller mode before self-test: 0x%x\n", grub_keyboard_controller_read()); + grub_outb (0xaa, KEYBOARD_REG_STATUS); + ping_sent = 1; + } +@@ -261,6 +335,7 @@ grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) + static void + grub_keyboard_controller_init (void) + { ++ grub_dprintf ("atkeyb", "initializing the controller\n"); + ps2_state.at_keyboard_status = 0; + /* Drain input buffer. */ + while (1) +@@ -282,6 +357,7 @@ grub_keyboard_controller_init (void) + grub_keyboard_controller_orig = grub_keyboard_controller_read (); + grub_dprintf ("atkeyb", "grub_keyboard_controller_orig = 0x%x\n", grub_keyboard_controller_orig); + grub_keyboard_orig_set = query_mode (); ++ grub_dprintf ("atkeyb", "grub_keyboard_orig_set = %d\n", grub_keyboard_orig_set); + #endif + set_scancodes (); + keyboard_controller_led (ps2_state.led_status); +@@ -329,7 +405,6 @@ grub_at_restore_hw (void) + return GRUB_ERR_NONE; + } + +- + static struct grub_term_input grub_at_keyboard_term = + { + .name = "at_keyboard", diff --git a/0281-verifiers-Fix-calling-uninitialized-function-pointer.patch b/0281-verifiers-Fix-calling-uninitialized-function-pointer.patch new file mode 100644 index 00000000..1f3b0400 --- /dev/null +++ b/0281-verifiers-Fix-calling-uninitialized-function-pointer.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Tue, 18 Feb 2020 18:08:18 +0800 +Subject: [PATCH] verifiers: Fix calling uninitialized function pointer + +The necessary check for NULL before use of function ver->close is not +taking place in the failure path. This patch simply adds the missing +check and fixes the problem that GRUB hangs indefinitely after booting +rogue image without valid signature if secure boot is turned on. + +Now it displays like this for booting rogue UEFI image: + + error: bad shim signature + error: you need to load the kernel first + + Press any key to continue... + +and then you can go back to boot menu by pressing any key or after a few +seconds expired. + +Signed-off-by: Michael Chang +Reviewed-by: Javier Martinez Canillas +Reviewed-by: Daniel Kiper +--- + grub-core/commands/verifiers.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/verifiers.c b/grub-core/commands/verifiers.c +index 0dde4818267..7b9297cd345 100644 +--- a/grub-core/commands/verifiers.c ++++ b/grub-core/commands/verifiers.c +@@ -196,7 +196,8 @@ grub_verifiers_open (grub_file_t io, enum grub_file_type type) + return ret; + + fail: +- ver->close (context); ++ if (ver->close) ++ ver->close (context); + fail_noclose: + verified_free (verified); + grub_free (ret); diff --git a/0282-ieee1275-claim-up-to-256MB-memory.patch b/0282-ieee1275-claim-up-to-256MB-memory.patch new file mode 100644 index 00000000..1f948eea --- /dev/null +++ b/0282-ieee1275-claim-up-to-256MB-memory.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Wed, 28 Oct 2020 11:44:29 +1100 +Subject: [PATCH] ieee1275: claim up to 256MB memory + +If we are verifying large kernels, we need more that 32MB. (Many distro +kernels are quite large, and debug kernels can be even bigger!) + +We originally went with 512MB: qemu pseries gives you all the memory a +32-bit number can handle, so there was lots left over to place a linux image +and initrd. + +Here's what we said then: +| This is possibly not the way we want to go with for upstream as it breaks +| booting on systems with <= 512MB. We're working on a more upstream-friendly +| solution and will post it shortly. However, for an end-user or packager with +| a higher minimum memory requirement, this will work fine. + +However, we've since discovered that (at least on one P8 test system), PFW +doesn't expose all of the memory allocated to the LPAR: it looks like it just +exposes 512MB - at least unless we mess with the CHRP note section. +Therefore, if we try to claim 512MB in grub, things _do not_ work when we try +to load linux. As a compromise, and again we'd like a better upstream solution, +go for 256MB. This is at least enough to verify distro kernels. + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/ieee1275/init.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 937c1bc44cb..d84fba44d10 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -52,15 +52,13 @@ + #ifdef __i386__ + #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) + #else +-#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024) ++#define HEAP_MAX_SIZE (unsigned long) (256 * 1024 * 1024) + #endif + +-/* If possible, we will avoid claiming heap above this address, because it +- seems to cause relocation problems with OSes that link at 4 MiB */ + #ifdef __i386__ + #define HEAP_MAX_ADDR (unsigned long) (64 * 1024 * 1024) + #else +-#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024) ++#define HEAP_MAX_ADDR (unsigned long) (256 * 1024 * 1024) + #endif + + extern char _end[]; diff --git a/0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch new file mode 100644 index 00000000..c8af937d --- /dev/null +++ b/0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -0,0 +1,309 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Rashmica Gupta +Date: Thu, 11 Jun 2020 11:26:23 +1000 +Subject: [PATCH] Add suport for signing grub with an appended signature + +Add infrastructure to allow firmware to verify the integrity of grub +by use of a Linux-kernel-module-style appended signature. We initially +target powerpc-ieee1275, but the code should be extensible to other +platforms. + +Usually these signatures are appended to a file without modifying the +ELF file itself. (This is what the 'sign-file' tool does, for example.) +The verifier loads the signed file from the file system and looks at the +end of the file for the appended signature. However, on powerpc-ieee1275 +platforms, the bootloader is often stored directly in the PReP partition +as raw bytes without a file-system. This makes determining the location +of an appended signature more difficult. + +To address this, we add a new ELF note. + +The name field of shall be the string "Appended-Signature", zero-padded +to 4 byte alignment. The type field shall be 0x41536967 (the ASCII values +for the string "ASig"). It must be the final section in the ELF binary. + +The description shall contain the appended signature structure as defined +by the Linux kernel. The description will also be padded to be a multiple +of 4 bytes. The padding shall be added before the appended signature +structure (not at the end) so that the final bytes of a signed ELF file +are the appended signature magic. + +A subsequent patch documents how to create a grub core.img validly signed +under this scheme. + +Signed-off-by: Daniel Axtens +Signed-off-by: Rashmica Gupta + +--- + +You can experiment with this code with a patched version of SLOF +that verifies these signatures. You can find one at: + https://github.com/daxtens/SLOF + +I will be proposing this for inclusion in a future Power Architecture +Platform Reference (PAPR). +--- + util/grub-install-common.c | 16 +++++++++++++--- + util/grub-mkimage.c | 11 +++++++++++ + util/grub-mkimagexx.c | 39 ++++++++++++++++++++++++++++++++++++++- + util/mkimage.c | 10 +++++----- + include/grub/util/install.h | 8 ++++++-- + include/grub/util/mkimage.h | 4 ++-- + 6 files changed, 75 insertions(+), 13 deletions(-) + +diff --git a/util/grub-install-common.c b/util/grub-install-common.c +index 0295d40f5e4..e2be0a3e305 100644 +--- a/util/grub-install-common.c ++++ b/util/grub-install-common.c +@@ -308,10 +308,12 @@ handle_install_list (struct install_list *il, const char *val, + static char **pubkeys; + static size_t npubkeys; + static grub_compression_t compression; ++static size_t appsig_size; + + int + grub_install_parse (int key, char *arg) + { ++ const char *end; + switch (key) + { + case 'C': +@@ -400,6 +402,12 @@ grub_install_parse (int key, char *arg) + grub_util_error (_("Unrecognized compression `%s'"), arg); + case GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE: + return 1; ++ case GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE: ++ grub_errno = 0; ++ appsig_size = grub_strtol(arg, &end, 10); ++ if (grub_errno) ++ return 0; ++ return 1; + default: + return 0; + } +@@ -498,10 +506,12 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + grub_util_info ("grub-mkimage --directory '%s' --prefix '%s'" + " --output '%s' " + " --dtb '%s' " +- "--format '%s' --compression '%s' %s %s\n", ++ "--format '%s' --compression '%s' " ++ "--appended-signature-size %zu %s %s\n", + dir, prefix, + outname, dtb ? : "", mkimage_target, +- compnames[compression], note ? "--note" : "", s); ++ compnames[compression], appsig_size, ++ note ? "--note" : "", s); + free (s); + + tgt = grub_install_get_image_target (mkimage_target); +@@ -511,7 +521,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + grub_install_generate_image (dir, prefix, fp, outname, + modules.entries, memdisk_path, + pubkeys, npubkeys, config_path, tgt, +- note, compression, dtb); ++ note, appsig_size, compression, dtb); + while (dc--) + grub_install_pop_module (); + } +diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c +index 912564e3622..c1e07c70dc7 100644 +--- a/util/grub-mkimage.c ++++ b/util/grub-mkimage.c +@@ -82,6 +82,7 @@ static struct argp_option options[] = { + {"format", 'O', N_("FORMAT"), 0, 0, 0}, + {"compression", 'C', "(xz|none|auto)", 0, N_("choose the compression to use for core image"), 0}, + {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, ++ {"appended-signature-size", 's', N_("SIZE"), 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), 0}, + { 0, 0, 0, 0, 0, 0 } + }; + +@@ -124,6 +125,7 @@ struct arguments + char *font; + char *config; + int note; ++ size_t appsig_size; + const struct grub_install_image_target_desc *image_target; + grub_compression_t comp; + }; +@@ -134,6 +136,7 @@ argp_parser (int key, char *arg, struct argp_state *state) + /* Get the input argument from argp_parse, which we + know is a pointer to our arguments structure. */ + struct arguments *arguments = state->input; ++ const char* end; + + switch (key) + { +@@ -166,6 +169,13 @@ argp_parser (int key, char *arg, struct argp_state *state) + arguments->note = 1; + break; + ++ case 's': ++ grub_errno = 0; ++ arguments->appsig_size = grub_strtol(arg, &end, 10); ++ if (grub_errno) ++ return 0; ++ break; ++ + case 'm': + if (arguments->memdisk) + free (arguments->memdisk); +@@ -309,6 +319,7 @@ main (int argc, char *argv[]) + arguments.memdisk, arguments.pubkeys, + arguments.npubkeys, arguments.config, + arguments.image_target, arguments.note, ++ arguments.appsig_size, + arguments.comp, arguments.dtb); + + if (grub_util_file_sync (fp) < 0) +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index 52bc9c848d9..bd2e2e9a52a 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -84,6 +84,15 @@ struct grub_ieee1275_note + struct grub_ieee1275_note_desc descriptor; + }; + ++#define GRUB_APPENDED_SIGNATURE_NOTE_NAME "Appended-Signature" ++#define GRUB_APPENDED_SIGNATURE_NOTE_TYPE 0x41536967 /* "ASig" */ ++ ++struct grub_appended_signature_note ++{ ++ Elf32_Nhdr header; ++ char name[ALIGN_UP(sizeof (GRUB_APPENDED_SIGNATURE_NOTE_NAME), 4)]; ++}; ++ + #define GRUB_XEN_NOTE_NAME "Xen" + + struct fixup_block_list +@@ -207,7 +216,7 @@ grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr sym_addr) + + void + SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc *image_target, +- int note, char **core_img, size_t *core_size, ++ int note, size_t appsig_size, char **core_img, size_t *core_size, + Elf_Addr target_addr, + struct grub_mkimage_layout *layout) + { +@@ -221,6 +230,12 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + int shnum = 4; + int string_size = sizeof (".text") + sizeof ("mods") + 1; + ++ if (appsig_size) ++ { ++ phnum++; ++ footer_size += ALIGN_UP(sizeof (struct grub_appended_signature_note) + appsig_size, 4); ++ } ++ + if (image_target->id != IMAGE_LOONGSON_ELF) + phnum += 2; + +@@ -484,6 +499,28 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + phdr->p_offset = grub_host_to_target32 (header_size + program_size); + } + ++ if (appsig_size) { ++ int note_size = ALIGN_UP(sizeof (struct grub_appended_signature_note) + appsig_size, 4); ++ struct grub_appended_signature_note *note_ptr = (struct grub_appended_signature_note *) ++ (elf_img + program_size + header_size + (note ? sizeof (struct grub_ieee1275_note) : 0)); ++ ++ note_ptr->header.n_namesz = grub_host_to_target32 (sizeof (GRUB_APPENDED_SIGNATURE_NOTE_NAME)); ++ /* needs to sit at the end, so we round this up and sign some zero padding */ ++ note_ptr->header.n_descsz = grub_host_to_target32 (ALIGN_UP(appsig_size, 4)); ++ note_ptr->header.n_type = grub_host_to_target32 (GRUB_APPENDED_SIGNATURE_NOTE_TYPE); ++ strcpy (note_ptr->name, GRUB_APPENDED_SIGNATURE_NOTE_NAME); ++ ++ phdr++; ++ phdr->p_type = grub_host_to_target32 (PT_NOTE); ++ phdr->p_flags = grub_host_to_target32 (PF_R); ++ phdr->p_align = grub_host_to_target32 (image_target->voidp_sizeof); ++ phdr->p_vaddr = 0; ++ phdr->p_paddr = 0; ++ phdr->p_filesz = grub_host_to_target32 (note_size); ++ phdr->p_memsz = 0; ++ phdr->p_offset = grub_host_to_target32 (header_size + program_size + (note ? sizeof (struct grub_ieee1275_note) : 0)); ++ } ++ + { + char *str_start = (elf_img + sizeof (*ehdr) + phnum * sizeof (*phdr) + + shnum * sizeof (*shdr)); +diff --git a/util/mkimage.c b/util/mkimage.c +index 37d6249f16b..bd06968decc 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -822,7 +822,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + char *memdisk_path, char **pubkey_paths, + size_t npubkeys, char *config_path, + const struct grub_install_image_target_desc *image_target, +- int note, grub_compression_t comp, const char *dtb_path) ++ int note, size_t appsig_size, grub_compression_t comp, const char *dtb_path) + { + char *kernel_img, *core_img; + size_t total_module_size, core_size; +@@ -1742,11 +1742,11 @@ grub_install_generate_image (const char *dir, const char *prefix, + else + target_addr = image_target->link_addr; + if (image_target->voidp_sizeof == 4) +- grub_mkimage_generate_elf32 (image_target, note, &core_img, &core_size, +- target_addr, &layout); ++ grub_mkimage_generate_elf32 (image_target, note, appsig_size, &core_img, ++ &core_size, target_addr, &layout); + else +- grub_mkimage_generate_elf64 (image_target, note, &core_img, &core_size, +- target_addr, &layout); ++ grub_mkimage_generate_elf64 (image_target, note, appsig_size, &core_img, ++ &core_size, target_addr, &layout); + } + break; + } +diff --git a/include/grub/util/install.h b/include/grub/util/install.h +index 2631b107451..eb1b83b6d94 100644 +--- a/include/grub/util/install.h ++++ b/include/grub/util/install.h +@@ -63,6 +63,9 @@ + /* TRANSLATORS: "embed" is a verb (command description). "*/ \ + { "pubkey", 'k', N_("FILE"), 0, \ + N_("embed FILE as public key for signature checking"), 0}, \ ++ { "appended-signature-size", GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE,\ ++ "SIZE", 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), \ ++ 1}, \ + { "verbose", 'v', 0, 0, \ + N_("print verbose messages."), 1 } + +@@ -122,7 +125,8 @@ enum grub_install_options { + GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, + GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, + GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, +- GRUB_INSTALL_OPTIONS_DTB ++ GRUB_INSTALL_OPTIONS_DTB, ++ GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE + }; + + extern char *grub_install_source_directory; +@@ -182,7 +186,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + size_t npubkeys, + char *config_path, + const struct grub_install_image_target_desc *image_target, +- int note, ++ int note, size_t appsig_size, + grub_compression_t comp, const char *dtb_file); + + const struct grub_install_image_target_desc * +diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h +index ba9f568f692..2000d6fbdf1 100644 +--- a/include/grub/util/mkimage.h ++++ b/include/grub/util/mkimage.h +@@ -50,12 +50,12 @@ grub_mkimage_load_image64 (const char *kernel_path, + const struct grub_install_image_target_desc *image_target); + void + grub_mkimage_generate_elf32 (const struct grub_install_image_target_desc *image_target, +- int note, char **core_img, size_t *core_size, ++ int note, size_t appsig_size, char **core_img, size_t *core_size, + Elf32_Addr target_addr, + struct grub_mkimage_layout *layout); + void + grub_mkimage_generate_elf64 (const struct grub_install_image_target_desc *image_target, +- int note, char **core_img, size_t *core_size, ++ int note, size_t appsig_size, char **core_img, size_t *core_size, + Elf64_Addr target_addr, + struct grub_mkimage_layout *layout); + diff --git a/0284-docs-grub-Document-signing-grub-under-UEFI.patch b/0284-docs-grub-Document-signing-grub-under-UEFI.patch new file mode 100644 index 00000000..387b51d7 --- /dev/null +++ b/0284-docs-grub-Document-signing-grub-under-UEFI.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Sat, 15 Aug 2020 02:00:57 +1000 +Subject: [PATCH] docs/grub: Document signing grub under UEFI + +Before adding information about how grub is signed with an appended +signature scheme, it's worth adding some information about how it +can currently be signed for UEFI. + +(adjusted from upstream - s/grub/grub2/ in the docs) +Signed-off-by: Daniel Axtens +--- + docs/grub.texi | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 085b9974cc5..abb1d0fae54 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -5645,6 +5645,7 @@ environment variables and commands are listed in the same order. + @menu + * Authentication and authorisation:: Users and access control + * Using digital signatures:: Booting digitally signed code ++* Signing GRUB itself:: Ensuring the integrity of the GRUB core image + * UEFI secure boot and shim:: Booting digitally signed PE files + * Measured Boot:: Measuring boot components + @end menu +@@ -5724,7 +5725,7 @@ commands. + + GRUB's @file{core.img} can optionally provide enforcement that all files + subsequently read from disk are covered by a valid digital signature. +-This document does @strong{not} cover how to ensure that your ++This section does @strong{not} cover how to ensure that your + platform's firmware (e.g., Coreboot) validates @file{core.img}. + + If environment variable @code{check_signatures} +@@ -5809,6 +5810,22 @@ or BIOS) configuration to cause the machine to boot from a different + (attacker-controlled) device. GRUB is at best only one link in a + secure boot chain. + ++@node Signing GRUB itself ++@section Signing GRUB itself ++ ++To ensure a complete secure-boot chain, there must be a way for the code that ++loads GRUB to verify the integrity of the core image. ++ ++This is ultimately platform-specific and individual platforms can define their ++own mechanisms. However, there are general-purpose mechanisms that can be used ++with GRUB. ++ ++@section Signing GRUB for UEFI secure boot ++ ++On UEFI platforms, @file{core.img} is a PE binary. Therefore, it can be signed ++with a tool such as @command{pesign} or @command{sbsign}. It will also be ++necessary to enrol the public key used into a relevant firmware key database. ++ + @node UEFI secure boot and shim + @section UEFI secure boot and shim support + diff --git a/0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch new file mode 100644 index 00000000..cff60cf4 --- /dev/null +++ b/0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 8 Feb 2021 19:17:55 +0100 +Subject: [PATCH] docs/grub: Document signing grub with an appended signature + +Signing grub for firmware that verifies an appended signature is a +bit fiddly. I don't want people to have to figure it out from scratch +so document it here. + +Signed-off-by: Daniel Axtens +--- + docs/grub.texi | 41 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 41 insertions(+) + +diff --git a/docs/grub.texi b/docs/grub.texi +index abb1d0fae54..e8bfe7ee7e8 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -5826,6 +5826,47 @@ On UEFI platforms, @file{core.img} is a PE binary. Therefore, it can be signed + with a tool such as @command{pesign} or @command{sbsign}. It will also be + necessary to enrol the public key used into a relevant firmware key database. + ++@section Signing GRUB with an appended signature ++ ++The @file{core.img} itself can be signed with a Linux kernel module-style ++appended signature. ++ ++To support IEEE1275 platforms where the boot image is often loaded directly ++from a disk partition rather than from a file system, the @file{core.img} ++can specify the size and location of the appended signature with an ELF ++note added by @command{grub-install}. ++ ++An image can be signed this way using the @command{sign-file} command from ++the Linux kernel: ++ ++@example ++@group ++# grub.key is your private key and certificate.der is your public key ++ ++# Determine the size of the appended signature. It depends on the signing ++# certificate and the hash algorithm ++touch empty ++sign-file SHA256 grub.key certificate.der empty empty.sig ++SIG_SIZE=`stat -c '%s' empty.sig` ++rm empty empty.sig ++ ++# Build a grub image with $SIG_SIZE reserved for the signature ++grub-install --appended-signature-size $SIG_SIZE --modules="..." ... ++ ++# Replace the reserved size with a signature: ++# cut off the last $SIG_SIZE bytes with truncate's minus modifier ++truncate -s -$SIG_SIZE /boot/grub/powerpc-ieee1275/core.elf core.elf.unsigned ++# sign the trimmed file with an appended signature, restoring the correct size ++sign-file SHA256 grub.key certificate.der core.elf.unsigned core.elf.signed ++ ++# Don't forget to install the signed image as required ++# (e.g. on powerpc-ieee1275, to the PReP partition) ++@end group ++@end example ++ ++As with UEFI secure boot, it is necessary to build in the required modules, ++or sign them separately. ++ + @node UEFI secure boot and shim + @section UEFI secure boot and shim support + diff --git a/0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch b/0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch new file mode 100644 index 00000000..72160198 --- /dev/null +++ b/0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Sat, 15 Aug 2020 01:00:11 +1000 +Subject: [PATCH] docs/grub: grub-install is no longer a shell script + +Since commit cd46aa6cefab in 2013, grub-install hasn't been a shell +script. The para doesn't really add that much, especially since it's +the user manual, so just drop it. + +(adjust docs: s/grub/grub2) +Signed-off-by: Daniel Axtens +--- + docs/grub.texi | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index e8bfe7ee7e8..2436c57f598 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -695,13 +695,6 @@ floppy instead of exposing the USB drive as a hard disk (they call it + This install doesn't conflict with standard install as long as they are in + separate directories. + +-Note that @command{grub2-install} is actually just a shell script and the +-real task is done by other tools such as @command{grub2-mkimage}. Therefore, +-you may run those commands directly to install GRUB, without using +-@command{grub2-install}. Don't do that, however, unless you are very familiar +-with the internals of GRUB. Installing a boot loader on a running OS may be +-extremely dangerous. +- + On EFI systems for fixed disk install you have to mount EFI System Partition. + If you mount it at @file{/boot/efi} then you don't need any special arguments: + diff --git a/0287-docs-grub-pubkey-has-been-supported-for-some-time.patch b/0287-docs-grub-pubkey-has-been-supported-for-some-time.patch new file mode 100644 index 00000000..51a843b1 --- /dev/null +++ b/0287-docs-grub-pubkey-has-been-supported-for-some-time.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Sat, 15 Aug 2020 02:04:01 +1000 +Subject: [PATCH] docs/grub: --pubkey has been supported for some time + +--pubkey is supported, so we can now document it. + +(adjust docs: s/grub/grub2) +Signed-off-by: Daniel Axtens +--- + docs/grub.texi | 12 +++--------- + 1 file changed, 3 insertions(+), 9 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 2436c57f598..7fc2a62a4f8 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -5732,15 +5732,9 @@ verified with a public key currently trusted by GRUB + validation fails, then file @file{foo} cannot be opened. This failure + may halt or otherwise impact the boot process. + +-@comment Unfortunately --pubkey is not yet supported by grub2-install, +-@comment but we should not bring up internal detail grub2-mkimage here +-@comment in the user guide (as opposed to developer's manual). +- +-@comment An initial trusted public key can be embedded within the GRUB +-@comment @file{core.img} using the @code{--pubkey} option to +-@comment @command{grub2-mkimage} (@pxref{Invoking grub2-install}). Presently it +-@comment is necessary to write a custom wrapper around @command{grub2-mkimage} +-@comment using the @code{--grub-mkimage} flag to @command{grub2-install}. ++An initial trusted public key can be embedded within the GRUB ++@file{core.img} using the @code{--pubkey} option to ++@command{grub2-install} (@pxref{Invoking grub2-install}). + + GRUB uses GPG-style detached signatures (meaning that a file + @file{foo.sig} will be produced when file @file{foo} is signed), and diff --git a/0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch new file mode 100644 index 00000000..7429d642 --- /dev/null +++ b/0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 30 Jul 2020 00:13:21 +1000 +Subject: [PATCH] dl: provide a fake grub_dl_set_persistent for the emu target + +Trying to start grub-emu with a module that calls grub_dl_set_persistent +will crash because grub-emu fakes modules and passes NULL to the module +init function. + +Provide an empty function for the emu case. + +Fixes: ee7808e2197c (dl: Add support for persistent modules) +Signed-off-by: Daniel Axtens +--- + include/grub/dl.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/include/grub/dl.h b/include/grub/dl.h +index 4fe2b524f73..177bcd67a25 100644 +--- a/include/grub/dl.h ++++ b/include/grub/dl.h +@@ -243,11 +243,22 @@ grub_dl_get (const char *name) + return 0; + } + ++#ifdef GRUB_MACHINE_EMU ++/* ++ * Under grub-emu, modules are faked and NULL is passed to GRUB_MOD_INIT. ++ * So we fake this out to avoid a NULL deref. ++ */ ++static inline void ++grub_dl_set_persistent (grub_dl_t mod __attribute__((unused))) ++{ ++} ++#else + static inline void + grub_dl_set_persistent (grub_dl_t mod) + { + mod->persistent = 1; + } ++#endif + + static inline int + grub_dl_is_persistent (grub_dl_t mod) diff --git a/0289-verifiers-provide-unsafe-module-list.patch b/0289-verifiers-provide-unsafe-module-list.patch new file mode 100644 index 00000000..1548d3a2 --- /dev/null +++ b/0289-verifiers-provide-unsafe-module-list.patch @@ -0,0 +1,97 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Wed, 29 Jul 2020 17:46:16 +1000 +Subject: [PATCH] verifiers: provide unsafe module list + +Other verifiers that implement secure boot may want to be able to +use this list and behaviour. + +Upstream, this factors the list out of the shim_lock verifier. +However, that hasn't hit the RHEL8.4 tree yet, so instead +of factoring it out of that we just create it. + +Signed-off-by: Daniel Axtens +--- + grub-core/commands/verifiers.c | 46 ++++++++++++++++++++++++++++++++++++++++++ + include/grub/verify.h | 13 ++++++++++++ + 2 files changed, 59 insertions(+) + +diff --git a/grub-core/commands/verifiers.c b/grub-core/commands/verifiers.c +index 7b9297cd345..4ced984cfed 100644 +--- a/grub-core/commands/verifiers.c ++++ b/grub-core/commands/verifiers.c +@@ -218,6 +218,52 @@ grub_verify_string (char *str, enum grub_verify_string_type type) + return GRUB_ERR_NONE; + } + ++/* List of modules which may allow for verifcation to be bypassed. */ ++static const char *const disabled_mods[] = { "iorw", "memrw", "wrmsr", NULL }; ++ ++/* ++ * Does the module in file `io' allow for the a verifier to be bypassed? ++ * ++ * Returns 1 if so, otherwise 0. ++ */ ++char ++grub_is_dangerous_module (grub_file_t io) ++{ ++ char *b, *e; ++ int i; ++ ++ /* Establish GRUB module name. */ ++ b = grub_strrchr (io->name, '/'); ++ e = grub_strrchr (io->name, '.'); ++ ++ b = b ? (b + 1) : io->name; ++ e = e ? e : io->name + grub_strlen (io->name); ++ e = (e > b) ? e : io->name + grub_strlen (io->name); ++ ++ for (i = 0; disabled_mods[i]; i++) ++ if (!grub_strncmp (b, disabled_mods[i], ++ grub_strlen (b) - grub_strlen (e))) ++ return 1; ++ return 0; ++} ++ ++/* ++ * Is there already an unsafe module in memory? ++ * Returns the name if one is loaded, otherwise NULL. ++ */ ++const char * ++grub_dangerous_module_loaded (void) ++{ ++ int i; ++ ++ for (i = 0; disabled_mods[i]; i++) ++ if (grub_dl_get (disabled_mods[i])) ++ { ++ return disabled_mods[i]; ++ } ++ return NULL; ++} ++ + GRUB_MOD_INIT(verifiers) + { + grub_file_filter_register (GRUB_FILE_FILTER_VERIFY, grub_verifiers_open); +diff --git a/include/grub/verify.h b/include/grub/verify.h +index ea049143368..8c2de132051 100644 +--- a/include/grub/verify.h ++++ b/include/grub/verify.h +@@ -81,4 +81,17 @@ grub_verifier_unregister (struct grub_file_verifier *ver) + grub_err_t + grub_verify_string (char *str, enum grub_verify_string_type type); + ++/* ++ * Does the module in file `io' allow for the a verifier to be bypassed? ++ * ++ * Returns 1 if so, otherwise 0. ++ */ ++char grub_is_dangerous_module (grub_file_t io); ++ ++/* ++ * Is there already an unsafe module in memory? ++ * Returns the name if one is loaded, otherwise NULL. ++ */ ++const char *grub_dangerous_module_loaded (void); ++ + #endif /* ! GRUB_VERIFY_HEADER */ diff --git a/0290-pgp-factor-out-rsa_pad.patch b/0290-pgp-factor-out-rsa_pad.patch new file mode 100644 index 00000000..3d4e1919 --- /dev/null +++ b/0290-pgp-factor-out-rsa_pad.patch @@ -0,0 +1,191 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 1 Oct 2020 20:23:48 +1000 +Subject: [PATCH] pgp: factor out rsa_pad + +rsa_pad does the PKCS#1 v1.5 padding for the RSA signature scheme. +We want to use it in other RSA signature verification applications. + +I considered and rejected putting it in lib/crypto.c. That file doesn't +currently require any MPI functions, but rsa_pad does. That's not so +much of a problem for the grub kernel and modules, but crypto.c also +gets built into all the grub utilities. So - despite the utils not +using any asymmetric ciphers - we would need to built the entire MPI +infrastructure in to them. + +A better and simpler solution is just to spin rsa_pad out into its own +PKCS#1 v1.5 module. + +Signed-off-by: Daniel Axtens +--- + grub-core/Makefile.core.def | 8 ++++++ + grub-core/commands/pgp.c | 28 ++------------------- + grub-core/lib/pkcs1_v15.c | 59 +++++++++++++++++++++++++++++++++++++++++++++ + include/grub/pkcs1_v15.h | 27 +++++++++++++++++++++ + 4 files changed, 96 insertions(+), 26 deletions(-) + create mode 100644 grub-core/lib/pkcs1_v15.c + create mode 100644 include/grub/pkcs1_v15.h + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index b283c502b9c..58bf113e7c1 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2488,6 +2488,14 @@ module = { + cppflags = '$(CPPFLAGS_GCRY)'; + }; + ++module = { ++ name = pkcs1_v15; ++ common = lib/pkcs1_v15.c; ++ ++ cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare'; ++ cppflags = '$(CPPFLAGS_GCRY)'; ++}; ++ + module = { + name = all_video; + common = lib/fake_module.c; +diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c +index bbf6871fe71..2032afa4ec6 100644 +--- a/grub-core/commands/pgp.c ++++ b/grub-core/commands/pgp.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -411,32 +412,7 @@ static int + rsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval, + const gcry_md_spec_t *hash, struct grub_public_subkey *sk) + { +- grub_size_t tlen, emlen, fflen; +- grub_uint8_t *em, *emptr; +- unsigned nbits = gcry_mpi_get_nbits (sk->mpis[0]); +- int ret; +- tlen = hash->mdlen + hash->asnlen; +- emlen = (nbits + 7) / 8; +- if (emlen < tlen + 11) +- return 1; +- +- em = grub_malloc (emlen); +- if (!em) +- return 1; +- +- em[0] = 0x00; +- em[1] = 0x01; +- fflen = emlen - tlen - 3; +- for (emptr = em + 2; emptr < em + 2 + fflen; emptr++) +- *emptr = 0xff; +- *emptr++ = 0x00; +- grub_memcpy (emptr, hash->asnoid, hash->asnlen); +- emptr += hash->asnlen; +- grub_memcpy (emptr, hval, hash->mdlen); +- +- ret = gcry_mpi_scan (hmpi, GCRYMPI_FMT_USG, em, emlen, 0); +- grub_free (em); +- return ret; ++ return grub_crypto_rsa_pad(hmpi, hval, hash, sk->mpis[0]); + } + + struct grub_pubkey_context +diff --git a/grub-core/lib/pkcs1_v15.c b/grub-core/lib/pkcs1_v15.c +new file mode 100644 +index 00000000000..dbacd563d01 +--- /dev/null ++++ b/grub-core/lib/pkcs1_v15.c +@@ -0,0 +1,59 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2013 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++/* ++ * Given a hash value 'hval', of hash specification 'hash', perform ++ * the EMSA-PKCS1-v1_5 padding suitable for a key with modulus 'mod' ++ * (see RFC 8017 s 9.2) and place the result in 'hmpi'. ++ */ ++gcry_err_code_t ++grub_crypto_rsa_pad (gcry_mpi_t * hmpi, grub_uint8_t * hval, ++ const gcry_md_spec_t * hash, gcry_mpi_t mod) ++{ ++ grub_size_t tlen, emlen, fflen; ++ grub_uint8_t *em, *emptr; ++ unsigned nbits = gcry_mpi_get_nbits (mod); ++ int ret; ++ tlen = hash->mdlen + hash->asnlen; ++ emlen = (nbits + 7) / 8; ++ if (emlen < tlen + 11) ++ return GPG_ERR_TOO_SHORT; ++ ++ em = grub_malloc (emlen); ++ if (!em) ++ return 1; ++ ++ em[0] = 0x00; ++ em[1] = 0x01; ++ fflen = emlen - tlen - 3; ++ for (emptr = em + 2; emptr < em + 2 + fflen; emptr++) ++ *emptr = 0xff; ++ *emptr++ = 0x00; ++ grub_memcpy (emptr, hash->asnoid, hash->asnlen); ++ emptr += hash->asnlen; ++ grub_memcpy (emptr, hval, hash->mdlen); ++ ++ ret = gcry_mpi_scan (hmpi, GCRYMPI_FMT_USG, em, emlen, 0); ++ grub_free (em); ++ return ret; ++} +diff --git a/include/grub/pkcs1_v15.h b/include/grub/pkcs1_v15.h +new file mode 100644 +index 00000000000..5c338c84a15 +--- /dev/null ++++ b/include/grub/pkcs1_v15.h +@@ -0,0 +1,27 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2013 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++/* ++ * Given a hash value 'hval', of hash specification 'hash', perform ++ * the EMSA-PKCS1-v1_5 padding suitable for a key with modulus 'mod' ++ * (See RFC 8017 s 9.2) ++ */ ++gcry_err_code_t ++grub_crypto_rsa_pad (gcry_mpi_t * hmpi, grub_uint8_t * hval, ++ const gcry_md_spec_t * hash, gcry_mpi_t mod); ++ diff --git a/0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch new file mode 100644 index 00000000..adfb680a --- /dev/null +++ b/0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 2 Oct 2020 10:49:26 +1000 +Subject: [PATCH] crypto: move storage for grub_crypto_pk_* to crypto.c + +The way gcry_rsa and friends (the asymmetric ciphers) are loaded for the +pgp module is a bit quirky. + +include/grub/crypto.h contains: + extern struct gcry_pk_spec *grub_crypto_pk_rsa; + +commands/pgp.c contains the actual storage: + struct gcry_pk_spec *grub_crypto_pk_rsa; + +And the module itself saves to the storage in pgp.c: + GRUB_MOD_INIT(gcry_rsa) + { + grub_crypto_pk_rsa = &_gcry_pubkey_spec_rsa; + } + +This is annoying: gcry_rsa now has a dependency on pgp! + +We want to be able to bring in gcry_rsa without bringing in PGP, +so move the storage to crypto.c. + +Previously, gcry_rsa depended on pgp and mpi. Now it depends on +crypto and mpi. As pgp depends on crypto, this doesn't add any new +module dependencies using the PGP verfier. + +[FWIW, the story is different for the symmetric ciphers. cryptodisk +and friends (zfs encryption etc) use grub_crypto_lookup_cipher_by_name() +to get a cipher handle. That depends on grub_ciphers being populated +by people calling grub_cipher_register. import_gcry.py ensures that the +symmetric ciphers call it.] + +Signed-off-by: Daniel Axtens +--- + grub-core/commands/pgp.c | 4 ---- + grub-core/lib/crypto.c | 4 ++++ + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c +index 2032afa4ec6..4e0667c1cd0 100644 +--- a/grub-core/commands/pgp.c ++++ b/grub-core/commands/pgp.c +@@ -147,10 +147,6 @@ const char *hashes[] = { + [0x0b] = "sha224" + }; + +-struct gcry_pk_spec *grub_crypto_pk_dsa; +-struct gcry_pk_spec *grub_crypto_pk_ecdsa; +-struct gcry_pk_spec *grub_crypto_pk_rsa; +- + static int + dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval, + const gcry_md_spec_t *hash, struct grub_public_subkey *sk); +diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c +index e6c78d16d39..ff62fa30e1a 100644 +--- a/grub-core/lib/crypto.c ++++ b/grub-core/lib/crypto.c +@@ -121,6 +121,10 @@ grub_md_unregister (gcry_md_spec_t *cipher) + } + } + ++struct gcry_pk_spec *grub_crypto_pk_dsa; ++struct gcry_pk_spec *grub_crypto_pk_ecdsa; ++struct gcry_pk_spec *grub_crypto_pk_rsa; ++ + void + grub_crypto_hash (const gcry_md_spec_t *hash, void *out, const void *in, + grub_size_t inlen) diff --git a/0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch new file mode 100644 index 00000000..a09cab19 --- /dev/null +++ b/0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Sat, 2 May 2020 00:27:57 +1000 +Subject: [PATCH] posix_wrap: tweaks in preparation for libtasn1 + + - Define SIZEOF_UNSIGNED_LONG_INT, it's the same as + SIZEOF_UNSIGNED_LONG. + + - Define WORD_BIT, the size in bits of an int. This is a defined + in the Single Unix Specification and in gnulib's limits.h. gnulib + assumes it's 32 bits on all our platforms, including 64 bit + platforms, so we also use that value. + + - Provide strto[u]l[l] preprocessor macros that resolve to + grub_strto[u]l[l]. To avoid gcrypt redefining strtoul, we + also define HAVE_STRTOUL here. + +Signed-off-by: Daniel Axtens +--- + grub-core/lib/posix_wrap/limits.h | 1 + + grub-core/lib/posix_wrap/stdlib.h | 8 ++++++++ + grub-core/lib/posix_wrap/sys/types.h | 1 + + 3 files changed, 10 insertions(+) + +diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h +index 7217138ffd6..591dbf3289d 100644 +--- a/grub-core/lib/posix_wrap/limits.h ++++ b/grub-core/lib/posix_wrap/limits.h +@@ -37,5 +37,6 @@ + #define LONG_MAX GRUB_LONG_MAX + + #define CHAR_BIT 8 ++#define WORD_BIT 32 + + #endif +diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h +index 7a8d385e973..4634db09f29 100644 +--- a/grub-core/lib/posix_wrap/stdlib.h ++++ b/grub-core/lib/posix_wrap/stdlib.h +@@ -58,4 +58,12 @@ abs (int c) + return (c >= 0) ? c : -c; + } + ++#define strtol grub_strtol ++ ++/* for libgcrypt */ ++#define HAVE_STRTOUL ++#define strtoul grub_strtoul ++ ++#define strtoull grub_strtoull ++ + #endif +diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h +index 854eb0122ef..f63412c8da0 100644 +--- a/grub-core/lib/posix_wrap/sys/types.h ++++ b/grub-core/lib/posix_wrap/sys/types.h +@@ -51,6 +51,7 @@ typedef grub_uint8_t byte; + typedef grub_addr_t uintptr_t; + + #define SIZEOF_UNSIGNED_LONG GRUB_CPU_SIZEOF_LONG ++#define SIZEOF_UNSIGNED_LONG_INT GRUB_CPU_SIZEOF_LONG + #define SIZEOF_UNSIGNED_INT 4 + #define SIZEOF_UNSIGNED_LONG_LONG 8 + #define SIZEOF_UNSIGNED_SHORT 2 diff --git a/0293-libtasn1-import-libtasn1-4.16.0.patch b/0293-libtasn1-import-libtasn1-4.16.0.patch new file mode 100644 index 00000000..89552c88 --- /dev/null +++ b/0293-libtasn1-import-libtasn1-4.16.0.patch @@ -0,0 +1,8934 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Wed, 10 Jun 2020 16:31:22 +1000 +Subject: [PATCH] libtasn1: import libtasn1-4.16.0 + +Import a very trimmed-down set of libtasn1 files: + +pushd /tmp +wget https://ftp.gnu.org/gnu/libtasn1/libtasn1-4.16.0.tar.gz +popd +pushd grub-core/lib +mkdir libtasn1 +cp /tmp/libtasn1-4.16.0/{README.md,LICENSE} libtasn1/ +mkdir libtasn1/lib +cp /tmp/libtasn1-4.16.0/lib/{coding.c,decoding.c,element.c,element.h,errors.c,gstr.c,gstr.h,int.h,parser_aux.c,parser_aux.h,structure.c,structure.h} libtasn1/lib +cp /tmp/libtasn1-4.16.0/lib/includes/libtasn1.h ../../include/grub/ +git add libtasn1/ ../../include/grub/libtasn1.h +popd + +Signed-off-by: Daniel Axtens +--- + grub-core/lib/libtasn1/lib/coding.c | 1415 ++++++++++++++++++ + grub-core/lib/libtasn1/lib/decoding.c | 2478 +++++++++++++++++++++++++++++++ + grub-core/lib/libtasn1/lib/element.c | 1111 ++++++++++++++ + grub-core/lib/libtasn1/lib/errors.c | 100 ++ + grub-core/lib/libtasn1/lib/gstr.c | 74 + + grub-core/lib/libtasn1/lib/parser_aux.c | 1173 +++++++++++++++ + grub-core/lib/libtasn1/lib/structure.c | 1220 +++++++++++++++ + grub-core/lib/libtasn1/lib/element.h | 40 + + grub-core/lib/libtasn1/lib/gstr.h | 47 + + grub-core/lib/libtasn1/lib/int.h | 221 +++ + grub-core/lib/libtasn1/lib/parser_aux.h | 172 +++ + grub-core/lib/libtasn1/lib/structure.h | 45 + + include/grub/libtasn1.h | 588 ++++++++ + grub-core/lib/libtasn1/LICENSE | 16 + + grub-core/lib/libtasn1/README.md | 91 ++ + 15 files changed, 8791 insertions(+) + create mode 100644 grub-core/lib/libtasn1/lib/coding.c + create mode 100644 grub-core/lib/libtasn1/lib/decoding.c + create mode 100644 grub-core/lib/libtasn1/lib/element.c + create mode 100644 grub-core/lib/libtasn1/lib/errors.c + create mode 100644 grub-core/lib/libtasn1/lib/gstr.c + create mode 100644 grub-core/lib/libtasn1/lib/parser_aux.c + create mode 100644 grub-core/lib/libtasn1/lib/structure.c + create mode 100644 grub-core/lib/libtasn1/lib/element.h + create mode 100644 grub-core/lib/libtasn1/lib/gstr.h + create mode 100644 grub-core/lib/libtasn1/lib/int.h + create mode 100644 grub-core/lib/libtasn1/lib/parser_aux.h + create mode 100644 grub-core/lib/libtasn1/lib/structure.h + create mode 100644 include/grub/libtasn1.h + create mode 100644 grub-core/lib/libtasn1/LICENSE + create mode 100644 grub-core/lib/libtasn1/README.md + +diff --git a/grub-core/lib/libtasn1/lib/coding.c b/grub-core/lib/libtasn1/lib/coding.c +new file mode 100644 +index 00000000000..245ea64cf0a +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/coding.c +@@ -0,0 +1,1415 @@ ++/* ++ * Copyright (C) 2002-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++ ++/*****************************************************/ ++/* File: coding.c */ ++/* Description: Functions to create a DER coding of */ ++/* an ASN1 type. */ ++/*****************************************************/ ++ ++#include ++#include "parser_aux.h" ++#include ++#include "element.h" ++#include "minmax.h" ++#include ++ ++#define MAX_TAG_LEN 16 ++ ++/******************************************************/ ++/* Function : _asn1_error_description_value_not_found */ ++/* Description: creates the ErrorDescription string */ ++/* for the ASN1_VALUE_NOT_FOUND error. */ ++/* Parameters: */ ++/* node: node of the tree where the value is NULL. */ ++/* ErrorDescription: string returned. */ ++/* Return: */ ++/******************************************************/ ++static void ++_asn1_error_description_value_not_found (asn1_node node, ++ char *ErrorDescription) ++{ ++ ++ if (ErrorDescription == NULL) ++ return; ++ ++ Estrcpy (ErrorDescription, ":: value of element '"); ++ _asn1_hierarchical_name (node, ErrorDescription + strlen (ErrorDescription), ++ ASN1_MAX_ERROR_DESCRIPTION_SIZE - 40); ++ Estrcat (ErrorDescription, "' not found"); ++ ++} ++ ++/** ++ * asn1_length_der: ++ * @len: value to convert. ++ * @der: buffer to hold the returned encoding (may be %NULL). ++ * @der_len: number of meaningful bytes of ANS (der[0]..der[der_len-1]). ++ * ++ * Creates the DER encoding of the provided length value. ++ * The @der buffer must have enough room for the output. The maximum ++ * length this function will encode is %ASN1_MAX_LENGTH_SIZE. ++ * ++ * To know the size of the DER encoding use a %NULL value for @der. ++ **/ ++void ++asn1_length_der (unsigned long int len, unsigned char *der, int *der_len) ++{ ++ int k; ++ unsigned char temp[ASN1_MAX_LENGTH_SIZE]; ++#if SIZEOF_UNSIGNED_LONG_INT > 8 ++ len &= 0xFFFFFFFFFFFFFFFF; ++#endif ++ ++ if (len < 128) ++ { ++ /* short form */ ++ if (der != NULL) ++ der[0] = (unsigned char) len; ++ *der_len = 1; ++ } ++ else ++ { ++ /* Long form */ ++ k = 0; ++ while (len) ++ { ++ temp[k++] = len & 0xFF; ++ len = len >> 8; ++ } ++ *der_len = k + 1; ++ if (der != NULL) ++ { ++ der[0] = ((unsigned char) k & 0x7F) + 128; ++ while (k--) ++ der[*der_len - 1 - k] = temp[k]; ++ } ++ } ++} ++ ++/******************************************************/ ++/* Function : _asn1_tag_der */ ++/* Description: creates the DER coding for the CLASS */ ++/* and TAG parameters. */ ++/* It is limited by the ASN1_MAX_TAG_SIZE variable */ ++/* Parameters: */ ++/* class: value to convert. */ ++/* tag_value: value to convert. */ ++/* ans: string returned. */ ++/* ans_len: number of meaningful bytes of ANS */ ++/* (ans[0]..ans[ans_len-1]). */ ++/* Return: */ ++/******************************************************/ ++static void ++_asn1_tag_der (unsigned char class, unsigned int tag_value, ++ unsigned char ans[ASN1_MAX_TAG_SIZE], int *ans_len) ++{ ++ int k; ++ unsigned char temp[ASN1_MAX_TAG_SIZE]; ++ ++ if (tag_value < 31) ++ { ++ /* short form */ ++ ans[0] = (class & 0xE0) + ((unsigned char) (tag_value & 0x1F)); ++ *ans_len = 1; ++ } ++ else ++ { ++ /* Long form */ ++ ans[0] = (class & 0xE0) + 31; ++ k = 0; ++ while (tag_value != 0) ++ { ++ temp[k++] = tag_value & 0x7F; ++ tag_value >>= 7; ++ ++ if (k > ASN1_MAX_TAG_SIZE - 1) ++ break; /* will not encode larger tags */ ++ } ++ *ans_len = k + 1; ++ while (k--) ++ ans[*ans_len - 1 - k] = temp[k] + 128; ++ ans[*ans_len - 1] -= 128; ++ } ++} ++ ++/** ++ * asn1_octet_der: ++ * @str: the input data. ++ * @str_len: STR length (str[0]..str[*str_len-1]). ++ * @der: encoded string returned. ++ * @der_len: number of meaningful bytes of DER (der[0]..der[der_len-1]). ++ * ++ * Creates a length-value DER encoding for the input data. ++ * The DER encoding of the input data will be placed in the @der variable. ++ * ++ * Note that the OCTET STRING tag is not included in the output. ++ * ++ * This function does not return any value because it is expected ++ * that @der_len will contain enough bytes to store the string ++ * plus the DER encoding. The DER encoding size can be obtained using ++ * asn1_length_der(). ++ **/ ++void ++asn1_octet_der (const unsigned char *str, int str_len, ++ unsigned char *der, int *der_len) ++{ ++ int len_len; ++ ++ if (der == NULL || str_len < 0) ++ return; ++ ++ asn1_length_der (str_len, der, &len_len); ++ memcpy (der + len_len, str, str_len); ++ *der_len = str_len + len_len; ++} ++ ++ ++/** ++ * asn1_encode_simple_der: ++ * @etype: The type of the string to be encoded (ASN1_ETYPE_) ++ * @str: the string data. ++ * @str_len: the string length ++ * @tl: the encoded tag and length ++ * @tl_len: the bytes of the @tl field ++ * ++ * Creates the DER encoding for various simple ASN.1 types like strings etc. ++ * It stores the tag and length in @tl, which should have space for at least ++ * %ASN1_MAX_TL_SIZE bytes. Initially @tl_len should contain the size of @tl. ++ * ++ * The complete DER encoding should consist of the value in @tl appended ++ * with the provided @str. ++ * ++ * Returns: %ASN1_SUCCESS if successful or an error value. ++ **/ ++int ++asn1_encode_simple_der (unsigned int etype, const unsigned char *str, ++ unsigned int str_len, unsigned char *tl, ++ unsigned int *tl_len) ++{ ++ int tag_len, len_len; ++ unsigned tlen; ++ unsigned char der_tag[ASN1_MAX_TAG_SIZE]; ++ unsigned char der_length[ASN1_MAX_LENGTH_SIZE]; ++ unsigned char *p; ++ ++ if (str == NULL) ++ return ASN1_VALUE_NOT_VALID; ++ ++ if (ETYPE_OK (etype) == 0) ++ return ASN1_VALUE_NOT_VALID; ++ ++ /* doesn't handle constructed classes */ ++ if (ETYPE_CLASS (etype) != ASN1_CLASS_UNIVERSAL) ++ return ASN1_VALUE_NOT_VALID; ++ ++ _asn1_tag_der (ETYPE_CLASS (etype), ETYPE_TAG (etype), der_tag, &tag_len); ++ ++ asn1_length_der (str_len, der_length, &len_len); ++ ++ if (tag_len <= 0 || len_len <= 0) ++ return ASN1_VALUE_NOT_VALID; ++ ++ tlen = tag_len + len_len; ++ ++ if (*tl_len < tlen) ++ return ASN1_MEM_ERROR; ++ ++ p = tl; ++ memcpy (p, der_tag, tag_len); ++ p += tag_len; ++ memcpy (p, der_length, len_len); ++ ++ *tl_len = tlen; ++ ++ return ASN1_SUCCESS; ++} ++ ++/******************************************************/ ++/* Function : _asn1_time_der */ ++/* Description: creates the DER coding for a TIME */ ++/* type (length included). */ ++/* Parameters: */ ++/* str: TIME null-terminated string. */ ++/* der: string returned. */ ++/* der_len: number of meaningful bytes of DER */ ++/* (der[0]..der[ans_len-1]). Initially it */ ++/* if must store the lenght of DER. */ ++/* Return: */ ++/* ASN1_MEM_ERROR when DER isn't big enough */ ++/* ASN1_SUCCESS otherwise */ ++/******************************************************/ ++static int ++_asn1_time_der (unsigned char *str, int str_len, unsigned char *der, ++ int *der_len) ++{ ++ int len_len; ++ int max_len; ++ ++ if (der == NULL) ++ return ASN1_VALUE_NOT_VALID; ++ ++ max_len = *der_len; ++ ++ asn1_length_der (str_len, (max_len > 0) ? der : NULL, &len_len); ++ ++ if ((len_len + str_len) <= max_len) ++ memcpy (der + len_len, str, str_len); ++ *der_len = len_len + str_len; ++ ++ if ((*der_len) > max_len) ++ return ASN1_MEM_ERROR; ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/* ++void ++_asn1_get_utctime_der(unsigned char *der,int *der_len,unsigned char *str) ++{ ++ int len_len,str_len; ++ char temp[20]; ++ ++ if(str==NULL) return; ++ str_len=asn1_get_length_der(der,*der_len,&len_len); ++ if (str_len<0) return; ++ memcpy(temp,der+len_len,str_len); ++ *der_len=str_len+len_len; ++ switch(str_len) ++ { ++ case 11: ++ temp[10]=0; ++ strcat(temp,"00+0000"); ++ break; ++ case 13: ++ temp[12]=0; ++ strcat(temp,"+0000"); ++ break; ++ case 15: ++ temp[15]=0; ++ memmove(temp+12,temp+10,6); ++ temp[10]=temp[11]='0'; ++ break; ++ case 17: ++ temp[17]=0; ++ break; ++ default: ++ return; ++ } ++ strcpy(str,temp); ++} ++*/ ++ ++static ++void encode_val(uint64_t val, unsigned char *der, int max_len, int *der_len) ++{ ++ int first, k; ++ unsigned char bit7; ++ ++ first = 0; ++ for (k = sizeof(val); k >= 0; k--) ++ { ++ bit7 = (val >> (k * 7)) & 0x7F; ++ if (bit7 || first || !k) ++ { ++ if (k) ++ bit7 |= 0x80; ++ if (max_len > (*der_len)) ++ der[*der_len] = bit7; ++ (*der_len)++; ++ first = 1; ++ } ++ } ++} ++ ++/******************************************************/ ++/* Function : _asn1_object_id_der */ ++/* Description: creates the DER coding for an */ ++/* OBJECT IDENTIFIER type (length included). */ ++/* Parameters: */ ++/* str: OBJECT IDENTIFIER null-terminated string. */ ++/* der: string returned. */ ++/* der_len: number of meaningful bytes of DER */ ++/* (der[0]..der[ans_len-1]). Initially it */ ++/* must store the length of DER. */ ++/* Return: */ ++/* ASN1_MEM_ERROR when DER isn't big enough */ ++/* ASN1_SUCCESS if succesful */ ++/* or an error value. */ ++/******************************************************/ ++static int ++_asn1_object_id_der (const char *str, unsigned char *der, int *der_len) ++{ ++ int len_len, counter, max_len; ++ char *temp, *n_end, *n_start; ++ uint64_t val, val1 = 0; ++ int str_len = _asn1_strlen (str); ++ ++ max_len = *der_len; ++ *der_len = 0; ++ ++ if (der == NULL && max_len > 0) ++ return ASN1_VALUE_NOT_VALID; ++ ++ temp = malloc (str_len + 2); ++ if (temp == NULL) ++ return ASN1_MEM_ALLOC_ERROR; ++ ++ memcpy (temp, str, str_len); ++ temp[str_len] = '.'; ++ temp[str_len + 1] = 0; ++ ++ counter = 0; ++ n_start = temp; ++ while ((n_end = strchr (n_start, '.'))) ++ { ++ *n_end = 0; ++ val = _asn1_strtou64 (n_start, NULL, 10); ++ counter++; ++ ++ if (counter == 1) ++ { ++ val1 = val; ++ } ++ else if (counter == 2) ++ { ++ uint64_t val0; ++ ++ if (val1 > 2) ++ { ++ free(temp); ++ return ASN1_VALUE_NOT_VALID; ++ } ++ else if ((val1 == 0 || val1 == 1) && val > 39) ++ { ++ free(temp); ++ return ASN1_VALUE_NOT_VALID; ++ } ++ ++ val0 = 40 * val1 + val; ++ encode_val(val0, der, max_len, der_len); ++ } ++ else ++ { ++ encode_val(val, der, max_len, der_len); ++ } ++ n_start = n_end + 1; ++ } ++ ++ asn1_length_der (*der_len, NULL, &len_len); ++ if (max_len >= (*der_len + len_len)) ++ { ++ memmove (der + len_len, der, *der_len); ++ asn1_length_der (*der_len, der, &len_len); ++ } ++ *der_len += len_len; ++ ++ free (temp); ++ ++ if (max_len < (*der_len)) ++ return ASN1_MEM_ERROR; ++ ++ return ASN1_SUCCESS; ++} ++ ++/** ++ * asn1_object_id_der: ++ * @str: An object identifier in numeric, dot format. ++ * @der: buffer to hold the returned encoding (may be %NULL). ++ * @der_len: initially the size of @der; will hold the final size. ++ * @flags: must be zero ++ * ++ * Creates the DER encoding of the provided object identifier. ++ * ++ * Returns: %ASN1_SUCCESS if DER encoding was OK, %ASN1_VALUE_NOT_VALID ++ * if @str is not a valid OID, %ASN1_MEM_ERROR if the @der ++ * vector isn't big enough and in this case @der_len will contain the ++ * length needed. ++ **/ ++int asn1_object_id_der(const char *str, unsigned char *der, int *der_len, unsigned flags) ++{ ++ unsigned char tag_der[MAX_TAG_LEN]; ++ int tag_len = 0, r; ++ int max_len = *der_len; ++ ++ *der_len = 0; ++ ++ _asn1_tag_der (ETYPE_CLASS (ASN1_ETYPE_OBJECT_ID), ETYPE_TAG (ASN1_ETYPE_OBJECT_ID), ++ tag_der, &tag_len); ++ ++ if (max_len > tag_len) ++ { ++ memcpy(der, tag_der, tag_len); ++ } ++ max_len -= tag_len; ++ der += tag_len; ++ ++ r = _asn1_object_id_der (str, der, &max_len); ++ if (r == ASN1_MEM_ERROR || r == ASN1_SUCCESS) ++ { ++ *der_len = max_len + tag_len; ++ } ++ ++ return r; ++} ++ ++static const unsigned char bit_mask[] = ++ { 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 }; ++ ++/** ++ * asn1_bit_der: ++ * @str: BIT string. ++ * @bit_len: number of meaningful bits in STR. ++ * @der: string returned. ++ * @der_len: number of meaningful bytes of DER ++ * (der[0]..der[ans_len-1]). ++ * ++ * Creates a length-value DER encoding for the input data ++ * as it would have been for a BIT STRING. ++ * The DER encoded data will be copied in @der. ++ * ++ * Note that the BIT STRING tag is not included in the output. ++ * ++ * This function does not return any value because it is expected ++ * that @der_len will contain enough bytes to store the string ++ * plus the DER encoding. The DER encoding size can be obtained using ++ * asn1_length_der(). ++ **/ ++void ++asn1_bit_der (const unsigned char *str, int bit_len, ++ unsigned char *der, int *der_len) ++{ ++ int len_len, len_byte, len_pad; ++ ++ if (der == NULL) ++ return; ++ ++ len_byte = bit_len >> 3; ++ len_pad = 8 - (bit_len & 7); ++ if (len_pad == 8) ++ len_pad = 0; ++ else ++ len_byte++; ++ asn1_length_der (len_byte + 1, der, &len_len); ++ der[len_len] = len_pad; ++ ++ if (str) ++ memcpy (der + len_len + 1, str, len_byte); ++ der[len_len + len_byte] &= bit_mask[len_pad]; ++ *der_len = len_byte + len_len + 1; ++} ++ ++ ++/******************************************************/ ++/* Function : _asn1_complete_explicit_tag */ ++/* Description: add the length coding to the EXPLICIT */ ++/* tags. */ ++/* Parameters: */ ++/* node: pointer to the tree element. */ ++/* der: string with the DER coding of the whole tree*/ ++/* counter: number of meaningful bytes of DER */ ++/* (der[0]..der[*counter-1]). */ ++/* max_len: size of der vector */ ++/* Return: */ ++/* ASN1_MEM_ERROR if der vector isn't big enough, */ ++/* otherwise ASN1_SUCCESS. */ ++/******************************************************/ ++static int ++_asn1_complete_explicit_tag (asn1_node node, unsigned char *der, ++ int *counter, int *max_len) ++{ ++ asn1_node p; ++ int is_tag_implicit, len2, len3; ++ unsigned char temp[SIZEOF_UNSIGNED_INT]; ++ ++ if (der == NULL && *max_len > 0) ++ return ASN1_VALUE_NOT_VALID; ++ ++ is_tag_implicit = 0; ++ ++ if (node->type & CONST_TAG) ++ { ++ p = node->down; ++ if (p == NULL) ++ return ASN1_DER_ERROR; ++ /* When there are nested tags we must complete them reverse to ++ the order they were created. This is because completing a tag ++ modifies all data within it, including the incomplete tags ++ which store buffer positions -- simon@josefsson.org 2002-09-06 ++ */ ++ while (p->right) ++ p = p->right; ++ while (p && p != node->down->left) ++ { ++ if (type_field (p->type) == ASN1_ETYPE_TAG) ++ { ++ if (p->type & CONST_EXPLICIT) ++ { ++ len2 = strtol (p->name, NULL, 10); ++ _asn1_set_name (p, NULL); ++ ++ asn1_length_der (*counter - len2, temp, &len3); ++ if (len3 <= (*max_len)) ++ { ++ memmove (der + len2 + len3, der + len2, ++ *counter - len2); ++ memcpy (der + len2, temp, len3); ++ } ++ *max_len -= len3; ++ *counter += len3; ++ is_tag_implicit = 0; ++ } ++ else ++ { /* CONST_IMPLICIT */ ++ if (!is_tag_implicit) ++ { ++ is_tag_implicit = 1; ++ } ++ } ++ } ++ p = p->left; ++ } ++ } ++ ++ if (*max_len < 0) ++ return ASN1_MEM_ERROR; ++ ++ return ASN1_SUCCESS; ++} ++ ++const tag_and_class_st _asn1_tags[] = { ++ [ASN1_ETYPE_GENERALSTRING] = ++ {ASN1_TAG_GENERALSTRING, ASN1_CLASS_UNIVERSAL, "type:GENERALSTRING"}, ++ [ASN1_ETYPE_NUMERIC_STRING] = ++ {ASN1_TAG_NUMERIC_STRING, ASN1_CLASS_UNIVERSAL, "type:NUMERIC_STR"}, ++ [ASN1_ETYPE_IA5_STRING] = ++ {ASN1_TAG_IA5_STRING, ASN1_CLASS_UNIVERSAL, "type:IA5_STR"}, ++ [ASN1_ETYPE_TELETEX_STRING] = ++ {ASN1_TAG_TELETEX_STRING, ASN1_CLASS_UNIVERSAL, "type:TELETEX_STR"}, ++ [ASN1_ETYPE_PRINTABLE_STRING] = ++ {ASN1_TAG_PRINTABLE_STRING, ASN1_CLASS_UNIVERSAL, "type:PRINTABLE_STR"}, ++ [ASN1_ETYPE_UNIVERSAL_STRING] = ++ {ASN1_TAG_UNIVERSAL_STRING, ASN1_CLASS_UNIVERSAL, "type:UNIVERSAL_STR"}, ++ [ASN1_ETYPE_BMP_STRING] = ++ {ASN1_TAG_BMP_STRING, ASN1_CLASS_UNIVERSAL, "type:BMP_STR"}, ++ [ASN1_ETYPE_UTF8_STRING] = ++ {ASN1_TAG_UTF8_STRING, ASN1_CLASS_UNIVERSAL, "type:UTF8_STR"}, ++ [ASN1_ETYPE_VISIBLE_STRING] = ++ {ASN1_TAG_VISIBLE_STRING, ASN1_CLASS_UNIVERSAL, "type:VISIBLE_STR"}, ++ [ASN1_ETYPE_OCTET_STRING] = ++ {ASN1_TAG_OCTET_STRING, ASN1_CLASS_UNIVERSAL, "type:OCT_STR"}, ++ [ASN1_ETYPE_BIT_STRING] = ++ {ASN1_TAG_BIT_STRING, ASN1_CLASS_UNIVERSAL, "type:BIT_STR"}, ++ [ASN1_ETYPE_OBJECT_ID] = ++ {ASN1_TAG_OBJECT_ID, ASN1_CLASS_UNIVERSAL, "type:OBJ_ID"}, ++ [ASN1_ETYPE_NULL] = {ASN1_TAG_NULL, ASN1_CLASS_UNIVERSAL, "type:NULL"}, ++ [ASN1_ETYPE_BOOLEAN] = ++ {ASN1_TAG_BOOLEAN, ASN1_CLASS_UNIVERSAL, "type:BOOLEAN"}, ++ [ASN1_ETYPE_INTEGER] = ++ {ASN1_TAG_INTEGER, ASN1_CLASS_UNIVERSAL, "type:INTEGER"}, ++ [ASN1_ETYPE_ENUMERATED] = ++ {ASN1_TAG_ENUMERATED, ASN1_CLASS_UNIVERSAL, "type:ENUMERATED"}, ++ [ASN1_ETYPE_SEQUENCE] = ++ {ASN1_TAG_SEQUENCE, ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED, ++ "type:SEQUENCE"}, ++ [ASN1_ETYPE_SEQUENCE_OF] = ++ {ASN1_TAG_SEQUENCE, ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED, ++ "type:SEQ_OF"}, ++ [ASN1_ETYPE_SET] = ++ {ASN1_TAG_SET, ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED, "type:SET"}, ++ [ASN1_ETYPE_SET_OF] = ++ {ASN1_TAG_SET, ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED, ++ "type:SET_OF"}, ++ [ASN1_ETYPE_GENERALIZED_TIME] = ++ {ASN1_TAG_GENERALIZEDTime, ASN1_CLASS_UNIVERSAL, "type:GENERALIZED_TIME"}, ++ [ASN1_ETYPE_UTC_TIME] = ++ {ASN1_TAG_UTCTime, ASN1_CLASS_UNIVERSAL, "type:UTC_TIME"}, ++}; ++ ++unsigned int _asn1_tags_size = sizeof (_asn1_tags) / sizeof (_asn1_tags[0]); ++ ++/******************************************************/ ++/* Function : _asn1_insert_tag_der */ ++/* Description: creates the DER coding of tags of one */ ++/* NODE. */ ++/* Parameters: */ ++/* node: pointer to the tree element. */ ++/* der: string returned */ ++/* counter: number of meaningful bytes of DER */ ++/* (counter[0]..der[*counter-1]). */ ++/* max_len: size of der vector */ ++/* Return: */ ++/* ASN1_GENERIC_ERROR if the type is unknown, */ ++/* ASN1_MEM_ERROR if der vector isn't big enough, */ ++/* otherwise ASN1_SUCCESS. */ ++/******************************************************/ ++static int ++_asn1_insert_tag_der (asn1_node node, unsigned char *der, int *counter, ++ int *max_len) ++{ ++ asn1_node p; ++ int tag_len, is_tag_implicit; ++ unsigned char class, class_implicit = 0, temp[MAX(SIZEOF_UNSIGNED_INT * 3 + 1, LTOSTR_MAX_SIZE)]; ++ unsigned long tag_implicit = 0; ++ unsigned char tag_der[MAX_TAG_LEN]; ++ ++ is_tag_implicit = 0; ++ ++ if (node->type & CONST_TAG) ++ { ++ p = node->down; ++ while (p) ++ { ++ if (type_field (p->type) == ASN1_ETYPE_TAG) ++ { ++ if (p->type & CONST_APPLICATION) ++ class = ASN1_CLASS_APPLICATION; ++ else if (p->type & CONST_UNIVERSAL) ++ class = ASN1_CLASS_UNIVERSAL; ++ else if (p->type & CONST_PRIVATE) ++ class = ASN1_CLASS_PRIVATE; ++ else ++ class = ASN1_CLASS_CONTEXT_SPECIFIC; ++ ++ if (p->type & CONST_EXPLICIT) ++ { ++ if (is_tag_implicit) ++ _asn1_tag_der (class_implicit, tag_implicit, tag_der, ++ &tag_len); ++ else ++ _asn1_tag_der (class | ASN1_CLASS_STRUCTURED, ++ _asn1_strtoul (p->value, NULL, 10), ++ tag_der, &tag_len); ++ ++ *max_len -= tag_len; ++ if (der && *max_len >= 0) ++ memcpy (der + *counter, tag_der, tag_len); ++ *counter += tag_len; ++ ++ _asn1_ltostr (*counter, (char *) temp); ++ _asn1_set_name (p, (const char *) temp); ++ ++ is_tag_implicit = 0; ++ } ++ else ++ { /* CONST_IMPLICIT */ ++ if (!is_tag_implicit) ++ { ++ if ((type_field (node->type) == ASN1_ETYPE_SEQUENCE) || ++ (type_field (node->type) == ASN1_ETYPE_SEQUENCE_OF) ++ || (type_field (node->type) == ASN1_ETYPE_SET) ++ || (type_field (node->type) == ASN1_ETYPE_SET_OF)) ++ class |= ASN1_CLASS_STRUCTURED; ++ class_implicit = class; ++ tag_implicit = _asn1_strtoul (p->value, NULL, 10); ++ is_tag_implicit = 1; ++ } ++ } ++ } ++ p = p->right; ++ } ++ } ++ ++ if (is_tag_implicit) ++ { ++ _asn1_tag_der (class_implicit, tag_implicit, tag_der, &tag_len); ++ } ++ else ++ { ++ unsigned type = type_field (node->type); ++ switch (type) ++ { ++ CASE_HANDLED_ETYPES: ++ _asn1_tag_der (_asn1_tags[type].class, _asn1_tags[type].tag, ++ tag_der, &tag_len); ++ break; ++ case ASN1_ETYPE_TAG: ++ case ASN1_ETYPE_CHOICE: ++ case ASN1_ETYPE_ANY: ++ tag_len = 0; ++ break; ++ default: ++ return ASN1_GENERIC_ERROR; ++ } ++ } ++ ++ *max_len -= tag_len; ++ if (der && *max_len >= 0) ++ memcpy (der + *counter, tag_der, tag_len); ++ *counter += tag_len; ++ ++ if (*max_len < 0) ++ return ASN1_MEM_ERROR; ++ ++ return ASN1_SUCCESS; ++} ++ ++/******************************************************/ ++/* Function : _asn1_ordering_set */ ++/* Description: puts the elements of a SET type in */ ++/* the correct order according to DER rules. */ ++/* Parameters: */ ++/* der: string with the DER coding. */ ++/* node: pointer to the SET element. */ ++/* Return: */ ++/* ASN1_SUCCESS if successful */ ++/* or an error value. */ ++/******************************************************/ ++static int ++_asn1_ordering_set (unsigned char *der, int der_len, asn1_node node) ++{ ++ struct vet ++ { ++ int end; ++ unsigned long value; ++ struct vet *next, *prev; ++ }; ++ ++ int counter, len, len2; ++ struct vet *first, *last, *p_vet, *p2_vet; ++ asn1_node p; ++ unsigned char class, *temp; ++ unsigned long tag, t; ++ int err; ++ ++ counter = 0; ++ ++ if (type_field (node->type) != ASN1_ETYPE_SET) ++ return ASN1_VALUE_NOT_VALID; ++ ++ p = node->down; ++ while (p && ((type_field (p->type) == ASN1_ETYPE_TAG) || ++ (type_field (p->type) == ASN1_ETYPE_SIZE))) ++ p = p->right; ++ ++ if ((p == NULL) || (p->right == NULL)) ++ return ASN1_SUCCESS; ++ ++ first = last = NULL; ++ while (p) ++ { ++ p_vet = malloc (sizeof (struct vet)); ++ if (p_vet == NULL) ++ { ++ err = ASN1_MEM_ALLOC_ERROR; ++ goto error; ++ } ++ ++ p_vet->next = NULL; ++ p_vet->prev = last; ++ if (first == NULL) ++ first = p_vet; ++ else ++ last->next = p_vet; ++ last = p_vet; ++ ++ /* tag value calculation */ ++ err = asn1_get_tag_der (der + counter, der_len - counter, &class, &len2, ++ &tag); ++ if (err != ASN1_SUCCESS) ++ goto error; ++ ++ t = ((unsigned int)class) << 24; ++ p_vet->value = t | tag; ++ counter += len2; ++ ++ /* extraction and length */ ++ len2 = asn1_get_length_der (der + counter, der_len - counter, &len); ++ if (len2 < 0) ++ { ++ err = ASN1_DER_ERROR; ++ goto error; ++ } ++ counter += len + len2; ++ ++ p_vet->end = counter; ++ p = p->right; ++ } ++ ++ p_vet = first; ++ ++ while (p_vet) ++ { ++ p2_vet = p_vet->next; ++ counter = 0; ++ while (p2_vet) ++ { ++ if (p_vet->value > p2_vet->value) ++ { ++ /* change position */ ++ temp = malloc (p_vet->end - counter); ++ if (temp == NULL) ++ { ++ err = ASN1_MEM_ALLOC_ERROR; ++ goto error; ++ } ++ ++ memcpy (temp, der + counter, p_vet->end - counter); ++ memcpy (der + counter, der + p_vet->end, ++ p2_vet->end - p_vet->end); ++ memcpy (der + counter + p2_vet->end - p_vet->end, temp, ++ p_vet->end - counter); ++ free (temp); ++ ++ tag = p_vet->value; ++ p_vet->value = p2_vet->value; ++ p2_vet->value = tag; ++ ++ p_vet->end = counter + (p2_vet->end - p_vet->end); ++ } ++ counter = p_vet->end; ++ ++ p2_vet = p2_vet->next; ++ p_vet = p_vet->next; ++ } ++ ++ if (p_vet != first) ++ p_vet->prev->next = NULL; ++ else ++ first = NULL; ++ free (p_vet); ++ p_vet = first; ++ } ++ return ASN1_SUCCESS; ++ ++error: ++ while (first != NULL) ++ { ++ p_vet = first; ++ first = first->next; ++ free(p_vet); ++ } ++ return err; ++} ++ ++struct vet ++{ ++ unsigned char *ptr; ++ int size; ++}; ++ ++static int setof_compar(const void *_e1, const void *_e2) ++{ ++ unsigned length; ++ const struct vet *e1 = _e1, *e2 = _e2; ++ int rval; ++ ++ /* The encodings of the component values of a set-of value shall ++ * appear in ascending order, the encodings being compared ++ * as octet strings with the shorter components being ++ * padded at their trailing end with 0-octets. ++ * The padding octets are for comparison purposes and ++ * do not appear in the encodings. ++ */ ++ length = MIN(e1->size, e2->size); ++ ++ rval = memcmp(e1->ptr, e2->ptr, length); ++ if (rval == 0 && e1->size != e2->size) ++ { ++ if (e1->size > e2->size) ++ rval = 1; ++ else if (e2->size > e1->size) ++ rval = -1; ++ } ++ ++ return rval; ++} ++ ++/******************************************************/ ++/* Function : _asn1_ordering_set_of */ ++/* Description: puts the elements of a SET OF type in */ ++/* the correct order according to DER rules. */ ++/* Parameters: */ ++/* der: string with the DER coding. */ ++/* node: pointer to the SET OF element. */ ++/* Return: */ ++/* ASN1_SUCCESS if successful */ ++/* or an error value. */ ++/******************************************************/ ++static int ++_asn1_ordering_set_of (unsigned char *der, int der_len, asn1_node node) ++{ ++ int counter, len, len2; ++ struct vet *list = NULL, *tlist; ++ unsigned list_size = 0; ++ struct vet *p_vet; ++ asn1_node p; ++ unsigned char class; ++ unsigned i; ++ unsigned char *out = NULL; ++ int err; ++ ++ if (der == NULL) ++ return ASN1_VALUE_NOT_VALID; ++ ++ counter = 0; ++ ++ if (type_field (node->type) != ASN1_ETYPE_SET_OF) ++ return ASN1_VALUE_NOT_VALID; ++ ++ p = node->down; ++ while (p && ((type_field (p->type) == ASN1_ETYPE_TAG) || ++ (type_field (p->type) == ASN1_ETYPE_SIZE))) ++ p = p->right; ++ if (p == NULL) ++ return ASN1_VALUE_NOT_VALID; ++ p = p->right; ++ ++ if ((p == NULL) || (p->right == NULL)) ++ return ASN1_SUCCESS; ++ ++ while (p) ++ { ++ list_size++; ++ tlist = realloc (list, list_size*sizeof(struct vet)); ++ if (tlist == NULL) ++ { ++ err = ASN1_MEM_ALLOC_ERROR; ++ goto error; ++ } ++ list = tlist; ++ p_vet = &list[list_size-1]; ++ ++ p_vet->ptr = der+counter; ++ p_vet->size = 0; ++ ++ /* extraction of tag and length */ ++ if (der_len - counter > 0) ++ { ++ err = asn1_get_tag_der (der + counter, der_len - counter, &class, ++ &len, NULL); ++ if (err != ASN1_SUCCESS) ++ goto error; ++ counter += len; ++ p_vet->size += len; ++ ++ len2 = asn1_get_length_der (der + counter, der_len - counter, &len); ++ if (len2 < 0) ++ { ++ err = ASN1_DER_ERROR; ++ goto error; ++ } ++ counter += len + len2; ++ p_vet->size += len + len2; ++ ++ } ++ else ++ { ++ err = ASN1_DER_ERROR; ++ goto error; ++ } ++ p = p->right; ++ } ++ ++ if (counter > der_len) ++ { ++ err = ASN1_DER_ERROR; ++ goto error; ++ } ++ ++ qsort(list, list_size, sizeof(struct vet), setof_compar); ++ ++ out = malloc(der_len); ++ if (out == NULL) ++ { ++ err = ASN1_MEM_ERROR; ++ goto error; ++ } ++ ++ /* the sum of p_vet->size == der_len */ ++ counter = 0; ++ for (i = 0; i < list_size; i++) ++ { ++ p_vet = &list[i]; ++ memcpy(out+counter, p_vet->ptr, p_vet->size); ++ counter += p_vet->size; ++ } ++ memcpy(der, out, der_len); ++ free(out); ++ ++ err = ASN1_SUCCESS; ++ ++error: ++ free(list); ++ return err; ++} ++ ++/** ++ * asn1_der_coding: ++ * @element: pointer to an ASN1 element ++ * @name: the name of the structure you want to encode (it must be ++ * inside *POINTER). ++ * @ider: vector that will contain the DER encoding. DER must be a ++ * pointer to memory cells already allocated. ++ * @len: number of bytes of *@ider: @ider[0]..@ider[len-1], Initialy ++ * holds the sizeof of der vector. ++ * @ErrorDescription: return the error description or an empty ++ * string if success. ++ * ++ * Creates the DER encoding for the NAME structure (inside *POINTER ++ * structure). ++ * ++ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND ++ * if @name is not a valid element, %ASN1_VALUE_NOT_FOUND if there ++ * is an element without a value, %ASN1_MEM_ERROR if the @ider ++ * vector isn't big enough and in this case @len will contain the ++ * length needed. ++ **/ ++int ++asn1_der_coding (asn1_node_const element, const char *name, void *ider, int *len, ++ char *ErrorDescription) ++{ ++ asn1_node node, p, p2; ++ unsigned char temp[MAX(LTOSTR_MAX_SIZE, SIZEOF_UNSIGNED_LONG_INT * 3 + 1)]; ++ int counter, counter_old, len2, len3, move, max_len, max_len_old; ++ int err; ++ unsigned char *der = ider; ++ ++ if (ErrorDescription) ++ ErrorDescription[0] = 0; ++ ++ node = asn1_find_node (element, name); ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ /* Node is now a locally allocated variable. ++ * That is because in some point we modify the ++ * structure, and I don't know why! --nmav ++ */ ++ node = _asn1_copy_structure3 (node); ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ max_len = *len; ++ ++ if (der == NULL && max_len > 0) ++ return ASN1_VALUE_NOT_VALID; ++ ++ counter = 0; ++ move = DOWN; ++ p = node; ++ ++ while (1) ++ { ++ ++ counter_old = counter; ++ max_len_old = max_len; ++ if (move != UP) ++ { ++ p->start = counter; ++ err = _asn1_insert_tag_der (p, der, &counter, &max_len); ++ if (err != ASN1_SUCCESS && err != ASN1_MEM_ERROR) ++ goto error; ++ } ++ switch (type_field (p->type)) ++ { ++ case ASN1_ETYPE_NULL: ++ max_len--; ++ if (der != NULL && max_len >= 0) ++ der[counter] = 0; ++ counter++; ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_BOOLEAN: ++ if ((p->type & CONST_DEFAULT) && (p->value == NULL)) ++ { ++ counter = counter_old; ++ max_len = max_len_old; ++ } ++ else ++ { ++ if (p->value == NULL) ++ { ++ _asn1_error_description_value_not_found (p, ++ ErrorDescription); ++ err = ASN1_VALUE_NOT_FOUND; ++ goto error; ++ } ++ max_len -= 2; ++ if (der != NULL && max_len >= 0) ++ { ++ der[counter++] = 1; ++ if (p->value[0] == 'F') ++ der[counter++] = 0; ++ else ++ der[counter++] = 0xFF; ++ } ++ else ++ counter += 2; ++ } ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_INTEGER: ++ case ASN1_ETYPE_ENUMERATED: ++ if ((p->type & CONST_DEFAULT) && (p->value == NULL)) ++ { ++ counter = counter_old; ++ max_len = max_len_old; ++ } ++ else ++ { ++ if (p->value == NULL) ++ { ++ _asn1_error_description_value_not_found (p, ++ ErrorDescription); ++ err = ASN1_VALUE_NOT_FOUND; ++ goto error; ++ } ++ len2 = asn1_get_length_der (p->value, p->value_len, &len3); ++ if (len2 < 0) ++ { ++ err = ASN1_DER_ERROR; ++ goto error; ++ } ++ max_len -= len2 + len3; ++ if (der != NULL && max_len >= 0) ++ memcpy (der + counter, p->value, len3 + len2); ++ counter += len3 + len2; ++ } ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_OBJECT_ID: ++ if ((p->type & CONST_DEFAULT) && (p->value == NULL)) ++ { ++ counter = counter_old; ++ max_len = max_len_old; ++ } ++ else ++ { ++ if (p->value == NULL) ++ { ++ _asn1_error_description_value_not_found (p, ++ ErrorDescription); ++ err = ASN1_VALUE_NOT_FOUND; ++ goto error; ++ } ++ len2 = max_len; ++ err = _asn1_object_id_der ((char*)p->value, der + counter, &len2); ++ if (err != ASN1_SUCCESS && err != ASN1_MEM_ERROR) ++ goto error; ++ ++ max_len -= len2; ++ counter += len2; ++ } ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_GENERALIZED_TIME: ++ case ASN1_ETYPE_UTC_TIME: ++ if (p->value == NULL) ++ { ++ _asn1_error_description_value_not_found (p, ErrorDescription); ++ err = ASN1_VALUE_NOT_FOUND; ++ goto error; ++ } ++ len2 = max_len; ++ err = _asn1_time_der (p->value, p->value_len, der + counter, &len2); ++ if (err != ASN1_SUCCESS && err != ASN1_MEM_ERROR) ++ goto error; ++ ++ max_len -= len2; ++ counter += len2; ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_OCTET_STRING: ++ case ASN1_ETYPE_GENERALSTRING: ++ case ASN1_ETYPE_NUMERIC_STRING: ++ case ASN1_ETYPE_IA5_STRING: ++ case ASN1_ETYPE_TELETEX_STRING: ++ case ASN1_ETYPE_PRINTABLE_STRING: ++ case ASN1_ETYPE_UNIVERSAL_STRING: ++ case ASN1_ETYPE_BMP_STRING: ++ case ASN1_ETYPE_UTF8_STRING: ++ case ASN1_ETYPE_VISIBLE_STRING: ++ case ASN1_ETYPE_BIT_STRING: ++ if (p->value == NULL) ++ { ++ _asn1_error_description_value_not_found (p, ErrorDescription); ++ err = ASN1_VALUE_NOT_FOUND; ++ goto error; ++ } ++ len2 = asn1_get_length_der (p->value, p->value_len, &len3); ++ if (len2 < 0) ++ { ++ err = ASN1_DER_ERROR; ++ goto error; ++ } ++ max_len -= len2 + len3; ++ if (der != NULL && max_len >= 0) ++ memcpy (der + counter, p->value, len3 + len2); ++ counter += len3 + len2; ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_SEQUENCE: ++ case ASN1_ETYPE_SET: ++ if (move != UP) ++ { ++ p->tmp_ival = counter; ++ if (p->down == NULL) ++ { ++ move = UP; ++ continue; ++ } ++ else ++ { ++ p2 = p->down; ++ while (p2 && (type_field (p2->type) == ASN1_ETYPE_TAG)) ++ p2 = p2->right; ++ if (p2) ++ { ++ p = p2; ++ move = RIGHT; ++ continue; ++ } ++ move = UP; ++ continue; ++ } ++ } ++ else ++ { /* move==UP */ ++ len2 = p->tmp_ival; ++ p->tmp_ival = 0; ++ if ((type_field (p->type) == ASN1_ETYPE_SET) && (max_len >= 0)) ++ { ++ err = _asn1_ordering_set (der + len2, counter - len2, p); ++ if (err != ASN1_SUCCESS) ++ goto error; ++ } ++ asn1_length_der (counter - len2, temp, &len3); ++ max_len -= len3; ++ if (der != NULL && max_len >= 0) ++ { ++ memmove (der + len2 + len3, der + len2, counter - len2); ++ memcpy (der + len2, temp, len3); ++ } ++ counter += len3; ++ move = RIGHT; ++ } ++ break; ++ case ASN1_ETYPE_SEQUENCE_OF: ++ case ASN1_ETYPE_SET_OF: ++ if (move != UP) ++ { ++ p->tmp_ival = counter; ++ p = p->down; ++ while ((type_field (p->type) == ASN1_ETYPE_TAG) ++ || (type_field (p->type) == ASN1_ETYPE_SIZE)) ++ p = p->right; ++ if (p->right) ++ { ++ p = p->right; ++ move = RIGHT; ++ continue; ++ } ++ else ++ p = _asn1_find_up (p); ++ move = UP; ++ } ++ if (move == UP) ++ { ++ len2 = p->tmp_ival; ++ p->tmp_ival = 0; ++ if ((type_field (p->type) == ASN1_ETYPE_SET_OF) ++ && (counter - len2 > 0) && (max_len >= 0)) ++ { ++ err = _asn1_ordering_set_of (der + len2, counter - len2, p); ++ if (err != ASN1_SUCCESS) ++ goto error; ++ } ++ asn1_length_der (counter - len2, temp, &len3); ++ max_len -= len3; ++ if (der != NULL && max_len >= 0) ++ { ++ memmove (der + len2 + len3, der + len2, counter - len2); ++ memcpy (der + len2, temp, len3); ++ } ++ counter += len3; ++ move = RIGHT; ++ } ++ break; ++ case ASN1_ETYPE_ANY: ++ if (p->value == NULL) ++ { ++ _asn1_error_description_value_not_found (p, ErrorDescription); ++ err = ASN1_VALUE_NOT_FOUND; ++ goto error; ++ } ++ len2 = asn1_get_length_der (p->value, p->value_len, &len3); ++ if (len2 < 0) ++ { ++ err = ASN1_DER_ERROR; ++ goto error; ++ } ++ max_len -= len2; ++ if (der != NULL && max_len >= 0) ++ memcpy (der + counter, p->value + len3, len2); ++ counter += len2; ++ move = RIGHT; ++ break; ++ default: ++ move = (move == UP) ? RIGHT : DOWN; ++ break; ++ } ++ ++ if ((move != DOWN) && (counter != counter_old)) ++ { ++ p->end = counter - 1; ++ err = _asn1_complete_explicit_tag (p, der, &counter, &max_len); ++ if (err != ASN1_SUCCESS && err != ASN1_MEM_ERROR) ++ goto error; ++ } ++ ++ if (p == node && move != DOWN) ++ break; ++ ++ if (move == DOWN) ++ { ++ if (p->down) ++ p = p->down; ++ else ++ move = RIGHT; ++ } ++ if (move == RIGHT) ++ { ++ if (p->right) ++ p = p->right; ++ else ++ move = UP; ++ } ++ if (move == UP) ++ p = _asn1_find_up (p); ++ } ++ ++ *len = counter; ++ ++ if (max_len < 0) ++ { ++ err = ASN1_MEM_ERROR; ++ goto error; ++ } ++ ++ err = ASN1_SUCCESS; ++ ++error: ++ asn1_delete_structure (&node); ++ return err; ++} +diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c +new file mode 100644 +index 00000000000..ff04eb778cb +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/decoding.c +@@ -0,0 +1,2478 @@ ++/* ++ * Copyright (C) 2002-2016 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++ ++/*****************************************************/ ++/* File: decoding.c */ ++/* Description: Functions to manage DER decoding */ ++/*****************************************************/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef DEBUG ++# define warn() fprintf(stderr, "%s: %d\n", __func__, __LINE__) ++#else ++# define warn() ++#endif ++ ++#define IS_ERR(len, flags) (len < -1 || ((flags & ASN1_DECODE_FLAG_STRICT_DER) && len < 0)) ++ ++#define HAVE_TWO(x) (x>=2?1:0) ++ ++/* Decoding flags (dflags) used in several decoding functions. ++ * DECODE_FLAG_HAVE_TAG: The provided buffer includes a tag ++ * DECODE_FLAG_CONSTRUCTED: The provided buffer is of indefinite encoding (useful ++ * when no tags are present). ++ * DECODE_FLAG_LEVEL1: Internal flag to indicate a level of recursion for BER strings. ++ * DECODE_FLAG_LEVEL2: Internal flag to indicate two levels of recursion for BER strings. ++ * DECODE_FLAG_LEVEL3: Internal flag to indicate three levels of recursion for BER strings. ++ * This is the maximum levels of recursion possible to prevent stack ++ * exhaustion. ++ */ ++ ++#define DECODE_FLAG_HAVE_TAG 1 ++#define DECODE_FLAG_CONSTRUCTED (1<<1) ++#define DECODE_FLAG_LEVEL1 (1<<2) ++#define DECODE_FLAG_LEVEL2 (1<<3) ++#define DECODE_FLAG_LEVEL3 (1<<4) ++ ++#define DECR_LEN(l, s) do { \ ++ l -= s; \ ++ if (l < 0) { \ ++ warn(); \ ++ result = ASN1_DER_ERROR; \ ++ goto cleanup; \ ++ } \ ++ } while (0) ++ ++static int ++_asn1_get_indefinite_length_string (const unsigned char *der, int der_len, int *len); ++ ++static int ++_asn1_decode_simple_ber (unsigned int etype, const unsigned char *der, ++ unsigned int _der_len, unsigned char **str, ++ unsigned int *str_len, unsigned int *ber_len, ++ unsigned dflags); ++ ++static int ++_asn1_decode_simple_der (unsigned int etype, const unsigned char *der, ++ unsigned int _der_len, const unsigned char **str, ++ unsigned int *str_len, unsigned dflags); ++ ++static void ++_asn1_error_description_tag_error (asn1_node node, char *ErrorDescription) ++{ ++ ++ Estrcpy (ErrorDescription, ":: tag error near element '"); ++ _asn1_hierarchical_name (node, ErrorDescription + strlen (ErrorDescription), ++ ASN1_MAX_ERROR_DESCRIPTION_SIZE - 40); ++ Estrcat (ErrorDescription, "'"); ++ ++} ++ ++/** ++ * asn1_get_length_der: ++ * @der: DER data to decode. ++ * @der_len: Length of DER data to decode. ++ * @len: Output variable containing the length of the DER length field. ++ * ++ * Extract a length field from DER data. ++ * ++ * Returns: Return the decoded length value, or -1 on indefinite ++ * length, or -2 when the value was too big to fit in a int, or -4 ++ * when the decoded length value plus @len would exceed @der_len. ++ **/ ++long ++asn1_get_length_der (const unsigned char *der, int der_len, int *len) ++{ ++ unsigned int ans; ++ int k, punt, sum; ++ ++ *len = 0; ++ if (der_len <= 0) ++ return 0; ++ ++ if (!(der[0] & 128)) ++ { ++ /* short form */ ++ *len = 1; ++ ans = der[0]; ++ } ++ else ++ { ++ /* Long form */ ++ k = der[0] & 0x7F; ++ punt = 1; ++ if (k) ++ { /* definite length method */ ++ ans = 0; ++ while (punt <= k && punt < der_len) ++ { ++ if (INT_MULTIPLY_OVERFLOW (ans, 256)) ++ return -2; ++ ans *= 256; ++ ++ if (INT_ADD_OVERFLOW (ans, ((unsigned) der[punt]))) ++ return -2; ++ ans += der[punt]; ++ punt++; ++ } ++ } ++ else ++ { /* indefinite length method */ ++ *len = punt; ++ return -1; ++ } ++ ++ *len = punt; ++ } ++ ++ sum = ans; ++ if (ans >= INT_MAX || INT_ADD_OVERFLOW (sum, (*len))) ++ return -2; ++ sum += *len; ++ ++ if (sum > der_len) ++ return -4; ++ ++ return ans; ++} ++ ++/** ++ * asn1_get_tag_der: ++ * @der: DER data to decode. ++ * @der_len: Length of DER data to decode. ++ * @cls: Output variable containing decoded class. ++ * @len: Output variable containing the length of the DER TAG data. ++ * @tag: Output variable containing the decoded tag (may be %NULL). ++ * ++ * Decode the class and TAG from DER code. ++ * ++ * Returns: Returns %ASN1_SUCCESS on success, or an error. ++ **/ ++int ++asn1_get_tag_der (const unsigned char *der, int der_len, ++ unsigned char *cls, int *len, unsigned long *tag) ++{ ++ unsigned int ris; ++ int punt; ++ ++ if (der == NULL || der_len < 2 || len == NULL) ++ return ASN1_DER_ERROR; ++ ++ *cls = der[0] & 0xE0; ++ if ((der[0] & 0x1F) != 0x1F) ++ { ++ /* short form */ ++ *len = 1; ++ ris = der[0] & 0x1F; ++ } ++ else ++ { ++ /* Long form */ ++ punt = 1; ++ ris = 0; ++ while (punt < der_len && der[punt] & 128) ++ { ++ ++ if (INT_MULTIPLY_OVERFLOW (ris, 128)) ++ return ASN1_DER_ERROR; ++ ris *= 128; ++ ++ if (INT_ADD_OVERFLOW (ris, ((unsigned) (der[punt] & 0x7F)))) ++ return ASN1_DER_ERROR; ++ ris += (der[punt] & 0x7F); ++ punt++; ++ } ++ ++ if (punt >= der_len) ++ return ASN1_DER_ERROR; ++ ++ if (INT_MULTIPLY_OVERFLOW (ris, 128)) ++ return ASN1_DER_ERROR; ++ ris *= 128; ++ ++ if (INT_ADD_OVERFLOW (ris, ((unsigned) (der[punt] & 0x7F)))) ++ return ASN1_DER_ERROR; ++ ris += (der[punt] & 0x7F); ++ punt++; ++ ++ *len = punt; ++ } ++ ++ if (tag) ++ *tag = ris; ++ return ASN1_SUCCESS; ++} ++ ++/** ++ * asn1_get_length_ber: ++ * @ber: BER data to decode. ++ * @ber_len: Length of BER data to decode. ++ * @len: Output variable containing the length of the BER length field. ++ * ++ * Extract a length field from BER data. The difference to ++ * asn1_get_length_der() is that this function will return a length ++ * even if the value has indefinite encoding. ++ * ++ * Returns: Return the decoded length value, or negative value when ++ * the value was too big. ++ * ++ * Since: 2.0 ++ **/ ++long ++asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len) ++{ ++ int ret; ++ long err; ++ ++ ret = asn1_get_length_der (ber, ber_len, len); ++ ++ if (ret == -1 && ber_len > 1) ++ { /* indefinite length method */ ++ err = _asn1_get_indefinite_length_string (ber + 1, ber_len-1, &ret); ++ if (err != ASN1_SUCCESS) ++ return -3; ++ } ++ ++ return ret; ++} ++ ++/** ++ * asn1_get_octet_der: ++ * @der: DER data to decode containing the OCTET SEQUENCE. ++ * @der_len: The length of the @der data to decode. ++ * @ret_len: Output variable containing the encoded length of the DER data. ++ * @str: Pre-allocated output buffer to put decoded OCTET SEQUENCE in. ++ * @str_size: Length of pre-allocated output buffer. ++ * @str_len: Output variable containing the length of the contents of the OCTET SEQUENCE. ++ * ++ * Extract an OCTET SEQUENCE from DER data. Note that this function ++ * expects the DER data past the tag field, i.e., the length and ++ * content octets. ++ * ++ * Returns: Returns %ASN1_SUCCESS on success, or an error. ++ **/ ++int ++asn1_get_octet_der (const unsigned char *der, int der_len, ++ int *ret_len, unsigned char *str, int str_size, ++ int *str_len) ++{ ++ int len_len = 0; ++ ++ if (der_len <= 0) ++ return ASN1_GENERIC_ERROR; ++ ++ *str_len = asn1_get_length_der (der, der_len, &len_len); ++ ++ if (*str_len < 0) ++ return ASN1_DER_ERROR; ++ ++ *ret_len = *str_len + len_len; ++ if (str_size >= *str_len) ++ { ++ if (*str_len > 0 && str != NULL) ++ memcpy (str, der + len_len, *str_len); ++ } ++ else ++ { ++ return ASN1_MEM_ERROR; ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/*- ++ * _asn1_get_time_der: ++ * @type: %ASN1_ETYPE_GENERALIZED_TIME or %ASN1_ETYPE_UTC_TIME ++ * @der: DER data to decode containing the time ++ * @der_len: Length of DER data to decode. ++ * @ret_len: Output variable containing the length of the DER data. ++ * @str: Pre-allocated output buffer to put the textual time in. ++ * @str_size: Length of pre-allocated output buffer. ++ * @flags: Zero or %ASN1_DECODE_FLAG_STRICT_DER ++ * ++ * Performs basic checks in the DER encoded time object and returns its textual form. ++ * The textual form will be in the YYYYMMDD000000Z format for GeneralizedTime ++ * and YYMMDD000000Z for UTCTime. ++ * ++ * Returns: %ASN1_SUCCESS on success, or an error. ++ -*/ ++static int ++_asn1_get_time_der (unsigned type, const unsigned char *der, int der_len, int *ret_len, ++ char *str, int str_size, unsigned flags) ++{ ++ int len_len, str_len; ++ unsigned i; ++ unsigned sign_count = 0; ++ unsigned dot_count = 0; ++ const unsigned char *p; ++ ++ if (der_len <= 0 || str == NULL) ++ return ASN1_DER_ERROR; ++ ++ str_len = asn1_get_length_der (der, der_len, &len_len); ++ if (str_len <= 0 || str_size < str_len) ++ return ASN1_DER_ERROR; ++ ++ /* perform some sanity checks on the data */ ++ if (str_len < 8) ++ { ++ warn(); ++ return ASN1_TIME_ENCODING_ERROR; ++ } ++ ++ if ((flags & ASN1_DECODE_FLAG_STRICT_DER) && !(flags & ASN1_DECODE_FLAG_ALLOW_INCORRECT_TIME)) ++ { ++ p = &der[len_len]; ++ for (i=0;i<(unsigned)(str_len-1);i++) ++ { ++ if (c_isdigit(p[i]) == 0) ++ { ++ if (type == ASN1_ETYPE_GENERALIZED_TIME) ++ { ++ /* tolerate lax encodings */ ++ if (p[i] == '.' && dot_count == 0) ++ { ++ dot_count++; ++ continue; ++ } ++ ++ /* This is not really valid DER, but there are ++ * structures using that */ ++ if (!(flags & ASN1_DECODE_FLAG_STRICT_DER) && ++ (p[i] == '+' || p[i] == '-') && sign_count == 0) ++ { ++ sign_count++; ++ continue; ++ } ++ } ++ ++ warn(); ++ return ASN1_TIME_ENCODING_ERROR; ++ } ++ } ++ ++ if (sign_count == 0 && p[str_len-1] != 'Z') ++ { ++ warn(); ++ return ASN1_TIME_ENCODING_ERROR; ++ } ++ } ++ memcpy (str, der + len_len, str_len); ++ str[str_len] = 0; ++ *ret_len = str_len + len_len; ++ ++ return ASN1_SUCCESS; ++} ++ ++/** ++ * asn1_get_object_id_der: ++ * @der: DER data to decode containing the OBJECT IDENTIFIER ++ * @der_len: Length of DER data to decode. ++ * @ret_len: Output variable containing the length of the DER data. ++ * @str: Pre-allocated output buffer to put the textual object id in. ++ * @str_size: Length of pre-allocated output buffer. ++ * ++ * Converts a DER encoded object identifier to its textual form. This ++ * function expects the DER object identifier without the tag. ++ * ++ * Returns: %ASN1_SUCCESS on success, or an error. ++ **/ ++int ++asn1_get_object_id_der (const unsigned char *der, int der_len, int *ret_len, ++ char *str, int str_size) ++{ ++ int len_len, len, k; ++ int leading, parsed; ++ char temp[LTOSTR_MAX_SIZE]; ++ uint64_t val, val1, val0; ++ ++ *ret_len = 0; ++ if (str && str_size > 0) ++ str[0] = 0; /* no oid */ ++ ++ if (str == NULL || der_len <= 0) ++ return ASN1_GENERIC_ERROR; ++ ++ len = asn1_get_length_der (der, der_len, &len_len); ++ ++ if (len <= 0 || len + len_len > der_len) ++ return ASN1_DER_ERROR; ++ ++ /* leading octet can never be 0x80 */ ++ if (der[len_len] == 0x80) ++ return ASN1_DER_ERROR; ++ ++ val0 = 0; ++ ++ for (k = 0; k < len; k++) ++ { ++ if (INT_LEFT_SHIFT_OVERFLOW (val0, 7)) ++ return ASN1_DER_ERROR; ++ ++ val0 <<= 7; ++ val0 |= der[len_len + k] & 0x7F; ++ if (!(der[len_len + k] & 0x80)) ++ break; ++ } ++ parsed = ++k; ++ ++ /* val0 = (X*40) + Y, X={0,1,2}, Y<=39 when X={0,1} */ ++ /* X = val, Y = val1 */ ++ ++ /* check if X == 0 */ ++ val = 0; ++ val1 = val0; ++ if (val1 > 39) ++ { ++ val = 1; ++ val1 = val0 - 40; ++ if (val1 > 39) ++ { ++ val = 2; ++ val1 = val0 - 80; ++ } ++ } ++ ++ _asn1_str_cpy (str, str_size, _asn1_ltostr (val, temp)); ++ _asn1_str_cat (str, str_size, "."); ++ _asn1_str_cat (str, str_size, _asn1_ltostr (val1, temp)); ++ ++ val = 0; ++ leading = 1; ++ for (k = parsed; k < len; k++) ++ { ++ /* X.690 mandates that the leading byte must never be 0x80 ++ */ ++ if (leading != 0 && der[len_len + k] == 0x80) ++ return ASN1_DER_ERROR; ++ leading = 0; ++ ++ /* check for wrap around */ ++ if (INT_LEFT_SHIFT_OVERFLOW (val, 7)) ++ return ASN1_DER_ERROR; ++ ++ val = val << 7; ++ val |= der[len_len + k] & 0x7F; ++ ++ if (!(der[len_len + k] & 0x80)) ++ { ++ _asn1_str_cat (str, str_size, "."); ++ _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp)); ++ val = 0; ++ leading = 1; ++ } ++ } ++ ++ if (INT_ADD_OVERFLOW (len, len_len)) ++ return ASN1_DER_ERROR; ++ ++ *ret_len = len + len_len; ++ ++ return ASN1_SUCCESS; ++} ++ ++/** ++ * asn1_get_bit_der: ++ * @der: DER data to decode containing the BIT SEQUENCE. ++ * @der_len: Length of DER data to decode. ++ * @ret_len: Output variable containing the length of the DER data. ++ * @str: Pre-allocated output buffer to put decoded BIT SEQUENCE in. ++ * @str_size: Length of pre-allocated output buffer. ++ * @bit_len: Output variable containing the size of the BIT SEQUENCE. ++ * ++ * Extract a BIT SEQUENCE from DER data. ++ * ++ * Returns: %ASN1_SUCCESS on success, or an error. ++ **/ ++int ++asn1_get_bit_der (const unsigned char *der, int der_len, ++ int *ret_len, unsigned char *str, int str_size, ++ int *bit_len) ++{ ++ int len_len = 0, len_byte; ++ ++ if (der_len <= 0) ++ return ASN1_GENERIC_ERROR; ++ ++ len_byte = asn1_get_length_der (der, der_len, &len_len) - 1; ++ if (len_byte < 0) ++ return ASN1_DER_ERROR; ++ ++ *ret_len = len_byte + len_len + 1; ++ *bit_len = len_byte * 8 - der[len_len]; ++ ++ if (*bit_len < 0) ++ return ASN1_DER_ERROR; ++ ++ if (str_size >= len_byte) ++ { ++ if (len_byte > 0 && str) ++ memcpy (str, der + len_len + 1, len_byte); ++ } ++ else ++ { ++ return ASN1_MEM_ERROR; ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++/* tag_len: the total tag length (explicit+inner) ++ * inner_tag_len: the inner_tag length ++ */ ++static int ++_asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len, ++ int *tag_len, int *inner_tag_len, unsigned flags) ++{ ++ asn1_node p; ++ int counter, len2, len3, is_tag_implicit; ++ int result; ++ unsigned long tag, tag_implicit = 0; ++ unsigned char class, class2, class_implicit = 0; ++ ++ if (der_len <= 0) ++ return ASN1_GENERIC_ERROR; ++ ++ counter = is_tag_implicit = 0; ++ ++ if (node->type & CONST_TAG) ++ { ++ p = node->down; ++ while (p) ++ { ++ if (type_field (p->type) == ASN1_ETYPE_TAG) ++ { ++ if (p->type & CONST_APPLICATION) ++ class2 = ASN1_CLASS_APPLICATION; ++ else if (p->type & CONST_UNIVERSAL) ++ class2 = ASN1_CLASS_UNIVERSAL; ++ else if (p->type & CONST_PRIVATE) ++ class2 = ASN1_CLASS_PRIVATE; ++ else ++ class2 = ASN1_CLASS_CONTEXT_SPECIFIC; ++ ++ if (p->type & CONST_EXPLICIT) ++ { ++ if (asn1_get_tag_der ++ (der + counter, der_len, &class, &len2, ++ &tag) != ASN1_SUCCESS) ++ return ASN1_DER_ERROR; ++ ++ DECR_LEN(der_len, len2); ++ counter += len2; ++ ++ if (flags & ASN1_DECODE_FLAG_STRICT_DER) ++ len3 = ++ asn1_get_length_der (der + counter, der_len, ++ &len2); ++ else ++ len3 = ++ asn1_get_length_ber (der + counter, der_len, ++ &len2); ++ if (len3 < 0) ++ return ASN1_DER_ERROR; ++ ++ DECR_LEN(der_len, len2); ++ counter += len2; ++ ++ if (!is_tag_implicit) ++ { ++ if ((class != (class2 | ASN1_CLASS_STRUCTURED)) || ++ (tag != strtoul ((char *) p->value, NULL, 10))) ++ return ASN1_TAG_ERROR; ++ } ++ else ++ { /* ASN1_TAG_IMPLICIT */ ++ if ((class != class_implicit) || (tag != tag_implicit)) ++ return ASN1_TAG_ERROR; ++ } ++ is_tag_implicit = 0; ++ } ++ else ++ { /* ASN1_TAG_IMPLICIT */ ++ if (!is_tag_implicit) ++ { ++ if ((type_field (node->type) == ASN1_ETYPE_SEQUENCE) || ++ (type_field (node->type) == ASN1_ETYPE_SEQUENCE_OF) ++ || (type_field (node->type) == ASN1_ETYPE_SET) ++ || (type_field (node->type) == ASN1_ETYPE_SET_OF)) ++ class2 |= ASN1_CLASS_STRUCTURED; ++ class_implicit = class2; ++ tag_implicit = strtoul ((char *) p->value, NULL, 10); ++ is_tag_implicit = 1; ++ } ++ } ++ } ++ p = p->right; ++ } ++ } ++ ++ if (is_tag_implicit) ++ { ++ if (asn1_get_tag_der ++ (der + counter, der_len, &class, &len2, ++ &tag) != ASN1_SUCCESS) ++ return ASN1_DER_ERROR; ++ ++ DECR_LEN(der_len, len2); ++ ++ if ((class != class_implicit) || (tag != tag_implicit)) ++ { ++ if (type_field (node->type) == ASN1_ETYPE_OCTET_STRING) ++ { ++ class_implicit |= ASN1_CLASS_STRUCTURED; ++ if ((class != class_implicit) || (tag != tag_implicit)) ++ return ASN1_TAG_ERROR; ++ } ++ else ++ return ASN1_TAG_ERROR; ++ } ++ } ++ else ++ { ++ unsigned type = type_field (node->type); ++ if (type == ASN1_ETYPE_TAG) ++ { ++ *tag_len = 0; ++ if (inner_tag_len) ++ *inner_tag_len = 0; ++ return ASN1_SUCCESS; ++ } ++ ++ if (asn1_get_tag_der ++ (der + counter, der_len, &class, &len2, ++ &tag) != ASN1_SUCCESS) ++ return ASN1_DER_ERROR; ++ ++ DECR_LEN(der_len, len2); ++ ++ switch (type) ++ { ++ case ASN1_ETYPE_NULL: ++ case ASN1_ETYPE_BOOLEAN: ++ case ASN1_ETYPE_INTEGER: ++ case ASN1_ETYPE_ENUMERATED: ++ case ASN1_ETYPE_OBJECT_ID: ++ case ASN1_ETYPE_GENERALSTRING: ++ case ASN1_ETYPE_NUMERIC_STRING: ++ case ASN1_ETYPE_IA5_STRING: ++ case ASN1_ETYPE_TELETEX_STRING: ++ case ASN1_ETYPE_PRINTABLE_STRING: ++ case ASN1_ETYPE_UNIVERSAL_STRING: ++ case ASN1_ETYPE_BMP_STRING: ++ case ASN1_ETYPE_UTF8_STRING: ++ case ASN1_ETYPE_VISIBLE_STRING: ++ case ASN1_ETYPE_BIT_STRING: ++ case ASN1_ETYPE_SEQUENCE: ++ case ASN1_ETYPE_SEQUENCE_OF: ++ case ASN1_ETYPE_SET: ++ case ASN1_ETYPE_SET_OF: ++ case ASN1_ETYPE_GENERALIZED_TIME: ++ case ASN1_ETYPE_UTC_TIME: ++ if ((class != _asn1_tags[type].class) ++ || (tag != _asn1_tags[type].tag)) ++ return ASN1_DER_ERROR; ++ break; ++ ++ case ASN1_ETYPE_OCTET_STRING: ++ /* OCTET STRING is handled differently to allow ++ * BER encodings (structured class). */ ++ if (((class != ASN1_CLASS_UNIVERSAL) ++ && (class != (ASN1_CLASS_UNIVERSAL | ASN1_CLASS_STRUCTURED))) ++ || (tag != ASN1_TAG_OCTET_STRING)) ++ return ASN1_DER_ERROR; ++ break; ++ case ASN1_ETYPE_ANY: ++ counter -= len2; ++ break; ++ case ASN1_ETYPE_CHOICE: ++ counter -= len2; ++ break; ++ default: ++ return ASN1_DER_ERROR; ++ break; ++ } ++ } ++ ++ counter += len2; ++ *tag_len = counter; ++ if (inner_tag_len) ++ *inner_tag_len = len2; ++ return ASN1_SUCCESS; ++ ++cleanup: ++ return result; ++} ++ ++static int ++extract_tag_der_recursive(asn1_node node, const unsigned char *der, int der_len, ++ int *ret_len, int *inner_len, unsigned flags) ++{ ++asn1_node p; ++int ris = ASN1_DER_ERROR; ++ ++ if (type_field (node->type) == ASN1_ETYPE_CHOICE) ++ { ++ p = node->down; ++ while (p) ++ { ++ ris = _asn1_extract_tag_der (p, der, der_len, ret_len, inner_len, flags); ++ if (ris == ASN1_SUCCESS) ++ break; ++ p = p->right; ++ } ++ ++ *ret_len = 0; ++ return ris; ++ } ++ else ++ return _asn1_extract_tag_der (node, der, der_len, ret_len, inner_len, flags); ++} ++ ++static int ++_asn1_delete_not_used (asn1_node node) ++{ ++ asn1_node p, p2; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = node; ++ while (p) ++ { ++ if (p->type & CONST_NOT_USED) ++ { ++ p2 = NULL; ++ if (p != node) ++ { ++ p2 = _asn1_find_left (p); ++ if (!p2) ++ p2 = _asn1_find_up (p); ++ } ++ asn1_delete_structure (&p); ++ p = p2; ++ } ++ ++ if (!p) ++ break; /* reach node */ ++ ++ if (p->down) ++ { ++ p = p->down; ++ } ++ else ++ { ++ if (p == node) ++ p = NULL; ++ else if (p->right) ++ p = p->right; ++ else ++ { ++ while (1) ++ { ++ p = _asn1_find_up (p); ++ if (p == node) ++ { ++ p = NULL; ++ break; ++ } ++ if (p->right) ++ { ++ p = p->right; ++ break; ++ } ++ } ++ } ++ } ++ } ++ return ASN1_SUCCESS; ++} ++ ++static int ++_asn1_get_indefinite_length_string (const unsigned char *der, ++ int der_len, int *len) ++{ ++ int len2, len3, counter, indefinite; ++ int result; ++ unsigned long tag; ++ unsigned char class; ++ ++ counter = indefinite = 0; ++ ++ while (1) ++ { ++ if (HAVE_TWO(der_len) && (der[counter] == 0) && (der[counter + 1] == 0)) ++ { ++ counter += 2; ++ DECR_LEN(der_len, 2); ++ ++ indefinite--; ++ if (indefinite <= 0) ++ break; ++ else ++ continue; ++ } ++ ++ if (asn1_get_tag_der ++ (der + counter, der_len, &class, &len2, ++ &tag) != ASN1_SUCCESS) ++ return ASN1_DER_ERROR; ++ ++ DECR_LEN(der_len, len2); ++ counter += len2; ++ ++ len2 = asn1_get_length_der (der + counter, der_len, &len3); ++ if (len2 < -1) ++ return ASN1_DER_ERROR; ++ ++ if (len2 == -1) ++ { ++ indefinite++; ++ counter += 1; ++ DECR_LEN(der_len, 1); ++ } ++ else ++ { ++ counter += len2 + len3; ++ DECR_LEN(der_len, len2+len3); ++ } ++ } ++ ++ *len = counter; ++ return ASN1_SUCCESS; ++ ++cleanup: ++ return result; ++} ++ ++static void delete_unneeded_choice_fields(asn1_node p) ++{ ++ asn1_node p2; ++ ++ while (p->right) ++ { ++ p2 = p->right; ++ asn1_delete_structure (&p2); ++ } ++} ++ ++ ++/** ++ * asn1_der_decoding2 ++ * @element: pointer to an ASN1 structure. ++ * @ider: vector that contains the DER encoding. ++ * @max_ider_len: pointer to an integer giving the information about the ++ * maximal number of bytes occupied by *@ider. The real size of the DER ++ * encoding is returned through this pointer. ++ * @flags: flags controlling the behaviour of the function. ++ * @errorDescription: null-terminated string contains details when an ++ * error occurred. ++ * ++ * Fill the structure *@element with values of a DER encoding string. The ++ * structure must just be created with function asn1_create_element(). ++ * ++ * If %ASN1_DECODE_FLAG_ALLOW_PADDING flag is set then the function will ignore ++ * padding after the decoded DER data. Upon a successful return the value of ++ * *@max_ider_len will be set to the number of bytes decoded. ++ * ++ * If %ASN1_DECODE_FLAG_STRICT_DER flag is set then the function will ++ * not decode any BER-encoded elements. ++ * ++ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND ++ * if @ELEMENT is %NULL, and %ASN1_TAG_ERROR or ++ * %ASN1_DER_ERROR if the der encoding doesn't match the structure ++ * name (*@ELEMENT deleted). ++ **/ ++int ++asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, ++ unsigned int flags, char *errorDescription) ++{ ++ asn1_node node, p, p2, p3; ++ char temp[128]; ++ int counter, len2, len3, len4, move, ris, tlen; ++ struct node_tail_cache_st tcache = {NULL, NULL}; ++ unsigned char class; ++ unsigned long tag; ++ int tag_len; ++ int indefinite, result, total_len = *max_ider_len, ider_len = *max_ider_len; ++ int inner_tag_len; ++ unsigned char *ptmp; ++ const unsigned char *ptag; ++ const unsigned char *der = ider; ++ ++ node = *element; ++ ++ if (errorDescription != NULL) ++ errorDescription[0] = 0; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ if (node->type & CONST_OPTION) ++ { ++ result = ASN1_GENERIC_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ counter = 0; ++ move = DOWN; ++ p = node; ++ while (1) ++ { ++ tag_len = 0; ++ inner_tag_len = 0; ++ ris = ASN1_SUCCESS; ++ if (move != UP) ++ { ++ if (p->type & CONST_SET) ++ { ++ p2 = _asn1_find_up (p); ++ len2 = p2->tmp_ival; ++ if (len2 == -1) ++ { ++ if (HAVE_TWO(ider_len) && !der[counter] && !der[counter + 1]) ++ { ++ p = p2; ++ move = UP; ++ counter += 2; ++ DECR_LEN(ider_len, 2); ++ continue; ++ } ++ } ++ else if (counter == len2) ++ { ++ p = p2; ++ move = UP; ++ continue; ++ } ++ else if (counter > len2) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ p2 = p2->down; ++ while (p2) ++ { ++ if ((p2->type & CONST_SET) && (p2->type & CONST_NOT_USED)) ++ { ++ ris = ++ extract_tag_der_recursive (p2, der + counter, ++ ider_len, &len2, NULL, flags); ++ if (ris == ASN1_SUCCESS) ++ { ++ p2->type &= ~CONST_NOT_USED; ++ p = p2; ++ break; ++ } ++ } ++ p2 = p2->right; ++ } ++ if (p2 == NULL) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ } ++ ++ /* the position in the DER structure this starts */ ++ p->start = counter; ++ p->end = total_len - 1; ++ ++ if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT)) ++ { ++ p2 = _asn1_find_up (p); ++ len2 = p2->tmp_ival; ++ if (counter == len2) ++ { ++ if (p->right) ++ { ++ p2 = p->right; ++ move = RIGHT; ++ } ++ else ++ move = UP; ++ ++ if (p->type & CONST_OPTION) ++ asn1_delete_structure (&p); ++ ++ p = p2; ++ continue; ++ } ++ } ++ ++ if (type_field (p->type) == ASN1_ETYPE_CHOICE) ++ { ++ while (p->down) ++ { ++ ris = ++ extract_tag_der_recursive (p->down, der + counter, ++ ider_len, &len2, NULL, flags); ++ ++ if (ris == ASN1_SUCCESS) ++ { ++ delete_unneeded_choice_fields(p->down); ++ break; ++ } ++ else if (ris == ASN1_ERROR_TYPE_ANY) ++ { ++ result = ASN1_ERROR_TYPE_ANY; ++ warn(); ++ goto cleanup; ++ } ++ else ++ { ++ p2 = p->down; ++ asn1_delete_structure (&p2); ++ } ++ } ++ ++ if (p->down == NULL) ++ { ++ if (!(p->type & CONST_OPTION)) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ } ++ else if (type_field (p->type) != ASN1_ETYPE_CHOICE) ++ p = p->down; ++ ++ p->start = counter; ++ } ++ ++ if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT)) ++ { ++ p2 = _asn1_find_up (p); ++ len2 = p2->tmp_ival; ++ ++ if ((len2 != -1) && (counter > len2)) ++ ris = ASN1_TAG_ERROR; ++ } ++ ++ if (ris == ASN1_SUCCESS) ++ ris = ++ extract_tag_der_recursive (p, der + counter, ider_len, ++ &tag_len, &inner_tag_len, flags); ++ ++ if (ris != ASN1_SUCCESS) ++ { ++ if (p->type & CONST_OPTION) ++ { ++ p->type |= CONST_NOT_USED; ++ move = RIGHT; ++ } ++ else if (p->type & CONST_DEFAULT) ++ { ++ _asn1_set_value (p, NULL, 0); ++ move = RIGHT; ++ } ++ else ++ { ++ if (errorDescription != NULL) ++ _asn1_error_description_tag_error (p, errorDescription); ++ ++ result = ASN1_TAG_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ } ++ else ++ { ++ DECR_LEN(ider_len, tag_len); ++ counter += tag_len; ++ } ++ } ++ ++ if (ris == ASN1_SUCCESS) ++ { ++ switch (type_field (p->type)) ++ { ++ case ASN1_ETYPE_NULL: ++ DECR_LEN(ider_len, 1); ++ if (der[counter]) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ counter++; ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_BOOLEAN: ++ DECR_LEN(ider_len, 2); ++ ++ if (der[counter++] != 1) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ if (der[counter++] == 0) ++ _asn1_set_value (p, "F", 1); ++ else ++ _asn1_set_value (p, "T", 1); ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_INTEGER: ++ case ASN1_ETYPE_ENUMERATED: ++ len2 = ++ asn1_get_length_der (der + counter, ider_len, &len3); ++ if (len2 < 0) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len3+len2); ++ ++ _asn1_set_value (p, der + counter, len3 + len2); ++ counter += len3 + len2; ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_OBJECT_ID: ++ result = ++ asn1_get_object_id_der (der + counter, ider_len, &len2, ++ temp, sizeof (temp)); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len2); ++ ++ tlen = strlen (temp); ++ if (tlen > 0) ++ _asn1_set_value (p, temp, tlen + 1); ++ ++ counter += len2; ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_GENERALIZED_TIME: ++ case ASN1_ETYPE_UTC_TIME: ++ result = ++ _asn1_get_time_der (type_field (p->type), der + counter, ider_len, &len2, temp, ++ sizeof (temp) - 1, flags); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len2); ++ ++ tlen = strlen (temp); ++ if (tlen > 0) ++ _asn1_set_value (p, temp, tlen); ++ ++ counter += len2; ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_OCTET_STRING: ++ if (counter < inner_tag_len) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ ptag = der + counter - inner_tag_len; ++ if ((flags & ASN1_DECODE_FLAG_STRICT_DER) || !(ptag[0] & ASN1_CLASS_STRUCTURED)) ++ { ++ if (ptag[0] & ASN1_CLASS_STRUCTURED) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ len2 = ++ asn1_get_length_der (der + counter, ider_len, &len3); ++ if (len2 < 0) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len3+len2); ++ ++ _asn1_set_value (p, der + counter, len3 + len2); ++ counter += len3 + len2; ++ } ++ else ++ { ++ unsigned dflags = 0, vlen, ber_len; ++ ++ if (ptag[0] & ASN1_CLASS_STRUCTURED) ++ dflags |= DECODE_FLAG_CONSTRUCTED; ++ ++ result = _asn1_decode_simple_ber(type_field (p->type), der+counter, ider_len, &ptmp, &vlen, &ber_len, dflags); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, ber_len); ++ ++ _asn1_set_value_lv (p, ptmp, vlen); ++ ++ counter += ber_len; ++ free(ptmp); ++ } ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_GENERALSTRING: ++ case ASN1_ETYPE_NUMERIC_STRING: ++ case ASN1_ETYPE_IA5_STRING: ++ case ASN1_ETYPE_TELETEX_STRING: ++ case ASN1_ETYPE_PRINTABLE_STRING: ++ case ASN1_ETYPE_UNIVERSAL_STRING: ++ case ASN1_ETYPE_BMP_STRING: ++ case ASN1_ETYPE_UTF8_STRING: ++ case ASN1_ETYPE_VISIBLE_STRING: ++ case ASN1_ETYPE_BIT_STRING: ++ len2 = ++ asn1_get_length_der (der + counter, ider_len, &len3); ++ if (len2 < 0) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len3+len2); ++ ++ _asn1_set_value (p, der + counter, len3 + len2); ++ counter += len3 + len2; ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_SEQUENCE: ++ case ASN1_ETYPE_SET: ++ if (move == UP) ++ { ++ len2 = p->tmp_ival; ++ p->tmp_ival = 0; ++ if (len2 == -1) ++ { /* indefinite length method */ ++ DECR_LEN(ider_len, 2); ++ if ((der[counter]) || der[counter + 1]) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ counter += 2; ++ } ++ else ++ { /* definite length method */ ++ if (len2 != counter) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ } ++ move = RIGHT; ++ } ++ else ++ { /* move==DOWN || move==RIGHT */ ++ len3 = ++ asn1_get_length_der (der + counter, ider_len, &len2); ++ if (IS_ERR(len3, flags)) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len2); ++ counter += len2; ++ ++ if (len3 > 0) ++ { ++ p->tmp_ival = counter + len3; ++ move = DOWN; ++ } ++ else if (len3 == 0) ++ { ++ p2 = p->down; ++ while (p2) ++ { ++ if (type_field (p2->type) != ASN1_ETYPE_TAG) ++ { ++ p3 = p2->right; ++ asn1_delete_structure (&p2); ++ p2 = p3; ++ } ++ else ++ p2 = p2->right; ++ } ++ move = RIGHT; ++ } ++ else ++ { /* indefinite length method */ ++ p->tmp_ival = -1; ++ move = DOWN; ++ } ++ } ++ break; ++ case ASN1_ETYPE_SEQUENCE_OF: ++ case ASN1_ETYPE_SET_OF: ++ if (move == UP) ++ { ++ len2 = p->tmp_ival; ++ if (len2 == -1) ++ { /* indefinite length method */ ++ if (!HAVE_TWO(ider_len) || ((der[counter]) || der[counter + 1])) ++ { ++ result = _asn1_append_sequence_set (p, &tcache); ++ if (result != 0) ++ { ++ warn(); ++ goto cleanup; ++ } ++ p = tcache.tail; ++ move = RIGHT; ++ continue; ++ } ++ ++ p->tmp_ival = 0; ++ tcache.tail = NULL; /* finished decoding this structure */ ++ tcache.head = NULL; ++ DECR_LEN(ider_len, 2); ++ counter += 2; ++ } ++ else ++ { /* definite length method */ ++ if (len2 > counter) ++ { ++ result = _asn1_append_sequence_set (p, &tcache); ++ if (result != 0) ++ { ++ warn(); ++ goto cleanup; ++ } ++ p = tcache.tail; ++ move = RIGHT; ++ continue; ++ } ++ ++ p->tmp_ival = 0; ++ tcache.tail = NULL; /* finished decoding this structure */ ++ tcache.head = NULL; ++ ++ if (len2 != counter) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ } ++ } ++ else ++ { /* move==DOWN || move==RIGHT */ ++ len3 = ++ asn1_get_length_der (der + counter, ider_len, &len2); ++ if (IS_ERR(len3, flags)) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len2); ++ counter += len2; ++ if (len3) ++ { ++ if (len3 > 0) ++ { /* definite length method */ ++ p->tmp_ival = counter + len3; ++ } ++ else ++ { /* indefinite length method */ ++ p->tmp_ival = -1; ++ } ++ ++ p2 = p->down; ++ if (p2 == NULL) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ while ((type_field (p2->type) == ASN1_ETYPE_TAG) ++ || (type_field (p2->type) == ASN1_ETYPE_SIZE)) ++ p2 = p2->right; ++ if (p2->right == NULL) ++ { ++ result = _asn1_append_sequence_set (p, &tcache); ++ if (result != 0) ++ { ++ warn(); ++ goto cleanup; ++ } ++ } ++ p = p2; ++ } ++ } ++ move = RIGHT; ++ break; ++ case ASN1_ETYPE_ANY: ++ /* Check indefinite lenth method in an EXPLICIT TAG */ ++ ++ if (!(flags & ASN1_DECODE_FLAG_STRICT_DER) && (p->type & CONST_TAG) && ++ tag_len == 2 && (der[counter - 1] == 0x80)) ++ indefinite = 1; ++ else ++ indefinite = 0; ++ ++ if (asn1_get_tag_der ++ (der + counter, ider_len, &class, &len2, ++ &tag) != ASN1_SUCCESS) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len2); ++ ++ len4 = ++ asn1_get_length_der (der + counter + len2, ++ ider_len, &len3); ++ if (IS_ERR(len4, flags)) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ if (len4 != -1) /* definite */ ++ { ++ len2 += len4; ++ ++ DECR_LEN(ider_len, len4+len3); ++ _asn1_set_value_lv (p, der + counter, len2 + len3); ++ counter += len2 + len3; ++ } ++ else /* == -1 */ ++ { /* indefinite length */ ++ ider_len += len2; /* undo DECR_LEN */ ++ ++ if (counter == 0) ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ ++ result = ++ _asn1_get_indefinite_length_string (der + counter, ider_len, &len2); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ DECR_LEN(ider_len, len2); ++ _asn1_set_value_lv (p, der + counter, len2); ++ counter += len2; ++ ++ } ++ ++ /* Check if a couple of 0x00 are present due to an EXPLICIT TAG with ++ an indefinite length method. */ ++ if (indefinite) ++ { ++ DECR_LEN(ider_len, 2); ++ if (!der[counter] && !der[counter + 1]) ++ { ++ counter += 2; ++ } ++ else ++ { ++ result = ASN1_DER_ERROR; ++ warn(); ++ goto cleanup; ++ } ++ } ++ ++ move = RIGHT; ++ break; ++ default: ++ move = (move == UP) ? RIGHT : DOWN; ++ break; ++ } ++ } ++ ++ if (p) ++ { ++ p->end = counter - 1; ++ } ++ ++ if (p == node && move != DOWN) ++ break; ++ ++ if (move == DOWN) ++ { ++ if (p->down) ++ p = p->down; ++ else ++ move = RIGHT; ++ } ++ if ((move == RIGHT) && !(p->type & CONST_SET)) ++ { ++ if (p->right) ++ p = p->right; ++ else ++ move = UP; ++ } ++ if (move == UP) ++ p = _asn1_find_up (p); ++ } ++ ++ _asn1_delete_not_used (*element); ++ ++ if ((ider_len < 0) || ++ (!(flags & ASN1_DECODE_FLAG_ALLOW_PADDING) && (ider_len != 0))) ++ { ++ warn(); ++ result = ASN1_DER_ERROR; ++ goto cleanup; ++ } ++ ++ *max_ider_len = total_len - ider_len; ++ ++ return ASN1_SUCCESS; ++ ++cleanup: ++ asn1_delete_structure (element); ++ return result; ++} ++ ++ ++/** ++ * asn1_der_decoding: ++ * @element: pointer to an ASN1 structure. ++ * @ider: vector that contains the DER encoding. ++ * @ider_len: number of bytes of *@ider: @ider[0]..@ider[len-1]. ++ * @errorDescription: null-terminated string contains details when an ++ * error occurred. ++ * ++ * Fill the structure *@element with values of a DER encoding ++ * string. The structure must just be created with function ++ * asn1_create_element(). ++ * ++ * Note that the *@element variable is provided as a pointer for ++ * historical reasons. ++ * ++ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND ++ * if @ELEMENT is %NULL, and %ASN1_TAG_ERROR or ++ * %ASN1_DER_ERROR if the der encoding doesn't match the structure ++ * name (*@ELEMENT deleted). ++ **/ ++int ++asn1_der_decoding (asn1_node * element, const void *ider, int ider_len, ++ char *errorDescription) ++{ ++ return asn1_der_decoding2 (element, ider, &ider_len, 0, errorDescription); ++} ++ ++/** ++ * asn1_der_decoding_element: ++ * @structure: pointer to an ASN1 structure ++ * @elementName: name of the element to fill ++ * @ider: vector that contains the DER encoding of the whole structure. ++ * @len: number of bytes of *der: der[0]..der[len-1] ++ * @errorDescription: null-terminated string contains details when an ++ * error occurred. ++ * ++ * Fill the element named @ELEMENTNAME with values of a DER encoding ++ * string. The structure must just be created with function ++ * asn1_create_element(). The DER vector must contain the encoding ++ * string of the whole @STRUCTURE. If an error occurs during the ++ * decoding procedure, the *@STRUCTURE is deleted and set equal to ++ * %NULL. ++ * ++ * This function is deprecated and may just be an alias to asn1_der_decoding ++ * in future versions. Use asn1_der_decoding() instead. ++ * ++ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND ++ * if ELEMENT is %NULL or @elementName == NULL, and ++ * %ASN1_TAG_ERROR or %ASN1_DER_ERROR if the der encoding doesn't ++ * match the structure @structure (*ELEMENT deleted). ++ **/ ++int ++asn1_der_decoding_element (asn1_node * structure, const char *elementName, ++ const void *ider, int len, char *errorDescription) ++{ ++ return asn1_der_decoding(structure, ider, len, errorDescription); ++} ++ ++/** ++ * asn1_der_decoding_startEnd: ++ * @element: pointer to an ASN1 element ++ * @ider: vector that contains the DER encoding. ++ * @ider_len: number of bytes of *@ider: @ider[0]..@ider[len-1] ++ * @name_element: an element of NAME structure. ++ * @start: the position of the first byte of NAME_ELEMENT decoding ++ * (@ider[*start]) ++ * @end: the position of the last byte of NAME_ELEMENT decoding ++ * (@ider[*end]) ++ * ++ * Find the start and end point of an element in a DER encoding ++ * string. I mean that if you have a der encoding and you have already ++ * used the function asn1_der_decoding() to fill a structure, it may ++ * happen that you want to find the piece of string concerning an ++ * element of the structure. ++ * ++ * One example is the sequence "tbsCertificate" inside an X509 ++ * certificate. ++ * ++ * Note that since libtasn1 3.7 the @ider and @ider_len parameters ++ * can be omitted, if the element is already decoded using asn1_der_decoding(). ++ * ++ * Returns: %ASN1_SUCCESS if DER encoding OK, %ASN1_ELEMENT_NOT_FOUND ++ * if ELEMENT is %asn1_node EMPTY or @name_element is not a valid ++ * element, %ASN1_TAG_ERROR or %ASN1_DER_ERROR if the der encoding ++ * doesn't match the structure ELEMENT. ++ **/ ++int ++asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len, ++ const char *name_element, int *start, int *end) ++{ ++ asn1_node node, node_to_find; ++ int result = ASN1_DER_ERROR; ++ ++ node = element; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ node_to_find = asn1_find_node (node, name_element); ++ ++ if (node_to_find == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ *start = node_to_find->start; ++ *end = node_to_find->end; ++ ++ if (*start == 0 && *end == 0) ++ { ++ if (ider == NULL || ider_len == 0) ++ return ASN1_GENERIC_ERROR; ++ ++ /* it seems asn1_der_decoding() wasn't called before. Do it now */ ++ result = asn1_der_decoding (&node, ider, ider_len, NULL); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ return result; ++ } ++ ++ node_to_find = asn1_find_node (node, name_element); ++ if (node_to_find == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ *start = node_to_find->start; ++ *end = node_to_find->end; ++ } ++ ++ if (*end < *start) ++ return ASN1_GENERIC_ERROR; ++ ++ return ASN1_SUCCESS; ++} ++ ++/** ++ * asn1_expand_any_defined_by: ++ * @definitions: ASN1 definitions ++ * @element: pointer to an ASN1 structure ++ * ++ * Expands every "ANY DEFINED BY" element of a structure created from ++ * a DER decoding process (asn1_der_decoding function). The element ++ * ANY must be defined by an OBJECT IDENTIFIER. The type used to ++ * expand the element ANY is the first one following the definition of ++ * the actual value of the OBJECT IDENTIFIER. ++ * ++ * Returns: %ASN1_SUCCESS if Substitution OK, %ASN1_ERROR_TYPE_ANY if ++ * some "ANY DEFINED BY" element couldn't be expanded due to a ++ * problem in OBJECT_ID -> TYPE association, or other error codes ++ * depending on DER decoding. ++ **/ ++int ++asn1_expand_any_defined_by (asn1_node_const definitions, asn1_node * element) ++{ ++ char name[2 * ASN1_MAX_NAME_SIZE + 2], ++ value[ASN1_MAX_NAME_SIZE]; ++ int retCode = ASN1_SUCCESS, result; ++ int len, len2, len3; ++ asn1_node_const p2; ++ asn1_node p, p3, aux = NULL; ++ char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; ++ const char *definitionsName; ++ ++ if ((definitions == NULL) || (*element == NULL)) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ definitionsName = definitions->name; ++ ++ p = *element; ++ while (p) ++ { ++ ++ switch (type_field (p->type)) ++ { ++ case ASN1_ETYPE_ANY: ++ if ((p->type & CONST_DEFINED_BY) && (p->value)) ++ { ++ /* search the "DEF_BY" element */ ++ p2 = p->down; ++ while ((p2) && (type_field (p2->type) != ASN1_ETYPE_CONSTANT)) ++ p2 = p2->right; ++ ++ if (!p2) ++ { ++ retCode = ASN1_ERROR_TYPE_ANY; ++ break; ++ } ++ ++ p3 = _asn1_find_up (p); ++ ++ if (!p3) ++ { ++ retCode = ASN1_ERROR_TYPE_ANY; ++ break; ++ } ++ ++ p3 = p3->down; ++ while (p3) ++ { ++ if (!(strcmp (p3->name, p2->name))) ++ break; ++ p3 = p3->right; ++ } ++ ++ if ((!p3) || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID) || ++ (p3->value == NULL)) ++ { ++ ++ p3 = _asn1_find_up (p); ++ p3 = _asn1_find_up (p3); ++ ++ if (!p3) ++ { ++ retCode = ASN1_ERROR_TYPE_ANY; ++ break; ++ } ++ ++ p3 = p3->down; ++ ++ while (p3) ++ { ++ if (!(strcmp (p3->name, p2->name))) ++ break; ++ p3 = p3->right; ++ } ++ ++ if ((!p3) || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID) ++ || (p3->value == NULL)) ++ { ++ retCode = ASN1_ERROR_TYPE_ANY; ++ break; ++ } ++ } ++ ++ /* search the OBJECT_ID into definitions */ ++ p2 = definitions->down; ++ while (p2) ++ { ++ if ((type_field (p2->type) == ASN1_ETYPE_OBJECT_ID) && ++ (p2->type & CONST_ASSIGN)) ++ { ++ snprintf(name, sizeof(name), "%s.%s", definitionsName, p2->name); ++ ++ len = ASN1_MAX_NAME_SIZE; ++ result = ++ asn1_read_value (definitions, name, value, &len); ++ ++ if ((result == ASN1_SUCCESS) ++ && (!_asn1_strcmp (p3->value, value))) ++ { ++ p2 = p2->right; /* pointer to the structure to ++ use for expansion */ ++ while ((p2) && (p2->type & CONST_ASSIGN)) ++ p2 = p2->right; ++ ++ if (p2) ++ { ++ snprintf(name, sizeof(name), "%s.%s", definitionsName, p2->name); ++ ++ result = ++ asn1_create_element (definitions, name, &aux); ++ if (result == ASN1_SUCCESS) ++ { ++ _asn1_cpy_name (aux, p); ++ len2 = ++ asn1_get_length_der (p->value, ++ p->value_len, &len3); ++ if (len2 < 0) ++ return ASN1_DER_ERROR; ++ ++ result = ++ asn1_der_decoding (&aux, p->value + len3, ++ len2, ++ errorDescription); ++ if (result == ASN1_SUCCESS) ++ { ++ ++ _asn1_set_right (aux, p->right); ++ _asn1_set_right (p, aux); ++ ++ result = asn1_delete_structure (&p); ++ if (result == ASN1_SUCCESS) ++ { ++ p = aux; ++ aux = NULL; ++ break; ++ } ++ else ++ { /* error with asn1_delete_structure */ ++ asn1_delete_structure (&aux); ++ retCode = result; ++ break; ++ } ++ } ++ else ++ { /* error with asn1_der_decoding */ ++ retCode = result; ++ break; ++ } ++ } ++ else ++ { /* error with asn1_create_element */ ++ retCode = result; ++ break; ++ } ++ } ++ else ++ { /* error with the pointer to the structure to exapand */ ++ retCode = ASN1_ERROR_TYPE_ANY; ++ break; ++ } ++ } ++ } ++ p2 = p2->right; ++ } /* end while */ ++ ++ if (!p2) ++ { ++ retCode = ASN1_ERROR_TYPE_ANY; ++ break; ++ } ++ ++ } ++ break; ++ default: ++ break; ++ } ++ ++ ++ if (p->down) ++ { ++ p = p->down; ++ } ++ else if (p == *element) ++ { ++ p = NULL; ++ break; ++ } ++ else if (p->right) ++ p = p->right; ++ else ++ { ++ while (1) ++ { ++ p = _asn1_find_up (p); ++ if (p == *element) ++ { ++ p = NULL; ++ break; ++ } ++ if (p->right) ++ { ++ p = p->right; ++ break; ++ } ++ } ++ } ++ } ++ ++ return retCode; ++} ++ ++/** ++ * asn1_expand_octet_string: ++ * @definitions: ASN1 definitions ++ * @element: pointer to an ASN1 structure ++ * @octetName: name of the OCTECT STRING field to expand. ++ * @objectName: name of the OBJECT IDENTIFIER field to use to define ++ * the type for expansion. ++ * ++ * Expands an "OCTET STRING" element of a structure created from a DER ++ * decoding process (the asn1_der_decoding() function). The type used ++ * for expansion is the first one following the definition of the ++ * actual value of the OBJECT IDENTIFIER indicated by OBJECTNAME. ++ * ++ * Returns: %ASN1_SUCCESS if substitution OK, %ASN1_ELEMENT_NOT_FOUND ++ * if @objectName or @octetName are not correct, ++ * %ASN1_VALUE_NOT_VALID if it wasn't possible to find the type to ++ * use for expansion, or other errors depending on DER decoding. ++ **/ ++int ++asn1_expand_octet_string (asn1_node_const definitions, asn1_node * element, ++ const char *octetName, const char *objectName) ++{ ++ char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE]; ++ int retCode = ASN1_SUCCESS, result; ++ int len, len2, len3; ++ asn1_node_const p2; ++ asn1_node aux = NULL; ++ asn1_node octetNode = NULL, objectNode = NULL; ++ char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; ++ ++ if ((definitions == NULL) || (*element == NULL)) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ octetNode = asn1_find_node (*element, octetName); ++ if (octetNode == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ if (type_field (octetNode->type) != ASN1_ETYPE_OCTET_STRING) ++ return ASN1_ELEMENT_NOT_FOUND; ++ if (octetNode->value == NULL) ++ return ASN1_VALUE_NOT_FOUND; ++ ++ objectNode = asn1_find_node (*element, objectName); ++ if (objectNode == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ if (type_field (objectNode->type) != ASN1_ETYPE_OBJECT_ID) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ if (objectNode->value == NULL) ++ return ASN1_VALUE_NOT_FOUND; ++ ++ ++ /* search the OBJECT_ID into definitions */ ++ p2 = definitions->down; ++ while (p2) ++ { ++ if ((type_field (p2->type) == ASN1_ETYPE_OBJECT_ID) && ++ (p2->type & CONST_ASSIGN)) ++ { ++ strcpy (name, definitions->name); ++ strcat (name, "."); ++ strcat (name, p2->name); ++ ++ len = sizeof (value); ++ result = asn1_read_value (definitions, name, value, &len); ++ ++ if ((result == ASN1_SUCCESS) ++ && (!_asn1_strcmp (objectNode->value, value))) ++ { ++ ++ p2 = p2->right; /* pointer to the structure to ++ use for expansion */ ++ while ((p2) && (p2->type & CONST_ASSIGN)) ++ p2 = p2->right; ++ ++ if (p2) ++ { ++ strcpy (name, definitions->name); ++ strcat (name, "."); ++ strcat (name, p2->name); ++ ++ result = asn1_create_element (definitions, name, &aux); ++ if (result == ASN1_SUCCESS) ++ { ++ _asn1_cpy_name (aux, octetNode); ++ len2 = ++ asn1_get_length_der (octetNode->value, ++ octetNode->value_len, &len3); ++ if (len2 < 0) ++ return ASN1_DER_ERROR; ++ ++ result = ++ asn1_der_decoding (&aux, octetNode->value + len3, ++ len2, errorDescription); ++ if (result == ASN1_SUCCESS) ++ { ++ ++ _asn1_set_right (aux, octetNode->right); ++ _asn1_set_right (octetNode, aux); ++ ++ result = asn1_delete_structure (&octetNode); ++ if (result == ASN1_SUCCESS) ++ { ++ aux = NULL; ++ break; ++ } ++ else ++ { /* error with asn1_delete_structure */ ++ asn1_delete_structure (&aux); ++ retCode = result; ++ break; ++ } ++ } ++ else ++ { /* error with asn1_der_decoding */ ++ retCode = result; ++ break; ++ } ++ } ++ else ++ { /* error with asn1_create_element */ ++ retCode = result; ++ break; ++ } ++ } ++ else ++ { /* error with the pointer to the structure to exapand */ ++ retCode = ASN1_VALUE_NOT_VALID; ++ break; ++ } ++ } ++ } ++ ++ p2 = p2->right; ++ ++ } ++ ++ if (!p2) ++ retCode = ASN1_VALUE_NOT_VALID; ++ ++ return retCode; ++} ++ ++/*- ++ * _asn1_decode_simple_der: ++ * @etype: The type of the string to be encoded (ASN1_ETYPE_) ++ * @der: the encoded string ++ * @_der_len: the bytes of the encoded string ++ * @str: a pointer to the data ++ * @str_len: the length of the data ++ * @dflags: DECODE_FLAG_* ++ * ++ * Decodes a simple DER encoded type (e.g. a string, which is not constructed). ++ * The output is a pointer inside the @der. ++ * ++ * Returns: %ASN1_SUCCESS if successful or an error value. ++ -*/ ++static int ++_asn1_decode_simple_der (unsigned int etype, const unsigned char *der, ++ unsigned int _der_len, const unsigned char **str, ++ unsigned int *str_len, unsigned dflags) ++{ ++ int tag_len, len_len; ++ const unsigned char *p; ++ int der_len = _der_len; ++ unsigned char class; ++ unsigned long tag; ++ long ret; ++ ++ if (der == NULL || der_len == 0) ++ return ASN1_VALUE_NOT_VALID; ++ ++ if (ETYPE_OK (etype) == 0 || ETYPE_IS_STRING(etype) == 0) ++ return ASN1_VALUE_NOT_VALID; ++ ++ /* doesn't handle constructed classes */ ++ class = ETYPE_CLASS(etype); ++ if (class != ASN1_CLASS_UNIVERSAL) ++ return ASN1_VALUE_NOT_VALID; ++ ++ p = der; ++ ++ if (dflags & DECODE_FLAG_HAVE_TAG) ++ { ++ ret = asn1_get_tag_der (p, der_len, &class, &tag_len, &tag); ++ if (ret != ASN1_SUCCESS) ++ return ret; ++ ++ if (class != ETYPE_CLASS (etype) || tag != ETYPE_TAG (etype)) ++ { ++ warn(); ++ return ASN1_DER_ERROR; ++ } ++ ++ p += tag_len; ++ der_len -= tag_len; ++ if (der_len <= 0) ++ return ASN1_DER_ERROR; ++ } ++ ++ ret = asn1_get_length_der (p, der_len, &len_len); ++ if (ret < 0) ++ return ASN1_DER_ERROR; ++ ++ p += len_len; ++ der_len -= len_len; ++ if (der_len <= 0) ++ return ASN1_DER_ERROR; ++ ++ *str_len = ret; ++ *str = p; ++ ++ return ASN1_SUCCESS; ++} ++ ++/** ++ * asn1_decode_simple_der: ++ * @etype: The type of the string to be encoded (ASN1_ETYPE_) ++ * @der: the encoded string ++ * @_der_len: the bytes of the encoded string ++ * @str: a pointer to the data ++ * @str_len: the length of the data ++ * ++ * Decodes a simple DER encoded type (e.g. a string, which is not constructed). ++ * The output is a pointer inside the @der. ++ * ++ * Returns: %ASN1_SUCCESS if successful or an error value. ++ **/ ++int ++asn1_decode_simple_der (unsigned int etype, const unsigned char *der, ++ unsigned int _der_len, const unsigned char **str, ++ unsigned int *str_len) ++{ ++ return _asn1_decode_simple_der(etype, der, _der_len, str, str_len, DECODE_FLAG_HAVE_TAG); ++} ++ ++static int append(uint8_t **dst, unsigned *dst_size, const unsigned char *src, unsigned src_size) ++{ ++ if (src_size == 0) ++ return ASN1_SUCCESS; ++ ++ *dst = _asn1_realloc(*dst, *dst_size+src_size); ++ if (*dst == NULL) ++ return ASN1_MEM_ALLOC_ERROR; ++ memcpy(*dst + *dst_size, src, src_size); ++ *dst_size += src_size; ++ return ASN1_SUCCESS; ++} ++ ++/*- ++ * _asn1_decode_simple_ber: ++ * @etype: The type of the string to be encoded (ASN1_ETYPE_) ++ * @der: the encoded string ++ * @_der_len: the bytes of the encoded string ++ * @str: a pointer to the data ++ * @str_len: the length of the data ++ * @ber_len: the total length occupied by BER (may be %NULL) ++ * @have_tag: whether a DER tag is included ++ * ++ * Decodes a BER encoded type. The output is an allocated value ++ * of the data. This decodes BER STRINGS only. Other types are ++ * decoded as DER. ++ * ++ * Returns: %ASN1_SUCCESS if successful or an error value. ++ -*/ ++static int ++_asn1_decode_simple_ber (unsigned int etype, const unsigned char *der, ++ unsigned int _der_len, unsigned char **str, ++ unsigned int *str_len, unsigned int *ber_len, ++ unsigned dflags) ++{ ++ int tag_len, len_len; ++ const unsigned char *p; ++ int der_len = _der_len; ++ uint8_t *total = NULL; ++ unsigned total_size = 0; ++ unsigned char class; ++ unsigned long tag; ++ unsigned char *out = NULL; ++ const unsigned char *cout = NULL; ++ unsigned out_len; ++ long result; ++ ++ if (ber_len) *ber_len = 0; ++ ++ if (der == NULL || der_len == 0) ++ { ++ warn(); ++ return ASN1_VALUE_NOT_VALID; ++ } ++ ++ if (ETYPE_OK (etype) == 0) ++ { ++ warn(); ++ return ASN1_VALUE_NOT_VALID; ++ } ++ ++ /* doesn't handle constructed + definite classes */ ++ class = ETYPE_CLASS (etype); ++ if (class != ASN1_CLASS_UNIVERSAL) ++ { ++ warn(); ++ return ASN1_VALUE_NOT_VALID; ++ } ++ ++ p = der; ++ ++ if (dflags & DECODE_FLAG_HAVE_TAG) ++ { ++ result = asn1_get_tag_der (p, der_len, &class, &tag_len, &tag); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ return result; ++ } ++ ++ if (tag != ETYPE_TAG (etype)) ++ { ++ warn(); ++ return ASN1_DER_ERROR; ++ } ++ ++ p += tag_len; ++ ++ DECR_LEN(der_len, tag_len); ++ ++ if (ber_len) *ber_len += tag_len; ++ } ++ ++ /* indefinite constructed */ ++ if ((((dflags & DECODE_FLAG_CONSTRUCTED) || class == ASN1_CLASS_STRUCTURED) && ETYPE_IS_STRING(etype)) && ++ !(dflags & DECODE_FLAG_LEVEL3)) ++ { ++ if (der_len == 0) ++ { ++ warn(); ++ result = ASN1_DER_ERROR; ++ goto cleanup; ++ } ++ ++ if (der_len > 0 && p[0] == 0x80) /* indefinite */ ++ { ++ len_len = 1; ++ DECR_LEN(der_len, len_len); ++ p += len_len; ++ ++ if (ber_len) *ber_len += len_len; ++ ++ /* decode the available octet strings */ ++ do ++ { ++ unsigned tmp_len; ++ unsigned flags = DECODE_FLAG_HAVE_TAG; ++ ++ if (dflags & DECODE_FLAG_LEVEL1) ++ flags |= DECODE_FLAG_LEVEL2; ++ else if (dflags & DECODE_FLAG_LEVEL2) ++ flags |= DECODE_FLAG_LEVEL3; ++ else ++ flags |= DECODE_FLAG_LEVEL1; ++ ++ result = _asn1_decode_simple_ber(etype, p, der_len, &out, &out_len, &tmp_len, ++ flags); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ p += tmp_len; ++ DECR_LEN(der_len, tmp_len); ++ ++ if (ber_len) *ber_len += tmp_len; ++ ++ DECR_LEN(der_len, 2); /* we need the EOC */ ++ ++ result = append(&total, &total_size, out, out_len); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ free(out); ++ out = NULL; ++ ++ if (p[0] == 0 && p[1] == 0) /* EOC */ ++ { ++ if (ber_len) *ber_len += 2; ++ break; ++ } ++ ++ /* no EOC */ ++ der_len += 2; ++ ++ if (der_len == 2) ++ { ++ warn(); ++ result = ASN1_DER_ERROR; ++ goto cleanup; ++ } ++ } ++ while(1); ++ } ++ else /* constructed */ ++ { ++ long const_len; ++ ++ result = asn1_get_length_ber(p, der_len, &len_len); ++ if (result < 0) ++ { ++ warn(); ++ result = ASN1_DER_ERROR; ++ goto cleanup; ++ } ++ ++ DECR_LEN(der_len, len_len); ++ p += len_len; ++ ++ const_len = result; ++ ++ if (ber_len) *ber_len += len_len; ++ ++ /* decode the available octet strings */ ++ while(const_len > 0) ++ { ++ unsigned tmp_len; ++ unsigned flags = DECODE_FLAG_HAVE_TAG; ++ ++ if (dflags & DECODE_FLAG_LEVEL1) ++ flags |= DECODE_FLAG_LEVEL2; ++ else if (dflags & DECODE_FLAG_LEVEL2) ++ flags |= DECODE_FLAG_LEVEL3; ++ else ++ flags |= DECODE_FLAG_LEVEL1; ++ ++ result = _asn1_decode_simple_ber(etype, p, der_len, &out, &out_len, &tmp_len, ++ flags); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ p += tmp_len; ++ DECR_LEN(der_len, tmp_len); ++ DECR_LEN(const_len, tmp_len); ++ ++ if (ber_len) *ber_len += tmp_len; ++ ++ result = append(&total, &total_size, out, out_len); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ free(out); ++ out = NULL; ++ } ++ } ++ } ++ else if (class == ETYPE_CLASS(etype)) ++ { ++ if (ber_len) ++ { ++ result = asn1_get_length_der (p, der_len, &len_len); ++ if (result < 0) ++ { ++ warn(); ++ result = ASN1_DER_ERROR; ++ goto cleanup; ++ } ++ *ber_len += result + len_len; ++ } ++ ++ /* non-string values are decoded as DER */ ++ result = _asn1_decode_simple_der(etype, der, _der_len, &cout, &out_len, dflags); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ ++ result = append(&total, &total_size, cout, out_len); ++ if (result != ASN1_SUCCESS) ++ { ++ warn(); ++ goto cleanup; ++ } ++ } ++ else ++ { ++ warn(); ++ result = ASN1_DER_ERROR; ++ goto cleanup; ++ } ++ ++ *str = total; ++ *str_len = total_size; ++ ++ return ASN1_SUCCESS; ++cleanup: ++ free(out); ++ free(total); ++ return result; ++} ++ ++/** ++ * asn1_decode_simple_ber: ++ * @etype: The type of the string to be encoded (ASN1_ETYPE_) ++ * @der: the encoded string ++ * @_der_len: the bytes of the encoded string ++ * @str: a pointer to the data ++ * @str_len: the length of the data ++ * @ber_len: the total length occupied by BER (may be %NULL) ++ * ++ * Decodes a BER encoded type. The output is an allocated value ++ * of the data. This decodes BER STRINGS only. Other types are ++ * decoded as DER. ++ * ++ * Returns: %ASN1_SUCCESS if successful or an error value. ++ **/ ++int ++asn1_decode_simple_ber (unsigned int etype, const unsigned char *der, ++ unsigned int _der_len, unsigned char **str, ++ unsigned int *str_len, unsigned int *ber_len) ++{ ++ return _asn1_decode_simple_ber(etype, der, _der_len, str, str_len, ber_len, DECODE_FLAG_HAVE_TAG); ++} +diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c +new file mode 100644 +index 00000000000..997eb2725dc +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/element.c +@@ -0,0 +1,1111 @@ ++/* ++ * Copyright (C) 2000-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++/*****************************************************/ ++/* File: element.c */ ++/* Description: Functions with the read and write */ ++/* functions. */ ++/*****************************************************/ ++ ++ ++#include ++#include "parser_aux.h" ++#include ++#include "structure.h" ++#include "c-ctype.h" ++#include "element.h" ++ ++void ++_asn1_hierarchical_name (asn1_node_const node, char *name, int name_size) ++{ ++ asn1_node_const p; ++ char tmp_name[64]; ++ ++ p = node; ++ ++ name[0] = 0; ++ ++ while (p != NULL) ++ { ++ if (p->name[0] != 0) ++ { ++ _asn1_str_cpy (tmp_name, sizeof (tmp_name), name), ++ _asn1_str_cpy (name, name_size, p->name); ++ _asn1_str_cat (name, name_size, "."); ++ _asn1_str_cat (name, name_size, tmp_name); ++ } ++ p = _asn1_find_up (p); ++ } ++ ++ if (name[0] == 0) ++ _asn1_str_cpy (name, name_size, "ROOT"); ++} ++ ++ ++/******************************************************************/ ++/* Function : _asn1_convert_integer */ ++/* Description: converts an integer from a null terminated string */ ++/* to der decoding. The convertion from a null */ ++/* terminated string to an integer is made with */ ++/* the 'strtol' function. */ ++/* Parameters: */ ++/* value: null terminated string to convert. */ ++/* value_out: convertion result (memory must be already */ ++/* allocated). */ ++/* value_out_size: number of bytes of value_out. */ ++/* len: number of significant byte of value_out. */ ++/* Return: ASN1_MEM_ERROR or ASN1_SUCCESS */ ++/******************************************************************/ ++int ++_asn1_convert_integer (const unsigned char *value, unsigned char *value_out, ++ int value_out_size, int *len) ++{ ++ char negative; ++ unsigned char val[SIZEOF_UNSIGNED_LONG_INT]; ++ long valtmp; ++ int k, k2; ++ ++ valtmp = _asn1_strtol (value, NULL, 10); ++ ++ for (k = 0; k < SIZEOF_UNSIGNED_LONG_INT; k++) ++ { ++ val[SIZEOF_UNSIGNED_LONG_INT - k - 1] = (valtmp >> (8 * k)) & 0xFF; ++ } ++ ++ if (val[0] & 0x80) ++ negative = 1; ++ else ++ negative = 0; ++ ++ for (k = 0; k < SIZEOF_UNSIGNED_LONG_INT - 1; k++) ++ { ++ if (negative && (val[k] != 0xFF)) ++ break; ++ else if (!negative && val[k]) ++ break; ++ } ++ ++ if ((negative && !(val[k] & 0x80)) || (!negative && (val[k] & 0x80))) ++ k--; ++ ++ *len = SIZEOF_UNSIGNED_LONG_INT - k; ++ ++ if (SIZEOF_UNSIGNED_LONG_INT - k > value_out_size) ++ /* VALUE_OUT is too short to contain the value conversion */ ++ return ASN1_MEM_ERROR; ++ ++ if (value_out != NULL) ++ { ++ for (k2 = k; k2 < SIZEOF_UNSIGNED_LONG_INT; k2++) ++ value_out[k2 - k] = val[k2]; ++ } ++ ++#if 0 ++ printf ("_asn1_convert_integer: valueIn=%s, lenOut=%d", value, *len); ++ for (k = 0; k < SIZEOF_UNSIGNED_LONG_INT; k++) ++ printf (", vOut[%d]=%d", k, value_out[k]); ++ printf ("\n"); ++#endif ++ ++ return ASN1_SUCCESS; ++} ++ ++/* Appends a new element into the sequence (or set) defined by this ++ * node. The new element will have a name of '?number', where number ++ * is a monotonically increased serial number. ++ * ++ * The last element in the list may be provided in @pcache, to avoid ++ * traversing the list, an expensive operation in long lists. ++ * ++ * On success it returns in @pcache the added element (which is the ++ * tail in the list of added elements). ++ */ ++int ++_asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcache) ++{ ++ asn1_node p, p2; ++ char temp[LTOSTR_MAX_SIZE]; ++ long n; ++ ++ if (!node || !(node->down)) ++ return ASN1_GENERIC_ERROR; ++ ++ p = node->down; ++ while ((type_field (p->type) == ASN1_ETYPE_TAG) ++ || (type_field (p->type) == ASN1_ETYPE_SIZE)) ++ p = p->right; ++ ++ p2 = _asn1_copy_structure3 (p); ++ if (p2 == NULL) ++ return ASN1_GENERIC_ERROR; ++ ++ if (pcache == NULL || pcache->tail == NULL || pcache->head != node) ++ { ++ while (p->right) ++ { ++ p = p->right; ++ } ++ } ++ else ++ { ++ p = pcache->tail; ++ } ++ ++ _asn1_set_right (p, p2); ++ if (pcache) ++ { ++ pcache->head = node; ++ pcache->tail = p2; ++ } ++ ++ if (p->name[0] == 0) ++ _asn1_str_cpy (temp, sizeof (temp), "?1"); ++ else ++ { ++ n = strtol (p->name + 1, NULL, 0); ++ n++; ++ temp[0] = '?'; ++ _asn1_ltostr (n, temp + 1); ++ } ++ _asn1_set_name (p2, temp); ++ /* p2->type |= CONST_OPTION; */ ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/** ++ * asn1_write_value: ++ * @node_root: pointer to a structure ++ * @name: the name of the element inside the structure that you want to set. ++ * @ivalue: vector used to specify the value to set. If len is >0, ++ * VALUE must be a two's complement form integer. if len=0 *VALUE ++ * must be a null terminated string with an integer value. ++ * @len: number of bytes of *value to use to set the value: ++ * value[0]..value[len-1] or 0 if value is a null terminated string ++ * ++ * Set the value of one element inside a structure. ++ * ++ * If an element is OPTIONAL and you want to delete it, you must use ++ * the value=NULL and len=0. Using "pkix.asn": ++ * ++ * result=asn1_write_value(cert, "tbsCertificate.issuerUniqueID", ++ * NULL, 0); ++ * ++ * Description for each type: ++ * ++ * INTEGER: VALUE must contain a two's complement form integer. ++ * ++ * value[0]=0xFF , len=1 -> integer=-1. ++ * value[0]=0xFF value[1]=0xFF , len=2 -> integer=-1. ++ * value[0]=0x01 , len=1 -> integer= 1. ++ * value[0]=0x00 value[1]=0x01 , len=2 -> integer= 1. ++ * value="123" , len=0 -> integer= 123. ++ * ++ * ENUMERATED: As INTEGER (but only with not negative numbers). ++ * ++ * BOOLEAN: VALUE must be the null terminated string "TRUE" or ++ * "FALSE" and LEN != 0. ++ * ++ * value="TRUE" , len=1 -> boolean=TRUE. ++ * value="FALSE" , len=1 -> boolean=FALSE. ++ * ++ * OBJECT IDENTIFIER: VALUE must be a null terminated string with ++ * each number separated by a dot (e.g. "1.2.3.543.1"). LEN != 0. ++ * ++ * value="1 2 840 10040 4 3" , len=1 -> OID=dsa-with-sha. ++ * ++ * UTCTime: VALUE must be a null terminated string in one of these ++ * formats: "YYMMDDhhmmssZ", "YYMMDDhhmmssZ", ++ * "YYMMDDhhmmss+hh'mm'", "YYMMDDhhmmss-hh'mm'", ++ * "YYMMDDhhmm+hh'mm'", or "YYMMDDhhmm-hh'mm'". LEN != 0. ++ * ++ * value="9801011200Z" , len=1 -> time=Jannuary 1st, 1998 ++ * at 12h 00m Greenwich Mean Time ++ * ++ * GeneralizedTime: VALUE must be in one of this format: ++ * "YYYYMMDDhhmmss.sZ", "YYYYMMDDhhmmss.sZ", ++ * "YYYYMMDDhhmmss.s+hh'mm'", "YYYYMMDDhhmmss.s-hh'mm'", ++ * "YYYYMMDDhhmm+hh'mm'", or "YYYYMMDDhhmm-hh'mm'" where ss.s ++ * indicates the seconds with any precision like "10.1" or "01.02". ++ * LEN != 0 ++ * ++ * value="2001010112001.12-0700" , len=1 -> time=Jannuary ++ * 1st, 2001 at 12h 00m 01.12s Pacific Daylight Time ++ * ++ * OCTET STRING: VALUE contains the octet string and LEN is the ++ * number of octets. ++ * ++ * value="$\backslash$x01$\backslash$x02$\backslash$x03" , ++ * len=3 -> three bytes octet string ++ * ++ * GeneralString: VALUE contains the generalstring and LEN is the ++ * number of octets. ++ * ++ * value="$\backslash$x01$\backslash$x02$\backslash$x03" , ++ * len=3 -> three bytes generalstring ++ * ++ * BIT STRING: VALUE contains the bit string organized by bytes and ++ * LEN is the number of bits. ++ * ++ * value="$\backslash$xCF" , len=6 -> bit string="110011" (six ++ * bits) ++ * ++ * CHOICE: if NAME indicates a choice type, VALUE must specify one of ++ * the alternatives with a null terminated string. LEN != 0. Using ++ * "pkix.asn"\: ++ * ++ * result=asn1_write_value(cert, ++ * "certificate1.tbsCertificate.subject", "rdnSequence", ++ * 1); ++ * ++ * ANY: VALUE indicates the der encoding of a structure. LEN != 0. ++ * ++ * SEQUENCE OF: VALUE must be the null terminated string "NEW" and ++ * LEN != 0. With this instruction another element is appended in ++ * the sequence. The name of this element will be "?1" if it's the ++ * first one, "?2" for the second and so on. ++ * ++ * Using "pkix.asn"\: ++ * ++ * result=asn1_write_value(cert, ++ * "certificate1.tbsCertificate.subject.rdnSequence", "NEW", 1); ++ * ++ * SET OF: the same as SEQUENCE OF. Using "pkix.asn": ++ * ++ * result=asn1_write_value(cert, ++ * "tbsCertificate.subject.rdnSequence.?LAST", "NEW", 1); ++ * ++ * Returns: %ASN1_SUCCESS if the value was set, ++ * %ASN1_ELEMENT_NOT_FOUND if @name is not a valid element, and ++ * %ASN1_VALUE_NOT_VALID if @ivalue has a wrong format. ++ **/ ++int ++asn1_write_value (asn1_node node_root, const char *name, ++ const void *ivalue, int len) ++{ ++ asn1_node node, p, p2; ++ unsigned char *temp, *value_temp = NULL, *default_temp = NULL; ++ int len2, k, k2, negative; ++ size_t i; ++ const unsigned char *value = ivalue; ++ unsigned int type; ++ ++ node = asn1_find_node (node_root, name); ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ if ((node->type & CONST_OPTION) && (value == NULL) && (len == 0)) ++ { ++ asn1_delete_structure (&node); ++ return ASN1_SUCCESS; ++ } ++ ++ type = type_field (node->type); ++ ++ if ((type == ASN1_ETYPE_SEQUENCE_OF || type == ASN1_ETYPE_SET_OF) && (value == NULL) && (len == 0)) ++ { ++ p = node->down; ++ while ((type_field (p->type) == ASN1_ETYPE_TAG) ++ || (type_field (p->type) == ASN1_ETYPE_SIZE)) ++ p = p->right; ++ ++ while (p->right) ++ asn1_delete_structure (&p->right); ++ ++ return ASN1_SUCCESS; ++ } ++ ++ /* Don't allow element deletion for other types */ ++ if (value == NULL) ++ { ++ return ASN1_VALUE_NOT_VALID; ++ } ++ ++ switch (type) ++ { ++ case ASN1_ETYPE_BOOLEAN: ++ if (!_asn1_strcmp (value, "TRUE")) ++ { ++ if (node->type & CONST_DEFAULT) ++ { ++ p = node->down; ++ while (type_field (p->type) != ASN1_ETYPE_DEFAULT) ++ p = p->right; ++ if (p->type & CONST_TRUE) ++ _asn1_set_value (node, NULL, 0); ++ else ++ _asn1_set_value (node, "T", 1); ++ } ++ else ++ _asn1_set_value (node, "T", 1); ++ } ++ else if (!_asn1_strcmp (value, "FALSE")) ++ { ++ if (node->type & CONST_DEFAULT) ++ { ++ p = node->down; ++ while (type_field (p->type) != ASN1_ETYPE_DEFAULT) ++ p = p->right; ++ if (p->type & CONST_FALSE) ++ _asn1_set_value (node, NULL, 0); ++ else ++ _asn1_set_value (node, "F", 1); ++ } ++ else ++ _asn1_set_value (node, "F", 1); ++ } ++ else ++ return ASN1_VALUE_NOT_VALID; ++ break; ++ case ASN1_ETYPE_INTEGER: ++ case ASN1_ETYPE_ENUMERATED: ++ if (len == 0) ++ { ++ if ((c_isdigit (value[0])) || (value[0] == '-')) ++ { ++ value_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); ++ if (value_temp == NULL) ++ return ASN1_MEM_ALLOC_ERROR; ++ ++ _asn1_convert_integer (value, value_temp, ++ SIZEOF_UNSIGNED_LONG_INT, &len); ++ } ++ else ++ { /* is an identifier like v1 */ ++ if (!(node->type & CONST_LIST)) ++ return ASN1_VALUE_NOT_VALID; ++ p = node->down; ++ while (p) ++ { ++ if (type_field (p->type) == ASN1_ETYPE_CONSTANT) ++ { ++ if (!_asn1_strcmp (p->name, value)) ++ { ++ value_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); ++ if (value_temp == NULL) ++ return ASN1_MEM_ALLOC_ERROR; ++ ++ _asn1_convert_integer (p->value, ++ value_temp, ++ SIZEOF_UNSIGNED_LONG_INT, ++ &len); ++ break; ++ } ++ } ++ p = p->right; ++ } ++ if (p == NULL) ++ return ASN1_VALUE_NOT_VALID; ++ } ++ } ++ else ++ { /* len != 0 */ ++ value_temp = malloc (len); ++ if (value_temp == NULL) ++ return ASN1_MEM_ALLOC_ERROR; ++ memcpy (value_temp, value, len); ++ } ++ ++ if (value_temp[0] & 0x80) ++ negative = 1; ++ else ++ negative = 0; ++ ++ if (negative && (type_field (node->type) == ASN1_ETYPE_ENUMERATED)) ++ { ++ free (value_temp); ++ return ASN1_VALUE_NOT_VALID; ++ } ++ ++ for (k = 0; k < len - 1; k++) ++ if (negative && (value_temp[k] != 0xFF)) ++ break; ++ else if (!negative && value_temp[k]) ++ break; ++ ++ if ((negative && !(value_temp[k] & 0x80)) || ++ (!negative && (value_temp[k] & 0x80))) ++ k--; ++ ++ _asn1_set_value_lv (node, value_temp + k, len - k); ++ ++ if (node->type & CONST_DEFAULT) ++ { ++ p = node->down; ++ while (type_field (p->type) != ASN1_ETYPE_DEFAULT) ++ p = p->right; ++ if ((c_isdigit (p->value[0])) || (p->value[0] == '-')) ++ { ++ default_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); ++ if (default_temp == NULL) ++ { ++ free (value_temp); ++ return ASN1_MEM_ALLOC_ERROR; ++ } ++ ++ _asn1_convert_integer (p->value, default_temp, ++ SIZEOF_UNSIGNED_LONG_INT, &len2); ++ } ++ else ++ { /* is an identifier like v1 */ ++ if (!(node->type & CONST_LIST)) ++ { ++ free (value_temp); ++ return ASN1_VALUE_NOT_VALID; ++ } ++ p2 = node->down; ++ while (p2) ++ { ++ if (type_field (p2->type) == ASN1_ETYPE_CONSTANT) ++ { ++ if (!_asn1_strcmp (p2->name, p->value)) ++ { ++ default_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); ++ if (default_temp == NULL) ++ { ++ free (value_temp); ++ return ASN1_MEM_ALLOC_ERROR; ++ } ++ ++ _asn1_convert_integer (p2->value, ++ default_temp, ++ SIZEOF_UNSIGNED_LONG_INT, ++ &len2); ++ break; ++ } ++ } ++ p2 = p2->right; ++ } ++ if (p2 == NULL) ++ { ++ free (value_temp); ++ return ASN1_VALUE_NOT_VALID; ++ } ++ } ++ ++ ++ if ((len - k) == len2) ++ { ++ for (k2 = 0; k2 < len2; k2++) ++ if (value_temp[k + k2] != default_temp[k2]) ++ { ++ break; ++ } ++ if (k2 == len2) ++ _asn1_set_value (node, NULL, 0); ++ } ++ free (default_temp); ++ } ++ free (value_temp); ++ break; ++ case ASN1_ETYPE_OBJECT_ID: ++ for (i = 0; i < _asn1_strlen (value); i++) ++ if ((!c_isdigit (value[i])) && (value[i] != '.') && (value[i] != '+')) ++ return ASN1_VALUE_NOT_VALID; ++ if (node->type & CONST_DEFAULT) ++ { ++ p = node->down; ++ while (type_field (p->type) != ASN1_ETYPE_DEFAULT) ++ p = p->right; ++ if (!_asn1_strcmp (value, p->value)) ++ { ++ _asn1_set_value (node, NULL, 0); ++ break; ++ } ++ } ++ _asn1_set_value (node, value, _asn1_strlen (value) + 1); ++ break; ++ case ASN1_ETYPE_UTC_TIME: ++ { ++ len = _asn1_strlen (value); ++ if (len < 11) ++ return ASN1_VALUE_NOT_VALID; ++ for (k = 0; k < 10; k++) ++ if (!c_isdigit (value[k])) ++ return ASN1_VALUE_NOT_VALID; ++ switch (len) ++ { ++ case 11: ++ if (value[10] != 'Z') ++ return ASN1_VALUE_NOT_VALID; ++ break; ++ case 13: ++ if ((!c_isdigit (value[10])) || (!c_isdigit (value[11])) || ++ (value[12] != 'Z')) ++ return ASN1_VALUE_NOT_VALID; ++ break; ++ case 15: ++ if ((value[10] != '+') && (value[10] != '-')) ++ return ASN1_VALUE_NOT_VALID; ++ for (k = 11; k < 15; k++) ++ if (!c_isdigit (value[k])) ++ return ASN1_VALUE_NOT_VALID; ++ break; ++ case 17: ++ if ((!c_isdigit (value[10])) || (!c_isdigit (value[11]))) ++ return ASN1_VALUE_NOT_VALID; ++ if ((value[12] != '+') && (value[12] != '-')) ++ return ASN1_VALUE_NOT_VALID; ++ for (k = 13; k < 17; k++) ++ if (!c_isdigit (value[k])) ++ return ASN1_VALUE_NOT_VALID; ++ break; ++ default: ++ return ASN1_VALUE_NOT_FOUND; ++ } ++ _asn1_set_value (node, value, len); ++ } ++ break; ++ case ASN1_ETYPE_GENERALIZED_TIME: ++ len = _asn1_strlen (value); ++ _asn1_set_value (node, value, len); ++ break; ++ case ASN1_ETYPE_OCTET_STRING: ++ case ASN1_ETYPE_GENERALSTRING: ++ case ASN1_ETYPE_NUMERIC_STRING: ++ case ASN1_ETYPE_IA5_STRING: ++ case ASN1_ETYPE_TELETEX_STRING: ++ case ASN1_ETYPE_PRINTABLE_STRING: ++ case ASN1_ETYPE_UNIVERSAL_STRING: ++ case ASN1_ETYPE_BMP_STRING: ++ case ASN1_ETYPE_UTF8_STRING: ++ case ASN1_ETYPE_VISIBLE_STRING: ++ if (len == 0) ++ len = _asn1_strlen (value); ++ _asn1_set_value_lv (node, value, len); ++ break; ++ case ASN1_ETYPE_BIT_STRING: ++ if (len == 0) ++ len = _asn1_strlen (value); ++ asn1_length_der ((len >> 3) + 2, NULL, &len2); ++ temp = malloc ((len >> 3) + 2 + len2); ++ if (temp == NULL) ++ return ASN1_MEM_ALLOC_ERROR; ++ ++ asn1_bit_der (value, len, temp, &len2); ++ _asn1_set_value_m (node, temp, len2); ++ temp = NULL; ++ break; ++ case ASN1_ETYPE_CHOICE: ++ p = node->down; ++ while (p) ++ { ++ if (!_asn1_strcmp (p->name, value)) ++ { ++ p2 = node->down; ++ while (p2) ++ { ++ if (p2 != p) ++ { ++ asn1_delete_structure (&p2); ++ p2 = node->down; ++ } ++ else ++ p2 = p2->right; ++ } ++ break; ++ } ++ p = p->right; ++ } ++ if (!p) ++ return ASN1_ELEMENT_NOT_FOUND; ++ break; ++ case ASN1_ETYPE_ANY: ++ _asn1_set_value_lv (node, value, len); ++ break; ++ case ASN1_ETYPE_SEQUENCE_OF: ++ case ASN1_ETYPE_SET_OF: ++ if (_asn1_strcmp (value, "NEW")) ++ return ASN1_VALUE_NOT_VALID; ++ _asn1_append_sequence_set (node, NULL); ++ break; ++ default: ++ return ASN1_ELEMENT_NOT_FOUND; ++ break; ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++#define PUT_VALUE( ptr, ptr_size, data, data_size) \ ++ *len = data_size; \ ++ if (ptr_size < data_size) { \ ++ return ASN1_MEM_ERROR; \ ++ } else { \ ++ if (ptr && data_size > 0) \ ++ memcpy (ptr, data, data_size); \ ++ } ++ ++#define PUT_STR_VALUE( ptr, ptr_size, data) \ ++ *len = _asn1_strlen (data) + 1; \ ++ if (ptr_size < *len) { \ ++ return ASN1_MEM_ERROR; \ ++ } else { \ ++ /* this strcpy is checked */ \ ++ if (ptr) { \ ++ _asn1_strcpy (ptr, data); \ ++ } \ ++ } ++ ++#define PUT_AS_STR_VALUE( ptr, ptr_size, data, data_size) \ ++ *len = data_size + 1; \ ++ if (ptr_size < *len) { \ ++ return ASN1_MEM_ERROR; \ ++ } else { \ ++ /* this strcpy is checked */ \ ++ if (ptr) { \ ++ if (data_size > 0) \ ++ memcpy (ptr, data, data_size); \ ++ ptr[data_size] = 0; \ ++ } \ ++ } ++ ++#define ADD_STR_VALUE( ptr, ptr_size, data) \ ++ *len += _asn1_strlen(data); \ ++ if (ptr_size < (int) *len) { \ ++ (*len)++; \ ++ return ASN1_MEM_ERROR; \ ++ } else { \ ++ /* this strcat is checked */ \ ++ if (ptr) _asn1_strcat (ptr, data); \ ++ } ++ ++/** ++ * asn1_read_value: ++ * @root: pointer to a structure. ++ * @name: the name of the element inside a structure that you want to read. ++ * @ivalue: vector that will contain the element's content, must be a ++ * pointer to memory cells already allocated (may be %NULL). ++ * @len: number of bytes of *value: value[0]..value[len-1]. Initialy ++ * holds the sizeof value. ++ * ++ * Returns the value of one element inside a structure. ++ * If an element is OPTIONAL and this returns ++ * %ASN1_ELEMENT_NOT_FOUND, it means that this element wasn't present ++ * in the der encoding that created the structure. The first element ++ * of a SEQUENCE_OF or SET_OF is named "?1". The second one "?2" and ++ * so on. If the @root provided is a node to specific sequence element, ++ * then the keyword "?CURRENT" is also acceptable and indicates the ++ * current sequence element of this node. ++ * ++ * Note that there can be valid values with length zero. In these case ++ * this function will succeed and @len will be zero. ++ * ++ * INTEGER: VALUE will contain a two's complement form integer. ++ * ++ * integer=-1 -> value[0]=0xFF , len=1. ++ * integer=1 -> value[0]=0x01 , len=1. ++ * ++ * ENUMERATED: As INTEGER (but only with not negative numbers). ++ * ++ * BOOLEAN: VALUE will be the null terminated string "TRUE" or ++ * "FALSE" and LEN=5 or LEN=6. ++ * ++ * OBJECT IDENTIFIER: VALUE will be a null terminated string with ++ * each number separated by a dot (i.e. "1.2.3.543.1"). ++ * ++ * LEN = strlen(VALUE)+1 ++ * ++ * UTCTime: VALUE will be a null terminated string in one of these ++ * formats: "YYMMDDhhmmss+hh'mm'" or "YYMMDDhhmmss-hh'mm'". ++ * LEN=strlen(VALUE)+1. ++ * ++ * GeneralizedTime: VALUE will be a null terminated string in the ++ * same format used to set the value. ++ * ++ * OCTET STRING: VALUE will contain the octet string and LEN will be ++ * the number of octets. ++ * ++ * GeneralString: VALUE will contain the generalstring and LEN will ++ * be the number of octets. ++ * ++ * BIT STRING: VALUE will contain the bit string organized by bytes ++ * and LEN will be the number of bits. ++ * ++ * CHOICE: If NAME indicates a choice type, VALUE will specify the ++ * alternative selected. ++ * ++ * ANY: If NAME indicates an any type, VALUE will indicate the DER ++ * encoding of the structure actually used. ++ * ++ * Returns: %ASN1_SUCCESS if value is returned, ++ * %ASN1_ELEMENT_NOT_FOUND if @name is not a valid element, ++ * %ASN1_VALUE_NOT_FOUND if there isn't any value for the element ++ * selected, and %ASN1_MEM_ERROR if The value vector isn't big enough ++ * to store the result, and in this case @len will contain the number of ++ * bytes needed. On the occasion that the stored data are of zero-length ++ * this function may return %ASN1_SUCCESS even if the provided @len is zero. ++ **/ ++int ++asn1_read_value (asn1_node_const root, const char *name, void *ivalue, int *len) ++{ ++ return asn1_read_value_type (root, name, ivalue, len, NULL); ++} ++ ++/** ++ * asn1_read_value_type: ++ * @root: pointer to a structure. ++ * @name: the name of the element inside a structure that you want to read. ++ * @ivalue: vector that will contain the element's content, must be a ++ * pointer to memory cells already allocated (may be %NULL). ++ * @len: number of bytes of *value: value[0]..value[len-1]. Initialy ++ * holds the sizeof value. ++ * @etype: The type of the value read (ASN1_ETYPE) ++ * ++ * Returns the type and value of one element inside a structure. ++ * If an element is OPTIONAL and this returns ++ * %ASN1_ELEMENT_NOT_FOUND, it means that this element wasn't present ++ * in the der encoding that created the structure. The first element ++ * of a SEQUENCE_OF or SET_OF is named "?1". The second one "?2" and ++ * so on. If the @root provided is a node to specific sequence element, ++ * then the keyword "?CURRENT" is also acceptable and indicates the ++ * current sequence element of this node. ++ * ++ * Note that there can be valid values with length zero. In these case ++ * this function will succeed and @len will be zero. ++ * ++ * ++ * INTEGER: VALUE will contain a two's complement form integer. ++ * ++ * integer=-1 -> value[0]=0xFF , len=1. ++ * integer=1 -> value[0]=0x01 , len=1. ++ * ++ * ENUMERATED: As INTEGER (but only with not negative numbers). ++ * ++ * BOOLEAN: VALUE will be the null terminated string "TRUE" or ++ * "FALSE" and LEN=5 or LEN=6. ++ * ++ * OBJECT IDENTIFIER: VALUE will be a null terminated string with ++ * each number separated by a dot (i.e. "1.2.3.543.1"). ++ * ++ * LEN = strlen(VALUE)+1 ++ * ++ * UTCTime: VALUE will be a null terminated string in one of these ++ * formats: "YYMMDDhhmmss+hh'mm'" or "YYMMDDhhmmss-hh'mm'". ++ * LEN=strlen(VALUE)+1. ++ * ++ * GeneralizedTime: VALUE will be a null terminated string in the ++ * same format used to set the value. ++ * ++ * OCTET STRING: VALUE will contain the octet string and LEN will be ++ * the number of octets. ++ * ++ * GeneralString: VALUE will contain the generalstring and LEN will ++ * be the number of octets. ++ * ++ * BIT STRING: VALUE will contain the bit string organized by bytes ++ * and LEN will be the number of bits. ++ * ++ * CHOICE: If NAME indicates a choice type, VALUE will specify the ++ * alternative selected. ++ * ++ * ANY: If NAME indicates an any type, VALUE will indicate the DER ++ * encoding of the structure actually used. ++ * ++ * Returns: %ASN1_SUCCESS if value is returned, ++ * %ASN1_ELEMENT_NOT_FOUND if @name is not a valid element, ++ * %ASN1_VALUE_NOT_FOUND if there isn't any value for the element ++ * selected, and %ASN1_MEM_ERROR if The value vector isn't big enough ++ * to store the result, and in this case @len will contain the number of ++ * bytes needed. On the occasion that the stored data are of zero-length ++ * this function may return %ASN1_SUCCESS even if the provided @len is zero. ++ **/ ++int ++asn1_read_value_type (asn1_node_const root, const char *name, void *ivalue, ++ int *len, unsigned int *etype) ++{ ++ asn1_node_const node, p, p2; ++ int len2, len3, result; ++ int value_size = *len; ++ unsigned char *value = ivalue; ++ unsigned type; ++ ++ node = asn1_find_node (root, name); ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ type = type_field (node->type); ++ ++ if ((type != ASN1_ETYPE_NULL) && ++ (type != ASN1_ETYPE_CHOICE) && ++ !(node->type & CONST_DEFAULT) && !(node->type & CONST_ASSIGN) && ++ (node->value == NULL)) ++ return ASN1_VALUE_NOT_FOUND; ++ ++ if (etype) ++ *etype = type; ++ switch (type) ++ { ++ case ASN1_ETYPE_NULL: ++ PUT_STR_VALUE (value, value_size, "NULL"); ++ break; ++ case ASN1_ETYPE_BOOLEAN: ++ if ((node->type & CONST_DEFAULT) && (node->value == NULL)) ++ { ++ p = node->down; ++ while (type_field (p->type) != ASN1_ETYPE_DEFAULT) ++ p = p->right; ++ if (p->type & CONST_TRUE) ++ { ++ PUT_STR_VALUE (value, value_size, "TRUE"); ++ } ++ else ++ { ++ PUT_STR_VALUE (value, value_size, "FALSE"); ++ } ++ } ++ else if (node->value[0] == 'T') ++ { ++ PUT_STR_VALUE (value, value_size, "TRUE"); ++ } ++ else ++ { ++ PUT_STR_VALUE (value, value_size, "FALSE"); ++ } ++ break; ++ case ASN1_ETYPE_INTEGER: ++ case ASN1_ETYPE_ENUMERATED: ++ if ((node->type & CONST_DEFAULT) && (node->value == NULL)) ++ { ++ p = node->down; ++ while (type_field (p->type) != ASN1_ETYPE_DEFAULT) ++ p = p->right; ++ if ((c_isdigit (p->value[0])) || (p->value[0] == '-') ++ || (p->value[0] == '+')) ++ { ++ result = _asn1_convert_integer ++ (p->value, value, value_size, len); ++ if (result != ASN1_SUCCESS) ++ return result; ++ } ++ else ++ { /* is an identifier like v1 */ ++ p2 = node->down; ++ while (p2) ++ { ++ if (type_field (p2->type) == ASN1_ETYPE_CONSTANT) ++ { ++ if (!_asn1_strcmp (p2->name, p->value)) ++ { ++ result = _asn1_convert_integer ++ (p2->value, value, value_size, ++ len); ++ if (result != ASN1_SUCCESS) ++ return result; ++ break; ++ } ++ } ++ p2 = p2->right; ++ } ++ } ++ } ++ else ++ { ++ len2 = -1; ++ result = asn1_get_octet_der ++ (node->value, node->value_len, &len2, value, value_size, ++ len); ++ if (result != ASN1_SUCCESS) ++ return result; ++ } ++ break; ++ case ASN1_ETYPE_OBJECT_ID: ++ if (node->type & CONST_ASSIGN) ++ { ++ *len = 0; ++ if (value) ++ value[0] = 0; ++ p = node->down; ++ while (p) ++ { ++ if (type_field (p->type) == ASN1_ETYPE_CONSTANT) ++ { ++ ADD_STR_VALUE (value, value_size, p->value); ++ if (p->right) ++ { ++ ADD_STR_VALUE (value, value_size, "."); ++ } ++ } ++ p = p->right; ++ } ++ (*len)++; ++ } ++ else if ((node->type & CONST_DEFAULT) && (node->value == NULL)) ++ { ++ p = node->down; ++ while (type_field (p->type) != ASN1_ETYPE_DEFAULT) ++ p = p->right; ++ PUT_STR_VALUE (value, value_size, p->value); ++ } ++ else ++ { ++ PUT_STR_VALUE (value, value_size, node->value); ++ } ++ break; ++ case ASN1_ETYPE_GENERALIZED_TIME: ++ case ASN1_ETYPE_UTC_TIME: ++ PUT_AS_STR_VALUE (value, value_size, node->value, node->value_len); ++ break; ++ case ASN1_ETYPE_OCTET_STRING: ++ case ASN1_ETYPE_GENERALSTRING: ++ case ASN1_ETYPE_NUMERIC_STRING: ++ case ASN1_ETYPE_IA5_STRING: ++ case ASN1_ETYPE_TELETEX_STRING: ++ case ASN1_ETYPE_PRINTABLE_STRING: ++ case ASN1_ETYPE_UNIVERSAL_STRING: ++ case ASN1_ETYPE_BMP_STRING: ++ case ASN1_ETYPE_UTF8_STRING: ++ case ASN1_ETYPE_VISIBLE_STRING: ++ len2 = -1; ++ result = asn1_get_octet_der ++ (node->value, node->value_len, &len2, value, value_size, ++ len); ++ if (result != ASN1_SUCCESS) ++ return result; ++ break; ++ case ASN1_ETYPE_BIT_STRING: ++ len2 = -1; ++ result = asn1_get_bit_der ++ (node->value, node->value_len, &len2, value, value_size, ++ len); ++ if (result != ASN1_SUCCESS) ++ return result; ++ break; ++ case ASN1_ETYPE_CHOICE: ++ PUT_STR_VALUE (value, value_size, node->down->name); ++ break; ++ case ASN1_ETYPE_ANY: ++ len3 = -1; ++ len2 = asn1_get_length_der (node->value, node->value_len, &len3); ++ if (len2 < 0) ++ return ASN1_DER_ERROR; ++ PUT_VALUE (value, value_size, node->value + len3, len2); ++ break; ++ default: ++ return ASN1_ELEMENT_NOT_FOUND; ++ break; ++ } ++ return ASN1_SUCCESS; ++} ++ ++ ++/** ++ * asn1_read_tag: ++ * @root: pointer to a structure ++ * @name: the name of the element inside a structure. ++ * @tagValue: variable that will contain the TAG value. ++ * @classValue: variable that will specify the TAG type. ++ * ++ * Returns the TAG and the CLASS of one element inside a structure. ++ * CLASS can have one of these constants: %ASN1_CLASS_APPLICATION, ++ * %ASN1_CLASS_UNIVERSAL, %ASN1_CLASS_PRIVATE or ++ * %ASN1_CLASS_CONTEXT_SPECIFIC. ++ * ++ * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if ++ * @name is not a valid element. ++ **/ ++int ++asn1_read_tag (asn1_node_const root, const char *name, int *tagValue, ++ int *classValue) ++{ ++ asn1_node node, p, pTag; ++ ++ node = asn1_find_node (root, name); ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = node->down; ++ ++ /* pTag will points to the IMPLICIT TAG */ ++ pTag = NULL; ++ if (node->type & CONST_TAG) ++ { ++ while (p) ++ { ++ if (type_field (p->type) == ASN1_ETYPE_TAG) ++ { ++ if ((p->type & CONST_IMPLICIT) && (pTag == NULL)) ++ pTag = p; ++ else if (p->type & CONST_EXPLICIT) ++ pTag = NULL; ++ } ++ p = p->right; ++ } ++ } ++ ++ if (pTag) ++ { ++ *tagValue = _asn1_strtoul (pTag->value, NULL, 10); ++ ++ if (pTag->type & CONST_APPLICATION) ++ *classValue = ASN1_CLASS_APPLICATION; ++ else if (pTag->type & CONST_UNIVERSAL) ++ *classValue = ASN1_CLASS_UNIVERSAL; ++ else if (pTag->type & CONST_PRIVATE) ++ *classValue = ASN1_CLASS_PRIVATE; ++ else ++ *classValue = ASN1_CLASS_CONTEXT_SPECIFIC; ++ } ++ else ++ { ++ unsigned type = type_field (node->type); ++ *classValue = ASN1_CLASS_UNIVERSAL; ++ ++ switch (type) ++ { ++ CASE_HANDLED_ETYPES: ++ *tagValue = _asn1_tags[type].tag; ++ break; ++ case ASN1_ETYPE_TAG: ++ case ASN1_ETYPE_CHOICE: ++ case ASN1_ETYPE_ANY: ++ *tagValue = -1; ++ break; ++ default: ++ break; ++ } ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++/** ++ * asn1_read_node_value: ++ * @node: pointer to a node. ++ * @data: a point to a asn1_data_node_st ++ * ++ * Returns the value a data node inside a asn1_node structure. ++ * The data returned should be handled as constant values. ++ * ++ * Returns: %ASN1_SUCCESS if the node exists. ++ **/ ++int ++asn1_read_node_value (asn1_node_const node, asn1_data_node_st * data) ++{ ++ data->name = node->name; ++ data->value = node->value; ++ data->value_len = node->value_len; ++ data->type = type_field (node->type); ++ ++ return ASN1_SUCCESS; ++} +diff --git a/grub-core/lib/libtasn1/lib/errors.c b/grub-core/lib/libtasn1/lib/errors.c +new file mode 100644 +index 00000000000..cee74daf795 +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/errors.c +@@ -0,0 +1,100 @@ ++/* ++ * Copyright (C) 2002-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++#include ++#ifdef STDC_HEADERS ++#include ++#endif ++ ++#define LIBTASN1_ERROR_ENTRY(name) { #name, name } ++ ++struct libtasn1_error_entry ++{ ++ const char *name; ++ int number; ++}; ++typedef struct libtasn1_error_entry libtasn1_error_entry; ++ ++static const libtasn1_error_entry error_algorithms[] = { ++ LIBTASN1_ERROR_ENTRY (ASN1_SUCCESS), ++ LIBTASN1_ERROR_ENTRY (ASN1_FILE_NOT_FOUND), ++ LIBTASN1_ERROR_ENTRY (ASN1_ELEMENT_NOT_FOUND), ++ LIBTASN1_ERROR_ENTRY (ASN1_IDENTIFIER_NOT_FOUND), ++ LIBTASN1_ERROR_ENTRY (ASN1_DER_ERROR), ++ LIBTASN1_ERROR_ENTRY (ASN1_VALUE_NOT_FOUND), ++ LIBTASN1_ERROR_ENTRY (ASN1_GENERIC_ERROR), ++ LIBTASN1_ERROR_ENTRY (ASN1_VALUE_NOT_VALID), ++ LIBTASN1_ERROR_ENTRY (ASN1_TAG_ERROR), ++ LIBTASN1_ERROR_ENTRY (ASN1_TAG_IMPLICIT), ++ LIBTASN1_ERROR_ENTRY (ASN1_ERROR_TYPE_ANY), ++ LIBTASN1_ERROR_ENTRY (ASN1_SYNTAX_ERROR), ++ LIBTASN1_ERROR_ENTRY (ASN1_MEM_ERROR), ++ LIBTASN1_ERROR_ENTRY (ASN1_MEM_ALLOC_ERROR), ++ LIBTASN1_ERROR_ENTRY (ASN1_DER_OVERFLOW), ++ LIBTASN1_ERROR_ENTRY (ASN1_NAME_TOO_LONG), ++ LIBTASN1_ERROR_ENTRY (ASN1_ARRAY_ERROR), ++ LIBTASN1_ERROR_ENTRY (ASN1_ELEMENT_NOT_EMPTY), ++ LIBTASN1_ERROR_ENTRY (ASN1_TIME_ENCODING_ERROR), ++ LIBTASN1_ERROR_ENTRY (ASN1_RECURSION), ++ {0, 0} ++}; ++ ++/** ++ * asn1_perror: ++ * @error: is an error returned by a libtasn1 function. ++ * ++ * Prints a string to stderr with a description of an error. This ++ * function is like perror(). The only difference is that it accepts ++ * an error returned by a libtasn1 function. ++ * ++ * Since: 1.6 ++ **/ ++void ++asn1_perror (int error) ++{ ++ const char *str = asn1_strerror (error); ++ fprintf (stderr, "LIBTASN1 ERROR: %s\n", str ? str : "(null)"); ++} ++ ++/** ++ * asn1_strerror: ++ * @error: is an error returned by a libtasn1 function. ++ * ++ * Returns a string with a description of an error. This function is ++ * similar to strerror. The only difference is that it accepts an ++ * error (number) returned by a libtasn1 function. ++ * ++ * Returns: Pointer to static zero-terminated string describing error ++ * code. ++ * ++ * Since: 1.6 ++ **/ ++const char * ++asn1_strerror (int error) ++{ ++ const libtasn1_error_entry *p; ++ ++ for (p = error_algorithms; p->name != NULL; p++) ++ if (p->number == error) ++ return p->name + sizeof ("ASN1_") - 1; ++ ++ return NULL; ++} +diff --git a/grub-core/lib/libtasn1/lib/gstr.c b/grub-core/lib/libtasn1/lib/gstr.c +new file mode 100644 +index 00000000000..e91a3a151c0 +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/gstr.c +@@ -0,0 +1,74 @@ ++/* ++ * Copyright (C) 2002-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++#include ++#include "gstr.h" ++ ++/* These function are like strcat, strcpy. They only ++ * do bounds checking (they shouldn't cause buffer overruns), ++ * and they always produce null terminated strings. ++ * ++ * They should be used only with null terminated strings. ++ */ ++void ++_asn1_str_cat (char *dest, size_t dest_tot_size, const char *src) ++{ ++ size_t str_size = strlen (src); ++ size_t dest_size = strlen (dest); ++ ++ if (dest_tot_size - dest_size > str_size) ++ { ++ strcat (dest, src); ++ } ++ else ++ { ++ if (dest_tot_size - dest_size > 0) ++ { ++ strncat (dest, src, (dest_tot_size - dest_size) - 1); ++ dest[dest_tot_size - 1] = 0; ++ } ++ } ++} ++ ++/* Returns the bytes copied (not including the null terminator) */ ++unsigned int ++_asn1_str_cpy (char *dest, size_t dest_tot_size, const char *src) ++{ ++ size_t str_size = strlen (src); ++ ++ if (dest_tot_size > str_size) ++ { ++ strcpy (dest, src); ++ return str_size; ++ } ++ else ++ { ++ if (dest_tot_size > 0) ++ { ++ str_size = dest_tot_size - 1; ++ memcpy (dest, src, str_size); ++ dest[str_size] = 0; ++ return str_size; ++ } ++ else ++ return 0; ++ } ++} +diff --git a/grub-core/lib/libtasn1/lib/parser_aux.c b/grub-core/lib/libtasn1/lib/parser_aux.c +new file mode 100644 +index 00000000000..d5dbbf8765d +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/parser_aux.c +@@ -0,0 +1,1173 @@ ++/* ++ * Copyright (C) 2000-2016 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++#include // WORD_BIT ++ ++#include "int.h" ++#include "parser_aux.h" ++#include "gstr.h" ++#include "structure.h" ++#include "element.h" ++#include "c-ctype.h" ++ ++char _asn1_identifierMissing[ASN1_MAX_NAME_SIZE + 1]; /* identifier name not found */ ++ ++/* Return a hash of the N bytes of X using the method described by ++ Bruno Haible in https://www.haible.de/bruno/hashfunc.html. ++ Note that while many hash functions reduce their result via modulo ++ to a 0..table_size-1 range, this function does not do that. ++ ++ This implementation has been changed from size_t -> unsigned int. */ ++ ++#ifdef __clang__ ++__attribute__((no_sanitize("integer"))) ++#endif ++_GL_ATTRIBUTE_PURE ++static unsigned int ++_asn1_hash_name (const char *x) ++{ ++ const unsigned char *s = (unsigned char *) x; ++ unsigned h = 0; ++ ++ while (*s) ++ h = (*s++) + ((h << 9) | (h >> (WORD_BIT - 9))); ++ ++ return h; ++} ++ ++/******************************************************/ ++/* Function : _asn1_add_static_node */ ++/* Description: creates a new NODE_ASN element and */ ++/* puts it in the list pointed by e_list. */ ++/* Parameters: */ ++/* e_list: of type list_type; must be NULL initially */ ++/* type: type of the new element (see ASN1_ETYPE_ */ ++/* and CONST_ constants). */ ++/* Return: pointer to the new element. */ ++/******************************************************/ ++asn1_node ++_asn1_add_static_node (list_type **e_list, unsigned int type) ++{ ++ list_type *p; ++ asn1_node punt; ++ ++ punt = calloc (1, sizeof (struct asn1_node_st)); ++ if (punt == NULL) ++ return NULL; ++ ++ p = malloc (sizeof (list_type)); ++ if (p == NULL) ++ { ++ free (punt); ++ return NULL; ++ } ++ ++ p->node = punt; ++ p->next = *e_list; ++ *e_list = p; ++ ++ punt->type = type; ++ ++ return punt; ++} ++ ++static ++int _asn1_add_static_node2 (list_type **e_list, asn1_node node) ++{ ++ list_type *p; ++ ++ p = malloc (sizeof (list_type)); ++ if (p == NULL) ++ { ++ return -1; ++ } ++ ++ p->node = node; ++ p->next = *e_list; ++ *e_list = p; ++ ++ return 0; ++} ++ ++/** ++ * asn1_find_node: ++ * @pointer: NODE_ASN element pointer. ++ * @name: null terminated string with the element's name to find. ++ * ++ * Searches for an element called @name starting from @pointer. The ++ * name is composed by different identifiers separated by dots. When ++ * *@pointer has a name, the first identifier must be the name of ++ * *@pointer, otherwise it must be the name of one child of *@pointer. ++ * ++ * Returns: the search result, or %NULL if not found. ++ **/ ++asn1_node ++asn1_find_node (asn1_node_const pointer, const char *name) ++{ ++ asn1_node_const p; ++ char *n_end, n[ASN1_MAX_NAME_SIZE + 1]; ++ const char *n_start; ++ unsigned int nsize; ++ unsigned int nhash; ++ ++ if (pointer == NULL) ++ return NULL; ++ ++ if (name == NULL) ++ return NULL; ++ ++ p = pointer; ++ n_start = name; ++ ++ if (name[0] == '?' && name[1] == 'C' && p->name[0] == '?') ++ { /* ?CURRENT */ ++ n_start = strchr(n_start, '.'); ++ if (n_start) ++ n_start++; ++ } ++ else if (p->name[0] != 0) ++ { /* has *pointer got a name ? */ ++ n_end = strchr (n_start, '.'); /* search the first dot */ ++ if (n_end) ++ { ++ nsize = n_end - n_start; ++ if (nsize >= sizeof(n)) ++ return NULL; ++ ++ memcpy (n, n_start, nsize); ++ n[nsize] = 0; ++ n_start = n_end; ++ n_start++; ++ ++ nhash = _asn1_hash_name (n); ++ } ++ else ++ { ++ _asn1_str_cpy (n, sizeof (n), n_start); ++ nhash = _asn1_hash_name (n); ++ ++ n_start = NULL; ++ } ++ ++ while (p) ++ { ++ if (nhash == p->name_hash && (!strcmp (p->name, n))) ++ break; ++ else ++ p = p->right; ++ } /* while */ ++ ++ if (p == NULL) ++ return NULL; ++ } ++ else ++ { /* *pointer doesn't have a name */ ++ if (n_start[0] == 0) ++ return (asn1_node) p; ++ } ++ ++ while (n_start) ++ { /* Has the end of NAME been reached? */ ++ n_end = strchr (n_start, '.'); /* search the next dot */ ++ if (n_end) ++ { ++ nsize = n_end - n_start; ++ if (nsize >= sizeof(n)) ++ return NULL; ++ ++ memcpy (n, n_start, nsize); ++ n[nsize] = 0; ++ n_start = n_end; ++ n_start++; ++ ++ nhash = _asn1_hash_name (n); ++ } ++ else ++ { ++ _asn1_str_cpy (n, sizeof (n), n_start); ++ nhash = _asn1_hash_name (n); ++ n_start = NULL; ++ } ++ ++ if (p->down == NULL) ++ return NULL; ++ ++ p = p->down; ++ if (p == NULL) ++ return NULL; ++ ++ /* The identifier "?LAST" indicates the last element ++ in the right chain. */ ++ if (n[0] == '?' && n[1] == 'L') /* ?LAST */ ++ { ++ while (p->right) ++ p = p->right; ++ } ++ else ++ { /* no "?LAST" */ ++ while (p) ++ { ++ if (p->name_hash == nhash && !strcmp (p->name, n)) ++ break; ++ else ++ p = p->right; ++ } ++ } ++ if (p == NULL) ++ return NULL; ++ } /* while */ ++ ++ return (asn1_node) p; ++} ++ ++ ++/******************************************************************/ ++/* Function : _asn1_set_value */ ++/* Description: sets the field VALUE in a NODE_ASN element. The */ ++/* previous value (if exist) will be lost */ ++/* Parameters: */ ++/* node: element pointer. */ ++/* value: pointer to the value that you want to set. */ ++/* len: character number of value. */ ++/* Return: pointer to the NODE_ASN element. */ ++/******************************************************************/ ++asn1_node ++_asn1_set_value (asn1_node node, const void *value, unsigned int len) ++{ ++ if (node == NULL) ++ return node; ++ if (node->value) ++ { ++ if (node->value != node->small_value) ++ free (node->value); ++ node->value = NULL; ++ node->value_len = 0; ++ } ++ ++ if (!len) ++ return node; ++ ++ if (len < sizeof (node->small_value)) ++ { ++ node->value = node->small_value; ++ } ++ else ++ { ++ node->value = malloc (len); ++ if (node->value == NULL) ++ return NULL; ++ } ++ node->value_len = len; ++ ++ memcpy (node->value, value, len); ++ return node; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_set_value_lv */ ++/* Description: sets the field VALUE in a NODE_ASN element. The */ ++/* previous value (if exist) will be lost. The value */ ++/* given is stored as an length-value format (LV */ ++/* Parameters: */ ++/* node: element pointer. */ ++/* value: pointer to the value that you want to set. */ ++/* len: character number of value. */ ++/* Return: pointer to the NODE_ASN element. */ ++/******************************************************************/ ++asn1_node ++_asn1_set_value_lv (asn1_node node, const void *value, unsigned int len) ++{ ++ int len2; ++ void *temp; ++ ++ if (node == NULL) ++ return node; ++ ++ asn1_length_der (len, NULL, &len2); ++ temp = malloc (len + len2); ++ if (temp == NULL) ++ return NULL; ++ ++ asn1_octet_der (value, len, temp, &len2); ++ return _asn1_set_value_m (node, temp, len2); ++} ++ ++/* the same as _asn1_set_value except that it sets an already malloc'ed ++ * value. ++ */ ++asn1_node ++_asn1_set_value_m (asn1_node node, void *value, unsigned int len) ++{ ++ if (node == NULL) ++ return node; ++ ++ if (node->value) ++ { ++ if (node->value != node->small_value) ++ free (node->value); ++ node->value = NULL; ++ node->value_len = 0; ++ } ++ ++ if (!len) ++ return node; ++ ++ node->value = value; ++ node->value_len = len; ++ ++ return node; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_append_value */ ++/* Description: appends to the field VALUE in a NODE_ASN element. */ ++/* */ ++/* Parameters: */ ++/* node: element pointer. */ ++/* value: pointer to the value that you want to be appended. */ ++/* len: character number of value. */ ++/* Return: pointer to the NODE_ASN element. */ ++/******************************************************************/ ++asn1_node ++_asn1_append_value (asn1_node node, const void *value, unsigned int len) ++{ ++ if (node == NULL) ++ return node; ++ ++ if (node->value == NULL) ++ return _asn1_set_value (node, value, len); ++ ++ if (len == 0) ++ return node; ++ ++ if (node->value == node->small_value) ++ { ++ /* value is in node */ ++ int prev_len = node->value_len; ++ node->value_len += len; ++ node->value = malloc (node->value_len); ++ if (node->value == NULL) ++ { ++ node->value_len = 0; ++ return NULL; ++ } ++ ++ if (prev_len > 0) ++ memcpy (node->value, node->small_value, prev_len); ++ ++ memcpy (&node->value[prev_len], value, len); ++ ++ return node; ++ } ++ else /* if (node->value != NULL && node->value != node->small_value) */ ++ { ++ /* value is allocated */ ++ int prev_len = node->value_len; ++ node->value_len += len; ++ ++ node->value = _asn1_realloc (node->value, node->value_len); ++ if (node->value == NULL) ++ { ++ node->value_len = 0; ++ return NULL; ++ } ++ ++ memcpy (&node->value[prev_len], value, len); ++ ++ return node; ++ } ++} ++ ++/******************************************************************/ ++/* Function : _asn1_set_name */ ++/* Description: sets the field NAME in a NODE_ASN element. The */ ++/* previous value (if exist) will be lost */ ++/* Parameters: */ ++/* node: element pointer. */ ++/* name: a null terminated string with the name that you want */ ++/* to set. */ ++/* Return: pointer to the NODE_ASN element. */ ++/******************************************************************/ ++asn1_node ++_asn1_set_name (asn1_node node, const char *name) ++{ ++ if (node == NULL) ++ return node; ++ ++ _asn1_str_cpy (node->name, sizeof (node->name), name ? name : ""); ++ node->name_hash = _asn1_hash_name (node->name); ++ ++ return node; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_cpy_name */ ++/* Description: copies the field NAME in a NODE_ASN element. */ ++/* Parameters: */ ++/* dst: a dest element pointer. */ ++/* src: a source element pointer. */ ++/* Return: pointer to the NODE_ASN element. */ ++/******************************************************************/ ++asn1_node ++_asn1_cpy_name (asn1_node dst, asn1_node_const src) ++{ ++ if (dst == NULL) ++ return dst; ++ ++ if (src == NULL) ++ { ++ dst->name[0] = 0; ++ dst->name_hash = _asn1_hash_name (dst->name); ++ return dst; ++ } ++ ++ _asn1_str_cpy (dst->name, sizeof (dst->name), src->name); ++ dst->name_hash = src->name_hash; ++ ++ return dst; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_set_right */ ++/* Description: sets the field RIGHT in a NODE_ASN element. */ ++/* Parameters: */ ++/* node: element pointer. */ ++/* right: pointer to a NODE_ASN element that you want be pointed*/ ++/* by NODE. */ ++/* Return: pointer to *NODE. */ ++/******************************************************************/ ++asn1_node ++_asn1_set_right (asn1_node node, asn1_node right) ++{ ++ if (node == NULL) ++ return node; ++ node->right = right; ++ if (right) ++ right->left = node; ++ return node; ++} ++ ++ ++/******************************************************************/ ++/* Function : _asn1_get_last_right */ ++/* Description: return the last element along the right chain. */ ++/* Parameters: */ ++/* node: starting element pointer. */ ++/* Return: pointer to the last element along the right chain. */ ++/******************************************************************/ ++asn1_node ++_asn1_get_last_right (asn1_node_const node) ++{ ++ asn1_node_const p; ++ ++ if (node == NULL) ++ return NULL; ++ p = node; ++ while (p->right) ++ p = p->right; ++ return (asn1_node) p; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_remove_node */ ++/* Description: gets free the memory allocated for an NODE_ASN */ ++/* element (not the elements pointed by it). */ ++/* Parameters: */ ++/* node: NODE_ASN element pointer. */ ++/* flags: ASN1_DELETE_FLAG_* */ ++/******************************************************************/ ++void ++_asn1_remove_node (asn1_node node, unsigned int flags) ++{ ++ if (node == NULL) ++ return; ++ ++ if (node->value != NULL) ++ { ++ if (flags & ASN1_DELETE_FLAG_ZEROIZE) ++ { ++ safe_memset(node->value, 0, node->value_len); ++ } ++ ++ if (node->value != node->small_value) ++ free (node->value); ++ } ++ free (node); ++} ++ ++/******************************************************************/ ++/* Function : _asn1_find_up */ ++/* Description: return the father of the NODE_ASN element. */ ++/* Parameters: */ ++/* node: NODE_ASN element pointer. */ ++/* Return: Null if not found. */ ++/******************************************************************/ ++asn1_node ++_asn1_find_up (asn1_node_const node) ++{ ++ asn1_node_const p; ++ ++ if (node == NULL) ++ return NULL; ++ ++ p = node; ++ ++ while ((p->left != NULL) && (p->left->right == p)) ++ p = p->left; ++ ++ return p->left; ++} ++ ++static ++unsigned _asn1_is_up (asn1_node_const up_cand, asn1_node_const down) ++{ ++ asn1_node_const d, u; ++ ++ if (up_cand == NULL || down == NULL) ++ return 0; ++ ++ d = down; ++ ++ while ((u = _asn1_find_up(d)) != NULL && u != d) ++ { ++ if (u == up_cand) ++ return 1; ++ d = u; ++ } ++ ++ return 0; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_delete_node_from_list */ ++/* Description: deletes the list element given */ ++/******************************************************************/ ++void ++_asn1_delete_node_from_list (list_type *list, asn1_node node) ++{ ++ list_type *p = list; ++ ++ while (p) ++ { ++ if (p->node == node) ++ p->node = NULL; ++ p = p->next; ++ } ++} ++ ++/******************************************************************/ ++/* Function : _asn1_delete_list */ ++/* Description: deletes the list elements (not the elements */ ++/* pointed by them). */ ++/******************************************************************/ ++void ++_asn1_delete_list (list_type *e_list) ++{ ++ list_type *p; ++ ++ while (e_list) ++ { ++ p = e_list; ++ e_list = e_list->next; ++ free (p); ++ } ++} ++ ++/******************************************************************/ ++/* Function : _asn1_delete_list_and nodes */ ++/* Description: deletes the list elements and the elements */ ++/* pointed by them. */ ++/******************************************************************/ ++void ++_asn1_delete_list_and_nodes (list_type *e_list) ++{ ++ list_type *p; ++ ++ while (e_list) ++ { ++ p = e_list; ++ e_list = e_list->next; ++ _asn1_remove_node (p->node, 0); ++ free (p); ++ } ++} ++ ++ ++char * ++_asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]) ++{ ++ uint64_t d, r; ++ char temp[LTOSTR_MAX_SIZE]; ++ int count, k, start; ++ uint64_t val; ++ ++ if (v < 0) ++ { ++ str[0] = '-'; ++ start = 1; ++ val = -((uint64_t)v); ++ } ++ else ++ { ++ val = v; ++ start = 0; ++ } ++ ++ count = 0; ++ do ++ { ++ d = val / 10; ++ r = val - d * 10; ++ temp[start + count] = '0' + (char) r; ++ count++; ++ val = d; ++ } ++ while (val && ((start+count) < LTOSTR_MAX_SIZE-1)); ++ ++ for (k = 0; k < count; k++) ++ str[k + start] = temp[start + count - k - 1]; ++ str[count + start] = 0; ++ return str; ++} ++ ++ ++/******************************************************************/ ++/* Function : _asn1_change_integer_value */ ++/* Description: converts into DER coding the value assign to an */ ++/* INTEGER constant. */ ++/* Parameters: */ ++/* node: root of an ASN1element. */ ++/* Return: */ ++/* ASN1_ELEMENT_NOT_FOUND if NODE is NULL, */ ++/* otherwise ASN1_SUCCESS */ ++/******************************************************************/ ++int ++_asn1_change_integer_value (asn1_node node) ++{ ++ asn1_node p; ++ unsigned char val[SIZEOF_UNSIGNED_LONG_INT]; ++ unsigned char val2[SIZEOF_UNSIGNED_LONG_INT + 1]; ++ int len; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = node; ++ while (p) ++ { ++ if ((type_field (p->type) == ASN1_ETYPE_INTEGER) ++ && (p->type & CONST_ASSIGN)) ++ { ++ if (p->value) ++ { ++ _asn1_convert_integer (p->value, val, sizeof (val), &len); ++ asn1_octet_der (val, len, val2, &len); ++ _asn1_set_value (p, val2, len); ++ } ++ } ++ ++ if (p->down) ++ { ++ p = p->down; ++ } ++ else ++ { ++ if (p == node) ++ p = NULL; ++ else if (p->right) ++ p = p->right; ++ else ++ { ++ while (1) ++ { ++ p = _asn1_find_up (p); ++ if (p == node) ++ { ++ p = NULL; ++ break; ++ } ++ if (p && p->right) ++ { ++ p = p->right; ++ break; ++ } ++ } ++ } ++ } ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++#define MAX_CONSTANTS 1024 ++/******************************************************************/ ++/* Function : _asn1_expand_object_id */ ++/* Description: expand the IDs of an OBJECT IDENTIFIER constant. */ ++/* Parameters: */ ++/* list: root of an object list */ ++/* node: root of an ASN1 element. */ ++/* Return: */ ++/* ASN1_ELEMENT_NOT_FOUND if NODE is NULL, */ ++/* otherwise ASN1_SUCCESS */ ++/******************************************************************/ ++int ++_asn1_expand_object_id (list_type **list, asn1_node node) ++{ ++ asn1_node p, p2, p3, p4, p5; ++ char name_root[ASN1_MAX_NAME_SIZE], name2[2 * ASN1_MAX_NAME_SIZE + 1]; ++ int move, tlen, tries; ++ unsigned max_constants; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ _asn1_str_cpy (name_root, sizeof (name_root), node->name); ++ ++ p = node; ++ move = DOWN; ++ tries = 0; ++ ++ while (!((p == node) && (move == UP))) ++ { ++ if (move != UP) ++ { ++ if ((type_field (p->type) == ASN1_ETYPE_OBJECT_ID) ++ && (p->type & CONST_ASSIGN)) ++ { ++ p2 = p->down; ++ if (p2 && (type_field (p2->type) == ASN1_ETYPE_CONSTANT)) ++ { ++ if (p2->value && !c_isdigit (p2->value[0])) ++ { ++ _asn1_str_cpy (name2, sizeof (name2), name_root); ++ _asn1_str_cat (name2, sizeof (name2), "."); ++ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value); ++ p3 = asn1_find_node (node, name2); ++ if (!p3 || _asn1_is_up(p2, p3) || ++ (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID) || ++ !(p3->type & CONST_ASSIGN)) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ _asn1_set_down (p, p2->right); ++ if (p2->down) ++ _asn1_delete_structure (*list, &p2->down, 0); ++ _asn1_delete_node_from_list(*list, p2); ++ _asn1_remove_node (p2, 0); ++ p2 = p; ++ p4 = p3->down; ++ max_constants = 0; ++ while (p4) ++ { ++ if (type_field (p4->type) == ASN1_ETYPE_CONSTANT) ++ { ++ max_constants++; ++ if (max_constants == MAX_CONSTANTS) ++ return ASN1_RECURSION; ++ ++ p5 = ++ _asn1_add_single_node (ASN1_ETYPE_CONSTANT); ++ _asn1_set_name (p5, p4->name); ++ if (p4->value) ++ { ++ tlen = _asn1_strlen (p4->value); ++ if (tlen > 0) ++ _asn1_set_value (p5, p4->value, tlen + 1); ++ } ++ _asn1_add_static_node2(list, p5); ++ ++ if (p2 == p) ++ { ++ _asn1_set_right (p5, p->down); ++ _asn1_set_down (p, p5); ++ } ++ else ++ { ++ _asn1_set_right (p5, p2->right); ++ _asn1_set_right (p2, p5); ++ } ++ p2 = p5; ++ } ++ p4 = p4->right; ++ } ++ move = DOWN; ++ ++ tries++; ++ if (tries >= EXPAND_OBJECT_ID_MAX_RECURSION) ++ return ASN1_RECURSION; ++ ++ continue; ++ } ++ } ++ } ++ move = DOWN; ++ } ++ else ++ move = RIGHT; ++ ++ tries = 0; ++ if (move == DOWN) ++ { ++ if (p->down) ++ p = p->down; ++ else ++ move = RIGHT; ++ } ++ ++ if (p == node) ++ { ++ move = UP; ++ continue; ++ } ++ ++ if (move == RIGHT) ++ { ++ if (p && p->right) ++ p = p->right; ++ else ++ move = UP; ++ } ++ if (move == UP) ++ p = _asn1_find_up (p); ++ } ++ ++ /*******************************/ ++ /* expand DEFAULT */ ++ /*******************************/ ++ p = node; ++ move = DOWN; ++ ++ while (!((p == node) && (move == UP))) ++ { ++ if (move != UP) ++ { ++ if ((type_field (p->type) == ASN1_ETYPE_OBJECT_ID) && ++ (p->type & CONST_DEFAULT)) ++ { ++ p2 = p->down; ++ if (p2 && (type_field (p2->type) == ASN1_ETYPE_DEFAULT)) ++ { ++ _asn1_str_cpy (name2, sizeof (name2), name_root); ++ _asn1_str_cat (name2, sizeof (name2), "."); ++ if (p2->value) ++ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value); ++ p3 = asn1_find_node (node, name2); ++ if (!p3 || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID) ++ || !(p3->type & CONST_ASSIGN)) ++ return ASN1_ELEMENT_NOT_FOUND; ++ p4 = p3->down; ++ name2[0] = 0; ++ while (p4) ++ { ++ if (type_field (p4->type) == ASN1_ETYPE_CONSTANT) ++ { ++ if (p4->value == NULL) ++ return ASN1_VALUE_NOT_FOUND; ++ ++ if (name2[0]) ++ _asn1_str_cat (name2, sizeof (name2), "."); ++ _asn1_str_cat (name2, sizeof (name2), ++ (char *) p4->value); ++ } ++ p4 = p4->right; ++ } ++ tlen = strlen (name2); ++ if (tlen > 0) ++ _asn1_set_value (p2, name2, tlen + 1); ++ } ++ } ++ move = DOWN; ++ } ++ else ++ move = RIGHT; ++ ++ if (move == DOWN) ++ { ++ if (p->down) ++ p = p->down; ++ else ++ move = RIGHT; ++ } ++ ++ if (p == node) ++ { ++ move = UP; ++ continue; ++ } ++ ++ if (move == RIGHT) ++ { ++ if (p && p->right) ++ p = p->right; ++ else ++ move = UP; ++ } ++ if (move == UP) ++ p = _asn1_find_up (p); ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/******************************************************************/ ++/* Function : _asn1_type_set_config */ ++/* Description: sets the CONST_SET and CONST_NOT_USED properties */ ++/* in the fields of the SET elements. */ ++/* Parameters: */ ++/* node: root of an ASN1 element. */ ++/* Return: */ ++/* ASN1_ELEMENT_NOT_FOUND if NODE is NULL, */ ++/* otherwise ASN1_SUCCESS */ ++/******************************************************************/ ++int ++_asn1_type_set_config (asn1_node node) ++{ ++ asn1_node p, p2; ++ int move; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = node; ++ move = DOWN; ++ ++ while (!((p == node) && (move == UP))) ++ { ++ if (move != UP) ++ { ++ if (type_field (p->type) == ASN1_ETYPE_SET) ++ { ++ p2 = p->down; ++ while (p2) ++ { ++ if (type_field (p2->type) != ASN1_ETYPE_TAG) ++ p2->type |= CONST_SET | CONST_NOT_USED; ++ p2 = p2->right; ++ } ++ } ++ move = DOWN; ++ } ++ else ++ move = RIGHT; ++ ++ if (move == DOWN) ++ { ++ if (p->down) ++ p = p->down; ++ else ++ move = RIGHT; ++ } ++ ++ if (p == node) ++ { ++ move = UP; ++ continue; ++ } ++ ++ if (move == RIGHT) ++ { ++ if (p && p->right) ++ p = p->right; ++ else ++ move = UP; ++ } ++ if (move == UP) ++ p = _asn1_find_up (p); ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/******************************************************************/ ++/* Function : _asn1_check_identifier */ ++/* Description: checks the definitions of all the identifiers */ ++/* and the first element of an OBJECT_ID (e.g. {pkix 0 4}). */ ++/* The _asn1_identifierMissing global variable is filled if */ ++/* necessary. */ ++/* Parameters: */ ++/* node: root of an ASN1 element. */ ++/* Return: */ ++/* ASN1_ELEMENT_NOT_FOUND if NODE is NULL, */ ++/* ASN1_IDENTIFIER_NOT_FOUND if an identifier is not defined, */ ++/* otherwise ASN1_SUCCESS */ ++/******************************************************************/ ++int ++_asn1_check_identifier (asn1_node_const node) ++{ ++ asn1_node_const p, p2; ++ char name2[ASN1_MAX_NAME_SIZE * 2 + 2]; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = node; ++ while (p) ++ { ++ if (p->value && type_field (p->type) == ASN1_ETYPE_IDENTIFIER) ++ { ++ _asn1_str_cpy (name2, sizeof (name2), node->name); ++ _asn1_str_cat (name2, sizeof (name2), "."); ++ _asn1_str_cat (name2, sizeof (name2), (char *) p->value); ++ p2 = asn1_find_node (node, name2); ++ if (p2 == NULL) ++ { ++ if (p->value) ++ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p->value); ++ else ++ _asn1_strcpy (_asn1_identifierMissing, "(null)"); ++ return ASN1_IDENTIFIER_NOT_FOUND; ++ } ++ } ++ else if ((type_field (p->type) == ASN1_ETYPE_OBJECT_ID) && ++ (p->type & CONST_DEFAULT)) ++ { ++ p2 = p->down; ++ if (p2 && (type_field (p2->type) == ASN1_ETYPE_DEFAULT)) ++ { ++ _asn1_str_cpy (name2, sizeof (name2), node->name); ++ if (p2->value) ++ { ++ _asn1_str_cat (name2, sizeof (name2), "."); ++ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value); ++ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p2->value); ++ } ++ else ++ _asn1_strcpy (_asn1_identifierMissing, "(null)"); ++ ++ p2 = asn1_find_node (node, name2); ++ if (!p2 || (type_field (p2->type) != ASN1_ETYPE_OBJECT_ID) || ++ !(p2->type & CONST_ASSIGN)) ++ return ASN1_IDENTIFIER_NOT_FOUND; ++ else ++ _asn1_identifierMissing[0] = 0; ++ } ++ } ++ else if ((type_field (p->type) == ASN1_ETYPE_OBJECT_ID) && ++ (p->type & CONST_ASSIGN)) ++ { ++ p2 = p->down; ++ if (p2 && (type_field (p2->type) == ASN1_ETYPE_CONSTANT)) ++ { ++ if (p2->value && !c_isdigit (p2->value[0])) ++ { ++ _asn1_str_cpy (name2, sizeof (name2), node->name); ++ _asn1_str_cat (name2, sizeof (name2), "."); ++ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value); ++ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p2->value); ++ ++ p2 = asn1_find_node (node, name2); ++ if (!p2 || (type_field (p2->type) != ASN1_ETYPE_OBJECT_ID) ++ || !(p2->type & CONST_ASSIGN)) ++ return ASN1_IDENTIFIER_NOT_FOUND; ++ else ++ _asn1_identifierMissing[0] = 0; ++ } ++ } ++ } ++ ++ if (p->down) ++ { ++ p = p->down; ++ } ++ else if (p->right) ++ p = p->right; ++ else ++ { ++ while (p) ++ { ++ p = _asn1_find_up (p); ++ if (p == node) ++ { ++ p = NULL; ++ break; ++ } ++ if (p && p->right) ++ { ++ p = p->right; ++ break; ++ } ++ } ++ } ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/******************************************************************/ ++/* Function : _asn1_set_default_tag */ ++/* Description: sets the default IMPLICIT or EXPLICIT property in */ ++/* the tagged elements that don't have this declaration. */ ++/* Parameters: */ ++/* node: pointer to a DEFINITIONS element. */ ++/* Return: */ ++/* ASN1_ELEMENT_NOT_FOUND if NODE is NULL or not a pointer to */ ++/* a DEFINITIONS element, */ ++/* otherwise ASN1_SUCCESS */ ++/******************************************************************/ ++int ++_asn1_set_default_tag (asn1_node node) ++{ ++ asn1_node p; ++ ++ if ((node == NULL) || (type_field (node->type) != ASN1_ETYPE_DEFINITIONS)) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = node; ++ while (p) ++ { ++ if ((type_field (p->type) == ASN1_ETYPE_TAG) && ++ !(p->type & CONST_EXPLICIT) && !(p->type & CONST_IMPLICIT)) ++ { ++ if (node->type & CONST_EXPLICIT) ++ p->type |= CONST_EXPLICIT; ++ else ++ p->type |= CONST_IMPLICIT; ++ } ++ ++ if (p->down) ++ { ++ p = p->down; ++ } ++ else if (p->right) ++ p = p->right; ++ else ++ { ++ while (1) ++ { ++ p = _asn1_find_up (p); ++ if (p == node) ++ { ++ p = NULL; ++ break; ++ } ++ if (p && p->right) ++ { ++ p = p->right; ++ break; ++ } ++ } ++ } ++ } ++ ++ return ASN1_SUCCESS; ++} +diff --git a/grub-core/lib/libtasn1/lib/structure.c b/grub-core/lib/libtasn1/lib/structure.c +new file mode 100644 +index 00000000000..8189c56a4c9 +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/structure.c +@@ -0,0 +1,1220 @@ ++/* ++ * Copyright (C) 2002-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++ ++/*****************************************************/ ++/* File: structure.c */ ++/* Description: Functions to create and delete an */ ++/* ASN1 tree. */ ++/*****************************************************/ ++ ++ ++#include ++#include ++#include "parser_aux.h" ++#include ++ ++ ++extern char _asn1_identifierMissing[]; ++ ++ ++/******************************************************/ ++/* Function : _asn1_add_single_node */ ++/* Description: creates a new NODE_ASN element. */ ++/* Parameters: */ ++/* type: type of the new element (see ASN1_ETYPE_ */ ++/* and CONST_ constants). */ ++/* Return: pointer to the new element. */ ++/******************************************************/ ++asn1_node ++_asn1_add_single_node (unsigned int type) ++{ ++ asn1_node punt; ++ ++ punt = calloc (1, sizeof (struct asn1_node_st)); ++ if (punt == NULL) ++ return NULL; ++ ++ punt->type = type; ++ ++ return punt; ++} ++ ++ ++/******************************************************************/ ++/* Function : _asn1_find_left */ ++/* Description: returns the NODE_ASN element with RIGHT field that*/ ++/* points the element NODE. */ ++/* Parameters: */ ++/* node: NODE_ASN element pointer. */ ++/* Return: NULL if not found. */ ++/******************************************************************/ ++asn1_node ++_asn1_find_left (asn1_node_const node) ++{ ++ if ((node == NULL) || (node->left == NULL) || (node->left->down == node)) ++ return NULL; ++ ++ return node->left; ++} ++ ++ ++int ++_asn1_create_static_structure (asn1_node_const pointer, char *output_file_name, ++ char *vector_name) ++{ ++ FILE *file; ++ asn1_node_const p; ++ unsigned long t; ++ ++ file = fopen (output_file_name, "w"); ++ ++ if (file == NULL) ++ return ASN1_FILE_NOT_FOUND; ++ ++ fprintf (file, "#if HAVE_CONFIG_H\n"); ++ fprintf (file, "# include \"config.h\"\n"); ++ fprintf (file, "#endif\n\n"); ++ ++ fprintf (file, "#include \n\n"); ++ ++ fprintf (file, "const asn1_static_node %s[] = {\n", vector_name); ++ ++ p = pointer; ++ ++ while (p) ++ { ++ fprintf (file, " { "); ++ ++ if (p->name[0] != 0) ++ fprintf (file, "\"%s\", ", p->name); ++ else ++ fprintf (file, "NULL, "); ++ ++ t = p->type; ++ if (p->down) ++ t |= CONST_DOWN; ++ if (p->right) ++ t |= CONST_RIGHT; ++ ++ fprintf (file, "%lu, ", t); ++ ++ if (p->value) ++ fprintf (file, "\"%s\"},\n", p->value); ++ else ++ fprintf (file, "NULL },\n"); ++ ++ if (p->down) ++ { ++ p = p->down; ++ } ++ else if (p->right) ++ { ++ p = p->right; ++ } ++ else ++ { ++ while (1) ++ { ++ p = _asn1_find_up (p); ++ if (p == pointer) ++ { ++ p = NULL; ++ break; ++ } ++ if (p->right) ++ { ++ p = p->right; ++ break; ++ } ++ } ++ } ++ } ++ ++ fprintf (file, " { NULL, 0, NULL }\n};\n"); ++ ++ fclose (file); ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/** ++ * asn1_array2tree: ++ * @array: specify the array that contains ASN.1 declarations ++ * @definitions: return the pointer to the structure created by ++ * *ARRAY ASN.1 declarations ++ * @errorDescription: return the error description. ++ * ++ * Creates the structures needed to manage the ASN.1 definitions. ++ * @array is a vector created by asn1_parser2array(). ++ * ++ * Returns: %ASN1_SUCCESS if structure was created correctly, ++ * %ASN1_ELEMENT_NOT_EMPTY if *@definitions not NULL, ++ * %ASN1_IDENTIFIER_NOT_FOUND if in the file there is an identifier ++ * that is not defined (see @errorDescription for more information), ++ * %ASN1_ARRAY_ERROR if the array pointed by @array is wrong. ++ **/ ++int ++asn1_array2tree (const asn1_static_node * array, asn1_node * definitions, ++ char *errorDescription) ++{ ++ asn1_node p, p_last = NULL; ++ unsigned long k; ++ int move; ++ int result; ++ unsigned int type; ++ list_type *e_list = NULL; ++ ++ if (errorDescription) ++ errorDescription[0] = 0; ++ ++ if (*definitions != NULL) ++ return ASN1_ELEMENT_NOT_EMPTY; ++ ++ move = UP; ++ ++ for (k = 0; array[k].value || array[k].type || array[k].name; k++) ++ { ++ type = convert_old_type (array[k].type); ++ ++ p = _asn1_add_static_node (&e_list, type & (~CONST_DOWN)); ++ if (array[k].name) ++ _asn1_set_name (p, array[k].name); ++ if (array[k].value) ++ _asn1_set_value (p, array[k].value, strlen (array[k].value) + 1); ++ ++ if (*definitions == NULL) ++ *definitions = p; ++ ++ if (move == DOWN) ++ { ++ if (p_last && p_last->down) ++ _asn1_delete_structure (e_list, &p_last->down, 0); ++ _asn1_set_down (p_last, p); ++ } ++ else if (move == RIGHT) ++ { ++ if (p_last && p_last->right) ++ _asn1_delete_structure (e_list, &p_last->right, 0); ++ _asn1_set_right (p_last, p); ++ } ++ ++ p_last = p; ++ ++ if (type & CONST_DOWN) ++ move = DOWN; ++ else if (type & CONST_RIGHT) ++ move = RIGHT; ++ else ++ { ++ while (p_last != *definitions) ++ { ++ p_last = _asn1_find_up (p_last); ++ ++ if (p_last == NULL) ++ break; ++ ++ if (p_last->type & CONST_RIGHT) ++ { ++ p_last->type &= ~CONST_RIGHT; ++ move = RIGHT; ++ break; ++ } ++ } /* while */ ++ } ++ } /* while */ ++ ++ if (p_last == *definitions) ++ { ++ result = _asn1_check_identifier (*definitions); ++ if (result == ASN1_SUCCESS) ++ { ++ _asn1_change_integer_value (*definitions); ++ result = _asn1_expand_object_id (&e_list, *definitions); ++ } ++ } ++ else ++ { ++ result = ASN1_ARRAY_ERROR; ++ } ++ ++ if (errorDescription != NULL) ++ { ++ if (result == ASN1_IDENTIFIER_NOT_FOUND) ++ { ++ Estrcpy (errorDescription, ":: identifier '"); ++ Estrcat (errorDescription, _asn1_identifierMissing); ++ Estrcat (errorDescription, "' not found"); ++ } ++ else ++ errorDescription[0] = 0; ++ } ++ ++ if (result != ASN1_SUCCESS) ++ { ++ _asn1_delete_list_and_nodes (e_list); ++ *definitions = NULL; ++ } ++ else ++ _asn1_delete_list (e_list); ++ ++ return result; ++} ++ ++/** ++ * asn1_delete_structure: ++ * @structure: pointer to the structure that you want to delete. ++ * ++ * Deletes the structure *@structure. At the end, *@structure is set ++ * to NULL. ++ * ++ * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if ++ * *@structure was NULL. ++ **/ ++int ++asn1_delete_structure (asn1_node * structure) ++{ ++ return _asn1_delete_structure (NULL, structure, 0); ++} ++ ++/** ++ * asn1_delete_structure2: ++ * @structure: pointer to the structure that you want to delete. ++ * @flags: additional flags (see %ASN1_DELETE_FLAG) ++ * ++ * Deletes the structure *@structure. At the end, *@structure is set ++ * to NULL. ++ * ++ * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if ++ * *@structure was NULL. ++ **/ ++int ++asn1_delete_structure2 (asn1_node * structure, unsigned int flags) ++{ ++ return _asn1_delete_structure (NULL, structure, flags); ++} ++ ++int ++_asn1_delete_structure (list_type *e_list, asn1_node * structure, unsigned int flags) ++{ ++ asn1_node p, p2, p3; ++ ++ if (*structure == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = *structure; ++ while (p) ++ { ++ if (p->down) ++ { ++ p = p->down; ++ } ++ else ++ { /* no down */ ++ p2 = p->right; ++ if (p != *structure) ++ { ++ p3 = _asn1_find_up (p); ++ _asn1_set_down (p3, p2); ++ if (e_list) ++ _asn1_delete_node_from_list (e_list, p); ++ _asn1_remove_node (p, flags); ++ p = p3; ++ } ++ else ++ { /* p==root */ ++ p3 = _asn1_find_left (p); ++ if (!p3) ++ { ++ p3 = _asn1_find_up (p); ++ if (p3) ++ _asn1_set_down (p3, p2); ++ else ++ { ++ if (p->right) ++ p->right->left = NULL; ++ } ++ } ++ else ++ _asn1_set_right (p3, p2); ++ if (e_list) ++ _asn1_delete_node_from_list (e_list, p); ++ _asn1_remove_node (p, flags); ++ p = NULL; ++ } ++ } ++ } ++ ++ *structure = NULL; ++ return ASN1_SUCCESS; ++} ++ ++ ++/** ++ * asn1_delete_element: ++ * @structure: pointer to the structure that contains the element you ++ * want to delete. ++ * @element_name: element's name you want to delete. ++ * ++ * Deletes the element named *@element_name inside *@structure. ++ * ++ * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if ++ * the @element_name was not found. ++ **/ ++int ++asn1_delete_element (asn1_node structure, const char *element_name) ++{ ++ asn1_node p2, p3, source_node; ++ ++ source_node = asn1_find_node (structure, element_name); ++ ++ if (source_node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p2 = source_node->right; ++ p3 = _asn1_find_left (source_node); ++ if (!p3) ++ { ++ p3 = _asn1_find_up (source_node); ++ if (p3) ++ _asn1_set_down (p3, p2); ++ else if (source_node->right) ++ source_node->right->left = NULL; ++ } ++ else ++ _asn1_set_right (p3, p2); ++ ++ return asn1_delete_structure (&source_node); ++} ++ ++#ifndef __clang_analyzer__ ++asn1_node ++_asn1_copy_structure3 (asn1_node_const source_node) ++{ ++ asn1_node_const p_s; ++ asn1_node dest_node, p_d, p_d_prev; ++ int move; ++ ++ if (source_node == NULL) ++ return NULL; ++ ++ dest_node = _asn1_add_single_node (source_node->type); ++ ++ p_s = source_node; ++ p_d = dest_node; ++ ++ move = DOWN; ++ ++ do ++ { ++ if (move != UP) ++ { ++ if (p_s->name[0] != 0) ++ _asn1_cpy_name (p_d, p_s); ++ if (p_s->value) ++ _asn1_set_value (p_d, p_s->value, p_s->value_len); ++ if (p_s->down) ++ { ++ p_s = p_s->down; ++ p_d_prev = p_d; ++ p_d = _asn1_add_single_node (p_s->type); ++ _asn1_set_down (p_d_prev, p_d); ++ continue; ++ } ++ p_d->start = p_s->start; ++ p_d->end = p_s->end; ++ } ++ ++ if (p_s == source_node) ++ break; ++ ++ if (p_s->right) ++ { ++ move = RIGHT; ++ p_s = p_s->right; ++ p_d_prev = p_d; ++ p_d = _asn1_add_single_node (p_s->type); ++ _asn1_set_right (p_d_prev, p_d); ++ } ++ else ++ { ++ move = UP; ++ p_s = _asn1_find_up (p_s); ++ p_d = _asn1_find_up (p_d); ++ } ++ } ++ while (p_s != source_node); ++ return dest_node; ++} ++#else ++ ++/* Non-production code */ ++asn1_node ++_asn1_copy_structure3 (asn1_node_const source_node) ++{ ++ return NULL; ++} ++#endif /* __clang_analyzer__ */ ++ ++ ++static asn1_node ++_asn1_copy_structure2 (asn1_node_const root, const char *source_name) ++{ ++ asn1_node source_node; ++ ++ source_node = asn1_find_node (root, source_name); ++ ++ return _asn1_copy_structure3 (source_node); ++ ++} ++ ++ ++static int ++_asn1_type_choice_config (asn1_node node) ++{ ++ asn1_node p, p2, p3, p4; ++ int move, tlen; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = node; ++ move = DOWN; ++ ++ while (!((p == node) && (move == UP))) ++ { ++ if (move != UP) ++ { ++ if ((type_field (p->type) == ASN1_ETYPE_CHOICE) ++ && (p->type & CONST_TAG)) ++ { ++ p2 = p->down; ++ while (p2) ++ { ++ if (type_field (p2->type) != ASN1_ETYPE_TAG) ++ { ++ p2->type |= CONST_TAG; ++ p3 = _asn1_find_left (p2); ++ while (p3) ++ { ++ if (type_field (p3->type) == ASN1_ETYPE_TAG) ++ { ++ p4 = _asn1_add_single_node (p3->type); ++ tlen = _asn1_strlen (p3->value); ++ if (tlen > 0) ++ _asn1_set_value (p4, p3->value, tlen + 1); ++ _asn1_set_right (p4, p2->down); ++ _asn1_set_down (p2, p4); ++ } ++ p3 = _asn1_find_left (p3); ++ } ++ } ++ p2 = p2->right; ++ } ++ p->type &= ~(CONST_TAG); ++ p2 = p->down; ++ while (p2) ++ { ++ p3 = p2->right; ++ if (type_field (p2->type) == ASN1_ETYPE_TAG) ++ asn1_delete_structure (&p2); ++ p2 = p3; ++ } ++ } ++ move = DOWN; ++ } ++ else ++ move = RIGHT; ++ ++ if (move == DOWN) ++ { ++ if (p->down) ++ p = p->down; ++ else ++ move = RIGHT; ++ } ++ ++ if (p == node) ++ { ++ move = UP; ++ continue; ++ } ++ ++ if (move == RIGHT) ++ { ++ if (p->right) ++ p = p->right; ++ else ++ move = UP; ++ } ++ if (move == UP) ++ p = _asn1_find_up (p); ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++static int ++_asn1_expand_identifier (asn1_node * node, asn1_node_const root) ++{ ++ asn1_node p, p2, p3; ++ char name2[ASN1_MAX_NAME_SIZE + 2]; ++ int move; ++ ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = *node; ++ move = DOWN; ++ ++ while (!((p == *node) && (move == UP))) ++ { ++ if (move != UP) ++ { ++ if (type_field (p->type) == ASN1_ETYPE_IDENTIFIER) ++ { ++ snprintf (name2, sizeof (name2), "%s.%s", root->name, p->value); ++ p2 = _asn1_copy_structure2 (root, name2); ++ if (p2 == NULL) ++ { ++ return ASN1_IDENTIFIER_NOT_FOUND; ++ } ++ _asn1_cpy_name (p2, p); ++ p2->right = p->right; ++ p2->left = p->left; ++ if (p->right) ++ p->right->left = p2; ++ p3 = p->down; ++ if (p3) ++ { ++ while (p3->right) ++ p3 = p3->right; ++ _asn1_set_right (p3, p2->down); ++ _asn1_set_down (p2, p->down); ++ } ++ ++ p3 = _asn1_find_left (p); ++ if (p3) ++ _asn1_set_right (p3, p2); ++ else ++ { ++ p3 = _asn1_find_up (p); ++ if (p3) ++ _asn1_set_down (p3, p2); ++ else ++ { ++ p2->left = NULL; ++ } ++ } ++ ++ if (p->type & CONST_SIZE) ++ p2->type |= CONST_SIZE; ++ if (p->type & CONST_TAG) ++ p2->type |= CONST_TAG; ++ if (p->type & CONST_OPTION) ++ p2->type |= CONST_OPTION; ++ if (p->type & CONST_DEFAULT) ++ p2->type |= CONST_DEFAULT; ++ if (p->type & CONST_SET) ++ p2->type |= CONST_SET; ++ if (p->type & CONST_NOT_USED) ++ p2->type |= CONST_NOT_USED; ++ ++ if (p == *node) ++ *node = p2; ++ _asn1_remove_node (p, 0); ++ p = p2; ++ move = DOWN; ++ continue; ++ } ++ move = DOWN; ++ } ++ else ++ move = RIGHT; ++ ++ if (move == DOWN) ++ { ++ if (p->down) ++ p = p->down; ++ else ++ move = RIGHT; ++ } ++ ++ if (p == *node) ++ { ++ move = UP; ++ continue; ++ } ++ ++ if (move == RIGHT) ++ { ++ if (p->right) ++ p = p->right; ++ else ++ move = UP; ++ } ++ if (move == UP) ++ p = _asn1_find_up (p); ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/** ++ * asn1_create_element: ++ * @definitions: pointer to the structure returned by "parser_asn1" function ++ * @source_name: the name of the type of the new structure (must be ++ * inside p_structure). ++ * @element: pointer to the structure created. ++ * ++ * Creates a structure of type @source_name. Example using ++ * "pkix.asn": ++ * ++ * rc = asn1_create_element(cert_def, "PKIX1.Certificate", certptr); ++ * ++ * Returns: %ASN1_SUCCESS if creation OK, %ASN1_ELEMENT_NOT_FOUND if ++ * @source_name is not known. ++ **/ ++int ++asn1_create_element (asn1_node_const definitions, const char *source_name, ++ asn1_node * element) ++{ ++ asn1_node dest_node; ++ int res; ++ ++ dest_node = _asn1_copy_structure2 (definitions, source_name); ++ ++ if (dest_node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ _asn1_set_name (dest_node, ""); ++ ++ res = _asn1_expand_identifier (&dest_node, definitions); ++ _asn1_type_choice_config (dest_node); ++ ++ *element = dest_node; ++ ++ return res; ++} ++ ++ ++/** ++ * asn1_print_structure: ++ * @out: pointer to the output file (e.g. stdout). ++ * @structure: pointer to the structure that you want to visit. ++ * @name: an element of the structure ++ * @mode: specify how much of the structure to print, can be ++ * %ASN1_PRINT_NAME, %ASN1_PRINT_NAME_TYPE, ++ * %ASN1_PRINT_NAME_TYPE_VALUE, or %ASN1_PRINT_ALL. ++ * ++ * Prints on the @out file descriptor the structure's tree starting ++ * from the @name element inside the structure @structure. ++ **/ ++void ++asn1_print_structure (FILE * out, asn1_node_const structure, const char *name, ++ int mode) ++{ ++ asn1_node_const p, root; ++ int k, indent = 0, len, len2, len3; ++ ++ if (out == NULL) ++ return; ++ ++ root = asn1_find_node (structure, name); ++ ++ if (root == NULL) ++ return; ++ ++ p = root; ++ while (p) ++ { ++ if (mode == ASN1_PRINT_ALL) ++ { ++ for (k = 0; k < indent; k++) ++ fprintf (out, " "); ++ fprintf (out, "name:"); ++ if (p->name[0] != 0) ++ fprintf (out, "%s ", p->name); ++ else ++ fprintf (out, "NULL "); ++ } ++ else ++ { ++ switch (type_field (p->type)) ++ { ++ case ASN1_ETYPE_CONSTANT: ++ case ASN1_ETYPE_TAG: ++ case ASN1_ETYPE_SIZE: ++ break; ++ default: ++ for (k = 0; k < indent; k++) ++ fprintf (out, " "); ++ fprintf (out, "name:"); ++ if (p->name[0] != 0) ++ fprintf (out, "%s ", p->name); ++ else ++ fprintf (out, "NULL "); ++ } ++ } ++ ++ if (mode != ASN1_PRINT_NAME) ++ { ++ unsigned type = type_field (p->type); ++ switch (type) ++ { ++ case ASN1_ETYPE_CONSTANT: ++ if (mode == ASN1_PRINT_ALL) ++ fprintf (out, "type:CONST"); ++ break; ++ case ASN1_ETYPE_TAG: ++ if (mode == ASN1_PRINT_ALL) ++ fprintf (out, "type:TAG"); ++ break; ++ case ASN1_ETYPE_SIZE: ++ if (mode == ASN1_PRINT_ALL) ++ fprintf (out, "type:SIZE"); ++ break; ++ case ASN1_ETYPE_DEFAULT: ++ fprintf (out, "type:DEFAULT"); ++ break; ++ case ASN1_ETYPE_IDENTIFIER: ++ fprintf (out, "type:IDENTIFIER"); ++ break; ++ case ASN1_ETYPE_ANY: ++ fprintf (out, "type:ANY"); ++ break; ++ case ASN1_ETYPE_CHOICE: ++ fprintf (out, "type:CHOICE"); ++ break; ++ case ASN1_ETYPE_DEFINITIONS: ++ fprintf (out, "type:DEFINITIONS"); ++ break; ++ CASE_HANDLED_ETYPES: ++ fprintf (out, "%s", _asn1_tags[type].desc); ++ break; ++ default: ++ break; ++ } ++ } ++ ++ if ((mode == ASN1_PRINT_NAME_TYPE_VALUE) || (mode == ASN1_PRINT_ALL)) ++ { ++ switch (type_field (p->type)) ++ { ++ case ASN1_ETYPE_CONSTANT: ++ if (mode == ASN1_PRINT_ALL) ++ if (p->value) ++ fprintf (out, " value:%s", p->value); ++ break; ++ case ASN1_ETYPE_TAG: ++ if (mode == ASN1_PRINT_ALL) ++ if (p->value) ++ fprintf (out, " value:%s", p->value); ++ break; ++ case ASN1_ETYPE_SIZE: ++ if (mode == ASN1_PRINT_ALL) ++ if (p->value) ++ fprintf (out, " value:%s", p->value); ++ break; ++ case ASN1_ETYPE_DEFAULT: ++ if (p->value) ++ fprintf (out, " value:%s", p->value); ++ else if (p->type & CONST_TRUE) ++ fprintf (out, " value:TRUE"); ++ else if (p->type & CONST_FALSE) ++ fprintf (out, " value:FALSE"); ++ break; ++ case ASN1_ETYPE_IDENTIFIER: ++ if (p->value) ++ fprintf (out, " value:%s", p->value); ++ break; ++ case ASN1_ETYPE_INTEGER: ++ if (p->value) ++ { ++ len2 = -1; ++ len = asn1_get_length_der (p->value, p->value_len, &len2); ++ fprintf (out, " value:0x"); ++ if (len > 0) ++ for (k = 0; k < len; k++) ++ fprintf (out, "%02x", (unsigned) (p->value)[k + len2]); ++ } ++ break; ++ case ASN1_ETYPE_ENUMERATED: ++ if (p->value) ++ { ++ len2 = -1; ++ len = asn1_get_length_der (p->value, p->value_len, &len2); ++ fprintf (out, " value:0x"); ++ if (len > 0) ++ for (k = 0; k < len; k++) ++ fprintf (out, "%02x", (unsigned) (p->value)[k + len2]); ++ } ++ break; ++ case ASN1_ETYPE_BOOLEAN: ++ if (p->value) ++ { ++ if (p->value[0] == 'T') ++ fprintf (out, " value:TRUE"); ++ else if (p->value[0] == 'F') ++ fprintf (out, " value:FALSE"); ++ } ++ break; ++ case ASN1_ETYPE_BIT_STRING: ++ if (p->value) ++ { ++ len2 = -1; ++ len = asn1_get_length_der (p->value, p->value_len, &len2); ++ if (len > 0) ++ { ++ fprintf (out, " value(%i):", ++ (len - 1) * 8 - (p->value[len2])); ++ for (k = 1; k < len; k++) ++ fprintf (out, "%02x", (unsigned) (p->value)[k + len2]); ++ } ++ } ++ break; ++ case ASN1_ETYPE_GENERALIZED_TIME: ++ case ASN1_ETYPE_UTC_TIME: ++ if (p->value) ++ { ++ fprintf (out, " value:"); ++ for (k = 0; k < p->value_len; k++) ++ fprintf (out, "%c", (p->value)[k]); ++ } ++ break; ++ case ASN1_ETYPE_GENERALSTRING: ++ case ASN1_ETYPE_NUMERIC_STRING: ++ case ASN1_ETYPE_IA5_STRING: ++ case ASN1_ETYPE_TELETEX_STRING: ++ case ASN1_ETYPE_PRINTABLE_STRING: ++ case ASN1_ETYPE_UNIVERSAL_STRING: ++ case ASN1_ETYPE_UTF8_STRING: ++ case ASN1_ETYPE_VISIBLE_STRING: ++ if (p->value) ++ { ++ len2 = -1; ++ len = asn1_get_length_der (p->value, p->value_len, &len2); ++ fprintf (out, " value:"); ++ if (len > 0) ++ for (k = 0; k < len; k++) ++ fprintf (out, "%c", (p->value)[k + len2]); ++ } ++ break; ++ case ASN1_ETYPE_BMP_STRING: ++ case ASN1_ETYPE_OCTET_STRING: ++ if (p->value) ++ { ++ len2 = -1; ++ len = asn1_get_length_der (p->value, p->value_len, &len2); ++ fprintf (out, " value:"); ++ if (len > 0) ++ for (k = 0; k < len; k++) ++ fprintf (out, "%02x", (unsigned) (p->value)[k + len2]); ++ } ++ break; ++ case ASN1_ETYPE_OBJECT_ID: ++ if (p->value) ++ fprintf (out, " value:%s", p->value); ++ break; ++ case ASN1_ETYPE_ANY: ++ if (p->value) ++ { ++ len3 = -1; ++ len2 = asn1_get_length_der (p->value, p->value_len, &len3); ++ fprintf (out, " value:"); ++ if (len2 > 0) ++ for (k = 0; k < len2; k++) ++ fprintf (out, "%02x", (unsigned) (p->value)[k + len3]); ++ } ++ break; ++ case ASN1_ETYPE_SET: ++ case ASN1_ETYPE_SET_OF: ++ case ASN1_ETYPE_CHOICE: ++ case ASN1_ETYPE_DEFINITIONS: ++ case ASN1_ETYPE_SEQUENCE_OF: ++ case ASN1_ETYPE_SEQUENCE: ++ case ASN1_ETYPE_NULL: ++ break; ++ default: ++ break; ++ } ++ } ++ ++ if (mode == ASN1_PRINT_ALL) ++ { ++ if (p->type & 0x1FFFFF00) ++ { ++ fprintf (out, " attr:"); ++ if (p->type & CONST_UNIVERSAL) ++ fprintf (out, "UNIVERSAL,"); ++ if (p->type & CONST_PRIVATE) ++ fprintf (out, "PRIVATE,"); ++ if (p->type & CONST_APPLICATION) ++ fprintf (out, "APPLICATION,"); ++ if (p->type & CONST_EXPLICIT) ++ fprintf (out, "EXPLICIT,"); ++ if (p->type & CONST_IMPLICIT) ++ fprintf (out, "IMPLICIT,"); ++ if (p->type & CONST_TAG) ++ fprintf (out, "TAG,"); ++ if (p->type & CONST_DEFAULT) ++ fprintf (out, "DEFAULT,"); ++ if (p->type & CONST_TRUE) ++ fprintf (out, "TRUE,"); ++ if (p->type & CONST_FALSE) ++ fprintf (out, "FALSE,"); ++ if (p->type & CONST_LIST) ++ fprintf (out, "LIST,"); ++ if (p->type & CONST_MIN_MAX) ++ fprintf (out, "MIN_MAX,"); ++ if (p->type & CONST_OPTION) ++ fprintf (out, "OPTION,"); ++ if (p->type & CONST_1_PARAM) ++ fprintf (out, "1_PARAM,"); ++ if (p->type & CONST_SIZE) ++ fprintf (out, "SIZE,"); ++ if (p->type & CONST_DEFINED_BY) ++ fprintf (out, "DEF_BY,"); ++ if (p->type & CONST_GENERALIZED) ++ fprintf (out, "GENERALIZED,"); ++ if (p->type & CONST_UTC) ++ fprintf (out, "UTC,"); ++ if (p->type & CONST_SET) ++ fprintf (out, "SET,"); ++ if (p->type & CONST_NOT_USED) ++ fprintf (out, "NOT_USED,"); ++ if (p->type & CONST_ASSIGN) ++ fprintf (out, "ASSIGNMENT,"); ++ } ++ } ++ ++ if (mode == ASN1_PRINT_ALL) ++ { ++ fprintf (out, "\n"); ++ } ++ else ++ { ++ switch (type_field (p->type)) ++ { ++ case ASN1_ETYPE_CONSTANT: ++ case ASN1_ETYPE_TAG: ++ case ASN1_ETYPE_SIZE: ++ break; ++ default: ++ fprintf (out, "\n"); ++ } ++ } ++ ++ if (p->down) ++ { ++ p = p->down; ++ indent += 2; ++ } ++ else if (p == root) ++ { ++ p = NULL; ++ break; ++ } ++ else if (p->right) ++ p = p->right; ++ else ++ { ++ while (1) ++ { ++ p = _asn1_find_up (p); ++ if (p == root) ++ { ++ p = NULL; ++ break; ++ } ++ indent -= 2; ++ if (p->right) ++ { ++ p = p->right; ++ break; ++ } ++ } ++ } ++ } ++} ++ ++ ++ ++/** ++ * asn1_number_of_elements: ++ * @element: pointer to the root of an ASN1 structure. ++ * @name: the name of a sub-structure of ROOT. ++ * @num: pointer to an integer where the result will be stored ++ * ++ * Counts the number of elements of a sub-structure called NAME with ++ * names equal to "?1","?2", ... ++ * ++ * Returns: %ASN1_SUCCESS if successful, %ASN1_ELEMENT_NOT_FOUND if ++ * @name is not known, %ASN1_GENERIC_ERROR if pointer @num is %NULL. ++ **/ ++int ++asn1_number_of_elements (asn1_node_const element, const char *name, int *num) ++{ ++ asn1_node_const node, p; ++ ++ if (num == NULL) ++ return ASN1_GENERIC_ERROR; ++ ++ *num = 0; ++ ++ node = asn1_find_node (element, name); ++ if (node == NULL) ++ return ASN1_ELEMENT_NOT_FOUND; ++ ++ p = node->down; ++ ++ while (p) ++ { ++ if (p->name[0] == '?') ++ (*num)++; ++ p = p->right; ++ } ++ ++ return ASN1_SUCCESS; ++} ++ ++ ++/** ++ * asn1_find_structure_from_oid: ++ * @definitions: ASN1 definitions ++ * @oidValue: value of the OID to search (e.g. "1.2.3.4"). ++ * ++ * Search the structure that is defined just after an OID definition. ++ * ++ * Returns: %NULL when @oidValue not found, otherwise the pointer to a ++ * constant string that contains the element name defined just after ++ * the OID. ++ **/ ++const char * ++asn1_find_structure_from_oid (asn1_node_const definitions, const char *oidValue) ++{ ++ char name[2 * ASN1_MAX_NAME_SIZE + 2]; ++ char value[ASN1_MAX_NAME_SIZE]; ++ asn1_node p; ++ int len; ++ int result; ++ const char *definitionsName; ++ ++ if ((definitions == NULL) || (oidValue == NULL)) ++ return NULL; /* ASN1_ELEMENT_NOT_FOUND; */ ++ ++ definitionsName = definitions->name; ++ ++ /* search the OBJECT_ID into definitions */ ++ p = definitions->down; ++ while (p) ++ { ++ if ((type_field (p->type) == ASN1_ETYPE_OBJECT_ID) && ++ (p->type & CONST_ASSIGN)) ++ { ++ snprintf(name, sizeof(name), "%s.%s", definitionsName, p->name); ++ ++ len = ASN1_MAX_NAME_SIZE; ++ result = asn1_read_value (definitions, name, value, &len); ++ ++ if ((result == ASN1_SUCCESS) && (!strcmp (oidValue, value))) ++ { ++ p = p->right; ++ if (p == NULL) /* reach the end of ASN1 definitions */ ++ return NULL; /* ASN1_ELEMENT_NOT_FOUND; */ ++ ++ return p->name; ++ } ++ } ++ p = p->right; ++ } ++ ++ return NULL; /* ASN1_ELEMENT_NOT_FOUND; */ ++} ++ ++/** ++ * asn1_copy_node: ++ * @dst: Destination asn1 node. ++ * @dst_name: Field name in destination node. ++ * @src: Source asn1 node. ++ * @src_name: Field name in source node. ++ * ++ * Create a deep copy of a asn1_node variable. That ++ * function requires @dst to be expanded using asn1_create_element(). ++ * ++ * Returns: Return %ASN1_SUCCESS on success. ++ **/ ++int ++asn1_copy_node (asn1_node dst, const char *dst_name, ++ asn1_node_const src, const char *src_name) ++{ ++ int result; ++ asn1_node dst_node; ++ void *data = NULL; ++ int size = 0; ++ ++ result = asn1_der_coding (src, src_name, NULL, &size, NULL); ++ if (result != ASN1_MEM_ERROR) ++ return result; ++ ++ data = malloc (size); ++ if (data == NULL) ++ return ASN1_MEM_ERROR; ++ ++ result = asn1_der_coding (src, src_name, data, &size, NULL); ++ if (result != ASN1_SUCCESS) ++ { ++ free (data); ++ return result; ++ } ++ ++ dst_node = asn1_find_node (dst, dst_name); ++ if (dst_node == NULL) ++ { ++ free (data); ++ return ASN1_ELEMENT_NOT_FOUND; ++ } ++ ++ result = asn1_der_decoding (&dst_node, data, size, NULL); ++ ++ free (data); ++ ++ return result; ++} ++ ++/** ++ * asn1_dup_node: ++ * @src: Source asn1 node. ++ * @src_name: Field name in source node. ++ * ++ * Create a deep copy of a asn1_node variable. This function ++ * will return an exact copy of the provided structure. ++ * ++ * Returns: Return %NULL on failure. ++ **/ ++asn1_node ++asn1_dup_node (asn1_node_const src, const char *src_name) ++{ ++ return _asn1_copy_structure2(src, src_name); ++} +diff --git a/grub-core/lib/libtasn1/lib/element.h b/grub-core/lib/libtasn1/lib/element.h +new file mode 100644 +index 00000000000..440a33f4bb1 +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/element.h +@@ -0,0 +1,40 @@ ++/* ++ * Copyright (C) 2000-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++#ifndef _ELEMENT_H ++#define _ELEMENT_H ++ ++ ++struct node_tail_cache_st ++{ ++ asn1_node head; /* the first element of the sequence */ ++ asn1_node tail; ++}; ++ ++int _asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcached); ++ ++int _asn1_convert_integer (const unsigned char *value, ++ unsigned char *value_out, ++ int value_out_size, int *len); ++ ++void _asn1_hierarchical_name (asn1_node_const node, char *name, int name_size); ++ ++#endif +diff --git a/grub-core/lib/libtasn1/lib/gstr.h b/grub-core/lib/libtasn1/lib/gstr.h +new file mode 100644 +index 00000000000..48229844ff3 +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/gstr.h +@@ -0,0 +1,47 @@ ++/* ++ * Copyright (C) 2002-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++#ifndef GSTR_H ++# define GSTR_H ++ ++unsigned int _asn1_str_cpy (char *dest, size_t dest_tot_size, ++ const char *src); ++void _asn1_str_cat (char *dest, size_t dest_tot_size, const char *src); ++ ++#define Estrcpy(x,y) _asn1_str_cpy(x,ASN1_MAX_ERROR_DESCRIPTION_SIZE,y) ++#define Estrcat(x,y) _asn1_str_cat(x,ASN1_MAX_ERROR_DESCRIPTION_SIZE,y) ++ ++inline static ++void safe_memset(void *data, int c, size_t size) ++{ ++ volatile unsigned volatile_zero = 0; ++ volatile char *vdata = (volatile char*)data; ++ ++ /* This is based on a nice trick for safe memset, ++ * sent by David Jacobson in the openssl-dev mailing list. ++ */ ++ ++ if (size > 0) do { ++ memset(data, c, size); ++ } while(vdata[volatile_zero] != c); ++} ++ ++#endif /* GSTR_H */ +diff --git a/grub-core/lib/libtasn1/lib/int.h b/grub-core/lib/libtasn1/lib/int.h +new file mode 100644 +index 00000000000..ea1625786c1 +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/int.h +@@ -0,0 +1,221 @@ ++/* ++ * Copyright (C) 2002-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++#ifndef INT_H ++#define INT_H ++ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ ++#include ++#include ++#include ++#include ++ ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif ++ ++#include ++ ++#define ASN1_SMALL_VALUE_SIZE 16 ++ ++/* This structure is also in libtasn1.h, but then contains less ++ fields. You cannot make any modifications to these first fields ++ without breaking ABI. */ ++struct asn1_node_st ++{ ++ /* public fields: */ ++ char name[ASN1_MAX_NAME_SIZE + 1]; /* Node name */ ++ unsigned int name_hash; ++ unsigned int type; /* Node type */ ++ unsigned char *value; /* Node value */ ++ int value_len; ++ asn1_node down; /* Pointer to the son node */ ++ asn1_node right; /* Pointer to the brother node */ ++ asn1_node left; /* Pointer to the next list element */ ++ /* private fields: */ ++ unsigned char small_value[ASN1_SMALL_VALUE_SIZE]; /* For small values */ ++ ++ /* values used during decoding/coding */ ++ int tmp_ival; ++ unsigned start; /* the start of the DER sequence - if decoded */ ++ unsigned end; /* the end of the DER sequence - if decoded */ ++}; ++ ++typedef struct tag_and_class_st ++{ ++ unsigned tag; ++ unsigned class; ++ const char *desc; ++} tag_and_class_st; ++ ++/* the types that are handled in _asn1_tags */ ++#define CASE_HANDLED_ETYPES \ ++ case ASN1_ETYPE_NULL: \ ++ case ASN1_ETYPE_BOOLEAN: \ ++ case ASN1_ETYPE_INTEGER: \ ++ case ASN1_ETYPE_ENUMERATED: \ ++ case ASN1_ETYPE_OBJECT_ID: \ ++ case ASN1_ETYPE_OCTET_STRING: \ ++ case ASN1_ETYPE_GENERALSTRING: \ ++ case ASN1_ETYPE_NUMERIC_STRING: \ ++ case ASN1_ETYPE_IA5_STRING: \ ++ case ASN1_ETYPE_TELETEX_STRING: \ ++ case ASN1_ETYPE_PRINTABLE_STRING: \ ++ case ASN1_ETYPE_UNIVERSAL_STRING: \ ++ case ASN1_ETYPE_BMP_STRING: \ ++ case ASN1_ETYPE_UTF8_STRING: \ ++ case ASN1_ETYPE_VISIBLE_STRING: \ ++ case ASN1_ETYPE_BIT_STRING: \ ++ case ASN1_ETYPE_SEQUENCE: \ ++ case ASN1_ETYPE_SEQUENCE_OF: \ ++ case ASN1_ETYPE_SET: \ ++ case ASN1_ETYPE_UTC_TIME: \ ++ case ASN1_ETYPE_GENERALIZED_TIME: \ ++ case ASN1_ETYPE_SET_OF ++ ++#define ETYPE_TAG(etype) (_asn1_tags[etype].tag) ++#define ETYPE_CLASS(etype) (_asn1_tags[etype].class) ++#define ETYPE_OK(etype) (((etype) != ASN1_ETYPE_INVALID && \ ++ (etype) <= _asn1_tags_size && \ ++ _asn1_tags[(etype)].desc != NULL)?1:0) ++ ++#define ETYPE_IS_STRING(etype) ((etype == ASN1_ETYPE_GENERALSTRING || \ ++ etype == ASN1_ETYPE_NUMERIC_STRING || etype == ASN1_ETYPE_IA5_STRING || \ ++ etype == ASN1_ETYPE_TELETEX_STRING || etype == ASN1_ETYPE_PRINTABLE_STRING || \ ++ etype == ASN1_ETYPE_UNIVERSAL_STRING || etype == ASN1_ETYPE_BMP_STRING || \ ++ etype == ASN1_ETYPE_UTF8_STRING || etype == ASN1_ETYPE_VISIBLE_STRING || \ ++ etype == ASN1_ETYPE_OCTET_STRING)?1:0) ++ ++extern unsigned int _asn1_tags_size; ++extern const tag_and_class_st _asn1_tags[]; ++ ++#define _asn1_strlen(s) strlen((const char *) s) ++#define _asn1_strtol(n,e,b) strtol((const char *) n, e, b) ++#define _asn1_strtoul(n,e,b) strtoul((const char *) n, e, b) ++#define _asn1_strcmp(a,b) strcmp((const char *)a, (const char *)b) ++#define _asn1_strcpy(a,b) strcpy((char *)a, (const char *)b) ++#define _asn1_strcat(a,b) strcat((char *)a, (const char *)b) ++ ++#if SIZEOF_UNSIGNED_LONG_INT == 8 ++# define _asn1_strtou64(n,e,b) strtoul((const char *) n, e, b) ++#else ++# define _asn1_strtou64(n,e,b) strtoull((const char *) n, e, b) ++#endif ++ ++#define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */ ++ ++/* Define used for visiting trees. */ ++#define UP 1 ++#define RIGHT 2 ++#define DOWN 3 ++ ++/***********************************************************************/ ++/* List of constants to better specify the type of typedef asn1_node_st. */ ++/***********************************************************************/ ++/* Used with TYPE_TAG */ ++#define CONST_UNIVERSAL (1U<<8) ++#define CONST_PRIVATE (1U<<9) ++#define CONST_APPLICATION (1U<<10) ++#define CONST_EXPLICIT (1U<<11) ++#define CONST_IMPLICIT (1U<<12) ++ ++#define CONST_TAG (1U<<13) /* Used in ASN.1 assignement */ ++#define CONST_OPTION (1U<<14) ++#define CONST_DEFAULT (1U<<15) ++#define CONST_TRUE (1U<<16) ++#define CONST_FALSE (1U<<17) ++ ++#define CONST_LIST (1U<<18) /* Used with TYPE_INTEGER and TYPE_BIT_STRING */ ++#define CONST_MIN_MAX (1U<<19) ++ ++#define CONST_1_PARAM (1U<<20) ++ ++#define CONST_SIZE (1U<<21) ++ ++#define CONST_DEFINED_BY (1U<<22) ++ ++/* Those two are deprecated and used for backwards compatibility */ ++#define CONST_GENERALIZED (1U<<23) ++#define CONST_UTC (1U<<24) ++ ++/* #define CONST_IMPORTS (1U<<25) */ ++ ++#define CONST_NOT_USED (1U<<26) ++#define CONST_SET (1U<<27) ++#define CONST_ASSIGN (1U<<28) ++ ++#define CONST_DOWN (1U<<29) ++#define CONST_RIGHT (1U<<30) ++ ++ ++#define ASN1_ETYPE_TIME 17 ++/****************************************/ ++/* Returns the first 8 bits. */ ++/* Used with the field type of asn1_node_st */ ++/****************************************/ ++inline static unsigned int ++type_field (unsigned int ntype) ++{ ++ return (ntype & 0xff); ++} ++ ++/* To convert old types from a static structure */ ++inline static unsigned int ++convert_old_type (unsigned int ntype) ++{ ++ unsigned int type = ntype & 0xff; ++ if (type == ASN1_ETYPE_TIME) ++ { ++ if (ntype & CONST_UTC) ++ type = ASN1_ETYPE_UTC_TIME; ++ else ++ type = ASN1_ETYPE_GENERALIZED_TIME; ++ ++ ntype &= ~(CONST_UTC | CONST_GENERALIZED); ++ ntype &= 0xffffff00; ++ ntype |= type; ++ ++ return ntype; ++ } ++ else ++ return ntype; ++} ++ ++static inline ++void *_asn1_realloc(void *ptr, size_t size) ++{ ++ void *ret; ++ ++ if (size == 0) ++ return ptr; ++ ++ ret = realloc(ptr, size); ++ if (ret == NULL) ++ { ++ free(ptr); ++ } ++ return ret; ++} ++ ++#endif /* INT_H */ +diff --git a/grub-core/lib/libtasn1/lib/parser_aux.h b/grub-core/lib/libtasn1/lib/parser_aux.h +new file mode 100644 +index 00000000000..598e684b355 +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/parser_aux.h +@@ -0,0 +1,172 @@ ++/* ++ * Copyright (C) 2000-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++#ifndef _PARSER_AUX_H ++#define _PARSER_AUX_H ++ ++/***********************************************/ ++/* Type: list_type */ ++/* Description: type used in the list during */ ++/* the structure creation. */ ++/***********************************************/ ++typedef struct list_struct ++{ ++ asn1_node node; ++ struct list_struct *next; ++} list_type; ++ ++/***************************************/ ++/* Functions used by ASN.1 parser */ ++/***************************************/ ++asn1_node _asn1_add_static_node (list_type **e_list, unsigned int type); ++ ++void _asn1_delete_list (list_type *e_list); ++ ++void _asn1_delete_list_and_nodes (list_type *e_list); ++ ++void _asn1_delete_node_from_list (list_type *list, asn1_node node); ++ ++asn1_node ++_asn1_set_value (asn1_node node, const void *value, unsigned int len); ++ ++asn1_node _asn1_set_value_m (asn1_node node, void *value, unsigned int len); ++ ++asn1_node ++_asn1_set_value_lv (asn1_node node, const void *value, unsigned int len); ++ ++asn1_node ++_asn1_append_value (asn1_node node, const void *value, unsigned int len); ++ ++asn1_node _asn1_set_name (asn1_node node, const char *name); ++ ++asn1_node _asn1_cpy_name (asn1_node dst, asn1_node_const src); ++ ++asn1_node _asn1_set_right (asn1_node node, asn1_node right); ++ ++asn1_node _asn1_get_last_right (asn1_node_const node); ++ ++void _asn1_remove_node (asn1_node node, unsigned int flags); ++ ++/* Max 64-bit integer length is 20 chars + 1 for sign + 1 for null termination */ ++#define LTOSTR_MAX_SIZE 22 ++char *_asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]); ++ ++asn1_node _asn1_find_up (asn1_node_const node); ++ ++int _asn1_change_integer_value (asn1_node node); ++ ++#define EXPAND_OBJECT_ID_MAX_RECURSION 16 ++int _asn1_expand_object_id (list_type **list, asn1_node node); ++ ++int _asn1_type_set_config (asn1_node node); ++ ++int _asn1_check_identifier (asn1_node_const node); ++ ++int _asn1_set_default_tag (asn1_node node); ++ ++/******************************************************************/ ++/* Function : _asn1_get_right */ ++/* Description: returns the element pointed by the RIGHT field of */ ++/* a NODE_ASN element. */ ++/* Parameters: */ ++/* node: NODE_ASN element pointer. */ ++/* Return: field RIGHT of NODE. */ ++/******************************************************************/ ++inline static asn1_node ++_asn1_get_right (asn1_node_const node) ++{ ++ if (node == NULL) ++ return NULL; ++ return node->right; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_set_down */ ++/* Description: sets the field DOWN in a NODE_ASN element. */ ++/* Parameters: */ ++/* node: element pointer. */ ++/* down: pointer to a NODE_ASN element that you want be pointed */ ++/* by NODE. */ ++/* Return: pointer to *NODE. */ ++/******************************************************************/ ++inline static asn1_node ++_asn1_set_down (asn1_node node, asn1_node down) ++{ ++ if (node == NULL) ++ return node; ++ node->down = down; ++ if (down) ++ down->left = node; ++ return node; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_get_down */ ++/* Description: returns the element pointed by the DOWN field of */ ++/* a NODE_ASN element. */ ++/* Parameters: */ ++/* node: NODE_ASN element pointer. */ ++/* Return: field DOWN of NODE. */ ++/******************************************************************/ ++inline static asn1_node ++_asn1_get_down (asn1_node_const node) ++{ ++ if (node == NULL) ++ return NULL; ++ return node->down; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_get_name */ ++/* Description: returns the name of a NODE_ASN element. */ ++/* Parameters: */ ++/* node: NODE_ASN element pointer. */ ++/* Return: a null terminated string. */ ++/******************************************************************/ ++inline static char * ++_asn1_get_name (asn1_node_const node) ++{ ++ if (node == NULL) ++ return NULL; ++ return (char *) node->name; ++} ++ ++/******************************************************************/ ++/* Function : _asn1_mod_type */ ++/* Description: change the field TYPE of an NODE_ASN element. */ ++/* The new value is the old one | (bitwise or) the */ ++/* paramener VALUE. */ ++/* Parameters: */ ++/* node: NODE_ASN element pointer. */ ++/* value: the integer value that must be or-ed with the current */ ++/* value of field TYPE. */ ++/* Return: NODE pointer. */ ++/******************************************************************/ ++inline static asn1_node ++_asn1_mod_type (asn1_node node, unsigned int value) ++{ ++ if (node == NULL) ++ return node; ++ node->type |= value; ++ return node; ++} ++ ++#endif +diff --git a/grub-core/lib/libtasn1/lib/structure.h b/grub-core/lib/libtasn1/lib/structure.h +new file mode 100644 +index 00000000000..99e685da07a +--- /dev/null ++++ b/grub-core/lib/libtasn1/lib/structure.h +@@ -0,0 +1,45 @@ ++/* ++ * Copyright (C) 2002-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * The LIBTASN1 library is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ */ ++ ++/*************************************************/ ++/* File: structure.h */ ++/* Description: list of exported object by */ ++/* "structure.c" */ ++/*************************************************/ ++ ++#ifndef _STRUCTURE_H ++#define _STRUCTURE_H ++ ++#include "parser_aux.h" // list_type ++ ++int _asn1_create_static_structure (asn1_node_const pointer, ++ char *output_file_name, char *vector_name); ++ ++asn1_node _asn1_copy_structure3 (asn1_node_const source_node); ++ ++asn1_node _asn1_add_single_node (unsigned int type); ++ ++asn1_node _asn1_find_left (asn1_node_const node); ++ ++int ++_asn1_delete_structure (list_type *e_list, asn1_node *structure, unsigned int flags); ++ ++#endif +diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h +new file mode 100644 +index 00000000000..6fd7a30dc35 +--- /dev/null ++++ b/include/grub/libtasn1.h +@@ -0,0 +1,588 @@ ++/* ++ * Copyright (C) 2002-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * LIBTASN1 is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU Lesser General Public License as ++ * published by the Free Software Foundation; either version 2.1 of ++ * the License, or (at your option) any later version. ++ * ++ * LIBTASN1 is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with LIBTASN1; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ++ * 02110-1301, USA ++ * ++ */ ++ ++/** ++ * libtasn1:Short_Description: ++ * ++ * GNU ASN.1 library ++ */ ++/** ++ * libtasn1:Long_Description: ++ * ++ * The Libtasn1 library provides Abstract Syntax Notation One (ASN.1, as ++ * specified by the X.680 ITU-T recommendation) parsing and structures ++ * management, and Distinguished Encoding Rules (DER, as per X.690) ++ * encoding and decoding functions. ++ */ ++ ++ ++#ifndef LIBTASN1_H ++#define LIBTASN1_H ++ ++#ifndef ASN1_API ++#if defined ASN1_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY ++#define ASN1_API __attribute__((__visibility__("default"))) ++#elif defined ASN1_BUILDING && defined _MSC_VER && ! defined ASN1_STATIC ++#define ASN1_API __declspec(dllexport) ++#elif defined _MSC_VER && ! defined ASN1_STATIC ++#define ASN1_API __declspec(dllimport) ++#else ++#define ASN1_API ++#endif ++#endif ++ ++#ifdef __GNUC__ ++# define __LIBTASN1_CONST__ __attribute__((const)) ++# define __LIBTASN1_PURE__ __attribute__((pure)) ++#else ++# define __LIBTASN1_CONST__ ++# define __LIBTASN1_PURE__ ++#endif ++ ++#include ++#include ++#include /* for FILE* */ ++ ++#ifdef __cplusplus ++extern "C" ++{ ++#endif ++ ++/** ++ * ASN1_VERSION: ++ * ++ * Version of the library as a string. ++ */ ++#define ASN1_VERSION "4.16.0" ++ ++/** ++ * ASN1_VERSION_MAJOR: ++ * ++ * Major version number of the library. ++ */ ++#define ASN1_VERSION_MAJOR 4 ++ ++/** ++ * ASN1_VERSION_MINOR: ++ * ++ * Minor version number of the library. ++ */ ++#define ASN1_VERSION_MINOR 16 ++ ++/** ++ * ASN1_VERSION_PATCH: ++ * ++ * Patch version number of the library. ++ */ ++#define ASN1_VERSION_PATCH 0 ++ ++/** ++ * ASN1_VERSION_NUMBER: ++ * ++ * Version number of the library as a number. ++ */ ++#define ASN1_VERSION_NUMBER 0x041000 ++ ++ ++#if defined __GNUC__ && !defined ASN1_INTERNAL_BUILD ++# define _ASN1_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) ++# if _ASN1_GCC_VERSION >= 30100 ++# define _ASN1_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__)) ++# endif ++#endif ++ ++#ifndef _ASN1_GCC_ATTR_DEPRECATED ++#define _ASN1_GCC_ATTR_DEPRECATED ++#endif ++ ++/*****************************************/ ++/* Errors returned by libtasn1 functions */ ++/*****************************************/ ++#define ASN1_SUCCESS 0 ++#define ASN1_FILE_NOT_FOUND 1 ++#define ASN1_ELEMENT_NOT_FOUND 2 ++#define ASN1_IDENTIFIER_NOT_FOUND 3 ++#define ASN1_DER_ERROR 4 ++#define ASN1_VALUE_NOT_FOUND 5 ++#define ASN1_GENERIC_ERROR 6 ++#define ASN1_VALUE_NOT_VALID 7 ++#define ASN1_TAG_ERROR 8 ++#define ASN1_TAG_IMPLICIT 9 ++#define ASN1_ERROR_TYPE_ANY 10 ++#define ASN1_SYNTAX_ERROR 11 ++#define ASN1_MEM_ERROR 12 ++#define ASN1_MEM_ALLOC_ERROR 13 ++#define ASN1_DER_OVERFLOW 14 ++#define ASN1_NAME_TOO_LONG 15 ++#define ASN1_ARRAY_ERROR 16 ++#define ASN1_ELEMENT_NOT_EMPTY 17 ++#define ASN1_TIME_ENCODING_ERROR 18 ++#define ASN1_RECURSION 19 ++ ++/*************************************/ ++/* Constants used in asn1_visit_tree */ ++/*************************************/ ++#define ASN1_PRINT_NAME 1 ++#define ASN1_PRINT_NAME_TYPE 2 ++#define ASN1_PRINT_NAME_TYPE_VALUE 3 ++#define ASN1_PRINT_ALL 4 ++ ++/*****************************************/ ++/* Constants returned by asn1_read_tag */ ++/*****************************************/ ++#define ASN1_CLASS_UNIVERSAL 0x00 /* old: 1 */ ++#define ASN1_CLASS_APPLICATION 0x40 /* old: 2 */ ++#define ASN1_CLASS_CONTEXT_SPECIFIC 0x80 /* old: 3 */ ++#define ASN1_CLASS_PRIVATE 0xC0 /* old: 4 */ ++#define ASN1_CLASS_STRUCTURED 0x20 ++ ++/*****************************************/ ++/* Constants returned by asn1_read_tag */ ++/*****************************************/ ++#define ASN1_TAG_BOOLEAN 0x01 ++#define ASN1_TAG_INTEGER 0x02 ++#define ASN1_TAG_SEQUENCE 0x10 ++#define ASN1_TAG_SET 0x11 ++#define ASN1_TAG_OCTET_STRING 0x04 ++#define ASN1_TAG_BIT_STRING 0x03 ++#define ASN1_TAG_UTCTime 0x17 ++#define ASN1_TAG_GENERALIZEDTime 0x18 ++#define ASN1_TAG_OBJECT_ID 0x06 ++#define ASN1_TAG_ENUMERATED 0x0A ++#define ASN1_TAG_NULL 0x05 ++#define ASN1_TAG_GENERALSTRING 0x1B ++#define ASN1_TAG_NUMERIC_STRING 0x12 ++#define ASN1_TAG_IA5_STRING 0x16 ++#define ASN1_TAG_TELETEX_STRING 0x14 ++#define ASN1_TAG_PRINTABLE_STRING 0x13 ++#define ASN1_TAG_UNIVERSAL_STRING 0x1C ++#define ASN1_TAG_BMP_STRING 0x1E ++#define ASN1_TAG_UTF8_STRING 0x0C ++#define ASN1_TAG_VISIBLE_STRING 0x1A ++ ++/** ++ * asn1_node: ++ * ++ * Structure definition used for the node of the tree ++ * that represents an ASN.1 DEFINITION. ++ */ ++typedef struct asn1_node_st asn1_node_st; ++ ++typedef asn1_node_st *asn1_node; ++typedef const asn1_node_st *asn1_node_const; ++ ++/** ++ * ASN1_MAX_NAME_SIZE: ++ * ++ * Maximum number of characters of a name ++ * inside a file with ASN1 definitions. ++ */ ++#define ASN1_MAX_NAME_SIZE 64 ++ ++ ++/** ++ * asn1_static_node: ++ * @name: Node name ++ * @type: Node typ ++ * @value: Node value ++ * ++ * For the on-disk format of ASN.1 trees, created by asn1_parser2array(). ++ */ ++struct asn1_static_node_st ++{ ++ const char *name; /* Node name */ ++ unsigned int type; /* Node type */ ++ const void *value; /* Node value */ ++}; ++typedef struct asn1_static_node_st asn1_static_node; ++ ++/* List of constants for field type of node_asn */ ++#define ASN1_ETYPE_INVALID 0 ++#define ASN1_ETYPE_CONSTANT 1 ++#define ASN1_ETYPE_IDENTIFIER 2 ++#define ASN1_ETYPE_INTEGER 3 ++#define ASN1_ETYPE_BOOLEAN 4 ++#define ASN1_ETYPE_SEQUENCE 5 ++#define ASN1_ETYPE_BIT_STRING 6 ++#define ASN1_ETYPE_OCTET_STRING 7 ++#define ASN1_ETYPE_TAG 8 ++#define ASN1_ETYPE_DEFAULT 9 ++#define ASN1_ETYPE_SIZE 10 ++#define ASN1_ETYPE_SEQUENCE_OF 11 ++#define ASN1_ETYPE_OBJECT_ID 12 ++#define ASN1_ETYPE_ANY 13 ++#define ASN1_ETYPE_SET 14 ++#define ASN1_ETYPE_SET_OF 15 ++#define ASN1_ETYPE_DEFINITIONS 16 ++#define ASN1_ETYPE_CHOICE 18 ++#define ASN1_ETYPE_IMPORTS 19 ++#define ASN1_ETYPE_NULL 20 ++#define ASN1_ETYPE_ENUMERATED 21 ++#define ASN1_ETYPE_GENERALSTRING 27 ++#define ASN1_ETYPE_NUMERIC_STRING 28 ++#define ASN1_ETYPE_IA5_STRING 29 ++#define ASN1_ETYPE_TELETEX_STRING 30 ++#define ASN1_ETYPE_PRINTABLE_STRING 31 ++#define ASN1_ETYPE_UNIVERSAL_STRING 32 ++#define ASN1_ETYPE_BMP_STRING 33 ++#define ASN1_ETYPE_UTF8_STRING 34 ++#define ASN1_ETYPE_VISIBLE_STRING 35 ++#define ASN1_ETYPE_UTC_TIME 36 ++#define ASN1_ETYPE_GENERALIZED_TIME 37 ++ ++/** ++ * ASN1_DELETE_FLAG_ZEROIZE: ++ * ++ * Used by: asn1_delete_structure2() ++ * ++ * Zeroize values prior to deinitialization. ++ */ ++#define ASN1_DELETE_FLAG_ZEROIZE 1 ++ ++/** ++ * ASN1_DECODE_FLAG_ALLOW_PADDING: ++ * ++ * Used by: asn1_der_decoding2() ++ * ++ * This flag would allow arbitrary data past the DER data. ++ */ ++#define ASN1_DECODE_FLAG_ALLOW_PADDING 1 ++/** ++ * ASN1_DECODE_FLAG_STRICT_DER: ++ * ++ * Used by: asn1_der_decoding2() ++ * ++ * This flag would ensure that no BER decoding takes place. ++ */ ++#define ASN1_DECODE_FLAG_STRICT_DER (1<<1) ++/** ++ * ASN1_DECODE_FLAG_ALLOW_INCORRECT_TIME: ++ * ++ * Used by: asn1_der_decoding2() ++ * ++ * This flag will tolerate Time encoding errors when in strict DER. ++ */ ++#define ASN1_DECODE_FLAG_ALLOW_INCORRECT_TIME (1<<2) ++ ++ ++/** ++ * asn1_data_node_st: ++ * @name: Node name ++ * @value: Node value ++ * @value_len: Node value size ++ * @type: Node value type (ASN1_ETYPE_*) ++ * ++ * Data node inside a #asn1_node structure. ++ */ ++struct asn1_data_node_st ++{ ++ const char *name; /* Node name */ ++ const void *value; /* Node value */ ++ unsigned int value_len; /* Node value size */ ++ unsigned int type; /* Node value type (ASN1_ETYPE_*) */ ++}; ++typedef struct asn1_data_node_st asn1_data_node_st; ++ ++/***********************************/ ++/* Fixed constants */ ++/***********************************/ ++ ++/** ++ * ASN1_MAX_ERROR_DESCRIPTION_SIZE: ++ * ++ * Maximum number of characters ++ * of a description message ++ * (null character included). ++ */ ++#define ASN1_MAX_ERROR_DESCRIPTION_SIZE 128 ++ ++/***********************************/ ++/* Functions definitions */ ++/***********************************/ ++ ++extern ASN1_API int ++ asn1_parser2tree (const char *file, ++ asn1_node * definitions, char *error_desc); ++ ++extern ASN1_API int ++ asn1_parser2array (const char *inputFileName, ++ const char *outputFileName, ++ const char *vectorName, char *error_desc); ++ ++extern ASN1_API int ++ asn1_array2tree (const asn1_static_node * array, ++ asn1_node * definitions, char *errorDescription); ++ ++extern ASN1_API void ++ asn1_print_structure (FILE * out, asn1_node_const structure, ++ const char *name, int mode); ++ ++extern ASN1_API int ++ asn1_create_element (asn1_node_const definitions, ++ const char *source_name, asn1_node * element); ++ ++extern ASN1_API int asn1_delete_structure (asn1_node * structure); ++ ++extern ASN1_API int asn1_delete_structure2 (asn1_node * structure, unsigned int flags); ++ ++extern ASN1_API int ++ asn1_delete_element (asn1_node structure, const char *element_name); ++ ++extern ASN1_API int ++ asn1_write_value (asn1_node node_root, const char *name, ++ const void *ivalue, int len); ++ ++extern ASN1_API int ++ asn1_read_value (asn1_node_const root, const char *name, ++ void *ivalue, int *len); ++ ++extern ASN1_API int ++ asn1_read_value_type (asn1_node_const root, const char *name, ++ void *ivalue, int *len, unsigned int *etype); ++ ++extern ASN1_API int ++ asn1_read_node_value (asn1_node_const node, asn1_data_node_st * data); ++ ++extern ASN1_API int ++ asn1_number_of_elements (asn1_node_const element, const char *name, int *num); ++ ++extern ASN1_API int ++ asn1_der_coding (asn1_node_const element, const char *name, ++ void *ider, int *len, char *ErrorDescription); ++ ++extern ASN1_API int ++ asn1_der_decoding2 (asn1_node *element, const void *ider, ++ int *max_ider_len, unsigned int flags, ++ char *errorDescription); ++ ++extern ASN1_API int ++ asn1_der_decoding (asn1_node * element, const void *ider, ++ int ider_len, char *errorDescription); ++ ++/* Do not use. Use asn1_der_decoding() instead. */ ++extern ASN1_API int ++ asn1_der_decoding_element (asn1_node * structure, ++ const char *elementName, ++ const void *ider, int len, ++ char *errorDescription) _ASN1_GCC_ATTR_DEPRECATED; ++ ++extern ASN1_API int ++ asn1_der_decoding_startEnd (asn1_node element, ++ const void *ider, int ider_len, ++ const char *name_element, ++ int *start, int *end); ++ ++extern ASN1_API int ++ asn1_expand_any_defined_by (asn1_node_const definitions, asn1_node * element); ++ ++extern ASN1_API int ++ asn1_expand_octet_string (asn1_node_const definitions, ++ asn1_node * element, ++ const char *octetName, const char *objectName); ++ ++extern ASN1_API int ++ asn1_read_tag (asn1_node_const root, const char *name, ++ int *tagValue, int *classValue); ++ ++extern ASN1_API const char *asn1_find_structure_from_oid (asn1_node_const ++ definitions, ++ const char ++ *oidValue); ++ ++__LIBTASN1_PURE__ ++extern ASN1_API const char *asn1_check_version (const char *req_version); ++ ++__LIBTASN1_PURE__ ++extern ASN1_API const char *asn1_strerror (int error); ++ ++extern ASN1_API void asn1_perror (int error); ++ ++#define ASN1_MAX_TAG_SIZE 4 ++#define ASN1_MAX_LENGTH_SIZE 9 ++#define ASN1_MAX_TL_SIZE (ASN1_MAX_TAG_SIZE+ASN1_MAX_LENGTH_SIZE) ++extern ASN1_API long ++ asn1_get_length_der (const unsigned char *der, int der_len, int *len); ++ ++extern ASN1_API long ++ asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len); ++ ++extern ASN1_API void ++ asn1_length_der (unsigned long int len, unsigned char *der, int *der_len); ++ ++/* Other utility functions. */ ++ ++extern ASN1_API ++ int asn1_decode_simple_der (unsigned int etype, const unsigned char *der, ++ unsigned int _der_len, ++ const unsigned char **str, ++ unsigned int *str_len); ++ ++extern ASN1_API ++ int asn1_decode_simple_ber (unsigned int etype, const unsigned char *der, ++ unsigned int _der_len, ++ unsigned char **str, ++ unsigned int *str_len, ++ unsigned int *ber_len); ++ ++extern ASN1_API int ++ asn1_encode_simple_der (unsigned int etype, const unsigned char *str, ++ unsigned int str_len, unsigned char *tl, ++ unsigned int *tl_len); ++ ++extern ASN1_API asn1_node ++ asn1_find_node (asn1_node_const pointer, const char *name); ++ ++extern ASN1_API int ++ asn1_copy_node (asn1_node dst, const char *dst_name, ++ asn1_node_const src, const char *src_name); ++extern ASN1_API asn1_node ++ asn1_dup_node (asn1_node_const src, const char *src_name); ++ ++/* Internal and low-level DER utility functions. */ ++ ++extern ASN1_API int ++ asn1_get_tag_der (const unsigned char *der, int der_len, ++ unsigned char *cls, int *len, unsigned long *tag); ++ ++extern ASN1_API void ++ asn1_octet_der (const unsigned char *str, int str_len, ++ unsigned char *der, int *der_len); ++ ++extern ASN1_API int ++ asn1_get_octet_der (const unsigned char *der, int der_len, ++ int *ret_len, unsigned char *str, ++ int str_size, int *str_len); ++ ++extern ASN1_API void asn1_bit_der (const unsigned char *str, int bit_len, ++ unsigned char *der, int *der_len); ++ ++extern ASN1_API int ++ asn1_get_bit_der (const unsigned char *der, int der_len, ++ int *ret_len, unsigned char *str, ++ int str_size, int *bit_len); ++ ++extern ASN1_API int ++ asn1_get_object_id_der (const unsigned char *der, ++ int der_len, int *ret_len, ++ char *str, int str_size); ++ ++extern ASN1_API int ++ asn1_object_id_der (const char *str, unsigned char *der, int *der_len, ++ unsigned flags); ++ ++/* Compatibility types */ ++ ++/** ++ * asn1_retCode: ++ * ++ * Type formerly returned by libtasn1 functions. ++ * ++ * Deprecated: 3.0: Use int instead. ++ */ ++typedef int asn1_retCode; ++ ++/** ++ * node_asn_struct: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use #asn1_node instead. ++ */ ++#define node_asn_struct asn1_node_st ++ ++/** ++ * node_asn: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use #asn1_node instead. ++ */ ++#define node_asn asn1_node_st ++ ++/** ++ * ASN1_TYPE: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use #asn1_node instead. ++ */ ++#define ASN1_TYPE asn1_node ++ ++/** ++ * ASN1_TYPE_EMPTY: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use NULL instead. ++ */ ++#define ASN1_TYPE_EMPTY NULL ++ ++/** ++ * static_struct_asn: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use #asn1_static_node instead. ++ */ ++#define static_struct_asn asn1_static_node_st ++ ++/** ++ * ASN1_ARRAY_TYPE: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use #asn1_static_node instead. ++ */ ++#define ASN1_ARRAY_TYPE asn1_static_node ++ ++/** ++ * asn1_static_node_t: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use #asn1_static_node instead. ++ */ ++#define asn1_static_node_t asn1_static_node ++ ++/** ++ * node_data_struct: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use #asn1_data_node_st instead. ++ */ ++#define node_data_struct asn1_data_node_st ++ ++/** ++ * ASN1_DATA_NODE: ++ * ++ * Compat #define. ++ * ++ * Deprecated: 3.0: Use #asn1_data_node_st instead. ++ */ ++#define ASN1_DATA_NODE asn1_data_node_st ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* LIBTASN1_H */ +diff --git a/grub-core/lib/libtasn1/LICENSE b/grub-core/lib/libtasn1/LICENSE +new file mode 100644 +index 00000000000..e8b3628db9b +--- /dev/null ++++ b/grub-core/lib/libtasn1/LICENSE +@@ -0,0 +1,16 @@ ++LICENSING ++========= ++ ++The libtasn1 library is released under the GNU Lesser General Public ++License (LGPL) version 2.1 or later; see [COPYING.LESSER](doc/COPYING.LESSER) ++for the license terms. ++ ++The GNU LGPL applies to the main libtasn1 library, while the ++included applications library are under the GNU GPL version 3. ++The libtasn1 library is located in the lib directory, while the applications ++in src/. ++ ++The documentation in doc/ is under the GNU FDL license 1.3. ++ ++For any copyright year range specified as YYYY-ZZZZ in this package ++note that the range specifies every single year in that closed interval. +diff --git a/grub-core/lib/libtasn1/README.md b/grub-core/lib/libtasn1/README.md +new file mode 100644 +index 00000000000..50a8642296c +--- /dev/null ++++ b/grub-core/lib/libtasn1/README.md +@@ -0,0 +1,91 @@ ++|Branch|CI system|Status| ++|:----:|:-------:|-----:| ++|Master|Gitlab|[![build status](https://gitlab.com/gnutls/libtasn1/badges/master/pipeline.svg)](https://gitlab.com/gnutls/libtasn1/commits/master)[![coverage report](https://gitlab.com/gnutls/libtasn1/badges/master/coverage.svg)](https://gnutls.gitlab.io/libtasn1/coverage)| ++ ++# libtasn1 ++ ++This is GNU Libtasn1, a small ASN.1 library. ++ ++The C library (libtasn1.*) is licensed under the GNU Lesser General ++Public License version 2.1 or later. See the file COPYING.LIB. ++ ++The command line tool, self tests, examples, and other auxilliary ++files, are licensed under the GNU General Public License version 3.0 ++or later. See the file COPYING. ++ ++## Building the library ++ ++We require several tools to build the software, including: ++ ++* [Make](https://www.gnu.org/software/make/) ++* [Automake](https://www.gnu.org/software/automake/) (use 1.11.3 or later) ++* [Autoconf](https://www.gnu.org/software/autoconf/) ++* [Libtool](https://www.gnu.org/software/libtool/) ++* [Texinfo](https://www.gnu.org/software/texinfo/) ++* [help2man](http://www.gnu.org/software/help2man/) ++* [Tar](https://www.gnu.org/software/tar/) ++* [Gzip](https://www.gnu.org/software/gzip/) ++* [bison](https://www.gnu.org/software/bison/) ++* [Texlive & epsf](https://www.tug.org/texlive/) (for PDF manual) ++* [GTK-DOC](https://www.gtk.org/gtk-doc/) (for API manual) ++* [Git](https://git-scm.com/) ++* [libabigail](https://pagure.io/libabigail/) (for abi comparison in make dist) ++* [Valgrind](https://valgrind.org/) (optional) ++ ++The required software is typically distributed with your operating ++system, and the instructions for installing them differ. Here are ++some hints: ++ ++gNewSense/Debian/Ubuntu: ++``` ++sudo apt-get install make git-core autoconf automake libtool ++sudo apt-get install texinfo texlive texlive-generic-recommended texlive-extra-utils ++sudo apt-get install help2man gtk-doc-tools valgrind abigail-tools ++``` ++ ++The next step is to run autoreconf, ./configure, etc: ++ ++``` ++$ ./bootstrap ++``` ++ ++Then build the project normally: ++ ++``` ++$ make ++$ make check ++``` ++ ++Happy hacking! ++ ++ ++## Manual ++ ++The manual is in the `doc/` directory of the release. You can also browse ++the manual online at: ++ ++ - https://gnutls.gitlab.io/libtasn1/ ++ ++ ++## Code coverage report ++ ++The coverage report is at: ++ ++ - https://gnutls.gitlab.io/libtasn1/coverage ++ ++ ++## Issue trackers ++ ++ - [Main issue tracker](https://gitlab.com/gnutls/libtasn1/issues) ++ - [oss-fuzz found issues](https://bugs.chromium.org/p/oss-fuzz/issues/list?q=libtasn1&can=2) ++ ++ ++## Homepage ++ ++The project homepage at the gnu site is at: ++ ++http://www.gnu.org/software/libtasn1/ ++ ++ ++For any copyright year range specified as YYYY-ZZZZ in this package ++note that the range specifies every single year in that closed interval. diff --git a/0294-libtasn1-disable-code-not-needed-in-grub.patch b/0294-libtasn1-disable-code-not-needed-in-grub.patch new file mode 100644 index 00000000..00f55888 --- /dev/null +++ b/0294-libtasn1-disable-code-not-needed-in-grub.patch @@ -0,0 +1,307 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 1 May 2020 17:12:23 +1000 +Subject: [PATCH] libtasn1: disable code not needed in grub + +We don't expect to be able to write ASN.1, only read it, +so we can disable some code. + +Do that with #if 0/#endif, rather than deletion. This means +that the difference between upstream and grub is smaller, +which should make updating libtasn1 easier in the future. + +With these exclusions we also avoid the need for minmax.h, +which is convenient because it means we don't have to +import it from gnulib. + +Signed-off-by: Daniel Axtens +--- + grub-core/lib/libtasn1/lib/coding.c | 12 ++++++++++-- + grub-core/lib/libtasn1/lib/decoding.c | 2 ++ + grub-core/lib/libtasn1/lib/element.c | 4 ++-- + grub-core/lib/libtasn1/lib/errors.c | 3 +++ + grub-core/lib/libtasn1/lib/structure.c | 10 ++++++---- + include/grub/libtasn1.h | 15 +++++++++++++++ + 6 files changed, 38 insertions(+), 8 deletions(-) + +diff --git a/grub-core/lib/libtasn1/lib/coding.c b/grub-core/lib/libtasn1/lib/coding.c +index 245ea64cf0a..52def598368 100644 +--- a/grub-core/lib/libtasn1/lib/coding.c ++++ b/grub-core/lib/libtasn1/lib/coding.c +@@ -30,11 +30,11 @@ + #include "parser_aux.h" + #include + #include "element.h" +-#include "minmax.h" + #include + + #define MAX_TAG_LEN 16 + ++#if 0 + /******************************************************/ + /* Function : _asn1_error_description_value_not_found */ + /* Description: creates the ErrorDescription string */ +@@ -58,6 +58,7 @@ _asn1_error_description_value_not_found (asn1_node node, + Estrcat (ErrorDescription, "' not found"); + + } ++#endif + + /** + * asn1_length_der: +@@ -244,6 +245,7 @@ asn1_encode_simple_der (unsigned int etype, const unsigned char *str, + return ASN1_SUCCESS; + } + ++#if 0 + /******************************************************/ + /* Function : _asn1_time_der */ + /* Description: creates the DER coding for a TIME */ +@@ -281,7 +283,7 @@ _asn1_time_der (unsigned char *str, int str_len, unsigned char *der, + + return ASN1_SUCCESS; + } +- ++#endif + + /* + void +@@ -520,6 +522,7 @@ asn1_bit_der (const unsigned char *str, int bit_len, + } + + ++#if 0 + /******************************************************/ + /* Function : _asn1_complete_explicit_tag */ + /* Description: add the length coding to the EXPLICIT */ +@@ -596,6 +599,7 @@ _asn1_complete_explicit_tag (asn1_node node, unsigned char *der, + + return ASN1_SUCCESS; + } ++#endif + + const tag_and_class_st _asn1_tags[] = { + [ASN1_ETYPE_GENERALSTRING] = +@@ -648,6 +652,8 @@ const tag_and_class_st _asn1_tags[] = { + + unsigned int _asn1_tags_size = sizeof (_asn1_tags) / sizeof (_asn1_tags[0]); + ++ ++#if 0 + /******************************************************/ + /* Function : _asn1_insert_tag_der */ + /* Description: creates the DER coding of tags of one */ +@@ -1413,3 +1419,5 @@ error: + asn1_delete_structure (&node); + return err; + } ++ ++#endif +\ No newline at end of file +diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c +index ff04eb778cb..42f9a92b5d4 100644 +--- a/grub-core/lib/libtasn1/lib/decoding.c ++++ b/grub-core/lib/libtasn1/lib/decoding.c +@@ -1613,6 +1613,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len, + return asn1_der_decoding2 (element, ider, &ider_len, 0, errorDescription); + } + ++#if 0 + /** + * asn1_der_decoding_element: + * @structure: pointer to an ASN1 structure +@@ -1643,6 +1644,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName, + { + return asn1_der_decoding(structure, ider, len, errorDescription); + } ++#endif + + /** + * asn1_der_decoding_startEnd: +diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c +index 997eb2725dc..539008d8e94 100644 +--- a/grub-core/lib/libtasn1/lib/element.c ++++ b/grub-core/lib/libtasn1/lib/element.c +@@ -191,7 +191,7 @@ _asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcache) + return ASN1_SUCCESS; + } + +- ++#if 0 + /** + * asn1_write_value: + * @node_root: pointer to a structure +@@ -645,7 +645,7 @@ asn1_write_value (asn1_node node_root, const char *name, + + return ASN1_SUCCESS; + } +- ++#endif + + #define PUT_VALUE( ptr, ptr_size, data, data_size) \ + *len = data_size; \ +diff --git a/grub-core/lib/libtasn1/lib/errors.c b/grub-core/lib/libtasn1/lib/errors.c +index cee74daf795..42785e8622b 100644 +--- a/grub-core/lib/libtasn1/lib/errors.c ++++ b/grub-core/lib/libtasn1/lib/errors.c +@@ -57,6 +57,8 @@ static const libtasn1_error_entry error_algorithms[] = { + {0, 0} + }; + ++ ++#if 0 + /** + * asn1_perror: + * @error: is an error returned by a libtasn1 function. +@@ -73,6 +75,7 @@ asn1_perror (int error) + const char *str = asn1_strerror (error); + fprintf (stderr, "LIBTASN1 ERROR: %s\n", str ? str : "(null)"); + } ++#endif + + /** + * asn1_strerror: +diff --git a/grub-core/lib/libtasn1/lib/structure.c b/grub-core/lib/libtasn1/lib/structure.c +index 8189c56a4c9..fcfde01a393 100644 +--- a/grub-core/lib/libtasn1/lib/structure.c ++++ b/grub-core/lib/libtasn1/lib/structure.c +@@ -76,7 +76,7 @@ _asn1_find_left (asn1_node_const node) + return node->left; + } + +- ++#if 0 + int + _asn1_create_static_structure (asn1_node_const pointer, char *output_file_name, + char *vector_name) +@@ -155,7 +155,7 @@ _asn1_create_static_structure (asn1_node_const pointer, char *output_file_name, + + return ASN1_SUCCESS; + } +- ++#endif + + /** + * asn1_array2tree: +@@ -718,7 +718,7 @@ asn1_create_element (asn1_node_const definitions, const char *source_name, + return res; + } + +- ++#if 0 + /** + * asn1_print_structure: + * @out: pointer to the output file (e.g. stdout). +@@ -1058,7 +1058,7 @@ asn1_print_structure (FILE * out, asn1_node_const structure, const char *name, + } + } + } +- ++#endif + + + /** +@@ -1153,6 +1153,7 @@ asn1_find_structure_from_oid (asn1_node_const definitions, const char *oidValue) + return NULL; /* ASN1_ELEMENT_NOT_FOUND; */ + } + ++#if 0 + /** + * asn1_copy_node: + * @dst: Destination asn1 node. +@@ -1202,6 +1203,7 @@ asn1_copy_node (asn1_node dst, const char *dst_name, + + return result; + } ++#endif + + /** + * asn1_dup_node: +diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h +index 6fd7a30dc35..785eda2ae3f 100644 +--- a/include/grub/libtasn1.h ++++ b/include/grub/libtasn1.h +@@ -319,6 +319,8 @@ typedef struct asn1_data_node_st asn1_data_node_st; + /* Functions definitions */ + /***********************************/ + ++/* These functions are not used in grub and should not be referenced. */ ++#if 0 + extern ASN1_API int + asn1_parser2tree (const char *file, + asn1_node * definitions, char *error_desc); +@@ -327,14 +329,17 @@ extern ASN1_API int + asn1_parser2array (const char *inputFileName, + const char *outputFileName, + const char *vectorName, char *error_desc); ++#endif + + extern ASN1_API int + asn1_array2tree (const asn1_static_node * array, + asn1_node * definitions, char *errorDescription); + ++#if 0 + extern ASN1_API void + asn1_print_structure (FILE * out, asn1_node_const structure, + const char *name, int mode); ++#endif + + extern ASN1_API int + asn1_create_element (asn1_node_const definitions, +@@ -347,9 +352,11 @@ extern ASN1_API int asn1_delete_structure2 (asn1_node * structure, unsigned int + extern ASN1_API int + asn1_delete_element (asn1_node structure, const char *element_name); + ++#if 0 + extern ASN1_API int + asn1_write_value (asn1_node node_root, const char *name, + const void *ivalue, int len); ++#endif + + extern ASN1_API int + asn1_read_value (asn1_node_const root, const char *name, +@@ -365,9 +372,11 @@ extern ASN1_API int + extern ASN1_API int + asn1_number_of_elements (asn1_node_const element, const char *name, int *num); + ++#if 0 + extern ASN1_API int + asn1_der_coding (asn1_node_const element, const char *name, + void *ider, int *len, char *ErrorDescription); ++#endif + + extern ASN1_API int + asn1_der_decoding2 (asn1_node *element, const void *ider, +@@ -378,12 +387,14 @@ extern ASN1_API int + asn1_der_decoding (asn1_node * element, const void *ider, + int ider_len, char *errorDescription); + ++#if 0 + /* Do not use. Use asn1_der_decoding() instead. */ + extern ASN1_API int + asn1_der_decoding_element (asn1_node * structure, + const char *elementName, + const void *ider, int len, + char *errorDescription) _ASN1_GCC_ATTR_DEPRECATED; ++#endif + + extern ASN1_API int + asn1_der_decoding_startEnd (asn1_node element, +@@ -408,13 +419,17 @@ extern ASN1_API const char *asn1_find_structure_from_oid (asn1_node_const + const char + *oidValue); + ++#if 0 + __LIBTASN1_PURE__ + extern ASN1_API const char *asn1_check_version (const char *req_version); ++#endif + + __LIBTASN1_PURE__ + extern ASN1_API const char *asn1_strerror (int error); + ++#if 0 + extern ASN1_API void asn1_perror (int error); ++#endif + + #define ASN1_MAX_TAG_SIZE 4 + #define ASN1_MAX_LENGTH_SIZE 9 diff --git a/0295-libtasn1-changes-for-grub-compatibility.patch b/0295-libtasn1-changes-for-grub-compatibility.patch new file mode 100644 index 00000000..9b2275ca --- /dev/null +++ b/0295-libtasn1-changes-for-grub-compatibility.patch @@ -0,0 +1,202 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 1 May 2020 20:44:29 +1000 +Subject: [PATCH] libtasn1: changes for grub compatibility + +Do a few things to make libtasn1 compile as part of grub: + + - replace strcat. grub removed strcat so replace it with the appropriate + calls to memcpy and strlen. + + - replace c_isdigit with grub_isdigit (and don't import c-ctype from + gnulib) grub_isdigit provides the same functionality as c_isdigit: it + determines if the input is an ASCII digit without regard for locale. + + - replace GL_ATTRIBUTE_PURE with __attribute__((pure)) which been + supported since gcc-2.96. This avoids messing around with gnulib. + + - adjust libtasn1.h: drop the ASN1_API logic, it's not needed for our + modules. Unconditionally support const and pure attributes and adjust + header paths. + + - adjust header paths to "grub/libtasn1.h". + + - replace a 64 bit division with a call to grub_divmod64, preventing + creation of __udivdi3 calls on 32 bit platforms. + +Signed-off-by: Daniel Axtens +--- + grub-core/lib/libtasn1/lib/decoding.c | 11 ++++++----- + grub-core/lib/libtasn1/lib/element.c | 3 ++- + grub-core/lib/libtasn1/lib/gstr.c | 4 ++-- + grub-core/lib/libtasn1/lib/parser_aux.c | 7 ++++--- + grub-core/lib/libtasn1/lib/int.h | 4 ++-- + include/grub/libtasn1.h | 26 ++++++-------------------- + 6 files changed, 22 insertions(+), 33 deletions(-) + +diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c +index 42f9a92b5d4..7856858b272 100644 +--- a/grub-core/lib/libtasn1/lib/decoding.c ++++ b/grub-core/lib/libtasn1/lib/decoding.c +@@ -32,7 +32,8 @@ + #include + #include + #include +-#include ++ ++#define c_isdigit grub_isdigit + + #ifdef DEBUG + # define warn() fprintf(stderr, "%s: %d\n", __func__, __LINE__) +@@ -2008,8 +2009,8 @@ asn1_expand_octet_string (asn1_node_const definitions, asn1_node * element, + (p2->type & CONST_ASSIGN)) + { + strcpy (name, definitions->name); +- strcat (name, "."); +- strcat (name, p2->name); ++ memcpy (name + strlen(name), ".", sizeof(" . ")); ++ memcpy (name + strlen(name), p2->name, strlen(p2->name) + 1); + + len = sizeof (value); + result = asn1_read_value (definitions, name, value, &len); +@@ -2026,8 +2027,8 @@ asn1_expand_octet_string (asn1_node_const definitions, asn1_node * element, + if (p2) + { + strcpy (name, definitions->name); +- strcat (name, "."); +- strcat (name, p2->name); ++ memcpy (name + strlen(name), ".", sizeof(" . ")); ++ memcpy (name + strlen(name), p2->name, strlen(p2->name) + 1); + + result = asn1_create_element (definitions, name, &aux); + if (result == ASN1_SUCCESS) +diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c +index 539008d8e94..ed761ff56bd 100644 +--- a/grub-core/lib/libtasn1/lib/element.c ++++ b/grub-core/lib/libtasn1/lib/element.c +@@ -30,9 +30,10 @@ + #include "parser_aux.h" + #include + #include "structure.h" +-#include "c-ctype.h" + #include "element.h" + ++#define c_isdigit grub_isdigit ++ + void + _asn1_hierarchical_name (asn1_node_const node, char *name, int name_size) + { +diff --git a/grub-core/lib/libtasn1/lib/gstr.c b/grub-core/lib/libtasn1/lib/gstr.c +index e91a3a151c0..e33875c2c7c 100644 +--- a/grub-core/lib/libtasn1/lib/gstr.c ++++ b/grub-core/lib/libtasn1/lib/gstr.c +@@ -36,13 +36,13 @@ _asn1_str_cat (char *dest, size_t dest_tot_size, const char *src) + + if (dest_tot_size - dest_size > str_size) + { +- strcat (dest, src); ++ memcpy (dest + dest_size, src, str_size + 1); + } + else + { + if (dest_tot_size - dest_size > 0) + { +- strncat (dest, src, (dest_tot_size - dest_size) - 1); ++ memcpy (dest + dest_size, src, (dest_tot_size - dest_size) - 1); + dest[dest_tot_size - 1] = 0; + } + } +diff --git a/grub-core/lib/libtasn1/lib/parser_aux.c b/grub-core/lib/libtasn1/lib/parser_aux.c +index d5dbbf8765d..89c9be69dc2 100644 +--- a/grub-core/lib/libtasn1/lib/parser_aux.c ++++ b/grub-core/lib/libtasn1/lib/parser_aux.c +@@ -26,7 +26,8 @@ + #include "gstr.h" + #include "structure.h" + #include "element.h" +-#include "c-ctype.h" ++ ++#define c_isdigit grub_isdigit + + char _asn1_identifierMissing[ASN1_MAX_NAME_SIZE + 1]; /* identifier name not found */ + +@@ -40,7 +41,7 @@ char _asn1_identifierMissing[ASN1_MAX_NAME_SIZE + 1]; /* identifier name not fou + #ifdef __clang__ + __attribute__((no_sanitize("integer"))) + #endif +-_GL_ATTRIBUTE_PURE ++__attribute__((__pure__)) + static unsigned int + _asn1_hash_name (const char *x) + { +@@ -634,7 +635,7 @@ _asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]) + count = 0; + do + { +- d = val / 10; ++ d = grub_divmod64(val, 10, NULL); + r = val - d * 10; + temp[start + count] = '0' + (char) r; + count++; +diff --git a/grub-core/lib/libtasn1/lib/int.h b/grub-core/lib/libtasn1/lib/int.h +index ea1625786c1..4a568efee9c 100644 +--- a/grub-core/lib/libtasn1/lib/int.h ++++ b/grub-core/lib/libtasn1/lib/int.h +@@ -35,7 +35,7 @@ + #include + #endif + +-#include ++#include "grub/libtasn1.h" + + #define ASN1_SMALL_VALUE_SIZE 16 + +@@ -115,7 +115,7 @@ extern const tag_and_class_st _asn1_tags[]; + #define _asn1_strtoul(n,e,b) strtoul((const char *) n, e, b) + #define _asn1_strcmp(a,b) strcmp((const char *)a, (const char *)b) + #define _asn1_strcpy(a,b) strcpy((char *)a, (const char *)b) +-#define _asn1_strcat(a,b) strcat((char *)a, (const char *)b) ++#define _asn1_strcat(a,b) memcpy((char *)a + strlen((const char *)a), (const char *)b, strlen((const char *)b) + 1) + + #if SIZEOF_UNSIGNED_LONG_INT == 8 + # define _asn1_strtou64(n,e,b) strtoul((const char *) n, e, b) +diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h +index 785eda2ae3f..28dbf16c4e0 100644 +--- a/include/grub/libtasn1.h ++++ b/include/grub/libtasn1.h +@@ -38,29 +38,15 @@ + #ifndef LIBTASN1_H + #define LIBTASN1_H + +-#ifndef ASN1_API +-#if defined ASN1_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY +-#define ASN1_API __attribute__((__visibility__("default"))) +-#elif defined ASN1_BUILDING && defined _MSC_VER && ! defined ASN1_STATIC +-#define ASN1_API __declspec(dllexport) +-#elif defined _MSC_VER && ! defined ASN1_STATIC +-#define ASN1_API __declspec(dllimport) +-#else ++/* grub: ASN1_API is not used */ + #define ASN1_API +-#endif +-#endif + +-#ifdef __GNUC__ +-# define __LIBTASN1_CONST__ __attribute__((const)) +-# define __LIBTASN1_PURE__ __attribute__((pure)) +-#else +-# define __LIBTASN1_CONST__ +-# define __LIBTASN1_PURE__ +-#endif ++/* grub: all our supported compilers support these attributes */ ++#define __LIBTASN1_CONST__ __attribute__((const)) ++#define __LIBTASN1_PURE__ __attribute__((pure)) + +-#include +-#include +-#include /* for FILE* */ ++#include ++#include + + #ifdef __cplusplus + extern "C" diff --git a/0296-libtasn1-compile-into-asn1-module.patch b/0296-libtasn1-compile-into-asn1-module.patch new file mode 100644 index 00000000..2ee3d9ad --- /dev/null +++ b/0296-libtasn1-compile-into-asn1-module.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 5 Jun 2020 17:47:25 +1000 +Subject: [PATCH] libtasn1: compile into asn1 module + +Create a wrapper file that specifies the module license. +Set up the makefile so it is built. + +Signed-off-by: Daniel Axtens +--- + grub-core/Makefile.core.def | 15 +++++++++++++++ + grub-core/lib/libtasn1_wrap/wrap.c | 26 ++++++++++++++++++++++++++ + 2 files changed, 41 insertions(+) + create mode 100644 grub-core/lib/libtasn1_wrap/wrap.c + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 58bf113e7c1..a9f589a7b99 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2554,3 +2554,18 @@ module = { + common = commands/i386/wrmsr.c; + enable = x86; + }; ++ ++module = { ++ name = asn1; ++ common = lib/libtasn1/lib/decoding.c; ++ common = lib/libtasn1/lib/coding.c; ++ common = lib/libtasn1/lib/element.c; ++ common = lib/libtasn1/lib/structure.c; ++ common = lib/libtasn1/lib/parser_aux.c; ++ common = lib/libtasn1/lib/gstr.c; ++ common = lib/libtasn1/lib/errors.c; ++ common = lib/libtasn1_wrap/wrap.c; ++ cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; ++ // -Wno-type-limits comes from libtasn1's configure.ac ++ cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB) -I$(srcdir)/lib/libtasn1/lib -Wno-type-limits'; ++}; +diff --git a/grub-core/lib/libtasn1_wrap/wrap.c b/grub-core/lib/libtasn1_wrap/wrap.c +new file mode 100644 +index 00000000000..622ba942e33 +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/wrap.c +@@ -0,0 +1,26 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++ ++/* ++ * libtasn1 is provided under LGPL2.1+, which is compatible ++ * with GPL3+. As Grub as a whole is under GPL3+, this module ++ * is therefore under GPL3+ also. ++ */ ++GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0297-test_asn1-test-module-for-libtasn1.patch b/0297-test_asn1-test-module-for-libtasn1.patch new file mode 100644 index 00000000..6036148f --- /dev/null +++ b/0297-test_asn1-test-module-for-libtasn1.patch @@ -0,0 +1,1455 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Wed, 10 Jun 2020 17:48:42 +1000 +Subject: [PATCH] test_asn1: test module for libtasn1 + +Import tests from libtasn1 that don't use functionality we don't +import. I have put them here rather than in the libtasn1 directory +because: + + - They need much more significant changes to run in the grub + context. + + - I don't expect they will need to be changed when updating + libtasn1: I expect the old tests will usually continue to pass on + new versions. + +This doesn't test the full decoder but that will be exercised in +test suites for coming patch sets. + +Signed-off-by: Daniel Axtens +--- + Makefile.util.def | 6 + + grub-core/Makefile.core.def | 13 ++ + .../lib/libtasn1_wrap/tests/CVE-2018-1000654.c | 61 ++++++ + grub-core/lib/libtasn1_wrap/tests/Test_overflow.c | 138 ++++++++++++++ + grub-core/lib/libtasn1_wrap/tests/Test_simple.c | 207 ++++++++++++++++++++ + grub-core/lib/libtasn1_wrap/tests/Test_strings.c | 150 +++++++++++++++ + .../lib/libtasn1_wrap/tests/object-id-decoding.c | 116 +++++++++++ + .../lib/libtasn1_wrap/tests/object-id-encoding.c | 120 ++++++++++++ + grub-core/lib/libtasn1_wrap/tests/octet-string.c | 211 +++++++++++++++++++++ + grub-core/lib/libtasn1_wrap/tests/reproducers.c | 81 ++++++++ + grub-core/lib/libtasn1_wrap/wrap_tests.c | 75 ++++++++ + .../tests/CVE-2018-1000654-1_asn1_tab.h | 32 ++++ + .../tests/CVE-2018-1000654-2_asn1_tab.h | 36 ++++ + grub-core/lib/libtasn1_wrap/wrap_tests.h | 38 ++++ + .gitignore | 1 + + tests/test_asn1.in | 12 ++ + 16 files changed, 1297 insertions(+) + create mode 100644 grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c + create mode 100644 grub-core/lib/libtasn1_wrap/tests/Test_overflow.c + create mode 100644 grub-core/lib/libtasn1_wrap/tests/Test_simple.c + create mode 100644 grub-core/lib/libtasn1_wrap/tests/Test_strings.c + create mode 100644 grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c + create mode 100644 grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c + create mode 100644 grub-core/lib/libtasn1_wrap/tests/octet-string.c + create mode 100644 grub-core/lib/libtasn1_wrap/tests/reproducers.c + create mode 100644 grub-core/lib/libtasn1_wrap/wrap_tests.c + create mode 100644 grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h + create mode 100644 grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h + create mode 100644 grub-core/lib/libtasn1_wrap/wrap_tests.h + create mode 100644 tests/test_asn1.in + +diff --git a/Makefile.util.def b/Makefile.util.def +index dc8d1790ea5..d7908cbd1a0 100644 +--- a/Makefile.util.def ++++ b/Makefile.util.def +@@ -1304,6 +1304,12 @@ script = { + common = tests/syslinux_test.in; + }; + ++script = { ++ testcase; ++ name = test_asn1; ++ common = tests/test_asn1.in; ++}; ++ + program = { + testcase; + name = example_unit_test; +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index a9f589a7b99..78071360529 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2569,3 +2569,16 @@ module = { + // -Wno-type-limits comes from libtasn1's configure.ac + cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB) -I$(srcdir)/lib/libtasn1/lib -Wno-type-limits'; + }; ++ ++module = { ++ name = test_asn1; ++ common = lib/libtasn1_wrap/tests/CVE-2018-1000654.c; ++ common = lib/libtasn1_wrap/tests/object-id-decoding.c; ++ common = lib/libtasn1_wrap/tests/object-id-encoding.c; ++ common = lib/libtasn1_wrap/tests/octet-string.c; ++ common = lib/libtasn1_wrap/tests/reproducers.c; ++ common = lib/libtasn1_wrap/tests/Test_overflow.c; ++ common = lib/libtasn1_wrap/tests/Test_simple.c; ++ common = lib/libtasn1_wrap/tests/Test_strings.c; ++ common = lib/libtasn1_wrap/wrap_tests.c; ++}; +diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c +new file mode 100644 +index 00000000000..534e304521e +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c +@@ -0,0 +1,61 @@ ++/* ++ * Copyright (C) 2002-2018 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++/****************************************************************/ ++/* Description: reproducer for CVE-2018-1000654 */ ++/****************************************************************/ ++ ++#include ++#include ++#include ++#include ++#include ++#include "../wrap_tests.h" ++ ++#include "CVE-2018-1000654-1_asn1_tab.h" ++#include "CVE-2018-1000654-2_asn1_tab.h" ++ ++void ++test_CVE_2018_1000654 (void) ++{ ++ int result; ++ asn1_node definitions = NULL; ++ char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; ++ ++ result = asn1_array2tree (CVE_2018_1000654_1_asn1_tab, &definitions, errorDescription); ++ if (result != ASN1_RECURSION) ++ { ++ grub_fatal ("Error: %s\nErrorDescription = %s\n\n", ++ asn1_strerror (result), errorDescription); ++ return; ++ } ++ ++ asn1_delete_structure (&definitions); ++ ++ result = asn1_array2tree (CVE_2018_1000654_2_asn1_tab, &definitions, errorDescription); ++ if (result != ASN1_RECURSION) ++ { ++ grub_fatal ("Error: %s\nErrorDescription = %s\n\n", ++ asn1_strerror (result), errorDescription); ++ return; ++ } ++ ++ asn1_delete_structure (&definitions); ++} +diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c b/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c +new file mode 100644 +index 00000000000..f48aea0ef8b +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c +@@ -0,0 +1,138 @@ ++/* ++ * Copyright (C) 2012-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++/* Written by Simon Josefsson */ ++ ++#include ++#include ++#include ++#include ++#include ++#include "../wrap_tests.h" ++ ++void ++test_overflow(void) ++{ ++ /* Test that values larger than long are rejected. This has worked ++ fine with all versions of libtasn1. */ ++ ++ { ++ unsigned char der[] = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"; ++ long l; ++ int len; ++ ++ l = asn1_get_length_der (der, sizeof der, &len); ++ ++ if (l != -2L) ++ { ++ grub_fatal ("ERROR: asn1_get_length_der bignum (l %ld len %d)\n", l, len); ++ return; ++ } ++ } ++ ++ /* Test that values larger than int but smaller than long are ++ rejected. This limitation was introduced with libtasn1 2.12. */ ++#if (GRUB_LONG_MAX > GRUB_INT_MAX) ++ { ++ unsigned long num = ((long) GRUB_UINT_MAX) << 2; ++ unsigned char der[20]; ++ int der_len; ++ long l; ++ int len; ++ ++ asn1_length_der (num, der, &der_len); ++ ++ l = asn1_get_length_der (der, der_len, &len); ++ ++ if (l != -2L) ++ { ++ grub_fatal ("ERROR: asn1_get_length_der intnum (l %ld len %d)\n", l, ++ len); ++ return; ++ } ++ } ++#endif ++ ++ /* Test that values larger than would fit in the input string are ++ rejected. This problem was fixed in libtasn1 2.12. */ ++ { ++ unsigned long num = 64; ++ unsigned char der[20]; ++ int der_len; ++ long l; ++ int len; ++ ++ asn1_length_der (num, der, &der_len); ++ ++ der_len = sizeof (der); ++ l = asn1_get_length_der (der, der_len, &len); ++ ++ if (l != -4L) ++ { ++ grub_fatal ("ERROR: asn1_get_length_der overflow-small (l %ld len %d)\n", ++ l, len); ++ return; ++ } ++ } ++ ++ /* Test that values larger than would fit in the input string are ++ rejected. This problem was fixed in libtasn1 2.12. */ ++ { ++ unsigned long num = 1073741824; ++ unsigned char der[20]; ++ int der_len; ++ long l; ++ int len; ++ ++ asn1_length_der (num, der, &der_len); ++ ++ der_len = sizeof (der); ++ l = asn1_get_length_der (der, der_len, &len); ++ ++ if (l != -4L) ++ { ++ grub_fatal ("ERROR: asn1_get_length_der overflow-large1 (l %ld len %d)\n", ++ l, len); ++ return; ++ } ++ } ++ ++ /* Test that values larger than would fit in the input string are ++ rejected. This problem was fixed in libtasn1 2.12. */ ++ { ++ unsigned long num = 2147483649; ++ unsigned char der[20]; ++ int der_len; ++ long l; ++ int len; ++ ++ asn1_length_der (num, der, &der_len); ++ ++ der_len = sizeof (der); ++ l = asn1_get_length_der (der, der_len, &len); ++ ++ if (l != -2L) ++ { ++ grub_fatal ("ERROR: asn1_get_length_der overflow-large2 (l %ld len %d)\n", ++ l, len); ++ return; ++ } ++ } ++} +diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_simple.c b/grub-core/lib/libtasn1_wrap/tests/Test_simple.c +new file mode 100644 +index 00000000000..9f01006ddf4 +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/Test_simple.c +@@ -0,0 +1,207 @@ ++/* ++ * Copyright (C) 2011-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ * Written by Simon Josefsson ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include "../wrap_tests.h" ++ ++struct tv ++{ ++ int bitlen; ++ const char *bitstr; ++ int derlen; ++ const char *der; ++}; ++ ++static const struct tv tv[] = { ++ {0, "", 2, "\x01\x00"}, ++ {1, "\x00", 3, "\x02\x07\x00"}, ++ {2, "\x00", 3, "\x02\x06\x00"}, ++ {3, "\x00", 3, "\x02\x05\x00"}, ++ {4, "\x00", 3, "\x02\x04\x00"}, ++ {5, "\x00", 3, "\x02\x03\x00"}, ++ {6, "\x00", 3, "\x02\x02\x00"}, ++ {7, "\x00", 3, "\x02\x01\x00"}, ++ {8, "\x00\x00", 3, "\x02\x00\x00"}, ++ {9, "\x00\x00", 4, "\x03\x07\x00\x00"}, ++ {10, "\x00\x00", 4, "\x03\x06\x00\x00"}, ++ {11, "\x00\x00", 4, "\x03\x05\x00\x00"}, ++ {12, "\x00\x00", 4, "\x03\x04\x00\x00"}, ++ {13, "\x00\x00", 4, "\x03\x03\x00\x00"}, ++ {14, "\x00\x00", 4, "\x03\x02\x00\x00"}, ++ {15, "\x00\x00", 4, "\x03\x01\x00\x00"}, ++ {16, "\x00\x00", 4, "\x03\x00\x00\x00"}, ++ {17, "\x00\x00\x00", 5, "\x04\x07\x00\x00\x00"}, ++ {18, "\x00\x00\x00", 5, "\x04\x06\x00\x00\x00"}, ++ {19, "\x00\x00\x00", 5, "\x04\x05\x00\x00\x00"}, ++ {1, "\xFF", 3, "\x02\x07\x80"}, ++ {2, "\xFF", 3, "\x02\x06\xc0"}, ++ {3, "\xFF", 3, "\x02\x05\xe0"}, ++ {4, "\xFF", 3, "\x02\x04\xf0"}, ++ {5, "\xFF", 3, "\x02\x03\xf8"}, ++ {6, "\xFF", 3, "\x02\x02\xfc"}, ++ {7, "\xFF", 3, "\x02\x01\xfe"}, ++ {8, "\xFF\xFF", 3, "\x02\x00\xff"}, ++ {9, "\xFF\xFF", 4, "\x03\x07\xff\x80"}, ++ {10, "\xFF\xFF", 4, "\x03\x06\xff\xc0"}, ++ {11, "\xFF\xFF", 4, "\x03\x05\xff\xe0"}, ++ {12, "\xFF\xFF", 4, "\x03\x04\xff\xf0"}, ++ {13, "\xFF\xFF", 4, "\x03\x03\xff\xf8"}, ++ {14, "\xFF\xFF", 4, "\x03\x02\xff\xfc"}, ++ {15, "\xFF\xFF", 4, "\x03\x01\xff\xfe"}, ++ {16, "\xFF\xFF", 4, "\x03\x00\xff\xff"}, ++ {17, "\xFF\xFF\xFF", 5, "\x04\x07\xff\xff\x80"}, ++ {18, "\xFF\xFF\xFF", 5, "\x04\x06\xff\xff\xc0"}, ++ {19, "\xFF\xFF\xFF", 5, "\x04\x05\xff\xff\xe0"}, ++}; ++ ++void ++test_simple (void) ++{ ++ int result; ++ unsigned char der[100]; ++ unsigned char str[100]; ++ int der_len = sizeof (der); ++ int str_size = sizeof (str); ++ int ret_len, bit_len; ++ grub_size_t i; ++ ++ /* Dummy test */ ++ ++ asn1_bit_der (NULL, 0, der, &der_len); ++ result = asn1_get_bit_der (der, 0, &ret_len, str, str_size, &bit_len); ++ if (result != ASN1_GENERIC_ERROR) ++ { ++ grub_fatal ("asn1_get_bit_der zero\n"); ++ return; ++ } ++ ++ /* Encode short strings with increasing bit lengths */ ++ ++ for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++) ++ { ++ /* Encode */ ++ ++ asn1_bit_der ((const unsigned char *) tv[i].bitstr, tv[i].bitlen, ++ der, &der_len); ++ ++#if 0 ++ { ++ size_t j; ++ for (j = 0; j < der_len; j++) ++ printf ("\\x%02x", der[j]); ++ printf ("\n"); ++ } ++#endif ++ ++ if (der_len != tv[i].derlen || grub_memcmp (der, tv[i].der, der_len) != 0) ++ { ++ grub_fatal ("asn1_bit_der iter %lu\n", (unsigned long) i); ++ return; ++ } ++ ++ /* Decode it */ ++ ++ result = asn1_get_bit_der (der, der_len, &ret_len, str, ++ str_size, &bit_len); ++ if (result != ASN1_SUCCESS || ret_len != tv[i].derlen ++ || bit_len != tv[i].bitlen) ++ { ++ grub_fatal ("asn1_get_bit_der iter %lu, err: %d\n", (unsigned long) i, result); ++ return; ++ } ++ } ++ ++ ++ /* Decode sample from "A Layman's Guide to a Subset of ASN.1, BER, ++ and DER" section 5.4 "BIT STRING": "The BER encoding of the BIT ++ STRING value "011011100101110111" can be any of the following, ++ among others, depending on the choice of padding bits, the form ++ of length octets [...]". ++ */ ++ ++ /* 03 04 06 6e 5d c0 DER encoding */ ++ ++ grub_memcpy (der, "\x04\x06\x6e\x5d\xc0", 5); ++ der_len = 5; ++ ++ result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len); ++ if (result != ASN1_SUCCESS || ret_len != 5 ++ || bit_len != 18 || grub_memcmp (str, "\x6e\x5d\xc0", 3) != 0) ++ { ++ grub_fatal ("asn1_get_bit_der example\n"); ++ return; ++ } ++ ++ der_len = sizeof (der); ++ asn1_bit_der (str, bit_len, der, &der_len); ++ if (der_len != 5 || grub_memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0) ++ { ++ grub_fatal ("asn1_bit_der example roundtrip\n"); ++ return; ++ } ++ ++ /* 03 04 06 6e 5d e0 padded with "100000" */ ++ ++ grub_memcpy (der, "\x04\x06\x6e\x5d\xe0", 5); ++ der_len = 5; ++ ++ result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len); ++ if (result != ASN1_SUCCESS || ret_len != 5 ++ || bit_len != 18 || grub_memcmp (str, "\x6e\x5d\xe0", 3) != 0) ++ { ++ grub_fatal ("asn1_get_bit_der example padded\n"); ++ return; ++ } ++ ++ der_len = sizeof (der); ++ asn1_bit_der (str, bit_len, der, &der_len); ++ if (der_len != 5 || grub_memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0) ++ { ++ grub_fatal ("asn1_bit_der example roundtrip\n"); ++ return; ++ } ++ ++ /* 03 81 04 06 6e 5d c0 long form of length octets */ ++ ++ grub_memcpy (der, "\x81\x04\x06\x6e\x5d\xc0", 6); ++ der_len = 6; ++ ++ result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len); ++ ++ if (result != ASN1_SUCCESS || ret_len != 6 ++ || bit_len != 18 || grub_memcmp (str, "\x6e\x5d\xc0", 3) != 0) ++ { ++ grub_fatal ("asn1_get_bit_der example long form\n"); ++ return; ++ } ++ ++ der_len = sizeof (der); ++ asn1_bit_der (str, bit_len, der, &der_len); ++ if (der_len != 5 || grub_memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0) ++ { ++ grub_fatal ("asn1_bit_der example roundtrip\n"); ++ return; ++ } ++} +diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_strings.c b/grub-core/lib/libtasn1_wrap/tests/Test_strings.c +new file mode 100644 +index 00000000000..dbe1474b204 +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/Test_strings.c +@@ -0,0 +1,150 @@ ++/* ++ * Copyright (C) 2012-2014 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ * Written by Simon Josefsson ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include "../wrap_tests.h" ++ ++struct tv ++{ ++ unsigned int etype; ++ unsigned int str_len; ++ const void *str; ++ unsigned int der_len; ++ const void *der; ++}; ++ ++static const struct tv tv[] = { ++ {ASN1_ETYPE_IA5_STRING, 20, ++ "\x63\x73\x63\x61\x40\x70\x61\x73\x73\x70\x6f\x72\x74\x2e\x67\x6f\x76\x2e\x67\x72", ++ 22, ++ "\x16\x14\x63\x73\x63\x61\x40\x70\x61\x73\x73\x70\x6f\x72\x74\x2e\x67\x6f\x76\x2e\x67\x72"}, ++ {ASN1_ETYPE_PRINTABLE_STRING, 5, "\x4e\x69\x6b\x6f\x73", ++ 7, "\x13\x05\x4e\x69\x6b\x6f\x73"}, ++ {ASN1_ETYPE_UTF8_STRING, 12, "Αττική", ++ 14, "\x0c\x0c\xce\x91\xcf\x84\xcf\x84\xce\xb9\xce\xba\xce\xae"}, ++ {ASN1_ETYPE_TELETEX_STRING, 15, ++ "\x53\x69\x6d\x6f\x6e\x20\x4a\x6f\x73\x65\x66\x73\x73\x6f\x6e", ++ 17, ++ "\x14\x0f\x53\x69\x6d\x6f\x6e\x20\x4a\x6f\x73\x65\x66\x73\x73\x6f\x6e"}, ++ {ASN1_ETYPE_OCTET_STRING, 36, ++ "\x30\x22\x80\x0F\x32\x30\x31\x31\x30\x38\x32\x31\x30\x38\x30\x30\x30\x36\x5A\x81\x0F\x32\x30\x31\x31\x30\x38\x32\x33\x32\x30\x35\x39\x35\x39\x5A", ++ 38, ++ "\x04\x24\x30\x22\x80\x0F\x32\x30\x31\x31\x30\x38\x32\x31\x30\x38\x30\x30\x30\x36\x5A\x81\x0F\x32\x30\x31\x31\x30\x38\x32\x33\x32\x30\x35\x39\x35\x39\x5A"} ++}; ++ ++#define SSTR(x) sizeof(x)-1,x ++static const struct tv ber[] = { ++ {ASN1_ETYPE_OCTET_STRING, ++ SSTR("\xa0\xa0"), ++ SSTR("\x24\x80\x04\x82\x00\x02\xa0\xa0\x00\x00")}, ++ {ASN1_ETYPE_OCTET_STRING, ++ SSTR("\xa0\xa0\xb0\xb0\xb0"), ++ SSTR("\x24\x80\x04\x82\x00\x02\xa0\xa0\x04\x82\x00\x03\xb0\xb0\xb0\x00\x00")}, ++ {ASN1_ETYPE_OCTET_STRING, ++ SSTR("\xa0\xa0\xb0\xb0\xb0\xa1\xa1"), ++ SSTR("\x24\x80\x04\x82\x00\x02\xa0\xa0\x04\x82\x00\x03\xb0\xb0\xb0\x24\x80\x04\x82\x00\x02\xa1\xa1\x00\x00\x00\x00")}, ++ {ASN1_ETYPE_OCTET_STRING, ++ SSTR("\xa0\xa0\xb0\xb0\xb0\xa1\xa1\xc1"), ++ SSTR("\x24\x80\x04\x82\x00\x02\xa0\xa0\x04\x82\x00\x03\xb0\xb0\xb0\x24\x80\x04\x82\x00\x02\xa1\xa1\x04\x82\x00\x01\xc1\x00\x00\x00\x00")}, ++}; ++ ++void ++test_strings () ++{ ++ int ret; ++ unsigned char tl[ASN1_MAX_TL_SIZE]; ++ unsigned int tl_len, der_len, str_len; ++ const unsigned char *str; ++ unsigned char *b; ++ unsigned int i; ++ ++ /* Dummy test */ ++ ++ for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++) ++ { ++ /* Encode */ ++ tl_len = sizeof (tl); ++ ret = asn1_encode_simple_der (tv[i].etype, tv[i].str, tv[i].str_len, ++ tl, &tl_len); ++ if (ret != ASN1_SUCCESS) ++ { ++ grub_fatal ("Encoding error in %u: %s\n", i, ++ asn1_strerror (ret)); ++ return; ++ } ++ der_len = tl_len + tv[i].str_len; ++ ++ if (der_len != tv[i].der_len || grub_memcmp (tl, tv[i].der, tl_len) != 0) ++ { ++ grub_fatal ( ++ "DER encoding differs in %u! (size: %u, expected: %u)\n", ++ i, der_len, tv[i].der_len); ++ return; ++ } ++ ++ /* decoding */ ++ ret = ++ asn1_decode_simple_der (tv[i].etype, tv[i].der, tv[i].der_len, &str, ++ &str_len); ++ if (ret != ASN1_SUCCESS) ++ { ++ grub_fatal ("Decoding error in %u: %s\n", i, ++ asn1_strerror (ret)); ++ return; ++ } ++ ++ if (str_len != tv[i].str_len || grub_memcmp (str, tv[i].str, str_len) != 0) ++ { ++ grub_fatal ( ++ "DER decoded data differ in %u! (size: %u, expected: %u)\n", ++ i, der_len, tv[i].str_len); ++ return; ++ } ++ } ++ ++ /* BER decoding */ ++ for (i = 0; i < sizeof (ber) / sizeof (ber[0]); i++) ++ { ++ /* decoding */ ++ ret = ++ asn1_decode_simple_ber (ber[i].etype, ber[i].der, ber[i].der_len, &b, ++ &str_len, NULL); ++ if (ret != ASN1_SUCCESS) ++ { ++ grub_fatal ("BER decoding error in %u: %s\n", i, ++ asn1_strerror (ret)); ++ return; ++ } ++ ++ if (str_len != ber[i].str_len || grub_memcmp (b, ber[i].str, str_len) != 0) ++ { ++ grub_fatal ( ++ "BER decoded data differ in %u! (size: %u, expected: %u)\n", ++ i, str_len, ber[i].str_len); ++ return; ++ } ++ grub_free(b); ++ } ++} +diff --git a/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c b/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c +new file mode 100644 +index 00000000000..d367bbfb5a7 +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c +@@ -0,0 +1,116 @@ ++/* ++ * Copyright (C) 2016 Red Hat, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include "../wrap_tests.h" ++ ++struct tv ++{ ++ int der_len; ++ const unsigned char *der; ++ const char *oid; ++ int expected_error; ++}; ++ ++static const struct tv tv[] = { ++ {.der_len = 5, ++ .der = (void *) "\x06\x03\x80\x37\x03", ++ .oid = "2.999.3", ++ .expected_error = ASN1_DER_ERROR /* leading 0x80 */ ++ }, ++ {.der_len = 12, ++ .der = (void *) "\x06\x0a\x2b\x06\x01\x80\x01\x92\x08\x09\x05\x01", ++ .oid = "1.3.6.1.4.1.2312.9.5.1", ++ .expected_error = ASN1_DER_ERROR /* leading 0x80 */ ++ }, ++ {.der_len = 6, ++ .der = (void *) "\x06\x04\x01\x02\x03\x04", ++ .oid = "0.1.2.3.4", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 5, ++ .der = (void *) "\x06\x03\x51\x02\x03", ++ .oid = "2.1.2.3", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 5, ++ .der = (void *) "\x06\x03\x88\x37\x03", ++ .oid = "2.999.3", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 12, ++ .der = (void *) "\x06\x0a\x2b\x06\x01\x04\x01\x92\x08\x09\x05\x01", ++ .oid = "1.3.6.1.4.1.2312.9.5.1", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 19, ++ .der = (void *) "\x06\x11\xfa\x80\x00\x00\x00\x0e\x01\x0e\xfa\x80\x00\x00\x00\x0e\x63\x6f\x6d", ++ .oid = "2.1998768.0.0.14.1.14.1998848.0.0.14.99.111.109", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 19, ++ .der = ++ (void *) ++ "\x06\x11\x2b\x06\x01\x04\x01\x92\x08\x09\x02\xaa\xda\xbe\xbe\xfa\x72\x01\x07", ++ .oid = "1.3.6.1.4.1.2312.9.2.1467399257458.1.7", ++ .expected_error = ASN1_SUCCESS}, ++}; ++ ++void ++test_object_id_decoding (void) ++{ ++ char str[128]; ++ int ret, ret_len; ++ grub_size_t i; ++ ++ for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++) ++ { ++ /* decode */ ++ ret = ++ asn1_get_object_id_der (tv[i].der+1, ++ tv[i].der_len-1, &ret_len, str, ++ sizeof (str)); ++ if (ret != tv[i].expected_error) ++ { ++ grub_fatal ( ++ "%d: asn1_get_object_id_der iter %lu: got '%s' expected %d\n", ++ __LINE__, (unsigned long) i, asn1_strerror(ret), tv[i].expected_error); ++ return; ++ } ++ ++ if (tv[i].expected_error != ASN1_SUCCESS) ++ continue; ++ ++ if (ret_len != tv[i].der_len-1) ++ { ++ grub_fatal ( ++ "%d: iter %lu: error in DER, length returned is %d, had %d\n", ++ __LINE__, (unsigned long)i, ret_len, tv[i].der_len-1); ++ return; ++ } ++ ++ if (grub_strcmp (tv[i].oid, str) != 0) ++ { ++ grub_fatal ( ++ "%d: strcmp iter %lu: got invalid OID: %s, expected: %s\n", ++ __LINE__, (unsigned long) i, str, tv[i].oid); ++ return; ++ } ++ ++ } ++} +diff --git a/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c b/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c +new file mode 100644 +index 00000000000..3a83b58c59f +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c +@@ -0,0 +1,120 @@ ++/* ++ * Copyright (C) 2019 Nikos Mavrogiannopoulos ++ * ++ * This file is part of LIBTASN1. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include "../wrap_tests.h" ++ ++struct tv ++{ ++ int der_len; ++ const unsigned char *der; ++ const char *oid; ++ int expected_error; ++}; ++ ++static const struct tv tv[] = { ++ {.der_len = 0, ++ .der = (void *) "", ++ .oid = "5.999.3", ++ .expected_error = ASN1_VALUE_NOT_VALID /* cannot start with 5 */ ++ }, ++ {.der_len = 0, ++ .der = (void *) "", ++ .oid = "0.48.9", ++ .expected_error = ASN1_VALUE_NOT_VALID /* second field cannot be 48 */ ++ }, ++ {.der_len = 0, ++ .der = (void *) "", ++ .oid = "1.40.9", ++ .expected_error = ASN1_VALUE_NOT_VALID /* second field cannot be 40 */ ++ }, ++ {.der_len = 4, ++ .der = (void *) "\x06\x02\x4f\x63", ++ .oid = "1.39.99", ++ .expected_error = ASN1_SUCCESS, ++ }, ++ {.der_len = 6, ++ .der = (void *) "\x06\x04\x01\x02\x03\x04", ++ .oid = "0.1.2.3.4", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 5, ++ .der = (void *) "\x06\x03\x51\x02\x03", ++ .oid = "2.1.2.3", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 5, ++ .der = (void *) "\x06\x03\x88\x37\x03", ++ .oid = "2.999.3", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 12, ++ .der = (void *) "\x06\x0a\x2b\x06\x01\x04\x01\x92\x08\x09\x05\x01", ++ .oid = "1.3.6.1.4.1.2312.9.5.1", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 19, ++ .der = (void *) "\x06\x11\xfa\x80\x00\x00\x00\x0e\x01\x0e\xfa\x80\x00\x00\x00\x0e\x63\x6f\x6d", ++ .oid = "2.1998768.0.0.14.1.14.1998848.0.0.14.99.111.109", ++ .expected_error = ASN1_SUCCESS}, ++ {.der_len = 19, ++ .der = ++ (void *) ++ "\x06\x11\x2b\x06\x01\x04\x01\x92\x08\x09\x02\xaa\xda\xbe\xbe\xfa\x72\x01\x07", ++ .oid = "1.3.6.1.4.1.2312.9.2.1467399257458.1.7", ++ .expected_error = ASN1_SUCCESS}, ++}; ++ ++void ++test_object_id_encoding(void) ++{ ++ unsigned char der[128]; ++ int ret, der_len, i; ++ ++ for (i = 0; i < (int)(sizeof (tv) / sizeof (tv[0])); i++) ++ { ++ der_len = sizeof(der); ++ ret = asn1_object_id_der(tv[i].oid, der, &der_len, 0); ++ if (ret != ASN1_SUCCESS) ++ { ++ if (ret == tv[i].expected_error) ++ continue; ++ grub_fatal ( ++ "%d: iter %lu, encoding of OID failed: %s\n", ++ __LINE__, (unsigned long) i, asn1_strerror(ret)); ++ return; ++ } ++ else if (ret != tv[i].expected_error) ++ { ++ grub_fatal ( ++ "%d: iter %lu, encoding of OID %s succeeded when expecting failure\n", ++ __LINE__, (unsigned long) i, tv[i].oid); ++ return; ++ } ++ ++ if (der_len != tv[i].der_len || grub_memcmp(der, tv[i].der, der_len) != 0) ++ { ++ grub_fatal ( ++ "%d: iter %lu, re-encoding of OID %s resulted to different string (%d vs %d bytes)\n", ++ __LINE__, (unsigned long) i, tv[i].oid, der_len, tv[i].der_len); ++ ++ return; ++ } ++ } ++} +diff --git a/grub-core/lib/libtasn1_wrap/tests/octet-string.c b/grub-core/lib/libtasn1_wrap/tests/octet-string.c +new file mode 100644 +index 00000000000..d8a049e8df0 +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/octet-string.c +@@ -0,0 +1,211 @@ ++/* ++ * Copyright (C) 2011-2020 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ * Written by Simon Josefsson and Nikos Mavrogiannopoulos ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include "../wrap_tests.h" ++ ++ ++struct tv ++{ ++ const char *name; ++ int der_len; ++ const unsigned char *der_str; ++ int len; ++ const unsigned char *string; ++ int expected_error; ++ int ber; ++}; ++ ++static const struct tv tv[] = { ++ {.name = "primitive octet strings", ++ .der_len = 10, ++ .der_str = ++ (void*)"\x04\x08\x01\x23\x45\x67\x89\xab\xcd\xef", ++ .len = 8, ++ .string = ++ (void*)"\x01\x23\x45\x67\x89\xab\xcd\xef", ++ .ber = 0}, ++ {.der_len = 22, ++ .der_str = ++ (void*)"\x04\x14\x13\x00\xd9\xa8\x47\xf7\xf2\x1c\xf4\xb0\xec\x5f\xc1\x73\xe5\x1b\x25\xc2\x62\x27", ++ .len = 20, ++ .string = ++ (void*)"\x13\x00\xD9\xA8\x47\xF7\xF2\x1C\xF4\xB0\xEC\x5F\xC1\x73\xE5\x1B\x25\xC2\x62\x27"}, ++ ++ {.name = "long type of length", ++ .der_len = 23, ++ .der_str = ++ (void*)"\x04\x81\x14\x13\x00\xd9\xa8\x47\xf7\xf2\x1c\xf4\xb0\xec\x5f\xc1\x73\xe5\x1b\x25\xc2\x62\x27", ++ .len = 20, ++ .string = ++ (void*)"\x13\x00\xD9\xA8\x47\xF7\xF2\x1C\xF4\xB0\xEC\x5F\xC1\x73\xE5\x1B\x25\xC2\x62\x27", ++ .ber = 1}, ++ {.der_len = 11, ++ .der_str = ++ (void*)"\x04\x81\x08\x01\x23\x45\x67\x89\xab\xcd\xef", ++ .len = 8, ++ .string = ++ (void*)"\x01\x23\x45\x67\x89\xab\xcd\xef", ++ .ber = 1}, ++ ++ {.name = "constructed - indefinite", ++ .der_len = 11, ++ .der_str = (void*)"\x24\x80\x04\x05\x01\x02\x03\x04\x05\x00\x00", ++ .len = 5, ++ .string = (void*)"\x01\x02\x03\x04\x05", ++ .ber = 1, ++ }, ++ ++ {.name = "constructed - definite - concat", ++ .der_len = 12, ++ .der_str = (void*)"\x24\x0a\x04\x04\x0a\x0b\x0c\x0d\x04\x02\x0e\x0f", ++ .len = 6, ++ .string = (void*)"\x0a\x0b\x0c\x0d\x0e\x0f", ++ .ber = 1, ++ }, ++ {.name = "constructed - definite - recursive", ++ .der_len = 15, ++ .der_str = (void*)"\x24\x0d\x04\x04\x0a\x0b\x0c\x0d\x24\x05\x04\x00\x04\x01\x0f", ++ .len = 5, ++ .string = (void*)"\x0a\x0b\x0c\x0d\x0f", ++ .ber = 1, ++ }, ++ {.name = "constructed - definite - single", ++ .der_len = 7, ++ .der_str = (void*)"\x24\x05\x04\x03\x01\x02\x03", ++ .len = 3, ++ .string = (void*)"\x01\x02\x03", ++ .ber = 1, ++ }, ++ ++ /* a large amount of recursive indefinite encoding */ ++ {.name = "a large amount of recursive indefinite encoding", ++ .der_len = 29325, ++ .der_str = (void*)"\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80\x24\x80", ++ .len = 0, ++ .ber = 1, ++ .expected_error = ASN1_DER_ERROR ++ } ++}; ++ ++void ++test_octet_string (void) ++{ ++ unsigned char str[100]; ++ unsigned char der[100]; ++ int der_len = sizeof (der); ++ int str_size = sizeof (str); ++ unsigned char *tmp = NULL; ++ int ret, ret_len; ++ grub_size_t i; ++ ++ for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++) ++ { ++ /* Decode */ ++ ++ if (tv[i].ber == 0) ++ { ++ str_size = sizeof (str); ++ ret = ++ asn1_get_octet_der (tv[i].der_str + 1, ++ tv[i].der_len - 1, &ret_len, str, ++ sizeof (str), &str_size); ++ if (ret != tv[i].expected_error) ++ { ++ grub_fatal ( ++ "%d: asn1_get_octet_der: %s: got %d expected %d\n", ++ __LINE__, tv[i].name, ret, ++ tv[i].expected_error); ++ return; ++ } ++ if (tv[i].expected_error) ++ continue; ++ ++ if (ret_len != tv[i].der_len - 1) ++ { ++ grub_fatal ( ++ "%d: error in DER, length returned is %d, had %d\n", ++ __LINE__, ret_len, tv[i].der_len - 1); ++ return; ++ } ++ ++ if (str_size != tv[i].len ++ || grub_memcmp (tv[i].string, str, tv[i].len) != 0) ++ { ++ grub_fatal ( ++ "%d: memcmp: %s: got invalid decoding\n", ++ __LINE__, tv[i].name); ++ ++ return; ++ } ++ ++ /* Encode */ ++ der_len = sizeof (der); ++ asn1_octet_der (str, str_size, der, &der_len); ++ ++ if (der_len != tv[i].der_len - 1 ++ || grub_memcmp (tv[i].der_str + 1, der, tv[i].der_len - 1) != 0) ++ { ++ grub_fatal ( ++ "encoding: %s: got invalid encoding\n", ++ tv[i].name); ++ return; ++ } ++ } ++ ++ ret = ++ asn1_decode_simple_ber (ASN1_ETYPE_OCTET_STRING, ++ tv[i].der_str, tv[i].der_len, ++ &tmp, (unsigned int*)&str_size, (unsigned int*)&der_len); ++ if (ret != tv[i].expected_error) ++ { ++ grub_fatal ( ++ "%d: asn1_decode_simple_ber: %s: got %s expected %s\n", ++ __LINE__, tv[i].name, asn1_strerror(ret), asn1_strerror(tv[i].expected_error)); ++ return; ++ } ++ if (tv[i].expected_error) ++ continue; ++ ++ if (der_len != tv[i].der_len) ++ { ++ grub_fatal ( ++ "%d: error: %s: DER, length returned is %d, had %d\n", ++ __LINE__, tv[i].name, der_len, tv[i].der_len); ++ return; ++ } ++ ++ if (str_size != tv[i].len || grub_memcmp (tv[i].string, tmp, tv[i].len) != 0) ++ { ++ grub_fatal ( ++ "%d: memcmp: %s: got invalid decoding\n", ++ __LINE__, tv[i].name); ++ return; ++ } ++ grub_free (tmp); ++ tmp = NULL; ++ ++ } ++} +diff --git a/grub-core/lib/libtasn1_wrap/tests/reproducers.c b/grub-core/lib/libtasn1_wrap/tests/reproducers.c +new file mode 100644 +index 00000000000..dc7268d4c6c +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/reproducers.c +@@ -0,0 +1,81 @@ ++/* ++ * Copyright (C) 2019 Free Software Foundation, Inc. ++ * ++ * This file is part of LIBTASN1. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++/****************************************************************/ ++/* Description: run reproducers for several fixed issues */ ++/****************************************************************/ ++ ++#include ++#include ++#include ++#include "../wrap_tests.h" ++ ++#define CONST_DOWN (1U<<29) ++ ++/* produces endless loop (fixed by d4b624b2): ++ * The following translates into a single node with all pointers ++ * (right,left,down) set to NULL. */ ++const asn1_static_node endless_asn1_tab[] = { ++ { "TEST_TREE", 536875024, NULL }, ++ { NULL, 0, NULL } ++}; ++ ++/* produces memory leak (fixed by f16d1ff9): ++ * 152 bytes in 1 blocks are definitely lost in loss record 1 of 1 ++ * at 0x4837B65: calloc (vg_replace_malloc.c:762) ++ * by 0x4851C0D: _asn1_add_static_node (parser_aux.c:71) ++ * by 0x4853AAC: asn1_array2tree (structure.c:200) ++ * by 0x10923B: main (single_node.c:67) ++ */ ++const asn1_static_node tab[] = { ++{ "a", CONST_DOWN, "" }, ++{ "b", 0, "" }, ++{ "c", 0, "" }, ++{ NULL, 0, NULL } ++}; ++ ++void ++test_reproducers (void) ++{ ++ int result; ++ asn1_node definitions = NULL; ++ char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; ++ ++ result = asn1_array2tree (endless_asn1_tab, &definitions, errorDescription); ++ if (result != ASN1_SUCCESS) ++ { ++ grub_fatal ("Error: %s\nErrorDescription = %s\n\n", ++ asn1_strerror (result), errorDescription); ++ return; ++ } ++ ++ asn1_delete_structure (&definitions); ++ ++ definitions = NULL; ++ result = asn1_array2tree (tab, &definitions, errorDescription); ++ if (result != ASN1_SUCCESS) ++ { ++ grub_fatal ("Error: %s\nErrorDescription = %s\n\n", ++ asn1_strerror (result), errorDescription); ++ return; ++ } ++ ++ asn1_delete_structure (&definitions); ++} +diff --git a/grub-core/lib/libtasn1_wrap/wrap_tests.c b/grub-core/lib/libtasn1_wrap/wrap_tests.c +new file mode 100644 +index 00000000000..75fcd21f0d5 +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/wrap_tests.c +@@ -0,0 +1,75 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include "wrap_tests.h" ++ ++/* ++ * libtasn1 tests - from which this is derived - are provided under GPL3+. ++ */ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++static grub_command_t cmd; ++ ++static grub_err_t ++grub_cmd_asn1test (grub_command_t cmdd __attribute__((unused)), ++ int argc __attribute__((unused)), ++ char **args __attribute__((unused))) ++{ ++ grub_printf ("test_CVE_2018_1000654\n"); ++ test_CVE_2018_1000654 (); ++ ++ grub_printf ("test_object_id_decoding\n"); ++ test_object_id_decoding (); ++ ++ grub_printf ("test_object_id_encoding\n"); ++ test_object_id_encoding (); ++ ++ grub_printf ("test_octet_string\n"); ++ test_octet_string (); ++ ++ grub_printf ("test_overflow\n"); ++ test_overflow (); ++ ++ grub_printf ("test_reproducers\n"); ++ test_overflow (); ++ ++ grub_printf ("test_simple\n"); ++ test_simple (); ++ ++ grub_printf ("test_strings\n"); ++ test_strings (); ++ ++ grub_printf ("ASN.1 self-tests passed\n"); ++ ++ return GRUB_ERR_NONE; ++} ++ ++ ++GRUB_MOD_INIT(test_asn1) ++{ ++ cmd = grub_register_command ("test_asn1", grub_cmd_asn1test, NULL, ++ "Run self-tests for the ASN.1 parser."); ++} ++ ++GRUB_MOD_FINI(test_asn1) ++{ ++ grub_unregister_command (cmd); ++} +diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h +new file mode 100644 +index 00000000000..1e7d3d64f55 +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h +@@ -0,0 +1,32 @@ ++#if HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include ++ ++const asn1_static_node CVE_2018_1000654_1_asn1_tab[] = { ++ { "TEST_TREE", 536875024, NULL }, ++ { NULL, 1610612748, NULL }, ++ { "iso", 1073741825, "1"}, ++ { "identified-organization", 1073741825, "3"}, ++ { "dod", 1073741825, "6"}, ++ { "internet", 1073741825, "1"}, ++ { "security", 1073741825, "5"}, ++ { "mechanisms", 1073741825, "5"}, ++ { "pkix", 1073741825, "7"}, ++ { "id-mod", 1073741825, "0"}, ++ { "id-pkix1-implicit-88", 1, "2"}, ++ { "id-xnyTest", 1879048204, NULL }, ++ { NULL, 1073741825, "id-ix"}, ++ { NULL, 1073741825, "29"}, ++ { NULL, 1, "1"}, ++ { "id-ix", 1880096780, "OBJECR"}, ++ { NULL, 1073741825, "id-ix"}, ++ { NULL, 1073741825, "29"}, ++ { NULL, 1, "2"}, ++ { "id-xnyTest", 805306380, NULL }, ++ { NULL, 1073741825, "id-ix"}, ++ { NULL, 1073741825, "29"}, ++ { NULL, 1, "1"}, ++ { NULL, 0, NULL } ++}; +diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h +new file mode 100644 +index 00000000000..e2561e5ec6d +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h +@@ -0,0 +1,36 @@ ++#if HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include ++ ++const asn1_static_node CVE_2018_1000654_2_asn1_tab[] = { ++ { "TEST_TREE", 536875024, NULL }, ++ { NULL, 1610612748, NULL }, ++ { "iso", 1073741825, "1"}, ++ { "identified-organization", 1073741825, "3"}, ++ { "dod", 1073741825, "6"}, ++ { "internet", 1073741825, "1"}, ++ { "security", 1073741825, "5"}, ++ { "mechanisms", 1073741825, "5"}, ++ { "pkix", 1073741825, "7"}, ++ { "id-mod", 1073741825, "0"}, ++ { "id-pkix1-implicit-88", 1, "2"}, ++ { "id-oneTest", 1879048204, NULL }, ++ { NULL, 1073741825, "id-two"}, ++ { NULL, 1073741825, "9"}, ++ { NULL, 1, "1"}, ++ { "id-two", 1879048204, NULL }, ++ { NULL, 1073741825, "id-three"}, ++ { NULL, 1073741825, "2"}, ++ { NULL, 1, "2"}, ++ { "id-three", 1879048204, NULL }, ++ { NULL, 1073741825, "id-four"}, ++ { NULL, 1073741825, "3"}, ++ { NULL, 1, "3"}, ++ { "id-four", 805306380, NULL }, ++ { NULL, 1073741825, "id-two"}, ++ { NULL, 1073741825, "3"}, ++ { NULL, 1, "3"}, ++ { NULL, 0, NULL } ++}; +diff --git a/grub-core/lib/libtasn1_wrap/wrap_tests.h b/grub-core/lib/libtasn1_wrap/wrap_tests.h +new file mode 100644 +index 00000000000..555e56dd202 +--- /dev/null ++++ b/grub-core/lib/libtasn1_wrap/wrap_tests.h +@@ -0,0 +1,38 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#ifndef LIBTASN1_WRAP_TESTS_H ++#define LIBTASN1_WRAP_TESTS_H ++ ++void test_CVE_2018_1000654 (void); ++ ++void test_object_id_encoding (void); ++ ++void test_object_id_decoding (void); ++ ++void test_octet_string (void); ++ ++void test_overflow (void); ++ ++void test_reproducers (void); ++ ++void test_simple (void); ++ ++void test_strings (void); ++ ++#endif +diff --git a/.gitignore b/.gitignore +index b45a633f3d1..0687c3cb5a2 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -148,4 +148,5 @@ grub-*.tar.* + /libgrub_a_init.c + /libgrub_a_init.lst + /stamp-h.in ++/test_asn1 + /widthspec.h +diff --git a/tests/test_asn1.in b/tests/test_asn1.in +new file mode 100644 +index 00000000000..8173c5c270e +--- /dev/null ++++ b/tests/test_asn1.in +@@ -0,0 +1,12 @@ ++#! @BUILD_SHEBANG@ ++set -e ++ ++. "@builddir@/grub-core/modinfo.sh" ++ ++out=`echo test_asn1 | @builddir@/grub-shell` ++ ++if [ "$(echo "$out" | tail -n 1)" != "ASN.1 self-tests passed" ]; then ++ echo "ASN.1 test failure: $out" ++ exit 1 ++fi ++ diff --git a/0298-grub-install-support-embedding-x509-certificates.patch b/0298-grub-install-support-embedding-x509-certificates.patch new file mode 100644 index 00000000..2bc196aa --- /dev/null +++ b/0298-grub-install-support-embedding-x509-certificates.patch @@ -0,0 +1,255 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alastair D'Silva +Date: Mon, 6 Jul 2020 13:33:04 +1000 +Subject: [PATCH] grub-install: support embedding x509 certificates + +To support verification of appended signatures, we need a way to +embed the necessary public keys. Existing appended signature schemes +in the Linux kernel use X.509 certificates, so allow certificates to +be embedded in the grub core image in the same way as PGP keys. + +Signed-off-by: Alastair D'Silva +Signed-off-by: Daniel Axtens +--- + grub-core/commands/pgp.c | 2 +- + util/grub-install-common.c | 23 ++++++++++++++++++++++- + util/grub-mkimage.c | 15 +++++++++++++-- + util/mkimage.c | 41 ++++++++++++++++++++++++++++++++++++++--- + include/grub/kernel.h | 3 ++- + include/grub/util/install.h | 7 +++++-- + 6 files changed, 81 insertions(+), 10 deletions(-) + +diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c +index 4e0667c1cd0..3cd31f50b5b 100644 +--- a/grub-core/commands/pgp.c ++++ b/grub-core/commands/pgp.c +@@ -944,7 +944,7 @@ GRUB_MOD_INIT(pgp) + grub_memset (&pseudo_file, 0, sizeof (pseudo_file)); + + /* Not an ELF module, skip. */ +- if (header->type != OBJ_TYPE_PUBKEY) ++ if (header->type != OBJ_TYPE_GPG_PUBKEY) + continue; + + pseudo_file.fs = &pseudo_fs; +diff --git a/util/grub-install-common.c b/util/grub-install-common.c +index e2be0a3e305..65cde2fa2f0 100644 +--- a/util/grub-install-common.c ++++ b/util/grub-install-common.c +@@ -307,6 +307,8 @@ handle_install_list (struct install_list *il, const char *val, + + static char **pubkeys; + static size_t npubkeys; ++static char **x509keys; ++static size_t nx509keys; + static grub_compression_t compression; + static size_t appsig_size; + +@@ -339,6 +341,12 @@ grub_install_parse (int key, char *arg) + * (npubkeys + 1)); + pubkeys[npubkeys++] = xstrdup (arg); + return 1; ++ case 'x': ++ x509keys = xrealloc (x509keys, ++ sizeof (x509keys[0]) ++ * (nx509keys + 1)); ++ x509keys[nx509keys++] = xstrdup (arg); ++ return 1; + + case GRUB_INSTALL_OPTIONS_VERBOSITY: + verbosity++; +@@ -465,6 +473,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + for (pk = pubkeys; pk < pubkeys + npubkeys; pk++) + slen += 20 + grub_strlen (*pk); + ++ for (pk = x509keys; pk < x509keys + nx509keys; pk++) ++ slen += 10 + grub_strlen (*pk); ++ + for (md = modules.entries; *md; md++) + { + slen += 10 + grub_strlen (*md); +@@ -493,6 +504,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + *p++ = ' '; + } + ++ for (pk = x509keys; pk < x509keys + nx509keys; pk++) ++ { ++ p = grub_stpcpy (p, "--x509 '"); ++ p = grub_stpcpy (p, *pk); ++ *p++ = '\''; ++ *p++ = ' '; ++ } ++ + for (md = modules.entries; *md; md++) + { + *p++ = '\''; +@@ -520,7 +539,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + + grub_install_generate_image (dir, prefix, fp, outname, + modules.entries, memdisk_path, +- pubkeys, npubkeys, config_path, tgt, ++ pubkeys, npubkeys, ++ x509keys, nx509keys, ++ config_path, tgt, + note, appsig_size, compression, dtb); + while (dc--) + grub_install_pop_module (); +diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c +index c1e07c70dc7..6034c51ece4 100644 +--- a/util/grub-mkimage.c ++++ b/util/grub-mkimage.c +@@ -75,7 +75,8 @@ static struct argp_option options[] = { + /* TRANSLATORS: "embed" is a verb (command description). "*/ + {"config", 'c', N_("FILE"), 0, N_("embed FILE as an early config"), 0}, + /* TRANSLATORS: "embed" is a verb (command description). "*/ +- {"pubkey", 'k', N_("FILE"), 0, N_("embed FILE as public key for signature checking"), 0}, ++ {"pubkey", 'k', N_("FILE"), 0, N_("embed FILE as public key for PGP signature checking"), 0}, ++ {"x509", 'x', N_("FILE"), 0, N_("embed FILE as an x509 certificate for appended signature checking"), 0}, + /* TRANSLATORS: NOTE is a name of segment. */ + {"note", 'n', 0, 0, N_("add NOTE segment for CHRP IEEE1275"), 0}, + {"output", 'o', N_("FILE"), 0, N_("output a generated image to FILE [default=stdout]"), 0}, +@@ -122,6 +123,8 @@ struct arguments + char *dtb; + char **pubkeys; + size_t npubkeys; ++ char **x509keys; ++ size_t nx509keys; + char *font; + char *config; + int note; +@@ -202,6 +205,13 @@ argp_parser (int key, char *arg, struct argp_state *state) + arguments->pubkeys[arguments->npubkeys++] = xstrdup (arg); + break; + ++ case 'x': ++ arguments->x509keys = xrealloc (arguments->x509keys, ++ sizeof (arguments->x509keys[0]) ++ * (arguments->nx509keys + 1)); ++ arguments->x509keys[arguments->nx509keys++] = xstrdup (arg); ++ break; ++ + case 'c': + if (arguments->config) + free (arguments->config); +@@ -317,7 +327,8 @@ main (int argc, char *argv[]) + grub_install_generate_image (arguments.dir, arguments.prefix, fp, + arguments.output, arguments.modules, + arguments.memdisk, arguments.pubkeys, +- arguments.npubkeys, arguments.config, ++ arguments.npubkeys, arguments.x509keys, ++ arguments.nx509keys, arguments.config, + arguments.image_target, arguments.note, + arguments.appsig_size, + arguments.comp, arguments.dtb); +diff --git a/util/mkimage.c b/util/mkimage.c +index bd06968decc..5702a00d06f 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -819,8 +819,10 @@ grub_install_get_image_targets_string (void) + void + grub_install_generate_image (const char *dir, const char *prefix, + FILE *out, const char *outname, char *mods[], +- char *memdisk_path, char **pubkey_paths, +- size_t npubkeys, char *config_path, ++ char *memdisk_path, ++ char **pubkey_paths, size_t npubkeys, ++ char **x509key_paths, size_t nx509keys, ++ char *config_path, + const struct grub_install_image_target_desc *image_target, + int note, size_t appsig_size, grub_compression_t comp, const char *dtb_path) + { +@@ -864,6 +866,19 @@ grub_install_generate_image (const char *dir, const char *prefix, + } + } + ++ { ++ size_t i; ++ for (i = 0; i < nx509keys; i++) ++ { ++ size_t curs; ++ curs = ALIGN_ADDR (grub_util_get_image_size (x509key_paths[i])); ++ grub_util_info ("the size of x509 public key %u is 0x%" ++ GRUB_HOST_PRIxLONG_LONG, ++ (unsigned) i, (unsigned long long) curs); ++ total_module_size += curs + sizeof (struct grub_module_header); ++ } ++ } ++ + if (memdisk_path) + { + memdisk_size = ALIGN_UP(grub_util_get_image_size (memdisk_path), 512); +@@ -979,7 +994,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + curs = grub_util_get_image_size (pubkey_paths[i]); + + header = (struct grub_module_header *) (kernel_img + offset); +- header->type = grub_host_to_target32 (OBJ_TYPE_PUBKEY); ++ header->type = grub_host_to_target32 (OBJ_TYPE_GPG_PUBKEY); + header->size = grub_host_to_target32 (curs + sizeof (*header)); + offset += sizeof (*header); + +@@ -988,6 +1003,26 @@ grub_install_generate_image (const char *dir, const char *prefix, + } + } + ++ { ++ size_t i; ++ for (i = 0; i < nx509keys; i++) ++ { ++ size_t curs; ++ struct grub_module_header *header; ++ ++ curs = grub_util_get_image_size (x509key_paths[i]); ++ ++ header = (struct grub_module_header *) (kernel_img + offset); ++ header->type = grub_host_to_target32 (OBJ_TYPE_X509_PUBKEY); ++ header->size = grub_host_to_target32 (curs + sizeof (*header)); ++ offset += sizeof (*header); ++ ++ grub_util_load_image (x509key_paths[i], kernel_img + offset); ++ offset += ALIGN_ADDR (curs); ++ } ++ } ++ ++ + if (memdisk_path) + { + struct grub_module_header *header; +diff --git a/include/grub/kernel.h b/include/grub/kernel.h +index de48cd44ccb..5d54c45cb70 100644 +--- a/include/grub/kernel.h ++++ b/include/grub/kernel.h +@@ -28,7 +28,8 @@ enum + OBJ_TYPE_MEMDISK, + OBJ_TYPE_CONFIG, + OBJ_TYPE_PREFIX, +- OBJ_TYPE_PUBKEY, ++ OBJ_TYPE_GPG_PUBKEY, ++ OBJ_TYPE_X509_PUBKEY, + OBJ_TYPE_DTB + }; + +diff --git a/include/grub/util/install.h b/include/grub/util/install.h +index eb1b83b6d94..8353bafb00a 100644 +--- a/include/grub/util/install.h ++++ b/include/grub/util/install.h +@@ -63,6 +63,8 @@ + /* TRANSLATORS: "embed" is a verb (command description). "*/ \ + { "pubkey", 'k', N_("FILE"), 0, \ + N_("embed FILE as public key for signature checking"), 0}, \ ++ { "x509key", 'x', N_("FILE"), 0, \ ++ N_("embed FILE as an x509 certificate for signature checking"), 0}, \ + { "appended-signature-size", GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE,\ + "SIZE", 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), \ + 1}, \ +@@ -182,8 +184,9 @@ void + grub_install_generate_image (const char *dir, const char *prefix, + FILE *out, + const char *outname, char *mods[], +- char *memdisk_path, char **pubkey_paths, +- size_t npubkeys, ++ char *memdisk_path, ++ char **pubkey_paths, size_t npubkeys, ++ char **x509key_paths, size_t nx509keys, + char *config_path, + const struct grub_install_image_target_desc *image_target, + int note, size_t appsig_size, diff --git a/0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch new file mode 100644 index 00000000..7b7d70c4 --- /dev/null +++ b/0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch @@ -0,0 +1,639 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 30 Jul 2020 01:35:10 +1000 +Subject: [PATCH] appended signatures: import GNUTLS's ASN.1 description files + +In order to parse PKCS#7 messages and X.509 certificates with libtasn1, +we need some information about how they are encoded. + +We get these from GNUTLS, which has the benefit that they support the +features we need and are well tested. + +The GNUTLS license is LGPLv2.1+, which is GPLv3 compatible, allowing +us to import it without issue. + +Signed-off-by: Daniel Axtens +--- + grub-core/commands/appendedsig/gnutls_asn1_tab.c | 121 ++++++ + grub-core/commands/appendedsig/pkix_asn1_tab.c | 484 +++++++++++++++++++++++ + 2 files changed, 605 insertions(+) + create mode 100644 grub-core/commands/appendedsig/gnutls_asn1_tab.c + create mode 100644 grub-core/commands/appendedsig/pkix_asn1_tab.c + +diff --git a/grub-core/commands/appendedsig/gnutls_asn1_tab.c b/grub-core/commands/appendedsig/gnutls_asn1_tab.c +new file mode 100644 +index 00000000000..ddd1314e63b +--- /dev/null ++++ b/grub-core/commands/appendedsig/gnutls_asn1_tab.c +@@ -0,0 +1,121 @@ ++#include ++#include ++ ++const asn1_static_node gnutls_asn1_tab[] = { ++ { "GNUTLS", 536872976, NULL }, ++ { NULL, 1073741836, NULL }, ++ { "RSAPublicKey", 1610612741, NULL }, ++ { "modulus", 1073741827, NULL }, ++ { "publicExponent", 3, NULL }, ++ { "RSAPrivateKey", 1610612741, NULL }, ++ { "version", 1073741827, NULL }, ++ { "modulus", 1073741827, NULL }, ++ { "publicExponent", 1073741827, NULL }, ++ { "privateExponent", 1073741827, NULL }, ++ { "prime1", 1073741827, NULL }, ++ { "prime2", 1073741827, NULL }, ++ { "exponent1", 1073741827, NULL }, ++ { "exponent2", 1073741827, NULL }, ++ { "coefficient", 1073741827, NULL }, ++ { "otherPrimeInfos", 16386, "OtherPrimeInfos"}, ++ { "ProvableSeed", 1610612741, NULL }, ++ { "algorithm", 1073741836, NULL }, ++ { "seed", 7, NULL }, ++ { "OtherPrimeInfos", 1612709899, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "OtherPrimeInfo"}, ++ { "OtherPrimeInfo", 1610612741, NULL }, ++ { "prime", 1073741827, NULL }, ++ { "exponent", 1073741827, NULL }, ++ { "coefficient", 3, NULL }, ++ { "AlgorithmIdentifier", 1610612741, NULL }, ++ { "algorithm", 1073741836, NULL }, ++ { "parameters", 541081613, NULL }, ++ { "algorithm", 1, NULL }, ++ { "DigestInfo", 1610612741, NULL }, ++ { "digestAlgorithm", 1073741826, "DigestAlgorithmIdentifier"}, ++ { "digest", 7, NULL }, ++ { "DigestAlgorithmIdentifier", 1073741826, "AlgorithmIdentifier"}, ++ { "DSAPublicKey", 1073741827, NULL }, ++ { "DSAParameters", 1610612741, NULL }, ++ { "p", 1073741827, NULL }, ++ { "q", 1073741827, NULL }, ++ { "g", 3, NULL }, ++ { "DSASignatureValue", 1610612741, NULL }, ++ { "r", 1073741827, NULL }, ++ { "s", 3, NULL }, ++ { "DSAPrivateKey", 1610612741, NULL }, ++ { "version", 1073741827, NULL }, ++ { "p", 1073741827, NULL }, ++ { "q", 1073741827, NULL }, ++ { "g", 1073741827, NULL }, ++ { "Y", 1073741827, NULL }, ++ { "priv", 3, NULL }, ++ { "DHParameter", 1610612741, NULL }, ++ { "prime", 1073741827, NULL }, ++ { "base", 1073741827, NULL }, ++ { "privateValueLength", 16387, NULL }, ++ { "ECParameters", 1610612754, NULL }, ++ { "namedCurve", 12, NULL }, ++ { "ECPrivateKey", 1610612741, NULL }, ++ { "Version", 1073741827, NULL }, ++ { "privateKey", 1073741831, NULL }, ++ { "parameters", 1610637314, "ECParameters"}, ++ { NULL, 2056, "0"}, ++ { "publicKey", 536895494, NULL }, ++ { NULL, 2056, "1"}, ++ { "PrincipalName", 1610612741, NULL }, ++ { "name-type", 1610620931, NULL }, ++ { NULL, 2056, "0"}, ++ { "name-string", 536879115, NULL }, ++ { NULL, 1073743880, "1"}, ++ { NULL, 27, NULL }, ++ { "KRB5PrincipalName", 1610612741, NULL }, ++ { "realm", 1610620955, NULL }, ++ { NULL, 2056, "0"}, ++ { "principalName", 536879106, "PrincipalName"}, ++ { NULL, 2056, "1"}, ++ { "RSAPSSParameters", 1610612741, NULL }, ++ { "hashAlgorithm", 1610637314, "AlgorithmIdentifier"}, ++ { NULL, 2056, "0"}, ++ { "maskGenAlgorithm", 1610637314, "AlgorithmIdentifier"}, ++ { NULL, 2056, "1"}, ++ { "saltLength", 1610653699, NULL }, ++ { NULL, 1073741833, "20"}, ++ { NULL, 2056, "2"}, ++ { "trailerField", 536911875, NULL }, ++ { NULL, 1073741833, "1"}, ++ { NULL, 2056, "3"}, ++ { "GOSTParameters", 1610612741, NULL }, ++ { "publicKeyParamSet", 1073741836, NULL }, ++ { "digestParamSet", 16396, NULL }, ++ { "GOSTParametersOld", 1610612741, NULL }, ++ { "publicKeyParamSet", 1073741836, NULL }, ++ { "digestParamSet", 1073741836, NULL }, ++ { "encryptionParamSet", 16396, NULL }, ++ { "GOSTPrivateKey", 1073741831, NULL }, ++ { "GOSTPrivateKeyOld", 1073741827, NULL }, ++ { "IssuerSignTool", 1610612741, NULL }, ++ { "signTool", 1073741858, NULL }, ++ { "cATool", 1073741858, NULL }, ++ { "signToolCert", 1073741858, NULL }, ++ { "cAToolCert", 34, NULL }, ++ { "Gost28147-89-EncryptedKey", 1610612741, NULL }, ++ { "encryptedKey", 1073741831, NULL }, ++ { "maskKey", 1610637319, NULL }, ++ { NULL, 4104, "0"}, ++ { "macKey", 7, NULL }, ++ { "SubjectPublicKeyInfo", 1610612741, NULL }, ++ { "algorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "subjectPublicKey", 6, NULL }, ++ { "GostR3410-TransportParameters", 1610612741, NULL }, ++ { "encryptionParamSet", 1073741836, NULL }, ++ { "ephemeralPublicKey", 1610637314, "SubjectPublicKeyInfo"}, ++ { NULL, 4104, "0"}, ++ { "ukm", 7, NULL }, ++ { "GostR3410-KeyTransport", 536870917, NULL }, ++ { "sessionEncryptedKey", 1073741826, "Gost28147-89-EncryptedKey"}, ++ { "transportParameters", 536895490, "GostR3410-TransportParameters"}, ++ { NULL, 4104, "0"}, ++ { NULL, 0, NULL } ++}; +diff --git a/grub-core/commands/appendedsig/pkix_asn1_tab.c b/grub-core/commands/appendedsig/pkix_asn1_tab.c +new file mode 100644 +index 00000000000..adef69d95ce +--- /dev/null ++++ b/grub-core/commands/appendedsig/pkix_asn1_tab.c +@@ -0,0 +1,484 @@ ++#include ++#include ++ ++const asn1_static_node pkix_asn1_tab[] = { ++ { "PKIX1", 536875024, NULL }, ++ { NULL, 1073741836, NULL }, ++ { "PrivateKeyUsagePeriod", 1610612741, NULL }, ++ { "notBefore", 1610637349, NULL }, ++ { NULL, 4104, "0"}, ++ { "notAfter", 536895525, NULL }, ++ { NULL, 4104, "1"}, ++ { "AuthorityKeyIdentifier", 1610612741, NULL }, ++ { "keyIdentifier", 1610637319, NULL }, ++ { NULL, 4104, "0"}, ++ { "authorityCertIssuer", 1610637314, "GeneralNames"}, ++ { NULL, 4104, "1"}, ++ { "authorityCertSerialNumber", 536895490, "CertificateSerialNumber"}, ++ { NULL, 4104, "2"}, ++ { "SubjectKeyIdentifier", 1073741831, NULL }, ++ { "KeyUsage", 1073741830, NULL }, ++ { "DirectoryString", 1610612754, NULL }, ++ { "teletexString", 1612709918, NULL }, ++ { "MAX", 524298, "1"}, ++ { "printableString", 1612709919, NULL }, ++ { "MAX", 524298, "1"}, ++ { "universalString", 1612709920, NULL }, ++ { "MAX", 524298, "1"}, ++ { "utf8String", 1612709922, NULL }, ++ { "MAX", 524298, "1"}, ++ { "bmpString", 1612709921, NULL }, ++ { "MAX", 524298, "1"}, ++ { "ia5String", 538968093, NULL }, ++ { "MAX", 524298, "1"}, ++ { "SubjectAltName", 1073741826, "GeneralNames"}, ++ { "GeneralNames", 1612709899, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "GeneralName"}, ++ { "GeneralName", 1610612754, NULL }, ++ { "otherName", 1610620930, "AnotherName"}, ++ { NULL, 4104, "0"}, ++ { "rfc822Name", 1610620957, NULL }, ++ { NULL, 4104, "1"}, ++ { "dNSName", 1610620957, NULL }, ++ { NULL, 4104, "2"}, ++ { "x400Address", 1610620941, NULL }, ++ { NULL, 4104, "3"}, ++ { "directoryName", 1610620939, NULL }, ++ { NULL, 1073743880, "4"}, ++ { NULL, 2, "RelativeDistinguishedName"}, ++ { "ediPartyName", 1610620941, NULL }, ++ { NULL, 4104, "5"}, ++ { "uniformResourceIdentifier", 1610620957, NULL }, ++ { NULL, 4104, "6"}, ++ { "iPAddress", 1610620935, NULL }, ++ { NULL, 4104, "7"}, ++ { "registeredID", 536879116, NULL }, ++ { NULL, 4104, "8"}, ++ { "AnotherName", 1610612741, NULL }, ++ { "type-id", 1073741836, NULL }, ++ { "value", 541073421, NULL }, ++ { NULL, 1073743880, "0"}, ++ { "type-id", 1, NULL }, ++ { "IssuerAltName", 1073741826, "GeneralNames"}, ++ { "BasicConstraints", 1610612741, NULL }, ++ { "cA", 1610645508, NULL }, ++ { NULL, 131081, NULL }, ++ { "pathLenConstraint", 537411587, NULL }, ++ { "0", 10, "MAX"}, ++ { "CRLDistributionPoints", 1612709899, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "DistributionPoint"}, ++ { "DistributionPoint", 1610612741, NULL }, ++ { "distributionPoint", 1610637314, "DistributionPointName"}, ++ { NULL, 2056, "0"}, ++ { "reasons", 1610637314, "ReasonFlags"}, ++ { NULL, 4104, "1"}, ++ { "cRLIssuer", 536895490, "GeneralNames"}, ++ { NULL, 4104, "2"}, ++ { "DistributionPointName", 1610612754, NULL }, ++ { "fullName", 1610620930, "GeneralNames"}, ++ { NULL, 4104, "0"}, ++ { "nameRelativeToCRLIssuer", 536879106, "RelativeDistinguishedName"}, ++ { NULL, 4104, "1"}, ++ { "ReasonFlags", 1073741830, NULL }, ++ { "ExtKeyUsageSyntax", 1612709899, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 12, NULL }, ++ { "AuthorityInfoAccessSyntax", 1612709899, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "AccessDescription"}, ++ { "AccessDescription", 1610612741, NULL }, ++ { "accessMethod", 1073741836, NULL }, ++ { "accessLocation", 2, "GeneralName"}, ++ { "Attribute", 1610612741, NULL }, ++ { "type", 1073741836, NULL }, ++ { "values", 536870927, NULL }, ++ { NULL, 13, NULL }, ++ { "AttributeTypeAndValue", 1610612741, NULL }, ++ { "type", 1073741836, NULL }, ++ { "value", 13, NULL }, ++ { "Name", 1610612754, NULL }, ++ { "rdnSequence", 536870923, NULL }, ++ { NULL, 2, "RelativeDistinguishedName"}, ++ { "DistinguishedName", 1610612747, NULL }, ++ { NULL, 2, "RelativeDistinguishedName"}, ++ { "RelativeDistinguishedName", 1612709903, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "AttributeTypeAndValue"}, ++ { "Certificate", 1610612741, NULL }, ++ { "tbsCertificate", 1073741826, "TBSCertificate"}, ++ { "signatureAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "signature", 6, NULL }, ++ { "TBSCertificate", 1610612741, NULL }, ++ { "version", 1610653699, NULL }, ++ { NULL, 1073741833, "0"}, ++ { NULL, 2056, "0"}, ++ { "serialNumber", 1073741826, "CertificateSerialNumber"}, ++ { "signature", 1073741826, "AlgorithmIdentifier"}, ++ { "issuer", 1073741826, "Name"}, ++ { "validity", 1073741826, "Validity"}, ++ { "subject", 1073741826, "Name"}, ++ { "subjectPublicKeyInfo", 1073741826, "SubjectPublicKeyInfo"}, ++ { "issuerUniqueID", 1610637314, "UniqueIdentifier"}, ++ { NULL, 4104, "1"}, ++ { "subjectUniqueID", 1610637314, "UniqueIdentifier"}, ++ { NULL, 4104, "2"}, ++ { "extensions", 536895490, "Extensions"}, ++ { NULL, 2056, "3"}, ++ { "CertificateSerialNumber", 1073741827, NULL }, ++ { "Validity", 1610612741, NULL }, ++ { "notBefore", 1073741826, "Time"}, ++ { "notAfter", 2, "Time"}, ++ { "Time", 1610612754, NULL }, ++ { "utcTime", 1073741860, NULL }, ++ { "generalTime", 37, NULL }, ++ { "UniqueIdentifier", 1073741830, NULL }, ++ { "SubjectPublicKeyInfo", 1610612741, NULL }, ++ { "algorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "subjectPublicKey", 6, NULL }, ++ { "Extensions", 1612709899, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "Extension"}, ++ { "Extension", 1610612741, NULL }, ++ { "extnID", 1073741836, NULL }, ++ { "critical", 1610645508, NULL }, ++ { NULL, 131081, NULL }, ++ { "extnValue", 7, NULL }, ++ { "CertificateList", 1610612741, NULL }, ++ { "tbsCertList", 1073741826, "TBSCertList"}, ++ { "signatureAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "signature", 6, NULL }, ++ { "TBSCertList", 1610612741, NULL }, ++ { "version", 1073758211, NULL }, ++ { "signature", 1073741826, "AlgorithmIdentifier"}, ++ { "issuer", 1073741826, "Name"}, ++ { "thisUpdate", 1073741826, "Time"}, ++ { "nextUpdate", 1073758210, "Time"}, ++ { "revokedCertificates", 1610629131, NULL }, ++ { NULL, 536870917, NULL }, ++ { "userCertificate", 1073741826, "CertificateSerialNumber"}, ++ { "revocationDate", 1073741826, "Time"}, ++ { "crlEntryExtensions", 16386, "Extensions"}, ++ { "crlExtensions", 536895490, "Extensions"}, ++ { NULL, 2056, "0"}, ++ { "AlgorithmIdentifier", 1610612741, NULL }, ++ { "algorithm", 1073741836, NULL }, ++ { "parameters", 541081613, NULL }, ++ { "algorithm", 1, NULL }, ++ { "Dss-Sig-Value", 1610612741, NULL }, ++ { "r", 1073741827, NULL }, ++ { "s", 3, NULL }, ++ { "Dss-Parms", 1610612741, NULL }, ++ { "p", 1073741827, NULL }, ++ { "q", 1073741827, NULL }, ++ { "g", 3, NULL }, ++ { "pkcs-7-ContentInfo", 1610612741, NULL }, ++ { "contentType", 1073741836, NULL }, ++ { "content", 541073421, NULL }, ++ { NULL, 1073743880, "0"}, ++ { "contentType", 1, NULL }, ++ { "pkcs-7-DigestInfo", 1610612741, NULL }, ++ { "digestAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "digest", 7, NULL }, ++ { "pkcs-7-SignedData", 1610612741, NULL }, ++ { "version", 1073741827, NULL }, ++ { "digestAlgorithms", 1073741826, "pkcs-7-DigestAlgorithmIdentifiers"}, ++ { "encapContentInfo", 1073741826, "pkcs-7-EncapsulatedContentInfo"}, ++ { "certificates", 1610637314, "pkcs-7-CertificateSet"}, ++ { NULL, 4104, "0"}, ++ { "crls", 1610637314, "pkcs-7-CertificateRevocationLists"}, ++ { NULL, 4104, "1"}, ++ { "signerInfos", 2, "pkcs-7-SignerInfos"}, ++ { "pkcs-7-DigestAlgorithmIdentifiers", 1610612751, NULL }, ++ { NULL, 2, "AlgorithmIdentifier"}, ++ { "pkcs-7-EncapsulatedContentInfo", 1610612741, NULL }, ++ { "eContentType", 1073741836, NULL }, ++ { "eContent", 536895501, NULL }, ++ { NULL, 2056, "0"}, ++ { "pkcs-7-CertificateRevocationLists", 1610612751, NULL }, ++ { NULL, 13, NULL }, ++ { "pkcs-7-CertificateChoices", 1610612754, NULL }, ++ { "certificate", 13, NULL }, ++ { "pkcs-7-CertificateSet", 1610612751, NULL }, ++ { NULL, 2, "pkcs-7-CertificateChoices"}, ++ { "IssuerAndSerialNumber", 1610612741, NULL }, ++ { "issuer", 1073741826, "Name"}, ++ { "serialNumber", 2, "CertificateSerialNumber"}, ++ { "pkcs-7-SignerInfo", 1610612741, NULL }, ++ { "version", 1073741827, NULL }, ++ { "sid", 1073741826, "SignerIdentifier"}, ++ { "digestAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "signedAttrs", 1610637314, "SignedAttributes"}, ++ { NULL, 4104, "0"}, ++ { "signatureAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "signature", 1073741831, NULL }, ++ { "unsignedAttrs", 536895490, "SignedAttributes"}, ++ { NULL, 4104, "1"}, ++ { "SignedAttributes", 1612709903, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "Attribute"}, ++ { "SignerIdentifier", 1610612754, NULL }, ++ { "issuerAndSerialNumber", 1073741826, "IssuerAndSerialNumber"}, ++ { "subjectKeyIdentifier", 536879111, NULL }, ++ { NULL, 4104, "0"}, ++ { "pkcs-7-SignerInfos", 1610612751, NULL }, ++ { NULL, 2, "pkcs-7-SignerInfo"}, ++ { "pkcs-10-CertificationRequestInfo", 1610612741, NULL }, ++ { "version", 1073741827, NULL }, ++ { "subject", 1073741826, "Name"}, ++ { "subjectPKInfo", 1073741826, "SubjectPublicKeyInfo"}, ++ { "attributes", 536879106, "Attributes"}, ++ { NULL, 4104, "0"}, ++ { "Attributes", 1610612751, NULL }, ++ { NULL, 2, "Attribute"}, ++ { "pkcs-10-CertificationRequest", 1610612741, NULL }, ++ { "certificationRequestInfo", 1073741826, "pkcs-10-CertificationRequestInfo"}, ++ { "signatureAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "signature", 6, NULL }, ++ { "pkcs-9-at-challengePassword", 1879048204, NULL }, ++ { "iso", 1073741825, "1"}, ++ { "member-body", 1073741825, "2"}, ++ { "us", 1073741825, "840"}, ++ { "rsadsi", 1073741825, "113549"}, ++ { "pkcs", 1073741825, "1"}, ++ { NULL, 1073741825, "9"}, ++ { NULL, 1, "7"}, ++ { "pkcs-9-challengePassword", 1610612754, NULL }, ++ { "printableString", 1073741855, NULL }, ++ { "utf8String", 34, NULL }, ++ { "pkcs-9-localKeyId", 1073741831, NULL }, ++ { "pkcs-8-PrivateKeyInfo", 1610612741, NULL }, ++ { "version", 1073741827, NULL }, ++ { "privateKeyAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "privateKey", 1073741831, NULL }, ++ { "attributes", 536895490, "Attributes"}, ++ { NULL, 4104, "0"}, ++ { "pkcs-8-EncryptedPrivateKeyInfo", 1610612741, NULL }, ++ { "encryptionAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "encryptedData", 2, "pkcs-8-EncryptedData"}, ++ { "pkcs-8-EncryptedData", 1073741831, NULL }, ++ { "pkcs-5-des-CBC-params", 1612709895, NULL }, ++ { NULL, 1048586, "8"}, ++ { "pkcs-5-des-EDE3-CBC-params", 1612709895, NULL }, ++ { NULL, 1048586, "8"}, ++ { "pkcs-5-aes128-CBC-params", 1612709895, NULL }, ++ { NULL, 1048586, "16"}, ++ { "pkcs-5-aes192-CBC-params", 1612709895, NULL }, ++ { NULL, 1048586, "16"}, ++ { "pkcs-5-aes256-CBC-params", 1612709895, NULL }, ++ { NULL, 1048586, "16"}, ++ { "Gost28147-89-Parameters", 1610612741, NULL }, ++ { "iv", 1073741831, NULL }, ++ { "encryptionParamSet", 12, NULL }, ++ { "pkcs-5-PBE-params", 1610612741, NULL }, ++ { "salt", 1073741831, NULL }, ++ { "iterationCount", 3, NULL }, ++ { "pkcs-5-PBES2-params", 1610612741, NULL }, ++ { "keyDerivationFunc", 1073741826, "AlgorithmIdentifier"}, ++ { "encryptionScheme", 2, "AlgorithmIdentifier"}, ++ { "pkcs-5-PBKDF2-params", 1610612741, NULL }, ++ { "salt", 1610612754, NULL }, ++ { "specified", 1073741831, NULL }, ++ { "otherSource", 2, "AlgorithmIdentifier"}, ++ { "iterationCount", 1611137027, NULL }, ++ { "1", 10, "MAX"}, ++ { "keyLength", 1611153411, NULL }, ++ { "1", 10, "MAX"}, ++ { "prf", 16386, "AlgorithmIdentifier"}, ++ { "pkcs-12-PFX", 1610612741, NULL }, ++ { "version", 1610874883, NULL }, ++ { "v3", 1, "3"}, ++ { "authSafe", 1073741826, "pkcs-7-ContentInfo"}, ++ { "macData", 16386, "pkcs-12-MacData"}, ++ { "pkcs-12-PbeParams", 1610612741, NULL }, ++ { "salt", 1073741831, NULL }, ++ { "iterations", 3, NULL }, ++ { "pkcs-12-MacData", 1610612741, NULL }, ++ { "mac", 1073741826, "pkcs-7-DigestInfo"}, ++ { "macSalt", 1073741831, NULL }, ++ { "iterations", 536903683, NULL }, ++ { NULL, 9, "1"}, ++ { "pkcs-12-AuthenticatedSafe", 1610612747, NULL }, ++ { NULL, 2, "pkcs-7-ContentInfo"}, ++ { "pkcs-12-SafeContents", 1610612747, NULL }, ++ { NULL, 2, "pkcs-12-SafeBag"}, ++ { "pkcs-12-SafeBag", 1610612741, NULL }, ++ { "bagId", 1073741836, NULL }, ++ { "bagValue", 1614815245, NULL }, ++ { NULL, 1073743880, "0"}, ++ { "badId", 1, NULL }, ++ { "bagAttributes", 536887311, NULL }, ++ { NULL, 2, "Attribute"}, ++ { "pkcs-12-CertBag", 1610612741, NULL }, ++ { "certId", 1073741836, NULL }, ++ { "certValue", 541073421, NULL }, ++ { NULL, 1073743880, "0"}, ++ { "certId", 1, NULL }, ++ { "pkcs-12-CRLBag", 1610612741, NULL }, ++ { "crlId", 1073741836, NULL }, ++ { "crlValue", 541073421, NULL }, ++ { NULL, 1073743880, "0"}, ++ { "crlId", 1, NULL }, ++ { "pkcs-12-SecretBag", 1610612741, NULL }, ++ { "secretTypeId", 1073741836, NULL }, ++ { "secretValue", 541073421, NULL }, ++ { NULL, 1073743880, "0"}, ++ { "secretTypeId", 1, NULL }, ++ { "pkcs-7-Data", 1073741831, NULL }, ++ { "pkcs-7-EncryptedData", 1610612741, NULL }, ++ { "version", 1073741827, NULL }, ++ { "encryptedContentInfo", 1073741826, "pkcs-7-EncryptedContentInfo"}, ++ { "unprotectedAttrs", 536895490, "pkcs-7-UnprotectedAttributes"}, ++ { NULL, 4104, "1"}, ++ { "pkcs-7-EncryptedContentInfo", 1610612741, NULL }, ++ { "contentType", 1073741836, NULL }, ++ { "contentEncryptionAlgorithm", 1073741826, "pkcs-7-ContentEncryptionAlgorithmIdentifier"}, ++ { "encryptedContent", 536895495, NULL }, ++ { NULL, 4104, "0"}, ++ { "pkcs-7-ContentEncryptionAlgorithmIdentifier", 1073741826, "AlgorithmIdentifier"}, ++ { "pkcs-7-UnprotectedAttributes", 1612709903, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "Attribute"}, ++ { "ProxyCertInfo", 1610612741, NULL }, ++ { "pCPathLenConstraint", 1611153411, NULL }, ++ { "0", 10, "MAX"}, ++ { "proxyPolicy", 2, "ProxyPolicy"}, ++ { "ProxyPolicy", 1610612741, NULL }, ++ { "policyLanguage", 1073741836, NULL }, ++ { "policy", 16391, NULL }, ++ { "certificatePolicies", 1612709899, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "PolicyInformation"}, ++ { "PolicyInformation", 1610612741, NULL }, ++ { "policyIdentifier", 1073741836, NULL }, ++ { "policyQualifiers", 538984459, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "PolicyQualifierInfo"}, ++ { "PolicyQualifierInfo", 1610612741, NULL }, ++ { "policyQualifierId", 1073741836, NULL }, ++ { "qualifier", 541065229, NULL }, ++ { "policyQualifierId", 1, NULL }, ++ { "CPSuri", 1073741853, NULL }, ++ { "UserNotice", 1610612741, NULL }, ++ { "noticeRef", 1073758210, "NoticeReference"}, ++ { "explicitText", 16386, "DisplayText"}, ++ { "NoticeReference", 1610612741, NULL }, ++ { "organization", 1073741826, "DisplayText"}, ++ { "noticeNumbers", 536870923, NULL }, ++ { NULL, 3, NULL }, ++ { "DisplayText", 1610612754, NULL }, ++ { "ia5String", 1612709917, NULL }, ++ { "200", 524298, "1"}, ++ { "visibleString", 1612709923, NULL }, ++ { "200", 524298, "1"}, ++ { "bmpString", 1612709921, NULL }, ++ { "200", 524298, "1"}, ++ { "utf8String", 538968098, NULL }, ++ { "200", 524298, "1"}, ++ { "OCSPRequest", 1610612741, NULL }, ++ { "tbsRequest", 1073741826, "TBSRequest"}, ++ { "optionalSignature", 536895490, "Signature"}, ++ { NULL, 2056, "0"}, ++ { "TBSRequest", 1610612741, NULL }, ++ { "version", 1610653699, NULL }, ++ { NULL, 1073741833, "0"}, ++ { NULL, 2056, "0"}, ++ { "requestorName", 1610637314, "GeneralName"}, ++ { NULL, 2056, "1"}, ++ { "requestList", 1610612747, NULL }, ++ { NULL, 2, "Request"}, ++ { "requestExtensions", 536895490, "Extensions"}, ++ { NULL, 2056, "2"}, ++ { "Signature", 1610612741, NULL }, ++ { "signatureAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "signature", 1073741830, NULL }, ++ { "certs", 536895499, NULL }, ++ { NULL, 1073743880, "0"}, ++ { NULL, 2, "Certificate"}, ++ { "Request", 1610612741, NULL }, ++ { "reqCert", 1073741826, "CertID"}, ++ { "singleRequestExtensions", 536895490, "Extensions"}, ++ { NULL, 2056, "0"}, ++ { "CertID", 1610612741, NULL }, ++ { "hashAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "issuerNameHash", 1073741831, NULL }, ++ { "issuerKeyHash", 1073741831, NULL }, ++ { "serialNumber", 2, "CertificateSerialNumber"}, ++ { "OCSPResponse", 1610612741, NULL }, ++ { "responseStatus", 1073741826, "OCSPResponseStatus"}, ++ { "responseBytes", 536895490, "ResponseBytes"}, ++ { NULL, 2056, "0"}, ++ { "OCSPResponseStatus", 1610874901, NULL }, ++ { "successful", 1073741825, "0"}, ++ { "malformedRequest", 1073741825, "1"}, ++ { "internalError", 1073741825, "2"}, ++ { "tryLater", 1073741825, "3"}, ++ { "sigRequired", 1073741825, "5"}, ++ { "unauthorized", 1, "6"}, ++ { "ResponseBytes", 1610612741, NULL }, ++ { "responseType", 1073741836, NULL }, ++ { "response", 7, NULL }, ++ { "BasicOCSPResponse", 1610612741, NULL }, ++ { "tbsResponseData", 1073741826, "ResponseData"}, ++ { "signatureAlgorithm", 1073741826, "AlgorithmIdentifier"}, ++ { "signature", 1073741830, NULL }, ++ { "certs", 536895499, NULL }, ++ { NULL, 1073743880, "0"}, ++ { NULL, 2, "Certificate"}, ++ { "ResponseData", 1610612741, NULL }, ++ { "version", 1610653699, NULL }, ++ { NULL, 1073741833, "0"}, ++ { NULL, 2056, "0"}, ++ { "responderID", 1073741826, "ResponderID"}, ++ { "producedAt", 1073741861, NULL }, ++ { "responses", 1610612747, NULL }, ++ { NULL, 2, "SingleResponse"}, ++ { "responseExtensions", 536895490, "Extensions"}, ++ { NULL, 2056, "1"}, ++ { "ResponderID", 1610612754, NULL }, ++ { "byName", 1610620939, NULL }, ++ { NULL, 1073743880, "1"}, ++ { NULL, 2, "RelativeDistinguishedName"}, ++ { "byKey", 536879111, NULL }, ++ { NULL, 2056, "2"}, ++ { "SingleResponse", 1610612741, NULL }, ++ { "certID", 1073741826, "CertID"}, ++ { "certStatus", 1073741826, "CertStatus"}, ++ { "thisUpdate", 1073741861, NULL }, ++ { "nextUpdate", 1610637349, NULL }, ++ { NULL, 2056, "0"}, ++ { "singleExtensions", 536895490, "Extensions"}, ++ { NULL, 2056, "1"}, ++ { "CertStatus", 1610612754, NULL }, ++ { "good", 1610620948, NULL }, ++ { NULL, 4104, "0"}, ++ { "revoked", 1610620930, "RevokedInfo"}, ++ { NULL, 4104, "1"}, ++ { "unknown", 536879106, "UnknownInfo"}, ++ { NULL, 4104, "2"}, ++ { "RevokedInfo", 1610612741, NULL }, ++ { "revocationTime", 1073741861, NULL }, ++ { "revocationReason", 537157653, NULL }, ++ { NULL, 1073743880, "0"}, ++ { "unspecified", 1, "0"}, ++ { "UnknownInfo", 1073741844, NULL }, ++ { "NameConstraints", 1610612741, NULL }, ++ { "permittedSubtrees", 1610637314, "GeneralSubtrees"}, ++ { NULL, 4104, "0"}, ++ { "excludedSubtrees", 536895490, "GeneralSubtrees"}, ++ { NULL, 4104, "1"}, ++ { "GeneralSubtrees", 1612709899, NULL }, ++ { "MAX", 1074266122, "1"}, ++ { NULL, 2, "GeneralSubtree"}, ++ { "GeneralSubtree", 1610612741, NULL }, ++ { "base", 1073741826, "GeneralName"}, ++ { "minimum", 1610653699, NULL }, ++ { NULL, 1073741833, "0"}, ++ { NULL, 4104, "0"}, ++ { "maximum", 536895491, NULL }, ++ { NULL, 4104, "1"}, ++ { "TlsFeatures", 536870923, NULL }, ++ { NULL, 3, NULL }, ++ { NULL, 0, NULL } ++}; diff --git a/0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch new file mode 100644 index 00000000..c638457f --- /dev/null +++ b/0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch @@ -0,0 +1,1542 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 30 Jul 2020 01:33:46 +1000 +Subject: [PATCH] appended signatures: parse PKCS#7 signedData and X.509 + certificates + +This code allows us to parse: + + - PKCS#7 signedData messages. Only a single signerInfo is supported, + which is all that the Linux sign-file utility supports creating + out-of-the-box. Only RSA, SHA-256 and SHA-512 are supported. + Any certificate embedded in the PKCS#7 message will be ignored. + + - X.509 certificates: at least enough to verify the signatures on the + PKCS#7 messages. We expect that the certificates embedded in grub will + be leaf certificates, not CA certificates. The parser enforces this. + +Signed-off-by: Daniel Axtens +--- + grub-core/commands/appendedsig/asn1util.c | 102 +++ + grub-core/commands/appendedsig/pkcs7.c | 305 +++++++++ + grub-core/commands/appendedsig/x509.c | 972 +++++++++++++++++++++++++++ + grub-core/commands/appendedsig/appendedsig.h | 110 +++ + 4 files changed, 1489 insertions(+) + create mode 100644 grub-core/commands/appendedsig/asn1util.c + create mode 100644 grub-core/commands/appendedsig/pkcs7.c + create mode 100644 grub-core/commands/appendedsig/x509.c + create mode 100644 grub-core/commands/appendedsig/appendedsig.h + +diff --git a/grub-core/commands/appendedsig/asn1util.c b/grub-core/commands/appendedsig/asn1util.c +new file mode 100644 +index 00000000000..eff095a9df2 +--- /dev/null ++++ b/grub-core/commands/appendedsig/asn1util.c +@@ -0,0 +1,102 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "appendedsig.h" ++ ++asn1_node _gnutls_gnutls_asn = ASN1_TYPE_EMPTY; ++asn1_node _gnutls_pkix_asn = ASN1_TYPE_EMPTY; ++ ++extern const ASN1_ARRAY_TYPE gnutls_asn1_tab[]; ++extern const ASN1_ARRAY_TYPE pkix_asn1_tab[]; ++ ++/* ++ * Read a value from an ASN1 node, allocating memory to store it. ++ * ++ * It will work for anything where the size libtasn1 returns is right: ++ * - Integers ++ * - Octet strings ++ * - DER encoding of other structures ++ * It will _not_ work for things where libtasn1 size requires adjustment: ++ * - Strings that require an extra NULL byte at the end ++ * - Bit strings because libtasn1 returns the length in bits, not bytes. ++ * ++ * If the function returns a non-NULL value, the caller must free it. ++ */ ++void * ++grub_asn1_allocate_and_read (asn1_node node, const char *name, ++ const char *friendly_name, int *content_size) ++{ ++ int result; ++ grub_uint8_t *tmpstr = NULL; ++ int tmpstr_size = 0; ++ ++ result = asn1_read_value (node, name, NULL, &tmpstr_size); ++ if (result != ASN1_MEM_ERROR) ++ { ++ grub_snprintf (grub_errmsg, sizeof (grub_errmsg), ++ _ ++ ("Reading size of %s did not return expected status: %s"), ++ friendly_name, asn1_strerror (result)); ++ grub_errno = GRUB_ERR_BAD_FILE_TYPE; ++ return NULL; ++ } ++ ++ tmpstr = grub_malloc (tmpstr_size); ++ if (tmpstr == NULL) ++ { ++ grub_snprintf (grub_errmsg, sizeof (grub_errmsg), ++ "Could not allocate memory to store %s", friendly_name); ++ grub_errno = GRUB_ERR_OUT_OF_MEMORY; ++ return NULL; ++ } ++ ++ result = asn1_read_value (node, name, tmpstr, &tmpstr_size); ++ if (result != ASN1_SUCCESS) ++ { ++ grub_free (tmpstr); ++ grub_snprintf (grub_errmsg, sizeof (grub_errmsg), ++ "Error reading %s: %s", ++ friendly_name, asn1_strerror (result)); ++ grub_errno = GRUB_ERR_BAD_FILE_TYPE; ++ return NULL; ++ } ++ ++ *content_size = tmpstr_size; ++ ++ return tmpstr; ++} ++ ++int ++asn1_init (void) ++{ ++ int res; ++ res = asn1_array2tree (gnutls_asn1_tab, &_gnutls_gnutls_asn, NULL); ++ if (res != ASN1_SUCCESS) ++ { ++ return res; ++ } ++ res = asn1_array2tree (pkix_asn1_tab, &_gnutls_pkix_asn, NULL); ++ return res; ++} +diff --git a/grub-core/commands/appendedsig/pkcs7.c b/grub-core/commands/appendedsig/pkcs7.c +new file mode 100644 +index 00000000000..dc6afe203f7 +--- /dev/null ++++ b/grub-core/commands/appendedsig/pkcs7.c +@@ -0,0 +1,305 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include "appendedsig.h" ++#include ++#include ++#include ++ ++ ++static char asn1_error[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; ++ ++/* ++ * RFC 5652 s 5.1 ++ */ ++const char *signedData_oid = "1.2.840.113549.1.7.2"; ++ ++/* ++ * RFC 4055 s 2.1 ++ */ ++const char *sha256_oid = "2.16.840.1.101.3.4.2.1"; ++const char *sha512_oid = "2.16.840.1.101.3.4.2.3"; ++ ++static grub_err_t ++process_content (grub_uint8_t * content, int size, ++ struct pkcs7_signedData *msg) ++{ ++ int res; ++ asn1_node signed_part; ++ grub_err_t err = GRUB_ERR_NONE; ++ char algo_oid[MAX_OID_LEN]; ++ int algo_oid_size = sizeof (algo_oid); ++ int algo_count; ++ char version; ++ int version_size = sizeof (version); ++ grub_uint8_t *result_buf; ++ int result_size = 0; ++ int crls_size = 0; ++ gcry_error_t gcry_err; ++ ++ res = asn1_create_element (_gnutls_pkix_asn, "PKIX1.pkcs-7-SignedData", ++ &signed_part); ++ if (res != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not create ASN.1 structure for PKCS#7 signed part."); ++ } ++ ++ res = asn1_der_decoding2 (&signed_part, content, &size, ++ ASN1_DECODE_FLAG_STRICT_DER, asn1_error); ++ if (res != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Error reading PKCS#7 signed data: %s", asn1_error); ++ goto cleanup_signed_part; ++ } ++ ++ /* SignedData ::= SEQUENCE { ++ * version CMSVersion, ++ * digestAlgorithms DigestAlgorithmIdentifiers, ++ * encapContentInfo EncapsulatedContentInfo, ++ * certificates [0] IMPLICIT CertificateSet OPTIONAL, ++ * crls [1] IMPLICIT RevocationInfoChoices OPTIONAL, ++ * signerInfos SignerInfos } ++ */ ++ ++ /* version per the algo in 5.1, must be 1 */ ++ res = asn1_read_value (signed_part, "version", &version, &version_size); ++ if (res != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Error reading signedData version: %s", ++ asn1_strerror (res)); ++ goto cleanup_signed_part; ++ } ++ ++ if (version != 1) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Unexpected signature version v%d, only v1 supported", ++ version); ++ goto cleanup_signed_part; ++ } ++ ++ /* ++ * digestAlgorithms DigestAlgorithmIdentifiers ++ * ++ * DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier ++ * DigestAlgorithmIdentifer is an X.509 AlgorithmIdentifier (10.1.1) ++ * ++ * RFC 4055 s 2.1: ++ * sha256Identifier AlgorithmIdentifier ::= { id-sha256, NULL } ++ * sha512Identifier AlgorithmIdentifier ::= { id-sha512, NULL } ++ * ++ * We only support 1 element in the set, and we do not check parameters atm. ++ */ ++ res = ++ asn1_number_of_elements (signed_part, "digestAlgorithms", &algo_count); ++ if (res != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Error counting number of digest algorithms: %s", ++ asn1_strerror (res)); ++ goto cleanup_signed_part; ++ } ++ ++ if (algo_count != 1) ++ { ++ err = ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ "Only 1 digest algorithm is supported"); ++ goto cleanup_signed_part; ++ } ++ ++ res = ++ asn1_read_value (signed_part, "digestAlgorithms.?1.algorithm", algo_oid, ++ &algo_oid_size); ++ if (res != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Error reading digest algorithm: %s", ++ asn1_strerror (res)); ++ goto cleanup_signed_part; ++ } ++ ++ if (grub_strncmp (sha512_oid, algo_oid, algo_oid_size) == 0) ++ { ++ msg->hash = grub_crypto_lookup_md_by_name ("sha512"); ++ } ++ else if (grub_strncmp (sha256_oid, algo_oid, algo_oid_size) == 0) ++ { ++ msg->hash = grub_crypto_lookup_md_by_name ("sha256"); ++ } ++ else ++ { ++ err = ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ "Only SHA-256 and SHA-512 hashes are supported, found OID %s", ++ algo_oid); ++ goto cleanup_signed_part; ++ } ++ ++ if (!msg->hash) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Hash algorithm for OID %s not loaded", algo_oid); ++ goto cleanup_signed_part; ++ } ++ ++ /* ++ * We ignore the certificates, but we don't permit CRLs. ++ * A CRL entry might be revoking the certificate we're using, and we have ++ * no way of dealing with that at the moment. ++ */ ++ res = asn1_read_value (signed_part, "crls", NULL, &crls_size); ++ if (res != ASN1_ELEMENT_NOT_FOUND) ++ { ++ err = ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ "PKCS#7 messages with embedded CRLs are not supported"); ++ goto cleanup_signed_part; ++ } ++ ++ /* read the signature */ ++ result_buf = ++ grub_asn1_allocate_and_read (signed_part, "signerInfos.?1.signature", ++ "signature data", &result_size); ++ if (!result_buf) ++ { ++ err = grub_errno; ++ goto cleanup_signed_part; ++ } ++ ++ gcry_err = ++ gcry_mpi_scan (&(msg->sig_mpi), GCRYMPI_FMT_USG, result_buf, result_size, ++ NULL); ++ if (gcry_err != GPG_ERR_NO_ERROR) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Error loading signature into MPI structure: %d", ++ gcry_err); ++ goto cleanup_result; ++ } ++ ++cleanup_result: ++ grub_free (result_buf); ++cleanup_signed_part: ++ asn1_delete_structure (&signed_part); ++ ++ return err; ++} ++ ++grub_err_t ++parse_pkcs7_signedData (void *sigbuf, grub_size_t data_size, ++ struct pkcs7_signedData *msg) ++{ ++ int res; ++ asn1_node content_info; ++ grub_err_t err = GRUB_ERR_NONE; ++ char content_oid[MAX_OID_LEN]; ++ grub_uint8_t *content; ++ int content_size; ++ int content_oid_size = sizeof (content_oid); ++ int size; ++ ++ if (data_size > GRUB_INT_MAX) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "Cannot parse a PKCS#7 message where data size > INT_MAX"); ++ size = (int) data_size; ++ ++ res = asn1_create_element (_gnutls_pkix_asn, ++ "PKIX1.pkcs-7-ContentInfo", &content_info); ++ if (res != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not create ASN.1 structure for PKCS#7 data: %s", ++ asn1_strerror (res)); ++ } ++ ++ res = asn1_der_decoding2 (&content_info, sigbuf, &size, ++ ASN1_DECODE_FLAG_STRICT_DER, asn1_error); ++ if (res != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Error decoding PKCS#7 message DER: %s", asn1_error); ++ goto cleanup; ++ } ++ ++ /* ++ * ContentInfo ::= SEQUENCE { ++ * contentType ContentType, ++ * content [0] EXPLICIT ANY DEFINED BY contentType } ++ * ++ * ContentType ::= OBJECT IDENTIFIER ++ */ ++ res = ++ asn1_read_value (content_info, "contentType", content_oid, ++ &content_oid_size); ++ if (res != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Error reading PKCS#7 content type: %s", ++ asn1_strerror (res)); ++ goto cleanup; ++ } ++ ++ /* OID for SignedData defined in 5.1 */ ++ if (grub_strncmp (signedData_oid, content_oid, content_oid_size) != 0) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_SIGNATURE, ++ "Unexpected content type in PKCS#7 message: OID %s", ++ content_oid); ++ goto cleanup; ++ } ++ ++ content = ++ grub_asn1_allocate_and_read (content_info, "content", ++ "PKCS#7 message content", &content_size); ++ if (!content) ++ { ++ err = grub_errno; ++ goto cleanup; ++ } ++ ++ err = process_content (content, content_size, msg); ++ grub_free (content); ++ ++cleanup: ++ asn1_delete_structure (&content_info); ++ return err; ++} ++ ++/* ++ * Release all the storage associated with the PKCS#7 message. ++ * If the caller dynamically allocated the message, it must free it. ++ */ ++void ++pkcs7_signedData_release (struct pkcs7_signedData *msg) ++{ ++ gcry_mpi_release (msg->sig_mpi); ++} +diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c +new file mode 100644 +index 00000000000..652e4f16870 +--- /dev/null ++++ b/grub-core/commands/appendedsig/x509.c +@@ -0,0 +1,972 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "appendedsig.h" ++ ++static char asn1_error[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; ++ ++/* ++ * RFC 3279 2.3.1 RSA Keys ++ */ ++const char *rsaEncryption_oid = "1.2.840.113549.1.1.1"; ++ ++/* ++ * RFC 5280 Appendix A ++ */ ++const char *commonName_oid = "2.5.4.3"; ++ ++/* ++ * RFC 5280 4.2.1.3 Key Usage ++ */ ++const char *keyUsage_oid = "2.5.29.15"; ++ ++/* ++ * RFC 5280 4.2.1.9 Basic Constraints ++ */ ++const char *basicConstraints_oid = "2.5.29.19"; ++ ++/* ++ * RFC 3279 2.3.1 ++ * ++ * The RSA public key MUST be encoded using the ASN.1 type RSAPublicKey: ++ * ++ * RSAPublicKey ::= SEQUENCE { ++ * modulus INTEGER, -- n ++ * publicExponent INTEGER } -- e ++ * ++ * where modulus is the modulus n, and publicExponent is the public ++ * exponent e. ++ */ ++static grub_err_t ++grub_parse_rsa_pubkey (grub_uint8_t * der, int dersize, ++ struct x509_certificate *certificate) ++{ ++ int result; ++ asn1_node spk = ASN1_TYPE_EMPTY; ++ grub_uint8_t *m_data, *e_data; ++ int m_size, e_size; ++ grub_err_t err = GRUB_ERR_NONE; ++ gcry_error_t gcry_err; ++ ++ result = ++ asn1_create_element (_gnutls_gnutls_asn, "GNUTLS.RSAPublicKey", &spk); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Cannot create storage for public key ASN.1 data"); ++ } ++ ++ result = asn1_der_decoding2 (&spk, der, &dersize, ++ ASN1_DECODE_FLAG_STRICT_DER, asn1_error); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Cannot decode certificate public key DER: %s", ++ asn1_error); ++ goto cleanup; ++ } ++ ++ m_data = ++ grub_asn1_allocate_and_read (spk, "modulus", "RSA modulus", &m_size); ++ if (!m_data) ++ { ++ err = grub_errno; ++ goto cleanup; ++ } ++ ++ e_data = ++ grub_asn1_allocate_and_read (spk, "publicExponent", "RSA public exponent", ++ &e_size); ++ if (!e_data) ++ { ++ err = grub_errno; ++ goto cleanup_m_data; ++ } ++ ++ /* ++ * convert m, e to mpi ++ * ++ * nscanned is not set for FMT_USG, it's only set for FMT_PGP, ++ * so we can't verify it ++ */ ++ gcry_err = ++ gcry_mpi_scan (&certificate->mpis[0], GCRYMPI_FMT_USG, m_data, m_size, ++ NULL); ++ if (gcry_err != GPG_ERR_NO_ERROR) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error loading RSA modulus into MPI structure: %d", ++ gcry_err); ++ goto cleanup_e_data; ++ } ++ ++ gcry_err = ++ gcry_mpi_scan (&certificate->mpis[1], GCRYMPI_FMT_USG, e_data, e_size, ++ NULL); ++ if (gcry_err != GPG_ERR_NO_ERROR) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error loading RSA exponent into MPI structure: %d", ++ gcry_err); ++ goto cleanup_m_mpi; ++ } ++ ++ grub_free (e_data); ++ grub_free (m_data); ++ asn1_delete_structure (&spk); ++ return GRUB_ERR_NONE; ++ ++cleanup_m_mpi: ++ gcry_mpi_release (certificate->mpis[0]); ++cleanup_e_data: ++ grub_free (e_data); ++cleanup_m_data: ++ grub_free (m_data); ++cleanup: ++ asn1_delete_structure (&spk); ++ return err; ++} ++ ++ ++/* ++ * RFC 5280: ++ * SubjectPublicKeyInfo ::= SEQUENCE { ++ * algorithm AlgorithmIdentifier, ++ * subjectPublicKey BIT STRING } ++ * ++ * AlgorithmIdentifiers come from RFC 3279, we are not strictly compilant as we ++ * only support RSA Encryption. ++ */ ++ ++static grub_err_t ++grub_x509_read_subject_public_key (asn1_node asn, ++ struct x509_certificate *results) ++{ ++ int result; ++ grub_err_t err; ++ const char *algo_name = ++ "tbsCertificate.subjectPublicKeyInfo.algorithm.algorithm"; ++ const char *params_name = ++ "tbsCertificate.subjectPublicKeyInfo.algorithm.parameters"; ++ const char *pk_name = ++ "tbsCertificate.subjectPublicKeyInfo.subjectPublicKey"; ++ char algo_oid[MAX_OID_LEN]; ++ int algo_size = sizeof (algo_oid); ++ char params_value[2]; ++ int params_size = sizeof (params_value); ++ grub_uint8_t *key_data = NULL; ++ int key_size = 0; ++ unsigned int key_type; ++ ++ /* algorithm: see notes for rsaEncryption_oid */ ++ result = asn1_read_value (asn, algo_name, algo_oid, &algo_size); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading x509 public key algorithm: %s", ++ asn1_strerror (result)); ++ } ++ ++ if (grub_strncmp (algo_oid, rsaEncryption_oid, sizeof (rsaEncryption_oid)) ++ != 0) ++ { ++ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ "Unsupported x509 public key algorithm: %s", ++ algo_oid); ++ } ++ ++ /* ++ * RFC 3279 2.3.1 ++ * The rsaEncryption OID is intended to be used in the algorithm field ++ * of a value of type AlgorithmIdentifier. The parameters field MUST ++ * have ASN.1 type NULL for this algorithm identifier. ++ */ ++ result = asn1_read_value (asn, params_name, params_value, ¶ms_size); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading x509 public key parameters: %s", ++ asn1_strerror (result)); ++ } ++ ++ if (params_value[0] != ASN1_TAG_NULL) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Invalid x509 public key parameters: expected NULL"); ++ } ++ ++ /* ++ * RFC 3279 2.3.1: The DER encoded RSAPublicKey is the value of the BIT ++ * STRING subjectPublicKey. ++ */ ++ result = asn1_read_value_type (asn, pk_name, NULL, &key_size, &key_type); ++ if (result != ASN1_MEM_ERROR) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading size of x509 public key: %s", ++ asn1_strerror (result)); ++ } ++ if (key_type != ASN1_ETYPE_BIT_STRING) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Unexpected ASN.1 type when reading x509 public key: %x", ++ key_type); ++ } ++ ++ /* length is in bits */ ++ key_size = (key_size + 7) / 8; ++ ++ key_data = grub_malloc (key_size); ++ if (!key_data) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Out of memory for x509 public key"); ++ } ++ ++ result = asn1_read_value (asn, pk_name, key_data, &key_size); ++ if (result != ASN1_SUCCESS) ++ { ++ grub_free (key_data); ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading public key data"); ++ } ++ key_size = (key_size + 7) / 8; ++ ++ err = grub_parse_rsa_pubkey (key_data, key_size, results); ++ grub_free (key_data); ++ ++ return err; ++} ++ ++/* Decode a string as defined in Appendix A */ ++static grub_err_t ++decode_string (char *der, int der_size, char **string, ++ grub_size_t * string_size) ++{ ++ asn1_node strasn; ++ int result; ++ char *choice; ++ int choice_size = 0; ++ int tmp_size = 0; ++ grub_err_t err = GRUB_ERR_NONE; ++ ++ result = ++ asn1_create_element (_gnutls_pkix_asn, "PKIX1.DirectoryString", &strasn); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not create ASN.1 structure for certificate: %s", ++ asn1_strerror (result)); ++ } ++ ++ result = asn1_der_decoding2 (&strasn, der, &der_size, ++ ASN1_DECODE_FLAG_STRICT_DER, asn1_error); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Could not parse DER for DirectoryString: %s", ++ asn1_error); ++ goto cleanup; ++ } ++ ++ choice = ++ grub_asn1_allocate_and_read (strasn, "", "DirectoryString choice", ++ &choice_size); ++ if (!choice) ++ { ++ err = grub_errno; ++ goto cleanup; ++ } ++ ++ if (grub_strncmp ("utf8String", choice, choice_size) == 0) ++ { ++ result = asn1_read_value (strasn, "utf8String", NULL, &tmp_size); ++ if (result != ASN1_MEM_ERROR) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading size of UTF-8 string: %s", ++ asn1_strerror (result)); ++ goto cleanup_choice; ++ } ++ } ++ else if (grub_strncmp("printableString", choice, choice_size) == 0) ++ { ++ result = asn1_read_value (strasn, "printableString", NULL, &tmp_size); ++ if (result != ASN1_MEM_ERROR) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading size of UTF-8 string: %s", ++ asn1_strerror (result)); ++ goto cleanup_choice; ++ } ++ } ++ else ++ { ++ err = ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ "Only UTF-8 and printable DirectoryStrings are supported, got %s", ++ choice); ++ goto cleanup_choice; ++ } ++ ++ /* read size does not include trailing null */ ++ tmp_size++; ++ ++ *string = grub_malloc (tmp_size); ++ if (!*string) ++ { ++ err = ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Cannot allocate memory for DirectoryString contents"); ++ goto cleanup_choice; ++ } ++ ++ result = asn1_read_value (strasn, choice, *string, &tmp_size); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading out %s in DirectoryString: %s", ++ choice, asn1_strerror (result)); ++ grub_free (*string); ++ goto cleanup_choice; ++ } ++ *string_size = tmp_size + 1; ++ (*string)[tmp_size] = '\0'; ++ ++cleanup_choice: ++ grub_free (choice); ++cleanup: ++ asn1_delete_structure (&strasn); ++ return err; ++} ++ ++/* ++ * TBSCertificate ::= SEQUENCE { ++ * version [0] EXPLICIT Version DEFAULT v1, ++ * ... ++ * ++ * Version ::= INTEGER { v1(0), v2(1), v3(2) } ++ */ ++static grub_err_t ++check_version (asn1_node certificate) ++{ ++ int rc; ++ const char *name = "tbsCertificate.version"; ++ grub_uint8_t version; ++ int len = 1; ++ ++ rc = asn1_read_value (certificate, name, &version, &len); ++ ++ /* require version 3 */ ++ if (rc != ASN1_SUCCESS || len != 1) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading certificate version"); ++ ++ if (version != 0x02) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Invalid x509 certificate version, expected v3 (0x02), got 0x%02x", ++ version); ++ ++ return GRUB_ERR_NONE; ++} ++ ++/* ++ * This is an X.501 Name, which is complex. ++ * ++ * For simplicity, we extract only the CN. ++ */ ++static grub_err_t ++read_name (asn1_node asn, const char *name_path, char **name, ++ grub_size_t * name_size) ++{ ++ int seq_components, set_components; ++ int result; ++ int i, j; ++ char *top_path, *set_path, *type_path, *val_path; ++ char type[MAX_OID_LEN]; ++ int type_len = sizeof (type); ++ int string_size = 0; ++ char *string_der; ++ grub_err_t err; ++ ++ *name = NULL; ++ ++ top_path = grub_xasprintf ("%s.rdnSequence", name_path); ++ if (!top_path) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not allocate memory for %s name parsing path", ++ name_path); ++ ++ result = asn1_number_of_elements (asn, top_path, &seq_components); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error counting name components: %s", ++ asn1_strerror (result)); ++ goto cleanup; ++ } ++ ++ for (i = 1; i <= seq_components; i++) ++ { ++ set_path = grub_xasprintf ("%s.?%d", top_path, i); ++ if (!set_path) ++ { ++ err = ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not allocate memory for %s name set parsing path", ++ name_path); ++ goto cleanup_set; ++ } ++ /* this brings us, hopefully, to a set */ ++ result = asn1_number_of_elements (asn, set_path, &set_components); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error counting name sub-components components (element %d): %s", ++ i, asn1_strerror (result)); ++ goto cleanup_set; ++ } ++ for (j = 1; j <= set_components; j++) ++ { ++ type_path = grub_xasprintf ("%s.?%d.?%d.type", top_path, i, j); ++ if (!type_path) ++ { ++ err = ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not allocate memory for %s name component type path", ++ name_path); ++ goto cleanup_set; ++ } ++ type_len = sizeof (type); ++ result = asn1_read_value (asn, type_path, type, &type_len); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading %s name component type: %s", ++ name_path, asn1_strerror (result)); ++ goto cleanup_type; ++ } ++ ++ if (grub_strncmp (type, commonName_oid, type_len) != 0) ++ { ++ grub_free (type_path); ++ continue; ++ } ++ ++ val_path = grub_xasprintf ("%s.?%d.?%d.value", top_path, i, j); ++ if (!val_path) ++ { ++ err = ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not allocate memory for %s name component value path", ++ name_path); ++ goto cleanup_set; ++ } ++ ++ string_der = ++ grub_asn1_allocate_and_read (asn, val_path, name_path, ++ &string_size); ++ if (!string_der) ++ { ++ err = grub_errno; ++ goto cleanup_val_path; ++ } ++ ++ err = decode_string (string_der, string_size, name, name_size); ++ if (err) ++ goto cleanup_string; ++ ++ grub_free (string_der); ++ grub_free (type_path); ++ grub_free (val_path); ++ break; ++ } ++ grub_free (set_path); ++ ++ if (*name) ++ break; ++ } ++ ++ return GRUB_ERR_NONE; ++ ++cleanup_string: ++ grub_free (string_der); ++cleanup_val_path: ++ grub_free (val_path); ++cleanup_type: ++ grub_free (type_path); ++cleanup_set: ++ grub_free (set_path); ++cleanup: ++ grub_free (top_path); ++ return err; ++} ++ ++/* ++ * details here ++ */ ++static grub_err_t ++verify_key_usage (grub_uint8_t * value, int value_size) ++{ ++ asn1_node usageasn; ++ int result; ++ grub_err_t err = GRUB_ERR_NONE; ++ grub_uint8_t usage = 0xff; ++ int usage_size = 1; ++ ++ result = ++ asn1_create_element (_gnutls_pkix_asn, "PKIX1.KeyUsage", &usageasn); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not create ASN.1 structure for key usage"); ++ } ++ ++ result = asn1_der_decoding2 (&usageasn, value, &value_size, ++ ASN1_DECODE_FLAG_STRICT_DER, asn1_error); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error parsing DER for Key Usage: %s", asn1_error); ++ goto cleanup; ++ } ++ ++ result = asn1_read_value (usageasn, "", &usage, &usage_size); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading Key Usage value: %s", ++ asn1_strerror (result)); ++ goto cleanup; ++ } ++ ++ /* Only the first bit is permitted to be set */ ++ if (usage != 0x80) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, "Unexpected Key Usage value: %x", ++ usage); ++ goto cleanup; ++ } ++ ++cleanup: ++ asn1_delete_structure (&usageasn); ++ return err; ++} ++ ++/* ++ * BasicConstraints ::= SEQUENCE { ++ * cA BOOLEAN DEFAULT FALSE, ++ * pathLenConstraint INTEGER (0..MAX) OPTIONAL } ++ */ ++static grub_err_t ++verify_basic_constraints (grub_uint8_t * value, int value_size) ++{ ++ asn1_node basicasn; ++ int result; ++ grub_err_t err = GRUB_ERR_NONE; ++ char cA[6]; /* FALSE or TRUE */ ++ int cA_size = sizeof (cA); ++ ++ result = ++ asn1_create_element (_gnutls_pkix_asn, "PKIX1.BasicConstraints", ++ &basicasn); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not create ASN.1 structure for Basic Constraints"); ++ } ++ ++ result = asn1_der_decoding2 (&basicasn, value, &value_size, ++ ASN1_DECODE_FLAG_STRICT_DER, asn1_error); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error parsing DER for Basic Constraints: %s", ++ asn1_error); ++ goto cleanup; ++ } ++ ++ result = asn1_read_value (basicasn, "cA", cA, &cA_size); ++ if (result == ASN1_ELEMENT_NOT_FOUND) ++ { ++ /* Not present, default is False, so this is OK */ ++ err = GRUB_ERR_NONE; ++ goto cleanup; ++ } ++ else if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading Basic Constraints cA value: %s", ++ asn1_strerror (result)); ++ goto cleanup; ++ } ++ ++ /* The certificate must not be a CA certificate */ ++ if (grub_strncmp ("FALSE", cA, cA_size) != 0) ++ { ++ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "Unexpected CA value: %s", ++ cA); ++ goto cleanup; ++ } ++ ++cleanup: ++ asn1_delete_structure (&basicasn); ++ return err; ++} ++ ++ ++/* ++ * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension ++ * ++ * Extension ::= SEQUENCE { ++ * extnID OBJECT IDENTIFIER, ++ * critical BOOLEAN DEFAULT FALSE, ++ * extnValue OCTET STRING ++ * -- contains the DER encoding of an ASN.1 value ++ * -- corresponding to the extension type identified ++ * -- by extnID ++ * } ++ * ++ * We require that a certificate: ++ * - contain the Digital Signature usage only ++ * - not be a CA ++ * - MUST not contain any other critical extensions (RFC 5280 s 4.2) ++ */ ++static grub_err_t ++verify_extensions (asn1_node cert) ++{ ++ int result; ++ int ext, num_extensions = 0; ++ int usage_present = 0, constraints_present = 0; ++ char *oid_path, *critical_path, *value_path; ++ char extnID[MAX_OID_LEN]; ++ int extnID_size; ++ grub_err_t err; ++ char critical[6]; /* we get either "TRUE" or "FALSE" */ ++ int critical_size; ++ grub_uint8_t *value; ++ int value_size; ++ ++ result = ++ asn1_number_of_elements (cert, "tbsCertificate.extensions", ++ &num_extensions); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error counting number of extensions: %s", ++ asn1_strerror (result)); ++ } ++ ++ if (num_extensions < 2) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Insufficient number of extensions for certificate, need at least 2, got %d", ++ num_extensions); ++ } ++ ++ for (ext = 1; ext <= num_extensions; ext++) ++ { ++ oid_path = grub_xasprintf ("tbsCertificate.extensions.?%d.extnID", ext); ++ ++ extnID_size = sizeof (extnID); ++ result = asn1_read_value (cert, oid_path, extnID, &extnID_size); ++ if (result != GRUB_ERR_NONE) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading extension OID: %s", ++ asn1_strerror (result)); ++ goto cleanup_oid_path; ++ } ++ ++ critical_path = ++ grub_xasprintf ("tbsCertificate.extensions.?%d.critical", ext); ++ critical_size = sizeof (critical); ++ result = ++ asn1_read_value (cert, critical_path, critical, &critical_size); ++ if (result == ASN1_ELEMENT_NOT_FOUND) ++ { ++ critical[0] = '\0'; ++ } ++ else if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading extension criticality: %s", ++ asn1_strerror (result)); ++ goto cleanup_critical_path; ++ } ++ ++ value_path = ++ grub_xasprintf ("tbsCertificate.extensions.?%d.extnValue", ext); ++ value = ++ grub_asn1_allocate_and_read (cert, value_path, ++ "certificate extension value", ++ &value_size); ++ if (!value) ++ { ++ err = grub_errno; ++ goto cleanup_value_path; ++ } ++ ++ /* ++ * Now we must see if we recognise the OID. ++ * If we have an unrecognised critical extension we MUST bail. ++ */ ++ if (grub_strncmp (keyUsage_oid, extnID, extnID_size) == 0) ++ { ++ err = verify_key_usage (value, value_size); ++ if (err != GRUB_ERR_NONE) ++ { ++ goto cleanup_value; ++ } ++ usage_present++; ++ } ++ else if (grub_strncmp (basicConstraints_oid, extnID, extnID_size) == 0) ++ { ++ err = verify_basic_constraints (value, value_size); ++ if (err != GRUB_ERR_NONE) ++ { ++ goto cleanup_value; ++ } ++ constraints_present++; ++ } ++ else if (grub_strncmp ("TRUE", critical, critical_size) == 0) ++ { ++ /* ++ * per the RFC, we must not process a certificate with ++ * a critical extension we do not understand. ++ */ ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Unhandled critical x509 extension with OID %s", ++ extnID); ++ goto cleanup_value; ++ } ++ ++ grub_free (value); ++ grub_free (value_path); ++ grub_free (critical_path); ++ grub_free (oid_path); ++ } ++ ++ if (usage_present != 1) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Unexpected number of Key Usage extensions - expected 1, got %d", ++ usage_present); ++ } ++ if (constraints_present != 1) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Unexpected number of basic constraints extensions - expected 1, got %d", ++ constraints_present); ++ } ++ return GRUB_ERR_NONE; ++ ++cleanup_value: ++ grub_free (value); ++cleanup_value_path: ++ grub_free (value_path); ++cleanup_critical_path: ++ grub_free (critical_path); ++cleanup_oid_path: ++ grub_free (oid_path); ++ return err; ++} ++ ++/* ++ * Parse a certificate whose DER-encoded form is in @data, of size @data_size. ++ * Return the results in @results, which must point to an allocated x509 certificate. ++ */ ++grub_err_t ++certificate_import (void *data, grub_size_t data_size, ++ struct x509_certificate *results) ++{ ++ int result = 0; ++ asn1_node cert; ++ grub_err_t err; ++ int size; ++ int tmp_size; ++ ++ if (data_size > GRUB_INT_MAX) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "Cannot parse a certificate where data size > INT_MAX"); ++ size = (int) data_size; ++ ++ result = asn1_create_element (_gnutls_pkix_asn, "PKIX1.Certificate", &cert); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not create ASN.1 structure for certificate: %s", ++ asn1_strerror (result)); ++ } ++ ++ result = asn1_der_decoding2 (&cert, data, &size, ++ ASN1_DECODE_FLAG_STRICT_DER, asn1_error); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Could not parse DER for certificate: %s", asn1_error); ++ goto cleanup; ++ } ++ ++ /* ++ * TBSCertificate ::= SEQUENCE { ++ * version [0] EXPLICIT Version DEFAULT v1 ++ */ ++ err = check_version (cert); ++ if (err != GRUB_ERR_NONE) ++ { ++ goto cleanup; ++ } ++ ++ /* ++ * serialNumber CertificateSerialNumber, ++ * ++ * CertificateSerialNumber ::= INTEGER ++ */ ++ results->serial = ++ grub_asn1_allocate_and_read (cert, "tbsCertificate.serialNumber", ++ "certificate serial number", &tmp_size); ++ if (!results->serial) ++ { ++ err = grub_errno; ++ goto cleanup; ++ } ++ /* ++ * It's safe to cast the signed int to an unsigned here, we know ++ * length is non-negative ++ */ ++ results->serial_len = tmp_size; ++ ++ /* ++ * signature AlgorithmIdentifier, ++ * ++ * We don't load the signature or issuer at the moment, ++ * as we don't attempt x509 verification. ++ */ ++ ++ /* ++ * issuer Name, ++ * ++ * The RFC only requires the serial number to be unique within ++ * issuers, so to avoid ambiguity we _technically_ ought to make ++ * this available. ++ */ ++ ++ /* ++ * validity Validity, ++ * ++ * Validity ::= SEQUENCE { ++ * notBefore Time, ++ * notAfter Time } ++ * ++ * We can't validate this reasonably, we have no true time source on several ++ * platforms. For now we do not parse them. ++ */ ++ ++ /* ++ * subject Name, ++ * ++ * This is an X501 name, we parse out just the CN. ++ */ ++ err = ++ read_name (cert, "tbsCertificate.subject", &results->subject, ++ &results->subject_len); ++ if (err != GRUB_ERR_NONE) ++ goto cleanup_serial; ++ ++ /* ++ * TBSCertificate ::= SEQUENCE { ++ * ... ++ * subjectPublicKeyInfo SubjectPublicKeyInfo, ++ * ... ++ */ ++ err = grub_x509_read_subject_public_key (cert, results); ++ if (err != GRUB_ERR_NONE) ++ goto cleanup_name; ++ ++ /* ++ * TBSCertificate ::= SEQUENCE { ++ * ... ++ * extensions [3] EXPLICIT Extensions OPTIONAL ++ * -- If present, version MUST be v3 ++ * } ++ */ ++ ++ err = verify_extensions (cert); ++ if (err != GRUB_ERR_NONE) ++ goto cleanup_name; ++ ++ ++ /* ++ * We do not read or check the signature on the certificate: ++ * as discussed we do not try to validate the certificate but trust ++ * it implictly. ++ */ ++ ++ asn1_delete_structure (&cert); ++ return GRUB_ERR_NONE; ++ ++ ++cleanup_name: ++ grub_free (results->subject); ++cleanup_serial: ++ grub_free (results->serial); ++cleanup: ++ asn1_delete_structure (&cert); ++ return err; ++} ++ ++/* ++ * Release all the storage associated with the x509 certificate. ++ * If the caller dynamically allocated the certificate, it must free it. ++ * The caller is also responsible for maintenance of the linked list. ++ */ ++void ++certificate_release (struct x509_certificate *cert) ++{ ++ grub_free (cert->subject); ++ grub_free (cert->serial); ++ gcry_mpi_release (cert->mpis[0]); ++ gcry_mpi_release (cert->mpis[1]); ++} +diff --git a/grub-core/commands/appendedsig/appendedsig.h b/grub-core/commands/appendedsig/appendedsig.h +new file mode 100644 +index 00000000000..9792ef3901e +--- /dev/null ++++ b/grub-core/commands/appendedsig/appendedsig.h +@@ -0,0 +1,110 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++ ++extern asn1_node _gnutls_gnutls_asn; ++extern asn1_node _gnutls_pkix_asn; ++ ++#define MAX_OID_LEN 32 ++ ++/* ++ * One or more x509 certificates. ++ * ++ * We do limited parsing: extracting only the serial, CN and RSA public key. ++ */ ++struct x509_certificate ++{ ++ struct x509_certificate *next; ++ ++ grub_uint8_t *serial; ++ grub_size_t serial_len; ++ ++ char *subject; ++ grub_size_t subject_len; ++ ++ /* We only support RSA public keys. This encodes [modulus, publicExponent] */ ++ gcry_mpi_t mpis[2]; ++}; ++ ++/* ++ * A PKCS#7 signedData message. ++ * ++ * We make no attempt to match intelligently, so we don't save any info about ++ * the signer. We also support only 1 signerInfo, so we only store a single ++ * MPI for the signature. ++ */ ++struct pkcs7_signedData ++{ ++ const gcry_md_spec_t *hash; ++ gcry_mpi_t sig_mpi; ++}; ++ ++ ++/* Do libtasn1 init */ ++int asn1_init (void); ++ ++/* ++ * Import a DER-encoded certificate at 'data', of size 'size'. ++ * ++ * Place the results into 'results', which must be already allocated. ++ */ ++grub_err_t ++certificate_import (void *data, grub_size_t size, ++ struct x509_certificate *results); ++ ++/* ++ * Release all the storage associated with the x509 certificate. ++ * If the caller dynamically allocated the certificate, it must free it. ++ * The caller is also responsible for maintenance of the linked list. ++ */ ++void certificate_release (struct x509_certificate *cert); ++ ++/* ++ * Parse a PKCS#7 message, which must be a signedData message. ++ * ++ * The message must be in 'sigbuf' and of size 'data_size'. The result is ++ * placed in 'msg', which must already be allocated. ++ */ ++grub_err_t ++parse_pkcs7_signedData (void *sigbuf, grub_size_t data_size, ++ struct pkcs7_signedData *msg); ++ ++/* ++ * Release all the storage associated with the PKCS#7 message. ++ * If the caller dynamically allocated the message, it must free it. ++ */ ++void pkcs7_signedData_release (struct pkcs7_signedData *msg); ++ ++/* ++ * Read a value from an ASN1 node, allocating memory to store it. ++ * ++ * It will work for anything where the size libtasn1 returns is right: ++ * - Integers ++ * - Octet strings ++ * - DER encoding of other structures ++ * It will _not_ work for things where libtasn1 size requires adjustment: ++ * - Strings that require an extra NULL byte at the end ++ * - Bit strings because libtasn1 returns the length in bits, not bytes. ++ * ++ * If the function returns a non-NULL value, the caller must free it. ++ */ ++void *grub_asn1_allocate_and_read (asn1_node node, const char *name, ++ const char *friendly_name, ++ int *content_size); diff --git a/0301-appended-signatures-support-verifying-appended-signa.patch b/0301-appended-signatures-support-verifying-appended-signa.patch new file mode 100644 index 00000000..f379d681 --- /dev/null +++ b/0301-appended-signatures-support-verifying-appended-signa.patch @@ -0,0 +1,719 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 30 Jul 2020 01:35:43 +1000 +Subject: [PATCH] appended signatures: support verifying appended signatures + +Building on the parsers and the ability to embed x509 certificates, as +well as the existing gcrypt functionality, add a module for verifying +appended signatures. + +This includes: + + - a verifier that requires that kernels and grub modules have appended + signatures. It shares lots of logic with shim-lock verifier about what + files need to be verified and what modules are unsafe to have loaded. + + - commands to manage the list of trusted certificates for verification. + +Similar to the PGP verifier, if a certificate is embedded in the core +image, verification will be enforced unless disabled on the the grub +command line or by load_env. + +Thus, as with the PGP verifier, it is not a complete secure-boot solution: +other mechanisms must be used to ensure that a user cannot drop to the +grub shell and disable verification. + +Signed-off-by: Daniel Axtens +--- + grub-core/Makefile.core.def | 12 + + grub-core/commands/appendedsig/appendedsig.c | 644 +++++++++++++++++++++++++++ + include/grub/file.h | 2 + + 3 files changed, 658 insertions(+) + create mode 100644 grub-core/commands/appendedsig/appendedsig.c + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 78071360529..30bd9a4a587 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -977,6 +977,18 @@ module = { + cppflags = '-I$(srcdir)/lib/posix_wrap'; + }; + ++module = { ++ name = appendedsig; ++ common = commands/appendedsig/appendedsig.c; ++ common = commands/appendedsig/x509.c; ++ common = commands/appendedsig/pkcs7.c; ++ common = commands/appendedsig/asn1util.c; ++ common = commands/appendedsig/gnutls_asn1_tab.c; ++ common = commands/appendedsig/pkix_asn1_tab.c; ++ cflags = '$(CFLAGS_POSIX)'; ++ cppflags = '-I$(srcdir)/lib/posix_wrap'; ++}; ++ + module = { + name = verifiers; + common = commands/verifiers.c; +diff --git a/grub-core/commands/appendedsig/appendedsig.c b/grub-core/commands/appendedsig/appendedsig.c +new file mode 100644 +index 00000000000..1fbc942254a +--- /dev/null ++++ b/grub-core/commands/appendedsig/appendedsig.c +@@ -0,0 +1,644 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "appendedsig.h" ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++const char magic[] = "~Module signature appended~\n"; ++ ++/* ++ * This structure is extracted from scripts/sign-file.c in the linux kernel ++ * source. It was licensed as LGPLv2.1+, which is GPLv3+ compatible. ++ */ ++struct module_signature ++{ ++ grub_uint8_t algo; /* Public-key crypto algorithm [0] */ ++ grub_uint8_t hash; /* Digest algorithm [0] */ ++ grub_uint8_t id_type; /* Key identifier type [PKEY_ID_PKCS7] */ ++ grub_uint8_t signer_len; /* Length of signer's name [0] */ ++ grub_uint8_t key_id_len; /* Length of key identifier [0] */ ++ grub_uint8_t __pad[3]; ++ grub_uint32_t sig_len; /* Length of signature data */ ++} GRUB_PACKED; ++ ++ ++/* This represents an entire, parsed, appended signature */ ++struct grub_appended_signature ++{ ++ grub_size_t signature_len; /* Length of PKCS#7 data + ++ * metadata + magic */ ++ ++ struct module_signature sig_metadata; /* Module signature metadata */ ++ struct pkcs7_signedData pkcs7; /* Parsed PKCS#7 data */ ++}; ++ ++/* Trusted certificates for verifying appended signatures */ ++struct x509_certificate *grub_trusted_key; ++ ++/* ++ * Force gcry_rsa to be a module dependency. ++ * ++ * If we use grub_crypto_pk_rsa, then then the gcry_rsa module won't be built ++ * in if you add 'appendedsig' to grub-install --modules. You would need to ++ * add 'gcry_rsa' too. That's confusing and seems suboptimal, especially when ++ * we only support RSA. ++ * ++ * Dynamic loading also causes some concerns. We can't load gcry_rsa from the ++ * the filesystem after we install the verifier - we won't be able to verify ++ * it without having it already present. We also shouldn't load it before we ++ * install the verifier, because that would mean it wouldn't be verified - an ++ * attacker could insert any code they wanted into the module. ++ * ++ * So instead, reference the internal symbol from gcry_rsa. That creates a ++ * direct dependency on gcry_rsa, so it will be built in when this module ++ * is built in. Being built in (assuming the core image is itself signed!) ++ * also resolves our concerns about loading from the filesystem. ++ */ ++extern gcry_pk_spec_t _gcry_pubkey_spec_rsa; ++ ++static int check_sigs = 0; ++ ++static char * ++grub_env_write_sec (struct grub_env_var *var __attribute__((unused)), ++ const char *val) ++{ ++ check_sigs = (*val == '1') || (*val == 'e'); ++ return grub_strdup (check_sigs ? "enforce" : "no"); ++} ++ ++static grub_err_t ++read_cert_from_file (grub_file_t f, struct x509_certificate *certificate) ++{ ++ grub_err_t err; ++ grub_uint8_t *buf = NULL; ++ grub_ssize_t read_size; ++ grub_off_t total_read_size = 0; ++ grub_off_t file_size = grub_file_size (f); ++ ++ ++ if (file_size == GRUB_FILE_SIZE_UNKNOWN) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, ++ N_("Cannot parse a certificate file of unknown size")); ++ ++ buf = grub_zalloc (file_size); ++ if (!buf) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ N_("Could not allocate buffer for certificate file contents")); ++ ++ while (total_read_size < file_size) ++ { ++ read_size = ++ grub_file_read (f, &buf[total_read_size], ++ file_size - total_read_size); ++ if (read_size < 0) ++ { ++ err = grub_error (GRUB_ERR_READ_ERROR, ++ N_("Error reading certificate file")); ++ goto cleanup_buf; ++ } ++ total_read_size += read_size; ++ } ++ ++ err = certificate_import (buf, total_read_size, certificate); ++ if (err != GRUB_ERR_NONE) ++ goto cleanup_buf; ++ ++ return GRUB_ERR_NONE; ++ ++cleanup_buf: ++ grub_free (buf); ++ return err; ++} ++ ++static grub_err_t ++extract_appended_signature (grub_uint8_t * buf, grub_size_t bufsize, ++ struct grub_appended_signature *sig) ++{ ++ grub_err_t err; ++ grub_size_t pkcs7_size; ++ grub_size_t remaining_len; ++ grub_uint8_t *appsigdata = buf + bufsize - grub_strlen (magic); ++ ++ if (bufsize < grub_strlen (magic)) ++ return grub_error (GRUB_ERR_BAD_SIGNATURE, ++ N_("File too short for signature magic")); ++ ++ if (grub_memcmp (appsigdata, (grub_uint8_t *) magic, grub_strlen (magic))) ++ return grub_error (GRUB_ERR_BAD_SIGNATURE, ++ N_("Missing or invalid signature magic")); ++ ++ remaining_len = bufsize - grub_strlen (magic); ++ ++ if (remaining_len < sizeof (struct module_signature)) ++ return grub_error (GRUB_ERR_BAD_SIGNATURE, ++ N_("File too short for signature metadata")); ++ ++ appsigdata -= sizeof (struct module_signature); ++ ++ /* extract the metadata */ ++ grub_memcpy (&(sig->sig_metadata), appsigdata, ++ sizeof (struct module_signature)); ++ ++ remaining_len -= sizeof (struct module_signature); ++ ++ if (sig->sig_metadata.id_type != 2) ++ return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("Wrong signature type")); ++ ++#ifdef GRUB_TARGET_WORDS_BIGENDIAN ++ pkcs7_size = sig->sig_metadata.sig_len; ++#else ++ pkcs7_size = __builtin_bswap32 (sig->sig_metadata.sig_len); ++#endif ++ ++ if (pkcs7_size > remaining_len) ++ return grub_error (GRUB_ERR_BAD_SIGNATURE, ++ N_("File too short for PKCS#7 message")); ++ ++ grub_dprintf ("appendedsig", "sig len %" PRIuGRUB_SIZE "\n", pkcs7_size); ++ ++ sig->signature_len = ++ grub_strlen (magic) + sizeof (struct module_signature) + pkcs7_size; ++ ++ /* rewind pointer and parse pkcs7 data */ ++ appsigdata -= pkcs7_size; ++ ++ err = parse_pkcs7_signedData (appsigdata, pkcs7_size, &sig->pkcs7); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_verify_appended_signature (grub_uint8_t * buf, grub_size_t bufsize) ++{ ++ grub_err_t err = GRUB_ERR_NONE; ++ grub_size_t datasize; ++ void *context; ++ unsigned char *hash; ++ gcry_mpi_t hashmpi; ++ gcry_err_code_t rc; ++ struct x509_certificate *pk; ++ struct grub_appended_signature sig; ++ ++ if (!grub_trusted_key) ++ return grub_error (GRUB_ERR_BAD_SIGNATURE, ++ N_("No trusted keys to verify against")); ++ ++ err = extract_appended_signature (buf, bufsize, &sig); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ ++ datasize = bufsize - sig.signature_len; ++ ++ context = grub_zalloc (sig.pkcs7.hash->contextsize); ++ if (!context) ++ return grub_errno; ++ ++ sig.pkcs7.hash->init (context); ++ sig.pkcs7.hash->write (context, buf, datasize); ++ sig.pkcs7.hash->final (context); ++ hash = sig.pkcs7.hash->read (context); ++ grub_dprintf ("appendedsig", ++ "data size %" PRIxGRUB_SIZE ", hash %02x%02x%02x%02x...\n", ++ datasize, hash[0], hash[1], hash[2], hash[3]); ++ ++ err = GRUB_ERR_BAD_SIGNATURE; ++ for (pk = grub_trusted_key; pk; pk = pk->next) ++ { ++ rc = grub_crypto_rsa_pad (&hashmpi, hash, sig.pkcs7.hash, pk->mpis[0]); ++ if (rc) ++ { ++ err = grub_error (GRUB_ERR_BAD_SIGNATURE, ++ N_("Error padding hash for RSA verification: %d"), ++ rc); ++ goto cleanup; ++ } ++ ++ rc = _gcry_pubkey_spec_rsa.verify (0, hashmpi, &sig.pkcs7.sig_mpi, ++ pk->mpis, NULL, NULL); ++ gcry_mpi_release (hashmpi); ++ ++ if (rc == 0) ++ { ++ grub_dprintf ("appendedsig", "verify with key '%s' succeeded\n", ++ pk->subject); ++ err = GRUB_ERR_NONE; ++ break; ++ } ++ ++ grub_dprintf ("appendedsig", "verify with key '%s' failed with %d\n", ++ pk->subject, rc); ++ } ++ ++ /* If we didn't verify, provide a neat message */ ++ if (err != GRUB_ERR_NONE) ++ err = grub_error (GRUB_ERR_BAD_SIGNATURE, ++ N_("Failed to verify signature against a trusted key")); ++ ++cleanup: ++ grub_free (context); ++ pkcs7_signedData_release (&sig.pkcs7); ++ ++ return err; ++} ++ ++static grub_err_t ++grub_cmd_verify_signature (grub_command_t cmd __attribute__((unused)), ++ int argc, char **args) ++{ ++ grub_file_t f; ++ grub_err_t err = GRUB_ERR_NONE; ++ grub_uint8_t *data; ++ grub_ssize_t read_size; ++ grub_off_t file_size, total_read_size = 0; ++ ++ if (argc < 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected")); ++ ++ grub_dprintf ("appendedsig", "verifying %s\n", args[0]); ++ ++ f = grub_file_open (args[0], GRUB_FILE_TYPE_VERIFY_SIGNATURE); ++ if (!f) ++ { ++ err = grub_errno; ++ goto cleanup; ++ } ++ ++ file_size = grub_file_size (f); ++ if (file_size == GRUB_FILE_SIZE_UNKNOWN) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, ++ N_("Cannot verify the signature of a file of unknown size")); ++ ++ data = grub_malloc (file_size); ++ if (!data) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ N_("Could not allocate data buffer size " ++ PRIuGRUB_UINT64_T " for verification"), file_size); ++ ++ while (total_read_size < file_size) ++ { ++ read_size = ++ grub_file_read (f, &data[total_read_size], ++ file_size - total_read_size); ++ if (read_size < 0) ++ { ++ err = grub_error (GRUB_ERR_READ_ERROR, ++ N_("Error reading file to verify")); ++ goto cleanup_data; ++ } ++ total_read_size += read_size; ++ } ++ ++ err = grub_verify_appended_signature (data, file_size); ++ ++cleanup_data: ++ grub_free (data); ++cleanup: ++ if (f) ++ grub_file_close (f); ++ return err; ++} ++ ++static grub_err_t ++grub_cmd_distrust (grub_command_t cmd __attribute__((unused)), ++ int argc, char **args) ++{ ++ unsigned long cert_num, i; ++ struct x509_certificate *cert, *prev; ++ ++ if (argc != 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("One argument expected")); ++ ++ grub_errno = GRUB_ERR_NONE; ++ cert_num = grub_strtoul (args[0], NULL, 10); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; ++ ++ if (cert_num < 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, ++ N_("Certificate number too small - numbers start at 1")); ++ ++ if (cert_num == 1) ++ { ++ cert = grub_trusted_key; ++ grub_trusted_key = cert->next; ++ ++ certificate_release (cert); ++ grub_free (cert); ++ return GRUB_ERR_NONE; ++ } ++ i = 2; ++ prev = grub_trusted_key; ++ cert = grub_trusted_key->next; ++ while (cert) ++ { ++ if (i == cert_num) ++ { ++ prev->next = cert->next; ++ certificate_release (cert); ++ grub_free (cert); ++ return GRUB_ERR_NONE; ++ } ++ i++; ++ prev = cert; ++ cert = cert->next; ++ } ++ ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, ++ N_("No certificate number %d found - only %d certificates in the store"), ++ cert_num, i - 1); ++} ++ ++static grub_err_t ++grub_cmd_trust (grub_command_t cmd __attribute__((unused)), ++ int argc, char **args) ++{ ++ grub_file_t certf; ++ struct x509_certificate *cert = NULL; ++ grub_err_t err; ++ ++ if (argc != 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected")); ++ ++ certf = grub_file_open (args[0], ++ GRUB_FILE_TYPE_CERTIFICATE_TRUST ++ | GRUB_FILE_TYPE_NO_DECOMPRESS); ++ if (!certf) ++ return grub_errno; ++ ++ ++ cert = grub_zalloc (sizeof (struct x509_certificate)); ++ if (!cert) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ N_("Could not allocate memory for certificate")); ++ ++ err = read_cert_from_file (certf, cert); ++ grub_file_close (certf); ++ if (err != GRUB_ERR_NONE) ++ { ++ grub_free (cert); ++ return err; ++ } ++ grub_dprintf ("appendedsig", "Loaded certificate with CN: %s\n", ++ cert->subject); ++ ++ cert->next = grub_trusted_key; ++ grub_trusted_key = cert; ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_cmd_list (grub_command_t cmd __attribute__((unused)), ++ int argc __attribute__((unused)), ++ char **args __attribute__((unused))) ++{ ++ struct x509_certificate *cert; ++ int cert_num = 1; ++ grub_size_t i; ++ ++ for (cert = grub_trusted_key; cert; cert = cert->next) ++ { ++ grub_printf (N_("Certificate %d:\n"), cert_num); ++ ++ grub_printf (N_("\tSerial: ")); ++ for (i = 0; i < cert->serial_len - 1; i++) ++ { ++ grub_printf ("%02x:", cert->serial[i]); ++ } ++ grub_printf ("%02x\n", cert->serial[cert->serial_len - 1]); ++ ++ grub_printf ("\tCN: %s\n\n", cert->subject); ++ cert_num++; ++ ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++appendedsig_init (grub_file_t io, enum grub_file_type type, ++ void **context __attribute__((unused)), ++ enum grub_verify_flags *flags) ++{ ++ const char *dangerous_mod; ++ ++ if (!check_sigs) ++ { ++ *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION; ++ return GRUB_ERR_NONE; ++ } ++ ++ switch (type & GRUB_FILE_TYPE_MASK) ++ { ++ case GRUB_FILE_TYPE_GRUB_MODULE: ++ if (grub_is_dangerous_module (io)) ++ return grub_error (GRUB_ERR_ACCESS_DENIED, ++ N_("module cannot be loaded in appended signature mode: %s"), ++ io->name); ++ ++ *flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK; ++ return GRUB_ERR_NONE; ++ ++ case GRUB_FILE_TYPE_ACPI_TABLE: ++ case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE: ++ *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH; ++ return GRUB_ERR_NONE; ++ ++ case GRUB_FILE_TYPE_CERTIFICATE_TRUST: ++ /* ++ * This is a certificate to add to trusted keychain. ++ * ++ * This needs to be verified or blocked. Ideally we'd write an x509 ++ * verifier, but we lack the hubris required to take this on. Instead, ++ * require that it have an appended signature. ++ */ ++ ++ /* Fall through */ ++ ++ case GRUB_FILE_TYPE_LINUX_KERNEL: ++ case GRUB_FILE_TYPE_MULTIBOOT_KERNEL: ++ case GRUB_FILE_TYPE_BSD_KERNEL: ++ case GRUB_FILE_TYPE_XNU_KERNEL: ++ case GRUB_FILE_TYPE_PLAN9_KERNEL: ++ ++ dangerous_mod = grub_dangerous_module_loaded (); ++ if (dangerous_mod) ++ return grub_error (GRUB_ERR_ACCESS_DENIED, ++ N_("cannot proceed due to dangerous module in memory: %s"), ++ dangerous_mod); ++ ++ *flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK; ++ return GRUB_ERR_NONE; ++ ++ default: ++ /* ++ * powerpc only supports the linux loader. If you support more, ++ * (especially chain loaded binaries) make sure they're checked! ++ */ ++ *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION; ++ return GRUB_ERR_NONE; ++ } ++} ++ ++static grub_err_t ++appendedsig_write (void *ctxt __attribute__((unused)), ++ void *buf, grub_size_t size) ++{ ++ return grub_verify_appended_signature (buf, size); ++} ++ ++struct grub_file_verifier grub_appendedsig_verifier = { ++ .name = "appendedsig", ++ .init = appendedsig_init, ++ .write = appendedsig_write, ++}; ++ ++static grub_ssize_t ++pseudo_read (struct grub_file *file, char *buf, grub_size_t len) ++{ ++ grub_memcpy (buf, (grub_uint8_t *) file->data + file->offset, len); ++ return len; ++} ++ ++/* Filesystem descriptor. */ ++static struct grub_fs pseudo_fs = { ++ .name = "pseudo", ++ .fs_read = pseudo_read ++}; ++ ++static grub_command_t cmd_verify, cmd_list, cmd_distrust, cmd_trust; ++ ++GRUB_MOD_INIT (appendedsig) ++{ ++ int rc; ++ struct grub_module_header *header; ++ const char *val; ++ ++ val = grub_env_get ("check_appended_signatures"); ++ grub_dprintf ("appendedsig", "check_appended_signatures='%s'\n", val); ++ ++ if (val && (val[0] == '1' || val[0] == 'e')) ++ check_sigs = 1; ++ else ++ check_sigs = 0; ++ ++ grub_trusted_key = NULL; ++ ++ grub_register_variable_hook ("check_appended_signatures", 0, ++ grub_env_write_sec); ++ grub_env_export ("check_appended_signatures"); ++ ++ rc = asn1_init (); ++ if (rc) ++ grub_fatal ("Error initing ASN.1 data structures: %d: %s\n", rc, ++ asn1_strerror (rc)); ++ ++ FOR_MODULES (header) ++ { ++ struct grub_file pseudo_file; ++ struct x509_certificate *pk = NULL; ++ grub_err_t err; ++ ++ /* Not an ELF module, skip. */ ++ if (header->type != OBJ_TYPE_X509_PUBKEY) ++ continue; ++ ++ grub_memset (&pseudo_file, 0, sizeof (pseudo_file)); ++ pseudo_file.fs = &pseudo_fs; ++ pseudo_file.size = header->size - sizeof (struct grub_module_header); ++ pseudo_file.data = (char *) header + sizeof (struct grub_module_header); ++ ++ grub_dprintf ("appendedsig", ++ "Found an x509 key, size=%" PRIuGRUB_UINT64_T "\n", ++ pseudo_file.size); ++ ++ pk = grub_zalloc (sizeof (struct x509_certificate)); ++ if (!pk) ++ { ++ grub_fatal ("Out of memory loading initial certificates"); ++ } ++ ++ err = read_cert_from_file (&pseudo_file, pk); ++ if (err != GRUB_ERR_NONE) ++ grub_fatal ("Error loading initial key: %s", grub_errmsg); ++ ++ grub_dprintf ("appendedsig", "loaded certificate CN='%s'\n", pk->subject); ++ ++ pk->next = grub_trusted_key; ++ grub_trusted_key = pk; ++ } ++ ++ if (!val || val[0] == '\0') ++ { ++ grub_env_set ("check_appended_signatures", ++ grub_trusted_key ? "enforce" : "no"); ++ } ++ ++ cmd_trust = ++ grub_register_command ("trust_certificate", grub_cmd_trust, ++ N_("X509_CERTIFICATE"), ++ N_("Add X509_CERTIFICATE to trusted certificates.")); ++ cmd_list = ++ grub_register_command ("list_certificates", grub_cmd_list, 0, ++ N_("Show the list of trusted x509 certificates.")); ++ cmd_verify = ++ grub_register_command ("verify_appended", grub_cmd_verify_signature, ++ N_("FILE"), ++ N_("Verify FILE against the trusted x509 certificates.")); ++ cmd_distrust = ++ grub_register_command ("distrust_certificate", grub_cmd_distrust, ++ N_("CERT_NUMBER"), ++ N_("Remove CERT_NUMBER (as listed by list_certificates) from trusted certificates.")); ++ ++ grub_verifier_register (&grub_appendedsig_verifier); ++ grub_dl_set_persistent (mod); ++} ++ ++GRUB_MOD_FINI (appendedsig) ++{ ++ /* ++ * grub_dl_set_persistent should prevent this from actually running, but ++ * it does still run under emu. ++ */ ++ ++ grub_verifier_unregister (&grub_appendedsig_verifier); ++ grub_unregister_command (cmd_verify); ++ grub_unregister_command (cmd_list); ++ grub_unregister_command (cmd_trust); ++ grub_unregister_command (cmd_distrust); ++} +diff --git a/include/grub/file.h b/include/grub/file.h +index 31567483ccf..96827a4f896 100644 +--- a/include/grub/file.h ++++ b/include/grub/file.h +@@ -80,6 +80,8 @@ enum grub_file_type + GRUB_FILE_TYPE_PUBLIC_KEY, + /* File holding public key to add to trused keys. */ + GRUB_FILE_TYPE_PUBLIC_KEY_TRUST, ++ /* File holding x509 certificiate to add to trusted keys. */ ++ GRUB_FILE_TYPE_CERTIFICATE_TRUST, + /* File of which we intend to print a blocklist to the user. */ + GRUB_FILE_TYPE_PRINT_BLOCKLIST, + /* File we intend to use for test loading or testing speed. */ diff --git a/0302-appended-signatures-verification-tests.patch b/0302-appended-signatures-verification-tests.patch new file mode 100644 index 00000000..3b2d9e9c --- /dev/null +++ b/0302-appended-signatures-verification-tests.patch @@ -0,0 +1,897 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 30 Jul 2020 01:31:02 +1000 +Subject: [PATCH] appended signatures: verification tests + +These tests are run through all_functional_test and test a range +of commands and behaviours. + +Signed-off-by: Daniel Axtens +--- + grub-core/Makefile.core.def | 6 + + grub-core/tests/appended_signature_test.c | 281 +++++++++++++++ + grub-core/tests/lib/functional_test.c | 1 + + grub-core/tests/appended_signatures.h | 557 ++++++++++++++++++++++++++++++ + 4 files changed, 845 insertions(+) + create mode 100644 grub-core/tests/appended_signature_test.c + create mode 100644 grub-core/tests/appended_signatures.h + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 30bd9a4a587..640de1b299b 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2138,6 +2138,12 @@ module = { + common = tests/setjmp_test.c; + }; + ++module = { ++ name = appended_signature_test; ++ common = tests/appended_signature_test.c; ++ common = tests/appended_signatures.h; ++}; ++ + module = { + name = signature_test; + common = tests/signature_test.c; +diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c +new file mode 100644 +index 00000000000..88a485200d8 +--- /dev/null ++++ b/grub-core/tests/appended_signature_test.c +@@ -0,0 +1,281 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2020 IBM Corporation. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "appended_signatures.h" ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++#define DEFINE_TEST_CASE(case_name) \ ++static char * \ ++get_ ## case_name (grub_size_t *sz) \ ++{ \ ++ char *ret; \ ++ *sz = case_name ## _len; \ ++ ret = grub_malloc (*sz); \ ++ if (ret) \ ++ grub_memcpy (ret, case_name, *sz); \ ++ return ret; \ ++} \ ++\ ++static struct grub_procfs_entry case_name ## _entry = \ ++{ \ ++ .name = #case_name, \ ++ .get_contents = get_ ## case_name \ ++} ++ ++#define DO_TEST(case_name, is_valid) \ ++{ \ ++ grub_procfs_register (#case_name, &case_name ## _entry); \ ++ do_verify ("(proc)/" #case_name, is_valid); \ ++ grub_procfs_unregister (&case_name ## _entry); \ ++} ++ ++ ++DEFINE_TEST_CASE (hi_signed); ++DEFINE_TEST_CASE (hi_signed_sha256); ++DEFINE_TEST_CASE (hj_signed); ++DEFINE_TEST_CASE (short_msg); ++DEFINE_TEST_CASE (unsigned_msg); ++DEFINE_TEST_CASE (hi_signed_2nd); ++ ++static char * ++get_certificate_der (grub_size_t * sz) ++{ ++ char *ret; ++ *sz = certificate_der_len; ++ ret = grub_malloc (*sz); ++ if (ret) ++ grub_memcpy (ret, certificate_der, *sz); ++ return ret; ++} ++ ++static struct grub_procfs_entry certificate_der_entry = { ++ .name = "certificate.der", ++ .get_contents = get_certificate_der ++}; ++ ++static char * ++get_certificate2_der (grub_size_t * sz) ++{ ++ char *ret; ++ *sz = certificate2_der_len; ++ ret = grub_malloc (*sz); ++ if (ret) ++ grub_memcpy (ret, certificate2_der, *sz); ++ return ret; ++} ++ ++static struct grub_procfs_entry certificate2_der_entry = { ++ .name = "certificate2.der", ++ .get_contents = get_certificate2_der ++}; ++ ++static char * ++get_certificate_printable_der (grub_size_t * sz) ++{ ++ char *ret; ++ *sz = certificate_printable_der_len; ++ ret = grub_malloc (*sz); ++ if (ret) ++ grub_memcpy (ret, certificate_printable_der, *sz); ++ return ret; ++} ++ ++static struct grub_procfs_entry certificate_printable_der_entry = { ++ .name = "certificate_printable.der", ++ .get_contents = get_certificate_printable_der ++}; ++ ++ ++static void ++do_verify (const char *f, int is_valid) ++{ ++ grub_command_t cmd; ++ char *args[] = { (char *) f, NULL }; ++ grub_err_t err; ++ ++ cmd = grub_command_find ("verify_appended"); ++ if (!cmd) ++ { ++ grub_test_assert (0, "can't find command `%s'", "verify_appended"); ++ return; ++ } ++ err = (cmd->func) (cmd, 1, args); ++ if (is_valid) ++ { ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "verification of %s failed: %d: %s", f, grub_errno, ++ grub_errmsg); ++ } ++ else ++ { ++ grub_test_assert (err == GRUB_ERR_BAD_SIGNATURE, ++ "verification of %s unexpectedly succeeded", f); ++ } ++ grub_errno = GRUB_ERR_NONE; ++ ++} ++ ++static void ++appended_signature_test (void) ++{ ++ grub_command_t cmd_trust, cmd_distrust; ++ char *trust_args[] = { (char *) "(proc)/certificate.der", NULL }; ++ char *trust_args2[] = { (char *) "(proc)/certificate2.der", NULL }; ++ char *trust_args_printable[] = { (char *) "(proc)/certificate_printable.der", ++ NULL }; ++ char *distrust_args[] = { (char *) "1", NULL }; ++ char *distrust2_args[] = { (char *) "2", NULL }; ++ grub_err_t err; ++ ++ grub_procfs_register ("certificate.der", &certificate_der_entry); ++ grub_procfs_register ("certificate2.der", &certificate2_der_entry); ++ grub_procfs_register ("certificate_printable.der", ++ &certificate_printable_der_entry); ++ ++ cmd_trust = grub_command_find ("trust_certificate"); ++ if (!cmd_trust) ++ { ++ grub_test_assert (0, "can't find command `%s'", "trust_certificate"); ++ return; ++ } ++ err = (cmd_trust->func) (cmd_trust, 1, trust_args); ++ ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "loading certificate failed: %d: %s", grub_errno, ++ grub_errmsg); ++ ++ /* If we have no certificate the remainder of the tests are meaningless */ ++ if (err != GRUB_ERR_NONE) ++ return; ++ ++ /* ++ * Reload the command: this works around some 'interesting' behaviour in the ++ * dynamic command dispatcher. The first time you call cmd->func you get a ++ * dispatcher that loads the module, finds the real cmd, calls it, and then ++ * releases some internal storage. This means it's not safe to call a second ++ * time and we need to reload it. ++ */ ++ cmd_trust = grub_command_find ("trust_certificate"); ++ ++ DO_TEST (hi_signed, 1); ++ DO_TEST (hi_signed_sha256, 1); ++ DO_TEST (hj_signed, 0); ++ DO_TEST (short_msg, 0); ++ DO_TEST (unsigned_msg, 0); ++ ++ /* ++ * in enforcing mode, we shouldn't be able to load a certificate that isn't ++ * signed by an existing trusted key. ++ * ++ * However, procfs files automatically skip the verification test, so we can't ++ * easily test this. ++ */ ++ ++ /* ++ * verify that testing with 2 trusted certs works ++ */ ++ DO_TEST (hi_signed_2nd, 0); ++ ++ err = (cmd_trust->func) (cmd_trust, 1, trust_args2); ++ ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "loading certificate 2 failed: %d: %s", grub_errno, ++ grub_errmsg); ++ ++ if (err != GRUB_ERR_NONE) ++ return; ++ ++ DO_TEST (hi_signed_2nd, 1); ++ DO_TEST (hi_signed, 1); ++ ++ /* ++ * Check certificate removal. They're added to the _top_ of the list and ++ * removed by position in the list. Current the list looks like [#2, #1]. ++ * ++ * First test removing the second certificate in the list, which is ++ * certificate #1, giving us just [#2]. ++ */ ++ cmd_distrust = grub_command_find ("distrust_certificate"); ++ if (!cmd_distrust) ++ { ++ grub_test_assert (0, "can't find command `%s'", "distrust_certificate"); ++ return; ++ } ++ ++ err = (cmd_distrust->func) (cmd_distrust, 1, distrust2_args); ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "distrusting certificate 1 failed: %d: %s", grub_errno, ++ grub_errmsg); ++ DO_TEST (hi_signed_2nd, 1); ++ DO_TEST (hi_signed, 0); ++ ++ /* ++ * Now reload certificate #1. This will make the list look like [#1, #2] ++ */ ++ err = (cmd_trust->func) (cmd_trust, 1, trust_args); ++ ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "reloading certificate 1 failed: %d: %s", grub_errno, ++ grub_errmsg); ++ DO_TEST (hi_signed, 1); ++ ++ /* Remove the first certificate in the list, giving us just [#2] */ ++ err = (cmd_distrust->func) (cmd_distrust, 1, distrust_args); ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "distrusting certificate 1 (first time) failed: %d: %s", ++ grub_errno, grub_errmsg); ++ DO_TEST (hi_signed_2nd, 1); ++ DO_TEST (hi_signed, 0); ++ ++ /* ++ * Remove the first certificate again, giving an empty list. ++ * ++ * verify_appended should fail if there are no certificates to verify against. ++ */ ++ err = (cmd_distrust->func) (cmd_distrust, 1, distrust_args); ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "distrusting certificate 1 (second time) failed: %d: %s", ++ grub_errno, grub_errmsg); ++ DO_TEST (hi_signed_2nd, 0); ++ ++ /* ++ * Lastly, check a certificate that uses printableString rather than ++ * utf8String loads properly. ++ */ ++ err = (cmd_trust->func) (cmd_trust, 1, trust_args_printable); ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "distrusting printable certificate failed: %d: %s", ++ grub_errno, grub_errmsg); ++ ++ grub_procfs_unregister (&certificate_der_entry); ++ grub_procfs_unregister (&certificate2_der_entry); ++ grub_procfs_unregister (&certificate_printable_der_entry); ++} ++ ++GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); +diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c +index 96781fb39b5..403fa5c789a 100644 +--- a/grub-core/tests/lib/functional_test.c ++++ b/grub-core/tests/lib/functional_test.c +@@ -73,6 +73,7 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), + grub_dl_load ("xnu_uuid_test"); + grub_dl_load ("pbkdf2_test"); + grub_dl_load ("signature_test"); ++ grub_dl_load ("appended_signature_test"); + grub_dl_load ("sleep_test"); + grub_dl_load ("bswap_test"); + grub_dl_load ("ctz_test"); +diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h +new file mode 100644 +index 00000000000..aa3dc6278e3 +--- /dev/null ++++ b/grub-core/tests/appended_signatures.h +@@ -0,0 +1,557 @@ ++unsigned char certificate_der[] = { ++ 0x30, 0x82, 0x03, 0x88, 0x30, 0x82, 0x02, 0x70, 0xa0, 0x03, 0x02, 0x01, ++ 0x02, 0x02, 0x14, 0x25, 0x2e, 0xb8, 0xfd, 0x12, 0x62, 0x2e, 0xcd, 0x5d, ++ 0xa7, 0x53, 0xd2, 0x0b, 0xc2, 0x61, 0x7c, 0x14, 0xe0, 0x0f, 0x5c, 0x30, ++ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, ++ 0x05, 0x00, 0x30, 0x49, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, ++ 0x03, 0x0c, 0x1f, 0x47, 0x72, 0x75, 0x62, 0x20, 0x41, 0x70, 0x70, 0x65, ++ 0x6e, 0x64, 0x65, 0x64, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, ++ 0x72, 0x65, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x31, 0x1d, ++ 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, ++ 0x01, 0x16, 0x0e, 0x64, 0x6a, 0x61, 0x40, 0x61, 0x78, 0x74, 0x65, 0x6e, ++ 0x73, 0x2e, 0x6e, 0x65, 0x74, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x30, 0x30, ++ 0x37, 0x30, 0x39, 0x30, 0x36, 0x32, 0x32, 0x30, 0x37, 0x5a, 0x18, 0x0f, ++ 0x32, 0x31, 0x32, 0x30, 0x30, 0x36, 0x31, 0x35, 0x30, 0x36, 0x32, 0x32, ++ 0x30, 0x37, 0x5a, 0x30, 0x52, 0x31, 0x31, 0x30, 0x2f, 0x06, 0x03, 0x55, ++ 0x04, 0x03, 0x0c, 0x28, 0x47, 0x72, 0x75, 0x62, 0x20, 0x41, 0x70, 0x70, ++ 0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, ++ 0x75, 0x72, 0x65, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x69, 0x67, ++ 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x4b, 0x65, 0x79, 0x31, 0x1d, 0x30, 0x1b, ++ 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, ++ 0x0e, 0x64, 0x6a, 0x61, 0x40, 0x61, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x2e, ++ 0x6e, 0x65, 0x74, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, ++ 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, ++ 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, ++ 0xcd, 0xe8, 0x1c, 0x08, 0x68, 0x2e, 0xcb, 0xfe, 0x8c, 0x4b, 0x3b, 0x61, ++ 0xe7, 0x8e, 0x80, 0x58, 0x85, 0x85, 0xea, 0xc8, 0x3b, 0x42, 0xba, 0x72, ++ 0x84, 0x65, 0x20, 0xbc, 0x48, 0xa2, 0x25, 0x49, 0x6e, 0x1c, 0xb9, 0x7d, ++ 0xeb, 0xc1, 0x0c, 0xa8, 0xb7, 0xcc, 0x13, 0x78, 0xba, 0x11, 0xa4, 0x98, ++ 0xd7, 0xd0, 0x7c, 0xdd, 0xf5, 0x5a, 0xb7, 0xcd, 0x31, 0x0e, 0xcd, 0x9e, ++ 0xa7, 0x19, 0xf0, 0xbd, 0x0f, 0xa6, 0xfe, 0x8a, 0x11, 0x97, 0xed, 0x8b, ++ 0xe5, 0x16, 0xa6, 0x21, 0x13, 0x36, 0xad, 0x05, 0x49, 0xec, 0x29, 0x12, ++ 0x38, 0xa7, 0x4b, 0x0f, 0xa1, 0xfb, 0x72, 0xc0, 0xc0, 0x09, 0x67, 0x78, ++ 0xa8, 0xb6, 0xd6, 0x1a, 0x39, 0xc0, 0xa8, 0xbf, 0x5f, 0x14, 0x89, 0x5c, ++ 0xbc, 0x41, 0x0c, 0x0c, 0x5d, 0x42, 0x2e, 0x1c, 0xdf, 0x1f, 0x1d, 0xc9, ++ 0x43, 0x94, 0x5b, 0x6e, 0x8f, 0x15, 0x8c, 0x8f, 0x94, 0x73, 0x4f, 0x97, ++ 0x54, 0xf1, 0x86, 0x8a, 0xbc, 0xe4, 0xe4, 0x93, 0xc1, 0x5e, 0xc2, 0x3e, ++ 0x31, 0x5e, 0xd4, 0x85, 0x57, 0x14, 0xd0, 0x11, 0x07, 0x65, 0xf4, 0x7c, ++ 0x8f, 0x07, 0x57, 0xe1, 0x22, 0xd4, 0x78, 0x47, 0x65, 0x4e, 0xa9, 0xb3, ++ 0xaa, 0xce, 0xc7, 0x36, 0xfe, 0xda, 0x66, 0x02, 0xb6, 0x8d, 0x18, 0x2f, ++ 0x3b, 0x41, 0x8d, 0x02, 0x08, 0x72, 0x4b, 0x69, 0xbd, 0x1e, 0x58, 0xfc, ++ 0x1b, 0x64, 0x04, 0x52, 0x35, 0x35, 0xe2, 0x3d, 0x3e, 0xde, 0xd6, 0x64, ++ 0xf4, 0xec, 0x57, 0x7e, 0x65, 0x59, 0x00, 0xa6, 0xd3, 0x4b, 0x09, 0x93, ++ 0x2a, 0x95, 0x0f, 0x30, 0xb6, 0xa1, 0x8c, 0xe7, 0x8b, 0x49, 0xa4, 0x1d, ++ 0x25, 0x2d, 0x65, 0x48, 0x8a, 0x0f, 0xcf, 0x2a, 0xa2, 0xe1, 0xef, 0x72, ++ 0x92, 0xc3, 0xf5, 0x21, 0x37, 0x83, 0x9b, 0x6d, 0x0b, 0x1b, 0xb3, 0xa2, ++ 0x32, 0x38, 0x11, 0xb1, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x5d, 0x30, ++ 0x5b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, ++ 0x02, 0x30, 0x00, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, ++ 0x03, 0x02, 0x07, 0x80, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, ++ 0x16, 0x04, 0x14, 0xe5, 0x2a, 0x4f, 0xf2, 0x84, 0x91, 0x57, 0x91, 0xaf, ++ 0x12, 0xd2, 0xf1, 0xa1, 0x87, 0x73, 0x0f, 0x90, 0x25, 0xa0, 0x7a, 0x30, ++ 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, ++ 0x56, 0xd1, 0xfd, 0xe2, 0x1e, 0x7e, 0x1c, 0x63, 0x4f, 0x47, 0xdb, 0xe4, ++ 0xc4, 0x51, 0x04, 0x03, 0x9a, 0x48, 0x35, 0x6e, 0x30, 0x0d, 0x06, 0x09, ++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, ++ 0x82, 0x01, 0x01, 0x00, 0x65, 0x82, 0xd5, 0x88, 0x30, 0xe2, 0x2c, 0x47, ++ 0xf3, 0x31, 0x39, 0xa1, 0x75, 0x9a, 0xb0, 0x8a, 0x6c, 0x4b, 0xac, 0xdf, ++ 0x09, 0x7b, 0x90, 0xb6, 0x9e, 0x76, 0x62, 0x94, 0xc1, 0x3a, 0x99, 0x49, ++ 0x68, 0x29, 0x47, 0x42, 0xc3, 0x06, 0xcb, 0x88, 0x75, 0xe6, 0x79, 0x13, ++ 0x8c, 0x4b, 0x49, 0x6a, 0xb5, 0x56, 0x95, 0xc0, 0x42, 0x21, 0x9b, 0xd4, ++ 0x61, 0xd0, 0x02, 0x41, 0xdd, 0x20, 0x61, 0xe5, 0x91, 0xdf, 0x75, 0x00, ++ 0x25, 0x0e, 0x99, 0x65, 0x5c, 0x54, 0x49, 0x32, 0xa3, 0xe2, 0xcd, 0xa1, ++ 0x5f, 0x40, 0xf3, 0xc5, 0x81, 0xd9, 0x3c, 0xa3, 0x63, 0x5a, 0x38, 0x79, ++ 0xab, 0x77, 0x98, 0xde, 0x8f, 0x4e, 0x9e, 0x26, 0xbc, 0x4e, 0x80, 0x9e, ++ 0x8f, 0xbe, 0xf1, 0x00, 0xb3, 0x78, 0xb9, 0x4b, 0x1d, 0xc7, 0xa4, 0x83, ++ 0x59, 0x56, 0x11, 0xd1, 0x11, 0x1e, 0x50, 0x39, 0xd5, 0x78, 0x14, 0xf3, ++ 0xb9, 0x1d, 0xda, 0xe4, 0xc4, 0x63, 0x74, 0x26, 0xab, 0xa3, 0xfd, 0x9d, ++ 0x58, 0xa2, 0xee, 0x7b, 0x28, 0x34, 0xa3, 0xbe, 0x85, 0x7e, 0xaa, 0x97, ++ 0xb7, 0x5b, 0x9d, 0xa9, 0x4d, 0x96, 0xdb, 0x6b, 0x21, 0xe1, 0x96, 0x5d, ++ 0xc7, 0xad, 0x23, 0x03, 0x9a, 0x16, 0xdb, 0xa4, 0x1f, 0x63, 0xef, 0xaf, ++ 0x1e, 0x4f, 0xf8, 0x27, 0xdc, 0x4b, 0xfc, 0x2b, 0x68, 0x2e, 0xa0, 0xd3, ++ 0xae, 0xf2, 0xce, 0xf5, 0xfc, 0x97, 0x92, 0xd2, 0x29, 0x0f, 0x4f, 0x4b, ++ 0x29, 0xeb, 0x06, 0xcb, 0xf8, 0x21, 0x6e, 0xbc, 0x8b, 0x5c, 0xc5, 0xc9, ++ 0xf7, 0xe2, 0x7c, 0x47, 0xcd, 0x43, 0x98, 0xc4, 0xa3, 0x9a, 0xd7, 0x3e, ++ 0xdc, 0x01, 0x13, 0x28, 0x96, 0xc4, 0x60, 0x83, 0xe2, 0x79, 0xa1, 0x46, ++ 0xef, 0xf5, 0xa4, 0x7b, 0x00, 0xe3, 0x3d, 0x7d, 0xbc, 0xa8, 0x98, 0x49, ++ 0xa8, 0xcf, 0x3b, 0x41, 0xb6, 0x09, 0x97, 0x07 ++}; ++unsigned int certificate_der_len = 908; ++ ++unsigned char hi_signed[] = { ++ 0x68, 0x69, 0x0a, 0x30, 0x82, 0x01, 0xc0, 0x06, 0x09, 0x2a, 0x86, 0x48, ++ 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x82, 0x01, 0xb1, 0x30, 0x82, ++ 0x01, 0xad, 0x02, 0x01, 0x01, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, ++ 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x30, 0x0b, 0x06, 0x09, ++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0x31, 0x82, 0x01, ++ 0x8a, 0x30, 0x82, 0x01, 0x86, 0x02, 0x01, 0x01, 0x30, 0x61, 0x30, 0x49, ++ 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1f, 0x47, ++ 0x72, 0x75, 0x62, 0x20, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x64, ++ 0x20, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x54, ++ 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x09, ++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x0e, 0x64, ++ 0x6a, 0x61, 0x40, 0x61, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x2e, 0x6e, 0x65, ++ 0x74, 0x02, 0x14, 0x25, 0x2e, 0xb8, 0xfd, 0x12, 0x62, 0x2e, 0xcd, 0x5d, ++ 0xa7, 0x53, 0xd2, 0x0b, 0xc2, 0x61, 0x7c, 0x14, 0xe0, 0x0f, 0x5c, 0x30, ++ 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00, 0xc7, 0x69, 0x35, 0x21, 0x66, ++ 0x4d, 0x50, 0xd4, 0x73, 0xde, 0xbd, 0x3a, 0xf6, 0x45, 0xe3, 0xe4, 0xd0, ++ 0xb6, 0xa1, 0xe7, 0xc0, 0xa2, 0xc9, 0xf4, 0xf0, 0x05, 0x8c, 0xa4, 0x16, ++ 0x9e, 0x81, 0x0d, 0x21, 0x68, 0xf3, 0xfe, 0x03, 0x96, 0x77, 0x31, 0x69, ++ 0x01, 0xd8, 0x26, 0xd9, 0x48, 0x95, 0xcf, 0xd1, 0x17, 0xb1, 0x0b, 0x6b, ++ 0x2c, 0xf1, 0xb0, 0xab, 0x65, 0x65, 0x56, 0xf8, 0x0c, 0xa7, 0xf7, 0xbb, ++ 0xf6, 0x5a, 0x55, 0x98, 0x14, 0x07, 0x8d, 0x2a, 0xbc, 0x16, 0x48, 0x94, ++ 0xab, 0x2f, 0x85, 0x97, 0x90, 0x51, 0x78, 0xa0, 0xda, 0x60, 0xb5, 0x41, ++ 0x4b, 0xe8, 0x78, 0xc5, 0xa6, 0x04, 0x9d, 0x54, 0x2a, 0x85, 0xfd, 0x86, ++ 0x0b, 0x6d, 0xc2, 0xd2, 0xad, 0x07, 0xff, 0x16, 0x42, 0x82, 0xe3, 0x5c, ++ 0xaa, 0x22, 0x59, 0x78, 0x92, 0xea, 0x94, 0xc3, 0x41, 0xb7, 0xa1, 0x86, ++ 0x44, 0xea, 0xd1, 0xdb, 0xe5, 0xac, 0x30, 0x32, 0xfb, 0x7d, 0x3f, 0xf7, ++ 0x8b, 0x11, 0x7f, 0x80, 0x3b, 0xe5, 0xc7, 0x82, 0x0f, 0x92, 0x07, 0x14, ++ 0x66, 0x01, 0x6e, 0x85, 0xab, 0x3a, 0x14, 0xcf, 0x76, 0xd1, 0x7e, 0x14, ++ 0x85, 0xca, 0x01, 0x73, 0x72, 0x38, 0xdc, 0xde, 0x30, 0x5c, 0xfb, 0xc0, ++ 0x3d, 0x93, 0xef, 0x9c, 0xbc, 0xf8, 0xcc, 0xd2, 0xbf, 0x47, 0xec, 0xf8, ++ 0x88, 0x9b, 0xe1, 0x43, 0xbe, 0xa7, 0x47, 0x96, 0xb6, 0x5d, 0x46, 0x0e, ++ 0x7a, 0x78, 0x38, 0x19, 0xbc, 0xb5, 0xbc, 0x9b, 0x3c, 0x39, 0x92, 0x70, ++ 0x0d, 0x9d, 0x8a, 0x35, 0xaf, 0xb4, 0x9e, 0xf4, 0xef, 0xc1, 0xb8, 0x25, ++ 0xd0, 0x14, 0x91, 0xd6, 0xc2, 0xb6, 0xc7, 0x3c, 0x72, 0x91, 0x0f, 0xad, ++ 0xde, 0xb2, 0x36, 0xf8, 0x4e, 0x59, 0xd4, 0xa4, 0x21, 0x9f, 0x03, 0x95, ++ 0x48, 0x01, 0xb4, 0x05, 0xc3, 0x39, 0x60, 0x51, 0x08, 0xd0, 0xbe, 0x00, ++ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc4, 0x7e, ++ 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x61, ++ 0x74, 0x75, 0x72, 0x65, 0x20, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x65, ++ 0x64, 0x7e, 0x0a ++}; ++unsigned int hi_signed_len = 495; ++ ++unsigned char hj_signed[] = { ++ 0x68, 0x6a, 0x0a, 0x30, 0x82, 0x01, 0xc0, 0x06, 0x09, 0x2a, 0x86, 0x48, ++ 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x82, 0x01, 0xb1, 0x30, 0x82, ++ 0x01, 0xad, 0x02, 0x01, 0x01, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, ++ 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x30, 0x0b, 0x06, 0x09, ++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0x31, 0x82, 0x01, ++ 0x8a, 0x30, 0x82, 0x01, 0x86, 0x02, 0x01, 0x01, 0x30, 0x61, 0x30, 0x49, ++ 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1f, 0x47, ++ 0x72, 0x75, 0x62, 0x20, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x64, ++ 0x20, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x54, ++ 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x09, ++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x0e, 0x64, ++ 0x6a, 0x61, 0x40, 0x61, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x2e, 0x6e, 0x65, ++ 0x74, 0x02, 0x14, 0x25, 0x2e, 0xb8, 0xfd, 0x12, 0x62, 0x2e, 0xcd, 0x5d, ++ 0xa7, 0x53, 0xd2, 0x0b, 0xc2, 0x61, 0x7c, 0x14, 0xe0, 0x0f, 0x5c, 0x30, ++ 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00, 0xc7, 0x69, 0x35, 0x21, 0x66, ++ 0x4d, 0x50, 0xd4, 0x73, 0xde, 0xbd, 0x3a, 0xf6, 0x45, 0xe3, 0xe4, 0xd0, ++ 0xb6, 0xa1, 0xe7, 0xc0, 0xa2, 0xc9, 0xf4, 0xf0, 0x05, 0x8c, 0xa4, 0x16, ++ 0x9e, 0x81, 0x0d, 0x21, 0x68, 0xf3, 0xfe, 0x03, 0x96, 0x77, 0x31, 0x69, ++ 0x01, 0xd8, 0x26, 0xd9, 0x48, 0x95, 0xcf, 0xd1, 0x17, 0xb1, 0x0b, 0x6b, ++ 0x2c, 0xf1, 0xb0, 0xab, 0x65, 0x65, 0x56, 0xf8, 0x0c, 0xa7, 0xf7, 0xbb, ++ 0xf6, 0x5a, 0x55, 0x98, 0x14, 0x07, 0x8d, 0x2a, 0xbc, 0x16, 0x48, 0x94, ++ 0xab, 0x2f, 0x85, 0x97, 0x90, 0x51, 0x78, 0xa0, 0xda, 0x60, 0xb5, 0x41, ++ 0x4b, 0xe8, 0x78, 0xc5, 0xa6, 0x04, 0x9d, 0x54, 0x2a, 0x85, 0xfd, 0x86, ++ 0x0b, 0x6d, 0xc2, 0xd2, 0xad, 0x07, 0xff, 0x16, 0x42, 0x82, 0xe3, 0x5c, ++ 0xaa, 0x22, 0x59, 0x78, 0x92, 0xea, 0x94, 0xc3, 0x41, 0xb7, 0xa1, 0x86, ++ 0x44, 0xea, 0xd1, 0xdb, 0xe5, 0xac, 0x30, 0x32, 0xfb, 0x7d, 0x3f, 0xf7, ++ 0x8b, 0x11, 0x7f, 0x80, 0x3b, 0xe5, 0xc7, 0x82, 0x0f, 0x92, 0x07, 0x14, ++ 0x66, 0x01, 0x6e, 0x85, 0xab, 0x3a, 0x14, 0xcf, 0x76, 0xd1, 0x7e, 0x14, ++ 0x85, 0xca, 0x01, 0x73, 0x72, 0x38, 0xdc, 0xde, 0x30, 0x5c, 0xfb, 0xc0, ++ 0x3d, 0x93, 0xef, 0x9c, 0xbc, 0xf8, 0xcc, 0xd2, 0xbf, 0x47, 0xec, 0xf8, ++ 0x88, 0x9b, 0xe1, 0x43, 0xbe, 0xa7, 0x47, 0x96, 0xb6, 0x5d, 0x46, 0x0e, ++ 0x7a, 0x78, 0x38, 0x19, 0xbc, 0xb5, 0xbc, 0x9b, 0x3c, 0x39, 0x92, 0x70, ++ 0x0d, 0x9d, 0x8a, 0x35, 0xaf, 0xb4, 0x9e, 0xf4, 0xef, 0xc1, 0xb8, 0x25, ++ 0xd0, 0x14, 0x91, 0xd6, 0xc2, 0xb6, 0xc7, 0x3c, 0x72, 0x91, 0x0f, 0xad, ++ 0xde, 0xb2, 0x36, 0xf8, 0x4e, 0x59, 0xd4, 0xa4, 0x21, 0x9f, 0x03, 0x95, ++ 0x48, 0x01, 0xb4, 0x05, 0xc3, 0x39, 0x60, 0x51, 0x08, 0xd0, 0xbe, 0x00, ++ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc4, 0x7e, ++ 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x61, ++ 0x74, 0x75, 0x72, 0x65, 0x20, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x65, ++ 0x64, 0x7e, 0x0a ++}; ++unsigned int hj_signed_len = 495; ++ ++unsigned char hi_signed_sha256[] = { ++ 0x68, 0x69, 0x0a, 0x30, 0x82, 0x01, 0xc0, 0x06, 0x09, 0x2a, 0x86, 0x48, ++ 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x82, 0x01, 0xb1, 0x30, 0x82, ++ 0x01, 0xad, 0x02, 0x01, 0x01, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, ++ 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, 0x0b, 0x06, 0x09, ++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0x31, 0x82, 0x01, ++ 0x8a, 0x30, 0x82, 0x01, 0x86, 0x02, 0x01, 0x01, 0x30, 0x61, 0x30, 0x49, ++ 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1f, 0x47, ++ 0x72, 0x75, 0x62, 0x20, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x64, ++ 0x20, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x54, ++ 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x09, ++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x0e, 0x64, ++ 0x6a, 0x61, 0x40, 0x61, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x2e, 0x6e, 0x65, ++ 0x74, 0x02, 0x14, 0x25, 0x2e, 0xb8, 0xfd, 0x12, 0x62, 0x2e, 0xcd, 0x5d, ++ 0xa7, 0x53, 0xd2, 0x0b, 0xc2, 0x61, 0x7c, 0x14, 0xe0, 0x0f, 0x5c, 0x30, ++ 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00, 0x7b, 0x5e, 0x82, 0x1d, 0x21, ++ 0xb6, 0x40, 0xd3, 0x33, 0x79, 0xa7, 0x52, 0x2b, 0xfc, 0x46, 0x51, 0x26, ++ 0xfe, 0x0f, 0x81, 0x90, 0x81, 0xab, 0x57, 0x5e, 0xf6, 0x45, 0x41, 0xa3, ++ 0x7b, 0x48, 0xdd, 0xd6, 0x59, 0x60, 0x51, 0x31, 0x14, 0x14, 0x7b, 0xb4, ++ 0x55, 0x7b, 0x4d, 0xfe, 0x09, 0x7a, 0x5d, 0xae, 0xc4, 0x58, 0x50, 0x80, ++ 0x75, 0xf2, 0x23, 0x20, 0x62, 0xe3, 0x7c, 0x26, 0x1d, 0x2a, 0x4d, 0x9f, ++ 0x89, 0xf0, 0x4f, 0x95, 0x8a, 0x80, 0x6e, 0x1a, 0xea, 0x87, 0xdb, 0x1f, ++ 0xf3, 0xda, 0x04, 0x91, 0x37, 0xea, 0x0a, 0xfb, 0x6c, 0xc9, 0x3d, 0x73, ++ 0xf9, 0x58, 0x7c, 0x15, 0x6b, 0xa2, 0x52, 0x5a, 0x97, 0xff, 0xd6, 0xb0, ++ 0xf1, 0xbf, 0xa5, 0x04, 0x6d, 0x91, 0xc1, 0x54, 0x05, 0xdc, 0x7f, 0x5d, ++ 0x19, 0xaf, 0x55, 0xec, 0x51, 0xfb, 0x66, 0x0a, 0xa4, 0x4e, 0x96, 0x47, ++ 0x43, 0x54, 0x7c, 0x64, 0xa8, 0xaa, 0xb4, 0x90, 0x02, 0xf3, 0xa7, 0x0b, ++ 0xb7, 0xbf, 0x06, 0xdb, 0x5e, 0x9c, 0x32, 0x6d, 0x45, 0x14, 0x1c, 0xaf, ++ 0x46, 0x30, 0x08, 0x55, 0x49, 0x78, 0xfa, 0x57, 0xda, 0x3d, 0xf5, 0xa0, ++ 0xef, 0x11, 0x0a, 0x81, 0x0d, 0x82, 0xcd, 0xaf, 0xdb, 0xda, 0x0e, 0x1a, ++ 0x44, 0xd1, 0xee, 0xc4, 0xb8, 0xde, 0x97, 0xb4, 0xda, 0xb4, 0x8b, 0x4f, ++ 0x58, 0x24, 0x59, 0xc0, 0xe0, 0x08, 0x97, 0x14, 0x68, 0xbe, 0x31, 0x09, ++ 0x5e, 0x67, 0x45, 0xf0, 0xcb, 0x81, 0x4f, 0x17, 0x44, 0x61, 0xe0, 0xe2, ++ 0xf0, 0xfc, 0x1e, 0xb9, 0x73, 0xaf, 0x42, 0xff, 0x33, 0xde, 0x61, 0x6b, ++ 0x7f, 0xc2, 0x69, 0x0d, 0x66, 0x54, 0xae, 0xf6, 0xde, 0x20, 0x47, 0x44, ++ 0x9b, 0x73, 0xd1, 0x07, 0x6e, 0x77, 0x37, 0x0a, 0xbb, 0x7f, 0xa0, 0x93, ++ 0x2d, 0x8d, 0x44, 0xba, 0xe2, 0xdd, 0x34, 0x32, 0xd7, 0x56, 0x71, 0x00, ++ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc4, 0x7e, ++ 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x73, 0x69, 0x67, 0x6e, 0x61, ++ 0x74, 0x75, 0x72, 0x65, 0x20, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x65, ++ 0x64, 0x7e, 0x0a ++}; ++unsigned int hi_signed_sha256_len = 495; ++ ++unsigned char short_msg[] = { ++ 0x68, 0x69, 0x0a ++}; ++unsigned int short_msg_len = 3; ++ ++unsigned char unsigned_msg[] = { ++ 0x53, 0x65, 0x64, 0x20, 0x75, 0x74, 0x20, 0x70, 0x65, 0x72, 0x73, 0x70, ++ 0x69, 0x63, 0x69, 0x61, 0x74, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x64, 0x65, ++ 0x20, 0x6f, 0x6d, 0x6e, 0x69, 0x73, 0x20, 0x69, 0x73, 0x74, 0x65, 0x20, ++ 0x6e, 0x61, 0x74, 0x75, 0x73, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, ++ 0x73, 0x69, 0x74, 0x20, 0x76, 0x6f, 0x6c, 0x75, 0x70, 0x74, 0x61, 0x74, ++ 0x65, 0x6d, 0x20, 0x61, 0x63, 0x63, 0x75, 0x73, 0x61, 0x6e, 0x74, 0x69, ++ 0x75, 0x6d, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x65, 0x6d, 0x71, 0x75, ++ 0x65, 0x20, 0x6c, 0x61, 0x75, 0x64, 0x61, 0x6e, 0x74, 0x69, 0x75, 0x6d, ++ 0x2c, 0x20, 0x74, 0x6f, 0x74, 0x61, 0x6d, 0x20, 0x72, 0x65, 0x6d, 0x20, ++ 0x61, 0x70, 0x65, 0x72, 0x69, 0x61, 0x6d, 0x2c, 0x20, 0x65, 0x61, 0x71, ++ 0x75, 0x65, 0x20, 0x69, 0x70, 0x73, 0x61, 0x20, 0x71, 0x75, 0x61, 0x65, ++ 0x20, 0x61, 0x62, 0x20, 0x69, 0x6c, 0x6c, 0x6f, 0x20, 0x69, 0x6e, 0x76, ++ 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x76, 0x65, 0x72, 0x69, 0x74, ++ 0x61, 0x74, 0x69, 0x73, 0x20, 0x65, 0x74, 0x20, 0x71, 0x75, 0x61, 0x73, ++ 0x69, 0x20, 0x61, 0x72, 0x63, 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x6f, ++ 0x20, 0x62, 0x65, 0x61, 0x74, 0x61, 0x65, 0x20, 0x76, 0x69, 0x74, 0x61, ++ 0x65, 0x20, 0x64, 0x69, 0x63, 0x74, 0x61, 0x20, 0x73, 0x75, 0x6e, 0x74, ++ 0x20, 0x65, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x62, 0x6f, 0x2e, 0x20, ++ 0x4e, 0x65, 0x6d, 0x6f, 0x20, 0x65, 0x6e, 0x69, 0x6d, 0x20, 0x69, 0x70, ++ 0x73, 0x61, 0x6d, 0x20, 0x76, 0x6f, 0x6c, 0x75, 0x70, 0x74, 0x61, 0x74, ++ 0x65, 0x6d, 0x20, 0x71, 0x75, 0x69, 0x61, 0x20, 0x76, 0x6f, 0x6c, 0x75, ++ 0x70, 0x74, 0x61, 0x73, 0x20, 0x73, 0x69, 0x74, 0x20, 0x61, 0x73, 0x70, ++ 0x65, 0x72, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x20, 0x61, 0x75, 0x74, 0x20, ++ 0x6f, 0x64, 0x69, 0x74, 0x20, 0x61, 0x75, 0x74, 0x20, 0x66, 0x75, 0x67, ++ 0x69, 0x74, 0x2c, 0x20, 0x73, 0x65, 0x64, 0x20, 0x71, 0x75, 0x69, 0x61, ++ 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x71, 0x75, 0x75, 0x6e, 0x74, 0x75, ++ 0x72, 0x20, 0x6d, 0x61, 0x67, 0x6e, 0x69, 0x20, 0x64, 0x6f, 0x6c, 0x6f, ++ 0x72, 0x65, 0x73, 0x20, 0x65, 0x6f, 0x73, 0x20, 0x71, 0x75, 0x69, 0x20, ++ 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x65, 0x20, 0x76, 0x6f, 0x6c, 0x75, ++ 0x70, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x20, 0x73, 0x65, 0x71, 0x75, 0x69, ++ 0x20, 0x6e, 0x65, 0x73, 0x63, 0x69, 0x75, 0x6e, 0x74, 0x2e, 0x20, 0x4e, ++ 0x65, 0x71, 0x75, 0x65, 0x20, 0x70, 0x6f, 0x72, 0x72, 0x6f, 0x20, 0x71, ++ 0x75, 0x69, 0x73, 0x71, 0x75, 0x61, 0x6d, 0x20, 0x65, 0x73, 0x74, 0x2c, ++ 0x20, 0x71, 0x75, 0x69, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x65, 0x6d, ++ 0x20, 0x69, 0x70, 0x73, 0x75, 0x6d, 0x20, 0x71, 0x75, 0x69, 0x61, 0x20, ++ 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x73, 0x69, 0x74, 0x20, 0x61, 0x6d, ++ 0x65, 0x74, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x63, 0x74, 0x65, ++ 0x74, 0x75, 0x72, 0x2c, 0x20, 0x61, 0x64, 0x69, 0x70, 0x69, 0x73, 0x63, ++ 0x69, 0x20, 0x76, 0x65, 0x6c, 0x69, 0x74, 0x2c, 0x20, 0x73, 0x65, 0x64, ++ 0x20, 0x71, 0x75, 0x69, 0x61, 0x20, 0x6e, 0x6f, 0x6e, 0x20, 0x6e, 0x75, ++ 0x6d, 0x71, 0x75, 0x61, 0x6d, 0x20, 0x65, 0x69, 0x75, 0x73, 0x20, 0x6d, ++ 0x6f, 0x64, 0x69, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x20, ++ 0x69, 0x6e, 0x63, 0x69, 0x64, 0x75, 0x6e, 0x74, 0x20, 0x75, 0x74, 0x20, ++ 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x65, 0x20, 0x65, 0x74, 0x20, 0x64, 0x6f, ++ 0x6c, 0x6f, 0x72, 0x65, 0x20, 0x6d, 0x61, 0x67, 0x6e, 0x61, 0x6d, 0x20, ++ 0x61, 0x6c, 0x69, 0x71, 0x75, 0x61, 0x6d, 0x20, 0x71, 0x75, 0x61, 0x65, ++ 0x72, 0x61, 0x74, 0x20, 0x76, 0x6f, 0x6c, 0x75, 0x70, 0x74, 0x61, 0x74, ++ 0x65, 0x6d, 0x2e, 0x20, 0x55, 0x74, 0x20, 0x65, 0x6e, 0x69, 0x6d, 0x20, ++ 0x61, 0x64, 0x20, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x61, 0x20, 0x76, 0x65, ++ 0x6e, 0x69, 0x61, 0x6d, 0x2c, 0x20, 0x71, 0x75, 0x69, 0x73, 0x20, 0x6e, ++ 0x6f, 0x73, 0x74, 0x72, 0x75, 0x6d, 0x20, 0x65, 0x78, 0x65, 0x72, 0x63, ++ 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x65, 0x6d, 0x20, 0x75, 0x6c, ++ 0x6c, 0x61, 0x6d, 0x20, 0x63, 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x69, 0x73, ++ 0x20, 0x73, 0x75, 0x73, 0x63, 0x69, 0x70, 0x69, 0x74, 0x20, 0x6c, 0x61, ++ 0x62, 0x6f, 0x72, 0x69, 0x6f, 0x73, 0x61, 0x6d, 0x2c, 0x20, 0x6e, 0x69, ++ 0x73, 0x69, 0x20, 0x75, 0x74, 0x20, 0x61, 0x6c, 0x69, 0x71, 0x75, 0x69, ++ 0x64, 0x20, 0x65, 0x78, 0x20, 0x65, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x6d, ++ 0x6f, 0x64, 0x69, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x71, 0x75, 0x61, ++ 0x74, 0x75, 0x72, 0x3f, 0x20, 0x51, 0x75, 0x69, 0x73, 0x20, 0x61, 0x75, ++ 0x74, 0x65, 0x6d, 0x20, 0x76, 0x65, 0x6c, 0x20, 0x65, 0x75, 0x6d, 0x20, ++ 0x69, 0x75, 0x72, 0x65, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x68, 0x65, ++ 0x6e, 0x64, 0x65, 0x72, 0x69, 0x74, 0x20, 0x71, 0x75, 0x69, 0x20, 0x69, ++ 0x6e, 0x20, 0x65, 0x61, 0x20, 0x76, 0x6f, 0x6c, 0x75, 0x70, 0x74, 0x61, ++ 0x74, 0x65, 0x20, 0x76, 0x65, 0x6c, 0x69, 0x74, 0x20, 0x65, 0x73, 0x73, ++ 0x65, 0x20, 0x71, 0x75, 0x61, 0x6d, 0x20, 0x6e, 0x69, 0x68, 0x69, 0x6c, ++ 0x20, 0x6d, 0x6f, 0x6c, 0x65, 0x73, 0x74, 0x69, 0x61, 0x65, 0x20, 0x63, ++ 0x6f, 0x6e, 0x73, 0x65, 0x71, 0x75, 0x61, 0x74, 0x75, 0x72, 0x2c, 0x20, ++ 0x76, 0x65, 0x6c, 0x20, 0x69, 0x6c, 0x6c, 0x75, 0x6d, 0x20, 0x71, 0x75, ++ 0x69, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x65, 0x6d, 0x20, 0x65, 0x75, ++ 0x6d, 0x20, 0x66, 0x75, 0x67, 0x69, 0x61, 0x74, 0x20, 0x71, 0x75, 0x6f, ++ 0x20, 0x76, 0x6f, 0x6c, 0x75, 0x70, 0x74, 0x61, 0x73, 0x20, 0x6e, 0x75, ++ 0x6c, 0x6c, 0x61, 0x20, 0x70, 0x61, 0x72, 0x69, 0x61, 0x74, 0x75, 0x72, ++ 0x3f, 0x0a ++}; ++unsigned int unsigned_msg_len = 866; ++ ++unsigned char certificate2_der[] = { ++ 0x30, 0x82, 0x05, 0x52, 0x30, 0x82, 0x03, 0x3a, 0xa0, 0x03, 0x02, 0x01, ++ 0x02, 0x02, 0x14, 0x5b, 0x5e, 0x59, 0xf2, 0x5f, 0x75, 0x4c, 0x8e, 0xc5, ++ 0x3a, 0x91, 0x07, 0xe9, 0xe7, 0x6d, 0x3c, 0xd0, 0x7f, 0x91, 0xff, 0x30, ++ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, ++ 0x05, 0x00, 0x30, 0x3a, 0x31, 0x38, 0x30, 0x36, 0x06, 0x03, 0x55, 0x04, ++ 0x03, 0x0c, 0x2f, 0x47, 0x72, 0x75, 0x62, 0x20, 0x32, 0x6e, 0x64, 0x20, ++ 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, ++ 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, ++ 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, ++ 0x74, 0x79, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x37, 0x32, 0x38, ++ 0x31, 0x33, 0x32, 0x34, 0x32, 0x39, 0x5a, 0x18, 0x0f, 0x32, 0x31, 0x32, ++ 0x30, 0x30, 0x37, 0x30, 0x34, 0x31, 0x33, 0x32, 0x34, 0x32, 0x39, 0x5a, ++ 0x30, 0x2b, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, ++ 0x20, 0x47, 0x72, 0x75, 0x62, 0x20, 0x32, 0x6e, 0x64, 0x20, 0x43, 0x65, ++ 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x53, 0x69, ++ 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x4b, 0x65, 0x79, 0x30, 0x82, 0x02, ++ 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, ++ 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x02, 0x0f, 0x00, 0x30, 0x82, 0x02, ++ 0x0a, 0x02, 0x82, 0x02, 0x01, 0x00, 0xb0, 0x2f, 0x50, 0x01, 0x9c, 0x0e, ++ 0xd6, 0x8c, 0x07, 0xca, 0xc1, 0xcf, 0xbc, 0x03, 0xdd, 0xd3, 0xfa, 0xe3, ++ 0x4f, 0x71, 0xc1, 0x30, 0xaa, 0x09, 0x96, 0xe4, 0xd0, 0x6c, 0x42, 0x93, ++ 0xdb, 0x35, 0xf6, 0x7e, 0x1b, 0x67, 0xc0, 0xc2, 0x2d, 0x5b, 0xec, 0xca, ++ 0x35, 0x06, 0x32, 0x6c, 0x7b, 0x2c, 0xd3, 0x71, 0x2b, 0xe9, 0x7a, 0x19, ++ 0xd1, 0xf2, 0xa0, 0x7f, 0xd7, 0x4d, 0x6e, 0x28, 0xbb, 0xae, 0x49, 0x4a, ++ 0xbc, 0xea, 0x47, 0x67, 0xb8, 0x36, 0xa6, 0xf5, 0x0d, 0x0e, 0x20, 0x14, ++ 0x0c, 0x66, 0x67, 0x28, 0xb5, 0x97, 0x8b, 0x1f, 0x5e, 0x32, 0x06, 0x29, ++ 0x9c, 0x99, 0x92, 0x0f, 0x73, 0xac, 0xfd, 0xd2, 0x1d, 0xf2, 0xa8, 0x55, ++ 0x9d, 0x1b, 0xd8, 0x3d, 0xb0, 0x76, 0x9a, 0xb6, 0x6c, 0x9f, 0x62, 0x37, ++ 0x2f, 0xc0, 0xef, 0x44, 0xb3, 0x0d, 0x4a, 0x3e, 0x4f, 0x7d, 0xbd, 0xdb, ++ 0xd8, 0x75, 0x5f, 0x68, 0xe3, 0xf0, 0xec, 0x82, 0x66, 0x7c, 0x31, 0x70, ++ 0xa9, 0xa1, 0x6f, 0x38, 0x9f, 0xdf, 0xf5, 0xf0, 0x7d, 0x23, 0x9d, 0x34, ++ 0xa5, 0x85, 0xd3, 0xdf, 0x68, 0x41, 0xfc, 0x4f, 0x89, 0x45, 0x3c, 0x24, ++ 0x81, 0xa6, 0xf2, 0x3c, 0x02, 0x26, 0x09, 0x48, 0xdd, 0xfe, 0x4b, 0xb6, ++ 0x66, 0xbf, 0x8f, 0xe5, 0x5f, 0xf0, 0x5d, 0x8a, 0x61, 0x2e, 0x5f, 0x9f, ++ 0x80, 0xd9, 0xd5, 0xe6, 0x41, 0xd8, 0x10, 0x5e, 0x7a, 0xc6, 0xdb, 0x89, ++ 0xc7, 0xca, 0x6c, 0x5b, 0xb1, 0x4e, 0x7d, 0x0c, 0x03, 0xfd, 0x50, 0xca, ++ 0xbf, 0xbb, 0xe2, 0x69, 0x4b, 0x4e, 0xc2, 0x3d, 0x75, 0xfa, 0xd1, 0xcc, ++ 0xd6, 0xf9, 0x39, 0xb9, 0xdc, 0x53, 0xad, 0x62, 0xfb, 0x1b, 0x94, 0x26, ++ 0x7f, 0x21, 0x54, 0x5c, 0xb7, 0xdc, 0xe7, 0x96, 0x8c, 0xce, 0x75, 0xe0, ++ 0x17, 0x01, 0x3a, 0x3c, 0x77, 0x6e, 0xa4, 0x8b, 0x7a, 0x83, 0x28, 0x7a, ++ 0xf7, 0xb0, 0x5f, 0xfc, 0x7f, 0x2d, 0x2e, 0xec, 0xf5, 0xeb, 0x9c, 0x63, ++ 0x74, 0xd0, 0xe5, 0xdc, 0x19, 0xe4, 0x71, 0xc5, 0x4a, 0x8a, 0x54, 0xa4, ++ 0xe0, 0x7d, 0x4e, 0xbf, 0x53, 0x30, 0xaf, 0xd0, 0xeb, 0x96, 0xc3, 0xbb, ++ 0x65, 0xf7, 0x67, 0xf5, 0xae, 0xd3, 0x96, 0xf2, 0x63, 0xc8, 0x69, 0xf7, ++ 0x47, 0xcb, 0x27, 0x79, 0xe1, 0xff, 0x2f, 0x68, 0xdf, 0x1e, 0xb3, 0xb8, ++ 0x0c, 0xc5, 0x58, 0x73, 0xcc, 0xfe, 0x8c, 0xda, 0x4e, 0x3b, 0x01, 0x04, ++ 0xcd, 0xcb, 0xb8, 0x3e, 0x06, 0xfd, 0x4c, 0x0a, 0x9f, 0x5e, 0x76, 0x8c, ++ 0x0c, 0x83, 0x75, 0x09, 0x08, 0xb2, 0xdb, 0xf4, 0x49, 0x4e, 0xa0, 0xf2, ++ 0x0c, 0x7b, 0x87, 0x38, 0x9e, 0x22, 0x67, 0xbd, 0xd1, 0x97, 0x57, 0x24, ++ 0xf1, 0x46, 0x07, 0xf9, 0xd2, 0x1b, 0xec, 0x25, 0x5e, 0x67, 0xd9, 0x66, ++ 0x23, 0x1b, 0xd3, 0xe4, 0xaa, 0xec, 0x88, 0xf0, 0x7e, 0x15, 0x83, 0x51, ++ 0x31, 0x67, 0x51, 0x76, 0x5f, 0x55, 0xd7, 0x36, 0xdf, 0x4a, 0x84, 0x0b, ++ 0x6f, 0x5c, 0xbb, 0x5b, 0x8f, 0x37, 0x23, 0x7f, 0xf8, 0x17, 0x84, 0xa2, ++ 0x70, 0x20, 0x07, 0x0c, 0x90, 0x3a, 0x04, 0xfd, 0xf0, 0x08, 0x4a, 0xb1, ++ 0x16, 0x0f, 0xe6, 0xf6, 0x40, 0x51, 0x83, 0xd2, 0x87, 0x40, 0x9c, 0x1c, ++ 0x9f, 0x13, 0x38, 0x17, 0xd3, 0x34, 0x58, 0xad, 0x05, 0x71, 0xa0, 0x73, ++ 0xca, 0x40, 0xa6, 0xa4, 0x81, 0x02, 0xee, 0xa8, 0x72, 0x41, 0xa1, 0x41, ++ 0x18, 0x64, 0x8a, 0x86, 0x8a, 0x5d, 0xe6, 0x4f, 0x0a, 0xc5, 0x95, 0x98, ++ 0xf9, 0x78, 0xfe, 0x19, 0x0d, 0xc9, 0xb3, 0x89, 0xc1, 0x2b, 0x09, 0xbe, ++ 0xf1, 0xd2, 0x04, 0x5d, 0xcc, 0x28, 0xf5, 0x4b, 0xd2, 0x20, 0x4f, 0xc5, ++ 0x41, 0x9d, 0x8c, 0x85, 0xd8, 0xb0, 0x68, 0x5e, 0xc1, 0x0c, 0xb7, 0x24, ++ 0x4d, 0x67, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x5d, 0x30, 0x5b, 0x30, ++ 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, ++ 0x00, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, ++ 0x07, 0x80, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, ++ 0x14, 0xac, 0xf5, 0x47, 0x17, 0xd9, 0x7d, 0xc1, 0xb1, 0xc4, 0x41, 0xe1, ++ 0x41, 0x60, 0xcb, 0x37, 0x11, 0x60, 0x28, 0x78, 0x5f, 0x30, 0x1f, 0x06, ++ 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x21, 0x94, ++ 0xfb, 0xf9, 0xb2, 0x43, 0xe9, 0x33, 0xd7, 0x50, 0x7d, 0xc7, 0x37, 0xdb, ++ 0xd5, 0x82, 0x5a, 0x4e, 0xbe, 0x1b, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, ++ 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x02, ++ 0x01, 0x00, 0x96, 0x70, 0x65, 0x26, 0x42, 0xf8, 0xdc, 0x69, 0xde, 0xcf, ++ 0x41, 0x3a, 0x2e, 0x7f, 0x5b, 0xf1, 0xf9, 0x3b, 0x9b, 0xd2, 0x4e, 0x64, ++ 0x48, 0x81, 0xe4, 0x5d, 0x1e, 0x22, 0xce, 0x68, 0x63, 0x62, 0xe5, 0x1b, ++ 0x9b, 0xf2, 0xc7, 0x12, 0xda, 0x1e, 0x9b, 0x90, 0x84, 0x79, 0x48, 0x12, ++ 0xe6, 0x21, 0x6f, 0x2f, 0x7e, 0x18, 0x77, 0xdb, 0x8c, 0xc4, 0xd1, 0x0d, ++ 0x91, 0xbf, 0x39, 0x22, 0x0f, 0x64, 0xcf, 0x25, 0x2e, 0x8c, 0x1f, 0x91, ++ 0x81, 0xb5, 0xe9, 0x6c, 0x02, 0x3a, 0xf8, 0x07, 0xa2, 0x6f, 0x46, 0x5d, ++ 0x7b, 0xfd, 0x43, 0xff, 0x41, 0x0f, 0xe2, 0x57, 0x1c, 0xbd, 0x48, 0x60, ++ 0x53, 0x11, 0x48, 0x87, 0x88, 0x9d, 0x13, 0x82, 0x40, 0x68, 0x44, 0x2c, ++ 0xc6, 0xc8, 0x95, 0x27, 0x4f, 0xb6, 0xb9, 0x4a, 0x22, 0x0a, 0xfd, 0xe4, ++ 0x46, 0x8f, 0x35, 0x12, 0x98, 0x5a, 0x34, 0x6f, 0x2b, 0x57, 0x62, 0xa1, ++ 0x4d, 0x8d, 0x79, 0x37, 0xe4, 0x6b, 0x8a, 0x32, 0x5b, 0xcb, 0xef, 0x79, ++ 0x11, 0xed, 0xa7, 0xf8, 0x7a, 0x1c, 0xbd, 0x86, 0xdc, 0x0e, 0x2e, 0xfd, ++ 0xd3, 0x51, 0xbb, 0x73, 0xad, 0x00, 0xa0, 0x1b, 0xf9, 0x1d, 0xd1, 0x4a, ++ 0xe4, 0xd4, 0x02, 0x63, 0x2b, 0x39, 0x5f, 0x18, 0x08, 0x2f, 0x42, 0xb7, ++ 0x23, 0x4b, 0x48, 0x46, 0x1f, 0x63, 0x87, 0xae, 0x6d, 0xd5, 0xdb, 0x60, ++ 0xf8, 0x5f, 0xd3, 0x13, 0xec, 0xca, 0xdd, 0x60, 0x60, 0x79, 0x52, 0x70, ++ 0x47, 0xae, 0x1d, 0x38, 0x78, 0x71, 0xcf, 0xb3, 0x04, 0x03, 0xbe, 0xba, ++ 0x81, 0xba, 0x74, 0xb1, 0x30, 0x35, 0xdc, 0xea, 0x21, 0x4a, 0x9b, 0x70, ++ 0xfb, 0xd6, 0x60, 0x59, 0x78, 0x0c, 0x4d, 0x39, 0x19, 0x1d, 0xe5, 0x75, ++ 0xba, 0x07, 0xf4, 0x22, 0x37, 0x64, 0xb7, 0xf2, 0x9a, 0xc9, 0x11, 0x2d, ++ 0x8e, 0x58, 0xa6, 0xcf, 0x83, 0xf1, 0xcb, 0x6c, 0x7f, 0x02, 0xbd, 0xda, ++ 0x03, 0x92, 0xa9, 0x45, 0x24, 0x56, 0xc5, 0xbd, 0x41, 0xd1, 0x20, 0x86, ++ 0xc0, 0xb6, 0xb7, 0xe8, 0xa7, 0xb2, 0x46, 0xf7, 0x8e, 0xa9, 0x38, 0x0e, ++ 0x23, 0x77, 0x3c, 0x0d, 0x66, 0x83, 0x6a, 0x1a, 0x6b, 0x7f, 0x54, 0x11, ++ 0x58, 0x0d, 0x4a, 0xb5, 0x74, 0x60, 0xca, 0xed, 0xff, 0x91, 0x47, 0xd9, ++ 0x29, 0xe0, 0xaa, 0x8c, 0xa8, 0x8f, 0x10, 0x4c, 0x15, 0x7d, 0xce, 0x95, ++ 0xf9, 0x87, 0x1e, 0x18, 0x38, 0x18, 0xfc, 0xcc, 0xaf, 0x91, 0x17, 0x3f, ++ 0xfa, 0xf0, 0x8a, 0x09, 0x6f, 0xba, 0x4e, 0x53, 0xf7, 0xfa, 0x4f, 0x20, ++ 0xa3, 0xf4, 0x4a, 0x5a, 0xde, 0x17, 0x1c, 0x29, 0x6a, 0x6f, 0x03, 0x48, ++ 0xdf, 0xad, 0x4f, 0xe4, 0xbc, 0x71, 0xc4, 0x72, 0x32, 0x11, 0x84, 0xac, ++ 0x09, 0xd2, 0x18, 0x44, 0x35, 0xf1, 0xcd, 0xaf, 0xa8, 0x98, 0xe0, 0x8b, ++ 0xec, 0xa0, 0x83, 0x37, 0xc3, 0x35, 0x85, 0xd6, 0xd8, 0x1b, 0xe0, 0x75, ++ 0xdc, 0xfd, 0xde, 0xc9, 0xeb, 0xd5, 0x18, 0x0f, 0xd3, 0x4c, 0x2f, 0x71, ++ 0xdc, 0x48, 0xe3, 0x14, 0xeb, 0xda, 0x00, 0x24, 0x24, 0x9e, 0xa3, 0x8e, ++ 0x3e, 0x08, 0x6f, 0x22, 0x24, 0xd6, 0xc4, 0x85, 0x8f, 0x68, 0x00, 0x4a, ++ 0x82, 0x4c, 0x33, 0x6e, 0xa5, 0x35, 0x7b, 0xeb, 0x4b, 0xdc, 0xa0, 0xa6, ++ 0x65, 0x6f, 0x5a, 0x7a, 0xdf, 0x8a, 0x01, 0x52, 0xa1, 0x6c, 0xff, 0x59, ++ 0x22, 0x7f, 0xe1, 0x96, 0x1b, 0x19, 0xb8, 0xf9, 0x5d, 0x44, 0x9f, 0x91, ++ 0x03, 0x3c, 0x3d, 0xa1, 0x2a, 0xb6, 0x5a, 0x51, 0xa0, 0xce, 0x4a, 0x88, ++ 0x22, 0x72, 0x9c, 0xdc, 0xc0, 0x47, 0x76, 0x35, 0x84, 0x75, 0x9b, 0x87, ++ 0x5c, 0xd3, 0xcf, 0xe7, 0xdd, 0xa3, 0x57, 0x14, 0xdf, 0x00, 0xfd, 0x19, ++ 0x2a, 0x7d, 0x89, 0x27, 0x1c, 0x78, 0x97, 0x04, 0x58, 0x48 ++}; ++unsigned int certificate2_der_len = 1366; ++ ++unsigned char hi_signed_2nd[] = { ++ 0x68, 0x69, 0x0a, 0x30, 0x82, 0x02, 0xb1, 0x06, 0x09, 0x2a, 0x86, 0x48, ++ 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x82, 0x02, 0xa2, 0x30, 0x82, ++ 0x02, 0x9e, 0x02, 0x01, 0x01, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, ++ 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x30, 0x0b, 0x06, 0x09, ++ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0x31, 0x82, 0x02, ++ 0x7b, 0x30, 0x82, 0x02, 0x77, 0x02, 0x01, 0x01, 0x30, 0x52, 0x30, 0x3a, ++ 0x31, 0x38, 0x30, 0x36, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x2f, 0x47, ++ 0x72, 0x75, 0x62, 0x20, 0x32, 0x6e, 0x64, 0x20, 0x43, 0x65, 0x72, 0x74, ++ 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x54, 0x65, 0x73, 0x74, ++ 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, ++ 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x02, 0x14, ++ 0x5b, 0x5e, 0x59, 0xf2, 0x5f, 0x75, 0x4c, 0x8e, 0xc5, 0x3a, 0x91, 0x07, ++ 0xe9, 0xe7, 0x6d, 0x3c, 0xd0, 0x7f, 0x91, 0xff, 0x30, 0x0b, 0x06, 0x09, ++ 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x30, 0x0d, 0x06, ++ 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, ++ 0x04, 0x82, 0x02, 0x00, 0x0e, 0xc2, 0x30, 0x38, 0x81, 0x23, 0x68, 0x90, ++ 0xae, 0x5f, 0xce, 0xf7, 0x27, 0xb1, 0x8c, 0x2e, 0x12, 0x10, 0xc6, 0x99, ++ 0xdc, 0x4d, 0x4b, 0x79, 0xda, 0xe4, 0x32, 0x10, 0x46, 0x1c, 0x16, 0x07, ++ 0x87, 0x66, 0x55, 0xff, 0x64, 0x1c, 0x61, 0x25, 0xd5, 0xb9, 0xe1, 0xfe, ++ 0xea, 0x5a, 0xcd, 0x56, 0xa5, 0xc3, 0xbe, 0xb1, 0x61, 0xc7, 0x6f, 0x5f, ++ 0x69, 0x20, 0x64, 0x50, 0x6f, 0x12, 0x78, 0xb6, 0x0c, 0x72, 0x44, 0x4f, ++ 0x60, 0x0f, 0x9f, 0xa2, 0x83, 0x3b, 0xc2, 0x83, 0xd5, 0x14, 0x1f, 0x6f, ++ 0x3e, 0xb2, 0x47, 0xb5, 0x58, 0xc5, 0xa7, 0xb4, 0x82, 0x53, 0x2e, 0x53, ++ 0x95, 0x4e, 0x3d, 0xe4, 0x62, 0xe8, 0xa1, 0xaf, 0xae, 0xbf, 0xa9, 0xd2, ++ 0x22, 0x07, 0xbe, 0x71, 0x37, 0x2c, 0x5a, 0xa7, 0x6c, 0xaf, 0x14, 0xc0, ++ 0x6c, 0x2f, 0xbf, 0x4f, 0x15, 0xc2, 0x0f, 0x8b, 0xdc, 0x68, 0x45, 0xdf, ++ 0xf3, 0xa5, 0x7f, 0x11, 0x6a, 0x54, 0xcd, 0x67, 0xb9, 0x2e, 0x7d, 0x05, ++ 0xe3, 0x1c, 0x1d, 0xcc, 0x77, 0x8e, 0x97, 0xb1, 0xa0, 0x11, 0x09, 0x3d, ++ 0x90, 0x54, 0xfc, 0x7e, 0xbb, 0xbb, 0x21, 0x23, 0x03, 0x44, 0xbf, 0x7d, ++ 0x2c, 0xc9, 0x15, 0x42, 0xe5, 0xa0, 0x3b, 0xa2, 0xd1, 0x5b, 0x73, 0x81, ++ 0xff, 0xfa, 0x90, 0xfc, 0x27, 0x7b, 0x2f, 0x86, 0x9c, 0x1d, 0x14, 0x36, ++ 0x94, 0xa2, 0x6e, 0xe8, 0x9d, 0xa0, 0x5f, 0xfc, 0x5a, 0x0d, 0xa4, 0xd5, ++ 0x2f, 0x8d, 0xd6, 0x00, 0xfa, 0x93, 0x5b, 0x09, 0x7f, 0x42, 0x78, 0xcc, ++ 0x8c, 0x49, 0xda, 0xd9, 0xf6, 0x43, 0xe7, 0xe1, 0x3c, 0xa2, 0xe2, 0x70, ++ 0xe2, 0x6a, 0x99, 0xc5, 0xd6, 0xa2, 0xe3, 0x0b, 0xd4, 0x09, 0xac, 0x94, ++ 0xaf, 0xb7, 0xf0, 0xb3, 0x0c, 0x1e, 0xf5, 0x16, 0x4f, 0x53, 0x9a, 0xe3, ++ 0xcc, 0xe2, 0x0c, 0x4a, 0xb9, 0xe6, 0x06, 0xbb, 0xf7, 0x41, 0x43, 0x20, ++ 0x04, 0xee, 0x99, 0x2f, 0xd8, 0x9f, 0xda, 0x3f, 0xfd, 0x49, 0xb8, 0xc2, ++ 0xbd, 0xd9, 0xc5, 0x72, 0xfd, 0xe3, 0xce, 0x1c, 0xbc, 0xe4, 0x39, 0xac, ++ 0x2a, 0x99, 0xe9, 0xb4, 0x3e, 0x74, 0x10, 0xeb, 0xd5, 0x14, 0xcc, 0xdb, ++ 0xf1, 0x04, 0x63, 0x36, 0xfb, 0x1f, 0x2b, 0xe2, 0x73, 0xd4, 0xd8, 0x49, ++ 0x31, 0xa8, 0x55, 0xcc, 0xa7, 0x76, 0x36, 0x6e, 0x18, 0xdc, 0xb9, 0xb0, ++ 0x29, 0x99, 0xcf, 0x49, 0xbf, 0xf9, 0xdb, 0x7f, 0x24, 0x42, 0x02, 0xcb, ++ 0xc1, 0xaa, 0xcb, 0xba, 0x18, 0x85, 0x86, 0xc7, 0xf4, 0x1c, 0x62, 0x76, ++ 0xbc, 0x73, 0xfb, 0xe4, 0x15, 0xb8, 0xdd, 0x5d, 0xa6, 0x68, 0x39, 0xa5, ++ 0x3d, 0x33, 0xaf, 0xd5, 0x92, 0x4d, 0x48, 0xdb, 0x22, 0xc0, 0xdc, 0x49, ++ 0x5f, 0x7b, 0xa8, 0xd2, 0x62, 0x2d, 0xa7, 0x39, 0x93, 0x48, 0xe7, 0x6b, ++ 0x23, 0xba, 0xd4, 0xe0, 0xc1, 0x29, 0x55, 0xc4, 0x34, 0xe3, 0xac, 0x25, ++ 0xa7, 0x15, 0xad, 0xab, 0xb3, 0xb7, 0x25, 0xca, 0x37, 0x88, 0x40, 0x2e, ++ 0x47, 0x6e, 0x92, 0x20, 0x09, 0x2e, 0x5a, 0xec, 0xf2, 0xfb, 0xb3, 0xa0, ++ 0x16, 0xb6, 0x93, 0xf2, 0xf5, 0x8b, 0xfe, 0xaf, 0x25, 0xee, 0x2e, 0x98, ++ 0x6c, 0x0a, 0xfe, 0xae, 0x0b, 0x57, 0xf5, 0x9f, 0x3c, 0x80, 0xe9, 0x8b, ++ 0xaf, 0x92, 0x8a, 0xad, 0xe7, 0xa0, 0xe4, 0xe6, 0x0a, 0xa0, 0xc7, 0x83, ++ 0xb5, 0x48, 0x58, 0x5f, 0x55, 0x9e, 0x9b, 0x27, 0xcd, 0x31, 0x1f, 0x3e, ++ 0x50, 0x5a, 0x91, 0xad, 0x21, 0x1b, 0x97, 0x5b, 0xe8, 0xfa, 0x29, 0x8a, ++ 0xa4, 0x17, 0xe8, 0xab, 0x87, 0x02, 0xd6, 0x18, 0x8c, 0x9f, 0x65, 0xb7, ++ 0x2a, 0xfa, 0xde, 0x5f, 0x77, 0x30, 0x6c, 0x04, 0x22, 0xe6, 0x58, 0x26, ++ 0x14, 0x0d, 0x9c, 0x41, 0x0a, 0x82, 0x77, 0xdb, 0x40, 0xa1, 0x58, 0xac, ++ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xb5, ++ 0x7e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x73, 0x69, 0x67, 0x6e, ++ 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, ++ 0x65, 0x64, 0x7e, 0x0a ++}; ++unsigned int hi_signed_2nd_len = 736; ++ ++unsigned char certificate_printable_der[] = { ++ 0x30, 0x82, 0x03, 0x39, 0x30, 0x82, 0x02, 0x21, 0xa0, 0x03, 0x02, 0x01, ++ 0x02, 0x02, 0x09, 0x00, 0xde, 0xf6, 0x22, 0xc4, 0xf2, 0xf1, 0x86, 0x02, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x0b, 0x05, 0x00, 0x30, 0x2a, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, ++ 0x04, 0x03, 0x13, 0x1f, 0x52, 0x65, 0x64, 0x20, 0x48, 0x61, 0x74, 0x20, ++ 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x42, 0x6f, 0x6f, 0x74, 0x20, ++ 0x43, 0x41, 0x20, 0x32, 0x20, 0x28, 0x62, 0x65, 0x74, 0x61, 0x29, 0x30, ++ 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x31, 0x30, 0x33, 0x31, 0x31, 0x34, 0x31, ++ 0x39, 0x32, 0x33, 0x5a, 0x17, 0x0d, 0x33, 0x37, 0x31, 0x30, 0x32, 0x35, ++ 0x31, 0x34, 0x31, 0x39, 0x32, 0x33, 0x5a, 0x30, 0x2f, 0x31, 0x2d, 0x30, ++ 0x2b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x24, 0x52, 0x65, 0x64, 0x20, ++ 0x48, 0x61, 0x74, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x42, ++ 0x6f, 0x6f, 0x74, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, ++ 0x33, 0x20, 0x28, 0x62, 0x65, 0x74, 0x61, 0x29, 0x30, 0x82, 0x01, 0x22, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, ++ 0x02, 0x82, 0x01, 0x01, 0x00, 0xbd, 0xda, 0xa1, 0xed, 0x8d, 0x8e, 0x15, ++ 0x5c, 0xf8, 0x01, 0x77, 0x48, 0x4a, 0x60, 0x96, 0xf9, 0x27, 0xfa, 0xe2, ++ 0xb1, 0x69, 0x0f, 0x51, 0x19, 0x52, 0x7e, 0xc4, 0x34, 0x8e, 0xe1, 0x9b, ++ 0x9c, 0xa4, 0xb1, 0x5c, 0xd6, 0x81, 0x98, 0x78, 0xfe, 0xa9, 0xe5, 0x0b, ++ 0x00, 0xba, 0x9c, 0x64, 0x7e, 0xc7, 0xcc, 0x72, 0xb1, 0x73, 0x4b, 0x11, ++ 0x07, 0x52, 0xf0, 0x20, 0x96, 0x8b, 0x99, 0x39, 0xde, 0xdb, 0xfa, 0x3d, ++ 0x45, 0xe2, 0x98, 0x7b, 0x0c, 0x41, 0xe4, 0x0c, 0xb5, 0x5d, 0x92, 0x74, ++ 0x39, 0x96, 0xe1, 0x97, 0x97, 0xa1, 0xad, 0x2e, 0xcc, 0xd0, 0x1b, 0x4d, ++ 0x9d, 0xbd, 0x3e, 0xa9, 0x36, 0x8e, 0xcc, 0xc7, 0x5f, 0x6a, 0x7d, 0x39, ++ 0x5e, 0x0b, 0x8d, 0xca, 0xe4, 0x83, 0xe9, 0x3b, 0x5c, 0x86, 0x47, 0xd4, ++ 0xba, 0x7d, 0x98, 0x26, 0xa1, 0xf4, 0xe8, 0x90, 0x6b, 0x0f, 0xf1, 0x6b, ++ 0x8c, 0xe3, 0xa2, 0x80, 0x3c, 0x96, 0xf1, 0x0a, 0xb6, 0x66, 0xc0, 0x4b, ++ 0x61, 0xf7, 0x74, 0xcd, 0xd3, 0x7b, 0x8e, 0x5e, 0x39, 0xda, 0x99, 0x20, ++ 0x33, 0x93, 0xd3, 0xf0, 0x7f, 0xad, 0x35, 0xe9, 0x88, 0x8d, 0x9c, 0xbf, ++ 0x65, 0xf1, 0x47, 0x02, 0xf9, 0x7c, 0xed, 0x27, 0x5f, 0x4a, 0x65, 0x3c, ++ 0xcf, 0x5f, 0x0e, 0x88, 0x95, 0x74, 0xde, 0xfb, 0x9e, 0x2e, 0x91, 0x9b, ++ 0x45, 0x37, 0xc8, 0x85, 0xff, 0xe3, 0x41, 0x70, 0xfe, 0xd5, 0xef, 0x0e, ++ 0x82, 0x22, 0x08, 0xb7, 0x3b, 0x44, 0x3e, 0xdc, 0x5b, 0x7f, 0xba, 0xbf, ++ 0xe6, 0x58, 0x9d, 0x02, 0x6e, 0x75, 0xbf, 0x50, 0xec, 0xcf, 0x3f, 0xa5, ++ 0x91, 0x0a, 0xe2, 0x59, 0x2c, 0xc3, 0xe7, 0x05, 0x03, 0xe8, 0xf2, 0x6f, ++ 0x2a, 0x04, 0x68, 0x9a, 0x31, 0x32, 0x8f, 0x04, 0x35, 0xcd, 0x1f, 0x34, ++ 0xcc, 0x4f, 0x79, 0x5a, 0x99, 0x8d, 0x9d, 0x5c, 0xf5, 0x02, 0x03, 0x01, ++ 0x00, 0x01, 0xa3, 0x5d, 0x30, 0x5b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, ++ 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0b, 0x06, 0x03, ++ 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x1d, 0x06, ++ 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x65, 0xc5, 0xbe, 0xca, ++ 0xe6, 0x59, 0x6a, 0xfd, 0x6c, 0x71, 0xc4, 0xa7, 0x98, 0xc6, 0x25, 0x8d, ++ 0x7b, 0x67, 0x05, 0xd0, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, ++ 0x18, 0x30, 0x16, 0x80, 0x14, 0x81, 0xf8, 0xee, 0x47, 0x5c, 0x3e, 0xed, ++ 0xfb, 0xce, 0xa5, 0x84, 0xbe, 0xd7, 0xae, 0xdb, 0xd3, 0x7d, 0x64, 0xb3, ++ 0x2a, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, ++ 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x66, 0x1e, 0x3d, ++ 0x1d, 0x53, 0x33, 0xde, 0x4e, 0xc7, 0xc4, 0xf4, 0xdf, 0xda, 0x18, 0x19, ++ 0x8a, 0xa9, 0xff, 0xe2, 0x63, 0x2b, 0xbe, 0xf2, 0x61, 0x63, 0xe2, 0xf6, ++ 0xed, 0x47, 0x1a, 0x71, 0x02, 0xec, 0x2a, 0xef, 0x89, 0x77, 0xe3, 0xfd, ++ 0x86, 0x69, 0xf1, 0x3f, 0x0d, 0xf9, 0x6e, 0xf9, 0x3b, 0xad, 0x26, 0x47, ++ 0xb7, 0xf2, 0x0d, 0xad, 0x23, 0xa3, 0x67, 0x3b, 0xcb, 0x6d, 0x9e, 0x03, ++ 0x0f, 0xbc, 0x69, 0x73, 0x9f, 0xd4, 0xa5, 0x0f, 0x6f, 0xf8, 0xab, 0x4d, ++ 0x36, 0xd1, 0xe0, 0xe0, 0x5d, 0x20, 0x43, 0x90, 0xc4, 0x65, 0x61, 0x93, ++ 0xe2, 0x0f, 0x51, 0x59, 0x0a, 0xf7, 0x88, 0x70, 0x57, 0xb9, 0x04, 0xa9, ++ 0x32, 0x57, 0x9c, 0xb3, 0x57, 0x38, 0x8b, 0x8e, 0x46, 0xc8, 0x32, 0x6c, ++ 0xb4, 0xf3, 0x96, 0x7f, 0x4b, 0xf0, 0x88, 0xf9, 0x7f, 0xe2, 0x71, 0xe1, ++ 0x8b, 0xe2, 0x14, 0xf1, 0x4b, 0x25, 0x00, 0x48, 0x1c, 0x7e, 0xe5, 0x8d, ++ 0x65, 0x2d, 0xeb, 0x72, 0x4f, 0x92, 0x44, 0xf3, 0xe6, 0xe0, 0xd0, 0xdf, ++ 0x85, 0xa8, 0x13, 0x4a, 0xfb, 0x99, 0xca, 0x14, 0x2c, 0x97, 0x80, 0x93, ++ 0x27, 0xd3, 0x20, 0xf8, 0x6d, 0x29, 0x28, 0x2c, 0xb9, 0x77, 0xea, 0xb1, ++ 0x63, 0xbd, 0x7d, 0x53, 0xfd, 0x4a, 0x62, 0x64, 0x0b, 0x98, 0xa8, 0xae, ++ 0x11, 0xfc, 0x6e, 0x8d, 0x63, 0xd4, 0x15, 0x55, 0xc6, 0x4c, 0x74, 0xf5, ++ 0x5f, 0xa0, 0xb9, 0x2c, 0x2d, 0x9a, 0x7a, 0x87, 0x6e, 0xf0, 0x5e, 0x25, ++ 0xed, 0xfc, 0xd8, 0xc4, 0x34, 0x33, 0x32, 0xad, 0x01, 0xd4, 0x4b, 0x49, ++ 0x51, 0xc2, 0x07, 0x7f, 0x90, 0x6d, 0xea, 0xf5, 0x4c, 0x41, 0x71, 0x64, ++ 0xeb, 0x1f, 0x29, 0xa3, 0x1f, 0x64, 0xa2, 0x1e, 0x0e, 0x6f, 0xa1, 0x67, ++ 0x99, 0x8d, 0x98, 0x1c, 0xb8, 0x53, 0x9d, 0x30, 0x1d, 0xae, 0x32, 0x56, ++ 0xd2 ++}; ++unsigned int certificate_printable_der_len = 829; diff --git a/0303-appended-signatures-documentation.patch b/0303-appended-signatures-documentation.patch new file mode 100644 index 00000000..7c1170a6 --- /dev/null +++ b/0303-appended-signatures-documentation.patch @@ -0,0 +1,333 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 8 Feb 2021 19:30:54 +0100 +Subject: [PATCH] appended signatures: documentation + +This explains how appended signatures can be used to form part of +a secure boot chain, and documents the commands and variables +introduced. + +(docs: s/grub/grub2/) +Signed-off-by: Daniel Axtens +--- + docs/grub.texi | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 174 insertions(+), 15 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 7fc2a62a4f8..7fe365414e4 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -3160,6 +3160,7 @@ These variables have special meaning to GRUB. + + @menu + * biosnum:: ++* check_appended_signatures:: + * check_signatures:: + * chosen:: + * cmdpath:: +@@ -3219,11 +3220,18 @@ For an alternative approach which also changes BIOS drive mappings for the + chain-loaded system, @pxref{drivemap}. + + ++@node check_appended_signatures ++@subsection check_appended_signatures ++ ++This variable controls whether GRUB enforces appended signature validation on ++certain loaded files. @xref{Using appended signatures}. ++ ++ + @node check_signatures + @subsection check_signatures + +-This variable controls whether GRUB enforces digital signature +-validation on loaded files. @xref{Using digital signatures}. ++This variable controls whether GRUB enforces GPG-style digital signature ++validation on loaded files. @xref{Using GPG-style digital signatures}. + + @node chosen + @subsection chosen +@@ -3937,6 +3945,7 @@ you forget a command, you can run the command @command{help} + * date:: Display or set current date and time + * devicetree:: Load a device tree blob + * distrust:: Remove a pubkey from trusted keys ++* distrust_certificate:: Remove a certificate from the list of trusted certificates + * drivemap:: Map a drive to another + * echo:: Display a line of text + * eval:: Evaluate agruments as GRUB commands +@@ -3953,6 +3962,7 @@ you forget a command, you can run the command @command{help} + * keystatus:: Check key modifier status + * linux:: Load a Linux kernel + * linux16:: Load a Linux kernel (16-bit mode) ++* list_certificates:: List trusted certificates + * list_env:: List variables in environment block + * list_trusted:: List trusted public keys + * load_env:: Load variables from environment block +@@ -3990,9 +4000,11 @@ you forget a command, you can run the command @command{help} + * test:: Check file types and compare values + * true:: Do nothing, successfully + * trust:: Add public key to list of trusted keys ++* trust_certificate:: Add an x509 certificate to the list of trusted certificates + * unset:: Unset an environment variable + * uppermem:: Set the upper memory size + @comment * vbeinfo:: List available video modes ++* verify_appended:: Verify appended digital signature + * verify_detached:: Verify detached digital signature + * videoinfo:: List available video modes + @comment * xen_*:: Xen boot commands for AArch64 +@@ -4284,9 +4296,28 @@ These keys are used to validate signatures when environment variable + @code{check_signatures} is set to @code{enforce} + (@pxref{check_signatures}), and by some invocations of + @command{verify_detached} (@pxref{verify_detached}). @xref{Using +-digital signatures}, for more information. ++GPG-style digital signatures}, for more information. + @end deffn + ++ ++@node distrust_certificate ++@subsection distrust_certificate ++ ++@deffn Command distrust_certificate cert_number ++Remove the x509 certificate numbered @var{cert_number} from GRUB's keyring of ++trusted x509 certificates for verifying appended signatures. ++ ++@var{cert_number} is the certificate number as listed by ++@command{list_certificates} (@pxref{list_certificates}). ++ ++These certificates are used to validate appended signatures when environment ++variable @code{check_appended_signatures} is set to @code{enforce} ++(@pxref{check_appended_signatures}), and by @command{verify_appended} ++(@pxref{verify_appended}). See @xref{Using appended signatures} for more ++information. ++@end deffn ++ ++ + @node drivemap + @subsection drivemap + +@@ -4544,6 +4575,21 @@ This command is only available on x86 systems. + @end deffn + + ++@node list_certificates ++@subsection list_certificates ++ ++@deffn Command list_certificates ++List all x509 certificates trusted by GRUB for validating appended signatures. ++The output is a numbered list of certificates, showing the certificate's serial ++number and Common Name. ++ ++The certificate number can be used as an argument to ++@command{distrust_certificate} (@pxref{distrust_certificate}). ++ ++See @xref{Using appended signatures} for more information. ++@end deffn ++ ++ + @node list_env + @subsection list_env + +@@ -4563,7 +4609,7 @@ The output is in GPG's v4 key fingerprint format (i.e., the output of + @code{gpg --fingerprint}). The least significant four bytes (last + eight hexadecimal digits) can be used as an argument to + @command{distrust} (@pxref{distrust}). +-@xref{Using digital signatures}, for more information about uses for ++@xref{Using GPG-style digital signatures}, for more information about uses for + these keys. + @end deffn + +@@ -4598,8 +4644,12 @@ When used with care, @option{--skip-sig} and the whitelist enable an + administrator to configure a system to boot only signed + configurations, but to allow the user to select from among multiple + configurations, and to enable ``one-shot'' boot attempts and +-``savedefault'' behavior. @xref{Using digital signatures}, for more ++``savedefault'' behavior. @xref{Using GPG-style digital signatures}, for more + information. ++ ++Extra care should be taken when combining this command with appended signatures ++(@pxref{Using appended signatures}), as this file is not validated by an ++appended signature and could set @code{check_appended_signatures=no}. + @end deffn + + +@@ -4903,7 +4953,7 @@ read. It is possible to modify a digitally signed environment block + file from within GRUB using this command, such that its signature will + no longer be valid on subsequent boots. Care should be taken in such + advanced configurations to avoid rendering the system +-unbootable. @xref{Using digital signatures}, for more information. ++unbootable. @xref{Using GPG-style digital signatures}, for more information. + @end deffn + + +@@ -5228,11 +5278,31 @@ signatures when environment variable @code{check_signatures} is set to + must itself be properly signed. The @option{--skip-sig} option can be + used to disable signature-checking when reading @var{pubkey_file} + itself. It is expected that @option{--skip-sig} is useful for testing +-and manual booting. @xref{Using digital signatures}, for more ++and manual booting. @xref{Using GPG-style digital signatures}, for more + information. + @end deffn + + ++@node trust_certificate ++@subsection trust_certificate ++ ++@deffn Command trust_certificate x509_certificate ++Read an DER-formatted x509 certificate from the file @var{x509_certificate} ++and add it to GRUB's internal list of trusted x509 certificates. These ++certificates are used to validate appended signatures when the environment ++variable @code{check_appended_signatures} is set to @code{enforce}. ++ ++Note that if @code{check_appended_signatures} is set to @code{enforce} ++when @command{trust_certificate} is executed, then @var{x509_certificate} ++must itself bear an appended signature. (It is not sufficient that ++@var{x509_certificate} be signed by a trusted certificate according to the ++x509 rules: grub does not include support for validating signatures within x509 ++certificates themselves.) ++ ++See @xref{Using appended signatures} for more information. ++@end deffn ++ ++ + @node unset + @subsection unset + +@@ -5257,6 +5327,18 @@ only on PC BIOS platforms. + @end deffn + @end ignore + ++@node verify_appended ++@subsection verify_appended ++ ++@deffn Command verify_appended file ++Verifies an appended signature on @var{file} against the trusted certificates ++known to GRUB (See @pxref{list_certificates}, @pxref{trust_certificate}, and ++@pxref{distrust_certificate}). ++ ++Exit code @code{$?} is set to 0 if the signature validates ++successfully. If validation fails, it is set to a non-zero value. ++See @xref{Using appended signatures}, for more information. ++@end deffn + + @node verify_detached + @subsection verify_detached +@@ -5275,7 +5357,7 @@ tried. + + Exit code @code{$?} is set to 0 if the signature validates + successfully. If validation fails, it is set to a non-zero value. +-@xref{Using digital signatures}, for more information. ++@xref{Using GPG-style digital signatures}, for more information. + @end deffn + + @node videoinfo +@@ -5636,11 +5718,12 @@ environment variables and commands are listed in the same order. + @chapter Security + + @menu +-* Authentication and authorisation:: Users and access control +-* Using digital signatures:: Booting digitally signed code +-* Signing GRUB itself:: Ensuring the integrity of the GRUB core image +-* UEFI secure boot and shim:: Booting digitally signed PE files +-* Measured Boot:: Measuring boot components ++* Authentication and authorisation:: Users and access control ++* Using GPG-style digital signatures:: Booting digitally signed code ++* Using appended signatures:: An alternative approach to booting digitally signed code ++* Signing GRUB itself:: Ensuring the integrity of the GRUB core image ++* UEFI secure boot and shim:: Booting digitally signed PE files ++* Measured Boot:: Measuring boot components + @end menu + + @node Authentication and authorisation +@@ -5713,8 +5796,8 @@ generating configuration files with authentication. You can use + adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} + commands. + +-@node Using digital signatures +-@section Using digital signatures in GRUB ++@node Using GPG-style digital signatures ++@section Using GPG-style digital signatures in GRUB + + GRUB's @file{core.img} can optionally provide enforcement that all files + subsequently read from disk are covered by a valid digital signature. +@@ -5797,6 +5880,82 @@ or BIOS) configuration to cause the machine to boot from a different + (attacker-controlled) device. GRUB is at best only one link in a + secure boot chain. + ++@node Using appended signatures ++@section Using appended signatures in GRUB ++ ++GRUB supports verifying Linux-style 'appended signatures' for secure boot. ++Appended signatures are PKCS#7 messages containing a signature over the ++contents of a file, plus some metadata, appended to the end of a file. A file ++with an appended signature ends with the magic string: ++ ++@example ++~Module signature appended~\n ++@end example ++ ++where @code{\n} represents the carriage-return character, @code{0x0a}. ++ ++To enable appended signature verification, load the appendedsig module and an ++x509 certificate for verification. Building the appendedsig module into the ++core grub image is recommended. ++ ++Certificates can be managed at boot time using the @pxref{trust_certificate}, ++@pxref{distrust_certificate} and @pxref{list_certificates} commands. ++Certificates can also be built in to the core image using the @code{--x509} ++parameter to @command{grub-install} or @command{grub-mkimage}. ++ ++A file can be explictly verified using the @pxref{verify_appended} command. ++ ++Only signatures made with the SHA-256 or SHA-512 hash algorithm are supported, ++and only RSA signatures are supported. ++ ++A file can be signed with the @command{sign-file} utility supplied with the ++Linux kernel source. For example, if you have @code{signing.key} as the private ++key and @code{certificate.der} as the x509 certificate containing the public key: ++ ++@example ++sign-file SHA256 signing.key certificate.der vmlinux vmlinux.signed ++@end example ++ ++Enforcement of signature verification is controlled by the ++@code{check_appended_signatures} variable. Verification will only take place ++when files are loaded if the variable is set to @code{enforce}. If a ++certificate is built into the grub core image with the @code{--x509} parameter, ++the variable will be automatically set to @code{enforce} when the appendedsig ++module is loaded. ++ ++Unlike GPG-style signatures, not all files loaded by GRUB are required to be ++signed. Once verification is turned on, the following file types must carry ++appended signatures: ++ ++@enumerate ++@item Linux, Multiboot, BSD, XNU and Plan9 kernels ++@item Grub modules, except those built in to the core image ++@item Any new certificate files to be trusted ++@end enumerate ++ ++ACPI tables and Device Tree images will not be checked for appended signatures ++but must be verified by another mechanism such as GPG-style signatures before ++they will be loaded. ++ ++No attempt is made to validate any other file type. In particular, ++chain-loaded binaries are not verified - if your platform supports ++chain-loading and this cannot be disabled, consider an alternative secure ++boot mechanism. ++ ++As with GPG-style appended signatures, signature checking does @strong{not} ++stop an attacker with console access from dropping manually to the GRUB ++console and executing: ++ ++@example ++set check_appended_signatures=no ++@end example ++ ++Refer to the section on password-protecting GRUB (@pxref{Authentication ++and authorisation}) for more information on preventing this. ++ ++Additionally, special care must be taken around the @command{loadenv} command, ++which can be used to turn off @code{check_appended_signature}. ++ + @node Signing GRUB itself + @section Signing GRUB itself + diff --git a/0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch b/0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch new file mode 100644 index 00000000..4adeefdf --- /dev/null +++ b/0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch @@ -0,0 +1,137 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 28 Sep 2020 11:11:17 +1000 +Subject: [PATCH] ieee1275: link appended-signature enforcement to + /ibm,secure-boot + +If the 'ibm,secure-boot' property of the root node is 2 or greater, +require that the kernel pass appended-signature verification. + +Do not consider the presence of a certificate to enforce verification. + +Signed-off-by: Daniel Axtens +--- + grub-core/commands/appendedsig/appendedsig.c | 44 +++++++++++++++++++++------- + grub-core/kern/ieee1275/init.c | 26 ++++++++++++++++ + 2 files changed, 60 insertions(+), 10 deletions(-) + +diff --git a/grub-core/commands/appendedsig/appendedsig.c b/grub-core/commands/appendedsig/appendedsig.c +index 1fbc942254a..6efe58ce8b2 100644 +--- a/grub-core/commands/appendedsig/appendedsig.c ++++ b/grub-core/commands/appendedsig/appendedsig.c +@@ -95,10 +95,24 @@ static char * + grub_env_write_sec (struct grub_env_var *var __attribute__((unused)), + const char *val) + { ++ if (check_sigs == 2) ++ return grub_strdup ("forced"); + check_sigs = (*val == '1') || (*val == 'e'); + return grub_strdup (check_sigs ? "enforce" : "no"); + } + ++static const char * ++grub_env_read_sec (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val __attribute__ ((unused))) ++{ ++ if (check_sigs == 2) ++ return "forced"; ++ else if (check_sigs == 1) ++ return "enforce"; ++ else ++ return "no"; ++} ++ + static grub_err_t + read_cert_from_file (grub_file_t f, struct x509_certificate *certificate) + { +@@ -552,14 +566,20 @@ GRUB_MOD_INIT (appendedsig) + val = grub_env_get ("check_appended_signatures"); + grub_dprintf ("appendedsig", "check_appended_signatures='%s'\n", val); + +- if (val && (val[0] == '1' || val[0] == 'e')) +- check_sigs = 1; +- else +- check_sigs = 0; ++ if (val) ++ { ++ if (val[0] == '2' || val[0] == 'f') ++ check_sigs = 2; ++ else if (val[0] == '1' || val[0] == 'e') ++ check_sigs = 1; ++ else ++ check_sigs = 0; ++ } + + grub_trusted_key = NULL; + +- grub_register_variable_hook ("check_appended_signatures", 0, ++ grub_register_variable_hook ("check_appended_signatures", ++ grub_env_read_sec, + grub_env_write_sec); + grub_env_export ("check_appended_signatures"); + +@@ -603,11 +623,15 @@ GRUB_MOD_INIT (appendedsig) + grub_trusted_key = pk; + } + +- if (!val || val[0] == '\0') +- { +- grub_env_set ("check_appended_signatures", +- grub_trusted_key ? "enforce" : "no"); +- } ++ /* ++ * When controlled by ibm,secure-boot, we don't want the presence of ++ * a certificate to enforce secure boot. ++ * if (!val || val[0] == '\0') ++ * { ++ * grub_env_set ("check_appended_signatures", ++ * grub_trusted_key ? "enforce" : "no"); ++ * } ++ */ + + cmd_trust = + grub_register_command ("trust_certificate", grub_cmd_trust, +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index d84fba44d10..9ffc7919da8 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -269,6 +269,30 @@ grub_parse_cmdline (void) + } + } + ++static void ++grub_get_ieee1275_secure_boot (void) ++{ ++ grub_ieee1275_phandle_t root; ++ int rc; ++ grub_uint32_t is_sb; ++ ++ grub_ieee1275_finddevice ("/", &root); ++ ++ rc = grub_ieee1275_get_integer_property (root, "ibm,secure-boot", &is_sb, ++ sizeof (is_sb), 0); ++ ++ /* ibm,secure-boot: ++ * 0 - disabled ++ * 1 - audit ++ * 2 - enforce ++ * 3 - enforce + OS-specific behaviour ++ * ++ * We only support enforce. ++ */ ++ if (rc >= 0 && is_sb >= 2) ++ grub_env_set("check_appended_signatures", "forced"); ++} ++ + grub_addr_t grub_modbase; + + void +@@ -294,6 +318,8 @@ grub_machine_init (void) + #else + grub_install_get_time_ms (grub_rtc_get_time_ms); + #endif ++ ++ grub_get_ieee1275_secure_boot (); + } + + void diff --git a/grub.patches b/grub.patches index eda1cf9a..e7e91dbd 100644 --- a/grub.patches +++ b/grub.patches @@ -277,3 +277,28 @@ Patch0276: 0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch Patch0277: 0277-ieee1275-powerpc-enables-device-mapper-discovery.patch Patch0278: 0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch Patch0279: 0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0280: 0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0281: 0281-verifiers-Fix-calling-uninitialized-function-pointer.patch +Patch0282: 0282-ieee1275-claim-up-to-256MB-memory.patch +Patch0283: 0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0284: 0284-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0285: 0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0286: 0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch +Patch0287: 0287-docs-grub-pubkey-has-been-supported-for-some-time.patch +Patch0288: 0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0289: 0289-verifiers-provide-unsafe-module-list.patch +Patch0290: 0290-pgp-factor-out-rsa_pad.patch +Patch0291: 0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0292: 0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0293: 0293-libtasn1-import-libtasn1-4.16.0.patch +Patch0294: 0294-libtasn1-disable-code-not-needed-in-grub.patch +Patch0295: 0295-libtasn1-changes-for-grub-compatibility.patch +Patch0296: 0296-libtasn1-compile-into-asn1-module.patch +Patch0297: 0297-test_asn1-test-module-for-libtasn1.patch +Patch0298: 0298-grub-install-support-embedding-x509-certificates.patch +Patch0299: 0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0300: 0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0301: 0301-appended-signatures-support-verifying-appended-signa.patch +Patch0302: 0302-appended-signatures-verification-tests.patch +Patch0303: 0303-appended-signatures-documentation.patch +Patch0304: 0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch diff --git a/grub2.spec b/grub2.spec index 17f5b6b8..df3a43b1 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 34%{?dist} +Release: 35%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -518,6 +518,14 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Feb 08 2021 Javier Martinez Canillas - 2.04-35 +- Remove -fcf-protection compiler flag to allow i386 builds (law) + Related: rhbz#1915452 +- Unify GRUB configuration file location across all platforms + Related: rhbz#1918817 +- Add 'at_keyboard_fallback_set' var to force the set manually (rmetrich) +- Add appended signatures support for ppc64le LPAR Secure Boot (daxtens) + * Tue Jan 12 2021 Javier Martinez Canillas - 2.04-34 - at_keyboard: use set 1 when keyboard is in Translate mode (rmetrich) From a32aa179fa4f5d914da176aa0ccceb9b5cd13535 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Mon, 22 Feb 2021 16:53:39 +0100 Subject: [PATCH 052/294] Transition existing installations to unified GRUB configuration The previous commits, especially b14117, unified the grub config locations across all platforms. In brief, this means that in the case of EFI, the config file in the EFI System Partition (ESP) is now meant to be a small stub config file that will in turn load the main configuration in /boot/grub2, which is used on all other platforms as well. For new installations all this is done by the Anaconda installer. But existing installations also need to be adapted. Add a %posttrans script to the grub2-common package that will, if a non-unified installation is detected, transition it into a unified one. This is done by moving the main grub.cfg file from the ESP to /boot/grub2, creating minimal stub on the ESP instead. Additionally, the grubenv file is also moved from the ESP to /boot/grub2. The detection of the non-unified installation is done by checking if the grub.cfg on the ESP contains the 'configfile' directive. If so, it is assumed the system has a unified grub configuration. Signed-off-by: Christian Kellner --- grub2.spec | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/grub2.spec b/grub2.spec index df3a43b1..f518ee4e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -344,6 +344,35 @@ mv -f /boot/grub2.tmp/*.mod \ /boot/grub2/ && rm -r /boot/grub2.tmp/ || : +%posttrans common +set -eu + +EFI_HOME=/boot/efi/EFI/fedora +GRUB_HOME=/boot/grub2 + +if grep -q "configfile" ${EFI_HOME}/grub.cfg; then + exit 0 # already unified, nothing to do +fi + +# create a stub grub2 config in EFI +BOOT_DEVICE=$(df -P /boot | awk 'END{print $1}') +BOOT_UUID=$(blkid -s UUID -o value "${BOOT_DEVICE}") +GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME}) + +cat << EOF > ${EFI_HOME}/grub.cfg.stb +search --no-floppy --fs-uuid --set=dev ${BOOT_UUID} +set prefix=(\$dev)${GRUB_DIR} +export \$prefix +configfile \$prefix/grub.cfg +EOF + +cp -av ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave +mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv + +cp -av ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave +cp -av ${EFI_HOME}/grub.cfg ${GRUB_HOME}/ +mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg + %files common -f grub.lang %dir %{_libdir}/grub/ %dir %{_datarootdir}/grub/ From c65a33ebcad1463a552ee0e1dc97da9160225242 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 22 Feb 2021 20:11:09 +0100 Subject: [PATCH 053/294] Switch EFI users to new config and fix ESC no longer showing the menu Resolves: rhbz#1918817 Resolves: rhbz#1928595 Signed-off-by: Javier Martinez Canillas --- ...set-1-when-keyboard-is-in-Translate-.patch | 121 --------- ...lling-uninitialized-function-pointer.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 251 ------------------ ...igning-grub-with-an-appended-signatu.patch | 0 ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 0282-ieee1275-claim-up-to-256MB-memory.patch | 52 ---- ...-install-is-no-longer-a-shell-script.patch | 0 ...key-has-been-supported-for-some-time.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...verifiers-provide-unsafe-module-list.patch | 0 ...patch => 0287-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0290-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...93-libtasn1-compile-into-asn1-module.patch | 0 ...4-test_asn1-test-module-for-libtasn1.patch | 0 ...-support-embedding-x509-certificates.patch | 0 ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 0 ...00-appended-signatures-documentation.patch | 0 ...pended-signature-enforcement-to-ibm-.patch | 6 +- grub.patches | 49 ++-- grub2.spec | 8 +- 28 files changed, 33 insertions(+), 454 deletions(-) delete mode 100644 0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename 0281-verifiers-Fix-calling-uninitialized-function-pointer.patch => 0279-verifiers-Fix-calling-uninitialized-function-pointer.patch (100%) delete mode 100644 0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename 0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0280-Add-suport-for-signing-grub-with-an-appended-signatu.patch (100%) rename 0284-docs-grub-Document-signing-grub-under-UEFI.patch => 0281-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0282-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) delete mode 100644 0282-ieee1275-claim-up-to-256MB-memory.patch rename 0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch => 0283-docs-grub-grub-install-is-no-longer-a-shell-script.patch (100%) rename 0287-docs-grub-pubkey-has-been-supported-for-some-time.patch => 0284-docs-grub-pubkey-has-been-supported-for-some-time.patch (100%) rename 0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0285-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0289-verifiers-provide-unsafe-module-list.patch => 0286-verifiers-provide-unsafe-module-list.patch (100%) rename 0290-pgp-factor-out-rsa_pad.patch => 0287-pgp-factor-out-rsa_pad.patch (100%) rename 0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0288-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0289-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0293-libtasn1-import-libtasn1-4.16.0.patch => 0290-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0294-libtasn1-disable-code-not-needed-in-grub.patch => 0291-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0295-libtasn1-changes-for-grub-compatibility.patch => 0292-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0296-libtasn1-compile-into-asn1-module.patch => 0293-libtasn1-compile-into-asn1-module.patch (100%) rename 0297-test_asn1-test-module-for-libtasn1.patch => 0294-test_asn1-test-module-for-libtasn1.patch (100%) rename 0298-grub-install-support-embedding-x509-certificates.patch => 0295-grub-install-support-embedding-x509-certificates.patch (100%) rename 0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0296-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0297-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0301-appended-signatures-support-verifying-appended-signa.patch => 0298-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0302-appended-signatures-verification-tests.patch => 0299-appended-signatures-verification-tests.patch (100%) rename 0303-appended-signatures-documentation.patch => 0300-appended-signatures-documentation.patch (100%) rename 0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch => 0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch (96%) diff --git a/0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch deleted file mode 100644 index 047b07ba..00000000 --- a/0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Renaud=20M=C3=A9trich?= -Date: Thu, 3 Dec 2020 09:13:24 +0100 -Subject: [PATCH] at_keyboard: use set 1 when keyboard is in Translate mode -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When keyboard controller acts in Translate mode (0x40 mask), then use -set 1 since translation is done. -Otherwise use the mode queried from the controller (usually set 2). - -Added "atkeyb" debugging messages in at_keyboard module as well. - -Resolves: rhbz#1897587 - -Tested on: -- Asus N53SN (set 1 used) -- Dell Precision (set 1 used) -- HP Elitebook (set 2 used) -- HP G5430 (set 1 used, keyboard in XT mode!) -- Lenovo P71 & Lenovo T460s (set 2 used) -- QEMU/KVM (set 1 used) - -Signed-off-by: Renaud Métrich ---- - grub-core/term/at_keyboard.c | 29 ++++++++++++++++++++++++----- - include/grub/at_keyboard.h | 4 ++++ - 2 files changed, 28 insertions(+), 5 deletions(-) - -diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index f0a986eb176..69d99b61df5 100644 ---- a/grub-core/term/at_keyboard.c -+++ b/grub-core/term/at_keyboard.c -@@ -135,20 +135,28 @@ query_mode (void) - int e; - - e = write_mode (0); -- if (!e) -+ if (!e) { -+ grub_dprintf("atkeyb", "query_mode: write_mode(0) failed\n"); - return 0; -+ } - - do { - keyboard_controller_wait_until_ready (); - ret = grub_inb (KEYBOARD_REG_DATA); - } while (ret == GRUB_AT_ACK); - /* QEMU translates the set even in no-translate mode. */ -- if (ret == 0x43 || ret == 1) -+ if (ret == 0x43 || ret == 1) { -+ grub_dprintf("atkeyb", "query_mode: returning 1 (ret=0x%x)\n", ret); - return 1; -- if (ret == 0x41 || ret == 2) -+ } -+ if (ret == 0x41 || ret == 2) { -+ grub_dprintf("atkeyb", "query_mode: returning 2 (ret=0x%x)\n", ret); - return 2; -- if (ret == 0x3f || ret == 3) -+ } -+ if (ret == 0x3f || ret == 3) { -+ grub_dprintf("atkeyb", "query_mode: returning 3 (ret=0x%x)\n", ret); - return 3; -+ } - return 0; - } - -@@ -165,7 +173,13 @@ set_scancodes (void) - } - - #if !USE_SCANCODE_SET -- ps2_state.current_set = 1; -+ if ((grub_keyboard_controller_orig & KEYBOARD_AT_TRANSLATE) == KEYBOARD_AT_TRANSLATE) { -+ grub_dprintf ("atkeyb", "queried set is %d but keyboard in Translate mode, so actually in set 1\n", grub_keyboard_orig_set); -+ ps2_state.current_set = 1; -+ } else { -+ grub_dprintf ("atkeyb", "using queried set %d\n", grub_keyboard_orig_set); -+ ps2_state.current_set = grub_keyboard_orig_set; -+ } - return; - #else - -@@ -266,6 +280,7 @@ grub_keyboard_controller_init (void) - grub_keyboard_orig_set = 2; - #else - grub_keyboard_controller_orig = grub_keyboard_controller_read (); -+ grub_dprintf ("atkeyb", "grub_keyboard_controller_orig = 0x%x\n", grub_keyboard_controller_orig); - grub_keyboard_orig_set = query_mode (); - #endif - set_scancodes (); -@@ -275,11 +290,15 @@ grub_keyboard_controller_init (void) - static grub_err_t - grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused))) - { -+/* In !USE_SCANCODE_SET mode, we didn't change anything, so nothing to restore */ -+#if USE_SCANCODE_SET - if (ps2_state.current_set == 0) - return GRUB_ERR_NONE; -+ grub_dprintf ("atkeyb", "restoring set %d, controller 0x%x\n", grub_keyboard_orig_set, grub_keyboard_controller_orig); - if (grub_keyboard_orig_set) - write_mode (grub_keyboard_orig_set); - grub_keyboard_controller_write (grub_keyboard_controller_orig); -+#endif - return GRUB_ERR_NONE; - } - -diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h -index bcb4d9ba78f..9414dc1b996 100644 ---- a/include/grub/at_keyboard.h -+++ b/include/grub/at_keyboard.h -@@ -19,6 +19,10 @@ - #ifndef GRUB_AT_KEYBOARD_HEADER - #define GRUB_AT_KEYBOARD_HEADER 1 - -+/* -+ * Refer to https://wiki.osdev.org/%228042%22_PS/2_Controller for details. -+ */ -+ - /* Used for sending commands to the controller. */ - #define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02) - #define KEYBOARD_COMMAND_READ 0x20 diff --git a/0281-verifiers-Fix-calling-uninitialized-function-pointer.patch b/0279-verifiers-Fix-calling-uninitialized-function-pointer.patch similarity index 100% rename from 0281-verifiers-Fix-calling-uninitialized-function-pointer.patch rename to 0279-verifiers-Fix-calling-uninitialized-function-pointer.patch diff --git a/0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch deleted file mode 100644 index 11510f54..00000000 --- a/0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +++ /dev/null @@ -1,251 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Renaud=20M=C3=A9trich?= -Date: Fri, 18 Dec 2020 15:39:26 +0100 -Subject: [PATCH] Add 'at_keyboard_fallback_set' var to force the set manually - -This seems required with HP DL380p Gen 8 systems. -Indeed, with this system, we can see the following sequence: - -1. controller is queried to get current configuration (returns 0x30 which is quite standard) -2. controller is queried to get the current keyboard set in used, using code 0xf0 (first part) -3. controller answers with 0xfa which means "ACK" (== ok) -4. then we send "0" to tell "we want to know which set your are supporting" -5. controller answers with 0xfa ("ACK") -6. controller should then give us 1, 2, 3 or 0x43, 0x41, 0x3f, but here it gives us 0xfe which means "NACK" - -Since there seems no way to determine the current set, and in fact the -controller expects set2 to be used, we need to rely on an environment -variable. -Everything has been tested on this system: using 0xFE (resend command), -making sure we wait for ACK in the 2 steps "write_mode", etc. - -Below is litterature I used to come up with "there is no other -solution": -- https://wiki.osdev.org/%228042%22_PS/2_Controller -- http://www-ug.eecg.toronto.edu/msl/nios_devices/datasheets/PS2%20Keyboard%20Protocol.htm -- http://www.s100computers.com/My%20System%20Pages/MSDOS%20Board/PC%20Keyboard.pdf ---- - grub-core/term/at_keyboard.c | 127 ++++++++++++++++++++++++++++++++++--------- - 1 file changed, 101 insertions(+), 26 deletions(-) - -diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index 69d99b61df5..e7d51b249ad 100644 ---- a/grub-core/term/at_keyboard.c -+++ b/grub-core/term/at_keyboard.c -@@ -31,6 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - static grub_uint8_t grub_keyboard_controller_orig; - static grub_uint8_t grub_keyboard_orig_set; - struct grub_ps2_state ps2_state; -+static int fallback_set; - - static int ping_sent; - -@@ -76,6 +77,8 @@ at_command (grub_uint8_t data) - break; - return 0; - } -+ if (i == GRUB_AT_TRIES) -+ grub_dprintf ("atkeyb", "at_command() timed out! (stopped after %d tries)\n", i); - return (i != GRUB_AT_TRIES); - } - -@@ -105,6 +108,21 @@ grub_keyboard_controller_read (void) - - #endif - -+static int -+resend_last_result (void) -+{ -+ grub_uint8_t ret; -+ keyboard_controller_wait_until_ready (); -+ grub_dprintf ("atkeyb", "resend_last_result: sending 0xfe\n"); -+ grub_outb (0xfe, KEYBOARD_REG_DATA); -+ ret = wait_ack (); -+ grub_dprintf ("atkeyb", "resend_last_result: wait_ack() returned 0x%x\n", ret); -+ keyboard_controller_wait_until_ready (); -+ ret = grub_inb (KEYBOARD_REG_DATA); -+ grub_dprintf ("atkeyb", "resend_last_result: read 0x%x from controller\n", ret); -+ return ret; -+} -+ - static int - write_mode (int mode) - { -@@ -113,11 +131,17 @@ write_mode (int mode) - { - grub_uint8_t ack; - keyboard_controller_wait_until_ready (); -+ grub_dprintf ("atkeyb", "write_mode: sending 0xf0\n"); - grub_outb (0xf0, KEYBOARD_REG_DATA); -+ ack = wait_ack (); -+ grub_dprintf ("atkeyb", "write_mode: wait_ack() returned 0x%x\n", ack); -+ if (ack != GRUB_AT_ACK) -+ continue; - keyboard_controller_wait_until_ready (); -+ grub_dprintf ("atkeyb", "write_mode: sending mode %d\n", mode); - grub_outb (mode, KEYBOARD_REG_DATA); -- keyboard_controller_wait_until_ready (); - ack = wait_ack (); -+ grub_dprintf ("atkeyb", "write_mode: wait_ack() returned 0x%x\n", ack); - if (ack == GRUB_AT_NACK) - continue; - if (ack == GRUB_AT_ACK) -@@ -125,6 +149,9 @@ write_mode (int mode) - return 0; - } - -+ if (i == GRUB_AT_TRIES) -+ grub_dprintf ("atkeyb", "write_mode() timed out! (stopped after %d tries)\n", i); -+ - return (i != GRUB_AT_TRIES); - } - -@@ -132,31 +159,66 @@ static int - query_mode (void) - { - grub_uint8_t ret; -+ grub_uint64_t endtime; -+ unsigned i; - int e; -+ char *envvar; - -- e = write_mode (0); -- if (!e) { -- grub_dprintf("atkeyb", "query_mode: write_mode(0) failed\n"); -- return 0; -- } -+ for (i = 0; i < GRUB_AT_TRIES; i++) { -+ grub_dprintf ("atkeyb", "query_mode: sending command to controller\n"); -+ e = write_mode (0); -+ if (!e) { -+ grub_dprintf ("atkeyb", "query_mode: write_mode(0) failed\n"); -+ return 0; -+ } - -- do { -- keyboard_controller_wait_until_ready (); -- ret = grub_inb (KEYBOARD_REG_DATA); -- } while (ret == GRUB_AT_ACK); -- /* QEMU translates the set even in no-translate mode. */ -- if (ret == 0x43 || ret == 1) { -- grub_dprintf("atkeyb", "query_mode: returning 1 (ret=0x%x)\n", ret); -- return 1; -- } -- if (ret == 0x41 || ret == 2) { -- grub_dprintf("atkeyb", "query_mode: returning 2 (ret=0x%x)\n", ret); -- return 2; -+ endtime = grub_get_time_ms () + 20; -+ do { -+ keyboard_controller_wait_until_ready (); -+ ret = grub_inb (KEYBOARD_REG_DATA); -+ grub_dprintf ("atkeyb", "query_mode/loop: read 0x%x from controller\n", ret); -+ } while ((ret == GRUB_AT_ACK || ret == GRUB_AT_NACK) && grub_get_time_ms () < endtime); -+ if (ret == 0xfe) { -+ grub_dprintf ("atkeyb", "query_mode: asking controller to resend last result\n"); -+ ret = resend_last_result(); -+ grub_dprintf ("atkeyb", "query_mode: read 0x%x from controller\n", ret); -+ } -+ /* QEMU translates the set even in no-translate mode. */ -+ if (ret == 0x43 || ret == 1) { -+ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 1\n", ret); -+ return 1; -+ } -+ if (ret == 0x41 || ret == 2) { -+ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 2\n", ret); -+ return 2; -+ } -+ if (ret == 0x3f || ret == 3) { -+ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 3\n", ret); -+ return 3; -+ } -+ grub_dprintf ("atkeyb", "query_mode: controller returned unexpected value 0x%x, retrying\n", ret); - } -- if (ret == 0x3f || ret == 3) { -- grub_dprintf("atkeyb", "query_mode: returning 3 (ret=0x%x)\n", ret); -- return 3; -+ -+ /* -+ * Falling here means we tried querying and the controller returned something -+ * we don't understand, try to use 'at_keyboard_fallback_set' if it exists, -+ * otherwise return 0. -+ */ -+ envvar = grub_env_get ("at_keyboard_fallback_set"); -+ if (envvar) { -+ fallback_set = grub_strtoul (envvar, 0, 10); -+ if ((grub_errno) || (fallback_set < 1) || (fallback_set > 3)) { -+ grub_dprintf ("atkeyb", "WARNING: ignoring unexpected value '%s' for '%s' variable\n", -+ envvar, "at_keyboard_fallback_set"); -+ fallback_set = 0; -+ } else { -+ grub_dprintf ("atkeyb", "query_mode: '%s' specified in environment, returning %d\n", -+ "at_keyboard_fallback_set", fallback_set); -+ } -+ return fallback_set; - } -+ grub_dprintf ("atkeyb", "WARNING: no '%s' specified in environment, returning 0\n", -+ "at_keyboard_fallback_set"); - return 0; - } - -@@ -165,14 +227,25 @@ set_scancodes (void) - { - /* You must have visited computer museum. Keyboard without scancode set - knowledge. Assume XT. */ -- if (!grub_keyboard_orig_set) -- { -- grub_dprintf ("atkeyb", "No sets support assumed\n"); -- ps2_state.current_set = 1; -+ if (!grub_keyboard_orig_set) { -+ if (fallback_set) { -+ grub_dprintf ("atkeyb", "No sets support assumed but set forced to %d\n", fallback_set); -+ ps2_state.current_set = fallback_set; - return; - } -+ grub_dprintf ("atkeyb", "No sets support assumed, forcing to set 1\n"); -+ ps2_state.current_set = 1; -+ return; -+ } - - #if !USE_SCANCODE_SET -+ if (fallback_set) { -+ grub_dprintf ("atkeyb", "queried set is %d but set forced to %d\n", -+ grub_keyboard_orig_set, fallback_set); -+ ps2_state.current_set = fallback_set; -+ return; -+ } -+ - if ((grub_keyboard_controller_orig & KEYBOARD_AT_TRANSLATE) == KEYBOARD_AT_TRANSLATE) { - grub_dprintf ("atkeyb", "queried set is %d but keyboard in Translate mode, so actually in set 1\n", grub_keyboard_orig_set); - ps2_state.current_set = 1; -@@ -229,6 +302,7 @@ grub_at_keyboard_is_alive (void) - - if (KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))) - { -+ grub_dprintf ("atkeyb", "grub_at_keyboard_is_alive: controller mode before self-test: 0x%x\n", grub_keyboard_controller_read()); - grub_outb (0xaa, KEYBOARD_REG_STATUS); - ping_sent = 1; - } -@@ -261,6 +335,7 @@ grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) - static void - grub_keyboard_controller_init (void) - { -+ grub_dprintf ("atkeyb", "initializing the controller\n"); - ps2_state.at_keyboard_status = 0; - /* Drain input buffer. */ - while (1) -@@ -282,6 +357,7 @@ grub_keyboard_controller_init (void) - grub_keyboard_controller_orig = grub_keyboard_controller_read (); - grub_dprintf ("atkeyb", "grub_keyboard_controller_orig = 0x%x\n", grub_keyboard_controller_orig); - grub_keyboard_orig_set = query_mode (); -+ grub_dprintf ("atkeyb", "grub_keyboard_orig_set = %d\n", grub_keyboard_orig_set); - #endif - set_scancodes (); - keyboard_controller_led (ps2_state.led_status); -@@ -329,7 +405,6 @@ grub_at_restore_hw (void) - return GRUB_ERR_NONE; - } - -- - static struct grub_term_input grub_at_keyboard_term = - { - .name = "at_keyboard", diff --git a/0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0280-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 100% rename from 0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0280-Add-suport-for-signing-grub-with-an-appended-signatu.patch diff --git a/0284-docs-grub-Document-signing-grub-under-UEFI.patch b/0281-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0284-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0281-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0282-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0282-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0282-ieee1275-claim-up-to-256MB-memory.patch b/0282-ieee1275-claim-up-to-256MB-memory.patch deleted file mode 100644 index 1f948eea..00000000 --- a/0282-ieee1275-claim-up-to-256MB-memory.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Wed, 28 Oct 2020 11:44:29 +1100 -Subject: [PATCH] ieee1275: claim up to 256MB memory - -If we are verifying large kernels, we need more that 32MB. (Many distro -kernels are quite large, and debug kernels can be even bigger!) - -We originally went with 512MB: qemu pseries gives you all the memory a -32-bit number can handle, so there was lots left over to place a linux image -and initrd. - -Here's what we said then: -| This is possibly not the way we want to go with for upstream as it breaks -| booting on systems with <= 512MB. We're working on a more upstream-friendly -| solution and will post it shortly. However, for an end-user or packager with -| a higher minimum memory requirement, this will work fine. - -However, we've since discovered that (at least on one P8 test system), PFW -doesn't expose all of the memory allocated to the LPAR: it looks like it just -exposes 512MB - at least unless we mess with the CHRP note section. -Therefore, if we try to claim 512MB in grub, things _do not_ work when we try -to load linux. As a compromise, and again we'd like a better upstream solution, -go for 256MB. This is at least enough to verify distro kernels. - -Signed-off-by: Daniel Axtens ---- - grub-core/kern/ieee1275/init.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 937c1bc44cb..d84fba44d10 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -52,15 +52,13 @@ - #ifdef __i386__ - #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) - #else --#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024) -+#define HEAP_MAX_SIZE (unsigned long) (256 * 1024 * 1024) - #endif - --/* If possible, we will avoid claiming heap above this address, because it -- seems to cause relocation problems with OSes that link at 4 MiB */ - #ifdef __i386__ - #define HEAP_MAX_ADDR (unsigned long) (64 * 1024 * 1024) - #else --#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024) -+#define HEAP_MAX_ADDR (unsigned long) (256 * 1024 * 1024) - #endif - - extern char _end[]; diff --git a/0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch b/0283-docs-grub-grub-install-is-no-longer-a-shell-script.patch similarity index 100% rename from 0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch rename to 0283-docs-grub-grub-install-is-no-longer-a-shell-script.patch diff --git a/0287-docs-grub-pubkey-has-been-supported-for-some-time.patch b/0284-docs-grub-pubkey-has-been-supported-for-some-time.patch similarity index 100% rename from 0287-docs-grub-pubkey-has-been-supported-for-some-time.patch rename to 0284-docs-grub-pubkey-has-been-supported-for-some-time.patch diff --git a/0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0285-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0285-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0289-verifiers-provide-unsafe-module-list.patch b/0286-verifiers-provide-unsafe-module-list.patch similarity index 100% rename from 0289-verifiers-provide-unsafe-module-list.patch rename to 0286-verifiers-provide-unsafe-module-list.patch diff --git a/0290-pgp-factor-out-rsa_pad.patch b/0287-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0290-pgp-factor-out-rsa_pad.patch rename to 0287-pgp-factor-out-rsa_pad.patch diff --git a/0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0288-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0288-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0289-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0289-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0293-libtasn1-import-libtasn1-4.16.0.patch b/0290-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0293-libtasn1-import-libtasn1-4.16.0.patch rename to 0290-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0294-libtasn1-disable-code-not-needed-in-grub.patch b/0291-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0294-libtasn1-disable-code-not-needed-in-grub.patch rename to 0291-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0295-libtasn1-changes-for-grub-compatibility.patch b/0292-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0295-libtasn1-changes-for-grub-compatibility.patch rename to 0292-libtasn1-changes-for-grub-compatibility.patch diff --git a/0296-libtasn1-compile-into-asn1-module.patch b/0293-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0296-libtasn1-compile-into-asn1-module.patch rename to 0293-libtasn1-compile-into-asn1-module.patch diff --git a/0297-test_asn1-test-module-for-libtasn1.patch b/0294-test_asn1-test-module-for-libtasn1.patch similarity index 100% rename from 0297-test_asn1-test-module-for-libtasn1.patch rename to 0294-test_asn1-test-module-for-libtasn1.patch diff --git a/0298-grub-install-support-embedding-x509-certificates.patch b/0295-grub-install-support-embedding-x509-certificates.patch similarity index 100% rename from 0298-grub-install-support-embedding-x509-certificates.patch rename to 0295-grub-install-support-embedding-x509-certificates.patch diff --git a/0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0296-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0296-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0297-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0297-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0301-appended-signatures-support-verifying-appended-signa.patch b/0298-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0301-appended-signatures-support-verifying-appended-signa.patch rename to 0298-appended-signatures-support-verifying-appended-signa.patch diff --git a/0302-appended-signatures-verification-tests.patch b/0299-appended-signatures-verification-tests.patch similarity index 100% rename from 0302-appended-signatures-verification-tests.patch rename to 0299-appended-signatures-verification-tests.patch diff --git a/0303-appended-signatures-documentation.patch b/0300-appended-signatures-documentation.patch similarity index 100% rename from 0303-appended-signatures-documentation.patch rename to 0300-appended-signatures-documentation.patch diff --git a/0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch b/0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch similarity index 96% rename from 0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch rename to 0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch index 4adeefdf..76c716b7 100644 --- a/0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch +++ b/0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch @@ -92,10 +92,10 @@ index 1fbc942254a..6efe58ce8b2 100644 cmd_trust = grub_register_command ("trust_certificate", grub_cmd_trust, diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index d84fba44d10..9ffc7919da8 100644 +index 937c1bc44cb..5df2e0efae7 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -269,6 +269,30 @@ grub_parse_cmdline (void) +@@ -271,6 +271,30 @@ grub_parse_cmdline (void) } } @@ -126,7 +126,7 @@ index d84fba44d10..9ffc7919da8 100644 grub_addr_t grub_modbase; void -@@ -294,6 +318,8 @@ grub_machine_init (void) +@@ -296,6 +320,8 @@ grub_machine_init (void) #else grub_install_get_time_ms (grub_rtc_get_time_ms); #endif diff --git a/grub.patches b/grub.patches index e7e91dbd..e5570829 100644 --- a/grub.patches +++ b/grub.patches @@ -276,29 +276,26 @@ Patch0275: 0275-ieee1275-Avoiding-many-unecessary-open-close.patch Patch0276: 0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch Patch0277: 0277-ieee1275-powerpc-enables-device-mapper-discovery.patch Patch0278: 0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch -Patch0279: 0279-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0280: 0280-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0281: 0281-verifiers-Fix-calling-uninitialized-function-pointer.patch -Patch0282: 0282-ieee1275-claim-up-to-256MB-memory.patch -Patch0283: 0283-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0284: 0284-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0285: 0285-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0286: 0286-docs-grub-grub-install-is-no-longer-a-shell-script.patch -Patch0287: 0287-docs-grub-pubkey-has-been-supported-for-some-time.patch -Patch0288: 0288-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0289: 0289-verifiers-provide-unsafe-module-list.patch -Patch0290: 0290-pgp-factor-out-rsa_pad.patch -Patch0291: 0291-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0292: 0292-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0293: 0293-libtasn1-import-libtasn1-4.16.0.patch -Patch0294: 0294-libtasn1-disable-code-not-needed-in-grub.patch -Patch0295: 0295-libtasn1-changes-for-grub-compatibility.patch -Patch0296: 0296-libtasn1-compile-into-asn1-module.patch -Patch0297: 0297-test_asn1-test-module-for-libtasn1.patch -Patch0298: 0298-grub-install-support-embedding-x509-certificates.patch -Patch0299: 0299-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0300: 0300-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0301: 0301-appended-signatures-support-verifying-appended-signa.patch -Patch0302: 0302-appended-signatures-verification-tests.patch -Patch0303: 0303-appended-signatures-documentation.patch -Patch0304: 0304-ieee1275-link-appended-signature-enforcement-to-ibm-.patch +Patch0279: 0279-verifiers-Fix-calling-uninitialized-function-pointer.patch +Patch0280: 0280-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0281: 0281-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0282: 0282-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0283: 0283-docs-grub-grub-install-is-no-longer-a-shell-script.patch +Patch0284: 0284-docs-grub-pubkey-has-been-supported-for-some-time.patch +Patch0285: 0285-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0286: 0286-verifiers-provide-unsafe-module-list.patch +Patch0287: 0287-pgp-factor-out-rsa_pad.patch +Patch0288: 0288-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0289: 0289-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0290: 0290-libtasn1-import-libtasn1-4.16.0.patch +Patch0291: 0291-libtasn1-disable-code-not-needed-in-grub.patch +Patch0292: 0292-libtasn1-changes-for-grub-compatibility.patch +Patch0293: 0293-libtasn1-compile-into-asn1-module.patch +Patch0294: 0294-test_asn1-test-module-for-libtasn1.patch +Patch0295: 0295-grub-install-support-embedding-x509-certificates.patch +Patch0296: 0296-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0297: 0297-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0298: 0298-appended-signatures-support-verifying-appended-signa.patch +Patch0299: 0299-appended-signatures-verification-tests.patch +Patch0300: 0300-appended-signatures-documentation.patch +Patch0301: 0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch diff --git a/grub2.spec b/grub2.spec index f518ee4e..4d6d8b59 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 35%{?dist} +Release: 36%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -547,6 +547,12 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Feb 22 2021 Javier Martinez Canillas - 2.04-36 +- Switch EFI users to new unified config + Resolves: rhbz#1918817 +- Fix ESC key no longer showing the menu + Resolves: rhbz#1928595 + * Mon Feb 08 2021 Javier Martinez Canillas - 2.04-35 - Remove -fcf-protection compiler flag to allow i386 builds (law) Related: rhbz#1915452 From 931f4f0364d09538b54651ab257ecc13c06ba095 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Thu, 25 Feb 2021 18:17:46 +0100 Subject: [PATCH 054/294] Don't attempt to unify if there is no grub.cfg on EFI If there is no grub config, for example when installing the system via anaconda, there is no need to attempt a grub configuration unification. It will indeed actually break because it will try to copy a non-existent file. Resolves: rhbz#1933085 --- grub2.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/grub2.spec b/grub2.spec index 4d6d8b59..3e151b18 100644 --- a/grub2.spec +++ b/grub2.spec @@ -350,6 +350,10 @@ set -eu EFI_HOME=/boot/efi/EFI/fedora GRUB_HOME=/boot/grub2 +if test ! -f ${EFI_HOME}/grub.cfg; then + exit 0 # nothing to unify, nothing to do +fi + if grep -q "configfile" ${EFI_HOME}/grub.cfg; then exit 0 # already unified, nothing to do fi @@ -366,11 +370,11 @@ export \$prefix configfile \$prefix/grub.cfg EOF -cp -av ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave +cp -a ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv -cp -av ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave -cp -av ${EFI_HOME}/grub.cfg ${GRUB_HOME}/ +cp -a ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave +cp -a ${EFI_HOME}/grub.cfg ${GRUB_HOME}/ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %files common -f grub.lang From 32351b30939abc79e503eee62f9df912eeb4a703 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 25 Feb 2021 18:26:22 +0100 Subject: [PATCH 055/294] Don't attempt to unify if there is no grub.cfg on EFI Resolves: rhbz#1933085 Signed-off-by: Javier Martinez Canillas --- grub2.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 3e151b18..0dc9eca7 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 36%{?dist} +Release: 37%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -551,6 +551,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Feb 25 2021 Javier Martinez Canillas - 2.04-37 +- Don't attempt to unify if there is no grub.cfg on EFI (gicmo) + Resolves: rhbz#1933085 + * Mon Feb 22 2021 Javier Martinez Canillas - 2.04-36 - Switch EFI users to new unified config Resolves: rhbz#1918817 From 3b8cfc9cf6fc05eb71f62beac3b58b50a63055a9 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 5 Mar 2021 10:26:42 +0100 Subject: [PATCH 056/294] Fix keyboards that report IBM PC AT scan codes Signed-off-by: Javier Martinez Canillas --- ...set-1-when-keyboard-is-in-Translate-.patch | 121 +++++++++ ...fallback_set-var-to-force-the-set-ma.patch | 239 ++++++++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch create mode 100644 0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch new file mode 100644 index 00000000..047b07ba --- /dev/null +++ b/0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch @@ -0,0 +1,121 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Thu, 3 Dec 2020 09:13:24 +0100 +Subject: [PATCH] at_keyboard: use set 1 when keyboard is in Translate mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When keyboard controller acts in Translate mode (0x40 mask), then use +set 1 since translation is done. +Otherwise use the mode queried from the controller (usually set 2). + +Added "atkeyb" debugging messages in at_keyboard module as well. + +Resolves: rhbz#1897587 + +Tested on: +- Asus N53SN (set 1 used) +- Dell Precision (set 1 used) +- HP Elitebook (set 2 used) +- HP G5430 (set 1 used, keyboard in XT mode!) +- Lenovo P71 & Lenovo T460s (set 2 used) +- QEMU/KVM (set 1 used) + +Signed-off-by: Renaud Métrich +--- + grub-core/term/at_keyboard.c | 29 ++++++++++++++++++++++++----- + include/grub/at_keyboard.h | 4 ++++ + 2 files changed, 28 insertions(+), 5 deletions(-) + +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index f0a986eb176..69d99b61df5 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -135,20 +135,28 @@ query_mode (void) + int e; + + e = write_mode (0); +- if (!e) ++ if (!e) { ++ grub_dprintf("atkeyb", "query_mode: write_mode(0) failed\n"); + return 0; ++ } + + do { + keyboard_controller_wait_until_ready (); + ret = grub_inb (KEYBOARD_REG_DATA); + } while (ret == GRUB_AT_ACK); + /* QEMU translates the set even in no-translate mode. */ +- if (ret == 0x43 || ret == 1) ++ if (ret == 0x43 || ret == 1) { ++ grub_dprintf("atkeyb", "query_mode: returning 1 (ret=0x%x)\n", ret); + return 1; +- if (ret == 0x41 || ret == 2) ++ } ++ if (ret == 0x41 || ret == 2) { ++ grub_dprintf("atkeyb", "query_mode: returning 2 (ret=0x%x)\n", ret); + return 2; +- if (ret == 0x3f || ret == 3) ++ } ++ if (ret == 0x3f || ret == 3) { ++ grub_dprintf("atkeyb", "query_mode: returning 3 (ret=0x%x)\n", ret); + return 3; ++ } + return 0; + } + +@@ -165,7 +173,13 @@ set_scancodes (void) + } + + #if !USE_SCANCODE_SET +- ps2_state.current_set = 1; ++ if ((grub_keyboard_controller_orig & KEYBOARD_AT_TRANSLATE) == KEYBOARD_AT_TRANSLATE) { ++ grub_dprintf ("atkeyb", "queried set is %d but keyboard in Translate mode, so actually in set 1\n", grub_keyboard_orig_set); ++ ps2_state.current_set = 1; ++ } else { ++ grub_dprintf ("atkeyb", "using queried set %d\n", grub_keyboard_orig_set); ++ ps2_state.current_set = grub_keyboard_orig_set; ++ } + return; + #else + +@@ -266,6 +280,7 @@ grub_keyboard_controller_init (void) + grub_keyboard_orig_set = 2; + #else + grub_keyboard_controller_orig = grub_keyboard_controller_read (); ++ grub_dprintf ("atkeyb", "grub_keyboard_controller_orig = 0x%x\n", grub_keyboard_controller_orig); + grub_keyboard_orig_set = query_mode (); + #endif + set_scancodes (); +@@ -275,11 +290,15 @@ grub_keyboard_controller_init (void) + static grub_err_t + grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused))) + { ++/* In !USE_SCANCODE_SET mode, we didn't change anything, so nothing to restore */ ++#if USE_SCANCODE_SET + if (ps2_state.current_set == 0) + return GRUB_ERR_NONE; ++ grub_dprintf ("atkeyb", "restoring set %d, controller 0x%x\n", grub_keyboard_orig_set, grub_keyboard_controller_orig); + if (grub_keyboard_orig_set) + write_mode (grub_keyboard_orig_set); + grub_keyboard_controller_write (grub_keyboard_controller_orig); ++#endif + return GRUB_ERR_NONE; + } + +diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h +index bcb4d9ba78f..9414dc1b996 100644 +--- a/include/grub/at_keyboard.h ++++ b/include/grub/at_keyboard.h +@@ -19,6 +19,10 @@ + #ifndef GRUB_AT_KEYBOARD_HEADER + #define GRUB_AT_KEYBOARD_HEADER 1 + ++/* ++ * Refer to https://wiki.osdev.org/%228042%22_PS/2_Controller for details. ++ */ ++ + /* Used for sending commands to the controller. */ + #define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02) + #define KEYBOARD_COMMAND_READ 0x20 diff --git a/0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch new file mode 100644 index 00000000..2f053c84 --- /dev/null +++ b/0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch @@ -0,0 +1,239 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Fri, 18 Dec 2020 15:39:26 +0100 +Subject: [PATCH] Add 'at_keyboard_fallback_set' var to force the set manually + +This seems required with HP DL380p Gen 8 systems. +Indeed, with this system, we can see the following sequence: + +1. controller is queried to get current configuration (returns 0x30 which is quite standard) +2. controller is queried to get the current keyboard set in used, using code 0xf0 (first part) +3. controller answers with 0xfa which means "ACK" (== ok) +4. then we send "0" to tell "we want to know which set your are supporting" +5. controller answers with 0xfa ("ACK") +6. controller should then give us 1, 2, 3 or 0x43, 0x41, 0x3f, but here it gives us 0xfe which means "NACK" + +Since there seems no way to determine the current set, and in fact the +controller expects set2 to be used, we need to rely on an environment +variable. +Everything has been tested on this system: using 0xFE (resend command), +making sure we wait for ACK in the 2 steps "write_mode", etc. + +Below is litterature I used to come up with "there is no other +solution": +- https://wiki.osdev.org/%228042%22_PS/2_Controller +- http://www-ug.eecg.toronto.edu/msl/nios_devices/datasheets/PS2%20Keyboard%20Protocol.htm +- http://www.s100computers.com/My%20System%20Pages/MSDOS%20Board/PC%20Keyboard.pdf +--- + grub-core/term/at_keyboard.c | 121 ++++++++++++++++++++++++++++++++++--------- + 1 file changed, 96 insertions(+), 25 deletions(-) + +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index 69d99b61df5..c805cccbdde 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -31,6 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + static grub_uint8_t grub_keyboard_controller_orig; + static grub_uint8_t grub_keyboard_orig_set; + struct grub_ps2_state ps2_state; ++static int fallback_set; + + static int ping_sent; + +@@ -76,6 +77,8 @@ at_command (grub_uint8_t data) + break; + return 0; + } ++ if (i == GRUB_AT_TRIES) ++ grub_dprintf ("atkeyb", "at_command() timed out! (stopped after %d tries)\n", i); + return (i != GRUB_AT_TRIES); + } + +@@ -105,6 +108,21 @@ grub_keyboard_controller_read (void) + + #endif + ++static int ++resend_last_result (void) ++{ ++ grub_uint8_t ret; ++ keyboard_controller_wait_until_ready (); ++ grub_dprintf ("atkeyb", "resend_last_result: sending 0xfe\n"); ++ grub_outb (0xfe, KEYBOARD_REG_DATA); ++ ret = wait_ack (); ++ grub_dprintf ("atkeyb", "resend_last_result: wait_ack() returned 0x%x\n", ret); ++ keyboard_controller_wait_until_ready (); ++ ret = grub_inb (KEYBOARD_REG_DATA); ++ grub_dprintf ("atkeyb", "resend_last_result: read 0x%x from controller\n", ret); ++ return ret; ++} ++ + static int + write_mode (int mode) + { +@@ -113,11 +131,14 @@ write_mode (int mode) + { + grub_uint8_t ack; + keyboard_controller_wait_until_ready (); ++ grub_dprintf ("atkeyb", "write_mode: sending 0xf0\n"); + grub_outb (0xf0, KEYBOARD_REG_DATA); + keyboard_controller_wait_until_ready (); ++ grub_dprintf ("atkeyb", "write_mode: sending mode %d\n", mode); + grub_outb (mode, KEYBOARD_REG_DATA); + keyboard_controller_wait_until_ready (); + ack = wait_ack (); ++ grub_dprintf ("atkeyb", "write_mode: wait_ack() returned 0x%x\n", ack); + if (ack == GRUB_AT_NACK) + continue; + if (ack == GRUB_AT_ACK) +@@ -125,6 +146,9 @@ write_mode (int mode) + return 0; + } + ++ if (i == GRUB_AT_TRIES) ++ grub_dprintf ("atkeyb", "write_mode() timed out! (stopped after %d tries)\n", i); ++ + return (i != GRUB_AT_TRIES); + } + +@@ -132,31 +156,66 @@ static int + query_mode (void) + { + grub_uint8_t ret; ++ grub_uint64_t endtime; ++ unsigned i; + int e; ++ char *envvar; + +- e = write_mode (0); +- if (!e) { +- grub_dprintf("atkeyb", "query_mode: write_mode(0) failed\n"); +- return 0; +- } ++ for (i = 0; i < GRUB_AT_TRIES; i++) { ++ grub_dprintf ("atkeyb", "query_mode: sending command to controller\n"); ++ e = write_mode (0); ++ if (!e) { ++ grub_dprintf ("atkeyb", "query_mode: write_mode(0) failed\n"); ++ return 0; ++ } + +- do { +- keyboard_controller_wait_until_ready (); +- ret = grub_inb (KEYBOARD_REG_DATA); +- } while (ret == GRUB_AT_ACK); +- /* QEMU translates the set even in no-translate mode. */ +- if (ret == 0x43 || ret == 1) { +- grub_dprintf("atkeyb", "query_mode: returning 1 (ret=0x%x)\n", ret); +- return 1; +- } +- if (ret == 0x41 || ret == 2) { +- grub_dprintf("atkeyb", "query_mode: returning 2 (ret=0x%x)\n", ret); +- return 2; ++ endtime = grub_get_time_ms () + 20; ++ do { ++ keyboard_controller_wait_until_ready (); ++ ret = grub_inb (KEYBOARD_REG_DATA); ++ grub_dprintf ("atkeyb", "query_mode/loop: read 0x%x from controller\n", ret); ++ } while ((ret == GRUB_AT_ACK || ret == GRUB_AT_NACK) && grub_get_time_ms () < endtime); ++ if (ret == 0xfe) { ++ grub_dprintf ("atkeyb", "query_mode: asking controller to resend last result\n"); ++ ret = resend_last_result(); ++ grub_dprintf ("atkeyb", "query_mode: read 0x%x from controller\n", ret); ++ } ++ /* QEMU translates the set even in no-translate mode. */ ++ if (ret == 0x43 || ret == 1) { ++ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 1\n", ret); ++ return 1; ++ } ++ if (ret == 0x41 || ret == 2) { ++ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 2\n", ret); ++ return 2; ++ } ++ if (ret == 0x3f || ret == 3) { ++ grub_dprintf ("atkeyb", "query_mode: controller returned 0x%x, returning 3\n", ret); ++ return 3; ++ } ++ grub_dprintf ("atkeyb", "query_mode: controller returned unexpected value 0x%x, retrying\n", ret); + } +- if (ret == 0x3f || ret == 3) { +- grub_dprintf("atkeyb", "query_mode: returning 3 (ret=0x%x)\n", ret); +- return 3; ++ ++ /* ++ * Falling here means we tried querying and the controller returned something ++ * we don't understand, try to use 'at_keyboard_fallback_set' if it exists, ++ * otherwise return 0. ++ */ ++ envvar = grub_env_get ("at_keyboard_fallback_set"); ++ if (envvar) { ++ fallback_set = grub_strtoul (envvar, 0, 10); ++ if ((grub_errno) || (fallback_set < 1) || (fallback_set > 3)) { ++ grub_dprintf ("atkeyb", "WARNING: ignoring unexpected value '%s' for '%s' variable\n", ++ envvar, "at_keyboard_fallback_set"); ++ fallback_set = 0; ++ } else { ++ grub_dprintf ("atkeyb", "query_mode: '%s' specified in environment, returning %d\n", ++ "at_keyboard_fallback_set", fallback_set); ++ } ++ return fallback_set; + } ++ grub_dprintf ("atkeyb", "WARNING: no '%s' specified in environment, returning 0\n", ++ "at_keyboard_fallback_set"); + return 0; + } + +@@ -165,14 +224,25 @@ set_scancodes (void) + { + /* You must have visited computer museum. Keyboard without scancode set + knowledge. Assume XT. */ +- if (!grub_keyboard_orig_set) +- { +- grub_dprintf ("atkeyb", "No sets support assumed\n"); +- ps2_state.current_set = 1; ++ if (!grub_keyboard_orig_set) { ++ if (fallback_set) { ++ grub_dprintf ("atkeyb", "No sets support assumed but set forced to %d\n", fallback_set); ++ ps2_state.current_set = fallback_set; + return; + } ++ grub_dprintf ("atkeyb", "No sets support assumed, forcing to set 1\n"); ++ ps2_state.current_set = 1; ++ return; ++ } + + #if !USE_SCANCODE_SET ++ if (fallback_set) { ++ grub_dprintf ("atkeyb", "queried set is %d but set forced to %d\n", ++ grub_keyboard_orig_set, fallback_set); ++ ps2_state.current_set = fallback_set; ++ return; ++ } ++ + if ((grub_keyboard_controller_orig & KEYBOARD_AT_TRANSLATE) == KEYBOARD_AT_TRANSLATE) { + grub_dprintf ("atkeyb", "queried set is %d but keyboard in Translate mode, so actually in set 1\n", grub_keyboard_orig_set); + ps2_state.current_set = 1; +@@ -261,6 +331,7 @@ grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) + static void + grub_keyboard_controller_init (void) + { ++ grub_dprintf ("atkeyb", "initializing the controller\n"); + ps2_state.at_keyboard_status = 0; + /* Drain input buffer. */ + while (1) +@@ -282,6 +353,7 @@ grub_keyboard_controller_init (void) + grub_keyboard_controller_orig = grub_keyboard_controller_read (); + grub_dprintf ("atkeyb", "grub_keyboard_controller_orig = 0x%x\n", grub_keyboard_controller_orig); + grub_keyboard_orig_set = query_mode (); ++ grub_dprintf ("atkeyb", "grub_keyboard_orig_set = %d\n", grub_keyboard_orig_set); + #endif + set_scancodes (); + keyboard_controller_led (ps2_state.led_status); +@@ -329,7 +401,6 @@ grub_at_restore_hw (void) + return GRUB_ERR_NONE; + } + +- + static struct grub_term_input grub_at_keyboard_term = + { + .name = "at_keyboard", diff --git a/grub.patches b/grub.patches index e5570829..41354060 100644 --- a/grub.patches +++ b/grub.patches @@ -299,3 +299,5 @@ Patch0298: 0298-appended-signatures-support-verifying-appended-signa.patch Patch0299: 0299-appended-signatures-verification-tests.patch Patch0300: 0300-appended-signatures-documentation.patch Patch0301: 0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch +Patch0302: 0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0303: 0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/grub2.spec b/grub2.spec index 0dc9eca7..103e1b9c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 37%{?dist} +Release: 38%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -551,6 +551,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Mar 05 2021 Javier Martinez Canillas - 2.04-38 +- Fix keyboards that report IBM PC AT scan codes (rmetrich) + * Thu Feb 25 2021 Javier Martinez Canillas - 2.04-37 - Don't attempt to unify if there is no grub.cfg on EFI (gicmo) Resolves: rhbz#1933085 From 89b6faf012bddc57c49db120a64713c3d1dc6151 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 11 Mar 2021 13:04:21 +0100 Subject: [PATCH 057/294] Fix config file generation failing due invalid petitboot version value Resolves: rhbz#1921479 Signed-off-by: Javier Martinez Canillas --- ...k-if-petitboot-sysfs-has-a-valid-ver.patch | 67 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch diff --git a/0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch b/0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch new file mode 100644 index 00000000..79c805f9 --- /dev/null +++ b/0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 10 Mar 2021 12:50:15 +0100 +Subject: [PATCH] 10_linux.in: Check if petitboot sysfs has a valid version + +The script assumes that the petitboot sysfs entry contains a valid version +number, but this is not always the case. For example, on a Talos II system +a user reported that contained the following value: + +$ cat /sys/firmware/devicetree/base/ibm,firmware-versions/petitboot +0ed84c0-p94177c1 + +This lead to the script wrongly trying to compare these hashes as if they +were integers values, which caused the following error when re-generating +the GRUB configuration file: + +/etc/grub.d/10_linux: line 234: test: 0ed84c0-p94177c1: integer expression expected +/etc/grub.d/10_linux: line 235: test: 0ed84c0-p94177c1: integer expression expected + +Check that the major and minor values are integers before attempting to do +the comparison. If these aren't numbers, then generate the menu with a set +of menuentry commands, since there's no way to know the petitboot version. + +Resolves: rhbz#1921479 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index e61b6c94f11..b9426eb2e2e 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -223,20 +223,25 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + arch="$(uname -m)" + if [ "x${arch}" = "xppc64le" ] && [ -d /sys/firmware/opal ]; then + ++ BLS_POPULATE_MENU="true" + petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" + + if test -e ${petitboot_path}; then + read -r -d '' petitboot_version < ${petitboot_path} + petitboot_version="$(echo ${petitboot_version//v})" +- major_version="$(echo ${petitboot_version} | cut -d . -f1)" +- minor_version="$(echo ${petitboot_version} | cut -d . -f2)" + +- if test -z ${petitboot_version} || test ${major_version} -lt 1 || \ +- test ${major_version} -eq 1 -a ${minor_version} -lt 8; then +- BLS_POPULATE_MENU="true" ++ if test -n ${petitboot_version}; then ++ major_version="$(echo ${petitboot_version} | cut -d . -f1)" ++ minor_version="$(echo ${petitboot_version} | cut -d . -f2)" ++ ++ re='^[0-9]+$' ++ if [[ $major_version =~ $re ]] && [[ $minor_version =~ $re ]] && ++ ([[ ${major_version} -gt 1 ]] || ++ [[ ${major_version} -eq 1 && ++ ${minor_version} -ge 8 ]]); then ++ BLS_POPULATE_MENU="false" ++ fi + fi +- else +- BLS_POPULATE_MENU="true" + fi + fi + diff --git a/grub.patches b/grub.patches index 41354060..84ecf0ea 100644 --- a/grub.patches +++ b/grub.patches @@ -301,3 +301,4 @@ Patch0300: 0300-appended-signatures-documentation.patch Patch0301: 0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch Patch0302: 0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch Patch0303: 0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0304: 0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch diff --git a/grub2.spec b/grub2.spec index 103e1b9c..34170bf2 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 38%{?dist} +Release: 39%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -551,6 +551,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Mar 11 2021 Javier Martinez Canillas - 2.04-39 +- Fix config file generation failing due invalid petitboot version value + Resolves: rhbz#1921479 + * Fri Mar 05 2021 Javier Martinez Canillas - 2.04-38 - Fix keyboards that report IBM PC AT scan codes (rmetrich) From 46968b6e6323925be6f29c2770a04a8a1a858082 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 12 Mar 2021 22:54:28 +0100 Subject: [PATCH 058/294] Update to 2.06~rc1 to fix a bunch of CVEs Resolves: CVE-2020-14372 Resolves: CVE-2020-25632 Resolves: CVE-2020-25647 Resolves: CVE-2020-27749 Resolves: CVE-2020-27779 Resolves: CVE-2021-20225 Resolves: CVE-2021-20233 Signed-off-by: Javier Martinez Canillas --- ...d-support-for-Linux-EFI-stub-loading.patch | 51 +- 0002-Rework-linux-command.patch | 49 +- 0003-Rework-linux16-command.patch | 18 +- ...ecureboot-support-on-efi-chainloader.patch | 36 +- ...loaders-that-link-in-efi-mode-honor-.patch | 274 +- ...rch-64-on-32-boot-in-linuxefi-loader.patch | 4 +- 0007-re-write-.gitignore.patch | 266 +- ...ient-architecture-CAS-reboot-support.patch | 10 +- ...nsole-display-attr-when-clear-screen.patch | 2 +- ...when-generating-configuration-by-gru.patch | 26 - ...1-Move-bash-completion-script-922997.patch | 6 +- ...o-include-entries-by-title-not-just-.patch | 13 +- ...=> 0013-Make-exit-take-a-return-code.patch | 22 +- 0013-Update-to-minilzo-2.08.patch | 8509 ----------------- ...es-load-an-env-block-from-a-variable.patch | 30 +- 0015-Add-GRUB_DISABLE_UUID.patch | 106 - ...015-Migrate-PPC-from-Yaboot-to-Grub2.patch | 4 +- ...=> 0016-Add-fw_path-variable-revised.patch | 8 +- ...pot-as-binary-so-git-won-t-try-to-di.patch | 19 - ...-hex-hex-straight-through-unmolested.patch | 30 +- ...g-module-to-parse-Boot-Loader-Specif.patch | 159 +- ...patch => 0019-Add-devicetree-loading.patch | 6 +- ...HCP-client-ID-and-UUID-options-added.patch | 140 - ...0-Don-t-write-messages-to-the-screen.patch | 21 +- ...Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch | 38 - ...UEFI-operating-systems-returned-by-o.patch | 46 - ... => 0021-Don-t-print-GNU-GRUB-header.patch | 2 +- ...=> 0022-Don-t-add-to-highlighted-row.patch | 2 +- ...atch => 0023-Message-string-cleanups.patch | 2 +- ...ing-now-that-we-aren-t-displaying-it.patch | 2 +- 0025-Add-X-option-to-printf-functions.patch | 55 - ...t-indentation-for-the-term-help-text.patch | 4 +- ...es.patch => 0026-Indent-menu-entries.patch | 2 +- ...for-specific-config-file-for-netboot.patch | 200 - ...ix-margins.patch => 0027-Fix-margins.patch | 2 +- ...-1-for-our-right-hand-margin-so-line.patch | 2 +- ...0029-Enable-pager-by-default.-985860.patch | 0 ...-on-serial-so-don-t-tell-the-user-to.patch | 2 +- ...n-t-say-GNU-Linux-in-generated-menus.patch | 4 +- ...-Don-t-draw-a-border-around-the-menu.patch | 2 +- ...andard-margin-for-the-timeout-string.patch | 2 +- ...rame-to-list-of-relocations-stripped.patch | 2 +- ...password-to-boot-entries-generated-b.patch | 2 +- ...=> 0036-Don-t-emit-Booting-.-message.patch | 8 +- ...f-man-pages-with-slightly-nicer-ones.patch | 8 +- ...ix-when-fallback-searching-for-grub-.patch | 2 +- ...-before-grub.cfg-on-tftp-config-file.patch | 30 +- ...CLASS-in-10_linux-from-etc-os-releas.patch | 2 +- ...t-ordering-for-.debug-and-rescue-ker.patch | 4 +- ...2-Try-prefix-if-fw_path-doesn-t-work.patch | 34 +- ...-Package-Sort-for-grub2-mkconfig-112.patch | 35 +- ...spaces-when-we-re-doing-our-cmdline-.patch | 33 - ...fig-construct-titles-that-look-like-.patch | 2 +- ...ly-grub2-password-config-tool-985962.patch | 14 +- ... 0046-tcp-add-window-scaling-support.patch | 0 ...net-and-bootp-add-support-for-dhcpv6.patch | 60 +- ...rnel-settings-and-use-it-in-10_linux.patch | 26 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 0 ...ert-function-to-support-NVMe-devices.patch | 56 - ... 0050-Make-grub_fatal-also-backtrace.patch | 8 +- 0051-Add-grub_util_readlink.patch | 82 - ...ix-up-some-man-pages-rpmdiff-noticed.patch | 6 +- ...se-symlinks-including-those-across-d.patch | 104 - ...fo-pages-say-grub2-where-appropriate.patch | 167 +- ...-chainloader-entries-don-t-try-any-x.patch | 6 +- ...-Add-ability-to-boot-from-subvolumes.patch | 30 +- ...port-btrfs_subvol-and-btrfs_subvolid.patch | 4 +- ...-grub.cfg-netboot-selection-order-11.patch | 66 - ...> 0056-grub2-btrfs-03-follow_default.patch | 20 +- ...=> 0057-grub2-btrfs-04-grub2-install.patch | 12 +- 0058-Handle-rssd-storage-devices.patch | 36 - ...> 0058-grub2-btrfs-05-grub2-mkconfig.patch | 10 +- ... => 0059-grub2-btrfs-06-subvol-mount.patch | 24 +- ...subvol-name-scheme-to-support-old-sn.patch | 4 +- ...-correctly-with-btrfs-snapshots-bsc-.patch | 8 +- ...ocate_pool-and-grub_efi_free_pool-wr.patch | 4 +- ...ue-when-reading-username-and-passwor.patch | 44 - 0063-Add-a-url-parser.patch | 1021 -- ...fi_.-memory-helpers-where-reasonable.patch | 14 +- ...4-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 16 +- ...=> 0065-don-t-use-int-for-efi-status.patch | 4 +- 0066-Normalize-slashes-in-tftp-paths.patch | 61 - ...INIT-declare-its-function-prototypes.patch | 2 +- ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 4 +- ...d-xen-or-multiboot-2-modules-as-need.patch | 32 +- ...-calibration-not-take-51-seconds-to-.patch | 0 ...070-align-struct-efi_variable-better.patch | 2 +- ...fdt-has-address-cells-and-size-cells.patch | 42 - 0071-Add-BLS-support-to-grub-mkconfig.patch | 393 + ...-backtrace-on-grub_abort-for-grub-em.patch | 4 +- ...more-debug-info-in-our-module-loader.patch | 41 - ...nux-and-initrd-commands-for-grub-emu.patch | 18 +- ...h => 0074-Add-grub2-switch-to-blscfg.patch | 57 +- ...patch => 0075-make-better-backtraces.patch | 38 +- ...w-our-startup-message-if-debug-is-se.patch | 4 +- ...-some-minor-include-path-weirdnesses.patch | 0 ...it-possible-to-enabled-build-id-sha1.patch | 6 +- ...f-grub_dprintf-without-the-file-line.patch | 8 +- ...dprintf-that-tells-us-load-addresses.patch | 22 +- ...tch => 0081-Fixup-for-newer-compiler.patch | 4 +- ...-export-the-start-and-_start-symbols.patch | 4 +- ...tch => 0083-Fixup-for-newer-compiler.patch | 2 +- ...pport-for-non-Ethernet-network-cards.patch | 28 +- ...c-sized-arrays-since-we-don-t-build-.patch | 43 - ...racketed-ipv6-addrs-and-port-numbers.patch | 39 +- ...=> 0086-bootp-New-net_bootp6-command.patch | 26 +- 0086-don-t-ignore-const.patch | 22 - ...=> 0087-efinet-UEFI-IPv6-PXE-support.patch | 12 +- ...088-grub.texi-Add-net_bootp6-doument.patch | 12 +- ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 22 +- 0089-editenv-handle-relative-symlinks.patch | 50 - ...e-libgrub.pp-depend-on-config-util.h.patch | 45 - ...etting-network-from-UEFI-device-path.patch | 20 +- ...etting-DNS-server-from-UEFI-protocol.patch | 39 +- ...92-Support-UEFI-networking-protocols.patch | 56 +- ...> 0093-AUDIT-0-http-boot-tracker-bug.patch | 2 +- ...-incr-command-to-increment-integer-v.patch | 6 +- 0095-Add-BLS-support-to-grub-mkconfig.patch | 741 -- ...h => 0095-Add-auto-hide-menu-support.patch | 22 +- ...> 0096-Add-grub-set-bootflag-utility.patch | 10 +- ...b-boot-indeterminate.service-example.patch | 0 ...h => 0098-gentpl-add-disable-support.patch | 2 +- 0099-Add-grub_debug_enabled.patch | 60 - ... => 0099-gentpl-add-pc-firmware-type.patch | 2 +- ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 10 +- ...make-it-possible-to-run-checkers-on-.patch | 0 ...04-Rework-how-the-fdt-command-builds.patch | 18 +- ...able-non-wordsize-allocations-on-arm.patch | 4 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 4 +- ...=> 0107-Make-grub_error-more-verbose.patch | 57 +- ...eset-an-alias-for-the-reboot-command.patch | 0 ....patch => 0109-Add-a-version-command.patch | 8 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 8 +- ...lid-character-recongition-in-strto-l.patch | 37 - ...-Better-memory-allocation-and-error-.patch | 47 +- ...tter-locations-for-kernel-and-initrd.patch | 6 +- ...p-all-the-places-Wsign-compare-error.patch | 39 +- ...gn-compare-Wno-conversion-Wno-error-.patch | 8 +- ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 4 +- 0118-Fix-one-more-coverity-complaint.patch | 27 - ...itrd-params-cmdline-allocations-abov.patch | 6 +- ... => 0119-Fix-getroot.c-s-trampolines.patch | 2 +- ...not-allow-stack-trampolines-anywhere.patch | 6 +- ...tch => 0121-Reimplement-boot_counter.patch | 8 +- ...efi_gop.c-Add-support-for-BLT_ONLY-a.patch | 56 - ...ntry-selection-based-on-ID-and-title.patch | 0 0122-efi-uga-use-64-bit-for-fb_base.patch | 105 - ...ot-set-text-mode-until-we-actually-n.patch | 184 - ...try-users-option-argument-to-be-opti.patch | 2 +- ...export-env-and-efi-load-env-commands.patch | 42 +- ...grub_console_read_key_stroke-helper-.patch | 102 - ...nsole-Implement-getkeystatus-support.patch | 72 - ...le-to-subtract-conditions-from-debug.patch | 4 +- ...bles-from-the-initial-context-when-c.patch | 0 ...status-helper-funtion-available-ever.patch | 87 - ...d-holding-SHIFT-as-user-interrupt-ke.patch | 94 - ...-boot-success-reset-from-menu-auto-h.patch | 6 +- ...ix-systemctl-kexec-exit-status-check.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 24 +- ...try-for-firmware-setup-on-UEFI-FastB.patch | 94 - ...ferences-for-fdt-when-building-with-.patch | 0 ... => 0132-Do-better-in-bootstrap.conf.patch | 2 +- ...0133-Use-git-to-apply-gnulib-patches.patch | 173 +- ...-error-with-the-fdt-module-on-risc-v.patch | 0 ...g-Update-comment-about-running-as-ro.patch | 0 ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...indeterminate-getting-set-on-boot_su.patch | 0 ..._EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch | 0 ...ader-Define-machine-types-for-RISC-V.patch | 4 +- ... => 0140-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 10 +- ...-R-.note.gnu.property-at-more-places.patch | 82 - ...fw-http-_path-variables-to-make-them.patch | 4 +- ...ernel_header.hdr_offset-be-at-the-ri.patch | 71 - ...-literal-IPv6-addresses-in-square-br.patch | 0 ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...-debug-output-on-GOP-and-UGA-probing.patch | 66 - ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 30 + ...se-address-before-jumping-to-the-PE-.patch | 16 +- ...ate-TPM-measurement-errors-to-the-ve.patch | 8 +- ...maximum-bounce-buffer-size-to-16-MiB.patch | 2 +- ...fix-when-the-HTTP-path-is-relative-a.patch | 16 +- ...turn-in-efi-export-env-and-efi-load-.patch | 2 +- ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 2 +- ...rnel-validation-without-shim-protoco.patch | 16 +- ...ar-pointers-in-grub-core-net-bootp.c.patch | 6 +- ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-end-pointers-have-safer-const-quali.patch | 987 -- ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 10 +- ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 2 +- ...g-up-grub.cfg-XXX-while-tftp-booting.patch | 42 - ...ll-disable-support-for-EFI-platforms.patch | 6 +- ...imestamps-configure-flag-to-prepend-.patch | 12 +- ...-to-set-fPIE-and-friends-on-libgnu.a.patch | 40 - ...ements-to-grub_disk_open-and-grub_di.patch | 2 +- ...strtoull-print-an-error-if-no-conver.patch | 31 - 0169-Fix-the-type-of-grub_efi_status_t.patch | 79 - ...on-grub_debug_is_enabled-void-return.patch | 8 +- ...ear-screen-when-debugging-is-enabled.patch | 2 +- ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 2 +- ...igning-grub-with-an-appended-signatu.patch | 118 +- ...find-wholename-for-long-path-matches.patch | 23 - ...rub-Document-signing-grub-under-UEFI.patch | 38 +- ...ap.conf-don-t-clobber-AM_CFLAGS-here.patch | 23 - ...nt-signing-grub-with-an-appended-sig.patch | 25 +- ...e-grub_dl_set_persistent-for-the-emu.patch | 4 +- ...tation-of-pc-relative-relocation-off.patch | 36 - ...patch => 0180-pgp-factor-out-rsa_pad.patch | 6 +- ...Add-support-for-the-devicetree-field.patch | 132 - ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 4 +- ...-var-in-a-BLS-config-if-GRUB_DEFAULT.patch | 38 - ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...s-option-to-menu-entries-generated-f.patch | 78 - ...0183-libtasn1-import-libtasn1-4.16.0.patch | 0 ...-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch | 45 - ...asn1-disable-code-not-needed-in-grub.patch | 0 ...dcode-an-env-var-as-fallback-for-the.patch | 63 - ...tasn1-changes-for-grub-compatibility.patch | 0 ...86-libtasn1-compile-into-asn1-module.patch | 4 +- ...7-test_asn1-test-module-for-libtasn1.patch | 22 +- ...ce-char-when-appending-fields-for-va.patch | 76 - ...-support-embedding-x509-certificates.patch | 99 +- ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 52 +- ...rt-for-sorting-the-plus-higher-than-.patch | 59 - 0191-Fix-savedefault-with-blscfg.patch | 50 - ...res-support-verifying-appended-signa.patch | 137 +- ...pended-signatures-verification-tests.patch | 123 +- ...93-appended-signatures-documentation.patch | 134 +- ...er-lockdown-based-on-ibm-secure-boot.patch | 109 + 0195-RISC-V-Add-__clzdi2-symbol.patch | 43 - ...-Properly-disable-the-os-prober-by-d.patch | 71 + ...tes-Disable-the-os-prober-by-default.patch | 70 + ...l-Define-default-platform-for-RISC-V.patch | 31 - ...e-the-root-variable-to-search-for-BL.patch | 47 - ...LL-instead-of-a-zero-length-array-in.patch | 38 - ...lscfg-Update-grub2-binary-in-ESP-for.patch | 37 - ...lscfg-Only-mark-GRUB-as-BLS-supporte.patch | 37 - ...e-logic-from-10_linux_bls-and-drop-t.patch | 662 -- ...lscfg-Use-install-to-copy-GRUB-binar.patch | 46 - ...le-BLS-configuration-if-new-kernel-p.patch | 39 - ...fault_kernelopts-variable-as-fallbac.patch | 40 - ...early-exit-due-error-when-reading-pe.patch | 33 - ...r-overrun-when-attempting-to-shrink-.patch | 60 - ...e-cmdline-in-BLS-snippets-instead-of.patch | 160 - ...ore-existence-check-in-get_sorted_bl.patch | 32 - ...-Enable-module-for-all-EFI-platforms.patch | 26 - ...t-update-BLS-files-that-aren-t-manag.patch | 56 - 0221-fix-build-with-rpm-4.16.patch | 30 - ...s-BLS-supported-in-OSTree-systems-wi.patch | 35 - ...t-boot-commands-will-only-return-on-.patch | 40 - ...lexer-fatal-errors-actually-be-fatal.patch | 67 - ...e-arithmetic-primitives-that-check-f.patch | 124 - ...-we-always-have-an-overflow-checking.patch | 240 - 0228-calloc-Use-calloc-at-most-places.patch | 1834 ---- ...low-checking-primitives-where-we-do-.patch | 1320 --- ...on-t-leak-memory-on-realloc-failures.patch | 66 - ...-not-load-more-than-one-NAME-section.patch | 35 - ...fxmenu-Fix-double-free-in-load_image.patch | 33 - ...ree-in-grub_xnu_devprop_add_property.patch | 53 - ...sure-we-don-t-dereference-past-array.patch | 49 - 0235-term-Fix-overflow-on-user-inputs.patch | 63 - 0236-udf-Fix-memory-leak.patch | 53 - ...emory-leak-if-grub_create_loader_cmd.patch | 32 - 0238-tftp-Do-not-use-priority-queue.patch | 278 - ...in-address-for-mbi-allocation-to-0x1.patch | 44 - ...t-grub_relocator_alloc_chunk_addr-in.patch | 147 - ...t-grub_relocator_alloc_chunk_align-m.patch | 335 - ...used-fields-from-grub_script_functio.patch | 30 - ...se-after-free-when-redefining-a-func.patch | 105 - ...ub_relocator_alloc_chunk_align-top-m.patch | 43 - 0245-hfsplus-fix-two-more-overflows.patch | 54 - ...-potential-data-dependent-alloc-over.patch | 108 - 0247-emu-make-grub_free-NULL-safe.patch | 31 - ...formed-device-path-arithmetic-errors.patch | 248 - ...-caused-by-efi-fix-some-malformed-de.patch | 84 - ...x-use-after-free-in-halt-reboot-path.patch | 162 - ...x-use-after-free-in-halt-reboot-path.patch | 57 - ...id-overflow-on-initrd-size-calculati.patch | 25 - ...er-overflows-in-initrd-size-handling.patch | 166 - ...ointers-in-grub-core-commands-blscfg.patch | 43 - ...char-pointers-in-grub-core-net-url.c.patch | 28 - ...lock-counter-to-prevent-timeouts-wit.patch | 51 - ...dd-support-for-new-RAID1C34-profiles.patch | 51 - ...lling-uninitialized-function-pointer.patch | 41 - ...-install-is-no-longer-a-shell-script.patch | 33 - ...key-has-been-supported-for-some-time.patch | 36 - ...verifiers-provide-unsafe-module-list.patch | 97 - ...pended-signature-enforcement-to-ibm-.patch | 137 - ...k-if-petitboot-sysfs-has-a-valid-ver.patch | 67 - bootstrap.conf | 12 +- gitignore | 468 +- grub.macros | 8 +- grub.patches | 480 +- grub2.spec | 19 +- sbat.csv.in | 3 + sources | 4 +- 315 files changed, 2750 insertions(+), 24936 deletions(-) delete mode 100644 0011-Honor-a-symlink-when-generating-configuration-by-gru.patch rename 0012-Move-bash-completion-script-922997.patch => 0011-Move-bash-completion-script-922997.patch (92%) rename 0014-Allow-fallback-to-include-entries-by-title-not-just-.patch => 0012-Allow-fallback-to-include-entries-by-title-not-just-.patch (90%) rename 0016-Make-exit-take-a-return-code.patch => 0013-Make-exit-take-a-return-code.patch (93%) delete mode 100644 0013-Update-to-minilzo-2.08.patch rename 0018-Make-efi-machines-load-an-env-block-from-a-variable.patch => 0014-Make-efi-machines-load-an-env-block-from-a-variable.patch (74%) delete mode 100644 0015-Add-GRUB_DISABLE_UUID.patch rename 0022-Migrate-PPC-from-Yaboot-to-Grub2.patch => 0015-Migrate-PPC-from-Yaboot-to-Grub2.patch (98%) rename 0023-Add-fw_path-variable-revised.patch => 0016-Add-fw_path-variable-revised.patch (91%) delete mode 100644 0017-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch rename 0024-Pass-x-hex-hex-straight-through-unmolested.patch => 0017-Pass-x-hex-hex-straight-through-unmolested.patch (86%) rename 0027-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch => 0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch (91%) rename 0028-Add-devicetree-loading.patch => 0019-Add-devicetree-loading.patch (94%) delete mode 100644 0019-DHCP-client-ID-and-UUID-options-added.patch rename 0029-Don-t-write-messages-to-the-screen.patch => 0020-Don-t-write-messages-to-the-screen.patch (89%) delete mode 100644 0020-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch delete mode 100644 0021-Add-support-for-UEFI-operating-systems-returned-by-o.patch rename 0030-Don-t-print-GNU-GRUB-header.patch => 0021-Don-t-print-GNU-GRUB-header.patch (96%) rename 0031-Don-t-add-to-highlighted-row.patch => 0022-Don-t-add-to-highlighted-row.patch (95%) rename 0032-Message-string-cleanups.patch => 0023-Message-string-cleanups.patch (98%) rename 0033-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch => 0024-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch (96%) delete mode 100644 0025-Add-X-option-to-printf-functions.patch rename 0034-Use-the-correct-indentation-for-the-term-help-text.patch => 0025-Use-the-correct-indentation-for-the-term-help-text.patch (90%) rename 0035-Indent-menu-entries.patch => 0026-Indent-menu-entries.patch (95%) delete mode 100644 0026-Search-for-specific-config-file-for-netboot.patch rename 0036-Fix-margins.patch => 0027-Fix-margins.patch (97%) rename 0037-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch => 0028-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch (95%) rename 0038-Enable-pager-by-default.-985860.patch => 0029-Enable-pager-by-default.-985860.patch (100%) rename 0039-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch => 0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch (96%) rename 0040-Don-t-say-GNU-Linux-in-generated-menus.patch => 0031-Don-t-say-GNU-Linux-in-generated-menus.patch (95%) rename 0041-Don-t-draw-a-border-around-the-menu.patch => 0032-Don-t-draw-a-border-around-the-menu.patch (98%) rename 0042-Use-the-standard-margin-for-the-timeout-string.patch => 0033-Use-the-standard-margin-for-the-timeout-string.patch (97%) rename 0043-Add-.eh_frame-to-list-of-relocations-stripped.patch => 0034-Add-.eh_frame-to-list-of-relocations-stripped.patch (96%) rename 0045-Don-t-require-a-password-to-boot-entries-generated-b.patch => 0035-Don-t-require-a-password-to-boot-entries-generated-b.patch (96%) rename 0046-Don-t-emit-Booting-.-message.patch => 0036-Don-t-emit-Booting-.-message.patch (87%) rename 0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch => 0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch (99%) rename 0048-use-fw_path-prefix-when-fallback-searching-for-grub-.patch => 0038-use-fw_path-prefix-when-fallback-searching-for-grub-.patch (97%) rename 0049-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch => 0039-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch (77%) rename 0053-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch => 0040-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch (96%) rename 0054-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch => 0041-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch (93%) rename 0055-Try-prefix-if-fw_path-doesn-t-work.patch => 0042-Try-prefix-if-fw_path-doesn-t-work.patch (85%) rename 0057-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch => 0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch (93%) delete mode 100644 0044-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch rename 0059-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0044-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (98%) rename 0060-Add-friendly-grub2-password-config-tool-985962.patch => 0045-Add-friendly-grub2-password-config-tool-985962.patch (96%) rename 0061-tcp-add-window-scaling-support.patch => 0046-tcp-add-window-scaling-support.patch (100%) rename 0064-efinet-and-bootp-add-support-for-dhcpv6.patch => 0047-efinet-and-bootp-add-support-for-dhcpv6.patch (92%) rename 0065-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (94%) rename 0067-bz1374141-fix-incorrect-mask-for-ppc64.patch => 0049-bz1374141-fix-incorrect-mask-for-ppc64.patch (100%) delete mode 100644 0050-Fix-convert-function-to-support-NVMe-devices.patch rename 0068-Make-grub_fatal-also-backtrace.patch => 0050-Make-grub_fatal-also-backtrace.patch (95%) delete mode 100644 0051-Add-grub_util_readlink.patch rename 0069-Fix-up-some-man-pages-rpmdiff-noticed.patch => 0051-Fix-up-some-man-pages-rpmdiff-noticed.patch (96%) delete mode 100644 0052-Make-editenv-chase-symlinks-including-those-across-d.patch rename 0071-Make-our-info-pages-say-grub2-where-appropriate.patch => 0052-Make-our-info-pages-say-grub2-where-appropriate.patch (88%) rename 0073-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch (97%) rename 0074-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0054-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (95%) rename 0075-export-btrfs_subvol-and-btrfs_subvolid.patch => 0055-export-btrfs_subvol-and-btrfs_subvolid.patch (91%) delete mode 100644 0056-Update-info-with-grub.cfg-netboot-selection-order-11.patch rename 0076-grub2-btrfs-03-follow_default.patch => 0056-grub2-btrfs-03-follow_default.patch (89%) rename 0077-grub2-btrfs-04-grub2-install.patch => 0057-grub2-btrfs-04-grub2-install.patch (94%) delete mode 100644 0058-Handle-rssd-storage-devices.patch rename 0078-grub2-btrfs-05-grub2-mkconfig.patch => 0058-grub2-btrfs-05-grub2-mkconfig.patch (95%) rename 0079-grub2-btrfs-06-subvol-mount.patch => 0059-grub2-btrfs-06-subvol-mount.patch (95%) rename 0080-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0060-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (94%) rename 0081-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0061-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (97%) rename 0082-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0062-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (96%) delete mode 100644 0062-Fix-security-issue-when-reading-username-and-passwor.patch delete mode 100644 0063-Add-a-url-parser.patch rename 0083-Use-grub_efi_.-memory-helpers-where-reasonable.patch => 0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch (89%) rename 0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch => 0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch (78%) rename 0087-don-t-use-int-for-efi-status.patch => 0065-don-t-use-int-for-efi-status.patch (88%) delete mode 100644 0066-Normalize-slashes-in-tftp-paths.patch rename 0088-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0066-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (96%) rename 0091-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (92%) rename 0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (51%) rename 0093-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch => 0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch (100%) rename 0094-align-struct-efi_variable-better.patch => 0070-align-struct-efi_variable-better.patch (96%) delete mode 100644 0070-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch create mode 100644 0071-Add-BLS-support-to-grub-mkconfig.patch rename 0096-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0072-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (89%) delete mode 100644 0072-print-more-debug-info-in-our-module-loader.patch rename 0097-Add-linux-and-initrd-commands-for-grub-emu.patch => 0073-Add-linux-and-initrd-commands-for-grub-emu.patch (96%) rename 0098-Add-grub2-switch-to-blscfg.patch => 0074-Add-grub2-switch-to-blscfg.patch (87%) rename 0100-make-better-backtraces.patch => 0075-make-better-backtraces.patch (96%) rename 0101-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0076-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (89%) rename 0102-Work-around-some-minor-include-path-weirdnesses.patch => 0077-Work-around-some-minor-include-path-weirdnesses.patch (100%) rename 0103-Make-it-possible-to-enabled-build-id-sha1.patch => 0078-Make-it-possible-to-enabled-build-id-sha1.patch (93%) rename 0104-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0079-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (89%) rename 0105-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (90%) rename 0106-Fixup-for-newer-compiler.patch => 0081-Fixup-for-newer-compiler.patch (92%) rename 0107-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0082-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (94%) rename 0108-Fixup-for-newer-compiler.patch => 0083-Fixup-for-newer-compiler.patch (96%) rename 0109-Add-support-for-non-Ethernet-network-cards.patch => 0084-Add-support-for-non-Ethernet-network-cards.patch (97%) delete mode 100644 0085-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch rename 0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (87%) rename 0112-bootp-New-net_bootp6-command.patch => 0086-bootp-New-net_bootp6-command.patch (98%) delete mode 100644 0086-don-t-ignore-const.patch rename 0113-efinet-UEFI-IPv6-PXE-support.patch => 0087-efinet-UEFI-IPv6-PXE-support.patch (92%) rename 0114-grub.texi-Add-net_bootp6-doument.patch => 0088-grub.texi-Add-net_bootp6-doument.patch (80%) rename 0115-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (88%) delete mode 100644 0089-editenv-handle-relative-symlinks.patch delete mode 100644 0090-Make-libgrub.pp-depend-on-config-util.h.patch rename 0116-efinet-Setting-network-from-UEFI-device-path.patch => 0090-efinet-Setting-network-from-UEFI-device-path.patch (95%) rename 0117-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0091-efinet-Setting-DNS-server-from-UEFI-protocol.patch (92%) rename 0119-Support-UEFI-networking-protocols.patch => 0092-Support-UEFI-networking-protocols.patch (99%) rename 0120-AUDIT-0-http-boot-tracker-bug.patch => 0093-AUDIT-0-http-boot-tracker-bug.patch (98%) rename 0128-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0094-grub-editenv-Add-incr-command-to-increment-integer-v.patch (94%) delete mode 100644 0095-Add-BLS-support-to-grub-mkconfig.patch rename 0129-Add-auto-hide-menu-support.patch => 0095-Add-auto-hide-menu-support.patch (94%) rename 0131-Add-grub-set-bootflag-utility.patch => 0096-Add-grub-set-bootflag-utility.patch (97%) rename 0132-docs-Add-grub-boot-indeterminate.service-example.patch => 0097-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0133-gentpl-add-disable-support.patch => 0098-gentpl-add-disable-support.patch (97%) delete mode 100644 0099-Add-grub_debug_enabled.patch rename 0134-gentpl-add-pc-firmware-type.patch => 0099-gentpl-add-pc-firmware-type.patch (95%) rename 0135-efinet-also-use-the-firmware-acceleration-for-http.patch => 0100-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0136-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0101-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0137-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (96%) rename 0138-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0103-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0139-Rework-how-the-fdt-command-builds.patch => 0104-Rework-how-the-fdt-command-builds.patch (92%) rename 0140-Disable-non-wordsize-allocations-on-arm.patch => 0105-Disable-non-wordsize-allocations-on-arm.patch (93%) rename 0142-Prepend-prefix-when-HTTP-path-is-relative.patch => 0106-Prepend-prefix-when-HTTP-path-is-relative.patch (98%) rename 0144-Make-grub_error-more-verbose.patch => 0107-Make-grub_error-more-verbose.patch (51%) rename 0145-Make-reset-an-alias-for-the-reboot-command.patch => 0108-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0147-Add-a-version-command.patch => 0109-Add-a-version-command.patch (96%) rename 0148-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0110-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (91%) delete mode 100644 0110-misc-fix-invalid-character-recongition-in-strto-l.patch rename 0149-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch (89%) rename 0150-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch (97%) rename 0151-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0113-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (93%) rename 0152-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (92%) rename 0153-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0115-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0154-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0116-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0155-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0117-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (98%) delete mode 100644 0118-Fix-one-more-coverity-complaint.patch rename 0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0118-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (98%) rename 0157-Fix-getroot.c-s-trampolines.patch => 0119-Fix-getroot.c-s-trampolines.patch (97%) rename 0158-Do-not-allow-stack-trampolines-anywhere.patch => 0120-Do-not-allow-stack-trampolines-anywhere.patch (90%) rename 0159-Reimplement-boot_counter.patch => 0121-Reimplement-boot_counter.patch (97%) delete mode 100644 0121-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch rename 0161-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0122-Fix-menu-entry-selection-based-on-ID-and-title.patch (100%) delete mode 100644 0122-efi-uga-use-64-bit-for-fb_base.patch delete mode 100644 0123-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch rename 0162-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0123-Make-the-menu-entry-users-option-argument-to-be-opti.patch (97%) rename 0163-Add-efi-export-env-and-efi-load-env-commands.patch => 0124-Add-efi-export-env-and-efi-load-env-commands.patch (91%) delete mode 100644 0124-EFI-console-Add-grub_console_read_key_stroke-helper-.patch delete mode 100644 0125-EFI-console-Implement-getkeystatus-support.patch rename 0164-Make-it-possible-to-subtract-conditions-from-debug.patch => 0125-Make-it-possible-to-subtract-conditions-from-debug.patch (95%) rename 0165-Export-all-variables-from-the-initial-context-when-c.patch => 0126-Export-all-variables-from-the-initial-context-when-c.patch (100%) delete mode 100644 0126-Make-grub_getkeystatus-helper-funtion-available-ever.patch delete mode 100644 0127-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch rename 0170-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0127-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (98%) rename 0171-Fix-systemctl-kexec-exit-status-check.patch => 0128-Fix-systemctl-kexec-exit-status-check.patch (100%) rename 0172-Print-grub-emu-linux-loader-messages-as-debug.patch => 0129-Print-grub-emu-linux-loader-messages-as-debug.patch (100%) rename 0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0130-Don-t-assume-that-boot-commands-will-only-return-on-.patch (80%) delete mode 100644 0130-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch rename 0174-Fix-undefined-references-for-fdt-when-building-with-.patch => 0131-Fix-undefined-references-for-fdt-when-building-with-.patch (100%) rename 0175-Do-better-in-bootstrap.conf.patch => 0132-Do-better-in-bootstrap.conf.patch (95%) rename 0176-Use-git-to-apply-gnulib-patches.patch => 0133-Use-git-to-apply-gnulib-patches.patch (70%) rename 0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch => 0134-Fix-build-error-with-the-fdt-module-on-risc-v.patch (100%) rename 0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0135-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) rename 0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0136-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) rename 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0137-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (100%) rename 0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch => 0138-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch (100%) rename 0193-chainloader-Define-machine-types-for-RISC-V.patch => 0139-chainloader-Define-machine-types-for-RISC-V.patch (91%) rename 0194-Add-start-symbol-for-RISC-V.patch => 0140-Add-start-symbol-for-RISC-V.patch (100%) rename 0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0141-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (86%) delete mode 100644 0141-strip-R-.note.gnu.property-at-more-places.patch rename 0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch (95%) delete mode 100644 0143-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch rename 0200-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0143-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) rename 0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0144-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0145-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) delete mode 100644 0146-EFI-more-debug-output-on-GOP-and-UGA-probing.patch rename 0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0146-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) create mode 100644 0147-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename 0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0148-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (82%) rename 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0149-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (90%) rename 0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0150-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (97%) rename 0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0151-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (80%) rename 0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0152-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (95%) rename 0251-efi-dhcp-fix-some-allocation-error-checking.patch => 0153-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0252-efi-http-fix-some-allocation-error-checking.patch => 0154-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0253-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0155-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0156-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (97%) rename 0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0157-linuxefi-fail-kernel-validation-without-shim-protoco.patch (90%) rename 0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (88%) rename 0261-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0159-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0160-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) delete mode 100644 0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch rename 0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0161-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0162-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0163-Add-systemd-integration-scripts-to-make-systemctl-re.patch (97%) rename 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0164-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0165-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (99%) delete mode 100644 0166-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch rename 0269-grub-install-disable-support-for-EFI-platforms.patch => 0166-grub-install-disable-support-for-EFI-platforms.patch (96%) rename 0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch (92%) delete mode 100644 0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch rename 0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0168-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (97%) delete mode 100644 0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch delete mode 100644 0169-Fix-the-type-of-grub_efi_status_t.patch rename 0272-Introduce-function-grub_debug_is_enabled-void-return.patch => 0169-Introduce-function-grub_debug_is_enabled-void-return.patch (87%) rename 0273-Don-t-clear-screen-when-debugging-is-enabled.patch => 0170-Don-t-clear-screen-when-debugging-is-enabled.patch (95%) rename 0274-grub_file_-instrumentation-new-file-debug-tag.patch => 0171-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0275-ieee1275-Avoiding-many-unecessary-open-close.patch => 0172-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0173-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0277-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0174-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0175-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (99%) rename 0280-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch (77%) delete mode 100644 0177-autogen.sh-use-find-wholename-for-long-path-matches.patch rename 0281-docs-grub-Document-signing-grub-under-UEFI.patch => 0177-docs-grub-Document-signing-grub-under-UEFI.patch (60%) delete mode 100644 0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch rename 0282-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch (76%) rename 0285-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0179-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (92%) delete mode 100644 0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch rename 0287-pgp-factor-out-rsa_pad.patch => 0180-pgp-factor-out-rsa_pad.patch (98%) delete mode 100644 0181-blscfg-Add-support-for-the-devicetree-field.patch rename 0288-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0181-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (96%) delete mode 100644 0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch rename 0289-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0182-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) delete mode 100644 0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch rename 0290-libtasn1-import-libtasn1-4.16.0.patch => 0183-libtasn1-import-libtasn1-4.16.0.patch (100%) delete mode 100644 0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch rename 0291-libtasn1-disable-code-not-needed-in-grub.patch => 0184-libtasn1-disable-code-not-needed-in-grub.patch (100%) delete mode 100644 0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch rename 0292-libtasn1-changes-for-grub-compatibility.patch => 0185-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0293-libtasn1-compile-into-asn1-module.patch => 0186-libtasn1-compile-into-asn1-module.patch (97%) rename 0294-test_asn1-test-module-for-libtasn1.patch => 0187-test_asn1-test-module-for-libtasn1.patch (99%) delete mode 100644 0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch rename 0295-grub-install-support-embedding-x509-certificates.patch => 0188-grub-install-support-embedding-x509-certificates.patch (77%) rename 0296-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0189-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0297-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0190-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (97%) delete mode 100644 0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch delete mode 100644 0191-Fix-savedefault-with-blscfg.patch rename 0298-appended-signatures-support-verifying-appended-signa.patch => 0191-appended-signatures-support-verifying-appended-signa.patch (88%) rename 0299-appended-signatures-verification-tests.patch => 0192-appended-signatures-verification-tests.patch (86%) rename 0300-appended-signatures-documentation.patch => 0193-appended-signatures-documentation.patch (76%) create mode 100644 0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch delete mode 100644 0195-RISC-V-Add-__clzdi2-symbol.patch create mode 100644 0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch create mode 100644 0196-Revert-templates-Disable-the-os-prober-by-default.patch delete mode 100644 0196-grub-install-Define-default-platform-for-RISC-V.patch delete mode 100644 0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch delete mode 100644 0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch delete mode 100644 0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch delete mode 100644 0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch delete mode 100644 0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch delete mode 100644 0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch delete mode 100644 0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch delete mode 100644 0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch delete mode 100644 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch delete mode 100644 0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch delete mode 100644 0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch delete mode 100644 0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch delete mode 100644 0217-tpm-Enable-module-for-all-EFI-platforms.patch delete mode 100644 0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch delete mode 100644 0221-fix-build-with-rpm-4.16.patch delete mode 100644 0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch delete mode 100644 0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch delete mode 100644 0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch delete mode 100644 0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch delete mode 100644 0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch delete mode 100644 0228-calloc-Use-calloc-at-most-places.patch delete mode 100644 0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch delete mode 100644 0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch delete mode 100644 0231-font-Do-not-load-more-than-one-NAME-section.patch delete mode 100644 0232-gfxmenu-Fix-double-free-in-load_image.patch delete mode 100644 0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch delete mode 100644 0234-lzma-Make-sure-we-don-t-dereference-past-array.patch delete mode 100644 0235-term-Fix-overflow-on-user-inputs.patch delete mode 100644 0236-udf-Fix-memory-leak.patch delete mode 100644 0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch delete mode 100644 0238-tftp-Do-not-use-priority-queue.patch delete mode 100644 0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch delete mode 100644 0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch delete mode 100644 0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch delete mode 100644 0242-script-Remove-unused-fields-from-grub_script_functio.patch delete mode 100644 0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch delete mode 100644 0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch delete mode 100644 0245-hfsplus-fix-two-more-overflows.patch delete mode 100644 0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch delete mode 100644 0247-emu-make-grub_free-NULL-safe.patch delete mode 100644 0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch delete mode 100644 0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch delete mode 100644 0250-efi-Fix-use-after-free-in-halt-reboot-path.patch delete mode 100644 0255-efi-Fix-use-after-free-in-halt-reboot-path.patch delete mode 100644 0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch delete mode 100644 0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch delete mode 100644 0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch delete mode 100644 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch delete mode 100644 0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch delete mode 100644 0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch delete mode 100644 0279-verifiers-Fix-calling-uninitialized-function-pointer.patch delete mode 100644 0283-docs-grub-grub-install-is-no-longer-a-shell-script.patch delete mode 100644 0284-docs-grub-pubkey-has-been-supported-for-some-time.patch delete mode 100644 0286-verifiers-provide-unsafe-module-list.patch delete mode 100644 0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch delete mode 100644 0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch create mode 100755 sbat.csv.in diff --git a/0001-Add-support-for-Linux-EFI-stub-loading.patch b/0001-Add-support-for-Linux-EFI-stub-loading.patch index 95c7cd5e..74044b8b 100644 --- a/0001-Add-support-for-Linux-EFI-stub-loading.patch +++ b/0001-Add-support-for-Linux-EFI-stub-loading.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Matthew Garrett -Date: Fri, 5 Jul 2019 18:36:44 +0200 +Date: Tue, 10 Jul 2012 11:58:52 -0400 Subject: [PATCH] Add support for Linux EFI stub loading. Also: @@ -35,19 +35,19 @@ moves the check into grub_dl_load_file. grub-core/loader/i386/efi/linux.c | 335 ++++++++++++++++++++++++++++++++++++++ grub-core/loader/i386/pc/linux.c | 10 +- include/grub/arm/linux.h | 9 + - include/grub/arm64/linux.h | 10 ++ + include/grub/arm64/linux.h | 9 + include/grub/efi/efi.h | 7 +- include/grub/efi/linux.h | 31 ++++ - 13 files changed, 619 insertions(+), 69 deletions(-) + 13 files changed, 618 insertions(+), 69 deletions(-) create mode 100644 grub-core/loader/efi/linux.c create mode 100644 grub-core/loader/i386/efi/linux.c create mode 100644 include/grub/efi/linux.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 474a63e68c5..581d9dfc3b3 100644 +index 8022e1c0a79..45d3edaa4dc 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1709,13 +1709,6 @@ module = { +@@ -1734,13 +1734,6 @@ module = { enable = i386_pc; }; @@ -61,7 +61,7 @@ index 474a63e68c5..581d9dfc3b3 100644 module = { name = ntldr; i386_pc = loader/i386/pc/ntldr.c; -@@ -1771,7 +1764,9 @@ module = { +@@ -1796,7 +1789,9 @@ module = { module = { name = linux; @@ -72,7 +72,7 @@ index 474a63e68c5..581d9dfc3b3 100644 i386_xen_pvh = loader/i386/linux.c; xen = loader/i386/xen.c; i386_pc = lib/i386/pc/vesa_modes_table.c; -@@ -1786,9 +1781,14 @@ module = { +@@ -1811,9 +1806,14 @@ module = { arm64 = loader/arm64/linux.c; riscv32 = loader/riscv/linux.c; riscv64 = loader/riscv/linux.c; @@ -88,7 +88,7 @@ index 474a63e68c5..581d9dfc3b3 100644 module = { diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 48eb5e7b627..896bebfd57e 100644 +index 48f8a79073d..b7149370950 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -38,6 +38,14 @@ @@ -106,7 +106,7 @@ index 48eb5e7b627..896bebfd57e 100644 #pragma GCC diagnostic ignored "-Wcast-align" -@@ -686,6 +694,19 @@ grub_dl_load_file (const char *filename) +@@ -695,6 +703,19 @@ grub_dl_load_file (const char *filename) void *core = 0; grub_dl_t mod = 0; @@ -127,11 +127,11 @@ index 48eb5e7b627..896bebfd57e 100644 file = grub_file_open (filename, GRUB_FILE_TYPE_GRUB_MODULE); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 6e1ceb90516..a0faa40ecf0 100644 +index 8cff7be0289..35b8f670602 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -273,6 +273,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, - return NULL; +@@ -286,6 +286,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, + return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL); } +grub_efi_boolean_t @@ -166,7 +166,7 @@ index 6e1ceb90516..a0faa40ecf0 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index b02fab1b102..a9e37108c6d 100644 +index 0cdb063bb1b..74360542062 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address, @@ -819,10 +819,10 @@ index 00000000000..bb2616a8092 + grub_unregister_command (cmd_initrdefi); +} diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 47ea2945e4f..eea25ea39ca 100644 +index 2a299520160..8be4c3b3f48 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c -@@ -470,14 +470,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -474,14 +474,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), return grub_errno; } @@ -844,7 +844,7 @@ index 47ea2945e4f..eea25ea39ca 100644 grub_register_command ("initrd16", grub_cmd_initrd, 0, N_("Load initrd.")); my_mod = mod; -@@ -486,5 +492,7 @@ GRUB_MOD_INIT(linux16) +@@ -490,5 +496,7 @@ GRUB_MOD_INIT(linux16) GRUB_MOD_FINI(linux16) { grub_unregister_command (cmd_linux); @@ -853,7 +853,7 @@ index 47ea2945e4f..eea25ea39ca 100644 + grub_unregister_command (cmd_initrd16); } diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index 2e98a668969..775297db869 100644 +index bcd5a7eb186..b582f67f661 100644 --- a/include/grub/arm/linux.h +++ b/include/grub/arm/linux.h @@ -20,6 +20,7 @@ @@ -883,19 +883,18 @@ index 2e98a668969..775297db869 100644 #if defined GRUB_MACHINE_UBOOT diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index 4269adc6dae..a3be9dd7003 100644 +index 7e22b4ab699..ea030312df3 100644 --- a/include/grub/arm64/linux.h +++ b/include/grub/arm64/linux.h -@@ -19,6 +19,8 @@ +@@ -19,6 +19,7 @@ #ifndef GRUB_ARM64_LINUX_HEADER #define GRUB_ARM64_LINUX_HEADER 1 +#include -+ - #define GRUB_LINUX_ARM64_MAGIC_SIGNATURE 0x644d5241 /* 'ARM\x64' */ + #include - /* From linux/Documentation/arm64/booting.txt */ -@@ -36,9 +38,17 @@ struct linux_arm64_kernel_header + #define GRUB_LINUX_ARM64_MAGIC_SIGNATURE 0x644d5241 /* 'ARM\x64' */ +@@ -38,9 +39,17 @@ struct linux_arm64_kernel_header grub_uint32_t hdr_offset; /* Offset of PE/COFF header */ }; @@ -914,7 +913,7 @@ index 4269adc6dae..a3be9dd7003 100644 #endif /* ! GRUB_ARM64_LINUX_HEADER */ diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index e90e00dc431..6840bfee9b7 100644 +index 83d958f9945..6295df85f3f 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address, @@ -927,7 +926,7 @@ index e90e00dc431..6840bfee9b7 100644 void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address, grub_efi_uintn_t pages); grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void); -@@ -82,6 +85,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, +@@ -88,6 +91,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, const grub_efi_guid_t *guid, void *data, grub_size_t datasize); @@ -935,7 +934,7 @@ index e90e00dc431..6840bfee9b7 100644 int EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, const grub_efi_device_path_t *dp2); -@@ -95,8 +99,7 @@ void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); +@@ -101,8 +105,7 @@ void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); #include grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); diff --git a/0002-Rework-linux-command.patch b/0002-Rework-linux-command.patch index bd136d69..9954dd0a 100644 --- a/0002-Rework-linux-command.patch +++ b/0002-Rework-linux-command.patch @@ -1,20 +1,22 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Matthew Garrett -Date: Fri, 5 Jul 2019 20:54:51 +0200 +Date: Sun, 9 Aug 2015 16:12:39 -0700 Subject: [PATCH] Rework linux command We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel into it before pulling out the individual blocks later on. + +Signed-off-by: Matthew Garrett --- - grub-core/loader/i386/linux.c | 36 +++++++++++++++++++++++------------- - 1 file changed, 23 insertions(+), 13 deletions(-) + grub-core/loader/i386/linux.c | 35 +++++++++++++++++++++++------------ + 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index d0501e22957..b255c950526 100644 +index 9f74a96b19a..dccf3bb3005 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c -@@ -641,13 +641,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -649,13 +649,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), { grub_file_t file = 0; struct linux_i386_kernel_header lh; @@ -31,7 +33,7 @@ index d0501e22957..b255c950526 100644 grub_dl_ref (my_mod); -@@ -661,7 +663,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -669,7 +671,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (! file) goto fail; @@ -48,7 +50,7 @@ index d0501e22957..b255c950526 100644 { if (!grub_errno) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -669,6 +679,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -677,6 +687,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -58,32 +60,25 @@ index d0501e22957..b255c950526 100644 if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) { grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); -@@ -760,6 +773,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - preferred_address)) - goto fail; - -+ - grub_memset (&linux_params, 0, sizeof (linux_params)); - grub_memcpy (&linux_params.setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1); - -@@ -782,13 +796,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -784,13 +797,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), /* We've already read lh so there is no need to read it second time. */ len -= sizeof(lh); -- if (grub_file_read (file, (char *) &linux_params + sizeof (lh), len) != len) -- { +- if ((len > 0) && +- (grub_file_read (file, (char *) &linux_params + sizeof (lh), len) != len)) ++ linux_params_ptr = (void *)&linux_params; ++ if (len > 0) + { - if (!grub_errno) - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), - argv[0]); - goto fail; -- } -+ linux_params_ptr = (void *)&linux_params; -+ grub_memcpy (linux_params_ptr + sizeof (lh), kernel + kernel_offset, len); -+ kernel_offset += len; ++ grub_memcpy (linux_params_ptr + sizeof (lh), kernel + kernel_offset, len); ++ kernel_offset += len; + } - linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; - -@@ -847,7 +857,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR; +@@ -853,7 +864,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), /* The other parameters are filled when booting. */ @@ -92,7 +87,7 @@ index d0501e22957..b255c950526 100644 grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n", (unsigned) real_size, (unsigned) prot_size); -@@ -1001,9 +1011,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -1007,9 +1018,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } len = prot_file_size; @@ -103,7 +98,7 @@ index d0501e22957..b255c950526 100644 if (grub_errno == GRUB_ERR_NONE) { -@@ -1014,6 +1022,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -1020,6 +1029,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), fail: diff --git a/0003-Rework-linux16-command.patch b/0003-Rework-linux16-command.patch index e73423ba..2c2d6f0b 100644 --- a/0003-Rework-linux16-command.patch +++ b/0003-Rework-linux16-command.patch @@ -1,20 +1,22 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Matthew Garrett -Date: Fri, 5 Jul 2019 21:12:00 +0200 +Date: Sun, 9 Aug 2015 16:20:58 -0700 Subject: [PATCH] Rework linux16 command We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel int it before pulling out the individual blocks later on. + +Signed-off-by: Matthew Garrett --- grub-core/loader/i386/pc/linux.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index eea25ea39ca..73fb91e0570 100644 +index 8be4c3b3f48..4b1750e360e 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c -@@ -123,13 +123,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_file_t file = 0; struct linux_i386_kernel_header lh; grub_uint8_t setup_sects; @@ -30,7 +32,7 @@ index eea25ea39ca..73fb91e0570 100644 grub_dl_ref (my_mod); -@@ -143,7 +144,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -144,7 +145,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (! file) goto fail; @@ -47,7 +49,7 @@ index eea25ea39ca..73fb91e0570 100644 { if (!grub_errno) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -151,6 +160,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -152,6 +161,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -57,7 +59,7 @@ index eea25ea39ca..73fb91e0570 100644 if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) { grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); -@@ -314,13 +326,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -320,13 +332,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_memmove (grub_linux_real_chunk, &lh, sizeof (lh)); len = real_size + GRUB_DISK_SECTOR_SIZE - sizeof (lh); @@ -74,7 +76,7 @@ index eea25ea39ca..73fb91e0570 100644 if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) || grub_le_to_cpu16 (lh.version) < 0x0200) -@@ -358,9 +366,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -364,9 +372,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } len = grub_linux16_prot_size; @@ -86,7 +88,7 @@ index eea25ea39ca..73fb91e0570 100644 if (grub_errno == GRUB_ERR_NONE) { -@@ -370,6 +377,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -376,6 +383,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), fail: diff --git a/0004-Add-secureboot-support-on-efi-chainloader.patch b/0004-Add-secureboot-support-on-efi-chainloader.patch index 092032b5..bfb5a9b6 100644 --- a/0004-Add-secureboot-support-on-efi-chainloader.patch +++ b/0004-Add-secureboot-support-on-efi-chainloader.patch @@ -167,18 +167,18 @@ Signed-off-by: Laszlo Ersek --- grub-core/kern/efi/efi.c | 14 +- grub-core/loader/arm64/linux.c | 4 +- - grub-core/loader/efi/chainloader.c | 817 +++++++++++++++++++++++++++++++++---- + grub-core/loader/efi/chainloader.c | 816 +++++++++++++++++++++++++++++++++---- grub-core/loader/efi/linux.c | 25 +- grub-core/loader/i386/efi/linux.c | 17 +- include/grub/efi/linux.h | 2 +- include/grub/efi/pe32.h | 52 ++- - 7 files changed, 840 insertions(+), 91 deletions(-) + 7 files changed, 840 insertions(+), 90 deletions(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index a0faa40ecf0..3487b0623a4 100644 +index 35b8f670602..4a2259aa1c7 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -283,14 +283,20 @@ grub_efi_secure_boot (void) +@@ -296,14 +296,20 @@ grub_efi_secure_boot (void) grub_efi_boolean_t ret = 0; secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize); @@ -226,7 +226,7 @@ index a312c668685..04994d5c67d 100644 grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); goto fail; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index cd92ea3f24b..ef87b06cf70 100644 +index 2bd80f4db3d..b54cf6986fc 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -32,6 +32,8 @@ @@ -261,15 +261,7 @@ index cd92ea3f24b..ef87b06cf70 100644 grub_dl_unref (my_mod); return GRUB_ERR_NONE; -@@ -179,7 +187,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) - /* Fill the file path for the directory. */ - d = (grub_efi_device_path_t *) ((char *) file_path - + ((char *) d - (char *) dp)); -- grub_efi_print_device_path (d); - copy_file_path ((grub_efi_file_path_device_path_t *) d, - dir_start, dir_end - dir_start); - -@@ -197,20 +204,690 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) +@@ -213,20 +221,690 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) return file_path; } @@ -963,7 +955,7 @@ index cd92ea3f24b..ef87b06cf70 100644 if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -222,15 +899,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -238,15 +916,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), address = 0; image_handle = 0; file_path = 0; @@ -1011,7 +1003,7 @@ index cd92ea3f24b..ef87b06cf70 100644 if (! dev) goto fail; -@@ -267,17 +974,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -283,17 +991,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (! file_path) goto fail; @@ -1032,7 +1024,7 @@ index cd92ea3f24b..ef87b06cf70 100644 status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES, GRUB_EFI_LOADER_CODE, -@@ -291,7 +995,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -307,7 +1012,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } boot_image = (void *) ((grub_addr_t) address); @@ -1041,7 +1033,7 @@ index cd92ea3f24b..ef87b06cf70 100644 { if (grub_errno == GRUB_ERR_NONE) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -301,7 +1005,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -317,7 +1022,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } #if defined (__i386__) || defined (__x86_64__) @@ -1050,12 +1042,12 @@ index cd92ea3f24b..ef87b06cf70 100644 { struct grub_macho_fat_header *head = boot_image; if (head->magic -@@ -310,6 +1014,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -326,6 +1031,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_uint32_t i; struct grub_macho_fat_arch *archs = (struct grub_macho_fat_arch *) (head + 1); + -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + { + grub_error (GRUB_ERR_BAD_OS, + "MACHO binaries are forbidden with Secure Boot"); @@ -1065,7 +1057,7 @@ index cd92ea3f24b..ef87b06cf70 100644 for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++) { if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype)) -@@ -324,79 +1036,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -340,79 +1053,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), > ~grub_cpu_to_le32 (archs[i].size) || grub_cpu_to_le32 (archs[i].offset) + grub_cpu_to_le32 (archs[i].size) @@ -1162,7 +1154,7 @@ index cd92ea3f24b..ef87b06cf70 100644 if (dev) grub_device_close (dev); -@@ -408,6 +1080,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -424,6 +1097,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (address) efi_call_2 (b->free_pages, address, pages); diff --git a/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 382fd234..3182fe99 100644 --- a/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -9,112 +9,94 @@ won't register commands if SB is enabled." Signed-off-by: Peter Jones --- - grub-core/Makefile.core.def | 1 + - grub-core/commands/iorw.c | 7 +++++ - grub-core/commands/memrw.c | 7 +++++ - grub-core/kern/dl.c | 1 + - grub-core/kern/efi/efi.c | 34 -------------------- - grub-core/kern/efi/sb.c | 64 ++++++++++++++++++++++++++++++++++++++ - grub-core/loader/efi/appleloader.c | 7 +++++ + grub-core/commands/iorw.c | 7 +++++++ + grub-core/commands/memrw.c | 7 +++++++ + grub-core/kern/dl.c | 3 ++- + grub-core/kern/efi/efi.c | 34 ---------------------------------- + grub-core/loader/efi/appleloader.c | 7 +++++++ grub-core/loader/efi/chainloader.c | 1 + - grub-core/loader/i386/bsd.c | 7 +++++ - grub-core/loader/i386/linux.c | 7 +++++ - grub-core/loader/i386/pc/linux.c | 7 +++++ - grub-core/loader/multiboot.c | 7 +++++ - grub-core/loader/xnu.c | 7 +++++ + grub-core/loader/i386/bsd.c | 7 +++++++ + grub-core/loader/i386/linux.c | 7 +++++++ + grub-core/loader/i386/pc/linux.c | 7 +++++++ + grub-core/loader/multiboot.c | 7 +++++++ + grub-core/loader/xnu.c | 7 +++++++ include/grub/efi/efi.h | 1 - - include/grub/efi/sb.h | 29 +++++++++++++++++ include/grub/ia64/linux.h | 0 include/grub/mips/linux.h | 0 include/grub/powerpc/linux.h | 0 include/grub/sparc64/linux.h | 0 - grub-core/Makefile.am | 1 + - 20 files changed, 153 insertions(+), 35 deletions(-) - create mode 100644 grub-core/kern/efi/sb.c - create mode 100644 include/grub/efi/sb.h + 16 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 include/grub/ia64/linux.h create mode 100644 include/grub/mips/linux.h create mode 100644 include/grub/powerpc/linux.h create mode 100644 include/grub/sparc64/linux.h -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 581d9dfc3b3..eb1088fd654 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -207,6 +207,7 @@ kernel = { - i386_multiboot = kern/i386/pc/acpi.c; - i386_coreboot = kern/acpi.c; - i386_multiboot = kern/acpi.c; -+ common = kern/efi/sb.c; - - x86 = kern/i386/tsc.c; - x86 = kern/i386/tsc_pit.c; diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c -index a0c164e54f0..41a7f3f0466 100644 +index 584baec8f91..7b2999b14b5 100644 --- a/grub-core/commands/iorw.c +++ b/grub-core/commands/iorw.c -@@ -23,6 +23,7 @@ - #include +@@ -24,6 +24,7 @@ #include #include + #include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -118,6 +119,9 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv) +@@ -119,6 +120,9 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv) GRUB_MOD_INIT(memrw) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + cmd_read_byte = grub_register_extcmd ("inb", grub_cmd_read, 0, N_("PORT"), N_("Read 8-bit value from PORT."), -@@ -146,6 +150,9 @@ GRUB_MOD_INIT(memrw) +@@ -147,6 +151,9 @@ GRUB_MOD_INIT(memrw) GRUB_MOD_FINI(memrw) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + grub_unregister_extcmd (cmd_read_byte); grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c -index 98769eadb34..088cbe9e2bc 100644 +index d401a6db0ef..39cf3a06dbd 100644 --- a/grub-core/commands/memrw.c +++ b/grub-core/commands/memrw.c -@@ -22,6 +22,7 @@ - #include +@@ -23,6 +23,7 @@ #include #include + #include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -120,6 +121,9 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv) +@@ -121,6 +122,9 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv) GRUB_MOD_INIT(memrw) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + cmd_read_byte = grub_register_extcmd ("read_byte", grub_cmd_read, 0, N_("ADDR"), N_("Read 8-bit value from ADDR."), -@@ -148,6 +152,9 @@ GRUB_MOD_INIT(memrw) +@@ -149,6 +153,9 @@ GRUB_MOD_INIT(memrw) GRUB_MOD_FINI(memrw) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + grub_unregister_extcmd (cmd_read_byte); grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 896bebfd57e..d7718d26abc 100644 +index b7149370950..7afb9e6f724 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -32,6 +32,7 @@ @@ -125,12 +107,21 @@ index 896bebfd57e..d7718d26abc 100644 /* Platforms where modules are in a readonly area of memory. */ #if defined(GRUB_MACHINE_QEMU) +@@ -704,7 +705,7 @@ grub_dl_load_file (const char *filename) + grub_dl_t mod = 0; + + #ifdef GRUB_MACHINE_EFI +- if (grub_efi_secure_boot ()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + { + #if 0 + /* This is an error, but grub2-mkconfig still generates a pile of diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 3487b0623a4..6e1ceb90516 100644 +index 4a2259aa1c7..8cff7be0289 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -273,40 +273,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, - return NULL; +@@ -286,40 +286,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, + return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL); } -grub_efi_boolean_t @@ -170,78 +161,8 @@ index 3487b0623a4..6e1ceb90516 100644 #pragma GCC diagnostic ignored "-Wcast-align" /* Search the mods section from the PE32/PE32+ image. This code uses -diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c -new file mode 100644 -index 00000000000..d74778b0cac ---- /dev/null -+++ b/grub-core/kern/efi/sb.c -@@ -0,0 +1,64 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2014 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+int -+grub_efi_secure_boot (void) -+{ -+#ifdef GRUB_MACHINE_EFI -+ grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID; -+ grub_size_t datasize; -+ char *secure_boot = NULL; -+ char *setup_mode = NULL; -+ grub_efi_boolean_t ret = 0; -+ -+ secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize); -+ if (datasize != 1 || !secure_boot) -+ { -+ grub_dprintf ("secureboot", "No SecureBoot variable\n"); -+ goto out; -+ } -+ grub_dprintf ("secureboot", "SecureBoot: %d\n", *secure_boot); -+ -+ setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize); -+ if (datasize != 1 || !setup_mode) -+ { -+ grub_dprintf ("secureboot", "No SetupMode variable\n"); -+ goto out; -+ } -+ grub_dprintf ("secureboot", "SetupMode: %d\n", *setup_mode); -+ -+ if (*secure_boot && !*setup_mode) -+ ret = 1; -+ -+ out: -+ grub_free (secure_boot); -+ grub_free (setup_mode); -+ return ret; -+#else -+ return 0; -+#endif -+} diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c -index 74888c463ba..69c2a10d351 100644 +index 74888c463ba..585f2b57385 100644 --- a/grub-core/loader/efi/appleloader.c +++ b/grub-core/loader/efi/appleloader.c @@ -24,6 +24,7 @@ @@ -256,7 +177,7 @@ index 74888c463ba..69c2a10d351 100644 GRUB_MOD_INIT(appleloader) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + cmd = grub_register_command ("appleloader", grub_cmd_appleloader, @@ -266,13 +187,13 @@ index 74888c463ba..69c2a10d351 100644 GRUB_MOD_FINI(appleloader) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + grub_unregister_command (cmd); } diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index ef87b06cf70..5aa3a5dc7dd 100644 +index b54cf6986fc..3ff305b1d32 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -34,6 +34,7 @@ @@ -284,10 +205,10 @@ index ef87b06cf70..5aa3a5dc7dd 100644 #include #include diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 3730ed38247..5b9b92d6ba5 100644 +index 5f3290ce17b..54befc26626 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c -@@ -39,6 +39,7 @@ +@@ -40,6 +40,7 @@ #ifdef GRUB_MACHINE_PCBIOS #include #endif @@ -295,92 +216,92 @@ index 3730ed38247..5b9b92d6ba5 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -2130,6 +2131,9 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk; +@@ -2137,6 +2138,9 @@ static grub_command_t cmd_netbsd_module_elf, cmd_openbsd_ramdisk; GRUB_MOD_INIT (bsd) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + /* Net and OpenBSD kernels are often compressed. */ grub_dl_load ("gzio"); -@@ -2169,6 +2173,9 @@ GRUB_MOD_INIT (bsd) +@@ -2176,6 +2180,9 @@ GRUB_MOD_INIT (bsd) GRUB_MOD_FINI (bsd) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + grub_unregister_extcmd (cmd_freebsd); grub_unregister_extcmd (cmd_openbsd); grub_unregister_extcmd (cmd_netbsd); diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index b255c950526..376c726928a 100644 +index dccf3bb3005..4aeb0e4b9a6 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c -@@ -36,6 +36,7 @@ - #include +@@ -37,6 +37,7 @@ #include #include + #include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -1131,6 +1132,9 @@ static grub_command_t cmd_linux, cmd_initrd; +@@ -1138,6 +1139,9 @@ static grub_command_t cmd_linux, cmd_initrd; GRUB_MOD_INIT(linux) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux.")); cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, -@@ -1140,6 +1144,9 @@ GRUB_MOD_INIT(linux) +@@ -1147,6 +1151,9 @@ GRUB_MOD_INIT(linux) GRUB_MOD_FINI(linux) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + grub_unregister_command (cmd_linux); grub_unregister_command (cmd_initrd); } diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 73fb91e0570..fe3e1d41d09 100644 +index 4b1750e360e..e3fa1221e81 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c -@@ -35,6 +35,7 @@ - #include +@@ -36,6 +36,7 @@ #include #include + #include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -483,6 +484,9 @@ static grub_command_t cmd_linux, cmd_linux16, cmd_initrd, cmd_initrd16; +@@ -487,6 +488,9 @@ static grub_command_t cmd_linux, cmd_linux16, cmd_initrd, cmd_initrd16; GRUB_MOD_INIT(linux16) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux.")); -@@ -500,6 +504,9 @@ GRUB_MOD_INIT(linux16) +@@ -504,6 +508,9 @@ GRUB_MOD_INIT(linux16) GRUB_MOD_FINI(linux16) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + grub_unregister_command (cmd_linux); grub_unregister_command (cmd_linux16); grub_unregister_command (cmd_initrd); diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index 4a98d708259..3e6ad166dc9 100644 +index facb13f3d36..47e481f4576 100644 --- a/grub-core/loader/multiboot.c +++ b/grub-core/loader/multiboot.c @@ -50,6 +50,7 @@ @@ -395,7 +316,7 @@ index 4a98d708259..3e6ad166dc9 100644 GRUB_MOD_INIT(multiboot) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + cmd_multiboot = @@ -405,49 +326,49 @@ index 4a98d708259..3e6ad166dc9 100644 GRUB_MOD_FINI(multiboot) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + grub_unregister_command (cmd_multiboot); grub_unregister_command (cmd_module); } diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index 7f74d1d6fc9..e0f47e72b06 100644 +index 1c0cf6a430a..baa54e652ab 100644 --- a/grub-core/loader/xnu.c +++ b/grub-core/loader/xnu.c -@@ -34,6 +34,7 @@ - #include +@@ -35,6 +35,7 @@ #include #include + #include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -1478,6 +1479,9 @@ static grub_extcmd_t cmd_splash; +@@ -1497,6 +1498,9 @@ static grub_extcmd_t cmd_splash; GRUB_MOD_INIT(xnu) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + cmd_kernel = grub_register_command ("xnu_kernel", grub_cmd_xnu_kernel, 0, N_("Load XNU image.")); cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64, -@@ -1518,6 +1522,9 @@ GRUB_MOD_INIT(xnu) +@@ -1540,6 +1544,9 @@ GRUB_MOD_INIT(xnu) GRUB_MOD_FINI(xnu) { -+ if (grub_efi_secure_boot()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + #ifndef GRUB_MACHINE_EMU grub_unregister_command (cmd_resume); #endif diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 6840bfee9b7..090c8621066 100644 +index 6295df85f3f..585fa6662b6 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -85,7 +85,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, +@@ -91,7 +91,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, const grub_efi_guid_t *guid, void *data, grub_size_t datasize); @@ -455,41 +376,6 @@ index 6840bfee9b7..090c8621066 100644 int EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, const grub_efi_device_path_t *dp2); -diff --git a/include/grub/efi/sb.h b/include/grub/efi/sb.h -new file mode 100644 -index 00000000000..9629fbb0f9e ---- /dev/null -+++ b/include/grub/efi/sb.h -@@ -0,0 +1,29 @@ -+/* sb.h - declare functions for EFI Secure Boot support */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_EFI_SB_HEADER -+#define GRUB_EFI_SB_HEADER 1 -+ -+#include -+#include -+ -+/* Functions. */ -+int EXPORT_FUNC (grub_efi_secure_boot) (void); -+ -+#endif /* ! GRUB_EFI_SB_HEADER */ diff --git a/include/grub/ia64/linux.h b/include/grub/ia64/linux.h new file mode 100644 index 00000000000..e69de29bb2d @@ -502,15 +388,3 @@ index 00000000000..e69de29bb2d diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h new file mode 100644 index 00000000000..e69de29bb2d -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 3ea8e7ff45f..c6ba5b2d763 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -71,6 +71,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h diff --git a/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch b/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch index 274321e3..f3aae389 100644 --- a/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +++ b/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch @@ -245,10 +245,10 @@ index 6b24cbb9483..3017d0f3e52 100644 if (kernel_mem && !loaded) grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index ce30e7fb01b..a093679cb80 100644 +index eddf9251d9a..25ef52c04eb 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h -@@ -136,7 +136,12 @@ struct linux_i386_kernel_header +@@ -138,7 +138,12 @@ struct linux_i386_kernel_header grub_uint32_t kernel_alignment; grub_uint8_t relocatable; grub_uint8_t min_alignment; diff --git a/0007-re-write-.gitignore.patch b/0007-re-write-.gitignore.patch index 25731397..74cb0dae 100644 --- a/0007-re-write-.gitignore.patch +++ b/0007-re-write-.gitignore.patch @@ -4,14 +4,14 @@ Date: Mon, 8 Jul 2019 12:55:29 +0200 Subject: [PATCH] re-write .gitignore --- - .gitignore | 366 +++++++++++++++----------------------- - docs/.gitignore | 5 + - grub-core/.gitignore | 16 ++ + .gitignore | 152 ++++++++++++++++++++++++++++++++++++++ + docs/.gitignore | 5 ++ + grub-core/.gitignore | 16 ++++ grub-core/lib/.gitignore | 1 + include/grub/gcrypt/.gitignore | 2 + - po/.gitignore | 5 + + po/.gitignore | 5 ++ util/bash-completion.d/.gitignore | 2 + - 7 files changed, 171 insertions(+), 226 deletions(-) + 7 files changed, 183 insertions(+) create mode 100644 docs/.gitignore create mode 100644 grub-core/.gitignore create mode 100644 grub-core/lib/.gitignore @@ -20,10 +20,14 @@ Subject: [PATCH] re-write .gitignore create mode 100644 util/bash-completion.d/.gitignore diff --git a/.gitignore b/.gitignore -index 819cd185d44..b45a633f3d1 100644 +index f6a1bd05175..594d0134d33 100644 --- a/.gitignore +++ b/.gitignore -@@ -1,237 +1,151 @@ +@@ -275,3 +275,155 @@ widthspec.bin + /xfs_test + /xzcompress_test + /zfs_test ++======= +# things ./autogen.sh will create +/Makefile.utilgcry.def +/ABOUT-NLS @@ -36,45 +40,7 @@ index 819cd185d44..b45a633f3d1 100644 +/Makefile + +# things very common editors create that we never want - *~ --00_header --10_* --20_linux_xen --30_os-prober --40_custom --41_custom --*.1 --*.8 --ABOUT-NLS --aclocal.m4 --ahci_test --ascii.bitmaps --ascii.h --autom4te.cache --build-aux --build-grub-gen-asciih --build-grub-gen-widthspec --build-grub-mkfont --cdboot_test --cmp_test --config.cache --config.guess --config.h --config-util.h --config-util.h.in --config.log --config.status --config.sub --configure --core_compress_test --DISTLIST --docs/*.info --docs/stamp-vti --docs/version.texi --ehci_test --example_grub_script_test --example_scripted_test --example_unit_test ++*~ +.*.sw? +*.patch + @@ -87,207 +53,22 @@ index 819cd185d44..b45a633f3d1 100644 +*.a +*.am +*.efi - *.exec --*.exec.exe --fddboot_test --genkernsyms.sh --gensymlist.sh --gentrigtables --gentrigtables.exe --gettext_strings_test --/gnulib --grub-bin2h --/grub-bios-setup --/grub-bios-setup.exe --grub_cmd_date --grub_cmd_echo --grub_cmd_regexp --grub_cmd_set_date --grub_cmd_sleep --/grub-editenv --/grub-editenv.exe --grub-emu --grub-emu-lite --grub-emu.exe --grub-emu-lite.exe --grub_emu_init.c --grub_emu_init.h --/grub-file --/grub-file.exe --grub-fstest --grub-fstest.exe --grub_fstest_init.c --grub_fstest_init.h --grub_func_test --grub-install --grub-install.exe --grub-kbdcomp --/grub-macbless --/grub-macbless.exe --grub-macho2img --/grub-menulst2cfg --/grub-menulst2cfg.exe --/grub-mk* --grub-mount --/grub-ofpathname --/grub-ofpathname.exe --grub-core/build-grub-pe2elf.exe --/grub-probe --/grub-probe.exe --grub_probe_init.c --grub_probe_init.h --/grub-reboot --grub_script_blanklines --grub_script_blockarg --grub_script_break --grub-script-check --grub-script-check.exe --grub_script_check_init.c --grub_script_check_init.h --grub_script_comments --grub_script_continue --grub_script_dollar --grub_script_echo1 --grub_script_echo_keywords --grub_script_escape_comma --grub_script_eval --grub_script_expansion --grub_script_final_semicolon --grub_script_for1 --grub_script_functions --grub_script_gettext --grub_script_if --grub_script_leading_whitespace --grub_script_no_commands --grub_script_not --grub_script_return --grub_script_setparams --grub_script_shift --grub_script_strcmp --grub_script_test --grub_script_vars1 --grub_script_while1 --grub_script.tab.c --grub_script.tab.h --grub_script.yy.c --grub_script.yy.h --grub-set-default --grub_setup_init.c --grub_setup_init.h --grub-shell --grub-shell-tester --grub-sparc64-setup --grub-sparc64-setup.exe --/grub-syslinux2cfg --/grub-syslinux2cfg.exe --gzcompress_test --hddboot_test --help_test --*.img - *.image --*.image.exe --include/grub/cpu --include/grub/machine --INSTALL.grub --install-sh --lib/libgcrypt-grub --libgrub_a_init.c --*.log ++*.exec ++*.image +*.img +*.info - *.lst --lzocompress_test - *.marker --Makefile - /m4 - *.mod --mod-*.c --missing --netboot_test ++*.lst ++*.marker ++/m4 ++*.mod +*.module - *.o --*.a --ohci_test --partmap_test --pata_test - *.pf2 --*.pp --po/*.mo --po/grub.pot --po/Makefile.in.in --po/Makevars --po/Makevars.template --po/POTFILES --po/Rules-quot --po/stamp-po --printf_test --priority_queue_unit_test --pseries_test --stamp-h --stamp-h1 --stamp-h.in --symlist.c --symlist.h --trigtables.c --*.trs --uhci_test --update-grub_lib --unidata.c --xzcompress_test --Makefile.in --GPATH --GRTAGS --GSYMS --GTAGS --compile --depcomp --mdate-sh --texinfo.tex --grub-core/lib/libgcrypt-grub --.deps --.deps-util --.deps-core ++*.o ++*.pf2 +*.yy.[ch] +.deps/ +.deps-core/ +.deps-util/ - .dirstamp --Makefile.util.am --contrib --grub-core/bootinfo.txt --grub-core/Makefile.core.am --grub-core/Makefile.gcry.def --grub-core/contrib --grub-core/gdb_grub --grub-core/genmod.sh --grub-core/gensyminfo.sh --grub-core/gmodule.pl --grub-core/grub.chrp --grub-core/modinfo.sh --grub-core/*.module --grub-core/*.module.exe --grub-core/*.pp --grub-core/kernel.img.bin --util/bash-completion.d/grub --grub-core/lib/gnulib --grub-core/rs_decoder.h --widthspec.bin --widthspec.h --docs/stamp-1 --docs/version-dev.texi --Makefile.utilgcry.def --po/*.po --po/*.gmo --po/LINGUAS --po/remove-potcdate.sed --include/grub/gcrypt/gcrypt.h --include/grub/gcrypt/g10lib.h --po/POTFILES.in --po/POTFILES-shell.in --/grub-glue-efi --/grub-render-label --/grub-glue-efi.exe --/grub-render-label.exe ++.dirstamp + +# next are things you get if you do ./configure in the topdir (for e.g. +# "make dist" invocation. @@ -320,10 +101,7 @@ index 819cd185d44..b45a633f3d1 100644 +/build-grub-gen-widthspec +/build-grub-mkfont +/config-util.h.in - /garbage-gen --/garbage-gen.exe --/grub-fs-tester --grub-core/build-grub-module-verifier ++/garbage-gen +/grub*-bios-setup +/grub*-bios-setup.8 +/grub*-editenv diff --git a/0008-IBM-client-architecture-CAS-reboot-support.patch b/0008-IBM-client-architecture-CAS-reboot-support.patch index 4c12e5a7..eaaf9a42 100644 --- a/0008-IBM-client-architecture-CAS-reboot-support.patch +++ b/0008-IBM-client-architecture-CAS-reboot-support.patch @@ -96,10 +96,10 @@ index 4d493ab7661..3a6689abb11 100644 + return 0; +} diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 1b03dfd57b9..222e239c1be 100644 +index c4ebe9e22ad..70614de1565 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -33,6 +33,9 @@ +@@ -34,6 +34,9 @@ #include #include #include @@ -109,7 +109,7 @@ index 1b03dfd57b9..222e239c1be 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -275,6 +278,22 @@ grub_normal_execute (const char *config, int nested, int batch) +@@ -276,6 +279,22 @@ grub_normal_execute (const char *config, int nested, int batch) { menu = read_config_file (config); @@ -133,7 +133,7 @@ index 1b03dfd57b9..222e239c1be 100644 grub_errno = GRUB_ERR_NONE; } diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index ee299fd0ea6..0d05d6b0709 100644 +index 25158407dd8..ad80399246a 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -28,6 +28,9 @@ @@ -146,7 +146,7 @@ index ee299fd0ea6..0d05d6b0709 100644 /* Max digits for a char is 3 (0xFF is 255), similarly for an int it is sizeof (int) * 3, and one extra for a possible -ve sign. */ -@@ -878,6 +881,10 @@ grub_script_execute_sourcecode (const char *source) +@@ -883,6 +886,10 @@ grub_script_execute_sourcecode (const char *source) grub_err_t ret = 0; struct grub_script *parsed_script; diff --git a/0009-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0009-for-ppc-reset-console-display-attr-when-clear-screen.patch index ac674531..fd86ef1a 100644 --- a/0009-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0009-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index d317efa368d..29df35e6d20 100644 +index cd720080375..44d0b3b19fb 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term, diff --git a/0011-Honor-a-symlink-when-generating-configuration-by-gru.patch b/0011-Honor-a-symlink-when-generating-configuration-by-gru.patch deleted file mode 100644 index 2b953a6a..00000000 --- a/0011-Honor-a-symlink-when-generating-configuration-by-gru.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Marcel Kolaja -Date: Tue, 21 Jan 2014 10:57:08 -0500 -Subject: [PATCH] Honor a symlink when generating configuration by - grub2-mkconfig - -Honor a symlink when generating configuration by grub2-mkconfig, so that -the -o option follows it rather than overwriting it with a regular file. ---- - util/grub-mkconfig.in | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 9f477ff0546..523d4e029bb 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -287,7 +287,8 @@ and /etc/grub.d/* files or please file a bug report with - exit 1 - else - # none of the children aborted with error, install the new grub.cfg -- mv -f ${grub_cfg}.new ${grub_cfg} -+ cat ${grub_cfg}.new > ${grub_cfg} -+ rm -f ${grub_cfg}.new - fi - fi - diff --git a/0012-Move-bash-completion-script-922997.patch b/0011-Move-bash-completion-script-922997.patch similarity index 92% rename from 0012-Move-bash-completion-script-922997.patch rename to 0011-Move-bash-completion-script-922997.patch index e3af5868..606e39b6 100644 --- a/0012-Move-bash-completion-script-922997.patch +++ b/0011-Move-bash-completion-script-922997.patch @@ -10,10 +10,10 @@ Apparently these go in a new place now. 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 7656f2434e5..d283af64c8c 100644 +index 74719416c4c..c0103b30d4e 100644 --- a/configure.ac +++ b/configure.ac -@@ -305,6 +305,14 @@ AC_SUBST(grubdirname) +@@ -314,6 +314,14 @@ AC_SUBST(grubdirname) AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", [Default grub directory name]) @@ -28,7 +28,7 @@ index 7656f2434e5..d283af64c8c 100644 # # Checks for build programs. # -@@ -516,6 +524,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" +@@ -525,6 +533,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" # Check for target programs. # diff --git a/0014-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0012-Allow-fallback-to-include-entries-by-title-not-just-.patch similarity index 90% rename from 0014-Allow-fallback-to-include-entries-by-title-not-just-.patch rename to 0012-Allow-fallback-to-include-entries-by-title-not-just-.patch index ee5d1dae..f2a4a82c 100644 --- a/0014-Allow-fallback-to-include-entries-by-title-not-just-.patch +++ b/0012-Allow-fallback-to-include-entries-by-title-not-just-.patch @@ -12,10 +12,10 @@ Signed-off-by: Peter Jones 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d5e0c79a70e..9175ad297d8 100644 +index 8397886fa05..d7a222e681b 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c -@@ -163,16 +163,41 @@ grub_menu_set_timeout (int timeout) +@@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout) } } @@ -51,14 +51,13 @@ index d5e0c79a70e..9175ad297d8 100644 -get_and_remove_first_entry_number (const char *name) +get_and_remove_first_entry_number (grub_menu_t menu, const char *name) { - const char *val; - char *tail; + const char *val, *tail; int entry; + int sz = 0; val = grub_env_get (name); if (! val) -@@ -182,9 +207,39 @@ get_and_remove_first_entry_number (const char *name) +@@ -181,9 +206,39 @@ get_and_remove_first_entry_number (const char *name) entry = (int) grub_strtoul (val, &tail, 0); @@ -99,7 +98,7 @@ index d5e0c79a70e..9175ad297d8 100644 while (*tail && grub_isspace (*tail)) tail++; grub_env_set (name, tail); -@@ -347,7 +402,7 @@ grub_menu_execute_with_fallback (grub_menu_t menu, +@@ -346,7 +401,7 @@ grub_menu_execute_with_fallback (grub_menu_t menu, grub_menu_execute_entry (entry, 1); /* Deal with fallback entries. */ @@ -108,7 +107,7 @@ index d5e0c79a70e..9175ad297d8 100644 >= 0) { grub_print_error (); -@@ -465,30 +520,6 @@ grub_menu_register_viewer (struct grub_menu_viewer *viewer) +@@ -464,30 +519,6 @@ grub_menu_register_viewer (struct grub_menu_viewer *viewer) viewers = viewer; } diff --git a/0016-Make-exit-take-a-return-code.patch b/0013-Make-exit-take-a-return-code.patch similarity index 93% rename from 0016-Make-exit-take-a-return-code.patch rename to 0013-Make-exit-take-a-return-code.patch index 0cd25b2f..39d70573 100644 --- a/0016-Make-exit-take-a-return-code.patch +++ b/0013-Make-exit-take-a-return-code.patch @@ -27,10 +27,10 @@ Signed-off-by: Peter Jones 14 files changed, 48 insertions(+), 21 deletions(-) diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c -index 6bbce3128cf..6d66b7c453a 100644 +index fa498931ed2..2bd3ac76f2d 100644 --- a/grub-core/commands/minicmd.c +++ b/grub-core/commands/minicmd.c -@@ -179,12 +179,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), +@@ -182,12 +182,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), } /* exit */ @@ -60,10 +60,10 @@ index 6bbce3128cf..6d66b7c453a 100644 } diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 6e1ceb90516..370ce03c5d7 100644 +index 8cff7be0289..05d8237a9b2 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -164,11 +164,16 @@ grub_reboot (void) +@@ -165,11 +165,16 @@ grub_reboot (void) } void @@ -96,10 +96,10 @@ index 425bb960347..55ea5a11ccd 100644 grub_reboot (); } diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 65db79baa10..19cd007d448 100644 +index dfd8a8ec488..0ff13bcaf8c 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -139,9 +139,10 @@ xasprintf (const char *fmt, ...) +@@ -151,9 +151,10 @@ xasprintf (const char *fmt, ...) #if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL) void @@ -152,7 +152,7 @@ index d483e35eed2..e71d1584164 100644 grub_ieee1275_exit (); } diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c -index 3834a149093..86b3a25ec40 100644 +index 2ed3ff3191e..5c40c34078d 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -276,7 +276,7 @@ grub_halt (void) @@ -191,10 +191,10 @@ index be88b77d22d..8b6c55ffc01 100644 grub_halt (); } diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 3b633d51f4c..cd63a8cea73 100644 +index 3af336ee227..63b586d09cb 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -1095,9 +1095,18 @@ grub_abort (void) +@@ -1209,9 +1209,18 @@ grub_abort (void) grub_getkey (); } @@ -253,10 +253,10 @@ index 782ca72952a..708b060f324 100644 struct sched_shutdown arg; diff --git a/include/grub/misc.h b/include/grub/misc.h -index ee48eb7a726..f9135b62e35 100644 +index 7d2b5519690..fd18e6320b8 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h -@@ -334,7 +334,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, +@@ -353,7 +353,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT; char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) WARN_UNUSED_RESULT; diff --git a/0013-Update-to-minilzo-2.08.patch b/0013-Update-to-minilzo-2.08.patch deleted file mode 100644 index a71c501e..00000000 --- a/0013-Update-to-minilzo-2.08.patch +++ /dev/null @@ -1,8509 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 4 Dec 2014 15:36:09 -0500 -Subject: [PATCH] Update to minilzo-2.08 - -This fixes CVE-2014-4607 - lzo: lzo1x_decompress_safe() integer overflow - -Signed-off-by: Peter Jones ---- - grub-core/lib/minilzo/minilzo.c | 3801 +++++++++++++++++++++++++++------------ - grub-core/lib/minilzo/lzoconf.h | 216 ++- - grub-core/lib/minilzo/lzodefs.h | 2320 ++++++++++++++++++------ - grub-core/lib/minilzo/minilzo.h | 21 +- - 4 files changed, 4489 insertions(+), 1869 deletions(-) - -diff --git a/grub-core/lib/minilzo/minilzo.c b/grub-core/lib/minilzo/minilzo.c -index 25a1f68b3b5..ab2be5f4fd0 100644 ---- a/grub-core/lib/minilzo/minilzo.c -+++ b/grub-core/lib/minilzo/minilzo.c -@@ -2,22 +2,7 @@ - - This file is part of the LZO real-time data compression library. - -- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer -+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or -@@ -67,12 +52,6 @@ - #if defined(__CYGWIN32__) && !defined(__CYGWIN__) - # define __CYGWIN__ __CYGWIN32__ - #endif --#if defined(__IBMCPP__) && !defined(__IBMC__) --# define __IBMC__ __IBMCPP__ --#endif --#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) --# define __INTEL_COMPILER __ICL --#endif - #if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) - # define _ALL_SOURCE 1 - #endif -@@ -81,19 +60,30 @@ - # define __LONG_MAX__ 9223372036854775807L - # endif - #endif --#if defined(__INTEL_COMPILER) && defined(__linux__) -+#if !defined(LZO_CFG_NO_DISABLE_WUNDEF) -+#if defined(__ARMCC_VERSION) -+# pragma diag_suppress 193 -+#elif defined(__clang__) && defined(__clang_minor__) -+# pragma clang diagnostic ignored "-Wundef" -+#elif defined(__INTEL_COMPILER) - # pragma warning(disable: 193) --#endif --#if defined(__KEIL__) && defined(__C166__) -+#elif defined(__KEIL__) && defined(__C166__) - # pragma warning disable = 322 --#elif 0 && defined(__C251__) --# pragma warning disable = 322 --#endif --#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) --# if (_MSC_VER >= 1300) -+#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__PATHSCALE__) -+# if ((__GNUC__-0) >= 5 || ((__GNUC__-0) == 4 && (__GNUC_MINOR__-0) >= 2)) -+# pragma GCC diagnostic ignored "-Wundef" -+# endif -+#elif defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -+# if ((_MSC_VER-0) >= 1300) - # pragma warning(disable: 4668) - # endif - #endif -+#endif -+#if 0 && defined(__POCC__) && defined(_WIN32) -+# if (__POCC__ >= 400) -+# pragma warn(disable: 2216) -+# endif -+#endif - #if 0 && defined(__WATCOMC__) - # if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) - # pragma warning 203 9 -@@ -102,13 +92,29 @@ - #if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) - # pragma option -h - #endif -+#if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC) -+#ifndef _CRT_NONSTDC_NO_DEPRECATE -+#define _CRT_NONSTDC_NO_DEPRECATE 1 -+#endif -+#ifndef _CRT_NONSTDC_NO_WARNINGS -+#define _CRT_NONSTDC_NO_WARNINGS 1 -+#endif -+#ifndef _CRT_SECURE_NO_DEPRECATE -+#define _CRT_SECURE_NO_DEPRECATE 1 -+#endif -+#ifndef _CRT_SECURE_NO_WARNINGS -+#define _CRT_SECURE_NO_WARNINGS 1 -+#endif -+#endif - #if 0 --#define LZO_0xffffL 0xfffful --#define LZO_0xffffffffL 0xfffffffful -+#define LZO_0xffffUL 0xfffful -+#define LZO_0xffffffffUL 0xfffffffful - #else --#define LZO_0xffffL 65535ul --#define LZO_0xffffffffL 4294967295ul -+#define LZO_0xffffUL 65535ul -+#define LZO_0xffffffffUL 4294967295ul - #endif -+#define LZO_0xffffL LZO_0xffffUL -+#define LZO_0xffffffffL LZO_0xffffffffUL - #if (LZO_0xffffL == LZO_0xffffffffL) - # error "your preprocessor is broken 1" - #endif -@@ -123,6 +129,13 @@ - # error "your preprocessor is broken 4" - #endif - #endif -+#if defined(__COUNTER__) -+# ifndef LZO_CFG_USE_COUNTER -+# define LZO_CFG_USE_COUNTER 1 -+# endif -+#else -+# undef LZO_CFG_USE_COUNTER -+#endif - #if (UINT_MAX == LZO_0xffffL) - #if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) - # if !defined(MSDOS) -@@ -253,14 +266,31 @@ - #endif - #define LZO_PP_STRINGIZE(x) #x - #define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -+#define LZO_PP_CONCAT0() /*empty*/ -+#define LZO_PP_CONCAT1(a) a - #define LZO_PP_CONCAT2(a,b) a ## b - #define LZO_PP_CONCAT3(a,b,c) a ## b ## c - #define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d - #define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -+#define LZO_PP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f -+#define LZO_PP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g -+#define LZO_PP_ECONCAT0() LZO_PP_CONCAT0() -+#define LZO_PP_ECONCAT1(a) LZO_PP_CONCAT1(a) - #define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) - #define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) - #define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) - #define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -+#define LZO_PP_ECONCAT6(a,b,c,d,e,f) LZO_PP_CONCAT6(a,b,c,d,e,f) -+#define LZO_PP_ECONCAT7(a,b,c,d,e,f,g) LZO_PP_CONCAT7(a,b,c,d,e,f,g) -+#define LZO_PP_EMPTY /*empty*/ -+#define LZO_PP_EMPTY0() /*empty*/ -+#define LZO_PP_EMPTY1(a) /*empty*/ -+#define LZO_PP_EMPTY2(a,b) /*empty*/ -+#define LZO_PP_EMPTY3(a,b,c) /*empty*/ -+#define LZO_PP_EMPTY4(a,b,c,d) /*empty*/ -+#define LZO_PP_EMPTY5(a,b,c,d,e) /*empty*/ -+#define LZO_PP_EMPTY6(a,b,c,d,e,f) /*empty*/ -+#define LZO_PP_EMPTY7(a,b,c,d,e,f,g) /*empty*/ - #if 1 - #define LZO_CPP_STRINGIZE(x) #x - #define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -@@ -268,12 +298,16 @@ - #define LZO_CPP_CONCAT3(a,b,c) a ## b ## c - #define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d - #define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -+#define LZO_CPP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f -+#define LZO_CPP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g - #define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) - #define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) - #define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) - #define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -+#define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f) -+#define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g) - #endif --#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) -+#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-!!(b))) - (o)) << 1) + (o)*!!(b)) - #if 1 && defined(__cplusplus) - # if !defined(__STDC_CONSTANT_MACROS) - # define __STDC_CONSTANT_MACROS 1 -@@ -283,9 +317,13 @@ - # endif - #endif - #if defined(__cplusplus) --# define LZO_EXTERN_C extern "C" -+# define LZO_EXTERN_C extern "C" -+# define LZO_EXTERN_C_BEGIN extern "C" { -+# define LZO_EXTERN_C_END } - #else --# define LZO_EXTERN_C extern -+# define LZO_EXTERN_C extern -+# define LZO_EXTERN_C_BEGIN /*empty*/ -+# define LZO_EXTERN_C_END /*empty*/ - #endif - #if !defined(__LZO_OS_OVERRIDE) - #if (LZO_OS_FREESTANDING) -@@ -386,12 +424,12 @@ - #elif defined(__VMS) - # define LZO_OS_VMS 1 - # define LZO_INFO_OS "vms" --#elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -+#elif (defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__) - # define LZO_OS_CONSOLE 1 - # define LZO_OS_CONSOLE_PS2 1 - # define LZO_INFO_OS "console" - # define LZO_INFO_OS_CONSOLE "ps2" --#elif (defined(__mips__) && defined(__psp__)) -+#elif defined(__mips__) && defined(__psp__) - # define LZO_OS_CONSOLE 1 - # define LZO_OS_CONSOLE_PSP 1 - # define LZO_INFO_OS "console" -@@ -419,9 +457,18 @@ - # elif defined(__linux__) || defined(__linux) || defined(__LINUX__) - # define LZO_OS_POSIX_LINUX 1 - # define LZO_INFO_OS_POSIX "linux" --# elif defined(__APPLE__) || defined(__MACOS__) --# define LZO_OS_POSIX_MACOSX 1 --# define LZO_INFO_OS_POSIX "macosx" -+# elif defined(__APPLE__) && defined(__MACH__) -+# if ((__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__-0) >= 20000) -+# define LZO_OS_POSIX_DARWIN 1040 -+# define LZO_INFO_OS_POSIX "darwin_iphone" -+# elif ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1040) -+# define LZO_OS_POSIX_DARWIN __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ -+# define LZO_INFO_OS_POSIX "darwin" -+# else -+# define LZO_OS_POSIX_DARWIN 1 -+# define LZO_INFO_OS_POSIX "darwin" -+# endif -+# define LZO_OS_POSIX_MACOSX LZO_OS_POSIX_DARWIN - # elif defined(__minix__) || defined(__minix) - # define LZO_OS_POSIX_MINIX 1 - # define LZO_INFO_OS_POSIX "minix" -@@ -456,18 +503,18 @@ - #endif - #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) - # if (UINT_MAX != LZO_0xffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (ULONG_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif - #if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) - # if (UINT_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (ULONG_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif - #if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -@@ -483,59 +530,65 @@ - # define LZO_INFO_CC "sdcc" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) - #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) --# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) -+# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__-0) * 0x100 + (__PATHCC_PATCHLEVEL__-0)) - # define LZO_INFO_CC "Pathscale C" - # define LZO_INFO_CCVER __PATHSCALE__ --#elif defined(__INTEL_COMPILER) --# define LZO_CC_INTELC 1 -+# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+# define LZO_CC_PATHSCALE_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -+# endif -+#elif defined(__INTEL_COMPILER) && ((__INTEL_COMPILER-0) > 0) -+# define LZO_CC_INTELC __INTEL_COMPILER - # define LZO_INFO_CC "Intel C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) --# if defined(_WIN32) || defined(_WIN64) --# define LZO_CC_SYNTAX_MSC 1 --# else --# define LZO_CC_SYNTAX_GNUC 1 -+# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -+# define LZO_CC_INTELC_MSC _MSC_VER -+# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+# define LZO_CC_INTELC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) - # endif - #elif defined(__POCC__) && defined(_WIN32) - # define LZO_CC_PELLESC 1 - # define LZO_INFO_CC "Pelles C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) --#elif defined(__clang__) && defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+#elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) - # if defined(__GNUC_PATCHLEVEL__) --# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -+# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) - # else --# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -+# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) - # endif -+# define LZO_CC_ARMCC __ARMCC_VERSION -+# define LZO_INFO_CC "ARM C Compiler" -+# define LZO_INFO_CCVER __VERSION__ -+#elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__) - # if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__) --# define LZO_CC_CLANG_CLANG (__clang_major__ * 0x10000L + __clang_minor__ * 0x100 + __clang_patchlevel__) -+# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) - # else --# define LZO_CC_CLANG_CLANG 0x010000L -+# define LZO_CC_CLANG 0x010000L -+# endif -+# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -+# define LZO_CC_CLANG_MSC _MSC_VER -+# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) - # endif --# define LZO_CC_CLANG LZO_CC_CLANG_GNUC - # define LZO_INFO_CC "clang" - # define LZO_INFO_CCVER __VERSION__ - #elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) - # if defined(__GNUC_PATCHLEVEL__) --# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -+# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) - # else --# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -+# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) - # endif - # define LZO_CC_LLVM LZO_CC_LLVM_GNUC - # define LZO_INFO_CC "llvm-gcc" - # define LZO_INFO_CCVER __VERSION__ --#elif defined(__GNUC__) && defined(__VERSION__) --# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) --# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) --# elif defined(__GNUC_MINOR__) --# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) --# else --# define LZO_CC_GNUC (__GNUC__ * 0x10000L) --# endif --# define LZO_INFO_CC "gcc" --# define LZO_INFO_CCVER __VERSION__ - #elif defined(__ACK__) && defined(_ACK) - # define LZO_CC_ACK 1 - # define LZO_INFO_CC "Amsterdam Compiler Kit C" - # define LZO_INFO_CCVER "unknown" -+#elif defined(__ARMCC_VERSION) && !defined(__GNUC__) -+# define LZO_CC_ARMCC __ARMCC_VERSION -+# define LZO_CC_ARMCC_ARMCC __ARMCC_VERSION -+# define LZO_INFO_CC "ARM C Compiler" -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ARMCC_VERSION) - #elif defined(__AZTEC_C__) - # define LZO_CC_AZTECC 1 - # define LZO_INFO_CC "Aztec C" -@@ -560,10 +613,23 @@ - # define LZO_CC_DECC 1 - # define LZO_INFO_CC "DEC C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -+#elif (defined(__ghs) || defined(__ghs__)) && defined(__GHS_VERSION_NUMBER) && ((__GHS_VERSION_NUMBER-0) > 0) -+# define LZO_CC_GHS 1 -+# define LZO_INFO_CC "Green Hills C" -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__GHS_VERSION_NUMBER) -+# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -+# define LZO_CC_GHS_MSC _MSC_VER -+# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+# define LZO_CC_GHS_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -+# endif - #elif defined(__HIGHC__) - # define LZO_CC_HIGHC 1 - # define LZO_INFO_CC "MetaWare High C" - # define LZO_INFO_CCVER "unknown" -+#elif defined(__HP_aCC) && ((__HP_aCC-0) > 0) -+# define LZO_CC_HPACC __HP_aCC -+# define LZO_INFO_CC "HP aCC" -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__HP_aCC) - #elif defined(__IAR_SYSTEMS_ICC__) - # define LZO_CC_IARC 1 - # define LZO_INFO_CC "IAR C" -@@ -572,10 +638,14 @@ - # else - # define LZO_INFO_CCVER "unknown" - # endif --#elif defined(__IBMC__) --# define LZO_CC_IBMC 1 -+#elif defined(__IBMC__) && ((__IBMC__-0) > 0) -+# define LZO_CC_IBMC __IBMC__ - # define LZO_INFO_CC "IBM C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -+#elif defined(__IBMCPP__) && ((__IBMCPP__-0) > 0) -+# define LZO_CC_IBMC __IBMCPP__ -+# define LZO_INFO_CC "IBM C" -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMCPP__) - #elif defined(__KEIL__) && defined(__C166__) - # define LZO_CC_KEILC 1 - # define LZO_INFO_CC "Keil C" -@@ -592,16 +662,8 @@ - # else - # define LZO_INFO_CCVER "unknown" - # endif --#elif defined(_MSC_VER) --# define LZO_CC_MSC 1 --# define LZO_INFO_CC "Microsoft C" --# if defined(_MSC_FULL_VER) --# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) --# else --# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) --# endif --#elif defined(__MWERKS__) --# define LZO_CC_MWERKS 1 -+#elif defined(__MWERKS__) && ((__MWERKS__-0) > 0) -+# define LZO_CC_MWERKS __MWERKS__ - # define LZO_INFO_CC "Metrowerks C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) - #elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -@@ -612,6 +674,15 @@ - # define LZO_CC_PACIFICC 1 - # define LZO_INFO_CC "Pacific C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -+#elif defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) -+# if defined(__PGIC_PATCHLEVEL__) -+# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100 + (__PGIC_PATCHLEVEL__-0)) -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) "." LZO_PP_MACRO_EXPAND(__PGIC_PATCHLEVEL__) -+# else -+# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100) -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) ".0" -+# endif -+# define LZO_INFO_CC "Portland Group PGI C" - #elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) - # define LZO_CC_PGI 1 - # define LZO_INFO_CC "Portland Group PGI C" -@@ -626,7 +697,7 @@ - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) - #elif defined(__SUNPRO_C) - # define LZO_INFO_CC "SunPro C" --# if ((__SUNPRO_C)+0 > 0) -+# if ((__SUNPRO_C-0) > 0) - # define LZO_CC_SUNPROC __SUNPRO_C - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) - # else -@@ -635,7 +706,7 @@ - # endif - #elif defined(__SUNPRO_CC) - # define LZO_INFO_CC "SunPro C" --# if ((__SUNPRO_CC)+0 > 0) -+# if ((__SUNPRO_CC-0) > 0) - # define LZO_CC_SUNPROC __SUNPRO_CC - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) - # else -@@ -661,16 +732,46 @@ - #elif defined(__ZTC__) - # define LZO_CC_ZORTECHC 1 - # define LZO_INFO_CC "Zortech C" --# if (__ZTC__ == 0x310) -+# if ((__ZTC__-0) == 0x310) - # define LZO_INFO_CCVER "0x310" - # else - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) - # endif -+#elif defined(__GNUC__) && defined(__VERSION__) -+# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -+# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -+# elif defined(__GNUC_MINOR__) -+# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) -+# else -+# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -+# endif -+# define LZO_INFO_CC "gcc" -+# define LZO_INFO_CCVER __VERSION__ -+#elif defined(_MSC_VER) && ((_MSC_VER-0) > 0) -+# define LZO_CC_MSC _MSC_VER -+# define LZO_INFO_CC "Microsoft C" -+# if defined(_MSC_FULL_VER) -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -+# else -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -+# endif - #else - # define LZO_CC_UNKNOWN 1 - # define LZO_INFO_CC "unknown" - # define LZO_INFO_CCVER "unknown" - #endif -+#if (LZO_CC_GNUC) && defined(__OPEN64__) -+# if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__) -+# define LZO_CC_OPEN64 (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__-0) * 0x100 + (__OPENCC_PATCHLEVEL__-0)) -+# define LZO_CC_OPEN64_GNUC LZO_CC_GNUC -+# endif -+#endif -+#if (LZO_CC_GNUC) && defined(__PCC__) -+# if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__) -+# define LZO_CC_PCC (__PCC__ * 0x10000L + (__PCC_MINOR__-0) * 0x100 + (__PCC_MINORMINOR__-0)) -+# define LZO_CC_PCC_GNUC LZO_CC_GNUC -+# endif -+#endif - #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) - # error "LZO_CC_MSC: _MSC_FULL_VER is not defined" - #endif -@@ -688,8 +789,10 @@ - # define LZO_INFO_ARCH "generic" - #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) - # define LZO_ARCH_I086 1 --# define LZO_ARCH_IA16 1 - # define LZO_INFO_ARCH "i086" -+#elif defined(__aarch64__) -+# define LZO_ARCH_ARM64 1 -+# define LZO_INFO_ARCH "arm64" - #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) - # define LZO_ARCH_ALPHA 1 - # define LZO_INFO_ARCH "alpha" -@@ -705,10 +808,10 @@ - # define LZO_INFO_ARCH "arm_thumb" - #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) - # define LZO_ARCH_ARM 1 --# if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) -+# if defined(__CPU_MODE__) && ((__CPU_MODE__-0) == 1) - # define LZO_ARCH_ARM_THUMB 1 - # define LZO_INFO_ARCH "arm_thumb" --# elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) -+# elif defined(__CPU_MODE__) && ((__CPU_MODE__-0) == 2) - # define LZO_INFO_ARCH "arm" - # else - # define LZO_INFO_ARCH "arm" -@@ -826,53 +929,147 @@ - # error "FIXME - missing define for CPU architecture" - #endif - #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) --# error "FIXME - missing WIN32 define for CPU architecture" -+# error "FIXME - missing LZO_OS_WIN32 define for CPU architecture" - #endif - #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) --# error "FIXME - missing WIN64 define for CPU architecture" -+# error "FIXME - missing LZO_OS_WIN64 define for CPU architecture" - #endif - #if (LZO_OS_OS216 || LZO_OS_WIN16) - # define LZO_ARCH_I086PM 1 --# define LZO_ARCH_IA16PM 1 - #elif 1 && (LZO_OS_DOS16 && defined(BLX286)) - # define LZO_ARCH_I086PM 1 --# define LZO_ARCH_IA16PM 1 - #elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) - # define LZO_ARCH_I086PM 1 --# define LZO_ARCH_IA16PM 1 - #elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) - # define LZO_ARCH_I086PM 1 --# define LZO_ARCH_IA16PM 1 - #endif --#if (LZO_ARCH_ARM_THUMB) && !(LZO_ARCH_ARM) --# error "this should not happen" -+#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) -+# define LZO_ARCH_X64 1 -+#elif (!LZO_ARCH_AMD64 && LZO_ARCH_X64) && defined(__LZO_ARCH_OVERRIDE) -+# define LZO_ARCH_AMD64 1 - #endif --#if (LZO_ARCH_I086PM) && !(LZO_ARCH_I086) --# error "this should not happen" -+#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) -+# define LZO_ARCH_AARCH64 1 -+#elif (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) && defined(__LZO_ARCH_OVERRIDE) -+# define LZO_ARCH_ARM64 1 -+#endif -+#if (LZO_ARCH_I386 && !LZO_ARCH_X86) -+# define LZO_ARCH_X86 1 -+#elif (!LZO_ARCH_I386 && LZO_ARCH_X86) && defined(__LZO_ARCH_OVERRIDE) -+# define LZO_ARCH_I386 1 -+#endif -+#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) || (!LZO_ARCH_AMD64 && LZO_ARCH_X64) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) || (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM_THUMB && !LZO_ARCH_ARM) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM_THUMB) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM_THUMB) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_I086PM && !LZO_ARCH_I086) -+# error "unexpected configuration - check your compiler defines" - #endif - #if (LZO_ARCH_I086) - # if (UINT_MAX != LZO_0xffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (ULONG_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif - #if (LZO_ARCH_I386) - # if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (ULONG_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif --#if !defined(__LZO_MM_OVERRIDE) -+#if (LZO_ARCH_AMD64 || LZO_ARCH_I386) -+# if !defined(LZO_TARGET_FEATURE_SSE2) -+# if defined(__SSE2__) -+# define LZO_TARGET_FEATURE_SSE2 1 -+# elif defined(_MSC_VER) && ((defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2)) || defined(_M_AMD64)) -+# define LZO_TARGET_FEATURE_SSE2 1 -+# endif -+# endif -+# if !defined(LZO_TARGET_FEATURE_SSSE3) -+# if (LZO_TARGET_FEATURE_SSE2) -+# if defined(__SSSE3__) -+# define LZO_TARGET_FEATURE_SSSE3 1 -+# elif defined(_MSC_VER) && defined(__AVX__) -+# define LZO_TARGET_FEATURE_SSSE3 1 -+# endif -+# endif -+# endif -+# if !defined(LZO_TARGET_FEATURE_SSE4_2) -+# if (LZO_TARGET_FEATURE_SSSE3) -+# if defined(__SSE4_2__) -+# define LZO_TARGET_FEATURE_SSE4_2 1 -+# endif -+# endif -+# endif -+# if !defined(LZO_TARGET_FEATURE_AVX) -+# if (LZO_TARGET_FEATURE_SSSE3) -+# if defined(__AVX__) -+# define LZO_TARGET_FEATURE_AVX 1 -+# endif -+# endif -+# endif -+# if !defined(LZO_TARGET_FEATURE_AVX2) -+# if (LZO_TARGET_FEATURE_AVX) -+# if defined(__AVX2__) -+# define LZO_TARGET_FEATURE_AVX2 1 -+# endif -+# endif -+# endif -+#endif -+#if (LZO_TARGET_FEATURE_SSSE3 && !(LZO_TARGET_FEATURE_SSE2)) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_TARGET_FEATURE_SSE4_2 && !(LZO_TARGET_FEATURE_SSSE3)) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_TARGET_FEATURE_AVX && !(LZO_TARGET_FEATURE_SSSE3)) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_TARGET_FEATURE_AVX2 && !(LZO_TARGET_FEATURE_AVX)) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM) -+# if !defined(LZO_TARGET_FEATURE_NEON) -+# if defined(__ARM_NEON__) -+# define LZO_TARGET_FEATURE_NEON 1 -+# endif -+# endif -+#elif (LZO_ARCH_ARM64) -+# if !defined(LZO_TARGET_FEATURE_NEON) -+# if 1 -+# define LZO_TARGET_FEATURE_NEON 1 -+# endif -+# endif -+#endif -+#if 0 -+#elif !defined(__LZO_MM_OVERRIDE) - #if (LZO_ARCH_I086) - #if (UINT_MAX != LZO_0xffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - #endif - #if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) - # define LZO_MM_TINY 1 -@@ -899,7 +1096,7 @@ - #elif (LZO_CC_ZORTECHC && defined(__VCM__)) - # define LZO_MM_LARGE 1 - #else --# error "unknown memory model" -+# error "unknown LZO_ARCH_I086 memory model" - #endif - #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) - #define LZO_HAVE_MM_HUGE_PTR 1 -@@ -922,10 +1119,10 @@ - #endif - #if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR) - # if (LZO_OS_DOS16) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # elif (LZO_CC_ZORTECHC) - # else --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif - #ifdef __cplusplus -@@ -957,7 +1154,7 @@ extern "C" { - #endif - #elif (LZO_ARCH_C166) - #if !defined(__MODEL__) --# error "FIXME - C166 __MODEL__" -+# error "FIXME - LZO_ARCH_C166 __MODEL__" - #elif ((__MODEL__) == 0) - # define LZO_MM_SMALL 1 - #elif ((__MODEL__) == 1) -@@ -971,11 +1168,11 @@ extern "C" { - #elif ((__MODEL__) == 5) - # define LZO_MM_XSMALL 1 - #else --# error "FIXME - C166 __MODEL__" -+# error "FIXME - LZO_ARCH_C166 __MODEL__" - #endif - #elif (LZO_ARCH_MCS251) - #if !defined(__MODEL__) --# error "FIXME - MCS251 __MODEL__" -+# error "FIXME - LZO_ARCH_MCS251 __MODEL__" - #elif ((__MODEL__) == 0) - # define LZO_MM_SMALL 1 - #elif ((__MODEL__) == 2) -@@ -987,11 +1184,11 @@ extern "C" { - #elif ((__MODEL__) == 5) - # define LZO_MM_XSMALL 1 - #else --# error "FIXME - MCS251 __MODEL__" -+# error "FIXME - LZO_ARCH_MCS251 __MODEL__" - #endif - #elif (LZO_ARCH_MCS51) - #if !defined(__MODEL__) --# error "FIXME - MCS51 __MODEL__" -+# error "FIXME - LZO_ARCH_MCS51 __MODEL__" - #elif ((__MODEL__) == 1) - # define LZO_MM_SMALL 1 - #elif ((__MODEL__) == 2) -@@ -1003,7 +1200,7 @@ extern "C" { - #elif ((__MODEL__) == 5) - # define LZO_MM_XSMALL 1 - #else --# error "FIXME - MCS51 __MODEL__" -+# error "FIXME - LZO_ARCH_MCS51 __MODEL__" - #endif - #elif (LZO_ARCH_CRAY_PVP) - # define LZO_MM_PVP 1 -@@ -1030,35 +1227,818 @@ extern "C" { - # error "unknown memory model" - #endif - #endif -+#if !defined(__lzo_gnuc_extension__) -+#if (LZO_CC_GNUC >= 0x020800ul) -+# define __lzo_gnuc_extension__ __extension__ -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_gnuc_extension__ __extension__ -+#elif (LZO_CC_IBMC >= 600) -+# define __lzo_gnuc_extension__ __extension__ -+#else -+#endif -+#endif -+#if !defined(__lzo_gnuc_extension__) -+# define __lzo_gnuc_extension__ /*empty*/ -+#endif -+#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0 -+# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) -+# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -+# elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1200)) -+# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -+# else -+# define LZO_CFG_USE_NEW_STYLE_CASTS 1 -+# endif -+#endif -+#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -+#endif -+#if !defined(__cplusplus) -+# if defined(LZO_CFG_USE_NEW_STYLE_CASTS) -+# undef LZO_CFG_USE_NEW_STYLE_CASTS -+# endif -+# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -+#endif -+#if !defined(LZO_REINTERPRET_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_REINTERPRET_CAST(t,e) (reinterpret_cast (e)) -+# endif -+#endif -+#if !defined(LZO_REINTERPRET_CAST) -+# define LZO_REINTERPRET_CAST(t,e) ((t) (e)) -+#endif -+#if !defined(LZO_STATIC_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_STATIC_CAST(t,e) (static_cast (e)) -+# endif -+#endif -+#if !defined(LZO_STATIC_CAST) -+# define LZO_STATIC_CAST(t,e) ((t) (e)) -+#endif -+#if !defined(LZO_STATIC_CAST2) -+# define LZO_STATIC_CAST2(t1,t2,e) LZO_STATIC_CAST(t1, LZO_STATIC_CAST(t2, e)) -+#endif -+#if !defined(LZO_UNCONST_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_UNCONST_CAST(t,e) (const_cast (e)) -+# elif (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_UNCONST_CAST(t,e) ((t) (e)) -+# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((const void *) (e))))) -+# endif -+#endif -+#if !defined(LZO_UNCONST_CAST) -+# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((const void *) (e)))) -+#endif -+#if !defined(LZO_UNCONST_VOLATILE_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_UNCONST_VOLATILE_CAST(t,e) (const_cast (e)) -+# elif (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) (e)) -+# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) -+# endif -+#endif -+#if !defined(LZO_UNCONST_VOLATILE_CAST) -+# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((volatile const void *) (e)))) -+#endif -+#if !defined(LZO_UNVOLATILE_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_UNVOLATILE_CAST(t,e) (const_cast (e)) -+# elif (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_UNVOLATILE_CAST(t,e) ((t) (e)) -+# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((volatile void *) (e))))) -+# endif -+#endif -+#if !defined(LZO_UNVOLATILE_CAST) -+# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((volatile void *) (e)))) -+#endif -+#if !defined(LZO_UNVOLATILE_CONST_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_UNVOLATILE_CONST_CAST(t,e) (const_cast (e)) -+# elif (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) (e)) -+# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) -+# endif -+#endif -+#if !defined(LZO_UNVOLATILE_CONST_CAST) -+# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((volatile const void *) (e)))) -+#endif -+#if !defined(LZO_PCAST) -+# if (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_PCAST(t,e) ((t) (e)) -+# endif -+#endif -+#if !defined(LZO_PCAST) -+# define LZO_PCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(void *, e)) -+#endif -+#if !defined(LZO_CCAST) -+# if (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_CCAST(t,e) ((t) (e)) -+# endif -+#endif -+#if !defined(LZO_CCAST) -+# define LZO_CCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(const void *, e)) -+#endif -+#if !defined(LZO_ICONV) -+# define LZO_ICONV(t,e) LZO_STATIC_CAST(t, e) -+#endif -+#if !defined(LZO_ICAST) -+# define LZO_ICAST(t,e) LZO_STATIC_CAST(t, e) -+#endif -+#if !defined(LZO_ITRUNC) -+# define LZO_ITRUNC(t,e) LZO_STATIC_CAST(t, e) -+#endif -+#if !defined(__lzo_cte) -+# if (LZO_CC_MSC || LZO_CC_WATCOMC) -+# define __lzo_cte(e) ((void)0,(e)) -+# elif 1 -+# define __lzo_cte(e) ((void)0,(e)) -+# endif -+#endif -+#if !defined(__lzo_cte) -+# define __lzo_cte(e) (e) -+#endif -+#if !defined(LZO_BLOCK_BEGIN) -+# define LZO_BLOCK_BEGIN do { -+# define LZO_BLOCK_END } while __lzo_cte(0) -+#endif -+#if !defined(LZO_UNUSED) -+# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -+# define LZO_UNUSED(var) ((void) &var) -+# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -+# define LZO_UNUSED(var) if (&var) ; else -+# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030200ul)) -+# define LZO_UNUSED(var) ((void) &var) -+# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNUSED(var) ((void) var) -+# elif (LZO_CC_MSC && (_MSC_VER < 900)) -+# define LZO_UNUSED(var) if (&var) ; else -+# elif (LZO_CC_KEILC) -+# define LZO_UNUSED(var) {LZO_EXTERN_C int lzo_unused__[1-2*!(sizeof(var)>0)];} -+# elif (LZO_CC_PACIFICC) -+# define LZO_UNUSED(var) ((void) sizeof(var)) -+# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -+# define LZO_UNUSED(var) ((void) var) -+# else -+# define LZO_UNUSED(var) ((void) &var) -+# endif -+#endif -+#if !defined(LZO_UNUSED_FUNC) -+# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -+# define LZO_UNUSED_FUNC(func) ((void) func) -+# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -+# define LZO_UNUSED_FUNC(func) if (func) ; else -+# elif (LZO_CC_CLANG || LZO_CC_LLVM) -+# define LZO_UNUSED_FUNC(func) ((void) &func) -+# elif (LZO_CC_MSC && (_MSC_VER < 900)) -+# define LZO_UNUSED_FUNC(func) if (func) ; else -+# elif (LZO_CC_MSC) -+# define LZO_UNUSED_FUNC(func) ((void) &func) -+# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -+# define LZO_UNUSED_FUNC(func) {LZO_EXTERN_C int lzo_unused_func__[1-2*!(sizeof((int)func)>0)];} -+# else -+# define LZO_UNUSED_FUNC(func) ((void) func) -+# endif -+#endif -+#if !defined(LZO_UNUSED_LABEL) -+# if (LZO_CC_CLANG >= 0x020800ul) -+# define LZO_UNUSED_LABEL(l) (__lzo_gnuc_extension__ ((void) ((const void *) &&l))) -+# elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) -+# define LZO_UNUSED_LABEL(l) if __lzo_cte(0) goto l -+# else -+# define LZO_UNUSED_LABEL(l) switch (0) case 1:goto l -+# endif -+#endif -+#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -+# if 0 -+# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -+# elif 0 && (LZO_CC_GNUC) -+# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -+# else -+# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -+# endif -+#endif -+#if !defined(__lzo_inline) -+#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -+#elif defined(__cplusplus) -+# define __lzo_inline inline -+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) -+# define __lzo_inline inline -+#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -+# define __lzo_inline __inline -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -+# define __lzo_inline __inline__ -+#elif (LZO_CC_DMC) -+# define __lzo_inline __inline -+#elif (LZO_CC_GHS) -+# define __lzo_inline __inline__ -+#elif (LZO_CC_IBMC >= 600) -+# define __lzo_inline __inline__ -+#elif (LZO_CC_INTELC) -+# define __lzo_inline __inline -+#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -+# define __lzo_inline __inline -+#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -+# define __lzo_inline __inline -+#elif (LZO_CC_SUNPROC >= 0x5100) -+# define __lzo_inline __inline__ -+#endif -+#endif -+#if defined(__lzo_inline) -+# ifndef __lzo_HAVE_inline -+# define __lzo_HAVE_inline 1 -+# endif -+#else -+# define __lzo_inline /*empty*/ -+#endif -+#if !defined(__lzo_forceinline) -+#if (LZO_CC_GNUC >= 0x030200ul) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) -+# define __lzo_forceinline __forceinline -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -+# define __lzo_forceinline __forceinline -+#elif (LZO_CC_PGI >= 0x0d0a00ul) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_SUNPROC >= 0x5100) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#endif -+#endif -+#if defined(__lzo_forceinline) -+# ifndef __lzo_HAVE_forceinline -+# define __lzo_HAVE_forceinline 1 -+# endif -+#else -+# define __lzo_forceinline __lzo_inline -+#endif -+#if !defined(__lzo_noinline) -+#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -+# define __lzo_noinline __attribute__((__noinline__,__used__)) -+#elif (LZO_CC_GNUC >= 0x030200ul) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) -+# define __lzo_noinline __declspec(noinline) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_noinline __declspec(noinline) -+#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -+# if defined(__cplusplus) -+# else -+# define __lzo_noinline __declspec(noinline) -+# endif -+#elif (LZO_CC_PGI >= 0x0d0a00ul) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_SUNPROC >= 0x5100) -+# define __lzo_noinline __attribute__((__noinline__)) -+#endif -+#endif -+#if defined(__lzo_noinline) -+# ifndef __lzo_HAVE_noinline -+# define __lzo_HAVE_noinline 1 -+# endif -+#else -+# define __lzo_noinline /*empty*/ -+#endif -+#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if !defined(__lzo_static_inline) -+#if (LZO_CC_IBMC) -+# define __lzo_static_inline __lzo_gnuc_extension__ static __lzo_inline -+#endif -+#endif -+#if !defined(__lzo_static_inline) -+# define __lzo_static_inline static __lzo_inline -+#endif -+#if !defined(__lzo_static_forceinline) -+#if (LZO_CC_IBMC) -+# define __lzo_static_forceinline __lzo_gnuc_extension__ static __lzo_forceinline -+#endif -+#endif -+#if !defined(__lzo_static_forceinline) -+# define __lzo_static_forceinline static __lzo_forceinline -+#endif -+#if !defined(__lzo_static_noinline) -+#if (LZO_CC_IBMC) -+# define __lzo_static_noinline __lzo_gnuc_extension__ static __lzo_noinline -+#endif -+#endif -+#if !defined(__lzo_static_noinline) -+# define __lzo_static_noinline static __lzo_noinline -+#endif -+#if !defined(__lzo_c99_extern_inline) -+#if defined(__GNUC_GNU_INLINE__) -+# define __lzo_c99_extern_inline __lzo_inline -+#elif defined(__GNUC_STDC_INLINE__) -+# define __lzo_c99_extern_inline extern __lzo_inline -+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) -+# define __lzo_c99_extern_inline extern __lzo_inline -+#endif -+#if !defined(__lzo_c99_extern_inline) && (__lzo_HAVE_inline) -+# define __lzo_c99_extern_inline __lzo_inline -+#endif -+#endif -+#if defined(__lzo_c99_extern_inline) -+# ifndef __lzo_HAVE_c99_extern_inline -+# define __lzo_HAVE_c99_extern_inline 1 -+# endif -+#else -+# define __lzo_c99_extern_inline /*empty*/ -+#endif -+#if !defined(__lzo_may_alias) -+#if (LZO_CC_GNUC >= 0x030400ul) -+# define __lzo_may_alias __attribute__((__may_alias__)) -+#elif (LZO_CC_CLANG >= 0x020900ul) -+# define __lzo_may_alias __attribute__((__may_alias__)) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1210)) && 0 -+# define __lzo_may_alias __attribute__((__may_alias__)) -+#elif (LZO_CC_PGI >= 0x0d0a00ul) && 0 -+# define __lzo_may_alias __attribute__((__may_alias__)) -+#endif -+#endif -+#if defined(__lzo_may_alias) -+# ifndef __lzo_HAVE_may_alias -+# define __lzo_HAVE_may_alias 1 -+# endif -+#else -+# define __lzo_may_alias /*empty*/ -+#endif -+#if !defined(__lzo_noreturn) -+#if (LZO_CC_GNUC >= 0x020700ul) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) -+# define __lzo_noreturn __declspec(noreturn) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -+# define __lzo_noreturn __declspec(noreturn) -+#elif (LZO_CC_PGI >= 0x0d0a00ul) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#endif -+#endif -+#if defined(__lzo_noreturn) -+# ifndef __lzo_HAVE_noreturn -+# define __lzo_HAVE_noreturn 1 -+# endif -+#else -+# define __lzo_noreturn /*empty*/ -+#endif -+#if !defined(__lzo_nothrow) -+#if (LZO_CC_GNUC >= 0x030300ul) -+# define __lzo_nothrow __attribute__((__nothrow__)) -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) && defined(__cplusplus) -+# define __lzo_nothrow __declspec(nothrow) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 900)) -+# define __lzo_nothrow __attribute__((__nothrow__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_nothrow __attribute__((__nothrow__)) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -+# define __lzo_nothrow __declspec(nothrow) -+#endif -+#endif -+#if defined(__lzo_nothrow) -+# ifndef __lzo_HAVE_nothrow -+# define __lzo_HAVE_nothrow 1 -+# endif -+#else -+# define __lzo_nothrow /*empty*/ -+#endif -+#if !defined(__lzo_restrict) -+#if (LZO_CC_GNUC >= 0x030400ul) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_IBMC >= 800) && !defined(__cplusplus) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_IBMC >= 1210) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -+# define __lzo_restrict __restrict -+#elif (LZO_CC_PGI >= 0x0d0a00ul) -+# define __lzo_restrict __restrict__ -+#endif -+#endif -+#if defined(__lzo_restrict) -+# ifndef __lzo_HAVE_restrict -+# define __lzo_HAVE_restrict 1 -+# endif -+#else -+# define __lzo_restrict /*empty*/ -+#endif -+#if !defined(__lzo_alignof) -+#if (LZO_CC_ARMCC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -+# define __lzo_alignof(e) __alignof__(e) -+#elif (LZO_CC_GHS) && !defined(__cplusplus) -+# define __lzo_alignof(e) __alignof__(e) -+#elif (LZO_CC_IBMC >= 600) -+# define __lzo_alignof(e) (__lzo_gnuc_extension__ __alignof__(e)) -+#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -+# define __lzo_alignof(e) __alignof__(e) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_alignof(e) __alignof(e) -+#elif (LZO_CC_SUNPROC >= 0x5100) -+# define __lzo_alignof(e) __alignof__(e) -+#endif -+#endif -+#if defined(__lzo_alignof) -+# ifndef __lzo_HAVE_alignof -+# define __lzo_HAVE_alignof 1 -+# endif -+#endif -+#if !defined(__lzo_struct_packed) -+#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) -+#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) -+#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) -+#elif (LZO_CC_GNUC >= 0x030400ul) && !(LZO_CC_PCC_GNUC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -+# define __lzo_struct_packed(s) struct s { -+# define __lzo_struct_packed_end() } __attribute__((__gcc_struct__,__packed__)); -+# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__gcc_struct__,__packed__)); -+#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) -+# define __lzo_struct_packed(s) struct s { -+# define __lzo_struct_packed_end() } __attribute__((__packed__)); -+# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_struct_packed(s) __lzo_gnuc_extension__ struct s { -+# define __lzo_struct_packed_end() } __attribute__((__packed__)); -+# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); -+#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_struct_packed(s) __pragma(pack(push,1)) struct s { -+# define __lzo_struct_packed_end() } __pragma(pack(pop)); -+#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) -+# define __lzo_struct_packed(s) _Packed struct s { -+# define __lzo_struct_packed_end() }; -+#endif -+#endif -+#if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma) -+# define __lzo_struct_packed_ma(s) __lzo_struct_packed(s) -+#endif -+#if defined(__lzo_struct_packed_end) && !defined(__lzo_struct_packed_ma_end) -+# define __lzo_struct_packed_ma_end() __lzo_struct_packed_end() -+#endif -+#if !defined(__lzo_byte_struct) -+#if defined(__lzo_struct_packed) -+# define __lzo_byte_struct(s,n) __lzo_struct_packed(s) unsigned char a[n]; __lzo_struct_packed_end() -+# define __lzo_byte_struct_ma(s,n) __lzo_struct_packed_ma(s) unsigned char a[n]; __lzo_struct_packed_ma_end() -+#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_PGI || (LZO_CC_SUNPROC >= 0x5100)) -+# define __lzo_byte_struct(s,n) struct s { unsigned char a[n]; } __attribute__((__packed__)); -+# define __lzo_byte_struct_ma(s,n) struct s { unsigned char a[n]; } __lzo_may_alias __attribute__((__packed__)); -+#endif -+#endif -+#if defined(__lzo_byte_struct) && !defined(__lzo_byte_struct_ma) -+# define __lzo_byte_struct_ma(s,n) __lzo_byte_struct(s,n) -+#endif -+#if !defined(__lzo_struct_align16) && (__lzo_HAVE_alignof) -+#if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul)) -+#elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_CILLY || LZO_CC_PCC) -+#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_struct_align16(s) struct __declspec(align(16)) s { -+# define __lzo_struct_align16_end() }; -+# define __lzo_struct_align32(s) struct __declspec(align(32)) s { -+# define __lzo_struct_align32_end() }; -+# define __lzo_struct_align64(s) struct __declspec(align(64)) s { -+# define __lzo_struct_align64_end() }; -+#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || (LZO_CC_IBMC >= 700) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_struct_align16(s) struct s { -+# define __lzo_struct_align16_end() } __attribute__((__aligned__(16))); -+# define __lzo_struct_align32(s) struct s { -+# define __lzo_struct_align32_end() } __attribute__((__aligned__(32))); -+# define __lzo_struct_align64(s) struct s { -+# define __lzo_struct_align64_end() } __attribute__((__aligned__(64))); -+#endif -+#endif -+#if !defined(__lzo_union_um) -+#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) -+#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER < 810)) -+#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) -+#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) -+#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) -+# define __lzo_union_am(s) union s { -+# define __lzo_union_am_end() } __lzo_may_alias; -+# define __lzo_union_um(s) union s { -+# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_union_am(s) __lzo_gnuc_extension__ union s { -+# define __lzo_union_am_end() } __lzo_may_alias; -+# define __lzo_union_um(s) __lzo_gnuc_extension__ union s { -+# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); -+#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_union_um(s) __pragma(pack(push,1)) union s { -+# define __lzo_union_um_end() } __pragma(pack(pop)); -+#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) -+# define __lzo_union_um(s) _Packed union s { -+# define __lzo_union_um_end() }; -+#endif -+#endif -+#if !defined(__lzo_union_am) -+# define __lzo_union_am(s) union s { -+# define __lzo_union_am_end() }; -+#endif -+#if !defined(__lzo_constructor) -+#if (LZO_CC_GNUC >= 0x030400ul) -+# define __lzo_constructor __attribute__((__constructor__,__used__)) -+#elif (LZO_CC_GNUC >= 0x020700ul) -+# define __lzo_constructor __attribute__((__constructor__)) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -+# define __lzo_constructor __attribute__((__constructor__,__used__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_constructor __attribute__((__constructor__)) -+#endif -+#endif -+#if defined(__lzo_constructor) -+# ifndef __lzo_HAVE_constructor -+# define __lzo_HAVE_constructor 1 -+# endif -+#endif -+#if !defined(__lzo_destructor) -+#if (LZO_CC_GNUC >= 0x030400ul) -+# define __lzo_destructor __attribute__((__destructor__,__used__)) -+#elif (LZO_CC_GNUC >= 0x020700ul) -+# define __lzo_destructor __attribute__((__destructor__)) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -+# define __lzo_destructor __attribute__((__destructor__,__used__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_destructor __attribute__((__destructor__)) -+#endif -+#endif -+#if defined(__lzo_destructor) -+# ifndef __lzo_HAVE_destructor -+# define __lzo_HAVE_destructor 1 -+# endif -+#endif -+#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -+#if (LZO_CC_GNUC >= 0x030200ul) -+# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -+# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -+#elif (LZO_CC_IBMC >= 1010) -+# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -+# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -+#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -+# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -+# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -+# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -+#endif -+#endif -+#if defined(__lzo_likely) -+# ifndef __lzo_HAVE_likely -+# define __lzo_HAVE_likely 1 -+# endif -+#else -+# define __lzo_likely(e) (e) -+#endif -+#if defined(__lzo_unlikely) -+# ifndef __lzo_HAVE_unlikely -+# define __lzo_HAVE_unlikely 1 -+# endif -+#else -+# define __lzo_unlikely(e) (e) -+#endif -+#if !defined(__lzo_static_unused_void_func) -+# if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -+# define __lzo_static_unused_void_func(f) static void __attribute__((__unused__)) f(void) -+# else -+# define __lzo_static_unused_void_func(f) static __lzo_inline void f(void) -+# endif -+#endif -+#if !defined(__lzo_loop_forever) -+# if (LZO_CC_IBMC) -+# define __lzo_loop_forever() LZO_BLOCK_BEGIN for (;;) { ; } LZO_BLOCK_END -+# else -+# define __lzo_loop_forever() do { ; } while __lzo_cte(1) -+# endif -+#endif -+#if !defined(__lzo_unreachable) -+#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul)) -+# define __lzo_unreachable() __builtin_unreachable(); -+#elif (LZO_CC_GNUC >= 0x040500ul) -+# define __lzo_unreachable() __builtin_unreachable(); -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1300)) && 1 -+# define __lzo_unreachable() __builtin_unreachable(); -+#endif -+#endif -+#if defined(__lzo_unreachable) -+# ifndef __lzo_HAVE_unreachable -+# define __lzo_HAVE_unreachable 1 -+# endif -+#else -+# if 0 -+# define __lzo_unreachable() ((void)0); -+# else -+# define __lzo_unreachable() __lzo_loop_forever(); -+# endif -+#endif -+#ifndef __LZO_CTA_NAME -+#if (LZO_CFG_USE_COUNTER) -+# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__) -+#else -+# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__LINE__) -+#endif -+#endif -+#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -+# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END -+# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1u-2*!(e)]; LZO_EXTERN_C_END -+# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END -+# elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020900ul)) && defined(__cplusplus) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN int __LZO_CTA_NAME(lzo_cta_f__)(int [1-2*!(e)]); LZO_EXTERN_C_END -+# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__)); LZO_EXTERN_C_END -+# else -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-2*!(e)]; LZO_EXTERN_C_END -+# endif -+#endif -+#if !defined(LZO_COMPILE_TIME_ASSERT) -+# if (LZO_CC_AZTECC) -+# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];} -+# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -+# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -+# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) -+# define LZO_COMPILE_TIME_ASSERT(e) {(void) (0/!!(e));} -+# elif (LZO_CC_GNUC >= 0x040700ul) && (LZO_CFG_USE_COUNTER) && defined(__cplusplus) -+# define LZO_COMPILE_TIME_ASSERT(e) {enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__));} -+# elif (LZO_CC_GNUC >= 0x040700ul) -+# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} -+# elif (LZO_CC_MSC && (_MSC_VER < 900)) -+# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -+# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -+# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -+# else -+# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];} -+# endif -+#endif -+LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1) -+#if defined(__cplusplus) -+extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) } -+#endif -+LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3) -+#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -+# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -+# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -+# define __lzo_cdecl __cdecl -+# define __lzo_cdecl_atexit /*empty*/ -+# define __lzo_cdecl_main __cdecl -+# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -+# define __lzo_cdecl_qsort __pascal -+# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -+# define __lzo_cdecl_qsort _stdcall -+# else -+# define __lzo_cdecl_qsort __cdecl -+# endif -+# elif (LZO_CC_WATCOMC) -+# define __lzo_cdecl __cdecl -+# else -+# define __lzo_cdecl __cdecl -+# define __lzo_cdecl_atexit __cdecl -+# define __lzo_cdecl_main __cdecl -+# define __lzo_cdecl_qsort __cdecl -+# endif -+# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -+# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -+# define __lzo_cdecl_sighandler __pascal -+# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -+# define __lzo_cdecl_sighandler _stdcall -+# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -+# define __lzo_cdecl_sighandler __clrcall -+# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -+# if defined(_DLL) -+# define __lzo_cdecl_sighandler _far _cdecl _loadds -+# elif defined(_MT) -+# define __lzo_cdecl_sighandler _far _cdecl -+# else -+# define __lzo_cdecl_sighandler _cdecl -+# endif -+# else -+# define __lzo_cdecl_sighandler __cdecl -+# endif -+#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -+# define __lzo_cdecl __cdecl -+#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -+# define __lzo_cdecl cdecl -+#endif -+#if !defined(__lzo_cdecl) -+# define __lzo_cdecl /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_atexit) -+# define __lzo_cdecl_atexit /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_main) -+# define __lzo_cdecl_main /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_qsort) -+# define __lzo_cdecl_qsort /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_sighandler) -+# define __lzo_cdecl_sighandler /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_va) -+# define __lzo_cdecl_va __lzo_cdecl -+#endif -+#if !(LZO_CFG_NO_WINDOWS_H) -+#if !defined(LZO_HAVE_WINDOWS_H) -+#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -+# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -+# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) -+# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -+# else -+# define LZO_HAVE_WINDOWS_H 1 -+# endif -+#endif -+#endif -+#endif -+#ifndef LZO_SIZEOF_SHORT - #if defined(SIZEOF_SHORT) - # define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -+#elif defined(__SIZEOF_SHORT__) -+# define LZO_SIZEOF_SHORT (__SIZEOF_SHORT__) - #endif -+#endif -+#ifndef LZO_SIZEOF_INT - #if defined(SIZEOF_INT) - # define LZO_SIZEOF_INT (SIZEOF_INT) -+#elif defined(__SIZEOF_INT__) -+# define LZO_SIZEOF_INT (__SIZEOF_INT__) - #endif -+#endif -+#ifndef LZO_SIZEOF_LONG - #if defined(SIZEOF_LONG) - # define LZO_SIZEOF_LONG (SIZEOF_LONG) -+#elif defined(__SIZEOF_LONG__) -+# define LZO_SIZEOF_LONG (__SIZEOF_LONG__) - #endif -+#endif -+#ifndef LZO_SIZEOF_LONG_LONG - #if defined(SIZEOF_LONG_LONG) - # define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -+#elif defined(__SIZEOF_LONG_LONG__) -+# define LZO_SIZEOF_LONG_LONG (__SIZEOF_LONG_LONG__) - #endif -+#endif -+#ifndef LZO_SIZEOF___INT16 - #if defined(SIZEOF___INT16) - # define LZO_SIZEOF___INT16 (SIZEOF___INT16) - #endif -+#endif -+#ifndef LZO_SIZEOF___INT32 - #if defined(SIZEOF___INT32) - # define LZO_SIZEOF___INT32 (SIZEOF___INT32) - #endif -+#endif -+#ifndef LZO_SIZEOF___INT64 - #if defined(SIZEOF___INT64) - # define LZO_SIZEOF___INT64 (SIZEOF___INT64) - #endif -+#endif -+#ifndef LZO_SIZEOF_VOID_P - #if defined(SIZEOF_VOID_P) - # define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -+#elif defined(__SIZEOF_POINTER__) -+# define LZO_SIZEOF_VOID_P (__SIZEOF_POINTER__) - #endif -+#endif -+#ifndef LZO_SIZEOF_SIZE_T - #if defined(SIZEOF_SIZE_T) - # define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -+#elif defined(__SIZEOF_SIZE_T__) -+# define LZO_SIZEOF_SIZE_T (__SIZEOF_SIZE_T__) - #endif -+#endif -+#ifndef LZO_SIZEOF_PTRDIFF_T - #if defined(SIZEOF_PTRDIFF_T) - # define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -+#elif defined(__SIZEOF_PTRDIFF_T__) -+# define LZO_SIZEOF_PTRDIFF_T (__SIZEOF_PTRDIFF_T__) -+#endif - #endif - #define __LZO_LSR(x,b) (((x)+0ul) >> (b)) - #if !defined(LZO_SIZEOF_SHORT) -@@ -1080,6 +2060,7 @@ extern "C" { - # error "LZO_SIZEOF_SHORT" - # endif - #endif -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SHORT == sizeof(short)) - #if !defined(LZO_SIZEOF_INT) - # if (LZO_ARCH_CRAY_PVP) - # define LZO_SIZEOF_INT 8 -@@ -1101,6 +2082,7 @@ extern "C" { - # error "LZO_SIZEOF_INT" - # endif - #endif -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_INT == sizeof(int)) - #if !defined(LZO_SIZEOF_LONG) - # if (ULONG_MAX == LZO_0xffffffffL) - # define LZO_SIZEOF_LONG 4 -@@ -1110,6 +2092,8 @@ extern "C" { - # define LZO_SIZEOF_LONG 2 - # elif (__LZO_LSR(ULONG_MAX,31) == 1) - # define LZO_SIZEOF_LONG 4 -+# elif (__LZO_LSR(ULONG_MAX,39) == 1) -+# define LZO_SIZEOF_LONG 5 - # elif (__LZO_LSR(ULONG_MAX,63) == 1) - # define LZO_SIZEOF_LONG 8 - # elif (__LZO_LSR(ULONG_MAX,127) == 1) -@@ -1118,11 +2102,12 @@ extern "C" { - # error "LZO_SIZEOF_LONG" - # endif - #endif -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long)) - #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) - #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) - # if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) - # if (LZO_CC_GNUC >= 0x030300ul) --# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) -+# if ((__LONG_MAX__-0) == (__LONG_LONG_MAX__-0)) - # define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG - # elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) - # define LZO_SIZEOF_LONG_LONG 4 -@@ -1136,7 +2121,7 @@ extern "C" { - #if (LZO_ARCH_I086 && LZO_CC_DMC) - #elif (LZO_CC_CILLY) && defined(__GNUC__) - # define LZO_SIZEOF_LONG_LONG 8 --#elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) - # define LZO_SIZEOF_LONG_LONG 8 - #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) - # define LZO_SIZEOF_LONG_LONG 8 -@@ -1158,11 +2143,13 @@ extern "C" { - # define LZO_SIZEOF___INT64 8 - #elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) - # define LZO_SIZEOF___INT64 8 --#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) -+#elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64)) -+# define LZO_SIZEOF_LONG_LONG 8 -+#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64)) - # define LZO_SIZEOF___INT64 8 - #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) - # define LZO_SIZEOF_LONG_LONG 8 --#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -+#elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64) - # define LZO_SIZEOF_LONG_LONG 8 - #elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) - #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -@@ -1175,87 +2162,127 @@ extern "C" { - # undef LZO_SIZEOF_LONG_LONG - # endif - #endif --#if (LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) -+#if (LZO_CFG_NO_LONG_LONG) -+# undef LZO_SIZEOF_LONG_LONG -+#elif defined(__NO_LONG_LONG) -+# undef LZO_SIZEOF_LONG_LONG -+#elif defined(_NO_LONGLONG) - # undef LZO_SIZEOF_LONG_LONG - #endif --#if !defined(LZO_SIZEOF_VOID_P) --#if (LZO_ARCH_I086) --# define __LZO_WORDSIZE 2 --# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) --# define LZO_SIZEOF_VOID_P 2 --# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) --# define LZO_SIZEOF_VOID_P 4 -+#if !defined(LZO_WORDSIZE) -+#if (LZO_ARCH_ALPHA) -+# define LZO_WORDSIZE 8 -+#elif (LZO_ARCH_AMD64) -+# define LZO_WORDSIZE 8 -+#elif (LZO_ARCH_AVR) -+# define LZO_WORDSIZE 1 -+#elif (LZO_ARCH_H8300) -+# if defined(__NORMAL_MODE__) -+# define LZO_WORDSIZE 4 -+# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -+# define LZO_WORDSIZE 4 - # else --# error "LZO_MM" -+# define LZO_WORDSIZE 2 - # endif --#elif (LZO_ARCH_AVR || LZO_ARCH_Z80) --# define __LZO_WORDSIZE 1 -+#elif (LZO_ARCH_I086) -+# define LZO_WORDSIZE 2 -+#elif (LZO_ARCH_IA64) -+# define LZO_WORDSIZE 8 -+#elif (LZO_ARCH_M16C) -+# define LZO_WORDSIZE 2 -+#elif (LZO_ARCH_SPU) -+# define LZO_WORDSIZE 4 -+#elif (LZO_ARCH_Z80) -+# define LZO_WORDSIZE 1 -+#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -+# define LZO_WORDSIZE 8 -+#elif (LZO_OS_OS400 || defined(__OS400__)) -+# define LZO_WORDSIZE 8 -+#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -+# define LZO_WORDSIZE 8 -+#endif -+#endif -+#if !defined(LZO_SIZEOF_VOID_P) -+#if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) -+# define LZO_SIZEOF_VOID_P 4 -+#elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) -+# define LZO_SIZEOF_VOID_P 8 -+#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) -+# define LZO_SIZEOF_VOID_P 8 -+#elif defined(__LP64__) || defined(__LP64) || defined(_LP64) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) -+# define LZO_SIZEOF_VOID_P 8 -+#elif (LZO_ARCH_AVR) - # define LZO_SIZEOF_VOID_P 2 - #elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) - # define LZO_SIZEOF_VOID_P 2 - #elif (LZO_ARCH_H8300) - # if defined(__NORMAL_MODE__) --# define __LZO_WORDSIZE 4 - # define LZO_SIZEOF_VOID_P 2 - # elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) --# define __LZO_WORDSIZE 4 - # define LZO_SIZEOF_VOID_P 4 - # else --# define __LZO_WORDSIZE 2 - # define LZO_SIZEOF_VOID_P 2 - # endif - # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) - # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT - # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT - # endif -+#elif (LZO_ARCH_I086) -+# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -+# define LZO_SIZEOF_VOID_P 2 -+# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -+# define LZO_SIZEOF_VOID_P 4 -+# else -+# error "invalid LZO_ARCH_I086 memory model" -+# endif - #elif (LZO_ARCH_M16C) --# define __LZO_WORDSIZE 2 - # if defined(__m32c_cpu__) || defined(__m32cm_cpu__) - # define LZO_SIZEOF_VOID_P 4 - # else - # define LZO_SIZEOF_VOID_P 2 - # endif -+#elif (LZO_ARCH_SPU) -+# define LZO_SIZEOF_VOID_P 4 -+#elif (LZO_ARCH_Z80) -+# define LZO_SIZEOF_VOID_P 2 - #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) --# define __LZO_WORDSIZE 8 - # define LZO_SIZEOF_VOID_P 4 --#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) --# define __LZO_WORDSIZE 8 --# define LZO_SIZEOF_VOID_P 8 --#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) --# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG --# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG --# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG - #elif (LZO_OS_OS400 || defined(__OS400__)) --# define __LZO_WORDSIZE LZO_SIZEOF_LONG --# define LZO_SIZEOF_VOID_P 16 --# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG --# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG --#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) --# define LZO_SIZEOF_VOID_P 8 --# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG --# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG --#elif (LZO_ARCH_SPU) --# if 0 --# define __LZO_WORDSIZE 16 --# endif --# define LZO_SIZEOF_VOID_P 4 --#else --# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG --#endif --#endif --#if !defined(LZO_WORDSIZE) --# if defined(__LZO_WORDSIZE) --# define LZO_WORDSIZE __LZO_WORDSIZE -+# if defined(__LLP64_IFC__) -+# define LZO_SIZEOF_VOID_P 8 -+# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -+# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG - # else --# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -+# define LZO_SIZEOF_VOID_P 16 -+# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -+# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG - # endif -+#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -+# define LZO_SIZEOF_VOID_P 8 -+# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -+# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG - #endif -+#endif -+#if !defined(LZO_SIZEOF_VOID_P) -+# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -+#endif -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *)) - #if !defined(LZO_SIZEOF_SIZE_T) - #if (LZO_ARCH_I086 || LZO_ARCH_M16C) - # define LZO_SIZEOF_SIZE_T 2 --#else -+#endif -+#endif -+#if !defined(LZO_SIZEOF_SIZE_T) - # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P - #endif -+#if defined(offsetof) -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SIZE_T == sizeof(size_t)) - #endif - #if !defined(LZO_SIZEOF_PTRDIFF_T) - #if (LZO_ARCH_I086) -@@ -1268,11 +2295,18 @@ extern "C" { - # define LZO_SIZEOF_PTRDIFF_T 2 - # endif - # else --# error "LZO_MM" -+# error "invalid LZO_ARCH_I086 memory model" - # endif --#else -+#endif -+#endif -+#if !defined(LZO_SIZEOF_PTRDIFF_T) - # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T - #endif -+#if defined(offsetof) -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t)) -+#endif -+#if !defined(LZO_WORDSIZE) -+# define LZO_WORDSIZE LZO_SIZEOF_VOID_P - #endif - #if (LZO_ABI_NEUTRAL_ENDIAN) - # undef LZO_ABI_BIG_ENDIAN -@@ -1284,7 +2318,7 @@ extern "C" { - # define LZO_ABI_LITTLE_ENDIAN 1 - #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) - # define LZO_ABI_LITTLE_ENDIAN 1 --#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390) -+#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU) - # define LZO_ABI_BIG_ENDIAN 1 - #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) - # if (__LITTLE_ENDIAN__ == 1) -@@ -1300,6 +2334,19 @@ extern "C" { - # define LZO_ABI_BIG_ENDIAN 1 - #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) - # define LZO_ABI_LITTLE_ENDIAN 1 -+#elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC) -+# if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) -+# error "unexpected configuration - check your compiler defines" -+# elif defined(__BIG_ENDIAN) -+# define LZO_ABI_BIG_ENDIAN 1 -+# else -+# define LZO_ABI_LITTLE_ENDIAN 1 -+# endif -+# define LZO_ABI_LITTLE_ENDIAN 1 -+#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__) -+# define LZO_ABI_BIG_ENDIAN 1 -+#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__) -+# define LZO_ABI_LITTLE_ENDIAN 1 - #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) - # define LZO_ABI_BIG_ENDIAN 1 - #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -@@ -1307,7 +2354,7 @@ extern "C" { - #endif - #endif - #if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - #endif - #if (LZO_ABI_BIG_ENDIAN) - # define LZO_INFO_ABI_ENDIAN "be" -@@ -1322,6 +2369,9 @@ extern "C" { - #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) - # define LZO_ABI_ILP16 1 - # define LZO_INFO_ABI_PM "ilp16" -+#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -+# define LZO_ABI_LP32 1 -+# define LZO_INFO_ABI_PM "lp32" - #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) - # define LZO_ABI_ILP32 1 - # define LZO_INFO_ABI_PM "ilp32" -@@ -1338,7 +2388,8 @@ extern "C" { - # define LZO_ABI_IP32L64 1 - # define LZO_INFO_ABI_PM "ip32l64" - #endif --#if !defined(__LZO_LIBC_OVERRIDE) -+#if 0 -+#elif !defined(__LZO_LIBC_OVERRIDE) - #if (LZO_LIBC_NAKED) - # define LZO_INFO_LIBC "naked" - #elif (LZO_LIBC_FREESTANDING) -@@ -1349,6 +2400,9 @@ extern "C" { - # define LZO_INFO_LIBC "isoc90" - #elif (LZO_LIBC_ISOC99) - # define LZO_INFO_LIBC "isoc99" -+#elif (LZO_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION) -+# define LZO_LIBC_ISOC90 1 -+# define LZO_INFO_LIBC "isoc90" - #elif defined(__dietlibc__) - # define LZO_LIBC_DIETLIBC 1 - # define LZO_INFO_LIBC "dietlibc" -@@ -1357,13 +2411,13 @@ extern "C" { - # define LZO_INFO_LIBC "newlib" - #elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) - # if defined(__UCLIBC_SUBLEVEL__) --# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) -+# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__-0) * 0x100 + (__UCLIBC_SUBLEVEL__-0)) - # else - # define LZO_LIBC_UCLIBC 0x00090bL - # endif --# define LZO_INFO_LIBC "uclibc" -+# define LZO_INFO_LIBC "uc" "libc" - #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) --# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) -+# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__-0) * 0x100) - # define LZO_INFO_LIBC "glibc" - #elif (LZO_CC_MWERKS) && defined(__MSL__) - # define LZO_LIBC_MSL __MSL__ -@@ -1376,423 +2430,159 @@ extern "C" { - # define LZO_INFO_LIBC "default" - #endif - #endif --#if !defined(__lzo_gnuc_extension__) --#if (LZO_CC_GNUC >= 0x020800ul) --# define __lzo_gnuc_extension__ __extension__ --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_gnuc_extension__ __extension__ --#else --# define __lzo_gnuc_extension__ /*empty*/ --#endif --#endif --#if !defined(__lzo_ua_volatile) --# define __lzo_ua_volatile volatile --#endif --#if !defined(__lzo_alignof) --#if (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) --# define __lzo_alignof(e) __alignof__(e) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) --# define __lzo_alignof(e) __alignof__(e) --#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) --# define __lzo_alignof(e) __alignof(e) --#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) --# define __lzo_alignof(e) __alignof__(e) --#endif --#endif --#if defined(__lzo_alignof) --# define __lzo_HAVE_alignof 1 --#endif --#if !defined(__lzo_constructor) --#if (LZO_CC_GNUC >= 0x030400ul) --# define __lzo_constructor __attribute__((__constructor__,__used__)) --#elif (LZO_CC_GNUC >= 0x020700ul) --# define __lzo_constructor __attribute__((__constructor__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_constructor __attribute__((__constructor__)) --#endif --#endif --#if defined(__lzo_constructor) --# define __lzo_HAVE_constructor 1 --#endif --#if !defined(__lzo_destructor) --#if (LZO_CC_GNUC >= 0x030400ul) --# define __lzo_destructor __attribute__((__destructor__,__used__)) --#elif (LZO_CC_GNUC >= 0x020700ul) --# define __lzo_destructor __attribute__((__destructor__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_destructor __attribute__((__destructor__)) --#endif --#endif --#if defined(__lzo_destructor) --# define __lzo_HAVE_destructor 1 --#endif --#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) --# error "this should not happen" --#endif --#if !defined(__lzo_inline) --#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) --#elif defined(__cplusplus) --# define __lzo_inline inline --#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) --# define __lzo_inline __inline --#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) --# define __lzo_inline __inline__ --#elif (LZO_CC_DMC) --# define __lzo_inline __inline --#elif (LZO_CC_INTELC) --# define __lzo_inline __inline --#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) --# define __lzo_inline __inline --#elif (LZO_CC_MSC && (_MSC_VER >= 900)) --# define __lzo_inline __inline --#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) --# define __lzo_inline __inline__ --#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) --# define __lzo_inline inline --#endif --#endif --#if defined(__lzo_inline) --# define __lzo_HAVE_inline 1 --#else --# define __lzo_inline /*empty*/ --#endif --#if !defined(__lzo_forceinline) --#if (LZO_CC_GNUC >= 0x030200ul) --# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) --# define __lzo_forceinline __forceinline --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) --# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) --#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) --# define __lzo_forceinline __forceinline --#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) --# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) --#endif --#endif --#if defined(__lzo_forceinline) --# define __lzo_HAVE_forceinline 1 --#else --# define __lzo_forceinline /*empty*/ --#endif --#if !defined(__lzo_noinline) --#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) --# define __lzo_noinline __attribute__((__noinline__,__used__)) --#elif (LZO_CC_GNUC >= 0x030200ul) --# define __lzo_noinline __attribute__((__noinline__)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) --# define __lzo_noinline __declspec(noinline) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) --# define __lzo_noinline __attribute__((__noinline__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_noinline __attribute__((__noinline__)) --#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) --# define __lzo_noinline __declspec(noinline) --#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) --# if defined(__cplusplus) --# else --# define __lzo_noinline __declspec(noinline) --# endif --#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) --# define __lzo_noinline __attribute__((__noinline__)) --#endif --#endif --#if defined(__lzo_noinline) --# define __lzo_HAVE_noinline 1 --#else --# define __lzo_noinline /*empty*/ --#endif --#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) --# error "this should not happen" --#endif --#if !defined(__lzo_noreturn) --#if (LZO_CC_GNUC >= 0x020700ul) --# define __lzo_noreturn __attribute__((__noreturn__)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) --# define __lzo_noreturn __declspec(noreturn) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) --# define __lzo_noreturn __attribute__((__noreturn__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_noreturn __attribute__((__noreturn__)) --#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) --# define __lzo_noreturn __declspec(noreturn) --#endif --#endif --#if defined(__lzo_noreturn) --# define __lzo_HAVE_noreturn 1 --#else --# define __lzo_noreturn /*empty*/ --#endif --#if !defined(__lzo_nothrow) --#if (LZO_CC_GNUC >= 0x030300ul) --# define __lzo_nothrow __attribute__((__nothrow__)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) --# define __lzo_nothrow __declspec(nothrow) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 900) && LZO_CC_SYNTAX_GNUC) --# define __lzo_nothrow __attribute__((__nothrow__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_nothrow __attribute__((__nothrow__)) --#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) --# define __lzo_nothrow __declspec(nothrow) --#endif --#endif --#if defined(__lzo_nothrow) --# define __lzo_HAVE_nothrow 1 --#else --# define __lzo_nothrow /*empty*/ --#endif --#if !defined(__lzo_restrict) --#if (LZO_CC_GNUC >= 0x030400ul) --# define __lzo_restrict __restrict__ --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) --# define __lzo_restrict __restrict__ --#elif (LZO_CC_CLANG || LZO_CC_LLVM) --# define __lzo_restrict __restrict__ --#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) --# define __lzo_restrict __restrict --#endif --#endif --#if defined(__lzo_restrict) --# define __lzo_HAVE_restrict 1 --#else --# define __lzo_restrict /*empty*/ --#endif --#if !defined(__lzo_likely) && !defined(__lzo_unlikely) --#if (LZO_CC_GNUC >= 0x030200ul) --# define __lzo_likely(e) (__builtin_expect(!!(e),1)) --# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) --# define __lzo_likely(e) (__builtin_expect(!!(e),1)) --# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_likely(e) (__builtin_expect(!!(e),1)) --# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) --#endif --#endif --#if defined(__lzo_likely) --# define __lzo_HAVE_likely 1 --#else --# define __lzo_likely(e) (e) --#endif --#if defined(__lzo_unlikely) --# define __lzo_HAVE_unlikely 1 --#else --# define __lzo_unlikely(e) (e) --#endif --#if !defined(LZO_UNUSED) --# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) --# define LZO_UNUSED(var) ((void) &var) --# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) --# define LZO_UNUSED(var) if (&var) ; else --# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define LZO_UNUSED(var) ((void) var) --# elif (LZO_CC_MSC && (_MSC_VER < 900)) --# define LZO_UNUSED(var) if (&var) ; else --# elif (LZO_CC_KEILC) --# define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} --# elif (LZO_CC_PACIFICC) --# define LZO_UNUSED(var) ((void) sizeof(var)) --# elif (LZO_CC_WATCOMC) && defined(__cplusplus) --# define LZO_UNUSED(var) ((void) var) --# else --# define LZO_UNUSED(var) ((void) &var) --# endif --#endif --#if !defined(LZO_UNUSED_FUNC) --# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) --# define LZO_UNUSED_FUNC(func) ((void) func) --# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) --# define LZO_UNUSED_FUNC(func) if (func) ; else --# elif (LZO_CC_CLANG || LZO_CC_LLVM) --# define LZO_UNUSED_FUNC(func) ((void) &func) --# elif (LZO_CC_MSC && (_MSC_VER < 900)) --# define LZO_UNUSED_FUNC(func) if (func) ; else --# elif (LZO_CC_MSC) --# define LZO_UNUSED_FUNC(func) ((void) &func) --# elif (LZO_CC_KEILC || LZO_CC_PELLESC) --# define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} --# else --# define LZO_UNUSED_FUNC(func) ((void) func) --# endif --#endif --#if !defined(LZO_UNUSED_LABEL) --# if (LZO_CC_WATCOMC) && defined(__cplusplus) --# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l --# elif (LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) --# define LZO_UNUSED_LABEL(l) if (0) goto l --# else --# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l --# endif --#endif --#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) --# if 0 --# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var --# elif 0 && (LZO_CC_GNUC) --# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var --# else --# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init --# endif --#endif --#if !defined(LZO_UNCONST_CAST) --# if 0 && defined(__cplusplus) --# define LZO_UNCONST_CAST(t,e) (const_cast (e)) --# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((lzo_uintptr_t) ((const void *) (e)))))) --# else --# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((const void *) (e))))) --# endif --#endif --#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) --# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) --# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; --# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) --# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; --# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) --# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; --# else --# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; --# endif --#endif --#if !defined(LZO_COMPILE_TIME_ASSERT) --# if (LZO_CC_AZTECC) --# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} --# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) --# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; --# elif (LZO_CC_MSC && (_MSC_VER < 900)) --# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; --# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) --# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; --# else --# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} --# endif --#endif --#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) --# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) --# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) --# define __lzo_cdecl __cdecl --# define __lzo_cdecl_atexit /*empty*/ --# define __lzo_cdecl_main __cdecl --# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) --# define __lzo_cdecl_qsort __pascal --# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) --# define __lzo_cdecl_qsort _stdcall --# else --# define __lzo_cdecl_qsort __cdecl --# endif --# elif (LZO_CC_WATCOMC) --# define __lzo_cdecl __cdecl --# else --# define __lzo_cdecl __cdecl --# define __lzo_cdecl_atexit __cdecl --# define __lzo_cdecl_main __cdecl --# define __lzo_cdecl_qsort __cdecl --# endif --# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) --# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) --# define __lzo_cdecl_sighandler __pascal --# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) --# define __lzo_cdecl_sighandler _stdcall --# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) --# define __lzo_cdecl_sighandler __clrcall --# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) --# if defined(_DLL) --# define __lzo_cdecl_sighandler _far _cdecl _loadds --# elif defined(_MT) --# define __lzo_cdecl_sighandler _far _cdecl --# else --# define __lzo_cdecl_sighandler _cdecl --# endif --# else --# define __lzo_cdecl_sighandler __cdecl --# endif --#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) --# define __lzo_cdecl __cdecl --#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) --# define __lzo_cdecl cdecl --#endif --#if !defined(__lzo_cdecl) --# define __lzo_cdecl /*empty*/ --#endif --#if !defined(__lzo_cdecl_atexit) --# define __lzo_cdecl_atexit /*empty*/ --#endif --#if !defined(__lzo_cdecl_main) --# define __lzo_cdecl_main /*empty*/ --#endif --#if !defined(__lzo_cdecl_qsort) --# define __lzo_cdecl_qsort /*empty*/ --#endif --#if !defined(__lzo_cdecl_sighandler) --# define __lzo_cdecl_sighandler /*empty*/ --#endif --#if !defined(__lzo_cdecl_va) --# define __lzo_cdecl_va __lzo_cdecl --#endif --#if !(LZO_CFG_NO_WINDOWS_H) --#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) --# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) --# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) --# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) --# else --# define LZO_HAVE_WINDOWS_H 1 --# endif -+#if (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -+# define LZO_ASM_SYNTAX_MSC 1 -+#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -+#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) -+#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -+# define LZO_ASM_SYNTAX_GNUC 1 -+#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -+# define LZO_ASM_SYNTAX_GNUC 1 -+#elif (LZO_CC_GNUC) -+# define LZO_ASM_SYNTAX_GNUC 1 -+#endif -+#if (LZO_ASM_SYNTAX_GNUC) -+#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -+# define __LZO_ASM_CLOBBER "ax" -+# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ -+# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY /*empty*/ -+# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -+#elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1000)) -+# define __LZO_ASM_CLOBBER "memory" -+# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ -+# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "memory" -+# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -+#else -+# define __LZO_ASM_CLOBBER "cc", "memory" -+# define __LZO_ASM_CLOBBER_LIST_CC : "cc" -+# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "cc", "memory" -+# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ - #endif - #endif - #if (LZO_ARCH_ALPHA) --# define LZO_OPT_AVOID_UINT_INDEX 1 --# define LZO_OPT_AVOID_SHORT 1 --# define LZO_OPT_AVOID_USHORT 1 -+# define LZO_OPT_AVOID_UINT_INDEX 1 - #elif (LZO_ARCH_AMD64) --# define LZO_OPT_AVOID_INT_INDEX 1 --# define LZO_OPT_AVOID_UINT_INDEX 1 --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 --# define LZO_OPT_UNALIGNED64 1 --#elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) -+# define LZO_OPT_AVOID_INT_INDEX 1 -+# define LZO_OPT_AVOID_UINT_INDEX 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED64 -+# define LZO_OPT_UNALIGNED64 1 -+# endif - #elif (LZO_ARCH_ARM) --# define LZO_OPT_AVOID_SHORT 1 --# define LZO_OPT_AVOID_USHORT 1 -+# if defined(__ARM_FEATURE_UNALIGNED) -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# elif defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM+0) >= 7) -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# elif defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM+0) >= 6) && !defined(__TARGET_PROFILE_M) -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# endif -+#elif (LZO_ARCH_ARM64) -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED64 -+# define LZO_OPT_UNALIGNED64 1 -+# endif - #elif (LZO_ARCH_CRIS) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif - #elif (LZO_ARCH_I386) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif - #elif (LZO_ARCH_IA64) --# define LZO_OPT_AVOID_INT_INDEX 1 --# define LZO_OPT_AVOID_UINT_INDEX 1 --# define LZO_OPT_PREFER_POSTINC 1 -+# define LZO_OPT_AVOID_INT_INDEX 1 -+# define LZO_OPT_AVOID_UINT_INDEX 1 -+# define LZO_OPT_PREFER_POSTINC 1 - #elif (LZO_ARCH_M68K) --# define LZO_OPT_PREFER_POSTINC 1 --# define LZO_OPT_PREFER_PREDEC 1 -+# define LZO_OPT_PREFER_POSTINC 1 -+# define LZO_OPT_PREFER_PREDEC 1 - # if defined(__mc68020__) && !defined(__mcoldfire__) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif - # endif - #elif (LZO_ARCH_MIPS) --# define LZO_OPT_AVOID_UINT_INDEX 1 -+# define LZO_OPT_AVOID_UINT_INDEX 1 - #elif (LZO_ARCH_POWERPC) --# define LZO_OPT_PREFER_PREINC 1 --# define LZO_OPT_PREFER_PREDEC 1 -+# define LZO_OPT_PREFER_PREINC 1 -+# define LZO_OPT_PREFER_PREDEC 1 - # if (LZO_ABI_BIG_ENDIAN) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# if (LZO_WORDSIZE == 8) -+# ifndef LZO_OPT_UNALIGNED64 -+# define LZO_OPT_UNALIGNED64 1 -+# endif -+# endif - # endif - #elif (LZO_ARCH_S390) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 --# if (LZO_SIZEOF_SIZE_T == 8) --# define LZO_OPT_UNALIGNED64 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# if (LZO_WORDSIZE == 8) -+# ifndef LZO_OPT_UNALIGNED64 -+# define LZO_OPT_UNALIGNED64 1 -+# endif - # endif - #elif (LZO_ARCH_SH) --# define LZO_OPT_PREFER_POSTINC 1 --# define LZO_OPT_PREFER_PREDEC 1 -+# define LZO_OPT_PREFER_POSTINC 1 -+# define LZO_OPT_PREFER_PREDEC 1 - #endif - #ifndef LZO_CFG_NO_INLINE_ASM --#if (LZO_CC_LLVM) -+#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) - # define LZO_CFG_NO_INLINE_ASM 1 -+#elif (LZO_CC_LLVM) -+# define LZO_CFG_NO_INLINE_ASM 1 -+#endif - #endif -+#if (LZO_CFG_NO_INLINE_ASM) -+# undef LZO_ASM_SYNTAX_MSC -+# undef LZO_ASM_SYNTAX_GNUC -+# undef __LZO_ASM_CLOBBER -+# undef __LZO_ASM_CLOBBER_LIST_CC -+# undef __LZO_ASM_CLOBBER_LIST_CC_MEMORY -+# undef __LZO_ASM_CLOBBER_LIST_EMPTY - #endif - #ifndef LZO_CFG_NO_UNALIGNED - #if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) -@@ -1804,25 +2594,6 @@ extern "C" { - # undef LZO_OPT_UNALIGNED32 - # undef LZO_OPT_UNALIGNED64 - #endif --#if (LZO_CFG_NO_INLINE_ASM) --#elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) --# define LZO_ASM_SYNTAX_MSC 1 --#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) --#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) --#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) --# define LZO_ASM_SYNTAX_GNUC 1 --#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) --# define LZO_ASM_SYNTAX_GNUC 1 --#endif --#if (LZO_ASM_SYNTAX_GNUC) --#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) --# define __LZO_ASM_CLOBBER "ax" --#elif (LZO_CC_INTELC) --# define __LZO_ASM_CLOBBER "memory" --#else --# define __LZO_ASM_CLOBBER "cc", "memory" --#endif --#endif - #if defined(__LZO_INFOSTR_MM) - #elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) - # define __LZO_INFOSTR_MM "" -@@ -1866,6 +2637,381 @@ extern "C" { - #define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER -+#if !(LZO_CFG_SKIP_LZO_TYPES) -+#if (!(LZO_SIZEOF_SHORT+0 > 0 && LZO_SIZEOF_INT+0 > 0 && LZO_SIZEOF_LONG+0 > 0)) -+# error "missing defines for sizes" -+#endif -+#if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0)) -+# error "missing defines for sizes" -+#endif -+#if !defined(lzo_llong_t) -+#if (LZO_SIZEOF_LONG_LONG+0 > 0) -+__lzo_gnuc_extension__ typedef long long lzo_llong_t__; -+__lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__; -+# define lzo_llong_t lzo_llong_t__ -+# define lzo_ullong_t lzo_ullong_t__ -+#endif -+#endif -+#if !defined(lzo_int16e_t) -+#if (LZO_SIZEOF_LONG == 2) -+# define lzo_int16e_t long -+# define lzo_uint16e_t unsigned long -+#elif (LZO_SIZEOF_INT == 2) -+# define lzo_int16e_t int -+# define lzo_uint16e_t unsigned int -+#elif (LZO_SIZEOF_SHORT == 2) -+# define lzo_int16e_t short int -+# define lzo_uint16e_t unsigned short int -+#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) -+ typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__))); -+ typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__))); -+# define lzo_int16e_t lzo_int16e_hi_t__ -+# define lzo_uint16e_t lzo_uint16e_hi_t__ -+#elif (LZO_SIZEOF___INT16 == 2) -+# define lzo_int16e_t __int16 -+# define lzo_uint16e_t unsigned __int16 -+#else -+#endif -+#endif -+#if defined(lzo_int16e_t) -+# define LZO_SIZEOF_LZO_INT16E_T 2 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T) -+#endif -+#if !defined(lzo_int32e_t) -+#if (LZO_SIZEOF_LONG == 4) -+# define lzo_int32e_t long int -+# define lzo_uint32e_t unsigned long int -+#elif (LZO_SIZEOF_INT == 4) -+# define lzo_int32e_t int -+# define lzo_uint32e_t unsigned int -+#elif (LZO_SIZEOF_SHORT == 4) -+# define lzo_int32e_t short int -+# define lzo_uint32e_t unsigned short int -+#elif (LZO_SIZEOF_LONG_LONG == 4) -+# define lzo_int32e_t lzo_llong_t -+# define lzo_uint32e_t lzo_ullong_t -+#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L) -+ typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); -+ typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); -+# define lzo_int32e_t lzo_int32e_si_t__ -+# define lzo_uint32e_t lzo_uint32e_si_t__ -+#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L) -+ typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); -+ typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); -+# define lzo_int32e_t lzo_int32e_si_t__ -+# define lzo_uint32e_t lzo_uint32e_si_t__ -+# define LZO_INT32_C(c) (c##LL) -+# define LZO_UINT32_C(c) (c##ULL) -+#elif (LZO_SIZEOF___INT32 == 4) -+# define lzo_int32e_t __int32 -+# define lzo_uint32e_t unsigned __int32 -+#else -+#endif -+#endif -+#if defined(lzo_int32e_t) -+# define LZO_SIZEOF_LZO_INT32E_T 4 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T) -+#endif -+#if !defined(lzo_int64e_t) -+#if (LZO_SIZEOF___INT64 == 8) -+# if (LZO_CC_BORLANDC) && !(LZO_CFG_TYPE_PREFER___INT64) -+# define LZO_CFG_TYPE_PREFER___INT64 1 -+# endif -+#endif -+#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -+# define lzo_int64e_t int -+# define lzo_uint64e_t unsigned int -+# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_INT -+#elif (LZO_SIZEOF_LONG == 8) -+# define lzo_int64e_t long int -+# define lzo_uint64e_t unsigned long int -+# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_LONG -+#elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_TYPE_PREFER___INT64) -+# define lzo_int64e_t lzo_llong_t -+# define lzo_uint64e_t lzo_ullong_t -+# if (LZO_CC_BORLANDC) -+# define LZO_INT64_C(c) ((c) + 0ll) -+# define LZO_UINT64_C(c) ((c) + 0ull) -+# elif 0 -+# define LZO_INT64_C(c) (__lzo_gnuc_extension__ (c##LL)) -+# define LZO_UINT64_C(c) (__lzo_gnuc_extension__ (c##ULL)) -+# else -+# define LZO_INT64_C(c) (c##LL) -+# define LZO_UINT64_C(c) (c##ULL) -+# endif -+# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_LONG_LONG -+#elif (LZO_SIZEOF___INT64 == 8) -+# define lzo_int64e_t __int64 -+# define lzo_uint64e_t unsigned __int64 -+# if (LZO_CC_BORLANDC) -+# define LZO_INT64_C(c) ((c) + 0i64) -+# define LZO_UINT64_C(c) ((c) + 0ui64) -+# else -+# define LZO_INT64_C(c) (c##i64) -+# define LZO_UINT64_C(c) (c##ui64) -+# endif -+# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF___INT64 -+#else -+#endif -+#endif -+#if defined(lzo_int64e_t) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T) -+#endif -+#if !defined(lzo_int32l_t) -+#if defined(lzo_int32e_t) -+# define lzo_int32l_t lzo_int32e_t -+# define lzo_uint32l_t lzo_uint32e_t -+# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T -+#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -+# define lzo_int32l_t int -+# define lzo_uint32l_t unsigned int -+# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT -+#elif (LZO_SIZEOF_LONG >= 4) -+# define lzo_int32l_t long int -+# define lzo_uint32l_t unsigned long int -+# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG -+#else -+# error "lzo_int32l_t" -+#endif -+#endif -+#if 1 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T) -+#endif -+#if !defined(lzo_int64l_t) -+#if defined(lzo_int64e_t) -+# define lzo_int64l_t lzo_int64e_t -+# define lzo_uint64l_t lzo_uint64e_t -+# define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T -+#else -+#endif -+#endif -+#if defined(lzo_int64l_t) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T) -+#endif -+#if !defined(lzo_int32f_t) -+#if (LZO_SIZEOF_SIZE_T >= 8) -+# define lzo_int32f_t lzo_int64l_t -+# define lzo_uint32f_t lzo_uint64l_t -+# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T -+#else -+# define lzo_int32f_t lzo_int32l_t -+# define lzo_uint32f_t lzo_uint32l_t -+# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T -+#endif -+#endif -+#if 1 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T) -+#endif -+#if !defined(lzo_int64f_t) -+#if defined(lzo_int64l_t) -+# define lzo_int64f_t lzo_int64l_t -+# define lzo_uint64f_t lzo_uint64l_t -+# define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T -+#else -+#endif -+#endif -+#if defined(lzo_int64f_t) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T) -+#endif -+#if !defined(lzo_intptr_t) -+#if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16)) -+# define __LZO_INTPTR_T_IS_POINTER 1 -+ typedef char* lzo_intptr_t; -+ typedef char* lzo_uintptr_t; -+# define lzo_intptr_t lzo_intptr_t -+# define lzo_uintptr_t lzo_uintptr_t -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P -+#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4)) -+ typedef __w64 int lzo_intptr_t; -+ typedef __w64 unsigned int lzo_uintptr_t; -+# define lzo_intptr_t lzo_intptr_t -+# define lzo_uintptr_t lzo_uintptr_t -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT -+#elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P) -+# define lzo_intptr_t short -+# define lzo_uintptr_t unsigned short -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT -+#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -+# define lzo_intptr_t int -+# define lzo_uintptr_t unsigned int -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT -+#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P) -+# define lzo_intptr_t long -+# define lzo_uintptr_t unsigned long -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG -+#elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P) -+# define lzo_intptr_t lzo_int64l_t -+# define lzo_uintptr_t lzo_uint64l_t -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T -+#else -+# error "lzo_intptr_t" -+#endif -+#endif -+#if 1 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *)) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t)) -+#endif -+#if !defined(lzo_word_t) -+#if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0) -+#if (LZO_WORDSIZE == LZO_SIZEOF_LZO_INTPTR_T) && !(__LZO_INTPTR_T_IS_POINTER) -+# define lzo_word_t lzo_uintptr_t -+# define lzo_sword_t lzo_intptr_t -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T -+#elif (LZO_WORDSIZE == LZO_SIZEOF_LONG) -+# define lzo_word_t unsigned long -+# define lzo_sword_t long -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG -+#elif (LZO_WORDSIZE == LZO_SIZEOF_INT) -+# define lzo_word_t unsigned int -+# define lzo_sword_t int -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT -+#elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT) -+# define lzo_word_t unsigned short -+# define lzo_sword_t short -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT -+#elif (LZO_WORDSIZE == 1) -+# define lzo_word_t unsigned char -+# define lzo_sword_t signed char -+# define LZO_SIZEOF_LZO_WORD_T 1 -+#elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T) -+# define lzo_word_t lzo_uint64l_t -+# define lzo_sword_t lzo_int64l_t -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T -+#elif (LZO_ARCH_SPU) && (LZO_CC_GNUC) -+#if 0 -+ typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__))); -+ typedef int lzo_sword_t __attribute__((__mode__(__V16QI__))); -+# define lzo_word_t lzo_word_t -+# define lzo_sword_t lzo_sword_t -+# define LZO_SIZEOF_LZO_WORD_T 16 -+#endif -+#else -+# error "lzo_word_t" -+#endif -+#endif -+#endif -+#if 1 && defined(lzo_word_t) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE) -+#endif -+#if 1 -+#define lzo_int8_t signed char -+#define lzo_uint8_t unsigned char -+#define LZO_SIZEOF_LZO_INT8_T 1 -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t)) -+#endif -+#if defined(lzo_int16e_t) -+#define lzo_int16_t lzo_int16e_t -+#define lzo_uint16_t lzo_uint16e_t -+#define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t)) -+#endif -+#if defined(lzo_int32e_t) -+#define lzo_int32_t lzo_int32e_t -+#define lzo_uint32_t lzo_uint32e_t -+#define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t)) -+#endif -+#if defined(lzo_int64e_t) -+#define lzo_int64_t lzo_int64e_t -+#define lzo_uint64_t lzo_uint64e_t -+#define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t)) -+#endif -+#if 1 -+#define lzo_int_least32_t lzo_int32l_t -+#define lzo_uint_least32_t lzo_uint32l_t -+#define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t)) -+#endif -+#if defined(lzo_int64l_t) -+#define lzo_int_least64_t lzo_int64l_t -+#define lzo_uint_least64_t lzo_uint64l_t -+#define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t)) -+#endif -+#if 1 -+#define lzo_int_fast32_t lzo_int32f_t -+#define lzo_uint_fast32_t lzo_uint32f_t -+#define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t)) -+#endif -+#if defined(lzo_int64f_t) -+#define lzo_int_fast64_t lzo_int64f_t -+#define lzo_uint_fast64_t lzo_uint64f_t -+#define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t)) -+#endif -+#if !defined(LZO_INT16_C) -+# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 2) -+# define LZO_INT16_C(c) ((c) + 0) -+# define LZO_UINT16_C(c) ((c) + 0U) -+# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 2) -+# define LZO_INT16_C(c) ((c) + 0L) -+# define LZO_UINT16_C(c) ((c) + 0UL) -+# elif (LZO_SIZEOF_INT >= 2) -+# define LZO_INT16_C(c) (c) -+# define LZO_UINT16_C(c) (c##U) -+# elif (LZO_SIZEOF_LONG >= 2) -+# define LZO_INT16_C(c) (c##L) -+# define LZO_UINT16_C(c) (c##UL) -+# else -+# error "LZO_INT16_C" -+# endif -+#endif -+#if !defined(LZO_INT32_C) -+# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 4) -+# define LZO_INT32_C(c) ((c) + 0) -+# define LZO_UINT32_C(c) ((c) + 0U) -+# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 4) -+# define LZO_INT32_C(c) ((c) + 0L) -+# define LZO_UINT32_C(c) ((c) + 0UL) -+# elif (LZO_SIZEOF_INT >= 4) -+# define LZO_INT32_C(c) (c) -+# define LZO_UINT32_C(c) (c##U) -+# elif (LZO_SIZEOF_LONG >= 4) -+# define LZO_INT32_C(c) (c##L) -+# define LZO_UINT32_C(c) (c##UL) -+# elif (LZO_SIZEOF_LONG_LONG >= 4) -+# define LZO_INT32_C(c) (c##LL) -+# define LZO_UINT32_C(c) (c##ULL) -+# else -+# error "LZO_INT32_C" -+# endif -+#endif -+#if !defined(LZO_INT64_C) && defined(lzo_int64l_t) -+# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 8) -+# define LZO_INT64_C(c) ((c) + 0) -+# define LZO_UINT64_C(c) ((c) + 0U) -+# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 8) -+# define LZO_INT64_C(c) ((c) + 0L) -+# define LZO_UINT64_C(c) ((c) + 0UL) -+# elif (LZO_SIZEOF_INT >= 8) -+# define LZO_INT64_C(c) (c) -+# define LZO_UINT64_C(c) (c##U) -+# elif (LZO_SIZEOF_LONG >= 8) -+# define LZO_INT64_C(c) (c##L) -+# define LZO_UINT64_C(c) (c##UL) -+# else -+# error "LZO_INT64_C" -+# endif -+#endif -+#endif - - #endif - -@@ -1874,7 +3020,7 @@ extern "C" { - #undef LZO_HAVE_CONFIG_H - #include "minilzo.h" - --#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2050) -+#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2080) - # error "version mismatch in miniLZO source files" - #endif - -@@ -1886,23 +3032,9 @@ extern "C" { - #define __LZO_CONF_H 1 - - #if !defined(__LZO_IN_MINILZO) --#if (LZO_CFG_FREESTANDING) -+#if defined(LZO_CFG_FREESTANDING) && (LZO_CFG_FREESTANDING) - # define LZO_LIBC_FREESTANDING 1 - # define LZO_OS_FREESTANDING 1 --# define ACC_LIBC_FREESTANDING 1 --# define ACC_OS_FREESTANDING 1 --#endif --#if (LZO_CFG_NO_UNALIGNED) --# define ACC_CFG_NO_UNALIGNED 1 --#endif --#if (LZO_ARCH_GENERIC) --# define ACC_ARCH_GENERIC 1 --#endif --#if (LZO_ABI_NEUTRAL_ENDIAN) --# define ACC_ABI_NEUTRAL_ENDIAN 1 --#endif --#if (LZO_HAVE_CONFIG_H) --# define ACC_CONFIG_NO_HEADER 1 - #endif - #if defined(LZO_CFG_EXTRA_CONFIG_HEADER) - # include LZO_CFG_EXTRA_CONFIG_HEADER -@@ -1911,22 +3043,27 @@ extern "C" { - # error "include this file first" - #endif - #include "lzo/lzoconf.h" -+#if defined(LZO_CFG_EXTRA_CONFIG_HEADER2) -+# include LZO_CFG_EXTRA_CONFIG_HEADER2 -+#endif - #endif - --#if (LZO_VERSION < 0x02000) || !defined(__LZOCONF_H_INCLUDED) -+#if (LZO_VERSION < 0x2080) || !defined(__LZOCONF_H_INCLUDED) - # error "version mismatch" - #endif - --#if (LZO_CC_BORLANDC && LZO_ARCH_I086) --# pragma option -h -+#if (LZO_CC_MSC && (_MSC_VER >= 1000 && _MSC_VER < 1100)) -+# pragma warning(disable: 4702) - #endif -- - #if (LZO_CC_MSC && (_MSC_VER >= 1000)) - # pragma warning(disable: 4127 4701) -+# pragma warning(disable: 4514 4710 4711) - #endif - #if (LZO_CC_MSC && (_MSC_VER >= 1300)) - # pragma warning(disable: 4820) --# pragma warning(disable: 4514 4710 4711) -+#endif -+#if (LZO_CC_MSC && (_MSC_VER >= 1800)) -+# pragma warning(disable: 4746) - #endif - - #if (LZO_CC_SUNPROC) -@@ -1937,49 +3074,16 @@ extern "C" { - #endif - #endif - --#if (__LZO_MMODEL_HUGE) && !(LZO_HAVE_MM_HUGE_PTR) --# error "this should not happen - check defines for __huge" --#endif -- --#if defined(__LZO_IN_MINILZO) || defined(LZO_CFG_FREESTANDING) --#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) --# define ACC_WANT_ACC_INCD_H 1 --# define ACC_WANT_ACC_INCE_H 1 --# define ACC_WANT_ACC_INCI_H 1 -+#if defined(__LZO_IN_MINILZO) || (LZO_CFG_FREESTANDING) - #elif 1 - # include - #else --# define ACC_WANT_ACC_INCD_H 1 -+# define LZO_WANT_ACC_INCD_H 1 - #endif -- --#if (LZO_ARCH_I086) --# define ACC_MM_AHSHIFT LZO_MM_AHSHIFT --# define ACC_PTR_FP_OFF(x) (((const unsigned __far*)&(x))[0]) --# define ACC_PTR_FP_SEG(x) (((const unsigned __far*)&(x))[1]) --# define ACC_PTR_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o))) -+#if defined(LZO_HAVE_CONFIG_H) -+# define LZO_CFG_NO_CONFIG_HEADER 1 - #endif - --#if !defined(lzo_uintptr_t) --# if defined(__LZO_MMODEL_HUGE) --# define lzo_uintptr_t unsigned long --# elif 1 && defined(LZO_OS_OS400) && (LZO_SIZEOF_VOID_P == 16) --# define __LZO_UINTPTR_T_IS_POINTER 1 -- typedef char* lzo_uintptr_t; --# define lzo_uintptr_t lzo_uintptr_t --# elif (LZO_SIZEOF_SIZE_T == LZO_SIZEOF_VOID_P) --# define lzo_uintptr_t size_t --# elif (LZO_SIZEOF_LONG == LZO_SIZEOF_VOID_P) --# define lzo_uintptr_t unsigned long --# elif (LZO_SIZEOF_INT == LZO_SIZEOF_VOID_P) --# define lzo_uintptr_t unsigned int --# elif (LZO_SIZEOF_LONG_LONG == LZO_SIZEOF_VOID_P) --# define lzo_uintptr_t unsigned long long --# else --# define lzo_uintptr_t size_t --# endif --#endif --LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) -- - #if 1 && !defined(LZO_CFG_FREESTANDING) - #if 1 && !defined(HAVE_STRING_H) - #define HAVE_STRING_H 1 -@@ -2002,6 +3106,23 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - #include - #endif - -+#if 1 || defined(lzo_int8_t) || defined(lzo_uint8_t) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint8_t) == 1) -+#endif -+#if 1 || defined(lzo_int16_t) || defined(lzo_uint16_t) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint16_t) == 2) -+#endif -+#if 1 || defined(lzo_int32_t) || defined(lzo_uint32_t) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32_t) == 4) -+#endif -+#if defined(lzo_int64_t) || defined(lzo_uint64_t) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint64_t) == 8) -+#endif -+ - #if (LZO_CFG_FREESTANDING) - # undef HAVE_MEMCMP - # undef HAVE_MEMCPY -@@ -2012,28 +3133,28 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - #if !(HAVE_MEMCMP) - # undef memcmp - # define memcmp(a,b,c) lzo_memcmp(a,b,c) --#elif !(__LZO_MMODEL_HUGE) -+#else - # undef lzo_memcmp - # define lzo_memcmp(a,b,c) memcmp(a,b,c) - #endif - #if !(HAVE_MEMCPY) - # undef memcpy - # define memcpy(a,b,c) lzo_memcpy(a,b,c) --#elif !(__LZO_MMODEL_HUGE) -+#else - # undef lzo_memcpy - # define lzo_memcpy(a,b,c) memcpy(a,b,c) - #endif - #if !(HAVE_MEMMOVE) - # undef memmove - # define memmove(a,b,c) lzo_memmove(a,b,c) --#elif !(__LZO_MMODEL_HUGE) -+#else - # undef lzo_memmove - # define lzo_memmove(a,b,c) memmove(a,b,c) - #endif - #if !(HAVE_MEMSET) - # undef memset - # define memset(a,b,c) lzo_memset(a,b,c) --#elif !(__LZO_MMODEL_HUGE) -+#else - # undef lzo_memset - # define lzo_memset(a,b,c) memset(a,b,c) - #endif -@@ -2058,27 +3179,29 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - # define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) - #endif - --#if !defined(__lzo_inline) --# define __lzo_inline /*empty*/ --#endif --#if !defined(__lzo_forceinline) --# define __lzo_forceinline /*empty*/ --#endif --#if !defined(__lzo_noinline) --# define __lzo_noinline /*empty*/ --#endif -- - #if (LZO_CFG_PGO) --# undef __acc_likely --# undef __acc_unlikely - # undef __lzo_likely - # undef __lzo_unlikely --# define __acc_likely(e) (e) --# define __acc_unlikely(e) (e) - # define __lzo_likely(e) (e) - # define __lzo_unlikely(e) (e) - #endif - -+#undef _ -+#undef __ -+#undef ___ -+#undef ____ -+#undef _p0 -+#undef _p1 -+#undef _p2 -+#undef _p3 -+#undef _p4 -+#undef _s0 -+#undef _s1 -+#undef _s2 -+#undef _s3 -+#undef _s4 -+#undef _ww -+ - #if 1 - # define LZO_BYTE(x) ((unsigned char) (x)) - #else -@@ -2097,84 +3220,548 @@ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - #define LZO_SIZE(bits) (1u << (bits)) - #define LZO_MASK(bits) (LZO_SIZE(bits) - 1) - --#define LZO_LSIZE(bits) (1ul << (bits)) --#define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1) -- - #define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) - #define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) - - #if !defined(DMUL) - #if 0 - --# define DMUL(a,b) ((lzo_xint) ((lzo_uint32)(a) * (lzo_uint32)(b))) -+# define DMUL(a,b) ((lzo_xint) ((lzo_uint32_t)(a) * (lzo_uint32_t)(b))) - #else - # define DMUL(a,b) ((lzo_xint) ((a) * (b))) - #endif - #endif - --#if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386 || LZO_ARCH_POWERPC) --# if (LZO_SIZEOF_SHORT == 2) --# define LZO_UNALIGNED_OK_2 1 --# endif --# if (LZO_SIZEOF_INT == 4) --# define LZO_UNALIGNED_OK_4 1 --# endif --#endif --#if 1 && (LZO_ARCH_AMD64) --# if defined(LZO_UINT64_MAX) --# define LZO_UNALIGNED_OK_8 1 --# endif --#endif --#if (LZO_CFG_NO_UNALIGNED) --# undef LZO_UNALIGNED_OK_2 --# undef LZO_UNALIGNED_OK_4 --# undef LZO_UNALIGNED_OK_8 --#endif -- --#undef UA_GET16 --#undef UA_SET16 --#undef UA_COPY16 --#undef UA_GET32 --#undef UA_SET32 --#undef UA_COPY32 --#undef UA_GET64 --#undef UA_SET64 --#undef UA_COPY64 --#if defined(LZO_UNALIGNED_OK_2) -- LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(unsigned short) == 2) --# if 1 && defined(ACC_UA_COPY16) --# define UA_GET16 ACC_UA_GET16 --# define UA_SET16 ACC_UA_SET16 --# define UA_COPY16 ACC_UA_COPY16 --# else --# define UA_GET16(p) (* (__lzo_ua_volatile const lzo_ushortp) (__lzo_ua_volatile const lzo_voidp) (p)) --# define UA_SET16(p,v) ((* (__lzo_ua_volatile lzo_ushortp) (__lzo_ua_volatile lzo_voidp) (p)) = (unsigned short) (v)) --# define UA_COPY16(d,s) UA_SET16(d, UA_GET16(s)) --# endif --#endif --#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -- LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) --# if 1 && defined(ACC_UA_COPY32) --# define UA_GET32 ACC_UA_GET32 --# define UA_SET32 ACC_UA_SET32 --# define UA_COPY32 ACC_UA_COPY32 --# else --# define UA_GET32(p) (* (__lzo_ua_volatile const lzo_uint32p) (__lzo_ua_volatile const lzo_voidp) (p)) --# define UA_SET32(p,v) ((* (__lzo_ua_volatile lzo_uint32p) (__lzo_ua_volatile lzo_voidp) (p)) = (lzo_uint32) (v)) --# define UA_COPY32(d,s) UA_SET32(d, UA_GET32(s)) --# endif --#endif --#if defined(LZO_UNALIGNED_OK_8) -- LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint64) == 8) --# if 1 && defined(ACC_UA_COPY64) --# define UA_GET64 ACC_UA_GET64 --# define UA_SET64 ACC_UA_SET64 --# define UA_COPY64 ACC_UA_COPY64 --# else --# define UA_GET64(p) (* (__lzo_ua_volatile const lzo_uint64p) (__lzo_ua_volatile const lzo_voidp) (p)) --# define UA_SET64(p,v) ((* (__lzo_ua_volatile lzo_uint64p) (__lzo_ua_volatile lzo_voidp) (p)) = (lzo_uint64) (v)) --# define UA_COPY64(d,s) UA_SET64(d, UA_GET64(s)) --# endif -+#ifndef __LZO_FUNC_H -+#define __LZO_FUNC_H 1 -+ -+#if !defined(LZO_BITOPS_USE_ASM_BITSCAN) && !defined(LZO_BITOPS_USE_GNUC_BITSCAN) && !defined(LZO_BITOPS_USE_MSC_BITSCAN) -+#if 1 && (LZO_ARCH_AMD64) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_ASM_SYNTAX_GNUC) -+#define LZO_BITOPS_USE_ASM_BITSCAN 1 -+#elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_LLVM && (!defined(__llvm_tools_version__) || (__llvm_tools_version__+0 >= 0x010500ul)))) -+#define LZO_BITOPS_USE_GNUC_BITSCAN 1 -+#elif (LZO_OS_WIN32 || LZO_OS_WIN64) && ((LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1010)) || (LZO_CC_MSC && (_MSC_VER >= 1400))) -+#define LZO_BITOPS_USE_MSC_BITSCAN 1 -+#if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -+#include -+#endif -+#if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -+#pragma intrinsic(_BitScanReverse) -+#pragma intrinsic(_BitScanForward) -+#endif -+#if (LZO_CC_MSC) && (LZO_ARCH_AMD64) -+#pragma intrinsic(_BitScanReverse64) -+#pragma intrinsic(_BitScanForward64) -+#endif -+#endif -+#endif -+ -+__lzo_static_forceinline unsigned lzo_bitops_ctlz32_func(lzo_uint32_t v) -+{ -+#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -+ unsigned long r; (void) _BitScanReverse(&r, v); return (unsigned) r ^ 31; -+#define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v) -+#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) -+ lzo_uint32_t r; -+ __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); -+ return (unsigned) r ^ 31; -+#define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v) -+#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT == 4) -+ unsigned r; r = (unsigned) __builtin_clz(v); return r; -+#define lzo_bitops_ctlz32(v) ((unsigned) __builtin_clz(v)) -+#else -+ LZO_UNUSED(v); return 0; -+#endif -+} -+ -+#if defined(lzo_uint64_t) -+__lzo_static_forceinline unsigned lzo_bitops_ctlz64_func(lzo_uint64_t v) -+{ -+#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64) -+ unsigned long r; (void) _BitScanReverse64(&r, v); return (unsigned) r ^ 63; -+#define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v) -+#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC) -+ lzo_uint64_t r; -+ __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); -+ return (unsigned) r ^ 63; -+#define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v) -+#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8) -+ unsigned r; r = (unsigned) __builtin_clzl(v); return r; -+#define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzl(v)) -+#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG == 8) && (LZO_WORDSIZE >= 8) -+ unsigned r; r = (unsigned) __builtin_clzll(v); return r; -+#define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzll(v)) -+#else -+ LZO_UNUSED(v); return 0; -+#endif -+} -+#endif -+ -+__lzo_static_forceinline unsigned lzo_bitops_cttz32_func(lzo_uint32_t v) -+{ -+#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -+ unsigned long r; (void) _BitScanForward(&r, v); return (unsigned) r; -+#define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v) -+#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) -+ lzo_uint32_t r; -+ __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); -+ return (unsigned) r; -+#define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v) -+#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT >= 4) -+ unsigned r; r = (unsigned) __builtin_ctz(v); return r; -+#define lzo_bitops_cttz32(v) ((unsigned) __builtin_ctz(v)) -+#else -+ LZO_UNUSED(v); return 0; -+#endif -+} -+ -+#if defined(lzo_uint64_t) -+__lzo_static_forceinline unsigned lzo_bitops_cttz64_func(lzo_uint64_t v) -+{ -+#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64) -+ unsigned long r; (void) _BitScanForward64(&r, v); return (unsigned) r; -+#define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v) -+#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC) -+ lzo_uint64_t r; -+ __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); -+ return (unsigned) r; -+#define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v) -+#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG >= 8) && (LZO_WORDSIZE >= 8) -+ unsigned r; r = (unsigned) __builtin_ctzl(v); return r; -+#define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzl(v)) -+#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG >= 8) && (LZO_WORDSIZE >= 8) -+ unsigned r; r = (unsigned) __builtin_ctzll(v); return r; -+#define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzll(v)) -+#else -+ LZO_UNUSED(v); return 0; -+#endif -+} -+#endif -+ -+#if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -+static void __attribute__((__unused__)) -+#else -+__lzo_static_forceinline void -+#endif -+lzo_bitops_unused_funcs(void) -+{ -+ LZO_UNUSED_FUNC(lzo_bitops_ctlz32_func); -+ LZO_UNUSED_FUNC(lzo_bitops_cttz32_func); -+#if defined(lzo_uint64_t) -+ LZO_UNUSED_FUNC(lzo_bitops_ctlz64_func); -+ LZO_UNUSED_FUNC(lzo_bitops_cttz64_func); -+#endif -+ LZO_UNUSED_FUNC(lzo_bitops_unused_funcs); -+} -+ -+#if defined(__lzo_alignof) && !(LZO_CFG_NO_UNALIGNED) -+#ifndef __lzo_memops_tcheck -+#define __lzo_memops_tcheck(t,a,b) ((void)0, sizeof(t) == (a) && __lzo_alignof(t) == (b)) -+#endif -+#endif -+#ifndef lzo_memops_TU0p -+#define lzo_memops_TU0p void __LZO_MMODEL * -+#endif -+#ifndef lzo_memops_TU1p -+#define lzo_memops_TU1p unsigned char __LZO_MMODEL * -+#endif -+#ifndef lzo_memops_TU2p -+#if (LZO_OPT_UNALIGNED16) -+typedef lzo_uint16_t __lzo_may_alias lzo_memops_TU2; -+#define lzo_memops_TU2p volatile lzo_memops_TU2 * -+#elif defined(__lzo_byte_struct) -+__lzo_byte_struct(lzo_memops_TU2_struct,2) -+typedef struct lzo_memops_TU2_struct lzo_memops_TU2; -+#else -+struct lzo_memops_TU2_struct { unsigned char a[2]; } __lzo_may_alias; -+typedef struct lzo_memops_TU2_struct lzo_memops_TU2; -+#endif -+#ifndef lzo_memops_TU2p -+#define lzo_memops_TU2p lzo_memops_TU2 * -+#endif -+#endif -+#ifndef lzo_memops_TU4p -+#if (LZO_OPT_UNALIGNED32) -+typedef lzo_uint32_t __lzo_may_alias lzo_memops_TU4; -+#define lzo_memops_TU4p volatile lzo_memops_TU4 __LZO_MMODEL * -+#elif defined(__lzo_byte_struct) -+__lzo_byte_struct(lzo_memops_TU4_struct,4) -+typedef struct lzo_memops_TU4_struct lzo_memops_TU4; -+#else -+struct lzo_memops_TU4_struct { unsigned char a[4]; } __lzo_may_alias; -+typedef struct lzo_memops_TU4_struct lzo_memops_TU4; -+#endif -+#ifndef lzo_memops_TU4p -+#define lzo_memops_TU4p lzo_memops_TU4 __LZO_MMODEL * -+#endif -+#endif -+#ifndef lzo_memops_TU8p -+#if (LZO_OPT_UNALIGNED64) -+typedef lzo_uint64_t __lzo_may_alias lzo_memops_TU8; -+#define lzo_memops_TU8p volatile lzo_memops_TU8 __LZO_MMODEL * -+#elif defined(__lzo_byte_struct) -+__lzo_byte_struct(lzo_memops_TU8_struct,8) -+typedef struct lzo_memops_TU8_struct lzo_memops_TU8; -+#else -+struct lzo_memops_TU8_struct { unsigned char a[8]; } __lzo_may_alias; -+typedef struct lzo_memops_TU8_struct lzo_memops_TU8; -+#endif -+#ifndef lzo_memops_TU8p -+#define lzo_memops_TU8p lzo_memops_TU8 __LZO_MMODEL * -+#endif -+#endif -+#ifndef lzo_memops_set_TU1p -+#define lzo_memops_set_TU1p volatile lzo_memops_TU1p -+#endif -+#ifndef lzo_memops_move_TU1p -+#define lzo_memops_move_TU1p lzo_memops_TU1p -+#endif -+#define LZO_MEMOPS_SET1(dd,cc) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_set_TU1p d__1 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ -+ d__1[0] = LZO_BYTE(cc); \ -+ LZO_BLOCK_END -+#define LZO_MEMOPS_SET2(dd,cc) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_set_TU1p d__2 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ -+ d__2[0] = LZO_BYTE(cc); d__2[1] = LZO_BYTE(cc); \ -+ LZO_BLOCK_END -+#define LZO_MEMOPS_SET3(dd,cc) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_set_TU1p d__3 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ -+ d__3[0] = LZO_BYTE(cc); d__3[1] = LZO_BYTE(cc); d__3[2] = LZO_BYTE(cc); \ -+ LZO_BLOCK_END -+#define LZO_MEMOPS_SET4(dd,cc) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_set_TU1p d__4 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ -+ d__4[0] = LZO_BYTE(cc); d__4[1] = LZO_BYTE(cc); d__4[2] = LZO_BYTE(cc); d__4[3] = LZO_BYTE(cc); \ -+ LZO_BLOCK_END -+#define LZO_MEMOPS_MOVE1(dd,ss) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_move_TU1p d__1 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ -+ const lzo_memops_move_TU1p s__1 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ -+ d__1[0] = s__1[0]; \ -+ LZO_BLOCK_END -+#define LZO_MEMOPS_MOVE2(dd,ss) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_move_TU1p d__2 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ -+ const lzo_memops_move_TU1p s__2 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ -+ d__2[0] = s__2[0]; d__2[1] = s__2[1]; \ -+ LZO_BLOCK_END -+#define LZO_MEMOPS_MOVE3(dd,ss) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_move_TU1p d__3 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ -+ const lzo_memops_move_TU1p s__3 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ -+ d__3[0] = s__3[0]; d__3[1] = s__3[1]; d__3[2] = s__3[2]; \ -+ LZO_BLOCK_END -+#define LZO_MEMOPS_MOVE4(dd,ss) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_move_TU1p d__4 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ -+ const lzo_memops_move_TU1p s__4 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ -+ d__4[0] = s__4[0]; d__4[1] = s__4[1]; d__4[2] = s__4[2]; d__4[3] = s__4[3]; \ -+ LZO_BLOCK_END -+#define LZO_MEMOPS_MOVE8(dd,ss) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_move_TU1p d__8 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ -+ const lzo_memops_move_TU1p s__8 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ -+ d__8[0] = s__8[0]; d__8[1] = s__8[1]; d__8[2] = s__8[2]; d__8[3] = s__8[3]; \ -+ d__8[4] = s__8[4]; d__8[5] = s__8[5]; d__8[6] = s__8[6]; d__8[7] = s__8[7]; \ -+ LZO_BLOCK_END -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU1p)0)==1) -+#define LZO_MEMOPS_COPY1(dd,ss) LZO_MEMOPS_MOVE1(dd,ss) -+#if (LZO_OPT_UNALIGNED16) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2) -+#define LZO_MEMOPS_COPY2(dd,ss) \ -+ * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss) -+#elif defined(__lzo_memops_tcheck) -+#define LZO_MEMOPS_COPY2(dd,ss) \ -+ LZO_BLOCK_BEGIN if (__lzo_memops_tcheck(lzo_memops_TU2,2,1)) { \ -+ * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss); \ -+ } else { LZO_MEMOPS_MOVE2(dd,ss); } LZO_BLOCK_END -+#else -+#define LZO_MEMOPS_COPY2(dd,ss) LZO_MEMOPS_MOVE2(dd,ss) -+#endif -+#if (LZO_OPT_UNALIGNED32) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4) -+#define LZO_MEMOPS_COPY4(dd,ss) \ -+ * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss) -+#elif defined(__lzo_memops_tcheck) -+#define LZO_MEMOPS_COPY4(dd,ss) \ -+ LZO_BLOCK_BEGIN if (__lzo_memops_tcheck(lzo_memops_TU4,4,1)) { \ -+ * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss); \ -+ } else { LZO_MEMOPS_MOVE4(dd,ss); } LZO_BLOCK_END -+#else -+#define LZO_MEMOPS_COPY4(dd,ss) LZO_MEMOPS_MOVE4(dd,ss) -+#endif -+#if (LZO_WORDSIZE != 8) -+#define LZO_MEMOPS_COPY8(dd,ss) \ -+ LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END -+#else -+#if (LZO_OPT_UNALIGNED64) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8) -+#define LZO_MEMOPS_COPY8(dd,ss) \ -+ * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss) -+#elif (LZO_OPT_UNALIGNED32) -+#define LZO_MEMOPS_COPY8(dd,ss) \ -+ LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END -+#elif defined(__lzo_memops_tcheck) -+#define LZO_MEMOPS_COPY8(dd,ss) \ -+ LZO_BLOCK_BEGIN if (__lzo_memops_tcheck(lzo_memops_TU8,8,1)) { \ -+ * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss); \ -+ } else { LZO_MEMOPS_MOVE8(dd,ss); } LZO_BLOCK_END -+#else -+#define LZO_MEMOPS_COPY8(dd,ss) LZO_MEMOPS_MOVE8(dd,ss) -+#endif -+#endif -+#define LZO_MEMOPS_COPYN(dd,ss,nn) \ -+ LZO_BLOCK_BEGIN \ -+ lzo_memops_TU1p d__n = (lzo_memops_TU1p) (lzo_memops_TU0p) (dd); \ -+ const lzo_memops_TU1p s__n = (const lzo_memops_TU1p) (const lzo_memops_TU0p) (ss); \ -+ lzo_uint n__n = (nn); \ -+ while ((void)0, n__n >= 8) { LZO_MEMOPS_COPY8(d__n, s__n); d__n += 8; s__n += 8; n__n -= 8; } \ -+ if ((void)0, n__n >= 4) { LZO_MEMOPS_COPY4(d__n, s__n); d__n += 4; s__n += 4; n__n -= 4; } \ -+ if ((void)0, n__n > 0) do { *d__n++ = *s__n++; } while (--n__n > 0); \ -+ LZO_BLOCK_END -+ -+__lzo_static_forceinline lzo_uint16_t lzo_memops_get_le16(const lzo_voidp ss) -+{ -+ lzo_uint16_t v; -+#if (LZO_ABI_LITTLE_ENDIAN) -+ LZO_MEMOPS_COPY2(&v, ss); -+#elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) -+ const lzo_memops_TU2p s = (const lzo_memops_TU2p) ss; -+ unsigned long vv; -+ __asm__("lhbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s)); -+ v = (lzo_uint16_t) vv; -+#else -+ const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss; -+ v = (lzo_uint16_t) (((lzo_uint16_t)s[0]) | ((lzo_uint16_t)s[1] << 8)); -+#endif -+ return v; -+} -+#if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) -+#define LZO_MEMOPS_GET_LE16(ss) * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss) -+#else -+#define LZO_MEMOPS_GET_LE16(ss) lzo_memops_get_le16(ss) -+#endif -+ -+__lzo_static_forceinline lzo_uint32_t lzo_memops_get_le32(const lzo_voidp ss) -+{ -+ lzo_uint32_t v; -+#if (LZO_ABI_LITTLE_ENDIAN) -+ LZO_MEMOPS_COPY4(&v, ss); -+#elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) -+ const lzo_memops_TU4p s = (const lzo_memops_TU4p) ss; -+ unsigned long vv; -+ __asm__("lwbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s)); -+ v = (lzo_uint32_t) vv; -+#else -+ const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss; -+ v = (lzo_uint32_t) (((lzo_uint32_t)s[0]) | ((lzo_uint32_t)s[1] << 8) | ((lzo_uint32_t)s[2] << 16) | ((lzo_uint32_t)s[3] << 24)); -+#endif -+ return v; -+} -+#if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN) -+#define LZO_MEMOPS_GET_LE32(ss) * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss) -+#else -+#define LZO_MEMOPS_GET_LE32(ss) lzo_memops_get_le32(ss) -+#endif -+ -+#if (LZO_OPT_UNALIGNED64) && (LZO_ABI_LITTLE_ENDIAN) -+#define LZO_MEMOPS_GET_LE64(ss) * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss) -+#endif -+ -+__lzo_static_forceinline lzo_uint16_t lzo_memops_get_ne16(const lzo_voidp ss) -+{ -+ lzo_uint16_t v; -+ LZO_MEMOPS_COPY2(&v, ss); -+ return v; -+} -+#if (LZO_OPT_UNALIGNED16) -+#define LZO_MEMOPS_GET_NE16(ss) * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss) -+#else -+#define LZO_MEMOPS_GET_NE16(ss) lzo_memops_get_ne16(ss) -+#endif -+ -+__lzo_static_forceinline lzo_uint32_t lzo_memops_get_ne32(const lzo_voidp ss) -+{ -+ lzo_uint32_t v; -+ LZO_MEMOPS_COPY4(&v, ss); -+ return v; -+} -+#if (LZO_OPT_UNALIGNED32) -+#define LZO_MEMOPS_GET_NE32(ss) * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss) -+#else -+#define LZO_MEMOPS_GET_NE32(ss) lzo_memops_get_ne32(ss) -+#endif -+ -+#if (LZO_OPT_UNALIGNED64) -+#define LZO_MEMOPS_GET_NE64(ss) * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss) -+#endif -+ -+__lzo_static_forceinline void lzo_memops_put_le16(lzo_voidp dd, lzo_uint16_t vv) -+{ -+#if (LZO_ABI_LITTLE_ENDIAN) -+ LZO_MEMOPS_COPY2(dd, &vv); -+#elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) -+ lzo_memops_TU2p d = (lzo_memops_TU2p) dd; -+ unsigned long v = vv; -+ __asm__("sthbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v)); -+#else -+ lzo_memops_TU1p d = (lzo_memops_TU1p) dd; -+ d[0] = LZO_BYTE((vv ) & 0xff); -+ d[1] = LZO_BYTE((vv >> 8) & 0xff); -+#endif -+} -+#if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) -+#define LZO_MEMOPS_PUT_LE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv)) -+#else -+#define LZO_MEMOPS_PUT_LE16(dd,vv) lzo_memops_put_le16(dd,vv) -+#endif -+ -+__lzo_static_forceinline void lzo_memops_put_le32(lzo_voidp dd, lzo_uint32_t vv) -+{ -+#if (LZO_ABI_LITTLE_ENDIAN) -+ LZO_MEMOPS_COPY4(dd, &vv); -+#elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) -+ lzo_memops_TU4p d = (lzo_memops_TU4p) dd; -+ unsigned long v = vv; -+ __asm__("stwbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v)); -+#else -+ lzo_memops_TU1p d = (lzo_memops_TU1p) dd; -+ d[0] = LZO_BYTE((vv ) & 0xff); -+ d[1] = LZO_BYTE((vv >> 8) & 0xff); -+ d[2] = LZO_BYTE((vv >> 16) & 0xff); -+ d[3] = LZO_BYTE((vv >> 24) & 0xff); -+#endif -+} -+#if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN) -+#define LZO_MEMOPS_PUT_LE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv)) -+#else -+#define LZO_MEMOPS_PUT_LE32(dd,vv) lzo_memops_put_le32(dd,vv) -+#endif -+ -+__lzo_static_forceinline void lzo_memops_put_ne16(lzo_voidp dd, lzo_uint16_t vv) -+{ -+ LZO_MEMOPS_COPY2(dd, &vv); -+} -+#if (LZO_OPT_UNALIGNED16) -+#define LZO_MEMOPS_PUT_NE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv)) -+#else -+#define LZO_MEMOPS_PUT_NE16(dd,vv) lzo_memops_put_ne16(dd,vv) -+#endif -+ -+__lzo_static_forceinline void lzo_memops_put_ne32(lzo_voidp dd, lzo_uint32_t vv) -+{ -+ LZO_MEMOPS_COPY4(dd, &vv); -+} -+#if (LZO_OPT_UNALIGNED32) -+#define LZO_MEMOPS_PUT_NE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv)) -+#else -+#define LZO_MEMOPS_PUT_NE32(dd,vv) lzo_memops_put_ne32(dd,vv) -+#endif -+ -+#if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -+static void __attribute__((__unused__)) -+#else -+__lzo_static_forceinline void -+#endif -+lzo_memops_unused_funcs(void) -+{ -+ LZO_UNUSED_FUNC(lzo_memops_get_le16); -+ LZO_UNUSED_FUNC(lzo_memops_get_le32); -+ LZO_UNUSED_FUNC(lzo_memops_get_ne16); -+ LZO_UNUSED_FUNC(lzo_memops_get_ne32); -+ LZO_UNUSED_FUNC(lzo_memops_put_le16); -+ LZO_UNUSED_FUNC(lzo_memops_put_le32); -+ LZO_UNUSED_FUNC(lzo_memops_put_ne16); -+ LZO_UNUSED_FUNC(lzo_memops_put_ne32); -+ LZO_UNUSED_FUNC(lzo_memops_unused_funcs); -+} -+ -+#endif -+ -+#ifndef UA_SET1 -+#define UA_SET1 LZO_MEMOPS_SET1 -+#endif -+#ifndef UA_SET2 -+#define UA_SET2 LZO_MEMOPS_SET2 -+#endif -+#ifndef UA_SET3 -+#define UA_SET3 LZO_MEMOPS_SET3 -+#endif -+#ifndef UA_SET4 -+#define UA_SET4 LZO_MEMOPS_SET4 -+#endif -+#ifndef UA_MOVE1 -+#define UA_MOVE1 LZO_MEMOPS_MOVE1 -+#endif -+#ifndef UA_MOVE2 -+#define UA_MOVE2 LZO_MEMOPS_MOVE2 -+#endif -+#ifndef UA_MOVE3 -+#define UA_MOVE3 LZO_MEMOPS_MOVE3 -+#endif -+#ifndef UA_MOVE4 -+#define UA_MOVE4 LZO_MEMOPS_MOVE4 -+#endif -+#ifndef UA_MOVE8 -+#define UA_MOVE8 LZO_MEMOPS_MOVE8 -+#endif -+#ifndef UA_COPY1 -+#define UA_COPY1 LZO_MEMOPS_COPY1 -+#endif -+#ifndef UA_COPY2 -+#define UA_COPY2 LZO_MEMOPS_COPY2 -+#endif -+#ifndef UA_COPY3 -+#define UA_COPY3 LZO_MEMOPS_COPY3 -+#endif -+#ifndef UA_COPY4 -+#define UA_COPY4 LZO_MEMOPS_COPY4 -+#endif -+#ifndef UA_COPY8 -+#define UA_COPY8 LZO_MEMOPS_COPY8 -+#endif -+#ifndef UA_COPYN -+#define UA_COPYN LZO_MEMOPS_COPYN -+#endif -+#ifndef UA_COPYN_X -+#define UA_COPYN_X LZO_MEMOPS_COPYN -+#endif -+#ifndef UA_GET_LE16 -+#define UA_GET_LE16 LZO_MEMOPS_GET_LE16 -+#endif -+#ifndef UA_GET_LE32 -+#define UA_GET_LE32 LZO_MEMOPS_GET_LE32 -+#endif -+#ifdef LZO_MEMOPS_GET_LE64 -+#ifndef UA_GET_LE64 -+#define UA_GET_LE64 LZO_MEMOPS_GET_LE64 -+#endif -+#endif -+#ifndef UA_GET_NE16 -+#define UA_GET_NE16 LZO_MEMOPS_GET_NE16 -+#endif -+#ifndef UA_GET_NE32 -+#define UA_GET_NE32 LZO_MEMOPS_GET_NE32 -+#endif -+#ifdef LZO_MEMOPS_GET_NE64 -+#ifndef UA_GET_NE64 -+#define UA_GET_NE64 LZO_MEMOPS_GET_NE64 -+#endif -+#endif -+#ifndef UA_PUT_LE16 -+#define UA_PUT_LE16 LZO_MEMOPS_PUT_LE16 -+#endif -+#ifndef UA_PUT_LE32 -+#define UA_PUT_LE32 LZO_MEMOPS_PUT_LE32 -+#endif -+#ifndef UA_PUT_NE16 -+#define UA_PUT_NE16 LZO_MEMOPS_PUT_NE16 -+#endif -+#ifndef UA_PUT_NE32 -+#define UA_PUT_NE32 LZO_MEMOPS_PUT_NE32 - #endif - - #define MEMCPY8_DS(dest,src,len) \ -@@ -2195,25 +3782,10 @@ LZO_EXTERN(const lzo_bytep) lzo_copyright(void); - extern "C" { - #endif - --#if !defined(lzo_uintptr_t) --# if (__LZO_MMODEL_HUGE) --# define lzo_uintptr_t unsigned long --# else --# define lzo_uintptr_t acc_uintptr_t --# ifdef __ACC_INTPTR_T_IS_POINTER --# define __LZO_UINTPTR_T_IS_POINTER 1 --# endif --# endif --#endif -- - #if (LZO_ARCH_I086) --#define PTR(a) ((lzo_bytep) (a)) --#define PTR_ALIGNED_4(a) ((ACC_PTR_FP_OFF(a) & 3) == 0) --#define PTR_ALIGNED2_4(a,b) (((ACC_PTR_FP_OFF(a) | ACC_PTR_FP_OFF(b)) & 3) == 0) -+#error "LZO_ARCH_I086 is unsupported" - #elif (LZO_MM_PVP) --#define PTR(a) ((lzo_bytep) (a)) --#define PTR_ALIGNED_8(a) ((((lzo_uintptr_t)(a)) >> 61) == 0) --#define PTR_ALIGNED2_8(a,b) ((((lzo_uintptr_t)(a)|(lzo_uintptr_t)(b)) >> 61) == 0) -+#error "LZO_MM_PVP is unsupported" - #else - #define PTR(a) ((lzo_uintptr_t) (a)) - #define PTR_LINEAR(a) PTR(a) -@@ -2243,24 +3815,28 @@ typedef union - unsigned long a_ulong; - lzo_int a_lzo_int; - lzo_uint a_lzo_uint; -- lzo_int32 a_lzo_int32; -- lzo_uint32 a_lzo_uint32; --#if defined(LZO_UINT64_MAX) -- lzo_int64 a_lzo_int64; -- lzo_uint64 a_lzo_uint64; -+ lzo_xint a_lzo_xint; -+ lzo_int16_t a_lzo_int16_t; -+ lzo_uint16_t a_lzo_uint16_t; -+ lzo_int32_t a_lzo_int32_t; -+ lzo_uint32_t a_lzo_uint32_t; -+#if defined(lzo_uint64_t) -+ lzo_int64_t a_lzo_int64_t; -+ lzo_uint64_t a_lzo_uint64_t; - #endif -+ size_t a_size_t; - ptrdiff_t a_ptrdiff_t; - lzo_uintptr_t a_lzo_uintptr_t; -- lzo_voidp a_lzo_voidp; - void * a_void_p; -- lzo_bytep a_lzo_bytep; -- lzo_bytepp a_lzo_bytepp; -- lzo_uintp a_lzo_uintp; -- lzo_uint * a_lzo_uint_p; -- lzo_uint32p a_lzo_uint32p; -- lzo_uint32 * a_lzo_uint32_p; -- unsigned char * a_uchar_p; - char * a_char_p; -+ unsigned char * a_uchar_p; -+ const void * a_c_void_p; -+ const char * a_c_char_p; -+ const unsigned char * a_c_uchar_p; -+ lzo_voidp a_lzo_voidp; -+ lzo_bytep a_lzo_bytep; -+ const lzo_voidp a_c_lzo_voidp; -+ const lzo_bytep a_c_lzo_bytep; - } - lzo_full_align_t; - -@@ -2276,18 +3852,14 @@ lzo_full_align_t; - - #ifndef LZO_DICT_USE_PTR - #define LZO_DICT_USE_PTR 1 --#if 0 && (LZO_ARCH_I086) --# undef LZO_DICT_USE_PTR --# define LZO_DICT_USE_PTR 0 --#endif - #endif - - #if (LZO_DICT_USE_PTR) - # define lzo_dict_t const lzo_bytep --# define lzo_dict_p lzo_dict_t __LZO_MMODEL * -+# define lzo_dict_p lzo_dict_t * - #else - # define lzo_dict_t lzo_uint --# define lzo_dict_p lzo_dict_t __LZO_MMODEL * -+# define lzo_dict_p lzo_dict_t * - #endif - - #endif -@@ -2300,10 +3872,9 @@ __lzo_ptr_linear(const lzo_voidp ptr) - lzo_uintptr_t p; - - #if (LZO_ARCH_I086) -- p = (((lzo_uintptr_t)(ACC_PTR_FP_SEG(ptr))) << (16 - ACC_MM_AHSHIFT)) + (ACC_PTR_FP_OFF(ptr)); -+#error "LZO_ARCH_I086 is unsupported" - #elif (LZO_MM_PVP) -- p = (lzo_uintptr_t) (ptr); -- p = (p << 3) | (p >> 61); -+#error "LZO_MM_PVP is unsupported" - #else - p = (lzo_uintptr_t) PTR_LINEAR(ptr); - #endif -@@ -2314,9 +3885,8 @@ __lzo_ptr_linear(const lzo_voidp ptr) - LZO_PUBLIC(unsigned) - __lzo_align_gap(const lzo_voidp ptr, lzo_uint size) - { --#if defined(__LZO_UINTPTR_T_IS_POINTER) -- size_t n = (size_t) ptr; -- n = (((n + size - 1) / size) * size) - n; -+#if (__LZO_UINTPTR_T_IS_POINTER) -+#error "__LZO_UINTPTR_T_IS_POINTER is unsupported" - #else - lzo_uintptr_t p, n; - p = __lzo_ptr_linear(ptr); -@@ -2342,7 +3912,7 @@ static const char __lzo_copyright[] = - #else - "\r\n\n" - "LZO data compression library.\n" -- "$Copyright: LZO Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer\n" -+ "$Copyright: LZO Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\n" - "\n" - "http://www.oberhumer.com $\n\n" - "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n" -@@ -2352,11 +3922,7 @@ static const char __lzo_copyright[] = - LZO_PUBLIC(const lzo_bytep) - lzo_copyright(void) - { --#if (LZO_OS_DOS16 && LZO_CC_TURBOC) -- return (lzo_voidp) __lzo_copyright; --#else - return (const lzo_bytep) __lzo_copyright; --#endif - } - - LZO_PUBLIC(unsigned) -@@ -2393,16 +3959,16 @@ _lzo_version_date(void) - #define LZO_NMAX 5552 - - #define LZO_DO1(buf,i) s1 += buf[i]; s2 += s1 --#define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1); --#define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2); --#define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4); --#define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8); -+#define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1) -+#define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2) -+#define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4) -+#define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8) - --LZO_PUBLIC(lzo_uint32) --lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len) -+LZO_PUBLIC(lzo_uint32_t) -+lzo_adler32(lzo_uint32_t adler, const lzo_bytep buf, lzo_uint len) - { -- lzo_uint32 s1 = adler & 0xffff; -- lzo_uint32 s2 = (adler >> 16) & 0xffff; -+ lzo_uint32_t s1 = adler & 0xffff; -+ lzo_uint32_t s2 = (adler >> 16) & 0xffff; - unsigned k; - - if (buf == NULL) -@@ -2459,8 +4025,8 @@ lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len) - LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len) - { - #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCMP) -- const lzo_hbyte_p p1 = (const lzo_hbyte_p) s1; -- const lzo_hbyte_p p2 = (const lzo_hbyte_p) s2; -+ const lzo_hbyte_p p1 = LZO_STATIC_CAST(const lzo_hbyte_p, s1); -+ const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, s2); - if __lzo_likely(len > 0) do - { - int d = *p1 - *p2; -@@ -2476,8 +4042,8 @@ LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo - LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) - { - #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCPY) -- lzo_hbyte_p p1 = (lzo_hbyte_p) dest; -- const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; -+ lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest); -+ const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src); - if (!(len > 0) || p1 == p2) - return dest; - do -@@ -2491,8 +4057,8 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src - LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) - { - #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMMOVE) -- lzo_hbyte_p p1 = (lzo_hbyte_p) dest; -- const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; -+ lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest); -+ const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src); - if (!(len > 0) || p1 == p2) - return dest; - if (p1 < p2) -@@ -2514,16 +4080,17 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p sr - return memmove(dest, src, len); - #endif - } --LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) -+LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int cc, lzo_hsize_t len) - { - #if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMSET) -- lzo_hbyte_p p = (lzo_hbyte_p) s; -+ lzo_hbyte_p p = LZO_STATIC_CAST(lzo_hbyte_p, s); -+ unsigned char c = LZO_ITRUNC(unsigned char, cc); - if __lzo_likely(len > 0) do -- *p++ = (unsigned char) c; -+ *p++ = c; - while __lzo_likely(--len > 0); - return s; - #else -- return memset(s, c, len); -+ return memset(s, cc, len); - #endif - } - #undef LZOLIB_PUBLIC -@@ -2532,105 +4099,28 @@ LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) - - #if !defined(__LZO_IN_MINILZO) - --#define ACC_WANT_ACC_CHK_CH 1 --#undef ACCCHK_ASSERT -+#define LZO_WANT_ACC_CHK_CH 1 -+#undef LZOCHK_ASSERT - -- ACCCHK_ASSERT_IS_SIGNED_T(lzo_int) -- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint) -- -- ACCCHK_ASSERT_IS_SIGNED_T(lzo_int32) -- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32) -- ACCCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0) -- ACCCHK_ASSERT(sizeof(lzo_uint32) >= 4) --#if defined(LZO_UINT64_MAX) -- ACCCHK_ASSERT(sizeof(lzo_uint64) == 8) -- ACCCHK_ASSERT_IS_SIGNED_T(lzo_int64) -- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint64) -+ LZOCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0) -+ LZOCHK_ASSERT_IS_SIGNED_T(lzo_int) -+ LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint) -+#if !(__LZO_UINTPTR_T_IS_POINTER) -+ LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) - #endif -+ LZOCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) -+ LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_xint) - --#if !defined(__LZO_UINTPTR_T_IS_POINTER) -- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) - #endif -- ACCCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) -- -- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_xint) -- ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint32)) -- ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint)) -- ACCCHK_ASSERT(sizeof(lzo_xint) == sizeof(lzo_uint32) || sizeof(lzo_xint) == sizeof(lzo_uint)) -+#undef LZOCHK_ASSERT - -+union lzo_config_check_union { -+ lzo_uint a[2]; -+ unsigned char b[2*LZO_MAX(8,sizeof(lzo_uint))]; -+#if defined(lzo_uint64_t) -+ lzo_uint64_t c[2]; - #endif --#undef ACCCHK_ASSERT -- --#if 0 --#define WANT_lzo_bitops_clz32 1 --#define WANT_lzo_bitops_clz64 1 --#endif --#define WANT_lzo_bitops_ctz32 1 --#define WANT_lzo_bitops_ctz64 1 -- --#if (defined(_WIN32) || defined(_WIN64)) && ((LZO_CC_INTELC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_MSC && (_MSC_VER >= 1400))) --#include --#if !defined(lzo_bitops_clz32) && defined(WANT_lzo_bitops_clz32) && 0 --#pragma intrinsic(_BitScanReverse) --static __lzo_inline unsigned lzo_bitops_clz32(lzo_uint32 v) --{ -- unsigned long r; -- (void) _BitScanReverse(&r, v); -- return (unsigned) r; --} --#define lzo_bitops_clz32 lzo_bitops_clz32 --#endif --#if !defined(lzo_bitops_clz64) && defined(WANT_lzo_bitops_clz64) && defined(LZO_UINT64_MAX) && 0 --#pragma intrinsic(_BitScanReverse64) --static __lzo_inline unsigned lzo_bitops_clz64(lzo_uint64 v) --{ -- unsigned long r; -- (void) _BitScanReverse64(&r, v); -- return (unsigned) r; --} --#define lzo_bitops_clz64 lzo_bitops_clz64 --#endif --#if !defined(lzo_bitops_ctz32) && defined(WANT_lzo_bitops_ctz32) --#pragma intrinsic(_BitScanForward) --static __lzo_inline unsigned lzo_bitops_ctz32(lzo_uint32 v) --{ -- unsigned long r; -- (void) _BitScanForward(&r, v); -- return (unsigned) r; --} --#define lzo_bitops_ctz32 lzo_bitops_ctz32 --#endif --#if !defined(lzo_bitops_ctz64) && defined(WANT_lzo_bitops_ctz64) && defined(LZO_UINT64_MAX) --#pragma intrinsic(_BitScanForward64) --static __lzo_inline unsigned lzo_bitops_ctz64(lzo_uint64 v) --{ -- unsigned long r; -- (void) _BitScanForward64(&r, v); -- return (unsigned) r; --} --#define lzo_bitops_ctz64 lzo_bitops_ctz64 --#endif -- --#elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC && (__INTEL_COMPILER >= 1000)) || LZO_CC_LLVM) --#if !defined(lzo_bitops_clz32) && defined(WANT_lzo_bitops_clz32) --#define lzo_bitops_clz32(v) ((unsigned) __builtin_clz(v)) --#endif --#if !defined(lzo_bitops_clz64) && defined(WANT_lzo_bitops_clz64) && defined(LZO_UINT64_MAX) --#define lzo_bitops_clz64(v) ((unsigned) __builtin_clzll(v)) --#endif --#if !defined(lzo_bitops_ctz32) && defined(WANT_lzo_bitops_ctz32) --#define lzo_bitops_ctz32(v) ((unsigned) __builtin_ctz(v)) --#endif --#if !defined(lzo_bitops_ctz64) && defined(WANT_lzo_bitops_ctz64) && defined(LZO_UINT64_MAX) --#define lzo_bitops_ctz64(v) ((unsigned) __builtin_ctzll(v)) --#endif --#if !defined(lzo_bitops_popcount32) && defined(WANT_lzo_bitops_popcount32) --#define lzo_bitops_popcount32(v) ((unsigned) __builtin_popcount(v)) --#endif --#if !defined(lzo_bitops_popcount32) && defined(WANT_lzo_bitops_popcount64) && defined(LZO_UINT64_MAX) --#define lzo_bitops_popcount64(v) ((unsigned) __builtin_popcountll(v)) --#endif --#endif -+}; - - #if 0 - #define u2p(ptr,off) ((lzo_voidp) (((lzo_bytep)(lzo_voidp)(ptr)) + (off))) -@@ -2644,73 +4134,101 @@ static __lzo_noinline lzo_voidp u2p(lzo_voidp ptr, lzo_uint off) - LZO_PUBLIC(int) - _lzo_config_check(void) - { -- lzo_bool r = 1; -- union { -- lzo_xint a[2]; unsigned char b[2*LZO_MAX(8,sizeof(lzo_xint))]; --#if defined(LZO_UNALIGNED_OK_8) -- lzo_uint64 c[2]; -+#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030100ul && LZO_CC_CLANG < 0x030300ul)) -+# if 0 -+ volatile -+# endif - #endif -- unsigned short x[2]; lzo_uint32 y[2]; lzo_uint z[2]; -- } u; -+ union lzo_config_check_union u; - lzo_voidp p; -+ unsigned r = 1; - - u.a[0] = u.a[1] = 0; - p = u2p(&u, 0); - r &= ((* (lzo_bytep) p) == 0); --#if !defined(LZO_CFG_NO_CONFIG_CHECK) --#if defined(LZO_ABI_BIG_ENDIAN) -+#if !(LZO_CFG_NO_CONFIG_CHECK) -+#if (LZO_ABI_BIG_ENDIAN) - u.a[0] = u.a[1] = 0; u.b[sizeof(lzo_uint) - 1] = 128; - p = u2p(&u, 0); - r &= ((* (lzo_uintp) p) == 128); - #endif --#if defined(LZO_ABI_LITTLE_ENDIAN) -+#if (LZO_ABI_LITTLE_ENDIAN) - u.a[0] = u.a[1] = 0; u.b[0] = 128; - p = u2p(&u, 0); - r &= ((* (lzo_uintp) p) == 128); - #endif --#if defined(LZO_UNALIGNED_OK_2) - u.a[0] = u.a[1] = 0; -- u.b[0] = 1; u.b[sizeof(unsigned short) + 1] = 2; -+ u.b[0] = 1; u.b[3] = 2; - p = u2p(&u, 1); -- r &= ((* (lzo_ushortp) p) == 0); -+ r &= UA_GET_NE16(p) == 0; -+ r &= UA_GET_LE16(p) == 0; -+ u.b[1] = 128; -+ r &= UA_GET_LE16(p) == 128; -+ u.b[2] = 129; -+ r &= UA_GET_LE16(p) == LZO_UINT16_C(0x8180); -+#if (LZO_ABI_BIG_ENDIAN) -+ r &= UA_GET_NE16(p) == LZO_UINT16_C(0x8081); -+#endif -+#if (LZO_ABI_LITTLE_ENDIAN) -+ r &= UA_GET_NE16(p) == LZO_UINT16_C(0x8180); - #endif --#if defined(LZO_UNALIGNED_OK_4) - u.a[0] = u.a[1] = 0; -- u.b[0] = 3; u.b[sizeof(lzo_uint32) + 1] = 4; -+ u.b[0] = 3; u.b[5] = 4; - p = u2p(&u, 1); -- r &= ((* (lzo_uint32p) p) == 0); -+ r &= UA_GET_NE32(p) == 0; -+ r &= UA_GET_LE32(p) == 0; -+ u.b[1] = 128; -+ r &= UA_GET_LE32(p) == 128; -+ u.b[2] = 129; u.b[3] = 130; u.b[4] = 131; -+ r &= UA_GET_LE32(p) == LZO_UINT32_C(0x83828180); -+#if (LZO_ABI_BIG_ENDIAN) -+ r &= UA_GET_NE32(p) == LZO_UINT32_C(0x80818283); -+#endif -+#if (LZO_ABI_LITTLE_ENDIAN) -+ r &= UA_GET_NE32(p) == LZO_UINT32_C(0x83828180); - #endif --#if defined(LZO_UNALIGNED_OK_8) -+#if defined(UA_GET_NE64) - u.c[0] = u.c[1] = 0; -- u.b[0] = 5; u.b[sizeof(lzo_uint64) + 1] = 6; -+ u.b[0] = 5; u.b[9] = 6; - p = u2p(&u, 1); -- r &= ((* (lzo_uint64p) p) == 0); -+ u.c[0] = u.c[1] = 0; -+ r &= UA_GET_NE64(p) == 0; -+#if defined(UA_GET_LE64) -+ r &= UA_GET_LE64(p) == 0; -+ u.b[1] = 128; -+ r &= UA_GET_LE64(p) == 128; -+#endif - #endif --#if defined(lzo_bitops_clz32) -- { unsigned i; lzo_uint32 v = 1; -- for (i = 0; i < 31; i++, v <<= 1) -- r &= lzo_bitops_clz32(v) == 31 - i; -- } -+#if defined(lzo_bitops_ctlz32) -+ { unsigned i = 0; lzo_uint32_t v; -+ for (v = 1; v != 0 && r == 1; v <<= 1, i++) { -+ r &= lzo_bitops_ctlz32(v) == 31 - i; -+ r &= lzo_bitops_ctlz32_func(v) == 31 - i; -+ }} - #endif --#if defined(lzo_bitops_clz64) -- { unsigned i; lzo_uint64 v = 1; -- for (i = 0; i < 63; i++, v <<= 1) -- r &= lzo_bitops_clz64(v) == 63 - i; -- } -+#if defined(lzo_bitops_ctlz64) -+ { unsigned i = 0; lzo_uint64_t v; -+ for (v = 1; v != 0 && r == 1; v <<= 1, i++) { -+ r &= lzo_bitops_ctlz64(v) == 63 - i; -+ r &= lzo_bitops_ctlz64_func(v) == 63 - i; -+ }} - #endif --#if defined(lzo_bitops_ctz32) -- { unsigned i; lzo_uint32 v = 1; -- for (i = 0; i < 31; i++, v <<= 1) -- r &= lzo_bitops_ctz32(v) == i; -- } -+#if defined(lzo_bitops_cttz32) -+ { unsigned i = 0; lzo_uint32_t v; -+ for (v = 1; v != 0 && r == 1; v <<= 1, i++) { -+ r &= lzo_bitops_cttz32(v) == i; -+ r &= lzo_bitops_cttz32_func(v) == i; -+ }} - #endif --#if defined(lzo_bitops_ctz64) -- { unsigned i; lzo_uint64 v = 1; -- for (i = 0; i < 63; i++, v <<= 1) -- r &= lzo_bitops_ctz64(v) == i; -- } -+#if defined(lzo_bitops_cttz64) -+ { unsigned i = 0; lzo_uint64_t v; -+ for (v = 1; v != 0 && r == 1; v <<= 1, i++) { -+ r &= lzo_bitops_cttz64(v) == i; -+ r &= lzo_bitops_cttz64_func(v) == i; -+ }} - #endif - #endif -+ LZO_UNUSED_FUNC(lzo_bitops_unused_funcs); - - return r == 1 ? LZO_E_OK : LZO_E_ERROR; - } -@@ -2724,11 +4242,11 @@ __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, - #if defined(__LZO_IN_MINILZO) - #elif (LZO_CC_MSC && ((_MSC_VER) < 700)) - #else --#define ACC_WANT_ACC_CHK_CH 1 --#undef ACCCHK_ASSERT --#define ACCCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr) -+#define LZO_WANT_ACC_CHK_CH 1 -+#undef LZOCHK_ASSERT -+#define LZOCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr) - #endif --#undef ACCCHK_ASSERT -+#undef LZOCHK_ASSERT - - if (v == 0) - return LZO_E_ERROR; -@@ -2736,7 +4254,7 @@ __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, - r = (s1 == -1 || s1 == (int) sizeof(short)) && - (s2 == -1 || s2 == (int) sizeof(int)) && - (s3 == -1 || s3 == (int) sizeof(long)) && -- (s4 == -1 || s4 == (int) sizeof(lzo_uint32)) && -+ (s4 == -1 || s4 == (int) sizeof(lzo_uint32_t)) && - (s5 == -1 || s5 == (int) sizeof(lzo_uint)) && - (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) && - (s7 == -1 || s7 == (int) sizeof(char *)) && -@@ -2779,11 +4297,11 @@ int __far __pascal LibMain ( int a, short b, short c, long d ) - - #if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS) - --#if 1 && defined(UA_GET32) -+#if 1 && defined(UA_GET_LE32) - #undef LZO_DICT_USE_PTR - #define LZO_DICT_USE_PTR 0 - #undef lzo_dict_t --#define lzo_dict_t unsigned short -+#define lzo_dict_t lzo_uint16_t - #endif - - #define LZO_NEED_DICT_H 1 -@@ -3088,77 +4606,7 @@ DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) - #endif - - #if 1 && defined(DO_COMPRESS) && !defined(do_compress) --# define do_compress LZO_CPP_ECONCAT2(DO_COMPRESS,_core) --#endif -- --#if defined(UA_GET64) --# define WANT_lzo_bitops_ctz64 1 --#elif defined(UA_GET32) --# define WANT_lzo_bitops_ctz32 1 --#endif -- --#if (defined(_WIN32) || defined(_WIN64)) && ((LZO_CC_INTELC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_MSC && (_MSC_VER >= 1400))) --#include --#if !defined(lzo_bitops_clz32) && defined(WANT_lzo_bitops_clz32) && 0 --#pragma intrinsic(_BitScanReverse) --static __lzo_inline unsigned lzo_bitops_clz32(lzo_uint32 v) --{ -- unsigned long r; -- (void) _BitScanReverse(&r, v); -- return (unsigned) r; --} --#define lzo_bitops_clz32 lzo_bitops_clz32 --#endif --#if !defined(lzo_bitops_clz64) && defined(WANT_lzo_bitops_clz64) && defined(LZO_UINT64_MAX) && 0 --#pragma intrinsic(_BitScanReverse64) --static __lzo_inline unsigned lzo_bitops_clz64(lzo_uint64 v) --{ -- unsigned long r; -- (void) _BitScanReverse64(&r, v); -- return (unsigned) r; --} --#define lzo_bitops_clz64 lzo_bitops_clz64 --#endif --#if !defined(lzo_bitops_ctz32) && defined(WANT_lzo_bitops_ctz32) --#pragma intrinsic(_BitScanForward) --static __lzo_inline unsigned lzo_bitops_ctz32(lzo_uint32 v) --{ -- unsigned long r; -- (void) _BitScanForward(&r, v); -- return (unsigned) r; --} --#define lzo_bitops_ctz32 lzo_bitops_ctz32 --#endif --#if !defined(lzo_bitops_ctz64) && defined(WANT_lzo_bitops_ctz64) && defined(LZO_UINT64_MAX) --#pragma intrinsic(_BitScanForward64) --static __lzo_inline unsigned lzo_bitops_ctz64(lzo_uint64 v) --{ -- unsigned long r; -- (void) _BitScanForward64(&r, v); -- return (unsigned) r; --} --#define lzo_bitops_ctz64 lzo_bitops_ctz64 --#endif -- --#elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC && (__INTEL_COMPILER >= 1000)) || LZO_CC_LLVM) --#if !defined(lzo_bitops_clz32) && defined(WANT_lzo_bitops_clz32) --#define lzo_bitops_clz32(v) ((unsigned) __builtin_clz(v)) --#endif --#if !defined(lzo_bitops_clz64) && defined(WANT_lzo_bitops_clz64) && defined(LZO_UINT64_MAX) --#define lzo_bitops_clz64(v) ((unsigned) __builtin_clzll(v)) --#endif --#if !defined(lzo_bitops_ctz32) && defined(WANT_lzo_bitops_ctz32) --#define lzo_bitops_ctz32(v) ((unsigned) __builtin_ctz(v)) --#endif --#if !defined(lzo_bitops_ctz64) && defined(WANT_lzo_bitops_ctz64) && defined(LZO_UINT64_MAX) --#define lzo_bitops_ctz64(v) ((unsigned) __builtin_ctzll(v)) --#endif --#if !defined(lzo_bitops_popcount32) && defined(WANT_lzo_bitops_popcount32) --#define lzo_bitops_popcount32(v) ((unsigned) __builtin_popcount(v)) --#endif --#if !defined(lzo_bitops_popcount32) && defined(WANT_lzo_bitops_popcount64) && defined(LZO_UINT64_MAX) --#define lzo_bitops_popcount64(v) ((unsigned) __builtin_popcountll(v)) --#endif -+# define do_compress LZO_PP_ECONCAT2(DO_COMPRESS,_core) - #endif - - static __lzo_noinline lzo_uint -@@ -3166,7 +4614,7 @@ do_compress ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_uint ti, lzo_voidp wrkmem) - { -- register const lzo_bytep ip; -+ const lzo_bytep ip; - lzo_bytep op; - const lzo_bytep const in_end = in + in_len; - const lzo_bytep const ip_end = in + in_len - 20; -@@ -3175,7 +4623,7 @@ do_compress ( const lzo_bytep in , lzo_uint in_len, - - op = out; - ip = in; -- ii = ip - ti; -+ ii = ip; - - ip += ti < 4 ? 4 - ti : 0; - for (;;) -@@ -3205,8 +4653,8 @@ next: - goto literal; - - try_match: --#if defined(UA_GET32) -- if (UA_GET32(m_pos) != UA_GET32(ip)) -+#if (LZO_OPT_UNALIGNED32) -+ if (UA_GET_NE32(m_pos) != UA_GET_NE32(ip)) - #else - if (m_pos[0] != ip[0] || m_pos[1] != ip[1] || m_pos[2] != ip[2] || m_pos[3] != ip[3]) - #endif -@@ -3221,49 +4669,43 @@ literal: - lzo_uint m_off; - lzo_uint m_len; - { -- lzo_uint32 dv; -+ lzo_uint32_t dv; - lzo_uint dindex; - literal: - ip += 1 + ((ip - ii) >> 5); - next: - if __lzo_unlikely(ip >= ip_end) - break; -- dv = UA_GET32(ip); -+ dv = UA_GET_LE32(ip); - dindex = DINDEX(dv,ip); - GINDEX(m_off,m_pos,in+dict,dindex,in); - UPDATE_I(dict,0,dindex,ip,in); -- if __lzo_unlikely(dv != UA_GET32(m_pos)) -+ if __lzo_unlikely(dv != UA_GET_LE32(m_pos)) - goto literal; - } - #endif - -+ ii -= ti; ti = 0; - { -- register lzo_uint t = pd(ip,ii); -+ lzo_uint t = pd(ip,ii); - if (t != 0) - { - if (t <= 3) - { -- op[-2] |= LZO_BYTE(t); --#if defined(UA_COPY32) -- UA_COPY32(op, ii); -+ op[-2] = LZO_BYTE(op[-2] | t); -+#if (LZO_OPT_UNALIGNED32) -+ UA_COPY4(op, ii); - op += t; - #else - { do *op++ = *ii++; while (--t > 0); } - #endif - } --#if defined(UA_COPY32) || defined(UA_COPY64) -+#if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64) - else if (t <= 16) - { - *op++ = LZO_BYTE(t - 3); --#if defined(UA_COPY64) -- UA_COPY64(op, ii); -- UA_COPY64(op+8, ii+8); --#else -- UA_COPY32(op, ii); -- UA_COPY32(op+4, ii+4); -- UA_COPY32(op+8, ii+8); -- UA_COPY32(op+12, ii+12); --#endif -+ UA_COPY8(op, ii); -+ UA_COPY8(op+8, ii+8); - op += t; - } - #endif -@@ -3273,31 +4715,21 @@ next: - *op++ = LZO_BYTE(t - 3); - else - { -- register lzo_uint tt = t - 18; -+ lzo_uint tt = t - 18; - *op++ = 0; - while __lzo_unlikely(tt > 255) - { - tt -= 255; --#if 1 && (LZO_CC_MSC && (_MSC_VER >= 1400)) -- * (volatile unsigned char *) op++ = 0; --#else -- *op++ = 0; --#endif -+ UA_SET1(op, 0); -+ op++; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } --#if defined(UA_COPY32) || defined(UA_COPY64) -+#if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64) - do { --#if defined(UA_COPY64) -- UA_COPY64(op, ii); -- UA_COPY64(op+8, ii+8); --#else -- UA_COPY32(op, ii); -- UA_COPY32(op+4, ii+4); -- UA_COPY32(op+8, ii+8); -- UA_COPY32(op+12, ii+12); --#endif -+ UA_COPY8(op, ii); -+ UA_COPY8(op+8, ii+8); - op += 16; ii += 16; t -= 16; - } while (t >= 16); if (t > 0) - #endif -@@ -3307,19 +4739,26 @@ next: - } - m_len = 4; - { --#if defined(UA_GET64) -- lzo_uint64 v; -- v = UA_GET64(ip + m_len) ^ UA_GET64(m_pos + m_len); -+#if (LZO_OPT_UNALIGNED64) -+ lzo_uint64_t v; -+ v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len); - if __lzo_unlikely(v == 0) { - do { - m_len += 8; -- v = UA_GET64(ip + m_len) ^ UA_GET64(m_pos + m_len); -+ v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len); - if __lzo_unlikely(ip + m_len >= ip_end) - goto m_len_done; - } while (v == 0); - } --#if (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_ctz64) -- m_len += lzo_bitops_ctz64(v) / CHAR_BIT; -+#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz64) -+ m_len += lzo_bitops_ctlz64(v) / CHAR_BIT; -+#elif (LZO_ABI_BIG_ENDIAN) -+ if ((v >> (64 - CHAR_BIT)) == 0) do { -+ v <<= CHAR_BIT; -+ m_len += 1; -+ } while ((v >> (64 - CHAR_BIT)) == 0); -+#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz64) -+ m_len += lzo_bitops_cttz64(v) / CHAR_BIT; - #elif (LZO_ABI_LITTLE_ENDIAN) - if ((v & UCHAR_MAX) == 0) do { - v >>= CHAR_BIT; -@@ -3330,19 +4769,30 @@ next: - m_len += 1; - } while (ip[m_len] == m_pos[m_len]); - #endif --#elif defined(UA_GET32) -- lzo_uint32 v; -- v = UA_GET32(ip + m_len) ^ UA_GET32(m_pos + m_len); -+#elif (LZO_OPT_UNALIGNED32) -+ lzo_uint32_t v; -+ v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); - if __lzo_unlikely(v == 0) { - do { - m_len += 4; -- v = UA_GET32(ip + m_len) ^ UA_GET32(m_pos + m_len); -+ v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); -+ if (v != 0) -+ break; -+ m_len += 4; -+ v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); - if __lzo_unlikely(ip + m_len >= ip_end) - goto m_len_done; - } while (v == 0); - } --#if (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_ctz32) -- m_len += lzo_bitops_ctz32(v) / CHAR_BIT; -+#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz32) -+ m_len += lzo_bitops_ctlz32(v) / CHAR_BIT; -+#elif (LZO_ABI_BIG_ENDIAN) -+ if ((v >> (32 - CHAR_BIT)) == 0) do { -+ v <<= CHAR_BIT; -+ m_len += 1; -+ } while ((v >> (32 - CHAR_BIT)) == 0); -+#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz32) -+ m_len += lzo_bitops_cttz32(v) / CHAR_BIT; - #elif (LZO_ABI_LITTLE_ENDIAN) - if ((v & UCHAR_MAX) == 0) do { - v >>= CHAR_BIT; -@@ -3357,6 +4807,27 @@ next: - if __lzo_unlikely(ip[m_len] == m_pos[m_len]) { - do { - m_len += 1; -+ if (ip[m_len] != m_pos[m_len]) -+ break; -+ m_len += 1; -+ if (ip[m_len] != m_pos[m_len]) -+ break; -+ m_len += 1; -+ if (ip[m_len] != m_pos[m_len]) -+ break; -+ m_len += 1; -+ if (ip[m_len] != m_pos[m_len]) -+ break; -+ m_len += 1; -+ if (ip[m_len] != m_pos[m_len]) -+ break; -+ m_len += 1; -+ if (ip[m_len] != m_pos[m_len]) -+ break; -+ m_len += 1; -+ if (ip[m_len] != m_pos[m_len]) -+ break; -+ m_len += 1; - if __lzo_unlikely(ip + m_len >= ip_end) - goto m_len_done; - } while (ip[m_len] == m_pos[m_len]); -@@ -3390,11 +4861,8 @@ m_len_done: - while __lzo_unlikely(m_len > 255) - { - m_len -= 255; --#if 1 && (LZO_CC_MSC && (_MSC_VER >= 1400)) -- * (volatile unsigned char *) op++ = 0; --#else -- *op++ = 0; --#endif -+ UA_SET1(op, 0); -+ op++; - } - *op++ = LZO_BYTE(m_len); - } -@@ -3413,11 +4881,8 @@ m_len_done: - while __lzo_unlikely(m_len > 255) - { - m_len -= 255; --#if 1 && (LZO_CC_MSC && (_MSC_VER >= 1400)) -- * (volatile unsigned char *) op++ = 0; --#else -- *op++ = 0; --#endif -+ UA_SET1(op, 0); -+ op++; - } - *op++ = LZO_BYTE(m_len); - } -@@ -3428,7 +4893,7 @@ m_len_done: - } - - *out_len = pd(op, out); -- return pd(in_end,ii); -+ return pd(in_end,ii-ti); - } - - LZO_PUBLIC(int) -@@ -3468,7 +4933,7 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - if (op == out && t <= 238) - *op++ = LZO_BYTE(17 + t); - else if (t <= 3) -- op[-2] |= LZO_BYTE(t); -+ op[-2] = LZO_BYTE(op[-2] | t); - else if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else -@@ -3479,17 +4944,14 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - while (tt > 255) - { - tt -= 255; --#if 1 && (LZO_CC_MSC && (_MSC_VER >= 1400)) -- -- * (volatile unsigned char *) op++ = 0; --#else -- *op++ = 0; --#endif -+ UA_SET1(op, 0); -+ op++; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } -- do *op++ = *ii++; while (--t > 0); -+ UA_COPYN(op, ii, t); -+ op += t; - } - - *op++ = M4_MARKER | 1; -@@ -3526,10 +4988,13 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - - #undef TEST_IP - #undef TEST_OP -+#undef TEST_IP_AND_TEST_OP - #undef TEST_LB - #undef TEST_LBO - #undef NEED_IP - #undef NEED_OP -+#undef TEST_IV -+#undef TEST_OV - #undef HAVE_TEST_IP - #undef HAVE_TEST_OP - #undef HAVE_NEED_IP -@@ -3544,6 +5009,7 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - # if (LZO_TEST_OVERRUN_INPUT >= 2) - # define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -+# define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun - # endif - #endif - -@@ -3555,12 +5021,13 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - # undef TEST_OP - # define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -+# define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun - # endif - #endif - - #if defined(LZO_TEST_OVERRUN_LOOKBEHIND) --# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun --# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun -+# define TEST_LB(m_pos) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun -+# define TEST_LBO(m_pos,o) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun - #else - # define TEST_LB(m_pos) ((void) 0) - # define TEST_LBO(m_pos,o) ((void) 0) -@@ -3581,15 +5048,27 @@ DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - # define TEST_OP 1 - #endif - -+#if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP) -+# define TEST_IP_AND_TEST_OP (TEST_IP && TEST_OP) -+#elif defined(HAVE_TEST_IP) -+# define TEST_IP_AND_TEST_OP TEST_IP -+#elif defined(HAVE_TEST_OP) -+# define TEST_IP_AND_TEST_OP TEST_OP -+#else -+# define TEST_IP_AND_TEST_OP 1 -+#endif -+ - #if defined(NEED_IP) - # define HAVE_NEED_IP 1 - #else - # define NEED_IP(x) ((void) 0) -+# define TEST_IV(x) ((void) 0) - #endif - #if defined(NEED_OP) - # define HAVE_NEED_OP 1 - #else - # define NEED_OP(x) ((void) 0) -+# define TEST_OV(x) ((void) 0) - #endif - - #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -@@ -3606,14 +5085,14 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_voidp wrkmem ) - #endif - { -- register lzo_bytep op; -- register const lzo_bytep ip; -- register lzo_uint t; -+ lzo_bytep op; -+ const lzo_bytep ip; -+ lzo_uint t; - #if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; - #else -- register const lzo_bytep m_pos; -+ const lzo_bytep m_pos; - #endif - - const lzo_bytep const ip_end = in + in_len; -@@ -3648,43 +5127,45 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - op = out; - ip = in; - -+ NEED_IP(1); - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; -- assert(t > 0); NEED_OP(t); NEED_IP(t+1); -+ assert(t > 0); NEED_OP(t); NEED_IP(t+3); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - -- while (TEST_IP && TEST_OP) -+ for (;;) - { -+ NEED_IP(3); - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { -- NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; -+ TEST_IV(t); - NEED_IP(1); - } - t += 15 + *ip++; - } -- assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); --#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) -+ assert(t > 0); NEED_OP(t+3); NEED_IP(t+6); -+#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) - t += 3; - if (t >= 8) do - { -- UA_COPY64(op,ip); -+ UA_COPY8(op,ip); - op += 8; ip += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { -- UA_COPY32(op,ip); -+ UA_COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } - if (t > 0) -@@ -3692,19 +5173,19 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } - } --#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) --#if !defined(LZO_UNALIGNED_OK_4) -+#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) -+#if !(LZO_OPT_UNALIGNED32) - if (PTR_ALIGNED2_4(op,ip)) - { - #endif -- UA_COPY32(op,ip); -+ UA_COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { -- UA_COPY32(op,ip); -+ UA_COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); -@@ -3712,12 +5193,12 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - else - do *op++ = *ip++; while (--t > 0); - } --#if !defined(LZO_UNALIGNED_OK_4) -+#if !(LZO_OPT_UNALIGNED32) - } - else - #endif - #endif --#if !defined(LZO_UNALIGNED_OK_4) && !defined(LZO_UNALIGNED_OK_8) -+#if !(LZO_OPT_UNALIGNED32) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); -@@ -3753,7 +5234,7 @@ first_literal_run: - #endif - goto match_done; - -- do { -+ for (;;) { - match: - if (t >= 64) - { -@@ -3813,14 +5294,15 @@ match: - t &= 31; - if (t == 0) - { -- NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; -+ TEST_OV(t); - NEED_IP(1); - } - t += 31 + *ip++; -+ NEED_IP(2); - } - #if defined(COPY_DICT) - #if defined(LZO1Z) -@@ -3836,9 +5318,9 @@ match: - m_pos = op - off; - last_m_off = off; - } --#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) -+#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; -- m_pos -= UA_GET16(ip) >> 2; -+ m_pos -= UA_GET_LE16(ip) >> 2; - #else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -@@ -3857,14 +5339,15 @@ match: - t &= 7; - if (t == 0) - { -- NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; -+ TEST_OV(t); - NEED_IP(1); - } - t += 7 + *ip++; -+ NEED_IP(2); - } - #if defined(COPY_DICT) - #if defined(LZO1Z) -@@ -3882,8 +5365,8 @@ match: - #else - #if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); --#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) -- m_pos -= UA_GET16(ip) >> 2; -+#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) -+ m_pos -= UA_GET_LE16(ip) >> 2; - #else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); - #endif -@@ -3931,18 +5414,18 @@ match: - #else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); --#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) -+#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) - if (op - m_pos >= 8) - { - t += (3 - 1); - if (t >= 8) do - { -- UA_COPY64(op,m_pos); -+ UA_COPY8(op,m_pos); - op += 8; m_pos += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { -- UA_COPY32(op,m_pos); -+ UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } - if (t > 0) -@@ -3952,8 +5435,8 @@ match: - } - } - else --#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) --#if !defined(LZO_UNALIGNED_OK_4) -+#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) -+#if !(LZO_OPT_UNALIGNED32) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -@@ -3961,10 +5444,10 @@ match: - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { - #endif -- UA_COPY32(op,m_pos); -+ UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { -- UA_COPY32(op,m_pos); -+ UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); -@@ -3989,7 +5472,7 @@ match_done: - break; - - match_next: -- assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -+ assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3); - #if 0 - do *op++ = *ip++; while (--t > 0); - #else -@@ -3997,16 +5480,10 @@ match_next: - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } - #endif - t = *ip++; -- } while (TEST_IP && TEST_OP); -+ } - } - --#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) -- *out_len = pd(op, out); -- return LZO_E_EOF_NOT_FOUND; --#endif -- - eof_found: -- assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); -@@ -4052,10 +5529,13 @@ lookbehind_overrun: - - #undef TEST_IP - #undef TEST_OP -+#undef TEST_IP_AND_TEST_OP - #undef TEST_LB - #undef TEST_LBO - #undef NEED_IP - #undef NEED_OP -+#undef TEST_IV -+#undef TEST_OV - #undef HAVE_TEST_IP - #undef HAVE_TEST_OP - #undef HAVE_NEED_IP -@@ -4070,6 +5550,7 @@ lookbehind_overrun: - # if (LZO_TEST_OVERRUN_INPUT >= 2) - # define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -+# define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun - # endif - #endif - -@@ -4081,12 +5562,13 @@ lookbehind_overrun: - # undef TEST_OP - # define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -+# define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun - # endif - #endif - - #if defined(LZO_TEST_OVERRUN_LOOKBEHIND) --# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun --# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun -+# define TEST_LB(m_pos) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun -+# define TEST_LBO(m_pos,o) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun - #else - # define TEST_LB(m_pos) ((void) 0) - # define TEST_LBO(m_pos,o) ((void) 0) -@@ -4107,15 +5589,27 @@ lookbehind_overrun: - # define TEST_OP 1 - #endif - -+#if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP) -+# define TEST_IP_AND_TEST_OP (TEST_IP && TEST_OP) -+#elif defined(HAVE_TEST_IP) -+# define TEST_IP_AND_TEST_OP TEST_IP -+#elif defined(HAVE_TEST_OP) -+# define TEST_IP_AND_TEST_OP TEST_OP -+#else -+# define TEST_IP_AND_TEST_OP 1 -+#endif -+ - #if defined(NEED_IP) - # define HAVE_NEED_IP 1 - #else - # define NEED_IP(x) ((void) 0) -+# define TEST_IV(x) ((void) 0) - #endif - #if defined(NEED_OP) - # define HAVE_NEED_OP 1 - #else - # define NEED_OP(x) ((void) 0) -+# define TEST_OV(x) ((void) 0) - #endif - - #if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -@@ -4132,14 +5626,14 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_voidp wrkmem ) - #endif - { -- register lzo_bytep op; -- register const lzo_bytep ip; -- register lzo_uint t; -+ lzo_bytep op; -+ const lzo_bytep ip; -+ lzo_uint t; - #if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; - #else -- register const lzo_bytep m_pos; -+ const lzo_bytep m_pos; - #endif - - const lzo_bytep const ip_end = in + in_len; -@@ -4174,43 +5668,45 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - op = out; - ip = in; - -+ NEED_IP(1); - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; -- assert(t > 0); NEED_OP(t); NEED_IP(t+1); -+ assert(t > 0); NEED_OP(t); NEED_IP(t+3); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - -- while (TEST_IP && TEST_OP) -+ for (;;) - { -+ NEED_IP(3); - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { -- NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; -+ TEST_IV(t); - NEED_IP(1); - } - t += 15 + *ip++; - } -- assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); --#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) -+ assert(t > 0); NEED_OP(t+3); NEED_IP(t+6); -+#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) - t += 3; - if (t >= 8) do - { -- UA_COPY64(op,ip); -+ UA_COPY8(op,ip); - op += 8; ip += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { -- UA_COPY32(op,ip); -+ UA_COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } - if (t > 0) -@@ -4218,19 +5714,19 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } - } --#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) --#if !defined(LZO_UNALIGNED_OK_4) -+#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) -+#if !(LZO_OPT_UNALIGNED32) - if (PTR_ALIGNED2_4(op,ip)) - { - #endif -- UA_COPY32(op,ip); -+ UA_COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { -- UA_COPY32(op,ip); -+ UA_COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); -@@ -4238,12 +5734,12 @@ DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - else - do *op++ = *ip++; while (--t > 0); - } --#if !defined(LZO_UNALIGNED_OK_4) -+#if !(LZO_OPT_UNALIGNED32) - } - else - #endif - #endif --#if !defined(LZO_UNALIGNED_OK_4) && !defined(LZO_UNALIGNED_OK_8) -+#if !(LZO_OPT_UNALIGNED32) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); -@@ -4279,7 +5775,7 @@ first_literal_run: - #endif - goto match_done; - -- do { -+ for (;;) { - match: - if (t >= 64) - { -@@ -4339,14 +5835,15 @@ match: - t &= 31; - if (t == 0) - { -- NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; -+ TEST_OV(t); - NEED_IP(1); - } - t += 31 + *ip++; -+ NEED_IP(2); - } - #if defined(COPY_DICT) - #if defined(LZO1Z) -@@ -4362,9 +5859,9 @@ match: - m_pos = op - off; - last_m_off = off; - } --#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) -+#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; -- m_pos -= UA_GET16(ip) >> 2; -+ m_pos -= UA_GET_LE16(ip) >> 2; - #else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -@@ -4383,14 +5880,15 @@ match: - t &= 7; - if (t == 0) - { -- NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; -+ TEST_OV(t); - NEED_IP(1); - } - t += 7 + *ip++; -+ NEED_IP(2); - } - #if defined(COPY_DICT) - #if defined(LZO1Z) -@@ -4408,8 +5906,8 @@ match: - #else - #if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); --#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) -- m_pos -= UA_GET16(ip) >> 2; -+#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) -+ m_pos -= UA_GET_LE16(ip) >> 2; - #else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); - #endif -@@ -4457,18 +5955,18 @@ match: - #else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); --#if defined(LZO_UNALIGNED_OK_8) && defined(LZO_UNALIGNED_OK_4) -+#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) - if (op - m_pos >= 8) - { - t += (3 - 1); - if (t >= 8) do - { -- UA_COPY64(op,m_pos); -+ UA_COPY8(op,m_pos); - op += 8; m_pos += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { -- UA_COPY32(op,m_pos); -+ UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } - if (t > 0) -@@ -4478,8 +5976,8 @@ match: - } - } - else --#elif defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) --#if !defined(LZO_UNALIGNED_OK_4) -+#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) -+#if !(LZO_OPT_UNALIGNED32) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -@@ -4487,10 +5985,10 @@ match: - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { - #endif -- UA_COPY32(op,m_pos); -+ UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { -- UA_COPY32(op,m_pos); -+ UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); -@@ -4515,7 +6013,7 @@ match_done: - break; - - match_next: -- assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -+ assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3); - #if 0 - do *op++ = *ip++; while (--t > 0); - #else -@@ -4523,16 +6021,10 @@ match_next: - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } - #endif - t = *ip++; -- } while (TEST_IP && TEST_OP); -+ } - } - --#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) -- *out_len = pd(op, out); -- return LZO_E_EOF_NOT_FOUND; --#endif -- - eof_found: -- assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); -@@ -4559,4 +6051,3 @@ lookbehind_overrun: - #endif - - /***** End of minilzo.c *****/ -- -diff --git a/grub-core/lib/minilzo/lzoconf.h b/grub-core/lib/minilzo/lzoconf.h -index 1d0fe14fcda..61be29c5dc2 100644 ---- a/grub-core/lib/minilzo/lzoconf.h -+++ b/grub-core/lib/minilzo/lzoconf.h -@@ -2,22 +2,7 @@ - - This file is part of the LZO real-time data compression library. - -- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer -+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or -@@ -44,9 +29,9 @@ - #ifndef __LZOCONF_H_INCLUDED - #define __LZOCONF_H_INCLUDED 1 - --#define LZO_VERSION 0x2050 --#define LZO_VERSION_STRING "2.05" --#define LZO_VERSION_DATE "Apr 23 2011" -+#define LZO_VERSION 0x2080 -+#define LZO_VERSION_STRING "2.08" -+#define LZO_VERSION_DATE "Jun 29 2014" - - /* internal Autoconf configuration file - only used when building LZO */ - #if defined(LZO_HAVE_CONFIG_H) -@@ -63,7 +48,7 @@ - #if !defined(CHAR_BIT) || (CHAR_BIT != 8) - # error "invalid CHAR_BIT" - #endif --#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) -+#if !defined(UCHAR_MAX) || !defined(USHRT_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) - # error "check your compiler installation" - #endif - #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) -@@ -85,14 +70,6 @@ extern "C" { - // some core defines - ************************************************************************/ - --#if !defined(LZO_UINT32_C) --# if (UINT_MAX < LZO_0xffffffffL) --# define LZO_UINT32_C(c) c ## UL --# else --# define LZO_UINT32_C(c) ((c) + 0U) --# endif --#endif -- - /* memory checkers */ - #if !defined(__LZO_CHECKER) - # if defined(__BOUNDS_CHECKING_ON) -@@ -111,28 +88,31 @@ extern "C" { - // integral and pointer types - ************************************************************************/ - --/* lzo_uint should match size_t */ -+/* lzo_uint must match size_t */ - #if !defined(LZO_UINT_MAX) --# if defined(LZO_ABI_LLP64) /* WIN64 */ --# if defined(LZO_OS_WIN64) -+# if (LZO_ABI_LLP64) -+# if (LZO_OS_WIN64) - typedef unsigned __int64 lzo_uint; - typedef __int64 lzo_int; - # else -- typedef unsigned long long lzo_uint; -- typedef long long lzo_int; -+ typedef lzo_ullong_t lzo_uint; -+ typedef lzo_llong_t lzo_int; - # endif -+# define LZO_SIZEOF_LZO_UINT 8 - # define LZO_UINT_MAX 0xffffffffffffffffull - # define LZO_INT_MAX 9223372036854775807LL - # define LZO_INT_MIN (-1LL - LZO_INT_MAX) --# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */ -+# elif (LZO_ABI_IP32L64) /* MIPS R5900 */ - typedef unsigned int lzo_uint; - typedef int lzo_int; -+# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_INT - # define LZO_UINT_MAX UINT_MAX - # define LZO_INT_MAX INT_MAX - # define LZO_INT_MIN INT_MIN - # elif (ULONG_MAX >= LZO_0xffffffffL) - typedef unsigned long lzo_uint; - typedef long lzo_int; -+# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LONG - # define LZO_UINT_MAX ULONG_MAX - # define LZO_INT_MAX LONG_MAX - # define LZO_INT_MIN LONG_MIN -@@ -141,63 +121,22 @@ extern "C" { - # endif - #endif - --/* Integral types with 32 bits or more. */ --#if !defined(LZO_UINT32_MAX) --# if (UINT_MAX >= LZO_0xffffffffL) -- typedef unsigned int lzo_uint32; -- typedef int lzo_int32; --# define LZO_UINT32_MAX UINT_MAX --# define LZO_INT32_MAX INT_MAX --# define LZO_INT32_MIN INT_MIN --# elif (ULONG_MAX >= LZO_0xffffffffL) -- typedef unsigned long lzo_uint32; -- typedef long lzo_int32; --# define LZO_UINT32_MAX ULONG_MAX --# define LZO_INT32_MAX LONG_MAX --# define LZO_INT32_MIN LONG_MIN --# else --# error "lzo_uint32" --# endif --#endif -- --/* Integral types with exactly 64 bits. */ --#if !defined(LZO_UINT64_MAX) --# if (LZO_UINT_MAX >= LZO_0xffffffffL) --# if ((((LZO_UINT_MAX) >> 31) >> 31) == 3) --# define lzo_uint64 lzo_uint --# define lzo_int64 lzo_int --# define LZO_UINT64_MAX LZO_UINT_MAX --# define LZO_INT64_MAX LZO_INT_MAX --# define LZO_INT64_MIN LZO_INT_MIN --# endif --# elif (ULONG_MAX >= LZO_0xffffffffL) --# if ((((ULONG_MAX) >> 31) >> 31) == 3) -- typedef unsigned long lzo_uint64; -- typedef long lzo_int64; --# define LZO_UINT64_MAX ULONG_MAX --# define LZO_INT64_MAX LONG_MAX --# define LZO_INT64_MIN LONG_MIN --# endif --# endif --#endif -- --/* The larger type of lzo_uint and lzo_uint32. */ --#if (LZO_UINT_MAX >= LZO_UINT32_MAX) -+/* The larger type of lzo_uint and lzo_uint32_t. */ -+#if (LZO_SIZEOF_LZO_UINT >= 4) - # define lzo_xint lzo_uint - #else --# define lzo_xint lzo_uint32 -+# define lzo_xint lzo_uint32_t - #endif - --/* Memory model that allows to access memory at offsets of lzo_uint. */ --#if !defined(__LZO_MMODEL) --# if (LZO_UINT_MAX <= UINT_MAX) --# define __LZO_MMODEL /*empty*/ --# elif defined(LZO_HAVE_MM_HUGE_PTR) --# define __LZO_MMODEL_HUGE 1 --# define __LZO_MMODEL __huge --# else --# define __LZO_MMODEL /*empty*/ --# endif -+typedef int lzo_bool; -+ -+/* sanity checks */ -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_UINT) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint)) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t)) -+ -+#ifndef __LZO_MMODEL -+#define __LZO_MMODEL /*empty*/ - #endif - - /* no typedef here because of const-pointer issues */ -@@ -206,21 +145,52 @@ extern "C" { - #define lzo_voidp void __LZO_MMODEL * - #define lzo_shortp short __LZO_MMODEL * - #define lzo_ushortp unsigned short __LZO_MMODEL * --#define lzo_uint32p lzo_uint32 __LZO_MMODEL * --#define lzo_int32p lzo_int32 __LZO_MMODEL * --#if defined(LZO_UINT64_MAX) --#define lzo_uint64p lzo_uint64 __LZO_MMODEL * --#define lzo_int64p lzo_int64 __LZO_MMODEL * --#endif --#define lzo_uintp lzo_uint __LZO_MMODEL * - #define lzo_intp lzo_int __LZO_MMODEL * -+#define lzo_uintp lzo_uint __LZO_MMODEL * - #define lzo_xintp lzo_xint __LZO_MMODEL * - #define lzo_voidpp lzo_voidp __LZO_MMODEL * - #define lzo_bytepp lzo_bytep __LZO_MMODEL * --/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */ --#define lzo_byte unsigned char __LZO_MMODEL - --typedef int lzo_bool; -+#define lzo_int8_tp lzo_int8_t __LZO_MMODEL * -+#define lzo_uint8_tp lzo_uint8_t __LZO_MMODEL * -+#define lzo_int16_tp lzo_int16_t __LZO_MMODEL * -+#define lzo_uint16_tp lzo_uint16_t __LZO_MMODEL * -+#define lzo_int32_tp lzo_int32_t __LZO_MMODEL * -+#define lzo_uint32_tp lzo_uint32_t __LZO_MMODEL * -+#if defined(lzo_int64_t) -+#define lzo_int64_tp lzo_int64_t __LZO_MMODEL * -+#define lzo_uint64_tp lzo_uint64_t __LZO_MMODEL * -+#endif -+ -+/* Older LZO versions used to support ancient systems and memory models -+ * like 16-bit MSDOS with __huge pointers and Cray PVP, but these -+ * obsolete configurations are not supported any longer. -+ */ -+#if defined(__LZO_MMODEL_HUGE) -+#error "__LZO_MMODEL_HUGE is unsupported" -+#endif -+#if (LZO_MM_PVP) -+#error "LZO_MM_PVP is unsupported" -+#endif -+#if (LZO_SIZEOF_INT < 4) -+#error "LZO_SIZEOF_INT < 4 is unsupported" -+#endif -+#if (__LZO_UINTPTR_T_IS_POINTER) -+#error "__LZO_UINTPTR_T_IS_POINTER is unsupported" -+#endif -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) >= 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) >= 4) -+/* Strange configurations where sizeof(lzo_uint) != sizeof(size_t) should -+ * work but have not received much testing lately, so be strict here. -+ */ -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(size_t)) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(ptrdiff_t)) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(lzo_uintptr_t)) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_uintptr_t)) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_uintptr_t)) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long *) == sizeof(lzo_uintptr_t)) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_voidp)) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep)) - - - /*********************************************************************** -@@ -315,7 +285,7 @@ struct lzo_callback_t - /* a progress indicator callback function (set to 0 to disable) */ - lzo_progress_func_t nprogress; - -- /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress -+ /* INFO: the first parameter "self" of the nalloc/nfree/nprogress - * callbacks points back to this struct, so you are free to store - * some extra info in the following variables. */ - lzo_voidp user1; -@@ -343,6 +313,9 @@ struct lzo_callback_t - #define LZO_E_INPUT_NOT_CONSUMED (-8) - #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ - #define LZO_E_INVALID_ARGUMENT (-10) -+#define LZO_E_INVALID_ALIGNMENT (-11) /* pointer argument is not properly aligned */ -+#define LZO_E_OUTPUT_NOT_CONSUMED (-12) -+#define LZO_E_INTERNAL_ERROR (-99) - - - #ifndef lzo_sizeof_dict_t -@@ -356,7 +329,7 @@ struct lzo_callback_t - * compiler's view of various types are consistent. - */ - #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ -- (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\ -+ (int)sizeof(long),(int)sizeof(lzo_uint32_t),(int)sizeof(lzo_uint),\ - (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ - (int)sizeof(lzo_callback_t)) - LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); -@@ -379,18 +352,22 @@ LZO_EXTERN(lzo_voidp) - lzo_memset(lzo_voidp buf, int c, lzo_uint len); - - /* checksum functions */ --LZO_EXTERN(lzo_uint32) -- lzo_adler32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len); --LZO_EXTERN(lzo_uint32) -- lzo_crc32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len); --LZO_EXTERN(const lzo_uint32p) -+LZO_EXTERN(lzo_uint32_t) -+ lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len); -+LZO_EXTERN(lzo_uint32_t) -+ lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len); -+LZO_EXTERN(const lzo_uint32_tp) - lzo_get_crc32_table(void); - - /* misc. */ - LZO_EXTERN(int) _lzo_config_check(void); --typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; --typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; --typedef union { void *vp; lzo_bytep bp; lzo_uint u; lzo_uint32 u32; unsigned long l; } lzo_align_t; -+typedef union { -+ lzo_voidp a00; lzo_bytep a01; lzo_uint a02; lzo_xint a03; lzo_uintptr_t a04; -+ void *a05; unsigned char *a06; unsigned long a07; size_t a08; ptrdiff_t a09; -+#if defined(lzo_int64_t) -+ lzo_uint64_t a10; -+#endif -+} lzo_align_t; - - /* align a char pointer on a boundary that is a multiple of 'size' */ - LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size); -@@ -399,9 +376,30 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size); - - - /*********************************************************************** --// deprecated macros - only for backward compatibility with LZO v1.xx -+// deprecated macros - only for backward compatibility - ************************************************************************/ - -+/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */ -+#define lzo_byte unsigned char -+/* deprecated type names */ -+#define lzo_int32 lzo_int32_t -+#define lzo_uint32 lzo_uint32_t -+#define lzo_int32p lzo_int32_t __LZO_MMODEL * -+#define lzo_uint32p lzo_uint32_t __LZO_MMODEL * -+#define LZO_INT32_MAX LZO_INT32_C(2147483647) -+#define LZO_UINT32_MAX LZO_UINT32_C(4294967295) -+#if defined(lzo_int64_t) -+#define lzo_int64 lzo_int64_t -+#define lzo_uint64 lzo_uint64_t -+#define lzo_int64p lzo_int64_t __LZO_MMODEL * -+#define lzo_uint64p lzo_uint64_t __LZO_MMODEL * -+#define LZO_INT64_MAX LZO_INT64_C(9223372036854775807) -+#define LZO_UINT64_MAX LZO_UINT64_C(18446744073709551615) -+#endif -+/* deprecated types */ -+typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u; -+typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u; -+ - #if defined(LZO_CFG_COMPAT) - - #define __LZOCONF_H 1 -@@ -443,4 +441,4 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size); - #endif /* already included */ - - --/* vim:set ts=4 et: */ -+/* vim:set ts=4 sw=4 et: */ -diff --git a/grub-core/lib/minilzo/lzodefs.h b/grub-core/lib/minilzo/lzodefs.h -index 0e40e332a8d..f4ae9487ebe 100644 ---- a/grub-core/lib/minilzo/lzodefs.h -+++ b/grub-core/lib/minilzo/lzodefs.h -@@ -2,22 +2,7 @@ - - This file is part of the LZO real-time data compression library. - -- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer -+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or -@@ -47,12 +32,6 @@ - #if defined(__CYGWIN32__) && !defined(__CYGWIN__) - # define __CYGWIN__ __CYGWIN32__ - #endif --#if defined(__IBMCPP__) && !defined(__IBMC__) --# define __IBMC__ __IBMCPP__ --#endif --#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) --# define __INTEL_COMPILER __ICL --#endif - #if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) - # define _ALL_SOURCE 1 - #endif -@@ -61,19 +40,30 @@ - # define __LONG_MAX__ 9223372036854775807L - # endif - #endif --#if defined(__INTEL_COMPILER) && defined(__linux__) -+#if !defined(LZO_CFG_NO_DISABLE_WUNDEF) -+#if defined(__ARMCC_VERSION) -+# pragma diag_suppress 193 -+#elif defined(__clang__) && defined(__clang_minor__) -+# pragma clang diagnostic ignored "-Wundef" -+#elif defined(__INTEL_COMPILER) - # pragma warning(disable: 193) --#endif --#if defined(__KEIL__) && defined(__C166__) -+#elif defined(__KEIL__) && defined(__C166__) - # pragma warning disable = 322 --#elif 0 && defined(__C251__) --# pragma warning disable = 322 --#endif --#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) --# if (_MSC_VER >= 1300) -+#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__PATHSCALE__) -+# if ((__GNUC__-0) >= 5 || ((__GNUC__-0) == 4 && (__GNUC_MINOR__-0) >= 2)) -+# pragma GCC diagnostic ignored "-Wundef" -+# endif -+#elif defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -+# if ((_MSC_VER-0) >= 1300) - # pragma warning(disable: 4668) - # endif - #endif -+#endif -+#if 0 && defined(__POCC__) && defined(_WIN32) -+# if (__POCC__ >= 400) -+# pragma warn(disable: 2216) -+# endif -+#endif - #if 0 && defined(__WATCOMC__) - # if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) - # pragma warning 203 9 -@@ -82,13 +72,29 @@ - #if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) - # pragma option -h - #endif -+#if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC) -+#ifndef _CRT_NONSTDC_NO_DEPRECATE -+#define _CRT_NONSTDC_NO_DEPRECATE 1 -+#endif -+#ifndef _CRT_NONSTDC_NO_WARNINGS -+#define _CRT_NONSTDC_NO_WARNINGS 1 -+#endif -+#ifndef _CRT_SECURE_NO_DEPRECATE -+#define _CRT_SECURE_NO_DEPRECATE 1 -+#endif -+#ifndef _CRT_SECURE_NO_WARNINGS -+#define _CRT_SECURE_NO_WARNINGS 1 -+#endif -+#endif - #if 0 --#define LZO_0xffffL 0xfffful --#define LZO_0xffffffffL 0xfffffffful -+#define LZO_0xffffUL 0xfffful -+#define LZO_0xffffffffUL 0xfffffffful - #else --#define LZO_0xffffL 65535ul --#define LZO_0xffffffffL 4294967295ul -+#define LZO_0xffffUL 65535ul -+#define LZO_0xffffffffUL 4294967295ul - #endif -+#define LZO_0xffffL LZO_0xffffUL -+#define LZO_0xffffffffL LZO_0xffffffffUL - #if (LZO_0xffffL == LZO_0xffffffffL) - # error "your preprocessor is broken 1" - #endif -@@ -103,6 +109,13 @@ - # error "your preprocessor is broken 4" - #endif - #endif -+#if defined(__COUNTER__) -+# ifndef LZO_CFG_USE_COUNTER -+# define LZO_CFG_USE_COUNTER 1 -+# endif -+#else -+# undef LZO_CFG_USE_COUNTER -+#endif - #if (UINT_MAX == LZO_0xffffL) - #if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) - # if !defined(MSDOS) -@@ -233,14 +246,31 @@ - #endif - #define LZO_PP_STRINGIZE(x) #x - #define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -+#define LZO_PP_CONCAT0() /*empty*/ -+#define LZO_PP_CONCAT1(a) a - #define LZO_PP_CONCAT2(a,b) a ## b - #define LZO_PP_CONCAT3(a,b,c) a ## b ## c - #define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d - #define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -+#define LZO_PP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f -+#define LZO_PP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g -+#define LZO_PP_ECONCAT0() LZO_PP_CONCAT0() -+#define LZO_PP_ECONCAT1(a) LZO_PP_CONCAT1(a) - #define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) - #define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) - #define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) - #define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -+#define LZO_PP_ECONCAT6(a,b,c,d,e,f) LZO_PP_CONCAT6(a,b,c,d,e,f) -+#define LZO_PP_ECONCAT7(a,b,c,d,e,f,g) LZO_PP_CONCAT7(a,b,c,d,e,f,g) -+#define LZO_PP_EMPTY /*empty*/ -+#define LZO_PP_EMPTY0() /*empty*/ -+#define LZO_PP_EMPTY1(a) /*empty*/ -+#define LZO_PP_EMPTY2(a,b) /*empty*/ -+#define LZO_PP_EMPTY3(a,b,c) /*empty*/ -+#define LZO_PP_EMPTY4(a,b,c,d) /*empty*/ -+#define LZO_PP_EMPTY5(a,b,c,d,e) /*empty*/ -+#define LZO_PP_EMPTY6(a,b,c,d,e,f) /*empty*/ -+#define LZO_PP_EMPTY7(a,b,c,d,e,f,g) /*empty*/ - #if 1 - #define LZO_CPP_STRINGIZE(x) #x - #define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -@@ -248,12 +278,16 @@ - #define LZO_CPP_CONCAT3(a,b,c) a ## b ## c - #define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d - #define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -+#define LZO_CPP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f -+#define LZO_CPP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g - #define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) - #define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) - #define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) - #define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -+#define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f) -+#define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g) - #endif --#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) -+#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-!!(b))) - (o)) << 1) + (o)*!!(b)) - #if 1 && defined(__cplusplus) - # if !defined(__STDC_CONSTANT_MACROS) - # define __STDC_CONSTANT_MACROS 1 -@@ -263,9 +297,13 @@ - # endif - #endif - #if defined(__cplusplus) --# define LZO_EXTERN_C extern "C" -+# define LZO_EXTERN_C extern "C" -+# define LZO_EXTERN_C_BEGIN extern "C" { -+# define LZO_EXTERN_C_END } - #else --# define LZO_EXTERN_C extern -+# define LZO_EXTERN_C extern -+# define LZO_EXTERN_C_BEGIN /*empty*/ -+# define LZO_EXTERN_C_END /*empty*/ - #endif - #if !defined(__LZO_OS_OVERRIDE) - #if (LZO_OS_FREESTANDING) -@@ -366,12 +404,12 @@ - #elif defined(__VMS) - # define LZO_OS_VMS 1 - # define LZO_INFO_OS "vms" --#elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -+#elif (defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__) - # define LZO_OS_CONSOLE 1 - # define LZO_OS_CONSOLE_PS2 1 - # define LZO_INFO_OS "console" - # define LZO_INFO_OS_CONSOLE "ps2" --#elif (defined(__mips__) && defined(__psp__)) -+#elif defined(__mips__) && defined(__psp__) - # define LZO_OS_CONSOLE 1 - # define LZO_OS_CONSOLE_PSP 1 - # define LZO_INFO_OS "console" -@@ -399,9 +437,18 @@ - # elif defined(__linux__) || defined(__linux) || defined(__LINUX__) - # define LZO_OS_POSIX_LINUX 1 - # define LZO_INFO_OS_POSIX "linux" --# elif defined(__APPLE__) || defined(__MACOS__) --# define LZO_OS_POSIX_MACOSX 1 --# define LZO_INFO_OS_POSIX "macosx" -+# elif defined(__APPLE__) && defined(__MACH__) -+# if ((__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__-0) >= 20000) -+# define LZO_OS_POSIX_DARWIN 1040 -+# define LZO_INFO_OS_POSIX "darwin_iphone" -+# elif ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1040) -+# define LZO_OS_POSIX_DARWIN __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ -+# define LZO_INFO_OS_POSIX "darwin" -+# else -+# define LZO_OS_POSIX_DARWIN 1 -+# define LZO_INFO_OS_POSIX "darwin" -+# endif -+# define LZO_OS_POSIX_MACOSX LZO_OS_POSIX_DARWIN - # elif defined(__minix__) || defined(__minix) - # define LZO_OS_POSIX_MINIX 1 - # define LZO_INFO_OS_POSIX "minix" -@@ -436,18 +483,18 @@ - #endif - #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) - # if (UINT_MAX != LZO_0xffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (ULONG_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif - #if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) - # if (UINT_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (ULONG_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif - #if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -@@ -463,59 +510,65 @@ - # define LZO_INFO_CC "sdcc" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) - #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) --# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) -+# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__-0) * 0x100 + (__PATHCC_PATCHLEVEL__-0)) - # define LZO_INFO_CC "Pathscale C" - # define LZO_INFO_CCVER __PATHSCALE__ --#elif defined(__INTEL_COMPILER) --# define LZO_CC_INTELC 1 -+# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+# define LZO_CC_PATHSCALE_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -+# endif -+#elif defined(__INTEL_COMPILER) && ((__INTEL_COMPILER-0) > 0) -+# define LZO_CC_INTELC __INTEL_COMPILER - # define LZO_INFO_CC "Intel C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) --# if defined(_WIN32) || defined(_WIN64) --# define LZO_CC_SYNTAX_MSC 1 --# else --# define LZO_CC_SYNTAX_GNUC 1 -+# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -+# define LZO_CC_INTELC_MSC _MSC_VER -+# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+# define LZO_CC_INTELC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) - # endif - #elif defined(__POCC__) && defined(_WIN32) - # define LZO_CC_PELLESC 1 - # define LZO_INFO_CC "Pelles C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) --#elif defined(__clang__) && defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+#elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) - # if defined(__GNUC_PATCHLEVEL__) --# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -+# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) - # else --# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -+# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) - # endif -+# define LZO_CC_ARMCC __ARMCC_VERSION -+# define LZO_INFO_CC "ARM C Compiler" -+# define LZO_INFO_CCVER __VERSION__ -+#elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__) - # if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__) --# define LZO_CC_CLANG_CLANG (__clang_major__ * 0x10000L + __clang_minor__ * 0x100 + __clang_patchlevel__) -+# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) - # else --# define LZO_CC_CLANG_CLANG 0x010000L -+# define LZO_CC_CLANG 0x010000L -+# endif -+# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -+# define LZO_CC_CLANG_MSC _MSC_VER -+# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) - # endif --# define LZO_CC_CLANG LZO_CC_CLANG_GNUC - # define LZO_INFO_CC "clang" - # define LZO_INFO_CCVER __VERSION__ - #elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) - # if defined(__GNUC_PATCHLEVEL__) --# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -+# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) - # else --# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -+# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) - # endif - # define LZO_CC_LLVM LZO_CC_LLVM_GNUC - # define LZO_INFO_CC "llvm-gcc" - # define LZO_INFO_CCVER __VERSION__ --#elif defined(__GNUC__) && defined(__VERSION__) --# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) --# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) --# elif defined(__GNUC_MINOR__) --# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) --# else --# define LZO_CC_GNUC (__GNUC__ * 0x10000L) --# endif --# define LZO_INFO_CC "gcc" --# define LZO_INFO_CCVER __VERSION__ - #elif defined(__ACK__) && defined(_ACK) - # define LZO_CC_ACK 1 - # define LZO_INFO_CC "Amsterdam Compiler Kit C" - # define LZO_INFO_CCVER "unknown" -+#elif defined(__ARMCC_VERSION) && !defined(__GNUC__) -+# define LZO_CC_ARMCC __ARMCC_VERSION -+# define LZO_CC_ARMCC_ARMCC __ARMCC_VERSION -+# define LZO_INFO_CC "ARM C Compiler" -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ARMCC_VERSION) - #elif defined(__AZTEC_C__) - # define LZO_CC_AZTECC 1 - # define LZO_INFO_CC "Aztec C" -@@ -540,10 +593,23 @@ - # define LZO_CC_DECC 1 - # define LZO_INFO_CC "DEC C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -+#elif (defined(__ghs) || defined(__ghs__)) && defined(__GHS_VERSION_NUMBER) && ((__GHS_VERSION_NUMBER-0) > 0) -+# define LZO_CC_GHS 1 -+# define LZO_INFO_CC "Green Hills C" -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__GHS_VERSION_NUMBER) -+# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -+# define LZO_CC_GHS_MSC _MSC_VER -+# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -+# define LZO_CC_GHS_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -+# endif - #elif defined(__HIGHC__) - # define LZO_CC_HIGHC 1 - # define LZO_INFO_CC "MetaWare High C" - # define LZO_INFO_CCVER "unknown" -+#elif defined(__HP_aCC) && ((__HP_aCC-0) > 0) -+# define LZO_CC_HPACC __HP_aCC -+# define LZO_INFO_CC "HP aCC" -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__HP_aCC) - #elif defined(__IAR_SYSTEMS_ICC__) - # define LZO_CC_IARC 1 - # define LZO_INFO_CC "IAR C" -@@ -552,10 +618,14 @@ - # else - # define LZO_INFO_CCVER "unknown" - # endif --#elif defined(__IBMC__) --# define LZO_CC_IBMC 1 -+#elif defined(__IBMC__) && ((__IBMC__-0) > 0) -+# define LZO_CC_IBMC __IBMC__ - # define LZO_INFO_CC "IBM C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -+#elif defined(__IBMCPP__) && ((__IBMCPP__-0) > 0) -+# define LZO_CC_IBMC __IBMCPP__ -+# define LZO_INFO_CC "IBM C" -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMCPP__) - #elif defined(__KEIL__) && defined(__C166__) - # define LZO_CC_KEILC 1 - # define LZO_INFO_CC "Keil C" -@@ -572,16 +642,8 @@ - # else - # define LZO_INFO_CCVER "unknown" - # endif --#elif defined(_MSC_VER) --# define LZO_CC_MSC 1 --# define LZO_INFO_CC "Microsoft C" --# if defined(_MSC_FULL_VER) --# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) --# else --# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) --# endif --#elif defined(__MWERKS__) --# define LZO_CC_MWERKS 1 -+#elif defined(__MWERKS__) && ((__MWERKS__-0) > 0) -+# define LZO_CC_MWERKS __MWERKS__ - # define LZO_INFO_CC "Metrowerks C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) - #elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -@@ -592,6 +654,15 @@ - # define LZO_CC_PACIFICC 1 - # define LZO_INFO_CC "Pacific C" - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -+#elif defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) -+# if defined(__PGIC_PATCHLEVEL__) -+# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100 + (__PGIC_PATCHLEVEL__-0)) -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) "." LZO_PP_MACRO_EXPAND(__PGIC_PATCHLEVEL__) -+# else -+# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100) -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) ".0" -+# endif -+# define LZO_INFO_CC "Portland Group PGI C" - #elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) - # define LZO_CC_PGI 1 - # define LZO_INFO_CC "Portland Group PGI C" -@@ -606,7 +677,7 @@ - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) - #elif defined(__SUNPRO_C) - # define LZO_INFO_CC "SunPro C" --# if ((__SUNPRO_C)+0 > 0) -+# if ((__SUNPRO_C-0) > 0) - # define LZO_CC_SUNPROC __SUNPRO_C - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) - # else -@@ -615,7 +686,7 @@ - # endif - #elif defined(__SUNPRO_CC) - # define LZO_INFO_CC "SunPro C" --# if ((__SUNPRO_CC)+0 > 0) -+# if ((__SUNPRO_CC-0) > 0) - # define LZO_CC_SUNPROC __SUNPRO_CC - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) - # else -@@ -641,16 +712,46 @@ - #elif defined(__ZTC__) - # define LZO_CC_ZORTECHC 1 - # define LZO_INFO_CC "Zortech C" --# if (__ZTC__ == 0x310) -+# if ((__ZTC__-0) == 0x310) - # define LZO_INFO_CCVER "0x310" - # else - # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) - # endif -+#elif defined(__GNUC__) && defined(__VERSION__) -+# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -+# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -+# elif defined(__GNUC_MINOR__) -+# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) -+# else -+# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -+# endif -+# define LZO_INFO_CC "gcc" -+# define LZO_INFO_CCVER __VERSION__ -+#elif defined(_MSC_VER) && ((_MSC_VER-0) > 0) -+# define LZO_CC_MSC _MSC_VER -+# define LZO_INFO_CC "Microsoft C" -+# if defined(_MSC_FULL_VER) -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -+# else -+# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -+# endif - #else - # define LZO_CC_UNKNOWN 1 - # define LZO_INFO_CC "unknown" - # define LZO_INFO_CCVER "unknown" - #endif -+#if (LZO_CC_GNUC) && defined(__OPEN64__) -+# if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__) -+# define LZO_CC_OPEN64 (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__-0) * 0x100 + (__OPENCC_PATCHLEVEL__-0)) -+# define LZO_CC_OPEN64_GNUC LZO_CC_GNUC -+# endif -+#endif -+#if (LZO_CC_GNUC) && defined(__PCC__) -+# if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__) -+# define LZO_CC_PCC (__PCC__ * 0x10000L + (__PCC_MINOR__-0) * 0x100 + (__PCC_MINORMINOR__-0)) -+# define LZO_CC_PCC_GNUC LZO_CC_GNUC -+# endif -+#endif - #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) - # error "LZO_CC_MSC: _MSC_FULL_VER is not defined" - #endif -@@ -668,8 +769,10 @@ - # define LZO_INFO_ARCH "generic" - #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) - # define LZO_ARCH_I086 1 --# define LZO_ARCH_IA16 1 - # define LZO_INFO_ARCH "i086" -+#elif defined(__aarch64__) -+# define LZO_ARCH_ARM64 1 -+# define LZO_INFO_ARCH "arm64" - #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) - # define LZO_ARCH_ALPHA 1 - # define LZO_INFO_ARCH "alpha" -@@ -685,10 +788,10 @@ - # define LZO_INFO_ARCH "arm_thumb" - #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) - # define LZO_ARCH_ARM 1 --# if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) -+# if defined(__CPU_MODE__) && ((__CPU_MODE__-0) == 1) - # define LZO_ARCH_ARM_THUMB 1 - # define LZO_INFO_ARCH "arm_thumb" --# elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) -+# elif defined(__CPU_MODE__) && ((__CPU_MODE__-0) == 2) - # define LZO_INFO_ARCH "arm" - # else - # define LZO_INFO_ARCH "arm" -@@ -806,53 +909,147 @@ - # error "FIXME - missing define for CPU architecture" - #endif - #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) --# error "FIXME - missing WIN32 define for CPU architecture" -+# error "FIXME - missing LZO_OS_WIN32 define for CPU architecture" - #endif - #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) --# error "FIXME - missing WIN64 define for CPU architecture" -+# error "FIXME - missing LZO_OS_WIN64 define for CPU architecture" - #endif - #if (LZO_OS_OS216 || LZO_OS_WIN16) - # define LZO_ARCH_I086PM 1 --# define LZO_ARCH_IA16PM 1 - #elif 1 && (LZO_OS_DOS16 && defined(BLX286)) - # define LZO_ARCH_I086PM 1 --# define LZO_ARCH_IA16PM 1 - #elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) - # define LZO_ARCH_I086PM 1 --# define LZO_ARCH_IA16PM 1 - #elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) - # define LZO_ARCH_I086PM 1 --# define LZO_ARCH_IA16PM 1 - #endif --#if (LZO_ARCH_ARM_THUMB) && !(LZO_ARCH_ARM) --# error "this should not happen" -+#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) -+# define LZO_ARCH_X64 1 -+#elif (!LZO_ARCH_AMD64 && LZO_ARCH_X64) && defined(__LZO_ARCH_OVERRIDE) -+# define LZO_ARCH_AMD64 1 - #endif --#if (LZO_ARCH_I086PM) && !(LZO_ARCH_I086) --# error "this should not happen" -+#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) -+# define LZO_ARCH_AARCH64 1 -+#elif (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) && defined(__LZO_ARCH_OVERRIDE) -+# define LZO_ARCH_ARM64 1 -+#endif -+#if (LZO_ARCH_I386 && !LZO_ARCH_X86) -+# define LZO_ARCH_X86 1 -+#elif (!LZO_ARCH_I386 && LZO_ARCH_X86) && defined(__LZO_ARCH_OVERRIDE) -+# define LZO_ARCH_I386 1 -+#endif -+#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) || (!LZO_ARCH_AMD64 && LZO_ARCH_X64) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) || (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM_THUMB && !LZO_ARCH_ARM) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM_THUMB) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM_THUMB) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_I086PM && !LZO_ARCH_I086) -+# error "unexpected configuration - check your compiler defines" - #endif - #if (LZO_ARCH_I086) - # if (UINT_MAX != LZO_0xffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (ULONG_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif - #if (LZO_ARCH_I386) - # if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - # if (ULONG_MAX != LZO_0xffffffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif --#if !defined(__LZO_MM_OVERRIDE) -+#if (LZO_ARCH_AMD64 || LZO_ARCH_I386) -+# if !defined(LZO_TARGET_FEATURE_SSE2) -+# if defined(__SSE2__) -+# define LZO_TARGET_FEATURE_SSE2 1 -+# elif defined(_MSC_VER) && ((defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2)) || defined(_M_AMD64)) -+# define LZO_TARGET_FEATURE_SSE2 1 -+# endif -+# endif -+# if !defined(LZO_TARGET_FEATURE_SSSE3) -+# if (LZO_TARGET_FEATURE_SSE2) -+# if defined(__SSSE3__) -+# define LZO_TARGET_FEATURE_SSSE3 1 -+# elif defined(_MSC_VER) && defined(__AVX__) -+# define LZO_TARGET_FEATURE_SSSE3 1 -+# endif -+# endif -+# endif -+# if !defined(LZO_TARGET_FEATURE_SSE4_2) -+# if (LZO_TARGET_FEATURE_SSSE3) -+# if defined(__SSE4_2__) -+# define LZO_TARGET_FEATURE_SSE4_2 1 -+# endif -+# endif -+# endif -+# if !defined(LZO_TARGET_FEATURE_AVX) -+# if (LZO_TARGET_FEATURE_SSSE3) -+# if defined(__AVX__) -+# define LZO_TARGET_FEATURE_AVX 1 -+# endif -+# endif -+# endif -+# if !defined(LZO_TARGET_FEATURE_AVX2) -+# if (LZO_TARGET_FEATURE_AVX) -+# if defined(__AVX2__) -+# define LZO_TARGET_FEATURE_AVX2 1 -+# endif -+# endif -+# endif -+#endif -+#if (LZO_TARGET_FEATURE_SSSE3 && !(LZO_TARGET_FEATURE_SSE2)) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_TARGET_FEATURE_SSE4_2 && !(LZO_TARGET_FEATURE_SSSE3)) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_TARGET_FEATURE_AVX && !(LZO_TARGET_FEATURE_SSSE3)) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_TARGET_FEATURE_AVX2 && !(LZO_TARGET_FEATURE_AVX)) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if (LZO_ARCH_ARM) -+# if !defined(LZO_TARGET_FEATURE_NEON) -+# if defined(__ARM_NEON__) -+# define LZO_TARGET_FEATURE_NEON 1 -+# endif -+# endif -+#elif (LZO_ARCH_ARM64) -+# if !defined(LZO_TARGET_FEATURE_NEON) -+# if 1 -+# define LZO_TARGET_FEATURE_NEON 1 -+# endif -+# endif -+#endif -+#if 0 -+#elif !defined(__LZO_MM_OVERRIDE) - #if (LZO_ARCH_I086) - #if (UINT_MAX != LZO_0xffffL) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - #endif - #if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) - # define LZO_MM_TINY 1 -@@ -879,7 +1076,7 @@ - #elif (LZO_CC_ZORTECHC && defined(__VCM__)) - # define LZO_MM_LARGE 1 - #else --# error "unknown memory model" -+# error "unknown LZO_ARCH_I086 memory model" - #endif - #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) - #define LZO_HAVE_MM_HUGE_PTR 1 -@@ -902,10 +1099,10 @@ - #endif - #if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR) - # if (LZO_OS_DOS16) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # elif (LZO_CC_ZORTECHC) - # else --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - # endif - #endif - #ifdef __cplusplus -@@ -937,7 +1134,7 @@ extern "C" { - #endif - #elif (LZO_ARCH_C166) - #if !defined(__MODEL__) --# error "FIXME - C166 __MODEL__" -+# error "FIXME - LZO_ARCH_C166 __MODEL__" - #elif ((__MODEL__) == 0) - # define LZO_MM_SMALL 1 - #elif ((__MODEL__) == 1) -@@ -951,11 +1148,11 @@ extern "C" { - #elif ((__MODEL__) == 5) - # define LZO_MM_XSMALL 1 - #else --# error "FIXME - C166 __MODEL__" -+# error "FIXME - LZO_ARCH_C166 __MODEL__" - #endif - #elif (LZO_ARCH_MCS251) - #if !defined(__MODEL__) --# error "FIXME - MCS251 __MODEL__" -+# error "FIXME - LZO_ARCH_MCS251 __MODEL__" - #elif ((__MODEL__) == 0) - # define LZO_MM_SMALL 1 - #elif ((__MODEL__) == 2) -@@ -967,11 +1164,11 @@ extern "C" { - #elif ((__MODEL__) == 5) - # define LZO_MM_XSMALL 1 - #else --# error "FIXME - MCS251 __MODEL__" -+# error "FIXME - LZO_ARCH_MCS251 __MODEL__" - #endif - #elif (LZO_ARCH_MCS51) - #if !defined(__MODEL__) --# error "FIXME - MCS51 __MODEL__" -+# error "FIXME - LZO_ARCH_MCS51 __MODEL__" - #elif ((__MODEL__) == 1) - # define LZO_MM_SMALL 1 - #elif ((__MODEL__) == 2) -@@ -983,7 +1180,7 @@ extern "C" { - #elif ((__MODEL__) == 5) - # define LZO_MM_XSMALL 1 - #else --# error "FIXME - MCS51 __MODEL__" -+# error "FIXME - LZO_ARCH_MCS51 __MODEL__" - #endif - #elif (LZO_ARCH_CRAY_PVP) - # define LZO_MM_PVP 1 -@@ -1010,35 +1207,818 @@ extern "C" { - # error "unknown memory model" - #endif - #endif -+#if !defined(__lzo_gnuc_extension__) -+#if (LZO_CC_GNUC >= 0x020800ul) -+# define __lzo_gnuc_extension__ __extension__ -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_gnuc_extension__ __extension__ -+#elif (LZO_CC_IBMC >= 600) -+# define __lzo_gnuc_extension__ __extension__ -+#else -+#endif -+#endif -+#if !defined(__lzo_gnuc_extension__) -+# define __lzo_gnuc_extension__ /*empty*/ -+#endif -+#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0 -+# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) -+# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -+# elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1200)) -+# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -+# else -+# define LZO_CFG_USE_NEW_STYLE_CASTS 1 -+# endif -+#endif -+#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -+#endif -+#if !defined(__cplusplus) -+# if defined(LZO_CFG_USE_NEW_STYLE_CASTS) -+# undef LZO_CFG_USE_NEW_STYLE_CASTS -+# endif -+# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -+#endif -+#if !defined(LZO_REINTERPRET_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_REINTERPRET_CAST(t,e) (reinterpret_cast (e)) -+# endif -+#endif -+#if !defined(LZO_REINTERPRET_CAST) -+# define LZO_REINTERPRET_CAST(t,e) ((t) (e)) -+#endif -+#if !defined(LZO_STATIC_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_STATIC_CAST(t,e) (static_cast (e)) -+# endif -+#endif -+#if !defined(LZO_STATIC_CAST) -+# define LZO_STATIC_CAST(t,e) ((t) (e)) -+#endif -+#if !defined(LZO_STATIC_CAST2) -+# define LZO_STATIC_CAST2(t1,t2,e) LZO_STATIC_CAST(t1, LZO_STATIC_CAST(t2, e)) -+#endif -+#if !defined(LZO_UNCONST_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_UNCONST_CAST(t,e) (const_cast (e)) -+# elif (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_UNCONST_CAST(t,e) ((t) (e)) -+# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((const void *) (e))))) -+# endif -+#endif -+#if !defined(LZO_UNCONST_CAST) -+# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((const void *) (e)))) -+#endif -+#if !defined(LZO_UNCONST_VOLATILE_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_UNCONST_VOLATILE_CAST(t,e) (const_cast (e)) -+# elif (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) (e)) -+# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) -+# endif -+#endif -+#if !defined(LZO_UNCONST_VOLATILE_CAST) -+# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((volatile const void *) (e)))) -+#endif -+#if !defined(LZO_UNVOLATILE_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_UNVOLATILE_CAST(t,e) (const_cast (e)) -+# elif (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_UNVOLATILE_CAST(t,e) ((t) (e)) -+# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((volatile void *) (e))))) -+# endif -+#endif -+#if !defined(LZO_UNVOLATILE_CAST) -+# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((volatile void *) (e)))) -+#endif -+#if !defined(LZO_UNVOLATILE_CONST_CAST) -+# if (LZO_CFG_USE_NEW_STYLE_CASTS) -+# define LZO_UNVOLATILE_CONST_CAST(t,e) (const_cast (e)) -+# elif (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) (e)) -+# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) -+# endif -+#endif -+#if !defined(LZO_UNVOLATILE_CONST_CAST) -+# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((volatile const void *) (e)))) -+#endif -+#if !defined(LZO_PCAST) -+# if (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_PCAST(t,e) ((t) (e)) -+# endif -+#endif -+#if !defined(LZO_PCAST) -+# define LZO_PCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(void *, e)) -+#endif -+#if !defined(LZO_CCAST) -+# if (LZO_HAVE_MM_HUGE_PTR) -+# define LZO_CCAST(t,e) ((t) (e)) -+# endif -+#endif -+#if !defined(LZO_CCAST) -+# define LZO_CCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(const void *, e)) -+#endif -+#if !defined(LZO_ICONV) -+# define LZO_ICONV(t,e) LZO_STATIC_CAST(t, e) -+#endif -+#if !defined(LZO_ICAST) -+# define LZO_ICAST(t,e) LZO_STATIC_CAST(t, e) -+#endif -+#if !defined(LZO_ITRUNC) -+# define LZO_ITRUNC(t,e) LZO_STATIC_CAST(t, e) -+#endif -+#if !defined(__lzo_cte) -+# if (LZO_CC_MSC || LZO_CC_WATCOMC) -+# define __lzo_cte(e) ((void)0,(e)) -+# elif 1 -+# define __lzo_cte(e) ((void)0,(e)) -+# endif -+#endif -+#if !defined(__lzo_cte) -+# define __lzo_cte(e) (e) -+#endif -+#if !defined(LZO_BLOCK_BEGIN) -+# define LZO_BLOCK_BEGIN do { -+# define LZO_BLOCK_END } while __lzo_cte(0) -+#endif -+#if !defined(LZO_UNUSED) -+# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -+# define LZO_UNUSED(var) ((void) &var) -+# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -+# define LZO_UNUSED(var) if (&var) ; else -+# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030200ul)) -+# define LZO_UNUSED(var) ((void) &var) -+# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define LZO_UNUSED(var) ((void) var) -+# elif (LZO_CC_MSC && (_MSC_VER < 900)) -+# define LZO_UNUSED(var) if (&var) ; else -+# elif (LZO_CC_KEILC) -+# define LZO_UNUSED(var) {LZO_EXTERN_C int lzo_unused__[1-2*!(sizeof(var)>0)];} -+# elif (LZO_CC_PACIFICC) -+# define LZO_UNUSED(var) ((void) sizeof(var)) -+# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -+# define LZO_UNUSED(var) ((void) var) -+# else -+# define LZO_UNUSED(var) ((void) &var) -+# endif -+#endif -+#if !defined(LZO_UNUSED_FUNC) -+# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -+# define LZO_UNUSED_FUNC(func) ((void) func) -+# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -+# define LZO_UNUSED_FUNC(func) if (func) ; else -+# elif (LZO_CC_CLANG || LZO_CC_LLVM) -+# define LZO_UNUSED_FUNC(func) ((void) &func) -+# elif (LZO_CC_MSC && (_MSC_VER < 900)) -+# define LZO_UNUSED_FUNC(func) if (func) ; else -+# elif (LZO_CC_MSC) -+# define LZO_UNUSED_FUNC(func) ((void) &func) -+# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -+# define LZO_UNUSED_FUNC(func) {LZO_EXTERN_C int lzo_unused_func__[1-2*!(sizeof((int)func)>0)];} -+# else -+# define LZO_UNUSED_FUNC(func) ((void) func) -+# endif -+#endif -+#if !defined(LZO_UNUSED_LABEL) -+# if (LZO_CC_CLANG >= 0x020800ul) -+# define LZO_UNUSED_LABEL(l) (__lzo_gnuc_extension__ ((void) ((const void *) &&l))) -+# elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) -+# define LZO_UNUSED_LABEL(l) if __lzo_cte(0) goto l -+# else -+# define LZO_UNUSED_LABEL(l) switch (0) case 1:goto l -+# endif -+#endif -+#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -+# if 0 -+# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -+# elif 0 && (LZO_CC_GNUC) -+# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -+# else -+# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -+# endif -+#endif -+#if !defined(__lzo_inline) -+#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -+#elif defined(__cplusplus) -+# define __lzo_inline inline -+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) -+# define __lzo_inline inline -+#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -+# define __lzo_inline __inline -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -+# define __lzo_inline __inline__ -+#elif (LZO_CC_DMC) -+# define __lzo_inline __inline -+#elif (LZO_CC_GHS) -+# define __lzo_inline __inline__ -+#elif (LZO_CC_IBMC >= 600) -+# define __lzo_inline __inline__ -+#elif (LZO_CC_INTELC) -+# define __lzo_inline __inline -+#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -+# define __lzo_inline __inline -+#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -+# define __lzo_inline __inline -+#elif (LZO_CC_SUNPROC >= 0x5100) -+# define __lzo_inline __inline__ -+#endif -+#endif -+#if defined(__lzo_inline) -+# ifndef __lzo_HAVE_inline -+# define __lzo_HAVE_inline 1 -+# endif -+#else -+# define __lzo_inline /*empty*/ -+#endif -+#if !defined(__lzo_forceinline) -+#if (LZO_CC_GNUC >= 0x030200ul) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) -+# define __lzo_forceinline __forceinline -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -+# define __lzo_forceinline __forceinline -+#elif (LZO_CC_PGI >= 0x0d0a00ul) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#elif (LZO_CC_SUNPROC >= 0x5100) -+# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -+#endif -+#endif -+#if defined(__lzo_forceinline) -+# ifndef __lzo_HAVE_forceinline -+# define __lzo_HAVE_forceinline 1 -+# endif -+#else -+# define __lzo_forceinline __lzo_inline -+#endif -+#if !defined(__lzo_noinline) -+#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -+# define __lzo_noinline __attribute__((__noinline__,__used__)) -+#elif (LZO_CC_GNUC >= 0x030200ul) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) -+# define __lzo_noinline __declspec(noinline) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_noinline __declspec(noinline) -+#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -+# if defined(__cplusplus) -+# else -+# define __lzo_noinline __declspec(noinline) -+# endif -+#elif (LZO_CC_PGI >= 0x0d0a00ul) -+# define __lzo_noinline __attribute__((__noinline__)) -+#elif (LZO_CC_SUNPROC >= 0x5100) -+# define __lzo_noinline __attribute__((__noinline__)) -+#endif -+#endif -+#if defined(__lzo_noinline) -+# ifndef __lzo_HAVE_noinline -+# define __lzo_HAVE_noinline 1 -+# endif -+#else -+# define __lzo_noinline /*empty*/ -+#endif -+#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if !defined(__lzo_static_inline) -+#if (LZO_CC_IBMC) -+# define __lzo_static_inline __lzo_gnuc_extension__ static __lzo_inline -+#endif -+#endif -+#if !defined(__lzo_static_inline) -+# define __lzo_static_inline static __lzo_inline -+#endif -+#if !defined(__lzo_static_forceinline) -+#if (LZO_CC_IBMC) -+# define __lzo_static_forceinline __lzo_gnuc_extension__ static __lzo_forceinline -+#endif -+#endif -+#if !defined(__lzo_static_forceinline) -+# define __lzo_static_forceinline static __lzo_forceinline -+#endif -+#if !defined(__lzo_static_noinline) -+#if (LZO_CC_IBMC) -+# define __lzo_static_noinline __lzo_gnuc_extension__ static __lzo_noinline -+#endif -+#endif -+#if !defined(__lzo_static_noinline) -+# define __lzo_static_noinline static __lzo_noinline -+#endif -+#if !defined(__lzo_c99_extern_inline) -+#if defined(__GNUC_GNU_INLINE__) -+# define __lzo_c99_extern_inline __lzo_inline -+#elif defined(__GNUC_STDC_INLINE__) -+# define __lzo_c99_extern_inline extern __lzo_inline -+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) -+# define __lzo_c99_extern_inline extern __lzo_inline -+#endif -+#if !defined(__lzo_c99_extern_inline) && (__lzo_HAVE_inline) -+# define __lzo_c99_extern_inline __lzo_inline -+#endif -+#endif -+#if defined(__lzo_c99_extern_inline) -+# ifndef __lzo_HAVE_c99_extern_inline -+# define __lzo_HAVE_c99_extern_inline 1 -+# endif -+#else -+# define __lzo_c99_extern_inline /*empty*/ -+#endif -+#if !defined(__lzo_may_alias) -+#if (LZO_CC_GNUC >= 0x030400ul) -+# define __lzo_may_alias __attribute__((__may_alias__)) -+#elif (LZO_CC_CLANG >= 0x020900ul) -+# define __lzo_may_alias __attribute__((__may_alias__)) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1210)) && 0 -+# define __lzo_may_alias __attribute__((__may_alias__)) -+#elif (LZO_CC_PGI >= 0x0d0a00ul) && 0 -+# define __lzo_may_alias __attribute__((__may_alias__)) -+#endif -+#endif -+#if defined(__lzo_may_alias) -+# ifndef __lzo_HAVE_may_alias -+# define __lzo_HAVE_may_alias 1 -+# endif -+#else -+# define __lzo_may_alias /*empty*/ -+#endif -+#if !defined(__lzo_noreturn) -+#if (LZO_CC_GNUC >= 0x020700ul) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) -+# define __lzo_noreturn __declspec(noreturn) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -+# define __lzo_noreturn __declspec(noreturn) -+#elif (LZO_CC_PGI >= 0x0d0a00ul) -+# define __lzo_noreturn __attribute__((__noreturn__)) -+#endif -+#endif -+#if defined(__lzo_noreturn) -+# ifndef __lzo_HAVE_noreturn -+# define __lzo_HAVE_noreturn 1 -+# endif -+#else -+# define __lzo_noreturn /*empty*/ -+#endif -+#if !defined(__lzo_nothrow) -+#if (LZO_CC_GNUC >= 0x030300ul) -+# define __lzo_nothrow __attribute__((__nothrow__)) -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) && defined(__cplusplus) -+# define __lzo_nothrow __declspec(nothrow) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 900)) -+# define __lzo_nothrow __attribute__((__nothrow__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_nothrow __attribute__((__nothrow__)) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -+# define __lzo_nothrow __declspec(nothrow) -+#endif -+#endif -+#if defined(__lzo_nothrow) -+# ifndef __lzo_HAVE_nothrow -+# define __lzo_HAVE_nothrow 1 -+# endif -+#else -+# define __lzo_nothrow /*empty*/ -+#endif -+#if !defined(__lzo_restrict) -+#if (LZO_CC_GNUC >= 0x030400ul) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_IBMC >= 800) && !defined(__cplusplus) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_IBMC >= 1210) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM) -+# define __lzo_restrict __restrict__ -+#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -+# define __lzo_restrict __restrict -+#elif (LZO_CC_PGI >= 0x0d0a00ul) -+# define __lzo_restrict __restrict__ -+#endif -+#endif -+#if defined(__lzo_restrict) -+# ifndef __lzo_HAVE_restrict -+# define __lzo_HAVE_restrict 1 -+# endif -+#else -+# define __lzo_restrict /*empty*/ -+#endif -+#if !defined(__lzo_alignof) -+#if (LZO_CC_ARMCC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -+# define __lzo_alignof(e) __alignof__(e) -+#elif (LZO_CC_GHS) && !defined(__cplusplus) -+# define __lzo_alignof(e) __alignof__(e) -+#elif (LZO_CC_IBMC >= 600) -+# define __lzo_alignof(e) (__lzo_gnuc_extension__ __alignof__(e)) -+#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -+# define __lzo_alignof(e) __alignof__(e) -+#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_alignof(e) __alignof(e) -+#elif (LZO_CC_SUNPROC >= 0x5100) -+# define __lzo_alignof(e) __alignof__(e) -+#endif -+#endif -+#if defined(__lzo_alignof) -+# ifndef __lzo_HAVE_alignof -+# define __lzo_HAVE_alignof 1 -+# endif -+#endif -+#if !defined(__lzo_struct_packed) -+#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) -+#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) -+#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) -+#elif (LZO_CC_GNUC >= 0x030400ul) && !(LZO_CC_PCC_GNUC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -+# define __lzo_struct_packed(s) struct s { -+# define __lzo_struct_packed_end() } __attribute__((__gcc_struct__,__packed__)); -+# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__gcc_struct__,__packed__)); -+#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) -+# define __lzo_struct_packed(s) struct s { -+# define __lzo_struct_packed_end() } __attribute__((__packed__)); -+# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_struct_packed(s) __lzo_gnuc_extension__ struct s { -+# define __lzo_struct_packed_end() } __attribute__((__packed__)); -+# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); -+#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_struct_packed(s) __pragma(pack(push,1)) struct s { -+# define __lzo_struct_packed_end() } __pragma(pack(pop)); -+#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) -+# define __lzo_struct_packed(s) _Packed struct s { -+# define __lzo_struct_packed_end() }; -+#endif -+#endif -+#if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma) -+# define __lzo_struct_packed_ma(s) __lzo_struct_packed(s) -+#endif -+#if defined(__lzo_struct_packed_end) && !defined(__lzo_struct_packed_ma_end) -+# define __lzo_struct_packed_ma_end() __lzo_struct_packed_end() -+#endif -+#if !defined(__lzo_byte_struct) -+#if defined(__lzo_struct_packed) -+# define __lzo_byte_struct(s,n) __lzo_struct_packed(s) unsigned char a[n]; __lzo_struct_packed_end() -+# define __lzo_byte_struct_ma(s,n) __lzo_struct_packed_ma(s) unsigned char a[n]; __lzo_struct_packed_ma_end() -+#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_PGI || (LZO_CC_SUNPROC >= 0x5100)) -+# define __lzo_byte_struct(s,n) struct s { unsigned char a[n]; } __attribute__((__packed__)); -+# define __lzo_byte_struct_ma(s,n) struct s { unsigned char a[n]; } __lzo_may_alias __attribute__((__packed__)); -+#endif -+#endif -+#if defined(__lzo_byte_struct) && !defined(__lzo_byte_struct_ma) -+# define __lzo_byte_struct_ma(s,n) __lzo_byte_struct(s,n) -+#endif -+#if !defined(__lzo_struct_align16) && (__lzo_HAVE_alignof) -+#if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul)) -+#elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_CILLY || LZO_CC_PCC) -+#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_struct_align16(s) struct __declspec(align(16)) s { -+# define __lzo_struct_align16_end() }; -+# define __lzo_struct_align32(s) struct __declspec(align(32)) s { -+# define __lzo_struct_align32_end() }; -+# define __lzo_struct_align64(s) struct __declspec(align(64)) s { -+# define __lzo_struct_align64_end() }; -+#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || (LZO_CC_IBMC >= 700) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_struct_align16(s) struct s { -+# define __lzo_struct_align16_end() } __attribute__((__aligned__(16))); -+# define __lzo_struct_align32(s) struct s { -+# define __lzo_struct_align32_end() } __attribute__((__aligned__(32))); -+# define __lzo_struct_align64(s) struct s { -+# define __lzo_struct_align64_end() } __attribute__((__aligned__(64))); -+#endif -+#endif -+#if !defined(__lzo_union_um) -+#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) -+#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER < 810)) -+#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) -+#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) -+#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) -+# define __lzo_union_am(s) union s { -+# define __lzo_union_am_end() } __lzo_may_alias; -+# define __lzo_union_um(s) union s { -+# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); -+#elif (LZO_CC_IBMC >= 700) -+# define __lzo_union_am(s) __lzo_gnuc_extension__ union s { -+# define __lzo_union_am_end() } __lzo_may_alias; -+# define __lzo_union_um(s) __lzo_gnuc_extension__ union s { -+# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); -+#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -+# define __lzo_union_um(s) __pragma(pack(push,1)) union s { -+# define __lzo_union_um_end() } __pragma(pack(pop)); -+#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) -+# define __lzo_union_um(s) _Packed union s { -+# define __lzo_union_um_end() }; -+#endif -+#endif -+#if !defined(__lzo_union_am) -+# define __lzo_union_am(s) union s { -+# define __lzo_union_am_end() }; -+#endif -+#if !defined(__lzo_constructor) -+#if (LZO_CC_GNUC >= 0x030400ul) -+# define __lzo_constructor __attribute__((__constructor__,__used__)) -+#elif (LZO_CC_GNUC >= 0x020700ul) -+# define __lzo_constructor __attribute__((__constructor__)) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -+# define __lzo_constructor __attribute__((__constructor__,__used__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_constructor __attribute__((__constructor__)) -+#endif -+#endif -+#if defined(__lzo_constructor) -+# ifndef __lzo_HAVE_constructor -+# define __lzo_HAVE_constructor 1 -+# endif -+#endif -+#if !defined(__lzo_destructor) -+#if (LZO_CC_GNUC >= 0x030400ul) -+# define __lzo_destructor __attribute__((__destructor__,__used__)) -+#elif (LZO_CC_GNUC >= 0x020700ul) -+# define __lzo_destructor __attribute__((__destructor__)) -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -+# define __lzo_destructor __attribute__((__destructor__,__used__)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_destructor __attribute__((__destructor__)) -+#endif -+#endif -+#if defined(__lzo_destructor) -+# ifndef __lzo_HAVE_destructor -+# define __lzo_HAVE_destructor 1 -+# endif -+#endif -+#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) -+# error "unexpected configuration - check your compiler defines" -+#endif -+#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -+#if (LZO_CC_GNUC >= 0x030200ul) -+# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -+# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -+#elif (LZO_CC_IBMC >= 1010) -+# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -+# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -+#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -+# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -+# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -+# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -+#endif -+#endif -+#if defined(__lzo_likely) -+# ifndef __lzo_HAVE_likely -+# define __lzo_HAVE_likely 1 -+# endif -+#else -+# define __lzo_likely(e) (e) -+#endif -+#if defined(__lzo_unlikely) -+# ifndef __lzo_HAVE_unlikely -+# define __lzo_HAVE_unlikely 1 -+# endif -+#else -+# define __lzo_unlikely(e) (e) -+#endif -+#if !defined(__lzo_static_unused_void_func) -+# if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -+# define __lzo_static_unused_void_func(f) static void __attribute__((__unused__)) f(void) -+# else -+# define __lzo_static_unused_void_func(f) static __lzo_inline void f(void) -+# endif -+#endif -+#if !defined(__lzo_loop_forever) -+# if (LZO_CC_IBMC) -+# define __lzo_loop_forever() LZO_BLOCK_BEGIN for (;;) { ; } LZO_BLOCK_END -+# else -+# define __lzo_loop_forever() do { ; } while __lzo_cte(1) -+# endif -+#endif -+#if !defined(__lzo_unreachable) -+#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul)) -+# define __lzo_unreachable() __builtin_unreachable(); -+#elif (LZO_CC_GNUC >= 0x040500ul) -+# define __lzo_unreachable() __builtin_unreachable(); -+#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1300)) && 1 -+# define __lzo_unreachable() __builtin_unreachable(); -+#endif -+#endif -+#if defined(__lzo_unreachable) -+# ifndef __lzo_HAVE_unreachable -+# define __lzo_HAVE_unreachable 1 -+# endif -+#else -+# if 0 -+# define __lzo_unreachable() ((void)0); -+# else -+# define __lzo_unreachable() __lzo_loop_forever(); -+# endif -+#endif -+#ifndef __LZO_CTA_NAME -+#if (LZO_CFG_USE_COUNTER) -+# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__) -+#else -+# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__LINE__) -+#endif -+#endif -+#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -+# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END -+# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1u-2*!(e)]; LZO_EXTERN_C_END -+# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END -+# elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020900ul)) && defined(__cplusplus) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN int __LZO_CTA_NAME(lzo_cta_f__)(int [1-2*!(e)]); LZO_EXTERN_C_END -+# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__)); LZO_EXTERN_C_END -+# else -+# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-2*!(e)]; LZO_EXTERN_C_END -+# endif -+#endif -+#if !defined(LZO_COMPILE_TIME_ASSERT) -+# if (LZO_CC_AZTECC) -+# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];} -+# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -+# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -+# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) -+# define LZO_COMPILE_TIME_ASSERT(e) {(void) (0/!!(e));} -+# elif (LZO_CC_GNUC >= 0x040700ul) && (LZO_CFG_USE_COUNTER) && defined(__cplusplus) -+# define LZO_COMPILE_TIME_ASSERT(e) {enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__));} -+# elif (LZO_CC_GNUC >= 0x040700ul) -+# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} -+# elif (LZO_CC_MSC && (_MSC_VER < 900)) -+# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -+# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -+# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -+# else -+# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];} -+# endif -+#endif -+LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1) -+#if defined(__cplusplus) -+extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) } -+#endif -+LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3) -+#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -+# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -+# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -+# define __lzo_cdecl __cdecl -+# define __lzo_cdecl_atexit /*empty*/ -+# define __lzo_cdecl_main __cdecl -+# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -+# define __lzo_cdecl_qsort __pascal -+# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -+# define __lzo_cdecl_qsort _stdcall -+# else -+# define __lzo_cdecl_qsort __cdecl -+# endif -+# elif (LZO_CC_WATCOMC) -+# define __lzo_cdecl __cdecl -+# else -+# define __lzo_cdecl __cdecl -+# define __lzo_cdecl_atexit __cdecl -+# define __lzo_cdecl_main __cdecl -+# define __lzo_cdecl_qsort __cdecl -+# endif -+# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -+# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -+# define __lzo_cdecl_sighandler __pascal -+# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -+# define __lzo_cdecl_sighandler _stdcall -+# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -+# define __lzo_cdecl_sighandler __clrcall -+# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -+# if defined(_DLL) -+# define __lzo_cdecl_sighandler _far _cdecl _loadds -+# elif defined(_MT) -+# define __lzo_cdecl_sighandler _far _cdecl -+# else -+# define __lzo_cdecl_sighandler _cdecl -+# endif -+# else -+# define __lzo_cdecl_sighandler __cdecl -+# endif -+#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -+# define __lzo_cdecl __cdecl -+#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -+# define __lzo_cdecl cdecl -+#endif -+#if !defined(__lzo_cdecl) -+# define __lzo_cdecl /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_atexit) -+# define __lzo_cdecl_atexit /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_main) -+# define __lzo_cdecl_main /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_qsort) -+# define __lzo_cdecl_qsort /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_sighandler) -+# define __lzo_cdecl_sighandler /*empty*/ -+#endif -+#if !defined(__lzo_cdecl_va) -+# define __lzo_cdecl_va __lzo_cdecl -+#endif -+#if !(LZO_CFG_NO_WINDOWS_H) -+#if !defined(LZO_HAVE_WINDOWS_H) -+#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -+# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -+# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) -+# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -+# else -+# define LZO_HAVE_WINDOWS_H 1 -+# endif -+#endif -+#endif -+#endif -+#ifndef LZO_SIZEOF_SHORT - #if defined(SIZEOF_SHORT) - # define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -+#elif defined(__SIZEOF_SHORT__) -+# define LZO_SIZEOF_SHORT (__SIZEOF_SHORT__) - #endif -+#endif -+#ifndef LZO_SIZEOF_INT - #if defined(SIZEOF_INT) - # define LZO_SIZEOF_INT (SIZEOF_INT) -+#elif defined(__SIZEOF_INT__) -+# define LZO_SIZEOF_INT (__SIZEOF_INT__) - #endif -+#endif -+#ifndef LZO_SIZEOF_LONG - #if defined(SIZEOF_LONG) - # define LZO_SIZEOF_LONG (SIZEOF_LONG) -+#elif defined(__SIZEOF_LONG__) -+# define LZO_SIZEOF_LONG (__SIZEOF_LONG__) - #endif -+#endif -+#ifndef LZO_SIZEOF_LONG_LONG - #if defined(SIZEOF_LONG_LONG) - # define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -+#elif defined(__SIZEOF_LONG_LONG__) -+# define LZO_SIZEOF_LONG_LONG (__SIZEOF_LONG_LONG__) - #endif -+#endif -+#ifndef LZO_SIZEOF___INT16 - #if defined(SIZEOF___INT16) - # define LZO_SIZEOF___INT16 (SIZEOF___INT16) - #endif -+#endif -+#ifndef LZO_SIZEOF___INT32 - #if defined(SIZEOF___INT32) - # define LZO_SIZEOF___INT32 (SIZEOF___INT32) - #endif -+#endif -+#ifndef LZO_SIZEOF___INT64 - #if defined(SIZEOF___INT64) - # define LZO_SIZEOF___INT64 (SIZEOF___INT64) - #endif -+#endif -+#ifndef LZO_SIZEOF_VOID_P - #if defined(SIZEOF_VOID_P) - # define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -+#elif defined(__SIZEOF_POINTER__) -+# define LZO_SIZEOF_VOID_P (__SIZEOF_POINTER__) - #endif -+#endif -+#ifndef LZO_SIZEOF_SIZE_T - #if defined(SIZEOF_SIZE_T) - # define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -+#elif defined(__SIZEOF_SIZE_T__) -+# define LZO_SIZEOF_SIZE_T (__SIZEOF_SIZE_T__) - #endif -+#endif -+#ifndef LZO_SIZEOF_PTRDIFF_T - #if defined(SIZEOF_PTRDIFF_T) - # define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -+#elif defined(__SIZEOF_PTRDIFF_T__) -+# define LZO_SIZEOF_PTRDIFF_T (__SIZEOF_PTRDIFF_T__) -+#endif - #endif - #define __LZO_LSR(x,b) (((x)+0ul) >> (b)) - #if !defined(LZO_SIZEOF_SHORT) -@@ -1060,6 +2040,7 @@ extern "C" { - # error "LZO_SIZEOF_SHORT" - # endif - #endif -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SHORT == sizeof(short)) - #if !defined(LZO_SIZEOF_INT) - # if (LZO_ARCH_CRAY_PVP) - # define LZO_SIZEOF_INT 8 -@@ -1081,6 +2062,7 @@ extern "C" { - # error "LZO_SIZEOF_INT" - # endif - #endif -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_INT == sizeof(int)) - #if !defined(LZO_SIZEOF_LONG) - # if (ULONG_MAX == LZO_0xffffffffL) - # define LZO_SIZEOF_LONG 4 -@@ -1090,6 +2072,8 @@ extern "C" { - # define LZO_SIZEOF_LONG 2 - # elif (__LZO_LSR(ULONG_MAX,31) == 1) - # define LZO_SIZEOF_LONG 4 -+# elif (__LZO_LSR(ULONG_MAX,39) == 1) -+# define LZO_SIZEOF_LONG 5 - # elif (__LZO_LSR(ULONG_MAX,63) == 1) - # define LZO_SIZEOF_LONG 8 - # elif (__LZO_LSR(ULONG_MAX,127) == 1) -@@ -1098,11 +2082,12 @@ extern "C" { - # error "LZO_SIZEOF_LONG" - # endif - #endif -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long)) - #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) - #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) - # if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) - # if (LZO_CC_GNUC >= 0x030300ul) --# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) -+# if ((__LONG_MAX__-0) == (__LONG_LONG_MAX__-0)) - # define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG - # elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) - # define LZO_SIZEOF_LONG_LONG 4 -@@ -1116,7 +2101,7 @@ extern "C" { - #if (LZO_ARCH_I086 && LZO_CC_DMC) - #elif (LZO_CC_CILLY) && defined(__GNUC__) - # define LZO_SIZEOF_LONG_LONG 8 --#elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -+#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) - # define LZO_SIZEOF_LONG_LONG 8 - #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) - # define LZO_SIZEOF_LONG_LONG 8 -@@ -1138,11 +2123,13 @@ extern "C" { - # define LZO_SIZEOF___INT64 8 - #elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) - # define LZO_SIZEOF___INT64 8 --#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) -+#elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64)) -+# define LZO_SIZEOF_LONG_LONG 8 -+#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64)) - # define LZO_SIZEOF___INT64 8 - #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) - # define LZO_SIZEOF_LONG_LONG 8 --#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -+#elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64) - # define LZO_SIZEOF_LONG_LONG 8 - #elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) - #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -@@ -1155,87 +2142,127 @@ extern "C" { - # undef LZO_SIZEOF_LONG_LONG - # endif - #endif --#if (LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) -+#if (LZO_CFG_NO_LONG_LONG) -+# undef LZO_SIZEOF_LONG_LONG -+#elif defined(__NO_LONG_LONG) -+# undef LZO_SIZEOF_LONG_LONG -+#elif defined(_NO_LONGLONG) - # undef LZO_SIZEOF_LONG_LONG - #endif --#if !defined(LZO_SIZEOF_VOID_P) --#if (LZO_ARCH_I086) --# define __LZO_WORDSIZE 2 --# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) --# define LZO_SIZEOF_VOID_P 2 --# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) --# define LZO_SIZEOF_VOID_P 4 -+#if !defined(LZO_WORDSIZE) -+#if (LZO_ARCH_ALPHA) -+# define LZO_WORDSIZE 8 -+#elif (LZO_ARCH_AMD64) -+# define LZO_WORDSIZE 8 -+#elif (LZO_ARCH_AVR) -+# define LZO_WORDSIZE 1 -+#elif (LZO_ARCH_H8300) -+# if defined(__NORMAL_MODE__) -+# define LZO_WORDSIZE 4 -+# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -+# define LZO_WORDSIZE 4 - # else --# error "LZO_MM" -+# define LZO_WORDSIZE 2 - # endif --#elif (LZO_ARCH_AVR || LZO_ARCH_Z80) --# define __LZO_WORDSIZE 1 -+#elif (LZO_ARCH_I086) -+# define LZO_WORDSIZE 2 -+#elif (LZO_ARCH_IA64) -+# define LZO_WORDSIZE 8 -+#elif (LZO_ARCH_M16C) -+# define LZO_WORDSIZE 2 -+#elif (LZO_ARCH_SPU) -+# define LZO_WORDSIZE 4 -+#elif (LZO_ARCH_Z80) -+# define LZO_WORDSIZE 1 -+#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -+# define LZO_WORDSIZE 8 -+#elif (LZO_OS_OS400 || defined(__OS400__)) -+# define LZO_WORDSIZE 8 -+#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -+# define LZO_WORDSIZE 8 -+#endif -+#endif -+#if !defined(LZO_SIZEOF_VOID_P) -+#if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) -+# define LZO_SIZEOF_VOID_P 4 -+#elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) -+# define LZO_SIZEOF_VOID_P 8 -+#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) -+# define LZO_SIZEOF_VOID_P 8 -+#elif defined(__LP64__) || defined(__LP64) || defined(_LP64) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) -+# define LZO_SIZEOF_VOID_P 8 -+#elif (LZO_ARCH_AVR) - # define LZO_SIZEOF_VOID_P 2 - #elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) - # define LZO_SIZEOF_VOID_P 2 - #elif (LZO_ARCH_H8300) - # if defined(__NORMAL_MODE__) --# define __LZO_WORDSIZE 4 - # define LZO_SIZEOF_VOID_P 2 - # elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) --# define __LZO_WORDSIZE 4 - # define LZO_SIZEOF_VOID_P 4 - # else --# define __LZO_WORDSIZE 2 - # define LZO_SIZEOF_VOID_P 2 - # endif - # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) - # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT - # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT - # endif -+#elif (LZO_ARCH_I086) -+# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -+# define LZO_SIZEOF_VOID_P 2 -+# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -+# define LZO_SIZEOF_VOID_P 4 -+# else -+# error "invalid LZO_ARCH_I086 memory model" -+# endif - #elif (LZO_ARCH_M16C) --# define __LZO_WORDSIZE 2 - # if defined(__m32c_cpu__) || defined(__m32cm_cpu__) - # define LZO_SIZEOF_VOID_P 4 - # else - # define LZO_SIZEOF_VOID_P 2 - # endif -+#elif (LZO_ARCH_SPU) -+# define LZO_SIZEOF_VOID_P 4 -+#elif (LZO_ARCH_Z80) -+# define LZO_SIZEOF_VOID_P 2 - #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) --# define __LZO_WORDSIZE 8 - # define LZO_SIZEOF_VOID_P 4 --#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) --# define __LZO_WORDSIZE 8 --# define LZO_SIZEOF_VOID_P 8 --#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) --# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG --# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG --# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG - #elif (LZO_OS_OS400 || defined(__OS400__)) --# define __LZO_WORDSIZE LZO_SIZEOF_LONG --# define LZO_SIZEOF_VOID_P 16 --# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG --# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG --#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) --# define LZO_SIZEOF_VOID_P 8 --# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG --# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG --#elif (LZO_ARCH_SPU) --# if 0 --# define __LZO_WORDSIZE 16 --# endif --# define LZO_SIZEOF_VOID_P 4 --#else --# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG --#endif --#endif --#if !defined(LZO_WORDSIZE) --# if defined(__LZO_WORDSIZE) --# define LZO_WORDSIZE __LZO_WORDSIZE -+# if defined(__LLP64_IFC__) -+# define LZO_SIZEOF_VOID_P 8 -+# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -+# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG - # else --# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -+# define LZO_SIZEOF_VOID_P 16 -+# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -+# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG - # endif -+#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -+# define LZO_SIZEOF_VOID_P 8 -+# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -+# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG - #endif -+#endif -+#if !defined(LZO_SIZEOF_VOID_P) -+# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -+#endif -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *)) - #if !defined(LZO_SIZEOF_SIZE_T) - #if (LZO_ARCH_I086 || LZO_ARCH_M16C) - # define LZO_SIZEOF_SIZE_T 2 --#else -+#endif -+#endif -+#if !defined(LZO_SIZEOF_SIZE_T) - # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P - #endif -+#if defined(offsetof) -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SIZE_T == sizeof(size_t)) - #endif - #if !defined(LZO_SIZEOF_PTRDIFF_T) - #if (LZO_ARCH_I086) -@@ -1248,11 +2275,18 @@ extern "C" { - # define LZO_SIZEOF_PTRDIFF_T 2 - # endif - # else --# error "LZO_MM" -+# error "invalid LZO_ARCH_I086 memory model" - # endif --#else -+#endif -+#endif -+#if !defined(LZO_SIZEOF_PTRDIFF_T) - # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T - #endif -+#if defined(offsetof) -+LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t)) -+#endif -+#if !defined(LZO_WORDSIZE) -+# define LZO_WORDSIZE LZO_SIZEOF_VOID_P - #endif - #if (LZO_ABI_NEUTRAL_ENDIAN) - # undef LZO_ABI_BIG_ENDIAN -@@ -1264,7 +2298,7 @@ extern "C" { - # define LZO_ABI_LITTLE_ENDIAN 1 - #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) - # define LZO_ABI_LITTLE_ENDIAN 1 --#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390) -+#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU) - # define LZO_ABI_BIG_ENDIAN 1 - #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) - # if (__LITTLE_ENDIAN__ == 1) -@@ -1280,6 +2314,19 @@ extern "C" { - # define LZO_ABI_BIG_ENDIAN 1 - #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) - # define LZO_ABI_LITTLE_ENDIAN 1 -+#elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC) -+# if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) -+# error "unexpected configuration - check your compiler defines" -+# elif defined(__BIG_ENDIAN) -+# define LZO_ABI_BIG_ENDIAN 1 -+# else -+# define LZO_ABI_LITTLE_ENDIAN 1 -+# endif -+# define LZO_ABI_LITTLE_ENDIAN 1 -+#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__) -+# define LZO_ABI_BIG_ENDIAN 1 -+#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__) -+# define LZO_ABI_LITTLE_ENDIAN 1 - #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) - # define LZO_ABI_BIG_ENDIAN 1 - #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -@@ -1287,7 +2334,7 @@ extern "C" { - #endif - #endif - #if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN) --# error "this should not happen" -+# error "unexpected configuration - check your compiler defines" - #endif - #if (LZO_ABI_BIG_ENDIAN) - # define LZO_INFO_ABI_ENDIAN "be" -@@ -1302,6 +2349,9 @@ extern "C" { - #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) - # define LZO_ABI_ILP16 1 - # define LZO_INFO_ABI_PM "ilp16" -+#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -+# define LZO_ABI_LP32 1 -+# define LZO_INFO_ABI_PM "lp32" - #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) - # define LZO_ABI_ILP32 1 - # define LZO_INFO_ABI_PM "ilp32" -@@ -1318,7 +2368,8 @@ extern "C" { - # define LZO_ABI_IP32L64 1 - # define LZO_INFO_ABI_PM "ip32l64" - #endif --#if !defined(__LZO_LIBC_OVERRIDE) -+#if 0 -+#elif !defined(__LZO_LIBC_OVERRIDE) - #if (LZO_LIBC_NAKED) - # define LZO_INFO_LIBC "naked" - #elif (LZO_LIBC_FREESTANDING) -@@ -1329,6 +2380,9 @@ extern "C" { - # define LZO_INFO_LIBC "isoc90" - #elif (LZO_LIBC_ISOC99) - # define LZO_INFO_LIBC "isoc99" -+#elif (LZO_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION) -+# define LZO_LIBC_ISOC90 1 -+# define LZO_INFO_LIBC "isoc90" - #elif defined(__dietlibc__) - # define LZO_LIBC_DIETLIBC 1 - # define LZO_INFO_LIBC "dietlibc" -@@ -1337,13 +2391,13 @@ extern "C" { - # define LZO_INFO_LIBC "newlib" - #elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) - # if defined(__UCLIBC_SUBLEVEL__) --# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) -+# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__-0) * 0x100 + (__UCLIBC_SUBLEVEL__-0)) - # else - # define LZO_LIBC_UCLIBC 0x00090bL - # endif --# define LZO_INFO_LIBC "uclibc" -+# define LZO_INFO_LIBC "uc" "libc" - #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) --# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) -+# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__-0) * 0x100) - # define LZO_INFO_LIBC "glibc" - #elif (LZO_CC_MWERKS) && defined(__MSL__) - # define LZO_LIBC_MSL __MSL__ -@@ -1356,423 +2410,159 @@ extern "C" { - # define LZO_INFO_LIBC "default" - #endif - #endif --#if !defined(__lzo_gnuc_extension__) --#if (LZO_CC_GNUC >= 0x020800ul) --# define __lzo_gnuc_extension__ __extension__ --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_gnuc_extension__ __extension__ --#else --# define __lzo_gnuc_extension__ /*empty*/ --#endif --#endif --#if !defined(__lzo_ua_volatile) --# define __lzo_ua_volatile volatile --#endif --#if !defined(__lzo_alignof) --#if (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) --# define __lzo_alignof(e) __alignof__(e) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) --# define __lzo_alignof(e) __alignof__(e) --#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) --# define __lzo_alignof(e) __alignof(e) --#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) --# define __lzo_alignof(e) __alignof__(e) --#endif --#endif --#if defined(__lzo_alignof) --# define __lzo_HAVE_alignof 1 --#endif --#if !defined(__lzo_constructor) --#if (LZO_CC_GNUC >= 0x030400ul) --# define __lzo_constructor __attribute__((__constructor__,__used__)) --#elif (LZO_CC_GNUC >= 0x020700ul) --# define __lzo_constructor __attribute__((__constructor__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_constructor __attribute__((__constructor__)) --#endif --#endif --#if defined(__lzo_constructor) --# define __lzo_HAVE_constructor 1 --#endif --#if !defined(__lzo_destructor) --#if (LZO_CC_GNUC >= 0x030400ul) --# define __lzo_destructor __attribute__((__destructor__,__used__)) --#elif (LZO_CC_GNUC >= 0x020700ul) --# define __lzo_destructor __attribute__((__destructor__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_destructor __attribute__((__destructor__)) --#endif --#endif --#if defined(__lzo_destructor) --# define __lzo_HAVE_destructor 1 --#endif --#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) --# error "this should not happen" --#endif --#if !defined(__lzo_inline) --#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) --#elif defined(__cplusplus) --# define __lzo_inline inline --#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) --# define __lzo_inline __inline --#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) --# define __lzo_inline __inline__ --#elif (LZO_CC_DMC) --# define __lzo_inline __inline --#elif (LZO_CC_INTELC) --# define __lzo_inline __inline --#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) --# define __lzo_inline __inline --#elif (LZO_CC_MSC && (_MSC_VER >= 900)) --# define __lzo_inline __inline --#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) --# define __lzo_inline __inline__ --#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) --# define __lzo_inline inline --#endif --#endif --#if defined(__lzo_inline) --# define __lzo_HAVE_inline 1 --#else --# define __lzo_inline /*empty*/ --#endif --#if !defined(__lzo_forceinline) --#if (LZO_CC_GNUC >= 0x030200ul) --# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) --# define __lzo_forceinline __forceinline --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) --# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) --#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) --# define __lzo_forceinline __forceinline --#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) --# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) --#endif --#endif --#if defined(__lzo_forceinline) --# define __lzo_HAVE_forceinline 1 --#else --# define __lzo_forceinline /*empty*/ --#endif --#if !defined(__lzo_noinline) --#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) --# define __lzo_noinline __attribute__((__noinline__,__used__)) --#elif (LZO_CC_GNUC >= 0x030200ul) --# define __lzo_noinline __attribute__((__noinline__)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) --# define __lzo_noinline __declspec(noinline) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) --# define __lzo_noinline __attribute__((__noinline__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_noinline __attribute__((__noinline__)) --#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) --# define __lzo_noinline __declspec(noinline) --#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) --# if defined(__cplusplus) --# else --# define __lzo_noinline __declspec(noinline) --# endif --#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC >= 0x5100)) --# define __lzo_noinline __attribute__((__noinline__)) --#endif --#endif --#if defined(__lzo_noinline) --# define __lzo_HAVE_noinline 1 --#else --# define __lzo_noinline /*empty*/ --#endif --#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) --# error "this should not happen" --#endif --#if !defined(__lzo_noreturn) --#if (LZO_CC_GNUC >= 0x020700ul) --# define __lzo_noreturn __attribute__((__noreturn__)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) --# define __lzo_noreturn __declspec(noreturn) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) --# define __lzo_noreturn __attribute__((__noreturn__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_noreturn __attribute__((__noreturn__)) --#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) --# define __lzo_noreturn __declspec(noreturn) --#endif --#endif --#if defined(__lzo_noreturn) --# define __lzo_HAVE_noreturn 1 --#else --# define __lzo_noreturn /*empty*/ --#endif --#if !defined(__lzo_nothrow) --#if (LZO_CC_GNUC >= 0x030300ul) --# define __lzo_nothrow __attribute__((__nothrow__)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) --# define __lzo_nothrow __declspec(nothrow) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 900) && LZO_CC_SYNTAX_GNUC) --# define __lzo_nothrow __attribute__((__nothrow__)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_nothrow __attribute__((__nothrow__)) --#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) --# define __lzo_nothrow __declspec(nothrow) --#endif --#endif --#if defined(__lzo_nothrow) --# define __lzo_HAVE_nothrow 1 --#else --# define __lzo_nothrow /*empty*/ --#endif --#if !defined(__lzo_restrict) --#if (LZO_CC_GNUC >= 0x030400ul) --# define __lzo_restrict __restrict__ --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) --# define __lzo_restrict __restrict__ --#elif (LZO_CC_CLANG || LZO_CC_LLVM) --# define __lzo_restrict __restrict__ --#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) --# define __lzo_restrict __restrict --#endif --#endif --#if defined(__lzo_restrict) --# define __lzo_HAVE_restrict 1 --#else --# define __lzo_restrict /*empty*/ --#endif --#if !defined(__lzo_likely) && !defined(__lzo_unlikely) --#if (LZO_CC_GNUC >= 0x030200ul) --# define __lzo_likely(e) (__builtin_expect(!!(e),1)) --# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) --#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) --# define __lzo_likely(e) (__builtin_expect(!!(e),1)) --# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) --#elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define __lzo_likely(e) (__builtin_expect(!!(e),1)) --# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) --#endif --#endif --#if defined(__lzo_likely) --# define __lzo_HAVE_likely 1 --#else --# define __lzo_likely(e) (e) --#endif --#if defined(__lzo_unlikely) --# define __lzo_HAVE_unlikely 1 --#else --# define __lzo_unlikely(e) (e) --#endif --#if !defined(LZO_UNUSED) --# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) --# define LZO_UNUSED(var) ((void) &var) --# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) --# define LZO_UNUSED(var) if (&var) ; else --# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define LZO_UNUSED(var) ((void) var) --# elif (LZO_CC_MSC && (_MSC_VER < 900)) --# define LZO_UNUSED(var) if (&var) ; else --# elif (LZO_CC_KEILC) --# define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} --# elif (LZO_CC_PACIFICC) --# define LZO_UNUSED(var) ((void) sizeof(var)) --# elif (LZO_CC_WATCOMC) && defined(__cplusplus) --# define LZO_UNUSED(var) ((void) var) --# else --# define LZO_UNUSED(var) ((void) &var) --# endif --#endif --#if !defined(LZO_UNUSED_FUNC) --# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) --# define LZO_UNUSED_FUNC(func) ((void) func) --# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) --# define LZO_UNUSED_FUNC(func) if (func) ; else --# elif (LZO_CC_CLANG || LZO_CC_LLVM) --# define LZO_UNUSED_FUNC(func) ((void) &func) --# elif (LZO_CC_MSC && (_MSC_VER < 900)) --# define LZO_UNUSED_FUNC(func) if (func) ; else --# elif (LZO_CC_MSC) --# define LZO_UNUSED_FUNC(func) ((void) &func) --# elif (LZO_CC_KEILC || LZO_CC_PELLESC) --# define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} --# else --# define LZO_UNUSED_FUNC(func) ((void) func) --# endif --#endif --#if !defined(LZO_UNUSED_LABEL) --# if (LZO_CC_WATCOMC) && defined(__cplusplus) --# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l --# elif (LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) --# define LZO_UNUSED_LABEL(l) if (0) goto l --# else --# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l --# endif --#endif --#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) --# if 0 --# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var --# elif 0 && (LZO_CC_GNUC) --# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var --# else --# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init --# endif --#endif --#if !defined(LZO_UNCONST_CAST) --# if 0 && defined(__cplusplus) --# define LZO_UNCONST_CAST(t,e) (const_cast (e)) --# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) --# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((lzo_uintptr_t) ((const void *) (e)))))) --# else --# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((const void *) (e))))) --# endif --#endif --#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) --# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) --# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; --# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) --# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; --# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) --# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; --# else --# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; --# endif --#endif --#if !defined(LZO_COMPILE_TIME_ASSERT) --# if (LZO_CC_AZTECC) --# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} --# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) --# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; --# elif (LZO_CC_MSC && (_MSC_VER < 900)) --# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; --# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) --# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; --# else --# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} --# endif --#endif --#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) --# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) --# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) --# define __lzo_cdecl __cdecl --# define __lzo_cdecl_atexit /*empty*/ --# define __lzo_cdecl_main __cdecl --# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) --# define __lzo_cdecl_qsort __pascal --# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) --# define __lzo_cdecl_qsort _stdcall --# else --# define __lzo_cdecl_qsort __cdecl --# endif --# elif (LZO_CC_WATCOMC) --# define __lzo_cdecl __cdecl --# else --# define __lzo_cdecl __cdecl --# define __lzo_cdecl_atexit __cdecl --# define __lzo_cdecl_main __cdecl --# define __lzo_cdecl_qsort __cdecl --# endif --# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) --# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) --# define __lzo_cdecl_sighandler __pascal --# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) --# define __lzo_cdecl_sighandler _stdcall --# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) --# define __lzo_cdecl_sighandler __clrcall --# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) --# if defined(_DLL) --# define __lzo_cdecl_sighandler _far _cdecl _loadds --# elif defined(_MT) --# define __lzo_cdecl_sighandler _far _cdecl --# else --# define __lzo_cdecl_sighandler _cdecl --# endif --# else --# define __lzo_cdecl_sighandler __cdecl --# endif --#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) --# define __lzo_cdecl __cdecl --#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) --# define __lzo_cdecl cdecl --#endif --#if !defined(__lzo_cdecl) --# define __lzo_cdecl /*empty*/ --#endif --#if !defined(__lzo_cdecl_atexit) --# define __lzo_cdecl_atexit /*empty*/ --#endif --#if !defined(__lzo_cdecl_main) --# define __lzo_cdecl_main /*empty*/ --#endif --#if !defined(__lzo_cdecl_qsort) --# define __lzo_cdecl_qsort /*empty*/ --#endif --#if !defined(__lzo_cdecl_sighandler) --# define __lzo_cdecl_sighandler /*empty*/ --#endif --#if !defined(__lzo_cdecl_va) --# define __lzo_cdecl_va __lzo_cdecl --#endif --#if !(LZO_CFG_NO_WINDOWS_H) --#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) --# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) --# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) --# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) --# else --# define LZO_HAVE_WINDOWS_H 1 --# endif -+#if (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -+# define LZO_ASM_SYNTAX_MSC 1 -+#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -+#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) -+#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -+# define LZO_ASM_SYNTAX_GNUC 1 -+#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -+# define LZO_ASM_SYNTAX_GNUC 1 -+#elif (LZO_CC_GNUC) -+# define LZO_ASM_SYNTAX_GNUC 1 -+#endif -+#if (LZO_ASM_SYNTAX_GNUC) -+#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -+# define __LZO_ASM_CLOBBER "ax" -+# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ -+# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY /*empty*/ -+# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -+#elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1000)) -+# define __LZO_ASM_CLOBBER "memory" -+# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ -+# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "memory" -+# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -+#else -+# define __LZO_ASM_CLOBBER "cc", "memory" -+# define __LZO_ASM_CLOBBER_LIST_CC : "cc" -+# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "cc", "memory" -+# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ - #endif - #endif - #if (LZO_ARCH_ALPHA) --# define LZO_OPT_AVOID_UINT_INDEX 1 --# define LZO_OPT_AVOID_SHORT 1 --# define LZO_OPT_AVOID_USHORT 1 -+# define LZO_OPT_AVOID_UINT_INDEX 1 - #elif (LZO_ARCH_AMD64) --# define LZO_OPT_AVOID_INT_INDEX 1 --# define LZO_OPT_AVOID_UINT_INDEX 1 --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 --# define LZO_OPT_UNALIGNED64 1 --#elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) -+# define LZO_OPT_AVOID_INT_INDEX 1 -+# define LZO_OPT_AVOID_UINT_INDEX 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED64 -+# define LZO_OPT_UNALIGNED64 1 -+# endif - #elif (LZO_ARCH_ARM) --# define LZO_OPT_AVOID_SHORT 1 --# define LZO_OPT_AVOID_USHORT 1 -+# if defined(__ARM_FEATURE_UNALIGNED) -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# elif defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM+0) >= 7) -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# elif defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM+0) >= 6) && !defined(__TARGET_PROFILE_M) -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# endif -+#elif (LZO_ARCH_ARM64) -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED64 -+# define LZO_OPT_UNALIGNED64 1 -+# endif - #elif (LZO_ARCH_CRIS) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif - #elif (LZO_ARCH_I386) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif - #elif (LZO_ARCH_IA64) --# define LZO_OPT_AVOID_INT_INDEX 1 --# define LZO_OPT_AVOID_UINT_INDEX 1 --# define LZO_OPT_PREFER_POSTINC 1 -+# define LZO_OPT_AVOID_INT_INDEX 1 -+# define LZO_OPT_AVOID_UINT_INDEX 1 -+# define LZO_OPT_PREFER_POSTINC 1 - #elif (LZO_ARCH_M68K) --# define LZO_OPT_PREFER_POSTINC 1 --# define LZO_OPT_PREFER_PREDEC 1 -+# define LZO_OPT_PREFER_POSTINC 1 -+# define LZO_OPT_PREFER_PREDEC 1 - # if defined(__mc68020__) && !defined(__mcoldfire__) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif - # endif - #elif (LZO_ARCH_MIPS) --# define LZO_OPT_AVOID_UINT_INDEX 1 -+# define LZO_OPT_AVOID_UINT_INDEX 1 - #elif (LZO_ARCH_POWERPC) --# define LZO_OPT_PREFER_PREINC 1 --# define LZO_OPT_PREFER_PREDEC 1 -+# define LZO_OPT_PREFER_PREINC 1 -+# define LZO_OPT_PREFER_PREDEC 1 - # if (LZO_ABI_BIG_ENDIAN) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# if (LZO_WORDSIZE == 8) -+# ifndef LZO_OPT_UNALIGNED64 -+# define LZO_OPT_UNALIGNED64 1 -+# endif -+# endif - # endif - #elif (LZO_ARCH_S390) --# define LZO_OPT_UNALIGNED16 1 --# define LZO_OPT_UNALIGNED32 1 --# if (LZO_SIZEOF_SIZE_T == 8) --# define LZO_OPT_UNALIGNED64 1 -+# ifndef LZO_OPT_UNALIGNED16 -+# define LZO_OPT_UNALIGNED16 1 -+# endif -+# ifndef LZO_OPT_UNALIGNED32 -+# define LZO_OPT_UNALIGNED32 1 -+# endif -+# if (LZO_WORDSIZE == 8) -+# ifndef LZO_OPT_UNALIGNED64 -+# define LZO_OPT_UNALIGNED64 1 -+# endif - # endif - #elif (LZO_ARCH_SH) --# define LZO_OPT_PREFER_POSTINC 1 --# define LZO_OPT_PREFER_PREDEC 1 -+# define LZO_OPT_PREFER_POSTINC 1 -+# define LZO_OPT_PREFER_PREDEC 1 - #endif - #ifndef LZO_CFG_NO_INLINE_ASM --#if (LZO_CC_LLVM) -+#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) - # define LZO_CFG_NO_INLINE_ASM 1 -+#elif (LZO_CC_LLVM) -+# define LZO_CFG_NO_INLINE_ASM 1 -+#endif - #endif -+#if (LZO_CFG_NO_INLINE_ASM) -+# undef LZO_ASM_SYNTAX_MSC -+# undef LZO_ASM_SYNTAX_GNUC -+# undef __LZO_ASM_CLOBBER -+# undef __LZO_ASM_CLOBBER_LIST_CC -+# undef __LZO_ASM_CLOBBER_LIST_CC_MEMORY -+# undef __LZO_ASM_CLOBBER_LIST_EMPTY - #endif - #ifndef LZO_CFG_NO_UNALIGNED - #if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) -@@ -1784,25 +2574,6 @@ extern "C" { - # undef LZO_OPT_UNALIGNED32 - # undef LZO_OPT_UNALIGNED64 - #endif --#if (LZO_CFG_NO_INLINE_ASM) --#elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) --# define LZO_ASM_SYNTAX_MSC 1 --#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) --#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) --#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) --# define LZO_ASM_SYNTAX_GNUC 1 --#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) --# define LZO_ASM_SYNTAX_GNUC 1 --#endif --#if (LZO_ASM_SYNTAX_GNUC) --#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) --# define __LZO_ASM_CLOBBER "ax" --#elif (LZO_CC_INTELC) --# define __LZO_ASM_CLOBBER "memory" --#else --# define __LZO_ASM_CLOBBER "cc", "memory" --#endif --#endif - #if defined(__LZO_INFOSTR_MM) - #elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) - # define __LZO_INFOSTR_MM "" -@@ -1846,7 +2617,382 @@ extern "C" { - #define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER -+#if !(LZO_CFG_SKIP_LZO_TYPES) -+#if (!(LZO_SIZEOF_SHORT+0 > 0 && LZO_SIZEOF_INT+0 > 0 && LZO_SIZEOF_LONG+0 > 0)) -+# error "missing defines for sizes" -+#endif -+#if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0)) -+# error "missing defines for sizes" -+#endif -+#if !defined(lzo_llong_t) -+#if (LZO_SIZEOF_LONG_LONG+0 > 0) -+__lzo_gnuc_extension__ typedef long long lzo_llong_t__; -+__lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__; -+# define lzo_llong_t lzo_llong_t__ -+# define lzo_ullong_t lzo_ullong_t__ -+#endif -+#endif -+#if !defined(lzo_int16e_t) -+#if (LZO_SIZEOF_LONG == 2) -+# define lzo_int16e_t long -+# define lzo_uint16e_t unsigned long -+#elif (LZO_SIZEOF_INT == 2) -+# define lzo_int16e_t int -+# define lzo_uint16e_t unsigned int -+#elif (LZO_SIZEOF_SHORT == 2) -+# define lzo_int16e_t short int -+# define lzo_uint16e_t unsigned short int -+#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) -+ typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__))); -+ typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__))); -+# define lzo_int16e_t lzo_int16e_hi_t__ -+# define lzo_uint16e_t lzo_uint16e_hi_t__ -+#elif (LZO_SIZEOF___INT16 == 2) -+# define lzo_int16e_t __int16 -+# define lzo_uint16e_t unsigned __int16 -+#else -+#endif -+#endif -+#if defined(lzo_int16e_t) -+# define LZO_SIZEOF_LZO_INT16E_T 2 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T) -+#endif -+#if !defined(lzo_int32e_t) -+#if (LZO_SIZEOF_LONG == 4) -+# define lzo_int32e_t long int -+# define lzo_uint32e_t unsigned long int -+#elif (LZO_SIZEOF_INT == 4) -+# define lzo_int32e_t int -+# define lzo_uint32e_t unsigned int -+#elif (LZO_SIZEOF_SHORT == 4) -+# define lzo_int32e_t short int -+# define lzo_uint32e_t unsigned short int -+#elif (LZO_SIZEOF_LONG_LONG == 4) -+# define lzo_int32e_t lzo_llong_t -+# define lzo_uint32e_t lzo_ullong_t -+#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L) -+ typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); -+ typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); -+# define lzo_int32e_t lzo_int32e_si_t__ -+# define lzo_uint32e_t lzo_uint32e_si_t__ -+#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L) -+ typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); -+ typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); -+# define lzo_int32e_t lzo_int32e_si_t__ -+# define lzo_uint32e_t lzo_uint32e_si_t__ -+# define LZO_INT32_C(c) (c##LL) -+# define LZO_UINT32_C(c) (c##ULL) -+#elif (LZO_SIZEOF___INT32 == 4) -+# define lzo_int32e_t __int32 -+# define lzo_uint32e_t unsigned __int32 -+#else -+#endif -+#endif -+#if defined(lzo_int32e_t) -+# define LZO_SIZEOF_LZO_INT32E_T 4 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T) -+#endif -+#if !defined(lzo_int64e_t) -+#if (LZO_SIZEOF___INT64 == 8) -+# if (LZO_CC_BORLANDC) && !(LZO_CFG_TYPE_PREFER___INT64) -+# define LZO_CFG_TYPE_PREFER___INT64 1 -+# endif -+#endif -+#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -+# define lzo_int64e_t int -+# define lzo_uint64e_t unsigned int -+# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_INT -+#elif (LZO_SIZEOF_LONG == 8) -+# define lzo_int64e_t long int -+# define lzo_uint64e_t unsigned long int -+# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_LONG -+#elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_TYPE_PREFER___INT64) -+# define lzo_int64e_t lzo_llong_t -+# define lzo_uint64e_t lzo_ullong_t -+# if (LZO_CC_BORLANDC) -+# define LZO_INT64_C(c) ((c) + 0ll) -+# define LZO_UINT64_C(c) ((c) + 0ull) -+# elif 0 -+# define LZO_INT64_C(c) (__lzo_gnuc_extension__ (c##LL)) -+# define LZO_UINT64_C(c) (__lzo_gnuc_extension__ (c##ULL)) -+# else -+# define LZO_INT64_C(c) (c##LL) -+# define LZO_UINT64_C(c) (c##ULL) -+# endif -+# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF_LONG_LONG -+#elif (LZO_SIZEOF___INT64 == 8) -+# define lzo_int64e_t __int64 -+# define lzo_uint64e_t unsigned __int64 -+# if (LZO_CC_BORLANDC) -+# define LZO_INT64_C(c) ((c) + 0i64) -+# define LZO_UINT64_C(c) ((c) + 0ui64) -+# else -+# define LZO_INT64_C(c) (c##i64) -+# define LZO_UINT64_C(c) (c##ui64) -+# endif -+# define LZO_SIZEOF_LZO_INT64E_T LZO_SIZEOF___INT64 -+#else -+#endif -+#endif -+#if defined(lzo_int64e_t) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T) -+#endif -+#if !defined(lzo_int32l_t) -+#if defined(lzo_int32e_t) -+# define lzo_int32l_t lzo_int32e_t -+# define lzo_uint32l_t lzo_uint32e_t -+# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T -+#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -+# define lzo_int32l_t int -+# define lzo_uint32l_t unsigned int -+# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT -+#elif (LZO_SIZEOF_LONG >= 4) -+# define lzo_int32l_t long int -+# define lzo_uint32l_t unsigned long int -+# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG -+#else -+# error "lzo_int32l_t" -+#endif -+#endif -+#if 1 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T) -+#endif -+#if !defined(lzo_int64l_t) -+#if defined(lzo_int64e_t) -+# define lzo_int64l_t lzo_int64e_t -+# define lzo_uint64l_t lzo_uint64e_t -+# define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T -+#else -+#endif -+#endif -+#if defined(lzo_int64l_t) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T) -+#endif -+#if !defined(lzo_int32f_t) -+#if (LZO_SIZEOF_SIZE_T >= 8) -+# define lzo_int32f_t lzo_int64l_t -+# define lzo_uint32f_t lzo_uint64l_t -+# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T -+#else -+# define lzo_int32f_t lzo_int32l_t -+# define lzo_uint32f_t lzo_uint32l_t -+# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T -+#endif -+#endif -+#if 1 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T) -+#endif -+#if !defined(lzo_int64f_t) -+#if defined(lzo_int64l_t) -+# define lzo_int64f_t lzo_int64l_t -+# define lzo_uint64f_t lzo_uint64l_t -+# define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T -+#else -+#endif -+#endif -+#if defined(lzo_int64f_t) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T) -+#endif -+#if !defined(lzo_intptr_t) -+#if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16)) -+# define __LZO_INTPTR_T_IS_POINTER 1 -+ typedef char* lzo_intptr_t; -+ typedef char* lzo_uintptr_t; -+# define lzo_intptr_t lzo_intptr_t -+# define lzo_uintptr_t lzo_uintptr_t -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P -+#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4)) -+ typedef __w64 int lzo_intptr_t; -+ typedef __w64 unsigned int lzo_uintptr_t; -+# define lzo_intptr_t lzo_intptr_t -+# define lzo_uintptr_t lzo_uintptr_t -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT -+#elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P) -+# define lzo_intptr_t short -+# define lzo_uintptr_t unsigned short -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT -+#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -+# define lzo_intptr_t int -+# define lzo_uintptr_t unsigned int -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT -+#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P) -+# define lzo_intptr_t long -+# define lzo_uintptr_t unsigned long -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG -+#elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P) -+# define lzo_intptr_t lzo_int64l_t -+# define lzo_uintptr_t lzo_uint64l_t -+# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T -+#else -+# error "lzo_intptr_t" -+#endif -+#endif -+#if 1 -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *)) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t)) -+#endif -+#if !defined(lzo_word_t) -+#if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0) -+#if (LZO_WORDSIZE == LZO_SIZEOF_LZO_INTPTR_T) && !(__LZO_INTPTR_T_IS_POINTER) -+# define lzo_word_t lzo_uintptr_t -+# define lzo_sword_t lzo_intptr_t -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T -+#elif (LZO_WORDSIZE == LZO_SIZEOF_LONG) -+# define lzo_word_t unsigned long -+# define lzo_sword_t long -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG -+#elif (LZO_WORDSIZE == LZO_SIZEOF_INT) -+# define lzo_word_t unsigned int -+# define lzo_sword_t int -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT -+#elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT) -+# define lzo_word_t unsigned short -+# define lzo_sword_t short -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT -+#elif (LZO_WORDSIZE == 1) -+# define lzo_word_t unsigned char -+# define lzo_sword_t signed char -+# define LZO_SIZEOF_LZO_WORD_T 1 -+#elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T) -+# define lzo_word_t lzo_uint64l_t -+# define lzo_sword_t lzo_int64l_t -+# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T -+#elif (LZO_ARCH_SPU) && (LZO_CC_GNUC) -+#if 0 -+ typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__))); -+ typedef int lzo_sword_t __attribute__((__mode__(__V16QI__))); -+# define lzo_word_t lzo_word_t -+# define lzo_sword_t lzo_sword_t -+# define LZO_SIZEOF_LZO_WORD_T 16 -+#endif -+#else -+# error "lzo_word_t" -+#endif -+#endif -+#endif -+#if 1 && defined(lzo_word_t) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE) -+ LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE) -+#endif -+#if 1 -+#define lzo_int8_t signed char -+#define lzo_uint8_t unsigned char -+#define LZO_SIZEOF_LZO_INT8_T 1 -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t)) -+#endif -+#if defined(lzo_int16e_t) -+#define lzo_int16_t lzo_int16e_t -+#define lzo_uint16_t lzo_uint16e_t -+#define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t)) -+#endif -+#if defined(lzo_int32e_t) -+#define lzo_int32_t lzo_int32e_t -+#define lzo_uint32_t lzo_uint32e_t -+#define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t)) -+#endif -+#if defined(lzo_int64e_t) -+#define lzo_int64_t lzo_int64e_t -+#define lzo_uint64_t lzo_uint64e_t -+#define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t)) -+#endif -+#if 1 -+#define lzo_int_least32_t lzo_int32l_t -+#define lzo_uint_least32_t lzo_uint32l_t -+#define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t)) -+#endif -+#if defined(lzo_int64l_t) -+#define lzo_int_least64_t lzo_int64l_t -+#define lzo_uint_least64_t lzo_uint64l_t -+#define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t)) -+#endif -+#if 1 -+#define lzo_int_fast32_t lzo_int32f_t -+#define lzo_uint_fast32_t lzo_uint32f_t -+#define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t)) -+#endif -+#if defined(lzo_int64f_t) -+#define lzo_int_fast64_t lzo_int64f_t -+#define lzo_uint_fast64_t lzo_uint64f_t -+#define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8) -+LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t)) -+#endif -+#if !defined(LZO_INT16_C) -+# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 2) -+# define LZO_INT16_C(c) ((c) + 0) -+# define LZO_UINT16_C(c) ((c) + 0U) -+# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 2) -+# define LZO_INT16_C(c) ((c) + 0L) -+# define LZO_UINT16_C(c) ((c) + 0UL) -+# elif (LZO_SIZEOF_INT >= 2) -+# define LZO_INT16_C(c) (c) -+# define LZO_UINT16_C(c) (c##U) -+# elif (LZO_SIZEOF_LONG >= 2) -+# define LZO_INT16_C(c) (c##L) -+# define LZO_UINT16_C(c) (c##UL) -+# else -+# error "LZO_INT16_C" -+# endif -+#endif -+#if !defined(LZO_INT32_C) -+# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 4) -+# define LZO_INT32_C(c) ((c) + 0) -+# define LZO_UINT32_C(c) ((c) + 0U) -+# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 4) -+# define LZO_INT32_C(c) ((c) + 0L) -+# define LZO_UINT32_C(c) ((c) + 0UL) -+# elif (LZO_SIZEOF_INT >= 4) -+# define LZO_INT32_C(c) (c) -+# define LZO_UINT32_C(c) (c##U) -+# elif (LZO_SIZEOF_LONG >= 4) -+# define LZO_INT32_C(c) (c##L) -+# define LZO_UINT32_C(c) (c##UL) -+# elif (LZO_SIZEOF_LONG_LONG >= 4) -+# define LZO_INT32_C(c) (c##LL) -+# define LZO_UINT32_C(c) (c##ULL) -+# else -+# error "LZO_INT32_C" -+# endif -+#endif -+#if !defined(LZO_INT64_C) && defined(lzo_int64l_t) -+# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 8) -+# define LZO_INT64_C(c) ((c) + 0) -+# define LZO_UINT64_C(c) ((c) + 0U) -+# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 8) -+# define LZO_INT64_C(c) ((c) + 0L) -+# define LZO_UINT64_C(c) ((c) + 0UL) -+# elif (LZO_SIZEOF_INT >= 8) -+# define LZO_INT64_C(c) (c) -+# define LZO_UINT64_C(c) (c##U) -+# elif (LZO_SIZEOF_LONG >= 8) -+# define LZO_INT64_C(c) (c##L) -+# define LZO_UINT64_C(c) (c##UL) -+# else -+# error "LZO_INT64_C" -+# endif -+#endif -+#endif - - #endif /* already included */ - --/* vim:set ts=4 et: */ -+/* vim:set ts=4 sw=4 et: */ -diff --git a/grub-core/lib/minilzo/minilzo.h b/grub-core/lib/minilzo/minilzo.h -index 74fefa9fe20..79374546748 100644 ---- a/grub-core/lib/minilzo/minilzo.h -+++ b/grub-core/lib/minilzo/minilzo.h -@@ -2,22 +2,7 @@ - - This file is part of the LZO real-time data compression library. - -- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer -- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer -+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or -@@ -50,7 +35,7 @@ - #ifndef __MINILZO_H - #define __MINILZO_H 1 - --#define MINILZO_VERSION 0x2050 -+#define MINILZO_VERSION 0x2080 - - #ifdef __LZOCONF_H - # error "you cannot use both LZO and miniLZO" -@@ -78,7 +63,7 @@ extern "C" { - */ - - #define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS --#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t)) -+#define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (16384L * lzo_sizeof_dict_t)) - #define LZO1X_MEM_DECOMPRESS (0) - - diff --git a/0018-Make-efi-machines-load-an-env-block-from-a-variable.patch b/0014-Make-efi-machines-load-an-env-block-from-a-variable.patch similarity index 74% rename from 0018-Make-efi-machines-load-an-env-block-from-a-variable.patch rename to 0014-Make-efi-machines-load-an-env-block-from-a-variable.patch index 9665d7bf..d0614611 100644 --- a/0018-Make-efi-machines-load-an-env-block-from-a-variable.patch +++ b/0014-Make-efi-machines-load-an-env-block-from-a-variable.patch @@ -6,30 +6,38 @@ Subject: [PATCH] Make efi machines load an env block from a variable Signed-off-by: Peter Jones --- grub-core/Makefile.core.def | 1 + - grub-core/kern/efi/init.c | 34 +++++++++++++++++++++++++++++++++- - 2 files changed, 34 insertions(+), 1 deletion(-) + grub-core/kern/efi/init.c | 36 +++++++++++++++++++++++++++++++++++- + 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index eb1088fd654..41b5e16a3ce 100644 +index 45d3edaa4dc..c865a08b027 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -203,6 +203,7 @@ kernel = { - efi = term/efi/console.c; - efi = kern/acpi.c; +@@ -207,6 +207,7 @@ kernel = { efi = kern/efi/acpi.c; + efi = kern/efi/sb.c; + efi = kern/lockdown.c; + efi = lib/envblk.c; i386_coreboot = kern/i386/pc/acpi.c; i386_multiboot = kern/i386/pc/acpi.c; i386_coreboot = kern/acpi.c; diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 3dfdf2d22b0..71d2279a0c1 100644 +index 7facacf09c7..6d39bd3ad29 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c -@@ -25,9 +25,40 @@ +@@ -27,8 +27,11 @@ #include #include #include ++ + #include + +#include ++ + #ifdef GRUB_STACK_PROTECTOR + + static grub_efi_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID; +@@ -82,6 +85,36 @@ stack_protector_init (void) grub_addr_t grub_modbase; @@ -54,8 +62,8 @@ index 3dfdf2d22b0..71d2279a0c1 100644 + struct grub_envblk envblk_s = { NULL, 0 }; + grub_envblk_t envblk = &envblk_s; + -+ envblk_s.buf = grub_efi_get_variable ("GRUB_ENV", &efi_grub_guid, -+ &envblk_s.size); ++ grub_efi_get_variable ("GRUB_ENV", &efi_grub_guid, &envblk_s.size, ++ (void **) &envblk_s.buf); + if (!envblk_s.buf || envblk_s.size < 1) + return; + @@ -66,7 +74,7 @@ index 3dfdf2d22b0..71d2279a0c1 100644 void grub_efi_init (void) { -@@ -42,10 +73,11 @@ grub_efi_init (void) +@@ -108,10 +141,11 @@ grub_efi_init (void) efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer, 0, 0, 0, NULL); diff --git a/0015-Add-GRUB_DISABLE_UUID.patch b/0015-Add-GRUB_DISABLE_UUID.patch deleted file mode 100644 index 7051dd7b..00000000 --- a/0015-Add-GRUB_DISABLE_UUID.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 4 Sep 2014 16:49:25 -0400 -Subject: [PATCH] Add GRUB_DISABLE_UUID. - -This will cause "search --fs-uuid --set=root ..." not to be generated by -grub2-mkconfig, and instead simply attempt to use the grub device name -as it understands it. - -Signed-off-by: Peter Jones ---- - docs/grub.texi | 7 +++++++ - util/grub-mkconfig.in | 22 +++++++++++++++++++--- - util/grub-mkconfig_lib.in | 4 ++-- - 3 files changed, 28 insertions(+), 5 deletions(-) - -diff --git a/docs/grub.texi b/docs/grub.texi -index 87795075a87..6f524305085 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -1441,6 +1441,13 @@ enable the use of partition UUIDs, set this option to @samp{false}. - If this option is set to @samp{true}, disable the generation of recovery - mode menu entries. - -+@item GRUB_DISABLE_UUID -+Normally, @command{grub-mkconfig} will generate menu entries that use -+universally-unique identifiers (UUIDs) to identify various filesystems to -+search for files. This is usually more reliable, but in some cases it may -+not be appropriate. To disable this use of UUIDs, set this option to -+@samp{true}. -+ - @item GRUB_VIDEO_BACKEND - If graphical video support is required, either because the @samp{gfxterm} - graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set, -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 523d4e029bb..9ecbcfb5b43 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -133,12 +133,12 @@ fi - - # Device containing our userland. Typically used for root= parameter. - GRUB_DEVICE="`${grub_probe} --target=device /`" --GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true --GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true -+GRUB_DEVICE_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true -+GRUB_DEVICE_PARTUUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true - - # Device containing our /boot partition. Usually the same as GRUB_DEVICE. - GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`" --GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true -+GRUB_DEVICE_BOOT_UUID_GENERATED="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true - - # Filesystem for the device containing our userland. Used for stuff like - # choosing Hurd filesystem module. -@@ -158,6 +158,21 @@ if test -f ${sysconfdir}/default/grub ; then - . ${sysconfdir}/default/grub - fi - -+if [ "x$GRUB_DISABLE_UUID" != "xtrue" ]; then -+ if [ -z "$GRUB_DEVICE_UUID" ]; then -+ GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED" -+ fi -+ if [ -z "$GRUB_DEVICE_BOOT_UUID" ]; then -+ GRUB_DEVICE_BOOT_UUID="$GRUB_DEVICE_BOOT_UUID_GENERATED" -+ fi -+ if [ -z "$GRUB_DEVICE_UUID" ]; then -+ GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED" -+ fi -+ if [ -z "$GRUB_DEVICE_PART_UUID" ]; then -+ GRUB_DEVICE_PART_UUID="$GRUB_DEVICE_PART_UUID_GENERATED" -+ fi -+fi -+ - # XXX: should this be deprecated at some point? - if [ "x${GRUB_TERMINAL}" != "x" ] ; then - GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}" -@@ -227,6 +242,7 @@ export GRUB_DEFAULT \ - GRUB_DISABLE_LINUX_UUID \ - GRUB_DISABLE_LINUX_PARTUUID \ - GRUB_DISABLE_RECOVERY \ -+ GRUB_DISABLE_UUID \ - GRUB_VIDEO_BACKEND \ - GRUB_GFXMODE \ - GRUB_BACKGROUND \ -diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 0f801cab3e4..1001a12232b 100644 ---- a/util/grub-mkconfig_lib.in -+++ b/util/grub-mkconfig_lib.in -@@ -156,7 +156,7 @@ prepare_grub_to_access_device () - if [ "x$fs_hint" != x ]; then - echo "set root='$fs_hint'" - fi -- if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then -+ if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then - hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints= - echo "if [ x\$feature_platform_search_hint = xy ]; then" - echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}" -@@ -173,7 +173,7 @@ grub_get_device_id () - IFS=' - ' - device="$1" -- if fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then -+ if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then - echo "$fs_uuid"; - else - echo $device |sed 's, ,_,g' diff --git a/0022-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0015-Migrate-PPC-from-Yaboot-to-Grub2.patch similarity index 98% rename from 0022-Migrate-PPC-from-Yaboot-to-Grub2.patch rename to 0015-Migrate-PPC-from-Yaboot-to-Grub2.patch index 3fbb18a7..ee8c7abf 100644 --- a/0022-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0015-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -12,10 +12,10 @@ maximum screen size so that text is not overwritten. create mode 100644 util/grub.d/20_ppc_terminfo.in diff --git a/Makefile.util.def b/Makefile.util.def -index 969d32f0097..8717774d510 100644 +index f8b356cc1fa..2c9b283a230 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -496,6 +496,13 @@ script = { +@@ -508,6 +508,13 @@ script = { condition = COND_HOST_LINUX; }; diff --git a/0023-Add-fw_path-variable-revised.patch b/0016-Add-fw_path-variable-revised.patch similarity index 91% rename from 0023-Add-fw_path-variable-revised.patch rename to 0016-Add-fw_path-variable-revised.patch index 36c3b1fe..df9ef830 100644 --- a/0023-Add-fw_path-variable-revised.patch +++ b/0016-Add-fw_path-variable-revised.patch @@ -14,10 +14,10 @@ https://bugzilla.redhat.com/show_bug.cgi?id=857936 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 9cad0c4485c..8ab7794c47b 100644 +index 73967e2f5b0..d1de9fa6873 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c -@@ -127,16 +127,15 @@ grub_set_prefix_and_root (void) +@@ -128,16 +128,15 @@ grub_set_prefix_and_root (void) grub_machine_get_bootlocation (&fwdevice, &fwpath); @@ -41,10 +41,10 @@ index 9cad0c4485c..8ab7794c47b 100644 } diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 222e239c1be..394bfbea868 100644 +index 70614de1565..62571e6dfcc 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -338,7 +338,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), +@@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), /* Guess the config filename. It is necessary to make CONFIG static, so that it won't get broken by longjmp. */ char *config; diff --git a/0017-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch b/0017-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch deleted file mode 100644 index 942116a3..00000000 --- a/0017-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 22 Jul 2015 11:21:01 -0400 -Subject: [PATCH] Mark po/exclude.pot as binary so git won't try to diff - nonprintables. - -Signed-off-by: Peter Jones ---- - .gitattributes | 1 + - 1 file changed, 1 insertion(+) - create mode 100644 .gitattributes - -diff --git a/.gitattributes b/.gitattributes -new file mode 100644 -index 00000000000..33ffaa40460 ---- /dev/null -+++ b/.gitattributes -@@ -0,0 +1 @@ -+po/exclude.pot binary diff --git a/0024-Pass-x-hex-hex-straight-through-unmolested.patch b/0017-Pass-x-hex-hex-straight-through-unmolested.patch similarity index 86% rename from 0024-Pass-x-hex-hex-straight-through-unmolested.patch rename to 0017-Pass-x-hex-hex-straight-through-unmolested.patch index 4fd78113..b81abb54 100644 --- a/0024-Pass-x-hex-hex-straight-through-unmolested.patch +++ b/0017-Pass-x-hex-hex-straight-through-unmolested.patch @@ -3,17 +3,20 @@ From: Peter Jones Date: Mon, 1 Oct 2012 13:24:37 -0400 Subject: [PATCH] Pass "\x[[:hex:]][[:hex:]]" straight through unmolested. +Don't munge raw spaces when we're doing our cmdline escaping (#923374) + +Signed-off-by: Peter Jones --- grub-core/commands/wildcard.c | 16 +++++++++++++++- - grub-core/lib/cmdline.c | 34 ++++++++++++++++++++++++++++++++-- + grub-core/lib/cmdline.c | 25 +++++++++++++++++++++++-- grub-core/script/execute.c | 43 +++++++++++++++++++++++++++++++++++++------ - 3 files changed, 84 insertions(+), 9 deletions(-) + 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index 4a106ca040b..560d437cdc6 100644 +index cc3290311f0..8f67a4be7f0 100644 --- a/grub-core/commands/wildcard.c +++ b/grub-core/commands/wildcard.c -@@ -462,6 +462,12 @@ check_file (const char *dir, const char *basename) +@@ -488,6 +488,12 @@ check_file (const char *dir, const char *basename) return ctx.found; } @@ -26,7 +29,7 @@ index 4a106ca040b..560d437cdc6 100644 static void unescape (char *out, const char *in, const char *end) { -@@ -470,7 +476,15 @@ unescape (char *out, const char *in, const char *end) +@@ -496,7 +502,15 @@ unescape (char *out, const char *in, const char *end) for (optr = out, iptr = in; iptr < end;) { @@ -44,7 +47,7 @@ index 4a106ca040b..560d437cdc6 100644 *optr++ = iptr[1]; iptr += 2; diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index ed0b149dca5..e0fb0a9e48a 100644 +index ed0b149dca5..8e2294d8ff6 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/lib/cmdline.c @@ -20,6 +20,12 @@ @@ -75,21 +78,12 @@ index ed0b149dca5..e0fb0a9e48a 100644 size++; else if (*c == ' ') space = 1; -@@ -86,7 +98,25 @@ grub_create_loader_cmdline (int argc, char *argv[], char *buf, +@@ -86,7 +98,16 @@ grub_create_loader_cmdline (int argc, char *argv[], char *buf, while (*c) { - if (*c == '\\' || *c == '\'' || *c == '"') -+ if (*c == ' ') -+ { -+ *buf++ = '\\'; -+ *buf++ = 'x'; -+ *buf++ = '2'; -+ *buf++ = '0'; -+ c++; -+ continue; -+ } -+ else if (*c == '\\' && *(c+1) == 'x' && ++ if (*c == '\\' && *(c+1) == 'x' && + is_hex(*(c+2)) && is_hex(*(c+3))) + { + *buf++ = *c++; @@ -103,7 +97,7 @@ index ed0b149dca5..e0fb0a9e48a 100644 *buf++ = *c; diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index 0d05d6b0709..ba38b5e8aef 100644 +index ad80399246a..0c6dd9c5201 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0; diff --git a/0027-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch similarity index 91% rename from 0027-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch rename to 0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index ada4564e..8c1a1672 100644 --- a/0027-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -14,7 +14,7 @@ Signed-off-by: Javier Martinez Canillas Signed-off-by: Will Thompson --- grub-core/Makefile.core.def | 11 + - grub-core/commands/blscfg.c | 1096 ++++++++++++++++++++++++++++++++++++++++ + grub-core/commands/blscfg.c | 1171 ++++++++++++++++++++++++++++++++++++++++ grub-core/commands/legacycfg.c | 5 +- grub-core/commands/loadenv.c | 77 +-- grub-core/commands/menuentry.c | 20 +- @@ -23,15 +23,15 @@ Signed-off-by: Will Thompson include/grub/compiler.h | 2 + include/grub/menu.h | 13 + include/grub/normal.h | 2 +- - 10 files changed, 1243 insertions(+), 82 deletions(-) + 10 files changed, 1318 insertions(+), 82 deletions(-) create mode 100644 grub-core/commands/blscfg.c create mode 100644 grub-core/commands/loadenv.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 41b5e16a3ce..57e253ab1a1 100644 +index c865a08b027..c15e91943b9 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -811,6 +811,16 @@ module = { +@@ -814,6 +814,16 @@ module = { common = commands/blocklist.c; }; @@ -48,7 +48,7 @@ index 41b5e16a3ce..57e253ab1a1 100644 module = { name = boot; common = commands/boot.c; -@@ -988,6 +998,7 @@ module = { +@@ -980,6 +990,7 @@ module = { module = { name = loadenv; common = commands/loadenv.c; @@ -58,10 +58,10 @@ index 41b5e16a3ce..57e253ab1a1 100644 diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c new file mode 100644 -index 00000000000..54458b14518 +index 00000000000..ab35c75443a --- /dev/null +++ b/grub-core/commands/blscfg.c -@@ -0,0 +1,1096 @@ +@@ -0,0 +1,1171 @@ +/*-*- Mode: C; c-basic-offset: 2; indent-tabs-mode: t -*-*/ + +/* bls.c - implementation of the boot loader spec */ @@ -227,8 +227,8 @@ index 00000000000..54458b14518 + + /* loop through each version segment of str1 and str2 and compare them */ + while (*one || *two) { -+ while (*one && !grub_isalnum(*one) && *one != '~') one++; -+ while (*two && !grub_isalnum(*two) && *two != '~') two++; ++ while (*one && !grub_isalnum(*one) && *one != '~' && *one != '+') one++; ++ while (*two && !grub_isalnum(*two) && *two != '~' && *two != '+') two++; + + /* handle the tilde separator, it sorts before everything else */ + if (*one == '~' || *two == '~') { @@ -239,6 +239,21 @@ index 00000000000..54458b14518 + continue; + } + ++ /* ++ * Handle plus separator. Concept is the same as tilde, ++ * except that if one of the strings ends (base version), ++ * the other is considered as higher version. ++ */ ++ if (*one == '+' || *two == '+') { ++ if (!*one) return -1; ++ if (!*two) return 1; ++ if (*one != '+') goto_return (1); ++ if (*two != '+') goto_return (-1); ++ one++; ++ two++; ++ continue; ++ } ++ + /* If we ran to the end of either, we are finished with the loop */ + if (!(*one && *two)) break; + @@ -649,13 +664,19 @@ index 00000000000..54458b14518 + list[nlist] = NULL; + } + ++ if (!nlist) ++ { ++ grub_free (list); ++ return NULL; ++ } ++ + if (num) + *num = nlist; + + return list; +} + -+static char *field_append(bool is_var, char *buffer, char *start, char *end) ++static char *field_append(bool is_var, char *buffer, const char *start, const char *end) +{ + char *temp = grub_strndup(start, end - start + 1); + const char *field = temp; @@ -666,26 +687,25 @@ index 00000000000..54458b14518 + return buffer; + } + -+ if (!buffer) { -+ buffer = grub_strdup(field); -+ if (!buffer) -+ return NULL; -+ } else { -+ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field)); -+ if (!buffer) -+ return NULL; ++ if (!buffer) ++ buffer = grub_zalloc (grub_strlen(field) + 1); ++ else ++ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field) + 1); + -+ grub_stpcpy (buffer + grub_strlen(buffer), field); -+ } ++ if (!buffer) ++ return NULL; ++ ++ grub_stpcpy (buffer + grub_strlen(buffer), field); ++ grub_stpcpy (buffer + grub_strlen(buffer), " "); + + return buffer; +} + -+static char *expand_val(char *value) ++static char *expand_val(const char *value) +{ + char *buffer = NULL; -+ char *start = value; -+ char *end = value; ++ const char *start = value; ++ const char *end = value; + bool is_var = false; + + if (!value) @@ -762,6 +782,8 @@ index 00000000000..54458b14518 + const char *early_initrd = NULL; + char **early_initrds = NULL; + char *initrd_prefix = NULL; ++ char *devicetree = NULL; ++ char *dt = NULL; + char *id = entry->filename; + char *dotconf = id; + char *hotkey = NULL; @@ -773,6 +795,7 @@ index 00000000000..54458b14518 + + char *src = NULL; + int i, index; ++ bool add_dt_prefix = false; + + grub_dprintf("blscfg", "%s got here\n", __func__); + clinux = bls_get_val (entry, "linux", NULL); @@ -800,6 +823,14 @@ index 00000000000..54458b14518 + + initrds = bls_make_list (entry, "initrd", NULL); + ++ devicetree = expand_val (bls_get_val (entry, "devicetree", NULL)); ++ ++ if (!devicetree) ++ { ++ devicetree = expand_val (grub_env_get("devicetree")); ++ add_dt_prefix = true; ++ } ++ + hotkey = bls_get_val (entry, "grub_hotkey", NULL); + users = expand_val (bls_get_val (entry, "grub_users", NULL)); + classes = bls_make_list (entry, "grub_class", NULL); @@ -865,7 +896,6 @@ index 00000000000..54458b14518 + goto finish; + } + -+ + tmp = grub_stpcpy(initrd, "initrd"); + for (i = 0; early_initrds != NULL && early_initrds[i] != NULL; i++) + { @@ -885,21 +915,68 @@ index 00000000000..54458b14518 + tmp = grub_stpcpy (tmp, "\n"); + } + -+ src = grub_xasprintf ("load_video\n" ++ if (devicetree) ++ { ++ char *prefix = NULL; ++ int dt_size; ++ ++ if (add_dt_prefix) ++ { ++ prefix = grub_strrchr (clinux, '/'); ++ prefix = grub_strndup(clinux, prefix - clinux + 1); ++ if (!prefix) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ goto finish; ++ } ++ } ++ ++ dt_size = sizeof("devicetree " GRUB_BOOT_DEVICE) + grub_strlen(devicetree) + 1; ++ ++ if (add_dt_prefix) ++ { ++ dt_size += grub_strlen(prefix); ++ } ++ ++ dt = grub_malloc (dt_size); ++ if (!dt) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ goto finish; ++ } ++ char *tmp = dt; ++ tmp = grub_stpcpy (dt, "devicetree"); ++ tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); ++ if (add_dt_prefix) ++ tmp = grub_stpcpy (tmp, prefix); ++ tmp = grub_stpcpy (tmp, devicetree); ++ tmp = grub_stpcpy (tmp, "\n"); ++ ++ grub_free(prefix); ++ } ++ ++ grub_dprintf ("blscfg2", "devicetree %s for id:\"%s\"\n", dt, id); ++ ++ const char *sdval = grub_env_get("save_default"); ++ bool savedefault = ((NULL != sdval) && (grub_strcmp(sdval, "true") == 0)); ++ src = grub_xasprintf ("%sload_video\n" + "set gfxpayload=keep\n" + "insmod gzio\n" + "linux %s%s%s%s\n" -+ "%s", ++ "%s%s", ++ savedefault ? "savedefault\n" : "", + GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", -+ initrd ? initrd : ""); ++ initrd ? initrd : "", dt ? dt : ""); + + grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry); + grub_dprintf ("blscfg", "Added entry %d id:\"%s\"\n", index, id); + +finish: ++ grub_free (dt); + grub_free (initrd); + grub_free (initrd_prefix); + grub_free (early_initrds); ++ grub_free (devicetree); + grub_free (initrds); + grub_free (options); + grub_free (classes); @@ -1009,14 +1086,12 @@ index 00000000000..54458b14518 + if (!devid) { +#ifdef GRUB_MACHINE_EMU + devid = "host"; -+#elif defined(GRUB_MACHINE_EFI) -+ devid = grub_env_get ("root"); +#else -+ devid = grub_env_get ("boot"); ++ devid = grub_env_get ("root"); +#endif + if (!devid) + return grub_error (GRUB_ERR_FILE_NOT_FOUND, -+ N_("variable `%s' isn't set"), "boot"); ++ N_("variable `%s' isn't set"), "root"); + } + + grub_dprintf ("blscfg", "opening %s\n", devid); @@ -1159,10 +1234,10 @@ index 00000000000..54458b14518 + grub_unregister_extcmd (oldcmd); +} diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index db7a8f00273..891eac5a33f 100644 +index cc5971f4dbd..782761c31aa 100644 --- a/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c -@@ -133,7 +133,7 @@ legacy_file (const char *filename) +@@ -143,7 +143,7 @@ legacy_file (const char *filename) args[0] = oldname; grub_normal_add_menu_entry (1, args, NULL, NULL, "legacy", NULL, NULL, @@ -1171,7 +1246,7 @@ index db7a8f00273..891eac5a33f 100644 grub_free (args); entrysrc[0] = 0; grub_free (oldname); -@@ -186,7 +186,8 @@ legacy_file (const char *filename) +@@ -205,7 +205,8 @@ legacy_file (const char *filename) } args[0] = entryname; grub_normal_add_menu_entry (1, args, NULL, NULL, NULL, @@ -1277,7 +1352,7 @@ index 3fd664aac33..163b9a09042 100644 grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args) { diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index 2c5363da7f5..9faf2be0f64 100644 +index 720e6d8ea3b..b194123eb67 100644 --- a/grub-core/commands/menuentry.c +++ b/grub-core/commands/menuentry.c @@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args, @@ -1301,7 +1376,7 @@ index 2c5363da7f5..9faf2be0f64 100644 + grub_dprintf ("menu", "menu_id:\"%s\"\n", menu_id); /* Save argc, args to pass as parameters to block arg later. */ - menu_args = grub_malloc (sizeof (char*) * (argc + 1)); + menu_args = grub_calloc (argc + 1, sizeof (char *)); @@ -170,8 +173,12 @@ grub_normal_add_menu_entry (int argc, const char **args, } @@ -1349,11 +1424,11 @@ index 2c5363da7f5..9faf2be0f64 100644 src[len - 1] = ch; args[argc - 1] = src; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 9ef98481f70..a326b192c89 100644 +index 62571e6dfcc..7ca2e5400b1 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -20,6 +20,7 @@ - #include +@@ -21,6 +21,7 @@ + #include #include #include +#include @@ -1472,11 +1547,11 @@ index 00000000000..952f46121bd + return 0; +} diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index c9e1d7a73dc..9859ff4cc79 100644 +index 8f3be3ae706..ebafec68957 100644 --- a/include/grub/compiler.h +++ b/include/grub/compiler.h -@@ -48,4 +48,6 @@ - # define WARN_UNUSED_RESULT +@@ -56,4 +56,6 @@ + # define CLANG_PREREQ(maj,min) 0 #endif +#define UNUSED __attribute__((__unused__)) diff --git a/0028-Add-devicetree-loading.patch b/0019-Add-devicetree-loading.patch similarity index 94% rename from 0028-Add-devicetree-loading.patch rename to 0019-Add-devicetree-loading.patch index 2558faa1..e55047e8 100644 --- a/0028-Add-devicetree-loading.patch +++ b/0019-Add-devicetree-loading.patch @@ -20,10 +20,10 @@ Signed-off-by: David A. Marlin 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 9ecbcfb5b43..c645351dd2a 100644 +index f8cbb8d7a2b..91d761bae80 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -254,7 +254,8 @@ export GRUB_DEFAULT \ +@@ -251,7 +251,8 @@ export GRUB_DEFAULT \ GRUB_ENABLE_CRYPTODISK \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ @@ -34,7 +34,7 @@ index 9ecbcfb5b43..c645351dd2a 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 58defdbd83f..dd3128440c4 100644 +index e8b01c0d0c7..dc75a1c30bf 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -153,6 +153,13 @@ EOF diff --git a/0019-DHCP-client-ID-and-UUID-options-added.patch b/0019-DHCP-client-ID-and-UUID-options-added.patch deleted file mode 100644 index 6167b622..00000000 --- a/0019-DHCP-client-ID-and-UUID-options-added.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Mon, 8 Jul 2019 14:10:58 +0200 -Subject: [PATCH] DHCP client ID and UUID options added. - ---- - grub-core/net/bootp.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++----- - include/grub/net.h | 2 ++ - 2 files changed, 79 insertions(+), 8 deletions(-) - -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 04cfbb04504..0e6e41a1699 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -95,6 +95,49 @@ enum - /* Max timeout when waiting for BOOTP/DHCP reply */ - #define GRUB_DHCP_MAX_PACKET_TIMEOUT 32 - -+static char * -+grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)), -+ const char *val __attribute__ ((unused))) -+{ -+ return NULL; -+} -+ -+static void -+set_env_limn_ro (const char *intername, const char *suffix, -+ const char *value, grub_size_t len) -+{ -+ char *varname, *varvalue; -+ char *ptr; -+ varname = grub_xasprintf ("net_%s_%s", intername, suffix); -+ if (!varname) -+ return; -+ for (ptr = varname; *ptr; ptr++) -+ if (*ptr == ':') -+ *ptr = '_'; -+ varvalue = grub_malloc (len + 1); -+ if (!varvalue) -+ { -+ grub_free (varname); -+ return; -+ } -+ -+ grub_memcpy (varvalue, value, len); -+ varvalue[len] = 0; -+ grub_env_set (varname, varvalue); -+ grub_register_variable_hook (varname, 0, grub_env_write_readonly); -+ grub_env_export (varname); -+ grub_free (varname); -+ grub_free (varvalue); -+} -+ -+static char -+hexdigit (grub_uint8_t val) -+{ -+ if (val < 10) -+ return val + '0'; -+ return val + 'a' - 10; -+} -+ - static const void * - find_dhcp_option (const struct grub_net_bootp_packet *bp, grub_size_t size, - grub_uint8_t opt_code, grub_uint8_t *opt_len) -@@ -152,6 +195,9 @@ again: - if (i + taglength >= size) - return NULL; - -+ grub_dprintf("net", "DHCP option %u (0x%02x) found with length %u.\n", -+ tagtype, tagtype, taglength); -+ - /* FIXME RFC 3396 options concatentation */ - if (tagtype == opt_code) - { -@@ -354,6 +400,37 @@ grub_net_configure_by_dhcp_ack (const char *name, - } - grub_net_add_ipv4_local (inter, mask); - -+ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_CLIENT_ID, &opt_len); -+ if (opt) -+ { -+ set_env_limn_ro (name, "clientid", (char *) opt, opt_len); -+ } -+ -+ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_CLIENT_UUID, &opt_len); -+ if (opt && opt_len == 17) -+ { -+ /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */ -+ -+ opt += 1; -+ opt_len -= 1; -+ -+ char *val = grub_malloc (2 * opt_len + 4 + 1); -+ int i = 0; -+ int j = 0; -+ for (i = 0; i < opt_len; i++) -+ { -+ val[2 * i + j] = hexdigit (opt[i] >> 4); -+ val[2 * i + 1 + j] = hexdigit (opt[i] & 0xf); -+ -+ if ((i == 3) || (i == 5) || (i == 7) || (i == 9)) -+ { -+ j++; -+ val[2 * i + 1+ j] = '-'; -+ } -+ } -+ set_env_limn_ro (name, "clientuuid", (char *) val, 2 * opt_len + 4); -+ } -+ - /* We do not implement dead gateway detection and the first entry SHOULD - be preferred one */ - opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_ROUTER, &opt_len); -@@ -631,14 +708,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb, - } - } - --static char --hexdigit (grub_uint8_t val) --{ -- if (val < 10) -- return val + '0'; -- return val + 'a' - 10; --} -- - static grub_err_t - grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), - int argc, char **args) -diff --git a/include/grub/net.h b/include/grub/net.h -index 4a9069a1474..556c54e579f 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -462,6 +462,8 @@ enum - GRUB_NET_BOOTP_DOMAIN = 0x0f, - GRUB_NET_BOOTP_ROOT_PATH = 0x11, - GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, -+ GRUB_NET_BOOTP_CLIENT_ID = 0x3d, -+ GRUB_NET_BOOTP_CLIENT_UUID = 0x61, - GRUB_NET_DHCP_REQUESTED_IP_ADDRESS = 50, - GRUB_NET_DHCP_OVERLOAD = 52, - GRUB_NET_DHCP_MESSAGE_TYPE = 53, diff --git a/0029-Don-t-write-messages-to-the-screen.patch b/0020-Don-t-write-messages-to-the-screen.patch similarity index 89% rename from 0029-Don-t-write-messages-to-the-screen.patch rename to 0020-Don-t-write-messages-to-the-screen.patch index 56774342..0decd847 100644 --- a/0029-Don-t-write-messages-to-the-screen.patch +++ b/0020-Don-t-write-messages-to-the-screen.patch @@ -8,11 +8,10 @@ happens so quickly it looks like something is wrong and isn't very appealing. --- grub-core/gettext/gettext.c | 25 +++++-------------------- - grub-core/kern/main.c | 5 ----- grub-core/boot/i386/pc/boot.S | 3 --- grub-core/boot/i386/pc/diskboot.S | 5 ----- util/grub.d/10_linux.in | 7 ------- - 5 files changed, 5 insertions(+), 40 deletions(-) + 4 files changed, 5 insertions(+), 35 deletions(-) diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c index 4d02e62c109..84d520cd494 100644 @@ -96,22 +95,6 @@ index 4d02e62c109..84d520cd494 100644 grub_register_variable_hook ("locale_dir", NULL, read_main); grub_register_variable_hook ("secondary_locale_dir", NULL, read_secondary); -diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 8ab7794c47b..da47b18b50e 100644 ---- a/grub-core/kern/main.c -+++ b/grub-core/kern/main.c -@@ -268,11 +268,6 @@ grub_main (void) - - grub_boot_time ("After machine init."); - -- /* Hello. */ -- grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); -- grub_printf ("Welcome to GRUB!\n\n"); -- grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); -- - grub_load_config (); - - grub_boot_time ("Before loading embedded modules."); diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S index 2bd0b2d2866..ea167fe1206 100644 --- a/grub-core/boot/i386/pc/boot.S @@ -143,7 +126,7 @@ index c1addc0df29..68d31de0c4c 100644 movw $LOCAL(firstlist), %di diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index dd3128440c4..ceb413fc2e3 100644 +index dc75a1c30bf..ad2ac4b078d 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -138,27 +138,20 @@ linux_entry () diff --git a/0020-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch b/0020-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch deleted file mode 100644 index 265e777f..00000000 --- a/0020-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Prarit Bhargava -Date: Wed, 12 Mar 2014 10:58:16 -0400 -Subject: [PATCH] Fix bad test on GRUB_DISABLE_SUBMENU. - -The file /etc/grub.d/10_linux does - -if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then - -when it should do - -if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then - -which results in submenus in /boot/grub2/grub.cfg when -GRUB_DISABLE_SUBMENU="yes". - -Resolves: rhbz#1063414 ---- - util/grub.d/10_linux.in | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 4532266be68..58defdbd83f 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -261,7 +261,11 @@ while [ "x$list" != "x" ] ; do - fi - fi - -- if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then -+ if [ "x${GRUB_DISABLE_SUBMENU}" = "xyes" ] || [ "x${GRUB_DISABLE_SUBMENU}" = "xy" ]; then -+ GRUB_DISABLE_SUBMENU="true" -+ fi -+ -+ if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then - linux_entry "${OS}" "${version}" simple \ - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - diff --git a/0021-Add-support-for-UEFI-operating-systems-returned-by-o.patch b/0021-Add-support-for-UEFI-operating-systems-returned-by-o.patch deleted file mode 100644 index 6ddda34a..00000000 --- a/0021-Add-support-for-UEFI-operating-systems-returned-by-o.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Wed, 12 Jun 2013 11:51:49 -0400 -Subject: [PATCH] Add support for UEFI operating systems returned by os-prober - -os-prober returns UEFI operating systems in the form: - -path:long-name:name - -where path is the path under the EFI directory on the ESP. This is in -contrast to legacy OSes, where path is the device string. Handle this case. ---- - util/grub.d/30_os-prober.in | 21 ++++++++++++++++++--- - 1 file changed, 18 insertions(+), 3 deletions(-) - -diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 515a68c7aa0..9b8f5968e2d 100644 ---- a/util/grub.d/30_os-prober.in -+++ b/util/grub.d/30_os-prober.in -@@ -328,8 +328,23 @@ EOF - EOF - ;; - *) -- # TRANSLATORS: %s is replaced by OS name. -- gettext_printf "%s is not yet supported by grub-mkconfig.\n" " ${LONGNAME}" >&2 -- ;; -+ case ${DEVICE} in -+ *.efi) -+ cat << EOF -+menuentry '$(echo "${LONGNAME}" | grub_quote)' { -+EOF -+ save_default_entry | grub_add_tab -+ cat << EOF -+ chainloader /EFI/${DEVICE} -+ boot -+} -+EOF -+ ;; -+ *) -+ echo -n " " -+ # TRANSLATORS: %s is replaced by OS name. -+ gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2 -+ ;; -+ esac - esac - done diff --git a/0030-Don-t-print-GNU-GRUB-header.patch b/0021-Don-t-print-GNU-GRUB-header.patch similarity index 96% rename from 0030-Don-t-print-GNU-GRUB-header.patch rename to 0021-Don-t-print-GNU-GRUB-header.patch index ce45d4bd..c903fd48 100644 --- a/0030-Don-t-print-GNU-GRUB-header.patch +++ b/0021-Don-t-print-GNU-GRUB-header.patch @@ -9,7 +9,7 @@ No one cares. 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index a326b192c89..09d0dfe76f1 100644 +index 7ca2e5400b1..5d5f7b539f5 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -208,15 +208,16 @@ read_config_file (const char *config) diff --git a/0031-Don-t-add-to-highlighted-row.patch b/0022-Don-t-add-to-highlighted-row.patch similarity index 95% rename from 0031-Don-t-add-to-highlighted-row.patch rename to 0022-Don-t-add-to-highlighted-row.patch index b2d55757..b83f543e 100644 --- a/0031-Don-t-add-to-highlighted-row.patch +++ b/0022-Don-t-add-to-highlighted-row.patch @@ -9,7 +9,7 @@ It is already highlighted. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index e22bb91f6e8..a3d1f23f68f 100644 +index 18240e76cea..65deafda531 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, diff --git a/0032-Message-string-cleanups.patch b/0023-Message-string-cleanups.patch similarity index 98% rename from 0032-Message-string-cleanups.patch rename to 0023-Message-string-cleanups.patch index 9b6208e9..e23ee1ad 100644 --- a/0032-Message-string-cleanups.patch +++ b/0023-Message-string-cleanups.patch @@ -9,7 +9,7 @@ Make use of terminology consistent. Remove jargon. 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index a3d1f23f68f..64a83862f66 100644 +index 65deafda531..cc5837ed2b8 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -157,9 +157,8 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run) diff --git a/0033-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch b/0024-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch similarity index 96% rename from 0033-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch rename to 0024-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch index 504f2735..920ef797 100644 --- a/0033-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch +++ b/0024-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Fix border spacing now that we aren't displaying it 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 64a83862f66..1062d64ee29 100644 +index cc5837ed2b8..b49835a9af7 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -331,12 +331,12 @@ grub_menu_init_page (int nested, int edit, diff --git a/0025-Add-X-option-to-printf-functions.patch b/0025-Add-X-option-to-printf-functions.patch deleted file mode 100644 index 5f2a0757..00000000 --- a/0025-Add-X-option-to-printf-functions.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Tue, 27 Nov 2012 16:58:39 -0200 -Subject: [PATCH] Add %X option to printf functions. - ---- - grub-core/kern/misc.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index cd63a8cea73..2656a670e09 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -588,7 +588,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) - static inline char * - grub_lltoa (char *str, int c, unsigned long long n) - { -- unsigned base = (c == 'x') ? 16 : 10; -+ unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10; - char *p; - - if ((long long) n < 0 && c == 'd') -@@ -603,7 +603,7 @@ grub_lltoa (char *str, int c, unsigned long long n) - do - { - unsigned d = (unsigned) (n & 0xf); -- *p++ = (d > 9) ? d + 'a' - 10 : d + '0'; -+ *p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0'; - } - while (n >>= 4); - else -@@ -676,6 +676,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, - { - case 'p': - case 'x': -+ case 'X': - case 'u': - case 'd': - case 'c': -@@ -762,6 +763,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, - switch (c) - { - case 'x': -+ case 'X': - case 'u': - args->ptr[curn].type = UNSIGNED_INT + longfmt; - break; -@@ -900,6 +902,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, - c = 'x'; - /* Fall through. */ - case 'x': -+ case 'X': - case 'u': - case 'd': - { diff --git a/0034-Use-the-correct-indentation-for-the-term-help-text.patch b/0025-Use-the-correct-indentation-for-the-term-help-text.patch similarity index 90% rename from 0034-Use-the-correct-indentation-for-the-term-help-text.patch rename to 0025-Use-the-correct-indentation-for-the-term-help-text.patch index 5a1f0b50..0ce3b048 100644 --- a/0034-Use-the-correct-indentation-for-the-term-help-text.patch +++ b/0025-Use-the-correct-indentation-for-the-term-help-text.patch @@ -9,10 +9,10 @@ That is consistent with the menu help text 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 09d0dfe76f1..7f61c5b618b 100644 +index 5d5f7b539f5..ec1cd257397 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -432,8 +432,8 @@ grub_normal_reader_init (int nested) +@@ -440,8 +440,8 @@ grub_normal_reader_init (int nested) grub_normal_init_page (term, 1); grub_term_setcursor (term, 1); diff --git a/0035-Indent-menu-entries.patch b/0026-Indent-menu-entries.patch similarity index 95% rename from 0035-Indent-menu-entries.patch rename to 0026-Indent-menu-entries.patch index 7a843ec0..7e588fd0 100644 --- a/0035-Indent-menu-entries.patch +++ b/0026-Indent-menu-entries.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Indent menu entries 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 1062d64ee29..ecc60f99fc3 100644 +index b49835a9af7..6a57376fa80 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -239,7 +239,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, diff --git a/0026-Search-for-specific-config-file-for-netboot.patch b/0026-Search-for-specific-config-file-for-netboot.patch deleted file mode 100644 index f94911cf..00000000 --- a/0026-Search-for-specific-config-file-for-netboot.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Tue, 27 Nov 2012 17:22:07 -0200 -Subject: [PATCH] Search for specific config file for netboot - -This patch implements a search for a specific configuration when the config -file is on a remoteserver. It uses the following order: - 1) DHCP client UUID option. - 2) MAC address (in lower case hexadecimal with dash separators); - 3) IP (in upper case hexadecimal) or IPv6; - 4) The original grub.cfg file. - -This procedure is similar to what is used by pxelinux and yaboot: -http://www.syslinux.org/wiki/index.php/PXELINUX#config - -This should close the bugzilla: -https://bugzilla.redhat.com/show_bug.cgi?id=873406 ---- - grub-core/net/net.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++ - grub-core/normal/main.c | 18 ++++++-- - include/grub/net.h | 3 ++ - 3 files changed, 135 insertions(+), 4 deletions(-) - -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index d5d726a315e..06454564b8f 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -1735,6 +1735,124 @@ grub_net_restore_hw (void) - return GRUB_ERR_NONE; - } - -+grub_err_t -+grub_net_search_configfile (char *config) -+{ -+ grub_size_t config_len; -+ char *suffix; -+ -+ auto int search_through (grub_size_t num_tries, grub_size_t slice_size); -+ int search_through (grub_size_t num_tries, grub_size_t slice_size) -+ { -+ while (num_tries-- > 0) -+ { -+ grub_dprintf ("net", "probe %s\n", config); -+ -+ grub_file_t file; -+ file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); -+ -+ if (file) -+ { -+ grub_file_close (file); -+ grub_dprintf ("net", "found!\n"); -+ return 0; -+ } -+ else -+ { -+ if (grub_errno == GRUB_ERR_IO) -+ grub_errno = GRUB_ERR_NONE; -+ } -+ -+ if (grub_strlen (suffix) < slice_size) -+ break; -+ -+ config[grub_strlen (config) - slice_size] = '\0'; -+ } -+ -+ return 1; -+ } -+ -+ config_len = grub_strlen (config); -+ config[config_len] = '-'; -+ suffix = config + config_len + 1; -+ -+ struct grub_net_network_level_interface *inf; -+ FOR_NET_NETWORK_LEVEL_INTERFACES (inf) -+ { -+ /* By the Client UUID. */ -+ -+ char client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) + -+ sizeof ("_clientuuid") + 1]; -+ grub_snprintf (client_uuid_var, sizeof (client_uuid_var), -+ "net_%s_clientuuid", inf->name); -+ -+ const char *client_uuid; -+ client_uuid = grub_env_get (client_uuid_var); -+ -+ if (client_uuid) -+ { -+ grub_strcpy (suffix, client_uuid); -+ if (search_through (1, 0) == 0) return GRUB_ERR_NONE; -+ } -+ -+ /* By the MAC address. */ -+ -+ /* Add ethernet type */ -+ grub_strcpy (suffix, "01-"); -+ -+ grub_net_hwaddr_to_str (&inf->hwaddress, suffix + 3); -+ -+ char *ptr; -+ for (ptr = suffix; *ptr; ptr++) -+ if (*ptr == ':') -+ *ptr = '-'; -+ -+ if (search_through (1, 0) == 0) return GRUB_ERR_NONE; -+ -+ /* By IP address */ -+ -+ switch ((&inf->address)->type) -+ { -+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4: -+ { -+ grub_uint32_t n = grub_be_to_cpu32 ((&inf->address)->ipv4); -+ grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%02X%02X%02X%02X", \ -+ ((n >> 24) & 0xff), ((n >> 16) & 0xff), \ -+ ((n >> 8) & 0xff), ((n >> 0) & 0xff)); -+ -+ if (search_through (8, 1) == 0) return GRUB_ERR_NONE; -+ break; -+ } -+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6: -+ { -+ char buf[GRUB_NET_MAX_STR_ADDR_LEN]; -+ struct grub_net_network_level_address base; -+ base.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -+ grub_memcpy (&base.ipv6, ((&inf->address)->ipv6), 16); -+ grub_net_addr_to_str (&base, buf); -+ -+ for (ptr = buf; *ptr; ptr++) -+ if (*ptr == ':') -+ *ptr = '-'; -+ -+ grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%s", buf); -+ if (search_through (1, 0) == 0) return GRUB_ERR_NONE; -+ break; -+ } -+ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV: -+ return grub_error (GRUB_ERR_BUG, "shouldn't reach here"); -+ default: -+ return grub_error (GRUB_ERR_BUG, -+ "unsupported address type %d", (&inf->address)->type); -+ } -+ } -+ -+ /* Remove the remaining minus sign at the end. */ -+ config[config_len] = '\0'; -+ -+ return GRUB_ERR_NONE; -+} -+ - static struct grub_preboot *fini_hnd; - - static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 394bfbea868..9ef98481f70 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - #ifdef GRUB_MACHINE_IEEE1275 - #include - #endif -@@ -365,10 +366,19 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), - - prefix = grub_env_get ("prefix"); - if (prefix) -- { -- config = grub_xasprintf ("%s/grub.cfg", prefix); -- if (! config) -- goto quit; -+ { -+ grub_size_t config_len; -+ config_len = grub_strlen (prefix) + -+ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); -+ config = grub_malloc (config_len); -+ -+ if (! config) -+ goto quit; -+ -+ grub_snprintf (config, config_len, "%s/grub.cfg", prefix); -+ -+ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) -+ grub_net_search_configfile (config); - - grub_enter_normal_mode (config); - grub_free (config); -diff --git a/include/grub/net.h b/include/grub/net.h -index 556c54e579f..ff6d347f7da 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -578,4 +578,7 @@ extern char *grub_net_default_server; - - #define VLANTAG_IDENTIFIER 0x8100 - -+grub_err_t -+grub_net_search_configfile (char *config); -+ - #endif /* ! GRUB_NET_HEADER */ diff --git a/0036-Fix-margins.patch b/0027-Fix-margins.patch similarity index 97% rename from 0036-Fix-margins.patch rename to 0027-Fix-margins.patch index 9be17318..baa10edf 100644 --- a/0036-Fix-margins.patch +++ b/0027-Fix-margins.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Fix margins 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index ecc60f99fc3..0e43f2c10cc 100644 +index 6a57376fa80..cbd62f714cb 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -333,17 +333,15 @@ grub_menu_init_page (int nested, int edit, diff --git a/0037-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch b/0028-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch similarity index 95% rename from 0037-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch rename to 0028-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch index 3a378398..79321807 100644 --- a/0037-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch +++ b/0028-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 0e43f2c10cc..537d4bf86ff 100644 +index cbd62f714cb..26e9e82042a 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -334,7 +334,7 @@ grub_menu_init_page (int nested, int edit, diff --git a/0038-Enable-pager-by-default.-985860.patch b/0029-Enable-pager-by-default.-985860.patch similarity index 100% rename from 0038-Enable-pager-by-default.-985860.patch rename to 0029-Enable-pager-by-default.-985860.patch diff --git a/0039-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch b/0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch similarity index 96% rename from 0039-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch rename to 0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch index 93233bc9..7e9e8294 100644 --- a/0039-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch +++ b/0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 537d4bf86ff..452d55bf9ff 100644 +index 26e9e82042a..4895ffe7d1d 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -157,7 +157,7 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run) diff --git a/0040-Don-t-say-GNU-Linux-in-generated-menus.patch b/0031-Don-t-say-GNU-Linux-in-generated-menus.patch similarity index 95% rename from 0040-Don-t-say-GNU-Linux-in-generated-menus.patch rename to 0031-Don-t-say-GNU-Linux-in-generated-menus.patch index ced25602..db2a8b5b 100644 --- a/0040-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0031-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus. 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index ceb413fc2e3..2b402d85a52 100644 +index ad2ac4b078d..4fc58c83304 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -25,7 +25,7 @@ index ceb413fc2e3..2b402d85a52 100644 fi diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 96179ea613c..47e0d3f5cd6 100644 +index 3b1f4704921..ada20775a14 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0041-Don-t-draw-a-border-around-the-menu.patch b/0032-Don-t-draw-a-border-around-the-menu.patch similarity index 98% rename from 0041-Don-t-draw-a-border-around-the-menu.patch rename to 0032-Don-t-draw-a-border-around-the-menu.patch index e5d11ac1..31a973ea 100644 --- a/0041-Don-t-draw-a-border-around-the-menu.patch +++ b/0032-Don-t-draw-a-border-around-the-menu.patch @@ -9,7 +9,7 @@ It looks cleaner without it. 1 file changed, 43 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 452d55bf9ff..1ed2bd92cf8 100644 +index 4895ffe7d1d..e72ed438ba3 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -108,47 +108,6 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right, diff --git a/0042-Use-the-standard-margin-for-the-timeout-string.patch b/0033-Use-the-standard-margin-for-the-timeout-string.patch similarity index 97% rename from 0042-Use-the-standard-margin-for-the-timeout-string.patch rename to 0033-Use-the-standard-margin-for-the-timeout-string.patch index c6c770c8..49a382d8 100644 --- a/0042-Use-the-standard-margin-for-the-timeout-string.patch +++ b/0033-Use-the-standard-margin-for-the-timeout-string.patch @@ -9,7 +9,7 @@ So that it aligns with the other messages 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 1ed2bd92cf8..7681f7d2893 100644 +index e72ed438ba3..ca135624356 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -372,7 +372,7 @@ grub_menu_init_page (int nested, int edit, diff --git a/0043-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0034-Add-.eh_frame-to-list-of-relocations-stripped.patch similarity index 96% rename from 0043-Add-.eh_frame-to-list-of-relocations-stripped.patch rename to 0034-Add-.eh_frame-to-list-of-relocations-stripped.patch index 4ab92e52..ed48c5c7 100644 --- a/0043-Add-.eh_frame-to-list-of-relocations-stripped.patch +++ b/0034-Add-.eh_frame-to-list-of-relocations-stripped.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Add .eh_frame to list of relocations stripped 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 6cd71cbb2ab..4ba729e14d8 100644 +index 2a1a886f6d5..191b1a70c6b 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding diff --git a/0045-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0035-Don-t-require-a-password-to-boot-entries-generated-b.patch similarity index 96% rename from 0045-Don-t-require-a-password-to-boot-entries-generated-b.patch rename to 0035-Don-t-require-a-password-to-boot-entries-generated-b.patch index c7370293..fb0e1976 100644 --- a/0045-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0035-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 2b402d85a52..d35b0f406bc 100644 +index 4fc58c83304..635d2fe0cd3 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -26,7 +26,7 @@ datarootdir="@datarootdir@" diff --git a/0046-Don-t-emit-Booting-.-message.patch b/0036-Don-t-emit-Booting-.-message.patch similarity index 87% rename from 0046-Don-t-emit-Booting-.-message.patch rename to 0036-Don-t-emit-Booting-.-message.patch index 63d1812e..4133b526 100644 --- a/0046-Don-t-emit-Booting-.-message.patch +++ b/0036-Don-t-emit-Booting-.-message.patch @@ -14,10 +14,10 @@ Signed-off-by: Peter Jones 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 9175ad297d8..783bde55b9e 100644 +index d7a222e681b..37d753d8081 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c -@@ -839,12 +839,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) +@@ -838,12 +838,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) /* Callback invoked immediately before a menu entry is executed. */ static void @@ -34,10 +34,10 @@ index 9175ad297d8..783bde55b9e 100644 /* Callback invoked when a default menu entry executed because of a timeout diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index cdf3590a364..5785f67ee1c 100644 +index 50eef918cf6..de64a367c4e 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c -@@ -1167,9 +1167,6 @@ run (struct screen *screen) +@@ -1176,9 +1176,6 @@ run (struct screen *screen) char *dummy[1] = { NULL }; grub_cls (); diff --git a/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch similarity index 99% rename from 0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch rename to 0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch index 8c1bd8f9..79399654 100644 --- a/0047-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +++ b/0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch @@ -122,10 +122,10 @@ Replace a bunch of machine generated ones with ones that look nicer. create mode 100644 util/grub-sparc64-setup.8 diff --git a/configure.ac b/configure.ac -index d283af64c8c..8df400e0a8b 100644 +index c0103b30d4e..b8c4d52dfd1 100644 --- a/configure.ac +++ b/configure.ac -@@ -74,6 +74,29 @@ grub_TRANSFORM([grub-set-default]) +@@ -77,6 +77,29 @@ grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-sparc64-setup]) grub_TRANSFORM([grub-render-label]) grub_TRANSFORM([grub-file]) @@ -156,7 +156,7 @@ index d283af64c8c..8df400e0a8b 100644 # Optimization flag. Allow user to override. if test "x$TARGET_CFLAGS" = x; then diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 46c4e95e2fa..58d7d9540be 100644 +index 8f1485d52a5..b909f2c073a 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -11,7 +11,6 @@ EXTRA_DIST += unicode @@ -498,7 +498,7 @@ index ad25c8ab753..00000000000 -[SEE ALSO] -.BR grub-menulst2cfg (8) diff --git a/gentpl.py b/gentpl.py -index 387588c0589..f05812eace3 100644 +index c86550d4f9e..2cba0bbbd6f 100644 --- a/gentpl.py +++ b/gentpl.py @@ -805,10 +805,7 @@ def manpage(defn, adddeps): diff --git a/0048-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0038-use-fw_path-prefix-when-fallback-searching-for-grub-.patch similarity index 97% rename from 0048-use-fw_path-prefix-when-fallback-searching-for-grub-.patch rename to 0038-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index 65b88553..985205c1 100644 --- a/0048-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0038-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -17,7 +17,7 @@ Signed-off-by: Mark Salter 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 7f61c5b618b..8add30e605f 100644 +index ec1cd257397..d85f7598d23 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -349,7 +349,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0049-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0039-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch similarity index 77% rename from 0049-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch rename to 0039-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index 45a09827..61dd5caa 100644 --- a/0049-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0039-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Try mac/guid/etc before grub.cfg on tftp config files. Signed-off-by: Peter Jones --- - grub-core/normal/main.c | 84 ++++++++++++++++++++++++++----------------------- - 1 file changed, 45 insertions(+), 39 deletions(-) + grub-core/normal/main.c | 97 ++++++++++++++++++++++++++----------------------- + 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 8add30e605f..d93bee613ac 100644 +index d85f7598d23..1e509fceb91 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -347,53 +347,59 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), +@@ -347,61 +347,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), /* Guess the config filename. It is necessary to make CONFIG static, so that it won't get broken by longjmp. */ char *config; @@ -41,25 +41,39 @@ index 8add30e605f..d93bee613ac 100644 - } - } + const char *prefix; ++ const char *net_search_cfg; ++ int disable_net_search = 0; + prefix = grub_env_get ("fw_path"); if (! prefix) prefix = grub_env_get ("prefix"); ++ ++ net_search_cfg = grub_env_get ("feature_net_search_cfg"); ++ if (net_search_cfg && net_search_cfg[0] == 'n') ++ disable_net_search = 1; + if (prefix) { - grub_size_t config_len; +- int disable_net_search = 0; +- const char *net_search_cfg; +- - config_len = grub_strlen (prefix) + -- sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); +- sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); - config = grub_malloc (config_len); - -- if (! config) +- if (!config) - goto quit; - - grub_snprintf (config, config_len, "%s/grub.cfg", prefix); - - if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) -- grub_net_search_configfile (config); +- net_search_cfg = grub_env_get ("feature_net_search_cfg"); +- if (net_search_cfg && net_search_cfg[0] == 'n') +- disable_net_search = 1; +- + if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0 && + !disable_net_search) +- grub_net_search_config_file (config); + { + grub_size_t config_len; + config_len = grub_strlen (prefix) + diff --git a/0053-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0040-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch similarity index 96% rename from 0053-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch rename to 0040-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index 6acd50e9..ef0b0f4b 100644 --- a/0053-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0040-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index d35b0f406bc..d12d2d784dc 100644 +index 635d2fe0cd3..fed73271478 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0054-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0041-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch similarity index 93% rename from 0054-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch rename to 0041-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch index fc296338..3e2d3ae5 100644 --- a/0054-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +++ b/0041-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 1 file changed, 8 insertions(+) diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 1001a12232b..1a4a57898f9 100644 +index 301d1ac229a..0f6505bf3b6 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in -@@ -249,6 +249,14 @@ version_test_gt () +@@ -253,6 +253,14 @@ version_test_gt () *.old:*.old) ;; *.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;; *:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;; diff --git a/0055-Try-prefix-if-fw_path-doesn-t-work.patch b/0042-Try-prefix-if-fw_path-doesn-t-work.patch similarity index 85% rename from 0055-Try-prefix-if-fw_path-doesn-t-work.patch rename to 0042-Try-prefix-if-fw_path-doesn-t-work.patch index 6c167e99..59489bd9 100644 --- a/0055-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0042-Try-prefix-if-fw_path-doesn-t-work.patch @@ -7,10 +7,10 @@ Related: rhbz#1148652 Signed-off-by: Peter Jones --- - grub-core/kern/ieee1275/init.c | 28 +++++----- + grub-core/kern/ieee1275/init.c | 28 +++++---- grub-core/net/net.c | 2 +- - grub-core/normal/main.c | 120 ++++++++++++++++++++--------------------- - 3 files changed, 75 insertions(+), 75 deletions(-) + grub-core/normal/main.c | 134 ++++++++++++++++++++--------------------- + 3 files changed, 82 insertions(+), 82 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c index e71d1584164..0cd2a627231 100644 @@ -56,10 +56,10 @@ index e71d1584164..0cd2a627231 100644 } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 06454564b8f..4b7972b8e7e 100644 +index 4d3eb5c1a52..0ef148f4adc 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c -@@ -1850,7 +1850,7 @@ grub_net_search_configfile (char *config) +@@ -1869,7 +1869,7 @@ grub_net_search_config_file (char *config) /* Remove the remaining minus sign at the end. */ config[config_len] = '\0'; @@ -69,10 +69,10 @@ index 06454564b8f..4b7972b8e7e 100644 static struct grub_preboot *fini_hnd; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index d93bee613ac..2fe6743399d 100644 +index 1e509fceb91..d5968797f4f 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -337,74 +337,72 @@ grub_enter_normal_mode (const char *config) +@@ -337,81 +337,79 @@ grub_enter_normal_mode (const char *config) grub_boot_time ("Exiting normal mode"); } @@ -82,12 +82,19 @@ index d93bee613ac..2fe6743399d 100644 + char *config; + const char *prefix; + grub_err_t err = GRUB_ERR_FILE_NOT_FOUND; ++ const char *net_search_cfg; ++ int disable_net_search = 0; + + prefix = grub_env_get (variable); + if (!prefix) + return GRUB_ERR_FILE_NOT_FOUND; + -+ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) ++ net_search_cfg = grub_env_get ("feature_net_search_cfg"); ++ if (net_search_cfg && net_search_cfg[0] == 'n') ++ disable_net_search = 1; ++ ++ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0 && ++ !disable_net_search) + { + grub_size_t config_len; + config_len = grub_strlen (prefix) + @@ -98,7 +105,7 @@ index d93bee613ac..2fe6743399d 100644 + return GRUB_ERR_FILE_NOT_FOUND; + + grub_snprintf (config, config_len, "%s/grub.cfg", prefix); -+ err = grub_net_search_configfile (config); ++ err = grub_net_search_config_file (config); + } + + if (err != GRUB_ERR_NONE) @@ -135,14 +142,21 @@ index d93bee613ac..2fe6743399d 100644 - so that it won't get broken by longjmp. */ - char *config; - const char *prefix; +- const char *net_search_cfg; +- int disable_net_search = 0; - - prefix = grub_env_get ("fw_path"); - if (! prefix) - prefix = grub_env_get ("prefix"); - +- net_search_cfg = grub_env_get ("feature_net_search_cfg"); +- if (net_search_cfg && net_search_cfg[0] == 'n') +- disable_net_search = 1; +- - if (prefix) - { -- if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) +- if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0 && +- !disable_net_search) - { - grub_size_t config_len; - config_len = grub_strlen (prefix) + diff --git a/0057-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch similarity index 93% rename from 0057-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch rename to 0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch index bfebe38c..fce54783 100644 --- a/0057-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +++ b/0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch @@ -13,21 +13,23 @@ Resolves rhbz#1124074 Signed-off-by: Robert Marshall [pjones: fix --enable-rpm-sort configure option] Signed-off-by: Peter Jones +[thierry.vignaud: fix build with rpm-4.16] +Signed-off-by: Thierry Vignaud --- - configure.ac | 29 +++++ + configure.ac | 38 +++++++ Makefile.util.def | 16 +++ util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ util/grub-mkconfig_lib.in | 11 +- util/grub-rpm-sort.8 | 12 ++ - 5 files changed, 348 insertions(+), 1 deletion(-) + 5 files changed, 357 insertions(+), 1 deletion(-) create mode 100644 util/grub-rpm-sort.c create mode 100644 util/grub-rpm-sort.8 diff --git a/configure.ac b/configure.ac -index 8df400e0a8b..6927615819b 100644 +index b8c4d52dfd1..ac84a8ccf69 100644 --- a/configure.ac +++ b/configure.ac -@@ -69,6 +69,7 @@ grub_TRANSFORM([grub-mkrelpath]) +@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) grub_TRANSFORM([grub-mkrescue]) grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-reboot]) @@ -35,7 +37,7 @@ index 8df400e0a8b..6927615819b 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-sparc64-setup]) -@@ -92,6 +93,7 @@ grub_TRANSFORM([grub-mkrescue.1]) +@@ -95,6 +96,7 @@ grub_TRANSFORM([grub-mkrescue.1]) grub_TRANSFORM([grub-mkstandalone.3]) grub_TRANSFORM([grub-ofpathname.3]) grub_TRANSFORM([grub-probe.3]) @@ -43,7 +45,7 @@ index 8df400e0a8b..6927615819b 100644 grub_TRANSFORM([grub-reboot.3]) grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) -@@ -1802,6 +1804,33 @@ fi +@@ -1860,6 +1862,42 @@ fi AC_SUBST([LIBDEVMAPPER]) @@ -72,16 +74,25 @@ index 8df400e0a8b..6927615819b 100644 + [Define to 1 if you have the rpm library.]) +fi + ++if test x"$LIBRPM" = x ; then ++ # Check for rpm library. ++ AC_CHECK_LIB([rpmio], [rpmvercmp], [], ++ [rpm_sort_excuse="rpmio missing rpmvercmp"]) ++ LIBRPM="-lrpmio"; ++ AC_DEFINE([HAVE_RPMIO], [1], ++ [Define to 1 if you have the rpm library.]) ++fi ++ +AC_SUBST([LIBRPM]) + LIBGEOM= if test x$host_kernel = xkfreebsd; then AC_CHECK_LIB([geom], [geom_gettree], [], diff --git a/Makefile.util.def b/Makefile.util.def -index 1f298d05f3d..843ce092b94 100644 +index 2c9b283a230..ba4cf4b29b0 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -696,6 +696,22 @@ program = { +@@ -703,6 +703,22 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -392,7 +403,7 @@ index 00000000000..f33bd1ed568 + return 0; +} diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 1a4a57898f9..113a41f9409 100644 +index 0f6505bf3b6..42c2ea9ba50 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -33,6 +33,9 @@ fi @@ -403,9 +414,9 @@ index 1a4a57898f9..113a41f9409 100644 + grub_rpm_sort="${sbindir}/@grub_rpm_sort@" +fi - if which gettext >/dev/null 2>/dev/null; then + if command -v gettext >/dev/null; then : -@@ -214,6 +217,12 @@ version_sort () +@@ -218,6 +221,12 @@ version_sort () esac } @@ -418,7 +429,7 @@ index 1a4a57898f9..113a41f9409 100644 version_test_numeric () { version_test_numeric_a="$1" -@@ -230,7 +239,7 @@ version_test_numeric () +@@ -234,7 +243,7 @@ version_test_numeric () version_test_numeric_a="$version_test_numeric_b" version_test_numeric_b="$version_test_numeric_c" fi diff --git a/0044-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch b/0044-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch deleted file mode 100644 index b8dbff50..00000000 --- a/0044-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Mon, 30 Jun 2014 14:16:46 -0400 -Subject: [PATCH] Don't munge raw spaces when we're doing our cmdline escaping - (#923374) - -Signed-off-by: Peter Jones ---- - grub-core/lib/cmdline.c | 11 +---------- - 1 file changed, 1 insertion(+), 10 deletions(-) - -diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index e0fb0a9e48a..8e2294d8ff6 100644 ---- a/grub-core/lib/cmdline.c -+++ b/grub-core/lib/cmdline.c -@@ -98,16 +98,7 @@ grub_create_loader_cmdline (int argc, char *argv[], char *buf, - - while (*c) - { -- if (*c == ' ') -- { -- *buf++ = '\\'; -- *buf++ = 'x'; -- *buf++ = '2'; -- *buf++ = '0'; -- c++; -- continue; -- } -- else if (*c == '\\' && *(c+1) == 'x' && -+ if (*c == '\\' && *(c+1) == 'x' && - is_hex(*(c+2)) && is_hex(*(c+3))) - { - *buf++ = *c++; diff --git a/0059-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0044-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 98% rename from 0059-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0044-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index 635a234d..4c474e4b 100644 --- a/0059-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0044-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index d12d2d784dc..12a20c9ad73 100644 +index fed73271478..2e59f3b4197 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -78,6 +78,32 @@ case x"$GRUB_FS" in diff --git a/0060-Add-friendly-grub2-password-config-tool-985962.patch b/0045-Add-friendly-grub2-password-config-tool-985962.patch similarity index 96% rename from 0060-Add-friendly-grub2-password-config-tool-985962.patch rename to 0045-Add-friendly-grub2-password-config-tool-985962.patch index 5374425f..5767794a 100644 --- a/0060-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0045-Add-friendly-grub2-password-config-tool-985962.patch @@ -27,10 +27,10 @@ Andy Lutomirski create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index 6927615819b..68501662e8d 100644 +index ac84a8ccf69..9ecd3540bd6 100644 --- a/configure.ac +++ b/configure.ac -@@ -69,6 +69,7 @@ grub_TRANSFORM([grub-mkrelpath]) +@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) grub_TRANSFORM([grub-mkrescue]) grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-reboot]) @@ -39,10 +39,10 @@ index 6927615819b..68501662e8d 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) diff --git a/Makefile.util.def b/Makefile.util.def -index 843ce092b94..e50436a4987 100644 +index ba4cf4b29b0..1a7dd433e33 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -451,6 +451,12 @@ script = { +@@ -452,6 +452,12 @@ script = { installdir = grubconf; }; @@ -55,7 +55,7 @@ index 843ce092b94..e50436a4987 100644 script = { name = '10_windows'; common = util/grub.d/10_windows.in; -@@ -733,6 +739,13 @@ script = { +@@ -740,6 +746,13 @@ script = { installdir = sbin; }; @@ -70,10 +70,10 @@ index 843ce092b94..e50436a4987 100644 name = grub-mkconfig_lib; common = util/grub-mkconfig_lib.in; diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index c645351dd2a..4e7a875309e 100644 +index 91d761bae80..3e4c6c5240b 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -282,6 +282,8 @@ for i in "${grub_mkconfig_dir}"/* ; do +@@ -279,6 +279,8 @@ for i in "${grub_mkconfig_dir}"/* ; do *~) ;; # emacsen autosave files. FIXME: support other editors */\#*\#) ;; diff --git a/0061-tcp-add-window-scaling-support.patch b/0046-tcp-add-window-scaling-support.patch similarity index 100% rename from 0061-tcp-add-window-scaling-support.patch rename to 0046-tcp-add-window-scaling-support.patch diff --git a/0064-efinet-and-bootp-add-support-for-dhcpv6.patch b/0047-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 92% rename from 0064-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0047-efinet-and-bootp-add-support-for-dhcpv6.patch index 0e60b8a4..96182c2e 100644 --- a/0064-efinet-and-bootp-add-support-for-dhcpv6.patch +++ b/0047-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -5,27 +5,19 @@ Subject: [PATCH] efinet and bootp: add support for dhcpv6 Signed-off-by: Peter Jones --- - grub-core/net/bootp.c | 174 +++++++++++++++++++++++++++++++++++++ - grub-core/net/drivers/efi/efinet.c | 54 ++++++++++-- + grub-core/net/bootp.c | 173 +++++++++++++++++++++++++++++++++++++ + grub-core/net/drivers/efi/efinet.c | 53 ++++++++++-- grub-core/net/net.c | 72 +++++++++++++++ grub-core/net/tftp.c | 4 + include/grub/efi/api.h | 129 +++++++++++++++++++++++++-- include/grub/net.h | 60 +++++++++++++ - 6 files changed, 479 insertions(+), 14 deletions(-) + 6 files changed, 477 insertions(+), 14 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 0e6e41a1699..8c969595a7b 100644 +index e33be51f83b..8d9edaac447 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - - struct grub_dhcp_discover_options -@@ -935,6 +936,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), +@@ -902,6 +902,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp; @@ -206,16 +198,15 @@ index 0e6e41a1699..8c969595a7b 100644 grub_bootp_init (void) { diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 5388f952ba9..a57189e8bb3 100644 +index 5388f952ba9..173fb63153c 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -18,11 +18,15 @@ +@@ -18,11 +18,14 @@ #include #include +#include #include -+#include #include #include #include @@ -225,7 +216,7 @@ index 5388f952ba9..a57189e8bb3 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -329,7 +333,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -329,7 +332,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, char **path) { struct grub_net_card *card; @@ -234,7 +225,7 @@ index 5388f952ba9..a57189e8bb3 100644 dp = grub_efi_get_device_path (hnd); if (! dp) -@@ -340,14 +344,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -340,14 +343,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, grub_efi_device_path_t *cdp; struct grub_efi_pxe *pxe; struct grub_efi_pxe_mode *pxe_mode; @@ -255,7 +246,7 @@ index 5388f952ba9..a57189e8bb3 100644 int match; /* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6 -@@ -356,7 +365,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -356,7 +364,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, devices. We skip them when enumerating cards, so here we need to find matching MAC device. */ @@ -263,7 +254,7 @@ index 5388f952ba9..a57189e8bb3 100644 if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) -@@ -373,16 +381,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -373,16 +380,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, if (!match) continue; } @@ -316,10 +307,10 @@ index 5388f952ba9..a57189e8bb3 100644 } } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 4b7972b8e7e..f24f1fd63f6 100644 +index 0ef148f4adc..22f2689aaeb 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c -@@ -955,6 +955,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa +@@ -960,6 +960,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa grub_net_network_level_interfaces = inter; } @@ -399,38 +390,37 @@ index 4b7972b8e7e..f24f1fd63f6 100644 grub_err_t grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter, diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 7d90bf66e76..a5c5038130a 100644 +index 7f44b30f521..4ab2f5c7357 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c -@@ -379,19 +379,23 @@ tftp_open (struct grub_file *file, const char *filename) - return grub_errno; - } +@@ -358,18 +358,22 @@ tftp_open (struct grub_file *file, const char *filename) + file->not_easily_seekable = 1; + file->data = data; -+ grub_dprintf ("tftp", "resolving address for %s\n", file->device->net->server); ++ grub_dprintf("tftp", "resolving address for %s\n", file->device->net->server); err = grub_net_resolve_address (file->device->net->server, &addr); if (err) { + grub_dprintf("tftp", "Address resolution failed: %d\n", err); - destroy_pq (data); grub_free (data); return err; } -+ grub_dprintf ("tftp", "opening connection\n"); ++ grub_dprintf("tftp", "opening connection\n"); data->sock = grub_net_udp_open (addr, TFTP_SERVER_PORT, tftp_receive, file); if (!data->sock) { -+ grub_dprintf ("tftp", "connection failed\n"); - destroy_pq (data); ++ grub_dprintf("tftp", "connection failed\n"); grub_free (data); return grub_errno; + } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index addcbfa8fb7..d97cdf98c80 100644 +index f1a52210c0c..117469450d3 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -572,10 +572,16 @@ typedef void *grub_efi_handle_t; +@@ -592,10 +592,16 @@ typedef void *grub_efi_handle_t; typedef void *grub_efi_event_t; typedef grub_efi_uint64_t grub_efi_lba_t; typedef grub_efi_uintn_t grub_efi_tpl_t; @@ -451,7 +441,7 @@ index addcbfa8fb7..d97cdf98c80 100644 typedef grub_efi_uint64_t grub_efi_physical_address_t; typedef grub_efi_uint64_t grub_efi_virtual_address_t; -@@ -1450,16 +1456,127 @@ struct grub_efi_simple_text_output_interface +@@ -1474,16 +1480,127 @@ struct grub_efi_simple_text_output_interface }; typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t; @@ -582,7 +572,7 @@ index addcbfa8fb7..d97cdf98c80 100644 typedef struct grub_efi_pxe diff --git a/include/grub/net.h b/include/grub/net.h -index ff6d347f7da..3647012374b 100644 +index 7ae4b6bd805..8a05ec4fe7a 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -447,6 +447,51 @@ struct grub_net_bootp_packet diff --git a/0065-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 94% rename from 0065-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index 00611dc8..3ffc50ce 100644 --- a/0065-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -23,10 +23,10 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 68501662e8d..fc3c2b44d60 100644 +index 9ecd3540bd6..281201f671e 100644 --- a/configure.ac +++ b/configure.ac -@@ -62,6 +62,7 @@ grub_TRANSFORM([grub-install]) +@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) grub_TRANSFORM([grub-mkconfig]) grub_TRANSFORM([grub-mkfont]) grub_TRANSFORM([grub-mkimage]) @@ -34,7 +34,7 @@ index 68501662e8d..fc3c2b44d60 100644 grub_TRANSFORM([grub-glue-efi]) grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) -@@ -79,6 +80,7 @@ grub_TRANSFORM([grub-file]) +@@ -82,6 +83,7 @@ grub_TRANSFORM([grub-file]) grub_TRANSFORM([grub-bios-setup.3]) grub_TRANSFORM([grub-editenv.1]) grub_TRANSFORM([grub-fstest.3]) @@ -43,10 +43,10 @@ index 68501662e8d..fc3c2b44d60 100644 grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) diff --git a/Makefile.util.def b/Makefile.util.def -index e50436a4987..2215cc759c0 100644 +index 1a7dd433e33..cdd2f51fe4b 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -725,6 +725,13 @@ script = { +@@ -732,6 +732,13 @@ script = { installdir = sbin; }; @@ -214,7 +214,7 @@ index 00000000000..7e87dfccc0e + echo export GRUB_UPDATE_DEFAULT_KERNEL +fi diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 4e7a875309e..6247a0ba850 100644 +index 3e4c6c5240b..60beaaa6962 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@" @@ -225,17 +225,17 @@ index 4e7a875309e..6247a0ba850 100644 export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAINDIR="@localedir@" -@@ -158,6 +159,8 @@ if test -f ${sysconfdir}/default/grub ; then +@@ -161,6 +162,8 @@ if test -f ${sysconfdir}/default/grub ; then . ${sysconfdir}/default/grub fi +eval "$("${grub_get_kernel_settings}")" || true + - if [ "x$GRUB_DISABLE_UUID" != "xtrue" ]; then - if [ -z "$GRUB_DEVICE_UUID" ]; then - GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED" + if [ "x${GRUB_DISABLE_UUID}" = "xtrue" ]; then + if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then + GRUB_DISABLE_LINUX_UUID="true" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 12a20c9ad73..55f4aa783cf 100644 +index 2e59f3b4197..0f3c19e30cc 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -111,7 +111,8 @@ linux_entry () @@ -258,7 +258,7 @@ index 12a20c9ad73..55f4aa783cf 100644 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" else echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -@@ -295,11 +299,15 @@ while [ "x$list" != "x" ] ; do +@@ -299,11 +303,15 @@ while [ "x$list" != "x" ] ; do fi if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then @@ -276,7 +276,7 @@ index 12a20c9ad73..55f4aa783cf 100644 if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi -@@ -308,10 +316,15 @@ while [ "x$list" != "x" ] ; do +@@ -312,10 +320,15 @@ while [ "x$list" != "x" ] ; do is_top_level=false fi diff --git a/0067-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0049-bz1374141-fix-incorrect-mask-for-ppc64.patch similarity index 100% rename from 0067-bz1374141-fix-incorrect-mask-for-ppc64.patch rename to 0049-bz1374141-fix-incorrect-mask-for-ppc64.patch diff --git a/0050-Fix-convert-function-to-support-NVMe-devices.patch b/0050-Fix-convert-function-to-support-NVMe-devices.patch deleted file mode 100644 index 0fb66161..00000000 --- a/0050-Fix-convert-function-to-support-NVMe-devices.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 18 Feb 2014 11:34:00 -0500 -Subject: [PATCH] Fix convert function to support NVMe devices - -This is adapted from the patch at -https://bugzilla.redhat.com/show_bug.cgi?id=1019660 , which is against -the now very old version of convert_system_partition_to_system_disk(). - -As such, it certainly not the right thing for upstream, but should -function for now. - -Resolves: rhbz#1019660 - -Signed-off-by: Peter Jones ---- - util/getroot.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/util/getroot.c b/util/getroot.c -index 847406fbab0..fa3460d6cd8 100644 ---- a/util/getroot.c -+++ b/util/getroot.c -@@ -153,6 +153,7 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part) - { - #if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL - struct stat st; -+ char *path = xmalloc(PATH_MAX); - - if (stat (os_dev, &st) < 0) - { -@@ -165,6 +166,24 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part) - - *is_part = 0; - -+ if (realpath(os_dev, path)) -+ { -+ if ((strncmp ("/dev/nvme", path, 9) == 0)) -+ { -+ char *p = path + 5; -+ p = strchr(p, 'p'); -+ if (p) -+ { -+ *is_part = 1; -+ *p = '\0'; -+ } -+ return path; -+ } -+ } -+ -+ grub_free (path); -+ *is_part = 0; -+ - if (grub_util_device_is_mapped_stat (&st)) - return grub_util_devmapper_part_to_disk (&st, is_part, os_dev); - diff --git a/0068-Make-grub_fatal-also-backtrace.patch b/0050-Make-grub_fatal-also-backtrace.patch similarity index 95% rename from 0068-Make-grub_fatal-also-backtrace.patch rename to 0050-Make-grub_fatal-also-backtrace.patch index de1de205..3534b05a 100644 --- a/0068-Make-grub_fatal-also-backtrace.patch +++ b/0050-Make-grub_fatal-also-backtrace.patch @@ -13,10 +13,10 @@ Subject: [PATCH] Make grub_fatal() also backtrace. create mode 100644 grub-core/lib/arm64/backtrace.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 99466b1e47e..ebc558019cd 100644 +index c15e91943b9..058c88ac3af 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -186,6 +186,9 @@ kernel = { +@@ -188,6 +188,9 @@ kernel = { softdiv = lib/division.c; @@ -27,7 +27,7 @@ index 99466b1e47e..ebc558019cd 100644 i386_xen = kern/i386/dl.c; i386_xen_pvh = kern/i386/dl.c; diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 1c560ea570a..04371ac49f2 100644 +index 63b586d09cb..a3e215155bd 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -24,6 +24,7 @@ @@ -38,7 +38,7 @@ index 1c560ea570a..04371ac49f2 100644 union printf_arg { -@@ -1101,8 +1102,13 @@ grub_xasprintf (const char *fmt, ...) +@@ -1199,8 +1200,13 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) static void __attribute__ ((noreturn)) grub_abort (void) { diff --git a/0051-Add-grub_util_readlink.patch b/0051-Add-grub_util_readlink.patch deleted file mode 100644 index 060a837b..00000000 --- a/0051-Add-grub_util_readlink.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 8 Jul 2019 21:46:52 +0200 -Subject: [PATCH] Add grub_util_readlink() - -Add grub_util_readlink(). This requires pulling in stat and readlink from -gnulib, which pulls in stat and related headers, but after that the -implementation is straightforward. - -Signed-off-by: Peter Jones -Reviewed-by: Adam Jackson ---- - grub-core/osdep/windows/hostdisk.c | 6 ++++++ - include/grub/osdep/hostfile_aros.h | 6 ++++++ - include/grub/osdep/hostfile_unix.h | 6 ++++++ - include/grub/osdep/hostfile_windows.h | 2 ++ - 4 files changed, 20 insertions(+) - -diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c -index 355100789a7..87a106c9b82 100644 ---- a/grub-core/osdep/windows/hostdisk.c -+++ b/grub-core/osdep/windows/hostdisk.c -@@ -365,6 +365,12 @@ grub_util_mkdir (const char *dir) - free (windows_name); - } - -+ssize_t -+grub_util_readlink (const char *name, char *buf, size_t bufsize) -+{ -+ return readlink(name, buf, bufsize); -+} -+ - int - grub_util_rename (const char *from, const char *to) - { -diff --git a/include/grub/osdep/hostfile_aros.h b/include/grub/osdep/hostfile_aros.h -index a059c0fa40a..161fbb7bdfd 100644 ---- a/include/grub/osdep/hostfile_aros.h -+++ b/include/grub/osdep/hostfile_aros.h -@@ -68,6 +68,12 @@ grub_util_rename (const char *from, const char *to) - return rename (from, to); - } - -+static inline ssize_t -+grub_util_readlink (const char *name, char *buf, size_t bufsize) -+{ -+ return readlink(name, buf, bufsize); -+} -+ - #define grub_util_mkdir(a) mkdir ((a), 0755) - - struct grub_util_fd -diff --git a/include/grub/osdep/hostfile_unix.h b/include/grub/osdep/hostfile_unix.h -index 9ffe46fa3ca..17cd3aa8b30 100644 ---- a/include/grub/osdep/hostfile_unix.h -+++ b/include/grub/osdep/hostfile_unix.h -@@ -71,6 +71,12 @@ grub_util_rename (const char *from, const char *to) - return rename (from, to); - } - -+static inline ssize_t -+grub_util_readlink (const char *name, char *buf, size_t bufsize) -+{ -+ return readlink(name, buf, bufsize); -+} -+ - #define grub_util_mkdir(a) mkdir ((a), 0755) - - #if defined (__NetBSD__) -diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h -index bf6451b6db4..8c92d0591bb 100644 ---- a/include/grub/osdep/hostfile_windows.h -+++ b/include/grub/osdep/hostfile_windows.h -@@ -41,6 +41,8 @@ typedef struct grub_util_fd_dir *grub_util_fd_dir_t; - - int - grub_util_rename (const char *from, const char *to); -+ssize_t -+grub_util_readlink (const char *name, char *buf, size_t bufsize); - int - grub_util_unlink (const char *name); - void diff --git a/0069-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0051-Fix-up-some-man-pages-rpmdiff-noticed.patch similarity index 96% rename from 0069-Fix-up-some-man-pages-rpmdiff-noticed.patch rename to 0051-Fix-up-some-man-pages-rpmdiff-noticed.patch index 80257e35..f51b62fe 100644 --- a/0069-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0051-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -13,10 +13,10 @@ Subject: [PATCH] Fix up some man pages rpmdiff noticed. create mode 100644 util/grub-syslinux2cfg.1 diff --git a/configure.ac b/configure.ac -index fc3c2b44d60..eb851b8d722 100644 +index 281201f671e..6c16968ad9c 100644 --- a/configure.ac +++ b/configure.ac -@@ -84,6 +84,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) +@@ -87,6 +87,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) grub_TRANSFORM([grub-glue-efi.3]) grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) @@ -24,7 +24,7 @@ index fc3c2b44d60..eb851b8d722 100644 grub_TRANSFORM([grub-menulst2cfg.1]) grub_TRANSFORM([grub-mkconfig.1]) grub_TRANSFORM([grub-mkfont.3]) -@@ -102,6 +103,7 @@ grub_TRANSFORM([grub-render-label.3]) +@@ -105,6 +106,7 @@ grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) grub_TRANSFORM([grub-set-default.1]) grub_TRANSFORM([grub-sparc64-setup.3]) diff --git a/0052-Make-editenv-chase-symlinks-including-those-across-d.patch b/0052-Make-editenv-chase-symlinks-including-those-across-d.patch deleted file mode 100644 index 288febac..00000000 --- a/0052-Make-editenv-chase-symlinks-including-those-across-d.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 3 Sep 2014 10:38:00 -0400 -Subject: [PATCH] Make editenv chase symlinks including those across devices. - -This lets us make /boot/grub2/grubenv a symlink to -/boot/efi/EFI/fedora/grubenv even though they're different mount points, -which allows /usr/bin/grub2-editenv to be the same across platforms -(i.e. UEFI vs BIOS). - -Signed-off-by: Peter Jones -Reviewed-by: Adam Jackson ---- - Makefile.util.def | 11 +++++++++++ - util/editenv.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 55 insertions(+), 2 deletions(-) - -diff --git a/Makefile.util.def b/Makefile.util.def -index 8717774d510..1f298d05f3d 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -240,8 +240,19 @@ program = { - - common = util/grub-editenv.c; - common = util/editenv.c; -+ common = util/grub-install-common.c; - common = grub-core/osdep/init.c; -+ common = grub-core/osdep/compress.c; -+ extra_dist = grub-core/osdep/unix/compress.c; -+ extra_dist = grub-core/osdep/basic/compress.c; -+ common = util/mkimage.c; -+ common = util/grub-mkimage32.c; -+ common = util/grub-mkimage64.c; -+ common = grub-core/osdep/config.c; -+ common = util/config.c; -+ common = util/resolve.c; - -+ ldadd = '$(LIBLZMA)'; - ldadd = libgrubmods.a; - ldadd = libgrubgcry.a; - ldadd = libgrubkern.a; -diff --git a/util/editenv.c b/util/editenv.c -index eb2d0c03a98..e61dc1283a4 100644 ---- a/util/editenv.c -+++ b/util/editenv.c -@@ -37,6 +37,7 @@ grub_util_create_envblk_file (const char *name) - FILE *fp; - char *buf; - char *namenew; -+ char *rename_target = xstrdup(name); - - buf = xmalloc (DEFAULT_ENVBLK_SIZE); - -@@ -60,7 +61,48 @@ grub_util_create_envblk_file (const char *name) - free (buf); - fclose (fp); - -- if (grub_util_rename (namenew, name) < 0) -- grub_util_error (_("cannot rename the file %s to %s"), namenew, name); -+ ssize_t size = 1; -+ while (1) -+ { -+ char *linkbuf; -+ ssize_t retsize; -+ -+ linkbuf = xmalloc(size+1); -+ retsize = grub_util_readlink (rename_target, linkbuf, size); -+ if (retsize < 0 && (errno == ENOENT || errno == EINVAL)) -+ { -+ free (linkbuf); -+ break; -+ } -+ else if (retsize < 0) -+ { -+ grub_util_error (_("cannot rename the file %s to %s: %m"), namenew, name); -+ free (linkbuf); -+ free (namenew); -+ return; -+ } -+ else if (retsize == size) -+ { -+ free(linkbuf); -+ size += 128; -+ continue; -+ } -+ -+ free (rename_target); -+ linkbuf[retsize] = '\0'; -+ rename_target = linkbuf; -+ } -+ -+ int rc = grub_util_rename (namenew, rename_target); -+ if (rc < 0 && errno == EXDEV) -+ { -+ rc = grub_install_copy_file (namenew, rename_target, 1); -+ grub_util_unlink (namenew); -+ } -+ -+ if (rc < 0) -+ grub_util_error (_("cannot rename the file %s to %s: %m"), namenew, name); -+ - free (namenew); -+ free (rename_target); - } diff --git a/0071-Make-our-info-pages-say-grub2-where-appropriate.patch b/0052-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 88% rename from 0071-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0052-Make-our-info-pages-say-grub2-where-appropriate.patch index eea4e6f9..e0930674 100644 --- a/0071-Make-our-info-pages-say-grub2-where-appropriate.patch +++ b/0052-Make-our-info-pages-say-grub2-where-appropriate.patch @@ -9,11 +9,11 @@ time. Signed-off-by: Peter Jones --- docs/grub-dev.texi | 4 +- - docs/grub.texi | 318 ++++++++++++++++++++++++++--------------------------- - 2 files changed, 161 insertions(+), 161 deletions(-) + docs/grub.texi | 323 ++++++++++++++++++++++++++++------------------------- + 2 files changed, 172 insertions(+), 155 deletions(-) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index ee389fd83c3..e3fed7312a3 100644 +index a834b3a9c32..a55af53fd45 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1,7 +1,7 @@ @@ -35,7 +35,7 @@ index ee389fd83c3..e3fed7312a3 100644 @setchapternewpage odd diff --git a/docs/grub.texi b/docs/grub.texi -index 221064b5679..960e5f3ba41 100644 +index eeb3118ebde..aa3a7de9d4f 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1,7 +1,7 @@ @@ -212,7 +212,7 @@ index 221064b5679..960e5f3ba41 100644 # @kbd{umount /mnt} @end group @end example -@@ -689,16 +689,16 @@ floppy instead of exposing the USB drive as a hard disk (they call it +@@ -689,30 +689,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it @example # @kbd{losetup /dev/loop0 /dev/sdb1} # @kbd{mount /dev/loop0 /mnt/usb} @@ -223,17 +223,14 @@ index 221064b5679..960e5f3ba41 100644 This install doesn't conflict with standard install as long as they are in separate directories. --Note that @command{grub-install} is actually just a shell script and the --real task is done by other tools such as @command{grub-mkimage}. Therefore, +Note that @command{grub2-install} is actually just a shell script and the +real task is done by other tools such as @command{grub2-mkimage}. Therefore, - you may run those commands directly to install GRUB, without using --@command{grub-install}. Don't do that, however, unless you are very familiar ++you may run those commands directly to install GRUB, without using +@command{grub2-install}. Don't do that, however, unless you are very familiar - with the internals of GRUB. Installing a boot loader on a running OS may be - extremely dangerous. - -@@ -706,20 +706,20 @@ On EFI systems for fixed disk install you have to mount EFI System Partition. ++with the internals of GRUB. Installing a boot loader on a running OS may be ++extremely dangerous. ++ + On EFI systems for fixed disk install you have to mount EFI System Partition. If you mount it at @file{/boot/efi} then you don't need any special arguments: @example @@ -257,7 +254,7 @@ index 221064b5679..960e5f3ba41 100644 @end example @node Making a GRUB bootable CD-ROM -@@ -739,10 +739,10 @@ usually also need to include a configuration file @file{grub.cfg} and some +@@ -732,10 +739,10 @@ usually also need to include a configuration file @file{grub.cfg} and some other GRUB modules. To make a simple generic GRUB rescue CD, you can use the @@ -270,7 +267,7 @@ index 221064b5679..960e5f3ba41 100644 @end example You will often need to include other files in your image. To do this, first -@@ -765,7 +765,7 @@ directory @file{iso/}. +@@ -758,7 +765,7 @@ directory @file{iso/}. Finally, make the image: @example @@ -279,7 +276,7 @@ index 221064b5679..960e5f3ba41 100644 @end example This produces a file named @file{grub.iso}, which then can be burned -@@ -781,7 +781,7 @@ storage devices. +@@ -774,7 +781,7 @@ storage devices. @node Device map @section The map between BIOS drives and OS devices @@ -288,7 +285,7 @@ index 221064b5679..960e5f3ba41 100644 etc.) read it to map BIOS drives to OS devices. This file consists of lines like this: -@@ -1225,23 +1225,23 @@ need to write the whole thing by hand. +@@ -1254,23 +1261,23 @@ need to write the whole thing by hand. @node Simple configuration @section Simple configuration handling @@ -317,7 +314,7 @@ index 221064b5679..960e5f3ba41 100644 valid POSIX shell input; normally, it will just be a sequence of @samp{KEY=value} lines, but if the value contains spaces or other special characters then it must be quoted. For example: -@@ -1279,7 +1279,7 @@ works it's not recommended since titles often contain unstable device names +@@ -1308,7 +1315,7 @@ works it's not recommended since titles often contain unstable device names and may be translated If you set this to @samp{saved}, then the default menu entry will be that @@ -326,7 +323,7 @@ index 221064b5679..960e5f3ba41 100644 the environment block, which may not be available in all situations (@pxref{Environment block}). -@@ -1290,7 +1290,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save +@@ -1319,7 +1326,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save it as a new default entry for use by future runs of GRUB. This is only useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because @samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with @@ -335,7 +332,7 @@ index 221064b5679..960e5f3ba41 100644 This option relies on the environment block, which may not be available in all situations (@pxref{Environment block}). -@@ -1420,7 +1420,7 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode +@@ -1449,7 +1456,7 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode @end example @item GRUB_DISABLE_LINUX_UUID @@ -344,7 +341,7 @@ index 221064b5679..960e5f3ba41 100644 universally-unique identifiers (UUIDs) to identify the root filesystem to the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is usually more reliable, but in some cases it may not be appropriate. To -@@ -1442,7 +1442,7 @@ If this option is set to @samp{true}, disable the generation of recovery +@@ -1471,7 +1478,7 @@ If this option is set to @samp{true}, disable the generation of recovery mode menu entries. @item GRUB_DISABLE_UUID @@ -353,7 +350,7 @@ index 221064b5679..960e5f3ba41 100644 universally-unique identifiers (UUIDs) to identify various filesystems to search for files. This is usually more reliable, but in some cases it may not be appropriate. To disable this use of UUIDs, set this option to -@@ -1451,12 +1451,12 @@ not be appropriate. To disable this use of UUIDs, set this option to +@@ -1482,12 +1489,12 @@ not be appropriate. To disable this use of UUIDs, set this option to @item GRUB_VIDEO_BACKEND If graphical video support is required, either because the @samp{gfxterm} graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set, @@ -369,16 +366,22 @@ index 221064b5679..960e5f3ba41 100644 @item GRUB_GFXMODE Set the resolution used on the @samp{gfxterm} graphical terminal. Note that -@@ -1488,7 +1488,7 @@ boot sequence. If you have problems, set this option to @samp{text} and +@@ -1519,20 +1526,20 @@ boot sequence. If you have problems, set this option to @samp{text} and GRUB will tell Linux to boot in normal text mode. @item GRUB_DISABLE_OS_PROBER --Normally, @command{grub-mkconfig} will try to use the external -+Normally, @command{grub2-mkconfig} will try to use the external - @command{os-prober} program, if installed, to discover other operating - systems installed on the same system and generate appropriate menu entries - for them. Set this option to @samp{true} to disable this. -@@ -1498,7 +1498,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober +-The @command{grub-mkconfig} has a feature to use the external ++The @command{grub2-mkconfig} has a feature to use the external + @command{os-prober} program to discover other operating systems installed on + the same machine and generate appropriate menu entries for them. It is disabled + by default since automatic and silent execution of @command{os-prober}, and + creating boot entries based on that data, is a potential attack vector. Set + this option to @samp{false} to enable this feature in the +-@command{grub-mkconfig} command. ++@command{grub2-mkconfig} command. + + @item GRUB_OS_PROBER_SKIP_LIST + List of space-separated FS UUIDs of filesystems to be ignored from os-prober output. For efi chainloaders it's @@ @item GRUB_DISABLE_SUBMENU @@ -387,7 +390,7 @@ index 221064b5679..960e5f3ba41 100644 the kernel with highest version number and put all other found kernels or alternative menu entries for recovery mode in submenu. For entries returned by @command{os-prober} first entry will be put on top level and all others -@@ -1506,11 +1506,11 @@ in submenu. If this option is set to @samp{y}, flat menu with all entries +@@ -1540,11 +1547,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries on top level will be generated instead. Changing this option will require changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback}) and @samp{default} (@pxref{default}) environment variables as well as saved @@ -402,7 +405,7 @@ index 221064b5679..960e5f3ba41 100644 check for encrypted disks and generate additional commands needed to access them during boot. Note that in this case unattended boot is not possible because GRUB will wait for passphrase to unlock encrypted container. -@@ -1569,7 +1569,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or +@@ -1603,7 +1610,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or @end table @@ -411,7 +414,7 @@ index 221064b5679..960e5f3ba41 100644 edit the scripts in @file{/etc/grub.d} directly. @file{/etc/grub.d/40_custom} is particularly useful for adding entire custom menu entries; simply type the menu entries you want to add at the end of -@@ -1831,7 +1831,7 @@ images as well. +@@ -1864,7 +1871,7 @@ images as well. Mount this partition on/mnt/boot and disable GRUB in all OSes and manually install self-compiled latest GRUB with: @@ -420,7 +423,7 @@ index 221064b5679..960e5f3ba41 100644 In all the OSes install GRUB tools but disable installing GRUB in bootsector, so you'll have menu.lst and grub.cfg available for use. Also disable os-prober -@@ -1841,20 +1841,20 @@ use by setting: +@@ -1874,20 +1881,20 @@ use by setting: in /etc/default/grub @@ -444,7 +447,7 @@ index 221064b5679..960e5f3ba41 100644 @} menuentry "Windows XP" @{ -@@ -1917,15 +1917,15 @@ GRUB supports embedding a configuration file directly into the core image, +@@ -1950,15 +1957,15 @@ GRUB supports embedding a configuration file directly into the core image, so that it is loaded before entering normal mode. This is useful, for example, when it is not straightforward to find the real configuration file, or when you need to debug problems with loading that file. @@ -463,7 +466,7 @@ index 221064b5679..960e5f3ba41 100644 After the embedded configuration file (if any) is executed, GRUB will load the @samp{normal} module (@pxref{normal}), which will then read the real -@@ -1960,13 +1960,13 @@ included in the core image: +@@ -1993,13 +2000,13 @@ included in the core image: @example @group search.fs_label grub root @@ -481,7 +484,7 @@ index 221064b5679..960e5f3ba41 100644 else echo "Could not find an example configuration file!" fi -@@ -2490,7 +2490,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 +@@ -2523,7 +2530,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 @end group @end example @@ -490,7 +493,7 @@ index 221064b5679..960e5f3ba41 100644 server. The grub.cfg file is placed in the same directory as the path output by -@@ -2675,7 +2675,7 @@ team are: +@@ -2717,7 +2724,7 @@ team are: @end table To take full advantage of this function, install GRUB into the MBR @@ -499,7 +502,7 @@ index 221064b5679..960e5f3ba41 100644 If you have a laptop which has a similar feature and not in the above list could you figure your address and contribute? -@@ -2736,7 +2736,7 @@ bytes. +@@ -2778,7 +2785,7 @@ bytes. The sole function of @file{boot.img} is to read the first sector of the core image from a local disk and jump to it. Because of the size restriction, @file{boot.img} cannot understand any file system structure, so @@ -508,7 +511,7 @@ index 221064b5679..960e5f3ba41 100644 core image into @file{boot.img} when installing GRUB. @item diskboot.img -@@ -2766,7 +2766,7 @@ images. +@@ -2808,7 +2815,7 @@ images. @item core.img This is the core image of GRUB. It is built dynamically from the kernel @@ -517,7 +520,7 @@ index 221064b5679..960e5f3ba41 100644 program. Usually, it contains enough modules to access @file{/boot/grub}, and loads everything else (including menu handling, the ability to load target operating systems, and so on) from the file system at run-time. The -@@ -2818,7 +2818,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from +@@ -2860,7 +2867,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from In GRUB 2, images for booting from CD-ROM drives are now constructed using @file{cdboot.img} and @file{core.img}, making sure that the core image contains the @samp{iso9660} module. It is usually best to use the @@ -526,7 +529,7 @@ index 221064b5679..960e5f3ba41 100644 @item nbgrub There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by -@@ -2974,8 +2974,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by +@@ -3016,8 +3023,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by An absolute file name resembles a Unix absolute file name, using @samp{/} for the directory separator (not @samp{\} as in DOS). One @@ -537,7 +540,7 @@ index 221064b5679..960e5f3ba41 100644 disk. If you omit the device name in an absolute file name, GRUB uses GRUB's @dfn{root device} implicitly. So if you set the root device to, say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}), -@@ -2983,8 +2983,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}. +@@ -3025,8 +3032,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}. On ZFS filesystem the first path component must be @var{volume}@samp{@@}[@var{snapshot}]. @@ -548,7 +551,7 @@ index 221064b5679..960e5f3ba41 100644 @samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if snapshot name is omitted. -@@ -3387,7 +3387,7 @@ The more recent release of Minix would then be identified as +@@ -3429,7 +3436,7 @@ The more recent release of Minix would then be identified as @samp{other>minix>minix-3.4.0}. This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple @@ -557,7 +560,7 @@ index 221064b5679..960e5f3ba41 100644 @node fallback -@@ -3477,7 +3477,7 @@ If this variable is set, it names the language code that the +@@ -3519,7 +3526,7 @@ If this variable is set, it names the language code that the example, French would be named as @samp{fr}, and Simplified Chinese as @samp{zh_CN}. @@ -566,7 +569,7 @@ index 221064b5679..960e5f3ba41 100644 reasonable default for this variable based on the system locale. -@@ -3485,10 +3485,10 @@ reasonable default for this variable based on the system locale. +@@ -3527,10 +3534,10 @@ reasonable default for this variable based on the system locale. @subsection locale_dir If this variable is set, it names the directory where translation files may @@ -579,7 +582,7 @@ index 221064b5679..960e5f3ba41 100644 default for this variable if internationalization is needed and any translation files are available. -@@ -3606,7 +3606,7 @@ input. The default is not to pause output. +@@ -3648,7 +3655,7 @@ input. The default is not to pause output. The location of the @samp{/boot/grub} directory as an absolute file name (@pxref{File name syntax}). This is normally set by GRUB at startup based @@ -588,7 +591,7 @@ index 221064b5679..960e5f3ba41 100644 dynamically loaded from this directory, so it must be set correctly in order for many parts of GRUB to work. -@@ -3697,17 +3697,17 @@ GRUB provides an ``environment block'' which can be used to save a small +@@ -3739,17 +3746,17 @@ GRUB provides an ``environment block'' which can be used to save a small amount of state. The environment block is a preallocated 1024-byte file, which normally lives @@ -609,7 +612,7 @@ index 221064b5679..960e5f3ba41 100644 @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}). -@@ -4398,7 +4398,7 @@ Translate @var{string} into the current language. +@@ -4473,7 +4480,7 @@ Translate @var{string} into the current language. The current language code is stored in the @samp{lang} variable in GRUB's environment (@pxref{lang}). Translation files in MO format are read from @@ -618,7 +621,7 @@ index 221064b5679..960e5f3ba41 100644 @end deffn -@@ -4793,7 +4793,7 @@ Define a user named @var{user} with password @var{clear-password}. +@@ -4868,7 +4875,7 @@ Define a user named @var{user} with password @var{clear-password}. @deffn Command password_pbkdf2 user hashed-password Define a user named @var{user} with password hash @var{hashed-password}. @@ -627,7 +630,7 @@ index 221064b5679..960e5f3ba41 100644 to generate password hashes. @xref{Security}. @end deffn -@@ -5651,8 +5651,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} +@@ -5811,8 +5818,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} which has an associated password. @samp{password} sets the password in plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2} sets the password hashed using the Password-Based Key Derivation Function @@ -638,7 +641,7 @@ index 221064b5679..960e5f3ba41 100644 In order to enable authentication support, the @samp{superusers} environment variable must be set to a list of usernames, separated by any of spaces, -@@ -5696,7 +5696,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ +@@ -5857,7 +5864,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ @end group @end example @@ -647,28 +650,26 @@ index 221064b5679..960e5f3ba41 100644 generating configuration files with authentication. You can use @file{/etc/grub.d/40_custom} to add simple superuser authentication, by adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} -@@ -5721,15 +5721,15 @@ verified with a public key currently trusted by GRUB - validation fails, then file @file{foo} cannot be opened. This failure - may halt or otherwise impact the boot process. +@@ -5884,7 +5891,17 @@ may halt or otherwise impact the boot process. --@comment Unfortunately --pubkey is not yet supported by grub-install, --@comment but we should not bring up internal detail grub-mkimage here + An initial trusted public key can be embedded within the GRUB @file{core.img} + using the @code{--pubkey} option to @command{grub-install} +-(@pxref{Invoking grub-install}). ++(@pxref{Invoking grub2-install}). ++ +@comment Unfortunately --pubkey is not yet supported by grub2-install, +@comment but we should not bring up internal detail grub2-mkimage here - @comment in the user guide (as opposed to developer's manual). - - @comment An initial trusted public key can be embedded within the GRUB - @comment @file{core.img} using the @code{--pubkey} option to --@comment @command{grub-mkimage} (@pxref{Invoking grub-install}). Presently it --@comment is necessary to write a custom wrapper around @command{grub-mkimage} --@comment using the @code{--grub-mkimage} flag to @command{grub-install}. ++@comment in the user guide (as opposed to developer's manual). ++ ++@comment An initial trusted public key can be embedded within the GRUB ++@comment @file{core.img} using the @code{--pubkey} option to +@comment @command{grub2-mkimage} (@pxref{Invoking grub2-install}). Presently it +@comment is necessary to write a custom wrapper around @command{grub2-mkimage} +@comment using the @code{--grub-mkimage} flag to @command{grub2-install}. GRUB uses GPG-style detached signatures (meaning that a file @file{foo.sig} will be produced when file @file{foo} is signed), and -@@ -5749,8 +5749,8 @@ gpg --detach-sign /path/to/file +@@ -5904,8 +5921,8 @@ gpg --detach-sign /path/to/file For successful validation of all of GRUB's subcomponents and the loaded OS kernel, they must all be signed. One way to accomplish this is the following (after having already produced the desired @@ -679,7 +680,7 @@ index 221064b5679..960e5f3ba41 100644 @example @group -@@ -5772,7 +5772,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, +@@ -5927,7 +5944,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, Note that internally signature enforcement is controlled by setting the environment variable @code{check_signatures} equal to @code{enforce}. Passing one or more @code{--pubkey} options to @@ -688,7 +689,7 @@ index 221064b5679..960e5f3ba41 100644 equal to @code{enforce} in @file{core.img} prior to processing any configuration files. -@@ -6189,10 +6189,10 @@ Required files are: +@@ -6385,10 +6402,10 @@ Required files are: GRUB's normal start-up procedure involves setting the @samp{prefix} environment variable to a value set in the core image by @@ -701,7 +702,7 @@ index 221064b5679..960e5f3ba41 100644 things GRUB is supposed to do. If, instead, you only get a rescue shell, this usually means that GRUB -@@ -6218,8 +6218,8 @@ normal +@@ -6414,8 +6431,8 @@ normal However, any problem that leaves you in the rescue shell probably means that GRUB was not correctly installed. It may be more useful to try to reinstall @@ -712,7 +713,7 @@ index 221064b5679..960e5f3ba41 100644 @itemize @bullet{} @item -@@ -6231,7 +6231,7 @@ is usually better to use UUIDs or file system labels and avoid depending on +@@ -6427,7 +6444,7 @@ is usually better to use UUIDs or file system labels and avoid depending on drive ordering entirely. @item @@ -721,7 +722,7 @@ index 221064b5679..960e5f3ba41 100644 to a partition but GRUB has already been installed in the master boot record, then the GRUB installation in the partition will be ignored. -@@ -6262,21 +6262,21 @@ entry which claims partition start at block 0. This change will not hamper +@@ -6458,21 +6475,21 @@ entry which claims partition start at block 0. This change will not hamper bootability on other machines. @@ -749,7 +750,7 @@ index 221064b5679..960e5f3ba41 100644 @table @option @item --help -@@ -6292,13 +6292,13 @@ separate partition or a removable disk. +@@ -6488,13 +6505,13 @@ separate partition or a removable disk. If this option is not specified then it defaults to @file{/boot}, so @example @@ -765,7 +766,7 @@ index 221064b5679..960e5f3ba41 100644 @end example Here is an example in which you have a separate @dfn{boot} partition which is -@@ -6306,16 +6306,16 @@ mounted on +@@ -6502,16 +6519,16 @@ mounted on @file{/mnt/boot}: @example @@ -785,7 +786,7 @@ index 221064b5679..960e5f3ba41 100644 extra space in the bootloader embedding area for Reed-Solomon error-correcting codes. This enables GRUB to still boot successfully if some blocks are corrupted. The exact amount of protection offered -@@ -6328,17 +6328,17 @@ installation}) where GRUB does not reside in any unpartitioned space +@@ -6524,17 +6541,17 @@ installation}) where GRUB does not reside in any unpartitioned space outside of the MBR. Disable the Reed-Solomon codes with this option. @end table @@ -808,7 +809,7 @@ index 221064b5679..960e5f3ba41 100644 @table @option @item --help -@@ -6354,17 +6354,17 @@ it to standard output. +@@ -6550,17 +6567,17 @@ it to standard output. @end table @@ -830,7 +831,7 @@ index 221064b5679..960e5f3ba41 100644 @table @option @item -c @var{number} -@@ -6382,23 +6382,23 @@ Length of the salt. Defaults to 64. +@@ -6578,23 +6595,23 @@ Length of the salt. Defaults to 64. @end table @@ -860,7 +861,7 @@ index 221064b5679..960e5f3ba41 100644 @table @option @item --help -@@ -6409,17 +6409,17 @@ Print the version number of GRUB and exit. +@@ -6605,17 +6622,17 @@ Print the version number of GRUB and exit. @end table @@ -882,7 +883,7 @@ index 221064b5679..960e5f3ba41 100644 passed on directly to @command{xorriso} in @command{mkisofs} emulation mode. Options passed to @command{xorriso} will normally be interpreted as @command{mkisofs} options; if the option @samp{--} is used, then anything -@@ -6434,7 +6434,7 @@ mkdir -p disk/boot/grub +@@ -6630,7 +6647,7 @@ mkdir -p disk/boot/grub grub-mkrescue -o grub.iso disk @end example @@ -891,7 +892,7 @@ index 221064b5679..960e5f3ba41 100644 @table @option @item --help -@@ -6462,15 +6462,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in +@@ -6658,15 +6675,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in default. @item --grub-mkimage=@var{file} @@ -911,7 +912,7 @@ index 221064b5679..960e5f3ba41 100644 system or file system image that GRUB understands, using GRUB's file system drivers via FUSE. (It is only available if FUSE development files were present when GRUB was built.) This has a number of uses: -@@ -6502,13 +6502,13 @@ even if nobody has yet written a FUSE module specifically for that file +@@ -6698,13 +6715,13 @@ even if nobody has yet written a FUSE module specifically for that file system type. @end itemize @@ -927,7 +928,7 @@ index 221064b5679..960e5f3ba41 100644 non-option arguments (if it is given more than one image, it will treat them as a RAID set), and also accepts the following options: -@@ -6530,13 +6530,13 @@ Show debugging output for conditions matching @var{string}. +@@ -6726,13 +6743,13 @@ Show debugging output for conditions matching @var{string}. @item -K prompt|@var{file} @itemx --zfs-key=prompt|@var{file} Load a ZFS encryption key. If you use @samp{prompt} as the argument, @@ -943,7 +944,7 @@ index 221064b5679..960e5f3ba41 100644 root of the supplied file system. If @var{device} is just a number, then it will be treated as a partition -@@ -6554,10 +6554,10 @@ Print verbose messages. +@@ -6750,10 +6767,10 @@ Print verbose messages. @end table @@ -957,7 +958,7 @@ index 221064b5679..960e5f3ba41 100644 or device. @example -@@ -6565,7 +6565,7 @@ grub-probe --target=fs /boot/grub +@@ -6761,7 +6778,7 @@ grub-probe --target=fs /boot/grub grub-probe --target=drive --device /dev/sda1 @end example @@ -966,7 +967,7 @@ index 221064b5679..960e5f3ba41 100644 argument, and also accepts the following options: @table @option -@@ -6578,16 +6578,16 @@ Print the version number of GRUB and exit. +@@ -6774,16 +6791,16 @@ Print the version number of GRUB and exit. @item -d @itemx --device If this option is given, then the non-option argument is a system device @@ -986,7 +987,7 @@ index 221064b5679..960e5f3ba41 100644 @item -t @var{target} @itemx --target=@var{target} -@@ -6640,19 +6640,19 @@ Print verbose messages. +@@ -6836,19 +6853,19 @@ Print verbose messages. @end table diff --git a/0073-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 97% rename from 0073-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch index 3a761c0c..2f3fd13e 100644 --- a/0073-macos-just-build-chainloader-entries-don-t-try-any-x.patch +++ b/0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch @@ -20,10 +20,10 @@ Signed-off-by: Peter Jones 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 9b8f5968e2d..13a3a6bc752 100644 +index 94622481284..9d6ea55bdd3 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in -@@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then +@@ -45,68 +45,25 @@ if [ -z "${OSPROBED}" ] ; then fi osx_entry() { @@ -104,7 +104,7 @@ index 9b8f5968e2d..13a3a6bc752 100644 } EOF } -@@ -284,11 +241,12 @@ EOF +@@ -295,11 +252,12 @@ EOF echo "$title_correction_code" ;; macosx) diff --git a/0074-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0054-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 95% rename from 0074-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0054-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch index 41616b0f..68dfc1dc 100644 --- a/0074-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +++ b/0054-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch @@ -24,7 +24,7 @@ Signed-off-by: Jeff Mahoney 2 files changed, 533 insertions(+), 20 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 48bd3d04a5e..6823d9765c4 100644 +index 63203034dfc..f1fff7385b5 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -38,6 +38,9 @@ @@ -36,8 +36,8 @@ index 48bd3d04a5e..6823d9765c4 100644 +#include #include #include - -@@ -78,9 +81,11 @@ struct grub_btrfs_superblock + #include +@@ -79,9 +82,11 @@ struct grub_btrfs_superblock grub_uint64_t generation; grub_uint64_t root_tree; grub_uint64_t chunk_tree; @@ -51,7 +51,7 @@ index 48bd3d04a5e..6823d9765c4 100644 struct grub_btrfs_device this_device; char label[0x100]; grub_uint8_t dummy4[0x100]; -@@ -120,6 +125,7 @@ struct grub_btrfs_data +@@ -121,6 +126,7 @@ struct grub_btrfs_data grub_uint64_t exttree; grub_size_t extsize; struct grub_btrfs_extent_data *extent; @@ -59,7 +59,7 @@ index 48bd3d04a5e..6823d9765c4 100644 }; struct grub_btrfs_chunk_item -@@ -188,6 +194,14 @@ struct grub_btrfs_leaf_descriptor +@@ -191,6 +197,14 @@ struct grub_btrfs_leaf_descriptor } *data; }; @@ -74,7 +74,7 @@ index 48bd3d04a5e..6823d9765c4 100644 struct grub_btrfs_time { grub_int64_t sec; -@@ -233,6 +247,14 @@ struct grub_btrfs_extent_data +@@ -236,6 +250,14 @@ struct grub_btrfs_extent_data #define GRUB_BTRFS_OBJECT_ID_CHUNK 0x100 @@ -89,7 +89,7 @@ index 48bd3d04a5e..6823d9765c4 100644 static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2, 256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2 }; -@@ -1153,6 +1175,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, +@@ -1173,6 +1195,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, return GRUB_ERR_NONE; } @@ -152,7 +152,7 @@ index 48bd3d04a5e..6823d9765c4 100644 static struct grub_btrfs_data * grub_btrfs_mount (grub_device_t dev) { -@@ -1188,6 +1266,13 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1208,6 +1286,13 @@ grub_btrfs_mount (grub_device_t dev) data->devices_attached[0].dev = dev; data->devices_attached[0].id = data->sblock.this_device.device_id; @@ -166,7 +166,7 @@ index 48bd3d04a5e..6823d9765c4 100644 return data; } -@@ -1653,6 +1738,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, +@@ -1673,6 +1758,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, return GRUB_ERR_NONE; } @@ -258,7 +258,7 @@ index 48bd3d04a5e..6823d9765c4 100644 static grub_err_t find_path (struct grub_btrfs_data *data, const char *path, struct grub_btrfs_key *key, -@@ -1671,14 +1841,26 @@ find_path (struct grub_btrfs_data *data, +@@ -1691,14 +1861,26 @@ find_path (struct grub_btrfs_data *data, char *origpath = NULL; unsigned symlinks_max = 32; @@ -289,7 +289,7 @@ index 48bd3d04a5e..6823d9765c4 100644 while (1) { while (path[0] == '/') -@@ -1851,9 +2033,21 @@ find_path (struct grub_btrfs_data *data, +@@ -1871,9 +2053,21 @@ find_path (struct grub_btrfs_data *data, path = path_alloc = tmp; if (path[0] == '/') { @@ -314,7 +314,7 @@ index 48bd3d04a5e..6823d9765c4 100644 } continue; } -@@ -2094,18 +2288,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len) +@@ -2114,18 +2308,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len) data->tree, file->offset, buf, len); } @@ -336,7 +336,7 @@ index 48bd3d04a5e..6823d9765c4 100644 grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]), grub_be_to_cpu16 (data->sblock.uuid[2]), -@@ -2114,6 +2300,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid) +@@ -2134,6 +2320,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid) grub_be_to_cpu16 (data->sblock.uuid[5]), grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[7])); @@ -357,7 +357,7 @@ index 48bd3d04a5e..6823d9765c4 100644 grub_btrfs_unmount (data); -@@ -2170,6 +2370,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), +@@ -2190,6 +2390,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), } #endif @@ -600,7 +600,7 @@ index 48bd3d04a5e..6823d9765c4 100644 static struct grub_fs grub_btrfs_fs = { .name = "btrfs", .fs_dir = grub_btrfs_dir, -@@ -2185,12 +2621,88 @@ static struct grub_fs grub_btrfs_fs = { +@@ -2205,12 +2641,88 @@ static struct grub_fs grub_btrfs_fs = { #endif }; diff --git a/0075-export-btrfs_subvol-and-btrfs_subvolid.patch b/0055-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 91% rename from 0075-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0055-export-btrfs_subvol-and-btrfs_subvolid.patch index 5af81e78..d38a6b87 100644 --- a/0075-export-btrfs_subvol-and-btrfs_subvolid.patch +++ b/0055-export-btrfs_subvol-and-btrfs_subvolid.patch @@ -12,10 +12,10 @@ Signed-off-by: Michael Chang 1 file changed, 2 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 6823d9765c4..2d099b18ea1 100644 +index f1fff7385b5..ad1b56b716d 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -2694,6 +2694,8 @@ GRUB_MOD_INIT (btrfs) +@@ -2714,6 +2714,8 @@ GRUB_MOD_INIT (btrfs) subvol_set_env); grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, subvolid_set_env); diff --git a/0056-Update-info-with-grub.cfg-netboot-selection-order-11.patch b/0056-Update-info-with-grub.cfg-netboot-selection-order-11.patch deleted file mode 100644 index afa32036..00000000 --- a/0056-Update-info-with-grub.cfg-netboot-selection-order-11.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robert Marshall -Date: Mon, 16 Mar 2015 16:34:51 -0400 -Subject: [PATCH] Update info with grub.cfg netboot selection order (#1148650) - -Added documentation to the grub info page that specifies the order -netboot clients will use to select a grub configuration file. - -Resolves rhbz#1148650 ---- - docs/grub.texi | 42 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - -diff --git a/docs/grub.texi b/docs/grub.texi -index 6f524305085..221064b5679 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -2493,6 +2493,48 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 - Then follow instructions printed out by grub-mknetdir on configuring your DHCP - server. - -+The grub.cfg file is placed in the same directory as the path output by -+grub-mknetdir hereafter referred to as FWPATH. GRUB will search for its -+configuration files in order using the following rules where the appended -+value corresponds to a value on the client machine. -+ -+@example -+@group -+@samp{(FWPATH)}/grub.cfg-@samp{(UUID OF NIC)} -+@samp{(FWPATH)}/grub.cfg-@samp{(MAC ADDRESS OF NIC)} -+@samp{(FWPATH)}/grub.cfg-@samp{(IPv4 OR IPv6 ADDRESS)} -+@samp{(FWPATH)}/grub.cfg -+@end group -+@end example -+ -+The client will only attempt to look up an IPv6 address config once, however, -+it will try the IPv4 multiple times. The concrete example below shows what -+would happen under the IPv4 case. -+ -+@example -+@group -+UUID: 7726a678-7fc0-4853-a4f6-c85ac36a120a -+MAC: 52:54:00:ec:33:81 -+IPV4: 10.0.0.130 (0A000082) -+@end group -+@end example -+ -+@example -+@group -+@samp{(FWPATH)}/grub.cfg-7726a678-7fc0-4853-a4f6-c85ac36a120a -+@samp{(FWPATH)}/grub.cfg-52-54-00-ec-33-81 -+@samp{(FWPATH)}/grub.cfg-0A000082 -+@samp{(FWPATH)}/grub.cfg-0A00008 -+@samp{(FWPATH)}/grub.cfg-0A0000 -+@samp{(FWPATH)}/grub.cfg-0A000 -+@samp{(FWPATH)}/grub.cfg-0A00 -+@samp{(FWPATH)}/grub.cfg-0A0 -+@samp{(FWPATH)}/grub.cfg-0A -+@samp{(FWPATH)}/grub.cfg-0 -+@samp{(FWPATH)}/grub.cfg -+@end group -+@end example -+ - After GRUB has started, files on the TFTP server will be accessible via the - @samp{(tftp)} device. - diff --git a/0076-grub2-btrfs-03-follow_default.patch b/0056-grub2-btrfs-03-follow_default.patch similarity index 89% rename from 0076-grub2-btrfs-03-follow_default.patch rename to 0056-grub2-btrfs-03-follow_default.patch index b28aa781..2b9a1364 100644 --- a/0076-grub2-btrfs-03-follow_default.patch +++ b/0056-grub2-btrfs-03-follow_default.patch @@ -8,10 +8,10 @@ Subject: [PATCH] grub2-btrfs-03-follow_default 1 file changed, 76 insertions(+), 31 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 2d099b18ea1..2db89f71ea5 100644 +index ad1b56b716d..113c1f746c9 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -1236,6 +1236,7 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1256,6 +1256,7 @@ grub_btrfs_mount (grub_device_t dev) { struct grub_btrfs_data *data; grub_err_t err; @@ -19,7 +19,7 @@ index 2d099b18ea1..2db89f71ea5 100644 if (!dev->disk) { -@@ -1266,11 +1267,14 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1286,11 +1287,14 @@ grub_btrfs_mount (grub_device_t dev) data->devices_attached[0].dev = dev; data->devices_attached[0].id = data->sblock.this_device.device_id; @@ -38,7 +38,7 @@ index 2d099b18ea1..2db89f71ea5 100644 } return data; -@@ -1835,24 +1839,39 @@ find_path (struct grub_btrfs_data *data, +@@ -1855,24 +1859,39 @@ find_path (struct grub_btrfs_data *data, grub_size_t allocated = 0; struct grub_btrfs_dir_item *direl = NULL; struct grub_btrfs_key key_out; @@ -85,7 +85,7 @@ index 2d099b18ea1..2db89f71ea5 100644 } else { -@@ -1863,15 +1882,23 @@ find_path (struct grub_btrfs_data *data, +@@ -1883,15 +1902,23 @@ find_path (struct grub_btrfs_data *data, while (1) { @@ -118,7 +118,7 @@ index 2d099b18ea1..2db89f71ea5 100644 if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) { -@@ -1882,7 +1909,9 @@ find_path (struct grub_btrfs_data *data, +@@ -1902,7 +1929,9 @@ find_path (struct grub_btrfs_data *data, if (ctokenlen == 1 && ctoken[0] == '.') { @@ -129,7 +129,7 @@ index 2d099b18ea1..2db89f71ea5 100644 continue; } if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.') -@@ -1913,8 +1942,9 @@ find_path (struct grub_btrfs_data *data, +@@ -1933,8 +1962,9 @@ find_path (struct grub_btrfs_data *data, *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; key->object_id = key_out.offset; @@ -141,7 +141,7 @@ index 2d099b18ea1..2db89f71ea5 100644 continue; } -@@ -1983,7 +2013,9 @@ find_path (struct grub_btrfs_data *data, +@@ -2003,7 +2033,9 @@ find_path (struct grub_btrfs_data *data, return err; } @@ -152,7 +152,7 @@ index 2d099b18ea1..2db89f71ea5 100644 if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK) { struct grub_btrfs_inode inode; -@@ -2033,14 +2065,26 @@ find_path (struct grub_btrfs_data *data, +@@ -2053,14 +2085,26 @@ find_path (struct grub_btrfs_data *data, path = path_alloc = tmp; if (path[0] == '/') { @@ -186,7 +186,7 @@ index 2d099b18ea1..2db89f71ea5 100644 } else { -@@ -2696,6 +2740,7 @@ GRUB_MOD_INIT (btrfs) +@@ -2716,6 +2760,7 @@ GRUB_MOD_INIT (btrfs) subvolid_set_env); grub_env_export ("btrfs_subvol"); grub_env_export ("btrfs_subvolid"); diff --git a/0077-grub2-btrfs-04-grub2-install.patch b/0057-grub2-btrfs-04-grub2-install.patch similarity index 94% rename from 0077-grub2-btrfs-04-grub2-install.patch rename to 0057-grub2-btrfs-04-grub2-install.patch index b490f8d3..1a617c27 100644 --- a/0077-grub2-btrfs-04-grub2-install.patch +++ b/0057-grub2-btrfs-04-grub2-install.patch @@ -13,7 +13,7 @@ Subject: [PATCH] grub2-btrfs-04-grub2-install 6 files changed, 54 insertions(+), 2 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 6d9f4e5faa2..5d50dd6f8dc 100644 +index 001b818fe58..caf9b1ccd3f 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_path) @@ -38,7 +38,7 @@ index 6d9f4e5faa2..5d50dd6f8dc 100644 else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) { diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index 65effa9f3a7..b637c58efb7 100644 +index 7d6325138ce..46a881530c0 100644 --- a/grub-core/osdep/unix/config.c +++ b/grub-core/osdep/unix/config.c @@ -82,6 +82,19 @@ grub_util_load_config (struct grub_util_config *cfg) @@ -94,10 +94,10 @@ index ebcdd8f5e22..f044a880a76 100644 sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) { diff --git a/util/grub-install.c b/util/grub-install.c -index 8a55ad4b8dc..0e807b09c36 100644 +index a0babe3eff9..427ae013701 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -819,6 +819,8 @@ fill_core_services (const char *core_services) +@@ -827,6 +827,8 @@ fill_core_services (const char *core_services) free (sysv_plist); } @@ -106,7 +106,7 @@ index 8a55ad4b8dc..0e807b09c36 100644 int main (int argc, char *argv[]) { -@@ -852,6 +854,9 @@ main (int argc, char *argv[]) +@@ -860,6 +862,9 @@ main (int argc, char *argv[]) grub_util_load_config (&config); @@ -116,7 +116,7 @@ index 8a55ad4b8dc..0e807b09c36 100644 if (!bootloader_id && config.grub_distributor) { char *ptr; -@@ -1344,6 +1349,16 @@ main (int argc, char *argv[]) +@@ -1352,6 +1357,16 @@ main (int argc, char *argv[]) fprintf (load_cfg_f, "set debug='%s'\n", debug_image); } diff --git a/0058-Handle-rssd-storage-devices.patch b/0058-Handle-rssd-storage-devices.patch deleted file mode 100644 index 8f25692a..00000000 --- a/0058-Handle-rssd-storage-devices.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 30 Jun 2015 15:50:41 -0400 -Subject: [PATCH] Handle rssd storage devices. - -Resolves: rhbz#1087962 - -Signed-off-by: Peter Jones ---- - grub-core/osdep/linux/getroot.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 90d92d3ad5c..6d9f4e5faa2 100644 ---- a/grub-core/osdep/linux/getroot.c -+++ b/grub-core/osdep/linux/getroot.c -@@ -921,6 +921,19 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, - return path; - } - -+ /* If this is an rssd device. */ -+ if ((strncmp ("rssd", p, 4) == 0) && p[4] >= 'a' && p[4] <= 'z') -+ { -+ char *pp = p + 4; -+ while (*pp >= 'a' && *pp <= 'z') -+ pp++; -+ if (*pp) -+ *is_part = 1; -+ /* /dev/rssd[a-z]+[0-9]* */ -+ *pp = '\0'; -+ return path; -+ } -+ - /* If this is a loop device */ - if ((strncmp ("loop", p, 4) == 0) && p[4] >= '0' && p[4] <= '9') - { diff --git a/0078-grub2-btrfs-05-grub2-mkconfig.patch b/0058-grub2-btrfs-05-grub2-mkconfig.patch similarity index 95% rename from 0078-grub2-btrfs-05-grub2-mkconfig.patch rename to 0058-grub2-btrfs-05-grub2-mkconfig.patch index 2320e89d..4cdf47b9 100644 --- a/0078-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0058-grub2-btrfs-05-grub2-mkconfig.patch @@ -13,10 +13,10 @@ Signed-off-by: Michael Chang 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 6247a0ba850..4649e92eb0f 100644 +index 60beaaa6962..e671ce68aec 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -258,7 +258,8 @@ export GRUB_DEFAULT \ +@@ -255,7 +255,8 @@ export GRUB_DEFAULT \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ GRUB_DISABLE_SUBMENU \ @@ -27,7 +27,7 @@ index 6247a0ba850..4649e92eb0f 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 113a41f9409..b3aae534ddc 100644 +index 42c2ea9ba50..fafeac95061 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -52,7 +52,11 @@ grub_warn () @@ -90,7 +90,7 @@ index 858b526c925..de727e6ee6b 100644 +EOF +fi diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 55f4aa783cf..5cab299dc08 100644 +index 0f3c19e30cc..cbfaca34cc7 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -66,10 +66,14 @@ fi @@ -109,7 +109,7 @@ index 55f4aa783cf..5cab299dc08 100644 xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 47e0d3f5cd6..1519ec692fe 100644 +index ada20775a14..e9e73b815fb 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -73,10 +73,14 @@ fi diff --git a/0079-grub2-btrfs-06-subvol-mount.patch b/0059-grub2-btrfs-06-subvol-mount.patch similarity index 95% rename from 0079-grub2-btrfs-06-subvol-mount.patch rename to 0059-grub2-btrfs-06-subvol-mount.patch index 36824c8b..5a92622d 100644 --- a/0079-grub2-btrfs-06-subvol-mount.patch +++ b/0059-grub2-btrfs-06-subvol-mount.patch @@ -11,7 +11,7 @@ Subject: [PATCH] grub2-btrfs-06-subvol-mount 4 files changed, 392 insertions(+), 5 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 2db89f71ea5..162723423ca 100644 +index 113c1f746c9..d323746ecfa 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -41,6 +41,7 @@ @@ -21,8 +21,8 @@ index 2db89f71ea5..162723423ca 100644 +#include #include #include - -@@ -263,6 +264,12 @@ static grub_err_t + #include +@@ -266,6 +267,12 @@ static grub_err_t grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, void *buf, grub_size_t size, int recursion_depth); @@ -35,7 +35,7 @@ index 2db89f71ea5..162723423ca 100644 static grub_err_t read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) -@@ -1203,9 +1210,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) +@@ -1223,9 +1230,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) grub_err_t err; grub_uint64_t tree = 0; grub_uint8_t type; @@ -62,7 +62,7 @@ index 2db89f71ea5..162723423ca 100644 if (err) return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); -@@ -2179,11 +2203,20 @@ grub_btrfs_dir (grub_device_t device, const char *path, +@@ -2199,11 +2223,20 @@ grub_btrfs_dir (grub_device_t device, const char *path, int r = 0; grub_uint64_t tree; grub_uint8_t type; @@ -84,7 +84,7 @@ index 2db89f71ea5..162723423ca 100644 if (err) { grub_btrfs_unmount (data); -@@ -2285,11 +2318,21 @@ grub_btrfs_open (struct grub_file *file, const char *name) +@@ -2305,11 +2338,21 @@ grub_btrfs_open (struct grub_file *file, const char *name) struct grub_btrfs_inode inode; grub_uint8_t type; struct grub_btrfs_key key_in; @@ -107,7 +107,7 @@ index 2db89f71ea5..162723423ca 100644 if (err) { grub_btrfs_unmount (data); -@@ -2460,6 +2503,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, +@@ -2480,6 +2523,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, return 0; } @@ -258,7 +258,7 @@ index 2db89f71ea5..162723423ca 100644 static grub_err_t get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, grub_uint64_t objectid, grub_uint64_t offset, -@@ -2666,6 +2853,7 @@ static struct grub_fs grub_btrfs_fs = { +@@ -2686,6 +2873,7 @@ static struct grub_fs grub_btrfs_fs = { }; static grub_command_t cmd_info; @@ -266,7 +266,7 @@ index 2db89f71ea5..162723423ca 100644 static grub_extcmd_t cmd_list_subvols; static char * -@@ -2729,6 +2917,9 @@ GRUB_MOD_INIT (btrfs) +@@ -2749,6 +2937,9 @@ GRUB_MOD_INIT (btrfs) cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, "DEVICE", "Print BtrFS info about DEVICE."); @@ -277,7 +277,7 @@ index 2db89f71ea5..162723423ca 100644 grub_cmd_btrfs_list_subvols, 0, "[-p|-n] [-o var] DEVICE", diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 5d50dd6f8dc..4c5a13022dc 100644 +index caf9b1ccd3f..28790307e00 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key @@ -460,10 +460,10 @@ index 5d50dd6f8dc..4c5a13022dc 100644 grub_make_system_path_relative_to_its_root_os (const char *path) { diff --git a/util/grub-install.c b/util/grub-install.c -index 0e807b09c36..3e718b9e3fb 100644 +index 427ae013701..c03214bdfcf 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -1561,6 +1561,55 @@ main (int argc, char *argv[]) +@@ -1569,6 +1569,55 @@ main (int argc, char *argv[]) prefix_drive = xasprintf ("(%s)", grub_drives[0]); } diff --git a/0080-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0060-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 94% rename from 0080-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0060-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch index f023ca2f..b02ab53f 100644 --- a/0080-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +++ b/0060-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch @@ -10,10 +10,10 @@ Ref: bsc#953538 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 162723423ca..69c30e62354 100644 +index d323746ecfa..673ded03522 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -1240,11 +1240,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) +@@ -1260,11 +1260,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) return GRUB_ERR_NONE; } diff --git a/0081-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0061-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 97% rename from 0081-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0061-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch index f88b8916..d4e20cd5 100644 --- a/0081-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +++ b/0061-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch @@ -8,10 +8,10 @@ Subject: [PATCH] Grub not working correctly with btrfs snapshots (bsc#1026511) 1 file changed, 238 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 69c30e62354..ba99d04f8ed 100644 +index 673ded03522..2b21cbaa67e 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -2867,6 +2867,238 @@ out: +@@ -2887,6 +2887,238 @@ out: return 0; } @@ -250,7 +250,7 @@ index 69c30e62354..ba99d04f8ed 100644 static struct grub_fs grub_btrfs_fs = { .name = "btrfs", .fs_dir = grub_btrfs_dir, -@@ -2885,6 +3117,7 @@ static struct grub_fs grub_btrfs_fs = { +@@ -2905,6 +3137,7 @@ static struct grub_fs grub_btrfs_fs = { static grub_command_t cmd_info; static grub_command_t cmd_mount_subvol; static grub_extcmd_t cmd_list_subvols; @@ -258,7 +258,7 @@ index 69c30e62354..ba99d04f8ed 100644 static char * subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)), -@@ -2955,6 +3188,11 @@ GRUB_MOD_INIT (btrfs) +@@ -2975,6 +3208,11 @@ GRUB_MOD_INIT (btrfs) "[-p|-n] [-o var] DEVICE", "Print list of BtrFS subvolumes on " "DEVICE.", options); diff --git a/0082-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0062-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 96% rename from 0082-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0062-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch index ccb1947b..bde70969 100644 --- a/0082-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +++ b/0062-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 090c8621066..5e2b479daec 100644 +index 585fa6662b6..03f9a9d0118 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -24,6 +24,10 @@ @@ -58,7 +58,7 @@ index 090c8621066..5e2b479daec 100644 grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle); void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp); char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp); -@@ -109,10 +140,7 @@ void grub_efi_init (void); +@@ -115,10 +146,7 @@ void grub_efi_init (void); void grub_efi_fini (void); void grub_efi_set_prefix (void); diff --git a/0062-Fix-security-issue-when-reading-username-and-passwor.patch b/0062-Fix-security-issue-when-reading-username-and-passwor.patch deleted file mode 100644 index 11bc4340..00000000 --- a/0062-Fix-security-issue-when-reading-username-and-passwor.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hector Marco-Gisbert -Date: Fri, 13 Nov 2015 16:21:09 +0100 -Subject: [PATCH] Fix security issue when reading username and password - - This patch fixes two integer underflows at: - * grub-core/lib/crypto.c - * grub-core/normal/auth.c - -Resolves: CVE-2015-8370 - -Signed-off-by: Hector Marco-Gisbert -Signed-off-by: Ismael Ripoll-Ripoll ---- - grub-core/lib/crypto.c | 2 +- - grub-core/normal/auth.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index ca334d5a40e..e6c78d16d39 100644 ---- a/grub-core/lib/crypto.c -+++ b/grub-core/lib/crypto.c -@@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned buf_size) - break; - } - -- if (key == '\b') -+ if (key == '\b' && cur_len) - { - if (cur_len) - cur_len--; -diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c -index 6be678c0de1..c35ce972473 100644 ---- a/grub-core/normal/auth.c -+++ b/grub-core/normal/auth.c -@@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned buf_size) - break; - } - -- if (key == GRUB_TERM_BACKSPACE) -+ if (key == GRUB_TERM_BACKSPACE && cur_len) - { - if (cur_len) - { diff --git a/0063-Add-a-url-parser.patch b/0063-Add-a-url-parser.patch deleted file mode 100644 index d6047fba..00000000 --- a/0063-Add-a-url-parser.patch +++ /dev/null @@ -1,1021 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 14 Jun 2016 16:18:44 -0400 -Subject: [PATCH] Add a url parser. - -This patch adds a url parser that can parse http, https, tftp, and tftps -urls, and is easily extensible to handle more types. - -It's a little ugly in terms of the arguments it takes. - -Signed-off-by: Peter Jones ---- - grub-core/Makefile.core.def | 1 + - grub-core/kern/misc.c | 13 + - grub-core/net/url.c | 861 ++++++++++++++++++++++++++++++++++++++++++++ - include/grub/misc.h | 45 +++ - include/grub/net/url.h | 28 ++ - 5 files changed, 948 insertions(+) - create mode 100644 grub-core/net/url.c - create mode 100644 include/grub/net/url.h - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 57e253ab1a1..99466b1e47e 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -2284,6 +2284,7 @@ module = { - common = net/ethernet.c; - common = net/arp.c; - common = net/netbuff.c; -+ common = net/url.c; - }; - - module = { -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 2656a670e09..1c560ea570a 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -296,6 +296,19 @@ grub_strrchr (const char *s, int c) - return p; - } - -+char * -+grub_strchrnul (const char *s, int c) -+{ -+ do -+ { -+ if (*s == c) -+ break; -+ } -+ while (*s++); -+ -+ return (char *) s; -+} -+ - int - grub_strword (const char *haystack, const char *needle) - { -diff --git a/grub-core/net/url.c b/grub-core/net/url.c -new file mode 100644 -index 00000000000..146858284cd ---- /dev/null -+++ b/grub-core/net/url.c -@@ -0,0 +1,861 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifdef URL_TEST -+ -+#define _GNU_SOURCE 1 -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define N_(x) x -+ -+#define grub_malloc(x) malloc(x) -+#define grub_free(x) ({if (x) free(x);}) -+#define grub_error(a, fmt, args...) printf(fmt "\n", ## args) -+#define grub_dprintf(a, fmt, args...) printf(a ": " fmt, ## args) -+#define grub_strlen(x) strlen(x) -+#define grub_strdup(x) strdup(x) -+#define grub_strstr(x,y) strstr(x,y) -+#define grub_memcpy(x,y,z) memcpy(x,y,z) -+#define grub_strcmp(x,y) strcmp(x,y) -+#define grub_strncmp(x,y,z) strncmp(x,y,z) -+#define grub_strcasecmp(x,y) strcasecmp(x,y) -+#define grub_strchrnul(x,y) strchrnul(x,y) -+#define grub_strchr(x,y) strchr(x,y) -+#define grub_strndup(x,y) strndup(x,y) -+#define grub_strtoul(x,y,z) strtoul(x,y,z) -+#define grub_memmove(x,y,z) memmove(x,y,z) -+#define grub_size_t size_t -+#define grub_errno errno -+ -+#else -+#include -+#include -+#include -+#include -+#endif -+ -+static char * -+translate_slashes(char *str) -+{ -+ int i, j; -+ if (str == NULL) -+ return str; -+ -+ for (i = 0, j = 0; str[i] != '\0'; i++, j++) -+ { -+ if (str[i] == '\\') -+ { -+ str[j] = '/'; -+ if (str[i+1] == '\\') -+ i++; -+ } -+ } -+ -+ return str; -+} -+ -+static inline int -+hex2int (char c) -+{ -+ if (c >= '0' && c <= '9') -+ return c - '0'; -+ c |= 0x20; -+ if (c >= 'a' && c <= 'f') -+ return c - 'a' + 10; -+ return -1; -+} -+ -+static int -+url_unescape (char *buf, grub_size_t len) -+{ -+ int c, rc; -+ unsigned int i; -+ -+ -+ if (len < 3) -+ { -+ for (i = 0; i < len; i++) -+ if (buf[i] == '%') -+ return -1; -+ return 0; -+ } -+ -+ for (i = 0; len > 2 && i < len - 2; i++) -+ { -+ if (buf[i] == '%') -+ { -+ unsigned int j; -+ for (j = i+1; j < i+3; j++) -+ { -+ if (!(buf[j] >= '0' && buf[j] <= '9') && -+ !(buf[j] >= 'a' && buf[j] <= 'f') && -+ !(buf[j] >= 'A' && buf[j] <= 'F')) -+ return -1; -+ } -+ i += 2; -+ } -+ } -+ if (i == len - 2) -+ { -+ if (buf[i+1] == '%' || buf[i+2] == '%') -+ return -1; -+ } -+ for (i = 0; i < len - 2; i++) -+ { -+ if (buf[i] == '%') -+ { -+ rc = hex2int (buf[i+1]); -+ if (rc < 0) -+ return -1; -+ c = (rc & 0xf) << 4; -+ rc = hex2int (buf[i+2]); -+ if (rc < 0) -+ return -1; -+ c |= (rc & 0xf); -+ -+ buf[i] = c; -+ grub_memmove (buf+i+1, buf+i+3, len-(i+2)); -+ len -= 2; -+ } -+ } -+ return 0; -+} -+ -+static int -+extract_http_url_info (char *url, int ssl, -+ char **userinfo, char **host, int *port, -+ char **file) -+{ -+ char *colon, *slash, *query, *at = NULL, *separator, *auth_end; -+ -+ char *userinfo_off = NULL; -+ char *userinfo_end; -+ char *host_off = NULL; -+ char *host_end; -+ char *port_off = NULL; -+ char *port_end; -+ char *file_off = NULL; -+ -+ grub_size_t l; -+ int c; -+ -+ if (!url || !userinfo || !host || !port || !file) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument"); -+ -+ *userinfo = *host = *file = NULL; -+ *port = -1; -+ -+ userinfo_off = url; -+ -+ slash = grub_strchrnul (userinfo_off, '/'); -+ query = grub_strchrnul (userinfo_off, '?'); -+ auth_end = slash < query ? slash : query; -+ /* auth_end here is one /past/ the last character in the auth section, i.e. -+ * it's the : or / or NUL */ -+ -+ separator = grub_strchrnul (userinfo_off, '@'); -+ if (separator > auth_end) -+ { -+ host_off = userinfo_off; -+ userinfo_off = NULL; -+ userinfo_end = NULL; -+ } -+ else -+ { -+ at = separator; -+ *separator = '\0'; -+ userinfo_end = separator; -+ host_off = separator + 1; -+ } -+ -+ if (*host_off == '[') -+ { -+ separator = grub_strchrnul (host_off, ']'); -+ if (separator >= auth_end) -+ goto fail; -+ -+ separator += 1; -+ host_end = separator; -+ } -+ else -+ { -+ host_end = separator = colon = grub_strchrnul (host_off, ':'); -+ -+ if (colon > auth_end) -+ { -+ separator = NULL; -+ host_end = auth_end; -+ } -+ } -+ -+ if (separator && separator < auth_end) -+ { -+ if (*separator == ':') -+ { -+ port_off = separator + 1; -+ port_end = auth_end; -+ -+ if (auth_end - port_end > 0) -+ goto fail; -+ if (port_end - port_off < 1) -+ goto fail; -+ } -+ else -+ goto fail; -+ } -+ -+ file_off = auth_end; -+ if (port_off) -+ { -+ unsigned long portul; -+ -+ separator = NULL; -+ c = *port_end; -+ *port_end = '\0'; -+ -+ portul = grub_strtoul (port_off, &separator, 10); -+ *port_end = c; -+#ifdef URL_TEST -+ if (portul == ULONG_MAX && errno == ERANGE) -+ goto fail; -+#else -+ if (grub_errno == GRUB_ERR_OUT_OF_RANGE) -+ goto fail; -+#endif -+ if (portul & ~0xfffful) -+ goto fail; -+ if (separator != port_end) -+ goto fail; -+ -+ *port = portul & 0xfffful; -+ } -+ else if (ssl) -+ *port = 443; -+ else -+ *port = 80; -+ -+ if (userinfo_off && *userinfo_off) -+ { -+ l = userinfo_end - userinfo_off + 1; -+ -+ *userinfo = grub_strndup (userinfo_off, l); -+ if (!*userinfo) -+ goto fail; -+ (*userinfo)[l-1]= '\0'; -+ } -+ -+ l = host_end - host_off; -+ -+ if (host_end == NULL) -+ goto fail; -+ else -+ c = *host_end; -+ -+ *host_end = '\0'; -+ *host = grub_strndup (host_off, l); -+ *host_end = c; -+ if (!*host) -+ goto fail; -+ (*host)[l] = '\0'; -+ -+ *file = grub_strdup (file_off); -+ if (!*file) -+ goto fail; -+ -+ if (at) -+ *at = '@'; -+ return 0; -+fail: -+ if (at) -+ *at = '@'; -+ grub_free (*userinfo); -+ grub_free (*host); -+ grub_free (*file); -+ -+ return -1; -+} -+ -+static int -+extract_tftp_url_info (char *url, int ssl, char **host, char **file, int *port) -+{ -+ char *slash, *semi; -+ -+ char *host_off = url; -+ char *host_end; -+ char *file_off; -+ -+ int c; -+ -+ if (!url || !host || !file || !port) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument"); -+ -+ if (ssl) -+ *port = 3713; -+ else -+ *port = 69; -+ -+ slash = grub_strchr (url, '/'); -+ if (!slash) -+ return -1; -+ -+ host_end = file_off = slash; -+ -+ semi = grub_strchrnul (slash, ';'); -+ if (!grub_strncmp (semi, ";mode=", 6) && grub_strcmp (semi+6, "octet")) -+ { -+ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ N_("TFTP mode `%s' is not implemented."), semi+6); -+ return -1; -+ } -+ -+ /* -+ * Maybe somebody added a new method, I dunno. Anyway, semi is a reserved -+ * character, so if it's there, it's the start of the mode block or it's -+ * invalid. So set it to \0 unconditionally, not just for ;mode=octet -+ */ -+ *semi = '\0'; -+ -+ c = *host_end; -+ *host_end = '\0'; -+ *host = grub_strdup (host_off); -+ *host_end = c; -+ -+ *file = grub_strdup (file_off); -+ -+ if (!*file || !*host) -+ { -+ grub_free (*file); -+ grub_free (*host); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+int -+extract_url_info (const char *urlbuf, grub_size_t buflen, -+ char **scheme, char **userinfo, -+ char **host, int *port, char **file) -+{ -+ char *url; -+ char *colon; -+ -+ char *scheme_off; -+ char *specific_off; -+ -+ int rc; -+ int c; -+ -+ int https; -+ -+ if (!urlbuf || !buflen || !scheme || !userinfo || !host || !port || !file) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument"); -+ -+ *scheme = *userinfo = *host = *file = NULL; -+ *port = -1; -+ -+ /* make sure we have our own coherent grub_string. */ -+ url = grub_malloc (buflen + 1); -+ if (!url) -+ return -1; -+ -+ grub_memcpy (url, urlbuf, buflen); -+ url[buflen] = '\0'; -+ -+ grub_dprintf ("net", "dhcpv6 boot-file-url: `%s'\n", url); -+ -+ /* get rid of any backslashes */ -+ url = translate_slashes (url); -+ -+ /* find the constituent parts */ -+ colon = grub_strstr (url, "://"); -+ if (!colon) -+ goto fail; -+ -+ scheme_off = url; -+ c = *colon; -+ *colon = '\0'; -+ specific_off = colon + 3; -+ -+ https = !grub_strcasecmp (scheme_off, "https"); -+ -+ rc = 0; -+ if (!grub_strcasecmp (scheme_off, "tftp")) -+ { -+ rc = extract_tftp_url_info (specific_off, 0, host, file, port); -+ } -+#ifdef URL_TEST -+ else if (!grub_strcasecmp (scheme_off, "http") || https) -+#else -+ else if (!grub_strcasecmp (scheme_off, "http")) -+#endif -+ { -+ rc = extract_http_url_info (specific_off, -+ https, userinfo, host, port, file); -+ } -+#ifdef URL_TEST -+ else if (!grub_strcasecmp (scheme_off, "iscsi")) -+ { -+ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ N_("Unimplemented URL scheme `%s'"), scheme_off); -+ *colon = c; -+ goto fail; -+ } -+ else if (!grub_strcasecmp (scheme_off, "tftps")) -+ { -+ rc = extract_tftp_url_info (specific_off, 1, host, file, port); -+ } -+#endif -+ else -+ { -+ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ N_("Unimplemented URL scheme `%s'"), scheme_off); -+ *colon = c; -+ goto fail; -+ } -+ -+ if (rc < 0) -+ { -+ *colon = c; -+ goto fail; -+ } -+ -+ *scheme = grub_strdup (scheme_off); -+ *colon = c; -+ if (!*scheme) -+ goto fail; -+ -+ if (*userinfo) -+ { -+ rc = url_unescape (*userinfo, grub_strlen (*userinfo)); -+ if (rc < 0) -+ goto fail; -+ } -+ -+ if (*host) -+ { -+ rc = url_unescape (*host, grub_strlen (*host)); -+ if (rc < 0) -+ goto fail; -+ } -+ -+ if (*file) -+ { -+ rc = url_unescape (*file, grub_strlen (*file)); -+ if (rc < 0) -+ goto fail; -+ } -+ -+ grub_free (url); -+ return 0; -+fail: -+ grub_free (*scheme); -+ grub_free (*userinfo); -+ grub_free (*host); -+ grub_free (*file); -+ -+ if (!grub_errno) -+ grub_error (GRUB_ERR_NET_BAD_ADDRESS, N_("Invalid boot-file-url `%s'"), -+ url); -+ grub_free (url); -+ return -1; -+} -+ -+#ifdef URL_TEST -+ -+struct test { -+ char *url; -+ int rc; -+ char *scheme; -+ char *userinfo; -+ char *host; -+ int port; -+ char *file; -+} tests[] = { -+ {.url = "http://foo.example.com/", -+ .rc = 0, -+ .scheme = "http", -+ .host = "foo.example.com", -+ .port = 80, -+ .file = "/", -+ }, -+ {.url = "http://foo.example.com/?foobar", -+ .rc = 0, -+ .scheme = "http", -+ .host = "foo.example.com", -+ .port = 80, -+ .file = "/?foobar", -+ }, -+ {.url = "http://[foo.example.com/", -+ .rc = -1, -+ }, -+ {.url = "http://[foo.example.com/?foobar", -+ .rc = -1, -+ }, -+ {.url = "http://foo.example.com:/", -+ .rc = -1, -+ }, -+ {.url = "http://foo.example.com:81/", -+ .rc = 0, -+ .scheme = "http", -+ .host = "foo.example.com", -+ .port = 81, -+ .file = "/", -+ }, -+ {.url = "http://foo.example.com:81/?foobar", -+ .rc = 0, -+ .scheme = "http", -+ .host = "foo.example.com", -+ .port = 81, -+ .file = "/?foobar", -+ }, -+ {.url = "http://[1234::1]/", -+ .rc = 0, -+ .scheme = "http", -+ .host = "[1234::1]", -+ .port = 80, -+ .file = "/", -+ }, -+ {.url = "http://[1234::1]/?foobar", -+ .rc = 0, -+ .scheme = "http", -+ .host = "[1234::1]", -+ .port = 80, -+ .file = "/?foobar", -+ }, -+ {.url = "http://[1234::1]:81/", -+ .rc = 0, -+ .scheme = "http", -+ .host = "[1234::1]", -+ .port = 81, -+ .file = "/", -+ }, -+ {.url = "http://[1234::1]:81/?foobar", -+ .rc = 0, -+ .scheme = "http", -+ .host = "[1234::1]", -+ .port = 81, -+ .file = "/?foobar", -+ }, -+ {.url = "http://foo@foo.example.com/", -+ .rc = 0, -+ .scheme = "http", -+ .userinfo = "foo", -+ .host = "foo.example.com", -+ .port = 80, -+ .file = "/", -+ }, -+ {.url = "http://foo@foo.example.com/?foobar", -+ .rc = 0, -+ .scheme = "http", -+ .userinfo = "foo", -+ .host = "foo.example.com", -+ .port = 80, -+ .file = "/?foobar", -+ }, -+ {.url = "http://foo@[foo.example.com/", -+ .rc = -1, -+ }, -+ {.url = "http://foo@[foo.example.com/?foobar", -+ .rc = -1, -+ }, -+ {.url = "http://foo@foo.example.com:81/", -+ .rc = 0, -+ .scheme = "http", -+ .userinfo = "foo", -+ .host = "foo.example.com", -+ .port = 81, -+ .file = "/", -+ }, -+ {.url = "http://foo@foo.example.com:81/?foobar", -+ .rc = 0, -+ .scheme = "http", -+ .userinfo = "foo", -+ .host = "foo.example.com", -+ .port = 81, -+ .file = "/?foobar", -+ }, -+ {.url = "http://foo@[1234::1]/", -+ .rc = 0, -+ .scheme = "http", -+ .userinfo = "foo", -+ .host = "[1234::1]", -+ .port = 80, -+ .file = "/", -+ }, -+ {.url = "http://foo@[1234::1]/?foobar", -+ .rc = 0, -+ .scheme = "http", -+ .userinfo = "foo", -+ .host = "[1234::1]", -+ .port = 80, -+ .file = "/?foobar", -+ }, -+ {.url = "http://foo@[1234::1]:81/", -+ .rc = 0, -+ .scheme = "http", -+ .userinfo = "foo", -+ .host = "[1234::1]", -+ .port = 81, -+ .file = "/", -+ }, -+ {.url = "http://foo@[1234::1]:81/?foobar", -+ .rc = 0, -+ .scheme = "http", -+ .userinfo = "foo", -+ .host = "[1234::1]", -+ .port = 81, -+ .file = "/?foobar", -+ }, -+ {.url = "https://foo.example.com/", -+ .rc = 0, -+ .scheme = "https", -+ .host = "foo.example.com", -+ .port = 443, -+ .file = "/", -+ }, -+ {.url = "https://foo.example.com/?foobar", -+ .rc = 0, -+ .scheme = "https", -+ .host = "foo.example.com", -+ .port = 443, -+ .file = "/?foobar", -+ }, -+ {.url = "https://[foo.example.com/", -+ .rc = -1, -+ }, -+ {.url = "https://[foo.example.com/?foobar", -+ .rc = -1, -+ }, -+ {.url = "https://foo.example.com:81/", -+ .rc = 0, -+ .scheme = "https", -+ .host = "foo.example.com", -+ .port = 81, -+ .file = "/", -+ }, -+ {.url = "https://foo.example.com:81/?foobar", -+ .rc = 0, -+ .scheme = "https", -+ .host = "foo.example.com", -+ .port = 81, -+ .file = "/?foobar", -+ }, -+ {.url = "https://[1234::1]/", -+ .rc = 0, -+ .scheme = "https", -+ .host = "[1234::1]", -+ .port = 443, -+ .file = "/", -+ }, -+ {.url = "https://[1234::1]/?foobar", -+ .rc = 0, -+ .scheme = "https", -+ .host = "[1234::1]", -+ .port = 443, -+ .file = "/?foobar", -+ }, -+ {.url = "https://[1234::1]:81/", -+ .rc = 0, -+ .scheme = "https", -+ .host = "[1234::1]", -+ .port = 81, -+ .file = "/", -+ }, -+ {.url = "https://[1234::1]:81/?foobar", -+ .rc = 0, -+ .scheme = "https", -+ .host = "[1234::1]", -+ .port = 81, -+ .file = "/?foobar", -+ }, -+ {.url = "https://foo@foo.example.com/", -+ .rc = 0, -+ .scheme = "https", -+ .userinfo = "foo", -+ .host = "foo.example.com", -+ .port = 443, -+ .file = "/", -+ }, -+ {.url = "https://foo@foo.example.com/?foobar", -+ .rc = 0, -+ .scheme = "https", -+ .userinfo = "foo", -+ .host = "foo.example.com", -+ .port = 443, -+ .file = "/?foobar", -+ }, -+ {.url = "https://foo@[foo.example.com/", -+ .rc = -1, -+ }, -+ {.url = "https://f%6fo@[foo.example.com/?fooba%72", -+ .rc = -1, -+ }, -+ {.url = "https://foo@foo.example.com:81/", -+ .rc = 0, -+ .scheme = "https", -+ .userinfo = "foo", -+ .host = "foo.example.com", -+ .port = 81, -+ .file = "/", -+ }, -+ {.url = "https://foo@foo.example.com:81/?foobar", -+ .rc = 0, -+ .scheme = "https", -+ .userinfo = "foo", -+ .host = "foo.example.com", -+ .port = 81, -+ .file = "/?foobar", -+ }, -+ {.url = "https://foo@[1234::1]/", -+ .rc = 0, -+ .scheme = "https", -+ .userinfo = "foo", -+ .host = "[1234::1]", -+ .port = 443, -+ .file = "/", -+ }, -+ {.url = "https://foo@[1234::1]/?foobar", -+ .rc = 0, -+ .scheme = "https", -+ .userinfo = "foo", -+ .host = "[1234::1]", -+ .port = 443, -+ .file = "/?foobar", -+ }, -+ {.url = "https://f%6fo@[12%334::1]:81/", -+ .rc = 0, -+ .scheme = "https", -+ .userinfo = "foo", -+ .host = "[1234::1]", -+ .port = 81, -+ .file = "/", -+ }, -+ {.url = "https://foo@[1234::1]:81/?foobar", -+ .rc = 0, -+ .scheme = "https", -+ .userinfo = "foo", -+ .host = "[1234::1]", -+ .port = 81, -+ .file = "/?foobar", -+ }, -+ {.url = "tftp://foo.e%78ample.com/foo/bar/b%61%7a", -+ .rc = 0, -+ .scheme = "tftp", -+ .host = "foo.example.com", -+ .port = 69, -+ .file = "/foo/bar/baz", -+ }, -+ {.url = "tftp://foo.example.com/foo/bar/baz", -+ .rc = 0, -+ .scheme = "tftp", -+ .host = "foo.example.com", -+ .port = 69, -+ .file = "/foo/bar/baz", -+ }, -+ {.url = "tftps://foo.example.com/foo/bar/baz", -+ .rc = 0, -+ .scheme = "tftps", -+ .host = "foo.example.com", -+ .port = 3713, -+ .file = "/foo/bar/baz", -+ }, -+ {.url = "tftps://foo.example.com/foo/bar/baz;mode=netascii", -+ .rc = -1, -+ }, -+ {.url = "tftps://foo.example.com/foo/bar/baz;mode=octet", -+ .rc = 0, -+ .scheme = "tftps", -+ .host = "foo.example.com", -+ .port = 3713, -+ .file = "/foo/bar/baz", -+ }, -+ {.url = "tftps://foo.example.com/foo/bar/baz;mode=invalid", -+ .rc = -1, -+ }, -+ {.url = "", -+ }, -+}; -+ -+static int -+string_test (char *name, char *a, char *b) -+{ -+ if ((a && !b) || (!a && b)) -+ { -+ printf("expected %s \"%s\", got \"%s\"\n", name, a, b); -+ return -1; -+ } -+ if (a && b && strcmp(a, b)) -+ { -+ printf("expected %s \"%s\", got \"%s\"\n", name, a, b); -+ return -1; -+ } -+ return 0; -+} -+ -+int -+main(void) -+{ -+ unsigned int i; -+ int rc; -+ -+ for (i = 0; tests[i].url[0] != '\0'; i++) -+ { -+ char *scheme, *userinfo, *host, *file; -+ int port; -+ -+ printf("======= url: \"%s\"\n", tests[i].url); -+ rc = extract_url_info(tests[i].url, strlen(tests[i].url) + 1, -+ &scheme, &userinfo, &host, &port, &file); -+ if (tests[i].rc != rc) -+ { -+ printf(" extract_url_info(...) = %d\n", rc); -+ exit(1); -+ } -+ else if (rc >= 0) -+ { -+ if (string_test("scheme", tests[i].scheme, scheme) < 0) -+ exit(1); -+ if (string_test("userinfo", tests[i].userinfo, userinfo) < 0) -+ exit(1); -+ if (string_test("host", tests[i].host, host) < 0) -+ exit(1); -+ if (port != tests[i].port) -+ { -+ printf(" bad port \"%d\" should have been \"%d\"\n", -+ port, tests[i].port); -+ exit(1); -+ } -+ if (string_test("file", tests[i].file, file) < 0) -+ exit(1); -+ } -+ free(scheme); -+ free(userinfo); -+ free(host); -+ free(file); -+ } -+ printf("everything worked?!?\n"); -+} -+#endif -diff --git a/include/grub/misc.h b/include/grub/misc.h -index f9135b62e35..b4339222ecb 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -85,6 +85,7 @@ int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n); - - char *EXPORT_FUNC(grub_strchr) (const char *s, int c); - char *EXPORT_FUNC(grub_strrchr) (const char *s, int c); -+char *EXPORT_FUNC(grub_strchrnul) (const char *s, int c); - int EXPORT_FUNC(grub_strword) (const char *s, const char *w); - - /* Copied from gnulib. -@@ -207,6 +208,50 @@ grub_toupper (int c) - return c; - } - -+static inline char * -+grub_strcasestr (const char *haystack, const char *needle) -+{ -+ /* Be careful not to look at the entire extent of haystack or needle -+ until needed. This is useful because of these two cases: -+ - haystack may be very long, and a match of needle found early, -+ - needle may be very long, and not even a short initial segment of -+ needle may be found in haystack. */ -+ if (*needle != '\0') -+ { -+ /* Speed up the following searches of needle by caching its first -+ character. */ -+ char b = *needle++; -+ -+ for (;; haystack++) -+ { -+ if (*haystack == '\0') -+ /* No match. */ -+ return 0; -+ if (grub_tolower(*haystack) == grub_tolower(b)) -+ /* The first character matches. */ -+ { -+ const char *rhaystack = haystack + 1; -+ const char *rneedle = needle; -+ -+ for (;; rhaystack++, rneedle++) -+ { -+ if (*rneedle == '\0') -+ /* Found a match. */ -+ return (char *) haystack; -+ if (*rhaystack == '\0') -+ /* No match. */ -+ return 0; -+ if (grub_tolower(*rhaystack) != grub_tolower(*rneedle)) -+ /* Nothing in this round. */ -+ break; -+ } -+ } -+ } -+ } -+ else -+ return (char *) haystack; -+} -+ - static inline int - grub_strcasecmp (const char *s1, const char *s2) - { -diff --git a/include/grub/net/url.h b/include/grub/net/url.h -new file mode 100644 -index 00000000000..a215fa27d0a ---- /dev/null -+++ b/include/grub/net/url.h -@@ -0,0 +1,28 @@ -+/* url.h - prototypes for url parsing functions */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2016 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_URL_HEADER -+#define GRUB_URL_HEADER 1 -+ -+int -+EXPORT_FUNC(extract_url_info) (const char *urlbuf, grub_size_t buflen, -+ char **scheme, char **userinfo, -+ char **host, int *port, char **file); -+ -+#endif /* GRUB_URL_HEADER */ diff --git a/0083-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch similarity index 89% rename from 0083-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename to 0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch index a9e1a2b6..4fa92c0d 100644 --- a/0083-Use-grub_efi_.-memory-helpers-where-reasonable.patch +++ b/0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 5aa3a5dc7dd..3a724a9fcbf 100644 +index 3ff305b1d32..ba3d2930197 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -65,7 +65,7 @@ grub_chainloader_unload (void) @@ -34,7 +34,7 @@ index 5aa3a5dc7dd..3a724a9fcbf 100644 grub_loader_unset (); -@@ -506,10 +506,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) +@@ -523,10 +523,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) static grub_efi_boolean_t handle_image (void *data, grub_efi_uint32_t datasize) { @@ -46,7 +46,7 @@ index 5aa3a5dc7dd..3a724a9fcbf 100644 char *buffer_aligned = NULL; grub_efi_uint32_t i; struct grub_pe32_section_table *section; -@@ -520,8 +519,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -537,8 +536,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) int found_entry_point = 0; int rc; @@ -55,7 +55,7 @@ index 5aa3a5dc7dd..3a724a9fcbf 100644 rc = read_header (data, datasize, &context); if (rc < 0) { -@@ -561,8 +558,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -578,8 +575,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n", context.image_size, datasize); @@ -66,7 +66,7 @@ index 5aa3a5dc7dd..3a724a9fcbf 100644 if (efi_status != GRUB_EFI_SUCCESS) { -@@ -794,14 +791,14 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -811,14 +808,14 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_dprintf ("chain", "entry_point returned %ld\n", efi_status); grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); @@ -83,7 +83,7 @@ index 5aa3a5dc7dd..3a724a9fcbf 100644 return 0; } -@@ -809,10 +806,7 @@ error_exit: +@@ -826,10 +823,7 @@ error_exit: static grub_err_t grub_secureboot_chainloader_unload (void) { @@ -95,7 +95,7 @@ index 5aa3a5dc7dd..3a724a9fcbf 100644 grub_free (file_path); grub_free (cmdline); cmdline = 0; -@@ -1079,7 +1073,7 @@ fail: +@@ -1096,7 +1090,7 @@ fail: grub_free (file_path); if (address) diff --git a/0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch similarity index 78% rename from 0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename to 0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch index d438465b..1a96b433 100644 --- a/0084-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +++ b/0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch @@ -8,14 +8,14 @@ This avoids syntax checkers getting confused about if it's llx or lx. Signed-off-by: Peter Jones --- grub-core/loader/efi/chainloader.c | 3 ++- - include/grub/efi/api.h | 8 ++++++++ - 2 files changed, 10 insertions(+), 1 deletion(-) + include/grub/efi/api.h | 9 +++++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 3a724a9fcbf..f4ddbeda687 100644 +index ba3d2930197..47f5aa14817 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -789,7 +789,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -806,7 +806,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) efi_status = efi_call_2 (entry_point, grub_efi_image_handle, grub_efi_system_table); @@ -26,13 +26,15 @@ index 3a724a9fcbf..f4ddbeda687 100644 efi_status = grub_efi_free_pool (buffer); diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index d97cdf98c80..955973ed484 100644 +index 117469450d3..99628801478 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -527,6 +527,14 @@ typedef grub_uint8_t grub_efi_char8_t; +@@ -546,7 +546,16 @@ typedef grub_uint64_t grub_efi_uint64_t; + typedef grub_uint8_t grub_efi_char8_t; typedef grub_uint16_t grub_efi_char16_t; - typedef grub_efi_intn_t grub_efi_status_t; ++ + typedef grub_efi_uintn_t grub_efi_status_t; +/* Make grub_efi_status_t reasonably printable. */ +#if GRUB_CPU_SIZEOF_VOID_P == 8 +#define PRIxGRUB_EFI_STATUS "lx" diff --git a/0087-don-t-use-int-for-efi-status.patch b/0065-don-t-use-int-for-efi-status.patch similarity index 88% rename from 0087-don-t-use-int-for-efi-status.patch rename to 0065-don-t-use-int-for-efi-status.patch index 9cdf63e0..44d35554 100644 --- a/0087-don-t-use-int-for-efi-status.patch +++ b/0065-don-t-use-int-for-efi-status.patch @@ -8,10 +8,10 @@ Subject: [PATCH] don't use int for efi status 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index a1af9b46559..2cf6a5ad526 100644 +index 05d8237a9b2..ae9885edb84 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -166,7 +166,7 @@ grub_reboot (void) +@@ -167,7 +167,7 @@ grub_reboot (void) void grub_exit (int retval) { diff --git a/0066-Normalize-slashes-in-tftp-paths.patch b/0066-Normalize-slashes-in-tftp-paths.patch deleted file mode 100644 index 57f5e5eb..00000000 --- a/0066-Normalize-slashes-in-tftp-paths.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lenny Szubowicz -Date: Mon, 29 Aug 2016 11:04:48 -0400 -Subject: [PATCH] Normalize slashes in tftp paths. - -Some tftp servers do not handle multiple consecutive slashes correctly; -this patch avoids sending tftp requests with non-normalized paths. - -Signed-off-by: Lenny Szubowicz -[msalter: fix malformed tftp packets] -Signed-off-by: Mark Salter ---- - grub-core/net/tftp.c | 28 +++++++++++++++++++++++++--- - 1 file changed, 25 insertions(+), 3 deletions(-) - -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index a5c5038130a..e6d831f1bc9 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -300,6 +300,25 @@ destroy_pq (tftp_data_t data) - grub_priority_queue_destroy (data->pq); - } - -+/* Create a normalized copy of the filename. -+ Compress any string of consecutive forward slashes to a single forward -+ slash. */ -+static void -+grub_normalize_filename (char *normalized, const char *filename) -+{ -+ char *dest = normalized; -+ char *src = filename; -+ -+ while (*src != '\0') -+ { -+ if (src[0] == '/' && src[1] == '/') -+ src++; -+ else -+ *dest++ = *src++; -+ } -+ *dest = '\0'; -+} -+ - static grub_err_t - tftp_open (struct grub_file *file, const char *filename) - { -@@ -337,9 +356,12 @@ tftp_open (struct grub_file *file, const char *filename) - rrqlen = 0; - - tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_RRQ); -- grub_strcpy (rrq, filename); -- rrqlen += grub_strlen (filename) + 1; -- rrq += grub_strlen (filename) + 1; -+ -+ /* Copy and normalize the filename to work-around issues on some tftp -+ servers when file names are being matched for remapping. */ -+ grub_normalize_filename (rrq, filename); -+ rrqlen += grub_strlen (rrq) + 1; -+ rrq += grub_strlen (rrq) + 1; - - grub_strcpy (rrq, "octet"); - rrqlen += grub_strlen ("octet") + 1; diff --git a/0088-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0066-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 96% rename from 0088-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0066-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch index 993034fc..1014900c 100644 --- a/0088-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +++ b/0066-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch @@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes. 1 file changed, 2 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index f03c03561a1..90dc9bb1017 100644 +index b3753c9ca26..91933b85f2c 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -54,6 +54,7 @@ grub_mod_fini (void) diff --git a/0091-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 92% rename from 0091-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch index 1e8743a1..89a65dbe 100644 --- a/0091-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +++ b/0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch @@ -16,10 +16,10 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index 3e718b9e3fb..37fcdac12cc 100644 +index c03214bdfcf..1e47491bc21 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -1182,18 +1182,8 @@ main (int argc, char *argv[]) +@@ -1190,18 +1190,8 @@ main (int argc, char *argv[]) char *d; is_guess = 1; diff --git a/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 51% rename from 0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch index b2c7519a..aa4cc8a5 100644 --- a/0092-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +++ b/0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -5,43 +5,27 @@ Subject: [PATCH] 20_linux_xen: load xen or multiboot{,2} modules as needed. Signed-off-by: Peter Jones --- - util/grub.d/20_linux_xen.in | 5 +++++ - 1 file changed, 5 insertions(+) + util/grub.d/20_linux_xen.in | 3 +++ + 1 file changed, 3 insertions(+) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 1519ec692fe..b6e4608db6e 100644 +index e9e73b815fb..f8897479fe6 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in -@@ -136,6 +136,7 @@ linux_entry () +@@ -153,6 +153,8 @@ linux_entry_xsm () else xen_rm_opts="no-real-mode edd=off" fi -+ insmod ${xen_module} ++ insmod ${module_loader} ++ insmod ${xen_loader} ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} echo '$(echo "$lmessage" | grub_quote)' ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} -@@ -149,6 +150,7 @@ EOF +@@ -166,6 +168,7 @@ EOF done sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' -+ insmod ${xen_module} ++ insmod ${module_loader} ${module_loader} --nounzip $(echo $initrd_path) EOF fi -@@ -225,13 +227,16 @@ while [ "x${xen_list}" != "x" ] ; do - echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" - fi - if ($grub_file --is-arm64-efi $current_xen); then -+ xen_module="xen_boot" - xen_loader="xen_hypervisor" - module_loader="xen_module" - else - if ($grub_file --is-x86-multiboot2 $current_xen); then -+ xen_module="multiboot2" - xen_loader="multiboot2" - module_loader="module2" - else -+ xen_module="multiboot" - xen_loader="multiboot" - module_loader="module" - fi diff --git a/0093-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch similarity index 100% rename from 0093-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename to 0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch diff --git a/0094-align-struct-efi_variable-better.patch b/0070-align-struct-efi_variable-better.patch similarity index 96% rename from 0094-align-struct-efi_variable-better.patch rename to 0070-align-struct-efi_variable-better.patch index 0afd9357..6d28e6d2 100644 --- a/0094-align-struct-efi_variable-better.patch +++ b/0070-align-struct-efi_variable-better.patch @@ -20,7 +20,7 @@ index 36d2dedf47e..9d93ba88bac 100644 +} GRUB_PACKED GRUB_ALIGNED(8); #endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */ diff --git a/include/grub/types.h b/include/grub/types.h -index 035a4b528fc..2fc4be4039a 100644 +index b36b26a79d4..30e57254889 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -29,6 +29,7 @@ diff --git a/0070-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch b/0070-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch deleted file mode 100644 index f0e491e0..00000000 --- a/0070-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Salter -Date: Mon, 17 Apr 2017 08:44:29 -0400 -Subject: [PATCH] arm64: make sure fdt has #address-cells and #size-cells - properties - -Recent upstream changes to kexec-tools relies on #address-cells -and #size-cells properties in the FDT. If grub2 needs to create -a chosen node, it is likely because firmware did not provide one. -In that case, set #address-cells and #size-cells properties to -make sure they exist. ---- - grub-core/loader/arm64/linux.c | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 04994d5c67d..4c0a09c06de 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -81,7 +81,21 @@ finalize_params_linux (void) - - node = grub_fdt_find_subnode (fdt, 0, "chosen"); - if (node < 0) -- node = grub_fdt_add_subnode (fdt, 0, "chosen"); -+ { -+ /* -+ * If we have to create a chosen node, Make sure we -+ * have #address-cells and #size-cells properties. -+ */ -+ retval = grub_fdt_set_prop32(fdt, 0, "#address-cells", 2); -+ if (retval) -+ goto failure; -+ -+ retval = grub_fdt_set_prop32(fdt, 0, "#size-cells", 2); -+ if (retval) -+ goto failure; -+ -+ node = grub_fdt_add_subnode (fdt, 0, "chosen"); -+ } - - if (node < 1) - goto failure; diff --git a/0071-Add-BLS-support-to-grub-mkconfig.patch b/0071-Add-BLS-support-to-grub-mkconfig.patch new file mode 100644 index 00000000..15ce7b3a --- /dev/null +++ b/0071-Add-BLS-support-to-grub-mkconfig.patch @@ -0,0 +1,393 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 9 Dec 2016 15:40:29 -0500 +Subject: [PATCH] Add BLS support to grub-mkconfig + +GRUB now has BootLoaderSpec support, the user can choose to use this by +setting GRUB_ENABLE_BLSCFG to true in /etc/default/grub. On this setup, +the boot menu entries are not added to the grub.cfg, instead BLS config +files are parsed by blscfg command and the entries created dynamically. + +A 10_linux_bls grub.d snippet to generate menu entries from BLS files +is also added that can be used on platforms where the bootloader doesn't +have BLS support and only can parse a normal grub configuration file. + +Portions of the 10_linux_bls were taken from the ostree-grub-generator +script that's included in the OSTree project. + +Fixes to support multi-devices and generate a BLS section even if no +kernels are found in the boot directory were proposed by Yclept Nemo +and Tom Gundersen respectively. + +Signed-off-by: Peter Jones +Signed-off-by: Javier Martinez Canillas +--- + util/grub-mkconfig.8 | 4 + + util/grub-mkconfig.in | 9 +- + util/grub-mkconfig_lib.in | 20 ++++- + util/grub.d/10_linux.in | 223 +++++++++++++++++++++++++++++++++++++++++++++- + 4 files changed, 251 insertions(+), 5 deletions(-) + +diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8 +index a2d1f577b9b..434fa4deda4 100644 +--- a/util/grub-mkconfig.8 ++++ b/util/grub-mkconfig.8 +@@ -13,5 +13,9 @@ + \fB--output\fR=\fIFILE\fR + Write generated output to \fIFILE\fR. + ++.TP ++\fB--no-grubenv-update\fR ++Do not update variables in the grubenv file. ++ + .SH SEE ALSO + .BR "info grub" +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index e671ce68aec..1a70b7ea056 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@" + export TEXTDOMAIN=@PACKAGE@ + export TEXTDOMAINDIR="@localedir@" + ++export GRUB_GRUBENV_UPDATE="yes" ++ + . "${pkgdatadir}/grub-mkconfig_lib" + + # Usage: usage +@@ -59,6 +61,7 @@ usage () { + gettext "Generate a grub config file"; echo + echo + print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")" ++ print_option_help "--no-grubenv-update" "$(gettext "do not update variables in the grubenv file")" + print_option_help "-h, --help" "$(gettext "print this message and exit")" + print_option_help "-V, --version" "$(gettext "print the version information and exit")" + echo +@@ -94,6 +97,9 @@ do + --output=*) + grub_cfg=`echo "$option" | sed 's/--output=//'` + ;; ++ --no-grubenv-update) ++ GRUB_GRUBENV_UPDATE="no" ++ ;; + -*) + gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2 + usage +@@ -256,7 +262,8 @@ export GRUB_DEFAULT \ + GRUB_OS_PROBER_SKIP_LIST \ + GRUB_DISABLE_SUBMENU \ + GRUB_DEFAULT_DTB \ +- SUSE_BTRFS_SNAPSHOT_BOOTING ++ SUSE_BTRFS_SNAPSHOT_BOOTING \ ++ GRUB_ENABLE_BLSCFG + + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" +diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in +index fafeac95061..4e6534a41f6 100644 +--- a/util/grub-mkconfig_lib.in ++++ b/util/grub-mkconfig_lib.in +@@ -30,6 +30,9 @@ fi + if test "x$grub_file" = x; then + grub_file="${bindir}/@grub_file@" + fi ++if test "x$grub_editenv" = x; then ++ grub_editenv="${bindir}/@grub_editenv@" ++fi + if test "x$grub_mkrelpath" = x; then + grub_mkrelpath="${bindir}/@grub_mkrelpath@" + fi +@@ -125,8 +128,19 @@ EOF + fi + } + ++prepare_grub_to_access_device_with_variable () ++{ ++ device_variable="$1" ++ shift ++ prepare_grub_to_access_device "$@" ++ unset "device_variable" ++} ++ + prepare_grub_to_access_device () + { ++ if [ -z "$device_variable" ]; then ++ device_variable="root" ++ fi + old_ifs="$IFS" + IFS=' + ' +@@ -161,15 +175,15 @@ prepare_grub_to_access_device () + # otherwise set root as per value in device.map. + fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`" + if [ "x$fs_hint" != x ]; then +- echo "set root='$fs_hint'" ++ echo "set ${device_variable}='$fs_hint'" + fi + if [ "x${GRUB_DISABLE_UUID}" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then + hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints= + if [ "x$hints" != x ]; then + echo "if [ x\$feature_platform_search_hint = xy ]; then" +- echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}" ++ echo " search --no-floppy --fs-uuid --set=${device_variable} ${hints} ${fs_uuid}" + echo "else" +- echo " search --no-floppy --fs-uuid --set=root ${fs_uuid}" ++ echo " search --no-floppy --fs-uuid --set=${device_variable} ${fs_uuid}" + echo "fi" + else + echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}" +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index cbfaca34cc7..68adb55d893 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -82,6 +82,223 @@ case x"$GRUB_FS" in + ;; + esac + ++populate_header_warn() ++{ ++if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then ++ bls_parser="10_linux script" ++else ++ bls_parser="blscfg command" ++fi ++cat </dev/null | tac)) || : ++ ++ echo "${files[@]}" ++} ++ ++update_bls_cmdline() ++{ ++ local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++ local -a files=($(get_sorted_bls)) ++ ++ for bls in "${files[@]}"; do ++ local options="${cmdline}" ++ if [ -z "${bls##*debug*}" ]; then ++ options="${options} ${GRUB_CMDLINE_LINUX_DEBUG}" ++ fi ++ options="$(echo "${options}" | sed -e 's/\//\\\//g')" ++ sed -i -e "s/^options.*/options ${options}/" "${blsdir}/${bls}.conf" ++ done ++} ++ ++populate_menu() ++{ ++ local -a files=($(get_sorted_bls)) ++ ++ gettext_printf "Generating boot entries from BLS files...\n" >&2 ++ ++ for bls in "${files[@]}"; do ++ read_config "${blsdir}/${bls}.conf" ++ ++ menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" ++ menu="${menu}\t linux ${linux} ${options}\n" ++ if [ -n "${initrd}" ] ; then ++ menu="${menu}\t initrd ${boot_prefix}${initrd}\n" ++ fi ++ menu="${menu}}\n\n" ++ done ++ # The printf command seems to be more reliable across shells for special character (\n, \t) evaluation ++ printf "$menu" ++} ++ ++# Make BLS the default if GRUB_ENABLE_BLSCFG was not set and grubby is not installed. ++if [ -z "${GRUB_ENABLE_BLSCFG}" ] && [ -z "$(which new-kernel-pkg 2> /dev/null)" ]; then ++ GRUB_ENABLE_BLSCFG="true" ++fi ++ ++if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then ++ if [ x$dirname = x/ ]; then ++ if [ -z "${prepare_root_cache}" ]; then ++ prepare_grub_to_access_device ${GRUB_DEVICE} ++ fi ++ else ++ if [ -z "${prepare_boot_cache}" ]; then ++ prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} ++ fi ++ fi ++ ++ if [ -d /sys/firmware/efi ]; then ++ bootefi_device="`${grub_probe} --target=device /boot/efi/`" ++ prepare_grub_to_access_device_with_variable boot ${bootefi_device} ++ else ++ boot_device="`${grub_probe} --target=device /boot/`" ++ prepare_grub_to_access_device_with_variable boot ${boot_device} ++ fi ++ ++ arch="$(uname -m)" ++ if [ "x${arch}" = "xppc64le" ] && [ -d /sys/firmware/opal ]; then ++ ++ BLS_POPULATE_MENU="true" ++ petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" ++ ++ if test -e ${petitboot_path}; then ++ read -r -d '' petitboot_version < ${petitboot_path} ++ petitboot_version="$(echo ${petitboot_version//v})" ++ ++ if test -n ${petitboot_version}; then ++ major_version="$(echo ${petitboot_version} | cut -d . -f1)" ++ minor_version="$(echo ${petitboot_version} | cut -d . -f2)" ++ ++ re='^[0-9]+$' ++ if [[ $major_version =~ $re ]] && [[ $minor_version =~ $re ]] && ++ ([[ ${major_version} -gt 1 ]] || ++ [[ ${major_version} -eq 1 && ++ ${minor_version} -ge 8 ]]); then ++ BLS_POPULATE_MENU="false" ++ fi ++ fi ++ fi ++ fi ++ ++ populate_header_warn ++ ++ cat << EOF ++# The kernelopts variable should be defined in the grubenv file. But to ensure that menu ++# entries populated from BootLoaderSpec files that use this variable work correctly even ++# without a grubenv file, define a fallback kernelopts variable if this has not been set. ++# ++# The kernelopts variable in the grubenv file can be modified using the grubby tool or by ++# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX ++# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both ++# the kernelopts variable in the grubenv file and the fallback kernelopts variable. ++if [ -z "\${kernelopts}" ]; then ++ set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++fi ++EOF ++ ++ update_bls_cmdline ++ ++ if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then ++ populate_menu ++ else ++ cat << EOF ++ ++insmod blscfg ++blscfg ++EOF ++ fi ++ ++ if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then ++ blsdir="/boot/loader/entries" ++ [ -d "${blsdir}" ] && GRUB_BLS_FS="$(${grub_probe} --target=fs ${blsdir})" ++ if [ "x${GRUB_BLS_FS}" = "xbtrfs" ] || [ "x${GRUB_BLS_FS}" = "xzfs" ]; then ++ blsdir=$(make_system_path_relative_to_its_root "${blsdir}") ++ if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then ++ ${grub_editenv} - set blsdir="${blsdir}" ++ fi ++ fi ++ ++ if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then ++ ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ++ fi ++ ++ if [ -n "${GRUB_DEFAULT_DTB}" ]; then ++ ${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}" ++ fi ++ ++ if [ -n "${GRUB_SAVEDEFAULT}" ]; then ++ ${grub_editenv} - set save_default="${GRUB_SAVEDEFAULT}" ++ fi ++ fi ++ ++ exit 0 ++fi ++ + mktitle () + { + local title_type +@@ -121,6 +338,7 @@ linux_entry () + if [ -z "$boot_device_id" ]; then + boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" + fi ++ + if [ x$type != xsimple ] ; then + title=$(mktitle "$type" "$version") + if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then +@@ -224,6 +442,7 @@ is_top_level=true + while [ "x$list" != "x" ] ; do + linux=`version_find_latest $list` + gettext_printf "Found linux image: %s\n" "$linux" >&2 ++ + basename=`basename $linux` + dirname=`dirname $linux` + rel_dirname=`make_system_path_relative_to_its_root $dirname` +@@ -262,7 +481,9 @@ while [ "x$list" != "x" ] ; do + for i in ${initrd}; do + initrd_display="${initrd_display} ${dirname}/${i}" + done +- gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 ++ if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then ++ gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 ++ fi + fi + + fdt= diff --git a/0096-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0072-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 89% rename from 0096-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0072-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch index 204abbc0..9ff4c8b8 100644 --- a/0096-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +++ b/0072-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch @@ -12,10 +12,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 04371ac49f2..636f97e1ba1 100644 +index a3e215155bd..c60601b699d 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -1103,7 +1103,7 @@ static void __attribute__ ((noreturn)) +@@ -1201,7 +1201,7 @@ static void __attribute__ ((noreturn)) grub_abort (void) { #ifndef GRUB_UTIL diff --git a/0072-print-more-debug-info-in-our-module-loader.patch b/0072-print-more-debug-info-in-our-module-loader.patch deleted file mode 100644 index 48f48e3e..00000000 --- a/0072-print-more-debug-info-in-our-module-loader.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 1 May 2017 11:19:40 -0400 -Subject: [PATCH] print more debug info in our module loader. - -Signed-off-by: Peter Jones ---- - grub-core/kern/efi/efi.c | 16 +++++++++++++--- - 1 file changed, 13 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 370ce03c5d7..a1af9b46559 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -313,13 +313,23 @@ grub_efi_modules_addr (void) - } - - if (i == coff_header->num_sections) -- return 0; -+ { -+ grub_dprintf("sections", "section %d is last section; invalid.\n", i); -+ return 0; -+ } - - info = (struct grub_module_info *) ((char *) image->image_base - + section->virtual_address); -- if (info->magic != GRUB_MODULE_MAGIC) -- return 0; -+ if (section->name[0] != '.' && info->magic != GRUB_MODULE_MAGIC) -+ { -+ grub_dprintf("sections", -+ "section %d has bad magic %08x, should be %08x\n", -+ i, info->magic, GRUB_MODULE_MAGIC); -+ return 0; -+ } - -+ grub_dprintf("sections", "returning section info for section %d: \"%s\"\n", -+ i, section->name); - return (grub_addr_t) info; - } - diff --git a/0097-Add-linux-and-initrd-commands-for-grub-emu.patch b/0073-Add-linux-and-initrd-commands-for-grub-emu.patch similarity index 96% rename from 0097-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0073-Add-linux-and-initrd-commands-for-grub-emu.patch index f956667d..dd69b130 100644 --- a/0097-Add-linux-and-initrd-commands-for-grub-emu.patch +++ b/0073-Add-linux-and-initrd-commands-for-grub-emu.patch @@ -18,10 +18,10 @@ to the kexec command line tool, to allow booting the selected menu entry. create mode 100644 grub-core/loader/emu/linux.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index ebc558019cd..528f76a8c8e 100644 +index 058c88ac3af..5354f9613d3 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1802,7 +1802,6 @@ module = { +@@ -1826,7 +1826,6 @@ module = { common = loader/linux.c; common = lib/cmdline.c; @@ -52,7 +52,7 @@ index 55ea5a11ccd..846fe9715ec 100644 case ARGP_KEY_ARG: { diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 19cd007d448..245b69cab51 100644 +index 0ff13bcaf8c..eeea092752d 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -39,6 +39,7 @@ @@ -72,7 +72,7 @@ index 19cd007d448..245b69cab51 100644 } void * -@@ -142,6 +143,9 @@ void +@@ -154,6 +155,9 @@ void __attribute__ ((noreturn)) grub_exit (int rc) { @@ -82,7 +82,7 @@ index 19cd007d448..245b69cab51 100644 exit (rc < 0 ? 1 : rc); } #endif -@@ -203,3 +207,15 @@ grub_util_load_image (const char *path, char *buf) +@@ -215,3 +219,15 @@ grub_util_load_image (const char *path, char *buf) fclose (fp); } @@ -320,10 +320,10 @@ index cfb1e2b5661..a61568e36e9 100644 char * grub_util_path_concat (size_t n, ...); diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index ce464cfd007..5ef4f79e689 100644 +index ff9c48a6490..01056954b96 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h -@@ -56,6 +56,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format ( +@@ -57,6 +57,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format ( void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2), noreturn)); @@ -334,10 +334,10 @@ index ce464cfd007..5ef4f79e689 100644 #ifdef HAVE_DEVICE_MAPPER diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index c6ba5b2d763..5ff3afd62fa 100644 +index ee88e44e97a..80e7a83edf9 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am -@@ -304,6 +304,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h +@@ -307,6 +307,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h diff --git a/0098-Add-grub2-switch-to-blscfg.patch b/0074-Add-grub2-switch-to-blscfg.patch similarity index 87% rename from 0098-Add-grub2-switch-to-blscfg.patch rename to 0074-Add-grub2-switch-to-blscfg.patch index 80c4042d..ce40e907 100644 --- a/0098-Add-grub2-switch-to-blscfg.patch +++ b/0074-Add-grub2-switch-to-blscfg.patch @@ -11,13 +11,13 @@ Signed-off-by: Jan Hlavac Makefile.util.def | 7 + util/grub-set-password.in | 2 +- util/grub-switch-to-blscfg.8 | 33 +++++ - util/grub-switch-to-blscfg.in | 314 ++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 355 insertions(+), 1 deletion(-) + util/grub-switch-to-blscfg.in | 317 ++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 358 insertions(+), 1 deletion(-) create mode 100644 util/grub-switch-to-blscfg.8 create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index a61613656d1..f55473c76aa 100644 +index cdd2f51fe4b..afc4d7b0c3e 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1364,6 +1364,13 @@ program = { @@ -87,10 +87,10 @@ index 00000000000..9a886282976 +.BR "info grub" diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in new file mode 100644 -index 00000000000..49b3985fadb +index 00000000000..a851424beb2 --- /dev/null +++ b/util/grub-switch-to-blscfg.in -@@ -0,0 +1,314 @@ +@@ -0,0 +1,317 @@ +#! /bin/sh +# +# Set a default boot entry for GRUB. @@ -283,7 +283,7 @@ index 00000000000..49b3985fadb +mkbls() { + local kernelver=$1 && shift + local datetime=$1 && shift -+ local bootprefix=$1 && shift ++ local kernelopts=$1 && shift + + local debugname="" + local debugid="" @@ -302,10 +302,9 @@ index 00000000000..49b3985fadb + cat <"${bls_target}" -+ fi ++ mkbls "${kernelver}" \ ++ "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" \ ++ "${bootprefix}" "${cmdline}" >"${bls_target}" + + if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then + bls_debug="$(echo ${bls_target} | sed -e "s/${kernelver}/${kernelver}~debug/")" + cp -aT "${bls_target}" "${bls_debug}" + title="$(grep '^title[ \t]' "${bls_debug}" | sed -e 's/^title[ \t]*//')" -+ blsid="$(grep '^id[ \t]' "${bls_debug}" | sed -e "s/\.${ARCH}/-debug.${arch}/")" ++ options="$(echo "${cmdline} ${GRUB_CMDLINE_LINUX_DEBUG}" | sed -e 's/\//\\\//g')" + sed -i -e "s/^title.*/title ${title}${GRUB_LINUX_DEBUG_TITLE_POSTFIX}/" "${bls_debug}" -+ sed -i -e "s/^id.*/${blsid}/" "${bls_debug}" -+ sed -i -e "s/^options.*/options \$kernelopts ${GRUB_CMDLINE_LINUX_DEBUG}/" "${bls_debug}" ++ sed -i -e "s/^options.*/options ${options}/" "${bls_debug}" + fi + done + @@ -359,6 +349,19 @@ index 00000000000..49b3985fadb + fi +} + ++# The grub2 EFI binary is not copied to the ESP as a part of an ostree ++# transaction. Make sure a grub2 version with BLS support is installed ++# but only do this if the blsdir is not set, to make sure that the BLS ++# parsing module will search for the BLS snippets in the default path. ++if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \ ++ ! ${grub_editenv} - list | grep -q blsdir && \ ++ mountpoint -q /boot; then ++ grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" ++ install -m 700 ${grub_binary} ${grubdir} || exit 1 ++ # Create a hidden file to indicate that grub2 now has BLS support. ++ touch /boot/grub2/.grub2-blscfg-supported ++fi ++ +GENERATE=0 +if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \ + | grep -vq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' ; then @@ -388,13 +391,13 @@ index 00000000000..49b3985fadb + + if [ -n "${mod_dir}" ]; then + for mod in blscfg increment; do -+ cp ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1 ++ install -m 700 ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1 + done + fi + + cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}" + if ! grub2-mkconfig -o "${GRUB_CONFIG_FILE}" ; then -+ cp -af "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}" ++ install -m 700 "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}" + sed -i"${backupsuffix}" \ + -e 's,^GRUB_ENABLE_BLSCFG=.*,GRUB_ENABLE_BLSCFG=false,' \ + "${etcdefaultgrub}" diff --git a/0100-make-better-backtraces.patch b/0075-make-better-backtraces.patch similarity index 96% rename from 0100-make-better-backtraces.patch rename to 0075-make-better-backtraces.patch index 56f4c4b5..a65af3db 100644 --- a/0100-make-better-backtraces.patch +++ b/0075-make-better-backtraces.patch @@ -38,10 +38,10 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index f55473c76aa..c13ca685ce1 100644 +index afc4d7b0c3e..41906486a71 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -49,6 +49,12 @@ library = { +@@ -51,6 +51,12 @@ library = { common = grub-core/partmap/msdos.c; common = grub-core/fs/proc.c; common = grub-core/fs/archelp.c; @@ -55,13 +55,13 @@ index f55473c76aa..c13ca685ce1 100644 library = { diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 528f76a8c8e..49c5dc4c3b7 100644 +index 5354f9613d3..4b7c45a7b06 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -140,6 +140,12 @@ kernel = { - common = kern/rescue_parser.c; +@@ -142,6 +142,12 @@ kernel = { common = kern/rescue_reader.c; common = kern/term.c; + common = kern/verifiers.c; + common = kern/backtrace.c; + + x86 = kern/i386/backtrace.c; @@ -71,7 +71,7 @@ index 528f76a8c8e..49c5dc4c3b7 100644 noemu = kern/compiler-rt.c; noemu = kern/mm.c; -@@ -186,9 +192,6 @@ kernel = { +@@ -188,9 +194,6 @@ kernel = { softdiv = lib/division.c; @@ -81,7 +81,7 @@ index 528f76a8c8e..49c5dc4c3b7 100644 i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; i386_xen_pvh = kern/i386/dl.c; -@@ -2376,15 +2379,12 @@ module = { +@@ -2398,15 +2401,12 @@ module = { module = { name = backtrace; @@ -331,7 +331,7 @@ index 00000000000..4a82e865cc6 + grub_backtrace (skip + 1); +} diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index d7718d26abc..2e57e5e6829 100644 +index 7afb9e6f724..88d2077709e 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name) @@ -559,11 +559,11 @@ index 0cd2a627231..937c1bc44cb 100644 #ifdef __sparc__ diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index e758ab3416d..5c2d2039d0b 100644 +index c60601b699d..a432a6be54a 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -1110,15 +1110,15 @@ grub_xasprintf (const char *fmt, ...) - } +@@ -1197,15 +1197,15 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) + /* Abort GRUB. This function does not return. */ -static void __attribute__ ((noreturn)) @@ -584,7 +584,7 @@ index e758ab3416d..5c2d2039d0b 100644 #ifndef GRUB_UTIL if (grub_term_inputs) -@@ -1145,6 +1145,7 @@ grub_fatal (const char *fmt, ...) +@@ -1232,6 +1232,7 @@ grub_fatal (const char *fmt, ...) { va_list ap; @@ -593,10 +593,10 @@ index e758ab3416d..5c2d2039d0b 100644 grub_vprintf (_(fmt), ap); va_end (ap); diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index ee88ff61187..002cbfa4f3d 100644 +index c070afc621f..d8c8377578b 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c -@@ -95,13 +95,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) +@@ -97,13 +97,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) break; if (! *r) @@ -787,10 +787,10 @@ index 395519762f0..275cf85e2d3 100644 #endif diff --git a/include/grub/dl.h b/include/grub/dl.h -index 90dc9bb1017..4fe2b524f73 100644 +index 91933b85f2c..2f76e6b0437 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h -@@ -257,6 +257,8 @@ grub_dl_is_persistent (grub_dl_t mod) +@@ -259,6 +259,8 @@ grub_dl_is_persistent (grub_dl_t mod) #endif @@ -800,10 +800,10 @@ index 90dc9bb1017..4fe2b524f73 100644 int isfunc, grub_dl_t mod); diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index 133a37c8d03..e5a5f436709 100644 +index abbca5ea335..300a9766cda 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h -@@ -110,6 +110,9 @@ grub_addr_t grub_modules_get_end (void); +@@ -111,6 +111,9 @@ grub_addr_t grub_modules_get_end (void); #endif @@ -897,7 +897,7 @@ index 03b916f0534..701bf63abcf 100644 ba codestart mov %o4, %o0 diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 5ff3afd62fa..d9ad30052f1 100644 +index 80e7a83edf9..f512573c0da 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h diff --git a/0101-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0076-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 89% rename from 0101-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0076-normal-don-t-draw-our-startup-message-if-debug-is-se.patch index 67776367..9922f2bb 100644 --- a/0101-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +++ b/0076-normal-don-t-draw-our-startup-message-if-debug-is-se.patch @@ -8,10 +8,10 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set 1 file changed, 3 insertions(+) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 2fe6743399d..f7ee912e715 100644 +index d5968797f4f..e349303c29b 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -425,6 +425,9 @@ grub_normal_reader_init (int nested) +@@ -432,6 +432,9 @@ grub_normal_reader_init (int nested) const char *msg_esc = _("ESC at any time exits."); char *msg_formatted; diff --git a/0102-Work-around-some-minor-include-path-weirdnesses.patch b/0077-Work-around-some-minor-include-path-weirdnesses.patch similarity index 100% rename from 0102-Work-around-some-minor-include-path-weirdnesses.patch rename to 0077-Work-around-some-minor-include-path-weirdnesses.patch diff --git a/0103-Make-it-possible-to-enabled-build-id-sha1.patch b/0078-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 93% rename from 0103-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0078-Make-it-possible-to-enabled-build-id-sha1.patch index d77b6f67..c1aa5167 100644 --- a/0103-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0078-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index eb851b8d722..8ee18ba159a 100644 +index 6c16968ad9c..f4cfd06cbe6 100644 --- a/configure.ac +++ b/configure.ac -@@ -1414,7 +1414,15 @@ grub_PROG_TARGET_CC +@@ -1470,7 +1470,15 @@ grub_PROG_TARGET_CC if test "x$TARGET_APPLE_LINKER" != x1 ; then grub_PROG_OBJCOPY_ABSOLUTE fi @@ -30,7 +30,7 @@ index eb851b8d722..8ee18ba159a 100644 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then if test ! -z "$TARGET_IMG_LDSCRIPT"; then diff --git a/acinclude.m4 b/acinclude.m4 -index 78cdf6e1d01..242e829ff23 100644 +index 6e14bb553c6..21238fcfd03 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then diff --git a/0104-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0079-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 89% rename from 0104-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0079-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch index b434d4c5..a8a757e5 100644 --- a/0104-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +++ b/0079-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch @@ -13,10 +13,10 @@ Signed-off-by: Peter Jones 2 files changed, 20 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 5c2d2039d0b..0e89c483d5e 100644 +index a432a6be54a..9a2fae6398e 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -190,6 +190,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, +@@ -191,6 +191,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, } } @@ -42,10 +42,10 @@ index 5c2d2039d0b..0e89c483d5e 100644 int diff --git a/include/grub/misc.h b/include/grub/misc.h -index 4a4f485a5f6..960097fbd06 100644 +index fd18e6320b8..3adc4036e3b 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h -@@ -372,6 +372,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, +@@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, const int line, const char *condition, const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5))); diff --git a/0105-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 90% rename from 0105-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch index 09cc7c6d..75de764a 100644 --- a/0105-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +++ b/0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -20,7 +20,7 @@ Signed-off-by: Peter Jones 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 2e57e5e6829..6a5e7706143 100644 +index 88d2077709e..9557254035e 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -501,6 +501,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) @@ -47,7 +47,7 @@ index 2e57e5e6829..6a5e7706143 100644 /* Me, Vladimir Serbinenko, hereby I add this module check as per new GNU module policy. Note that this license check is informative only. -@@ -644,6 +661,37 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) +@@ -653,6 +670,37 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) return GRUB_ERR_NONE; } @@ -85,7 +85,7 @@ index 2e57e5e6829..6a5e7706143 100644 /* Load a module from core memory. */ grub_dl_t -@@ -703,6 +751,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) +@@ -712,6 +760,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) grub_dprintf ("modules", "module name: %s\n", mod->name); grub_dprintf ("modules", "init function: %p\n", mod->init); @@ -95,10 +95,10 @@ index 2e57e5e6829..6a5e7706143 100644 { grub_dl_unload (mod); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 2cf6a5ad526..19054b1465f 100644 +index ae9885edb84..d6a2fb57789 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -283,7 +283,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, +@@ -296,7 +296,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, /* Search the mods section from the PE32/PE32+ image. This code uses a PE32 header, but should work with PE32+ as well. */ grub_addr_t @@ -107,7 +107,7 @@ index 2cf6a5ad526..19054b1465f 100644 { grub_efi_loaded_image_t *image; struct grub_pe32_header *header; -@@ -308,7 +308,7 @@ grub_efi_modules_addr (void) +@@ -321,7 +321,7 @@ grub_efi_modules_addr (void) i < coff_header->num_sections; i++, section++) { @@ -117,10 +117,10 @@ index 2cf6a5ad526..19054b1465f 100644 } diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 71d2279a0c1..e6183a4c44d 100644 +index 6d39bd3ad29..2d12e6188fd 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c -@@ -59,10 +59,33 @@ grub_efi_env_init (void) +@@ -115,10 +115,33 @@ grub_efi_env_init (void) grub_free (envblk_s.buf); } @@ -155,7 +155,7 @@ index 71d2279a0c1..e6183a4c44d 100644 /* First of all, initialize the console so that GRUB can display messages. */ grub_console_init (); -@@ -74,6 +97,7 @@ grub_efi_init (void) +@@ -142,6 +165,7 @@ grub_efi_init (void) 0, 0, 0, NULL); grub_efi_env_init (); @@ -164,10 +164,10 @@ index 71d2279a0c1..e6183a4c44d 100644 } diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 5e2b479daec..8ca3981d7a1 100644 +index 03f9a9d0118..2e0691454b1 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -132,7 +132,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); +@@ -138,7 +138,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args); #endif diff --git a/0106-Fixup-for-newer-compiler.patch b/0081-Fixup-for-newer-compiler.patch similarity index 92% rename from 0106-Fixup-for-newer-compiler.patch rename to 0081-Fixup-for-newer-compiler.patch index ae5ac893..12dd193e 100644 --- a/0106-Fixup-for-newer-compiler.patch +++ b/0081-Fixup-for-newer-compiler.patch @@ -9,10 +9,10 @@ Subject: [PATCH] Fixup for newer compiler 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index ba99d04f8ed..9cd7f4bdf65 100644 +index 2b21cbaa67e..4cc86e9b79e 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -215,7 +215,7 @@ struct grub_btrfs_inode +@@ -218,7 +218,7 @@ struct grub_btrfs_inode grub_uint64_t size; grub_uint8_t dummy2[0x70]; struct grub_btrfs_time mtime; diff --git a/0107-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0082-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 94% rename from 0107-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0082-Don-t-attempt-to-export-the-start-and-_start-symbols.patch index f6c1185f..0e925eef 100644 --- a/0107-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +++ b/0082-Don-t-attempt-to-export-the-start-and-_start-symbols.patch @@ -26,10 +26,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+) diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index e5a5f436709..de48cd44ccb 100644 +index 300a9766cda..55849777eaa 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h -@@ -110,8 +110,10 @@ grub_addr_t grub_modules_get_end (void); +@@ -111,8 +111,10 @@ grub_addr_t grub_modules_get_end (void); #endif diff --git a/0108-Fixup-for-newer-compiler.patch b/0083-Fixup-for-newer-compiler.patch similarity index 96% rename from 0108-Fixup-for-newer-compiler.patch rename to 0083-Fixup-for-newer-compiler.patch index e35dbdb7..11ed6e52 100644 --- a/0108-Fixup-for-newer-compiler.patch +++ b/0083-Fixup-for-newer-compiler.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Fixup for newer compiler 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 4ba729e14d8..5e8ba2ae3b0 100644 +index 191b1a70c6b..5f0ef969857 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding diff --git a/0109-Add-support-for-non-Ethernet-network-cards.patch b/0084-Add-support-for-non-Ethernet-network-cards.patch similarity index 97% rename from 0109-Add-support-for-non-Ethernet-network-cards.patch rename to 0084-Add-support-for-non-Ethernet-network-cards.patch index dc89c990..62f2a11c 100644 --- a/0109-Add-support-for-non-Ethernet-network-cards.patch +++ b/0084-Add-support-for-non-Ethernet-network-cards.patch @@ -271,10 +271,10 @@ index 54306e3b16d..67b409a8acc 100644 /* Change operation to REPLY and send packet */ send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 8c969595a7b..3cf6dbf0e72 100644 +index 8d9edaac447..dd5c8d04da9 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c -@@ -269,7 +269,6 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -233,7 +233,6 @@ grub_net_configure_by_dhcp_ack (const char *name, int is_def, char **device, char **path) { grub_net_network_level_address_t addr; @@ -282,7 +282,7 @@ index 8c969595a7b..3cf6dbf0e72 100644 struct grub_net_network_level_interface *inter; int mask = -1; char server_ip[sizeof ("xxx.xxx.xxx.xxx")]; -@@ -286,12 +285,8 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -250,12 +249,8 @@ grub_net_configure_by_dhcp_ack (const char *name, if (path) *path = 0; @@ -297,7 +297,7 @@ index 8c969595a7b..3cf6dbf0e72 100644 if (!inter) return 0; -@@ -601,7 +596,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) +@@ -567,7 +562,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) grub_memset (pack, 0, sizeof (*pack)); pack->opcode = 1; pack->hw_type = 1; @@ -308,7 +308,7 @@ index 8c969595a7b..3cf6dbf0e72 100644 err = grub_get_datetime (&date); if (err || !grub_datetime2unixtime (&date, &t)) { -@@ -614,7 +611,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) +@@ -580,7 +577,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) else pack->ident = iface->xid; @@ -318,10 +318,10 @@ index 8c969595a7b..3cf6dbf0e72 100644 grub_netbuff_push (nb, sizeof (*udph)); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index a57189e8bb3..4444e8e60ee 100644 +index 173fb63153c..a673bea807a 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -280,6 +280,9 @@ grub_efinet_findcards (void) +@@ -279,6 +279,9 @@ grub_efinet_findcards (void) /* This should not happen... Why? */ continue; @@ -331,7 +331,7 @@ index a57189e8bb3..4444e8e60ee 100644 if (net->mode->state == GRUB_EFI_NETWORK_STOPPED && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS) continue; -@@ -316,10 +319,11 @@ grub_efinet_findcards (void) +@@ -315,10 +318,11 @@ grub_efinet_findcards (void) card->name = grub_xasprintf ("efinet%d", i++); card->driver = &efidriver; card->flags = 0; @@ -627,10 +627,10 @@ index ea5edf8f1f6..a5896f6dc26 100644 grub_net_process_dhcp (nb, inf); grub_netbuff_free (nb); diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 5366e443d2a..6468eb24596 100644 +index 22f2689aaeb..a46f82362ed 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c -@@ -128,8 +128,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, +@@ -133,8 +133,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, << 48) && proto_addr->ipv6[1] == (grub_be_to_cpu64_compile_time (1)))) { @@ -642,7 +642,7 @@ index 5366e443d2a..6468eb24596 100644 return GRUB_ERR_NONE; } -@@ -137,6 +138,7 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, +@@ -142,6 +143,7 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, && ((grub_be_to_cpu64 (proto_addr->ipv6[0]) >> 56) == 0xff)) { hw_addr->type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; @@ -650,7 +650,7 @@ index 5366e443d2a..6468eb24596 100644 hw_addr->mac[0] = 0x33; hw_addr->mac[1] = 0x33; hw_addr->mac[2] = ((grub_be_to_cpu64 (proto_addr->ipv6[1]) >> 24) & 0xff); -@@ -757,23 +759,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf) +@@ -762,23 +764,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf) void grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str) { @@ -689,7 +689,7 @@ index 5366e443d2a..6468eb24596 100644 } int -@@ -784,13 +786,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a, +@@ -789,13 +791,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a, return -1; if (a->type > b->type) return +1; @@ -713,7 +713,7 @@ index 5366e443d2a..6468eb24596 100644 int diff --git a/include/grub/net.h b/include/grub/net.h -index 3647012374b..fc1fc44baef 100644 +index 8a05ec4fe7a..af0404db7e3 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -29,7 +29,8 @@ diff --git a/0085-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch b/0085-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch deleted file mode 100644 index a53ecb40..00000000 --- a/0085-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 26 Jun 2017 12:42:57 -0400 -Subject: [PATCH] Don't use dynamic sized arrays since we don't build with - -std=c99 - ---- - grub-core/net/net.c | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index f24f1fd63f6..5366e443d2a 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -1853,14 +1853,25 @@ grub_net_search_configfile (char *config) - { - /* By the Client UUID. */ - -- char client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) + -- sizeof ("_clientuuid") + 1]; -- grub_snprintf (client_uuid_var, sizeof (client_uuid_var), -+ char *client_uuid_var; -+ grub_size_t client_uuid_var_size; -+ -+ client_uuid_var_size = grub_snprintf (NULL, 0, -+ "net_%s_clientuuid", inf->name); -+ if (client_uuid_var_size <= 0) -+ continue; -+ client_uuid_var_size += 1; -+ client_uuid_var = grub_malloc(client_uuid_var_size); -+ if (!client_uuid_var) -+ continue; -+ grub_snprintf (client_uuid_var, client_uuid_var_size, - "net_%s_clientuuid", inf->name); - - const char *client_uuid; - client_uuid = grub_env_get (client_uuid_var); - -+ grub_free(client_uuid_var); -+ - if (client_uuid) - { - grub_strcpy (suffix, client_uuid); diff --git a/0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 87% rename from 0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch index a2701b3d..834b96e2 100644 --- a/0111-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +++ b/0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch @@ -11,14 +11,14 @@ Signed-off-by: Aaron Miller [pjones: various bug fixes] Signed-off-by: Peter Jones --- - grub-core/net/http.c | 27 ++++++++++++---- + grub-core/net/http.c | 25 ++++++++++++--- grub-core/net/net.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++--- grub-core/net/tftp.c | 8 +++-- include/grub/net.h | 1 + - 4 files changed, 110 insertions(+), 13 deletions(-) + 4 files changed, 109 insertions(+), 12 deletions(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 5aa4ad3befc..00737c52750 100644 +index b616cf40b1e..12a2632ea55 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -289,7 +289,9 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)), @@ -73,26 +73,24 @@ index 5aa4ad3befc..00737c52750 100644 ptr = nb->tail; err = grub_netbuff_put (nb, sizeof ("\r\nUser-Agent: " PACKAGE_STRING "\r\n") -@@ -390,9 +403,11 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) +@@ -390,8 +403,10 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) grub_netbuff_put (nb, 2); grub_memcpy (ptr, "\r\n", 2); - data->sock = grub_net_tcp_open (file->device->net->server, - HTTP_PORT, http_receive, -- http_err, http_err, + grub_dprintf ("http", "opening path %s on host %s TCP port %d\n", + data->filename, server, port ? port : HTTP_PORT); + data->sock = grub_net_tcp_open (server, + port ? port : HTTP_PORT, http_receive, -+ http_err, NULL, + http_err, NULL, file); if (!data->sock) - { diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 6468eb24596..2734f70d22f 100644 +index a46f82362ed..0ce5e675ed7 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c -@@ -439,6 +439,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) +@@ -444,6 +444,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) grub_uint16_t newip[8]; const char *ptr = val; int word, quaddot = -1; @@ -106,7 +104,7 @@ index 6468eb24596..2734f70d22f 100644 if (ptr[0] == ':' && ptr[1] != ':') return 0; -@@ -477,6 +484,8 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) +@@ -482,6 +489,8 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0])); } grub_memcpy (ip, newip, 16); @@ -115,7 +113,7 @@ index 6468eb24596..2734f70d22f 100644 if (rest) *rest = ptr; return 1; -@@ -1338,8 +1347,10 @@ grub_net_open_real (const char *name) +@@ -1343,8 +1352,10 @@ grub_net_open_real (const char *name) { grub_net_app_level_t proto; const char *protname, *server; @@ -126,7 +124,7 @@ index 6468eb24596..2734f70d22f 100644 if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0) { -@@ -1377,6 +1388,72 @@ grub_net_open_real (const char *name) +@@ -1382,6 +1393,72 @@ grub_net_open_real (const char *name) return NULL; } @@ -199,7 +197,7 @@ index 6468eb24596..2734f70d22f 100644 for (try = 0; try < 2; try++) { FOR_NET_APP_LEVEL (proto) -@@ -1386,14 +1463,13 @@ grub_net_open_real (const char *name) +@@ -1391,14 +1468,13 @@ grub_net_open_real (const char *name) { grub_net_t ret = grub_zalloc (sizeof (*ret)); if (!ret) @@ -218,7 +216,7 @@ index 6468eb24596..2734f70d22f 100644 ret->fs = &grub_net_fs; return ret; } -@@ -1468,6 +1544,7 @@ grub_net_open_real (const char *name) +@@ -1473,6 +1549,7 @@ grub_net_open_real (const char *name) grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"), name); @@ -227,10 +225,10 @@ index 6468eb24596..2734f70d22f 100644 } diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 0c02a00255b..4920c3a9783 100644 +index 4ab2f5c7357..d54b13f09ff 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c -@@ -333,6 +333,7 @@ tftp_open (struct grub_file *file, const char *filename) +@@ -295,6 +295,7 @@ tftp_open (struct grub_file *file, const char *filename) grub_err_t err; grub_uint8_t *nbd; grub_net_network_level_address_t addr; @@ -238,7 +236,7 @@ index 0c02a00255b..4920c3a9783 100644 data = grub_zalloc (sizeof (*data)); if (!data) -@@ -405,7 +406,10 @@ tftp_open (struct grub_file *file, const char *filename) +@@ -362,14 +363,17 @@ tftp_open (struct grub_file *file, const char *filename) err = grub_net_resolve_address (file->device->net->server, &addr); if (err) { @@ -247,12 +245,11 @@ index 0c02a00255b..4920c3a9783 100644 + grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n", + (unsigned long long)data->file_size, + (unsigned long long)data->block_size); - destroy_pq (data); grub_free (data); return err; -@@ -413,7 +417,7 @@ tftp_open (struct grub_file *file, const char *filename) + } - grub_dprintf ("tftp", "opening connection\n"); + grub_dprintf("tftp", "opening connection\n"); data->sock = grub_net_udp_open (addr, - TFTP_SERVER_PORT, tftp_receive, + port ? port : TFTP_SERVER_PORT, tftp_receive, @@ -260,7 +257,7 @@ index 0c02a00255b..4920c3a9783 100644 if (!data->sock) { diff --git a/include/grub/net.h b/include/grub/net.h -index fc1fc44baef..fa7a8c39704 100644 +index af0404db7e3..d55d505a03a 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -273,6 +273,7 @@ typedef struct grub_net diff --git a/0112-bootp-New-net_bootp6-command.patch b/0086-bootp-New-net_bootp6-command.patch similarity index 98% rename from 0112-bootp-New-net_bootp6-command.patch rename to 0086-bootp-New-net_bootp6-command.patch index 8cb4ed82..b5f78f8d 100644 --- a/0112-bootp-New-net_bootp6-command.patch +++ b/0086-bootp-New-net_bootp6-command.patch @@ -19,12 +19,12 @@ Signed-off-by: Peter Jones 5 files changed, 1002 insertions(+), 209 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 3cf6dbf0e72..85adc9cb447 100644 +index dd5c8d04da9..68c4df681b5 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c -@@ -25,6 +25,98 @@ +@@ -24,6 +24,98 @@ + #include #include - #include #include +#include +#include @@ -121,7 +121,7 @@ index 3cf6dbf0e72..85adc9cb447 100644 struct grub_dhcp_discover_options { -@@ -638,6 +730,584 @@ out: +@@ -604,6 +696,584 @@ out: return err; } @@ -706,7 +706,7 @@ index 3cf6dbf0e72..85adc9cb447 100644 /* * This is called directly from net/ip.c:handle_dgram(), because those * BOOTP/DHCP packets are a bit special due to their improper -@@ -706,6 +1376,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb, +@@ -672,6 +1342,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb, } } @@ -784,7 +784,7 @@ index 3cf6dbf0e72..85adc9cb447 100644 static grub_err_t grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), int argc, char **args) -@@ -931,180 +1672,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), +@@ -897,180 +1638,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), return err; } @@ -1119,7 +1119,7 @@ index 3cf6dbf0e72..85adc9cb447 100644 void grub_bootp_init (void) -@@ -1118,11 +1853,15 @@ grub_bootp_init (void) +@@ -1084,11 +1819,15 @@ grub_bootp_init (void) cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt, N_("VAR INTERFACE NUMBER DESCRIPTION"), N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value.")); @@ -1136,10 +1136,10 @@ index 3cf6dbf0e72..85adc9cb447 100644 grub_unregister_command (cmd_bootp); grub_unregister_command (cmd_dhcp); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 4444e8e60ee..00d7d37b8de 100644 +index a673bea807a..8e25680db0c 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -394,9 +394,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -393,9 +393,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, pxe_mode = pxe->mode; if (pxe_mode->using_ipv6) { @@ -1149,7 +1149,7 @@ index 4444e8e60ee..00d7d37b8de 100644 grub_dprintf ("efinet", "using ipv6 and dhcpv6\n"); grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n", pxe_mode->dhcp_ack_received ? "yes" : "no", -@@ -404,15 +401,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -403,15 +400,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, if (!pxe_mode->dhcp_ack_received) continue; @@ -1224,10 +1224,10 @@ index a5896f6dc26..ce6bdc75c6d 100644 { const struct grub_net_bootp_packet *bootp; diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 955973ed484..71d972a3d89 100644 +index 99628801478..7614b58dca8 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -1507,7 +1507,7 @@ typedef struct grub_efi_pxe_ip_filter +@@ -1532,7 +1532,7 @@ typedef struct grub_efi_pxe_ip_filter { grub_efi_uint8_t filters; grub_efi_uint8_t ip_count; @@ -1237,7 +1237,7 @@ index 955973ed484..71d972a3d89 100644 } grub_efi_pxe_ip_filter_t; diff --git a/include/grub/net.h b/include/grub/net.h -index fa7a8c39704..aedf4b59cfe 100644 +index d55d505a03a..543251f7273 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -451,50 +451,65 @@ struct grub_net_bootp_packet diff --git a/0086-don-t-ignore-const.patch b/0086-don-t-ignore-const.patch deleted file mode 100644 index 81a20250..00000000 --- a/0086-don-t-ignore-const.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 26 Jun 2017 12:43:22 -0400 -Subject: [PATCH] don't ignore const - ---- - grub-core/net/tftp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index e6d831f1bc9..0c02a00255b 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -307,7 +307,7 @@ static void - grub_normalize_filename (char *normalized, const char *filename) - { - char *dest = normalized; -- char *src = filename; -+ const char *src = filename; - - while (*src != '\0') - { diff --git a/0113-efinet-UEFI-IPv6-PXE-support.patch b/0087-efinet-UEFI-IPv6-PXE-support.patch similarity index 92% rename from 0113-efinet-UEFI-IPv6-PXE-support.patch rename to 0087-efinet-UEFI-IPv6-PXE-support.patch index 50d680ab..d8b22b8c 100644 --- a/0113-efinet-UEFI-IPv6-PXE-support.patch +++ b/0087-efinet-UEFI-IPv6-PXE-support.patch @@ -15,10 +15,10 @@ Signed-off-by: Ken Lin 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 00d7d37b8de..c3db3285b97 100644 +index 8e25680db0c..014e5bf9802 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -410,6 +410,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, grub_print_error (); if (device && path) grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); @@ -28,10 +28,10 @@ index 00d7d37b8de..c3db3285b97 100644 else { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 71d972a3d89..186cf398840 100644 +index 7614b58dca8..91ab528e4d0 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -1499,31 +1499,6 @@ typedef union +@@ -1524,31 +1524,6 @@ typedef union grub_efi_pxe_dhcpv6_packet_t dhcpv6; } grub_efi_pxe_packet_t; @@ -63,7 +63,7 @@ index 71d972a3d89..186cf398840 100644 typedef struct grub_efi_pxe_icmp_error { grub_efi_uint8_t type; -@@ -1549,6 +1524,48 @@ typedef struct grub_efi_pxe_tftp_error +@@ -1574,6 +1549,48 @@ typedef struct grub_efi_pxe_tftp_error grub_efi_char8_t error_string[127]; } grub_efi_pxe_tftp_error_t; @@ -112,7 +112,7 @@ index 71d972a3d89..186cf398840 100644 typedef struct grub_efi_pxe_mode { grub_efi_boolean_t started; -@@ -1580,9 +1597,9 @@ typedef struct grub_efi_pxe_mode +@@ -1605,9 +1622,9 @@ typedef struct grub_efi_pxe_mode grub_efi_pxe_packet_t pxe_bis_reply; grub_efi_pxe_ip_filter_t ip_filter; grub_efi_uint32_t arp_cache_entries; diff --git a/0114-grub.texi-Add-net_bootp6-doument.patch b/0088-grub.texi-Add-net_bootp6-doument.patch similarity index 80% rename from 0114-grub.texi-Add-net_bootp6-doument.patch rename to 0088-grub.texi-Add-net_bootp6-doument.patch index fdca976e..d7fd91a0 100644 --- a/0114-grub.texi-Add-net_bootp6-doument.patch +++ b/0088-grub.texi-Add-net_bootp6-doument.patch @@ -12,18 +12,18 @@ Signed-off-by: Ken Lin 1 file changed, 17 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 960e5f3ba41..495462b8e48 100644 +index aa3a7de9d4f..67bf8523ccb 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5338,6 +5338,7 @@ This command is only available on AArch64 systems. +@@ -5484,6 +5484,7 @@ This command is only available on AArch64 systems. * net_add_dns:: Add a DNS server * net_add_route:: Add routing entry - * net_bootp:: Perform a bootp autoconfiguration + * net_bootp:: Perform a bootp/DHCP autoconfiguration +* net_bootp6:: Perform a DHCPv6 autoconfiguration * net_del_addr:: Remove IP address from interface * net_del_dns:: Remove a DNS server * net_del_route:: Remove a route entry -@@ -5419,6 +5420,22 @@ Sets environment variable @samp{net_}@var{}@samp{_dhcp_extensionspath} +@@ -5608,6 +5609,22 @@ Sets environment variable @samp{net_}@var{}@samp{_boot_file} @end deffn @@ -44,5 +44,5 @@ index 960e5f3ba41..495462b8e48 100644 + +@end deffn - @node net_del_addr - @subsection net_del_addr + @node net_get_dhcp_option + @subsection net_get_dhcp_option diff --git a/0115-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 88% rename from 0115-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch index 301e781e..171bf823 100644 --- a/0115-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +++ b/0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch @@ -22,7 +22,7 @@ Signed-off-by: Ken Lin 2 files changed, 56 insertions(+) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 85adc9cb447..2e46842e829 100644 +index 68c4df681b5..0b430489329 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -20,6 +20,7 @@ @@ -33,7 +33,7 @@ index 85adc9cb447..2e46842e829 100644 #include #include #include -@@ -567,6 +568,60 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -500,6 +501,60 @@ grub_net_configure_by_dhcp_ack (const char *name, if (opt && opt_len) grub_env_set_net_property (name, "rootpath", (const char *) opt, opt_len); @@ -95,14 +95,14 @@ index 85adc9cb447..2e46842e829 100644 if (opt && opt_len) grub_env_set_net_property (name, "extensionspath", (const char *) opt, opt_len); diff --git a/include/grub/net.h b/include/grub/net.h -index aedf4b59cfe..ebb569bd86e 100644 +index 543251f7273..42af7de250a 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -526,6 +526,7 @@ enum - GRUB_NET_BOOTP_DOMAIN = 0x0f, - GRUB_NET_BOOTP_ROOT_PATH = 0x11, - GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, -+ GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 0x3C, - GRUB_NET_BOOTP_CLIENT_ID = 0x3d, - GRUB_NET_BOOTP_CLIENT_UUID = 0x61, - GRUB_NET_DHCP_REQUESTED_IP_ADDRESS = 50, +@@ -531,6 +531,7 @@ enum + GRUB_NET_DHCP_MESSAGE_TYPE = 53, + GRUB_NET_DHCP_SERVER_IDENTIFIER = 54, + GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55, ++ GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 60, + GRUB_NET_BOOTP_CLIENT_ID = 61, + GRUB_NET_DHCP_TFTP_SERVER_NAME = 66, + GRUB_NET_DHCP_BOOTFILE_NAME = 67, diff --git a/0089-editenv-handle-relative-symlinks.patch b/0089-editenv-handle-relative-symlinks.patch deleted file mode 100644 index 06adca7f..00000000 --- a/0089-editenv-handle-relative-symlinks.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonathan Lebon -Date: Mon, 14 Aug 2017 14:37:20 -0400 -Subject: [PATCH] editenv: handle relative symlinks - -Handle symlinks with targets relative to the containing dir. This -ensures that the rename operation does not depend on the cwd. - -Resolves: rhbz#1479960 - -Signed-off-by: Jonathan Lebon ---- - util/editenv.c | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git a/util/editenv.c b/util/editenv.c -index e61dc1283a4..1f7f6f3ae18 100644 ---- a/util/editenv.c -+++ b/util/editenv.c -@@ -28,6 +28,7 @@ - - #include - #include -+#include - - #define DEFAULT_ENVBLK_SIZE 1024 - -@@ -88,9 +89,20 @@ grub_util_create_envblk_file (const char *name) - continue; - } - -- free (rename_target); - linkbuf[retsize] = '\0'; -- rename_target = linkbuf; -+ if (linkbuf[0] == '/') -+ { -+ free (rename_target); -+ rename_target = linkbuf; -+ } -+ else -+ { -+ char *dbuf = xstrdup (rename_target); -+ const char *dir = dirname (dbuf); -+ free (rename_target); -+ rename_target = xasprintf("%s/%s", dir, linkbuf); -+ free (dbuf); -+ } - } - - int rc = grub_util_rename (namenew, rename_target); diff --git a/0090-Make-libgrub.pp-depend-on-config-util.h.patch b/0090-Make-libgrub.pp-depend-on-config-util.h.patch deleted file mode 100644 index 9a7d85f4..00000000 --- a/0090-Make-libgrub.pp-depend-on-config-util.h.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 23 Aug 2017 10:37:27 -0400 -Subject: [PATCH] Make libgrub.pp depend on config-util.h - -If you build with "make -j48" a lot, sometimes you see: - -gcc -E -DHAVE_CONFIG_H -I. -I.. -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub_script.tab.h\" -I. -I.. -I. -I.. -I../include -I./include -I../grub-core/lib/libgcrypt-grub/src/ -I../grub-core/lib/minilzo -I../grub-core/lib/xzembed -DMINILZO_HAVE_CONFIG_H -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub_script.tab.h\" -I. -I.. -I. -I.. -I../include -I./include -I../grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib -I../grub-core/gnulib -I/builddir/build/BUILD/grub-2.02/grub-aarch64-efi-2.02 -D_FILE_OFFSET_BITS=64 \ - -D'GRUB_MOD_INIT(x)=@MARKER@x@' grub_script.tab.h grub_script.yy.h ../grub-core/commands/blocklist.c ../grub-core/commands/macbless.c ../grub-core/commands/xnu_uuid.c ../grub-core/commands/testload.c ../grub-core/commands/ls.c ../grub-core/disk/dmraid_nvidia.c ../grub-core/disk/loopback.c ../grub-core/disk/lvm.c ../grub-core/disk/mdraid_linux.c ../grub-core/disk/mdraid_linux_be.c ../grub-core/disk/mdraid1x_linux.c ../grub-core/disk/raid5_recover.c ../grub-core/disk/raid6_recover.c ../grub-core/font/font.c ../grub-core/gfxmenu/font.c ../grub-core/normal/charset.c ../grub-core/video/fb/fbblit.c ../grub-core/video/fb/fbutil.c ../grub-core/video/fb/fbfill.c ../grub-core/video/fb/video_fb.c ../grub-core/video/video.c ../grub-core/video/capture.c ../grub-core/video/colors.c ../grub-core/unidata.c ../grub-core/io/bufio.c ../grub-core/fs/affs.c ../grub-core/fs/afs.c ../grub-core/fs/bfs.c ../grub-core/fs/btrfs.c ../grub-core/fs/cbfs.c ../grub-core/fs/cpio.c ../grub-core/fs/cpio_be.c ../grub-core/fs/odc.c ../grub-core/fs/newc.c ../grub-core/fs/ext2.c ../grub-core/fs/fat.c ../grub-core/fs/exfat.c ../grub-core/fs/fshelp.c ../grub-core/fs/hfs.c ../grub-core/fs/hfsplus.c ../grub-core/fs/hfspluscomp.c ../grub-core/fs/iso9660.c ../grub-core/fs/jfs.c ../grub-core/fs/minix.c ../grub-core/fs/minix2.c ../grub-core/fs/minix3.c ../grub-core/fs/minix_be.c ../grub-core/fs/minix2_be.c ../grub-core/fs/minix3_be.c ../grub-core/fs/nilfs2.c ../grub-core/fs/ntfs.c ../grub-core/fs/ntfscomp.c ../grub-core/fs/reiserfs.c ../grub-core/fs/romfs.c ../grub-core/fs/sfs.c ../grub-core/fs/squash4.c ../grub-core/fs/tar.c ../grub-core/fs/udf.c ../grub-core/fs/ufs2.c ../grub-core/fs/ufs.c ../grub-core/fs/ufs_be.c ../grub-core/fs/xfs.c ../grub-core/fs/zfs/zfscrypt.c ../grub-core/fs/zfs/zfs.c ../grub-core/fs/zfs/zfsinfo.c ../grub-core/fs/zfs/zfs_lzjb.c ../grub-core/fs/zfs/zfs_lz4.c ../grub-core/fs/zfs/zfs_sha256.c ../grub-core/fs/zfs/zfs_fletcher.c ../grub-core/lib/envblk.c ../grub-core/lib/hexdump.c ../grub-core/lib/LzFind.c ../grub-core/lib/LzmaEnc.c ../grub-core/lib/crc.c ../grub-core/lib/adler32.c ../grub-core/lib/crc64.c ../grub-core/normal/datetime.c ../grub-core/normal/misc.c ../grub-core/partmap/acorn.c ../grub-core/partmap/amiga.c ../grub-core/partmap/apple.c ../grub-core/partmap/sun.c ../grub-core/partmap/plan.c ../grub-core/partmap/dvh.c ../grub-core/partmap/sunpc.c ../grub-core/partmap/bsdlabel.c ../grub-core/partmap/dfly.c ../grub-core/script/function.c ../grub-core/script/lexer.c ../grub-core/script/main.c ../grub-core/script/script.c ../grub-core/script/argv.c ../grub-core/io/gzio.c ../grub-core/io/xzio.c ../grub-core/io/lzopio.c ../grub-core/kern/ia64/dl_helper.c ../grub-core/kern/arm/dl_helper.c ../grub-core/kern/arm64/dl_helper.c ../grub-core/lib/minilzo/minilzo.c ../grub-core/lib/xzembed/xz_dec_bcj.c ../grub-core/lib/xzembed/xz_dec_lzma2.c ../grub-core/lib/xzembed/xz_dec_stream.c ../util/misc.c ../grub-core/kern/command.c ../grub-core/kern/device.c ../grub-core/kern/disk.c ../grub-core/lib/disk.c ../util/getroot.c ../grub-core/osdep/unix/getroot.c ../grub-core/osdep/getroot.c ../grub-core/osdep/devmapper/getroot.c ../grub-core/osdep/relpath.c ../grub-core/kern/emu/hostdisk.c ../grub-core/osdep/devmapper/hostdisk.c ../grub-core/osdep/hostdisk.c ../grub-core/osdep/unix/hostdisk.c ../grub-core/osdep/exec.c ../grub-core/osdep/sleep.c ../grub-core/osdep/password.c ../grub-core/kern/emu/misc.c ../grub-core/kern/emu/mm.c ../grub-core/kern/env.c ../grub-core/kern/err.c ../grub-core/kern/file.c ../grub-core/kern/fs.c ../grub-core/kern/list.c ../grub-core/kern/misc.c ../grub-core/kern/partition.c ../grub-core/lib/crypto.c ../grub-core/disk/luks.c ../grub-core/disk/geli.c ../grub-core/disk/cryptodisk.c ../grub-core/disk/AFSplitter.c ../grub-core/lib/pbkdf2.c ../grub-core/commands/extcmd.c ../grub-core/lib/arg.c ../grub-core/disk/ldm.c ../grub-core/disk/diskfilter.c ../grub-core/partmap/gpt.c ../grub-core/partmap/msdos.c ../grub-core/fs/proc.c ../grub-core/fs/archelp.c > libgrub.pp || (rm -f libgrub.pp; exit 1) -rm -f stamp-h1 -touch ../config-util.h.in -cd . && /bin/sh ./config.status config-util.h -config.status: creating config-util.h -In file included from ../include/grub/mm.h:25:0, - from ../include/grub/disk.h:29, - from ../include/grub/file.h:26, - from ../grub-core/fs/btrfs.c:21: -./config.h:38:10: fatal error: ./config-util.h: No such file or directory - #include - ^~~~~~~~~~~~~~~ -compilation terminated. -make: *** [Makefile:13098: libgrub.pp] Error 1 - -This is because libgrub.pp is built with -DGRUB_UTIL=1, which means -it'll try to include config-util.h, but a parallel make is actually -building that file. I think. - -Signed-off-by: Peter Jones ---- - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index 1f4bb9b8c5a..bf9c1ba64c9 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -37,7 +37,7 @@ grub_script.yy.c: grub_script.yy.h - CLEANFILES += grub_script.yy.c grub_script.yy.h - - # For libgrub.a --libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES) -+libgrub.pp: config-util.h grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) \ - -D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1) - CLEANFILES += libgrub.pp diff --git a/0116-efinet-Setting-network-from-UEFI-device-path.patch b/0090-efinet-Setting-network-from-UEFI-device-path.patch similarity index 95% rename from 0116-efinet-Setting-network-from-UEFI-device-path.patch rename to 0090-efinet-Setting-network-from-UEFI-device-path.patch index f0172953..11b2a724 100644 --- a/0116-efinet-Setting-network-from-UEFI-device-path.patch +++ b/0090-efinet-Setting-network-from-UEFI-device-path.patch @@ -32,10 +32,10 @@ Signed-off-by: Ken Lin 2 files changed, 280 insertions(+), 15 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index c3db3285b97..2817b6f8fb9 100644 +index 014e5bf9802..8171ecaa5e4 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -27,6 +27,7 @@ +@@ -26,6 +26,7 @@ #include #include #include @@ -43,7 +43,7 @@ index c3db3285b97..2817b6f8fb9 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -332,6 +333,227 @@ grub_efinet_findcards (void) +@@ -331,6 +332,227 @@ grub_efinet_findcards (void) grub_free (handles); } @@ -271,7 +271,7 @@ index c3db3285b97..2817b6f8fb9 100644 static void grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, char **path) -@@ -347,7 +569,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -346,7 +568,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, { grub_efi_device_path_t *cdp; struct grub_efi_pxe *pxe; @@ -284,7 +284,7 @@ index c3db3285b97..2817b6f8fb9 100644 if (card->driver != &efidriver) continue; -@@ -371,11 +597,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -370,11 +596,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, */ if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE @@ -307,7 +307,7 @@ index c3db3285b97..2817b6f8fb9 100644 dup_ldp = grub_efi_find_last_device_path (dup_dp); dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -@@ -388,23 +624,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -387,23 +623,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, pxe = grub_efi_open_protocol (hnd, &pxe_io_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); @@ -356,7 +356,7 @@ index c3db3285b97..2817b6f8fb9 100644 1, device, path); if (grub_errno) grub_print_error (); -@@ -418,11 +668,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -417,11 +667,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, grub_dprintf ("efinet", "using ipv4 and dhcp\n"); grub_net_configure_by_dhcp_ack (card->name, card, 0, (struct grub_net_bootp_packet *) @@ -375,10 +375,10 @@ index c3db3285b97..2817b6f8fb9 100644 } } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 186cf398840..0d4839a41f1 100644 +index 91ab528e4d0..4a51667adb1 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -839,6 +839,8 @@ struct grub_efi_ipv4_device_path +@@ -864,6 +864,8 @@ struct grub_efi_ipv4_device_path grub_efi_uint16_t remote_port; grub_efi_uint16_t protocol; grub_efi_uint8_t static_ip_address; @@ -387,7 +387,7 @@ index 186cf398840..0d4839a41f1 100644 } GRUB_PACKED; typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t; -@@ -893,6 +895,15 @@ struct grub_efi_sata_device_path +@@ -918,6 +920,15 @@ struct grub_efi_sata_device_path } GRUB_PACKED; typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t; diff --git a/0117-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0091-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 92% rename from 0117-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0091-efinet-Setting-DNS-server-from-UEFI-protocol.patch index d79b34a6..1460c8a6 100644 --- a/0117-efinet-Setting-DNS-server-from-UEFI-protocol.patch +++ b/0091-efinet-Setting-DNS-server-from-UEFI-protocol.patch @@ -29,14 +29,14 @@ Signed-off-by: Michael Chang Signed-off-by: Ken Lin --- grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++ - include/grub/efi/api.h | 76 +++++++++++++++++ - 2 files changed, 239 insertions(+) + include/grub/efi/api.h | 75 +++++++++++++++++ + 2 files changed, 238 insertions(+) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 2817b6f8fb9..c843654b830 100644 +index 8171ecaa5e4..715a6168d77 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -34,6 +34,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); +@@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); /* GUID. */ static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID; static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; @@ -45,7 +45,7 @@ index 2817b6f8fb9..c843654b830 100644 static grub_err_t send_card_buffer (struct grub_net_card *dev, -@@ -333,6 +335,125 @@ grub_efinet_findcards (void) +@@ -332,6 +334,125 @@ grub_efinet_findcards (void) grub_free (handles); } @@ -171,7 +171,7 @@ index 2817b6f8fb9..c843654b830 100644 static struct grub_net_buff * grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6) { -@@ -391,6 +512,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -390,6 +511,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp; struct grub_net_bootp_packet *bp; grub_uint8_t *ptr; @@ -180,7 +180,7 @@ index 2817b6f8fb9..c843654b830 100644 bp = (struct grub_net_bootp_packet *) nb->tail; err = grub_netbuff_put (nb, sizeof (*bp) + 4); -@@ -452,6 +575,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -451,6 +574,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u *ptr++ = sizeof ("HTTPClient") - 1; grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1); @@ -206,7 +206,7 @@ index 2817b6f8fb9..c843654b830 100644 ptr = nb->tail; err = grub_netbuff_put (nb, 1); if (err) -@@ -484,6 +626,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -483,6 +625,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u struct grub_net_dhcp6_option *opt; struct grub_net_dhcp6_option_iana *iana; struct grub_net_dhcp6_option_iaaddr *iaaddr; @@ -215,7 +215,7 @@ index 2817b6f8fb9..c843654b830 100644 d6p = (struct grub_net_dhcp6_packet *)nb->tail; err = grub_netbuff_put (nb, sizeof(*d6p)); -@@ -547,6 +691,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -546,6 +690,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u opt->len = grub_cpu_to_be16 (uri_len); grub_memcpy (opt->data, uri_dp->uri, uri_len); @@ -242,13 +242,14 @@ index 2817b6f8fb9..c843654b830 100644 } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 0d4839a41f1..716f121728b 100644 +index 4a51667adb1..0b490195ad9 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -334,6 +334,16 @@ - { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \ - } - +@@ -352,6 +352,15 @@ + #define GRUB_EFI_RNG_PROTOCOL_GUID \ + { 0x3152bca5, 0xeade, 0x433d, \ + { 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \ ++ +#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \ + { 0x5b446ed1, 0xe30b, 0x4faa, \ + { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ @@ -257,14 +258,12 @@ index 0d4839a41f1..716f121728b 100644 +#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \ + { 0x937fe521, 0x95ae, 0x4d1a, \ + { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \ -+ } -+ + } + struct grub_efi_sal_system_table - { - grub_uint32_t signature; -@@ -1838,6 +1848,72 @@ struct grub_efi_block_io +@@ -1883,6 +1892,72 @@ struct grub_efi_rng_protocol }; - typedef struct grub_efi_block_io grub_efi_block_io_t; + typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t; +enum grub_efi_ip4_config2_data_type { + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, diff --git a/0119-Support-UEFI-networking-protocols.patch b/0092-Support-UEFI-networking-protocols.patch similarity index 99% rename from 0119-Support-UEFI-networking-protocols.patch rename to 0092-Support-UEFI-networking-protocols.patch index 3b0ff4ab..e69054fe 100644 --- a/0119-Support-UEFI-networking-protocols.patch +++ b/0092-Support-UEFI-networking-protocols.patch @@ -57,10 +57,10 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/net/efi.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 49c5dc4c3b7..48491b50683 100644 +index 4b7c45a7b06..c40170f2dd2 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2276,6 +2276,12 @@ module = { +@@ -2299,6 +2299,12 @@ module = { common = hook/datehook.c; }; @@ -73,10 +73,10 @@ index 49c5dc4c3b7..48491b50683 100644 module = { name = net; common = net/net.c; -@@ -2290,6 +2296,12 @@ module = { +@@ -2312,6 +2318,12 @@ module = { + common = net/ethernet.c; common = net/arp.c; common = net/netbuff.c; - common = net/url.c; + efi = net/efi/net.c; + efi = net/efi/http.c; + efi = net/efi/pxe.c; @@ -100,10 +100,10 @@ index a458c3aca78..1637731535e 100644 if (file->offset + res < next_buf) { diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 19054b1465f..ada3004cfba 100644 +index d6a2fb57789..2a446f5031b 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -709,7 +709,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -755,7 +755,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) { grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) dp; @@ -112,7 +112,7 @@ index 19054b1465f..ada3004cfba 100644 (unsigned) ipv4->local_ip_address[0], (unsigned) ipv4->local_ip_address[1], (unsigned) ipv4->local_ip_address[2], -@@ -722,33 +722,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -768,33 +768,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) (unsigned) ipv4->remote_port, (unsigned) ipv4->protocol, (unsigned) ipv4->static_ip_address); @@ -190,7 +190,7 @@ index 19054b1465f..ada3004cfba 100644 } break; case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE: -@@ -788,6 +815,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -834,6 +861,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) dump_vendor_path ("Messaging", (grub_efi_vendor_device_path_t *) dp); break; @@ -231,10 +231,10 @@ index 19054b1465f..ada3004cfba 100644 grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype); break; diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index c843654b830..ca8bd3c2301 100644 +index 715a6168d77..e11d759f19a 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -28,6 +28,7 @@ +@@ -27,6 +27,7 @@ #include #include #include @@ -242,7 +242,7 @@ index c843654b830..ca8bd3c2301 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -492,6 +493,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -491,6 +492,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u ldp = grub_efi_find_last_device_path (ddp); @@ -260,7 +260,7 @@ index c843654b830..ca8bd3c2301 100644 if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) -@@ -761,6 +773,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -760,6 +772,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE @@ -268,7 +268,7 @@ index c843654b830..ca8bd3c2301 100644 && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)) continue; dup_dp = grub_efi_duplicate_device_path (dp); -@@ -775,6 +788,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -774,6 +787,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, dup_ldp->length = sizeof (*dup_ldp); } @@ -284,7 +284,7 @@ index c843654b830..ca8bd3c2301 100644 dup_ldp = grub_efi_find_last_device_path (dup_dp); dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -@@ -846,6 +868,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -845,6 +867,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, GRUB_MOD_INIT(efinet) { @@ -294,7 +294,7 @@ index c843654b830..ca8bd3c2301 100644 grub_efinet_findcards (); grub_efi_net_config = grub_efi_net_config_real; } -@@ -857,5 +882,7 @@ GRUB_MOD_FINI(efinet) +@@ -856,5 +881,7 @@ GRUB_MOD_FINI(efinet) FOR_NET_CARDS_SAFE (card, next) if (card->driver == &efidriver) grub_net_card_unregister (card); @@ -3890,7 +3890,7 @@ index 00000000000..531949cba5c + }; + diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 2734f70d22f..27a0a1d6961 100644 +index 0ce5e675ed7..55aed92722c 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -32,6 +32,9 @@ @@ -3903,7 +3903,7 @@ index 2734f70d22f..27a0a1d6961 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -2025,8 +2028,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; +@@ -2033,8 +2036,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; static grub_command_t cmd_lsroutes, cmd_lscards; static grub_command_t cmd_lsaddr, cmd_slaac; @@ -3953,7 +3953,7 @@ index 2734f70d22f..27a0a1d6961 100644 grub_register_variable_hook ("net_default_server", defserver_get_env, defserver_set_env); grub_env_export ("net_default_server"); -@@ -2074,10 +2118,37 @@ GRUB_MOD_INIT(net) +@@ -2082,10 +2126,37 @@ GRUB_MOD_INIT(net) grub_net_restore_hw, GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK); grub_net_poll_cards_idle = grub_net_poll_cards_idle_real; @@ -3991,7 +3991,7 @@ index 2734f70d22f..27a0a1d6961 100644 grub_register_variable_hook ("net_default_server", 0, 0); grub_register_variable_hook ("pxe_default_server", 0, 0); -@@ -2096,4 +2167,7 @@ GRUB_MOD_FINI(net) +@@ -2104,4 +2175,7 @@ GRUB_MOD_FINI(net) grub_net_fini_hw (0); grub_loader_unregister_preboot_hook (fini_hnd); grub_net_poll_cards_idle = grub_net_poll_cards_idle_real; @@ -4082,10 +4082,10 @@ index 602574d52e8..1a61e05c6ec 100644 if (!grub_install_source_directory) { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 716f121728b..2ed9c26a450 100644 +index 0b490195ad9..f431f49973e 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -602,6 +602,23 @@ typedef union +@@ -622,6 +622,23 @@ typedef union typedef grub_efi_uint64_t grub_efi_physical_address_t; typedef grub_efi_uint64_t grub_efi_virtual_address_t; @@ -4109,7 +4109,7 @@ index 716f121728b..2ed9c26a450 100644 struct grub_efi_guid { -@@ -865,6 +882,8 @@ struct grub_efi_ipv6_device_path +@@ -889,6 +906,8 @@ struct grub_efi_ipv6_device_path grub_efi_uint16_t remote_port; grub_efi_uint16_t protocol; grub_efi_uint8_t static_ip_address; @@ -4118,7 +4118,7 @@ index 716f121728b..2ed9c26a450 100644 } GRUB_PACKED; typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t; -@@ -914,6 +933,15 @@ struct grub_efi_uri_device_path +@@ -938,6 +957,15 @@ struct grub_efi_uri_device_path } GRUB_PACKED; typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t; @@ -4134,7 +4134,7 @@ index 716f121728b..2ed9c26a450 100644 #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10 /* Media Device Path. */ -@@ -996,6 +1024,23 @@ struct grub_efi_bios_device_path +@@ -1020,6 +1048,23 @@ struct grub_efi_bios_device_path } GRUB_PACKED; typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t; @@ -4158,7 +4158,7 @@ index 716f121728b..2ed9c26a450 100644 struct grub_efi_open_protocol_information_entry { grub_efi_handle_t agent_handle; -@@ -1545,23 +1590,27 @@ typedef struct grub_efi_pxe_tftp_error +@@ -1569,23 +1614,27 @@ typedef struct grub_efi_pxe_tftp_error grub_efi_char8_t error_string[127]; } grub_efi_pxe_tftp_error_t; @@ -4200,7 +4200,7 @@ index 716f121728b..2ed9c26a450 100644 #define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8 typedef struct grub_efi_pxe_ip_filter -@@ -1628,17 +1677,31 @@ typedef struct grub_efi_pxe_mode +@@ -1652,17 +1701,31 @@ typedef struct grub_efi_pxe_mode typedef struct grub_efi_pxe { grub_uint64_t rev; @@ -4236,7 +4236,7 @@ index 716f121728b..2ed9c26a450 100644 void (*setpackets) (void); struct grub_efi_pxe_mode *mode; } grub_efi_pxe_t; -@@ -1880,6 +1943,44 @@ struct grub_efi_ip4_config2_protocol +@@ -1924,6 +1987,44 @@ struct grub_efi_ip4_config2_protocol }; typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t; @@ -4281,7 +4281,7 @@ index 716f121728b..2ed9c26a450 100644 enum grub_efi_ip6_config_data_type { GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID, -@@ -1914,6 +2015,49 @@ struct grub_efi_ip6_config_protocol +@@ -1958,6 +2059,49 @@ struct grub_efi_ip6_config_protocol }; typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t; diff --git a/0120-AUDIT-0-http-boot-tracker-bug.patch b/0093-AUDIT-0-http-boot-tracker-bug.patch similarity index 98% rename from 0120-AUDIT-0-http-boot-tracker-bug.patch rename to 0093-AUDIT-0-http-boot-tracker-bug.patch index 78a78e4d..ef3e67b7 100644 --- a/0120-AUDIT-0-http-boot-tracker-bug.patch +++ b/0093-AUDIT-0-http-boot-tracker-bug.patch @@ -38,7 +38,7 @@ index 86bce6535d3..4bb308026ce 100644 if (buf) { diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 00737c52750..c9c59690a98 100644 +index 12a2632ea55..b52b558d631 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0128-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0094-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 94% rename from 0128-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0094-grub-editenv-Add-incr-command-to-increment-integer-v.patch index 5da986fa..f8de42a3 100644 --- a/0128-grub-editenv-Add-incr-command-to-increment-integer-v.patch +++ b/0094-grub-editenv-Add-incr-command-to-increment-integer-v.patch @@ -17,7 +17,7 @@ Signed-off-by: Hans de Goede 1 file changed, 50 insertions(+) diff --git a/util/grub-editenv.c b/util/grub-editenv.c -index f3662c95ba6..d848038abea 100644 +index db6f187cc63..948eec8a114 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -53,6 +53,9 @@ static struct argp_option options[] = { @@ -30,7 +30,7 @@ index f3662c95ba6..d848038abea 100644 {0, 0, 0, OPTION_DOC, N_("Options:"), -1}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, -@@ -247,6 +250,51 @@ unset_variables (const char *name, int argc, char *argv[]) +@@ -253,6 +256,51 @@ unset_variables (const char *name, int argc, char *argv[]) grub_envblk_close (envblk); } @@ -82,7 +82,7 @@ index f3662c95ba6..d848038abea 100644 int main (int argc, char *argv[]) { -@@ -286,6 +334,8 @@ main (int argc, char *argv[]) +@@ -292,6 +340,8 @@ main (int argc, char *argv[]) set_variables (filename, argc - curindex, argv + curindex); else if (strcmp (command, "unset") == 0) unset_variables (filename, argc - curindex, argv + curindex); diff --git a/0095-Add-BLS-support-to-grub-mkconfig.patch b/0095-Add-BLS-support-to-grub-mkconfig.patch deleted file mode 100644 index 70277efb..00000000 --- a/0095-Add-BLS-support-to-grub-mkconfig.patch +++ /dev/null @@ -1,741 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 9 Dec 2016 15:40:29 -0500 -Subject: [PATCH] Add BLS support to grub-mkconfig - -GRUB now has BootLoaderSpec support, the user can choose to use this by -setting GRUB_ENABLE_BLSCFG to true in /etc/default/grub. On this setup, -the boot menu entries are not added to the grub.cfg, instead BLS config -files are parsed by blscfg command and the entries created dynamically. - -A 10_linux_bls grub.d snippet to generate menu entries from BLS files -is also added that can be used on platforms where the bootloader doesn't -have BLS support and only can parse a normal grub configuration file. - -Portions of the 10_linux_bls were taken from the ostree-grub-generator -script that's included in the OSTree project. - -Fixes to support multi-devices and generate a BLS section even if no -kernels are found in the boot directory were proposed by Yclept Nemo -and Tom Gundersen respectively. - -Signed-off-by: Peter Jones -Signed-off-by: Javier Martinez Canillas ---- - Makefile.util.def | 7 + - util/grub-mkconfig.8 | 4 + - util/grub-mkconfig.in | 9 +- - util/grub-mkconfig_lib.in | 20 +- - util/grub.d/10_linux.in | 67 ++++++- - util/grub.d/10_linux_bls.in | 478 ++++++++++++++++++++++++++++++++++++++++++++ - 6 files changed, 580 insertions(+), 5 deletions(-) - create mode 100644 util/grub.d/10_linux_bls.in - -diff --git a/Makefile.util.def b/Makefile.util.def -index 2215cc759c0..a61613656d1 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -499,6 +499,13 @@ script = { - condition = COND_HOST_LINUX; - }; - -+script = { -+ name = '10_linux_bls'; -+ common = util/grub.d/10_linux_bls.in; -+ installdir = grubconf; -+ condition = COND_HOST_LINUX; -+}; -+ - script = { - name = '10_xnu'; - common = util/grub.d/10_xnu.in; -diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8 -index a2d1f577b9b..434fa4deda4 100644 ---- a/util/grub-mkconfig.8 -+++ b/util/grub-mkconfig.8 -@@ -13,5 +13,9 @@ - \fB--output\fR=\fIFILE\fR - Write generated output to \fIFILE\fR. - -+.TP -+\fB--no-grubenv-update\fR -+Do not update variables in the grubenv file. -+ - .SH SEE ALSO - .BR "info grub" -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 4649e92eb0f..2601bdc0711 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@" - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" - -+export GRUB_GRUBENV_UPDATE="yes" -+ - . "${pkgdatadir}/grub-mkconfig_lib" - - # Usage: usage -@@ -59,6 +61,7 @@ usage () { - gettext "Generate a grub config file"; echo - echo - print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")" -+ print_option_help "--no-grubenv-update" "$(gettext "do not update variables in the grubenv file")" - print_option_help "-h, --help" "$(gettext "print this message and exit")" - print_option_help "-v, --version" "$(gettext "print the version information and exit")" - echo -@@ -94,6 +97,9 @@ do - --output=*) - grub_cfg=`echo "$option" | sed 's/--output=//'` - ;; -+ --no-grubenv-update) -+ GRUB_GRUBENV_UPDATE="no" -+ ;; - -*) - gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2 - usage -@@ -259,7 +265,8 @@ export GRUB_DEFAULT \ - GRUB_OS_PROBER_SKIP_LIST \ - GRUB_DISABLE_SUBMENU \ - GRUB_DEFAULT_DTB \ -- SUSE_BTRFS_SNAPSHOT_BOOTING -+ SUSE_BTRFS_SNAPSHOT_BOOTING \ -+ GRUB_ENABLE_BLSCFG - - if test "x${grub_cfg}" != "x"; then - rm -f "${grub_cfg}.new" -diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index b3aae534ddc..bc11df2bd84 100644 ---- a/util/grub-mkconfig_lib.in -+++ b/util/grub-mkconfig_lib.in -@@ -30,6 +30,9 @@ fi - if test "x$grub_file" = x; then - grub_file="${bindir}/@grub_file@" - fi -+if test "x$grub_editenv" = x; then -+ grub_editenv="${bindir}/@grub_editenv@" -+fi - if test "x$grub_mkrelpath" = x; then - grub_mkrelpath="${bindir}/@grub_mkrelpath@" - fi -@@ -125,8 +128,19 @@ EOF - fi - } - -+prepare_grub_to_access_device_with_variable () -+{ -+ device_variable="$1" -+ shift -+ prepare_grub_to_access_device "$@" -+ unset "device_variable" -+} -+ - prepare_grub_to_access_device () - { -+ if [ -z "$device_variable" ]; then -+ device_variable="root" -+ fi - old_ifs="$IFS" - IFS=' - ' -@@ -161,14 +175,14 @@ prepare_grub_to_access_device () - # otherwise set root as per value in device.map. - fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`" - if [ "x$fs_hint" != x ]; then -- echo "set root='$fs_hint'" -+ echo "set ${device_variable}='$fs_hint'" - fi - if [ "x$GRUB_DISABLE_UUID" != "xtrue" ] && fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then - hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints= - echo "if [ x\$feature_platform_search_hint = xy ]; then" -- echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}" -+ echo " search --no-floppy --fs-uuid --set=${device_variable} ${hints} ${fs_uuid}" - echo "else" -- echo " search --no-floppy --fs-uuid --set=root ${fs_uuid}" -+ echo " search --no-floppy --fs-uuid --set=${device_variable} ${fs_uuid}" - echo "fi" - fi - IFS="$old_ifs" -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 5cab299dc08..301594a0c9e 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -82,6 +82,67 @@ case x"$GRUB_FS" in - ;; - esac - -+populate_header_warn() -+{ -+cat <$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then -@@ -224,6 +286,7 @@ is_top_level=true - while [ "x$list" != "x" ] ; do - linux=`version_find_latest $list` - gettext_printf "Found linux image: %s\n" "$linux" >&2 -+ - basename=`basename $linux` - dirname=`dirname $linux` - rel_dirname=`make_system_path_relative_to_its_root $dirname` -@@ -262,7 +325,9 @@ while [ "x$list" != "x" ] ; do - for i in ${initrd}; do - initrd_display="${initrd_display} ${dirname}/${i}" - done -- gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 -+ if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then -+ gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 -+ fi - fi - - fdt= -diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in -new file mode 100644 -index 00000000000..1b7536435f1 ---- /dev/null -+++ b/util/grub.d/10_linux_bls.in -@@ -0,0 +1,478 @@ -+#! /bin/sh -+set -e -+ -+# grub-mkconfig helper script. -+# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. -+# -+# GRUB is free software: you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation, either version 3 of the License, or -+# (at your option) any later version. -+# -+# GRUB is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with GRUB. If not, see . -+ -+prefix="@prefix@" -+exec_prefix="@exec_prefix@" -+datarootdir="@datarootdir@" -+ -+. "$pkgdatadir/grub-mkconfig_lib" -+ -+export TEXTDOMAIN=@PACKAGE@ -+export TEXTDOMAINDIR="@localedir@" -+ -+CLASS="--class gnu-linux --class gnu --class os --unrestricted" -+ -+if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then -+ OS="$(eval $(grep PRETTY_NAME /etc/os-release) ; echo ${PRETTY_NAME})" -+ CLASS="--class $(eval $(grep '^ID_LIKE=\|^ID=' /etc/os-release) ; [ -n "${ID_LIKE}" ] && echo ${ID_LIKE} || echo ${ID}) ${CLASS}" -+else -+ OS="${GRUB_DISTRIBUTOR}" -+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" -+fi -+ -+# loop-AES arranges things so that /dev/loop/X can be our root device, but -+# the initrds that Linux uses don't like that. -+case ${GRUB_DEVICE} in -+ /dev/loop/*|/dev/loop[0-9]) -+ GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` -+ ;; -+esac -+ -+# Default to disabling partition uuid support to maintian compatibility with -+# older kernels. -+GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true} -+ -+# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter -+# and mounting btrfs requires user space scanning, so force UUID in this case. -+if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \ -+ || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ -+ && [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \ -+ || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -+ && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \ -+ || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then -+ LINUX_ROOT_DEVICE=${GRUB_DEVICE} -+elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \ -+ || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then -+ LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID} -+else -+ LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -+fi -+ -+case x"$GRUB_FS" in -+ xbtrfs) -+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then -+ GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}" -+ else -+ rootsubvol="`make_system_path_relative_to_its_root /`" -+ rootsubvol="${rootsubvol#/}" -+ if [ "x${rootsubvol}" != x ]; then -+ GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" -+ fi -+ fi;; -+ xzfs) -+ rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` -+ bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" -+ LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}" -+ ;; -+esac -+ -+mktitle () -+{ -+ local title_type -+ local version -+ local OS_NAME -+ local OS_VERS -+ -+ title_type=$1 && shift -+ version=$1 && shift -+ -+ OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})" -+ OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})" -+ -+ case $title_type in -+ recovery) -+ title=$(printf '%s (%s) %s (recovery mode)' \ -+ "${OS_NAME}" "${version}" "${OS_VERS}") -+ ;; -+ *) -+ title=$(printf '%s (%s) %s' \ -+ "${OS_NAME}" "${version}" "${OS_VERS}") -+ ;; -+ esac -+ echo -n ${title} -+} -+ -+title_correction_code= -+ -+populate_header_warn() -+{ -+cat <&2 -+ -+ files=($(for bls in ${blsdir}/*.conf ; do -+ if ! [[ -e "${bls}" ]] ; then -+ continue -+ fi -+ bls="${bls%.conf}" -+ bls="${bls##*/}" -+ echo "${bls}" -+ done | ${kernel_sort} | tac)) || : -+ -+ for bls in "${files[@]}" ; do -+ read_config "${blsdir}/${bls}.conf" -+ -+ menu="${menu}menuentry '${title}' --class ${grub_class} ${grub_arg} --id=${bls} {\n" -+ menu="${menu}\t linux ${linux} ${options}\n" -+ if [ -n "${initrd}" ] ; then -+ menu="${menu}\t initrd ${boot_prefix}${initrd}\n" -+ fi -+ menu="${menu}}\n\n" -+ done -+ # The printf command seems to be more reliable across shells for special character (\n, \t) evaluation -+ printf "$menu" -+} -+ -+linux_entry () -+{ -+ os="$1" -+ version="$2" -+ type="$3" -+ isdebug="$4" -+ args="$5" -+ -+ if [ -z "$boot_device_id" ]; then -+ boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" -+ fi -+ -+ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then -+ if [ x$dirname = x/ ]; then -+ if [ -z "${prepare_root_cache}" ]; then -+ prepare_grub_to_access_device ${GRUB_DEVICE} -+ fi -+ else -+ if [ -z "${prepare_boot_cache}" ]; then -+ prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} -+ fi -+ fi -+ -+ if [ -d /sys/firmware/efi ]; then -+ bootefi_device="`${grub_probe} --target=device /boot/efi/`" -+ prepare_grub_to_access_device_with_variable boot ${bootefi_device} -+ else -+ boot_device="`${grub_probe} --target=device /boot/`" -+ prepare_grub_to_access_device_with_variable boot ${boot_device} -+ fi -+ -+ populate_header_warn -+ populate_menu -+ -+ if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then -+ blsdir="/boot/loader/entries" -+ [ -d "${blsdir}" ] && GRUB_BLS_FS="$(${grub_probe} --target=fs ${blsdir})" -+ if [ "x${GRUB_BLS_FS}" = "xbtrfs" ] || [ "x${GRUB_BLS_FS}" = "xzfs" ]; then -+ blsdir=$(make_system_path_relative_to_its_root "${blsdir}") -+ if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then -+ ${grub_editenv} - set blsdir="${blsdir}" -+ fi -+ fi -+ -+ ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}" -+ if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then -+ ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" -+ fi -+ fi -+ -+ exit 0 -+ fi -+ -+ if [ x$type != xsimple ] ; then -+ title=$(mktitle "$type" "$version") -+ if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then -+ replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" -+ quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" -+ title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" -+ fi -+ if [ x$isdebug = xdebug ]; then -+ title="$title${GRUB_LINUX_DEBUG_TITLE_POSTFIX}" -+ fi -+ echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -+ else -+ echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -+ fi -+ if [ x$type != xrecovery ] ; then -+ save_default_entry | grub_add_tab -+ fi -+ -+ # Use ELILO's generic "efifb" when it's known to be available. -+ # FIXME: We need an interface to select vesafb in case efifb can't be used. -+ if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then -+ echo " load_video" | sed "s/^/$submenu_indentation/" -+ if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \ -+ && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then -+ echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/" -+ fi -+ else -+ if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then -+ echo " load_video" | sed "s/^/$submenu_indentation/" -+ fi -+ echo " set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/" -+ fi -+ -+ echo " insmod gzio" | sed "s/^/$submenu_indentation/" -+ -+ if [ x$dirname = x/ ]; then -+ if [ -z "${prepare_root_cache}" ]; then -+ prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)" -+ fi -+ printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/" -+ else -+ if [ -z "${prepare_boot_cache}" ]; then -+ prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)" -+ fi -+ printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" -+ fi -+ sed "s/^/$submenu_indentation/" << EOF -+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} -+EOF -+ if test -n "${initrd}" ; then -+ initrd_path= -+ for i in ${initrd}; do -+ initrd_path="${initrd_path} ${rel_dirname}/${i}" -+ done -+ sed "s/^/$submenu_indentation/" << EOF -+ initrd $(echo $initrd_path) -+EOF -+ fi -+ if test -n "${fdt}" ; then -+ sed "s/^/$submenu_indentation/" << EOF -+ devicetree ${rel_dirname}/${fdt} -+EOF -+ fi -+ sed "s/^/$submenu_indentation/" << EOF -+} -+EOF -+} -+ -+machine=`uname -m` -+case "x$machine" in -+ xi?86 | xx86_64) -+ list= -+ for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do -+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -+ done ;; -+ *) -+ list= -+ for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do -+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -+ done ;; -+esac -+ -+if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then -+ for i in /boot/ostree/*/vmlinuz-* ; do -+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -+ done -+fi -+ -+case "$machine" in -+ i?86) GENKERNEL_ARCH="x86" ;; -+ mips|mips64) GENKERNEL_ARCH="mips" ;; -+ mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;; -+ arm*) GENKERNEL_ARCH="arm" ;; -+ *) GENKERNEL_ARCH="$machine" ;; -+esac -+ -+prepare_boot_cache= -+prepare_root_cache= -+boot_device_id= -+title_correction_code= -+ -+# Extra indentation to add to menu entries in a submenu. We're not in a submenu -+# yet, so it's empty. In a submenu it will be equal to '\t' (one tab). -+submenu_indentation="" -+ -+is_top_level=true -+while [ "x$list" != "x" ] ; do -+ linux=`version_find_latest $list` -+ if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then -+ gettext_printf "Found linux image: %s\n" "$linux" >&2 -+ fi -+ -+ basename=`basename $linux` -+ dirname=`dirname $linux` -+ rel_dirname=`make_system_path_relative_to_its_root $dirname` -+ version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` -+ alt_version=`echo $version | sed -e "s,\.old$,,g"` -+ linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" -+ -+ initrd_early= -+ for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \ -+ ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do -+ if test -e "${dirname}/${i}" ; then -+ initrd_early="${initrd_early} ${i}" -+ fi -+ done -+ -+ initrd_real= -+ for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ -+ "initrd-${version}" "initramfs-${version}.img" \ -+ "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ -+ "initrd-${alt_version}" "initramfs-${alt_version}.img" \ -+ "initramfs-genkernel-${version}" \ -+ "initramfs-genkernel-${alt_version}" \ -+ "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ -+ "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do -+ if test -e "${dirname}/${i}" ; then -+ initrd_real="${i}" -+ break -+ fi -+ done -+ -+ initrd= -+ if test -n "${initrd_early}" || test -n "${initrd_real}"; then -+ initrd="${initrd_early} ${initrd_real}" -+ -+ initrd_display= -+ for i in ${initrd}; do -+ initrd_display="${initrd_display} ${dirname}/${i}" -+ done -+ if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then -+ gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 -+ fi -+ fi -+ -+ fdt= -+ for i in "dtb-${version}" "dtb-${alt_version}"; do -+ if test -f "${dirname}/${i}/${GRUB_DEFAULT_DTB}" ; then -+ fdt="${i}/${GRUB_DEFAULT_DTB}" -+ break -+ fi -+ done -+ -+ config= -+ for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do -+ if test -e "${i}" ; then -+ config="${i}" -+ break -+ fi -+ done -+ -+ initramfs= -+ if test -n "${config}" ; then -+ initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` -+ fi -+ -+ if test -z "${initramfs}" && test -z "${initrd_real}" ; then -+ # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's -+ # no initrd or builtin initramfs, it can't work here. -+ if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \ -+ || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then -+ -+ linux_root_device_thisversion=${GRUB_DEVICE} -+ else -+ linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID} -+ fi -+ fi -+ -+ if [ "x${GRUB_DISABLE_SUBMENU}" = "xyes" ] || [ "x${GRUB_DISABLE_SUBMENU}" = "xy" ]; then -+ GRUB_DISABLE_SUBMENU="true" -+ fi -+ -+ if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then -+ linux_entry "${OS}" "${version}" simple standard \ -+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -+ if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then -+ linux_entry "${OS}" "${version}" simple debug \ -+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_LINUX_DEBUG}" -+ fi -+ -+ submenu_indentation="$grub_tab" -+ -+ if [ -z "$boot_device_id" ]; then -+ boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" -+ fi -+ # TRANSLATORS: %s is replaced with an OS name -+ echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" -+ is_top_level=false -+ fi -+ -+ linux_entry "${OS}" "${version}" advanced standard \ -+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -+ if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then -+ linux_entry "${OS}" "${version}" advanced debug \ -+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_LINUX_DEBUG}" -+ fi -+ -+ if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then -+ linux_entry "${OS}" "${version}" recovery standard \ -+ "single ${GRUB_CMDLINE_LINUX}" -+ fi -+ -+ list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` -+done -+ -+# If at least one kernel was found, then we need to -+# add a closing '}' for the submenu command. -+if [ x"$is_top_level" != xtrue ]; then -+ echo '}' -+fi -+ -+echo "$title_correction_code" diff --git a/0129-Add-auto-hide-menu-support.patch b/0095-Add-auto-hide-menu-support.patch similarity index 94% rename from 0129-Add-auto-hide-menu-support.patch rename to 0095-Add-auto-hide-menu-support.patch index 0afa74a9..64511158 100644 --- a/0129-Add-auto-hide-menu-support.patch +++ b/0095-Add-auto-hide-menu-support.patch @@ -49,10 +49,10 @@ Changes in v2: create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index c13ca685ce1..026b458bb85 100644 +index 41906486a71..04551e095bd 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -457,6 +457,12 @@ script = { +@@ -458,6 +458,12 @@ script = { installdir = grubconf; }; @@ -120,10 +120,10 @@ index 00000000000..ad175870a54 +fi +EOF diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 13a3a6bc752..ab634393a31 100644 +index 9d6ea55bdd3..21bbace4647 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in -@@ -42,6 +42,7 @@ if [ -z "${OSPROBED}" ] ; then +@@ -45,6 +45,7 @@ if [ -z "${OSPROBED}" ] ; then fi osx_entry() { @@ -131,7 +131,7 @@ index 13a3a6bc752..ab634393a31 100644 # TRANSLATORS: it refers on the OS residing on device %s onstr="$(gettext_printf "(on %s)" "${DEVICE}")" hints="" -@@ -102,6 +103,7 @@ for OS in ${OSPROBED} ; do +@@ -105,6 +106,7 @@ for OS in ${OSPROBED} ; do case ${BOOT} in chain) @@ -139,7 +139,7 @@ index 13a3a6bc752..ab634393a31 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -@@ -132,6 +134,7 @@ EOF +@@ -135,6 +137,7 @@ EOF EOF ;; efi) @@ -147,7 +147,7 @@ index 13a3a6bc752..ab634393a31 100644 EFIPATH=${DEVICE#*@} DEVICE=${DEVICE%@*} -@@ -176,6 +179,7 @@ EOF +@@ -179,6 +182,7 @@ EOF LINITRD="${LINITRD#/boot}" fi @@ -155,7 +155,7 @@ index 13a3a6bc752..ab634393a31 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" recovery_params="$(echo "${LPARAMS}" | grep single)" || true counter=1 -@@ -249,6 +253,7 @@ EOF +@@ -260,6 +264,7 @@ EOF done ;; hurd) @@ -163,7 +163,7 @@ index 13a3a6bc752..ab634393a31 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' { -@@ -275,6 +280,7 @@ EOF +@@ -286,6 +291,7 @@ EOF EOF ;; minix) @@ -171,8 +171,8 @@ index 13a3a6bc752..ab634393a31 100644 cat << EOF menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" { EOF -@@ -306,3 +312,15 @@ EOF - esac +@@ -302,3 +308,15 @@ EOF + ;; esac done + diff --git a/0131-Add-grub-set-bootflag-utility.patch b/0096-Add-grub-set-bootflag-utility.patch similarity index 97% rename from 0131-Add-grub-set-bootflag-utility.patch rename to 0096-Add-grub-set-bootflag-utility.patch index ff66909c..f5ff7d38 100644 --- a/0131-Add-grub-set-bootflag-utility.patch +++ b/0096-Add-grub-set-bootflag-utility.patch @@ -45,10 +45,10 @@ Signed-off-by: Hans de Goede create mode 100644 util/grub-set-bootflag.1 diff --git a/Makefile.util.def b/Makefile.util.def -index 89a9da1b9f7..125ad6209b2 100644 +index 04551e095bd..c6375933faa 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1451,3 +1451,10 @@ program = { +@@ -1445,3 +1445,10 @@ program = { ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -226,7 +226,7 @@ index 00000000000..bb198f02351 + return 0; +} diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 58d7d9540be..375b1bf9b02 100644 +index b909f2c073a..ea58362b555 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -14,6 +14,9 @@ EXTRA_DIST += util/import_unicode.py @@ -265,7 +265,7 @@ index 00000000000..5d8fcba21aa +OnActiveSec=2min diff --git a/util/grub-set-bootflag.1 b/util/grub-set-bootflag.1 new file mode 100644 -index 00000000000..f121226b416 +index 00000000000..57801da22a0 --- /dev/null +++ b/util/grub-set-bootflag.1 @@ -0,0 +1,20 @@ @@ -284,7 +284,7 @@ index 00000000000..f121226b416 +.TP +\fBBOOTFLAG\fR +.RS 7 -+Bootflag to set, one of \fIboot_success\fR or \fImenu_show_once\fR. ++Bootflag to set, one of \fIboot_success\fR or \fIshow_menu_once\fR. +.RE + +.SH SEE ALSO diff --git a/0132-docs-Add-grub-boot-indeterminate.service-example.patch b/0097-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0132-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0097-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0133-gentpl-add-disable-support.patch b/0098-gentpl-add-disable-support.patch similarity index 97% rename from 0133-gentpl-add-disable-support.patch rename to 0098-gentpl-add-disable-support.patch index 90308d88..2c3c998f 100644 --- a/0133-gentpl-add-disable-support.patch +++ b/0098-gentpl-add-disable-support.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gentpl.py b/gentpl.py -index f05812eace3..3a0c04963aa 100644 +index 2cba0bbbd6f..628e8bec1d7 100644 --- a/gentpl.py +++ b/gentpl.py @@ -592,11 +592,21 @@ def platform_conditional(platform, closure): diff --git a/0099-Add-grub_debug_enabled.patch b/0099-Add-grub_debug_enabled.patch deleted file mode 100644 index 838913ca..00000000 --- a/0099-Add-grub_debug_enabled.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 30 Nov 2017 15:11:39 -0500 -Subject: [PATCH] Add grub_debug_enabled() - ---- - grub-core/kern/misc.c | 21 ++++++++++++++++----- - include/grub/misc.h | 1 + - 2 files changed, 17 insertions(+), 5 deletions(-) - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 636f97e1ba1..e758ab3416d 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -159,17 +159,28 @@ int grub_err_printf (const char *fmt, ...) - __attribute__ ((alias("grub_printf"))); - #endif - -+int -+grub_debug_enabled (const char * condition) -+{ -+ const char *debug; -+ -+ debug = grub_env_get ("debug"); -+ if (!debug) -+ return 0; -+ -+ if (grub_strword (debug, "all") || grub_strword (debug, condition)) -+ return 1; -+ -+ return 0; -+} -+ - void - grub_real_dprintf (const char *file, const int line, const char *condition, - const char *fmt, ...) - { - va_list args; -- const char *debug = grub_env_get ("debug"); - -- if (! debug) -- return; -- -- if (grub_strword (debug, "all") || grub_strword (debug, condition)) -+ if (grub_debug_enabled (condition)) - { - grub_printf ("%s:%d: ", file, line); - va_start (args, fmt); -diff --git a/include/grub/misc.h b/include/grub/misc.h -index b4339222ecb..4a4f485a5f6 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -367,6 +367,7 @@ grub_puts (const char *s) - } - - int EXPORT_FUNC(grub_puts_) (const char *s); -+int EXPORT_FUNC(grub_debug_enabled) (const char *condition); - void EXPORT_FUNC(grub_real_dprintf) (const char *file, - const int line, - const char *condition, diff --git a/0134-gentpl-add-pc-firmware-type.patch b/0099-gentpl-add-pc-firmware-type.patch similarity index 95% rename from 0134-gentpl-add-pc-firmware-type.patch rename to 0099-gentpl-add-pc-firmware-type.patch index 9f0fd473..96dd2b8c 100644 --- a/0134-gentpl-add-pc-firmware-type.patch +++ b/0099-gentpl-add-pc-firmware-type.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+) diff --git a/gentpl.py b/gentpl.py -index 3a0c04963aa..1d9dda430e7 100644 +index 628e8bec1d7..34a4eba2b42 100644 --- a/gentpl.py +++ b/gentpl.py @@ -51,6 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ] diff --git a/0135-efinet-also-use-the-firmware-acceleration-for-http.patch b/0100-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0135-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0100-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0136-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0101-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0136-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0101-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0137-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 96% rename from 0137-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index 403412ba..6afb91c1 100644 --- a/0137-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index 8ee18ba159a..cf327482e8a 100644 +index f4cfd06cbe6..dbf97e703b4 100644 --- a/configure.ac +++ b/configure.ac -@@ -868,11 +868,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p +@@ -877,11 +877,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" fi @@ -45,7 +45,7 @@ index 8ee18ba159a..cf327482e8a 100644 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ grub_cv_target_cc_soft_float=no if test "x$target_cpu" = xarm64; then -@@ -1951,6 +1963,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +@@ -2018,6 +2030,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" @@ -88,7 +88,7 @@ index 8ee18ba159a..cf327482e8a 100644 GRUB_PLATFORM="${platform}" diff --git a/conf/Makefile.common b/conf/Makefile.common -index 5e8ba2ae3b0..bbf33b0bc4a 100644 +index 5f0ef969857..2ff9b39357c 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 @@ -129,7 +129,7 @@ index 5e8ba2ae3b0..bbf33b0bc4a 100644 # Other variables diff --git a/gentpl.py b/gentpl.py -index 1d9dda430e7..95fe1a24d8a 100644 +index 34a4eba2b42..59f62ef9522 100644 --- a/gentpl.py +++ b/gentpl.py @@ -697,10 +697,10 @@ def module(defn, platform): diff --git a/0138-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0103-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0138-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0103-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0139-Rework-how-the-fdt-command-builds.patch b/0104-Rework-how-the-fdt-command-builds.patch similarity index 92% rename from 0139-Rework-how-the-fdt-command-builds.patch rename to 0104-Rework-how-the-fdt-command-builds.patch index 9936858c..71328da1 100644 --- a/0139-Rework-how-the-fdt-command-builds.patch +++ b/0104-Rework-how-the-fdt-command-builds.patch @@ -22,10 +22,10 @@ Signed-off-by: Peter Jones 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 48491b50683..556adca7074 100644 +index c40170f2dd2..84a3d89de9a 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -175,7 +175,6 @@ kernel = { +@@ -177,7 +177,6 @@ kernel = { arm_coreboot = kern/arm/coreboot/init.c; arm_coreboot = kern/arm/coreboot/timer.c; arm_coreboot = kern/arm/coreboot/coreboot.S; @@ -33,7 +33,7 @@ index 48491b50683..556adca7074 100644 arm_coreboot = bus/fdt.c; arm_coreboot = term/ps2.c; arm_coreboot = term/arm/pl050.c; -@@ -348,6 +347,8 @@ kernel = { +@@ -351,6 +350,8 @@ kernel = { riscv64 = kern/riscv/cache_flush.S; riscv64 = kern/riscv/dl.c; @@ -42,7 +42,7 @@ index 48491b50683..556adca7074 100644 emu = disk/host.c; emu = kern/emu/cache_s.S; emu = kern/emu/hostdisk.c; -@@ -1801,7 +1802,6 @@ module = { +@@ -1825,7 +1826,6 @@ module = { riscv32 = loader/riscv/linux.c; riscv64 = loader/riscv/linux.c; emu = loader/emu/linux.c; @@ -50,7 +50,7 @@ index 48491b50683..556adca7074 100644 common = loader/linux.c; common = lib/cmdline.c; -@@ -1812,7 +1812,6 @@ module = { +@@ -1836,7 +1836,6 @@ module = { module = { name = fdt; efi = loader/efi/fdt.c; @@ -72,12 +72,12 @@ index 0d371c5633e..37e04bd69e7 100644 #define FDT_BEGIN_NODE 0x00000001 diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c -index ee9c5592c70..37ca407bb36 100644 +index c86f283d756..c572415d38a 100644 --- a/grub-core/loader/efi/fdt.c +++ b/grub-core/loader/efi/fdt.c -@@ -26,6 +26,8 @@ - #include +@@ -27,6 +27,8 @@ #include + #include +GRUB_MOD_LICENSE ("GPLv3+"); + @@ -105,7 +105,7 @@ index e609c7e4111..22b7c5463fc 100644 + #endif /* ! GRUB_FDT_HEADER */ diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index d9ad30052f1..ee9c4e4eb88 100644 +index f512573c0da..dd49939aaa9 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h diff --git a/0140-Disable-non-wordsize-allocations-on-arm.patch b/0105-Disable-non-wordsize-allocations-on-arm.patch similarity index 93% rename from 0140-Disable-non-wordsize-allocations-on-arm.patch rename to 0105-Disable-non-wordsize-allocations-on-arm.patch index 64da8e67..3708cbee 100644 --- a/0140-Disable-non-wordsize-allocations-on-arm.patch +++ b/0105-Disable-non-wordsize-allocations-on-arm.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index cf327482e8a..9b0946c27bf 100644 +index dbf97e703b4..96b96973f26 100644 --- a/configure.ac +++ b/configure.ac -@@ -1262,6 +1262,26 @@ if test "x$target_cpu" = xarm; then +@@ -1288,6 +1288,26 @@ if test "x$target_cpu" = xarm; then done ]) diff --git a/0142-Prepend-prefix-when-HTTP-path-is-relative.patch b/0106-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 98% rename from 0142-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0106-Prepend-prefix-when-HTTP-path-is-relative.patch index 1b1af535..3592ef2e 100644 --- a/0142-Prepend-prefix-when-HTTP-path-is-relative.patch +++ b/0106-Prepend-prefix-when-HTTP-path-is-relative.patch @@ -14,10 +14,10 @@ Signed-off-by: Peter Jones 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index da47b18b50e..dcf48726d54 100644 +index d1de9fa6873..1c540fc8c26 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c -@@ -130,11 +130,19 @@ grub_set_prefix_and_root (void) +@@ -131,11 +131,19 @@ grub_set_prefix_and_root (void) if (fwdevice && fwpath) { char *fw_path; diff --git a/0144-Make-grub_error-more-verbose.patch b/0107-Make-grub_error-more-verbose.patch similarity index 51% rename from 0144-Make-grub_error-more-verbose.patch rename to 0107-Make-grub_error-more-verbose.patch index ec4a3ebc..2492e9f6 100644 --- a/0144-Make-grub_error-more-verbose.patch +++ b/0107-Make-grub_error-more-verbose.patch @@ -5,50 +5,10 @@ Subject: [PATCH] Make grub_error() more verbose Signed-off-by: Peter Jones --- - grub-core/kern/efi/mm.c | 17 ++++++++++++++--- - grub-core/kern/err.c | 13 +++++++++++-- - include/grub/err.h | 5 ++++- - 3 files changed, 29 insertions(+), 6 deletions(-) + grub-core/kern/err.c | 13 +++++++++++-- + include/grub/err.h | 8 ++++++-- + 2 files changed, 17 insertions(+), 4 deletions(-) -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index a9e37108c6d..15595a46e23 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -157,12 +157,20 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, - - /* Limit the memory access to less than 4GB for 32-bit platforms. */ - if (address > GRUB_EFI_MAX_USABLE_ADDRESS) -- return 0; -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, -+ N_("invalid memory address (0x%llx > 0x%llx)"), -+ address, GRUB_EFI_MAX_USABLE_ADDRESS); -+ return NULL; -+ } - - b = grub_efi_system_table->boot_services; - status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address); - if (status != GRUB_EFI_SUCCESS) -- return 0; -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -+ return NULL; -+ } - - if (address == 0) - { -@@ -172,7 +180,10 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, - status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address); - grub_efi_free_pages (0, pages); - if (status != GRUB_EFI_SUCCESS) -- return 0; -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -+ return NULL; -+ } - } - - grub_efi_store_alloc (address, pages); diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c index 53c734de70e..aebfe0cf839 100644 --- a/grub-core/kern/err.c @@ -81,17 +41,20 @@ index 53c734de70e..aebfe0cf839 100644 return n; diff --git a/include/grub/err.h b/include/grub/err.h -index 24ba9f5f592..b68bbec3c72 100644 +index b08d5d0de4c..c0f90ef07c8 100644 --- a/include/grub/err.h +++ b/include/grub/err.h -@@ -85,7 +85,10 @@ struct grub_error_saved +@@ -85,8 +85,12 @@ struct grub_error_saved extern grub_err_t EXPORT_VAR(grub_errno); extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG]; --grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...); -+grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const int line, const char *fmt, ...); +-grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...) +- __attribute__ ((format (GNU_PRINTF, 2, 3))); ++grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const int line, const char *fmt, ...) ++ __attribute__ ((format (GNU_PRINTF, 4, 5))); + +#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__, fmt, ##__VA_ARGS__) ++ + void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn)); void EXPORT_FUNC(grub_error_push) (void); diff --git a/0145-Make-reset-an-alias-for-the-reboot-command.patch b/0108-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0145-Make-reset-an-alias-for-the-reboot-command.patch rename to 0108-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0147-Add-a-version-command.patch b/0109-Add-a-version-command.patch similarity index 96% rename from 0147-Add-a-version-command.patch rename to 0109-Add-a-version-command.patch index f08559b4..749d3196 100644 --- a/0147-Add-a-version-command.patch +++ b/0109-Add-a-version-command.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index 9b0946c27bf..bca7c2818af 100644 +index 96b96973f26..dabcbafc985 100644 --- a/configure.ac +++ b/configure.ac -@@ -303,6 +303,19 @@ AC_SUBST(target_cpu) +@@ -312,6 +312,19 @@ AC_SUBST(target_cpu) AC_SUBST(platform) # Define default variables @@ -41,10 +41,10 @@ index 9b0946c27bf..bca7c2818af 100644 have_with_bootdir=n AC_ARG_WITH([bootdir], diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 556adca7074..8bb1dafd0ac 100644 +index 84a3d89de9a..498ca11762a 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -576,6 +576,11 @@ image = { +@@ -579,6 +579,11 @@ image = { enable = mips_loongson; }; diff --git a/0148-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0110-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 91% rename from 0148-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0110-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch index ac8ed7fb..9afb3151 100644 --- a/0148-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +++ b/0110-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 4 files changed, 10 insertions(+) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index c3b578acf25..1a3eb6b8d77 100644 +index 0320115662f..7cdffe3ebd5 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter) @@ -24,16 +24,16 @@ index c3b578acf25..1a3eb6b8d77 100644 if (!accept_diskfilter && is_valid_diskfilter_name (name)) return 0; -@@ -1211,6 +1213,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id, +@@ -1212,6 +1214,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id, the same. */ - if (pv->disk && grub_disk_get_size (disk) >= pv->part_size) + if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size) return GRUB_ERR_NONE; + grub_dprintf ("diskfilter", "checking %s\n", disk->name); pv->disk = grub_disk_open (disk->name); if (!pv->disk) return grub_errno; diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index 9e20af70ee0..54c227b1c84 100644 +index f077b5f5535..fe8ba6e6c93 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -855,6 +855,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) diff --git a/0110-misc-fix-invalid-character-recongition-in-strto-l.patch b/0110-misc-fix-invalid-character-recongition-in-strto-l.patch deleted file mode 100644 index 40060286..00000000 --- a/0110-misc-fix-invalid-character-recongition-in-strto-l.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aaron Miller -Date: Fri, 29 Jul 2016 17:41:27 +0800 -Subject: [PATCH] misc: fix invalid character recongition in strto*l - -Would previously allow digits larger than the base and didn't check that -subtracting the difference from 0-9 to lowercase letters for characters -larger than 9 didn't result in a value lower than 9, which allowed the -parses: ` = 9, _ = 8, ^ = 7, ] = 6, \ = 5, and [ = 4 ---- - grub-core/kern/misc.c | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 0e89c483d5e..5c3899f0e5b 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -434,11 +434,14 @@ grub_strtoull (const char *str, char **end, int base) - unsigned long digit; - - digit = grub_tolower (*str) - '0'; -- if (digit >= 'a' - '0') -- digit += '0' - 'a' + 10; -- else if (digit > 9) -- break; -- -+ if (digit > 9) -+ { -+ digit += '0' - 'a' + 10; -+ /* digit <= 9 check is needed to keep chars larger than -+ '9' but less than 'a' from being read as numbers */ -+ if (digit >= (unsigned long) base || digit <= 9) -+ break; -+ } - if (digit >= (unsigned long) base) - break; - diff --git a/0149-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 89% rename from 0149-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch index c912d24c..5b18d9cd 100644 --- a/0149-arm-arm64-loader-Better-memory-allocation-and-error-.patch +++ b/0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch @@ -66,12 +66,12 @@ per-platform constraints on its given address are maintained. Signed-off-by: Peter Jones --- - grub-core/kern/efi/mm.c | 33 +++++++++++++----- - grub-core/loader/arm64/linux.c | 78 ++++++++++++++++++++++++++++++++---------- - 2 files changed, 84 insertions(+), 27 deletions(-) + grub-core/kern/efi/mm.c | 33 +++++++++++++++----- + grub-core/loader/arm64/linux.c | 68 +++++++++++++++++++++++++++++++----------- + 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 15595a46e23..1b14fa0694c 100644 +index 74360542062..e6abc923db2 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, @@ -82,7 +82,7 @@ index 15595a46e23..1b14fa0694c 100644 /* Limit the memory access to less than 4GB for 32-bit platforms. */ if (address > GRUB_EFI_MAX_USABLE_ADDRESS) -@@ -165,19 +166,22 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, +@@ -166,19 +167,22 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, } b = grub_efi_system_table->boot_services; @@ -109,7 +109,7 @@ index 15595a46e23..1b14fa0694c 100644 grub_efi_free_pages (0, pages); if (status != GRUB_EFI_SUCCESS) { -@@ -186,9 +190,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, +@@ -187,9 +191,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, } } @@ -121,7 +121,7 @@ index 15595a46e23..1b14fa0694c 100644 } void * -@@ -699,8 +703,21 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) +@@ -709,8 +713,21 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) for (desc = memory_map, *base_addr = GRUB_EFI_MAX_USABLE_ADDRESS; (grub_addr_t) desc < ((grub_addr_t) memory_map + memory_map_size); desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) @@ -146,10 +146,10 @@ index 15595a46e23..1b14fa0694c 100644 grub_free(memory_map); diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 4c0a09c06de..8791b35b6fe 100644 +index 04994d5c67d..70a0075ec5e 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c -@@ -71,13 +71,15 @@ finalize_params_linux (void) +@@ -71,20 +71,25 @@ finalize_params_linux (void) { grub_efi_loaded_image_t *loaded_image = NULL; int node, retval, len; @@ -168,26 +168,7 @@ index 4c0a09c06de..8791b35b6fe 100644 node = grub_fdt_find_subnode (fdt, 0, "chosen"); if (node < 0) -@@ -88,17 +90,26 @@ finalize_params_linux (void) - */ - retval = grub_fdt_set_prop32(fdt, 0, "#address-cells", 2); - if (retval) -- goto failure; -+ { -+ err = grub_error(retval, "Could not find #address-cells"); -+ goto failure; -+ } - - retval = grub_fdt_set_prop32(fdt, 0, "#size-cells", 2); - if (retval) -- goto failure; -+ { -+ err = grub_error(retval, "Could not find #size-cells"); -+ goto failure; -+ } - - node = grub_fdt_add_subnode (fdt, 0, "chosen"); - } + node = grub_fdt_add_subnode (fdt, 0, "chosen"); if (node < 1) - goto failure; @@ -198,7 +179,7 @@ index 4c0a09c06de..8791b35b6fe 100644 /* Set initrd info */ if (initrd_start && initrd_end > initrd_start) -@@ -109,15 +120,26 @@ finalize_params_linux (void) +@@ -95,15 +100,26 @@ finalize_params_linux (void) retval = grub_fdt_set_prop64 (fdt, node, "linux,initrd-start", initrd_start); if (retval) @@ -229,7 +210,7 @@ index 4c0a09c06de..8791b35b6fe 100644 grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n", fdt); -@@ -125,14 +147,20 @@ finalize_params_linux (void) +@@ -111,14 +127,20 @@ finalize_params_linux (void) /* Convert command line to UCS-2 */ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); if (!loaded_image) @@ -252,7 +233,7 @@ index 4c0a09c06de..8791b35b6fe 100644 loaded_image->load_options_size = 2 * grub_utf8_to_utf16 (loaded_image->load_options, len, -@@ -142,7 +170,7 @@ finalize_params_linux (void) +@@ -128,7 +150,7 @@ finalize_params_linux (void) failure: grub_fdt_unload(); @@ -261,7 +242,7 @@ index 4c0a09c06de..8791b35b6fe 100644 } static void -@@ -226,16 +254,28 @@ grub_linux_unload (void) +@@ -212,16 +234,28 @@ grub_linux_unload (void) static void * allocate_initrd_mem (int initrd_pages) { diff --git a/0150-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 97% rename from 0150-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch index 25ad6498..0bceecb6 100644 --- a/0150-Try-to-pick-better-locations-for-kernel-and-initrd.patch +++ b/0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch @@ -34,7 +34,7 @@ Signed-off-by: Peter Jones 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 1b14fa0694c..d70e5b45b7c 100644 +index e6abc923db2..83d7644222e 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 1b14fa0694c..d70e5b45b7c 100644 return 0; b = grub_efi_system_table->boot_services; -@@ -466,7 +466,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -476,7 +476,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 1b14fa0694c..d70e5b45b7c 100644 #endif && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 && desc->num_pages != 0) -@@ -484,9 +484,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -494,9 +494,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 diff --git a/0151-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0113-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 93% rename from 0151-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0113-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index db05a0f9..c2f2a597 100644 --- a/0151-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0113-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -16,16 +16,16 @@ Signed-off-by: Peter Jones util/grub-probe.c | 2 +- util/grub-rpm-sort.c | 2 +- util/setup.c | 2 +- - bootstrap.conf | 2 +- + bootstrap.conf | 3 +- .../gnulib-patches/fix-sign-compare-errors.patch | 161 +++++++++++++++++++++ - 13 files changed, 180 insertions(+), 18 deletions(-) + 13 files changed, 181 insertions(+), 18 deletions(-) create mode 100644 grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 245b69cab51..7a8d9e62300 100644 +index eeea092752d..f08a1bb8415 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -177,7 +177,7 @@ grub_util_get_image_size (const char *path) +@@ -189,7 +189,7 @@ grub_util_get_image_size (const char *path) sz = ftello (f); if (sz < 0) grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); @@ -35,19 +35,19 @@ index 245b69cab51..7a8d9e62300 100644 ret = (size_t) sz; diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c -index ee9fa7b4feb..19c20085279 100644 +index 467305b46ab..79037c093f7 100644 --- a/grub-core/lib/reed_solomon.c +++ b/grub-core/lib/reed_solomon.c -@@ -156,7 +156,7 @@ static void +@@ -157,7 +157,7 @@ static void rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs) { gf_single_t *rs_polynomial; - int i, j; + unsigned int i, j; gf_single_t *m; - m = xmalloc ((s + rs) * sizeof (gf_single_t)); + m = xcalloc (s + rs, sizeof (gf_single_t)); grub_memcpy (m, data, s * sizeof (gf_single_t)); -@@ -325,7 +325,7 @@ static void +@@ -324,7 +324,7 @@ static void encode_block (gf_single_t *ptr, grub_size_t s, gf_single_t *rptr, grub_size_t rs) { @@ -70,7 +70,7 @@ index c77d6085ccb..42a315031ff 100644 + fie1.fm_mapped_extents * sizeof (fie1.fm_extents[1])); diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 4c5a13022dc..2b7a626d5ea 100644 +index 28790307e00..9f730b35189 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -236,7 +236,7 @@ grub_find_root_devices_from_btrfs (const char *dir) @@ -83,7 +83,7 @@ index 4c5a13022dc..2b7a626d5ea 100644 fd = open (dir, 0); diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c -index 8b92f8528f9..370d02787cd 100644 +index da62f924e35..7bc99ac1c1d 100644 --- a/grub-core/osdep/linux/hostdisk.c +++ b/grub-core/osdep/linux/hostdisk.c @@ -83,7 +83,7 @@ grub_util_get_fd_size_os (grub_util_fd_t fd, const char *name, unsigned *log_sec @@ -96,7 +96,7 @@ index 8b92f8528f9..370d02787cd 100644 if (log_secsize) diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index f14e02d9727..88f9c5d4ad8 100644 +index 83865642009..bfcef852d83 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -323,7 +323,7 @@ cmd_cmp (char *src, char *dest) @@ -176,7 +176,7 @@ index 0fe45a6103d..3e09240b99f 100644 add_pixel (&data, &mask, glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] & diff --git a/util/grub-probe.c b/util/grub-probe.c -index 81d27eead59..7481e487211 100644 +index c08e46bbb40..c6fac732b40 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -798,7 +798,7 @@ argp_parser (int key, char *arg, struct argp_state *state) @@ -202,10 +202,10 @@ index f33bd1ed568..8345944105f 100644 grub_util_host_init (&argc, &argv); diff --git a/util/setup.c b/util/setup.c -index 6f88f3cc43f..864094de682 100644 +index da5f2c07f50..8b22bb8ccac 100644 --- a/util/setup.c +++ b/util/setup.c -@@ -402,7 +402,7 @@ SETUP (const char *dir, +@@ -406,7 +406,7 @@ SETUP (const char *dir, int is_ldm; grub_err_t err; grub_disk_addr_t *sectors; @@ -215,15 +215,16 @@ index 6f88f3cc43f..864094de682 100644 unsigned int nsec, maxsec; diff --git a/bootstrap.conf b/bootstrap.conf -index 988dda099ac..8804d5beb89 100644 +index 6b043fc354c..186be9c48ce 100644 --- a/bootstrap.conf +++ b/bootstrap.conf -@@ -78,7 +78,7 @@ cp -a INSTALL INSTALL.grub - +@@ -80,7 +80,8 @@ cp -a INSTALL INSTALL.grub bootstrap_post_import_hook () { set -e -- for patchname in fix-null-deref fix-width no-abort; do -+ for patchname in fix-null-deref fix-width no-abort fix-sign-compare-errors; do + for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ +- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do ++ fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort \ ++ fix-sign-compare-errors; do patch -d grub-core/lib/gnulib -p2 \ < "grub-core/lib/gnulib-patches/$patchname.patch" done diff --git a/0152-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 92% rename from 0152-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index b2e5de04..668fb4c7 100644 --- a/0152-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index bca7c2818af..38d978bd650 100644 +index dabcbafc985..f691767a2c0 100644 --- a/configure.ac +++ b/configure.ac -@@ -1424,11 +1424,11 @@ fi +@@ -1480,11 +1480,11 @@ fi # Set them to their new values for the tests below. CC="$TARGET_CC" if test x"$platform" = xemu ; then @@ -29,7 +29,7 @@ index bca7c2818af..38d978bd650 100644 fi CPPFLAGS="$TARGET_CPPFLAGS" -@@ -1987,6 +1987,14 @@ if test x"$enable_werror" != xno ; then +@@ -2054,6 +2054,14 @@ if test x"$enable_werror" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Werror" fi @@ -45,7 +45,7 @@ index bca7c2818af..38d978bd650 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index bbf33b0bc4a..b867691f125 100644 +index 2ff9b39357c..35e14ff017e 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d diff --git a/0153-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0115-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0153-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0115-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0154-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0116-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0154-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0116-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0155-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0117-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 98% rename from 0155-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0117-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch index 3bfb4829..4ad0696b 100644 --- a/0155-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +++ b/0117-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 1 file changed, 94 insertions(+), 73 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 5f48fa55619..075b77eb3e4 100644 +index 5f48fa55619..3e4f7ef39f4 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -47,6 +47,65 @@ static char *linux_cmdline; @@ -72,7 +72,7 @@ index 5f48fa55619..075b77eb3e4 100644 + } + + if (addr == NULL) -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, errmsg); ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, "%s", errmsg); + + return addr; +} diff --git a/0118-Fix-one-more-coverity-complaint.patch b/0118-Fix-one-more-coverity-complaint.patch deleted file mode 100644 index 41f4d0aa..00000000 --- a/0118-Fix-one-more-coverity-complaint.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 25 May 2017 11:27:40 -0400 -Subject: [PATCH] Fix one more coverity complaint - -No idea why covscan thinks this is an "added" bug, since the file hasn't -changed in 3 years, but... yeah. - -Signed-off-by: Peter Jones ---- - grub-core/normal/completion.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/normal/completion.c b/grub-core/normal/completion.c -index 596102848c1..c07100a8de3 100644 ---- a/grub-core/normal/completion.c -+++ b/grub-core/normal/completion.c -@@ -284,7 +284,8 @@ complete_file (void) - - /* Cut away the filename part. */ - dirfile = grub_strrchr (dir, '/'); -- dirfile[1] = '\0'; -+ if (dirfile) -+ dirfile[1] = '\0'; - - /* Iterate the directory. */ - (fs->fs_dir) (dev, dir, iterate_dir, NULL); diff --git a/0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0118-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 98% rename from 0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0118-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch index f545a060..b1233ce3 100644 --- a/0156-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +++ b/0118-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 075b77eb3e4..50b7798d6e5 100644 +index 3e4f7ef39f4..6bc18d5aef5 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -52,13 +52,22 @@ struct allocation_choice { @@ -153,10 +153,10 @@ index 075b77eb3e4..50b7798d6e5 100644 grub_memcpy (kernel_mem, (char *)kernel + start, filelen - start); diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index a093679cb80..91123b1eb5c 100644 +index 25ef52c04eb..fac22476cc5 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h -@@ -234,7 +234,11 @@ struct linux_kernel_params +@@ -236,7 +236,11 @@ struct linux_kernel_params grub_uint32_t ofw_cif_handler; /* b8 */ grub_uint32_t ofw_idt; /* bc */ diff --git a/0157-Fix-getroot.c-s-trampolines.patch b/0119-Fix-getroot.c-s-trampolines.patch similarity index 97% rename from 0157-Fix-getroot.c-s-trampolines.patch rename to 0119-Fix-getroot.c-s-trampolines.patch index 85fe933f..29ec44c9 100644 --- a/0157-Fix-getroot.c-s-trampolines.patch +++ b/0119-Fix-getroot.c-s-trampolines.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 2b7a626d5ea..36429a7cd25 100644 +index 9f730b35189..f0c503f43d3 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -1264,22 +1264,20 @@ grub_util_get_grub_dev_os (const char *os_dev) diff --git a/0158-Do-not-allow-stack-trampolines-anywhere.patch b/0120-Do-not-allow-stack-trampolines-anywhere.patch similarity index 90% rename from 0158-Do-not-allow-stack-trampolines-anywhere.patch rename to 0120-Do-not-allow-stack-trampolines-anywhere.patch index 62b9463d..46176d01 100644 --- a/0158-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0120-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 38d978bd650..5076d635c57 100644 +index f691767a2c0..2e4b12adad3 100644 --- a/configure.ac +++ b/configure.ac -@@ -1995,6 +1995,9 @@ if test x"$enable_wextra" != xno ; then +@@ -2062,6 +2062,9 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi @@ -24,7 +24,7 @@ index 38d978bd650..5076d635c57 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index b867691f125..87c1f0e809b 100644 +index 35e14ff017e..0647c53b916 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d diff --git a/0159-Reimplement-boot_counter.patch b/0121-Reimplement-boot_counter.patch similarity index 97% rename from 0159-Reimplement-boot_counter.patch rename to 0121-Reimplement-boot_counter.patch index 08c8c586..164b2291 100644 --- a/0159-Reimplement-boot_counter.patch +++ b/0121-Reimplement-boot_counter.patch @@ -23,10 +23,10 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index 125ad6209b2..2019ebd0207 100644 +index c6375933faa..2e5e05b25f1 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -457,6 +457,12 @@ script = { +@@ -458,6 +458,12 @@ script = { installdir = grubconf; }; @@ -40,10 +40,10 @@ index 125ad6209b2..2019ebd0207 100644 name = '01_menu_auto_hide'; common = util/grub.d/01_menu_auto_hide.in; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 8bb1dafd0ac..65ca74f9ad9 100644 +index 498ca11762a..1e15345107e 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -395,6 +395,11 @@ kernel = { +@@ -398,6 +398,11 @@ kernel = { extra_dist = kern/mips/cache_flush.S; }; diff --git a/0121-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch b/0121-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch deleted file mode 100644 index 33cde3ba..00000000 --- a/0121-grub-core-video-efi_gop.c-Add-support-for-BLT_ONLY-a.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Wed, 1 Feb 2017 23:10:45 +0100 -Subject: [PATCH] grub-core/video/efi_gop.c: Add support for BLT_ONLY adapters - -EFI GOP has support for multiple different bitness types of frame buffers -and for a special "BLT only" type which is always defined to be RGBx. - -Because grub2 doesn't ever directly access the frame buffer but instead -only renders graphics via the BLT interface anyway, we can easily support -these adapters. - -The reason this has come up now is the emerging support for virtio-gpu -in OVMF. That adapter does not have the notion of a memory mapped frame -buffer and thus is BLT only. - -Signed-off-by: Alexander Graf ---- - grub-core/video/efi_gop.c | 2 ++ - include/grub/efi/graphics_output.h | 3 ++- - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c -index 7f9d1c2dfa1..c9e40e8d4e9 100644 ---- a/grub-core/video/efi_gop.c -+++ b/grub-core/video/efi_gop.c -@@ -121,6 +121,7 @@ grub_video_gop_get_bpp (struct grub_efi_gop_mode_info *in) - { - case GRUB_EFI_GOT_BGRA8: - case GRUB_EFI_GOT_RGBA8: -+ case GRUB_EFI_GOT_BLT_ONLY: - return 32; - - case GRUB_EFI_GOT_BITMASK: -@@ -187,6 +188,7 @@ grub_video_gop_fill_real_mode_info (unsigned mode, - switch (in->pixel_format) - { - case GRUB_EFI_GOT_RGBA8: -+ case GRUB_EFI_GOT_BLT_ONLY: - out->red_mask_size = 8; - out->red_field_pos = 0; - out->green_mask_size = 8; -diff --git a/include/grub/efi/graphics_output.h b/include/grub/efi/graphics_output.h -index 12977741192..e4388127c66 100644 ---- a/include/grub/efi/graphics_output.h -+++ b/include/grub/efi/graphics_output.h -@@ -28,7 +28,8 @@ typedef enum - { - GRUB_EFI_GOT_RGBA8, - GRUB_EFI_GOT_BGRA8, -- GRUB_EFI_GOT_BITMASK -+ GRUB_EFI_GOT_BITMASK, -+ GRUB_EFI_GOT_BLT_ONLY, - } - grub_efi_gop_pixel_format_t; - diff --git a/0161-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0122-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 100% rename from 0161-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0122-Fix-menu-entry-selection-based-on-ID-and-title.patch diff --git a/0122-efi-uga-use-64-bit-for-fb_base.patch b/0122-efi-uga-use-64-bit-for-fb_base.patch deleted file mode 100644 index bafcb648..00000000 --- a/0122-efi-uga-use-64-bit-for-fb_base.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Andrei Borzenkov -Date: Wed, 16 May 2018 13:06:04 -0400 -Subject: [PATCH] efi/uga: use 64 bit for fb_base - -We get 64 bit from PCI BAR but then truncate by assigning to 32 bit. -Make sure to check that pointer does not overflow on 32 bit platform. - -Closes: 50931 ---- - grub-core/video/efi_uga.c | 31 ++++++++++++++++--------------- - 1 file changed, 16 insertions(+), 15 deletions(-) - -diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c -index 044af1d20d3..97a607c01a5 100644 ---- a/grub-core/video/efi_uga.c -+++ b/grub-core/video/efi_uga.c -@@ -34,7 +34,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - - static grub_efi_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID; - static struct grub_efi_uga_draw_protocol *uga; --static grub_uint32_t uga_fb; -+static grub_uint64_t uga_fb; - static grub_uint32_t uga_pitch; - - static struct -@@ -52,7 +52,7 @@ static struct - #define FBTEST_COUNT 8 - - static int --find_line_len (grub_uint32_t *fb_base, grub_uint32_t *line_len) -+find_line_len (grub_uint64_t *fb_base, grub_uint32_t *line_len) - { - grub_uint32_t *base = (grub_uint32_t *) (grub_addr_t) *fb_base; - int i; -@@ -67,7 +67,7 @@ find_line_len (grub_uint32_t *fb_base, grub_uint32_t *line_len) - { - if ((base[j] & RGB_MASK) == RGB_MAGIC) - { -- *fb_base = (grub_uint32_t) (grub_addr_t) base; -+ *fb_base = (grub_uint64_t) (grub_addr_t) base; - *line_len = j << 2; - - return 1; -@@ -84,7 +84,7 @@ find_line_len (grub_uint32_t *fb_base, grub_uint32_t *line_len) - /* Context for find_framebuf. */ - struct find_framebuf_ctx - { -- grub_uint32_t *fb_base; -+ grub_uint64_t *fb_base; - grub_uint32_t *line_len; - int found; - }; -@@ -129,7 +129,9 @@ find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) - if (i == 5) - break; - -- old_bar2 = grub_pci_read (addr + 4); -+ i++; -+ addr += 4; -+ old_bar2 = grub_pci_read (addr); - } - else - old_bar2 = 0; -@@ -138,10 +140,15 @@ find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) - base64 <<= 32; - base64 |= (old_bar1 & GRUB_PCI_ADDR_MEM_MASK); - -- grub_dprintf ("fb", "%s(%d): 0x%llx\n", -+ grub_dprintf ("fb", "%s(%d): 0x%" PRIxGRUB_UINT64_T "\n", - ((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) ? -- "VMEM" : "MMIO"), i, -- (unsigned long long) base64); -+ "VMEM" : "MMIO"), type == GRUB_PCI_ADDR_MEM_TYPE_64 ? i - 1 : i, -+ base64); -+ -+#if GRUB_CPU_SIZEOF_VOID_P == 4 -+ if (old_bar2) -+ continue; -+#endif - - if ((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) && (! ctx->found)) - { -@@ -149,12 +156,6 @@ find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) - if (find_line_len (ctx->fb_base, ctx->line_len)) - ctx->found++; - } -- -- if (type == GRUB_PCI_ADDR_MEM_TYPE_64) -- { -- i++; -- addr += 4; -- } - } - } - -@@ -162,7 +163,7 @@ find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) - } - - static int --find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len) -+find_framebuf (grub_uint64_t *fb_base, grub_uint32_t *line_len) - { - struct find_framebuf_ctx ctx = { - .fb_base = fb_base, diff --git a/0123-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch b/0123-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch deleted file mode 100644 index 20aadf66..00000000 --- a/0123-EFI-console-Do-not-set-text-mode-until-we-actually-n.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Tue, 6 Mar 2018 17:11:15 +0100 -Subject: [PATCH] EFI: console: Do not set text-mode until we actually need it - -If we're running with a hidden menu we may never need text mode, so do not -change the video-mode to text until we actually need it. - -Signed-off-by: Hans de Goede ---- - grub-core/term/efi/console.c | 65 ++++++++++++++++++++++++++++++-------------- - 1 file changed, 44 insertions(+), 21 deletions(-) - -diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index 4840cc59d3f..051633d71e9 100644 ---- a/grub-core/term/efi/console.c -+++ b/grub-core/term/efi/console.c -@@ -24,6 +24,11 @@ - #include - #include - -+static grub_err_t grub_prepare_for_text_output(struct grub_term_output *term); -+ -+static int text_mode_available = -1; -+static int text_colorstate = -1; -+ - static grub_uint32_t - map_char (grub_uint32_t c) - { -@@ -66,14 +71,14 @@ map_char (grub_uint32_t c) - } - - static void --grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)), -+grub_console_putchar (struct grub_term_output *term, - const struct grub_unicode_glyph *c) - { - grub_efi_char16_t str[2 + 30]; - grub_efi_simple_text_output_interface_t *o; - unsigned i, j; - -- if (grub_efi_is_finished) -+ if (grub_prepare_for_text_output (term)) - return; - - o = grub_efi_system_table->con_out; -@@ -223,14 +228,15 @@ grub_console_getkey (struct grub_term_input *term) - } - - static struct grub_term_coordinate --grub_console_getwh (struct grub_term_output *term __attribute__ ((unused))) -+grub_console_getwh (struct grub_term_output *term) - { - grub_efi_simple_text_output_interface_t *o; - grub_efi_uintn_t columns, rows; - - o = grub_efi_system_table->con_out; -- if (grub_efi_is_finished || efi_call_4 (o->query_mode, o, o->mode->mode, -- &columns, &rows) != GRUB_EFI_SUCCESS) -+ if (grub_prepare_for_text_output (term) != GRUB_ERR_NONE || -+ efi_call_4 (o->query_mode, o, o->mode->mode, -+ &columns, &rows) != GRUB_EFI_SUCCESS) - { - /* Why does this fail? */ - columns = 80; -@@ -245,7 +251,7 @@ grub_console_getxy (struct grub_term_output *term __attribute__ ((unused))) - { - grub_efi_simple_text_output_interface_t *o; - -- if (grub_efi_is_finished) -+ if (grub_efi_is_finished || text_mode_available != 1) - return (struct grub_term_coordinate) { 0, 0 }; - - o = grub_efi_system_table->con_out; -@@ -253,12 +259,12 @@ grub_console_getxy (struct grub_term_output *term __attribute__ ((unused))) - } - - static void --grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)), -+grub_console_gotoxy (struct grub_term_output *term, - struct grub_term_coordinate pos) - { - grub_efi_simple_text_output_interface_t *o; - -- if (grub_efi_is_finished) -+ if (grub_prepare_for_text_output (term)) - return; - - o = grub_efi_system_table->con_out; -@@ -271,7 +277,7 @@ grub_console_cls (struct grub_term_output *term __attribute__ ((unused))) - grub_efi_simple_text_output_interface_t *o; - grub_efi_int32_t orig_attr; - -- if (grub_efi_is_finished) -+ if (grub_efi_is_finished || text_mode_available != 1) - return; - - o = grub_efi_system_table->con_out; -@@ -291,6 +297,12 @@ grub_console_setcolorstate (struct grub_term_output *term - if (grub_efi_is_finished) - return; - -+ if (text_mode_available != 1) { -+ /* Avoid "color_normal" environment writes causing a switch to textmode */ -+ text_colorstate = state; -+ return; -+ } -+ - o = grub_efi_system_table->con_out; - - switch (state) { -@@ -315,7 +327,7 @@ grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)), - { - grub_efi_simple_text_output_interface_t *o; - -- if (grub_efi_is_finished) -+ if (grub_efi_is_finished || text_mode_available != 1) - return; - - o = grub_efi_system_table->con_out; -@@ -323,18 +335,38 @@ grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)), - } - - static grub_err_t --grub_efi_console_output_init (struct grub_term_output *term) -+grub_prepare_for_text_output(struct grub_term_output *term) - { -- grub_efi_set_text_mode (1); -+ if (grub_efi_is_finished) -+ return GRUB_ERR_BAD_DEVICE; -+ -+ if (text_mode_available != -1) -+ return text_mode_available ? 0 : GRUB_ERR_BAD_DEVICE; -+ -+ if (! grub_efi_set_text_mode (1)) -+ { -+ /* This really should never happen */ -+ grub_error (GRUB_ERR_BAD_DEVICE, "cannot set text mode"); -+ text_mode_available = 0; -+ return GRUB_ERR_BAD_DEVICE; -+ } -+ - grub_console_setcursor (term, 1); -+ if (text_colorstate != -1) -+ grub_console_setcolorstate (term, text_colorstate); -+ text_mode_available = 1; - return 0; - } - - static grub_err_t - grub_efi_console_output_fini (struct grub_term_output *term) - { -+ if (text_mode_available != 1) -+ return 0; -+ - grub_console_setcursor (term, 0); - grub_efi_set_text_mode (0); -+ text_mode_available = -1; - return 0; - } - -@@ -348,7 +380,6 @@ static struct grub_term_input grub_console_term_input = - static struct grub_term_output grub_console_term_output = - { - .name = "console", -- .init = grub_efi_console_output_init, - .fini = grub_efi_console_output_fini, - .putchar = grub_console_putchar, - .getwh = grub_console_getwh, -@@ -364,14 +395,6 @@ static struct grub_term_output grub_console_term_output = - void - grub_console_init (void) - { -- /* FIXME: it is necessary to consider the case where no console control -- is present but the default is already in text mode. */ -- if (! grub_efi_set_text_mode (1)) -- { -- grub_error (GRUB_ERR_BAD_DEVICE, "cannot set text mode"); -- return; -- } -- - grub_term_register_output ("console", &grub_console_term_output); - grub_term_register_input ("console", &grub_console_term_input); - } diff --git a/0162-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0123-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 97% rename from 0162-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0123-Make-the-menu-entry-users-option-argument-to-be-opti.patch index d560ec9a..e0d36db7 100644 --- a/0162-Make-the-menu-entry-users-option-argument-to-be-opti.patch +++ b/0123-Make-the-menu-entry-users-option-argument-to-be-opti.patch @@ -23,7 +23,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index 9faf2be0f64..29736f5cd03 100644 +index b194123eb67..b175a1b43b7 100644 --- a/grub-core/commands/menuentry.c +++ b/grub-core/commands/menuentry.c @@ -29,7 +29,7 @@ static const struct grub_arg_option options[] = diff --git a/0163-Add-efi-export-env-and-efi-load-env-commands.patch b/0124-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 91% rename from 0163-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0124-Add-efi-export-env-and-efi-load-env-commands.patch index 9b2ab56c..73456bc9 100644 --- a/0163-Add-efi-export-env-and-efi-load-env-commands.patch +++ b/0124-Add-efi-export-env-and-efi-load-env-commands.patch @@ -14,18 +14,17 @@ Signed-off-by: Peter Jones grub-core/kern/efi/efi.c | 3 + grub-core/kern/efi/init.c | 5 -- grub-core/lib/envblk.c | 43 +++++++++++ - util/editenv.c | 2 - util/grub-set-bootflag.c | 1 + include/grub/efi/efi.h | 5 ++ include/grub/lib/envblk.h | 3 + - 9 files changed, 229 insertions(+), 7 deletions(-) + 8 files changed, 229 insertions(+), 5 deletions(-) create mode 100644 grub-core/commands/efi/env.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 65ca74f9ad9..661994686e6 100644 +index 1e15345107e..81fc274148e 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -817,6 +817,12 @@ module = { +@@ -820,6 +820,12 @@ module = { enable = efi; }; @@ -40,7 +39,7 @@ index 65ca74f9ad9..661994686e6 100644 efi = commands/efi/efifwsetup.c; diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c new file mode 100644 -index 00000000000..a69079786aa +index 00000000000..cbd13e03e81 --- /dev/null +++ b/grub-core/commands/efi/env.c @@ -0,0 +1,168 @@ @@ -96,8 +95,8 @@ index 00000000000..a69079786aa + if (argc != 1) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable name expected")); + -+ envblk_s.buf = grub_efi_get_variable ("GRUB_ENV", &grub_env_guid, -+ &envblk_s.size); ++ grub_efi_get_variable ("GRUB_ENV", &grub_env_guid, &envblk_s.size, ++ (void **) &envblk_s.buf); + if (!envblk_s.buf || envblk_s.size < 1) + { + char *buf = grub_malloc (1025); @@ -185,8 +184,8 @@ index 00000000000..a69079786aa + struct grub_envblk envblk_s = { NULL, 0 }; + grub_envblk_t envblk = &envblk_s; + -+ envblk_s.buf = grub_efi_get_variable ("GRUB_ENV", &grub_env_guid, -+ &envblk_s.size); ++ grub_efi_get_variable ("GRUB_ENV", &grub_env_guid, &envblk_s.size, ++ (void **) &envblk_s.buf); + if (!envblk_s.buf || envblk_s.size < 1) + return 0; + @@ -213,10 +212,10 @@ index 00000000000..a69079786aa + grub_unregister_command (loadenv_cmd); +} diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index ada3004cfba..279394d85eb 100644 +index 2a446f5031b..14bc10eb564 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -224,6 +224,9 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid, +@@ -225,6 +225,9 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid, if (status == GRUB_EFI_SUCCESS) return GRUB_ERR_NONE; @@ -227,10 +226,10 @@ index ada3004cfba..279394d85eb 100644 } diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index e6183a4c44d..d1afa3af11e 100644 +index 2d12e6188fd..0574d8d6217 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c -@@ -29,11 +29,6 @@ +@@ -85,11 +85,6 @@ stack_protector_init (void) grub_addr_t grub_modbase; @@ -243,7 +242,7 @@ index e6183a4c44d..d1afa3af11e 100644 static int set_var (const char *name, const char *value, diff --git a/grub-core/lib/envblk.c b/grub-core/lib/envblk.c -index 230e0e9d9ab..f89d86d4e8d 100644 +index 2e4e78b132d..874506da169 100644 --- a/grub-core/lib/envblk.c +++ b/grub-core/lib/envblk.c @@ -223,6 +223,49 @@ grub_envblk_delete (grub_envblk_t envblk, const char *name) @@ -296,19 +295,6 @@ index 230e0e9d9ab..f89d86d4e8d 100644 void grub_envblk_iterate (grub_envblk_t envblk, void *hook_data, -diff --git a/util/editenv.c b/util/editenv.c -index 1f7f6f3ae18..66f99f988ff 100644 ---- a/util/editenv.c -+++ b/util/editenv.c -@@ -30,8 +30,6 @@ - #include - #include - --#define DEFAULT_ENVBLK_SIZE 1024 -- - void - grub_util_create_envblk_file (const char *name) - { diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c index bb198f02351..6a79ee67444 100644 --- a/util/grub-set-bootflag.c @@ -322,7 +308,7 @@ index bb198f02351..6a79ee67444 100644 #include #include diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 8ca3981d7a1..d24afbadbf6 100644 +index 2e0691454b1..8dfc89a33b9 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -24,6 +24,11 @@ diff --git a/0124-EFI-console-Add-grub_console_read_key_stroke-helper-.patch b/0124-EFI-console-Add-grub_console_read_key_stroke-helper-.patch deleted file mode 100644 index 6da36b26..00000000 --- a/0124-EFI-console-Add-grub_console_read_key_stroke-helper-.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Wed, 6 Jun 2018 15:54:44 +0200 -Subject: [PATCH] EFI: console: Add grub_console_read_key_stroke() helper - function - -This is a preparation patch for adding getkeystatus() support to the -EFI console terminal input driver. - -We can get modifier status through the simple_text_input read_key_stroke -method, but if a non-modifier key is (also) pressed the read_key_stroke -call will consume that key from the firmware's queue. - -The new grub_console_read_key_stroke() helper buffers upto 1 key-stroke. -If it has a non-modifier key buffered, it will return that one, if its -buffer is empty, it will fills its buffer by getting a new key-stroke. - -If called with consume=1 it will empty its buffer after copying the -key-data to the callers buffer, this is how getkey() will use it. - -If called with consume=0 it will keep the last key-stroke buffered, this -is how getkeystatus() will call it. This means that if a non-modifier -key gets pressed, repeated getkeystatus() calls will return the modifiers -of that key-press until it is consumed by a getkey() call. - -Signed-off-by: Hans de Goede ---- - grub-core/term/efi/console.c | 51 ++++++++++++++++++++++++++++++++++---------- - 1 file changed, 40 insertions(+), 11 deletions(-) - -diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index 051633d71e9..3d36c5c701b 100644 ---- a/grub-core/term/efi/console.c -+++ b/grub-core/term/efi/console.c -@@ -157,27 +157,56 @@ grub_console_getkey_con (struct grub_term_input *term __attribute__ ((unused))) - return grub_efi_translate_key(key); - } - -+/* -+ * When more then just modifiers are pressed, our getkeystatus() consumes a -+ * press from the queue, this function buffers the press for the regular -+ * getkey() so that it does not get lost. -+ */ -+static int -+grub_console_read_key_stroke ( -+ grub_efi_simple_text_input_ex_interface_t *text_input, -+ grub_efi_key_data_t *key_data_ret, int *key_ret, -+ int consume) -+{ -+ static grub_efi_key_data_t key_data; -+ grub_efi_status_t status; -+ int key; -+ -+ if (!text_input) -+ return GRUB_ERR_EOF; -+ -+ key = grub_efi_translate_key (key_data.key); -+ if (key == GRUB_TERM_NO_KEY) { -+ status = efi_call_2 (text_input->read_key_stroke, text_input, &key_data); -+ if (status != GRUB_EFI_SUCCESS) -+ return GRUB_ERR_EOF; -+ -+ key = grub_efi_translate_key (key_data.key); -+ } -+ -+ *key_data_ret = key_data; -+ *key_ret = key; -+ -+ if (consume) { -+ key_data.key.scan_code = 0; -+ key_data.key.unicode_char = 0; -+ } -+ -+ return 0; -+} -+ - static int - grub_console_getkey_ex(struct grub_term_input *term) - { - grub_efi_key_data_t key_data; -- grub_efi_status_t status; - grub_efi_uint32_t kss; - int key = -1; - -- grub_efi_simple_text_input_ex_interface_t *text_input = term->data; -- -- status = efi_call_2 (text_input->read_key_stroke, text_input, &key_data); -- -- if (status != GRUB_EFI_SUCCESS) -+ if (grub_console_read_key_stroke (term->data, &key_data, &key, 1) || -+ key == GRUB_TERM_NO_KEY) - return GRUB_TERM_NO_KEY; - - kss = key_data.key_state.key_shift_state; -- key = grub_efi_translate_key(key_data.key); -- -- if (key == GRUB_TERM_NO_KEY) -- return GRUB_TERM_NO_KEY; -- - if (kss & GRUB_EFI_SHIFT_STATE_VALID) - { - if ((kss & GRUB_EFI_LEFT_SHIFT_PRESSED diff --git a/0125-EFI-console-Implement-getkeystatus-support.patch b/0125-EFI-console-Implement-getkeystatus-support.patch deleted file mode 100644 index 74fa2536..00000000 --- a/0125-EFI-console-Implement-getkeystatus-support.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Wed, 6 Jun 2018 16:16:47 +0200 -Subject: [PATCH] EFI: console: Implement getkeystatus() support - -Implement getkeystatus() support. - -Note that if a non-modifier key gets pressed and repeated calls to -getkeystatus() are made then it will return the modifier status at the -time of the non-modifier key, until that key-press gets consumed by a -getkey() call. - -This is a side-effect of how the EFI simple-text-input protocol works -and cannot be avoided. - -Signed-off-by: Hans de Goede ---- - grub-core/term/efi/console.c | 34 ++++++++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - -diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index 3d36c5c701b..92dd4996bb7 100644 ---- a/grub-core/term/efi/console.c -+++ b/grub-core/term/efi/console.c -@@ -223,6 +223,39 @@ grub_console_getkey_ex(struct grub_term_input *term) - return key; - } - -+static int -+grub_console_getkeystatus(struct grub_term_input *term) -+{ -+ grub_efi_key_data_t key_data; -+ grub_efi_uint32_t kss; -+ int key, mods = 0; -+ -+ if (grub_efi_is_finished) -+ return 0; -+ -+ if (grub_console_read_key_stroke (term->data, &key_data, &key, 0)) -+ return 0; -+ -+ kss = key_data.key_state.key_shift_state; -+ if (kss & GRUB_EFI_SHIFT_STATE_VALID) -+ { -+ if (kss & GRUB_EFI_LEFT_SHIFT_PRESSED) -+ mods |= GRUB_TERM_STATUS_LSHIFT; -+ if (kss & GRUB_EFI_RIGHT_SHIFT_PRESSED) -+ mods |= GRUB_TERM_STATUS_RSHIFT; -+ if (kss & GRUB_EFI_LEFT_ALT_PRESSED) -+ mods |= GRUB_TERM_STATUS_LALT; -+ if (kss & GRUB_EFI_RIGHT_ALT_PRESSED) -+ mods |= GRUB_TERM_STATUS_RALT; -+ if (kss & GRUB_EFI_LEFT_CONTROL_PRESSED) -+ mods |= GRUB_TERM_STATUS_LCTRL; -+ if (kss & GRUB_EFI_RIGHT_CONTROL_PRESSED) -+ mods |= GRUB_TERM_STATUS_RCTRL; -+ } -+ -+ return mods; -+} -+ - static grub_err_t - grub_efi_console_input_init (struct grub_term_input *term) - { -@@ -403,6 +436,7 @@ static struct grub_term_input grub_console_term_input = - { - .name = "console", - .getkey = grub_console_getkey, -+ .getkeystatus = grub_console_getkeystatus, - .init = grub_efi_console_input_init, - }; - diff --git a/0164-Make-it-possible-to-subtract-conditions-from-debug.patch b/0125-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 95% rename from 0164-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0125-Make-it-possible-to-subtract-conditions-from-debug.patch index c281ef62..fce51eac 100644 --- a/0164-Make-it-possible-to-subtract-conditions-from-debug.patch +++ b/0125-Make-it-possible-to-subtract-conditions-from-debug.patch @@ -14,10 +14,10 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index e21dd44c7cf..18a7dbf4cd7 100644 +index 9a2fae6398e..578bf51a5fc 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -163,12 +163,24 @@ int +@@ -164,12 +164,24 @@ int grub_debug_enabled (const char * condition) { const char *debug; diff --git a/0165-Export-all-variables-from-the-initial-context-when-c.patch b/0126-Export-all-variables-from-the-initial-context-when-c.patch similarity index 100% rename from 0165-Export-all-variables-from-the-initial-context-when-c.patch rename to 0126-Export-all-variables-from-the-initial-context-when-c.patch diff --git a/0126-Make-grub_getkeystatus-helper-funtion-available-ever.patch b/0126-Make-grub_getkeystatus-helper-funtion-available-ever.patch deleted file mode 100644 index 9840a558..00000000 --- a/0126-Make-grub_getkeystatus-helper-funtion-available-ever.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Wed, 6 Jun 2018 16:47:11 +0200 -Subject: [PATCH] Make grub_getkeystatus helper funtion available everywhere - -Move the grub_getkeystatus helper function from -grub-core/commands/keystatus.c to grub-core/kern/term.c -and export it so that it can be used outside of the -keystatus command code too. - -Signed-off-by: Hans de Goede ---- - grub-core/commands/keystatus.c | 18 ------------------ - grub-core/kern/term.c | 18 ++++++++++++++++++ - include/grub/term.h | 1 + - 3 files changed, 19 insertions(+), 18 deletions(-) - -diff --git a/grub-core/commands/keystatus.c b/grub-core/commands/keystatus.c -index 460cf4e7e50..ff3f5878163 100644 ---- a/grub-core/commands/keystatus.c -+++ b/grub-core/commands/keystatus.c -@@ -35,24 +35,6 @@ static const struct grub_arg_option options[] = - {0, 0, 0, 0, 0, 0} - }; - --static int --grub_getkeystatus (void) --{ -- int status = 0; -- grub_term_input_t term; -- -- if (grub_term_poll_usb) -- grub_term_poll_usb (0); -- -- FOR_ACTIVE_TERM_INPUTS(term) -- { -- if (term->getkeystatus) -- status |= term->getkeystatus (term); -- } -- -- return status; --} -- - static grub_err_t - grub_cmd_keystatus (grub_extcmd_context_t ctxt, - int argc __attribute__ ((unused)), -diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c -index 07720ee6746..93bd3378d18 100644 ---- a/grub-core/kern/term.c -+++ b/grub-core/kern/term.c -@@ -120,6 +120,24 @@ grub_getkey (void) - } - } - -+int -+grub_getkeystatus (void) -+{ -+ int status = 0; -+ grub_term_input_t term; -+ -+ if (grub_term_poll_usb) -+ grub_term_poll_usb (0); -+ -+ FOR_ACTIVE_TERM_INPUTS(term) -+ { -+ if (term->getkeystatus) -+ status |= term->getkeystatus (term); -+ } -+ -+ return status; -+} -+ - void - grub_refresh (void) - { -diff --git a/include/grub/term.h b/include/grub/term.h -index 8117e2a24da..c215133383f 100644 ---- a/include/grub/term.h -+++ b/include/grub/term.h -@@ -327,6 +327,7 @@ grub_term_unregister_output (grub_term_output_t term) - void grub_putcode (grub_uint32_t code, struct grub_term_output *term); - int EXPORT_FUNC(grub_getkey) (void); - int EXPORT_FUNC(grub_getkey_noblock) (void); -+int EXPORT_FUNC(grub_getkeystatus) (void); - void grub_cls (void); - void EXPORT_FUNC(grub_refresh) (void); - void grub_puts_terminal (const char *str, struct grub_term_output *term); diff --git a/0127-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch b/0127-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch deleted file mode 100644 index e62a619e..00000000 --- a/0127-Accept-ESC-F8-and-holding-SHIFT-as-user-interrupt-ke.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Mon, 26 Mar 2018 16:15:53 +0200 -Subject: [PATCH] Accept ESC, F8 and holding SHIFT as user interrupt keys - -On some devices the ESC key is the hotkey to enter the BIOS/EFI setup -screen, making it really hard to time pressing it right. Besides that -ESC is also pretty hard to discover for a user who does not know it -will unhide the menu. - -This commit makes F8, which used to be the hotkey to show the Windows -boot menu during boot for a long long time, also interrupt sleeps / -stop the menu countdown. - -This solves the ESC gets into the BIOS setup and also somewhat solves -the discoverability issue, but leaves the timing issue unresolved. - -This commit fixes the timing issue by also adding support for keeping -SHIFT pressed during boot to stop the menu countdown. This matches -what Ubuntu is doing, which should also help with discoverability. - -Signed-off-by: Hans de Goede ---- - grub-core/commands/sleep.c | 2 +- - grub-core/kern/term.c | 16 ++++++++++++++++ - grub-core/normal/menu.c | 2 +- - include/grub/term.h | 1 + - 4 files changed, 19 insertions(+), 2 deletions(-) - -diff --git a/grub-core/commands/sleep.c b/grub-core/commands/sleep.c -index e77e7900fac..a1370b710c9 100644 ---- a/grub-core/commands/sleep.c -+++ b/grub-core/commands/sleep.c -@@ -55,7 +55,7 @@ grub_interruptible_millisleep (grub_uint32_t ms) - start = grub_get_time_ms (); - - while (grub_get_time_ms () - start < ms) -- if (grub_getkey_noblock () == GRUB_TERM_ESC) -+ if (grub_key_is_interrupt (grub_getkey_noblock ())) - return 1; - - return 0; -diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c -index 93bd3378d18..6cae4c23e7a 100644 ---- a/grub-core/kern/term.c -+++ b/grub-core/kern/term.c -@@ -138,6 +138,22 @@ grub_getkeystatus (void) - return status; - } - -+int -+grub_key_is_interrupt (int key) -+{ -+ /* ESC sometimes is the BIOS setup hotkey and may be hard to discover, also -+ check F8, which was the key to get the Windows bootmenu for a long time. */ -+ if (key == GRUB_TERM_ESC || key == GRUB_TERM_KEY_F8) -+ return 1; -+ -+ /* Pressing keys at the right time during boot is hard to time, also allow -+ interrupting sleeps / the menu countdown by keeping shift pressed. */ -+ if (grub_getkeystatus() & (GRUB_TERM_STATUS_LSHIFT|GRUB_TERM_STATUS_RSHIFT)) -+ return 1; -+ -+ return 0; -+} -+ - void - grub_refresh (void) - { -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 783bde55b9e..046a1fb2c84 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -655,7 +655,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) - if (entry >= 0) - break; - } -- if (key == GRUB_TERM_ESC) -+ if (grub_key_is_interrupt (key)) - { - timeout = -1; - break; -diff --git a/include/grub/term.h b/include/grub/term.h -index c215133383f..2b079c29b80 100644 ---- a/include/grub/term.h -+++ b/include/grub/term.h -@@ -328,6 +328,7 @@ void grub_putcode (grub_uint32_t code, struct grub_term_output *term); - int EXPORT_FUNC(grub_getkey) (void); - int EXPORT_FUNC(grub_getkey_noblock) (void); - int EXPORT_FUNC(grub_getkeystatus) (void); -+int EXPORT_FUNC(grub_key_is_interrupt) (int key); - void grub_cls (void); - void EXPORT_FUNC(grub_refresh) (void); - void grub_puts_terminal (const char *str, struct grub_term_output *term); diff --git a/0170-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0127-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 98% rename from 0170-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0127-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index 5c6c28e9..9788fd52 100644 --- a/0170-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0127-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -18,10 +18,10 @@ In menu auto hide script, rename last_boot_ok var to menu_hide_ok rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index 2019ebd0207..1fa92caad4d 100644 +index 2e5e05b25f1..11ab2d6fad1 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -458,14 +458,14 @@ script = { +@@ -459,14 +459,14 @@ script = { }; script = { @@ -40,7 +40,7 @@ index 2019ebd0207..1fa92caad4d 100644 installdir = grubconf; }; -@@ -524,6 +524,12 @@ script = { +@@ -518,6 +518,12 @@ script = { condition = COND_HOST_LINUX; }; diff --git a/0171-Fix-systemctl-kexec-exit-status-check.patch b/0128-Fix-systemctl-kexec-exit-status-check.patch similarity index 100% rename from 0171-Fix-systemctl-kexec-exit-status-check.patch rename to 0128-Fix-systemctl-kexec-exit-status-check.patch diff --git a/0172-Print-grub-emu-linux-loader-messages-as-debug.patch b/0129-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 100% rename from 0172-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0129-Print-grub-emu-linux-loader-messages-as-debug.patch diff --git a/0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0130-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 80% rename from 0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0130-Don-t-assume-that-boot-commands-will-only-return-on-.patch index 34cff10f..418a1ef4 100644 --- a/0173-Don-t-assume-that-boot-commands-will-only-return-on-.patch +++ b/0130-Don-t-assume-that-boot-commands-will-only-return-on-.patch @@ -13,11 +13,11 @@ kexec call later succeeds. Signed-off-by: Javier Martinez Canillas --- - grub-core/normal/menu.c | 19 +++++++++++-------- - 1 file changed, 11 insertions(+), 8 deletions(-) + grub-core/normal/menu.c | 23 +++++++++++++---------- + 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d4832f17699..9ea1f411814 100644 +index d4832f17699..14ceb9bb060 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -285,7 +285,7 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) @@ -29,6 +29,24 @@ index d4832f17699..9ea1f411814 100644 grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) { grub_err_t err = GRUB_ERR_NONE; +@@ -302,7 +302,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) + { + grub_print_error (); + grub_errno = GRUB_ERR_NONE; +- return; ++ return grub_errno; + } + + errs_before = grub_err_printed_errors; +@@ -315,7 +315,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) + grub_env_context_open (); + menu = grub_zalloc (sizeof (*menu)); + if (! menu) +- return; ++ return grub_errno; + grub_env_set_menu (menu); + if (auto_boot) + grub_env_set ("timeout", "0"); @@ -385,7 +385,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ()) diff --git a/0130-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch b/0130-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch deleted file mode 100644 index e461de9b..00000000 --- a/0130-Output-a-menu-entry-for-firmware-setup-on-UEFI-FastB.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Steve Langasek -Date: Mon, 13 Jan 2014 12:13:12 +0000 -Subject: [PATCH] Output a menu entry for firmware setup on UEFI FastBoot - systems - -If fastboot is enabled in the BIOS then often it is not possible to -enter the firmware setup menu, add a menu entry for this. - -hdegoede: Cherry picked the Ubuntu patch from: -https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu/tree/debian/patches/uefi_firmware_setup.patch -Into the Fedora / RH grub version - -According to: -https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu/tree/debian/copyright -The patch is licensed under GPL-3+ - -[hdegoede: fix use with /sys/firmware/efi/efivars] -Signed-off-by: Hans de Goede ---- - Makefile.util.def | 6 ++++++ - util/grub.d/30_uefi-firmware.in | 46 +++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 52 insertions(+) - create mode 100644 util/grub.d/30_uefi-firmware.in - -diff --git a/Makefile.util.def b/Makefile.util.def -index 026b458bb85..89a9da1b9f7 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -545,6 +545,12 @@ script = { - installdir = grubconf; - }; - -+script = { -+ name = '30_uefi-firmware'; -+ common = util/grub.d/30_uefi-firmware.in; -+ installdir = grubconf; -+}; -+ - script = { - name = '40_custom'; - common = util/grub.d/40_custom.in; -diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in -new file mode 100644 -index 00000000000..93ececffea7 ---- /dev/null -+++ b/util/grub.d/30_uefi-firmware.in -@@ -0,0 +1,46 @@ -+#! /bin/sh -+set -e -+ -+# grub-mkconfig helper script. -+# Copyright (C) 2012 Free Software Foundation, Inc. -+# -+# GRUB is free software: you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation, either version 3 of the License, or -+# (at your option) any later version. -+# -+# GRUB is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with GRUB. If not, see . -+ -+prefix="@prefix@" -+exec_prefix="@exec_prefix@" -+datarootdir="@datarootdir@" -+ -+export TEXTDOMAIN=@PACKAGE@ -+export TEXTDOMAINDIR="@localedir@" -+ -+. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+ -+efi_vars_dir=/sys/firmware/efi/efivars -+EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c -+OsIndications="$efi_vars_dir/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE" -+ -+if [ -e "$OsIndications" ] && \ -+ [ "$(( $(printf 0x%x \'"$(cat $OsIndications | cut -b5)") & 1 ))" = 1 ]; then -+ LABEL="System setup" -+ -+ gettext_printf "Adding boot menu entry for EFI firmware configuration\n" >&2 -+ -+ onstr="$(gettext_printf "(on %s)" "${DEVICE}")" -+ -+ cat << EOF -+menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { -+ fwsetup -+} -+EOF -+fi diff --git a/0174-Fix-undefined-references-for-fdt-when-building-with-.patch b/0131-Fix-undefined-references-for-fdt-when-building-with-.patch similarity index 100% rename from 0174-Fix-undefined-references-for-fdt-when-building-with-.patch rename to 0131-Fix-undefined-references-for-fdt-when-building-with-.patch diff --git a/0175-Do-better-in-bootstrap.conf.patch b/0132-Do-better-in-bootstrap.conf.patch similarity index 95% rename from 0175-Do-better-in-bootstrap.conf.patch rename to 0132-Do-better-in-bootstrap.conf.patch index 3547c784..ec9d8ecc 100644 --- a/0175-Do-better-in-bootstrap.conf.patch +++ b/0132-Do-better-in-bootstrap.conf.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Do better in bootstrap.conf 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf -index 29a6a3e90e2..417cfe405f4 100644 +index 186be9c48ce..9259526e891 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -16,7 +16,13 @@ diff --git a/0176-Use-git-to-apply-gnulib-patches.patch b/0133-Use-git-to-apply-gnulib-patches.patch similarity index 70% rename from 0176-Use-git-to-apply-gnulib-patches.patch rename to 0133-Use-git-to-apply-gnulib-patches.patch index 0813badb..76546488 100644 --- a/0176-Use-git-to-apply-gnulib-patches.patch +++ b/0133-Use-git-to-apply-gnulib-patches.patch @@ -5,32 +5,95 @@ Subject: [PATCH] Use git to apply gnulib patches. Signed-off-by: Peter Jones --- - bootstrap.conf | 4 - + bootstrap.conf | 6 - + conf/Makefile.extra-dist | 10 - + grub-core/lib/gnulib-patches/fix-base64.patch | 21 -- grub-core/lib/gnulib-patches/fix-null-deref.patch | 13 -- + .../lib/gnulib-patches/fix-null-state-deref.patch | 12 -- + .../gnulib-patches/fix-regcomp-uninit-token.patch | 15 -- + .../gnulib-patches/fix-regexec-null-deref.patch | 12 -- .../gnulib-patches/fix-sign-compare-errors.patch | 161 --------------- + .../lib/gnulib-patches/fix-uninit-structure.patch | 11 -- + .../lib/gnulib-patches/fix-unused-value.patch | 14 -- grub-core/lib/gnulib-patches/fix-width.patch | 217 --------------------- grub-core/lib/gnulib-patches/no-abort.patch | 26 --- - 5 files changed, 421 deletions(-) + 12 files changed, 518 deletions(-) + delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch delete mode 100644 grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch delete mode 100644 grub-core/lib/gnulib-patches/fix-width.patch delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch diff --git a/bootstrap.conf b/bootstrap.conf -index 417cfe405f4..24ea40b2fc5 100644 +index 9259526e891..452f4d79b0d 100644 --- a/bootstrap.conf +++ b/bootstrap.conf -@@ -84,10 +84,6 @@ cp -a INSTALL INSTALL.grub +@@ -85,12 +85,6 @@ cp -a INSTALL INSTALL.grub bootstrap_post_import_hook () { set -e -- for patchname in fix-null-deref fix-width no-abort fix-sign-compare-errors; do +- for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ +- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort \ +- fix-sign-compare-errors; do - patch -d grub-core/lib/gnulib -p2 \ - < "grub-core/lib/gnulib-patches/$patchname.patch" - done - for flagvar in CPPFLAGS CFLAGS; do - sed -i -e "s/^AM_$flagvar =/AM_$flagvar = \$(HOST_$flagvar)/" grub-core/lib/gnulib/Makefile.am - done + for patchname in \ + 0001-Support-POTFILES-shell \ + 0002-Handle-gettext_printf-shell-function \ +diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist +index ea58362b555..8ddf22e6c99 100644 +--- a/conf/Makefile.extra-dist ++++ b/conf/Makefile.extra-dist +@@ -30,16 +30,6 @@ EXTRA_DIST += grub-core/gensymlist.sh + EXTRA_DIST += grub-core/genemuinit.sh + EXTRA_DIST += grub-core/genemuinitheader.sh + +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch +- + EXTRA_DIST += grub-core/lib/libgcrypt + EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic + EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h') +diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch +deleted file mode 100644 +index 985db127971..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-base64.patch ++++ /dev/null +@@ -1,21 +0,0 @@ +-diff --git a/lib/base64.h b/lib/base64.h +-index 9cd0183b8..185a2afa1 100644 +---- a/lib/base64.h +-+++ b/lib/base64.h +-@@ -21,8 +21,14 @@ +- /* Get size_t. */ +- # include +- +--/* Get bool. */ +--# include +-+#ifndef GRUB_POSIX_BOOL_DEFINED +-+typedef enum { false = 0, true = 1 } bool; +-+#define GRUB_POSIX_BOOL_DEFINED 1 +-+#endif +-+ +-+#ifndef _GL_ATTRIBUTE_CONST +-+# define _GL_ATTRIBUTE_CONST /* empty */ +-+#endif +- +- # ifdef __cplusplus +- extern "C" { diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch deleted file mode 100644 index 8fafa153a47..00000000000 @@ -50,6 +113,63 @@ index 8fafa153a47..00000000000 - { - struct group *group; - struct parser *parser = state->pstate; +diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch +deleted file mode 100644 +index 813ec09c8a1..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch ++++ /dev/null +@@ -1,12 +0,0 @@ +---- a/lib/argp-help.c 2020-10-28 14:32:19.189215988 +0000 +-+++ b/lib/argp-help.c 2020-10-28 14:38:21.204673940 +0000 +-@@ -145,7 +145,8 @@ +- if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin) +- { +- __argp_failure (state, 0, 0, +-- dgettext (state->root_argp->argp_domain, +-+ dgettext (state == NULL ? NULL +-+ : state->root_argp->argp_domain, +- "\ +- ARGP_HELP_FMT: %s value is less than or equal to %s"), +- "rmargin", up->name); +diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch +deleted file mode 100644 +index 02e06315dff..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch ++++ /dev/null +@@ -1,15 +0,0 @@ +---- a/lib/regcomp.c 2020-11-24 17:06:08.159223858 +0000 +-+++ b/lib/regcomp.c 2020-11-24 17:06:15.630253923 +0000 +-@@ -3808,11 +3808,7 @@ +- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, +- re_token_type_t type) +- { +-- re_token_t t; +--#if defined GCC_LINT || defined lint +-- memset (&t, 0, sizeof t); +--#endif +-- t.type = type; +-+ re_token_t t = { .type = type }; +- return create_token_tree (dfa, left, right, &t); +- } +- +diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch +deleted file mode 100644 +index db6dac9c9e3..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch ++++ /dev/null +@@ -1,12 +0,0 @@ +---- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 +-+++ b/lib/regexec.c 2020-11-05 10:55:09.621542984 +0000 +-@@ -1692,6 +1692,9 @@ +- { +- Idx top = mctx->state_log_top; +- +-+ if (mctx->state_log == NULL) +-+ return REG_NOERROR; +-+ +- if ((next_state_log_idx >= mctx->input.bufs_len +- && mctx->input.bufs_len < mctx->input.len) +- || (next_state_log_idx >= mctx->input.valid_len diff --git a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch b/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch deleted file mode 100644 index 479029c0565..00000000000 @@ -217,6 +337,43 @@ index 479029c0565..00000000000 - mctx->max_mb_elem_len = to - from; - return REG_NOERROR; - } +diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch +deleted file mode 100644 +index 7b4d9f67af4..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch ++++ /dev/null +@@ -1,11 +0,0 @@ +---- a/lib/regcomp.c 2020-10-22 13:49:06.770168928 +0000 +-+++ b/lib/regcomp.c 2020-10-22 13:50:37.026528298 +0000 +-@@ -3662,7 +3662,7 @@ +- Idx alloc = 0; +- #endif /* not RE_ENABLE_I18N */ +- reg_errcode_t ret; +-- re_token_t br_token; +-+ re_token_t br_token = {0}; +- bin_tree_t *tree; +- +- sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); +diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch +deleted file mode 100644 +index ba51f1bf223..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-unused-value.patch ++++ /dev/null +@@ -1,14 +0,0 @@ +---- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 +-+++ b/lib/regexec.c 2020-10-21 14:32:07.961765604 +0000 +-@@ -828,7 +828,11 @@ +- break; +- if (__glibc_unlikely (err != REG_NOMATCH)) +- goto free_return; +-+#ifdef DEBUG +-+ /* Only used for assertion below when DEBUG is set, otherwise +-+ it will be over-written when we loop around. */ +- match_last = -1; +-+#endif +- } +- else +- break; /* We found a match. */ diff --git a/grub-core/lib/gnulib-patches/fix-width.patch b/grub-core/lib/gnulib-patches/fix-width.patch deleted file mode 100644 index 0a208ad08b5..00000000000 diff --git a/0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch b/0134-Fix-build-error-with-the-fdt-module-on-risc-v.patch similarity index 100% rename from 0179-Fix-build-error-with-the-fdt-module-on-risc-v.patch rename to 0134-Fix-build-error-with-the-fdt-module-on-risc-v.patch diff --git a/0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0135-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0186-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0135-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0136-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0187-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0136-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0137-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 100% rename from 0189-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0137-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch b/0138-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch similarity index 100% rename from 0192-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch rename to 0138-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch diff --git a/0193-chainloader-Define-machine-types-for-RISC-V.patch b/0139-chainloader-Define-machine-types-for-RISC-V.patch similarity index 91% rename from 0193-chainloader-Define-machine-types-for-RISC-V.patch rename to 0139-chainloader-Define-machine-types-for-RISC-V.patch index 2ec71003..480db52d 100644 --- a/0193-chainloader-Define-machine-types-for-RISC-V.patch +++ b/0139-chainloader-Define-machine-types-for-RISC-V.patch @@ -15,10 +15,10 @@ Signed-off-by: David Abdurachmanov 1 file changed, 4 insertions(+) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index f4ddbeda687..2c529f71471 100644 +index 47f5aa14817..ac8dfd40c61 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -316,6 +316,10 @@ static const grub_uint16_t machine_type __attribute__((__unused__)) = +@@ -333,6 +333,10 @@ static const grub_uint16_t machine_type __attribute__((__unused__)) = GRUB_PE32_MACHINE_I386; #elif defined(__ia64__) GRUB_PE32_MACHINE_IA64; diff --git a/0194-Add-start-symbol-for-RISC-V.patch b/0140-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0194-Add-start-symbol-for-RISC-V.patch rename to 0140-Add-start-symbol-for-RISC-V.patch diff --git a/0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0141-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 86% rename from 0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0141-bootstrap.conf-Force-autogen.sh-to-use-python3.patch index d63a24ef..5c3b968b 100644 --- a/0198-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +++ b/0141-bootstrap.conf-Force-autogen.sh-to-use-python3.patch @@ -19,13 +19,13 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf -index 274c55a5568..5665c83351d 100644 +index 452f4d79b0d..03f10930230 100644 --- a/bootstrap.conf +++ b/bootstrap.conf -@@ -84,7 +84,7 @@ cp -a INSTALL INSTALL.grub - - bootstrap_post_import_hook () { - set -e +@@ -93,7 +93,7 @@ bootstrap_post_import_hook () { + patch -d po -p3 \ + < "po/gettext-patches/$patchname.patch" + done - FROM_BOOTSTRAP=1 ./autogen.sh + PYTHON=python3 FROM_BOOTSTRAP=1 ./autogen.sh set +e # bootstrap expects this diff --git a/0141-strip-R-.note.gnu.property-at-more-places.patch b/0141-strip-R-.note.gnu.property-at-more-places.patch deleted file mode 100644 index d5684227..00000000 --- a/0141-strip-R-.note.gnu.property-at-more-places.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 3 Aug 2018 15:07:23 -0400 -Subject: [PATCH] strip "-R .note.gnu.property" at more places. - -For whatever reason, sometimes I see: - - lzma_decompress.image: file format elf32-i386 - lzma_decompress.image - architecture: i386, flags 0x00000012: - EXEC_P, HAS_SYMS - start address 0x00008200 - - Program Header: - LOAD off 0x000000c0 vaddr 0x00008200 paddr 0x00008200 align 2**5 - filesz 0x00000b10 memsz 0x00000b10 flags rwx - LOAD off 0x00000bd0 vaddr 0x080480b4 paddr 0x080480b4 align 2**2 - filesz 0x0000001c memsz 0x0000001c flags r-- - NOTE off 0x00000bd0 vaddr 0x080480b4 paddr 0x080480b4 align 2**2 - filesz 0x0000001c memsz 0x0000001c flags r-- - STACK off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**4 - filesz 0x00000000 memsz 0x00000000 flags rw- - - Sections: - Idx Name Size VMA LMA File off Algn - 0 .note.gnu.property 0000001c 080480b4 080480b4 00000bd0 2**2 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 1 .text 00000b10 00008200 00008200 000000c0 2**5 - CONTENTS, ALLOC, LOAD, CODE - SYMBOL TABLE: - 080480b4 l d .note.gnu.property 00000000 .note.gnu.property - 00008200 l d .text 00000000 .text - 00000000 l df *ABS* 00000000 startup_raw.S - ... - -Which just looks wrong no matter what to my eyes (seriously it's at -128M? Why?), and when we fail to strip it, we get: - -trillian:~/tmp/f29$ hexdump -C usr/lib/grub/i386-pc/lzma_decompress.img | tail -6 -00000b00 ff 45 e8 5a 83 c2 02 89 d1 e9 df fe ff ff 66 90 |.E.Z..........f.| -00000b10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -* -0803feb0 00 00 00 00 04 00 00 00 0c 00 00 00 05 00 00 00 |................| -0803fec0 47 4e 55 00 02 00 00 c0 04 00 00 00 03 00 00 00 |GNU.............| -0803fed0 - -Which is very very much not what we want. - -Cut it out. - -Signed-off-by: Peter Jones ---- - Makefile.am | 2 +- - gentpl.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index bf9c1ba64c9..0d4dd7c2e90 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -209,7 +209,7 @@ pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub- - $(TARGET_CC) -o $@ $< -static -DTARGET_CHAINLOADER=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x7c00 -m32 - - pc-chainloader.bin: pc-chainloader.elf -- $(TARGET_OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; -+ $(TARGET_OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property $< $@; - - ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S - $(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0 -m32 -diff --git a/gentpl.py b/gentpl.py -index 95fe1a24d8a..32cf7456b72 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -779,7 +779,7 @@ def image(defn, platform): - if test x$(TARGET_APPLE_LINKER) = x1; then \ - $(MACHO2IMG) $< $@; \ - else \ -- $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; \ -+ $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx -R .note.gnu.property $< $@; \ - fi - """) - diff --git a/0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 95% rename from 0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch index 1f857605..74183bc3 100644 --- a/0199-efi-http-Export-fw-http-_path-variables-to-make-them.patch +++ b/0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch @@ -25,10 +25,10 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 2 insertions(+) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index dcf48726d54..9bf6a8b231a 100644 +index 1c540fc8c26..b573be6650d 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c -@@ -142,6 +142,7 @@ grub_set_prefix_and_root (void) +@@ -143,6 +143,7 @@ grub_set_prefix_and_root (void) if (fw_path) { grub_env_set ("fw_path", fw_path); diff --git a/0143-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch b/0143-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch deleted file mode 100644 index a3c32139..00000000 --- a/0143-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 16 Aug 2018 11:08:11 -0400 -Subject: [PATCH] Make linux_arm_kernel_header.hdr_offset be at the right place - -The kernel in front of me (slightly edited to make objdump work) looks like: - -00000000 4d 5a 10 13 4d 5a 10 13 4d 5a 10 13 4d 5a 10 13 |MZ..MZ..MZ..MZ..| -00000010 4d 5a 10 13 4d 5a 10 13 4d 5a 10 13 00 00 a0 e1 |MZ..MZ..MZ......| -00000020 f6 03 00 ea 18 28 6f 01 00 00 00 00 00 32 74 00 |.....(o......2t.| -00000030 01 02 03 04 45 45 45 45 74 a2 00 00 40 00 00 00 |....EEEEt...@...| -00000040 50 45 00 00 4c 01 04 00 00 00 00 00 00 00 00 00 |PE..L...........| -00000050 00 00 00 00 90 00 06 03 0b 01 02 14 00 20 74 00 |............. t.| -00000060 00 14 00 00 00 00 00 00 b4 19 00 00 00 10 00 00 |................| -00000070 00 30 74 00 00 00 00 00 00 10 00 00 00 02 00 00 |.0t.............| -00000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000090 00 44 74 00 00 10 00 00 00 00 00 00 0a 00 00 00 |.Dt.............| -000000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -000000b0 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 |................| -000000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -* - -(I don't know why the MZ header is there 7 times, but the offsets work out, so -it's merely a surprising distraction.) - -If linux_arm_kernel_header.reserved2 is 16 bytes, that means hdr_offset is -here: - -00000030 01 02 03 04 45 45 45 45 74 a2 00 00 40 00 00 00 |....EEEEt...@...| -00000040 50 45 00 00 4c 01 04 00 00 00 00 00 00 00 00 00 |PE..L...........| - ^^^^^^^^^^^ - -But it's supposed to be 4 bytes before that. - -This patch makes the reserved field be 3*32 instead of 4*32, and that means we -can find the PE header correcrtly at 0x40 by reading the value at 0x3c. - -Signed-off-by: Peter Jones ---- - grub-core/loader/efi/linux.c | 3 +++ - include/grub/arm/linux.h | 2 +- - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 0622dfa48d4..b56ea0bc041 100644 ---- a/grub-core/loader/efi/linux.c -+++ b/grub-core/loader/efi/linux.c -@@ -79,7 +79,10 @@ grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, - offset = 512; - #endif - -+ grub_dprintf ("linux", "kernel_addr: %p handover_offset: %p params: %p\n", -+ kernel_addr, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); - hf = (handover_func)((char *)kernel_addr + handover_offset + offset); -+ grub_dprintf ("linux", "handover_func() = %p\n", hf); - hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); - - return GRUB_ERR_BUG; -diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index 775297db869..b582f67f661 100644 ---- a/include/grub/arm/linux.h -+++ b/include/grub/arm/linux.h -@@ -31,7 +31,7 @@ struct linux_arm_kernel_header { - grub_uint32_t magic; - grub_uint32_t start; /* _start */ - grub_uint32_t end; /* _edata */ -- grub_uint32_t reserved2[4]; -+ grub_uint32_t reserved2[3]; - grub_uint32_t hdr_offset; - }; - diff --git a/0200-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0143-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0200-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0143-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0144-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0201-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0144-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0145-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0202-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0145-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0146-EFI-more-debug-output-on-GOP-and-UGA-probing.patch b/0146-EFI-more-debug-output-on-GOP-and-UGA-probing.patch deleted file mode 100644 index 37d6f4d3..00000000 --- a/0146-EFI-more-debug-output-on-GOP-and-UGA-probing.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 10 Sep 2018 13:01:24 -0400 -Subject: [PATCH] EFI: more debug output on GOP and UGA probing. - -Signed-off-by: Peter Jones ---- - grub-core/video/efi_gop.c | 8 +++++++- - grub-core/video/efi_uga.c | 4 ++-- - 2 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c -index c9e40e8d4e9..be446f8d291 100644 ---- a/grub-core/video/efi_gop.c -+++ b/grub-core/video/efi_gop.c -@@ -71,7 +71,10 @@ check_protocol (void) - handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, - &graphics_output_guid, NULL, &num_handles); - if (!handles || num_handles == 0) -- return 0; -+ { -+ grub_dprintf ("video", "GOP: no handles\n"); -+ return 0; -+ } - - for (i = 0; i < num_handles; i++) - { -@@ -81,6 +84,7 @@ check_protocol (void) - grub_video_gop_iterate (check_protocol_hook, &have_usable_mode); - if (have_usable_mode) - { -+ grub_dprintf ("video", "GOP: found usable mode\n"); - grub_free (handles); - return 1; - } -@@ -89,6 +93,8 @@ check_protocol (void) - gop = 0; - gop_handle = 0; - -+ grub_dprintf ("video", "GOP: no usable mode\n"); -+ - return 0; - } - -diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c -index 97a607c01a5..e74d6c23500 100644 ---- a/grub-core/video/efi_uga.c -+++ b/grub-core/video/efi_uga.c -@@ -110,7 +110,7 @@ find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) - { - int i; - -- grub_dprintf ("fb", "Display controller: %d:%d.%d\nDevice id: %x\n", -+ grub_dprintf ("video", "Display controller: %d:%d.%d\nDevice id: %x\n", - grub_pci_get_bus (dev), grub_pci_get_device (dev), - grub_pci_get_function (dev), pciid); - addr += 8; -@@ -140,7 +140,7 @@ find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) - base64 <<= 32; - base64 |= (old_bar1 & GRUB_PCI_ADDR_MEM_MASK); - -- grub_dprintf ("fb", "%s(%d): 0x%" PRIxGRUB_UINT64_T "\n", -+ grub_dprintf ("video", "%s(%d): 0x%" PRIxGRUB_UINT64_T "\n", - ((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) ? - "VMEM" : "MMIO"), type == GRUB_PCI_ADDR_MEM_TYPE_64 ? i - 1 : i, - base64); diff --git a/0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0146-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0203-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0146-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0147-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0147-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch new file mode 100644 index 00000000..3dd525af --- /dev/null +++ b/0147-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 22 Apr 2020 12:41:52 +0200 +Subject: [PATCH] kern/term: Also accept F8 as a user interrupt key + +Make F8, which used to be the hotkey to show the Windows boot menu during +boot for a long long time, also interrupt sleeps / stop the menu countdown. + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/kern/term.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c +index 14d59649832..4d61f4e9790 100644 +--- a/grub-core/kern/term.c ++++ b/grub-core/kern/term.c +@@ -144,9 +144,10 @@ grub_key_is_interrupt (int key) + /* + * ESC sometimes is the BIOS setup hotkey and may be hard to discover, also + * check F4, which was chosen because is not used as a hotkey to enter the +- * BIOS setup by any vendor. ++ * BIOS setup by any vendor. Also, F8 which was the key to get the Windows ++ * bootmenu for a long time. + */ +- if (key == GRUB_TERM_ESC || key == GRUB_TERM_KEY_F4) ++ if (key == GRUB_TERM_ESC || key == GRUB_TERM_KEY_F4 || key == GRUB_TERM_KEY_F8) + return 1; + + /* diff --git a/0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0148-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 82% rename from 0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0148-efi-Set-image-base-address-before-jumping-to-the-PE-.patch index 36915877..336bcf18 100644 --- a/0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +++ b/0148-efi-Set-image-base-address-before-jumping-to-the-PE-.patch @@ -21,15 +21,15 @@ and print the following warning message: EFI stub: ERROR: FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value -Resolves: rhbz#1825411 +Resolves: rhbz#1814690 Signed-off-by: Javier Martinez Canillas --- - grub-core/loader/efi/linux.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) + grub-core/loader/efi/linux.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index b56ea0bc041..e09f824862b 100644 +index 0622dfa48d4..e8b9ecb17f6 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -72,6 +72,7 @@ grub_err_t @@ -40,7 +40,7 @@ index b56ea0bc041..e09f824862b 100644 handover_func hf; int offset = 0; -@@ -79,6 +80,17 @@ grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, +@@ -79,6 +80,19 @@ grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, offset = 512; #endif @@ -55,6 +55,8 @@ index b56ea0bc041..e09f824862b 100644 + else + grub_dprintf ("linux", "Loaded Image base address could not be set\n"); + - grub_dprintf ("linux", "kernel_addr: %p handover_offset: %p params: %p\n", - kernel_addr, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); ++ grub_dprintf ("linux", "kernel_addr: %p handover_offset: %p params: %p\n", ++ kernel_addr, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); hf = (handover_func)((char *)kernel_addr + handover_offset + offset); + hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); + diff --git a/0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0149-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 90% rename from 0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0149-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch index ca125c64..747773d1 100644 --- a/0216-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +++ b/0149-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch @@ -18,10 +18,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/grub-core/commands/tpm.c b/grub-core/commands/tpm.c -index 1441c494d81..dbaeae46dfa 100644 +index 2052c36eaba..e287d042e6b 100644 --- a/grub-core/commands/tpm.c +++ b/grub-core/commands/tpm.c -@@ -49,7 +49,8 @@ grub_tpm_verify_init (grub_file_t io, +@@ -42,7 +42,8 @@ grub_tpm_verify_init (grub_file_t io, static grub_err_t grub_tpm_verify_write (void *context, void *buf, grub_size_t size) { @@ -31,7 +31,7 @@ index 1441c494d81..dbaeae46dfa 100644 } static grub_err_t -@@ -57,7 +58,6 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type) +@@ -50,7 +51,6 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type) { const char *prefix = NULL; char *description; @@ -39,7 +39,7 @@ index 1441c494d81..dbaeae46dfa 100644 switch (type) { -@@ -73,15 +73,15 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type) +@@ -66,15 +66,15 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type) } description = grub_malloc (grub_strlen (str) + grub_strlen (prefix) + 1); if (!description) diff --git a/0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0150-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 97% rename from 0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0150-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch index fd68d092..825d0f7c 100644 --- a/0219-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +++ b/0150-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 50b7798d6e5..e5b2736b0ce 100644 +index 6bc18d5aef5..15d40d6e35b 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -144,7 +144,7 @@ grub_linuxefi_unload (void) diff --git a/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0151-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 80% rename from 0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0151-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch index 1c5e5990..97d2e06f 100644 --- a/0220-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +++ b/0151-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch @@ -16,22 +16,14 @@ path fails. Signed-off-by: Javier Martinez Canillas --- - grub-core/net/http.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) + grub-core/net/http.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index b52b558d631..598961afbb5 100644 +index b52b558d631..7f878b56157 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -501,13 +502,20 @@ http_open (struct grub_file *file, const char *filename) +@@ -501,13 +501,20 @@ http_open (struct grub_file *file, const char *filename) { grub_err_t err; struct http_data *data; diff --git a/0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0152-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 95% rename from 0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0152-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch index 02528b51..1657d7a8 100644 --- a/0224-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +++ b/0152-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c -index a69079786aa..4838dac22e7 100644 +index cbd13e03e81..977edb6b065 100644 --- a/grub-core/commands/efi/env.c +++ b/grub-core/commands/efi/env.c @@ -149,6 +149,8 @@ grub_efi_load_env(grub_command_t cmd __attribute__ ((unused)), diff --git a/0251-efi-dhcp-fix-some-allocation-error-checking.patch b/0153-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0251-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0153-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0252-efi-http-fix-some-allocation-error-checking.patch b/0154-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0252-efi-http-fix-some-allocation-error-checking.patch rename to 0154-efi-http-fix-some-allocation-error-checking.patch diff --git a/0253-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0155-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0253-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0155-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0156-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 97% rename from 0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0156-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch index 3f0b01d2..95f7e208 100644 --- a/0254-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +++ b/0156-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch @@ -13,7 +13,7 @@ Signed-off-by: Colin Watson 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index e5b2736b0ce..c0a98d152ff 100644 +index 15d40d6e35b..f992ceeef20 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -28,6 +28,8 @@ diff --git a/0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0157-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 90% rename from 0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0157-linuxefi-fail-kernel-validation-without-shim-protoco.patch index 3d046722..20fc7869 100644 --- a/0257-linuxefi-fail-kernel-validation-without-shim-protoco.patch +++ b/0157-linuxefi-fail-kernel-validation-without-shim-protoco.patch @@ -23,7 +23,7 @@ Signed-off-by: Dimitri John Ledkov 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 8791b35b6fe..720eec075cd 100644 +index 70a0075ec5e..47f8cf0d84b 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -34,6 +34,7 @@ @@ -34,13 +34,13 @@ index 8791b35b6fe..720eec075cd 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -383,11 +384,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -363,11 +364,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); - rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size); - if (rc < 0) -+ if (grub_efi_secure_boot ()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) { - grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); - goto fail; @@ -55,10 +55,10 @@ index 8791b35b6fe..720eec075cd 100644 pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 3dfa41bb49d..26f4fa9dc6a 100644 +index ac8dfd40c61..d41e8ea14a8 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -1083,6 +1083,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -1084,6 +1084,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), return 0; } @@ -67,7 +67,7 @@ index 3dfa41bb49d..26f4fa9dc6a 100644 fail: if (dev) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index e09f824862b..927d89a90d7 100644 +index e8b9ecb17f6..9260731c107 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -33,6 +33,7 @@ struct grub_efi_shim_lock @@ -79,7 +79,7 @@ index e09f824862b..927d89a90d7 100644 grub_linuxefi_secure_validate (void *data, grub_uint32_t size) { diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index c0a98d152ff..60ef7d12f07 100644 +index f992ceeef20..3cf0f9b330b 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -30,6 +30,7 @@ @@ -105,7 +105,7 @@ index c0a98d152ff..60ef7d12f07 100644 - rc = grub_linuxefi_secure_validate (kernel, filelen); - if (rc < 0) -+ if (grub_efi_secure_boot ()) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) { - grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), - argv[0]); diff --git a/0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 88% rename from 0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch index b7e55d3f..0bd28c3e 100644 --- a/0260-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +++ b/0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch @@ -14,10 +14,10 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 5a5ebbfb1aa..2658a0cda4e 100644 +index 0b430489329..8f2f55c0079 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c -@@ -365,7 +365,7 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -329,7 +329,7 @@ grub_net_configure_by_dhcp_ack (const char *name, struct grub_net_network_level_interface *inter; int mask = -1; char server_ip[sizeof ("xxx.xxx.xxx.xxx")]; @@ -26,7 +26,7 @@ index 5a5ebbfb1aa..2658a0cda4e 100644 grub_uint8_t opt_len, overload = 0; const char *boot_file = 0, *server_name = 0; grub_size_t boot_file_len, server_name_len; -@@ -572,7 +572,7 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -505,7 +505,7 @@ grub_net_configure_by_dhcp_ack (const char *name, if (opt && opt_len) { grub_env_set_net_property (name, "vendor_class_identifier", (const char *) opt, opt_len); diff --git a/0261-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0159-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0261-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0159-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0160-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0262-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0160-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch b/0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch deleted file mode 100644 index 30c0828a..00000000 --- a/0160-Make-grub_strtol-end-pointers-have-safer-const-quali.patch +++ /dev/null @@ -1,987 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 19 Oct 2018 13:41:48 -0400 -Subject: [PATCH] Make grub_strtol() "end" pointers have safer const - qualifiers. (v2) - -Currently the string functions grub_strtol(), grub_strtoul(), and -grub_strtoull() don't declare the "end" pointer in such a way as to -require the pointer itself or the character array to be immutable to the -implementation, nor does the C standard do so in its similar functions, -though it does require us not to change any of it. - -The typical declarations of these functions follow this pattern: - -long -strtol(const char * restrict nptr, char ** restrict endptr, int base); - -Much of the reason for this is historic, and a discussion of that -follows below, after the explanation of this change. (GRUB currently -does not include the "restrict" qualifiers, and we name the arguments a -bit differently.) - -The implementation is semantically required to treat the character array -as immutable, but such accidental modifications aren't stopped by the -compiler, and the semantics for both the callers and the implementation -of these functions are sometimes also helped by adding that requirement. - -This patch changes these declarations to follow this pattern instead: - -long -strtol(const char * restrict nptr, - const char ** const restrict endptr, - int base); - -This means that if any modification to these functions accidentally -introduces either an errant modification to the underlying character -array, or an accidental assignment to endptr rather than *endptr, the -compiler should generate an error. (The two uses of "restrict" in this -case basically mean strtol() isn't allowed to modify the character array -by going through *endptr, and endptr isn't allowed to point inside the -array.) - -It also means the typical use case changes to: - - char *s = ...; - const char *end; - long l; - - l = strtol(s, &end, 10); - -Or even: - - const char *p = str; - while (p && *p) { - long l = strtol(p, &p, 10); - ... - } - -This fixes 26 places where we discard our attempts at treating the data -safely by doing: - - const char *p = str; - long l; - - l = strtol(p, (char **)&ptr, 10); - -It also adds 5 places where we do: - - char *p = str; - while (p && *p) { - long l = strtol(p, (const char ** const)&p, 10); - ... - /* more calls that need p not to be pointer-to-const */ - } - -While moderately distasteful, this is a better problem to have. - -With one minor exception, I have tested that all of this compiles -without relevant warnings or errors, and that /much/ of it behaves -correctly, with gcc 9 using 'gcc -W -Wall -Wextra'. The one exception -is the changes in grub-core/osdep/aros/hostdisk.c , which I have no idea -how to build. - -Because the C standard defined type-qualifiers in a way that can be -confusing, in the past there's been a slow but fairly regular stream of -churn within our patches, which add and remove the const qualifier in many -of the users of these functions. This change should help avoid that in -the future, and in order to help ensure this, I've added an explanation -in misc.h so that when someone does get a compiler warning about a type -error, they have the fix at hand. - -The reason we don't have "const" in these calls in the standard is -purely anachronistic: C78 (de facto) did not have type qualifiers in the -syntax, and the "const" type qualifier was added for C89 (I think; it -may have been later). strtol() appears to date from 4.3BSD in 1986, -which means it could not be added to those functions in the standard -without breaking compatibility, which is usually avoided. - -The syntax chosen for type qualifiers is what has led to the churn -regarding usage of const, and is especially confusing on string -functions due to the lack of a string type. Quoting from C99, the -syntax is: - - declarator: - pointer[opt] direct-declarator - direct-declarator: - identifier - ( declarator ) - direct-declarator [ type-qualifier-list[opt] assignment-expression[opt] ] - ... - direct-declarator [ type-qualifier-list[opt] * ] - ... - pointer: - * type-qualifier-list[opt] - * type-qualifier-list[opt] pointer - type-qualifier-list: - type-qualifier - type-qualifier-list type-qualifier - ... - type-qualifier: - const - restrict - volatile - -So the examples go like: - -const char foo; // immutable object -const char *foo; // mutable pointer to object -char * const foo; // immutable pointer to mutable object -const char * const foo; // immutable pointer to immutable object -const char const * const foo; // XXX extra const keyword in the middle -const char * const * const foo; // immutable pointer to immutable - // pointer to immutable object -const char ** const foo; // immutable pointer to mutable pointer - // to immutable object - -Making const left-associative for * and right-associative for everything -else may not have been the best choice ever, but here we are, and the -inevitable result is people using trying to use const (as they should!), -putting it at the wrong place, fighting with the compiler for a bit, and -then either removing it or typecasting something in a bad way. I won't -go into describing restrict, but its syntax has exactly the same issue -as with const. - -Anyway, the last example above actually represents the *behavior* that's -required of strtol()-like functions, so that's our choice for the "end" -pointer. - -Signed-off-by: Peter Jones ---- - grub-core/commands/date.c | 3 ++- - grub-core/commands/i386/cmostest.c | 2 +- - grub-core/commands/i386/pc/play.c | 2 +- - grub-core/commands/i386/rdmsr.c | 2 +- - grub-core/commands/i386/wrmsr.c | 2 +- - grub-core/commands/password_pbkdf2.c | 2 +- - grub-core/commands/pcidump.c | 13 ++++++------- - grub-core/commands/regexp.c | 2 +- - grub-core/commands/setpci.c | 21 ++++++++++----------- - grub-core/commands/test.c | 2 +- - grub-core/commands/videoinfo.c | 2 +- - grub-core/disk/diskfilter.c | 3 ++- - grub-core/disk/lvm.c | 9 +++++---- - grub-core/efiemu/pnvram.c | 5 +++-- - grub-core/gfxmenu/gui_circular_progress.c | 2 +- - grub-core/gfxmenu/theme_loader.c | 2 +- - grub-core/kern/fs.c | 2 +- - grub-core/kern/misc.c | 10 ++++++---- - grub-core/kern/partition.c | 2 +- - grub-core/lib/arg.c | 2 +- - grub-core/lib/legacy_parse.c | 2 +- - grub-core/lib/syslinux_parse.c | 6 +++--- - grub-core/loader/i386/bsd.c | 6 +++--- - grub-core/loader/i386/linux.c | 2 +- - grub-core/loader/i386/pc/linux.c | 2 +- - grub-core/loader/i386/xen_fileXX.c | 2 +- - grub-core/mmap/mmap.c | 4 ++-- - grub-core/net/http.c | 4 ++-- - grub-core/net/net.c | 8 ++++---- - grub-core/normal/menu.c | 3 +-- - grub-core/osdep/aros/hostdisk.c | 2 +- - grub-core/osdep/devmapper/hostdisk.c | 2 +- - grub-core/script/execute.c | 6 +++--- - grub-core/term/serial.c | 2 +- - grub-core/term/terminfo.c | 2 +- - grub-core/tests/strtoull_test.c | 2 +- - util/grub-fstest.c | 2 +- - include/grub/misc.h | 24 +++++++++++++++++++++--- - 38 files changed, 96 insertions(+), 75 deletions(-) - -diff --git a/grub-core/commands/date.c b/grub-core/commands/date.c -index 8e1f41f141b..5cb4fafd454 100644 ---- a/grub-core/commands/date.c -+++ b/grub-core/commands/date.c -@@ -59,7 +59,8 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)), - - for (; argc; argc--, args++) - { -- char *p, c; -+ const char *p; -+ char c; - int m1, ofs, n, cur_mask; - - p = args[0]; -diff --git a/grub-core/commands/i386/cmostest.c b/grub-core/commands/i386/cmostest.c -index c839b704dc5..9f6b56a2f0c 100644 ---- a/grub-core/commands/i386/cmostest.c -+++ b/grub-core/commands/i386/cmostest.c -@@ -27,7 +27,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - static grub_err_t - parse_args (int argc, char *argv[], int *byte, int *bit) - { -- char *rest; -+ const char *rest; - - if (argc != 1) - return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required"); -diff --git a/grub-core/commands/i386/pc/play.c b/grub-core/commands/i386/pc/play.c -index c8181310515..a980e46883c 100644 ---- a/grub-core/commands/i386/pc/play.c -+++ b/grub-core/commands/i386/pc/play.c -@@ -132,7 +132,7 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), - } - else - { -- char *end; -+ const char *end; - unsigned tempo; - struct note note; - int i; -diff --git a/grub-core/commands/i386/rdmsr.c b/grub-core/commands/i386/rdmsr.c -index 15b9adfca67..46c4346da1b 100644 ---- a/grub-core/commands/i386/rdmsr.c -+++ b/grub-core/commands/i386/rdmsr.c -@@ -44,7 +44,7 @@ grub_cmd_msr_read (grub_extcmd_context_t ctxt, int argc, char **argv) - { - grub_uint32_t manufacturer[3], max_cpuid, a, b, c, features, addr; - grub_uint64_t value; -- char *ptr; -+ const char *ptr; - char buf[sizeof("1122334455667788")]; - - /* -diff --git a/grub-core/commands/i386/wrmsr.c b/grub-core/commands/i386/wrmsr.c -index 9c5e510eb44..fa76f5aed11 100644 ---- a/grub-core/commands/i386/wrmsr.c -+++ b/grub-core/commands/i386/wrmsr.c -@@ -37,7 +37,7 @@ grub_cmd_msr_write (grub_command_t cmd __attribute__ ((unused)), int argc, char - { - grub_uint32_t manufacturer[3], max_cpuid, a, b, c, features, addr; - grub_uint64_t value; -- char *ptr; -+ const char *ptr; - - /* - * The CPUID instruction should be used to determine whether MSRs -diff --git a/grub-core/commands/password_pbkdf2.c b/grub-core/commands/password_pbkdf2.c -index da636e6217a..ab845d25eb3 100644 ---- a/grub-core/commands/password_pbkdf2.c -+++ b/grub-core/commands/password_pbkdf2.c -@@ -86,7 +86,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)), - int argc, char **args) - { - grub_err_t err; -- char *ptr, *ptr2; -+ const char *ptr, *ptr2; - grub_uint8_t *ptro; - struct pbkdf2_password *pass; - -diff --git a/grub-core/commands/pcidump.c b/grub-core/commands/pcidump.c -index f99ad4a216f..f72628fce2d 100644 ---- a/grub-core/commands/pcidump.c -+++ b/grub-core/commands/pcidump.c -@@ -95,7 +95,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, - if (ctxt->state[0].set) - { - ptr = ctxt->state[0].arg; -- ctx.pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff); -+ ctx.pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff); - if (grub_errno == GRUB_ERR_BAD_NUMBER) - { - grub_errno = GRUB_ERR_NONE; -@@ -108,8 +108,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, - if (*ptr != ':') - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':'); - ptr++; -- ctx.pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff) -- << 16; -+ ctx.pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff) << 16; - if (grub_errno == GRUB_ERR_BAD_NUMBER) - grub_errno = GRUB_ERR_NONE; - else -@@ -121,10 +120,10 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, - if (ctxt->state[1].set) - { - const char *optr; -- -+ - ptr = ctxt->state[1].arg; - optr = ptr; -- ctx.bus = grub_strtoul (ptr, (char **) &ptr, 16); -+ ctx.bus = grub_strtoul (ptr, &ptr, 16); - if (grub_errno == GRUB_ERR_BAD_NUMBER) - { - grub_errno = GRUB_ERR_NONE; -@@ -138,7 +137,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':'); - ptr++; - optr = ptr; -- ctx.device = grub_strtoul (ptr, (char **) &ptr, 16); -+ ctx.device = grub_strtoul (ptr, &ptr, 16); - if (grub_errno == GRUB_ERR_BAD_NUMBER) - { - grub_errno = GRUB_ERR_NONE; -@@ -149,7 +148,7 @@ grub_cmd_pcidump (grub_extcmd_context_t ctxt, - if (*ptr == '.') - { - ptr++; -- ctx.function = grub_strtoul (ptr, (char **) &ptr, 16); -+ ctx.function = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - return grub_errno; - ctx.check_function = 1; -diff --git a/grub-core/commands/regexp.c b/grub-core/commands/regexp.c -index f00b184c81e..7c5c72fe460 100644 ---- a/grub-core/commands/regexp.c -+++ b/grub-core/commands/regexp.c -@@ -64,7 +64,7 @@ set_matches (char **varnames, char *str, grub_size_t nmatches, - { - int i; - char *p; -- char *q; -+ const char * q; - grub_err_t err; - unsigned long j; - -diff --git a/grub-core/commands/setpci.c b/grub-core/commands/setpci.c -index d5bc97d60b2..e966af080a6 100644 ---- a/grub-core/commands/setpci.c -+++ b/grub-core/commands/setpci.c -@@ -169,7 +169,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) - if (ctxt->state[0].set) - { - ptr = ctxt->state[0].arg; -- pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff); -+ pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff); - if (grub_errno == GRUB_ERR_BAD_NUMBER) - { - grub_errno = GRUB_ERR_NONE; -@@ -182,8 +182,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) - if (*ptr != ':') - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':'); - ptr++; -- pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff) -- << 16; -+ pciid_check_value |= (grub_strtoul (ptr, &ptr, 16) & 0xffff) << 16; - if (grub_errno == GRUB_ERR_BAD_NUMBER) - grub_errno = GRUB_ERR_NONE; - else -@@ -197,10 +196,10 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) - if (ctxt->state[1].set) - { - const char *optr; -- -+ - ptr = ctxt->state[1].arg; - optr = ptr; -- bus = grub_strtoul (ptr, (char **) &ptr, 16); -+ bus = grub_strtoul (ptr, &ptr, 16); - if (grub_errno == GRUB_ERR_BAD_NUMBER) - { - grub_errno = GRUB_ERR_NONE; -@@ -214,7 +213,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing `%c' symbol"), ':'); - ptr++; - optr = ptr; -- device = grub_strtoul (ptr, (char **) &ptr, 16); -+ device = grub_strtoul (ptr, &ptr, 16); - if (grub_errno == GRUB_ERR_BAD_NUMBER) - { - grub_errno = GRUB_ERR_NONE; -@@ -225,7 +224,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) - if (*ptr == '.') - { - ptr++; -- function = grub_strtoul (ptr, (char **) &ptr, 16); -+ function = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - return grub_errno; - check_function = 1; -@@ -253,7 +252,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) - if (i == ARRAY_SIZE (pci_registers)) - { - regsize = 0; -- regaddr = grub_strtoul (ptr, (char **) &ptr, 16); -+ regaddr = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown register"); - } -@@ -270,7 +269,7 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) - if (*ptr == '+') - { - ptr++; -- regaddr += grub_strtoul (ptr, (char **) &ptr, 16); -+ regaddr += grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - return grub_errno; - } -@@ -302,14 +301,14 @@ grub_cmd_setpci (grub_extcmd_context_t ctxt, int argc, char **argv) - if (*ptr == '=') - { - ptr++; -- regwrite = grub_strtoul (ptr, (char **) &ptr, 16); -+ regwrite = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - return grub_errno; - write_mask = 0xffffffff; - if (*ptr == ':') - { - ptr++; -- write_mask = grub_strtoul (ptr, (char **) &ptr, 16); -+ write_mask = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - return grub_errno; - write_mask = 0xffffffff; -diff --git a/grub-core/commands/test.c b/grub-core/commands/test.c -index 4e929e0452e..62d3fb3988f 100644 ---- a/grub-core/commands/test.c -+++ b/grub-core/commands/test.c -@@ -31,7 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - - /* A simple implementation for signed numbers. */ - static int --grub_strtosl (char *arg, char **end, int base) -+grub_strtosl (char *arg, const char ** const end, int base) - { - if (arg[0] == '-') - return -grub_strtoul (arg + 1, end, base); -diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c -index 4be8107d553..016a4d81835 100644 ---- a/grub-core/commands/videoinfo.c -+++ b/grub-core/commands/videoinfo.c -@@ -136,7 +136,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)), - ctx.height = ctx.width = ctx.depth = 0; - if (argc) - { -- char *ptr; -+ const char *ptr; - ptr = args[0]; - ctx.width = grub_strtoul (ptr, &ptr, 0); - if (grub_errno) -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 1a3eb6b8d77..3f264be77d1 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -971,7 +971,8 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg) - for (p = vgp->lvs; p; p = p->next) - { - int cur_num; -- char *num, *end; -+ char *num; -+ const char *end; - if (!p->fullname) - continue; - if (grub_strncmp (p->fullname, lv->fullname, len) != 0) -diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c -index 7b265c780c3..0cbd0dd1629 100644 ---- a/grub-core/disk/lvm.c -+++ b/grub-core/disk/lvm.c -@@ -38,7 +38,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - at the number. In case STR is not found, *P will be NULL and the - return value will be 0. */ - static grub_uint64_t --grub_lvm_getvalue (char **p, const char *str) -+grub_lvm_getvalue (const char ** const p, const char *str) - { - *p = grub_strstr (*p, str); - if (! *p) -@@ -63,12 +63,12 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl) - #endif - - static int --grub_lvm_check_flag (char *p, const char *str, const char *flag) -+grub_lvm_check_flag (const char *p, const char *str, const char *flag) - { - grub_size_t len_str = grub_strlen (str), len_flag = grub_strlen (flag); - while (1) - { -- char *q; -+ const char *q; - p = grub_strstr (p, str); - if (! p) - return 0; -@@ -105,7 +105,8 @@ grub_lvm_detect (grub_disk_t disk, - char buf[GRUB_LVM_LABEL_SIZE]; - char vg_id[GRUB_LVM_ID_STRLEN+1]; - char pv_id[GRUB_LVM_ID_STRLEN+1]; -- char *metadatabuf, *p, *q, *vgname; -+ char *metadatabuf, *vgname; -+ const char *p, *q; - struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf; - struct grub_lvm_pv_header *pvh; - struct grub_lvm_disk_locn *dlocn; -diff --git a/grub-core/efiemu/pnvram.c b/grub-core/efiemu/pnvram.c -index c5c3d4bd3d5..dd42bc69116 100644 ---- a/grub-core/efiemu/pnvram.c -+++ b/grub-core/efiemu/pnvram.c -@@ -39,7 +39,7 @@ static grub_size_t nvramsize; - - /* Parse signed value */ - static int --grub_strtosl (const char *arg, char **end, int base) -+grub_strtosl (const char *arg, const char ** const end, int base) - { - if (arg[0] == '-') - return -grub_strtoul (arg + 1, end, base); -@@ -120,7 +120,8 @@ nvram_set (void * data __attribute__ ((unused))) - grub_memset (nvram, 0, nvramsize); - FOR_SORTED_ENV (var) - { -- char *guid, *attr, *name, *varname; -+ const char *guid; -+ char *attr, *name, *varname; - struct efi_variable *efivar; - int len = 0; - int i; -diff --git a/grub-core/gfxmenu/gui_circular_progress.c b/grub-core/gfxmenu/gui_circular_progress.c -index 354dd7b73ee..7578bfbec92 100644 ---- a/grub-core/gfxmenu/gui_circular_progress.c -+++ b/grub-core/gfxmenu/gui_circular_progress.c -@@ -230,7 +230,7 @@ circprog_set_state (void *vself, int visible, int start, - static int - parse_angle (const char *value) - { -- char *ptr; -+ const char *ptr; - int angle; - - angle = grub_strtol (value, &ptr, 10); -diff --git a/grub-core/gfxmenu/theme_loader.c b/grub-core/gfxmenu/theme_loader.c -index d6829bb5e90..eae83086bcc 100644 ---- a/grub-core/gfxmenu/theme_loader.c -+++ b/grub-core/gfxmenu/theme_loader.c -@@ -484,7 +484,7 @@ parse_proportional_spec (const char *value, signed *abs, grub_fixed_signed_t *pr - ptr++; - } - -- num = grub_strtoul (ptr, (char **) &ptr, 0); -+ num = grub_strtoul (ptr, &ptr, 0); - if (grub_errno) - return grub_errno; - if (sig) -diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c -index 2b85f4950bd..88d39360da0 100644 ---- a/grub-core/kern/fs.c -+++ b/grub-core/kern/fs.c -@@ -134,7 +134,7 @@ struct grub_fs_block - static grub_err_t - grub_fs_blocklist_open (grub_file_t file, const char *name) - { -- char *p = (char *) name; -+ const char *p = name; - unsigned num = 0; - unsigned i; - grub_disk_t disk = file->device->disk; -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 5c3899f0e5b..e21dd44c7cf 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -383,7 +383,8 @@ grub_isspace (int c) - } - - unsigned long --grub_strtoul (const char *str, char **end, int base) -+grub_strtoul (const char * restrict str, const char ** const restrict end, -+ int base) - { - unsigned long long num; - -@@ -400,7 +401,8 @@ grub_strtoul (const char *str, char **end, int base) - } - - unsigned long long --grub_strtoull (const char *str, char **end, int base) -+grub_strtoull (const char * restrict str, const char ** const restrict end, -+ int base) - { - unsigned long long num = 0; - int found = 0; -@@ -901,14 +903,14 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, - { - if (fmt[0] == '0') - zerofill = '0'; -- format1 = grub_strtoul (fmt, (char **) &fmt, 10); -+ format1 = grub_strtoul (fmt, &fmt, 10); - } - - if (*fmt == '.') - fmt++; - - if (grub_isdigit (*fmt)) -- format2 = grub_strtoul (fmt, (char **) &fmt, 10); -+ format2 = grub_strtoul (fmt, &fmt, 10); - - if (*fmt == '$') - { -diff --git a/grub-core/kern/partition.c b/grub-core/kern/partition.c -index e499147cbcb..2c401b866c4 100644 ---- a/grub-core/kern/partition.c -+++ b/grub-core/kern/partition.c -@@ -126,7 +126,7 @@ grub_partition_probe (struct grub_disk *disk, const char *str) - while (*ptr && grub_isalpha (*ptr)) - ptr++; - partname_end = ptr; -- num = grub_strtoul (ptr, (char **) &ptr, 0) - 1; -+ num = grub_strtoul (ptr, &ptr, 0) - 1; - - curpart = 0; - /* Use the first partition map type found. */ -diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c -index fd7744a6ff6..ccc185017ee 100644 ---- a/grub-core/lib/arg.c -+++ b/grub-core/lib/arg.c -@@ -375,7 +375,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv, - - case ARG_TYPE_INT: - { -- char *tail; -+ const char * tail; - - grub_strtoull (option, &tail, 0); - if (tail == 0 || tail == option || *tail != '\0' || grub_errno) -diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c -index ef56150ac77..05719ab2ccb 100644 ---- a/grub-core/lib/legacy_parse.c -+++ b/grub-core/lib/legacy_parse.c -@@ -418,7 +418,7 @@ adjust_file (const char *in, grub_size_t len) - } - if (*comma != ',') - return grub_legacy_escape (in, len); -- part = grub_strtoull (comma + 1, (char **) &rest, 0); -+ part = grub_strtoull (comma + 1, &rest, 0); - if (rest[0] == ',' && rest[1] >= 'a' && rest[1] <= 'z') - { - subpart = rest[1] - 'a'; -diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c -index 4afa99279a2..de9fda06f52 100644 ---- a/grub-core/lib/syslinux_parse.c -+++ b/grub-core/lib/syslinux_parse.c -@@ -1062,7 +1062,7 @@ write_entry (struct output_buffer *outbuf, - if (ptr[0] == 'h' && ptr[1] == 'd') - { - is_fd = 0; -- devn = grub_strtoul (ptr + 2, &ptr, 0); -+ devn = grub_strtoul (ptr + 2, (const char **)&ptr, 0); - continue; - } - if (grub_strncasecmp (ptr, "file=", 5) == 0) -@@ -1086,12 +1086,12 @@ write_entry (struct output_buffer *outbuf, - if (ptr[0] == 'f' && ptr[1] == 'd') - { - is_fd = 1; -- devn = grub_strtoul (ptr + 2, &ptr, 0); -+ devn = grub_strtoul (ptr + 2, (const char **)&ptr, 0); - continue; - } - if (grub_isdigit (ptr[0])) - { -- part = grub_strtoul (ptr, &ptr, 0); -+ part = grub_strtoul (ptr, (const char **)&ptr, 0); - continue; - } - /* FIXME: isolinux, ntldr, cmldr, *dos, seg, hide -diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 5b9b92d6ba5..50cca304fd0 100644 ---- a/grub-core/loader/i386/bsd.c -+++ b/grub-core/loader/i386/bsd.c -@@ -1616,7 +1616,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) - return grub_error (GRUB_ERR_BAD_ARGUMENT, - "unknown disk type name"); - -- unit = grub_strtoul (arg, (char **) &arg, 10); -+ unit = grub_strtoul (arg, &arg, 10); - if (! (arg && *arg >= 'a' && *arg <= 'z')) - return grub_error (GRUB_ERR_BAD_ARGUMENT, - "only device specifications of form " -@@ -1634,7 +1634,7 @@ grub_cmd_openbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) - if (ctxt->state[OPENBSD_SERIAL_ARG].set) - { - struct grub_openbsd_bootarg_console serial; -- char *ptr; -+ const char *ptr; - unsigned port = 0; - unsigned speed = 9600; - -@@ -1736,7 +1736,7 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[]) - if (ctxt->state[NETBSD_SERIAL_ARG].set) - { - struct grub_netbsd_btinfo_serial serial; -- char *ptr; -+ const char *ptr; - - grub_memset (&serial, 0, sizeof (serial)); - grub_strcpy (serial.devname, "com"); -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 376c726928a..201e6597c6d 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -954,7 +954,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - #endif /* GRUB_MACHINE_PCBIOS */ - if (grub_memcmp (argv[i], "mem=", 4) == 0) - { -- char *val = argv[i] + 4; -+ const char *val = argv[i] + 4; - - linux_mem_size = grub_strtoul (val, &val, 0); - -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index fe3e1d41d09..0bf0e13d647 100644 ---- a/grub-core/loader/i386/pc/linux.c -+++ b/grub-core/loader/i386/pc/linux.c -@@ -272,7 +272,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - } - else if (grub_memcmp (argv[i], "mem=", 4) == 0) - { -- char *val = argv[i] + 4; -+ const char *val = argv[i] + 4; - - linux_mem_size = grub_strtoul (val, &val, 0); - -diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c -index 6329ec01038..27afcaacbce 100644 ---- a/grub-core/loader/i386/xen_fileXX.c -+++ b/grub-core/loader/i386/xen_fileXX.c -@@ -25,7 +25,7 @@ parse_xen_guest (grub_elf_t elf, struct grub_xen_file_info *xi, - grub_off_t off, grub_size_t sz) - { - char *buf; -- char *ptr; -+ const char *ptr; - int has_paddr = 0; - - grub_errno = GRUB_ERR_NONE; -diff --git a/grub-core/mmap/mmap.c b/grub-core/mmap/mmap.c -index 6a31cbae325..b569cb23b5a 100644 ---- a/grub-core/mmap/mmap.c -+++ b/grub-core/mmap/mmap.c -@@ -423,7 +423,7 @@ static grub_err_t - grub_cmd_badram (grub_command_t cmd __attribute__ ((unused)), - int argc, char **args) - { -- char * str; -+ const char *str; - struct badram_entry entry; - - if (argc != 1) -@@ -465,7 +465,7 @@ static grub_uint64_t - parsemem (const char *str) - { - grub_uint64_t ret; -- char *ptr; -+ const char *ptr; - - ret = grub_strtoul (str, &ptr, 0); - -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index c9c59690a98..b52b558d631 100644 ---- a/grub-core/net/http.c -+++ b/grub-core/net/http.c -@@ -110,7 +110,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) - return GRUB_ERR_NONE; - } - ptr += sizeof ("HTTP/1.1 ") - 1; -- code = grub_strtoul (ptr, &ptr, 10); -+ code = grub_strtoul (ptr, (const char **)&ptr, 10); - if (grub_errno) - return grub_errno; - switch (code) -@@ -137,7 +137,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) - == 0 && !data->size_recv) - { - ptr += sizeof ("Content-Length: ") - 1; -- file->size = grub_strtoull (ptr, &ptr, 10); -+ file->size = grub_strtoull (ptr, (const char **)&ptr, 10); - data->size_recv = 1; - return GRUB_ERR_NONE; - } -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 27a0a1d6961..aa56393e1c4 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -411,7 +411,7 @@ parse_ip (const char *val, grub_uint32_t *ip, const char **rest) - for (i = 0; i < 4; i++) - { - unsigned long t; -- t = grub_strtoul (ptr, (char **) &ptr, 0); -+ t = grub_strtoul (ptr, &ptr, 0); - if (grub_errno) - { - grub_errno = GRUB_ERR_NONE; -@@ -465,7 +465,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) - ptr++; - continue; - } -- t = grub_strtoul (ptr, (char **) &ptr, 16); -+ t = grub_strtoul (ptr, &ptr, 16); - if (grub_errno) - { - grub_errno = GRUB_ERR_NONE; -@@ -577,7 +577,7 @@ grub_net_resolve_net_address (const char *name, - addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; - if (*rest == '/') - { -- addr->ipv4.masksize = grub_strtoul (rest + 1, (char **) &rest, 0); -+ addr->ipv4.masksize = grub_strtoul (rest + 1, &rest, 0); - if (!grub_errno && *rest == 0) - return GRUB_ERR_NONE; - grub_errno = GRUB_ERR_NONE; -@@ -593,7 +593,7 @@ grub_net_resolve_net_address (const char *name, - addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; - if (*rest == '/') - { -- addr->ipv6.masksize = grub_strtoul (rest + 1, (char **) &rest, 0); -+ addr->ipv6.masksize = grub_strtoul (rest + 1, &rest, 0); - if (!grub_errno && *rest == 0) - return GRUB_ERR_NONE; - grub_errno = GRUB_ERR_NONE; -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 046a1fb2c84..37d753d8081 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -194,8 +194,7 @@ menuentry_eq (const char *id, const char *spec) - static int - get_and_remove_first_entry_number (grub_menu_t menu, const char *name) - { -- const char *val; -- char *tail; -+ const char *val, *tail; - int entry; - int sz = 0; - -diff --git a/grub-core/osdep/aros/hostdisk.c b/grub-core/osdep/aros/hostdisk.c -index 2be654ca3bd..3b2c9de2496 100644 ---- a/grub-core/osdep/aros/hostdisk.c -+++ b/grub-core/osdep/aros/hostdisk.c -@@ -194,7 +194,7 @@ grub_util_fd_open (const char *dev, int flg) - p1 = dev + strlen (dev); - else - { -- unit = grub_strtoul (p1 + 1, (char **) &p2, 16); -+ unit = grub_strtoul (p1 + 1, &p2, 16); - if (p2 && *p2 == '/') - flags = grub_strtoul (p2 + 1, 0, 16); - } -diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c -index a697bcb4d8d..a8afc0c9408 100644 ---- a/grub-core/osdep/devmapper/hostdisk.c -+++ b/grub-core/osdep/devmapper/hostdisk.c -@@ -113,7 +113,7 @@ grub_util_get_dm_node_linear_info (dev_t dev, - void *next = NULL; - uint64_t length, start; - char *target, *params; -- char *ptr; -+ const char *ptr; - int major = 0, minor = 0; - int first = 1; - grub_disk_addr_t partstart = 0; -diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index ba38b5e8aef..c6d2c365c9a 100644 ---- a/grub-core/script/execute.c -+++ b/grub-core/script/execute.c -@@ -146,7 +146,7 @@ replace_scope (struct grub_script_scope *new_scope) - grub_err_t - grub_script_break (grub_command_t cmd, int argc, char *argv[]) - { -- char *p = 0; -+ const char *p = NULL; - unsigned long count; - - if (argc == 0) -@@ -178,7 +178,7 @@ grub_err_t - grub_script_shift (grub_command_t cmd __attribute__((unused)), - int argc, char *argv[]) - { -- char *p = 0; -+ const char *p = NULL; - unsigned long n = 0; - - if (! scope) -@@ -239,7 +239,7 @@ grub_err_t - grub_script_return (grub_command_t cmd __attribute__((unused)), - int argc, char *argv[]) - { -- char *p; -+ const char *p = NULL; - unsigned long n; - - if (! scope || argc > 1) -diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c -index db80b3ba0fb..f9271b09239 100644 ---- a/grub-core/term/serial.c -+++ b/grub-core/term/serial.c -@@ -269,7 +269,7 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) - - if (state[OPTION_BASE_CLOCK].set) - { -- char *ptr; -+ const char *ptr; - config.base_clock = grub_strtoull (state[OPTION_BASE_CLOCK].arg, &ptr, 0); - if (grub_errno) - return grub_errno; -diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index 29df35e6d20..537a5c0cb0b 100644 ---- a/grub-core/term/terminfo.c -+++ b/grub-core/term/terminfo.c -@@ -737,7 +737,7 @@ grub_cmd_terminfo (grub_extcmd_context_t ctxt, int argc, char **args) - - if (state[OPTION_GEOMETRY].set) - { -- char *ptr = state[OPTION_GEOMETRY].arg; -+ const char *ptr = state[OPTION_GEOMETRY].arg; - w = grub_strtoul (ptr, &ptr, 0); - if (grub_errno) - return grub_errno; -diff --git a/grub-core/tests/strtoull_test.c b/grub-core/tests/strtoull_test.c -index 7da615ff33e..5488ab26b43 100644 ---- a/grub-core/tests/strtoull_test.c -+++ b/grub-core/tests/strtoull_test.c -@@ -25,7 +25,7 @@ static void - strtoull_testcase (const char *input, int base, unsigned long long expected, - int num_digits, grub_err_t error) - { -- char *output; -+ const char *output; - unsigned long long value; - grub_errno = 0; - value = grub_strtoull(input, &output, base); -diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index 88f9c5d4ad8..39bad1f432f 100644 ---- a/util/grub-fstest.c -+++ b/util/grub-fstest.c -@@ -538,7 +538,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; - static error_t - argp_parser (int key, char *arg, struct argp_state *state) - { -- char *p; -+ const char *p; - - switch (key) - { -diff --git a/include/grub/misc.h b/include/grub/misc.h -index 960097fbd06..998e47e0ccf 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -288,11 +288,29 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n) - - (int) grub_tolower ((grub_uint8_t) *s2); - } - --unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base); --unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base); -+/* -+ * Note that these differ from the C standard's definitions of strtol, -+ * strtoul(), and strtoull() by the addition of two const qualifiers on the end -+ * pointer, which make the declaration match the *semantic* requirements of -+ * their behavior. This means that instead of: -+ * -+ * char *s = "1234 abcd"; -+ * char *end; -+ * unsigned long l; -+ * -+ * l = grub_strtoul(s, &end, 10); -+ * -+ * We must one of: -+ * -+ * const char *end; -+ * ... or ... -+ * l = grub_strtoul(s, (const char ** const)&end, 10); -+ */ -+unsigned long EXPORT_FUNC(grub_strtoul) (const char * restrict str, const char ** const restrict end, int base); -+unsigned long long EXPORT_FUNC(grub_strtoull) (const char * restrict str, const char ** const restrict end, int base); - - static inline long --grub_strtol (const char *str, char **end, int base) -+grub_strtol (const char * restrict str, const char ** const restrict end, int base) - { - int negative = 0; - unsigned long long magnitude; diff --git a/0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0161-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0263-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0161-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0162-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0162-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0163-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 97% rename from 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0163-Add-systemd-integration-scripts-to-make-systemctl-re.patch index faf51393..130dc778 100644 --- a/0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch +++ b/0163-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -65,10 +65,10 @@ Signed-off-by: Hans de Goede create mode 100644 util/systemd/systemd-integration.sh.in diff --git a/Makefile.util.def b/Makefile.util.def -index f3a699691bf..dc8d1790ea5 100644 +index 11ab2d6fad1..e1242f54022 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -469,6 +469,12 @@ script = { +@@ -470,6 +470,12 @@ script = { installdir = grubconf; }; @@ -81,7 +81,7 @@ index f3a699691bf..dc8d1790ea5 100644 script = { name = '01_users'; common = util/grub.d/01_users.in; -@@ -568,6 +574,27 @@ script = { +@@ -569,6 +575,27 @@ script = { installdir = grubconf; }; @@ -110,7 +110,7 @@ index f3a699691bf..dc8d1790ea5 100644 mansection = 1; name = grub-mkrescue; diff --git a/conf/Makefile.common b/conf/Makefile.common -index 87c1f0e809b..6b85eb394ce 100644 +index 0647c53b916..9fe5863b2d9 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -63,8 +63,11 @@ CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS) @@ -125,7 +125,7 @@ index 87c1f0e809b..6b85eb394ce 100644 CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Werror=trampolines -fno-trampolines CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib -@@ -119,6 +122,9 @@ noinst_LIBRARIES = +@@ -121,6 +124,9 @@ noinst_LIBRARIES = dist_noinst_DATA = platform_SCRIPTS = platform_PROGRAMS = diff --git a/0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0164-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0164-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0165-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 99% rename from 0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0165-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch index 047b07ba..c3388409 100644 --- a/0302-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +++ b/0165-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch @@ -29,7 +29,7 @@ Signed-off-by: Renaud Métrich 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index f0a986eb176..69d99b61df5 100644 +index 597111077bd..26014382608 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -135,20 +135,28 @@ query_mode (void) diff --git a/0166-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch b/0166-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch deleted file mode 100644 index 2cef9b9d..00000000 --- a/0166-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Masayoshi Mizuma -Date: Tue, 18 Dec 2018 21:27:45 -0500 -Subject: [PATCH] Fix the looking up grub.cfg-XXX while tftp booting. - -Currently, grub doesn't look up grub.cfg-UUID, grub.cfg-MAC and grub.cfg-IP -while the boot is from tftp. That is because the uuid size is got by -grub_snprintf(, 0, ,), but the grub_snprintf() always returns 0, -so grub judges there's no available uuid in the client and give up -the looking up grub.cfg-XXX. - -This issue can be fixed by changing grub_snprintf(, 0, ,) behaivior -to like as snprintf() from glibc, however, somewhere may expect -such argument as the error, so it's risky. - -Let's use sizeof() and grub_strlen() to calculate the uuid size -instead of grub_snprintf(). - -Resolves: rhbz#1658500 ---- - grub-core/net/net.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index aa56393e1c4..15073dde1c4 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -1942,11 +1942,9 @@ grub_net_search_configfile (char *config) - char *client_uuid_var; - grub_size_t client_uuid_var_size; - -- client_uuid_var_size = grub_snprintf (NULL, 0, -- "net_%s_clientuuid", inf->name); -- if (client_uuid_var_size <= 0) -- continue; -- client_uuid_var_size += 1; -+ client_uuid_var_size = sizeof ("net_") + grub_strlen (inf->name) + -+ sizeof ("_clientuuid") + 1; -+ - client_uuid_var = grub_malloc(client_uuid_var_size); - if (!client_uuid_var) - continue; diff --git a/0269-grub-install-disable-support-for-EFI-platforms.patch b/0166-grub-install-disable-support-for-EFI-platforms.patch similarity index 96% rename from 0269-grub-install-disable-support-for-EFI-platforms.patch rename to 0166-grub-install-disable-support-for-EFI-platforms.patch index e5104bf1..e3cf2ecf 100644 --- a/0269-grub-install-disable-support-for-EFI-platforms.patch +++ b/0166-grub-install-disable-support-for-EFI-platforms.patch @@ -26,7 +26,7 @@ Signed-off-by: Jan Hlavac 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index dddb7576c97..b3f5e414052 100644 +index 1e47491bc21..ffac91c9a24 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -899,6 +899,22 @@ main (int argc, char *argv[]) @@ -82,10 +82,10 @@ index dddb7576c97..b3f5e414052 100644 { grub_fs_t fs; diff --git a/docs/grub.texi b/docs/grub.texi -index 495462b8e48..085b9974cc5 100644 +index 67bf8523ccb..75b22231f35 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -6293,6 +6293,13 @@ grub2-install @var{install_device} +@@ -6506,6 +6506,13 @@ grub2-install @var{install_device} The device name @var{install_device} is an OS device name or a GRUB device name. diff --git a/0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 92% rename from 0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch index e3d09bcb..ff2841e4 100644 --- a/0270-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,10 +15,10 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index 5d3316185da..d150a2e4a9c 100644 +index 2e4b12adad3..7b11fae0c3d 100644 --- a/configure.ac +++ b/configure.ac -@@ -1555,6 +1555,17 @@ else +@@ -1613,6 +1613,17 @@ else fi AC_SUBST([BOOT_TIME_STATS]) @@ -36,7 +36,7 @@ index 5d3316185da..d150a2e4a9c 100644 AC_ARG_ENABLE([grub-emu-sdl], [AS_HELP_STRING([--enable-grub-emu-sdl], [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) -@@ -2142,6 +2153,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) +@@ -2200,6 +2211,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) @@ -44,7 +44,7 @@ index 5d3316185da..d150a2e4a9c 100644 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) -@@ -2237,6 +2249,12 @@ else +@@ -2295,6 +2307,12 @@ else echo With boot time statistics: No fi @@ -58,7 +58,7 @@ index 5d3316185da..d150a2e4a9c 100644 echo efiemu runtime: Yes else diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index dc5e10b651a..bc23945a3c2 100644 +index 578bf51a5fc..9f54b6b7d2d 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -25,6 +25,9 @@ @@ -71,7 +71,7 @@ index dc5e10b651a..bc23945a3c2 100644 union printf_arg { -@@ -191,9 +194,26 @@ grub_real_dprintf (const char *file, const int line, const char *condition, +@@ -192,9 +195,26 @@ grub_real_dprintf (const char *file, const int line, const char *condition, const char *fmt, ...) { va_list args; diff --git a/0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch b/0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch deleted file mode 100644 index 837da31f..00000000 --- a/0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 12 Jul 2019 17:45:51 +0200 -Subject: [PATCH] Try to set -fPIE and friends on libgnu.a - -In order to make sure UTIL_CFLAGS and UTIL_LDFLAGS can correctly get --Wl,-z,relro,-z,now , we need everything going in them to be built with at -least -fPIC (and preferably -fPIE) wherever we can, or else we get relocations -in some component object that can't be used with the link type that's being -used for the final ELF object. - -So this makes sure libgnu.a gets built with HOST_CFLAGS and HOST_LDFLAGS, -which are what is later used to define UTIL_CFLAGS and UTIL_LDFLAGS, and -includes -fPIE. - -Fixes an rpmdiff check. - -Related: rhbz#1658500 - -Signed-off-by: Peter Jones -[javierm: replace from bootstrap instead patching generated Makefile.am] -Signed-off-by: Javier Martinez Canillas ---- - bootstrap.conf | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/bootstrap.conf b/bootstrap.conf -index 8804d5beb89..29a6a3e90e2 100644 ---- a/bootstrap.conf -+++ b/bootstrap.conf -@@ -82,6 +82,9 @@ bootstrap_post_import_hook () { - patch -d grub-core/lib/gnulib -p2 \ - < "grub-core/lib/gnulib-patches/$patchname.patch" - done -+ for flagvar in CPPFLAGS CFLAGS; do -+ sed -i -e "s/^AM_$flagvar =/AM_$flagvar = \$(HOST_$flagvar)/" grub-core/lib/gnulib/Makefile.am -+ done - FROM_BOOTSTRAP=1 ./autogen.sh - set +e # bootstrap expects this - } diff --git a/0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0168-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 97% rename from 0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0168-Added-debug-statements-to-grub_disk_open-and-grub_di.patch index 94978402..cbb1a38e 100644 --- a/0271-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +++ b/0168-Added-debug-statements-to-grub_disk_open-and-grub_di.patch @@ -13,7 +13,7 @@ Signed-off-by: Renaud Métrich 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c -index ffb09c8eefb..141b40de473 100644 +index e1b0e073e09..05a28ab1429 100644 --- a/grub-core/kern/disk.c +++ b/grub-core/kern/disk.c @@ -285,6 +285,8 @@ grub_disk_open (const char *name) diff --git a/0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch b/0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch deleted file mode 100644 index 21d242e4..00000000 --- a/0168-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 11 Feb 2019 15:14:10 +0100 -Subject: [PATCH] Don't make grub_strtoull() print an error if no conversion is - performed - -Callers can check if grub_errno was set to GRUB_ERR_BAD_NUMBER, so there's -no need to print an error if a conversion couldn't be performed. This just -pollutes the output with noisy error messages. - -Resolves: rhbz#1674512 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/kern/misc.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 18a7dbf4cd7..87afb43cd55 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -475,8 +475,7 @@ grub_strtoull (const char * restrict str, const char ** const restrict end, - - if (! found) - { -- grub_error (GRUB_ERR_BAD_NUMBER, -- N_("unrecognized number")); -+ grub_errno = GRUB_ERR_BAD_NUMBER; - return 0; - } - diff --git a/0169-Fix-the-type-of-grub_efi_status_t.patch b/0169-Fix-the-type-of-grub_efi_status_t.patch deleted file mode 100644 index fba3f3d1..00000000 --- a/0169-Fix-the-type-of-grub_efi_status_t.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 21 Mar 2019 13:06:06 -0400 -Subject: [PATCH] Fix the type of grub_efi_status_t - -Currently, in some builds with some checkers, we see: - -1. grub-core/disk/efi/efidisk.c:601: error[shiftTooManyBitsSigned]: Shifting signed 64-bit value by 63 bits is undefined behaviour - -This is because grub_efi_status_t is defined as grub_efi_intn_t, which is -signed, and shifting into the sign bit is not defined behavior. UEFI fixed -this in the spec in 2.3: - -2.3 | Change the defined type of EFI_STATUS from INTN to UINTN | May 7, 2009 - -And the current EDK2 code has: -MdePkg/Include/Base.h-// -MdePkg/Include/Base.h-// Status codes common to all execution phases -MdePkg/Include/Base.h-// -MdePkg/Include/Base.h:typedef UINTN RETURN_STATUS; -MdePkg/Include/Base.h- -MdePkg/Include/Base.h-/** -MdePkg/Include/Base.h- Produces a RETURN_STATUS code with the highest bit set. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h- @param StatusCode The status code value to convert into a warning code. -MdePkg/Include/Base.h- StatusCode must be in the range 0x00000000..0x7FFFFFFF. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h- @return The value specified by StatusCode with the highest bit set. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h-**/ -MdePkg/Include/Base.h-#define ENCODE_ERROR(StatusCode) ((RETURN_STATUS)(MAX_BIT | (StatusCode))) -MdePkg/Include/Base.h- -MdePkg/Include/Base.h-/** -MdePkg/Include/Base.h- Produces a RETURN_STATUS code with the highest bit clear. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h- @param StatusCode The status code value to convert into a warning code. -MdePkg/Include/Base.h- StatusCode must be in the range 0x00000000..0x7FFFFFFF. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h- @return The value specified by StatusCode with the highest bit clear. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h-**/ -MdePkg/Include/Base.h-#define ENCODE_WARNING(StatusCode) ((RETURN_STATUS)(StatusCode)) -MdePkg/Include/Base.h- -MdePkg/Include/Base.h-/** -MdePkg/Include/Base.h- Returns TRUE if a specified RETURN_STATUS code is an error code. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h- This function returns TRUE if StatusCode has the high bit set. Otherwise, FALSE is returned. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h- @param StatusCode The status code value to evaluate. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h- @retval TRUE The high bit of StatusCode is set. -MdePkg/Include/Base.h- @retval FALSE The high bit of StatusCode is clear. -MdePkg/Include/Base.h- -MdePkg/Include/Base.h-**/ -MdePkg/Include/Base.h-#define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0) -... -Uefi/UefiBaseType.h:typedef RETURN_STATUS EFI_STATUS; - -This patch makes grub's implementation match the Edk2 declaration with regards -to the signedness of the type. - -Signed-off-by: Peter Jones ---- - include/grub/efi/api.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 2ed9c26a450..dec7b06083e 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h -@@ -536,7 +536,7 @@ typedef grub_uint64_t grub_efi_uint64_t; - typedef grub_uint8_t grub_efi_char8_t; - typedef grub_uint16_t grub_efi_char16_t; - --typedef grub_efi_intn_t grub_efi_status_t; -+typedef grub_efi_uintn_t grub_efi_status_t; - /* Make grub_efi_status_t reasonably printable. */ - #if GRUB_CPU_SIZEOF_VOID_P == 8 - #define PRIxGRUB_EFI_STATUS "lx" diff --git a/0272-Introduce-function-grub_debug_is_enabled-void-return.patch b/0169-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 87% rename from 0272-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0169-Introduce-function-grub_debug_is_enabled-void-return.patch index 54248584..4e4718b7 100644 --- a/0272-Introduce-function-grub_debug_is_enabled-void-return.patch +++ b/0169-Introduce-function-grub_debug_is_enabled-void-return.patch @@ -14,10 +14,10 @@ Signed-off-by: Renaud Métrich 2 files changed, 14 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index bc23945a3c2..d729b439072 100644 +index 9f54b6b7d2d..a186ad3dd41 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -162,6 +162,19 @@ int grub_err_printf (const char *fmt, ...) +@@ -163,6 +163,19 @@ int grub_err_printf (const char *fmt, ...) __attribute__ ((alias("grub_printf"))); #endif @@ -38,10 +38,10 @@ index bc23945a3c2..d729b439072 100644 grub_debug_enabled (const char * condition) { diff --git a/include/grub/misc.h b/include/grub/misc.h -index 998e47e0ccf..f05e1947c4a 100644 +index 3adc4036e3b..6c4aa85ac50 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h -@@ -385,6 +385,7 @@ grub_puts (const char *s) +@@ -340,6 +340,7 @@ grub_puts (const char *s) } int EXPORT_FUNC(grub_puts_) (const char *s); diff --git a/0273-Don-t-clear-screen-when-debugging-is-enabled.patch b/0170-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 95% rename from 0273-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0170-Don-t-clear-screen-when-debugging-is-enabled.patch index 70f45e72..d2a59886 100644 --- a/0273-Don-t-clear-screen-when-debugging-is-enabled.patch +++ b/0170-Don-t-clear-screen-when-debugging-is-enabled.patch @@ -12,7 +12,7 @@ Signed-off-by: Renaud Métrich 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index f7ee912e715..abdccc86a59 100644 +index e349303c29b..155bf366da2 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -210,7 +210,8 @@ void diff --git a/0274-grub_file_-instrumentation-new-file-debug-tag.patch b/0171-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0274-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0171-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0275-ieee1275-Avoiding-many-unecessary-open-close.patch b/0172-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0275-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0172-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0173-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0276-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0173-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0277-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0174-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0277-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0174-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0175-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 99% rename from 0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0175-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch index 2f053c84..968a9c14 100644 --- a/0303-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +++ b/0175-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch @@ -29,7 +29,7 @@ solution": 1 file changed, 96 insertions(+), 25 deletions(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index 69d99b61df5..c805cccbdde 100644 +index 26014382608..dac0f946fe6 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -31,6 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0280-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 77% rename from 0280-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch index c8af937d..75e8ddad 100644 --- a/0280-Add-suport-for-signing-grub-with-an-appended-signatu.patch +++ b/0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -43,21 +43,21 @@ that verifies these signatures. You can find one at: I will be proposing this for inclusion in a future Power Architecture Platform Reference (PAPR). --- - util/grub-install-common.c | 16 +++++++++++++--- - util/grub-mkimage.c | 11 +++++++++++ + util/grub-install-common.c | 18 ++++++++++++++++-- + util/grub-mkimage.c | 16 ++++++++++++++-- util/grub-mkimagexx.c | 39 ++++++++++++++++++++++++++++++++++++++- - util/mkimage.c | 10 +++++----- + util/mkimage.c | 13 +++++++------ include/grub/util/install.h | 8 ++++++-- include/grub/util/mkimage.h | 4 ++-- - 6 files changed, 75 insertions(+), 13 deletions(-) + 6 files changed, 83 insertions(+), 15 deletions(-) diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 0295d40f5e4..e2be0a3e305 100644 +index b4f28840f10..a53f0a5c496 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c -@@ -308,10 +308,12 @@ handle_install_list (struct install_list *il, const char *val, - static char **pubkeys; - static size_t npubkeys; +@@ -335,10 +335,12 @@ static size_t npubkeys; + static char *sbat; + static int disable_shim_lock; static grub_compression_t compression; +static size_t appsig_size; @@ -68,7 +68,7 @@ index 0295d40f5e4..e2be0a3e305 100644 switch (key) { case 'C': -@@ -400,6 +402,12 @@ grub_install_parse (int key, char *arg) +@@ -436,6 +438,12 @@ grub_install_parse (int key, char *arg) grub_util_error (_("Unrecognized compression `%s'"), arg); case GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE: return 1; @@ -81,51 +81,51 @@ index 0295d40f5e4..e2be0a3e305 100644 default: return 0; } -@@ -498,10 +506,12 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, - grub_util_info ("grub-mkimage --directory '%s' --prefix '%s'" - " --output '%s' " - " --dtb '%s' " -- "--format '%s' --compression '%s' %s %s\n", +@@ -539,7 +547,13 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + dir, prefix, + outname, dtb ? : "", sbat ? : "", mkimage_target, + compnames[compression], note ? "--note" : "", +- disable_shim_lock ? "--disable-shim-lock" : "", s); ++ disable_shim_lock ? "--disable-shim-lock" : "", + "--format '%s' --compression '%s' " + "--appended-signature-size %zu %s %s\n", - dir, prefix, - outname, dtb ? : "", mkimage_target, -- compnames[compression], note ? "--note" : "", s); ++ dir, prefix, ++ outname, dtb ? : "", mkimage_target, + compnames[compression], appsig_size, + note ? "--note" : "", s); free (s); tgt = grub_install_get_image_target (mkimage_target); -@@ -511,7 +521,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -549,7 +563,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, pubkeys, npubkeys, config_path, tgt, -- note, compression, dtb); -+ note, appsig_size, compression, dtb); +- note, compression, dtb, sbat, ++ note, appsig_size, compression, dtb, sbat, + disable_shim_lock); while (dc--) grub_install_pop_module (); - } diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index 912564e3622..c1e07c70dc7 100644 +index c0d55993702..26d1ecbf74e 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c -@@ -82,6 +82,7 @@ static struct argp_option options[] = { - {"format", 'O', N_("FORMAT"), 0, 0, 0}, - {"compression", 'C', "(xz|none|auto)", 0, N_("choose the compression to use for core image"), 0}, +@@ -84,6 +84,7 @@ static struct argp_option options[] = { + {"sbat", 's', N_("FILE"), 0, N_("SBAT metadata"), 0}, + {"disable-shim-lock", GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, 0, 0, N_("disable shim_lock verifier"), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, + {"appended-signature-size", 's', N_("SIZE"), 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), 0}, { 0, 0, 0, 0, 0, 0 } }; -@@ -124,6 +125,7 @@ struct arguments - char *font; - char *config; +@@ -128,6 +129,7 @@ struct arguments + char *sbat; int note; + int disable_shim_lock; + size_t appsig_size; const struct grub_install_image_target_desc *image_target; grub_compression_t comp; }; -@@ -134,6 +136,7 @@ argp_parser (int key, char *arg, struct argp_state *state) +@@ -138,6 +140,7 @@ argp_parser (int key, char *arg, struct argp_state *state) /* Get the input argument from argp_parse, which we know is a pointer to our arguments structure. */ struct arguments *arguments = state->input; @@ -133,11 +133,11 @@ index 912564e3622..c1e07c70dc7 100644 switch (key) { -@@ -166,6 +169,13 @@ argp_parser (int key, char *arg, struct argp_state *state) +@@ -170,6 +173,13 @@ argp_parser (int key, char *arg, struct argp_state *state) arguments->note = 1; break; -+ case 's': ++ case 'S': + grub_errno = 0; + arguments->appsig_size = grub_strtol(arg, &end, 10); + if (grub_errno) @@ -147,16 +147,21 @@ index 912564e3622..c1e07c70dc7 100644 case 'm': if (arguments->memdisk) free (arguments->memdisk); -@@ -309,6 +319,7 @@ main (int argc, char *argv[]) +@@ -324,8 +334,10 @@ main (int argc, char *argv[]) arguments.memdisk, arguments.pubkeys, arguments.npubkeys, arguments.config, arguments.image_target, arguments.note, -+ arguments.appsig_size, - arguments.comp, arguments.dtb); +- arguments.comp, arguments.dtb, +- arguments.sbat, arguments.disable_shim_lock); ++ ++ arguments.comp, arguments.appsig_size, ++ arguments.dtb, arguments.sbat, ++ arguments.disable_shim_lock); if (grub_util_file_sync (fp) < 0) + grub_util_error (_("cannot sync `%s': %s"), arguments.output ? : "stdout", diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index 52bc9c848d9..bd2e2e9a52a 100644 +index 00f49ccaaaf..ed422bd1781 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -84,6 +84,15 @@ struct grub_ieee1275_note @@ -227,19 +232,22 @@ index 52bc9c848d9..bd2e2e9a52a 100644 char *str_start = (elf_img + sizeof (*ehdr) + phnum * sizeof (*phdr) + shnum * sizeof (*shdr)); diff --git a/util/mkimage.c b/util/mkimage.c -index 37d6249f16b..bd06968decc 100644 +index a26cf76f72f..bab12276010 100644 --- a/util/mkimage.c +++ b/util/mkimage.c -@@ -822,7 +822,7 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -869,8 +869,9 @@ grub_install_generate_image (const char *dir, const char *prefix, char *memdisk_path, char **pubkey_paths, size_t npubkeys, char *config_path, const struct grub_install_image_target_desc *image_target, -- int note, grub_compression_t comp, const char *dtb_path) -+ int note, size_t appsig_size, grub_compression_t comp, const char *dtb_path) +- int note, grub_compression_t comp, const char *dtb_path, +- const char *sbat_path, int disable_shim_lock) ++ int note, size_t appsig_size, grub_compression_t comp, ++ const char *dtb_path, const char *sbat_path, ++ int disable_shim_lock) { char *kernel_img, *core_img; size_t total_module_size, core_size; -@@ -1742,11 +1742,11 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -1773,11 +1774,11 @@ grub_install_generate_image (const char *dir, const char *prefix, else target_addr = image_target->link_addr; if (image_target->voidp_sizeof == 4) @@ -256,43 +264,43 @@ index 37d6249f16b..bd06968decc 100644 break; } diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index 2631b107451..eb1b83b6d94 100644 +index b93c73caac6..b3307fef9b4 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h -@@ -63,6 +63,9 @@ - /* TRANSLATORS: "embed" is a verb (command description). "*/ \ - { "pubkey", 'k', N_("FILE"), 0, \ - N_("embed FILE as public key for signature checking"), 0}, \ +@@ -67,6 +67,9 @@ + N_("SBAT metadata"), 0 }, \ + { "disable-shim-lock", GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, 0, 0, \ + N_("disable shim_lock verifier"), 0 }, \ + { "appended-signature-size", GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE,\ + "SIZE", 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), \ + 1}, \ { "verbose", 'v', 0, 0, \ N_("print verbose messages."), 1 } -@@ -122,7 +125,8 @@ enum grub_install_options { - GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, - GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, +@@ -128,7 +131,8 @@ enum grub_install_options { GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, -- GRUB_INSTALL_OPTIONS_DTB -+ GRUB_INSTALL_OPTIONS_DTB, + GRUB_INSTALL_OPTIONS_DTB, + GRUB_INSTALL_OPTIONS_SBAT, +- GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK ++ GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, + GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE }; extern char *grub_install_source_directory; -@@ -182,7 +186,7 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -188,7 +192,7 @@ grub_install_generate_image (const char *dir, const char *prefix, size_t npubkeys, char *config_path, const struct grub_install_image_target_desc *image_target, - int note, + int note, size_t appsig_size, - grub_compression_t comp, const char *dtb_file); + grub_compression_t comp, const char *dtb_file, + const char *sbat_path, const int disable_shim_lock); - const struct grub_install_image_target_desc * diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h -index ba9f568f692..2000d6fbdf1 100644 +index 3819a67441c..6f1da89b9b6 100644 --- a/include/grub/util/mkimage.h +++ b/include/grub/util/mkimage.h -@@ -50,12 +50,12 @@ grub_mkimage_load_image64 (const char *kernel_path, +@@ -51,12 +51,12 @@ grub_mkimage_load_image64 (const char *kernel_path, const struct grub_install_image_target_desc *image_target); void grub_mkimage_generate_elf32 (const struct grub_install_image_target_desc *image_target, diff --git a/0177-autogen.sh-use-find-wholename-for-long-path-matches.patch b/0177-autogen.sh-use-find-wholename-for-long-path-matches.patch deleted file mode 100644 index 1ac3f16e..00000000 --- a/0177-autogen.sh-use-find-wholename-for-long-path-matches.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 29 Jul 2019 14:01:50 -0400 -Subject: [PATCH] autogen.sh: use find -wholename for long path matches - -Signed-off-by: Peter Jones ---- - autogen.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/autogen.sh b/autogen.sh -index ef43270fca0..a1783d62c26 100755 ---- a/autogen.sh -+++ b/autogen.sh -@@ -13,7 +13,7 @@ fi - export LC_COLLATE=C - unset LC_ALL - --find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -ipath './gnulib/*' ! -iname './grub-core/lib/gnulib/*' |sort > po/POTFILES.in -+find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -ipath './gnulib/*' ! -wholename './grub-core/lib/gnulib/*' |sort > po/POTFILES.in - find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in - - echo "Importing unicode..." diff --git a/0281-docs-grub-Document-signing-grub-under-UEFI.patch b/0177-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 60% rename from 0281-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0177-docs-grub-Document-signing-grub-under-UEFI.patch index 387b51d7..2f53d524 100644 --- a/0281-docs-grub-Document-signing-grub-under-UEFI.patch +++ b/0177-docs-grub-Document-signing-grub-under-UEFI.patch @@ -7,25 +7,24 @@ Before adding information about how grub is signed with an appended signature scheme, it's worth adding some information about how it can currently be signed for UEFI. -(adjusted from upstream - s/grub/grub2/ in the docs) Signed-off-by: Daniel Axtens --- - docs/grub.texi | 19 ++++++++++++++++++- - 1 file changed, 18 insertions(+), 1 deletion(-) + docs/grub.texi | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 085b9974cc5..abb1d0fae54 100644 +index 75b22231f35..ca36ad0b6b7 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5645,6 +5645,7 @@ environment variables and commands are listed in the same order. - @menu - * Authentication and authorisation:: Users and access control - * Using digital signatures:: Booting digitally signed code -+* Signing GRUB itself:: Ensuring the integrity of the GRUB core image - * UEFI secure boot and shim:: Booting digitally signed PE files +@@ -5814,6 +5814,7 @@ environment variables and commands are listed in the same order. + * Secure Boot Advanced Targeting:: Embedded information for generation number based revocation * Measured Boot:: Measuring boot components + * Lockdown:: Lockdown when booting on a secure setup ++* Signing GRUB itself:: Ensuring the integrity of the GRUB core image @end menu -@@ -5724,7 +5725,7 @@ commands. + + @node Authentication and authorisation +@@ -5892,7 +5893,7 @@ commands. GRUB's @file{core.img} can optionally provide enforcement that all files subsequently read from disk are covered by a valid digital signature. @@ -34,9 +33,9 @@ index 085b9974cc5..abb1d0fae54 100644 platform's firmware (e.g., Coreboot) validates @file{core.img}. If environment variable @code{check_signatures} -@@ -5809,6 +5810,22 @@ or BIOS) configuration to cause the machine to boot from a different - (attacker-controlled) device. GRUB is at best only one link in a - secure boot chain. +@@ -6064,6 +6065,25 @@ be restricted and some operations/commands cannot be executed. + The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down. + Otherwise it does not exit. +@node Signing GRUB itself +@section Signing GRUB itself @@ -51,9 +50,12 @@ index 085b9974cc5..abb1d0fae54 100644 +@section Signing GRUB for UEFI secure boot + +On UEFI platforms, @file{core.img} is a PE binary. Therefore, it can be signed -+with a tool such as @command{pesign} or @command{sbsign}. It will also be -+necessary to enrol the public key used into a relevant firmware key database. ++with a tool such as @command{pesign} or @command{sbsign}. Refer to the ++suggestions in @pxref{UEFI secure boot and shim} to ensure that the final ++image works under UEFI secure boot and can maintain the secure-boot chain. It ++will also be necessary to enrol the public key used into a relevant firmware ++key database. + - @node UEFI secure boot and shim - @section UEFI secure boot and shim support + @node Platform limitations + @chapter Platform limitations diff --git a/0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch b/0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch deleted file mode 100644 index 3a0e5bcf..00000000 --- a/0178-bootstrap.conf-don-t-clobber-AM_CFLAGS-here.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 29 Jul 2019 14:02:11 -0400 -Subject: [PATCH] bootstrap.conf: don't clobber AM_CFLAGS here - ---- - bootstrap.conf | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/bootstrap.conf b/bootstrap.conf -index 24ea40b2fc5..274c55a5568 100644 ---- a/bootstrap.conf -+++ b/bootstrap.conf -@@ -84,9 +84,6 @@ cp -a INSTALL INSTALL.grub - - bootstrap_post_import_hook () { - set -e -- for flagvar in CPPFLAGS CFLAGS; do -- sed -i -e "s/^AM_$flagvar =/AM_$flagvar = \$(HOST_$flagvar)/" grub-core/lib/gnulib/Makefile.am -- done - FROM_BOOTSTRAP=1 ./autogen.sh - set +e # bootstrap expects this - } diff --git a/0282-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 76% rename from 0282-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch index cff60cf4..29db2bb8 100644 --- a/0282-docs-grub-Document-signing-grub-with-an-appended-sig.patch +++ b/0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 8 Feb 2021 19:17:55 +0100 +From: Daniel Axtens +Date: Sat, 15 Aug 2020 02:19:36 +1000 Subject: [PATCH] docs/grub: Document signing grub with an appended signature Signing grub for firmware that verifies an appended signature is a @@ -9,24 +9,24 @@ so document it here. Signed-off-by: Daniel Axtens --- - docs/grub.texi | 41 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 41 insertions(+) + docs/grub.texi | 42 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index abb1d0fae54..e8bfe7ee7e8 100644 +index ca36ad0b6b7..691ffaa1861 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5826,6 +5826,47 @@ On UEFI platforms, @file{core.img} is a PE binary. Therefore, it can be signed - with a tool such as @command{pesign} or @command{sbsign}. It will also be - necessary to enrol the public key used into a relevant firmware key database. +@@ -6084,6 +6084,48 @@ image works under UEFI secure boot and can maintain the secure-boot chain. It + will also be necessary to enrol the public key used into a relevant firmware + key database. +@section Signing GRUB with an appended signature + -+The @file{core.img} itself can be signed with a Linux kernel module-style ++The @file{core.elf} itself can be signed with a Linux kernel module-style +appended signature. + +To support IEEE1275 platforms where the boot image is often loaded directly -+from a disk partition rather than from a file system, the @file{core.img} ++from a disk partition rather than from a file system, the @file{core.elf} +can specify the size and location of the appended signature with an ELF +note added by @command{grub-install}. + @@ -61,6 +61,7 @@ index abb1d0fae54..e8bfe7ee7e8 100644 +As with UEFI secure boot, it is necessary to build in the required modules, +or sign them separately. + - @node UEFI secure boot and shim - @section UEFI secure boot and shim support ++ + @node Platform limitations + @chapter Platform limitations diff --git a/0285-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0179-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 92% rename from 0285-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0179-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch index 7429d642..6e46db01 100644 --- a/0285-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +++ b/0179-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch @@ -16,10 +16,10 @@ Signed-off-by: Daniel Axtens 1 file changed, 11 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index 4fe2b524f73..177bcd67a25 100644 +index 2f76e6b0437..20d870f2a47 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h -@@ -243,11 +243,22 @@ grub_dl_get (const char *name) +@@ -245,11 +245,22 @@ grub_dl_get (const char *name) return 0; } diff --git a/0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch b/0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch deleted file mode 100644 index 582cadbd..00000000 --- a/0180-RISC-V-Fix-computation-of-pc-relative-relocation-off.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Andreas Schwab -Date: Wed, 26 Jun 2019 16:50:03 +0200 -Subject: [PATCH] RISC-V: Fix computation of pc-relative relocation offset - -The offset calculation was missing the relocation addend. - -Signed-off-by: Andreas Schwab -Tested-by: Chester Lin -Reviewed-by: Daniel Kiper ---- - util/grub-mkimagexx.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index bc087c2b57f..d16ec63a16f 100644 ---- a/util/grub-mkimagexx.c -+++ b/util/grub-mkimagexx.c -@@ -1232,8 +1232,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd, - grub_uint32_t *t32 = (grub_uint32_t *) target; - grub_uint16_t *t16 = (grub_uint16_t *) target; - grub_uint8_t *t8 = (grub_uint8_t *) target; -- grub_int64_t off = (long)sym_addr - target_section_addr - offset -- - image_target->vaddr_offset; -+ grub_int64_t off; - - /* - * Instructions and instruction encoding are documented in the RISC-V -@@ -1243,6 +1242,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, struct section_metadata *smd, - */ - - sym_addr += addend; -+ off = sym_addr - target_section_addr - offset - image_target->vaddr_offset; - - switch (ELF_R_TYPE (info)) - { diff --git a/0287-pgp-factor-out-rsa_pad.patch b/0180-pgp-factor-out-rsa_pad.patch similarity index 98% rename from 0287-pgp-factor-out-rsa_pad.patch rename to 0180-pgp-factor-out-rsa_pad.patch index 3d4e1919..a8154e74 100644 --- a/0287-pgp-factor-out-rsa_pad.patch +++ b/0180-pgp-factor-out-rsa_pad.patch @@ -27,10 +27,10 @@ Signed-off-by: Daniel Axtens create mode 100644 include/grub/pkcs1_v15.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index b283c502b9c..58bf113e7c1 100644 +index 81fc274148e..97347ae76f9 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2488,6 +2488,14 @@ module = { +@@ -2510,6 +2510,14 @@ module = { cppflags = '$(CPPFLAGS_GCRY)'; }; @@ -46,7 +46,7 @@ index b283c502b9c..58bf113e7c1 100644 name = all_video; common = lib/fake_module.c; diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index bbf6871fe71..2032afa4ec6 100644 +index 5daa1e9d00c..2408db4994f 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -24,6 +24,7 @@ diff --git a/0181-blscfg-Add-support-for-the-devicetree-field.patch b/0181-blscfg-Add-support-for-the-devicetree-field.patch deleted file mode 100644 index 8c971af5..00000000 --- a/0181-blscfg-Add-support-for-the-devicetree-field.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Sun, 15 Sep 2019 09:37:45 +0200 -Subject: [PATCH] blscfg: Add support for the devicetree field - -The BootLoaderSpec mentions that a devicetree field can be used to pass a -Device Tree (DT) to the kernel, for the platforms that use it to describe -information about the hardware. - -Allow the blscfg module to parse this field and call the grub2 devicetree -command in that case. If there is a devicetree grub2 environment variable -defined, this will be used if the field is not defined in the BLS snippet. - -Resolves: rhbz#1751307 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/blscfg.c | 60 ++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 57 insertions(+), 3 deletions(-) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 54458b14518..1ec89870483 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -698,6 +698,8 @@ static void create_entry (struct bls_entry *entry) - const char *early_initrd = NULL; - char **early_initrds = NULL; - char *initrd_prefix = NULL; -+ char *devicetree = NULL; -+ char *dt = NULL; - char *id = entry->filename; - char *dotconf = id; - char *hotkey = NULL; -@@ -709,6 +711,7 @@ static void create_entry (struct bls_entry *entry) - - char *src = NULL; - int i, index; -+ bool add_dt_prefix = false; - - grub_dprintf("blscfg", "%s got here\n", __func__); - clinux = bls_get_val (entry, "linux", NULL); -@@ -736,6 +739,14 @@ static void create_entry (struct bls_entry *entry) - - initrds = bls_make_list (entry, "initrd", NULL); - -+ devicetree = expand_val (bls_get_val (entry, "devicetree", NULL)); -+ -+ if (!devicetree) -+ { -+ devicetree = expand_val (grub_env_get("devicetree")); -+ add_dt_prefix = true; -+ } -+ - hotkey = bls_get_val (entry, "grub_hotkey", NULL); - users = expand_val (bls_get_val (entry, "grub_users", NULL)); - classes = bls_make_list (entry, "grub_class", NULL); -@@ -801,7 +812,6 @@ static void create_entry (struct bls_entry *entry) - goto finish; - } - -- - tmp = grub_stpcpy(initrd, "initrd"); - for (i = 0; early_initrds != NULL && early_initrds[i] != NULL; i++) - { -@@ -821,21 +831,65 @@ static void create_entry (struct bls_entry *entry) - tmp = grub_stpcpy (tmp, "\n"); - } - -+ if (devicetree) -+ { -+ char *prefix = NULL; -+ int dt_size; -+ -+ if (add_dt_prefix) -+ { -+ prefix = grub_strrchr (clinux, '/'); -+ prefix = grub_strndup(clinux, prefix - clinux + 1); -+ if (!prefix) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -+ goto finish; -+ } -+ } -+ -+ dt_size = sizeof("devicetree " GRUB_BOOT_DEVICE) + grub_strlen(devicetree) + 1; -+ -+ if (add_dt_prefix) -+ { -+ dt_size += grub_strlen(prefix); -+ } -+ -+ dt = grub_malloc (dt_size); -+ if (!dt) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -+ goto finish; -+ } -+ char *tmp = dt; -+ tmp = grub_stpcpy (dt, "devicetree"); -+ tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); -+ if (add_dt_prefix) -+ tmp = grub_stpcpy (tmp, prefix); -+ tmp = grub_stpcpy (tmp, devicetree); -+ tmp = grub_stpcpy (tmp, "\n"); -+ -+ grub_free(prefix); -+ } -+ -+ grub_dprintf ("blscfg2", "devicetree %s for id:\"%s\"\n", dt, id); -+ - src = grub_xasprintf ("load_video\n" - "set gfxpayload=keep\n" - "insmod gzio\n" - "linux %s%s%s%s\n" -- "%s", -+ "%s%s", - GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", -- initrd ? initrd : ""); -+ initrd ? initrd : "", dt ? dt : ""); - - grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry); - grub_dprintf ("blscfg", "Added entry %d id:\"%s\"\n", index, id); - - finish: -+ grub_free (dt); - grub_free (initrd); - grub_free (initrd_prefix); - grub_free (early_initrds); -+ grub_free (devicetree); - grub_free (initrds); - grub_free (options); - grub_free (classes); diff --git a/0288-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0181-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 96% rename from 0288-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0181-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch index adfb680a..763cdc63 100644 --- a/0288-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +++ b/0181-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch @@ -40,7 +40,7 @@ Signed-off-by: Daniel Axtens 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 2032afa4ec6..4e0667c1cd0 100644 +index 2408db4994f..355a43844ac 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -147,10 +147,6 @@ const char *hashes[] = { @@ -55,7 +55,7 @@ index 2032afa4ec6..4e0667c1cd0 100644 dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval, const gcry_md_spec_t *hash, struct grub_public_subkey *sk); diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index e6c78d16d39..ff62fa30e1a 100644 +index ca334d5a40e..c578128a59d 100644 --- a/grub-core/lib/crypto.c +++ b/grub-core/lib/crypto.c @@ -121,6 +121,10 @@ grub_md_unregister (gcry_md_spec_t *cipher) diff --git a/0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch b/0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch deleted file mode 100644 index 2da87d63..00000000 --- a/0182-Set-a-devicetree-var-in-a-BLS-config-if-GRUB_DEFAULT.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Sun, 15 Sep 2019 10:05:29 +0200 -Subject: [PATCH] Set a devicetree var in a BLS config if GRUB_DEFAULT_DTB is - present - -The BootLoaderSpec mentions that a devicetree field can be used to pass a -Device Tree (DT) to the kernel, for the platforms that use it to describe -information about the hardware. - -The blscfg module supports parsing the field from the BLS snippets but it -allows to set a DT for all the entries if a devicetree env var is defined. - -Make the grub2-mkconfig tool to set this variable if GRUB_DEFAULT_DTB was -defined in the /etc/default/grub file. - -Resolves: rhbz#1751307 - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/10_linux.in | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 301594a0c9e..1520b7e47c1 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -138,6 +138,10 @@ EOF - if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then - ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" - fi -+ -+ if [ -n "${GRUB_DEFAULT_DTB}" ]; then -+ ${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}" -+ fi - fi - - exit 0 diff --git a/0289-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0182-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0289-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0182-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch b/0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch deleted file mode 100644 index d1366182..00000000 --- a/0183-Don-t-add-a-class-option-to-menu-entries-generated-f.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Fri, 4 Oct 2019 16:43:05 +0200 -Subject: [PATCH] Don't add a class option to menu entries generated for - ppc64le - -For ppc64le a grub config file with menuentry commands is still generated -even when BLS support is enabled. That's because BLS support was added to -Petitboot 1.8.0 and any previous version won't be able to parse BLS files. - -To make the BLS snippets the source of truth, these are used to generate -the menuentry commands in the grub config file. - -And to keep it consistent across all ppc64le machines regardless of the -firmware used, the grub config file is also generated for machines with -OF that use grub2 and would have BLS support. - -The BLS snippets created by the kernel package have fields that are used -to specify the generated menuentry command users and class options. These -fields are not present in BLS snippets created by OSTree though, so the -script generating the menuentry commands will add options with an empty -argument which will lead to grub failing to parse them. - -We could check if the field is defined before attempting to add those, but -since the grub2 blscfg module also supports setting these to variables, it -could lead to an empty argument even if was defined in the BLS snippet if -the variable doesn't exist. - -So to make more robust, just don't add a class to the menuentry commands -generated by the script. It's better to not have a class for the menuentry -than grub2 failing to parse the command and not populating the boot menu. - -Resolves: rhbz#1758225 - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/10_linux_bls.in | 10 +--------- - 1 file changed, 1 insertion(+), 9 deletions(-) - -diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in -index 1b7536435f1..68fbedf2129 100644 ---- a/util/grub.d/10_linux_bls.in -+++ b/util/grub.d/10_linux_bls.in -@@ -127,9 +127,7 @@ read_config() - initrd="" - options="" - linux="" -- grub_users="" - grub_arg="" -- grub_class="" - - while read -r line - do -@@ -148,15 +146,9 @@ read_config() - "options") - options=${value} - ;; -- "grub_users") -- grub_users=${value} -- ;; - "grub_arg") - grub_arg=${value} - ;; -- "grub_class") -- grub_class=${value} -- ;; - esac - done < ${config_file} - } -@@ -180,7 +172,7 @@ populate_menu() - for bls in "${files[@]}" ; do - read_config "${blsdir}/${bls}.conf" - -- menu="${menu}menuentry '${title}' --class ${grub_class} ${grub_arg} --id=${bls} {\n" -+ menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" - menu="${menu}\t linux ${linux} ${options}\n" - if [ -n "${initrd}" ] ; then - menu="${menu}\t initrd ${boot_prefix}${initrd}\n" diff --git a/0290-libtasn1-import-libtasn1-4.16.0.patch b/0183-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0290-libtasn1-import-libtasn1-4.16.0.patch rename to 0183-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch b/0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch deleted file mode 100644 index f4aa0084..00000000 --- a/0184-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 15 Oct 2019 09:08:25 +0200 -Subject: [PATCH] 10_linux.in: Also use GRUB_CMDLINE_LINUX_DEFAULT to set - kernelopts - -The GRUB documentation mentions that there are two variables to set the -linux kernel cmdline: GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT. - -The former is added to all the menuentry commands and the latter is not -added to the recovery mode menu entries. But the blscfg module doesn't -populate recovery entries from the BLS snippets, so the values set in the -GRUB_CMDLINE_LINUX_DEFAULT variable should also be included in kernelopts. - -This is needed because the GRUB_CMDLINE_LINUX_DEFAULT option is mentioned -in the GRUB documentation so users assume that the kernel cmdline options -can be changed by setting this option and running the grub2-mkconfig tool. - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/10_linux.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 1520b7e47c1..0471464e68e 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -118,7 +118,7 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then - populate_header_warn - - cat << EOF --set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}" -+set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - - insmod blscfg - blscfg -@@ -134,7 +134,7 @@ EOF - fi - fi - -- ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}" -+ ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then - ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" - fi diff --git a/0291-libtasn1-disable-code-not-needed-in-grub.patch b/0184-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0291-libtasn1-disable-code-not-needed-in-grub.patch rename to 0184-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch b/0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch deleted file mode 100644 index 669c7709..00000000 --- a/0185-blscfg-Don-t-hardcode-an-env-var-as-fallback-for-the.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 14 Oct 2019 17:37:26 +0200 -Subject: [PATCH] blscfg: Don't hardcode an env var as fallback for the BLS - options field - -If the BLS fragments don't have an options field or if this was set to an -environment variable that was not defined in the grubenv file, the blscfg -module searches for an default_kernelopts variable that is defined in the -grub.cfg file. - -But the blscfg module shouldn't hardcode fallbacks variables and instead -this logic should be handled in the GRUB config file itself. - -Also, add a comment explaining where the kernelopts variable is supposed -to be defined and what is the process for the user to change its value. - -Resolves: rhbz#1710483 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/blscfg.c | 4 ---- - util/grub.d/10_linux.in | 12 +++++++++++- - 2 files changed, 11 insertions(+), 5 deletions(-) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 1ec89870483..471975fd2e5 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -733,10 +733,6 @@ static void create_entry (struct bls_entry *entry) - - title = bls_get_val (entry, "title", NULL); - options = expand_val (bls_get_val (entry, "options", NULL)); -- -- if (!options) -- options = expand_val (grub_env_get("default_kernelopts")); -- - initrds = bls_make_list (entry, "initrd", NULL); - - devicetree = expand_val (bls_get_val (entry, "devicetree", NULL)); -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 0471464e68e..21a6915dca3 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -118,7 +118,17 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then - populate_header_warn - - cat << EOF --set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -+# The kernelopts variable should be defined in the grubenv file. But to ensure that menu -+# entries populated from BootLoaderSpec files that use this variable work correctly even -+# without a grubenv file, define a fallback kernelopts variable if this has not been set. -+# -+# The kernelopts variable in the grubenv file can be modified using the grubby tool or by -+# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX -+# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both -+# the kernelopts variable in the grubenv file and the fallback kernelopts variable. -+if [ -z "\${kernelopts}" ]; then -+ set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -+fi - - insmod blscfg - blscfg diff --git a/0292-libtasn1-changes-for-grub-compatibility.patch b/0185-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0292-libtasn1-changes-for-grub-compatibility.patch rename to 0185-libtasn1-changes-for-grub-compatibility.patch diff --git a/0293-libtasn1-compile-into-asn1-module.patch b/0186-libtasn1-compile-into-asn1-module.patch similarity index 97% rename from 0293-libtasn1-compile-into-asn1-module.patch rename to 0186-libtasn1-compile-into-asn1-module.patch index 2ee3d9ad..67be4e87 100644 --- a/0293-libtasn1-compile-into-asn1-module.patch +++ b/0186-libtasn1-compile-into-asn1-module.patch @@ -14,10 +14,10 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/lib/libtasn1_wrap/wrap.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 58bf113e7c1..a9f589a7b99 100644 +index 97347ae76f9..21d2c541850 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2554,3 +2554,18 @@ module = { +@@ -2576,3 +2576,18 @@ module = { common = commands/i386/wrmsr.c; enable = x86; }; diff --git a/0294-test_asn1-test-module-for-libtasn1.patch b/0187-test_asn1-test-module-for-libtasn1.patch similarity index 99% rename from 0294-test_asn1-test-module-for-libtasn1.patch rename to 0187-test_asn1-test-module-for-libtasn1.patch index 6036148f..3a02b247 100644 --- a/0294-test_asn1-test-module-for-libtasn1.patch +++ b/0187-test_asn1-test-module-for-libtasn1.patch @@ -51,10 +51,10 @@ Signed-off-by: Daniel Axtens create mode 100644 tests/test_asn1.in diff --git a/Makefile.util.def b/Makefile.util.def -index dc8d1790ea5..d7908cbd1a0 100644 +index e1242f54022..8cfbe69a76e 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1304,6 +1304,12 @@ script = { +@@ -1305,6 +1305,12 @@ script = { common = tests/syslinux_test.in; }; @@ -68,10 +68,10 @@ index dc8d1790ea5..d7908cbd1a0 100644 testcase; name = example_unit_test; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index a9f589a7b99..78071360529 100644 +index 21d2c541850..b4aaccf7b57 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2569,3 +2569,16 @@ module = { +@@ -2591,3 +2591,16 @@ module = { // -Wno-type-limits comes from libtasn1's configure.ac cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB) -I$(srcdir)/lib/libtasn1/lib -Wno-type-limits'; }; @@ -1426,15 +1426,17 @@ index 00000000000..555e56dd202 + +#endif diff --git a/.gitignore b/.gitignore -index b45a633f3d1..0687c3cb5a2 100644 +index 594d0134d33..856e69bc5c1 100644 --- a/.gitignore +++ b/.gitignore -@@ -148,4 +148,5 @@ grub-*.tar.* - /libgrub_a_init.c - /libgrub_a_init.lst - /stamp-h.in +@@ -264,6 +264,7 @@ widthspec.bin + /stamp-h1 + /syslinux_test + /tar_test +/test_asn1 - /widthspec.h + /test_sha512sum + /test_unset + /tests/syslinux/ubuntu10.04_grub.cfg diff --git a/tests/test_asn1.in b/tests/test_asn1.in new file mode 100644 index 00000000000..8173c5c270e diff --git a/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch b/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch deleted file mode 100644 index 9f692382..00000000 --- a/0188-blscfg-add-a-space-char-when-appending-fields-for-va.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 26 Nov 2019 09:51:41 +0100 -Subject: [PATCH] blscfg: add a space char when appending fields for variable - expansion - -The GRUB variables are expanded and replaced by their values before adding -menu entries, but they didn't include space characters after the values so -the result was not correct. - -For the common case this wasn't a problem but it is if there are variables -that are part of the values of other variables. - -Resolves: rhbz#1669252 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/blscfg.c | 31 ++++++++++++++++++------------- - 1 file changed, 18 insertions(+), 13 deletions(-) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 471975fd2e5..d78cff79f97 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -593,26 +593,29 @@ static char **bls_make_list (struct bls_entry *entry, const char *key, int *num) - - static char *field_append(bool is_var, char *buffer, char *start, char *end) - { -- char *temp = grub_strndup(start, end - start + 1); -- const char *field = temp; -+ char *tmp = grub_strndup(start, end - start + 1); -+ const char *field = tmp; -+ int term = is_var ? 2 : 1; - - if (is_var) { -- field = grub_env_get (temp); -+ field = grub_env_get (tmp); - if (!field) - return buffer; - } - -- if (!buffer) { -- buffer = grub_strdup(field); -- if (!buffer) -- return NULL; -- } else { -- buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field)); -- if (!buffer) -- return NULL; -+ if (!buffer) -+ buffer = grub_zalloc (grub_strlen(field) + term); -+ else -+ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field) + term); - -- grub_stpcpy (buffer + grub_strlen(buffer), field); -- } -+ if (!buffer) -+ return NULL; -+ -+ tmp = buffer + grub_strlen(buffer); -+ tmp = grub_stpcpy (tmp, field); -+ -+ if (is_var) -+ tmp = grub_stpcpy (tmp, " "); - - return buffer; - } -@@ -642,6 +645,8 @@ static char *expand_val(char *value) - buffer = field_append(is_var, buffer, start, end); - is_var = false; - start = value; -+ if (*start == ' ') -+ start++; - } - } - diff --git a/0295-grub-install-support-embedding-x509-certificates.patch b/0188-grub-install-support-embedding-x509-certificates.patch similarity index 77% rename from 0295-grub-install-support-embedding-x509-certificates.patch rename to 0188-grub-install-support-embedding-x509-certificates.patch index 2bc196aa..4d13e3c8 100644 --- a/0295-grub-install-support-embedding-x509-certificates.patch +++ b/0188-grub-install-support-embedding-x509-certificates.patch @@ -12,15 +12,15 @@ Signed-off-by: Alastair D'Silva Signed-off-by: Daniel Axtens --- grub-core/commands/pgp.c | 2 +- - util/grub-install-common.c | 23 ++++++++++++++++++++++- + util/grub-install-common.c | 22 +++++++++++++++++++++- util/grub-mkimage.c | 15 +++++++++++++-- - util/mkimage.c | 41 ++++++++++++++++++++++++++++++++++++++--- - include/grub/kernel.h | 3 ++- + util/mkimage.c | 38 ++++++++++++++++++++++++++++++++++++-- + include/grub/kernel.h | 4 +++- include/grub/util/install.h | 7 +++++-- - 6 files changed, 81 insertions(+), 10 deletions(-) + 6 files changed, 79 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 4e0667c1cd0..3cd31f50b5b 100644 +index 355a43844ac..b81ac0ae46c 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -944,7 +944,7 @@ GRUB_MOD_INIT(pgp) @@ -33,32 +33,31 @@ index 4e0667c1cd0..3cd31f50b5b 100644 pseudo_file.fs = &pseudo_fs; diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index e2be0a3e305..65cde2fa2f0 100644 +index a53f0a5c496..917904ee73d 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c -@@ -307,6 +307,8 @@ handle_install_list (struct install_list *il, const char *val, - - static char **pubkeys; +@@ -334,6 +334,8 @@ static char **pubkeys; static size_t npubkeys; + static char *sbat; + static int disable_shim_lock; +static char **x509keys; +static size_t nx509keys; static grub_compression_t compression; static size_t appsig_size; -@@ -339,6 +341,12 @@ grub_install_parse (int key, char *arg) - * (npubkeys + 1)); - pubkeys[npubkeys++] = xstrdup (arg); +@@ -374,6 +376,11 @@ grub_install_parse (int key, char *arg) return 1; + case GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK: + disable_shim_lock = 1; + case 'x': + x509keys = xrealloc (x509keys, + sizeof (x509keys[0]) + * (nx509keys + 1)); + x509keys[nx509keys++] = xstrdup (arg); -+ return 1; + return 1; case GRUB_INSTALL_OPTIONS_VERBOSITY: - verbosity++; -@@ -465,6 +473,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -501,6 +508,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, for (pk = pubkeys; pk < pubkeys + npubkeys; pk++) slen += 20 + grub_strlen (*pk); @@ -68,7 +67,7 @@ index e2be0a3e305..65cde2fa2f0 100644 for (md = modules.entries; *md; md++) { slen += 10 + grub_strlen (*md); -@@ -493,6 +504,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -529,6 +539,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, *p++ = ' '; } @@ -83,7 +82,7 @@ index e2be0a3e305..65cde2fa2f0 100644 for (md = modules.entries; *md; md++) { *p++ = '\''; -@@ -520,7 +539,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -562,7 +580,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, @@ -91,11 +90,11 @@ index e2be0a3e305..65cde2fa2f0 100644 + pubkeys, npubkeys, + x509keys, nx509keys, + config_path, tgt, - note, appsig_size, compression, dtb); + note, appsig_size, compression, dtb, sbat, + disable_shim_lock); while (dc--) - grub_install_pop_module (); diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index c1e07c70dc7..6034c51ece4 100644 +index 26d1ecbf74e..c5cdda498eb 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -75,7 +75,8 @@ static struct argp_option options[] = { @@ -108,7 +107,7 @@ index c1e07c70dc7..6034c51ece4 100644 /* TRANSLATORS: NOTE is a name of segment. */ {"note", 'n', 0, 0, N_("add NOTE segment for CHRP IEEE1275"), 0}, {"output", 'o', N_("FILE"), 0, N_("output a generated image to FILE [default=stdout]"), 0}, -@@ -122,6 +123,8 @@ struct arguments +@@ -124,6 +125,8 @@ struct arguments char *dtb; char **pubkeys; size_t npubkeys; @@ -116,8 +115,8 @@ index c1e07c70dc7..6034c51ece4 100644 + size_t nx509keys; char *font; char *config; - int note; -@@ -202,6 +205,13 @@ argp_parser (int key, char *arg, struct argp_state *state) + char *sbat; +@@ -206,6 +209,13 @@ argp_parser (int key, char *arg, struct argp_state *state) arguments->pubkeys[arguments->npubkeys++] = xstrdup (arg); break; @@ -131,7 +130,7 @@ index c1e07c70dc7..6034c51ece4 100644 case 'c': if (arguments->config) free (arguments->config); -@@ -317,7 +327,8 @@ main (int argc, char *argv[]) +@@ -332,7 +342,8 @@ main (int argc, char *argv[]) grub_install_generate_image (arguments.dir, arguments.prefix, fp, arguments.output, arguments.modules, arguments.memdisk, arguments.pubkeys, @@ -139,26 +138,23 @@ index c1e07c70dc7..6034c51ece4 100644 + arguments.npubkeys, arguments.x509keys, + arguments.nx509keys, arguments.config, arguments.image_target, arguments.note, - arguments.appsig_size, - arguments.comp, arguments.dtb); + + arguments.comp, arguments.appsig_size, diff --git a/util/mkimage.c b/util/mkimage.c -index bd06968decc..5702a00d06f 100644 +index bab12276010..8319e8dfbde 100644 --- a/util/mkimage.c +++ b/util/mkimage.c -@@ -819,8 +819,10 @@ grub_install_get_image_targets_string (void) - void +@@ -867,7 +867,8 @@ void grub_install_generate_image (const char *dir, const char *prefix, FILE *out, const char *outname, char *mods[], -- char *memdisk_path, char **pubkey_paths, + char *memdisk_path, char **pubkey_paths, - size_t npubkeys, char *config_path, -+ char *memdisk_path, -+ char **pubkey_paths, size_t npubkeys, -+ char **x509key_paths, size_t nx509keys, -+ char *config_path, ++ size_t npubkeys, char **x509key_paths, ++ size_t nx509keys, char *config_path, const struct grub_install_image_target_desc *image_target, - int note, size_t appsig_size, grub_compression_t comp, const char *dtb_path) - { -@@ -864,6 +866,19 @@ grub_install_generate_image (const char *dir, const char *prefix, + int note, size_t appsig_size, grub_compression_t comp, + const char *dtb_path, const char *sbat_path, +@@ -913,6 +914,19 @@ grub_install_generate_image (const char *dir, const char *prefix, } } @@ -178,7 +174,7 @@ index bd06968decc..5702a00d06f 100644 if (memdisk_path) { memdisk_size = ALIGN_UP(grub_util_get_image_size (memdisk_path), 512); -@@ -979,7 +994,7 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -1034,7 +1048,7 @@ grub_install_generate_image (const char *dir, const char *prefix, curs = grub_util_get_image_size (pubkey_paths[i]); header = (struct grub_module_header *) (kernel_img + offset); @@ -187,7 +183,7 @@ index bd06968decc..5702a00d06f 100644 header->size = grub_host_to_target32 (curs + sizeof (*header)); offset += sizeof (*header); -@@ -988,6 +1003,26 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -1043,6 +1057,26 @@ grub_install_generate_image (const char *dir, const char *prefix, } } @@ -215,33 +211,34 @@ index bd06968decc..5702a00d06f 100644 { struct grub_module_header *header; diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index de48cd44ccb..5d54c45cb70 100644 +index 55849777eaa..98edc0863f6 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h -@@ -28,7 +28,8 @@ enum - OBJ_TYPE_MEMDISK, - OBJ_TYPE_CONFIG, +@@ -30,7 +30,9 @@ enum OBJ_TYPE_PREFIX, -- OBJ_TYPE_PUBKEY, + OBJ_TYPE_PUBKEY, + OBJ_TYPE_DTB, +- OBJ_TYPE_DISABLE_SHIM_LOCK ++ OBJ_TYPE_DISABLE_SHIM_LOCK, + OBJ_TYPE_GPG_PUBKEY, + OBJ_TYPE_X509_PUBKEY, - OBJ_TYPE_DTB }; + /* The module header. */ diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index eb1b83b6d94..8353bafb00a 100644 +index b3307fef9b4..faecf7b26e2 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h -@@ -63,6 +63,8 @@ - /* TRANSLATORS: "embed" is a verb (command description). "*/ \ - { "pubkey", 'k', N_("FILE"), 0, \ - N_("embed FILE as public key for signature checking"), 0}, \ +@@ -67,6 +67,8 @@ + N_("SBAT metadata"), 0 }, \ + { "disable-shim-lock", GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, 0, 0, \ + N_("disable shim_lock verifier"), 0 }, \ + { "x509key", 'x', N_("FILE"), 0, \ + N_("embed FILE as an x509 certificate for signature checking"), 0}, \ { "appended-signature-size", GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE,\ "SIZE", 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), \ 1}, \ -@@ -182,8 +184,9 @@ void +@@ -188,8 +190,9 @@ void grub_install_generate_image (const char *dir, const char *prefix, FILE *out, const char *outname, char *mods[], diff --git a/0296-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0189-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0296-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0189-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0297-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0190-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 97% rename from 0297-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0190-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch index c638457f..04bf1df4 100644 --- a/0297-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +++ b/0190-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch @@ -19,9 +19,9 @@ Signed-off-by: Daniel Axtens --- grub-core/commands/appendedsig/asn1util.c | 102 +++ grub-core/commands/appendedsig/pkcs7.c | 305 +++++++++ - grub-core/commands/appendedsig/x509.c | 972 +++++++++++++++++++++++++++ + grub-core/commands/appendedsig/x509.c | 958 +++++++++++++++++++++++++++ grub-core/commands/appendedsig/appendedsig.h | 110 +++ - 4 files changed, 1489 insertions(+) + 4 files changed, 1475 insertions(+) create mode 100644 grub-core/commands/appendedsig/asn1util.c create mode 100644 grub-core/commands/appendedsig/pkcs7.c create mode 100644 grub-core/commands/appendedsig/x509.c @@ -448,10 +448,10 @@ index 00000000000..dc6afe203f7 +} diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c new file mode 100644 -index 00000000000..652e4f16870 +index 00000000000..2b38b3670a2 --- /dev/null +++ b/grub-core/commands/appendedsig/x509.c -@@ -0,0 +1,972 @@ +@@ -0,0 +1,958 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2020 IBM Corporation. @@ -758,39 +758,25 @@ index 00000000000..652e4f16870 + goto cleanup; + } + -+ if (grub_strncmp ("utf8String", choice, choice_size) == 0) -+ { -+ result = asn1_read_value (strasn, "utf8String", NULL, &tmp_size); -+ if (result != ASN1_MEM_ERROR) -+ { -+ err = -+ grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "Error reading size of UTF-8 string: %s", -+ asn1_strerror (result)); -+ goto cleanup_choice; -+ } -+ } -+ else if (grub_strncmp("printableString", choice, choice_size) == 0) -+ { -+ result = asn1_read_value (strasn, "printableString", NULL, &tmp_size); -+ if (result != ASN1_MEM_ERROR) -+ { -+ err = -+ grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "Error reading size of UTF-8 string: %s", -+ asn1_strerror (result)); -+ goto cleanup_choice; -+ } -+ } -+ else ++ if (grub_strncmp ("utf8String", choice, choice_size)) + { + err = + grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ "Only UTF-8 and printable DirectoryStrings are supported, got %s", ++ "Only UTF-8 DirectoryStrings are supported, got %s", + choice); + goto cleanup_choice; + } + ++ result = asn1_read_value (strasn, "utf8String", NULL, &tmp_size); ++ if (result != ASN1_MEM_ERROR) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading size of UTF-8 string: %s", ++ asn1_strerror (result)); ++ goto cleanup_choice; ++ } ++ + /* read size does not include trailing null */ + tmp_size++; + @@ -803,13 +789,13 @@ index 00000000000..652e4f16870 + goto cleanup_choice; + } + -+ result = asn1_read_value (strasn, choice, *string, &tmp_size); ++ result = asn1_read_value (strasn, "utf8String", *string, &tmp_size); + if (result != ASN1_SUCCESS) + { + err = + grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "Error reading out %s in DirectoryString: %s", -+ choice, asn1_strerror (result)); ++ "Error reading out UTF-8 string in DirectoryString: %s", ++ asn1_strerror (result)); + grub_free (*string); + goto cleanup_choice; + } diff --git a/0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch b/0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch deleted file mode 100644 index 2df15bf5..00000000 --- a/0190-blscfg-Add-support-for-sorting-the-plus-higher-than-.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 4 Nov 2019 17:33:30 +0100 -Subject: [PATCH] blscfg: Add support for sorting the plus ('+') higher than - base version - -Handle plus separator. Concept is the same as tilde, except that if one of -the strings ends (base version), the other is considered as higher version. - -A plus character is used for example by the Linux kernel build system to -denote that is the base version plus some changes on top of it. - -Currently for example rpmvercmp("5.3.0", "5.3.0+") will return 0 even when -the two versions are not the same. - -Resolves: rhbz#1767395 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/blscfg.c | 19 +++++++++++++++++-- - 1 file changed, 17 insertions(+), 2 deletions(-) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index d78cff79f97..83b33c1cd93 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -163,8 +163,8 @@ static int vercmp(const char * a, const char * b) - - /* loop through each version segment of str1 and str2 and compare them */ - while (*one || *two) { -- while (*one && !grub_isalnum(*one) && *one != '~') one++; -- while (*two && !grub_isalnum(*two) && *two != '~') two++; -+ while (*one && !grub_isalnum(*one) && *one != '~' && *one != '+') one++; -+ while (*two && !grub_isalnum(*two) && *two != '~' && *two != '+') two++; - - /* handle the tilde separator, it sorts before everything else */ - if (*one == '~' || *two == '~') { -@@ -175,6 +175,21 @@ static int vercmp(const char * a, const char * b) - continue; - } - -+ /* -+ * Handle plus separator. Concept is the same as tilde, -+ * except that if one of the strings ends (base version), -+ * the other is considered as higher version. -+ */ -+ if (*one == '+' || *two == '+') { -+ if (!*one) return -1; -+ if (!*two) return 1; -+ if (*one != '+') goto_return (1); -+ if (*two != '+') goto_return (-1); -+ one++; -+ two++; -+ continue; -+ } -+ - /* If we ran to the end of either, we are finished with the loop */ - if (!(*one && *two)) break; - diff --git a/0191-Fix-savedefault-with-blscfg.patch b/0191-Fix-savedefault-with-blscfg.patch deleted file mode 100644 index 51d5b822..00000000 --- a/0191-Fix-savedefault-with-blscfg.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Fritz Elfert -Date: Mon, 13 Jan 2020 19:29:58 +0100 -Subject: [PATCH] Fix savedefault with blscfg - -The GRUB_SAVEDEFAULT option was ignored on a BLS configuration. Fix it by -making the menu entries populated from the BLS files to call savedefault -if a save_default environment variable has been set to "true". - -This variable is set by grub2-mkconfig to the value in GRUB_SAVEDEFAULT. ---- - grub-core/commands/blscfg.c | 5 ++++- - util/grub.d/10_linux.in | 4 ++++ - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 83b33c1cd93..069db721bec 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -889,11 +889,14 @@ static void create_entry (struct bls_entry *entry) - - grub_dprintf ("blscfg2", "devicetree %s for id:\"%s\"\n", dt, id); - -- src = grub_xasprintf ("load_video\n" -+ const char *sdval = grub_env_get("save_default"); -+ bool savedefault = ((NULL != sdval) && (grub_strcmp(sdval, "true") == 0)); -+ src = grub_xasprintf ("%sload_video\n" - "set gfxpayload=keep\n" - "insmod gzio\n" - "linux %s%s%s%s\n" - "%s%s", -+ savedefault ? "savedefault\n" : "", - GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", - initrd ? initrd : "", dt ? dt : ""); - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 21a6915dca3..b70dca27567 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -152,6 +152,10 @@ EOF - if [ -n "${GRUB_DEFAULT_DTB}" ]; then - ${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}" - fi -+ -+ if [ -n "${GRUB_SAVEDEFAULT}" ]; then -+ ${grub_editenv} - set save_default="${GRUB_SAVEDEFAULT}" -+ fi - fi - - exit 0 diff --git a/0298-appended-signatures-support-verifying-appended-signa.patch b/0191-appended-signatures-support-verifying-appended-signa.patch similarity index 88% rename from 0298-appended-signatures-support-verifying-appended-signa.patch rename to 0191-appended-signatures-support-verifying-appended-signa.patch index f379d681..262efc0d 100644 --- a/0298-appended-signatures-support-verifying-appended-signa.patch +++ b/0191-appended-signatures-support-verifying-appended-signa.patch @@ -7,35 +7,31 @@ Building on the parsers and the ability to embed x509 certificates, as well as the existing gcrypt functionality, add a module for verifying appended signatures. -This includes: +This includes a verifier that requires that Linux kernels and grub modules +have appended signatures, and commands to manage the list of trusted +certificates for verification. - - a verifier that requires that kernels and grub modules have appended - signatures. It shares lots of logic with shim-lock verifier about what - files need to be verified and what modules are unsafe to have loaded. +Verification must be enabled by setting check_appended_signatures. If +GRUB is locked down when the module is loaded, verification will be +enabled and locked automatically. - - commands to manage the list of trusted certificates for verification. - -Similar to the PGP verifier, if a certificate is embedded in the core -image, verification will be enforced unless disabled on the the grub -command line or by load_env. - -Thus, as with the PGP verifier, it is not a complete secure-boot solution: -other mechanisms must be used to ensure that a user cannot drop to the -grub shell and disable verification. +As with the PGP verifier, it is not a complete secure-boot solution: +other mechanisms, such as a password or lockdown, must be used to ensure +that a user cannot drop to the grub shell and disable verification. Signed-off-by: Daniel Axtens --- grub-core/Makefile.core.def | 12 + - grub-core/commands/appendedsig/appendedsig.c | 644 +++++++++++++++++++++++++++ + grub-core/commands/appendedsig/appendedsig.c | 645 +++++++++++++++++++++++++++ include/grub/file.h | 2 + - 3 files changed, 658 insertions(+) + 3 files changed, 659 insertions(+) create mode 100644 grub-core/commands/appendedsig/appendedsig.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 78071360529..30bd9a4a587 100644 +index b4aaccf7b57..77321d218c8 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -977,6 +977,18 @@ module = { +@@ -980,6 +980,18 @@ module = { cppflags = '-I$(srcdir)/lib/posix_wrap'; }; @@ -52,17 +48,17 @@ index 78071360529..30bd9a4a587 100644 +}; + module = { - name = verifiers; - common = commands/verifiers.c; + name = hdparm; + common = commands/hdparm.c; diff --git a/grub-core/commands/appendedsig/appendedsig.c b/grub-core/commands/appendedsig/appendedsig.c new file mode 100644 -index 00000000000..1fbc942254a +index 00000000000..dc294cd339e --- /dev/null +++ b/grub-core/commands/appendedsig/appendedsig.c -@@ -0,0 +1,644 @@ +@@ -0,0 +1,645 @@ +/* + * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2020 IBM Corporation. ++ * Copyright (C) 2020-2021 IBM Corporation. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -94,6 +90,7 @@ index 00000000000..1fbc942254a +#include +#include +#include ++#include + +#include "appendedsig.h" + @@ -153,12 +150,34 @@ index 00000000000..1fbc942254a + +static int check_sigs = 0; + ++static const char * ++grub_env_read_sec (struct grub_env_var *var __attribute__ ((unused)), ++ const char *val __attribute__ ((unused))) ++{ ++ if (check_sigs == 2) ++ return "forced"; ++ else if (check_sigs == 1) ++ return "enforce"; ++ else ++ return "no"; ++} ++ +static char * +grub_env_write_sec (struct grub_env_var *var __attribute__((unused)), + const char *val) +{ -+ check_sigs = (*val == '1') || (*val == 'e'); -+ return grub_strdup (check_sigs ? "enforce" : "no"); ++ /* Do not allow the value to be changed if set to forced */ ++ if (check_sigs == 2) ++ return grub_strdup ("forced"); ++ ++ if ((*val == '2') || (*val == 'f')) ++ check_sigs = 2; ++ else if ((*val == '1') || (*val == 'e')) ++ check_sigs = 1; ++ else if ((*val == '0') || (*val == 'n')) ++ check_sigs = 0; ++ ++ return grub_strdup (grub_env_read_sec (NULL, NULL)); +} + +static grub_err_t @@ -513,12 +532,11 @@ index 00000000000..1fbc942254a +} + +static grub_err_t -+appendedsig_init (grub_file_t io, enum grub_file_type type, ++appendedsig_init (grub_file_t io __attribute__((unused)), ++ enum grub_file_type type, + void **context __attribute__((unused)), + enum grub_verify_flags *flags) +{ -+ const char *dangerous_mod; -+ + if (!check_sigs) + { + *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION; @@ -527,20 +545,6 @@ index 00000000000..1fbc942254a + + switch (type & GRUB_FILE_TYPE_MASK) + { -+ case GRUB_FILE_TYPE_GRUB_MODULE: -+ if (grub_is_dangerous_module (io)) -+ return grub_error (GRUB_ERR_ACCESS_DENIED, -+ N_("module cannot be loaded in appended signature mode: %s"), -+ io->name); -+ -+ *flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK; -+ return GRUB_ERR_NONE; -+ -+ case GRUB_FILE_TYPE_ACPI_TABLE: -+ case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE: -+ *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH; -+ return GRUB_ERR_NONE; -+ + case GRUB_FILE_TYPE_CERTIFICATE_TRUST: + /* + * This is a certificate to add to trusted keychain. @@ -553,25 +557,28 @@ index 00000000000..1fbc942254a + /* Fall through */ + + case GRUB_FILE_TYPE_LINUX_KERNEL: -+ case GRUB_FILE_TYPE_MULTIBOOT_KERNEL: -+ case GRUB_FILE_TYPE_BSD_KERNEL: -+ case GRUB_FILE_TYPE_XNU_KERNEL: -+ case GRUB_FILE_TYPE_PLAN9_KERNEL: -+ -+ dangerous_mod = grub_dangerous_module_loaded (); -+ if (dangerous_mod) -+ return grub_error (GRUB_ERR_ACCESS_DENIED, -+ N_("cannot proceed due to dangerous module in memory: %s"), -+ dangerous_mod); -+ ++ case GRUB_FILE_TYPE_GRUB_MODULE: ++ /* ++ * Appended signatures are only defined for ELF binaries. ++ * Out of an abundance of caution, we only verify Linux kernels and ++ * GRUB modules at this point. ++ */ + *flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK; + return GRUB_ERR_NONE; + -+ default: ++ case GRUB_FILE_TYPE_ACPI_TABLE: ++ case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE: + /* -+ * powerpc only supports the linux loader. If you support more, -+ * (especially chain loaded binaries) make sure they're checked! ++ * It is possible to use appended signature verification without ++ * lockdown - like the PGP verifier. When combined with an embedded ++ * config file in a signed grub binary, this could still be a meaningful ++ * secure-boot chain - so long as it isn't subverted by something like a ++ * rouge ACPI table or DT image. Defer them explicitly. + */ ++ *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH; ++ return GRUB_ERR_NONE; ++ ++ default: + *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION; + return GRUB_ERR_NONE; + } @@ -609,19 +616,15 @@ index 00000000000..1fbc942254a +{ + int rc; + struct grub_module_header *header; -+ const char *val; + -+ val = grub_env_get ("check_appended_signatures"); -+ grub_dprintf ("appendedsig", "check_appended_signatures='%s'\n", val); -+ -+ if (val && (val[0] == '1' || val[0] == 'e')) -+ check_sigs = 1; -+ else -+ check_sigs = 0; ++ /* If in lockdown, immediately enter forced mode */ ++ if (grub_is_lockdown () == GRUB_LOCKDOWN_ENABLED) ++ check_sigs = 2; + + grub_trusted_key = NULL; + -+ grub_register_variable_hook ("check_appended_signatures", 0, ++ grub_register_variable_hook ("check_appended_signatures", ++ grub_env_read_sec, + grub_env_write_sec); + grub_env_export ("check_appended_signatures"); + @@ -665,12 +668,6 @@ index 00000000000..1fbc942254a + grub_trusted_key = pk; + } + -+ if (!val || val[0] == '\0') -+ { -+ grub_env_set ("check_appended_signatures", -+ grub_trusted_key ? "enforce" : "no"); -+ } -+ + cmd_trust = + grub_register_command ("trust_certificate", grub_cmd_trust, + N_("X509_CERTIFICATE"), diff --git a/0299-appended-signatures-verification-tests.patch b/0192-appended-signatures-verification-tests.patch similarity index 86% rename from 0299-appended-signatures-verification-tests.patch rename to 0192-appended-signatures-verification-tests.patch index 3b2d9e9c..8364a906 100644 --- a/0299-appended-signatures-verification-tests.patch +++ b/0192-appended-signatures-verification-tests.patch @@ -9,18 +9,18 @@ of commands and behaviours. Signed-off-by: Daniel Axtens --- grub-core/Makefile.core.def | 6 + - grub-core/tests/appended_signature_test.c | 281 +++++++++++++++ + grub-core/tests/appended_signature_test.c | 250 ++++++++++++++++ grub-core/tests/lib/functional_test.c | 1 + - grub-core/tests/appended_signatures.h | 557 ++++++++++++++++++++++++++++++ - 4 files changed, 845 insertions(+) + grub-core/tests/appended_signatures.h | 483 ++++++++++++++++++++++++++++++ + 4 files changed, 740 insertions(+) create mode 100644 grub-core/tests/appended_signature_test.c create mode 100644 grub-core/tests/appended_signatures.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 30bd9a4a587..640de1b299b 100644 +index 77321d218c8..6bddc841b85 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2138,6 +2138,12 @@ module = { +@@ -2161,6 +2161,12 @@ module = { common = tests/setjmp_test.c; }; @@ -35,10 +35,10 @@ index 30bd9a4a587..640de1b299b 100644 common = tests/signature_test.c; diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c new file mode 100644 -index 00000000000..88a485200d8 +index 00000000000..bb29a85c9bb --- /dev/null +++ b/grub-core/tests/appended_signature_test.c -@@ -0,0 +1,281 @@ +@@ -0,0 +1,250 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2020 IBM Corporation. @@ -136,23 +136,6 @@ index 00000000000..88a485200d8 + .get_contents = get_certificate2_der +}; + -+static char * -+get_certificate_printable_der (grub_size_t * sz) -+{ -+ char *ret; -+ *sz = certificate_printable_der_len; -+ ret = grub_malloc (*sz); -+ if (ret) -+ grub_memcpy (ret, certificate_printable_der, *sz); -+ return ret; -+} -+ -+static struct grub_procfs_entry certificate_printable_der_entry = { -+ .name = "certificate_printable.der", -+ .get_contents = get_certificate_printable_der -+}; -+ -+ +static void +do_verify (const char *f, int is_valid) +{ @@ -188,16 +171,12 @@ index 00000000000..88a485200d8 + grub_command_t cmd_trust, cmd_distrust; + char *trust_args[] = { (char *) "(proc)/certificate.der", NULL }; + char *trust_args2[] = { (char *) "(proc)/certificate2.der", NULL }; -+ char *trust_args_printable[] = { (char *) "(proc)/certificate_printable.der", -+ NULL }; + char *distrust_args[] = { (char *) "1", NULL }; + char *distrust2_args[] = { (char *) "2", NULL }; + grub_err_t err; + + grub_procfs_register ("certificate.der", &certificate_der_entry); + grub_procfs_register ("certificate2.der", &certificate2_der_entry); -+ grub_procfs_register ("certificate_printable.der", -+ &certificate_printable_der_entry); + + cmd_trust = grub_command_find ("trust_certificate"); + if (!cmd_trust) @@ -305,18 +284,8 @@ index 00000000000..88a485200d8 + grub_errno, grub_errmsg); + DO_TEST (hi_signed_2nd, 0); + -+ /* -+ * Lastly, check a certificate that uses printableString rather than -+ * utf8String loads properly. -+ */ -+ err = (cmd_trust->func) (cmd_trust, 1, trust_args_printable); -+ grub_test_assert (err == GRUB_ERR_NONE, -+ "distrusting printable certificate failed: %d: %s", -+ grub_errno, grub_errmsg); -+ + grub_procfs_unregister (&certificate_der_entry); + grub_procfs_unregister (&certificate2_der_entry); -+ grub_procfs_unregister (&certificate_printable_der_entry); +} + +GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); @@ -334,10 +303,10 @@ index 96781fb39b5..403fa5c789a 100644 grub_dl_load ("ctz_test"); diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h new file mode 100644 -index 00000000000..aa3dc6278e3 +index 00000000000..d5b56f74ad9 --- /dev/null +++ b/grub-core/tests/appended_signatures.h -@@ -0,0 +1,557 @@ +@@ -0,0 +1,483 @@ +unsigned char certificate_der[] = { + 0x30, 0x82, 0x03, 0x88, 0x30, 0x82, 0x02, 0x70, 0xa0, 0x03, 0x02, 0x01, + 0x02, 0x02, 0x14, 0x25, 0x2e, 0xb8, 0xfd, 0x12, 0x62, 0x2e, 0xcd, 0x5d, @@ -821,77 +790,3 @@ index 00000000000..aa3dc6278e3 + 0x65, 0x64, 0x7e, 0x0a +}; +unsigned int hi_signed_2nd_len = 736; -+ -+unsigned char certificate_printable_der[] = { -+ 0x30, 0x82, 0x03, 0x39, 0x30, 0x82, 0x02, 0x21, 0xa0, 0x03, 0x02, 0x01, -+ 0x02, 0x02, 0x09, 0x00, 0xde, 0xf6, 0x22, 0xc4, 0xf2, 0xf1, 0x86, 0x02, -+ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, -+ 0x0b, 0x05, 0x00, 0x30, 0x2a, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, -+ 0x04, 0x03, 0x13, 0x1f, 0x52, 0x65, 0x64, 0x20, 0x48, 0x61, 0x74, 0x20, -+ 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x42, 0x6f, 0x6f, 0x74, 0x20, -+ 0x43, 0x41, 0x20, 0x32, 0x20, 0x28, 0x62, 0x65, 0x74, 0x61, 0x29, 0x30, -+ 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x31, 0x30, 0x33, 0x31, 0x31, 0x34, 0x31, -+ 0x39, 0x32, 0x33, 0x5a, 0x17, 0x0d, 0x33, 0x37, 0x31, 0x30, 0x32, 0x35, -+ 0x31, 0x34, 0x31, 0x39, 0x32, 0x33, 0x5a, 0x30, 0x2f, 0x31, 0x2d, 0x30, -+ 0x2b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x24, 0x52, 0x65, 0x64, 0x20, -+ 0x48, 0x61, 0x74, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x42, -+ 0x6f, 0x6f, 0x74, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, -+ 0x33, 0x20, 0x28, 0x62, 0x65, 0x74, 0x61, 0x29, 0x30, 0x82, 0x01, 0x22, -+ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, -+ 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, -+ 0x02, 0x82, 0x01, 0x01, 0x00, 0xbd, 0xda, 0xa1, 0xed, 0x8d, 0x8e, 0x15, -+ 0x5c, 0xf8, 0x01, 0x77, 0x48, 0x4a, 0x60, 0x96, 0xf9, 0x27, 0xfa, 0xe2, -+ 0xb1, 0x69, 0x0f, 0x51, 0x19, 0x52, 0x7e, 0xc4, 0x34, 0x8e, 0xe1, 0x9b, -+ 0x9c, 0xa4, 0xb1, 0x5c, 0xd6, 0x81, 0x98, 0x78, 0xfe, 0xa9, 0xe5, 0x0b, -+ 0x00, 0xba, 0x9c, 0x64, 0x7e, 0xc7, 0xcc, 0x72, 0xb1, 0x73, 0x4b, 0x11, -+ 0x07, 0x52, 0xf0, 0x20, 0x96, 0x8b, 0x99, 0x39, 0xde, 0xdb, 0xfa, 0x3d, -+ 0x45, 0xe2, 0x98, 0x7b, 0x0c, 0x41, 0xe4, 0x0c, 0xb5, 0x5d, 0x92, 0x74, -+ 0x39, 0x96, 0xe1, 0x97, 0x97, 0xa1, 0xad, 0x2e, 0xcc, 0xd0, 0x1b, 0x4d, -+ 0x9d, 0xbd, 0x3e, 0xa9, 0x36, 0x8e, 0xcc, 0xc7, 0x5f, 0x6a, 0x7d, 0x39, -+ 0x5e, 0x0b, 0x8d, 0xca, 0xe4, 0x83, 0xe9, 0x3b, 0x5c, 0x86, 0x47, 0xd4, -+ 0xba, 0x7d, 0x98, 0x26, 0xa1, 0xf4, 0xe8, 0x90, 0x6b, 0x0f, 0xf1, 0x6b, -+ 0x8c, 0xe3, 0xa2, 0x80, 0x3c, 0x96, 0xf1, 0x0a, 0xb6, 0x66, 0xc0, 0x4b, -+ 0x61, 0xf7, 0x74, 0xcd, 0xd3, 0x7b, 0x8e, 0x5e, 0x39, 0xda, 0x99, 0x20, -+ 0x33, 0x93, 0xd3, 0xf0, 0x7f, 0xad, 0x35, 0xe9, 0x88, 0x8d, 0x9c, 0xbf, -+ 0x65, 0xf1, 0x47, 0x02, 0xf9, 0x7c, 0xed, 0x27, 0x5f, 0x4a, 0x65, 0x3c, -+ 0xcf, 0x5f, 0x0e, 0x88, 0x95, 0x74, 0xde, 0xfb, 0x9e, 0x2e, 0x91, 0x9b, -+ 0x45, 0x37, 0xc8, 0x85, 0xff, 0xe3, 0x41, 0x70, 0xfe, 0xd5, 0xef, 0x0e, -+ 0x82, 0x22, 0x08, 0xb7, 0x3b, 0x44, 0x3e, 0xdc, 0x5b, 0x7f, 0xba, 0xbf, -+ 0xe6, 0x58, 0x9d, 0x02, 0x6e, 0x75, 0xbf, 0x50, 0xec, 0xcf, 0x3f, 0xa5, -+ 0x91, 0x0a, 0xe2, 0x59, 0x2c, 0xc3, 0xe7, 0x05, 0x03, 0xe8, 0xf2, 0x6f, -+ 0x2a, 0x04, 0x68, 0x9a, 0x31, 0x32, 0x8f, 0x04, 0x35, 0xcd, 0x1f, 0x34, -+ 0xcc, 0x4f, 0x79, 0x5a, 0x99, 0x8d, 0x9d, 0x5c, 0xf5, 0x02, 0x03, 0x01, -+ 0x00, 0x01, 0xa3, 0x5d, 0x30, 0x5b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, -+ 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0b, 0x06, 0x03, -+ 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x1d, 0x06, -+ 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x65, 0xc5, 0xbe, 0xca, -+ 0xe6, 0x59, 0x6a, 0xfd, 0x6c, 0x71, 0xc4, 0xa7, 0x98, 0xc6, 0x25, 0x8d, -+ 0x7b, 0x67, 0x05, 0xd0, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, -+ 0x18, 0x30, 0x16, 0x80, 0x14, 0x81, 0xf8, 0xee, 0x47, 0x5c, 0x3e, 0xed, -+ 0xfb, 0xce, 0xa5, 0x84, 0xbe, 0xd7, 0xae, 0xdb, 0xd3, 0x7d, 0x64, 0xb3, -+ 0x2a, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, -+ 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x66, 0x1e, 0x3d, -+ 0x1d, 0x53, 0x33, 0xde, 0x4e, 0xc7, 0xc4, 0xf4, 0xdf, 0xda, 0x18, 0x19, -+ 0x8a, 0xa9, 0xff, 0xe2, 0x63, 0x2b, 0xbe, 0xf2, 0x61, 0x63, 0xe2, 0xf6, -+ 0xed, 0x47, 0x1a, 0x71, 0x02, 0xec, 0x2a, 0xef, 0x89, 0x77, 0xe3, 0xfd, -+ 0x86, 0x69, 0xf1, 0x3f, 0x0d, 0xf9, 0x6e, 0xf9, 0x3b, 0xad, 0x26, 0x47, -+ 0xb7, 0xf2, 0x0d, 0xad, 0x23, 0xa3, 0x67, 0x3b, 0xcb, 0x6d, 0x9e, 0x03, -+ 0x0f, 0xbc, 0x69, 0x73, 0x9f, 0xd4, 0xa5, 0x0f, 0x6f, 0xf8, 0xab, 0x4d, -+ 0x36, 0xd1, 0xe0, 0xe0, 0x5d, 0x20, 0x43, 0x90, 0xc4, 0x65, 0x61, 0x93, -+ 0xe2, 0x0f, 0x51, 0x59, 0x0a, 0xf7, 0x88, 0x70, 0x57, 0xb9, 0x04, 0xa9, -+ 0x32, 0x57, 0x9c, 0xb3, 0x57, 0x38, 0x8b, 0x8e, 0x46, 0xc8, 0x32, 0x6c, -+ 0xb4, 0xf3, 0x96, 0x7f, 0x4b, 0xf0, 0x88, 0xf9, 0x7f, 0xe2, 0x71, 0xe1, -+ 0x8b, 0xe2, 0x14, 0xf1, 0x4b, 0x25, 0x00, 0x48, 0x1c, 0x7e, 0xe5, 0x8d, -+ 0x65, 0x2d, 0xeb, 0x72, 0x4f, 0x92, 0x44, 0xf3, 0xe6, 0xe0, 0xd0, 0xdf, -+ 0x85, 0xa8, 0x13, 0x4a, 0xfb, 0x99, 0xca, 0x14, 0x2c, 0x97, 0x80, 0x93, -+ 0x27, 0xd3, 0x20, 0xf8, 0x6d, 0x29, 0x28, 0x2c, 0xb9, 0x77, 0xea, 0xb1, -+ 0x63, 0xbd, 0x7d, 0x53, 0xfd, 0x4a, 0x62, 0x64, 0x0b, 0x98, 0xa8, 0xae, -+ 0x11, 0xfc, 0x6e, 0x8d, 0x63, 0xd4, 0x15, 0x55, 0xc6, 0x4c, 0x74, 0xf5, -+ 0x5f, 0xa0, 0xb9, 0x2c, 0x2d, 0x9a, 0x7a, 0x87, 0x6e, 0xf0, 0x5e, 0x25, -+ 0xed, 0xfc, 0xd8, 0xc4, 0x34, 0x33, 0x32, 0xad, 0x01, 0xd4, 0x4b, 0x49, -+ 0x51, 0xc2, 0x07, 0x7f, 0x90, 0x6d, 0xea, 0xf5, 0x4c, 0x41, 0x71, 0x64, -+ 0xeb, 0x1f, 0x29, 0xa3, 0x1f, 0x64, 0xa2, 0x1e, 0x0e, 0x6f, 0xa1, 0x67, -+ 0x99, 0x8d, 0x98, 0x1c, 0xb8, 0x53, 0x9d, 0x30, 0x1d, 0xae, 0x32, 0x56, -+ 0xd2 -+}; -+unsigned int certificate_printable_der_len = 829; diff --git a/0300-appended-signatures-documentation.patch b/0193-appended-signatures-documentation.patch similarity index 76% rename from 0300-appended-signatures-documentation.patch rename to 0193-appended-signatures-documentation.patch index 7c1170a6..c9076338 100644 --- a/0300-appended-signatures-documentation.patch +++ b/0193-appended-signatures-documentation.patch @@ -1,23 +1,22 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 8 Feb 2021 19:30:54 +0100 +From: Daniel Axtens +Date: Thu, 1 Oct 2020 13:02:09 +1000 Subject: [PATCH] appended signatures: documentation This explains how appended signatures can be used to form part of a secure boot chain, and documents the commands and variables introduced. -(docs: s/grub/grub2/) Signed-off-by: Daniel Axtens --- - docs/grub.texi | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 174 insertions(+), 15 deletions(-) + docs/grub.texi | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 182 insertions(+), 17 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 7fc2a62a4f8..7fe365414e4 100644 +index 691ffaa1861..7b5d7800418 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -3160,6 +3160,7 @@ These variables have special meaning to GRUB. +@@ -3216,6 +3216,7 @@ These variables have special meaning to GRUB. @menu * biosnum:: @@ -25,7 +24,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 * check_signatures:: * chosen:: * cmdpath:: -@@ -3219,11 +3220,18 @@ For an alternative approach which also changes BIOS drive mappings for the +@@ -3275,11 +3276,18 @@ For an alternative approach which also changes BIOS drive mappings for the chain-loaded system, @pxref{drivemap}. @@ -46,7 +45,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 @node chosen @subsection chosen -@@ -3937,6 +3945,7 @@ you forget a command, you can run the command @command{help} +@@ -3994,6 +4002,7 @@ you forget a command, you can run the command @command{help} * date:: Display or set current date and time * devicetree:: Load a device tree blob * distrust:: Remove a pubkey from trusted keys @@ -54,7 +53,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 * drivemap:: Map a drive to another * echo:: Display a line of text * eval:: Evaluate agruments as GRUB commands -@@ -3953,6 +3962,7 @@ you forget a command, you can run the command @command{help} +@@ -4010,6 +4019,7 @@ you forget a command, you can run the command @command{help} * keystatus:: Check key modifier status * linux:: Load a Linux kernel * linux16:: Load a Linux kernel (16-bit mode) @@ -62,19 +61,18 @@ index 7fc2a62a4f8..7fe365414e4 100644 * list_env:: List variables in environment block * list_trusted:: List trusted public keys * load_env:: Load variables from environment block -@@ -3990,9 +4000,11 @@ you forget a command, you can run the command @command{help} +@@ -4047,8 +4057,10 @@ you forget a command, you can run the command @command{help} * test:: Check file types and compare values * true:: Do nothing, successfully * trust:: Add public key to list of trusted keys +* trust_certificate:: Add an x509 certificate to the list of trusted certificates * unset:: Unset an environment variable - * uppermem:: Set the upper memory size @comment * vbeinfo:: List available video modes +* verify_appended:: Verify appended digital signature * verify_detached:: Verify detached digital signature * videoinfo:: List available video modes @comment * xen_*:: Xen boot commands for AArch64 -@@ -4284,9 +4296,28 @@ These keys are used to validate signatures when environment variable +@@ -4373,9 +4385,28 @@ These keys are used to validate signatures when environment variable @code{check_signatures} is set to @code{enforce} (@pxref{check_signatures}), and by some invocations of @command{verify_detached} (@pxref{verify_detached}). @xref{Using @@ -94,17 +92,17 @@ index 7fc2a62a4f8..7fe365414e4 100644 +@command{list_certificates} (@pxref{list_certificates}). + +These certificates are used to validate appended signatures when environment -+variable @code{check_appended_signatures} is set to @code{enforce} -+(@pxref{check_appended_signatures}), and by @command{verify_appended} -+(@pxref{verify_appended}). See @xref{Using appended signatures} for more -+information. ++variable @code{check_appended_signatures} is set to @code{enforce} or ++@code{forced} (@pxref{check_appended_signatures}), and by ++@command{verify_appended} (@pxref{verify_appended}). See ++@xref{Using appended signatures} for more information. +@end deffn + + @node drivemap @subsection drivemap -@@ -4544,6 +4575,21 @@ This command is only available on x86 systems. +@@ -4633,6 +4664,21 @@ This command is only available on x86 systems. @end deffn @@ -126,7 +124,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 @node list_env @subsection list_env -@@ -4563,7 +4609,7 @@ The output is in GPG's v4 key fingerprint format (i.e., the output of +@@ -4652,7 +4698,7 @@ The output is in GPG's v4 key fingerprint format (i.e., the output of @code{gpg --fingerprint}). The least significant four bytes (last eight hexadecimal digits) can be used as an argument to @command{distrust} (@pxref{distrust}). @@ -135,7 +133,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 these keys. @end deffn -@@ -4598,8 +4644,12 @@ When used with care, @option{--skip-sig} and the whitelist enable an +@@ -4687,8 +4733,13 @@ When used with care, @option{--skip-sig} and the whitelist enable an administrator to configure a system to boot only signed configurations, but to allow the user to select from among multiple configurations, and to enable ``one-shot'' boot attempts and @@ -145,11 +143,12 @@ index 7fc2a62a4f8..7fe365414e4 100644 + +Extra care should be taken when combining this command with appended signatures +(@pxref{Using appended signatures}), as this file is not validated by an -+appended signature and could set @code{check_appended_signatures=no}. ++appended signature and could set @code{check_appended_signatures=no} if GRUB is ++not in @pxref{Lockdown} mode. @end deffn -@@ -4903,7 +4953,7 @@ read. It is possible to modify a digitally signed environment block +@@ -4984,7 +5035,7 @@ read. It is possible to modify a digitally signed environment block file from within GRUB using this command, such that its signature will no longer be valid on subsequent boots. Care should be taken in such advanced configurations to avoid rendering the system @@ -158,7 +157,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 @end deffn -@@ -5228,11 +5278,31 @@ signatures when environment variable @code{check_signatures} is set to +@@ -5384,11 +5435,32 @@ signatures when environment variable @code{check_signatures} is set to must itself be properly signed. The @option{--skip-sig} option can be used to disable signature-checking when reading @var{pubkey_file} itself. It is expected that @option{--skip-sig} is useful for testing @@ -175,14 +174,15 @@ index 7fc2a62a4f8..7fe365414e4 100644 +Read an DER-formatted x509 certificate from the file @var{x509_certificate} +and add it to GRUB's internal list of trusted x509 certificates. These +certificates are used to validate appended signatures when the environment -+variable @code{check_appended_signatures} is set to @code{enforce}. ++variable @code{check_appended_signatures} is set to @code{enforce} or ++@code{forced}. + -+Note that if @code{check_appended_signatures} is set to @code{enforce} -+when @command{trust_certificate} is executed, then @var{x509_certificate} -+must itself bear an appended signature. (It is not sufficient that -+@var{x509_certificate} be signed by a trusted certificate according to the -+x509 rules: grub does not include support for validating signatures within x509 -+certificates themselves.) ++Note that if @code{check_appended_signatures} is set to @code{enforce} or ++@code{forced} when @command{trust_certificate} is executed, then ++@var{x509_certificate} must itself bear an appended signature. (It is not ++sufficient that @var{x509_certificate} be signed by a trusted certificate ++according to the x509 rules: grub does not include support for validating ++signatures within x509 certificates themselves.) + +See @xref{Using appended signatures} for more information. +@end deffn @@ -191,7 +191,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 @node unset @subsection unset -@@ -5257,6 +5327,18 @@ only on PC BIOS platforms. +@@ -5407,6 +5479,18 @@ only on PC BIOS platforms. @end deffn @end ignore @@ -210,7 +210,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 @node verify_detached @subsection verify_detached -@@ -5275,7 +5357,7 @@ tried. +@@ -5425,7 +5509,7 @@ tried. Exit code @code{$?} is set to 0 if the signature validates successfully. If validation fails, it is set to a non-zero value. @@ -219,25 +219,29 @@ index 7fc2a62a4f8..7fe365414e4 100644 @end deffn @node videoinfo -@@ -5636,11 +5718,12 @@ environment variables and commands are listed in the same order. +@@ -5808,13 +5892,14 @@ environment variables and commands are listed in the same order. @chapter Security @menu -* Authentication and authorisation:: Users and access control -* Using digital signatures:: Booting digitally signed code --* Signing GRUB itself:: Ensuring the integrity of the GRUB core image -* UEFI secure boot and shim:: Booting digitally signed PE files +-* Secure Boot Advanced Targeting:: Embedded information for generation number based revocation -* Measured Boot:: Measuring boot components +-* Lockdown:: Lockdown when booting on a secure setup +-* Signing GRUB itself:: Ensuring the integrity of the GRUB core image +* Authentication and authorisation:: Users and access control +* Using GPG-style digital signatures:: Booting digitally signed code +* Using appended signatures:: An alternative approach to booting digitally signed code -+* Signing GRUB itself:: Ensuring the integrity of the GRUB core image +* UEFI secure boot and shim:: Booting digitally signed PE files ++* Secure Boot Advanced Targeting:: Embedded information for generation number based revocation +* Measured Boot:: Measuring boot components ++* Lockdown:: Lockdown when booting on a secure setup ++* Signing GRUB itself:: Ensuring the integrity of the GRUB core image @end menu @node Authentication and authorisation -@@ -5713,8 +5796,8 @@ generating configuration files with authentication. You can use +@@ -5888,8 +5973,8 @@ generating configuration files with authentication. You can use adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} commands. @@ -248,7 +252,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 GRUB's @file{core.img} can optionally provide enforcement that all files subsequently read from disk are covered by a valid digital signature. -@@ -5797,6 +5880,82 @@ or BIOS) configuration to cause the machine to boot from a different +@@ -5982,6 +6067,86 @@ or BIOS) configuration to cause the machine to boot from a different (attacker-controlled) device. GRUB is at best only one link in a secure boot chain. @@ -264,11 +268,7 @@ index 7fc2a62a4f8..7fe365414e4 100644 +~Module signature appended~\n +@end example + -+where @code{\n} represents the carriage-return character, @code{0x0a}. -+ -+To enable appended signature verification, load the appendedsig module and an -+x509 certificate for verification. Building the appendedsig module into the -+core grub image is recommended. ++where @code{\n} represents the line-feed character, @code{0x0a}. + +Certificates can be managed at boot time using the @pxref{trust_certificate}, +@pxref{distrust_certificate} and @pxref{list_certificates} commands. @@ -289,32 +289,32 @@ index 7fc2a62a4f8..7fe365414e4 100644 +@end example + +Enforcement of signature verification is controlled by the -+@code{check_appended_signatures} variable. Verification will only take place -+when files are loaded if the variable is set to @code{enforce}. If a -+certificate is built into the grub core image with the @code{--x509} parameter, -+the variable will be automatically set to @code{enforce} when the appendedsig -+module is loaded. ++@code{check_appended_signatures} variable. ++ ++@itemize ++@item @samp{no}: no verification is performed. This is the default when GRUB ++ is not in @pxref{Lockdown} mode. ++@item @samp{enforce}: verification is performed. Verification can be disabled ++ by setting the variable back to @samp{no}. ++@item @samp{forced}: verification is performed and cannot be disabled. This is ++ set when GRUB is in Lockdown when the appendedsig module is loaded. ++@end itemize + +Unlike GPG-style signatures, not all files loaded by GRUB are required to be -+signed. Once verification is turned on, the following file types must carry -+appended signatures: ++signed. Once verification is turned on, the following file types will have ++appended signatures verified: + -+@enumerate -+@item Linux, Multiboot, BSD, XNU and Plan9 kernels -+@item Grub modules, except those built in to the core image ++@itemize ++@item Linux kernels ++@item GRUB modules, except those built into the core image +@item Any new certificate files to be trusted -+@end enumerate ++@end itemize + +ACPI tables and Device Tree images will not be checked for appended signatures +but must be verified by another mechanism such as GPG-style signatures before +they will be loaded. + -+No attempt is made to validate any other file type. In particular, -+chain-loaded binaries are not verified - if your platform supports -+chain-loading and this cannot be disabled, consider an alternative secure -+boot mechanism. -+ -+As with GPG-style appended signatures, signature checking does @strong{not} ++Unless lockdown mode is enabled, signature checking does @strong{not} +stop an attacker with console access from dropping manually to the GRUB +console and executing: + @@ -325,9 +325,17 @@ index 7fc2a62a4f8..7fe365414e4 100644 +Refer to the section on password-protecting GRUB (@pxref{Authentication +and authorisation}) for more information on preventing this. + -+Additionally, special care must be taken around the @command{loadenv} command, -+which can be used to turn off @code{check_appended_signature}. ++Additionally, unless lockdown mode is enabled: + - @node Signing GRUB itself - @section Signing GRUB itself ++@itemize ++@item Special care must be taken around the @command{loadenv} command, which ++ can be used to turn off @code{check_appended_signature}. ++ ++@item If the grub configuration file is loaded from the disk, anyone who can ++ modify the file on disk can turn off @code{check_appended_signature}. ++ Consider embedding the configuration into the core grub image. ++@end itemize ++ + @node UEFI secure boot and shim + @section UEFI secure boot and shim support diff --git a/0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch new file mode 100644 index 00000000..cce1d079 --- /dev/null +++ b/0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch @@ -0,0 +1,109 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 28 Sep 2020 11:11:17 +1000 +Subject: [PATCH] ieee1275: enter lockdown based on /ibm,secure-boot + +If the 'ibm,secure-boot' property of the root node is 2 or greater, +enter lockdown. + +Signed-off-by: Daniel Axtens +--- + grub-core/Makefile.core.def | 1 + + grub-core/kern/ieee1275/init.c | 27 +++++++++++++++++++++++++++ + include/grub/lockdown.h | 3 ++- + docs/grub.texi | 4 ++-- + 4 files changed, 32 insertions(+), 3 deletions(-) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 6bddc841b85..3f3459b2c70 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -323,6 +323,7 @@ kernel = { + powerpc_ieee1275 = kern/powerpc/cache.S; + powerpc_ieee1275 = kern/powerpc/dl.c; + powerpc_ieee1275 = kern/powerpc/compiler-rt.S; ++ powerpc_ieee1275 = kern/lockdown.c; + + sparc64_ieee1275 = kern/sparc64/cache.S; + sparc64_ieee1275 = kern/sparc64/dl.c; +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 937c1bc44cb..fc7d9712729 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -44,6 +44,7 @@ + #ifdef __sparc__ + #include + #endif ++#include + + /* The minimal heap size we can live with. */ + #define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024) +@@ -271,6 +272,30 @@ grub_parse_cmdline (void) + } + } + ++static void ++grub_get_ieee1275_secure_boot (void) ++{ ++ grub_ieee1275_phandle_t root; ++ int rc; ++ grub_uint32_t is_sb; ++ ++ grub_ieee1275_finddevice ("/", &root); ++ ++ rc = grub_ieee1275_get_integer_property (root, "ibm,secure-boot", &is_sb, ++ sizeof (is_sb), 0); ++ ++ /* ibm,secure-boot: ++ * 0 - disabled ++ * 1 - audit ++ * 2 - enforce ++ * 3 - enforce + OS-specific behaviour ++ * ++ * We only support enforce. ++ */ ++ if (rc >= 0 && is_sb >= 2) ++ grub_lockdown (); ++} ++ + grub_addr_t grub_modbase; + + void +@@ -296,6 +321,8 @@ grub_machine_init (void) + #else + grub_install_get_time_ms (grub_rtc_get_time_ms); + #endif ++ ++ grub_get_ieee1275_secure_boot (); + } + + void +diff --git a/include/grub/lockdown.h b/include/grub/lockdown.h +index 40531fa823b..ebfee4bf06e 100644 +--- a/include/grub/lockdown.h ++++ b/include/grub/lockdown.h +@@ -24,7 +24,8 @@ + #define GRUB_LOCKDOWN_DISABLED 0 + #define GRUB_LOCKDOWN_ENABLED 1 + +-#ifdef GRUB_MACHINE_EFI ++#if defined(GRUB_MACHINE_EFI) || \ ++ (defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)) + extern void + EXPORT_FUNC (grub_lockdown) (void); + extern int +diff --git a/docs/grub.texi b/docs/grub.texi +index 7b5d7800418..cb5804fd6fe 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -6224,8 +6224,8 @@ Measured boot is currently only supported on EFI platforms. + @section Lockdown when booting on a secure setup + + The GRUB can be locked down when booted on a secure boot environment, for example +-if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will +-be restricted and some operations/commands cannot be executed. ++if UEFI or Power secure boot is enabled. On a locked down configuration, the ++GRUB will be restricted and some operations/commands cannot be executed. + + The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down. + Otherwise it does not exit. diff --git a/0195-RISC-V-Add-__clzdi2-symbol.patch b/0195-RISC-V-Add-__clzdi2-symbol.patch deleted file mode 100644 index 492aaef3..00000000 --- a/0195-RISC-V-Add-__clzdi2-symbol.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Andreas Schwab -Date: Thu, 19 Sep 2019 09:39:04 +0200 -Subject: [PATCH] RISC-V: Add __clzdi2 symbol - -This is needed for the zstd module build for riscv64-emu. - -Signed-off-by: Andreas Schwab -Reviewed-by: Daniel Kiper ---- - configure.ac | 2 +- - include/grub/compiler-rt-emu.h | 5 +++++ - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 5076d635c57..eff160b6931 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1444,7 +1444,7 @@ fi - - # Check for libgcc symbols - if test x"$platform" = xemu; then --AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms) -+AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __clzdi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms) - fi - - if test "x$TARGET_APPLE_LINKER" = x1 ; then -diff --git a/include/grub/compiler-rt-emu.h b/include/grub/compiler-rt-emu.h -index b21425d9eb8..fde620ac186 100644 ---- a/include/grub/compiler-rt-emu.h -+++ b/include/grub/compiler-rt-emu.h -@@ -74,6 +74,11 @@ unsigned - EXPORT_FUNC (__ctzsi2) (grub_uint32_t x); - #endif - -+#ifdef HAVE___CLZDI2 -+int -+EXPORT_FUNC (__clzdi2) (grub_uint64_t x); -+#endif -+ - #ifdef HAVE___AEABI_UIDIV - grub_uint32_t - EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b); diff --git a/0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch b/0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch new file mode 100644 index 00000000..6c2b8a4c --- /dev/null +++ b/0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Fri, 12 Mar 2021 23:25:01 +0100 +Subject: [PATCH] Revert "templates: Properly disable the os-prober by default" + +This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925. +--- + util/grub-mkconfig.in | 5 +---- + util/grub.d/30_os-prober.in | 8 ++++---- + 2 files changed, 5 insertions(+), 8 deletions(-) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index 1a70b7ea056..f55339a3f64 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -147,9 +147,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2 + GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`" + GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true + +-# Disable os-prober by default due to security reasons. +-GRUB_DISABLE_OS_PROBER="true" +- + # Filesystem for the device containing our userland. Used for stuff like + # choosing Hurd filesystem module. + GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`" +@@ -213,7 +210,6 @@ export GRUB_DEVICE \ + GRUB_DEVICE_PARTUUID \ + GRUB_DEVICE_BOOT \ + GRUB_DEVICE_BOOT_UUID \ +- GRUB_DISABLE_OS_PROBER \ + GRUB_FS \ + GRUB_FONT \ + GRUB_PRELOAD_MODULES \ +@@ -255,6 +251,7 @@ export GRUB_DEFAULT \ + GRUB_BACKGROUND \ + GRUB_THEME \ + GRUB_GFXPAYLOAD_LINUX \ ++ GRUB_DISABLE_OS_PROBER \ + GRUB_INIT_TUNE \ + GRUB_SAVEDEFAULT \ + GRUB_ENABLE_CRYPTODISK \ +diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in +index 21bbace4647..7591edc58ed 100644 +--- a/util/grub.d/30_os-prober.in ++++ b/util/grub.d/30_os-prober.in +@@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@" + + . "$pkgdatadir/grub-mkconfig_lib" + +-if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then +- grub_warn "$(gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.")" ++if [ "x${GRUB_DISABLE_OS_PROBER}" = "xfalse" ]; then ++ gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.\n" + exit 0 + fi + +@@ -36,12 +36,12 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n + exit 0 + fi + +-grub_warn "$(gettext_printf "os-prober will be executed to detect other bootable partitions.\nIt's output will be used to detect bootable binaries on them and create new boot entries.")" +- + OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`" + if [ -z "${OSPROBED}" ] ; then + # empty os-prober output, nothing doing + exit 0 ++else ++ grub_warn "$(gettext_printf "os-prober was executed to detect other bootable partitions.\nIt's output will be used to detect bootable binaries on them and create new boot entries.")" + fi + + osx_entry() { diff --git a/0196-Revert-templates-Disable-the-os-prober-by-default.patch b/0196-Revert-templates-Disable-the-os-prober-by-default.patch new file mode 100644 index 00000000..b97c4c73 --- /dev/null +++ b/0196-Revert-templates-Disable-the-os-prober-by-default.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Fri, 12 Mar 2021 23:26:15 +0100 +Subject: [PATCH] Revert "templates: Disable the os-prober by default" + +This reverts commit e346414725a70e5c74ee87ca14e580c66f517666. +--- + docs/grub.texi | 18 ++++++++---------- + util/grub.d/30_os-prober.in | 5 +---- + 2 files changed, 9 insertions(+), 14 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index cb5804fd6fe..d183575bc18 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -1526,13 +1526,10 @@ boot sequence. If you have problems, set this option to @samp{text} and + GRUB will tell Linux to boot in normal text mode. + + @item GRUB_DISABLE_OS_PROBER +-The @command{grub2-mkconfig} has a feature to use the external +-@command{os-prober} program to discover other operating systems installed on +-the same machine and generate appropriate menu entries for them. It is disabled +-by default since automatic and silent execution of @command{os-prober}, and +-creating boot entries based on that data, is a potential attack vector. Set +-this option to @samp{false} to enable this feature in the +-@command{grub2-mkconfig} command. ++Normally, @command{grub2-mkconfig} will try to use the external ++@command{os-prober} program, if installed, to discover other operating ++systems installed on the same system and generate appropriate menu entries ++for them. Set this option to @samp{true} to disable this. + + @item GRUB_OS_PROBER_SKIP_LIST + List of space-separated FS UUIDs of filesystems to be ignored from os-prober +@@ -1860,9 +1857,10 @@ than zero; otherwise 0. + @section Multi-boot manual config + + Currently autogenerating config files for multi-boot environments depends on +-os-prober and has several shortcomings. Due to that it is disabled by default. +-It is advised to use the power of GRUB syntax and do it yourself. A possible +-configuration is detailed here, feel free to adjust to your needs. ++os-prober and has several shortcomings. While fixing it is scheduled for the ++next release, meanwhile you can make use of the power of GRUB syntax and do it ++yourself. A possible configuration is detailed here, feel free to adjust to your ++needs. + + First create a separate GRUB partition, big enough to hold GRUB. Some of the + following entries show how to load OS installer images from this same partition, +diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in +index 7591edc58ed..3c9431cfcfb 100644 +--- a/util/grub.d/30_os-prober.in ++++ b/util/grub.d/30_os-prober.in +@@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@" + + . "$pkgdatadir/grub-mkconfig_lib" + +-if [ "x${GRUB_DISABLE_OS_PROBER}" = "xfalse" ]; then +- gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.\n" ++if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then + exit 0 + fi + +@@ -40,8 +39,6 @@ OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`" + if [ -z "${OSPROBED}" ] ; then + # empty os-prober output, nothing doing + exit 0 +-else +- grub_warn "$(gettext_printf "os-prober was executed to detect other bootable partitions.\nIt's output will be used to detect bootable binaries on them and create new boot entries.")" + fi + + osx_entry() { diff --git a/0196-grub-install-Define-default-platform-for-RISC-V.patch b/0196-grub-install-Define-default-platform-for-RISC-V.patch deleted file mode 100644 index 962c0803..00000000 --- a/0196-grub-install-Define-default-platform-for-RISC-V.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Andreas Schwab -Date: Thu, 15 Aug 2019 16:55:13 +0200 -Subject: [PATCH] grub-install: Define default platform for RISC-V - -Signed-off-by: Andreas Schwab -Reviewed-by: Daniel Kiper -Reviewed-by: Alexander Graf ---- - util/grub-install.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/util/grub-install.c b/util/grub-install.c -index 37fcdac12cc..8b6a037903e 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -324,6 +324,14 @@ get_default_platform (void) - return "arm64-efi"; - #elif defined (__amd64__) || defined (__x86_64__) || defined (__i386__) - return grub_install_get_default_x86_platform (); -+#elif defined (__riscv) -+#if __riscv_xlen == 32 -+ return "riscv32-efi"; -+#elif __riscv_xlen == 64 -+ return "riscv64-efi"; -+#else -+ return NULL; -+#endif - #else - return NULL; - #endif diff --git a/0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch b/0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch deleted file mode 100644 index 55efdaa1..00000000 --- a/0197-blscfg-Always-use-the-root-variable-to-search-for-BL.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 14 Jan 2020 17:41:29 +0100 -Subject: [PATCH] blscfg: Always use the root variable to search for BLS - snippets - -The boot and root variables are set by grub2-mkconfig to tell GRUB what -are the devices and partitions used as the EFI System Partition (ESP) -and to store the /boot directory (or used as the /boot mount point). - -But the boot variable is not needed anymore, this was added because the -blscfg module used to search for the BLS snippets in the ESP, but was -later changed to always search for the BLS files in /boot even for EFI. - -When doing that change, the logic was made backwards and so the boot -variable is wrongly used for legacy BIOS. This only works because this -is set to the same value as the root variable. - -So the correct thing to do is to always use the root variable to search -the BLS snippets, since that is set to the partition that stores them. - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/blscfg.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 069db721bec..24e35a40f24 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -1018,14 +1018,12 @@ bls_load_entries (const char *path) - if (!devid) { - #ifdef GRUB_MACHINE_EMU - devid = "host"; --#elif defined(GRUB_MACHINE_EFI) -+#else - devid = grub_env_get ("root"); --#else -- devid = grub_env_get ("boot"); - #endif - if (!devid) - return grub_error (GRUB_ERR_FILE_NOT_FOUND, -- N_("variable `%s' isn't set"), "boot"); -+ N_("variable `%s' isn't set"), "root"); - } - - grub_dprintf ("blscfg", "opening %s\n", devid); diff --git a/0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch b/0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch deleted file mode 100644 index fa35f659..00000000 --- a/0204-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 16 Mar 2020 13:51:45 +0100 -Subject: [PATCH] blscfg: return NULL instead of a zero-length array in - bls_make_list() - -The bls_make_list() function returns a list of all the values for a given -key and if there is none a NULL pointer should be returned. But currently -is returnin a zero-length array instead. - -This makes the callers to wrongly assume that there are values for a key -and populate wrong menu entries. For example menu entries are populated -with an initrd command even if there is no initrd fiel in the BLS file. - -Resolves: rhbz#1806022 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/blscfg.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 24e35a40f24..9263a5c1a02 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -600,6 +600,12 @@ static char **bls_make_list (struct bls_entry *entry, const char *key, int *num) - list[nlist] = NULL; - } - -+ if (!nlist) -+ { -+ grub_free (list); -+ return NULL; -+ } -+ - if (num) - *num = nlist; - diff --git a/0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch b/0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch deleted file mode 100644 index 5993a6ba..00000000 --- a/0205-grub-switch-to-blscfg-Update-grub2-binary-in-ESP-for.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Thu, 26 Mar 2020 15:08:30 +0100 -Subject: [PATCH] grub-switch-to-blscfg: Update grub2 binary in ESP for OSTree - systems - -The grub2 EFI binary in the ESP isn't updated as a part of an OSTree update -transaction. So let's make the script to update this and also create a file -to indicate that the installed version has support for the blscfg module. - -Related: rhbz#1751272 - -Signed-off-by: Javier Martinez Canillas ---- - util/grub-switch-to-blscfg.in | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in -index 49b3985fadb..a05a8d98554 100644 ---- a/util/grub-switch-to-blscfg.in -+++ b/util/grub-switch-to-blscfg.in -@@ -266,6 +266,15 @@ copy_bls() { - fi - } - -+# The grub2 EFI binary is not copied to the ESP as a part of an ostree -+# transaction. Make sure a grub2 version with BLS support is installed. -+if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars/; then -+ grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" -+ cp ${grub_binary} ${grubdir} || exit 1 -+ # Create a hidden file to indicate that grub2 now has BLS support. -+ touch /boot/grub2/.grub2-blscfg-supported -+fi -+ - GENERATE=0 - if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \ - | grep -vq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' ; then diff --git a/0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch b/0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch deleted file mode 100644 index 27ef6e0a..00000000 --- a/0206-grub-switch-to-blscfg-Only-mark-GRUB-as-BLS-supporte.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Thu, 2 Apr 2020 11:07:24 +0200 -Subject: [PATCH] grub-switch-to-blscfg: Only mark GRUB as BLS supported if - blsdir isn't set - -If the user set the blsdir environemnt variable to a path that is not the -default where ostree writes the BLS snippets, the blscfg module won't be -able to parse them and can lead to not having any menu entries on boot. - -So to minimize the risk of things going wrong when dropping the 15_ostree -script used by ostree to create the menu entries, only mark the bootloader -as BLS supported if the blsdir variable has not been set. - -Signed-off-by: Javier Martinez Canillas ---- - util/grub-switch-to-blscfg.in | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in -index a05a8d98554..4bbed8e4fe9 100644 ---- a/util/grub-switch-to-blscfg.in -+++ b/util/grub-switch-to-blscfg.in -@@ -267,8 +267,11 @@ copy_bls() { - } - - # The grub2 EFI binary is not copied to the ESP as a part of an ostree --# transaction. Make sure a grub2 version with BLS support is installed. --if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars/; then -+# transaction. Make sure a grub2 version with BLS support is installed -+# but only do this if the blsdir is not set, to make sure that the BLS -+# parsing module will search for the BLS snippets in the default path. -+if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \ -+ ! ${grub_editenv} - list | grep -q blsdir; then - grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" - cp ${grub_binary} ${grubdir} || exit 1 - # Create a hidden file to indicate that grub2 now has BLS support. diff --git a/0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch b/0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch deleted file mode 100644 index cd4be69e..00000000 --- a/0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch +++ /dev/null @@ -1,662 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 31 Mar 2020 12:35:42 +0200 -Subject: [PATCH] 10_linux.in: Merge logic from 10_linux_bls and drop that - script - -There's a 10_linux_bls snippet that's used in ppc64le machines to generate -a set of menuentry commands by parsing BLS configs in /boot/loader/entries. - -This was made because on PowerNV ppc64le machines that boot using the OPAL -firmware, there could be an old version of the Petitboot bootloader that -doesn't have support to parse BLS snippets. - -But there is no need to have a separate GRUB script for that and the logic -could just be part of the usual 10_linux snippet. - -Also the BLS files could be used directly if the bootloader has support to -parse them, which is the case for GRUB that's used in ppc64le OF or if the -Petitboot used in ppc64le OPAL machines is version 1.8.0 or newer. - -So only generate the menuentry commands from the BLS snippets in the case -of OPAL machines with an old Petitboot version. - -Signed-off-by: Javier Martinez Canillas ---- - Makefile.util.def | 7 - - util/grub.d/10_linux.in | 97 ++++++++- - util/grub.d/10_linux_bls.in | 470 -------------------------------------------- - 3 files changed, 96 insertions(+), 478 deletions(-) - delete mode 100644 util/grub.d/10_linux_bls.in - -diff --git a/Makefile.util.def b/Makefile.util.def -index 1fa92caad4d..f3a699691bf 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -517,13 +517,6 @@ script = { - condition = COND_HOST_LINUX; - }; - --script = { -- name = '10_linux_bls'; -- common = util/grub.d/10_linux_bls.in; -- installdir = grubconf; -- condition = COND_HOST_LINUX; --}; -- - script = { - name = '10_reset_boot_success'; - common = util/grub.d/10_reset_boot_success.in; -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index b70dca27567..c72cc3246bb 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -84,18 +84,86 @@ esac - - populate_header_warn() - { -+if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then -+ bls_parser="10_linux script" -+else -+ bls_parser="blscfg command" -+fi - cat <&2 -+ -+ files=($(for bls in ${blsdir}/*.conf ; do -+ if ! [[ -e "${bls}" ]] ; then -+ continue -+ fi -+ bls="${bls%.conf}" -+ bls="${bls##*/}" -+ echo "${bls}" -+ done | ${kernel_sort} | tac)) || : -+ -+ for bls in "${files[@]}" ; do -+ read_config "${blsdir}/${bls}.conf" -+ -+ menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" -+ menu="${menu}\t linux ${linux} ${options}\n" -+ if [ -n "${initrd}" ] ; then -+ menu="${menu}\t initrd ${boot_prefix}${initrd}\n" -+ fi -+ menu="${menu}}\n\n" -+ done -+ # The printf command seems to be more reliable across shells for special character (\n, \t) evaluation -+ printf "$menu" -+} -+ - if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then - if [ x$dirname = x/ ]; then - if [ -z "${prepare_root_cache}" ]; then -@@ -115,6 +183,26 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then - prepare_grub_to_access_device_with_variable boot ${boot_device} - fi - -+ arch="$(uname -m)" -+ if [ "x${arch}" = "xppc64le" ] && [ -d /sys/firmware/opal ]; then -+ -+ petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" -+ -+ if test -e ${petitboot_path}; then -+ read -a petitboot_version < ${petitboot_path} -+ petitboot_version="$(echo ${petitboot_version//v})" -+ major_version="$(echo ${petitboot_version} | cut -d . -f1)" -+ minor_version="$(echo ${petitboot_version} | cut -d . -f2)" -+ -+ if test -z ${petitboot_version} || test ${major_version} -lt 1 || \ -+ test ${major_version} -eq 1 -a ${minor_version} -lt 8; then -+ BLS_POPULATE_MENU="true" -+ fi -+ else -+ BLS_POPULATE_MENU="true" -+ fi -+ fi -+ - populate_header_warn - - cat << EOF -@@ -129,10 +217,17 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then - if [ -z "\${kernelopts}" ]; then - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - fi -+EOF -+ -+ if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then -+ populate_menu -+ else -+ cat << EOF - - insmod blscfg - blscfg - EOF -+ fi - - if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then - blsdir="/boot/loader/entries" -diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in -deleted file mode 100644 -index 68fbedf2129..00000000000 ---- a/util/grub.d/10_linux_bls.in -+++ /dev/null -@@ -1,470 +0,0 @@ --#! /bin/sh --set -e -- --# grub-mkconfig helper script. --# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. --# --# GRUB is free software: you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation, either version 3 of the License, or --# (at your option) any later version. --# --# GRUB is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with GRUB. If not, see . -- --prefix="@prefix@" --exec_prefix="@exec_prefix@" --datarootdir="@datarootdir@" -- --. "$pkgdatadir/grub-mkconfig_lib" -- --export TEXTDOMAIN=@PACKAGE@ --export TEXTDOMAINDIR="@localedir@" -- --CLASS="--class gnu-linux --class gnu --class os --unrestricted" -- --if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then -- OS="$(eval $(grep PRETTY_NAME /etc/os-release) ; echo ${PRETTY_NAME})" -- CLASS="--class $(eval $(grep '^ID_LIKE=\|^ID=' /etc/os-release) ; [ -n "${ID_LIKE}" ] && echo ${ID_LIKE} || echo ${ID}) ${CLASS}" --else -- OS="${GRUB_DISTRIBUTOR}" -- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" --fi -- --# loop-AES arranges things so that /dev/loop/X can be our root device, but --# the initrds that Linux uses don't like that. --case ${GRUB_DEVICE} in -- /dev/loop/*|/dev/loop[0-9]) -- GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` -- ;; --esac -- --# Default to disabling partition uuid support to maintian compatibility with --# older kernels. --GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true} -- --# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter --# and mounting btrfs requires user space scanning, so force UUID in this case. --if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \ -- || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ -- && [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \ -- || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -- && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \ -- || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then -- LINUX_ROOT_DEVICE=${GRUB_DEVICE} --elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \ -- || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then -- LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID} --else -- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} --fi -- --case x"$GRUB_FS" in -- xbtrfs) -- if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then -- GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}" -- else -- rootsubvol="`make_system_path_relative_to_its_root /`" -- rootsubvol="${rootsubvol#/}" -- if [ "x${rootsubvol}" != x ]; then -- GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" -- fi -- fi;; -- xzfs) -- rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` -- bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" -- LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}" -- ;; --esac -- --mktitle () --{ -- local title_type -- local version -- local OS_NAME -- local OS_VERS -- -- title_type=$1 && shift -- version=$1 && shift -- -- OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})" -- OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})" -- -- case $title_type in -- recovery) -- title=$(printf '%s (%s) %s (recovery mode)' \ -- "${OS_NAME}" "${version}" "${OS_VERS}") -- ;; -- *) -- title=$(printf '%s (%s) %s' \ -- "${OS_NAME}" "${version}" "${OS_VERS}") -- ;; -- esac -- echo -n ${title} --} -- --title_correction_code= -- --populate_header_warn() --{ --cat <&2 -- -- files=($(for bls in ${blsdir}/*.conf ; do -- if ! [[ -e "${bls}" ]] ; then -- continue -- fi -- bls="${bls%.conf}" -- bls="${bls##*/}" -- echo "${bls}" -- done | ${kernel_sort} | tac)) || : -- -- for bls in "${files[@]}" ; do -- read_config "${blsdir}/${bls}.conf" -- -- menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" -- menu="${menu}\t linux ${linux} ${options}\n" -- if [ -n "${initrd}" ] ; then -- menu="${menu}\t initrd ${boot_prefix}${initrd}\n" -- fi -- menu="${menu}}\n\n" -- done -- # The printf command seems to be more reliable across shells for special character (\n, \t) evaluation -- printf "$menu" --} -- --linux_entry () --{ -- os="$1" -- version="$2" -- type="$3" -- isdebug="$4" -- args="$5" -- -- if [ -z "$boot_device_id" ]; then -- boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" -- fi -- -- if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then -- if [ x$dirname = x/ ]; then -- if [ -z "${prepare_root_cache}" ]; then -- prepare_grub_to_access_device ${GRUB_DEVICE} -- fi -- else -- if [ -z "${prepare_boot_cache}" ]; then -- prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} -- fi -- fi -- -- if [ -d /sys/firmware/efi ]; then -- bootefi_device="`${grub_probe} --target=device /boot/efi/`" -- prepare_grub_to_access_device_with_variable boot ${bootefi_device} -- else -- boot_device="`${grub_probe} --target=device /boot/`" -- prepare_grub_to_access_device_with_variable boot ${boot_device} -- fi -- -- populate_header_warn -- populate_menu -- -- if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then -- blsdir="/boot/loader/entries" -- [ -d "${blsdir}" ] && GRUB_BLS_FS="$(${grub_probe} --target=fs ${blsdir})" -- if [ "x${GRUB_BLS_FS}" = "xbtrfs" ] || [ "x${GRUB_BLS_FS}" = "xzfs" ]; then -- blsdir=$(make_system_path_relative_to_its_root "${blsdir}") -- if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then -- ${grub_editenv} - set blsdir="${blsdir}" -- fi -- fi -- -- ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}" -- if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then -- ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" -- fi -- fi -- -- exit 0 -- fi -- -- if [ x$type != xsimple ] ; then -- title=$(mktitle "$type" "$version") -- if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then -- replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" -- quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" -- title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" -- fi -- if [ x$isdebug = xdebug ]; then -- title="$title${GRUB_LINUX_DEBUG_TITLE_POSTFIX}" -- fi -- echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -- else -- echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -- fi -- if [ x$type != xrecovery ] ; then -- save_default_entry | grub_add_tab -- fi -- -- # Use ELILO's generic "efifb" when it's known to be available. -- # FIXME: We need an interface to select vesafb in case efifb can't be used. -- if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then -- echo " load_video" | sed "s/^/$submenu_indentation/" -- if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \ -- && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then -- echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/" -- fi -- else -- if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then -- echo " load_video" | sed "s/^/$submenu_indentation/" -- fi -- echo " set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/" -- fi -- -- echo " insmod gzio" | sed "s/^/$submenu_indentation/" -- -- if [ x$dirname = x/ ]; then -- if [ -z "${prepare_root_cache}" ]; then -- prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)" -- fi -- printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/" -- else -- if [ -z "${prepare_boot_cache}" ]; then -- prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)" -- fi -- printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" -- fi -- sed "s/^/$submenu_indentation/" << EOF -- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} --EOF -- if test -n "${initrd}" ; then -- initrd_path= -- for i in ${initrd}; do -- initrd_path="${initrd_path} ${rel_dirname}/${i}" -- done -- sed "s/^/$submenu_indentation/" << EOF -- initrd $(echo $initrd_path) --EOF -- fi -- if test -n "${fdt}" ; then -- sed "s/^/$submenu_indentation/" << EOF -- devicetree ${rel_dirname}/${fdt} --EOF -- fi -- sed "s/^/$submenu_indentation/" << EOF --} --EOF --} -- --machine=`uname -m` --case "x$machine" in -- xi?86 | xx86_64) -- list= -- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do -- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -- done ;; -- *) -- list= -- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do -- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -- done ;; --esac -- --if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then -- for i in /boot/ostree/*/vmlinuz-* ; do -- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -- done --fi -- --case "$machine" in -- i?86) GENKERNEL_ARCH="x86" ;; -- mips|mips64) GENKERNEL_ARCH="mips" ;; -- mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;; -- arm*) GENKERNEL_ARCH="arm" ;; -- *) GENKERNEL_ARCH="$machine" ;; --esac -- --prepare_boot_cache= --prepare_root_cache= --boot_device_id= --title_correction_code= -- --# Extra indentation to add to menu entries in a submenu. We're not in a submenu --# yet, so it's empty. In a submenu it will be equal to '\t' (one tab). --submenu_indentation="" -- --is_top_level=true --while [ "x$list" != "x" ] ; do -- linux=`version_find_latest $list` -- if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then -- gettext_printf "Found linux image: %s\n" "$linux" >&2 -- fi -- -- basename=`basename $linux` -- dirname=`dirname $linux` -- rel_dirname=`make_system_path_relative_to_its_root $dirname` -- version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` -- alt_version=`echo $version | sed -e "s,\.old$,,g"` -- linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" -- -- initrd_early= -- for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \ -- ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do -- if test -e "${dirname}/${i}" ; then -- initrd_early="${initrd_early} ${i}" -- fi -- done -- -- initrd_real= -- for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ -- "initrd-${version}" "initramfs-${version}.img" \ -- "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ -- "initrd-${alt_version}" "initramfs-${alt_version}.img" \ -- "initramfs-genkernel-${version}" \ -- "initramfs-genkernel-${alt_version}" \ -- "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ -- "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do -- if test -e "${dirname}/${i}" ; then -- initrd_real="${i}" -- break -- fi -- done -- -- initrd= -- if test -n "${initrd_early}" || test -n "${initrd_real}"; then -- initrd="${initrd_early} ${initrd_real}" -- -- initrd_display= -- for i in ${initrd}; do -- initrd_display="${initrd_display} ${dirname}/${i}" -- done -- if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then -- gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 -- fi -- fi -- -- fdt= -- for i in "dtb-${version}" "dtb-${alt_version}"; do -- if test -f "${dirname}/${i}/${GRUB_DEFAULT_DTB}" ; then -- fdt="${i}/${GRUB_DEFAULT_DTB}" -- break -- fi -- done -- -- config= -- for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do -- if test -e "${i}" ; then -- config="${i}" -- break -- fi -- done -- -- initramfs= -- if test -n "${config}" ; then -- initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` -- fi -- -- if test -z "${initramfs}" && test -z "${initrd_real}" ; then -- # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's -- # no initrd or builtin initramfs, it can't work here. -- if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \ -- || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then -- -- linux_root_device_thisversion=${GRUB_DEVICE} -- else -- linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID} -- fi -- fi -- -- if [ "x${GRUB_DISABLE_SUBMENU}" = "xyes" ] || [ "x${GRUB_DISABLE_SUBMENU}" = "xy" ]; then -- GRUB_DISABLE_SUBMENU="true" -- fi -- -- if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then -- linux_entry "${OS}" "${version}" simple standard \ -- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -- if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then -- linux_entry "${OS}" "${version}" simple debug \ -- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_LINUX_DEBUG}" -- fi -- -- submenu_indentation="$grub_tab" -- -- if [ -z "$boot_device_id" ]; then -- boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" -- fi -- # TRANSLATORS: %s is replaced with an OS name -- echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" -- is_top_level=false -- fi -- -- linux_entry "${OS}" "${version}" advanced standard \ -- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -- if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then -- linux_entry "${OS}" "${version}" advanced debug \ -- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_LINUX_DEBUG}" -- fi -- -- if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then -- linux_entry "${OS}" "${version}" recovery standard \ -- "single ${GRUB_CMDLINE_LINUX}" -- fi -- -- list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` --done -- --# If at least one kernel was found, then we need to --# add a closing '}' for the submenu command. --if [ x"$is_top_level" != xtrue ]; then -- echo '}' --fi -- --echo "$title_correction_code" diff --git a/0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch b/0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch deleted file mode 100644 index c131a7f6..00000000 --- a/0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Thu, 16 Apr 2020 18:53:03 +0200 -Subject: [PATCH] grub-switch-to-blscfg: Use install to copy GRUB binary, - modules and config - -By default the cp command truncates the destination before copying from the -source, so if interrupted it can lead to a file that's half written. - -This behavior can be modified using the --remove-destination option, but is -usually a better choice to use the install tool for this. So let's do that. - -Signed-off-by: Javier Martinez Canillas ---- - util/grub-switch-to-blscfg.in | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in -index 4bbed8e4fe9..3333a620c28 100644 ---- a/util/grub-switch-to-blscfg.in -+++ b/util/grub-switch-to-blscfg.in -@@ -273,7 +273,7 @@ copy_bls() { - if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \ - ! ${grub_editenv} - list | grep -q blsdir; then - grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" -- cp ${grub_binary} ${grubdir} || exit 1 -+ install -m 700 ${grub_binary} ${grubdir} || exit 1 - # Create a hidden file to indicate that grub2 now has BLS support. - touch /boot/grub2/.grub2-blscfg-supported - fi -@@ -307,13 +307,13 @@ if [ "${GENERATE}" -eq 1 ] ; then - - if [ -n "${mod_dir}" ]; then - for mod in blscfg increment; do -- cp ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1 -+ install -m 700 ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1 - done - fi - - cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}" - if ! grub2-mkconfig -o "${GRUB_CONFIG_FILE}" ; then -- cp -af "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}" -+ install -m 700 "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}" - sed -i"${backupsuffix}" \ - -e 's,^GRUB_ENABLE_BLSCFG=.*,GRUB_ENABLE_BLSCFG=false,' \ - "${etcdefaultgrub}" diff --git a/0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch b/0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch deleted file mode 100644 index 99c26dda..00000000 --- a/0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Thu, 16 Apr 2020 18:53:05 +0200 -Subject: [PATCH] 10_linux.in: Enable BLS configuration if new-kernel-pkg isn't - present - -Currently if the the GRUB_ENABLE_BLSCFG option in /etc/default/grub hasn't -been set, the 10_linux script will generate a GRUB configuration that does -not include the blscfg command to populate the menu entries from BLS files. - -But on kernel install the /usr/lib/kernel/install.d/20-grub.install script -will only add menuentry commands to the GRUB config file if the old grubby -tool and new-kernel-pkg script are installed. - -So a configuration with the GRUB_ENABLE_BLSCFG option will lead to a setup -where new kernel entries are not added. Make a BLS config the default if -that option wasn't set and the new-kernel-pkg script is not present. - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/10_linux.in | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index c72cc3246bb..847646bd8a8 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -164,6 +164,11 @@ populate_menu() - printf "$menu" - } - -+# Make BLS the default if GRUB_ENABLE_BLSCFG was not set and grubby is not installed. -+if [ -z "${GRUB_ENABLE_BLSCFG}" ] && [ -z "$(which new-kernel-pkg 2> /dev/null)" ]; then -+ GRUB_ENABLE_BLSCFG="true" -+fi -+ - if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then - if [ x$dirname = x/ ]; then - if [ -z "${prepare_root_cache}" ]; then diff --git a/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch b/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch deleted file mode 100644 index 483efc4c..00000000 --- a/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Wed, 29 Apr 2020 20:08:27 +0200 -Subject: [PATCH] blscfg: Lookup default_kernelopts variable as fallback for - options - -The 10_linux script sets a variable that contains the kernel command line -parameters. This is done so the entries will still have a kernel cmdline -defined even if the grubenv can't be read. - -But older versions of the script used to set a default_kernelopts variable -while newer versions just sets the kernelopts, which is what's defined in -the BLS snippets. - -The blscfg module needs to keep looking for the default_kernelops since it -may be that a user doesn't have a grubenv file and has an older grub.cfg -that sets this variable instead of kernelopts. - -Related: rhbz#1765297 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/blscfg.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 9263a5c1a02..4ec6504d9a4 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -759,6 +759,10 @@ static void create_entry (struct bls_entry *entry) - - title = bls_get_val (entry, "title", NULL); - options = expand_val (bls_get_val (entry, "options", NULL)); -+ -+ if (!options) -+ options = expand_val (grub_env_get("default_kernelopts")); -+ - initrds = bls_make_list (entry, "initrd", NULL); - - devicetree = expand_val (bls_get_val (entry, "devicetree", NULL)); diff --git a/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch b/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch deleted file mode 100644 index 75eb75ad..00000000 --- a/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Thu, 30 Apr 2020 15:45:31 +0200 -Subject: [PATCH] 10_linux.in: fix early exit due error when reading petitboot - version - -The script uses bash's read built-in command to get the petitboot version -version, but this command has a non-zero exit status if the EOF is found. - -Since the /sys/firmware/devicetree/base/ibm,firmware-versions/petitboot -string ends with a NUL character, use the empty string as read delimiter -to prevent the command to read to the end-of-file and exit with an error. - -Resolves: rhbz#1827397 - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/10_linux.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 847646bd8a8..09adfce80fd 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -194,7 +194,7 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then - petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" - - if test -e ${petitboot_path}; then -- read -a petitboot_version < ${petitboot_path} -+ read -r -d '' petitboot_version < ${petitboot_path} - petitboot_version="$(echo ${petitboot_version//v})" - major_version="$(echo ${petitboot_version} | cut -d . -f1)" - minor_version="$(echo ${petitboot_version} | cut -d . -f2)" diff --git a/0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch b/0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch deleted file mode 100644 index 09d378f2..00000000 --- a/0213-envblk-Fix-buffer-overrun-when-attempting-to-shrink-.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 12 May 2020 01:00:51 +0200 -Subject: [PATCH] envblk: Fix buffer overrun when attempting to shrink a - variable value -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If an existing variable is set with a value whose length is smaller than -the current value, a memory corruption can happen due copying padding '#' -characters outside of the environment block buffer. - -This is caused by a wrong calculation of the previous free space position -after moving backward the characters that followed the old variable value. - -That position is calculated to fill the remaining of the buffer with the -padding '#' characters. But since isn't calculated correctly, it can lead -to copies outside of the buffer. - -The issue can be reproduced by creating a variable with a large value and -then try to set a new value that is much smaller: - -$ grub2-editenv --version -grub2-editenv (GRUB) 2.04 - -$ grub2-editenv env create - -$ grub2-editenv env set a="$(for i in {1..500}; do var="b$var"; done; echo $var)" - -$ wc -c env -1024 grubenv - -$ grub2-editenv env set a="$(for i in {1..50}; do var="b$var"; done; echo $var)" -malloc(): corrupted top size -Aborted (core dumped) - -$ wc -c env -0 grubenv - -Reported-by: Renaud Métrich -Signed-off-by: Javier Martinez Canillas -Patch-cc: Daniel Kiper ---- - grub-core/lib/envblk.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/lib/envblk.c b/grub-core/lib/envblk.c -index f89d86d4e8d..874506da169 100644 ---- a/grub-core/lib/envblk.c -+++ b/grub-core/lib/envblk.c -@@ -143,7 +143,7 @@ grub_envblk_set (grub_envblk_t envblk, const char *name, const char *value) - /* Move the following characters backward, and fill the new - space with harmless characters. */ - grub_memmove (p + vl, p + len, pend - (p + len)); -- grub_memset (space + len - vl, '#', len - vl); -+ grub_memset (space - (len - vl), '#', len - vl); - } - else - /* Move the following characters forward. */ diff --git a/0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch b/0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch deleted file mode 100644 index 2b9b4436..00000000 --- a/0214-10_linux.in-Store-cmdline-in-BLS-snippets-instead-of.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Wed, 13 May 2020 19:40:10 +0200 -Subject: [PATCH] 10_linux.in: Store cmdline in BLS snippets instead of using a - variable - -The kernel cmdline was stored as a kernelopts variable in the grubenv file -and the BLS snippets used that. But this turned out to be fragile since the -grubenv file could be removed or get corrupted easily. - -To prevent the entries to not have a cmdline if the grubenv can't be read, -a fallback variable was set in the GRUB config file. But this still caused -issues since the config needs to be re-generated to change the parameters. - -Instead, let's store the cmdline in the BLS snippets. This will make the -configuration more robust, since it will work even without the grubenv -file and the BLS entries will contain all the information needed to boot. - -Signed-off-by: Javier Martinez Canillas ---- - util/grub-switch-to-blscfg.in | 30 ++++++++++-------------------- - util/grub.d/10_linux.in | 41 +++++++++++++++++++++++++++++++---------- - 2 files changed, 41 insertions(+), 30 deletions(-) - -diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in -index 3333a620c28..cb229126128 100644 ---- a/util/grub-switch-to-blscfg.in -+++ b/util/grub-switch-to-blscfg.in -@@ -190,7 +190,7 @@ fi - mkbls() { - local kernelver=$1 && shift - local datetime=$1 && shift -- local bootprefix=$1 && shift -+ local kernelopts=$1 && shift - - local debugname="" - local debugid="" -@@ -209,10 +209,9 @@ mkbls() { - cat <"${bls_target}" -- fi -+ mkbls "${kernelver}" \ -+ "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" \ -+ "${bootprefix}" "${cmdline}" >"${bls_target}" - - if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then - bls_debug="$(echo ${bls_target} | sed -e "s/${kernelver}/${kernelver}~debug/")" - cp -aT "${bls_target}" "${bls_debug}" - title="$(grep '^title[ \t]' "${bls_debug}" | sed -e 's/^title[ \t]*//')" -- blsid="$(grep '^id[ \t]' "${bls_debug}" | sed -e "s/\.${ARCH}/-debug.${arch}/")" -+ options="$(echo "${cmdline} ${GRUB_CMDLINE_LINUX_DEBUG}" | sed -e 's/\//\\\//g')" - sed -i -e "s/^title.*/title ${title}${GRUB_LINUX_DEBUG_TITLE_POSTFIX}/" "${bls_debug}" -- sed -i -e "s/^id.*/${blsid}/" "${bls_debug}" -- sed -i -e "s/^options.*/options \$kernelopts ${GRUB_CMDLINE_LINUX_DEBUG}/" "${bls_debug}" -+ sed -i -e "s/^options.*/options ${options}/" "${bls_debug}" - fi - done - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 09adfce80fd..80299ecaf00 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -134,23 +134,43 @@ read_config() - done < ${config_file} - } - --populate_menu() -+blsdir="/boot/loader/entries" -+ -+get_sorted_bls() - { -- blsdir="/boot/loader/entries" -- local -a files - local IFS=$'\n' -- gettext_printf "Generating boot entries from BLS files...\n" >&2 - -- files=($(for bls in ${blsdir}/*.conf ; do -- if ! [[ -e "${bls}" ]] ; then -- continue -- fi -+ files=($(for bls in ${blsdir}/*.conf; do - bls="${bls%.conf}" - bls="${bls##*/}" - echo "${bls}" - done | ${kernel_sort} | tac)) || : - -- for bls in "${files[@]}" ; do -+ echo "${files[@]}" -+} -+ -+update_bls_cmdline() -+{ -+ local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" -+ local -a files=($(get_sorted_bls)) -+ -+ for bls in "${files[@]}"; do -+ local options="${cmdline}" -+ if [ -z "${bls##*debug*}" ]; then -+ options="${options} ${GRUB_CMDLINE_LINUX_DEBUG}" -+ fi -+ options="$(echo "${options}" | sed -e 's/\//\\\//g')" -+ sed -i -e "s/^options.*/options ${options}/" "${blsdir}/${bls}.conf" -+ done -+} -+ -+populate_menu() -+{ -+ local -a files=($(get_sorted_bls)) -+ -+ gettext_printf "Generating boot entries from BLS files...\n" >&2 -+ -+ for bls in "${files[@]}"; do - read_config "${blsdir}/${bls}.conf" - - menu="${menu}menuentry '${title}' ${grub_arg} --id=${bls} {\n" -@@ -224,6 +244,8 @@ if [ -z "\${kernelopts}" ]; then - fi - EOF - -+ update_bls_cmdline -+ - if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then - populate_menu - else -@@ -244,7 +266,6 @@ EOF - fi - fi - -- ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then - ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" - fi diff --git a/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch b/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch deleted file mode 100644 index 4517745f..00000000 --- a/0215-10_linux.in-restore-existence-check-in-get_sorted_bl.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Thu, 14 May 2020 17:52:53 -0700 -Subject: [PATCH] 10_linux.in: restore existence check in `get_sorted_bls` - -This is necessary to handle `/boot/loader/entries` not existing -at all (or possibly existing but being empty - not sure about -that case). Without this check, this function gets pretty wacky -and winds up returning the contents of the current working -directory, which of course causes whatever called it to break. - -Resolves: rhbz#1836020 - -Signed-off-by: Adam Williamson ---- - util/grub.d/10_linux.in | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 80299ecaf00..519e2d9e616 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -141,6 +141,9 @@ get_sorted_bls() - local IFS=$'\n' - - files=($(for bls in ${blsdir}/*.conf; do -+ if ! [[ -e "${bls}" ]] ; then -+ continue -+ fi - bls="${bls%.conf}" - bls="${bls##*/}" - echo "${bls}" diff --git a/0217-tpm-Enable-module-for-all-EFI-platforms.patch b/0217-tpm-Enable-module-for-all-EFI-platforms.patch deleted file mode 100644 index f1197850..00000000 --- a/0217-tpm-Enable-module-for-all-EFI-platforms.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 18 May 2020 12:56:27 +0200 -Subject: [PATCH] tpm: Enable module for all EFI platforms - -The tpm module is only enabled for x86_64, but there's nothing specific to -that architecture in the code and could be enabled for all EFI platforms. - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/Makefile.core.def | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 661994686e6..b283c502b9c 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -2512,7 +2512,7 @@ module = { - name = tpm; - common = commands/tpm.c; - efi = commands/efi/tpm.c; -- enable = x86_64_efi; -+ enable = efi; - }; - - module = { diff --git a/0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch b/0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch deleted file mode 100644 index 945efc2c..00000000 --- a/0218-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Wed, 20 May 2020 12:23:27 +0200 -Subject: [PATCH] 10_linux.in: Don't update BLS files that aren't managed by - GRUB scripts - -The script is updating all BLS files present in the /boot/loader/entries -directory, but it should only update the BLS that belong to the machine. - -Otherwise if a user is sharing the same boot partition between different -operating systems, the grub2-mkconfig tool will wrongly update BLS files -that were created by a different OS. - -There are also cases where the BLS snippets are not managed by the GRUB -scripts at all, for example in OSTree based systems. So it's also wrong -to update the BLS snippets created by OSTree. - -Resolves: rhbz#1837783 - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/10_linux.in | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 519e2d9e616..e61b6c94f11 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -138,16 +138,25 @@ blsdir="/boot/loader/entries" - - get_sorted_bls() - { -+ if ! [ -d "${blsdir}" ] || ! [ -e /etc/machine-id ]; then -+ return -+ fi -+ -+ read machine_id < /etc/machine-id -+ if [ -z "${machine_id}" ]; then -+ return -+ fi -+ - local IFS=$'\n' - -- files=($(for bls in ${blsdir}/*.conf; do -+ files=($(for bls in ${blsdir}/${machine_id}-*.conf; do - if ! [[ -e "${bls}" ]] ; then - continue - fi - bls="${bls%.conf}" - bls="${bls##*/}" - echo "${bls}" -- done | ${kernel_sort} | tac)) || : -+ done | ${kernel_sort} 2>/dev/null | tac)) || : - - echo "${files[@]}" - } diff --git a/0221-fix-build-with-rpm-4.16.patch b/0221-fix-build-with-rpm-4.16.patch deleted file mode 100644 index 2a2e3897..00000000 --- a/0221-fix-build-with-rpm-4.16.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thierry Vignaud -Date: Mon, 8 Jun 2020 06:50:21 +0200 -Subject: [PATCH] fix build with rpm-4.16 - -Signed-off-by: Thierry Vignaud ---- - configure.ac | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/configure.ac b/configure.ac -index eff160b6931..5d3316185da 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1887,6 +1887,15 @@ if test x"$rpm_sort_excuse" = x ; then - [Define to 1 if you have the rpm library.]) - fi - -+if test x"$LIBRPM" = x ; then -+ # Check for rpm library. -+ AC_CHECK_LIB([rpmio], [rpmvercmp], [], -+ [rpm_sort_excuse="rpmio missing rpmvercmp"]) -+ LIBRPM="-lrpmio"; -+ AC_DEFINE([HAVE_RPMIO], [1], -+ [Define to 1 if you have the rpm library.]) -+fi -+ - AC_SUBST([LIBRPM]) - - LIBGEOM= diff --git a/0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch b/0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch deleted file mode 100644 index dbb24f21..00000000 --- a/0222-Only-mark-GRUB-as-BLS-supported-in-OSTree-systems-wi.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Thu, 18 Jun 2020 11:19:00 +0200 -Subject: [PATCH] Only mark GRUB as BLS supported in OSTree systems with a boot - partition - -The script grub2-switch-to-blscfg updates the grub2 EFI binary in OSTree -systems and marks that has BLS support, to indicate that's not necessary -to add menuentry commands since the BLS snippets can be used to populate -the GRUB boot menu. - -But OSTree doesn't support installations that don't have a boot partition, -the BLS snippets assume that there will be one so this has to be checked -and only mark the bootloader as supporting BLS in OSTree installations -that have /boot as a mountpoint. - -Signed-off-by: Javier Martinez Canillas ---- - util/grub-switch-to-blscfg.in | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in -index cb229126128..a851424beb2 100644 ---- a/util/grub-switch-to-blscfg.in -+++ b/util/grub-switch-to-blscfg.in -@@ -261,7 +261,8 @@ copy_bls() { - # but only do this if the blsdir is not set, to make sure that the BLS - # parsing module will search for the BLS snippets in the default path. - if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \ -- ! ${grub_editenv} - list | grep -q blsdir; then -+ ! ${grub_editenv} - list | grep -q blsdir && \ -+ mountpoint -q /boot; then - grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)" - install -m 700 ${grub_binary} ${grubdir} || exit 1 - # Create a hidden file to indicate that grub2 now has BLS support. diff --git a/0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch deleted file mode 100644 index 5dc6377e..00000000 --- a/0223-Don-t-assume-that-boot-commands-will-only-return-on-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 9 Apr 2019 13:12:40 +0200 -Subject: [PATCH] Don't assume that boot commands will only return on fail - -While it's true that for most loaders the boot command never returns, it -may be the case that it does. For example the GRUB emulator boot command -calls to systemctl kexec which in turn does an asynchonous call to kexec. - -So in this case GRUB will wrongly assume that the boot command fails and -print a "Failed to boot both default and fallback entries" even when the -kexec call later succeeds. - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/normal/menu.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 9ea1f411814..14ceb9bb060 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -302,7 +302,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) - { - grub_print_error (); - grub_errno = GRUB_ERR_NONE; -- return; -+ return grub_errno; - } - - errs_before = grub_err_printed_errors; -@@ -315,7 +315,7 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) - grub_env_context_open (); - menu = grub_zalloc (sizeof (*menu)); - if (! menu) -- return; -+ return grub_errno; - grub_env_set_menu (menu); - if (auto_boot) - grub_env_set ("timeout", "0"); diff --git a/0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch b/0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch deleted file mode 100644 index 99b66f0b..00000000 --- a/0225-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 15 Apr 2020 15:45:02 -0400 -Subject: [PATCH] yylex: Make lexer fatal errors actually be fatal - -When presented with a command that can't be tokenized to anything -smaller than YYLMAX characters, the parser calls YY_FATAL_ERROR(errmsg), -expecting that will stop further processing, as such: - - #define YY_DO_BEFORE_ACTION \ - yyg->yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yyg->yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - if ( yyleng >= YYLMAX ) \ - YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ - yy_flex_strncpy( yytext, yyg->yytext_ptr, yyleng + 1 , yyscanner); \ - yyg->yy_c_buf_p = yy_cp; - -The code flex generates expects that YY_FATAL_ERROR() will either return -for it or do some form of longjmp(), or handle the error in some way at -least, and so the strncpy() call isn't in an "else" clause, and thus if -YY_FATAL_ERROR() is *not* actually fatal, it does the call with the -questionable limit, and predictable results ensue. - -Unfortunately, our implementation of YY_FATAL_ERROR() is: - - #define YY_FATAL_ERROR(msg) \ - do { \ - grub_printf (_("fatal error: %s\n"), _(msg)); \ - } while (0) - -The same pattern exists in yyless(), and similar problems exist in users -of YY_INPUT(), several places in the main parsing loop, -yy_get_next_buffer(), yy_load_buffer_state(), yyensure_buffer_stack, -yy_scan_buffer(), etc. - -All of these callers expect YY_FATAL_ERROR() to actually be fatal, and -the things they do if it returns after calling it are wildly unsafe. - -Fixes: CVE-2020-10713 - -Signed-off-by: Peter Jones -Reviewed-by: Daniel Kiper -Upstream-commit-id: 926df817dc8 ---- - grub-core/script/yylex.l | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/script/yylex.l b/grub-core/script/yylex.l -index 7b44c37b76f..b7203c82309 100644 ---- a/grub-core/script/yylex.l -+++ b/grub-core/script/yylex.l -@@ -37,11 +37,11 @@ - - /* - * As we don't have access to yyscanner, we cannot do much except to -- * print the fatal error. -+ * print the fatal error and exit. - */ - #define YY_FATAL_ERROR(msg) \ - do { \ -- grub_printf (_("fatal error: %s\n"), _(msg)); \ -+ grub_fatal (_("fatal error: %s\n"), _(msg));\ - } while (0) - - #define COPY(str, hint) \ diff --git a/0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch b/0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch deleted file mode 100644 index 24786867..00000000 --- a/0226-safemath-Add-some-arithmetic-primitives-that-check-f.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 15 Jun 2020 10:58:42 -0400 -Subject: [PATCH] safemath: Add some arithmetic primitives that check for - overflow - -This adds a new header, include/grub/safemath.h, that includes easy to -use wrappers for __builtin_{add,sub,mul}_overflow() declared like: - - bool OP(a, b, res) - -where OP is grub_add, grub_sub or grub_mul. OP() returns true in the -case where the operation would overflow and res is not modified. -Otherwise, false is returned and the operation is executed. - -These arithmetic primitives require newer compiler versions. So, bump -these requirements in the INSTALL file too. - -Signed-off-by: Peter Jones -Reviewed-by: Daniel Kiper -Upstream-commit-id: de1c315841a ---- - include/grub/compiler.h | 8 ++++++++ - include/grub/safemath.h | 37 +++++++++++++++++++++++++++++++++++++ - INSTALL | 22 ++-------------------- - 3 files changed, 47 insertions(+), 20 deletions(-) - create mode 100644 include/grub/safemath.h - -diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index 9859ff4cc79..ebafec68957 100644 ---- a/include/grub/compiler.h -+++ b/include/grub/compiler.h -@@ -48,6 +48,14 @@ - # define WARN_UNUSED_RESULT - #endif - -+#if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__) -+# define CLANG_PREREQ(maj,min) \ -+ ((__clang_major__ > (maj)) || \ -+ (__clang_major__ == (maj) && __clang_minor__ >= (min))) -+#else -+# define CLANG_PREREQ(maj,min) 0 -+#endif -+ - #define UNUSED __attribute__((__unused__)) - - #endif /* ! GRUB_COMPILER_HEADER */ -diff --git a/include/grub/safemath.h b/include/grub/safemath.h -new file mode 100644 -index 00000000000..c17b89bba17 ---- /dev/null -+++ b/include/grub/safemath.h -@@ -0,0 +1,37 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2020 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ * -+ * Arithmetic operations that protect against overflow. -+ */ -+ -+#ifndef GRUB_SAFEMATH_H -+#define GRUB_SAFEMATH_H 1 -+ -+#include -+ -+/* These appear in gcc 5.1 and clang 3.8. */ -+#if GNUC_PREREQ(5, 1) || CLANG_PREREQ(3, 8) -+ -+#define grub_add(a, b, res) __builtin_add_overflow(a, b, res) -+#define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res) -+#define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res) -+ -+#else -+#error gcc 5.1 or newer or clang 3.8 or newer is required -+#endif -+ -+#endif /* GRUB_SAFEMATH_H */ -diff --git a/INSTALL b/INSTALL -index 8acb4090235..dcb9b7d7b7a 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -11,27 +11,9 @@ GRUB depends on some software packages installed into your system. If - you don't have any of them, please obtain and install them before - configuring the GRUB. - --* GCC 4.1.3 or later -- Note: older versions may work but support is limited -- -- Experimental support for clang 3.3 or later (results in much bigger binaries) -+* GCC 5.1.0 or later -+ Experimental support for clang 3.8.0 or later (results in much bigger binaries) - for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64 -- Note: clang 3.2 or later works for i386 and x86_64 targets but results in -- much bigger binaries. -- earlier versions not tested -- Note: clang 3.2 or later works for arm -- earlier versions not tested -- Note: clang on arm64 is not supported due to -- https://llvm.org/bugs/show_bug.cgi?id=26030 -- Note: clang 3.3 or later works for mips(el) -- earlier versions fail to generate .reginfo and hence gprel relocations -- fail. -- Note: clang 3.2 or later works for powerpc -- earlier versions not tested -- Note: clang 3.5 or later works for sparc64 -- earlier versions return "error: unable to interface with target machine" -- Note: clang has no support for ia64 and hence you can't compile GRUB -- for ia64 with clang - * GNU Make - * GNU Bison 2.3 or later - * GNU gettext 0.17 or later diff --git a/0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch b/0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch deleted file mode 100644 index b44695b9..00000000 --- a/0227-calloc-Make-sure-we-always-have-an-overflow-checking.patch +++ /dev/null @@ -1,240 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 15 Jun 2020 12:15:29 -0400 -Subject: [PATCH] calloc: Make sure we always have an overflow-checking - calloc() available - -This tries to make sure that everywhere in this source tree, we always have -an appropriate version of calloc() (i.e. grub_calloc(), xcalloc(), etc.) -available, and that they all safely check for overflow and return NULL when -it would occur. - -Signed-off-by: Peter Jones -Reviewed-by: Daniel Kiper -Upstream-commit-id: 79e51ab7a9a ---- - grub-core/kern/emu/misc.c | 12 ++++++++++++ - grub-core/kern/emu/mm.c | 10 ++++++++++ - grub-core/kern/mm.c | 40 ++++++++++++++++++++++++++++++++++++++ - grub-core/lib/libgcrypt_wrap/mem.c | 11 +++++++++-- - grub-core/lib/posix_wrap/stdlib.h | 8 +++++++- - include/grub/emu/misc.h | 1 + - include/grub/mm.h | 6 ++++++ - 7 files changed, 85 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 7a8d9e62300..f08a1bb8415 100644 ---- a/grub-core/kern/emu/misc.c -+++ b/grub-core/kern/emu/misc.c -@@ -86,6 +86,18 @@ grub_util_error (const char *fmt, ...) - grub_exit (1); - } - -+void * -+xcalloc (grub_size_t nmemb, grub_size_t size) -+{ -+ void *p; -+ -+ p = calloc (nmemb, size); -+ if (!p) -+ grub_util_error ("%s", _("out of memory")); -+ -+ return p; -+} -+ - void * - xmalloc (grub_size_t size) - { -diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c -index f262e95e388..145b01d3719 100644 ---- a/grub-core/kern/emu/mm.c -+++ b/grub-core/kern/emu/mm.c -@@ -25,6 +25,16 @@ - #include - #include - -+void * -+grub_calloc (grub_size_t nmemb, grub_size_t size) -+{ -+ void *ret; -+ ret = calloc (nmemb, size); -+ if (!ret) -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -+ return ret; -+} -+ - void * - grub_malloc (grub_size_t size) - { -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index 002cbfa4f3d..80d0720d005 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -67,8 +67,10 @@ - #include - #include - #include -+#include - - #ifdef MM_DEBUG -+# undef grub_calloc - # undef grub_malloc - # undef grub_zalloc - # undef grub_realloc -@@ -375,6 +377,30 @@ grub_memalign (grub_size_t align, grub_size_t size) - return 0; - } - -+/* -+ * Allocate NMEMB instances of SIZE bytes and return the pointer, or error on -+ * integer overflow. -+ */ -+void * -+grub_calloc (grub_size_t nmemb, grub_size_t size) -+{ -+ void *ret; -+ grub_size_t sz = 0; -+ -+ if (grub_mul (nmemb, size, &sz)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ return NULL; -+ } -+ -+ ret = grub_memalign (0, sz); -+ if (!ret) -+ return NULL; -+ -+ grub_memset (ret, 0, sz); -+ return ret; -+} -+ - /* Allocate SIZE bytes and return the pointer. */ - void * - grub_malloc (grub_size_t size) -@@ -561,6 +587,20 @@ grub_mm_dump (unsigned lineno) - grub_printf ("\n"); - } - -+void * -+grub_debug_calloc (const char *file, int line, grub_size_t nmemb, grub_size_t size) -+{ -+ void *ptr; -+ -+ if (grub_mm_debug) -+ grub_printf ("%s:%d: calloc (0x%" PRIxGRUB_SIZE ", 0x%" PRIxGRUB_SIZE ") = ", -+ file, line, size); -+ ptr = grub_calloc (nmemb, size); -+ if (grub_mm_debug) -+ grub_printf ("%p\n", ptr); -+ return ptr; -+} -+ - void * - grub_debug_malloc (const char *file, int line, grub_size_t size) - { -diff --git a/grub-core/lib/libgcrypt_wrap/mem.c b/grub-core/lib/libgcrypt_wrap/mem.c -index beeb661a3c8..74c6eafe525 100644 ---- a/grub-core/lib/libgcrypt_wrap/mem.c -+++ b/grub-core/lib/libgcrypt_wrap/mem.c -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -36,7 +37,10 @@ void * - gcry_xcalloc (size_t n, size_t m) - { - void *ret; -- ret = grub_zalloc (n * m); -+ size_t sz; -+ if (grub_mul (n, m, &sz)) -+ grub_fatal ("gcry_xcalloc would overflow"); -+ ret = grub_zalloc (sz); - if (!ret) - grub_fatal ("gcry_xcalloc failed"); - return ret; -@@ -56,7 +60,10 @@ void * - gcry_xcalloc_secure (size_t n, size_t m) - { - void *ret; -- ret = grub_zalloc (n * m); -+ size_t sz; -+ if (grub_mul (n, m, &sz)) -+ grub_fatal ("gcry_xcalloc would overflow"); -+ ret = grub_zalloc (sz); - if (!ret) - grub_fatal ("gcry_xcalloc failed"); - return ret; -diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h -index 3b46f47ff50..7a8d385e973 100644 ---- a/grub-core/lib/posix_wrap/stdlib.h -+++ b/grub-core/lib/posix_wrap/stdlib.h -@@ -21,6 +21,7 @@ - - #include - #include -+#include - - static inline void - free (void *ptr) -@@ -37,7 +38,12 @@ malloc (grub_size_t size) - static inline void * - calloc (grub_size_t size, grub_size_t nelem) - { -- return grub_zalloc (size * nelem); -+ grub_size_t sz; -+ -+ if (grub_mul (size, nelem, &sz)) -+ return NULL; -+ -+ return grub_zalloc (sz); - } - - static inline void * -diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index 5ef4f79e689..01056954b96 100644 ---- a/include/grub/emu/misc.h -+++ b/include/grub/emu/misc.h -@@ -47,6 +47,7 @@ grub_util_device_is_mapped (const char *dev); - #define GRUB_HOST_PRIuLONG_LONG "llu" - #define GRUB_HOST_PRIxLONG_LONG "llx" - -+void * EXPORT_FUNC(xcalloc) (grub_size_t nmemb, grub_size_t size) WARN_UNUSED_RESULT; - void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT; - void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT; - char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT; -diff --git a/include/grub/mm.h b/include/grub/mm.h -index 28e2e53eb32..9c38dd3ca5d 100644 ---- a/include/grub/mm.h -+++ b/include/grub/mm.h -@@ -29,6 +29,7 @@ - #endif - - void grub_mm_init_region (void *addr, grub_size_t size); -+void *EXPORT_FUNC(grub_calloc) (grub_size_t nmemb, grub_size_t size); - void *EXPORT_FUNC(grub_malloc) (grub_size_t size); - void *EXPORT_FUNC(grub_zalloc) (grub_size_t size); - void EXPORT_FUNC(grub_free) (void *ptr); -@@ -48,6 +49,9 @@ extern int EXPORT_VAR(grub_mm_debug); - void grub_mm_dump_free (void); - void grub_mm_dump (unsigned lineno); - -+#define grub_calloc(nmemb, size) \ -+ grub_debug_calloc (GRUB_FILE, __LINE__, nmemb, size) -+ - #define grub_malloc(size) \ - grub_debug_malloc (GRUB_FILE, __LINE__, size) - -@@ -63,6 +67,8 @@ void grub_mm_dump (unsigned lineno); - #define grub_free(ptr) \ - grub_debug_free (GRUB_FILE, __LINE__, ptr) - -+void *EXPORT_FUNC(grub_debug_calloc) (const char *file, int line, -+ grub_size_t nmemb, grub_size_t size); - void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line, - grub_size_t size); - void *EXPORT_FUNC(grub_debug_zalloc) (const char *file, int line, diff --git a/0228-calloc-Use-calloc-at-most-places.patch b/0228-calloc-Use-calloc-at-most-places.patch deleted file mode 100644 index 6d429300..00000000 --- a/0228-calloc-Use-calloc-at-most-places.patch +++ /dev/null @@ -1,1834 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 15 Jun 2020 12:26:01 -0400 -Subject: [PATCH] calloc: Use calloc() at most places - -This modifies most of the places we do some form of: - - X = malloc(Y * Z); - -to use calloc(Y, Z) instead. - -Among other issues, this fixes: - - allocation of integer overflow in grub_png_decode_image_header() - reported by Chris Coulson, - - allocation of integer overflow in luks_recover_key() - reported by Chris Coulson, - - allocation of integer overflow in grub_lvm_detect() - reported by Chris Coulson. - -Fixes: CVE-2020-14308 - -Signed-off-by: Peter Jones -Reviewed-by: Daniel Kiper -Upstream-commit-id: 48eeedf1e4b ---- - grub-core/bus/usb/usbhub.c | 8 ++++---- - grub-core/commands/efi/lsefisystab.c | 3 ++- - grub-core/commands/legacycfg.c | 6 +++--- - grub-core/commands/menuentry.c | 2 +- - grub-core/commands/nativedisk.c | 2 +- - grub-core/commands/parttool.c | 12 +++++++++--- - grub-core/commands/regexp.c | 2 +- - grub-core/commands/search_wrap.c | 2 +- - grub-core/disk/diskfilter.c | 4 ++-- - grub-core/disk/ieee1275/ofdisk.c | 2 +- - grub-core/disk/ldm.c | 14 +++++++------- - grub-core/disk/luks.c | 2 +- - grub-core/disk/lvm.c | 8 ++++---- - grub-core/disk/xen/xendisk.c | 2 +- - grub-core/efiemu/loadcore.c | 2 +- - grub-core/efiemu/mm.c | 6 +++--- - grub-core/font/font.c | 3 +-- - grub-core/fs/affs.c | 6 +++--- - grub-core/fs/btrfs.c | 6 +++--- - grub-core/fs/hfs.c | 2 +- - grub-core/fs/hfsplus.c | 6 +++--- - grub-core/fs/iso9660.c | 2 +- - grub-core/fs/ntfs.c | 4 ++-- - grub-core/fs/sfs.c | 2 +- - grub-core/fs/tar.c | 2 +- - grub-core/fs/udf.c | 4 ++-- - grub-core/fs/zfs/zfs.c | 4 ++-- - grub-core/gfxmenu/gui_string_util.c | 2 +- - grub-core/gfxmenu/widget-box.c | 4 ++-- - grub-core/io/gzio.c | 2 +- - grub-core/kern/efi/efi.c | 6 +++--- - grub-core/kern/emu/hostdisk.c | 2 +- - grub-core/kern/fs.c | 2 +- - grub-core/kern/misc.c | 2 +- - grub-core/kern/parser.c | 2 +- - grub-core/kern/uboot/uboot.c | 2 +- - grub-core/lib/libgcrypt/cipher/ac.c | 8 ++++---- - grub-core/lib/libgcrypt/cipher/primegen.c | 4 ++-- - grub-core/lib/libgcrypt/cipher/pubkey.c | 4 ++-- - grub-core/lib/priority_queue.c | 2 +- - grub-core/lib/reed_solomon.c | 7 +++---- - grub-core/lib/relocator.c | 10 +++++----- - grub-core/lib/zstd/fse_decompress.c | 2 +- - grub-core/loader/arm/linux.c | 2 +- - grub-core/loader/efi/chainloader.c | 2 +- - grub-core/loader/i386/bsdXX.c | 2 +- - grub-core/loader/i386/xnu.c | 4 ++-- - grub-core/loader/macho.c | 2 +- - grub-core/loader/multiboot_elfxx.c | 2 +- - grub-core/loader/xnu.c | 2 +- - grub-core/mmap/mmap.c | 4 ++-- - grub-core/net/bootp.c | 2 +- - grub-core/net/dns.c | 10 +++++----- - grub-core/net/net.c | 4 ++-- - grub-core/normal/charset.c | 10 +++++----- - grub-core/normal/cmdline.c | 14 +++++++------- - grub-core/normal/menu_entry.c | 14 +++++++------- - grub-core/normal/menu_text.c | 4 ++-- - grub-core/normal/term.c | 4 ++-- - grub-core/osdep/linux/getroot.c | 6 +++--- - grub-core/osdep/unix/config.c | 2 +- - grub-core/osdep/windows/getroot.c | 2 +- - grub-core/osdep/windows/hostdisk.c | 4 ++-- - grub-core/osdep/windows/init.c | 2 +- - grub-core/osdep/windows/platform.c | 4 ++-- - grub-core/osdep/windows/relpath.c | 2 +- - grub-core/partmap/gpt.c | 2 +- - grub-core/partmap/msdos.c | 2 +- - grub-core/script/execute.c | 2 +- - grub-core/tests/fake_input.c | 2 +- - grub-core/tests/video_checksum.c | 6 +++--- - grub-core/video/capture.c | 2 +- - grub-core/video/emu/sdl.c | 2 +- - grub-core/video/i386/pc/vga.c | 2 +- - grub-core/video/readers/png.c | 2 +- - util/getroot.c | 2 +- - util/grub-file.c | 2 +- - util/grub-fstest.c | 4 ++-- - util/grub-install-common.c | 2 +- - util/grub-install.c | 4 ++-- - util/grub-mkimagexx.c | 6 ++---- - util/grub-mkrescue.c | 4 ++-- - util/grub-mkstandalone.c | 2 +- - util/grub-pe2elf.c | 12 +++++------- - util/grub-probe.c | 4 ++-- - include/grub/unicode.h | 4 ++-- - 86 files changed, 176 insertions(+), 175 deletions(-) - -diff --git a/grub-core/bus/usb/usbhub.c b/grub-core/bus/usb/usbhub.c -index 34a7ff1b5f8..a06cce302d2 100644 ---- a/grub-core/bus/usb/usbhub.c -+++ b/grub-core/bus/usb/usbhub.c -@@ -149,8 +149,8 @@ grub_usb_add_hub (grub_usb_device_t dev) - grub_usb_set_configuration (dev, 1); - - dev->nports = hubdesc.portcnt; -- dev->children = grub_zalloc (hubdesc.portcnt * sizeof (dev->children[0])); -- dev->ports = grub_zalloc (dev->nports * sizeof (dev->ports[0])); -+ dev->children = grub_calloc (hubdesc.portcnt, sizeof (dev->children[0])); -+ dev->ports = grub_calloc (dev->nports, sizeof (dev->ports[0])); - if (!dev->children || !dev->ports) - { - grub_free (dev->children); -@@ -268,8 +268,8 @@ grub_usb_controller_dev_register_iter (grub_usb_controller_t controller, void *d - - /* Query the number of ports the root Hub has. */ - hub->nports = controller->dev->hubports (controller); -- hub->devices = grub_zalloc (sizeof (hub->devices[0]) * hub->nports); -- hub->ports = grub_zalloc (sizeof (hub->ports[0]) * hub->nports); -+ hub->devices = grub_calloc (hub->nports, sizeof (hub->devices[0])); -+ hub->ports = grub_calloc (hub->nports, sizeof (hub->ports[0])); - if (!hub->devices || !hub->ports) - { - grub_free (hub->devices); -diff --git a/grub-core/commands/efi/lsefisystab.c b/grub-core/commands/efi/lsefisystab.c -index df103022188..cd81507f5d4 100644 ---- a/grub-core/commands/efi/lsefisystab.c -+++ b/grub-core/commands/efi/lsefisystab.c -@@ -71,7 +71,8 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)), - grub_printf ("Vendor: "); - - for (vendor_utf16 = st->firmware_vendor; *vendor_utf16; vendor_utf16++); -- vendor = grub_malloc (4 * (vendor_utf16 - st->firmware_vendor) + 1); -+ /* Allocate extra 3 bytes to simplify math. */ -+ vendor = grub_calloc (4, vendor_utf16 - st->firmware_vendor + 1); - if (!vendor) - return grub_errno; - *grub_utf16_to_utf8 ((grub_uint8_t *) vendor, st->firmware_vendor, -diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index 891eac5a33f..da5143d4360 100644 ---- a/grub-core/commands/legacycfg.c -+++ b/grub-core/commands/legacycfg.c -@@ -315,7 +315,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), - if (argc < 2) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); - -- cutargs = grub_malloc (sizeof (cutargs[0]) * (argc - 1)); -+ cutargs = grub_calloc (argc - 1, sizeof (cutargs[0])); - if (!cutargs) - return grub_errno; - cutargc = argc - 1; -@@ -437,7 +437,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), - { - char rbuf[3] = "-r"; - bsdargc = cutargc + 2; -- bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc); -+ bsdargs = grub_calloc (bsdargc, sizeof (bsdargs[0])); - if (!bsdargs) - { - err = grub_errno; -@@ -560,7 +560,7 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("can't find command `%s'"), - "module"); - -- newargs = grub_malloc ((argc + 1) * sizeof (newargs[0])); -+ newargs = grub_calloc (argc + 1, sizeof (newargs[0])); - if (!newargs) - return grub_errno; - grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0])); -diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index 29736f5cd03..84edfc06b7f 100644 ---- a/grub-core/commands/menuentry.c -+++ b/grub-core/commands/menuentry.c -@@ -157,7 +157,7 @@ grub_normal_add_menu_entry (int argc, const char **args, - grub_dprintf ("menu", "menu_id:\"%s\"\n", menu_id); - - /* Save argc, args to pass as parameters to block arg later. */ -- menu_args = grub_malloc (sizeof (char*) * (argc + 1)); -+ menu_args = grub_calloc (argc + 1, sizeof (char *)); - if (! menu_args) - goto fail; - -diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c -index 699447d11ec..7c8f97f6ad5 100644 ---- a/grub-core/commands/nativedisk.c -+++ b/grub-core/commands/nativedisk.c -@@ -195,7 +195,7 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)), - else - path_prefix = prefix; - -- mods = grub_malloc (argc * sizeof (mods[0])); -+ mods = grub_calloc (argc, sizeof (mods[0])); - if (!mods) - return grub_errno; - -diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c -index 22b46b18741..051e31320e9 100644 ---- a/grub-core/commands/parttool.c -+++ b/grub-core/commands/parttool.c -@@ -59,7 +59,13 @@ grub_parttool_register(const char *part_name, - for (nargs = 0; args[nargs].name != 0; nargs++); - cur->nargs = nargs; - cur->args = (struct grub_parttool_argdesc *) -- grub_malloc ((nargs + 1) * sizeof (struct grub_parttool_argdesc)); -+ grub_calloc (nargs + 1, sizeof (struct grub_parttool_argdesc)); -+ if (!cur->args) -+ { -+ grub_free (cur); -+ curhandle--; -+ return -1; -+ } - grub_memcpy (cur->args, args, - (nargs + 1) * sizeof (struct grub_parttool_argdesc)); - -@@ -257,7 +263,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), - return err; - } - -- parsed = (int *) grub_zalloc (argc * sizeof (int)); -+ parsed = (int *) grub_calloc (argc, sizeof (int)); - - for (i = 1; i < argc; i++) - if (! parsed[i]) -@@ -290,7 +296,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), - } - ptool = cur; - pargs = (struct grub_parttool_args *) -- grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args)); -+ grub_calloc (ptool->nargs, sizeof (struct grub_parttool_args)); - for (j = i; j < argc; j++) - if (! parsed[j]) - { -diff --git a/grub-core/commands/regexp.c b/grub-core/commands/regexp.c -index 7c5c72fe460..612003f94c8 100644 ---- a/grub-core/commands/regexp.c -+++ b/grub-core/commands/regexp.c -@@ -116,7 +116,7 @@ grub_cmd_regexp (grub_extcmd_context_t ctxt, int argc, char **args) - if (ret) - goto fail; - -- matches = grub_zalloc (sizeof (*matches) * (regex.re_nsub + 1)); -+ matches = grub_calloc (regex.re_nsub + 1, sizeof (*matches)); - if (! matches) - goto fail; - -diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c -index d7fd26b9405..47fc8eb9966 100644 ---- a/grub-core/commands/search_wrap.c -+++ b/grub-core/commands/search_wrap.c -@@ -122,7 +122,7 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) - for (i = 0; state[SEARCH_HINT_BAREMETAL].args[i]; i++) - nhints++; - -- hints = grub_malloc (sizeof (hints[0]) * nhints); -+ hints = grub_calloc (nhints, sizeof (hints[0])); - if (!hints) - return grub_errno; - j = 0; -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 3f264be77d1..88784dc440b 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -1137,7 +1137,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, - array->lvs->segments->node_count = nmemb; - array->lvs->segments->raid_member_size = disk_size; - array->lvs->segments->nodes -- = grub_zalloc (nmemb * sizeof (array->lvs->segments->nodes[0])); -+ = grub_calloc (nmemb, sizeof (array->lvs->segments->nodes[0])); - array->lvs->segments->stripe_size = stripe_size; - for (i = 0; i < nmemb; i++) - { -@@ -1230,7 +1230,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id, - grub_partition_t p; - for (p = disk->partition; p; p = p->parent) - s++; -- pv->partmaps = xmalloc (s * sizeof (pv->partmaps[0])); -+ pv->partmaps = xcalloc (s, sizeof (pv->partmaps[0])); - s = 0; - for (p = disk->partition; p; p = p->parent) - pv->partmaps[s++] = xstrdup (p->partmap->name); -diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index f73257e66dc..03674cb477e 100644 ---- a/grub-core/disk/ieee1275/ofdisk.c -+++ b/grub-core/disk/ieee1275/ofdisk.c -@@ -297,7 +297,7 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) - /* Power machines documentation specify 672 as maximum SAS disks in - one system. Using a slightly larger value to be safe. */ - table_size = 768; -- table = grub_malloc (table_size * sizeof (grub_uint64_t)); -+ table = grub_calloc (table_size, sizeof (grub_uint64_t)); - - if (!table) - { -diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c -index 2a22d2d6c1c..e6323701ab3 100644 ---- a/grub-core/disk/ldm.c -+++ b/grub-core/disk/ldm.c -@@ -323,8 +323,8 @@ make_vg (grub_disk_t disk, - lv->segments->type = GRUB_DISKFILTER_MIRROR; - lv->segments->node_count = 0; - lv->segments->node_alloc = 8; -- lv->segments->nodes = grub_zalloc (sizeof (*lv->segments->nodes) -- * lv->segments->node_alloc); -+ lv->segments->nodes = grub_calloc (lv->segments->node_alloc, -+ sizeof (*lv->segments->nodes)); - if (!lv->segments->nodes) - goto fail2; - ptr = vblk[i].dynamic; -@@ -543,8 +543,8 @@ make_vg (grub_disk_t disk, - { - comp->segment_alloc = 8; - comp->segment_count = 0; -- comp->segments = grub_malloc (sizeof (*comp->segments) -- * comp->segment_alloc); -+ comp->segments = grub_calloc (comp->segment_alloc, -+ sizeof (*comp->segments)); - if (!comp->segments) - goto fail2; - } -@@ -590,8 +590,8 @@ make_vg (grub_disk_t disk, - } - comp->segments->node_count = read_int (ptr + 1, *ptr); - comp->segments->node_alloc = comp->segments->node_count; -- comp->segments->nodes = grub_zalloc (sizeof (*comp->segments->nodes) -- * comp->segments->node_alloc); -+ comp->segments->nodes = grub_calloc (comp->segments->node_alloc, -+ sizeof (*comp->segments->nodes)); - if (!lv->segments->nodes) - goto fail2; - } -@@ -1017,7 +1017,7 @@ grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors, - *nsectors = lv->size; - if (*nsectors > max_nsectors) - *nsectors = max_nsectors; -- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); -+ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); - if (!*sectors) - return grub_errno; - for (i = 0; i < *nsectors; i++) -diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c -index 86c50c61217..18b3a8bb1d3 100644 ---- a/grub-core/disk/luks.c -+++ b/grub-core/disk/luks.c -@@ -336,7 +336,7 @@ luks_recover_key (grub_disk_t source, - && grub_be_to_cpu32 (header.keyblock[i].stripes) > max_stripes) - max_stripes = grub_be_to_cpu32 (header.keyblock[i].stripes); - -- split_key = grub_malloc (keysize * max_stripes); -+ split_key = grub_calloc (keysize, max_stripes); - if (!split_key) - return grub_errno; - -diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c -index 0cbd0dd1629..8e76d1ae121 100644 ---- a/grub-core/disk/lvm.c -+++ b/grub-core/disk/lvm.c -@@ -174,7 +174,7 @@ grub_lvm_detect (grub_disk_t disk, - first one. */ - - /* Allocate buffer space for the circular worst-case scenario. */ -- metadatabuf = grub_malloc (2 * mda_size); -+ metadatabuf = grub_calloc (2, mda_size); - if (! metadatabuf) - goto fail; - -@@ -427,7 +427,7 @@ grub_lvm_detect (grub_disk_t disk, - #endif - goto lvs_fail; - } -- lv->segments = grub_zalloc (sizeof (*seg) * lv->segment_count); -+ lv->segments = grub_calloc (lv->segment_count, sizeof (*seg)); - seg = lv->segments; - - for (i = 0; i < lv->segment_count; i++) -@@ -484,8 +484,8 @@ grub_lvm_detect (grub_disk_t disk, - if (seg->node_count != 1) - seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = "); - -- seg->nodes = grub_zalloc (sizeof (*stripe) -- * seg->node_count); -+ seg->nodes = grub_calloc (seg->node_count, -+ sizeof (*stripe)); - stripe = seg->nodes; - - p = grub_strstr (p, "stripes = ["); -diff --git a/grub-core/disk/xen/xendisk.c b/grub-core/disk/xen/xendisk.c -index 48476cbbf96..d6612eebd75 100644 ---- a/grub-core/disk/xen/xendisk.c -+++ b/grub-core/disk/xen/xendisk.c -@@ -426,7 +426,7 @@ grub_xendisk_init (void) - if (!ctr) - return; - -- virtdisks = grub_malloc (ctr * sizeof (virtdisks[0])); -+ virtdisks = grub_calloc (ctr, sizeof (virtdisks[0])); - if (!virtdisks) - return; - if (grub_xenstore_dir ("device/vbd", fill, &ctr)) -diff --git a/grub-core/efiemu/loadcore.c b/grub-core/efiemu/loadcore.c -index 44085ef818e..2b924623f51 100644 ---- a/grub-core/efiemu/loadcore.c -+++ b/grub-core/efiemu/loadcore.c -@@ -201,7 +201,7 @@ grub_efiemu_count_symbols (const Elf_Ehdr *e) - - grub_efiemu_nelfsyms = (unsigned) s->sh_size / (unsigned) s->sh_entsize; - grub_efiemu_elfsyms = (struct grub_efiemu_elf_sym *) -- grub_malloc (sizeof (struct grub_efiemu_elf_sym) * grub_efiemu_nelfsyms); -+ grub_calloc (grub_efiemu_nelfsyms, sizeof (struct grub_efiemu_elf_sym)); - - /* Relocators */ - for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); -diff --git a/grub-core/efiemu/mm.c b/grub-core/efiemu/mm.c -index 52a032f7b2e..9b8e0d0ad1a 100644 ---- a/grub-core/efiemu/mm.c -+++ b/grub-core/efiemu/mm.c -@@ -554,11 +554,11 @@ grub_efiemu_mmap_sort_and_uniq (void) - /* Initialize variables*/ - grub_memset (present, 0, sizeof (int) * GRUB_EFI_MAX_MEMORY_TYPE); - scanline_events = (struct grub_efiemu_mmap_scan *) -- grub_malloc (sizeof (struct grub_efiemu_mmap_scan) * 2 * mmap_num); -+ grub_calloc (mmap_num, sizeof (struct grub_efiemu_mmap_scan) * 2); - - /* Number of chunks can't increase more than by factor of 2 */ - result = (grub_efi_memory_descriptor_t *) -- grub_malloc (sizeof (grub_efi_memory_descriptor_t) * 2 * mmap_num); -+ grub_calloc (mmap_num, sizeof (grub_efi_memory_descriptor_t) * 2); - if (!result || !scanline_events) - { - grub_free (result); -@@ -660,7 +660,7 @@ grub_efiemu_mm_do_alloc (void) - - /* Preallocate mmap */ - efiemu_mmap = (grub_efi_memory_descriptor_t *) -- grub_malloc (mmap_reserved_size * sizeof (grub_efi_memory_descriptor_t)); -+ grub_calloc (mmap_reserved_size, sizeof (grub_efi_memory_descriptor_t)); - if (!efiemu_mmap) - { - grub_efiemu_unload (); -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 85a292557ac..8e118b315ce 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -293,8 +293,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct - font->num_chars = sect_length / FONT_CHAR_INDEX_ENTRY_SIZE; - - /* Allocate the character index array. */ -- font->char_index = grub_malloc (font->num_chars -- * sizeof (struct char_index_entry)); -+ font->char_index = grub_calloc (font->num_chars, sizeof (struct char_index_entry)); - if (!font->char_index) - return 1; - font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t)); -diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c -index 6b6a2bc9135..220b3712f2a 100644 ---- a/grub-core/fs/affs.c -+++ b/grub-core/fs/affs.c -@@ -301,7 +301,7 @@ grub_affs_read_symlink (grub_fshelp_node_t node) - return 0; - } - latin1[symlink_size] = 0; -- utf8 = grub_malloc (symlink_size * GRUB_MAX_UTF8_PER_LATIN1 + 1); -+ utf8 = grub_calloc (GRUB_MAX_UTF8_PER_LATIN1 + 1, symlink_size); - if (!utf8) - { - grub_free (latin1); -@@ -422,7 +422,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir, - return 1; - } - -- hashtable = grub_zalloc (data->htsize * sizeof (*hashtable)); -+ hashtable = grub_calloc (data->htsize, sizeof (*hashtable)); - if (!hashtable) - return 1; - -@@ -628,7 +628,7 @@ grub_affs_label (grub_device_t device, char **label) - len = file.namelen; - if (len > sizeof (file.name)) - len = sizeof (file.name); -- *label = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1); -+ *label = grub_calloc (GRUB_MAX_UTF8_PER_LATIN1 + 1, len); - if (*label) - *grub_latin1_to_utf8 ((grub_uint8_t *) *label, file.name, len) = '\0'; - } -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 9cd7f4bdf65..ba080fdc580 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -442,7 +442,7 @@ lower_bound (struct grub_btrfs_data *data, - { - desc->allocated = 16; - desc->depth = 0; -- desc->data = grub_malloc (sizeof (desc->data[0]) * desc->allocated); -+ desc->data = grub_calloc (desc->allocated, sizeof (desc->data[0])); - if (!desc->data) - return grub_errno; - } -@@ -781,7 +781,7 @@ raid56_read_retry (struct grub_btrfs_data *data, - grub_err_t ret = GRUB_ERR_OUT_OF_MEMORY; - grub_uint64_t i, failed_devices; - -- buffers = grub_zalloc (sizeof(*buffers) * nstripes); -+ buffers = grub_calloc (nstripes, sizeof (*buffers)); - if (!buffers) - goto cleanup; - -@@ -2477,7 +2477,7 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), - *nsectors = 64 * 2 - 1; - if (*nsectors > max_nsectors) - *nsectors = max_nsectors; -- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); -+ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); - if (!*sectors) - return grub_errno; - for (i = 0; i < *nsectors; i++) -diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c -index ac0a40990e0..3fe842b4d8b 100644 ---- a/grub-core/fs/hfs.c -+++ b/grub-core/fs/hfs.c -@@ -1360,7 +1360,7 @@ grub_hfs_label (grub_device_t device, char **label) - grub_size_t len = data->sblock.volname[0]; - if (len > sizeof (data->sblock.volname) - 1) - len = sizeof (data->sblock.volname) - 1; -- *label = grub_malloc (len * MAX_UTF8_PER_MAC_ROMAN + 1); -+ *label = grub_calloc (MAX_UTF8_PER_MAC_ROMAN + 1, len); - if (*label) - macroman_to_utf8 (*label, data->sblock.volname + 1, - len + 1, 0); -diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c -index 54786bb1c6d..dae43becc97 100644 ---- a/grub-core/fs/hfsplus.c -+++ b/grub-core/fs/hfsplus.c -@@ -720,7 +720,7 @@ list_nodes (void *record, void *hook_arg) - if (! filename) - return 0; - -- keyname = grub_malloc (grub_be_to_cpu16 (catkey->namelen) * sizeof (*keyname)); -+ keyname = grub_calloc (grub_be_to_cpu16 (catkey->namelen), sizeof (*keyname)); - if (!keyname) - { - grub_free (filename); -@@ -1007,7 +1007,7 @@ grub_hfsplus_label (grub_device_t device, char **label) - grub_hfsplus_btree_recptr (&data->catalog_tree, node, ptr); - - label_len = grub_be_to_cpu16 (catkey->namelen); -- label_name = grub_malloc (label_len * sizeof (*label_name)); -+ label_name = grub_calloc (label_len, sizeof (*label_name)); - if (!label_name) - { - grub_free (node); -@@ -1029,7 +1029,7 @@ grub_hfsplus_label (grub_device_t device, char **label) - } - } - -- *label = grub_malloc (label_len * GRUB_MAX_UTF8_PER_UTF16 + 1); -+ *label = grub_calloc (label_len, GRUB_MAX_UTF8_PER_UTF16 + 1); - if (! *label) - { - grub_free (label_name); -diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c -index 49c0c632bf3..4f1b52a552a 100644 ---- a/grub-core/fs/iso9660.c -+++ b/grub-core/fs/iso9660.c -@@ -331,7 +331,7 @@ grub_iso9660_convert_string (grub_uint8_t *us, int len) - int i; - grub_uint16_t t[MAX_NAMELEN / 2 + 1]; - -- p = grub_malloc (len * GRUB_MAX_UTF8_PER_UTF16 + 1); -+ p = grub_calloc (len, GRUB_MAX_UTF8_PER_UTF16 + 1); - if (! p) - return NULL; - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index fc4e1f678d6..2f34f76da88 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -556,8 +556,8 @@ get_utf8 (grub_uint8_t *in, grub_size_t len) - grub_uint16_t *tmp; - grub_size_t i; - -- buf = grub_malloc (len * GRUB_MAX_UTF8_PER_UTF16 + 1); -- tmp = grub_malloc (len * sizeof (tmp[0])); -+ buf = grub_calloc (len, GRUB_MAX_UTF8_PER_UTF16 + 1); -+ tmp = grub_calloc (len, sizeof (tmp[0])); - if (!buf || !tmp) - { - grub_free (buf); -diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c -index 50c1fe72f44..90f7fb37918 100644 ---- a/grub-core/fs/sfs.c -+++ b/grub-core/fs/sfs.c -@@ -266,7 +266,7 @@ grub_sfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - node->next_extent = node->block; - node->cache_size = 0; - -- node->cache = grub_malloc (sizeof (node->cache[0]) * cache_size); -+ node->cache = grub_calloc (cache_size, sizeof (node->cache[0])); - if (!node->cache) - { - grub_errno = 0; -diff --git a/grub-core/fs/tar.c b/grub-core/fs/tar.c -index 7d63e0c99c7..c551ed6b520 100644 ---- a/grub-core/fs/tar.c -+++ b/grub-core/fs/tar.c -@@ -120,7 +120,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, - if (data->linkname_alloc < linksize + 1) - { - char *n; -- n = grub_malloc (2 * (linksize + 1)); -+ n = grub_calloc (2, linksize + 1); - if (!n) - return grub_errno; - grub_free (data->linkname); -diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c -index dc8b6e2d1c9..a83761674ad 100644 ---- a/grub-core/fs/udf.c -+++ b/grub-core/fs/udf.c -@@ -873,7 +873,7 @@ read_string (const grub_uint8_t *raw, grub_size_t sz, char *outbuf) - { - unsigned i; - utf16len = sz - 1; -- utf16 = grub_malloc (utf16len * sizeof (utf16[0])); -+ utf16 = grub_calloc (utf16len, sizeof (utf16[0])); - if (!utf16) - return NULL; - for (i = 0; i < utf16len; i++) -@@ -883,7 +883,7 @@ read_string (const grub_uint8_t *raw, grub_size_t sz, char *outbuf) - { - unsigned i; - utf16len = (sz - 1) / 2; -- utf16 = grub_malloc (utf16len * sizeof (utf16[0])); -+ utf16 = grub_calloc (utf16len, sizeof (utf16[0])); - if (!utf16) - return NULL; - for (i = 0; i < utf16len; i++) -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index 2f72e42bf80..381dde556d1 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -3325,7 +3325,7 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, - } - subvol->nkeys = 0; - zap_iterate (&keychain_dn, 8, count_zap_keys, &ctx, data); -- subvol->keyring = grub_zalloc (subvol->nkeys * sizeof (subvol->keyring[0])); -+ subvol->keyring = grub_calloc (subvol->nkeys, sizeof (subvol->keyring[0])); - if (!subvol->keyring) - { - grub_free (fsname); -@@ -4336,7 +4336,7 @@ grub_zfs_embed (grub_device_t device __attribute__ ((unused)), - *nsectors = (VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS); - if (*nsectors > max_nsectors) - *nsectors = max_nsectors; -- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); -+ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); - if (!*sectors) - return grub_errno; - for (i = 0; i < *nsectors; i++) -diff --git a/grub-core/gfxmenu/gui_string_util.c b/grub-core/gfxmenu/gui_string_util.c -index a9a415e3129..ba1e1eab319 100644 ---- a/grub-core/gfxmenu/gui_string_util.c -+++ b/grub-core/gfxmenu/gui_string_util.c -@@ -55,7 +55,7 @@ canonicalize_path (const char *path) - if (*p == '/') - components++; - -- char **path_array = grub_malloc (components * sizeof (*path_array)); -+ char **path_array = grub_calloc (components, sizeof (*path_array)); - if (! path_array) - return 0; - -diff --git a/grub-core/gfxmenu/widget-box.c b/grub-core/gfxmenu/widget-box.c -index b6060288914..470597ded2b 100644 ---- a/grub-core/gfxmenu/widget-box.c -+++ b/grub-core/gfxmenu/widget-box.c -@@ -303,10 +303,10 @@ grub_gfxmenu_create_box (const char *pixmaps_prefix, - box->content_height = 0; - box->raw_pixmaps = - (struct grub_video_bitmap **) -- grub_malloc (BOX_NUM_PIXMAPS * sizeof (struct grub_video_bitmap *)); -+ grub_calloc (BOX_NUM_PIXMAPS, sizeof (struct grub_video_bitmap *)); - box->scaled_pixmaps = - (struct grub_video_bitmap **) -- grub_malloc (BOX_NUM_PIXMAPS * sizeof (struct grub_video_bitmap *)); -+ grub_calloc (BOX_NUM_PIXMAPS, sizeof (struct grub_video_bitmap *)); - - /* Initialize all pixmap pointers to NULL so that proper destruction can - be performed if an error is encountered partway through construction. */ -diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c -index 6208a976363..43d98a7bdf4 100644 ---- a/grub-core/io/gzio.c -+++ b/grub-core/io/gzio.c -@@ -554,7 +554,7 @@ huft_build (unsigned *b, /* code lengths in bits (all assumed <= BMAX) */ - z = 1 << j; /* table entries for j-bit table */ - - /* allocate and link in new table */ -- q = (struct huft *) grub_zalloc ((z + 1) * sizeof (struct huft)); -+ q = (struct huft *) grub_calloc (z + 1, sizeof (struct huft)); - if (! q) - { - if (h) -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 279394d85eb..ab133fecce0 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -207,7 +207,7 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid, - - len = grub_strlen (var); - len16 = len * GRUB_MAX_UTF16_PER_UTF8; -- var16 = grub_malloc ((len16 + 1) * sizeof (var16[0])); -+ var16 = grub_calloc (len16 + 1, sizeof (var16[0])); - if (!var16) - return grub_errno; - len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL); -@@ -245,7 +245,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, - - len = grub_strlen (var); - len16 = len * GRUB_MAX_UTF16_PER_UTF8; -- var16 = grub_malloc ((len16 + 1) * sizeof (var16[0])); -+ var16 = grub_calloc (len16 + 1, sizeof (var16[0])); - if (!var16) - return NULL; - len16 = grub_utf8_to_utf16 (var16, len16, (grub_uint8_t *) var, len, NULL); -@@ -401,7 +401,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - while (len > 0 && fp->path_name[len - 1] == 0) - len--; - -- dup_name = grub_malloc (len * sizeof (*dup_name)); -+ dup_name = grub_calloc (len, sizeof (*dup_name)); - if (!dup_name) - { - grub_free (name); -diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c -index e9ec680cdbb..d975265b2e0 100644 ---- a/grub-core/kern/emu/hostdisk.c -+++ b/grub-core/kern/emu/hostdisk.c -@@ -615,7 +615,7 @@ static char * - grub_util_path_concat_real (size_t n, int ext, va_list ap) - { - size_t totlen = 0; -- char **l = xmalloc ((n + ext) * sizeof (l[0])); -+ char **l = xcalloc (n + ext, sizeof (l[0])); - char *r, *p, *pi; - size_t i; - int first = 1; -diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c -index 88d39360da0..fb30da9f404 100644 ---- a/grub-core/kern/fs.c -+++ b/grub-core/kern/fs.c -@@ -151,7 +151,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name) - while (p); - - /* Allocate a block list. */ -- blocks = grub_zalloc (sizeof (struct grub_fs_block) * (num + 1)); -+ blocks = grub_calloc (num + 1, sizeof (struct grub_fs_block)); - if (! blocks) - return 0; - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 87afb43cd55..dc5e10b651a 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -750,7 +750,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args, - args->ptr = args->prealloc; - else - { -- args->ptr = grub_malloc (args->count * sizeof (args->ptr[0])); -+ args->ptr = grub_calloc (args->count, sizeof (args->ptr[0])); - if (!args->ptr) - { - grub_errno = GRUB_ERR_NONE; -diff --git a/grub-core/kern/parser.c b/grub-core/kern/parser.c -index 78175aac2d3..619db3122a0 100644 ---- a/grub-core/kern/parser.c -+++ b/grub-core/kern/parser.c -@@ -213,7 +213,7 @@ grub_parser_split_cmdline (const char *cmdline, - return grub_errno; - grub_memcpy (args, buffer, bp - buffer); - -- *argv = grub_malloc (sizeof (char *) * (*argc + 1)); -+ *argv = grub_calloc (*argc + 1, sizeof (char *)); - if (!*argv) - { - grub_free (args); -diff --git a/grub-core/kern/uboot/uboot.c b/grub-core/kern/uboot/uboot.c -index be4816fe6f5..aac8f9ae1fd 100644 ---- a/grub-core/kern/uboot/uboot.c -+++ b/grub-core/kern/uboot/uboot.c -@@ -133,7 +133,7 @@ grub_uboot_dev_enum (void) - return num_devices; - - max_devices = 2; -- enum_devices = grub_malloc (sizeof(struct device_info) * max_devices); -+ enum_devices = grub_calloc (max_devices, sizeof(struct device_info)); - if (!enum_devices) - return 0; - -diff --git a/grub-core/lib/libgcrypt/cipher/ac.c b/grub-core/lib/libgcrypt/cipher/ac.c -index f5e946a2d8f..63f6fcd11ef 100644 ---- a/grub-core/lib/libgcrypt/cipher/ac.c -+++ b/grub-core/lib/libgcrypt/cipher/ac.c -@@ -185,7 +185,7 @@ ac_data_mpi_copy (gcry_ac_mpi_t *data_mpis, unsigned int data_mpis_n, - gcry_mpi_t mpi; - char *label; - -- data_mpis_new = gcry_malloc (sizeof (*data_mpis_new) * data_mpis_n); -+ data_mpis_new = gcry_calloc (data_mpis_n, sizeof (*data_mpis_new)); - if (! data_mpis_new) - { - err = gcry_error_from_errno (errno); -@@ -572,7 +572,7 @@ _gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp, - } - - /* Add MPI list. */ -- arg_list = gcry_malloc (sizeof (*arg_list) * (data_n + 1)); -+ arg_list = gcry_calloc (data_n + 1, sizeof (*arg_list)); - if (! arg_list) - { - err = gcry_error_from_errno (errno); -@@ -1283,7 +1283,7 @@ ac_data_construct (const char *identifier, int include_flags, - /* We build a list of arguments to pass to - gcry_sexp_build_array(). */ - data_length = _gcry_ac_data_length (data); -- arg_list = gcry_malloc (sizeof (*arg_list) * (data_length * 2)); -+ arg_list = gcry_calloc (data_length, sizeof (*arg_list) * 2); - if (! arg_list) - { - err = gcry_error_from_errno (errno); -@@ -1593,7 +1593,7 @@ _gcry_ac_key_pair_generate (gcry_ac_handle_t handle, unsigned int nbits, - arg_list_n += 2; - - /* Allocate list. */ -- arg_list = gcry_malloc (sizeof (*arg_list) * arg_list_n); -+ arg_list = gcry_calloc (arg_list_n, sizeof (*arg_list)); - if (! arg_list) - { - err = gcry_error_from_errno (errno); -diff --git a/grub-core/lib/libgcrypt/cipher/primegen.c b/grub-core/lib/libgcrypt/cipher/primegen.c -index 2788e349fa9..b12e79b1922 100644 ---- a/grub-core/lib/libgcrypt/cipher/primegen.c -+++ b/grub-core/lib/libgcrypt/cipher/primegen.c -@@ -383,7 +383,7 @@ prime_generate_internal (int need_q_factor, - } - - /* Allocate an array to track pool usage. */ -- pool_in_use = gcry_malloc (n * sizeof *pool_in_use); -+ pool_in_use = gcry_calloc (n, sizeof *pool_in_use); - if (!pool_in_use) - { - err = gpg_err_code_from_errno (errno); -@@ -765,7 +765,7 @@ gen_prime (unsigned int nbits, int secret, int randomlevel, - if (nbits < 16) - log_fatal ("can't generate a prime with less than %d bits\n", 16); - -- mods = gcry_xmalloc( no_of_small_prime_numbers * sizeof *mods ); -+ mods = gcry_xcalloc( no_of_small_prime_numbers, sizeof *mods); - /* Make nbits fit into gcry_mpi_t implementation. */ - val_2 = mpi_alloc_set_ui( 2 ); - val_3 = mpi_alloc_set_ui( 3); -diff --git a/grub-core/lib/libgcrypt/cipher/pubkey.c b/grub-core/lib/libgcrypt/cipher/pubkey.c -index 910982141e0..ca087ad75b9 100644 ---- a/grub-core/lib/libgcrypt/cipher/pubkey.c -+++ b/grub-core/lib/libgcrypt/cipher/pubkey.c -@@ -2941,7 +2941,7 @@ gcry_pk_encrypt (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t s_pkey) - * array to a format string, so we have to do it this way :-(. */ - /* FIXME: There is now such a format specifier, so we can - change the code to be more clear. */ -- arg_list = malloc (nelem * sizeof *arg_list); -+ arg_list = calloc (nelem, sizeof *arg_list); - if (!arg_list) - { - rc = gpg_err_code_from_syserror (); -@@ -3233,7 +3233,7 @@ gcry_pk_sign (gcry_sexp_t *r_sig, gcry_sexp_t s_hash, gcry_sexp_t s_skey) - } - strcpy (p, "))"); - -- arg_list = malloc (nelem * sizeof *arg_list); -+ arg_list = calloc (nelem, sizeof *arg_list); - if (!arg_list) - { - rc = gpg_err_code_from_syserror (); -diff --git a/grub-core/lib/priority_queue.c b/grub-core/lib/priority_queue.c -index 659be0b7f40..7d5e7c05aab 100644 ---- a/grub-core/lib/priority_queue.c -+++ b/grub-core/lib/priority_queue.c -@@ -92,7 +92,7 @@ grub_priority_queue_new (grub_size_t elsize, - { - struct grub_priority_queue *ret; - void *els; -- els = grub_malloc (elsize * 8); -+ els = grub_calloc (8, elsize); - if (!els) - return 0; - ret = (struct grub_priority_queue *) grub_malloc (sizeof (*ret)); -diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c -index 19c20085279..79037c093f7 100644 ---- a/grub-core/lib/reed_solomon.c -+++ b/grub-core/lib/reed_solomon.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#define xcalloc calloc - #define xmalloc malloc - #define grub_memset memset - #define grub_memcpy memcpy -@@ -158,11 +159,9 @@ rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs) - gf_single_t *rs_polynomial; - unsigned int i, j; - gf_single_t *m; -- m = xmalloc ((s + rs) * sizeof (gf_single_t)); -+ m = xcalloc (s + rs, sizeof (gf_single_t)); - grub_memcpy (m, data, s * sizeof (gf_single_t)); -- grub_memset (m + s, 0, rs * sizeof (gf_single_t)); -- rs_polynomial = xmalloc ((rs + 1) * sizeof (gf_single_t)); -- grub_memset (rs_polynomial, 0, (rs + 1) * sizeof (gf_single_t)); -+ rs_polynomial = xcalloc (rs + 1, sizeof (gf_single_t)); - rs_polynomial[rs] = 1; - /* Multiply with X - a^r */ - for (j = 0; j < rs; j++) -diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c -index ea3ebc719b1..5847aac3643 100644 ---- a/grub-core/lib/relocator.c -+++ b/grub-core/lib/relocator.c -@@ -495,9 +495,9 @@ malloc_in_range (struct grub_relocator *rel, - } - #endif - -- eventt = grub_malloc (maxevents * sizeof (events[0])); -+ eventt = grub_calloc (maxevents, sizeof (events[0])); - counter = grub_malloc ((DIGITSORT_MASK + 2) * sizeof (counter[0])); -- events = grub_malloc (maxevents * sizeof (events[0])); -+ events = grub_calloc (maxevents, sizeof (events[0])); - if (!events || !eventt || !counter) - { - grub_dprintf ("relocator", "events or counter allocation failed %d\n", -@@ -963,7 +963,7 @@ malloc_in_range (struct grub_relocator *rel, - #endif - unsigned cural = 0; - int oom = 0; -- res->subchunks = grub_malloc (sizeof (res->subchunks[0]) * nallocs); -+ res->subchunks = grub_calloc (nallocs, sizeof (res->subchunks[0])); - if (!res->subchunks) - oom = 1; - res->nsubchunks = nallocs; -@@ -1562,8 +1562,8 @@ grub_relocator_prepare_relocs (struct grub_relocator *rel, grub_addr_t addr, - count[(chunk->src & 0xff) + 1]++; - } - } -- from = grub_malloc (nchunks * sizeof (sorted[0])); -- to = grub_malloc (nchunks * sizeof (sorted[0])); -+ from = grub_calloc (nchunks, sizeof (sorted[0])); -+ to = grub_calloc (nchunks, sizeof (sorted[0])); - if (!from || !to) - { - grub_free (from); -diff --git a/grub-core/lib/zstd/fse_decompress.c b/grub-core/lib/zstd/fse_decompress.c -index 72bbead5bee..2227b84bc7e 100644 ---- a/grub-core/lib/zstd/fse_decompress.c -+++ b/grub-core/lib/zstd/fse_decompress.c -@@ -82,7 +82,7 @@ - FSE_DTable* FSE_createDTable (unsigned tableLog) - { - if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX; -- return (FSE_DTable*)malloc( FSE_DTABLE_SIZE_U32(tableLog) * sizeof (U32) ); -+ return (FSE_DTable*)calloc( FSE_DTABLE_SIZE_U32(tableLog), sizeof (U32) ); - } - - void FSE_freeDTable (FSE_DTable* dt) -diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c -index 51684914cfc..d70c174868e 100644 ---- a/grub-core/loader/arm/linux.c -+++ b/grub-core/loader/arm/linux.c -@@ -78,7 +78,7 @@ linux_prepare_atag (void *target_atag) - - /* some place for cmdline, initrd and terminator. */ - tmp_size = get_atag_size (atag_orig) + 20 + (arg_size) / 4; -- tmp_atag = grub_malloc (tmp_size * sizeof (grub_uint32_t)); -+ tmp_atag = grub_calloc (tmp_size, sizeof (grub_uint32_t)); - if (!tmp_atag) - return grub_errno; - -diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 2c529f71471..736505173cb 100644 ---- a/grub-core/loader/efi/chainloader.c -+++ b/grub-core/loader/efi/chainloader.c -@@ -125,7 +125,7 @@ copy_file_path (grub_efi_file_path_device_path_t *fp, - fp->header.type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE; - fp->header.subtype = GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE; - -- path_name = grub_malloc (len * GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); -+ path_name = grub_calloc (len, GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); - if (!path_name) - return; - -diff --git a/grub-core/loader/i386/bsdXX.c b/grub-core/loader/i386/bsdXX.c -index af6741d157c..a8d8bf7daed 100644 ---- a/grub-core/loader/i386/bsdXX.c -+++ b/grub-core/loader/i386/bsdXX.c -@@ -48,7 +48,7 @@ read_headers (grub_file_t file, const char *filename, Elf_Ehdr *e, char **shdr) - if (e->e_ident[EI_CLASS] != SUFFIX (ELFCLASS)) - return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-dependent ELF magic")); - -- *shdr = grub_malloc ((grub_uint32_t) e->e_shnum * e->e_shentsize); -+ *shdr = grub_calloc (e->e_shnum, e->e_shentsize); - if (! *shdr) - return grub_errno; - -diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c -index e64ed08f580..b7d176b5d30 100644 ---- a/grub-core/loader/i386/xnu.c -+++ b/grub-core/loader/i386/xnu.c -@@ -295,7 +295,7 @@ grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *d - return grub_errno; - - len = grub_strlen (name); -- utf16 = grub_malloc (sizeof (grub_uint16_t) * len); -+ utf16 = grub_calloc (len, sizeof (grub_uint16_t)); - if (!utf16) - { - grub_free (utf8); -@@ -331,7 +331,7 @@ grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor * - grub_uint16_t *utf16; - grub_err_t err; - -- utf16 = grub_malloc (sizeof (grub_uint16_t) * namelen); -+ utf16 = grub_calloc (namelen, sizeof (grub_uint16_t)); - if (!utf16) - return grub_errno; - grub_memcpy (utf16, name, sizeof (grub_uint16_t) * namelen); -diff --git a/grub-core/loader/macho.c b/grub-core/loader/macho.c -index 085f9c6890a..05710c48e06 100644 ---- a/grub-core/loader/macho.c -+++ b/grub-core/loader/macho.c -@@ -97,7 +97,7 @@ grub_macho_file (grub_file_t file, const char *filename, int is_64bit) - if (grub_file_seek (macho->file, sizeof (struct grub_macho_fat_header)) - == (grub_off_t) -1) - goto fail; -- archs = grub_malloc (sizeof (struct grub_macho_fat_arch) * narchs); -+ archs = grub_calloc (narchs, sizeof (struct grub_macho_fat_arch)); - if (!archs) - goto fail; - if (grub_file_read (macho->file, archs, -diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c -index 70cd1db513e..cc6853692a8 100644 ---- a/grub-core/loader/multiboot_elfxx.c -+++ b/grub-core/loader/multiboot_elfxx.c -@@ -217,7 +217,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - { - grub_uint8_t *shdr, *shdrptr; - -- shdr = grub_malloc ((grub_uint32_t) ehdr->e_shnum * ehdr->e_shentsize); -+ shdr = grub_calloc (ehdr->e_shnum, ehdr->e_shentsize); - if (!shdr) - return grub_errno; - -diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index e0f47e72b06..2f0ebd0b8bf 100644 ---- a/grub-core/loader/xnu.c -+++ b/grub-core/loader/xnu.c -@@ -801,7 +801,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)), - if (grub_be_to_cpu32 (head.magic) == GRUB_MACHO_FAT_MAGIC) - { - narchs = grub_be_to_cpu32 (head.nfat_arch); -- archs = grub_malloc (sizeof (struct grub_macho_fat_arch) * narchs); -+ archs = grub_calloc (narchs, sizeof (struct grub_macho_fat_arch)); - if (! archs) - { - grub_file_close (file); -diff --git a/grub-core/mmap/mmap.c b/grub-core/mmap/mmap.c -index b569cb23b5a..64684c23d0d 100644 ---- a/grub-core/mmap/mmap.c -+++ b/grub-core/mmap/mmap.c -@@ -143,9 +143,9 @@ grub_mmap_iterate (grub_memory_hook_t hook, void *hook_data) - - /* Initialize variables. */ - ctx.scanline_events = (struct grub_mmap_scan *) -- grub_malloc (sizeof (struct grub_mmap_scan) * 2 * mmap_num); -+ grub_calloc (mmap_num, sizeof (struct grub_mmap_scan) * 2); - -- present = grub_zalloc (sizeof (present[0]) * current_priority); -+ present = grub_calloc (current_priority, sizeof (present[0])); - - if (! ctx.scanline_events || !present) - { -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 2e46842e829..5a5ebbfb1aa 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -1629,7 +1629,7 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), - if (ncards == 0) - return grub_error (GRUB_ERR_NET_NO_CARD, N_("no network card found")); - -- ifaces = grub_zalloc (ncards * sizeof (ifaces[0])); -+ ifaces = grub_calloc (ncards, sizeof (ifaces[0])); - if (!ifaces) - return grub_errno; - -diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c -index 5d9afe093c0..e332d5eb4a4 100644 ---- a/grub-core/net/dns.c -+++ b/grub-core/net/dns.c -@@ -285,8 +285,8 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), - ptr++; - ptr += 4; - } -- *data->addresses = grub_malloc (sizeof ((*data->addresses)[0]) -- * grub_be_to_cpu16 (head->ancount)); -+ *data->addresses = grub_calloc (grub_be_to_cpu16 (head->ancount), -+ sizeof ((*data->addresses)[0])); - if (!*data->addresses) - { - grub_errno = GRUB_ERR_NONE; -@@ -406,8 +406,8 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), - dns_cache[h].addresses = 0; - dns_cache[h].name = grub_strdup (data->oname); - dns_cache[h].naddresses = *data->naddresses; -- dns_cache[h].addresses = grub_malloc (*data->naddresses -- * sizeof (dns_cache[h].addresses[0])); -+ dns_cache[h].addresses = grub_calloc (*data->naddresses, -+ sizeof (dns_cache[h].addresses[0])); - dns_cache[h].limit_time = grub_get_time_ms () + 1000 * ttl_all; - if (!dns_cache[h].addresses || !dns_cache[h].name) - { -@@ -479,7 +479,7 @@ grub_net_dns_lookup (const char *name, - } - } - -- sockets = grub_malloc (sizeof (sockets[0]) * n_servers); -+ sockets = grub_calloc (n_servers, sizeof (sockets[0])); - if (!sockets) - return grub_errno; - -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 15073dde1c4..ad024c9ef7a 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -338,8 +338,8 @@ grub_cmd_ipv6_autoconf (struct grub_command *cmd __attribute__ ((unused)), - ncards++; - } - -- ifaces = grub_zalloc (ncards * sizeof (ifaces[0])); -- slaacs = grub_zalloc (ncards * sizeof (slaacs[0])); -+ ifaces = grub_calloc (ncards, sizeof (ifaces[0])); -+ slaacs = grub_calloc (ncards, sizeof (slaacs[0])); - if (!ifaces || !slaacs) - { - grub_free (ifaces); -diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c -index b0ab47d73fd..d57fb72faa8 100644 ---- a/grub-core/normal/charset.c -+++ b/grub-core/normal/charset.c -@@ -203,7 +203,7 @@ grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg, - { - grub_size_t msg_len = grub_strlen (msg); - -- *unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t)); -+ *unicode_msg = grub_calloc (msg_len, sizeof (grub_uint32_t)); - - if (!*unicode_msg) - return -1; -@@ -488,7 +488,7 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, - } - else - { -- n = grub_malloc (sizeof (n[0]) * (out->ncomb + 1)); -+ n = grub_calloc (out->ncomb + 1, sizeof (n[0])); - if (!n) - { - grub_errno = GRUB_ERR_NONE; -@@ -842,7 +842,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, - } \ - } - -- visual = grub_malloc (sizeof (visual[0]) * logical_len); -+ visual = grub_calloc (logical_len, sizeof (visual[0])); - if (!visual) - return -1; - -@@ -1165,8 +1165,8 @@ grub_bidi_logical_to_visual (const grub_uint32_t *logical, - { - const grub_uint32_t *line_start = logical, *ptr; - struct grub_unicode_glyph *visual_ptr; -- *visual_out = visual_ptr = grub_malloc (3 * sizeof (visual_ptr[0]) -- * (logical_len + 2)); -+ *visual_out = visual_ptr = grub_calloc (logical_len + 2, -+ 3 * sizeof (visual_ptr[0])); - if (!visual_ptr) - return -1; - for (ptr = logical; ptr <= logical + logical_len; ptr++) -diff --git a/grub-core/normal/cmdline.c b/grub-core/normal/cmdline.c -index c037d5050ed..c57242e2ea9 100644 ---- a/grub-core/normal/cmdline.c -+++ b/grub-core/normal/cmdline.c -@@ -41,7 +41,7 @@ grub_err_t - grub_set_history (int newsize) - { - grub_uint32_t **old_hist_lines = hist_lines; -- hist_lines = grub_malloc (sizeof (grub_uint32_t *) * newsize); -+ hist_lines = grub_calloc (newsize, sizeof (grub_uint32_t *)); - - /* Copy the old lines into the new buffer. */ - if (old_hist_lines) -@@ -114,7 +114,7 @@ static void - grub_history_set (int pos, grub_uint32_t *s, grub_size_t len) - { - grub_free (hist_lines[pos]); -- hist_lines[pos] = grub_malloc ((len + 1) * sizeof (grub_uint32_t)); -+ hist_lines[pos] = grub_calloc (len + 1, sizeof (grub_uint32_t)); - if (!hist_lines[pos]) - { - grub_print_error (); -@@ -349,7 +349,7 @@ grub_cmdline_get (const char *prompt_translated) - char *ret; - unsigned nterms; - -- buf = grub_malloc (max_len * sizeof (grub_uint32_t)); -+ buf = grub_calloc (max_len, sizeof (grub_uint32_t)); - if (!buf) - return 0; - -@@ -377,7 +377,7 @@ grub_cmdline_get (const char *prompt_translated) - FOR_ACTIVE_TERM_OUTPUTS(cur) - nterms++; - -- cl_terms = grub_malloc (sizeof (cl_terms[0]) * nterms); -+ cl_terms = grub_calloc (nterms, sizeof (cl_terms[0])); - if (!cl_terms) - { - grub_free (buf); -@@ -385,7 +385,7 @@ grub_cmdline_get (const char *prompt_translated) - } - cl_term_cur = cl_terms; - -- unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t)); -+ unicode_msg = grub_calloc (msg_len, sizeof (grub_uint32_t)); - if (!unicode_msg) - { - grub_free (buf); -@@ -495,7 +495,7 @@ grub_cmdline_get (const char *prompt_translated) - grub_uint32_t *insert; - - insertlen = grub_strlen (insertu8); -- insert = grub_malloc ((insertlen + 1) * sizeof (grub_uint32_t)); -+ insert = grub_calloc (insertlen + 1, sizeof (grub_uint32_t)); - if (!insert) - { - grub_free (insertu8); -@@ -602,7 +602,7 @@ grub_cmdline_get (const char *prompt_translated) - - grub_free (kill_buf); - -- kill_buf = grub_malloc ((n + 1) * sizeof(grub_uint32_t)); -+ kill_buf = grub_calloc (n + 1, sizeof (grub_uint32_t)); - if (grub_errno) - { - grub_print_error (); -diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index 5785f67ee1c..f31487c1f58 100644 ---- a/grub-core/normal/menu_entry.c -+++ b/grub-core/normal/menu_entry.c -@@ -95,8 +95,8 @@ init_line (struct screen *screen, struct line *linep) - { - linep->len = 0; - linep->max_len = 80; -- linep->buf = grub_malloc ((linep->max_len + 1) * sizeof (linep->buf[0])); -- linep->pos = grub_zalloc (screen->nterms * sizeof (linep->pos[0])); -+ linep->buf = grub_calloc (linep->max_len + 1, sizeof (linep->buf[0])); -+ linep->pos = grub_calloc (screen->nterms, sizeof (linep->pos[0])); - if (! linep->buf || !linep->pos) - { - grub_free (linep->buf); -@@ -287,7 +287,7 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen, - pos = linep->pos + (term_screen - screen->terms); - - if (!*pos) -- *pos = grub_zalloc ((linep->len + 1) * sizeof (**pos)); -+ *pos = grub_calloc (linep->len + 1, sizeof (**pos)); - - if (i == region_start || linep == screen->lines + screen->line - || (i > region_start && mode == ALL_LINES)) -@@ -471,7 +471,7 @@ insert_string (struct screen *screen, const char *s, int update) - - /* Insert the string. */ - current_linep = screen->lines + screen->line; -- unicode_msg = grub_malloc ((p - s) * sizeof (grub_uint32_t)); -+ unicode_msg = grub_calloc (p - s, sizeof (grub_uint32_t)); - - if (!unicode_msg) - return 0; -@@ -1023,7 +1023,7 @@ complete (struct screen *screen, int continuous, int update) - if (completion_buffer.buf) - { - buflen = grub_strlen (completion_buffer.buf); -- ucs4 = grub_malloc (sizeof (grub_uint32_t) * (buflen + 1)); -+ ucs4 = grub_calloc (buflen + 1, sizeof (grub_uint32_t)); - - if (!ucs4) - { -@@ -1265,7 +1265,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) - for (i = 0; i < (unsigned) screen->num_lines; i++) - { - grub_free (screen->lines[i].pos); -- screen->lines[i].pos = grub_zalloc (screen->nterms * sizeof (screen->lines[i].pos[0])); -+ screen->lines[i].pos = grub_calloc (screen->nterms, sizeof (screen->lines[i].pos[0])); - if (! screen->lines[i].pos) - { - grub_print_error (); -@@ -1275,7 +1275,7 @@ grub_menu_entry_run (grub_menu_entry_t entry) - } - } - -- screen->terms = grub_zalloc (screen->nterms * sizeof (screen->terms[0])); -+ screen->terms = grub_calloc (screen->nterms, sizeof (screen->terms[0])); - if (!screen->terms) - { - grub_print_error (); -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 7681f7d2893..ca135624356 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -78,7 +78,7 @@ grub_print_message_indented_real (const char *msg, int margin_left, - grub_size_t msg_len = grub_strlen (msg) + 2; - int ret = 0; - -- unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t)); -+ unicode_msg = grub_calloc (msg_len, sizeof (grub_uint32_t)); - - if (!unicode_msg) - return 0; -@@ -167,7 +167,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, - - title = entry ? entry->title : ""; - title_len = grub_strlen (title); -- unicode_title = grub_malloc (title_len * sizeof (*unicode_title)); -+ unicode_title = grub_calloc (title_len, sizeof (*unicode_title)); - if (! unicode_title) - /* XXX How to show this error? */ - return; -diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c -index a1e5c5a0daf..cc8c173b6e8 100644 ---- a/grub-core/normal/term.c -+++ b/grub-core/normal/term.c -@@ -264,7 +264,7 @@ grub_term_save_pos (void) - FOR_ACTIVE_TERM_OUTPUTS(cur) - cnt++; - -- ret = grub_malloc (cnt * sizeof (ret[0])); -+ ret = grub_calloc (cnt, sizeof (ret[0])); - if (!ret) - return NULL; - -@@ -1013,7 +1013,7 @@ grub_xnputs (const char *str, grub_size_t msg_len) - - grub_error_push (); - -- unicode_str = grub_malloc (msg_len * sizeof (grub_uint32_t)); -+ unicode_str = grub_calloc (msg_len, sizeof (grub_uint32_t)); - - grub_error_pop (); - -diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 36429a7cd25..f0c503f43d3 100644 ---- a/grub-core/osdep/linux/getroot.c -+++ b/grub-core/osdep/linux/getroot.c -@@ -176,7 +176,7 @@ grub_util_raid_getmembers (const char *name, int bootable) - if (ret != 0) - grub_util_error (_("ioctl GET_ARRAY_INFO error: %s"), strerror (errno)); - -- devicelist = xmalloc ((info.nr_disks + 1) * sizeof (char *)); -+ devicelist = xcalloc (info.nr_disks + 1, sizeof (char *)); - - for (i = 0, j = 0; j < info.nr_disks; i++) - { -@@ -249,7 +249,7 @@ grub_find_root_devices_from_btrfs (const char *dir) - return NULL; - } - -- ret = xmalloc ((fsi.num_devices + 1) * sizeof (ret[0])); -+ ret = xcalloc (fsi.num_devices + 1, sizeof (ret[0])); - - for (i = 1; i <= fsi.max_id && j < fsi.num_devices; i++) - { -@@ -508,7 +508,7 @@ grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) - if (relroot) - *relroot = NULL; - -- entries = xmalloc (entry_max * sizeof (*entries)); -+ entries = xcalloc (entry_max, sizeof (*entries)); - - again: - fp = grub_util_fopen ("/proc/self/mountinfo", "r"); -diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index b637c58efb7..46a881530c0 100644 ---- a/grub-core/osdep/unix/config.c -+++ b/grub-core/osdep/unix/config.c -@@ -102,7 +102,7 @@ grub_util_load_config (struct grub_util_config *cfg) - argv[0] = "sh"; - argv[1] = "-c"; - -- script = xmalloc (4 * strlen (cfgfile) + 300); -+ script = xcalloc (4, strlen (cfgfile) + 300); - - ptr = script; - memcpy (ptr, ". '", 3); -diff --git a/grub-core/osdep/windows/getroot.c b/grub-core/osdep/windows/getroot.c -index 661d9546192..eada663b261 100644 ---- a/grub-core/osdep/windows/getroot.c -+++ b/grub-core/osdep/windows/getroot.c -@@ -59,7 +59,7 @@ grub_get_mount_point (const TCHAR *path) - - for (ptr = path; *ptr; ptr++); - allocsize = (ptr - path + 10) * 2; -- out = xmalloc (allocsize * sizeof (out[0])); -+ out = xcalloc (allocsize, sizeof (out[0])); - - /* When pointing to EFI system partition GetVolumePathName fails - for ESP root and returns abberant information for everything -diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c -index 87a106c9b82..29cf42788fe 100644 ---- a/grub-core/osdep/windows/hostdisk.c -+++ b/grub-core/osdep/windows/hostdisk.c -@@ -111,7 +111,7 @@ grub_util_get_windows_path_real (const char *path) - - while (1) - { -- fpa = xmalloc (alloc * sizeof (fpa[0])); -+ fpa = xcalloc (alloc, sizeof (fpa[0])); - - len = GetFullPathName (tpath, alloc, fpa, NULL); - if (len >= alloc) -@@ -405,7 +405,7 @@ grub_util_fd_opendir (const char *name) - for (l = 0; name_windows[l]; l++); - for (l--; l >= 0 && (name_windows[l] == '\\' || name_windows[l] == '/'); l--); - l++; -- pattern = xmalloc ((l + 3) * sizeof (pattern[0])); -+ pattern = xcalloc (l + 3, sizeof (pattern[0])); - memcpy (pattern, name_windows, l * sizeof (pattern[0])); - pattern[l] = '\\'; - pattern[l + 1] = '*'; -diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c -index e8ffd62c6a0..6297de6326a 100644 ---- a/grub-core/osdep/windows/init.c -+++ b/grub-core/osdep/windows/init.c -@@ -161,7 +161,7 @@ grub_util_host_init (int *argc __attribute__ ((unused)), - LPWSTR *targv; - - targv = CommandLineToArgvW (tcmdline, argc); -- *argv = xmalloc ((*argc + 1) * sizeof (argv[0])); -+ *argv = xcalloc (*argc + 1, sizeof (argv[0])); - - for (i = 0; i < *argc; i++) - (*argv)[i] = grub_util_tchar_to_utf8 (targv[i]); -diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c -index 7eb53fe01b4..1ef86bf5873 100644 ---- a/grub-core/osdep/windows/platform.c -+++ b/grub-core/osdep/windows/platform.c -@@ -225,8 +225,8 @@ grub_install_register_efi (grub_device_t efidir_grub_dev, - grub_util_error ("%s", _("no EFI routines are available when running in BIOS mode")); - - distrib8_len = grub_strlen (efi_distributor); -- distributor16 = xmalloc ((distrib8_len + 1) * GRUB_MAX_UTF16_PER_UTF8 -- * sizeof (grub_uint16_t)); -+ distributor16 = xcalloc (distrib8_len + 1, -+ GRUB_MAX_UTF16_PER_UTF8 * sizeof (grub_uint16_t)); - distrib16_len = grub_utf8_to_utf16 (distributor16, distrib8_len * GRUB_MAX_UTF16_PER_UTF8, - (const grub_uint8_t *) efi_distributor, - distrib8_len, 0); -diff --git a/grub-core/osdep/windows/relpath.c b/grub-core/osdep/windows/relpath.c -index cb0861744ae..478e8ef14d5 100644 ---- a/grub-core/osdep/windows/relpath.c -+++ b/grub-core/osdep/windows/relpath.c -@@ -72,7 +72,7 @@ grub_make_system_path_relative_to_its_root (const char *path) - if (dirwindows[0] && dirwindows[1] == ':') - offset = 2; - } -- ret = xmalloc (sizeof (ret[0]) * (flen - offset + 2)); -+ ret = xcalloc (flen - offset + 2, sizeof (ret[0])); - if (dirwindows[offset] != '\\' - && dirwindows[offset] != '/' - && dirwindows[offset]) -diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c -index 103f6796f39..72a2e37cd48 100644 ---- a/grub-core/partmap/gpt.c -+++ b/grub-core/partmap/gpt.c -@@ -199,7 +199,7 @@ gpt_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors, - *nsectors = ctx.len; - if (*nsectors > max_nsectors) - *nsectors = max_nsectors; -- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); -+ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); - if (!*sectors) - return grub_errno; - for (i = 0; i < *nsectors; i++) -diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c -index 7b8e4507625..ee3f24982b8 100644 ---- a/grub-core/partmap/msdos.c -+++ b/grub-core/partmap/msdos.c -@@ -337,7 +337,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors, - avail_nsectors = *nsectors; - if (*nsectors > max_nsectors) - *nsectors = max_nsectors; -- *sectors = grub_malloc (*nsectors * sizeof (**sectors)); -+ *sectors = grub_calloc (*nsectors, sizeof (**sectors)); - if (!*sectors) - return grub_errno; - for (i = 0; i < *nsectors; i++) -diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index c6d2c365c9a..b55e171c931 100644 ---- a/grub-core/script/execute.c -+++ b/grub-core/script/execute.c -@@ -587,7 +587,7 @@ gettext_append (struct grub_script_argv *result, const char *orig_str) - for (iptr = orig_str; *iptr; iptr++) - if (*iptr == '$') - dollar_cnt++; -- ctx.allowed_strings = grub_malloc (sizeof (ctx.allowed_strings[0]) * dollar_cnt); -+ ctx.allowed_strings = grub_calloc (dollar_cnt, sizeof (ctx.allowed_strings[0])); - - if (parse_string (orig_str, gettext_save_allow, &ctx, 0)) - goto fail; -diff --git a/grub-core/tests/fake_input.c b/grub-core/tests/fake_input.c -index 2d60852989c..b5eb516be2d 100644 ---- a/grub-core/tests/fake_input.c -+++ b/grub-core/tests/fake_input.c -@@ -49,7 +49,7 @@ grub_terminal_input_fake_sequence (int *seq_in, int nseq_in) - saved = grub_term_inputs; - if (seq) - grub_free (seq); -- seq = grub_malloc (nseq_in * sizeof (seq[0])); -+ seq = grub_calloc (nseq_in, sizeof (seq[0])); - if (!seq) - return; - -diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c -index 74d5b65e5c7..44d0810698a 100644 ---- a/grub-core/tests/video_checksum.c -+++ b/grub-core/tests/video_checksum.c -@@ -336,7 +336,7 @@ grub_video_capture_write_bmp (const char *fname, - { - case 4: - { -- grub_uint8_t *buffer = xmalloc (mode_info->width * 3); -+ grub_uint8_t *buffer = xcalloc (3, mode_info->width); - grub_uint32_t rmask = ((1 << mode_info->red_mask_size) - 1); - grub_uint32_t gmask = ((1 << mode_info->green_mask_size) - 1); - grub_uint32_t bmask = ((1 << mode_info->blue_mask_size) - 1); -@@ -367,7 +367,7 @@ grub_video_capture_write_bmp (const char *fname, - } - case 3: - { -- grub_uint8_t *buffer = xmalloc (mode_info->width * 3); -+ grub_uint8_t *buffer = xcalloc (3, mode_info->width); - grub_uint32_t rmask = ((1 << mode_info->red_mask_size) - 1); - grub_uint32_t gmask = ((1 << mode_info->green_mask_size) - 1); - grub_uint32_t bmask = ((1 << mode_info->blue_mask_size) - 1); -@@ -407,7 +407,7 @@ grub_video_capture_write_bmp (const char *fname, - } - case 2: - { -- grub_uint8_t *buffer = xmalloc (mode_info->width * 3); -+ grub_uint8_t *buffer = xcalloc (3, mode_info->width); - grub_uint16_t rmask = ((1 << mode_info->red_mask_size) - 1); - grub_uint16_t gmask = ((1 << mode_info->green_mask_size) - 1); - grub_uint16_t bmask = ((1 << mode_info->blue_mask_size) - 1); -diff --git a/grub-core/video/capture.c b/grub-core/video/capture.c -index 4f83c744116..4d3195e017b 100644 ---- a/grub-core/video/capture.c -+++ b/grub-core/video/capture.c -@@ -89,7 +89,7 @@ grub_video_capture_start (const struct grub_video_mode_info *mode_info, - framebuffer.mode_info = *mode_info; - framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info); - -- framebuffer.ptr = grub_malloc (framebuffer.mode_info.height * framebuffer.mode_info.pitch); -+ framebuffer.ptr = grub_calloc (framebuffer.mode_info.height, framebuffer.mode_info.pitch); - if (!framebuffer.ptr) - return grub_errno; - -diff --git a/grub-core/video/emu/sdl.c b/grub-core/video/emu/sdl.c -index a2f639f66de..0ebab6f57dd 100644 ---- a/grub-core/video/emu/sdl.c -+++ b/grub-core/video/emu/sdl.c -@@ -172,7 +172,7 @@ grub_video_sdl_set_palette (unsigned int start, unsigned int count, - if (start + count > mode_info.number_of_colors) - count = mode_info.number_of_colors - start; - -- tmp = grub_malloc (count * sizeof (tmp[0])); -+ tmp = grub_calloc (count, sizeof (tmp[0])); - for (i = 0; i < count; i++) - { - tmp[i].r = palette_data[i].r; -diff --git a/grub-core/video/i386/pc/vga.c b/grub-core/video/i386/pc/vga.c -index 01f47112d37..b2f776c997b 100644 ---- a/grub-core/video/i386/pc/vga.c -+++ b/grub-core/video/i386/pc/vga.c -@@ -127,7 +127,7 @@ grub_video_vga_setup (unsigned int width, unsigned int height, - - vga_height = height ? : 480; - -- framebuffer.temporary_buffer = grub_malloc (vga_height * VGA_WIDTH); -+ framebuffer.temporary_buffer = grub_calloc (vga_height, VGA_WIDTH); - framebuffer.front_page = 0; - framebuffer.back_page = 0; - if (!framebuffer.temporary_buffer) -diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c -index 777e71334cb..61bd645379b 100644 ---- a/grub-core/video/readers/png.c -+++ b/grub-core/video/readers/png.c -@@ -309,7 +309,7 @@ grub_png_decode_image_header (struct grub_png_data *data) - if (data->is_16bit || data->is_gray || data->is_palette) - #endif - { -- data->image_data = grub_malloc (data->image_height * data->row_bytes); -+ data->image_data = grub_calloc (data->image_height, data->row_bytes); - if (grub_errno) - return grub_errno; - -diff --git a/util/getroot.c b/util/getroot.c -index fa3460d6cd8..6feb2a4de40 100644 ---- a/util/getroot.c -+++ b/util/getroot.c -@@ -219,7 +219,7 @@ make_device_name (const char *drive) - char *ret, *ptr; - const char *iptr; - -- ret = xmalloc (strlen (drive) * 2); -+ ret = xcalloc (2, strlen (drive)); - ptr = ret; - for (iptr = drive; *iptr; iptr++) - { -diff --git a/util/grub-file.c b/util/grub-file.c -index 50c18b6835a..b2e7dd69f4c 100644 ---- a/util/grub-file.c -+++ b/util/grub-file.c -@@ -54,7 +54,7 @@ main (int argc, char *argv[]) - - grub_util_host_init (&argc, &argv); - -- argv2 = xmalloc (argc * sizeof (argv2[0])); -+ argv2 = xcalloc (argc, sizeof (argv2[0])); - - if (argc == 2 && strcmp (argv[1], "--version") == 0) - { -diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index 39bad1f432f..bfcef852d83 100644 ---- a/util/grub-fstest.c -+++ b/util/grub-fstest.c -@@ -650,7 +650,7 @@ argp_parser (int key, char *arg, struct argp_state *state) - if (args_count < num_disks) - { - if (args_count == 0) -- images = xmalloc (num_disks * sizeof (images[0])); -+ images = xcalloc (num_disks, sizeof (images[0])); - images[args_count] = grub_canonicalize_file_name (arg); - args_count++; - return 0; -@@ -734,7 +734,7 @@ main (int argc, char *argv[]) - - grub_util_host_init (&argc, &argv); - -- args = xmalloc (argc * sizeof (args[0])); -+ args = xcalloc (argc, sizeof (args[0])); - - argp_parse (&argp, argc, argv, 0, 0, 0); - -diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index ca0ac612ac5..0295d40f5e4 100644 ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -286,7 +286,7 @@ handle_install_list (struct install_list *il, const char *val, - il->n_entries++; - } - il->n_alloc = il->n_entries + 1; -- il->entries = xmalloc (il->n_alloc * sizeof (il->entries[0])); -+ il->entries = xcalloc (il->n_alloc, sizeof (il->entries[0])); - ptr = val; - for (ce = il->entries; ; ce++) - { -diff --git a/util/grub-install.c b/util/grub-install.c -index 8b6a037903e..dddb7576c97 100644 ---- a/util/grub-install.c -+++ b/util/grub-install.c -@@ -634,7 +634,7 @@ device_map_check_duplicates (const char *dev_map) - if (! fp) - return; - -- d = xmalloc (alloced * sizeof (d[0])); -+ d = xcalloc (alloced, sizeof (d[0])); - - while (fgets (buf, sizeof (buf), fp)) - { -@@ -1263,7 +1263,7 @@ main (int argc, char *argv[]) - ndev++; - } - -- grub_drives = xmalloc (sizeof (grub_drives[0]) * (ndev + 1)); -+ grub_drives = xcalloc (ndev + 1, sizeof (grub_drives[0])); - - for (curdev = grub_devices, curdrive = grub_drives; *curdev; curdev++, - curdrive++) -diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index d16ec63a16f..52bc9c848d9 100644 ---- a/util/grub-mkimagexx.c -+++ b/util/grub-mkimagexx.c -@@ -2294,10 +2294,8 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, - + grub_host_to_target16 (e->e_shstrndx) * smd.section_entsize); - smd.strtab = (char *) e + grub_host_to_target_addr (s->sh_offset); - -- smd.addrs = xmalloc (sizeof (*smd.addrs) * smd.num_sections); -- memset (smd.addrs, 0, sizeof (*smd.addrs) * smd.num_sections); -- smd.vaddrs = xmalloc (sizeof (*smd.vaddrs) * smd.num_sections); -- memset (smd.vaddrs, 0, sizeof (*smd.vaddrs) * smd.num_sections); -+ smd.addrs = xcalloc (smd.num_sections, sizeof (*smd.addrs)); -+ smd.vaddrs = xcalloc (smd.num_sections, sizeof (*smd.vaddrs)); - - SUFFIX (locate_sections) (e, kernel_path, &smd, layout, image_target); - -diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c -index ce2cbc4f100..51831027f72 100644 ---- a/util/grub-mkrescue.c -+++ b/util/grub-mkrescue.c -@@ -441,8 +441,8 @@ main (int argc, char *argv[]) - xorriso = xstrdup ("xorriso"); - label_font = grub_util_path_concat (2, pkgdatadir, "unicode.pf2"); - -- argp_argv = xmalloc (sizeof (argp_argv[0]) * argc); -- xorriso_tail_argv = xmalloc (sizeof (argp_argv[0]) * argc); -+ argp_argv = xcalloc (argc, sizeof (argp_argv[0])); -+ xorriso_tail_argv = xcalloc (argc, sizeof (argp_argv[0])); - - xorriso_tail_argc = 0; - /* Program name */ -diff --git a/util/grub-mkstandalone.c b/util/grub-mkstandalone.c -index 4907d44c0bd..edf309717c3 100644 ---- a/util/grub-mkstandalone.c -+++ b/util/grub-mkstandalone.c -@@ -296,7 +296,7 @@ main (int argc, char *argv[]) - grub_util_host_init (&argc, &argv); - grub_util_disable_fd_syncs (); - -- files = xmalloc ((argc + 1) * sizeof (files[0])); -+ files = xcalloc (argc + 1, sizeof (files[0])); - - argp_parse (&argp, argc, argv, 0, 0, 0); - -diff --git a/util/grub-pe2elf.c b/util/grub-pe2elf.c -index 0d4084a108e..11331294f1b 100644 ---- a/util/grub-pe2elf.c -+++ b/util/grub-pe2elf.c -@@ -100,9 +100,9 @@ write_section_data (FILE* fp, const char *name, char *image, - char *pe_strtab = (image + pe_chdr->symtab_offset - + pe_chdr->num_symbols * sizeof (struct grub_pe32_symbol)); - -- section_map = xmalloc ((2 * pe_chdr->num_sections + 5) * sizeof (int)); -+ section_map = xcalloc (2 * pe_chdr->num_sections + 5, sizeof (int)); - section_map[0] = 0; -- shdr = xmalloc ((2 * pe_chdr->num_sections + 5) * sizeof (shdr[0])); -+ shdr = xcalloc (2 * pe_chdr->num_sections + 5, sizeof (shdr[0])); - idx = 1; - idx_reloc = pe_chdr->num_sections + 1; - -@@ -233,7 +233,7 @@ write_reloc_section (FILE* fp, const char *name, char *image, - - pe_sec = pe_shdr + shdr[i].sh_link; - pe_rel = (struct grub_pe32_reloc *) (image + pe_sec->relocations_offset); -- rel = (elf_reloc_t *) xmalloc (pe_sec->num_relocations * sizeof (elf_reloc_t)); -+ rel = (elf_reloc_t *) xcalloc (pe_sec->num_relocations, sizeof (elf_reloc_t)); - num_rels = 0; - modified = 0; - -@@ -365,12 +365,10 @@ write_symbol_table (FILE* fp, const char *name, char *image, - pe_symtab = (struct grub_pe32_symbol *) (image + pe_chdr->symtab_offset); - pe_strtab = (char *) (pe_symtab + pe_chdr->num_symbols); - -- symtab = (Elf_Sym *) xmalloc ((pe_chdr->num_symbols + 1) * -- sizeof (Elf_Sym)); -- memset (symtab, 0, (pe_chdr->num_symbols + 1) * sizeof (Elf_Sym)); -+ symtab = (Elf_Sym *) xcalloc (pe_chdr->num_symbols + 1, sizeof (Elf_Sym)); - num_syms = 1; - -- symtab_map = (int *) xmalloc (pe_chdr->num_symbols * sizeof (int)); -+ symtab_map = (int *) xcalloc (pe_chdr->num_symbols, sizeof (int)); - - for (i = 0; i < (int) pe_chdr->num_symbols; - i += pe_symtab->num_aux + 1, pe_symtab += pe_symtab->num_aux + 1) -diff --git a/util/grub-probe.c b/util/grub-probe.c -index 7481e487211..cf4291c00a4 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -361,8 +361,8 @@ probe (const char *path, char **device_names, char delim) - grub_util_pull_device (*curdev); - ndev++; - } -- -- drives_names = xmalloc (sizeof (drives_names[0]) * (ndev + 1)); -+ -+ drives_names = xcalloc (ndev + 1, sizeof (drives_names[0])); - - for (curdev = device_names, curdrive = drives_names; *curdev; curdev++, - curdrive++) -diff --git a/include/grub/unicode.h b/include/grub/unicode.h -index a0403e91f9a..4de986a8576 100644 ---- a/include/grub/unicode.h -+++ b/include/grub/unicode.h -@@ -293,7 +293,7 @@ grub_unicode_glyph_dup (const struct grub_unicode_glyph *in) - grub_memcpy (out, in, sizeof (*in)); - if (in->ncomb > ARRAY_SIZE (out->combining_inline)) - { -- out->combining_ptr = grub_malloc (in->ncomb * sizeof (out->combining_ptr[0])); -+ out->combining_ptr = grub_calloc (in->ncomb, sizeof (out->combining_ptr[0])); - if (!out->combining_ptr) - { - grub_free (out); -@@ -315,7 +315,7 @@ grub_unicode_set_glyph (struct grub_unicode_glyph *out, - grub_memcpy (out, in, sizeof (*in)); - if (in->ncomb > ARRAY_SIZE (out->combining_inline)) - { -- out->combining_ptr = grub_malloc (in->ncomb * sizeof (out->combining_ptr[0])); -+ out->combining_ptr = grub_calloc (in->ncomb, sizeof (out->combining_ptr[0])); - if (!out->combining_ptr) - return; - grub_memcpy (out->combining_ptr, in->combining_ptr, diff --git a/0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch b/0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch deleted file mode 100644 index f840978e..00000000 --- a/0229-malloc-Use-overflow-checking-primitives-where-we-do-.patch +++ /dev/null @@ -1,1320 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 15 Jun 2020 12:28:27 -0400 -Subject: [PATCH] malloc: Use overflow checking primitives where we do complex - allocations - -This attempts to fix the places where we do the following where -arithmetic_expr may include unvalidated data: - - X = grub_malloc(arithmetic_expr); - -It accomplishes this by doing the arithmetic ahead of time using grub_add(), -grub_sub(), grub_mul() and testing for overflow before proceeding. - -Among other issues, this fixes: - - allocation of integer overflow in grub_video_bitmap_create() - reported by Chris Coulson, - - allocation of integer overflow in grub_png_decode_image_header() - reported by Chris Coulson, - - allocation of integer overflow in grub_squash_read_symlink() - reported by Chris Coulson, - - allocation of integer overflow in grub_ext2_read_symlink() - reported by Chris Coulson, - - allocation of integer overflow in read_section_as_string() - reported by Chris Coulson. - -Fixes: CVE-2020-14309, CVE-2020-14310, CVE-2020-14311 - -Signed-off-by: Peter Jones -Reviewed-by: Daniel Kiper -Upstream-commit-id: 5fb2befbf04 ---- - grub-core/commands/legacycfg.c | 29 +++++++++++++++++++----- - grub-core/commands/wildcard.c | 36 ++++++++++++++++++++++++----- - grub-core/disk/ldm.c | 32 ++++++++++++++++++-------- - grub-core/font/font.c | 7 +++++- - grub-core/fs/btrfs.c | 28 +++++++++++++++-------- - grub-core/fs/ext2.c | 10 ++++++++- - grub-core/fs/iso9660.c | 51 +++++++++++++++++++++++++++++------------- - grub-core/fs/sfs.c | 27 +++++++++++++++++----- - grub-core/fs/squash4.c | 45 ++++++++++++++++++++++++++++--------- - grub-core/fs/udf.c | 41 +++++++++++++++++++++------------ - grub-core/fs/xfs.c | 11 +++++---- - grub-core/fs/zfs/zfs.c | 22 ++++++++++++------ - grub-core/fs/zfs/zfscrypt.c | 7 +++++- - grub-core/lib/arg.c | 20 +++++++++++++++-- - grub-core/loader/i386/bsd.c | 8 ++++++- - grub-core/net/dns.c | 9 +++++++- - grub-core/normal/charset.c | 10 +++++++-- - grub-core/normal/cmdline.c | 14 ++++++++++-- - grub-core/normal/menu_entry.c | 13 +++++++++-- - grub-core/script/argv.c | 16 +++++++++++-- - grub-core/script/lexer.c | 21 ++++++++++++++--- - grub-core/video/bitmap.c | 25 +++++++++++++-------- - grub-core/video/readers/png.c | 13 +++++++++-- - 23 files changed, 382 insertions(+), 113 deletions(-) - -diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index da5143d4360..782761c31aa 100644 ---- a/grub-core/commands/legacycfg.c -+++ b/grub-core/commands/legacycfg.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -104,13 +105,22 @@ legacy_file (const char *filename) - if (newsuffix) - { - char *t; -- -+ grub_size_t sz; -+ -+ if (grub_add (grub_strlen (suffix), grub_strlen (newsuffix), &sz) || -+ grub_add (sz, 1, &sz)) -+ { -+ grub_errno = GRUB_ERR_OUT_OF_RANGE; -+ goto fail_0; -+ } -+ - t = suffix; -- suffix = grub_realloc (suffix, grub_strlen (suffix) -- + grub_strlen (newsuffix) + 1); -+ suffix = grub_realloc (suffix, sz); - if (!suffix) - { - grub_free (t); -+ -+ fail_0: - grub_free (entrysrc); - grub_free (parsed); - grub_free (newsuffix); -@@ -154,13 +164,22 @@ legacy_file (const char *filename) - else - { - char *t; -+ grub_size_t sz; -+ -+ if (grub_add (grub_strlen (entrysrc), grub_strlen (parsed), &sz) || -+ grub_add (sz, 1, &sz)) -+ { -+ grub_errno = GRUB_ERR_OUT_OF_RANGE; -+ goto fail_1; -+ } - - t = entrysrc; -- entrysrc = grub_realloc (entrysrc, grub_strlen (entrysrc) -- + grub_strlen (parsed) + 1); -+ entrysrc = grub_realloc (entrysrc, sz); - if (!entrysrc) - { - grub_free (t); -+ -+ fail_1: - grub_free (parsed); - grub_free (suffix); - return grub_errno; -diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index 560d437cdc6..8f67a4be7f0 100644 ---- a/grub-core/commands/wildcard.c -+++ b/grub-core/commands/wildcard.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - #include - -@@ -48,6 +49,7 @@ merge (char **dest, char **ps) - int i; - int j; - char **p; -+ grub_size_t sz; - - if (! dest) - return ps; -@@ -60,7 +62,12 @@ merge (char **dest, char **ps) - for (j = 0; ps[j]; j++) - ; - -- p = grub_realloc (dest, sizeof (char*) * (i + j + 1)); -+ if (grub_add (i, j, &sz) || -+ grub_add (sz, 1, &sz) || -+ grub_mul (sz, sizeof (char *), &sz)) -+ return dest; -+ -+ p = grub_realloc (dest, sz); - if (! p) - { - grub_free (dest); -@@ -115,8 +122,15 @@ make_regex (const char *start, const char *end, regex_t *regexp) - char ch; - int i = 0; - unsigned len = end - start; -- char *buffer = grub_malloc (len * 2 + 2 + 1); /* worst case size. */ -+ char *buffer; -+ grub_size_t sz; - -+ /* Worst case size is (len * 2 + 2 + 1). */ -+ if (grub_mul (len, 2, &sz) || -+ grub_add (sz, 3, &sz)) -+ return 1; -+ -+ buffer = grub_malloc (sz); - if (! buffer) - return 1; - -@@ -226,6 +240,7 @@ match_devices_iter (const char *name, void *data) - struct match_devices_ctx *ctx = data; - char **t; - char *buffer; -+ grub_size_t sz; - - /* skip partitions if asked to. */ - if (ctx->noparts && grub_strchr (name, ',')) -@@ -239,11 +254,16 @@ match_devices_iter (const char *name, void *data) - if (regexec (ctx->regexp, buffer, 0, 0, 0)) - { - grub_dprintf ("expand", "not matched\n"); -+ fail: - grub_free (buffer); - return 0; - } - -- t = grub_realloc (ctx->devs, sizeof (char*) * (ctx->ndev + 2)); -+ if (grub_add (ctx->ndev, 2, &sz) || -+ grub_mul (sz, sizeof (char *), &sz)) -+ goto fail; -+ -+ t = grub_realloc (ctx->devs, sz); - if (! t) - { - grub_free (buffer); -@@ -300,6 +320,7 @@ match_files_iter (const char *name, - struct match_files_ctx *ctx = data; - char **t; - char *buffer; -+ grub_size_t sz; - - /* skip . and .. names */ - if (grub_strcmp(".", name) == 0 || grub_strcmp("..", name) == 0) -@@ -315,9 +336,14 @@ match_files_iter (const char *name, - if (! buffer) - return 1; - -- t = grub_realloc (ctx->files, sizeof (char*) * (ctx->nfile + 2)); -- if (! t) -+ if (grub_add (ctx->nfile, 2, &sz) || -+ grub_mul (sz, sizeof (char *), &sz)) -+ goto fail; -+ -+ t = grub_realloc (ctx->files, sz); -+ if (!t) - { -+ fail: - grub_free (buffer); - return 1; - } -diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c -index e6323701ab3..58f8a53e1ab 100644 ---- a/grub-core/disk/ldm.c -+++ b/grub-core/disk/ldm.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - - #ifdef GRUB_UTIL - #include -@@ -289,6 +290,7 @@ make_vg (grub_disk_t disk, - struct grub_ldm_vblk vblk[GRUB_DISK_SECTOR_SIZE - / sizeof (struct grub_ldm_vblk)]; - unsigned i; -+ grub_size_t sz; - err = grub_disk_read (disk, cursec, 0, - sizeof(vblk), &vblk); - if (err) -@@ -350,7 +352,13 @@ make_vg (grub_disk_t disk, - grub_free (lv); - goto fail2; - } -- lv->name = grub_malloc (*ptr + 1); -+ if (grub_add (*ptr, 1, &sz)) -+ { -+ grub_free (lv->internal_id); -+ grub_free (lv); -+ goto fail2; -+ } -+ lv->name = grub_malloc (sz); - if (!lv->name) - { - grub_free (lv->internal_id); -@@ -599,10 +607,13 @@ make_vg (grub_disk_t disk, - if (lv->segments->node_alloc == lv->segments->node_count) - { - void *t; -- lv->segments->node_alloc *= 2; -- t = grub_realloc (lv->segments->nodes, -- sizeof (*lv->segments->nodes) -- * lv->segments->node_alloc); -+ grub_size_t sz; -+ -+ if (grub_mul (lv->segments->node_alloc, 2, &lv->segments->node_alloc) || -+ grub_mul (lv->segments->node_alloc, sizeof (*lv->segments->nodes), &sz)) -+ goto fail2; -+ -+ t = grub_realloc (lv->segments->nodes, sz); - if (!t) - goto fail2; - lv->segments->nodes = t; -@@ -723,10 +734,13 @@ make_vg (grub_disk_t disk, - if (comp->segment_alloc == comp->segment_count) - { - void *t; -- comp->segment_alloc *= 2; -- t = grub_realloc (comp->segments, -- comp->segment_alloc -- * sizeof (*comp->segments)); -+ grub_size_t sz; -+ -+ if (grub_mul (comp->segment_alloc, 2, &comp->segment_alloc) || -+ grub_mul (comp->segment_alloc, sizeof (*comp->segments), &sz)) -+ goto fail2; -+ -+ t = grub_realloc (comp->segments, sz); - if (!t) - goto fail2; - comp->segments = t; -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 8e118b315ce..5edb477ac2e 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -360,9 +361,13 @@ static char * - read_section_as_string (struct font_file_section *section) - { - char *str; -+ grub_size_t sz; - grub_ssize_t ret; - -- str = grub_malloc (section->length + 1); -+ if (grub_add (section->length, 1, &sz)) -+ return NULL; -+ -+ str = grub_malloc (sz); - if (!str) - return 0; - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index ba080fdc580..0d8c666aea1 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -44,6 +44,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -358,9 +359,13 @@ save_ref (struct grub_btrfs_leaf_descriptor *desc, - if (desc->allocated < desc->depth) - { - void *newdata; -- desc->allocated *= 2; -- newdata = grub_realloc (desc->data, sizeof (desc->data[0]) -- * desc->allocated); -+ grub_size_t sz; -+ -+ if (grub_mul (desc->allocated, 2, &desc->allocated) || -+ grub_mul (desc->allocated, sizeof (desc->data[0]), &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ -+ newdata = grub_realloc (desc->data, sz); - if (!newdata) - return grub_errno; - desc->data = newdata; -@@ -651,16 +656,21 @@ find_device (struct grub_btrfs_data *data, grub_uint64_t id) - if (data->n_devices_attached > data->n_devices_allocated) - { - void *tmp; -- data->n_devices_allocated = 2 * data->n_devices_attached + 1; -- data->devices_attached -- = grub_realloc (tmp = data->devices_attached, -- data->n_devices_allocated -- * sizeof (data->devices_attached[0])); -+ grub_size_t sz; -+ -+ if (grub_mul (data->n_devices_attached, 2, &data->n_devices_allocated) || -+ grub_add (data->n_devices_allocated, 1, &data->n_devices_allocated) || -+ grub_mul (data->n_devices_allocated, sizeof (data->devices_attached[0]), &sz)) -+ goto fail; -+ -+ data->devices_attached = grub_realloc (tmp = data->devices_attached, sz); - if (!data->devices_attached) - { -+ data->devices_attached = tmp; -+ -+ fail: - if (ctx.dev_found) - grub_device_close (ctx.dev_found); -- data->devices_attached = tmp; - return NULL; - } - } -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index 9b389802a35..ac33bcd68c4 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -46,6 +46,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -703,6 +704,7 @@ grub_ext2_read_symlink (grub_fshelp_node_t node) - { - char *symlink; - struct grub_fshelp_node *diro = node; -+ grub_size_t sz; - - if (! diro->inode_read) - { -@@ -717,7 +719,13 @@ grub_ext2_read_symlink (grub_fshelp_node_t node) - } - } - -- symlink = grub_malloc (grub_le_to_cpu32 (diro->inode.size) + 1); -+ if (grub_add (grub_le_to_cpu32 (diro->inode.size), 1, &sz)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ return NULL; -+ } -+ -+ symlink = grub_malloc (sz); - if (! symlink) - return 0; - -diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c -index 4f1b52a552a..7ba5b300bc1 100644 ---- a/grub-core/fs/iso9660.c -+++ b/grub-core/fs/iso9660.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -531,8 +532,13 @@ add_part (struct iterate_dir_ctx *ctx, - int len2) - { - int size = ctx->symlink ? grub_strlen (ctx->symlink) : 0; -+ grub_size_t sz; - -- ctx->symlink = grub_realloc (ctx->symlink, size + len2 + 1); -+ if (grub_add (size, len2, &sz) || -+ grub_add (sz, 1, &sz)) -+ return; -+ -+ ctx->symlink = grub_realloc (ctx->symlink, sz); - if (! ctx->symlink) - return; - -@@ -560,17 +566,24 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry, - { - grub_size_t off = 0, csize = 1; - char *old; -+ grub_size_t sz; -+ - csize = entry->len - 5; - old = ctx->filename; - if (ctx->filename_alloc) - { - off = grub_strlen (ctx->filename); -- ctx->filename = grub_realloc (ctx->filename, csize + off + 1); -+ if (grub_add (csize, off, &sz) || -+ grub_add (sz, 1, &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ ctx->filename = grub_realloc (ctx->filename, sz); - } - else - { - off = 0; -- ctx->filename = grub_zalloc (csize + 1); -+ if (grub_add (csize, 1, &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ ctx->filename = grub_zalloc (sz); - } - if (!ctx->filename) - { -@@ -776,14 +789,18 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir, - if (node->have_dirents >= node->alloc_dirents) - { - struct grub_fshelp_node *new_node; -- node->alloc_dirents *= 2; -- new_node = grub_realloc (node, -- sizeof (struct grub_fshelp_node) -- + ((node->alloc_dirents -- - ARRAY_SIZE (node->dirents)) -- * sizeof (node->dirents[0]))); -+ grub_size_t sz; -+ -+ if (grub_mul (node->alloc_dirents, 2, &node->alloc_dirents) || -+ grub_sub (node->alloc_dirents, ARRAY_SIZE (node->dirents), &sz) || -+ grub_mul (sz, sizeof (node->dirents[0]), &sz) || -+ grub_add (sz, sizeof (struct grub_fshelp_node), &sz)) -+ goto fail_0; -+ -+ new_node = grub_realloc (node, sz); - if (!new_node) - { -+ fail_0: - if (ctx.filename_alloc) - grub_free (ctx.filename); - grub_free (node); -@@ -799,14 +816,18 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir, - * sizeof (node->dirents[0]) < grub_strlen (ctx.symlink) + 1) - { - struct grub_fshelp_node *new_node; -- new_node = grub_realloc (node, -- sizeof (struct grub_fshelp_node) -- + ((node->alloc_dirents -- - ARRAY_SIZE (node->dirents)) -- * sizeof (node->dirents[0])) -- + grub_strlen (ctx.symlink) + 1); -+ grub_size_t sz; -+ -+ if (grub_sub (node->alloc_dirents, ARRAY_SIZE (node->dirents), &sz) || -+ grub_mul (sz, sizeof (node->dirents[0]), &sz) || -+ grub_add (sz, sizeof (struct grub_fshelp_node) + 1, &sz) || -+ grub_add (sz, grub_strlen (ctx.symlink), &sz)) -+ goto fail_1; -+ -+ new_node = grub_realloc (node, sz); - if (!new_node) - { -+ fail_1: - if (ctx.filename_alloc) - grub_free (ctx.filename); - grub_free (node); -diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c -index 90f7fb37918..de2b107a4a4 100644 ---- a/grub-core/fs/sfs.c -+++ b/grub-core/fs/sfs.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -307,10 +308,15 @@ grub_sfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - if (node->cache && node->cache_size >= node->cache_allocated) - { - struct cache_entry *e = node->cache; -- e = grub_realloc (node->cache,node->cache_allocated * 2 -- * sizeof (e[0])); -+ grub_size_t sz; -+ -+ if (grub_mul (node->cache_allocated, 2 * sizeof (e[0]), &sz)) -+ goto fail; -+ -+ e = grub_realloc (node->cache, sz); - if (!e) - { -+ fail: - grub_errno = 0; - grub_free (node->cache); - node->cache = 0; -@@ -477,10 +483,16 @@ grub_sfs_create_node (struct grub_fshelp_node **node, - grub_size_t len = grub_strlen (name); - grub_uint8_t *name_u8; - int ret; -+ grub_size_t sz; -+ -+ if (grub_mul (len, GRUB_MAX_UTF8_PER_LATIN1, &sz) || -+ grub_add (sz, 1, &sz)) -+ return 1; -+ - *node = grub_malloc (sizeof (**node)); - if (!*node) - return 1; -- name_u8 = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1); -+ name_u8 = grub_malloc (sz); - if (!name_u8) - { - grub_free (*node); -@@ -724,8 +736,13 @@ grub_sfs_label (grub_device_t device, char **label) - data = grub_sfs_mount (disk); - if (data) - { -- grub_size_t len = grub_strlen (data->label); -- *label = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1); -+ grub_size_t sz, len = grub_strlen (data->label); -+ -+ if (grub_mul (len, GRUB_MAX_UTF8_PER_LATIN1, &sz) || -+ grub_add (sz, 1, &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ -+ *label = grub_malloc (sz); - if (*label) - *grub_latin1_to_utf8 ((grub_uint8_t *) *label, - (const grub_uint8_t *) data->label, -diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c -index 95d5c1e1ff4..785123894e3 100644 ---- a/grub-core/fs/squash4.c -+++ b/grub-core/fs/squash4.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - - #include "xz.h" -@@ -459,7 +460,17 @@ grub_squash_read_symlink (grub_fshelp_node_t node) - { - char *ret; - grub_err_t err; -- ret = grub_malloc (grub_le_to_cpu32 (node->ino.symlink.namelen) + 1); -+ grub_size_t sz; -+ -+ if (grub_add (grub_le_to_cpu32 (node->ino.symlink.namelen), 1, &sz)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ return NULL; -+ } -+ -+ ret = grub_malloc (sz); -+ if (!ret) -+ return NULL; - - err = read_chunk (node->data, ret, - grub_le_to_cpu32 (node->ino.symlink.namelen), -@@ -506,11 +517,16 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, - - { - grub_fshelp_node_t node; -- node = grub_malloc (sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); -+ grub_size_t sz; -+ -+ if (grub_mul (dir->stsize, sizeof (dir->stack[0]), &sz) || -+ grub_add (sz, sizeof (*node), &sz)) -+ return 0; -+ -+ node = grub_malloc (sz); - if (!node) - return 0; -- grub_memcpy (node, dir, -- sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); -+ grub_memcpy (node, dir, sz); - if (hook (".", GRUB_FSHELP_DIR, node, hook_data)) - return 1; - -@@ -518,12 +534,15 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, - { - grub_err_t err; - -- node = grub_malloc (sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); -+ if (grub_mul (dir->stsize, sizeof (dir->stack[0]), &sz) || -+ grub_add (sz, sizeof (*node), &sz)) -+ return 0; -+ -+ node = grub_malloc (sz); - if (!node) - return 0; - -- grub_memcpy (node, dir, -- sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); -+ grub_memcpy (node, dir, sz); - - node->stsize--; - err = read_chunk (dir->data, &node->ino, sizeof (node->ino), -@@ -557,6 +576,7 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, - enum grub_fshelp_filetype filetype = GRUB_FSHELP_REG; - struct grub_squash_dirent di; - struct grub_squash_inode ino; -+ grub_size_t sz; - - err = read_chunk (dir->data, &di, sizeof (di), - grub_le_to_cpu64 (dir->data->sb.diroffset) -@@ -589,13 +609,16 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, - if (grub_le_to_cpu16 (di.type) == SQUASH_TYPE_SYMLINK) - filetype = GRUB_FSHELP_SYMLINK; - -- node = grub_malloc (sizeof (*node) -- + (dir->stsize + 1) * sizeof (dir->stack[0])); -+ if (grub_add (dir->stsize, 1, &sz) || -+ grub_mul (sz, sizeof (dir->stack[0]), &sz) || -+ grub_add (sz, sizeof (*node), &sz)) -+ return 0; -+ -+ node = grub_malloc (sz); - if (! node) - return 0; - -- grub_memcpy (node, dir, -- sizeof (*node) + dir->stsize * sizeof (dir->stack[0])); -+ grub_memcpy (node, dir, sz - sizeof(dir->stack[0])); - - node->ino = ino; - node->stack[node->stsize].ino_chunk = grub_le_to_cpu32 (dh.ino_chunk); -diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c -index a83761674ad..21ac7f4460d 100644 ---- a/grub-core/fs/udf.c -+++ b/grub-core/fs/udf.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -890,9 +891,19 @@ read_string (const grub_uint8_t *raw, grub_size_t sz, char *outbuf) - utf16[i] = (raw[2 * i + 1] << 8) | raw[2*i + 2]; - } - if (!outbuf) -- outbuf = grub_malloc (utf16len * GRUB_MAX_UTF8_PER_UTF16 + 1); -+ { -+ grub_size_t size; -+ -+ if (grub_mul (utf16len, GRUB_MAX_UTF8_PER_UTF16, &size) || -+ grub_add (size, 1, &size)) -+ goto fail; -+ -+ outbuf = grub_malloc (size); -+ } - if (outbuf) - *grub_utf16_to_utf8 ((grub_uint8_t *) outbuf, utf16, utf16len) = '\0'; -+ -+ fail: - grub_free (utf16); - return outbuf; - } -@@ -1005,7 +1016,7 @@ grub_udf_read_symlink (grub_fshelp_node_t node) - grub_size_t sz = U64 (node->block.fe.file_size); - grub_uint8_t *raw; - const grub_uint8_t *ptr; -- char *out, *optr; -+ char *out = NULL, *optr; - - if (sz < 4) - return NULL; -@@ -1013,14 +1024,16 @@ grub_udf_read_symlink (grub_fshelp_node_t node) - if (!raw) - return NULL; - if (grub_udf_read_file (node, NULL, NULL, 0, sz, (char *) raw) < 0) -- { -- grub_free (raw); -- return NULL; -- } -+ goto fail_1; - -- out = grub_malloc (sz * 2 + 1); -+ if (grub_mul (sz, 2, &sz) || -+ grub_add (sz, 1, &sz)) -+ goto fail_0; -+ -+ out = grub_malloc (sz); - if (!out) - { -+ fail_0: - grub_free (raw); - return NULL; - } -@@ -1031,17 +1044,17 @@ grub_udf_read_symlink (grub_fshelp_node_t node) - { - grub_size_t s; - if ((grub_size_t) (ptr - raw + 4) > sz) -- goto fail; -+ goto fail_1; - if (!(ptr[2] == 0 && ptr[3] == 0)) -- goto fail; -+ goto fail_1; - s = 4 + ptr[1]; - if ((grub_size_t) (ptr - raw + s) > sz) -- goto fail; -+ goto fail_1; - switch (*ptr) - { - case 1: - if (ptr[1]) -- goto fail; -+ goto fail_1; - /* Fallthrough. */ - case 2: - /* in 4 bytes. out: 1 byte. */ -@@ -1066,11 +1079,11 @@ grub_udf_read_symlink (grub_fshelp_node_t node) - if (optr != out) - *optr++ = '/'; - if (!read_string (ptr + 4, s - 4, optr)) -- goto fail; -+ goto fail_1; - optr += grub_strlen (optr); - break; - default: -- goto fail; -+ goto fail_1; - } - ptr += s; - } -@@ -1078,7 +1091,7 @@ grub_udf_read_symlink (grub_fshelp_node_t node) - grub_free (raw); - return out; - -- fail: -+ fail_1: - grub_free (raw); - grub_free (out); - grub_error (GRUB_ERR_BAD_FS, "invalid symlink"); -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 96ffecbfc92..ea6590290b1 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -899,6 +900,7 @@ static struct grub_xfs_data * - grub_xfs_mount (grub_disk_t disk) - { - struct grub_xfs_data *data = 0; -+ grub_size_t sz; - - data = grub_zalloc (sizeof (struct grub_xfs_data)); - if (!data) -@@ -913,10 +915,11 @@ grub_xfs_mount (grub_disk_t disk) - if (!grub_xfs_sb_valid(data)) - goto fail; - -- data = grub_realloc (data, -- sizeof (struct grub_xfs_data) -- - sizeof (struct grub_xfs_inode) -- + grub_xfs_inode_size(data) + 1); -+ if (grub_add (grub_xfs_inode_size (data), -+ sizeof (struct grub_xfs_data) - sizeof (struct grub_xfs_inode) + 1, &sz)) -+ goto fail; -+ -+ data = grub_realloc (data, sz); - - if (! data) - goto fail; -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index 381dde556d1..36d0373a6a5 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -55,6 +55,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -773,11 +774,14 @@ fill_vdev_info (struct grub_zfs_data *data, - if (data->n_devices_attached > data->n_devices_allocated) - { - void *tmp; -- data->n_devices_allocated = 2 * data->n_devices_attached + 1; -- data->devices_attached -- = grub_realloc (tmp = data->devices_attached, -- data->n_devices_allocated -- * sizeof (data->devices_attached[0])); -+ grub_size_t sz; -+ -+ if (grub_mul (data->n_devices_attached, 2, &data->n_devices_allocated) || -+ grub_add (data->n_devices_allocated, 1, &data->n_devices_allocated) || -+ grub_mul (data->n_devices_allocated, sizeof (data->devices_attached[0]), &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ -+ data->devices_attached = grub_realloc (tmp = data->devices_attached, sz); - if (!data->devices_attached) - { - data->devices_attached = tmp; -@@ -3468,14 +3472,18 @@ grub_zfs_nvlist_lookup_nvlist (const char *nvlist, const char *name) - { - char *nvpair; - char *ret; -- grub_size_t size; -+ grub_size_t size, sz; - int found; - - found = nvlist_find_value (nvlist, name, DATA_TYPE_NVLIST, &nvpair, - &size, 0); - if (!found) - return 0; -- ret = grub_zalloc (size + 3 * sizeof (grub_uint32_t)); -+ -+ if (grub_add (size, 3 * sizeof (grub_uint32_t), &sz)) -+ return 0; -+ -+ ret = grub_zalloc (sz); - if (!ret) - return 0; - grub_memcpy (ret, nvlist, sizeof (grub_uint32_t)); -diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c -index 1402e0bc29b..de3b015f582 100644 ---- a/grub-core/fs/zfs/zfscrypt.c -+++ b/grub-core/fs/zfs/zfscrypt.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -82,9 +83,13 @@ grub_zfs_add_key (grub_uint8_t *key_in, - int passphrase) - { - struct grub_zfs_wrap_key *key; -+ grub_size_t sz; -+ - if (!passphrase && keylen > 32) - keylen = 32; -- key = grub_malloc (sizeof (*key) + keylen); -+ if (grub_add (sizeof (*key), keylen, &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ key = grub_malloc (sz); - if (!key) - return grub_errno; - key->is_passphrase = passphrase; -diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c -index ccc185017ee..8439a0062ff 100644 ---- a/grub-core/lib/arg.c -+++ b/grub-core/lib/arg.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - /* Built-in parser for default options. */ - static const struct grub_arg_option help_options[] = -@@ -216,7 +217,13 @@ static inline grub_err_t - add_arg (char ***argl, int *num, char *s) - { - char **p = *argl; -- *argl = grub_realloc (*argl, (++(*num) + 1) * sizeof (char *)); -+ grub_size_t sz; -+ -+ if (grub_add (++(*num), 1, &sz) || -+ grub_mul (sz, sizeof (char *), &sz)) -+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ -+ *argl = grub_realloc (*argl, sz); - if (! *argl) - { - grub_free (p); -@@ -431,6 +438,7 @@ grub_arg_list_alloc(grub_extcmd_t extcmd, int argc, - grub_size_t argcnt; - struct grub_arg_list *list; - const struct grub_arg_option *options; -+ grub_size_t sz0, sz1; - - options = extcmd->options; - if (! options) -@@ -443,7 +451,15 @@ grub_arg_list_alloc(grub_extcmd_t extcmd, int argc, - argcnt += ((grub_size_t) argc + 1) / 2 + 1; /* max possible for any option */ - } - -- list = grub_zalloc (sizeof (*list) * i + sizeof (char*) * argcnt); -+ if (grub_mul (sizeof (*list), i, &sz0) || -+ grub_mul (sizeof (char *), argcnt, &sz1) || -+ grub_add (sz0, sz1, &sz0)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ return 0; -+ } -+ -+ list = grub_zalloc (sz0); - if (! list) - return 0; - -diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 50cca304fd0..ff98fb7b62b 100644 ---- a/grub-core/loader/i386/bsd.c -+++ b/grub-core/loader/i386/bsd.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - #include - #ifdef GRUB_MACHINE_PCBIOS - #include -@@ -1013,11 +1014,16 @@ grub_netbsd_add_modules (void) - struct grub_netbsd_btinfo_modules *mods; - unsigned i; - grub_err_t err; -+ grub_size_t sz; - - for (mod = netbsd_mods; mod; mod = mod->next) - modcnt++; - -- mods = grub_malloc (sizeof (*mods) + sizeof (mods->mods[0]) * modcnt); -+ if (grub_mul (modcnt, sizeof (mods->mods[0]), &sz) || -+ grub_add (sz, sizeof (*mods), &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ -+ mods = grub_malloc (sz); - if (!mods) - return grub_errno; - -diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c -index e332d5eb4a4..906ec7d6782 100644 ---- a/grub-core/net/dns.c -+++ b/grub-core/net/dns.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - struct dns_cache_element - { -@@ -51,9 +52,15 @@ grub_net_add_dns_server (const struct grub_net_network_level_address *s) - { - int na = dns_servers_alloc * 2; - struct grub_net_network_level_address *ns; -+ grub_size_t sz; -+ - if (na < 8) - na = 8; -- ns = grub_realloc (dns_servers, na * sizeof (ns[0])); -+ -+ if (grub_mul (na, sizeof (ns[0]), &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ -+ ns = grub_realloc (dns_servers, sz); - if (!ns) - return grub_errno; - dns_servers_alloc = na; -diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c -index d57fb72faa8..4dfcc31078d 100644 ---- a/grub-core/normal/charset.c -+++ b/grub-core/normal/charset.c -@@ -48,6 +48,7 @@ - #include - #include - #include -+#include - - #if HAVE_FONT_SOURCE - #include "widthspec.h" -@@ -464,6 +465,7 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, - { - struct grub_unicode_combining *n; - unsigned j; -+ grub_size_t sz; - - if (!haveout) - continue; -@@ -477,10 +479,14 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, - n = out->combining_inline; - else if (out->ncomb > (int) ARRAY_SIZE (out->combining_inline)) - { -- n = grub_realloc (out->combining_ptr, -- sizeof (n[0]) * (out->ncomb + 1)); -+ if (grub_add (out->ncomb, 1, &sz) || -+ grub_mul (sz, sizeof (n[0]), &sz)) -+ goto fail; -+ -+ n = grub_realloc (out->combining_ptr, sz); - if (!n) - { -+ fail: - grub_errno = GRUB_ERR_NONE; - continue; - } -diff --git a/grub-core/normal/cmdline.c b/grub-core/normal/cmdline.c -index c57242e2ea9..de03fe63b3d 100644 ---- a/grub-core/normal/cmdline.c -+++ b/grub-core/normal/cmdline.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - static grub_uint32_t *kill_buf; - -@@ -307,12 +308,21 @@ cl_insert (struct cmdline_term *cl_terms, unsigned nterms, - if (len + (*llen) >= (*max_len)) - { - grub_uint32_t *nbuf; -- (*max_len) *= 2; -- nbuf = grub_realloc ((*buf), sizeof (grub_uint32_t) * (*max_len)); -+ grub_size_t sz; -+ -+ if (grub_mul (*max_len, 2, max_len) || -+ grub_mul (*max_len, sizeof (grub_uint32_t), &sz)) -+ { -+ grub_errno = GRUB_ERR_OUT_OF_RANGE; -+ goto fail; -+ } -+ -+ nbuf = grub_realloc ((*buf), sz); - if (nbuf) - (*buf) = nbuf; - else - { -+ fail: - grub_print_error (); - grub_errno = GRUB_ERR_NONE; - (*max_len) /= 2; -diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index f31487c1f58..de64a367c4e 100644 ---- a/grub-core/normal/menu_entry.c -+++ b/grub-core/normal/menu_entry.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - enum update_mode - { -@@ -113,10 +114,18 @@ ensure_space (struct line *linep, int extra) - { - if (linep->max_len < linep->len + extra) - { -- linep->max_len = 2 * (linep->len + extra); -- linep->buf = grub_realloc (linep->buf, (linep->max_len + 1) * sizeof (linep->buf[0])); -+ grub_size_t sz0, sz1; -+ -+ if (grub_add (linep->len, extra, &sz0) || -+ grub_mul (sz0, 2, &sz0) || -+ grub_add (sz0, 1, &sz1) || -+ grub_mul (sz1, sizeof (linep->buf[0]), &sz1)) -+ return 0; -+ -+ linep->buf = grub_realloc (linep->buf, sz1); - if (! linep->buf) - return 0; -+ linep->max_len = sz0; - } - - return 1; -diff --git a/grub-core/script/argv.c b/grub-core/script/argv.c -index 217ec5d1e1b..5751fdd5708 100644 ---- a/grub-core/script/argv.c -+++ b/grub-core/script/argv.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - - /* Return nearest power of two that is >= v. */ - static unsigned -@@ -81,11 +82,16 @@ int - grub_script_argv_next (struct grub_script_argv *argv) - { - char **p = argv->args; -+ grub_size_t sz; - - if (argv->args && argv->argc && argv->args[argv->argc - 1] == 0) - return 0; - -- p = grub_realloc (p, round_up_exp ((argv->argc + 2) * sizeof (char *))); -+ if (grub_add (argv->argc, 2, &sz) || -+ grub_mul (sz, sizeof (char *), &sz)) -+ return 1; -+ -+ p = grub_realloc (p, round_up_exp (sz)); - if (! p) - return 1; - -@@ -105,13 +111,19 @@ grub_script_argv_append (struct grub_script_argv *argv, const char *s, - { - grub_size_t a; - char *p = argv->args[argv->argc - 1]; -+ grub_size_t sz; - - if (! s) - return 0; - - a = p ? grub_strlen (p) : 0; - -- p = grub_realloc (p, round_up_exp ((a + slen + 1) * sizeof (char))); -+ if (grub_add (a, slen, &sz) || -+ grub_add (sz, 1, &sz) || -+ grub_mul (sz, sizeof (char), &sz)) -+ return 1; -+ -+ p = grub_realloc (p, round_up_exp (sz)); - if (! p) - return 1; - -diff --git a/grub-core/script/lexer.c b/grub-core/script/lexer.c -index c6bd3172fab..5fb0cbd0bc9 100644 ---- a/grub-core/script/lexer.c -+++ b/grub-core/script/lexer.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - #define yytext_ptr char * - #include "grub_script.tab.h" -@@ -110,10 +111,14 @@ grub_script_lexer_record (struct grub_parser_param *parser, char *str) - old = lexer->recording; - if (lexer->recordlen < len) - lexer->recordlen = len; -- lexer->recordlen *= 2; -+ -+ if (grub_mul (lexer->recordlen, 2, &lexer->recordlen)) -+ goto fail; -+ - lexer->recording = grub_realloc (lexer->recording, lexer->recordlen); - if (!lexer->recording) - { -+ fail: - grub_free (old); - lexer->recordpos = 0; - lexer->recordlen = 0; -@@ -130,7 +135,7 @@ int - grub_script_lexer_yywrap (struct grub_parser_param *parserstate, - const char *input) - { -- grub_size_t len = 0; -+ grub_size_t len = 0, sz; - char *p = 0; - char *line = 0; - YY_BUFFER_STATE buffer; -@@ -168,12 +173,22 @@ grub_script_lexer_yywrap (struct grub_parser_param *parserstate, - } - else if (len && line[len - 1] != '\n') - { -- p = grub_realloc (line, len + 2); -+ if (grub_add (len, 2, &sz)) -+ { -+ grub_free (line); -+ grub_script_yyerror (parserstate, N_("overflow is detected")); -+ return 1; -+ } -+ -+ p = grub_realloc (line, sz); - if (p) - { - p[len++] = '\n'; - p[len] = '\0'; - } -+ else -+ grub_free (line); -+ - line = p; - } - -diff --git a/grub-core/video/bitmap.c b/grub-core/video/bitmap.c -index b2e0315665b..6256e209a6b 100644 ---- a/grub-core/video/bitmap.c -+++ b/grub-core/video/bitmap.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -58,7 +59,7 @@ grub_video_bitmap_create (struct grub_video_bitmap **bitmap, - enum grub_video_blit_format blit_format) - { - struct grub_video_mode_info *mode_info; -- unsigned int size; -+ grub_size_t size; - - if (!bitmap) - return grub_error (GRUB_ERR_BUG, "invalid argument"); -@@ -137,19 +138,25 @@ grub_video_bitmap_create (struct grub_video_bitmap **bitmap, - - mode_info->pitch = width * mode_info->bytes_per_pixel; - -- /* Calculate size needed for the data. */ -- size = (width * mode_info->bytes_per_pixel) * height; -+ /* Calculate size needed for the data. */ -+ if (grub_mul (width, mode_info->bytes_per_pixel, &size) || -+ grub_mul (size, height, &size)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ goto fail; -+ } - - (*bitmap)->data = grub_zalloc (size); - if (! (*bitmap)->data) -- { -- grub_free (*bitmap); -- *bitmap = 0; -- -- return grub_errno; -- } -+ goto fail; - - return GRUB_ERR_NONE; -+ -+ fail: -+ grub_free (*bitmap); -+ *bitmap = NULL; -+ -+ return grub_errno; - } - - /* Frees all resources allocated by bitmap. */ -diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c -index 61bd645379b..0157ff7420b 100644 ---- a/grub-core/video/readers/png.c -+++ b/grub-core/video/readers/png.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -301,9 +302,17 @@ grub_png_decode_image_header (struct grub_png_data *data) - data->bpp <<= 1; - - data->color_bits = color_bits; -- data->row_bytes = data->image_width * data->bpp; -+ -+ if (grub_mul (data->image_width, data->bpp, &data->row_bytes)) -+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ - if (data->color_bits <= 4) -- data->row_bytes = (data->image_width * data->color_bits + 7) / 8; -+ { -+ if (grub_mul (data->image_width, data->color_bits + 7, &data->row_bytes)) -+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ -+ data->row_bytes >>= 3; -+ } - - #ifndef GRUB_CPU_WORDS_BIGENDIAN - if (data->is_16bit || data->is_gray || data->is_palette) diff --git a/0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch b/0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch deleted file mode 100644 index 8ec24bde..00000000 --- a/0230-iso9660-Don-t-leak-memory-on-realloc-failures.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Sat, 4 Jul 2020 12:25:09 -0400 -Subject: [PATCH] iso9660: Don't leak memory on realloc() failures - -Signed-off-by: Peter Jones -Reviewed-by: Daniel Kiper -Upstream-commit-id: f2bd30b2fe7 ---- - grub-core/fs/iso9660.c | 24 ++++++++++++++++++++---- - 1 file changed, 20 insertions(+), 4 deletions(-) - -diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c -index 7ba5b300bc1..5ec4433b8f8 100644 ---- a/grub-core/fs/iso9660.c -+++ b/grub-core/fs/iso9660.c -@@ -533,14 +533,20 @@ add_part (struct iterate_dir_ctx *ctx, - { - int size = ctx->symlink ? grub_strlen (ctx->symlink) : 0; - grub_size_t sz; -+ char *new; - - if (grub_add (size, len2, &sz) || - grub_add (sz, 1, &sz)) - return; - -- ctx->symlink = grub_realloc (ctx->symlink, sz); -- if (! ctx->symlink) -- return; -+ new = grub_realloc (ctx->symlink, sz); -+ if (!new) -+ { -+ grub_free (ctx->symlink); -+ ctx->symlink = NULL; -+ return; -+ } -+ ctx->symlink = new; - - grub_memcpy (ctx->symlink + size, part, len2); - ctx->symlink[size + len2] = 0; -@@ -634,7 +640,12 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry, - is the length. Both are part of the `Component - Record'. */ - if (ctx->symlink && !ctx->was_continue) -- add_part (ctx, "/", 1); -+ { -+ add_part (ctx, "/", 1); -+ if (grub_errno) -+ return grub_errno; -+ } -+ - add_part (ctx, (char *) &entry->data[pos + 2], - entry->data[pos + 1]); - ctx->was_continue = (entry->data[pos] & 1); -@@ -653,6 +664,11 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry, - add_part (ctx, "/", 1); - break; - } -+ -+ /* Check if grub_realloc() failed in add_part(). */ -+ if (grub_errno) -+ return grub_errno; -+ - /* In pos + 1 the length of the `Component Record' is - stored. */ - pos += entry->data[pos + 1] + 2; diff --git a/0231-font-Do-not-load-more-than-one-NAME-section.patch b/0231-font-Do-not-load-more-than-one-NAME-section.patch deleted file mode 100644 index a1da6296..00000000 --- a/0231-font-Do-not-load-more-than-one-NAME-section.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Kiper -Date: Tue, 7 Jul 2020 15:36:26 +0200 -Subject: [PATCH] font: Do not load more than one NAME section - -The GRUB font file can have one NAME section only. Though if somebody -crafts a broken font file with many NAME sections and loads it then the -GRUB leaks memory. So, prevent against that by loading first NAME -section and failing in controlled way on following one. - -Reported-by: Chris Coulson -Signed-off-by: Daniel Kiper -Reviewed-by: Jan Setje-Eilers -Upstream-commit-id: 482814113dc ---- - grub-core/font/font.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 5edb477ac2e..d09bb38d896 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -532,6 +532,12 @@ grub_font_load (const char *filename) - if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FONT_NAME, - sizeof (FONT_FORMAT_SECTION_NAMES_FONT_NAME) - 1) == 0) - { -+ if (font->name != NULL) -+ { -+ grub_error (GRUB_ERR_BAD_FONT, "invalid font file: too many NAME sections"); -+ goto fail; -+ } -+ - font->name = read_section_as_string (§ion); - if (!font->name) - goto fail; diff --git a/0232-gfxmenu-Fix-double-free-in-load_image.patch b/0232-gfxmenu-Fix-double-free-in-load_image.patch deleted file mode 100644 index 97416b95..00000000 --- a/0232-gfxmenu-Fix-double-free-in-load_image.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexey Makhalov -Date: Wed, 8 Jul 2020 20:41:56 +0000 -Subject: [PATCH] gfxmenu: Fix double free in load_image() - -self->bitmap should be zeroed after free. Otherwise, there is a chance -to double free (USE_AFTER_FREE) it later in rescale_image(). - -Fixes: CID 292472 - -Signed-off-by: Alexey Makhalov -Reviewed-by: Daniel Kiper -Upstream-commit-id: 5d3e84b15a4 ---- - grub-core/gfxmenu/gui_image.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/gfxmenu/gui_image.c b/grub-core/gfxmenu/gui_image.c -index 29784ed2d9a..6b2e976f16e 100644 ---- a/grub-core/gfxmenu/gui_image.c -+++ b/grub-core/gfxmenu/gui_image.c -@@ -195,7 +195,10 @@ load_image (grub_gui_image_t self, const char *path) - return grub_errno; - - if (self->bitmap && (self->bitmap != self->raw_bitmap)) -- grub_video_bitmap_destroy (self->bitmap); -+ { -+ grub_video_bitmap_destroy (self->bitmap); -+ self->bitmap = 0; -+ } - if (self->raw_bitmap) - grub_video_bitmap_destroy (self->raw_bitmap); - diff --git a/0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch b/0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch deleted file mode 100644 index 235376b0..00000000 --- a/0233-xnu-Fix-double-free-in-grub_xnu_devprop_add_property.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexey Makhalov -Date: Wed, 8 Jul 2020 21:30:43 +0000 -Subject: [PATCH] xnu: Fix double free in grub_xnu_devprop_add_property() - -grub_xnu_devprop_add_property() should not free utf8 and utf16 as it get -allocated and freed in the caller. - -Minor improvement: do prop fields initialization after memory allocations. - -Fixes: CID 292442, CID 292457, CID 292460, CID 292466 - -Signed-off-by: Alexey Makhalov -Reviewed-by: Daniel Kiper -Upstream-commit-id: 4d5e2d13519 ---- - grub-core/loader/i386/xnu.c | 19 +++++++++---------- - 1 file changed, 9 insertions(+), 10 deletions(-) - -diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c -index b7d176b5d30..e9e11925972 100644 ---- a/grub-core/loader/i386/xnu.c -+++ b/grub-core/loader/i386/xnu.c -@@ -262,20 +262,19 @@ grub_xnu_devprop_add_property (struct grub_xnu_devprop_device_descriptor *dev, - if (!prop) - return grub_errno; - -+ prop->data = grub_malloc (datalen); -+ if (!prop->data) -+ { -+ grub_free (prop); -+ return grub_errno; -+ } -+ grub_memcpy (prop->data, data, datalen); -+ - prop->name = utf8; - prop->name16 = utf16; - prop->name16len = utf16len; -- - prop->length = datalen; -- prop->data = grub_malloc (prop->length); -- if (!prop->data) -- { -- grub_free (prop->name); -- grub_free (prop->name16); -- grub_free (prop); -- return grub_errno; -- } -- grub_memcpy (prop->data, data, prop->length); -+ - grub_list_push (GRUB_AS_LIST_P (&dev->properties), - GRUB_AS_LIST (prop)); - return GRUB_ERR_NONE; diff --git a/0234-lzma-Make-sure-we-don-t-dereference-past-array.patch b/0234-lzma-Make-sure-we-don-t-dereference-past-array.patch deleted file mode 100644 index d5a31f5d..00000000 --- a/0234-lzma-Make-sure-we-don-t-dereference-past-array.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Konrad Rzeszutek Wilk -Date: Thu, 9 Jul 2020 03:05:23 +0000 -Subject: [PATCH] lzma: Make sure we don't dereference past array - -The two dimensional array p->posSlotEncoder[4][64] is being dereferenced -using the GetLenToPosState() macro which checks if len is less than 5, -and if so subtracts 2 from it. If len = 0, that is 0 - 2 = 4294967294. -Obviously we don't want to dereference that far out so we check if the -position found is greater or equal kNumLenToPosStates (4) and bail out. - -N.B.: Upstream LZMA 18.05 and later has this function completely rewritten -without any history. - -Fixes: CID 51526 - -Signed-off-by: Konrad Rzeszutek Wilk -Reviewed-by: Daniel Kiper -Upstream-commit-id: f91e043bda4 ---- - grub-core/lib/LzmaEnc.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/grub-core/lib/LzmaEnc.c b/grub-core/lib/LzmaEnc.c -index f2ec04a8c28..753e56a95e3 100644 ---- a/grub-core/lib/LzmaEnc.c -+++ b/grub-core/lib/LzmaEnc.c -@@ -1877,13 +1877,19 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize - } - else - { -- UInt32 posSlot; -+ UInt32 posSlot, lenToPosState; - RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); - p->state = kMatchNextStates[p->state]; - LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); - pos -= LZMA_NUM_REPS; - GetPosSlot(pos, posSlot); -- RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); -+ lenToPosState = GetLenToPosState(len); -+ if (lenToPosState >= kNumLenToPosStates) -+ { -+ p->result = SZ_ERROR_DATA; -+ return CheckErrors(p); -+ } -+ RcTree_Encode(&p->rc, p->posSlotEncoder[lenToPosState], kNumPosSlotBits, posSlot); - - if (posSlot >= kStartPosModelIndex) - { diff --git a/0235-term-Fix-overflow-on-user-inputs.patch b/0235-term-Fix-overflow-on-user-inputs.patch deleted file mode 100644 index b381e450..00000000 --- a/0235-term-Fix-overflow-on-user-inputs.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Konrad Rzeszutek Wilk -Date: Tue, 7 Jul 2020 15:12:25 -0400 -Subject: [PATCH] term: Fix overflow on user inputs - -This requires a very weird input from the serial interface but can cause -an overflow in input_buf (keys) overwriting the next variable (npending) -with the user choice: - -(pahole output) - -struct grub_terminfo_input_state { - int input_buf[6]; /* 0 24 */ - int npending; /* 24 4 */ <- CORRUPT - ...snip... - -The magic string requires causing this is "ESC,O,],0,1,2,q" and we overflow -npending with "q" (aka increase npending to 161). The simplest fix is to -just to disallow overwrites input_buf, which exactly what this patch does. - -Fixes: CID 292449 - -Signed-off-by: Konrad Rzeszutek Wilk -Reviewed-by: Daniel Kiper -Upstream-commit-id: 98dfa546777 ---- - grub-core/term/terminfo.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index 537a5c0cb0b..44d0b3b19fb 100644 ---- a/grub-core/term/terminfo.c -+++ b/grub-core/term/terminfo.c -@@ -398,7 +398,7 @@ grub_terminfo_getwh (struct grub_term_output *term) - } - - static void --grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, -+grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, int max_len, - int (*readkey) (struct grub_term_input *term)) - { - int c; -@@ -414,6 +414,9 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, - if (c == -1) \ - return; \ - \ -+ if (*len >= max_len) \ -+ return; \ -+ \ - keys[*len] = c; \ - (*len)++; \ - } -@@ -602,8 +605,8 @@ grub_terminfo_getkey (struct grub_term_input *termi) - return ret; - } - -- grub_terminfo_readkey (termi, data->input_buf, -- &data->npending, data->readkey); -+ grub_terminfo_readkey (termi, data->input_buf, &data->npending, -+ GRUB_TERMINFO_READKEY_MAX_LEN, data->readkey); - - #if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275) - if (data->npending == 1 && data->input_buf[0] == GRUB_TERM_ESC diff --git a/0236-udf-Fix-memory-leak.patch b/0236-udf-Fix-memory-leak.patch deleted file mode 100644 index 6b8f0922..00000000 --- a/0236-udf-Fix-memory-leak.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Konrad Rzeszutek Wilk -Date: Tue, 7 Jul 2020 22:02:31 -0400 -Subject: [PATCH] udf: Fix memory leak - -Fixes: CID 73796 - -Signed-off-by: Konrad Rzeszutek Wilk -Reviewed-by: Daniel Kiper -Reviewed-by: Jan Setje-Eilers -Upstream-commit-id: 8da62d8183c ---- - grub-core/fs/udf.c | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - -diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c -index 21ac7f4460d..2ac5c1d0048 100644 ---- a/grub-core/fs/udf.c -+++ b/grub-core/fs/udf.c -@@ -965,8 +965,10 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir, - return 0; - - if (grub_udf_read_icb (dir->data, &dirent.icb, child)) -- return 0; -- -+ { -+ grub_free (child); -+ return 0; -+ } - if (dirent.characteristics & GRUB_UDF_FID_CHAR_PARENT) - { - /* This is the parent directory. */ -@@ -988,11 +990,18 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir, - dirent.file_ident_length, - (char *) raw)) - != dirent.file_ident_length) -- return 0; -+ { -+ grub_free (child); -+ return 0; -+ } - - filename = read_string (raw, dirent.file_ident_length, 0); - if (!filename) -- grub_print_error (); -+ { -+ /* As the hook won't get called. */ -+ grub_free (child); -+ grub_print_error (); -+ } - - if (filename && hook (filename, type, child, hook_data)) - { diff --git a/0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch b/0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch deleted file mode 100644 index 18c0a499..00000000 --- a/0237-multiboot2-Fix-memory-leak-if-grub_create_loader_cmd.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Konrad Rzeszutek Wilk -Date: Fri, 26 Jun 2020 10:51:43 -0400 -Subject: [PATCH] multiboot2: Fix memory leak if grub_create_loader_cmdline() - fails - -Fixes: CID 292468 - -Signed-off-by: Konrad Rzeszutek Wilk -Reviewed-by: Daniel Kiper -Upstream-commit-id: cd6760b6289 ---- - grub-core/loader/multiboot_mbi2.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c -index 53da7861516..0efc660620e 100644 ---- a/grub-core/loader/multiboot_mbi2.c -+++ b/grub-core/loader/multiboot_mbi2.c -@@ -1070,7 +1070,11 @@ grub_multiboot2_add_module (grub_addr_t start, grub_size_t size, - err = grub_create_loader_cmdline (argc, argv, newmod->cmdline, - newmod->cmdline_size, GRUB_VERIFY_MODULE_CMDLINE); - if (err) -- return err; -+ { -+ grub_free (newmod->cmdline); -+ grub_free (newmod); -+ return err; -+ } - - if (modules_last) - modules_last->next = newmod; diff --git a/0238-tftp-Do-not-use-priority-queue.patch b/0238-tftp-Do-not-use-priority-queue.patch deleted file mode 100644 index 9a1750e3..00000000 --- a/0238-tftp-Do-not-use-priority-queue.patch +++ /dev/null @@ -1,278 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexey Makhalov -Date: Thu, 9 Jul 2020 08:10:40 +0000 -Subject: [PATCH] tftp: Do not use priority queue - -There is not need to reassemble the order of blocks. Per RFC 1350, -server must wait for the ACK, before sending next block. Data packets -can be served immediately without putting them to priority queue. - -Logic to handle incoming packet is this: - - if packet block id equal to expected block id, then - process the packet, - - if packet block id is less than expected - this is retransmit - of old packet, then ACK it and drop the packet, - - if packet block id is more than expected - that shouldn't - happen, just drop the packet. - -It makes the tftp receive path code simpler, smaller and faster. -As a benefit, this change fixes CID# 73624 and CID# 96690, caused -by following while loop: - - while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0) - -where tftph pointer is not moving from one iteration to another, causing -to serve same packet again. Luckily, double serving didn't happen due to -data->block++ during the first iteration. - -Fixes: CID 73624, CID 96690 - -Signed-off-by: Alexey Makhalov -Reviewed-by: Daniel Kiper -Upstream-commit-id: 8316694c4f7 ---- - grub-core/net/tftp.c | 162 ++++++++++++++++----------------------------------- - 1 file changed, 50 insertions(+), 112 deletions(-) - -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 4920c3a9783..22badd74316 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -25,7 +25,6 @@ - #include - #include - #include --#include - #include - - GRUB_MOD_LICENSE ("GPLv3+"); -@@ -106,31 +105,8 @@ typedef struct tftp_data - int have_oack; - struct grub_error_saved save_err; - grub_net_udp_socket_t sock; -- grub_priority_queue_t pq; - } *tftp_data_t; - --static int --cmp_block (grub_uint16_t a, grub_uint16_t b) --{ -- grub_int16_t i = (grub_int16_t) (a - b); -- if (i > 0) -- return +1; -- if (i < 0) -- return -1; -- return 0; --} -- --static int --cmp (const void *a__, const void *b__) --{ -- struct grub_net_buff *a_ = *(struct grub_net_buff **) a__; -- struct grub_net_buff *b_ = *(struct grub_net_buff **) b__; -- struct tftphdr *a = (struct tftphdr *) a_->data; -- struct tftphdr *b = (struct tftphdr *) b_->data; -- /* We want the first elements to be on top. */ -- return -cmp_block (grub_be_to_cpu16 (a->u.data.block), grub_be_to_cpu16 (b->u.data.block)); --} -- - static grub_err_t - ack (tftp_data_t data, grub_uint64_t block) - { -@@ -207,73 +183,60 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), - return GRUB_ERR_NONE; - } - -- err = grub_priority_queue_push (data->pq, &nb); -- if (err) -- return err; -+ /* Ack old/retransmitted block. */ -+ if (grub_be_to_cpu16 (tftph->u.data.block) < data->block + 1) -+ ack (data, grub_be_to_cpu16 (tftph->u.data.block)); -+ /* Ignore unexpected block. */ -+ else if (grub_be_to_cpu16 (tftph->u.data.block) > data->block + 1) -+ grub_dprintf ("tftp", "TFTP unexpected block # %d\n", tftph->u.data.block); -+ else -+ { -+ unsigned size; - -- { -- struct grub_net_buff **nb_top_p, *nb_top; -- while (1) -- { -- nb_top_p = grub_priority_queue_top (data->pq); -- if (!nb_top_p) -- return GRUB_ERR_NONE; -- nb_top = *nb_top_p; -- tftph = (struct tftphdr *) nb_top->data; -- if (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) >= 0) -- break; -- ack (data, grub_be_to_cpu16 (tftph->u.data.block)); -- grub_netbuff_free (nb_top); -- grub_priority_queue_pop (data->pq); -- } -- while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0) -- { -- unsigned size; -- -- grub_priority_queue_pop (data->pq); -- -- if (file->device->net->packs.count < 50) -+ if (file->device->net->packs.count < 50) -+ { - err = ack (data, data->block + 1); -- else -- { -- file->device->net->stall = 1; -- err = 0; -- } -- if (err) -- return err; -+ if (err) -+ return err; -+ } -+ else -+ file->device->net->stall = 1; - -- err = grub_netbuff_pull (nb_top, sizeof (tftph->opcode) + -- sizeof (tftph->u.data.block)); -- if (err) -- return err; -- size = nb_top->tail - nb_top->data; -+ err = grub_netbuff_pull (nb, sizeof (tftph->opcode) + -+ sizeof (tftph->u.data.block)); -+ if (err) -+ return err; -+ size = nb->tail - nb->data; - -- data->block++; -- if (size < data->block_size) -- { -- if (data->ack_sent < data->block) -- ack (data, data->block); -- file->device->net->eof = 1; -- file->device->net->stall = 1; -- grub_net_udp_close (data->sock); -- data->sock = NULL; -- } -- /* Prevent garbage in broken cards. Is it still necessary -- given that IP implementation has been fixed? -- */ -- if (size > data->block_size) -- { -- err = grub_netbuff_unput (nb_top, size - data->block_size); -- if (err) -- return err; -- } -- /* If there is data, puts packet in socket list. */ -- if ((nb_top->tail - nb_top->data) > 0) -- grub_net_put_packet (&file->device->net->packs, nb_top); -- else -- grub_netbuff_free (nb_top); -- } -- } -+ data->block++; -+ if (size < data->block_size) -+ { -+ if (data->ack_sent < data->block) -+ ack (data, data->block); -+ file->device->net->eof = 1; -+ file->device->net->stall = 1; -+ grub_net_udp_close (data->sock); -+ data->sock = NULL; -+ } -+ /* -+ * Prevent garbage in broken cards. Is it still necessary -+ * given that IP implementation has been fixed? -+ */ -+ if (size > data->block_size) -+ { -+ err = grub_netbuff_unput (nb, size - data->block_size); -+ if (err) -+ return err; -+ } -+ /* If there is data, puts packet in socket list. */ -+ if ((nb->tail - nb->data) > 0) -+ { -+ grub_net_put_packet (&file->device->net->packs, nb); -+ /* Do not free nb. */ -+ return GRUB_ERR_NONE; -+ } -+ } -+ grub_netbuff_free (nb); - return GRUB_ERR_NONE; - case TFTP_ERROR: - data->have_oack = 1; -@@ -287,19 +250,6 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), - } - } - --static void --destroy_pq (tftp_data_t data) --{ -- struct grub_net_buff **nb_p; -- while ((nb_p = grub_priority_queue_top (data->pq))) -- { -- grub_netbuff_free (*nb_p); -- grub_priority_queue_pop (data->pq); -- } -- -- grub_priority_queue_destroy (data->pq); --} -- - /* Create a normalized copy of the filename. - Compress any string of consecutive forward slashes to a single forward - slash. */ -@@ -395,13 +345,6 @@ tftp_open (struct grub_file *file, const char *filename) - file->not_easily_seekable = 1; - file->data = data; - -- data->pq = grub_priority_queue_new (sizeof (struct grub_net_buff *), cmp); -- if (!data->pq) -- { -- grub_free (data); -- return grub_errno; -- } -- - grub_dprintf ("tftp", "resolving address for %s\n", file->device->net->server); - err = grub_net_resolve_address (file->device->net->server, &addr); - if (err) -@@ -410,7 +353,6 @@ tftp_open (struct grub_file *file, const char *filename) - grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n", - (unsigned long long)data->file_size, - (unsigned long long)data->block_size); -- destroy_pq (data); - grub_free (data); - return err; - } -@@ -422,7 +364,6 @@ tftp_open (struct grub_file *file, const char *filename) - if (!data->sock) - { - grub_dprintf ("tftp", "connection failed\n"); -- destroy_pq (data); - grub_free (data); - return grub_errno; - } -@@ -436,7 +377,6 @@ tftp_open (struct grub_file *file, const char *filename) - if (err) - { - grub_net_udp_close (data->sock); -- destroy_pq (data); - grub_free (data); - return err; - } -@@ -453,7 +393,6 @@ tftp_open (struct grub_file *file, const char *filename) - if (grub_errno) - { - grub_net_udp_close (data->sock); -- destroy_pq (data); - grub_free (data); - return grub_errno; - } -@@ -496,7 +435,6 @@ tftp_close (struct grub_file *file) - grub_print_error (); - grub_net_udp_close (data->sock); - } -- destroy_pq (data); - grub_free (data); - return GRUB_ERR_NONE; - } diff --git a/0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch b/0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch deleted file mode 100644 index b68f3a16..00000000 --- a/0239-multiboot2-Set-min-address-for-mbi-allocation-to-0x1.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lukasz Hawrylko -Date: Mon, 16 Dec 2019 11:15:55 +0100 -Subject: [PATCH] multiboot2: Set min address for mbi allocation to 0x1000 - -In some cases GRUB2 allocates multiboot2 structure at 0 address, that is -a confusing behavior. Consumers of that structure can have internal NULL-checks -that will throw an error when get a pointer to data allocated at address 0. -To prevent that, define min address for mbi allocation on x86 and x86_64 -platforms. - -Signed-off-by: Lukasz Hawrylko -Reviewed-by: Daniel Kiper -Upstream-commit-id: 0f3f5b7c13f ---- - grub-core/loader/multiboot_mbi2.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c -index 0efc660620e..e88c9f4884f 100644 ---- a/grub-core/loader/multiboot_mbi2.c -+++ b/grub-core/loader/multiboot_mbi2.c -@@ -48,6 +48,12 @@ - #define HAS_VGA_TEXT 0 - #endif - -+#if defined (__i386__) || defined (__x86_64__) -+#define MBI_MIN_ADDR 0x1000 -+#else -+#define MBI_MIN_ADDR 0 -+#endif -+ - struct module - { - struct module *next; -@@ -708,7 +714,7 @@ grub_multiboot2_make_mbi (grub_uint32_t *target) - COMPILE_TIME_ASSERT (MULTIBOOT_TAG_ALIGN % sizeof (grub_properly_aligned_t) == 0); - - err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch, -- 0, 0xffffffff - bufsize, -+ MBI_MIN_ADDR, 0xffffffff - bufsize, - bufsize, MULTIBOOT_TAG_ALIGN, - GRUB_RELOCATOR_PREFERENCE_NONE, 1); - if (err) diff --git a/0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch b/0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch deleted file mode 100644 index 3c054cc6..00000000 --- a/0240-relocator-Protect-grub_relocator_alloc_chunk_addr-in.patch +++ /dev/null @@ -1,147 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexey Makhalov -Date: Wed, 15 Jul 2020 06:42:37 +0000 -Subject: [PATCH] relocator: Protect grub_relocator_alloc_chunk_addr() input - args against integer underflow/overflow - -Use arithmetic macros from safemath.h to accomplish it. In this commit, -I didn't want to be too paranoid to check every possible math equation -for overflow/underflow. Only obvious places (with non zero chance of -overflow/underflow) were refactored. - -Signed-off-by: Alexey Makhalov -Reviewed-by: Daniel Kiper -Upstream-commit-id: ebb15735f10 ---- - grub-core/loader/i386/linux.c | 9 +++++++-- - grub-core/loader/i386/pc/linux.c | 9 +++++++-- - grub-core/loader/i386/xen.c | 12 ++++++++++-- - grub-core/loader/xnu.c | 11 +++++++---- - 4 files changed, 31 insertions(+), 10 deletions(-) - -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 201e6597c6d..90f2315f847 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -548,9 +549,13 @@ grub_linux_boot (void) - - { - grub_relocator_chunk_t ch; -+ grub_size_t sz; -+ -+ if (grub_add (ctx.real_size, efi_mmap_size, &sz)) -+ return GRUB_ERR_OUT_OF_RANGE; -+ - err = grub_relocator_alloc_chunk_addr (relocator, &ch, -- ctx.real_mode_target, -- (ctx.real_size + efi_mmap_size)); -+ ctx.real_mode_target, sz); - if (err) - return err; - real_mode_mem = get_virtual_current_address (ch); -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 0bf0e13d647..33d1196b1e2 100644 ---- a/grub-core/loader/i386/pc/linux.c -+++ b/grub-core/loader/i386/pc/linux.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -231,8 +232,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS; - - real_size = setup_sects << GRUB_DISK_SECTOR_BITS; -- grub_linux16_prot_size = grub_file_size (file) -- - real_size - GRUB_DISK_SECTOR_SIZE; -+ if (grub_sub (grub_file_size (file), real_size, &grub_linux16_prot_size) || -+ grub_sub (grub_linux16_prot_size, GRUB_DISK_SECTOR_SIZE, &grub_linux16_prot_size)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ goto fail; -+ } - - if (! grub_linux_is_bzimage - && GRUB_LINUX_ZIMAGE_ADDR + grub_linux16_prot_size -diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c -index 8f662c8ac89..cd24874ca32 100644 ---- a/grub-core/loader/i386/xen.c -+++ b/grub-core/loader/i386/xen.c -@@ -41,6 +41,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -636,6 +637,7 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)), - grub_relocator_chunk_t ch; - grub_addr_t kern_start; - grub_addr_t kern_end; -+ grub_size_t sz; - - if (argc == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -703,8 +705,14 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)), - - xen_state.max_addr = ALIGN_UP (kern_end, PAGE_SIZE); - -- err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch, kern_start, -- kern_end - kern_start); -+ -+ if (grub_sub (kern_end, kern_start, &sz)) -+ { -+ err = GRUB_ERR_OUT_OF_RANGE; -+ goto fail; -+ } -+ -+ err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch, kern_start, sz); - if (err) - goto fail; - kern_chunk_src = get_virtual_current_address (ch); -diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index 2f0ebd0b8bf..3fd653993f7 100644 ---- a/grub-core/loader/xnu.c -+++ b/grub-core/loader/xnu.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -60,15 +61,17 @@ grub_xnu_heap_malloc (int size, void **src, grub_addr_t *target) - { - grub_err_t err; - grub_relocator_chunk_t ch; -+ grub_addr_t tgt; -+ -+ if (grub_add (grub_xnu_heap_target_start, grub_xnu_heap_size, &tgt)) -+ return GRUB_ERR_OUT_OF_RANGE; - -- err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &ch, -- grub_xnu_heap_target_start -- + grub_xnu_heap_size, size); -+ err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &ch, tgt, size); - if (err) - return err; - - *src = get_virtual_current_address (ch); -- *target = grub_xnu_heap_target_start + grub_xnu_heap_size; -+ *target = tgt; - grub_xnu_heap_size += size; - grub_dprintf ("xnu", "val=%p\n", *src); - return GRUB_ERR_NONE; diff --git a/0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch b/0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch deleted file mode 100644 index 2ac53959..00000000 --- a/0241-relocator-Protect-grub_relocator_alloc_chunk_align-m.patch +++ /dev/null @@ -1,335 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexey Makhalov -Date: Wed, 8 Jul 2020 01:44:38 +0000 -Subject: [PATCH] relocator: Protect grub_relocator_alloc_chunk_align() - max_addr against integer underflow - -This commit introduces integer underflow mitigation in max_addr calculation -in grub_relocator_alloc_chunk_align() invocation. - -It consists of 2 fixes: - 1. Introduced grub_relocator_alloc_chunk_align_safe() wrapper function to perform - sanity check for min/max and size values, and to make safe invocation of - grub_relocator_alloc_chunk_align() with validated max_addr value. Replace all - invocations such as grub_relocator_alloc_chunk_align(..., min_addr, max_addr - size, size, ...) - by grub_relocator_alloc_chunk_align_safe(..., min_addr, max_addr, size, ...). - 2. Introduced UP_TO_TOP32(s) macro for the cases where max_addr is 32-bit top - address (0xffffffff - size + 1) or similar. - -Signed-off-by: Alexey Makhalov -Reviewed-by: Daniel Kiper -Upstream-commit-id: 10498c8ba17 ---- - grub-core/lib/i386/relocator.c | 28 +++++++++++----------------- - grub-core/lib/mips/relocator.c | 6 ++---- - grub-core/lib/powerpc/relocator.c | 6 ++---- - grub-core/lib/x86_64/efi/relocator.c | 7 +++---- - grub-core/loader/i386/linux.c | 5 ++--- - grub-core/loader/i386/multiboot_mbi.c | 7 +++---- - grub-core/loader/i386/pc/linux.c | 6 ++---- - grub-core/loader/mips/linux.c | 9 +++------ - grub-core/loader/multiboot.c | 2 +- - grub-core/loader/multiboot_elfxx.c | 10 +++++----- - grub-core/loader/multiboot_mbi2.c | 10 +++++----- - grub-core/loader/xnu_resume.c | 2 +- - include/grub/relocator.h | 29 +++++++++++++++++++++++++++++ - 13 files changed, 69 insertions(+), 58 deletions(-) - -diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c -index 71dd4f0ab0c..34cbe834fa3 100644 ---- a/grub-core/lib/i386/relocator.c -+++ b/grub-core/lib/i386/relocator.c -@@ -83,11 +83,10 @@ grub_relocator32_boot (struct grub_relocator *rel, - /* Specific memory range due to Global Descriptor Table for use by payload - that we will store in returned chunk. The address range and preference - are based on "THE LINUX/x86 BOOT PROTOCOL" specification. */ -- err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000, -- 0x9a000 - RELOCATOR_SIZEOF (32), -- RELOCATOR_SIZEOF (32), 16, -- GRUB_RELOCATOR_PREFERENCE_LOW, -- avoid_efi_bootservices); -+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0x1000, 0x9a000, -+ RELOCATOR_SIZEOF (32), 16, -+ GRUB_RELOCATOR_PREFERENCE_LOW, -+ avoid_efi_bootservices); - if (err) - return err; - -@@ -125,13 +124,10 @@ grub_relocator16_boot (struct grub_relocator *rel, - grub_relocator_chunk_t ch; - - /* Put it higher than the byte it checks for A20 check. */ -- err = grub_relocator_alloc_chunk_align (rel, &ch, 0x8010, -- 0xa0000 - RELOCATOR_SIZEOF (16) -- - GRUB_RELOCATOR16_STACK_SIZE, -- RELOCATOR_SIZEOF (16) -- + GRUB_RELOCATOR16_STACK_SIZE, 16, -- GRUB_RELOCATOR_PREFERENCE_NONE, -- 0); -+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0x8010, 0xa0000, -+ RELOCATOR_SIZEOF (16) + -+ GRUB_RELOCATOR16_STACK_SIZE, 16, -+ GRUB_RELOCATOR_PREFERENCE_NONE, 0); - if (err) - return err; - -@@ -183,11 +179,9 @@ grub_relocator64_boot (struct grub_relocator *rel, - void *relst; - grub_relocator_chunk_t ch; - -- err = grub_relocator_alloc_chunk_align (rel, &ch, min_addr, -- max_addr - RELOCATOR_SIZEOF (64), -- RELOCATOR_SIZEOF (64), 16, -- GRUB_RELOCATOR_PREFERENCE_NONE, -- 0); -+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, min_addr, max_addr, -+ RELOCATOR_SIZEOF (64), 16, -+ GRUB_RELOCATOR_PREFERENCE_NONE, 0); - if (err) - return err; - -diff --git a/grub-core/lib/mips/relocator.c b/grub-core/lib/mips/relocator.c -index 9d5f49cb93a..743b213e695 100644 ---- a/grub-core/lib/mips/relocator.c -+++ b/grub-core/lib/mips/relocator.c -@@ -120,10 +120,8 @@ grub_relocator32_boot (struct grub_relocator *rel, - unsigned i; - grub_addr_t vtarget; - -- err = grub_relocator_alloc_chunk_align (rel, &ch, 0, -- (0xffffffff - stateset_size) -- + 1, stateset_size, -- sizeof (grub_uint32_t), -+ err = grub_relocator_alloc_chunk_align (rel, &ch, 0, UP_TO_TOP32 (stateset_size), -+ stateset_size, sizeof (grub_uint32_t), - GRUB_RELOCATOR_PREFERENCE_NONE, 0); - if (err) - return err; -diff --git a/grub-core/lib/powerpc/relocator.c b/grub-core/lib/powerpc/relocator.c -index bdf2b111be7..8ffb8b68683 100644 ---- a/grub-core/lib/powerpc/relocator.c -+++ b/grub-core/lib/powerpc/relocator.c -@@ -115,10 +115,8 @@ grub_relocator32_boot (struct grub_relocator *rel, - unsigned i; - grub_relocator_chunk_t ch; - -- err = grub_relocator_alloc_chunk_align (rel, &ch, 0, -- (0xffffffff - stateset_size) -- + 1, stateset_size, -- sizeof (grub_uint32_t), -+ err = grub_relocator_alloc_chunk_align (rel, &ch, 0, UP_TO_TOP32 (stateset_size), -+ stateset_size, sizeof (grub_uint32_t), - GRUB_RELOCATOR_PREFERENCE_NONE, 0); - if (err) - return err; -diff --git a/grub-core/lib/x86_64/efi/relocator.c b/grub-core/lib/x86_64/efi/relocator.c -index 3caef7a4021..7d200a125ee 100644 ---- a/grub-core/lib/x86_64/efi/relocator.c -+++ b/grub-core/lib/x86_64/efi/relocator.c -@@ -50,10 +50,9 @@ grub_relocator64_efi_boot (struct grub_relocator *rel, - * 64-bit relocator code may live above 4 GiB quite well. - * However, I do not want ask for problems. Just in case. - */ -- err = grub_relocator_alloc_chunk_align (rel, &ch, 0, -- 0x100000000 - RELOCATOR_SIZEOF (64_efi), -- RELOCATOR_SIZEOF (64_efi), 16, -- GRUB_RELOCATOR_PREFERENCE_NONE, 1); -+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0, 0x100000000, -+ RELOCATOR_SIZEOF (64_efi), 16, -+ GRUB_RELOCATOR_PREFERENCE_NONE, 1); - if (err) - return err; - -diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 90f2315f847..7d0c987cd91 100644 ---- a/grub-core/loader/i386/linux.c -+++ b/grub-core/loader/i386/linux.c -@@ -182,9 +182,8 @@ allocate_pages (grub_size_t prot_size, grub_size_t *align, - for (; err && *align + 1 > min_align; (*align)--) - { - grub_errno = GRUB_ERR_NONE; -- err = grub_relocator_alloc_chunk_align (relocator, &ch, -- 0x1000000, -- 0xffffffff & ~prot_size, -+ err = grub_relocator_alloc_chunk_align (relocator, &ch, 0x1000000, -+ UP_TO_TOP32 (prot_size), - prot_size, 1 << *align, - GRUB_RELOCATOR_PREFERENCE_LOW, - 1); -diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c -index ad3cc292fd1..a67d9d0a808 100644 ---- a/grub-core/loader/i386/multiboot_mbi.c -+++ b/grub-core/loader/i386/multiboot_mbi.c -@@ -466,10 +466,9 @@ grub_multiboot_make_mbi (grub_uint32_t *target) - - bufsize = grub_multiboot_get_mbi_size (); - -- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch, -- 0x10000, 0xa0000 - bufsize, -- bufsize, 4, -- GRUB_RELOCATOR_PREFERENCE_NONE, 0); -+ err = grub_relocator_alloc_chunk_align_safe (grub_multiboot_relocator, &ch, -+ 0x10000, 0xa0000, bufsize, 4, -+ GRUB_RELOCATOR_PREFERENCE_NONE, 0); - if (err) - return err; - ptrorig = get_virtual_current_address (ch); -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 33d1196b1e2..f1ad185ddc2 100644 ---- a/grub-core/loader/i386/pc/linux.c -+++ b/grub-core/loader/i386/pc/linux.c -@@ -463,10 +463,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - - { - grub_relocator_chunk_t ch; -- err = grub_relocator_alloc_chunk_align (relocator, &ch, -- addr_min, addr_max - size, -- size, 0x1000, -- GRUB_RELOCATOR_PREFERENCE_HIGH, 0); -+ err = grub_relocator_alloc_chunk_align_safe (relocator, &ch, addr_min, addr_max, size, -+ 0x1000, GRUB_RELOCATOR_PREFERENCE_HIGH, 0); - if (err) - return err; - initrd_chunk = get_virtual_current_address (ch); -diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c -index 7b723bf189d..e4ed95921df 100644 ---- a/grub-core/loader/mips/linux.c -+++ b/grub-core/loader/mips/linux.c -@@ -442,12 +442,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), - { - grub_relocator_chunk_t ch; - -- err = grub_relocator_alloc_chunk_align (relocator, &ch, -- (target_addr & 0x1fffffff) -- + linux_size + 0x10000, -- (0x10000000 - size), -- size, 0x10000, -- GRUB_RELOCATOR_PREFERENCE_NONE, 0); -+ err = grub_relocator_alloc_chunk_align_safe (relocator, &ch, (target_addr & 0x1fffffff) + -+ linux_size + 0x10000, 0x10000000, size, -+ 0x10000, GRUB_RELOCATOR_PREFERENCE_NONE, 0); - - if (err) - goto fail; -diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index 3e6ad166dc9..3e286908dda 100644 ---- a/grub-core/loader/multiboot.c -+++ b/grub-core/loader/multiboot.c -@@ -404,7 +404,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), - { - grub_relocator_chunk_t ch; - err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, -- lowest_addr, (0xffffffff - size) + 1, -+ lowest_addr, UP_TO_TOP32 (size), - size, MULTIBOOT_MOD_ALIGN, - GRUB_RELOCATOR_PREFERENCE_NONE, 1); - if (err) -diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c -index cc6853692a8..f2318e0d165 100644 ---- a/grub-core/loader/multiboot_elfxx.c -+++ b/grub-core/loader/multiboot_elfxx.c -@@ -109,10 +109,10 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - if (load_size > mld->max_addr || mld->min_addr > mld->max_addr - load_size) - return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size"); - -- err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, -- mld->min_addr, mld->max_addr - load_size, -- load_size, mld->align ? mld->align : 1, -- mld->preference, mld->avoid_efi_boot_services); -+ err = grub_relocator_alloc_chunk_align_safe (GRUB_MULTIBOOT (relocator), &ch, -+ mld->min_addr, mld->max_addr, -+ load_size, mld->align ? mld->align : 1, -+ mld->preference, mld->avoid_efi_boot_services); - - if (err) - { -@@ -256,7 +256,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) - continue; - - err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, 0, -- (0xffffffff - sh->sh_size) + 1, -+ UP_TO_TOP32 (sh->sh_size), - sh->sh_size, sh->sh_addralign, - GRUB_RELOCATOR_PREFERENCE_NONE, - mld->avoid_efi_boot_services); -diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c -index e88c9f4884f..9a943d7bdd7 100644 ---- a/grub-core/loader/multiboot_mbi2.c -+++ b/grub-core/loader/multiboot_mbi2.c -@@ -301,10 +301,10 @@ grub_multiboot2_load (grub_file_t file, const char *filename) - return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size"); - } - -- err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch, -- mld.min_addr, mld.max_addr - code_size, -- code_size, mld.align ? mld.align : 1, -- mld.preference, keep_bs); -+ err = grub_relocator_alloc_chunk_align_safe (grub_multiboot2_relocator, &ch, -+ mld.min_addr, mld.max_addr, -+ code_size, mld.align ? mld.align : 1, -+ mld.preference, keep_bs); - } - else - err = grub_relocator_alloc_chunk_addr (grub_multiboot2_relocator, -@@ -714,7 +714,7 @@ grub_multiboot2_make_mbi (grub_uint32_t *target) - COMPILE_TIME_ASSERT (MULTIBOOT_TAG_ALIGN % sizeof (grub_properly_aligned_t) == 0); - - err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch, -- MBI_MIN_ADDR, 0xffffffff - bufsize, -+ MBI_MIN_ADDR, UP_TO_TOP32 (bufsize), - bufsize, MULTIBOOT_TAG_ALIGN, - GRUB_RELOCATOR_PREFERENCE_NONE, 1); - if (err) -diff --git a/grub-core/loader/xnu_resume.c b/grub-core/loader/xnu_resume.c -index 8089804d482..d648ef0cd3a 100644 ---- a/grub-core/loader/xnu_resume.c -+++ b/grub-core/loader/xnu_resume.c -@@ -129,7 +129,7 @@ grub_xnu_resume (char *imagename) - { - grub_relocator_chunk_t ch; - err = grub_relocator_alloc_chunk_align (grub_xnu_relocator, &ch, 0, -- (0xffffffff - hibhead.image_size) + 1, -+ UP_TO_TOP32 (hibhead.image_size), - hibhead.image_size, - GRUB_XNU_PAGESIZE, - GRUB_RELOCATOR_PREFERENCE_NONE, 0); -diff --git a/include/grub/relocator.h b/include/grub/relocator.h -index 24d8672d22c..1b3bdd92ac6 100644 ---- a/include/grub/relocator.h -+++ b/include/grub/relocator.h -@@ -49,6 +49,35 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel, - int preference, - int avoid_efi_boot_services); - -+/* -+ * Wrapper for grub_relocator_alloc_chunk_align() with purpose of -+ * protecting against integer underflow. -+ * -+ * Compare to its callee, max_addr has different meaning here. -+ * It covers entire chunk and not just start address of the chunk. -+ */ -+static inline grub_err_t -+grub_relocator_alloc_chunk_align_safe (struct grub_relocator *rel, -+ grub_relocator_chunk_t *out, -+ grub_phys_addr_t min_addr, -+ grub_phys_addr_t max_addr, -+ grub_size_t size, grub_size_t align, -+ int preference, -+ int avoid_efi_boot_services) -+{ -+ /* Sanity check and ensure following equation (max_addr - size) is safe. */ -+ if (max_addr < size || (max_addr - size) < min_addr) -+ return GRUB_ERR_OUT_OF_RANGE; -+ -+ return grub_relocator_alloc_chunk_align (rel, out, min_addr, -+ max_addr - size, -+ size, align, preference, -+ avoid_efi_boot_services); -+} -+ -+/* Top 32-bit address minus s bytes and plus 1 byte. */ -+#define UP_TO_TOP32(s) ((~(s) & 0xffffffff) + 1) -+ - #define GRUB_RELOCATOR_PREFERENCE_NONE 0 - #define GRUB_RELOCATOR_PREFERENCE_LOW 1 - #define GRUB_RELOCATOR_PREFERENCE_HIGH 2 diff --git a/0242-script-Remove-unused-fields-from-grub_script_functio.patch b/0242-script-Remove-unused-fields-from-grub_script_functio.patch deleted file mode 100644 index 93beaac0..00000000 --- a/0242-script-Remove-unused-fields-from-grub_script_functio.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chris Coulson -Date: Fri, 10 Jul 2020 11:21:14 +0100 -Subject: [PATCH] script: Remove unused fields from grub_script_function struct - -Signed-off-by: Chris Coulson -Reviewed-by: Daniel Kiper -Upstream-commit-id: d04089c8e52 ---- - include/grub/script_sh.h | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h -index 360c2be1f05..b382bcf09bc 100644 ---- a/include/grub/script_sh.h -+++ b/include/grub/script_sh.h -@@ -359,13 +359,8 @@ struct grub_script_function - /* The script function. */ - struct grub_script *func; - -- /* The flags. */ -- unsigned flags; -- - /* The next element. */ - struct grub_script_function *next; -- -- int references; - }; - typedef struct grub_script_function *grub_script_function_t; - diff --git a/0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch b/0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch deleted file mode 100644 index 4435a7d4..00000000 --- a/0243-script-Avoid-a-use-after-free-when-redefining-a-func.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chris Coulson -Date: Fri, 10 Jul 2020 14:41:45 +0100 -Subject: [PATCH] script: Avoid a use-after-free when redefining a function - during execution - -Defining a new function with the same name as a previously defined -function causes the grub_script and associated resources for the -previous function to be freed. If the previous function is currently -executing when a function with the same name is defined, this results -in use-after-frees when processing subsequent commands in the original -function. - -Instead, reject a new function definition if it has the same name as -a previously defined function, and that function is currently being -executed. Although a behavioural change, this should be backwards -compatible with existing configurations because they can't be -dependent on the current behaviour without being broken. - -Signed-off-by: Chris Coulson -Reviewed-by: Daniel Kiper -Upstream-commit-id: f6253a1f540 ---- - grub-core/script/execute.c | 2 ++ - grub-core/script/function.c | 16 +++++++++++++--- - include/grub/script_sh.h | 2 ++ - grub-core/script/parser.y | 3 ++- - 4 files changed, 19 insertions(+), 4 deletions(-) - -diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index b55e171c931..d2f02cc5b38 100644 ---- a/grub-core/script/execute.c -+++ b/grub-core/script/execute.c -@@ -872,7 +872,9 @@ grub_script_function_call (grub_script_function_t func, int argc, char **args) - old_scope = scope; - scope = &new_scope; - -+ func->executing++; - ret = grub_script_execute (func->func); -+ func->executing--; - - function_return = 0; - active_loops = loops; -diff --git a/grub-core/script/function.c b/grub-core/script/function.c -index d36655e510f..3aad04bf9dd 100644 ---- a/grub-core/script/function.c -+++ b/grub-core/script/function.c -@@ -34,6 +34,7 @@ grub_script_function_create (struct grub_script_arg *functionname_arg, - func = (grub_script_function_t) grub_malloc (sizeof (*func)); - if (! func) - return 0; -+ func->executing = 0; - - func->name = grub_strdup (functionname_arg->str); - if (! func->name) -@@ -60,10 +61,19 @@ grub_script_function_create (struct grub_script_arg *functionname_arg, - grub_script_function_t q; - - q = *p; -- grub_script_free (q->func); -- q->func = cmd; - grub_free (func); -- func = q; -+ if (q->executing > 0) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, -+ N_("attempt to redefine a function being executed")); -+ func = NULL; -+ } -+ else -+ { -+ grub_script_free (q->func); -+ q->func = cmd; -+ func = q; -+ } - } - else - { -diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h -index b382bcf09bc..6c48e075122 100644 ---- a/include/grub/script_sh.h -+++ b/include/grub/script_sh.h -@@ -361,6 +361,8 @@ struct grub_script_function - - /* The next element. */ - struct grub_script_function *next; -+ -+ unsigned executing; - }; - typedef struct grub_script_function *grub_script_function_t; - -diff --git a/grub-core/script/parser.y b/grub-core/script/parser.y -index 4f0ab8319e3..f80b86b6f15 100644 ---- a/grub-core/script/parser.y -+++ b/grub-core/script/parser.y -@@ -289,7 +289,8 @@ function: "function" "name" - grub_script_mem_free (state->func_mem); - else { - script->children = state->scripts; -- grub_script_function_create ($2, script); -+ if (!grub_script_function_create ($2, script)) -+ grub_script_free (script); - } - - state->scripts = $3; diff --git a/0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch b/0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch deleted file mode 100644 index 850fef76..00000000 --- a/0244-relocator-Fix-grub_relocator_alloc_chunk_align-top-m.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexey Makhalov -Date: Fri, 17 Jul 2020 05:17:26 +0000 -Subject: [PATCH] relocator: Fix grub_relocator_alloc_chunk_align() top memory - allocation - -Current implementation of grub_relocator_alloc_chunk_align() -does not allow allocation of the top byte. - -Assuming input args are: - max_addr = 0xfffff000; - size = 0x1000; - -And this is valid. But following overflow protection will -unnecessarily move max_addr one byte down (to 0xffffefff): - if (max_addr > ~size) - max_addr = ~size; - -~size + 1 will fix the situation. In addition, check size -for non zero to do not zero max_addr. - -Signed-off-by: Alexey Makhalov -Reviewed-by: Daniel Kiper -Upstream-commit-id: ab80a97eb1f ---- - grub-core/lib/relocator.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c -index 5847aac3643..f2c1944c28d 100644 ---- a/grub-core/lib/relocator.c -+++ b/grub-core/lib/relocator.c -@@ -1386,8 +1386,8 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel, - }; - grub_addr_t min_addr2 = 0, max_addr2; - -- if (max_addr > ~size) -- max_addr = ~size; -+ if (size && (max_addr > ~size)) -+ max_addr = ~size + 1; - - #ifdef GRUB_MACHINE_PCBIOS - if (min_addr < 0x1000) diff --git a/0245-hfsplus-fix-two-more-overflows.patch b/0245-hfsplus-fix-two-more-overflows.patch deleted file mode 100644 index 937918f7..00000000 --- a/0245-hfsplus-fix-two-more-overflows.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Sun, 19 Jul 2020 14:43:31 -0400 -Subject: [PATCH] hfsplus: fix two more overflows - -Both node->size and node->namelen come from the supplied filesystem, -which may be user-supplied. We can't trust them for the math unless we -know they don't overflow; making sure they go through calloc() first -will give us that. - -Signed-off-by: Peter Jones -Reviewed-by: Darren Kenny -Upstream-commit-id: b4915078903 ---- - grub-core/fs/hfsplus.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c -index dae43becc97..9c4e4c88c99 100644 ---- a/grub-core/fs/hfsplus.c -+++ b/grub-core/fs/hfsplus.c -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -475,8 +476,12 @@ grub_hfsplus_read_symlink (grub_fshelp_node_t node) - { - char *symlink; - grub_ssize_t numread; -+ grub_size_t sz = node->size; - -- symlink = grub_malloc (node->size + 1); -+ if (grub_add (sz, 1, &sz)) -+ return NULL; -+ -+ symlink = grub_malloc (sz); - if (!symlink) - return 0; - -@@ -715,8 +720,8 @@ list_nodes (void *record, void *hook_arg) - if (type == GRUB_FSHELP_UNKNOWN) - return 0; - -- filename = grub_malloc (grub_be_to_cpu16 (catkey->namelen) -- * GRUB_MAX_UTF8_PER_UTF16 + 1); -+ filename = grub_calloc (grub_be_to_cpu16 (catkey->namelen), -+ GRUB_MAX_UTF8_PER_UTF16 + 1); - if (! filename) - return 0; - diff --git a/0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch b/0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch deleted file mode 100644 index 31e7f072..00000000 --- a/0246-lvm-fix-two-more-potential-data-dependent-alloc-over.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Sun, 19 Jul 2020 15:48:20 -0400 -Subject: [PATCH] lvm: fix two more potential data-dependent alloc overflows - -It appears to be possible to make a (possibly invalid) lvm PV with a -metadata size field that overflows our type when adding it to the -address we've allocated. Even if it doesn't, it may be possible to do -so with the math using the outcome of that as an operand. Check them -both. - -Signed-off-by: Peter Jones -Signed-off-by: Darren Kenny -Upstream-commit-id: 45ec6046ea0 ---- - grub-core/disk/lvm.c | 47 +++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 39 insertions(+), 8 deletions(-) - -diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c -index 8e76d1ae121..cca8ec668ba 100644 ---- a/grub-core/disk/lvm.c -+++ b/grub-core/disk/lvm.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - - #ifdef GRUB_UTIL - #include -@@ -102,10 +103,11 @@ grub_lvm_detect (grub_disk_t disk, - { - grub_err_t err; - grub_uint64_t mda_offset, mda_size; -+ grub_size_t ptr; - char buf[GRUB_LVM_LABEL_SIZE]; - char vg_id[GRUB_LVM_ID_STRLEN+1]; - char pv_id[GRUB_LVM_ID_STRLEN+1]; -- char *metadatabuf, *vgname; -+ char *metadatabuf, *mda_end, *vgname; - const char *p, *q; - struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf; - struct grub_lvm_pv_header *pvh; -@@ -206,19 +208,31 @@ grub_lvm_detect (grub_disk_t disk, - grub_le_to_cpu64 (rlocn->size) - - grub_le_to_cpu64 (mdah->size)); - } -- p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset); - -- while (*q != ' ' && q < metadatabuf + mda_size) -- q++; -- -- if (q == metadatabuf + mda_size) -+ if (grub_add ((grub_size_t)metadatabuf, -+ (grub_size_t)grub_le_to_cpu64 (rlocn->offset), -+ &ptr)) - { -+error_parsing_metadata: - #ifdef GRUB_UTIL - grub_util_info ("error parsing metadata"); - #endif - goto fail2; - } - -+ p = q = (char *)ptr; -+ -+ if (grub_add ((grub_size_t)metadatabuf, (grub_size_t)mda_size, &ptr)) -+ goto error_parsing_metadata; -+ -+ mda_end = (char *)ptr; -+ -+ while (*q != ' ' && q < mda_end) -+ q++; -+ -+ if (q == mda_end) -+ goto error_parsing_metadata; -+ - vgname_len = q - p; - vgname = grub_malloc (vgname_len + 1); - if (!vgname) -@@ -368,8 +382,25 @@ grub_lvm_detect (grub_disk_t disk, - { - const char *iptr; - char *optr; -- lv->fullname = grub_malloc (sizeof ("lvm/") - 1 + 2 * vgname_len -- + 1 + 2 * s + 1); -+ -+ /* this is kind of hard to read with our safe (but rather -+ * baroque) math primatives, but it boils down to: -+ * -+ * sz0 = vgname_len * 2 + 1 -+ * + s * 2 + 1 -+ * + sizeof ("lvm/") - 1; -+ */ -+ grub_size_t sz0 = vgname_len, sz1 = s; -+ -+ if (grub_mul (sz0, 2, &sz0) || -+ grub_add (sz0, 1, &sz0) || -+ grub_mul (sz1, 2, &sz1) || -+ grub_add (sz1, 1, &sz1) || -+ grub_add (sz0, sz1, &sz0) || -+ grub_add (sz0, sizeof ("lvm/") - 1, &sz0)) -+ goto lvs_fail; -+ -+ lv->fullname = grub_malloc (sz0); - if (!lv->fullname) - goto lvs_fail; - diff --git a/0247-emu-make-grub_free-NULL-safe.patch b/0247-emu-make-grub_free-NULL-safe.patch deleted file mode 100644 index 64ecc344..00000000 --- a/0247-emu-make-grub_free-NULL-safe.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Sun, 19 Jul 2020 16:08:08 -0400 -Subject: [PATCH] emu: make grub_free(NULL) safe - -The grub_free() implementation in kern/mm.c safely handles NULL -pointers, and code at many places depends on this. We don't know that -the same is true on all host OSes, so we need to handle the same -behavior in grub-emu's implementation. - -Signed-off-by: Peter Jones -Reviewed-by: Darren Kenny -Upstream-commit-id: 96bb109e658 ---- - grub-core/kern/emu/mm.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c -index 145b01d3719..4d1046a219e 100644 ---- a/grub-core/kern/emu/mm.c -+++ b/grub-core/kern/emu/mm.c -@@ -60,7 +60,8 @@ grub_zalloc (grub_size_t size) - void - grub_free (void *ptr) - { -- free (ptr); -+ if (ptr) -+ free (ptr); - } - - void * diff --git a/0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch b/0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch deleted file mode 100644 index a18412ff..00000000 --- a/0248-efi-fix-some-malformed-device-path-arithmetic-errors.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Sun, 19 Jul 2020 16:53:27 -0400 -Subject: [PATCH] efi: fix some malformed device path arithmetic errors. - -Several places we take the length of a device path and subtract 4 from -it, without ever checking that it's >= 4. There are also cases where -this kind of malformation will result in unpredictable iteration, -including treating the length from one dp node as the type in the next -node. These are all errors, no matter where the data comes from. - -This patch adds a checking macro, GRUB_EFI_DEVICE_PATH_VALID(), which -can be used in several places, and makes GRUB_EFI_NEXT_DEVICE_PATH() -return NULL and GRUB_EFI_END_ENTIRE_DEVICE_PATH() evaluate as true when -the length is too small. Additionally, it makes several places in the -code check for and return errors in these cases. - -Signed-off-by: Peter Jones -Upstream-commit-id: 23e68a83990 ---- - grub-core/kern/efi/efi.c | 67 ++++++++++++++++++++++++++++++++------ - grub-core/loader/efi/chainloader.c | 19 +++++++++-- - grub-core/loader/i386/xnu.c | 9 ++--- - include/grub/efi/api.h | 14 +++++--- - 4 files changed, 88 insertions(+), 21 deletions(-) - -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index ab133fecce0..8c09e60987d 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -350,7 +350,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - - dp = dp0; - -- while (1) -+ while (dp) - { - grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); - grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); -@@ -360,9 +360,15 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - if (type == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE - && subtype == GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE) - { -- grub_efi_uint16_t len; -- len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4) -- / sizeof (grub_efi_char16_t)); -+ grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp); -+ -+ if (len < 4) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, -+ "malformed EFI Device Path node has length=%d", len); -+ return NULL; -+ } -+ len = (len - 4) / sizeof (grub_efi_char16_t); - filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2; - } - -@@ -378,7 +384,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - if (!name) - return NULL; - -- while (1) -+ while (dp) - { - grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); - grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); -@@ -394,8 +400,15 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - - *p++ = '/'; - -- len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4) -- / sizeof (grub_efi_char16_t)); -+ len = GRUB_EFI_DEVICE_PATH_LENGTH (dp); -+ if (len < 4) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, -+ "malformed EFI Device Path node has length=%d", len); -+ return NULL; -+ } -+ -+ len = (len - 4) / sizeof (grub_efi_char16_t); - fp = (grub_efi_file_path_device_path_t *) dp; - /* According to EFI spec Path Name is NULL terminated */ - while (len > 0 && fp->path_name[len - 1] == 0) -@@ -470,7 +483,26 @@ grub_efi_duplicate_device_path (const grub_efi_device_path_t *dp) - ; - p = GRUB_EFI_NEXT_DEVICE_PATH (p)) - { -- total_size += GRUB_EFI_DEVICE_PATH_LENGTH (p); -+ grub_size_t len = GRUB_EFI_DEVICE_PATH_LENGTH (p); -+ -+ /* -+ * In the event that we find a node that's completely garbage, for -+ * example if we get to 0x7f 0x01 0x02 0x00 ... (EndInstance with a size -+ * of 2), GRUB_EFI_END_ENTIRE_DEVICE_PATH() will be true and -+ * GRUB_EFI_NEXT_DEVICE_PATH() will return NULL, so we won't continue, -+ * and neither should our consumers, but there won't be any error raised -+ * even though the device path is junk. -+ * -+ * This keeps us from passing junk down back to our caller. -+ */ -+ if (len < 4) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, -+ "malformed EFI Device Path node has length=%d", len); -+ return NULL; -+ } -+ -+ total_size += len; - if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (p)) - break; - } -@@ -515,7 +547,7 @@ dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor) - void - grub_efi_print_device_path (grub_efi_device_path_t *dp) - { -- while (1) -+ while (GRUB_EFI_DEVICE_PATH_VALID (dp)) - { - grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); - grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); -@@ -987,7 +1019,11 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1, - /* Return non-zero. */ - return 1; - -- while (1) -+ if (dp1 == dp2) -+ return 0; -+ -+ while (GRUB_EFI_DEVICE_PATH_VALID (dp1) -+ && GRUB_EFI_DEVICE_PATH_VALID (dp2)) - { - grub_efi_uint8_t type1, type2; - grub_efi_uint8_t subtype1, subtype2; -@@ -1023,5 +1059,16 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1, - dp2 = (grub_efi_device_path_t *) ((char *) dp2 + len2); - } - -+ /* -+ * There's no "right" answer here, but we probably don't want to call a valid -+ * dp and an invalid dp equal, so pick one way or the other. -+ */ -+ if (GRUB_EFI_DEVICE_PATH_VALID (dp1) && -+ !GRUB_EFI_DEVICE_PATH_VALID (dp2)) -+ return 1; -+ else if (!GRUB_EFI_DEVICE_PATH_VALID (dp1) && -+ GRUB_EFI_DEVICE_PATH_VALID (dp2)) -+ return -1; -+ - return 0; - } -diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 736505173cb..5f7c6cfe105 100644 ---- a/grub-core/loader/efi/chainloader.c -+++ b/grub-core/loader/efi/chainloader.c -@@ -125,6 +125,12 @@ copy_file_path (grub_efi_file_path_device_path_t *fp, - fp->header.type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE; - fp->header.subtype = GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE; - -+ if (!GRUB_EFI_DEVICE_PATH_VALID ((grub_efi_device_path_t *)fp)) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "EFI Device Path is invalid"); -+ return; -+ } -+ - path_name = grub_calloc (len, GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); - if (!path_name) - return; -@@ -165,9 +171,18 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) - - size = 0; - d = dp; -- while (1) -+ while (d) - { -- size += GRUB_EFI_DEVICE_PATH_LENGTH (d); -+ grub_size_t len = GRUB_EFI_DEVICE_PATH_LENGTH (d); -+ -+ if (len < 4) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, -+ "malformed EFI Device Path node has length=%d", len); -+ return NULL; -+ } -+ -+ size += len; - if ((GRUB_EFI_END_ENTIRE_DEVICE_PATH (d))) - break; - d = GRUB_EFI_NEXT_DEVICE_PATH (d); -diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c -index e9e11925972..a7009360732 100644 ---- a/grub-core/loader/i386/xnu.c -+++ b/grub-core/loader/i386/xnu.c -@@ -515,14 +515,15 @@ grub_cmd_devprop_load (grub_command_t cmd __attribute__ ((unused)), - - devhead = buf; - buf = devhead + 1; -- dpstart = buf; -+ dp = dpstart = buf; - -- do -+ while (GRUB_EFI_DEVICE_PATH_VALID (dp) && buf < bufend) - { -- dp = buf; - buf = (char *) buf + GRUB_EFI_DEVICE_PATH_LENGTH (dp); -+ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp)) -+ break; -+ dp = buf; - } -- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp) && buf < bufend); - - dev = grub_xnu_devprop_add_device (dpstart, (char *) buf - - (char *) dpstart); -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index dec7b06083e..fc8a564e94d 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h -@@ -666,6 +666,7 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t; - #define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f) - #define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype) - #define GRUB_EFI_DEVICE_PATH_LENGTH(dp) ((dp)->length) -+#define GRUB_EFI_DEVICE_PATH_VALID(dp) ((dp) != NULL && GRUB_EFI_DEVICE_PATH_LENGTH (dp) >= 4) - - /* The End of Device Path nodes. */ - #define GRUB_EFI_END_DEVICE_PATH_TYPE (0xff & 0x7f) -@@ -674,13 +675,16 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t; - #define GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE 0x01 - - #define GRUB_EFI_END_ENTIRE_DEVICE_PATH(dp) \ -- (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \ -- && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \ -- == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)) -+ (!GRUB_EFI_DEVICE_PATH_VALID (dp) || \ -+ (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \ -+ && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \ -+ == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE))) - - #define GRUB_EFI_NEXT_DEVICE_PATH(dp) \ -- ((grub_efi_device_path_t *) ((char *) (dp) \ -- + GRUB_EFI_DEVICE_PATH_LENGTH (dp))) -+ (GRUB_EFI_DEVICE_PATH_VALID (dp) \ -+ ? ((grub_efi_device_path_t *) \ -+ ((char *) (dp) + GRUB_EFI_DEVICE_PATH_LENGTH (dp))) \ -+ : NULL) - - /* Hardware Device Path. */ - #define GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE 1 diff --git a/0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch b/0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch deleted file mode 100644 index 1bccfd67..00000000 --- a/0249-Fix-a-regression-caused-by-efi-fix-some-malformed-de.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chris Coulson -Date: Wed, 22 Jul 2020 17:06:04 +0100 -Subject: [PATCH] Fix a regression caused by "efi: fix some malformed device - path arithmetic errors" - -This commit introduced a bogus check inside copy_file_path to -determine whether the destination grub_efi_file_path_device_path_t -was valid before anything was copied to it. Depending on the -contents of the heap buffer, this check could fail which would -result in copy_file_path returning early. - -Without any error propagated to the caller, make_file_path would -then try to advance the invalid device path node with -GRUB_EFI_NEXT_DEVICE_PATH, which would also fail, returning a NULL -pointer that would subsequently be dereferenced. - -Remove the bogus check, and also propagate errors from copy_file_path. ---- - grub-core/loader/efi/chainloader.c | 25 +++++++++++++------------ - 1 file changed, 13 insertions(+), 12 deletions(-) - -diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 5f7c6cfe105..3dfa41bb49d 100644 ---- a/grub-core/loader/efi/chainloader.c -+++ b/grub-core/loader/efi/chainloader.c -@@ -115,7 +115,7 @@ grub_chainloader_boot (void) - return grub_errno; - } - --static void -+static grub_err_t - copy_file_path (grub_efi_file_path_device_path_t *fp, - const char *str, grub_efi_uint16_t len) - { -@@ -125,15 +125,9 @@ copy_file_path (grub_efi_file_path_device_path_t *fp, - fp->header.type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE; - fp->header.subtype = GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE; - -- if (!GRUB_EFI_DEVICE_PATH_VALID ((grub_efi_device_path_t *)fp)) -- { -- grub_error (GRUB_ERR_BAD_ARGUMENT, "EFI Device Path is invalid"); -- return; -- } -- - path_name = grub_calloc (len, GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); - if (!path_name) -- return; -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "failed to allocate path buffer"); - - size = grub_utf8_to_utf16 (path_name, len * GRUB_MAX_UTF16_PER_UTF8, - (const grub_uint8_t *) str, len, 0); -@@ -146,6 +140,7 @@ copy_file_path (grub_efi_file_path_device_path_t *fp, - fp->path_name[size++] = '\0'; - fp->header.length = size * sizeof (grub_efi_char16_t) + sizeof (*fp); - grub_free (path_name); -+ return GRUB_ERR_NONE; - } - - static grub_efi_device_path_t * -@@ -203,13 +198,19 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) - /* Fill the file path for the directory. */ - d = (grub_efi_device_path_t *) ((char *) file_path - + ((char *) d - (char *) dp)); -- copy_file_path ((grub_efi_file_path_device_path_t *) d, -- dir_start, dir_end - dir_start); -+ if (copy_file_path ((grub_efi_file_path_device_path_t *) d, -+ dir_start, dir_end - dir_start) != GRUB_ERR_NONE) -+ { -+ fail: -+ grub_free (file_path); -+ return 0; -+ } - - /* Fill the file path for the file. */ - d = GRUB_EFI_NEXT_DEVICE_PATH (d); -- copy_file_path ((grub_efi_file_path_device_path_t *) d, -- dir_end + 1, grub_strlen (dir_end + 1)); -+ if (copy_file_path ((grub_efi_file_path_device_path_t *) d, -+ dir_end + 1, grub_strlen (dir_end + 1)) != GRUB_ERR_NONE) -+ goto fail; - - /* Fill the end of device path nodes. */ - d = GRUB_EFI_NEXT_DEVICE_PATH (d); diff --git a/0250-efi-Fix-use-after-free-in-halt-reboot-path.patch b/0250-efi-Fix-use-after-free-in-halt-reboot-path.patch deleted file mode 100644 index b0d52899..00000000 --- a/0250-efi-Fix-use-after-free-in-halt-reboot-path.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexey Makhalov -Date: Mon, 20 Jul 2020 23:03:05 +0000 -Subject: [PATCH] efi: Fix use-after-free in halt/reboot path - -commit 92bfc33db984 ("efi: Free malloc regions on exit") -introduced memory freeing in grub_efi_fini(), which is -used not only by exit path but by halt/reboot one as well. -As result of memory freeing, code and data regions used by -modules, such as halt, reboot, acpi (used by halt) also got -freed. After return to module code, CPU executes, filled -by UEFI firmware (tested with edk2), 0xAFAFAFAF pattern as -a code. Which leads to #UD exception later. - -grub> halt -!!!! X64 Exception Type - 06(#UD - Invalid Opcode) CPU Apic ID - 00000000 !!!! -RIP - 0000000003F4EC28, CS - 0000000000000038, RFLAGS - 0000000000200246 -RAX - 0000000000000000, RCX - 00000000061DA188, RDX - 0A74C0854DC35D41 -RBX - 0000000003E10E08, RSP - 0000000007F0F860, RBP - 0000000000000000 -RSI - 00000000064DB768, RDI - 000000000832C5C3 -R8 - 0000000000000002, R9 - 0000000000000000, R10 - 00000000061E2E52 -R11 - 0000000000000020, R12 - 0000000003EE5C1F, R13 - 00000000061E0FF4 -R14 - 0000000003E10D80, R15 - 00000000061E2F60 -DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030 -GS - 0000000000000030, SS - 0000000000000030 -CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000 -CR4 - 0000000000000668, CR8 - 0000000000000000 -DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 -DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 -GDTR - 00000000079EEA98 0000000000000047, LDTR - 0000000000000000 -IDTR - 0000000007598018 0000000000000FFF, TR - 0000000000000000 -FXSAVE_STATE - 0000000007F0F4C0 - -Proposal here is to continue to free allocated memory for -exit boot services path but keep it for halt/reboot path -as it won't be much security concern here. -Introduced GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY -loader flag to be used by efi halt/reboot path. - -Signed-off-by: Alexey Makhalov -Reviewed-by: Darren Kenny ---- - grub-core/kern/arm/efi/init.c | 3 +++ - grub-core/kern/arm64/efi/init.c | 3 +++ - grub-core/kern/efi/efi.c | 3 ++- - grub-core/kern/efi/init.c | 1 - - grub-core/kern/i386/efi/init.c | 9 +++++++-- - grub-core/kern/ia64/efi/init.c | 9 +++++++-- - grub-core/lib/efi/halt.c | 3 ++- - include/grub/loader.h | 1 + - 8 files changed, 25 insertions(+), 7 deletions(-) - -diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c -index 06df60e2f0e..40c3b467fc6 100644 ---- a/grub-core/kern/arm/efi/init.c -+++ b/grub-core/kern/arm/efi/init.c -@@ -71,4 +71,7 @@ grub_machine_fini (int flags) - efi_call_1 (b->close_event, tmr_evt); - - grub_efi_fini (); -+ -+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) -+ grub_efi_memory_fini (); - } -diff --git a/grub-core/kern/arm64/efi/init.c b/grub-core/kern/arm64/efi/init.c -index 6224999ec9c..5010caefd66 100644 ---- a/grub-core/kern/arm64/efi/init.c -+++ b/grub-core/kern/arm64/efi/init.c -@@ -57,4 +57,7 @@ grub_machine_fini (int flags) - return; - - grub_efi_fini (); -+ -+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) -+ grub_efi_memory_fini (); - } -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 8c09e60987d..5ee739d51ae 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -157,7 +157,8 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) - void - grub_reboot (void) - { -- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); -+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN | -+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY); - efi_call_4 (grub_efi_system_table->runtime_services->reset_system, - GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL); - for (;;) ; -diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index d1afa3af11e..2ffb5205dda 100644 ---- a/grub-core/kern/efi/init.c -+++ b/grub-core/kern/efi/init.c -@@ -131,5 +131,4 @@ grub_efi_fini (void) - { - grub_efidisk_fini (); - grub_console_fini (); -- grub_efi_memory_fini (); - } -diff --git a/grub-core/kern/i386/efi/init.c b/grub-core/kern/i386/efi/init.c -index da499aba04e..deb2eacd8d8 100644 ---- a/grub-core/kern/i386/efi/init.c -+++ b/grub-core/kern/i386/efi/init.c -@@ -39,6 +39,11 @@ grub_machine_init (void) - void - grub_machine_fini (int flags) - { -- if (flags & GRUB_LOADER_FLAG_NORETURN) -- grub_efi_fini (); -+ if (!(flags & GRUB_LOADER_FLAG_NORETURN)) -+ return; -+ -+ grub_efi_fini (); -+ -+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) -+ grub_efi_memory_fini (); - } -diff --git a/grub-core/kern/ia64/efi/init.c b/grub-core/kern/ia64/efi/init.c -index b5ecbd09121..f1965571b1d 100644 ---- a/grub-core/kern/ia64/efi/init.c -+++ b/grub-core/kern/ia64/efi/init.c -@@ -70,6 +70,11 @@ grub_machine_init (void) - void - grub_machine_fini (int flags) - { -- if (flags & GRUB_LOADER_FLAG_NORETURN) -- grub_efi_fini (); -+ if (!(flags & GRUB_LOADER_FLAG_NORETURN)) -+ return; -+ -+ grub_efi_fini (); -+ -+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) -+ grub_efi_memory_fini (); - } -diff --git a/grub-core/lib/efi/halt.c b/grub-core/lib/efi/halt.c -index 5859f0498a8..29d41364168 100644 ---- a/grub-core/lib/efi/halt.c -+++ b/grub-core/lib/efi/halt.c -@@ -28,7 +28,8 @@ - void - grub_halt (void) - { -- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); -+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN | -+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY); - #if !defined(__ia64__) && !defined(__arm__) && !defined(__aarch64__) && \ - !defined(__riscv) - grub_acpi_halt (); -diff --git a/include/grub/loader.h b/include/grub/loader.h -index 7f82a499fd9..b208642821b 100644 ---- a/include/grub/loader.h -+++ b/include/grub/loader.h -@@ -33,6 +33,7 @@ enum - { - GRUB_LOADER_FLAG_NORETURN = 1, - GRUB_LOADER_FLAG_PXE_NOT_UNLOAD = 2, -+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY = 4, - }; - - void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void), diff --git a/0255-efi-Fix-use-after-free-in-halt-reboot-path.patch b/0255-efi-Fix-use-after-free-in-halt-reboot-path.patch deleted file mode 100644 index 93efaf67..00000000 --- a/0255-efi-Fix-use-after-free-in-halt-reboot-path.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexey Makhalov -Date: Mon, 20 Jul 2020 23:03:05 +0000 -Subject: [PATCH] efi: Fix use-after-free in halt/reboot path - -commit 92bfc33db984 ("efi: Free malloc regions on exit") -introduced memory freeing in grub_efi_fini(), which is -used not only by exit path but by halt/reboot one as well. -As result of memory freeing, code and data regions used by -modules, such as halt, reboot, acpi (used by halt) also got -freed. After return to module code, CPU executes, filled -by UEFI firmware (tested with edk2), 0xAFAFAFAF pattern as -a code. Which leads to #UD exception later. - -grub> halt -!!!! X64 Exception Type - 06(#UD - Invalid Opcode) CPU Apic ID - 00000000 !!!! -RIP - 0000000003F4EC28, CS - 0000000000000038, RFLAGS - 0000000000200246 -RAX - 0000000000000000, RCX - 00000000061DA188, RDX - 0A74C0854DC35D41 -RBX - 0000000003E10E08, RSP - 0000000007F0F860, RBP - 0000000000000000 -RSI - 00000000064DB768, RDI - 000000000832C5C3 -R8 - 0000000000000002, R9 - 0000000000000000, R10 - 00000000061E2E52 -R11 - 0000000000000020, R12 - 0000000003EE5C1F, R13 - 00000000061E0FF4 -R14 - 0000000003E10D80, R15 - 00000000061E2F60 -DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030 -GS - 0000000000000030, SS - 0000000000000030 -CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000 -CR4 - 0000000000000668, CR8 - 0000000000000000 -DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000 -DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400 -GDTR - 00000000079EEA98 0000000000000047, LDTR - 0000000000000000 -IDTR - 0000000007598018 0000000000000FFF, TR - 0000000000000000 -FXSAVE_STATE - 0000000007F0F4C0 - -Proposal here is to continue to free allocated memory for -exit boot services path but keep it for halt/reboot path -as it won't be much security concern here. -Introduced GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY -loader flag to be used by efi halt/reboot path. - -Signed-off-by: Alexey Makhalov -Reviewed-by: Darren Kenny ---- - grub-core/kern/riscv/efi/init.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/grub-core/kern/riscv/efi/init.c b/grub-core/kern/riscv/efi/init.c -index 7eb1969d0b0..38795fe6741 100644 ---- a/grub-core/kern/riscv/efi/init.c -+++ b/grub-core/kern/riscv/efi/init.c -@@ -73,4 +73,7 @@ grub_machine_fini (int flags) - return; - - grub_efi_fini (); -+ -+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY)) -+ grub_efi_memory_fini (); - } diff --git a/0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch b/0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch deleted file mode 100644 index 51f39e5d..00000000 --- a/0256-linux-loader-avoid-overflow-on-initrd-size-calculati.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 24 Jul 2020 13:57:27 -0400 -Subject: [PATCH] linux loader: avoid overflow on initrd size calculation - -Signed-off-by: Peter Jones ---- - grub-core/loader/linux.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c -index 471b214d6c3..25624ebc114 100644 ---- a/grub-core/loader/linux.c -+++ b/grub-core/loader/linux.c -@@ -151,8 +151,8 @@ grub_initrd_init (int argc, char *argv[], - initrd_ctx->nfiles = 0; - initrd_ctx->components = 0; - -- initrd_ctx->components = grub_zalloc (argc -- * sizeof (initrd_ctx->components[0])); -+ initrd_ctx->components = grub_calloc (argc, -+ sizeof (initrd_ctx->components[0])); - if (!initrd_ctx->components) - return grub_errno; - diff --git a/0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch b/0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch deleted file mode 100644 index b784faa9..00000000 --- a/0258-linux-Fix-integer-overflows-in-initrd-size-handling.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Sat, 25 Jul 2020 12:15:37 +0100 -Subject: [PATCH] linux: Fix integer overflows in initrd size handling - -These could be triggered by a crafted filesystem with very large files. - -Fixes: CVE-2020-15707 - -Signed-off-by: Colin Watson -Reviewed-by: Jan Setje-Eilers ---- - grub-core/loader/linux.c | 75 +++++++++++++++++++++++++++++++++++------------- - 1 file changed, 55 insertions(+), 20 deletions(-) - -diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c -index 25624ebc114..1af142f5760 100644 ---- a/grub-core/loader/linux.c -+++ b/grub-core/loader/linux.c -@@ -4,6 +4,8 @@ - #include - #include - #include -+#include -+#include - - struct newc_head - { -@@ -98,13 +100,13 @@ free_dir (struct dir *root) - grub_free (root); - } - --static grub_size_t -+static grub_err_t - insert_dir (const char *name, struct dir **root, -- grub_uint8_t *ptr) -+ grub_uint8_t *ptr, grub_size_t *size) - { - struct dir *cur, **head = root; - const char *cb, *ce = name; -- grub_size_t size = 0; -+ *size = 0; - while (1) - { - for (cb = ce; *cb == '/'; cb++); -@@ -130,14 +132,22 @@ insert_dir (const char *name, struct dir **root, - ptr = make_header (ptr, name, ce - name, - 040777, 0); - } -- size += ALIGN_UP ((ce - (char *) name) -- + sizeof (struct newc_head), 4); -+ if (grub_add (*size, -+ ALIGN_UP ((ce - (char *) name) -+ + sizeof (struct newc_head), 4), -+ size)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); -+ grub_free (n->name); -+ grub_free (n); -+ return grub_errno; -+ } - *head = n; - cur = n; - } - root = &cur->next; - } -- return size; -+ return GRUB_ERR_NONE; - } - - grub_err_t -@@ -173,26 +183,33 @@ grub_initrd_init (int argc, char *argv[], - eptr = grub_strchr (ptr, ':'); - if (eptr) - { -+ grub_size_t dir_size, name_len; -+ - initrd_ctx->components[i].newc_name = grub_strndup (ptr, eptr - ptr); -- if (!initrd_ctx->components[i].newc_name) -+ if (!initrd_ctx->components[i].newc_name || -+ insert_dir (initrd_ctx->components[i].newc_name, &root, 0, -+ &dir_size)) - { - grub_initrd_close (initrd_ctx); - return grub_errno; - } -- initrd_ctx->size -- += ALIGN_UP (sizeof (struct newc_head) -- + grub_strlen (initrd_ctx->components[i].newc_name), -- 4); -- initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name, -- &root, 0); -+ name_len = grub_strlen (initrd_ctx->components[i].newc_name); -+ if (grub_add (initrd_ctx->size, -+ ALIGN_UP (sizeof (struct newc_head) + name_len, 4), -+ &initrd_ctx->size) || -+ grub_add (initrd_ctx->size, dir_size, &initrd_ctx->size)) -+ goto overflow; - newc = 1; - fname = eptr + 1; - } - } - else if (newc) - { -- initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head) -- + sizeof ("TRAILER!!!") - 1, 4); -+ if (grub_add (initrd_ctx->size, -+ ALIGN_UP (sizeof (struct newc_head) -+ + sizeof ("TRAILER!!!") - 1, 4), -+ &initrd_ctx->size)) -+ goto overflow; - free_dir (root); - root = 0; - newc = 0; -@@ -208,19 +225,29 @@ grub_initrd_init (int argc, char *argv[], - initrd_ctx->nfiles++; - initrd_ctx->components[i].size - = grub_file_size (initrd_ctx->components[i].file); -- initrd_ctx->size += initrd_ctx->components[i].size; -+ if (grub_add (initrd_ctx->size, initrd_ctx->components[i].size, -+ &initrd_ctx->size)) -+ goto overflow; - } - - if (newc) - { - initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4); -- initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head) -- + sizeof ("TRAILER!!!") - 1, 4); -+ if (grub_add (initrd_ctx->size, -+ ALIGN_UP (sizeof (struct newc_head) -+ + sizeof ("TRAILER!!!") - 1, 4), -+ &initrd_ctx->size)) -+ goto overflow; - free_dir (root); - root = 0; - } - - return GRUB_ERR_NONE; -+ -+overflow: -+ free_dir (root); -+ grub_initrd_close (initrd_ctx); -+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); - } - - grub_size_t -@@ -261,8 +288,16 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx, - - if (initrd_ctx->components[i].newc_name) - { -- ptr += insert_dir (initrd_ctx->components[i].newc_name, -- &root, ptr); -+ grub_size_t dir_size; -+ -+ if (insert_dir (initrd_ctx->components[i].newc_name, &root, ptr, -+ &dir_size)) -+ { -+ free_dir (root); -+ grub_initrd_close (initrd_ctx); -+ return grub_errno; -+ } -+ ptr += dir_size; - ptr = make_header (ptr, initrd_ctx->components[i].newc_name, - grub_strlen (initrd_ctx->components[i].newc_name), - 0100777, diff --git a/0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch b/0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch deleted file mode 100644 index 62658d25..00000000 --- a/0259-Fix-const-char-pointers-in-grub-core-commands-blscfg.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 20 Jul 2020 12:24:02 -0400 -Subject: [PATCH] Fix const char ** pointers in grub-core/commands/blscfg.c - -This will need to get folded back in the right place on the next rebase, -but it's before "Make grub_strtol() "end" pointers have safer const -qualifiers" currently, so for now I'm leaving it here instead of merging -it back with the original patch. - -Signed-off-by: Peter Jones ---- - grub-core/commands/blscfg.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index 4ec6504d9a4..e907a6a5d28 100644 ---- a/grub-core/commands/blscfg.c -+++ b/grub-core/commands/blscfg.c -@@ -612,7 +612,7 @@ static char **bls_make_list (struct bls_entry *entry, const char *key, int *num) - return list; - } - --static char *field_append(bool is_var, char *buffer, char *start, char *end) -+static char *field_append(bool is_var, char *buffer, const char *start, const char *end) - { - char *tmp = grub_strndup(start, end - start + 1); - const char *field = tmp; -@@ -641,11 +641,11 @@ static char *field_append(bool is_var, char *buffer, char *start, char *end) - return buffer; - } - --static char *expand_val(char *value) -+static char *expand_val(const char *value) - { - char *buffer = NULL; -- char *start = value; -- char *end = value; -+ const char *start = value; -+ const char *end = value; - bool is_var = false; - - if (!value) diff --git a/0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch b/0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch deleted file mode 100644 index e3d1be4b..00000000 --- a/0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 20 Jul 2020 12:24:02 -0400 -Subject: [PATCH] Fix const char ** pointers in grub-core/net/url.c - -This will need to get folded back in the right place on the next rebase, -but it's before "Make grub_strtol() "end" pointers have safer const -qualifiers" currently, so for now I'm leaving it here instead of merging -it back with the original patch. - -Signed-off-by: Peter Jones ---- - grub-core/net/url.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/net/url.c b/grub-core/net/url.c -index 146858284cd..d9d2fc9a9dc 100644 ---- a/grub-core/net/url.c -+++ b/grub-core/net/url.c -@@ -235,7 +235,7 @@ extract_http_url_info (char *url, int ssl, - c = *port_end; - *port_end = '\0'; - -- portul = grub_strtoul (port_off, &separator, 10); -+ portul = grub_strtoul (port_off, (const char **)&separator, 10); - *port_end = c; - #ifdef URL_TEST - if (portul == ULONG_MAX && errno == ERANGE) diff --git a/0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch b/0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch deleted file mode 100644 index e7b5c6ec..00000000 --- a/0268-tftp-roll-over-block-counter-to-prevent-timeouts-wit.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 24 Aug 2020 14:46:27 +0200 -Subject: [PATCH] tftp: roll over block counter to prevent timeouts with data - packets - -The block number is a 16-bit counter which only allows to fetch -files no bigger than 65535 * blksize. To avoid this limit, the -counter is rolled over. This behavior isn't defined in RFC 1350 -but is handled by many TFTP servers and it's what GRUB was doing -before implicitly due an overflow. - -Fixing that bug led to TFTP timeouts, since GRUB wasn't acking -data packets anymore for files with size bigger than the maximum -mentioned above. Restore the old behavior to prevent this issue. - -Resolves: rhbz#1869335 - -Suggested-by: Peter Jones -Signed-off-by: Javier Martinez Canillas ---- - grub-core/net/tftp.c | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 22badd74316..acbb01c10e7 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -183,8 +183,20 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), - return GRUB_ERR_NONE; - } - -- /* Ack old/retransmitted block. */ -- if (grub_be_to_cpu16 (tftph->u.data.block) < data->block + 1) -+ /* -+ * Ack old/retransmitted block. -+ * -+ * The block number is a 16-bit counter which only allows to fetch -+ * files no bigger than 65535 * blksize. To avoid this limit, the -+ * counter is rolled over. This behavior isn't defined in RFC 1350 -+ * but is handled by many TFTP servers and it's what GRUB was doing -+ * before implicitly due an overflow. -+ * -+ * Fixing that bug led to TFTP timeouts, since GRUB wasn't acking -+ * data packets anymore for files with size bigger than the maximum -+ * mentioned above. Restore the old behavior to prevent this issue. -+ */ -+ if (grub_be_to_cpu16 (tftph->u.data.block) < ((data->block + 1) & 0xffffu)) - ack (data, grub_be_to_cpu16 (tftph->u.data.block)); - /* Ignore unexpected block. */ - else if (grub_be_to_cpu16 (tftph->u.data.block) > data->block + 1) diff --git a/0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch b/0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch deleted file mode 100644 index d6abc6b4..00000000 --- a/0278-btrfs-Add-support-for-new-RAID1C34-profiles.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: David Sterba -Date: Mon, 4 Nov 2019 17:23:22 +0100 -Subject: [PATCH] btrfs: Add support for new RAID1C34 profiles - -New 3- and 4-copy variants of RAID1 were merged into Linux kernel 5.5. -Add the two new profiles to the list of recognized ones. As this builds -on the same code as RAID1, only the redundancy level needs to be -adjusted, the rest is done by the existing code. - -Signed-off-by: David Sterba -Reviewed-by: Daniel Kiper ---- - grub-core/fs/btrfs.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 0d8c666aea1..78f5de37b27 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -144,6 +144,8 @@ struct grub_btrfs_chunk_item - #define GRUB_BTRFS_CHUNK_TYPE_RAID10 0x40 - #define GRUB_BTRFS_CHUNK_TYPE_RAID5 0x80 - #define GRUB_BTRFS_CHUNK_TYPE_RAID6 0x100 -+#define GRUB_BTRFS_CHUNK_TYPE_RAID1C3 0x200 -+#define GRUB_BTRFS_CHUNK_TYPE_RAID1C4 0x400 - grub_uint8_t dummy2[0xc]; - grub_uint16_t nstripes; - grub_uint16_t nsubstripes; -@@ -1003,14 +1005,19 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - csize = (stripen + 1) * stripe_length - off; - break; - } -+ case GRUB_BTRFS_CHUNK_TYPE_RAID1C4: -+ redundancy++; -+ /* fall through */ -+ case GRUB_BTRFS_CHUNK_TYPE_RAID1C3: -+ redundancy++; -+ /* fall through */ - case GRUB_BTRFS_CHUNK_TYPE_DUPLICATED: - case GRUB_BTRFS_CHUNK_TYPE_RAID1: - { -- grub_dprintf ("btrfs", "RAID1\n"); -+ grub_dprintf ("btrfs", "RAID1 (copies: %d)\n", ++redundancy); - stripen = 0; - stripe_offset = off; - csize = grub_le_to_cpu64 (chunk->size) - off; -- redundancy = 2; - break; - } - case GRUB_BTRFS_CHUNK_TYPE_RAID0: diff --git a/0279-verifiers-Fix-calling-uninitialized-function-pointer.patch b/0279-verifiers-Fix-calling-uninitialized-function-pointer.patch deleted file mode 100644 index 1f3b0400..00000000 --- a/0279-verifiers-Fix-calling-uninitialized-function-pointer.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Tue, 18 Feb 2020 18:08:18 +0800 -Subject: [PATCH] verifiers: Fix calling uninitialized function pointer - -The necessary check for NULL before use of function ver->close is not -taking place in the failure path. This patch simply adds the missing -check and fixes the problem that GRUB hangs indefinitely after booting -rogue image without valid signature if secure boot is turned on. - -Now it displays like this for booting rogue UEFI image: - - error: bad shim signature - error: you need to load the kernel first - - Press any key to continue... - -and then you can go back to boot menu by pressing any key or after a few -seconds expired. - -Signed-off-by: Michael Chang -Reviewed-by: Javier Martinez Canillas -Reviewed-by: Daniel Kiper ---- - grub-core/commands/verifiers.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/commands/verifiers.c b/grub-core/commands/verifiers.c -index 0dde4818267..7b9297cd345 100644 ---- a/grub-core/commands/verifiers.c -+++ b/grub-core/commands/verifiers.c -@@ -196,7 +196,8 @@ grub_verifiers_open (grub_file_t io, enum grub_file_type type) - return ret; - - fail: -- ver->close (context); -+ if (ver->close) -+ ver->close (context); - fail_noclose: - verified_free (verified); - grub_free (ret); diff --git a/0283-docs-grub-grub-install-is-no-longer-a-shell-script.patch b/0283-docs-grub-grub-install-is-no-longer-a-shell-script.patch deleted file mode 100644 index 72160198..00000000 --- a/0283-docs-grub-grub-install-is-no-longer-a-shell-script.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Sat, 15 Aug 2020 01:00:11 +1000 -Subject: [PATCH] docs/grub: grub-install is no longer a shell script - -Since commit cd46aa6cefab in 2013, grub-install hasn't been a shell -script. The para doesn't really add that much, especially since it's -the user manual, so just drop it. - -(adjust docs: s/grub/grub2) -Signed-off-by: Daniel Axtens ---- - docs/grub.texi | 7 ------- - 1 file changed, 7 deletions(-) - -diff --git a/docs/grub.texi b/docs/grub.texi -index e8bfe7ee7e8..2436c57f598 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -695,13 +695,6 @@ floppy instead of exposing the USB drive as a hard disk (they call it - This install doesn't conflict with standard install as long as they are in - separate directories. - --Note that @command{grub2-install} is actually just a shell script and the --real task is done by other tools such as @command{grub2-mkimage}. Therefore, --you may run those commands directly to install GRUB, without using --@command{grub2-install}. Don't do that, however, unless you are very familiar --with the internals of GRUB. Installing a boot loader on a running OS may be --extremely dangerous. -- - On EFI systems for fixed disk install you have to mount EFI System Partition. - If you mount it at @file{/boot/efi} then you don't need any special arguments: - diff --git a/0284-docs-grub-pubkey-has-been-supported-for-some-time.patch b/0284-docs-grub-pubkey-has-been-supported-for-some-time.patch deleted file mode 100644 index 51a843b1..00000000 --- a/0284-docs-grub-pubkey-has-been-supported-for-some-time.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Sat, 15 Aug 2020 02:04:01 +1000 -Subject: [PATCH] docs/grub: --pubkey has been supported for some time - ---pubkey is supported, so we can now document it. - -(adjust docs: s/grub/grub2) -Signed-off-by: Daniel Axtens ---- - docs/grub.texi | 12 +++--------- - 1 file changed, 3 insertions(+), 9 deletions(-) - -diff --git a/docs/grub.texi b/docs/grub.texi -index 2436c57f598..7fc2a62a4f8 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -5732,15 +5732,9 @@ verified with a public key currently trusted by GRUB - validation fails, then file @file{foo} cannot be opened. This failure - may halt or otherwise impact the boot process. - --@comment Unfortunately --pubkey is not yet supported by grub2-install, --@comment but we should not bring up internal detail grub2-mkimage here --@comment in the user guide (as opposed to developer's manual). -- --@comment An initial trusted public key can be embedded within the GRUB --@comment @file{core.img} using the @code{--pubkey} option to --@comment @command{grub2-mkimage} (@pxref{Invoking grub2-install}). Presently it --@comment is necessary to write a custom wrapper around @command{grub2-mkimage} --@comment using the @code{--grub-mkimage} flag to @command{grub2-install}. -+An initial trusted public key can be embedded within the GRUB -+@file{core.img} using the @code{--pubkey} option to -+@command{grub2-install} (@pxref{Invoking grub2-install}). - - GRUB uses GPG-style detached signatures (meaning that a file - @file{foo.sig} will be produced when file @file{foo} is signed), and diff --git a/0286-verifiers-provide-unsafe-module-list.patch b/0286-verifiers-provide-unsafe-module-list.patch deleted file mode 100644 index 1548d3a2..00000000 --- a/0286-verifiers-provide-unsafe-module-list.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Wed, 29 Jul 2020 17:46:16 +1000 -Subject: [PATCH] verifiers: provide unsafe module list - -Other verifiers that implement secure boot may want to be able to -use this list and behaviour. - -Upstream, this factors the list out of the shim_lock verifier. -However, that hasn't hit the RHEL8.4 tree yet, so instead -of factoring it out of that we just create it. - -Signed-off-by: Daniel Axtens ---- - grub-core/commands/verifiers.c | 46 ++++++++++++++++++++++++++++++++++++++++++ - include/grub/verify.h | 13 ++++++++++++ - 2 files changed, 59 insertions(+) - -diff --git a/grub-core/commands/verifiers.c b/grub-core/commands/verifiers.c -index 7b9297cd345..4ced984cfed 100644 ---- a/grub-core/commands/verifiers.c -+++ b/grub-core/commands/verifiers.c -@@ -218,6 +218,52 @@ grub_verify_string (char *str, enum grub_verify_string_type type) - return GRUB_ERR_NONE; - } - -+/* List of modules which may allow for verifcation to be bypassed. */ -+static const char *const disabled_mods[] = { "iorw", "memrw", "wrmsr", NULL }; -+ -+/* -+ * Does the module in file `io' allow for the a verifier to be bypassed? -+ * -+ * Returns 1 if so, otherwise 0. -+ */ -+char -+grub_is_dangerous_module (grub_file_t io) -+{ -+ char *b, *e; -+ int i; -+ -+ /* Establish GRUB module name. */ -+ b = grub_strrchr (io->name, '/'); -+ e = grub_strrchr (io->name, '.'); -+ -+ b = b ? (b + 1) : io->name; -+ e = e ? e : io->name + grub_strlen (io->name); -+ e = (e > b) ? e : io->name + grub_strlen (io->name); -+ -+ for (i = 0; disabled_mods[i]; i++) -+ if (!grub_strncmp (b, disabled_mods[i], -+ grub_strlen (b) - grub_strlen (e))) -+ return 1; -+ return 0; -+} -+ -+/* -+ * Is there already an unsafe module in memory? -+ * Returns the name if one is loaded, otherwise NULL. -+ */ -+const char * -+grub_dangerous_module_loaded (void) -+{ -+ int i; -+ -+ for (i = 0; disabled_mods[i]; i++) -+ if (grub_dl_get (disabled_mods[i])) -+ { -+ return disabled_mods[i]; -+ } -+ return NULL; -+} -+ - GRUB_MOD_INIT(verifiers) - { - grub_file_filter_register (GRUB_FILE_FILTER_VERIFY, grub_verifiers_open); -diff --git a/include/grub/verify.h b/include/grub/verify.h -index ea049143368..8c2de132051 100644 ---- a/include/grub/verify.h -+++ b/include/grub/verify.h -@@ -81,4 +81,17 @@ grub_verifier_unregister (struct grub_file_verifier *ver) - grub_err_t - grub_verify_string (char *str, enum grub_verify_string_type type); - -+/* -+ * Does the module in file `io' allow for the a verifier to be bypassed? -+ * -+ * Returns 1 if so, otherwise 0. -+ */ -+char grub_is_dangerous_module (grub_file_t io); -+ -+/* -+ * Is there already an unsafe module in memory? -+ * Returns the name if one is loaded, otherwise NULL. -+ */ -+const char *grub_dangerous_module_loaded (void); -+ - #endif /* ! GRUB_VERIFY_HEADER */ diff --git a/0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch b/0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch deleted file mode 100644 index 76c716b7..00000000 --- a/0301-ieee1275-link-appended-signature-enforcement-to-ibm-.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 28 Sep 2020 11:11:17 +1000 -Subject: [PATCH] ieee1275: link appended-signature enforcement to - /ibm,secure-boot - -If the 'ibm,secure-boot' property of the root node is 2 or greater, -require that the kernel pass appended-signature verification. - -Do not consider the presence of a certificate to enforce verification. - -Signed-off-by: Daniel Axtens ---- - grub-core/commands/appendedsig/appendedsig.c | 44 +++++++++++++++++++++------- - grub-core/kern/ieee1275/init.c | 26 ++++++++++++++++ - 2 files changed, 60 insertions(+), 10 deletions(-) - -diff --git a/grub-core/commands/appendedsig/appendedsig.c b/grub-core/commands/appendedsig/appendedsig.c -index 1fbc942254a..6efe58ce8b2 100644 ---- a/grub-core/commands/appendedsig/appendedsig.c -+++ b/grub-core/commands/appendedsig/appendedsig.c -@@ -95,10 +95,24 @@ static char * - grub_env_write_sec (struct grub_env_var *var __attribute__((unused)), - const char *val) - { -+ if (check_sigs == 2) -+ return grub_strdup ("forced"); - check_sigs = (*val == '1') || (*val == 'e'); - return grub_strdup (check_sigs ? "enforce" : "no"); - } - -+static const char * -+grub_env_read_sec (struct grub_env_var *var __attribute__ ((unused)), -+ const char *val __attribute__ ((unused))) -+{ -+ if (check_sigs == 2) -+ return "forced"; -+ else if (check_sigs == 1) -+ return "enforce"; -+ else -+ return "no"; -+} -+ - static grub_err_t - read_cert_from_file (grub_file_t f, struct x509_certificate *certificate) - { -@@ -552,14 +566,20 @@ GRUB_MOD_INIT (appendedsig) - val = grub_env_get ("check_appended_signatures"); - grub_dprintf ("appendedsig", "check_appended_signatures='%s'\n", val); - -- if (val && (val[0] == '1' || val[0] == 'e')) -- check_sigs = 1; -- else -- check_sigs = 0; -+ if (val) -+ { -+ if (val[0] == '2' || val[0] == 'f') -+ check_sigs = 2; -+ else if (val[0] == '1' || val[0] == 'e') -+ check_sigs = 1; -+ else -+ check_sigs = 0; -+ } - - grub_trusted_key = NULL; - -- grub_register_variable_hook ("check_appended_signatures", 0, -+ grub_register_variable_hook ("check_appended_signatures", -+ grub_env_read_sec, - grub_env_write_sec); - grub_env_export ("check_appended_signatures"); - -@@ -603,11 +623,15 @@ GRUB_MOD_INIT (appendedsig) - grub_trusted_key = pk; - } - -- if (!val || val[0] == '\0') -- { -- grub_env_set ("check_appended_signatures", -- grub_trusted_key ? "enforce" : "no"); -- } -+ /* -+ * When controlled by ibm,secure-boot, we don't want the presence of -+ * a certificate to enforce secure boot. -+ * if (!val || val[0] == '\0') -+ * { -+ * grub_env_set ("check_appended_signatures", -+ * grub_trusted_key ? "enforce" : "no"); -+ * } -+ */ - - cmd_trust = - grub_register_command ("trust_certificate", grub_cmd_trust, -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 937c1bc44cb..5df2e0efae7 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -271,6 +271,30 @@ grub_parse_cmdline (void) - } - } - -+static void -+grub_get_ieee1275_secure_boot (void) -+{ -+ grub_ieee1275_phandle_t root; -+ int rc; -+ grub_uint32_t is_sb; -+ -+ grub_ieee1275_finddevice ("/", &root); -+ -+ rc = grub_ieee1275_get_integer_property (root, "ibm,secure-boot", &is_sb, -+ sizeof (is_sb), 0); -+ -+ /* ibm,secure-boot: -+ * 0 - disabled -+ * 1 - audit -+ * 2 - enforce -+ * 3 - enforce + OS-specific behaviour -+ * -+ * We only support enforce. -+ */ -+ if (rc >= 0 && is_sb >= 2) -+ grub_env_set("check_appended_signatures", "forced"); -+} -+ - grub_addr_t grub_modbase; - - void -@@ -296,6 +320,8 @@ grub_machine_init (void) - #else - grub_install_get_time_ms (grub_rtc_get_time_ms); - #endif -+ -+ grub_get_ieee1275_secure_boot (); - } - - void diff --git a/0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch b/0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch deleted file mode 100644 index 79c805f9..00000000 --- a/0304-10_linux.in-Check-if-petitboot-sysfs-has-a-valid-ver.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Wed, 10 Mar 2021 12:50:15 +0100 -Subject: [PATCH] 10_linux.in: Check if petitboot sysfs has a valid version - -The script assumes that the petitboot sysfs entry contains a valid version -number, but this is not always the case. For example, on a Talos II system -a user reported that contained the following value: - -$ cat /sys/firmware/devicetree/base/ibm,firmware-versions/petitboot -0ed84c0-p94177c1 - -This lead to the script wrongly trying to compare these hashes as if they -were integers values, which caused the following error when re-generating -the GRUB configuration file: - -/etc/grub.d/10_linux: line 234: test: 0ed84c0-p94177c1: integer expression expected -/etc/grub.d/10_linux: line 235: test: 0ed84c0-p94177c1: integer expression expected - -Check that the major and minor values are integers before attempting to do -the comparison. If these aren't numbers, then generate the menu with a set -of menuentry commands, since there's no way to know the petitboot version. - -Resolves: rhbz#1921479 - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/10_linux.in | 19 ++++++++++++------- - 1 file changed, 12 insertions(+), 7 deletions(-) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index e61b6c94f11..b9426eb2e2e 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -223,20 +223,25 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then - arch="$(uname -m)" - if [ "x${arch}" = "xppc64le" ] && [ -d /sys/firmware/opal ]; then - -+ BLS_POPULATE_MENU="true" - petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" - - if test -e ${petitboot_path}; then - read -r -d '' petitboot_version < ${petitboot_path} - petitboot_version="$(echo ${petitboot_version//v})" -- major_version="$(echo ${petitboot_version} | cut -d . -f1)" -- minor_version="$(echo ${petitboot_version} | cut -d . -f2)" - -- if test -z ${petitboot_version} || test ${major_version} -lt 1 || \ -- test ${major_version} -eq 1 -a ${minor_version} -lt 8; then -- BLS_POPULATE_MENU="true" -+ if test -n ${petitboot_version}; then -+ major_version="$(echo ${petitboot_version} | cut -d . -f1)" -+ minor_version="$(echo ${petitboot_version} | cut -d . -f2)" -+ -+ re='^[0-9]+$' -+ if [[ $major_version =~ $re ]] && [[ $minor_version =~ $re ]] && -+ ([[ ${major_version} -gt 1 ]] || -+ [[ ${major_version} -eq 1 && -+ ${minor_version} -ge 8 ]]); then -+ BLS_POPULATE_MENU="false" -+ fi - fi -- else -- BLS_POPULATE_MENU="true" - fi - fi - diff --git a/bootstrap.conf b/bootstrap.conf index 988dda09..6b043fc3 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -23,6 +23,7 @@ GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 # directly. gnulib_modules=" argp + base64 error fnmatch getdelim @@ -78,10 +79,19 @@ cp -a INSTALL INSTALL.grub bootstrap_post_import_hook () { set -e - for patchname in fix-null-deref fix-width no-abort; do + for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ + fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do patch -d grub-core/lib/gnulib -p2 \ < "grub-core/lib/gnulib-patches/$patchname.patch" done + for patchname in \ + 0001-Support-POTFILES-shell \ + 0002-Handle-gettext_printf-shell-function \ + 0003-Make-msgfmt-output-in-little-endian \ + 0004-Use-SHELL-rather-than-bin-sh; do + patch -d po -p3 \ + < "po/gettext-patches/$patchname.patch" + done FROM_BOOTSTRAP=1 ./autogen.sh set +e # bootstrap expects this } diff --git a/gitignore b/gitignore index 819cd185..f6a1bd05 100644 --- a/gitignore +++ b/gitignore @@ -1,237 +1,277 @@ -*~ -00_header -10_* -20_linux_xen -30_os-prober -40_custom -41_custom +# +# Ignore patterns in this directory and all subdirectories. +# *.1 *.8 -ABOUT-NLS -aclocal.m4 -ahci_test -ascii.bitmaps -ascii.h -autom4te.cache -build-aux -build-grub-gen-asciih -build-grub-gen-widthspec -build-grub-mkfont -cdboot_test -cmp_test -config.cache -config.guess -config.h -config-util.h -config-util.h.in -config.log -config.status -config.sub -configure -core_compress_test -DISTLIST -docs/*.info -docs/stamp-vti -docs/version.texi -ehci_test -example_grub_script_test -example_scripted_test -example_unit_test +*.a *.exec *.exec.exe -fddboot_test -genkernsyms.sh -gensymlist.sh -gentrigtables -gentrigtables.exe -gettext_strings_test -/gnulib -grub-bin2h -/grub-bios-setup -/grub-bios-setup.exe -grub_cmd_date -grub_cmd_echo -grub_cmd_regexp -grub_cmd_set_date -grub_cmd_sleep -/grub-editenv -/grub-editenv.exe -grub-emu -grub-emu-lite -grub-emu.exe -grub-emu-lite.exe -grub_emu_init.c -grub_emu_init.h -/grub-file -/grub-file.exe -grub-fstest -grub-fstest.exe -grub_fstest_init.c -grub_fstest_init.h -grub_func_test -grub-install -grub-install.exe -grub-kbdcomp -/grub-macbless -/grub-macbless.exe -grub-macho2img -/grub-menulst2cfg -/grub-menulst2cfg.exe -/grub-mk* -grub-mount -/grub-ofpathname -/grub-ofpathname.exe -grub-core/build-grub-pe2elf.exe -/grub-probe -/grub-probe.exe -grub_probe_init.c -grub_probe_init.h -/grub-reboot -grub_script_blanklines -grub_script_blockarg -grub_script_break -grub-script-check -grub-script-check.exe -grub_script_check_init.c -grub_script_check_init.h -grub_script_comments -grub_script_continue -grub_script_dollar -grub_script_echo1 -grub_script_echo_keywords -grub_script_escape_comma -grub_script_eval -grub_script_expansion -grub_script_final_semicolon -grub_script_for1 -grub_script_functions -grub_script_gettext -grub_script_if -grub_script_leading_whitespace -grub_script_no_commands -grub_script_not -grub_script_return -grub_script_setparams -grub_script_shift -grub_script_strcmp -grub_script_test -grub_script_vars1 -grub_script_while1 -grub_script.tab.c -grub_script.tab.h -grub_script.yy.c -grub_script.yy.h -grub-set-default -grub_setup_init.c -grub_setup_init.h -grub-shell -grub-shell-tester -grub-sparc64-setup -grub-sparc64-setup.exe -/grub-syslinux2cfg -/grub-syslinux2cfg.exe -gzcompress_test -hddboot_test -help_test -*.img *.image *.image.exe -include/grub/cpu -include/grub/machine -INSTALL.grub -install-sh -lib/libgcrypt-grub -libgrub_a_init.c +*.img *.log *.lst -lzocompress_test *.marker -Makefile -/m4 *.mod -mod-*.c -missing -netboot_test *.o -*.a -ohci_test -partmap_test -pata_test *.pf2 *.pp -po/*.mo -po/grub.pot -po/Makefile.in.in -po/Makevars -po/Makevars.template -po/POTFILES -po/Rules-quot -po/stamp-po -printf_test -priority_queue_unit_test -pseries_test -stamp-h -stamp-h1 -stamp-h.in -symlist.c -symlist.h -trigtables.c *.trs -uhci_test -update-grub_lib -unidata.c -xzcompress_test -Makefile.in +*~ +.deps-core/ +.deps-util/ +.deps/ +.dirstamp +DISTLIST GPATH GRTAGS GSYMS GTAGS -compile -depcomp +Makefile +Makefile.in +ascii.bitmaps +genkernsyms.sh +gensymlist.sh +grub-bin2h +grub-emu +grub-emu-lite +grub-emu-lite.exe +grub-emu.exe +grub-macho2img +grub_emu_init.c +grub_emu_init.h +grub_probe_init.c +grub_probe_init.h +grub_script.tab.c +grub_script.tab.h +grub_script.yy.c +grub_script.yy.h +grub_script_check_init.c +grub_script_check_init.h +grub_setup_init.c +grub_setup_init.h mdate-sh -texinfo.tex -grub-core/lib/libgcrypt-grub -.deps -.deps-util -.deps-core -.dirstamp -Makefile.util.am -contrib -grub-core/bootinfo.txt -grub-core/Makefile.core.am -grub-core/Makefile.gcry.def -grub-core/contrib -grub-core/gdb_grub -grub-core/genmod.sh -grub-core/gensyminfo.sh -grub-core/gmodule.pl -grub-core/grub.chrp -grub-core/modinfo.sh -grub-core/*.module -grub-core/*.module.exe -grub-core/*.pp -grub-core/kernel.img.bin -util/bash-completion.d/grub -grub-core/lib/gnulib -grub-core/rs_decoder.h +mod-*.c +update-grub_lib widthspec.bin -widthspec.h -docs/stamp-1 -docs/version-dev.texi -Makefile.utilgcry.def -po/*.po -po/*.gmo -po/LINGUAS -po/remove-potcdate.sed -include/grub/gcrypt/gcrypt.h -include/grub/gcrypt/g10lib.h -po/POTFILES.in -po/POTFILES-shell.in -/grub-glue-efi -/grub-render-label -/grub-glue-efi.exe -/grub-render-label.exe + +# +# Ignore patterns relative to this .gitignore file's directory. +# +/00_header +/10_* +/20_linux_xen +/30_os-prober +/30_uefi-firmware +/40_custom +/41_custom +/ABOUT-NLS +/ChangeLog +/INSTALL.grub +/Makefile.util.am +/Makefile.utilgcry.def +/aclocal.m4 +/ahci_test +/ascii.h +/autom4te.cache/ +/btrfs_test +/build-aux/ +/build-grub-gen-asciih +/build-grub-gen-widthspec +/build-grub-mkfont +/cdboot_test +/cmp_test +/compile +/config-util.h +/config-util.h.in +/config.cache +/config.guess +/config.h +/config.log +/config.status +/config.sub +/configure +/contrib +/core_compress_test +/cpio_test +/date_test +/depcomp +/docs/*.info +/docs/*.info-[0-9]* +/docs/stamp-1 +/docs/stamp-vti +/docs/version-dev.texi +/docs/version.texi +/ehci_test +/example_grub_script_test +/example_scripted_test +/example_unit_test +/exfat_test +/ext234_test +/f2fs_test +/fat_test +/fddboot_test +/file_filter_test /garbage-gen /garbage-gen.exe +/gettext_strings_test +/gnulib/ +/grub-2.[0-9]*/ +/grub-2.[0-9]*.tar.gz +/grub-bios-setup +/grub-bios-setup.exe +/grub-core/*.module +/grub-core/*.module.exe +/grub-core/*.pp +/grub-core/Makefile.core.am +/grub-core/Makefile.gcry.def +/grub-core/bootinfo.txt +/grub-core/build-grub-module-verifier +/grub-core/build-grub-pe2elf.exe +/grub-core/contrib +/grub-core/gdb_grub +/grub-core/genmod.sh +/grub-core/gensyminfo.sh +/grub-core/gentrigtables +/grub-core/gentrigtables.exe +/grub-core/gmodule.pl +/grub-core/grub.chrp +/grub-core/kernel.img.bin +/grub-core/lib/gnulib +/grub-core/lib/libgcrypt-grub +/grub-core/modinfo.sh +/grub-core/rs_decoder.h +/grub-core/symlist.c +/grub-core/symlist.h +/grub-core/trigtables.c +/grub-core/unidata.c +/grub-editenv +/grub-editenv.exe +/grub-file +/grub-file.exe /grub-fs-tester -grub-core/build-grub-module-verifier +/grub-fstest +/grub-fstest.exe +/grub-glue-efi +/grub-glue-efi.exe +/grub-install +/grub-install.exe +/grub-kbdcomp +/grub-macbless +/grub-macbless.exe +/grub-menulst2cfg +/grub-menulst2cfg.exe +/grub-mk* +/grub-mount +/grub-ofpathname +/grub-ofpathname.exe +/grub-probe +/grub-probe.exe +/grub-reboot +/grub-render-label +/grub-render-label.exe +/grub-script-check +/grub-script-check.exe +/grub-set-default +/grub-shell +/grub-shell-tester +/grub-sparc64-setup +/grub-sparc64-setup.exe +/grub-syslinux2cfg +/grub-syslinux2cfg.exe +/grub_cmd_date +/grub_cmd_echo +/grub_cmd_regexp +/grub_cmd_set_date +/grub_cmd_sleep +/grub_cmd_test +/grub_cmd_tr +/grub_fstest_init.c +/grub_fstest_init.h +/grub_func_test +/grub_script_blanklines +/grub_script_blockarg +/grub_script_break +/grub_script_comments +/grub_script_continue +/grub_script_dollar +/grub_script_echo1 +/grub_script_echo_keywords +/grub_script_escape_comma +/grub_script_eval +/grub_script_expansion +/grub_script_final_semicolon +/grub_script_for1 +/grub_script_functions +/grub_script_gettext +/grub_script_if +/grub_script_leading_whitespace +/grub_script_no_commands +/grub_script_not +/grub_script_return +/grub_script_setparams +/grub_script_shift +/grub_script_strcmp +/grub_script_test +/grub_script_vars1 +/grub_script_while1 +/gzcompress_test +/hddboot_test +/help_test +/hfs_test +/hfsplus_test +/include/grub/cpu +/include/grub/gcrypt/g10lib.h +/include/grub/gcrypt/gcrypt.h +/include/grub/machine +/install-sh +/iso9660_test +/jfs_test +/lib/libgcrypt-grub +/libgrub_a_init.c +/lzocompress_test +/m4/ +/minixfs_test +/missing +/netboot_test +/nilfs2_test +/ntfs_test +/ohci_test +/partmap_test +/pata_test +/po/*.gmo +/po/*.mo +/po/*.po +/po/LINGUAS +/po/Makefile.in.in +/po/Makevars +/po/Makevars.template +/po/POTFILES +/po/POTFILES-shell.in +/po/POTFILES.in +/po/Rules-quot +/po/grub.pot +/po/remove-potcdate.sed +/po/stamp-po +/printf_test +/priority_queue_unit_test +/pseries_test +/reiserfs_test +/romfs_test +/squashfs_test +/stamp-h +/stamp-h.in +/stamp-h1 +/syslinux_test +/tar_test +/test_sha512sum +/test_unset +/tests/syslinux/ubuntu10.04_grub.cfg +/texinfo.tex +/udf_test +/uhci_test +/util/bash-completion.d/grub +/widthspec.h +/xfs_test +/xzcompress_test +/zfs_test diff --git a/grub.macros b/grub.macros index 0498daed..577e9436 100644 --- a/grub.macros +++ b/grub.macros @@ -333,8 +333,6 @@ git commit -a -q -m "%{tarversion} baseline." \ #git commit -a -q -m "%{tarversion} master." \ git am --whitespace=nowarn %%{patches} grub-%{grubefiarch}-%{tarversion}/.gitignore cp %{SOURCE4} grub-%{grubefiarch}-%{tarversion}/unifont.pcf.gz +sed -e "s,@@VERSION@@,%{version},g" -e "s,@@VERSION_RELEASE@@,%{version}-%{release},g" \ + %{SOURCE12} > grub-%{grubefiarch}-%{tarversion}/sbat.csv git add grub-%{grubefiarch}-%{tarversion} %endif %if 0%{with_alt_efi_arch} @@ -551,6 +554,16 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Mar 12 2021 Javier Martinez Canillas - 2.06~rc1-1 +- Update to 2.06~rc1 to fix a bunch of CVEs + Resolves: CVE-2020-14372 + Resolves: CVE-2020-25632 + Resolves: CVE-2020-25647 + Resolves: CVE-2020-27749 + Resolves: CVE-2020-27779 + Resolves: CVE-2021-20225 + Resolves: CVE-2021-20233 + * Thu Mar 11 2021 Javier Martinez Canillas - 2.04-39 - Fix config file generation failing due invalid petitboot version value Resolves: rhbz#1921479 diff --git a/sbat.csv.in b/sbat.csv.in new file mode 100755 index 00000000..ea697f51 --- /dev/null +++ b/sbat.csv.in @@ -0,0 +1,3 @@ +sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md +grub,1,Free Software Foundation,grub,@@VERSION@@,https//www.gnu.org/software/grub/ +grub.fedora,1,The Fedora Project,grub2,@@VERSION_RELEASE@@,https://src.fedoraproject.org/rpms/grub2 diff --git a/sources b/sources index 9bd1834c..5251e5d9 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ SHA512 (unifont-5.1.20080820.pcf.gz) = 8939e2bc82ca97b60e6678f3ff079a2be7ba9b702f2e8ee289e853af5823695f7baafbf14b674fc5e41071f2a6de4f2dadd56bf8b4653849dd756d59622f1649 SHA512 (theme.tar.bz2) = 0f6f914d5f801509403094b28b8cfe5169cb56ae9bdd808ae21a6780a8236b434161a068351508dd78729c25ee2fed066c124c1eef9e15102750b409b4576a5c -SHA512 (grub-2.04.tar.xz) = 9c15c42d0cf5d61446b752194e3b628bb04be0fe6ea0240ab62b3d753784712744846e1f7c3651d8e0968d22012e6d713c38c44936d4004ded3ca4d4007babbb -SHA512 (gnulib-fixes.tar.gz) = c45de2126598485bcf2fee81a66e64afa0e253aa04fc796c9201dd50229a93cc086d635a21d4644cb454ad6f71fa342494573aa86478fca19059cf71836b0619 +SHA512 (grub-2.06~rc1.tar.xz) = 093890b0af71b0d346afb415dec106681fd9e3f2f5bda14093c060b861d55ee1b50c8fb24afd072d24968ebebedde290f8220b0374cbd2b2e4508dfb00924122 +SHA512 (gnulib-fixes.tar.gz) = 7aa933812de10f54196c7ed02079d7edeb92672a528baf83201ca4c62aa3e6b119f61c45469d2c4623c4efc5d4a08d20b029403f1f2c6e35fb7cb15789ff54b2 From 51b7d6220eea87a73365c53dcb5ee9fab26be882 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 24 Mar 2021 09:19:08 +0100 Subject: [PATCH 059/294] Fix a couple of merge mistakes made when rebasing to 2.06~rc1 Resolves: rhbz#1940524 Signed-off-by: Javier Martinez Canillas --- ...g-module-to-parse-Boot-Loader-Specif.patch | 28 +++++++++++-------- 0020-Don-t-write-messages-to-the-screen.patch | 19 ++++++++++++- 0071-Add-BLS-support-to-grub-mkconfig.patch | 14 ++++++---- ...nd-prefix-when-HTTP-path-is-relative.patch | 2 +- ...fw-http-_path-variables-to-make-them.patch | 2 +- grub.macros | 3 ++ grub2.spec | 6 +++- 7 files changed, 54 insertions(+), 20 deletions(-) diff --git a/0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index 8c1a1672..da65e187 100644 --- a/0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -14,7 +14,7 @@ Signed-off-by: Javier Martinez Canillas Signed-off-by: Will Thompson --- grub-core/Makefile.core.def | 11 + - grub-core/commands/blscfg.c | 1171 ++++++++++++++++++++++++++++++++++++++++ + grub-core/commands/blscfg.c | 1177 ++++++++++++++++++++++++++++++++++++++++ grub-core/commands/legacycfg.c | 5 +- grub-core/commands/loadenv.c | 77 +-- grub-core/commands/menuentry.c | 20 +- @@ -23,7 +23,7 @@ Signed-off-by: Will Thompson include/grub/compiler.h | 2 + include/grub/menu.h | 13 + include/grub/normal.h | 2 +- - 10 files changed, 1318 insertions(+), 82 deletions(-) + 10 files changed, 1324 insertions(+), 82 deletions(-) create mode 100644 grub-core/commands/blscfg.c create mode 100644 grub-core/commands/loadenv.h @@ -58,10 +58,10 @@ index c865a08b027..c15e91943b9 100644 diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c new file mode 100644 -index 00000000000..ab35c75443a +index 00000000000..e907a6a5d28 --- /dev/null +++ b/grub-core/commands/blscfg.c -@@ -0,0 +1,1171 @@ +@@ -0,0 +1,1177 @@ +/*-*- Mode: C; c-basic-offset: 2; indent-tabs-mode: t -*-*/ + +/* bls.c - implementation of the boot loader spec */ @@ -678,25 +678,29 @@ index 00000000000..ab35c75443a + +static char *field_append(bool is_var, char *buffer, const char *start, const char *end) +{ -+ char *temp = grub_strndup(start, end - start + 1); -+ const char *field = temp; ++ char *tmp = grub_strndup(start, end - start + 1); ++ const char *field = tmp; ++ int term = is_var ? 2 : 1; + + if (is_var) { -+ field = grub_env_get (temp); ++ field = grub_env_get (tmp); + if (!field) + return buffer; + } + + if (!buffer) -+ buffer = grub_zalloc (grub_strlen(field) + 1); ++ buffer = grub_zalloc (grub_strlen(field) + term); + else -+ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field) + 1); ++ buffer = grub_realloc (buffer, grub_strlen(buffer) + grub_strlen(field) + term); + + if (!buffer) + return NULL; + -+ grub_stpcpy (buffer + grub_strlen(buffer), field); -+ grub_stpcpy (buffer + grub_strlen(buffer), " "); ++ tmp = buffer + grub_strlen(buffer); ++ tmp = grub_stpcpy (tmp, field); ++ ++ if (is_var) ++ tmp = grub_stpcpy (tmp, " "); + + return buffer; +} @@ -726,6 +730,8 @@ index 00000000000..ab35c75443a + buffer = field_append(is_var, buffer, start, end); + is_var = false; + start = value; ++ if (*start == ' ') ++ start++; + } + } + diff --git a/0020-Don-t-write-messages-to-the-screen.patch b/0020-Don-t-write-messages-to-the-screen.patch index 0decd847..01d0264b 100644 --- a/0020-Don-t-write-messages-to-the-screen.patch +++ b/0020-Don-t-write-messages-to-the-screen.patch @@ -8,10 +8,11 @@ happens so quickly it looks like something is wrong and isn't very appealing. --- grub-core/gettext/gettext.c | 25 +++++-------------------- + grub-core/kern/main.c | 5 ----- grub-core/boot/i386/pc/boot.S | 3 --- grub-core/boot/i386/pc/diskboot.S | 5 ----- util/grub.d/10_linux.in | 7 ------- - 4 files changed, 5 insertions(+), 35 deletions(-) + 5 files changed, 5 insertions(+), 40 deletions(-) diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c index 4d02e62c109..84d520cd494 100644 @@ -95,6 +96,22 @@ index 4d02e62c109..84d520cd494 100644 grub_register_variable_hook ("locale_dir", NULL, read_main); grub_register_variable_hook ("secondary_locale_dir", NULL, read_secondary); +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index d1de9fa6873..48058d983ce 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -269,11 +269,6 @@ grub_main (void) + + grub_boot_time ("After machine init."); + +- /* Hello. */ +- grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); +- grub_printf ("Welcome to GRUB!\n\n"); +- grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); +- + /* Init verifiers API. */ + grub_verifiers_init (); + diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S index 2bd0b2d2866..ea167fe1206 100644 --- a/grub-core/boot/i386/pc/boot.S diff --git a/0071-Add-BLS-support-to-grub-mkconfig.patch b/0071-Add-BLS-support-to-grub-mkconfig.patch index 15ce7b3a..7bdb9425 100644 --- a/0071-Add-BLS-support-to-grub-mkconfig.patch +++ b/0071-Add-BLS-support-to-grub-mkconfig.patch @@ -24,9 +24,9 @@ Signed-off-by: Javier Martinez Canillas --- util/grub-mkconfig.8 | 4 + util/grub-mkconfig.in | 9 +- - util/grub-mkconfig_lib.in | 20 ++++- + util/grub-mkconfig_lib.in | 22 ++++- util/grub.d/10_linux.in | 223 +++++++++++++++++++++++++++++++++++++++++++++- - 4 files changed, 251 insertions(+), 5 deletions(-) + 4 files changed, 252 insertions(+), 6 deletions(-) diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8 index a2d1f577b9b..434fa4deda4 100644 @@ -84,7 +84,7 @@ index e671ce68aec..1a70b7ea056 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index fafeac95061..4e6534a41f6 100644 +index fafeac95061..d8bb4069360 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -30,6 +30,9 @@ fi @@ -117,7 +117,7 @@ index fafeac95061..4e6534a41f6 100644 old_ifs="$IFS" IFS=' ' -@@ -161,15 +175,15 @@ prepare_grub_to_access_device () +@@ -161,18 +175,18 @@ prepare_grub_to_access_device () # otherwise set root as per value in device.map. fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`" if [ "x$fs_hint" != x ]; then @@ -135,7 +135,11 @@ index fafeac95061..4e6534a41f6 100644 + echo " search --no-floppy --fs-uuid --set=${device_variable} ${fs_uuid}" echo "fi" else - echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}" +- echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}" ++ echo "search --no-floppy --fs-uuid --set=${device_variable} ${fs_uuid}" + fi + fi + IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index cbfaca34cc7..68adb55d893 100644 --- a/util/grub.d/10_linux.in diff --git a/0106-Prepend-prefix-when-HTTP-path-is-relative.patch b/0106-Prepend-prefix-when-HTTP-path-is-relative.patch index 3592ef2e..fc861d97 100644 --- a/0106-Prepend-prefix-when-HTTP-path-is-relative.patch +++ b/0106-Prepend-prefix-when-HTTP-path-is-relative.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index d1de9fa6873..1c540fc8c26 100644 +index 48058d983ce..4ec3f5e4d33 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -131,11 +131,19 @@ grub_set_prefix_and_root (void) diff --git a/0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch index 74183bc3..6f2e93dd 100644 --- a/0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch +++ b/0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch @@ -25,7 +25,7 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 2 insertions(+) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 1c540fc8c26..b573be6650d 100644 +index 4ec3f5e4d33..0285e95a2bb 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -143,6 +143,7 @@ grub_set_prefix_and_root (void) diff --git a/grub.macros b/grub.macros index 577e9436..576e8a43 100644 --- a/grub.macros +++ b/grub.macros @@ -464,6 +464,9 @@ cd .. \ cd grub-emu-%{tarversion} \ %configure \\\ %{cc_equals} \\\ + HOST_CFLAGS="%{legacy_host_cflags}" \\\ + HOST_CPPFLAGS="-I$(pwd)" \\\ + HOST_LDFLAGS="%{legacy_host_ldflags}" \\\ --with-platform=emu \\\ --with-grubdir=%{name} \\\ --program-transform-name=s,grub,%{name}, \\\ diff --git a/grub2.spec b/grub2.spec index fd3c7569..faf85e45 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06~rc1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -554,6 +554,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Mar 24 2021 Javier Martinez Canillas - 2.06~rc1-2 +- Fix a couple of merge mistakes made when rebasing to 2.06~rc1 + Resolves: rhbz#1940524 + * Fri Mar 12 2021 Javier Martinez Canillas - 2.06~rc1-1 - Update to 2.06~rc1 to fix a bunch of CVEs Resolves: CVE-2020-14372 From d672447dfba38661fec589d8b9cc660a277d2aaa Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 25 Mar 2021 22:59:26 +0100 Subject: [PATCH 060/294] Prevent %posttrans scriptlet to fail if grubenv isn't present in the ESP Also simplify the logic to determine the filesystem UUID of the partition that contains the /boot/grub2 directory. Signed-off-by: Javier Martinez Canillas --- grub2.spec | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/grub2.spec b/grub2.spec index faf85e45..46dbf335 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06~rc1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -362,8 +362,7 @@ if grep -q "configfile" ${EFI_HOME}/grub.cfg; then fi # create a stub grub2 config in EFI -BOOT_DEVICE=$(df -P /boot | awk 'END{print $1}') -BOOT_UUID=$(blkid -s UUID -o value "${BOOT_DEVICE}") +BOOT_UUID=$(grub2-probe --target=fs_uuid ${GRUB_HOME}) GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME}) cat << EOF > ${EFI_HOME}/grub.cfg.stb @@ -373,8 +372,10 @@ export \$prefix configfile \$prefix/grub.cfg EOF -cp -a ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave -mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv +if test -f ${EFI_HOME}/grubenv; then + cp -a ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave + mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv +fi cp -a ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave cp -a ${EFI_HOME}/grub.cfg ${GRUB_HOME}/ @@ -554,6 +555,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Mar 25 2021 Javier Martinez Canillas - 2.06~rc1-3 +- Prevent %%posttrans scriptlet to fail if grubenv isn't present in the ESP + * Wed Mar 24 2021 Javier Martinez Canillas - 2.06~rc1-2 - Fix a couple of merge mistakes made when rebasing to 2.06~rc1 Resolves: rhbz#1940524 From 2f63333bcf09a43b0742abb967b4d317d478ff4e Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 12 Apr 2021 00:42:48 +0200 Subject: [PATCH 061/294] Add again 20_linux_xen script fix that got dropped by mistake Resolves: rhbz#1858364 Signed-off-by: Javier Martinez Canillas --- ...d-xen-or-multiboot-2-modules-as-need.patch | 32 ++++++++++++++----- grub2.spec | 6 +++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch index aa4cc8a5..3fd779f7 100644 --- a/0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +++ b/0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -5,27 +5,43 @@ Subject: [PATCH] 20_linux_xen: load xen or multiboot{,2} modules as needed. Signed-off-by: Peter Jones --- - util/grub.d/20_linux_xen.in | 3 +++ - 1 file changed, 3 insertions(+) + util/grub.d/20_linux_xen.in | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index e9e73b815fb..f8897479fe6 100644 +index e9e73b815fb..c23b064be6c 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in -@@ -153,6 +153,8 @@ linux_entry_xsm () +@@ -153,6 +153,7 @@ linux_entry_xsm () else xen_rm_opts="no-real-mode edd=off" fi -+ insmod ${module_loader} -+ insmod ${xen_loader} ++ insmod ${xen_module} ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} echo '$(echo "$lmessage" | grub_quote)' ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} -@@ -166,6 +168,7 @@ EOF +@@ -166,6 +167,7 @@ EOF done sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' -+ insmod ${module_loader} ++ insmod ${xen_module} ${module_loader} --nounzip $(echo $initrd_path) EOF fi +@@ -253,13 +255,16 @@ while [ "x${xen_list}" != "x" ] ; do + echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" + fi + if ($grub_file --is-arm64-efi $current_xen); then ++ xen_module="xen_boot" + xen_loader="xen_hypervisor" + module_loader="xen_module" + else + if ($grub_file --is-x86-multiboot2 $current_xen); then ++ xen_module="multiboot2" + xen_loader="multiboot2" + module_loader="module2" + else ++ xen_module="multiboot" + xen_loader="multiboot" + module_loader="module" + fi diff --git a/grub2.spec b/grub2.spec index 46dbf335..d4993974 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06~rc1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Apr 12 2021 Javier Martinez Canillas - 2.06~rc1-4 +- Add again 20_linux_xen script fix that got dropped by mistake + Resolves: rhbz#1858364 + * Thu Mar 25 2021 Javier Martinez Canillas - 2.06~rc1-3 - Prevent %%posttrans scriptlet to fail if grubenv isn't present in the ESP From 5ef95ecb65b2519edf228c23ad0f42ca7c28ad60 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 14 Apr 2021 12:55:04 +0200 Subject: [PATCH 062/294] Add XFS bigtime support Signed-off-by: Javier Martinez Canillas --- ...s-Add-bigtime-support-for-xfs-driver.patch | 167 +++++++++ ...-64bit-type-for-filesystem-timestamp.patch | 327 ++++++++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 500 insertions(+), 1 deletion(-) create mode 100644 0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch create mode 100644 0198-fs-Use-64bit-type-for-filesystem-timestamp.patch diff --git a/0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch b/0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch new file mode 100644 index 00000000..7758c0c4 --- /dev/null +++ b/0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch @@ -0,0 +1,167 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Carlos Maiolino +Date: Wed, 14 Apr 2021 11:07:20 +0200 +Subject: [PATCH] fs/xfs: Add bigtime support for xfs driver + +XFS filesystem now supports bigtime feature, to overcome y2038 problem. +This patch makes grub able to support xfs filesystems with this feature +enabled. + +xfs counter for bigtime enable timestamps starts on 0, which translates +to INT32_MIN (Dec 31 20:45:52 UTC 1901) in the legacy timestamps. The +conversion to unix timestamps is made before passing the value to +grub-core. + +For this to work properly, grub requires to access flags2 field in the +xfs ondisk inode, so, the grub_xfs_inode structure has been updated to +the full ondisk inode size. + +This patch is enough to make grub work properly with files with +timestamps up to INT32_MAX (y2038), any file with timestamps bigger than +this will overflow the counter, causing grub to show wrong timestamps +(not really much difference on current situation). + +Reviewed-by: Javier Martinez Canillas +Signed-off-by: Carlos Maiolino +--- + grub-core/fs/xfs.c | 69 ++++++++++++++++++++++++++++++++++++++++++------------ + 1 file changed, 54 insertions(+), 15 deletions(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 43023e03fb3..2ce76ec70f9 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -75,10 +75,15 @@ GRUB_MOD_LICENSE ("GPLv3+"); + XFS_SB_VERSION2_PROJID32BIT | \ + XFS_SB_VERSION2_FTYPE) + ++/* Inode flags2 flags */ ++#define XFS_DIFLAG2_BIGTIME_BIT 3 ++#define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT) ++ + /* incompat feature flags */ +-#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ +-#define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ +-#define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ ++#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ ++#define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ ++#define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ ++#define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */ + + /* + * Directory entries with ftype are explicitly handled by GRUB code. +@@ -92,7 +97,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define XFS_SB_FEAT_INCOMPAT_SUPPORTED \ + (XFS_SB_FEAT_INCOMPAT_FTYPE | \ + XFS_SB_FEAT_INCOMPAT_SPINODES | \ +- XFS_SB_FEAT_INCOMPAT_META_UUID) ++ XFS_SB_FEAT_INCOMPAT_META_UUID | \ ++ XFS_SB_FEAT_INCOMPAT_BIGTIME) + + struct grub_xfs_sblock + { +@@ -177,7 +183,7 @@ struct grub_xfs_btree_root + grub_uint64_t keys[1]; + } GRUB_PACKED; + +-struct grub_xfs_time ++struct grub_xfs_time_legacy + { + grub_uint32_t sec; + grub_uint32_t nanosec; +@@ -190,20 +196,23 @@ struct grub_xfs_inode + grub_uint8_t version; + grub_uint8_t format; + grub_uint8_t unused2[26]; +- struct grub_xfs_time atime; +- struct grub_xfs_time mtime; +- struct grub_xfs_time ctime; ++ grub_uint64_t atime; ++ grub_uint64_t mtime; ++ grub_uint64_t ctime; + grub_uint64_t size; + grub_uint64_t nblocks; + grub_uint32_t extsize; + grub_uint32_t nextents; + grub_uint16_t unused3; + grub_uint8_t fork_offset; +- grub_uint8_t unused4[17]; ++ grub_uint8_t unused4[37]; ++ grub_uint64_t flags2; ++ grub_uint8_t unused5[48]; + } GRUB_PACKED; + +-#define XFS_V2_INODE_SIZE sizeof(struct grub_xfs_inode) +-#define XFS_V3_INODE_SIZE (XFS_V2_INODE_SIZE + 76) ++#define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode) ++/* Size of struct grub_xfs_inode until fork_offset (included)*/ ++#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 92) + + struct grub_xfs_dirblock_tail + { +@@ -233,8 +242,6 @@ struct grub_xfs_data + + static grub_dl_t my_mod; + +- +- + static int grub_xfs_sb_hascrc(struct grub_xfs_data *data) + { + return (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == +@@ -950,7 +957,6 @@ grub_xfs_mount (grub_disk_t disk) + return 0; + } + +- + /* Context for grub_xfs_dir. */ + struct grub_xfs_dir_ctx + { +@@ -958,6 +964,39 @@ struct grub_xfs_dir_ctx + void *hook_data; + }; + ++/* Bigtime inodes helpers */ ++ ++#define NSEC_PER_SEC 1000000000L ++#define XFS_BIGTIME_EPOCH_OFFSET (-(grub_int64_t)GRUB_INT32_MIN) ++ ++static int grub_xfs_inode_has_bigtime(const struct grub_xfs_inode *inode) ++{ ++ return inode->version >= 3 && ++ (inode->flags2 & grub_cpu_to_be64_compile_time(XFS_DIFLAG2_BIGTIME)); ++} ++ ++static grub_int64_t ++grub_xfs_bigtime_to_unix(grub_uint64_t time) ++{ ++ grub_uint64_t rem; ++ grub_int64_t nsec = NSEC_PER_SEC; ++ grub_int64_t seconds = grub_divmod64((grub_int64_t)time, nsec, &rem); ++ ++ return seconds - XFS_BIGTIME_EPOCH_OFFSET; ++} ++ ++static grub_int64_t ++grub_xfs_get_inode_time(struct grub_xfs_inode *inode) ++{ ++ struct grub_xfs_time_legacy *lts; ++ ++ if (grub_xfs_inode_has_bigtime(inode)) ++ return grub_xfs_bigtime_to_unix(grub_be_to_cpu64(inode->mtime)); ++ ++ lts = (struct grub_xfs_time_legacy *)&inode->mtime; ++ return grub_be_to_cpu32(lts->sec); ++} ++ + /* Helper for grub_xfs_dir. */ + static int + grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype, +@@ -970,7 +1009,7 @@ grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype, + if (node->inode_read) + { + info.mtimeset = 1; +- info.mtime = grub_be_to_cpu32 (node->inode.mtime.sec); ++ info.mtime = grub_xfs_get_inode_time(&node->inode); + } + info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR); + grub_free (node); diff --git a/0198-fs-Use-64bit-type-for-filesystem-timestamp.patch b/0198-fs-Use-64bit-type-for-filesystem-timestamp.patch new file mode 100644 index 00000000..5938deb1 --- /dev/null +++ b/0198-fs-Use-64bit-type-for-filesystem-timestamp.patch @@ -0,0 +1,327 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Carlos Maiolino +Date: Wed, 14 Apr 2021 11:07:21 +0200 +Subject: [PATCH] fs: Use 64bit type for filesystem timestamp + +Some filesystems nowadays uses 64bit types for timestamps, so, update +grub_dirhook_info struct to use an int64 type to store mtime. This also +updates grub_unixtime2datetime() to receive a 64-bit timestamp +argument and do 64bit-safe divisions. + +All the remaining conversion from 32 to 64 should be safe, as 32 to 64 +attributions will be implicitly casted. The most crictical part in the +32 to 64bits conversion is on grub_unixtime2datetime() where it needs +to deal with the 64bit type, specially with division in x86_architectures, +so, for that, the grub_divmod64() helper has been used. + +These changes enables grub to support dates beyond y2038. + +Reviewed-by: Javier Martinez Canillas +Signed-off-by: Carlos Maiolino +--- + grub-core/fs/affs.c | 2 +- + grub-core/fs/ext2.c | 2 +- + grub-core/fs/fat.c | 4 ++-- + grub-core/fs/hfs.c | 2 +- + grub-core/fs/hfsplus.c | 2 +- + grub-core/fs/iso9660.c | 6 +++--- + grub-core/fs/nilfs2.c | 2 +- + grub-core/fs/squash4.c | 2 +- + grub-core/fs/ufs.c | 2 +- + grub-core/fs/zfs/zfs.c | 2 +- + grub-core/lib/datetime.c | 15 ++++++++++++--- + grub-core/net/bootp.c | 2 +- + grub-core/normal/misc.c | 2 +- + grub-core/tests/sleep_test.c | 4 ++-- + include/grub/datetime.h | 4 ++-- + include/grub/fs.h | 4 ++-- + 16 files changed, 33 insertions(+), 24 deletions(-) + +diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c +index 230e26af0f8..cafcd0fba91 100644 +--- a/grub-core/fs/affs.c ++++ b/grub-core/fs/affs.c +@@ -641,7 +641,7 @@ grub_affs_label (grub_device_t device, char **label) + } + + static grub_err_t +-grub_affs_mtime (grub_device_t device, grub_int32_t *t) ++grub_affs_mtime (grub_device_t device, grub_int64_t *t) + { + struct grub_affs_data *data; + grub_disk_t disk = device->disk; +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index 848bf939dba..e7dd78e6635 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -1055,7 +1055,7 @@ grub_ext2_uuid (grub_device_t device, char **uuid) + + /* Get mtime. */ + static grub_err_t +-grub_ext2_mtime (grub_device_t device, grub_int32_t *tm) ++grub_ext2_mtime (grub_device_t device, grub_int64_t *tm) + { + struct grub_ext2_data *data; + grub_disk_t disk = device->disk; +diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c +index 7f775a17038..dd82e4ee35d 100644 +--- a/grub-core/fs/fat.c ++++ b/grub-core/fs/fat.c +@@ -737,7 +737,7 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, + * https://docs.microsoft.com/en-us/windows/win32/fileio/exfat-specification + */ + static int +-grub_exfat_timestamp (grub_uint32_t field, grub_uint8_t msec, grub_int32_t *nix) { ++grub_exfat_timestamp (grub_uint32_t field, grub_uint8_t msec, grub_int64_t *nix) { + struct grub_datetime datetime = { + .year = (field >> 25) + 1980, + .month = (field & 0x01E00000) >> 21, +@@ -891,7 +891,7 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, + * https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-107.pdf + */ + static int +-grub_fat_timestamp (grub_uint16_t time, grub_uint16_t date, grub_int32_t *nix) { ++grub_fat_timestamp (grub_uint16_t time, grub_uint16_t date, grub_int64_t *nix) { + struct grub_datetime datetime = { + .year = (date >> 9) + 1980, + .month = (date & 0x01E0) >> 5, +diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c +index 9a5b7bbe906..f419965d154 100644 +--- a/grub-core/fs/hfs.c ++++ b/grub-core/fs/hfs.c +@@ -1374,7 +1374,7 @@ grub_hfs_label (grub_device_t device, char **label) + } + + static grub_err_t +-grub_hfs_mtime (grub_device_t device, grub_int32_t *tm) ++grub_hfs_mtime (grub_device_t device, grub_int64_t *tm) + { + struct grub_hfs_data *data; + +diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c +index 2a69055c7ec..19c7b336798 100644 +--- a/grub-core/fs/hfsplus.c ++++ b/grub-core/fs/hfsplus.c +@@ -1083,7 +1083,7 @@ grub_hfsplus_label (grub_device_t device, char **label) + + /* Get mtime. */ + static grub_err_t +-grub_hfsplus_mtime (grub_device_t device, grub_int32_t *tm) ++grub_hfsplus_mtime (grub_device_t device, grub_int64_t *tm) + { + struct grub_hfsplus_data *data; + grub_disk_t disk = device->disk; +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index 5ec4433b8f8..ac011950a64 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -178,7 +178,7 @@ static grub_dl_t my_mod; + + + static grub_err_t +-iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int32_t *nix) ++iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int64_t *nix) + { + struct grub_datetime datetime; + +@@ -206,7 +206,7 @@ iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int32_t *nix) + } + + static int +-iso9660_to_unixtime2 (const struct grub_iso9660_date2 *i, grub_int32_t *nix) ++iso9660_to_unixtime2 (const struct grub_iso9660_date2 *i, grub_int64_t *nix) + { + struct grub_datetime datetime; + +@@ -1107,7 +1107,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid) + + /* Get writing time of filesystem. */ + static grub_err_t +-grub_iso9660_mtime (grub_device_t device, grub_int32_t *timebuf) ++grub_iso9660_mtime (grub_device_t device, grub_int64_t *timebuf) + { + struct grub_iso9660_data *data; + grub_disk_t disk = device->disk; +diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c +index 9b76982b3b0..3c248a910b4 100644 +--- a/grub-core/fs/nilfs2.c ++++ b/grub-core/fs/nilfs2.c +@@ -1186,7 +1186,7 @@ grub_nilfs2_uuid (grub_device_t device, char **uuid) + + /* Get mtime. */ + static grub_err_t +-grub_nilfs2_mtime (grub_device_t device, grub_int32_t * tm) ++grub_nilfs2_mtime (grub_device_t device, grub_int64_t * tm) + { + struct grub_nilfs2_data *data; + grub_disk_t disk = device->disk; +diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c +index a5f35c10e2f..6dd731e231e 100644 +--- a/grub-core/fs/squash4.c ++++ b/grub-core/fs/squash4.c +@@ -1003,7 +1003,7 @@ grub_squash_close (grub_file_t file) + } + + static grub_err_t +-grub_squash_mtime (grub_device_t dev, grub_int32_t *tm) ++grub_squash_mtime (grub_device_t dev, grub_int64_t *tm) + { + struct grub_squash_data *data = 0; + +diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c +index fca46baa19d..34a698b71b8 100644 +--- a/grub-core/fs/ufs.c ++++ b/grub-core/fs/ufs.c +@@ -837,7 +837,7 @@ grub_ufs_uuid (grub_device_t device, char **uuid) + + /* Get mtime. */ + static grub_err_t +-grub_ufs_mtime (grub_device_t device, grub_int32_t *tm) ++grub_ufs_mtime (grub_device_t device, grub_int64_t *tm) + { + struct grub_ufs_data *data = 0; + +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index f9e755197c5..cf4d2ab189a 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -3771,7 +3771,7 @@ zfs_uuid (grub_device_t device, char **uuid) + } + + static grub_err_t +-zfs_mtime (grub_device_t device, grub_int32_t *mt) ++zfs_mtime (grub_device_t device, grub_int64_t *mt) + { + struct grub_zfs_data *data; + grub_zfs_endian_t ub_endian = GRUB_ZFS_UNKNOWN_ENDIAN; +diff --git a/grub-core/lib/datetime.c b/grub-core/lib/datetime.c +index 95b8c9ff5e3..3e84fa1dbc4 100644 +--- a/grub-core/lib/datetime.c ++++ b/grub-core/lib/datetime.c +@@ -19,6 +19,7 @@ + + #include + #include ++#include + + static const char *const grub_weekday_names[] = + { +@@ -60,9 +61,10 @@ grub_get_weekday_name (struct grub_datetime *datetime) + + + void +-grub_unixtime2datetime (grub_int32_t nix, struct grub_datetime *datetime) ++grub_unixtime2datetime (grub_int64_t nix, struct grub_datetime *datetime) + { + int i; ++ grub_uint64_t rem; + grub_uint8_t months[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + /* In the period of validity of unixtime all years divisible by 4 + are bissextile*/ +@@ -75,9 +77,16 @@ grub_unixtime2datetime (grub_int32_t nix, struct grub_datetime *datetime) + unsigned secs_in_day; + /* Transform C divisions and modulos to mathematical ones */ + if (nix < 0) +- days_epoch = -(((unsigned) (SECPERDAY-nix-1)) / SECPERDAY); ++ /* ++ * the division here shouldn't be larger than INT_MAX, ++ * so, it's safe to store the result back in an int ++ */ ++ days_epoch = -(grub_divmod64(((grub_int64_t)(SECPERDAY) - nix - 1), ++ SECPERDAY, ++ &rem)); + else +- days_epoch = ((unsigned) nix) / SECPERDAY; ++ days_epoch = grub_divmod64(nix, SECPERDAY, &rem); ++ + secs_in_day = nix - days_epoch * SECPERDAY; + days = days_epoch + 69 * DAYSPERYEAR + 17; + +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index 8f2f55c0079..7baf3540c81 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -610,7 +610,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) + grub_err_t err; + struct grub_net_bootp_packet *pack; + struct grub_datetime date; +- grub_int32_t t = 0; ++ grub_int64_t t = 0; + struct grub_net_buff *nb; + struct udphdr *udph; + grub_net_network_level_address_t target; +diff --git a/grub-core/normal/misc.c b/grub-core/normal/misc.c +index 8bb6da31fb3..f7e9e3ac4a1 100644 +--- a/grub-core/normal/misc.c ++++ b/grub-core/normal/misc.c +@@ -136,7 +136,7 @@ grub_normal_print_device_info (const char *name) + } + if (fs->fs_mtime) + { +- grub_int32_t tm; ++ grub_int64_t tm; + struct grub_datetime datetime; + (fs->fs_mtime) (dev, &tm); + if (grub_errno == GRUB_ERR_NONE) +diff --git a/grub-core/tests/sleep_test.c b/grub-core/tests/sleep_test.c +index 3d11c717cb7..63f6713165f 100644 +--- a/grub-core/tests/sleep_test.c ++++ b/grub-core/tests/sleep_test.c +@@ -32,7 +32,7 @@ static void + sleep_test (void) + { + struct grub_datetime st, en; +- grub_int32_t stu = 0, enu = 0; ++ grub_int64_t stu = 0, enu = 0; + int is_delayok; + grub_test_assert (!grub_get_datetime (&st), "Couldn't retrieve start time"); + grub_millisleep (10000); +@@ -45,7 +45,7 @@ sleep_test (void) + if (enu - stu >= 15 && enu - stu <= 17) + is_delayok = 1; + #endif +- grub_test_assert (is_delayok, "Interval out of range: %d", enu-stu); ++ grub_test_assert (is_delayok, "Interval out of range: %lld", enu-stu); + + } + +diff --git a/include/grub/datetime.h b/include/grub/datetime.h +index fef281404d7..23ae0791ced 100644 +--- a/include/grub/datetime.h ++++ b/include/grub/datetime.h +@@ -48,11 +48,11 @@ grub_err_t grub_set_datetime (struct grub_datetime *datetime); + int grub_get_weekday (struct grub_datetime *datetime); + const char *grub_get_weekday_name (struct grub_datetime *datetime); + +-void grub_unixtime2datetime (grub_int32_t nix, ++void grub_unixtime2datetime (grub_int64_t nix, + struct grub_datetime *datetime); + + static inline int +-grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix) ++grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int64_t *nix) + { + grub_int32_t ret; + int y4, ay; +diff --git a/include/grub/fs.h b/include/grub/fs.h +index 302e48d4b50..026bc3bb861 100644 +--- a/include/grub/fs.h ++++ b/include/grub/fs.h +@@ -39,7 +39,7 @@ struct grub_dirhook_info + unsigned mtimeset:1; + unsigned case_insensitive:1; + unsigned inodeset:1; +- grub_int32_t mtime; ++ grub_int64_t mtime; + grub_uint64_t inode; + }; + +@@ -81,7 +81,7 @@ struct grub_fs + grub_err_t (*fs_uuid) (grub_device_t device, char **uuid); + + /* Get writing time of filesystem. */ +- grub_err_t (*fs_mtime) (grub_device_t device, grub_int32_t *timebuf); ++ grub_err_t (*fs_mtime) (grub_device_t device, grub_int64_t *timebuf); + + #ifdef GRUB_UTIL + /* Determine sectors available for embedding. */ diff --git a/grub.patches b/grub.patches index 4f8f4738..59f42c3c 100644 --- a/grub.patches +++ b/grub.patches @@ -194,3 +194,5 @@ Patch0193: 0193-appended-signatures-documentation.patch Patch0194: 0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch Patch0195: 0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch Patch0196: 0196-Revert-templates-Disable-the-os-prober-by-default.patch +Patch0197: 0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch +Patch0198: 0198-fs-Use-64bit-type-for-filesystem-timestamp.patch diff --git a/grub2.spec b/grub2.spec index d4993974..450af505 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06~rc1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Apr 14 2021 Javier Martinez Canillas - 2.06~rc1-5 +- Add XFS bigtime support (cmaiolino) + * Mon Apr 12 2021 Javier Martinez Canillas - 2.06~rc1-4 - Add again 20_linux_xen script fix that got dropped by mistake Resolves: rhbz#1858364 From ddafa09a887b719d3f415d4843650c746e97f126 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 23 Apr 2021 11:29:46 +0200 Subject: [PATCH 063/294] Find and claim more memory for ieee1275 Signed-off-by: Javier Martinez Canillas --- ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 75 +++++ 0200-ieee1275-claim-more-memory.patch | 252 ++++++++++++++++ ...-memory-with-ibm-client-architecture.patch | 268 ++++++++++++++++++ grub.patches | 3 + grub2.spec | 5 +- 5 files changed, 602 insertions(+), 1 deletion(-) create mode 100644 0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch create mode 100644 0200-ieee1275-claim-more-memory.patch create mode 100644 0201-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch new file mode 100644 index 00000000..52fa9d23 --- /dev/null +++ b/0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Wed, 14 Apr 2021 20:10:23 +1000 +Subject: [PATCH] ieee1275: drop HEAP_MAX_ADDR, HEAP_MIN_SIZE + +HEAP_MAX_ADDR is confusing. Currently it is set to 32MB, except +on ieee1275 on x86, where it is 64MB. + +There is a comment which purports to explain it: + +/* If possible, we will avoid claiming heap above this address, because it + seems to cause relocation problems with OSes that link at 4 MiB */ + +This doesn't make a lot of sense when the constants are well above 4MB +already. It was not always this way. Prior to +commit 7b5d0fe4440c ("Increase heap limit") in 2010, HEAP_MAX_SIZE and +HEAP_MAX_ADDR were indeed 4MB. However, when the constants were increased +the comment was left unchanged. + +It's been over a decade. It doesn't seem like we have problems with +claims over 4MB on powerpc or x86 ieee1275. (sparc does things completely +differently and never used the constant.) + +Drop the constant and the check. + +The only use of HEAP_MIN_SIZE was to potentially override the +HEAP_MAX_ADDR check. It is now unused. Remove it. + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/ieee1275/init.c | 17 ----------------- + 1 file changed, 17 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index fc7d9712729..0dcd114ce54 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -46,9 +46,6 @@ + #endif + #include + +-/* The minimal heap size we can live with. */ +-#define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024) +- + /* The maximum heap size we're going to claim */ + #ifdef __i386__ + #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) +@@ -56,14 +53,6 @@ + #define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024) + #endif + +-/* If possible, we will avoid claiming heap above this address, because it +- seems to cause relocation problems with OSes that link at 4 MiB */ +-#ifdef __i386__ +-#define HEAP_MAX_ADDR (unsigned long) (64 * 1024 * 1024) +-#else +-#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024) +-#endif +- + extern char _end[]; + + #ifdef __sparc__ +@@ -185,12 +174,6 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + if (*total + len > HEAP_MAX_SIZE) + len = HEAP_MAX_SIZE - *total; + +- /* Avoid claiming anything above HEAP_MAX_ADDR, if possible. */ +- if ((addr < HEAP_MAX_ADDR) && /* if it's too late, don't bother */ +- (addr + len > HEAP_MAX_ADDR) && /* if it wasn't available anyway, don't bother */ +- (*total + (HEAP_MAX_ADDR - addr) > HEAP_MIN_SIZE)) /* only limit ourselves when we can afford to */ +- len = HEAP_MAX_ADDR - addr; +- + /* In theory, firmware should already prevent this from happening by not + listing our own image in /memory/available. The check below is intended + as a safeguard in case that doesn't happen. However, it doesn't protect diff --git a/0200-ieee1275-claim-more-memory.patch b/0200-ieee1275-claim-more-memory.patch new file mode 100644 index 00000000..d1156ca1 --- /dev/null +++ b/0200-ieee1275-claim-more-memory.patch @@ -0,0 +1,252 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Wed, 15 Apr 2020 23:28:29 +1000 +Subject: [PATCH] ieee1275: claim more memory + +On powerpc-ieee1275, we are running out of memory trying to verify +anything. This is because: + + - we have to load an entire file into memory to verify it. This is + extremely difficult to change with appended signatures. + - We only have 32MB of heap. + - Distro kernels are now often around 30MB. + +So we want to claim more memory from OpenFirmware for our heap. + +There are some complications: + + - The grub mm code isn't the only thing that will make claims on + memory from OpenFirmware: + + * PFW/SLOF will have claimed some for their own use. + + * The ieee1275 loader will try to find other bits of memory that we + haven't claimed to place the kernel and initrd when we go to boot. + + * Once we load Linux, it will also try to claim memory. It claims + memory without any reference to /memory/available, it just starts + at min(top of RMO, 768MB) and works down. So we need to avoid this + area. See arch/powerpc/kernel/prom_init.c as of v5.11. + + - The smallest amount of memory a ppc64 KVM guest can have is 256MB. + It doesn't work with distro kernels but can work with custom kernels. + We should maintain support for that. (ppc32 can boot with even less, + and we shouldn't break that either.) + + - Even if a VM has more memory, the memory OpenFirmware makes available + as Real Memory Area can be restricted. A freshly created LPAR on a + PowerVM machine is likely to have only 256MB available to OpenFirmware + even if it has many gigabytes of memory allocated. + +EFI systems will attempt to allocate 1/4th of the available memory, +clamped to between 1M and 1600M. That seems like a good sort of +approach, we just need to figure out if 1/4 is the right fraction +for us. + +We don't know in advance how big the kernel and initrd are going to be, +which makes figuring out how much memory we can take a bit tricky. + +To figure out how much memory we should leave unused, I looked at: + + - an Ubuntu 20.04.1 ppc64le pseries KVM guest: + vmlinux: ~30MB + initrd: ~50MB + + - a RHEL8.2 ppc64le pseries KVM guest: + vmlinux: ~30MB + initrd: ~30MB + +Ubuntu VMs struggle to boot with just 256MB under SLOF. +RHEL likewise has a higher minimum supported memory figure. +So lets first consider a distro kernel and 512MB of addressible memory. +(This is the default case for anything booting under PFW.) Say we lose +131MB to PFW (based on some tests). This leaves us 381MB. 1/4 of 381MB +is ~95MB. That should be enough to verify a 30MB vmlinux and should +leave plenty of space to load Linux and the initrd. + +If we consider 256MB of RMA under PFW, we have just 125MB remaining. 1/4 +of that is a smidge under 32MB, which gives us very poor odds of verifying +a distro-sized kernel. However, if we need 80MB just to put the kernel +and initrd in memory, we can't claim any more than 45MB anyway. So 1/4 +will do. We'll come back to this later. + +grub is always built as a 32-bit binary, even if it's loading a ppc64 +kernel. So we can't address memory beyond 4GB. This gives a natural cap +of 1GB for powerpc-ieee1275. + +Also apply this 1/4 approach to i386-ieee1275, but keep the 32MB cap. + +make check still works for both i386 and powerpc and I've booted +powerpc grub with this change under SLOF and PFW. + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/ieee1275/init.c | 81 +++++++++++++++++++++++++++++++++--------- + docs/grub-dev.texi | 6 ++-- + 2 files changed, 69 insertions(+), 18 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 0dcd114ce54..c61d91a0285 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -46,11 +46,12 @@ + #endif + #include + +-/* The maximum heap size we're going to claim */ ++/* The maximum heap size we're going to claim. Not used by sparc. ++ We allocate 1/4 of the available memory under 4G, up to this limit. */ + #ifdef __i386__ + #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) +-#else +-#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024) ++#else // __powerpc__ ++#define HEAP_MAX_SIZE (unsigned long) (1 * 1024 * 1024 * 1024) + #endif + + extern char _end[]; +@@ -147,16 +148,45 @@ grub_claim_heap (void) + + GRUB_KERNEL_MACHINE_STACK_SIZE), 0x200000); + } + #else +-/* Helper for grub_claim_heap. */ ++/* Helper for grub_claim_heap on powerpc. */ ++static int ++heap_size (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, ++ void *data) ++{ ++ grub_uint32_t total = *(grub_uint32_t *)data; ++ ++ if (type != GRUB_MEMORY_AVAILABLE) ++ return 0; ++ ++ /* Do not consider memory beyond 4GB */ ++ if (addr > 0xffffffffUL) ++ return 0; ++ ++ if (addr + len > 0xffffffffUL) ++ len = 0xffffffffUL - addr; ++ ++ total += len; ++ *(grub_uint32_t *)data = total; ++ ++ return 0; ++} ++ + static int + heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + void *data) + { +- unsigned long *total = data; ++ grub_uint32_t total = *(grub_uint32_t *)data; + + if (type != GRUB_MEMORY_AVAILABLE) + return 0; + ++ /* Do not consider memory beyond 4GB */ ++ if (addr > 0xffffffffUL) ++ return 0; ++ ++ if (addr + len > 0xffffffffUL) ++ len = 0xffffffffUL - addr; ++ + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM)) + { + if (addr + len <= 0x180000) +@@ -170,10 +200,6 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + } + len -= 1; /* Required for some firmware. */ + +- /* Never exceed HEAP_MAX_SIZE */ +- if (*total + len > HEAP_MAX_SIZE) +- len = HEAP_MAX_SIZE - *total; +- + /* In theory, firmware should already prevent this from happening by not + listing our own image in /memory/available. The check below is intended + as a safeguard in case that doesn't happen. However, it doesn't protect +@@ -185,6 +211,18 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + len = 0; + } + ++ /* If this block contains 0x30000000 (768MB), do not claim below that. ++ Linux likes to claim memory at min(RMO top, 768MB) and works down ++ without reference to /memory/available. */ ++ if ((addr < 0x30000000) && ((addr + len) > 0x30000000)) ++ { ++ len = len - (0x30000000 - addr); ++ addr = 0x30000000; ++ } ++ ++ if (len > total) ++ len = total; ++ + if (len) + { + grub_err_t err; +@@ -193,10 +231,12 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + if (err) + return err; + grub_mm_init_region ((void *) (grub_addr_t) addr, len); ++ total -= len; + } + +- *total += len; +- if (*total >= HEAP_MAX_SIZE) ++ *(grub_uint32_t *)data = total; ++ ++ if (total == 0) + return 1; + + return 0; +@@ -205,13 +245,22 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + static void + grub_claim_heap (void) + { +- unsigned long total = 0; ++ grub_uint32_t total = 0; + + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) +- heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, +- 1, &total); +- else +- grub_machine_mmap_iterate (heap_init, &total); ++ { ++ heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, ++ 1, &total); ++ return; ++ } ++ ++ grub_machine_mmap_iterate (heap_size, &total); ++ ++ total = total / 4; ++ if (total > HEAP_MAX_SIZE) ++ total = HEAP_MAX_SIZE; ++ ++ grub_machine_mmap_iterate (heap_init, &total); + } + #endif + +diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi +index a55af53fd45..008bd7a3c34 100644 +--- a/docs/grub-dev.texi ++++ b/docs/grub-dev.texi +@@ -1047,7 +1047,9 @@ space is limited to 4GiB. GRUB allocates pages from EFI for its heap, at most + 1.6 GiB. + + On i386-ieee1275 and powerpc-ieee1275 GRUB uses same stack as IEEE1275. +-It allocates at most 32MiB for its heap. ++ ++On i386-ieee1275, GRUB allocates at most 32MiB for its heap. On ++powerpc-ieee1275, GRUB allocates up to 1GiB. + + On sparc64-ieee1275 stack is 256KiB and heap is 2MiB. + +@@ -1075,7 +1077,7 @@ In short: + @item i386-qemu @tab 60 KiB @tab < 4 GiB + @item *-efi @tab ? @tab < 1.6 GiB + @item i386-ieee1275 @tab ? @tab < 32 MiB +-@item powerpc-ieee1275 @tab ? @tab < 32 MiB ++@item powerpc-ieee1275 @tab ? @tab < 1 GiB + @item sparc64-ieee1275 @tab 256KiB @tab 2 MiB + @item arm-uboot @tab 256KiB @tab 2 MiB + @item mips(el)-qemu_mips @tab 2MiB @tab 253 MiB diff --git a/0201-ieee1275-request-memory-with-ibm-client-architecture.patch b/0201-ieee1275-request-memory-with-ibm-client-architecture.patch new file mode 100644 index 00000000..6e6c1f0c --- /dev/null +++ b/0201-ieee1275-request-memory-with-ibm-client-architecture.patch @@ -0,0 +1,268 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 16 Apr 2021 11:48:46 +1000 +Subject: [PATCH] ieee1275: request memory with ibm,client-architecture-support + +On PowerVM, the first time we boot a Linux partition, we may only get +256MB of real memory area, even if the partition has more memory. + +This isn't really enough. Fortunately, the Power Architecture Platform +Reference (PAPR) defines a method we can call to ask for more memory. +This is part of the broad and powerful ibm,client-architecture-support +(CAS) method. + +CAS can do an enormous amount of things on a PAPR platform: as well as +asking for memory, you can set the supported processor level, the interrupt +controller, hash vs radix mmu, and so on. We want to touch as little of +this as possible because we don't want to step on the toes of the future OS. + +If: + + - we are running under what we think is PowerVM (compatible property of / + begins with "IBM"), and + + - the full amount of RMA is less than 512MB (as determined by the reg + property of /memory) + +then call CAS as follows: (refer to the Linux on Power Architecture +Reference, LoPAR, which is public, at B.5.2.3): + + - Use the "any" PVR value and supply 2 option vectors. + + - Set option vector 1 (PowerPC Server Processor Architecture Level) + to "ignore". + + - Set option vector 2 with default or Linux-like options, including a + min-rma-size of 512MB. + +This will cause a CAS reboot and the partition will restart with 512MB +of RMA. Grub will notice the 512MB and not call CAS again. + +(A partition can be configured with only 256MB of memory, which would +mean this request couldn't be satisfied, but PFW refuses to load with +only 256MB of memory, so it's a bit moot. SLOF will run fine with 256MB, +but we will never call CAS under qemu/SLOF because /compatible won't +begin with "IBM".) + +One of the first things Linux does while still running under OpenFirmware +is to call CAS with a much fuller set of options (including asking for +512MB of memory). This includes a much more restrictive set of PVR values +and processor support levels, and this will induce another reboot. On this +reboot grub will again notice the higher RMA, and not call CAS. We will get +to Linux, Linux will call CAS but because the values are now set for Linux +this will not induce another CAS reboot and we will finally boot. + +On all subsequent boots, everything will be configured with 512MB of RMA +and all the settings Linux likes, so there will be no further CAS reboots. + +(phyp is super sticky with the RMA size - it persists even on cold boots. +So if you've ever booted Linux in a partition, you'll probably never have +grub call CAS. It'll only ever fire the first time a partition loads grub, +or if you deliberately lower the amount of memory your partition has below +512MB.) + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/ieee1275/cmain.c | 3 + + grub-core/kern/ieee1275/init.c | 144 ++++++++++++++++++++++++++++++++++++++- + include/grub/ieee1275/ieee1275.h | 8 ++- + 3 files changed, 152 insertions(+), 3 deletions(-) + +diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c +index 04df9d2c667..6435628ec57 100644 +--- a/grub-core/kern/ieee1275/cmain.c ++++ b/grub-core/kern/ieee1275/cmain.c +@@ -127,6 +127,9 @@ grub_ieee1275_find_options (void) + break; + } + } ++ ++ if (grub_strncmp (tmp, "IBM,", 4) == 0) ++ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY); + } + + if (is_smartfirmware) +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index c61d91a0285..9704715c837 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -242,6 +242,135 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + return 0; + } + ++/* How much memory does OF believe it has? (regardless of whether ++ it's accessible or not) */ ++static grub_err_t ++grub_ieee1275_total_mem (grub_uint64_t *total) ++{ ++ grub_ieee1275_phandle_t root; ++ grub_ieee1275_phandle_t memory; ++ grub_uint32_t reg[4]; ++ grub_ssize_t reg_size; ++ grub_uint32_t address_cells = 1; ++ grub_uint32_t size_cells = 1; ++ grub_uint64_t size; ++ ++ /* If we fail to get to the end, report 0. */ ++ *total = 0; ++ ++ /* Determine the format of each entry in `reg'. */ ++ grub_ieee1275_finddevice ("/", &root); ++ grub_ieee1275_get_integer_property (root, "#address-cells", &address_cells, ++ sizeof address_cells, 0); ++ grub_ieee1275_get_integer_property (root, "#size-cells", &size_cells, ++ sizeof size_cells, 0); ++ ++ if (size_cells > address_cells) ++ address_cells = size_cells; ++ ++ /* Load `/memory/reg'. */ ++ if (grub_ieee1275_finddevice ("/memory", &memory)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, ++ "couldn't find /memory node"); ++ if (grub_ieee1275_get_integer_property (memory, "reg", reg, ++ sizeof reg, ®_size)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, ++ "couldn't examine /memory/reg property"); ++ if (reg_size < 0 || (grub_size_t) reg_size > sizeof (reg)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, ++ "/memory response buffer exceeded"); ++ ++ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS)) ++ { ++ address_cells = 1; ++ size_cells = 1; ++ } ++ ++ /* Decode only the size */ ++ size = reg[address_cells]; ++ if (size_cells == 2) ++ size = (size << 32) | reg[address_cells + 1]; ++ ++ *total = size; ++ ++ return grub_errno; ++} ++ ++/* Based on linux - arch/powerpc/kernel/prom_init.c */ ++struct option_vector2 { ++ grub_uint8_t byte1; ++ grub_uint16_t reserved; ++ grub_uint32_t real_base; ++ grub_uint32_t real_size; ++ grub_uint32_t virt_base; ++ grub_uint32_t virt_size; ++ grub_uint32_t load_base; ++ grub_uint32_t min_rma; ++ grub_uint32_t min_load; ++ grub_uint8_t min_rma_percent; ++ grub_uint8_t max_pft_size; ++} __attribute__((packed)); ++ ++struct pvr_entry { ++ grub_uint32_t mask; ++ grub_uint32_t entry; ++}; ++ ++struct cas_vector { ++ struct { ++ struct pvr_entry terminal; ++ } pvr_list; ++ grub_uint8_t num_vecs; ++ grub_uint8_t vec1_size; ++ grub_uint8_t vec1; ++ grub_uint8_t vec2_size; ++ struct option_vector2 vec2; ++} __attribute__((packed)); ++ ++/* Call ibm,client-architecture-support to try to get more RMA. ++ We ask for 512MB which should be enough to verify a distro kernel. ++ We ignore most errors: if we don't succeed we'll proceed with whatever ++ memory we have. */ ++static void ++grub_ieee1275_ibm_cas (void) ++{ ++ int rc; ++ grub_ieee1275_ihandle_t root; ++ struct cas_args { ++ struct grub_ieee1275_common_hdr common; ++ grub_ieee1275_cell_t method; ++ grub_ieee1275_ihandle_t ihandle; ++ grub_ieee1275_cell_t cas_addr; ++ grub_ieee1275_cell_t result; ++ } args; ++ struct cas_vector vector = { ++ .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ ++ .num_vecs = 2 - 1, ++ .vec1_size = 0, ++ .vec1 = 0x80, /* ignore */ ++ .vec2_size = 1 + sizeof(struct option_vector2) - 2, ++ .vec2 = { ++ 0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48 ++ }, ++ }; ++ ++ INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); ++ args.method = (grub_ieee1275_cell_t)"ibm,client-architecture-support"; ++ rc = grub_ieee1275_open("/", &root); ++ if (rc) { ++ grub_error (GRUB_ERR_IO, "could not open root when trying to call CAS"); ++ return; ++ } ++ args.ihandle = root; ++ args.cas_addr = (grub_ieee1275_cell_t)&vector; ++ ++ grub_printf("Calling ibm,client-architecture-support..."); ++ IEEE1275_CALL_ENTRY_FN (&args); ++ grub_printf("done\n"); ++ ++ grub_ieee1275_close(root); ++} ++ + static void + grub_claim_heap (void) + { +@@ -249,11 +378,22 @@ grub_claim_heap (void) + + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) + { +- heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, +- 1, &total); ++ heap_init (GRUB_IEEE1275_STATIC_HEAP_START, ++ GRUB_IEEE1275_STATIC_HEAP_LEN, 1, &total); + return; + } + ++ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) ++ { ++ grub_uint64_t rma_size; ++ grub_err_t err; ++ ++ err = grub_ieee1275_total_mem (&rma_size); ++ /* if we have an error, don't call CAS, just hope for the best */ ++ if (!err && rma_size < (512 * 1024 * 1024)) ++ grub_ieee1275_ibm_cas(); ++ } ++ + grub_machine_mmap_iterate (heap_size, &total); + + total = total / 4; +diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h +index b5a1d49bbc3..e0a6c2ce1e6 100644 +--- a/include/grub/ieee1275/ieee1275.h ++++ b/include/grub/ieee1275/ieee1275.h +@@ -149,7 +149,13 @@ enum grub_ieee1275_flag + + GRUB_IEEE1275_FLAG_RAW_DEVNAMES, + +- GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT ++ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT, ++ ++ /* On PFW, the first time we boot a Linux partition, we may only get 256MB ++ of real memory area, even if the partition has more memory. Set this flag ++ if we think we're running under PFW. Then, if this flag is set, and the ++ RMA is only 256MB in size, try asking for more with CAS. */ ++ GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY, + }; + + extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); diff --git a/grub.patches b/grub.patches index 59f42c3c..6ca168ce 100644 --- a/grub.patches +++ b/grub.patches @@ -196,3 +196,6 @@ Patch0195: 0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch Patch0196: 0196-Revert-templates-Disable-the-os-prober-by-default.patch Patch0197: 0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch Patch0198: 0198-fs-Use-64bit-type-for-filesystem-timestamp.patch +Patch0199: 0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0200: 0200-ieee1275-claim-more-memory.patch +Patch0201: 0201-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/grub2.spec b/grub2.spec index 450af505..56c834bd 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06~rc1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Apr 23 2021 Javier Martinez Canillas - 2.06~rc1-5 +- Find and claim more memory for ieee1275 (dja) + * Wed Apr 14 2021 Javier Martinez Canillas - 2.06~rc1-5 - Add XFS bigtime support (cmaiolino) From e91046d26412ec21bcf6cd69257e27f6467c388a Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 3 May 2021 17:23:43 +0200 Subject: [PATCH 064/294] Add XFS needsrepair support Signed-off-by: Javier Martinez Canillas --- ...srepair-in-the-supported-incompat-fe.patch | 79 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 7 +- 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch diff --git a/0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch b/0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch new file mode 100644 index 00000000..fbffc3cb --- /dev/null +++ b/0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 3 May 2021 16:57:17 +0200 +Subject: [PATCH] xfs: Include needsrepair in the supported incompat features + list + +XFS now has an incompat feature flag to indicate that the filesystem needs +to be repaired. The Linux kernel refuses to mount a filesystem that has it +set and only the xfs_repair tool is able to clear that flag. + +The GRUB doesn't have the concept of mounting filesystems and just attempt +to read the files. But it does some sanity checking, before attempting to +read from a filesystem. + +Among the things that are tested, is if the super block only has set the +incompatible features flags that are supported by GRUB. If it contains any +flags that are not listed as supported, reading the XFS filesystem fails. + +Since GRUB doesn't attempt to detect if the filesystem is inconsistent nor +replays the journal, just ignore if a filesystem needs to be repaired too. + +But print a message if grub_xfs_mount() fails, to give more information to +the user about why that could had been the case. + +Suggested-by: Eric Sandeen +Signed-off-by: Javier Martinez Canillas +--- + grub-core/fs/xfs.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 2ce76ec70f9..c4c1bca39a8 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -84,6 +84,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ + #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ + #define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */ ++#define XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR (1 << 4) /* needs xfs_repair */ + + /* + * Directory entries with ftype are explicitly handled by GRUB code. +@@ -98,7 +99,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + (XFS_SB_FEAT_INCOMPAT_FTYPE | \ + XFS_SB_FEAT_INCOMPAT_SPINODES | \ + XFS_SB_FEAT_INCOMPAT_META_UUID | \ +- XFS_SB_FEAT_INCOMPAT_BIGTIME) ++ XFS_SB_FEAT_INCOMPAT_BIGTIME | \ ++ XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR) + + struct grub_xfs_sblock + { +@@ -307,6 +309,16 @@ static int grub_xfs_sb_valid(struct grub_xfs_data *data) + return 0; + } + ++static int ++grub_xfs_sb_needs_repair(struct grub_xfs_data *data) ++{ ++ return ((data->sblock.version & ++ grub_cpu_to_be16_compile_time (XFS_SB_VERSION_NUMBITS)) == ++ grub_cpu_to_be16_compile_time (XFS_SB_VERSION_5) && ++ (data->sblock.sb_features_incompat & ++ grub_cpu_to_be32_compile_time (XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR))); ++} ++ + /* Filetype information as used in inodes. */ + #define FILETYPE_INO_MASK 0170000 + #define FILETYPE_INO_REG 0100000 +@@ -949,6 +961,9 @@ grub_xfs_mount (grub_disk_t disk) + return data; + fail: + ++ if (grub_xfs_sb_needs_repair(data)) ++ grub_dprintf("xfs", "Filesystem needs repair\n"); ++ + if (grub_errno == GRUB_ERR_OUT_OF_RANGE) + grub_error (GRUB_ERR_BAD_FS, "not an XFS filesystem"); + diff --git a/grub.patches b/grub.patches index 6ca168ce..cd6807c8 100644 --- a/grub.patches +++ b/grub.patches @@ -199,3 +199,4 @@ Patch0198: 0198-fs-Use-64bit-type-for-filesystem-timestamp.patch Patch0199: 0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch Patch0200: 0200-ieee1275-claim-more-memory.patch Patch0201: 0201-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0202: 0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch diff --git a/grub2.spec b/grub2.spec index 56c834bd..9f8918dd 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06~rc1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -555,7 +555,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog -* Fri Apr 23 2021 Javier Martinez Canillas - 2.06~rc1-5 +* Mon May 03 2021 Javier Martinez Canillas - 2.06~rc1-7 +- Add XFS needsrepair support + +* Fri Apr 23 2021 Javier Martinez Canillas - 2.06~rc1-6 - Find and claim more memory for ieee1275 (dja) * Wed Apr 14 2021 Javier Martinez Canillas - 2.06~rc1-5 From 6b5d11f7609a51272e10ba45a59f6fbe1d0c38c2 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Thu, 10 Jun 2021 10:28:48 +0200 Subject: [PATCH 065/294] Use the proper macro instead of hard coding fedora The efi-srpm-macros package contais a macro for the ESP vendor directory to make sure that the correct one for each distro is used. But the grub2 package is instead hardcoding it to "fedora", use the macro instead. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Javier Martinez Canillas --- grub2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 9f8918dd..b89c1a2d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -350,7 +350,7 @@ rm -r /boot/grub2.tmp/ || : %posttrans common set -eu -EFI_HOME=/boot/efi/EFI/fedora +EFI_HOME=%{efi_esp_dir} GRUB_HOME=/boot/grub2 if test ! -f ${EFI_HOME}/grub.cfg; then From 6dc8b4a57a342c91688fbe943d84f7d2a697efea Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 11 Jun 2021 00:18:35 +0200 Subject: [PATCH 066/294] Generate a GRUB config if is not present in the ESP If there's no GRUB config in the ESP, generate one. This is a full config but later the posttrans script will convert it to the minimal config stub. Signed-off-by: Javier Martinez Canillas --- grub2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index b89c1a2d..3ed54551 100644 --- a/grub2.spec +++ b/grub2.spec @@ -354,7 +354,7 @@ EFI_HOME=%{efi_esp_dir} GRUB_HOME=/boot/grub2 if test ! -f ${EFI_HOME}/grub.cfg; then - exit 0 # nothing to unify, nothing to do + grub2-mkconfig -o ${EFI_HOME}/grub.cfg fi if grep -q "configfile" ${EFI_HOME}/grub.cfg; then From 6d09d20265a3ef445f8fba51147f4f2ca1df55c6 Mon Sep 17 00:00:00 2001 From: Frederick Grose Date: Tue, 9 Feb 2021 22:37:58 +0000 Subject: [PATCH 067/294] grub.macros: Include f2fs in GRUB_MODULES Enable GRUB to read F2FS filesystems. --- grub.macros | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index 576e8a43..7a1e479d 100644 --- a/grub.macros +++ b/grub.macros @@ -405,7 +405,7 @@ rm -f %{1}.conf \ %define do_efi_build_images() \ GRUB_MODULES=" all_video boot blscfg btrfs \\\ cat configfile cryptodisk \\\ - echo efi_netfs efifwsetup efinet ext2 \\\ + echo efi_netfs efifwsetup efinet ext2 f2fs \\\ fat font gcry_rijndael gcry_rsa gcry_serpent \\\ gcry_sha256 gcry_twofish gcry_whirlpool \\\ gfxmenu gfxterm gzio \\\ From 13985b0e4cb9420b8e23d0c555af22c97565c693 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 14 Jun 2021 10:48:27 +0200 Subject: [PATCH 068/294] Update to 2.06 final release and ton of fixes Signed-off-by: Javier Martinez Canillas --- ...-Fix-user-facing-typo-with-an-incorr.patch | 24 + ...-Properly-disable-the-os-prober-by-d.patch | 12 +- ...tes-Disable-the-os-prober-by-default.patch | 16 +- ...d-support-for-Linux-EFI-stub-loading.patch | 2 +- ...d.patch => 0005-Rework-linux-command.patch | 0 ...patch => 0006-Rework-linux16-command.patch | 0 ...ecureboot-support-on-efi-chainloader.patch | 0 ...loaders-that-link-in-efi-mode-honor-.patch | 0 ...rch-64-on-32-boot-in-linuxefi-loader.patch | 0 ...re.patch => 0010-re-write-.gitignore.patch | 0 ...ient-architecture-CAS-reboot-support.patch | 0 ...nsole-display-attr-when-clear-screen.patch | 2 +- ...video-support-for-IBM-power-machines.patch | 0 ...4-Move-bash-completion-script-922997.patch | 2 +- ...o-include-entries-by-title-not-just-.patch | 0 ...=> 0016-Make-exit-take-a-return-code.patch | 0 ...es-load-an-env-block-from-a-variable.patch | 0 ...018-Migrate-PPC-from-Yaboot-to-Grub2.patch | 0 ...=> 0019-Add-fw_path-variable-revised.patch | 0 ...-hex-hex-straight-through-unmolested.patch | 0 ...g-module-to-parse-Boot-Loader-Specif.patch | 0 ...patch => 0022-Add-devicetree-loading.patch | 4 +- ...3-Don-t-write-messages-to-the-screen.patch | 0 ... => 0024-Don-t-print-GNU-GRUB-header.patch | 0 ...=> 0025-Don-t-add-to-highlighted-row.patch | 0 ...atch => 0026-Message-string-cleanups.patch | 0 ...ing-now-that-we-aren-t-displaying-it.patch | 0 ...t-indentation-for-the-term-help-text.patch | 0 ...es.patch => 0029-Indent-menu-entries.patch | 0 ...ix-margins.patch => 0030-Fix-margins.patch | 0 ...-1-for-our-right-hand-margin-so-line.patch | 0 ...0032-Enable-pager-by-default.-985860.patch | 0 ...-on-serial-so-don-t-tell-the-user-to.patch | 0 ...n-t-say-GNU-Linux-in-generated-menus.patch | 0 ...-Don-t-draw-a-border-around-the-menu.patch | 0 ...andard-margin-for-the-timeout-string.patch | 0 ...rame-to-list-of-relocations-stripped.patch | 0 ...password-to-boot-entries-generated-b.patch | 0 ...=> 0039-Don-t-emit-Booting-.-message.patch | 0 ...f-man-pages-with-slightly-nicer-ones.patch | 2 +- ...ix-when-fallback-searching-for-grub-.patch | 0 ...-before-grub.cfg-on-tftp-config-file.patch | 0 ...CLASS-in-10_linux-from-etc-os-releas.patch | 0 ...t-ordering-for-.debug-and-rescue-ker.patch | 0 ...5-Try-prefix-if-fw_path-doesn-t-work.patch | 0 ...-Package-Sort-for-grub2-mkconfig-112.patch | 2 +- ...fig-construct-titles-that-look-like-.patch | 0 ...ly-grub2-password-config-tool-985962.patch | 6 +- ... 0049-tcp-add-window-scaling-support.patch | 0 ...net-and-bootp-add-support-for-dhcpv6.patch | 2 +- ...rnel-settings-and-use-it-in-10_linux.patch | 6 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 0 ... 0053-Make-grub_fatal-also-backtrace.patch | 0 ...ix-up-some-man-pages-rpmdiff-noticed.patch | 2 +- ...fo-pages-say-grub2-where-appropriate.patch | 114 +++-- ...-chainloader-entries-don-t-try-any-x.patch | 6 +- ...-Add-ability-to-boot-from-subvolumes.patch | 0 ...port-btrfs_subvol-and-btrfs_subvolid.patch | 0 ...> 0059-grub2-btrfs-03-follow_default.patch | 0 ...=> 0060-grub2-btrfs-04-grub2-install.patch | 2 +- ...> 0061-grub2-btrfs-05-grub2-mkconfig.patch | 4 +- ... => 0062-grub2-btrfs-06-subvol-mount.patch | 2 +- ...subvol-name-scheme-to-support-old-sn.patch | 0 ...-correctly-with-btrfs-snapshots-bsc-.patch | 0 ...ocate_pool-and-grub_efi_free_pool-wr.patch | 0 ...fi_.-memory-helpers-where-reasonable.patch | 0 ...7-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 0 ...=> 0068-don-t-use-int-for-efi-status.patch | 0 ...INIT-declare-its-function-prototypes.patch | 0 ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 2 +- ...d-xen-or-multiboot-2-modules-as-need.patch | 0 ...-calibration-not-take-51-seconds-to-.patch | 0 ...073-align-struct-efi_variable-better.patch | 2 +- ...074-Add-BLS-support-to-grub-mkconfig.patch | 4 +- ...-backtrace-on-grub_abort-for-grub-em.patch | 0 ...nux-and-initrd-commands-for-grub-emu.patch | 0 ...h => 0077-Add-grub2-switch-to-blscfg.patch | 0 ...patch => 0078-make-better-backtraces.patch | 0 ...w-our-startup-message-if-debug-is-se.patch | 0 ...-some-minor-include-path-weirdnesses.patch | 0 ...it-possible-to-enabled-build-id-sha1.patch | 2 +- ...f-grub_dprintf-without-the-file-line.patch | 0 ...dprintf-that-tells-us-load-addresses.patch | 0 ...tch => 0084-Fixup-for-newer-compiler.patch | 0 ...-export-the-start-and-_start-symbols.patch | 0 ...tch => 0086-Fixup-for-newer-compiler.patch | 0 ...pport-for-non-Ethernet-network-cards.patch | 2 +- ...racketed-ipv6-addrs-and-port-numbers.patch | 0 ...=> 0089-bootp-New-net_bootp6-command.patch | 2 +- ...=> 0090-efinet-UEFI-IPv6-PXE-support.patch | 0 ...091-grub.texi-Add-net_bootp6-doument.patch | 6 +- ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 2 +- ...etting-network-from-UEFI-device-path.patch | 0 ...etting-DNS-server-from-UEFI-protocol.patch | 0 ...95-Support-UEFI-networking-protocols.patch | 4 +- ...> 0096-AUDIT-0-http-boot-tracker-bug.patch | 0 ...-incr-command-to-increment-integer-v.patch | 0 ...h => 0098-Add-auto-hide-menu-support.patch | 16 +- ...> 0099-Add-grub-set-bootflag-utility.patch | 0 ...b-boot-indeterminate.service-example.patch | 0 ...h => 0101-gentpl-add-disable-support.patch | 0 ... => 0102-gentpl-add-pc-firmware-type.patch | 0 ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 2 +- ...make-it-possible-to-run-checkers-on-.patch | 0 ...07-Rework-how-the-fdt-command-builds.patch | 0 ...able-non-wordsize-allocations-on-arm.patch | 2 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 0 ...=> 0110-Make-grub_error-more-verbose.patch | 0 ...eset-an-alias-for-the-reboot-command.patch | 0 ....patch => 0112-Add-a-version-command.patch | 2 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 0 ...-Better-memory-allocation-and-error-.patch | 8 +- ...tter-locations-for-kernel-and-initrd.patch | 6 +- ...p-all-the-places-Wsign-compare-error.patch | 0 ...gn-compare-Wno-conversion-Wno-error-.patch | 2 +- ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 0 ...itrd-params-cmdline-allocations-abov.patch | 0 ... => 0122-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 2 +- ...tch => 0124-Reimplement-boot_counter.patch | 0 ...ntry-selection-based-on-ID-and-title.patch | 0 ...try-users-option-argument-to-be-opti.patch | 0 ...export-env-and-efi-load-env-commands.patch | 0 ...le-to-subtract-conditions-from-debug.patch | 0 ...bles-from-the-initial-context-when-c.patch | 0 ...-boot-success-reset-from-menu-auto-h.patch | 0 ...ix-systemctl-kexec-exit-status-check.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 0 ...ferences-for-fdt-when-building-with-.patch | 0 ... => 0135-Do-better-in-bootstrap.conf.patch | 0 ...0136-Use-git-to-apply-gnulib-patches.patch | 0 ...-error-with-the-fdt-module-on-risc-v.patch | 0 ...g-Update-comment-about-running-as-ro.patch | 0 ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...indeterminate-getting-set-on-boot_su.patch | 0 ..._EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch | 0 ...ader-Define-machine-types-for-RISC-V.patch | 0 ... => 0143-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 0 ...fw-http-_path-variables-to-make-them.patch | 0 ...-literal-IPv6-addresses-in-square-br.patch | 0 ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 0 ...se-address-before-jumping-to-the-PE-.patch | 0 ...ate-TPM-measurement-errors-to-the-ve.patch | 0 ...maximum-bounce-buffer-size-to-16-MiB.patch | 0 ...fix-when-the-HTTP-path-is-relative-a.patch | 0 ...turn-in-efi-export-env-and-efi-load-.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 0 ...rnel-validation-without-shim-protoco.patch | 0 ...ar-pointers-in-grub-core-net-bootp.c.patch | 2 +- ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 0 ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 0 ...ll-disable-support-for-EFI-platforms.patch | 6 +- ...imestamps-configure-flag-to-prepend-.patch | 2 +- ...ements-to-grub_disk_open-and-grub_di.patch | 0 ...on-grub_debug_is_enabled-void-return.patch | 0 ...ear-screen-when-debugging-is-enabled.patch | 0 ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 0 ...igning-grub-with-an-appended-signatu.patch | 14 +- ...rub-Document-signing-grub-under-UEFI.patch | 8 +- ...nt-signing-grub-with-an-appended-sig.patch | 4 +- ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0183-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0186-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...89-libtasn1-compile-into-asn1-module.patch | 0 ...0-test_asn1-test-module-for-libtasn1.patch | 0 ...-support-embedding-x509-certificates.patch | 14 +- ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 119 ++++- ...96-appended-signatures-documentation.patch | 28 +- ...s-Add-bigtime-support-for-xfs-driver.patch | 167 ------- ...er-lockdown-based-on-ibm-secure-boot.patch | 4 +- ...-64bit-type-for-filesystem-timestamp.patch | 327 -------------- ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0199-ieee1275-claim-more-memory.patch | 2 +- ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 315 ++++++++++++++ ...eee1275-ofdisk-retry-on-open-failure.patch | 103 +++++ ...srepair-in-the-supported-incompat-fe.patch | 79 ---- ...nu_auto_hide.in-fix-a-then-than-typo.patch | 26 ++ 0204-Fix-disabling-grub-rpm-sort.patch | 59 +++ ...-Don-t-check-for-rpmvercmp-in-librpm.patch | 57 +++ ...ainloading-EFI-apps-from-loop-mounts.patch | 136 ++++++ 0207-efinet-Add-DHCP-proxy-support.patch | 50 +++ ...gnore-checksum-seed-incompat-feature.patch | 54 +++ grub.patches | 410 +++++++++--------- grub2.spec | 9 +- sources | 2 +- 214 files changed, 1316 insertions(+), 957 deletions(-) create mode 100644 0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch rename 0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch => 0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch (91%) rename 0196-Revert-templates-Disable-the-os-prober-by-default.patch => 0003-Revert-templates-Disable-the-os-prober-by-default.patch (88%) rename 0001-Add-support-for-Linux-EFI-stub-loading.patch => 0004-Add-support-for-Linux-EFI-stub-loading.patch (99%) rename 0002-Rework-linux-command.patch => 0005-Rework-linux-command.patch (100%) rename 0003-Rework-linux16-command.patch => 0006-Rework-linux16-command.patch (100%) rename 0004-Add-secureboot-support-on-efi-chainloader.patch => 0007-Add-secureboot-support-on-efi-chainloader.patch (100%) rename 0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch => 0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch (100%) rename 0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch => 0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch (100%) rename 0007-re-write-.gitignore.patch => 0010-re-write-.gitignore.patch (100%) rename 0008-IBM-client-architecture-CAS-reboot-support.patch => 0011-IBM-client-architecture-CAS-reboot-support.patch (100%) rename 0009-for-ppc-reset-console-display-attr-when-clear-screen.patch => 0012-for-ppc-reset-console-display-attr-when-clear-screen.patch (97%) rename 0010-Disable-GRUB-video-support-for-IBM-power-machines.patch => 0013-Disable-GRUB-video-support-for-IBM-power-machines.patch (100%) rename 0011-Move-bash-completion-script-922997.patch => 0014-Move-bash-completion-script-922997.patch (97%) rename 0012-Allow-fallback-to-include-entries-by-title-not-just-.patch => 0015-Allow-fallback-to-include-entries-by-title-not-just-.patch (100%) rename 0013-Make-exit-take-a-return-code.patch => 0016-Make-exit-take-a-return-code.patch (100%) rename 0014-Make-efi-machines-load-an-env-block-from-a-variable.patch => 0017-Make-efi-machines-load-an-env-block-from-a-variable.patch (100%) rename 0015-Migrate-PPC-from-Yaboot-to-Grub2.patch => 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch (100%) rename 0016-Add-fw_path-variable-revised.patch => 0019-Add-fw_path-variable-revised.patch (100%) rename 0017-Pass-x-hex-hex-straight-through-unmolested.patch => 0020-Pass-x-hex-hex-straight-through-unmolested.patch (100%) rename 0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch => 0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch (100%) rename 0019-Add-devicetree-loading.patch => 0022-Add-devicetree-loading.patch (96%) rename 0020-Don-t-write-messages-to-the-screen.patch => 0023-Don-t-write-messages-to-the-screen.patch (100%) rename 0021-Don-t-print-GNU-GRUB-header.patch => 0024-Don-t-print-GNU-GRUB-header.patch (100%) rename 0022-Don-t-add-to-highlighted-row.patch => 0025-Don-t-add-to-highlighted-row.patch (100%) rename 0023-Message-string-cleanups.patch => 0026-Message-string-cleanups.patch (100%) rename 0024-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch => 0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch (100%) rename 0025-Use-the-correct-indentation-for-the-term-help-text.patch => 0028-Use-the-correct-indentation-for-the-term-help-text.patch (100%) rename 0026-Indent-menu-entries.patch => 0029-Indent-menu-entries.patch (100%) rename 0027-Fix-margins.patch => 0030-Fix-margins.patch (100%) rename 0028-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch => 0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch (100%) rename 0029-Enable-pager-by-default.-985860.patch => 0032-Enable-pager-by-default.-985860.patch (100%) rename 0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch => 0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch (100%) rename 0031-Don-t-say-GNU-Linux-in-generated-menus.patch => 0034-Don-t-say-GNU-Linux-in-generated-menus.patch (100%) rename 0032-Don-t-draw-a-border-around-the-menu.patch => 0035-Don-t-draw-a-border-around-the-menu.patch (100%) rename 0033-Use-the-standard-margin-for-the-timeout-string.patch => 0036-Use-the-standard-margin-for-the-timeout-string.patch (100%) rename 0034-Add-.eh_frame-to-list-of-relocations-stripped.patch => 0037-Add-.eh_frame-to-list-of-relocations-stripped.patch (100%) rename 0035-Don-t-require-a-password-to-boot-entries-generated-b.patch => 0038-Don-t-require-a-password-to-boot-entries-generated-b.patch (100%) rename 0036-Don-t-emit-Booting-.-message.patch => 0039-Don-t-emit-Booting-.-message.patch (100%) rename 0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch => 0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch (99%) rename 0038-use-fw_path-prefix-when-fallback-searching-for-grub-.patch => 0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch (100%) rename 0039-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch => 0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch (100%) rename 0040-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch => 0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch (100%) rename 0041-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch => 0044-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch (100%) rename 0042-Try-prefix-if-fw_path-doesn-t-work.patch => 0045-Try-prefix-if-fw_path-doesn-t-work.patch (100%) rename 0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch => 0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch (99%) rename 0044-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (100%) rename 0045-Add-friendly-grub2-password-config-tool-985962.patch => 0048-Add-friendly-grub2-password-config-tool-985962.patch (98%) rename 0046-tcp-add-window-scaling-support.patch => 0049-tcp-add-window-scaling-support.patch (100%) rename 0047-efinet-and-bootp-add-support-for-dhcpv6.patch => 0050-efinet-and-bootp-add-support-for-dhcpv6.patch (99%) rename 0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (98%) rename 0049-bz1374141-fix-incorrect-mask-for-ppc64.patch => 0052-bz1374141-fix-incorrect-mask-for-ppc64.patch (100%) rename 0050-Make-grub_fatal-also-backtrace.patch => 0053-Make-grub_fatal-also-backtrace.patch (100%) rename 0051-Fix-up-some-man-pages-rpmdiff-noticed.patch => 0054-Fix-up-some-man-pages-rpmdiff-noticed.patch (99%) rename 0052-Make-our-info-pages-say-grub2-where-appropriate.patch => 0055-Make-our-info-pages-say-grub2-where-appropriate.patch (92%) rename 0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch (97%) rename 0054-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0057-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (100%) rename 0055-export-btrfs_subvol-and-btrfs_subvolid.patch => 0058-export-btrfs_subvol-and-btrfs_subvolid.patch (100%) rename 0056-grub2-btrfs-03-follow_default.patch => 0059-grub2-btrfs-03-follow_default.patch (100%) rename 0057-grub2-btrfs-04-grub2-install.patch => 0060-grub2-btrfs-04-grub2-install.patch (99%) rename 0058-grub2-btrfs-05-grub2-mkconfig.patch => 0061-grub2-btrfs-05-grub2-mkconfig.patch (98%) rename 0059-grub2-btrfs-06-subvol-mount.patch => 0062-grub2-btrfs-06-subvol-mount.patch (99%) rename 0060-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0063-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (100%) rename 0061-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (100%) rename 0062-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (100%) rename 0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch => 0066-Use-grub_efi_.-memory-helpers-where-reasonable.patch (100%) rename 0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch => 0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch (100%) rename 0065-don-t-use-int-for-efi-status.patch => 0068-don-t-use-int-for-efi-status.patch (100%) rename 0066-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0069-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (100%) rename 0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (96%) rename 0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0071-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (100%) rename 0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch => 0072-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch (100%) rename 0070-align-struct-efi_variable-better.patch => 0073-align-struct-efi_variable-better.patch (96%) rename 0071-Add-BLS-support-to-grub-mkconfig.patch => 0074-Add-BLS-support-to-grub-mkconfig.patch (99%) rename 0072-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0075-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (100%) rename 0073-Add-linux-and-initrd-commands-for-grub-emu.patch => 0076-Add-linux-and-initrd-commands-for-grub-emu.patch (100%) rename 0074-Add-grub2-switch-to-blscfg.patch => 0077-Add-grub2-switch-to-blscfg.patch (100%) rename 0075-make-better-backtraces.patch => 0078-make-better-backtraces.patch (100%) rename 0076-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (100%) rename 0077-Work-around-some-minor-include-path-weirdnesses.patch => 0080-Work-around-some-minor-include-path-weirdnesses.patch (100%) rename 0078-Make-it-possible-to-enabled-build-id-sha1.patch => 0081-Make-it-possible-to-enabled-build-id-sha1.patch (98%) rename 0079-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0082-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (100%) rename 0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0083-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (100%) rename 0081-Fixup-for-newer-compiler.patch => 0084-Fixup-for-newer-compiler.patch (100%) rename 0082-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0085-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (100%) rename 0083-Fixup-for-newer-compiler.patch => 0086-Fixup-for-newer-compiler.patch (100%) rename 0084-Add-support-for-non-Ethernet-network-cards.patch => 0087-Add-support-for-non-Ethernet-network-cards.patch (99%) rename 0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0088-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (100%) rename 0086-bootp-New-net_bootp6-command.patch => 0089-bootp-New-net_bootp6-command.patch (99%) rename 0087-efinet-UEFI-IPv6-PXE-support.patch => 0090-efinet-UEFI-IPv6-PXE-support.patch (100%) rename 0088-grub.texi-Add-net_bootp6-doument.patch => 0091-grub.texi-Add-net_bootp6-doument.patch (90%) rename 0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (99%) rename 0090-efinet-Setting-network-from-UEFI-device-path.patch => 0093-efinet-Setting-network-from-UEFI-device-path.patch (100%) rename 0091-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0094-efinet-Setting-DNS-server-from-UEFI-protocol.patch (100%) rename 0092-Support-UEFI-networking-protocols.patch => 0095-Support-UEFI-networking-protocols.patch (99%) rename 0093-AUDIT-0-http-boot-tracker-bug.patch => 0096-AUDIT-0-http-boot-tracker-bug.patch (100%) rename 0094-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0097-grub-editenv-Add-incr-command-to-increment-integer-v.patch (100%) rename 0095-Add-auto-hide-menu-support.patch => 0098-Add-auto-hide-menu-support.patch (95%) rename 0096-Add-grub-set-bootflag-utility.patch => 0099-Add-grub-set-bootflag-utility.patch (100%) rename 0097-docs-Add-grub-boot-indeterminate.service-example.patch => 0100-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0098-gentpl-add-disable-support.patch => 0101-gentpl-add-disable-support.patch (100%) rename 0099-gentpl-add-pc-firmware-type.patch => 0102-gentpl-add-pc-firmware-type.patch (100%) rename 0100-efinet-also-use-the-firmware-acceleration-for-http.patch => 0103-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0101-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0104-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (99%) rename 0103-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0106-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0104-Rework-how-the-fdt-command-builds.patch => 0107-Rework-how-the-fdt-command-builds.patch (100%) rename 0105-Disable-non-wordsize-allocations-on-arm.patch => 0108-Disable-non-wordsize-allocations-on-arm.patch (97%) rename 0106-Prepend-prefix-when-HTTP-path-is-relative.patch => 0109-Prepend-prefix-when-HTTP-path-is-relative.patch (100%) rename 0107-Make-grub_error-more-verbose.patch => 0110-Make-grub_error-more-verbose.patch (100%) rename 0108-Make-reset-an-alias-for-the-reboot-command.patch => 0111-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0109-Add-a-version-command.patch => 0112-Add-a-version-command.patch (99%) rename 0110-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (100%) rename 0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch (97%) rename 0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch (97%) rename 0113-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0116-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (100%) rename 0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (98%) rename 0115-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0118-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0116-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0119-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0117-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0120-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (100%) rename 0118-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0121-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (100%) rename 0119-Fix-getroot.c-s-trampolines.patch => 0122-Fix-getroot.c-s-trampolines.patch (100%) rename 0120-Do-not-allow-stack-trampolines-anywhere.patch => 0123-Do-not-allow-stack-trampolines-anywhere.patch (97%) rename 0121-Reimplement-boot_counter.patch => 0124-Reimplement-boot_counter.patch (100%) rename 0122-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0125-Fix-menu-entry-selection-based-on-ID-and-title.patch (100%) rename 0123-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0126-Make-the-menu-entry-users-option-argument-to-be-opti.patch (100%) rename 0124-Add-efi-export-env-and-efi-load-env-commands.patch => 0127-Add-efi-export-env-and-efi-load-env-commands.patch (100%) rename 0125-Make-it-possible-to-subtract-conditions-from-debug.patch => 0128-Make-it-possible-to-subtract-conditions-from-debug.patch (100%) rename 0126-Export-all-variables-from-the-initial-context-when-c.patch => 0129-Export-all-variables-from-the-initial-context-when-c.patch (100%) rename 0127-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (100%) rename 0128-Fix-systemctl-kexec-exit-status-check.patch => 0131-Fix-systemctl-kexec-exit-status-check.patch (100%) rename 0129-Print-grub-emu-linux-loader-messages-as-debug.patch => 0132-Print-grub-emu-linux-loader-messages-as-debug.patch (100%) rename 0130-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0133-Don-t-assume-that-boot-commands-will-only-return-on-.patch (100%) rename 0131-Fix-undefined-references-for-fdt-when-building-with-.patch => 0134-Fix-undefined-references-for-fdt-when-building-with-.patch (100%) rename 0132-Do-better-in-bootstrap.conf.patch => 0135-Do-better-in-bootstrap.conf.patch (100%) rename 0133-Use-git-to-apply-gnulib-patches.patch => 0136-Use-git-to-apply-gnulib-patches.patch (100%) rename 0134-Fix-build-error-with-the-fdt-module-on-risc-v.patch => 0137-Fix-build-error-with-the-fdt-module-on-risc-v.patch (100%) rename 0135-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0138-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) rename 0136-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0139-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) rename 0137-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0140-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (100%) rename 0138-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch => 0141-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch (100%) rename 0139-chainloader-Define-machine-types-for-RISC-V.patch => 0142-chainloader-Define-machine-types-for-RISC-V.patch (100%) rename 0140-Add-start-symbol-for-RISC-V.patch => 0143-Add-start-symbol-for-RISC-V.patch (100%) rename 0141-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0144-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (100%) rename 0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch (100%) rename 0143-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0146-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) rename 0144-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0147-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0145-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0148-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) rename 0146-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0149-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) rename 0147-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0150-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (100%) rename 0148-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0151-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (100%) rename 0149-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0152-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (100%) rename 0150-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0153-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (100%) rename 0151-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0154-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (100%) rename 0152-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0155-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (100%) rename 0153-efi-dhcp-fix-some-allocation-error-checking.patch => 0156-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0154-efi-http-fix-some-allocation-error-checking.patch => 0157-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0155-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0158-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0156-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0159-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (100%) rename 0157-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0160-linuxefi-fail-kernel-validation-without-shim-protoco.patch (100%) rename 0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (97%) rename 0159-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0162-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0160-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0163-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) rename 0161-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0164-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0162-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0165-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0163-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0166-Add-systemd-integration-scripts-to-make-systemctl-re.patch (100%) rename 0164-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0167-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0165-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0168-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (100%) rename 0166-grub-install-disable-support-for-EFI-platforms.patch => 0169-grub-install-disable-support-for-EFI-platforms.patch (96%) rename 0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch (98%) rename 0168-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0171-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (100%) rename 0169-Introduce-function-grub_debug_is_enabled-void-return.patch => 0172-Introduce-function-grub_debug_is_enabled-void-return.patch (100%) rename 0170-Don-t-clear-screen-when-debugging-is-enabled.patch => 0173-Don-t-clear-screen-when-debugging-is-enabled.patch (100%) rename 0171-grub_file_-instrumentation-new-file-debug-tag.patch => 0174-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0172-ieee1275-Avoiding-many-unecessary-open-close.patch => 0175-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0173-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0176-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0174-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0177-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0175-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (100%) rename 0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch (97%) rename 0177-docs-grub-Document-signing-grub-under-UEFI.patch => 0180-docs-grub-Document-signing-grub-under-UEFI.patch (92%) rename 0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch (95%) rename 0179-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0182-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0180-pgp-factor-out-rsa_pad.patch => 0183-pgp-factor-out-rsa_pad.patch (100%) rename 0181-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0184-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0182-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0185-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0183-libtasn1-import-libtasn1-4.16.0.patch => 0186-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0184-libtasn1-disable-code-not-needed-in-grub.patch => 0187-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0185-libtasn1-changes-for-grub-compatibility.patch => 0188-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0186-libtasn1-compile-into-asn1-module.patch => 0189-libtasn1-compile-into-asn1-module.patch (100%) rename 0187-test_asn1-test-module-for-libtasn1.patch => 0190-test_asn1-test-module-for-libtasn1.patch (100%) rename 0188-grub-install-support-embedding-x509-certificates.patch => 0191-grub-install-support-embedding-x509-certificates.patch (96%) rename 0189-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0192-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0190-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0193-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0191-appended-signatures-support-verifying-appended-signa.patch => 0194-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0192-appended-signatures-verification-tests.patch => 0195-appended-signatures-verification-tests.patch (86%) rename 0193-appended-signatures-documentation.patch => 0196-appended-signatures-documentation.patch (94%) delete mode 100644 0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch rename 0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (97%) delete mode 100644 0198-fs-Use-64bit-type-for-filesystem-timestamp.patch rename 0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0198-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0200-ieee1275-claim-more-memory.patch => 0199-ieee1275-claim-more-memory.patch (99%) rename 0201-ieee1275-request-memory-with-ibm-client-architecture.patch => 0200-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) create mode 100644 0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch create mode 100644 0202-ieee1275-ofdisk-retry-on-open-failure.patch delete mode 100644 0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch create mode 100644 0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch create mode 100644 0204-Fix-disabling-grub-rpm-sort.patch create mode 100644 0205-Don-t-check-for-rpmvercmp-in-librpm.patch create mode 100644 0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch create mode 100644 0207-efinet-Add-DHCP-proxy-support.patch create mode 100644 0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch b/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch new file mode 100644 index 00000000..fcc78251 --- /dev/null +++ b/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Fri, 11 Jun 2021 12:10:45 +0200 +Subject: [PATCH] Revert "templates: Fix user-facing typo with an incorrect use + of "it's"" + +This reverts commit 722737630889607c3b5761f1f5a48f1674cd2821. +--- + util/grub.d/30_os-prober.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in +index 5984e92d291..94622481284 100644 +--- a/util/grub.d/30_os-prober.in ++++ b/util/grub.d/30_os-prober.in +@@ -36,7 +36,7 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n + exit 0 + fi + +-grub_warn "$(gettext_printf "os-prober will be executed to detect other bootable partitions.\nIts output will be used to detect bootable binaries on them and create new boot entries.")" ++grub_warn "$(gettext_printf "os-prober will be executed to detect other bootable partitions.\nIt's output will be used to detect bootable binaries on them and create new boot entries.")" + + OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`" + if [ -z "${OSPROBED}" ] ; then diff --git a/0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch b/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch similarity index 91% rename from 0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch rename to 0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch index 6c2b8a4c..4187765f 100644 --- a/0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch +++ b/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas -Date: Fri, 12 Mar 2021 23:25:01 +0100 +Date: Fri, 11 Jun 2021 12:10:54 +0200 Subject: [PATCH] Revert "templates: Properly disable the os-prober by default" This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925. @@ -10,10 +10,10 @@ This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925. 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 1a70b7ea056..f55339a3f64 100644 +index f8cbb8d7a2b..d3e879b8e5c 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -147,9 +147,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2 +@@ -140,9 +140,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2 GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`" GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true @@ -23,7 +23,7 @@ index 1a70b7ea056..f55339a3f64 100644 # Filesystem for the device containing our userland. Used for stuff like # choosing Hurd filesystem module. GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`" -@@ -213,7 +210,6 @@ export GRUB_DEVICE \ +@@ -204,7 +201,6 @@ export GRUB_DEVICE \ GRUB_DEVICE_PARTUUID \ GRUB_DEVICE_BOOT \ GRUB_DEVICE_BOOT_UUID \ @@ -31,7 +31,7 @@ index 1a70b7ea056..f55339a3f64 100644 GRUB_FS \ GRUB_FONT \ GRUB_PRELOAD_MODULES \ -@@ -255,6 +251,7 @@ export GRUB_DEFAULT \ +@@ -246,6 +242,7 @@ export GRUB_DEFAULT \ GRUB_BACKGROUND \ GRUB_THEME \ GRUB_GFXPAYLOAD_LINUX \ @@ -40,7 +40,7 @@ index 1a70b7ea056..f55339a3f64 100644 GRUB_SAVEDEFAULT \ GRUB_ENABLE_CRYPTODISK \ diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 21bbace4647..7591edc58ed 100644 +index 94622481284..80685b15f4d 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0196-Revert-templates-Disable-the-os-prober-by-default.patch b/0003-Revert-templates-Disable-the-os-prober-by-default.patch similarity index 88% rename from 0196-Revert-templates-Disable-the-os-prober-by-default.patch rename to 0003-Revert-templates-Disable-the-os-prober-by-default.patch index b97c4c73..68cacfca 100644 --- a/0196-Revert-templates-Disable-the-os-prober-by-default.patch +++ b/0003-Revert-templates-Disable-the-os-prober-by-default.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas -Date: Fri, 12 Mar 2021 23:26:15 +0100 +Date: Fri, 11 Jun 2021 12:10:58 +0200 Subject: [PATCH] Revert "templates: Disable the os-prober by default" This reverts commit e346414725a70e5c74ee87ca14e580c66f517666. @@ -10,28 +10,28 @@ This reverts commit e346414725a70e5c74ee87ca14e580c66f517666. 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index cb5804fd6fe..d183575bc18 100644 +index f8b4b3b21a7..69f08d289f9 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -1526,13 +1526,10 @@ boot sequence. If you have problems, set this option to @samp{text} and +@@ -1519,13 +1519,10 @@ boot sequence. If you have problems, set this option to @samp{text} and GRUB will tell Linux to boot in normal text mode. @item GRUB_DISABLE_OS_PROBER --The @command{grub2-mkconfig} has a feature to use the external +-The @command{grub-mkconfig} has a feature to use the external -@command{os-prober} program to discover other operating systems installed on -the same machine and generate appropriate menu entries for them. It is disabled -by default since automatic and silent execution of @command{os-prober}, and -creating boot entries based on that data, is a potential attack vector. Set -this option to @samp{false} to enable this feature in the --@command{grub2-mkconfig} command. -+Normally, @command{grub2-mkconfig} will try to use the external +-@command{grub-mkconfig} command. ++Normally, @command{grub-mkconfig} will try to use the external +@command{os-prober} program, if installed, to discover other operating +systems installed on the same system and generate appropriate menu entries +for them. Set this option to @samp{true} to disable this. @item GRUB_OS_PROBER_SKIP_LIST List of space-separated FS UUIDs of filesystems to be ignored from os-prober -@@ -1860,9 +1857,10 @@ than zero; otherwise 0. +@@ -1853,9 +1850,10 @@ than zero; otherwise 0. @section Multi-boot manual config Currently autogenerating config files for multi-boot environments depends on @@ -46,7 +46,7 @@ index cb5804fd6fe..d183575bc18 100644 First create a separate GRUB partition, big enough to hold GRUB. Some of the following entries show how to load OS installer images from this same partition, diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 7591edc58ed..3c9431cfcfb 100644 +index 80685b15f4d..1b91c102f35 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0001-Add-support-for-Linux-EFI-stub-loading.patch b/0004-Add-support-for-Linux-EFI-stub-loading.patch similarity index 99% rename from 0001-Add-support-for-Linux-EFI-stub-loading.patch rename to 0004-Add-support-for-Linux-EFI-stub-loading.patch index 74044b8b..73d231a2 100644 --- a/0001-Add-support-for-Linux-EFI-stub-loading.patch +++ b/0004-Add-support-for-Linux-EFI-stub-loading.patch @@ -166,7 +166,7 @@ index 8cff7be0289..35b8f670602 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 0cdb063bb1b..74360542062 100644 +index 9838fb2f50d..f6aef0ef649 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address, diff --git a/0002-Rework-linux-command.patch b/0005-Rework-linux-command.patch similarity index 100% rename from 0002-Rework-linux-command.patch rename to 0005-Rework-linux-command.patch diff --git a/0003-Rework-linux16-command.patch b/0006-Rework-linux16-command.patch similarity index 100% rename from 0003-Rework-linux16-command.patch rename to 0006-Rework-linux16-command.patch diff --git a/0004-Add-secureboot-support-on-efi-chainloader.patch b/0007-Add-secureboot-support-on-efi-chainloader.patch similarity index 100% rename from 0004-Add-secureboot-support-on-efi-chainloader.patch rename to 0007-Add-secureboot-support-on-efi-chainloader.patch diff --git a/0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch similarity index 100% rename from 0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch rename to 0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch diff --git a/0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch b/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch similarity index 100% rename from 0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch rename to 0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch diff --git a/0007-re-write-.gitignore.patch b/0010-re-write-.gitignore.patch similarity index 100% rename from 0007-re-write-.gitignore.patch rename to 0010-re-write-.gitignore.patch diff --git a/0008-IBM-client-architecture-CAS-reboot-support.patch b/0011-IBM-client-architecture-CAS-reboot-support.patch similarity index 100% rename from 0008-IBM-client-architecture-CAS-reboot-support.patch rename to 0011-IBM-client-architecture-CAS-reboot-support.patch diff --git a/0009-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch similarity index 97% rename from 0009-for-ppc-reset-console-display-attr-when-clear-screen.patch rename to 0012-for-ppc-reset-console-display-attr-when-clear-screen.patch index fd86ef1a..c8bb9d3c 100644 --- a/0009-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index cd720080375..44d0b3b19fb 100644 +index 85ecf06b4df..05c88dcf49e 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term, diff --git a/0010-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch similarity index 100% rename from 0010-Disable-GRUB-video-support-for-IBM-power-machines.patch rename to 0013-Disable-GRUB-video-support-for-IBM-power-machines.patch diff --git a/0011-Move-bash-completion-script-922997.patch b/0014-Move-bash-completion-script-922997.patch similarity index 97% rename from 0011-Move-bash-completion-script-922997.patch rename to 0014-Move-bash-completion-script-922997.patch index 606e39b6..6bf0b4b9 100644 --- a/0011-Move-bash-completion-script-922997.patch +++ b/0014-Move-bash-completion-script-922997.patch @@ -10,7 +10,7 @@ Apparently these go in a new place now. 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 74719416c4c..c0103b30d4e 100644 +index 7517fc49d98..8331f95b645 100644 --- a/configure.ac +++ b/configure.ac @@ -314,6 +314,14 @@ AC_SUBST(grubdirname) diff --git a/0012-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch similarity index 100% rename from 0012-Allow-fallback-to-include-entries-by-title-not-just-.patch rename to 0015-Allow-fallback-to-include-entries-by-title-not-just-.patch diff --git a/0013-Make-exit-take-a-return-code.patch b/0016-Make-exit-take-a-return-code.patch similarity index 100% rename from 0013-Make-exit-take-a-return-code.patch rename to 0016-Make-exit-take-a-return-code.patch diff --git a/0014-Make-efi-machines-load-an-env-block-from-a-variable.patch b/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch similarity index 100% rename from 0014-Make-efi-machines-load-an-env-block-from-a-variable.patch rename to 0017-Make-efi-machines-load-an-env-block-from-a-variable.patch diff --git a/0015-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch similarity index 100% rename from 0015-Migrate-PPC-from-Yaboot-to-Grub2.patch rename to 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch diff --git a/0016-Add-fw_path-variable-revised.patch b/0019-Add-fw_path-variable-revised.patch similarity index 100% rename from 0016-Add-fw_path-variable-revised.patch rename to 0019-Add-fw_path-variable-revised.patch diff --git a/0017-Pass-x-hex-hex-straight-through-unmolested.patch b/0020-Pass-x-hex-hex-straight-through-unmolested.patch similarity index 100% rename from 0017-Pass-x-hex-hex-straight-through-unmolested.patch rename to 0020-Pass-x-hex-hex-straight-through-unmolested.patch diff --git a/0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch similarity index 100% rename from 0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch rename to 0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch diff --git a/0019-Add-devicetree-loading.patch b/0022-Add-devicetree-loading.patch similarity index 96% rename from 0019-Add-devicetree-loading.patch rename to 0022-Add-devicetree-loading.patch index e55047e8..c0728a98 100644 --- a/0019-Add-devicetree-loading.patch +++ b/0022-Add-devicetree-loading.patch @@ -20,10 +20,10 @@ Signed-off-by: David A. Marlin 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f8cbb8d7a2b..91d761bae80 100644 +index d3e879b8e5c..8ea2315ebc2 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -251,7 +251,8 @@ export GRUB_DEFAULT \ +@@ -248,7 +248,8 @@ export GRUB_DEFAULT \ GRUB_ENABLE_CRYPTODISK \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ diff --git a/0020-Don-t-write-messages-to-the-screen.patch b/0023-Don-t-write-messages-to-the-screen.patch similarity index 100% rename from 0020-Don-t-write-messages-to-the-screen.patch rename to 0023-Don-t-write-messages-to-the-screen.patch diff --git a/0021-Don-t-print-GNU-GRUB-header.patch b/0024-Don-t-print-GNU-GRUB-header.patch similarity index 100% rename from 0021-Don-t-print-GNU-GRUB-header.patch rename to 0024-Don-t-print-GNU-GRUB-header.patch diff --git a/0022-Don-t-add-to-highlighted-row.patch b/0025-Don-t-add-to-highlighted-row.patch similarity index 100% rename from 0022-Don-t-add-to-highlighted-row.patch rename to 0025-Don-t-add-to-highlighted-row.patch diff --git a/0023-Message-string-cleanups.patch b/0026-Message-string-cleanups.patch similarity index 100% rename from 0023-Message-string-cleanups.patch rename to 0026-Message-string-cleanups.patch diff --git a/0024-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch b/0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch similarity index 100% rename from 0024-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch rename to 0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch diff --git a/0025-Use-the-correct-indentation-for-the-term-help-text.patch b/0028-Use-the-correct-indentation-for-the-term-help-text.patch similarity index 100% rename from 0025-Use-the-correct-indentation-for-the-term-help-text.patch rename to 0028-Use-the-correct-indentation-for-the-term-help-text.patch diff --git a/0026-Indent-menu-entries.patch b/0029-Indent-menu-entries.patch similarity index 100% rename from 0026-Indent-menu-entries.patch rename to 0029-Indent-menu-entries.patch diff --git a/0027-Fix-margins.patch b/0030-Fix-margins.patch similarity index 100% rename from 0027-Fix-margins.patch rename to 0030-Fix-margins.patch diff --git a/0028-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch b/0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch similarity index 100% rename from 0028-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch rename to 0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch diff --git a/0029-Enable-pager-by-default.-985860.patch b/0032-Enable-pager-by-default.-985860.patch similarity index 100% rename from 0029-Enable-pager-by-default.-985860.patch rename to 0032-Enable-pager-by-default.-985860.patch diff --git a/0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch b/0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch similarity index 100% rename from 0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch rename to 0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch diff --git a/0031-Don-t-say-GNU-Linux-in-generated-menus.patch b/0034-Don-t-say-GNU-Linux-in-generated-menus.patch similarity index 100% rename from 0031-Don-t-say-GNU-Linux-in-generated-menus.patch rename to 0034-Don-t-say-GNU-Linux-in-generated-menus.patch diff --git a/0032-Don-t-draw-a-border-around-the-menu.patch b/0035-Don-t-draw-a-border-around-the-menu.patch similarity index 100% rename from 0032-Don-t-draw-a-border-around-the-menu.patch rename to 0035-Don-t-draw-a-border-around-the-menu.patch diff --git a/0033-Use-the-standard-margin-for-the-timeout-string.patch b/0036-Use-the-standard-margin-for-the-timeout-string.patch similarity index 100% rename from 0033-Use-the-standard-margin-for-the-timeout-string.patch rename to 0036-Use-the-standard-margin-for-the-timeout-string.patch diff --git a/0034-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0037-Add-.eh_frame-to-list-of-relocations-stripped.patch similarity index 100% rename from 0034-Add-.eh_frame-to-list-of-relocations-stripped.patch rename to 0037-Add-.eh_frame-to-list-of-relocations-stripped.patch diff --git a/0035-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0038-Don-t-require-a-password-to-boot-entries-generated-b.patch similarity index 100% rename from 0035-Don-t-require-a-password-to-boot-entries-generated-b.patch rename to 0038-Don-t-require-a-password-to-boot-entries-generated-b.patch diff --git a/0036-Don-t-emit-Booting-.-message.patch b/0039-Don-t-emit-Booting-.-message.patch similarity index 100% rename from 0036-Don-t-emit-Booting-.-message.patch rename to 0039-Don-t-emit-Booting-.-message.patch diff --git a/0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch similarity index 99% rename from 0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch rename to 0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch index 79399654..daa6fae0 100644 --- a/0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +++ b/0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch @@ -122,7 +122,7 @@ Replace a bunch of machine generated ones with ones that look nicer. create mode 100644 util/grub-sparc64-setup.8 diff --git a/configure.ac b/configure.ac -index c0103b30d4e..b8c4d52dfd1 100644 +index 8331f95b645..bec8535af70 100644 --- a/configure.ac +++ b/configure.ac @@ -77,6 +77,29 @@ grub_TRANSFORM([grub-set-default]) diff --git a/0038-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch similarity index 100% rename from 0038-use-fw_path-prefix-when-fallback-searching-for-grub-.patch rename to 0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch diff --git a/0039-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch similarity index 100% rename from 0039-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch rename to 0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch diff --git a/0040-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch similarity index 100% rename from 0040-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch rename to 0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch diff --git a/0041-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0044-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch similarity index 100% rename from 0041-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch rename to 0044-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch diff --git a/0042-Try-prefix-if-fw_path-doesn-t-work.patch b/0045-Try-prefix-if-fw_path-doesn-t-work.patch similarity index 100% rename from 0042-Try-prefix-if-fw_path-doesn-t-work.patch rename to 0045-Try-prefix-if-fw_path-doesn-t-work.patch diff --git a/0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch similarity index 99% rename from 0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch rename to 0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch index fce54783..78a6fa1b 100644 --- a/0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +++ b/0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch @@ -26,7 +26,7 @@ Signed-off-by: Thierry Vignaud create mode 100644 util/grub-rpm-sort.8 diff --git a/configure.ac b/configure.ac -index b8c4d52dfd1..ac84a8ccf69 100644 +index bec8535af70..fdcb452581c 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) diff --git a/0044-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 100% rename from 0044-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch diff --git a/0045-Add-friendly-grub2-password-config-tool-985962.patch b/0048-Add-friendly-grub2-password-config-tool-985962.patch similarity index 98% rename from 0045-Add-friendly-grub2-password-config-tool-985962.patch rename to 0048-Add-friendly-grub2-password-config-tool-985962.patch index 5767794a..9807d0ea 100644 --- a/0045-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0048-Add-friendly-grub2-password-config-tool-985962.patch @@ -27,7 +27,7 @@ Andy Lutomirski create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index ac84a8ccf69..9ecd3540bd6 100644 +index fdcb452581c..30fd84d8067 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -70,10 +70,10 @@ index ba4cf4b29b0..1a7dd433e33 100644 name = grub-mkconfig_lib; common = util/grub-mkconfig_lib.in; diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 91d761bae80..3e4c6c5240b 100644 +index 8ea2315ebc2..ba14cf6261c 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -279,6 +279,8 @@ for i in "${grub_mkconfig_dir}"/* ; do +@@ -276,6 +276,8 @@ for i in "${grub_mkconfig_dir}"/* ; do *~) ;; # emacsen autosave files. FIXME: support other editors */\#*\#) ;; diff --git a/0046-tcp-add-window-scaling-support.patch b/0049-tcp-add-window-scaling-support.patch similarity index 100% rename from 0046-tcp-add-window-scaling-support.patch rename to 0049-tcp-add-window-scaling-support.patch diff --git a/0047-efinet-and-bootp-add-support-for-dhcpv6.patch b/0050-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 99% rename from 0047-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0050-efinet-and-bootp-add-support-for-dhcpv6.patch index 96182c2e..a9844b89 100644 --- a/0047-efinet-and-bootp-add-support-for-dhcpv6.patch +++ b/0050-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 6 files changed, 477 insertions(+), 14 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index e33be51f83b..8d9edaac447 100644 +index 6fb5627025d..e28fb6a09f9 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -902,6 +902,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 98% rename from 0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index 3ffc50ce..e799ac1a 100644 --- a/0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -23,7 +23,7 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 9ecd3540bd6..281201f671e 100644 +index 30fd84d8067..ed31ea457d2 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) @@ -214,7 +214,7 @@ index 00000000000..7e87dfccc0e + echo export GRUB_UPDATE_DEFAULT_KERNEL +fi diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 3e4c6c5240b..60beaaa6962 100644 +index ba14cf6261c..005f093809b 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@" @@ -225,7 +225,7 @@ index 3e4c6c5240b..60beaaa6962 100644 export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAINDIR="@localedir@" -@@ -161,6 +162,8 @@ if test -f ${sysconfdir}/default/grub ; then +@@ -158,6 +159,8 @@ if test -f ${sysconfdir}/default/grub ; then . ${sysconfdir}/default/grub fi diff --git a/0049-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0052-bz1374141-fix-incorrect-mask-for-ppc64.patch similarity index 100% rename from 0049-bz1374141-fix-incorrect-mask-for-ppc64.patch rename to 0052-bz1374141-fix-incorrect-mask-for-ppc64.patch diff --git a/0050-Make-grub_fatal-also-backtrace.patch b/0053-Make-grub_fatal-also-backtrace.patch similarity index 100% rename from 0050-Make-grub_fatal-also-backtrace.patch rename to 0053-Make-grub_fatal-also-backtrace.patch diff --git a/0051-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0054-Fix-up-some-man-pages-rpmdiff-noticed.patch similarity index 99% rename from 0051-Fix-up-some-man-pages-rpmdiff-noticed.patch rename to 0054-Fix-up-some-man-pages-rpmdiff-noticed.patch index f51b62fe..8016a621 100644 --- a/0051-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0054-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -13,7 +13,7 @@ Subject: [PATCH] Fix up some man pages rpmdiff noticed. create mode 100644 util/grub-syslinux2cfg.1 diff --git a/configure.ac b/configure.ac -index 281201f671e..6c16968ad9c 100644 +index ed31ea457d2..537ed411469 100644 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) diff --git a/0052-Make-our-info-pages-say-grub2-where-appropriate.patch b/0055-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 92% rename from 0052-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0055-Make-our-info-pages-say-grub2-where-appropriate.patch index e0930674..be28efd5 100644 --- a/0052-Make-our-info-pages-say-grub2-where-appropriate.patch +++ b/0055-Make-our-info-pages-say-grub2-where-appropriate.patch @@ -9,11 +9,11 @@ time. Signed-off-by: Peter Jones --- docs/grub-dev.texi | 4 +- - docs/grub.texi | 323 ++++++++++++++++++++++++++++------------------------- - 2 files changed, 172 insertions(+), 155 deletions(-) + docs/grub.texi | 321 ++++++++++++++++++++++++++++------------------------- + 2 files changed, 171 insertions(+), 154 deletions(-) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index a834b3a9c32..a55af53fd45 100644 +index 6c629a23e2d..19f708ee662 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1,7 +1,7 @@ @@ -35,7 +35,7 @@ index a834b3a9c32..a55af53fd45 100644 @setchapternewpage odd diff --git a/docs/grub.texi b/docs/grub.texi -index eeb3118ebde..aa3a7de9d4f 100644 +index 69f08d289f9..0615d0ed97e 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1,7 +1,7 @@ @@ -366,22 +366,16 @@ index eeb3118ebde..aa3a7de9d4f 100644 @item GRUB_GFXMODE Set the resolution used on the @samp{gfxterm} graphical terminal. Note that -@@ -1519,20 +1526,20 @@ boot sequence. If you have problems, set this option to @samp{text} and +@@ -1519,7 +1526,7 @@ boot sequence. If you have problems, set this option to @samp{text} and GRUB will tell Linux to boot in normal text mode. @item GRUB_DISABLE_OS_PROBER --The @command{grub-mkconfig} has a feature to use the external -+The @command{grub2-mkconfig} has a feature to use the external - @command{os-prober} program to discover other operating systems installed on - the same machine and generate appropriate menu entries for them. It is disabled - by default since automatic and silent execution of @command{os-prober}, and - creating boot entries based on that data, is a potential attack vector. Set - this option to @samp{false} to enable this feature in the --@command{grub-mkconfig} command. -+@command{grub2-mkconfig} command. - - @item GRUB_OS_PROBER_SKIP_LIST - List of space-separated FS UUIDs of filesystems to be ignored from os-prober +-Normally, @command{grub-mkconfig} will try to use the external ++Normally, @command{grub2-mkconfig} will try to use the external + @command{os-prober} program, if installed, to discover other operating + systems installed on the same system and generate appropriate menu entries + for them. Set this option to @samp{true} to disable this. +@@ -1529,7 +1536,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober output. For efi chainloaders it's @@ @item GRUB_DISABLE_SUBMENU @@ -390,7 +384,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 the kernel with highest version number and put all other found kernels or alternative menu entries for recovery mode in submenu. For entries returned by @command{os-prober} first entry will be put on top level and all others -@@ -1540,11 +1547,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries +@@ -1537,11 +1544,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries on top level will be generated instead. Changing this option will require changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback}) and @samp{default} (@pxref{default}) environment variables as well as saved @@ -405,7 +399,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 check for encrypted disks and generate additional commands needed to access them during boot. Note that in this case unattended boot is not possible because GRUB will wait for passphrase to unlock encrypted container. -@@ -1603,7 +1610,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or +@@ -1600,7 +1607,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or @end table @@ -414,7 +408,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 edit the scripts in @file{/etc/grub.d} directly. @file{/etc/grub.d/40_custom} is particularly useful for adding entire custom menu entries; simply type the menu entries you want to add at the end of -@@ -1864,7 +1871,7 @@ images as well. +@@ -1862,7 +1869,7 @@ images as well. Mount this partition on/mnt/boot and disable GRUB in all OSes and manually install self-compiled latest GRUB with: @@ -423,7 +417,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 In all the OSes install GRUB tools but disable installing GRUB in bootsector, so you'll have menu.lst and grub.cfg available for use. Also disable os-prober -@@ -1874,20 +1881,20 @@ use by setting: +@@ -1872,20 +1879,20 @@ use by setting: in /etc/default/grub @@ -447,7 +441,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @} menuentry "Windows XP" @{ -@@ -1950,15 +1957,15 @@ GRUB supports embedding a configuration file directly into the core image, +@@ -1948,15 +1955,15 @@ GRUB supports embedding a configuration file directly into the core image, so that it is loaded before entering normal mode. This is useful, for example, when it is not straightforward to find the real configuration file, or when you need to debug problems with loading that file. @@ -466,7 +460,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 After the embedded configuration file (if any) is executed, GRUB will load the @samp{normal} module (@pxref{normal}), which will then read the real -@@ -1993,13 +2000,13 @@ included in the core image: +@@ -1991,13 +1998,13 @@ included in the core image: @example @group search.fs_label grub root @@ -484,7 +478,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 else echo "Could not find an example configuration file!" fi -@@ -2523,7 +2530,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 +@@ -2521,7 +2528,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 @end group @end example @@ -493,7 +487,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 server. The grub.cfg file is placed in the same directory as the path output by -@@ -2717,7 +2724,7 @@ team are: +@@ -2715,7 +2722,7 @@ team are: @end table To take full advantage of this function, install GRUB into the MBR @@ -502,7 +496,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 If you have a laptop which has a similar feature and not in the above list could you figure your address and contribute? -@@ -2778,7 +2785,7 @@ bytes. +@@ -2776,7 +2783,7 @@ bytes. The sole function of @file{boot.img} is to read the first sector of the core image from a local disk and jump to it. Because of the size restriction, @file{boot.img} cannot understand any file system structure, so @@ -511,7 +505,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 core image into @file{boot.img} when installing GRUB. @item diskboot.img -@@ -2808,7 +2815,7 @@ images. +@@ -2806,7 +2813,7 @@ images. @item core.img This is the core image of GRUB. It is built dynamically from the kernel @@ -520,7 +514,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 program. Usually, it contains enough modules to access @file{/boot/grub}, and loads everything else (including menu handling, the ability to load target operating systems, and so on) from the file system at run-time. The -@@ -2860,7 +2867,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from +@@ -2858,7 +2865,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from In GRUB 2, images for booting from CD-ROM drives are now constructed using @file{cdboot.img} and @file{core.img}, making sure that the core image contains the @samp{iso9660} module. It is usually best to use the @@ -529,7 +523,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @item nbgrub There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by -@@ -3016,8 +3023,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by +@@ -3014,8 +3021,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by An absolute file name resembles a Unix absolute file name, using @samp{/} for the directory separator (not @samp{\} as in DOS). One @@ -540,7 +534,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 disk. If you omit the device name in an absolute file name, GRUB uses GRUB's @dfn{root device} implicitly. So if you set the root device to, say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}), -@@ -3025,8 +3032,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}. +@@ -3023,8 +3030,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}. On ZFS filesystem the first path component must be @var{volume}@samp{@@}[@var{snapshot}]. @@ -551,7 +545,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if snapshot name is omitted. -@@ -3429,7 +3436,7 @@ The more recent release of Minix would then be identified as +@@ -3427,7 +3434,7 @@ The more recent release of Minix would then be identified as @samp{other>minix>minix-3.4.0}. This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple @@ -560,7 +554,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @node fallback -@@ -3519,7 +3526,7 @@ If this variable is set, it names the language code that the +@@ -3517,7 +3524,7 @@ If this variable is set, it names the language code that the example, French would be named as @samp{fr}, and Simplified Chinese as @samp{zh_CN}. @@ -569,7 +563,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 reasonable default for this variable based on the system locale. -@@ -3527,10 +3534,10 @@ reasonable default for this variable based on the system locale. +@@ -3525,10 +3532,10 @@ reasonable default for this variable based on the system locale. @subsection locale_dir If this variable is set, it names the directory where translation files may @@ -582,7 +576,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 default for this variable if internationalization is needed and any translation files are available. -@@ -3648,7 +3655,7 @@ input. The default is not to pause output. +@@ -3646,7 +3653,7 @@ input. The default is not to pause output. The location of the @samp{/boot/grub} directory as an absolute file name (@pxref{File name syntax}). This is normally set by GRUB at startup based @@ -591,7 +585,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 dynamically loaded from this directory, so it must be set correctly in order for many parts of GRUB to work. -@@ -3739,17 +3746,17 @@ GRUB provides an ``environment block'' which can be used to save a small +@@ -3737,17 +3744,17 @@ GRUB provides an ``environment block'' which can be used to save a small amount of state. The environment block is a preallocated 1024-byte file, which normally lives @@ -612,7 +606,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}). -@@ -4473,7 +4480,7 @@ Translate @var{string} into the current language. +@@ -4476,7 +4483,7 @@ Translate @var{string} into the current language. The current language code is stored in the @samp{lang} variable in GRUB's environment (@pxref{lang}). Translation files in MO format are read from @@ -621,7 +615,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @end deffn -@@ -4868,7 +4875,7 @@ Define a user named @var{user} with password @var{clear-password}. +@@ -4871,7 +4878,7 @@ Define a user named @var{user} with password @var{clear-password}. @deffn Command password_pbkdf2 user hashed-password Define a user named @var{user} with password hash @var{hashed-password}. @@ -630,7 +624,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 to generate password hashes. @xref{Security}. @end deffn -@@ -5811,8 +5818,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} +@@ -5814,8 +5821,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} which has an associated password. @samp{password} sets the password in plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2} sets the password hashed using the Password-Based Key Derivation Function @@ -641,7 +635,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 In order to enable authentication support, the @samp{superusers} environment variable must be set to a list of usernames, separated by any of spaces, -@@ -5857,7 +5864,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ +@@ -5860,7 +5867,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ @end group @end example @@ -650,7 +644,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 generating configuration files with authentication. You can use @file{/etc/grub.d/40_custom} to add simple superuser authentication, by adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} -@@ -5884,7 +5891,17 @@ may halt or otherwise impact the boot process. +@@ -5887,7 +5894,17 @@ may halt or otherwise impact the boot process. An initial trusted public key can be embedded within the GRUB @file{core.img} using the @code{--pubkey} option to @command{grub-install} @@ -669,7 +663,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 GRUB uses GPG-style detached signatures (meaning that a file @file{foo.sig} will be produced when file @file{foo} is signed), and -@@ -5904,8 +5921,8 @@ gpg --detach-sign /path/to/file +@@ -5907,8 +5924,8 @@ gpg --detach-sign /path/to/file For successful validation of all of GRUB's subcomponents and the loaded OS kernel, they must all be signed. One way to accomplish this is the following (after having already produced the desired @@ -680,7 +674,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @example @group -@@ -5927,7 +5944,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, +@@ -5930,7 +5947,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, Note that internally signature enforcement is controlled by setting the environment variable @code{check_signatures} equal to @code{enforce}. Passing one or more @code{--pubkey} options to @@ -689,7 +683,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 equal to @code{enforce} in @file{core.img} prior to processing any configuration files. -@@ -6385,10 +6402,10 @@ Required files are: +@@ -6388,10 +6405,10 @@ Required files are: GRUB's normal start-up procedure involves setting the @samp{prefix} environment variable to a value set in the core image by @@ -702,7 +696,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 things GRUB is supposed to do. If, instead, you only get a rescue shell, this usually means that GRUB -@@ -6414,8 +6431,8 @@ normal +@@ -6417,8 +6434,8 @@ normal However, any problem that leaves you in the rescue shell probably means that GRUB was not correctly installed. It may be more useful to try to reinstall @@ -713,7 +707,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @itemize @bullet{} @item -@@ -6427,7 +6444,7 @@ is usually better to use UUIDs or file system labels and avoid depending on +@@ -6430,7 +6447,7 @@ is usually better to use UUIDs or file system labels and avoid depending on drive ordering entirely. @item @@ -722,7 +716,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 to a partition but GRUB has already been installed in the master boot record, then the GRUB installation in the partition will be ignored. -@@ -6458,21 +6475,21 @@ entry which claims partition start at block 0. This change will not hamper +@@ -6461,21 +6478,21 @@ entry which claims partition start at block 0. This change will not hamper bootability on other machines. @@ -750,7 +744,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @table @option @item --help -@@ -6488,13 +6505,13 @@ separate partition or a removable disk. +@@ -6491,13 +6508,13 @@ separate partition or a removable disk. If this option is not specified then it defaults to @file{/boot}, so @example @@ -766,7 +760,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @end example Here is an example in which you have a separate @dfn{boot} partition which is -@@ -6502,16 +6519,16 @@ mounted on +@@ -6505,16 +6522,16 @@ mounted on @file{/mnt/boot}: @example @@ -786,7 +780,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 extra space in the bootloader embedding area for Reed-Solomon error-correcting codes. This enables GRUB to still boot successfully if some blocks are corrupted. The exact amount of protection offered -@@ -6524,17 +6541,17 @@ installation}) where GRUB does not reside in any unpartitioned space +@@ -6527,17 +6544,17 @@ installation}) where GRUB does not reside in any unpartitioned space outside of the MBR. Disable the Reed-Solomon codes with this option. @end table @@ -809,7 +803,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @table @option @item --help -@@ -6550,17 +6567,17 @@ it to standard output. +@@ -6553,17 +6570,17 @@ it to standard output. @end table @@ -831,7 +825,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @table @option @item -c @var{number} -@@ -6578,23 +6595,23 @@ Length of the salt. Defaults to 64. +@@ -6581,23 +6598,23 @@ Length of the salt. Defaults to 64. @end table @@ -861,7 +855,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @table @option @item --help -@@ -6605,17 +6622,17 @@ Print the version number of GRUB and exit. +@@ -6608,17 +6625,17 @@ Print the version number of GRUB and exit. @end table @@ -883,7 +877,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 passed on directly to @command{xorriso} in @command{mkisofs} emulation mode. Options passed to @command{xorriso} will normally be interpreted as @command{mkisofs} options; if the option @samp{--} is used, then anything -@@ -6630,7 +6647,7 @@ mkdir -p disk/boot/grub +@@ -6633,7 +6650,7 @@ mkdir -p disk/boot/grub grub-mkrescue -o grub.iso disk @end example @@ -892,7 +886,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @table @option @item --help -@@ -6658,15 +6675,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in +@@ -6661,15 +6678,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in default. @item --grub-mkimage=@var{file} @@ -912,7 +906,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 system or file system image that GRUB understands, using GRUB's file system drivers via FUSE. (It is only available if FUSE development files were present when GRUB was built.) This has a number of uses: -@@ -6698,13 +6715,13 @@ even if nobody has yet written a FUSE module specifically for that file +@@ -6701,13 +6718,13 @@ even if nobody has yet written a FUSE module specifically for that file system type. @end itemize @@ -928,7 +922,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 non-option arguments (if it is given more than one image, it will treat them as a RAID set), and also accepts the following options: -@@ -6726,13 +6743,13 @@ Show debugging output for conditions matching @var{string}. +@@ -6729,13 +6746,13 @@ Show debugging output for conditions matching @var{string}. @item -K prompt|@var{file} @itemx --zfs-key=prompt|@var{file} Load a ZFS encryption key. If you use @samp{prompt} as the argument, @@ -944,7 +938,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 root of the supplied file system. If @var{device} is just a number, then it will be treated as a partition -@@ -6750,10 +6767,10 @@ Print verbose messages. +@@ -6753,10 +6770,10 @@ Print verbose messages. @end table @@ -958,7 +952,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 or device. @example -@@ -6761,7 +6778,7 @@ grub-probe --target=fs /boot/grub +@@ -6764,7 +6781,7 @@ grub-probe --target=fs /boot/grub grub-probe --target=drive --device /dev/sda1 @end example @@ -967,7 +961,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 argument, and also accepts the following options: @table @option -@@ -6774,16 +6791,16 @@ Print the version number of GRUB and exit. +@@ -6777,16 +6794,16 @@ Print the version number of GRUB and exit. @item -d @itemx --device If this option is given, then the non-option argument is a system device @@ -987,7 +981,7 @@ index eeb3118ebde..aa3a7de9d4f 100644 @item -t @var{target} @itemx --target=@var{target} -@@ -6836,19 +6853,19 @@ Print verbose messages. +@@ -6839,19 +6856,19 @@ Print verbose messages. @end table diff --git a/0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 97% rename from 0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch index 2f3fd13e..574d1173 100644 --- a/0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch +++ b/0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch @@ -20,10 +20,10 @@ Signed-off-by: Peter Jones 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 94622481284..9d6ea55bdd3 100644 +index 1b91c102f35..4b27bd20153 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in -@@ -45,68 +45,25 @@ if [ -z "${OSPROBED}" ] ; then +@@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then fi osx_entry() { @@ -104,7 +104,7 @@ index 94622481284..9d6ea55bdd3 100644 } EOF } -@@ -295,11 +252,12 @@ EOF +@@ -292,11 +249,12 @@ EOF echo "$title_correction_code" ;; macosx) diff --git a/0054-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0057-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 100% rename from 0054-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0057-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch diff --git a/0055-export-btrfs_subvol-and-btrfs_subvolid.patch b/0058-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 100% rename from 0055-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0058-export-btrfs_subvol-and-btrfs_subvolid.patch diff --git a/0056-grub2-btrfs-03-follow_default.patch b/0059-grub2-btrfs-03-follow_default.patch similarity index 100% rename from 0056-grub2-btrfs-03-follow_default.patch rename to 0059-grub2-btrfs-03-follow_default.patch diff --git a/0057-grub2-btrfs-04-grub2-install.patch b/0060-grub2-btrfs-04-grub2-install.patch similarity index 99% rename from 0057-grub2-btrfs-04-grub2-install.patch rename to 0060-grub2-btrfs-04-grub2-install.patch index 1a617c27..f91c31a8 100644 --- a/0057-grub2-btrfs-04-grub2-install.patch +++ b/0060-grub2-btrfs-04-grub2-install.patch @@ -94,7 +94,7 @@ index ebcdd8f5e22..f044a880a76 100644 sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) { diff --git a/util/grub-install.c b/util/grub-install.c -index a0babe3eff9..427ae013701 100644 +index 0fbe7f78c6d..0f66f36d23a 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -827,6 +827,8 @@ fill_core_services (const char *core_services) diff --git a/0058-grub2-btrfs-05-grub2-mkconfig.patch b/0061-grub2-btrfs-05-grub2-mkconfig.patch similarity index 98% rename from 0058-grub2-btrfs-05-grub2-mkconfig.patch rename to 0061-grub2-btrfs-05-grub2-mkconfig.patch index 4cdf47b9..8270505d 100644 --- a/0058-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0061-grub2-btrfs-05-grub2-mkconfig.patch @@ -13,10 +13,10 @@ Signed-off-by: Michael Chang 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 60beaaa6962..e671ce68aec 100644 +index 005f093809b..535c0f02499 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -255,7 +255,8 @@ export GRUB_DEFAULT \ +@@ -252,7 +252,8 @@ export GRUB_DEFAULT \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ GRUB_DISABLE_SUBMENU \ diff --git a/0059-grub2-btrfs-06-subvol-mount.patch b/0062-grub2-btrfs-06-subvol-mount.patch similarity index 99% rename from 0059-grub2-btrfs-06-subvol-mount.patch rename to 0062-grub2-btrfs-06-subvol-mount.patch index 5a92622d..9a511759 100644 --- a/0059-grub2-btrfs-06-subvol-mount.patch +++ b/0062-grub2-btrfs-06-subvol-mount.patch @@ -460,7 +460,7 @@ index caf9b1ccd3f..28790307e00 100644 grub_make_system_path_relative_to_its_root_os (const char *path) { diff --git a/util/grub-install.c b/util/grub-install.c -index 427ae013701..c03214bdfcf 100644 +index 0f66f36d23a..84ed6e88ecb 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1569,6 +1569,55 @@ main (int argc, char *argv[]) diff --git a/0060-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0063-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 100% rename from 0060-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0063-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch diff --git a/0061-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 100% rename from 0061-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch diff --git a/0062-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 100% rename from 0062-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch diff --git a/0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0066-Use-grub_efi_.-memory-helpers-where-reasonable.patch similarity index 100% rename from 0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename to 0066-Use-grub_efi_.-memory-helpers-where-reasonable.patch diff --git a/0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch similarity index 100% rename from 0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename to 0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch diff --git a/0065-don-t-use-int-for-efi-status.patch b/0068-don-t-use-int-for-efi-status.patch similarity index 100% rename from 0065-don-t-use-int-for-efi-status.patch rename to 0068-don-t-use-int-for-efi-status.patch diff --git a/0066-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0069-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 100% rename from 0066-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0069-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch diff --git a/0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 96% rename from 0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch index 89a65dbe..890aa34c 100644 --- a/0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +++ b/0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch @@ -16,7 +16,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index c03214bdfcf..1e47491bc21 100644 +index 84ed6e88ecb..a2bec7446cb 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1190,18 +1190,8 @@ main (int argc, char *argv[]) diff --git a/0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0071-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 100% rename from 0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0071-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch diff --git a/0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0072-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch similarity index 100% rename from 0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename to 0072-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch diff --git a/0070-align-struct-efi_variable-better.patch b/0073-align-struct-efi_variable-better.patch similarity index 96% rename from 0070-align-struct-efi_variable-better.patch rename to 0073-align-struct-efi_variable-better.patch index 6d28e6d2..ec26def5 100644 --- a/0070-align-struct-efi_variable-better.patch +++ b/0073-align-struct-efi_variable-better.patch @@ -20,7 +20,7 @@ index 36d2dedf47e..9d93ba88bac 100644 +} GRUB_PACKED GRUB_ALIGNED(8); #endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */ diff --git a/include/grub/types.h b/include/grub/types.h -index b36b26a79d4..30e57254889 100644 +index 0a3ff159136..ba446d99040 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -29,6 +29,7 @@ diff --git a/0071-Add-BLS-support-to-grub-mkconfig.patch b/0074-Add-BLS-support-to-grub-mkconfig.patch similarity index 99% rename from 0071-Add-BLS-support-to-grub-mkconfig.patch rename to 0074-Add-BLS-support-to-grub-mkconfig.patch index 7bdb9425..6c65440b 100644 --- a/0071-Add-BLS-support-to-grub-mkconfig.patch +++ b/0074-Add-BLS-support-to-grub-mkconfig.patch @@ -43,7 +43,7 @@ index a2d1f577b9b..434fa4deda4 100644 .SH SEE ALSO .BR "info grub" diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index e671ce68aec..1a70b7ea056 100644 +index 535c0f02499..f55339a3f64 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@" @@ -73,7 +73,7 @@ index e671ce68aec..1a70b7ea056 100644 -*) gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2 usage -@@ -256,7 +262,8 @@ export GRUB_DEFAULT \ +@@ -253,7 +259,8 @@ export GRUB_DEFAULT \ GRUB_OS_PROBER_SKIP_LIST \ GRUB_DISABLE_SUBMENU \ GRUB_DEFAULT_DTB \ diff --git a/0072-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0075-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 100% rename from 0072-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0075-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch diff --git a/0073-Add-linux-and-initrd-commands-for-grub-emu.patch b/0076-Add-linux-and-initrd-commands-for-grub-emu.patch similarity index 100% rename from 0073-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0076-Add-linux-and-initrd-commands-for-grub-emu.patch diff --git a/0074-Add-grub2-switch-to-blscfg.patch b/0077-Add-grub2-switch-to-blscfg.patch similarity index 100% rename from 0074-Add-grub2-switch-to-blscfg.patch rename to 0077-Add-grub2-switch-to-blscfg.patch diff --git a/0075-make-better-backtraces.patch b/0078-make-better-backtraces.patch similarity index 100% rename from 0075-make-better-backtraces.patch rename to 0078-make-better-backtraces.patch diff --git a/0076-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 100% rename from 0076-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch diff --git a/0077-Work-around-some-minor-include-path-weirdnesses.patch b/0080-Work-around-some-minor-include-path-weirdnesses.patch similarity index 100% rename from 0077-Work-around-some-minor-include-path-weirdnesses.patch rename to 0080-Work-around-some-minor-include-path-weirdnesses.patch diff --git a/0078-Make-it-possible-to-enabled-build-id-sha1.patch b/0081-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 98% rename from 0078-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0081-Make-it-possible-to-enabled-build-id-sha1.patch index c1aa5167..356a4d81 100644 --- a/0078-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0081-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index 6c16968ad9c..f4cfd06cbe6 100644 +index 537ed411469..b4455e4732d 100644 --- a/configure.ac +++ b/configure.ac @@ -1470,7 +1470,15 @@ grub_PROG_TARGET_CC diff --git a/0079-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0082-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 100% rename from 0079-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0082-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch diff --git a/0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0083-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 100% rename from 0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0083-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch diff --git a/0081-Fixup-for-newer-compiler.patch b/0084-Fixup-for-newer-compiler.patch similarity index 100% rename from 0081-Fixup-for-newer-compiler.patch rename to 0084-Fixup-for-newer-compiler.patch diff --git a/0082-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0085-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 100% rename from 0082-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0085-Don-t-attempt-to-export-the-start-and-_start-symbols.patch diff --git a/0083-Fixup-for-newer-compiler.patch b/0086-Fixup-for-newer-compiler.patch similarity index 100% rename from 0083-Fixup-for-newer-compiler.patch rename to 0086-Fixup-for-newer-compiler.patch diff --git a/0084-Add-support-for-non-Ethernet-network-cards.patch b/0087-Add-support-for-non-Ethernet-network-cards.patch similarity index 99% rename from 0084-Add-support-for-non-Ethernet-network-cards.patch rename to 0087-Add-support-for-non-Ethernet-network-cards.patch index 62f2a11c..02fb951f 100644 --- a/0084-Add-support-for-non-Ethernet-network-cards.patch +++ b/0087-Add-support-for-non-Ethernet-network-cards.patch @@ -271,7 +271,7 @@ index 54306e3b16d..67b409a8acc 100644 /* Change operation to REPLY and send packet */ send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 8d9edaac447..dd5c8d04da9 100644 +index e28fb6a09f9..08b6b2b5d6c 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -233,7 +233,6 @@ grub_net_configure_by_dhcp_ack (const char *name, diff --git a/0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0088-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 100% rename from 0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0088-net-read-bracketed-ipv6-addrs-and-port-numbers.patch diff --git a/0086-bootp-New-net_bootp6-command.patch b/0089-bootp-New-net_bootp6-command.patch similarity index 99% rename from 0086-bootp-New-net_bootp6-command.patch rename to 0089-bootp-New-net_bootp6-command.patch index b5f78f8d..21b3871b 100644 --- a/0086-bootp-New-net_bootp6-command.patch +++ b/0089-bootp-New-net_bootp6-command.patch @@ -19,7 +19,7 @@ Signed-off-by: Peter Jones 5 files changed, 1002 insertions(+), 209 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index dd5c8d04da9..68c4df681b5 100644 +index 08b6b2b5d6c..fe93b80f1cf 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -24,6 +24,98 @@ diff --git a/0087-efinet-UEFI-IPv6-PXE-support.patch b/0090-efinet-UEFI-IPv6-PXE-support.patch similarity index 100% rename from 0087-efinet-UEFI-IPv6-PXE-support.patch rename to 0090-efinet-UEFI-IPv6-PXE-support.patch diff --git a/0088-grub.texi-Add-net_bootp6-doument.patch b/0091-grub.texi-Add-net_bootp6-doument.patch similarity index 90% rename from 0088-grub.texi-Add-net_bootp6-doument.patch rename to 0091-grub.texi-Add-net_bootp6-doument.patch index d7fd91a0..3f8ec97a 100644 --- a/0088-grub.texi-Add-net_bootp6-doument.patch +++ b/0091-grub.texi-Add-net_bootp6-doument.patch @@ -12,10 +12,10 @@ Signed-off-by: Ken Lin 1 file changed, 17 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index aa3a7de9d4f..67bf8523ccb 100644 +index 0615d0ed97e..04ed6ac1f07 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5484,6 +5484,7 @@ This command is only available on AArch64 systems. +@@ -5487,6 +5487,7 @@ This command is only available on AArch64 systems. * net_add_dns:: Add a DNS server * net_add_route:: Add routing entry * net_bootp:: Perform a bootp/DHCP autoconfiguration @@ -23,7 +23,7 @@ index aa3a7de9d4f..67bf8523ccb 100644 * net_del_addr:: Remove IP address from interface * net_del_dns:: Remove a DNS server * net_del_route:: Remove a route entry -@@ -5608,6 +5609,22 @@ Sets environment variable @samp{net_}@var{}@samp{_boot_file} +@@ -5611,6 +5612,22 @@ Sets environment variable @samp{net_}@var{}@samp{_boot_file} @end deffn diff --git a/0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 99% rename from 0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch index 171bf823..e800dd23 100644 --- a/0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +++ b/0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch @@ -22,7 +22,7 @@ Signed-off-by: Ken Lin 2 files changed, 56 insertions(+) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 68c4df681b5..0b430489329 100644 +index fe93b80f1cf..8fb8918ae7e 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -20,6 +20,7 @@ diff --git a/0090-efinet-Setting-network-from-UEFI-device-path.patch b/0093-efinet-Setting-network-from-UEFI-device-path.patch similarity index 100% rename from 0090-efinet-Setting-network-from-UEFI-device-path.patch rename to 0093-efinet-Setting-network-from-UEFI-device-path.patch diff --git a/0091-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0094-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 100% rename from 0091-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0094-efinet-Setting-DNS-server-from-UEFI-protocol.patch diff --git a/0092-Support-UEFI-networking-protocols.patch b/0095-Support-UEFI-networking-protocols.patch similarity index 99% rename from 0092-Support-UEFI-networking-protocols.patch rename to 0095-Support-UEFI-networking-protocols.patch index e69054fe..fb143862 100644 --- a/0092-Support-UEFI-networking-protocols.patch +++ b/0095-Support-UEFI-networking-protocols.patch @@ -4000,7 +4000,7 @@ index 0ce5e675ed7..55aed92722c 100644 +#endif } diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c -index 602574d52e8..1a61e05c6ec 100644 +index a2461cda1c4..77958dd9dd5 100644 --- a/util/grub-mknetdir.c +++ b/util/grub-mknetdir.c @@ -32,13 +32,15 @@ @@ -4063,7 +4063,7 @@ index 602574d52e8..1a61e05c6ec 100644 grub_install_make_image_wrap (input_dir, prefix, output, 0, load_cfg, targets[platform].mkimage_target, 0); -@@ -192,7 +198,16 @@ main (int argc, char *argv[]) +@@ -195,7 +201,16 @@ main (int argc, char *argv[]) grub_install_mkdir_p (base); diff --git a/0093-AUDIT-0-http-boot-tracker-bug.patch b/0096-AUDIT-0-http-boot-tracker-bug.patch similarity index 100% rename from 0093-AUDIT-0-http-boot-tracker-bug.patch rename to 0096-AUDIT-0-http-boot-tracker-bug.patch diff --git a/0094-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0097-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 100% rename from 0094-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0097-grub-editenv-Add-incr-command-to-increment-integer-v.patch diff --git a/0095-Add-auto-hide-menu-support.patch b/0098-Add-auto-hide-menu-support.patch similarity index 95% rename from 0095-Add-auto-hide-menu-support.patch rename to 0098-Add-auto-hide-menu-support.patch index 64511158..efb76c40 100644 --- a/0095-Add-auto-hide-menu-support.patch +++ b/0098-Add-auto-hide-menu-support.patch @@ -120,10 +120,10 @@ index 00000000000..ad175870a54 +fi +EOF diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 9d6ea55bdd3..21bbace4647 100644 +index 4b27bd20153..3c9431cfcfb 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in -@@ -45,6 +45,7 @@ if [ -z "${OSPROBED}" ] ; then +@@ -42,6 +42,7 @@ if [ -z "${OSPROBED}" ] ; then fi osx_entry() { @@ -131,7 +131,7 @@ index 9d6ea55bdd3..21bbace4647 100644 # TRANSLATORS: it refers on the OS residing on device %s onstr="$(gettext_printf "(on %s)" "${DEVICE}")" hints="" -@@ -105,6 +106,7 @@ for OS in ${OSPROBED} ; do +@@ -102,6 +103,7 @@ for OS in ${OSPROBED} ; do case ${BOOT} in chain) @@ -139,7 +139,7 @@ index 9d6ea55bdd3..21bbace4647 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -@@ -135,6 +137,7 @@ EOF +@@ -132,6 +134,7 @@ EOF EOF ;; efi) @@ -147,7 +147,7 @@ index 9d6ea55bdd3..21bbace4647 100644 EFIPATH=${DEVICE#*@} DEVICE=${DEVICE%@*} -@@ -179,6 +182,7 @@ EOF +@@ -176,6 +179,7 @@ EOF LINITRD="${LINITRD#/boot}" fi @@ -155,7 +155,7 @@ index 9d6ea55bdd3..21bbace4647 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" recovery_params="$(echo "${LPARAMS}" | grep single)" || true counter=1 -@@ -260,6 +264,7 @@ EOF +@@ -257,6 +261,7 @@ EOF done ;; hurd) @@ -163,7 +163,7 @@ index 9d6ea55bdd3..21bbace4647 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' { -@@ -286,6 +291,7 @@ EOF +@@ -283,6 +288,7 @@ EOF EOF ;; minix) @@ -171,7 +171,7 @@ index 9d6ea55bdd3..21bbace4647 100644 cat << EOF menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" { EOF -@@ -302,3 +308,15 @@ EOF +@@ -299,3 +305,15 @@ EOF ;; esac done diff --git a/0096-Add-grub-set-bootflag-utility.patch b/0099-Add-grub-set-bootflag-utility.patch similarity index 100% rename from 0096-Add-grub-set-bootflag-utility.patch rename to 0099-Add-grub-set-bootflag-utility.patch diff --git a/0097-docs-Add-grub-boot-indeterminate.service-example.patch b/0100-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0097-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0100-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0098-gentpl-add-disable-support.patch b/0101-gentpl-add-disable-support.patch similarity index 100% rename from 0098-gentpl-add-disable-support.patch rename to 0101-gentpl-add-disable-support.patch diff --git a/0099-gentpl-add-pc-firmware-type.patch b/0102-gentpl-add-pc-firmware-type.patch similarity index 100% rename from 0099-gentpl-add-pc-firmware-type.patch rename to 0102-gentpl-add-pc-firmware-type.patch diff --git a/0100-efinet-also-use-the-firmware-acceleration-for-http.patch b/0103-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0100-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0103-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0101-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0104-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0101-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0104-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 99% rename from 0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index 6afb91c1..b65eafcc 100644 --- a/0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index f4cfd06cbe6..dbf97e703b4 100644 +index b4455e4732d..3405348178a 100644 --- a/configure.ac +++ b/configure.ac @@ -877,11 +877,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p diff --git a/0103-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0106-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0103-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0106-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0104-Rework-how-the-fdt-command-builds.patch b/0107-Rework-how-the-fdt-command-builds.patch similarity index 100% rename from 0104-Rework-how-the-fdt-command-builds.patch rename to 0107-Rework-how-the-fdt-command-builds.patch diff --git a/0105-Disable-non-wordsize-allocations-on-arm.patch b/0108-Disable-non-wordsize-allocations-on-arm.patch similarity index 97% rename from 0105-Disable-non-wordsize-allocations-on-arm.patch rename to 0108-Disable-non-wordsize-allocations-on-arm.patch index 3708cbee..f614c9ee 100644 --- a/0105-Disable-non-wordsize-allocations-on-arm.patch +++ b/0108-Disable-non-wordsize-allocations-on-arm.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index dbf97e703b4..96b96973f26 100644 +index 3405348178a..152e7dba652 100644 --- a/configure.ac +++ b/configure.ac @@ -1288,6 +1288,26 @@ if test "x$target_cpu" = xarm; then diff --git a/0106-Prepend-prefix-when-HTTP-path-is-relative.patch b/0109-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 100% rename from 0106-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0109-Prepend-prefix-when-HTTP-path-is-relative.patch diff --git a/0107-Make-grub_error-more-verbose.patch b/0110-Make-grub_error-more-verbose.patch similarity index 100% rename from 0107-Make-grub_error-more-verbose.patch rename to 0110-Make-grub_error-more-verbose.patch diff --git a/0108-Make-reset-an-alias-for-the-reboot-command.patch b/0111-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0108-Make-reset-an-alias-for-the-reboot-command.patch rename to 0111-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0109-Add-a-version-command.patch b/0112-Add-a-version-command.patch similarity index 99% rename from 0109-Add-a-version-command.patch rename to 0112-Add-a-version-command.patch index 749d3196..30c8224f 100644 --- a/0109-Add-a-version-command.patch +++ b/0112-Add-a-version-command.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index 96b96973f26..dabcbafc985 100644 +index 152e7dba652..cfdac6bed5a 100644 --- a/configure.ac +++ b/configure.ac @@ -312,6 +312,19 @@ AC_SUBST(target_cpu) diff --git a/0110-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 100% rename from 0110-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch diff --git a/0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 97% rename from 0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch index 5b18d9cd..1fdc5528 100644 --- a/0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch +++ b/0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch @@ -71,7 +71,7 @@ Signed-off-by: Peter Jones 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 74360542062..e6abc923db2 100644 +index f6aef0ef649..85ad4b4494c 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, @@ -82,7 +82,7 @@ index 74360542062..e6abc923db2 100644 /* Limit the memory access to less than 4GB for 32-bit platforms. */ if (address > GRUB_EFI_MAX_USABLE_ADDRESS) -@@ -166,19 +167,22 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, +@@ -170,19 +171,22 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, } b = grub_efi_system_table->boot_services; @@ -109,7 +109,7 @@ index 74360542062..e6abc923db2 100644 grub_efi_free_pages (0, pages); if (status != GRUB_EFI_SUCCESS) { -@@ -187,9 +191,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, +@@ -191,9 +195,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, } } @@ -121,7 +121,7 @@ index 74360542062..e6abc923db2 100644 } void * -@@ -709,8 +713,21 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) +@@ -713,8 +717,21 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) for (desc = memory_map, *base_addr = GRUB_EFI_MAX_USABLE_ADDRESS; (grub_addr_t) desc < ((grub_addr_t) memory_map + memory_map_size); desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) diff --git a/0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 97% rename from 0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch index 0bceecb6..ba918edf 100644 --- a/0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch +++ b/0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch @@ -34,7 +34,7 @@ Signed-off-by: Peter Jones 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index e6abc923db2..83d7644222e 100644 +index 85ad4b4494c..e84961d078c 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 e6abc923db2..83d7644222e 100644 return 0; b = grub_efi_system_table->boot_services; -@@ -476,7 +476,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -480,7 +480,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 e6abc923db2..83d7644222e 100644 #endif && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 && desc->num_pages != 0) -@@ -494,9 +494,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -498,9 +498,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 diff --git a/0113-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0116-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 100% rename from 0113-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0116-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch diff --git a/0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 98% rename from 0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index 668fb4c7..de71484b 100644 --- a/0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index dabcbafc985..f691767a2c0 100644 +index cfdac6bed5a..bd28edf3141 100644 --- a/configure.ac +++ b/configure.ac @@ -1480,11 +1480,11 @@ fi diff --git a/0115-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0118-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0115-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0118-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0116-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0119-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0116-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0119-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0117-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0120-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 100% rename from 0117-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0120-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch diff --git a/0118-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0121-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 100% rename from 0118-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0121-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch diff --git a/0119-Fix-getroot.c-s-trampolines.patch b/0122-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0119-Fix-getroot.c-s-trampolines.patch rename to 0122-Fix-getroot.c-s-trampolines.patch diff --git a/0120-Do-not-allow-stack-trampolines-anywhere.patch b/0123-Do-not-allow-stack-trampolines-anywhere.patch similarity index 97% rename from 0120-Do-not-allow-stack-trampolines-anywhere.patch rename to 0123-Do-not-allow-stack-trampolines-anywhere.patch index 46176d01..4ee639d4 100644 --- a/0120-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0123-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index f691767a2c0..2e4b12adad3 100644 +index bd28edf3141..907477a585c 100644 --- a/configure.ac +++ b/configure.ac @@ -2062,6 +2062,9 @@ if test x"$enable_wextra" != xno ; then diff --git a/0121-Reimplement-boot_counter.patch b/0124-Reimplement-boot_counter.patch similarity index 100% rename from 0121-Reimplement-boot_counter.patch rename to 0124-Reimplement-boot_counter.patch diff --git a/0122-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0125-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 100% rename from 0122-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0125-Fix-menu-entry-selection-based-on-ID-and-title.patch diff --git a/0123-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0126-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 100% rename from 0123-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0126-Make-the-menu-entry-users-option-argument-to-be-opti.patch diff --git a/0124-Add-efi-export-env-and-efi-load-env-commands.patch b/0127-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 100% rename from 0124-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0127-Add-efi-export-env-and-efi-load-env-commands.patch diff --git a/0125-Make-it-possible-to-subtract-conditions-from-debug.patch b/0128-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 100% rename from 0125-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0128-Make-it-possible-to-subtract-conditions-from-debug.patch diff --git a/0126-Export-all-variables-from-the-initial-context-when-c.patch b/0129-Export-all-variables-from-the-initial-context-when-c.patch similarity index 100% rename from 0126-Export-all-variables-from-the-initial-context-when-c.patch rename to 0129-Export-all-variables-from-the-initial-context-when-c.patch diff --git a/0127-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 100% rename from 0127-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch diff --git a/0128-Fix-systemctl-kexec-exit-status-check.patch b/0131-Fix-systemctl-kexec-exit-status-check.patch similarity index 100% rename from 0128-Fix-systemctl-kexec-exit-status-check.patch rename to 0131-Fix-systemctl-kexec-exit-status-check.patch diff --git a/0129-Print-grub-emu-linux-loader-messages-as-debug.patch b/0132-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 100% rename from 0129-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0132-Print-grub-emu-linux-loader-messages-as-debug.patch diff --git a/0130-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0133-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 100% rename from 0130-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0133-Don-t-assume-that-boot-commands-will-only-return-on-.patch diff --git a/0131-Fix-undefined-references-for-fdt-when-building-with-.patch b/0134-Fix-undefined-references-for-fdt-when-building-with-.patch similarity index 100% rename from 0131-Fix-undefined-references-for-fdt-when-building-with-.patch rename to 0134-Fix-undefined-references-for-fdt-when-building-with-.patch diff --git a/0132-Do-better-in-bootstrap.conf.patch b/0135-Do-better-in-bootstrap.conf.patch similarity index 100% rename from 0132-Do-better-in-bootstrap.conf.patch rename to 0135-Do-better-in-bootstrap.conf.patch diff --git a/0133-Use-git-to-apply-gnulib-patches.patch b/0136-Use-git-to-apply-gnulib-patches.patch similarity index 100% rename from 0133-Use-git-to-apply-gnulib-patches.patch rename to 0136-Use-git-to-apply-gnulib-patches.patch diff --git a/0134-Fix-build-error-with-the-fdt-module-on-risc-v.patch b/0137-Fix-build-error-with-the-fdt-module-on-risc-v.patch similarity index 100% rename from 0134-Fix-build-error-with-the-fdt-module-on-risc-v.patch rename to 0137-Fix-build-error-with-the-fdt-module-on-risc-v.patch diff --git a/0135-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0138-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0135-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0138-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0136-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0139-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0136-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0139-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0137-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0140-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 100% rename from 0137-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0140-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0138-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch b/0141-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch similarity index 100% rename from 0138-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch rename to 0141-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch diff --git a/0139-chainloader-Define-machine-types-for-RISC-V.patch b/0142-chainloader-Define-machine-types-for-RISC-V.patch similarity index 100% rename from 0139-chainloader-Define-machine-types-for-RISC-V.patch rename to 0142-chainloader-Define-machine-types-for-RISC-V.patch diff --git a/0140-Add-start-symbol-for-RISC-V.patch b/0143-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0140-Add-start-symbol-for-RISC-V.patch rename to 0143-Add-start-symbol-for-RISC-V.patch diff --git a/0141-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0144-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 100% rename from 0141-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0144-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 100% rename from 0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch diff --git a/0143-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0146-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0143-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0146-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0144-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0147-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0144-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0147-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0145-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0148-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0145-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0148-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0146-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0149-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0146-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0149-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0147-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0150-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 100% rename from 0147-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0150-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch diff --git a/0148-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0151-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 100% rename from 0148-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0151-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0149-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0152-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 100% rename from 0149-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0152-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0150-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0153-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 100% rename from 0150-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0153-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0151-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0154-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 100% rename from 0151-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0154-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch diff --git a/0152-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0155-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 100% rename from 0152-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0155-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch diff --git a/0153-efi-dhcp-fix-some-allocation-error-checking.patch b/0156-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0153-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0156-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0154-efi-http-fix-some-allocation-error-checking.patch b/0157-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0154-efi-http-fix-some-allocation-error-checking.patch rename to 0157-efi-http-fix-some-allocation-error-checking.patch diff --git a/0155-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0158-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0155-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0158-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0156-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0159-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 100% rename from 0156-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0159-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch diff --git a/0157-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0160-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 100% rename from 0157-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0160-linuxefi-fail-kernel-validation-without-shim-protoco.patch diff --git a/0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 97% rename from 0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch index 0bd28c3e..9b0db5f9 100644 --- a/0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +++ b/0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 0b430489329..8f2f55c0079 100644 +index 8fb8918ae7e..7baf3540c81 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -329,7 +329,7 @@ grub_net_configure_by_dhcp_ack (const char *name, diff --git a/0159-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0162-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0159-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0162-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0160-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0163-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0160-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0163-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0161-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0164-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0161-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0164-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0162-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0165-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0162-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0165-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0163-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0166-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 100% rename from 0163-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0166-Add-systemd-integration-scripts-to-make-systemctl-re.patch diff --git a/0164-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0167-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0164-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0167-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0165-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0168-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 100% rename from 0165-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0168-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0166-grub-install-disable-support-for-EFI-platforms.patch b/0169-grub-install-disable-support-for-EFI-platforms.patch similarity index 96% rename from 0166-grub-install-disable-support-for-EFI-platforms.patch rename to 0169-grub-install-disable-support-for-EFI-platforms.patch index e3cf2ecf..41003e25 100644 --- a/0166-grub-install-disable-support-for-EFI-platforms.patch +++ b/0169-grub-install-disable-support-for-EFI-platforms.patch @@ -26,7 +26,7 @@ Signed-off-by: Jan Hlavac 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index 1e47491bc21..ffac91c9a24 100644 +index a2bec7446cb..5babc7af551 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -899,6 +899,22 @@ main (int argc, char *argv[]) @@ -82,10 +82,10 @@ index 1e47491bc21..ffac91c9a24 100644 { grub_fs_t fs; diff --git a/docs/grub.texi b/docs/grub.texi -index 67bf8523ccb..75b22231f35 100644 +index 04ed6ac1f07..4870faaa00a 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -6506,6 +6506,13 @@ grub2-install @var{install_device} +@@ -6509,6 +6509,13 @@ grub2-install @var{install_device} The device name @var{install_device} is an OS device name or a GRUB device name. diff --git a/0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 98% rename from 0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch index ff2841e4..3eb0d00c 100644 --- a/0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,7 +15,7 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index 2e4b12adad3..7b11fae0c3d 100644 +index 907477a585c..d5d2a28b4ef 100644 --- a/configure.ac +++ b/configure.ac @@ -1613,6 +1613,17 @@ else diff --git a/0168-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0171-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 100% rename from 0168-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0171-Added-debug-statements-to-grub_disk_open-and-grub_di.patch diff --git a/0169-Introduce-function-grub_debug_is_enabled-void-return.patch b/0172-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 100% rename from 0169-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0172-Introduce-function-grub_debug_is_enabled-void-return.patch diff --git a/0170-Don-t-clear-screen-when-debugging-is-enabled.patch b/0173-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 100% rename from 0170-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0173-Don-t-clear-screen-when-debugging-is-enabled.patch diff --git a/0171-grub_file_-instrumentation-new-file-debug-tag.patch b/0174-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0171-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0174-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0172-ieee1275-Avoiding-many-unecessary-open-close.patch b/0175-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0172-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0175-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0173-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0176-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0173-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0176-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0174-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0177-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0174-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0177-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0175-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 100% rename from 0175-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 97% rename from 0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch index 75e8ddad..a8632985 100644 --- a/0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch +++ b/0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -52,10 +52,10 @@ Platform Reference (PAPR). 6 files changed, 83 insertions(+), 15 deletions(-) diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index b4f28840f10..a53f0a5c496 100644 +index 4e212e690c5..aab2a941f85 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c -@@ -335,10 +335,12 @@ static size_t npubkeys; +@@ -461,10 +461,12 @@ static size_t npubkeys; static char *sbat; static int disable_shim_lock; static grub_compression_t compression; @@ -68,7 +68,7 @@ index b4f28840f10..a53f0a5c496 100644 switch (key) { case 'C': -@@ -436,6 +438,12 @@ grub_install_parse (int key, char *arg) +@@ -562,6 +564,12 @@ grub_install_parse (int key, char *arg) grub_util_error (_("Unrecognized compression `%s'"), arg); case GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE: return 1; @@ -81,7 +81,7 @@ index b4f28840f10..a53f0a5c496 100644 default: return 0; } -@@ -539,7 +547,13 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -665,7 +673,13 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, dir, prefix, outname, dtb ? : "", sbat ? : "", mkimage_target, compnames[compression], note ? "--note" : "", @@ -96,7 +96,7 @@ index b4f28840f10..a53f0a5c496 100644 free (s); tgt = grub_install_get_image_target (mkimage_target); -@@ -549,7 +563,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -675,7 +689,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, pubkeys, npubkeys, config_path, tgt, @@ -161,7 +161,7 @@ index c0d55993702..26d1ecbf74e 100644 if (grub_util_file_sync (fp) < 0) grub_util_error (_("cannot sync `%s': %s"), arguments.output ? : "stdout", diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index 00f49ccaaaf..ed422bd1781 100644 +index d78fa3e5330..393119486d3 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -84,6 +84,15 @@ struct grub_ieee1275_note @@ -264,7 +264,7 @@ index a26cf76f72f..bab12276010 100644 break; } diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index b93c73caac6..b3307fef9b4 100644 +index 7df3191f47e..cf4531e02b6 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -67,6 +67,9 @@ diff --git a/0177-docs-grub-Document-signing-grub-under-UEFI.patch b/0180-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 92% rename from 0177-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0180-docs-grub-Document-signing-grub-under-UEFI.patch index 2f53d524..9b9b19a7 100644 --- a/0177-docs-grub-Document-signing-grub-under-UEFI.patch +++ b/0180-docs-grub-Document-signing-grub-under-UEFI.patch @@ -13,10 +13,10 @@ Signed-off-by: Daniel Axtens 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 75b22231f35..ca36ad0b6b7 100644 +index 4870faaa00a..365d1d6931b 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5814,6 +5814,7 @@ environment variables and commands are listed in the same order. +@@ -5817,6 +5817,7 @@ environment variables and commands are listed in the same order. * Secure Boot Advanced Targeting:: Embedded information for generation number based revocation * Measured Boot:: Measuring boot components * Lockdown:: Lockdown when booting on a secure setup @@ -24,7 +24,7 @@ index 75b22231f35..ca36ad0b6b7 100644 @end menu @node Authentication and authorisation -@@ -5892,7 +5893,7 @@ commands. +@@ -5895,7 +5896,7 @@ commands. GRUB's @file{core.img} can optionally provide enforcement that all files subsequently read from disk are covered by a valid digital signature. @@ -33,7 +33,7 @@ index 75b22231f35..ca36ad0b6b7 100644 platform's firmware (e.g., Coreboot) validates @file{core.img}. If environment variable @code{check_signatures} -@@ -6064,6 +6065,25 @@ be restricted and some operations/commands cannot be executed. +@@ -6067,6 +6068,25 @@ be restricted and some operations/commands cannot be executed. The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down. Otherwise it does not exit. diff --git a/0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 95% rename from 0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch index 29db2bb8..4d85d938 100644 --- a/0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch +++ b/0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch @@ -13,10 +13,10 @@ Signed-off-by: Daniel Axtens 1 file changed, 42 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index ca36ad0b6b7..691ffaa1861 100644 +index 365d1d6931b..afbde7c1f7b 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -6084,6 +6084,48 @@ image works under UEFI secure boot and can maintain the secure-boot chain. It +@@ -6087,6 +6087,48 @@ image works under UEFI secure boot and can maintain the secure-boot chain. It will also be necessary to enrol the public key used into a relevant firmware key database. diff --git a/0179-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0182-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0179-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0182-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0180-pgp-factor-out-rsa_pad.patch b/0183-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0180-pgp-factor-out-rsa_pad.patch rename to 0183-pgp-factor-out-rsa_pad.patch diff --git a/0181-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0184-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0181-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0184-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0182-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0185-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0182-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0185-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0183-libtasn1-import-libtasn1-4.16.0.patch b/0186-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0183-libtasn1-import-libtasn1-4.16.0.patch rename to 0186-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0184-libtasn1-disable-code-not-needed-in-grub.patch b/0187-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0184-libtasn1-disable-code-not-needed-in-grub.patch rename to 0187-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0185-libtasn1-changes-for-grub-compatibility.patch b/0188-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0185-libtasn1-changes-for-grub-compatibility.patch rename to 0188-libtasn1-changes-for-grub-compatibility.patch diff --git a/0186-libtasn1-compile-into-asn1-module.patch b/0189-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0186-libtasn1-compile-into-asn1-module.patch rename to 0189-libtasn1-compile-into-asn1-module.patch diff --git a/0187-test_asn1-test-module-for-libtasn1.patch b/0190-test_asn1-test-module-for-libtasn1.patch similarity index 100% rename from 0187-test_asn1-test-module-for-libtasn1.patch rename to 0190-test_asn1-test-module-for-libtasn1.patch diff --git a/0188-grub-install-support-embedding-x509-certificates.patch b/0191-grub-install-support-embedding-x509-certificates.patch similarity index 96% rename from 0188-grub-install-support-embedding-x509-certificates.patch rename to 0191-grub-install-support-embedding-x509-certificates.patch index 4d13e3c8..04722ad7 100644 --- a/0188-grub-install-support-embedding-x509-certificates.patch +++ b/0191-grub-install-support-embedding-x509-certificates.patch @@ -33,10 +33,10 @@ index 355a43844ac..b81ac0ae46c 100644 pseudo_file.fs = &pseudo_fs; diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index a53f0a5c496..917904ee73d 100644 +index aab2a941f85..422f82362c7 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c -@@ -334,6 +334,8 @@ static char **pubkeys; +@@ -460,6 +460,8 @@ static char **pubkeys; static size_t npubkeys; static char *sbat; static int disable_shim_lock; @@ -45,7 +45,7 @@ index a53f0a5c496..917904ee73d 100644 static grub_compression_t compression; static size_t appsig_size; -@@ -374,6 +376,11 @@ grub_install_parse (int key, char *arg) +@@ -500,6 +502,11 @@ grub_install_parse (int key, char *arg) return 1; case GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK: disable_shim_lock = 1; @@ -57,7 +57,7 @@ index a53f0a5c496..917904ee73d 100644 return 1; case GRUB_INSTALL_OPTIONS_VERBOSITY: -@@ -501,6 +508,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -627,6 +634,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, for (pk = pubkeys; pk < pubkeys + npubkeys; pk++) slen += 20 + grub_strlen (*pk); @@ -67,7 +67,7 @@ index a53f0a5c496..917904ee73d 100644 for (md = modules.entries; *md; md++) { slen += 10 + grub_strlen (*md); -@@ -529,6 +539,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -655,6 +665,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, *p++ = ' '; } @@ -82,7 +82,7 @@ index a53f0a5c496..917904ee73d 100644 for (md = modules.entries; *md; md++) { *p++ = '\''; -@@ -562,7 +580,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -688,7 +706,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, @@ -226,7 +226,7 @@ index 55849777eaa..98edc0863f6 100644 /* The module header. */ diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index b3307fef9b4..faecf7b26e2 100644 +index cf4531e02b6..51f3b13ac13 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -67,6 +67,8 @@ diff --git a/0189-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0192-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0189-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0192-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0190-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0193-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0190-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0193-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0191-appended-signatures-support-verifying-appended-signa.patch b/0194-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0191-appended-signatures-support-verifying-appended-signa.patch rename to 0194-appended-signatures-support-verifying-appended-signa.patch diff --git a/0192-appended-signatures-verification-tests.patch b/0195-appended-signatures-verification-tests.patch similarity index 86% rename from 0192-appended-signatures-verification-tests.patch rename to 0195-appended-signatures-verification-tests.patch index 8364a906..9f6c3c62 100644 --- a/0192-appended-signatures-verification-tests.patch +++ b/0195-appended-signatures-verification-tests.patch @@ -9,10 +9,10 @@ of commands and behaviours. Signed-off-by: Daniel Axtens --- grub-core/Makefile.core.def | 6 + - grub-core/tests/appended_signature_test.c | 250 ++++++++++++++++ + grub-core/tests/appended_signature_test.c | 281 +++++++++++++++ grub-core/tests/lib/functional_test.c | 1 + - grub-core/tests/appended_signatures.h | 483 ++++++++++++++++++++++++++++++ - 4 files changed, 740 insertions(+) + grub-core/tests/appended_signatures.h | 557 ++++++++++++++++++++++++++++++ + 4 files changed, 845 insertions(+) create mode 100644 grub-core/tests/appended_signature_test.c create mode 100644 grub-core/tests/appended_signatures.h @@ -35,10 +35,10 @@ index 77321d218c8..6bddc841b85 100644 common = tests/signature_test.c; diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c new file mode 100644 -index 00000000000..bb29a85c9bb +index 00000000000..88a485200d8 --- /dev/null +++ b/grub-core/tests/appended_signature_test.c -@@ -0,0 +1,250 @@ +@@ -0,0 +1,281 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2020 IBM Corporation. @@ -136,6 +136,23 @@ index 00000000000..bb29a85c9bb + .get_contents = get_certificate2_der +}; + ++static char * ++get_certificate_printable_der (grub_size_t * sz) ++{ ++ char *ret; ++ *sz = certificate_printable_der_len; ++ ret = grub_malloc (*sz); ++ if (ret) ++ grub_memcpy (ret, certificate_printable_der, *sz); ++ return ret; ++} ++ ++static struct grub_procfs_entry certificate_printable_der_entry = { ++ .name = "certificate_printable.der", ++ .get_contents = get_certificate_printable_der ++}; ++ ++ +static void +do_verify (const char *f, int is_valid) +{ @@ -171,12 +188,16 @@ index 00000000000..bb29a85c9bb + grub_command_t cmd_trust, cmd_distrust; + char *trust_args[] = { (char *) "(proc)/certificate.der", NULL }; + char *trust_args2[] = { (char *) "(proc)/certificate2.der", NULL }; ++ char *trust_args_printable[] = { (char *) "(proc)/certificate_printable.der", ++ NULL }; + char *distrust_args[] = { (char *) "1", NULL }; + char *distrust2_args[] = { (char *) "2", NULL }; + grub_err_t err; + + grub_procfs_register ("certificate.der", &certificate_der_entry); + grub_procfs_register ("certificate2.der", &certificate2_der_entry); ++ grub_procfs_register ("certificate_printable.der", ++ &certificate_printable_der_entry); + + cmd_trust = grub_command_find ("trust_certificate"); + if (!cmd_trust) @@ -284,8 +305,18 @@ index 00000000000..bb29a85c9bb + grub_errno, grub_errmsg); + DO_TEST (hi_signed_2nd, 0); + ++ /* ++ * Lastly, check a certificate that uses printableString rather than ++ * utf8String loads properly. ++ */ ++ err = (cmd_trust->func) (cmd_trust, 1, trust_args_printable); ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "distrusting printable certificate failed: %d: %s", ++ grub_errno, grub_errmsg); ++ + grub_procfs_unregister (&certificate_der_entry); + grub_procfs_unregister (&certificate2_der_entry); ++ grub_procfs_unregister (&certificate_printable_der_entry); +} + +GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); @@ -303,10 +334,10 @@ index 96781fb39b5..403fa5c789a 100644 grub_dl_load ("ctz_test"); diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h new file mode 100644 -index 00000000000..d5b56f74ad9 +index 00000000000..aa3dc6278e3 --- /dev/null +++ b/grub-core/tests/appended_signatures.h -@@ -0,0 +1,483 @@ +@@ -0,0 +1,557 @@ +unsigned char certificate_der[] = { + 0x30, 0x82, 0x03, 0x88, 0x30, 0x82, 0x02, 0x70, 0xa0, 0x03, 0x02, 0x01, + 0x02, 0x02, 0x14, 0x25, 0x2e, 0xb8, 0xfd, 0x12, 0x62, 0x2e, 0xcd, 0x5d, @@ -790,3 +821,77 @@ index 00000000000..d5b56f74ad9 + 0x65, 0x64, 0x7e, 0x0a +}; +unsigned int hi_signed_2nd_len = 736; ++ ++unsigned char certificate_printable_der[] = { ++ 0x30, 0x82, 0x03, 0x39, 0x30, 0x82, 0x02, 0x21, 0xa0, 0x03, 0x02, 0x01, ++ 0x02, 0x02, 0x09, 0x00, 0xde, 0xf6, 0x22, 0xc4, 0xf2, 0xf1, 0x86, 0x02, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x0b, 0x05, 0x00, 0x30, 0x2a, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, ++ 0x04, 0x03, 0x13, 0x1f, 0x52, 0x65, 0x64, 0x20, 0x48, 0x61, 0x74, 0x20, ++ 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x42, 0x6f, 0x6f, 0x74, 0x20, ++ 0x43, 0x41, 0x20, 0x32, 0x20, 0x28, 0x62, 0x65, 0x74, 0x61, 0x29, 0x30, ++ 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x31, 0x30, 0x33, 0x31, 0x31, 0x34, 0x31, ++ 0x39, 0x32, 0x33, 0x5a, 0x17, 0x0d, 0x33, 0x37, 0x31, 0x30, 0x32, 0x35, ++ 0x31, 0x34, 0x31, 0x39, 0x32, 0x33, 0x5a, 0x30, 0x2f, 0x31, 0x2d, 0x30, ++ 0x2b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x24, 0x52, 0x65, 0x64, 0x20, ++ 0x48, 0x61, 0x74, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x42, ++ 0x6f, 0x6f, 0x74, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, ++ 0x33, 0x20, 0x28, 0x62, 0x65, 0x74, 0x61, 0x29, 0x30, 0x82, 0x01, 0x22, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, ++ 0x02, 0x82, 0x01, 0x01, 0x00, 0xbd, 0xda, 0xa1, 0xed, 0x8d, 0x8e, 0x15, ++ 0x5c, 0xf8, 0x01, 0x77, 0x48, 0x4a, 0x60, 0x96, 0xf9, 0x27, 0xfa, 0xe2, ++ 0xb1, 0x69, 0x0f, 0x51, 0x19, 0x52, 0x7e, 0xc4, 0x34, 0x8e, 0xe1, 0x9b, ++ 0x9c, 0xa4, 0xb1, 0x5c, 0xd6, 0x81, 0x98, 0x78, 0xfe, 0xa9, 0xe5, 0x0b, ++ 0x00, 0xba, 0x9c, 0x64, 0x7e, 0xc7, 0xcc, 0x72, 0xb1, 0x73, 0x4b, 0x11, ++ 0x07, 0x52, 0xf0, 0x20, 0x96, 0x8b, 0x99, 0x39, 0xde, 0xdb, 0xfa, 0x3d, ++ 0x45, 0xe2, 0x98, 0x7b, 0x0c, 0x41, 0xe4, 0x0c, 0xb5, 0x5d, 0x92, 0x74, ++ 0x39, 0x96, 0xe1, 0x97, 0x97, 0xa1, 0xad, 0x2e, 0xcc, 0xd0, 0x1b, 0x4d, ++ 0x9d, 0xbd, 0x3e, 0xa9, 0x36, 0x8e, 0xcc, 0xc7, 0x5f, 0x6a, 0x7d, 0x39, ++ 0x5e, 0x0b, 0x8d, 0xca, 0xe4, 0x83, 0xe9, 0x3b, 0x5c, 0x86, 0x47, 0xd4, ++ 0xba, 0x7d, 0x98, 0x26, 0xa1, 0xf4, 0xe8, 0x90, 0x6b, 0x0f, 0xf1, 0x6b, ++ 0x8c, 0xe3, 0xa2, 0x80, 0x3c, 0x96, 0xf1, 0x0a, 0xb6, 0x66, 0xc0, 0x4b, ++ 0x61, 0xf7, 0x74, 0xcd, 0xd3, 0x7b, 0x8e, 0x5e, 0x39, 0xda, 0x99, 0x20, ++ 0x33, 0x93, 0xd3, 0xf0, 0x7f, 0xad, 0x35, 0xe9, 0x88, 0x8d, 0x9c, 0xbf, ++ 0x65, 0xf1, 0x47, 0x02, 0xf9, 0x7c, 0xed, 0x27, 0x5f, 0x4a, 0x65, 0x3c, ++ 0xcf, 0x5f, 0x0e, 0x88, 0x95, 0x74, 0xde, 0xfb, 0x9e, 0x2e, 0x91, 0x9b, ++ 0x45, 0x37, 0xc8, 0x85, 0xff, 0xe3, 0x41, 0x70, 0xfe, 0xd5, 0xef, 0x0e, ++ 0x82, 0x22, 0x08, 0xb7, 0x3b, 0x44, 0x3e, 0xdc, 0x5b, 0x7f, 0xba, 0xbf, ++ 0xe6, 0x58, 0x9d, 0x02, 0x6e, 0x75, 0xbf, 0x50, 0xec, 0xcf, 0x3f, 0xa5, ++ 0x91, 0x0a, 0xe2, 0x59, 0x2c, 0xc3, 0xe7, 0x05, 0x03, 0xe8, 0xf2, 0x6f, ++ 0x2a, 0x04, 0x68, 0x9a, 0x31, 0x32, 0x8f, 0x04, 0x35, 0xcd, 0x1f, 0x34, ++ 0xcc, 0x4f, 0x79, 0x5a, 0x99, 0x8d, 0x9d, 0x5c, 0xf5, 0x02, 0x03, 0x01, ++ 0x00, 0x01, 0xa3, 0x5d, 0x30, 0x5b, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, ++ 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0b, 0x06, 0x03, ++ 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x1d, 0x06, ++ 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x65, 0xc5, 0xbe, 0xca, ++ 0xe6, 0x59, 0x6a, 0xfd, 0x6c, 0x71, 0xc4, 0xa7, 0x98, 0xc6, 0x25, 0x8d, ++ 0x7b, 0x67, 0x05, 0xd0, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, ++ 0x18, 0x30, 0x16, 0x80, 0x14, 0x81, 0xf8, 0xee, 0x47, 0x5c, 0x3e, 0xed, ++ 0xfb, 0xce, 0xa5, 0x84, 0xbe, 0xd7, 0xae, 0xdb, 0xd3, 0x7d, 0x64, 0xb3, ++ 0x2a, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, ++ 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x66, 0x1e, 0x3d, ++ 0x1d, 0x53, 0x33, 0xde, 0x4e, 0xc7, 0xc4, 0xf4, 0xdf, 0xda, 0x18, 0x19, ++ 0x8a, 0xa9, 0xff, 0xe2, 0x63, 0x2b, 0xbe, 0xf2, 0x61, 0x63, 0xe2, 0xf6, ++ 0xed, 0x47, 0x1a, 0x71, 0x02, 0xec, 0x2a, 0xef, 0x89, 0x77, 0xe3, 0xfd, ++ 0x86, 0x69, 0xf1, 0x3f, 0x0d, 0xf9, 0x6e, 0xf9, 0x3b, 0xad, 0x26, 0x47, ++ 0xb7, 0xf2, 0x0d, 0xad, 0x23, 0xa3, 0x67, 0x3b, 0xcb, 0x6d, 0x9e, 0x03, ++ 0x0f, 0xbc, 0x69, 0x73, 0x9f, 0xd4, 0xa5, 0x0f, 0x6f, 0xf8, 0xab, 0x4d, ++ 0x36, 0xd1, 0xe0, 0xe0, 0x5d, 0x20, 0x43, 0x90, 0xc4, 0x65, 0x61, 0x93, ++ 0xe2, 0x0f, 0x51, 0x59, 0x0a, 0xf7, 0x88, 0x70, 0x57, 0xb9, 0x04, 0xa9, ++ 0x32, 0x57, 0x9c, 0xb3, 0x57, 0x38, 0x8b, 0x8e, 0x46, 0xc8, 0x32, 0x6c, ++ 0xb4, 0xf3, 0x96, 0x7f, 0x4b, 0xf0, 0x88, 0xf9, 0x7f, 0xe2, 0x71, 0xe1, ++ 0x8b, 0xe2, 0x14, 0xf1, 0x4b, 0x25, 0x00, 0x48, 0x1c, 0x7e, 0xe5, 0x8d, ++ 0x65, 0x2d, 0xeb, 0x72, 0x4f, 0x92, 0x44, 0xf3, 0xe6, 0xe0, 0xd0, 0xdf, ++ 0x85, 0xa8, 0x13, 0x4a, 0xfb, 0x99, 0xca, 0x14, 0x2c, 0x97, 0x80, 0x93, ++ 0x27, 0xd3, 0x20, 0xf8, 0x6d, 0x29, 0x28, 0x2c, 0xb9, 0x77, 0xea, 0xb1, ++ 0x63, 0xbd, 0x7d, 0x53, 0xfd, 0x4a, 0x62, 0x64, 0x0b, 0x98, 0xa8, 0xae, ++ 0x11, 0xfc, 0x6e, 0x8d, 0x63, 0xd4, 0x15, 0x55, 0xc6, 0x4c, 0x74, 0xf5, ++ 0x5f, 0xa0, 0xb9, 0x2c, 0x2d, 0x9a, 0x7a, 0x87, 0x6e, 0xf0, 0x5e, 0x25, ++ 0xed, 0xfc, 0xd8, 0xc4, 0x34, 0x33, 0x32, 0xad, 0x01, 0xd4, 0x4b, 0x49, ++ 0x51, 0xc2, 0x07, 0x7f, 0x90, 0x6d, 0xea, 0xf5, 0x4c, 0x41, 0x71, 0x64, ++ 0xeb, 0x1f, 0x29, 0xa3, 0x1f, 0x64, 0xa2, 0x1e, 0x0e, 0x6f, 0xa1, 0x67, ++ 0x99, 0x8d, 0x98, 0x1c, 0xb8, 0x53, 0x9d, 0x30, 0x1d, 0xae, 0x32, 0x56, ++ 0xd2 ++}; ++unsigned int certificate_printable_der_len = 829; diff --git a/0193-appended-signatures-documentation.patch b/0196-appended-signatures-documentation.patch similarity index 94% rename from 0193-appended-signatures-documentation.patch rename to 0196-appended-signatures-documentation.patch index c9076338..864cfa31 100644 --- a/0193-appended-signatures-documentation.patch +++ b/0196-appended-signatures-documentation.patch @@ -13,10 +13,10 @@ Signed-off-by: Daniel Axtens 1 file changed, 182 insertions(+), 17 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 691ffaa1861..7b5d7800418 100644 +index afbde7c1f7b..4816be85611 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -3216,6 +3216,7 @@ These variables have special meaning to GRUB. +@@ -3214,6 +3214,7 @@ These variables have special meaning to GRUB. @menu * biosnum:: @@ -24,7 +24,7 @@ index 691ffaa1861..7b5d7800418 100644 * check_signatures:: * chosen:: * cmdpath:: -@@ -3275,11 +3276,18 @@ For an alternative approach which also changes BIOS drive mappings for the +@@ -3273,11 +3274,18 @@ For an alternative approach which also changes BIOS drive mappings for the chain-loaded system, @pxref{drivemap}. @@ -72,7 +72,7 @@ index 691ffaa1861..7b5d7800418 100644 * verify_detached:: Verify detached digital signature * videoinfo:: List available video modes @comment * xen_*:: Xen boot commands for AArch64 -@@ -4373,9 +4385,28 @@ These keys are used to validate signatures when environment variable +@@ -4376,9 +4388,28 @@ These keys are used to validate signatures when environment variable @code{check_signatures} is set to @code{enforce} (@pxref{check_signatures}), and by some invocations of @command{verify_detached} (@pxref{verify_detached}). @xref{Using @@ -102,7 +102,7 @@ index 691ffaa1861..7b5d7800418 100644 @node drivemap @subsection drivemap -@@ -4633,6 +4664,21 @@ This command is only available on x86 systems. +@@ -4636,6 +4667,21 @@ This command is only available on x86 systems. @end deffn @@ -124,7 +124,7 @@ index 691ffaa1861..7b5d7800418 100644 @node list_env @subsection list_env -@@ -4652,7 +4698,7 @@ The output is in GPG's v4 key fingerprint format (i.e., the output of +@@ -4655,7 +4701,7 @@ The output is in GPG's v4 key fingerprint format (i.e., the output of @code{gpg --fingerprint}). The least significant four bytes (last eight hexadecimal digits) can be used as an argument to @command{distrust} (@pxref{distrust}). @@ -133,7 +133,7 @@ index 691ffaa1861..7b5d7800418 100644 these keys. @end deffn -@@ -4687,8 +4733,13 @@ When used with care, @option{--skip-sig} and the whitelist enable an +@@ -4690,8 +4736,13 @@ When used with care, @option{--skip-sig} and the whitelist enable an administrator to configure a system to boot only signed configurations, but to allow the user to select from among multiple configurations, and to enable ``one-shot'' boot attempts and @@ -148,7 +148,7 @@ index 691ffaa1861..7b5d7800418 100644 @end deffn -@@ -4984,7 +5035,7 @@ read. It is possible to modify a digitally signed environment block +@@ -4987,7 +5038,7 @@ read. It is possible to modify a digitally signed environment block file from within GRUB using this command, such that its signature will no longer be valid on subsequent boots. Care should be taken in such advanced configurations to avoid rendering the system @@ -157,7 +157,7 @@ index 691ffaa1861..7b5d7800418 100644 @end deffn -@@ -5384,11 +5435,32 @@ signatures when environment variable @code{check_signatures} is set to +@@ -5387,11 +5438,32 @@ signatures when environment variable @code{check_signatures} is set to must itself be properly signed. The @option{--skip-sig} option can be used to disable signature-checking when reading @var{pubkey_file} itself. It is expected that @option{--skip-sig} is useful for testing @@ -191,7 +191,7 @@ index 691ffaa1861..7b5d7800418 100644 @node unset @subsection unset -@@ -5407,6 +5479,18 @@ only on PC BIOS platforms. +@@ -5410,6 +5482,18 @@ only on PC BIOS platforms. @end deffn @end ignore @@ -210,7 +210,7 @@ index 691ffaa1861..7b5d7800418 100644 @node verify_detached @subsection verify_detached -@@ -5425,7 +5509,7 @@ tried. +@@ -5428,7 +5512,7 @@ tried. Exit code @code{$?} is set to 0 if the signature validates successfully. If validation fails, it is set to a non-zero value. @@ -219,7 +219,7 @@ index 691ffaa1861..7b5d7800418 100644 @end deffn @node videoinfo -@@ -5808,13 +5892,14 @@ environment variables and commands are listed in the same order. +@@ -5811,13 +5895,14 @@ environment variables and commands are listed in the same order. @chapter Security @menu @@ -241,7 +241,7 @@ index 691ffaa1861..7b5d7800418 100644 @end menu @node Authentication and authorisation -@@ -5888,8 +5973,8 @@ generating configuration files with authentication. You can use +@@ -5891,8 +5976,8 @@ generating configuration files with authentication. You can use adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} commands. @@ -252,7 +252,7 @@ index 691ffaa1861..7b5d7800418 100644 GRUB's @file{core.img} can optionally provide enforcement that all files subsequently read from disk are covered by a valid digital signature. -@@ -5982,6 +6067,86 @@ or BIOS) configuration to cause the machine to boot from a different +@@ -5985,6 +6070,86 @@ or BIOS) configuration to cause the machine to boot from a different (attacker-controlled) device. GRUB is at best only one link in a secure boot chain. diff --git a/0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch b/0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch deleted file mode 100644 index 7758c0c4..00000000 --- a/0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Carlos Maiolino -Date: Wed, 14 Apr 2021 11:07:20 +0200 -Subject: [PATCH] fs/xfs: Add bigtime support for xfs driver - -XFS filesystem now supports bigtime feature, to overcome y2038 problem. -This patch makes grub able to support xfs filesystems with this feature -enabled. - -xfs counter for bigtime enable timestamps starts on 0, which translates -to INT32_MIN (Dec 31 20:45:52 UTC 1901) in the legacy timestamps. The -conversion to unix timestamps is made before passing the value to -grub-core. - -For this to work properly, grub requires to access flags2 field in the -xfs ondisk inode, so, the grub_xfs_inode structure has been updated to -the full ondisk inode size. - -This patch is enough to make grub work properly with files with -timestamps up to INT32_MAX (y2038), any file with timestamps bigger than -this will overflow the counter, causing grub to show wrong timestamps -(not really much difference on current situation). - -Reviewed-by: Javier Martinez Canillas -Signed-off-by: Carlos Maiolino ---- - grub-core/fs/xfs.c | 69 ++++++++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 54 insertions(+), 15 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 43023e03fb3..2ce76ec70f9 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -75,10 +75,15 @@ GRUB_MOD_LICENSE ("GPLv3+"); - XFS_SB_VERSION2_PROJID32BIT | \ - XFS_SB_VERSION2_FTYPE) - -+/* Inode flags2 flags */ -+#define XFS_DIFLAG2_BIGTIME_BIT 3 -+#define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT) -+ - /* incompat feature flags */ --#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ --#define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ --#define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ -+#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ -+#define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ -+#define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ -+#define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */ - - /* - * Directory entries with ftype are explicitly handled by GRUB code. -@@ -92,7 +97,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define XFS_SB_FEAT_INCOMPAT_SUPPORTED \ - (XFS_SB_FEAT_INCOMPAT_FTYPE | \ - XFS_SB_FEAT_INCOMPAT_SPINODES | \ -- XFS_SB_FEAT_INCOMPAT_META_UUID) -+ XFS_SB_FEAT_INCOMPAT_META_UUID | \ -+ XFS_SB_FEAT_INCOMPAT_BIGTIME) - - struct grub_xfs_sblock - { -@@ -177,7 +183,7 @@ struct grub_xfs_btree_root - grub_uint64_t keys[1]; - } GRUB_PACKED; - --struct grub_xfs_time -+struct grub_xfs_time_legacy - { - grub_uint32_t sec; - grub_uint32_t nanosec; -@@ -190,20 +196,23 @@ struct grub_xfs_inode - grub_uint8_t version; - grub_uint8_t format; - grub_uint8_t unused2[26]; -- struct grub_xfs_time atime; -- struct grub_xfs_time mtime; -- struct grub_xfs_time ctime; -+ grub_uint64_t atime; -+ grub_uint64_t mtime; -+ grub_uint64_t ctime; - grub_uint64_t size; - grub_uint64_t nblocks; - grub_uint32_t extsize; - grub_uint32_t nextents; - grub_uint16_t unused3; - grub_uint8_t fork_offset; -- grub_uint8_t unused4[17]; -+ grub_uint8_t unused4[37]; -+ grub_uint64_t flags2; -+ grub_uint8_t unused5[48]; - } GRUB_PACKED; - --#define XFS_V2_INODE_SIZE sizeof(struct grub_xfs_inode) --#define XFS_V3_INODE_SIZE (XFS_V2_INODE_SIZE + 76) -+#define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode) -+/* Size of struct grub_xfs_inode until fork_offset (included)*/ -+#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 92) - - struct grub_xfs_dirblock_tail - { -@@ -233,8 +242,6 @@ struct grub_xfs_data - - static grub_dl_t my_mod; - -- -- - static int grub_xfs_sb_hascrc(struct grub_xfs_data *data) - { - return (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) == -@@ -950,7 +957,6 @@ grub_xfs_mount (grub_disk_t disk) - return 0; - } - -- - /* Context for grub_xfs_dir. */ - struct grub_xfs_dir_ctx - { -@@ -958,6 +964,39 @@ struct grub_xfs_dir_ctx - void *hook_data; - }; - -+/* Bigtime inodes helpers */ -+ -+#define NSEC_PER_SEC 1000000000L -+#define XFS_BIGTIME_EPOCH_OFFSET (-(grub_int64_t)GRUB_INT32_MIN) -+ -+static int grub_xfs_inode_has_bigtime(const struct grub_xfs_inode *inode) -+{ -+ return inode->version >= 3 && -+ (inode->flags2 & grub_cpu_to_be64_compile_time(XFS_DIFLAG2_BIGTIME)); -+} -+ -+static grub_int64_t -+grub_xfs_bigtime_to_unix(grub_uint64_t time) -+{ -+ grub_uint64_t rem; -+ grub_int64_t nsec = NSEC_PER_SEC; -+ grub_int64_t seconds = grub_divmod64((grub_int64_t)time, nsec, &rem); -+ -+ return seconds - XFS_BIGTIME_EPOCH_OFFSET; -+} -+ -+static grub_int64_t -+grub_xfs_get_inode_time(struct grub_xfs_inode *inode) -+{ -+ struct grub_xfs_time_legacy *lts; -+ -+ if (grub_xfs_inode_has_bigtime(inode)) -+ return grub_xfs_bigtime_to_unix(grub_be_to_cpu64(inode->mtime)); -+ -+ lts = (struct grub_xfs_time_legacy *)&inode->mtime; -+ return grub_be_to_cpu32(lts->sec); -+} -+ - /* Helper for grub_xfs_dir. */ - static int - grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype, -@@ -970,7 +1009,7 @@ grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype, - if (node->inode_read) - { - info.mtimeset = 1; -- info.mtime = grub_be_to_cpu32 (node->inode.mtime.sec); -+ info.mtime = grub_xfs_get_inode_time(&node->inode); - } - info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR); - grub_free (node); diff --git a/0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 97% rename from 0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch index cce1d079..40c3b3e8 100644 --- a/0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +++ b/0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch @@ -93,10 +93,10 @@ index 40531fa823b..ebfee4bf06e 100644 EXPORT_FUNC (grub_lockdown) (void); extern int diff --git a/docs/grub.texi b/docs/grub.texi -index 7b5d7800418..cb5804fd6fe 100644 +index 4816be85611..a4da9c2a1b9 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -6224,8 +6224,8 @@ Measured boot is currently only supported on EFI platforms. +@@ -6227,8 +6227,8 @@ Measured boot is currently only supported on EFI platforms. @section Lockdown when booting on a secure setup The GRUB can be locked down when booted on a secure boot environment, for example diff --git a/0198-fs-Use-64bit-type-for-filesystem-timestamp.patch b/0198-fs-Use-64bit-type-for-filesystem-timestamp.patch deleted file mode 100644 index 5938deb1..00000000 --- a/0198-fs-Use-64bit-type-for-filesystem-timestamp.patch +++ /dev/null @@ -1,327 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Carlos Maiolino -Date: Wed, 14 Apr 2021 11:07:21 +0200 -Subject: [PATCH] fs: Use 64bit type for filesystem timestamp - -Some filesystems nowadays uses 64bit types for timestamps, so, update -grub_dirhook_info struct to use an int64 type to store mtime. This also -updates grub_unixtime2datetime() to receive a 64-bit timestamp -argument and do 64bit-safe divisions. - -All the remaining conversion from 32 to 64 should be safe, as 32 to 64 -attributions will be implicitly casted. The most crictical part in the -32 to 64bits conversion is on grub_unixtime2datetime() where it needs -to deal with the 64bit type, specially with division in x86_architectures, -so, for that, the grub_divmod64() helper has been used. - -These changes enables grub to support dates beyond y2038. - -Reviewed-by: Javier Martinez Canillas -Signed-off-by: Carlos Maiolino ---- - grub-core/fs/affs.c | 2 +- - grub-core/fs/ext2.c | 2 +- - grub-core/fs/fat.c | 4 ++-- - grub-core/fs/hfs.c | 2 +- - grub-core/fs/hfsplus.c | 2 +- - grub-core/fs/iso9660.c | 6 +++--- - grub-core/fs/nilfs2.c | 2 +- - grub-core/fs/squash4.c | 2 +- - grub-core/fs/ufs.c | 2 +- - grub-core/fs/zfs/zfs.c | 2 +- - grub-core/lib/datetime.c | 15 ++++++++++++--- - grub-core/net/bootp.c | 2 +- - grub-core/normal/misc.c | 2 +- - grub-core/tests/sleep_test.c | 4 ++-- - include/grub/datetime.h | 4 ++-- - include/grub/fs.h | 4 ++-- - 16 files changed, 33 insertions(+), 24 deletions(-) - -diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c -index 230e26af0f8..cafcd0fba91 100644 ---- a/grub-core/fs/affs.c -+++ b/grub-core/fs/affs.c -@@ -641,7 +641,7 @@ grub_affs_label (grub_device_t device, char **label) - } - - static grub_err_t --grub_affs_mtime (grub_device_t device, grub_int32_t *t) -+grub_affs_mtime (grub_device_t device, grub_int64_t *t) - { - struct grub_affs_data *data; - grub_disk_t disk = device->disk; -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index 848bf939dba..e7dd78e6635 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -1055,7 +1055,7 @@ grub_ext2_uuid (grub_device_t device, char **uuid) - - /* Get mtime. */ - static grub_err_t --grub_ext2_mtime (grub_device_t device, grub_int32_t *tm) -+grub_ext2_mtime (grub_device_t device, grub_int64_t *tm) - { - struct grub_ext2_data *data; - grub_disk_t disk = device->disk; -diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c -index 7f775a17038..dd82e4ee35d 100644 ---- a/grub-core/fs/fat.c -+++ b/grub-core/fs/fat.c -@@ -737,7 +737,7 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, - * https://docs.microsoft.com/en-us/windows/win32/fileio/exfat-specification - */ - static int --grub_exfat_timestamp (grub_uint32_t field, grub_uint8_t msec, grub_int32_t *nix) { -+grub_exfat_timestamp (grub_uint32_t field, grub_uint8_t msec, grub_int64_t *nix) { - struct grub_datetime datetime = { - .year = (field >> 25) + 1980, - .month = (field & 0x01E00000) >> 21, -@@ -891,7 +891,7 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, - * https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-107.pdf - */ - static int --grub_fat_timestamp (grub_uint16_t time, grub_uint16_t date, grub_int32_t *nix) { -+grub_fat_timestamp (grub_uint16_t time, grub_uint16_t date, grub_int64_t *nix) { - struct grub_datetime datetime = { - .year = (date >> 9) + 1980, - .month = (date & 0x01E0) >> 5, -diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c -index 9a5b7bbe906..f419965d154 100644 ---- a/grub-core/fs/hfs.c -+++ b/grub-core/fs/hfs.c -@@ -1374,7 +1374,7 @@ grub_hfs_label (grub_device_t device, char **label) - } - - static grub_err_t --grub_hfs_mtime (grub_device_t device, grub_int32_t *tm) -+grub_hfs_mtime (grub_device_t device, grub_int64_t *tm) - { - struct grub_hfs_data *data; - -diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c -index 2a69055c7ec..19c7b336798 100644 ---- a/grub-core/fs/hfsplus.c -+++ b/grub-core/fs/hfsplus.c -@@ -1083,7 +1083,7 @@ grub_hfsplus_label (grub_device_t device, char **label) - - /* Get mtime. */ - static grub_err_t --grub_hfsplus_mtime (grub_device_t device, grub_int32_t *tm) -+grub_hfsplus_mtime (grub_device_t device, grub_int64_t *tm) - { - struct grub_hfsplus_data *data; - grub_disk_t disk = device->disk; -diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c -index 5ec4433b8f8..ac011950a64 100644 ---- a/grub-core/fs/iso9660.c -+++ b/grub-core/fs/iso9660.c -@@ -178,7 +178,7 @@ static grub_dl_t my_mod; - - - static grub_err_t --iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int32_t *nix) -+iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int64_t *nix) - { - struct grub_datetime datetime; - -@@ -206,7 +206,7 @@ iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int32_t *nix) - } - - static int --iso9660_to_unixtime2 (const struct grub_iso9660_date2 *i, grub_int32_t *nix) -+iso9660_to_unixtime2 (const struct grub_iso9660_date2 *i, grub_int64_t *nix) - { - struct grub_datetime datetime; - -@@ -1107,7 +1107,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid) - - /* Get writing time of filesystem. */ - static grub_err_t --grub_iso9660_mtime (grub_device_t device, grub_int32_t *timebuf) -+grub_iso9660_mtime (grub_device_t device, grub_int64_t *timebuf) - { - struct grub_iso9660_data *data; - grub_disk_t disk = device->disk; -diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c -index 9b76982b3b0..3c248a910b4 100644 ---- a/grub-core/fs/nilfs2.c -+++ b/grub-core/fs/nilfs2.c -@@ -1186,7 +1186,7 @@ grub_nilfs2_uuid (grub_device_t device, char **uuid) - - /* Get mtime. */ - static grub_err_t --grub_nilfs2_mtime (grub_device_t device, grub_int32_t * tm) -+grub_nilfs2_mtime (grub_device_t device, grub_int64_t * tm) - { - struct grub_nilfs2_data *data; - grub_disk_t disk = device->disk; -diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c -index a5f35c10e2f..6dd731e231e 100644 ---- a/grub-core/fs/squash4.c -+++ b/grub-core/fs/squash4.c -@@ -1003,7 +1003,7 @@ grub_squash_close (grub_file_t file) - } - - static grub_err_t --grub_squash_mtime (grub_device_t dev, grub_int32_t *tm) -+grub_squash_mtime (grub_device_t dev, grub_int64_t *tm) - { - struct grub_squash_data *data = 0; - -diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c -index fca46baa19d..34a698b71b8 100644 ---- a/grub-core/fs/ufs.c -+++ b/grub-core/fs/ufs.c -@@ -837,7 +837,7 @@ grub_ufs_uuid (grub_device_t device, char **uuid) - - /* Get mtime. */ - static grub_err_t --grub_ufs_mtime (grub_device_t device, grub_int32_t *tm) -+grub_ufs_mtime (grub_device_t device, grub_int64_t *tm) - { - struct grub_ufs_data *data = 0; - -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index f9e755197c5..cf4d2ab189a 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -3771,7 +3771,7 @@ zfs_uuid (grub_device_t device, char **uuid) - } - - static grub_err_t --zfs_mtime (grub_device_t device, grub_int32_t *mt) -+zfs_mtime (grub_device_t device, grub_int64_t *mt) - { - struct grub_zfs_data *data; - grub_zfs_endian_t ub_endian = GRUB_ZFS_UNKNOWN_ENDIAN; -diff --git a/grub-core/lib/datetime.c b/grub-core/lib/datetime.c -index 95b8c9ff5e3..3e84fa1dbc4 100644 ---- a/grub-core/lib/datetime.c -+++ b/grub-core/lib/datetime.c -@@ -19,6 +19,7 @@ - - #include - #include -+#include - - static const char *const grub_weekday_names[] = - { -@@ -60,9 +61,10 @@ grub_get_weekday_name (struct grub_datetime *datetime) - - - void --grub_unixtime2datetime (grub_int32_t nix, struct grub_datetime *datetime) -+grub_unixtime2datetime (grub_int64_t nix, struct grub_datetime *datetime) - { - int i; -+ grub_uint64_t rem; - grub_uint8_t months[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - /* In the period of validity of unixtime all years divisible by 4 - are bissextile*/ -@@ -75,9 +77,16 @@ grub_unixtime2datetime (grub_int32_t nix, struct grub_datetime *datetime) - unsigned secs_in_day; - /* Transform C divisions and modulos to mathematical ones */ - if (nix < 0) -- days_epoch = -(((unsigned) (SECPERDAY-nix-1)) / SECPERDAY); -+ /* -+ * the division here shouldn't be larger than INT_MAX, -+ * so, it's safe to store the result back in an int -+ */ -+ days_epoch = -(grub_divmod64(((grub_int64_t)(SECPERDAY) - nix - 1), -+ SECPERDAY, -+ &rem)); - else -- days_epoch = ((unsigned) nix) / SECPERDAY; -+ days_epoch = grub_divmod64(nix, SECPERDAY, &rem); -+ - secs_in_day = nix - days_epoch * SECPERDAY; - days = days_epoch + 69 * DAYSPERYEAR + 17; - -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 8f2f55c0079..7baf3540c81 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -610,7 +610,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) - grub_err_t err; - struct grub_net_bootp_packet *pack; - struct grub_datetime date; -- grub_int32_t t = 0; -+ grub_int64_t t = 0; - struct grub_net_buff *nb; - struct udphdr *udph; - grub_net_network_level_address_t target; -diff --git a/grub-core/normal/misc.c b/grub-core/normal/misc.c -index 8bb6da31fb3..f7e9e3ac4a1 100644 ---- a/grub-core/normal/misc.c -+++ b/grub-core/normal/misc.c -@@ -136,7 +136,7 @@ grub_normal_print_device_info (const char *name) - } - if (fs->fs_mtime) - { -- grub_int32_t tm; -+ grub_int64_t tm; - struct grub_datetime datetime; - (fs->fs_mtime) (dev, &tm); - if (grub_errno == GRUB_ERR_NONE) -diff --git a/grub-core/tests/sleep_test.c b/grub-core/tests/sleep_test.c -index 3d11c717cb7..63f6713165f 100644 ---- a/grub-core/tests/sleep_test.c -+++ b/grub-core/tests/sleep_test.c -@@ -32,7 +32,7 @@ static void - sleep_test (void) - { - struct grub_datetime st, en; -- grub_int32_t stu = 0, enu = 0; -+ grub_int64_t stu = 0, enu = 0; - int is_delayok; - grub_test_assert (!grub_get_datetime (&st), "Couldn't retrieve start time"); - grub_millisleep (10000); -@@ -45,7 +45,7 @@ sleep_test (void) - if (enu - stu >= 15 && enu - stu <= 17) - is_delayok = 1; - #endif -- grub_test_assert (is_delayok, "Interval out of range: %d", enu-stu); -+ grub_test_assert (is_delayok, "Interval out of range: %lld", enu-stu); - - } - -diff --git a/include/grub/datetime.h b/include/grub/datetime.h -index fef281404d7..23ae0791ced 100644 ---- a/include/grub/datetime.h -+++ b/include/grub/datetime.h -@@ -48,11 +48,11 @@ grub_err_t grub_set_datetime (struct grub_datetime *datetime); - int grub_get_weekday (struct grub_datetime *datetime); - const char *grub_get_weekday_name (struct grub_datetime *datetime); - --void grub_unixtime2datetime (grub_int32_t nix, -+void grub_unixtime2datetime (grub_int64_t nix, - struct grub_datetime *datetime); - - static inline int --grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix) -+grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int64_t *nix) - { - grub_int32_t ret; - int y4, ay; -diff --git a/include/grub/fs.h b/include/grub/fs.h -index 302e48d4b50..026bc3bb861 100644 ---- a/include/grub/fs.h -+++ b/include/grub/fs.h -@@ -39,7 +39,7 @@ struct grub_dirhook_info - unsigned mtimeset:1; - unsigned case_insensitive:1; - unsigned inodeset:1; -- grub_int32_t mtime; -+ grub_int64_t mtime; - grub_uint64_t inode; - }; - -@@ -81,7 +81,7 @@ struct grub_fs - grub_err_t (*fs_uuid) (grub_device_t device, char **uuid); - - /* Get writing time of filesystem. */ -- grub_err_t (*fs_mtime) (grub_device_t device, grub_int32_t *timebuf); -+ grub_err_t (*fs_mtime) (grub_device_t device, grub_int64_t *timebuf); - - #ifdef GRUB_UTIL - /* Determine sectors available for embedding. */ diff --git a/0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0198-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0198-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0200-ieee1275-claim-more-memory.patch b/0199-ieee1275-claim-more-memory.patch similarity index 99% rename from 0200-ieee1275-claim-more-memory.patch rename to 0199-ieee1275-claim-more-memory.patch index d1156ca1..001a9df0 100644 --- a/0200-ieee1275-claim-more-memory.patch +++ b/0199-ieee1275-claim-more-memory.patch @@ -227,7 +227,7 @@ index 0dcd114ce54..c61d91a0285 100644 #endif diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index a55af53fd45..008bd7a3c34 100644 +index 19f708ee662..90083772c8a 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1047,7 +1047,9 @@ space is limited to 4GiB. GRUB allocates pages from EFI for its heap, at most diff --git a/0201-ieee1275-request-memory-with-ibm-client-architecture.patch b/0200-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0201-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0200-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch new file mode 100644 index 00000000..a237a217 --- /dev/null +++ b/0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch @@ -0,0 +1,315 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Sat, 8 May 2021 02:27:58 +0200 +Subject: [PATCH] appendedsig/x509: Also handle the Extended Key Usage + extension + +Red Hat certificates have both Key Usage and Extended Key Usage extensions +present, but the appended signatures x509 parser doesn't handle the latter +and so buils due finding an unrecognised critical extension: + +Error loading initial key: +../../grub-core/commands/appendedsig/x509.c:780:Unhandled critical x509 extension with OID 2.5.29.37 + +Fix this by also parsing the Extended Key Usage extension and handle it by +verifying that the certificate has a single purpose, that is code signing. + +Signed-off-by: Javier Martinez Canillas +Signed-off-by: Daniel Axtens +--- + grub-core/commands/appendedsig/x509.c | 94 ++++++++++++++++++++++++++++++- + grub-core/tests/appended_signature_test.c | 29 +++++++++- + grub-core/tests/appended_signatures.h | 81 ++++++++++++++++++++++++++ + 3 files changed, 201 insertions(+), 3 deletions(-) + +diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c +index 2b38b3670a2..42ec65c54aa 100644 +--- a/grub-core/commands/appendedsig/x509.c ++++ b/grub-core/commands/appendedsig/x509.c +@@ -47,6 +47,12 @@ const char *keyUsage_oid = "2.5.29.15"; + */ + const char *basicConstraints_oid = "2.5.29.19"; + ++/* ++ * RFC 5280 4.2.1.12 Extended Key Usage ++ */ ++const char *extendedKeyUsage_oid = "2.5.29.37"; ++const char *codeSigningUsage_oid = "1.3.6.1.5.5.7.3.3"; ++ + /* + * RFC 3279 2.3.1 + * +@@ -637,6 +643,77 @@ cleanup: + return err; + } + ++/* ++ * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId ++ * ++ * KeyPurposeId ::= OBJECT IDENTIFIER ++ */ ++static grub_err_t ++verify_extended_key_usage (grub_uint8_t * value, int value_size) ++{ ++ asn1_node extendedasn; ++ int result, count; ++ grub_err_t err = GRUB_ERR_NONE; ++ char usage[MAX_OID_LEN]; ++ int usage_size = sizeof (usage); ++ ++ result = ++ asn1_create_element (_gnutls_pkix_asn, "PKIX1.ExtKeyUsageSyntax", ++ &extendedasn); ++ if (result != ASN1_SUCCESS) ++ { ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Could not create ASN.1 structure for Extended Key Usage"); ++ } ++ ++ result = asn1_der_decoding2 (&extendedasn, value, &value_size, ++ ASN1_DECODE_FLAG_STRICT_DER, asn1_error); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error parsing DER for Extended Key Usage: %s", ++ asn1_error); ++ goto cleanup; ++ } ++ ++ /* ++ * If EKUs are present, there must be exactly 1 and it must be a ++ * codeSigning usage. ++ */ ++ result = asn1_number_of_elements(extendedasn, "", &count); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error counting number of Extended Key Usages: %s", ++ asn1_strerror (result)); ++ goto cleanup; ++ } ++ ++ result = asn1_read_value (extendedasn, "?1", usage, &usage_size); ++ if (result != ASN1_SUCCESS) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading Extended Key Usage: %s", ++ asn1_strerror (result)); ++ goto cleanup; ++ } ++ ++ if (grub_strncmp (codeSigningUsage_oid, usage, usage_size) != 0) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Unexpected Extended Key Usage OID, got: %s", ++ usage); ++ goto cleanup; ++ } ++ ++cleanup: ++ asn1_delete_structure (&extendedasn); ++ return err; ++} + + /* + * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension +@@ -660,7 +737,7 @@ verify_extensions (asn1_node cert) + { + int result; + int ext, num_extensions = 0; +- int usage_present = 0, constraints_present = 0; ++ int usage_present = 0, constraints_present = 0, extended_usage_present = 0; + char *oid_path, *critical_path, *value_path; + char extnID[MAX_OID_LEN]; + int extnID_size; +@@ -754,6 +831,15 @@ verify_extensions (asn1_node cert) + } + constraints_present++; + } ++ else if (grub_strncmp (extendedKeyUsage_oid, extnID, extnID_size) == 0) ++ { ++ err = verify_extended_key_usage (value, value_size); ++ if (err != GRUB_ERR_NONE) ++ { ++ goto cleanup_value; ++ } ++ extended_usage_present++; ++ } + else if (grub_strncmp ("TRUE", critical, critical_size) == 0) + { + /* +@@ -785,6 +871,12 @@ verify_extensions (asn1_node cert) + "Unexpected number of basic constraints extensions - expected 1, got %d", + constraints_present); + } ++ if (extended_usage_present > 1) ++ { ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Unexpected number of Extended Key Usage extensions - expected 0 or 1, got %d", ++ extended_usage_present); ++ } + return GRUB_ERR_NONE; + + cleanup_value: +diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c +index 88a485200d8..dbba0616621 100644 +--- a/grub-core/tests/appended_signature_test.c ++++ b/grub-core/tests/appended_signature_test.c +@@ -111,6 +111,22 @@ static struct grub_procfs_entry certificate_printable_der_entry = { + .get_contents = get_certificate_printable_der + }; + ++static char * ++get_certificate_eku_der (grub_size_t * sz) ++{ ++ char *ret; ++ *sz = certificate_eku_der_len; ++ ret = grub_malloc (*sz); ++ if (ret) ++ grub_memcpy (ret, certificate_eku_der, *sz); ++ return ret; ++} ++ ++static struct grub_procfs_entry certificate_eku_der_entry = { ++ .name = "certificate_eku.der", ++ .get_contents = get_certificate_eku_der ++}; ++ + + static void + do_verify (const char *f, int is_valid) +@@ -149,6 +165,7 @@ appended_signature_test (void) + char *trust_args2[] = { (char *) "(proc)/certificate2.der", NULL }; + char *trust_args_printable[] = { (char *) "(proc)/certificate_printable.der", + NULL }; ++ char *trust_args_eku[] = { (char *) "(proc)/certificate_eku.der", NULL }; + char *distrust_args[] = { (char *) "1", NULL }; + char *distrust2_args[] = { (char *) "2", NULL }; + grub_err_t err; +@@ -157,6 +174,7 @@ appended_signature_test (void) + grub_procfs_register ("certificate2.der", &certificate2_der_entry); + grub_procfs_register ("certificate_printable.der", + &certificate_printable_der_entry); ++ grub_procfs_register ("certificate_eku.der", &certificate_eku_der_entry); + + cmd_trust = grub_command_find ("trust_certificate"); + if (!cmd_trust) +@@ -266,16 +284,23 @@ appended_signature_test (void) + + /* + * Lastly, check a certificate that uses printableString rather than +- * utf8String loads properly. ++ * utf8String loads properly, and that a certificate with an appropriate ++ * extended key usage loads. + */ + err = (cmd_trust->func) (cmd_trust, 1, trust_args_printable); + grub_test_assert (err == GRUB_ERR_NONE, +- "distrusting printable certificate failed: %d: %s", ++ "trusting printable certificate failed: %d: %s", ++ grub_errno, grub_errmsg); ++ ++ err = (cmd_trust->func) (cmd_trust, 1, trust_args_eku); ++ grub_test_assert (err == GRUB_ERR_NONE, ++ "trusting certificate with extended key usage failed: %d: %s", + grub_errno, grub_errmsg); + + grub_procfs_unregister (&certificate_der_entry); + grub_procfs_unregister (&certificate2_der_entry); + grub_procfs_unregister (&certificate_printable_der_entry); ++ grub_procfs_unregister (&certificate_eku_der_entry); + } + + GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); +diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h +index aa3dc6278e3..2e5ebd7d8bd 100644 +--- a/grub-core/tests/appended_signatures.h ++++ b/grub-core/tests/appended_signatures.h +@@ -555,3 +555,84 @@ unsigned char certificate_printable_der[] = { + 0xd2 + }; + unsigned int certificate_printable_der_len = 829; ++ ++unsigned char certificate_eku_der[] = { ++ 0x30, 0x82, 0x03, 0x90, 0x30, 0x82, 0x02, 0x78, 0xa0, 0x03, 0x02, 0x01, ++ 0x02, 0x02, 0x09, 0x00, 0xd3, 0x9c, 0x41, 0x33, 0xdd, 0x6b, 0x5f, 0x45, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x0b, 0x05, 0x00, 0x30, 0x47, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, ++ 0x04, 0x03, 0x0c, 0x18, 0x52, 0x65, 0x64, 0x20, 0x48, 0x61, 0x74, 0x20, ++ 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x42, 0x6f, 0x6f, 0x74, 0x20, ++ 0x43, 0x41, 0x20, 0x36, 0x31, 0x22, 0x30, 0x20, 0x06, 0x09, 0x2a, 0x86, ++ 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x13, 0x73, 0x65, 0x63, ++ 0x61, 0x6c, 0x65, 0x72, 0x74, 0x40, 0x72, 0x65, 0x64, 0x68, 0x61, 0x74, ++ 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x32, ++ 0x31, 0x35, 0x31, 0x34, 0x30, 0x30, 0x34, 0x34, 0x5a, 0x17, 0x0d, 0x33, ++ 0x38, 0x30, 0x31, 0x31, 0x37, 0x31, 0x34, 0x30, 0x30, 0x34, 0x34, 0x5a, ++ 0x30, 0x4e, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, ++ 0x1f, 0x52, 0x65, 0x64, 0x20, 0x48, 0x61, 0x74, 0x20, 0x53, 0x65, 0x63, ++ 0x75, 0x72, 0x65, 0x20, 0x42, 0x6f, 0x6f, 0x74, 0x20, 0x53, 0x69, 0x67, ++ 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x36, 0x30, 0x32, 0x31, 0x22, 0x30, 0x20, ++ 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, ++ 0x13, 0x73, 0x65, 0x63, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x40, 0x72, 0x65, ++ 0x64, 0x68, 0x61, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0x22, ++ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, ++ 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, ++ 0x02, 0x82, 0x01, 0x01, 0x00, 0xaa, 0x6f, 0xbb, 0x92, 0x77, 0xd7, 0x15, ++ 0xef, 0x88, 0x80, 0x88, 0xc0, 0xe7, 0x89, 0xeb, 0x35, 0x76, 0xf4, 0x85, ++ 0x05, 0x0f, 0x19, 0xe4, 0x5f, 0x25, 0xdd, 0xc1, 0xa2, 0xe5, 0x5c, 0x06, ++ 0xfb, 0xf1, 0x06, 0xb5, 0x65, 0x45, 0xcb, 0xbd, 0x19, 0x33, 0x54, 0xb5, ++ 0x1a, 0xcd, 0xe4, 0xa8, 0x35, 0x2a, 0xfe, 0x9c, 0x53, 0xf4, 0xc6, 0x76, ++ 0xdb, 0x1f, 0x8a, 0xd4, 0x7b, 0x18, 0x11, 0xaf, 0xa3, 0x90, 0xd4, 0xdd, ++ 0x4d, 0xd5, 0x42, 0xcc, 0x14, 0x9a, 0x64, 0x6b, 0xc0, 0x7f, 0xaa, 0x1c, ++ 0x94, 0x47, 0x4d, 0x79, 0xbd, 0x57, 0x9a, 0xbf, 0x99, 0x4e, 0x96, 0xa9, ++ 0x31, 0x2c, 0xa9, 0xe7, 0x14, 0x65, 0x86, 0xc8, 0xac, 0x79, 0x5e, 0x78, ++ 0xa4, 0x3c, 0x00, 0x24, 0xd3, 0xf7, 0xe1, 0xf5, 0x12, 0xad, 0xa0, 0x29, ++ 0xe5, 0xfe, 0x80, 0xae, 0xf8, 0xaa, 0x60, 0x36, 0xe7, 0xe8, 0x94, 0xcb, ++ 0xe9, 0xd1, 0xcc, 0x0b, 0x4d, 0xf7, 0xde, 0xeb, 0x52, 0xd2, 0x73, 0x09, ++ 0x28, 0xdf, 0x48, 0x99, 0x53, 0x9f, 0xc5, 0x9a, 0xd4, 0x36, 0xa3, 0xc6, ++ 0x5e, 0x8d, 0xbe, 0xd5, 0xdc, 0x76, 0xb4, 0x74, 0xb8, 0x26, 0x18, 0x27, ++ 0xfb, 0xf2, 0xfb, 0xd0, 0x9b, 0x3d, 0x7f, 0x10, 0xe2, 0xab, 0x44, 0xc7, ++ 0x88, 0x7f, 0xb4, 0x3d, 0x3e, 0xa3, 0xff, 0x6d, 0x06, 0x4b, 0x3e, 0x55, ++ 0xb2, 0x84, 0xf4, 0xad, 0x54, 0x88, 0x81, 0xc3, 0x9c, 0xf8, 0xb6, 0x68, ++ 0x96, 0x38, 0x8b, 0xcd, 0x90, 0x6d, 0x25, 0x4b, 0xbf, 0x0c, 0x44, 0x90, ++ 0xa5, 0x5b, 0x98, 0xd0, 0x40, 0x2f, 0xbb, 0x0d, 0xa8, 0x4b, 0x8a, 0x62, ++ 0x82, 0x46, 0x46, 0x18, 0x38, 0xae, 0x82, 0x07, 0xd0, 0xb4, 0x2f, 0x16, ++ 0x79, 0x55, 0x9f, 0x1b, 0xc5, 0x08, 0x6d, 0x85, 0xdf, 0x3f, 0xa9, 0x9b, ++ 0x4b, 0xc6, 0x28, 0xd3, 0x58, 0x72, 0x3d, 0x37, 0x11, 0x02, 0x03, 0x01, ++ 0x00, 0x01, 0xa3, 0x78, 0x30, 0x76, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, ++ 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0e, 0x06, 0x03, ++ 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, ++ 0x30, 0x16, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x01, 0x01, 0xff, 0x04, 0x0c, ++ 0x30, 0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, ++ 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x6c, ++ 0xe4, 0x6c, 0x27, 0xaa, 0xcd, 0x0d, 0x4b, 0x74, 0x21, 0xa4, 0xf6, 0x5f, ++ 0x87, 0xb5, 0x31, 0xfe, 0x10, 0xbb, 0xa7, 0x30, 0x1f, 0x06, 0x03, 0x55, ++ 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xe8, 0x6a, 0x1c, 0xab, ++ 0x2c, 0x48, 0xf9, 0x60, 0x36, 0xa2, 0xf0, 0x7b, 0x8e, 0xd2, 0x9d, 0xb4, ++ 0x2a, 0x28, 0x98, 0xc8, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, ++ 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, ++ 0x55, 0x34, 0xe2, 0xfa, 0xf6, 0x89, 0x86, 0xad, 0x92, 0x21, 0xec, 0xb9, ++ 0x54, 0x0e, 0x18, 0x47, 0x0d, 0x1b, 0xa7, 0x58, 0xad, 0x69, 0xe4, 0xef, ++ 0x3b, 0xe6, 0x8d, 0xdd, 0xda, 0x0c, 0x45, 0xf6, 0xe8, 0x96, 0xa4, 0x29, ++ 0x0f, 0xbb, 0xcf, 0x16, 0xae, 0x93, 0xd0, 0xcb, 0x2a, 0x26, 0x1a, 0x7b, ++ 0xfc, 0x51, 0x22, 0x76, 0x98, 0x31, 0xa7, 0x0f, 0x29, 0x35, 0x79, 0xbf, ++ 0xe2, 0x4f, 0x0f, 0x14, 0xf5, 0x1f, 0xcb, 0xbf, 0x87, 0x65, 0x13, 0x32, ++ 0xa3, 0x19, 0x4a, 0xd1, 0x3f, 0x45, 0xd4, 0x4b, 0xe2, 0x00, 0x26, 0xa9, ++ 0x3e, 0xd7, 0xa5, 0x37, 0x9f, 0xf5, 0xad, 0x61, 0xe2, 0x40, 0xa9, 0x74, ++ 0x24, 0x53, 0xf2, 0x78, 0xeb, 0x10, 0x9b, 0x2c, 0x27, 0x88, 0x46, 0xcb, ++ 0xe4, 0x60, 0xca, 0xf5, 0x06, 0x24, 0x40, 0x2a, 0x97, 0x3a, 0xcc, 0xd0, ++ 0x81, 0xb1, 0x15, 0xa3, 0x4f, 0xd0, 0x2b, 0x4f, 0xca, 0x6e, 0xaa, 0x24, ++ 0x31, 0xb3, 0xac, 0xa6, 0x75, 0x05, 0xfe, 0x8a, 0xf4, 0x41, 0xc4, 0x06, ++ 0x8a, 0xc7, 0x0a, 0x83, 0x4e, 0x49, 0xd4, 0x3f, 0x83, 0x50, 0xec, 0x57, ++ 0x04, 0x97, 0x14, 0x49, 0xf5, 0xe1, 0xb1, 0x7a, 0x9c, 0x09, 0x4f, 0x61, ++ 0x87, 0xc3, 0x97, 0x22, 0x17, 0xc2, 0xeb, 0xcc, 0x32, 0x81, 0x31, 0x21, ++ 0x3f, 0x10, 0x57, 0x5b, 0x43, 0xbe, 0xcd, 0x68, 0x82, 0xbe, 0xe5, 0xc1, ++ 0x65, 0x94, 0x7e, 0xc2, 0x34, 0x76, 0x2b, 0xcf, 0x89, 0x3c, 0x2b, 0x81, ++ 0x23, 0x72, 0x95, 0xcf, 0xc9, 0x67, 0x19, 0x2a, 0xd5, 0x5c, 0xca, 0xa3, ++ 0x46, 0xbd, 0x48, 0x06, 0x0b, 0xa6, 0xa3, 0x96, 0x50, 0x28, 0xc7, 0x7e, ++ 0xcf, 0x62, 0xf2, 0xfa, 0xc4, 0xf2, 0x53, 0xe3, 0xc9, 0xe8, 0x2e, 0xdd, ++ 0x29, 0x37, 0x07, 0x47, 0xff, 0xff, 0x8a, 0x32, 0xbd, 0xa2, 0xb7, 0x21, ++ 0x89, 0xa0, 0x55, 0xf7 ++}; ++unsigned int certificate_eku_der_len = 916; diff --git a/0202-ieee1275-ofdisk-retry-on-open-failure.patch b/0202-ieee1275-ofdisk-retry-on-open-failure.patch new file mode 100644 index 00000000..275d14f4 --- /dev/null +++ b/0202-ieee1275-ofdisk-retry-on-open-failure.patch @@ -0,0 +1,103 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Diego Domingos +Date: Wed, 10 Mar 2021 14:17:52 -0500 +Subject: [PATCH] ieee1275/ofdisk: retry on open failure + +This patch aims to make grub more robust when booting from SAN/Multipath disks. + +If a path is failing intermittently so grub will retry the OPEN and READ the +disk (grub_ieee1275_open and grub_ieee1275_read) until the total amount of times +specified in MAX_RETRIES. + +Signed-off-by: Diego Domingos +--- + grub-core/disk/ieee1275/ofdisk.c | 25 ++++++++++++++++++++----- + include/grub/ieee1275/ofdisk.h | 8 ++++++++ + 2 files changed, 28 insertions(+), 5 deletions(-) + +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index ea7f78ac7d8..55346849d35 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -225,7 +225,9 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) + char *buf, *bufptr; + unsigned i; + +- if (grub_ieee1275_open (alias->path, &ihandle)) ++ ++ RETRY_IEEE1275_OFDISK_OPEN(alias->path, &ihandle) ++ if (! ihandle) + return; + + /* This method doesn't need memory allocation for the table. Open +@@ -305,7 +307,9 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) + return; + } + +- if (grub_ieee1275_open (alias->path, &ihandle)) ++ RETRY_IEEE1275_OFDISK_OPEN(alias->path, &ihandle); ++ ++ if (! ihandle) + { + grub_free (buf); + grub_free (table); +@@ -495,7 +499,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) + last_ihandle = 0; + last_devpath = NULL; + +- grub_ieee1275_open (op->open_path, &last_ihandle); ++ RETRY_IEEE1275_OFDISK_OPEN(op->open_path, &last_ihandle); + if (! last_ihandle) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); + last_devpath = op->open_path; +@@ -571,7 +575,7 @@ grub_ofdisk_prepare (grub_disk_t disk, grub_disk_addr_t sector) + last_ihandle = 0; + last_devpath = NULL; + +- grub_ieee1275_open (disk->data, &last_ihandle); ++ RETRY_IEEE1275_OFDISK_OPEN(disk->data, &last_ihandle); + if (! last_ihandle) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); + last_devpath = disk->data; +@@ -598,12 +602,23 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector, + return err; + grub_ieee1275_read (last_ihandle, buf, size << disk->log_sector_size, + &actual); +- if (actual != (grub_ssize_t) (size << disk->log_sector_size)) ++ int i = 0; ++ while(actual != (grub_ssize_t) (size << disk->log_sector_size)){ ++ if (i>MAX_RETRIES){ + return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx " + "from `%s'"), + (unsigned long long) sector, + disk->name); ++ } ++ last_devpath = NULL; ++ err = grub_ofdisk_prepare (disk, sector); ++ if (err) ++ return err; + ++ grub_ieee1275_read (last_ihandle, buf, size << disk->log_sector_size, ++ &actual); ++ i++; ++ } + return 0; + } + +diff --git a/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h +index 2f69e3f191d..7d2d5409305 100644 +--- a/include/grub/ieee1275/ofdisk.h ++++ b/include/grub/ieee1275/ofdisk.h +@@ -22,4 +22,12 @@ + extern void grub_ofdisk_init (void); + extern void grub_ofdisk_fini (void); + ++#define MAX_RETRIES 20 ++ ++ ++#define RETRY_IEEE1275_OFDISK_OPEN(device, last_ihandle) unsigned retry_i=0;for(retry_i=0; retry_i < MAX_RETRIES; retry_i++){ \ ++ if(!grub_ieee1275_open(device, last_ihandle)) \ ++ break; \ ++ grub_dprintf("ofdisk","Opening disk %s failed. Retrying...\n",device); } ++ + #endif /* ! GRUB_INIT_HEADER */ diff --git a/0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch b/0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch deleted file mode 100644 index fbffc3cb..00000000 --- a/0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 3 May 2021 16:57:17 +0200 -Subject: [PATCH] xfs: Include needsrepair in the supported incompat features - list - -XFS now has an incompat feature flag to indicate that the filesystem needs -to be repaired. The Linux kernel refuses to mount a filesystem that has it -set and only the xfs_repair tool is able to clear that flag. - -The GRUB doesn't have the concept of mounting filesystems and just attempt -to read the files. But it does some sanity checking, before attempting to -read from a filesystem. - -Among the things that are tested, is if the super block only has set the -incompatible features flags that are supported by GRUB. If it contains any -flags that are not listed as supported, reading the XFS filesystem fails. - -Since GRUB doesn't attempt to detect if the filesystem is inconsistent nor -replays the journal, just ignore if a filesystem needs to be repaired too. - -But print a message if grub_xfs_mount() fails, to give more information to -the user about why that could had been the case. - -Suggested-by: Eric Sandeen -Signed-off-by: Javier Martinez Canillas ---- - grub-core/fs/xfs.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 2ce76ec70f9..c4c1bca39a8 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -84,6 +84,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ - #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ - #define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */ -+#define XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR (1 << 4) /* needs xfs_repair */ - - /* - * Directory entries with ftype are explicitly handled by GRUB code. -@@ -98,7 +99,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); - (XFS_SB_FEAT_INCOMPAT_FTYPE | \ - XFS_SB_FEAT_INCOMPAT_SPINODES | \ - XFS_SB_FEAT_INCOMPAT_META_UUID | \ -- XFS_SB_FEAT_INCOMPAT_BIGTIME) -+ XFS_SB_FEAT_INCOMPAT_BIGTIME | \ -+ XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR) - - struct grub_xfs_sblock - { -@@ -307,6 +309,16 @@ static int grub_xfs_sb_valid(struct grub_xfs_data *data) - return 0; - } - -+static int -+grub_xfs_sb_needs_repair(struct grub_xfs_data *data) -+{ -+ return ((data->sblock.version & -+ grub_cpu_to_be16_compile_time (XFS_SB_VERSION_NUMBITS)) == -+ grub_cpu_to_be16_compile_time (XFS_SB_VERSION_5) && -+ (data->sblock.sb_features_incompat & -+ grub_cpu_to_be32_compile_time (XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR))); -+} -+ - /* Filetype information as used in inodes. */ - #define FILETYPE_INO_MASK 0170000 - #define FILETYPE_INO_REG 0100000 -@@ -949,6 +961,9 @@ grub_xfs_mount (grub_disk_t disk) - return data; - fail: - -+ if (grub_xfs_sb_needs_repair(data)) -+ grub_dprintf("xfs", "Filesystem needs repair\n"); -+ - if (grub_errno == GRUB_ERR_OUT_OF_RANGE) - grub_error (GRUB_ERR_BAD_FS, "not an XFS filesystem"); - diff --git a/0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch b/0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch new file mode 100644 index 00000000..4847ef93 --- /dev/null +++ b/0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= +Date: Fri, 11 Jun 2021 12:57:56 +0200 +Subject: [PATCH] 01_menu_auto_hide.in: fix a then/than typo +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Jan Pokorný +--- + util/grub.d/10_reset_boot_success.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in +index 737e1ae5b68..e73f4137b36 100644 +--- a/util/grub.d/10_reset_boot_success.in ++++ b/util/grub.d/10_reset_boot_success.in +@@ -15,7 +15,7 @@ fi + # Reset boot_indeterminate after a successful boot + if [ "\${boot_success}" = "1" ] ; then + set boot_indeterminate=0 +-# Avoid boot_indeterminate causing the menu to be hidden more then once ++# Avoid boot_indeterminate causing the menu to be hidden more than once + elif [ "\${boot_indeterminate}" = "1" ]; then + set boot_indeterminate=2 + fi diff --git a/0204-Fix-disabling-grub-rpm-sort.patch b/0204-Fix-disabling-grub-rpm-sort.patch new file mode 100644 index 00000000..dccde3c4 --- /dev/null +++ b/0204-Fix-disabling-grub-rpm-sort.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tim Landscheidt +Date: Fri, 11 Jun 2021 13:02:37 +0200 +Subject: [PATCH] Fix disabling grub-rpm-sort + +Currently, grub-rpm-sort is unconditionally compiled whether +./configure has been called with --disable-rpm-sort or not. This adds +the necessary logic to configure.ac and Makefile.util.def and some +debug output to ./configure and fixes #44. +--- + configure.ac | 8 ++++++++ + Makefile.util.def | 1 + + 2 files changed, 9 insertions(+) + +diff --git a/configure.ac b/configure.ac +index d5d2a28b4ef..c7842ec29d8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1936,6 +1936,8 @@ AC_ARG_ENABLE([rpm-sort], + [enable native rpm sorting of kernels in grub (default=guessed)])]) + if test x"$enable_rpm_sort" = xno ; then + rpm_sort_excuse="explicitly disabled" ++else ++ enable_rpm_sort=yes + fi + + if test x"$rpm_sort_excuse" = x ; then +@@ -2200,6 +2202,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) + AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) + AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) + AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) ++AM_CONDITIONAL([COND_GRUB_RPM_SORT], [test x$enable_rpm_sort = xyes]) + AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) + if test x$FONT_SOURCE != x ; then + HAVE_FONT_SOURCE=1 +@@ -2328,6 +2331,11 @@ echo grub-mount: Yes + else + echo grub-mount: No "($grub_mount_excuse)" + fi ++if [ x"$rpm_sort_excuse" = x ]; then ++echo grub-rpm-sort: Yes ++else ++echo grub-rpm-sort: No "($rpm_sort_excuse)" ++fi + if [ x"$starfield_excuse" = x ]; then + echo starfield theme: Yes + echo With DejaVuSans font from $DJVU_FONT_SOURCE +diff --git a/Makefile.util.def b/Makefile.util.def +index 8cfbe69a76e..3f191aa8095 100644 +--- a/Makefile.util.def ++++ b/Makefile.util.def +@@ -774,6 +774,7 @@ program = { + ldadd = libgrubkern.a; + ldadd = grub-core/lib/gnulib/libgnu.a; + ldadd = '$(LIBDEVMAPPER) $(LIBRPM)'; ++ condition = COND_GRUB_RPM_SORT; + }; + + script = { diff --git a/0205-Don-t-check-for-rpmvercmp-in-librpm.patch b/0205-Don-t-check-for-rpmvercmp-in-librpm.patch new file mode 100644 index 00000000..c21dca47 --- /dev/null +++ b/0205-Don-t-check-for-rpmvercmp-in-librpm.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Fri, 11 Jun 2021 13:13:27 +0200 +Subject: [PATCH] Don't check for rpmvercmp in librpm + +The rpmvercmp() function was moved from librpm to librpmio. The configure +option had some logic to first check if the symbol is in librpm and then +librpmio if this check didn't succeed. + +But the logic wasn't working and rpm sorting was always disabled. Instead +of trying to fix this logic, let's just remove since the function already +moved and there's no need to check librpm anymore. Now it's enabled again: + + GRUB2 will be compiled with following components: + ... + grub-rpm-sort: Yes + ... + +Signed-off-by: Javier Martinez Canillas +--- + configure.ac | 19 +++++-------------- + 1 file changed, 5 insertions(+), 14 deletions(-) + +diff --git a/configure.ac b/configure.ac +index c7842ec29d8..3c808a72230 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1947,24 +1947,15 @@ if test x"$rpm_sort_excuse" = x ; then + fi + + if test x"$rpm_sort_excuse" = x ; then +- # Check for rpm library. +- AC_CHECK_LIB([rpm], [rpmvercmp], [], +- [rpm_sort_excuse="rpmlib missing rpmvercmp"]) +-fi +- +-if test x"$rpm_sort_excuse" = x ; then +- LIBRPM="-lrpm"; +- AC_DEFINE([HAVE_RPM], [1], +- [Define to 1 if you have the rpm library.]) +-fi +- +-if test x"$LIBRPM" = x ; then +- # Check for rpm library. ++ # Check for rpmio library. + AC_CHECK_LIB([rpmio], [rpmvercmp], [], + [rpm_sort_excuse="rpmio missing rpmvercmp"]) ++fi ++ ++if test x"$rpm_sort_excuse" = x ; then + LIBRPM="-lrpmio"; + AC_DEFINE([HAVE_RPMIO], [1], +- [Define to 1 if you have the rpm library.]) ++ [Define to 1 if you have the rpmio library.]) + fi + + AC_SUBST([LIBRPM]) diff --git a/0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch new file mode 100644 index 00000000..e48f1021 --- /dev/null +++ b/0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch @@ -0,0 +1,136 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Fri, 11 Jun 2021 13:51:20 +0200 +Subject: [PATCH] Allow chainloading EFI apps from loop mounts. + +--- + grub-core/disk/loopback.c | 9 +-------- + grub-core/loader/efi/chainloader.c | 23 +++++++++++++++++++++++ + include/grub/loopback.h | 30 ++++++++++++++++++++++++++++++ + 3 files changed, 54 insertions(+), 8 deletions(-) + create mode 100644 include/grub/loopback.h + +diff --git a/grub-core/disk/loopback.c b/grub-core/disk/loopback.c +index 41bebd14fe3..99f47924ec2 100644 +--- a/grub-core/disk/loopback.c ++++ b/grub-core/disk/loopback.c +@@ -21,20 +21,13 @@ + #include + #include + #include ++#include + #include + #include + #include + + GRUB_MOD_LICENSE ("GPLv3+"); + +-struct grub_loopback +-{ +- char *devname; +- grub_file_t file; +- struct grub_loopback *next; +- unsigned long id; +-}; +- + static struct grub_loopback *loopback_list; + static unsigned long last_id = 0; + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index d41e8ea14a8..3af6b122926 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -901,6 +902,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_efi_status_t status; + grub_efi_boot_services_t *b; + grub_device_t dev = 0; ++ grub_device_t orig_dev = 0; + grub_efi_device_path_t *dp = 0; + char *filename; + void *boot_image = 0; +@@ -958,6 +960,15 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + if (! dev) + goto fail; + ++ /* if device is loopback, use underlying dev */ ++ if (dev->disk->dev->id == GRUB_DISK_DEVICE_LOOPBACK_ID) ++ { ++ struct grub_loopback *d; ++ orig_dev = dev; ++ d = dev->disk->data; ++ dev = d->file->device; ++ } ++ + if (dev->disk) + dev_handle = grub_efidisk_get_device_handle (dev->disk); + else if (dev->net && dev->net->server) +@@ -1065,6 +1076,12 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + } + #endif + ++ if (orig_dev) ++ { ++ dev = orig_dev; ++ orig_dev = 0; ++ } ++ + rc = grub_linuxefi_secure_validate((void *)(unsigned long)address, fsize); + grub_dprintf ("chain", "linuxefi_secure_validate: %d\n", rc); + if (rc > 0) +@@ -1087,6 +1104,12 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + // -1 fall-through to fail + + fail: ++ if (orig_dev) ++ { ++ dev = orig_dev; ++ orig_dev = 0; ++ } ++ + if (dev) + grub_device_close (dev); + +diff --git a/include/grub/loopback.h b/include/grub/loopback.h +new file mode 100644 +index 00000000000..3b9a9e32e80 +--- /dev/null ++++ b/include/grub/loopback.h +@@ -0,0 +1,30 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2019 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#ifndef GRUB_LOOPBACK_HEADER ++#define GRUB_LOOPBACK_HEADER 1 ++ ++struct grub_loopback ++{ ++ char *devname; ++ grub_file_t file; ++ struct grub_loopback *next; ++ unsigned long id; ++}; ++ ++#endif /* ! GRUB_LOOPBACK_HEADER */ diff --git a/0207-efinet-Add-DHCP-proxy-support.patch b/0207-efinet-Add-DHCP-proxy-support.patch new file mode 100644 index 00000000..a8755a39 --- /dev/null +++ b/0207-efinet-Add-DHCP-proxy-support.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ian Page Hands +Date: Tue, 8 Jun 2021 13:48:56 -0400 +Subject: [PATCH] efinet: Add DHCP proxy support + +If a proxyDHCP configuration is used, the server name, server IP and boot +file values should be taken from the DHCP proxy offer instead of the DHCP +server ack packet. Currently that case is not handled, add support for it. +--- + grub-core/net/drivers/efi/efinet.c | 25 +++++++++++++++++++++++-- + 1 file changed, 23 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index e11d759f19a..1a24f38a21a 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -850,10 +850,31 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + else + { + grub_dprintf ("efinet", "using ipv4 and dhcp\n"); ++ ++ struct grub_net_bootp_packet *dhcp_ack = &pxe_mode->dhcp_ack; ++ ++ if (pxe_mode->proxy_offer_received) ++ { ++ grub_dprintf ("efinet", "proxy offer receive"); ++ struct grub_net_bootp_packet *proxy_offer = &pxe_mode->proxy_offer; ++ ++ if (proxy_offer && dhcp_ack->boot_file[0] == '\0') ++ { ++ grub_dprintf ("efinet", "setting values from proxy offer"); ++ /* Here we got a proxy offer and the dhcp_ack has a nil boot_file ++ * Copy the proxy DHCP offer details into the bootp_packet we are ++ * sending forward as they are the deatils we need. ++ */ ++ *dhcp_ack->server_name = *proxy_offer->server_name; ++ *dhcp_ack->boot_file = *proxy_offer->boot_file; ++ dhcp_ack->server_ip = proxy_offer->server_ip; ++ } ++ } ++ + grub_net_configure_by_dhcp_ack (card->name, card, 0, + (struct grub_net_bootp_packet *) +- packet_buf, +- packet_bufsz, ++ &pxe_mode->dhcp_ack, ++ sizeof (pxe_mode->dhcp_ack), + 1, device, path); + grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); + } diff --git a/0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch new file mode 100644 index 00000000..b4a5fd4d --- /dev/null +++ b/0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Fri, 11 Jun 2021 00:01:29 +0200 +Subject: [PATCH] fs/ext2: Ignore checksum seed incompat feature + +This incompat feature is used to denote that the filesystem stored its +metadata checksum seed in the superblock. This is used to allow tune2fs +to change the UUID on a mounted metadata_csum filesystem without having +to rewrite all the disk metadata. + +But GRUB doesn't use the metadata checksum in anyway, so can just ignore +this feature if is enabled. This is consistent with GRUB filesystem code +in general which just does a best effort to access the filesystem's data. + +It may be removed from the ignored list in the future if supports to do +metadata checksumming verification is added to the read-only FS driver. + +Suggested-by: Eric Sandeen +Suggested-by: Lukas Czerner +Signed-off-by: Javier Martinez Canillas +--- + grub-core/fs/ext2.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index e7dd78e6635..731d346f886 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -103,6 +103,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 + #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 + #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 ++#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000 + #define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000 + + /* The set of back-incompatible features this driver DOES support. Add (OR) +@@ -123,9 +124,16 @@ GRUB_MOD_LICENSE ("GPLv3+"); + * mmp: Not really back-incompatible - was added as such to + * avoid multiple read-write mounts. Safe to ignore for this + * RO driver. ++ * checksum seed: Not really back-incompatible - was added to allow tools ++ * such as tune2fs to change the UUID on a mounted metadata ++ * checksummed filesystem. Safe to ignore for now since the ++ * driver doesn't support checksum verification. But it must ++ * be removed from this list if that support is added later. ++ * + */ + #define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \ +- | EXT4_FEATURE_INCOMPAT_MMP) ++ | EXT4_FEATURE_INCOMPAT_MMP \ ++ | EXT4_FEATURE_INCOMPAT_CSUM_SEED) + + + #define EXT3_JOURNAL_MAGIC_NUMBER 0xc03b3998U diff --git a/grub.patches b/grub.patches index cd6807c8..df709d62 100644 --- a/grub.patches +++ b/grub.patches @@ -1,202 +1,208 @@ -Patch0001: 0001-Add-support-for-Linux-EFI-stub-loading.patch -Patch0002: 0002-Rework-linux-command.patch -Patch0003: 0003-Rework-linux16-command.patch -Patch0004: 0004-Add-secureboot-support-on-efi-chainloader.patch -Patch0005: 0005-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch -Patch0006: 0006-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch -Patch0007: 0007-re-write-.gitignore.patch -Patch0008: 0008-IBM-client-architecture-CAS-reboot-support.patch -Patch0009: 0009-for-ppc-reset-console-display-attr-when-clear-screen.patch -Patch0010: 0010-Disable-GRUB-video-support-for-IBM-power-machines.patch -Patch0011: 0011-Move-bash-completion-script-922997.patch -Patch0012: 0012-Allow-fallback-to-include-entries-by-title-not-just-.patch -Patch0013: 0013-Make-exit-take-a-return-code.patch -Patch0014: 0014-Make-efi-machines-load-an-env-block-from-a-variable.patch -Patch0015: 0015-Migrate-PPC-from-Yaboot-to-Grub2.patch -Patch0016: 0016-Add-fw_path-variable-revised.patch -Patch0017: 0017-Pass-x-hex-hex-straight-through-unmolested.patch -Patch0018: 0018-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch -Patch0019: 0019-Add-devicetree-loading.patch -Patch0020: 0020-Don-t-write-messages-to-the-screen.patch -Patch0021: 0021-Don-t-print-GNU-GRUB-header.patch -Patch0022: 0022-Don-t-add-to-highlighted-row.patch -Patch0023: 0023-Message-string-cleanups.patch -Patch0024: 0024-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch -Patch0025: 0025-Use-the-correct-indentation-for-the-term-help-text.patch -Patch0026: 0026-Indent-menu-entries.patch -Patch0027: 0027-Fix-margins.patch -Patch0028: 0028-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch -Patch0029: 0029-Enable-pager-by-default.-985860.patch -Patch0030: 0030-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch -Patch0031: 0031-Don-t-say-GNU-Linux-in-generated-menus.patch -Patch0032: 0032-Don-t-draw-a-border-around-the-menu.patch -Patch0033: 0033-Use-the-standard-margin-for-the-timeout-string.patch -Patch0034: 0034-Add-.eh_frame-to-list-of-relocations-stripped.patch -Patch0035: 0035-Don-t-require-a-password-to-boot-entries-generated-b.patch -Patch0036: 0036-Don-t-emit-Booting-.-message.patch -Patch0037: 0037-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch -Patch0038: 0038-use-fw_path-prefix-when-fallback-searching-for-grub-.patch -Patch0039: 0039-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch -Patch0040: 0040-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch -Patch0041: 0041-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch -Patch0042: 0042-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0043: 0043-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch -Patch0044: 0044-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0045: 0045-Add-friendly-grub2-password-config-tool-985962.patch -Patch0046: 0046-tcp-add-window-scaling-support.patch -Patch0047: 0047-efinet-and-bootp-add-support-for-dhcpv6.patch -Patch0048: 0048-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0049: 0049-bz1374141-fix-incorrect-mask-for-ppc64.patch -Patch0050: 0050-Make-grub_fatal-also-backtrace.patch -Patch0051: 0051-Fix-up-some-man-pages-rpmdiff-noticed.patch -Patch0052: 0052-Make-our-info-pages-say-grub2-where-appropriate.patch -Patch0053: 0053-macos-just-build-chainloader-entries-don-t-try-any-x.patch -Patch0054: 0054-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch -Patch0055: 0055-export-btrfs_subvol-and-btrfs_subvolid.patch -Patch0056: 0056-grub2-btrfs-03-follow_default.patch -Patch0057: 0057-grub2-btrfs-04-grub2-install.patch -Patch0058: 0058-grub2-btrfs-05-grub2-mkconfig.patch -Patch0059: 0059-grub2-btrfs-06-subvol-mount.patch -Patch0060: 0060-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch -Patch0061: 0061-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch -Patch0062: 0062-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch -Patch0063: 0063-Use-grub_efi_.-memory-helpers-where-reasonable.patch -Patch0064: 0064-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch -Patch0065: 0065-don-t-use-int-for-efi-status.patch -Patch0066: 0066-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch -Patch0067: 0067-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch -Patch0068: 0068-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch -Patch0069: 0069-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch -Patch0070: 0070-align-struct-efi_variable-better.patch -Patch0071: 0071-Add-BLS-support-to-grub-mkconfig.patch -Patch0072: 0072-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0073: 0073-Add-linux-and-initrd-commands-for-grub-emu.patch -Patch0074: 0074-Add-grub2-switch-to-blscfg.patch -Patch0075: 0075-make-better-backtraces.patch -Patch0076: 0076-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0077: 0077-Work-around-some-minor-include-path-weirdnesses.patch -Patch0078: 0078-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0079: 0079-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0080: 0080-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch -Patch0081: 0081-Fixup-for-newer-compiler.patch -Patch0082: 0082-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0083: 0083-Fixup-for-newer-compiler.patch -Patch0084: 0084-Add-support-for-non-Ethernet-network-cards.patch -Patch0085: 0085-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0086: 0086-bootp-New-net_bootp6-command.patch -Patch0087: 0087-efinet-UEFI-IPv6-PXE-support.patch -Patch0088: 0088-grub.texi-Add-net_bootp6-doument.patch -Patch0089: 0089-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0090: 0090-efinet-Setting-network-from-UEFI-device-path.patch -Patch0091: 0091-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0092: 0092-Support-UEFI-networking-protocols.patch -Patch0093: 0093-AUDIT-0-http-boot-tracker-bug.patch -Patch0094: 0094-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0095: 0095-Add-auto-hide-menu-support.patch -Patch0096: 0096-Add-grub-set-bootflag-utility.patch -Patch0097: 0097-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0098: 0098-gentpl-add-disable-support.patch -Patch0099: 0099-gentpl-add-pc-firmware-type.patch -Patch0100: 0100-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0101: 0101-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0102: 0102-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0103: 0103-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0104: 0104-Rework-how-the-fdt-command-builds.patch -Patch0105: 0105-Disable-non-wordsize-allocations-on-arm.patch -Patch0106: 0106-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0107: 0107-Make-grub_error-more-verbose.patch -Patch0108: 0108-Make-reset-an-alias-for-the-reboot-command.patch -Patch0109: 0109-Add-a-version-command.patch -Patch0110: 0110-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0111: 0111-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0112: 0112-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0113: 0113-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0114: 0114-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0115: 0115-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0116: 0116-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0117: 0117-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0118: 0118-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0119: 0119-Fix-getroot.c-s-trampolines.patch -Patch0120: 0120-Do-not-allow-stack-trampolines-anywhere.patch -Patch0121: 0121-Reimplement-boot_counter.patch -Patch0122: 0122-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0123: 0123-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0124: 0124-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0125: 0125-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0126: 0126-Export-all-variables-from-the-initial-context-when-c.patch -Patch0127: 0127-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0128: 0128-Fix-systemctl-kexec-exit-status-check.patch -Patch0129: 0129-Print-grub-emu-linux-loader-messages-as-debug.patch -Patch0130: 0130-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0131: 0131-Fix-undefined-references-for-fdt-when-building-with-.patch -Patch0132: 0132-Do-better-in-bootstrap.conf.patch -Patch0133: 0133-Use-git-to-apply-gnulib-patches.patch -Patch0134: 0134-Fix-build-error-with-the-fdt-module-on-risc-v.patch -Patch0135: 0135-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0136: 0136-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0137: 0137-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0138: 0138-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch -Patch0139: 0139-chainloader-Define-machine-types-for-RISC-V.patch -Patch0140: 0140-Add-start-symbol-for-RISC-V.patch -Patch0141: 0141-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0142: 0142-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0143: 0143-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0144: 0144-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0145: 0145-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0146: 0146-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0147: 0147-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0148: 0148-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0149: 0149-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0150: 0150-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0151: 0151-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0152: 0152-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0153: 0153-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0154: 0154-efi-http-fix-some-allocation-error-checking.patch -Patch0155: 0155-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0156: 0156-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0157: 0157-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0158: 0158-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0159: 0159-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0160: 0160-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0161: 0161-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0162: 0162-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0163: 0163-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0164: 0164-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0165: 0165-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0166: 0166-grub-install-disable-support-for-EFI-platforms.patch -Patch0167: 0167-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0168: 0168-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0169: 0169-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0170: 0170-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0171: 0171-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0172: 0172-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0173: 0173-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0174: 0174-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0175: 0175-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0176: 0176-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0177: 0177-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0178: 0178-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0179: 0179-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0180: 0180-pgp-factor-out-rsa_pad.patch -Patch0181: 0181-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0182: 0182-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0183: 0183-libtasn1-import-libtasn1-4.16.0.patch -Patch0184: 0184-libtasn1-disable-code-not-needed-in-grub.patch -Patch0185: 0185-libtasn1-changes-for-grub-compatibility.patch -Patch0186: 0186-libtasn1-compile-into-asn1-module.patch -Patch0187: 0187-test_asn1-test-module-for-libtasn1.patch -Patch0188: 0188-grub-install-support-embedding-x509-certificates.patch -Patch0189: 0189-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0190: 0190-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0191: 0191-appended-signatures-support-verifying-appended-signa.patch -Patch0192: 0192-appended-signatures-verification-tests.patch -Patch0193: 0193-appended-signatures-documentation.patch -Patch0194: 0194-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0195: 0195-Revert-templates-Properly-disable-the-os-prober-by-d.patch -Patch0196: 0196-Revert-templates-Disable-the-os-prober-by-default.patch -Patch0197: 0197-fs-xfs-Add-bigtime-support-for-xfs-driver.patch -Patch0198: 0198-fs-Use-64bit-type-for-filesystem-timestamp.patch -Patch0199: 0199-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0200: 0200-ieee1275-claim-more-memory.patch -Patch0201: 0201-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0202: 0202-xfs-Include-needsrepair-in-the-supported-incompat-fe.patch +Patch0001: 0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch +Patch0002: 0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch +Patch0003: 0003-Revert-templates-Disable-the-os-prober-by-default.patch +Patch0004: 0004-Add-support-for-Linux-EFI-stub-loading.patch +Patch0005: 0005-Rework-linux-command.patch +Patch0006: 0006-Rework-linux16-command.patch +Patch0007: 0007-Add-secureboot-support-on-efi-chainloader.patch +Patch0008: 0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +Patch0009: 0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +Patch0010: 0010-re-write-.gitignore.patch +Patch0011: 0011-IBM-client-architecture-CAS-reboot-support.patch +Patch0012: 0012-for-ppc-reset-console-display-attr-when-clear-screen.patch +Patch0013: 0013-Disable-GRUB-video-support-for-IBM-power-machines.patch +Patch0014: 0014-Move-bash-completion-script-922997.patch +Patch0015: 0015-Allow-fallback-to-include-entries-by-title-not-just-.patch +Patch0016: 0016-Make-exit-take-a-return-code.patch +Patch0017: 0017-Make-efi-machines-load-an-env-block-from-a-variable.patch +Patch0018: 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch +Patch0019: 0019-Add-fw_path-variable-revised.patch +Patch0020: 0020-Pass-x-hex-hex-straight-through-unmolested.patch +Patch0021: 0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +Patch0022: 0022-Add-devicetree-loading.patch +Patch0023: 0023-Don-t-write-messages-to-the-screen.patch +Patch0024: 0024-Don-t-print-GNU-GRUB-header.patch +Patch0025: 0025-Don-t-add-to-highlighted-row.patch +Patch0026: 0026-Message-string-cleanups.patch +Patch0027: 0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch +Patch0028: 0028-Use-the-correct-indentation-for-the-term-help-text.patch +Patch0029: 0029-Indent-menu-entries.patch +Patch0030: 0030-Fix-margins.patch +Patch0031: 0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch +Patch0032: 0032-Enable-pager-by-default.-985860.patch +Patch0033: 0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch +Patch0034: 0034-Don-t-say-GNU-Linux-in-generated-menus.patch +Patch0035: 0035-Don-t-draw-a-border-around-the-menu.patch +Patch0036: 0036-Use-the-standard-margin-for-the-timeout-string.patch +Patch0037: 0037-Add-.eh_frame-to-list-of-relocations-stripped.patch +Patch0038: 0038-Don-t-require-a-password-to-boot-entries-generated-b.patch +Patch0039: 0039-Don-t-emit-Booting-.-message.patch +Patch0040: 0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +Patch0041: 0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +Patch0042: 0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +Patch0043: 0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +Patch0044: 0044-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +Patch0045: 0045-Try-prefix-if-fw_path-doesn-t-work.patch +Patch0046: 0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +Patch0047: 0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0048: 0048-Add-friendly-grub2-password-config-tool-985962.patch +Patch0049: 0049-tcp-add-window-scaling-support.patch +Patch0050: 0050-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0051: 0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0052: 0052-bz1374141-fix-incorrect-mask-for-ppc64.patch +Patch0053: 0053-Make-grub_fatal-also-backtrace.patch +Patch0054: 0054-Fix-up-some-man-pages-rpmdiff-noticed.patch +Patch0055: 0055-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0056: 0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0057: 0057-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0058: 0058-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0059: 0059-grub2-btrfs-03-follow_default.patch +Patch0060: 0060-grub2-btrfs-04-grub2-install.patch +Patch0061: 0061-grub2-btrfs-05-grub2-mkconfig.patch +Patch0062: 0062-grub2-btrfs-06-subvol-mount.patch +Patch0063: 0063-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0064: 0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0065: 0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0066: 0066-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0067: 0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0068: 0068-don-t-use-int-for-efi-status.patch +Patch0069: 0069-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0070: 0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +Patch0071: 0071-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +Patch0072: 0072-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +Patch0073: 0073-align-struct-efi_variable-better.patch +Patch0074: 0074-Add-BLS-support-to-grub-mkconfig.patch +Patch0075: 0075-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +Patch0076: 0076-Add-linux-and-initrd-commands-for-grub-emu.patch +Patch0077: 0077-Add-grub2-switch-to-blscfg.patch +Patch0078: 0078-make-better-backtraces.patch +Patch0079: 0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0080: 0080-Work-around-some-minor-include-path-weirdnesses.patch +Patch0081: 0081-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0082: 0082-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0083: 0083-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0084: 0084-Fixup-for-newer-compiler.patch +Patch0085: 0085-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +Patch0086: 0086-Fixup-for-newer-compiler.patch +Patch0087: 0087-Add-support-for-non-Ethernet-network-cards.patch +Patch0088: 0088-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0089: 0089-bootp-New-net_bootp6-command.patch +Patch0090: 0090-efinet-UEFI-IPv6-PXE-support.patch +Patch0091: 0091-grub.texi-Add-net_bootp6-doument.patch +Patch0092: 0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0093: 0093-efinet-Setting-network-from-UEFI-device-path.patch +Patch0094: 0094-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0095: 0095-Support-UEFI-networking-protocols.patch +Patch0096: 0096-AUDIT-0-http-boot-tracker-bug.patch +Patch0097: 0097-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0098: 0098-Add-auto-hide-menu-support.patch +Patch0099: 0099-Add-grub-set-bootflag-utility.patch +Patch0100: 0100-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0101: 0101-gentpl-add-disable-support.patch +Patch0102: 0102-gentpl-add-pc-firmware-type.patch +Patch0103: 0103-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0104: 0104-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0105: 0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0106: 0106-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0107: 0107-Rework-how-the-fdt-command-builds.patch +Patch0108: 0108-Disable-non-wordsize-allocations-on-arm.patch +Patch0109: 0109-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0110: 0110-Make-grub_error-more-verbose.patch +Patch0111: 0111-Make-reset-an-alias-for-the-reboot-command.patch +Patch0112: 0112-Add-a-version-command.patch +Patch0113: 0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0114: 0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0115: 0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0116: 0116-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0117: 0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0118: 0118-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0119: 0119-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0120: 0120-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0121: 0121-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0122: 0122-Fix-getroot.c-s-trampolines.patch +Patch0123: 0123-Do-not-allow-stack-trampolines-anywhere.patch +Patch0124: 0124-Reimplement-boot_counter.patch +Patch0125: 0125-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0126: 0126-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0127: 0127-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0128: 0128-Make-it-possible-to-subtract-conditions-from-debug.patch +Patch0129: 0129-Export-all-variables-from-the-initial-context-when-c.patch +Patch0130: 0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0131: 0131-Fix-systemctl-kexec-exit-status-check.patch +Patch0132: 0132-Print-grub-emu-linux-loader-messages-as-debug.patch +Patch0133: 0133-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0134: 0134-Fix-undefined-references-for-fdt-when-building-with-.patch +Patch0135: 0135-Do-better-in-bootstrap.conf.patch +Patch0136: 0136-Use-git-to-apply-gnulib-patches.patch +Patch0137: 0137-Fix-build-error-with-the-fdt-module-on-risc-v.patch +Patch0138: 0138-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0139: 0139-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0140: 0140-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0141: 0141-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch +Patch0142: 0142-chainloader-Define-machine-types-for-RISC-V.patch +Patch0143: 0143-Add-start-symbol-for-RISC-V.patch +Patch0144: 0144-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0145: 0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0146: 0146-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0147: 0147-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0148: 0148-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0149: 0149-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0150: 0150-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0151: 0151-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0152: 0152-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0153: 0153-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0154: 0154-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0155: 0155-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0156: 0156-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0157: 0157-efi-http-fix-some-allocation-error-checking.patch +Patch0158: 0158-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0159: 0159-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0160: 0160-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0161: 0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0162: 0162-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0163: 0163-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0164: 0164-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0165: 0165-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0166: 0166-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0167: 0167-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0168: 0168-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0169: 0169-grub-install-disable-support-for-EFI-platforms.patch +Patch0170: 0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0171: 0171-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0172: 0172-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0173: 0173-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0174: 0174-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0175: 0175-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0176: 0176-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0177: 0177-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0178: 0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0179: 0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0180: 0180-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0181: 0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0182: 0182-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0183: 0183-pgp-factor-out-rsa_pad.patch +Patch0184: 0184-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0185: 0185-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0186: 0186-libtasn1-import-libtasn1-4.16.0.patch +Patch0187: 0187-libtasn1-disable-code-not-needed-in-grub.patch +Patch0188: 0188-libtasn1-changes-for-grub-compatibility.patch +Patch0189: 0189-libtasn1-compile-into-asn1-module.patch +Patch0190: 0190-test_asn1-test-module-for-libtasn1.patch +Patch0191: 0191-grub-install-support-embedding-x509-certificates.patch +Patch0192: 0192-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0193: 0193-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0194: 0194-appended-signatures-support-verifying-appended-signa.patch +Patch0195: 0195-appended-signatures-verification-tests.patch +Patch0196: 0196-appended-signatures-documentation.patch +Patch0197: 0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0198: 0198-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0199: 0199-ieee1275-claim-more-memory.patch +Patch0200: 0200-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0201: 0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0202: 0202-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0203: 0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch +Patch0204: 0204-Fix-disabling-grub-rpm-sort.patch +Patch0205: 0205-Don-t-check-for-rpmvercmp-in-librpm.patch +Patch0206: 0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0207: 0207-efinet-Add-DHCP-proxy-support.patch +Patch0208: 0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/grub2.spec b/grub2.spec index 3ed54551..b590a866 100644 --- a/grub2.spec +++ b/grub2.spec @@ -5,7 +5,7 @@ %undefine _hardened_build -%global tarversion 2.06~rc1 +%global tarversion 2.06 %undefine _missing_build_ids_terminate_build %global _configure_gnuconfig_hack 0 @@ -13,8 +13,8 @@ Name: grub2 Epoch: 1 -Version: 2.06~rc1 -Release: 7%{?dist} +Version: 2.06 +Release: 1%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Jun 14 2021 Javier Martinez Canillas - 2.06-1 +- Update to 2.06 final release and ton of fixes + * Mon May 03 2021 Javier Martinez Canillas - 2.06~rc1-7 - Add XFS needsrepair support diff --git a/sources b/sources index 5251e5d9..43b7cac3 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ SHA512 (unifont-5.1.20080820.pcf.gz) = 8939e2bc82ca97b60e6678f3ff079a2be7ba9b702f2e8ee289e853af5823695f7baafbf14b674fc5e41071f2a6de4f2dadd56bf8b4653849dd756d59622f1649 SHA512 (theme.tar.bz2) = 0f6f914d5f801509403094b28b8cfe5169cb56ae9bdd808ae21a6780a8236b434161a068351508dd78729c25ee2fed066c124c1eef9e15102750b409b4576a5c -SHA512 (grub-2.06~rc1.tar.xz) = 093890b0af71b0d346afb415dec106681fd9e3f2f5bda14093c060b861d55ee1b50c8fb24afd072d24968ebebedde290f8220b0374cbd2b2e4508dfb00924122 +SHA512 (grub-2.06.tar.xz) = 4f11c648f3078567e53fc0c74d5026fdc6da4be27d188975e79d9a4df817ade0fe5ad2ddd694238a07edc45adfa02943d83c57767dd51548102b375e529e8efe SHA512 (gnulib-fixes.tar.gz) = 7aa933812de10f54196c7ed02079d7edeb92672a528baf83201ca4c62aa3e6b119f61c45469d2c4623c4efc5d4a08d20b029403f1f2c6e35fb7cb15789ff54b2 From 345905806250aeb5e4b6437c90033f5578b84062 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 15 Jun 2021 15:50:14 +0200 Subject: [PATCH 069/294] Only try to generate a config if the ESP is mounted The posttran scriptlet attempts to generate a GRUB configuration if there isn't one in the EFI System Partition. But this leads to a failure if the grub2 package is installed in a container. To avoid this issue, only attempt to generate a GRUB config if the ESP is mounted in /boot/efi. Signed-off-by: Javier Martinez Canillas --- grub2.spec | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/grub2.spec b/grub2.spec index b590a866..3b167dba 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -81,6 +81,7 @@ hardware devices.\ Summary: grub2 common layout BuildArch: noarch Conflicts: grubby < 8.40-18 +Requires(post): util-linux %description common This package provides some directories which are required by various grub2 @@ -352,9 +353,15 @@ set -eu EFI_HOME=%{efi_esp_dir} GRUB_HOME=/boot/grub2 +ESP_PATH=/boot/efi + +if ! mountpoint -q ${ESP_PATH}; then + exit 0 # no ESP mounted, nothing to do +fi if test ! -f ${EFI_HOME}/grub.cfg; then - grub2-mkconfig -o ${EFI_HOME}/grub.cfg + # there's no config in ESP, create one + grub2-mkconfig -o ${EFI_HOME}/grub.cfg fi if grep -q "configfile" ${EFI_HOME}/grub.cfg; then @@ -555,6 +562,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jun 15 2021 Javier Martinez Canillas - 2.06-2 +- Only try to generate a config if the ESP is mounted + * Mon Jun 14 2021 Javier Martinez Canillas - 2.06-1 - Update to 2.06 final release and ton of fixes From 485dd93ff13415ac142430884e4ab28b8d728a2a Mon Sep 17 00:00:00 2001 From: Austin Conatser Date: Thu, 17 Jun 2021 01:24:42 +0000 Subject: [PATCH 070/294] Add luks2 to GRUB_MODULES Enable limited luks2 support for the built images. Argon2 keys. the default used in cryptsetup for luks2, are not yet supported. --- grub.macros | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index 7a1e479d..ff5fee36 100644 --- a/grub.macros +++ b/grub.macros @@ -411,7 +411,7 @@ GRUB_MODULES=" all_video boot blscfg btrfs \\\ gfxmenu gfxterm gzio \\\ halt hfsplus http increment iso9660 jpeg \\\ loadenv loopback linux lvm lsefi lsefimmap luks \\\ - mdraid09 mdraid1x minicmd net \\\ + luks2 mdraid09 mdraid1x minicmd net \\\ normal part_apple part_msdos part_gpt \\\ password_pbkdf2 pgp png reboot \\\ regexp search search_fs_uuid search_fs_file \\\ From a02c397786acbe5450b7d6697fd0f0b1a2fcd586 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 21 Jun 2021 08:08:10 +0200 Subject: [PATCH 071/294] 20-grub-install: Create a symvers.gz symbolic link This is not needed for boot, just a symlink would be enough for tools that expect this file to be present in the boot directory. Signed-off-by: Javier Martinez Canillas --- 20-grub.install | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/20-grub.install b/20-grub.install index 8ae38853..ccc85fbc 100755 --- a/20-grub.install +++ b/20-grub.install @@ -75,6 +75,14 @@ case "$COMMAND" in command -v restorecon &>/dev/null && \ restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" fi + # symvers is symvers-.gz symlink, needs a special treatment + i="$KERNEL_DIR/symvers.gz" + if [[ -e "$i" ]]; then + rm -f "/boot/symvers-${KERNEL_VERSION}.gz" + ln -s "$i" "/boot/symvers-${KERNEL_VERSION}.gz" + command -v restorecon &>/dev/null && \ + restorecon "/boot/symvers-${KERNEL_VERSION}.gz" + fi fi if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then @@ -163,6 +171,8 @@ case "$COMMAND" in done # hmac is .vmlinuz-.hmac so needs a special treatment rm -f "/boot/.vmlinuz-${KERNEL_VERSION}.hmac" + # symvers is symvers-.gz symlink, needs a special treatment + rm -f "/boot/symvers-${KERNEL_VERSION}.gz" exit 0 fi From fc19d7847d35b0d096449f337eac361d811c21c2 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 29 Jun 2021 15:31:16 +0200 Subject: [PATCH 072/294] 20-grub-install: Always use fedora as the boot entry --class This is only used by themes and these assume that boot entries for Fedora will be named "fedora". Currently we are using "kernel" that's not useful. Resolves: rhbz#1957014 Signed-off-by: Javier Martinez Canillas --- 20-grub.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/20-grub.install b/20-grub.install index ccc85fbc..436360d8 100755 --- a/20-grub.install +++ b/20-grub.install @@ -46,7 +46,7 @@ initrd /initramfs-${kernelver}.img options ${kernelopts} grub_users \$grub_users grub_arg --unrestricted -grub_class kernel${flavor} +grub_class ${ID} EOF } From 9cf30d96e9d4c8895ec7f2b119dea020edb89527 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 29 Jun 2021 15:43:43 +0200 Subject: [PATCH 073/294] grub.macros: Install font in /boot/grub2 instead of the ESP GRUB is now using /boot/grub2 as the directory where all the resources are loaded, but the unicode.pf2 is still installed in the EFI System Partition. Resolves: rhbz#1739762 Signed-off-by: Javier Martinez Canillas --- grub.macros | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub.macros b/grub.macros index ff5fee36..d35c4e77 100644 --- a/grub.macros +++ b/grub.macros @@ -517,7 +517,7 @@ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ %endif \ install -D -m 700 unicode.pf2 \\\ - $RPM_BUILD_ROOT%{efi_esp_dir}/fonts/unicode.pf2 \ + ${RPM_BUILD_ROOT}/boot/%{name}/fonts/unicode.pf2 \ ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ ${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \ %{expand:%%do_install_protected_file %{name}-%{package_arch}} \ @@ -615,7 +615,7 @@ ln -s ../boot/%{name}/grub.cfg \\\ %ifarch %{arm} \ %attr(0700,root,root)%{efi_esp_boot}/BOOTARM.EFI \ %endif \ -%dir %attr(0700,root,root)%{efi_esp_dir}/fonts \ +%attr(0700,root,root)/boot/%{name}/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) /boot/%{name}/grub.cfg \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ @@ -637,5 +637,5 @@ ln -s ../boot/%{name}/grub.cfg \\\ %{expand:%%files %{1}-cdboot} \ %defattr(0700,root,root,-) \ %attr(0700,root,root)%{efi_esp_dir}/%{3} \ -%attr(0700,root,root)%{efi_esp_dir}/fonts \ +%attr(0700,root,root)/boot/%{name}/fonts \ %{nil} From 504ecff2edd84132223d4116a78453c2dce8b368 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 29 Jun 2021 16:07:43 +0200 Subject: [PATCH 074/294] grub.macros: Use consistent file mode for legacy and EFI Currently the permissions are inconsistent for grub2-pc and grub2-efi: $ rpm -qlvf --filesbypkg /boot/grub2/grub.cfg ... grub2-efi-x64 /boot/grub2/grub.cfg -rwx------ 1 root root grub2-pc /boot/grub2/grub.cfg -rw-r--r-- 1 root root Resolves: rhbz#1965794 Signed-off-by: Javier Martinez Canillas --- grub.macros | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub.macros b/grub.macros index d35c4e77..dee5db64 100644 --- a/grub.macros +++ b/grub.macros @@ -608,7 +608,7 @@ ln -s ../boot/%{name}/grub.cfg \\\ %define define_efi_variant_files() \ %{expand:%%files %{1}} \ -%defattr(0700,root,root,-) \ +%defattr(-,root,root,-) \ %config(noreplace) %{_sysconfdir}/%{name}.cfg \ %config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \ %attr(0700,root,root)%{efi_esp_dir}/%{2} \ @@ -635,7 +635,7 @@ ln -s ../boot/%{name}/grub.cfg \\\ %endif} \ \ %{expand:%%files %{1}-cdboot} \ -%defattr(0700,root,root,-) \ +%defattr(-,root,root,-) \ %attr(0700,root,root)%{efi_esp_dir}/%{3} \ %attr(0700,root,root)/boot/%{name}/fonts \ %{nil} From 8efaf82828a09322fd30a78823245e2afa7531a2 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 29 Jun 2021 18:18:51 +0200 Subject: [PATCH 075/294] Drop grub2 prelink configuration A /etc/prelink.conf.d/grub2.conf is shipped to avoid SELinux to warn about security violations when SELinux is enforced and allow_execstack is off. But the tools have been fixed a long time ago and the allow list shouldn't be needed anymore, let's just drop it. Resolves: rhbz#1659675 Signed-off-by: Javier Martinez Canillas --- grub2.spec | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/grub2.spec b/grub2.spec index 3b167dba..b47de5bc 100644 --- a/grub2.spec +++ b/grub2.spec @@ -241,19 +241,6 @@ rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/%{name}-macbless %find_lang grub -# Make selinux happy with exec stack binaries. -mkdir ${RPM_BUILD_ROOT}%{_sysconfdir}/prelink.conf.d/ -cat << EOF > ${RPM_BUILD_ROOT}%{_sysconfdir}/prelink.conf.d/grub2.conf -# these have execstack, and break under selinux --b /usr/bin/grub2-script-check --b /usr/bin/grub2-mkrelpath --b /usr/bin/grub2-mount --b /usr/bin/grub2-fstest --b /usr/sbin/grub2-bios-setup --b /usr/sbin/grub2-probe --b /usr/sbin/grub2-sparc64-setup -EOF - # Install kernel-install scripts install -d -m 0755 %{buildroot}%{_prefix}/lib/kernel/install.d/ install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE10} @@ -411,7 +398,6 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %doc docs/font_char_metrics.png %files tools-minimal -%{_sysconfdir}/prelink.conf.d/grub2.conf %{_sbindir}/%{name}-get-kernel-settings %{_sbindir}/%{name}-probe %attr(4755, root, root) %{_sbindir}/%{name}-set-bootflag From 5e2444babec408e4989466cc64122502d4c3a93c Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 30 Jun 2021 09:20:11 +0200 Subject: [PATCH 076/294] Remove triggers needed to upgrade from legacy GRUB The legacy GRUB package (grub2 < 1.99-4) had a %preun scriptlet that did a rm -f /boot/%{name}/*.{mod,img,lst} and caused users who upgraded to grub2 to have an empty /boot/%{name} directory, leading to an unbootable system. To workaround this, a set of %triggerun and %triggerpostun triggers were added that backup and restore the /boot/%{name} directory. But that was an issue in Fedora 16, almost a decade ago. These aren't needed anymore. Signed-off-by: Javier Martinez Canillas --- grub2.spec | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/grub2.spec b/grub2.spec index b47de5bc..c7edc7a9 100644 --- a/grub2.spec +++ b/grub2.spec @@ -310,31 +310,6 @@ elif [ -f /etc/grub.d/01_users ] && \ fi fi -%triggerun -- grub2 < 1:1.99-4 -# grub2 < 1.99-4 removed a number of essential files in postun. To fix upgrades -# from the affected grub2 packages, we first back up the files in triggerun and -# later restore them in triggerpostun. -# https://bugzilla.redhat.com/show_bug.cgi?id=735259 - -# Back up the files before uninstalling old grub2 -mkdir -p /boot/grub2.tmp && -mv -f /boot/grub2/*.mod \ - /boot/grub2/*.img \ - /boot/grub2/*.lst \ - /boot/grub2/device.map \ - /boot/grub2.tmp/ || : - -%triggerpostun -- grub2 < 1:1.99-4 -# ... and restore the files. -test ! -f /boot/grub2/device.map && -test -d /boot/grub2.tmp && -mv -f /boot/grub2.tmp/*.mod \ - /boot/grub2.tmp/*.img \ - /boot/grub2.tmp/*.lst \ - /boot/grub2.tmp/device.map \ - /boot/grub2/ && -rm -r /boot/grub2.tmp/ || : - %posttrans common set -eu From 967c5629ed9fdb4e8572daa78f3bb5ac5e675e77 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 30 Jun 2021 09:20:25 +0200 Subject: [PATCH 077/294] Don't harcode grub2 in the spec file There's a variable for this, use it consistently. Suggested-by: Benjamin Herrenschmidt Signed-off-by: Javier Martinez Canillas --- grub.macros | 18 +++++++++--------- grub2.spec | 28 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/grub.macros b/grub.macros index dee5db64..865ade3c 100644 --- a/grub.macros +++ b/grub.macros @@ -389,7 +389,7 @@ rm -f %{1}.conf \ %{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \ %{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ -%{expand:%%define __pesign_client_cert grub2-signer} \ +%{expand:%%define __pesign_client_cert %{name}-signer} \ %{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \ %{nil} @@ -533,9 +533,9 @@ fi \ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ fi \ -if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \ - mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\ - $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \ +if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \ + mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\ + $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \ fi \ if [ %{3} -eq 0 ]; then \ ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ @@ -554,8 +554,8 @@ fi \ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ fi \ -if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \ - mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\ +if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \ + mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\ $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \ fi \ cd .. \ @@ -572,7 +572,7 @@ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \ cp docs/grub-dev.info \\\ $RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \ install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \ -install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \ +install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \ install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \ @@ -582,7 +582,7 @@ ln -sf ../default/grub \\\ ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ ln -s ../boot/%{name}/grub.cfg \\\ - ${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \ + ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}.cfg \ %{nil} %define define_legacy_variant_files() \ @@ -619,7 +619,7 @@ ln -s ../boot/%{name}/grub.cfg \\\ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) /boot/%{name}/grub.cfg \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ -%config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ +%config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ %exclude %{_libdir}/grub/%{6} \ diff --git a/grub2.spec b/grub2.spec index c7edc7a9..e7f7eea0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -258,7 +258,7 @@ install -d -m 0755 %{buildroot}%{_unitdir}/system-update.target.wants install -d -m 0755 %{buildroot}%{_unitdir}/reboot.target.wants ln -s ../grub-boot-indeterminate.service \ %{buildroot}%{_unitdir}/system-update.target.wants -ln -s ../grub2-systemd-integration.service \ +ln -s ../%{name}-systemd-integration.service \ %{buildroot}%{_unitdir}/reboot.target.wants # Don't run debuginfo on all the grub modules and whatnot; it just @@ -283,9 +283,9 @@ ln -s ../grub2-systemd-integration.service \ %undefine buildsubdir %pre tools -if [ -f /boot/grub2/user.cfg ]; then - if grep -q '^GRUB_PASSWORD=' /boot/grub2/user.cfg ; then - sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/grub2/user.cfg +if [ -f /boot/%{name}/user.cfg ]; then + if grep -q '^GRUB_PASSWORD=' /boot/%{name}/user.cfg ; then + sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/%{name}/user.cfg fi elif [ -f %{efi_esp_dir}/user.cfg ]; then if grep -q '^GRUB_PASSWORD=' %{efi_esp_dir}/user.cfg ; then @@ -301,12 +301,12 @@ elif [ -f /etc/grub.d/01_users ] && \ sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \ > %{efi_esp_dir}/user.cfg fi - if [ -f /boot/grub2/grub.cfg ]; then - install -m 0600 /dev/null /boot/grub2/user.cfg - chmod 0600 /boot/grub2/user.cfg + if [ -f /boot/%{name}/grub.cfg ]; then + install -m 0600 /dev/null /boot/%{name}/user.cfg + chmod 0600 /boot/%{name}/user.cfg grep '^password_pbkdf2 root' /etc/grub.d/01_users | \ sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \ - > /boot/grub2/user.cfg + > /boot/%{name}/user.cfg fi fi @@ -314,7 +314,7 @@ fi set -eu EFI_HOME=%{efi_esp_dir} -GRUB_HOME=/boot/grub2 +GRUB_HOME=/boot/%{name} ESP_PATH=/boot/efi if ! mountpoint -q ${ESP_PATH}; then @@ -331,8 +331,8 @@ if grep -q "configfile" ${EFI_HOME}/grub.cfg; then fi # create a stub grub2 config in EFI -BOOT_UUID=$(grub2-probe --target=fs_uuid ${GRUB_HOME}) -GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME}) +BOOT_UUID=$(%{name}-probe --target=fs_uuid ${GRUB_HOME}) +GRUB_DIR=$(%{name}-mkrelpath ${GRUB_HOME}) cat << EOF > ${EFI_HOME}/grub.cfg.stb search --no-floppy --fs-uuid --set=dev ${BOOT_UUID} @@ -361,11 +361,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %dir /boot/%{name} %dir /boot/%{name}/themes/ %dir /boot/%{name}/themes/system -%attr(0700,root,root) %dir /boot/grub2 -%exclude /boot/grub2/* +%attr(0700,root,root) %dir /boot/%{name} +%exclude /boot/%{name}/* %dir %attr(0700,root,root) %{efi_esp_dir} %exclude %{efi_esp_dir}/* -%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv +%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv %license COPYING %doc THANKS %doc docs/grub.html From 419340f25e1884ef12cb35c64ce1e6b36a7d6961 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 30 Jun 2021 09:51:36 +0200 Subject: [PATCH 078/294] Update to unifont-13.0.06 Resolves: rhbz#1939125 Signed-off-by: Javier Martinez Canillas --- .gitignore | 2 +- grub2.spec | 2 +- sources | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 19364b80..9bde6f1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ grub-*.tar.?z *.rpm clog -/unifont-5.1.20080820.pcf.gz +/unifont-*.pcf.?z /theme.tar.bz2 kojilogs /grub-*/ diff --git a/grub2.spec b/grub2.spec index e7f7eea0..179e8d44 100644 --- a/grub2.spec +++ b/grub2.spec @@ -23,7 +23,7 @@ Source0: https://ftp.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz Source1: grub.macros Source2: gnulib-%{gnulibversion}.tar.gz Source3: 99-grub-mkconfig.install -Source4: http://unifoundry.com/unifont-5.1.20080820.pcf.gz +Source4: http://unifoundry.com/pub/unifont/unifont-13.0.06/font-builds/unifont-13.0.06.pcf.gz Source5: theme.tar.bz2 Source6: gitignore Source7: bootstrap diff --git a/sources b/sources index 43b7cac3..9a24a530 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (unifont-5.1.20080820.pcf.gz) = 8939e2bc82ca97b60e6678f3ff079a2be7ba9b702f2e8ee289e853af5823695f7baafbf14b674fc5e41071f2a6de4f2dadd56bf8b4653849dd756d59622f1649 +SHA512 (unifont-13.0.06.pcf.gz) = 25f1ea4e316cd77b65cf4f60aa10ed054db6df2195be7344216673dee6628ab055ebcdeea186996d931fd1e9e4f519f4a2e4b4544b8a9ad2fe410aadc4eecd2d SHA512 (theme.tar.bz2) = 0f6f914d5f801509403094b28b8cfe5169cb56ae9bdd808ae21a6780a8236b434161a068351508dd78729c25ee2fed066c124c1eef9e15102750b409b4576a5c SHA512 (grub-2.06.tar.xz) = 4f11c648f3078567e53fc0c74d5026fdc6da4be27d188975e79d9a4df817ade0fe5ad2ddd694238a07edc45adfa02943d83c57767dd51548102b375e529e8efe SHA512 (gnulib-fixes.tar.gz) = 7aa933812de10f54196c7ed02079d7edeb92672a528baf83201ca4c62aa3e6b119f61c45469d2c4623c4efc5d4a08d20b029403f1f2c6e35fb7cb15789ff54b2 From fbeda573a9798fda3d18e67cef004df70e412789 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Wed, 30 Jun 2021 11:38:27 +0200 Subject: [PATCH 079/294] 20-grub-install: Use relative paths for btrfs in BLS snippets When SUSE_BTRFS_SNAPSHOT_BOOTING=true is set in /etc/default/grub, paths to kernel and initrd images need to be relative. Since are used along with snapper, configured so the default btrfs subvolume is the current snapshot. Resolves: rhbz#1906191 --- 20-grub.install | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/20-grub.install b/20-grub.install index 436360d8..2a0ac323 100755 --- a/20-grub.install +++ b/20-grub.install @@ -112,7 +112,12 @@ case "$COMMAND" in LINUX="$(grep '^linux[ \t]' "${BLS_TARGET}" | sed -e 's,^linux[ \t]*,,')" INITRD="$(grep '^initrd[ \t]' "${BLS_TARGET}" | sed -e 's,^initrd[ \t]*,,')" - LINUX_RELPATH="$(grub2-mkrelpath /boot${LINUX})" + if [[ "$(grub2-probe --device $(grub2-probe --target=device /) --target=fs)" == "btrfs" && + "${SUSE_BTRFS_SNAPSHOT_BOOTING}" == "true" ]]; then + LINUX_RELPATH="$(grub2-mkrelpath -r /boot${LINUX})" + else + LINUX_RELPATH="$(grub2-mkrelpath /boot${LINUX})" + fi BOOTPREFIX="$(dirname ${LINUX_RELPATH})" ROOTPREFIX="$(dirname "/boot${LINUX}")" From 67f07b7c9e649a7605926e3b2eca2717485f3bc1 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 6 Jul 2021 01:34:01 +0200 Subject: [PATCH 080/294] Another set of fixes for 2.06 - Add luks2 to GRUB_MODULES - 20-grub-install: Create a symvers.gz symbolic link - 20-grub-install: Always use fedora as the boot entry --class Resolves: rhbz#1957014 - grub.macros: Install font in /boot/grub2 instead of the ESP Resolves: rhbz#1739762 - grub.macros: Use consistent file mode for legacy and EFI Resolves: rhbz#1965794 - Drop grub2 prelink configuration Resolves: rhbz#1659675 - Remove triggers needed to upgrade from legacy GRUB - Don't harcode grub2 in the spec file - Update to unifont-13.0.06 Resolves: rhbz#1939125 - 20-grub-install: Use relative paths for btrfs in BLS snippets Resolves: rhbz#1906191 - Don't update the cmdline when generating legacy menuentry commands - Suppress gettext error message Resolves: rhbz#1592124 - grub-boot-success.timer: Only run if not in a container Resolves: rhbz#1914571 - grub-set-password: Always use /boot/grub2/user.cfg as password default Resolves: rhbz#1955294 - Remove outdated URL for BLS document Resolves: rhbz#1926453 - templates: Check for EFI at runtime instead of config generation time Resolves: rhbz#1823864 - efi: Print an error if boot to firmware setup is not supported Resolves: rhbz#1823864 Signed-off-by: Javier Martinez Canillas --- ...-cmdline-when-generating-legacy-menu.patch | 36 ++++++++ 0210-Suppress-gettext-error-message.patch | 33 +++++++ ...s.timer-Only-run-if-not-in-a-contain.patch | 32 +++++++ ...d-Always-use-boot-grub2-user.cfg-as-.patch | 42 +++++++++ ...Remove-outdated-URL-for-BLS-document.patch | 28 ++++++ ...for-EFI-at-runtime-instead-of-config.patch | 63 +++++++++++++ ...or-if-boot-to-firmware-setup-is-not-.patch | 92 +++++++++++++++++++ grub.patches | 7 ++ grub2.spec | 33 ++++++- 9 files changed, 365 insertions(+), 1 deletion(-) create mode 100644 0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch create mode 100644 0210-Suppress-gettext-error-message.patch create mode 100644 0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch create mode 100644 0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch create mode 100644 0213-Remove-outdated-URL-for-BLS-document.patch create mode 100644 0214-templates-Check-for-EFI-at-runtime-instead-of-config.patch create mode 100644 0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch new file mode 100644 index 00000000..c55b7e3c --- /dev/null +++ b/0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 17 Jun 2021 14:31:42 +0200 +Subject: [PATCH] Don't update the cmdline when generating legacy menuentry + commands + +On OPAL ppc64le machines with an old petitboot version that doesn't have +support to parse BLS snippets, the grub2-mkconfig script is executed to +generate menuentry commands from the BLS snippets. + +In this case, the script is executed with the --no-grubenv-update option +that indicates that no side effects should happen when running the script. + +But the options field in the BLS snippets are updated regardless, only do +the update if --no-grubenv-update was not used. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 68adb55d893..c9296154f51 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -261,7 +261,9 @@ if [ -z "\${kernelopts}" ]; then + fi + EOF + +- update_bls_cmdline ++ if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then ++ update_bls_cmdline ++ fi + + if [ "x${BLS_POPULATE_MENU}" = "xtrue" ]; then + populate_menu diff --git a/0210-Suppress-gettext-error-message.patch b/0210-Suppress-gettext-error-message.patch new file mode 100644 index 00000000..c57e7ff4 --- /dev/null +++ b/0210-Suppress-gettext-error-message.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Tue, 29 Jun 2021 13:17:42 +0200 +Subject: [PATCH] Suppress gettext error message + +Colin Watson's patch from comment #11 on the upstream bug: +https://savannah.gnu.org/bugs/?35880#comment11 + +Resolves: rhbz#1592124 + +Signed-off-by: Paulo Flabiano Smorigo +--- + grub-core/gettext/gettext.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c +index 84d520cd494..87a912ac6e5 100644 +--- a/grub-core/gettext/gettext.c ++++ b/grub-core/gettext/gettext.c +@@ -424,6 +424,13 @@ grub_gettext_init_ext (struct grub_gettext_context *ctx, + grub_free (lang); + } + ++ /* If no translations are available, fall back to untranslated text. */ ++ if (err == GRUB_ERR_FILE_NOT_FOUND) ++ { ++ grub_errno = GRUB_ERR_NONE; ++ return 0; ++ } ++ + if (locale[0] == 'e' && locale[1] == 'n' + && (locale[2] == '\0' || locale[2] == '_')) + grub_errno = err = GRUB_ERR_NONE; diff --git a/0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch b/0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch new file mode 100644 index 00000000..61d0f6d9 --- /dev/null +++ b/0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Gena Makhomed +Date: Thu, 1 Jul 2021 01:07:46 +0200 +Subject: [PATCH] grub-boot-success.timer: Only run if not in a container + +The grub-boot-success.timer should be disabled inside a container since it +leads to the following error: + +Jan 09 22:56:38 test sshd[8786]: pam_unix(sshd:session): session opened for user www(uid=1000) by (uid=0) +Jan 09 22:58:39 test systemd[8857]: Starting Mark boot as successful... +Jan 09 22:58:39 test systemd[8857]: grub-boot-success.service: Main process exited, code=exited, status=1/FAILURE +Jan 09 22:58:39 test systemd[8857]: grub-boot-success.service: Failed with result 'exit-code'. +Jan 09 22:58:39 test systemd[8857]: Failed to start Mark boot as successful. +Jan 09 22:58:39 test grub2-set-bootflag[10034]: Error canonicalizing /boot/grub2/grubenv filename: No such file or directory + +Resolves: rhbz#1914571 +--- + docs/grub-boot-success.timer | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer +index 5d8fcba21aa..406f1720056 100644 +--- a/docs/grub-boot-success.timer ++++ b/docs/grub-boot-success.timer +@@ -1,6 +1,7 @@ + [Unit] + Description=Mark boot as successful after the user session has run 2 minutes + ConditionUser=!@system ++ConditionVirtualization=!container + + [Timer] + OnActiveSec=2min diff --git a/0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch new file mode 100644 index 00000000..7ecea22d --- /dev/null +++ b/0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 5 Jul 2021 18:24:22 +0200 +Subject: [PATCH] grub-set-password: Always use /boot/grub2/user.cfg as + password default + +The GRUB configuration file is always placed in /boot/grub2/ now, even for +EFI. But the tool is still creating the user.cfg in the ESP and not there. + +Resolves: rhbz#1955294 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-set-password.in | 9 +-------- + 1 file changed, 1 insertion(+), 8 deletions(-) + +diff --git a/util/grub-set-password.in b/util/grub-set-password.in +index c0b5ebbfdc5..d8005e5a142 100644 +--- a/util/grub-set-password.in ++++ b/util/grub-set-password.in +@@ -1,11 +1,6 @@ + #!/bin/sh -e + +-EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g') +-if [ -d /sys/firmware/efi/efivars/ ]; then +- grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'` +-else +- grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` +-fi ++grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` + + PACKAGE_VERSION="@PACKAGE_VERSION@" + PACKAGE_NAME="@PACKAGE_NAME@" +@@ -116,8 +111,6 @@ if [ -z "${MYPASS}" ]; then + exit 1 + fi + +-# on the ESP, these will fail to set the permissions, but it's okay because +-# the directory is protected. + install -m 0600 /dev/null "${OUTPUT_PATH}/user.cfg" 2>/dev/null || : + chmod 0600 "${OUTPUT_PATH}/user.cfg" 2>/dev/null || : + echo "GRUB2_PASSWORD=${MYPASS}" > "${OUTPUT_PATH}/user.cfg" diff --git a/0213-Remove-outdated-URL-for-BLS-document.patch b/0213-Remove-outdated-URL-for-BLS-document.patch new file mode 100644 index 00000000..d380fe88 --- /dev/null +++ b/0213-Remove-outdated-URL-for-BLS-document.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 5 Jul 2021 19:00:25 +0200 +Subject: [PATCH] Remove outdated URL for BLS document + +The document was moved to https://systemd.io/BOOT_LOADER_SPECIFICATION/, +update the URL accordingly to point to the current location. + +Resolves: rhbz#1926453 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index c9296154f51..6ee0a2cf3d0 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -96,7 +96,7 @@ cat < +Date: Tue, 6 Jul 2021 00:38:40 +0200 +Subject: [PATCH] templates: Check for EFI at runtime instead of config + generation time + +The 30_uefi-firmware template checks if an OsIndicationsSupported UEFI var +exists and EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit is set, to decide whether +a "fwsetup" menu entry would be added or not to the GRUB menu. + +But this has the problem that it will only work if the configuration file +was created on an UEFI machine that supports booting to a firmware UI. + +This for example doesn't support creating GRUB config files when executing +on systems that support both UEFI and legacy BIOS booting. Since creating +the config file from legacy BIOS wouldn't allow to access the firmware UI. + +To prevent this, make the template to unconditionally create the grub.cfg +snippet but check at runtime if was booted through UEFI to decide if this +entry should be added. That way it won't be added when booting with BIOS. + +There's no need to check if EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit is set, +since that's already done by the "fwsetup" command when is executed. + +Resolves: rhbz#1823864 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/30_uefi-firmware.in | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in +index d344d3883d7..b6041b55e2a 100644 +--- a/util/grub.d/30_uefi-firmware.in ++++ b/util/grub.d/30_uefi-firmware.in +@@ -26,19 +26,14 @@ export TEXTDOMAINDIR="@localedir@" + + . "$pkgdatadir/grub-mkconfig_lib" + +-EFI_VARS_DIR=/sys/firmware/efi/efivars +-EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c +-OS_INDICATIONS="$EFI_VARS_DIR/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE" ++LABEL="UEFI Firmware Settings" + +-if [ -e "$OS_INDICATIONS" ] && \ +- [ "$(( $(printf 0x%x \'"$(cat $OS_INDICATIONS | cut -b5)"\') & 1 ))" = 1 ]; then +- LABEL="UEFI Firmware Settings" ++gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2 + +- gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2 +- +- cat << EOF +-menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { +- fwsetup +-} +-EOF ++cat << EOF ++if [ "\$grub_platform" = "efi" ]; then ++ menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { ++ fwsetup ++ } + fi ++EOF diff --git a/0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch new file mode 100644 index 00000000..65b4aec5 --- /dev/null +++ b/0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch @@ -0,0 +1,92 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 6 Jul 2021 01:10:18 +0200 +Subject: [PATCH] efi: Print an error if boot to firmware setup is not + supported + +The "fwsetup" command is only registered if the firmware supports booting +to the firmware setup UI. But it could be possible that the GRUB config +already contains a "fwsetup" entry, because it was generated in a machine +that has support for this feature. + +To prevent users getting a "can't find command `fwsetup`" error if it is +not supported by the firmware, let's just always register the command but +print a more accurate message if the firmware doesn't support this option. + +Resolves: rhbz#1823864 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/efi/efifwsetup.c | 43 ++++++++++++++++++++----------------- + 1 file changed, 23 insertions(+), 20 deletions(-) + +diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c +index eaca0328388..328c45e82e0 100644 +--- a/grub-core/commands/efi/efifwsetup.c ++++ b/grub-core/commands/efi/efifwsetup.c +@@ -27,6 +27,25 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + ++static grub_efi_boolean_t ++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_get_variable ("OsIndicationsSupported", &global, &oi_size, ++ (void **) &os_indications_supported); ++ ++ if (!os_indications_supported) ++ return 0; ++ ++ if (*os_indications_supported & GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI) ++ return 1; ++ ++ return 0; ++} ++ + static grub_err_t + grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)), + int argc __attribute__ ((unused)), +@@ -38,6 +57,10 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)), + grub_size_t oi_size; + grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID; + ++ if (!efifwsetup_is_supported ()) ++ return grub_error (GRUB_ERR_INVALID_COMMAND, ++ N_("Reboot to firmware setup is not supported")); ++ + grub_efi_get_variable ("OsIndications", &global, &oi_size, + (void **) &old_os_indications); + +@@ -56,28 +79,8 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)), + + static grub_command_t cmd = NULL; + +-static grub_efi_boolean_t +-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_get_variable ("OsIndicationsSupported", &global, &oi_size, +- (void **) &os_indications_supported); +- +- if (!os_indications_supported) +- return 0; +- +- if (*os_indications_supported & GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI) +- return 1; +- +- return 0; +-} +- + GRUB_MOD_INIT (efifwsetup) + { +- if (efifwsetup_is_supported ()) + cmd = grub_register_command ("fwsetup", grub_cmd_fwsetup, NULL, + N_("Reboot into firmware setup menu.")); + diff --git a/grub.patches b/grub.patches index df709d62..92158946 100644 --- a/grub.patches +++ b/grub.patches @@ -206,3 +206,10 @@ Patch0205: 0205-Don-t-check-for-rpmvercmp-in-librpm.patch Patch0206: 0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch Patch0207: 0207-efinet-Add-DHCP-proxy-support.patch Patch0208: 0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0209: 0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0210: 0210-Suppress-gettext-error-message.patch +Patch0211: 0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch +Patch0212: 0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0213: 0213-Remove-outdated-URL-for-BLS-document.patch +Patch0214: 0214-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0215: 0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/grub2.spec b/grub2.spec index 179e8d44..907cae88 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,37 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jul 06 2021 Javier Martinez Canillas - 2.06-3 +- Add luks2 to GRUB_MODULES +- 20-grub-install: Create a symvers.gz symbolic link +- 20-grub-install: Always use fedora as the boot entry --class + Resolves: rhbz#1957014 +- grub.macros: Install font in /boot/grub2 instead of the ESP + Resolves: rhbz#1739762 +- grub.macros: Use consistent file mode for legacy and EFI + Resolves: rhbz#1965794 +- Drop grub2 prelink configuration + Resolves: rhbz#1659675 +- Remove triggers needed to upgrade from legacy GRUB +- Don't harcode grub2 in the spec file +- Update to unifont-13.0.06 + Resolves: rhbz#1939125 +- 20-grub-install: Use relative paths for btrfs in BLS snippets + Resolves: rhbz#1906191 +- Don't update the cmdline when generating legacy menuentry commands +- Suppress gettext error message + Resolves: rhbz#1592124 +- grub-boot-success.timer: Only run if not in a container + Resolves: rhbz#1914571 +- grub-set-password: Always use /boot/grub2/user.cfg as password default + Resolves: rhbz#1955294 +- Remove outdated URL for BLS document + Resolves: rhbz#1926453 +- templates: Check for EFI at runtime instead of config generation time + Resolves: rhbz#1823864 +- efi: Print an error if boot to firmware setup is not supported + Resolves: rhbz#1823864 + * Tue Jun 15 2021 Javier Martinez Canillas - 2.06-2 - Only try to generate a config if the ESP is mounted From 702732583bcb68938ef09403083184dd8f5fcb75 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 24 Aug 2021 11:23:07 -0400 Subject: [PATCH 081/294] Fix aarch64 kernel alignment. Signed-off-by: Peter Jones --- ...x-EFI-loader-kernel-image-allocation.patch | 189 ++++++++++++++++++ grub.patches | 1 + 2 files changed, 190 insertions(+) create mode 100644 0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch diff --git a/0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch new file mode 100644 index 00000000..600b4611 --- /dev/null +++ b/0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch @@ -0,0 +1,189 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Herrenschmidt +Date: Mon, 2 Aug 2021 23:10:01 +1000 +Subject: [PATCH] arm64: Fix EFI loader kernel image allocation + +We are currently allocating just enough memory for the file size, +which means that the kernel BSS is in limbo (and not even zeroed). + +We are also not honoring the alignment specified in the image +PE header. + +This makes us use the PE optional header in which the kernel puts the +actual size it needs, including BSS, and make sure we clear it, and +honors the specified alignment for the image. + +Signed-off-by: Benjamin Herrenschmidt +--- + grub-core/loader/arm64/linux.c | 100 +++++++++++++++++++++++++++-------------- + 1 file changed, 66 insertions(+), 34 deletions(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index 47f8cf0d84b..4a252d5e7e9 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -41,6 +41,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + static grub_dl_t my_mod; + static int loaded; + ++static void *kernel_alloc_addr; ++static grub_uint32_t kernel_alloc_pages; + static void *kernel_addr; + static grub_uint64_t kernel_size; + static grub_uint32_t handover_offset; +@@ -204,9 +206,8 @@ grub_linux_unload (void) + GRUB_EFI_BYTES_TO_PAGES (initrd_end - initrd_start)); + initrd_start = initrd_end = 0; + grub_free (linux_args); +- if (kernel_addr) +- grub_efi_free_pages ((grub_addr_t) kernel_addr, +- GRUB_EFI_BYTES_TO_PAGES (kernel_size)); ++ if (kernel_alloc_addr) ++ grub_efi_free_pages ((grub_addr_t) kernel_alloc_addr, kernel_alloc_pages); + grub_fdt_unload (); + return GRUB_ERR_NONE; + } +@@ -311,14 +312,35 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + return grub_errno; + } + ++static grub_err_t ++parse_pe_header (void *kernel, grub_uint64_t *total_size, ++ grub_uint32_t *entry_offset, ++ grub_uint32_t *alignment) ++{ ++ struct linux_arch_kernel_header *lh = kernel; ++ struct grub_armxx_linux_pe_header *pe; ++ ++ pe = (void *)((unsigned long)kernel + lh->hdr_offset); ++ ++ if (pe->opt.magic != GRUB_PE32_PE64_MAGIC) ++ return grub_error(GRUB_ERR_BAD_OS, "Invalid PE optional header magic"); ++ ++ *total_size = pe->opt.image_size; ++ *entry_offset = pe->opt.entry_addr; ++ *alignment = pe->opt.section_alignment; ++ ++ return GRUB_ERR_NONE; ++} ++ + static grub_err_t + grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + int argc, char *argv[]) + { + grub_file_t file = 0; +- struct linux_arch_kernel_header lh; +- struct grub_armxx_linux_pe_header *pe; + grub_err_t err; ++ grub_off_t filelen; ++ grub_uint32_t align; ++ void *kernel = NULL; + int rc; + + grub_dl_ref (my_mod); +@@ -333,40 +355,24 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + if (!file) + goto fail; + +- kernel_size = grub_file_size (file); +- +- if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh)) +- return grub_errno; +- +- if (grub_arch_efi_linux_check_image (&lh) != GRUB_ERR_NONE) +- goto fail; +- +- grub_loader_unset(); +- +- grub_dprintf ("linux", "kernel file size: %lld\n", (long long) kernel_size); +- kernel_addr = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (kernel_size)); +- grub_dprintf ("linux", "kernel numpages: %lld\n", +- (long long) GRUB_EFI_BYTES_TO_PAGES (kernel_size)); +- if (!kernel_addr) ++ filelen = grub_file_size (file); ++ kernel = grub_malloc(filelen); ++ if (!kernel) + { +- grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel load buffer")); + goto fail; + } + +- grub_file_seek (file, 0); +- if (grub_file_read (file, kernel_addr, kernel_size) +- < (grub_int64_t) kernel_size) ++ if (grub_file_read (file, kernel, filelen) < (grub_ssize_t)filelen) + { +- if (!grub_errno) +- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), argv[0]); ++ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), ++ argv[0]); + goto fail; + } + +- grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); +- + if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + { +- rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size); ++ rc = grub_linuxefi_secure_validate (kernel, filelen); + if (rc <= 0) + { + grub_error (GRUB_ERR_INVALID_COMMAND, +@@ -375,8 +381,32 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } + } + +- pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); +- handover_offset = pe->opt.entry_addr; ++ if (grub_arch_efi_linux_check_image (kernel) != GRUB_ERR_NONE) ++ goto fail; ++ if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align) != GRUB_ERR_NONE) ++ goto fail; ++ grub_dprintf ("linux", "kernel mem size : %lld\n", (long long) kernel_size); ++ grub_dprintf ("linux", "kernel entry offset : %d\n", handover_offset); ++ grub_dprintf ("linux", "kernel alignment : 0x%x\n", align); ++ ++ grub_loader_unset(); ++ ++ kernel_alloc_pages = GRUB_EFI_BYTES_TO_PAGES (kernel_size + align - 1); ++ kernel_alloc_addr = grub_efi_allocate_any_pages (kernel_alloc_pages); ++ grub_dprintf ("linux", "kernel numpages: %d\n", kernel_alloc_pages); ++ if (!kernel_alloc_addr) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ goto fail; ++ } ++ kernel_addr = (void *)ALIGN_UP((grub_uint64_t)kernel_alloc_addr, align); ++ ++ grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); ++ grub_memcpy (kernel_addr, kernel, grub_min(filelen, kernel_size)); ++ if (kernel_size > filelen) ++ grub_memset ((char *)kernel_addr + filelen, 0, kernel_size - filelen); ++ grub_free(kernel); ++ kernel = NULL; + + cmdline_size = grub_loader_cmdline_size (argc, argv) + sizeof (LINUX_IMAGE); + linux_args = grub_malloc (cmdline_size); +@@ -400,6 +430,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } + + fail: ++ if (kernel) ++ grub_free (kernel); ++ + if (file) + grub_file_close (file); + +@@ -412,9 +445,8 @@ fail: + if (linux_args && !loaded) + grub_free (linux_args); + +- if (kernel_addr && !loaded) +- grub_efi_free_pages ((grub_addr_t) kernel_addr, +- GRUB_EFI_BYTES_TO_PAGES (kernel_size)); ++ if (kernel_alloc_addr && !loaded) ++ grub_efi_free_pages ((grub_addr_t) kernel_alloc_addr, kernel_alloc_pages); + + return grub_errno; + } diff --git a/grub.patches b/grub.patches index 92158946..4940f653 100644 --- a/grub.patches +++ b/grub.patches @@ -213,3 +213,4 @@ Patch0212: 0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch Patch0213: 0213-Remove-outdated-URL-for-BLS-document.patch Patch0214: 0214-templates-Check-for-EFI-at-runtime-instead-of-config.patch Patch0215: 0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0216: 0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch From db96a0c4de542d3191542d3f5c6ca560d39a50d3 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 24 Aug 2021 12:14:06 -0400 Subject: [PATCH 082/294] grub.macros: Remove annobin plugin from linker flags The annobin GCC plugin is now turned on linking for LTO mode but it causes build failures on at least powerpc. The plugin is already removed from the CFLAGS but was added again through LDFLAGS, remove from there as well. Signed-off-by: Peter Jones --- grub.macros | 3 ++- grub2.spec | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/grub.macros b/grub.macros index 865ade3c..58630377 100644 --- a/grub.macros +++ b/grub.macros @@ -18,7 +18,7 @@ sed \\\ -e 's/-O. //g' \\\ -e 's/-fplugin=annobin //g' \\\ - -e 's,-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 ,,g' \\\ + -e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]* ,,g' \\\ -e 's/-fstack-protector[[:alpha:]-]\\+//g' \\\ -e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\\+//g' \\\ -e 's/--param=ssp-buffer-size=4//g' \\\ @@ -49,6 +49,7 @@ %global ldflags_sed \\\ sed \\\ + -e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]* ,,g' \\\ -e 's/^$//' \\\ %{nil} diff --git a/grub2.spec b/grub2.spec index 907cae88..6c82b03e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Aug 24 2021 Peter Jones - 2.06-4 +- Fix aarch64 kernel alignment. +- Fix annobin regexp on ppc64le + * Tue Jul 06 2021 Javier Martinez Canillas - 2.06-3 - Add luks2 to GRUB_MODULES - 20-grub-install: Create a symvers.gz symbolic link From 1f9e8074aef0db4f291963776db4f31750dfd7b2 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 30 Aug 2021 16:50:42 +0200 Subject: [PATCH 083/294] A few fixes for ppc64le LPAR Secure Boot support Signed-off-by: Javier Martinez Canillas --- ...over-the-device-to-read-the-config-f.patch | 123 ++++++++++++++++++ ...etting-of-prefix-for-signed-binary-c.patch | 75 +++++++++++ ...ix-signed-grub-special-case-for-Powe.patch | 43 ++++++ grub.patches | 3 + grub2.spec | 5 +- 5 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 0217-normal-main-Discover-the-device-to-read-the-config-f.patch create mode 100644 0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch create mode 100644 0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch diff --git a/0217-normal-main-Discover-the-device-to-read-the-config-f.patch b/0217-normal-main-Discover-the-device-to-read-the-config-f.patch new file mode 100644 index 00000000..cf12fd6e --- /dev/null +++ b/0217-normal-main-Discover-the-device-to-read-the-config-f.patch @@ -0,0 +1,123 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 30 Aug 2021 12:31:18 +0200 +Subject: [PATCH] normal/main: Discover the device to read the config from as a + fallback + +The GRUB core.img is generated locally, when this is done the grub2-probe +tool figures out the device and partition that needs to be read to parse +the GRUB configuration file. + +But in some cases the core.img can't be generated on the host and instead +has to be done at package build time. For example, if needs to get signed +with a key that's only available on the package building infrastructure. + +If that's the case, the prefix variable won't have a device and partition +but only a directory path. So there's no way for GRUB to know from which +device has to read the configuration file. + +To allow GRUB to continue working on that scenario, fallback to iterating +over all the available devices, if reading the config failed when using +the prefix and fw_path variables. + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/normal/main.c | 58 +++++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 51 insertions(+), 7 deletions(-) + +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index 155bf366da2..f9ccca502ee 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -339,18 +339,13 @@ grub_enter_normal_mode (const char *config) + } + + static grub_err_t +-grub_try_normal (const char *variable) ++grub_try_normal_prefix (const char *prefix) + { + char *config; +- const char *prefix; + grub_err_t err = GRUB_ERR_FILE_NOT_FOUND; + const char *net_search_cfg; + int disable_net_search = 0; + +- prefix = grub_env_get (variable); +- if (!prefix) +- return GRUB_ERR_FILE_NOT_FOUND; +- + net_search_cfg = grub_env_get ("feature_net_search_cfg"); + if (net_search_cfg && net_search_cfg[0] == 'n') + disable_net_search = 1; +@@ -364,7 +359,7 @@ grub_try_normal (const char *variable) + config = grub_malloc (config_len); + + if (! config) +- return GRUB_ERR_FILE_NOT_FOUND; ++ return err; + + grub_snprintf (config, config_len, "%s/grub.cfg", prefix); + err = grub_net_search_config_file (config); +@@ -393,6 +388,53 @@ grub_try_normal (const char *variable) + return err; + } + ++static int ++grub_try_normal_dev (const char *name, void *data) ++{ ++ grub_err_t err; ++ const char *prefix = grub_xasprintf ("(%s)%s", name, (char *)data); ++ ++ if (!prefix) ++ return 0; ++ ++ err = grub_try_normal_prefix (prefix); ++ if (err == GRUB_ERR_NONE) ++ return 1; ++ ++ return 0; ++} ++ ++static grub_err_t ++grub_try_normal_discover (void) ++{ ++ char *prefix = grub_env_get ("prefix"); ++ grub_err_t err = GRUB_ERR_FILE_NOT_FOUND; ++ ++ if (!prefix) ++ return err; ++ ++ if (grub_device_iterate (grub_try_normal_dev, (void *)prefix)) ++ return GRUB_ERR_NONE; ++ ++ return err; ++} ++ ++static grub_err_t ++grub_try_normal (const char *variable) ++{ ++ grub_err_t err = GRUB_ERR_FILE_NOT_FOUND; ++ const char *prefix; ++ ++ if (!variable) ++ return err; ++ ++ prefix = grub_env_get (variable); ++ if (!prefix) ++ return err; ++ ++ return grub_try_normal_prefix (prefix); ++} ++ + /* Enter normal mode from rescue mode. */ + static grub_err_t + grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), +@@ -407,6 +449,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), + err = grub_try_normal ("fw_path"); + if (err == GRUB_ERR_FILE_NOT_FOUND) + err = grub_try_normal ("prefix"); ++ if (err == GRUB_ERR_FILE_NOT_FOUND) ++ err = grub_try_normal_discover (); + if (err == GRUB_ERR_FILE_NOT_FOUND) + grub_enter_normal_mode (0); + } diff --git a/0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch new file mode 100644 index 00000000..70b021d2 --- /dev/null +++ b/0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 19 Jul 2021 14:35:55 +1000 +Subject: [PATCH] powerpc: adjust setting of prefix for signed binary case + +On RHEL-signed powerpc grub, we sign a grub with -p /grub2 and expect +that there's a boot partition. + +Unfortunately grub_set_prefix_and_root tries to convert this to +($fwdevice)/grub2. This ends up being (ieee1275/disk)/grub2 and that +falls apart pretty quickly - there's no file-system on ieee1275/disk, +and it makes the search routine try things like +(ieee1275/disk,msdos2)(ieee1275/disk)/grub2 which also doesn't work. + +Detect if we would be about to create (ieee1275/disk)/path and don't: +preserve a prefix of /path instead and hope the search later finds us. + +Related: rhbz#1899864 + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/main.c | 38 +++++++++++++++++++++++++++++++++----- + 1 file changed, 33 insertions(+), 5 deletions(-) + +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index 0285e95a2bb..e809a5edec1 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -216,13 +216,41 @@ grub_set_prefix_and_root (void) + if (device) + { + char *prefix_set; +- +- prefix_set = grub_xasprintf ("(%s)%s", device, path ? : ""); +- if (prefix_set) ++ ++#ifdef __powerpc__ ++ /* We have to be careful here on powerpc-ieee1275 + signed grub. We ++ will have signed something with a prefix that doesn't have a device ++ because we cannot know in advance what partition we're on. ++ ++ We will have had !device earlier, so we will have set device=fwdevice ++ However, we want to make sure we do not end up setting prefix to be ++ ($fwdevice)/path, because we will then end up trying to boot or search ++ based on a prefix of (ieee1275/disk)/path, which will not work because ++ it's missing a partition. ++ ++ Also: ++ - You can end up with a device with an FS directly on it, without ++ a partition, e.g. ieee1275/cdrom. ++ ++ - powerpc-ieee1275 + grub-install sets e.g. prefix=(,gpt2)/path, ++ which will have now been extended to device=$fwdisk,partition ++ and path=/path ++ ++ So we only need to act if device = ieee1275/disk exactly. ++ */ ++ if (grub_strncmp (device, "ieee1275/disk", 14) == 0) ++ grub_env_set ("prefix", path); ++ else ++#endif + { +- grub_env_set ("prefix", prefix_set); +- grub_free (prefix_set); ++ prefix_set = grub_xasprintf ("(%s)%s", device, path ? : ""); ++ if (prefix_set) ++ { ++ grub_env_set ("prefix", prefix_set); ++ grub_free (prefix_set); ++ } + } ++ + grub_env_set ("root", device); + } + diff --git a/0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch b/0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch new file mode 100644 index 00000000..1cb21efa --- /dev/null +++ b/0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 16 Aug 2021 16:01:47 +1000 +Subject: [PATCH] powerpc: fix prefix + signed grub special case for PowerVM + +Mea culpa: when testing the PowerPC special case for signed grub, I +assumed qemu and PowerVM would behave identically. This was wrong, and +with hindsight a pretty dumb error. + +This fixes it. This time, I am actually testing on PowerVM. + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/main.c | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index e809a5edec1..2d0d2bbd4cf 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -236,9 +236,20 @@ grub_set_prefix_and_root (void) + which will have now been extended to device=$fwdisk,partition + and path=/path + +- So we only need to act if device = ieee1275/disk exactly. ++ - PowerVM will give us device names like ++ ieee1275//vdevice/v-scsi@3000006c/disk@8100000000000000 ++ and we don't want to try to encode some sort of truth table about ++ what sorts of paths represent disks with partition tables and those ++ without partition tables. ++ ++ So we act unless there is a comma in the device, which would indicate ++ a partition has already been specified. ++ ++ (If we only have a path, the code in normal to discover config files ++ will try both without partitions and then with any partitions so we ++ will cover both CDs and HDs.) + */ +- if (grub_strncmp (device, "ieee1275/disk", 14) == 0) ++ if (grub_strchr (device, ',') == NULL) + grub_env_set ("prefix", path); + else + #endif diff --git a/grub.patches b/grub.patches index 4940f653..5365f4af 100644 --- a/grub.patches +++ b/grub.patches @@ -214,3 +214,6 @@ Patch0213: 0213-Remove-outdated-URL-for-BLS-document.patch Patch0214: 0214-templates-Check-for-EFI-at-runtime-instead-of-config.patch Patch0215: 0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch Patch0216: 0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0217: 0217-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0218: 0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0219: 0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch diff --git a/grub2.spec b/grub2.spec index 6c82b03e..d9838d35 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Aug 30 2021 Javier Martinez Canillas - 2.06-5 +- A few fixes for ppc64le LPAR Secure Boot support + * Tue Aug 24 2021 Peter Jones - 2.06-4 - Fix aarch64 kernel alignment. - Fix annobin regexp on ppc64le From 64dc7670b0c1d1d766c96224f9b46e498d2c7042 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 23 Sep 2021 16:44:52 -0400 Subject: [PATCH 084/294] Add rpminspect config file Signed-off-by: Robbie Harwood --- rpminspect.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rpminspect.yaml diff --git a/rpminspect.yaml b/rpminspect.yaml new file mode 100644 index 00000000..015af4ea --- /dev/null +++ b/rpminspect.yaml @@ -0,0 +1,22 @@ +--- +inspections: + # Not a Java package + javabytecode: off + + # These just flag when things change "too much" + changedfiles: off + filesize: off + patches: off + upstream: off + + # https://bugzilla.redhat.com/show_bug.cgi?id=2007427 + manpage: off + + # https://bugzilla.redhat.com/show_bug.cgi?id=2007428 + elf: off + + # https://bugzilla.redhat.com/show_bug.cgi?id=1961250 + annocheck: off + + # https://bugzilla.redhat.com/show_bug.cgi?id=2007431 + permissions: off From 07cf41c169da8ab2d70ac7ae8d9a050505af1402 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 29 Sep 2021 16:11:15 +0000 Subject: [PATCH 085/294] fs/xfs: Fix unreadable filesystem with v4 superblock While we're here, also: check for the PE magic for the compiled arch Resolves: rhbz#2008819 Signed-off-by: Robbie Harwood --- ...r-the-PE-magic-for-the-compiled-arch.patch | 63 ++++++++++ ...adable-filesystem-with-v4-superblock.patch | 118 ++++++++++++++++++ grub.patches | 2 + grub2.spec | 7 +- 4 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch create mode 100644 0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch b/0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch new file mode 100644 index 00000000..8b5170b6 --- /dev/null +++ b/0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 9 Sep 2021 10:59:28 -0400 +Subject: [PATCH] Arm: check for the PE magic for the compiled arch + +In "arm64: Fix EFI loader kernel image allocation", Ben fixed the kernel +alignment to match the alignment given in the PE header. In doing so, a +check for valid PE magic was added, which was hard-coded to the value +seen on Aarch64 (GRUB_PE32_PE64_MAGIC). + +Unfortunately, this code is shared between 64-bit and 32-bit, and so +that value broke 32-bit Arm systems. + +This patch adds a constant definition for GRUB_PE32_PEXX_MAGIC, which is +either GRUB_PE32_PE64_MAGIC or GRUB_PE32_PE32_MAGIC, depending on which +platform is being built, and uses it in the header magic check. + +Resolves: rhbz#2000756 + +Signed-off-by: Peter Jones +--- + grub-core/loader/arm64/linux.c | 2 +- + include/grub/arm/linux.h | 1 + + include/grub/arm64/linux.h | 1 + + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index 4a252d5e7e9..f18d90bd749 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -322,7 +322,7 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size, + + pe = (void *)((unsigned long)kernel + lh->hdr_offset); + +- if (pe->opt.magic != GRUB_PE32_PE64_MAGIC) ++ if (pe->opt.magic != GRUB_PE32_PEXX_MAGIC) + return grub_error(GRUB_ERR_BAD_OS, "Invalid PE optional header magic"); + + *total_size = pe->opt.image_size; +diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h +index b582f67f661..966a5074f53 100644 +--- a/include/grub/arm/linux.h ++++ b/include/grub/arm/linux.h +@@ -44,6 +44,7 @@ struct grub_arm_linux_pe_header + + #if defined(__arm__) + # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE ++# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE32_MAGIC + # define linux_arch_kernel_header linux_arm_kernel_header + # define grub_armxx_linux_pe_header grub_arm_linux_pe_header + #endif +diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h +index ea030312df3..422bf2bf24b 100644 +--- a/include/grub/arm64/linux.h ++++ b/include/grub/arm64/linux.h +@@ -48,6 +48,7 @@ struct grub_arm64_linux_pe_header + + #if defined(__aarch64__) + # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE ++# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE64_MAGIC + # define linux_arch_kernel_header linux_arm64_kernel_header + # define grub_armxx_linux_pe_header grub_arm64_linux_pe_header + #endif diff --git a/0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch new file mode 100644 index 00000000..893d8b41 --- /dev/null +++ b/0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch @@ -0,0 +1,118 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Erwan Velu +Date: Wed, 25 Aug 2021 15:31:52 +0200 +Subject: [PATCH] fs/xfs: Fix unreadable filesystem with v4 superblock + +The commit 8b1e5d193 (fs/xfs: Add bigtime incompat feature support) +introduced the bigtime support by adding some features in v3 inodes. +This change extended grub_xfs_inode struct by 76 bytes but also changed +the computation of XFS_V2_INODE_SIZE and XFS_V3_INODE_SIZE. Prior this +commit, XFS_V2_INODE_SIZE was 100 bytes. After the commit it's 84 bytes +XFS_V2_INODE_SIZE becomes 16 bytes too small. + +As a result, the data structures aren't properly aligned and the GRUB +generates "attempt to read or write outside of partition" errors when +trying to read the XFS filesystem: + + GNU GRUB version 2.11 + .... + grub> set debug=efi,gpt,xfs + grub> insmod part_gpt + grub> ls (hd0,gpt1)/ + partmap/gpt.c:93: Read a valid GPT header + partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 + fs/xfs.c:931: Reading sb + fs/xfs.c:270: Validating superblock + fs/xfs.c:295: XFS v4 superblock detected + fs/xfs.c:962: Reading root ino 128 + fs/xfs.c:515: Reading inode (128) - 64, 0 + fs/xfs.c:515: Reading inode (739521961424144223) - 344365866970255880, 3840 + error: attempt to read or write outside of partition. + +This commit change the XFS_V2_INODE_SIZE computation by subtracting 76 +bytes instead of 92 bytes from the actual size of grub_xfs_inode struct. +This 76 bytes value comes from added members: + 20 grub_uint8_t unused5 + 1 grub_uint64_t flags2 + 48 grub_uint8_t unused6 + +This patch explicitly splits the v2 and v3 parts of the structure. +The unused4 is still ending of the v2 structures and the v3 starts +at unused5. Thanks to this we will avoid future corruptions of v2 +or v3 inodes. + +The XFS_V2_INODE_SIZE is returning to its expected size and the +filesystem is back to a readable state: + + GNU GRUB version 2.11 + .... + grub> set debug=efi,gpt,xfs + grub> insmod part_gpt + grub> ls (hd0,gpt1)/ + partmap/gpt.c:93: Read a valid GPT header + partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 + fs/xfs.c:931: Reading sb + fs/xfs.c:270: Validating superblock + fs/xfs.c:295: XFS v4 superblock detected + fs/xfs.c:962: Reading root ino 128 + fs/xfs.c:515: Reading inode (128) - 64, 0 + fs/xfs.c:515: Reading inode (128) - 64, 0 + fs/xfs.c:931: Reading sb + fs/xfs.c:270: Validating superblock + fs/xfs.c:295: XFS v4 superblock detected + fs/xfs.c:962: Reading root ino 128 + fs/xfs.c:515: Reading inode (128) - 64, 0 + fs/xfs.c:515: Reading inode (128) - 64, 0 + fs/xfs.c:515: Reading inode (128) - 64, 0 + fs/xfs.c:515: Reading inode (131) - 64, 768 + efi/ fs/xfs.c:515: Reading inode (3145856) - 1464904, 0 + grub2/ fs/xfs.c:515: Reading inode (132) - 64, 1024 + grub/ fs/xfs.c:515: Reading inode (139) - 64, 2816 + grub> + +Fixes: 8b1e5d193 (fs/xfs: Add bigtime incompat feature support) + +Signed-off-by: Erwan Velu +Tested-by: Carlos Maiolino +Reviewed-by: Daniel Kiper +(cherry picked from commit a4b495520e4dc41a896a8b916a64eda9970c50ea) +--- + grub-core/fs/xfs.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 0f524c3a8a6..e3816d1ec4a 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -192,6 +192,11 @@ struct grub_xfs_time_legacy + grub_uint32_t nanosec; + } GRUB_PACKED; + ++/* ++ * The struct grub_xfs_inode layout was taken from the ++ * struct xfs_dinode_core which is described here: ++ * https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf ++ */ + struct grub_xfs_inode + { + grub_uint8_t magic[2]; +@@ -208,14 +213,15 @@ struct grub_xfs_inode + grub_uint32_t nextents; + grub_uint16_t unused3; + grub_uint8_t fork_offset; +- grub_uint8_t unused4[37]; ++ grub_uint8_t unused4[17]; /* Last member of inode v2. */ ++ grub_uint8_t unused5[20]; /* First member of inode v3. */ + grub_uint64_t flags2; +- grub_uint8_t unused5[48]; ++ grub_uint8_t unused6[48]; /* Last member of inode v3. */ + } GRUB_PACKED; + + #define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode) +-/* Size of struct grub_xfs_inode until fork_offset (included). */ +-#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 92) ++/* Size of struct grub_xfs_inode v2, up to unused4 member included. */ ++#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76) + + struct grub_xfs_dirblock_tail + { diff --git a/grub.patches b/grub.patches index 5365f4af..f474e1fc 100644 --- a/grub.patches +++ b/grub.patches @@ -217,3 +217,5 @@ Patch0216: 0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch Patch0217: 0217-normal-main-Discover-the-device-to-read-the-config-f.patch Patch0218: 0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch Patch0219: 0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch +Patch0220: 0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch +Patch0221: 0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/grub2.spec b/grub2.spec index d9838d35..0ab40143 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Sep 29 2021 Robbie Harwood - 2.06-6 +- fs/xfs: Fix unreadable filesystem with v4 superblock +- Arm: check for the PE magic for the compiled arch +- Resolves: rhbz#2008819 + * Mon Aug 30 2021 Javier Martinez Canillas - 2.06-5 - A few fixes for ppc64le LPAR Secure Boot support From b3b9566edf60e29e96f6d1fb9fdee30bd803e02f Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 29 Sep 2021 18:05:43 +0000 Subject: [PATCH 086/294] Rebuild; no code changes --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 0ab40143..3f293296 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Sep 29 2021 Robbie Harwood - 2.06-7 +- Rebuild; no code changes + * Wed Sep 29 2021 Robbie Harwood - 2.06-6 - fs/xfs: Fix unreadable filesystem with v4 superblock - Arm: check for the PE magic for the compiled arch From 99bcf9931e0176e736e3e98c6a941121a3f53e82 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 5 Oct 2021 17:39:11 -0400 Subject: [PATCH 087/294] Fix grub-mkimage --append-signature-size 0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch was written in Jun of 2020, before support for .sbat went upstream. It adds a command line option "--append-signature-size" to grub-mkimage with the short argument '-s'. Unfortunately, .sbat support also uses that short argument, and as a result, trying to use "grub-mkimage --append-signature-size" on ppc64le (where we need it) fails due to argument.sbat being set on a non-EFI platform. This patch makes the --append-signature-size use 'S' instead of 's'. Related: rhbz#1951104 Signed-off-by: Peter Jones --- ...Add-suport-for-signing-grub-with-an-appended-signatu.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch index a8632985..86075510 100644 --- a/0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch +++ b/0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -106,14 +106,14 @@ index 4e212e690c5..aab2a941f85 100644 while (dc--) grub_install_pop_module (); diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index c0d55993702..26d1ecbf74e 100644 +index c0d55993702..94c9893230f 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -84,6 +84,7 @@ static struct argp_option options[] = { {"sbat", 's', N_("FILE"), 0, N_("SBAT metadata"), 0}, {"disable-shim-lock", GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, 0, 0, N_("disable shim_lock verifier"), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, -+ {"appended-signature-size", 's', N_("SIZE"), 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), 0}, ++ {"appended-signature-size", 'S', N_("SIZE"), 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), 0}, { 0, 0, 0, 0, 0, 0 } }; From 42a07486d8b59fd4acb280ab4b6197c8b7119a02 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 7 Oct 2021 12:30:02 -0400 Subject: [PATCH 088/294] Fix "grub2-mkimage --appended-signature-size" parsing. Signed-off-by: Peter Jones --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 3f293296..5928e6f0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Oct 07 2021 Peter Jones - 2.06-8 +- Fix "grub2-mkimage --appended-signature-size" parsing. + * Wed Sep 29 2021 Robbie Harwood - 2.06-7 - Rebuild; no code changes From af038a0bdc38f46db45fc5aeaca0a6942fc22440 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 7 Oct 2021 17:38:20 -0400 Subject: [PATCH 089/294] Revert "Don't harcode grub2 in the spec file" Two issues: - line 538 switches the filename from "grub" to "grub2" where it shouldn't - in general, things that aren't referring to the packaging itself shouldn't be %{name}; it just makes them less flexible. This reverts commit 967c5629ed9fdb4e8572daa78f3bb5ac5e675e77. --- grub.macros | 18 +++++++++--------- grub2.spec | 28 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/grub.macros b/grub.macros index 58630377..03436267 100644 --- a/grub.macros +++ b/grub.macros @@ -390,7 +390,7 @@ rm -f %{1}.conf \ %{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \ %{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ -%{expand:%%define __pesign_client_cert %{name}-signer} \ +%{expand:%%define __pesign_client_cert grub2-signer} \ %{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \ %{nil} @@ -534,9 +534,9 @@ fi \ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ fi \ -if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \ - mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\ - $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \ +if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \ + mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\ + $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \ fi \ if [ %{3} -eq 0 ]; then \ ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ @@ -555,8 +555,8 @@ fi \ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ fi \ -if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp ]; then \ - mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/%{name}.chrp \\\ +if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \ + mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\ $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \ fi \ cd .. \ @@ -573,7 +573,7 @@ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \ cp docs/grub-dev.info \\\ $RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \ install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \ -install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/ \ +install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \ install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \ @@ -583,7 +583,7 @@ ln -sf ../default/grub \\\ ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ ln -s ../boot/%{name}/grub.cfg \\\ - ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}.cfg \ + ${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \ %{nil} %define define_legacy_variant_files() \ @@ -620,7 +620,7 @@ ln -s ../boot/%{name}/grub.cfg \\\ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) /boot/%{name}/grub.cfg \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ -%config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv \ +%config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ %exclude %{_libdir}/grub/%{6} \ diff --git a/grub2.spec b/grub2.spec index 5928e6f0..21404f3b 100644 --- a/grub2.spec +++ b/grub2.spec @@ -258,7 +258,7 @@ install -d -m 0755 %{buildroot}%{_unitdir}/system-update.target.wants install -d -m 0755 %{buildroot}%{_unitdir}/reboot.target.wants ln -s ../grub-boot-indeterminate.service \ %{buildroot}%{_unitdir}/system-update.target.wants -ln -s ../%{name}-systemd-integration.service \ +ln -s ../grub2-systemd-integration.service \ %{buildroot}%{_unitdir}/reboot.target.wants # Don't run debuginfo on all the grub modules and whatnot; it just @@ -283,9 +283,9 @@ ln -s ../%{name}-systemd-integration.service \ %undefine buildsubdir %pre tools -if [ -f /boot/%{name}/user.cfg ]; then - if grep -q '^GRUB_PASSWORD=' /boot/%{name}/user.cfg ; then - sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/%{name}/user.cfg +if [ -f /boot/grub2/user.cfg ]; then + if grep -q '^GRUB_PASSWORD=' /boot/grub2/user.cfg ; then + sed -i 's/^GRUB_PASSWORD=/GRUB2_PASSWORD=/' /boot/grub2/user.cfg fi elif [ -f %{efi_esp_dir}/user.cfg ]; then if grep -q '^GRUB_PASSWORD=' %{efi_esp_dir}/user.cfg ; then @@ -301,12 +301,12 @@ elif [ -f /etc/grub.d/01_users ] && \ sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \ > %{efi_esp_dir}/user.cfg fi - if [ -f /boot/%{name}/grub.cfg ]; then - install -m 0600 /dev/null /boot/%{name}/user.cfg - chmod 0600 /boot/%{name}/user.cfg + if [ -f /boot/grub2/grub.cfg ]; then + install -m 0600 /dev/null /boot/grub2/user.cfg + chmod 0600 /boot/grub2/user.cfg grep '^password_pbkdf2 root' /etc/grub.d/01_users | \ sed 's/^password_pbkdf2 root \(.*\)$/GRUB2_PASSWORD=\1/' \ - > /boot/%{name}/user.cfg + > /boot/grub2/user.cfg fi fi @@ -314,7 +314,7 @@ fi set -eu EFI_HOME=%{efi_esp_dir} -GRUB_HOME=/boot/%{name} +GRUB_HOME=/boot/grub2 ESP_PATH=/boot/efi if ! mountpoint -q ${ESP_PATH}; then @@ -331,8 +331,8 @@ if grep -q "configfile" ${EFI_HOME}/grub.cfg; then fi # create a stub grub2 config in EFI -BOOT_UUID=$(%{name}-probe --target=fs_uuid ${GRUB_HOME}) -GRUB_DIR=$(%{name}-mkrelpath ${GRUB_HOME}) +BOOT_UUID=$(grub2-probe --target=fs_uuid ${GRUB_HOME}) +GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME}) cat << EOF > ${EFI_HOME}/grub.cfg.stb search --no-floppy --fs-uuid --set=dev ${BOOT_UUID} @@ -361,11 +361,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %dir /boot/%{name} %dir /boot/%{name}/themes/ %dir /boot/%{name}/themes/system -%attr(0700,root,root) %dir /boot/%{name} -%exclude /boot/%{name}/* +%attr(0700,root,root) %dir /boot/grub2 +%exclude /boot/grub2/* %dir %attr(0700,root,root) %{efi_esp_dir} %exclude %{efi_esp_dir}/* -%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/%{name}/grubenv +%ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv %license COPYING %doc THANKS %doc docs/grub.html From 9fdaa794e06846f1426bd15360401a8b1a5017a9 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 4 Nov 2021 16:29:49 +0000 Subject: [PATCH 090/294] Drop UI patches and update provenance information Signed-off-by: Robbie Harwood --- 0023-Don-t-write-messages-to-the-screen.patch | 176 -------- ...0023-Enable-pager-by-default.-985860.patch | 0 0024-Don-t-print-GNU-GRUB-header.patch | 42 -- ...n-t-say-GNU-Linux-in-generated-menus.patch | 2 +- ...rame-to-list-of-relocations-stripped.patch | 0 0025-Don-t-add-to-highlighted-row.patch | 23 -- ...password-to-boot-entries-generated-b.patch | 2 +- 0026-Message-string-cleanups.patch | 68 --- ...=> 0027-Don-t-emit-Booting-.-message.patch | 0 ...ing-now-that-we-aren-t-displaying-it.patch | 29 -- ...f-man-pages-with-slightly-nicer-ones.patch | 0 ...t-indentation-for-the-term-help-text.patch | 25 -- 0029-Indent-menu-entries.patch | 23 -- ...ix-when-fallback-searching-for-grub-.patch | 6 +- 0030-Fix-margins.patch | 34 -- ...-before-grub.cfg-on-tftp-config-file.patch | 4 +- ...CLASS-in-10_linux-from-etc-os-releas.patch | 2 +- ...-1-for-our-right-hand-margin-so-line.patch | 24 -- ...t-ordering-for-.debug-and-rescue-ker.patch | 0 ...-on-serial-so-don-t-tell-the-user-to.patch | 24 -- ...3-Try-prefix-if-fw_path-doesn-t-work.patch | 4 +- ...-Package-Sort-for-grub2-mkconfig-112.patch | 0 ...-Don-t-draw-a-border-around-the-menu.patch | 71 ---- ...fig-construct-titles-that-look-like-.patch | 2 +- ...ly-grub2-password-config-tool-985962.patch | 0 ...andard-margin-for-the-timeout-string.patch | 40 -- ... 0037-tcp-add-window-scaling-support.patch | 0 ...net-and-bootp-add-support-for-dhcpv6.patch | 0 ...rnel-settings-and-use-it-in-10_linux.patch | 6 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 0 ... 0041-Make-grub_fatal-also-backtrace.patch | 0 ...ix-up-some-man-pages-rpmdiff-noticed.patch | 0 ...fo-pages-say-grub2-where-appropriate.patch | 0 ...-chainloader-entries-don-t-try-any-x.patch | 0 ...-Add-ability-to-boot-from-subvolumes.patch | 0 ...port-btrfs_subvol-and-btrfs_subvolid.patch | 0 ...> 0047-grub2-btrfs-03-follow_default.patch | 2 + ...=> 0048-grub2-btrfs-04-grub2-install.patch | 2 + ...> 0049-grub2-btrfs-05-grub2-mkconfig.patch | 2 +- ... => 0050-grub2-btrfs-06-subvol-mount.patch | 2 + ...subvol-name-scheme-to-support-old-sn.patch | 0 ...-correctly-with-btrfs-snapshots-bsc-.patch | 2 + ...ocate_pool-and-grub_efi_free_pool-wr.patch | 0 ...fi_.-memory-helpers-where-reasonable.patch | 0 ...5-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 0 ...=> 0056-don-t-use-int-for-efi-status.patch | 0 ...INIT-declare-its-function-prototypes.patch | 0 ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 0 ...d-xen-or-multiboot-2-modules-as-need.patch | 0 ...-calibration-not-take-51-seconds-to-.patch | 0 ...061-align-struct-efi_variable-better.patch | 0 ...062-Add-BLS-support-to-grub-mkconfig.patch | 6 +- ...-backtrace-on-grub_abort-for-grub-em.patch | 0 ...nux-and-initrd-commands-for-grub-emu.patch | 5 +- ...h => 0065-Add-grub2-switch-to-blscfg.patch | 0 ...patch => 0066-make-better-backtraces.patch | 0 ...w-our-startup-message-if-debug-is-se.patch | 4 +- ...-some-minor-include-path-weirdnesses.patch | 0 ...it-possible-to-enabled-build-id-sha1.patch | 0 ...f-grub_dprintf-without-the-file-line.patch | 0 ...dprintf-that-tells-us-load-addresses.patch | 0 ...tch => 0072-Fixup-for-newer-compiler.patch | 0 ...-export-the-start-and-_start-symbols.patch | 0 ...tch => 0074-Fixup-for-newer-compiler.patch | 0 ...pport-for-non-Ethernet-network-cards.patch | 0 ...racketed-ipv6-addrs-and-port-numbers.patch | 0 ...=> 0077-bootp-New-net_bootp6-command.patch | 0 ...=> 0078-efinet-UEFI-IPv6-PXE-support.patch | 0 ...079-grub.texi-Add-net_bootp6-doument.patch | 0 ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 0 ...etting-network-from-UEFI-device-path.patch | 0 ...etting-DNS-server-from-UEFI-protocol.patch | 0 ...83-Support-UEFI-networking-protocols.patch | 0 ...> 0084-AUDIT-0-http-boot-tracker-bug.patch | 0 ...-incr-command-to-increment-integer-v.patch | 0 ...h => 0086-Add-auto-hide-menu-support.patch | 0 ...> 0087-Add-grub-set-bootflag-utility.patch | 0 ...b-boot-indeterminate.service-example.patch | 0 ...h => 0089-gentpl-add-disable-support.patch | 0 ... => 0090-gentpl-add-pc-firmware-type.patch | 0 ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 0 ...make-it-possible-to-run-checkers-on-.patch | 0 ...95-Rework-how-the-fdt-command-builds.patch | 0 ...able-non-wordsize-allocations-on-arm.patch | 0 ...nd-prefix-when-HTTP-path-is-relative.patch | 4 +- ...=> 0098-Make-grub_error-more-verbose.patch | 0 ...eset-an-alias-for-the-reboot-command.patch | 0 ....patch => 0100-Add-a-version-command.patch | 0 ...dprintf-and-nerf-dprintf-in-script.c.patch | 0 ...-Better-memory-allocation-and-error-.patch | 0 ...tter-locations-for-kernel-and-initrd.patch | 0 ...p-all-the-places-Wsign-compare-error.patch | 0 ...gn-compare-Wno-conversion-Wno-error-.patch | 0 ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 0 ...itrd-params-cmdline-allocations-abov.patch | 0 ... => 0110-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 0 ...tch => 0112-Reimplement-boot_counter.patch | 0 ...ntry-selection-based-on-ID-and-title.patch | 0 ...try-users-option-argument-to-be-opti.patch | 0 ...export-env-and-efi-load-env-commands.patch | 0 ...le-to-subtract-conditions-from-debug.patch | 0 ...bles-from-the-initial-context-when-c.patch | 0 ...-boot-success-reset-from-menu-auto-h.patch | 3 + ...ix-systemctl-kexec-exit-status-check.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 0 ...ferences-for-fdt-when-building-with-.patch | 0 ... => 0123-Do-better-in-bootstrap.conf.patch | 0 ...0124-Use-git-to-apply-gnulib-patches.patch | 0 ...-error-with-the-fdt-module-on-risc-v.patch | 0 ...g-Update-comment-about-running-as-ro.patch | 0 ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...indeterminate-getting-set-on-boot_su.patch | 0 ..._EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch | 0 ...ader-Define-machine-types-for-RISC-V.patch | 0 ... => 0131-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 0 ...fw-http-_path-variables-to-make-them.patch | 2 +- ...-literal-IPv6-addresses-in-square-br.patch | 0 ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 0 ...se-address-before-jumping-to-the-PE-.patch | 0 ...ate-TPM-measurement-errors-to-the-ve.patch | 0 ...maximum-bounce-buffer-size-to-16-MiB.patch | 0 ...fix-when-the-HTTP-path-is-relative-a.patch | 0 ...turn-in-efi-export-env-and-efi-load-.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 0 ...rnel-validation-without-shim-protoco.patch | 0 ...ar-pointers-in-grub-core-net-bootp.c.patch | 0 ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 0 ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 0 ...ll-disable-support-for-EFI-platforms.patch | 0 ...imestamps-configure-flag-to-prepend-.patch | 0 ...ements-to-grub_disk_open-and-grub_di.patch | 0 ...on-grub_debug_is_enabled-void-return.patch | 0 ...ear-screen-when-debugging-is-enabled.patch | 22 +- ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 6 + ...igning-grub-with-an-appended-signatu.patch | 11 +- ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0171-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0174-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...77-libtasn1-compile-into-asn1-module.patch | 0 ...8-test_asn1-test-module-for-libtasn1.patch | 0 ...-support-embedding-x509-certificates.patch | 6 +- ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 0 ...84-appended-signatures-documentation.patch | 0 ...er-lockdown-based-on-ibm-secure-boot.patch | 0 ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0187-ieee1275-claim-more-memory.patch | 0 ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 0 ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...nu_auto_hide.in-fix-a-then-than-typo.patch | 0 ... => 0192-Fix-disabling-grub-rpm-sort.patch | 3 + ...-Don-t-check-for-rpmvercmp-in-librpm.patch | 0 ...ainloading-EFI-apps-from-loop-mounts.patch | 2 + ...> 0195-efinet-Add-DHCP-proxy-support.patch | 3 + ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 2 +- ... 0198-Suppress-gettext-error-message.patch | 2 +- ...s.timer-Only-run-if-not-in-a-contain.patch | 0 ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 ...Remove-outdated-URL-for-BLS-document.patch | 2 +- ...for-EFI-at-runtime-instead-of-config.patch | 0 ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 0 ...over-the-device-to-read-the-config-f.patch | 10 +- ...etting-of-prefix-for-signed-binary-c.patch | 2 +- ...ix-signed-grub-special-case-for-Powe.patch | 2 +- ...r-the-PE-magic-for-the-compiled-arch.patch | 0 ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 48 +++ ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 106 +++++ grub.patches | 388 +++++++++--------- grub2.spec | 5 +- 203 files changed, 431 insertions(+), 830 deletions(-) delete mode 100644 0023-Don-t-write-messages-to-the-screen.patch rename 0032-Enable-pager-by-default.-985860.patch => 0023-Enable-pager-by-default.-985860.patch (100%) delete mode 100644 0024-Don-t-print-GNU-GRUB-header.patch rename 0034-Don-t-say-GNU-Linux-in-generated-menus.patch => 0024-Don-t-say-GNU-Linux-in-generated-menus.patch (97%) rename 0037-Add-.eh_frame-to-list-of-relocations-stripped.patch => 0025-Add-.eh_frame-to-list-of-relocations-stripped.patch (100%) delete mode 100644 0025-Don-t-add-to-highlighted-row.patch rename 0038-Don-t-require-a-password-to-boot-entries-generated-b.patch => 0026-Don-t-require-a-password-to-boot-entries-generated-b.patch (96%) delete mode 100644 0026-Message-string-cleanups.patch rename 0039-Don-t-emit-Booting-.-message.patch => 0027-Don-t-emit-Booting-.-message.patch (100%) delete mode 100644 0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch rename 0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch => 0028-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch (100%) delete mode 100644 0028-Use-the-correct-indentation-for-the-term-help-text.patch delete mode 100644 0029-Indent-menu-entries.patch rename 0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch => 0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch (89%) delete mode 100644 0030-Fix-margins.patch rename 0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch => 0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch (97%) rename 0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch => 0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch (96%) delete mode 100644 0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch rename 0044-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch => 0032-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch (100%) delete mode 100644 0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch rename 0045-Try-prefix-if-fw_path-doesn-t-work.patch => 0033-Try-prefix-if-fw_path-doesn-t-work.patch (98%) rename 0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch => 0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch (100%) delete mode 100644 0035-Don-t-draw-a-border-around-the-menu.patch rename 0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (98%) rename 0048-Add-friendly-grub2-password-config-tool-985962.patch => 0036-Add-friendly-grub2-password-config-tool-985962.patch (100%) delete mode 100644 0036-Use-the-standard-margin-for-the-timeout-string.patch rename 0049-tcp-add-window-scaling-support.patch => 0037-tcp-add-window-scaling-support.patch (100%) rename 0050-efinet-and-bootp-add-support-for-dhcpv6.patch => 0038-efinet-and-bootp-add-support-for-dhcpv6.patch (100%) rename 0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (98%) rename 0052-bz1374141-fix-incorrect-mask-for-ppc64.patch => 0040-bz1374141-fix-incorrect-mask-for-ppc64.patch (100%) rename 0053-Make-grub_fatal-also-backtrace.patch => 0041-Make-grub_fatal-also-backtrace.patch (100%) rename 0054-Fix-up-some-man-pages-rpmdiff-noticed.patch => 0042-Fix-up-some-man-pages-rpmdiff-noticed.patch (100%) rename 0055-Make-our-info-pages-say-grub2-where-appropriate.patch => 0043-Make-our-info-pages-say-grub2-where-appropriate.patch (100%) rename 0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0044-macos-just-build-chainloader-entries-don-t-try-any-x.patch (100%) rename 0057-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0045-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (100%) rename 0058-export-btrfs_subvol-and-btrfs_subvolid.patch => 0046-export-btrfs_subvol-and-btrfs_subvolid.patch (100%) rename 0059-grub2-btrfs-03-follow_default.patch => 0047-grub2-btrfs-03-follow_default.patch (98%) rename 0060-grub2-btrfs-04-grub2-install.patch => 0048-grub2-btrfs-04-grub2-install.patch (98%) rename 0061-grub2-btrfs-05-grub2-mkconfig.patch => 0049-grub2-btrfs-05-grub2-mkconfig.patch (99%) rename 0062-grub2-btrfs-06-subvol-mount.patch => 0050-grub2-btrfs-06-subvol-mount.patch (99%) rename 0063-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0051-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (100%) rename 0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (98%) rename 0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0053-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (100%) rename 0066-Use-grub_efi_.-memory-helpers-where-reasonable.patch => 0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch (100%) rename 0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch => 0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch (100%) rename 0068-don-t-use-int-for-efi-status.patch => 0056-don-t-use-int-for-efi-status.patch (100%) rename 0069-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0057-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (100%) rename 0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0058-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (100%) rename 0071-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0059-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (100%) rename 0072-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch => 0060-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch (100%) rename 0073-align-struct-efi_variable-better.patch => 0061-align-struct-efi_variable-better.patch (100%) rename 0074-Add-BLS-support-to-grub-mkconfig.patch => 0062-Add-BLS-support-to-grub-mkconfig.patch (99%) rename 0075-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0063-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (100%) rename 0076-Add-linux-and-initrd-commands-for-grub-emu.patch => 0064-Add-linux-and-initrd-commands-for-grub-emu.patch (98%) rename 0077-Add-grub2-switch-to-blscfg.patch => 0065-Add-grub2-switch-to-blscfg.patch (100%) rename 0078-make-better-backtraces.patch => 0066-make-better-backtraces.patch (100%) rename 0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (89%) rename 0080-Work-around-some-minor-include-path-weirdnesses.patch => 0068-Work-around-some-minor-include-path-weirdnesses.patch (100%) rename 0081-Make-it-possible-to-enabled-build-id-sha1.patch => 0069-Make-it-possible-to-enabled-build-id-sha1.patch (100%) rename 0082-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0070-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (100%) rename 0083-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0071-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (100%) rename 0084-Fixup-for-newer-compiler.patch => 0072-Fixup-for-newer-compiler.patch (100%) rename 0085-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0073-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (100%) rename 0086-Fixup-for-newer-compiler.patch => 0074-Fixup-for-newer-compiler.patch (100%) rename 0087-Add-support-for-non-Ethernet-network-cards.patch => 0075-Add-support-for-non-Ethernet-network-cards.patch (100%) rename 0088-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0076-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (100%) rename 0089-bootp-New-net_bootp6-command.patch => 0077-bootp-New-net_bootp6-command.patch (100%) rename 0090-efinet-UEFI-IPv6-PXE-support.patch => 0078-efinet-UEFI-IPv6-PXE-support.patch (100%) rename 0091-grub.texi-Add-net_bootp6-doument.patch => 0079-grub.texi-Add-net_bootp6-doument.patch (100%) rename 0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0080-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (100%) rename 0093-efinet-Setting-network-from-UEFI-device-path.patch => 0081-efinet-Setting-network-from-UEFI-device-path.patch (100%) rename 0094-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0082-efinet-Setting-DNS-server-from-UEFI-protocol.patch (100%) rename 0095-Support-UEFI-networking-protocols.patch => 0083-Support-UEFI-networking-protocols.patch (100%) rename 0096-AUDIT-0-http-boot-tracker-bug.patch => 0084-AUDIT-0-http-boot-tracker-bug.patch (100%) rename 0097-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0085-grub-editenv-Add-incr-command-to-increment-integer-v.patch (100%) rename 0098-Add-auto-hide-menu-support.patch => 0086-Add-auto-hide-menu-support.patch (100%) rename 0099-Add-grub-set-bootflag-utility.patch => 0087-Add-grub-set-bootflag-utility.patch (100%) rename 0100-docs-Add-grub-boot-indeterminate.service-example.patch => 0088-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0101-gentpl-add-disable-support.patch => 0089-gentpl-add-disable-support.patch (100%) rename 0102-gentpl-add-pc-firmware-type.patch => 0090-gentpl-add-pc-firmware-type.patch (100%) rename 0103-efinet-also-use-the-firmware-acceleration-for-http.patch => 0091-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0104-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0092-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (100%) rename 0106-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0094-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0107-Rework-how-the-fdt-command-builds.patch => 0095-Rework-how-the-fdt-command-builds.patch (100%) rename 0108-Disable-non-wordsize-allocations-on-arm.patch => 0096-Disable-non-wordsize-allocations-on-arm.patch (100%) rename 0109-Prepend-prefix-when-HTTP-path-is-relative.patch => 0097-Prepend-prefix-when-HTTP-path-is-relative.patch (97%) rename 0110-Make-grub_error-more-verbose.patch => 0098-Make-grub_error-more-verbose.patch (100%) rename 0111-Make-reset-an-alias-for-the-reboot-command.patch => 0099-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0112-Add-a-version-command.patch => 0100-Add-a-version-command.patch (100%) rename 0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0101-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (100%) rename 0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0102-arm-arm64-loader-Better-memory-allocation-and-error-.patch (100%) rename 0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch (100%) rename 0116-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0104-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (100%) rename 0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (100%) rename 0118-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0106-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0119-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0107-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0120-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0108-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (100%) rename 0121-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0109-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (100%) rename 0122-Fix-getroot.c-s-trampolines.patch => 0110-Fix-getroot.c-s-trampolines.patch (100%) rename 0123-Do-not-allow-stack-trampolines-anywhere.patch => 0111-Do-not-allow-stack-trampolines-anywhere.patch (100%) rename 0124-Reimplement-boot_counter.patch => 0112-Reimplement-boot_counter.patch (100%) rename 0125-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0113-Fix-menu-entry-selection-based-on-ID-and-title.patch (100%) rename 0126-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0114-Make-the-menu-entry-users-option-argument-to-be-opti.patch (100%) rename 0127-Add-efi-export-env-and-efi-load-env-commands.patch => 0115-Add-efi-export-env-and-efi-load-env-commands.patch (100%) rename 0128-Make-it-possible-to-subtract-conditions-from-debug.patch => 0116-Make-it-possible-to-subtract-conditions-from-debug.patch (100%) rename 0129-Export-all-variables-from-the-initial-context-when-c.patch => 0117-Export-all-variables-from-the-initial-context-when-c.patch (100%) rename 0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (98%) rename 0131-Fix-systemctl-kexec-exit-status-check.patch => 0119-Fix-systemctl-kexec-exit-status-check.patch (100%) rename 0132-Print-grub-emu-linux-loader-messages-as-debug.patch => 0120-Print-grub-emu-linux-loader-messages-as-debug.patch (100%) rename 0133-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch (100%) rename 0134-Fix-undefined-references-for-fdt-when-building-with-.patch => 0122-Fix-undefined-references-for-fdt-when-building-with-.patch (100%) rename 0135-Do-better-in-bootstrap.conf.patch => 0123-Do-better-in-bootstrap.conf.patch (100%) rename 0136-Use-git-to-apply-gnulib-patches.patch => 0124-Use-git-to-apply-gnulib-patches.patch (100%) rename 0137-Fix-build-error-with-the-fdt-module-on-risc-v.patch => 0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch (100%) rename 0138-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0126-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) rename 0139-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0127-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) rename 0140-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (100%) rename 0141-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch => 0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch (100%) rename 0142-chainloader-Define-machine-types-for-RISC-V.patch => 0130-chainloader-Define-machine-types-for-RISC-V.patch (100%) rename 0143-Add-start-symbol-for-RISC-V.patch => 0131-Add-start-symbol-for-RISC-V.patch (100%) rename 0144-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0132-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (100%) rename 0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch (97%) rename 0146-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0134-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) rename 0147-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0135-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0148-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0136-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) rename 0149-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0137-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) rename 0150-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0138-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (100%) rename 0151-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0139-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (100%) rename 0152-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0140-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (100%) rename 0153-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0141-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (100%) rename 0154-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0142-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (100%) rename 0155-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0143-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (100%) rename 0156-efi-dhcp-fix-some-allocation-error-checking.patch => 0144-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0157-efi-http-fix-some-allocation-error-checking.patch => 0145-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0158-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0146-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0159-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0147-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (100%) rename 0160-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0148-linuxefi-fail-kernel-validation-without-shim-protoco.patch (100%) rename 0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0149-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (100%) rename 0162-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0150-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0163-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0151-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) rename 0164-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0152-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0165-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0153-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0166-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch (100%) rename 0167-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0155-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0168-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0156-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (100%) rename 0169-grub-install-disable-support-for-EFI-platforms.patch => 0157-grub-install-disable-support-for-EFI-platforms.patch (100%) rename 0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch (100%) rename 0171-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0159-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (100%) rename 0172-Introduce-function-grub_debug_is_enabled-void-return.patch => 0160-Introduce-function-grub_debug_is_enabled-void-return.patch (100%) rename 0173-Don-t-clear-screen-when-debugging-is-enabled.patch => 0161-Don-t-clear-screen-when-debugging-is-enabled.patch (55%) rename 0174-grub_file_-instrumentation-new-file-debug-tag.patch => 0162-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0175-ieee1275-Avoiding-many-unecessary-open-close.patch => 0163-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0176-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0164-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0177-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0165-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (97%) rename 0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch (98%) rename 0180-docs-grub-Document-signing-grub-under-UEFI.patch => 0168-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0169-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) rename 0182-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0170-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0183-pgp-factor-out-rsa_pad.patch => 0171-pgp-factor-out-rsa_pad.patch (100%) rename 0184-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0172-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0185-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0173-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0186-libtasn1-import-libtasn1-4.16.0.patch => 0174-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0187-libtasn1-disable-code-not-needed-in-grub.patch => 0175-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0188-libtasn1-changes-for-grub-compatibility.patch => 0176-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0189-libtasn1-compile-into-asn1-module.patch => 0177-libtasn1-compile-into-asn1-module.patch (100%) rename 0190-test_asn1-test-module-for-libtasn1.patch => 0178-test_asn1-test-module-for-libtasn1.patch (100%) rename 0191-grub-install-support-embedding-x509-certificates.patch => 0179-grub-install-support-embedding-x509-certificates.patch (98%) rename 0192-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0180-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0193-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0181-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0194-appended-signatures-support-verifying-appended-signa.patch => 0182-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0195-appended-signatures-verification-tests.patch => 0183-appended-signatures-verification-tests.patch (100%) rename 0196-appended-signatures-documentation.patch => 0184-appended-signatures-documentation.patch (100%) rename 0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0185-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (100%) rename 0198-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0186-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0199-ieee1275-claim-more-memory.patch => 0187-ieee1275-claim-more-memory.patch (100%) rename 0200-ieee1275-request-memory-with-ibm-client-architecture.patch => 0188-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) rename 0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0189-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) rename 0202-ieee1275-ofdisk-retry-on-open-failure.patch => 0190-ieee1275-ofdisk-retry-on-open-failure.patch (100%) rename 0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch => 0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch (100%) rename 0204-Fix-disabling-grub-rpm-sort.patch => 0192-Fix-disabling-grub-rpm-sort.patch (95%) rename 0205-Don-t-check-for-rpmvercmp-in-librpm.patch => 0193-Don-t-check-for-rpmvercmp-in-librpm.patch (100%) rename 0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch (97%) rename 0207-efinet-Add-DHCP-proxy-support.patch => 0195-efinet-Add-DHCP-proxy-support.patch (95%) rename 0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0196-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (97%) rename 0210-Suppress-gettext-error-message.patch => 0198-Suppress-gettext-error-message.patch (96%) rename 0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch => 0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch (100%) rename 0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0200-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) rename 0213-Remove-outdated-URL-for-BLS-document.patch => 0201-Remove-outdated-URL-for-BLS-document.patch (96%) rename 0214-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0202-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) rename 0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0203-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0204-arm64-Fix-EFI-loader-kernel-image-allocation.patch (100%) rename 0217-normal-main-Discover-the-device-to-read-the-config-f.patch => 0205-normal-main-Discover-the-device-to-read-the-config-f.patch (92%) rename 0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (98%) rename 0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch => 0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch (97%) rename 0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch => 0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch (100%) rename 0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) create mode 100644 0210-Print-module-name-on-license-check-failure.patch create mode 100644 0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/0023-Don-t-write-messages-to-the-screen.patch b/0023-Don-t-write-messages-to-the-screen.patch deleted file mode 100644 index 01d0264b..00000000 --- a/0023-Don-t-write-messages-to-the-screen.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Wed, 15 May 2013 13:30:20 -0400 -Subject: [PATCH] Don't write messages to the screen - -Writing messages to the screen before the menus or boot splash -happens so quickly it looks like something is wrong and isn't -very appealing. ---- - grub-core/gettext/gettext.c | 25 +++++-------------------- - grub-core/kern/main.c | 5 ----- - grub-core/boot/i386/pc/boot.S | 3 --- - grub-core/boot/i386/pc/diskboot.S | 5 ----- - util/grub.d/10_linux.in | 7 ------- - 5 files changed, 5 insertions(+), 40 deletions(-) - -diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c -index 4d02e62c109..84d520cd494 100644 ---- a/grub-core/gettext/gettext.c -+++ b/grub-core/gettext/gettext.c -@@ -434,16 +434,12 @@ static char * - grub_gettext_env_write_lang (struct grub_env_var *var - __attribute__ ((unused)), const char *val) - { -- grub_err_t err; -+ grub_err_t __attribute__((__unused__)) err; - err = grub_gettext_init_ext (&main_context, val, grub_env_get ("locale_dir"), - grub_env_get ("prefix")); -- if (err) -- grub_print_error (); - - err = grub_gettext_init_ext (&secondary_context, val, - grub_env_get ("secondary_locale_dir"), 0); -- if (err) -- grub_print_error (); - - return grub_strdup (val); - } -@@ -451,23 +447,19 @@ grub_gettext_env_write_lang (struct grub_env_var *var - void - grub_gettext_reread_prefix (const char *val) - { -- grub_err_t err; -+ grub_err_t __attribute__((__unused__)) err; - err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"), - grub_env_get ("locale_dir"), - val); -- if (err) -- grub_print_error (); - } - - static char * - read_main (struct grub_env_var *var - __attribute__ ((unused)), const char *val) - { -- grub_err_t err; -+ grub_err_t __attribute__((__unused__)) err; - err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"), val, - grub_env_get ("prefix")); -- if (err) -- grub_print_error (); - return grub_strdup (val); - } - -@@ -475,12 +467,9 @@ static char * - read_secondary (struct grub_env_var *var - __attribute__ ((unused)), const char *val) - { -- grub_err_t err; -+ grub_err_t __attribute__((__unused__)) err; - err = grub_gettext_init_ext (&secondary_context, grub_env_get ("lang"), val, - 0); -- if (err) -- grub_print_error (); -- - return grub_strdup (val); - } - -@@ -500,18 +489,14 @@ grub_cmd_translate (grub_command_t cmd __attribute__ ((unused)), - GRUB_MOD_INIT (gettext) - { - const char *lang; -- grub_err_t err; -+ grub_err_t __attribute__((__unused__)) err; - - lang = grub_env_get ("lang"); - - err = grub_gettext_init_ext (&main_context, lang, grub_env_get ("locale_dir"), - grub_env_get ("prefix")); -- if (err) -- grub_print_error (); - err = grub_gettext_init_ext (&secondary_context, lang, - grub_env_get ("secondary_locale_dir"), 0); -- if (err) -- grub_print_error (); - - grub_register_variable_hook ("locale_dir", NULL, read_main); - grub_register_variable_hook ("secondary_locale_dir", NULL, read_secondary); -diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index d1de9fa6873..48058d983ce 100644 ---- a/grub-core/kern/main.c -+++ b/grub-core/kern/main.c -@@ -269,11 +269,6 @@ grub_main (void) - - grub_boot_time ("After machine init."); - -- /* Hello. */ -- grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); -- grub_printf ("Welcome to GRUB!\n\n"); -- grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); -- - /* Init verifiers API. */ - grub_verifiers_init (); - -diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S -index 2bd0b2d2866..ea167fe1206 100644 ---- a/grub-core/boot/i386/pc/boot.S -+++ b/grub-core/boot/i386/pc/boot.S -@@ -249,9 +249,6 @@ real_start: - /* save drive reference first thing! */ - pushw %dx - -- /* print a notification message on the screen */ -- MSG(notification_string) -- - /* set %si to the disk address packet */ - movw $disk_address_packet, %si - -diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S -index c1addc0df29..68d31de0c4c 100644 ---- a/grub-core/boot/i386/pc/diskboot.S -+++ b/grub-core/boot/i386/pc/diskboot.S -@@ -50,11 +50,6 @@ _start: - /* save drive reference first thing! */ - pushw %dx - -- /* print a notification message on the screen */ -- pushw %si -- MSG(notification_string) -- popw %si -- - /* this sets up for the first run through "bootloop" */ - movw $LOCAL(firstlist), %di - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index dc75a1c30bf..ad2ac4b078d 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -138,27 +138,20 @@ linux_entry () - fi - printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" - fi -- message="$(gettext_printf "Loading Linux %s ..." ${version})" - sed "s/^/$submenu_indentation/" << EOF -- echo '$(echo "$message" | grub_quote)' - linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} - EOF - if test -n "${initrd}" ; then -- # TRANSLATORS: ramdisk isn't identifier. Should be translated. -- message="$(gettext_printf "Loading initial ramdisk ...")" - initrd_path= - for i in ${initrd}; do - initrd_path="${initrd_path} ${rel_dirname}/${i}" - done - sed "s/^/$submenu_indentation/" << EOF -- echo '$(echo "$message" | grub_quote)' - initrd $(echo $initrd_path) - EOF - fi - if test -n "${fdt}" ; then -- message="$(gettext_printf "Loading fdt ...")" - sed "s/^/$submenu_indentation/" << EOF -- echo '$(echo "$message" | grub_quote)' - devicetree ${rel_dirname}/${fdt} - EOF - fi diff --git a/0032-Enable-pager-by-default.-985860.patch b/0023-Enable-pager-by-default.-985860.patch similarity index 100% rename from 0032-Enable-pager-by-default.-985860.patch rename to 0023-Enable-pager-by-default.-985860.patch diff --git a/0024-Don-t-print-GNU-GRUB-header.patch b/0024-Don-t-print-GNU-GRUB-header.patch deleted file mode 100644 index c903fd48..00000000 --- a/0024-Don-t-print-GNU-GRUB-header.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Wed, 15 May 2013 13:53:48 -0400 -Subject: [PATCH] Don't print GNU GRUB header - -No one cares. ---- - grub-core/normal/main.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 7ca2e5400b1..5d5f7b539f5 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -208,15 +208,16 @@ read_config_file (const char *config) - /* Initialize the screen. */ - void - grub_normal_init_page (struct grub_term_output *term, -- int y) -+ int y __attribute__((__unused__))) - { -+ grub_term_cls (term); -+ -+#if 0 - grub_ssize_t msg_len; - int posx; - char *msg_formatted; - grub_uint32_t *unicode_msg; - grub_uint32_t *last_position; -- -- grub_term_cls (term); - - msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); - if (!msg_formatted) -@@ -241,6 +242,7 @@ grub_normal_init_page (struct grub_term_output *term, - grub_putcode ('\n', term); - grub_putcode ('\n', term); - grub_free (unicode_msg); -+#endif - } - - static void diff --git a/0034-Don-t-say-GNU-Linux-in-generated-menus.patch b/0024-Don-t-say-GNU-Linux-in-generated-menus.patch similarity index 97% rename from 0034-Don-t-say-GNU-Linux-in-generated-menus.patch rename to 0024-Don-t-say-GNU-Linux-in-generated-menus.patch index db2a8b5b..f2880950 100644 --- a/0034-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0024-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus. 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index ad2ac4b078d..4fc58c83304 100644 +index dc75a1c30bf..4a499c53a61 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0037-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch similarity index 100% rename from 0037-Add-.eh_frame-to-list-of-relocations-stripped.patch rename to 0025-Add-.eh_frame-to-list-of-relocations-stripped.patch diff --git a/0025-Don-t-add-to-highlighted-row.patch b/0025-Don-t-add-to-highlighted-row.patch deleted file mode 100644 index b83f543e..00000000 --- a/0025-Don-t-add-to-highlighted-row.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Wed, 15 May 2013 17:49:45 -0400 -Subject: [PATCH] Don't add '*' to highlighted row - -It is already highlighted. ---- - grub-core/normal/menu_text.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 18240e76cea..65deafda531 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, - unicode_title[i] = ' '; - - if (data->geo.num_entries > 1) -- grub_putcode (highlight ? '*' : ' ', data->term); -+ grub_putcode (' ', data->term); - - grub_print_ucs4_menu (unicode_title, - unicode_title + len, diff --git a/0038-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch similarity index 96% rename from 0038-Don-t-require-a-password-to-boot-entries-generated-b.patch rename to 0026-Don-t-require-a-password-to-boot-entries-generated-b.patch index fb0e1976..ac9475e3 100644 --- a/0038-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 4fc58c83304..635d2fe0cd3 100644 +index 4a499c53a61..cf8d1186981 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -26,7 +26,7 @@ datarootdir="@datarootdir@" diff --git a/0026-Message-string-cleanups.patch b/0026-Message-string-cleanups.patch deleted file mode 100644 index e23ee1ad..00000000 --- a/0026-Message-string-cleanups.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Fri, 7 Jun 2013 11:09:04 -0400 -Subject: [PATCH] Message string cleanups - -Make use of terminology consistent. Remove jargon. ---- - grub-core/normal/menu_text.c | 21 +++++++++------------ - 1 file changed, 9 insertions(+), 12 deletions(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 65deafda531..cc5837ed2b8 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -157,9 +157,8 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run) - - if (edit) - { -- ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \ --supported. TAB lists completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a \ --command-line or ESC to discard edits and return to the GRUB menu."), -+ ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \ -+command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."), - STANDARD_MARGIN, STANDARD_MARGIN, - term, dry_run); - } -@@ -167,8 +166,8 @@ command-line or ESC to discard edits and return to the GRUB menu."), - { - char *msg_translated; - -- msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which " -- "entry is highlighted."), -+ msg_translated = grub_xasprintf (_("Use the %C and %C keys to change the " -+ "selection."), - GRUB_UNICODE_UPARROW, - GRUB_UNICODE_DOWNARROW); - if (!msg_translated) -@@ -181,17 +180,15 @@ command-line or ESC to discard edits and return to the GRUB menu."), - if (nested) - { - ret += grub_print_message_indented_real -- (_("Press enter to boot the selected OS, " -- "`e' to edit the commands before booting " -- "or `c' for a command-line. ESC to return previous menu."), -+ (_("Press 'e' to edit the selected item, " -+ "or 'c' for a command prompt. Press Escape to return to the previous menu."), - STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); - } - else - { - ret += grub_print_message_indented_real -- (_("Press enter to boot the selected OS, " -- "`e' to edit the commands before booting " -- "or `c' for a command-line."), -+ (_("Press 'e' to edit the selected item, " -+ "or 'c' for a command prompt."), - STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); - } - } -@@ -443,7 +440,7 @@ menu_text_print_timeout (int timeout, void *dataptr) - || data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN) - msg_translated = grub_xasprintf (_("%ds"), timeout); - else -- msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout); -+ msg_translated = grub_xasprintf (_("The selected entry will be started automatically in %ds."), timeout); - if (!msg_translated) - { - grub_print_error (); diff --git a/0039-Don-t-emit-Booting-.-message.patch b/0027-Don-t-emit-Booting-.-message.patch similarity index 100% rename from 0039-Don-t-emit-Booting-.-message.patch rename to 0027-Don-t-emit-Booting-.-message.patch diff --git a/0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch b/0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch deleted file mode 100644 index 920ef797..00000000 --- a/0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Fri, 7 Jun 2013 14:08:23 -0400 -Subject: [PATCH] Fix border spacing now that we aren't displaying it - ---- - grub-core/normal/menu_text.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index cc5837ed2b8..b49835a9af7 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -331,12 +331,12 @@ grub_menu_init_page (int nested, int edit, - int empty_lines = 1; - int version_msg = 1; - -- geo->border = 1; -- geo->first_entry_x = 1 /* margin */ + 1 /* border */; -+ geo->border = 0; -+ geo->first_entry_x = 0 /* margin */ + 0 /* border */; - geo->entry_width = grub_term_width (term) - 5; - - geo->first_entry_y = 2 /* two empty lines*/ -- + 1 /* GNU GRUB version text */ + 1 /* top border */; -+ + 0 /* GNU GRUB version text */ + 1 /* top border */; - - geo->timeout_lines = 2; - diff --git a/0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0028-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch similarity index 100% rename from 0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch rename to 0028-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch diff --git a/0028-Use-the-correct-indentation-for-the-term-help-text.patch b/0028-Use-the-correct-indentation-for-the-term-help-text.patch deleted file mode 100644 index 0ce3b048..00000000 --- a/0028-Use-the-correct-indentation-for-the-term-help-text.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Fri, 7 Jun 2013 14:08:49 -0400 -Subject: [PATCH] Use the correct indentation for the term help text - -That is consistent with the menu help text ---- - grub-core/normal/main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 5d5f7b539f5..ec1cd257397 100644 ---- a/grub-core/normal/main.c -+++ b/grub-core/normal/main.c -@@ -440,8 +440,8 @@ grub_normal_reader_init (int nested) - grub_normal_init_page (term, 1); - grub_term_setcursor (term, 1); - -- if (grub_term_width (term) > 3 + STANDARD_MARGIN + 20) -- grub_print_message_indented (msg_formatted, 3, STANDARD_MARGIN, term); -+ if (grub_term_width (term) > 2 * STANDARD_MARGIN + 20) -+ grub_print_message_indented (msg_formatted, STANDARD_MARGIN, STANDARD_MARGIN, term); - else - grub_print_message_indented (msg_formatted, 0, 0, term); - grub_putcode ('\n', term); diff --git a/0029-Indent-menu-entries.patch b/0029-Indent-menu-entries.patch deleted file mode 100644 index 7e588fd0..00000000 --- a/0029-Indent-menu-entries.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Fri, 7 Jun 2013 14:30:55 -0400 -Subject: [PATCH] Indent menu entries - ---- - grub-core/normal/menu_text.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index b49835a9af7..6a57376fa80 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -239,7 +239,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, - unicode_title[i] = ' '; - - if (data->geo.num_entries > 1) -- grub_putcode (' ', data->term); -+ for (i = 0; i < STANDARD_MARGIN; i++) -+ grub_putcode (' ', data->term); - - grub_print_ucs4_menu (unicode_title, - unicode_title + len, diff --git a/0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch similarity index 89% rename from 0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch rename to 0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index 985205c1..6b1580bb 100644 --- a/0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -17,10 +17,10 @@ Signed-off-by: Mark Salter 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index ec1cd257397..d85f7598d23 100644 +index 7ca2e5400b1..02577502116 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -349,7 +349,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), +@@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), char *config; const char *prefix, *fw_path; @@ -29,7 +29,7 @@ index ec1cd257397..d85f7598d23 100644 if (fw_path) { config = grub_xasprintf ("%s/grub.cfg", fw_path); -@@ -372,7 +372,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), +@@ -370,7 +370,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), } } diff --git a/0030-Fix-margins.patch b/0030-Fix-margins.patch deleted file mode 100644 index baa10edf..00000000 --- a/0030-Fix-margins.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Fri, 7 Jun 2013 14:59:36 -0400 -Subject: [PATCH] Fix margins - ---- - grub-core/normal/menu_text.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 6a57376fa80..cbd62f714cb 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -333,17 +333,15 @@ grub_menu_init_page (int nested, int edit, - int version_msg = 1; - - geo->border = 0; -- geo->first_entry_x = 0 /* margin */ + 0 /* border */; -- geo->entry_width = grub_term_width (term) - 5; -+ geo->first_entry_x = 0; /* no margin */ -+ geo->entry_width = grub_term_width (term) - 1; - -- geo->first_entry_y = 2 /* two empty lines*/ -- + 0 /* GNU GRUB version text */ + 1 /* top border */; -+ geo->first_entry_y = 3; /* three empty lines*/ - - geo->timeout_lines = 2; - - /* 3 lines for timeout message and bottom margin. 2 lines for the border. */ - geo->num_entries = grub_term_height (term) - geo->first_entry_y -- - 1 /* bottom border */ - - 1 /* empty line before info message*/ - - geo->timeout_lines /* timeout */ - - 1 /* empty final line */; diff --git a/0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch similarity index 97% rename from 0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch rename to 0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index 61dd5caa..ab49bb19 100644 --- a/0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index d85f7598d23..1e509fceb91 100644 +index 02577502116..880d0ebd454 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -347,61 +347,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), +@@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), /* Guess the config filename. It is necessary to make CONFIG static, so that it won't get broken by longjmp. */ char *config; diff --git a/0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch similarity index 96% rename from 0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch rename to 0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index ef0b0f4b..245faf7e 100644 --- a/0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 635d2fe0cd3..fed73271478 100644 +index cf8d1186981..5f6d3c8d52d 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch b/0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch deleted file mode 100644 index 79321807..00000000 --- a/0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 21 Jun 2013 14:44:08 -0400 -Subject: [PATCH] Use -2 instead of -1 for our right-hand margin, so - linewrapping works (#976643). - -Signed-off-by: Peter Jones ---- - grub-core/normal/menu_text.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index cbd62f714cb..26e9e82042a 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -334,7 +334,7 @@ grub_menu_init_page (int nested, int edit, - - geo->border = 0; - geo->first_entry_x = 0; /* no margin */ -- geo->entry_width = grub_term_width (term) - 1; -+ geo->entry_width = grub_term_width (term) - 2; - - geo->first_entry_y = 3; /* three empty lines*/ - diff --git a/0044-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0032-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch similarity index 100% rename from 0044-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch rename to 0032-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch diff --git a/0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch b/0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch deleted file mode 100644 index 7e9e8294..00000000 --- a/0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 28 Oct 2013 10:13:27 -0400 -Subject: [PATCH] F10 doesn't work on serial, so don't tell the user to hit it - (#987443) - -Signed-off-by: Peter Jones ---- - grub-core/normal/menu_text.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 26e9e82042a..4895ffe7d1d 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -157,7 +157,7 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run) - - if (edit) - { -- ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \ -+ ret += grub_print_message_indented_real (_("Press Ctrl-x to start, Ctrl-c for a \ - command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."), - STANDARD_MARGIN, STANDARD_MARGIN, - term, dry_run); diff --git a/0045-Try-prefix-if-fw_path-doesn-t-work.patch b/0033-Try-prefix-if-fw_path-doesn-t-work.patch similarity index 98% rename from 0045-Try-prefix-if-fw_path-doesn-t-work.patch rename to 0033-Try-prefix-if-fw_path-doesn-t-work.patch index 59489bd9..54a876ba 100644 --- a/0045-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0033-Try-prefix-if-fw_path-doesn-t-work.patch @@ -69,10 +69,10 @@ index 4d3eb5c1a52..0ef148f4adc 100644 static struct grub_preboot *fini_hnd; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 1e509fceb91..d5968797f4f 100644 +index 880d0ebd454..d5df4f815b0 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -337,81 +337,79 @@ grub_enter_normal_mode (const char *config) +@@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config) grub_boot_time ("Exiting normal mode"); } diff --git a/0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch similarity index 100% rename from 0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch rename to 0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch diff --git a/0035-Don-t-draw-a-border-around-the-menu.patch b/0035-Don-t-draw-a-border-around-the-menu.patch deleted file mode 100644 index 31a973ea..00000000 --- a/0035-Don-t-draw-a-border-around-the-menu.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Wed, 15 May 2013 16:47:33 -0400 -Subject: [PATCH] Don't draw a border around the menu - -It looks cleaner without it. ---- - grub-core/normal/menu_text.c | 43 ------------------------------------------- - 1 file changed, 43 deletions(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index 4895ffe7d1d..e72ed438ba3 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -108,47 +108,6 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right, - grub_print_message_indented_real (msg, margin_left, margin_right, term, 0); - } - --static void --draw_border (struct grub_term_output *term, const struct grub_term_screen_geometry *geo) --{ -- int i; -- -- grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); -- -- grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1, -- geo->first_entry_y - 1 }); -- grub_putcode (GRUB_UNICODE_CORNER_UL, term); -- for (i = 0; i < geo->entry_width + 1; i++) -- grub_putcode (GRUB_UNICODE_HLINE, term); -- grub_putcode (GRUB_UNICODE_CORNER_UR, term); -- -- for (i = 0; i < geo->num_entries; i++) -- { -- grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1, -- geo->first_entry_y + i }); -- grub_putcode (GRUB_UNICODE_VLINE, term); -- grub_term_gotoxy (term, -- (struct grub_term_coordinate) { geo->first_entry_x + geo->entry_width + 1, -- geo->first_entry_y + i }); -- grub_putcode (GRUB_UNICODE_VLINE, term); -- } -- -- grub_term_gotoxy (term, -- (struct grub_term_coordinate) { geo->first_entry_x - 1, -- geo->first_entry_y - 1 + geo->num_entries + 1 }); -- grub_putcode (GRUB_UNICODE_CORNER_LL, term); -- for (i = 0; i < geo->entry_width + 1; i++) -- grub_putcode (GRUB_UNICODE_HLINE, term); -- grub_putcode (GRUB_UNICODE_CORNER_LR, term); -- -- grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); -- -- grub_term_gotoxy (term, -- (struct grub_term_coordinate) { geo->first_entry_x - 1, -- (geo->first_entry_y - 1 + geo->num_entries -- + GRUB_TERM_MARGIN + 1) }); --} -- - static int - print_message (int nested, int edit, struct grub_term_output *term, int dry_run) - { -@@ -406,8 +365,6 @@ grub_menu_init_page (int nested, int edit, - - grub_term_normal_color = grub_color_menu_normal; - grub_term_highlight_color = grub_color_menu_highlight; -- if (geo->border) -- draw_border (term, geo); - grub_term_normal_color = old_color_normal; - grub_term_highlight_color = old_color_highlight; - geo->timeout_y = geo->first_entry_y + geo->num_entries diff --git a/0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 98% rename from 0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index 4c474e4b..4eb37e1e 100644 --- a/0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index fed73271478..2e59f3b4197 100644 +index 5f6d3c8d52d..786dbabb4a8 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -78,6 +78,32 @@ case x"$GRUB_FS" in diff --git a/0048-Add-friendly-grub2-password-config-tool-985962.patch b/0036-Add-friendly-grub2-password-config-tool-985962.patch similarity index 100% rename from 0048-Add-friendly-grub2-password-config-tool-985962.patch rename to 0036-Add-friendly-grub2-password-config-tool-985962.patch diff --git a/0036-Use-the-standard-margin-for-the-timeout-string.patch b/0036-Use-the-standard-margin-for-the-timeout-string.patch deleted file mode 100644 index 49a382d8..00000000 --- a/0036-Use-the-standard-margin-for-the-timeout-string.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Jon McCann -Date: Fri, 7 Jun 2013 10:52:32 -0400 -Subject: [PATCH] Use the standard margin for the timeout string - -So that it aligns with the other messages ---- - grub-core/normal/menu_text.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index e72ed438ba3..ca135624356 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -372,7 +372,7 @@ grub_menu_init_page (int nested, int edit, - if (bottom_message) - { - grub_term_gotoxy (term, -- (struct grub_term_coordinate) { GRUB_TERM_MARGIN, -+ (struct grub_term_coordinate) { STANDARD_MARGIN, - geo->timeout_y }); - - print_message (nested, edit, term, 0); -@@ -407,14 +407,14 @@ menu_text_print_timeout (int timeout, void *dataptr) - if (data->timeout_msg == TIMEOUT_UNKNOWN) - { - data->timeout_msg = grub_print_message_indented_real (msg_translated, -- 3, 1, data->term, 1) -+ STANDARD_MARGIN, 1, data->term, 1) - <= data->geo.timeout_lines ? TIMEOUT_NORMAL : TIMEOUT_TERSE; - if (data->timeout_msg == TIMEOUT_TERSE) - { - grub_free (msg_translated); - msg_translated = grub_xasprintf (_("%ds"), timeout); - if (grub_term_width (data->term) < 10) -- data->timeout_msg = TIMEOUT_TERSE_NO_MARGIN; -+ data->timeout_msg = STANDARD_MARGIN; - } - } - diff --git a/0049-tcp-add-window-scaling-support.patch b/0037-tcp-add-window-scaling-support.patch similarity index 100% rename from 0049-tcp-add-window-scaling-support.patch rename to 0037-tcp-add-window-scaling-support.patch diff --git a/0050-efinet-and-bootp-add-support-for-dhcpv6.patch b/0038-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 100% rename from 0050-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0038-efinet-and-bootp-add-support-for-dhcpv6.patch diff --git a/0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 98% rename from 0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index e799ac1a..f203685b 100644 --- a/0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -235,7 +235,7 @@ index ba14cf6261c..005f093809b 100644 if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then GRUB_DISABLE_LINUX_UUID="true" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 2e59f3b4197..0f3c19e30cc 100644 +index 786dbabb4a8..292e333324b 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -111,7 +111,8 @@ linux_entry () @@ -258,7 +258,7 @@ index 2e59f3b4197..0f3c19e30cc 100644 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" else echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -@@ -299,11 +303,15 @@ while [ "x$list" != "x" ] ; do +@@ -306,11 +310,15 @@ while [ "x$list" != "x" ] ; do fi if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then @@ -276,7 +276,7 @@ index 2e59f3b4197..0f3c19e30cc 100644 if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi -@@ -312,10 +320,15 @@ while [ "x$list" != "x" ] ; do +@@ -319,10 +327,15 @@ while [ "x$list" != "x" ] ; do is_top_level=false fi diff --git a/0052-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0040-bz1374141-fix-incorrect-mask-for-ppc64.patch similarity index 100% rename from 0052-bz1374141-fix-incorrect-mask-for-ppc64.patch rename to 0040-bz1374141-fix-incorrect-mask-for-ppc64.patch diff --git a/0053-Make-grub_fatal-also-backtrace.patch b/0041-Make-grub_fatal-also-backtrace.patch similarity index 100% rename from 0053-Make-grub_fatal-also-backtrace.patch rename to 0041-Make-grub_fatal-also-backtrace.patch diff --git a/0054-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0042-Fix-up-some-man-pages-rpmdiff-noticed.patch similarity index 100% rename from 0054-Fix-up-some-man-pages-rpmdiff-noticed.patch rename to 0042-Fix-up-some-man-pages-rpmdiff-noticed.patch diff --git a/0055-Make-our-info-pages-say-grub2-where-appropriate.patch b/0043-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 100% rename from 0055-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0043-Make-our-info-pages-say-grub2-where-appropriate.patch diff --git a/0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0044-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 100% rename from 0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0044-macos-just-build-chainloader-entries-don-t-try-any-x.patch diff --git a/0057-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0045-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 100% rename from 0057-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0045-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch diff --git a/0058-export-btrfs_subvol-and-btrfs_subvolid.patch b/0046-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 100% rename from 0058-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0046-export-btrfs_subvol-and-btrfs_subvolid.patch diff --git a/0059-grub2-btrfs-03-follow_default.patch b/0047-grub2-btrfs-03-follow_default.patch similarity index 98% rename from 0059-grub2-btrfs-03-follow_default.patch rename to 0047-grub2-btrfs-03-follow_default.patch index 2b9a1364..ca203f4a 100644 --- a/0059-grub2-btrfs-03-follow_default.patch +++ b/0047-grub2-btrfs-03-follow_default.patch @@ -3,6 +3,8 @@ From: Michael Chang Date: Thu, 21 Aug 2014 03:39:11 +0000 Subject: [PATCH] grub2-btrfs-03-follow_default +Signed-off-by: Michael Chang +Signed-off-by: Robbie Harwood --- grub-core/fs/btrfs.c | 107 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 31 deletions(-) diff --git a/0060-grub2-btrfs-04-grub2-install.patch b/0048-grub2-btrfs-04-grub2-install.patch similarity index 98% rename from 0060-grub2-btrfs-04-grub2-install.patch rename to 0048-grub2-btrfs-04-grub2-install.patch index f91c31a8..451f61d7 100644 --- a/0060-grub2-btrfs-04-grub2-install.patch +++ b/0048-grub2-btrfs-04-grub2-install.patch @@ -3,6 +3,8 @@ From: Michael Chang Date: Thu, 21 Aug 2014 03:39:11 +0000 Subject: [PATCH] grub2-btrfs-04-grub2-install +Signed-off-by: Michael Chang +Signed-off-by: Robbie Harwood --- grub-core/osdep/linux/getroot.c | 7 +++++++ grub-core/osdep/unix/config.c | 17 +++++++++++++++-- diff --git a/0061-grub2-btrfs-05-grub2-mkconfig.patch b/0049-grub2-btrfs-05-grub2-mkconfig.patch similarity index 99% rename from 0061-grub2-btrfs-05-grub2-mkconfig.patch rename to 0049-grub2-btrfs-05-grub2-mkconfig.patch index 8270505d..5afd183c 100644 --- a/0061-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0049-grub2-btrfs-05-grub2-mkconfig.patch @@ -90,7 +90,7 @@ index 858b526c925..de727e6ee6b 100644 +EOF +fi diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 0f3c19e30cc..cbfaca34cc7 100644 +index 292e333324b..7bb3a211a7c 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -66,10 +66,14 @@ fi diff --git a/0062-grub2-btrfs-06-subvol-mount.patch b/0050-grub2-btrfs-06-subvol-mount.patch similarity index 99% rename from 0062-grub2-btrfs-06-subvol-mount.patch rename to 0050-grub2-btrfs-06-subvol-mount.patch index 9a511759..14117ab4 100644 --- a/0062-grub2-btrfs-06-subvol-mount.patch +++ b/0050-grub2-btrfs-06-subvol-mount.patch @@ -3,6 +3,8 @@ From: Michael Chang Date: Tue, 9 Jul 2019 13:56:16 +0200 Subject: [PATCH] grub2-btrfs-06-subvol-mount +Signed-off-by: Michael Chang +Signed-off-by: Robbie Harwood --- grub-core/fs/btrfs.c | 195 +++++++++++++++++++++++++++++++++++++++- grub-core/osdep/linux/getroot.c | 148 +++++++++++++++++++++++++++++- diff --git a/0063-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0051-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 100% rename from 0063-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0051-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch diff --git a/0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 98% rename from 0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch index d4e20cd5..b54b1960 100644 --- a/0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +++ b/0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch @@ -3,6 +3,8 @@ From: Michael Chang Date: Thu, 11 May 2017 08:56:57 +0000 Subject: [PATCH] Grub not working correctly with btrfs snapshots (bsc#1026511) +Signed-off-by: Michael Chang +Signed-off-by: Robbie Harwood --- grub-core/fs/btrfs.c | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) diff --git a/0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0053-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 100% rename from 0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0053-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch diff --git a/0066-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch similarity index 100% rename from 0066-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename to 0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch diff --git a/0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch similarity index 100% rename from 0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename to 0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch diff --git a/0068-don-t-use-int-for-efi-status.patch b/0056-don-t-use-int-for-efi-status.patch similarity index 100% rename from 0068-don-t-use-int-for-efi-status.patch rename to 0056-don-t-use-int-for-efi-status.patch diff --git a/0069-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0057-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 100% rename from 0069-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0057-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch diff --git a/0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0058-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 100% rename from 0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0058-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch diff --git a/0071-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0059-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 100% rename from 0071-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0059-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch diff --git a/0072-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0060-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch similarity index 100% rename from 0072-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename to 0060-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch diff --git a/0073-align-struct-efi_variable-better.patch b/0061-align-struct-efi_variable-better.patch similarity index 100% rename from 0073-align-struct-efi_variable-better.patch rename to 0061-align-struct-efi_variable-better.patch diff --git a/0074-Add-BLS-support-to-grub-mkconfig.patch b/0062-Add-BLS-support-to-grub-mkconfig.patch similarity index 99% rename from 0074-Add-BLS-support-to-grub-mkconfig.patch rename to 0062-Add-BLS-support-to-grub-mkconfig.patch index 6c65440b..9679fb9f 100644 --- a/0074-Add-BLS-support-to-grub-mkconfig.patch +++ b/0062-Add-BLS-support-to-grub-mkconfig.patch @@ -141,7 +141,7 @@ index fafeac95061..d8bb4069360 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index cbfaca34cc7..68adb55d893 100644 +index 7bb3a211a7c..fdf324b7ab1 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -82,6 +82,223 @@ case x"$GRUB_FS" in @@ -376,7 +376,7 @@ index cbfaca34cc7..68adb55d893 100644 if [ x$type != xsimple ] ; then title=$(mktitle "$type" "$version") if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then -@@ -224,6 +442,7 @@ is_top_level=true +@@ -231,6 +449,7 @@ is_top_level=true while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` gettext_printf "Found linux image: %s\n" "$linux" >&2 @@ -384,7 +384,7 @@ index cbfaca34cc7..68adb55d893 100644 basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` -@@ -262,7 +481,9 @@ while [ "x$list" != "x" ] ; do +@@ -269,7 +488,9 @@ while [ "x$list" != "x" ] ; do for i in ${initrd}; do initrd_display="${initrd_display} ${dirname}/${i}" done diff --git a/0075-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0063-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 100% rename from 0075-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0063-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch diff --git a/0076-Add-linux-and-initrd-commands-for-grub-emu.patch b/0064-Add-linux-and-initrd-commands-for-grub-emu.patch similarity index 98% rename from 0076-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0064-Add-linux-and-initrd-commands-for-grub-emu.patch index dd69b130..2431a4d7 100644 --- a/0076-Add-linux-and-initrd-commands-for-grub-emu.patch +++ b/0064-Add-linux-and-initrd-commands-for-grub-emu.patch @@ -1,10 +1,13 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Chang +From: Raymund Will Date: Tue, 6 Feb 2018 09:09:00 +0100 Subject: [PATCH] Add linux and initrd commands for grub-emu When using grub-emu, the linux and initrd commands are used as arguments to the kexec command line tool, to allow booting the selected menu entry. + +Signed-off-by: Raymund Will +Signed-off-by: Robbie Harwood --- grub-core/Makefile.core.def | 1 - grub-core/kern/emu/main.c | 4 + diff --git a/0077-Add-grub2-switch-to-blscfg.patch b/0065-Add-grub2-switch-to-blscfg.patch similarity index 100% rename from 0077-Add-grub2-switch-to-blscfg.patch rename to 0065-Add-grub2-switch-to-blscfg.patch diff --git a/0078-make-better-backtraces.patch b/0066-make-better-backtraces.patch similarity index 100% rename from 0078-make-better-backtraces.patch rename to 0066-make-better-backtraces.patch diff --git a/0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 89% rename from 0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch index 9922f2bb..9ebfc7ae 100644 --- a/0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +++ b/0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch @@ -8,10 +8,10 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set 1 file changed, 3 insertions(+) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index d5968797f4f..e349303c29b 100644 +index d5df4f815b0..1970e4816a8 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -432,6 +432,9 @@ grub_normal_reader_init (int nested) +@@ -430,6 +430,9 @@ grub_normal_reader_init (int nested) const char *msg_esc = _("ESC at any time exits."); char *msg_formatted; diff --git a/0080-Work-around-some-minor-include-path-weirdnesses.patch b/0068-Work-around-some-minor-include-path-weirdnesses.patch similarity index 100% rename from 0080-Work-around-some-minor-include-path-weirdnesses.patch rename to 0068-Work-around-some-minor-include-path-weirdnesses.patch diff --git a/0081-Make-it-possible-to-enabled-build-id-sha1.patch b/0069-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 100% rename from 0081-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0069-Make-it-possible-to-enabled-build-id-sha1.patch diff --git a/0082-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0070-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 100% rename from 0082-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0070-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch diff --git a/0083-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0071-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 100% rename from 0083-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0071-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch diff --git a/0084-Fixup-for-newer-compiler.patch b/0072-Fixup-for-newer-compiler.patch similarity index 100% rename from 0084-Fixup-for-newer-compiler.patch rename to 0072-Fixup-for-newer-compiler.patch diff --git a/0085-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0073-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 100% rename from 0085-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0073-Don-t-attempt-to-export-the-start-and-_start-symbols.patch diff --git a/0086-Fixup-for-newer-compiler.patch b/0074-Fixup-for-newer-compiler.patch similarity index 100% rename from 0086-Fixup-for-newer-compiler.patch rename to 0074-Fixup-for-newer-compiler.patch diff --git a/0087-Add-support-for-non-Ethernet-network-cards.patch b/0075-Add-support-for-non-Ethernet-network-cards.patch similarity index 100% rename from 0087-Add-support-for-non-Ethernet-network-cards.patch rename to 0075-Add-support-for-non-Ethernet-network-cards.patch diff --git a/0088-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0076-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 100% rename from 0088-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0076-net-read-bracketed-ipv6-addrs-and-port-numbers.patch diff --git a/0089-bootp-New-net_bootp6-command.patch b/0077-bootp-New-net_bootp6-command.patch similarity index 100% rename from 0089-bootp-New-net_bootp6-command.patch rename to 0077-bootp-New-net_bootp6-command.patch diff --git a/0090-efinet-UEFI-IPv6-PXE-support.patch b/0078-efinet-UEFI-IPv6-PXE-support.patch similarity index 100% rename from 0090-efinet-UEFI-IPv6-PXE-support.patch rename to 0078-efinet-UEFI-IPv6-PXE-support.patch diff --git a/0091-grub.texi-Add-net_bootp6-doument.patch b/0079-grub.texi-Add-net_bootp6-doument.patch similarity index 100% rename from 0091-grub.texi-Add-net_bootp6-doument.patch rename to 0079-grub.texi-Add-net_bootp6-doument.patch diff --git a/0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0080-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 100% rename from 0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0080-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch diff --git a/0093-efinet-Setting-network-from-UEFI-device-path.patch b/0081-efinet-Setting-network-from-UEFI-device-path.patch similarity index 100% rename from 0093-efinet-Setting-network-from-UEFI-device-path.patch rename to 0081-efinet-Setting-network-from-UEFI-device-path.patch diff --git a/0094-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0082-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 100% rename from 0094-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0082-efinet-Setting-DNS-server-from-UEFI-protocol.patch diff --git a/0095-Support-UEFI-networking-protocols.patch b/0083-Support-UEFI-networking-protocols.patch similarity index 100% rename from 0095-Support-UEFI-networking-protocols.patch rename to 0083-Support-UEFI-networking-protocols.patch diff --git a/0096-AUDIT-0-http-boot-tracker-bug.patch b/0084-AUDIT-0-http-boot-tracker-bug.patch similarity index 100% rename from 0096-AUDIT-0-http-boot-tracker-bug.patch rename to 0084-AUDIT-0-http-boot-tracker-bug.patch diff --git a/0097-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0085-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 100% rename from 0097-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0085-grub-editenv-Add-incr-command-to-increment-integer-v.patch diff --git a/0098-Add-auto-hide-menu-support.patch b/0086-Add-auto-hide-menu-support.patch similarity index 100% rename from 0098-Add-auto-hide-menu-support.patch rename to 0086-Add-auto-hide-menu-support.patch diff --git a/0099-Add-grub-set-bootflag-utility.patch b/0087-Add-grub-set-bootflag-utility.patch similarity index 100% rename from 0099-Add-grub-set-bootflag-utility.patch rename to 0087-Add-grub-set-bootflag-utility.patch diff --git a/0100-docs-Add-grub-boot-indeterminate.service-example.patch b/0088-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0100-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0088-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0101-gentpl-add-disable-support.patch b/0089-gentpl-add-disable-support.patch similarity index 100% rename from 0101-gentpl-add-disable-support.patch rename to 0089-gentpl-add-disable-support.patch diff --git a/0102-gentpl-add-pc-firmware-type.patch b/0090-gentpl-add-pc-firmware-type.patch similarity index 100% rename from 0102-gentpl-add-pc-firmware-type.patch rename to 0090-gentpl-add-pc-firmware-type.patch diff --git a/0103-efinet-also-use-the-firmware-acceleration-for-http.patch b/0091-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0103-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0091-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0104-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0092-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0104-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0092-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 100% rename from 0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch diff --git a/0106-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0094-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0106-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0094-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0107-Rework-how-the-fdt-command-builds.patch b/0095-Rework-how-the-fdt-command-builds.patch similarity index 100% rename from 0107-Rework-how-the-fdt-command-builds.patch rename to 0095-Rework-how-the-fdt-command-builds.patch diff --git a/0108-Disable-non-wordsize-allocations-on-arm.patch b/0096-Disable-non-wordsize-allocations-on-arm.patch similarity index 100% rename from 0108-Disable-non-wordsize-allocations-on-arm.patch rename to 0096-Disable-non-wordsize-allocations-on-arm.patch diff --git a/0109-Prepend-prefix-when-HTTP-path-is-relative.patch b/0097-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 97% rename from 0109-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0097-Prepend-prefix-when-HTTP-path-is-relative.patch index fc861d97..d3e599d1 100644 --- a/0109-Prepend-prefix-when-HTTP-path-is-relative.patch +++ b/0097-Prepend-prefix-when-HTTP-path-is-relative.patch @@ -8,13 +8,15 @@ http_path: /foo/bar http_url: http://www.example.com/foo/bar Signed-off-by: Peter Jones +Signed-off-by: Stephen Benjamin +Signed-off-by: Robbie Harwood --- grub-core/kern/main.c | 10 +++++- grub-core/net/efi/http.c | 82 ++++++++++++++++++++++++++++++++++++------------ 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 48058d983ce..4ec3f5e4d33 100644 +index d1de9fa6873..1c540fc8c26 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -131,11 +131,19 @@ grub_set_prefix_and_root (void) diff --git a/0110-Make-grub_error-more-verbose.patch b/0098-Make-grub_error-more-verbose.patch similarity index 100% rename from 0110-Make-grub_error-more-verbose.patch rename to 0098-Make-grub_error-more-verbose.patch diff --git a/0111-Make-reset-an-alias-for-the-reboot-command.patch b/0099-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0111-Make-reset-an-alias-for-the-reboot-command.patch rename to 0099-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0112-Add-a-version-command.patch b/0100-Add-a-version-command.patch similarity index 100% rename from 0112-Add-a-version-command.patch rename to 0100-Add-a-version-command.patch diff --git a/0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0101-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 100% rename from 0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0101-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch diff --git a/0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0102-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 100% rename from 0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0102-arm-arm64-loader-Better-memory-allocation-and-error-.patch diff --git a/0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 100% rename from 0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch diff --git a/0116-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0104-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 100% rename from 0116-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0104-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch diff --git a/0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 100% rename from 0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch diff --git a/0118-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0106-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0118-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0106-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0119-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0107-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0119-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0107-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0120-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0108-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 100% rename from 0120-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0108-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch diff --git a/0121-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0109-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 100% rename from 0121-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0109-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch diff --git a/0122-Fix-getroot.c-s-trampolines.patch b/0110-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0122-Fix-getroot.c-s-trampolines.patch rename to 0110-Fix-getroot.c-s-trampolines.patch diff --git a/0123-Do-not-allow-stack-trampolines-anywhere.patch b/0111-Do-not-allow-stack-trampolines-anywhere.patch similarity index 100% rename from 0123-Do-not-allow-stack-trampolines-anywhere.patch rename to 0111-Do-not-allow-stack-trampolines-anywhere.patch diff --git a/0124-Reimplement-boot_counter.patch b/0112-Reimplement-boot_counter.patch similarity index 100% rename from 0124-Reimplement-boot_counter.patch rename to 0112-Reimplement-boot_counter.patch diff --git a/0125-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0113-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 100% rename from 0125-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0113-Fix-menu-entry-selection-based-on-ID-and-title.patch diff --git a/0126-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0114-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 100% rename from 0126-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0114-Make-the-menu-entry-users-option-argument-to-be-opti.patch diff --git a/0127-Add-efi-export-env-and-efi-load-env-commands.patch b/0115-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 100% rename from 0127-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0115-Add-efi-export-env-and-efi-load-env-commands.patch diff --git a/0128-Make-it-possible-to-subtract-conditions-from-debug.patch b/0116-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 100% rename from 0128-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0116-Make-it-possible-to-subtract-conditions-from-debug.patch diff --git a/0129-Export-all-variables-from-the-initial-context-when-c.patch b/0117-Export-all-variables-from-the-initial-context-when-c.patch similarity index 100% rename from 0129-Export-all-variables-from-the-initial-context-when-c.patch rename to 0117-Export-all-variables-from-the-initial-context-when-c.patch diff --git a/0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 98% rename from 0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index 9788fd52..6797ffc4 100644 --- a/0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -7,6 +7,9 @@ Subject: [PATCH] grub.d: Split out boot success reset from menu auto hide Also rename fallback and menu auto hide script to be executed before and after boot success reset script. In menu auto hide script, rename last_boot_ok var to menu_hide_ok + +Signed-off-by: Christian Glombek +Signed-off-by: Robbie Harwood --- Makefile.util.def | 14 ++++++++---- ...allback_counting.in => 08_fallback_counting.in} | 14 ++++++------ diff --git a/0131-Fix-systemctl-kexec-exit-status-check.patch b/0119-Fix-systemctl-kexec-exit-status-check.patch similarity index 100% rename from 0131-Fix-systemctl-kexec-exit-status-check.patch rename to 0119-Fix-systemctl-kexec-exit-status-check.patch diff --git a/0132-Print-grub-emu-linux-loader-messages-as-debug.patch b/0120-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 100% rename from 0132-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0120-Print-grub-emu-linux-loader-messages-as-debug.patch diff --git a/0133-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 100% rename from 0133-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch diff --git a/0134-Fix-undefined-references-for-fdt-when-building-with-.patch b/0122-Fix-undefined-references-for-fdt-when-building-with-.patch similarity index 100% rename from 0134-Fix-undefined-references-for-fdt-when-building-with-.patch rename to 0122-Fix-undefined-references-for-fdt-when-building-with-.patch diff --git a/0135-Do-better-in-bootstrap.conf.patch b/0123-Do-better-in-bootstrap.conf.patch similarity index 100% rename from 0135-Do-better-in-bootstrap.conf.patch rename to 0123-Do-better-in-bootstrap.conf.patch diff --git a/0136-Use-git-to-apply-gnulib-patches.patch b/0124-Use-git-to-apply-gnulib-patches.patch similarity index 100% rename from 0136-Use-git-to-apply-gnulib-patches.patch rename to 0124-Use-git-to-apply-gnulib-patches.patch diff --git a/0137-Fix-build-error-with-the-fdt-module-on-risc-v.patch b/0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch similarity index 100% rename from 0137-Fix-build-error-with-the-fdt-module-on-risc-v.patch rename to 0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch diff --git a/0138-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0126-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0138-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0126-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0139-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0127-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0139-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0127-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0140-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 100% rename from 0140-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0141-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch b/0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch similarity index 100% rename from 0141-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch rename to 0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch diff --git a/0142-chainloader-Define-machine-types-for-RISC-V.patch b/0130-chainloader-Define-machine-types-for-RISC-V.patch similarity index 100% rename from 0142-chainloader-Define-machine-types-for-RISC-V.patch rename to 0130-chainloader-Define-machine-types-for-RISC-V.patch diff --git a/0143-Add-start-symbol-for-RISC-V.patch b/0131-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0143-Add-start-symbol-for-RISC-V.patch rename to 0131-Add-start-symbol-for-RISC-V.patch diff --git a/0144-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0132-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 100% rename from 0144-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0132-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 97% rename from 0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch index 6f2e93dd..74183bc3 100644 --- a/0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch +++ b/0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch @@ -25,7 +25,7 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 2 insertions(+) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 4ec3f5e4d33..0285e95a2bb 100644 +index 1c540fc8c26..b573be6650d 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -143,6 +143,7 @@ grub_set_prefix_and_root (void) diff --git a/0146-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0134-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0146-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0134-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0147-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0135-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0147-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0135-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0148-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0136-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0148-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0136-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0149-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0137-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0149-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0137-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0150-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0138-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 100% rename from 0150-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0138-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch diff --git a/0151-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0139-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 100% rename from 0151-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0139-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0152-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0140-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 100% rename from 0152-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0140-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0153-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0141-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 100% rename from 0153-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0141-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0154-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0142-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 100% rename from 0154-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0142-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch diff --git a/0155-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0143-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 100% rename from 0155-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0143-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch diff --git a/0156-efi-dhcp-fix-some-allocation-error-checking.patch b/0144-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0156-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0144-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0157-efi-http-fix-some-allocation-error-checking.patch b/0145-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0157-efi-http-fix-some-allocation-error-checking.patch rename to 0145-efi-http-fix-some-allocation-error-checking.patch diff --git a/0158-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0146-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0158-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0146-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0159-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0147-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 100% rename from 0159-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0147-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch diff --git a/0160-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0148-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 100% rename from 0160-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0148-linuxefi-fail-kernel-validation-without-shim-protoco.patch diff --git a/0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0149-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 100% rename from 0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0149-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch diff --git a/0162-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0150-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0162-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0150-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0163-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0151-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0163-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0151-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0164-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0152-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0164-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0152-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0165-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0153-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0165-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0153-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0166-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 100% rename from 0166-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch diff --git a/0167-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0155-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0167-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0155-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0168-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0156-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 100% rename from 0168-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0156-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0169-grub-install-disable-support-for-EFI-platforms.patch b/0157-grub-install-disable-support-for-EFI-platforms.patch similarity index 100% rename from 0169-grub-install-disable-support-for-EFI-platforms.patch rename to 0157-grub-install-disable-support-for-EFI-platforms.patch diff --git a/0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 100% rename from 0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch diff --git a/0171-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0159-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 100% rename from 0171-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0159-Added-debug-statements-to-grub_disk_open-and-grub_di.patch diff --git a/0172-Introduce-function-grub_debug_is_enabled-void-return.patch b/0160-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 100% rename from 0172-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0160-Introduce-function-grub_debug_is_enabled-void-return.patch diff --git a/0173-Don-t-clear-screen-when-debugging-is-enabled.patch b/0161-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 55% rename from 0173-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0161-Don-t-clear-screen-when-debugging-is-enabled.patch index d2a59886..d17b080c 100644 --- a/0173-Don-t-clear-screen-when-debugging-is-enabled.patch +++ b/0161-Don-t-clear-screen-when-debugging-is-enabled.patch @@ -7,21 +7,25 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Renaud Métrich +[rharwood@redhat.com: rebase fuzz] +Signed-off-by: Robbie Harwood --- - grub-core/normal/main.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) + grub-core/normal/main.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index e349303c29b..155bf366da2 100644 +index 1970e4816a8..4ebdbd228d4 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -210,7 +210,8 @@ void - grub_normal_init_page (struct grub_term_output *term, - int y __attribute__((__unused__))) - { +@@ -215,8 +215,9 @@ grub_normal_init_page (struct grub_term_output *term, + char *msg_formatted; + grub_uint32_t *unicode_msg; + grub_uint32_t *last_position; +- - grub_term_cls (term); ++ + if (! grub_debug_is_enabled ()) + grub_term_cls (term); - #if 0 - grub_ssize_t msg_len; + msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); + if (!msg_formatted) diff --git a/0174-grub_file_-instrumentation-new-file-debug-tag.patch b/0162-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0174-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0162-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0175-ieee1275-Avoiding-many-unecessary-open-close.patch b/0163-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0175-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0163-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0176-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0164-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0176-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0164-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0177-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0165-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0177-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0165-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 97% rename from 0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch index 968a9c14..01e7e678 100644 --- a/0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +++ b/0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch @@ -2,6 +2,9 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20M=C3=A9trich?= Date: Fri, 18 Dec 2020 15:39:26 +0100 Subject: [PATCH] Add 'at_keyboard_fallback_set' var to force the set manually +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit This seems required with HP DL380p Gen 8 systems. Indeed, with this system, we can see the following sequence: @@ -24,6 +27,9 @@ solution": - https://wiki.osdev.org/%228042%22_PS/2_Controller - http://www-ug.eecg.toronto.edu/msl/nios_devices/datasheets/PS2%20Keyboard%20Protocol.htm - http://www.s100computers.com/My%20System%20Pages/MSDOS%20Board/PC%20Keyboard.pdf + +Signed-off-by: Renaud Métrich +Signed-off-by: Robbie Harwood --- grub-core/term/at_keyboard.c | 121 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 25 deletions(-) diff --git a/0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 98% rename from 0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch index 86075510..caab8d58 100644 --- a/0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch +++ b/0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -44,12 +44,12 @@ I will be proposing this for inclusion in a future Power Architecture Platform Reference (PAPR). --- util/grub-install-common.c | 18 ++++++++++++++++-- - util/grub-mkimage.c | 16 ++++++++++++++-- + util/grub-mkimage.c | 15 +++++++++++++-- util/grub-mkimagexx.c | 39 ++++++++++++++++++++++++++++++++++++++- util/mkimage.c | 13 +++++++------ include/grub/util/install.h | 8 ++++++-- include/grub/util/mkimage.h | 4 ++-- - 6 files changed, 83 insertions(+), 15 deletions(-) + 6 files changed, 82 insertions(+), 15 deletions(-) diff --git a/util/grub-install-common.c b/util/grub-install-common.c index 4e212e690c5..aab2a941f85 100644 @@ -106,7 +106,7 @@ index 4e212e690c5..aab2a941f85 100644 while (dc--) grub_install_pop_module (); diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index c0d55993702..94c9893230f 100644 +index c0d55993702..8a53310548b 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -84,6 +84,7 @@ static struct argp_option options[] = { @@ -147,14 +147,13 @@ index c0d55993702..94c9893230f 100644 case 'm': if (arguments->memdisk) free (arguments->memdisk); -@@ -324,8 +334,10 @@ main (int argc, char *argv[]) +@@ -324,8 +334,9 @@ main (int argc, char *argv[]) arguments.memdisk, arguments.pubkeys, arguments.npubkeys, arguments.config, arguments.image_target, arguments.note, - arguments.comp, arguments.dtb, - arguments.sbat, arguments.disable_shim_lock); -+ -+ arguments.comp, arguments.appsig_size, ++ arguments.appsig_size, arguments.comp, + arguments.dtb, arguments.sbat, + arguments.disable_shim_lock); diff --git a/0180-docs-grub-Document-signing-grub-under-UEFI.patch b/0168-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0180-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0168-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0169-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0169-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0182-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0170-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0182-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0170-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0183-pgp-factor-out-rsa_pad.patch b/0171-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0183-pgp-factor-out-rsa_pad.patch rename to 0171-pgp-factor-out-rsa_pad.patch diff --git a/0184-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0172-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0184-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0172-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0185-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0173-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0185-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0173-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0186-libtasn1-import-libtasn1-4.16.0.patch b/0174-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0186-libtasn1-import-libtasn1-4.16.0.patch rename to 0174-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0187-libtasn1-disable-code-not-needed-in-grub.patch b/0175-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0187-libtasn1-disable-code-not-needed-in-grub.patch rename to 0175-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0188-libtasn1-changes-for-grub-compatibility.patch b/0176-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0188-libtasn1-changes-for-grub-compatibility.patch rename to 0176-libtasn1-changes-for-grub-compatibility.patch diff --git a/0189-libtasn1-compile-into-asn1-module.patch b/0177-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0189-libtasn1-compile-into-asn1-module.patch rename to 0177-libtasn1-compile-into-asn1-module.patch diff --git a/0190-test_asn1-test-module-for-libtasn1.patch b/0178-test_asn1-test-module-for-libtasn1.patch similarity index 100% rename from 0190-test_asn1-test-module-for-libtasn1.patch rename to 0178-test_asn1-test-module-for-libtasn1.patch diff --git a/0191-grub-install-support-embedding-x509-certificates.patch b/0179-grub-install-support-embedding-x509-certificates.patch similarity index 98% rename from 0191-grub-install-support-embedding-x509-certificates.patch rename to 0179-grub-install-support-embedding-x509-certificates.patch index 04722ad7..bd02e6de 100644 --- a/0191-grub-install-support-embedding-x509-certificates.patch +++ b/0179-grub-install-support-embedding-x509-certificates.patch @@ -94,7 +94,7 @@ index aab2a941f85..422f82362c7 100644 disable_shim_lock); while (dc--) diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index 26d1ecbf74e..c5cdda498eb 100644 +index 8a53310548b..e1f1112784a 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -75,7 +75,8 @@ static struct argp_option options[] = { @@ -138,8 +138,8 @@ index 26d1ecbf74e..c5cdda498eb 100644 + arguments.npubkeys, arguments.x509keys, + arguments.nx509keys, arguments.config, arguments.image_target, arguments.note, - - arguments.comp, arguments.appsig_size, + arguments.appsig_size, arguments.comp, + arguments.dtb, arguments.sbat, diff --git a/util/mkimage.c b/util/mkimage.c index bab12276010..8319e8dfbde 100644 --- a/util/mkimage.c diff --git a/0192-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0180-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0192-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0180-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0193-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0181-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0193-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0181-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0194-appended-signatures-support-verifying-appended-signa.patch b/0182-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0194-appended-signatures-support-verifying-appended-signa.patch rename to 0182-appended-signatures-support-verifying-appended-signa.patch diff --git a/0195-appended-signatures-verification-tests.patch b/0183-appended-signatures-verification-tests.patch similarity index 100% rename from 0195-appended-signatures-verification-tests.patch rename to 0183-appended-signatures-verification-tests.patch diff --git a/0196-appended-signatures-documentation.patch b/0184-appended-signatures-documentation.patch similarity index 100% rename from 0196-appended-signatures-documentation.patch rename to 0184-appended-signatures-documentation.patch diff --git a/0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0185-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 100% rename from 0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0185-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch diff --git a/0198-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0186-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0198-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0186-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0199-ieee1275-claim-more-memory.patch b/0187-ieee1275-claim-more-memory.patch similarity index 100% rename from 0199-ieee1275-claim-more-memory.patch rename to 0187-ieee1275-claim-more-memory.patch diff --git a/0200-ieee1275-request-memory-with-ibm-client-architecture.patch b/0188-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0200-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0188-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0189-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0189-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0202-ieee1275-ofdisk-retry-on-open-failure.patch b/0190-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0202-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0190-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch b/0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch similarity index 100% rename from 0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch rename to 0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch diff --git a/0204-Fix-disabling-grub-rpm-sort.patch b/0192-Fix-disabling-grub-rpm-sort.patch similarity index 95% rename from 0204-Fix-disabling-grub-rpm-sort.patch rename to 0192-Fix-disabling-grub-rpm-sort.patch index dccde3c4..ccde7519 100644 --- a/0204-Fix-disabling-grub-rpm-sort.patch +++ b/0192-Fix-disabling-grub-rpm-sort.patch @@ -7,6 +7,9 @@ Currently, grub-rpm-sort is unconditionally compiled whether ./configure has been called with --disable-rpm-sort or not. This adds the necessary logic to configure.ac and Makefile.util.def and some debug output to ./configure and fixes #44. + +Signed-off-by: Tim Landscheidt +Signed-off-by: Robbie Harwood --- configure.ac | 8 ++++++++ Makefile.util.def | 1 + diff --git a/0205-Don-t-check-for-rpmvercmp-in-librpm.patch b/0193-Don-t-check-for-rpmvercmp-in-librpm.patch similarity index 100% rename from 0205-Don-t-check-for-rpmvercmp-in-librpm.patch rename to 0193-Don-t-check-for-rpmvercmp-in-librpm.patch diff --git a/0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 97% rename from 0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch index e48f1021..66e61a7e 100644 --- a/0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch +++ b/0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch @@ -3,6 +3,8 @@ From: Dimitri John Ledkov Date: Fri, 11 Jun 2021 13:51:20 +0200 Subject: [PATCH] Allow chainloading EFI apps from loop mounts. +Signed-off-by: Dimitri John Ledkov +Signed-off-by: Robbie Harwood --- grub-core/disk/loopback.c | 9 +-------- grub-core/loader/efi/chainloader.c | 23 +++++++++++++++++++++++ diff --git a/0207-efinet-Add-DHCP-proxy-support.patch b/0195-efinet-Add-DHCP-proxy-support.patch similarity index 95% rename from 0207-efinet-Add-DHCP-proxy-support.patch rename to 0195-efinet-Add-DHCP-proxy-support.patch index a8755a39..dcaac6fb 100644 --- a/0207-efinet-Add-DHCP-proxy-support.patch +++ b/0195-efinet-Add-DHCP-proxy-support.patch @@ -6,6 +6,9 @@ Subject: [PATCH] efinet: Add DHCP proxy support If a proxyDHCP configuration is used, the server name, server IP and boot file values should be taken from the DHCP proxy offer instead of the DHCP server ack packet. Currently that case is not handled, add support for it. + +Signed-off-by: Ian Page Hands +Signed-off-by: Robbie Harwood --- grub-core/net/drivers/efi/efinet.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0196-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0196-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 97% rename from 0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index c55b7e3c..84997a90 100644 --- a/0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 68adb55d893..c9296154f51 100644 +index fdf324b7ab1..518624f336e 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -261,7 +261,9 @@ if [ -z "\${kernelopts}" ]; then diff --git a/0210-Suppress-gettext-error-message.patch b/0198-Suppress-gettext-error-message.patch similarity index 96% rename from 0210-Suppress-gettext-error-message.patch rename to 0198-Suppress-gettext-error-message.patch index c57e7ff4..c42dd0d5 100644 --- a/0210-Suppress-gettext-error-message.patch +++ b/0198-Suppress-gettext-error-message.patch @@ -14,7 +14,7 @@ Signed-off-by: Paulo Flabiano Smorigo 1 file changed, 7 insertions(+) diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c -index 84d520cd494..87a912ac6e5 100644 +index 4d02e62c109..7ec81ca0b48 100644 --- a/grub-core/gettext/gettext.c +++ b/grub-core/gettext/gettext.c @@ -424,6 +424,13 @@ grub_gettext_init_ext (struct grub_gettext_context *ctx, diff --git a/0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch b/0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch similarity index 100% rename from 0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch rename to 0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch diff --git a/0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0200-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0200-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0213-Remove-outdated-URL-for-BLS-document.patch b/0201-Remove-outdated-URL-for-BLS-document.patch similarity index 96% rename from 0213-Remove-outdated-URL-for-BLS-document.patch rename to 0201-Remove-outdated-URL-for-BLS-document.patch index d380fe88..c4d5d726 100644 --- a/0213-Remove-outdated-URL-for-BLS-document.patch +++ b/0201-Remove-outdated-URL-for-BLS-document.patch @@ -14,7 +14,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index c9296154f51..6ee0a2cf3d0 100644 +index 518624f336e..b95a9a8d7ca 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -96,7 +96,7 @@ cat < 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 155bf366da2..f9ccca502ee 100644 +index 4ebdbd228d4..b72fe3d653c 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -339,18 +339,13 @@ grub_enter_normal_mode (const char *config) +@@ -337,18 +337,13 @@ grub_enter_normal_mode (const char *config) } static grub_err_t @@ -49,7 +49,7 @@ index 155bf366da2..f9ccca502ee 100644 net_search_cfg = grub_env_get ("feature_net_search_cfg"); if (net_search_cfg && net_search_cfg[0] == 'n') disable_net_search = 1; -@@ -364,7 +359,7 @@ grub_try_normal (const char *variable) +@@ -362,7 +357,7 @@ grub_try_normal (const char *variable) config = grub_malloc (config_len); if (! config) @@ -58,7 +58,7 @@ index 155bf366da2..f9ccca502ee 100644 grub_snprintf (config, config_len, "%s/grub.cfg", prefix); err = grub_net_search_config_file (config); -@@ -393,6 +388,53 @@ grub_try_normal (const char *variable) +@@ -391,6 +386,53 @@ grub_try_normal (const char *variable) return err; } @@ -112,7 +112,7 @@ index 155bf366da2..f9ccca502ee 100644 /* Enter normal mode from rescue mode. */ static grub_err_t grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), -@@ -407,6 +449,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), +@@ -405,6 +447,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), err = grub_try_normal ("fw_path"); if (err == GRUB_ERR_FILE_NOT_FOUND) err = grub_try_normal ("prefix"); diff --git a/0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 98% rename from 0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch index 70b021d2..7ca37887 100644 --- a/0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +++ b/0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch @@ -23,7 +23,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 0285e95a2bb..e809a5edec1 100644 +index b573be6650d..58d35be253f 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -216,13 +216,41 @@ grub_set_prefix_and_root (void) diff --git a/0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch b/0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch similarity index 97% rename from 0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch rename to 0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch index 1cb21efa..ce0d889f 100644 --- a/0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch +++ b/0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index e809a5edec1..2d0d2bbd4cf 100644 +index 58d35be253f..3fc34014726 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -236,9 +236,20 @@ grub_set_prefix_and_root (void) diff --git a/0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch b/0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch similarity index 100% rename from 0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch rename to 0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch diff --git a/0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0210-Print-module-name-on-license-check-failure.patch b/0210-Print-module-name-on-license-check-failure.patch new file mode 100644 index 00000000..c4b9a134 --- /dev/null +++ b/0210-Print-module-name-on-license-check-failure.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Tue, 12 Oct 2021 12:34:23 -0400 +Subject: [PATCH] Print module name on license check failure + +At the very least, this will make it easier to track down the problem +module - or, if something else has gone wrong, provide more information +for debugging. + +Signed-off-by: Robbie Harwood +--- + grub-core/kern/dl.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index 9557254035e..f3044945742 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -528,14 +528,16 @@ grub_dl_find_section_index (Elf_Ehdr *e, const char *name) + Be sure to understand your license obligations. + */ + static grub_err_t +-grub_dl_check_license (Elf_Ehdr *e) ++grub_dl_check_license (grub_dl_t mod, Elf_Ehdr *e) + { + Elf_Shdr *s = grub_dl_find_section (e, ".module_license"); + if (s && (grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv3") == 0 + || grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv3+") == 0 + || grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv2+") == 0)) + return GRUB_ERR_NONE; +- return grub_error (GRUB_ERR_BAD_MODULE, "incompatible license"); ++ return grub_error (GRUB_ERR_BAD_MODULE, ++ "incompatible license in module %s: %s", mod->name, ++ (char *) e + s->sh_offset); + } + + static grub_err_t +@@ -743,8 +745,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) + constitutes linking) and GRUB core being licensed under GPLv3+. + Be sure to understand your license obligations. + */ +- if (grub_dl_check_license (e) +- || grub_dl_resolve_name (mod, e) ++ if (grub_dl_resolve_name (mod, e) ++ || grub_dl_check_license (mod, e) + || grub_dl_resolve_dependencies (mod, e) + || grub_dl_load_segments (mod, e) + || grub_dl_resolve_symbols (mod, e) diff --git a/0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch new file mode 100644 index 00000000..a80727e0 --- /dev/null +++ b/0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 22 Oct 2021 09:53:15 +1100 +Subject: [PATCH] powerpc-ieee1275: load grub at 4MB, not 2MB + +This was first reported under PFW but reproduces under SLOF. + + - The core.elf was 2126152 = 0x207148 bytes in size with the following + program headers (per readelf): + +Entry point 0x200000 +There are 4 program headers, starting at offset 52 + +Program Headers: + Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align + LOAD 0x000160 0x00200000 0x00200000 0x21f98 0x2971c RWE 0x8 + GNU_STACK 0x0220f8 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4 + LOAD 0x0220f8 0x00232000 0x00232000 0x1e4e50 0x1e4e50 RWE 0x4 + NOTE 0x206f48 0x00000000 0x00000000 0x00200 0x00000 R 0x4 + + - SLOF places the ELF file at 0x4000 (after the reserved space for + interrupt handlers etc.) upwards. The image was 2126152 = 0x207148 + bytes in size, so it runs from 0x4000 - 0x20b148. We'll call 0x4000 the + load address. + +0x0 0x4000 0x20b148 + |----------|--------------| + | reserved | ELF contents | + + - SLOF then copies the first LOAD program header (for .text). That runs + for 0x21f98 bytes. It runs from + (load addr + 0x160) to (load addr + 0x160 + 0x21f98) + = 0x4160 to 0x260f8 + and we copy it to 0x200000 to 0x221f98. This overwrites the end of the + image: + +0x0 0x4000 0x200000 0x221f98 + |----------|------------|---------------| + | reserved | ELF cont.. | .text section | + + - SLOF zeros the bss up to PhysAddr + MemSize = 0x22971c + +0x0 0x4000 0x200000 0x221f98 0x22971c + |----------|------------|---------------|--------| + | reserved | ELF cont.. | .text section | bss 0s | + + - SLOF then goes to fulfil the next LOAD header (for mods), which is + for 0x1e4e50 bytes. We copy from + (load addr + 0x220f8) to (load addr + 0x220f8 + 0x1e4e50) + = 0x260f8 to 0x20af48 + and we copy it to 0x232000 to 0x416e50: + +0x0 0x4000 0x200000 0x221f98 0x22971c + |----------|------------|---------------|--------| + | reserved | ELF cont.. | .text section | bss 0s | + |-------------| + | copied area | + 0x260f8 0x20af48 + + This goes poorly: + +0x0 0x4000 0x200000 0x221f98 0x22971c 0x232000 0x40bf08 0x416e50 + |----------|------------|---------------|--------|-----|-----------|-------------| + | reserved | ELF cont.. | .text section | bss 0s | pad | some mods | .text start | + +This matches the observations on the running system - 0x40bf08 was where +the contents of memory no longer matched the contents of the ELF file. + +This was reported as a license verification failure on SLOF as the +last module's .module_license section fell past where the corruption +began. + +Signed-off-by: Daniel Axtens +[rharwood@redhat.com: trim very detailed commit message] +Signed-off-by: Robbie Harwood +--- + grub-core/Makefile.core.def | 2 +- + include/grub/offsets.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 3f3459b2c70..6b00eb55575 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -89,7 +89,7 @@ kernel = { + i386_xen_pvh_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x100000'; + + mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; +- powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000'; ++ powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x400000'; + sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400'; + mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)'; + mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000'; +diff --git a/include/grub/offsets.h b/include/grub/offsets.h +index 871e1cd4c38..69211aa798b 100644 +--- a/include/grub/offsets.h ++++ b/include/grub/offsets.h +@@ -63,7 +63,7 @@ + #define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400 + + #define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4 +-#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000 ++#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x400000 + + #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR 0x80200000 + diff --git a/grub.patches b/grub.patches index f474e1fc..4a349cd5 100644 --- a/grub.patches +++ b/grub.patches @@ -20,202 +20,192 @@ Patch0019: 0019-Add-fw_path-variable-revised.patch Patch0020: 0020-Pass-x-hex-hex-straight-through-unmolested.patch Patch0021: 0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch Patch0022: 0022-Add-devicetree-loading.patch -Patch0023: 0023-Don-t-write-messages-to-the-screen.patch -Patch0024: 0024-Don-t-print-GNU-GRUB-header.patch -Patch0025: 0025-Don-t-add-to-highlighted-row.patch -Patch0026: 0026-Message-string-cleanups.patch -Patch0027: 0027-Fix-border-spacing-now-that-we-aren-t-displaying-it.patch -Patch0028: 0028-Use-the-correct-indentation-for-the-term-help-text.patch -Patch0029: 0029-Indent-menu-entries.patch -Patch0030: 0030-Fix-margins.patch -Patch0031: 0031-Use-2-instead-of-1-for-our-right-hand-margin-so-line.patch -Patch0032: 0032-Enable-pager-by-default.-985860.patch -Patch0033: 0033-F10-doesn-t-work-on-serial-so-don-t-tell-the-user-to.patch -Patch0034: 0034-Don-t-say-GNU-Linux-in-generated-menus.patch -Patch0035: 0035-Don-t-draw-a-border-around-the-menu.patch -Patch0036: 0036-Use-the-standard-margin-for-the-timeout-string.patch -Patch0037: 0037-Add-.eh_frame-to-list-of-relocations-stripped.patch -Patch0038: 0038-Don-t-require-a-password-to-boot-entries-generated-b.patch -Patch0039: 0039-Don-t-emit-Booting-.-message.patch -Patch0040: 0040-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch -Patch0041: 0041-use-fw_path-prefix-when-fallback-searching-for-grub-.patch -Patch0042: 0042-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch -Patch0043: 0043-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch -Patch0044: 0044-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch -Patch0045: 0045-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0046: 0046-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch -Patch0047: 0047-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0048: 0048-Add-friendly-grub2-password-config-tool-985962.patch -Patch0049: 0049-tcp-add-window-scaling-support.patch -Patch0050: 0050-efinet-and-bootp-add-support-for-dhcpv6.patch -Patch0051: 0051-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0052: 0052-bz1374141-fix-incorrect-mask-for-ppc64.patch -Patch0053: 0053-Make-grub_fatal-also-backtrace.patch -Patch0054: 0054-Fix-up-some-man-pages-rpmdiff-noticed.patch -Patch0055: 0055-Make-our-info-pages-say-grub2-where-appropriate.patch -Patch0056: 0056-macos-just-build-chainloader-entries-don-t-try-any-x.patch -Patch0057: 0057-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch -Patch0058: 0058-export-btrfs_subvol-and-btrfs_subvolid.patch -Patch0059: 0059-grub2-btrfs-03-follow_default.patch -Patch0060: 0060-grub2-btrfs-04-grub2-install.patch -Patch0061: 0061-grub2-btrfs-05-grub2-mkconfig.patch -Patch0062: 0062-grub2-btrfs-06-subvol-mount.patch -Patch0063: 0063-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch -Patch0064: 0064-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch -Patch0065: 0065-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch -Patch0066: 0066-Use-grub_efi_.-memory-helpers-where-reasonable.patch -Patch0067: 0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch -Patch0068: 0068-don-t-use-int-for-efi-status.patch -Patch0069: 0069-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch -Patch0070: 0070-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch -Patch0071: 0071-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch -Patch0072: 0072-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch -Patch0073: 0073-align-struct-efi_variable-better.patch -Patch0074: 0074-Add-BLS-support-to-grub-mkconfig.patch -Patch0075: 0075-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0076: 0076-Add-linux-and-initrd-commands-for-grub-emu.patch -Patch0077: 0077-Add-grub2-switch-to-blscfg.patch -Patch0078: 0078-make-better-backtraces.patch -Patch0079: 0079-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0080: 0080-Work-around-some-minor-include-path-weirdnesses.patch -Patch0081: 0081-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0082: 0082-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0083: 0083-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch -Patch0084: 0084-Fixup-for-newer-compiler.patch -Patch0085: 0085-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0086: 0086-Fixup-for-newer-compiler.patch -Patch0087: 0087-Add-support-for-non-Ethernet-network-cards.patch -Patch0088: 0088-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0089: 0089-bootp-New-net_bootp6-command.patch -Patch0090: 0090-efinet-UEFI-IPv6-PXE-support.patch -Patch0091: 0091-grub.texi-Add-net_bootp6-doument.patch -Patch0092: 0092-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0093: 0093-efinet-Setting-network-from-UEFI-device-path.patch -Patch0094: 0094-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0095: 0095-Support-UEFI-networking-protocols.patch -Patch0096: 0096-AUDIT-0-http-boot-tracker-bug.patch -Patch0097: 0097-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0098: 0098-Add-auto-hide-menu-support.patch -Patch0099: 0099-Add-grub-set-bootflag-utility.patch -Patch0100: 0100-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0101: 0101-gentpl-add-disable-support.patch -Patch0102: 0102-gentpl-add-pc-firmware-type.patch -Patch0103: 0103-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0104: 0104-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0105: 0105-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0106: 0106-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0107: 0107-Rework-how-the-fdt-command-builds.patch -Patch0108: 0108-Disable-non-wordsize-allocations-on-arm.patch -Patch0109: 0109-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0110: 0110-Make-grub_error-more-verbose.patch -Patch0111: 0111-Make-reset-an-alias-for-the-reboot-command.patch -Patch0112: 0112-Add-a-version-command.patch -Patch0113: 0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0114: 0114-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0115: 0115-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0116: 0116-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0117: 0117-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0118: 0118-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0119: 0119-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0120: 0120-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0121: 0121-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0122: 0122-Fix-getroot.c-s-trampolines.patch -Patch0123: 0123-Do-not-allow-stack-trampolines-anywhere.patch -Patch0124: 0124-Reimplement-boot_counter.patch -Patch0125: 0125-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0126: 0126-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0127: 0127-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0128: 0128-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0129: 0129-Export-all-variables-from-the-initial-context-when-c.patch -Patch0130: 0130-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0131: 0131-Fix-systemctl-kexec-exit-status-check.patch -Patch0132: 0132-Print-grub-emu-linux-loader-messages-as-debug.patch -Patch0133: 0133-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0134: 0134-Fix-undefined-references-for-fdt-when-building-with-.patch -Patch0135: 0135-Do-better-in-bootstrap.conf.patch -Patch0136: 0136-Use-git-to-apply-gnulib-patches.patch -Patch0137: 0137-Fix-build-error-with-the-fdt-module-on-risc-v.patch -Patch0138: 0138-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0139: 0139-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0140: 0140-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0141: 0141-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch -Patch0142: 0142-chainloader-Define-machine-types-for-RISC-V.patch -Patch0143: 0143-Add-start-symbol-for-RISC-V.patch -Patch0144: 0144-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0145: 0145-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0146: 0146-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0147: 0147-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0148: 0148-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0149: 0149-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0150: 0150-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0151: 0151-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0152: 0152-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0153: 0153-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0154: 0154-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0155: 0155-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0156: 0156-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0157: 0157-efi-http-fix-some-allocation-error-checking.patch -Patch0158: 0158-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0159: 0159-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0160: 0160-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0161: 0161-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0162: 0162-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0163: 0163-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0164: 0164-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0165: 0165-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0166: 0166-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0167: 0167-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0168: 0168-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0169: 0169-grub-install-disable-support-for-EFI-platforms.patch -Patch0170: 0170-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0171: 0171-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0172: 0172-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0173: 0173-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0174: 0174-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0175: 0175-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0176: 0176-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0177: 0177-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0178: 0178-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0179: 0179-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0180: 0180-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0181: 0181-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0182: 0182-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0183: 0183-pgp-factor-out-rsa_pad.patch -Patch0184: 0184-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0185: 0185-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0186: 0186-libtasn1-import-libtasn1-4.16.0.patch -Patch0187: 0187-libtasn1-disable-code-not-needed-in-grub.patch -Patch0188: 0188-libtasn1-changes-for-grub-compatibility.patch -Patch0189: 0189-libtasn1-compile-into-asn1-module.patch -Patch0190: 0190-test_asn1-test-module-for-libtasn1.patch -Patch0191: 0191-grub-install-support-embedding-x509-certificates.patch -Patch0192: 0192-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0193: 0193-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0194: 0194-appended-signatures-support-verifying-appended-signa.patch -Patch0195: 0195-appended-signatures-verification-tests.patch -Patch0196: 0196-appended-signatures-documentation.patch -Patch0197: 0197-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0198: 0198-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0199: 0199-ieee1275-claim-more-memory.patch -Patch0200: 0200-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0201: 0201-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0202: 0202-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0203: 0203-01_menu_auto_hide.in-fix-a-then-than-typo.patch -Patch0204: 0204-Fix-disabling-grub-rpm-sort.patch -Patch0205: 0205-Don-t-check-for-rpmvercmp-in-librpm.patch -Patch0206: 0206-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0207: 0207-efinet-Add-DHCP-proxy-support.patch -Patch0208: 0208-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0209: 0209-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0210: 0210-Suppress-gettext-error-message.patch -Patch0211: 0211-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch -Patch0212: 0212-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0213: 0213-Remove-outdated-URL-for-BLS-document.patch -Patch0214: 0214-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0215: 0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0216: 0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0217: 0217-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0218: 0218-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0219: 0219-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch -Patch0220: 0220-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch -Patch0221: 0221-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0023: 0023-Enable-pager-by-default.-985860.patch +Patch0024: 0024-Don-t-say-GNU-Linux-in-generated-menus.patch +Patch0025: 0025-Add-.eh_frame-to-list-of-relocations-stripped.patch +Patch0026: 0026-Don-t-require-a-password-to-boot-entries-generated-b.patch +Patch0027: 0027-Don-t-emit-Booting-.-message.patch +Patch0028: 0028-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +Patch0029: 0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +Patch0030: 0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +Patch0031: 0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +Patch0032: 0032-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +Patch0033: 0033-Try-prefix-if-fw_path-doesn-t-work.patch +Patch0034: 0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +Patch0035: 0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0036: 0036-Add-friendly-grub2-password-config-tool-985962.patch +Patch0037: 0037-tcp-add-window-scaling-support.patch +Patch0038: 0038-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0039: 0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0040: 0040-bz1374141-fix-incorrect-mask-for-ppc64.patch +Patch0041: 0041-Make-grub_fatal-also-backtrace.patch +Patch0042: 0042-Fix-up-some-man-pages-rpmdiff-noticed.patch +Patch0043: 0043-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0044: 0044-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0045: 0045-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0046: 0046-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0047: 0047-grub2-btrfs-03-follow_default.patch +Patch0048: 0048-grub2-btrfs-04-grub2-install.patch +Patch0049: 0049-grub2-btrfs-05-grub2-mkconfig.patch +Patch0050: 0050-grub2-btrfs-06-subvol-mount.patch +Patch0051: 0051-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0052: 0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0053: 0053-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0054: 0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0055: 0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0056: 0056-don-t-use-int-for-efi-status.patch +Patch0057: 0057-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0058: 0058-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +Patch0059: 0059-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +Patch0060: 0060-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +Patch0061: 0061-align-struct-efi_variable-better.patch +Patch0062: 0062-Add-BLS-support-to-grub-mkconfig.patch +Patch0063: 0063-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +Patch0064: 0064-Add-linux-and-initrd-commands-for-grub-emu.patch +Patch0065: 0065-Add-grub2-switch-to-blscfg.patch +Patch0066: 0066-make-better-backtraces.patch +Patch0067: 0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0068: 0068-Work-around-some-minor-include-path-weirdnesses.patch +Patch0069: 0069-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0070: 0070-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0071: 0071-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0072: 0072-Fixup-for-newer-compiler.patch +Patch0073: 0073-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +Patch0074: 0074-Fixup-for-newer-compiler.patch +Patch0075: 0075-Add-support-for-non-Ethernet-network-cards.patch +Patch0076: 0076-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0077: 0077-bootp-New-net_bootp6-command.patch +Patch0078: 0078-efinet-UEFI-IPv6-PXE-support.patch +Patch0079: 0079-grub.texi-Add-net_bootp6-doument.patch +Patch0080: 0080-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0081: 0081-efinet-Setting-network-from-UEFI-device-path.patch +Patch0082: 0082-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0083: 0083-Support-UEFI-networking-protocols.patch +Patch0084: 0084-AUDIT-0-http-boot-tracker-bug.patch +Patch0085: 0085-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0086: 0086-Add-auto-hide-menu-support.patch +Patch0087: 0087-Add-grub-set-bootflag-utility.patch +Patch0088: 0088-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0089: 0089-gentpl-add-disable-support.patch +Patch0090: 0090-gentpl-add-pc-firmware-type.patch +Patch0091: 0091-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0092: 0092-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0093: 0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0094: 0094-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0095: 0095-Rework-how-the-fdt-command-builds.patch +Patch0096: 0096-Disable-non-wordsize-allocations-on-arm.patch +Patch0097: 0097-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0098: 0098-Make-grub_error-more-verbose.patch +Patch0099: 0099-Make-reset-an-alias-for-the-reboot-command.patch +Patch0100: 0100-Add-a-version-command.patch +Patch0101: 0101-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0102: 0102-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0103: 0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0104: 0104-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0105: 0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0106: 0106-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0107: 0107-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0108: 0108-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0109: 0109-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0110: 0110-Fix-getroot.c-s-trampolines.patch +Patch0111: 0111-Do-not-allow-stack-trampolines-anywhere.patch +Patch0112: 0112-Reimplement-boot_counter.patch +Patch0113: 0113-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0114: 0114-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0115: 0115-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0116: 0116-Make-it-possible-to-subtract-conditions-from-debug.patch +Patch0117: 0117-Export-all-variables-from-the-initial-context-when-c.patch +Patch0118: 0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0119: 0119-Fix-systemctl-kexec-exit-status-check.patch +Patch0120: 0120-Print-grub-emu-linux-loader-messages-as-debug.patch +Patch0121: 0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0122: 0122-Fix-undefined-references-for-fdt-when-building-with-.patch +Patch0123: 0123-Do-better-in-bootstrap.conf.patch +Patch0124: 0124-Use-git-to-apply-gnulib-patches.patch +Patch0125: 0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch +Patch0126: 0126-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0127: 0127-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0128: 0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0129: 0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch +Patch0130: 0130-chainloader-Define-machine-types-for-RISC-V.patch +Patch0131: 0131-Add-start-symbol-for-RISC-V.patch +Patch0132: 0132-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0133: 0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0134: 0134-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0135: 0135-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0136: 0136-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0137: 0137-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0138: 0138-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0139: 0139-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0140: 0140-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0141: 0141-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0142: 0142-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0143: 0143-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0144: 0144-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0145: 0145-efi-http-fix-some-allocation-error-checking.patch +Patch0146: 0146-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0147: 0147-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0148: 0148-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0149: 0149-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0150: 0150-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0151: 0151-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0152: 0152-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0153: 0153-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0154: 0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0155: 0155-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0156: 0156-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0157: 0157-grub-install-disable-support-for-EFI-platforms.patch +Patch0158: 0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0159: 0159-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0160: 0160-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0161: 0161-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0162: 0162-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0163: 0163-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0164: 0164-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0165: 0165-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0166: 0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0167: 0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0168: 0168-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0169: 0169-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0170: 0170-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0171: 0171-pgp-factor-out-rsa_pad.patch +Patch0172: 0172-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0173: 0173-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0174: 0174-libtasn1-import-libtasn1-4.16.0.patch +Patch0175: 0175-libtasn1-disable-code-not-needed-in-grub.patch +Patch0176: 0176-libtasn1-changes-for-grub-compatibility.patch +Patch0177: 0177-libtasn1-compile-into-asn1-module.patch +Patch0178: 0178-test_asn1-test-module-for-libtasn1.patch +Patch0179: 0179-grub-install-support-embedding-x509-certificates.patch +Patch0180: 0180-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0181: 0181-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0182: 0182-appended-signatures-support-verifying-appended-signa.patch +Patch0183: 0183-appended-signatures-verification-tests.patch +Patch0184: 0184-appended-signatures-documentation.patch +Patch0185: 0185-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0186: 0186-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0187: 0187-ieee1275-claim-more-memory.patch +Patch0188: 0188-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0189: 0189-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0190: 0190-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0191: 0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch +Patch0192: 0192-Fix-disabling-grub-rpm-sort.patch +Patch0193: 0193-Don-t-check-for-rpmvercmp-in-librpm.patch +Patch0194: 0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0195: 0195-efinet-Add-DHCP-proxy-support.patch +Patch0196: 0196-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0197: 0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0198: 0198-Suppress-gettext-error-message.patch +Patch0199: 0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch +Patch0200: 0200-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0201: 0201-Remove-outdated-URL-for-BLS-document.patch +Patch0202: 0202-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0203: 0203-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0204: 0204-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0205: 0205-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0206: 0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0207: 0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch +Patch0208: 0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch +Patch0209: 0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0210: 0210-Print-module-name-on-license-check-failure.patch +Patch0211: 0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/grub2.spec b/grub2.spec index 21404f3b..25b2b52f 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Nov 04 2021 Robbie Harwood - 2.06-9 +- Drop UI patches and update provenance information + * Thu Oct 07 2021 Peter Jones - 2.06-8 - Fix "grub2-mkimage --appended-signature-size" parsing. From d90546c5ee7dec2cb829f1ebe8c4eed7bad412d9 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 9 Dec 2021 16:11:27 +0000 Subject: [PATCH 091/294] restore umask for grub.cfg (CVE-2021-3981) Signed-off-by: Robbie Harwood --- ...-mkconfig-restore-umask-for-grub.cfg.patch | 43 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 0212-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/0212-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0212-grub-mkconfig-restore-umask-for-grub.cfg.patch new file mode 100644 index 00000000..d9a81964 --- /dev/null +++ b/0212-grub-mkconfig-restore-umask-for-grub.cfg.patch @@ -0,0 +1,43 @@ +From 3ea051e59e9c0cd79eac7f2e1563606e1e31a530 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 3 Dec 2021 16:13:28 +0800 +Subject: [PATCH] grub-mkconfig: restore umask for grub.cfg + +Since commit: + + ab2e53c8a grub-mkconfig: Honor a symlink when generating configuration +by grub-mkconfig + +has inadvertently discarded umask for creating grub.cfg in the process +of grub-mkconfig. The resulting wrong permission (0644) would allow +unprivileged users to read grub's configuration file content. This +presents a low confidentiality risk as grub.cfg may contain non-secured +plain-text passwords. + +This patch restores the missing umask and set the file mode of creation +to 0600 preventing unprivileged access. + +Fixes: CVE-2021-3981 + +Signed-off-by: Michael Chang +--- + util/grub-mkconfig.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index f55339a3f..520a672cd 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -311,7 +311,9 @@ and /etc/grub.d/* files or please file a bug report with + exit 1 + else + # none of the children aborted with error, install the new grub.cfg ++ oldumask=$(umask); umask 077 + cat ${grub_cfg}.new > ${grub_cfg} ++ umask $oldumask + rm -f ${grub_cfg}.new + fi + fi +-- +2.33.0 + diff --git a/grub.patches b/grub.patches index 4a349cd5..b8336903 100644 --- a/grub.patches +++ b/grub.patches @@ -209,3 +209,4 @@ Patch0208: 0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch Patch0209: 0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch Patch0210: 0210-Print-module-name-on-license-check-failure.patch Patch0211: 0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0212: 0212-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/grub2.spec b/grub2.spec index 25b2b52f..89030ea1 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Dec 09 2021 Robbie Harwood - 2.06-10 +- restore umask for grub.cfg (CVE-2021-3981) + * Thu Nov 04 2021 Robbie Harwood - 2.06-9 - Drop UI patches and update provenance information From 46317f98bfb96ef757aacc23b551454f2dea5d9e Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 10 Dec 2021 17:34:40 +0000 Subject: [PATCH 092/294] Bump to rerun signing (no code changes) Signed-off-by: Robbie Harwood --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 89030ea1..586a8336 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Dec 10 2021 Robbie Harwood - 2.06-11 +- Bump to rerun signing (no code changes) + * Thu Dec 09 2021 Robbie Harwood - 2.06-10 - restore umask for grub.cfg (CVE-2021-3981) From b25606806096b51e9d920f50b9bb47773641644d Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 6 Jan 2022 17:42:54 +0000 Subject: [PATCH 093/294] btrfs: use full bootloader area Signed-off-by: Robbie Harwood --- ...btrfs-Use-full-btrfs-bootloader-area.patch | 163 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 0213-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/0213-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0213-fs-btrfs-Use-full-btrfs-bootloader-area.patch new file mode 100644 index 00000000..a5a62ee2 --- /dev/null +++ b/0213-fs-btrfs-Use-full-btrfs-bootloader-area.patch @@ -0,0 +1,163 @@ +From 6e5b9bc2f1d2e3a10096716350fa67f48c199f5d Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Mon, 13 Dec 2021 14:25:49 +0800 +Subject: [PATCH] fs/btrfs: Use full btrfs bootloader area + +Up to now GRUB can only embed to the first 64 KiB before primary +superblock of btrfs, effectively limiting the GRUB core size. That +could consequently pose restrictions to feature enablement like +advanced zstd compression. + +This patch attempts to utilize full unused area reserved by btrfs for +the bootloader outlined in the document [1]: + + The first 1MiB on each device is unused with the exception of primary + superblock that is on the offset 64KiB and spans 4KiB. + +Apart from that, adjacent sectors to superblock and first block group +are not used for embedding in case of overflow and logged access to +adjacent sectors could be useful for tracing it up. + +This patch has been tested to provide out of the box support for btrfs +zstd compression with which GRUB has been installed to the partition. + +[1] https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#BOOTLOADER_SUPPORT + +Signed-off-by: Michael Chang +Reviewed-by: Daniel Kiper +(cherry picked from commit b0f06a81c6f31b6fa20be67a96b6683bba8210c9) +--- + grub-core/fs/btrfs.c | 90 +++++++++++++++++++++++++++++++++++++------- + include/grub/disk.h | 2 + + 2 files changed, 79 insertions(+), 13 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 4cc86e9b7..07c0ff874 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -2476,6 +2476,33 @@ grub_btrfs_label (grub_device_t device, char **label) + } + + #ifdef GRUB_UTIL ++ ++struct embed_region { ++ unsigned int start; ++ unsigned int secs; ++}; ++ ++/* ++ * https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#BOOTLOADER_SUPPORT ++ * The first 1 MiB on each device is unused with the exception of primary ++ * superblock that is on the offset 64 KiB and spans 4 KiB. ++ */ ++ ++static const struct { ++ struct embed_region available; ++ struct embed_region used[6]; ++} btrfs_head = { ++ .available = {0, GRUB_DISK_KiB_TO_SECTORS (1024)}, /* The first 1 MiB. */ ++ .used = { ++ {0, 1}, /* boot.S. */ ++ {GRUB_DISK_KiB_TO_SECTORS (64) - 1, 1}, /* Overflow guard. */ ++ {GRUB_DISK_KiB_TO_SECTORS (64), GRUB_DISK_KiB_TO_SECTORS (4)}, /* 4 KiB superblock. */ ++ {GRUB_DISK_KiB_TO_SECTORS (68), 1}, /* Overflow guard. */ ++ {GRUB_DISK_KiB_TO_SECTORS (1024) - 1, 1}, /* Overflow guard. */ ++ {0, 0} /* Array terminator. */ ++ } ++}; ++ + static grub_err_t + grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), + unsigned int *nsectors, +@@ -2483,25 +2510,62 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), + grub_embed_type_t embed_type, + grub_disk_addr_t **sectors) + { +- unsigned i; ++ unsigned int i, j, n = 0; ++ const struct embed_region *u; ++ grub_disk_addr_t *map; + + if (embed_type != GRUB_EMBED_PCBIOS) + return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "BtrFS currently supports only PC-BIOS embedding"); + +- if (64 * 2 - 1 < *nsectors) +- return grub_error (GRUB_ERR_OUT_OF_RANGE, +- N_("your core.img is unusually large. " +- "It won't fit in the embedding area")); +- +- *nsectors = 64 * 2 - 1; +- if (*nsectors > max_nsectors) +- *nsectors = max_nsectors; +- *sectors = grub_calloc (*nsectors, sizeof (**sectors)); +- if (!*sectors) ++ map = grub_calloc (btrfs_head.available.secs, sizeof (*map)); ++ if (map == NULL) + return grub_errno; +- for (i = 0; i < *nsectors; i++) +- (*sectors)[i] = i + 1; ++ ++ /* ++ * Populating the map array so that it can be used to index if a disk ++ * address is available to embed: ++ * - 0: available, ++ * - 1: unavailable. ++ */ ++ for (u = btrfs_head.used; u->secs; ++u) ++ { ++ unsigned int end = u->start + u->secs; ++ ++ if (end > btrfs_head.available.secs) ++ end = btrfs_head.available.secs; ++ for (i = u->start; i < end; ++i) ++ map[i] = 1; ++ } ++ ++ /* Adding up n until it matches total size of available embedding area. */ ++ for (i = 0; i < btrfs_head.available.secs; ++i) ++ if (map[i] == 0) ++ n++; ++ ++ if (n < *nsectors) ++ { ++ grub_free (map); ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, ++ N_("your core.img is unusually large. " ++ "It won't fit in the embedding area")); ++ } ++ ++ if (n > max_nsectors) ++ n = max_nsectors; ++ ++ /* ++ * Populating the array so that it can used to index disk block address for ++ * an image file's offset to be embedded on disk (the unit is in sectors): ++ * - i: The disk block address relative to btrfs_head.available.start, ++ * - j: The offset in image file. ++ */ ++ for (i = 0, j = 0; i < btrfs_head.available.secs && j < n; ++i) ++ if (map[i] == 0) ++ map[j++] = btrfs_head.available.start + i; ++ ++ *nsectors = n; ++ *sectors = map; + + return GRUB_ERR_NONE; + } +diff --git a/include/grub/disk.h b/include/grub/disk.h +index f95aca929..06210a704 100644 +--- a/include/grub/disk.h ++++ b/include/grub/disk.h +@@ -182,6 +182,8 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t; + /* Return value of grub_disk_native_sectors() in case disk size is unknown. */ + #define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL + ++#define GRUB_DISK_KiB_TO_SECTORS(x) ((x) << (10 - GRUB_DISK_SECTOR_BITS)) ++ + /* Convert sector number from one sector size to another. */ + static inline grub_disk_addr_t + grub_convert_sector (grub_disk_addr_t sector, +-- +2.34.1 + diff --git a/grub.patches b/grub.patches index b8336903..bbb454ad 100644 --- a/grub.patches +++ b/grub.patches @@ -210,3 +210,4 @@ Patch0209: 0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch Patch0210: 0210-Print-module-name-on-license-check-failure.patch Patch0211: 0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch Patch0212: 0212-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0213: 0213-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/grub2.spec b/grub2.spec index 586a8336..7f22435a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Jan 06 2022 Robbie Harwood - 2.06-12 +- btrfs: use full bootloader area + * Fri Dec 10 2021 Robbie Harwood - 2.06-11 - Bump to rerun signing (no code changes) From e602a0629dc2d243ae3c4ae64ea36dddabc27937 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 17 Jan 2022 23:06:55 +0000 Subject: [PATCH 094/294] Update patches; minor changes at most, if correct Signed-off-by: Robbie Harwood --- ...ecureboot-support-on-efi-chainloader.patch | 41 +- ...loaders-that-link-in-efi-mode-honor-.patch | 2 +- ...ient-architecture-CAS-reboot-support.patch | 14 +- ...nsole-display-attr-when-clear-screen.patch | 2 + ...video-support-for-IBM-power-machines.patch | 3 + 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch | 7 +- 0019-Add-fw_path-variable-revised.patch | 3 + 0027-Don-t-emit-Booting-.-message.patch | 49 --- ...f-man-pages-with-slightly-nicer-ones.patch | 0 ...ix-when-fallback-searching-for-grub-.patch | 0 ...-before-grub.cfg-on-tftp-config-file.patch | 0 ...CLASS-in-10_linux-from-etc-os-releas.patch | 0 ...t-ordering-for-.debug-and-rescue-ker.patch | 0 ...2-Try-prefix-if-fw_path-doesn-t-work.patch | 0 ...33-Use-rpm-s-sort-for-grub2-mkconfig.patch | 69 ++-- ...fig-construct-titles-that-look-like-.patch | 0 ...ly-grub2-password-config-tool-985962.patch | 6 +- ... 0036-tcp-add-window-scaling-support.patch | 0 ...net-and-bootp-add-support-for-dhcpv6.patch | 0 ...rnel-settings-and-use-it-in-10_linux.patch | 6 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 3 + ... 0040-Make-grub_fatal-also-backtrace.patch | 0 ...ix-up-some-man-pages-rpmdiff-noticed.patch | 2 +- ...fo-pages-say-grub2-where-appropriate.patch | 0 ...-chainloader-entries-don-t-try-any-x.patch | 0 ...-Add-ability-to-boot-from-subvolumes.patch | 0 ...port-btrfs_subvol-and-btrfs_subvolid.patch | 0 ...> 0046-grub2-btrfs-03-follow_default.patch | 0 ...=> 0047-grub2-btrfs-04-grub2-install.patch | 0 ...> 0048-grub2-btrfs-05-grub2-mkconfig.patch | 0 ... => 0049-grub2-btrfs-06-subvol-mount.patch | 0 ...subvol-name-scheme-to-support-old-sn.patch | 0 ...-correctly-with-btrfs-snapshots-bsc-.patch | 0 ...ocate_pool-and-grub_efi_free_pool-wr.patch | 0 ...fi_.-memory-helpers-where-reasonable.patch | 14 +- ...4-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 4 +- ...=> 0055-don-t-use-int-for-efi-status.patch | 0 ...INIT-declare-its-function-prototypes.patch | 0 ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 0 ...d-xen-or-multiboot-2-modules-as-need.patch | 0 ...-calibration-not-take-51-seconds-to-.patch | 0 ...060-align-struct-efi_variable-better.patch | 0 ...061-Add-BLS-support-to-grub-mkconfig.patch | 6 +- ...-backtrace-on-grub_abort-for-grub-em.patch | 0 ...nux-and-initrd-commands-for-grub-emu.patch | 0 ...h => 0064-Add-grub2-switch-to-blscfg.patch | 4 +- ...patch => 0065-make-better-backtraces.patch | 2 +- ...w-our-startup-message-if-debug-is-se.patch | 0 ...-some-minor-include-path-weirdnesses.patch | 0 ...it-possible-to-enabled-build-id-sha1.patch | 2 +- ...f-grub_dprintf-without-the-file-line.patch | 0 ...dprintf-that-tells-us-load-addresses.patch | 0 ...tch => 0071-Fixup-for-newer-compiler.patch | 0 ...-export-the-start-and-_start-symbols.patch | 0 ...tch => 0073-Fixup-for-newer-compiler.patch | 0 ...pport-for-non-Ethernet-network-cards.patch | 0 ...racketed-ipv6-addrs-and-port-numbers.patch | 0 ...=> 0076-bootp-New-net_bootp6-command.patch | 0 ...=> 0077-efinet-UEFI-IPv6-PXE-support.patch | 0 ...078-grub.texi-Add-net_bootp6-doument.patch | 0 ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 0 ...etting-network-from-UEFI-device-path.patch | 0 ...etting-DNS-server-from-UEFI-protocol.patch | 0 ...82-Support-UEFI-networking-protocols.patch | 0 ...> 0083-AUDIT-0-http-boot-tracker-bug.patch | 0 ...-incr-command-to-increment-integer-v.patch | 0 ...h => 0085-Add-auto-hide-menu-support.patch | 2 +- ...> 0086-Add-grub-set-bootflag-utility.patch | 16 +- ...b-boot-indeterminate.service-example.patch | 0 ...h => 0088-gentpl-add-disable-support.patch | 0 ... => 0089-gentpl-add-pc-firmware-type.patch | 0 ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 4 +- ...make-it-possible-to-run-checkers-on-.patch | 0 ...94-Rework-how-the-fdt-command-builds.patch | 19 +- ...able-non-wordsize-allocations-on-arm.patch | 2 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 0 ...=> 0097-Make-grub_error-more-verbose.patch | 0 ...eset-an-alias-for-the-reboot-command.patch | 0 ....patch => 0099-Add-a-version-command.patch | 2 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 0 ...-Better-memory-allocation-and-error-.patch | 0 ...tter-locations-for-kernel-and-initrd.patch | 17 +- ...p-all-the-places-Wsign-compare-error.patch | 0 ...gn-compare-Wno-conversion-Wno-error-.patch | 4 +- ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 0 ...itrd-params-cmdline-allocations-abov.patch | 0 ... => 0109-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 4 +- ...tch => 0111-Reimplement-boot_counter.patch | 2 +- ...ntry-selection-based-on-ID-and-title.patch | 2 +- ...try-users-option-argument-to-be-opti.patch | 0 ...export-env-and-efi-load-env-commands.patch | 0 ...le-to-subtract-conditions-from-debug.patch | 0 ...bles-from-the-initial-context-when-c.patch | 2 +- ...-boot-success-reset-from-menu-auto-h.patch | 2 +- ...ix-systemctl-kexec-exit-status-check.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 2 +- ... => 0121-Do-better-in-bootstrap.conf.patch | 0 ...ferences-for-fdt-when-building-with-.patch | 41 -- ...0122-Use-git-to-apply-gnulib-patches.patch | 0 ...g-Update-comment-about-running-as-ro.patch | 0 ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...-error-with-the-fdt-module-on-risc-v.patch | 40 -- ...indeterminate-getting-set-on-boot_su.patch | 10 +- ... => 0126-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 0 ...fw-http-_path-variables-to-make-them.patch | 0 ..._EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch | 24 -- ...-literal-IPv6-addresses-in-square-br.patch | 0 ...ader-Define-machine-types-for-RISC-V.patch | 31 -- ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 0 ...se-address-before-jumping-to-the-PE-.patch | 0 ...ate-TPM-measurement-errors-to-the-ve.patch | 0 ...maximum-bounce-buffer-size-to-16-MiB.patch | 0 ...fix-when-the-HTTP-path-is-relative-a.patch | 0 ...turn-in-efi-export-env-and-efi-load-.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 0 ...rnel-validation-without-shim-protoco.patch | 0 ...ar-pointers-in-grub-core-net-bootp.c.patch | 0 ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 2 +- ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 0 ...ll-disable-support-for-EFI-platforms.patch | 0 ...imestamps-configure-flag-to-prepend-.patch | 6 +- ...ements-to-grub_disk_open-and-grub_di.patch | 0 ...on-grub_debug_is_enabled-void-return.patch | 0 ...ear-screen-when-debugging-is-enabled.patch | 0 ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 0 ...igning-grub-with-an-appended-signatu.patch | 0 ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0166-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0169-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...72-libtasn1-compile-into-asn1-module.patch | 0 ...3-test_asn1-test-module-for-libtasn1.patch | 4 +- ...-support-embedding-x509-certificates.patch | 0 ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 0 ...79-appended-signatures-documentation.patch | 0 ...er-lockdown-based-on-ibm-secure-boot.patch | 0 ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0182-ieee1275-claim-more-memory.patch | 0 ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 0 ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...ainloading-EFI-apps-from-loop-mounts.patch | 0 ...> 0187-efinet-Add-DHCP-proxy-support.patch | 0 ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 2 +- ... 0190-Suppress-gettext-error-message.patch | 0 ...nu_auto_hide.in-fix-a-then-than-typo.patch | 26 -- ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 0192-Fix-disabling-grub-rpm-sort.patch | 62 --- ...for-EFI-at-runtime-instead-of-config.patch | 0 ...-Don-t-check-for-rpmvercmp-in-librpm.patch | 57 --- ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 35 +- ...over-the-device-to-read-the-config-f.patch | 0 ...etting-of-prefix-for-signed-binary-c.patch | 25 +- ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 0 ...s.timer-Only-run-if-not-in-a-contain.patch | 32 -- ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 0 ...-mkconfig-restore-umask-for-grub.cfg.patch | 7 +- ...Remove-outdated-URL-for-BLS-document.patch | 28 -- ...btrfs-Use-full-btrfs-bootloader-area.patch | 13 +- ...ix-signed-grub-special-case-for-Powe.patch | 43 --- ...r-the-PE-magic-for-the-compiled-arch.patch | 63 --- grub.patches | 362 +++++++++--------- grub2.spec | 5 +- 196 files changed, 427 insertions(+), 810 deletions(-) delete mode 100644 0027-Don-t-emit-Booting-.-message.patch rename 0028-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch => 0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch (100%) rename 0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch => 0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch (100%) rename 0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch => 0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch (100%) rename 0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch => 0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch (100%) rename 0032-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch => 0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch (100%) rename 0033-Try-prefix-if-fw_path-doesn-t-work.patch => 0032-Try-prefix-if-fw_path-doesn-t-work.patch (100%) rename 0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch => 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch (87%) rename 0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (100%) rename 0036-Add-friendly-grub2-password-config-tool-985962.patch => 0035-Add-friendly-grub2-password-config-tool-985962.patch (98%) rename 0037-tcp-add-window-scaling-support.patch => 0036-tcp-add-window-scaling-support.patch (100%) rename 0038-efinet-and-bootp-add-support-for-dhcpv6.patch => 0037-efinet-and-bootp-add-support-for-dhcpv6.patch (100%) rename 0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (98%) rename 0040-bz1374141-fix-incorrect-mask-for-ppc64.patch => 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch (95%) rename 0041-Make-grub_fatal-also-backtrace.patch => 0040-Make-grub_fatal-also-backtrace.patch (100%) rename 0042-Fix-up-some-man-pages-rpmdiff-noticed.patch => 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch (99%) rename 0043-Make-our-info-pages-say-grub2-where-appropriate.patch => 0042-Make-our-info-pages-say-grub2-where-appropriate.patch (100%) rename 0044-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch (100%) rename 0045-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (100%) rename 0046-export-btrfs_subvol-and-btrfs_subvolid.patch => 0045-export-btrfs_subvol-and-btrfs_subvolid.patch (100%) rename 0047-grub2-btrfs-03-follow_default.patch => 0046-grub2-btrfs-03-follow_default.patch (100%) rename 0048-grub2-btrfs-04-grub2-install.patch => 0047-grub2-btrfs-04-grub2-install.patch (100%) rename 0049-grub2-btrfs-05-grub2-mkconfig.patch => 0048-grub2-btrfs-05-grub2-mkconfig.patch (100%) rename 0050-grub2-btrfs-06-subvol-mount.patch => 0049-grub2-btrfs-06-subvol-mount.patch (100%) rename 0051-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (100%) rename 0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (100%) rename 0053-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (100%) rename 0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch => 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch (89%) rename 0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch => 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch (94%) rename 0056-don-t-use-int-for-efi-status.patch => 0055-don-t-use-int-for-efi-status.patch (100%) rename 0057-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (100%) rename 0058-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (100%) rename 0059-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (100%) rename 0060-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch => 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch (100%) rename 0061-align-struct-efi_variable-better.patch => 0060-align-struct-efi_variable-better.patch (100%) rename 0062-Add-BLS-support-to-grub-mkconfig.patch => 0061-Add-BLS-support-to-grub-mkconfig.patch (98%) rename 0063-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (100%) rename 0064-Add-linux-and-initrd-commands-for-grub-emu.patch => 0063-Add-linux-and-initrd-commands-for-grub-emu.patch (100%) rename 0065-Add-grub2-switch-to-blscfg.patch => 0064-Add-grub2-switch-to-blscfg.patch (99%) rename 0066-make-better-backtraces.patch => 0065-make-better-backtraces.patch (99%) rename 0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (100%) rename 0068-Work-around-some-minor-include-path-weirdnesses.patch => 0067-Work-around-some-minor-include-path-weirdnesses.patch (100%) rename 0069-Make-it-possible-to-enabled-build-id-sha1.patch => 0068-Make-it-possible-to-enabled-build-id-sha1.patch (98%) rename 0070-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (100%) rename 0071-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (100%) rename 0072-Fixup-for-newer-compiler.patch => 0071-Fixup-for-newer-compiler.patch (100%) rename 0073-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (100%) rename 0074-Fixup-for-newer-compiler.patch => 0073-Fixup-for-newer-compiler.patch (100%) rename 0075-Add-support-for-non-Ethernet-network-cards.patch => 0074-Add-support-for-non-Ethernet-network-cards.patch (100%) rename 0076-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (100%) rename 0077-bootp-New-net_bootp6-command.patch => 0076-bootp-New-net_bootp6-command.patch (100%) rename 0078-efinet-UEFI-IPv6-PXE-support.patch => 0077-efinet-UEFI-IPv6-PXE-support.patch (100%) rename 0079-grub.texi-Add-net_bootp6-doument.patch => 0078-grub.texi-Add-net_bootp6-doument.patch (100%) rename 0080-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (100%) rename 0081-efinet-Setting-network-from-UEFI-device-path.patch => 0080-efinet-Setting-network-from-UEFI-device-path.patch (100%) rename 0082-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch (100%) rename 0083-Support-UEFI-networking-protocols.patch => 0082-Support-UEFI-networking-protocols.patch (100%) rename 0084-AUDIT-0-http-boot-tracker-bug.patch => 0083-AUDIT-0-http-boot-tracker-bug.patch (100%) rename 0085-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch (100%) rename 0086-Add-auto-hide-menu-support.patch => 0085-Add-auto-hide-menu-support.patch (99%) rename 0087-Add-grub-set-bootflag-utility.patch => 0086-Add-grub-set-bootflag-utility.patch (95%) rename 0088-docs-Add-grub-boot-indeterminate.service-example.patch => 0087-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0089-gentpl-add-disable-support.patch => 0088-gentpl-add-disable-support.patch (100%) rename 0090-gentpl-add-pc-firmware-type.patch => 0089-gentpl-add-pc-firmware-type.patch (100%) rename 0091-efinet-also-use-the-firmware-acceleration-for-http.patch => 0090-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0092-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (98%) rename 0094-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0095-Rework-how-the-fdt-command-builds.patch => 0094-Rework-how-the-fdt-command-builds.patch (84%) rename 0096-Disable-non-wordsize-allocations-on-arm.patch => 0095-Disable-non-wordsize-allocations-on-arm.patch (97%) rename 0097-Prepend-prefix-when-HTTP-path-is-relative.patch => 0096-Prepend-prefix-when-HTTP-path-is-relative.patch (100%) rename 0098-Make-grub_error-more-verbose.patch => 0097-Make-grub_error-more-verbose.patch (100%) rename 0099-Make-reset-an-alias-for-the-reboot-command.patch => 0098-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0100-Add-a-version-command.patch => 0099-Add-a-version-command.patch (99%) rename 0101-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (100%) rename 0102-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch (100%) rename 0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch (91%) rename 0104-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (100%) rename 0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (95%) rename 0106-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0107-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0108-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (100%) rename 0109-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (100%) rename 0110-Fix-getroot.c-s-trampolines.patch => 0109-Fix-getroot.c-s-trampolines.patch (100%) rename 0111-Do-not-allow-stack-trampolines-anywhere.patch => 0110-Do-not-allow-stack-trampolines-anywhere.patch (93%) rename 0112-Reimplement-boot_counter.patch => 0111-Reimplement-boot_counter.patch (99%) rename 0113-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch (99%) rename 0114-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch (100%) rename 0115-Add-efi-export-env-and-efi-load-env-commands.patch => 0114-Add-efi-export-env-and-efi-load-env-commands.patch (100%) rename 0116-Make-it-possible-to-subtract-conditions-from-debug.patch => 0115-Make-it-possible-to-subtract-conditions-from-debug.patch (100%) rename 0117-Export-all-variables-from-the-initial-context-when-c.patch => 0116-Export-all-variables-from-the-initial-context-when-c.patch (97%) rename 0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (99%) rename 0119-Fix-systemctl-kexec-exit-status-check.patch => 0118-Fix-systemctl-kexec-exit-status-check.patch (100%) rename 0120-Print-grub-emu-linux-loader-messages-as-debug.patch => 0119-Print-grub-emu-linux-loader-messages-as-debug.patch (100%) rename 0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch (98%) rename 0123-Do-better-in-bootstrap.conf.patch => 0121-Do-better-in-bootstrap.conf.patch (100%) delete mode 100644 0122-Fix-undefined-references-for-fdt-when-building-with-.patch rename 0124-Use-git-to-apply-gnulib-patches.patch => 0122-Use-git-to-apply-gnulib-patches.patch (100%) rename 0126-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0123-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) rename 0127-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0124-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) delete mode 100644 0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch rename 0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0125-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (91%) rename 0131-Add-start-symbol-for-RISC-V.patch => 0126-Add-start-symbol-for-RISC-V.patch (100%) rename 0132-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0127-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (100%) rename 0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0128-efi-http-Export-fw-http-_path-variables-to-make-them.patch (100%) delete mode 100644 0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch rename 0134-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0129-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) delete mode 100644 0130-chainloader-Define-machine-types-for-RISC-V.patch rename 0135-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0130-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0136-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0131-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) rename 0137-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0132-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) rename 0138-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0133-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (100%) rename 0139-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0134-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (100%) rename 0140-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0135-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (100%) rename 0141-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0136-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (100%) rename 0142-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0137-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (100%) rename 0143-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0138-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (100%) rename 0144-efi-dhcp-fix-some-allocation-error-checking.patch => 0139-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0145-efi-http-fix-some-allocation-error-checking.patch => 0140-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0146-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0141-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0147-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0142-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (100%) rename 0148-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0143-linuxefi-fail-kernel-validation-without-shim-protoco.patch (100%) rename 0149-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0144-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (100%) rename 0150-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0145-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0151-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0146-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) rename 0152-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0147-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0153-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0148-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0149-Add-systemd-integration-scripts-to-make-systemctl-re.patch (99%) rename 0155-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0150-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0156-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0151-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (100%) rename 0157-grub-install-disable-support-for-EFI-platforms.patch => 0152-grub-install-disable-support-for-EFI-platforms.patch (100%) rename 0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0153-New-with-debug-timestamps-configure-flag-to-prepend-.patch (96%) rename 0159-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0154-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (100%) rename 0160-Introduce-function-grub_debug_is_enabled-void-return.patch => 0155-Introduce-function-grub_debug_is_enabled-void-return.patch (100%) rename 0161-Don-t-clear-screen-when-debugging-is-enabled.patch => 0156-Don-t-clear-screen-when-debugging-is-enabled.patch (100%) rename 0162-grub_file_-instrumentation-new-file-debug-tag.patch => 0157-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0163-ieee1275-Avoiding-many-unecessary-open-close.patch => 0158-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0164-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0159-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0165-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0160-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0161-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (100%) rename 0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0162-Add-suport-for-signing-grub-with-an-appended-signatu.patch (100%) rename 0168-docs-grub-Document-signing-grub-under-UEFI.patch => 0163-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0169-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0164-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) rename 0170-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0165-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0171-pgp-factor-out-rsa_pad.patch => 0166-pgp-factor-out-rsa_pad.patch (100%) rename 0172-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0167-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0173-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0168-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0174-libtasn1-import-libtasn1-4.16.0.patch => 0169-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0175-libtasn1-disable-code-not-needed-in-grub.patch => 0170-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0176-libtasn1-changes-for-grub-compatibility.patch => 0171-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0177-libtasn1-compile-into-asn1-module.patch => 0172-libtasn1-compile-into-asn1-module.patch (100%) rename 0178-test_asn1-test-module-for-libtasn1.patch => 0173-test_asn1-test-module-for-libtasn1.patch (99%) rename 0179-grub-install-support-embedding-x509-certificates.patch => 0174-grub-install-support-embedding-x509-certificates.patch (100%) rename 0180-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0175-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0181-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0176-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0182-appended-signatures-support-verifying-appended-signa.patch => 0177-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0183-appended-signatures-verification-tests.patch => 0178-appended-signatures-verification-tests.patch (100%) rename 0184-appended-signatures-documentation.patch => 0179-appended-signatures-documentation.patch (100%) rename 0185-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0180-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (100%) rename 0186-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0181-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0187-ieee1275-claim-more-memory.patch => 0182-ieee1275-claim-more-memory.patch (100%) rename 0188-ieee1275-request-memory-with-ibm-client-architecture.patch => 0183-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) rename 0189-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0184-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) rename 0190-ieee1275-ofdisk-retry-on-open-failure.patch => 0185-ieee1275-ofdisk-retry-on-open-failure.patch (100%) rename 0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0186-Allow-chainloading-EFI-apps-from-loop-mounts.patch (100%) rename 0195-efinet-Add-DHCP-proxy-support.patch => 0187-efinet-Add-DHCP-proxy-support.patch (100%) rename 0196-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0188-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (97%) rename 0198-Suppress-gettext-error-message.patch => 0190-Suppress-gettext-error-message.patch (100%) delete mode 100644 0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch rename 0200-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0191-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) delete mode 100644 0192-Fix-disabling-grub-rpm-sort.patch rename 0202-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0192-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) delete mode 100644 0193-Don-t-check-for-rpmvercmp-in-librpm.patch rename 0203-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0193-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0204-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch (81%) rename 0205-normal-main-Discover-the-device-to-read-the-config-f.patch => 0195-normal-main-Discover-the-device-to-read-the-config-f.patch (100%) rename 0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0196-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (71%) rename 0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0197-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) rename 0210-Print-module-name-on-license-check-failure.patch => 0198-Print-module-name-on-license-check-failure.patch (100%) delete mode 100644 0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch rename 0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0199-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (100%) rename 0212-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0200-grub-mkconfig-restore-umask-for-grub.cfg.patch (91%) delete mode 100644 0201-Remove-outdated-URL-for-BLS-document.patch rename 0213-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0201-fs-btrfs-Use-full-btrfs-bootloader-area.patch (96%) delete mode 100644 0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch delete mode 100644 0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch diff --git a/0007-Add-secureboot-support-on-efi-chainloader.patch b/0007-Add-secureboot-support-on-efi-chainloader.patch index bfb5a9b6..6826cce1 100644 --- a/0007-Add-secureboot-support-on-efi-chainloader.patch +++ b/0007-Add-secureboot-support-on-efi-chainloader.patch @@ -164,15 +164,30 @@ following branches: Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1347291 Signed-off-by: Laszlo Ersek + +Also: + +commit cc06f149fbd2d8c1da1e83173d21629ba97e0d92 +Author: Raymund Will + +chainloader: Define machine types for RISC-V + +The commit "Add secureboot support on efi chainloader" didn't add machine +types for RISC-V, so this patch adds them. + +Note, that grub-core/loader/riscv/linux.c is skipped because Linux is not +supported yet. This patch might need a new revision once that's the case. + +Signed-off-by: David Abdurachmanov --- grub-core/kern/efi/efi.c | 14 +- grub-core/loader/arm64/linux.c | 4 +- - grub-core/loader/efi/chainloader.c | 816 +++++++++++++++++++++++++++++++++---- + grub-core/loader/efi/chainloader.c | 820 +++++++++++++++++++++++++++++++++---- grub-core/loader/efi/linux.c | 25 +- grub-core/loader/i386/efi/linux.c | 17 +- include/grub/efi/linux.h | 2 +- include/grub/efi/pe32.h | 52 ++- - 7 files changed, 840 insertions(+), 90 deletions(-) + 7 files changed, 844 insertions(+), 90 deletions(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c index 35b8f670602..4a2259aa1c7 100644 @@ -226,7 +241,7 @@ index a312c668685..04994d5c67d 100644 grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); goto fail; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 2bd80f4db3d..b54cf6986fc 100644 +index 2bd80f4db3d..e6a8d4ad0e9 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -32,6 +32,8 @@ @@ -261,7 +276,7 @@ index 2bd80f4db3d..b54cf6986fc 100644 grub_dl_unref (my_mod); return GRUB_ERR_NONE; -@@ -213,20 +221,690 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) +@@ -213,20 +221,694 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) return file_path; } @@ -376,6 +391,10 @@ index 2bd80f4db3d..b54cf6986fc 100644 + GRUB_PE32_MACHINE_I386; +#elif defined(__ia64__) + GRUB_PE32_MACHINE_IA64; ++#elif defined(__riscv) && (__riscv_xlen == 32) ++ GRUB_PE32_MACHINE_RISCV32; ++#elif defined(__riscv) && (__riscv_xlen == 64) ++ GRUB_PE32_MACHINE_RISCV64; +#else +#error this architecture is not supported by grub2 +#endif @@ -955,7 +974,7 @@ index 2bd80f4db3d..b54cf6986fc 100644 if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -238,15 +916,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -238,15 +920,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), address = 0; image_handle = 0; file_path = 0; @@ -1003,7 +1022,7 @@ index 2bd80f4db3d..b54cf6986fc 100644 if (! dev) goto fail; -@@ -283,17 +991,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -283,17 +995,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (! file_path) goto fail; @@ -1024,7 +1043,7 @@ index 2bd80f4db3d..b54cf6986fc 100644 status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES, GRUB_EFI_LOADER_CODE, -@@ -307,7 +1012,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -307,7 +1016,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } boot_image = (void *) ((grub_addr_t) address); @@ -1033,7 +1052,7 @@ index 2bd80f4db3d..b54cf6986fc 100644 { if (grub_errno == GRUB_ERR_NONE) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -317,7 +1022,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -317,7 +1026,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } #if defined (__i386__) || defined (__x86_64__) @@ -1042,7 +1061,7 @@ index 2bd80f4db3d..b54cf6986fc 100644 { struct grub_macho_fat_header *head = boot_image; if (head->magic -@@ -326,6 +1031,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -326,6 +1035,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_uint32_t i; struct grub_macho_fat_arch *archs = (struct grub_macho_fat_arch *) (head + 1); @@ -1057,7 +1076,7 @@ index 2bd80f4db3d..b54cf6986fc 100644 for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++) { if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype)) -@@ -340,79 +1053,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -340,79 +1057,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), > ~grub_cpu_to_le32 (archs[i].size) || grub_cpu_to_le32 (archs[i].offset) + grub_cpu_to_le32 (archs[i].size) @@ -1154,7 +1173,7 @@ index 2bd80f4db3d..b54cf6986fc 100644 if (dev) grub_device_close (dev); -@@ -424,6 +1097,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -424,6 +1101,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (address) efi_call_2 (b->free_pages, address, pages); diff --git a/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 3182fe99..030c71c9 100644 --- a/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -193,7 +193,7 @@ index 74888c463ba..585f2b57385 100644 grub_unregister_command (cmd); } diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index b54cf6986fc..3ff305b1d32 100644 +index e6a8d4ad0e9..07c4937898d 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -34,6 +34,7 @@ diff --git a/0011-IBM-client-architecture-CAS-reboot-support.patch b/0011-IBM-client-architecture-CAS-reboot-support.patch index eaaf9a42..431a443b 100644 --- a/0011-IBM-client-architecture-CAS-reboot-support.patch +++ b/0011-IBM-client-architecture-CAS-reboot-support.patch @@ -7,16 +7,20 @@ This is an implementation of IBM client architecture (CAS) reboot for GRUB. There are cases where the POWER firmware must reboot in order to support specific features requested by a kernel. The kernel calls -ibm,client-architecture-support and it may either return or reboot with the new -feature set. eg: +ibm,client-architecture-support and it may either return or reboot with +the new feature set. eg: Calling ibm,client-architecture-support.../ Elapsed time since release of system processors: 70959 mins 50 secs Welcome to GRUB! -Instead of return to the GRUB menu, it will check if the flag for CAS reboot is -set. If so, grub will automatically boot the last booted kernel using the same -parameters +Instead of return to the GRUB menu, it will check if the flag for CAS +reboot is set. If so, grub will automatically boot the last booted +kernel using the same parameters + +Signed-off-by: Paulo Flabiano Smorigo +[rharwood@redhat.com: commit message rewrap] +Signed-off-by: Robbie Harwood --- grub-core/kern/ieee1275/openfw.c | 63 ++++++++++++++++++++++++++++++++++++++++ grub-core/normal/main.c | 19 ++++++++++++ diff --git a/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch index c8bb9d3c..c8ccc7e2 100644 --- a/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -10,6 +10,8 @@ This should fix this bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=908519 Signed-off-by: Peter Jones +Signed-off-by: Paulo Flabiano Smorigo +Signed-off-by: Robbie Harwood --- grub-core/term/terminfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch index 430f6002..e8aa3678 100644 --- a/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch +++ b/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch @@ -5,6 +5,9 @@ Subject: [PATCH] Disable GRUB video support for IBM power machines Should fix the problem in bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=973205 + +Signed-off-by: Paulo Flabiano Smorigo +Signed-off-by: Robbie Harwood --- grub-core/kern/ieee1275/cmain.c | 5 ++++- grub-core/video/ieee1275.c | 9 ++++++--- diff --git a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch index ee8c7abf..5cbe731b 100644 --- a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -3,8 +3,11 @@ From: Mark Hamzy Date: Wed, 28 Mar 2012 14:46:41 -0500 Subject: [PATCH] Migrate PPC from Yaboot to Grub2 -Add configuration support for serial terminal consoles. This will set the -maximum screen size so that text is not overwritten. +Add configuration support for serial terminal consoles. This will set +the maximum screen size so that text is not overwritten. + +Signed-off-by: Mark Hamzy +Signed-off-by: Robbie Harwood --- Makefile.util.def | 7 +++ util/grub.d/20_ppc_terminfo.in | 114 +++++++++++++++++++++++++++++++++++++++++ diff --git a/0019-Add-fw_path-variable-revised.patch b/0019-Add-fw_path-variable-revised.patch index df9ef830..a8491e8c 100644 --- a/0019-Add-fw_path-variable-revised.patch +++ b/0019-Add-fw_path-variable-revised.patch @@ -8,6 +8,9 @@ found. It was originally written by Matthew Garrett, and adapted to fix the "No modules are loaded on grub2 network boot" issue: https://bugzilla.redhat.com/show_bug.cgi?id=857936 + +Signed-off-by: Paulo Flabiano Smorigo +Signed-off-by: Robbie Harwood --- grub-core/kern/main.c | 13 ++++++------- grub-core/normal/main.c | 25 ++++++++++++++++++++++++- diff --git a/0027-Don-t-emit-Booting-.-message.patch b/0027-Don-t-emit-Booting-.-message.patch deleted file mode 100644 index 4133b526..00000000 --- a/0027-Don-t-emit-Booting-.-message.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 18 Feb 2014 09:37:49 -0500 -Subject: [PATCH] Don't emit "Booting ..." message. - -UI team still hates this stuff, so we're disabling it for RHEL 7. - -Resolves: rhbz#1023142 - -Signed-off-by: Peter Jones ---- - grub-core/normal/menu.c | 4 +++- - grub-core/normal/menu_entry.c | 3 --- - 2 files changed, 3 insertions(+), 4 deletions(-) - -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d7a222e681b..37d753d8081 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -838,12 +838,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) - - /* Callback invoked immediately before a menu entry is executed. */ - static void --notify_booting (grub_menu_entry_t entry, -+notify_booting (grub_menu_entry_t __attribute__((unused)) entry, - void *userdata __attribute__((unused))) - { -+#if 0 - grub_printf (" "); - grub_printf_ (N_("Booting `%s'"), entry->title); - grub_printf ("\n\n"); -+#endif - } - - /* Callback invoked when a default menu entry executed because of a timeout -diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c -index 50eef918cf6..de64a367c4e 100644 ---- a/grub-core/normal/menu_entry.c -+++ b/grub-core/normal/menu_entry.c -@@ -1176,9 +1176,6 @@ run (struct screen *screen) - char *dummy[1] = { NULL }; - - grub_cls (); -- grub_printf (" "); -- grub_printf_ (N_("Booting a command list")); -- grub_printf ("\n\n"); - - errs_before = grub_err_printed_errors; - diff --git a/0028-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch similarity index 100% rename from 0028-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch rename to 0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch diff --git a/0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch similarity index 100% rename from 0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch rename to 0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch diff --git a/0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch similarity index 100% rename from 0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch rename to 0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch diff --git a/0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch similarity index 100% rename from 0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch rename to 0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch diff --git a/0032-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch similarity index 100% rename from 0032-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch rename to 0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch diff --git a/0033-Try-prefix-if-fw_path-doesn-t-work.patch b/0032-Try-prefix-if-fw_path-doesn-t-work.patch similarity index 100% rename from 0033-Try-prefix-if-fw_path-doesn-t-work.patch rename to 0032-Try-prefix-if-fw_path-doesn-t-work.patch diff --git a/0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch similarity index 87% rename from 0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch rename to 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch index 78a6fa1b..ff1c13ec 100644 --- a/0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +++ b/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch @@ -1,23 +1,26 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Mon, 16 Mar 2015 14:14:19 -0400 -Subject: [PATCH] Use Distribution Package Sort for grub2-mkconfig (#1124074) +Subject: [PATCH] Use rpm's sort for grub2-mkconfig -Users reported that newly installed kernels on their systems installed -with grub-mkconfig would not appear on the grub boot list in order -starting with the most recent. Added an option for rpm-based systems to -use the rpm-sort library to sort kernels instead. - -Resolves rhbz#1124074 +Add an option for rpm-based systems to use the rpm-sort library to sort +kernels. This avoids problems due to discrepancies between `sort -V` +and rpm. Signed-off-by: Robert Marshall [pjones: fix --enable-rpm-sort configure option] Signed-off-by: Peter Jones [thierry.vignaud: fix build with rpm-4.16] Signed-off-by: Thierry Vignaud +[tim: fix disabling grub-rpm-sort by ./configure] +Signed-off-by: Tim Landscheidt +[javierm: don't check for rpmvercmp in librpm] +Signed-off-by: Javier Martinez Canillas +[rharwood: commit message] +Signed-off-by: Robbie Harwood --- - configure.ac | 38 +++++++ - Makefile.util.def | 16 +++ + configure.ac | 37 ++++++ + Makefile.util.def | 17 +++ util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ util/grub-mkconfig_lib.in | 11 +- util/grub-rpm-sort.8 | 12 ++ @@ -26,7 +29,7 @@ Signed-off-by: Thierry Vignaud create mode 100644 util/grub-rpm-sort.8 diff --git a/configure.ac b/configure.ac -index bec8535af70..fdcb452581c 100644 +index bec8535af70..643a13f9147 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -45,7 +48,7 @@ index bec8535af70..fdcb452581c 100644 grub_TRANSFORM([grub-reboot.3]) grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) -@@ -1860,6 +1862,42 @@ fi +@@ -1860,6 +1862,35 @@ fi AC_SUBST([LIBDEVMAPPER]) @@ -54,6 +57,8 @@ index bec8535af70..fdcb452581c 100644 + [enable native rpm sorting of kernels in grub (default=guessed)])]) +if test x"$enable_rpm_sort" = xno ; then + rpm_sort_excuse="explicitly disabled" ++else ++ enable_rpm_sort=yes +fi + +if test x"$rpm_sort_excuse" = x ; then @@ -63,24 +68,15 @@ index bec8535af70..fdcb452581c 100644 +fi + +if test x"$rpm_sort_excuse" = x ; then -+ # Check for rpm library. -+ AC_CHECK_LIB([rpm], [rpmvercmp], [], -+ [rpm_sort_excuse="rpmlib missing rpmvercmp"]) ++ # Check for rpmio library. ++ AC_CHECK_LIB([rpmio], [rpmvercmp], [], ++ [rpm_sort_excuse="rpmio missing rpmvercmp"]) +fi + +if test x"$rpm_sort_excuse" = x ; then -+ LIBRPM="-lrpm"; -+ AC_DEFINE([HAVE_RPM], [1], -+ [Define to 1 if you have the rpm library.]) -+fi -+ -+if test x"$LIBRPM" = x ; then -+ # Check for rpm library. -+ AC_CHECK_LIB([rpmio], [rpmvercmp], [], -+ [rpm_sort_excuse="rpmio missing rpmvercmp"]) + LIBRPM="-lrpmio"; + AC_DEFINE([HAVE_RPMIO], [1], -+ [Define to 1 if you have the rpm library.]) ++ [Define to 1 if you have the rpmio library.]) +fi + +AC_SUBST([LIBRPM]) @@ -88,11 +84,31 @@ index bec8535af70..fdcb452581c 100644 LIBGEOM= if test x$host_kernel = xkfreebsd; then AC_CHECK_LIB([geom], [geom_gettree], [], +@@ -2047,6 +2078,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) + AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) + AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) + AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) ++AM_CONDITIONAL([COND_GRUB_RPM_SORT], [test x$enable_rpm_sort = xyes]) + AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) + if test x$FONT_SOURCE != x ; then + HAVE_FONT_SOURCE=1 +@@ -2168,6 +2200,11 @@ echo grub-mount: Yes + else + echo grub-mount: No "($grub_mount_excuse)" + fi ++if [ x"$rpm_sort_excuse" = x ]; then ++echo grub-rpm-sort: Yes ++else ++echo grub-rpm-sort: No "($rpm_sort_excuse)" ++fi + if [ x"$starfield_excuse" = x ]; then + echo starfield theme: Yes + echo With DejaVuSans font from $DJVU_FONT_SOURCE diff --git a/Makefile.util.def b/Makefile.util.def -index 2c9b283a230..ba4cf4b29b0 100644 +index 2c9b283a230..bc10cc79722 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -703,6 +703,22 @@ program = { +@@ -703,6 +703,23 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -110,6 +126,7 @@ index 2c9b283a230..ba4cf4b29b0 100644 + ldadd = libgrubkern.a; + ldadd = grub-core/lib/gnulib/libgnu.a; + ldadd = '$(LIBDEVMAPPER) $(LIBRPM)'; ++ condition = COND_GRUB_RPM_SORT; +}; + script = { diff --git a/0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 100% rename from 0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch diff --git a/0036-Add-friendly-grub2-password-config-tool-985962.patch b/0035-Add-friendly-grub2-password-config-tool-985962.patch similarity index 98% rename from 0036-Add-friendly-grub2-password-config-tool-985962.patch rename to 0035-Add-friendly-grub2-password-config-tool-985962.patch index 9807d0ea..2d6f18a6 100644 --- a/0036-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0035-Add-friendly-grub2-password-config-tool-985962.patch @@ -27,7 +27,7 @@ Andy Lutomirski create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index fdcb452581c..30fd84d8067 100644 +index 643a13f9147..25e1abb59b9 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -39,7 +39,7 @@ index fdcb452581c..30fd84d8067 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) diff --git a/Makefile.util.def b/Makefile.util.def -index ba4cf4b29b0..1a7dd433e33 100644 +index bc10cc79722..8ca4c14f0b9 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -452,6 +452,12 @@ script = { @@ -55,7 +55,7 @@ index ba4cf4b29b0..1a7dd433e33 100644 script = { name = '10_windows'; common = util/grub.d/10_windows.in; -@@ -740,6 +746,13 @@ script = { +@@ -741,6 +747,13 @@ script = { installdir = sbin; }; diff --git a/0037-tcp-add-window-scaling-support.patch b/0036-tcp-add-window-scaling-support.patch similarity index 100% rename from 0037-tcp-add-window-scaling-support.patch rename to 0036-tcp-add-window-scaling-support.patch diff --git a/0038-efinet-and-bootp-add-support-for-dhcpv6.patch b/0037-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 100% rename from 0038-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0037-efinet-and-bootp-add-support-for-dhcpv6.patch diff --git a/0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 98% rename from 0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index f203685b..bf78c813 100644 --- a/0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -23,7 +23,7 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 30fd84d8067..ed31ea457d2 100644 +index 25e1abb59b9..58e57a745fa 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) @@ -43,10 +43,10 @@ index 30fd84d8067..ed31ea457d2 100644 grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) diff --git a/Makefile.util.def b/Makefile.util.def -index 1a7dd433e33..cdd2f51fe4b 100644 +index 8ca4c14f0b9..43a1c7453b1 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -732,6 +732,13 @@ script = { +@@ -733,6 +733,13 @@ script = { installdir = sbin; }; diff --git a/0040-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0039-bz1374141-fix-incorrect-mask-for-ppc64.patch similarity index 95% rename from 0040-bz1374141-fix-incorrect-mask-for-ppc64.patch rename to 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch index 1bb26586..ef992f5d 100644 --- a/0040-bz1374141-fix-incorrect-mask-for-ppc64.patch +++ b/0039-bz1374141-fix-incorrect-mask-for-ppc64.patch @@ -25,6 +25,9 @@ This patch changes it as below. 0000 0000 0000 0000 0000 0011 1111 1111 # ~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4)) The count of zero with __builtin_clz can be 22. (clz counts the number of one bits preceding the most significant zero bit) + +Signed-off-by: Masahiro Matsuya +Signed-off-by: Robbie Harwood --- grub-core/net/drivers/ieee1275/ofnet.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/0041-Make-grub_fatal-also-backtrace.patch b/0040-Make-grub_fatal-also-backtrace.patch similarity index 100% rename from 0041-Make-grub_fatal-also-backtrace.patch rename to 0040-Make-grub_fatal-also-backtrace.patch diff --git a/0042-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch similarity index 99% rename from 0042-Fix-up-some-man-pages-rpmdiff-noticed.patch rename to 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch index 8016a621..be584175 100644 --- a/0042-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -13,7 +13,7 @@ Subject: [PATCH] Fix up some man pages rpmdiff noticed. create mode 100644 util/grub-syslinux2cfg.1 diff --git a/configure.ac b/configure.ac -index ed31ea457d2..537ed411469 100644 +index 58e57a745fa..a0030632220 100644 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) diff --git a/0043-Make-our-info-pages-say-grub2-where-appropriate.patch b/0042-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 100% rename from 0043-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0042-Make-our-info-pages-say-grub2-where-appropriate.patch diff --git a/0044-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 100% rename from 0044-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch diff --git a/0045-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 100% rename from 0045-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch diff --git a/0046-export-btrfs_subvol-and-btrfs_subvolid.patch b/0045-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 100% rename from 0046-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0045-export-btrfs_subvol-and-btrfs_subvolid.patch diff --git a/0047-grub2-btrfs-03-follow_default.patch b/0046-grub2-btrfs-03-follow_default.patch similarity index 100% rename from 0047-grub2-btrfs-03-follow_default.patch rename to 0046-grub2-btrfs-03-follow_default.patch diff --git a/0048-grub2-btrfs-04-grub2-install.patch b/0047-grub2-btrfs-04-grub2-install.patch similarity index 100% rename from 0048-grub2-btrfs-04-grub2-install.patch rename to 0047-grub2-btrfs-04-grub2-install.patch diff --git a/0049-grub2-btrfs-05-grub2-mkconfig.patch b/0048-grub2-btrfs-05-grub2-mkconfig.patch similarity index 100% rename from 0049-grub2-btrfs-05-grub2-mkconfig.patch rename to 0048-grub2-btrfs-05-grub2-mkconfig.patch diff --git a/0050-grub2-btrfs-06-subvol-mount.patch b/0049-grub2-btrfs-06-subvol-mount.patch similarity index 100% rename from 0050-grub2-btrfs-06-subvol-mount.patch rename to 0049-grub2-btrfs-06-subvol-mount.patch diff --git a/0051-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 100% rename from 0051-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch diff --git a/0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 100% rename from 0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch diff --git a/0053-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 100% rename from 0053-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch diff --git a/0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch similarity index 89% rename from 0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename to 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch index 4fa92c0d..ccdf2829 100644 --- a/0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch +++ b/0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 3ff305b1d32..ba3d2930197 100644 +index 07c4937898d..89ac84cc663 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -65,7 +65,7 @@ grub_chainloader_unload (void) @@ -34,7 +34,7 @@ index 3ff305b1d32..ba3d2930197 100644 grub_loader_unset (); -@@ -523,10 +523,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) +@@ -527,10 +527,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) static grub_efi_boolean_t handle_image (void *data, grub_efi_uint32_t datasize) { @@ -46,7 +46,7 @@ index 3ff305b1d32..ba3d2930197 100644 char *buffer_aligned = NULL; grub_efi_uint32_t i; struct grub_pe32_section_table *section; -@@ -537,8 +536,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -541,8 +540,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) int found_entry_point = 0; int rc; @@ -55,7 +55,7 @@ index 3ff305b1d32..ba3d2930197 100644 rc = read_header (data, datasize, &context); if (rc < 0) { -@@ -578,8 +575,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -582,8 +579,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n", context.image_size, datasize); @@ -66,7 +66,7 @@ index 3ff305b1d32..ba3d2930197 100644 if (efi_status != GRUB_EFI_SUCCESS) { -@@ -811,14 +808,14 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -815,14 +812,14 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_dprintf ("chain", "entry_point returned %ld\n", efi_status); grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); @@ -83,7 +83,7 @@ index 3ff305b1d32..ba3d2930197 100644 return 0; } -@@ -826,10 +823,7 @@ error_exit: +@@ -830,10 +827,7 @@ error_exit: static grub_err_t grub_secureboot_chainloader_unload (void) { @@ -95,7 +95,7 @@ index 3ff305b1d32..ba3d2930197 100644 grub_free (file_path); grub_free (cmdline); cmdline = 0; -@@ -1096,7 +1090,7 @@ fail: +@@ -1100,7 +1094,7 @@ fail: grub_free (file_path); if (address) diff --git a/0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch similarity index 94% rename from 0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename to 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch index 1a96b433..ef41fe1a 100644 --- a/0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +++ b/0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch @@ -12,10 +12,10 @@ Signed-off-by: Peter Jones 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index ba3d2930197..47f5aa14817 100644 +index 89ac84cc663..ac8dfd40c61 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -806,7 +806,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) +@@ -810,7 +810,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) efi_status = efi_call_2 (entry_point, grub_efi_image_handle, grub_efi_system_table); diff --git a/0056-don-t-use-int-for-efi-status.patch b/0055-don-t-use-int-for-efi-status.patch similarity index 100% rename from 0056-don-t-use-int-for-efi-status.patch rename to 0055-don-t-use-int-for-efi-status.patch diff --git a/0057-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 100% rename from 0057-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch diff --git a/0058-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 100% rename from 0058-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch diff --git a/0059-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 100% rename from 0059-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch diff --git a/0060-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch similarity index 100% rename from 0060-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename to 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch diff --git a/0061-align-struct-efi_variable-better.patch b/0060-align-struct-efi_variable-better.patch similarity index 100% rename from 0061-align-struct-efi_variable-better.patch rename to 0060-align-struct-efi_variable-better.patch diff --git a/0062-Add-BLS-support-to-grub-mkconfig.patch b/0061-Add-BLS-support-to-grub-mkconfig.patch similarity index 98% rename from 0062-Add-BLS-support-to-grub-mkconfig.patch rename to 0061-Add-BLS-support-to-grub-mkconfig.patch index 9679fb9f..f7c8064e 100644 --- a/0062-Add-BLS-support-to-grub-mkconfig.patch +++ b/0061-Add-BLS-support-to-grub-mkconfig.patch @@ -20,7 +20,9 @@ kernels are found in the boot directory were proposed by Yclept Nemo and Tom Gundersen respectively. Signed-off-by: Peter Jones +[javierm: remove outdated URL for BLS document] Signed-off-by: Javier Martinez Canillas +Signed-off-by: Robbie Harwood --- util/grub-mkconfig.8 | 4 + util/grub-mkconfig.in | 9 +- @@ -141,7 +143,7 @@ index fafeac95061..d8bb4069360 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 7bb3a211a7c..fdf324b7ab1 100644 +index 7bb3a211a7c..6bceabf3dc9 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -82,6 +82,223 @@ case x"$GRUB_FS" in @@ -162,7 +164,7 @@ index 7bb3a211a7c..fdf324b7ab1 100644 +# +# The $bls_parser parses the BootLoaderSpec files stored in /boot/loader/entries and +# populates the boot menu. Please refer to the Boot Loader Specification documentation -+# for the files format: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/. ++# for the files format: https://systemd.io/BOOT_LOADER_SPECIFICATION/. + +EOF +} diff --git a/0063-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 100% rename from 0063-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch diff --git a/0064-Add-linux-and-initrd-commands-for-grub-emu.patch b/0063-Add-linux-and-initrd-commands-for-grub-emu.patch similarity index 100% rename from 0064-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0063-Add-linux-and-initrd-commands-for-grub-emu.patch diff --git a/0065-Add-grub2-switch-to-blscfg.patch b/0064-Add-grub2-switch-to-blscfg.patch similarity index 99% rename from 0065-Add-grub2-switch-to-blscfg.patch rename to 0064-Add-grub2-switch-to-blscfg.patch index ce40e907..ac30490f 100644 --- a/0065-Add-grub2-switch-to-blscfg.patch +++ b/0064-Add-grub2-switch-to-blscfg.patch @@ -17,10 +17,10 @@ Signed-off-by: Jan Hlavac create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index cdd2f51fe4b..afc4d7b0c3e 100644 +index 43a1c7453b1..a90879fa9ba 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1364,6 +1364,13 @@ program = { +@@ -1365,6 +1365,13 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; diff --git a/0066-make-better-backtraces.patch b/0065-make-better-backtraces.patch similarity index 99% rename from 0066-make-better-backtraces.patch rename to 0065-make-better-backtraces.patch index a65af3db..63765671 100644 --- a/0066-make-better-backtraces.patch +++ b/0065-make-better-backtraces.patch @@ -38,7 +38,7 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index afc4d7b0c3e..41906486a71 100644 +index a90879fa9ba..48512bc6311 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -51,6 +51,12 @@ library = { diff --git a/0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 100% rename from 0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch diff --git a/0068-Work-around-some-minor-include-path-weirdnesses.patch b/0067-Work-around-some-minor-include-path-weirdnesses.patch similarity index 100% rename from 0068-Work-around-some-minor-include-path-weirdnesses.patch rename to 0067-Work-around-some-minor-include-path-weirdnesses.patch diff --git a/0069-Make-it-possible-to-enabled-build-id-sha1.patch b/0068-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 98% rename from 0069-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0068-Make-it-possible-to-enabled-build-id-sha1.patch index 356a4d81..f68fc58b 100644 --- a/0069-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0068-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index 537ed411469..b4455e4732d 100644 +index a0030632220..b50fb2e9897 100644 --- a/configure.ac +++ b/configure.ac @@ -1470,7 +1470,15 @@ grub_PROG_TARGET_CC diff --git a/0070-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 100% rename from 0070-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch diff --git a/0071-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 100% rename from 0071-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch diff --git a/0072-Fixup-for-newer-compiler.patch b/0071-Fixup-for-newer-compiler.patch similarity index 100% rename from 0072-Fixup-for-newer-compiler.patch rename to 0071-Fixup-for-newer-compiler.patch diff --git a/0073-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 100% rename from 0073-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch diff --git a/0074-Fixup-for-newer-compiler.patch b/0073-Fixup-for-newer-compiler.patch similarity index 100% rename from 0074-Fixup-for-newer-compiler.patch rename to 0073-Fixup-for-newer-compiler.patch diff --git a/0075-Add-support-for-non-Ethernet-network-cards.patch b/0074-Add-support-for-non-Ethernet-network-cards.patch similarity index 100% rename from 0075-Add-support-for-non-Ethernet-network-cards.patch rename to 0074-Add-support-for-non-Ethernet-network-cards.patch diff --git a/0076-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 100% rename from 0076-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch diff --git a/0077-bootp-New-net_bootp6-command.patch b/0076-bootp-New-net_bootp6-command.patch similarity index 100% rename from 0077-bootp-New-net_bootp6-command.patch rename to 0076-bootp-New-net_bootp6-command.patch diff --git a/0078-efinet-UEFI-IPv6-PXE-support.patch b/0077-efinet-UEFI-IPv6-PXE-support.patch similarity index 100% rename from 0078-efinet-UEFI-IPv6-PXE-support.patch rename to 0077-efinet-UEFI-IPv6-PXE-support.patch diff --git a/0079-grub.texi-Add-net_bootp6-doument.patch b/0078-grub.texi-Add-net_bootp6-doument.patch similarity index 100% rename from 0079-grub.texi-Add-net_bootp6-doument.patch rename to 0078-grub.texi-Add-net_bootp6-doument.patch diff --git a/0080-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 100% rename from 0080-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch diff --git a/0081-efinet-Setting-network-from-UEFI-device-path.patch b/0080-efinet-Setting-network-from-UEFI-device-path.patch similarity index 100% rename from 0081-efinet-Setting-network-from-UEFI-device-path.patch rename to 0080-efinet-Setting-network-from-UEFI-device-path.patch diff --git a/0082-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 100% rename from 0082-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch diff --git a/0083-Support-UEFI-networking-protocols.patch b/0082-Support-UEFI-networking-protocols.patch similarity index 100% rename from 0083-Support-UEFI-networking-protocols.patch rename to 0082-Support-UEFI-networking-protocols.patch diff --git a/0084-AUDIT-0-http-boot-tracker-bug.patch b/0083-AUDIT-0-http-boot-tracker-bug.patch similarity index 100% rename from 0084-AUDIT-0-http-boot-tracker-bug.patch rename to 0083-AUDIT-0-http-boot-tracker-bug.patch diff --git a/0085-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 100% rename from 0085-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch diff --git a/0086-Add-auto-hide-menu-support.patch b/0085-Add-auto-hide-menu-support.patch similarity index 99% rename from 0086-Add-auto-hide-menu-support.patch rename to 0085-Add-auto-hide-menu-support.patch index efb76c40..863cd053 100644 --- a/0086-Add-auto-hide-menu-support.patch +++ b/0085-Add-auto-hide-menu-support.patch @@ -49,7 +49,7 @@ Changes in v2: create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index 41906486a71..04551e095bd 100644 +index 48512bc6311..314e6f2acf8 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { diff --git a/0087-Add-grub-set-bootflag-utility.patch b/0086-Add-grub-set-bootflag-utility.patch similarity index 95% rename from 0087-Add-grub-set-bootflag-utility.patch rename to 0086-Add-grub-set-bootflag-utility.patch index f5ff7d38..e39f8beb 100644 --- a/0087-Add-grub-set-bootflag-utility.patch +++ b/0086-Add-grub-set-bootflag-utility.patch @@ -31,24 +31,27 @@ and a symlink to grub-boot-success.timer should be added to /lib/systemd/user/timers.target.wants. Signed-off-by: Hans de Goede +[makhomed: grub-boot-success.timer: Only run if not in a container] +Signed-off-by: Gena Makhomed +Signed-off-by: Robbie Harwood --- Makefile.util.def | 7 ++ util/grub-set-bootflag.c | 160 +++++++++++++++++++++++++++++++++++++++++ conf/Makefile.extra-dist | 3 + docs/grub-boot-success.service | 6 ++ - docs/grub-boot-success.timer | 6 ++ + docs/grub-boot-success.timer | 7 ++ util/grub-set-bootflag.1 | 20 ++++++ - 6 files changed, 202 insertions(+) + 6 files changed, 203 insertions(+) create mode 100644 util/grub-set-bootflag.c create mode 100644 docs/grub-boot-success.service create mode 100644 docs/grub-boot-success.timer create mode 100644 util/grub-set-bootflag.1 diff --git a/Makefile.util.def b/Makefile.util.def -index 04551e095bd..c6375933faa 100644 +index 314e6f2acf8..0b85a7fce4a 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1445,3 +1445,10 @@ program = { +@@ -1446,3 +1446,10 @@ program = { ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -253,13 +256,14 @@ index 00000000000..80e79584c91 +ExecStart=/usr/sbin/grub2-set-bootflag boot_success diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer new file mode 100644 -index 00000000000..5d8fcba21aa +index 00000000000..406f1720056 --- /dev/null +++ b/docs/grub-boot-success.timer -@@ -0,0 +1,6 @@ +@@ -0,0 +1,7 @@ +[Unit] +Description=Mark boot as successful after the user session has run 2 minutes +ConditionUser=!@system ++ConditionVirtualization=!container + +[Timer] +OnActiveSec=2min diff --git a/0088-docs-Add-grub-boot-indeterminate.service-example.patch b/0087-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0088-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0087-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0089-gentpl-add-disable-support.patch b/0088-gentpl-add-disable-support.patch similarity index 100% rename from 0089-gentpl-add-disable-support.patch rename to 0088-gentpl-add-disable-support.patch diff --git a/0090-gentpl-add-pc-firmware-type.patch b/0089-gentpl-add-pc-firmware-type.patch similarity index 100% rename from 0090-gentpl-add-pc-firmware-type.patch rename to 0089-gentpl-add-pc-firmware-type.patch diff --git a/0091-efinet-also-use-the-firmware-acceleration-for-http.patch b/0090-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0091-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0090-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0092-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0092-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 98% rename from 0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index b65eafcc..ee2216e5 100644 --- a/0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index b4455e4732d..3405348178a 100644 +index b50fb2e9897..b27573b3de5 100644 --- a/configure.ac +++ b/configure.ac @@ -877,11 +877,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p @@ -45,7 +45,7 @@ index b4455e4732d..3405348178a 100644 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ grub_cv_target_cc_soft_float=no if test "x$target_cpu" = xarm64; then -@@ -2018,6 +2030,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +@@ -2011,6 +2023,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" diff --git a/0094-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0093-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0094-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0095-Rework-how-the-fdt-command-builds.patch b/0094-Rework-how-the-fdt-command-builds.patch similarity index 84% rename from 0095-Rework-how-the-fdt-command-builds.patch rename to 0094-Rework-how-the-fdt-command-builds.patch index 71328da1..e233067a 100644 --- a/0095-Rework-how-the-fdt-command-builds.patch +++ b/0094-Rework-how-the-fdt-command-builds.patch @@ -13,13 +13,16 @@ grub_fdt_load in xen_boot is not defined grub_fdt_unload in xen_boot is not defined Signed-off-by: Peter Jones +[javierm: Fix build with platform emu, aarch64, and risc-v] +Signed-off-by: Javier Martinez Canillas +Signed-off-by: Robbie Harwood --- grub-core/Makefile.core.def | 5 ++--- grub-core/lib/fdt.c | 2 -- grub-core/loader/efi/fdt.c | 2 ++ - include/grub/fdt.h | 4 ++++ + include/grub/fdt.h | 6 ++++++ grub-core/Makefile.am | 1 + - 5 files changed, 9 insertions(+), 5 deletions(-) + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index c40170f2dd2..84a3d89de9a 100644 @@ -85,23 +88,25 @@ index c86f283d756..c572415d38a 100644 static void *fdt; diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index e609c7e4111..22b7c5463fc 100644 +index e609c7e4111..3514aa4a5b6 100644 --- a/include/grub/fdt.h +++ b/include/grub/fdt.h -@@ -19,6 +19,8 @@ +@@ -19,6 +19,9 @@ #ifndef GRUB_FDT_HEADER #define GRUB_FDT_HEADER 1 -+#if defined(__arm__) || defined(__aarch64__) ++#if !defined(GRUB_MACHINE_EMU) && \ ++ (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) + #include #include -@@ -144,4 +146,6 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch +@@ -144,4 +147,7 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16); \ }) -+#endif /* defined(__arm__) || defined(__aarch64__) */ ++#endif /* !defined(GRUB_MACHINE_EMU) && \ ++ (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) */ + #endif /* ! GRUB_FDT_HEADER */ diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am diff --git a/0096-Disable-non-wordsize-allocations-on-arm.patch b/0095-Disable-non-wordsize-allocations-on-arm.patch similarity index 97% rename from 0096-Disable-non-wordsize-allocations-on-arm.patch rename to 0095-Disable-non-wordsize-allocations-on-arm.patch index f614c9ee..e28041a1 100644 --- a/0096-Disable-non-wordsize-allocations-on-arm.patch +++ b/0095-Disable-non-wordsize-allocations-on-arm.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index 3405348178a..152e7dba652 100644 +index b27573b3de5..bb4e05ceef3 100644 --- a/configure.ac +++ b/configure.ac @@ -1288,6 +1288,26 @@ if test "x$target_cpu" = xarm; then diff --git a/0097-Prepend-prefix-when-HTTP-path-is-relative.patch b/0096-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 100% rename from 0097-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0096-Prepend-prefix-when-HTTP-path-is-relative.patch diff --git a/0098-Make-grub_error-more-verbose.patch b/0097-Make-grub_error-more-verbose.patch similarity index 100% rename from 0098-Make-grub_error-more-verbose.patch rename to 0097-Make-grub_error-more-verbose.patch diff --git a/0099-Make-reset-an-alias-for-the-reboot-command.patch b/0098-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0099-Make-reset-an-alias-for-the-reboot-command.patch rename to 0098-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0100-Add-a-version-command.patch b/0099-Add-a-version-command.patch similarity index 99% rename from 0100-Add-a-version-command.patch rename to 0099-Add-a-version-command.patch index 30c8224f..bf3b4b80 100644 --- a/0100-Add-a-version-command.patch +++ b/0099-Add-a-version-command.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index 152e7dba652..cfdac6bed5a 100644 +index bb4e05ceef3..59ccda24475 100644 --- a/configure.ac +++ b/configure.ac @@ -312,6 +312,19 @@ AC_SUBST(target_cpu) diff --git a/0101-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 100% rename from 0101-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch diff --git a/0102-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 100% rename from 0102-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch diff --git a/0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 91% rename from 0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch index ba918edf..06329b9c 100644 --- a/0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch +++ b/0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch @@ -23,6 +23,9 @@ Additionally, we now try to locate kernel+initrd+cmdline+etc below we try a higher address. Signed-off-by: Peter Jones +[david.abdurachmanov: fix macro for riscv64] +Signed-off-by: David Abdurachmanov +Signed-off-by: Robbie Harwood --- grub-core/kern/efi/mm.c | 8 ++++---- grub-core/loader/i386/efi/linux.c | 24 +++++++++++++++++------- @@ -30,8 +33,9 @@ Signed-off-by: Peter Jones include/grub/arm64/efi/memory.h | 1 + include/grub/i386/efi/memory.h | 1 + include/grub/ia64/efi/memory.h | 1 + + include/grub/riscv64/efi/memory.h | 1 + include/grub/x86_64/efi/memory.h | 4 +++- - 7 files changed, 28 insertions(+), 12 deletions(-) + 8 files changed, 29 insertions(+), 12 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c index 85ad4b4494c..e84961d078c 100644 @@ -176,6 +180,17 @@ index 2c64918e3f7..a4c2ec83502 100644 #define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffff +#define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS + #endif /* ! GRUB_MEMORY_CPU_HEADER */ +diff --git a/include/grub/riscv64/efi/memory.h b/include/grub/riscv64/efi/memory.h +index c6cb3241714..acb61dca44b 100644 +--- a/include/grub/riscv64/efi/memory.h ++++ b/include/grub/riscv64/efi/memory.h +@@ -2,5 +2,6 @@ + #include + + #define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffffffffULL ++#define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS + #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h index 46e9145a308..e81cfb32213 100644 diff --git a/0104-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 100% rename from 0104-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch diff --git a/0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 95% rename from 0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index de71484b..1fa705e6 100644 --- a/0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index cfdac6bed5a..bd28edf3141 100644 +index 59ccda24475..6eb297fdbf6 100644 --- a/configure.ac +++ b/configure.ac @@ -1480,11 +1480,11 @@ fi @@ -29,7 +29,7 @@ index cfdac6bed5a..bd28edf3141 100644 fi CPPFLAGS="$TARGET_CPPFLAGS" -@@ -2054,6 +2054,14 @@ if test x"$enable_werror" != xno ; then +@@ -2047,6 +2047,14 @@ if test x"$enable_werror" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Werror" fi diff --git a/0106-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0106-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0107-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0107-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0108-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 100% rename from 0108-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch diff --git a/0109-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 100% rename from 0109-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch diff --git a/0110-Fix-getroot.c-s-trampolines.patch b/0109-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0110-Fix-getroot.c-s-trampolines.patch rename to 0109-Fix-getroot.c-s-trampolines.patch diff --git a/0111-Do-not-allow-stack-trampolines-anywhere.patch b/0110-Do-not-allow-stack-trampolines-anywhere.patch similarity index 93% rename from 0111-Do-not-allow-stack-trampolines-anywhere.patch rename to 0110-Do-not-allow-stack-trampolines-anywhere.patch index 4ee639d4..2a3247af 100644 --- a/0111-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0110-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index bd28edf3141..907477a585c 100644 +index 6eb297fdbf6..c6bd965f1f9 100644 --- a/configure.ac +++ b/configure.ac -@@ -2062,6 +2062,9 @@ if test x"$enable_wextra" != xno ; then +@@ -2055,6 +2055,9 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi diff --git a/0112-Reimplement-boot_counter.patch b/0111-Reimplement-boot_counter.patch similarity index 99% rename from 0112-Reimplement-boot_counter.patch rename to 0111-Reimplement-boot_counter.patch index 164b2291..a203929f 100644 --- a/0112-Reimplement-boot_counter.patch +++ b/0111-Reimplement-boot_counter.patch @@ -23,7 +23,7 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index c6375933faa..2e5e05b25f1 100644 +index 0b85a7fce4a..27a13bc734e 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { diff --git a/0113-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0112-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 99% rename from 0113-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch index 84c13706..957fda38 100644 --- a/0113-Fix-menu-entry-selection-based-on-ID-and-title.patch +++ b/0112-Fix-menu-entry-selection-based-on-ID-and-title.patch @@ -24,7 +24,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 37d753d8081..ea714d27176 100644 +index d7a222e681b..4a02aadb01c 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -164,12 +164,12 @@ grub_menu_set_timeout (int timeout) diff --git a/0114-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 100% rename from 0114-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch diff --git a/0115-Add-efi-export-env-and-efi-load-env-commands.patch b/0114-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 100% rename from 0115-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0114-Add-efi-export-env-and-efi-load-env-commands.patch diff --git a/0116-Make-it-possible-to-subtract-conditions-from-debug.patch b/0115-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 100% rename from 0116-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0115-Make-it-possible-to-subtract-conditions-from-debug.patch diff --git a/0117-Export-all-variables-from-the-initial-context-when-c.patch b/0116-Export-all-variables-from-the-initial-context-when-c.patch similarity index 97% rename from 0117-Export-all-variables-from-the-initial-context-when-c.patch rename to 0116-Export-all-variables-from-the-initial-context-when-c.patch index bfe31653..4e32260c 100644 --- a/0117-Export-all-variables-from-the-initial-context-when-c.patch +++ b/0116-Export-all-variables-from-the-initial-context-when-c.patch @@ -30,7 +30,7 @@ index ee53d4a68e5..87edd254c44 100644 int grub_extractor_level = 0; diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index ea714d27176..d4832f17699 100644 +index 4a02aadb01c..fe2e77a43e2 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -375,8 +375,6 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) diff --git a/0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 99% rename from 0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index 6797ffc4..92f259dc 100644 --- a/0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -21,7 +21,7 @@ Signed-off-by: Robbie Harwood rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index 2e5e05b25f1..11ab2d6fad1 100644 +index 27a13bc734e..2e6ad979c3e 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -459,14 +459,14 @@ script = { diff --git a/0119-Fix-systemctl-kexec-exit-status-check.patch b/0118-Fix-systemctl-kexec-exit-status-check.patch similarity index 100% rename from 0119-Fix-systemctl-kexec-exit-status-check.patch rename to 0118-Fix-systemctl-kexec-exit-status-check.patch diff --git a/0120-Print-grub-emu-linux-loader-messages-as-debug.patch b/0119-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 100% rename from 0120-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0119-Print-grub-emu-linux-loader-messages-as-debug.patch diff --git a/0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 98% rename from 0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch index 418a1ef4..bd7b2c1b 100644 --- a/0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch +++ b/0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch @@ -17,7 +17,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d4832f17699..14ceb9bb060 100644 +index fe2e77a43e2..ec0c92bade0 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -285,7 +285,7 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) diff --git a/0123-Do-better-in-bootstrap.conf.patch b/0121-Do-better-in-bootstrap.conf.patch similarity index 100% rename from 0123-Do-better-in-bootstrap.conf.patch rename to 0121-Do-better-in-bootstrap.conf.patch diff --git a/0122-Fix-undefined-references-for-fdt-when-building-with-.patch b/0122-Fix-undefined-references-for-fdt-when-building-with-.patch deleted file mode 100644 index 9065da8a..00000000 --- a/0122-Fix-undefined-references-for-fdt-when-building-with-.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Wed, 1 May 2019 00:36:19 +0200 -Subject: [PATCH] Fix undefined references for fdt when building with platform - emu - -The fdt module isn't build for this platform, so adding the declarations -with platform emu will lead to the following undefined reference errors: - -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x500): undefined reference to `grub_fdt_add_subnode' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x518): undefined reference to `grub_fdt_check_header' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x530): undefined reference to `grub_fdt_check_header_nosize' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x548): undefined reference to `grub_fdt_create_empty_tree' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x560): undefined reference to `grub_fdt_find_subnode' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x578): undefined reference to `grub_fdt_first_node' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x590): undefined reference to `grub_fdt_get_nodename' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x5a8): undefined reference to `grub_fdt_get_prop' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x5c0): undefined reference to `grub_fdt_next_node' -BUILDSTDERR: /usr/bin/ld: grub_emu_lite-symlist.o:(.data+0x5d8): undefined reference to `grub_fdt_set_prop' -BUILDSTDERR: collect2: error: ld returned 1 exit status -BUILDSTDERR: make[1]: *** [Makefile:27093: grub-emu-lite] Error 1 -BUILDSTDERR: make[1]: *** Waiting for unfinished jobs.... - -Signed-off-by: Javier Martinez Canillas ---- - include/grub/fdt.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index 22b7c5463fc..2041341fd68 100644 ---- a/include/grub/fdt.h -+++ b/include/grub/fdt.h -@@ -19,7 +19,7 @@ - #ifndef GRUB_FDT_HEADER - #define GRUB_FDT_HEADER 1 - --#if defined(__arm__) || defined(__aarch64__) -+#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__aarch64__)) - - #include - #include diff --git a/0124-Use-git-to-apply-gnulib-patches.patch b/0122-Use-git-to-apply-gnulib-patches.patch similarity index 100% rename from 0124-Use-git-to-apply-gnulib-patches.patch rename to 0122-Use-git-to-apply-gnulib-patches.patch diff --git a/0126-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0123-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0126-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0123-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0127-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0124-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0127-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0124-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch b/0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch deleted file mode 100644 index 35f2878b..00000000 --- a/0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 27 Aug 2019 10:34:24 +0200 -Subject: [PATCH] Fix build error with the fdt module on risc-v - -The risc-v architecture also uses Device Trees, but the symbols in the -fdt header aren't defined for this arch which lead to following error: - -BUILDSTDERR: ../../grub-core/loader/efi/fdt.c: In function 'grub_fdt_load': -BUILDSTDERR: ../../grub-core/loader/efi/fdt.c:48:39: warning: implicit declaration of function 'grub_fdt_get_totalsize' [-Wimplicit-function-declaration] -BUILDSTDERR: 48 | size = GRUB_EFI_BYTES_TO_PAGES (grub_fdt_get_totalsize (fdt)); - -Signed-off-by: Javier Martinez Canillas ---- - include/grub/fdt.h | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index 2041341fd68..3514aa4a5b6 100644 ---- a/include/grub/fdt.h -+++ b/include/grub/fdt.h -@@ -19,7 +19,8 @@ - #ifndef GRUB_FDT_HEADER - #define GRUB_FDT_HEADER 1 - --#if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__aarch64__)) -+#if !defined(GRUB_MACHINE_EMU) && \ -+ (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) - - #include - #include -@@ -146,6 +147,7 @@ int EXPORT_FUNC(grub_fdt_set_prop) (void *fdt, unsigned int nodeoffset, const ch - grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16); \ - }) - --#endif /* defined(__arm__) || defined(__aarch64__) */ -+#endif /* !defined(GRUB_MACHINE_EMU) && \ -+ (defined(__arm__) || defined(__aarch64__) || defined(__riscv)) */ - - #endif /* ! GRUB_FDT_HEADER */ diff --git a/0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0125-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 91% rename from 0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0125-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch index 54b73e6c..a32c1465 100644 --- a/0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +++ b/0125-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch @@ -3,6 +3,9 @@ From: Hans de Goede Date: Tue, 26 Nov 2019 09:51:41 +0100 Subject: [PATCH] grub.d: Fix boot_indeterminate getting set on boot_success=0 boot +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit The "grub.d: Split out boot success reset from menu auto hide script" not only moved the code to clear boot_success and boot_indeterminate @@ -42,12 +45,15 @@ boot_indeterminate to 2 when it was 1 before. Fixes: "grub.d: Split out boot success reset from menu auto hide script" Signed-off-by: Hans de Goede +[jpokorny: 01_menu_auto_hide.in: fix a then/than typo] +Signed-off-by: Jan Pokorný +Signed-off-by: Robbie Harwood --- util/grub.d/10_reset_boot_success.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in -index 6c88d933dde..737e1ae5b68 100644 +index 6c88d933dde..e73f4137b36 100644 --- a/util/grub.d/10_reset_boot_success.in +++ b/util/grub.d/10_reset_boot_success.in @@ -6,18 +6,18 @@ @@ -67,7 +73,7 @@ index 6c88d933dde..737e1ae5b68 100644 set boot_indeterminate=0 -else - increment boot_indeterminate -+# Avoid boot_indeterminate causing the menu to be hidden more then once ++# Avoid boot_indeterminate causing the menu to be hidden more than once +elif [ "\${boot_indeterminate}" = "1" ]; then + set boot_indeterminate=2 fi diff --git a/0131-Add-start-symbol-for-RISC-V.patch b/0126-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0131-Add-start-symbol-for-RISC-V.patch rename to 0126-Add-start-symbol-for-RISC-V.patch diff --git a/0132-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0127-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 100% rename from 0132-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0127-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0128-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 100% rename from 0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0128-efi-http-Export-fw-http-_path-variables-to-make-them.patch diff --git a/0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch b/0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch deleted file mode 100644 index b694ec9c..00000000 --- a/0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: David Abdurachmanov -Date: Thu, 16 Jan 2020 13:10:10 +0100 -Subject: [PATCH] Also define GRUB_EFI_MAX_ALLOCATION_ADDRESS for RISC-V - -The commit "Try to pick better locations for kernel and initrd" missed to -define this macro for the RISC-V (riscv64) architecture, so add it there. - -Signed-off-by: David Abdurachmanov ---- - include/grub/riscv64/efi/memory.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/grub/riscv64/efi/memory.h b/include/grub/riscv64/efi/memory.h -index c6cb3241714..acb61dca44b 100644 ---- a/include/grub/riscv64/efi/memory.h -+++ b/include/grub/riscv64/efi/memory.h -@@ -2,5 +2,6 @@ - #include - - #define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffffffffULL -+#define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS - - #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/0134-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0129-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0134-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0129-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0130-chainloader-Define-machine-types-for-RISC-V.patch b/0130-chainloader-Define-machine-types-for-RISC-V.patch deleted file mode 100644 index 480db52d..00000000 --- a/0130-chainloader-Define-machine-types-for-RISC-V.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: David Abdurachmanov -Date: Sat, 9 Nov 2019 18:06:32 +0000 -Subject: [PATCH] chainloader: Define machine types for RISC-V - -The commit "Add secureboot support on efi chainloader" didn't add machine -types for RISC-V, so this patch adds them. - -Note, that grub-core/loader/riscv/linux.c is skipped because Linux is not -supported yet. This patch might need a new revision once that's the case. - -Signed-off-by: David Abdurachmanov ---- - grub-core/loader/efi/chainloader.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 47f5aa14817..ac8dfd40c61 100644 ---- a/grub-core/loader/efi/chainloader.c -+++ b/grub-core/loader/efi/chainloader.c -@@ -333,6 +333,10 @@ static const grub_uint16_t machine_type __attribute__((__unused__)) = - GRUB_PE32_MACHINE_I386; - #elif defined(__ia64__) - GRUB_PE32_MACHINE_IA64; -+#elif defined(__riscv) && (__riscv_xlen == 32) -+ GRUB_PE32_MACHINE_RISCV32; -+#elif defined(__riscv) && (__riscv_xlen == 64) -+ GRUB_PE32_MACHINE_RISCV64; - #else - #error this architecture is not supported by grub2 - #endif diff --git a/0135-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0130-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0135-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0130-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0136-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0131-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0136-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0131-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0137-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0132-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0137-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0132-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0138-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0133-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 100% rename from 0138-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0133-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch diff --git a/0139-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0134-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 100% rename from 0139-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0134-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0140-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0135-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 100% rename from 0140-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0135-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0141-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0136-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 100% rename from 0141-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0136-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0142-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0137-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 100% rename from 0142-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0137-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch diff --git a/0143-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0138-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 100% rename from 0143-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0138-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch diff --git a/0144-efi-dhcp-fix-some-allocation-error-checking.patch b/0139-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0144-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0139-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0145-efi-http-fix-some-allocation-error-checking.patch b/0140-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0145-efi-http-fix-some-allocation-error-checking.patch rename to 0140-efi-http-fix-some-allocation-error-checking.patch diff --git a/0146-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0141-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0146-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0141-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0147-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0142-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 100% rename from 0147-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0142-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch diff --git a/0148-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0143-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 100% rename from 0148-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0143-linuxefi-fail-kernel-validation-without-shim-protoco.patch diff --git a/0149-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0144-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 100% rename from 0149-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0144-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch diff --git a/0150-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0145-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0150-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0145-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0151-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0146-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0151-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0146-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0152-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0147-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0152-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0147-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0153-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0148-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0153-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0148-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0149-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 99% rename from 0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0149-Add-systemd-integration-scripts-to-make-systemctl-re.patch index 130dc778..8e2481e7 100644 --- a/0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch +++ b/0149-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -65,7 +65,7 @@ Signed-off-by: Hans de Goede create mode 100644 util/systemd/systemd-integration.sh.in diff --git a/Makefile.util.def b/Makefile.util.def -index 11ab2d6fad1..e1242f54022 100644 +index 2e6ad979c3e..9927c2cfd6a 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -470,6 +470,12 @@ script = { diff --git a/0155-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0150-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0155-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0150-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0156-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0151-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 100% rename from 0156-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0151-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0157-grub-install-disable-support-for-EFI-platforms.patch b/0152-grub-install-disable-support-for-EFI-platforms.patch similarity index 100% rename from 0157-grub-install-disable-support-for-EFI-platforms.patch rename to 0152-grub-install-disable-support-for-EFI-platforms.patch diff --git a/0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0153-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 96% rename from 0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0153-New-with-debug-timestamps-configure-flag-to-prepend-.patch index 3eb0d00c..d216284c 100644 --- a/0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0153-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,7 +15,7 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index 907477a585c..d5d2a28b4ef 100644 +index c6bd965f1f9..3c808a72230 100644 --- a/configure.ac +++ b/configure.ac @@ -1613,6 +1613,17 @@ else @@ -36,7 +36,7 @@ index 907477a585c..d5d2a28b4ef 100644 AC_ARG_ENABLE([grub-emu-sdl], [AS_HELP_STRING([--enable-grub-emu-sdl], [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) -@@ -2200,6 +2211,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) +@@ -2194,6 +2205,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) @@ -44,7 +44,7 @@ index 907477a585c..d5d2a28b4ef 100644 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) -@@ -2295,6 +2307,12 @@ else +@@ -2289,6 +2301,12 @@ else echo With boot time statistics: No fi diff --git a/0159-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0154-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 100% rename from 0159-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0154-Added-debug-statements-to-grub_disk_open-and-grub_di.patch diff --git a/0160-Introduce-function-grub_debug_is_enabled-void-return.patch b/0155-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 100% rename from 0160-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0155-Introduce-function-grub_debug_is_enabled-void-return.patch diff --git a/0161-Don-t-clear-screen-when-debugging-is-enabled.patch b/0156-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 100% rename from 0161-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0156-Don-t-clear-screen-when-debugging-is-enabled.patch diff --git a/0162-grub_file_-instrumentation-new-file-debug-tag.patch b/0157-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0162-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0157-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0163-ieee1275-Avoiding-many-unecessary-open-close.patch b/0158-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0163-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0158-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0164-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0159-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0164-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0159-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0165-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0160-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0165-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0160-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0161-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 100% rename from 0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0161-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0162-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 100% rename from 0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0162-Add-suport-for-signing-grub-with-an-appended-signatu.patch diff --git a/0168-docs-grub-Document-signing-grub-under-UEFI.patch b/0163-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0168-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0163-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0169-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0164-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0169-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0164-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0170-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0165-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0170-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0165-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0171-pgp-factor-out-rsa_pad.patch b/0166-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0171-pgp-factor-out-rsa_pad.patch rename to 0166-pgp-factor-out-rsa_pad.patch diff --git a/0172-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0167-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0172-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0167-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0173-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0168-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0173-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0168-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0174-libtasn1-import-libtasn1-4.16.0.patch b/0169-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0174-libtasn1-import-libtasn1-4.16.0.patch rename to 0169-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0175-libtasn1-disable-code-not-needed-in-grub.patch b/0170-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0175-libtasn1-disable-code-not-needed-in-grub.patch rename to 0170-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0176-libtasn1-changes-for-grub-compatibility.patch b/0171-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0176-libtasn1-changes-for-grub-compatibility.patch rename to 0171-libtasn1-changes-for-grub-compatibility.patch diff --git a/0177-libtasn1-compile-into-asn1-module.patch b/0172-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0177-libtasn1-compile-into-asn1-module.patch rename to 0172-libtasn1-compile-into-asn1-module.patch diff --git a/0178-test_asn1-test-module-for-libtasn1.patch b/0173-test_asn1-test-module-for-libtasn1.patch similarity index 99% rename from 0178-test_asn1-test-module-for-libtasn1.patch rename to 0173-test_asn1-test-module-for-libtasn1.patch index 3a02b247..b659558b 100644 --- a/0178-test_asn1-test-module-for-libtasn1.patch +++ b/0173-test_asn1-test-module-for-libtasn1.patch @@ -51,10 +51,10 @@ Signed-off-by: Daniel Axtens create mode 100644 tests/test_asn1.in diff --git a/Makefile.util.def b/Makefile.util.def -index e1242f54022..8cfbe69a76e 100644 +index 9927c2cfd6a..3f191aa8095 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1305,6 +1305,12 @@ script = { +@@ -1306,6 +1306,12 @@ script = { common = tests/syslinux_test.in; }; diff --git a/0179-grub-install-support-embedding-x509-certificates.patch b/0174-grub-install-support-embedding-x509-certificates.patch similarity index 100% rename from 0179-grub-install-support-embedding-x509-certificates.patch rename to 0174-grub-install-support-embedding-x509-certificates.patch diff --git a/0180-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0175-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0180-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0175-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0181-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0176-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0181-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0176-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0182-appended-signatures-support-verifying-appended-signa.patch b/0177-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0182-appended-signatures-support-verifying-appended-signa.patch rename to 0177-appended-signatures-support-verifying-appended-signa.patch diff --git a/0183-appended-signatures-verification-tests.patch b/0178-appended-signatures-verification-tests.patch similarity index 100% rename from 0183-appended-signatures-verification-tests.patch rename to 0178-appended-signatures-verification-tests.patch diff --git a/0184-appended-signatures-documentation.patch b/0179-appended-signatures-documentation.patch similarity index 100% rename from 0184-appended-signatures-documentation.patch rename to 0179-appended-signatures-documentation.patch diff --git a/0185-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0180-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 100% rename from 0185-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0180-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch diff --git a/0186-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0181-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0186-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0181-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0187-ieee1275-claim-more-memory.patch b/0182-ieee1275-claim-more-memory.patch similarity index 100% rename from 0187-ieee1275-claim-more-memory.patch rename to 0182-ieee1275-claim-more-memory.patch diff --git a/0188-ieee1275-request-memory-with-ibm-client-architecture.patch b/0183-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0188-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0183-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0189-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0184-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0189-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0184-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0190-ieee1275-ofdisk-retry-on-open-failure.patch b/0185-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0190-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0185-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0186-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 100% rename from 0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0186-Allow-chainloading-EFI-apps-from-loop-mounts.patch diff --git a/0195-efinet-Add-DHCP-proxy-support.patch b/0187-efinet-Add-DHCP-proxy-support.patch similarity index 100% rename from 0195-efinet-Add-DHCP-proxy-support.patch rename to 0187-efinet-Add-DHCP-proxy-support.patch diff --git a/0196-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0188-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0196-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0188-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 97% rename from 0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index 84997a90..2e13f399 100644 --- a/0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index fdf324b7ab1..518624f336e 100644 +index 6bceabf3dc9..b95a9a8d7ca 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -261,7 +261,9 @@ if [ -z "\${kernelopts}" ]; then diff --git a/0198-Suppress-gettext-error-message.patch b/0190-Suppress-gettext-error-message.patch similarity index 100% rename from 0198-Suppress-gettext-error-message.patch rename to 0190-Suppress-gettext-error-message.patch diff --git a/0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch b/0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch deleted file mode 100644 index 4847ef93..00000000 --- a/0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= -Date: Fri, 11 Jun 2021 12:57:56 +0200 -Subject: [PATCH] 01_menu_auto_hide.in: fix a then/than typo -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Jan Pokorný ---- - util/grub.d/10_reset_boot_success.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in -index 737e1ae5b68..e73f4137b36 100644 ---- a/util/grub.d/10_reset_boot_success.in -+++ b/util/grub.d/10_reset_boot_success.in -@@ -15,7 +15,7 @@ fi - # Reset boot_indeterminate after a successful boot - if [ "\${boot_success}" = "1" ] ; then - set boot_indeterminate=0 --# Avoid boot_indeterminate causing the menu to be hidden more then once -+# Avoid boot_indeterminate causing the menu to be hidden more than once - elif [ "\${boot_indeterminate}" = "1" ]; then - set boot_indeterminate=2 - fi diff --git a/0200-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0191-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0200-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0191-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0192-Fix-disabling-grub-rpm-sort.patch b/0192-Fix-disabling-grub-rpm-sort.patch deleted file mode 100644 index ccde7519..00000000 --- a/0192-Fix-disabling-grub-rpm-sort.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tim Landscheidt -Date: Fri, 11 Jun 2021 13:02:37 +0200 -Subject: [PATCH] Fix disabling grub-rpm-sort - -Currently, grub-rpm-sort is unconditionally compiled whether -./configure has been called with --disable-rpm-sort or not. This adds -the necessary logic to configure.ac and Makefile.util.def and some -debug output to ./configure and fixes #44. - -Signed-off-by: Tim Landscheidt -Signed-off-by: Robbie Harwood ---- - configure.ac | 8 ++++++++ - Makefile.util.def | 1 + - 2 files changed, 9 insertions(+) - -diff --git a/configure.ac b/configure.ac -index d5d2a28b4ef..c7842ec29d8 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1936,6 +1936,8 @@ AC_ARG_ENABLE([rpm-sort], - [enable native rpm sorting of kernels in grub (default=guessed)])]) - if test x"$enable_rpm_sort" = xno ; then - rpm_sort_excuse="explicitly disabled" -+else -+ enable_rpm_sort=yes - fi - - if test x"$rpm_sort_excuse" = x ; then -@@ -2200,6 +2202,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) - AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) - AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) - AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) -+AM_CONDITIONAL([COND_GRUB_RPM_SORT], [test x$enable_rpm_sort = xyes]) - AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) - if test x$FONT_SOURCE != x ; then - HAVE_FONT_SOURCE=1 -@@ -2328,6 +2331,11 @@ echo grub-mount: Yes - else - echo grub-mount: No "($grub_mount_excuse)" - fi -+if [ x"$rpm_sort_excuse" = x ]; then -+echo grub-rpm-sort: Yes -+else -+echo grub-rpm-sort: No "($rpm_sort_excuse)" -+fi - if [ x"$starfield_excuse" = x ]; then - echo starfield theme: Yes - echo With DejaVuSans font from $DJVU_FONT_SOURCE -diff --git a/Makefile.util.def b/Makefile.util.def -index 8cfbe69a76e..3f191aa8095 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -774,6 +774,7 @@ program = { - ldadd = libgrubkern.a; - ldadd = grub-core/lib/gnulib/libgnu.a; - ldadd = '$(LIBDEVMAPPER) $(LIBRPM)'; -+ condition = COND_GRUB_RPM_SORT; - }; - - script = { diff --git a/0202-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0192-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 100% rename from 0202-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0192-templates-Check-for-EFI-at-runtime-instead-of-config.patch diff --git a/0193-Don-t-check-for-rpmvercmp-in-librpm.patch b/0193-Don-t-check-for-rpmvercmp-in-librpm.patch deleted file mode 100644 index c21dca47..00000000 --- a/0193-Don-t-check-for-rpmvercmp-in-librpm.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Fri, 11 Jun 2021 13:13:27 +0200 -Subject: [PATCH] Don't check for rpmvercmp in librpm - -The rpmvercmp() function was moved from librpm to librpmio. The configure -option had some logic to first check if the symbol is in librpm and then -librpmio if this check didn't succeed. - -But the logic wasn't working and rpm sorting was always disabled. Instead -of trying to fix this logic, let's just remove since the function already -moved and there's no need to check librpm anymore. Now it's enabled again: - - GRUB2 will be compiled with following components: - ... - grub-rpm-sort: Yes - ... - -Signed-off-by: Javier Martinez Canillas ---- - configure.ac | 19 +++++-------------- - 1 file changed, 5 insertions(+), 14 deletions(-) - -diff --git a/configure.ac b/configure.ac -index c7842ec29d8..3c808a72230 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1947,24 +1947,15 @@ if test x"$rpm_sort_excuse" = x ; then - fi - - if test x"$rpm_sort_excuse" = x ; then -- # Check for rpm library. -- AC_CHECK_LIB([rpm], [rpmvercmp], [], -- [rpm_sort_excuse="rpmlib missing rpmvercmp"]) --fi -- --if test x"$rpm_sort_excuse" = x ; then -- LIBRPM="-lrpm"; -- AC_DEFINE([HAVE_RPM], [1], -- [Define to 1 if you have the rpm library.]) --fi -- --if test x"$LIBRPM" = x ; then -- # Check for rpm library. -+ # Check for rpmio library. - AC_CHECK_LIB([rpmio], [rpmvercmp], [], - [rpm_sort_excuse="rpmio missing rpmvercmp"]) -+fi -+ -+if test x"$rpm_sort_excuse" = x ; then - LIBRPM="-lrpmio"; - AC_DEFINE([HAVE_RPMIO], [1], -- [Define to 1 if you have the rpm library.]) -+ [Define to 1 if you have the rpmio library.]) - fi - - AC_SUBST([LIBRPM]) diff --git a/0203-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0193-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 100% rename from 0203-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0193-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0204-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 81% rename from 0204-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch index 600b4611..0472a42f 100644 --- a/0204-arm64-Fix-EFI-loader-kernel-image-allocation.patch +++ b/0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch @@ -14,12 +14,17 @@ actual size it needs, including BSS, and make sure we clear it, and honors the specified alignment for the image. Signed-off-by: Benjamin Herrenschmidt +[pjones: arm: check for the PE magic for the compiled arch] +Signed-off-by: Peter Jones +Signed-off-by: Robbie Harwood --- grub-core/loader/arm64/linux.c | 100 +++++++++++++++++++++++++++-------------- - 1 file changed, 66 insertions(+), 34 deletions(-) + include/grub/arm/linux.h | 1 + + include/grub/arm64/linux.h | 1 + + 3 files changed, 68 insertions(+), 34 deletions(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 47f8cf0d84b..4a252d5e7e9 100644 +index 47f8cf0d84b..f18d90bd749 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -41,6 +41,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -57,7 +62,7 @@ index 47f8cf0d84b..4a252d5e7e9 100644 + + pe = (void *)((unsigned long)kernel + lh->hdr_offset); + -+ if (pe->opt.magic != GRUB_PE32_PE64_MAGIC) ++ if (pe->opt.magic != GRUB_PE32_PEXX_MAGIC) + return grub_error(GRUB_ERR_BAD_OS, "Invalid PE optional header magic"); + + *total_size = pe->opt.image_size; @@ -187,3 +192,27 @@ index 47f8cf0d84b..4a252d5e7e9 100644 return grub_errno; } +diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h +index b582f67f661..966a5074f53 100644 +--- a/include/grub/arm/linux.h ++++ b/include/grub/arm/linux.h +@@ -44,6 +44,7 @@ struct grub_arm_linux_pe_header + + #if defined(__arm__) + # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE ++# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE32_MAGIC + # define linux_arch_kernel_header linux_arm_kernel_header + # define grub_armxx_linux_pe_header grub_arm_linux_pe_header + #endif +diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h +index ea030312df3..422bf2bf24b 100644 +--- a/include/grub/arm64/linux.h ++++ b/include/grub/arm64/linux.h +@@ -48,6 +48,7 @@ struct grub_arm64_linux_pe_header + + #if defined(__aarch64__) + # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE ++# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE64_MAGIC + # define linux_arch_kernel_header linux_arm64_kernel_header + # define grub_armxx_linux_pe_header grub_arm64_linux_pe_header + #endif diff --git a/0205-normal-main-Discover-the-device-to-read-the-config-f.patch b/0195-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 100% rename from 0205-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0195-normal-main-Discover-the-device-to-read-the-config-f.patch diff --git a/0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0196-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 71% rename from 0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0196-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch index 7ca37887..7f3161e2 100644 --- a/0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +++ b/0196-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch @@ -18,15 +18,17 @@ preserve a prefix of /path instead and hope the search later finds us. Related: rhbz#1899864 Signed-off-by: Daniel Axtens +[rharwood@redhat.com: squash in fixup commit] +Signed-off-by: Robbie Harwood --- - grub-core/kern/main.c | 38 +++++++++++++++++++++++++++++++++----- - 1 file changed, 33 insertions(+), 5 deletions(-) + grub-core/kern/main.c | 49 ++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index b573be6650d..58d35be253f 100644 +index b573be6650d..3fc34014726 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c -@@ -216,13 +216,41 @@ grub_set_prefix_and_root (void) +@@ -216,13 +216,52 @@ grub_set_prefix_and_root (void) if (device) { char *prefix_set; @@ -53,9 +55,20 @@ index b573be6650d..58d35be253f 100644 + which will have now been extended to device=$fwdisk,partition + and path=/path + -+ So we only need to act if device = ieee1275/disk exactly. ++ - PowerVM will give us device names like ++ ieee1275//vdevice/v-scsi@3000006c/disk@8100000000000000 ++ and we don't want to try to encode some sort of truth table about ++ what sorts of paths represent disks with partition tables and those ++ without partition tables. ++ ++ So we act unless there is a comma in the device, which would indicate ++ a partition has already been specified. ++ ++ (If we only have a path, the code in normal to discover config files ++ will try both without partitions and then with any partitions so we ++ will cover both CDs and HDs.) + */ -+ if (grub_strncmp (device, "ieee1275/disk", 14) == 0) ++ if (grub_strchr (device, ',') == NULL) + grub_env_set ("prefix", path); + else +#endif diff --git a/0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0197-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0197-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0210-Print-module-name-on-license-check-failure.patch b/0198-Print-module-name-on-license-check-failure.patch similarity index 100% rename from 0210-Print-module-name-on-license-check-failure.patch rename to 0198-Print-module-name-on-license-check-failure.patch diff --git a/0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch b/0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch deleted file mode 100644 index 61d0f6d9..00000000 --- a/0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Gena Makhomed -Date: Thu, 1 Jul 2021 01:07:46 +0200 -Subject: [PATCH] grub-boot-success.timer: Only run if not in a container - -The grub-boot-success.timer should be disabled inside a container since it -leads to the following error: - -Jan 09 22:56:38 test sshd[8786]: pam_unix(sshd:session): session opened for user www(uid=1000) by (uid=0) -Jan 09 22:58:39 test systemd[8857]: Starting Mark boot as successful... -Jan 09 22:58:39 test systemd[8857]: grub-boot-success.service: Main process exited, code=exited, status=1/FAILURE -Jan 09 22:58:39 test systemd[8857]: grub-boot-success.service: Failed with result 'exit-code'. -Jan 09 22:58:39 test systemd[8857]: Failed to start Mark boot as successful. -Jan 09 22:58:39 test grub2-set-bootflag[10034]: Error canonicalizing /boot/grub2/grubenv filename: No such file or directory - -Resolves: rhbz#1914571 ---- - docs/grub-boot-success.timer | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer -index 5d8fcba21aa..406f1720056 100644 ---- a/docs/grub-boot-success.timer -+++ b/docs/grub-boot-success.timer -@@ -1,6 +1,7 @@ - [Unit] - Description=Mark boot as successful after the user session has run 2 minutes - ConditionUser=!@system -+ConditionVirtualization=!container - - [Timer] - OnActiveSec=2min diff --git a/0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0199-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 100% rename from 0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0199-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/0212-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0200-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 91% rename from 0212-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0200-grub-mkconfig-restore-umask-for-grub.cfg.patch index d9a81964..7c7bee0e 100644 --- a/0212-grub-mkconfig-restore-umask-for-grub.cfg.patch +++ b/0200-grub-mkconfig-restore-umask-for-grub.cfg.patch @@ -1,4 +1,4 @@ -From 3ea051e59e9c0cd79eac7f2e1563606e1e31a530 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Michael Chang via Grub-devel Date: Fri, 3 Dec 2021 16:13:28 +0800 Subject: [PATCH] grub-mkconfig: restore umask for grub.cfg @@ -25,7 +25,7 @@ Signed-off-by: Michael Chang 1 file changed, 2 insertions(+) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f55339a3f..520a672cd 100644 +index f55339a3f64..520a672cd2c 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -311,7 +311,9 @@ and /etc/grub.d/* files or please file a bug report with @@ -38,6 +38,3 @@ index f55339a3f..520a672cd 100644 rm -f ${grub_cfg}.new fi fi --- -2.33.0 - diff --git a/0201-Remove-outdated-URL-for-BLS-document.patch b/0201-Remove-outdated-URL-for-BLS-document.patch deleted file mode 100644 index c4d5d726..00000000 --- a/0201-Remove-outdated-URL-for-BLS-document.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Mon, 5 Jul 2021 19:00:25 +0200 -Subject: [PATCH] Remove outdated URL for BLS document - -The document was moved to https://systemd.io/BOOT_LOADER_SPECIFICATION/, -update the URL accordingly to point to the current location. - -Resolves: rhbz#1926453 - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/10_linux.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 518624f336e..b95a9a8d7ca 100644 ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in -@@ -96,7 +96,7 @@ cat < Date: Mon, 13 Dec 2021 14:25:49 +0800 Subject: [PATCH] fs/btrfs: Use full btrfs bootloader area @@ -27,12 +27,12 @@ Signed-off-by: Michael Chang Reviewed-by: Daniel Kiper (cherry picked from commit b0f06a81c6f31b6fa20be67a96b6683bba8210c9) --- - grub-core/fs/btrfs.c | 90 +++++++++++++++++++++++++++++++++++++------- - include/grub/disk.h | 2 + + grub-core/fs/btrfs.c | 90 ++++++++++++++++++++++++++++++++++++++++++++-------- + include/grub/disk.h | 2 ++ 2 files changed, 79 insertions(+), 13 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 4cc86e9b7..07c0ff874 100644 +index 4cc86e9b79e..07c0ff874b8 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -2476,6 +2476,33 @@ grub_btrfs_label (grub_device_t device, char **label) @@ -146,7 +146,7 @@ index 4cc86e9b7..07c0ff874 100644 return GRUB_ERR_NONE; } diff --git a/include/grub/disk.h b/include/grub/disk.h -index f95aca929..06210a704 100644 +index f95aca929a6..06210a70492 100644 --- a/include/grub/disk.h +++ b/include/grub/disk.h @@ -182,6 +182,8 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t; @@ -158,6 +158,3 @@ index f95aca929..06210a704 100644 /* Convert sector number from one sector size to another. */ static inline grub_disk_addr_t grub_convert_sector (grub_disk_addr_t sector, --- -2.34.1 - diff --git a/0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch b/0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch deleted file mode 100644 index ce0d889f..00000000 --- a/0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 16 Aug 2021 16:01:47 +1000 -Subject: [PATCH] powerpc: fix prefix + signed grub special case for PowerVM - -Mea culpa: when testing the PowerPC special case for signed grub, I -assumed qemu and PowerVM would behave identically. This was wrong, and -with hindsight a pretty dumb error. - -This fixes it. This time, I am actually testing on PowerVM. - -Signed-off-by: Daniel Axtens ---- - grub-core/kern/main.c | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 58d35be253f..3fc34014726 100644 ---- a/grub-core/kern/main.c -+++ b/grub-core/kern/main.c -@@ -236,9 +236,20 @@ grub_set_prefix_and_root (void) - which will have now been extended to device=$fwdisk,partition - and path=/path - -- So we only need to act if device = ieee1275/disk exactly. -+ - PowerVM will give us device names like -+ ieee1275//vdevice/v-scsi@3000006c/disk@8100000000000000 -+ and we don't want to try to encode some sort of truth table about -+ what sorts of paths represent disks with partition tables and those -+ without partition tables. -+ -+ So we act unless there is a comma in the device, which would indicate -+ a partition has already been specified. -+ -+ (If we only have a path, the code in normal to discover config files -+ will try both without partitions and then with any partitions so we -+ will cover both CDs and HDs.) - */ -- if (grub_strncmp (device, "ieee1275/disk", 14) == 0) -+ if (grub_strchr (device, ',') == NULL) - grub_env_set ("prefix", path); - else - #endif diff --git a/0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch b/0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch deleted file mode 100644 index 8b5170b6..00000000 --- a/0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 9 Sep 2021 10:59:28 -0400 -Subject: [PATCH] Arm: check for the PE magic for the compiled arch - -In "arm64: Fix EFI loader kernel image allocation", Ben fixed the kernel -alignment to match the alignment given in the PE header. In doing so, a -check for valid PE magic was added, which was hard-coded to the value -seen on Aarch64 (GRUB_PE32_PE64_MAGIC). - -Unfortunately, this code is shared between 64-bit and 32-bit, and so -that value broke 32-bit Arm systems. - -This patch adds a constant definition for GRUB_PE32_PEXX_MAGIC, which is -either GRUB_PE32_PE64_MAGIC or GRUB_PE32_PE32_MAGIC, depending on which -platform is being built, and uses it in the header magic check. - -Resolves: rhbz#2000756 - -Signed-off-by: Peter Jones ---- - grub-core/loader/arm64/linux.c | 2 +- - include/grub/arm/linux.h | 1 + - include/grub/arm64/linux.h | 1 + - 3 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 4a252d5e7e9..f18d90bd749 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -322,7 +322,7 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size, - - pe = (void *)((unsigned long)kernel + lh->hdr_offset); - -- if (pe->opt.magic != GRUB_PE32_PE64_MAGIC) -+ if (pe->opt.magic != GRUB_PE32_PEXX_MAGIC) - return grub_error(GRUB_ERR_BAD_OS, "Invalid PE optional header magic"); - - *total_size = pe->opt.image_size; -diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index b582f67f661..966a5074f53 100644 ---- a/include/grub/arm/linux.h -+++ b/include/grub/arm/linux.h -@@ -44,6 +44,7 @@ struct grub_arm_linux_pe_header - - #if defined(__arm__) - # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE -+# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE32_MAGIC - # define linux_arch_kernel_header linux_arm_kernel_header - # define grub_armxx_linux_pe_header grub_arm_linux_pe_header - #endif -diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index ea030312df3..422bf2bf24b 100644 ---- a/include/grub/arm64/linux.h -+++ b/include/grub/arm64/linux.h -@@ -48,6 +48,7 @@ struct grub_arm64_linux_pe_header - - #if defined(__aarch64__) - # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE -+# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE64_MAGIC - # define linux_arch_kernel_header linux_arm64_kernel_header - # define grub_armxx_linux_pe_header grub_arm64_linux_pe_header - #endif diff --git a/grub.patches b/grub.patches index bbb454ad..f12bbe64 100644 --- a/grub.patches +++ b/grub.patches @@ -24,190 +24,178 @@ Patch0023: 0023-Enable-pager-by-default.-985860.patch Patch0024: 0024-Don-t-say-GNU-Linux-in-generated-menus.patch Patch0025: 0025-Add-.eh_frame-to-list-of-relocations-stripped.patch Patch0026: 0026-Don-t-require-a-password-to-boot-entries-generated-b.patch -Patch0027: 0027-Don-t-emit-Booting-.-message.patch -Patch0028: 0028-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch -Patch0029: 0029-use-fw_path-prefix-when-fallback-searching-for-grub-.patch -Patch0030: 0030-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch -Patch0031: 0031-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch -Patch0032: 0032-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch -Patch0033: 0033-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0034: 0034-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch -Patch0035: 0035-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0036: 0036-Add-friendly-grub2-password-config-tool-985962.patch -Patch0037: 0037-tcp-add-window-scaling-support.patch -Patch0038: 0038-efinet-and-bootp-add-support-for-dhcpv6.patch -Patch0039: 0039-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0040: 0040-bz1374141-fix-incorrect-mask-for-ppc64.patch -Patch0041: 0041-Make-grub_fatal-also-backtrace.patch -Patch0042: 0042-Fix-up-some-man-pages-rpmdiff-noticed.patch -Patch0043: 0043-Make-our-info-pages-say-grub2-where-appropriate.patch -Patch0044: 0044-macos-just-build-chainloader-entries-don-t-try-any-x.patch -Patch0045: 0045-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch -Patch0046: 0046-export-btrfs_subvol-and-btrfs_subvolid.patch -Patch0047: 0047-grub2-btrfs-03-follow_default.patch -Patch0048: 0048-grub2-btrfs-04-grub2-install.patch -Patch0049: 0049-grub2-btrfs-05-grub2-mkconfig.patch -Patch0050: 0050-grub2-btrfs-06-subvol-mount.patch -Patch0051: 0051-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch -Patch0052: 0052-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch -Patch0053: 0053-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch -Patch0054: 0054-Use-grub_efi_.-memory-helpers-where-reasonable.patch -Patch0055: 0055-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch -Patch0056: 0056-don-t-use-int-for-efi-status.patch -Patch0057: 0057-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch -Patch0058: 0058-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch -Patch0059: 0059-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch -Patch0060: 0060-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch -Patch0061: 0061-align-struct-efi_variable-better.patch -Patch0062: 0062-Add-BLS-support-to-grub-mkconfig.patch -Patch0063: 0063-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0064: 0064-Add-linux-and-initrd-commands-for-grub-emu.patch -Patch0065: 0065-Add-grub2-switch-to-blscfg.patch -Patch0066: 0066-make-better-backtraces.patch -Patch0067: 0067-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0068: 0068-Work-around-some-minor-include-path-weirdnesses.patch -Patch0069: 0069-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0070: 0070-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0071: 0071-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch -Patch0072: 0072-Fixup-for-newer-compiler.patch -Patch0073: 0073-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0074: 0074-Fixup-for-newer-compiler.patch -Patch0075: 0075-Add-support-for-non-Ethernet-network-cards.patch -Patch0076: 0076-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0077: 0077-bootp-New-net_bootp6-command.patch -Patch0078: 0078-efinet-UEFI-IPv6-PXE-support.patch -Patch0079: 0079-grub.texi-Add-net_bootp6-doument.patch -Patch0080: 0080-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0081: 0081-efinet-Setting-network-from-UEFI-device-path.patch -Patch0082: 0082-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0083: 0083-Support-UEFI-networking-protocols.patch -Patch0084: 0084-AUDIT-0-http-boot-tracker-bug.patch -Patch0085: 0085-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0086: 0086-Add-auto-hide-menu-support.patch -Patch0087: 0087-Add-grub-set-bootflag-utility.patch -Patch0088: 0088-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0089: 0089-gentpl-add-disable-support.patch -Patch0090: 0090-gentpl-add-pc-firmware-type.patch -Patch0091: 0091-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0092: 0092-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0093: 0093-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0094: 0094-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0095: 0095-Rework-how-the-fdt-command-builds.patch -Patch0096: 0096-Disable-non-wordsize-allocations-on-arm.patch -Patch0097: 0097-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0098: 0098-Make-grub_error-more-verbose.patch -Patch0099: 0099-Make-reset-an-alias-for-the-reboot-command.patch -Patch0100: 0100-Add-a-version-command.patch -Patch0101: 0101-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0102: 0102-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0103: 0103-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0104: 0104-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0105: 0105-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0106: 0106-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0107: 0107-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0108: 0108-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0109: 0109-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0110: 0110-Fix-getroot.c-s-trampolines.patch -Patch0111: 0111-Do-not-allow-stack-trampolines-anywhere.patch -Patch0112: 0112-Reimplement-boot_counter.patch -Patch0113: 0113-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0114: 0114-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0115: 0115-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0116: 0116-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0117: 0117-Export-all-variables-from-the-initial-context-when-c.patch -Patch0118: 0118-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0119: 0119-Fix-systemctl-kexec-exit-status-check.patch -Patch0120: 0120-Print-grub-emu-linux-loader-messages-as-debug.patch -Patch0121: 0121-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0122: 0122-Fix-undefined-references-for-fdt-when-building-with-.patch -Patch0123: 0123-Do-better-in-bootstrap.conf.patch -Patch0124: 0124-Use-git-to-apply-gnulib-patches.patch -Patch0125: 0125-Fix-build-error-with-the-fdt-module-on-risc-v.patch -Patch0126: 0126-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0127: 0127-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0128: 0128-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0129: 0129-Also-define-GRUB_EFI_MAX_ALLOCATION_ADDRESS-for-RISC.patch -Patch0130: 0130-chainloader-Define-machine-types-for-RISC-V.patch -Patch0131: 0131-Add-start-symbol-for-RISC-V.patch -Patch0132: 0132-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0133: 0133-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0134: 0134-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0135: 0135-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0136: 0136-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0137: 0137-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0138: 0138-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0139: 0139-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0140: 0140-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0141: 0141-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0142: 0142-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0143: 0143-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0144: 0144-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0145: 0145-efi-http-fix-some-allocation-error-checking.patch -Patch0146: 0146-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0147: 0147-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0148: 0148-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0149: 0149-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0150: 0150-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0151: 0151-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0152: 0152-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0153: 0153-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0154: 0154-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0155: 0155-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0156: 0156-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0157: 0157-grub-install-disable-support-for-EFI-platforms.patch -Patch0158: 0158-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0159: 0159-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0160: 0160-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0161: 0161-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0162: 0162-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0163: 0163-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0164: 0164-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0165: 0165-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0166: 0166-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0167: 0167-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0168: 0168-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0169: 0169-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0170: 0170-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0171: 0171-pgp-factor-out-rsa_pad.patch -Patch0172: 0172-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0173: 0173-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0174: 0174-libtasn1-import-libtasn1-4.16.0.patch -Patch0175: 0175-libtasn1-disable-code-not-needed-in-grub.patch -Patch0176: 0176-libtasn1-changes-for-grub-compatibility.patch -Patch0177: 0177-libtasn1-compile-into-asn1-module.patch -Patch0178: 0178-test_asn1-test-module-for-libtasn1.patch -Patch0179: 0179-grub-install-support-embedding-x509-certificates.patch -Patch0180: 0180-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0181: 0181-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0182: 0182-appended-signatures-support-verifying-appended-signa.patch -Patch0183: 0183-appended-signatures-verification-tests.patch -Patch0184: 0184-appended-signatures-documentation.patch -Patch0185: 0185-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0186: 0186-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0187: 0187-ieee1275-claim-more-memory.patch -Patch0188: 0188-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0189: 0189-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0190: 0190-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0191: 0191-01_menu_auto_hide.in-fix-a-then-than-typo.patch -Patch0192: 0192-Fix-disabling-grub-rpm-sort.patch -Patch0193: 0193-Don-t-check-for-rpmvercmp-in-librpm.patch -Patch0194: 0194-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0195: 0195-efinet-Add-DHCP-proxy-support.patch -Patch0196: 0196-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0197: 0197-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0198: 0198-Suppress-gettext-error-message.patch -Patch0199: 0199-grub-boot-success.timer-Only-run-if-not-in-a-contain.patch -Patch0200: 0200-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0201: 0201-Remove-outdated-URL-for-BLS-document.patch -Patch0202: 0202-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0203: 0203-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0204: 0204-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0205: 0205-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0206: 0206-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0207: 0207-powerpc-fix-prefix-signed-grub-special-case-for-Powe.patch -Patch0208: 0208-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch -Patch0209: 0209-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0210: 0210-Print-module-name-on-license-check-failure.patch -Patch0211: 0211-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0212: 0212-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0213: 0213-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0027: 0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +Patch0028: 0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +Patch0029: 0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +Patch0030: 0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +Patch0031: 0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +Patch0032: 0032-Try-prefix-if-fw_path-doesn-t-work.patch +Patch0033: 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch +Patch0034: 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0035: 0035-Add-friendly-grub2-password-config-tool-985962.patch +Patch0036: 0036-tcp-add-window-scaling-support.patch +Patch0037: 0037-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0038: 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0039: 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch +Patch0040: 0040-Make-grub_fatal-also-backtrace.patch +Patch0041: 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch +Patch0042: 0042-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0043: 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0044: 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0045: 0045-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0046: 0046-grub2-btrfs-03-follow_default.patch +Patch0047: 0047-grub2-btrfs-04-grub2-install.patch +Patch0048: 0048-grub2-btrfs-05-grub2-mkconfig.patch +Patch0049: 0049-grub2-btrfs-06-subvol-mount.patch +Patch0050: 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0051: 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0052: 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0053: 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0054: 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0055: 0055-don-t-use-int-for-efi-status.patch +Patch0056: 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0057: 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +Patch0058: 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +Patch0059: 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +Patch0060: 0060-align-struct-efi_variable-better.patch +Patch0061: 0061-Add-BLS-support-to-grub-mkconfig.patch +Patch0062: 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +Patch0063: 0063-Add-linux-and-initrd-commands-for-grub-emu.patch +Patch0064: 0064-Add-grub2-switch-to-blscfg.patch +Patch0065: 0065-make-better-backtraces.patch +Patch0066: 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0067: 0067-Work-around-some-minor-include-path-weirdnesses.patch +Patch0068: 0068-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0069: 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0070: 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0071: 0071-Fixup-for-newer-compiler.patch +Patch0072: 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +Patch0073: 0073-Fixup-for-newer-compiler.patch +Patch0074: 0074-Add-support-for-non-Ethernet-network-cards.patch +Patch0075: 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0076: 0076-bootp-New-net_bootp6-command.patch +Patch0077: 0077-efinet-UEFI-IPv6-PXE-support.patch +Patch0078: 0078-grub.texi-Add-net_bootp6-doument.patch +Patch0079: 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0080: 0080-efinet-Setting-network-from-UEFI-device-path.patch +Patch0081: 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0082: 0082-Support-UEFI-networking-protocols.patch +Patch0083: 0083-AUDIT-0-http-boot-tracker-bug.patch +Patch0084: 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0085: 0085-Add-auto-hide-menu-support.patch +Patch0086: 0086-Add-grub-set-bootflag-utility.patch +Patch0087: 0087-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0088: 0088-gentpl-add-disable-support.patch +Patch0089: 0089-gentpl-add-pc-firmware-type.patch +Patch0090: 0090-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0091: 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0092: 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0093: 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0094: 0094-Rework-how-the-fdt-command-builds.patch +Patch0095: 0095-Disable-non-wordsize-allocations-on-arm.patch +Patch0096: 0096-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0097: 0097-Make-grub_error-more-verbose.patch +Patch0098: 0098-Make-reset-an-alias-for-the-reboot-command.patch +Patch0099: 0099-Add-a-version-command.patch +Patch0100: 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0101: 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0102: 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0103: 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0104: 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0105: 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0106: 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0107: 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0108: 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0109: 0109-Fix-getroot.c-s-trampolines.patch +Patch0110: 0110-Do-not-allow-stack-trampolines-anywhere.patch +Patch0111: 0111-Reimplement-boot_counter.patch +Patch0112: 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0113: 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0114: 0114-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0115: 0115-Make-it-possible-to-subtract-conditions-from-debug.patch +Patch0116: 0116-Export-all-variables-from-the-initial-context-when-c.patch +Patch0117: 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0118: 0118-Fix-systemctl-kexec-exit-status-check.patch +Patch0119: 0119-Print-grub-emu-linux-loader-messages-as-debug.patch +Patch0120: 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0121: 0121-Do-better-in-bootstrap.conf.patch +Patch0122: 0122-Use-git-to-apply-gnulib-patches.patch +Patch0123: 0123-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0124: 0124-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0125: 0125-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0126: 0126-Add-start-symbol-for-RISC-V.patch +Patch0127: 0127-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0128: 0128-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0129: 0129-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0130: 0130-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0131: 0131-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0132: 0132-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0133: 0133-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0134: 0134-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0135: 0135-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0136: 0136-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0137: 0137-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0138: 0138-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0139: 0139-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0140: 0140-efi-http-fix-some-allocation-error-checking.patch +Patch0141: 0141-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0142: 0142-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0143: 0143-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0144: 0144-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0145: 0145-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0146: 0146-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0147: 0147-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0148: 0148-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0149: 0149-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0150: 0150-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0151: 0151-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0152: 0152-grub-install-disable-support-for-EFI-platforms.patch +Patch0153: 0153-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0154: 0154-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0155: 0155-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0156: 0156-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0157: 0157-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0158: 0158-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0159: 0159-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0160: 0160-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0161: 0161-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0162: 0162-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0163: 0163-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0164: 0164-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0165: 0165-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0166: 0166-pgp-factor-out-rsa_pad.patch +Patch0167: 0167-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0168: 0168-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0169: 0169-libtasn1-import-libtasn1-4.16.0.patch +Patch0170: 0170-libtasn1-disable-code-not-needed-in-grub.patch +Patch0171: 0171-libtasn1-changes-for-grub-compatibility.patch +Patch0172: 0172-libtasn1-compile-into-asn1-module.patch +Patch0173: 0173-test_asn1-test-module-for-libtasn1.patch +Patch0174: 0174-grub-install-support-embedding-x509-certificates.patch +Patch0175: 0175-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0176: 0176-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0177: 0177-appended-signatures-support-verifying-appended-signa.patch +Patch0178: 0178-appended-signatures-verification-tests.patch +Patch0179: 0179-appended-signatures-documentation.patch +Patch0180: 0180-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0181: 0181-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0182: 0182-ieee1275-claim-more-memory.patch +Patch0183: 0183-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0184: 0184-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0185: 0185-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0186: 0186-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0187: 0187-efinet-Add-DHCP-proxy-support.patch +Patch0188: 0188-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0189: 0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0190: 0190-Suppress-gettext-error-message.patch +Patch0191: 0191-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0192: 0192-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0193: 0193-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0194: 0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0195: 0195-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0196: 0196-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0197: 0197-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0198: 0198-Print-module-name-on-license-check-failure.patch +Patch0199: 0199-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0200: 0200-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0201: 0201-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/grub2.spec b/grub2.spec index 7f22435a..47f48e7f 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Jan 17 2022 Robbie Harwood - 2.06-13 +- Update patches; minor changes at most, if correct + * Thu Jan 06 2022 Robbie Harwood - 2.06-12 - btrfs: use full bootloader area From 357489e3ead94d22106631900dd667949d99563e Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 18 Jan 2022 19:46:15 +0000 Subject: [PATCH 095/294] Add location of DejaVu Sans font Signed-off-by: Robbie Harwood --- ...-Fedora-location-of-DejaVu-SANS-font.patch | 33 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 3 ++ 3 files changed, 37 insertions(+) create mode 100644 0202-Add-Fedora-location-of-DejaVu-SANS-font.patch diff --git a/0202-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0202-Add-Fedora-location-of-DejaVu-SANS-font.patch new file mode 100644 index 00000000..bac9f53f --- /dev/null +++ b/0202-Add-Fedora-location-of-DejaVu-SANS-font.patch @@ -0,0 +1,33 @@ +From 8c68222cbb8e7527c447bd6908578b72b7302f80 Mon Sep 17 00:00:00 2001 +From: fluteze +Date: Sat, 27 Nov 2021 10:54:44 -0600 +Subject: [PATCH] Add Fedora location of DejaVu SANS font + +In Fedora 35, and possibly earlier, grub would fail to configure with a +complaint about DejaVu being "not found" even though it was installed. +The DejaVu sans font search path is updated to reflect the +distribution's current install path. + +Signed-off-by: Erik Edwards +[rharwood@redhat.com: slight commit message edits] +Signed-off-by: Robbie Harwood +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 3c808a722..3527f069a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1812,7 +1812,7 @@ fi + + if test x"$starfield_excuse" = x; then + for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do +- for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do ++ for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype /usr/share/fonts/dejavu-sans-fonts; do + if test -f "$dir/DejaVuSans.$ext"; then + DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" + break 2 +-- +2.34.1 + diff --git a/grub.patches b/grub.patches index f12bbe64..a5a0b0d4 100644 --- a/grub.patches +++ b/grub.patches @@ -199,3 +199,4 @@ Patch0198: 0198-Print-module-name-on-license-check-failure.patch Patch0199: 0199-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch Patch0200: 0200-grub-mkconfig-restore-umask-for-grub.cfg.patch Patch0201: 0201-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0202: 0202-Add-Fedora-location-of-DejaVu-SANS-font.patch diff --git a/grub2.spec b/grub2.spec index 47f48e7f..b2f14c05 100644 --- a/grub2.spec +++ b/grub2.spec @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jan 18 2022 Robbie Harwood - 2.06-14 +- Add location of DejaVu Sans font + * Mon Jan 17 2022 Robbie Harwood - 2.06-13 - Update patches; minor changes at most, if correct From a382c9e3c9ae55b364a59f81aea556b30661fbf7 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 18 Jan 2022 19:47:01 +0000 Subject: [PATCH 096/294] Bump release; no code chages Signed-off-by: Robbie Harwood --- grub2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index b2f14c05..4fb6c027 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ From 3e40727f723213b92defb8df7396e6c579480483 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 20 Jan 2022 22:48:15 +0000 Subject: [PATCH 097/294] Skip machine ID check when updating BLS Signed-off-by: Robbie Harwood --- 0061-Add-BLS-support-to-grub-mkconfig.patch | 26 +++++++++---------- ...-cmdline-when-generating-legacy-menu.patch | 4 +-- ...-Fedora-location-of-DejaVu-SANS-font.patch | 7 ++--- grub2.spec | 5 +++- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/0061-Add-BLS-support-to-grub-mkconfig.patch b/0061-Add-BLS-support-to-grub-mkconfig.patch index f7c8064e..7211afba 100644 --- a/0061-Add-BLS-support-to-grub-mkconfig.patch +++ b/0061-Add-BLS-support-to-grub-mkconfig.patch @@ -22,13 +22,16 @@ and Tom Gundersen respectively. Signed-off-by: Peter Jones [javierm: remove outdated URL for BLS document] Signed-off-by: Javier Martinez Canillas +[iwienand@redhat.com: skip machine ID check when updating entries] +Signed-off-by: Ian Wienand +[rharwood: commit message composits] Signed-off-by: Robbie Harwood --- util/grub-mkconfig.8 | 4 + util/grub-mkconfig.in | 9 +- util/grub-mkconfig_lib.in | 22 ++++- - util/grub.d/10_linux.in | 223 +++++++++++++++++++++++++++++++++++++++++++++- - 4 files changed, 252 insertions(+), 6 deletions(-) + util/grub.d/10_linux.in | 218 +++++++++++++++++++++++++++++++++++++++++++++- + 4 files changed, 247 insertions(+), 6 deletions(-) diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8 index a2d1f577b9b..434fa4deda4 100644 @@ -143,10 +146,10 @@ index fafeac95061..d8bb4069360 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 7bb3a211a7c..6bceabf3dc9 100644 +index 7bb3a211a7c..9fcd77cacc3 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -82,6 +82,223 @@ case x"$GRUB_FS" in +@@ -82,6 +82,218 @@ case x"$GRUB_FS" in ;; esac @@ -206,18 +209,13 @@ index 7bb3a211a7c..6bceabf3dc9 100644 + +get_sorted_bls() +{ -+ if ! [ -d "${blsdir}" ] || ! [ -e /etc/machine-id ]; then -+ return -+ fi -+ -+ read machine_id < /etc/machine-id -+ if [ -z "${machine_id}" ]; then ++ if ! [ -d "${blsdir}" ]; then + return + fi + + local IFS=$'\n' + -+ files=($(for bls in ${blsdir}/${machine_id}-*.conf; do ++ files=($(for bls in ${blsdir}/*.conf; do + if ! [[ -e "${bls}" ]] ; then + continue + fi @@ -370,7 +368,7 @@ index 7bb3a211a7c..6bceabf3dc9 100644 mktitle () { local title_type -@@ -121,6 +338,7 @@ linux_entry () +@@ -121,6 +333,7 @@ linux_entry () if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi @@ -378,7 +376,7 @@ index 7bb3a211a7c..6bceabf3dc9 100644 if [ x$type != xsimple ] ; then title=$(mktitle "$type" "$version") if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then -@@ -231,6 +449,7 @@ is_top_level=true +@@ -231,6 +444,7 @@ is_top_level=true while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` gettext_printf "Found linux image: %s\n" "$linux" >&2 @@ -386,7 +384,7 @@ index 7bb3a211a7c..6bceabf3dc9 100644 basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` -@@ -269,7 +488,9 @@ while [ "x$list" != "x" ] ; do +@@ -269,7 +483,9 @@ while [ "x$list" != "x" ] ; do for i in ${initrd}; do initrd_display="${initrd_display} ${dirname}/${i}" done diff --git a/0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index 2e13f399..85dfb537 100644 --- a/0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,10 +20,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 6bceabf3dc9..b95a9a8d7ca 100644 +index 9fcd77cacc3..dc473f4333c 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -261,7 +261,9 @@ if [ -z "\${kernelopts}" ]; then +@@ -256,7 +256,9 @@ if [ -z "\${kernelopts}" ]; then fi EOF diff --git a/0202-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0202-Add-Fedora-location-of-DejaVu-SANS-font.patch index bac9f53f..eb76649e 100644 --- a/0202-Add-Fedora-location-of-DejaVu-SANS-font.patch +++ b/0202-Add-Fedora-location-of-DejaVu-SANS-font.patch @@ -1,4 +1,4 @@ -From 8c68222cbb8e7527c447bd6908578b72b7302f80 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: fluteze Date: Sat, 27 Nov 2021 10:54:44 -0600 Subject: [PATCH] Add Fedora location of DejaVu SANS font @@ -16,7 +16,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 3c808a722..3527f069a 100644 +index 3c808a72230..3527f069ab2 100644 --- a/configure.ac +++ b/configure.ac @@ -1812,7 +1812,7 @@ fi @@ -28,6 +28,3 @@ index 3c808a722..3527f069a 100644 if test -f "$dir/DejaVuSans.$ext"; then DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" break 2 --- -2.34.1 - diff --git a/grub2.spec b/grub2.spec index 4fb6c027..959991cb 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -523,6 +523,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Jan 20 2022 Robbie Harwood - 2.06-15 +- Skip machine ID check when updating BLS + * Tue Jan 18 2022 Robbie Harwood - 2.06-14 - Add location of DejaVu Sans font From 8a74d28ac85dff8c6c66ccb9b5d09479406eada4 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 17 Feb 2022 11:53:21 -0500 Subject: [PATCH 098/294] Life is pain, but especially when it's gnulib Signed-off-by: Robbie Harwood --- ...p-all-the-places-Wsign-compare-error.patch | 208 +---- 0121-Do-better-in-bootstrap.conf.patch | 28 - ...g-Update-comment-about-running-as-ro.patch | 0 0122-Use-git-to-apply-gnulib-patches.patch | 631 ------------- ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...indeterminate-getting-set-on-boot_su.patch | 0 ... => 0124-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 4 +- ...fw-http-_path-variables-to-make-them.patch | 0 ...-literal-IPv6-addresses-in-square-br.patch | 0 ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 0 ...se-address-before-jumping-to-the-PE-.patch | 0 ...ate-TPM-measurement-errors-to-the-ve.patch | 0 ...maximum-bounce-buffer-size-to-16-MiB.patch | 0 ...fix-when-the-HTTP-path-is-relative-a.patch | 0 ...turn-in-efi-export-env-and-efi-load-.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 0 ...rnel-validation-without-shim-protoco.patch | 0 ...ar-pointers-in-grub-core-net-bootp.c.patch | 0 ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 0 ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 0 ...ll-disable-support-for-EFI-platforms.patch | 0 ...imestamps-configure-flag-to-prepend-.patch | 0 ...ements-to-grub_disk_open-and-grub_di.patch | 0 ...on-grub_debug_is_enabled-void-return.patch | 0 ...ear-screen-when-debugging-is-enabled.patch | 0 ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 0 ...igning-grub-with-an-appended-signatu.patch | 0 ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0164-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0167-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...70-libtasn1-compile-into-asn1-module.patch | 0 ...1-test_asn1-test-module-for-libtasn1.patch | 0 ...-support-embedding-x509-certificates.patch | 0 ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 0 ...77-appended-signatures-documentation.patch | 0 ...er-lockdown-based-on-ibm-secure-boot.patch | 0 ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0180-ieee1275-claim-more-memory.patch | 0 ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 0 ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...ainloading-EFI-apps-from-loop-mounts.patch | 0 ...> 0185-efinet-Add-DHCP-proxy-support.patch | 0 ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 0 ... 0188-Suppress-gettext-error-message.patch | 0 ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 ...for-EFI-at-runtime-instead-of-config.patch | 0 ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 0 ...over-the-device-to-read-the-config-f.patch | 0 ...etting-of-prefix-for-signed-binary-c.patch | 0 ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 0 ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 0 ...-mkconfig-restore-umask-for-grub.cfg.patch | 0 ...btrfs-Use-full-btrfs-bootloader-area.patch | 0 ...-Fedora-location-of-DejaVu-SANS-font.patch | 0 ...t-show-Booting-s-msg-when-auto-booti.patch | 90 ++ ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 41 + ...ot-set-colorstate-until-the-first-te.patch | 51 ++ ...ot-set-cursor-until-the-first-text-o.patch | 71 ++ ...se-visual-indentation-in-config.h.in.patch | 93 ++ ...sure-config-util.h-precedes-config.h.patch | 275 ++++++ 0207-Drop-gnulib-fix-base64.patch.patch | 140 +++ 0208-Drop-gnulib-no-abort.patch.patch | 97 ++ ...version-and-drop-most-gnulib-patches.patch | 832 ++++++++++++++++++ do-rebase | 14 - grub.macros | 10 +- grub.patches | 171 ++-- grub2.spec | 9 +- 96 files changed, 1806 insertions(+), 959 deletions(-) delete mode 100644 0121-Do-better-in-bootstrap.conf.patch rename 0123-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) delete mode 100644 0122-Use-git-to-apply-gnulib-patches.patch rename 0124-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) rename 0125-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (100%) rename 0126-Add-start-symbol-for-RISC-V.patch => 0124-Add-start-symbol-for-RISC-V.patch (100%) rename 0127-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (92%) rename 0128-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch (100%) rename 0129-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) rename 0130-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0131-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) rename 0132-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) rename 0133-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (100%) rename 0134-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (100%) rename 0135-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (100%) rename 0136-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (100%) rename 0137-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (100%) rename 0138-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (100%) rename 0139-efi-dhcp-fix-some-allocation-error-checking.patch => 0137-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0140-efi-http-fix-some-allocation-error-checking.patch => 0138-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0141-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0142-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (100%) rename 0143-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch (100%) rename 0144-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (100%) rename 0145-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0146-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) rename 0147-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0148-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0149-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch (100%) rename 0150-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0151-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (100%) rename 0152-grub-install-disable-support-for-EFI-platforms.patch => 0150-grub-install-disable-support-for-EFI-platforms.patch (100%) rename 0153-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch (100%) rename 0154-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (100%) rename 0155-Introduce-function-grub_debug_is_enabled-void-return.patch => 0153-Introduce-function-grub_debug_is_enabled-void-return.patch (100%) rename 0156-Don-t-clear-screen-when-debugging-is-enabled.patch => 0154-Don-t-clear-screen-when-debugging-is-enabled.patch (100%) rename 0157-grub_file_-instrumentation-new-file-debug-tag.patch => 0155-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0158-ieee1275-Avoiding-many-unecessary-open-close.patch => 0156-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0159-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0160-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0161-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (100%) rename 0162-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch (100%) rename 0163-docs-grub-Document-signing-grub-under-UEFI.patch => 0161-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0164-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) rename 0165-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0166-pgp-factor-out-rsa_pad.patch => 0164-pgp-factor-out-rsa_pad.patch (100%) rename 0167-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0168-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0169-libtasn1-import-libtasn1-4.16.0.patch => 0167-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0170-libtasn1-disable-code-not-needed-in-grub.patch => 0168-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0171-libtasn1-changes-for-grub-compatibility.patch => 0169-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0172-libtasn1-compile-into-asn1-module.patch => 0170-libtasn1-compile-into-asn1-module.patch (100%) rename 0173-test_asn1-test-module-for-libtasn1.patch => 0171-test_asn1-test-module-for-libtasn1.patch (100%) rename 0174-grub-install-support-embedding-x509-certificates.patch => 0172-grub-install-support-embedding-x509-certificates.patch (100%) rename 0175-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0176-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0177-appended-signatures-support-verifying-appended-signa.patch => 0175-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0178-appended-signatures-verification-tests.patch => 0176-appended-signatures-verification-tests.patch (100%) rename 0179-appended-signatures-documentation.patch => 0177-appended-signatures-documentation.patch (100%) rename 0180-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (100%) rename 0181-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0182-ieee1275-claim-more-memory.patch => 0180-ieee1275-claim-more-memory.patch (100%) rename 0183-ieee1275-request-memory-with-ibm-client-architecture.patch => 0181-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) rename 0184-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) rename 0185-ieee1275-ofdisk-retry-on-open-failure.patch => 0183-ieee1275-ofdisk-retry-on-open-failure.patch (100%) rename 0186-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch (100%) rename 0187-efinet-Add-DHCP-proxy-support.patch => 0185-efinet-Add-DHCP-proxy-support.patch (100%) rename 0188-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (100%) rename 0190-Suppress-gettext-error-message.patch => 0188-Suppress-gettext-error-message.patch (100%) rename 0191-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) rename 0192-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) rename 0193-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch (100%) rename 0195-normal-main-Discover-the-device-to-read-the-config-f.patch => 0193-normal-main-Discover-the-device-to-read-the-config-f.patch (100%) rename 0196-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (100%) rename 0197-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) rename 0198-Print-module-name-on-license-check-failure.patch => 0196-Print-module-name-on-license-check-failure.patch (100%) rename 0199-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (100%) rename 0200-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch (100%) rename 0201-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch (100%) rename 0202-Add-Fedora-location-of-DejaVu-SANS-font.patch => 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch (100%) create mode 100644 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch create mode 100644 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch create mode 100644 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch create mode 100644 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch create mode 100644 0205-Use-visual-indentation-in-config.h.in.patch create mode 100644 0206-Where-present-ensure-config-util.h-precedes-config.h.patch create mode 100644 0207-Drop-gnulib-fix-base64.patch.patch create mode 100644 0208-Drop-gnulib-no-abort.patch.patch create mode 100644 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch diff --git a/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index c2f2a597..e6cd8b47 100644 --- a/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -5,21 +5,18 @@ Subject: [PATCH] Attempt to fix up all the places -Wsign-compare=error finds. Signed-off-by: Peter Jones --- - grub-core/kern/emu/misc.c | 2 +- - grub-core/lib/reed_solomon.c | 4 +- - grub-core/osdep/linux/blocklist.c | 2 +- - grub-core/osdep/linux/getroot.c | 2 +- - grub-core/osdep/linux/hostdisk.c | 2 +- - util/grub-fstest.c | 2 +- - util/grub-menulst2cfg.c | 2 +- - util/grub-mkfont.c | 13 +- - util/grub-probe.c | 2 +- - util/grub-rpm-sort.c | 2 +- - util/setup.c | 2 +- - bootstrap.conf | 3 +- - .../gnulib-patches/fix-sign-compare-errors.patch | 161 +++++++++++++++++++++ - 13 files changed, 181 insertions(+), 18 deletions(-) - create mode 100644 grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch + grub-core/kern/emu/misc.c | 2 +- + grub-core/lib/reed_solomon.c | 4 ++-- + grub-core/osdep/linux/blocklist.c | 2 +- + grub-core/osdep/linux/getroot.c | 2 +- + grub-core/osdep/linux/hostdisk.c | 2 +- + util/grub-fstest.c | 2 +- + util/grub-menulst2cfg.c | 2 +- + util/grub-mkfont.c | 13 +++++++------ + util/grub-probe.c | 2 +- + util/grub-rpm-sort.c | 2 +- + util/setup.c | 2 +- + 11 files changed, 18 insertions(+), 17 deletions(-) diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c index eeea092752d..f08a1bb8415 100644 @@ -214,184 +211,3 @@ index da5f2c07f50..8b22bb8ccac 100644 grub_fs_t fs; unsigned int nsec, maxsec; -diff --git a/bootstrap.conf b/bootstrap.conf -index 6b043fc354c..186be9c48ce 100644 ---- a/bootstrap.conf -+++ b/bootstrap.conf -@@ -80,7 +80,8 @@ cp -a INSTALL INSTALL.grub - bootstrap_post_import_hook () { - set -e - for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ -- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do -+ fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort \ -+ fix-sign-compare-errors; do - patch -d grub-core/lib/gnulib -p2 \ - < "grub-core/lib/gnulib-patches/$patchname.patch" - done -diff --git a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch b/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch -new file mode 100644 -index 00000000000..479029c0565 ---- /dev/null -+++ b/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch -@@ -0,0 +1,161 @@ -+diff --git a/lib/regcomp.c b/lib/regcomp.c -+index cc85f35ac58..361079d82d6 100644 -+--- a/lib/regcomp.c -++++ b/lib/regcomp.c -+@@ -322,7 +322,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, -+ *p++ = dfa->nodes[node].opr.c; -+ memset (&state, '\0', sizeof (state)); -+ if (__mbrtowc (&wc, (const char *) buf, p - buf, -+- &state) == p - buf -++ &state) == (size_t)(p - buf) -+ && (__wcrtomb ((char *) buf, __towlower (wc), &state) -+ != (size_t) -1)) -+ re_set_fastmap (fastmap, false, buf[0]); -+@@ -3778,7 +3778,7 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) -+ num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2) -+ ? -2 -+ : num == -1 -+- ? c - '0' -++ ? (Idx)(c - '0') -+ : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); -+ } -+ return num; -+diff --git a/lib/regex_internal.c b/lib/regex_internal.c -+index 9004ce809eb..193a1e3d332 100644 -+--- a/lib/regex_internal.c -++++ b/lib/regex_internal.c -+@@ -233,7 +233,7 @@ build_wcs_buffer (re_string_t *pstr) -+ /* Apply the translation if we need. */ -+ if (__glibc_unlikely (pstr->trans != NULL)) -+ { -+- int i, ch; -++ unsigned int i, ch; -+ -+ for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) -+ { -+@@ -376,7 +376,7 @@ build_wcs_upper_buffer (re_string_t *pstr) -+ prev_st = pstr->cur_state; -+ if (__glibc_unlikely (pstr->trans != NULL)) -+ { -+- int i, ch; -++ unsigned int i, ch; -+ -+ for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) -+ { -+@@ -754,7 +754,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) -+ memset (&cur_state, 0, sizeof (cur_state)); -+ mbclen = __mbrtowc (&wc2, (const char *) pp, mlen, -+ &cur_state); -+- if (raw + offset - p <= mbclen -++ if ((size_t)(raw + offset - p) <= mbclen -+ && mbclen < (size_t) -2) -+ { -+ memset (&pstr->cur_state, '\0', -+diff --git a/lib/regex_internal.h b/lib/regex_internal.h -+index 5462419b787..e0f8292395d 100644 -+--- a/lib/regex_internal.h -++++ b/lib/regex_internal.h -+@@ -425,7 +425,7 @@ struct re_string_t -+ unsigned char offsets_needed; -+ unsigned char newline_anchor; -+ unsigned char word_ops_used; -+- int mb_cur_max; -++ unsigned int mb_cur_max; -+ }; -+ typedef struct re_string_t re_string_t; -+ -+@@ -702,7 +702,7 @@ struct re_dfa_t -+ unsigned int is_utf8 : 1; -+ unsigned int map_notascii : 1; -+ unsigned int word_ops_used : 1; -+- int mb_cur_max; -++ unsigned int mb_cur_max; -+ bitset_t word_char; -+ reg_syntax_t syntax; -+ Idx *subexp_map; -+diff --git a/lib/regexec.c b/lib/regexec.c -+index 0a7a27b772e..b57d4f9141d 100644 -+--- a/lib/regexec.c -++++ b/lib/regexec.c -+@@ -443,7 +443,7 @@ re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, -+ { -+ if (ret_len) -+ { -+- assert (pmatch[0].rm_so == start); -++ assert (pmatch[0].rm_so == (long)start); -+ rval = pmatch[0].rm_eo - start; -+ } -+ else -+@@ -877,11 +877,11 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, -+ if (__glibc_unlikely (mctx.input.offsets_needed != 0)) -+ { -+ pmatch[reg_idx].rm_so = -+- (pmatch[reg_idx].rm_so == mctx.input.valid_len -++ (pmatch[reg_idx].rm_so == (long)mctx.input.valid_len -+ ? mctx.input.valid_raw_len -+ : mctx.input.offsets[pmatch[reg_idx].rm_so]); -+ pmatch[reg_idx].rm_eo = -+- (pmatch[reg_idx].rm_eo == mctx.input.valid_len -++ (pmatch[reg_idx].rm_eo == (long)mctx.input.valid_len -+ ? mctx.input.valid_raw_len -+ : mctx.input.offsets[pmatch[reg_idx].rm_eo]); -+ } -+@@ -1418,11 +1418,11 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, -+ } -+ memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); -+ -+- for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) -++ for (idx = pmatch[0].rm_so; idx <= (long)pmatch[0].rm_eo ;) -+ { -+ update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); -+ -+- if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) -++ if (idx == (long)pmatch[0].rm_eo && cur_node == mctx->last_node) -+ { -+ Idx reg_idx; -+ if (fs) -+@@ -1519,7 +1519,7 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, -+ if (reg_num < nmatch) -+ { -+ /* We are at the last node of this sub expression. */ -+- if (pmatch[reg_num].rm_so < cur_idx) -++ if (pmatch[reg_num].rm_so < (long)cur_idx) -+ { -+ pmatch[reg_num].rm_eo = cur_idx; -+ /* This is a non-empty match or we are not inside an optional -+@@ -2938,7 +2938,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, -+ mctx->state_log[str_idx] = cur_state; -+ } -+ -+- for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;) -++ for (null_cnt = 0; str_idx < last_str && null_cnt <= (long)mctx->max_mb_elem_len;) -+ { -+ re_node_set_empty (&next_nodes); -+ if (mctx->state_log[str_idx + 1]) -+@@ -3718,7 +3718,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, -+ const re_string_t *input, Idx str_idx) -+ { -+ const re_token_t *node = dfa->nodes + node_idx; -+- int char_len, elem_len; -++ unsigned int char_len, elem_len; -+ Idx i; -+ -+ if (__glibc_unlikely (node->type == OP_UTF8_PERIOD)) -+@@ -4066,7 +4066,7 @@ extend_buffers (re_match_context_t *mctx, int min_len) -+ /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ -+ ret = re_string_realloc_buffers (pstr, -+ MAX (min_len, -+- MIN (pstr->len, pstr->bufs_len * 2))); -++ MIN ((long)pstr->len, pstr->bufs_len * 2))); -+ if (__glibc_unlikely (ret != REG_NOERROR)) -+ return ret; -+ -+@@ -4236,7 +4236,7 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, -+ = (from == to ? -1 : 0); -+ -+ mctx->bkref_ents[mctx->nbkref_ents++].more = 0; -+- if (mctx->max_mb_elem_len < to - from) -++ if (mctx->max_mb_elem_len < (long)(to - from)) -+ mctx->max_mb_elem_len = to - from; -+ return REG_NOERROR; -+ } diff --git a/0121-Do-better-in-bootstrap.conf.patch b/0121-Do-better-in-bootstrap.conf.patch deleted file mode 100644 index ec9d8ecc..00000000 --- a/0121-Do-better-in-bootstrap.conf.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 29 Jul 2019 10:58:52 -0400 -Subject: [PATCH] Do better in bootstrap.conf - ---- - bootstrap.conf | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/bootstrap.conf b/bootstrap.conf -index 186be9c48ce..9259526e891 100644 ---- a/bootstrap.conf -+++ b/bootstrap.conf -@@ -16,7 +16,13 @@ - # along with this program. If not, see . - - --GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 -+# GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 -+if [[ -z "${GNULIB_REVISION}" ]] ;then -+ GNULIB_REVISION=fixes -+fi -+if [[ -z "${GNULIB_URL}" ]] ;then -+ GNULIB_URL=https://github.com/rhboot/gnulib.git -+fi - - # gnulib modules used by this package. - # mbswidth is used by gnulib-fix-width.diff's changes to argp rather than diff --git a/0123-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0123-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0122-Use-git-to-apply-gnulib-patches.patch b/0122-Use-git-to-apply-gnulib-patches.patch deleted file mode 100644 index 76546488..00000000 --- a/0122-Use-git-to-apply-gnulib-patches.patch +++ /dev/null @@ -1,631 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 29 Jul 2019 11:21:27 -0400 -Subject: [PATCH] Use git to apply gnulib patches. - -Signed-off-by: Peter Jones ---- - bootstrap.conf | 6 - - conf/Makefile.extra-dist | 10 - - grub-core/lib/gnulib-patches/fix-base64.patch | 21 -- - grub-core/lib/gnulib-patches/fix-null-deref.patch | 13 -- - .../lib/gnulib-patches/fix-null-state-deref.patch | 12 -- - .../gnulib-patches/fix-regcomp-uninit-token.patch | 15 -- - .../gnulib-patches/fix-regexec-null-deref.patch | 12 -- - .../gnulib-patches/fix-sign-compare-errors.patch | 161 --------------- - .../lib/gnulib-patches/fix-uninit-structure.patch | 11 -- - .../lib/gnulib-patches/fix-unused-value.patch | 14 -- - grub-core/lib/gnulib-patches/fix-width.patch | 217 --------------------- - grub-core/lib/gnulib-patches/no-abort.patch | 26 --- - 12 files changed, 518 deletions(-) - delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-width.patch - delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch - -diff --git a/bootstrap.conf b/bootstrap.conf -index 9259526e891..452f4d79b0d 100644 ---- a/bootstrap.conf -+++ b/bootstrap.conf -@@ -85,12 +85,6 @@ cp -a INSTALL INSTALL.grub - - bootstrap_post_import_hook () { - set -e -- for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ -- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort \ -- fix-sign-compare-errors; do -- patch -d grub-core/lib/gnulib -p2 \ -- < "grub-core/lib/gnulib-patches/$patchname.patch" -- done - for patchname in \ - 0001-Support-POTFILES-shell \ - 0002-Handle-gettext_printf-shell-function \ -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index ea58362b555..8ddf22e6c99 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -30,16 +30,6 @@ EXTRA_DIST += grub-core/gensymlist.sh - EXTRA_DIST += grub-core/genemuinit.sh - EXTRA_DIST += grub-core/genemuinitheader.sh - --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch -- - EXTRA_DIST += grub-core/lib/libgcrypt - EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic - EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h') -diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch -deleted file mode 100644 -index 985db127971..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-base64.patch -+++ /dev/null -@@ -1,21 +0,0 @@ --diff --git a/lib/base64.h b/lib/base64.h --index 9cd0183b8..185a2afa1 100644 ----- a/lib/base64.h --+++ b/lib/base64.h --@@ -21,8 +21,14 @@ -- /* Get size_t. */ -- # include -- ---/* Get bool. */ ---# include --+#ifndef GRUB_POSIX_BOOL_DEFINED --+typedef enum { false = 0, true = 1 } bool; --+#define GRUB_POSIX_BOOL_DEFINED 1 --+#endif --+ --+#ifndef _GL_ATTRIBUTE_CONST --+# define _GL_ATTRIBUTE_CONST /* empty */ --+#endif -- -- # ifdef __cplusplus -- extern "C" { -diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch -deleted file mode 100644 -index 8fafa153a47..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-null-deref.patch -+++ /dev/null -@@ -1,13 +0,0 @@ --diff --git a/lib/argp-parse.c b/lib/argp-parse.c --index 6dec57310..900adad54 100644 ----- a/lib/argp-parse.c --+++ b/lib/argp-parse.c --@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse) -- void * -- __argp_input (const struct argp *argp, const struct argp_state *state) -- { --- if (state) --+ if (state && state->pstate) -- { -- struct group *group; -- struct parser *parser = state->pstate; -diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch -deleted file mode 100644 -index 813ec09c8a1..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch -+++ /dev/null -@@ -1,12 +0,0 @@ ----- a/lib/argp-help.c 2020-10-28 14:32:19.189215988 +0000 --+++ b/lib/argp-help.c 2020-10-28 14:38:21.204673940 +0000 --@@ -145,7 +145,8 @@ -- if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin) -- { -- __argp_failure (state, 0, 0, --- dgettext (state->root_argp->argp_domain, --+ dgettext (state == NULL ? NULL --+ : state->root_argp->argp_domain, -- "\ -- ARGP_HELP_FMT: %s value is less than or equal to %s"), -- "rmargin", up->name); -diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch -deleted file mode 100644 -index 02e06315dff..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch -+++ /dev/null -@@ -1,15 +0,0 @@ ----- a/lib/regcomp.c 2020-11-24 17:06:08.159223858 +0000 --+++ b/lib/regcomp.c 2020-11-24 17:06:15.630253923 +0000 --@@ -3808,11 +3808,7 @@ -- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, -- re_token_type_t type) -- { --- re_token_t t; ---#if defined GCC_LINT || defined lint --- memset (&t, 0, sizeof t); ---#endif --- t.type = type; --+ re_token_t t = { .type = type }; -- return create_token_tree (dfa, left, right, &t); -- } -- -diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch -deleted file mode 100644 -index db6dac9c9e3..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch -+++ /dev/null -@@ -1,12 +0,0 @@ ----- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 --+++ b/lib/regexec.c 2020-11-05 10:55:09.621542984 +0000 --@@ -1692,6 +1692,9 @@ -- { -- Idx top = mctx->state_log_top; -- --+ if (mctx->state_log == NULL) --+ return REG_NOERROR; --+ -- if ((next_state_log_idx >= mctx->input.bufs_len -- && mctx->input.bufs_len < mctx->input.len) -- || (next_state_log_idx >= mctx->input.valid_len -diff --git a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch b/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch -deleted file mode 100644 -index 479029c0565..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-sign-compare-errors.patch -+++ /dev/null -@@ -1,161 +0,0 @@ --diff --git a/lib/regcomp.c b/lib/regcomp.c --index cc85f35ac58..361079d82d6 100644 ----- a/lib/regcomp.c --+++ b/lib/regcomp.c --@@ -322,7 +322,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, -- *p++ = dfa->nodes[node].opr.c; -- memset (&state, '\0', sizeof (state)); -- if (__mbrtowc (&wc, (const char *) buf, p - buf, --- &state) == p - buf --+ &state) == (size_t)(p - buf) -- && (__wcrtomb ((char *) buf, __towlower (wc), &state) -- != (size_t) -1)) -- re_set_fastmap (fastmap, false, buf[0]); --@@ -3778,7 +3778,7 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) -- num = ((token->type != CHARACTER || c < '0' || '9' < c || num == -2) -- ? -2 -- : num == -1 --- ? c - '0' --+ ? (Idx)(c - '0') -- : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); -- } -- return num; --diff --git a/lib/regex_internal.c b/lib/regex_internal.c --index 9004ce809eb..193a1e3d332 100644 ----- a/lib/regex_internal.c --+++ b/lib/regex_internal.c --@@ -233,7 +233,7 @@ build_wcs_buffer (re_string_t *pstr) -- /* Apply the translation if we need. */ -- if (__glibc_unlikely (pstr->trans != NULL)) -- { --- int i, ch; --+ unsigned int i, ch; -- -- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) -- { --@@ -376,7 +376,7 @@ build_wcs_upper_buffer (re_string_t *pstr) -- prev_st = pstr->cur_state; -- if (__glibc_unlikely (pstr->trans != NULL)) -- { --- int i, ch; --+ unsigned int i, ch; -- -- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) -- { --@@ -754,7 +754,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) -- memset (&cur_state, 0, sizeof (cur_state)); -- mbclen = __mbrtowc (&wc2, (const char *) pp, mlen, -- &cur_state); --- if (raw + offset - p <= mbclen --+ if ((size_t)(raw + offset - p) <= mbclen -- && mbclen < (size_t) -2) -- { -- memset (&pstr->cur_state, '\0', --diff --git a/lib/regex_internal.h b/lib/regex_internal.h --index 5462419b787..e0f8292395d 100644 ----- a/lib/regex_internal.h --+++ b/lib/regex_internal.h --@@ -425,7 +425,7 @@ struct re_string_t -- unsigned char offsets_needed; -- unsigned char newline_anchor; -- unsigned char word_ops_used; --- int mb_cur_max; --+ unsigned int mb_cur_max; -- }; -- typedef struct re_string_t re_string_t; -- --@@ -702,7 +702,7 @@ struct re_dfa_t -- unsigned int is_utf8 : 1; -- unsigned int map_notascii : 1; -- unsigned int word_ops_used : 1; --- int mb_cur_max; --+ unsigned int mb_cur_max; -- bitset_t word_char; -- reg_syntax_t syntax; -- Idx *subexp_map; --diff --git a/lib/regexec.c b/lib/regexec.c --index 0a7a27b772e..b57d4f9141d 100644 ----- a/lib/regexec.c --+++ b/lib/regexec.c --@@ -443,7 +443,7 @@ re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, -- { -- if (ret_len) -- { --- assert (pmatch[0].rm_so == start); --+ assert (pmatch[0].rm_so == (long)start); -- rval = pmatch[0].rm_eo - start; -- } -- else --@@ -877,11 +877,11 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, -- if (__glibc_unlikely (mctx.input.offsets_needed != 0)) -- { -- pmatch[reg_idx].rm_so = --- (pmatch[reg_idx].rm_so == mctx.input.valid_len --+ (pmatch[reg_idx].rm_so == (long)mctx.input.valid_len -- ? mctx.input.valid_raw_len -- : mctx.input.offsets[pmatch[reg_idx].rm_so]); -- pmatch[reg_idx].rm_eo = --- (pmatch[reg_idx].rm_eo == mctx.input.valid_len --+ (pmatch[reg_idx].rm_eo == (long)mctx.input.valid_len -- ? mctx.input.valid_raw_len -- : mctx.input.offsets[pmatch[reg_idx].rm_eo]); -- } --@@ -1418,11 +1418,11 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, -- } -- memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); -- --- for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) --+ for (idx = pmatch[0].rm_so; idx <= (long)pmatch[0].rm_eo ;) -- { -- update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); -- --- if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) --+ if (idx == (long)pmatch[0].rm_eo && cur_node == mctx->last_node) -- { -- Idx reg_idx; -- if (fs) --@@ -1519,7 +1519,7 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, -- if (reg_num < nmatch) -- { -- /* We are at the last node of this sub expression. */ --- if (pmatch[reg_num].rm_so < cur_idx) --+ if (pmatch[reg_num].rm_so < (long)cur_idx) -- { -- pmatch[reg_num].rm_eo = cur_idx; -- /* This is a non-empty match or we are not inside an optional --@@ -2938,7 +2938,7 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, -- mctx->state_log[str_idx] = cur_state; -- } -- --- for (null_cnt = 0; str_idx < last_str && null_cnt <= mctx->max_mb_elem_len;) --+ for (null_cnt = 0; str_idx < last_str && null_cnt <= (long)mctx->max_mb_elem_len;) -- { -- re_node_set_empty (&next_nodes); -- if (mctx->state_log[str_idx + 1]) --@@ -3718,7 +3718,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, -- const re_string_t *input, Idx str_idx) -- { -- const re_token_t *node = dfa->nodes + node_idx; --- int char_len, elem_len; --+ unsigned int char_len, elem_len; -- Idx i; -- -- if (__glibc_unlikely (node->type == OP_UTF8_PERIOD)) --@@ -4066,7 +4066,7 @@ extend_buffers (re_match_context_t *mctx, int min_len) -- /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ -- ret = re_string_realloc_buffers (pstr, -- MAX (min_len, --- MIN (pstr->len, pstr->bufs_len * 2))); --+ MIN ((long)pstr->len, pstr->bufs_len * 2))); -- if (__glibc_unlikely (ret != REG_NOERROR)) -- return ret; -- --@@ -4236,7 +4236,7 @@ match_ctx_add_entry (re_match_context_t *mctx, Idx node, Idx str_idx, Idx from, -- = (from == to ? -1 : 0); -- -- mctx->bkref_ents[mctx->nbkref_ents++].more = 0; --- if (mctx->max_mb_elem_len < to - from) --+ if (mctx->max_mb_elem_len < (long)(to - from)) -- mctx->max_mb_elem_len = to - from; -- return REG_NOERROR; -- } -diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch -deleted file mode 100644 -index 7b4d9f67af4..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch -+++ /dev/null -@@ -1,11 +0,0 @@ ----- a/lib/regcomp.c 2020-10-22 13:49:06.770168928 +0000 --+++ b/lib/regcomp.c 2020-10-22 13:50:37.026528298 +0000 --@@ -3662,7 +3662,7 @@ -- Idx alloc = 0; -- #endif /* not RE_ENABLE_I18N */ -- reg_errcode_t ret; --- re_token_t br_token; --+ re_token_t br_token = {0}; -- bin_tree_t *tree; -- -- sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); -diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch -deleted file mode 100644 -index ba51f1bf223..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-unused-value.patch -+++ /dev/null -@@ -1,14 +0,0 @@ ----- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 --+++ b/lib/regexec.c 2020-10-21 14:32:07.961765604 +0000 --@@ -828,7 +828,11 @@ -- break; -- if (__glibc_unlikely (err != REG_NOMATCH)) -- goto free_return; --+#ifdef DEBUG --+ /* Only used for assertion below when DEBUG is set, otherwise --+ it will be over-written when we loop around. */ -- match_last = -1; --+#endif -- } -- else -- break; /* We found a match. */ -diff --git a/grub-core/lib/gnulib-patches/fix-width.patch b/grub-core/lib/gnulib-patches/fix-width.patch -deleted file mode 100644 -index 0a208ad08b5..00000000000 ---- a/grub-core/lib/gnulib-patches/fix-width.patch -+++ /dev/null -@@ -1,217 +0,0 @@ --diff --git a/lib/argp-fmtstream.c b/lib/argp-fmtstream.c --index ba6a407f7..d0685b3d4 100644 ----- a/lib/argp-fmtstream.c --+++ b/lib/argp-fmtstream.c --@@ -28,9 +28,11 @@ -- #include -- #include -- #include --+#include -- -- #include "argp-fmtstream.h" -- #include "argp-namefrob.h" --+#include "mbswidth.h" -- -- #ifndef ARGP_FMTSTREAM_USE_LINEWRAP -- --@@ -115,6 +117,51 @@ weak_alias (__argp_fmtstream_free, argp_fmtstream_free) -- #endif -- #endif -- --+ --+/* Return the pointer to the first character that doesn't fit in l columns. */ --+static inline const ptrdiff_t --+add_width (const char *ptr, const char *end, size_t l) --+{ --+ mbstate_t ps; --+ const char *ptr0 = ptr; --+ --+ memset (&ps, 0, sizeof (ps)); --+ --+ while (ptr < end) --+ { --+ wchar_t wc; --+ size_t s, k; --+ --+ s = mbrtowc (&wc, ptr, end - ptr, &ps); --+ if (s == (size_t) -1) --+ break; --+ if (s == (size_t) -2) --+ { --+ if (1 >= l) --+ break; --+ l--; --+ ptr++; --+ continue; --+ } --+ --+ if (wc == '\e' && ptr + 3 < end --+ && ptr[1] == '[' && (ptr[2] == '0' || ptr[2] == '1') --+ && ptr[3] == 'm') --+ { --+ ptr += 4; --+ continue; --+ } --+ --+ k = wcwidth (wc); --+ --+ if (k >= l) --+ break; --+ l -= k; --+ ptr += s; --+ } --+ return ptr - ptr0; --+} --+ -- /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the -- end of its buffer. This code is mostly from glibc stdio/linewrap.c. */ -- void --@@ -168,13 +215,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs) -- if (!nl) -- { -- /* The buffer ends in a partial line. */ --+ size_t display_width = mbsnwidth (buf, fs->p - buf, --+ MBSW_STOP_AT_NUL); -- --- if (fs->point_col + len < fs->rmargin) --+ if (fs->point_col + display_width < fs->rmargin) -- { -- /* The remaining buffer text is a partial line and fits -- within the maximum line width. Advance point for the -- characters to be written and stop scanning. */ --- fs->point_col += len; --+ fs->point_col += display_width; -- break; -- } -- else --@@ -182,14 +231,18 @@ __argp_fmtstream_update (argp_fmtstream_t fs) -- the end of the buffer. */ -- nl = fs->p; -- } --- else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin) --- { --- /* The buffer contains a full line that fits within the maximum --- line width. Reset point and scan the next line. */ --- fs->point_col = 0; --- buf = nl + 1; --- continue; --- } --+ else --+ { --+ size_t display_width = mbsnwidth (buf, nl - buf, MBSW_STOP_AT_NUL); --+ if (display_width < (ssize_t) fs->rmargin) --+ { --+ /* The buffer contains a full line that fits within the maximum --+ line width. Reset point and scan the next line. */ --+ fs->point_col = 0; --+ buf = nl + 1; --+ continue; --+ } --+ } -- -- /* This line is too long. */ -- r = fs->rmargin - 1; --@@ -225,7 +278,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) -- char *p, *nextline; -- int i; -- --- p = buf + (r + 1 - fs->point_col); --+ p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); -- while (p >= buf && !isblank ((unsigned char) *p)) -- --p; -- nextline = p + 1; /* This will begin the next line. */ --@@ -243,7 +296,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) -- { -- /* A single word that is greater than the maximum line width. -- Oh well. Put it on an overlong line by itself. */ --- p = buf + (r + 1 - fs->point_col); --+ p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); -- /* Find the end of the long word. */ -- if (p < nl) -- do --@@ -277,7 +330,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs) -- && fs->p > nextline) -- { -- /* The margin needs more blanks than we removed. */ --- if (fs->end - fs->p > fs->wmargin + 1) --+ if (mbsnwidth (fs->p, fs->end - fs->p, MBSW_STOP_AT_NUL) --+ > fs->wmargin + 1) -- /* Make some space for them. */ -- { -- size_t mv = fs->p - nextline; --diff --git a/lib/argp-help.c b/lib/argp-help.c --index e5375a0f0..5d8f451ec 100644 ----- a/lib/argp-help.c --+++ b/lib/argp-help.c --@@ -51,6 +51,7 @@ -- #include "argp.h" -- #include "argp-fmtstream.h" -- #include "argp-namefrob.h" --+#include "mbswidth.h" -- -- #ifndef SIZE_MAX -- # define SIZE_MAX ((size_t) -1) --@@ -1432,7 +1433,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, -- -- /* Manually do line wrapping so that it (probably) won't get wrapped at -- any embedded spaces. */ --- space (stream, 1 + nl - cp); --+ space (stream, 1 + mbsnwidth (cp, nl - cp, MBSW_STOP_AT_NUL)); -- -- __argp_fmtstream_write (stream, cp, nl - cp); -- } --diff --git a/lib/mbswidth.c b/lib/mbswidth.c --index 408a15e34..b3fb7f83a 100644 ----- a/lib/mbswidth.c --+++ b/lib/mbswidth.c --@@ -38,6 +38,14 @@ -- /* Get INT_MAX. */ -- #include -- --+#ifndef FALLTHROUGH --+# if __GNUC__ < 7 --+# define FALLTHROUGH ((void) 0) --+# else --+# define FALLTHROUGH __attribute__ ((__fallthrough__)) --+# endif --+#endif --+ -- /* Returns the number of columns needed to represent the multibyte -- character string pointed to by STRING. If a non-printable character -- occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. --@@ -90,6 +98,10 @@ mbsnwidth (const char *string, size_t nbytes, int flags) -- p++; -- width++; -- break; --+ case '\0': --+ if (flags & MBSW_STOP_AT_NUL) --+ return width; --+ FALLTHROUGH; -- default: -- /* If we have a multibyte sequence, scan it up to its end. */ -- { --@@ -168,6 +180,9 @@ mbsnwidth (const char *string, size_t nbytes, int flags) -- { -- unsigned char c = (unsigned char) *p++; -- --+ if (c == 0 && (flags & MBSW_STOP_AT_NUL)) --+ return width; --+ -- if (isprint (c)) -- { -- if (width == INT_MAX) --diff --git a/lib/mbswidth.h b/lib/mbswidth.h --index 2b5c53c37..45a123e63 100644 ----- a/lib/mbswidth.h --+++ b/lib/mbswidth.h --@@ -45,6 +45,10 @@ extern "C" { -- control characters and 1 otherwise. */ -- #define MBSW_REJECT_UNPRINTABLE 2 -- --+/* If this bit is set \0 is treated as the end of string. --+ Otherwise it's treated as a normal one column width character. */ --+#define MBSW_STOP_AT_NUL 4 --+ -- -- /* Returns the number of screen columns needed for STRING. */ -- #define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */ -diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch -deleted file mode 100644 -index e469c4762eb..00000000000 ---- a/grub-core/lib/gnulib-patches/no-abort.patch -+++ /dev/null -@@ -1,26 +0,0 @@ --diff --git a/lib/regcomp.c b/lib/regcomp.c --index cc85f35ac..de45ebb5c 100644 ----- a/lib/regcomp.c --+++ b/lib/regcomp.c --@@ -528,9 +528,9 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf, -- to this routine. If we are given anything else, or if other regex -- code generates an invalid error code, then the program has a bug. -- Dump core so we can fix it. */ --- abort (); --- --- msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); --+ msg = gettext ("unknown regexp error"); --+ else --+ msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); -- -- msg_size = strlen (msg) + 1; /* Includes the null. */ -- --@@ -1136,7 +1136,7 @@ optimize_utf8 (re_dfa_t *dfa) -- } -- break; -- default: --- abort (); --+ break; -- } -- -- if (mb_chars || has_period) diff --git a/0124-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0124-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0125-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 100% rename from 0125-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0126-Add-start-symbol-for-RISC-V.patch b/0124-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0126-Add-start-symbol-for-RISC-V.patch rename to 0124-Add-start-symbol-for-RISC-V.patch diff --git a/0127-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 92% rename from 0127-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch index 5c3b968b..49c92b97 100644 --- a/0127-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +++ b/0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch @@ -19,10 +19,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf -index 452f4d79b0d..03f10930230 100644 +index 6b043fc354c..52d4af44bec 100644 --- a/bootstrap.conf +++ b/bootstrap.conf -@@ -93,7 +93,7 @@ bootstrap_post_import_hook () { +@@ -92,7 +92,7 @@ bootstrap_post_import_hook () { patch -d po -p3 \ < "po/gettext-patches/$patchname.patch" done diff --git a/0128-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 100% rename from 0128-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch diff --git a/0129-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0129-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0130-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0130-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0131-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0131-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0132-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0132-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0133-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 100% rename from 0133-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch diff --git a/0134-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 100% rename from 0134-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0135-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 100% rename from 0135-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0136-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 100% rename from 0136-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0137-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 100% rename from 0137-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch diff --git a/0138-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 100% rename from 0138-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch diff --git a/0139-efi-dhcp-fix-some-allocation-error-checking.patch b/0137-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0139-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0137-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0140-efi-http-fix-some-allocation-error-checking.patch b/0138-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0140-efi-http-fix-some-allocation-error-checking.patch rename to 0138-efi-http-fix-some-allocation-error-checking.patch diff --git a/0141-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0141-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0142-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 100% rename from 0142-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch diff --git a/0143-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 100% rename from 0143-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch diff --git a/0144-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 100% rename from 0144-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch diff --git a/0145-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0145-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0146-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0146-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0147-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0147-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0148-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0148-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0149-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 100% rename from 0149-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch diff --git a/0150-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0150-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0151-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 100% rename from 0151-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0152-grub-install-disable-support-for-EFI-platforms.patch b/0150-grub-install-disable-support-for-EFI-platforms.patch similarity index 100% rename from 0152-grub-install-disable-support-for-EFI-platforms.patch rename to 0150-grub-install-disable-support-for-EFI-platforms.patch diff --git a/0153-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 100% rename from 0153-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch diff --git a/0154-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 100% rename from 0154-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch diff --git a/0155-Introduce-function-grub_debug_is_enabled-void-return.patch b/0153-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 100% rename from 0155-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0153-Introduce-function-grub_debug_is_enabled-void-return.patch diff --git a/0156-Don-t-clear-screen-when-debugging-is-enabled.patch b/0154-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 100% rename from 0156-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0154-Don-t-clear-screen-when-debugging-is-enabled.patch diff --git a/0157-grub_file_-instrumentation-new-file-debug-tag.patch b/0155-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0157-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0155-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0158-ieee1275-Avoiding-many-unecessary-open-close.patch b/0156-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0158-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0156-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0159-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0159-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0160-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0158-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0160-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0161-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 100% rename from 0161-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0162-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 100% rename from 0162-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch diff --git a/0163-docs-grub-Document-signing-grub-under-UEFI.patch b/0161-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0163-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0161-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0164-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0164-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0165-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0165-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0166-pgp-factor-out-rsa_pad.patch b/0164-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0166-pgp-factor-out-rsa_pad.patch rename to 0164-pgp-factor-out-rsa_pad.patch diff --git a/0167-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0167-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0168-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0168-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0169-libtasn1-import-libtasn1-4.16.0.patch b/0167-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0169-libtasn1-import-libtasn1-4.16.0.patch rename to 0167-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0170-libtasn1-disable-code-not-needed-in-grub.patch b/0168-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0170-libtasn1-disable-code-not-needed-in-grub.patch rename to 0168-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0171-libtasn1-changes-for-grub-compatibility.patch b/0169-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0171-libtasn1-changes-for-grub-compatibility.patch rename to 0169-libtasn1-changes-for-grub-compatibility.patch diff --git a/0172-libtasn1-compile-into-asn1-module.patch b/0170-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0172-libtasn1-compile-into-asn1-module.patch rename to 0170-libtasn1-compile-into-asn1-module.patch diff --git a/0173-test_asn1-test-module-for-libtasn1.patch b/0171-test_asn1-test-module-for-libtasn1.patch similarity index 100% rename from 0173-test_asn1-test-module-for-libtasn1.patch rename to 0171-test_asn1-test-module-for-libtasn1.patch diff --git a/0174-grub-install-support-embedding-x509-certificates.patch b/0172-grub-install-support-embedding-x509-certificates.patch similarity index 100% rename from 0174-grub-install-support-embedding-x509-certificates.patch rename to 0172-grub-install-support-embedding-x509-certificates.patch diff --git a/0175-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0175-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0176-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0176-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0177-appended-signatures-support-verifying-appended-signa.patch b/0175-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0177-appended-signatures-support-verifying-appended-signa.patch rename to 0175-appended-signatures-support-verifying-appended-signa.patch diff --git a/0178-appended-signatures-verification-tests.patch b/0176-appended-signatures-verification-tests.patch similarity index 100% rename from 0178-appended-signatures-verification-tests.patch rename to 0176-appended-signatures-verification-tests.patch diff --git a/0179-appended-signatures-documentation.patch b/0177-appended-signatures-documentation.patch similarity index 100% rename from 0179-appended-signatures-documentation.patch rename to 0177-appended-signatures-documentation.patch diff --git a/0180-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 100% rename from 0180-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch diff --git a/0181-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0181-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0182-ieee1275-claim-more-memory.patch b/0180-ieee1275-claim-more-memory.patch similarity index 100% rename from 0182-ieee1275-claim-more-memory.patch rename to 0180-ieee1275-claim-more-memory.patch diff --git a/0183-ieee1275-request-memory-with-ibm-client-architecture.patch b/0181-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0183-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0181-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0184-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0184-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0185-ieee1275-ofdisk-retry-on-open-failure.patch b/0183-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0185-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0183-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0186-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 100% rename from 0186-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch diff --git a/0187-efinet-Add-DHCP-proxy-support.patch b/0185-efinet-Add-DHCP-proxy-support.patch similarity index 100% rename from 0187-efinet-Add-DHCP-proxy-support.patch rename to 0185-efinet-Add-DHCP-proxy-support.patch diff --git a/0188-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0188-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 100% rename from 0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch diff --git a/0190-Suppress-gettext-error-message.patch b/0188-Suppress-gettext-error-message.patch similarity index 100% rename from 0190-Suppress-gettext-error-message.patch rename to 0188-Suppress-gettext-error-message.patch diff --git a/0191-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0191-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0192-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 100% rename from 0192-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch diff --git a/0193-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 100% rename from 0193-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 100% rename from 0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch diff --git a/0195-normal-main-Discover-the-device-to-read-the-config-f.patch b/0193-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 100% rename from 0195-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0193-normal-main-Discover-the-device-to-read-the-config-f.patch diff --git a/0196-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 100% rename from 0196-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch diff --git a/0197-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0197-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0198-Print-module-name-on-license-check-failure.patch b/0196-Print-module-name-on-license-check-failure.patch similarity index 100% rename from 0198-Print-module-name-on-license-check-failure.patch rename to 0196-Print-module-name-on-license-check-failure.patch diff --git a/0199-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 100% rename from 0199-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/0200-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0198-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 100% rename from 0200-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/0201-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch similarity index 100% rename from 0201-fs-btrfs-Use-full-btrfs-bootloader-area.patch rename to 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/0202-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0200-Add-Fedora-location-of-DejaVu-SANS-font.patch similarity index 100% rename from 0202-Add-Fedora-location-of-DejaVu-SANS-font.patch rename to 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch diff --git a/0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch new file mode 100644 index 00000000..531c4f5d --- /dev/null +++ b/0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch @@ -0,0 +1,90 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 28 Jan 2022 11:30:32 +0100 +Subject: [PATCH] normal/menu: Don't show "Booting `%s'" msg when auto-booting + with TIMEOUT_STYLE_HIDDEN + +When the user has asked the menu code to be hidden/quiet and the current +entry is being autobooted because the timeout has expired don't show +the "Booting `%s'" msg. + +This is necessary to let flicker-free boots really be flicker free, +otherwise the "Booting `%s'" msg will kick the EFI fb into text mode +and show the msg, breaking the flicker-free experience. + +Signed-off-by: Hans de Goede +--- + grub-core/normal/menu.c | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +index ec0c92bade0..c8516a5a080 100644 +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -606,13 +606,15 @@ print_countdown (struct grub_term_coordinate *pos, int n) + entry to be executed is a result of an automatic default selection because + of the timeout. */ + static int +-run_menu (grub_menu_t menu, int nested, int *auto_boot) ++run_menu (grub_menu_t menu, int nested, int *auto_boot, int *notify_boot) + { + grub_uint64_t saved_time; + int default_entry, current_entry; + int timeout; + enum timeout_style timeout_style; + ++ *notify_boot = 1; ++ + default_entry = get_entry_number (menu, "default"); + + /* If DEFAULT_ENTRY is not within the menu entries, fall back to +@@ -687,6 +689,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) + if (timeout == 0) + { + *auto_boot = 1; ++ *notify_boot = timeout_style != TIMEOUT_STYLE_HIDDEN; + return default_entry; + } + +@@ -840,12 +843,16 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) + + /* Callback invoked immediately before a menu entry is executed. */ + static void +-notify_booting (grub_menu_entry_t entry, +- void *userdata __attribute__((unused))) ++notify_booting (grub_menu_entry_t entry, void *userdata) + { +- grub_printf (" "); +- grub_printf_ (N_("Booting `%s'"), entry->title); +- grub_printf ("\n\n"); ++ int *notify_boot = userdata; ++ ++ if (*notify_boot) ++ { ++ grub_printf (" "); ++ grub_printf_ (N_("Booting `%s'"), entry->title); ++ grub_printf ("\n\n"); ++ } + } + + /* Callback invoked when a default menu entry executed because of a timeout +@@ -893,8 +900,9 @@ show_menu (grub_menu_t menu, int nested, int autobooted) + int boot_entry; + grub_menu_entry_t e; + int auto_boot; ++ int notify_boot; + +- boot_entry = run_menu (menu, nested, &auto_boot); ++ boot_entry = run_menu (menu, nested, &auto_boot, ¬ify_boot); + if (boot_entry < 0) + break; + +@@ -906,7 +914,7 @@ show_menu (grub_menu_t menu, int nested, int autobooted) + + if (auto_boot) + grub_menu_execute_with_fallback (menu, e, autobooted, +- &execution_callback, 0); ++ &execution_callback, ¬ify_boot); + else + grub_menu_execute_entry (e, 0); + if (autobooted) diff --git a/0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch new file mode 100644 index 00000000..8f34b74d --- /dev/null +++ b/0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 28 Jan 2022 11:30:33 +0100 +Subject: [PATCH] EFI: suppress the "Welcome to GRUB!" message in EFI builds + +Grub EFI builds are now often used in combination with flicker-free +boot, but this breaks with upstream grub because the "Welcome to GRUB!" +message will kick the EFI fb into text mode and show the msg, +breaking the flicker-free experience. + +EFI systems are so fast, that when the menu or the countdown are enabled +the message will be immediately overwritten, so in these cases not +printing the message does not matter. + +And in case when the timeout_style is set to TIMEOUT_STYLE_HIDDEN, +the user has asked grub to be quiet (for example to allow flickfree +boot) annd thus the message should not be printed. + +Signed-off-by: Hans de Goede +--- + grub-core/kern/main.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index 3fc34014726..993b8a8598e 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -317,10 +317,13 @@ grub_main (void) + + grub_boot_time ("After machine init."); + ++ /* This breaks flicker-free boot on EFI systems, so disable it there. */ ++#ifndef GRUB_MACHINE_EFI + /* Hello. */ + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + grub_printf ("Welcome to GRUB!\n\n"); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); ++#endif + + /* Init verifiers API. */ + grub_verifiers_init (); diff --git a/0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch new file mode 100644 index 00000000..cb430c02 --- /dev/null +++ b/0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 28 Jan 2022 12:43:48 +0100 +Subject: [PATCH] EFI: console: Do not set colorstate until the first text + output + +GRUB_MOD_INIT(normal) does an unconditional: + +grub_env_set ("color_normal", "light-gray/black"); + +which triggers a grub_term_setcolorstate() call. The original version +of the "efi/console: Do not set text-mode until we actually need it" patch: +https://lists.gnu.org/archive/html/grub-devel/2018-03/msg00125.html + +Protected against this by caching the requested state in +grub_console_setcolorstate () and then only applying it when the first +text output actually happens. During refactoring to move the +grub_console_setcolorstate () up higher in the grub-core/term/efi/console.c +file the code to cache the color-state + bail early was accidentally +dropped. + +Restore the cache the color-state + bail early behavior from the original. + +Cc: Javier Martinez Canillas +Fixes: 2d7c3abd871f ("efi/console: Do not set text-mode until we actually need it") +Signed-off-by: Hans de Goede +--- + grub-core/term/efi/console.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c +index 2f1ae85ba7d..c44b2ac318c 100644 +--- a/grub-core/term/efi/console.c ++++ b/grub-core/term/efi/console.c +@@ -82,6 +82,16 @@ grub_console_setcolorstate (struct grub_term_output *term + { + grub_efi_simple_text_output_interface_t *o; + ++ if (grub_efi_is_finished || text_mode != GRUB_TEXT_MODE_AVAILABLE) ++ { ++ /* ++ * Cache colorstate changes before the first text-output, this avoids ++ * "color_normal" environment writes causing a switch to textmode. ++ */ ++ text_colorstate = state; ++ return; ++ } ++ + if (grub_efi_is_finished) + return; + diff --git a/0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch new file mode 100644 index 00000000..e33d1f37 --- /dev/null +++ b/0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 28 Jan 2022 12:43:49 +0100 +Subject: [PATCH] EFI: console: Do not set cursor until the first text output + +To allow flickerfree boot the EFI console code does not call +grub_efi_set_text_mode (1) until some text is actually output. + +Depending on if the output text is because of an error loading +e.g. the .cfg file; or because of showing the menu the cursor needs +to be on or off when the first text is shown. + +So far the cursor was hardcoded to being on, but this is causing +drawing artifacts + slow drawing of the menu as reported here: +https://bugzilla.redhat.com/show_bug.cgi?id=1946969 + +Handle the cursorstate in the same way as the colorstate to fix this, +when no text has been output yet, just cache the cursorstate and +then use the last set value when the first text is output. + +Fixes: 2d7c3abd871f ("efi/console: Do not set text-mode until we actually need it") +Signed-off-by: Hans de Goede +--- + grub-core/term/efi/console.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c +index c44b2ac318c..a3622e4fe5f 100644 +--- a/grub-core/term/efi/console.c ++++ b/grub-core/term/efi/console.c +@@ -31,7 +31,15 @@ typedef enum { + } + grub_text_mode; + ++typedef enum { ++ GRUB_CURSOR_MODE_UNDEFINED = -1, ++ GRUB_CURSOR_MODE_OFF = 0, ++ GRUB_CURSUR_MODE_ON ++} ++grub_cursor_mode; ++ + static grub_text_mode text_mode = GRUB_TEXT_MODE_UNDEFINED; ++static grub_cursor_mode cursor_mode = GRUB_CURSOR_MODE_UNDEFINED; + static grub_term_color_state text_colorstate = GRUB_TERM_COLOR_UNDEFINED; + + static grub_uint32_t +@@ -119,8 +127,12 @@ grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)), + { + grub_efi_simple_text_output_interface_t *o; + +- if (grub_efi_is_finished) +- return; ++ if (grub_efi_is_finished || text_mode != GRUB_TEXT_MODE_AVAILABLE) ++ { ++ /* Cache cursor changes before the first text-output */ ++ cursor_mode = on; ++ return; ++ } + + o = grub_efi_system_table->con_out; + efi_call_2 (o->enable_cursor, o, on); +@@ -143,7 +155,8 @@ grub_prepare_for_text_output (struct grub_term_output *term) + return GRUB_ERR_BAD_DEVICE; + } + +- grub_console_setcursor (term, 1); ++ if (cursor_mode != GRUB_CURSOR_MODE_UNDEFINED) ++ grub_console_setcursor (term, cursor_mode); + if (text_colorstate != GRUB_TERM_COLOR_UNDEFINED) + grub_console_setcolorstate (term, text_colorstate); + text_mode = GRUB_TEXT_MODE_AVAILABLE; diff --git a/0205-Use-visual-indentation-in-config.h.in.patch b/0205-Use-visual-indentation-in-config.h.in.patch new file mode 100644 index 00000000..1acc3336 --- /dev/null +++ b/0205-Use-visual-indentation-in-config.h.in.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 15 Dec 2021 15:46:13 -0500 +Subject: [PATCH] Use visual indentation in config.h.in + +Signed-off-by: Robbie Harwood +(cherry picked from commit de8051f34de0aa55c921a510974e5bb27e39c17b) +[rharwood: GRUB_RPM_CONFIG presence] +--- + config.h.in | 58 +++++++++++++++++++++++++++++----------------------------- + 1 file changed, 29 insertions(+), 29 deletions(-) + +diff --git a/config.h.in b/config.h.in +index c80e3e0aba3..f2ed0066ec0 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -23,47 +23,47 @@ + #define MINILZO_CFG_SKIP_LZO1X_DECOMPRESS 1 + + #if defined (GRUB_BUILD) +-#undef ENABLE_NLS +-#define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@ +-#define BUILD_SIZEOF_VOID_P @BUILD_SIZEOF_VOID_P@ +-#if defined __APPLE__ +-# if defined __BIG_ENDIAN__ +-# define BUILD_WORDS_BIGENDIAN 1 +-# else +-# define BUILD_WORDS_BIGENDIAN 0 +-# endif +-#else +-#define BUILD_WORDS_BIGENDIAN @BUILD_WORDS_BIGENDIAN@ +-#endif ++# undef ENABLE_NLS ++# define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@ ++# define BUILD_SIZEOF_VOID_P @BUILD_SIZEOF_VOID_P@ ++# if defined __APPLE__ ++# if defined __BIG_ENDIAN__ ++# define BUILD_WORDS_BIGENDIAN 1 ++# else ++# define BUILD_WORDS_BIGENDIAN 0 ++# endif ++# else /* !defined __APPLE__ */ ++# define BUILD_WORDS_BIGENDIAN @BUILD_WORDS_BIGENDIAN@ ++# endif /* !defined __APPLE__ */ + #elif defined (GRUB_UTIL) || !defined (GRUB_MACHINE) +-#include +-#else +-#define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@ ++# include ++#else /* !defined GRUB_UTIL && defined GRUB_MACHINE */ ++# define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@ + /* Define if C symbols get an underscore after compilation. */ +-#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@ ++# define HAVE_ASM_USCORE @HAVE_ASM_USCORE@ + /* Define it to one of __bss_start, edata and _edata. */ +-#define BSS_START_SYMBOL @BSS_START_SYMBOL@ ++# define BSS_START_SYMBOL @BSS_START_SYMBOL@ + /* Define it to either end or _end. */ +-#define END_SYMBOL @END_SYMBOL@ ++# define END_SYMBOL @END_SYMBOL@ + /* Name of package. */ +-#define PACKAGE "@PACKAGE@" ++# define PACKAGE "@PACKAGE@" + /* Version number of package. */ +-#define VERSION "@VERSION@" ++# define VERSION "@VERSION@" + /* Define to the full name and version of this package. */ +-#define PACKAGE_STRING "@PACKAGE_STRING@" ++# define PACKAGE_STRING "@PACKAGE_STRING@" + /* Define to the version of this package. */ +-#define PACKAGE_VERSION "@PACKAGE_VERSION@" ++# define PACKAGE_VERSION "@PACKAGE_VERSION@" + /* Define to the full name of this package. */ +-#define PACKAGE_NAME "@PACKAGE_NAME@" ++# define PACKAGE_NAME "@PACKAGE_NAME@" + /* Define to the address where bug reports for this package should be sent. */ +-#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" ++# define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" + +-#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@" +-#define GRUB_PLATFORM "@GRUB_PLATFORM@" +-#define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@" ++# define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@" ++# define GRUB_PLATFORM "@GRUB_PLATFORM@" ++# define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@" + +-#define RE_ENABLE_I18N 1 ++# define RE_ENABLE_I18N 1 + +-#define _GNU_SOURCE 1 ++# define _GNU_SOURCE 1 + + #endif diff --git a/0206-Where-present-ensure-config-util.h-precedes-config.h.patch b/0206-Where-present-ensure-config-util.h-precedes-config.h.patch new file mode 100644 index 00000000..351d50f1 --- /dev/null +++ b/0206-Where-present-ensure-config-util.h-precedes-config.h.patch @@ -0,0 +1,275 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Tue, 22 Feb 2022 16:57:54 -0500 +Subject: [PATCH] Where present, ensure config-util.h precedes config.h + +gnulib defines go in config-util.h, and we need to know whether to +provide duplicates in config.h or not. + +Signed-off-by: Robbie Harwood +(cherry picked from commit 46e82b28e1a75703d0424c7e13d009171310c6cd) +[rharwood: gensymlist isn't part of tarballs] +--- + grub-core/disk/host.c | 2 +- + grub-core/kern/emu/argp_common.c | 2 +- + grub-core/kern/emu/main.c | 2 +- + grub-core/osdep/aros/config.c | 2 +- + grub-core/osdep/basic/emunet.c | 2 +- + grub-core/osdep/basic/init.c | 2 +- + grub-core/osdep/haiku/getroot.c | 2 +- + grub-core/osdep/linux/emunet.c | 2 +- + grub-core/osdep/unix/config.c | 2 +- + grub-core/osdep/unix/cputime.c | 2 +- + grub-core/osdep/unix/dl.c | 2 +- + grub-core/osdep/unix/emuconsole.c | 2 +- + grub-core/osdep/unix/getroot.c | 2 +- + grub-core/osdep/windows/config.c | 2 +- + grub-core/osdep/windows/cputime.c | 2 +- + grub-core/osdep/windows/dl.c | 2 +- + grub-core/osdep/windows/emuconsole.c | 2 +- + grub-core/osdep/windows/init.c | 2 +- + 18 files changed, 18 insertions(+), 18 deletions(-) + +diff --git a/grub-core/disk/host.c b/grub-core/disk/host.c +index c151d225df7..f34529f86ae 100644 +--- a/grub-core/disk/host.c ++++ b/grub-core/disk/host.c +@@ -20,8 +20,8 @@ + /* When using the disk, make a reference to this module. Otherwise + the user will end up with a useless module :-). */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/kern/emu/argp_common.c b/grub-core/kern/emu/argp_common.c +index 16688587037..8cb4608c3df 100644 +--- a/grub-core/kern/emu/argp_common.c ++++ b/grub-core/kern/emu/argp_common.c +@@ -17,8 +17,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #pragma GCC diagnostic ignored "-Wmissing-prototypes" + #pragma GCC diagnostic ignored "-Wmissing-declarations" +diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c +index 846fe9715ec..3e7929cc4af 100644 +--- a/grub-core/kern/emu/main.c ++++ b/grub-core/kern/emu/main.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/aros/config.c b/grub-core/osdep/aros/config.c +index c82d0ea8e76..55f5728efca 100644 +--- a/grub-core/osdep/aros/config.c ++++ b/grub-core/osdep/aros/config.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/basic/emunet.c b/grub-core/osdep/basic/emunet.c +index 6362e5cfbb3..dbfd316d613 100644 +--- a/grub-core/osdep/basic/emunet.c ++++ b/grub-core/osdep/basic/emunet.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/basic/init.c b/grub-core/osdep/basic/init.c +index c54c710dbcb..b104c7e162b 100644 +--- a/grub-core/osdep/basic/init.c ++++ b/grub-core/osdep/basic/init.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/haiku/getroot.c b/grub-core/osdep/haiku/getroot.c +index 4e123c0903a..927a1ebc941 100644 +--- a/grub-core/osdep/haiku/getroot.c ++++ b/grub-core/osdep/haiku/getroot.c +@@ -1,5 +1,5 @@ +-#include + #include ++#include + #include + #include + #include +diff --git a/grub-core/osdep/linux/emunet.c b/grub-core/osdep/linux/emunet.c +index 19b188f09ee..d5a6417355f 100644 +--- a/grub-core/osdep/linux/emunet.c ++++ b/grub-core/osdep/linux/emunet.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c +index 46a881530c0..0ce0e309ac0 100644 +--- a/grub-core/osdep/unix/config.c ++++ b/grub-core/osdep/unix/config.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/unix/cputime.c b/grub-core/osdep/unix/cputime.c +index cff359a3b94..fb6ff55a1a7 100644 +--- a/grub-core/osdep/unix/cputime.c ++++ b/grub-core/osdep/unix/cputime.c +@@ -1,5 +1,5 @@ +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/unix/dl.c b/grub-core/osdep/unix/dl.c +index 562b101a280..99b189bc1c9 100644 +--- a/grub-core/osdep/unix/dl.c ++++ b/grub-core/osdep/unix/dl.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/unix/emuconsole.c b/grub-core/osdep/unix/emuconsole.c +index 7308798efe9..cac159424d8 100644 +--- a/grub-core/osdep/unix/emuconsole.c ++++ b/grub-core/osdep/unix/emuconsole.c +@@ -17,8 +17,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c +index 46d7116c6e6..4f436284ce0 100644 +--- a/grub-core/osdep/unix/getroot.c ++++ b/grub-core/osdep/unix/getroot.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/windows/config.c b/grub-core/osdep/windows/config.c +index 928ab1a49be..2bb8a2fd88e 100644 +--- a/grub-core/osdep/windows/config.c ++++ b/grub-core/osdep/windows/config.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/windows/cputime.c b/grub-core/osdep/windows/cputime.c +index 3568aa2d359..5d06d79dd53 100644 +--- a/grub-core/osdep/windows/cputime.c ++++ b/grub-core/osdep/windows/cputime.c +@@ -1,5 +1,5 @@ +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/windows/dl.c b/grub-core/osdep/windows/dl.c +index eec6a24ad7f..8eab7057e4d 100644 +--- a/grub-core/osdep/windows/dl.c ++++ b/grub-core/osdep/windows/dl.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/windows/emuconsole.c b/grub-core/osdep/windows/emuconsole.c +index 4fb3693cc01..17a44de4690 100644 +--- a/grub-core/osdep/windows/emuconsole.c ++++ b/grub-core/osdep/windows/emuconsole.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c +index 6297de6326a..51a9647dde4 100644 +--- a/grub-core/osdep/windows/init.c ++++ b/grub-core/osdep/windows/init.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + #include + #include + #include diff --git a/0207-Drop-gnulib-fix-base64.patch.patch b/0207-Drop-gnulib-fix-base64.patch.patch new file mode 100644 index 00000000..1d26c57f --- /dev/null +++ b/0207-Drop-gnulib-fix-base64.patch.patch @@ -0,0 +1,140 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Thu, 28 Oct 2021 15:07:50 -0400 +Subject: [PATCH] Drop gnulib fix-base64.patch + +Originally added in 9fbdec2f6b4fa8b549daa4d49134d1fe89d95ef9 and +subsequently modified in 552c9fd08122a3036c724ce96dfe68aa2f75705f, +fix-base64.patch handled two problems we have using gnulib, which are +exerciesd by the base64 module but not directly caused by it. + +First, grub2 defines its own bool type, while gnulib expects the +equivalent of stdbool.h to be present. Rather than patching gnulib, +instead use gnulib's stdbool module to provide a bool type if needed. +(Suggested by Simon Josefsson.) + +Second, our config.h doesn't always inherit config-util.h, which is +where gnulib-related options like _GL_ATTRIBUTE_CONST end up. +fix-base64.h worked around this by defining the attribute away, but this +workaround is better placed in config.h itself, not a gnulib patch. + +Signed-off-by: Robbie Harwood +(cherry picked from commit 54fd1c3301dd15f6b6212c12887265e8a6cbc076) +--- + grub-core/lib/posix_wrap/sys/types.h | 7 +++---- + grub-core/lib/xzembed/xz.h | 5 +---- + bootstrap.conf | 3 ++- + conf/Makefile.extra-dist | 1 - + config.h.in | 4 ++++ + grub-core/lib/gnulib-patches/fix-base64.patch | 21 --------------------- + 6 files changed, 10 insertions(+), 31 deletions(-) + delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch + +diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h +index f63412c8da0..2f3e865495a 100644 +--- a/grub-core/lib/posix_wrap/sys/types.h ++++ b/grub-core/lib/posix_wrap/sys/types.h +@@ -23,11 +23,10 @@ + + #include + ++/* Provided by gnulib if not present. */ ++#include ++ + typedef grub_ssize_t ssize_t; +-#ifndef GRUB_POSIX_BOOL_DEFINED +-typedef enum { false = 0, true = 1 } bool; +-#define GRUB_POSIX_BOOL_DEFINED 1 +-#endif + + typedef grub_uint8_t uint8_t; + typedef grub_uint16_t uint16_t; +diff --git a/grub-core/lib/xzembed/xz.h b/grub-core/lib/xzembed/xz.h +index f7b32d80032..d1417039aa4 100644 +--- a/grub-core/lib/xzembed/xz.h ++++ b/grub-core/lib/xzembed/xz.h +@@ -29,10 +29,7 @@ + #include + #include + #include +- +-#ifndef GRUB_POSIX_BOOL_DEFINED +-typedef enum { false = 0, true = 1 } bool; +-#endif ++#include + + /** + * enum xz_ret - Return codes +diff --git a/bootstrap.conf b/bootstrap.conf +index 52d4af44bec..645e3a459ce 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -35,6 +35,7 @@ gnulib_modules=" + realloc-gnu + regex + save-cwd ++ stdbool + " + + gnulib_tool_option_extras="\ +@@ -79,7 +80,7 @@ cp -a INSTALL INSTALL.grub + + bootstrap_post_import_hook () { + set -e +- for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ ++ for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ + fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do + patch -d grub-core/lib/gnulib -p2 \ + < "grub-core/lib/gnulib-patches/$patchname.patch" +diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist +index ea58362b555..ca6a50deca9 100644 +--- a/conf/Makefile.extra-dist ++++ b/conf/Makefile.extra-dist +@@ -30,7 +30,6 @@ EXTRA_DIST += grub-core/gensymlist.sh + EXTRA_DIST += grub-core/genemuinit.sh + EXTRA_DIST += grub-core/genemuinitheader.sh + +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch + EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch + EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch + EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch +diff --git a/config.h.in b/config.h.in +index f2ed0066ec0..9c7b4afaaad 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -66,4 +66,8 @@ + + # define _GNU_SOURCE 1 + ++# ifndef _GL_INLINE_HEADER_BEGIN ++# define _GL_ATTRIBUTE_CONST __attribute__ ((const)) ++# endif /* !_GL_INLINE_HEADER_BEGIN */ ++ + #endif +diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch +deleted file mode 100644 +index 985db127971..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-base64.patch ++++ /dev/null +@@ -1,21 +0,0 @@ +-diff --git a/lib/base64.h b/lib/base64.h +-index 9cd0183b8..185a2afa1 100644 +---- a/lib/base64.h +-+++ b/lib/base64.h +-@@ -21,8 +21,14 @@ +- /* Get size_t. */ +- # include +- +--/* Get bool. */ +--# include +-+#ifndef GRUB_POSIX_BOOL_DEFINED +-+typedef enum { false = 0, true = 1 } bool; +-+#define GRUB_POSIX_BOOL_DEFINED 1 +-+#endif +-+ +-+#ifndef _GL_ATTRIBUTE_CONST +-+# define _GL_ATTRIBUTE_CONST /* empty */ +-+#endif +- +- # ifdef __cplusplus +- extern "C" { diff --git a/0208-Drop-gnulib-no-abort.patch.patch b/0208-Drop-gnulib-no-abort.patch.patch new file mode 100644 index 00000000..79bcb038 --- /dev/null +++ b/0208-Drop-gnulib-no-abort.patch.patch @@ -0,0 +1,97 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 5 Jan 2022 16:42:11 -0500 +Subject: [PATCH] Drop gnulib no-abort.patch + +Originally added in db7337a3d353a817ffe9eb4a3702120527100be9, this +patched out all relevant invocations of abort() in gnulib. While it was +not documented why at the time, testing suggests that there's no abort() +implementation available for gnulib to use. + +gnulib's position is that the use of abort() is correct here, since it +happens when input violates a "shall" from POSIX. Additionally, the +code in question is probably not reachable. Since abort() is more +friendly to user-space, they prefer to make no change, so we can just +carry a define instead. (Suggested by Paul Eggert.) + +Signed-off-by: Robbie Harwood +(cherry picked from commit 5137c8eb3ec11c3217acea1a93a3f88f3fa4cbca) +--- + bootstrap.conf | 2 +- + conf/Makefile.extra-dist | 1 - + config.h.in | 3 +++ + grub-core/lib/gnulib-patches/no-abort.patch | 26 -------------------------- + 4 files changed, 4 insertions(+), 28 deletions(-) + delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch + +diff --git a/bootstrap.conf b/bootstrap.conf +index 645e3a459ce..71ce943c7d4 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -81,7 +81,7 @@ cp -a INSTALL INSTALL.grub + bootstrap_post_import_hook () { + set -e + for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ +- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do ++ fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do + patch -d grub-core/lib/gnulib -p2 \ + < "grub-core/lib/gnulib-patches/$patchname.patch" + done +diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist +index ca6a50deca9..16248ccf032 100644 +--- a/conf/Makefile.extra-dist ++++ b/conf/Makefile.extra-dist +@@ -37,7 +37,6 @@ EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch + EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch + EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch + EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch + + EXTRA_DIST += grub-core/lib/libgcrypt + EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic +diff --git a/config.h.in b/config.h.in +index 9c7b4afaaad..c3134309c63 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -68,6 +68,9 @@ + + # ifndef _GL_INLINE_HEADER_BEGIN + # define _GL_ATTRIBUTE_CONST __attribute__ ((const)) ++ ++/* We don't have an abort() for gnulib to call in regexp. */ ++# define abort __builtin_unreachable + # endif /* !_GL_INLINE_HEADER_BEGIN */ + + #endif +diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch +deleted file mode 100644 +index e469c4762eb..00000000000 +--- a/grub-core/lib/gnulib-patches/no-abort.patch ++++ /dev/null +@@ -1,26 +0,0 @@ +-diff --git a/lib/regcomp.c b/lib/regcomp.c +-index cc85f35ac..de45ebb5c 100644 +---- a/lib/regcomp.c +-+++ b/lib/regcomp.c +-@@ -528,9 +528,9 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf, +- to this routine. If we are given anything else, or if other regex +- code generates an invalid error code, then the program has a bug. +- Dump core so we can fix it. */ +-- abort (); +-- +-- msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); +-+ msg = gettext ("unknown regexp error"); +-+ else +-+ msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); +- +- msg_size = strlen (msg) + 1; /* Includes the null. */ +- +-@@ -1136,7 +1136,7 @@ optimize_utf8 (re_dfa_t *dfa) +- } +- break; +- default: +-- abort (); +-+ break; +- } +- +- if (mb_chars || has_period) diff --git a/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch new file mode 100644 index 00000000..4b5a44c8 --- /dev/null +++ b/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch @@ -0,0 +1,832 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 15 Dec 2021 15:07:50 -0500 +Subject: [PATCH] Update gnulib version and drop most gnulib patches + +In addition to the changes carried in our gnulib patches, several +Coverity and code hygiene fixes that were previously downstream are also +included in this 3-year gnulib increment. + +Unfortunately, fix-width.patch is retained. + +Bump minimum autoconf version from 2.63 to 2.64 and automake from 1.11 +to 1.14, as required by gnulib. + +Sync bootstrap script itself with gnulib. + +Update regexp module for new dynarray dependency. + +Fix various new warnings. + +Signed-off-by: Robbie Harwood +(cherry picked from commit deb18ff931c3133c2aa536a92bd92e50d6615303) +[rharwood: backport around requirements in INSTALL] +--- + configure.ac | 2 +- + grub-core/Makefile.core.def | 3 + + grub-core/disk/luks2.c | 4 +- + grub-core/lib/posix_wrap/limits.h | 6 +- + include/grub/compiler.h | 4 +- + include/grub/list.h | 2 +- + INSTALL | 2 +- + bootstrap | 291 ++++++++++++--------- + bootstrap.conf | 22 +- + conf/Makefile.extra-dist | 6 - + config.h.in | 68 +++++ + grub-core/lib/gnulib-patches/fix-null-deref.patch | 13 - + .../lib/gnulib-patches/fix-null-state-deref.patch | 12 - + .../gnulib-patches/fix-regcomp-uninit-token.patch | 15 -- + .../gnulib-patches/fix-regexec-null-deref.patch | 12 - + .../lib/gnulib-patches/fix-uninit-structure.patch | 11 - + .../lib/gnulib-patches/fix-unused-value.patch | 14 - + 17 files changed, 262 insertions(+), 225 deletions(-) + delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch + delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch + +diff --git a/configure.ac b/configure.ac +index 3527f069ab2..d04c94691ef 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -49,7 +49,7 @@ AC_CANONICAL_TARGET + program_prefix="${save_program_prefix}" + + AM_INIT_AUTOMAKE([1.11]) +-AC_PREREQ(2.63) ++AC_PREREQ(2.64) + AC_CONFIG_SRCDIR([include/grub/dl.h]) + AC_CONFIG_HEADER([config-util.h]) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 6b00eb55575..39233096f29 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -762,6 +762,9 @@ module = { + name = regexp; + common = commands/regexp.c; + common = commands/wildcard.c; ++ common = lib/gnulib/malloc/dynarray_finalize.c; ++ common = lib/gnulib/malloc/dynarray_emplace_enlarge.c; ++ common = lib/gnulib/malloc/dynarray_resize.c; + common = lib/gnulib/regex.c; + cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; +diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c +index 371a53b837d..c917a5f91e7 100644 +--- a/grub-core/disk/luks2.c ++++ b/grub-core/disk/luks2.c +@@ -389,7 +389,7 @@ luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key, + { + grub_uint8_t candidate_digest[GRUB_CRYPTODISK_MAX_KEYLEN]; + grub_uint8_t digest[GRUB_CRYPTODISK_MAX_KEYLEN], salt[GRUB_CRYPTODISK_MAX_KEYLEN]; +- grub_size_t saltlen = sizeof (salt), digestlen = sizeof (digest); ++ idx_t saltlen = sizeof (salt), digestlen = sizeof (digest); + const gcry_md_spec_t *hash; + gcry_err_code_t gcry_ret; + +@@ -428,7 +428,7 @@ luks2_decrypt_key (grub_uint8_t *out_key, + grub_uint8_t area_key[GRUB_CRYPTODISK_MAX_KEYLEN]; + grub_uint8_t salt[GRUB_CRYPTODISK_MAX_KEYLEN]; + grub_uint8_t *split_key = NULL; +- grub_size_t saltlen = sizeof (salt); ++ idx_t saltlen = sizeof (salt); + char cipher[32], *p; + const gcry_md_spec_t *hash; + gcry_err_code_t gcry_ret; +diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h +index 591dbf3289d..4be7b408063 100644 +--- a/grub-core/lib/posix_wrap/limits.h ++++ b/grub-core/lib/posix_wrap/limits.h +@@ -25,7 +25,11 @@ + #define USHRT_MAX GRUB_USHRT_MAX + #define UINT_MAX GRUB_UINT_MAX + #define ULONG_MAX GRUB_ULONG_MAX +-#define SIZE_MAX GRUB_SIZE_MAX ++ ++/* gnulib also defines this type */ ++#ifndef SIZE_MAX ++# define SIZE_MAX GRUB_SIZE_MAX ++#endif + + #define SCHAR_MIN GRUB_SCHAR_MIN + #define SCHAR_MAX GRUB_SCHAR_MAX +diff --git a/include/grub/compiler.h b/include/grub/compiler.h +index ebafec68957..441a9eca07c 100644 +--- a/include/grub/compiler.h ++++ b/include/grub/compiler.h +@@ -30,10 +30,10 @@ + + /* Does this compiler support compile-time error attributes? */ + #if GNUC_PREREQ(4,3) +-# define ATTRIBUTE_ERROR(msg) \ ++# define GRUB_ATTRIBUTE_ERROR(msg) \ + __attribute__ ((__error__ (msg))) + #else +-# define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn)) ++# define GRUB_ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn)) + #endif + + #if GNUC_PREREQ(4,4) +diff --git a/include/grub/list.h b/include/grub/list.h +index b13acb96243..21f4b4b44a1 100644 +--- a/include/grub/list.h ++++ b/include/grub/list.h +@@ -40,7 +40,7 @@ void EXPORT_FUNC(grub_list_remove) (grub_list_t item); + + static inline void * + grub_bad_type_cast_real (int line, const char *file) +- ATTRIBUTE_ERROR ("bad type cast between incompatible grub types"); ++ GRUB_ATTRIBUTE_ERROR ("bad type cast between incompatible grub types"); + + static inline void * + grub_bad_type_cast_real (int line, const char *file) +diff --git a/INSTALL b/INSTALL +index 79a0af7d937..ee9f536f760 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -42,7 +42,7 @@ If you use a development snapshot or want to hack on GRUB you may + need the following. + + * Python 2.6 or later +-* Autoconf 2.63 or later ++* Autoconf 2.64 or later + * Automake 1.11 or later + + Prerequisites for make-check: +diff --git a/bootstrap b/bootstrap +index 5b08e7e2d42..dc2238f4adf 100755 +--- a/bootstrap ++++ b/bootstrap +@@ -1,10 +1,10 @@ + #! /bin/sh + # Print a version string. +-scriptversion=2019-01-04.17; # UTC ++scriptversion=2022-01-26.05; # UTC + + # Bootstrap this package from checked-out sources. + +-# Copyright (C) 2003-2019 Free Software Foundation, Inc. ++# Copyright (C) 2003-2022 Free Software Foundation, Inc. + + # This program is free software: you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +@@ -47,7 +47,7 @@ PERL="${PERL-perl}" + + me=$0 + +-default_gnulib_url=git://git.sv.gnu.org/gnulib ++default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git + + usage() { + cat </dev/null) ++if test -z "$package"; then ++ package=$(sed -n "$extract_package_name" configure.ac) \ ++ || die 'cannot find package name in configure.ac' ++fi + gnulib_name=lib$package + + build_aux=build-aux +@@ -290,6 +313,116 @@ find_tool () + eval "export $find_tool_envvar" + } + ++# Strip blank and comment lines to leave significant entries. ++gitignore_entries() { ++ sed '/^#/d; /^$/d' "$@" ++} ++ ++# If $STR is not already on a line by itself in $FILE, insert it at the start. ++# Entries are inserted at the start of the ignore list to ensure existing ++# entries starting with ! are not overridden. Such entries support ++# whitelisting exceptions after a more generic blacklist pattern. ++insert_if_absent() { ++ file=$1 ++ str=$2 ++ test -f $file || touch $file ++ test -r $file || die "Error: failed to read ignore file: $file" ++ duplicate_entries=$(gitignore_entries $file | sort | uniq -d) ++ if [ "$duplicate_entries" ] ; then ++ die "Error: Duplicate entries in $file: " $duplicate_entries ++ fi ++ linesold=$(gitignore_entries $file | wc -l) ++ linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) ++ if [ $linesold != $linesnew ] ; then ++ { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ ++ || die "insert_if_absent $file $str: failed" ++ fi ++} ++ ++# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with ++# insert_if_absent. ++insert_vc_ignore() { ++ vc_ignore_file="$1" ++ pattern="$2" ++ case $vc_ignore_file in ++ *.gitignore) ++ # A .gitignore entry that does not start with '/' applies ++ # recursively to subdirectories, so prepend '/' to every ++ # .gitignore entry. ++ pattern=$(echo "$pattern" | sed s,^,/,);; ++ esac ++ insert_if_absent "$vc_ignore_file" "$pattern" ++} ++ ++symlink_to_dir() ++{ ++ src=$1/$2 ++ dst=${3-$2} ++ ++ test -f "$src" && { ++ ++ # If the destination directory doesn't exist, create it. ++ # This is required at least for "lib/uniwidth/cjk.h". ++ dst_dir=$(dirname "$dst") ++ if ! test -d "$dst_dir"; then ++ mkdir -p "$dst_dir" ++ ++ # If we've just created a directory like lib/uniwidth, ++ # tell version control system(s) it's ignorable. ++ # FIXME: for now, this does only one level ++ parent=$(dirname "$dst_dir") ++ for dot_ig in x $vc_ignore; do ++ test $dot_ig = x && continue ++ ig=$parent/$dot_ig ++ insert_vc_ignore $ig "${dst_dir##*/}" ++ done ++ fi ++ ++ if $copy; then ++ { ++ test ! -h "$dst" || { ++ echo "$me: rm -f $dst" && ++ rm -f "$dst" ++ } ++ } && ++ test -f "$dst" && ++ cmp -s "$src" "$dst" || { ++ echo "$me: cp -fp $src $dst" && ++ cp -fp "$src" "$dst" ++ } ++ else ++ # Leave any existing symlink alone, if it already points to the source, ++ # so that broken build tools that care about symlink times ++ # aren't confused into doing unnecessary builds. Conversely, if the ++ # existing symlink's timestamp is older than the source, make it afresh, ++ # so that broken tools aren't confused into skipping needed builds. See ++ # . ++ test -h "$dst" && ++ src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && ++ dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && ++ test "$src_i" = "$dst_i" && ++ both_ls=$(ls -dt "$src" "$dst") && ++ test "X$both_ls" = "X$dst$nl$src" || { ++ dot_dots= ++ case $src in ++ /*) ;; ++ *) ++ case /$dst/ in ++ *//* | */../* | */./* | /*/*/*/*/*/) ++ die "invalid symlink calculation: $src -> $dst";; ++ /*/*/*/*/) dot_dots=../../../;; ++ /*/*/*/) dot_dots=../../;; ++ /*/*/) dot_dots=../;; ++ esac;; ++ esac ++ ++ echo "$me: ln -fs $dot_dots$src $dst" && ++ ln -fs "$dot_dots$src" "$dst" ++ } ++ fi ++ } ++} ++ + # Override the default configuration, if necessary. + # Make sure that bootstrap.conf is sourced from the current directory + # if we were invoked as "sh bootstrap". +@@ -320,6 +453,12 @@ do + --help) + usage + exit;; ++ --version) ++ set -e ++ echo "bootstrap $scriptversion" ++ echo "$copyright" ++ exit 0 ++ ;; + --gnulib-srcdir=*) + GNULIB_SRCDIR=${option#--gnulib-srcdir=};; + --skip-po) +@@ -335,7 +474,7 @@ do + --no-git) + use_git=false;; + *) +- die "$option: unknown option";; ++ bootstrap_option_hook $option || die "$option: unknown option";; + esac + done + +@@ -346,47 +485,6 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then + die "Bootstrapping from a non-checked-out distribution is risky." + fi + +-# Strip blank and comment lines to leave significant entries. +-gitignore_entries() { +- sed '/^#/d; /^$/d' "$@" +-} +- +-# If $STR is not already on a line by itself in $FILE, insert it at the start. +-# Entries are inserted at the start of the ignore list to ensure existing +-# entries starting with ! are not overridden. Such entries support +-# whitelisting exceptions after a more generic blacklist pattern. +-insert_if_absent() { +- file=$1 +- str=$2 +- test -f $file || touch $file +- test -r $file || die "Error: failed to read ignore file: $file" +- duplicate_entries=$(gitignore_entries $file | sort | uniq -d) +- if [ "$duplicate_entries" ] ; then +- die "Error: Duplicate entries in $file: " $duplicate_entries +- fi +- linesold=$(gitignore_entries $file | wc -l) +- linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) +- if [ $linesold != $linesnew ] ; then +- { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ +- || die "insert_if_absent $file $str: failed" +- fi +-} +- +-# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with +-# insert_if_absent. +-insert_vc_ignore() { +- vc_ignore_file="$1" +- pattern="$2" +- case $vc_ignore_file in +- *.gitignore) +- # A .gitignore entry that does not start with '/' applies +- # recursively to subdirectories, so prepend '/' to every +- # .gitignore entry. +- pattern=$(echo "$pattern" | sed s,^,/,);; +- esac +- insert_if_absent "$vc_ignore_file" "$pattern" +-} +- + # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. + found_aux_dir=no + grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ +@@ -665,9 +763,25 @@ if $use_gnulib; then + shallow= + if test -z "$GNULIB_REVISION"; then + git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' ++ git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ ++ || cleanup_gnulib ++ else ++ git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' ++ mkdir -p "$gnulib_path" ++ # Only want a shallow checkout of $GNULIB_REVISION, but git does not ++ # support cloning by commit hash. So attempt a shallow fetch by commit ++ # hash to minimize the amount of data downloaded and changes needed to ++ # be processed, which can drastically reduce download and processing ++ # time for checkout. If the fetch by commit fails, a shallow fetch can ++ # not be performed because we do not know what the depth of the commit ++ # is without fetching all commits. So fallback to fetching all commits. ++ git -C "$gnulib_path" init ++ git -C "$gnulib_path" remote add origin ${GNULIB_URL:-$default_gnulib_url} ++ git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \ ++ || git -C "$gnulib_path" fetch origin \ ++ || cleanup_gnulib ++ git -C "$gnulib_path" reset --hard FETCH_HEAD + fi +- git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ +- || cleanup_gnulib + + trap - 1 2 13 15 + fi +@@ -784,75 +898,6 @@ case $SKIP_PO in + fi;; + esac + +-symlink_to_dir() +-{ +- src=$1/$2 +- dst=${3-$2} +- +- test -f "$src" && { +- +- # If the destination directory doesn't exist, create it. +- # This is required at least for "lib/uniwidth/cjk.h". +- dst_dir=$(dirname "$dst") +- if ! test -d "$dst_dir"; then +- mkdir -p "$dst_dir" +- +- # If we've just created a directory like lib/uniwidth, +- # tell version control system(s) it's ignorable. +- # FIXME: for now, this does only one level +- parent=$(dirname "$dst_dir") +- for dot_ig in x $vc_ignore; do +- test $dot_ig = x && continue +- ig=$parent/$dot_ig +- insert_vc_ignore $ig "${dst_dir##*/}" +- done +- fi +- +- if $copy; then +- { +- test ! -h "$dst" || { +- echo "$me: rm -f $dst" && +- rm -f "$dst" +- } +- } && +- test -f "$dst" && +- cmp -s "$src" "$dst" || { +- echo "$me: cp -fp $src $dst" && +- cp -fp "$src" "$dst" +- } +- else +- # Leave any existing symlink alone, if it already points to the source, +- # so that broken build tools that care about symlink times +- # aren't confused into doing unnecessary builds. Conversely, if the +- # existing symlink's timestamp is older than the source, make it afresh, +- # so that broken tools aren't confused into skipping needed builds. See +- # . +- test -h "$dst" && +- src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && +- dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && +- test "$src_i" = "$dst_i" && +- both_ls=$(ls -dt "$src" "$dst") && +- test "X$both_ls" = "X$dst$nl$src" || { +- dot_dots= +- case $src in +- /*) ;; +- *) +- case /$dst/ in +- *//* | */../* | */./* | /*/*/*/*/*/) +- die "invalid symlink calculation: $src -> $dst";; +- /*/*/*/*/) dot_dots=../../../;; +- /*/*/*/) dot_dots=../../;; +- /*/*/) dot_dots=../;; +- esac;; +- esac +- +- echo "$me: ln -fs $dot_dots$src $dst" && +- ln -fs "$dot_dots$src" "$dst" +- } +- fi +- } +-} +- + version_controlled_file() { + parent=$1 + file=$2 +@@ -970,7 +1015,7 @@ bootstrap_post_import_hook \ + # Uninitialized submodules are listed with an initial dash. + if $use_git && git submodule | grep '^-' >/dev/null; then + die "some git submodules are not initialized. " \ +- "Run 'git submodule init' and bootstrap again." ++ "Run 'git submodule update --init' and bootstrap again." + fi + + # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some +@@ -1064,7 +1109,7 @@ bootstrap_epilogue + + echo "$0: done. Now you can run './configure'." + +-# Local variables: ++# Local Variables: + # eval: (add-hook 'before-save-hook 'time-stamp) + # time-stamp-start: "scriptversion=" + # time-stamp-format: "%:y-%02m-%02d.%02H" +diff --git a/bootstrap.conf b/bootstrap.conf +index 71ce943c7d4..e4e5f3750ad 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -1,6 +1,6 @@ + # Bootstrap configuration. + +-# Copyright (C) 2006-2019 Free Software Foundation, Inc. ++# Copyright (C) 2006-2022 Free Software Foundation, Inc. + + # This program is free software: you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +@@ -16,11 +16,10 @@ + # along with this program. If not, see . + + +-GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 ++GNULIB_REVISION=9f48fb992a3d7e96610c4ce8be969cff2d61a01b + + # gnulib modules used by this package. +-# mbswidth is used by gnulib-fix-width.diff's changes to argp rather than +-# directly. ++# mbswidth is used by fix-width.diff's changes to argp rather than directly. + gnulib_modules=" + argp + base64 +@@ -67,8 +66,8 @@ SKIP_PO=t + + # Build prerequisites + buildreq="\ +-autoconf 2.63 +-automake 1.11 ++autoconf 2.64 ++automake 1.14 + gettext 0.18.3 + git 1.5.5 + tar - +@@ -80,11 +79,12 @@ cp -a INSTALL INSTALL.grub + + bootstrap_post_import_hook () { + set -e +- for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ +- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do +- patch -d grub-core/lib/gnulib -p2 \ +- < "grub-core/lib/gnulib-patches/$patchname.patch" +- done ++ ++ # Instead of patching our gnulib and therefore maintaining a fork, submit ++ # changes to gnulib and update the hash above when they've merged. Do not ++ # add new patches here. ++ patch -d grub-core/lib/gnulib -p2 < grub-core/lib/gnulib-patches/fix-width.patch ++ + for patchname in \ + 0001-Support-POTFILES-shell \ + 0002-Handle-gettext_printf-shell-function \ +diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist +index 16248ccf032..5b9fda752b6 100644 +--- a/conf/Makefile.extra-dist ++++ b/conf/Makefile.extra-dist +@@ -30,12 +30,6 @@ EXTRA_DIST += grub-core/gensymlist.sh + EXTRA_DIST += grub-core/genemuinit.sh + EXTRA_DIST += grub-core/genemuinitheader.sh + +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch +-EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch + EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch + + EXTRA_DIST += grub-core/lib/libgcrypt +diff --git a/config.h.in b/config.h.in +index c3134309c63..512d1bbe138 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -67,10 +67,78 @@ + # define _GNU_SOURCE 1 + + # ifndef _GL_INLINE_HEADER_BEGIN ++/* gnulib gets configured against the host, not the target, and the rest of ++ * our buildsystem works around that. This is difficult to avoid as gnulib's ++ * detection requires a more capable system than our target. Instead, we ++ * reach in and set values appropriately - intentionally setting more than the ++ * bare minimum. If, when updating gnulib, something breaks, there's probably ++ * a change needed here or in grub-core/Makefile.core.def. */ ++# define SIZE_MAX ((size_t) -1) ++# define _GL_ATTRIBUTE_ALLOC_SIZE(args) \ ++ __attribute__ ((__alloc_size__ args)) ++# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) ++# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) ++# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) + # define _GL_ATTRIBUTE_CONST __attribute__ ((const)) ++# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute ((__malloc__ (f, i))) ++# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) ++# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) ++# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) ++# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE \ ++ __attribute__ ((externally_visible)) ++# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) ++# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) ++# define _GL_ATTRIBUTE_MALLOC __attribute__ ((malloc)) ++# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED ++# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) ++# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) ++# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) ++# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) ++# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) ++# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) ++# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) ++# define _GL_ATTRIBUTE_RETURNS_NONNULL \ ++ __attribute__ ((__returns_nonnull__)) ++# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) ++# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) ++# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) ++# define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) ++# define _GL_GNUC_PREREQ GNUC_PREREQ ++# define _GL_INLINE inline ++# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED ++ ++/* We can't use __has_attribute for these because gcc-5.1 is too old for ++ * that. Everything above is present in that version, though. */ ++# if __GNUC__ >= 7 ++# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((fallthrough)) ++# else ++# define _GL_ATTRIBUTE_FALLTHROUGH /* empty */ ++# endif ++ ++# ifndef ASM_FILE ++typedef __INT_FAST32_TYPE__ int_fast32_t; ++typedef __UINT_FAST32_TYPE__ uint_fast32_t; ++# endif ++ ++/* Ensure ialloc nests static/non-static inline properly. */ ++# define IALLOC_INLINE static inline ++ ++/* gnulib uses these for blocking out warnings they can't/won't fix. gnulib ++ * also makes the decision about whether to provide a declaration for ++ * reallocarray() at compile-time, so this is a convenient place to override - ++ * it's used by the ialloc module, which is used by base64. */ ++# define _GL_INLINE_HEADER_BEGIN _Pragma ("GCC diagnostic push") \ ++ void * \ ++ reallocarray (void *ptr, unsigned int nmemb, unsigned int size); ++# define _GL_INLINE_HEADER_END _Pragma ("GCC diagnostic pop") + + /* We don't have an abort() for gnulib to call in regexp. */ + # define abort __builtin_unreachable + # endif /* !_GL_INLINE_HEADER_BEGIN */ + ++/* gnulib doesn't build cleanly with older compilers. */ ++# if __GNUC__ < 11 ++_Pragma ("GCC diagnostic ignored \"-Wtype-limits\"") ++# endif ++ + #endif +diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch +deleted file mode 100644 +index 8fafa153a47..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-null-deref.patch ++++ /dev/null +@@ -1,13 +0,0 @@ +-diff --git a/lib/argp-parse.c b/lib/argp-parse.c +-index 6dec57310..900adad54 100644 +---- a/lib/argp-parse.c +-+++ b/lib/argp-parse.c +-@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse) +- void * +- __argp_input (const struct argp *argp, const struct argp_state *state) +- { +-- if (state) +-+ if (state && state->pstate) +- { +- struct group *group; +- struct parser *parser = state->pstate; +diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch +deleted file mode 100644 +index 813ec09c8a1..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch ++++ /dev/null +@@ -1,12 +0,0 @@ +---- a/lib/argp-help.c 2020-10-28 14:32:19.189215988 +0000 +-+++ b/lib/argp-help.c 2020-10-28 14:38:21.204673940 +0000 +-@@ -145,7 +145,8 @@ +- if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin) +- { +- __argp_failure (state, 0, 0, +-- dgettext (state->root_argp->argp_domain, +-+ dgettext (state == NULL ? NULL +-+ : state->root_argp->argp_domain, +- "\ +- ARGP_HELP_FMT: %s value is less than or equal to %s"), +- "rmargin", up->name); +diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch +deleted file mode 100644 +index 02e06315dff..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch ++++ /dev/null +@@ -1,15 +0,0 @@ +---- a/lib/regcomp.c 2020-11-24 17:06:08.159223858 +0000 +-+++ b/lib/regcomp.c 2020-11-24 17:06:15.630253923 +0000 +-@@ -3808,11 +3808,7 @@ +- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, +- re_token_type_t type) +- { +-- re_token_t t; +--#if defined GCC_LINT || defined lint +-- memset (&t, 0, sizeof t); +--#endif +-- t.type = type; +-+ re_token_t t = { .type = type }; +- return create_token_tree (dfa, left, right, &t); +- } +- +diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch +deleted file mode 100644 +index db6dac9c9e3..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch ++++ /dev/null +@@ -1,12 +0,0 @@ +---- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 +-+++ b/lib/regexec.c 2020-11-05 10:55:09.621542984 +0000 +-@@ -1692,6 +1692,9 @@ +- { +- Idx top = mctx->state_log_top; +- +-+ if (mctx->state_log == NULL) +-+ return REG_NOERROR; +-+ +- if ((next_state_log_idx >= mctx->input.bufs_len +- && mctx->input.bufs_len < mctx->input.len) +- || (next_state_log_idx >= mctx->input.valid_len +diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch +deleted file mode 100644 +index 7b4d9f67af4..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch ++++ /dev/null +@@ -1,11 +0,0 @@ +---- a/lib/regcomp.c 2020-10-22 13:49:06.770168928 +0000 +-+++ b/lib/regcomp.c 2020-10-22 13:50:37.026528298 +0000 +-@@ -3662,7 +3662,7 @@ +- Idx alloc = 0; +- #endif /* not RE_ENABLE_I18N */ +- reg_errcode_t ret; +-- re_token_t br_token; +-+ re_token_t br_token = {0}; +- bin_tree_t *tree; +- +- sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); +diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch +deleted file mode 100644 +index ba51f1bf223..00000000000 +--- a/grub-core/lib/gnulib-patches/fix-unused-value.patch ++++ /dev/null +@@ -1,14 +0,0 @@ +---- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 +-+++ b/lib/regexec.c 2020-10-21 14:32:07.961765604 +0000 +-@@ -828,7 +828,11 @@ +- break; +- if (__glibc_unlikely (err != REG_NOMATCH)) +- goto free_return; +-+#ifdef DEBUG +-+ /* Only used for assertion below when DEBUG is set, otherwise +-+ it will be over-written when we loop around. */ +- match_last = -1; +-+#endif +- } +- else +- break; /* We found a match. */ diff --git a/do-rebase b/do-rebase index 1f9b21c2..685cef68 100755 --- a/do-rebase +++ b/do-rebase @@ -155,21 +155,7 @@ fi unset LC_ALL git rm -q 0*.patch -# No need for this patch anymore, the package is rebased on latest release now. -#> release-to-master.patch -#othergit diff --full-index --binary $diff_ops grub-2.04..refs/remotes/rhboot/master > release-to-master.patch -#git add release-to-master.patch - fedpkg sources -curl -L https://github.com/rhboot/gnulib/archive/fixes.tar.gz > gnulib-fixes.tar.gz.new -if cmp -s gnulib-fixes.tar.gz gnulib-fixes.tar.gz.new; then - rm gnulib-fixes.tar.gz.new -else - mv gnulib-fixes.tar.gz.new gnulib-fixes.tar.gz - sed -i -e '/gnulib-/d' sources - fedpkg upload gnulib-fixes.tar.gz - git add sources -fi > grub.patches patches=$(formatpatch refs/remotes/rhboot/master..refs/remotes/rhboot/${releasever}) diff --git a/grub.macros b/grub.macros index 03436267..a198b177 100644 --- a/grub.macros +++ b/grub.macros @@ -9,11 +9,14 @@ %global _configure ../configure %if %{?_with_ccache: 1}%{?!_with_ccache: 0} -%global cc_equals CC=/usr/%{_lib}/ccache/gcc +%global ccpath /usr/%{_lib}/ccache/gcc %else -%global cc_equals %{nil} +%global ccpath %{__cc} %endif +# gnulib actively ignores CFLAGS because it's terrible +%global cc_equals "CC=%{ccpath} -fPIE" + %global cflags_sed \\\ sed \\\ -e 's/-O. //g' \\\ @@ -330,9 +333,8 @@ git config gc.auto 0 \ rm -f configure \ git add . \ git commit -a -q -m "%{tarversion} baseline." \ -#git apply --index --whitespace=nowarn %{SOURCE3} \ -#git commit -a -q -m "%{tarversion} master." \ git am --whitespace=nowarn %%{patches} - 2.06-16 +- Suffer through updating gnulib + * Thu Jan 20 2022 Robbie Harwood - 2.06-15 - Skip machine ID check when updating BLS From 1c4e61c9899955a130655e40f01e6eef0fd7e9e9 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 24 Feb 2022 13:35:00 -0500 Subject: [PATCH 099/294] Don't forget the sources file Signed-off-by: Robbie Harwood --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 9a24a530..5f2ba311 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ SHA512 (unifont-13.0.06.pcf.gz) = 25f1ea4e316cd77b65cf4f60aa10ed054db6df2195be7344216673dee6628ab055ebcdeea186996d931fd1e9e4f519f4a2e4b4544b8a9ad2fe410aadc4eecd2d SHA512 (theme.tar.bz2) = 0f6f914d5f801509403094b28b8cfe5169cb56ae9bdd808ae21a6780a8236b434161a068351508dd78729c25ee2fed066c124c1eef9e15102750b409b4576a5c SHA512 (grub-2.06.tar.xz) = 4f11c648f3078567e53fc0c74d5026fdc6da4be27d188975e79d9a4df817ade0fe5ad2ddd694238a07edc45adfa02943d83c57767dd51548102b375e529e8efe -SHA512 (gnulib-fixes.tar.gz) = 7aa933812de10f54196c7ed02079d7edeb92672a528baf83201ca4c62aa3e6b119f61c45469d2c4623c4efc5d4a08d20b029403f1f2c6e35fb7cb15789ff54b2 +SHA512 (gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz) = 6887dede2d4a403422ea045329ee9bd7ca4c1561bcaf39e805e1d1ce8f4c050a65ce286e7d8362fb8e815b5fab0b405730a3f93194e343e2aedcf9b4411a285e From 9c910dfa10b136439ceb019b78d242d54f19771d Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 24 Feb 2022 20:10:21 +0000 Subject: [PATCH 100/294] Fix appending signature support commit (thanks: pjones) Signed-off-by: Robbie Harwood --- ...igning-grub-with-an-appended-signatu.patch | 24 ++++++++++--------- ...-support-embedding-x509-certificates.patch | 4 ++-- grub2.spec | 5 +++- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch index caab8d58..ef644149 100644 --- a/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch +++ b/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -43,16 +43,16 @@ that verifies these signatures. You can find one at: I will be proposing this for inclusion in a future Power Architecture Platform Reference (PAPR). --- - util/grub-install-common.c | 18 ++++++++++++++++-- + util/grub-install-common.c | 18 ++++++++++++++---- util/grub-mkimage.c | 15 +++++++++++++-- util/grub-mkimagexx.c | 39 ++++++++++++++++++++++++++++++++++++++- util/mkimage.c | 13 +++++++------ include/grub/util/install.h | 8 ++++++-- include/grub/util/mkimage.h | 4 ++-- - 6 files changed, 82 insertions(+), 15 deletions(-) + 6 files changed, 80 insertions(+), 17 deletions(-) diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 4e212e690c5..aab2a941f85 100644 +index 4e212e690c5..a74fee16e22 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -461,10 +461,12 @@ static size_t npubkeys; @@ -81,22 +81,24 @@ index 4e212e690c5..aab2a941f85 100644 default: return 0; } -@@ -665,7 +673,13 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -661,11 +669,13 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + " --output '%s' " + " --dtb '%s' " + "--sbat '%s' " +- "--format '%s' --compression '%s' %s %s %s\n", ++ "--format '%s' --compression '%s' " ++ "--appended-signature-size %zu %s %s %s\n", dir, prefix, outname, dtb ? : "", sbat ? : "", mkimage_target, - compnames[compression], note ? "--note" : "", +- compnames[compression], note ? "--note" : "", - disable_shim_lock ? "--disable-shim-lock" : "", s); -+ disable_shim_lock ? "--disable-shim-lock" : "", -+ "--format '%s' --compression '%s' " -+ "--appended-signature-size %zu %s %s\n", -+ dir, prefix, -+ outname, dtb ? : "", mkimage_target, + compnames[compression], appsig_size, ++ disable_shim_lock ? "--disable-shim-lock" : "", + note ? "--note" : "", s); free (s); tgt = grub_install_get_image_target (mkimage_target); -@@ -675,7 +689,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -675,7 +685,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, pubkeys, npubkeys, config_path, tgt, diff --git a/0172-grub-install-support-embedding-x509-certificates.patch b/0172-grub-install-support-embedding-x509-certificates.patch index bd02e6de..136d2165 100644 --- a/0172-grub-install-support-embedding-x509-certificates.patch +++ b/0172-grub-install-support-embedding-x509-certificates.patch @@ -33,7 +33,7 @@ index 355a43844ac..b81ac0ae46c 100644 pseudo_file.fs = &pseudo_fs; diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index aab2a941f85..422f82362c7 100644 +index a74fee16e22..2d9693ffeb7 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -460,6 +460,8 @@ static char **pubkeys; @@ -82,7 +82,7 @@ index aab2a941f85..422f82362c7 100644 for (md = modules.entries; *md; md++) { *p++ = '\''; -@@ -688,7 +706,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -684,7 +702,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, diff --git a/grub2.spec b/grub2.spec index 8635342e..a7f8cb39 100644 --- a/grub2.spec +++ b/grub2.spec @@ -16,7 +16,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 16%{?dist} +Release: 17%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -525,6 +525,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Feb 24 2022 Robbie Harwood - 2.06-17 +- Fix appended signature support commit (thanks: pjones) + * Thu Feb 24 2022 Robbie Harwood - 2.06-16 - Suffer through updating gnulib From e82a4fd034f2e25952513e4363541a6c80aaf632 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 24 Feb 2022 22:03:20 +0000 Subject: [PATCH 101/294] Add efidisk/connectefi patches Signed-off-by: Robbie Harwood --- ...-stopping-iteration-when-no-floppy-i.patch | 29 ++ ...w-efidisk-only-option-on-EFI-systems.patch | 166 ++++++++ 0212-efi-new-connectefi-command.patch | 394 ++++++++++++++++++ grub.patches | 3 + grub2.spec | 5 +- 5 files changed, 596 insertions(+), 1 deletion(-) create mode 100644 0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch create mode 100644 0211-search-new-efidisk-only-option-on-EFI-systems.patch create mode 100644 0212-efi-new-connectefi-command.patch diff --git a/0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch b/0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch new file mode 100644 index 00000000..656f2291 --- /dev/null +++ b/0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Tue, 8 Feb 2022 08:39:10 +0100 +Subject: [PATCH] search: fixed bug stopping iteration when --no-floppy is used +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When using --no-floppy and a floppy was encountered, iterate_device() +was returning 1, causing the iteration to stop instead of continuing. + +Signed-off-by: Renaud Métrich +--- + grub-core/commands/search.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index ed090b3af8b..51656e361cc 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -64,7 +64,7 @@ iterate_device (const char *name, void *data) + /* Skip floppy drives when requested. */ + if (ctx->no_floppy && + name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9') +- return 1; ++ return 0; + + #ifdef DO_SEARCH_FS_UUID + #define compare_fn grub_strcasecmp diff --git a/0211-search-new-efidisk-only-option-on-EFI-systems.patch b/0211-search-new-efidisk-only-option-on-EFI-systems.patch new file mode 100644 index 00000000..74b35227 --- /dev/null +++ b/0211-search-new-efidisk-only-option-on-EFI-systems.patch @@ -0,0 +1,166 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Tue, 8 Feb 2022 08:39:11 +0100 +Subject: [PATCH] search: new --efidisk-only option on EFI systems +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When using 'search' on EFI systems, we sometimes want to exclude devices +that are not EFI disks (e.g. md, lvm). +This is typically used when wanting to chainload when having a software +raid (md) for EFI partition: +with no option, 'search --file /EFI/redhat/shimx64.efi' sets root envvar +to 'md/boot_efi' which cannot be used for chainloading since there is no +effective EFI device behind. + +This commit also refactors handling of --no-floppy option. + +Signed-off-by: Renaud Métrich +--- + grub-core/commands/search.c | 27 +++++++++++++++++++++++---- + grub-core/commands/search_wrap.c | 18 ++++++++++++------ + include/grub/search.h | 15 ++++++++++++--- + 3 files changed, 47 insertions(+), 13 deletions(-) + +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index 51656e361cc..57d26ced8a8 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -47,7 +47,7 @@ struct search_ctx + { + const char *key; + const char *var; +- int no_floppy; ++ enum search_flags flags; + char **hints; + unsigned nhints; + int count; +@@ -62,10 +62,29 @@ iterate_device (const char *name, void *data) + int found = 0; + + /* Skip floppy drives when requested. */ +- if (ctx->no_floppy && ++ if (ctx->flags & SEARCH_FLAGS_NO_FLOPPY && + name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9') + return 0; + ++ /* Limit to EFI disks when requested. */ ++ if (ctx->flags & SEARCH_FLAGS_EFIDISK_ONLY) ++ { ++ grub_device_t dev; ++ dev = grub_device_open (name); ++ if (! dev) ++ { ++ grub_errno = GRUB_ERR_NONE; ++ return 0; ++ } ++ if (! dev->disk || dev->disk->dev->id != GRUB_DISK_DEVICE_EFIDISK_ID) ++ { ++ grub_device_close (dev); ++ grub_errno = GRUB_ERR_NONE; ++ return 0; ++ } ++ grub_device_close (dev); ++ } ++ + #ifdef DO_SEARCH_FS_UUID + #define compare_fn grub_strcasecmp + #else +@@ -261,13 +280,13 @@ try (struct search_ctx *ctx) + } + + void +-FUNC_NAME (const char *key, const char *var, int no_floppy, ++FUNC_NAME (const char *key, const char *var, enum search_flags flags, + char **hints, unsigned nhints) + { + struct search_ctx ctx = { + .key = key, + .var = var, +- .no_floppy = no_floppy, ++ .flags = flags, + .hints = hints, + .nhints = nhints, + .count = 0, +diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c +index 47fc8eb9966..464e6ebb1c8 100644 +--- a/grub-core/commands/search_wrap.c ++++ b/grub-core/commands/search_wrap.c +@@ -40,6 +40,7 @@ static const struct grub_arg_option options[] = + N_("Set a variable to the first device found."), N_("VARNAME"), + ARG_TYPE_STRING}, + {"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0}, ++ {"efidisk-only", 0, 0, N_("Only probe EFI disks."), 0, 0}, + {"hint", 'h', GRUB_ARG_OPTION_REPEATABLE, + N_("First try the device HINT. If HINT ends in comma, " + "also try subpartitions"), N_("HINT"), ARG_TYPE_STRING}, +@@ -73,6 +74,7 @@ enum options + SEARCH_FS_UUID, + SEARCH_SET, + SEARCH_NO_FLOPPY, ++ SEARCH_EFIDISK_ONLY, + SEARCH_HINT, + SEARCH_HINT_IEEE1275, + SEARCH_HINT_BIOS, +@@ -89,6 +91,7 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) + const char *id = 0; + int i = 0, j = 0, nhints = 0; + char **hints = NULL; ++ enum search_flags flags; + + if (state[SEARCH_HINT].set) + for (i = 0; state[SEARCH_HINT].args[i]; i++) +@@ -180,15 +183,18 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) + goto out; + } + ++ if (state[SEARCH_NO_FLOPPY].set) ++ flags |= SEARCH_FLAGS_NO_FLOPPY; ++ ++ if (state[SEARCH_EFIDISK_ONLY].set) ++ flags |= SEARCH_FLAGS_EFIDISK_ONLY; ++ + if (state[SEARCH_LABEL].set) +- grub_search_label (id, var, state[SEARCH_NO_FLOPPY].set, +- hints, nhints); ++ grub_search_label (id, var, flags, hints, nhints); + else if (state[SEARCH_FS_UUID].set) +- grub_search_fs_uuid (id, var, state[SEARCH_NO_FLOPPY].set, +- hints, nhints); ++ grub_search_fs_uuid (id, var, flags, hints, nhints); + else if (state[SEARCH_FILE].set) +- grub_search_fs_file (id, var, state[SEARCH_NO_FLOPPY].set, +- hints, nhints); ++ grub_search_fs_file (id, var, flags, hints, nhints); + else + grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type"); + +diff --git a/include/grub/search.h b/include/grub/search.h +index d80347df34b..4190aeb2cbf 100644 +--- a/include/grub/search.h ++++ b/include/grub/search.h +@@ -19,11 +19,20 @@ + #ifndef GRUB_SEARCH_HEADER + #define GRUB_SEARCH_HEADER 1 + +-void grub_search_fs_file (const char *key, const char *var, int no_floppy, ++enum search_flags ++ { ++ SEARCH_FLAGS_NO_FLOPPY = 1, ++ SEARCH_FLAGS_EFIDISK_ONLY = 2 ++ }; ++ ++void grub_search_fs_file (const char *key, const char *var, ++ enum search_flags flags, + char **hints, unsigned nhints); +-void grub_search_fs_uuid (const char *key, const char *var, int no_floppy, ++void grub_search_fs_uuid (const char *key, const char *var, ++ enum search_flags flags, + char **hints, unsigned nhints); +-void grub_search_label (const char *key, const char *var, int no_floppy, ++void grub_search_label (const char *key, const char *var, ++ enum search_flags flags, + char **hints, unsigned nhints); + + #endif diff --git a/0212-efi-new-connectefi-command.patch b/0212-efi-new-connectefi-command.patch new file mode 100644 index 00000000..e5aba51e --- /dev/null +++ b/0212-efi-new-connectefi-command.patch @@ -0,0 +1,394 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Tue, 15 Feb 2022 14:05:22 +0100 +Subject: [PATCH] efi: new 'connectefi' command +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When efi.quickboot is enabled on VMWare (which is the default for +hardware release 16 and later), it may happen that not all EFI devices +are connected. Due to this, browsing the devices in make_devices() just +fails to find devices, in particular disks or partitions for a given +disk. +This typically happens when network booting, then trying to chainload to +local disk (this is used in deployment tools such as Red Hat Satellite), +which is done through using the following grub.cfg snippet: +-------- 8< ---------------- 8< ---------------- 8< -------- +unset prefix +search --file --set=prefix /EFI/redhat/grubx64.efi +if [ -n "$prefix" ]; then + chainloader ($prefix)/EFI/redhat/grubx64/efi +... +-------- 8< ---------------- 8< ---------------- 8< -------- + +With efi.quickboot, none of the devices are connected, causing "search" +to fail. Sometimes devices are connected but not the partition of the +disk matching $prefix, causing partition to not be found by +"chainloader". + +This patch introduces a new "connectefi pciroot|scsi" command which +recursively connects all EFI devices starting from a given controller +type: +- if 'pciroot' is specified, recursion is performed for all PCI root + handles +- if 'scsi' is specified, recursion is performed for all SCSI I/O + handles (recommended usage to avoid connecting unwanted handles which + may impact Grub performances) + +Typical grub.cfg snippet would then be: +-------- 8< ---------------- 8< ---------------- 8< -------- +connectefi scsi +unset prefix +search --file --set=prefix /EFI/redhat/grubx64.efi +if [ -n "$prefix" ]; then + chainloader ($prefix)/EFI/redhat/grubx64/efi +... +-------- 8< ---------------- 8< ---------------- 8< -------- + +The code is easily extensible to handle other arguments in the future if +needed. + +Signed-off-by: Renaud Métrich +--- + grub-core/Makefile.core.def | 6 ++ + grub-core/commands/efi/connectefi.c | 205 ++++++++++++++++++++++++++++++++++++ + grub-core/commands/efi/lsefi.c | 1 + + grub-core/disk/efi/efidisk.c | 13 +++ + grub-core/kern/efi/efi.c | 13 +++ + include/grub/efi/disk.h | 2 + + include/grub/efi/efi.h | 5 + + NEWS | 2 +- + 8 files changed, 246 insertions(+), 1 deletion(-) + create mode 100644 grub-core/commands/efi/connectefi.c + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 39233096f29..3c0ac3b7bd0 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -836,6 +836,12 @@ module = { + enable = efi; + }; + ++module = { ++ name = connectefi; ++ common = commands/efi/connectefi.c; ++ enable = efi; ++}; ++ + module = { + name = blocklist; + common = commands/blocklist.c; +diff --git a/grub-core/commands/efi/connectefi.c b/grub-core/commands/efi/connectefi.c +new file mode 100644 +index 00000000000..8ab75bd51be +--- /dev/null ++++ b/grub-core/commands/efi/connectefi.c +@@ -0,0 +1,205 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2022 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++typedef struct handle_list ++{ ++ grub_efi_handle_t handle; ++ struct handle_list *next; ++} handle_list_t; ++ ++static handle_list_t *already_handled = NULL; ++ ++static grub_err_t ++add_handle (grub_efi_handle_t handle) ++{ ++ handle_list_t *e; ++ e = grub_malloc (sizeof (*e)); ++ if (! e) ++ return grub_errno; ++ e->handle = handle; ++ e->next = already_handled; ++ already_handled = e; ++ return GRUB_ERR_NONE; ++} ++ ++static int ++is_in_list (grub_efi_handle_t handle) ++{ ++ handle_list_t *e; ++ for (e = already_handled; e != NULL; e = e->next) ++ if (e->handle == handle) ++ return 1; ++ return 0; ++} ++ ++static void ++free_handle_list (void) ++{ ++ handle_list_t *e; ++ while ((e = already_handled) != NULL) ++ { ++ already_handled = already_handled->next; ++ grub_free (e); ++ } ++} ++ ++typedef enum searched_item_flag ++{ ++ SEARCHED_ITEM_FLAG_LOOP = 1, ++ SEARCHED_ITEM_FLAG_RECURSIVE = 2 ++} searched_item_flags; ++ ++typedef struct searched_item ++{ ++ grub_efi_guid_t guid; ++ const char *name; ++ searched_item_flags flags; ++} searched_items; ++ ++static grub_err_t ++grub_cmd_connectefi (grub_command_t cmd __attribute__ ((unused)), ++ int argc, char **args) ++{ ++ unsigned s; ++ searched_items pciroot_items[] = ++ { ++ { GRUB_EFI_PCI_ROOT_IO_GUID, "PCI root", SEARCHED_ITEM_FLAG_RECURSIVE } ++ }; ++ searched_items scsi_items[] = ++ { ++ { GRUB_EFI_PCI_ROOT_IO_GUID, "PCI root", 0 }, ++ { GRUB_EFI_PCI_IO_GUID, "PCI", SEARCHED_ITEM_FLAG_LOOP }, ++ { GRUB_EFI_SCSI_IO_PROTOCOL_GUID, "SCSI I/O", SEARCHED_ITEM_FLAG_RECURSIVE } ++ }; ++ searched_items *items = NULL; ++ unsigned nitems = 0; ++ grub_err_t grub_err = GRUB_ERR_NONE; ++ unsigned total_connected = 0; ++ ++ if (argc != 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected")); ++ ++ if (grub_strcmp(args[0], N_("pciroot")) == 0) ++ { ++ items = pciroot_items; ++ nitems = ARRAY_SIZE (pciroot_items); ++ } ++ else if (grub_strcmp(args[0], N_("scsi")) == 0) ++ { ++ items = scsi_items; ++ nitems = ARRAY_SIZE (scsi_items); ++ } ++ else ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, ++ N_("unexpected argument `%s'"), args[0]); ++ ++ for (s = 0; s < nitems; s++) ++ { ++ grub_efi_handle_t *handles; ++ grub_efi_uintn_t num_handles; ++ unsigned i, connected = 0, loop = 0; ++ ++loop: ++ loop++; ++ grub_dprintf ("efi", "step '%s' loop %d:\n", items[s].name, loop); ++ ++ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, ++ &items[s].guid, 0, &num_handles); ++ ++ if (!handles) ++ continue; ++ ++ for (i = 0; i < num_handles; i++) ++ { ++ grub_efi_handle_t handle = handles[i]; ++ grub_efi_status_t status; ++ unsigned j; ++ ++ /* Skip already handled handles */ ++ if (is_in_list (handle)) ++ { ++ grub_dprintf ("efi", " handle %p: already processed\n", ++ handle); ++ continue; ++ } ++ ++ status = grub_efi_connect_controller(handle, NULL, NULL, ++ items[s].flags & SEARCHED_ITEM_FLAG_RECURSIVE ? 1 : 0); ++ if (status == GRUB_EFI_SUCCESS) ++ { ++ connected++; ++ total_connected++; ++ grub_dprintf ("efi", " handle %p: connected\n", handle); ++ } ++ else ++ grub_dprintf ("efi", " handle %p: failed to connect (%d)\n", ++ handle, (grub_efi_int8_t) status); ++ ++ if ((grub_err = add_handle (handle)) != GRUB_ERR_NONE) ++ break; /* fatal */ ++ } ++ ++ grub_free (handles); ++ if (grub_err != GRUB_ERR_NONE) ++ break; /* fatal */ ++ ++ if (items[s].flags & SEARCHED_ITEM_FLAG_LOOP && connected) ++ { ++ connected = 0; ++ goto loop; ++ } ++ ++ free_handle_list (); ++ } ++ ++ free_handle_list (); ++ ++ if (total_connected) ++ grub_efidisk_reenumerate_disks (); ++ ++ return grub_err; ++} ++ ++static grub_command_t cmd; ++ ++GRUB_MOD_INIT(connectefi) ++{ ++ cmd = grub_register_command ("connectefi", grub_cmd_connectefi, ++ N_("pciroot|scsi"), ++ N_("Connect EFI handles." ++ " If 'pciroot' is specified, connect PCI" ++ " root EFI handles recursively." ++ " If 'scsi' is specified, connect SCSI" ++ " I/O EFI handles recursively.")); ++} ++ ++GRUB_MOD_FINI(connectefi) ++{ ++ grub_unregister_command (cmd); ++} +diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c +index d1ce99af438..f2d2430e666 100644 +--- a/grub-core/commands/efi/lsefi.c ++++ b/grub-core/commands/efi/lsefi.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c +index fe8ba6e6c93..062143dfffd 100644 +--- a/grub-core/disk/efi/efidisk.c ++++ b/grub-core/disk/efi/efidisk.c +@@ -396,6 +396,19 @@ enumerate_disks (void) + free_devices (devices); + } + ++void ++grub_efidisk_reenumerate_disks (void) ++{ ++ free_devices (fd_devices); ++ free_devices (hd_devices); ++ free_devices (cd_devices); ++ fd_devices = 0; ++ hd_devices = 0; ++ cd_devices = 0; ++ ++ enumerate_disks (); ++} ++ + static int + grub_efidisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, + grub_disk_pull_t pull) +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 14bc10eb564..7fcca69c17b 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -95,6 +95,19 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type, + return buffer; + } + ++grub_efi_status_t ++grub_efi_connect_controller (grub_efi_handle_t controller_handle, ++ grub_efi_handle_t *driver_image_handle, ++ grub_efi_device_path_protocol_t *remaining_device_path, ++ grub_efi_boolean_t recursive) ++{ ++ grub_efi_boot_services_t *b; ++ ++ b = grub_efi_system_table->boot_services; ++ return efi_call_4 (b->connect_controller, controller_handle, ++ driver_image_handle, remaining_device_path, recursive); ++} ++ + void * + grub_efi_open_protocol (grub_efi_handle_t handle, + grub_efi_guid_t *protocol, +diff --git a/include/grub/efi/disk.h b/include/grub/efi/disk.h +index 254475c8428..6845c2f1fd8 100644 +--- a/include/grub/efi/disk.h ++++ b/include/grub/efi/disk.h +@@ -27,6 +27,8 @@ grub_efi_handle_t + EXPORT_FUNC(grub_efidisk_get_device_handle) (grub_disk_t disk); + char *EXPORT_FUNC(grub_efidisk_get_device_name) (grub_efi_handle_t *handle); + ++void EXPORT_FUNC(grub_efidisk_reenumerate_disks) (void); ++ + void grub_efidisk_init (void); + void grub_efidisk_fini (void); + +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 8dfc89a33b9..ec52083c49f 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -41,6 +41,11 @@ EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type, + grub_efi_guid_t *protocol, + void *search_key, + grub_efi_uintn_t *num_handles); ++grub_efi_status_t ++EXPORT_FUNC(grub_efi_connect_controller) (grub_efi_handle_t controller_handle, ++ grub_efi_handle_t *driver_image_handle, ++ grub_efi_device_path_protocol_t *remaining_device_path, ++ grub_efi_boolean_t recursive); + void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle, + grub_efi_guid_t *protocol, + grub_efi_uint32_t attributes); +diff --git a/NEWS b/NEWS +index 73b8492bc42..d7c1d23aed7 100644 +--- a/NEWS ++++ b/NEWS +@@ -98,7 +98,7 @@ New in 2.02: + * Prefer pmtimer for TSC calibration. + + * New/improved platform support: +- * New `efifwsetup' and `lsefi' commands on EFI platforms. ++ * New `efifwsetup', `lsefi' and `connectefi` commands on EFI platforms. + * New `cmosdump' and `cmosset' commands on platforms with CMOS support. + * New command `pcidump' for PCI platforms. + * Improve opcode parsing in ACPI halt implementation. diff --git a/grub.patches b/grub.patches index 290189d2..c3ce86f4 100644 --- a/grub.patches +++ b/grub.patches @@ -207,3 +207,6 @@ Patch0206: 0206-Where-present-ensure-config-util.h-precedes-config.h.patch Patch0207: 0207-Drop-gnulib-fix-base64.patch.patch Patch0208: 0208-Drop-gnulib-no-abort.patch.patch Patch0209: 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch +Patch0210: 0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch +Patch0211: 0211-search-new-efidisk-only-option-on-EFI-systems.patch +Patch0212: 0212-efi-new-connectefi-command.patch diff --git a/grub2.spec b/grub2.spec index a7f8cb39..884226c4 100644 --- a/grub2.spec +++ b/grub2.spec @@ -16,7 +16,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 17%{?dist} +Release: 18%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -525,6 +525,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Feb 24 2022 Robbie Harwood - 2.06-18 +- Add efidisk/connectefi patches + * Thu Feb 24 2022 Robbie Harwood - 2.06-17 - Fix appended signature support commit (thanks: pjones) From fe0248c0cef1e8ef5e41790c5906f3dd691308d9 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 25 Feb 2022 22:25:36 +0000 Subject: [PATCH 102/294] Fix stripping of annobin -spec Signed-off-by: Robbie Harwood --- grub.macros | 6 +++--- grub2.spec | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/grub.macros b/grub.macros index a198b177..38247798 100644 --- a/grub.macros +++ b/grub.macros @@ -20,8 +20,8 @@ %global cflags_sed \\\ sed \\\ -e 's/-O. //g' \\\ - -e 's/-fplugin=annobin //g' \\\ - -e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]* ,,g' \\\ + -e 's/-fplugin=annobin//g' \\\ + -e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]*,,g' \\\ -e 's/-fstack-protector[[:alpha:]-]\\+//g' \\\ -e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\\+//g' \\\ -e 's/--param=ssp-buffer-size=4//g' \\\ @@ -52,7 +52,7 @@ %global ldflags_sed \\\ sed \\\ - -e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]* ,,g' \\\ + -e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]*,,g' \\\ -e 's/^$//' \\\ %{nil} diff --git a/grub2.spec b/grub2.spec index 884226c4..b8d26084 100644 --- a/grub2.spec +++ b/grub2.spec @@ -525,6 +525,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Feb 25 2022 Robbie Harwood - 2.06-19 +- Fix stripping of annobin -spec + * Thu Feb 24 2022 Robbie Harwood - 2.06-18 - Add efidisk/connectefi patches From 9027ec262fbd530ab50523bbaf0b9cca43dfdd74 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 25 Feb 2022 17:26:09 -0500 Subject: [PATCH 103/294] Bump spec Signed-off-by: Robbie Harwood --- grub2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index b8d26084..4a21a4ea 100644 --- a/grub2.spec +++ b/grub2.spec @@ -16,7 +16,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 18%{?dist} +Release: 19%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ From 0bd53311928e44a9ebb9df5b7faec1a938f69b58 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 28 Feb 2022 14:02:46 -0500 Subject: [PATCH 104/294] Fix efi_modules to include connectefi Signed-off-by: Robbie Harwood --- grub.macros | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index 38247798..4162b823 100644 --- a/grub.macros +++ b/grub.macros @@ -120,7 +120,7 @@ %ifarch aarch64 %{arm} riscv64 %global efi_modules " " %else -%global efi_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard " +%global efi_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard connectefi " %endif %ifarch aarch64 %{arm} riscv64 From 95d197a80ce590896253b5b72cda0372ebe1d85a Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 28 Feb 2022 20:31:09 +0000 Subject: [PATCH 105/294] Disable the .package_note awfulness Resolves: #2058712 Resolves: #2058527 Signed-off-by: Robbie Harwood --- grub2.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 4a21a4ea..a0a7a913 100644 --- a/grub2.spec +++ b/grub2.spec @@ -4,6 +4,7 @@ %global _lto_cflags %{nil} %undefine _hardened_build +%undefine _package_note_file %global tarversion 2.06 %undefine _missing_build_ids_terminate_build @@ -16,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 19%{?dist} +Release: 20%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -525,6 +526,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Feb 28 2022 Robbie Harwood - 2.06-20 +- Disable the .package_note awfulness +- Resolves: #2058712 +- Resolves: #2058527 + * Fri Feb 25 2022 Robbie Harwood - 2.06-19 - Fix stripping of annobin -spec From 9a30e00fc02948a589441503be3d7fa6ea50b989 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 9 Mar 2022 16:50:45 +0000 Subject: [PATCH 106/294] Fix initialization in efidisk patch Signed-off-by: Robbie Harwood --- ...mmands-search-Fix-bug-stopping-iteration-when-no-f.patch | 6 +++++- 0211-search-new-efidisk-only-option-on-EFI-systems.patch | 6 ++++-- 0212-efi-new-connectefi-command.patch | 1 + grub.patches | 2 +- grub2.spec | 5 ++++- 5 files changed, 15 insertions(+), 5 deletions(-) rename 0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch => 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch (79%) diff --git a/0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch b/0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch similarity index 79% rename from 0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch rename to 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch index 656f2291..388d3239 100644 --- a/0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch +++ b/0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch @@ -1,7 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20M=C3=A9trich?= Date: Tue, 8 Feb 2022 08:39:10 +0100 -Subject: [PATCH] search: fixed bug stopping iteration when --no-floppy is used +Subject: [PATCH] commands/search: Fix bug stopping iteration when --no-floppy + is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -10,6 +11,9 @@ When using --no-floppy and a floppy was encountered, iterate_device() was returning 1, causing the iteration to stop instead of continuing. Signed-off-by: Renaud Métrich +Reviewed-by: Daniel Kiper +(cherry picked from commit 68ba54c2298604146be83cae144dafd1cfd1fe2d) +Signed-off-by: Robbie Harwood --- grub-core/commands/search.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0211-search-new-efidisk-only-option-on-EFI-systems.patch b/0211-search-new-efidisk-only-option-on-EFI-systems.patch index 74b35227..afafc151 100644 --- a/0211-search-new-efidisk-only-option-on-EFI-systems.patch +++ b/0211-search-new-efidisk-only-option-on-EFI-systems.patch @@ -17,6 +17,8 @@ effective EFI device behind. This commit also refactors handling of --no-floppy option. Signed-off-by: Renaud Métrich +[rharwood: apply rmetrich's flags initialization fix] +Signed-off-by: Robbie Harwood --- grub-core/commands/search.c | 27 +++++++++++++++++++++++---- grub-core/commands/search_wrap.c | 18 ++++++++++++------ @@ -24,7 +26,7 @@ Signed-off-by: Renaud Métrich 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index 51656e361cc..57d26ced8a8 100644 +index 51656e361cc..dc182bf2017 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -47,7 +47,7 @@ struct search_ctx @@ -32,7 +34,7 @@ index 51656e361cc..57d26ced8a8 100644 const char *key; const char *var; - int no_floppy; -+ enum search_flags flags; ++ enum search_flags flags = 0; char **hints; unsigned nhints; int count; diff --git a/0212-efi-new-connectefi-command.patch b/0212-efi-new-connectefi-command.patch index e5aba51e..a9d860ba 100644 --- a/0212-efi-new-connectefi-command.patch +++ b/0212-efi-new-connectefi-command.patch @@ -50,6 +50,7 @@ The code is easily extensible to handle other arguments in the future if needed. Signed-off-by: Renaud Métrich +Signed-off-by: Robbie Harwood --- grub-core/Makefile.core.def | 6 ++ grub-core/commands/efi/connectefi.c | 205 ++++++++++++++++++++++++++++++++++++ diff --git a/grub.patches b/grub.patches index c3ce86f4..28185697 100644 --- a/grub.patches +++ b/grub.patches @@ -207,6 +207,6 @@ Patch0206: 0206-Where-present-ensure-config-util.h-precedes-config.h.patch Patch0207: 0207-Drop-gnulib-fix-base64.patch.patch Patch0208: 0208-Drop-gnulib-no-abort.patch.patch Patch0209: 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0210: 0210-search-fixed-bug-stopping-iteration-when-no-floppy-i.patch +Patch0210: 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch Patch0211: 0211-search-new-efidisk-only-option-on-EFI-systems.patch Patch0212: 0212-efi-new-connectefi-command.patch diff --git a/grub2.spec b/grub2.spec index a0a7a913..61e18696 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 20%{?dist} +Release: 21%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Mar 09 2022 Robbie Harwood - 2.06-21 +- Fix initialization in efidisk patch + * Mon Feb 28 2022 Robbie Harwood - 2.06-20 - Disable the .package_note awfulness - Resolves: #2058712 From e72456a804108212a7bea4841a1ffdb2fc4f9080 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 9 Mar 2022 12:10:32 -0500 Subject: [PATCH 107/294] Fix libusb dep Signed-off-by: Robbie Harwood --- grub2.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 61e18696..dda1e146 100644 --- a/grub2.spec +++ b/grub2.spec @@ -41,7 +41,8 @@ Source12: sbat.csv.in BuildRequires: gcc efi-srpm-macros BuildRequires: flex bison binutils python3 BuildRequires: ncurses-devel xz-devel bzip2-devel -BuildRequires: freetype-devel libusb-devel +BuildRequires: freetype-devel +BuildRequires: pkgconfig(libusb) BuildRequires: fuse-devel BuildRequires: rpm-devel rpm-libs BuildRequires: autoconf automake device-mapper-devel From e849938f16a6c712504cdf544845c50a2c1b4087 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 9 Mar 2022 12:50:39 -0500 Subject: [PATCH 108/294] Fix location of fix for fixing Signed-off-by: Robbie Harwood --- 0211-search-new-efidisk-only-option-on-EFI-systems.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/0211-search-new-efidisk-only-option-on-EFI-systems.patch b/0211-search-new-efidisk-only-option-on-EFI-systems.patch index afafc151..20ee9793 100644 --- a/0211-search-new-efidisk-only-option-on-EFI-systems.patch +++ b/0211-search-new-efidisk-only-option-on-EFI-systems.patch @@ -26,7 +26,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index 51656e361cc..dc182bf2017 100644 +index 51656e361cc..57d26ced8a8 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -47,7 +47,7 @@ struct search_ctx @@ -34,7 +34,7 @@ index 51656e361cc..dc182bf2017 100644 const char *key; const char *var; - int no_floppy; -+ enum search_flags flags = 0; ++ enum search_flags flags; char **hints; unsigned nhints; int count; @@ -86,7 +86,7 @@ index 51656e361cc..dc182bf2017 100644 .nhints = nhints, .count = 0, diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c -index 47fc8eb9966..464e6ebb1c8 100644 +index 47fc8eb9966..0b62acf8535 100644 --- a/grub-core/commands/search_wrap.c +++ b/grub-core/commands/search_wrap.c @@ -40,6 +40,7 @@ static const struct grub_arg_option options[] = @@ -109,7 +109,7 @@ index 47fc8eb9966..464e6ebb1c8 100644 const char *id = 0; int i = 0, j = 0, nhints = 0; char **hints = NULL; -+ enum search_flags flags; ++ enum search_flags flags = 0; if (state[SEARCH_HINT].set) for (i = 0; state[SEARCH_HINT].args[i]; i++) From 3de994c662e2c5b1611e9f55f4ea878bf62b0110 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 9 Mar 2022 15:28:03 -0500 Subject: [PATCH 109/294] Drop libusb dependency Signed-off-by: Robbie Harwood --- grub2.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index dda1e146..2f102008 100644 --- a/grub2.spec +++ b/grub2.spec @@ -42,7 +42,6 @@ BuildRequires: gcc efi-srpm-macros BuildRequires: flex bison binutils python3 BuildRequires: ncurses-devel xz-devel bzip2-devel BuildRequires: freetype-devel -BuildRequires: pkgconfig(libusb) BuildRequires: fuse-devel BuildRequires: rpm-devel rpm-libs BuildRequires: autoconf automake device-mapper-devel From e31fc7ca96eb797987d2e627220e71dec48f1152 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 10 Mar 2022 19:46:17 +0000 Subject: [PATCH 110/294] Skip updating BLS on ostree installations Resolves: #2059776 Signed-off-by: Robbie Harwood --- 0064-Add-grub2-switch-to-blscfg.patch | 18 +++++++++++++++++- ...e-cmdline-when-generating-legacy-menu.patch | 2 +- grub2.spec | 6 +++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/0064-Add-grub2-switch-to-blscfg.patch b/0064-Add-grub2-switch-to-blscfg.patch index ac30490f..fca07e64 100644 --- a/0064-Add-grub2-switch-to-blscfg.patch +++ b/0064-Add-grub2-switch-to-blscfg.patch @@ -7,12 +7,15 @@ Signed-off-by: Peter Jones Signed-off-by: Javier Martinez Canillas [jhlavac: Use ${etcdefaultgrub} instead of /etc/default/grub] Signed-off-by: Jan Hlavac +[rharwood: skip on ostree installations] +Signed-off-by: Robbie Harwood --- Makefile.util.def | 7 + util/grub-set-password.in | 2 +- util/grub-switch-to-blscfg.8 | 33 +++++ util/grub-switch-to-blscfg.in | 317 ++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 358 insertions(+), 1 deletion(-) + util/grub.d/10_linux.in | 2 +- + 5 files changed, 359 insertions(+), 2 deletions(-) create mode 100644 util/grub-switch-to-blscfg.8 create mode 100644 util/grub-switch-to-blscfg.in @@ -408,3 +411,16 @@ index 00000000000..a851424beb2 + +# Bye. +exit 0 +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 9fcd77cacc3..81f35a2f3f0 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -138,7 +138,7 @@ blsdir="/boot/loader/entries" + + get_sorted_bls() + { +- if ! [ -d "${blsdir}" ]; then ++ if ! [ -d "${blsdir}" ] || [ -f /run/ostree-booted ]; then + return + fi + diff --git a/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index 85dfb537..c4ce251e 100644 --- a/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 9fcd77cacc3..dc473f4333c 100644 +index 81f35a2f3f0..98fd9da6610 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -256,7 +256,9 @@ if [ -z "\${kernelopts}" ]; then diff --git a/grub2.spec b/grub2.spec index 2f102008..f13f7c33 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 21%{?dist} +Release: 22%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -526,6 +526,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Mar 10 2022 Robbie Harwood - 2.06-22 +- Skip updating BLS on ostree installations +- Resolves: #2059776 + * Wed Mar 09 2022 Robbie Harwood - 2.06-21 - Fix initialization in efidisk patch From 90dacf59d0f5270f345a9079f3a27df614b8e17c Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 18 Mar 2022 18:33:12 +0000 Subject: [PATCH 111/294] Don't verify kernels twice Signed-off-by: Robbie Harwood --- ...-i386-efi-linux.c-do-not-validate-ke.patch | 73 ++++++++++++++++ ...-arm64-linux.c-do-not-validate-kerne.patch | 58 +++++++++++++ ...-efi-chainloader.c-do-not-validate-c.patch | 80 ++++++++++++++++++ ...-efi-linux.c-drop-now-unused-grub_li.patch | 83 +++++++++++++++++++ grub.patches | 4 + grub2.spec | 5 +- 6 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch create mode 100644 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch create mode 100644 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch create mode 100644 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch new file mode 100644 index 00000000..e4a8522a --- /dev/null +++ b/0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Thu, 3 Mar 2022 13:10:56 +0100 +Subject: [PATCH] grub-core/loader/i386/efi/linux.c: do not validate kernels + twice + +On codebases that have shim-lock-verifier built into the grub core +(like 2.06 upstream), shim-lock-verifier is in enforcing mode when +booted with secureboot. It means that grub_cmd_linux() command +attempts to perform shim validate upon opening linux kernel image, +including kernel measurement. And the verifier correctly returns file +open error when shim validate protocol is not present or shim fails to +validate the kernel. + +This makes the call to grub_linuxefi_secure_validate() redundant, but +also harmful. As validating the kernel image twice, extends the PCRs +with the same measurement twice. Which breaks existing sealing +policies when upgrading from grub2.04+rhboot+sb+linuxefi to +grub2.06+rhboot+sb+linuxefi builds. It is also incorrect to measure +the kernel twice. + +This patch must not be ported to older editions of grub code bases +that do not have verifiers framework, or it is not builtin, or +shim-lock-verifier is an optional module. + +This patch is tested to ensure that unsigned kernels are not possible +to boot in secureboot mode when shim rejects kernel, or shim protocol +is missing, and that the measurements become stable once again. The +above also ensures that CVE-2020-15705 is not reintroduced. + +Signed-off-by: Dimitri John Ledkov +--- + grub-core/loader/i386/efi/linux.c | 13 ------------- + 1 file changed, 13 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 3cf0f9b330b..941df6400b9 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -30,7 +30,6 @@ + #include + #include + #include +-#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -278,7 +277,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_ssize_t start, filelen; + void *kernel = NULL; + int setup_header_end_offset; +- int rc; + + grub_dl_ref (my_mod); + +@@ -308,17 +306,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) +- { +- rc = grub_linuxefi_secure_validate (kernel, filelen); +- if (rc <= 0) +- { +- grub_error (GRUB_ERR_INVALID_COMMAND, +- N_("%s has invalid signature"), argv[0]); +- goto fail; +- } +- } +- + lh = (struct linux_i386_kernel_header *)kernel; + grub_dprintf ("linux", "original lh is at %p\n", kernel); + diff --git a/0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch new file mode 100644 index 00000000..9fb39a63 --- /dev/null +++ b/0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Fri, 4 Mar 2022 11:29:31 +0100 +Subject: [PATCH] grub-core/loader/arm64/linux.c: do not validate kernel twice + +Call to grub_file_open(, GRUB_FILE_TYPE_LINUX_KERNEL) already passes +the kernel file through shim-lock verifier when secureboot is on. Thus +there is no need to validate the kernel image again. And when doing so +again, duplicate PCR measurement is performed, breaking measurements +compatibility with 2.04+linuxefi. + +This patch must not be ported to older editions of grub code bases +that do not have verifiers framework, or it is not builtin, or +shim-lock-verifier is an optional module. + +Signed-off-by: Dimitri John Ledkov +--- + grub-core/loader/arm64/linux.c | 13 ------------- + 1 file changed, 13 deletions(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index f18d90bd749..d2af47c2c0a 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -34,7 +34,6 @@ + #include + #include + #include +-#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -341,7 +340,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_off_t filelen; + grub_uint32_t align; + void *kernel = NULL; +- int rc; + + grub_dl_ref (my_mod); + +@@ -370,17 +368,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) +- { +- rc = grub_linuxefi_secure_validate (kernel, filelen); +- if (rc <= 0) +- { +- grub_error (GRUB_ERR_INVALID_COMMAND, +- N_("%s has invalid signature"), argv[0]); +- goto fail; +- } +- } +- + if (grub_arch_efi_linux_check_image (kernel) != GRUB_ERR_NONE) + goto fail; + if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align) != GRUB_ERR_NONE) diff --git a/0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch new file mode 100644 index 00000000..ad343097 --- /dev/null +++ b/0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Fri, 4 Mar 2022 09:31:43 +0100 +Subject: [PATCH] grub-core/loader/efi/chainloader.c: do not validate + chainloader twice + +On secureboot systems, with shimlock verifier, call to +grub_file_open(, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE) will already +pass the chainloader target through shim-lock protocol verify +call. And create a TPM measurement. If verification fails, +grub_cmd_chainloader will fail at file open time. + +This makes previous code paths for negative, and zero return codes +from grub_linuxefi_secure_validate unreachable under secureboot. But +also breaking measurements compatibility with 2.04+linuxefi codebases, +as the chainloader file is passed through shim_lock->verify() twice +(via verifier & direct call to grub_linuxefi_secure_validate) +extending the PCRs twice. + +This reduces grub_loader options to perform +grub_secureboot_chainloader when secureboot is on, and otherwise +attempt grub_chainloader_boot. + +It means that booting with secureboot off, yet still with shim (which +always verifies things successfully), will stop choosing +grub_secureboot_chainloader, and opting for a more regular +loadimage/startimage codepath. If we want to use the +grub_secureboot_chainloader codepath in such scenarios we should adapt +the code to simply check for shim_lock protocol presence / +shim_lock->context() success?! But I am not sure if that is necessary. + +This patch must not be ported to older editions of grub code bases +that do not have verifiers framework, or it is not builtin, or +shim-lock-verifier is an optional module. + +Signed-off-by: Dimitri John Ledkov +--- + grub-core/loader/efi/chainloader.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 3af6b122926..644cd2e56fe 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -906,7 +906,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_efi_device_path_t *dp = 0; + char *filename; + void *boot_image = 0; +- int rc; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); +@@ -1082,9 +1081,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + orig_dev = 0; + } + +- rc = grub_linuxefi_secure_validate((void *)(unsigned long)address, fsize); +- grub_dprintf ("chain", "linuxefi_secure_validate: %d\n", rc); +- if (rc > 0) ++ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + { + grub_file_close (file); + grub_device_close (dev); +@@ -1092,7 +1089,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_secureboot_chainloader_unload, 0); + return 0; + } +- else if (rc == 0) ++ else + { + grub_load_and_start_image(boot_image); + grub_file_close (file); +@@ -1101,7 +1098,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + + return 0; + } +- // -1 fall-through to fail + + fail: + if (orig_dev) diff --git a/0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch new file mode 100644 index 00000000..46eafc01 --- /dev/null +++ b/0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dimitri John Ledkov +Date: Fri, 4 Mar 2022 11:36:09 +0100 +Subject: [PATCH] grub-core/loader/efi/linux.c: drop now unused + grub_linuxefi_secure_validate + +Drop the now unused grub_linuxefi_secure_validate() as all prior users +of this API now rely on the shim-lock-verifier codepath instead. + +This patch must not be ported to older editions of grub code bases +that do not have verifiers framework, or it is not builtin, or +shim-lock-verifier is an optional module. + +Signed-off-by: Dimitri John Ledkov +--- + grub-core/loader/efi/linux.c | 40 ---------------------------------------- + include/grub/efi/linux.h | 2 -- + 2 files changed, 42 deletions(-) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 9260731c107..9265cf4200a 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -24,46 +24,6 @@ + #include + #include + +-#define SHIM_LOCK_GUID \ +- { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} } +- +-struct grub_efi_shim_lock +-{ +- grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size); +-}; +-typedef struct grub_efi_shim_lock grub_efi_shim_lock_t; +- +-// Returns 1 on success, -1 on error, 0 when not available +-int +-grub_linuxefi_secure_validate (void *data, grub_uint32_t size) +-{ +- grub_efi_guid_t guid = SHIM_LOCK_GUID; +- grub_efi_shim_lock_t *shim_lock; +- grub_efi_status_t status; +- +- shim_lock = grub_efi_locate_protocol(&guid, NULL); +- grub_dprintf ("secureboot", "shim_lock: %p\n", shim_lock); +- if (!shim_lock) +- { +- grub_dprintf ("secureboot", "shim not available\n"); +- return 0; +- } +- +- grub_dprintf ("secureboot", "Asking shim to verify kernel signature\n"); +- status = shim_lock->verify (data, size); +- grub_dprintf ("secureboot", "shim_lock->verify(): %ld\n", (long int)status); +- if (status == GRUB_EFI_SUCCESS) +- { +- grub_dprintf ("secureboot", "Kernel signature verification passed\n"); +- return 1; +- } +- +- grub_dprintf ("secureboot", "Kernel signature verification failed (0x%lx)\n", +- (unsigned long) status); +- +- return -1; +-} +- + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" + +diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h +index 0033d9305a9..887b02fd9f3 100644 +--- a/include/grub/efi/linux.h ++++ b/include/grub/efi/linux.h +@@ -22,8 +22,6 @@ + #include + #include + +-int +-EXPORT_FUNC(grub_linuxefi_secure_validate) (void *data, grub_uint32_t size); + grub_err_t + EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, + void *kernel_param); diff --git a/grub.patches b/grub.patches index 28185697..29c58942 100644 --- a/grub.patches +++ b/grub.patches @@ -210,3 +210,7 @@ Patch0209: 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch Patch0210: 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch Patch0211: 0211-search-new-efidisk-only-option-on-EFI-systems.patch Patch0212: 0212-efi-new-connectefi-command.patch +Patch0213: 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0214: 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +Patch0215: 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0216: 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/grub2.spec b/grub2.spec index f13f7c33..34b2ccc3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 22%{?dist} +Release: 23%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Mar 18 2022 Robbie Harwood - 2.06-23 +- Don't verify kernels twice + * Thu Mar 10 2022 Robbie Harwood - 2.06-22 - Skip updating BLS on ostree installations - Resolves: #2059776 From ac0e146ae3a268d5d3eaae40fe1278408d4d1f24 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 21 Mar 2022 17:01:32 +0000 Subject: [PATCH 112/294] Fix missing format specifier in appended signature commit Signed-off-by: Robbie Harwood --- ...pended-signatures-support-verifying-appended-signa.patch | 6 ++++-- grub2.spec | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/0175-appended-signatures-support-verifying-appended-signa.patch b/0175-appended-signatures-support-verifying-appended-signa.patch index 262efc0d..f655bb51 100644 --- a/0175-appended-signatures-support-verifying-appended-signa.patch +++ b/0175-appended-signatures-support-verifying-appended-signa.patch @@ -20,6 +20,8 @@ other mechanisms, such as a password or lockdown, must be used to ensure that a user cannot drop to the grub shell and disable verification. Signed-off-by: Daniel Axtens +[pjones: fix missing format specifier] +Signed-off-by: Robbie Harwood --- grub-core/Makefile.core.def | 12 + grub-core/commands/appendedsig/appendedsig.c | 645 +++++++++++++++++++++++++++ @@ -52,7 +54,7 @@ index b4aaccf7b57..77321d218c8 100644 common = commands/hdparm.c; diff --git a/grub-core/commands/appendedsig/appendedsig.c b/grub-core/commands/appendedsig/appendedsig.c new file mode 100644 -index 00000000000..dc294cd339e +index 00000000000..bf8b18b6205 --- /dev/null +++ b/grub-core/commands/appendedsig/appendedsig.c @@ -0,0 +1,645 @@ @@ -387,7 +389,7 @@ index 00000000000..dc294cd339e + data = grub_malloc (file_size); + if (!data) + return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ N_("Could not allocate data buffer size " ++ N_("Could not allocate data buffer size %" + PRIuGRUB_UINT64_T " for verification"), file_size); + + while (total_read_size < file_size) diff --git a/grub2.spec b/grub2.spec index 34b2ccc3..826b6651 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 23%{?dist} +Release: 24%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Mar 21 2022 Robbie Harwood - 2.06-24 +- Fix missing format specifier in appended signature commit + * Fri Mar 18 2022 Robbie Harwood - 2.06-23 - Don't verify kernels twice From 93004a8494732dca960febe24d987a8ff115de38 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 21 Mar 2022 17:54:55 +0000 Subject: [PATCH 113/294] Use my sort patch instead Signed-off-by: Robbie Harwood --- ...fig-construct-titles-that-look-like-.patch | 0 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch | 475 ------------------ ...ly-grub2-password-config-tool-985962.patch | 8 +- ... 0035-tcp-add-window-scaling-support.patch | 0 ...net-and-bootp-add-support-for-dhcpv6.patch | 0 ...rnel-settings-and-use-it-in-10_linux.patch | 8 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 0 ... 0039-Make-grub_fatal-also-backtrace.patch | 0 ...ix-up-some-man-pages-rpmdiff-noticed.patch | 6 +- ...fo-pages-say-grub2-where-appropriate.patch | 0 ...-chainloader-entries-don-t-try-any-x.patch | 0 ...-Add-ability-to-boot-from-subvolumes.patch | 0 ...port-btrfs_subvol-and-btrfs_subvolid.patch | 0 ...> 0045-grub2-btrfs-03-follow_default.patch | 0 ...=> 0046-grub2-btrfs-04-grub2-install.patch | 0 ...> 0047-grub2-btrfs-05-grub2-mkconfig.patch | 4 +- ... => 0048-grub2-btrfs-06-subvol-mount.patch | 0 ...subvol-name-scheme-to-support-old-sn.patch | 0 ...-correctly-with-btrfs-snapshots-bsc-.patch | 0 ...ocate_pool-and-grub_efi_free_pool-wr.patch | 0 ...fi_.-memory-helpers-where-reasonable.patch | 0 ...3-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 0 ...=> 0054-don-t-use-int-for-efi-status.patch | 0 ...INIT-declare-its-function-prototypes.patch | 0 ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 0 ...d-xen-or-multiboot-2-modules-as-need.patch | 0 ...-calibration-not-take-51-seconds-to-.patch | 0 ...059-align-struct-efi_variable-better.patch | 0 ...060-Add-BLS-support-to-grub-mkconfig.patch | 6 +- ...-backtrace-on-grub_abort-for-grub-em.patch | 0 ...nux-and-initrd-commands-for-grub-emu.patch | 0 ...h => 0063-Add-grub2-switch-to-blscfg.patch | 4 +- ...patch => 0064-make-better-backtraces.patch | 2 +- ...w-our-startup-message-if-debug-is-se.patch | 0 ...-some-minor-include-path-weirdnesses.patch | 0 ...it-possible-to-enabled-build-id-sha1.patch | 4 +- ...f-grub_dprintf-without-the-file-line.patch | 0 ...dprintf-that-tells-us-load-addresses.patch | 0 ...tch => 0070-Fixup-for-newer-compiler.patch | 0 ...-export-the-start-and-_start-symbols.patch | 0 ...tch => 0072-Fixup-for-newer-compiler.patch | 0 ...pport-for-non-Ethernet-network-cards.patch | 0 ...racketed-ipv6-addrs-and-port-numbers.patch | 0 ...=> 0075-bootp-New-net_bootp6-command.patch | 0 ...=> 0076-efinet-UEFI-IPv6-PXE-support.patch | 0 ...077-grub.texi-Add-net_bootp6-doument.patch | 0 ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 0 ...etting-network-from-UEFI-device-path.patch | 0 ...etting-DNS-server-from-UEFI-protocol.patch | 0 ...81-Support-UEFI-networking-protocols.patch | 0 ...> 0082-AUDIT-0-http-boot-tracker-bug.patch | 0 ...-incr-command-to-increment-integer-v.patch | 0 ...h => 0084-Add-auto-hide-menu-support.patch | 2 +- ...> 0085-Add-grub-set-bootflag-utility.patch | 4 +- ...b-boot-indeterminate.service-example.patch | 0 ...h => 0087-gentpl-add-disable-support.patch | 0 ... => 0088-gentpl-add-pc-firmware-type.patch | 0 ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 6 +- ...make-it-possible-to-run-checkers-on-.patch | 0 ...93-Rework-how-the-fdt-command-builds.patch | 0 ...able-non-wordsize-allocations-on-arm.patch | 4 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 0 ...=> 0096-Make-grub_error-more-verbose.patch | 0 ...eset-an-alias-for-the-reboot-command.patch | 0 ....patch => 0098-Add-a-version-command.patch | 4 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 0 ...-Better-memory-allocation-and-error-.patch | 0 ...tter-locations-for-kernel-and-initrd.patch | 0 ...p-all-the-places-Wsign-compare-error.patch | 16 +- ...gn-compare-Wno-conversion-Wno-error-.patch | 6 +- ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 0 ...itrd-params-cmdline-allocations-abov.patch | 0 ... => 0108-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 4 +- ...tch => 0110-Reimplement-boot_counter.patch | 2 +- ...ntry-selection-based-on-ID-and-title.patch | 0 ...try-users-option-argument-to-be-opti.patch | 0 ...export-env-and-efi-load-env-commands.patch | 0 ...le-to-subtract-conditions-from-debug.patch | 0 ...bles-from-the-initial-context-when-c.patch | 0 ...-boot-success-reset-from-menu-auto-h.patch | 2 +- ...ix-systemctl-kexec-exit-status-check.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 0 ...g-Update-comment-about-running-as-ro.patch | 0 ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...indeterminate-getting-set-on-boot_su.patch | 0 ... => 0123-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 0 ...fw-http-_path-variables-to-make-them.patch | 0 ...-literal-IPv6-addresses-in-square-br.patch | 0 ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 0 ...se-address-before-jumping-to-the-PE-.patch | 0 ...ate-TPM-measurement-errors-to-the-ve.patch | 0 ...maximum-bounce-buffer-size-to-16-MiB.patch | 0 ...fix-when-the-HTTP-path-is-relative-a.patch | 0 ...turn-in-efi-export-env-and-efi-load-.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 0 ...rnel-validation-without-shim-protoco.patch | 0 ...ar-pointers-in-grub-core-net-bootp.c.patch | 0 ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 2 +- ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 0 ...ll-disable-support-for-EFI-platforms.patch | 0 ...imestamps-configure-flag-to-prepend-.patch | 8 +- ...ements-to-grub_disk_open-and-grub_di.patch | 0 ...on-grub_debug_is_enabled-void-return.patch | 0 ...ear-screen-when-debugging-is-enabled.patch | 0 ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 0 ...igning-grub-with-an-appended-signatu.patch | 0 ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0163-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0166-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...69-libtasn1-compile-into-asn1-module.patch | 0 ...0-test_asn1-test-module-for-libtasn1.patch | 4 +- ...-support-embedding-x509-certificates.patch | 0 ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 0 ...76-appended-signatures-documentation.patch | 0 ...er-lockdown-based-on-ibm-secure-boot.patch | 0 ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0179-ieee1275-claim-more-memory.patch | 0 ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 0 ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...ainloading-EFI-apps-from-loop-mounts.patch | 0 ...> 0184-efinet-Add-DHCP-proxy-support.patch | 0 ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 0 ... 0187-Suppress-gettext-error-message.patch | 0 ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 ...for-EFI-at-runtime-instead-of-config.patch | 0 ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 0 ...over-the-device-to-read-the-config-f.patch | 0 ...etting-of-prefix-for-signed-binary-c.patch | 0 ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 0 ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 0 ...-mkconfig-restore-umask-for-grub.cfg.patch | 0 ...btrfs-Use-full-btrfs-bootloader-area.patch | 0 ...-Fedora-location-of-DejaVu-SANS-font.patch | 4 +- ...t-show-Booting-s-msg-when-auto-booti.patch | 0 ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 0 ...ot-set-colorstate-until-the-first-te.patch | 0 ...ot-set-cursor-until-the-first-text-o.patch | 0 ...se-visual-indentation-in-config.h.in.patch | 0 ...sure-config-util.h-precedes-config.h.patch | 0 ...=> 0206-Drop-gnulib-fix-base64.patch.patch | 0 ...h => 0207-Drop-gnulib-no-abort.patch.patch | 0 ...version-and-drop-most-gnulib-patches.patch | 2 +- ...Fix-bug-stopping-iteration-when-no-f.patch | 0 ...w-efidisk-only-option-on-EFI-systems.patch | 0 ...h => 0211-efi-new-connectefi-command.patch | 0 ...-i386-efi-linux.c-do-not-validate-ke.patch | 0 ...-arm64-linux.c-do-not-validate-kerne.patch | 0 ...-efi-chainloader.c-do-not-validate-c.patch | 0 ...-efi-linux.c-drop-now-unused-grub_li.patch | 0 ...sorting-of-kernel-names-containing-_.patch | 34 ++ grub.patches | 368 +++++++------- grub2.spec | 6 +- 187 files changed, 271 insertions(+), 724 deletions(-) rename 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (100%) delete mode 100644 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch rename 0035-Add-friendly-grub2-password-config-tool-985962.patch => 0034-Add-friendly-grub2-password-config-tool-985962.patch (98%) rename 0036-tcp-add-window-scaling-support.patch => 0035-tcp-add-window-scaling-support.patch (100%) rename 0037-efinet-and-bootp-add-support-for-dhcpv6.patch => 0036-efinet-and-bootp-add-support-for-dhcpv6.patch (100%) rename 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (98%) rename 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch => 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch (100%) rename 0040-Make-grub_fatal-also-backtrace.patch => 0039-Make-grub_fatal-also-backtrace.patch (100%) rename 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch => 0040-Fix-up-some-man-pages-rpmdiff-noticed.patch (96%) rename 0042-Make-our-info-pages-say-grub2-where-appropriate.patch => 0041-Make-our-info-pages-say-grub2-where-appropriate.patch (100%) rename 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0042-macos-just-build-chainloader-entries-don-t-try-any-x.patch (100%) rename 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0043-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (100%) rename 0045-export-btrfs_subvol-and-btrfs_subvolid.patch => 0044-export-btrfs_subvol-and-btrfs_subvolid.patch (100%) rename 0046-grub2-btrfs-03-follow_default.patch => 0045-grub2-btrfs-03-follow_default.patch (100%) rename 0047-grub2-btrfs-04-grub2-install.patch => 0046-grub2-btrfs-04-grub2-install.patch (100%) rename 0048-grub2-btrfs-05-grub2-mkconfig.patch => 0047-grub2-btrfs-05-grub2-mkconfig.patch (98%) rename 0049-grub2-btrfs-06-subvol-mount.patch => 0048-grub2-btrfs-06-subvol-mount.patch (100%) rename 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0049-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (100%) rename 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0050-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (100%) rename 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0051-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (100%) rename 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch => 0052-Use-grub_efi_.-memory-helpers-where-reasonable.patch (100%) rename 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch => 0053-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch (100%) rename 0055-don-t-use-int-for-efi-status.patch => 0054-don-t-use-int-for-efi-status.patch (100%) rename 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0055-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (100%) rename 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0056-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (100%) rename 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0057-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (100%) rename 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch => 0058-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch (100%) rename 0060-align-struct-efi_variable-better.patch => 0059-align-struct-efi_variable-better.patch (100%) rename 0061-Add-BLS-support-to-grub-mkconfig.patch => 0060-Add-BLS-support-to-grub-mkconfig.patch (99%) rename 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0061-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (100%) rename 0063-Add-linux-and-initrd-commands-for-grub-emu.patch => 0062-Add-linux-and-initrd-commands-for-grub-emu.patch (100%) rename 0064-Add-grub2-switch-to-blscfg.patch => 0063-Add-grub2-switch-to-blscfg.patch (99%) rename 0065-make-better-backtraces.patch => 0064-make-better-backtraces.patch (99%) rename 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0065-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (100%) rename 0067-Work-around-some-minor-include-path-weirdnesses.patch => 0066-Work-around-some-minor-include-path-weirdnesses.patch (100%) rename 0068-Make-it-possible-to-enabled-build-id-sha1.patch => 0067-Make-it-possible-to-enabled-build-id-sha1.patch (95%) rename 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0068-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (100%) rename 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0069-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (100%) rename 0071-Fixup-for-newer-compiler.patch => 0070-Fixup-for-newer-compiler.patch (100%) rename 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0071-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (100%) rename 0073-Fixup-for-newer-compiler.patch => 0072-Fixup-for-newer-compiler.patch (100%) rename 0074-Add-support-for-non-Ethernet-network-cards.patch => 0073-Add-support-for-non-Ethernet-network-cards.patch (100%) rename 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0074-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (100%) rename 0076-bootp-New-net_bootp6-command.patch => 0075-bootp-New-net_bootp6-command.patch (100%) rename 0077-efinet-UEFI-IPv6-PXE-support.patch => 0076-efinet-UEFI-IPv6-PXE-support.patch (100%) rename 0078-grub.texi-Add-net_bootp6-doument.patch => 0077-grub.texi-Add-net_bootp6-doument.patch (100%) rename 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0078-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (100%) rename 0080-efinet-Setting-network-from-UEFI-device-path.patch => 0079-efinet-Setting-network-from-UEFI-device-path.patch (100%) rename 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0080-efinet-Setting-DNS-server-from-UEFI-protocol.patch (100%) rename 0082-Support-UEFI-networking-protocols.patch => 0081-Support-UEFI-networking-protocols.patch (100%) rename 0083-AUDIT-0-http-boot-tracker-bug.patch => 0082-AUDIT-0-http-boot-tracker-bug.patch (100%) rename 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0083-grub-editenv-Add-incr-command-to-increment-integer-v.patch (100%) rename 0085-Add-auto-hide-menu-support.patch => 0084-Add-auto-hide-menu-support.patch (99%) rename 0086-Add-grub-set-bootflag-utility.patch => 0085-Add-grub-set-bootflag-utility.patch (99%) rename 0087-docs-Add-grub-boot-indeterminate.service-example.patch => 0086-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0088-gentpl-add-disable-support.patch => 0087-gentpl-add-disable-support.patch (100%) rename 0089-gentpl-add-pc-firmware-type.patch => 0088-gentpl-add-pc-firmware-type.patch (100%) rename 0090-efinet-also-use-the-firmware-acceleration-for-http.patch => 0089-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0090-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (97%) rename 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0092-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0094-Rework-how-the-fdt-command-builds.patch => 0093-Rework-how-the-fdt-command-builds.patch (100%) rename 0095-Disable-non-wordsize-allocations-on-arm.patch => 0094-Disable-non-wordsize-allocations-on-arm.patch (93%) rename 0096-Prepend-prefix-when-HTTP-path-is-relative.patch => 0095-Prepend-prefix-when-HTTP-path-is-relative.patch (100%) rename 0097-Make-grub_error-more-verbose.patch => 0096-Make-grub_error-more-verbose.patch (100%) rename 0098-Make-reset-an-alias-for-the-reboot-command.patch => 0097-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0099-Add-a-version-command.patch => 0098-Add-a-version-command.patch (98%) rename 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0099-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (100%) rename 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0100-arm-arm64-loader-Better-memory-allocation-and-error-.patch (100%) rename 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0101-Try-to-pick-better-locations-for-kernel-and-initrd.patch (100%) rename 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (93%) rename 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (93%) rename 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0104-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0105-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0106-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (100%) rename 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0107-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (100%) rename 0109-Fix-getroot.c-s-trampolines.patch => 0108-Fix-getroot.c-s-trampolines.patch (100%) rename 0110-Do-not-allow-stack-trampolines-anywhere.patch => 0109-Do-not-allow-stack-trampolines-anywhere.patch (93%) rename 0111-Reimplement-boot_counter.patch => 0110-Reimplement-boot_counter.patch (99%) rename 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0111-Fix-menu-entry-selection-based-on-ID-and-title.patch (100%) rename 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0112-Make-the-menu-entry-users-option-argument-to-be-opti.patch (100%) rename 0114-Add-efi-export-env-and-efi-load-env-commands.patch => 0113-Add-efi-export-env-and-efi-load-env-commands.patch (100%) rename 0115-Make-it-possible-to-subtract-conditions-from-debug.patch => 0114-Make-it-possible-to-subtract-conditions-from-debug.patch (100%) rename 0116-Export-all-variables-from-the-initial-context-when-c.patch => 0115-Export-all-variables-from-the-initial-context-when-c.patch (100%) rename 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (99%) rename 0118-Fix-systemctl-kexec-exit-status-check.patch => 0117-Fix-systemctl-kexec-exit-status-check.patch (100%) rename 0119-Print-grub-emu-linux-loader-messages-as-debug.patch => 0118-Print-grub-emu-linux-loader-messages-as-debug.patch (100%) rename 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0119-Don-t-assume-that-boot-commands-will-only-return-on-.patch (100%) rename 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0120-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) rename 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0121-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) rename 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0122-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (100%) rename 0124-Add-start-symbol-for-RISC-V.patch => 0123-Add-start-symbol-for-RISC-V.patch (100%) rename 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0124-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (100%) rename 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0125-efi-http-Export-fw-http-_path-variables-to-make-them.patch (100%) rename 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0126-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) rename 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0127-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0128-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) rename 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0129-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) rename 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0130-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (100%) rename 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0131-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (100%) rename 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0132-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (100%) rename 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0133-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (100%) rename 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0134-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (100%) rename 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0135-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (100%) rename 0137-efi-dhcp-fix-some-allocation-error-checking.patch => 0136-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0138-efi-http-fix-some-allocation-error-checking.patch => 0137-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0138-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0139-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (100%) rename 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0140-linuxefi-fail-kernel-validation-without-shim-protoco.patch (100%) rename 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0141-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (100%) rename 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) rename 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0144-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0145-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch (99%) rename 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0147-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0148-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (100%) rename 0150-grub-install-disable-support-for-EFI-platforms.patch => 0149-grub-install-disable-support-for-EFI-platforms.patch (100%) rename 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch (95%) rename 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0151-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (100%) rename 0153-Introduce-function-grub_debug_is_enabled-void-return.patch => 0152-Introduce-function-grub_debug_is_enabled-void-return.patch (100%) rename 0154-Don-t-clear-screen-when-debugging-is-enabled.patch => 0153-Don-t-clear-screen-when-debugging-is-enabled.patch (100%) rename 0155-grub_file_-instrumentation-new-file-debug-tag.patch => 0154-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0156-ieee1275-Avoiding-many-unecessary-open-close.patch => 0155-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0156-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0157-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0158-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (100%) rename 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0159-Add-suport-for-signing-grub-with-an-appended-signatu.patch (100%) rename 0161-docs-grub-Document-signing-grub-under-UEFI.patch => 0160-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0161-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) rename 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0162-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0164-pgp-factor-out-rsa_pad.patch => 0163-pgp-factor-out-rsa_pad.patch (100%) rename 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0164-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0165-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0167-libtasn1-import-libtasn1-4.16.0.patch => 0166-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0168-libtasn1-disable-code-not-needed-in-grub.patch => 0167-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0169-libtasn1-changes-for-grub-compatibility.patch => 0168-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0170-libtasn1-compile-into-asn1-module.patch => 0169-libtasn1-compile-into-asn1-module.patch (100%) rename 0171-test_asn1-test-module-for-libtasn1.patch => 0170-test_asn1-test-module-for-libtasn1.patch (99%) rename 0172-grub-install-support-embedding-x509-certificates.patch => 0171-grub-install-support-embedding-x509-certificates.patch (100%) rename 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0172-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0173-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0175-appended-signatures-support-verifying-appended-signa.patch => 0174-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0176-appended-signatures-verification-tests.patch => 0175-appended-signatures-verification-tests.patch (100%) rename 0177-appended-signatures-documentation.patch => 0176-appended-signatures-documentation.patch (100%) rename 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0177-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (100%) rename 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0178-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0180-ieee1275-claim-more-memory.patch => 0179-ieee1275-claim-more-memory.patch (100%) rename 0181-ieee1275-request-memory-with-ibm-client-architecture.patch => 0180-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) rename 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0181-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) rename 0183-ieee1275-ofdisk-retry-on-open-failure.patch => 0182-ieee1275-ofdisk-retry-on-open-failure.patch (100%) rename 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0183-Allow-chainloading-EFI-apps-from-loop-mounts.patch (100%) rename 0185-efinet-Add-DHCP-proxy-support.patch => 0184-efinet-Add-DHCP-proxy-support.patch (100%) rename 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0185-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0186-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (100%) rename 0188-Suppress-gettext-error-message.patch => 0187-Suppress-gettext-error-message.patch (100%) rename 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0188-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) rename 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0189-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) rename 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0190-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0191-arm64-Fix-EFI-loader-kernel-image-allocation.patch (100%) rename 0193-normal-main-Discover-the-device-to-read-the-config-f.patch => 0192-normal-main-Discover-the-device-to-read-the-config-f.patch (100%) rename 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0193-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (100%) rename 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0194-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) rename 0196-Print-module-name-on-license-check-failure.patch => 0195-Print-module-name-on-license-check-failure.patch (100%) rename 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0196-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (100%) rename 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0197-grub-mkconfig-restore-umask-for-grub.cfg.patch (100%) rename 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0198-fs-btrfs-Use-full-btrfs-bootloader-area.patch (100%) rename 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch => 0199-Add-Fedora-location-of-DejaVu-SANS-font.patch (95%) rename 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch => 0200-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch (100%) rename 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch => 0201-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch (100%) rename 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch => 0202-EFI-console-Do-not-set-colorstate-until-the-first-te.patch (100%) rename 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch => 0203-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch (100%) rename 0205-Use-visual-indentation-in-config.h.in.patch => 0204-Use-visual-indentation-in-config.h.in.patch (100%) rename 0206-Where-present-ensure-config-util.h-precedes-config.h.patch => 0205-Where-present-ensure-config-util.h-precedes-config.h.patch (100%) rename 0207-Drop-gnulib-fix-base64.patch.patch => 0206-Drop-gnulib-fix-base64.patch.patch (100%) rename 0208-Drop-gnulib-no-abort.patch.patch => 0207-Drop-gnulib-no-abort.patch.patch (100%) rename 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch => 0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch (99%) rename 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch => 0209-commands-search-Fix-bug-stopping-iteration-when-no-f.patch (100%) rename 0211-search-new-efidisk-only-option-on-EFI-systems.patch => 0210-search-new-efidisk-only-option-on-EFI-systems.patch (100%) rename 0212-efi-new-connectefi-command.patch => 0211-efi-new-connectefi-command.patch (100%) rename 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch => 0212-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch (100%) rename 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch => 0213-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch (100%) rename 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch => 0214-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch (100%) rename 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch => 0215-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch (100%) create mode 100644 0216-Correct-sorting-of-kernel-names-containing-_.patch diff --git a/0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 100% rename from 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch diff --git a/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch b/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch deleted file mode 100644 index ff1c13ec..00000000 --- a/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch +++ /dev/null @@ -1,475 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robert Marshall -Date: Mon, 16 Mar 2015 14:14:19 -0400 -Subject: [PATCH] Use rpm's sort for grub2-mkconfig - -Add an option for rpm-based systems to use the rpm-sort library to sort -kernels. This avoids problems due to discrepancies between `sort -V` -and rpm. - -Signed-off-by: Robert Marshall -[pjones: fix --enable-rpm-sort configure option] -Signed-off-by: Peter Jones -[thierry.vignaud: fix build with rpm-4.16] -Signed-off-by: Thierry Vignaud -[tim: fix disabling grub-rpm-sort by ./configure] -Signed-off-by: Tim Landscheidt -[javierm: don't check for rpmvercmp in librpm] -Signed-off-by: Javier Martinez Canillas -[rharwood: commit message] -Signed-off-by: Robbie Harwood ---- - configure.ac | 37 ++++++ - Makefile.util.def | 17 +++ - util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ - util/grub-mkconfig_lib.in | 11 +- - util/grub-rpm-sort.8 | 12 ++ - 5 files changed, 357 insertions(+), 1 deletion(-) - create mode 100644 util/grub-rpm-sort.c - create mode 100644 util/grub-rpm-sort.8 - -diff --git a/configure.ac b/configure.ac -index bec8535af70..643a13f9147 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) - grub_TRANSFORM([grub-mkrescue]) - grub_TRANSFORM([grub-probe]) - grub_TRANSFORM([grub-reboot]) -+grub_TRANSFORM([grub-rpm-sort]) - grub_TRANSFORM([grub-script-check]) - grub_TRANSFORM([grub-set-default]) - grub_TRANSFORM([grub-sparc64-setup]) -@@ -95,6 +96,7 @@ grub_TRANSFORM([grub-mkrescue.1]) - grub_TRANSFORM([grub-mkstandalone.3]) - grub_TRANSFORM([grub-ofpathname.3]) - grub_TRANSFORM([grub-probe.3]) -+grub_TRANSFORM([grub-rpm-sort.8]) - grub_TRANSFORM([grub-reboot.3]) - grub_TRANSFORM([grub-render-label.3]) - grub_TRANSFORM([grub-script-check.3]) -@@ -1860,6 +1862,35 @@ fi - - AC_SUBST([LIBDEVMAPPER]) - -+AC_ARG_ENABLE([rpm-sort], -+ [AS_HELP_STRING([--enable-rpm-sort], -+ [enable native rpm sorting of kernels in grub (default=guessed)])]) -+if test x"$enable_rpm_sort" = xno ; then -+ rpm_sort_excuse="explicitly disabled" -+else -+ enable_rpm_sort=yes -+fi -+ -+if test x"$rpm_sort_excuse" = x ; then -+ # Check for rpmlib header. -+ AC_CHECK_HEADER([rpm/rpmlib.h], [], -+ [rpm_sort_excuse="need rpm/rpmlib header"]) -+fi -+ -+if test x"$rpm_sort_excuse" = x ; then -+ # Check for rpmio library. -+ AC_CHECK_LIB([rpmio], [rpmvercmp], [], -+ [rpm_sort_excuse="rpmio missing rpmvercmp"]) -+fi -+ -+if test x"$rpm_sort_excuse" = x ; then -+ LIBRPM="-lrpmio"; -+ AC_DEFINE([HAVE_RPMIO], [1], -+ [Define to 1 if you have the rpmio library.]) -+fi -+ -+AC_SUBST([LIBRPM]) -+ - LIBGEOM= - if test x$host_kernel = xkfreebsd; then - AC_CHECK_LIB([geom], [geom_gettree], [], -@@ -2047,6 +2078,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) - AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) - AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) - AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) -+AM_CONDITIONAL([COND_GRUB_RPM_SORT], [test x$enable_rpm_sort = xyes]) - AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) - if test x$FONT_SOURCE != x ; then - HAVE_FONT_SOURCE=1 -@@ -2168,6 +2200,11 @@ echo grub-mount: Yes - else - echo grub-mount: No "($grub_mount_excuse)" - fi -+if [ x"$rpm_sort_excuse" = x ]; then -+echo grub-rpm-sort: Yes -+else -+echo grub-rpm-sort: No "($rpm_sort_excuse)" -+fi - if [ x"$starfield_excuse" = x ]; then - echo starfield theme: Yes - echo With DejaVuSans font from $DJVU_FONT_SOURCE -diff --git a/Makefile.util.def b/Makefile.util.def -index 2c9b283a230..bc10cc79722 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -703,6 +703,23 @@ program = { - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - }; - -+program = { -+ name = grub-rpm-sort; -+ mansection = 8; -+ installdir = sbin; -+ -+ common = grub-core/kern/emu/misc.c; -+ common = grub-core/kern/emu/argp_common.c; -+ common = grub-core/osdep/init.c; -+ common = util/misc.c; -+ common = util/grub-rpm-sort.c; -+ -+ ldadd = libgrubkern.a; -+ ldadd = grub-core/lib/gnulib/libgnu.a; -+ ldadd = '$(LIBDEVMAPPER) $(LIBRPM)'; -+ condition = COND_GRUB_RPM_SORT; -+}; -+ - script = { - name = grub-mkconfig; - common = util/grub-mkconfig.in; -diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c -new file mode 100644 -index 00000000000..f33bd1ed568 ---- /dev/null -+++ b/util/grub-rpm-sort.c -@@ -0,0 +1,281 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static size_t -+read_file (const char *input, char **ret) -+{ -+ FILE *in; -+ size_t s; -+ size_t sz = 2048; -+ size_t offset = 0; -+ char *text; -+ -+ if (!strcmp(input, "-")) -+ in = stdin; -+ else -+ in = grub_util_fopen(input, "r"); -+ -+ text = xmalloc (sz); -+ -+ if (!in) -+ grub_util_error (_("cannot open `%s': %s"), input, strerror (errno)); -+ -+ while ((s = fread (text + offset, 1, sz - offset, in)) != 0) -+ { -+ offset += s; -+ if (sz - offset == 0) -+ { -+ sz += 2048; -+ text = xrealloc (text, sz); -+ } -+ } -+ -+ text[offset] = '\0'; -+ *ret = text; -+ -+ if (in != stdin) -+ fclose(in); -+ -+ return offset + 1; -+} -+ -+/* returns name/version/release */ -+/* NULL string pointer returned if nothing found */ -+static void -+split_package_string (char *package_string, char **name, -+ char **version, char **release) -+{ -+ char *package_version, *package_release; -+ -+ /* Release */ -+ package_release = strrchr (package_string, '-'); -+ -+ if (package_release != NULL) -+ *package_release++ = '\0'; -+ -+ *release = package_release; -+ -+ /* Version */ -+ package_version = strrchr(package_string, '-'); -+ -+ if (package_version != NULL) -+ *package_version++ = '\0'; -+ -+ *version = package_version; -+ /* Name */ -+ *name = package_string; -+ -+ /* Bubble up non-null values from release to name */ -+ if (*name == NULL) -+ { -+ *name = (*version == NULL ? *release : *version); -+ *version = *release; -+ *release = NULL; -+ } -+ if (*version == NULL) -+ { -+ *version = *release; -+ *release = NULL; -+ } -+} -+ -+/* -+ * package name-version-release comparator for qsort -+ * expects p, q which are pointers to character strings (char *) -+ * which will not be altered in this function -+ */ -+static int -+package_version_compare (const void *p, const void *q) -+{ -+ char *local_p, *local_q; -+ char *lhs_name, *lhs_version, *lhs_release; -+ char *rhs_name, *rhs_version, *rhs_release; -+ int vercmpflag = 0; -+ -+ local_p = alloca (strlen (*(char * const *)p) + 1); -+ local_q = alloca (strlen (*(char * const *)q) + 1); -+ -+ /* make sure these allocated */ -+ assert (local_p); -+ assert (local_q); -+ -+ strcpy (local_p, *(char * const *)p); -+ strcpy (local_q, *(char * const *)q); -+ -+ split_package_string (local_p, &lhs_name, &lhs_version, &lhs_release); -+ split_package_string (local_q, &rhs_name, &rhs_version, &rhs_release); -+ -+ /* Check Name and return if unequal */ -+ vercmpflag = rpmvercmp ((lhs_name == NULL ? "" : lhs_name), -+ (rhs_name == NULL ? "" : rhs_name)); -+ if (vercmpflag != 0) -+ return vercmpflag; -+ -+ /* Check version and return if unequal */ -+ vercmpflag = rpmvercmp ((lhs_version == NULL ? "" : lhs_version), -+ (rhs_version == NULL ? "" : rhs_version)); -+ if (vercmpflag != 0) -+ return vercmpflag; -+ -+ /* Check release and return the version compare value */ -+ vercmpflag = rpmvercmp ((lhs_release == NULL ? "" : lhs_release), -+ (rhs_release == NULL ? "" : rhs_release)); -+ -+ return vercmpflag; -+} -+ -+static void -+add_input (const char *filename, char ***package_names, size_t *n_package_names) -+{ -+ char *orig_input_buffer = NULL; -+ char *input_buffer; -+ char *position_of_newline; -+ char **names = *package_names; -+ char **new_names = NULL; -+ size_t n_names = *n_package_names; -+ -+ if (!*package_names) -+ new_names = names = xmalloc (sizeof (char *) * 2); -+ -+ if (read_file (filename, &orig_input_buffer) < 2) -+ { -+ if (new_names) -+ free (new_names); -+ if (orig_input_buffer) -+ free (orig_input_buffer); -+ return; -+ } -+ -+ input_buffer = orig_input_buffer; -+ while (input_buffer && *input_buffer && -+ (position_of_newline = strchrnul (input_buffer, '\n'))) -+ { -+ size_t sz = position_of_newline - input_buffer; -+ char *new; -+ -+ if (sz == 0) -+ { -+ input_buffer = position_of_newline + 1; -+ continue; -+ } -+ -+ new = xmalloc (sz+1); -+ strncpy (new, input_buffer, sz); -+ new[sz] = '\0'; -+ -+ names = xrealloc (names, sizeof (char *) * (n_names + 1)); -+ names[n_names] = new; -+ n_names++; -+ -+ /* move buffer ahead to next line */ -+ input_buffer = position_of_newline + 1; -+ if (*position_of_newline == '\0') -+ input_buffer = NULL; -+ } -+ -+ free (orig_input_buffer); -+ -+ *package_names = names; -+ *n_package_names = n_names; -+} -+ -+static char * -+help_filter (int key, const char *text, void *input __attribute__ ((unused))) -+{ -+ return (char *)text; -+} -+ -+static struct argp_option options[] = { -+ { 0, } -+}; -+ -+struct arguments -+{ -+ size_t ninputs; -+ size_t input_max; -+ char **inputs; -+}; -+ -+static error_t -+argp_parser (int key, char *arg, struct argp_state *state) -+{ -+ struct arguments *arguments = state->input; -+ switch (key) -+ { -+ case ARGP_KEY_ARG: -+ assert (arguments->ninputs < arguments->input_max); -+ arguments->inputs[arguments->ninputs++] = xstrdup (arg); -+ break; -+ default: -+ return ARGP_ERR_UNKNOWN; -+ } -+ return 0; -+} -+ -+static struct argp argp = { -+ options, argp_parser, N_("[INPUT_FILES]"), -+ N_("Sort a list of strings in RPM version sort order."), -+ NULL, help_filter, NULL -+}; -+ -+int -+main (int argc, char *argv[]) -+{ -+ struct arguments arguments; -+ char **package_names = NULL; -+ size_t n_package_names = 0; -+ int i; -+ -+ grub_util_host_init (&argc, &argv); -+ -+ memset (&arguments, 0, sizeof (struct arguments)); -+ arguments.input_max = argc+1; -+ arguments.inputs = xmalloc ((arguments.input_max + 1) -+ * sizeof (arguments.inputs[0])); -+ memset (arguments.inputs, 0, (arguments.input_max + 1) -+ * sizeof (arguments.inputs[0])); -+ -+ /* Parse our arguments */ -+ if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0) -+ grub_util_error ("%s", _("Error in parsing command line arguments\n")); -+ -+ /* If there's no inputs in argv, add one for stdin */ -+ if (!arguments.ninputs) -+ { -+ arguments.ninputs = 1; -+ arguments.inputs[0] = xmalloc (2); -+ strcpy(arguments.inputs[0], "-"); -+ } -+ -+ for (i = 0; i < arguments.ninputs; i++) -+ add_input(arguments.inputs[i], &package_names, &n_package_names); -+ -+ if (package_names == NULL || n_package_names < 1) -+ grub_util_error ("%s", _("Invalid input\n")); -+ -+ qsort (package_names, n_package_names, sizeof (char *), -+ package_version_compare); -+ -+ /* send sorted list to stdout */ -+ for (i = 0; i < n_package_names; i++) -+ { -+ fprintf (stdout, "%s\n", package_names[i]); -+ free (package_names[i]); -+ } -+ -+ free (package_names); -+ for (i = 0; i < arguments.ninputs; i++) -+ free (arguments.inputs[i]); -+ -+ free (arguments.inputs); -+ -+ return 0; -+} -diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 0f6505bf3b6..42c2ea9ba50 100644 ---- a/util/grub-mkconfig_lib.in -+++ b/util/grub-mkconfig_lib.in -@@ -33,6 +33,9 @@ fi - if test "x$grub_mkrelpath" = x; then - grub_mkrelpath="${bindir}/@grub_mkrelpath@" - fi -+if test "x$grub_rpm_sort" = x; then -+ grub_rpm_sort="${sbindir}/@grub_rpm_sort@" -+fi - - if command -v gettext >/dev/null; then - : -@@ -218,6 +221,12 @@ version_sort () - esac - } - -+if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then -+ kernel_sort="$grub_rpm_sort" -+else -+ kernel_sort=version_sort -+fi -+ - version_test_numeric () - { - version_test_numeric_a="$1" -@@ -234,7 +243,7 @@ version_test_numeric () - version_test_numeric_a="$version_test_numeric_b" - version_test_numeric_b="$version_test_numeric_c" - fi -- if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then -+ if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | "$kernel_sort" | head -n 1 | grep -qx "$version_test_numeric_b" ; then - return 0 - else - return 1 -diff --git a/util/grub-rpm-sort.8 b/util/grub-rpm-sort.8 -new file mode 100644 -index 00000000000..8ce21488448 ---- /dev/null -+++ b/util/grub-rpm-sort.8 -@@ -0,0 +1,12 @@ -+.TH GRUB-RPM-SORT 8 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-rpm-sort\fR \(em Sort input according to RPM version compare. -+ -+.SH SYNOPSIS -+\fBgrub-rpm-sort\fR [OPTIONS]. -+ -+.SH DESCRIPTION -+You should not normally run this program directly. Use grub-mkconfig instead. -+ -+.SH SEE ALSO -+.BR "info grub" diff --git a/0035-Add-friendly-grub2-password-config-tool-985962.patch b/0034-Add-friendly-grub2-password-config-tool-985962.patch similarity index 98% rename from 0035-Add-friendly-grub2-password-config-tool-985962.patch rename to 0034-Add-friendly-grub2-password-config-tool-985962.patch index 2d6f18a6..0bc17f76 100644 --- a/0035-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0034-Add-friendly-grub2-password-config-tool-985962.patch @@ -27,7 +27,7 @@ Andy Lutomirski create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index 643a13f9147..25e1abb59b9 100644 +index bec8535af70..22d289eacb9 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -35,11 +35,11 @@ index 643a13f9147..25e1abb59b9 100644 grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-reboot]) +grub_TRANSFORM([grub-set-password]) - grub_TRANSFORM([grub-rpm-sort]) grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) + grub_TRANSFORM([grub-sparc64-setup]) diff --git a/Makefile.util.def b/Makefile.util.def -index bc10cc79722..8ca4c14f0b9 100644 +index 2c9b283a230..4ee22c5daad 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -452,6 +452,12 @@ script = { @@ -55,7 +55,7 @@ index bc10cc79722..8ca4c14f0b9 100644 script = { name = '10_windows'; common = util/grub.d/10_windows.in; -@@ -741,6 +747,13 @@ script = { +@@ -724,6 +730,13 @@ script = { installdir = sbin; }; diff --git a/0036-tcp-add-window-scaling-support.patch b/0035-tcp-add-window-scaling-support.patch similarity index 100% rename from 0036-tcp-add-window-scaling-support.patch rename to 0035-tcp-add-window-scaling-support.patch diff --git a/0037-efinet-and-bootp-add-support-for-dhcpv6.patch b/0036-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 100% rename from 0037-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0036-efinet-and-bootp-add-support-for-dhcpv6.patch diff --git a/0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 98% rename from 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index bf78c813..e9518f84 100644 --- a/0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -23,7 +23,7 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 25e1abb59b9..58e57a745fa 100644 +index 22d289eacb9..c02898b7568 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) @@ -34,7 +34,7 @@ index 25e1abb59b9..58e57a745fa 100644 grub_TRANSFORM([grub-glue-efi]) grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) -@@ -82,6 +83,7 @@ grub_TRANSFORM([grub-file]) +@@ -81,6 +82,7 @@ grub_TRANSFORM([grub-file]) grub_TRANSFORM([grub-bios-setup.3]) grub_TRANSFORM([grub-editenv.1]) grub_TRANSFORM([grub-fstest.3]) @@ -43,10 +43,10 @@ index 25e1abb59b9..58e57a745fa 100644 grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) diff --git a/Makefile.util.def b/Makefile.util.def -index 8ca4c14f0b9..43a1c7453b1 100644 +index 4ee22c5daad..18a92427767 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -733,6 +733,13 @@ script = { +@@ -716,6 +716,13 @@ script = { installdir = sbin; }; diff --git a/0039-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch similarity index 100% rename from 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch rename to 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch diff --git a/0040-Make-grub_fatal-also-backtrace.patch b/0039-Make-grub_fatal-also-backtrace.patch similarity index 100% rename from 0040-Make-grub_fatal-also-backtrace.patch rename to 0039-Make-grub_fatal-also-backtrace.patch diff --git a/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0040-Fix-up-some-man-pages-rpmdiff-noticed.patch similarity index 96% rename from 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch rename to 0040-Fix-up-some-man-pages-rpmdiff-noticed.patch index be584175..b4f39c00 100644 --- a/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0040-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -13,10 +13,10 @@ Subject: [PATCH] Fix up some man pages rpmdiff noticed. create mode 100644 util/grub-syslinux2cfg.1 diff --git a/configure.ac b/configure.ac -index 58e57a745fa..a0030632220 100644 +index c02898b7568..24f3be54bca 100644 --- a/configure.ac +++ b/configure.ac -@@ -87,6 +87,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) +@@ -86,6 +86,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) grub_TRANSFORM([grub-glue-efi.3]) grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) @@ -24,7 +24,7 @@ index 58e57a745fa..a0030632220 100644 grub_TRANSFORM([grub-menulst2cfg.1]) grub_TRANSFORM([grub-mkconfig.1]) grub_TRANSFORM([grub-mkfont.3]) -@@ -105,6 +106,7 @@ grub_TRANSFORM([grub-render-label.3]) +@@ -103,6 +104,7 @@ grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) grub_TRANSFORM([grub-set-default.1]) grub_TRANSFORM([grub-sparc64-setup.3]) diff --git a/0042-Make-our-info-pages-say-grub2-where-appropriate.patch b/0041-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 100% rename from 0042-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0041-Make-our-info-pages-say-grub2-where-appropriate.patch diff --git a/0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0042-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 100% rename from 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0042-macos-just-build-chainloader-entries-don-t-try-any-x.patch diff --git a/0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0043-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 100% rename from 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0043-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch diff --git a/0045-export-btrfs_subvol-and-btrfs_subvolid.patch b/0044-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 100% rename from 0045-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0044-export-btrfs_subvol-and-btrfs_subvolid.patch diff --git a/0046-grub2-btrfs-03-follow_default.patch b/0045-grub2-btrfs-03-follow_default.patch similarity index 100% rename from 0046-grub2-btrfs-03-follow_default.patch rename to 0045-grub2-btrfs-03-follow_default.patch diff --git a/0047-grub2-btrfs-04-grub2-install.patch b/0046-grub2-btrfs-04-grub2-install.patch similarity index 100% rename from 0047-grub2-btrfs-04-grub2-install.patch rename to 0046-grub2-btrfs-04-grub2-install.patch diff --git a/0048-grub2-btrfs-05-grub2-mkconfig.patch b/0047-grub2-btrfs-05-grub2-mkconfig.patch similarity index 98% rename from 0048-grub2-btrfs-05-grub2-mkconfig.patch rename to 0047-grub2-btrfs-05-grub2-mkconfig.patch index 5afd183c..6fb1d640 100644 --- a/0048-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0047-grub2-btrfs-05-grub2-mkconfig.patch @@ -27,10 +27,10 @@ index 005f093809b..535c0f02499 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 42c2ea9ba50..fafeac95061 100644 +index 0f6505bf3b6..5e96f6cc5d2 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in -@@ -52,7 +52,11 @@ grub_warn () +@@ -49,7 +49,11 @@ grub_warn () make_system_path_relative_to_its_root () { diff --git a/0049-grub2-btrfs-06-subvol-mount.patch b/0048-grub2-btrfs-06-subvol-mount.patch similarity index 100% rename from 0049-grub2-btrfs-06-subvol-mount.patch rename to 0048-grub2-btrfs-06-subvol-mount.patch diff --git a/0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0049-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 100% rename from 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0049-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch diff --git a/0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0050-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 100% rename from 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0050-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch diff --git a/0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0051-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 100% rename from 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0051-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch diff --git a/0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0052-Use-grub_efi_.-memory-helpers-where-reasonable.patch similarity index 100% rename from 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename to 0052-Use-grub_efi_.-memory-helpers-where-reasonable.patch diff --git a/0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0053-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch similarity index 100% rename from 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename to 0053-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch diff --git a/0055-don-t-use-int-for-efi-status.patch b/0054-don-t-use-int-for-efi-status.patch similarity index 100% rename from 0055-don-t-use-int-for-efi-status.patch rename to 0054-don-t-use-int-for-efi-status.patch diff --git a/0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0055-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 100% rename from 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0055-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch diff --git a/0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0056-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 100% rename from 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0056-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch diff --git a/0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0057-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 100% rename from 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0057-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch diff --git a/0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0058-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch similarity index 100% rename from 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename to 0058-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch diff --git a/0060-align-struct-efi_variable-better.patch b/0059-align-struct-efi_variable-better.patch similarity index 100% rename from 0060-align-struct-efi_variable-better.patch rename to 0059-align-struct-efi_variable-better.patch diff --git a/0061-Add-BLS-support-to-grub-mkconfig.patch b/0060-Add-BLS-support-to-grub-mkconfig.patch similarity index 99% rename from 0061-Add-BLS-support-to-grub-mkconfig.patch rename to 0060-Add-BLS-support-to-grub-mkconfig.patch index 7211afba..6feb7474 100644 --- a/0061-Add-BLS-support-to-grub-mkconfig.patch +++ b/0060-Add-BLS-support-to-grub-mkconfig.patch @@ -89,7 +89,7 @@ index 535c0f02499..f55339a3f64 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index fafeac95061..d8bb4069360 100644 +index 5e96f6cc5d2..301d8a8a1e4 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -30,6 +30,9 @@ fi @@ -102,7 +102,7 @@ index fafeac95061..d8bb4069360 100644 if test "x$grub_mkrelpath" = x; then grub_mkrelpath="${bindir}/@grub_mkrelpath@" fi -@@ -125,8 +128,19 @@ EOF +@@ -122,8 +125,19 @@ EOF fi } @@ -122,7 +122,7 @@ index fafeac95061..d8bb4069360 100644 old_ifs="$IFS" IFS=' ' -@@ -161,18 +175,18 @@ prepare_grub_to_access_device () +@@ -158,18 +172,18 @@ prepare_grub_to_access_device () # otherwise set root as per value in device.map. fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`" if [ "x$fs_hint" != x ]; then diff --git a/0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0061-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 100% rename from 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0061-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch diff --git a/0063-Add-linux-and-initrd-commands-for-grub-emu.patch b/0062-Add-linux-and-initrd-commands-for-grub-emu.patch similarity index 100% rename from 0063-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0062-Add-linux-and-initrd-commands-for-grub-emu.patch diff --git a/0064-Add-grub2-switch-to-blscfg.patch b/0063-Add-grub2-switch-to-blscfg.patch similarity index 99% rename from 0064-Add-grub2-switch-to-blscfg.patch rename to 0063-Add-grub2-switch-to-blscfg.patch index fca07e64..0fe9cc5a 100644 --- a/0064-Add-grub2-switch-to-blscfg.patch +++ b/0063-Add-grub2-switch-to-blscfg.patch @@ -20,10 +20,10 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index 43a1c7453b1..a90879fa9ba 100644 +index 18a92427767..88f55e35c47 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1365,6 +1365,13 @@ program = { +@@ -1348,6 +1348,13 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; diff --git a/0065-make-better-backtraces.patch b/0064-make-better-backtraces.patch similarity index 99% rename from 0065-make-better-backtraces.patch rename to 0064-make-better-backtraces.patch index 63765671..7cdc8c0d 100644 --- a/0065-make-better-backtraces.patch +++ b/0064-make-better-backtraces.patch @@ -38,7 +38,7 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index a90879fa9ba..48512bc6311 100644 +index 88f55e35c47..bda9fd12111 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -51,6 +51,12 @@ library = { diff --git a/0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0065-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 100% rename from 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0065-normal-don-t-draw-our-startup-message-if-debug-is-se.patch diff --git a/0067-Work-around-some-minor-include-path-weirdnesses.patch b/0066-Work-around-some-minor-include-path-weirdnesses.patch similarity index 100% rename from 0067-Work-around-some-minor-include-path-weirdnesses.patch rename to 0066-Work-around-some-minor-include-path-weirdnesses.patch diff --git a/0068-Make-it-possible-to-enabled-build-id-sha1.patch b/0067-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 95% rename from 0068-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0067-Make-it-possible-to-enabled-build-id-sha1.patch index f68fc58b..1a84b83c 100644 --- a/0068-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0067-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index a0030632220..b50fb2e9897 100644 +index 24f3be54bca..a4ca2ec542e 100644 --- a/configure.ac +++ b/configure.ac -@@ -1470,7 +1470,15 @@ grub_PROG_TARGET_CC +@@ -1468,7 +1468,15 @@ grub_PROG_TARGET_CC if test "x$TARGET_APPLE_LINKER" != x1 ; then grub_PROG_OBJCOPY_ABSOLUTE fi diff --git a/0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0068-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 100% rename from 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0068-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch diff --git a/0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0069-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 100% rename from 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0069-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch diff --git a/0071-Fixup-for-newer-compiler.patch b/0070-Fixup-for-newer-compiler.patch similarity index 100% rename from 0071-Fixup-for-newer-compiler.patch rename to 0070-Fixup-for-newer-compiler.patch diff --git a/0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0071-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 100% rename from 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0071-Don-t-attempt-to-export-the-start-and-_start-symbols.patch diff --git a/0073-Fixup-for-newer-compiler.patch b/0072-Fixup-for-newer-compiler.patch similarity index 100% rename from 0073-Fixup-for-newer-compiler.patch rename to 0072-Fixup-for-newer-compiler.patch diff --git a/0074-Add-support-for-non-Ethernet-network-cards.patch b/0073-Add-support-for-non-Ethernet-network-cards.patch similarity index 100% rename from 0074-Add-support-for-non-Ethernet-network-cards.patch rename to 0073-Add-support-for-non-Ethernet-network-cards.patch diff --git a/0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0074-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 100% rename from 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0074-net-read-bracketed-ipv6-addrs-and-port-numbers.patch diff --git a/0076-bootp-New-net_bootp6-command.patch b/0075-bootp-New-net_bootp6-command.patch similarity index 100% rename from 0076-bootp-New-net_bootp6-command.patch rename to 0075-bootp-New-net_bootp6-command.patch diff --git a/0077-efinet-UEFI-IPv6-PXE-support.patch b/0076-efinet-UEFI-IPv6-PXE-support.patch similarity index 100% rename from 0077-efinet-UEFI-IPv6-PXE-support.patch rename to 0076-efinet-UEFI-IPv6-PXE-support.patch diff --git a/0078-grub.texi-Add-net_bootp6-doument.patch b/0077-grub.texi-Add-net_bootp6-doument.patch similarity index 100% rename from 0078-grub.texi-Add-net_bootp6-doument.patch rename to 0077-grub.texi-Add-net_bootp6-doument.patch diff --git a/0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0078-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 100% rename from 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0078-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch diff --git a/0080-efinet-Setting-network-from-UEFI-device-path.patch b/0079-efinet-Setting-network-from-UEFI-device-path.patch similarity index 100% rename from 0080-efinet-Setting-network-from-UEFI-device-path.patch rename to 0079-efinet-Setting-network-from-UEFI-device-path.patch diff --git a/0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0080-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 100% rename from 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0080-efinet-Setting-DNS-server-from-UEFI-protocol.patch diff --git a/0082-Support-UEFI-networking-protocols.patch b/0081-Support-UEFI-networking-protocols.patch similarity index 100% rename from 0082-Support-UEFI-networking-protocols.patch rename to 0081-Support-UEFI-networking-protocols.patch diff --git a/0083-AUDIT-0-http-boot-tracker-bug.patch b/0082-AUDIT-0-http-boot-tracker-bug.patch similarity index 100% rename from 0083-AUDIT-0-http-boot-tracker-bug.patch rename to 0082-AUDIT-0-http-boot-tracker-bug.patch diff --git a/0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0083-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 100% rename from 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0083-grub-editenv-Add-incr-command-to-increment-integer-v.patch diff --git a/0085-Add-auto-hide-menu-support.patch b/0084-Add-auto-hide-menu-support.patch similarity index 99% rename from 0085-Add-auto-hide-menu-support.patch rename to 0084-Add-auto-hide-menu-support.patch index 863cd053..9c6a67e6 100644 --- a/0085-Add-auto-hide-menu-support.patch +++ b/0084-Add-auto-hide-menu-support.patch @@ -49,7 +49,7 @@ Changes in v2: create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index 48512bc6311..314e6f2acf8 100644 +index bda9fd12111..cb8e3c3270d 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { diff --git a/0086-Add-grub-set-bootflag-utility.patch b/0085-Add-grub-set-bootflag-utility.patch similarity index 99% rename from 0086-Add-grub-set-bootflag-utility.patch rename to 0085-Add-grub-set-bootflag-utility.patch index e39f8beb..9e787163 100644 --- a/0086-Add-grub-set-bootflag-utility.patch +++ b/0085-Add-grub-set-bootflag-utility.patch @@ -48,10 +48,10 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub-set-bootflag.1 diff --git a/Makefile.util.def b/Makefile.util.def -index 314e6f2acf8..0b85a7fce4a 100644 +index cb8e3c3270d..d066652e9bb 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1446,3 +1446,10 @@ program = { +@@ -1429,3 +1429,10 @@ program = { ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; diff --git a/0087-docs-Add-grub-boot-indeterminate.service-example.patch b/0086-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0087-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0086-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0088-gentpl-add-disable-support.patch b/0087-gentpl-add-disable-support.patch similarity index 100% rename from 0088-gentpl-add-disable-support.patch rename to 0087-gentpl-add-disable-support.patch diff --git a/0089-gentpl-add-pc-firmware-type.patch b/0088-gentpl-add-pc-firmware-type.patch similarity index 100% rename from 0089-gentpl-add-pc-firmware-type.patch rename to 0088-gentpl-add-pc-firmware-type.patch diff --git a/0090-efinet-also-use-the-firmware-acceleration-for-http.patch b/0089-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0090-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0089-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0090-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0090-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 97% rename from 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index ee2216e5..ce9286a7 100644 --- a/0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index b50fb2e9897..b27573b3de5 100644 +index a4ca2ec542e..f685f300327 100644 --- a/configure.ac +++ b/configure.ac -@@ -877,11 +877,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p +@@ -875,11 +875,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" fi @@ -45,7 +45,7 @@ index b50fb2e9897..b27573b3de5 100644 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ grub_cv_target_cc_soft_float=no if test "x$target_cpu" = xarm64; then -@@ -2011,6 +2023,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +@@ -1980,6 +1992,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" diff --git a/0093-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0092-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0092-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0094-Rework-how-the-fdt-command-builds.patch b/0093-Rework-how-the-fdt-command-builds.patch similarity index 100% rename from 0094-Rework-how-the-fdt-command-builds.patch rename to 0093-Rework-how-the-fdt-command-builds.patch diff --git a/0095-Disable-non-wordsize-allocations-on-arm.patch b/0094-Disable-non-wordsize-allocations-on-arm.patch similarity index 93% rename from 0095-Disable-non-wordsize-allocations-on-arm.patch rename to 0094-Disable-non-wordsize-allocations-on-arm.patch index e28041a1..54a4ccbf 100644 --- a/0095-Disable-non-wordsize-allocations-on-arm.patch +++ b/0094-Disable-non-wordsize-allocations-on-arm.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index b27573b3de5..bb4e05ceef3 100644 +index f685f300327..8fd57b709ff 100644 --- a/configure.ac +++ b/configure.ac -@@ -1288,6 +1288,26 @@ if test "x$target_cpu" = xarm; then +@@ -1286,6 +1286,26 @@ if test "x$target_cpu" = xarm; then done ]) diff --git a/0096-Prepend-prefix-when-HTTP-path-is-relative.patch b/0095-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 100% rename from 0096-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0095-Prepend-prefix-when-HTTP-path-is-relative.patch diff --git a/0097-Make-grub_error-more-verbose.patch b/0096-Make-grub_error-more-verbose.patch similarity index 100% rename from 0097-Make-grub_error-more-verbose.patch rename to 0096-Make-grub_error-more-verbose.patch diff --git a/0098-Make-reset-an-alias-for-the-reboot-command.patch b/0097-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0098-Make-reset-an-alias-for-the-reboot-command.patch rename to 0097-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0099-Add-a-version-command.patch b/0098-Add-a-version-command.patch similarity index 98% rename from 0099-Add-a-version-command.patch rename to 0098-Add-a-version-command.patch index bf3b4b80..f4f44048 100644 --- a/0099-Add-a-version-command.patch +++ b/0098-Add-a-version-command.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index bb4e05ceef3..59ccda24475 100644 +index 8fd57b709ff..31a08ff9b8e 100644 --- a/configure.ac +++ b/configure.ac -@@ -312,6 +312,19 @@ AC_SUBST(target_cpu) +@@ -310,6 +310,19 @@ AC_SUBST(target_cpu) AC_SUBST(platform) # Define default variables diff --git a/0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0099-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 100% rename from 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0099-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch diff --git a/0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0100-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 100% rename from 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0100-arm-arm64-loader-Better-memory-allocation-and-error-.patch diff --git a/0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0101-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 100% rename from 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0101-Try-to-pick-better-locations-for-kernel-and-initrd.patch diff --git a/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 93% rename from 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index e6cd8b47..0fe538e6 100644 --- a/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -14,9 +14,8 @@ Signed-off-by: Peter Jones util/grub-menulst2cfg.c | 2 +- util/grub-mkfont.c | 13 +++++++------ util/grub-probe.c | 2 +- - util/grub-rpm-sort.c | 2 +- util/setup.c | 2 +- - 11 files changed, 18 insertions(+), 17 deletions(-) + 10 files changed, 17 insertions(+), 16 deletions(-) diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c index eeea092752d..f08a1bb8415 100644 @@ -185,19 +184,6 @@ index c08e46bbb40..c6fac732b40 100644 for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) if (strcmp (arg, targets[i]) == 0) -diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c -index f33bd1ed568..8345944105f 100644 ---- a/util/grub-rpm-sort.c -+++ b/util/grub-rpm-sort.c -@@ -232,7 +232,7 @@ main (int argc, char *argv[]) - struct arguments arguments; - char **package_names = NULL; - size_t n_package_names = 0; -- int i; -+ unsigned int i; - - grub_util_host_init (&argc, &argv); - diff --git a/util/setup.c b/util/setup.c index da5f2c07f50..8b22bb8ccac 100644 --- a/util/setup.c diff --git a/0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 93% rename from 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index 1fa705e6..0ea153b2 100644 --- a/0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index 59ccda24475..6eb297fdbf6 100644 +index 31a08ff9b8e..efc871a6732 100644 --- a/configure.ac +++ b/configure.ac -@@ -1480,11 +1480,11 @@ fi +@@ -1478,11 +1478,11 @@ fi # Set them to their new values for the tests below. CC="$TARGET_CC" if test x"$platform" = xemu ; then @@ -29,7 +29,7 @@ index 59ccda24475..6eb297fdbf6 100644 fi CPPFLAGS="$TARGET_CPPFLAGS" -@@ -2047,6 +2047,14 @@ if test x"$enable_werror" != xno ; then +@@ -2016,6 +2016,14 @@ if test x"$enable_werror" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Werror" fi diff --git a/0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0104-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0104-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0105-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0105-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0106-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 100% rename from 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0106-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch diff --git a/0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0107-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 100% rename from 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0107-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch diff --git a/0109-Fix-getroot.c-s-trampolines.patch b/0108-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0109-Fix-getroot.c-s-trampolines.patch rename to 0108-Fix-getroot.c-s-trampolines.patch diff --git a/0110-Do-not-allow-stack-trampolines-anywhere.patch b/0109-Do-not-allow-stack-trampolines-anywhere.patch similarity index 93% rename from 0110-Do-not-allow-stack-trampolines-anywhere.patch rename to 0109-Do-not-allow-stack-trampolines-anywhere.patch index 2a3247af..d8befae5 100644 --- a/0110-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0109-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 6eb297fdbf6..c6bd965f1f9 100644 +index efc871a6732..b45ddb2292f 100644 --- a/configure.ac +++ b/configure.ac -@@ -2055,6 +2055,9 @@ if test x"$enable_wextra" != xno ; then +@@ -2024,6 +2024,9 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi diff --git a/0111-Reimplement-boot_counter.patch b/0110-Reimplement-boot_counter.patch similarity index 99% rename from 0111-Reimplement-boot_counter.patch rename to 0110-Reimplement-boot_counter.patch index a203929f..80213d7e 100644 --- a/0111-Reimplement-boot_counter.patch +++ b/0110-Reimplement-boot_counter.patch @@ -23,7 +23,7 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index 0b85a7fce4a..27a13bc734e 100644 +index d066652e9bb..e10fe766d1d 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { diff --git a/0112-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0111-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 100% rename from 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0111-Fix-menu-entry-selection-based-on-ID-and-title.patch diff --git a/0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0112-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 100% rename from 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0112-Make-the-menu-entry-users-option-argument-to-be-opti.patch diff --git a/0114-Add-efi-export-env-and-efi-load-env-commands.patch b/0113-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 100% rename from 0114-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0113-Add-efi-export-env-and-efi-load-env-commands.patch diff --git a/0115-Make-it-possible-to-subtract-conditions-from-debug.patch b/0114-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 100% rename from 0115-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0114-Make-it-possible-to-subtract-conditions-from-debug.patch diff --git a/0116-Export-all-variables-from-the-initial-context-when-c.patch b/0115-Export-all-variables-from-the-initial-context-when-c.patch similarity index 100% rename from 0116-Export-all-variables-from-the-initial-context-when-c.patch rename to 0115-Export-all-variables-from-the-initial-context-when-c.patch diff --git a/0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 99% rename from 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index 92f259dc..f0cc94e8 100644 --- a/0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -21,7 +21,7 @@ Signed-off-by: Robbie Harwood rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index 27a13bc734e..2e6ad979c3e 100644 +index e10fe766d1d..b4ce5383b76 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -459,14 +459,14 @@ script = { diff --git a/0118-Fix-systemctl-kexec-exit-status-check.patch b/0117-Fix-systemctl-kexec-exit-status-check.patch similarity index 100% rename from 0118-Fix-systemctl-kexec-exit-status-check.patch rename to 0117-Fix-systemctl-kexec-exit-status-check.patch diff --git a/0119-Print-grub-emu-linux-loader-messages-as-debug.patch b/0118-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 100% rename from 0119-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0118-Print-grub-emu-linux-loader-messages-as-debug.patch diff --git a/0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0119-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 100% rename from 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0119-Don-t-assume-that-boot-commands-will-only-return-on-.patch diff --git a/0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0120-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0120-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0121-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0121-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0122-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 100% rename from 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0122-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0124-Add-start-symbol-for-RISC-V.patch b/0123-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0124-Add-start-symbol-for-RISC-V.patch rename to 0123-Add-start-symbol-for-RISC-V.patch diff --git a/0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0124-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 100% rename from 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0124-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0125-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 100% rename from 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0125-efi-http-Export-fw-http-_path-variables-to-make-them.patch diff --git a/0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0126-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0126-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0127-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0127-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0128-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0128-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0129-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0129-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0130-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 100% rename from 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0130-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch diff --git a/0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0131-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 100% rename from 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0131-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0132-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 100% rename from 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0132-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0133-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 100% rename from 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0133-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0134-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 100% rename from 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0134-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch diff --git a/0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0135-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 100% rename from 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0135-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch diff --git a/0137-efi-dhcp-fix-some-allocation-error-checking.patch b/0136-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0137-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0136-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0138-efi-http-fix-some-allocation-error-checking.patch b/0137-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0138-efi-http-fix-some-allocation-error-checking.patch rename to 0137-efi-http-fix-some-allocation-error-checking.patch diff --git a/0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0138-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0138-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0139-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 100% rename from 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0139-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch diff --git a/0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0140-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 100% rename from 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0140-linuxefi-fail-kernel-validation-without-shim-protoco.patch diff --git a/0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0141-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 100% rename from 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0141-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch diff --git a/0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0143-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0144-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0144-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0145-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0145-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 99% rename from 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch index 8e2481e7..c76d8688 100644 --- a/0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch +++ b/0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -65,7 +65,7 @@ Signed-off-by: Hans de Goede create mode 100644 util/systemd/systemd-integration.sh.in diff --git a/Makefile.util.def b/Makefile.util.def -index 2e6ad979c3e..9927c2cfd6a 100644 +index b4ce5383b76..6366442129d 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -470,6 +470,12 @@ script = { diff --git a/0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0147-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0147-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0148-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 100% rename from 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0148-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0150-grub-install-disable-support-for-EFI-platforms.patch b/0149-grub-install-disable-support-for-EFI-platforms.patch similarity index 100% rename from 0150-grub-install-disable-support-for-EFI-platforms.patch rename to 0149-grub-install-disable-support-for-EFI-platforms.patch diff --git a/0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 95% rename from 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch index d216284c..743e8ad1 100644 --- a/0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,10 +15,10 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index c6bd965f1f9..3c808a72230 100644 +index b45ddb2292f..6b19c489cb0 100644 --- a/configure.ac +++ b/configure.ac -@@ -1613,6 +1613,17 @@ else +@@ -1611,6 +1611,17 @@ else fi AC_SUBST([BOOT_TIME_STATS]) @@ -36,7 +36,7 @@ index c6bd965f1f9..3c808a72230 100644 AC_ARG_ENABLE([grub-emu-sdl], [AS_HELP_STRING([--enable-grub-emu-sdl], [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) -@@ -2194,6 +2205,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) +@@ -2162,6 +2173,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) @@ -44,7 +44,7 @@ index c6bd965f1f9..3c808a72230 100644 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) -@@ -2289,6 +2301,12 @@ else +@@ -2257,6 +2269,12 @@ else echo With boot time statistics: No fi diff --git a/0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0151-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 100% rename from 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0151-Added-debug-statements-to-grub_disk_open-and-grub_di.patch diff --git a/0153-Introduce-function-grub_debug_is_enabled-void-return.patch b/0152-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 100% rename from 0153-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0152-Introduce-function-grub_debug_is_enabled-void-return.patch diff --git a/0154-Don-t-clear-screen-when-debugging-is-enabled.patch b/0153-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 100% rename from 0154-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0153-Don-t-clear-screen-when-debugging-is-enabled.patch diff --git a/0155-grub_file_-instrumentation-new-file-debug-tag.patch b/0154-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0155-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0154-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0156-ieee1275-Avoiding-many-unecessary-open-close.patch b/0155-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0156-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0155-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0156-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0156-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0158-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0157-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0157-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0158-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 100% rename from 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0158-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0159-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 100% rename from 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0159-Add-suport-for-signing-grub-with-an-appended-signatu.patch diff --git a/0161-docs-grub-Document-signing-grub-under-UEFI.patch b/0160-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0161-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0160-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0161-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0161-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0162-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0162-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0164-pgp-factor-out-rsa_pad.patch b/0163-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0164-pgp-factor-out-rsa_pad.patch rename to 0163-pgp-factor-out-rsa_pad.patch diff --git a/0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0164-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0164-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0165-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0165-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0167-libtasn1-import-libtasn1-4.16.0.patch b/0166-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0167-libtasn1-import-libtasn1-4.16.0.patch rename to 0166-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0168-libtasn1-disable-code-not-needed-in-grub.patch b/0167-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0168-libtasn1-disable-code-not-needed-in-grub.patch rename to 0167-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0169-libtasn1-changes-for-grub-compatibility.patch b/0168-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0169-libtasn1-changes-for-grub-compatibility.patch rename to 0168-libtasn1-changes-for-grub-compatibility.patch diff --git a/0170-libtasn1-compile-into-asn1-module.patch b/0169-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0170-libtasn1-compile-into-asn1-module.patch rename to 0169-libtasn1-compile-into-asn1-module.patch diff --git a/0171-test_asn1-test-module-for-libtasn1.patch b/0170-test_asn1-test-module-for-libtasn1.patch similarity index 99% rename from 0171-test_asn1-test-module-for-libtasn1.patch rename to 0170-test_asn1-test-module-for-libtasn1.patch index b659558b..a2f4d547 100644 --- a/0171-test_asn1-test-module-for-libtasn1.patch +++ b/0170-test_asn1-test-module-for-libtasn1.patch @@ -51,10 +51,10 @@ Signed-off-by: Daniel Axtens create mode 100644 tests/test_asn1.in diff --git a/Makefile.util.def b/Makefile.util.def -index 9927c2cfd6a..3f191aa8095 100644 +index 6366442129d..d04b3fe68a1 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1306,6 +1306,12 @@ script = { +@@ -1289,6 +1289,12 @@ script = { common = tests/syslinux_test.in; }; diff --git a/0172-grub-install-support-embedding-x509-certificates.patch b/0171-grub-install-support-embedding-x509-certificates.patch similarity index 100% rename from 0172-grub-install-support-embedding-x509-certificates.patch rename to 0171-grub-install-support-embedding-x509-certificates.patch diff --git a/0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0172-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0172-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0173-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0173-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0175-appended-signatures-support-verifying-appended-signa.patch b/0174-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0175-appended-signatures-support-verifying-appended-signa.patch rename to 0174-appended-signatures-support-verifying-appended-signa.patch diff --git a/0176-appended-signatures-verification-tests.patch b/0175-appended-signatures-verification-tests.patch similarity index 100% rename from 0176-appended-signatures-verification-tests.patch rename to 0175-appended-signatures-verification-tests.patch diff --git a/0177-appended-signatures-documentation.patch b/0176-appended-signatures-documentation.patch similarity index 100% rename from 0177-appended-signatures-documentation.patch rename to 0176-appended-signatures-documentation.patch diff --git a/0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0177-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 100% rename from 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0177-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch diff --git a/0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0178-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0178-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0180-ieee1275-claim-more-memory.patch b/0179-ieee1275-claim-more-memory.patch similarity index 100% rename from 0180-ieee1275-claim-more-memory.patch rename to 0179-ieee1275-claim-more-memory.patch diff --git a/0181-ieee1275-request-memory-with-ibm-client-architecture.patch b/0180-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0181-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0180-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0181-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0181-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0183-ieee1275-ofdisk-retry-on-open-failure.patch b/0182-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0183-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0182-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0183-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 100% rename from 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0183-Allow-chainloading-EFI-apps-from-loop-mounts.patch diff --git a/0185-efinet-Add-DHCP-proxy-support.patch b/0184-efinet-Add-DHCP-proxy-support.patch similarity index 100% rename from 0185-efinet-Add-DHCP-proxy-support.patch rename to 0184-efinet-Add-DHCP-proxy-support.patch diff --git a/0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0185-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0185-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0186-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 100% rename from 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0186-Don-t-update-the-cmdline-when-generating-legacy-menu.patch diff --git a/0188-Suppress-gettext-error-message.patch b/0187-Suppress-gettext-error-message.patch similarity index 100% rename from 0188-Suppress-gettext-error-message.patch rename to 0187-Suppress-gettext-error-message.patch diff --git a/0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0188-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0188-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0189-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 100% rename from 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0189-templates-Check-for-EFI-at-runtime-instead-of-config.patch diff --git a/0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0190-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 100% rename from 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0190-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0191-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 100% rename from 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0191-arm64-Fix-EFI-loader-kernel-image-allocation.patch diff --git a/0193-normal-main-Discover-the-device-to-read-the-config-f.patch b/0192-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 100% rename from 0193-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0192-normal-main-Discover-the-device-to-read-the-config-f.patch diff --git a/0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0193-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 100% rename from 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0193-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch diff --git a/0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0194-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0194-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0196-Print-module-name-on-license-check-failure.patch b/0195-Print-module-name-on-license-check-failure.patch similarity index 100% rename from 0196-Print-module-name-on-license-check-failure.patch rename to 0195-Print-module-name-on-license-check-failure.patch diff --git a/0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0196-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 100% rename from 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0196-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/0198-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0197-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 100% rename from 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0197-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0198-fs-btrfs-Use-full-btrfs-bootloader-area.patch similarity index 100% rename from 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch rename to 0198-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/0200-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0199-Add-Fedora-location-of-DejaVu-SANS-font.patch similarity index 95% rename from 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch rename to 0199-Add-Fedora-location-of-DejaVu-SANS-font.patch index eb76649e..493484c0 100644 --- a/0200-Add-Fedora-location-of-DejaVu-SANS-font.patch +++ b/0199-Add-Fedora-location-of-DejaVu-SANS-font.patch @@ -16,10 +16,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 3c808a72230..3527f069ab2 100644 +index 6b19c489cb0..0510afe0172 100644 --- a/configure.ac +++ b/configure.ac -@@ -1812,7 +1812,7 @@ fi +@@ -1810,7 +1810,7 @@ fi if test x"$starfield_excuse" = x; then for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do diff --git a/0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0200-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch similarity index 100% rename from 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch rename to 0200-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch diff --git a/0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0201-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch similarity index 100% rename from 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch rename to 0201-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch diff --git a/0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0202-EFI-console-Do-not-set-colorstate-until-the-first-te.patch similarity index 100% rename from 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch rename to 0202-EFI-console-Do-not-set-colorstate-until-the-first-te.patch diff --git a/0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0203-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch similarity index 100% rename from 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch rename to 0203-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch diff --git a/0205-Use-visual-indentation-in-config.h.in.patch b/0204-Use-visual-indentation-in-config.h.in.patch similarity index 100% rename from 0205-Use-visual-indentation-in-config.h.in.patch rename to 0204-Use-visual-indentation-in-config.h.in.patch diff --git a/0206-Where-present-ensure-config-util.h-precedes-config.h.patch b/0205-Where-present-ensure-config-util.h-precedes-config.h.patch similarity index 100% rename from 0206-Where-present-ensure-config-util.h-precedes-config.h.patch rename to 0205-Where-present-ensure-config-util.h-precedes-config.h.patch diff --git a/0207-Drop-gnulib-fix-base64.patch.patch b/0206-Drop-gnulib-fix-base64.patch.patch similarity index 100% rename from 0207-Drop-gnulib-fix-base64.patch.patch rename to 0206-Drop-gnulib-fix-base64.patch.patch diff --git a/0208-Drop-gnulib-no-abort.patch.patch b/0207-Drop-gnulib-no-abort.patch.patch similarity index 100% rename from 0208-Drop-gnulib-no-abort.patch.patch rename to 0207-Drop-gnulib-no-abort.patch.patch diff --git a/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch similarity index 99% rename from 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch rename to 0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch index 4b5a44c8..a3f9a619 100644 --- a/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch +++ b/0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch @@ -48,7 +48,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch diff --git a/configure.ac b/configure.ac -index 3527f069ab2..d04c94691ef 100644 +index 0510afe0172..eb928485e45 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,7 @@ AC_CANONICAL_TARGET diff --git a/0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0209-commands-search-Fix-bug-stopping-iteration-when-no-f.patch similarity index 100% rename from 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch rename to 0209-commands-search-Fix-bug-stopping-iteration-when-no-f.patch diff --git a/0211-search-new-efidisk-only-option-on-EFI-systems.patch b/0210-search-new-efidisk-only-option-on-EFI-systems.patch similarity index 100% rename from 0211-search-new-efidisk-only-option-on-EFI-systems.patch rename to 0210-search-new-efidisk-only-option-on-EFI-systems.patch diff --git a/0212-efi-new-connectefi-command.patch b/0211-efi-new-connectefi-command.patch similarity index 100% rename from 0212-efi-new-connectefi-command.patch rename to 0211-efi-new-connectefi-command.patch diff --git a/0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0212-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch similarity index 100% rename from 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch rename to 0212-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch diff --git a/0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0213-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch similarity index 100% rename from 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch rename to 0213-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch diff --git a/0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0214-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch similarity index 100% rename from 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch rename to 0214-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch diff --git a/0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0215-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch similarity index 100% rename from 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch rename to 0215-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/0216-Correct-sorting-of-kernel-names-containing-_.patch b/0216-Correct-sorting-of-kernel-names-containing-_.patch new file mode 100644 index 00000000..e0694cf5 --- /dev/null +++ b/0216-Correct-sorting-of-kernel-names-containing-_.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Tue, 18 Jan 2022 12:22:15 -0500 +Subject: [PATCH] Correct sorting of kernel names containing '_' + +sort(1) from GNU coreutils does not treat underscore as part of a +version number for `sort -V. This causes misorderings on x86_64, where +e.g. kernel-core-3.17.6-300.11.fc21.x86_64 will incorrectly sort +*before* kernel-core-3.17.6-300.fc21.x86_64. + +To cope with this behavior, replace underscores with dashes in order to +approximate their intended meaning as version component separators. + +Fixes: https://savannah.gnu.org/bugs/?42844 +Signed-off-by: Robbie Harwood +--- + util/grub-mkconfig_lib.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in +index 301d8a8a1e4..57fb95e3aeb 100644 +--- a/util/grub-mkconfig_lib.in ++++ b/util/grub-mkconfig_lib.in +@@ -261,8 +261,8 @@ version_test_numeric () + + version_test_gt () + { +- version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`" +- version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`" ++ version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//" -e "s/_/-/g"`" ++ version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//" -e "s/_/-/g"`" + version_test_gt_cmp=gt + if [ "x$version_test_gt_b" = "x" ] ; then + return 0 diff --git a/grub.patches b/grub.patches index 29c58942..43b407bf 100644 --- a/grub.patches +++ b/grub.patches @@ -30,187 +30,187 @@ Patch0029: 0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch Patch0030: 0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch Patch0031: 0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch Patch0032: 0032-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0033: 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch -Patch0034: 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0035: 0035-Add-friendly-grub2-password-config-tool-985962.patch -Patch0036: 0036-tcp-add-window-scaling-support.patch -Patch0037: 0037-efinet-and-bootp-add-support-for-dhcpv6.patch -Patch0038: 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0039: 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch -Patch0040: 0040-Make-grub_fatal-also-backtrace.patch -Patch0041: 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch -Patch0042: 0042-Make-our-info-pages-say-grub2-where-appropriate.patch -Patch0043: 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch -Patch0044: 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch -Patch0045: 0045-export-btrfs_subvol-and-btrfs_subvolid.patch -Patch0046: 0046-grub2-btrfs-03-follow_default.patch -Patch0047: 0047-grub2-btrfs-04-grub2-install.patch -Patch0048: 0048-grub2-btrfs-05-grub2-mkconfig.patch -Patch0049: 0049-grub2-btrfs-06-subvol-mount.patch -Patch0050: 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch -Patch0051: 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch -Patch0052: 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch -Patch0053: 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch -Patch0054: 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch -Patch0055: 0055-don-t-use-int-for-efi-status.patch -Patch0056: 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch -Patch0057: 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch -Patch0058: 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch -Patch0059: 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch -Patch0060: 0060-align-struct-efi_variable-better.patch -Patch0061: 0061-Add-BLS-support-to-grub-mkconfig.patch -Patch0062: 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0063: 0063-Add-linux-and-initrd-commands-for-grub-emu.patch -Patch0064: 0064-Add-grub2-switch-to-blscfg.patch -Patch0065: 0065-make-better-backtraces.patch -Patch0066: 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0067: 0067-Work-around-some-minor-include-path-weirdnesses.patch -Patch0068: 0068-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0069: 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0070: 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch -Patch0071: 0071-Fixup-for-newer-compiler.patch -Patch0072: 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0073: 0073-Fixup-for-newer-compiler.patch -Patch0074: 0074-Add-support-for-non-Ethernet-network-cards.patch -Patch0075: 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0076: 0076-bootp-New-net_bootp6-command.patch -Patch0077: 0077-efinet-UEFI-IPv6-PXE-support.patch -Patch0078: 0078-grub.texi-Add-net_bootp6-doument.patch -Patch0079: 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0080: 0080-efinet-Setting-network-from-UEFI-device-path.patch -Patch0081: 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0082: 0082-Support-UEFI-networking-protocols.patch -Patch0083: 0083-AUDIT-0-http-boot-tracker-bug.patch -Patch0084: 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0085: 0085-Add-auto-hide-menu-support.patch -Patch0086: 0086-Add-grub-set-bootflag-utility.patch -Patch0087: 0087-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0088: 0088-gentpl-add-disable-support.patch -Patch0089: 0089-gentpl-add-pc-firmware-type.patch -Patch0090: 0090-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0091: 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0092: 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0093: 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0094: 0094-Rework-how-the-fdt-command-builds.patch -Patch0095: 0095-Disable-non-wordsize-allocations-on-arm.patch -Patch0096: 0096-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0097: 0097-Make-grub_error-more-verbose.patch -Patch0098: 0098-Make-reset-an-alias-for-the-reboot-command.patch -Patch0099: 0099-Add-a-version-command.patch -Patch0100: 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0101: 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0102: 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0103: 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0104: 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0105: 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0106: 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0107: 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0108: 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0109: 0109-Fix-getroot.c-s-trampolines.patch -Patch0110: 0110-Do-not-allow-stack-trampolines-anywhere.patch -Patch0111: 0111-Reimplement-boot_counter.patch -Patch0112: 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0113: 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0114: 0114-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0115: 0115-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0116: 0116-Export-all-variables-from-the-initial-context-when-c.patch -Patch0117: 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0118: 0118-Fix-systemctl-kexec-exit-status-check.patch -Patch0119: 0119-Print-grub-emu-linux-loader-messages-as-debug.patch -Patch0120: 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0121: 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0122: 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0123: 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0124: 0124-Add-start-symbol-for-RISC-V.patch -Patch0125: 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0126: 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0127: 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0128: 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0129: 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0130: 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0131: 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0132: 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0133: 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0134: 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0135: 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0136: 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0137: 0137-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0138: 0138-efi-http-fix-some-allocation-error-checking.patch -Patch0139: 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0140: 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0141: 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0144: 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0145: 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0146: 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0147: 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0148: 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0149: 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0150: 0150-grub-install-disable-support-for-EFI-platforms.patch -Patch0151: 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0152: 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0153: 0153-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0154: 0154-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0155: 0155-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0156: 0156-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0157: 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0158: 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0159: 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0160: 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0161: 0161-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0162: 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0163: 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0164: 0164-pgp-factor-out-rsa_pad.patch -Patch0165: 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0166: 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0167: 0167-libtasn1-import-libtasn1-4.16.0.patch -Patch0168: 0168-libtasn1-disable-code-not-needed-in-grub.patch -Patch0169: 0169-libtasn1-changes-for-grub-compatibility.patch -Patch0170: 0170-libtasn1-compile-into-asn1-module.patch -Patch0171: 0171-test_asn1-test-module-for-libtasn1.patch -Patch0172: 0172-grub-install-support-embedding-x509-certificates.patch -Patch0173: 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0174: 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0175: 0175-appended-signatures-support-verifying-appended-signa.patch -Patch0176: 0176-appended-signatures-verification-tests.patch -Patch0177: 0177-appended-signatures-documentation.patch -Patch0178: 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0179: 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0180: 0180-ieee1275-claim-more-memory.patch -Patch0181: 0181-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0182: 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0183: 0183-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0184: 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0185: 0185-efinet-Add-DHCP-proxy-support.patch -Patch0186: 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0187: 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0188: 0188-Suppress-gettext-error-message.patch -Patch0189: 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0190: 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0191: 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0192: 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0193: 0193-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0194: 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0195: 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0196: 0196-Print-module-name-on-license-check-failure.patch -Patch0197: 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0198: 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0199: 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch -Patch0200: 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch -Patch0201: 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch -Patch0202: 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch -Patch0203: 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch -Patch0204: 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch -Patch0205: 0205-Use-visual-indentation-in-config.h.in.patch -Patch0206: 0206-Where-present-ensure-config-util.h-precedes-config.h.patch -Patch0207: 0207-Drop-gnulib-fix-base64.patch.patch -Patch0208: 0208-Drop-gnulib-no-abort.patch.patch -Patch0209: 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0210: 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch -Patch0211: 0211-search-new-efidisk-only-option-on-EFI-systems.patch -Patch0212: 0212-efi-new-connectefi-command.patch -Patch0213: 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch -Patch0214: 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch -Patch0215: 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch -Patch0216: 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0033: 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0034: 0034-Add-friendly-grub2-password-config-tool-985962.patch +Patch0035: 0035-tcp-add-window-scaling-support.patch +Patch0036: 0036-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0037: 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0038: 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch +Patch0039: 0039-Make-grub_fatal-also-backtrace.patch +Patch0040: 0040-Fix-up-some-man-pages-rpmdiff-noticed.patch +Patch0041: 0041-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0042: 0042-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0043: 0043-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0044: 0044-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0045: 0045-grub2-btrfs-03-follow_default.patch +Patch0046: 0046-grub2-btrfs-04-grub2-install.patch +Patch0047: 0047-grub2-btrfs-05-grub2-mkconfig.patch +Patch0048: 0048-grub2-btrfs-06-subvol-mount.patch +Patch0049: 0049-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0050: 0050-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0051: 0051-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0052: 0052-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0053: 0053-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0054: 0054-don-t-use-int-for-efi-status.patch +Patch0055: 0055-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0056: 0056-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +Patch0057: 0057-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +Patch0058: 0058-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +Patch0059: 0059-align-struct-efi_variable-better.patch +Patch0060: 0060-Add-BLS-support-to-grub-mkconfig.patch +Patch0061: 0061-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +Patch0062: 0062-Add-linux-and-initrd-commands-for-grub-emu.patch +Patch0063: 0063-Add-grub2-switch-to-blscfg.patch +Patch0064: 0064-make-better-backtraces.patch +Patch0065: 0065-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0066: 0066-Work-around-some-minor-include-path-weirdnesses.patch +Patch0067: 0067-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0068: 0068-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0069: 0069-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0070: 0070-Fixup-for-newer-compiler.patch +Patch0071: 0071-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +Patch0072: 0072-Fixup-for-newer-compiler.patch +Patch0073: 0073-Add-support-for-non-Ethernet-network-cards.patch +Patch0074: 0074-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0075: 0075-bootp-New-net_bootp6-command.patch +Patch0076: 0076-efinet-UEFI-IPv6-PXE-support.patch +Patch0077: 0077-grub.texi-Add-net_bootp6-doument.patch +Patch0078: 0078-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0079: 0079-efinet-Setting-network-from-UEFI-device-path.patch +Patch0080: 0080-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0081: 0081-Support-UEFI-networking-protocols.patch +Patch0082: 0082-AUDIT-0-http-boot-tracker-bug.patch +Patch0083: 0083-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0084: 0084-Add-auto-hide-menu-support.patch +Patch0085: 0085-Add-grub-set-bootflag-utility.patch +Patch0086: 0086-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0087: 0087-gentpl-add-disable-support.patch +Patch0088: 0088-gentpl-add-pc-firmware-type.patch +Patch0089: 0089-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0090: 0090-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0091: 0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0092: 0092-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0093: 0093-Rework-how-the-fdt-command-builds.patch +Patch0094: 0094-Disable-non-wordsize-allocations-on-arm.patch +Patch0095: 0095-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0096: 0096-Make-grub_error-more-verbose.patch +Patch0097: 0097-Make-reset-an-alias-for-the-reboot-command.patch +Patch0098: 0098-Add-a-version-command.patch +Patch0099: 0099-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0100: 0100-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0101: 0101-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0102: 0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0103: 0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0104: 0104-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0105: 0105-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0106: 0106-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0107: 0107-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0108: 0108-Fix-getroot.c-s-trampolines.patch +Patch0109: 0109-Do-not-allow-stack-trampolines-anywhere.patch +Patch0110: 0110-Reimplement-boot_counter.patch +Patch0111: 0111-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0112: 0112-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0113: 0113-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0114: 0114-Make-it-possible-to-subtract-conditions-from-debug.patch +Patch0115: 0115-Export-all-variables-from-the-initial-context-when-c.patch +Patch0116: 0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0117: 0117-Fix-systemctl-kexec-exit-status-check.patch +Patch0118: 0118-Print-grub-emu-linux-loader-messages-as-debug.patch +Patch0119: 0119-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0120: 0120-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0121: 0121-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0122: 0122-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0123: 0123-Add-start-symbol-for-RISC-V.patch +Patch0124: 0124-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0125: 0125-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0126: 0126-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0127: 0127-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0128: 0128-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0129: 0129-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0130: 0130-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0131: 0131-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0132: 0132-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0133: 0133-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0134: 0134-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0135: 0135-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0136: 0136-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0137: 0137-efi-http-fix-some-allocation-error-checking.patch +Patch0138: 0138-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0139: 0139-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0140: 0140-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0141: 0141-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0144: 0144-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0145: 0145-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0146: 0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0147: 0147-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0148: 0148-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0149: 0149-grub-install-disable-support-for-EFI-platforms.patch +Patch0150: 0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0151: 0151-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0152: 0152-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0153: 0153-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0154: 0154-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0155: 0155-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0156: 0156-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0157: 0157-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0158: 0158-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0159: 0159-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0160: 0160-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0161: 0161-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0162: 0162-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0163: 0163-pgp-factor-out-rsa_pad.patch +Patch0164: 0164-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0165: 0165-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0166: 0166-libtasn1-import-libtasn1-4.16.0.patch +Patch0167: 0167-libtasn1-disable-code-not-needed-in-grub.patch +Patch0168: 0168-libtasn1-changes-for-grub-compatibility.patch +Patch0169: 0169-libtasn1-compile-into-asn1-module.patch +Patch0170: 0170-test_asn1-test-module-for-libtasn1.patch +Patch0171: 0171-grub-install-support-embedding-x509-certificates.patch +Patch0172: 0172-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0173: 0173-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0174: 0174-appended-signatures-support-verifying-appended-signa.patch +Patch0175: 0175-appended-signatures-verification-tests.patch +Patch0176: 0176-appended-signatures-documentation.patch +Patch0177: 0177-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0178: 0178-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0179: 0179-ieee1275-claim-more-memory.patch +Patch0180: 0180-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0181: 0181-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0182: 0182-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0183: 0183-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0184: 0184-efinet-Add-DHCP-proxy-support.patch +Patch0185: 0185-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0186: 0186-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0187: 0187-Suppress-gettext-error-message.patch +Patch0188: 0188-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0189: 0189-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0190: 0190-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0191: 0191-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0192: 0192-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0193: 0193-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0194: 0194-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0195: 0195-Print-module-name-on-license-check-failure.patch +Patch0196: 0196-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0197: 0197-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0198: 0198-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0199: 0199-Add-Fedora-location-of-DejaVu-SANS-font.patch +Patch0200: 0200-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +Patch0201: 0201-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +Patch0202: 0202-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +Patch0203: 0203-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +Patch0204: 0204-Use-visual-indentation-in-config.h.in.patch +Patch0205: 0205-Where-present-ensure-config-util.h-precedes-config.h.patch +Patch0206: 0206-Drop-gnulib-fix-base64.patch.patch +Patch0207: 0207-Drop-gnulib-no-abort.patch.patch +Patch0208: 0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch +Patch0209: 0209-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +Patch0210: 0210-search-new-efidisk-only-option-on-EFI-systems.patch +Patch0211: 0211-efi-new-connectefi-command.patch +Patch0212: 0212-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0213: 0213-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +Patch0214: 0214-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0215: 0215-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0216: 0216-Correct-sorting-of-kernel-names-containing-_.patch diff --git a/grub2.spec b/grub2.spec index 826b6651..720daabe 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 24%{?dist} +Release: 25%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -422,7 +422,6 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %{_datarootdir}/bash-completion/completions/grub %{_sbindir}/%{name}-mkconfig %{_sbindir}/%{name}-switch-to-blscfg -%{_sbindir}/%{name}-rpm-sort %{_sbindir}/%{name}-reboot %{_bindir}/%{name}-file %{_bindir}/%{name}-menulst2cfg @@ -526,6 +525,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Mar 21 2022 Robbie Harwood - 2.06-25 +- Use my sort patch instead + * Mon Mar 21 2022 Robbie Harwood - 2.06-24 - Fix missing format specifier in appended signature commit From 2a0a68c5422f236e5db9932ddb51910649270c2c Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 22 Mar 2022 14:45:26 -0400 Subject: [PATCH 114/294] Fix rebase fuzz on x509 embedding patch Signed-off-by: Robbie Harwood --- ...-support-embedding-x509-certificates.patch | 19 ++++++++++--------- grub2.spec | 5 ++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/0171-grub-install-support-embedding-x509-certificates.patch b/0171-grub-install-support-embedding-x509-certificates.patch index 136d2165..089e34fd 100644 --- a/0171-grub-install-support-embedding-x509-certificates.patch +++ b/0171-grub-install-support-embedding-x509-certificates.patch @@ -12,12 +12,12 @@ Signed-off-by: Alastair D'Silva Signed-off-by: Daniel Axtens --- grub-core/commands/pgp.c | 2 +- - util/grub-install-common.c | 22 +++++++++++++++++++++- + util/grub-install-common.c | 23 ++++++++++++++++++++++- util/grub-mkimage.c | 15 +++++++++++++-- util/mkimage.c | 38 ++++++++++++++++++++++++++++++++++++-- include/grub/kernel.h | 4 +++- include/grub/util/install.h | 7 +++++-- - 6 files changed, 79 insertions(+), 9 deletions(-) + 6 files changed, 80 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c index 355a43844ac..b81ac0ae46c 100644 @@ -33,7 +33,7 @@ index 355a43844ac..b81ac0ae46c 100644 pseudo_file.fs = &pseudo_fs; diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index a74fee16e22..2d9693ffeb7 100644 +index a74fee16e22..c603f5b308d 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -460,6 +460,8 @@ static char **pubkeys; @@ -45,19 +45,20 @@ index a74fee16e22..2d9693ffeb7 100644 static grub_compression_t compression; static size_t appsig_size; -@@ -500,6 +502,11 @@ grub_install_parse (int key, char *arg) - return 1; +@@ -501,6 +503,12 @@ grub_install_parse (int key, char *arg) case GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK: disable_shim_lock = 1; + return 1; + case 'x': + x509keys = xrealloc (x509keys, + sizeof (x509keys[0]) + * (nx509keys + 1)); + x509keys[nx509keys++] = xstrdup (arg); - return 1; ++ return 1; case GRUB_INSTALL_OPTIONS_VERBOSITY: -@@ -627,6 +634,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + verbosity++; +@@ -627,6 +635,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, for (pk = pubkeys; pk < pubkeys + npubkeys; pk++) slen += 20 + grub_strlen (*pk); @@ -67,7 +68,7 @@ index a74fee16e22..2d9693ffeb7 100644 for (md = modules.entries; *md; md++) { slen += 10 + grub_strlen (*md); -@@ -655,6 +665,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -655,6 +666,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, *p++ = ' '; } @@ -82,7 +83,7 @@ index a74fee16e22..2d9693ffeb7 100644 for (md = modules.entries; *md; md++) { *p++ = '\''; -@@ -684,7 +702,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -684,7 +703,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, diff --git a/grub2.spec b/grub2.spec index 720daabe..9f788964 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 25%{?dist} +Release: 26%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -525,6 +525,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Mar 22 2022 Robbie Harwood - 2.06-26 +- Fix rebase on x509 embedding patch + * Mon Mar 21 2022 Robbie Harwood - 2.06-25 - Use my sort patch instead From 5e729561995f51781ddec73ba70fd544f7f3c569 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 22 Mar 2022 15:46:46 -0700 Subject: [PATCH 115/294] Revert "Use my sort patch instead", fix BLS ostree detection This reverts commit 93004a8494732dca960febe24d987a8ff115de38, because it broke Rawhide. It also tries to fixes BLS ostree detection to work in chroots (e.g. during installation) by also checking for /ostree/repo. --- 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch | 475 ++++++++++++++++++ ...fig-construct-titles-that-look-like-.patch | 0 ...ly-grub2-password-config-tool-985962.patch | 8 +- ... 0036-tcp-add-window-scaling-support.patch | 0 ...net-and-bootp-add-support-for-dhcpv6.patch | 0 ...rnel-settings-and-use-it-in-10_linux.patch | 8 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 0 ... 0040-Make-grub_fatal-also-backtrace.patch | 0 ...ix-up-some-man-pages-rpmdiff-noticed.patch | 6 +- ...fo-pages-say-grub2-where-appropriate.patch | 0 ...-chainloader-entries-don-t-try-any-x.patch | 0 ...-Add-ability-to-boot-from-subvolumes.patch | 0 ...port-btrfs_subvol-and-btrfs_subvolid.patch | 0 ...> 0046-grub2-btrfs-03-follow_default.patch | 0 ...=> 0047-grub2-btrfs-04-grub2-install.patch | 0 ...> 0048-grub2-btrfs-05-grub2-mkconfig.patch | 4 +- ... => 0049-grub2-btrfs-06-subvol-mount.patch | 0 ...subvol-name-scheme-to-support-old-sn.patch | 0 ...-correctly-with-btrfs-snapshots-bsc-.patch | 0 ...ocate_pool-and-grub_efi_free_pool-wr.patch | 0 ...fi_.-memory-helpers-where-reasonable.patch | 0 ...4-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 0 ...=> 0055-don-t-use-int-for-efi-status.patch | 0 ...INIT-declare-its-function-prototypes.patch | 0 ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 0 ...d-xen-or-multiboot-2-modules-as-need.patch | 0 ...-calibration-not-take-51-seconds-to-.patch | 0 ...060-align-struct-efi_variable-better.patch | 0 ...061-Add-BLS-support-to-grub-mkconfig.patch | 6 +- ...-backtrace-on-grub_abort-for-grub-em.patch | 0 ...nux-and-initrd-commands-for-grub-emu.patch | 0 ...h => 0064-Add-grub2-switch-to-blscfg.patch | 6 +- ...patch => 0065-make-better-backtraces.patch | 2 +- ...w-our-startup-message-if-debug-is-se.patch | 0 ...-some-minor-include-path-weirdnesses.patch | 0 ...it-possible-to-enabled-build-id-sha1.patch | 4 +- ...f-grub_dprintf-without-the-file-line.patch | 0 ...dprintf-that-tells-us-load-addresses.patch | 0 ...tch => 0071-Fixup-for-newer-compiler.patch | 0 ...-export-the-start-and-_start-symbols.patch | 0 ...tch => 0073-Fixup-for-newer-compiler.patch | 0 ...pport-for-non-Ethernet-network-cards.patch | 0 ...racketed-ipv6-addrs-and-port-numbers.patch | 0 ...=> 0076-bootp-New-net_bootp6-command.patch | 0 ...=> 0077-efinet-UEFI-IPv6-PXE-support.patch | 0 ...078-grub.texi-Add-net_bootp6-doument.patch | 0 ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 0 ...etting-network-from-UEFI-device-path.patch | 0 ...etting-DNS-server-from-UEFI-protocol.patch | 0 ...82-Support-UEFI-networking-protocols.patch | 0 ...> 0083-AUDIT-0-http-boot-tracker-bug.patch | 0 ...-incr-command-to-increment-integer-v.patch | 0 ...h => 0085-Add-auto-hide-menu-support.patch | 2 +- ...> 0086-Add-grub-set-bootflag-utility.patch | 4 +- ...b-boot-indeterminate.service-example.patch | 0 ...h => 0088-gentpl-add-disable-support.patch | 0 ... => 0089-gentpl-add-pc-firmware-type.patch | 0 ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 6 +- ...make-it-possible-to-run-checkers-on-.patch | 0 ...94-Rework-how-the-fdt-command-builds.patch | 0 ...able-non-wordsize-allocations-on-arm.patch | 4 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 0 ...=> 0097-Make-grub_error-more-verbose.patch | 0 ...eset-an-alias-for-the-reboot-command.patch | 0 ....patch => 0099-Add-a-version-command.patch | 4 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 0 ...-Better-memory-allocation-and-error-.patch | 0 ...tter-locations-for-kernel-and-initrd.patch | 0 ...p-all-the-places-Wsign-compare-error.patch | 16 +- ...gn-compare-Wno-conversion-Wno-error-.patch | 6 +- ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 0 ...itrd-params-cmdline-allocations-abov.patch | 0 ... => 0109-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 4 +- ...tch => 0111-Reimplement-boot_counter.patch | 2 +- ...ntry-selection-based-on-ID-and-title.patch | 0 ...try-users-option-argument-to-be-opti.patch | 0 ...export-env-and-efi-load-env-commands.patch | 0 ...le-to-subtract-conditions-from-debug.patch | 0 ...bles-from-the-initial-context-when-c.patch | 0 ...-boot-success-reset-from-menu-auto-h.patch | 2 +- ...ix-systemctl-kexec-exit-status-check.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 0 ...g-Update-comment-about-running-as-ro.patch | 0 ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...indeterminate-getting-set-on-boot_su.patch | 0 ... => 0124-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 0 ...fw-http-_path-variables-to-make-them.patch | 0 ...-literal-IPv6-addresses-in-square-br.patch | 0 ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 0 ...se-address-before-jumping-to-the-PE-.patch | 0 ...ate-TPM-measurement-errors-to-the-ve.patch | 0 ...maximum-bounce-buffer-size-to-16-MiB.patch | 0 ...fix-when-the-HTTP-path-is-relative-a.patch | 0 ...turn-in-efi-export-env-and-efi-load-.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 0 ...rnel-validation-without-shim-protoco.patch | 0 ...ar-pointers-in-grub-core-net-bootp.c.patch | 0 ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 2 +- ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 0 ...ll-disable-support-for-EFI-platforms.patch | 0 ...imestamps-configure-flag-to-prepend-.patch | 8 +- ...ements-to-grub_disk_open-and-grub_di.patch | 0 ...on-grub_debug_is_enabled-void-return.patch | 0 ...ear-screen-when-debugging-is-enabled.patch | 0 ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 0 ...igning-grub-with-an-appended-signatu.patch | 0 ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0164-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0167-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...70-libtasn1-compile-into-asn1-module.patch | 0 ...1-test_asn1-test-module-for-libtasn1.patch | 4 +- ...-support-embedding-x509-certificates.patch | 0 ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 0 ...77-appended-signatures-documentation.patch | 0 ...er-lockdown-based-on-ibm-secure-boot.patch | 0 ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0180-ieee1275-claim-more-memory.patch | 0 ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 0 ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...ainloading-EFI-apps-from-loop-mounts.patch | 0 ...> 0185-efinet-Add-DHCP-proxy-support.patch | 0 ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 0 ... 0188-Suppress-gettext-error-message.patch | 0 ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 ...for-EFI-at-runtime-instead-of-config.patch | 0 ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 0 ...over-the-device-to-read-the-config-f.patch | 0 ...etting-of-prefix-for-signed-binary-c.patch | 0 ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 0 ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 0 ...-mkconfig-restore-umask-for-grub.cfg.patch | 0 ...btrfs-Use-full-btrfs-bootloader-area.patch | 0 ...-Fedora-location-of-DejaVu-SANS-font.patch | 4 +- ...t-show-Booting-s-msg-when-auto-booti.patch | 0 ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 0 ...ot-set-colorstate-until-the-first-te.patch | 0 ...ot-set-cursor-until-the-first-text-o.patch | 0 ...se-visual-indentation-in-config.h.in.patch | 0 ...sure-config-util.h-precedes-config.h.patch | 0 ...=> 0207-Drop-gnulib-fix-base64.patch.patch | 0 ...h => 0208-Drop-gnulib-no-abort.patch.patch | 0 ...version-and-drop-most-gnulib-patches.patch | 2 +- ...Fix-bug-stopping-iteration-when-no-f.patch | 0 ...w-efidisk-only-option-on-EFI-systems.patch | 0 ...h => 0212-efi-new-connectefi-command.patch | 0 ...-i386-efi-linux.c-do-not-validate-ke.patch | 0 ...-arm64-linux.c-do-not-validate-kerne.patch | 0 ...-efi-chainloader.c-do-not-validate-c.patch | 0 ...sorting-of-kernel-names-containing-_.patch | 34 -- ...-efi-linux.c-drop-now-unused-grub_li.patch | 0 grub.patches | 368 +++++++------- grub2.spec | 9 +- 187 files changed, 731 insertions(+), 269 deletions(-) create mode 100644 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch rename 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (100%) rename 0034-Add-friendly-grub2-password-config-tool-985962.patch => 0035-Add-friendly-grub2-password-config-tool-985962.patch (98%) rename 0035-tcp-add-window-scaling-support.patch => 0036-tcp-add-window-scaling-support.patch (100%) rename 0036-efinet-and-bootp-add-support-for-dhcpv6.patch => 0037-efinet-and-bootp-add-support-for-dhcpv6.patch (100%) rename 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (98%) rename 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch => 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch (100%) rename 0039-Make-grub_fatal-also-backtrace.patch => 0040-Make-grub_fatal-also-backtrace.patch (100%) rename 0040-Fix-up-some-man-pages-rpmdiff-noticed.patch => 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch (96%) rename 0041-Make-our-info-pages-say-grub2-where-appropriate.patch => 0042-Make-our-info-pages-say-grub2-where-appropriate.patch (100%) rename 0042-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch (100%) rename 0043-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (100%) rename 0044-export-btrfs_subvol-and-btrfs_subvolid.patch => 0045-export-btrfs_subvol-and-btrfs_subvolid.patch (100%) rename 0045-grub2-btrfs-03-follow_default.patch => 0046-grub2-btrfs-03-follow_default.patch (100%) rename 0046-grub2-btrfs-04-grub2-install.patch => 0047-grub2-btrfs-04-grub2-install.patch (100%) rename 0047-grub2-btrfs-05-grub2-mkconfig.patch => 0048-grub2-btrfs-05-grub2-mkconfig.patch (98%) rename 0048-grub2-btrfs-06-subvol-mount.patch => 0049-grub2-btrfs-06-subvol-mount.patch (100%) rename 0049-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (100%) rename 0050-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (100%) rename 0051-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (100%) rename 0052-Use-grub_efi_.-memory-helpers-where-reasonable.patch => 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch (100%) rename 0053-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch => 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch (100%) rename 0054-don-t-use-int-for-efi-status.patch => 0055-don-t-use-int-for-efi-status.patch (100%) rename 0055-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (100%) rename 0056-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (100%) rename 0057-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (100%) rename 0058-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch => 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch (100%) rename 0059-align-struct-efi_variable-better.patch => 0060-align-struct-efi_variable-better.patch (100%) rename 0060-Add-BLS-support-to-grub-mkconfig.patch => 0061-Add-BLS-support-to-grub-mkconfig.patch (99%) rename 0061-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (100%) rename 0062-Add-linux-and-initrd-commands-for-grub-emu.patch => 0063-Add-linux-and-initrd-commands-for-grub-emu.patch (100%) rename 0063-Add-grub2-switch-to-blscfg.patch => 0064-Add-grub2-switch-to-blscfg.patch (98%) rename 0064-make-better-backtraces.patch => 0065-make-better-backtraces.patch (99%) rename 0065-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (100%) rename 0066-Work-around-some-minor-include-path-weirdnesses.patch => 0067-Work-around-some-minor-include-path-weirdnesses.patch (100%) rename 0067-Make-it-possible-to-enabled-build-id-sha1.patch => 0068-Make-it-possible-to-enabled-build-id-sha1.patch (95%) rename 0068-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (100%) rename 0069-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (100%) rename 0070-Fixup-for-newer-compiler.patch => 0071-Fixup-for-newer-compiler.patch (100%) rename 0071-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (100%) rename 0072-Fixup-for-newer-compiler.patch => 0073-Fixup-for-newer-compiler.patch (100%) rename 0073-Add-support-for-non-Ethernet-network-cards.patch => 0074-Add-support-for-non-Ethernet-network-cards.patch (100%) rename 0074-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (100%) rename 0075-bootp-New-net_bootp6-command.patch => 0076-bootp-New-net_bootp6-command.patch (100%) rename 0076-efinet-UEFI-IPv6-PXE-support.patch => 0077-efinet-UEFI-IPv6-PXE-support.patch (100%) rename 0077-grub.texi-Add-net_bootp6-doument.patch => 0078-grub.texi-Add-net_bootp6-doument.patch (100%) rename 0078-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (100%) rename 0079-efinet-Setting-network-from-UEFI-device-path.patch => 0080-efinet-Setting-network-from-UEFI-device-path.patch (100%) rename 0080-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch (100%) rename 0081-Support-UEFI-networking-protocols.patch => 0082-Support-UEFI-networking-protocols.patch (100%) rename 0082-AUDIT-0-http-boot-tracker-bug.patch => 0083-AUDIT-0-http-boot-tracker-bug.patch (100%) rename 0083-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch (100%) rename 0084-Add-auto-hide-menu-support.patch => 0085-Add-auto-hide-menu-support.patch (99%) rename 0085-Add-grub-set-bootflag-utility.patch => 0086-Add-grub-set-bootflag-utility.patch (99%) rename 0086-docs-Add-grub-boot-indeterminate.service-example.patch => 0087-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0087-gentpl-add-disable-support.patch => 0088-gentpl-add-disable-support.patch (100%) rename 0088-gentpl-add-pc-firmware-type.patch => 0089-gentpl-add-pc-firmware-type.patch (100%) rename 0089-efinet-also-use-the-firmware-acceleration-for-http.patch => 0090-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0090-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (97%) rename 0092-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0093-Rework-how-the-fdt-command-builds.patch => 0094-Rework-how-the-fdt-command-builds.patch (100%) rename 0094-Disable-non-wordsize-allocations-on-arm.patch => 0095-Disable-non-wordsize-allocations-on-arm.patch (93%) rename 0095-Prepend-prefix-when-HTTP-path-is-relative.patch => 0096-Prepend-prefix-when-HTTP-path-is-relative.patch (100%) rename 0096-Make-grub_error-more-verbose.patch => 0097-Make-grub_error-more-verbose.patch (100%) rename 0097-Make-reset-an-alias-for-the-reboot-command.patch => 0098-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0098-Add-a-version-command.patch => 0099-Add-a-version-command.patch (98%) rename 0099-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (100%) rename 0100-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch (100%) rename 0101-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch (100%) rename 0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (93%) rename 0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (93%) rename 0104-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0105-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0106-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (100%) rename 0107-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (100%) rename 0108-Fix-getroot.c-s-trampolines.patch => 0109-Fix-getroot.c-s-trampolines.patch (100%) rename 0109-Do-not-allow-stack-trampolines-anywhere.patch => 0110-Do-not-allow-stack-trampolines-anywhere.patch (93%) rename 0110-Reimplement-boot_counter.patch => 0111-Reimplement-boot_counter.patch (99%) rename 0111-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch (100%) rename 0112-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch (100%) rename 0113-Add-efi-export-env-and-efi-load-env-commands.patch => 0114-Add-efi-export-env-and-efi-load-env-commands.patch (100%) rename 0114-Make-it-possible-to-subtract-conditions-from-debug.patch => 0115-Make-it-possible-to-subtract-conditions-from-debug.patch (100%) rename 0115-Export-all-variables-from-the-initial-context-when-c.patch => 0116-Export-all-variables-from-the-initial-context-when-c.patch (100%) rename 0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (99%) rename 0117-Fix-systemctl-kexec-exit-status-check.patch => 0118-Fix-systemctl-kexec-exit-status-check.patch (100%) rename 0118-Print-grub-emu-linux-loader-messages-as-debug.patch => 0119-Print-grub-emu-linux-loader-messages-as-debug.patch (100%) rename 0119-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch (100%) rename 0120-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) rename 0121-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) rename 0122-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (100%) rename 0123-Add-start-symbol-for-RISC-V.patch => 0124-Add-start-symbol-for-RISC-V.patch (100%) rename 0124-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (100%) rename 0125-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch (100%) rename 0126-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) rename 0127-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0128-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) rename 0129-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) rename 0130-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (100%) rename 0131-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (100%) rename 0132-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (100%) rename 0133-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (100%) rename 0134-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (100%) rename 0135-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (100%) rename 0136-efi-dhcp-fix-some-allocation-error-checking.patch => 0137-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0137-efi-http-fix-some-allocation-error-checking.patch => 0138-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0138-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0139-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (100%) rename 0140-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch (100%) rename 0141-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (100%) rename 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) rename 0144-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0145-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch (99%) rename 0147-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0148-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (100%) rename 0149-grub-install-disable-support-for-EFI-platforms.patch => 0150-grub-install-disable-support-for-EFI-platforms.patch (100%) rename 0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch (95%) rename 0151-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (100%) rename 0152-Introduce-function-grub_debug_is_enabled-void-return.patch => 0153-Introduce-function-grub_debug_is_enabled-void-return.patch (100%) rename 0153-Don-t-clear-screen-when-debugging-is-enabled.patch => 0154-Don-t-clear-screen-when-debugging-is-enabled.patch (100%) rename 0154-grub_file_-instrumentation-new-file-debug-tag.patch => 0155-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0155-ieee1275-Avoiding-many-unecessary-open-close.patch => 0156-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0156-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0157-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0158-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (100%) rename 0159-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch (100%) rename 0160-docs-grub-Document-signing-grub-under-UEFI.patch => 0161-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0161-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) rename 0162-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0163-pgp-factor-out-rsa_pad.patch => 0164-pgp-factor-out-rsa_pad.patch (100%) rename 0164-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0165-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0166-libtasn1-import-libtasn1-4.16.0.patch => 0167-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0167-libtasn1-disable-code-not-needed-in-grub.patch => 0168-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0168-libtasn1-changes-for-grub-compatibility.patch => 0169-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0169-libtasn1-compile-into-asn1-module.patch => 0170-libtasn1-compile-into-asn1-module.patch (100%) rename 0170-test_asn1-test-module-for-libtasn1.patch => 0171-test_asn1-test-module-for-libtasn1.patch (99%) rename 0171-grub-install-support-embedding-x509-certificates.patch => 0172-grub-install-support-embedding-x509-certificates.patch (100%) rename 0172-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0173-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0174-appended-signatures-support-verifying-appended-signa.patch => 0175-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0175-appended-signatures-verification-tests.patch => 0176-appended-signatures-verification-tests.patch (100%) rename 0176-appended-signatures-documentation.patch => 0177-appended-signatures-documentation.patch (100%) rename 0177-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (100%) rename 0178-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0179-ieee1275-claim-more-memory.patch => 0180-ieee1275-claim-more-memory.patch (100%) rename 0180-ieee1275-request-memory-with-ibm-client-architecture.patch => 0181-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) rename 0181-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) rename 0182-ieee1275-ofdisk-retry-on-open-failure.patch => 0183-ieee1275-ofdisk-retry-on-open-failure.patch (100%) rename 0183-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch (100%) rename 0184-efinet-Add-DHCP-proxy-support.patch => 0185-efinet-Add-DHCP-proxy-support.patch (100%) rename 0185-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0186-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (100%) rename 0187-Suppress-gettext-error-message.patch => 0188-Suppress-gettext-error-message.patch (100%) rename 0188-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) rename 0189-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) rename 0190-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0191-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch (100%) rename 0192-normal-main-Discover-the-device-to-read-the-config-f.patch => 0193-normal-main-Discover-the-device-to-read-the-config-f.patch (100%) rename 0193-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (100%) rename 0194-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) rename 0195-Print-module-name-on-license-check-failure.patch => 0196-Print-module-name-on-license-check-failure.patch (100%) rename 0196-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (100%) rename 0197-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch (100%) rename 0198-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch (100%) rename 0199-Add-Fedora-location-of-DejaVu-SANS-font.patch => 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch (95%) rename 0200-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch => 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch (100%) rename 0201-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch => 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch (100%) rename 0202-EFI-console-Do-not-set-colorstate-until-the-first-te.patch => 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch (100%) rename 0203-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch => 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch (100%) rename 0204-Use-visual-indentation-in-config.h.in.patch => 0205-Use-visual-indentation-in-config.h.in.patch (100%) rename 0205-Where-present-ensure-config-util.h-precedes-config.h.patch => 0206-Where-present-ensure-config-util.h-precedes-config.h.patch (100%) rename 0206-Drop-gnulib-fix-base64.patch.patch => 0207-Drop-gnulib-fix-base64.patch.patch (100%) rename 0207-Drop-gnulib-no-abort.patch.patch => 0208-Drop-gnulib-no-abort.patch.patch (100%) rename 0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch => 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch (99%) rename 0209-commands-search-Fix-bug-stopping-iteration-when-no-f.patch => 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch (100%) rename 0210-search-new-efidisk-only-option-on-EFI-systems.patch => 0211-search-new-efidisk-only-option-on-EFI-systems.patch (100%) rename 0211-efi-new-connectefi-command.patch => 0212-efi-new-connectefi-command.patch (100%) rename 0212-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch => 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch (100%) rename 0213-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch => 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch (100%) rename 0214-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch => 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch (100%) delete mode 100644 0216-Correct-sorting-of-kernel-names-containing-_.patch rename 0215-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch => 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch (100%) diff --git a/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch b/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch new file mode 100644 index 00000000..ff1c13ec --- /dev/null +++ b/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch @@ -0,0 +1,475 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robert Marshall +Date: Mon, 16 Mar 2015 14:14:19 -0400 +Subject: [PATCH] Use rpm's sort for grub2-mkconfig + +Add an option for rpm-based systems to use the rpm-sort library to sort +kernels. This avoids problems due to discrepancies between `sort -V` +and rpm. + +Signed-off-by: Robert Marshall +[pjones: fix --enable-rpm-sort configure option] +Signed-off-by: Peter Jones +[thierry.vignaud: fix build with rpm-4.16] +Signed-off-by: Thierry Vignaud +[tim: fix disabling grub-rpm-sort by ./configure] +Signed-off-by: Tim Landscheidt +[javierm: don't check for rpmvercmp in librpm] +Signed-off-by: Javier Martinez Canillas +[rharwood: commit message] +Signed-off-by: Robbie Harwood +--- + configure.ac | 37 ++++++ + Makefile.util.def | 17 +++ + util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ + util/grub-mkconfig_lib.in | 11 +- + util/grub-rpm-sort.8 | 12 ++ + 5 files changed, 357 insertions(+), 1 deletion(-) + create mode 100644 util/grub-rpm-sort.c + create mode 100644 util/grub-rpm-sort.8 + +diff --git a/configure.ac b/configure.ac +index bec8535af70..643a13f9147 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) + grub_TRANSFORM([grub-mkrescue]) + grub_TRANSFORM([grub-probe]) + grub_TRANSFORM([grub-reboot]) ++grub_TRANSFORM([grub-rpm-sort]) + grub_TRANSFORM([grub-script-check]) + grub_TRANSFORM([grub-set-default]) + grub_TRANSFORM([grub-sparc64-setup]) +@@ -95,6 +96,7 @@ grub_TRANSFORM([grub-mkrescue.1]) + grub_TRANSFORM([grub-mkstandalone.3]) + grub_TRANSFORM([grub-ofpathname.3]) + grub_TRANSFORM([grub-probe.3]) ++grub_TRANSFORM([grub-rpm-sort.8]) + grub_TRANSFORM([grub-reboot.3]) + grub_TRANSFORM([grub-render-label.3]) + grub_TRANSFORM([grub-script-check.3]) +@@ -1860,6 +1862,35 @@ fi + + AC_SUBST([LIBDEVMAPPER]) + ++AC_ARG_ENABLE([rpm-sort], ++ [AS_HELP_STRING([--enable-rpm-sort], ++ [enable native rpm sorting of kernels in grub (default=guessed)])]) ++if test x"$enable_rpm_sort" = xno ; then ++ rpm_sort_excuse="explicitly disabled" ++else ++ enable_rpm_sort=yes ++fi ++ ++if test x"$rpm_sort_excuse" = x ; then ++ # Check for rpmlib header. ++ AC_CHECK_HEADER([rpm/rpmlib.h], [], ++ [rpm_sort_excuse="need rpm/rpmlib header"]) ++fi ++ ++if test x"$rpm_sort_excuse" = x ; then ++ # Check for rpmio library. ++ AC_CHECK_LIB([rpmio], [rpmvercmp], [], ++ [rpm_sort_excuse="rpmio missing rpmvercmp"]) ++fi ++ ++if test x"$rpm_sort_excuse" = x ; then ++ LIBRPM="-lrpmio"; ++ AC_DEFINE([HAVE_RPMIO], [1], ++ [Define to 1 if you have the rpmio library.]) ++fi ++ ++AC_SUBST([LIBRPM]) ++ + LIBGEOM= + if test x$host_kernel = xkfreebsd; then + AC_CHECK_LIB([geom], [geom_gettree], [], +@@ -2047,6 +2078,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) + AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) + AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) + AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) ++AM_CONDITIONAL([COND_GRUB_RPM_SORT], [test x$enable_rpm_sort = xyes]) + AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) + if test x$FONT_SOURCE != x ; then + HAVE_FONT_SOURCE=1 +@@ -2168,6 +2200,11 @@ echo grub-mount: Yes + else + echo grub-mount: No "($grub_mount_excuse)" + fi ++if [ x"$rpm_sort_excuse" = x ]; then ++echo grub-rpm-sort: Yes ++else ++echo grub-rpm-sort: No "($rpm_sort_excuse)" ++fi + if [ x"$starfield_excuse" = x ]; then + echo starfield theme: Yes + echo With DejaVuSans font from $DJVU_FONT_SOURCE +diff --git a/Makefile.util.def b/Makefile.util.def +index 2c9b283a230..bc10cc79722 100644 +--- a/Makefile.util.def ++++ b/Makefile.util.def +@@ -703,6 +703,23 @@ program = { + ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + }; + ++program = { ++ name = grub-rpm-sort; ++ mansection = 8; ++ installdir = sbin; ++ ++ common = grub-core/kern/emu/misc.c; ++ common = grub-core/kern/emu/argp_common.c; ++ common = grub-core/osdep/init.c; ++ common = util/misc.c; ++ common = util/grub-rpm-sort.c; ++ ++ ldadd = libgrubkern.a; ++ ldadd = grub-core/lib/gnulib/libgnu.a; ++ ldadd = '$(LIBDEVMAPPER) $(LIBRPM)'; ++ condition = COND_GRUB_RPM_SORT; ++}; ++ + script = { + name = grub-mkconfig; + common = util/grub-mkconfig.in; +diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c +new file mode 100644 +index 00000000000..f33bd1ed568 +--- /dev/null ++++ b/util/grub-rpm-sort.c +@@ -0,0 +1,281 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static size_t ++read_file (const char *input, char **ret) ++{ ++ FILE *in; ++ size_t s; ++ size_t sz = 2048; ++ size_t offset = 0; ++ char *text; ++ ++ if (!strcmp(input, "-")) ++ in = stdin; ++ else ++ in = grub_util_fopen(input, "r"); ++ ++ text = xmalloc (sz); ++ ++ if (!in) ++ grub_util_error (_("cannot open `%s': %s"), input, strerror (errno)); ++ ++ while ((s = fread (text + offset, 1, sz - offset, in)) != 0) ++ { ++ offset += s; ++ if (sz - offset == 0) ++ { ++ sz += 2048; ++ text = xrealloc (text, sz); ++ } ++ } ++ ++ text[offset] = '\0'; ++ *ret = text; ++ ++ if (in != stdin) ++ fclose(in); ++ ++ return offset + 1; ++} ++ ++/* returns name/version/release */ ++/* NULL string pointer returned if nothing found */ ++static void ++split_package_string (char *package_string, char **name, ++ char **version, char **release) ++{ ++ char *package_version, *package_release; ++ ++ /* Release */ ++ package_release = strrchr (package_string, '-'); ++ ++ if (package_release != NULL) ++ *package_release++ = '\0'; ++ ++ *release = package_release; ++ ++ /* Version */ ++ package_version = strrchr(package_string, '-'); ++ ++ if (package_version != NULL) ++ *package_version++ = '\0'; ++ ++ *version = package_version; ++ /* Name */ ++ *name = package_string; ++ ++ /* Bubble up non-null values from release to name */ ++ if (*name == NULL) ++ { ++ *name = (*version == NULL ? *release : *version); ++ *version = *release; ++ *release = NULL; ++ } ++ if (*version == NULL) ++ { ++ *version = *release; ++ *release = NULL; ++ } ++} ++ ++/* ++ * package name-version-release comparator for qsort ++ * expects p, q which are pointers to character strings (char *) ++ * which will not be altered in this function ++ */ ++static int ++package_version_compare (const void *p, const void *q) ++{ ++ char *local_p, *local_q; ++ char *lhs_name, *lhs_version, *lhs_release; ++ char *rhs_name, *rhs_version, *rhs_release; ++ int vercmpflag = 0; ++ ++ local_p = alloca (strlen (*(char * const *)p) + 1); ++ local_q = alloca (strlen (*(char * const *)q) + 1); ++ ++ /* make sure these allocated */ ++ assert (local_p); ++ assert (local_q); ++ ++ strcpy (local_p, *(char * const *)p); ++ strcpy (local_q, *(char * const *)q); ++ ++ split_package_string (local_p, &lhs_name, &lhs_version, &lhs_release); ++ split_package_string (local_q, &rhs_name, &rhs_version, &rhs_release); ++ ++ /* Check Name and return if unequal */ ++ vercmpflag = rpmvercmp ((lhs_name == NULL ? "" : lhs_name), ++ (rhs_name == NULL ? "" : rhs_name)); ++ if (vercmpflag != 0) ++ return vercmpflag; ++ ++ /* Check version and return if unequal */ ++ vercmpflag = rpmvercmp ((lhs_version == NULL ? "" : lhs_version), ++ (rhs_version == NULL ? "" : rhs_version)); ++ if (vercmpflag != 0) ++ return vercmpflag; ++ ++ /* Check release and return the version compare value */ ++ vercmpflag = rpmvercmp ((lhs_release == NULL ? "" : lhs_release), ++ (rhs_release == NULL ? "" : rhs_release)); ++ ++ return vercmpflag; ++} ++ ++static void ++add_input (const char *filename, char ***package_names, size_t *n_package_names) ++{ ++ char *orig_input_buffer = NULL; ++ char *input_buffer; ++ char *position_of_newline; ++ char **names = *package_names; ++ char **new_names = NULL; ++ size_t n_names = *n_package_names; ++ ++ if (!*package_names) ++ new_names = names = xmalloc (sizeof (char *) * 2); ++ ++ if (read_file (filename, &orig_input_buffer) < 2) ++ { ++ if (new_names) ++ free (new_names); ++ if (orig_input_buffer) ++ free (orig_input_buffer); ++ return; ++ } ++ ++ input_buffer = orig_input_buffer; ++ while (input_buffer && *input_buffer && ++ (position_of_newline = strchrnul (input_buffer, '\n'))) ++ { ++ size_t sz = position_of_newline - input_buffer; ++ char *new; ++ ++ if (sz == 0) ++ { ++ input_buffer = position_of_newline + 1; ++ continue; ++ } ++ ++ new = xmalloc (sz+1); ++ strncpy (new, input_buffer, sz); ++ new[sz] = '\0'; ++ ++ names = xrealloc (names, sizeof (char *) * (n_names + 1)); ++ names[n_names] = new; ++ n_names++; ++ ++ /* move buffer ahead to next line */ ++ input_buffer = position_of_newline + 1; ++ if (*position_of_newline == '\0') ++ input_buffer = NULL; ++ } ++ ++ free (orig_input_buffer); ++ ++ *package_names = names; ++ *n_package_names = n_names; ++} ++ ++static char * ++help_filter (int key, const char *text, void *input __attribute__ ((unused))) ++{ ++ return (char *)text; ++} ++ ++static struct argp_option options[] = { ++ { 0, } ++}; ++ ++struct arguments ++{ ++ size_t ninputs; ++ size_t input_max; ++ char **inputs; ++}; ++ ++static error_t ++argp_parser (int key, char *arg, struct argp_state *state) ++{ ++ struct arguments *arguments = state->input; ++ switch (key) ++ { ++ case ARGP_KEY_ARG: ++ assert (arguments->ninputs < arguments->input_max); ++ arguments->inputs[arguments->ninputs++] = xstrdup (arg); ++ break; ++ default: ++ return ARGP_ERR_UNKNOWN; ++ } ++ return 0; ++} ++ ++static struct argp argp = { ++ options, argp_parser, N_("[INPUT_FILES]"), ++ N_("Sort a list of strings in RPM version sort order."), ++ NULL, help_filter, NULL ++}; ++ ++int ++main (int argc, char *argv[]) ++{ ++ struct arguments arguments; ++ char **package_names = NULL; ++ size_t n_package_names = 0; ++ int i; ++ ++ grub_util_host_init (&argc, &argv); ++ ++ memset (&arguments, 0, sizeof (struct arguments)); ++ arguments.input_max = argc+1; ++ arguments.inputs = xmalloc ((arguments.input_max + 1) ++ * sizeof (arguments.inputs[0])); ++ memset (arguments.inputs, 0, (arguments.input_max + 1) ++ * sizeof (arguments.inputs[0])); ++ ++ /* Parse our arguments */ ++ if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0) ++ grub_util_error ("%s", _("Error in parsing command line arguments\n")); ++ ++ /* If there's no inputs in argv, add one for stdin */ ++ if (!arguments.ninputs) ++ { ++ arguments.ninputs = 1; ++ arguments.inputs[0] = xmalloc (2); ++ strcpy(arguments.inputs[0], "-"); ++ } ++ ++ for (i = 0; i < arguments.ninputs; i++) ++ add_input(arguments.inputs[i], &package_names, &n_package_names); ++ ++ if (package_names == NULL || n_package_names < 1) ++ grub_util_error ("%s", _("Invalid input\n")); ++ ++ qsort (package_names, n_package_names, sizeof (char *), ++ package_version_compare); ++ ++ /* send sorted list to stdout */ ++ for (i = 0; i < n_package_names; i++) ++ { ++ fprintf (stdout, "%s\n", package_names[i]); ++ free (package_names[i]); ++ } ++ ++ free (package_names); ++ for (i = 0; i < arguments.ninputs; i++) ++ free (arguments.inputs[i]); ++ ++ free (arguments.inputs); ++ ++ return 0; ++} +diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in +index 0f6505bf3b6..42c2ea9ba50 100644 +--- a/util/grub-mkconfig_lib.in ++++ b/util/grub-mkconfig_lib.in +@@ -33,6 +33,9 @@ fi + if test "x$grub_mkrelpath" = x; then + grub_mkrelpath="${bindir}/@grub_mkrelpath@" + fi ++if test "x$grub_rpm_sort" = x; then ++ grub_rpm_sort="${sbindir}/@grub_rpm_sort@" ++fi + + if command -v gettext >/dev/null; then + : +@@ -218,6 +221,12 @@ version_sort () + esac + } + ++if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then ++ kernel_sort="$grub_rpm_sort" ++else ++ kernel_sort=version_sort ++fi ++ + version_test_numeric () + { + version_test_numeric_a="$1" +@@ -234,7 +243,7 @@ version_test_numeric () + version_test_numeric_a="$version_test_numeric_b" + version_test_numeric_b="$version_test_numeric_c" + fi +- if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then ++ if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | "$kernel_sort" | head -n 1 | grep -qx "$version_test_numeric_b" ; then + return 0 + else + return 1 +diff --git a/util/grub-rpm-sort.8 b/util/grub-rpm-sort.8 +new file mode 100644 +index 00000000000..8ce21488448 +--- /dev/null ++++ b/util/grub-rpm-sort.8 +@@ -0,0 +1,12 @@ ++.TH GRUB-RPM-SORT 8 "Wed Feb 26 2014" ++.SH NAME ++\fBgrub-rpm-sort\fR \(em Sort input according to RPM version compare. ++ ++.SH SYNOPSIS ++\fBgrub-rpm-sort\fR [OPTIONS]. ++ ++.SH DESCRIPTION ++You should not normally run this program directly. Use grub-mkconfig instead. ++ ++.SH SEE ALSO ++.BR "info grub" diff --git a/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 100% rename from 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch diff --git a/0034-Add-friendly-grub2-password-config-tool-985962.patch b/0035-Add-friendly-grub2-password-config-tool-985962.patch similarity index 98% rename from 0034-Add-friendly-grub2-password-config-tool-985962.patch rename to 0035-Add-friendly-grub2-password-config-tool-985962.patch index 0bc17f76..2d6f18a6 100644 --- a/0034-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0035-Add-friendly-grub2-password-config-tool-985962.patch @@ -27,7 +27,7 @@ Andy Lutomirski create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index bec8535af70..22d289eacb9 100644 +index 643a13f9147..25e1abb59b9 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -35,11 +35,11 @@ index bec8535af70..22d289eacb9 100644 grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-reboot]) +grub_TRANSFORM([grub-set-password]) + grub_TRANSFORM([grub-rpm-sort]) grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) - grub_TRANSFORM([grub-sparc64-setup]) diff --git a/Makefile.util.def b/Makefile.util.def -index 2c9b283a230..4ee22c5daad 100644 +index bc10cc79722..8ca4c14f0b9 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -452,6 +452,12 @@ script = { @@ -55,7 +55,7 @@ index 2c9b283a230..4ee22c5daad 100644 script = { name = '10_windows'; common = util/grub.d/10_windows.in; -@@ -724,6 +730,13 @@ script = { +@@ -741,6 +747,13 @@ script = { installdir = sbin; }; diff --git a/0035-tcp-add-window-scaling-support.patch b/0036-tcp-add-window-scaling-support.patch similarity index 100% rename from 0035-tcp-add-window-scaling-support.patch rename to 0036-tcp-add-window-scaling-support.patch diff --git a/0036-efinet-and-bootp-add-support-for-dhcpv6.patch b/0037-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 100% rename from 0036-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0037-efinet-and-bootp-add-support-for-dhcpv6.patch diff --git a/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 98% rename from 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index e9518f84..bf78c813 100644 --- a/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -23,7 +23,7 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 22d289eacb9..c02898b7568 100644 +index 25e1abb59b9..58e57a745fa 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) @@ -34,7 +34,7 @@ index 22d289eacb9..c02898b7568 100644 grub_TRANSFORM([grub-glue-efi]) grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) -@@ -81,6 +82,7 @@ grub_TRANSFORM([grub-file]) +@@ -82,6 +83,7 @@ grub_TRANSFORM([grub-file]) grub_TRANSFORM([grub-bios-setup.3]) grub_TRANSFORM([grub-editenv.1]) grub_TRANSFORM([grub-fstest.3]) @@ -43,10 +43,10 @@ index 22d289eacb9..c02898b7568 100644 grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) diff --git a/Makefile.util.def b/Makefile.util.def -index 4ee22c5daad..18a92427767 100644 +index 8ca4c14f0b9..43a1c7453b1 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -716,6 +716,13 @@ script = { +@@ -733,6 +733,13 @@ script = { installdir = sbin; }; diff --git a/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0039-bz1374141-fix-incorrect-mask-for-ppc64.patch similarity index 100% rename from 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch rename to 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch diff --git a/0039-Make-grub_fatal-also-backtrace.patch b/0040-Make-grub_fatal-also-backtrace.patch similarity index 100% rename from 0039-Make-grub_fatal-also-backtrace.patch rename to 0040-Make-grub_fatal-also-backtrace.patch diff --git a/0040-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch similarity index 96% rename from 0040-Fix-up-some-man-pages-rpmdiff-noticed.patch rename to 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch index b4f39c00..be584175 100644 --- a/0040-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ b/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch @@ -13,10 +13,10 @@ Subject: [PATCH] Fix up some man pages rpmdiff noticed. create mode 100644 util/grub-syslinux2cfg.1 diff --git a/configure.ac b/configure.ac -index c02898b7568..24f3be54bca 100644 +index 58e57a745fa..a0030632220 100644 --- a/configure.ac +++ b/configure.ac -@@ -86,6 +86,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) +@@ -87,6 +87,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) grub_TRANSFORM([grub-glue-efi.3]) grub_TRANSFORM([grub-install.1]) grub_TRANSFORM([grub-kbdcomp.3]) @@ -24,7 +24,7 @@ index c02898b7568..24f3be54bca 100644 grub_TRANSFORM([grub-menulst2cfg.1]) grub_TRANSFORM([grub-mkconfig.1]) grub_TRANSFORM([grub-mkfont.3]) -@@ -103,6 +104,7 @@ grub_TRANSFORM([grub-render-label.3]) +@@ -105,6 +106,7 @@ grub_TRANSFORM([grub-render-label.3]) grub_TRANSFORM([grub-script-check.3]) grub_TRANSFORM([grub-set-default.1]) grub_TRANSFORM([grub-sparc64-setup.3]) diff --git a/0041-Make-our-info-pages-say-grub2-where-appropriate.patch b/0042-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 100% rename from 0041-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0042-Make-our-info-pages-say-grub2-where-appropriate.patch diff --git a/0042-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 100% rename from 0042-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch diff --git a/0043-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 100% rename from 0043-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch diff --git a/0044-export-btrfs_subvol-and-btrfs_subvolid.patch b/0045-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 100% rename from 0044-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0045-export-btrfs_subvol-and-btrfs_subvolid.patch diff --git a/0045-grub2-btrfs-03-follow_default.patch b/0046-grub2-btrfs-03-follow_default.patch similarity index 100% rename from 0045-grub2-btrfs-03-follow_default.patch rename to 0046-grub2-btrfs-03-follow_default.patch diff --git a/0046-grub2-btrfs-04-grub2-install.patch b/0047-grub2-btrfs-04-grub2-install.patch similarity index 100% rename from 0046-grub2-btrfs-04-grub2-install.patch rename to 0047-grub2-btrfs-04-grub2-install.patch diff --git a/0047-grub2-btrfs-05-grub2-mkconfig.patch b/0048-grub2-btrfs-05-grub2-mkconfig.patch similarity index 98% rename from 0047-grub2-btrfs-05-grub2-mkconfig.patch rename to 0048-grub2-btrfs-05-grub2-mkconfig.patch index 6fb1d640..5afd183c 100644 --- a/0047-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0048-grub2-btrfs-05-grub2-mkconfig.patch @@ -27,10 +27,10 @@ index 005f093809b..535c0f02499 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 0f6505bf3b6..5e96f6cc5d2 100644 +index 42c2ea9ba50..fafeac95061 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in -@@ -49,7 +49,11 @@ grub_warn () +@@ -52,7 +52,11 @@ grub_warn () make_system_path_relative_to_its_root () { diff --git a/0048-grub2-btrfs-06-subvol-mount.patch b/0049-grub2-btrfs-06-subvol-mount.patch similarity index 100% rename from 0048-grub2-btrfs-06-subvol-mount.patch rename to 0049-grub2-btrfs-06-subvol-mount.patch diff --git a/0049-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 100% rename from 0049-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch diff --git a/0050-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 100% rename from 0050-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch diff --git a/0051-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 100% rename from 0051-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch diff --git a/0052-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch similarity index 100% rename from 0052-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename to 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch diff --git a/0053-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch similarity index 100% rename from 0053-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename to 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch diff --git a/0054-don-t-use-int-for-efi-status.patch b/0055-don-t-use-int-for-efi-status.patch similarity index 100% rename from 0054-don-t-use-int-for-efi-status.patch rename to 0055-don-t-use-int-for-efi-status.patch diff --git a/0055-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 100% rename from 0055-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch diff --git a/0056-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 100% rename from 0056-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch diff --git a/0057-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 100% rename from 0057-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch diff --git a/0058-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch similarity index 100% rename from 0058-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename to 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch diff --git a/0059-align-struct-efi_variable-better.patch b/0060-align-struct-efi_variable-better.patch similarity index 100% rename from 0059-align-struct-efi_variable-better.patch rename to 0060-align-struct-efi_variable-better.patch diff --git a/0060-Add-BLS-support-to-grub-mkconfig.patch b/0061-Add-BLS-support-to-grub-mkconfig.patch similarity index 99% rename from 0060-Add-BLS-support-to-grub-mkconfig.patch rename to 0061-Add-BLS-support-to-grub-mkconfig.patch index 6feb7474..7211afba 100644 --- a/0060-Add-BLS-support-to-grub-mkconfig.patch +++ b/0061-Add-BLS-support-to-grub-mkconfig.patch @@ -89,7 +89,7 @@ index 535c0f02499..f55339a3f64 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 5e96f6cc5d2..301d8a8a1e4 100644 +index fafeac95061..d8bb4069360 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -30,6 +30,9 @@ fi @@ -102,7 +102,7 @@ index 5e96f6cc5d2..301d8a8a1e4 100644 if test "x$grub_mkrelpath" = x; then grub_mkrelpath="${bindir}/@grub_mkrelpath@" fi -@@ -122,8 +125,19 @@ EOF +@@ -125,8 +128,19 @@ EOF fi } @@ -122,7 +122,7 @@ index 5e96f6cc5d2..301d8a8a1e4 100644 old_ifs="$IFS" IFS=' ' -@@ -158,18 +172,18 @@ prepare_grub_to_access_device () +@@ -161,18 +175,18 @@ prepare_grub_to_access_device () # otherwise set root as per value in device.map. fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`" if [ "x$fs_hint" != x ]; then diff --git a/0061-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 100% rename from 0061-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch diff --git a/0062-Add-linux-and-initrd-commands-for-grub-emu.patch b/0063-Add-linux-and-initrd-commands-for-grub-emu.patch similarity index 100% rename from 0062-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0063-Add-linux-and-initrd-commands-for-grub-emu.patch diff --git a/0063-Add-grub2-switch-to-blscfg.patch b/0064-Add-grub2-switch-to-blscfg.patch similarity index 98% rename from 0063-Add-grub2-switch-to-blscfg.patch rename to 0064-Add-grub2-switch-to-blscfg.patch index 0fe9cc5a..650d56f2 100644 --- a/0063-Add-grub2-switch-to-blscfg.patch +++ b/0064-Add-grub2-switch-to-blscfg.patch @@ -20,10 +20,10 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index 18a92427767..88f55e35c47 100644 +index 43a1c7453b1..a90879fa9ba 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1348,6 +1348,13 @@ program = { +@@ -1365,6 +1365,13 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -420,7 +420,7 @@ index 9fcd77cacc3..81f35a2f3f0 100644 get_sorted_bls() { - if ! [ -d "${blsdir}" ]; then -+ if ! [ -d "${blsdir}" ] || [ -f /run/ostree-booted ]; then ++ if ! [ -d "${blsdir}" ] || [ -f /run/ostree-booted ] || [ -d /ostree/repo ]]; then return fi diff --git a/0064-make-better-backtraces.patch b/0065-make-better-backtraces.patch similarity index 99% rename from 0064-make-better-backtraces.patch rename to 0065-make-better-backtraces.patch index 7cdc8c0d..63765671 100644 --- a/0064-make-better-backtraces.patch +++ b/0065-make-better-backtraces.patch @@ -38,7 +38,7 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index 88f55e35c47..bda9fd12111 100644 +index a90879fa9ba..48512bc6311 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -51,6 +51,12 @@ library = { diff --git a/0065-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 100% rename from 0065-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch diff --git a/0066-Work-around-some-minor-include-path-weirdnesses.patch b/0067-Work-around-some-minor-include-path-weirdnesses.patch similarity index 100% rename from 0066-Work-around-some-minor-include-path-weirdnesses.patch rename to 0067-Work-around-some-minor-include-path-weirdnesses.patch diff --git a/0067-Make-it-possible-to-enabled-build-id-sha1.patch b/0068-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 95% rename from 0067-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0068-Make-it-possible-to-enabled-build-id-sha1.patch index 1a84b83c..f68fc58b 100644 --- a/0067-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0068-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index 24f3be54bca..a4ca2ec542e 100644 +index a0030632220..b50fb2e9897 100644 --- a/configure.ac +++ b/configure.ac -@@ -1468,7 +1468,15 @@ grub_PROG_TARGET_CC +@@ -1470,7 +1470,15 @@ grub_PROG_TARGET_CC if test "x$TARGET_APPLE_LINKER" != x1 ; then grub_PROG_OBJCOPY_ABSOLUTE fi diff --git a/0068-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 100% rename from 0068-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch diff --git a/0069-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 100% rename from 0069-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch diff --git a/0070-Fixup-for-newer-compiler.patch b/0071-Fixup-for-newer-compiler.patch similarity index 100% rename from 0070-Fixup-for-newer-compiler.patch rename to 0071-Fixup-for-newer-compiler.patch diff --git a/0071-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 100% rename from 0071-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch diff --git a/0072-Fixup-for-newer-compiler.patch b/0073-Fixup-for-newer-compiler.patch similarity index 100% rename from 0072-Fixup-for-newer-compiler.patch rename to 0073-Fixup-for-newer-compiler.patch diff --git a/0073-Add-support-for-non-Ethernet-network-cards.patch b/0074-Add-support-for-non-Ethernet-network-cards.patch similarity index 100% rename from 0073-Add-support-for-non-Ethernet-network-cards.patch rename to 0074-Add-support-for-non-Ethernet-network-cards.patch diff --git a/0074-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 100% rename from 0074-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch diff --git a/0075-bootp-New-net_bootp6-command.patch b/0076-bootp-New-net_bootp6-command.patch similarity index 100% rename from 0075-bootp-New-net_bootp6-command.patch rename to 0076-bootp-New-net_bootp6-command.patch diff --git a/0076-efinet-UEFI-IPv6-PXE-support.patch b/0077-efinet-UEFI-IPv6-PXE-support.patch similarity index 100% rename from 0076-efinet-UEFI-IPv6-PXE-support.patch rename to 0077-efinet-UEFI-IPv6-PXE-support.patch diff --git a/0077-grub.texi-Add-net_bootp6-doument.patch b/0078-grub.texi-Add-net_bootp6-doument.patch similarity index 100% rename from 0077-grub.texi-Add-net_bootp6-doument.patch rename to 0078-grub.texi-Add-net_bootp6-doument.patch diff --git a/0078-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 100% rename from 0078-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch diff --git a/0079-efinet-Setting-network-from-UEFI-device-path.patch b/0080-efinet-Setting-network-from-UEFI-device-path.patch similarity index 100% rename from 0079-efinet-Setting-network-from-UEFI-device-path.patch rename to 0080-efinet-Setting-network-from-UEFI-device-path.patch diff --git a/0080-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 100% rename from 0080-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch diff --git a/0081-Support-UEFI-networking-protocols.patch b/0082-Support-UEFI-networking-protocols.patch similarity index 100% rename from 0081-Support-UEFI-networking-protocols.patch rename to 0082-Support-UEFI-networking-protocols.patch diff --git a/0082-AUDIT-0-http-boot-tracker-bug.patch b/0083-AUDIT-0-http-boot-tracker-bug.patch similarity index 100% rename from 0082-AUDIT-0-http-boot-tracker-bug.patch rename to 0083-AUDIT-0-http-boot-tracker-bug.patch diff --git a/0083-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 100% rename from 0083-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch diff --git a/0084-Add-auto-hide-menu-support.patch b/0085-Add-auto-hide-menu-support.patch similarity index 99% rename from 0084-Add-auto-hide-menu-support.patch rename to 0085-Add-auto-hide-menu-support.patch index 9c6a67e6..863cd053 100644 --- a/0084-Add-auto-hide-menu-support.patch +++ b/0085-Add-auto-hide-menu-support.patch @@ -49,7 +49,7 @@ Changes in v2: create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index bda9fd12111..cb8e3c3270d 100644 +index 48512bc6311..314e6f2acf8 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { diff --git a/0085-Add-grub-set-bootflag-utility.patch b/0086-Add-grub-set-bootflag-utility.patch similarity index 99% rename from 0085-Add-grub-set-bootflag-utility.patch rename to 0086-Add-grub-set-bootflag-utility.patch index 9e787163..e39f8beb 100644 --- a/0085-Add-grub-set-bootflag-utility.patch +++ b/0086-Add-grub-set-bootflag-utility.patch @@ -48,10 +48,10 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub-set-bootflag.1 diff --git a/Makefile.util.def b/Makefile.util.def -index cb8e3c3270d..d066652e9bb 100644 +index 314e6f2acf8..0b85a7fce4a 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1429,3 +1429,10 @@ program = { +@@ -1446,3 +1446,10 @@ program = { ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; diff --git a/0086-docs-Add-grub-boot-indeterminate.service-example.patch b/0087-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0086-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0087-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0087-gentpl-add-disable-support.patch b/0088-gentpl-add-disable-support.patch similarity index 100% rename from 0087-gentpl-add-disable-support.patch rename to 0088-gentpl-add-disable-support.patch diff --git a/0088-gentpl-add-pc-firmware-type.patch b/0089-gentpl-add-pc-firmware-type.patch similarity index 100% rename from 0088-gentpl-add-pc-firmware-type.patch rename to 0089-gentpl-add-pc-firmware-type.patch diff --git a/0089-efinet-also-use-the-firmware-acceleration-for-http.patch b/0090-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0089-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0090-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0090-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0090-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 97% rename from 0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index ce9286a7..ee2216e5 100644 --- a/0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index a4ca2ec542e..f685f300327 100644 +index b50fb2e9897..b27573b3de5 100644 --- a/configure.ac +++ b/configure.ac -@@ -875,11 +875,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p +@@ -877,11 +877,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" fi @@ -45,7 +45,7 @@ index a4ca2ec542e..f685f300327 100644 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ grub_cv_target_cc_soft_float=no if test "x$target_cpu" = xarm64; then -@@ -1980,6 +1992,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +@@ -2011,6 +2023,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" diff --git a/0092-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0093-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0092-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0093-Rework-how-the-fdt-command-builds.patch b/0094-Rework-how-the-fdt-command-builds.patch similarity index 100% rename from 0093-Rework-how-the-fdt-command-builds.patch rename to 0094-Rework-how-the-fdt-command-builds.patch diff --git a/0094-Disable-non-wordsize-allocations-on-arm.patch b/0095-Disable-non-wordsize-allocations-on-arm.patch similarity index 93% rename from 0094-Disable-non-wordsize-allocations-on-arm.patch rename to 0095-Disable-non-wordsize-allocations-on-arm.patch index 54a4ccbf..e28041a1 100644 --- a/0094-Disable-non-wordsize-allocations-on-arm.patch +++ b/0095-Disable-non-wordsize-allocations-on-arm.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index f685f300327..8fd57b709ff 100644 +index b27573b3de5..bb4e05ceef3 100644 --- a/configure.ac +++ b/configure.ac -@@ -1286,6 +1286,26 @@ if test "x$target_cpu" = xarm; then +@@ -1288,6 +1288,26 @@ if test "x$target_cpu" = xarm; then done ]) diff --git a/0095-Prepend-prefix-when-HTTP-path-is-relative.patch b/0096-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 100% rename from 0095-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0096-Prepend-prefix-when-HTTP-path-is-relative.patch diff --git a/0096-Make-grub_error-more-verbose.patch b/0097-Make-grub_error-more-verbose.patch similarity index 100% rename from 0096-Make-grub_error-more-verbose.patch rename to 0097-Make-grub_error-more-verbose.patch diff --git a/0097-Make-reset-an-alias-for-the-reboot-command.patch b/0098-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0097-Make-reset-an-alias-for-the-reboot-command.patch rename to 0098-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0098-Add-a-version-command.patch b/0099-Add-a-version-command.patch similarity index 98% rename from 0098-Add-a-version-command.patch rename to 0099-Add-a-version-command.patch index f4f44048..bf3b4b80 100644 --- a/0098-Add-a-version-command.patch +++ b/0099-Add-a-version-command.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index 8fd57b709ff..31a08ff9b8e 100644 +index bb4e05ceef3..59ccda24475 100644 --- a/configure.ac +++ b/configure.ac -@@ -310,6 +310,19 @@ AC_SUBST(target_cpu) +@@ -312,6 +312,19 @@ AC_SUBST(target_cpu) AC_SUBST(platform) # Define default variables diff --git a/0099-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 100% rename from 0099-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch diff --git a/0100-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 100% rename from 0100-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch diff --git a/0101-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 100% rename from 0101-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch diff --git a/0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 93% rename from 0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index 0fe538e6..e6cd8b47 100644 --- a/0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -14,8 +14,9 @@ Signed-off-by: Peter Jones util/grub-menulst2cfg.c | 2 +- util/grub-mkfont.c | 13 +++++++------ util/grub-probe.c | 2 +- + util/grub-rpm-sort.c | 2 +- util/setup.c | 2 +- - 10 files changed, 17 insertions(+), 16 deletions(-) + 11 files changed, 18 insertions(+), 17 deletions(-) diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c index eeea092752d..f08a1bb8415 100644 @@ -184,6 +185,19 @@ index c08e46bbb40..c6fac732b40 100644 for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) if (strcmp (arg, targets[i]) == 0) +diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c +index f33bd1ed568..8345944105f 100644 +--- a/util/grub-rpm-sort.c ++++ b/util/grub-rpm-sort.c +@@ -232,7 +232,7 @@ main (int argc, char *argv[]) + struct arguments arguments; + char **package_names = NULL; + size_t n_package_names = 0; +- int i; ++ unsigned int i; + + grub_util_host_init (&argc, &argv); + diff --git a/util/setup.c b/util/setup.c index da5f2c07f50..8b22bb8ccac 100644 --- a/util/setup.c diff --git a/0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 93% rename from 0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index 0ea153b2..1fa705e6 100644 --- a/0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index 31a08ff9b8e..efc871a6732 100644 +index 59ccda24475..6eb297fdbf6 100644 --- a/configure.ac +++ b/configure.ac -@@ -1478,11 +1478,11 @@ fi +@@ -1480,11 +1480,11 @@ fi # Set them to their new values for the tests below. CC="$TARGET_CC" if test x"$platform" = xemu ; then @@ -29,7 +29,7 @@ index 31a08ff9b8e..efc871a6732 100644 fi CPPFLAGS="$TARGET_CPPFLAGS" -@@ -2016,6 +2016,14 @@ if test x"$enable_werror" != xno ; then +@@ -2047,6 +2047,14 @@ if test x"$enable_werror" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Werror" fi diff --git a/0104-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0104-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0105-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0105-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0106-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 100% rename from 0106-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch diff --git a/0107-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 100% rename from 0107-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch diff --git a/0108-Fix-getroot.c-s-trampolines.patch b/0109-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0108-Fix-getroot.c-s-trampolines.patch rename to 0109-Fix-getroot.c-s-trampolines.patch diff --git a/0109-Do-not-allow-stack-trampolines-anywhere.patch b/0110-Do-not-allow-stack-trampolines-anywhere.patch similarity index 93% rename from 0109-Do-not-allow-stack-trampolines-anywhere.patch rename to 0110-Do-not-allow-stack-trampolines-anywhere.patch index d8befae5..2a3247af 100644 --- a/0109-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0110-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index efc871a6732..b45ddb2292f 100644 +index 6eb297fdbf6..c6bd965f1f9 100644 --- a/configure.ac +++ b/configure.ac -@@ -2024,6 +2024,9 @@ if test x"$enable_wextra" != xno ; then +@@ -2055,6 +2055,9 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi diff --git a/0110-Reimplement-boot_counter.patch b/0111-Reimplement-boot_counter.patch similarity index 99% rename from 0110-Reimplement-boot_counter.patch rename to 0111-Reimplement-boot_counter.patch index 80213d7e..a203929f 100644 --- a/0110-Reimplement-boot_counter.patch +++ b/0111-Reimplement-boot_counter.patch @@ -23,7 +23,7 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index d066652e9bb..e10fe766d1d 100644 +index 0b85a7fce4a..27a13bc734e 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { diff --git a/0111-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0112-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 100% rename from 0111-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch diff --git a/0112-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 100% rename from 0112-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch diff --git a/0113-Add-efi-export-env-and-efi-load-env-commands.patch b/0114-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 100% rename from 0113-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0114-Add-efi-export-env-and-efi-load-env-commands.patch diff --git a/0114-Make-it-possible-to-subtract-conditions-from-debug.patch b/0115-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 100% rename from 0114-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0115-Make-it-possible-to-subtract-conditions-from-debug.patch diff --git a/0115-Export-all-variables-from-the-initial-context-when-c.patch b/0116-Export-all-variables-from-the-initial-context-when-c.patch similarity index 100% rename from 0115-Export-all-variables-from-the-initial-context-when-c.patch rename to 0116-Export-all-variables-from-the-initial-context-when-c.patch diff --git a/0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 99% rename from 0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index f0cc94e8..92f259dc 100644 --- a/0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -21,7 +21,7 @@ Signed-off-by: Robbie Harwood rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index e10fe766d1d..b4ce5383b76 100644 +index 27a13bc734e..2e6ad979c3e 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -459,14 +459,14 @@ script = { diff --git a/0117-Fix-systemctl-kexec-exit-status-check.patch b/0118-Fix-systemctl-kexec-exit-status-check.patch similarity index 100% rename from 0117-Fix-systemctl-kexec-exit-status-check.patch rename to 0118-Fix-systemctl-kexec-exit-status-check.patch diff --git a/0118-Print-grub-emu-linux-loader-messages-as-debug.patch b/0119-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 100% rename from 0118-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0119-Print-grub-emu-linux-loader-messages-as-debug.patch diff --git a/0119-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 100% rename from 0119-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch diff --git a/0120-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0120-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0121-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0121-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0122-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 100% rename from 0122-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0123-Add-start-symbol-for-RISC-V.patch b/0124-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0123-Add-start-symbol-for-RISC-V.patch rename to 0124-Add-start-symbol-for-RISC-V.patch diff --git a/0124-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 100% rename from 0124-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/0125-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 100% rename from 0125-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch diff --git a/0126-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0126-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0127-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0127-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0128-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0128-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0129-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0129-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0130-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 100% rename from 0130-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch diff --git a/0131-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 100% rename from 0131-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0132-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 100% rename from 0132-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0133-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 100% rename from 0133-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0134-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 100% rename from 0134-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch diff --git a/0135-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 100% rename from 0135-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch diff --git a/0136-efi-dhcp-fix-some-allocation-error-checking.patch b/0137-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0136-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0137-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0137-efi-http-fix-some-allocation-error-checking.patch b/0138-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0137-efi-http-fix-some-allocation-error-checking.patch rename to 0138-efi-http-fix-some-allocation-error-checking.patch diff --git a/0138-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0138-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0139-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 100% rename from 0139-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch diff --git a/0140-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 100% rename from 0140-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch diff --git a/0141-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 100% rename from 0141-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch diff --git a/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0143-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0144-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0144-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0145-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0145-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 99% rename from 0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch index c76d8688..8e2481e7 100644 --- a/0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch +++ b/0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -65,7 +65,7 @@ Signed-off-by: Hans de Goede create mode 100644 util/systemd/systemd-integration.sh.in diff --git a/Makefile.util.def b/Makefile.util.def -index b4ce5383b76..6366442129d 100644 +index 2e6ad979c3e..9927c2cfd6a 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -470,6 +470,12 @@ script = { diff --git a/0147-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0147-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0148-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 100% rename from 0148-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0149-grub-install-disable-support-for-EFI-platforms.patch b/0150-grub-install-disable-support-for-EFI-platforms.patch similarity index 100% rename from 0149-grub-install-disable-support-for-EFI-platforms.patch rename to 0150-grub-install-disable-support-for-EFI-platforms.patch diff --git a/0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 95% rename from 0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch index 743e8ad1..d216284c 100644 --- a/0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,10 +15,10 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index b45ddb2292f..6b19c489cb0 100644 +index c6bd965f1f9..3c808a72230 100644 --- a/configure.ac +++ b/configure.ac -@@ -1611,6 +1611,17 @@ else +@@ -1613,6 +1613,17 @@ else fi AC_SUBST([BOOT_TIME_STATS]) @@ -36,7 +36,7 @@ index b45ddb2292f..6b19c489cb0 100644 AC_ARG_ENABLE([grub-emu-sdl], [AS_HELP_STRING([--enable-grub-emu-sdl], [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) -@@ -2162,6 +2173,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) +@@ -2194,6 +2205,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) @@ -44,7 +44,7 @@ index b45ddb2292f..6b19c489cb0 100644 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) -@@ -2257,6 +2269,12 @@ else +@@ -2289,6 +2301,12 @@ else echo With boot time statistics: No fi diff --git a/0151-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 100% rename from 0151-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch diff --git a/0152-Introduce-function-grub_debug_is_enabled-void-return.patch b/0153-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 100% rename from 0152-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0153-Introduce-function-grub_debug_is_enabled-void-return.patch diff --git a/0153-Don-t-clear-screen-when-debugging-is-enabled.patch b/0154-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 100% rename from 0153-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0154-Don-t-clear-screen-when-debugging-is-enabled.patch diff --git a/0154-grub_file_-instrumentation-new-file-debug-tag.patch b/0155-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0154-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0155-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0155-ieee1275-Avoiding-many-unecessary-open-close.patch b/0156-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0155-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0156-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0156-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0156-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0157-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0158-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0157-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0158-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 100% rename from 0158-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0159-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 100% rename from 0159-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch diff --git a/0160-docs-grub-Document-signing-grub-under-UEFI.patch b/0161-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0160-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0161-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0161-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0161-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0162-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0162-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0163-pgp-factor-out-rsa_pad.patch b/0164-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0163-pgp-factor-out-rsa_pad.patch rename to 0164-pgp-factor-out-rsa_pad.patch diff --git a/0164-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0164-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0165-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0165-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0166-libtasn1-import-libtasn1-4.16.0.patch b/0167-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0166-libtasn1-import-libtasn1-4.16.0.patch rename to 0167-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0167-libtasn1-disable-code-not-needed-in-grub.patch b/0168-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0167-libtasn1-disable-code-not-needed-in-grub.patch rename to 0168-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0168-libtasn1-changes-for-grub-compatibility.patch b/0169-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0168-libtasn1-changes-for-grub-compatibility.patch rename to 0169-libtasn1-changes-for-grub-compatibility.patch diff --git a/0169-libtasn1-compile-into-asn1-module.patch b/0170-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0169-libtasn1-compile-into-asn1-module.patch rename to 0170-libtasn1-compile-into-asn1-module.patch diff --git a/0170-test_asn1-test-module-for-libtasn1.patch b/0171-test_asn1-test-module-for-libtasn1.patch similarity index 99% rename from 0170-test_asn1-test-module-for-libtasn1.patch rename to 0171-test_asn1-test-module-for-libtasn1.patch index a2f4d547..b659558b 100644 --- a/0170-test_asn1-test-module-for-libtasn1.patch +++ b/0171-test_asn1-test-module-for-libtasn1.patch @@ -51,10 +51,10 @@ Signed-off-by: Daniel Axtens create mode 100644 tests/test_asn1.in diff --git a/Makefile.util.def b/Makefile.util.def -index 6366442129d..d04b3fe68a1 100644 +index 9927c2cfd6a..3f191aa8095 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1289,6 +1289,12 @@ script = { +@@ -1306,6 +1306,12 @@ script = { common = tests/syslinux_test.in; }; diff --git a/0171-grub-install-support-embedding-x509-certificates.patch b/0172-grub-install-support-embedding-x509-certificates.patch similarity index 100% rename from 0171-grub-install-support-embedding-x509-certificates.patch rename to 0172-grub-install-support-embedding-x509-certificates.patch diff --git a/0172-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0172-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0173-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0173-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0174-appended-signatures-support-verifying-appended-signa.patch b/0175-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0174-appended-signatures-support-verifying-appended-signa.patch rename to 0175-appended-signatures-support-verifying-appended-signa.patch diff --git a/0175-appended-signatures-verification-tests.patch b/0176-appended-signatures-verification-tests.patch similarity index 100% rename from 0175-appended-signatures-verification-tests.patch rename to 0176-appended-signatures-verification-tests.patch diff --git a/0176-appended-signatures-documentation.patch b/0177-appended-signatures-documentation.patch similarity index 100% rename from 0176-appended-signatures-documentation.patch rename to 0177-appended-signatures-documentation.patch diff --git a/0177-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 100% rename from 0177-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch diff --git a/0178-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0178-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0179-ieee1275-claim-more-memory.patch b/0180-ieee1275-claim-more-memory.patch similarity index 100% rename from 0179-ieee1275-claim-more-memory.patch rename to 0180-ieee1275-claim-more-memory.patch diff --git a/0180-ieee1275-request-memory-with-ibm-client-architecture.patch b/0181-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0180-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0181-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0181-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0181-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0182-ieee1275-ofdisk-retry-on-open-failure.patch b/0183-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0182-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0183-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0183-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 100% rename from 0183-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch diff --git a/0184-efinet-Add-DHCP-proxy-support.patch b/0185-efinet-Add-DHCP-proxy-support.patch similarity index 100% rename from 0184-efinet-Add-DHCP-proxy-support.patch rename to 0185-efinet-Add-DHCP-proxy-support.patch diff --git a/0185-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0185-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0186-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 100% rename from 0186-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch diff --git a/0187-Suppress-gettext-error-message.patch b/0188-Suppress-gettext-error-message.patch similarity index 100% rename from 0187-Suppress-gettext-error-message.patch rename to 0188-Suppress-gettext-error-message.patch diff --git a/0188-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0188-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0189-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 100% rename from 0189-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch diff --git a/0190-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 100% rename from 0190-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0191-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 100% rename from 0191-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch diff --git a/0192-normal-main-Discover-the-device-to-read-the-config-f.patch b/0193-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 100% rename from 0192-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0193-normal-main-Discover-the-device-to-read-the-config-f.patch diff --git a/0193-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 100% rename from 0193-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch diff --git a/0194-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0194-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0195-Print-module-name-on-license-check-failure.patch b/0196-Print-module-name-on-license-check-failure.patch similarity index 100% rename from 0195-Print-module-name-on-license-check-failure.patch rename to 0196-Print-module-name-on-license-check-failure.patch diff --git a/0196-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 100% rename from 0196-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/0197-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0198-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 100% rename from 0197-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/0198-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch similarity index 100% rename from 0198-fs-btrfs-Use-full-btrfs-bootloader-area.patch rename to 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/0199-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0200-Add-Fedora-location-of-DejaVu-SANS-font.patch similarity index 95% rename from 0199-Add-Fedora-location-of-DejaVu-SANS-font.patch rename to 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch index 493484c0..eb76649e 100644 --- a/0199-Add-Fedora-location-of-DejaVu-SANS-font.patch +++ b/0200-Add-Fedora-location-of-DejaVu-SANS-font.patch @@ -16,10 +16,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 6b19c489cb0..0510afe0172 100644 +index 3c808a72230..3527f069ab2 100644 --- a/configure.ac +++ b/configure.ac -@@ -1810,7 +1810,7 @@ fi +@@ -1812,7 +1812,7 @@ fi if test x"$starfield_excuse" = x; then for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do diff --git a/0200-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch similarity index 100% rename from 0200-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch rename to 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch diff --git a/0201-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch similarity index 100% rename from 0201-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch rename to 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch diff --git a/0202-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch similarity index 100% rename from 0202-EFI-console-Do-not-set-colorstate-until-the-first-te.patch rename to 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch diff --git a/0203-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch similarity index 100% rename from 0203-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch rename to 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch diff --git a/0204-Use-visual-indentation-in-config.h.in.patch b/0205-Use-visual-indentation-in-config.h.in.patch similarity index 100% rename from 0204-Use-visual-indentation-in-config.h.in.patch rename to 0205-Use-visual-indentation-in-config.h.in.patch diff --git a/0205-Where-present-ensure-config-util.h-precedes-config.h.patch b/0206-Where-present-ensure-config-util.h-precedes-config.h.patch similarity index 100% rename from 0205-Where-present-ensure-config-util.h-precedes-config.h.patch rename to 0206-Where-present-ensure-config-util.h-precedes-config.h.patch diff --git a/0206-Drop-gnulib-fix-base64.patch.patch b/0207-Drop-gnulib-fix-base64.patch.patch similarity index 100% rename from 0206-Drop-gnulib-fix-base64.patch.patch rename to 0207-Drop-gnulib-fix-base64.patch.patch diff --git a/0207-Drop-gnulib-no-abort.patch.patch b/0208-Drop-gnulib-no-abort.patch.patch similarity index 100% rename from 0207-Drop-gnulib-no-abort.patch.patch rename to 0208-Drop-gnulib-no-abort.patch.patch diff --git a/0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch similarity index 99% rename from 0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch rename to 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch index a3f9a619..4b5a44c8 100644 --- a/0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch +++ b/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch @@ -48,7 +48,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch diff --git a/configure.ac b/configure.ac -index 0510afe0172..eb928485e45 100644 +index 3527f069ab2..d04c94691ef 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,7 @@ AC_CANONICAL_TARGET diff --git a/0209-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch similarity index 100% rename from 0209-commands-search-Fix-bug-stopping-iteration-when-no-f.patch rename to 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch diff --git a/0210-search-new-efidisk-only-option-on-EFI-systems.patch b/0211-search-new-efidisk-only-option-on-EFI-systems.patch similarity index 100% rename from 0210-search-new-efidisk-only-option-on-EFI-systems.patch rename to 0211-search-new-efidisk-only-option-on-EFI-systems.patch diff --git a/0211-efi-new-connectefi-command.patch b/0212-efi-new-connectefi-command.patch similarity index 100% rename from 0211-efi-new-connectefi-command.patch rename to 0212-efi-new-connectefi-command.patch diff --git a/0212-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch similarity index 100% rename from 0212-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch rename to 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch diff --git a/0213-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch similarity index 100% rename from 0213-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch rename to 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch diff --git a/0214-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch similarity index 100% rename from 0214-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch rename to 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch diff --git a/0216-Correct-sorting-of-kernel-names-containing-_.patch b/0216-Correct-sorting-of-kernel-names-containing-_.patch deleted file mode 100644 index e0694cf5..00000000 --- a/0216-Correct-sorting-of-kernel-names-containing-_.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Tue, 18 Jan 2022 12:22:15 -0500 -Subject: [PATCH] Correct sorting of kernel names containing '_' - -sort(1) from GNU coreutils does not treat underscore as part of a -version number for `sort -V. This causes misorderings on x86_64, where -e.g. kernel-core-3.17.6-300.11.fc21.x86_64 will incorrectly sort -*before* kernel-core-3.17.6-300.fc21.x86_64. - -To cope with this behavior, replace underscores with dashes in order to -approximate their intended meaning as version component separators. - -Fixes: https://savannah.gnu.org/bugs/?42844 -Signed-off-by: Robbie Harwood ---- - util/grub-mkconfig_lib.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 301d8a8a1e4..57fb95e3aeb 100644 ---- a/util/grub-mkconfig_lib.in -+++ b/util/grub-mkconfig_lib.in -@@ -261,8 +261,8 @@ version_test_numeric () - - version_test_gt () - { -- version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`" -- version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`" -+ version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//" -e "s/_/-/g"`" -+ version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//" -e "s/_/-/g"`" - version_test_gt_cmp=gt - if [ "x$version_test_gt_b" = "x" ] ; then - return 0 diff --git a/0215-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch similarity index 100% rename from 0215-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch rename to 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/grub.patches b/grub.patches index 43b407bf..29c58942 100644 --- a/grub.patches +++ b/grub.patches @@ -30,187 +30,187 @@ Patch0029: 0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch Patch0030: 0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch Patch0031: 0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch Patch0032: 0032-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0033: 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0034: 0034-Add-friendly-grub2-password-config-tool-985962.patch -Patch0035: 0035-tcp-add-window-scaling-support.patch -Patch0036: 0036-efinet-and-bootp-add-support-for-dhcpv6.patch -Patch0037: 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0038: 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch -Patch0039: 0039-Make-grub_fatal-also-backtrace.patch -Patch0040: 0040-Fix-up-some-man-pages-rpmdiff-noticed.patch -Patch0041: 0041-Make-our-info-pages-say-grub2-where-appropriate.patch -Patch0042: 0042-macos-just-build-chainloader-entries-don-t-try-any-x.patch -Patch0043: 0043-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch -Patch0044: 0044-export-btrfs_subvol-and-btrfs_subvolid.patch -Patch0045: 0045-grub2-btrfs-03-follow_default.patch -Patch0046: 0046-grub2-btrfs-04-grub2-install.patch -Patch0047: 0047-grub2-btrfs-05-grub2-mkconfig.patch -Patch0048: 0048-grub2-btrfs-06-subvol-mount.patch -Patch0049: 0049-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch -Patch0050: 0050-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch -Patch0051: 0051-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch -Patch0052: 0052-Use-grub_efi_.-memory-helpers-where-reasonable.patch -Patch0053: 0053-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch -Patch0054: 0054-don-t-use-int-for-efi-status.patch -Patch0055: 0055-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch -Patch0056: 0056-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch -Patch0057: 0057-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch -Patch0058: 0058-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch -Patch0059: 0059-align-struct-efi_variable-better.patch -Patch0060: 0060-Add-BLS-support-to-grub-mkconfig.patch -Patch0061: 0061-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0062: 0062-Add-linux-and-initrd-commands-for-grub-emu.patch -Patch0063: 0063-Add-grub2-switch-to-blscfg.patch -Patch0064: 0064-make-better-backtraces.patch -Patch0065: 0065-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0066: 0066-Work-around-some-minor-include-path-weirdnesses.patch -Patch0067: 0067-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0068: 0068-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0069: 0069-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch -Patch0070: 0070-Fixup-for-newer-compiler.patch -Patch0071: 0071-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0072: 0072-Fixup-for-newer-compiler.patch -Patch0073: 0073-Add-support-for-non-Ethernet-network-cards.patch -Patch0074: 0074-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0075: 0075-bootp-New-net_bootp6-command.patch -Patch0076: 0076-efinet-UEFI-IPv6-PXE-support.patch -Patch0077: 0077-grub.texi-Add-net_bootp6-doument.patch -Patch0078: 0078-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0079: 0079-efinet-Setting-network-from-UEFI-device-path.patch -Patch0080: 0080-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0081: 0081-Support-UEFI-networking-protocols.patch -Patch0082: 0082-AUDIT-0-http-boot-tracker-bug.patch -Patch0083: 0083-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0084: 0084-Add-auto-hide-menu-support.patch -Patch0085: 0085-Add-grub-set-bootflag-utility.patch -Patch0086: 0086-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0087: 0087-gentpl-add-disable-support.patch -Patch0088: 0088-gentpl-add-pc-firmware-type.patch -Patch0089: 0089-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0090: 0090-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0091: 0091-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0092: 0092-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0093: 0093-Rework-how-the-fdt-command-builds.patch -Patch0094: 0094-Disable-non-wordsize-allocations-on-arm.patch -Patch0095: 0095-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0096: 0096-Make-grub_error-more-verbose.patch -Patch0097: 0097-Make-reset-an-alias-for-the-reboot-command.patch -Patch0098: 0098-Add-a-version-command.patch -Patch0099: 0099-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0100: 0100-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0101: 0101-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0102: 0102-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0103: 0103-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0104: 0104-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0105: 0105-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0106: 0106-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0107: 0107-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0108: 0108-Fix-getroot.c-s-trampolines.patch -Patch0109: 0109-Do-not-allow-stack-trampolines-anywhere.patch -Patch0110: 0110-Reimplement-boot_counter.patch -Patch0111: 0111-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0112: 0112-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0113: 0113-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0114: 0114-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0115: 0115-Export-all-variables-from-the-initial-context-when-c.patch -Patch0116: 0116-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0117: 0117-Fix-systemctl-kexec-exit-status-check.patch -Patch0118: 0118-Print-grub-emu-linux-loader-messages-as-debug.patch -Patch0119: 0119-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0120: 0120-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0121: 0121-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0122: 0122-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0123: 0123-Add-start-symbol-for-RISC-V.patch -Patch0124: 0124-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0125: 0125-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0126: 0126-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0127: 0127-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0128: 0128-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0129: 0129-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0130: 0130-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0131: 0131-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0132: 0132-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0133: 0133-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0134: 0134-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0135: 0135-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0136: 0136-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0137: 0137-efi-http-fix-some-allocation-error-checking.patch -Patch0138: 0138-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0139: 0139-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0140: 0140-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0141: 0141-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0144: 0144-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0145: 0145-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0146: 0146-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0147: 0147-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0148: 0148-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0149: 0149-grub-install-disable-support-for-EFI-platforms.patch -Patch0150: 0150-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0151: 0151-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0152: 0152-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0153: 0153-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0154: 0154-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0155: 0155-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0156: 0156-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0157: 0157-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0158: 0158-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0159: 0159-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0160: 0160-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0161: 0161-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0162: 0162-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0163: 0163-pgp-factor-out-rsa_pad.patch -Patch0164: 0164-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0165: 0165-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0166: 0166-libtasn1-import-libtasn1-4.16.0.patch -Patch0167: 0167-libtasn1-disable-code-not-needed-in-grub.patch -Patch0168: 0168-libtasn1-changes-for-grub-compatibility.patch -Patch0169: 0169-libtasn1-compile-into-asn1-module.patch -Patch0170: 0170-test_asn1-test-module-for-libtasn1.patch -Patch0171: 0171-grub-install-support-embedding-x509-certificates.patch -Patch0172: 0172-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0173: 0173-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0174: 0174-appended-signatures-support-verifying-appended-signa.patch -Patch0175: 0175-appended-signatures-verification-tests.patch -Patch0176: 0176-appended-signatures-documentation.patch -Patch0177: 0177-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0178: 0178-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0179: 0179-ieee1275-claim-more-memory.patch -Patch0180: 0180-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0181: 0181-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0182: 0182-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0183: 0183-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0184: 0184-efinet-Add-DHCP-proxy-support.patch -Patch0185: 0185-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0186: 0186-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0187: 0187-Suppress-gettext-error-message.patch -Patch0188: 0188-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0189: 0189-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0190: 0190-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0191: 0191-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0192: 0192-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0193: 0193-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0194: 0194-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0195: 0195-Print-module-name-on-license-check-failure.patch -Patch0196: 0196-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0197: 0197-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0198: 0198-fs-btrfs-Use-full-btrfs-bootloader-area.patch -Patch0199: 0199-Add-Fedora-location-of-DejaVu-SANS-font.patch -Patch0200: 0200-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch -Patch0201: 0201-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch -Patch0202: 0202-EFI-console-Do-not-set-colorstate-until-the-first-te.patch -Patch0203: 0203-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch -Patch0204: 0204-Use-visual-indentation-in-config.h.in.patch -Patch0205: 0205-Where-present-ensure-config-util.h-precedes-config.h.patch -Patch0206: 0206-Drop-gnulib-fix-base64.patch.patch -Patch0207: 0207-Drop-gnulib-no-abort.patch.patch -Patch0208: 0208-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0209: 0209-commands-search-Fix-bug-stopping-iteration-when-no-f.patch -Patch0210: 0210-search-new-efidisk-only-option-on-EFI-systems.patch -Patch0211: 0211-efi-new-connectefi-command.patch -Patch0212: 0212-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch -Patch0213: 0213-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch -Patch0214: 0214-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch -Patch0215: 0215-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch -Patch0216: 0216-Correct-sorting-of-kernel-names-containing-_.patch +Patch0033: 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch +Patch0034: 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0035: 0035-Add-friendly-grub2-password-config-tool-985962.patch +Patch0036: 0036-tcp-add-window-scaling-support.patch +Patch0037: 0037-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0038: 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0039: 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch +Patch0040: 0040-Make-grub_fatal-also-backtrace.patch +Patch0041: 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch +Patch0042: 0042-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0043: 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0044: 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0045: 0045-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0046: 0046-grub2-btrfs-03-follow_default.patch +Patch0047: 0047-grub2-btrfs-04-grub2-install.patch +Patch0048: 0048-grub2-btrfs-05-grub2-mkconfig.patch +Patch0049: 0049-grub2-btrfs-06-subvol-mount.patch +Patch0050: 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0051: 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0052: 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0053: 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0054: 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0055: 0055-don-t-use-int-for-efi-status.patch +Patch0056: 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0057: 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +Patch0058: 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +Patch0059: 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +Patch0060: 0060-align-struct-efi_variable-better.patch +Patch0061: 0061-Add-BLS-support-to-grub-mkconfig.patch +Patch0062: 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +Patch0063: 0063-Add-linux-and-initrd-commands-for-grub-emu.patch +Patch0064: 0064-Add-grub2-switch-to-blscfg.patch +Patch0065: 0065-make-better-backtraces.patch +Patch0066: 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0067: 0067-Work-around-some-minor-include-path-weirdnesses.patch +Patch0068: 0068-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0069: 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0070: 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0071: 0071-Fixup-for-newer-compiler.patch +Patch0072: 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +Patch0073: 0073-Fixup-for-newer-compiler.patch +Patch0074: 0074-Add-support-for-non-Ethernet-network-cards.patch +Patch0075: 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0076: 0076-bootp-New-net_bootp6-command.patch +Patch0077: 0077-efinet-UEFI-IPv6-PXE-support.patch +Patch0078: 0078-grub.texi-Add-net_bootp6-doument.patch +Patch0079: 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0080: 0080-efinet-Setting-network-from-UEFI-device-path.patch +Patch0081: 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0082: 0082-Support-UEFI-networking-protocols.patch +Patch0083: 0083-AUDIT-0-http-boot-tracker-bug.patch +Patch0084: 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0085: 0085-Add-auto-hide-menu-support.patch +Patch0086: 0086-Add-grub-set-bootflag-utility.patch +Patch0087: 0087-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0088: 0088-gentpl-add-disable-support.patch +Patch0089: 0089-gentpl-add-pc-firmware-type.patch +Patch0090: 0090-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0091: 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0092: 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0093: 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0094: 0094-Rework-how-the-fdt-command-builds.patch +Patch0095: 0095-Disable-non-wordsize-allocations-on-arm.patch +Patch0096: 0096-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0097: 0097-Make-grub_error-more-verbose.patch +Patch0098: 0098-Make-reset-an-alias-for-the-reboot-command.patch +Patch0099: 0099-Add-a-version-command.patch +Patch0100: 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0101: 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0102: 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0103: 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0104: 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0105: 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0106: 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0107: 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0108: 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0109: 0109-Fix-getroot.c-s-trampolines.patch +Patch0110: 0110-Do-not-allow-stack-trampolines-anywhere.patch +Patch0111: 0111-Reimplement-boot_counter.patch +Patch0112: 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0113: 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0114: 0114-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0115: 0115-Make-it-possible-to-subtract-conditions-from-debug.patch +Patch0116: 0116-Export-all-variables-from-the-initial-context-when-c.patch +Patch0117: 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0118: 0118-Fix-systemctl-kexec-exit-status-check.patch +Patch0119: 0119-Print-grub-emu-linux-loader-messages-as-debug.patch +Patch0120: 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0121: 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0122: 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0123: 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0124: 0124-Add-start-symbol-for-RISC-V.patch +Patch0125: 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0126: 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0127: 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0128: 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0129: 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0130: 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0131: 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0132: 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0133: 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0134: 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0135: 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0136: 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0137: 0137-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0138: 0138-efi-http-fix-some-allocation-error-checking.patch +Patch0139: 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0140: 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0141: 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0144: 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0145: 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0146: 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0147: 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0148: 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0149: 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0150: 0150-grub-install-disable-support-for-EFI-platforms.patch +Patch0151: 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0152: 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0153: 0153-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0154: 0154-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0155: 0155-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0156: 0156-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0157: 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0158: 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0159: 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0160: 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0161: 0161-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0162: 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0163: 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0164: 0164-pgp-factor-out-rsa_pad.patch +Patch0165: 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0166: 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0167: 0167-libtasn1-import-libtasn1-4.16.0.patch +Patch0168: 0168-libtasn1-disable-code-not-needed-in-grub.patch +Patch0169: 0169-libtasn1-changes-for-grub-compatibility.patch +Patch0170: 0170-libtasn1-compile-into-asn1-module.patch +Patch0171: 0171-test_asn1-test-module-for-libtasn1.patch +Patch0172: 0172-grub-install-support-embedding-x509-certificates.patch +Patch0173: 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0174: 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0175: 0175-appended-signatures-support-verifying-appended-signa.patch +Patch0176: 0176-appended-signatures-verification-tests.patch +Patch0177: 0177-appended-signatures-documentation.patch +Patch0178: 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0179: 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0180: 0180-ieee1275-claim-more-memory.patch +Patch0181: 0181-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0182: 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0183: 0183-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0184: 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0185: 0185-efinet-Add-DHCP-proxy-support.patch +Patch0186: 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0187: 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0188: 0188-Suppress-gettext-error-message.patch +Patch0189: 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0190: 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0191: 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0192: 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0193: 0193-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0194: 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0195: 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0196: 0196-Print-module-name-on-license-check-failure.patch +Patch0197: 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0198: 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0199: 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0200: 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch +Patch0201: 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +Patch0202: 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +Patch0203: 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +Patch0204: 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +Patch0205: 0205-Use-visual-indentation-in-config.h.in.patch +Patch0206: 0206-Where-present-ensure-config-util.h-precedes-config.h.patch +Patch0207: 0207-Drop-gnulib-fix-base64.patch.patch +Patch0208: 0208-Drop-gnulib-no-abort.patch.patch +Patch0209: 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch +Patch0210: 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +Patch0211: 0211-search-new-efidisk-only-option-on-EFI-systems.patch +Patch0212: 0212-efi-new-connectefi-command.patch +Patch0213: 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0214: 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +Patch0215: 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0216: 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/grub2.spec b/grub2.spec index 9f788964..b7a1117a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 26%{?dist} +Release: 27%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -422,6 +422,7 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %{_datarootdir}/bash-completion/completions/grub %{_sbindir}/%{name}-mkconfig %{_sbindir}/%{name}-switch-to-blscfg +%{_sbindir}/%{name}-rpm-sort %{_sbindir}/%{name}-reboot %{_bindir}/%{name}-file %{_bindir}/%{name}-menulst2cfg @@ -525,6 +526,12 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Mar 22 2022 Adam Williamson - 2.06-27 +- Revert "Use my sort patch instead", it broke Rawhide +- Tweak BLS skipping on ostree to work in chroots (I hope) +- Resolves: #2066969 +- Resolves: #2059776 + * Tue Mar 22 2022 Robbie Harwood - 2.06-26 - Fix rebase on x509 embedding patch From 5d7c163550eb4489189a2ec29accb1ac9d21d162 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 23 Mar 2022 10:29:57 +0000 Subject: [PATCH 116/294] Rebuild for secure-boot signing --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index b7a1117a..cf68e0c3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 27%{?dist} +Release: 28%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Mar 23 2022 Peter Robinson 2.06-28 +- Rebuild for secure-boot signing + * Tue Mar 22 2022 Adam Williamson - 2.06-27 - Revert "Use my sort patch instead", it broke Rawhide - Tweak BLS skipping on ostree to work in chroots (I hope) From f29388d27ac1c733697d8f64d703a00ac60a4c89 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 23 Mar 2022 16:48:18 -0700 Subject: [PATCH 117/294] Fix a syntax error in the ostree BLS fix attempt --- 0064-Add-grub2-switch-to-blscfg.patch | 2 +- grub2.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/0064-Add-grub2-switch-to-blscfg.patch b/0064-Add-grub2-switch-to-blscfg.patch index 650d56f2..ccac3579 100644 --- a/0064-Add-grub2-switch-to-blscfg.patch +++ b/0064-Add-grub2-switch-to-blscfg.patch @@ -420,7 +420,7 @@ index 9fcd77cacc3..81f35a2f3f0 100644 get_sorted_bls() { - if ! [ -d "${blsdir}" ]; then -+ if ! [ -d "${blsdir}" ] || [ -f /run/ostree-booted ] || [ -d /ostree/repo ]]; then ++ if ! [ -d "${blsdir}" ] || [ -f /run/ostree-booted ] || [ -d /ostree/repo ]; then return fi diff --git a/grub2.spec b/grub2.spec index cf68e0c3..486931c9 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 28%{?dist} +Release: 29%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Mar 23 2022 Adam Williamson - 2.06-29 +- Fix a syntax error in the ostree BLS fix attempt + * Wed Mar 23 2022 Peter Robinson 2.06-28 - Rebuild for secure-boot signing From 2b909b72a4317b3584d43ee5d2cf6b369719db12 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 29 Mar 2022 18:45:49 +0000 Subject: [PATCH 118/294] Drop i32 support Signed-off-by: Robbie Harwood --- grub2.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grub2.spec b/grub2.spec index 486931c9..0df7d5da 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 29%{?dist} +Release: 30%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -58,7 +58,7 @@ BuildRequires: pesign >= 0.99-8 BuildRequires: ccache %endif -ExcludeArch: s390 s390x +ExcludeArch: s390 s390x %{ix86} Obsoletes: %{name} <= %{evr} %if 0%{with_legacy_arch} @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Mar 29 2022 Robbie Harwood - 2.06-30 +- Drop i32 support + * Wed Mar 23 2022 Adam Williamson - 2.06-29 - Fix a syntax error in the ostree BLS fix attempt From d171a2a95c9fb2ce2490bac0066fa9354c0c0e3a Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 30 Mar 2022 14:44:17 +0000 Subject: [PATCH 119/294] Revert previous change (grub2-pc-modules is built on i32) Signed-off-by: Robbie Harwood --- grub2.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grub2.spec b/grub2.spec index 0df7d5da..f0feedb5 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 30%{?dist} +Release: 31%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -58,7 +58,7 @@ BuildRequires: pesign >= 0.99-8 BuildRequires: ccache %endif -ExcludeArch: s390 s390x %{ix86} +ExcludeArch: s390 s390x Obsoletes: %{name} <= %{evr} %if 0%{with_legacy_arch} @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Mar 30 2022 Robbie Harwood - 2.06-31 +- Revert previous change (grub2-pc-modules is built on i32) + * Tue Mar 29 2022 Robbie Harwood - 2.06-30 - Drop i32 support From bd73b85ea3356cbeac4afd7095ebf923c60ab7a3 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 31 Mar 2022 21:21:43 +0000 Subject: [PATCH 120/294] Switch to upstream man pages Signed-off-by: Robbie Harwood --- ...-Fix-user-facing-typo-with-an-incorr.patch | 2 +- ...-Properly-disable-the-os-prober-by-d.patch | 4 +- ...tes-Disable-the-os-prober-by-default.patch | 4 +- ...d-support-for-Linux-EFI-stub-loading.patch | 26 +- 0005-Rework-linux-command.patch | 2 +- 0006-Rework-linux16-command.patch | 2 +- ...ecureboot-support-on-efi-chainloader.patch | 14 +- ...loaders-that-link-in-efi-mode-honor-.patch | 32 +- ...rch-64-on-32-boot-in-linuxefi-loader.patch | 6 +- 0010-re-write-.gitignore.patch | 14 +- ...ient-architecture-CAS-reboot-support.patch | 8 +- ...nsole-display-attr-when-clear-screen.patch | 2 +- ...video-support-for-IBM-power-machines.patch | 6 +- 0014-Move-bash-completion-script-922997.patch | 4 +- ...o-include-entries-by-title-not-just-.patch | 2 +- 0016-Make-exit-take-a-return-code.patch | 28 +- ...es-load-an-env-block-from-a-variable.patch | 4 +- 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch | 4 +- 0019-Add-fw_path-variable-revised.patch | 4 +- ...-hex-hex-straight-through-unmolested.patch | 6 +- ...g-module-to-parse-Boot-Loader-Specif.patch | 20 +- 0022-Add-devicetree-loading.patch | 4 +- 0023-Enable-pager-by-default.-985860.patch | 2 +- ...n-t-say-GNU-Linux-in-generated-menus.patch | 4 +- ...rame-to-list-of-relocations-stripped.patch | 2 +- ...password-to-boot-entries-generated-b.patch | 2 +- ...f-man-pages-with-slightly-nicer-ones.patch | 1959 ----------------- ...ix-when-fallback-searching-for-grub-.patch | 2 +- ...-before-grub.cfg-on-tftp-config-file.patch | 2 +- ...CLASS-in-10_linux-from-etc-os-releas.patch | 2 +- ...t-ordering-for-.debug-and-rescue-ker.patch | 2 +- ...1-Try-prefix-if-fw_path-doesn-t-work.patch | 6 +- ...32-Use-rpm-s-sort-for-grub2-mkconfig.patch | 64 +- ...fig-construct-titles-that-look-like-.patch | 2 +- ...ly-grub2-password-config-tool-985962.patch | 72 +- ... 0035-tcp-add-window-scaling-support.patch | 2 +- ...net-and-bootp-add-support-for-dhcpv6.patch | 12 +- ...rnel-settings-and-use-it-in-10_linux.patch | 63 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 2 +- ... 0039-Make-grub_fatal-also-backtrace.patch | 10 +- ...fo-pages-say-grub2-where-appropriate.patch | 4 +- ...ix-up-some-man-pages-rpmdiff-noticed.patch | 150 -- ...-chainloader-entries-don-t-try-any-x.patch | 2 +- ...-Add-ability-to-boot-from-subvolumes.patch | 4 +- ...port-btrfs_subvol-and-btrfs_subvolid.patch | 2 +- ...> 0044-grub2-btrfs-03-follow_default.patch | 2 +- ...=> 0045-grub2-btrfs-04-grub2-install.patch | 12 +- ...> 0046-grub2-btrfs-05-grub2-mkconfig.patch | 10 +- ... => 0047-grub2-btrfs-06-subvol-mount.patch | 8 +- ...subvol-name-scheme-to-support-old-sn.patch | 2 +- ...-correctly-with-btrfs-snapshots-bsc-.patch | 2 +- ...ocate_pool-and-grub_efi_free_pool-wr.patch | 2 +- ...fi_.-memory-helpers-where-reasonable.patch | 2 +- ...2-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 4 +- ...=> 0053-don-t-use-int-for-efi-status.patch | 2 +- ...INIT-declare-its-function-prototypes.patch | 2 +- ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 2 +- ...d-xen-or-multiboot-2-modules-as-need.patch | 2 +- ...-calibration-not-take-51-seconds-to-.patch | 2 +- ...058-align-struct-efi_variable-better.patch | 4 +- ...059-Add-BLS-support-to-grub-mkconfig.patch | 25 +- ...-backtrace-on-grub_abort-for-grub-em.patch | 2 +- ...nux-and-initrd-commands-for-grub-emu.patch | 16 +- ...h => 0062-Add-grub2-switch-to-blscfg.patch | 71 +- ...patch => 0063-make-better-backtraces.patch | 48 +- ...w-our-startup-message-if-debug-is-se.patch | 2 +- ...-some-minor-include-path-weirdnesses.patch | 8 +- ...it-possible-to-enabled-build-id-sha1.patch | 6 +- ...f-grub_dprintf-without-the-file-line.patch | 4 +- ...dprintf-that-tells-us-load-addresses.patch | 8 +- 0069-Fixup-for-newer-compiler.patch | 36 + ...-export-the-start-and-_start-symbols.patch | 2 +- 0071-Fixup-for-newer-compiler.patch | 42 +- ...pport-for-non-Ethernet-network-cards.patch | 24 +- 0073-Fixup-for-newer-compiler.patch | 22 - ...racketed-ipv6-addrs-and-port-numbers.patch | 8 +- ...=> 0074-bootp-New-net_bootp6-command.patch | 10 +- ...=> 0075-efinet-UEFI-IPv6-PXE-support.patch | 4 +- ...076-grub.texi-Add-net_bootp6-doument.patch | 2 +- ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 4 +- ...etting-network-from-UEFI-device-path.patch | 4 +- ...etting-DNS-server-from-UEFI-protocol.patch | 4 +- ...80-Support-UEFI-networking-protocols.patch | 34 +- ...> 0081-AUDIT-0-http-boot-tracker-bug.patch | 4 +- ...-incr-command-to-increment-integer-v.patch | 2 +- ...h => 0083-Add-auto-hide-menu-support.patch | 12 +- ...> 0084-Add-grub-set-bootflag-utility.patch | 75 +- ...b-boot-indeterminate.service-example.patch | 2 +- ...h => 0086-gentpl-add-disable-support.patch | 2 +- ... => 0087-gentpl-add-pc-firmware-type.patch | 2 +- ...e-the-firmware-acceleration-for-http.patch | 2 +- ...ot_url-reflect-the-protocol-hostname.patch | 2 +- ...n-tell-configure-which-cflags-utils-.patch | 10 +- ...make-it-possible-to-run-checkers-on-.patch | 6 +- ...92-Rework-how-the-fdt-command-builds.patch | 10 +- ...able-non-wordsize-allocations-on-arm.patch | 4 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 4 +- ...=> 0095-Make-grub_error-more-verbose.patch | 4 +- ...eset-an-alias-for-the-reboot-command.patch | 2 +- ....patch => 0097-Add-a-version-command.patch | 10 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 8 +- ...-Better-memory-allocation-and-error-.patch | 4 +- ...tter-locations-for-kernel-and-initrd.patch | 16 +- ...p-all-the-places-Wsign-compare-error.patch | 22 +- ...gn-compare-Wno-conversion-Wno-error-.patch | 8 +- ...ce-buffers-for-reading-to-addresses-.patch | 2 +- ...-arrange-grub_cmd_linux-a-little-bit.patch | 2 +- ...e-our-own-allocator-for-kernel-stuff.patch | 2 +- ...itrd-params-cmdline-allocations-abov.patch | 4 +- ... => 0107-Fix-getroot.c-s-trampolines.patch | 2 +- ...not-allow-stack-trampolines-anywhere.patch | 6 +- ...tch => 0109-Reimplement-boot_counter.patch | 8 +- ...ntry-selection-based-on-ID-and-title.patch | 2 +- ...try-users-option-argument-to-be-opti.patch | 2 +- ...export-env-and-efi-load-env-commands.patch | 16 +- ...le-to-subtract-conditions-from-debug.patch | 2 +- ...bles-from-the-initial-context-when-c.patch | 4 +- ...-boot-success-reset-from-menu-auto-h.patch | 8 +- ...ix-systemctl-kexec-exit-status-check.patch | 2 +- ...b-emu-linux-loader-messages-as-debug.patch | 2 +- ...t-boot-commands-will-only-return-on-.patch | 2 +- ...g-Update-comment-about-running-as-ro.patch | 2 +- ...g-Write-new-env-to-tmpfile-and-then-.patch | 8 +- ...indeterminate-getting-set-on-boot_su.patch | 2 +- ... => 0122-Add-start-symbol-for-RISC-V.patch | 2 +- ...conf-Force-autogen.sh-to-use-python3.patch | 2 +- ...fw-http-_path-variables-to-make-them.patch | 4 +- ...-literal-IPv6-addresses-in-square-br.patch | 2 +- ...o-specify-a-port-number-in-addresses.patch | 2 +- ...mprove-check-to-detect-literal-IPv6-.patch | 2 +- ...debug-message-if-parsing-the-address.patch | 2 +- ...so-accept-F8-as-a-user-interrupt-key.patch | 2 +- ...se-address-before-jumping-to-the-PE-.patch | 2 +- ...ate-TPM-measurement-errors-to-the-ve.patch | 2 +- ...maximum-bounce-buffer-size-to-16-MiB.patch | 2 +- ...fix-when-the-HTTP-path-is-relative-a.patch | 2 +- ...turn-in-efi-export-env-and-efi-load-.patch | 2 +- ...p-fix-some-allocation-error-checking.patch | 2 +- ...p-fix-some-allocation-error-checking.patch | 2 +- ...g.c-fix-some-potential-allocation-ov.patch | 4 +- ...integer-overflows-in-grub_cmd_initrd.patch | 2 +- ...rnel-validation-without-shim-protoco.patch | 8 +- ...ar-pointers-in-grub-core-net-bootp.c.patch | 2 +- ...ointers-in-grub-core-net-efi-ip4_con.patch | 2 +- ...ointers-in-grub-core-net-efi-ip6_con.patch | 2 +- ...-pointers-in-grub-core-net-efi-net.c.patch | 2 +- ...-pointers-in-grub-core-net-efi-pxe.c.patch | 2 +- ...gration-scripts-to-make-systemctl-re.patch | 12 +- ...ion.sh-Also-set-old-menu_show_once-g.patch | 2 +- ...set-1-when-keyboard-is-in-Translate-.patch | 4 +- ...ll-disable-support-for-EFI-platforms.patch | 27 +- ...imestamps-configure-flag-to-prepend-.patch | 12 +- ...ements-to-grub_disk_open-and-grub_di.patch | 2 +- ...on-grub_debug_is_enabled-void-return.patch | 4 +- ...ear-screen-when-debugging-is-enabled.patch | 2 +- ..._-instrumentation-new-file-debug-tag.patch | 2 +- ...-Avoiding-many-unecessary-open-close.patch | 2 +- ...-implements-fibre-channel-discovery-.patch | 2 +- ...erpc-enables-device-mapper-discovery.patch | 2 +- ...fallback_set-var-to-force-the-set-ma.patch | 2 +- ...igning-grub-with-an-appended-signatu.patch | 21 +- ...rub-Document-signing-grub-under-UEFI.patch | 2 +- ...nt-signing-grub-with-an-appended-sig.patch | 2 +- ...e-grub_dl_set_persistent-for-the-emu.patch | 2 +- ...patch => 0162-pgp-factor-out-rsa_pad.patch | 8 +- ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 4 +- ...p-tweaks-in-preparation-for-libtasn1.patch | 6 +- ...0165-libtasn1-import-libtasn1-4.16.0.patch | 30 +- ...asn1-disable-code-not-needed-in-grub.patch | 12 +- ...tasn1-changes-for-grub-compatibility.patch | 12 +- ...68-libtasn1-compile-into-asn1-module.patch | 4 +- ...9-test_asn1-test-module-for-libtasn1.patch | 32 +- ...-support-embedding-x509-certificates.patch | 12 +- ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 4 +- ...res-parse-PKCS-7-signedData-and-X.50.patch | 8 +- ...res-support-verifying-appended-signa.patch | 6 +- ...pended-signatures-verification-tests.patch | 8 +- ...75-appended-signatures-documentation.patch | 2 +- ...er-lockdown-based-on-ibm-secure-boot.patch | 8 +- ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 2 +- ...h => 0178-ieee1275-claim-more-memory.patch | 4 +- ...-memory-with-ibm-client-architecture.patch | 6 +- ...-Also-handle-the-Extended-Key-Usage-.patch | 6 +- ...eee1275-ofdisk-retry-on-open-failure.patch | 4 +- ...ainloading-EFI-apps-from-loop-mounts.patch | 6 +- ...> 0183-efinet-Add-DHCP-proxy-support.patch | 2 +- ...gnore-checksum-seed-incompat-feature.patch | 2 +- ...-cmdline-when-generating-legacy-menu.patch | 2 +- ... 0186-Suppress-gettext-error-message.patch | 2 +- ...d-Always-use-boot-grub2-user.cfg-as-.patch | 2 +- ...for-EFI-at-runtime-instead-of-config.patch | 2 +- ...or-if-boot-to-firmware-setup-is-not-.patch | 2 +- ...x-EFI-loader-kernel-image-allocation.patch | 6 +- ...over-the-device-to-read-the-config-f.patch | 2 +- ...etting-of-prefix-for-signed-binary-c.patch | 2 +- ...adable-filesystem-with-v4-superblock.patch | 2 +- ...module-name-on-license-check-failure.patch | 2 +- ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 4 +- ...-mkconfig-restore-umask-for-grub.cfg.patch | 2 +- ...btrfs-Use-full-btrfs-bootloader-area.patch | 4 +- ...-Fedora-location-of-DejaVu-SANS-font.patch | 4 +- ...t-show-Booting-s-msg-when-auto-booti.patch | 2 +- ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 2 +- ...ot-set-colorstate-until-the-first-te.patch | 2 +- ...ot-set-cursor-until-the-first-text-o.patch | 2 +- ...se-visual-indentation-in-config.h.in.patch | 2 +- ...sure-config-util.h-precedes-config.h.patch | 36 +- ...=> 0205-Drop-gnulib-fix-base64.patch.patch | 14 +- ...h => 0206-Drop-gnulib-no-abort.patch.patch | 10 +- ...version-and-drop-most-gnulib-patches.patch | 36 +- ...Fix-bug-stopping-iteration-when-no-f.patch | 2 +- ...w-efidisk-only-option-on-EFI-systems.patch | 6 +- ...h => 0210-efi-new-connectefi-command.patch | 16 +- ...-i386-efi-linux.c-do-not-validate-ke.patch | 2 +- ...-arm64-linux.c-do-not-validate-kerne.patch | 2 +- ...-efi-chainloader.c-do-not-validate-c.patch | 2 +- ...-efi-linux.c-drop-now-unused-grub_li.patch | 4 +- grub.patches | 376 ++-- grub2.spec | 5 +- 219 files changed, 974 insertions(+), 3234 deletions(-) delete mode 100644 0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch rename 0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch => 0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch (97%) rename 0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch => 0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch (99%) rename 0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch => 0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch (96%) rename 0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch => 0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch (96%) rename 0032-Try-prefix-if-fw_path-doesn-t-work.patch => 0031-Try-prefix-if-fw_path-doesn-t-work.patch (98%) rename 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch => 0032-Use-rpm-s-sort-for-grub2-mkconfig.patch (89%) rename 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (98%) rename 0035-Add-friendly-grub2-password-config-tool-985962.patch => 0034-Add-friendly-grub2-password-config-tool-985962.patch (80%) rename 0036-tcp-add-window-scaling-support.patch => 0035-tcp-add-window-scaling-support.patch (98%) rename 0037-efinet-and-bootp-add-support-for-dhcpv6.patch => 0036-efinet-and-bootp-add-support-for-dhcpv6.patch (98%) rename 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (84%) rename 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch => 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch (98%) rename 0040-Make-grub_fatal-also-backtrace.patch => 0039-Make-grub_fatal-also-backtrace.patch (96%) rename 0042-Make-our-info-pages-say-grub2-where-appropriate.patch => 0040-Make-our-info-pages-say-grub2-where-appropriate.patch (99%) delete mode 100644 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch rename 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch (99%) rename 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (99%) rename 0045-export-btrfs_subvol-and-btrfs_subvolid.patch => 0043-export-btrfs_subvol-and-btrfs_subvolid.patch (95%) rename 0046-grub2-btrfs-03-follow_default.patch => 0044-grub2-btrfs-03-follow_default.patch (99%) rename 0047-grub2-btrfs-04-grub2-install.patch => 0045-grub2-btrfs-04-grub2-install.patch (95%) rename 0048-grub2-btrfs-05-grub2-mkconfig.patch => 0046-grub2-btrfs-05-grub2-mkconfig.patch (95%) rename 0049-grub2-btrfs-06-subvol-mount.patch => 0047-grub2-btrfs-06-subvol-mount.patch (98%) rename 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (97%) rename 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (99%) rename 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (98%) rename 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch => 0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch (98%) rename 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch => 0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch (95%) rename 0055-don-t-use-int-for-efi-status.patch => 0053-don-t-use-int-for-efi-status.patch (94%) rename 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (96%) rename 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (96%) rename 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (97%) rename 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch => 0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch (99%) rename 0060-align-struct-efi_variable-better.patch => 0058-align-struct-efi_variable-better.patch (92%) rename 0061-Add-BLS-support-to-grub-mkconfig.patch => 0059-Add-BLS-support-to-grub-mkconfig.patch (95%) rename 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (95%) rename 0063-Add-linux-and-initrd-commands-for-grub-emu.patch => 0061-Add-linux-and-initrd-commands-for-grub-emu.patch (97%) rename 0064-Add-grub2-switch-to-blscfg.patch => 0062-Add-grub2-switch-to-blscfg.patch (85%) rename 0065-make-better-backtraces.patch => 0063-make-better-backtraces.patch (96%) rename 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (95%) rename 0067-Work-around-some-minor-include-path-weirdnesses.patch => 0065-Work-around-some-minor-include-path-weirdnesses.patch (97%) rename 0068-Make-it-possible-to-enabled-build-id-sha1.patch => 0066-Make-it-possible-to-enabled-build-id-sha1.patch (93%) rename 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (95%) rename 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (97%) create mode 100644 0069-Fixup-for-newer-compiler.patch rename 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (97%) rename 0074-Add-support-for-non-Ethernet-network-cards.patch => 0072-Add-support-for-non-Ethernet-network-cards.patch (98%) delete mode 100644 0073-Fixup-for-newer-compiler.patch rename 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (98%) rename 0076-bootp-New-net_bootp6-command.patch => 0074-bootp-New-net_bootp6-command.patch (99%) rename 0077-efinet-UEFI-IPv6-PXE-support.patch => 0075-efinet-UEFI-IPv6-PXE-support.patch (98%) rename 0078-grub.texi-Add-net_bootp6-doument.patch => 0076-grub.texi-Add-net_bootp6-doument.patch (97%) rename 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (98%) rename 0080-efinet-Setting-network-from-UEFI-device-path.patch => 0078-efinet-Setting-network-from-UEFI-device-path.patch (99%) rename 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch (99%) rename 0082-Support-UEFI-networking-protocols.patch => 0080-Support-UEFI-networking-protocols.patch (99%) rename 0083-AUDIT-0-http-boot-tracker-bug.patch => 0081-AUDIT-0-http-boot-tracker-bug.patch (96%) rename 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch (98%) rename 0085-Add-auto-hide-menu-support.patch => 0083-Add-auto-hide-menu-support.patch (93%) rename 0086-Add-grub-set-bootflag-utility.patch => 0084-Add-grub-set-bootflag-utility.patch (85%) rename 0087-docs-Add-grub-boot-indeterminate.service-example.patch => 0085-docs-Add-grub-boot-indeterminate.service-example.patch (97%) rename 0088-gentpl-add-disable-support.patch => 0086-gentpl-add-disable-support.patch (97%) rename 0089-gentpl-add-pc-firmware-type.patch => 0087-gentpl-add-pc-firmware-type.patch (95%) rename 0090-efinet-also-use-the-firmware-acceleration-for-http.patch => 0088-efinet-also-use-the-firmware-acceleration-for-http.patch (96%) rename 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (97%) rename 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (96%) rename 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0091-module-verifier-make-it-possible-to-run-checkers-on-.patch (94%) rename 0094-Rework-how-the-fdt-command-builds.patch => 0092-Rework-how-the-fdt-command-builds.patch (95%) rename 0095-Disable-non-wordsize-allocations-on-arm.patch => 0093-Disable-non-wordsize-allocations-on-arm.patch (93%) rename 0096-Prepend-prefix-when-HTTP-path-is-relative.patch => 0094-Prepend-prefix-when-HTTP-path-is-relative.patch (98%) rename 0097-Make-grub_error-more-verbose.patch => 0095-Make-grub_error-more-verbose.patch (96%) rename 0098-Make-reset-an-alias-for-the-reboot-command.patch => 0096-Make-reset-an-alias-for-the-reboot-command.patch (97%) rename 0099-Add-a-version-command.patch => 0097-Add-a-version-command.patch (95%) rename 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (94%) rename 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch (99%) rename 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch (96%) rename 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (94%) rename 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (92%) rename 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (98%) rename 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (99%) rename 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (99%) rename 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (98%) rename 0109-Fix-getroot.c-s-trampolines.patch => 0107-Fix-getroot.c-s-trampolines.patch (97%) rename 0110-Do-not-allow-stack-trampolines-anywhere.patch => 0108-Do-not-allow-stack-trampolines-anywhere.patch (90%) rename 0111-Reimplement-boot_counter.patch => 0109-Reimplement-boot_counter.patch (97%) rename 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0110-Fix-menu-entry-selection-based-on-ID-and-title.patch (99%) rename 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch (97%) rename 0114-Add-efi-export-env-and-efi-load-env-commands.patch => 0112-Add-efi-export-env-and-efi-load-env-commands.patch (97%) rename 0115-Make-it-possible-to-subtract-conditions-from-debug.patch => 0113-Make-it-possible-to-subtract-conditions-from-debug.patch (97%) rename 0116-Export-all-variables-from-the-initial-context-when-c.patch => 0114-Export-all-variables-from-the-initial-context-when-c.patch (95%) rename 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (97%) rename 0118-Fix-systemctl-kexec-exit-status-check.patch => 0116-Fix-systemctl-kexec-exit-status-check.patch (97%) rename 0119-Print-grub-emu-linux-loader-messages-as-debug.patch => 0117-Print-grub-emu-linux-loader-messages-as-debug.patch (97%) rename 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch (98%) rename 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch (96%) rename 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (95%) rename 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (98%) rename 0124-Add-start-symbol-for-RISC-V.patch => 0122-Add-start-symbol-for-RISC-V.patch (95%) rename 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (96%) rename 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch (95%) rename 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (99%) rename 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (97%) rename 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (97%) rename 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch (98%) rename 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (96%) rename 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (98%) rename 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (98%) rename 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (97%) rename 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (97%) rename 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (95%) rename 0137-efi-dhcp-fix-some-allocation-error-checking.patch => 0135-efi-dhcp-fix-some-allocation-error-checking.patch (97%) rename 0138-efi-http-fix-some-allocation-error-checking.patch => 0136-efi-http-fix-some-allocation-error-checking.patch (96%) rename 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (98%) rename 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (97%) rename 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch (96%) rename 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (97%) rename 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (97%) rename 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (96%) rename 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (97%) rename 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (97%) rename 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch (97%) rename 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (97%) rename 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (98%) rename 0150-grub-install-disable-support-for-EFI-platforms.patch => 0148-grub-install-disable-support-for-EFI-platforms.patch (74%) rename 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch (93%) rename 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (97%) rename 0153-Introduce-function-grub_debug_is_enabled-void-return.patch => 0151-Introduce-function-grub_debug_is_enabled-void-return.patch (95%) rename 0154-Don-t-clear-screen-when-debugging-is-enabled.patch => 0152-Don-t-clear-screen-when-debugging-is-enabled.patch (96%) rename 0155-grub_file_-instrumentation-new-file-debug-tag.patch => 0153-grub_file_-instrumentation-new-file-debug-tag.patch (98%) rename 0156-ieee1275-Avoiding-many-unecessary-open-close.patch => 0154-ieee1275-Avoiding-many-unecessary-open-close.patch (99%) rename 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (98%) rename 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch (98%) rename 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (99%) rename 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch (96%) rename 0161-docs-grub-Document-signing-grub-under-UEFI.patch => 0159-docs-grub-Document-signing-grub-under-UEFI.patch (98%) rename 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch (98%) rename 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (96%) rename 0164-pgp-factor-out-rsa_pad.patch => 0162-pgp-factor-out-rsa_pad.patch (97%) rename 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (96%) rename 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (94%) rename 0167-libtasn1-import-libtasn1-4.16.0.patch => 0165-libtasn1-import-libtasn1-4.16.0.patch (99%) rename 0168-libtasn1-disable-code-not-needed-in-grub.patch => 0166-libtasn1-disable-code-not-needed-in-grub.patch (97%) rename 0169-libtasn1-changes-for-grub-compatibility.patch => 0167-libtasn1-changes-for-grub-compatibility.patch (96%) rename 0170-libtasn1-compile-into-asn1-module.patch => 0168-libtasn1-compile-into-asn1-module.patch (97%) rename 0171-test_asn1-test-module-for-libtasn1.patch => 0169-test_asn1-test-module-for-libtasn1.patch (99%) rename 0172-grub-install-support-embedding-x509-certificates.patch => 0170-grub-install-support-embedding-x509-certificates.patch (97%) rename 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (99%) rename 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (99%) rename 0175-appended-signatures-support-verifying-appended-signa.patch => 0173-appended-signatures-support-verifying-appended-signa.patch (99%) rename 0176-appended-signatures-verification-tests.patch => 0174-appended-signatures-verification-tests.patch (99%) rename 0177-appended-signatures-documentation.patch => 0175-appended-signatures-documentation.patch (99%) rename 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (95%) rename 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (98%) rename 0180-ieee1275-claim-more-memory.patch => 0178-ieee1275-claim-more-memory.patch (99%) rename 0181-ieee1275-request-memory-with-ibm-client-architecture.patch => 0179-ieee1275-request-memory-with-ibm-client-architecture.patch (98%) rename 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (99%) rename 0183-ieee1275-ofdisk-retry-on-open-failure.patch => 0181-ieee1275-ofdisk-retry-on-open-failure.patch (97%) rename 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch (97%) rename 0185-efinet-Add-DHCP-proxy-support.patch => 0183-efinet-Add-DHCP-proxy-support.patch (98%) rename 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (98%) rename 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (97%) rename 0188-Suppress-gettext-error-message.patch => 0186-Suppress-gettext-error-message.patch (96%) rename 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (97%) rename 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch (98%) rename 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (98%) rename 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch (98%) rename 0193-normal-main-Discover-the-device-to-read-the-config-f.patch => 0191-normal-main-Discover-the-device-to-read-the-config-f.patch (98%) rename 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (98%) rename 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (99%) rename 0196-Print-module-name-on-license-check-failure.patch => 0194-Print-module-name-on-license-check-failure.patch (98%) rename 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (98%) rename 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch (97%) rename 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch (98%) rename 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch => 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch (95%) rename 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch => 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch (98%) rename 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch => 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch (97%) rename 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch => 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch (97%) rename 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch => 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch (98%) rename 0205-Use-visual-indentation-in-config.h.in.patch => 0203-Use-visual-indentation-in-config.h.in.patch (98%) rename 0206-Where-present-ensure-config-util.h-precedes-config.h.patch => 0204-Where-present-ensure-config-util.h-precedes-config.h.patch (91%) rename 0207-Drop-gnulib-fix-base64.patch.patch => 0205-Drop-gnulib-fix-base64.patch.patch (94%) rename 0208-Drop-gnulib-no-abort.patch.patch => 0206-Drop-gnulib-no-abort.patch.patch (94%) rename 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch => 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch (97%) rename 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch => 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch (97%) rename 0211-search-new-efidisk-only-option-on-EFI-systems.patch => 0209-search-new-efidisk-only-option-on-EFI-systems.patch (98%) rename 0212-efi-new-connectefi-command.patch => 0210-efi-new-connectefi-command.patch (97%) rename 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch => 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch (98%) rename 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch => 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch (98%) rename 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch => 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch (98%) rename 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch => 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch (97%) diff --git a/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch b/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch index fcc78251..3ddefe63 100644 --- a/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch +++ b/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch @@ -10,7 +10,7 @@ This reverts commit 722737630889607c3b5761f1f5a48f1674cd2821. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 5984e92d291..94622481284 100644 +index 5984e92d2..946224812 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -36,7 +36,7 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n diff --git a/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch b/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch index 4187765f..5429c42c 100644 --- a/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch +++ b/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch @@ -10,7 +10,7 @@ This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925. 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f8cbb8d7a2b..d3e879b8e5c 100644 +index f8cbb8d7a..d3e879b8e 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -140,9 +140,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2 @@ -40,7 +40,7 @@ index f8cbb8d7a2b..d3e879b8e5c 100644 GRUB_SAVEDEFAULT \ GRUB_ENABLE_CRYPTODISK \ diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 94622481284..80685b15f4d 100644 +index 946224812..80685b15f 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0003-Revert-templates-Disable-the-os-prober-by-default.patch b/0003-Revert-templates-Disable-the-os-prober-by-default.patch index 68cacfca..4e4dc55c 100644 --- a/0003-Revert-templates-Disable-the-os-prober-by-default.patch +++ b/0003-Revert-templates-Disable-the-os-prober-by-default.patch @@ -10,7 +10,7 @@ This reverts commit e346414725a70e5c74ee87ca14e580c66f517666. 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index f8b4b3b21a7..69f08d289f9 100644 +index f8b4b3b21..69f08d289 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1519,13 +1519,10 @@ boot sequence. If you have problems, set this option to @samp{text} and @@ -46,7 +46,7 @@ index f8b4b3b21a7..69f08d289f9 100644 First create a separate GRUB partition, big enough to hold GRUB. Some of the following entries show how to load OS installer images from this same partition, diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 80685b15f4d..1b91c102f35 100644 +index 80685b15f..1b91c102f 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0004-Add-support-for-Linux-EFI-stub-loading.patch b/0004-Add-support-for-Linux-EFI-stub-loading.patch index 73d231a2..bdd7dde5 100644 --- a/0004-Add-support-for-Linux-EFI-stub-loading.patch +++ b/0004-Add-support-for-Linux-EFI-stub-loading.patch @@ -44,7 +44,7 @@ moves the check into grub_dl_load_file. create mode 100644 include/grub/efi/linux.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 8022e1c0a79..45d3edaa4dc 100644 +index 8022e1c0a..45d3edaa4 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1734,13 +1734,6 @@ module = { @@ -88,7 +88,7 @@ index 8022e1c0a79..45d3edaa4dc 100644 module = { diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 48f8a79073d..b7149370950 100644 +index 48f8a7907..b71493709 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -38,6 +38,14 @@ @@ -127,7 +127,7 @@ index 48f8a79073d..b7149370950 100644 file = grub_file_open (filename, GRUB_FILE_TYPE_GRUB_MODULE); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 8cff7be0289..35b8f670602 100644 +index 8cff7be02..35b8f6706 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -286,6 +286,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -166,7 +166,7 @@ index 8cff7be0289..35b8f670602 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 9838fb2f50d..f6aef0ef649 100644 +index 9838fb2f5..f6aef0ef6 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address, @@ -209,7 +209,7 @@ index 9838fb2f50d..f6aef0ef649 100644 void * grub_efi_allocate_pages_real (grub_efi_physical_address_t address, diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index ef3e9f9444c..a312c668685 100644 +index ef3e9f944..a312c6686 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -29,6 +29,7 @@ @@ -390,7 +390,7 @@ index ef3e9f9444c..a312c668685 100644 linux_args = grub_malloc (cmdline_size); if (!linux_args) diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c -index 22cc25eccd9..d9b7a9ba400 100644 +index 22cc25ecc..d9b7a9ba4 100644 --- a/grub-core/loader/arm64/xen_boot.c +++ b/grub-core/loader/arm64/xen_boot.c @@ -266,7 +266,6 @@ xen_boot (void) @@ -403,7 +403,7 @@ index 22cc25eccd9..d9b7a9ba400 100644 diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c new file mode 100644 -index 00000000000..c24202a5dd1 +index 000000000..c24202a5d --- /dev/null +++ b/grub-core/loader/efi/linux.c @@ -0,0 +1,70 @@ @@ -479,7 +479,7 @@ index 00000000000..c24202a5dd1 +#pragma GCC diagnostic pop diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c new file mode 100644 -index 00000000000..bb2616a8092 +index 000000000..bb2616a80 --- /dev/null +++ b/grub-core/loader/i386/efi/linux.c @@ -0,0 +1,335 @@ @@ -819,7 +819,7 @@ index 00000000000..bb2616a8092 + grub_unregister_command (cmd_initrdefi); +} diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 2a299520160..8be4c3b3f48 100644 +index 2a2995201..8be4c3b3f 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -474,14 +474,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), @@ -853,7 +853,7 @@ index 2a299520160..8be4c3b3f48 100644 + grub_unregister_command (cmd_initrd16); } diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index bcd5a7eb186..b582f67f661 100644 +index bcd5a7eb1..b582f67f6 100644 --- a/include/grub/arm/linux.h +++ b/include/grub/arm/linux.h @@ -20,6 +20,7 @@ @@ -883,7 +883,7 @@ index bcd5a7eb186..b582f67f661 100644 #if defined GRUB_MACHINE_UBOOT diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index 7e22b4ab699..ea030312df3 100644 +index 7e22b4ab6..ea030312d 100644 --- a/include/grub/arm64/linux.h +++ b/include/grub/arm64/linux.h @@ -19,6 +19,7 @@ @@ -913,7 +913,7 @@ index 7e22b4ab699..ea030312df3 100644 #endif /* ! GRUB_ARM64_LINUX_HEADER */ diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 83d958f9945..6295df85f3f 100644 +index 83d958f99..6295df85f 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address, @@ -946,7 +946,7 @@ index 83d958f9945..6295df85f3f 100644 grub_addr_t grub_efi_modules_addr (void); diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h new file mode 100644 -index 00000000000..d9ede36773b +index 000000000..d9ede3677 --- /dev/null +++ b/include/grub/efi/linux.h @@ -0,0 +1,31 @@ diff --git a/0005-Rework-linux-command.patch b/0005-Rework-linux-command.patch index 9954dd0a..6f5f8794 100644 --- a/0005-Rework-linux-command.patch +++ b/0005-Rework-linux-command.patch @@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 9f74a96b19a..dccf3bb3005 100644 +index 9f74a96b1..dccf3bb30 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -649,13 +649,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), diff --git a/0006-Rework-linux16-command.patch b/0006-Rework-linux16-command.patch index 2c2d6f0b..63b1ad39 100644 --- a/0006-Rework-linux16-command.patch +++ b/0006-Rework-linux16-command.patch @@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 8be4c3b3f48..4b1750e360e 100644 +index 8be4c3b3f..4b1750e36 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), diff --git a/0007-Add-secureboot-support-on-efi-chainloader.patch b/0007-Add-secureboot-support-on-efi-chainloader.patch index 6826cce1..065d506a 100644 --- a/0007-Add-secureboot-support-on-efi-chainloader.patch +++ b/0007-Add-secureboot-support-on-efi-chainloader.patch @@ -190,7 +190,7 @@ Signed-off-by: David Abdurachmanov 7 files changed, 844 insertions(+), 90 deletions(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 35b8f670602..4a2259aa1c7 100644 +index 35b8f6706..4a2259aa1 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -296,14 +296,20 @@ grub_efi_secure_boot (void) @@ -219,7 +219,7 @@ index 35b8f670602..4a2259aa1c7 100644 if (*secure_boot && !*setup_mode) ret = 1; diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index a312c668685..04994d5c67d 100644 +index a312c6686..04994d5c6 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -284,6 +284,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -241,7 +241,7 @@ index a312c668685..04994d5c67d 100644 grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); goto fail; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 2bd80f4db3d..e6a8d4ad0e9 100644 +index 2bd80f4db..e6a8d4ad0 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -32,6 +32,8 @@ @@ -1184,7 +1184,7 @@ index 2bd80f4db3d..e6a8d4ad0e9 100644 return grub_errno; diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index c24202a5dd1..c8ecce6dfd0 100644 +index c24202a5d..c8ecce6df 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -33,21 +33,34 @@ struct grub_efi_shim_lock @@ -1229,7 +1229,7 @@ index c24202a5dd1..c8ecce6dfd0 100644 #pragma GCC diagnostic push diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index bb2616a8092..6b24cbb9483 100644 +index bb2616a80..6b24cbb94 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -117,6 +117,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), @@ -1297,7 +1297,7 @@ index bb2616a8092..6b24cbb9483 100644 grub_file_close (file); diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h -index d9ede36773b..0033d9305a9 100644 +index d9ede3677..0033d9305 100644 --- a/include/grub/efi/linux.h +++ b/include/grub/efi/linux.h @@ -22,7 +22,7 @@ @@ -1310,7 +1310,7 @@ index d9ede36773b..0033d9305a9 100644 grub_err_t EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index 0ed8781f037..a43adf27464 100644 +index 0ed8781f0..a43adf274 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h @@ -223,7 +223,11 @@ struct grub_pe64_optional_header diff --git a/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 030c71c9..3f53d8b3 100644 --- a/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -32,7 +32,7 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/sparc64/linux.h diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c -index 584baec8f91..7b2999b14b5 100644 +index 584baec8f..7b2999b14 100644 --- a/grub-core/commands/iorw.c +++ b/grub-core/commands/iorw.c @@ -24,6 +24,7 @@ @@ -64,7 +64,7 @@ index 584baec8f91..7b2999b14b5 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c -index d401a6db0ef..39cf3a06dbd 100644 +index d401a6db0..39cf3a06d 100644 --- a/grub-core/commands/memrw.c +++ b/grub-core/commands/memrw.c @@ -23,6 +23,7 @@ @@ -96,7 +96,7 @@ index d401a6db0ef..39cf3a06dbd 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index b7149370950..7afb9e6f724 100644 +index b71493709..7afb9e6f7 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -32,6 +32,7 @@ @@ -117,7 +117,7 @@ index b7149370950..7afb9e6f724 100644 #if 0 /* This is an error, but grub2-mkconfig still generates a pile of diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 4a2259aa1c7..8cff7be0289 100644 +index 4a2259aa1..8cff7be02 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -286,40 +286,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -162,7 +162,7 @@ index 4a2259aa1c7..8cff7be0289 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c -index 74888c463ba..585f2b57385 100644 +index 74888c463..585f2b573 100644 --- a/grub-core/loader/efi/appleloader.c +++ b/grub-core/loader/efi/appleloader.c @@ -24,6 +24,7 @@ @@ -193,7 +193,7 @@ index 74888c463ba..585f2b57385 100644 grub_unregister_command (cmd); } diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index e6a8d4ad0e9..07c4937898d 100644 +index e6a8d4ad0..07c493789 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -34,6 +34,7 @@ @@ -205,7 +205,7 @@ index e6a8d4ad0e9..07c4937898d 100644 #include #include diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 5f3290ce17b..54befc26626 100644 +index 5f3290ce1..54befc266 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -40,6 +40,7 @@ @@ -237,7 +237,7 @@ index 5f3290ce17b..54befc26626 100644 grub_unregister_extcmd (cmd_openbsd); grub_unregister_extcmd (cmd_netbsd); diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index dccf3bb3005..4aeb0e4b9a6 100644 +index dccf3bb30..4aeb0e4b9 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -37,6 +37,7 @@ @@ -269,7 +269,7 @@ index dccf3bb3005..4aeb0e4b9a6 100644 grub_unregister_command (cmd_initrd); } diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 4b1750e360e..e3fa1221e81 100644 +index 4b1750e36..e3fa1221e 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -36,6 +36,7 @@ @@ -301,7 +301,7 @@ index 4b1750e360e..e3fa1221e81 100644 grub_unregister_command (cmd_linux16); grub_unregister_command (cmd_initrd); diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index facb13f3d36..47e481f4576 100644 +index facb13f3d..47e481f45 100644 --- a/grub-core/loader/multiboot.c +++ b/grub-core/loader/multiboot.c @@ -50,6 +50,7 @@ @@ -333,7 +333,7 @@ index facb13f3d36..47e481f4576 100644 grub_unregister_command (cmd_module); } diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index 1c0cf6a430a..baa54e652ab 100644 +index 1c0cf6a43..baa54e652 100644 --- a/grub-core/loader/xnu.c +++ b/grub-core/loader/xnu.c @@ -35,6 +35,7 @@ @@ -365,7 +365,7 @@ index 1c0cf6a430a..baa54e652ab 100644 grub_unregister_command (cmd_resume); #endif diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 6295df85f3f..585fa6662b6 100644 +index 6295df85f..585fa6662 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -91,7 +91,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, @@ -378,13 +378,13 @@ index 6295df85f3f..585fa6662b6 100644 const grub_efi_device_path_t *dp2); diff --git a/include/grub/ia64/linux.h b/include/grub/ia64/linux.h new file mode 100644 -index 00000000000..e69de29bb2d +index 000000000..e69de29bb diff --git a/include/grub/mips/linux.h b/include/grub/mips/linux.h new file mode 100644 -index 00000000000..e69de29bb2d +index 000000000..e69de29bb diff --git a/include/grub/powerpc/linux.h b/include/grub/powerpc/linux.h new file mode 100644 -index 00000000000..e69de29bb2d +index 000000000..e69de29bb diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h new file mode 100644 -index 00000000000..e69de29bb2d +index 000000000..e69de29bb diff --git a/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch b/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch index f3aae389..dc54e2d0 100644 --- a/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +++ b/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 3 files changed, 89 insertions(+), 37 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index c8ecce6dfd0..0622dfa48d4 100644 +index c8ecce6df..0622dfa48 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -69,12 +69,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size) @@ -37,7 +37,7 @@ index c8ecce6dfd0..0622dfa48d4 100644 return GRUB_ERR_BUG; diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 6b24cbb9483..3017d0f3e52 100644 +index 6b24cbb94..3017d0f3e 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -44,14 +44,10 @@ static char *linux_cmdline; @@ -245,7 +245,7 @@ index 6b24cbb9483..3017d0f3e52 100644 if (kernel_mem && !loaded) grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index eddf9251d9a..25ef52c04eb 100644 +index eddf9251d..25ef52c04 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -138,7 +138,12 @@ struct linux_i386_kernel_header diff --git a/0010-re-write-.gitignore.patch b/0010-re-write-.gitignore.patch index 74cb0dae..af1859ce 100644 --- a/0010-re-write-.gitignore.patch +++ b/0010-re-write-.gitignore.patch @@ -20,7 +20,7 @@ Subject: [PATCH] re-write .gitignore create mode 100644 util/bash-completion.d/.gitignore diff --git a/.gitignore b/.gitignore -index f6a1bd05175..594d0134d33 100644 +index f6a1bd051..594d0134d 100644 --- a/.gitignore +++ b/.gitignore @@ -275,3 +275,155 @@ widthspec.bin @@ -181,7 +181,7 @@ index f6a1bd05175..594d0134d33 100644 +/widthspec.h diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 -index 00000000000..e1d849ef95b +index 000000000..e1d849ef9 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,5 @@ @@ -192,7 +192,7 @@ index 00000000000..e1d849ef95b +/version*.texi diff --git a/grub-core/.gitignore b/grub-core/.gitignore new file mode 100644 -index 00000000000..2acce281159 +index 000000000..2acce2811 --- /dev/null +++ b/grub-core/.gitignore @@ -0,0 +1,16 @@ @@ -214,14 +214,14 @@ index 00000000000..2acce281159 +/trigtables.c diff --git a/grub-core/lib/.gitignore b/grub-core/lib/.gitignore new file mode 100644 -index 00000000000..68154591404 +index 000000000..681545914 --- /dev/null +++ b/grub-core/lib/.gitignore @@ -0,0 +1 @@ +/libgcrypt-grub/ diff --git a/include/grub/gcrypt/.gitignore b/include/grub/gcrypt/.gitignore new file mode 100644 -index 00000000000..8fbf5646246 +index 000000000..8fbf56462 --- /dev/null +++ b/include/grub/gcrypt/.gitignore @@ -0,0 +1,2 @@ @@ -229,7 +229,7 @@ index 00000000000..8fbf5646246 +gcrypt.h diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 -index 00000000000..f507e7741e3 +index 000000000..f507e7741 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,5 @@ @@ -240,7 +240,7 @@ index 00000000000..f507e7741e3 +/stamp-po diff --git a/util/bash-completion.d/.gitignore b/util/bash-completion.d/.gitignore new file mode 100644 -index 00000000000..6813a527ad3 +index 000000000..6813a527a --- /dev/null +++ b/util/bash-completion.d/.gitignore @@ -0,0 +1,2 @@ diff --git a/0011-IBM-client-architecture-CAS-reboot-support.patch b/0011-IBM-client-architecture-CAS-reboot-support.patch index 431a443b..cea157b2 100644 --- a/0011-IBM-client-architecture-CAS-reboot-support.patch +++ b/0011-IBM-client-architecture-CAS-reboot-support.patch @@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood 4 files changed, 91 insertions(+) diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c -index 4d493ab7661..3a6689abb11 100644 +index 4d493ab76..3a6689abb 100644 --- a/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c @@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void) @@ -100,7 +100,7 @@ index 4d493ab7661..3a6689abb11 100644 + return 0; +} diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index c4ebe9e22ad..70614de1565 100644 +index c4ebe9e22..70614de15 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -34,6 +34,9 @@ @@ -137,7 +137,7 @@ index c4ebe9e22ad..70614de1565 100644 grub_errno = GRUB_ERR_NONE; } diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index 25158407dd8..ad80399246a 100644 +index 25158407d..ad8039924 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -28,6 +28,9 @@ @@ -162,7 +162,7 @@ index 25158407dd8..ad80399246a 100644 { char *line; diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 73e2f464475..0a599607f31 100644 +index 73e2f4644..0a599607f 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -254,6 +254,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali diff --git a/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch index c8ccc7e2..fa459299 100644 --- a/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index 85ecf06b4df..05c88dcf49e 100644 +index 85ecf06b4..05c88dcf4 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term, diff --git a/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch index e8aa3678..aebfe75a 100644 --- a/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch +++ b/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch @@ -15,7 +15,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 20cbbd761ec..04df9d2c667 100644 +index 20cbbd761..04df9d2c6 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c @@ -90,7 +90,10 @@ grub_ieee1275_find_options (void) @@ -31,7 +31,7 @@ index 20cbbd761ec..04df9d2c667 100644 /* Old Macs have no key repeat, newer ones have fully working one. The ones inbetween when repeated key generates an escaoe sequence diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c -index 17a3dbbb575..b8e4b3feb32 100644 +index 17a3dbbb5..b8e4b3feb 100644 --- a/grub-core/video/ieee1275.c +++ b/grub-core/video/ieee1275.c @@ -352,9 +352,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter = @@ -51,7 +51,7 @@ index 17a3dbbb575..b8e4b3feb32 100644 GRUB_MOD_FINI(ieee1275_fb) diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 0a599607f31..b5a1d49bbc3 100644 +index 0a599607f..b5a1d49bb 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -148,6 +148,8 @@ enum grub_ieee1275_flag diff --git a/0014-Move-bash-completion-script-922997.patch b/0014-Move-bash-completion-script-922997.patch index 6bf0b4b9..ffc1685d 100644 --- a/0014-Move-bash-completion-script-922997.patch +++ b/0014-Move-bash-completion-script-922997.patch @@ -10,7 +10,7 @@ Apparently these go in a new place now. 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 7517fc49d98..8331f95b645 100644 +index 7517fc49d..8331f95b6 100644 --- a/configure.ac +++ b/configure.ac @@ -314,6 +314,14 @@ AC_SUBST(grubdirname) @@ -39,7 +39,7 @@ index 7517fc49d98..8331f95b645 100644 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then tmp_ac_tool_prefix="$ac_tool_prefix" diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am -index 136287cf1bf..61108f05429 100644 +index 136287cf1..61108f054 100644 --- a/util/bash-completion.d/Makefile.am +++ b/util/bash-completion.d/Makefile.am @@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source) diff --git a/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch index f2a4a82c..3141feae 100644 --- a/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch +++ b/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 8397886fa05..d7a222e681b 100644 +index 8397886fa..d7a222e68 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout) diff --git a/0016-Make-exit-take-a-return-code.patch b/0016-Make-exit-take-a-return-code.patch index 39d70573..a5381545 100644 --- a/0016-Make-exit-take-a-return-code.patch +++ b/0016-Make-exit-take-a-return-code.patch @@ -27,7 +27,7 @@ Signed-off-by: Peter Jones 14 files changed, 48 insertions(+), 21 deletions(-) diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c -index fa498931ed2..2bd3ac76f2d 100644 +index fa498931e..2bd3ac76f 100644 --- a/grub-core/commands/minicmd.c +++ b/grub-core/commands/minicmd.c @@ -182,12 +182,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), @@ -60,7 +60,7 @@ index fa498931ed2..2bd3ac76f2d 100644 } diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 8cff7be0289..05d8237a9b2 100644 +index 8cff7be02..05d8237a9 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -165,11 +165,16 @@ grub_reboot (void) @@ -83,7 +83,7 @@ index 8cff7be0289..05d8237a9b2 100644 } diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 425bb960347..55ea5a11ccd 100644 +index 425bb9603..55ea5a11c 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -67,7 +67,7 @@ grub_reboot (void) @@ -96,7 +96,7 @@ index 425bb960347..55ea5a11ccd 100644 grub_reboot (); } diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index dfd8a8ec488..0ff13bcaf8c 100644 +index dfd8a8ec4..0ff13bcaf 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -151,9 +151,10 @@ xasprintf (const char *fmt, ...) @@ -113,7 +113,7 @@ index dfd8a8ec488..0ff13bcaf8c 100644 #endif diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c -index 3314f027fec..36f9134b7b7 100644 +index 3314f027f..36f9134b7 100644 --- a/grub-core/kern/i386/coreboot/init.c +++ b/grub-core/kern/i386/coreboot/init.c @@ -41,7 +41,7 @@ extern grub_uint8_t _end[]; @@ -126,7 +126,7 @@ index 3314f027fec..36f9134b7b7 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/i386/qemu/init.c b/grub-core/kern/i386/qemu/init.c -index 271b6fbfabd..9fafe98f015 100644 +index 271b6fbfa..9fafe98f0 100644 --- a/grub-core/kern/i386/qemu/init.c +++ b/grub-core/kern/i386/qemu/init.c @@ -42,7 +42,7 @@ extern grub_uint8_t _end[]; @@ -139,7 +139,7 @@ index 271b6fbfabd..9fafe98f015 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index d483e35eed2..e71d1584164 100644 +index d483e35ee..e71d15841 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack; @@ -152,7 +152,7 @@ index d483e35eed2..e71d1584164 100644 grub_ieee1275_exit (); } diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c -index 2ed3ff3191e..5c40c34078d 100644 +index 2ed3ff319..5c40c3407 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -276,7 +276,7 @@ grub_halt (void) @@ -165,7 +165,7 @@ index 2ed3ff3191e..5c40c34078d 100644 GRUB_ARC_FIRMWARE_VECTOR->exit (); diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c -index 7b96531b983..dff598ca7b0 100644 +index 7b96531b9..dff598ca7 100644 --- a/grub-core/kern/mips/loongson/init.c +++ b/grub-core/kern/mips/loongson/init.c @@ -304,7 +304,7 @@ grub_halt (void) @@ -178,7 +178,7 @@ index 7b96531b983..dff598ca7b0 100644 grub_halt (); } diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c -index be88b77d22d..8b6c55ffc01 100644 +index be88b77d2..8b6c55ffc 100644 --- a/grub-core/kern/mips/qemu_mips/init.c +++ b/grub-core/kern/mips/qemu_mips/init.c @@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused))) @@ -191,7 +191,7 @@ index be88b77d22d..8b6c55ffc01 100644 grub_halt (); } diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 3af336ee227..63b586d09cb 100644 +index 3af336ee2..63b586d09 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -1209,9 +1209,18 @@ grub_abort (void) @@ -215,7 +215,7 @@ index 3af336ee227..63b586d09cb 100644 grub_fatal (const char *fmt, ...) { diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c -index 3e338645c57..be2a5be1d07 100644 +index 3e338645c..be2a5be1d 100644 --- a/grub-core/kern/uboot/init.c +++ b/grub-core/kern/uboot/init.c @@ -39,9 +39,9 @@ extern grub_size_t grub_total_module_size; @@ -240,7 +240,7 @@ index 3e338645c57..be2a5be1d07 100644 else if (ver > API_SIG_VERSION) { diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c -index 782ca72952a..708b060f324 100644 +index 782ca7295..708b060f3 100644 --- a/grub-core/kern/xen/init.c +++ b/grub-core/kern/xen/init.c @@ -584,7 +584,7 @@ grub_machine_init (void) @@ -253,7 +253,7 @@ index 782ca72952a..708b060f324 100644 struct sched_shutdown arg; diff --git a/include/grub/misc.h b/include/grub/misc.h -index 7d2b5519690..fd18e6320b8 100644 +index 7d2b55196..fd18e6320 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -353,7 +353,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, diff --git a/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch b/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch index d0614611..7e702ada 100644 --- a/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch +++ b/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 45d3edaa4dc..c865a08b027 100644 +index 45d3edaa4..c865a08b0 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -207,6 +207,7 @@ kernel = { @@ -22,7 +22,7 @@ index 45d3edaa4dc..c865a08b027 100644 i386_multiboot = kern/i386/pc/acpi.c; i386_coreboot = kern/acpi.c; diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 7facacf09c7..6d39bd3ad29 100644 +index 7facacf09..6d39bd3ad 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -27,8 +27,11 @@ diff --git a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch index 5cbe731b..070e4c9a 100644 --- a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -15,7 +15,7 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub.d/20_ppc_terminfo.in diff --git a/Makefile.util.def b/Makefile.util.def -index f8b356cc1fa..2c9b283a230 100644 +index f8b356cc1..2c9b283a2 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -508,6 +508,13 @@ script = { @@ -34,7 +34,7 @@ index f8b356cc1fa..2c9b283a230 100644 common = util/grub.d/30_os-prober.in; diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in new file mode 100644 -index 00000000000..10d66586820 +index 000000000..10d665868 --- /dev/null +++ b/util/grub.d/20_ppc_terminfo.in @@ -0,0 +1,114 @@ diff --git a/0019-Add-fw_path-variable-revised.patch b/0019-Add-fw_path-variable-revised.patch index a8491e8c..a1ea381f 100644 --- a/0019-Add-fw_path-variable-revised.patch +++ b/0019-Add-fw_path-variable-revised.patch @@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 73967e2f5b0..d1de9fa6873 100644 +index 73967e2f5..d1de9fa68 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -128,16 +128,15 @@ grub_set_prefix_and_root (void) @@ -44,7 +44,7 @@ index 73967e2f5b0..d1de9fa6873 100644 } diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 70614de1565..62571e6dfcc 100644 +index 70614de15..62571e6df 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0020-Pass-x-hex-hex-straight-through-unmolested.patch b/0020-Pass-x-hex-hex-straight-through-unmolested.patch index b81abb54..853fcfd5 100644 --- a/0020-Pass-x-hex-hex-straight-through-unmolested.patch +++ b/0020-Pass-x-hex-hex-straight-through-unmolested.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index cc3290311f0..8f67a4be7f0 100644 +index cc3290311..8f67a4be7 100644 --- a/grub-core/commands/wildcard.c +++ b/grub-core/commands/wildcard.c @@ -488,6 +488,12 @@ check_file (const char *dir, const char *basename) @@ -47,7 +47,7 @@ index cc3290311f0..8f67a4be7f0 100644 *optr++ = iptr[1]; iptr += 2; diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index ed0b149dca5..8e2294d8ff6 100644 +index ed0b149dc..8e2294d8f 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/lib/cmdline.c @@ -20,6 +20,12 @@ @@ -97,7 +97,7 @@ index ed0b149dca5..8e2294d8ff6 100644 *buf++ = *c; diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index ad80399246a..0c6dd9c5201 100644 +index ad8039924..0c6dd9c52 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0; diff --git a/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index da65e187..78ba64ac 100644 --- a/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -28,7 +28,7 @@ Signed-off-by: Will Thompson create mode 100644 grub-core/commands/loadenv.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c865a08b027..c15e91943b9 100644 +index c865a08b0..c15e91943 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -814,6 +814,16 @@ module = { @@ -58,7 +58,7 @@ index c865a08b027..c15e91943b9 100644 diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c new file mode 100644 -index 00000000000..e907a6a5d28 +index 000000000..e907a6a5d --- /dev/null +++ b/grub-core/commands/blscfg.c @@ -0,0 +1,1177 @@ @@ -1240,7 +1240,7 @@ index 00000000000..e907a6a5d28 + grub_unregister_extcmd (oldcmd); +} diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index cc5971f4dbd..782761c31aa 100644 +index cc5971f4d..782761c31 100644 --- a/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c @@ -143,7 +143,7 @@ legacy_file (const char *filename) @@ -1263,7 +1263,7 @@ index cc5971f4dbd..782761c31aa 100644 } diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c -index 3fd664aac33..163b9a09042 100644 +index 3fd664aac..163b9a090 100644 --- a/grub-core/commands/loadenv.c +++ b/grub-core/commands/loadenv.c @@ -28,6 +28,8 @@ @@ -1358,7 +1358,7 @@ index 3fd664aac33..163b9a09042 100644 grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args) { diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index 720e6d8ea3b..b194123eb67 100644 +index 720e6d8ea..b194123eb 100644 --- a/grub-core/commands/menuentry.c +++ b/grub-core/commands/menuentry.c @@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args, @@ -1430,7 +1430,7 @@ index 720e6d8ea3b..b194123eb67 100644 src[len - 1] = ch; args[argc - 1] = src; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 62571e6dfcc..7ca2e5400b1 100644 +index 62571e6df..7ca2e5400 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -21,6 +21,7 @@ @@ -1455,7 +1455,7 @@ index 62571e6dfcc..7ca2e5400b1 100644 grub_free ((void *) entry->title); diff --git a/grub-core/commands/loadenv.h b/grub-core/commands/loadenv.h new file mode 100644 -index 00000000000..952f46121bd +index 000000000..952f46121 --- /dev/null +++ b/grub-core/commands/loadenv.h @@ -0,0 +1,93 @@ @@ -1553,7 +1553,7 @@ index 00000000000..952f46121bd + return 0; +} diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index 8f3be3ae706..ebafec68957 100644 +index 8f3be3ae7..ebafec689 100644 --- a/include/grub/compiler.h +++ b/include/grub/compiler.h @@ -56,4 +56,6 @@ @@ -1564,7 +1564,7 @@ index 8f3be3ae706..ebafec68957 100644 + #endif /* ! GRUB_COMPILER_HEADER */ diff --git a/include/grub/menu.h b/include/grub/menu.h -index ee2b5e91045..0acdc2aa6bf 100644 +index ee2b5e910..0acdc2aa6 100644 --- a/include/grub/menu.h +++ b/include/grub/menu.h @@ -20,6 +20,16 @@ @@ -1595,7 +1595,7 @@ index ee2b5e91045..0acdc2aa6bf 100644 typedef struct grub_menu_entry *grub_menu_entry_t; diff --git a/include/grub/normal.h b/include/grub/normal.h -index 218cbabccaf..8839ad85a19 100644 +index 218cbabcc..8839ad85a 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes, diff --git a/0022-Add-devicetree-loading.patch b/0022-Add-devicetree-loading.patch index c0728a98..7d9ac65c 100644 --- a/0022-Add-devicetree-loading.patch +++ b/0022-Add-devicetree-loading.patch @@ -20,7 +20,7 @@ Signed-off-by: David A. Marlin 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index d3e879b8e5c..8ea2315ebc2 100644 +index d3e879b8e..8ea2315eb 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -248,7 +248,8 @@ export GRUB_DEFAULT \ @@ -34,7 +34,7 @@ index d3e879b8e5c..8ea2315ebc2 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index e8b01c0d0c7..dc75a1c30bf 100644 +index e8b01c0d0..dc75a1c30 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -153,6 +153,13 @@ EOF diff --git a/0023-Enable-pager-by-default.-985860.patch b/0023-Enable-pager-by-default.-985860.patch index d92fbcc7..24f2cbf4 100644 --- a/0023-Enable-pager-by-default.-985860.patch +++ b/0023-Enable-pager-by-default.-985860.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 93a90233ead..858b526c925 100644 +index 93a90233e..858b526c9 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_ diff --git a/0024-Don-t-say-GNU-Linux-in-generated-menus.patch b/0024-Don-t-say-GNU-Linux-in-generated-menus.patch index f2880950..f5c783aa 100644 --- a/0024-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0024-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus. 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index dc75a1c30bf..4a499c53a61 100644 +index dc75a1c30..4a499c53a 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -25,7 +25,7 @@ index dc75a1c30bf..4a499c53a61 100644 fi diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 3b1f4704921..ada20775a14 100644 +index 3b1f47049..ada20775a 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch index ed48c5c7..2cdd762a 100644 --- a/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch +++ b/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Add .eh_frame to list of relocations stripped 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 2a1a886f6d5..191b1a70c6b 100644 +index 2a1a886f6..191b1a70c 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding diff --git a/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch index ac9475e3..89d026ff 100644 --- a/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 4a499c53a61..cf8d1186981 100644 +index 4a499c53a..cf8d11869 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -26,7 +26,7 @@ datarootdir="@datarootdir@" diff --git a/0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch b/0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch deleted file mode 100644 index daa6fae0..00000000 --- a/0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch +++ /dev/null @@ -1,1959 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 4 Mar 2014 11:00:23 -0500 -Subject: [PATCH] Replace a lot of man pages with slightly nicer ones. - -Replace a bunch of machine generated ones with ones that look nicer. ---- - configure.ac | 23 ++++++ - conf/Makefile.extra-dist | 1 - - docs/Makefile.am | 2 - - docs/man/grub-bios-setup.h2m | 6 -- - docs/man/grub-editenv.h2m | 5 -- - docs/man/grub-emu.h2m | 6 -- - docs/man/grub-file.h2m | 2 - - docs/man/grub-fstest.h2m | 4 - - docs/man/grub-glue-efi.h2m | 4 - - docs/man/grub-install.h2m | 6 -- - docs/man/grub-kbdcomp.h2m | 10 --- - docs/man/grub-macbless.h2m | 4 - - docs/man/grub-macho2img.h2m | 4 - - docs/man/grub-menulst2cfg.h2m | 4 - - docs/man/grub-mkconfig.h2m | 4 - - docs/man/grub-mkfont.h2m | 4 - - docs/man/grub-mkimage.h2m | 6 -- - docs/man/grub-mklayout.h2m | 10 --- - docs/man/grub-mknetdir.h2m | 4 - - docs/man/grub-mkpasswd-pbkdf2.h2m | 4 - - docs/man/grub-mkrelpath.h2m | 4 - - docs/man/grub-mkrescue.h2m | 4 - - docs/man/grub-mkstandalone.h2m | 4 - - docs/man/grub-mount.h2m | 2 - - docs/man/grub-ofpathname.h2m | 4 - - docs/man/grub-pe2elf.h2m | 4 - - docs/man/grub-probe.h2m | 4 - - docs/man/grub-reboot.h2m | 5 -- - docs/man/grub-render-label.h2m | 3 - - docs/man/grub-script-check.h2m | 4 - - docs/man/grub-set-default.h2m | 5 -- - docs/man/grub-sparc64-setup.h2m | 6 -- - docs/man/grub-syslinux2cfg.h2m | 4 - - gentpl.py | 5 +- - util/grub-bios-setup.8 | 54 +++++++++++++ - util/grub-editenv.1 | 46 +++++++++++ - util/grub-file.1 | 165 ++++++++++++++++++++++++++++++++++++++ - util/grub-fstest.1 | 99 +++++++++++++++++++++++ - util/grub-glue-efi.1 | 31 +++++++ - util/grub-install.8 | 128 +++++++++++++++++++++++++++++ - util/grub-kbdcomp.1 | 19 +++++ - util/grub-macbless.1 | 22 +++++ - util/grub-menulst2cfg.1 | 12 +++ - util/grub-mkconfig.8 | 17 ++++ - util/grub-mkfont.1 | 87 ++++++++++++++++++++ - util/grub-mkimage.1 | 95 ++++++++++++++++++++++ - util/grub-mklayout.1 | 27 +++++++ - util/grub-mknetdir.1 | 12 +++ - util/grub-mkpasswd-pbkdf2.1 | 27 +++++++ - util/grub-mkrelpath.1 | 12 +++ - util/grub-mkrescue.1 | 123 ++++++++++++++++++++++++++++ - util/grub-mkstandalone.1 | 100 +++++++++++++++++++++++ - util/grub-ofpathname.8 | 12 +++ - util/grub-probe.8 | 80 ++++++++++++++++++ - util/grub-reboot.8 | 21 +++++ - util/grub-render-label.1 | 51 ++++++++++++ - util/grub-script-check.1 | 21 +++++ - util/grub-set-default.8 | 21 +++++ - util/grub-sparc64-setup.8 | 12 +++ - 59 files changed, 1318 insertions(+), 147 deletions(-) - delete mode 100644 docs/man/grub-bios-setup.h2m - delete mode 100644 docs/man/grub-editenv.h2m - delete mode 100644 docs/man/grub-emu.h2m - delete mode 100644 docs/man/grub-file.h2m - delete mode 100644 docs/man/grub-fstest.h2m - delete mode 100644 docs/man/grub-glue-efi.h2m - delete mode 100644 docs/man/grub-install.h2m - delete mode 100644 docs/man/grub-kbdcomp.h2m - delete mode 100644 docs/man/grub-macbless.h2m - delete mode 100644 docs/man/grub-macho2img.h2m - delete mode 100644 docs/man/grub-menulst2cfg.h2m - delete mode 100644 docs/man/grub-mkconfig.h2m - delete mode 100644 docs/man/grub-mkfont.h2m - delete mode 100644 docs/man/grub-mkimage.h2m - delete mode 100644 docs/man/grub-mklayout.h2m - delete mode 100644 docs/man/grub-mknetdir.h2m - delete mode 100644 docs/man/grub-mkpasswd-pbkdf2.h2m - delete mode 100644 docs/man/grub-mkrelpath.h2m - delete mode 100644 docs/man/grub-mkrescue.h2m - delete mode 100644 docs/man/grub-mkstandalone.h2m - delete mode 100644 docs/man/grub-mount.h2m - delete mode 100644 docs/man/grub-ofpathname.h2m - delete mode 100644 docs/man/grub-pe2elf.h2m - delete mode 100644 docs/man/grub-probe.h2m - delete mode 100644 docs/man/grub-reboot.h2m - delete mode 100644 docs/man/grub-render-label.h2m - delete mode 100644 docs/man/grub-script-check.h2m - delete mode 100644 docs/man/grub-set-default.h2m - delete mode 100644 docs/man/grub-sparc64-setup.h2m - delete mode 100644 docs/man/grub-syslinux2cfg.h2m - create mode 100644 util/grub-bios-setup.8 - create mode 100644 util/grub-editenv.1 - create mode 100644 util/grub-file.1 - create mode 100644 util/grub-fstest.1 - create mode 100644 util/grub-glue-efi.1 - create mode 100644 util/grub-install.8 - create mode 100644 util/grub-kbdcomp.1 - create mode 100644 util/grub-macbless.1 - create mode 100644 util/grub-menulst2cfg.1 - create mode 100644 util/grub-mkconfig.8 - create mode 100644 util/grub-mkfont.1 - create mode 100644 util/grub-mkimage.1 - create mode 100644 util/grub-mklayout.1 - create mode 100644 util/grub-mknetdir.1 - create mode 100644 util/grub-mkpasswd-pbkdf2.1 - create mode 100644 util/grub-mkrelpath.1 - create mode 100644 util/grub-mkrescue.1 - create mode 100644 util/grub-mkstandalone.1 - create mode 100644 util/grub-ofpathname.8 - create mode 100644 util/grub-probe.8 - create mode 100644 util/grub-reboot.8 - create mode 100644 util/grub-render-label.1 - create mode 100644 util/grub-script-check.1 - create mode 100644 util/grub-set-default.8 - create mode 100644 util/grub-sparc64-setup.8 - -diff --git a/configure.ac b/configure.ac -index 8331f95b645..bec8535af70 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -77,6 +77,29 @@ grub_TRANSFORM([grub-set-default]) - grub_TRANSFORM([grub-sparc64-setup]) - grub_TRANSFORM([grub-render-label]) - grub_TRANSFORM([grub-file]) -+grub_TRANSFORM([grub-bios-setup.3]) -+grub_TRANSFORM([grub-editenv.1]) -+grub_TRANSFORM([grub-fstest.3]) -+grub_TRANSFORM([grub-glue-efi.3]) -+grub_TRANSFORM([grub-install.1]) -+grub_TRANSFORM([grub-kbdcomp.3]) -+grub_TRANSFORM([grub-menulst2cfg.1]) -+grub_TRANSFORM([grub-mkconfig.1]) -+grub_TRANSFORM([grub-mkfont.3]) -+grub_TRANSFORM([grub-mkimage.1]) -+grub_TRANSFORM([grub-mklayout.3]) -+grub_TRANSFORM([grub-mknetdir.3]) -+grub_TRANSFORM([grub-mkpasswd-pbkdf2.3]) -+grub_TRANSFORM([grub-mkrelpath.3]) -+grub_TRANSFORM([grub-mkrescue.1]) -+grub_TRANSFORM([grub-mkstandalone.3]) -+grub_TRANSFORM([grub-ofpathname.3]) -+grub_TRANSFORM([grub-probe.3]) -+grub_TRANSFORM([grub-reboot.3]) -+grub_TRANSFORM([grub-render-label.3]) -+grub_TRANSFORM([grub-script-check.3]) -+grub_TRANSFORM([grub-set-default.1]) -+grub_TRANSFORM([grub-sparc64-setup.3]) - - # Optimization flag. Allow user to override. - if test "x$TARGET_CFLAGS" = x; then -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 8f1485d52a5..b909f2c073a 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -11,7 +11,6 @@ EXTRA_DIST += unicode - EXTRA_DIST += util/import_gcry.py - EXTRA_DIST += util/import_unicode.py - --EXTRA_DIST += docs/man - EXTRA_DIST += docs/autoiso.cfg - EXTRA_DIST += docs/grub.cfg - EXTRA_DIST += docs/osdetect.cfg -diff --git a/docs/Makefile.am b/docs/Makefile.am -index 93eb3962765..ab28f199694 100644 ---- a/docs/Makefile.am -+++ b/docs/Makefile.am -@@ -5,5 +5,3 @@ info_TEXINFOS = grub.texi grub-dev.texi - grub_TEXINFOS = fdl.texi - - EXTRA_DIST = font_char_metrics.png font_char_metrics.txt -- -- -diff --git a/docs/man/grub-bios-setup.h2m b/docs/man/grub-bios-setup.h2m -deleted file mode 100644 -index ac6ede36296..00000000000 ---- a/docs/man/grub-bios-setup.h2m -+++ /dev/null -@@ -1,6 +0,0 @@ --[NAME] --grub-bios-setup \- set up a device to boot using GRUB --[SEE ALSO] --.BR grub-install (8), --.BR grub-mkimage (1), --.BR grub-mkrescue (1) -diff --git a/docs/man/grub-editenv.h2m b/docs/man/grub-editenv.h2m -deleted file mode 100644 -index 3859d3d4c4f..00000000000 ---- a/docs/man/grub-editenv.h2m -+++ /dev/null -@@ -1,5 +0,0 @@ --[NAME] --grub-editenv \- edit GRUB environment block --[SEE ALSO] --.BR grub-reboot (8), --.BR grub-set-default (8) -diff --git a/docs/man/grub-emu.h2m b/docs/man/grub-emu.h2m -deleted file mode 100644 -index ef1c000656a..00000000000 ---- a/docs/man/grub-emu.h2m -+++ /dev/null -@@ -1,6 +0,0 @@ --[NAME] --grub-emu \- GRUB emulator --[SEE ALSO] --If you are trying to install GRUB, then you should use --.BR grub-install (8) --rather than this program. -diff --git a/docs/man/grub-file.h2m b/docs/man/grub-file.h2m -deleted file mode 100644 -index e09bb4d3101..00000000000 ---- a/docs/man/grub-file.h2m -+++ /dev/null -@@ -1,2 +0,0 @@ --[NAME] --grub-file \- check file type -diff --git a/docs/man/grub-fstest.h2m b/docs/man/grub-fstest.h2m -deleted file mode 100644 -index 9676b159afd..00000000000 ---- a/docs/man/grub-fstest.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-fstest \- debug tool for GRUB filesystem drivers --[SEE ALSO] --.BR grub-probe (8) -diff --git a/docs/man/grub-glue-efi.h2m b/docs/man/grub-glue-efi.h2m -deleted file mode 100644 -index c1c6ded49ff..00000000000 ---- a/docs/man/grub-glue-efi.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-glue-efi \- generate a fat binary for EFI --[DESCRIPTION] --grub-glue-efi processes ia32 and amd64 EFI images and glues them according to Apple format. -diff --git a/docs/man/grub-install.h2m b/docs/man/grub-install.h2m -deleted file mode 100644 -index 8cbbc87a0f2..00000000000 ---- a/docs/man/grub-install.h2m -+++ /dev/null -@@ -1,6 +0,0 @@ --[NAME] --grub-install \- install GRUB to a device --[SEE ALSO] --.BR grub-mkconfig (8), --.BR grub-mkimage (1), --.BR grub-mkrescue (1) -diff --git a/docs/man/grub-kbdcomp.h2m b/docs/man/grub-kbdcomp.h2m -deleted file mode 100644 -index d81f9157e01..00000000000 ---- a/docs/man/grub-kbdcomp.h2m -+++ /dev/null -@@ -1,10 +0,0 @@ --[NAME] --grub-kbdcomp \- generate a GRUB keyboard layout file --[DESCRIPTION] --grub-kbdcomp processes a X keyboard layout description in --.BR keymaps (5) --format into a format that can be used by GRUB's --.B keymap --command. --[SEE ALSO] --.BR grub-mklayout (8) -diff --git a/docs/man/grub-macbless.h2m b/docs/man/grub-macbless.h2m -deleted file mode 100644 -index 0197c0087d7..00000000000 ---- a/docs/man/grub-macbless.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-macbless \- bless a mac file/directory --[SEE ALSO] --.BR grub-install (1) -diff --git a/docs/man/grub-macho2img.h2m b/docs/man/grub-macho2img.h2m -deleted file mode 100644 -index d79aaeed8f9..00000000000 ---- a/docs/man/grub-macho2img.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-macho2img \- convert Mach-O to raw image --[SEE ALSO] --.BR grub-mkimage (1) -diff --git a/docs/man/grub-menulst2cfg.h2m b/docs/man/grub-menulst2cfg.h2m -deleted file mode 100644 -index c2e0055ed7e..00000000000 ---- a/docs/man/grub-menulst2cfg.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-menulst2cfg \- transform legacy menu.lst into grub.cfg --[SEE ALSO] --.BR grub-mkconfig (8) -diff --git a/docs/man/grub-mkconfig.h2m b/docs/man/grub-mkconfig.h2m -deleted file mode 100644 -index 9b42f813010..00000000000 ---- a/docs/man/grub-mkconfig.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-mkconfig \- generate a GRUB configuration file --[SEE ALSO] --.BR grub-install (8) -diff --git a/docs/man/grub-mkfont.h2m b/docs/man/grub-mkfont.h2m -deleted file mode 100644 -index d46fe600eca..00000000000 ---- a/docs/man/grub-mkfont.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-mkfont \- make GRUB font files --[SEE ALSO] --.BR grub-mkconfig (8) -diff --git a/docs/man/grub-mkimage.h2m b/docs/man/grub-mkimage.h2m -deleted file mode 100644 -index f0fbc2bb197..00000000000 ---- a/docs/man/grub-mkimage.h2m -+++ /dev/null -@@ -1,6 +0,0 @@ --[NAME] --grub-mkimage \- make a bootable image of GRUB --[SEE ALSO] --.BR grub-install (8), --.BR grub-mkrescue (1), --.BR grub-mknetdir (8) -diff --git a/docs/man/grub-mklayout.h2m b/docs/man/grub-mklayout.h2m -deleted file mode 100644 -index 1e43409c0ab..00000000000 ---- a/docs/man/grub-mklayout.h2m -+++ /dev/null -@@ -1,10 +0,0 @@ --[NAME] --grub-mklayout \- generate a GRUB keyboard layout file --[DESCRIPTION] --grub-mklayout processes a keyboard layout description in --.BR keymaps (5) --format into a format that can be used by GRUB's --.B keymap --command. --[SEE ALSO] --.BR grub-mkconfig (8) -diff --git a/docs/man/grub-mknetdir.h2m b/docs/man/grub-mknetdir.h2m -deleted file mode 100644 -index a2ef13ec111..00000000000 ---- a/docs/man/grub-mknetdir.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-mknetdir \- prepare a GRUB netboot directory. --[SEE ALSO] --.BR grub-mkimage (1) -diff --git a/docs/man/grub-mkpasswd-pbkdf2.h2m b/docs/man/grub-mkpasswd-pbkdf2.h2m -deleted file mode 100644 -index 4d202f3da7e..00000000000 ---- a/docs/man/grub-mkpasswd-pbkdf2.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-mkpasswd-pbkdf2 \- generate hashed password for GRUB --[SEE ALSO] --.BR grub-mkconfig (8) -diff --git a/docs/man/grub-mkrelpath.h2m b/docs/man/grub-mkrelpath.h2m -deleted file mode 100644 -index d01f3961e3f..00000000000 ---- a/docs/man/grub-mkrelpath.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-mkrelpath \- make a system path relative to its root --[SEE ALSO] --.BR grub-probe (8) -diff --git a/docs/man/grub-mkrescue.h2m b/docs/man/grub-mkrescue.h2m -deleted file mode 100644 -index a427f02e3c6..00000000000 ---- a/docs/man/grub-mkrescue.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-mkrescue \- make a GRUB rescue image --[SEE ALSO] --.BR grub-mkimage (1) -diff --git a/docs/man/grub-mkstandalone.h2m b/docs/man/grub-mkstandalone.h2m -deleted file mode 100644 -index c77313978ad..00000000000 ---- a/docs/man/grub-mkstandalone.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-mkstandalone \- make a memdisk-based GRUB image --[SEE ALSO] --.BR grub-mkimage (1) -diff --git a/docs/man/grub-mount.h2m b/docs/man/grub-mount.h2m -deleted file mode 100644 -index 8d168982d72..00000000000 ---- a/docs/man/grub-mount.h2m -+++ /dev/null -@@ -1,2 +0,0 @@ --[NAME] --grub-mount \- export GRUB filesystem with FUSE -diff --git a/docs/man/grub-ofpathname.h2m b/docs/man/grub-ofpathname.h2m -deleted file mode 100644 -index 74b43eea039..00000000000 ---- a/docs/man/grub-ofpathname.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-ofpathname \- find OpenBOOT path for a device --[SEE ALSO] --.BR grub-probe (8) -diff --git a/docs/man/grub-pe2elf.h2m b/docs/man/grub-pe2elf.h2m -deleted file mode 100644 -index 7ca29bd703c..00000000000 ---- a/docs/man/grub-pe2elf.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-pe2elf \- convert PE image to ELF --[SEE ALSO] --.BR grub-mkimage (1) -diff --git a/docs/man/grub-probe.h2m b/docs/man/grub-probe.h2m -deleted file mode 100644 -index 6e1ffdcf937..00000000000 ---- a/docs/man/grub-probe.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-probe \- probe device information for GRUB --[SEE ALSO] --.BR grub-fstest (1) -diff --git a/docs/man/grub-reboot.h2m b/docs/man/grub-reboot.h2m -deleted file mode 100644 -index e4acace65ce..00000000000 ---- a/docs/man/grub-reboot.h2m -+++ /dev/null -@@ -1,5 +0,0 @@ --[NAME] --grub-reboot \- set the default boot entry for GRUB, for the next boot only --[SEE ALSO] --.BR grub-set-default (8), --.BR grub-editenv (1) -diff --git a/docs/man/grub-render-label.h2m b/docs/man/grub-render-label.h2m -deleted file mode 100644 -index 50ae5247c05..00000000000 ---- a/docs/man/grub-render-label.h2m -+++ /dev/null -@@ -1,3 +0,0 @@ --[NAME] --grub-render-label \- generate a .disk_label for Apple Macs. -- -diff --git a/docs/man/grub-script-check.h2m b/docs/man/grub-script-check.h2m -deleted file mode 100644 -index 3653682671a..00000000000 ---- a/docs/man/grub-script-check.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-script-check \- check grub.cfg for syntax errors --[SEE ALSO] --.BR grub-mkconfig (8) -diff --git a/docs/man/grub-set-default.h2m b/docs/man/grub-set-default.h2m -deleted file mode 100644 -index 7945001c154..00000000000 ---- a/docs/man/grub-set-default.h2m -+++ /dev/null -@@ -1,5 +0,0 @@ --[NAME] --grub-set-default \- set the saved default boot entry for GRUB --[SEE ALSO] --.BR grub-reboot (8), --.BR grub-editenv (1) -diff --git a/docs/man/grub-sparc64-setup.h2m b/docs/man/grub-sparc64-setup.h2m -deleted file mode 100644 -index 18f803a50db..00000000000 ---- a/docs/man/grub-sparc64-setup.h2m -+++ /dev/null -@@ -1,6 +0,0 @@ --[NAME] --grub-sparc64-setup \- set up a device to boot using GRUB --[SEE ALSO] --.BR grub-install (8), --.BR grub-mkimage (1), --.BR grub-mkrescue (1) -diff --git a/docs/man/grub-syslinux2cfg.h2m b/docs/man/grub-syslinux2cfg.h2m -deleted file mode 100644 -index ad25c8ab753..00000000000 ---- a/docs/man/grub-syslinux2cfg.h2m -+++ /dev/null -@@ -1,4 +0,0 @@ --[NAME] --grub-syslinux2cfg \- transform syslinux config into grub.cfg --[SEE ALSO] --.BR grub-menulst2cfg (8) -diff --git a/gentpl.py b/gentpl.py -index c86550d4f9e..2cba0bbbd6f 100644 ---- a/gentpl.py -+++ b/gentpl.py -@@ -805,10 +805,7 @@ def manpage(defn, adddeps): - - output("if COND_MAN_PAGES\n") - gvar_add("man_MANS", name + "." + mansection) -- rule(name + "." + mansection, name + " " + adddeps, """ --chmod a+x """ + name + """ --PATH=$(builddir):$$PATH pkgdatadir=$(builddir) $(HELP2MAN) --section=""" + mansection + """ -i $(top_srcdir)/docs/man/""" + name + """.h2m -o $@ """ + name + """ --""") -+ rule(name + "." + mansection, name + " " + adddeps, "cat $(top_srcdir)/util/" + name + "." + mansection + " | $(top_builddir)/config.status --file=$@:-") - gvar_add("CLEANFILES", name + "." + mansection) - output("endif\n") - -diff --git a/util/grub-bios-setup.8 b/util/grub-bios-setup.8 -new file mode 100644 -index 00000000000..56f582b3d75 ---- /dev/null -+++ b/util/grub-bios-setup.8 -@@ -0,0 +1,54 @@ -+.TH GRUB-BIOS-SETUP 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-bios-setup\fR \(em Set up images to boot from a device. -+ -+.SH SYNOPSIS -+\fBgrub-bios-setup\fR [-a | --allow-floppy] [-b | --boot-image=\fIFILE\fR] -+.RS 17 -+[-c | --core-image=\fIFILE\fR] [-d | --directory=\fIDIR\fR] -+.RE -+.RS 17 -+[-f | --force] [-m | --device-map=\fIFILE\fR] -+.RE -+.RS 17 -+[-s | --skip-fs-probe] [-v | --verbose] \fIDEVICE\fR -+ -+.SH DESCRIPTION -+You should not normally run this program directly. Use grub-install instead. -+ -+.SH OPTIONS -+.TP -+\fB--allow-floppy\fR -+Make the device also bootable as a floppy. This option is the default for -+/dev/fdX devices. Some BIOSes will not boot images created with this option. -+ -+.TP -+\fB--boot-image\fR=\fIFILE\fR -+Use FILE as the boot image. The default value is \fBboot.img\fR. -+ -+.TP -+\fB--core-image\fR=\fIFILE\fR -+Use FILE as ther core image. The default value is \fBcore.img\fR. -+ -+.TP -+\fB--directory\fR=\fIDIR\fR -+Use GRUB files in the directory DIR. The default value is \fB/boot/grub\fR. -+ -+.TP -+\fB--force\fR -+Install even if problems are detected. -+ -+.TP -+\fB--device-map\fR=\fIFILE\fR -+Use FILE as the device map. The default value is /boot/grub/device.map . -+ -+.TP -+\fB--skip-fs-probe\fR -+Do not probe DEVICE for filesystems. -+ -+.TP -+\fB--verbose\fR -+Print verbose messages. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-editenv.1 b/util/grub-editenv.1 -new file mode 100644 -index 00000000000..d28ba03ba42 ---- /dev/null -+++ b/util/grub-editenv.1 -@@ -0,0 +1,46 @@ -+.TH GRUB-EDITENV 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-editenv\fR \(em Manage the GRUB environment block. -+ -+.SH SYNOPSIS -+\fBgrub-editenv\fR [-v | --verbose] [\fIFILE\fR] -+.RS 14 -+ -+ -+.SH DESCRIPTION -+\fBgrub-editenv\fR is a command line tool to manage GRUB's stored environment. -+ -+.SH OPTIONS -+.TP -+\fB--verbose\fR -+Print verbose messages. -+ -+.TP -+\fBFILE\fR -+.RS 7 -+File name to use for grub environment. Default is /boot/grub/grubenv . -+.RE -+ -+.SH COMMANDS -+.TP -+\fBcreate\fR -+.RS 7 -+Create a blank environment block file. -+.RE -+ -+.TP -+\fBlist\fR -+.RS 7 -+List the current variables. -+.RE -+ -+.TP -+\fBset\fR [\fINAME\fR=\fIVALUE\fR ...] -+Set variables. -+ -+.TP -+\fBunset [\fINAME\fR ...] -+Delete variables. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-file.1 b/util/grub-file.1 -new file mode 100644 -index 00000000000..b29cb327889 ---- /dev/null -+++ b/util/grub-file.1 -@@ -0,0 +1,165 @@ -+.TH GRUB-FILE 1 "Web Feb 26 2014" -+.SH NAME -+\fBgrub-file\fR \(em Check if FILE is of specified type. -+ -+.SH SYNOPSIS -+\fBgrub-file\fR (--is-i386-xen-pae-domu | --is-x86_64-xen-domu | -+.RS 11 -+--is-x86-xen-dom0 | --is-x86-multiboot | -+.RE -+.RS 11 -+--is-x86-multiboot2 | --is-arm-linux | --is-arm64-linux | -+.RE -+.RS 11 -+--is-ia64-linux | --is-mips-linux | --is-mipsel-linux | -+.RE -+.RS 11 -+--is-sparc64-linux | --is-powerpc-linux | --is-x86-linux | -+.RE -+.RS 11 -+--is-x86-linux32 | --is-x86-kfreebsd | --is-i386-kfreebsd | -+.RE -+.RS 11 -+--is-x86_64-kfreebsd | --is-x86-knetbsd | -+.RE -+.RS 11 -+--is-i386-knetbsd | --is-x86_64-knetbsd | --is-i386-efi | -+.RE -+.RS 11 -+--is-x86_64-efi | --is-ia64-efi | --is-arm64-efi | -+.RE -+.RS 11 -+--is-arm-efi | --is-hibernated-hiberfil | --is-x86_64-xnu | -+.RE -+.RS 11 -+--is-i386-xnu | --is-xnu-hibr | --is-x86-bios-bootsector) -+.RE -+.RS 11 -+\fIFILE\fR -+ -+.SH DESCRIPTION -+\fBgrub-file\fR is used to check if \fIFILE\fR is of a specified type. -+ -+.SH OPTIONS -+.TP -+--is-i386-xen-pae-domu -+Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel -+ -+.TP -+--is-x86_64-xen-domu -+Check if FILE can be booted as x86_64 Xen unprivileged guest kernel -+ -+.TP -+--is-x86-xen-dom0 -+Check if FILE can be used as Xen x86 privileged guest kernel -+ -+.TP -+--is-x86-multiboot -+Check if FILE can be used as x86 multiboot kernel -+ -+.TP -+--is-x86-multiboot2 -+Check if FILE can be used as x86 multiboot2 kernel -+ -+.TP -+--is-arm-linux -+Check if FILE is ARM Linux -+ -+.TP -+--is-arm64-linux -+Check if FILE is ARM64 Linux -+ -+.TP -+--is-ia64-linux -+Check if FILE is IA64 Linux -+ -+.TP -+--is-mips-linux -+Check if FILE is MIPS Linux -+ -+.TP -+--is-mipsel-linux -+Check if FILE is MIPSEL Linux -+ -+.TP -+--is-sparc64-linux -+Check if FILE is SPARC64 Linux -+ -+.TP -+--is-powerpc-linux -+Check if FILE is POWERPC Linux -+ -+.TP -+--is-x86-linux -+Check if FILE is x86 Linux -+ -+.TP -+--is-x86-linux32 -+Check if FILE is x86 Linux supporting 32-bit protocol -+ -+.TP -+--is-x86-kfreebsd -+Check if FILE is x86 kFreeBSD -+ -+.TP -+--is-i386-kfreebsd -+Check if FILE is i386 kFreeBSD -+ -+.TP -+--is-x86_64-kfreebsd -+Check if FILE is x86_64 kFreeBSD -+ -+.TP -+--is-x86-knetbsd -+Check if FILE is x86 kNetBSD -+ -+.TP -+--is-i386-knetbsd -+Check if FILE is i386 kNetBSD -+ -+.TP -+--is-x86_64-knetbsd -+Check if FILE is x86_64 kNetBSD -+ -+.TP -+--is-i386-efi -+Check if FILE is i386 EFI file -+ -+.TP -+--is-x86_64-efi -+Check if FILE is x86_64 EFI file -+ -+.TP -+--is-ia64-efi -+Check if FILE is IA64 EFI file -+ -+.TP -+--is-arm64-efi -+Check if FILE is ARM64 EFI file -+ -+.TP -+--is-arm-efi -+Check if FILE is ARM EFI file -+ -+.TP -+--is-hibernated-hiberfil -+Check if FILE is hiberfil.sys in hibernated state -+ -+.TP -+--is-x86_64-xnu -+Check if FILE is x86_64 XNU (Mac OS X kernel) -+ -+.TP -+--is-i386-xnu -+Check if FILE is i386 XNU (Mac OS X kernel) -+ -+.TP -+--is-xnu-hibr -+Check if FILE is XNU (Mac OS X kernel) hibernated image -+ -+.TP -+--is-x86-bios-bootsector -+Check if FILE is BIOS bootsector -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-fstest.1 b/util/grub-fstest.1 -new file mode 100644 -index 00000000000..792fa78634c ---- /dev/null -+++ b/util/grub-fstest.1 -@@ -0,0 +1,99 @@ -+.TH GRUB-FSTEST 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-fstest\fR — Debug tool for GRUB's filesystem driver. -+ -+.SH SYNOPSIS -+\fBgrub-fstest\fR [-c | --diskcount=\fINUM\fR] [-C | --crypto] -+.RS 13 -+[-d | --debug=\fISTRING\fR] [-K | --zfs-key=\fIFILE\fR|\fIprompt\fR] -+.RE -+.RS 13 -+[-n | --length=\fINUM\fR] [-r | --root=\fIDEVICE_NAME\fR] -+.RE -+.RS 13 -+[-s | --skip=\fINUM\fR] [-u | --uncompress] [-v | --verbose] -+.RE -+.RS 13 -+\fIIMAGE_PATH\fR -+ -+.SH DESCRIPTION -+\fBgrub-fstest\fR is a tool for testing GRUB's filesystem drivers. You should not normally need to run this program. -+ -+.SH OPTIONS -+.TP -+\fB--diskcount\fR=\fINUM\fR -+Specify the number of input files. -+ -+.TP -+\fB--crypto\fR -+Mount cryptographic devices. -+ -+.TP -+\fB--debug\fR=\fISTRING\fR -+Set debug environment variable. -+ -+.TP -+\fB--zfs-key\fR=\fIFILE\fR|\fIprompt\fR -+Load ZFS cryptographic key. -+ -+.TP -+\fB--length\fR=\fINUM\fR -+Handle NUM bytes in output file. -+ -+.TP -+\fB--root\fR=\fIDEVICE_NAME\fR -+Set root device. -+ -+.TP -+\fB--skip\fR=\fINUM\fR -+Skip NUM bytes from output file. -+ -+.TP -+\fB--uncompress\fR -+Uncompress data. -+ -+.TP -+\fB--verbose\fR -+Print verbose messages. -+ -+.SH COMMANDS -+.TP -+\fBblocklist\fR \fIFILE\fR -+Display block list of \fIFILE\fR. -+ -+.TP -+\fBcat\fR \fIFILE\fR -+Display \fIFILE\fR on standard output. -+ -+.TP -+\fBcmp\fR \fIFILE\fR \fILOCAL\fR -+Compare \fIFILE\fR with local file \fILOCAL\fR. -+ -+.TP -+\fBcp\fR \fIFILE\fR \fILOCAL\fR -+Copy \fIFILE\fR to local file \fILOCAL\fR. -+ -+.TP -+\fBcrc\fR \fIFILE\fR -+Display the CRC-32 checksum of \fIFILE\fR. -+ -+.TP -+\fBhex\fR \fIFILE\fR -+Display contents of \fIFILE\fR in hexidecimal. -+ -+.TP -+\fBls\fR \fIPATH\fR -+List files at \fIPATH\fR. -+ -+.TP -+\fBxnu_uuid\fR \fIDEVICE\fR -+Display the XNU UUID of \fIDEVICE\fR. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-glue-efi.1 b/util/grub-glue-efi.1 -new file mode 100644 -index 00000000000..72bd555d577 ---- /dev/null -+++ b/util/grub-glue-efi.1 -@@ -0,0 +1,31 @@ -+.TH GRUB-GLUE-EFI 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-glue-efi\fR \(em Create an Apple fat EFI binary. -+ -+.SH SYNOPSIS -+\fBgrub-glue-efi\fR <-3 | --input32=\fIFILE\fR> <-6 | --input64=\fIFILE\fR> -+.RS 15 -+<-o | --output=\fIFILE\fR> [-v | --verbose] -+ -+.SH DESCRIPTION -+\fBgrub-glue-efi\fR creates an Apple fat EFI binary from two EFI binaries. -+ -+.SH OPTIONS -+.TP -+\fB--input32\fR=\fIFILE\fR -+Read 32-bit binary from \fIFILE\fR. -+ -+.TP -+\fB--input64\fR=\fIFILE\fR -+Read 64-bit binary from \fIFILE\fR. -+ -+.TP -+\fB--output\fR=\fIFILE\fR -+Write resulting fat binary to \fIFILE\fR. -+ -+.TP -+\fB--verbose\fR -+Print verbose messages. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-install.8 b/util/grub-install.8 -new file mode 100644 -index 00000000000..1db89e94b3b ---- /dev/null -+++ b/util/grub-install.8 -@@ -0,0 +1,128 @@ -+.TH GRUB-INSTALL 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-install\fR \(em Install GRUB on a device. -+ -+.SH SYNOPSIS -+\fBgrub-install\fR [--modules=\fIMODULES\fR] [--install-modules=\fIMODULES\fR] -+.RS 14 -+[--themes=\fITHEMES\fR] [--fonts=\fIFONTS\fR] [--locales=\fILOCALES\fR] -+.RE -+.RS 14 -+[--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]] [-d | --directory=\fIDIR\fR] -+.RE -+.RS 14 -+[--grub-mkimage=\fIFILE\fR] [--boot-directory=\fIDIR\fR] -+.RE -+.RS 14 -+[--target=\fITARGET\fR] [--grub-setup=\fIFILE\fR] -+.RE -+.RS 14 -+[--grub-mkrelpath=\fIFILE\fR] [--grub-probe=\fIFILE\fR] -+.RE -+.RS 14 -+[--allow-floppy] [--recheck] [--force] [--force-file-id] -+.RE -+.RS 14 -+[--disk-module=\fIMODULE\fR] [--no-nvram] [--removable] -+.RE -+.RS 14 -+[--bootloader-id=\fIID\fR] [--efi-directory=\fIDIR\fR] \fIINSTALL_DEVICE\fR -+ -+.SH DESCRIPTION -+\fBgrub-install\fR installs GRUB onto a device. This includes copying GRUB images into the target directory (generally \fI/boot/grub\fR), and on some platforms may also include installing GRUB onto a boot sector. -+ -+.SH OPTIONS -+.TP -+\fB--modules\fR=\fIMODULES\fR\! -+Pre-load modules specified by \fIMODULES\fR. -+ -+.TP -+\fB--install-modules\fR=\fIMODULES\fR -+Install only \fIMODULES\fR and their dependencies. The default is to install all available modules. -+ -+.TP -+\fB--themes\fR=\fITHEMES\fR -+Install \fITHEMES\fR. The default is to install the \fIstarfield\fR theme, if available. -+ -+.TP -+\fB--fonts\fR=\fIFONTS\fR -+Install \fIFONTS\fR. The default is to install the \fIunicode\fR font. -+ -+.TP -+\fB--locales\fR=\fILOCALES\fR -+Install only locales listed in \fILOCALES\fR. The default is to install all available locales. -+ -+.TP -+\fB--compress\fR=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR -+Compress GRUB files using the specified compression algorithm. -+ -+.TP -+\fB--directory\fR=\fIDIR\fR -+Use images and modules in \fIDIR\fR. -+ -+.TP -+\fB--grub-mkimage\fR=\fIFILE\fR -+Use \fIFILE\fR as \fBgrub-mkimage\fR. The default is \fI/usr/bin/grub-mkimage\fR. -+ -+.TP -+\fB--boot-directory\fR=\fIDIR\fR -+Use \fIDIR\fR as the boot directory. The default is \fI/boot\fR. GRUB will put its files in a subdirectory of this directory named \fIgrub\fR. -+ -+.TP -+\fB--target\fR=\fITARGET\fR -+Install GRUB for \fITARGET\fR platform. The default is the platform \fBgrub-install\fR is running on. -+ -+.TP -+\fB--grub-setup\fR=\fIFILE\fR -+Use \fIFILE\fR as \fBgrub-setup\fR. The default is \fI/usr/bin/grub-setup\fR. -+ -+.TP -+\fB--grub-mkrelpath\fR=\fIFILE\fR -+Use \fIFILE\fR as \fBgrub-mkrelpath\fR. The default is \fI/usr/bin/grub-mkrelpath\fR. -+ -+.TP -+\fB--grub-probe\fR=\fIFILE\fR -+Use \fIFILE\fR as \fBgrub-probe\fR. The default is \fI/usr/bin/grub-mkrelpath\fR. -+ -+.TP -+\fB--allow-floppy -+Make the device also bootable as a floppy. This option is the default for /dev/fdX devices. Some BIOSes will not boot images created with this option. -+ -+.TP -+\fB--recheck -+Delete any existing device map and create a new one if necessary. -+ -+.TP -+\fB--force -+Install even if problems are detected. -+ -+.TP -+\fB--force-file-id -+Use identifier file even if UUID is available. -+ -+.TP -+\fB--disk-module\fR=\fIMODULE\fR -+Use \fIMODULE\fR for disk access. This allows you to manually specify either \fIbiosdisk\fR or \fInative\fR disk access. This option is only available on the BIOS target platform. -+ -+.TP -+\fB--no-nvram -+Do not update the \fIboot-device\fR NVRAM variable. This option is only available on IEEE1275 target platforms. -+ -+.TP -+\fB--removable -+Treat the target device as if it is removeable. This option is only available on the EFI target platform. -+ -+.TP -+\fB--bootloader-id\fR=\fIID\fR -+Use \fIID\fR as the bootloader ID. This option is only available on the EFI target platform. -+ -+.TP -+\fB--efi-directory\fR=\fIDIR\fR -+Use \fIDIR\fR as the EFI System Partition root. This option is only available on the EFI target platform. -+ -+.TP -+\fIINSTALL_DEVICE\fR -+Install GRUB to the block device \fIINSTALL_DEVICE\fR. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-kbdcomp.1 b/util/grub-kbdcomp.1 -new file mode 100644 -index 00000000000..0bb969a5b43 ---- /dev/null -+++ b/util/grub-kbdcomp.1 -@@ -0,0 +1,19 @@ -+.TH GRUB-KBDCOMP 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-kbdcomp\fR \(em Generate a GRUB keyboard layout file. -+ -+.SH SYNOPSIS -+\fBgrub-kbdcomp\fR <-o | --output=\fIFILE\fR> \fICKBMAP_ARGUMENTS\fR -+ -+.SH DESCRIPTION -+\fBgrub-kbdcomp\fR processes an X keyboard layout description in -+\fBkeymaps\fR(5) format into a format that can be used by GRUB's \fBkeymap\fR -+command. -+ -+.SH OPTIONS -+.TP -+\fB--output\fR=\fIFILE\fR -+Write output to \fIFILE\fR. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-macbless.1 b/util/grub-macbless.1 -new file mode 100644 -index 00000000000..41a96186f70 ---- /dev/null -+++ b/util/grub-macbless.1 -@@ -0,0 +1,22 @@ -+.TH GRUB-MACBLESS 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-macbless\fR \(em Mac-style bless on HFS or HFS+ -+ -+.SH SYNOPSIS -+\fBgrub-macbless\fR [-v | --verbose] [-p | --ppc] \fIFILE\fR | [-x | --x86] \fIFILE\fR -+ -+.SH OPTIONS -+.TP -+--x86 -+Bless for x86 based Macs. -+ -+.TP -+--ppc -+Bless for PPC based Macs. -+ -+.TP -+--verbose -+Print verbose messages. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-menulst2cfg.1 b/util/grub-menulst2cfg.1 -new file mode 100644 -index 00000000000..91e2ef87113 ---- /dev/null -+++ b/util/grub-menulst2cfg.1 -@@ -0,0 +1,12 @@ -+.TH GRUB-MENULST2CFG 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-menulst2cfg\fR \(em Convert a configuration file from GRUB 0.xx to GRUB 2.xx format. -+ -+.SH SYNOPSIS -+\fBgrub-menulst2cfg\fR [\fIINFILE\fR [\fIOUTFILE\fR]] -+ -+.SH DESCRIPTION -+\fBgrub-menulst2cfg\fR converts a configuration file from GRUB 0.xx to the current format. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8 -new file mode 100644 -index 00000000000..a2d1f577b9b ---- /dev/null -+++ b/util/grub-mkconfig.8 -@@ -0,0 +1,17 @@ -+.TH GRUB-MKCONFIG 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-mkconfig\fR \(em Generate a GRUB configuration file. -+ -+.SH SYNOPSIS -+\fBgrub-mkconfig\fR [-o | --output=\fIFILE\fR] -+ -+.SH DESCRIPTION -+\fBgrub-mkconfig\fR generates a configuration file for GRUB. -+ -+.SH OPTIONS -+.TP -+\fB--output\fR=\fIFILE\fR -+Write generated output to \fIFILE\fR. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mkfont.1 b/util/grub-mkfont.1 -new file mode 100644 -index 00000000000..3494857987d ---- /dev/null -+++ b/util/grub-mkfont.1 -@@ -0,0 +1,87 @@ -+.TH GRUB-MKFONT 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-mkfont\fR \(em Convert common font file formats into the PF2 format. -+ -+.SH SYNOPSIS -+\fBgrub-mkfont\fR [--ascii-bitmaps] [-a | --force-autohint] -+.RS 13 -+[-b | --bold] [-c | --asce=\fINUM\fR] [-d | --desc=\fINUM\fR] -+.RE -+.RS 13 -+[-i | --index=\fINUM\fR] [-n | --name=\fINAME\fR] [--no-bitmap] -+.RE -+.RS 13 -+[--no-hinting] <-o | --output=\fIFILE\fR> -+.RE -+.RS 13 -+[-r | --range=\fIFROM-TO\fR[\fI,FROM-TO\fR]] [-s | --size=\fISIZE\fR] -+.RE -+.RS 13 -+[-v | --verbose] [--width-spec] \fIFONT_FILES\fR -+ -+.SH DESCRIPTION -+\fBgrub-mkfont\fR converts font files from common formats into the PF2 format used by GRUB. -+ -+.SH OPTIONS -+.TP -+--ascii-bitmaps -+Save only bitmaps for ASCII characters. -+ -+.TP -+--force-autohint -+Force generation of automatic hinting. -+ -+.TP -+--bold -+Convert font to bold. -+ -+.TP -+--asce=\fINUM\fR -+Set font ascent to \fINUM\fR. -+ -+.TP -+--desc=\fINUM\fR -+Set font descent to \fINUM\fR. -+ -+.TP -+--index=\fINUM\fR -+Select face index \fINUM\fR. -+ -+.TP -+--name=\fINAME\fR -+Set font family to \fINAME\fR. -+ -+.TP -+--no-bitmap -+Ignore bitmap strikes when loading. -+ -+.TP -+--no-hinting -+Disable hinting. -+ -+.TP -+--output=\fIFILE\fR -+Save ouptut to \fIFILE\fR. This argument is required. -+ -+.TP -+--range=\fIFROM-TO\fR\fI,FROM-TO\fR -+Set the font ranges to each pair of \fIFROM\fR,\fITO\fR. -+ -+.TP -+--size=\fISIZE\fR -+Set font size to \fISIZE\fR. -+ -+.TP -+--verbose -+Print verbose messages. -+ -+.TP -+--width-spec -+Create a width summary file. -+ -+.TP -+\fIFONT_FILES\fR -+The input files to be converted. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1 -new file mode 100644 -index 00000000000..4dea4f54597 ---- /dev/null -+++ b/util/grub-mkimage.1 -@@ -0,0 +1,95 @@ -+.TH GRUB-MKIMAGE 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-mkimage\fR \(em Make a bootable GRUB image. -+ -+.SH SYNOPSIS -+\fBgrub-mkimage\fR [-c | --config=\fRFILE\fI] [-C | --compression=(\fIxz\fR,\fInone\fR,\fIauto\fR)] -+.RS 14 -+[-d | --directory=\fRDIR\fR] [-k | --pubkey=\fIFILE\fR] -+.RE -+.RS 14 -+[-m | --memdisk=\fIFILE\fR] [-n | --note] [-o | --output=\fIFILE\fR] -+.RE -+.RS 14 -+[-O | --format=\fIFORMAT\fR] [-p | --prefix=\fIDIR\fR] -+.RE -+.RS 14 -+[-v | --verbose] \fIMODULES\fR -+ -+.SH DESCRIPTION -+\fBgrub-mkimage\fI builds a bootable image of GRUB. -+ -+.SH OPTIONS -+.TP -+--config=\fIFILE\fR -+Embed \fIFILE\fR as the image's initial configuration file. -+ -+.TP -+--compression=(\fIxz\fR,\fInone\fR,\fIauto\fR) -+Use one of \fIxz\fR, \fInone\fR, or \fIauto\fR as the compression method for the core image. -+ -+.TP -+--directory=\fIDIR\fR -+Use images and modules from \fIDIR\fR. The default value is \fB/usr/lib/grub/\fR. -+ -+.TP -+--pubkey=\fIFILE\fR -+Embed the public key \fIFILE\fR for signature checking. -+ -+.TP -+--memdisk=\fIFILE\fR -+Embed the memdisk image \fIFILE\fR. If no \fB-p\fR option is also specified, this implies \fI-p (memdisk)/boot/grub\fR. -+ -+.TP -+--note -+Add a CHRP \fINOTE\fR section. This option is only valid on IEEE1275 platforms. -+ -+.TP -+--output=\fIFILE\fR -+Write the generated file to \fIFILE\fR. The default is to write to standard output. -+ -+.TP -+--format=\fIFORMAT\fR -+Generate an image in the specified \fIFORMAT\fR. Valid values are: -+.RS -+.RS 4 -+.P -+i386-coreboot, -+i386-multiboot, -+i386-pc, -+i386-pc-pxe, -+i386-efi, -+i386-ieee1275, -+i386-qemu, -+x86_64-efi, -+mipsel-yeeloong-flash, -+mipsel-fuloong2f-flash, -+mipself-loongson-elf, -+powerpc-ieee1275, -+sparc64-ieee1275-raw, -+sparc64-ieee1275-cdcore, -+sparc64-ieee1275-aout, -+ia64-efi, -+mips-arc, -+mipsel-arc, -+mipsel-qemu_mips-elf, -+mips-qemu_mips-flash, -+mipsel-qemu_mips-flash, -+mips-qemu_mips-elf -+.RE -+.RE -+ -+.TP -+--prefix=\fIDIR\fR -+Set prefix directory. The default value is \fI/boot/grub\fR. -+ -+.TP -+--verbose -+Print verbose messages. -+ -+.TP -+\fIMODULES\fR -+Include \fIMODULES\fR. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mklayout.1 b/util/grub-mklayout.1 -new file mode 100644 -index 00000000000..d1bbc2ec515 ---- /dev/null -+++ b/util/grub-mklayout.1 -@@ -0,0 +1,27 @@ -+.TH GRUB-MKLAYOUT 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-mklayout\fR \(em Generate a GRUB keyboard layout file. -+ -+.SH SYNOPSIS -+\fBgrub-mklayout\fR [-i | --input=\fIFILE\fR] [-o | --output=\fIFILE\fR] -+.RS 15 -+[-v | --verbose] -+ -+.SH DESCRIPTION -+\fBgrub-mklayout\fR generates a GRUB keyboard layout description which corresponds with the Linux console layout description given as input. -+ -+.SH OPTIONS -+.TP -+--input=\fIFILE\fR -+Use \fIFILE\fR as the input. The default value is the standard input device. -+ -+.TP -+--output=\fIFILE\fR -+Use \fIFILE\fR as the output. The default value is the standard output device. -+ -+.TP -+--verbose -+Print verbose messages. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mknetdir.1 b/util/grub-mknetdir.1 -new file mode 100644 -index 00000000000..fa7e8d4ef0d ---- /dev/null -+++ b/util/grub-mknetdir.1 -@@ -0,0 +1,12 @@ -+.TH GRUB-MKNETDIR 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-mknetdir\fR \(em Prepare a GRUB netboot directory. -+ -+.SH SYNOPSIS -+\fBgrub-mknetdir\fR -+ -+.SH DESCRIPTION -+\fBgrub-mknetdir\fR prepares a directory for GRUB to be netbooted from. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mkpasswd-pbkdf2.1 b/util/grub-mkpasswd-pbkdf2.1 -new file mode 100644 -index 00000000000..73c437c15d8 ---- /dev/null -+++ b/util/grub-mkpasswd-pbkdf2.1 -@@ -0,0 +1,27 @@ -+.TH GRUB-MKPASSWD-PBKDF2 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-mkpasswd-pbkdf2\fR \(em Generate a PBKDF2 password hash. -+ -+.SH SYNOPSIS -+\fBgrub-mkpasswd-pbkdf2\fR [-c | --iteration-count=\fINUM\fR] [-l | --buflen=\fINUM\fR] -+.RS 22 -+[-s | --salt=\fINUM\fR] -+ -+.SH DESCRIPTION -+\fBgrub-mkpasswd-pbkdf2\fR generates a PBKDF2 password string suitable for use in a GRUB configuration file. -+ -+.SH OPTIONS -+.TP -+--iteration-count=\fINUM\fR -+Number of PBKDF2 iterations. -+ -+.TP -+--buflen=\fINUM\fR -+Length of generated hash. -+ -+.TP -+--salt=\fINUM\fR -+Length of salt to use. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mkrelpath.1 b/util/grub-mkrelpath.1 -new file mode 100644 -index 00000000000..85f1113621d ---- /dev/null -+++ b/util/grub-mkrelpath.1 -@@ -0,0 +1,12 @@ -+.TH GRUB-MKRELPATH 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-mkrelpath\fR \(em Generate a relative GRUB path given an OS path. -+ -+.SH SYNOPSIS -+\fBgrub-mkrelpath\fR \fIFILE\fR -+ -+.SH DESCRIPTION -+\fBgrub-mkrelpath\fR takes an OS filesystem path for \fIFILE\fR and returns a relative path suitable for use in a GRUB configuration file. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mkrescue.1 b/util/grub-mkrescue.1 -new file mode 100644 -index 00000000000..4ed9fc723fd ---- /dev/null -+++ b/util/grub-mkrescue.1 -@@ -0,0 +1,123 @@ -+.TH GRUB-MKRESCUE 3 "Wed Feb 26 2014" -+.SH NAME -+grub-mkrescue \(em Generate a GRUB rescue image using GNU Xorriso. -+ -+.SH SYNOPSIS -+\fBgrub-mkrescue\fR [-o | --output=\fIFILE\fR] [--modules=\fIMODULES\fR] -+.RS 15 -+[--install-modules=\fIMODULES\fR] [--themes=\fITHEMES\fR] -+.RE -+.RS 15 -+[--fonts=\fIFONTS\fR] [--locales=\fILOCALES\fR] -+.RE -+.RS 15 -+[--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]] [-d | --directory=\fIDIR\fR] -+.RE -+.RS 15 -+[--grub-mkimage=\fIFILE\fR] [--rom-directory=\fIDIR\fR] -+.RE -+.RS 15 -+[--xorriso=\fIFILE\fR] [--grub-glue-efi=\fIFILE\fR] -+.RE -+.RS 15 -+[--grub-render-label=\fIFILE\fR] [--label-font=\fIFILE\fR] -+.RE -+.RS 15 -+[--label-color=\fICOLOR\fR] [--label-bgcolor=\fIFILE\fR] -+.RE -+.RS 15 -+[--product-name=\fISTRING\fR] [--product-version=\fISTRING\fR] -+.RE -+.RS 15 -+[--sparc-boot] [--arcs-boot] -+ -+.SH DESCRIPTION -+\fBgrub-mkrescue\fR can be used to generate a rescue image with the GRUB bootloader. -+ -+.SH OPTIONS -+.TP -+\fB--output\fR=\fIFILE\fR -+Write the generated file to \fIFILE\fR. The default is to write to standard output. -+ -+.TP -+\fB--modules\fR=\fIMODULES\fR -+Pre-load modules specified by \fIMODULES\fR. -+ -+.TP -+\fB--install-modules\fR=\fIMODULES\fR -+Install only \fIMODULES\fR and their dependencies. The default is to install all available modules. -+ -+.TP -+\fB--themes\fR=\fITHEMES\fR -+Install \fITHEMES\fR. The default is to install the \fIstarfield\fR theme, if available. -+ -+.TP -+\fB--fonts\fR=\fIFONTS\fR -+Install \fIFONTS\fR. The default is to install the \fIunicode\fR font. -+ -+.TP -+\fB--locales\fR=\fILOCALES\fR -+Install only locales listed in \fILOCALES\fR. The default is to install all available locales. -+ -+.TP -+\fB--compress\fR[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR] -+Compress GRUB files using the specified compression algorithm. -+ -+.TP -+\fB--directory\fR=\fIDIR\fR -+Use images and modules in \fIDIR\fR. -+ -+.TP -+\fB--grub-mkimage\fR=\fIFILE\fR -+Use \fIFILE\fR as \fBgrub-mkimage\fR(1). The default is \fI/usr/bin/grub-mkimage\fR. -+ -+.TP -+\fB--rom-directory\fR=\fIDIR\fR -+Save ROM images in \fIDIR\fR. -+ -+.TP -+\fB--xorriso\fR=\fIFILE\fR -+Use \fIFILE\fR as \fBxorriso\fI. -+ -+.TP -+\fB--grub-glue-efi\fR=\fIFILE\fR -+Use \fIFILE\fR as \fBgrub-glue-efi\fR(3). -+ -+.TP -+\fB--grub-render-label\fR=\fIFILE\fR -+Use \fIFILE\fR as \fBgrub-render-label\fR(3). -+ -+.TP -+\fB--label-font\fR=\fIFILE\fR -+Use \fIFILE\fR as the font file for generated labels. -+ -+.TP -+\fB--label-color\fR=\fICOLOR\fR -+Use \fICOLOR\fI as the color for generated labels. -+ -+.TP -+\fB--label-bgcolor\fR=\fICOLOR\fR -+Use \fICOLOR\fR as the background color for generated labels. -+ -+.TP -+\fB--product-name\fR=\fISTRING\fR -+Use \fISTRING\fR as the product name in generated labels. -+ -+.TP -+\fB--product-version\fR=\fISTRING\fR -+Use \fISTRING\fR as the product version in generated labels. -+ -+.TP -+\fB--sparc-boot\fR -+Enable booting the SPARC platform. This disables HFS+, APM, ARCS, and "boot as disk image" on the \fIi386-pc\fR target platform. -+ -+.TP -+\fB--arcs-boot\fR -+Enable ARCS booting. This is typically for big-endian MIPS machines, and disables HFS+, APM, sparc64, and "boot as disk image" on the \fIi386-pc\fR target platform. -+ -+.TP -+\fB--\fR -+All options after a \fB--\fR will be passed directly to xorriso's command line when generating the image. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mkstandalone.1 b/util/grub-mkstandalone.1 -new file mode 100644 -index 00000000000..ba2d2bdf279 ---- /dev/null -+++ b/util/grub-mkstandalone.1 -@@ -0,0 +1,100 @@ -+.TH GRUB-MKSTANDALONE 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-mkstandalone\fR \(em Generate a standalone image in the selected format. -+ -+.SH SYNOPSIS -+\fBgrub-mkstandalone\fR [-o | --output=\fIFILE\fR] [-O | --format=\fIFORMAT\fR] -+.RS 19 -+[-C | --compression=(\fIxz\fR|\fInone\fR|\fIauto\fR)] -+.RE -+.RS 19 -+[--modules=\fIMODULES\fR] [--install-modules=\fIMODULES\fR] -+.RE -+.RS 19 -+[--themes=\fITHEMES\fR] [--fonts=\fIFONTS\fR] -+.RE -+.RS 19 -+[--locales=\fILOCALES\fR] [--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR]] -+.RE -+.RS 19 -+[-d | --directory=\fIDIR\fR] [--grub-mkimage=\fIFILE\fR] -+.RE -+.RS 19 -+\fISOURCE...\fR -+ -+.SH DESCRIPTION -+ -+.SH OPTIONS -+.TP -+--output=\fIFILE\fR -+Write the generated file to \fIFILE\fR. The default is to write to standard output. -+ -+.TP -+--format=\fIFORMAT\fR -+Generate an image in the specified \fIFORMAT\fR. Valid values are: -+.RS -+.RS 4 -+.P -+i386-coreboot, -+i386-multiboot, -+i386-pc, -+i386-pc-pxe, -+i386-efi, -+i386-ieee1275, -+i386-qemu, -+x86_64-efi, -+mipsel-yeeloong-flash, -+mipsel-fuloong2f-flash, -+mipself-loongson-elf, -+powerpc-ieee1275, -+sparc64-ieee1275-raw, -+sparc64-ieee1275-cdcore, -+sparc64-ieee1275-aout, -+ia64-efi, -+mips-arc, -+mipsel-arc, -+mipsel-qemu_mips-elf, -+mips-qemu_mips-flash, -+mipsel-qemu_mips-flash, -+mips-qemu_mips-elf -+.RE -+.RE -+ -+.TP -+--compression=(\fIxz\fR|\fInone\fR|\fIauto\fR) -+Use one of \fIxz\fR, \fInone\fR, or \fIauto\fR as the compression method for the core image. -+ -+.TP -+--modules=\fIMODULES\fR -+Pre-load modules specified by \fIMODULES\fR. -+ -+.TP -+--install-modules=\fIMODULES\fR -+Install only \fIMODULES\fR and their dependencies. The default is to install all available modules. -+ -+.TP -+--themes=\fITHEMES\fR -+Install \fITHEMES\fR. The default is to install the \fIstarfield\fR theme, if available. -+ -+.TP -+--fonts=\fIFONTS\fR -+Install \fIFONTS\fR. The default is to install the \fIunicode\fR font. -+ -+.TP -+--locales=\fILOCALES\fR -+Install only locales listed in \fILOCALES\fR. The default is to install all available locales. -+ -+.TP -+--compress[=\fIno\fR,\fIxz\fR,\fIgz\fR,\fIlzo\fR] -+Compress GRUB files using the specified compression algorithm. -+ -+.TP -+--directory=\fIDIR\fR -+Use images and modules in \fIDIR\fR. -+ -+.TP -+--grub-mkimage=\fIFILE\fR -+Use \fIFILE\fR as \fBgrub-mkimage\fR. The default is \fI/usr/bin/grub-mkimage\fR. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-ofpathname.8 b/util/grub-ofpathname.8 -new file mode 100644 -index 00000000000..bf3743aeba1 ---- /dev/null -+++ b/util/grub-ofpathname.8 -@@ -0,0 +1,12 @@ -+.TH GRUB-OFPATHNAME 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-ofpathname\fR \(em Generate an IEEE-1275 device path for a specified device. -+ -+.SH SYNOPSIS -+\fBgrub-ofpathname\fR \fIDEVICE\fR -+ -+.SH DESCRIPTION -+\fBgrub-ofpathname\fR generates an IEEE-1275 device path for the specified \fIDEVICE\fR. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-probe.8 b/util/grub-probe.8 -new file mode 100644 -index 00000000000..04e26c832bb ---- /dev/null -+++ b/util/grub-probe.8 -@@ -0,0 +1,80 @@ -+.TH GRUB-PROBE 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-probe\fR \(em Probe device information for a given path. -+ -+.SH SYNOPSIS -+\fBgrub-probe\fR \[-d | --device] [-m | --device-map=\fIFILE\fR] -+.RS 12 -+[-t | --target=(fs|fs_uuid|fs_label|drive|device|partmap| -+.RE -+.RS 28 -+abstraction|cryptodisk_uuid| -+.RE -+.RS 28 -+msdos_parttype)] -+.RE -+.RS 12 -+[-v | --verbose] (PATH|DEVICE) -+ -+.SH DESCRIPTION -+\fBgrub-probe\fR probes a path or device for filesystem and related information. -+ -+.SH OPTIONS -+.TP -+--device -+Final option represents a \fIDEVICE\fR, rather than a filesystem \fIPATH\fR. -+.TP -+--device-map=\fIFILE\fR -+Use \fIFILE\fR as the device map. The default value is \fI/boot/grub/device.map\fR. -+ -+.TP -+--target=(fs|fs_uuid|fs_label|drive|device|partmap|msdos_parttype) -+Select among various output definitions. The default is \fIfs\fR. -+.RS -+.TP -+\fIfs\fR -+filesystem module -+ -+.TP -+\fIfs_uuid\fR -+filesystem UUID -+ -+.TP -+\fIfs_label\fR -+filesystem label -+ -+.TP -+\fIdrive\fR -+GRUB drive name -+ -+.TP -+\fIdevice\fR -+System device -+ -+.TP -+\fIpartmap\fR -+partition map module -+ -+.TP -+\fIabstraction\fR -+abstraction module -+ -+.TP -+\fIcryptodisk_uuid\fR -+cryptographic container -+ -+.TP -+\fImsdos_partmap\fR -+MS-DOS partition map -+.RE -+ -+.TP -+--verbose -+Print verbose output. -+ -+.TP -+(\fIPATH\fR|\fIDEVICE\fR) -+If --device is passed, a block \fIDEVICE\fR. Otherwise, the \fIPATH\fR of a file on the filesystem. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-reboot.8 b/util/grub-reboot.8 -new file mode 100644 -index 00000000000..faa5e4eece2 ---- /dev/null -+++ b/util/grub-reboot.8 -@@ -0,0 +1,21 @@ -+.TH GRUB-REBOOT 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-reboot\fR \(em Set the default boot menu entry for the next boot only. -+ -+.SH SYNOPSIS -+\fBgrub-reboot\fR [--boot-directory=\fIDIR\fR] \fIMENU_ENTRY\fR -+ -+.SH DESCRIPTION -+\fBgrub-reboot\fR sets the default boot menu entry for the next boot, but not further boots after that. This command only works for GRUB configuration files created with \fIGRUB_DEFAULT=saved\fR in \fI/etc/default/grub\fR. -+ -+.SH OPTIONS -+.TP -+--boot-directory=\fIDIR\fR -+Find GRUB images under \fIDIR/grub\fR. The default value is \fI/boot\fR, resulting in grub images being search for at \fI/boot/grub\fR. -+ -+.TP -+\fIMENU_ENTRY\fR -+A number, a menu item title or a menu item identifier. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-render-label.1 b/util/grub-render-label.1 -new file mode 100644 -index 00000000000..4d51c8abf01 ---- /dev/null -+++ b/util/grub-render-label.1 -@@ -0,0 +1,51 @@ -+.TH GRUB-RENDER-LABEL 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-render-label\fR \(em Render an Apple disk label. -+ -+.SH SYNOPSIS -+\fBgrub-render-label\fR [-b | --bgcolor=\fICOLOR\fR] [-c | --color=\fICOLOR\fR] -+.RS 19 -+[-f | --font=\fIFILE\fR] [-i | --input=\fIFILE\fR] -+.RE -+.RS 19 -+[-o | --output=\fIFILE\fR] [-t | --text=\fISTRING\fR] -+.RE -+.RS 19 -+[-v | --verbose] -+ -+.SH DESCRIPTION -+\fBgrub-render-label\fR renders an Apple disk label (.disk_label) file. -+ -+ -+.SH OPTIONS -+.TP -+\fB--color\fR=\fICOLOR\fR -+Use \fICOLOR\fI as the color for generated labels. -+ -+.TP -+\fB--bgcolor\fR=\fICOLOR\fR -+Use \fICOLOR\fR as the background color for generated labels. -+ -+.TP -+\fB--font\fR=\fIFILE\fR -+Use \fIFILE\fR as the font file for generated labels. -+ -+.TP -+--input=\fIFILE\fR -+Read input text from \fIFILE\fR. -+ -+.TP -+--output=\fIFILE\fR -+Render output to \fIFILE\fR. -+ -+.TP -+--text=\fISTRING\fR -+Use \fISTRING\fR as input text. -+ -+.TP -+--verbose -+Print verbose output. -+ -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-script-check.1 b/util/grub-script-check.1 -new file mode 100644 -index 00000000000..0f1f625b05d ---- /dev/null -+++ b/util/grub-script-check.1 -@@ -0,0 +1,21 @@ -+.TH GRUB-SCRIPT-CHECK 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-script-check\fR \(em Check GRUB configuration file for syntax errors. -+ -+.SH SYNOPSIS -+\fBgrub-script-check\fR [-v | --verbose] \fIPATH\fR -+ -+.SH DESCRIPTION -+\fBgrub-script-check\fR verifies that a specified GRUB configuration file does not contain syntax errors. -+ -+.SH OPTIONS -+.TP -+--verbose -+Print verbose output. -+ -+.TP -+\fIPATH\fR -+Path of the file to use as input. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-set-default.8 b/util/grub-set-default.8 -new file mode 100644 -index 00000000000..a96265a1509 ---- /dev/null -+++ b/util/grub-set-default.8 -@@ -0,0 +1,21 @@ -+.TH GRUB-SET-DEFAULT 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-set-default\fR \(em Set the default boot menu entry for GRUB. -+ -+.SH SYNOPSIS -+\fBgrub-set-default\fR [--boot-directory=\fIDIR\fR] \fIMENU_ENTRY\fR -+ -+.SH DESCRIPTION -+\fBgrub-set-default\fR sets the default boot menu entry for all subsequent boots. This command only works for GRUB configuration files created with \fIGRUB_DEFAULT=saved\fR in \fI/etc/default/grub\fR. -+ -+.SH OPTIONS -+.TP -+--boot-directory=\fIDIR\fR -+Find GRUB images under \fIDIR/grub\fR. The default value is \fI/boot\fR, resulting in grub images being search for at \fI/boot/grub\fR. -+ -+.TP -+\fIMENU_ENTRY\fR -+A number, a menu item title or a menu item identifier. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-sparc64-setup.8 b/util/grub-sparc64-setup.8 -new file mode 100644 -index 00000000000..37ea2dd5eaa ---- /dev/null -+++ b/util/grub-sparc64-setup.8 -@@ -0,0 +1,12 @@ -+.TH GRUB-SPARC64-SETUP 3 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-sparc64-setup\fR \(em Set up a device to boot a sparc64 GRUB image. -+ -+.SH SYNOPSIS -+\fBgrub-sparc64-setup\fR [OPTIONS]. -+ -+.SH DESCRIPTION -+You should not normally run this program directly. Use grub-install instead. -+ -+.SH SEE ALSO -+.BR "info grub" diff --git a/0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch similarity index 97% rename from 0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch rename to 0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index 6b1580bb..619cd928 100644 --- a/0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -17,7 +17,7 @@ Signed-off-by: Mark Salter 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 7ca2e5400b1..02577502116 100644 +index 7ca2e5400..025775021 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch similarity index 99% rename from 0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch rename to 0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index ab49bb19..54b8a05e 100644 --- a/0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 02577502116..880d0ebd454 100644 +index 025775021..880d0ebd4 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch similarity index 96% rename from 0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch rename to 0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index 245faf7e..6ad5b7a7 100644 --- a/0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index cf8d1186981..5f6d3c8d52d 100644 +index cf8d11869..5f6d3c8d5 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch similarity index 96% rename from 0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch rename to 0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch index 3e2d3ae5..6d8d6730 100644 --- a/0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +++ b/0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 8 insertions(+) diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 301d1ac229a..0f6505bf3b6 100644 +index 301d1ac22..0f6505bf3 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -253,6 +253,14 @@ version_test_gt () diff --git a/0032-Try-prefix-if-fw_path-doesn-t-work.patch b/0031-Try-prefix-if-fw_path-doesn-t-work.patch similarity index 98% rename from 0032-Try-prefix-if-fw_path-doesn-t-work.patch rename to 0031-Try-prefix-if-fw_path-doesn-t-work.patch index 54a876ba..2abb2397 100644 --- a/0032-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0031-Try-prefix-if-fw_path-doesn-t-work.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 3 files changed, 82 insertions(+), 82 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index e71d1584164..0cd2a627231 100644 +index e71d15841..0cd2a6272 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -127,23 +127,25 @@ grub_machine_get_bootlocation (char **device, char **path) @@ -56,7 +56,7 @@ index e71d1584164..0cd2a627231 100644 } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 4d3eb5c1a52..0ef148f4adc 100644 +index 4d3eb5c1a..0ef148f4a 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1869,7 +1869,7 @@ grub_net_search_config_file (char *config) @@ -69,7 +69,7 @@ index 4d3eb5c1a52..0ef148f4adc 100644 static struct grub_preboot *fini_hnd; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 880d0ebd454..d5df4f815b0 100644 +index 880d0ebd4..d5df4f815 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config) diff --git a/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch b/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch similarity index 89% rename from 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch rename to 0032-Use-rpm-s-sort-for-grub2-mkconfig.patch index ff1c13ec..2a1e3643 100644 --- a/0033-Use-rpm-s-sort-for-grub2-mkconfig.patch +++ b/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch @@ -16,20 +16,20 @@ Signed-off-by: Thierry Vignaud Signed-off-by: Tim Landscheidt [javierm: don't check for rpmvercmp in librpm] Signed-off-by: Javier Martinez Canillas -[rharwood: commit message] +[rharwood: commit message, migrate to h2m] Signed-off-by: Robbie Harwood --- - configure.ac | 37 ++++++ - Makefile.util.def | 17 +++ - util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ - util/grub-mkconfig_lib.in | 11 +- - util/grub-rpm-sort.8 | 12 ++ - 5 files changed, 357 insertions(+), 1 deletion(-) + configure.ac | 36 ++++++ + Makefile.util.def | 17 +++ + util/grub-rpm-sort.c | 281 +++++++++++++++++++++++++++++++++++++++++++++ + docs/man/grub-rpm-sort.h2m | 2 + + util/grub-mkconfig_lib.in | 11 +- + 5 files changed, 346 insertions(+), 1 deletion(-) create mode 100644 util/grub-rpm-sort.c - create mode 100644 util/grub-rpm-sort.8 + create mode 100644 docs/man/grub-rpm-sort.h2m diff --git a/configure.ac b/configure.ac -index bec8535af70..643a13f9147 100644 +index 8331f95b6..87c8f1739 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -40,15 +40,7 @@ index bec8535af70..643a13f9147 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-sparc64-setup]) -@@ -95,6 +96,7 @@ grub_TRANSFORM([grub-mkrescue.1]) - grub_TRANSFORM([grub-mkstandalone.3]) - grub_TRANSFORM([grub-ofpathname.3]) - grub_TRANSFORM([grub-probe.3]) -+grub_TRANSFORM([grub-rpm-sort.8]) - grub_TRANSFORM([grub-reboot.3]) - grub_TRANSFORM([grub-render-label.3]) - grub_TRANSFORM([grub-script-check.3]) -@@ -1860,6 +1862,35 @@ fi +@@ -1837,6 +1838,35 @@ fi AC_SUBST([LIBDEVMAPPER]) @@ -84,7 +76,7 @@ index bec8535af70..643a13f9147 100644 LIBGEOM= if test x$host_kernel = xkfreebsd; then AC_CHECK_LIB([geom], [geom_gettree], [], -@@ -2047,6 +2078,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) +@@ -2024,6 +2054,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) @@ -92,7 +84,7 @@ index bec8535af70..643a13f9147 100644 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) if test x$FONT_SOURCE != x ; then HAVE_FONT_SOURCE=1 -@@ -2168,6 +2200,11 @@ echo grub-mount: Yes +@@ -2145,6 +2176,11 @@ echo grub-mount: Yes else echo grub-mount: No "($grub_mount_excuse)" fi @@ -105,7 +97,7 @@ index bec8535af70..643a13f9147 100644 echo starfield theme: Yes echo With DejaVuSans font from $DJVU_FONT_SOURCE diff --git a/Makefile.util.def b/Makefile.util.def -index 2c9b283a230..bc10cc79722 100644 +index 2c9b283a2..bc10cc797 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -703,6 +703,23 @@ program = { @@ -134,7 +126,7 @@ index 2c9b283a230..bc10cc79722 100644 common = util/grub-mkconfig.in; diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c new file mode 100644 -index 00000000000..f33bd1ed568 +index 000000000..f33bd1ed5 --- /dev/null +++ b/util/grub-rpm-sort.c @@ -0,0 +1,281 @@ @@ -419,8 +411,16 @@ index 00000000000..f33bd1ed568 + + return 0; +} +diff --git a/docs/man/grub-rpm-sort.h2m b/docs/man/grub-rpm-sort.h2m +new file mode 100644 +index 000000000..fe711ae10 +--- /dev/null ++++ b/docs/man/grub-rpm-sort.h2m +@@ -0,0 +1,2 @@ ++[NAME] ++grub-rpm-sort \- sort input according to RPM version compare diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 0f6505bf3b6..42c2ea9ba50 100644 +index 0f6505bf3..42c2ea9ba 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -33,6 +33,9 @@ fi @@ -455,21 +455,3 @@ index 0f6505bf3b6..42c2ea9ba50 100644 return 0 else return 1 -diff --git a/util/grub-rpm-sort.8 b/util/grub-rpm-sort.8 -new file mode 100644 -index 00000000000..8ce21488448 ---- /dev/null -+++ b/util/grub-rpm-sort.8 -@@ -0,0 +1,12 @@ -+.TH GRUB-RPM-SORT 8 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-rpm-sort\fR \(em Sort input according to RPM version compare. -+ -+.SH SYNOPSIS -+\fBgrub-rpm-sort\fR [OPTIONS]. -+ -+.SH DESCRIPTION -+You should not normally run this program directly. Use grub-mkconfig instead. -+ -+.SH SEE ALSO -+.BR "info grub" diff --git a/0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 98% rename from 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index 4eb37e1e..89a38795 100644 --- a/0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 5f6d3c8d52d..786dbabb4a8 100644 +index 5f6d3c8d5..786dbabb4 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -78,6 +78,32 @@ case x"$GRUB_FS" in diff --git a/0035-Add-friendly-grub2-password-config-tool-985962.patch b/0034-Add-friendly-grub2-password-config-tool-985962.patch similarity index 80% rename from 0035-Add-friendly-grub2-password-config-tool-985962.patch rename to 0034-Add-friendly-grub2-password-config-tool-985962.patch index 2d6f18a6..40f9738e 100644 --- a/0035-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0034-Add-friendly-grub2-password-config-tool-985962.patch @@ -13,21 +13,23 @@ Signed-off-by: Robert Marshall [pjones: fix the efidir in grub-setpassword and rename tool] Signed-off-by: Peter Jones [luto: fix grub-setpassword -o's output path] -Andy Lutomirski +Signed-off-by: Andy Lutomirski +[rharwood: migrate man page to h2m] +Signed-off-by: Robbie Harwood --- - configure.ac | 1 + - Makefile.util.def | 13 +++++ - util/grub-mkconfig.in | 2 + - util/grub-set-password.8 | 28 ++++++++++ - util/grub-set-password.in | 128 ++++++++++++++++++++++++++++++++++++++++++++++ - util/grub.d/01_users.in | 11 ++++ - 6 files changed, 183 insertions(+) - create mode 100644 util/grub-set-password.8 + configure.ac | 1 + + Makefile.util.def | 13 +++++ + docs/man/grub-set-password.h2m | 2 + + util/grub-mkconfig.in | 2 + + util/grub-set-password.in | 128 +++++++++++++++++++++++++++++++++++++++++ + util/grub.d/01_users.in | 11 ++++ + 6 files changed, 157 insertions(+) + create mode 100644 docs/man/grub-set-password.h2m create mode 100644 util/grub-set-password.in create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index 643a13f9147..25e1abb59b9 100644 +index 87c8f1739..916bede6b 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -39,7 +41,7 @@ index 643a13f9147..25e1abb59b9 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) diff --git a/Makefile.util.def b/Makefile.util.def -index bc10cc79722..8ca4c14f0b9 100644 +index bc10cc797..8ca4c14f0 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -452,6 +452,12 @@ script = { @@ -69,8 +71,16 @@ index bc10cc79722..8ca4c14f0b9 100644 script = { name = grub-mkconfig_lib; common = util/grub-mkconfig_lib.in; +diff --git a/docs/man/grub-set-password.h2m b/docs/man/grub-set-password.h2m +new file mode 100644 +index 000000000..10ee82f4d +--- /dev/null ++++ b/docs/man/grub-set-password.h2m +@@ -0,0 +1,2 @@ ++[NAME] ++grub-set-password \- generate the user.cfg file containing the hashed grub bootloader password diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 8ea2315ebc2..ba14cf6261c 100644 +index 8ea2315eb..ba14cf626 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -276,6 +276,8 @@ for i in "${grub_mkconfig_dir}"/* ; do @@ -82,43 +92,9 @@ index 8ea2315ebc2..ba14cf6261c 100644 *) if grub_file_is_not_garbage "$i" && test -x "$i" ; then echo -diff --git a/util/grub-set-password.8 b/util/grub-set-password.8 -new file mode 100644 -index 00000000000..9646546e43d ---- /dev/null -+++ b/util/grub-set-password.8 -@@ -0,0 +1,28 @@ -+.TH GRUB-SET-PASSWORD 3 "Thu Jun 25 2015" -+.SH NAME -+\fBgrub-set-password\fR \(em Generate the user.cfg file containing the hashed grub bootloader password. -+ -+.SH SYNOPSIS -+\fBgrub-set-password\fR [OPTION] -+ -+.SH DESCRIPTION -+\fBgrub-set-password\fR outputs the user.cfg file which contains the hashed GRUB bootloader password. This utility only supports configurations where there is a single root user. -+ -+The file has the format: -+GRUB2_PASSWORD=<\fIhashed password\fR>. -+ -+.SH OPTIONS -+.TP -+-h, --help -+Display program usage and exit. -+.TP -+-v, --version -+Display the current version. -+.TP -+-o, --output=<\fIDIRECTORY\fR> -+Choose the file path to which user.cfg will be written. -+ -+.SH SEE ALSO -+.BR "info grub" -+ -+.BR "info grub2-mkpasswd-pbkdf2" diff --git a/util/grub-set-password.in b/util/grub-set-password.in new file mode 100644 -index 00000000000..5ebf50576d6 +index 000000000..5ebf50576 --- /dev/null +++ b/util/grub-set-password.in @@ -0,0 +1,128 @@ @@ -252,7 +228,7 @@ index 00000000000..5ebf50576d6 +fi diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in new file mode 100644 -index 00000000000..db2f44bfb78 +index 000000000..db2f44bfb --- /dev/null +++ b/util/grub.d/01_users.in @@ -0,0 +1,11 @@ diff --git a/0036-tcp-add-window-scaling-support.patch b/0035-tcp-add-window-scaling-support.patch similarity index 98% rename from 0036-tcp-add-window-scaling-support.patch rename to 0035-tcp-add-window-scaling-support.patch index 7d1996c8..e19ddf8a 100644 --- a/0036-tcp-add-window-scaling-support.patch +++ b/0035-tcp-add-window-scaling-support.patch @@ -17,7 +17,7 @@ Signed-off-by: Josef Bacik 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c -index e8ad34b84d4..7d4b822626d 100644 +index e8ad34b84..7d4b82262 100644 --- a/grub-core/net/tcp.c +++ b/grub-core/net/tcp.c @@ -106,6 +106,18 @@ struct tcphdr diff --git a/0037-efinet-and-bootp-add-support-for-dhcpv6.patch b/0036-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 98% rename from 0037-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0036-efinet-and-bootp-add-support-for-dhcpv6.patch index a9844b89..4daf9e5e 100644 --- a/0037-efinet-and-bootp-add-support-for-dhcpv6.patch +++ b/0036-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 6 files changed, 477 insertions(+), 14 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 6fb5627025d..e28fb6a09f9 100644 +index 6fb562702..e28fb6a09 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -902,6 +902,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), @@ -198,7 +198,7 @@ index 6fb5627025d..e28fb6a09f9 100644 grub_bootp_init (void) { diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 5388f952ba9..173fb63153c 100644 +index 5388f952b..173fb6315 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -18,11 +18,14 @@ @@ -307,7 +307,7 @@ index 5388f952ba9..173fb63153c 100644 } } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0ef148f4adc..22f2689aaeb 100644 +index 0ef148f4a..22f2689aa 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -960,6 +960,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa @@ -390,7 +390,7 @@ index 0ef148f4adc..22f2689aaeb 100644 grub_err_t grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter, diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 7f44b30f521..4ab2f5c7357 100644 +index 7f44b30f5..4ab2f5c73 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -358,18 +358,22 @@ tftp_open (struct grub_file *file, const char *filename) @@ -417,7 +417,7 @@ index 7f44b30f521..4ab2f5c7357 100644 return grub_errno; } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index f1a52210c0c..117469450d3 100644 +index f1a52210c..117469450 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -592,10 +592,16 @@ typedef void *grub_efi_handle_t; @@ -572,7 +572,7 @@ index f1a52210c0c..117469450d3 100644 typedef struct grub_efi_pxe diff --git a/include/grub/net.h b/include/grub/net.h -index 7ae4b6bd805..8a05ec4fe7a 100644 +index 7ae4b6bd8..8a05ec4fe 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -447,6 +447,51 @@ struct grub_net_bootp_packet diff --git a/0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 84% rename from 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index bf78c813..80948ce7 100644 --- a/0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -10,20 +10,21 @@ variables are then used by 10_linux to choose whether or not to create debug stanzas. Resolves: rhbz#1226325 +[rharwood: migrate man page to h2m] --- - configure.ac | 2 + + configure.ac | 1 + Makefile.util.def | 7 ++ + docs/man/grub-get-kernel-settings.h2m | 2 + util/bash-completion.d/grub-completion.bash.in | 22 +++++++ - util/grub-get-kernel-settings.3 | 20 ++++++ util/grub-get-kernel-settings.in | 88 ++++++++++++++++++++++++++ util/grub-mkconfig.in | 3 + util/grub.d/10_linux.in | 23 +++++-- - 7 files changed, 160 insertions(+), 5 deletions(-) - create mode 100644 util/grub-get-kernel-settings.3 + 7 files changed, 141 insertions(+), 5 deletions(-) + create mode 100644 docs/man/grub-get-kernel-settings.h2m create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 25e1abb59b9..58e57a745fa 100644 +index 916bede6b..4f1676967 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) @@ -34,16 +35,8 @@ index 25e1abb59b9..58e57a745fa 100644 grub_TRANSFORM([grub-glue-efi]) grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) -@@ -82,6 +83,7 @@ grub_TRANSFORM([grub-file]) - grub_TRANSFORM([grub-bios-setup.3]) - grub_TRANSFORM([grub-editenv.1]) - grub_TRANSFORM([grub-fstest.3]) -+grub_TRANSFORM([grub-get-kernel-settings.3]) - grub_TRANSFORM([grub-glue-efi.3]) - grub_TRANSFORM([grub-install.1]) - grub_TRANSFORM([grub-kbdcomp.3]) diff --git a/Makefile.util.def b/Makefile.util.def -index 8ca4c14f0b9..43a1c7453b1 100644 +index 8ca4c14f0..43a1c7453 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -733,6 +733,13 @@ script = { @@ -60,8 +53,16 @@ index 8ca4c14f0b9..43a1c7453b1 100644 script = { name = grub-set-default; common = util/grub-set-default.in; +diff --git a/docs/man/grub-get-kernel-settings.h2m b/docs/man/grub-get-kernel-settings.h2m +new file mode 100644 +index 000000000..b8051f01f +--- /dev/null ++++ b/docs/man/grub-get-kernel-settings.h2m +@@ -0,0 +1,2 @@ ++[NAME] ++grub-get-kernel-settings \- Evaluate the system's kernel installation settings for use while making a grub configuration file diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in -index 44bf135b9f8..5c4acd496d4 100644 +index 44bf135b9..5c4acd496 100644 --- a/util/bash-completion.d/grub-completion.bash.in +++ b/util/bash-completion.d/grub-completion.bash.in @@ -264,6 +264,28 @@ have ${__grub_sparc64_setup_program} && \ @@ -93,35 +94,9 @@ index 44bf135b9f8..5c4acd496d4 100644 # # grub-install # -diff --git a/util/grub-get-kernel-settings.3 b/util/grub-get-kernel-settings.3 -new file mode 100644 -index 00000000000..ba33330e28d ---- /dev/null -+++ b/util/grub-get-kernel-settings.3 -@@ -0,0 +1,20 @@ -+.TH GRUB-GET-KERNEL-SETTINGS 3 "Thu Jun 25 2015" -+.SH NAME -+\fBgrub-get-kernel-settings\fR \(em Evaluate the system's kernel installation settings for use while making a grub configuration file. -+ -+.SH SYNOPSIS -+\fBgrub-get-kernel-settings\fR [OPTION] -+ -+.SH DESCRIPTION -+\fBgrub-get-kernel-settings\fR reads the kernel installation settings on the host system, and emits a set of grub settings suitable for use when creating a grub configuration file. -+ -+.SH OPTIONS -+.TP -+-h, --help -+Display program usage and exit. -+.TP -+-v, --version -+Display the current version. -+ -+.SH SEE ALSO -+.BR "info grub" diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in new file mode 100644 -index 00000000000..7e87dfccc0e +index 000000000..7e87dfccc --- /dev/null +++ b/util/grub-get-kernel-settings.in @@ -0,0 +1,88 @@ @@ -214,7 +189,7 @@ index 00000000000..7e87dfccc0e + echo export GRUB_UPDATE_DEFAULT_KERNEL +fi diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index ba14cf6261c..005f093809b 100644 +index ba14cf626..005f09380 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@" @@ -235,7 +210,7 @@ index ba14cf6261c..005f093809b 100644 if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then GRUB_DISABLE_LINUX_UUID="true" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 786dbabb4a8..292e333324b 100644 +index 786dbabb4..292e33332 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -111,7 +111,8 @@ linux_entry () diff --git a/0039-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch similarity index 98% rename from 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch rename to 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch index ef992f5d..feec4a6c 100644 --- a/0039-bz1374141-fix-incorrect-mask-for-ppc64.patch +++ b/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch @@ -33,7 +33,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index ac4e62a95c9..3860b6f78d8 100644 +index ac4e62a95..3860b6f78 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -220,8 +220,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, diff --git a/0040-Make-grub_fatal-also-backtrace.patch b/0039-Make-grub_fatal-also-backtrace.patch similarity index 96% rename from 0040-Make-grub_fatal-also-backtrace.patch rename to 0039-Make-grub_fatal-also-backtrace.patch index 3534b05a..ec24049f 100644 --- a/0040-Make-grub_fatal-also-backtrace.patch +++ b/0039-Make-grub_fatal-also-backtrace.patch @@ -13,7 +13,7 @@ Subject: [PATCH] Make grub_fatal() also backtrace. create mode 100644 grub-core/lib/arm64/backtrace.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c15e91943b9..058c88ac3af 100644 +index c15e91943..058c88ac3 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -188,6 +188,9 @@ kernel = { @@ -27,7 +27,7 @@ index c15e91943b9..058c88ac3af 100644 i386_xen = kern/i386/dl.c; i386_xen_pvh = kern/i386/dl.c; diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 63b586d09cb..a3e215155bd 100644 +index 63b586d09..a3e215155 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -24,6 +24,7 @@ @@ -55,7 +55,7 @@ index 63b586d09cb..a3e215155bd 100644 #endif diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c new file mode 100644 -index 00000000000..1079b5380e1 +index 000000000..1079b5380 --- /dev/null +++ b/grub-core/lib/arm64/backtrace.c @@ -0,0 +1,62 @@ @@ -122,7 +122,7 @@ index 00000000000..1079b5380e1 +} + diff --git a/grub-core/lib/backtrace.c b/grub-core/lib/backtrace.c -index 825a8800e25..c0ad6ab8be1 100644 +index 825a8800e..c0ad6ab8b 100644 --- a/grub-core/lib/backtrace.c +++ b/grub-core/lib/backtrace.c @@ -29,6 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -142,7 +142,7 @@ index 825a8800e25..c0ad6ab8be1 100644 } diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c -index c3e03c7275c..c67273db3ae 100644 +index c3e03c727..c67273db3 100644 --- a/grub-core/lib/i386/backtrace.c +++ b/grub-core/lib/i386/backtrace.c @@ -15,11 +15,23 @@ diff --git a/0042-Make-our-info-pages-say-grub2-where-appropriate.patch b/0040-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 99% rename from 0042-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0040-Make-our-info-pages-say-grub2-where-appropriate.patch index be28efd5..eda8d45d 100644 --- a/0042-Make-our-info-pages-say-grub2-where-appropriate.patch +++ b/0040-Make-our-info-pages-say-grub2-where-appropriate.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 2 files changed, 171 insertions(+), 154 deletions(-) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 6c629a23e2d..19f708ee662 100644 +index 6c629a23e..19f708ee6 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1,7 +1,7 @@ @@ -35,7 +35,7 @@ index 6c629a23e2d..19f708ee662 100644 @setchapternewpage odd diff --git a/docs/grub.texi b/docs/grub.texi -index 69f08d289f9..0615d0ed97e 100644 +index 69f08d289..0615d0ed9 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1,7 +1,7 @@ diff --git a/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch b/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch deleted file mode 100644 index be584175..00000000 --- a/0041-Fix-up-some-man-pages-rpmdiff-noticed.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 23 Sep 2014 09:58:49 -0400 -Subject: [PATCH] Fix up some man pages rpmdiff noticed. - ---- - configure.ac | 2 ++ - util/grub-macbless.8 | 26 +++++++++++++++++++ - util/grub-mkimage.1 | 2 +- - util/grub-syslinux2cfg.1 | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 94 insertions(+), 1 deletion(-) - create mode 100644 util/grub-macbless.8 - create mode 100644 util/grub-syslinux2cfg.1 - -diff --git a/configure.ac b/configure.ac -index 58e57a745fa..a0030632220 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -87,6 +87,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3]) - grub_TRANSFORM([grub-glue-efi.3]) - grub_TRANSFORM([grub-install.1]) - grub_TRANSFORM([grub-kbdcomp.3]) -+grub_TRANSFORM([grub-macbless.8]) - grub_TRANSFORM([grub-menulst2cfg.1]) - grub_TRANSFORM([grub-mkconfig.1]) - grub_TRANSFORM([grub-mkfont.3]) -@@ -105,6 +106,7 @@ grub_TRANSFORM([grub-render-label.3]) - grub_TRANSFORM([grub-script-check.3]) - grub_TRANSFORM([grub-set-default.1]) - grub_TRANSFORM([grub-sparc64-setup.3]) -+grub_TRANSFORM([grub-syslinux2cfg.1]) - - # Optimization flag. Allow user to override. - if test "x$TARGET_CFLAGS" = x; then -diff --git a/util/grub-macbless.8 b/util/grub-macbless.8 -new file mode 100644 -index 00000000000..ae842f3a606 ---- /dev/null -+++ b/util/grub-macbless.8 -@@ -0,0 +1,26 @@ -+.TH GRUB-MACBLESS 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-macbless\fR \(em Mac-style bless utility for HFS or HFS+ -+ -+.SH SYNOPSIS -+\fBgrub-macbless\fR [-p | --ppc] [-v | --verbose] [-x | --x86] \fIFILE\fR -+ -+.SH DESCRIPTION -+\fBgrub-mkimage\fR blesses a file on an HFS or HFS+ file system, so that it -+can be used to boot a Mac. -+ -+.SH OPTIONS -+.TP -+--ppc -+Bless the file for use on PPC-based Macs. -+ -+.TP -+--verbose -+Print verbose messages. -+ -+.TP -+--x86 -+Bless the file for use on x86-based Macs. -+ -+.SH SEE ALSO -+.BR "info grub" -diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1 -index 4dea4f54597..0eaaafe505b 100644 ---- a/util/grub-mkimage.1 -+++ b/util/grub-mkimage.1 -@@ -17,7 +17,7 @@ - [-v | --verbose] \fIMODULES\fR - - .SH DESCRIPTION --\fBgrub-mkimage\fI builds a bootable image of GRUB. -+\fBgrub-mkimage\fR builds a bootable image of GRUB. - - .SH OPTIONS - .TP -diff --git a/util/grub-syslinux2cfg.1 b/util/grub-syslinux2cfg.1 -new file mode 100644 -index 00000000000..85309482718 ---- /dev/null -+++ b/util/grub-syslinux2cfg.1 -@@ -0,0 +1,65 @@ -+.TH GRUB-SYSLINUX2CFG 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-syslinux2cfg\fR \(em Transform a syslinux config file into a GRUB config. -+ -+.SH SYNOPSIS -+\fBgrub-syslinux2cfg\fR [-c | --cwd=\fRDIR\fI] [-r | --root=\fIDIR\fR] [-v | --verbose] -+.RE -+.RS 25 -+[-t | --target-root=\fIDIR\fR] [-T | --target-cwd=\fIDIR\fR] -+.RE -+.RS 25 -+[-o | --output=\fIFILE\fR] [[-i | --isolinux] | -+.RE -+.RS 46 -+ [-s | --syslinux] | -+.RE -+.RS 46 -+ [-p | --pxelinux]] \fIFILE\fR -+ -+.SH DESCRIPTION -+\fBgrub-syslinux2cfg\fR builds a GRUB configuration file out of an existing -+syslinux configuration file. -+ -+.SH OPTIONS -+.TP -+--cwd=\fIDIR\fR -+Set \fIDIR\fR as syslinux's working directory. The default is to use the -+parent directory of the input file. -+ -+.TP -+--root=\fIDIR\fR -+Set \fIDIR\fR as the root directory of the syslinux disk. The default value -+is "/". -+ -+.TP -+--verbose -+Print verbose messages. -+ -+.TP -+--target-root=\fIDIR\fR -+Root directory as it will be seen at runtime. The default value is "/". -+ -+.TP -+--target-cwd=\fIDIR\fR -+Working directory of syslinux as it will be seen at runtime. The default -+value is the parent directory of the input file. -+ -+.TP -+--output=\fIFILE\fR -+Write the new config file to \fIFILE\fR. The default value is standard output. -+ -+.TP -+--isolinux -+Assume that the input file is an isolinux configuration file. -+ -+.TP -+--pxelinux -+Assume that the input file is a pxelinux configuration file. -+ -+.TP -+--syslinux -+Assume that the input file is a syslinux configuration file. -+ -+.SH SEE ALSO -+.BR "info grub" diff --git a/0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 99% rename from 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch index 574d1173..56106615 100644 --- a/0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch +++ b/0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch @@ -20,7 +20,7 @@ Signed-off-by: Peter Jones 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 1b91c102f35..4b27bd20153 100644 +index 1b91c102f..4b27bd201 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then diff --git a/0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 99% rename from 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch index 68dfc1dc..bea6e328 100644 --- a/0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +++ b/0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch @@ -24,7 +24,7 @@ Signed-off-by: Jeff Mahoney 2 files changed, 533 insertions(+), 20 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 63203034dfc..f1fff7385b5 100644 +index 63203034d..f1fff7385 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -38,6 +38,9 @@ @@ -690,7 +690,7 @@ index 63203034dfc..f1fff7385b5 100644 + +// vim: si et sw=2: diff --git a/include/grub/btrfs.h b/include/grub/btrfs.h -index 9d93fb6c182..234ad976771 100644 +index 9d93fb6c1..234ad9767 100644 --- a/include/grub/btrfs.h +++ b/include/grub/btrfs.h @@ -29,6 +29,7 @@ enum diff --git a/0045-export-btrfs_subvol-and-btrfs_subvolid.patch b/0043-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 95% rename from 0045-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0043-export-btrfs_subvol-and-btrfs_subvolid.patch index d38a6b87..61d16996 100644 --- a/0045-export-btrfs_subvol-and-btrfs_subvolid.patch +++ b/0043-export-btrfs_subvol-and-btrfs_subvolid.patch @@ -12,7 +12,7 @@ Signed-off-by: Michael Chang 1 file changed, 2 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index f1fff7385b5..ad1b56b716d 100644 +index f1fff7385..ad1b56b71 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -2714,6 +2714,8 @@ GRUB_MOD_INIT (btrfs) diff --git a/0046-grub2-btrfs-03-follow_default.patch b/0044-grub2-btrfs-03-follow_default.patch similarity index 99% rename from 0046-grub2-btrfs-03-follow_default.patch rename to 0044-grub2-btrfs-03-follow_default.patch index ca203f4a..f9a935e2 100644 --- a/0046-grub2-btrfs-03-follow_default.patch +++ b/0044-grub2-btrfs-03-follow_default.patch @@ -10,7 +10,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 76 insertions(+), 31 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index ad1b56b716d..113c1f746c9 100644 +index ad1b56b71..113c1f746 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -1256,6 +1256,7 @@ grub_btrfs_mount (grub_device_t dev) diff --git a/0047-grub2-btrfs-04-grub2-install.patch b/0045-grub2-btrfs-04-grub2-install.patch similarity index 95% rename from 0047-grub2-btrfs-04-grub2-install.patch rename to 0045-grub2-btrfs-04-grub2-install.patch index 451f61d7..2ce64b1c 100644 --- a/0047-grub2-btrfs-04-grub2-install.patch +++ b/0045-grub2-btrfs-04-grub2-install.patch @@ -15,7 +15,7 @@ Signed-off-by: Robbie Harwood 6 files changed, 54 insertions(+), 2 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 001b818fe58..caf9b1ccd3f 100644 +index 001b818fe..caf9b1ccd 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_path) @@ -40,7 +40,7 @@ index 001b818fe58..caf9b1ccd3f 100644 else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) { diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index 7d6325138ce..46a881530c0 100644 +index 7d6325138..46a881530 100644 --- a/grub-core/osdep/unix/config.c +++ b/grub-core/osdep/unix/config.c @@ -82,6 +82,19 @@ grub_util_load_config (struct grub_util_config *cfg) @@ -75,7 +75,7 @@ index 7d6325138ce..46a881530c0 100644 argv[2] = script; argv[3] = '\0'; diff --git a/util/config.c b/util/config.c -index ebcdd8f5e22..f044a880a76 100644 +index ebcdd8f5e..f044a880a 100644 --- a/util/config.c +++ b/util/config.c @@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct grub_util_config *cfg, int simple) @@ -96,7 +96,7 @@ index ebcdd8f5e22..f044a880a76 100644 sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) { diff --git a/util/grub-install.c b/util/grub-install.c -index 0fbe7f78c6d..0f66f36d23a 100644 +index 0fbe7f78c..0f66f36d2 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -827,6 +827,8 @@ fill_core_services (const char *core_services) @@ -136,7 +136,7 @@ index 0fbe7f78c6d..0f66f36d23a 100644 char *install_drive = NULL; diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c -index 47a241a391b..5db7a9a7d97 100644 +index 47a241a39..5db7a9a7d 100644 --- a/util/grub-mkrelpath.c +++ b/util/grub-mkrelpath.c @@ -40,9 +40,12 @@ struct arguments @@ -163,7 +163,7 @@ index 47a241a391b..5db7a9a7d97 100644 if (state->arg_num == 0) arguments->pathname = xstrdup (arg); diff --git a/include/grub/emu/config.h b/include/grub/emu/config.h -index 875d5896ce1..c9a7e5f4ade 100644 +index 875d5896c..c9a7e5f4a 100644 --- a/include/grub/emu/config.h +++ b/include/grub/emu/config.h @@ -37,6 +37,7 @@ struct grub_util_config diff --git a/0048-grub2-btrfs-05-grub2-mkconfig.patch b/0046-grub2-btrfs-05-grub2-mkconfig.patch similarity index 95% rename from 0048-grub2-btrfs-05-grub2-mkconfig.patch rename to 0046-grub2-btrfs-05-grub2-mkconfig.patch index 5afd183c..08b5224f 100644 --- a/0048-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0046-grub2-btrfs-05-grub2-mkconfig.patch @@ -13,7 +13,7 @@ Signed-off-by: Michael Chang 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 005f093809b..535c0f02499 100644 +index 005f09380..535c0f024 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -252,7 +252,8 @@ export GRUB_DEFAULT \ @@ -27,7 +27,7 @@ index 005f093809b..535c0f02499 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 42c2ea9ba50..fafeac95061 100644 +index 42c2ea9ba..fafeac950 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -52,7 +52,11 @@ grub_warn () @@ -43,7 +43,7 @@ index 42c2ea9ba50..fafeac95061 100644 is_path_readable_by_grub () diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 858b526c925..de727e6ee6b 100644 +index 858b526c9..de727e6ee 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@" @@ -90,7 +90,7 @@ index 858b526c925..de727e6ee6b 100644 +EOF +fi diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 292e333324b..7bb3a211a7c 100644 +index 292e33332..7bb3a211a 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -66,10 +66,14 @@ fi @@ -109,7 +109,7 @@ index 292e333324b..7bb3a211a7c 100644 xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index ada20775a14..e9e73b815fb 100644 +index ada20775a..e9e73b815 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -73,10 +73,14 @@ fi diff --git a/0049-grub2-btrfs-06-subvol-mount.patch b/0047-grub2-btrfs-06-subvol-mount.patch similarity index 98% rename from 0049-grub2-btrfs-06-subvol-mount.patch rename to 0047-grub2-btrfs-06-subvol-mount.patch index 14117ab4..d36c966f 100644 --- a/0049-grub2-btrfs-06-subvol-mount.patch +++ b/0047-grub2-btrfs-06-subvol-mount.patch @@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood 4 files changed, 392 insertions(+), 5 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 113c1f746c9..d323746ecfa 100644 +index 113c1f746..d323746ec 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -41,6 +41,7 @@ @@ -279,7 +279,7 @@ index 113c1f746c9..d323746ecfa 100644 grub_cmd_btrfs_list_subvols, 0, "[-p|-n] [-o var] DEVICE", diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index caf9b1ccd3f..28790307e00 100644 +index caf9b1ccd..28790307e 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key @@ -462,7 +462,7 @@ index caf9b1ccd3f..28790307e00 100644 grub_make_system_path_relative_to_its_root_os (const char *path) { diff --git a/util/grub-install.c b/util/grub-install.c -index 0f66f36d23a..84ed6e88ecb 100644 +index 0f66f36d2..84ed6e88e 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1569,6 +1569,55 @@ main (int argc, char *argv[]) @@ -522,7 +522,7 @@ index 0f66f36d23a..84ed6e88ecb 100644 const char *core_name = NULL; diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h -index 73fa2d34abb..9c642ae3fe3 100644 +index 73fa2d34a..9c642ae3f 100644 --- a/include/grub/emu/getroot.h +++ b/include/grub/emu/getroot.h @@ -53,6 +53,11 @@ char ** diff --git a/0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 97% rename from 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch index b02ab53f..8e56f313 100644 --- a/0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +++ b/0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch @@ -10,7 +10,7 @@ Ref: bsc#953538 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index d323746ecfa..673ded03522 100644 +index d323746ec..673ded035 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -1260,11 +1260,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) diff --git a/0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 99% rename from 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch index b54b1960..49d8972a 100644 --- a/0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +++ b/0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch @@ -10,7 +10,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 238 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 673ded03522..2b21cbaa67e 100644 +index 673ded035..2b21cbaa6 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -2887,6 +2887,238 @@ out: diff --git a/0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 98% rename from 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch index bde70969..071fa4ef 100644 --- a/0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +++ b/0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 585fa6662b6..03f9a9d0118 100644 +index 585fa6662..03f9a9d01 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -24,6 +24,10 @@ diff --git a/0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch similarity index 98% rename from 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename to 0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch index ccdf2829..11c7c27e 100644 --- a/0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch +++ b/0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 07c4937898d..89ac84cc663 100644 +index 07c493789..89ac84cc6 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -65,7 +65,7 @@ grub_chainloader_unload (void) diff --git a/0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch similarity index 95% rename from 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename to 0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch index ef41fe1a..5afc0959 100644 --- a/0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +++ b/0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 89ac84cc663..ac8dfd40c61 100644 +index 89ac84cc6..ac8dfd40c 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -810,7 +810,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) @@ -26,7 +26,7 @@ index 89ac84cc663..ac8dfd40c61 100644 efi_status = grub_efi_free_pool (buffer); diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 117469450d3..99628801478 100644 +index 117469450..996288014 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -546,7 +546,16 @@ typedef grub_uint64_t grub_efi_uint64_t; diff --git a/0055-don-t-use-int-for-efi-status.patch b/0053-don-t-use-int-for-efi-status.patch similarity index 94% rename from 0055-don-t-use-int-for-efi-status.patch rename to 0053-don-t-use-int-for-efi-status.patch index 44d35554..808823e1 100644 --- a/0055-don-t-use-int-for-efi-status.patch +++ b/0053-don-t-use-int-for-efi-status.patch @@ -8,7 +8,7 @@ Subject: [PATCH] don't use int for efi status 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 05d8237a9b2..ae9885edb84 100644 +index 05d8237a9..ae9885edb 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -167,7 +167,7 @@ grub_reboot (void) diff --git a/0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 96% rename from 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch index 1014900c..ce03b0b5 100644 --- a/0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +++ b/0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch @@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes. 1 file changed, 2 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index b3753c9ca26..91933b85f2c 100644 +index b3753c9ca..91933b85f 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -54,6 +54,7 @@ grub_mod_fini (void) diff --git a/0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 96% rename from 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch index 890aa34c..974f5ebc 100644 --- a/0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +++ b/0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch @@ -16,7 +16,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index 84ed6e88ecb..a2bec7446cb 100644 +index 84ed6e88e..a2bec7446 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1190,18 +1190,8 @@ main (int argc, char *argv[]) diff --git a/0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 97% rename from 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch index 3fd779f7..b9902f23 100644 --- a/0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +++ b/0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 5 insertions(+) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index e9e73b815fb..c23b064be6c 100644 +index e9e73b815..c23b064be 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -153,6 +153,7 @@ linux_entry_xsm () diff --git a/0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch similarity index 99% rename from 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename to 0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch index acfb116d..06326961 100644 --- a/0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +++ b/0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch @@ -63,7 +63,7 @@ Signed-off-by: Peter Jones 1 file changed, 89 insertions(+), 20 deletions(-) diff --git a/grub-core/kern/i386/tsc_pmtimer.c b/grub-core/kern/i386/tsc_pmtimer.c -index c9c36169978..ca15c3aacd7 100644 +index c9c361699..ca15c3aac 100644 --- a/grub-core/kern/i386/tsc_pmtimer.c +++ b/grub-core/kern/i386/tsc_pmtimer.c @@ -28,40 +28,101 @@ diff --git a/0060-align-struct-efi_variable-better.patch b/0058-align-struct-efi_variable-better.patch similarity index 92% rename from 0060-align-struct-efi_variable-better.patch rename to 0058-align-struct-efi_variable-better.patch index ec26def5..bbadf711 100644 --- a/0060-align-struct-efi_variable-better.patch +++ b/0058-align-struct-efi_variable-better.patch @@ -9,7 +9,7 @@ Subject: [PATCH] align struct efi_variable better... 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h -index 36d2dedf47e..9d93ba88bac 100644 +index 36d2dedf4..9d93ba88b 100644 --- a/include/grub/efiemu/runtime.h +++ b/include/grub/efiemu/runtime.h @@ -33,5 +33,5 @@ struct efi_variable @@ -20,7 +20,7 @@ index 36d2dedf47e..9d93ba88bac 100644 +} GRUB_PACKED GRUB_ALIGNED(8); #endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */ diff --git a/include/grub/types.h b/include/grub/types.h -index 0a3ff159136..ba446d99040 100644 +index 0a3ff1591..ba446d990 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -29,6 +29,7 @@ diff --git a/0061-Add-BLS-support-to-grub-mkconfig.patch b/0059-Add-BLS-support-to-grub-mkconfig.patch similarity index 95% rename from 0061-Add-BLS-support-to-grub-mkconfig.patch rename to 0059-Add-BLS-support-to-grub-mkconfig.patch index 7211afba..ccdd403b 100644 --- a/0061-Add-BLS-support-to-grub-mkconfig.patch +++ b/0059-Add-BLS-support-to-grub-mkconfig.patch @@ -24,31 +24,16 @@ Signed-off-by: Peter Jones Signed-off-by: Javier Martinez Canillas [iwienand@redhat.com: skip machine ID check when updating entries] Signed-off-by: Ian Wienand -[rharwood: commit message composits] +[rharwood: commit message composits, drop man pages] Signed-off-by: Robbie Harwood --- - util/grub-mkconfig.8 | 4 + util/grub-mkconfig.in | 9 +- util/grub-mkconfig_lib.in | 22 ++++- util/grub.d/10_linux.in | 218 +++++++++++++++++++++++++++++++++++++++++++++- - 4 files changed, 247 insertions(+), 6 deletions(-) + 3 files changed, 243 insertions(+), 6 deletions(-) -diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8 -index a2d1f577b9b..434fa4deda4 100644 ---- a/util/grub-mkconfig.8 -+++ b/util/grub-mkconfig.8 -@@ -13,5 +13,9 @@ - \fB--output\fR=\fIFILE\fR - Write generated output to \fIFILE\fR. - -+.TP -+\fB--no-grubenv-update\fR -+Do not update variables in the grubenv file. -+ - .SH SEE ALSO - .BR "info grub" diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 535c0f02499..f55339a3f64 100644 +index 535c0f024..f55339a3f 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@" @@ -89,7 +74,7 @@ index 535c0f02499..f55339a3f64 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index fafeac95061..d8bb4069360 100644 +index fafeac950..d8bb40693 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -30,6 +30,9 @@ fi @@ -146,7 +131,7 @@ index fafeac95061..d8bb4069360 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 7bb3a211a7c..9fcd77cacc3 100644 +index 7bb3a211a..9fcd77cac 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -82,6 +82,218 @@ case x"$GRUB_FS" in diff --git a/0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 95% rename from 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch index 9ff4c8b8..c1cdd3cd 100644 --- a/0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +++ b/0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch @@ -12,7 +12,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index a3e215155bd..c60601b699d 100644 +index a3e215155..c60601b69 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -1201,7 +1201,7 @@ static void __attribute__ ((noreturn)) diff --git a/0063-Add-linux-and-initrd-commands-for-grub-emu.patch b/0061-Add-linux-and-initrd-commands-for-grub-emu.patch similarity index 97% rename from 0063-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0061-Add-linux-and-initrd-commands-for-grub-emu.patch index 2431a4d7..25838e74 100644 --- a/0063-Add-linux-and-initrd-commands-for-grub-emu.patch +++ b/0061-Add-linux-and-initrd-commands-for-grub-emu.patch @@ -21,7 +21,7 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/loader/emu/linux.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 058c88ac3af..5354f9613d3 100644 +index 058c88ac3..5354f9613 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1826,7 +1826,6 @@ module = { @@ -33,7 +33,7 @@ index 058c88ac3af..5354f9613d3 100644 efi = loader/efi/linux.c; }; diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 55ea5a11ccd..846fe9715ec 100644 +index 55ea5a11c..846fe9715 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -107,6 +107,7 @@ static struct argp_option options[] = { @@ -55,7 +55,7 @@ index 55ea5a11ccd..846fe9715ec 100644 case ARGP_KEY_ARG: { diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 0ff13bcaf8c..eeea092752d 100644 +index 0ff13bcaf..eeea09275 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -39,6 +39,7 @@ @@ -103,7 +103,7 @@ index 0ff13bcaf8c..eeea092752d 100644 +} diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c new file mode 100644 -index 00000000000..fda9e00d24c +index 000000000..fda9e00d2 --- /dev/null +++ b/grub-core/loader/emu/linux.c @@ -0,0 +1,172 @@ @@ -280,7 +280,7 @@ index 00000000000..fda9e00d24c + grub_unregister_command (cmd_initrd); +} diff --git a/include/grub/emu/exec.h b/include/grub/emu/exec.h -index d1073ef86af..1b61b4a2e5d 100644 +index d1073ef86..1b61b4a2e 100644 --- a/include/grub/emu/exec.h +++ b/include/grub/emu/exec.h @@ -23,6 +23,8 @@ @@ -302,7 +302,7 @@ index d1073ef86af..1b61b4a2e5d 100644 grub_util_exec_redirect (const char *const *argv, const char *stdin_file, const char *stdout_file); diff --git a/include/grub/emu/hostfile.h b/include/grub/emu/hostfile.h -index cfb1e2b5661..a61568e36e9 100644 +index cfb1e2b56..a61568e36 100644 --- a/include/grub/emu/hostfile.h +++ b/include/grub/emu/hostfile.h @@ -22,6 +22,7 @@ @@ -323,7 +323,7 @@ index cfb1e2b5661..a61568e36e9 100644 char * grub_util_path_concat (size_t n, ...); diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index ff9c48a6490..01056954b96 100644 +index ff9c48a64..01056954b 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -57,6 +57,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format ( @@ -337,7 +337,7 @@ index ff9c48a6490..01056954b96 100644 #ifdef HAVE_DEVICE_MAPPER diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index ee88e44e97a..80e7a83edf9 100644 +index ee88e44e9..80e7a83ed 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -307,6 +307,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h diff --git a/0064-Add-grub2-switch-to-blscfg.patch b/0062-Add-grub2-switch-to-blscfg.patch similarity index 85% rename from 0064-Add-grub2-switch-to-blscfg.patch rename to 0062-Add-grub2-switch-to-blscfg.patch index ccac3579..bc1ac3f3 100644 --- a/0064-Add-grub2-switch-to-blscfg.patch +++ b/0062-Add-grub2-switch-to-blscfg.patch @@ -7,20 +7,20 @@ Signed-off-by: Peter Jones Signed-off-by: Javier Martinez Canillas [jhlavac: Use ${etcdefaultgrub} instead of /etc/default/grub] Signed-off-by: Jan Hlavac -[rharwood: skip on ostree installations] +[rharwood: skip on ostree installations, migrate man to h2m] Signed-off-by: Robbie Harwood --- - Makefile.util.def | 7 + - util/grub-set-password.in | 2 +- - util/grub-switch-to-blscfg.8 | 33 +++++ - util/grub-switch-to-blscfg.in | 317 ++++++++++++++++++++++++++++++++++++++++++ - util/grub.d/10_linux.in | 2 +- - 5 files changed, 359 insertions(+), 2 deletions(-) - create mode 100644 util/grub-switch-to-blscfg.8 + Makefile.util.def | 7 + + docs/man/grub-switch-to-blscfg.h2m | 2 + + util/grub-set-password.in | 2 +- + util/grub-switch-to-blscfg.in | 317 +++++++++++++++++++++++++++++++++++++ + util/grub.d/10_linux.in | 2 +- + 5 files changed, 328 insertions(+), 2 deletions(-) + create mode 100644 docs/man/grub-switch-to-blscfg.h2m create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index 43a1c7453b1..a90879fa9ba 100644 +index 43a1c7453..a90879fa9 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1365,6 +1365,13 @@ program = { @@ -37,8 +37,16 @@ index 43a1c7453b1..a90879fa9ba 100644 program = { name = grub-glue-efi; mansection = 1; +diff --git a/docs/man/grub-switch-to-blscfg.h2m b/docs/man/grub-switch-to-blscfg.h2m +new file mode 100644 +index 000000000..fa341426a +--- /dev/null ++++ b/docs/man/grub-switch-to-blscfg.h2m +@@ -0,0 +1,2 @@ ++[NAME] ++grub-switch-to-blscfg \- switch to using BLS config files diff --git a/util/grub-set-password.in b/util/grub-set-password.in -index 5ebf50576d6..c0b5ebbfdc5 100644 +index 5ebf50576..c0b5ebbfd 100644 --- a/util/grub-set-password.in +++ b/util/grub-set-password.in @@ -1,6 +1,6 @@ @@ -49,48 +57,9 @@ index 5ebf50576d6..c0b5ebbfdc5 100644 if [ -d /sys/firmware/efi/efivars/ ]; then grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'` else -diff --git a/util/grub-switch-to-blscfg.8 b/util/grub-switch-to-blscfg.8 -new file mode 100644 -index 00000000000..9a886282976 ---- /dev/null -+++ b/util/grub-switch-to-blscfg.8 -@@ -0,0 +1,33 @@ -+.TH GRUB-SWITCH-TO-BLSCFG 1 "Wed Feb 26 2014" -+.SH NAME -+\fBgrub-switch-to-blscfg\fR \(em Switch to using BLS config files. -+ -+.SH SYNOPSIS -+\fBgrub-switch-to-blscfg\fR [--grub-directory=\fIDIR\fR] [--config-file=\fIFILE\fR] [--grub-defaults=\fIFILE\fR] -+ -+.SH DESCRIPTION -+\fBgrub-switch-to-blscfg\fR reconfigures grub-mkconfig to use BLS-style config files, and then regenerates the GRUB configuration. -+ -+.SH OPTIONS -+.TP -+--grub-directory=\fIDIR\fR -+Search for grub.cfg under \fIDIR\fR. The default value is \fI/boot/efi/EFI/\fBVENDOR\fR on UEFI machines and \fI/boot/grub2\fR elsewhere. -+ -+.TP -+--config-file=\fIFILE\fR -+The grub config file to use. The default value is \fI/etc/grub2-efi.cfg\fR on UEFI machines and \fI/etc/grub2.cfg\fR elsewhere. Symbolic links will be followed. -+ -+.TP -+--grub-defaults=\fIFILE\fR -+The defaults file for grub-mkconfig. The default value is \fI/etc/default/grub\fR. -+ -+.TP -+--bls-directory=\fIDIR\fR -+Create BootLoaderSpec fragments in \fIDIR\fR. The default value is \fI/boot/loader/entries\fR. -+ -+.TP -+--backup-suffix=\fSUFFIX\fR -+The suffix to use for saved backup files. The default value is \fI.bak\fR. -+ -+.SH SEE ALSO -+.BR "info grub" diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in new file mode 100644 -index 00000000000..a851424beb2 +index 000000000..a851424be --- /dev/null +++ b/util/grub-switch-to-blscfg.in @@ -0,0 +1,317 @@ @@ -412,7 +381,7 @@ index 00000000000..a851424beb2 +# Bye. +exit 0 diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 9fcd77cacc3..81f35a2f3f0 100644 +index 9fcd77cac..70d56518b 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -138,7 +138,7 @@ blsdir="/boot/loader/entries" diff --git a/0065-make-better-backtraces.patch b/0063-make-better-backtraces.patch similarity index 96% rename from 0065-make-better-backtraces.patch rename to 0063-make-better-backtraces.patch index 63765671..06a0a459 100644 --- a/0065-make-better-backtraces.patch +++ b/0063-make-better-backtraces.patch @@ -38,7 +38,7 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index a90879fa9ba..48512bc6311 100644 +index a90879fa9..48512bc63 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -51,6 +51,12 @@ library = { @@ -55,7 +55,7 @@ index a90879fa9ba..48512bc6311 100644 library = { diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 5354f9613d3..4b7c45a7b06 100644 +index 5354f9613..4b7c45a7b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -142,6 +142,12 @@ kernel = { @@ -103,7 +103,7 @@ diff --git a/grub-core/lib/backtrace.c b/grub-core/commands/backtrace.c similarity index 98% rename from grub-core/lib/backtrace.c rename to grub-core/commands/backtrace.c -index c0ad6ab8be1..8b5ec3913b5 100644 +index c0ad6ab8b..8b5ec3913 100644 --- a/grub-core/lib/backtrace.c +++ b/grub-core/commands/backtrace.c @@ -54,7 +54,7 @@ grub_cmd_backtrace (grub_command_t cmd __attribute__ ((unused)), @@ -116,7 +116,7 @@ index c0ad6ab8be1..8b5ec3913b5 100644 } diff --git a/grub-core/gdb/cstub.c b/grub-core/gdb/cstub.c -index b64acd70fee..99281472d36 100644 +index b64acd70f..99281472d 100644 --- a/grub-core/gdb/cstub.c +++ b/grub-core/gdb/cstub.c @@ -215,7 +215,6 @@ grub_gdb_trap (int trap_no) @@ -129,7 +129,7 @@ index b64acd70fee..99281472d36 100644 diff --git a/grub-core/kern/arm64/backtrace.c b/grub-core/kern/arm64/backtrace.c new file mode 100644 -index 00000000000..019c6fdfef2 +index 000000000..019c6fdfe --- /dev/null +++ b/grub-core/kern/arm64/backtrace.c @@ -0,0 +1,94 @@ @@ -229,7 +229,7 @@ index 00000000000..019c6fdfef2 +} diff --git a/grub-core/kern/backtrace.c b/grub-core/kern/backtrace.c new file mode 100644 -index 00000000000..4a82e865cc6 +index 000000000..4a82e865c --- /dev/null +++ b/grub-core/kern/backtrace.c @@ -0,0 +1,97 @@ @@ -331,7 +331,7 @@ index 00000000000..4a82e865cc6 + grub_backtrace (skip + 1); +} diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 7afb9e6f724..88d2077709e 100644 +index 7afb9e6f7..88d207770 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name) @@ -395,7 +395,7 @@ index 7afb9e6f724..88d2077709e 100644 i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) diff --git a/grub-core/kern/i386/backtrace.c b/grub-core/kern/i386/backtrace.c new file mode 100644 -index 00000000000..2413f9a57db +index 000000000..2413f9a57 --- /dev/null +++ b/grub-core/kern/i386/backtrace.c @@ -0,0 +1,125 @@ @@ -525,7 +525,7 @@ index 00000000000..2413f9a57db +#endif +} diff --git a/grub-core/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c -index 27bc68b8a53..b51d0abfa6e 100644 +index 27bc68b8a..b51d0abfa 100644 --- a/grub-core/kern/i386/pc/init.c +++ b/grub-core/kern/i386/pc/init.c @@ -153,7 +153,7 @@ compact_mem_regions (void) @@ -547,7 +547,7 @@ index 27bc68b8a53..b51d0abfa6e 100644 /* Initialize the console as early as possible. */ grub_console_init (); diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 0cd2a627231..937c1bc44cb 100644 +index 0cd2a6272..937c1bc44 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -63,7 +63,6 @@ @@ -559,7 +559,7 @@ index 0cd2a627231..937c1bc44cb 100644 #ifdef __sparc__ diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index c60601b699d..a432a6be54a 100644 +index c60601b69..a432a6be5 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -1197,15 +1197,15 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) @@ -593,7 +593,7 @@ index c60601b699d..a432a6be54a 100644 grub_vprintf (_(fmt), ap); va_end (ap); diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index c070afc621f..d8c8377578b 100644 +index c070afc62..d8c837757 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c @@ -97,13 +97,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) @@ -615,7 +615,7 @@ index c070afc621f..d8c8377578b 100644 diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c deleted file mode 100644 -index 1079b5380e1..00000000000 +index 1079b5380..000000000 --- a/grub-core/lib/arm64/backtrace.c +++ /dev/null @@ -1,62 +0,0 @@ @@ -683,7 +683,7 @@ index 1079b5380e1..00000000000 - diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c deleted file mode 100644 -index c67273db3ae..00000000000 +index c67273db3..000000000 --- a/grub-core/lib/i386/backtrace.c +++ /dev/null @@ -1,78 +0,0 @@ @@ -766,7 +766,7 @@ index c67273db3ae..00000000000 -} - diff --git a/include/grub/backtrace.h b/include/grub/backtrace.h -index 395519762f0..275cf85e2d3 100644 +index 395519762..275cf85e2 100644 --- a/include/grub/backtrace.h +++ b/include/grub/backtrace.h @@ -19,8 +19,14 @@ @@ -787,7 +787,7 @@ index 395519762f0..275cf85e2d3 100644 #endif diff --git a/include/grub/dl.h b/include/grub/dl.h -index 91933b85f2c..2f76e6b0437 100644 +index 91933b85f..2f76e6b04 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -259,6 +259,8 @@ grub_dl_is_persistent (grub_dl_t mod) @@ -800,7 +800,7 @@ index 91933b85f2c..2f76e6b0437 100644 int isfunc, grub_dl_t mod); diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index abbca5ea335..300a9766cda 100644 +index abbca5ea3..300a9766c 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -111,6 +111,9 @@ grub_addr_t grub_modules_get_end (void); @@ -814,7 +814,7 @@ index abbca5ea335..300a9766cda 100644 void grub_main (void) __attribute__ ((noreturn)); diff --git a/grub-core/kern/arm/efi/startup.S b/grub-core/kern/arm/efi/startup.S -index 9f8265315a9..f3bc41f9d0f 100644 +index 9f8265315..f3bc41f9d 100644 --- a/grub-core/kern/arm/efi/startup.S +++ b/grub-core/kern/arm/efi/startup.S @@ -23,6 +23,8 @@ @@ -827,7 +827,7 @@ index 9f8265315a9..f3bc41f9d0f 100644 /* * EFI_SYSTEM_TABLE and EFI_HANDLE are passed in r1/r0. diff --git a/grub-core/kern/arm/startup.S b/grub-core/kern/arm/startup.S -index 3946fe8e183..5679a1d00ad 100644 +index 3946fe8e1..5679a1d00 100644 --- a/grub-core/kern/arm/startup.S +++ b/grub-core/kern/arm/startup.S @@ -48,6 +48,8 @@ @@ -840,7 +840,7 @@ index 3946fe8e183..5679a1d00ad 100644 b codestart diff --git a/grub-core/kern/arm64/efi/startup.S b/grub-core/kern/arm64/efi/startup.S -index 666a7ee3c92..41676bdb2b8 100644 +index 666a7ee3c..41676bdb2 100644 --- a/grub-core/kern/arm64/efi/startup.S +++ b/grub-core/kern/arm64/efi/startup.S @@ -19,7 +19,9 @@ @@ -854,7 +854,7 @@ index 666a7ee3c92..41676bdb2b8 100644 /* * EFI_SYSTEM_TABLE and EFI_HANDLE are passed in x1/x0. diff --git a/grub-core/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S -index 0d89858d9b3..939f182fc74 100644 +index 0d89858d9..939f182fc 100644 --- a/grub-core/kern/i386/qemu/startup.S +++ b/grub-core/kern/i386/qemu/startup.S @@ -24,7 +24,8 @@ @@ -868,7 +868,7 @@ index 0d89858d9b3..939f182fc74 100644 jmp codestart diff --git a/grub-core/kern/ia64/efi/startup.S b/grub-core/kern/ia64/efi/startup.S -index d75c6d7cc74..8f2a593e529 100644 +index d75c6d7cc..8f2a593e5 100644 --- a/grub-core/kern/ia64/efi/startup.S +++ b/grub-core/kern/ia64/efi/startup.S @@ -24,8 +24,9 @@ @@ -883,7 +883,7 @@ index d75c6d7cc74..8f2a593e529 100644 alloc loc0=ar.pfs,2,4,0,0 mov loc1=rp diff --git a/grub-core/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S -index 03b916f0534..701bf63abcf 100644 +index 03b916f05..701bf63ab 100644 --- a/grub-core/kern/sparc64/ieee1275/crt0.S +++ b/grub-core/kern/sparc64/ieee1275/crt0.S @@ -22,7 +22,8 @@ @@ -897,7 +897,7 @@ index 03b916f0534..701bf63abcf 100644 ba codestart mov %o4, %o0 diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 80e7a83edf9..f512573c0da 100644 +index 80e7a83ed..f512573c0 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h diff --git a/0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 95% rename from 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch index 9ebfc7ae..d872cb81 100644 --- a/0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +++ b/0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch @@ -8,7 +8,7 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set 1 file changed, 3 insertions(+) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index d5df4f815b0..1970e4816a8 100644 +index d5df4f815..1970e4816 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -430,6 +430,9 @@ grub_normal_reader_init (int nested) diff --git a/0067-Work-around-some-minor-include-path-weirdnesses.patch b/0065-Work-around-some-minor-include-path-weirdnesses.patch similarity index 97% rename from 0067-Work-around-some-minor-include-path-weirdnesses.patch rename to 0065-Work-around-some-minor-include-path-weirdnesses.patch index 460d7927..589f3350 100644 --- a/0067-Work-around-some-minor-include-path-weirdnesses.patch +++ b/0065-Work-around-some-minor-include-path-weirdnesses.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Jones diff --git a/include/grub/arm/efi/console.h b/include/grub/arm/efi/console.h new file mode 100644 -index 00000000000..1592f6f76b5 +index 000000000..1592f6f76 --- /dev/null +++ b/include/grub/arm/efi/console.h @@ -0,0 +1,24 @@ @@ -47,7 +47,7 @@ index 00000000000..1592f6f76b5 +#endif /* ! GRUB_ARM_EFI_CONSOLE_H */ diff --git a/include/grub/arm64/efi/console.h b/include/grub/arm64/efi/console.h new file mode 100644 -index 00000000000..95689339384 +index 000000000..956893393 --- /dev/null +++ b/include/grub/arm64/efi/console.h @@ -0,0 +1,24 @@ @@ -77,7 +77,7 @@ index 00000000000..95689339384 +#endif /* ! GRUB_ARM64_EFI_CONSOLE_H */ diff --git a/include/grub/i386/efi/console.h b/include/grub/i386/efi/console.h new file mode 100644 -index 00000000000..9231375cb07 +index 000000000..9231375cb --- /dev/null +++ b/include/grub/i386/efi/console.h @@ -0,0 +1,24 @@ @@ -107,7 +107,7 @@ index 00000000000..9231375cb07 +#endif /* ! GRUB_I386_EFI_CONSOLE_H */ diff --git a/include/grub/x86_64/efi/console.h b/include/grub/x86_64/efi/console.h new file mode 100644 -index 00000000000..dba9d8678d0 +index 000000000..dba9d8678 --- /dev/null +++ b/include/grub/x86_64/efi/console.h @@ -0,0 +1,24 @@ diff --git a/0068-Make-it-possible-to-enabled-build-id-sha1.patch b/0066-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 93% rename from 0068-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0066-Make-it-possible-to-enabled-build-id-sha1.patch index f68fc58b..5088c89a 100644 --- a/0068-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0066-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index a0030632220..b50fb2e9897 100644 +index 4f1676967..b809c0078 100644 --- a/configure.ac +++ b/configure.ac -@@ -1470,7 +1470,15 @@ grub_PROG_TARGET_CC +@@ -1443,7 +1443,15 @@ grub_PROG_TARGET_CC if test "x$TARGET_APPLE_LINKER" != x1 ; then grub_PROG_OBJCOPY_ABSOLUTE fi @@ -30,7 +30,7 @@ index a0030632220..b50fb2e9897 100644 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then if test ! -z "$TARGET_IMG_LDSCRIPT"; then diff --git a/acinclude.m4 b/acinclude.m4 -index 6e14bb553c6..21238fcfd03 100644 +index 6e14bb553..21238fcfd 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then diff --git a/0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 95% rename from 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch index a8a757e5..20f19c6f 100644 --- a/0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +++ b/0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 2 files changed, 20 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index a432a6be54a..9a2fae6398e 100644 +index a432a6be5..9a2fae639 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -191,6 +191,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, @@ -42,7 +42,7 @@ index a432a6be54a..9a2fae6398e 100644 int diff --git a/include/grub/misc.h b/include/grub/misc.h -index fd18e6320b8..3adc4036e3b 100644 +index fd18e6320..3adc4036e 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, diff --git a/0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 97% rename from 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch index 75de764a..91bc5576 100644 --- a/0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +++ b/0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -20,7 +20,7 @@ Signed-off-by: Peter Jones 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 88d2077709e..9557254035e 100644 +index 88d207770..955725403 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -501,6 +501,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) @@ -95,7 +95,7 @@ index 88d2077709e..9557254035e 100644 { grub_dl_unload (mod); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index ae9885edb84..d6a2fb57789 100644 +index ae9885edb..d6a2fb577 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -296,7 +296,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -117,7 +117,7 @@ index ae9885edb84..d6a2fb57789 100644 } diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 6d39bd3ad29..2d12e6188fd 100644 +index 6d39bd3ad..2d12e6188 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -115,10 +115,33 @@ grub_efi_env_init (void) @@ -164,7 +164,7 @@ index 6d39bd3ad29..2d12e6188fd 100644 } diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 03f9a9d0118..2e0691454b1 100644 +index 03f9a9d01..2e0691454 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -138,7 +138,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); diff --git a/0069-Fixup-for-newer-compiler.patch b/0069-Fixup-for-newer-compiler.patch new file mode 100644 index 00000000..aff1662b --- /dev/null +++ b/0069-Fixup-for-newer-compiler.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 10 May 2018 13:40:19 -0400 +Subject: [PATCH] Fixup for newer compiler + +--- + grub-core/fs/btrfs.c | 2 +- + include/grub/gpt_partition.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 2b21cbaa6..4cc86e9b7 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -218,7 +218,7 @@ struct grub_btrfs_inode + grub_uint64_t size; + grub_uint8_t dummy2[0x70]; + struct grub_btrfs_time mtime; +-} GRUB_PACKED; ++} GRUB_PACKED __attribute__ ((aligned(8))); + + struct grub_btrfs_extent_data + { +diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h +index 7a93f4329..8212697bf 100644 +--- a/include/grub/gpt_partition.h ++++ b/include/grub/gpt_partition.h +@@ -76,7 +76,7 @@ struct grub_gpt_partentry + grub_uint64_t end; + grub_uint64_t attrib; + char name[72]; +-} GRUB_PACKED; ++} GRUB_PACKED __attribute__ ((aligned(8))); + + grub_err_t + grub_gpt_partition_map_iterate (grub_disk_t disk, diff --git a/0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 97% rename from 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch index 0e925eef..6d85ecc0 100644 --- a/0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +++ b/0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+) diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index 300a9766cda..55849777eaa 100644 +index 300a9766c..55849777e 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -111,8 +111,10 @@ grub_addr_t grub_modules_get_end (void); diff --git a/0071-Fixup-for-newer-compiler.patch b/0071-Fixup-for-newer-compiler.patch index 12dd193e..f3844043 100644 --- a/0071-Fixup-for-newer-compiler.patch +++ b/0071-Fixup-for-newer-compiler.patch @@ -4,33 +4,19 @@ Date: Thu, 10 May 2018 13:40:19 -0400 Subject: [PATCH] Fixup for newer compiler --- - grub-core/fs/btrfs.c | 2 +- - include/grub/gpt_partition.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) + conf/Makefile.common | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 2b21cbaa67e..4cc86e9b79e 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -218,7 +218,7 @@ struct grub_btrfs_inode - grub_uint64_t size; - grub_uint8_t dummy2[0x70]; - struct grub_btrfs_time mtime; --} GRUB_PACKED; -+} GRUB_PACKED __attribute__ ((aligned(8))); +diff --git a/conf/Makefile.common b/conf/Makefile.common +index 191b1a70c..5f0ef9698 100644 +--- a/conf/Makefile.common ++++ b/conf/Makefile.common +@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding + LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) + CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 + CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) +-STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx ++STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes - struct grub_btrfs_extent_data - { -diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h -index 7a93f43291c..8212697bf6b 100644 ---- a/include/grub/gpt_partition.h -+++ b/include/grub/gpt_partition.h -@@ -76,7 +76,7 @@ struct grub_gpt_partentry - grub_uint64_t end; - grub_uint64_t attrib; - char name[72]; --} GRUB_PACKED; -+} GRUB_PACKED __attribute__ ((aligned(8))); - - grub_err_t - grub_gpt_partition_map_iterate (grub_disk_t disk, + CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding + LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d diff --git a/0074-Add-support-for-non-Ethernet-network-cards.patch b/0072-Add-support-for-non-Ethernet-network-cards.patch similarity index 98% rename from 0074-Add-support-for-non-Ethernet-network-cards.patch rename to 0072-Add-support-for-non-Ethernet-network-cards.patch index 02fb951f..e161fa04 100644 --- a/0074-Add-support-for-non-Ethernet-network-cards.patch +++ b/0072-Add-support-for-non-Ethernet-network-cards.patch @@ -38,7 +38,7 @@ Signed-off-by: Mark Salter 12 files changed, 219 insertions(+), 152 deletions(-) diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index 54306e3b16d..67b409a8acc 100644 +index 54306e3b1..67b409a8a 100644 --- a/grub-core/net/arp.c +++ b/grub-core/net/arp.c @@ -31,22 +31,12 @@ enum @@ -271,7 +271,7 @@ index 54306e3b16d..67b409a8acc 100644 /* Change operation to REPLY and send packet */ send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index e28fb6a09f9..08b6b2b5d6c 100644 +index e28fb6a09..08b6b2b5d 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -233,7 +233,6 @@ grub_net_configure_by_dhcp_ack (const char *name, @@ -318,7 +318,7 @@ index e28fb6a09f9..08b6b2b5d6c 100644 grub_netbuff_push (nb, sizeof (*udph)); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 173fb63153c..a673bea807a 100644 +index 173fb6315..a673bea80 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -279,6 +279,9 @@ grub_efinet_findcards (void) @@ -346,7 +346,7 @@ index 173fb63153c..a673bea807a 100644 card->efi_handle = *handle; diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c -index b194920861f..5b6c5e16a6d 100644 +index b19492086..5b6c5e16a 100644 --- a/grub-core/net/drivers/emu/emunet.c +++ b/grub-core/net/drivers/emu/emunet.c @@ -46,6 +46,7 @@ static struct grub_net_card emucard = @@ -358,7 +358,7 @@ index b194920861f..5b6c5e16a6d 100644 }, .flags = 0 diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c -index 3f4152d036c..9f8fb4b6d2b 100644 +index 3f4152d03..9f8fb4b6d 100644 --- a/grub-core/net/drivers/i386/pc/pxe.c +++ b/grub-core/net/drivers/i386/pc/pxe.c @@ -386,20 +386,21 @@ GRUB_MOD_INIT(pxe) @@ -390,7 +390,7 @@ index 3f4152d036c..9f8fb4b6d2b 100644 grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index 3860b6f78d8..bcb3f9ea02d 100644 +index 3860b6f78..bcb3f9ea0 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -160,6 +160,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, @@ -410,7 +410,7 @@ index 3860b6f78d8..bcb3f9ea02d 100644 card->txbufsize = ALIGN_UP (card->mtu, 64) + 256; diff --git a/grub-core/net/drivers/uboot/ubootnet.c b/grub-core/net/drivers/uboot/ubootnet.c -index 056052e40d5..22ebcbf211e 100644 +index 056052e40..22ebcbf21 100644 --- a/grub-core/net/drivers/uboot/ubootnet.c +++ b/grub-core/net/drivers/uboot/ubootnet.c @@ -131,6 +131,7 @@ GRUB_MOD_INIT (ubootnet) @@ -422,7 +422,7 @@ index 056052e40d5..22ebcbf211e 100644 card->txbufsize = ALIGN_UP (card->mtu, 64) + 256; card->txbuf = grub_zalloc (card->txbufsize); diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c -index 4d7ceed6f93..9aae83a5eb4 100644 +index 4d7ceed6f..9aae83a5e 100644 --- a/grub-core/net/ethernet.c +++ b/grub-core/net/ethernet.c @@ -29,13 +29,6 @@ @@ -572,7 +572,7 @@ index 4d7ceed6f93..9aae83a5eb4 100644 { /* ARP packet. */ diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c -index 2cbd95dce25..56a3ec5c8e8 100644 +index 2cbd95dce..56a3ec5c8 100644 --- a/grub-core/net/icmp6.c +++ b/grub-core/net/icmp6.c @@ -231,8 +231,9 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb, @@ -612,7 +612,7 @@ index 2cbd95dce25..56a3ec5c8e8 100644 } if (ohdr->type == OPTION_PREFIX && ohdr->len == 4) diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index ea5edf8f1f6..a5896f6dc26 100644 +index ea5edf8f1..a5896f6dc 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c @@ -276,8 +276,8 @@ handle_dgram (struct grub_net_buff *nb, @@ -627,7 +627,7 @@ index ea5edf8f1f6..a5896f6dc26 100644 grub_net_process_dhcp (nb, inf); grub_netbuff_free (nb); diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 22f2689aaeb..a46f82362ed 100644 +index 22f2689aa..a46f82362 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -133,8 +133,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, @@ -713,7 +713,7 @@ index 22f2689aaeb..a46f82362ed 100644 int diff --git a/include/grub/net.h b/include/grub/net.h -index 8a05ec4fe7a..af0404db7e3 100644 +index 8a05ec4fe..af0404db7 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -29,7 +29,8 @@ diff --git a/0073-Fixup-for-newer-compiler.patch b/0073-Fixup-for-newer-compiler.patch deleted file mode 100644 index 11ed6e52..00000000 --- a/0073-Fixup-for-newer-compiler.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 10 May 2018 13:40:19 -0400 -Subject: [PATCH] Fixup for newer compiler - ---- - conf/Makefile.common | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/conf/Makefile.common b/conf/Makefile.common -index 191b1a70c6b..5f0ef969857 100644 ---- a/conf/Makefile.common -+++ b/conf/Makefile.common -@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding - LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) - CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 - CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) --STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -+STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes - - CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding - LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d diff --git a/0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 98% rename from 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch index 834b96e2..997c189d 100644 --- a/0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +++ b/0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch @@ -18,7 +18,7 @@ Signed-off-by: Peter Jones 4 files changed, 109 insertions(+), 12 deletions(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index b616cf40b1e..12a2632ea55 100644 +index b616cf40b..12a2632ea 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -289,7 +289,9 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)), @@ -87,7 +87,7 @@ index b616cf40b1e..12a2632ea55 100644 file); if (!data->sock) diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index a46f82362ed..0ce5e675ed7 100644 +index a46f82362..0ce5e675e 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -444,6 +444,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) @@ -225,7 +225,7 @@ index a46f82362ed..0ce5e675ed7 100644 } diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 4ab2f5c7357..d54b13f09ff 100644 +index 4ab2f5c73..d54b13f09 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -295,6 +295,7 @@ tftp_open (struct grub_file *file, const char *filename) @@ -257,7 +257,7 @@ index 4ab2f5c7357..d54b13f09ff 100644 if (!data->sock) { diff --git a/include/grub/net.h b/include/grub/net.h -index af0404db7e3..d55d505a03a 100644 +index af0404db7..d55d505a0 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -273,6 +273,7 @@ typedef struct grub_net diff --git a/0076-bootp-New-net_bootp6-command.patch b/0074-bootp-New-net_bootp6-command.patch similarity index 99% rename from 0076-bootp-New-net_bootp6-command.patch rename to 0074-bootp-New-net_bootp6-command.patch index 21b3871b..83074098 100644 --- a/0076-bootp-New-net_bootp6-command.patch +++ b/0074-bootp-New-net_bootp6-command.patch @@ -19,7 +19,7 @@ Signed-off-by: Peter Jones 5 files changed, 1002 insertions(+), 209 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 08b6b2b5d6c..fe93b80f1cf 100644 +index 08b6b2b5d..fe93b80f1 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -24,6 +24,98 @@ @@ -1136,7 +1136,7 @@ index 08b6b2b5d6c..fe93b80f1cf 100644 grub_unregister_command (cmd_bootp); grub_unregister_command (cmd_dhcp); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index a673bea807a..8e25680db0c 100644 +index a673bea80..8e25680db 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -393,9 +393,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, @@ -1174,7 +1174,7 @@ index a673bea807a..8e25680db0c 100644 } else diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index a5896f6dc26..ce6bdc75c6d 100644 +index a5896f6dc..ce6bdc75c 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c @@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb, @@ -1224,7 +1224,7 @@ index a5896f6dc26..ce6bdc75c6d 100644 { const struct grub_net_bootp_packet *bootp; diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 99628801478..7614b58dca8 100644 +index 996288014..7614b58dc 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1532,7 +1532,7 @@ typedef struct grub_efi_pxe_ip_filter @@ -1237,7 +1237,7 @@ index 99628801478..7614b58dca8 100644 } grub_efi_pxe_ip_filter_t; diff --git a/include/grub/net.h b/include/grub/net.h -index d55d505a03a..543251f7273 100644 +index d55d505a0..543251f72 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -451,50 +451,65 @@ struct grub_net_bootp_packet diff --git a/0077-efinet-UEFI-IPv6-PXE-support.patch b/0075-efinet-UEFI-IPv6-PXE-support.patch similarity index 98% rename from 0077-efinet-UEFI-IPv6-PXE-support.patch rename to 0075-efinet-UEFI-IPv6-PXE-support.patch index d8b22b8c..8f1dca69 100644 --- a/0077-efinet-UEFI-IPv6-PXE-support.patch +++ b/0075-efinet-UEFI-IPv6-PXE-support.patch @@ -15,7 +15,7 @@ Signed-off-by: Ken Lin 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 8e25680db0c..014e5bf9802 100644 +index 8e25680db..014e5bf98 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, @@ -28,7 +28,7 @@ index 8e25680db0c..014e5bf9802 100644 else { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 7614b58dca8..91ab528e4d0 100644 +index 7614b58dc..91ab528e4 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1524,31 +1524,6 @@ typedef union diff --git a/0078-grub.texi-Add-net_bootp6-doument.patch b/0076-grub.texi-Add-net_bootp6-doument.patch similarity index 97% rename from 0078-grub.texi-Add-net_bootp6-doument.patch rename to 0076-grub.texi-Add-net_bootp6-doument.patch index 3f8ec97a..d12f33e2 100644 --- a/0078-grub.texi-Add-net_bootp6-doument.patch +++ b/0076-grub.texi-Add-net_bootp6-doument.patch @@ -12,7 +12,7 @@ Signed-off-by: Ken Lin 1 file changed, 17 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 0615d0ed97e..04ed6ac1f07 100644 +index 0615d0ed9..04ed6ac1f 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -5487,6 +5487,7 @@ This command is only available on AArch64 systems. diff --git a/0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 98% rename from 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch index e800dd23..114f102e 100644 --- a/0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +++ b/0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch @@ -22,7 +22,7 @@ Signed-off-by: Ken Lin 2 files changed, 56 insertions(+) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index fe93b80f1cf..8fb8918ae7e 100644 +index fe93b80f1..8fb8918ae 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -20,6 +20,7 @@ @@ -95,7 +95,7 @@ index fe93b80f1cf..8fb8918ae7e 100644 if (opt && opt_len) grub_env_set_net_property (name, "extensionspath", (const char *) opt, opt_len); diff --git a/include/grub/net.h b/include/grub/net.h -index 543251f7273..42af7de250a 100644 +index 543251f72..42af7de25 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -531,6 +531,7 @@ enum diff --git a/0080-efinet-Setting-network-from-UEFI-device-path.patch b/0078-efinet-Setting-network-from-UEFI-device-path.patch similarity index 99% rename from 0080-efinet-Setting-network-from-UEFI-device-path.patch rename to 0078-efinet-Setting-network-from-UEFI-device-path.patch index 11b2a724..0aef614e 100644 --- a/0080-efinet-Setting-network-from-UEFI-device-path.patch +++ b/0078-efinet-Setting-network-from-UEFI-device-path.patch @@ -32,7 +32,7 @@ Signed-off-by: Ken Lin 2 files changed, 280 insertions(+), 15 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 014e5bf9802..8171ecaa5e4 100644 +index 014e5bf98..8171ecaa5 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -26,6 +26,7 @@ @@ -375,7 +375,7 @@ index 014e5bf9802..8171ecaa5e4 100644 } } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 91ab528e4d0..4a51667adb1 100644 +index 91ab528e4..4a51667ad 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -864,6 +864,8 @@ struct grub_efi_ipv4_device_path diff --git a/0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 99% rename from 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch index 1460c8a6..a539267d 100644 --- a/0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch +++ b/0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch @@ -33,7 +33,7 @@ Signed-off-by: Ken Lin 2 files changed, 238 insertions(+) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 8171ecaa5e4..715a6168d77 100644 +index 8171ecaa5..715a6168d 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -242,7 +242,7 @@ index 8171ecaa5e4..715a6168d77 100644 } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 4a51667adb1..0b490195ad9 100644 +index 4a51667ad..0b490195a 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -352,6 +352,15 @@ diff --git a/0082-Support-UEFI-networking-protocols.patch b/0080-Support-UEFI-networking-protocols.patch similarity index 99% rename from 0082-Support-UEFI-networking-protocols.patch rename to 0080-Support-UEFI-networking-protocols.patch index fb143862..ec8e1592 100644 --- a/0082-Support-UEFI-networking-protocols.patch +++ b/0080-Support-UEFI-networking-protocols.patch @@ -57,7 +57,7 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/net/efi.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 4b7c45a7b06..c40170f2dd2 100644 +index 4b7c45a7b..c40170f2d 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2299,6 +2299,12 @@ module = { @@ -87,7 +87,7 @@ index 4b7c45a7b06..c40170f2dd2 100644 module = { diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c -index a458c3aca78..1637731535e 100644 +index a458c3aca..163773153 100644 --- a/grub-core/io/bufio.c +++ b/grub-core/io/bufio.c @@ -139,7 +139,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len) @@ -100,7 +100,7 @@ index a458c3aca78..1637731535e 100644 if (file->offset + res < next_buf) { diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index d6a2fb57789..2a446f5031b 100644 +index d6a2fb577..2a446f503 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -755,7 +755,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) @@ -231,7 +231,7 @@ index d6a2fb57789..2a446f5031b 100644 grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype); break; diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 715a6168d77..e11d759f19a 100644 +index 715a6168d..e11d759f1 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -27,6 +27,7 @@ @@ -304,7 +304,7 @@ index 715a6168d77..e11d759f19a 100644 diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c new file mode 100644 -index 00000000000..dbef63d8c08 +index 000000000..dbef63d8c --- /dev/null +++ b/grub-core/net/efi/dhcp.c @@ -0,0 +1,397 @@ @@ -707,7 +707,7 @@ index 00000000000..dbef63d8c08 +grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6; diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c new file mode 100644 -index 00000000000..ef371d885ea +index 000000000..ef371d885 --- /dev/null +++ b/grub-core/net/efi/efi_netfs.c @@ -0,0 +1,57 @@ @@ -770,7 +770,7 @@ index 00000000000..ef371d885ea +} diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c new file mode 100644 -index 00000000000..3f61fd2fa5b +index 000000000..3f61fd2fa --- /dev/null +++ b/grub-core/net/efi/http.c @@ -0,0 +1,419 @@ @@ -1195,7 +1195,7 @@ index 00000000000..3f61fd2fa5b + }; diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c new file mode 100644 -index 00000000000..b711a5d9457 +index 000000000..b711a5d94 --- /dev/null +++ b/grub-core/net/efi/ip4_config.c @@ -0,0 +1,398 @@ @@ -1599,7 +1599,7 @@ index 00000000000..b711a5d9457 + }; diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c new file mode 100644 -index 00000000000..017c4d05bc7 +index 000000000..017c4d05b --- /dev/null +++ b/grub-core/net/efi/ip6_config.c @@ -0,0 +1,422 @@ @@ -2027,7 +2027,7 @@ index 00000000000..017c4d05bc7 + }; diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c new file mode 100644 -index 00000000000..86bce6535d3 +index 000000000..86bce6535 --- /dev/null +++ b/grub-core/net/efi/net.c @@ -0,0 +1,1428 @@ @@ -3461,7 +3461,7 @@ index 00000000000..86bce6535d3 +} diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c new file mode 100644 -index 00000000000..531949cba5c +index 000000000..531949cba --- /dev/null +++ b/grub-core/net/efi/pxe.c @@ -0,0 +1,424 @@ @@ -3890,7 +3890,7 @@ index 00000000000..531949cba5c + }; + diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0ce5e675ed7..55aed92722c 100644 +index 0ce5e675e..55aed9272 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -32,6 +32,9 @@ @@ -4000,7 +4000,7 @@ index 0ce5e675ed7..55aed92722c 100644 +#endif } diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c -index a2461cda1c4..77958dd9dd5 100644 +index a2461cda1..77958dd9d 100644 --- a/util/grub-mknetdir.c +++ b/util/grub-mknetdir.c @@ -32,13 +32,15 @@ @@ -4082,7 +4082,7 @@ index a2461cda1c4..77958dd9dd5 100644 if (!grub_install_source_directory) { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 0b490195ad9..f431f49973e 100644 +index 0b490195a..f431f4997 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -622,6 +622,23 @@ typedef union @@ -4333,7 +4333,7 @@ index 0b490195ad9..f431f49973e 100644 || defined(__riscv) diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h new file mode 100644 -index 00000000000..fdb88eb810e +index 000000000..fdb88eb81 --- /dev/null +++ b/include/grub/efi/dhcp.h @@ -0,0 +1,343 @@ @@ -4682,7 +4682,7 @@ index 00000000000..fdb88eb810e +#endif /* ! GRUB_EFI_DHCP_HEADER */ diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h new file mode 100644 -index 00000000000..c5e9a89f505 +index 000000000..c5e9a89f5 --- /dev/null +++ b/include/grub/efi/http.h @@ -0,0 +1,215 @@ @@ -4903,7 +4903,7 @@ index 00000000000..c5e9a89f505 +#endif /* !GRUB_EFI_HTTP_HEADER */ diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h new file mode 100644 -index 00000000000..de90d223e8e +index 000000000..de90d223e --- /dev/null +++ b/include/grub/net/efi.h @@ -0,0 +1,144 @@ diff --git a/0083-AUDIT-0-http-boot-tracker-bug.patch b/0081-AUDIT-0-http-boot-tracker-bug.patch similarity index 96% rename from 0083-AUDIT-0-http-boot-tracker-bug.patch rename to 0081-AUDIT-0-http-boot-tracker-bug.patch index ef3e67b7..d9a20a99 100644 --- a/0083-AUDIT-0-http-boot-tracker-bug.patch +++ b/0081-AUDIT-0-http-boot-tracker-bug.patch @@ -22,7 +22,7 @@ Signed-off-by: Michael Chang 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 86bce6535d3..4bb308026ce 100644 +index 86bce6535..4bb308026 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -645,8 +645,10 @@ grub_efihttp_chunk_read (grub_file_t file, char *buf, @@ -38,7 +38,7 @@ index 86bce6535d3..4bb308026ce 100644 if (buf) { diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 12a2632ea55..b52b558d631 100644 +index 12a2632ea..b52b558d6 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 98% rename from 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch index f8de42a3..b64dad25 100644 --- a/0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch +++ b/0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch @@ -17,7 +17,7 @@ Signed-off-by: Hans de Goede 1 file changed, 50 insertions(+) diff --git a/util/grub-editenv.c b/util/grub-editenv.c -index db6f187cc63..948eec8a114 100644 +index db6f187cc..948eec8a1 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -53,6 +53,9 @@ static struct argp_option options[] = { diff --git a/0085-Add-auto-hide-menu-support.patch b/0083-Add-auto-hide-menu-support.patch similarity index 93% rename from 0085-Add-auto-hide-menu-support.patch rename to 0083-Add-auto-hide-menu-support.patch index 863cd053..d0122552 100644 --- a/0085-Add-auto-hide-menu-support.patch +++ b/0083-Add-auto-hide-menu-support.patch @@ -35,12 +35,6 @@ fastboot If set to "1" and the conditions for auto-hiding the menu https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu/tree/debian/patches/quick_boot.patch Signed-off-by: Hans de Goede ---- -Changes in v2: --Drop shutdown_success tests, there is no meaningful way for systemd to set - this flag (by the time it knows all filesystems are unmounted or read-only --Drop fwsetup_once support, systemd already supports booting directly into - the fwsetup by doing "systemctl reboot --firmware" --- Makefile.util.def | 6 +++++ util/grub.d/01_menu_auto_hide.in | 48 ++++++++++++++++++++++++++++++++++++++++ @@ -49,7 +43,7 @@ Changes in v2: create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index 48512bc6311..314e6f2acf8 100644 +index 48512bc63..314e6f2ac 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { @@ -67,7 +61,7 @@ index 48512bc6311..314e6f2acf8 100644 common = util/grub.d/01_users.in; diff --git a/util/grub.d/01_menu_auto_hide.in b/util/grub.d/01_menu_auto_hide.in new file mode 100644 -index 00000000000..ad175870a54 +index 000000000..ad175870a --- /dev/null +++ b/util/grub.d/01_menu_auto_hide.in @@ -0,0 +1,48 @@ @@ -120,7 +114,7 @@ index 00000000000..ad175870a54 +fi +EOF diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 4b27bd20153..3c9431cfcfb 100644 +index 4b27bd201..3c9431cfc 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -42,6 +42,7 @@ if [ -z "${OSPROBED}" ] ; then diff --git a/0086-Add-grub-set-bootflag-utility.patch b/0084-Add-grub-set-bootflag-utility.patch similarity index 85% rename from 0086-Add-grub-set-bootflag-utility.patch rename to 0084-Add-grub-set-bootflag-utility.patch index e39f8beb..a0a6da9b 100644 --- a/0086-Add-grub-set-bootflag-utility.patch +++ b/0084-Add-grub-set-bootflag-utility.patch @@ -33,22 +33,23 @@ and a symlink to grub-boot-success.timer should be added to Signed-off-by: Hans de Goede [makhomed: grub-boot-success.timer: Only run if not in a container] Signed-off-by: Gena Makhomed +[rharwood: migrate to h2m] Signed-off-by: Robbie Harwood --- Makefile.util.def | 7 ++ - util/grub-set-bootflag.c | 160 +++++++++++++++++++++++++++++++++++++++++ + util/grub-set-bootflag.c | 172 +++++++++++++++++++++++++++++++++++++++++ conf/Makefile.extra-dist | 3 + docs/grub-boot-success.service | 6 ++ docs/grub-boot-success.timer | 7 ++ - util/grub-set-bootflag.1 | 20 ++++++ - 6 files changed, 203 insertions(+) + docs/man/grub-set-bootflag.h2m | 2 + + 6 files changed, 197 insertions(+) create mode 100644 util/grub-set-bootflag.c create mode 100644 docs/grub-boot-success.service create mode 100644 docs/grub-boot-success.timer - create mode 100644 util/grub-set-bootflag.1 + create mode 100644 docs/man/grub-set-bootflag.h2m diff --git a/Makefile.util.def b/Makefile.util.def -index 314e6f2acf8..0b85a7fce4a 100644 +index 314e6f2ac..0b85a7fce 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1446,3 +1446,10 @@ program = { @@ -64,10 +65,10 @@ index 314e6f2acf8..0b85a7fce4a 100644 +}; diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c new file mode 100644 -index 00000000000..bb198f02351 +index 000000000..d506f7e75 --- /dev/null +++ b/util/grub-set-bootflag.c -@@ -0,0 +1,160 @@ +@@ -0,0 +1,172 @@ +/* grub-set-bootflag.c - tool to set boot-flags in the grubenv. */ +/* + * GRUB -- GRand Unified Bootloader @@ -101,6 +102,8 @@ index 00000000000..bb198f02351 +#include +#include + ++#include "progname.h" ++ +#define GRUBENV "/" GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME "/" GRUB_ENVBLK_DEFCFG +#define GRUBENV_SIZE 1024 + @@ -110,13 +113,13 @@ index 00000000000..bb198f02351 + NULL +}; + -+static void usage(void) ++static void usage(FILE *out) +{ + int i; + -+ fprintf (stderr, "Usage: 'grub-set-bootflag ', where is one of:\n"); ++ fprintf (out, "Usage: 'grub-set-bootflag ', where is one of:\n"); + for (i = 0; bootflags[i]; i++) -+ fprintf (stderr, " %s\n", bootflags[i]); ++ fprintf (out, " %s\n", bootflags[i]); +} + +int main(int argc, char *argv[]) @@ -129,9 +132,19 @@ index 00000000000..bb198f02351 + + if (argc != 2) + { -+ usage(); ++ usage (stderr); + return 1; + } ++ else if (!strcmp (argv[1], "--help")) ++ { ++ usage (stdout); ++ return 0; ++ } ++ else if (!strcmp (argv[1], "--version")) ++ { ++ printf ("grub-set-bootflag (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); ++ return 0; ++ } + + for (i = 0; bootflags[i]; i++) + if (!strcmp (argv[1], bootflags[i])) @@ -139,7 +152,7 @@ index 00000000000..bb198f02351 + if (!bootflags[i]) + { + fprintf (stderr, "Invalid bootflag: '%s'\n", argv[1]); -+ usage(); ++ usage (stderr); + return 1; + } + @@ -229,10 +242,10 @@ index 00000000000..bb198f02351 + return 0; +} diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index b909f2c073a..ea58362b555 100644 +index 8f1485d52..ad235de7f 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist -@@ -14,6 +14,9 @@ EXTRA_DIST += util/import_unicode.py +@@ -15,6 +15,9 @@ EXTRA_DIST += docs/man EXTRA_DIST += docs/autoiso.cfg EXTRA_DIST += docs/grub.cfg EXTRA_DIST += docs/osdetect.cfg @@ -244,7 +257,7 @@ index b909f2c073a..ea58362b555 100644 diff --git a/docs/grub-boot-success.service b/docs/grub-boot-success.service new file mode 100644 -index 00000000000..80e79584c91 +index 000000000..80e79584c --- /dev/null +++ b/docs/grub-boot-success.service @@ -0,0 +1,6 @@ @@ -256,7 +269,7 @@ index 00000000000..80e79584c91 +ExecStart=/usr/sbin/grub2-set-bootflag boot_success diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer new file mode 100644 -index 00000000000..406f1720056 +index 000000000..406f17200 --- /dev/null +++ b/docs/grub-boot-success.timer @@ -0,0 +1,7 @@ @@ -267,29 +280,11 @@ index 00000000000..406f1720056 + +[Timer] +OnActiveSec=2min -diff --git a/util/grub-set-bootflag.1 b/util/grub-set-bootflag.1 +diff --git a/docs/man/grub-set-bootflag.h2m b/docs/man/grub-set-bootflag.h2m new file mode 100644 -index 00000000000..57801da22a0 +index 000000000..94ec0b92e --- /dev/null -+++ b/util/grub-set-bootflag.1 -@@ -0,0 +1,20 @@ -+.TH GRUB-SET-BOOTFLAG 1 "Tue Jun 12 2018" -+.SH NAME -+\fBgrub-set-bootflag\fR \(em Set a bootflag in the GRUB environment block. -+ -+.SH SYNOPSIS -+\fBgrub-set-bootflag\fR <\fIBOOTFLAG\fR> -+ -+.SH DESCRIPTION -+\fBgrub-set-bootflag\fR is a command line to set bootflags in GRUB's -+stored environment. -+ -+.SH COMMANDS -+.TP -+\fBBOOTFLAG\fR -+.RS 7 -+Bootflag to set, one of \fIboot_success\fR or \fIshow_menu_once\fR. -+.RE -+ -+.SH SEE ALSO -+.BR "info grub" ++++ b/docs/man/grub-set-bootflag.h2m +@@ -0,0 +1,2 @@ ++[NAME] ++grub-set-bootflag \- set a bootflag in the GRUB environment block diff --git a/0087-docs-Add-grub-boot-indeterminate.service-example.patch b/0085-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 97% rename from 0087-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0085-docs-Add-grub-boot-indeterminate.service-example.patch index 44f6ad39..5b8732a8 100644 --- a/0087-docs-Add-grub-boot-indeterminate.service-example.patch +++ b/0085-docs-Add-grub-boot-indeterminate.service-example.patch @@ -16,7 +16,7 @@ Signed-off-by: Hans de Goede diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service new file mode 100644 -index 00000000000..6c8dcb186b6 +index 000000000..6c8dcb186 --- /dev/null +++ b/docs/grub-boot-indeterminate.service @@ -0,0 +1,11 @@ diff --git a/0088-gentpl-add-disable-support.patch b/0086-gentpl-add-disable-support.patch similarity index 97% rename from 0088-gentpl-add-disable-support.patch rename to 0086-gentpl-add-disable-support.patch index 2c3c998f..fabba4b1 100644 --- a/0088-gentpl-add-disable-support.patch +++ b/0086-gentpl-add-disable-support.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gentpl.py b/gentpl.py -index 2cba0bbbd6f..628e8bec1d7 100644 +index c86550d4f..f3c5f84f8 100644 --- a/gentpl.py +++ b/gentpl.py @@ -592,11 +592,21 @@ def platform_conditional(platform, closure): diff --git a/0089-gentpl-add-pc-firmware-type.patch b/0087-gentpl-add-pc-firmware-type.patch similarity index 95% rename from 0089-gentpl-add-pc-firmware-type.patch rename to 0087-gentpl-add-pc-firmware-type.patch index 96dd2b8c..e3647875 100644 --- a/0089-gentpl-add-pc-firmware-type.patch +++ b/0087-gentpl-add-pc-firmware-type.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+) diff --git a/gentpl.py b/gentpl.py -index 628e8bec1d7..34a4eba2b42 100644 +index f3c5f84f8..f09b33686 100644 --- a/gentpl.py +++ b/gentpl.py @@ -51,6 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ] diff --git a/0090-efinet-also-use-the-firmware-acceleration-for-http.patch b/0088-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 96% rename from 0090-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0088-efinet-also-use-the-firmware-acceleration-for-http.patch index 915b5aa1..9fec27c8 100644 --- a/0090-efinet-also-use-the-firmware-acceleration-for-http.patch +++ b/0088-efinet-also-use-the-firmware-acceleration-for-http.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 4bb308026ce..6603cd83edc 100644 +index 4bb308026..6603cd83e 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -1324,7 +1324,9 @@ grub_efi_net_boot_from_https (void) diff --git a/0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 97% rename from 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch index 985a0378..1af9ba00 100644 --- a/0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +++ b/0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 19 insertions(+) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 3f61fd2fa5b..243acbaa35b 100644 +index 3f61fd2fa..243acbaa3 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -4,6 +4,7 @@ diff --git a/0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 96% rename from 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index ee2216e5..e77a96cf 100644 --- a/0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index b50fb2e9897..b27573b3de5 100644 +index b809c0078..b1ca89479 100644 --- a/configure.ac +++ b/configure.ac -@@ -877,11 +877,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p +@@ -850,11 +850,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" fi @@ -45,7 +45,7 @@ index b50fb2e9897..b27573b3de5 100644 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ grub_cv_target_cc_soft_float=no if test "x$target_cpu" = xarm64; then -@@ -2011,6 +2023,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +@@ -1984,6 +1996,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" @@ -88,7 +88,7 @@ index b50fb2e9897..b27573b3de5 100644 GRUB_PLATFORM="${platform}" diff --git a/conf/Makefile.common b/conf/Makefile.common -index 5f0ef969857..2ff9b39357c 100644 +index 5f0ef9698..2ff9b3935 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 @@ -129,7 +129,7 @@ index 5f0ef969857..2ff9b39357c 100644 # Other variables diff --git a/gentpl.py b/gentpl.py -index 34a4eba2b42..59f62ef9522 100644 +index f09b33686..0e62e1466 100644 --- a/gentpl.py +++ b/gentpl.py @@ -697,10 +697,10 @@ def module(defn, platform): diff --git a/0093-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0091-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 94% rename from 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0091-module-verifier-make-it-possible-to-run-checkers-on-.patch index e31b38f6..5419b614 100644 --- a/0093-module-verifier-make-it-possible-to-run-checkers-on-.patch +++ b/0091-module-verifier-make-it-possible-to-run-checkers-on-.patch @@ -22,7 +22,7 @@ Signed-off-by: Peter Jones 3 files changed, 13 insertions(+) diff --git a/util/grub-module-verifier32.c b/util/grub-module-verifier32.c -index 257229f8f08..ba7d41aafea 100644 +index 257229f8f..ba7d41aaf 100644 --- a/util/grub-module-verifier32.c +++ b/util/grub-module-verifier32.c @@ -1,2 +1,4 @@ @@ -31,7 +31,7 @@ index 257229f8f08..ba7d41aafea 100644 #include "grub-module-verifierXX.c" +#endif diff --git a/util/grub-module-verifier64.c b/util/grub-module-verifier64.c -index 4db6b4bedd1..fc23ef800b3 100644 +index 4db6b4bed..fc23ef800 100644 --- a/util/grub-module-verifier64.c +++ b/util/grub-module-verifier64.c @@ -1,2 +1,4 @@ @@ -40,7 +40,7 @@ index 4db6b4bedd1..fc23ef800b3 100644 #include "grub-module-verifierXX.c" +#endif diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c -index ceb24309aec..a98e2f9b1ac 100644 +index ceb24309a..a98e2f9b1 100644 --- a/util/grub-module-verifierXX.c +++ b/util/grub-module-verifierXX.c @@ -1,3 +1,12 @@ diff --git a/0094-Rework-how-the-fdt-command-builds.patch b/0092-Rework-how-the-fdt-command-builds.patch similarity index 95% rename from 0094-Rework-how-the-fdt-command-builds.patch rename to 0092-Rework-how-the-fdt-command-builds.patch index e233067a..8cf19f0d 100644 --- a/0094-Rework-how-the-fdt-command-builds.patch +++ b/0092-Rework-how-the-fdt-command-builds.patch @@ -25,7 +25,7 @@ Signed-off-by: Robbie Harwood 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c40170f2dd2..84a3d89de9a 100644 +index c40170f2d..84a3d89de 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -177,7 +177,6 @@ kernel = { @@ -62,7 +62,7 @@ index c40170f2dd2..84a3d89de9a 100644 }; diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c -index 0d371c5633e..37e04bd69e7 100644 +index 0d371c563..37e04bd69 100644 --- a/grub-core/lib/fdt.c +++ b/grub-core/lib/fdt.c @@ -21,8 +21,6 @@ @@ -75,7 +75,7 @@ index 0d371c5633e..37e04bd69e7 100644 #define FDT_BEGIN_NODE 0x00000001 diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c -index c86f283d756..c572415d38a 100644 +index c86f283d7..c572415d3 100644 --- a/grub-core/loader/efi/fdt.c +++ b/grub-core/loader/efi/fdt.c @@ -27,6 +27,8 @@ @@ -88,7 +88,7 @@ index c86f283d756..c572415d38a 100644 static void *fdt; diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index e609c7e4111..3514aa4a5b6 100644 +index e609c7e41..3514aa4a5 100644 --- a/include/grub/fdt.h +++ b/include/grub/fdt.h @@ -19,6 +19,9 @@ @@ -110,7 +110,7 @@ index e609c7e4111..3514aa4a5b6 100644 + #endif /* ! GRUB_FDT_HEADER */ diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index f512573c0da..dd49939aaa9 100644 +index f512573c0..dd49939aa 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h diff --git a/0095-Disable-non-wordsize-allocations-on-arm.patch b/0093-Disable-non-wordsize-allocations-on-arm.patch similarity index 93% rename from 0095-Disable-non-wordsize-allocations-on-arm.patch rename to 0093-Disable-non-wordsize-allocations-on-arm.patch index e28041a1..60adf7e7 100644 --- a/0095-Disable-non-wordsize-allocations-on-arm.patch +++ b/0093-Disable-non-wordsize-allocations-on-arm.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index b27573b3de5..bb4e05ceef3 100644 +index b1ca89479..f42be6533 100644 --- a/configure.ac +++ b/configure.ac -@@ -1288,6 +1288,26 @@ if test "x$target_cpu" = xarm; then +@@ -1261,6 +1261,26 @@ if test "x$target_cpu" = xarm; then done ]) diff --git a/0096-Prepend-prefix-when-HTTP-path-is-relative.patch b/0094-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 98% rename from 0096-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0094-Prepend-prefix-when-HTTP-path-is-relative.patch index d3e599d1..787e6813 100644 --- a/0096-Prepend-prefix-when-HTTP-path-is-relative.patch +++ b/0094-Prepend-prefix-when-HTTP-path-is-relative.patch @@ -16,7 +16,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index d1de9fa6873..1c540fc8c26 100644 +index d1de9fa68..1c540fc8c 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -131,11 +131,19 @@ grub_set_prefix_and_root (void) @@ -41,7 +41,7 @@ index d1de9fa6873..1c540fc8c26 100644 } } diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 243acbaa35b..de351b2cd03 100644 +index 243acbaa3..de351b2cd 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -9,10 +9,52 @@ diff --git a/0097-Make-grub_error-more-verbose.patch b/0095-Make-grub_error-more-verbose.patch similarity index 96% rename from 0097-Make-grub_error-more-verbose.patch rename to 0095-Make-grub_error-more-verbose.patch index 2492e9f6..8ecefea3 100644 --- a/0097-Make-grub_error-more-verbose.patch +++ b/0095-Make-grub_error-more-verbose.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c -index 53c734de70e..aebfe0cf839 100644 +index 53c734de7..aebfe0cf8 100644 --- a/grub-core/kern/err.c +++ b/grub-core/kern/err.c @@ -33,15 +33,24 @@ static struct grub_error_saved grub_error_stack_items[GRUB_ERROR_STACK_SIZE]; @@ -41,7 +41,7 @@ index 53c734de70e..aebfe0cf839 100644 return n; diff --git a/include/grub/err.h b/include/grub/err.h -index b08d5d0de4c..c0f90ef07c8 100644 +index b08d5d0de..c0f90ef07 100644 --- a/include/grub/err.h +++ b/include/grub/err.h @@ -85,8 +85,12 @@ struct grub_error_saved diff --git a/0098-Make-reset-an-alias-for-the-reboot-command.patch b/0096-Make-reset-an-alias-for-the-reboot-command.patch similarity index 97% rename from 0098-Make-reset-an-alias-for-the-reboot-command.patch rename to 0096-Make-reset-an-alias-for-the-reboot-command.patch index c86acf18..f7bd8553 100644 --- a/0098-Make-reset-an-alias-for-the-reboot-command.patch +++ b/0096-Make-reset-an-alias-for-the-reboot-command.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub-core/commands/reboot.c b/grub-core/commands/reboot.c -index 46d364c99a9..f5cc2283636 100644 +index 46d364c99..f5cc22836 100644 --- a/grub-core/commands/reboot.c +++ b/grub-core/commands/reboot.c @@ -32,15 +32,18 @@ grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)), diff --git a/0099-Add-a-version-command.patch b/0097-Add-a-version-command.patch similarity index 95% rename from 0099-Add-a-version-command.patch rename to 0097-Add-a-version-command.patch index bf3b4b80..a70170fc 100644 --- a/0099-Add-a-version-command.patch +++ b/0097-Add-a-version-command.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index bb4e05ceef3..59ccda24475 100644 +index f42be6533..2af5f23ad 100644 --- a/configure.ac +++ b/configure.ac -@@ -312,6 +312,19 @@ AC_SUBST(target_cpu) +@@ -285,6 +285,19 @@ AC_SUBST(target_cpu) AC_SUBST(platform) # Define default variables @@ -41,7 +41,7 @@ index bb4e05ceef3..59ccda24475 100644 have_with_bootdir=n AC_ARG_WITH([bootdir], diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 84a3d89de9a..498ca11762a 100644 +index 84a3d89de..498ca1176 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -579,6 +579,11 @@ image = { @@ -58,7 +58,7 @@ index 84a3d89de9a..498ca11762a 100644 common = lib/disk.c; diff --git a/grub-core/commands/version.c b/grub-core/commands/version.c new file mode 100644 -index 00000000000..f0966a518f7 +index 000000000..f0966a518 --- /dev/null +++ b/grub-core/commands/version.c @@ -0,0 +1,56 @@ @@ -119,7 +119,7 @@ index 00000000000..f0966a518f7 + grub_unregister_command (cmd); +} diff --git a/config.h.in b/config.h.in -index 9e8f9911b18..c7e316f0f1f 100644 +index 9e8f9911b..c7e316f0f 100644 --- a/config.h.in +++ b/config.h.in @@ -59,6 +59,7 @@ diff --git a/0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 94% rename from 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch index 9afb3151..32834958 100644 --- a/0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +++ b/0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 4 files changed, 10 insertions(+) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 0320115662f..7cdffe3ebd5 100644 +index 032011566..7cdffe3eb 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter) @@ -33,7 +33,7 @@ index 0320115662f..7cdffe3ebd5 100644 if (!pv->disk) return grub_errno; diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index f077b5f5535..fe8ba6e6c93 100644 +index f077b5f55..fe8ba6e6c 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -855,6 +855,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) @@ -45,7 +45,7 @@ index f077b5f5535..fe8ba6e6c93 100644 grub_free (dup_dp); diff --git a/grub-core/kern/device.c b/grub-core/kern/device.c -index 73b8ecc0c09..f58b58c89d5 100644 +index 73b8ecc0c..f58b58c89 100644 --- a/grub-core/kern/device.c +++ b/grub-core/kern/device.c @@ -34,6 +34,7 @@ grub_device_open (const char *name) @@ -57,7 +57,7 @@ index 73b8ecc0c09..f58b58c89d5 100644 { name = grub_env_get ("root"); diff --git a/grub-core/script/script.c b/grub-core/script/script.c -index ec4d4337c66..844e8343ca7 100644 +index ec4d4337c..844e8343c 100644 --- a/grub-core/script/script.c +++ b/grub-core/script/script.c @@ -22,6 +22,11 @@ diff --git a/0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 99% rename from 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch index 1fdc5528..54e336c9 100644 --- a/0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch +++ b/0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch @@ -71,7 +71,7 @@ Signed-off-by: Peter Jones 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index f6aef0ef649..85ad4b4494c 100644 +index f6aef0ef6..85ad4b449 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, @@ -146,7 +146,7 @@ index f6aef0ef649..85ad4b4494c 100644 grub_free(memory_map); diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 04994d5c67d..70a0075ec5e 100644 +index 04994d5c6..70a0075ec 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -71,20 +71,25 @@ finalize_params_linux (void) diff --git a/0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 96% rename from 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch index 06329b9c..83fc6108 100644 --- a/0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch +++ b/0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch @@ -38,7 +38,7 @@ Signed-off-by: Robbie Harwood 8 files changed, 29 insertions(+), 12 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 85ad4b4494c..e84961d078c 100644 +index 85ad4b449..e84961d07 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, @@ -72,7 +72,7 @@ index 85ad4b4494c..e84961d078c 100644 #endif diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3017d0f3e52..33e981e76e7 100644 +index 3017d0f3e..33e981e76 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -27,6 +27,7 @@ @@ -138,7 +138,7 @@ index 3017d0f3e52..33e981e76e7 100644 { grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel")); diff --git a/include/grub/arm/efi/memory.h b/include/grub/arm/efi/memory.h -index 2c64918e3f7..a4c2ec83502 100644 +index 2c64918e3..a4c2ec835 100644 --- a/include/grub/arm/efi/memory.h +++ b/include/grub/arm/efi/memory.h @@ -2,5 +2,6 @@ @@ -149,7 +149,7 @@ index 2c64918e3f7..a4c2ec83502 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/arm64/efi/memory.h b/include/grub/arm64/efi/memory.h -index c6cb3241714..acb61dca44b 100644 +index c6cb32417..acb61dca4 100644 --- a/include/grub/arm64/efi/memory.h +++ b/include/grub/arm64/efi/memory.h @@ -2,5 +2,6 @@ @@ -160,7 +160,7 @@ index c6cb3241714..acb61dca44b 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/i386/efi/memory.h b/include/grub/i386/efi/memory.h -index 2c64918e3f7..a4c2ec83502 100644 +index 2c64918e3..a4c2ec835 100644 --- a/include/grub/i386/efi/memory.h +++ b/include/grub/i386/efi/memory.h @@ -2,5 +2,6 @@ @@ -171,7 +171,7 @@ index 2c64918e3f7..a4c2ec83502 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/ia64/efi/memory.h b/include/grub/ia64/efi/memory.h -index 2c64918e3f7..a4c2ec83502 100644 +index 2c64918e3..a4c2ec835 100644 --- a/include/grub/ia64/efi/memory.h +++ b/include/grub/ia64/efi/memory.h @@ -2,5 +2,6 @@ @@ -182,7 +182,7 @@ index 2c64918e3f7..a4c2ec83502 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/riscv64/efi/memory.h b/include/grub/riscv64/efi/memory.h -index c6cb3241714..acb61dca44b 100644 +index c6cb32417..acb61dca4 100644 --- a/include/grub/riscv64/efi/memory.h +++ b/include/grub/riscv64/efi/memory.h @@ -2,5 +2,6 @@ @@ -193,7 +193,7 @@ index c6cb3241714..acb61dca44b 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h -index 46e9145a308..e81cfb32213 100644 +index 46e9145a3..e81cfb322 100644 --- a/include/grub/x86_64/efi/memory.h +++ b/include/grub/x86_64/efi/memory.h @@ -2,9 +2,11 @@ diff --git a/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 94% rename from 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index e6cd8b47..f060b0f6 100644 --- a/0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -19,7 +19,7 @@ Signed-off-by: Peter Jones 11 files changed, 18 insertions(+), 17 deletions(-) diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index eeea092752d..f08a1bb8415 100644 +index eeea09275..f08a1bb84 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -189,7 +189,7 @@ grub_util_get_image_size (const char *path) @@ -32,7 +32,7 @@ index eeea092752d..f08a1bb8415 100644 ret = (size_t) sz; diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c -index 467305b46ab..79037c093f7 100644 +index 467305b46..79037c093 100644 --- a/grub-core/lib/reed_solomon.c +++ b/grub-core/lib/reed_solomon.c @@ -157,7 +157,7 @@ static void @@ -54,7 +54,7 @@ index 467305b46ab..79037c093f7 100644 { grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE; diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c -index c77d6085ccb..42a315031ff 100644 +index c77d6085c..42a315031 100644 --- a/grub-core/osdep/linux/blocklist.c +++ b/grub-core/osdep/linux/blocklist.c @@ -109,7 +109,7 @@ grub_install_get_blocklist (grub_device_t root_dev, @@ -67,7 +67,7 @@ index c77d6085ccb..42a315031ff 100644 + fie1.fm_mapped_extents * sizeof (fie1.fm_extents[1])); diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 28790307e00..9f730b35189 100644 +index 28790307e..9f730b351 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -236,7 +236,7 @@ grub_find_root_devices_from_btrfs (const char *dir) @@ -80,7 +80,7 @@ index 28790307e00..9f730b35189 100644 fd = open (dir, 0); diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c -index da62f924e35..7bc99ac1c1d 100644 +index da62f924e..7bc99ac1c 100644 --- a/grub-core/osdep/linux/hostdisk.c +++ b/grub-core/osdep/linux/hostdisk.c @@ -83,7 +83,7 @@ grub_util_get_fd_size_os (grub_util_fd_t fd, const char *name, unsigned *log_sec @@ -93,7 +93,7 @@ index da62f924e35..7bc99ac1c1d 100644 if (log_secsize) diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index 83865642009..bfcef852d83 100644 +index 838656420..bfcef852d 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -323,7 +323,7 @@ cmd_cmp (char *src, char *dest) @@ -106,7 +106,7 @@ index 83865642009..bfcef852d83 100644 fseek (ff, 0, SEEK_END); if (pre != ftell (ff)) diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c -index a39f8693947..358d604210b 100644 +index a39f86939..358d60421 100644 --- a/util/grub-menulst2cfg.c +++ b/util/grub-menulst2cfg.c @@ -34,7 +34,7 @@ main (int argc, char **argv) @@ -119,7 +119,7 @@ index a39f8693947..358d604210b 100644 grub_util_host_init (&argc, &argv); diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c -index 0fe45a6103d..3e09240b99f 100644 +index 0fe45a610..3e09240b9 100644 --- a/util/grub-mkfont.c +++ b/util/grub-mkfont.c @@ -138,7 +138,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, @@ -173,7 +173,7 @@ index 0fe45a6103d..3e09240b99f 100644 add_pixel (&data, &mask, glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] & diff --git a/util/grub-probe.c b/util/grub-probe.c -index c08e46bbb40..c6fac732b40 100644 +index c08e46bbb..c6fac732b 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -798,7 +798,7 @@ argp_parser (int key, char *arg, struct argp_state *state) @@ -186,7 +186,7 @@ index c08e46bbb40..c6fac732b40 100644 for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) if (strcmp (arg, targets[i]) == 0) diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c -index f33bd1ed568..8345944105f 100644 +index f33bd1ed5..834594410 100644 --- a/util/grub-rpm-sort.c +++ b/util/grub-rpm-sort.c @@ -232,7 +232,7 @@ main (int argc, char *argv[]) @@ -199,7 +199,7 @@ index f33bd1ed568..8345944105f 100644 grub_util_host_init (&argc, &argv); diff --git a/util/setup.c b/util/setup.c -index da5f2c07f50..8b22bb8ccac 100644 +index da5f2c07f..8b22bb8cc 100644 --- a/util/setup.c +++ b/util/setup.c @@ -406,7 +406,7 @@ SETUP (const char *dir, diff --git a/0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 92% rename from 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index 1fa705e6..bbcefd23 100644 --- a/0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index 59ccda24475..6eb297fdbf6 100644 +index 2af5f23ad..091ab3283 100644 --- a/configure.ac +++ b/configure.ac -@@ -1480,11 +1480,11 @@ fi +@@ -1453,11 +1453,11 @@ fi # Set them to their new values for the tests below. CC="$TARGET_CC" if test x"$platform" = xemu ; then @@ -29,7 +29,7 @@ index 59ccda24475..6eb297fdbf6 100644 fi CPPFLAGS="$TARGET_CPPFLAGS" -@@ -2047,6 +2047,14 @@ if test x"$enable_werror" != xno ; then +@@ -2020,6 +2020,14 @@ if test x"$enable_werror" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Werror" fi @@ -45,7 +45,7 @@ index 59ccda24475..6eb297fdbf6 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index 2ff9b39357c..35e14ff017e 100644 +index 2ff9b3935..35e14ff01 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d diff --git a/0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 98% rename from 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch index fdd30965..15f7e2cf 100644 --- a/0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +++ b/0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 33e981e76e7..2f0336809e7 100644 +index 33e981e76..2f0336809 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -35,11 +35,16 @@ static grub_dl_t my_mod; diff --git a/0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 99% rename from 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch index f8284ec2..56c524ca 100644 --- a/0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +++ b/0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 2f0336809e7..5f48fa55619 100644 +index 2f0336809..5f48fa556 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -243,32 +243,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), diff --git a/0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 99% rename from 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch index 4ad0696b..bba44ec4 100644 --- a/0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +++ b/0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 1 file changed, 94 insertions(+), 73 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 5f48fa55619..3e4f7ef39f4 100644 +index 5f48fa556..3e4f7ef39 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -47,6 +47,65 @@ static char *linux_cmdline; diff --git a/0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 98% rename from 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch index b1233ce3..e30c4373 100644 --- a/0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +++ b/0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3e4f7ef39f4..6bc18d5aef5 100644 +index 3e4f7ef39..6bc18d5ae 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -52,13 +52,22 @@ struct allocation_choice { @@ -153,7 +153,7 @@ index 3e4f7ef39f4..6bc18d5aef5 100644 grub_memcpy (kernel_mem, (char *)kernel + start, filelen - start); diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index 25ef52c04eb..fac22476cc5 100644 +index 25ef52c04..fac22476c 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -236,7 +236,11 @@ struct linux_kernel_params diff --git a/0109-Fix-getroot.c-s-trampolines.patch b/0107-Fix-getroot.c-s-trampolines.patch similarity index 97% rename from 0109-Fix-getroot.c-s-trampolines.patch rename to 0107-Fix-getroot.c-s-trampolines.patch index 29ec44c9..dbf875cb 100644 --- a/0109-Fix-getroot.c-s-trampolines.patch +++ b/0107-Fix-getroot.c-s-trampolines.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 9f730b35189..f0c503f43d3 100644 +index 9f730b351..f0c503f43 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -1264,22 +1264,20 @@ grub_util_get_grub_dev_os (const char *os_dev) diff --git a/0110-Do-not-allow-stack-trampolines-anywhere.patch b/0108-Do-not-allow-stack-trampolines-anywhere.patch similarity index 90% rename from 0110-Do-not-allow-stack-trampolines-anywhere.patch rename to 0108-Do-not-allow-stack-trampolines-anywhere.patch index 2a3247af..b05a36ea 100644 --- a/0110-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0108-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 6eb297fdbf6..c6bd965f1f9 100644 +index 091ab3283..de707f7e0 100644 --- a/configure.ac +++ b/configure.ac -@@ -2055,6 +2055,9 @@ if test x"$enable_wextra" != xno ; then +@@ -2028,6 +2028,9 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi @@ -24,7 +24,7 @@ index 6eb297fdbf6..c6bd965f1f9 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index 35e14ff017e..0647c53b916 100644 +index 35e14ff01..0647c53b9 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d diff --git a/0111-Reimplement-boot_counter.patch b/0109-Reimplement-boot_counter.patch similarity index 97% rename from 0111-Reimplement-boot_counter.patch rename to 0109-Reimplement-boot_counter.patch index a203929f..b884f817 100644 --- a/0111-Reimplement-boot_counter.patch +++ b/0109-Reimplement-boot_counter.patch @@ -23,7 +23,7 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index 0b85a7fce4a..27a13bc734e 100644 +index 0b85a7fce..27a13bc73 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { @@ -40,7 +40,7 @@ index 0b85a7fce4a..27a13bc734e 100644 name = '01_menu_auto_hide'; common = util/grub.d/01_menu_auto_hide.in; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 498ca11762a..1e15345107e 100644 +index 498ca1176..1e1534510 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -398,6 +398,11 @@ kernel = { @@ -57,7 +57,7 @@ index 498ca11762a..1e15345107e 100644 mansection = 1; diff --git a/grub-core/commands/increment.c b/grub-core/commands/increment.c new file mode 100644 -index 00000000000..79cf137656c +index 000000000..79cf13765 --- /dev/null +++ b/grub-core/commands/increment.c @@ -0,0 +1,105 @@ @@ -168,7 +168,7 @@ index 00000000000..79cf137656c +} diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in new file mode 100644 -index 00000000000..be0e770ea82 +index 000000000..be0e770ea --- /dev/null +++ b/util/grub.d/01_fallback_counting.in @@ -0,0 +1,22 @@ diff --git a/0112-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0110-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 99% rename from 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0110-Fix-menu-entry-selection-based-on-ID-and-title.patch index 957fda38..cd9e50f5 100644 --- a/0112-Fix-menu-entry-selection-based-on-ID-and-title.patch +++ b/0110-Fix-menu-entry-selection-based-on-ID-and-title.patch @@ -24,7 +24,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d7a222e681b..4a02aadb01c 100644 +index d7a222e68..4a02aadb0 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -164,12 +164,12 @@ grub_menu_set_timeout (int timeout) diff --git a/0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 97% rename from 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch index e0d36db7..c2fbe655 100644 --- a/0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch +++ b/0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch @@ -23,7 +23,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index b194123eb67..b175a1b43b7 100644 +index b194123eb..b175a1b43 100644 --- a/grub-core/commands/menuentry.c +++ b/grub-core/commands/menuentry.c @@ -29,7 +29,7 @@ static const struct grub_arg_option options[] = diff --git a/0114-Add-efi-export-env-and-efi-load-env-commands.patch b/0112-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 97% rename from 0114-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0112-Add-efi-export-env-and-efi-load-env-commands.patch index 73456bc9..abff17cb 100644 --- a/0114-Add-efi-export-env-and-efi-load-env-commands.patch +++ b/0112-Add-efi-export-env-and-efi-load-env-commands.patch @@ -21,7 +21,7 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/efi/env.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 1e15345107e..81fc274148e 100644 +index 1e1534510..81fc27414 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -820,6 +820,12 @@ module = { @@ -39,7 +39,7 @@ index 1e15345107e..81fc274148e 100644 efi = commands/efi/efifwsetup.c; diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c new file mode 100644 -index 00000000000..cbd13e03e81 +index 000000000..cbd13e03e --- /dev/null +++ b/grub-core/commands/efi/env.c @@ -0,0 +1,168 @@ @@ -212,7 +212,7 @@ index 00000000000..cbd13e03e81 + grub_unregister_command (loadenv_cmd); +} diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 2a446f5031b..14bc10eb564 100644 +index 2a446f503..14bc10eb5 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -225,6 +225,9 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid, @@ -226,7 +226,7 @@ index 2a446f5031b..14bc10eb564 100644 } diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 2d12e6188fd..0574d8d6217 100644 +index 2d12e6188..0574d8d62 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -85,11 +85,6 @@ stack_protector_init (void) @@ -242,7 +242,7 @@ index 2d12e6188fd..0574d8d6217 100644 static int set_var (const char *name, const char *value, diff --git a/grub-core/lib/envblk.c b/grub-core/lib/envblk.c -index 2e4e78b132d..874506da169 100644 +index 2e4e78b13..874506da1 100644 --- a/grub-core/lib/envblk.c +++ b/grub-core/lib/envblk.c @@ -223,6 +223,49 @@ grub_envblk_delete (grub_envblk_t envblk, const char *name) @@ -296,7 +296,7 @@ index 2e4e78b132d..874506da169 100644 grub_envblk_iterate (grub_envblk_t envblk, void *hook_data, diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index bb198f02351..6a79ee67444 100644 +index d506f7e75..a6ccc1138 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -25,6 +25,7 @@ @@ -308,7 +308,7 @@ index bb198f02351..6a79ee67444 100644 #include #include diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 2e0691454b1..8dfc89a33b9 100644 +index 2e0691454..8dfc89a33 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -24,6 +24,11 @@ @@ -324,7 +324,7 @@ index 2e0691454b1..8dfc89a33b9 100644 extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table); extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle); diff --git a/include/grub/lib/envblk.h b/include/grub/lib/envblk.h -index c3e65592170..ab969af2461 100644 +index c3e655921..ab969af24 100644 --- a/include/grub/lib/envblk.h +++ b/include/grub/lib/envblk.h @@ -22,6 +22,8 @@ diff --git a/0115-Make-it-possible-to-subtract-conditions-from-debug.patch b/0113-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 97% rename from 0115-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0113-Make-it-possible-to-subtract-conditions-from-debug.patch index fce51eac..53e28fd8 100644 --- a/0115-Make-it-possible-to-subtract-conditions-from-debug.patch +++ b/0113-Make-it-possible-to-subtract-conditions-from-debug.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 9a2fae6398e..578bf51a5fc 100644 +index 9a2fae639..578bf51a5 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -164,12 +164,24 @@ int diff --git a/0116-Export-all-variables-from-the-initial-context-when-c.patch b/0114-Export-all-variables-from-the-initial-context-when-c.patch similarity index 95% rename from 0116-Export-all-variables-from-the-initial-context-when-c.patch rename to 0114-Export-all-variables-from-the-initial-context-when-c.patch index 4e32260c..554884bf 100644 --- a/0116-Export-all-variables-from-the-initial-context-when-c.patch +++ b/0114-Export-all-variables-from-the-initial-context-when-c.patch @@ -17,7 +17,7 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/grub-core/normal/context.c b/grub-core/normal/context.c -index ee53d4a68e5..87edd254c44 100644 +index ee53d4a68..87edd254c 100644 --- a/grub-core/normal/context.c +++ b/grub-core/normal/context.c @@ -99,7 +99,7 @@ grub_env_new_context (int export_all) @@ -30,7 +30,7 @@ index ee53d4a68e5..87edd254c44 100644 int grub_extractor_level = 0; diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 4a02aadb01c..fe2e77a43e2 100644 +index 4a02aadb0..fe2e77a43 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -375,8 +375,6 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) diff --git a/0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 97% rename from 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index 92f259dc..ad2e25fd 100644 --- a/0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -21,7 +21,7 @@ Signed-off-by: Robbie Harwood rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index 27a13bc734e..2e6ad979c3e 100644 +index 27a13bc73..2e6ad979c 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -459,14 +459,14 @@ script = { @@ -60,7 +60,7 @@ diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/08_fallback_count similarity index 65% rename from util/grub.d/01_fallback_counting.in rename to util/grub.d/08_fallback_counting.in -index be0e770ea82..2e2c3ff7d31 100644 +index be0e770ea..2e2c3ff7d 100644 --- a/util/grub.d/01_fallback_counting.in +++ b/util/grub.d/08_fallback_counting.in @@ -1,15 +1,17 @@ @@ -89,7 +89,7 @@ index be0e770ea82..2e2c3ff7d31 100644 set boot_counter=-1 diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in new file mode 100644 -index 00000000000..6c88d933dde +index 000000000..6c88d933d --- /dev/null +++ b/util/grub.d/10_reset_boot_success.in @@ -0,0 +1,25 @@ @@ -122,7 +122,7 @@ diff --git a/util/grub.d/01_menu_auto_hide.in b/util/grub.d/12_menu_auto_hide.in similarity index 58% rename from util/grub.d/01_menu_auto_hide.in rename to util/grub.d/12_menu_auto_hide.in -index ad175870a54..6a7c0fa0d43 100644 +index ad175870a..6a7c0fa0d 100644 --- a/util/grub.d/01_menu_auto_hide.in +++ b/util/grub.d/12_menu_auto_hide.in @@ -1,5 +1,8 @@ diff --git a/0118-Fix-systemctl-kexec-exit-status-check.patch b/0116-Fix-systemctl-kexec-exit-status-check.patch similarity index 97% rename from 0118-Fix-systemctl-kexec-exit-status-check.patch rename to 0116-Fix-systemctl-kexec-exit-status-check.patch index 74ecedcc..e10d6499 100644 --- a/0118-Fix-systemctl-kexec-exit-status-check.patch +++ b/0116-Fix-systemctl-kexec-exit-status-check.patch @@ -19,7 +19,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -index fda9e00d24c..5b85b225eed 100644 +index fda9e00d2..5b85b225e 100644 --- a/grub-core/loader/emu/linux.c +++ b/grub-core/loader/emu/linux.c @@ -71,8 +71,10 @@ grub_linux_boot (void) diff --git a/0119-Print-grub-emu-linux-loader-messages-as-debug.patch b/0117-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 97% rename from 0119-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0117-Print-grub-emu-linux-loader-messages-as-debug.patch index a49ec44c..5afe5113 100644 --- a/0119-Print-grub-emu-linux-loader-messages-as-debug.patch +++ b/0117-Print-grub-emu-linux-loader-messages-as-debug.patch @@ -11,7 +11,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -index 5b85b225eed..22ab6af1727 100644 +index 5b85b225e..22ab6af17 100644 --- a/grub-core/loader/emu/linux.c +++ b/grub-core/loader/emu/linux.c @@ -50,7 +50,7 @@ grub_linux_boot (void) diff --git a/0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 98% rename from 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch index bd7b2c1b..96e56cfb 100644 --- a/0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch +++ b/0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch @@ -17,7 +17,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index fe2e77a43e2..ec0c92bade0 100644 +index fe2e77a43..ec0c92bad 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -285,7 +285,7 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) diff --git a/0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 96% rename from 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch index cd4ef775..16829c7d 100644 --- a/0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch +++ b/0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch @@ -13,7 +13,7 @@ Signed-off-by: Hans de Goede 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index 6a79ee67444..65d74ce010f 100644 +index a6ccc1138..3eb04beb5 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -18,7 +18,7 @@ diff --git a/0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 95% rename from 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch index 122bf686..bb611f63 100644 --- a/0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +++ b/0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch @@ -13,7 +13,7 @@ Signed-off-by: Hans de Goede 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index 65d74ce010f..d1c5e28862b 100644 +index 3eb04beb5..3b4c25ca2 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -28,7 +28,9 @@ @@ -26,7 +26,7 @@ index 65d74ce010f..d1c5e28862b 100644 #include #include -@@ -54,8 +56,10 @@ int main(int argc, char *argv[]) +@@ -56,8 +58,10 @@ int main(int argc, char *argv[]) { /* NOTE buf must be at least the longest bootflag length + 4 bytes */ char env[GRUBENV_SIZE + 1], buf[64], *s; @@ -38,7 +38,7 @@ index 65d74ce010f..d1c5e28862b 100644 FILE *f; if (argc != 2) -@@ -77,7 +81,32 @@ int main(int argc, char *argv[]) +@@ -89,7 +93,32 @@ int main(int argc, char *argv[]) bootflag = bootflags[i]; len = strlen (bootflag); @@ -72,7 +72,7 @@ index 65d74ce010f..d1c5e28862b 100644 if (!f) { perror ("Error opening " GRUBENV " for reading"); -@@ -132,30 +161,70 @@ int main(int argc, char *argv[]) +@@ -144,30 +173,70 @@ int main(int argc, char *argv[]) snprintf(buf, sizeof(buf), "%s=1\n", bootflag); memcpy(s, buf, len + 3); diff --git a/0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 98% rename from 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch index a32c1465..ff129c6f 100644 --- a/0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +++ b/0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch @@ -53,7 +53,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in -index 6c88d933dde..e73f4137b36 100644 +index 6c88d933d..e73f4137b 100644 --- a/util/grub.d/10_reset_boot_success.in +++ b/util/grub.d/10_reset_boot_success.in @@ -6,18 +6,18 @@ diff --git a/0124-Add-start-symbol-for-RISC-V.patch b/0122-Add-start-symbol-for-RISC-V.patch similarity index 95% rename from 0124-Add-start-symbol-for-RISC-V.patch rename to 0122-Add-start-symbol-for-RISC-V.patch index 677efae0..cc8aa6f4 100644 --- a/0124-Add-start-symbol-for-RISC-V.patch +++ b/0122-Add-start-symbol-for-RISC-V.patch @@ -15,7 +15,7 @@ Signed-off-by: David Abdurachmanov 1 file changed, 1 insertion(+) diff --git a/grub-core/kern/riscv/efi/startup.S b/grub-core/kern/riscv/efi/startup.S -index f2a7b2b1ede..781773136e8 100644 +index f2a7b2b1e..781773136 100644 --- a/grub-core/kern/riscv/efi/startup.S +++ b/grub-core/kern/riscv/efi/startup.S @@ -29,6 +29,7 @@ diff --git a/0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 96% rename from 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch index 49c92b97..873ce0cc 100644 --- a/0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +++ b/0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch @@ -19,7 +19,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf -index 6b043fc354c..52d4af44bec 100644 +index 6b043fc35..52d4af44b 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -92,7 +92,7 @@ bootstrap_post_import_hook () { diff --git a/0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 95% rename from 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch index 74183bc3..5f9b8a81 100644 --- a/0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch +++ b/0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch @@ -25,7 +25,7 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 2 insertions(+) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 1c540fc8c26..b573be6650d 100644 +index 1c540fc8c..b573be665 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -143,6 +143,7 @@ grub_set_prefix_and_root (void) @@ -37,7 +37,7 @@ index 1c540fc8c26..b573be6650d 100644 grub_free (fw_path); } diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index de351b2cd03..755b7a6d054 100644 +index de351b2cd..755b7a6d0 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -39,6 +39,7 @@ http_configure (struct grub_efi_net_device *dev, int prefer_ip6) diff --git a/0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 99% rename from 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch index c3945498..69764f09 100644 --- a/0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +++ b/0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch @@ -43,7 +43,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 755b7a6d054..fc8cb25ae0a 100644 +index 755b7a6d0..fc8cb25ae 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -158,13 +158,7 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, diff --git a/0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 97% rename from 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch index 209aed80..94268422 100644 --- a/0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +++ b/0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch @@ -25,7 +25,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 6603cd83edc..84573937b18 100644 +index 6603cd83e..84573937b 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -742,7 +742,7 @@ grub_efi_net_parse_address (const char *address, diff --git a/0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 97% rename from 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch index f92dee44..807bda4d 100644 --- a/0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +++ b/0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch @@ -21,7 +21,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index b711a5d9457..313c818b184 100644 +index b711a5d94..313c818b1 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -56,9 +56,20 @@ int diff --git a/0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 98% rename from 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch index 33d8f886..0f5ff978 100644 --- a/0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch +++ b/0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch @@ -22,7 +22,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 84573937b18..a3f0535d43c 100644 +index 84573937b..a3f0535d4 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -778,9 +778,9 @@ grub_efi_net_parse_address (const char *address, diff --git a/0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 96% rename from 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch index 3dd525af..b8f4eeb2 100644 --- a/0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +++ b/0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch @@ -12,7 +12,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c -index 14d59649832..4d61f4e9790 100644 +index 14d596498..4d61f4e97 100644 --- a/grub-core/kern/term.c +++ b/grub-core/kern/term.c @@ -144,9 +144,10 @@ grub_key_is_interrupt (int key) diff --git a/0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 98% rename from 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch index 336bcf18..c3d2b9b4 100644 --- a/0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +++ b/0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch @@ -29,7 +29,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 14 insertions(+) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 0622dfa48d4..e8b9ecb17f6 100644 +index 0622dfa48..e8b9ecb17 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -72,6 +72,7 @@ grub_err_t diff --git a/0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 98% rename from 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch index 747773d1..35a5a6ab 100644 --- a/0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +++ b/0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch @@ -18,7 +18,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/grub-core/commands/tpm.c b/grub-core/commands/tpm.c -index 2052c36eaba..e287d042e6b 100644 +index 2052c36ea..e287d042e 100644 --- a/grub-core/commands/tpm.c +++ b/grub-core/commands/tpm.c @@ -42,7 +42,8 @@ grub_tpm_verify_init (grub_file_t io, diff --git a/0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 97% rename from 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch index 825d0f7c..420bc23b 100644 --- a/0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +++ b/0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 6bc18d5aef5..15d40d6e35b 100644 +index 6bc18d5ae..15d40d6e3 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -144,7 +144,7 @@ grub_linuxefi_unload (void) diff --git a/0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 97% rename from 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch index 97d2e06f..e62feb06 100644 --- a/0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +++ b/0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index b52b558d631..7f878b56157 100644 +index b52b558d6..7f878b561 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -501,13 +501,20 @@ http_open (struct grub_file *file, const char *filename) diff --git a/0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 95% rename from 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch index 1657d7a8..956208a4 100644 --- a/0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +++ b/0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c -index cbd13e03e81..977edb6b065 100644 +index cbd13e03e..977edb6b0 100644 --- a/grub-core/commands/efi/env.c +++ b/grub-core/commands/efi/env.c @@ -149,6 +149,8 @@ grub_efi_load_env(grub_command_t cmd __attribute__ ((unused)), diff --git a/0137-efi-dhcp-fix-some-allocation-error-checking.patch b/0135-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 97% rename from 0137-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0135-efi-dhcp-fix-some-allocation-error-checking.patch index 75497338..b705d12d 100644 --- a/0137-efi-dhcp-fix-some-allocation-error-checking.patch +++ b/0135-efi-dhcp-fix-some-allocation-error-checking.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c -index dbef63d8c08..e5c79b748b0 100644 +index dbef63d8c..e5c79b748 100644 --- a/grub-core/net/efi/dhcp.c +++ b/grub-core/net/efi/dhcp.c @@ -80,7 +80,7 @@ grub_efi_dhcp4_parse_dns (grub_efi_dhcp4_protocol_t *dhcp4, grub_efi_dhcp4_packe diff --git a/0138-efi-http-fix-some-allocation-error-checking.patch b/0136-efi-http-fix-some-allocation-error-checking.patch similarity index 96% rename from 0138-efi-http-fix-some-allocation-error-checking.patch rename to 0136-efi-http-fix-some-allocation-error-checking.patch index 4dffab9e..6aa40dde 100644 --- a/0138-efi-http-fix-some-allocation-error-checking.patch +++ b/0136-efi-http-fix-some-allocation-error-checking.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index fc8cb25ae0a..26647a50fa4 100644 +index fc8cb25ae..26647a50f 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -412,8 +412,8 @@ grub_efihttp_open (struct grub_efi_net_device *dev, diff --git a/0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 98% rename from 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch index 30c21a58..b40c4c26 100644 --- a/0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +++ b/0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index 313c818b184..9725e928f7e 100644 +index 313c818b1..9725e928f 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -4,15 +4,20 @@ @@ -82,7 +82,7 @@ index 313c818b184..9725e928f7e 100644 char *subnet, *gateway, *mask; grub_uint32_t u32_subnet, u32_gateway; diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c -index 017c4d05bc7..a46f6f9b685 100644 +index 017c4d05b..a46f6f9b6 100644 --- a/grub-core/net/efi/ip6_config.c +++ b/grub-core/net/efi/ip6_config.c @@ -3,6 +3,7 @@ diff --git a/0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 97% rename from 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch index 95f7e208..e1db5339 100644 --- a/0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +++ b/0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch @@ -13,7 +13,7 @@ Signed-off-by: Colin Watson 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 15d40d6e35b..f992ceeef20 100644 +index 15d40d6e3..f992ceeef 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -28,6 +28,8 @@ diff --git a/0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 96% rename from 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch index 20fc7869..2b5f6026 100644 --- a/0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch +++ b/0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch @@ -23,7 +23,7 @@ Signed-off-by: Dimitri John Ledkov 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 70a0075ec5e..47f8cf0d84b 100644 +index 70a0075ec..47f8cf0d8 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -34,6 +34,7 @@ @@ -55,7 +55,7 @@ index 70a0075ec5e..47f8cf0d84b 100644 pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index ac8dfd40c61..d41e8ea14a8 100644 +index ac8dfd40c..d41e8ea14 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -1084,6 +1084,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), @@ -67,7 +67,7 @@ index ac8dfd40c61..d41e8ea14a8 100644 fail: if (dev) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index e8b9ecb17f6..9260731c107 100644 +index e8b9ecb17..9260731c1 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -33,6 +33,7 @@ struct grub_efi_shim_lock @@ -79,7 +79,7 @@ index e8b9ecb17f6..9260731c107 100644 grub_linuxefi_secure_validate (void *data, grub_uint32_t size) { diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index f992ceeef20..3cf0f9b330b 100644 +index f992ceeef..3cf0f9b33 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -30,6 +30,7 @@ diff --git a/0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 97% rename from 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch index 9b0db5f9..b99d5e08 100644 --- a/0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +++ b/0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 8fb8918ae7e..7baf3540c81 100644 +index 8fb8918ae..7baf3540c 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -329,7 +329,7 @@ grub_net_configure_by_dhcp_ack (const char *name, diff --git a/0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 97% rename from 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch index 6c16e9ef..346beb32 100644 --- a/0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +++ b/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index 9725e928f7e..cb880fc3e8f 100644 +index 9725e928f..cb880fc3e 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -61,7 +61,8 @@ int diff --git a/0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 96% rename from 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch index 7c29683e..e8e411b7 100644 --- a/0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +++ b/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c -index a46f6f9b685..1c5415d7185 100644 +index a46f6f9b6..1c5415d71 100644 --- a/grub-core/net/efi/ip6_config.c +++ b/grub-core/net/efi/ip6_config.c @@ -85,7 +85,7 @@ grub_efi_string_to_ip6_address (const char *val, grub_efi_ipv6_address_t *addres diff --git a/0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 97% rename from 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch index 0fe90c8b..fa350023 100644 --- a/0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +++ b/0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index a3f0535d43c..78e5442fc52 100644 +index a3f0535d4..78e5442fc 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -729,7 +729,7 @@ grub_efi_net_parse_address (const char *address, diff --git a/0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 97% rename from 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch index 59f29e4f..8b55d80e 100644 --- a/0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +++ b/0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c -index 531949cba5c..73e2bb01c1b 100644 +index 531949cba..73e2bb01c 100644 --- a/grub-core/net/efi/pxe.c +++ b/grub-core/net/efi/pxe.c @@ -187,7 +187,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) diff --git a/0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 97% rename from 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch index 8e2481e7..bef2e7d2 100644 --- a/0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch +++ b/0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -65,7 +65,7 @@ Signed-off-by: Hans de Goede create mode 100644 util/systemd/systemd-integration.sh.in diff --git a/Makefile.util.def b/Makefile.util.def -index 2e6ad979c3e..9927c2cfd6a 100644 +index 2e6ad979c..9927c2cfd 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -470,6 +470,12 @@ script = { @@ -110,7 +110,7 @@ index 2e6ad979c3e..9927c2cfd6a 100644 mansection = 1; name = grub-mkrescue; diff --git a/conf/Makefile.common b/conf/Makefile.common -index 0647c53b916..9fe5863b2d9 100644 +index 0647c53b9..9fe5863b2 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -63,8 +63,11 @@ CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS) @@ -137,7 +137,7 @@ index 0647c53b916..9fe5863b2d9 100644 EXTRA_DIST = diff --git a/util/grub.d/14_menu_show_once.in b/util/grub.d/14_menu_show_once.in new file mode 100755 -index 00000000000..1cd7f36142b +index 000000000..1cd7f3614 --- /dev/null +++ b/util/grub.d/14_menu_show_once.in @@ -0,0 +1,13 @@ @@ -156,7 +156,7 @@ index 00000000000..1cd7f36142b +EOF diff --git a/util/systemd/10-grub-logind-service.conf.in b/util/systemd/10-grub-logind-service.conf.in new file mode 100644 -index 00000000000..f2d4ac00732 +index 000000000..f2d4ac007 --- /dev/null +++ b/util/systemd/10-grub-logind-service.conf.in @@ -0,0 +1,2 @@ @@ -164,7 +164,7 @@ index 00000000000..f2d4ac00732 +Environment=SYSTEMD_REBOOT_TO_BOOT_LOADER_MENU=true diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in new file mode 100644 -index 00000000000..c81fb594ce1 +index 000000000..c81fb594c --- /dev/null +++ b/util/systemd/grub-systemd-integration.service.in @@ -0,0 +1,8 @@ @@ -178,7 +178,7 @@ index 00000000000..c81fb594ce1 +ExecStart=@libexecdir@/@grubdirname@/systemd-integration.sh diff --git a/util/systemd/systemd-integration.sh.in b/util/systemd/systemd-integration.sh.in new file mode 100644 -index 00000000000..dc1218597bc +index 000000000..dc1218597 --- /dev/null +++ b/util/systemd/systemd-integration.sh.in @@ -0,0 +1,6 @@ diff --git a/0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 97% rename from 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch index 9021de50..77131a28 100644 --- a/0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +++ b/0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch @@ -18,7 +18,7 @@ Signed-off-by: Hans de Goede 1 file changed, 5 insertions(+) diff --git a/util/systemd/systemd-integration.sh.in b/util/systemd/systemd-integration.sh.in -index dc1218597bc..a4c071c5b0c 100644 +index dc1218597..a4c071c5b 100644 --- a/util/systemd/systemd-integration.sh.in +++ b/util/systemd/systemd-integration.sh.in @@ -4,3 +4,8 @@ TIMEOUT_USEC=$(cat /run/systemd/reboot-to-boot-loader-menu) diff --git a/0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 98% rename from 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch index c3388409..d16abcd8 100644 --- a/0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +++ b/0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch @@ -29,7 +29,7 @@ Signed-off-by: Renaud Métrich 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index 597111077bd..26014382608 100644 +index 597111077..260143826 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -135,20 +135,28 @@ query_mode (void) @@ -105,7 +105,7 @@ index 597111077bd..26014382608 100644 } diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h -index bcb4d9ba78f..9414dc1b996 100644 +index bcb4d9ba7..9414dc1b9 100644 --- a/include/grub/at_keyboard.h +++ b/include/grub/at_keyboard.h @@ -19,6 +19,10 @@ diff --git a/0150-grub-install-disable-support-for-EFI-platforms.patch b/0148-grub-install-disable-support-for-EFI-platforms.patch similarity index 74% rename from 0150-grub-install-disable-support-for-EFI-platforms.patch rename to 0148-grub-install-disable-support-for-EFI-platforms.patch index 41003e25..34d04d52 100644 --- a/0150-grub-install-disable-support-for-EFI-platforms.patch +++ b/0148-grub-install-disable-support-for-EFI-platforms.patch @@ -19,14 +19,14 @@ build-time option. Resolves: rhbz#1737444 Signed-off-by: Jan Hlavac +[rharwood: drop man page] --- util/grub-install.c | 37 ++++++++++++++++--------------------- docs/grub.texi | 7 +++++++ - util/grub-install.8 | 4 +++- - 3 files changed, 26 insertions(+), 22 deletions(-) + 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index a2bec7446cb..5babc7af551 100644 +index a2bec7446..5babc7af5 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -899,6 +899,22 @@ main (int argc, char *argv[]) @@ -82,7 +82,7 @@ index a2bec7446cb..5babc7af551 100644 { grub_fs_t fs; diff --git a/docs/grub.texi b/docs/grub.texi -index 04ed6ac1f07..4870faaa00a 100644 +index 04ed6ac1f..4870faaa0 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -6509,6 +6509,13 @@ grub2-install @var{install_device} @@ -99,22 +99,3 @@ index 04ed6ac1f07..4870faaa00a 100644 @command{grub2-install} accepts the following options: @table @option -diff --git a/util/grub-install.8 b/util/grub-install.8 -index 1db89e94b3b..811d441b16c 100644 ---- a/util/grub-install.8 -+++ b/util/grub-install.8 -@@ -1,4 +1,4 @@ --.TH GRUB-INSTALL 1 "Wed Feb 26 2014" -+.TH GRUB-INSTALL 1 "Fri Nov 20 2020" - .SH NAME - \fBgrub-install\fR \(em Install GRUB on a device. - -@@ -31,6 +31,8 @@ - .SH DESCRIPTION - \fBgrub-install\fR installs GRUB onto a device. This includes copying GRUB images into the target directory (generally \fI/boot/grub\fR), and on some platforms may also include installing GRUB onto a boot sector. - -+In order to support UEFI Secure Boot, the resulting GRUB EFI binary must be signed by a recognized private key. For this reason, for EFI platforms, most distributions also ship prebuilt GRUB EFI binaries signed by a distribution-specific private key. In this case, however, the \fBgrub-install\fR utility should not be used because it would overwrite the signed EFI binary. -+ - .SH OPTIONS - .TP - \fB--modules\fR=\fIMODULES\fR\! diff --git a/0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 93% rename from 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch index d216284c..d0a1f680 100644 --- a/0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,10 +15,10 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index c6bd965f1f9..3c808a72230 100644 +index de707f7e0..f069d8403 100644 --- a/configure.ac +++ b/configure.ac -@@ -1613,6 +1613,17 @@ else +@@ -1586,6 +1586,17 @@ else fi AC_SUBST([BOOT_TIME_STATS]) @@ -36,7 +36,7 @@ index c6bd965f1f9..3c808a72230 100644 AC_ARG_ENABLE([grub-emu-sdl], [AS_HELP_STRING([--enable-grub-emu-sdl], [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) -@@ -2194,6 +2205,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) +@@ -2167,6 +2178,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) @@ -44,7 +44,7 @@ index c6bd965f1f9..3c808a72230 100644 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) -@@ -2289,6 +2301,12 @@ else +@@ -2262,6 +2274,12 @@ else echo With boot time statistics: No fi @@ -58,7 +58,7 @@ index c6bd965f1f9..3c808a72230 100644 echo efiemu runtime: Yes else diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 578bf51a5fc..9f54b6b7d2d 100644 +index 578bf51a5..9f54b6b7d 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -25,6 +25,9 @@ @@ -99,7 +99,7 @@ index 578bf51a5fc..9f54b6b7d2d 100644 va_start (args, fmt); grub_vprintf (fmt, args); diff --git a/config.h.in b/config.h.in -index c7e316f0f1f..c80e3e0aba3 100644 +index c7e316f0f..c80e3e0ab 100644 --- a/config.h.in +++ b/config.h.in @@ -12,6 +12,7 @@ diff --git a/0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 97% rename from 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch index cbb1a38e..71fa73ab 100644 --- a/0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +++ b/0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch @@ -13,7 +13,7 @@ Signed-off-by: Renaud Métrich 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c -index e1b0e073e09..05a28ab1429 100644 +index e1b0e073e..05a28ab14 100644 --- a/grub-core/kern/disk.c +++ b/grub-core/kern/disk.c @@ -285,6 +285,8 @@ grub_disk_open (const char *name) diff --git a/0153-Introduce-function-grub_debug_is_enabled-void-return.patch b/0151-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 95% rename from 0153-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0151-Introduce-function-grub_debug_is_enabled-void-return.patch index 4e4718b7..ef33974f 100644 --- a/0153-Introduce-function-grub_debug_is_enabled-void-return.patch +++ b/0151-Introduce-function-grub_debug_is_enabled-void-return.patch @@ -14,7 +14,7 @@ Signed-off-by: Renaud Métrich 2 files changed, 14 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 9f54b6b7d2d..a186ad3dd41 100644 +index 9f54b6b7d..a186ad3dd 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -163,6 +163,19 @@ int grub_err_printf (const char *fmt, ...) @@ -38,7 +38,7 @@ index 9f54b6b7d2d..a186ad3dd41 100644 grub_debug_enabled (const char * condition) { diff --git a/include/grub/misc.h b/include/grub/misc.h -index 3adc4036e3b..6c4aa85ac50 100644 +index 3adc4036e..6c4aa85ac 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -340,6 +340,7 @@ grub_puts (const char *s) diff --git a/0154-Don-t-clear-screen-when-debugging-is-enabled.patch b/0152-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 96% rename from 0154-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0152-Don-t-clear-screen-when-debugging-is-enabled.patch index d17b080c..ee987e72 100644 --- a/0154-Don-t-clear-screen-when-debugging-is-enabled.patch +++ b/0152-Don-t-clear-screen-when-debugging-is-enabled.patch @@ -14,7 +14,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 1970e4816a8..4ebdbd228d4 100644 +index 1970e4816..4ebdbd228 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -215,8 +215,9 @@ grub_normal_init_page (struct grub_term_output *term, diff --git a/0155-grub_file_-instrumentation-new-file-debug-tag.patch b/0153-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 98% rename from 0155-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0153-grub_file_-instrumentation-new-file-debug-tag.patch index 0cc6b8c9..da9c4ab4 100644 --- a/0155-grub_file_-instrumentation-new-file-debug-tag.patch +++ b/0153-grub_file_-instrumentation-new-file-debug-tag.patch @@ -12,7 +12,7 @@ Signed-off-by: Renaud Métrich 1 file changed, 14 insertions(+) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index 58454458c47..e19aea3e514 100644 +index 58454458c..e19aea3e5 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -66,6 +66,8 @@ grub_file_open (const char *name, enum grub_file_type type) diff --git a/0156-ieee1275-Avoiding-many-unecessary-open-close.patch b/0154-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 99% rename from 0156-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0154-ieee1275-Avoiding-many-unecessary-open-close.patch index 6a0ad75b..68b89ffc 100644 --- a/0156-ieee1275-Avoiding-many-unecessary-open-close.patch +++ b/0154-ieee1275-Avoiding-many-unecessary-open-close.patch @@ -9,7 +9,7 @@ Signed-off-by: Diego Domingos 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index 03674cb477e..ea7f78ac7d8 100644 +index 03674cb47..ea7f78ac7 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -44,7 +44,7 @@ struct ofdisk_hash_ent diff --git a/0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 98% rename from 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch index 9fa02bb1..94f4eb7f 100644 --- a/0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +++ b/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch @@ -15,7 +15,7 @@ Signed-off-by: Diego Domingos 1 file changed, 49 insertions(+) diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index a6153d35954..0f5d54e9f2d 100644 +index a6153d359..0f5d54e9f 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c @@ -350,6 +350,38 @@ of_path_of_ide(const char *sys_devname __attribute__((unused)), const char *devi diff --git a/0158-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 98% rename from 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch index 6f1c21b3..8bb19345 100644 --- a/0158-ieee1275-powerpc-enables-device-mapper-discovery.patch +++ b/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch @@ -17,7 +17,7 @@ Signed-off-by: Diego Domingos 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index 0f5d54e9f2d..cc849d9c94c 100644 +index 0f5d54e9f..cc849d9c9 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c @@ -37,6 +37,7 @@ diff --git a/0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 99% rename from 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch index 01e7e678..7b8150a9 100644 --- a/0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +++ b/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch @@ -35,7 +35,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 96 insertions(+), 25 deletions(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index 26014382608..dac0f946fe6 100644 +index 260143826..dac0f946f 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -31,6 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 96% rename from 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch index ef644149..9e42d64d 100644 --- a/0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch +++ b/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -33,15 +33,6 @@ under this scheme. Signed-off-by: Daniel Axtens Signed-off-by: Rashmica Gupta - ---- - -You can experiment with this code with a patched version of SLOF -that verifies these signatures. You can find one at: - https://github.com/daxtens/SLOF - -I will be proposing this for inclusion in a future Power Architecture -Platform Reference (PAPR). --- util/grub-install-common.c | 18 ++++++++++++++---- util/grub-mkimage.c | 15 +++++++++++++-- @@ -52,7 +43,7 @@ Platform Reference (PAPR). 6 files changed, 80 insertions(+), 17 deletions(-) diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 4e212e690c5..a74fee16e22 100644 +index 4e212e690..a74fee16e 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -461,10 +461,12 @@ static size_t npubkeys; @@ -108,7 +99,7 @@ index 4e212e690c5..a74fee16e22 100644 while (dc--) grub_install_pop_module (); diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index c0d55993702..8a53310548b 100644 +index c0d559937..8a5331054 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -84,6 +84,7 @@ static struct argp_option options[] = { @@ -162,7 +153,7 @@ index c0d55993702..8a53310548b 100644 if (grub_util_file_sync (fp) < 0) grub_util_error (_("cannot sync `%s': %s"), arguments.output ? : "stdout", diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index d78fa3e5330..393119486d3 100644 +index d78fa3e53..393119486 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -84,6 +84,15 @@ struct grub_ieee1275_note @@ -233,7 +224,7 @@ index d78fa3e5330..393119486d3 100644 char *str_start = (elf_img + sizeof (*ehdr) + phnum * sizeof (*phdr) + shnum * sizeof (*shdr)); diff --git a/util/mkimage.c b/util/mkimage.c -index a26cf76f72f..bab12276010 100644 +index a26cf76f7..bab122760 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -869,8 +869,9 @@ grub_install_generate_image (const char *dir, const char *prefix, @@ -265,7 +256,7 @@ index a26cf76f72f..bab12276010 100644 break; } diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index 7df3191f47e..cf4531e02b6 100644 +index 7df3191f4..cf4531e02 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -67,6 +67,9 @@ @@ -298,7 +289,7 @@ index 7df3191f47e..cf4531e02b6 100644 const char *sbat_path, const int disable_shim_lock); diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h -index 3819a67441c..6f1da89b9b6 100644 +index 3819a6744..6f1da89b9 100644 --- a/include/grub/util/mkimage.h +++ b/include/grub/util/mkimage.h @@ -51,12 +51,12 @@ grub_mkimage_load_image64 (const char *kernel_path, diff --git a/0161-docs-grub-Document-signing-grub-under-UEFI.patch b/0159-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 98% rename from 0161-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0159-docs-grub-Document-signing-grub-under-UEFI.patch index 9b9b19a7..328e5abd 100644 --- a/0161-docs-grub-Document-signing-grub-under-UEFI.patch +++ b/0159-docs-grub-Document-signing-grub-under-UEFI.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 4870faaa00a..365d1d6931b 100644 +index 4870faaa0..365d1d693 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -5817,6 +5817,7 @@ environment variables and commands are listed in the same order. diff --git a/0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 98% rename from 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch index 4d85d938..9e04af2b 100644 --- a/0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch +++ b/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 42 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 365d1d6931b..afbde7c1f7b 100644 +index 365d1d693..afbde7c1f 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -6087,6 +6087,48 @@ image works under UEFI secure boot and can maintain the secure-boot chain. It diff --git a/0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 96% rename from 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch index 6e46db01..1d8012dd 100644 --- a/0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +++ b/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch @@ -16,7 +16,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 11 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index 2f76e6b0437..20d870f2a47 100644 +index 2f76e6b04..20d870f2a 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -245,11 +245,22 @@ grub_dl_get (const char *name) diff --git a/0164-pgp-factor-out-rsa_pad.patch b/0162-pgp-factor-out-rsa_pad.patch similarity index 97% rename from 0164-pgp-factor-out-rsa_pad.patch rename to 0162-pgp-factor-out-rsa_pad.patch index a8154e74..1c566b21 100644 --- a/0164-pgp-factor-out-rsa_pad.patch +++ b/0162-pgp-factor-out-rsa_pad.patch @@ -27,7 +27,7 @@ Signed-off-by: Daniel Axtens create mode 100644 include/grub/pkcs1_v15.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 81fc274148e..97347ae76f9 100644 +index 81fc27414..97347ae76 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2510,6 +2510,14 @@ module = { @@ -46,7 +46,7 @@ index 81fc274148e..97347ae76f9 100644 name = all_video; common = lib/fake_module.c; diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 5daa1e9d00c..2408db4994f 100644 +index 5daa1e9d0..2408db499 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -24,6 +24,7 @@ @@ -93,7 +93,7 @@ index 5daa1e9d00c..2408db4994f 100644 struct grub_pubkey_context diff --git a/grub-core/lib/pkcs1_v15.c b/grub-core/lib/pkcs1_v15.c new file mode 100644 -index 00000000000..dbacd563d01 +index 000000000..dbacd563d --- /dev/null +++ b/grub-core/lib/pkcs1_v15.c @@ -0,0 +1,59 @@ @@ -158,7 +158,7 @@ index 00000000000..dbacd563d01 +} diff --git a/include/grub/pkcs1_v15.h b/include/grub/pkcs1_v15.h new file mode 100644 -index 00000000000..5c338c84a15 +index 000000000..5c338c84a --- /dev/null +++ b/include/grub/pkcs1_v15.h @@ -0,0 +1,27 @@ diff --git a/0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 96% rename from 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch index 763cdc63..b104617d 100644 --- a/0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +++ b/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch @@ -40,7 +40,7 @@ Signed-off-by: Daniel Axtens 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 2408db4994f..355a43844ac 100644 +index 2408db499..355a43844 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -147,10 +147,6 @@ const char *hashes[] = { @@ -55,7 +55,7 @@ index 2408db4994f..355a43844ac 100644 dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval, const gcry_md_spec_t *hash, struct grub_public_subkey *sk); diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index ca334d5a40e..c578128a59d 100644 +index ca334d5a4..c578128a5 100644 --- a/grub-core/lib/crypto.c +++ b/grub-core/lib/crypto.c @@ -121,6 +121,10 @@ grub_md_unregister (gcry_md_spec_t *cipher) diff --git a/0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 94% rename from 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch index a09cab19..fed345e3 100644 --- a/0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +++ b/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch @@ -23,7 +23,7 @@ Signed-off-by: Daniel Axtens 3 files changed, 10 insertions(+) diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h -index 7217138ffd6..591dbf3289d 100644 +index 7217138ff..591dbf328 100644 --- a/grub-core/lib/posix_wrap/limits.h +++ b/grub-core/lib/posix_wrap/limits.h @@ -37,5 +37,6 @@ @@ -34,7 +34,7 @@ index 7217138ffd6..591dbf3289d 100644 #endif diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h -index 7a8d385e973..4634db09f29 100644 +index 7a8d385e9..4634db09f 100644 --- a/grub-core/lib/posix_wrap/stdlib.h +++ b/grub-core/lib/posix_wrap/stdlib.h @@ -58,4 +58,12 @@ abs (int c) @@ -51,7 +51,7 @@ index 7a8d385e973..4634db09f29 100644 + #endif diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h -index 854eb0122ef..f63412c8da0 100644 +index 854eb0122..f63412c8d 100644 --- a/grub-core/lib/posix_wrap/sys/types.h +++ b/grub-core/lib/posix_wrap/sys/types.h @@ -51,6 +51,7 @@ typedef grub_uint8_t byte; diff --git a/0167-libtasn1-import-libtasn1-4.16.0.patch b/0165-libtasn1-import-libtasn1-4.16.0.patch similarity index 99% rename from 0167-libtasn1-import-libtasn1-4.16.0.patch rename to 0165-libtasn1-import-libtasn1-4.16.0.patch index 89552c88..7a7b05d4 100644 --- a/0167-libtasn1-import-libtasn1-4.16.0.patch +++ b/0165-libtasn1-import-libtasn1-4.16.0.patch @@ -53,7 +53,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/lib/libtasn1/lib/coding.c b/grub-core/lib/libtasn1/lib/coding.c new file mode 100644 -index 00000000000..245ea64cf0a +index 000000000..245ea64cf --- /dev/null +++ b/grub-core/lib/libtasn1/lib/coding.c @@ -0,0 +1,1415 @@ @@ -1474,7 +1474,7 @@ index 00000000000..245ea64cf0a +} diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c new file mode 100644 -index 00000000000..ff04eb778cb +index 000000000..ff04eb778 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -0,0 +1,2478 @@ @@ -3958,7 +3958,7 @@ index 00000000000..ff04eb778cb +} diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c new file mode 100644 -index 00000000000..997eb2725dc +index 000000000..997eb2725 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/element.c @@ -0,0 +1,1111 @@ @@ -5075,7 +5075,7 @@ index 00000000000..997eb2725dc +} diff --git a/grub-core/lib/libtasn1/lib/errors.c b/grub-core/lib/libtasn1/lib/errors.c new file mode 100644 -index 00000000000..cee74daf795 +index 000000000..cee74daf7 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/errors.c @@ -0,0 +1,100 @@ @@ -5181,7 +5181,7 @@ index 00000000000..cee74daf795 +} diff --git a/grub-core/lib/libtasn1/lib/gstr.c b/grub-core/lib/libtasn1/lib/gstr.c new file mode 100644 -index 00000000000..e91a3a151c0 +index 000000000..e91a3a151 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/gstr.c @@ -0,0 +1,74 @@ @@ -5261,7 +5261,7 @@ index 00000000000..e91a3a151c0 +} diff --git a/grub-core/lib/libtasn1/lib/parser_aux.c b/grub-core/lib/libtasn1/lib/parser_aux.c new file mode 100644 -index 00000000000..d5dbbf8765d +index 000000000..d5dbbf876 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/parser_aux.c @@ -0,0 +1,1173 @@ @@ -6440,7 +6440,7 @@ index 00000000000..d5dbbf8765d +} diff --git a/grub-core/lib/libtasn1/lib/structure.c b/grub-core/lib/libtasn1/lib/structure.c new file mode 100644 -index 00000000000..8189c56a4c9 +index 000000000..8189c56a4 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/structure.c @@ -0,0 +1,1220 @@ @@ -7666,7 +7666,7 @@ index 00000000000..8189c56a4c9 +} diff --git a/grub-core/lib/libtasn1/lib/element.h b/grub-core/lib/libtasn1/lib/element.h new file mode 100644 -index 00000000000..440a33f4bb1 +index 000000000..440a33f4b --- /dev/null +++ b/grub-core/lib/libtasn1/lib/element.h @@ -0,0 +1,40 @@ @@ -7712,7 +7712,7 @@ index 00000000000..440a33f4bb1 +#endif diff --git a/grub-core/lib/libtasn1/lib/gstr.h b/grub-core/lib/libtasn1/lib/gstr.h new file mode 100644 -index 00000000000..48229844ff3 +index 000000000..48229844f --- /dev/null +++ b/grub-core/lib/libtasn1/lib/gstr.h @@ -0,0 +1,47 @@ @@ -7765,7 +7765,7 @@ index 00000000000..48229844ff3 +#endif /* GSTR_H */ diff --git a/grub-core/lib/libtasn1/lib/int.h b/grub-core/lib/libtasn1/lib/int.h new file mode 100644 -index 00000000000..ea1625786c1 +index 000000000..ea1625786 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/int.h @@ -0,0 +1,221 @@ @@ -7992,7 +7992,7 @@ index 00000000000..ea1625786c1 +#endif /* INT_H */ diff --git a/grub-core/lib/libtasn1/lib/parser_aux.h b/grub-core/lib/libtasn1/lib/parser_aux.h new file mode 100644 -index 00000000000..598e684b355 +index 000000000..598e684b3 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/parser_aux.h @@ -0,0 +1,172 @@ @@ -8170,7 +8170,7 @@ index 00000000000..598e684b355 +#endif diff --git a/grub-core/lib/libtasn1/lib/structure.h b/grub-core/lib/libtasn1/lib/structure.h new file mode 100644 -index 00000000000..99e685da07a +index 000000000..99e685da0 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/structure.h @@ -0,0 +1,45 @@ @@ -8221,7 +8221,7 @@ index 00000000000..99e685da07a +#endif diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h new file mode 100644 -index 00000000000..6fd7a30dc35 +index 000000000..6fd7a30dc --- /dev/null +++ b/include/grub/libtasn1.h @@ -0,0 +1,588 @@ @@ -8815,7 +8815,7 @@ index 00000000000..6fd7a30dc35 +#endif /* LIBTASN1_H */ diff --git a/grub-core/lib/libtasn1/LICENSE b/grub-core/lib/libtasn1/LICENSE new file mode 100644 -index 00000000000..e8b3628db9b +index 000000000..e8b3628db --- /dev/null +++ b/grub-core/lib/libtasn1/LICENSE @@ -0,0 +1,16 @@ @@ -8837,7 +8837,7 @@ index 00000000000..e8b3628db9b +note that the range specifies every single year in that closed interval. diff --git a/grub-core/lib/libtasn1/README.md b/grub-core/lib/libtasn1/README.md new file mode 100644 -index 00000000000..50a8642296c +index 000000000..50a864229 --- /dev/null +++ b/grub-core/lib/libtasn1/README.md @@ -0,0 +1,91 @@ diff --git a/0168-libtasn1-disable-code-not-needed-in-grub.patch b/0166-libtasn1-disable-code-not-needed-in-grub.patch similarity index 97% rename from 0168-libtasn1-disable-code-not-needed-in-grub.patch rename to 0166-libtasn1-disable-code-not-needed-in-grub.patch index 00f55888..082cdb9b 100644 --- a/0168-libtasn1-disable-code-not-needed-in-grub.patch +++ b/0166-libtasn1-disable-code-not-needed-in-grub.patch @@ -25,7 +25,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/grub-core/lib/libtasn1/lib/coding.c b/grub-core/lib/libtasn1/lib/coding.c -index 245ea64cf0a..52def598368 100644 +index 245ea64cf..52def5983 100644 --- a/grub-core/lib/libtasn1/lib/coding.c +++ b/grub-core/lib/libtasn1/lib/coding.c @@ -30,11 +30,11 @@ @@ -99,7 +99,7 @@ index 245ea64cf0a..52def598368 100644 +#endif \ No newline at end of file diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c -index ff04eb778cb..42f9a92b5d4 100644 +index ff04eb778..42f9a92b5 100644 --- a/grub-core/lib/libtasn1/lib/decoding.c +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -1613,6 +1613,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len, @@ -119,7 +119,7 @@ index ff04eb778cb..42f9a92b5d4 100644 /** * asn1_der_decoding_startEnd: diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c -index 997eb2725dc..539008d8e94 100644 +index 997eb2725..539008d8e 100644 --- a/grub-core/lib/libtasn1/lib/element.c +++ b/grub-core/lib/libtasn1/lib/element.c @@ -191,7 +191,7 @@ _asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcache) @@ -141,7 +141,7 @@ index 997eb2725dc..539008d8e94 100644 #define PUT_VALUE( ptr, ptr_size, data, data_size) \ *len = data_size; \ diff --git a/grub-core/lib/libtasn1/lib/errors.c b/grub-core/lib/libtasn1/lib/errors.c -index cee74daf795..42785e8622b 100644 +index cee74daf7..42785e862 100644 --- a/grub-core/lib/libtasn1/lib/errors.c +++ b/grub-core/lib/libtasn1/lib/errors.c @@ -57,6 +57,8 @@ static const libtasn1_error_entry error_algorithms[] = { @@ -162,7 +162,7 @@ index cee74daf795..42785e8622b 100644 /** * asn1_strerror: diff --git a/grub-core/lib/libtasn1/lib/structure.c b/grub-core/lib/libtasn1/lib/structure.c -index 8189c56a4c9..fcfde01a393 100644 +index 8189c56a4..fcfde01a3 100644 --- a/grub-core/lib/libtasn1/lib/structure.c +++ b/grub-core/lib/libtasn1/lib/structure.c @@ -76,7 +76,7 @@ _asn1_find_left (asn1_node_const node) @@ -218,7 +218,7 @@ index 8189c56a4c9..fcfde01a393 100644 /** * asn1_dup_node: diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h -index 6fd7a30dc35..785eda2ae3f 100644 +index 6fd7a30dc..785eda2ae 100644 --- a/include/grub/libtasn1.h +++ b/include/grub/libtasn1.h @@ -319,6 +319,8 @@ typedef struct asn1_data_node_st asn1_data_node_st; diff --git a/0169-libtasn1-changes-for-grub-compatibility.patch b/0167-libtasn1-changes-for-grub-compatibility.patch similarity index 96% rename from 0169-libtasn1-changes-for-grub-compatibility.patch rename to 0167-libtasn1-changes-for-grub-compatibility.patch index 9b2275ca..35ceb569 100644 --- a/0169-libtasn1-changes-for-grub-compatibility.patch +++ b/0167-libtasn1-changes-for-grub-compatibility.patch @@ -35,7 +35,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 22 insertions(+), 33 deletions(-) diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c -index 42f9a92b5d4..7856858b272 100644 +index 42f9a92b5..7856858b2 100644 --- a/grub-core/lib/libtasn1/lib/decoding.c +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -32,7 +32,8 @@ @@ -71,7 +71,7 @@ index 42f9a92b5d4..7856858b272 100644 result = asn1_create_element (definitions, name, &aux); if (result == ASN1_SUCCESS) diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c -index 539008d8e94..ed761ff56bd 100644 +index 539008d8e..ed761ff56 100644 --- a/grub-core/lib/libtasn1/lib/element.c +++ b/grub-core/lib/libtasn1/lib/element.c @@ -30,9 +30,10 @@ @@ -87,7 +87,7 @@ index 539008d8e94..ed761ff56bd 100644 _asn1_hierarchical_name (asn1_node_const node, char *name, int name_size) { diff --git a/grub-core/lib/libtasn1/lib/gstr.c b/grub-core/lib/libtasn1/lib/gstr.c -index e91a3a151c0..e33875c2c7c 100644 +index e91a3a151..e33875c2c 100644 --- a/grub-core/lib/libtasn1/lib/gstr.c +++ b/grub-core/lib/libtasn1/lib/gstr.c @@ -36,13 +36,13 @@ _asn1_str_cat (char *dest, size_t dest_tot_size, const char *src) @@ -107,7 +107,7 @@ index e91a3a151c0..e33875c2c7c 100644 } } diff --git a/grub-core/lib/libtasn1/lib/parser_aux.c b/grub-core/lib/libtasn1/lib/parser_aux.c -index d5dbbf8765d..89c9be69dc2 100644 +index d5dbbf876..89c9be69d 100644 --- a/grub-core/lib/libtasn1/lib/parser_aux.c +++ b/grub-core/lib/libtasn1/lib/parser_aux.c @@ -26,7 +26,8 @@ @@ -139,7 +139,7 @@ index d5dbbf8765d..89c9be69dc2 100644 temp[start + count] = '0' + (char) r; count++; diff --git a/grub-core/lib/libtasn1/lib/int.h b/grub-core/lib/libtasn1/lib/int.h -index ea1625786c1..4a568efee9c 100644 +index ea1625786..4a568efee 100644 --- a/grub-core/lib/libtasn1/lib/int.h +++ b/grub-core/lib/libtasn1/lib/int.h @@ -35,7 +35,7 @@ @@ -161,7 +161,7 @@ index ea1625786c1..4a568efee9c 100644 #if SIZEOF_UNSIGNED_LONG_INT == 8 # define _asn1_strtou64(n,e,b) strtoul((const char *) n, e, b) diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h -index 785eda2ae3f..28dbf16c4e0 100644 +index 785eda2ae..28dbf16c4 100644 --- a/include/grub/libtasn1.h +++ b/include/grub/libtasn1.h @@ -38,29 +38,15 @@ diff --git a/0170-libtasn1-compile-into-asn1-module.patch b/0168-libtasn1-compile-into-asn1-module.patch similarity index 97% rename from 0170-libtasn1-compile-into-asn1-module.patch rename to 0168-libtasn1-compile-into-asn1-module.patch index 67be4e87..fe6ffddc 100644 --- a/0170-libtasn1-compile-into-asn1-module.patch +++ b/0168-libtasn1-compile-into-asn1-module.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/lib/libtasn1_wrap/wrap.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 97347ae76f9..21d2c541850 100644 +index 97347ae76..21d2c5418 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2576,3 +2576,18 @@ module = { @@ -38,7 +38,7 @@ index 97347ae76f9..21d2c541850 100644 +}; diff --git a/grub-core/lib/libtasn1_wrap/wrap.c b/grub-core/lib/libtasn1_wrap/wrap.c new file mode 100644 -index 00000000000..622ba942e33 +index 000000000..622ba942e --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap.c @@ -0,0 +1,26 @@ diff --git a/0171-test_asn1-test-module-for-libtasn1.patch b/0169-test_asn1-test-module-for-libtasn1.patch similarity index 99% rename from 0171-test_asn1-test-module-for-libtasn1.patch rename to 0169-test_asn1-test-module-for-libtasn1.patch index b659558b..6bacdb96 100644 --- a/0171-test_asn1-test-module-for-libtasn1.patch +++ b/0169-test_asn1-test-module-for-libtasn1.patch @@ -51,7 +51,7 @@ Signed-off-by: Daniel Axtens create mode 100644 tests/test_asn1.in diff --git a/Makefile.util.def b/Makefile.util.def -index 9927c2cfd6a..3f191aa8095 100644 +index 9927c2cfd..3f191aa80 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1306,6 +1306,12 @@ script = { @@ -68,7 +68,7 @@ index 9927c2cfd6a..3f191aa8095 100644 testcase; name = example_unit_test; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 21d2c541850..b4aaccf7b57 100644 +index 21d2c5418..b4aaccf7b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2591,3 +2591,16 @@ module = { @@ -90,7 +90,7 @@ index 21d2c541850..b4aaccf7b57 100644 +}; diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c new file mode 100644 -index 00000000000..534e304521e +index 000000000..534e30452 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c @@ -0,0 +1,61 @@ @@ -157,7 +157,7 @@ index 00000000000..534e304521e +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c b/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c new file mode 100644 -index 00000000000..f48aea0ef8b +index 000000000..f48aea0ef --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c @@ -0,0 +1,138 @@ @@ -301,7 +301,7 @@ index 00000000000..f48aea0ef8b +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_simple.c b/grub-core/lib/libtasn1_wrap/tests/Test_simple.c new file mode 100644 -index 00000000000..9f01006ddf4 +index 000000000..9f01006dd --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_simple.c @@ -0,0 +1,207 @@ @@ -514,7 +514,7 @@ index 00000000000..9f01006ddf4 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_strings.c b/grub-core/lib/libtasn1_wrap/tests/Test_strings.c new file mode 100644 -index 00000000000..dbe1474b204 +index 000000000..dbe1474b2 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_strings.c @@ -0,0 +1,150 @@ @@ -670,7 +670,7 @@ index 00000000000..dbe1474b204 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c b/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c new file mode 100644 -index 00000000000..d367bbfb5a7 +index 000000000..d367bbfb5 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c @@ -0,0 +1,116 @@ @@ -792,7 +792,7 @@ index 00000000000..d367bbfb5a7 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c b/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c new file mode 100644 -index 00000000000..3a83b58c59f +index 000000000..3a83b58c5 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c @@ -0,0 +1,120 @@ @@ -918,7 +918,7 @@ index 00000000000..3a83b58c59f +} diff --git a/grub-core/lib/libtasn1_wrap/tests/octet-string.c b/grub-core/lib/libtasn1_wrap/tests/octet-string.c new file mode 100644 -index 00000000000..d8a049e8df0 +index 000000000..d8a049e8d --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/octet-string.c @@ -0,0 +1,211 @@ @@ -1135,7 +1135,7 @@ index 00000000000..d8a049e8df0 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/reproducers.c b/grub-core/lib/libtasn1_wrap/tests/reproducers.c new file mode 100644 -index 00000000000..dc7268d4c6c +index 000000000..dc7268d4c --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/reproducers.c @@ -0,0 +1,81 @@ @@ -1222,7 +1222,7 @@ index 00000000000..dc7268d4c6c +} diff --git a/grub-core/lib/libtasn1_wrap/wrap_tests.c b/grub-core/lib/libtasn1_wrap/wrap_tests.c new file mode 100644 -index 00000000000..75fcd21f0d5 +index 000000000..75fcd21f0 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap_tests.c @@ -0,0 +1,75 @@ @@ -1303,7 +1303,7 @@ index 00000000000..75fcd21f0d5 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h new file mode 100644 -index 00000000000..1e7d3d64f55 +index 000000000..1e7d3d64f --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h @@ -0,0 +1,32 @@ @@ -1341,7 +1341,7 @@ index 00000000000..1e7d3d64f55 +}; diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h new file mode 100644 -index 00000000000..e2561e5ec6d +index 000000000..e2561e5ec --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h @@ -0,0 +1,36 @@ @@ -1383,7 +1383,7 @@ index 00000000000..e2561e5ec6d +}; diff --git a/grub-core/lib/libtasn1_wrap/wrap_tests.h b/grub-core/lib/libtasn1_wrap/wrap_tests.h new file mode 100644 -index 00000000000..555e56dd202 +index 000000000..555e56dd2 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap_tests.h @@ -0,0 +1,38 @@ @@ -1426,7 +1426,7 @@ index 00000000000..555e56dd202 + +#endif diff --git a/.gitignore b/.gitignore -index 594d0134d33..856e69bc5c1 100644 +index 594d0134d..856e69bc5 100644 --- a/.gitignore +++ b/.gitignore @@ -264,6 +264,7 @@ widthspec.bin @@ -1439,7 +1439,7 @@ index 594d0134d33..856e69bc5c1 100644 /tests/syslinux/ubuntu10.04_grub.cfg diff --git a/tests/test_asn1.in b/tests/test_asn1.in new file mode 100644 -index 00000000000..8173c5c270e +index 000000000..8173c5c27 --- /dev/null +++ b/tests/test_asn1.in @@ -0,0 +1,12 @@ diff --git a/0172-grub-install-support-embedding-x509-certificates.patch b/0170-grub-install-support-embedding-x509-certificates.patch similarity index 97% rename from 0172-grub-install-support-embedding-x509-certificates.patch rename to 0170-grub-install-support-embedding-x509-certificates.patch index 089e34fd..c3c83a58 100644 --- a/0172-grub-install-support-embedding-x509-certificates.patch +++ b/0170-grub-install-support-embedding-x509-certificates.patch @@ -20,7 +20,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 80 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 355a43844ac..b81ac0ae46c 100644 +index 355a43844..b81ac0ae4 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -944,7 +944,7 @@ GRUB_MOD_INIT(pgp) @@ -33,7 +33,7 @@ index 355a43844ac..b81ac0ae46c 100644 pseudo_file.fs = &pseudo_fs; diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index a74fee16e22..c603f5b308d 100644 +index a74fee16e..c603f5b30 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -460,6 +460,8 @@ static char **pubkeys; @@ -95,7 +95,7 @@ index a74fee16e22..c603f5b308d 100644 disable_shim_lock); while (dc--) diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index 8a53310548b..e1f1112784a 100644 +index 8a5331054..e1f111278 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -75,7 +75,8 @@ static struct argp_option options[] = { @@ -142,7 +142,7 @@ index 8a53310548b..e1f1112784a 100644 arguments.appsig_size, arguments.comp, arguments.dtb, arguments.sbat, diff --git a/util/mkimage.c b/util/mkimage.c -index bab12276010..8319e8dfbde 100644 +index bab122760..8319e8dfb 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -867,7 +867,8 @@ void @@ -212,7 +212,7 @@ index bab12276010..8319e8dfbde 100644 { struct grub_module_header *header; diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index 55849777eaa..98edc0863f6 100644 +index 55849777e..98edc0863 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -30,7 +30,9 @@ enum @@ -227,7 +227,7 @@ index 55849777eaa..98edc0863f6 100644 /* The module header. */ diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index cf4531e02b6..51f3b13ac13 100644 +index cf4531e02..51f3b13ac 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -67,6 +67,8 @@ diff --git a/0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 99% rename from 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch index 7b7d70c4..a9ee5b4c 100644 --- a/0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +++ b/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch @@ -22,7 +22,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/commands/appendedsig/gnutls_asn1_tab.c b/grub-core/commands/appendedsig/gnutls_asn1_tab.c new file mode 100644 -index 00000000000..ddd1314e63b +index 000000000..ddd1314e6 --- /dev/null +++ b/grub-core/commands/appendedsig/gnutls_asn1_tab.c @@ -0,0 +1,121 @@ @@ -149,7 +149,7 @@ index 00000000000..ddd1314e63b +}; diff --git a/grub-core/commands/appendedsig/pkix_asn1_tab.c b/grub-core/commands/appendedsig/pkix_asn1_tab.c new file mode 100644 -index 00000000000..adef69d95ce +index 000000000..adef69d95 --- /dev/null +++ b/grub-core/commands/appendedsig/pkix_asn1_tab.c @@ -0,0 +1,484 @@ diff --git a/0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 99% rename from 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch index 04bf1df4..7fb56881 100644 --- a/0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +++ b/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch @@ -29,7 +29,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/commands/appendedsig/asn1util.c b/grub-core/commands/appendedsig/asn1util.c new file mode 100644 -index 00000000000..eff095a9df2 +index 000000000..eff095a9d --- /dev/null +++ b/grub-core/commands/appendedsig/asn1util.c @@ -0,0 +1,102 @@ @@ -137,7 +137,7 @@ index 00000000000..eff095a9df2 +} diff --git a/grub-core/commands/appendedsig/pkcs7.c b/grub-core/commands/appendedsig/pkcs7.c new file mode 100644 -index 00000000000..dc6afe203f7 +index 000000000..dc6afe203 --- /dev/null +++ b/grub-core/commands/appendedsig/pkcs7.c @@ -0,0 +1,305 @@ @@ -448,7 +448,7 @@ index 00000000000..dc6afe203f7 +} diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c new file mode 100644 -index 00000000000..2b38b3670a2 +index 000000000..2b38b3670 --- /dev/null +++ b/grub-core/commands/appendedsig/x509.c @@ -0,0 +1,958 @@ @@ -1412,7 +1412,7 @@ index 00000000000..2b38b3670a2 +} diff --git a/grub-core/commands/appendedsig/appendedsig.h b/grub-core/commands/appendedsig/appendedsig.h new file mode 100644 -index 00000000000..9792ef3901e +index 000000000..9792ef390 --- /dev/null +++ b/grub-core/commands/appendedsig/appendedsig.h @@ -0,0 +1,110 @@ diff --git a/0175-appended-signatures-support-verifying-appended-signa.patch b/0173-appended-signatures-support-verifying-appended-signa.patch similarity index 99% rename from 0175-appended-signatures-support-verifying-appended-signa.patch rename to 0173-appended-signatures-support-verifying-appended-signa.patch index f655bb51..95451282 100644 --- a/0175-appended-signatures-support-verifying-appended-signa.patch +++ b/0173-appended-signatures-support-verifying-appended-signa.patch @@ -30,7 +30,7 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/appendedsig/appendedsig.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index b4aaccf7b57..77321d218c8 100644 +index b4aaccf7b..77321d218 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -980,6 +980,18 @@ module = { @@ -54,7 +54,7 @@ index b4aaccf7b57..77321d218c8 100644 common = commands/hdparm.c; diff --git a/grub-core/commands/appendedsig/appendedsig.c b/grub-core/commands/appendedsig/appendedsig.c new file mode 100644 -index 00000000000..bf8b18b6205 +index 000000000..bf8b18b62 --- /dev/null +++ b/grub-core/commands/appendedsig/appendedsig.c @@ -0,0 +1,645 @@ @@ -704,7 +704,7 @@ index 00000000000..bf8b18b6205 + grub_unregister_command (cmd_distrust); +} diff --git a/include/grub/file.h b/include/grub/file.h -index 31567483ccf..96827a4f896 100644 +index 31567483c..96827a4f8 100644 --- a/include/grub/file.h +++ b/include/grub/file.h @@ -80,6 +80,8 @@ enum grub_file_type diff --git a/0176-appended-signatures-verification-tests.patch b/0174-appended-signatures-verification-tests.patch similarity index 99% rename from 0176-appended-signatures-verification-tests.patch rename to 0174-appended-signatures-verification-tests.patch index 9f6c3c62..12ae1e83 100644 --- a/0176-appended-signatures-verification-tests.patch +++ b/0174-appended-signatures-verification-tests.patch @@ -17,7 +17,7 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/tests/appended_signatures.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 77321d218c8..6bddc841b85 100644 +index 77321d218..6bddc841b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2161,6 +2161,12 @@ module = { @@ -35,7 +35,7 @@ index 77321d218c8..6bddc841b85 100644 common = tests/signature_test.c; diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c new file mode 100644 -index 00000000000..88a485200d8 +index 000000000..88a485200 --- /dev/null +++ b/grub-core/tests/appended_signature_test.c @@ -0,0 +1,281 @@ @@ -321,7 +321,7 @@ index 00000000000..88a485200d8 + +GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c -index 96781fb39b5..403fa5c789a 100644 +index 96781fb39..403fa5c78 100644 --- a/grub-core/tests/lib/functional_test.c +++ b/grub-core/tests/lib/functional_test.c @@ -73,6 +73,7 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), @@ -334,7 +334,7 @@ index 96781fb39b5..403fa5c789a 100644 grub_dl_load ("ctz_test"); diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h new file mode 100644 -index 00000000000..aa3dc6278e3 +index 000000000..aa3dc6278 --- /dev/null +++ b/grub-core/tests/appended_signatures.h @@ -0,0 +1,557 @@ diff --git a/0177-appended-signatures-documentation.patch b/0175-appended-signatures-documentation.patch similarity index 99% rename from 0177-appended-signatures-documentation.patch rename to 0175-appended-signatures-documentation.patch index 864cfa31..c67bcc18 100644 --- a/0177-appended-signatures-documentation.patch +++ b/0175-appended-signatures-documentation.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 182 insertions(+), 17 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index afbde7c1f7b..4816be85611 100644 +index afbde7c1f..4816be856 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -3214,6 +3214,7 @@ These variables have special meaning to GRUB. diff --git a/0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 95% rename from 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch index 40c3b3e8..3e211b0b 100644 --- a/0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +++ b/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Axtens 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 6bddc841b85..3f3459b2c70 100644 +index 6bddc841b..3f3459b2c 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -323,6 +323,7 @@ kernel = { @@ -27,7 +27,7 @@ index 6bddc841b85..3f3459b2c70 100644 sparc64_ieee1275 = kern/sparc64/cache.S; sparc64_ieee1275 = kern/sparc64/dl.c; diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 937c1bc44cb..fc7d9712729 100644 +index 937c1bc44..fc7d97127 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -44,6 +44,7 @@ @@ -79,7 +79,7 @@ index 937c1bc44cb..fc7d9712729 100644 void diff --git a/include/grub/lockdown.h b/include/grub/lockdown.h -index 40531fa823b..ebfee4bf06e 100644 +index 40531fa82..ebfee4bf0 100644 --- a/include/grub/lockdown.h +++ b/include/grub/lockdown.h @@ -24,7 +24,8 @@ @@ -93,7 +93,7 @@ index 40531fa823b..ebfee4bf06e 100644 EXPORT_FUNC (grub_lockdown) (void); extern int diff --git a/docs/grub.texi b/docs/grub.texi -index 4816be85611..a4da9c2a1b9 100644 +index 4816be856..a4da9c2a1 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -6227,8 +6227,8 @@ Measured boot is currently only supported on EFI platforms. diff --git a/0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 98% rename from 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch index 52fa9d23..30efae78 100644 --- a/0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +++ b/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch @@ -32,7 +32,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 17 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index fc7d9712729..0dcd114ce54 100644 +index fc7d97127..0dcd114ce 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -46,9 +46,6 @@ diff --git a/0180-ieee1275-claim-more-memory.patch b/0178-ieee1275-claim-more-memory.patch similarity index 99% rename from 0180-ieee1275-claim-more-memory.patch rename to 0178-ieee1275-claim-more-memory.patch index 001a9df0..27bab15e 100644 --- a/0180-ieee1275-claim-more-memory.patch +++ b/0178-ieee1275-claim-more-memory.patch @@ -86,7 +86,7 @@ Signed-off-by: Daniel Axtens 2 files changed, 69 insertions(+), 18 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 0dcd114ce54..c61d91a0285 100644 +index 0dcd114ce..c61d91a02 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -46,11 +46,12 @@ @@ -227,7 +227,7 @@ index 0dcd114ce54..c61d91a0285 100644 #endif diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 19f708ee662..90083772c8a 100644 +index 19f708ee6..90083772c 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1047,7 +1047,9 @@ space is limited to 4GiB. GRUB allocates pages from EFI for its heap, at most diff --git a/0181-ieee1275-request-memory-with-ibm-client-architecture.patch b/0179-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 98% rename from 0181-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0179-ieee1275-request-memory-with-ibm-client-architecture.patch index 6e6c1f0c..edfbe929 100644 --- a/0181-ieee1275-request-memory-with-ibm-client-architecture.patch +++ b/0179-ieee1275-request-memory-with-ibm-client-architecture.patch @@ -69,7 +69,7 @@ Signed-off-by: Daniel Axtens 3 files changed, 152 insertions(+), 3 deletions(-) diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 04df9d2c667..6435628ec57 100644 +index 04df9d2c6..6435628ec 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c @@ -127,6 +127,9 @@ grub_ieee1275_find_options (void) @@ -83,7 +83,7 @@ index 04df9d2c667..6435628ec57 100644 if (is_smartfirmware) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index c61d91a0285..9704715c837 100644 +index c61d91a02..9704715c8 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -242,6 +242,135 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, @@ -248,7 +248,7 @@ index c61d91a0285..9704715c837 100644 total = total / 4; diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index b5a1d49bbc3..e0a6c2ce1e6 100644 +index b5a1d49bb..e0a6c2ce1 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -149,7 +149,13 @@ enum grub_ieee1275_flag diff --git a/0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 99% rename from 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch index a237a217..878bf608 100644 --- a/0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +++ b/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch @@ -23,7 +23,7 @@ Signed-off-by: Daniel Axtens 3 files changed, 201 insertions(+), 3 deletions(-) diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c -index 2b38b3670a2..42ec65c54aa 100644 +index 2b38b3670..42ec65c54 100644 --- a/grub-core/commands/appendedsig/x509.c +++ b/grub-core/commands/appendedsig/x509.c @@ -47,6 +47,12 @@ const char *keyUsage_oid = "2.5.29.15"; @@ -156,7 +156,7 @@ index 2b38b3670a2..42ec65c54aa 100644 cleanup_value: diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c -index 88a485200d8..dbba0616621 100644 +index 88a485200..dbba06166 100644 --- a/grub-core/tests/appended_signature_test.c +++ b/grub-core/tests/appended_signature_test.c @@ -111,6 +111,22 @@ static struct grub_procfs_entry certificate_printable_der_entry = { @@ -225,7 +225,7 @@ index 88a485200d8..dbba0616621 100644 GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h -index aa3dc6278e3..2e5ebd7d8bd 100644 +index aa3dc6278..2e5ebd7d8 100644 --- a/grub-core/tests/appended_signatures.h +++ b/grub-core/tests/appended_signatures.h @@ -555,3 +555,84 @@ unsigned char certificate_printable_der[] = { diff --git a/0183-ieee1275-ofdisk-retry-on-open-failure.patch b/0181-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 97% rename from 0183-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0181-ieee1275-ofdisk-retry-on-open-failure.patch index 275d14f4..264c7c9c 100644 --- a/0183-ieee1275-ofdisk-retry-on-open-failure.patch +++ b/0181-ieee1275-ofdisk-retry-on-open-failure.patch @@ -16,7 +16,7 @@ Signed-off-by: Diego Domingos 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index ea7f78ac7d8..55346849d35 100644 +index ea7f78ac7..55346849d 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -225,7 +225,9 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) @@ -85,7 +85,7 @@ index ea7f78ac7d8..55346849d35 100644 } diff --git a/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h -index 2f69e3f191d..7d2d5409305 100644 +index 2f69e3f19..7d2d54093 100644 --- a/include/grub/ieee1275/ofdisk.h +++ b/include/grub/ieee1275/ofdisk.h @@ -22,4 +22,12 @@ diff --git a/0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 97% rename from 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch index 66e61a7e..32c6b601 100644 --- a/0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch +++ b/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch @@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood create mode 100644 include/grub/loopback.h diff --git a/grub-core/disk/loopback.c b/grub-core/disk/loopback.c -index 41bebd14fe3..99f47924ec2 100644 +index 41bebd14f..99f47924e 100644 --- a/grub-core/disk/loopback.c +++ b/grub-core/disk/loopback.c @@ -21,20 +21,13 @@ @@ -39,7 +39,7 @@ index 41bebd14fe3..99f47924ec2 100644 static unsigned long last_id = 0; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index d41e8ea14a8..3af6b122926 100644 +index d41e8ea14..3af6b1229 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -24,6 +24,7 @@ @@ -102,7 +102,7 @@ index d41e8ea14a8..3af6b122926 100644 diff --git a/include/grub/loopback.h b/include/grub/loopback.h new file mode 100644 -index 00000000000..3b9a9e32e80 +index 000000000..3b9a9e32e --- /dev/null +++ b/include/grub/loopback.h @@ -0,0 +1,30 @@ diff --git a/0185-efinet-Add-DHCP-proxy-support.patch b/0183-efinet-Add-DHCP-proxy-support.patch similarity index 98% rename from 0185-efinet-Add-DHCP-proxy-support.patch rename to 0183-efinet-Add-DHCP-proxy-support.patch index dcaac6fb..f1fb5cb1 100644 --- a/0185-efinet-Add-DHCP-proxy-support.patch +++ b/0183-efinet-Add-DHCP-proxy-support.patch @@ -14,7 +14,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index e11d759f19a..1a24f38a21a 100644 +index e11d759f1..1a24f38a2 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -850,10 +850,31 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, diff --git a/0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 98% rename from 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch index b4a5fd4d..8e3279ae 100644 --- a/0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +++ b/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch @@ -23,7 +23,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index e7dd78e6635..731d346f886 100644 +index e7dd78e66..731d346f8 100644 --- a/grub-core/fs/ext2.c +++ b/grub-core/fs/ext2.c @@ -103,6 +103,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 97% rename from 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index c4ce251e..ab236fc0 100644 --- a/0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 81f35a2f3f0..98fd9da6610 100644 +index 70d56518b..f8e868b6c 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -256,7 +256,9 @@ if [ -z "\${kernelopts}" ]; then diff --git a/0188-Suppress-gettext-error-message.patch b/0186-Suppress-gettext-error-message.patch similarity index 96% rename from 0188-Suppress-gettext-error-message.patch rename to 0186-Suppress-gettext-error-message.patch index c42dd0d5..2ca0ce09 100644 --- a/0188-Suppress-gettext-error-message.patch +++ b/0186-Suppress-gettext-error-message.patch @@ -14,7 +14,7 @@ Signed-off-by: Paulo Flabiano Smorigo 1 file changed, 7 insertions(+) diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c -index 4d02e62c109..7ec81ca0b48 100644 +index 4d02e62c1..7ec81ca0b 100644 --- a/grub-core/gettext/gettext.c +++ b/grub-core/gettext/gettext.c @@ -424,6 +424,13 @@ grub_gettext_init_ext (struct grub_gettext_context *ctx, diff --git a/0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 97% rename from 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch index 7ecea22d..c83c5322 100644 --- a/0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +++ b/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch @@ -15,7 +15,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/util/grub-set-password.in b/util/grub-set-password.in -index c0b5ebbfdc5..d8005e5a142 100644 +index c0b5ebbfd..d8005e5a1 100644 --- a/util/grub-set-password.in +++ b/util/grub-set-password.in @@ -1,11 +1,6 @@ diff --git a/0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 98% rename from 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch index e36afa11..79040b47 100644 --- a/0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch +++ b/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch @@ -30,7 +30,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in -index d344d3883d7..b6041b55e2a 100644 +index d344d3883..b6041b55e 100644 --- a/util/grub.d/30_uefi-firmware.in +++ b/util/grub.d/30_uefi-firmware.in @@ -26,19 +26,14 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 98% rename from 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch index 65b4aec5..81ac3e9c 100644 --- a/0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +++ b/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch @@ -21,7 +21,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c -index eaca0328388..328c45e82e0 100644 +index eaca03283..328c45e82 100644 --- a/grub-core/commands/efi/efifwsetup.c +++ b/grub-core/commands/efi/efifwsetup.c @@ -27,6 +27,25 @@ diff --git a/0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 98% rename from 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch index 0472a42f..a206b72d 100644 --- a/0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch +++ b/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch @@ -24,7 +24,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 68 insertions(+), 34 deletions(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 47f8cf0d84b..f18d90bd749 100644 +index 47f8cf0d8..f18d90bd7 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -41,6 +41,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -193,7 +193,7 @@ index 47f8cf0d84b..f18d90bd749 100644 return grub_errno; } diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index b582f67f661..966a5074f53 100644 +index b582f67f6..966a5074f 100644 --- a/include/grub/arm/linux.h +++ b/include/grub/arm/linux.h @@ -44,6 +44,7 @@ struct grub_arm_linux_pe_header @@ -205,7 +205,7 @@ index b582f67f661..966a5074f53 100644 # define grub_armxx_linux_pe_header grub_arm_linux_pe_header #endif diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index ea030312df3..422bf2bf24b 100644 +index ea030312d..422bf2bf2 100644 --- a/include/grub/arm64/linux.h +++ b/include/grub/arm64/linux.h @@ -48,6 +48,7 @@ struct grub_arm64_linux_pe_header diff --git a/0193-normal-main-Discover-the-device-to-read-the-config-f.patch b/0191-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 98% rename from 0193-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0191-normal-main-Discover-the-device-to-read-the-config-f.patch index 80090388..5cf3cb28 100644 --- a/0193-normal-main-Discover-the-device-to-read-the-config-f.patch +++ b/0191-normal-main-Discover-the-device-to-read-the-config-f.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 4ebdbd228d4..b72fe3d653c 100644 +index 4ebdbd228..b72fe3d65 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -337,18 +337,13 @@ grub_enter_normal_mode (const char *config) diff --git a/0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 98% rename from 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch index 7f3161e2..b03e3d33 100644 --- a/0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +++ b/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch @@ -25,7 +25,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index b573be6650d..3fc34014726 100644 +index b573be665..3fc340147 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -216,13 +216,52 @@ grub_set_prefix_and_root (void) diff --git a/0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 99% rename from 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch index 893d8b41..fbb0ee70 100644 --- a/0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +++ b/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch @@ -81,7 +81,7 @@ Reviewed-by: Daniel Kiper 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 0f524c3a8a6..e3816d1ec4a 100644 +index 0f524c3a8..e3816d1ec 100644 --- a/grub-core/fs/xfs.c +++ b/grub-core/fs/xfs.c @@ -192,6 +192,11 @@ struct grub_xfs_time_legacy diff --git a/0196-Print-module-name-on-license-check-failure.patch b/0194-Print-module-name-on-license-check-failure.patch similarity index 98% rename from 0196-Print-module-name-on-license-check-failure.patch rename to 0194-Print-module-name-on-license-check-failure.patch index c4b9a134..f6c6041a 100644 --- a/0196-Print-module-name-on-license-check-failure.patch +++ b/0194-Print-module-name-on-license-check-failure.patch @@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 9557254035e..f3044945742 100644 +index 955725403..f30449457 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -528,14 +528,16 @@ grub_dl_find_section_index (Elf_Ehdr *e, const char *name) diff --git a/0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 98% rename from 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch index a80727e0..121ed5bc 100644 --- a/0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +++ b/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch @@ -79,7 +79,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 3f3459b2c70..6b00eb55575 100644 +index 3f3459b2c..6b00eb555 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -89,7 +89,7 @@ kernel = { @@ -92,7 +92,7 @@ index 3f3459b2c70..6b00eb55575 100644 mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)'; mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000'; diff --git a/include/grub/offsets.h b/include/grub/offsets.h -index 871e1cd4c38..69211aa798b 100644 +index 871e1cd4c..69211aa79 100644 --- a/include/grub/offsets.h +++ b/include/grub/offsets.h @@ -63,7 +63,7 @@ diff --git a/0198-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 97% rename from 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch index 7c7bee0e..f4936a7a 100644 --- a/0198-grub-mkconfig-restore-umask-for-grub.cfg.patch +++ b/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch @@ -25,7 +25,7 @@ Signed-off-by: Michael Chang 1 file changed, 2 insertions(+) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f55339a3f64..520a672cd2c 100644 +index f55339a3f..520a672cd 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -311,7 +311,9 @@ and /etc/grub.d/* files or please file a bug report with diff --git a/0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch similarity index 98% rename from 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch rename to 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch index ecfc58cd..81b7e1c0 100644 --- a/0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch +++ b/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch @@ -32,7 +32,7 @@ Reviewed-by: Daniel Kiper 2 files changed, 79 insertions(+), 13 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 4cc86e9b79e..07c0ff874b8 100644 +index 4cc86e9b7..07c0ff874 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -2476,6 +2476,33 @@ grub_btrfs_label (grub_device_t device, char **label) @@ -146,7 +146,7 @@ index 4cc86e9b79e..07c0ff874b8 100644 return GRUB_ERR_NONE; } diff --git a/include/grub/disk.h b/include/grub/disk.h -index f95aca929a6..06210a70492 100644 +index f95aca929..06210a704 100644 --- a/include/grub/disk.h +++ b/include/grub/disk.h @@ -182,6 +182,8 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t; diff --git a/0200-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch similarity index 95% rename from 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch rename to 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch index eb76649e..ba84f9c7 100644 --- a/0200-Add-Fedora-location-of-DejaVu-SANS-font.patch +++ b/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch @@ -16,10 +16,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 3c808a72230..3527f069ab2 100644 +index f069d8403..88e33e0f0 100644 --- a/configure.ac +++ b/configure.ac -@@ -1812,7 +1812,7 @@ fi +@@ -1785,7 +1785,7 @@ fi if test x"$starfield_excuse" = x; then for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do diff --git a/0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch similarity index 98% rename from 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch rename to 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch index 531c4f5d..3073238b 100644 --- a/0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +++ b/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch @@ -18,7 +18,7 @@ Signed-off-by: Hans de Goede 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index ec0c92bade0..c8516a5a080 100644 +index ec0c92bad..c8516a5a0 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -606,13 +606,15 @@ print_countdown (struct grub_term_coordinate *pos, int n) diff --git a/0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch similarity index 97% rename from 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch rename to 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch index 8f34b74d..de29340a 100644 --- a/0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +++ b/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch @@ -22,7 +22,7 @@ Signed-off-by: Hans de Goede 1 file changed, 3 insertions(+) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 3fc34014726..993b8a8598e 100644 +index 3fc340147..993b8a859 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -317,10 +317,13 @@ grub_main (void) diff --git a/0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch similarity index 97% rename from 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch rename to 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch index cb430c02..1007041d 100644 --- a/0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +++ b/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch @@ -29,7 +29,7 @@ Signed-off-by: Hans de Goede 1 file changed, 10 insertions(+) diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index 2f1ae85ba7d..c44b2ac318c 100644 +index 2f1ae85ba..c44b2ac31 100644 --- a/grub-core/term/efi/console.c +++ b/grub-core/term/efi/console.c @@ -82,6 +82,16 @@ grub_console_setcolorstate (struct grub_term_output *term diff --git a/0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch similarity index 98% rename from 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch rename to 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch index e33d1f37..c8674516 100644 --- a/0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +++ b/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch @@ -25,7 +25,7 @@ Signed-off-by: Hans de Goede 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index c44b2ac318c..a3622e4fe5f 100644 +index c44b2ac31..a3622e4fe 100644 --- a/grub-core/term/efi/console.c +++ b/grub-core/term/efi/console.c @@ -31,7 +31,15 @@ typedef enum { diff --git a/0205-Use-visual-indentation-in-config.h.in.patch b/0203-Use-visual-indentation-in-config.h.in.patch similarity index 98% rename from 0205-Use-visual-indentation-in-config.h.in.patch rename to 0203-Use-visual-indentation-in-config.h.in.patch index 1acc3336..88818453 100644 --- a/0205-Use-visual-indentation-in-config.h.in.patch +++ b/0203-Use-visual-indentation-in-config.h.in.patch @@ -11,7 +11,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/config.h.in b/config.h.in -index c80e3e0aba3..f2ed0066ec0 100644 +index c80e3e0ab..f2ed0066e 100644 --- a/config.h.in +++ b/config.h.in @@ -23,47 +23,47 @@ diff --git a/0206-Where-present-ensure-config-util.h-precedes-config.h.patch b/0204-Where-present-ensure-config-util.h-precedes-config.h.patch similarity index 91% rename from 0206-Where-present-ensure-config-util.h-precedes-config.h.patch rename to 0204-Where-present-ensure-config-util.h-precedes-config.h.patch index 351d50f1..0bfb00e5 100644 --- a/0206-Where-present-ensure-config-util.h-precedes-config.h.patch +++ b/0204-Where-present-ensure-config-util.h-precedes-config.h.patch @@ -31,7 +31,7 @@ Signed-off-by: Robbie Harwood 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/grub-core/disk/host.c b/grub-core/disk/host.c -index c151d225df7..f34529f86ae 100644 +index c151d225d..f34529f86 100644 --- a/grub-core/disk/host.c +++ b/grub-core/disk/host.c @@ -20,8 +20,8 @@ @@ -45,7 +45,7 @@ index c151d225df7..f34529f86ae 100644 #include #include diff --git a/grub-core/kern/emu/argp_common.c b/grub-core/kern/emu/argp_common.c -index 16688587037..8cb4608c3df 100644 +index 166885870..8cb4608c3 100644 --- a/grub-core/kern/emu/argp_common.c +++ b/grub-core/kern/emu/argp_common.c @@ -17,8 +17,8 @@ @@ -59,7 +59,7 @@ index 16688587037..8cb4608c3df 100644 #pragma GCC diagnostic ignored "-Wmissing-prototypes" #pragma GCC diagnostic ignored "-Wmissing-declarations" diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 846fe9715ec..3e7929cc4af 100644 +index 846fe9715..3e7929cc4 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -16,8 +16,8 @@ @@ -73,7 +73,7 @@ index 846fe9715ec..3e7929cc4af 100644 #include #include diff --git a/grub-core/osdep/aros/config.c b/grub-core/osdep/aros/config.c -index c82d0ea8e76..55f5728efca 100644 +index c82d0ea8e..55f5728ef 100644 --- a/grub-core/osdep/aros/config.c +++ b/grub-core/osdep/aros/config.c @@ -16,8 +16,8 @@ @@ -87,7 +87,7 @@ index c82d0ea8e76..55f5728efca 100644 #include #include diff --git a/grub-core/osdep/basic/emunet.c b/grub-core/osdep/basic/emunet.c -index 6362e5cfbb3..dbfd316d613 100644 +index 6362e5cfb..dbfd316d6 100644 --- a/grub-core/osdep/basic/emunet.c +++ b/grub-core/osdep/basic/emunet.c @@ -16,8 +16,8 @@ @@ -101,7 +101,7 @@ index 6362e5cfbb3..dbfd316d613 100644 #include #include diff --git a/grub-core/osdep/basic/init.c b/grub-core/osdep/basic/init.c -index c54c710dbcb..b104c7e162b 100644 +index c54c710db..b104c7e16 100644 --- a/grub-core/osdep/basic/init.c +++ b/grub-core/osdep/basic/init.c @@ -16,8 +16,8 @@ @@ -115,7 +115,7 @@ index c54c710dbcb..b104c7e162b 100644 #include #include diff --git a/grub-core/osdep/haiku/getroot.c b/grub-core/osdep/haiku/getroot.c -index 4e123c0903a..927a1ebc941 100644 +index 4e123c090..927a1ebc9 100644 --- a/grub-core/osdep/haiku/getroot.c +++ b/grub-core/osdep/haiku/getroot.c @@ -1,5 +1,5 @@ @@ -126,7 +126,7 @@ index 4e123c0903a..927a1ebc941 100644 #include #include diff --git a/grub-core/osdep/linux/emunet.c b/grub-core/osdep/linux/emunet.c -index 19b188f09ee..d5a6417355f 100644 +index 19b188f09..d5a641735 100644 --- a/grub-core/osdep/linux/emunet.c +++ b/grub-core/osdep/linux/emunet.c @@ -16,8 +16,8 @@ @@ -140,7 +140,7 @@ index 19b188f09ee..d5a6417355f 100644 #include #include diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index 46a881530c0..0ce0e309ac0 100644 +index 46a881530..0ce0e309a 100644 --- a/grub-core/osdep/unix/config.c +++ b/grub-core/osdep/unix/config.c @@ -16,8 +16,8 @@ @@ -154,7 +154,7 @@ index 46a881530c0..0ce0e309ac0 100644 #include #include diff --git a/grub-core/osdep/unix/cputime.c b/grub-core/osdep/unix/cputime.c -index cff359a3b94..fb6ff55a1a7 100644 +index cff359a3b..fb6ff55a1 100644 --- a/grub-core/osdep/unix/cputime.c +++ b/grub-core/osdep/unix/cputime.c @@ -1,5 +1,5 @@ @@ -165,7 +165,7 @@ index cff359a3b94..fb6ff55a1a7 100644 #include #include diff --git a/grub-core/osdep/unix/dl.c b/grub-core/osdep/unix/dl.c -index 562b101a280..99b189bc1c9 100644 +index 562b101a2..99b189bc1 100644 --- a/grub-core/osdep/unix/dl.c +++ b/grub-core/osdep/unix/dl.c @@ -16,8 +16,8 @@ @@ -179,7 +179,7 @@ index 562b101a280..99b189bc1c9 100644 #include #include diff --git a/grub-core/osdep/unix/emuconsole.c b/grub-core/osdep/unix/emuconsole.c -index 7308798efe9..cac159424d8 100644 +index 7308798ef..cac159424 100644 --- a/grub-core/osdep/unix/emuconsole.c +++ b/grub-core/osdep/unix/emuconsole.c @@ -17,8 +17,8 @@ @@ -193,7 +193,7 @@ index 7308798efe9..cac159424d8 100644 #include #include diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c -index 46d7116c6e6..4f436284ce0 100644 +index 46d7116c6..4f436284c 100644 --- a/grub-core/osdep/unix/getroot.c +++ b/grub-core/osdep/unix/getroot.c @@ -16,8 +16,8 @@ @@ -207,7 +207,7 @@ index 46d7116c6e6..4f436284ce0 100644 #include #include diff --git a/grub-core/osdep/windows/config.c b/grub-core/osdep/windows/config.c -index 928ab1a49be..2bb8a2fd88e 100644 +index 928ab1a49..2bb8a2fd8 100644 --- a/grub-core/osdep/windows/config.c +++ b/grub-core/osdep/windows/config.c @@ -16,8 +16,8 @@ @@ -221,7 +221,7 @@ index 928ab1a49be..2bb8a2fd88e 100644 #include #include diff --git a/grub-core/osdep/windows/cputime.c b/grub-core/osdep/windows/cputime.c -index 3568aa2d359..5d06d79dd53 100644 +index 3568aa2d3..5d06d79dd 100644 --- a/grub-core/osdep/windows/cputime.c +++ b/grub-core/osdep/windows/cputime.c @@ -1,5 +1,5 @@ @@ -232,7 +232,7 @@ index 3568aa2d359..5d06d79dd53 100644 #include #include diff --git a/grub-core/osdep/windows/dl.c b/grub-core/osdep/windows/dl.c -index eec6a24ad7f..8eab7057e4d 100644 +index eec6a24ad..8eab7057e 100644 --- a/grub-core/osdep/windows/dl.c +++ b/grub-core/osdep/windows/dl.c @@ -16,8 +16,8 @@ @@ -246,7 +246,7 @@ index eec6a24ad7f..8eab7057e4d 100644 #include #include diff --git a/grub-core/osdep/windows/emuconsole.c b/grub-core/osdep/windows/emuconsole.c -index 4fb3693cc01..17a44de4690 100644 +index 4fb3693cc..17a44de46 100644 --- a/grub-core/osdep/windows/emuconsole.c +++ b/grub-core/osdep/windows/emuconsole.c @@ -16,8 +16,8 @@ @@ -260,7 +260,7 @@ index 4fb3693cc01..17a44de4690 100644 #include #include diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c -index 6297de6326a..51a9647dde4 100644 +index 6297de632..51a9647dd 100644 --- a/grub-core/osdep/windows/init.c +++ b/grub-core/osdep/windows/init.c @@ -16,8 +16,8 @@ diff --git a/0207-Drop-gnulib-fix-base64.patch.patch b/0205-Drop-gnulib-fix-base64.patch.patch similarity index 94% rename from 0207-Drop-gnulib-fix-base64.patch.patch rename to 0205-Drop-gnulib-fix-base64.patch.patch index 1d26c57f..9815550c 100644 --- a/0207-Drop-gnulib-fix-base64.patch.patch +++ b/0205-Drop-gnulib-fix-base64.patch.patch @@ -31,7 +31,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h -index f63412c8da0..2f3e865495a 100644 +index f63412c8d..2f3e86549 100644 --- a/grub-core/lib/posix_wrap/sys/types.h +++ b/grub-core/lib/posix_wrap/sys/types.h @@ -23,11 +23,10 @@ @@ -50,7 +50,7 @@ index f63412c8da0..2f3e865495a 100644 typedef grub_uint8_t uint8_t; typedef grub_uint16_t uint16_t; diff --git a/grub-core/lib/xzembed/xz.h b/grub-core/lib/xzembed/xz.h -index f7b32d80032..d1417039aa4 100644 +index f7b32d800..d1417039a 100644 --- a/grub-core/lib/xzembed/xz.h +++ b/grub-core/lib/xzembed/xz.h @@ -29,10 +29,7 @@ @@ -66,7 +66,7 @@ index f7b32d80032..d1417039aa4 100644 /** * enum xz_ret - Return codes diff --git a/bootstrap.conf b/bootstrap.conf -index 52d4af44bec..645e3a459ce 100644 +index 52d4af44b..645e3a459 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -35,6 +35,7 @@ gnulib_modules=" @@ -87,10 +87,10 @@ index 52d4af44bec..645e3a459ce 100644 patch -d grub-core/lib/gnulib -p2 \ < "grub-core/lib/gnulib-patches/$patchname.patch" diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index ea58362b555..ca6a50deca9 100644 +index ad235de7f..f4791dc6c 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist -@@ -30,7 +30,6 @@ EXTRA_DIST += grub-core/gensymlist.sh +@@ -31,7 +31,6 @@ EXTRA_DIST += grub-core/gensymlist.sh EXTRA_DIST += grub-core/genemuinit.sh EXTRA_DIST += grub-core/genemuinitheader.sh @@ -99,7 +99,7 @@ index ea58362b555..ca6a50deca9 100644 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch diff --git a/config.h.in b/config.h.in -index f2ed0066ec0..9c7b4afaaad 100644 +index f2ed0066e..9c7b4afaa 100644 --- a/config.h.in +++ b/config.h.in @@ -66,4 +66,8 @@ @@ -113,7 +113,7 @@ index f2ed0066ec0..9c7b4afaaad 100644 #endif diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch deleted file mode 100644 -index 985db127971..00000000000 +index 985db1279..000000000 --- a/grub-core/lib/gnulib-patches/fix-base64.patch +++ /dev/null @@ -1,21 +0,0 @@ diff --git a/0208-Drop-gnulib-no-abort.patch.patch b/0206-Drop-gnulib-no-abort.patch.patch similarity index 94% rename from 0208-Drop-gnulib-no-abort.patch.patch rename to 0206-Drop-gnulib-no-abort.patch.patch index 79bcb038..a1a067a1 100644 --- a/0208-Drop-gnulib-no-abort.patch.patch +++ b/0206-Drop-gnulib-no-abort.patch.patch @@ -25,7 +25,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch diff --git a/bootstrap.conf b/bootstrap.conf -index 645e3a459ce..71ce943c7d4 100644 +index 645e3a459..71ce943c7 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -81,7 +81,7 @@ cp -a INSTALL INSTALL.grub @@ -38,10 +38,10 @@ index 645e3a459ce..71ce943c7d4 100644 < "grub-core/lib/gnulib-patches/$patchname.patch" done diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index ca6a50deca9..16248ccf032 100644 +index f4791dc6c..5eef70833 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist -@@ -37,7 +37,6 @@ EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch +@@ -38,7 +38,6 @@ EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch @@ -50,7 +50,7 @@ index ca6a50deca9..16248ccf032 100644 EXTRA_DIST += grub-core/lib/libgcrypt EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic diff --git a/config.h.in b/config.h.in -index 9c7b4afaaad..c3134309c63 100644 +index 9c7b4afaa..c3134309c 100644 --- a/config.h.in +++ b/config.h.in @@ -68,6 +68,9 @@ @@ -65,7 +65,7 @@ index 9c7b4afaaad..c3134309c63 100644 #endif diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch deleted file mode 100644 -index e469c4762eb..00000000000 +index e469c4762..000000000 --- a/grub-core/lib/gnulib-patches/no-abort.patch +++ /dev/null @@ -1,26 +0,0 @@ diff --git a/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch similarity index 97% rename from 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch rename to 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch index 4b5a44c8..fd44c8f1 100644 --- a/0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch +++ b/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch @@ -48,7 +48,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch diff --git a/configure.ac b/configure.ac -index 3527f069ab2..d04c94691ef 100644 +index 88e33e0f0..871235b91 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,7 @@ AC_CANONICAL_TARGET @@ -61,7 +61,7 @@ index 3527f069ab2..d04c94691ef 100644 AC_CONFIG_HEADER([config-util.h]) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 6b00eb55575..39233096f29 100644 +index 6b00eb555..39233096f 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -762,6 +762,9 @@ module = { @@ -75,7 +75,7 @@ index 6b00eb55575..39233096f29 100644 cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c -index 371a53b837d..c917a5f91e7 100644 +index 371a53b83..c917a5f91 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -389,7 +389,7 @@ luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key, @@ -97,7 +97,7 @@ index 371a53b837d..c917a5f91e7 100644 const gcry_md_spec_t *hash; gcry_err_code_t gcry_ret; diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h -index 591dbf3289d..4be7b408063 100644 +index 591dbf328..4be7b4080 100644 --- a/grub-core/lib/posix_wrap/limits.h +++ b/grub-core/lib/posix_wrap/limits.h @@ -25,7 +25,11 @@ @@ -114,7 +114,7 @@ index 591dbf3289d..4be7b408063 100644 #define SCHAR_MIN GRUB_SCHAR_MIN #define SCHAR_MAX GRUB_SCHAR_MAX diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index ebafec68957..441a9eca07c 100644 +index ebafec689..441a9eca0 100644 --- a/include/grub/compiler.h +++ b/include/grub/compiler.h @@ -30,10 +30,10 @@ @@ -131,7 +131,7 @@ index ebafec68957..441a9eca07c 100644 #if GNUC_PREREQ(4,4) diff --git a/include/grub/list.h b/include/grub/list.h -index b13acb96243..21f4b4b44a1 100644 +index b13acb962..21f4b4b44 100644 --- a/include/grub/list.h +++ b/include/grub/list.h @@ -40,7 +40,7 @@ void EXPORT_FUNC(grub_list_remove) (grub_list_t item); @@ -144,7 +144,7 @@ index b13acb96243..21f4b4b44a1 100644 static inline void * grub_bad_type_cast_real (int line, const char *file) diff --git a/INSTALL b/INSTALL -index 79a0af7d937..ee9f536f760 100644 +index 79a0af7d9..ee9f536f7 100644 --- a/INSTALL +++ b/INSTALL @@ -42,7 +42,7 @@ If you use a development snapshot or want to hack on GRUB you may @@ -157,7 +157,7 @@ index 79a0af7d937..ee9f536f760 100644 Prerequisites for make-check: diff --git a/bootstrap b/bootstrap -index 5b08e7e2d42..dc2238f4adf 100755 +index 5b08e7e2d..dc2238f4a 100755 --- a/bootstrap +++ b/bootstrap @@ -1,10 +1,10 @@ @@ -563,7 +563,7 @@ index 5b08e7e2d42..dc2238f4adf 100755 # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" diff --git a/bootstrap.conf b/bootstrap.conf -index 71ce943c7d4..e4e5f3750ad 100644 +index 71ce943c7..e4e5f3750 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -1,6 +1,6 @@ @@ -618,10 +618,10 @@ index 71ce943c7d4..e4e5f3750ad 100644 0001-Support-POTFILES-shell \ 0002-Handle-gettext_printf-shell-function \ diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 16248ccf032..5b9fda752b6 100644 +index 5eef70833..26ac8765e 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist -@@ -30,12 +30,6 @@ EXTRA_DIST += grub-core/gensymlist.sh +@@ -31,12 +31,6 @@ EXTRA_DIST += grub-core/gensymlist.sh EXTRA_DIST += grub-core/genemuinit.sh EXTRA_DIST += grub-core/genemuinitheader.sh @@ -635,7 +635,7 @@ index 16248ccf032..5b9fda752b6 100644 EXTRA_DIST += grub-core/lib/libgcrypt diff --git a/config.h.in b/config.h.in -index c3134309c63..512d1bbe138 100644 +index c3134309c..512d1bbe1 100644 --- a/config.h.in +++ b/config.h.in @@ -67,10 +67,78 @@ @@ -719,7 +719,7 @@ index c3134309c63..512d1bbe138 100644 #endif diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch deleted file mode 100644 -index 8fafa153a47..00000000000 +index 8fafa153a..000000000 --- a/grub-core/lib/gnulib-patches/fix-null-deref.patch +++ /dev/null @@ -1,13 +0,0 @@ @@ -738,7 +738,7 @@ index 8fafa153a47..00000000000 - struct parser *parser = state->pstate; diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch deleted file mode 100644 -index 813ec09c8a1..00000000000 +index 813ec09c8..000000000 --- a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch +++ /dev/null @@ -1,12 +0,0 @@ @@ -756,7 +756,7 @@ index 813ec09c8a1..00000000000 - "rmargin", up->name); diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch deleted file mode 100644 -index 02e06315dff..00000000000 +index 02e06315d..000000000 --- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch +++ /dev/null @@ -1,15 +0,0 @@ @@ -777,7 +777,7 @@ index 02e06315dff..00000000000 - diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch deleted file mode 100644 -index db6dac9c9e3..00000000000 +index db6dac9c9..000000000 --- a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch +++ /dev/null @@ -1,12 +0,0 @@ @@ -795,7 +795,7 @@ index db6dac9c9e3..00000000000 - || (next_state_log_idx >= mctx->input.valid_len diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch deleted file mode 100644 -index 7b4d9f67af4..00000000000 +index 7b4d9f67a..000000000 --- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch +++ /dev/null @@ -1,11 +0,0 @@ @@ -812,7 +812,7 @@ index 7b4d9f67af4..00000000000 - sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch deleted file mode 100644 -index ba51f1bf223..00000000000 +index ba51f1bf2..000000000 --- a/grub-core/lib/gnulib-patches/fix-unused-value.patch +++ /dev/null @@ -1,14 +0,0 @@ diff --git a/0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch similarity index 97% rename from 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch rename to 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch index 388d3239..461a1b86 100644 --- a/0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +++ b/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch @@ -19,7 +19,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index ed090b3af8b..51656e361cc 100644 +index ed090b3af..51656e361 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -64,7 +64,7 @@ iterate_device (const char *name, void *data) diff --git a/0211-search-new-efidisk-only-option-on-EFI-systems.patch b/0209-search-new-efidisk-only-option-on-EFI-systems.patch similarity index 98% rename from 0211-search-new-efidisk-only-option-on-EFI-systems.patch rename to 0209-search-new-efidisk-only-option-on-EFI-systems.patch index 20ee9793..02e2412a 100644 --- a/0211-search-new-efidisk-only-option-on-EFI-systems.patch +++ b/0209-search-new-efidisk-only-option-on-EFI-systems.patch @@ -26,7 +26,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index 51656e361cc..57d26ced8a8 100644 +index 51656e361..57d26ced8 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -47,7 +47,7 @@ struct search_ctx @@ -86,7 +86,7 @@ index 51656e361cc..57d26ced8a8 100644 .nhints = nhints, .count = 0, diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c -index 47fc8eb9966..0b62acf8535 100644 +index 47fc8eb99..0b62acf85 100644 --- a/grub-core/commands/search_wrap.c +++ b/grub-core/commands/search_wrap.c @@ -40,6 +40,7 @@ static const struct grub_arg_option options[] = @@ -139,7 +139,7 @@ index 47fc8eb9966..0b62acf8535 100644 grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type"); diff --git a/include/grub/search.h b/include/grub/search.h -index d80347df34b..4190aeb2cbf 100644 +index d80347df3..4190aeb2c 100644 --- a/include/grub/search.h +++ b/include/grub/search.h @@ -19,11 +19,20 @@ diff --git a/0212-efi-new-connectefi-command.patch b/0210-efi-new-connectefi-command.patch similarity index 97% rename from 0212-efi-new-connectefi-command.patch rename to 0210-efi-new-connectefi-command.patch index a9d860ba..524412ca 100644 --- a/0212-efi-new-connectefi-command.patch +++ b/0210-efi-new-connectefi-command.patch @@ -64,7 +64,7 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/efi/connectefi.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 39233096f29..3c0ac3b7bd0 100644 +index 39233096f..3c0ac3b7b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -836,6 +836,12 @@ module = { @@ -82,7 +82,7 @@ index 39233096f29..3c0ac3b7bd0 100644 common = commands/blocklist.c; diff --git a/grub-core/commands/efi/connectefi.c b/grub-core/commands/efi/connectefi.c new file mode 100644 -index 00000000000..8ab75bd51be +index 000000000..8ab75bd51 --- /dev/null +++ b/grub-core/commands/efi/connectefi.c @@ -0,0 +1,205 @@ @@ -292,7 +292,7 @@ index 00000000000..8ab75bd51be + grub_unregister_command (cmd); +} diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c -index d1ce99af438..f2d2430e666 100644 +index d1ce99af4..f2d2430e6 100644 --- a/grub-core/commands/efi/lsefi.c +++ b/grub-core/commands/efi/lsefi.c @@ -19,6 +19,7 @@ @@ -304,7 +304,7 @@ index d1ce99af438..f2d2430e666 100644 #include #include diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index fe8ba6e6c93..062143dfffd 100644 +index fe8ba6e6c..062143dff 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -396,6 +396,19 @@ enumerate_disks (void) @@ -328,7 +328,7 @@ index fe8ba6e6c93..062143dfffd 100644 grub_efidisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, grub_disk_pull_t pull) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 14bc10eb564..7fcca69c17b 100644 +index 14bc10eb5..7fcca69c1 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -95,6 +95,19 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type, @@ -352,7 +352,7 @@ index 14bc10eb564..7fcca69c17b 100644 grub_efi_open_protocol (grub_efi_handle_t handle, grub_efi_guid_t *protocol, diff --git a/include/grub/efi/disk.h b/include/grub/efi/disk.h -index 254475c8428..6845c2f1fd8 100644 +index 254475c84..6845c2f1f 100644 --- a/include/grub/efi/disk.h +++ b/include/grub/efi/disk.h @@ -27,6 +27,8 @@ grub_efi_handle_t @@ -365,7 +365,7 @@ index 254475c8428..6845c2f1fd8 100644 void grub_efidisk_fini (void); diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 8dfc89a33b9..ec52083c49f 100644 +index 8dfc89a33..ec52083c4 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -41,6 +41,11 @@ EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type, @@ -381,7 +381,7 @@ index 8dfc89a33b9..ec52083c49f 100644 grub_efi_guid_t *protocol, grub_efi_uint32_t attributes); diff --git a/NEWS b/NEWS -index 73b8492bc42..d7c1d23aed7 100644 +index 73b8492bc..d7c1d23ae 100644 --- a/NEWS +++ b/NEWS @@ -98,7 +98,7 @@ New in 2.02: diff --git a/0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch similarity index 98% rename from 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch rename to 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch index e4a8522a..869d0a4e 100644 --- a/0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +++ b/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch @@ -34,7 +34,7 @@ Signed-off-by: Dimitri John Ledkov 1 file changed, 13 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3cf0f9b330b..941df6400b9 100644 +index 3cf0f9b33..941df6400 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -30,7 +30,6 @@ diff --git a/0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch similarity index 98% rename from 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch rename to 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch index 9fb39a63..5d76beb3 100644 --- a/0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +++ b/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch @@ -19,7 +19,7 @@ Signed-off-by: Dimitri John Ledkov 1 file changed, 13 deletions(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index f18d90bd749..d2af47c2c0a 100644 +index f18d90bd7..d2af47c2c 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -34,7 +34,6 @@ diff --git a/0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch similarity index 98% rename from 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch rename to 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch index ad343097..adc81794 100644 --- a/0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +++ b/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch @@ -39,7 +39,7 @@ Signed-off-by: Dimitri John Ledkov 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 3af6b122926..644cd2e56fe 100644 +index 3af6b1229..644cd2e56 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -906,7 +906,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), diff --git a/0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch similarity index 97% rename from 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch rename to 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch index 46eafc01..c298c04a 100644 --- a/0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +++ b/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch @@ -18,7 +18,7 @@ Signed-off-by: Dimitri John Ledkov 2 files changed, 42 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 9260731c107..9265cf4200a 100644 +index 9260731c1..9265cf420 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -24,46 +24,6 @@ @@ -69,7 +69,7 @@ index 9260731c107..9265cf4200a 100644 #pragma GCC diagnostic ignored "-Wcast-align" diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h -index 0033d9305a9..887b02fd9f3 100644 +index 0033d9305..887b02fd9 100644 --- a/include/grub/efi/linux.h +++ b/include/grub/efi/linux.h @@ -22,8 +22,6 @@ diff --git a/grub.patches b/grub.patches index 29c58942..286d0113 100644 --- a/grub.patches +++ b/grub.patches @@ -24,193 +24,191 @@ Patch0023: 0023-Enable-pager-by-default.-985860.patch Patch0024: 0024-Don-t-say-GNU-Linux-in-generated-menus.patch Patch0025: 0025-Add-.eh_frame-to-list-of-relocations-stripped.patch Patch0026: 0026-Don-t-require-a-password-to-boot-entries-generated-b.patch -Patch0027: 0027-Replace-a-lot-of-man-pages-with-slightly-nicer-ones.patch -Patch0028: 0028-use-fw_path-prefix-when-fallback-searching-for-grub-.patch -Patch0029: 0029-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch -Patch0030: 0030-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch -Patch0031: 0031-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch -Patch0032: 0032-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0033: 0033-Use-rpm-s-sort-for-grub2-mkconfig.patch -Patch0034: 0034-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0035: 0035-Add-friendly-grub2-password-config-tool-985962.patch -Patch0036: 0036-tcp-add-window-scaling-support.patch -Patch0037: 0037-efinet-and-bootp-add-support-for-dhcpv6.patch -Patch0038: 0038-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0039: 0039-bz1374141-fix-incorrect-mask-for-ppc64.patch -Patch0040: 0040-Make-grub_fatal-also-backtrace.patch -Patch0041: 0041-Fix-up-some-man-pages-rpmdiff-noticed.patch -Patch0042: 0042-Make-our-info-pages-say-grub2-where-appropriate.patch -Patch0043: 0043-macos-just-build-chainloader-entries-don-t-try-any-x.patch -Patch0044: 0044-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch -Patch0045: 0045-export-btrfs_subvol-and-btrfs_subvolid.patch -Patch0046: 0046-grub2-btrfs-03-follow_default.patch -Patch0047: 0047-grub2-btrfs-04-grub2-install.patch -Patch0048: 0048-grub2-btrfs-05-grub2-mkconfig.patch -Patch0049: 0049-grub2-btrfs-06-subvol-mount.patch -Patch0050: 0050-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch -Patch0051: 0051-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch -Patch0052: 0052-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch -Patch0053: 0053-Use-grub_efi_.-memory-helpers-where-reasonable.patch -Patch0054: 0054-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch -Patch0055: 0055-don-t-use-int-for-efi-status.patch -Patch0056: 0056-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch -Patch0057: 0057-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch -Patch0058: 0058-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch -Patch0059: 0059-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch -Patch0060: 0060-align-struct-efi_variable-better.patch -Patch0061: 0061-Add-BLS-support-to-grub-mkconfig.patch -Patch0062: 0062-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0063: 0063-Add-linux-and-initrd-commands-for-grub-emu.patch -Patch0064: 0064-Add-grub2-switch-to-blscfg.patch -Patch0065: 0065-make-better-backtraces.patch -Patch0066: 0066-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0067: 0067-Work-around-some-minor-include-path-weirdnesses.patch -Patch0068: 0068-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0069: 0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0070: 0070-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0027: 0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +Patch0028: 0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +Patch0029: 0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +Patch0030: 0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +Patch0031: 0031-Try-prefix-if-fw_path-doesn-t-work.patch +Patch0032: 0032-Use-rpm-s-sort-for-grub2-mkconfig.patch +Patch0033: 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0034: 0034-Add-friendly-grub2-password-config-tool-985962.patch +Patch0035: 0035-tcp-add-window-scaling-support.patch +Patch0036: 0036-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0037: 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0038: 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch +Patch0039: 0039-Make-grub_fatal-also-backtrace.patch +Patch0040: 0040-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0041: 0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0042: 0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0043: 0043-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0044: 0044-grub2-btrfs-03-follow_default.patch +Patch0045: 0045-grub2-btrfs-04-grub2-install.patch +Patch0046: 0046-grub2-btrfs-05-grub2-mkconfig.patch +Patch0047: 0047-grub2-btrfs-06-subvol-mount.patch +Patch0048: 0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0049: 0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0050: 0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0051: 0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0052: 0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0053: 0053-don-t-use-int-for-efi-status.patch +Patch0054: 0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0055: 0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +Patch0056: 0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +Patch0057: 0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +Patch0058: 0058-align-struct-efi_variable-better.patch +Patch0059: 0059-Add-BLS-support-to-grub-mkconfig.patch +Patch0060: 0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +Patch0061: 0061-Add-linux-and-initrd-commands-for-grub-emu.patch +Patch0062: 0062-Add-grub2-switch-to-blscfg.patch +Patch0063: 0063-make-better-backtraces.patch +Patch0064: 0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0065: 0065-Work-around-some-minor-include-path-weirdnesses.patch +Patch0066: 0066-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0067: 0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0068: 0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0069: 0069-Fixup-for-newer-compiler.patch +Patch0070: 0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch Patch0071: 0071-Fixup-for-newer-compiler.patch -Patch0072: 0072-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0073: 0073-Fixup-for-newer-compiler.patch -Patch0074: 0074-Add-support-for-non-Ethernet-network-cards.patch -Patch0075: 0075-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0076: 0076-bootp-New-net_bootp6-command.patch -Patch0077: 0077-efinet-UEFI-IPv6-PXE-support.patch -Patch0078: 0078-grub.texi-Add-net_bootp6-doument.patch -Patch0079: 0079-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0080: 0080-efinet-Setting-network-from-UEFI-device-path.patch -Patch0081: 0081-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0082: 0082-Support-UEFI-networking-protocols.patch -Patch0083: 0083-AUDIT-0-http-boot-tracker-bug.patch -Patch0084: 0084-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0085: 0085-Add-auto-hide-menu-support.patch -Patch0086: 0086-Add-grub-set-bootflag-utility.patch -Patch0087: 0087-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0088: 0088-gentpl-add-disable-support.patch -Patch0089: 0089-gentpl-add-pc-firmware-type.patch -Patch0090: 0090-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0091: 0091-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0092: 0092-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0093: 0093-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0094: 0094-Rework-how-the-fdt-command-builds.patch -Patch0095: 0095-Disable-non-wordsize-allocations-on-arm.patch -Patch0096: 0096-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0097: 0097-Make-grub_error-more-verbose.patch -Patch0098: 0098-Make-reset-an-alias-for-the-reboot-command.patch -Patch0099: 0099-Add-a-version-command.patch -Patch0100: 0100-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0101: 0101-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0102: 0102-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0103: 0103-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0104: 0104-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0105: 0105-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0106: 0106-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0107: 0107-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0108: 0108-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0109: 0109-Fix-getroot.c-s-trampolines.patch -Patch0110: 0110-Do-not-allow-stack-trampolines-anywhere.patch -Patch0111: 0111-Reimplement-boot_counter.patch -Patch0112: 0112-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0113: 0113-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0114: 0114-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0115: 0115-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0116: 0116-Export-all-variables-from-the-initial-context-when-c.patch -Patch0117: 0117-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0118: 0118-Fix-systemctl-kexec-exit-status-check.patch -Patch0119: 0119-Print-grub-emu-linux-loader-messages-as-debug.patch -Patch0120: 0120-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0121: 0121-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0122: 0122-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0123: 0123-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0124: 0124-Add-start-symbol-for-RISC-V.patch -Patch0125: 0125-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0126: 0126-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0127: 0127-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0128: 0128-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0129: 0129-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0130: 0130-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0131: 0131-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0132: 0132-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0133: 0133-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0134: 0134-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0135: 0135-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0136: 0136-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0137: 0137-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0138: 0138-efi-http-fix-some-allocation-error-checking.patch -Patch0139: 0139-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0140: 0140-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0141: 0141-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0144: 0144-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0145: 0145-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0146: 0146-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0147: 0147-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0148: 0148-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0149: 0149-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0150: 0150-grub-install-disable-support-for-EFI-platforms.patch -Patch0151: 0151-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0152: 0152-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0153: 0153-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0154: 0154-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0155: 0155-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0156: 0156-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0157: 0157-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0158: 0158-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0159: 0159-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0160: 0160-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0161: 0161-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0162: 0162-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0163: 0163-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0164: 0164-pgp-factor-out-rsa_pad.patch -Patch0165: 0165-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0166: 0166-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0167: 0167-libtasn1-import-libtasn1-4.16.0.patch -Patch0168: 0168-libtasn1-disable-code-not-needed-in-grub.patch -Patch0169: 0169-libtasn1-changes-for-grub-compatibility.patch -Patch0170: 0170-libtasn1-compile-into-asn1-module.patch -Patch0171: 0171-test_asn1-test-module-for-libtasn1.patch -Patch0172: 0172-grub-install-support-embedding-x509-certificates.patch -Patch0173: 0173-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0174: 0174-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0175: 0175-appended-signatures-support-verifying-appended-signa.patch -Patch0176: 0176-appended-signatures-verification-tests.patch -Patch0177: 0177-appended-signatures-documentation.patch -Patch0178: 0178-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0179: 0179-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0180: 0180-ieee1275-claim-more-memory.patch -Patch0181: 0181-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0182: 0182-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0183: 0183-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0184: 0184-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0185: 0185-efinet-Add-DHCP-proxy-support.patch -Patch0186: 0186-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0187: 0187-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0188: 0188-Suppress-gettext-error-message.patch -Patch0189: 0189-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0190: 0190-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0191: 0191-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0192: 0192-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0193: 0193-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0194: 0194-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0195: 0195-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0196: 0196-Print-module-name-on-license-check-failure.patch -Patch0197: 0197-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0198: 0198-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0199: 0199-fs-btrfs-Use-full-btrfs-bootloader-area.patch -Patch0200: 0200-Add-Fedora-location-of-DejaVu-SANS-font.patch -Patch0201: 0201-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch -Patch0202: 0202-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch -Patch0203: 0203-EFI-console-Do-not-set-colorstate-until-the-first-te.patch -Patch0204: 0204-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch -Patch0205: 0205-Use-visual-indentation-in-config.h.in.patch -Patch0206: 0206-Where-present-ensure-config-util.h-precedes-config.h.patch -Patch0207: 0207-Drop-gnulib-fix-base64.patch.patch -Patch0208: 0208-Drop-gnulib-no-abort.patch.patch -Patch0209: 0209-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0210: 0210-commands-search-Fix-bug-stopping-iteration-when-no-f.patch -Patch0211: 0211-search-new-efidisk-only-option-on-EFI-systems.patch -Patch0212: 0212-efi-new-connectefi-command.patch -Patch0213: 0213-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch -Patch0214: 0214-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch -Patch0215: 0215-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch -Patch0216: 0216-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0072: 0072-Add-support-for-non-Ethernet-network-cards.patch +Patch0073: 0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0074: 0074-bootp-New-net_bootp6-command.patch +Patch0075: 0075-efinet-UEFI-IPv6-PXE-support.patch +Patch0076: 0076-grub.texi-Add-net_bootp6-doument.patch +Patch0077: 0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0078: 0078-efinet-Setting-network-from-UEFI-device-path.patch +Patch0079: 0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0080: 0080-Support-UEFI-networking-protocols.patch +Patch0081: 0081-AUDIT-0-http-boot-tracker-bug.patch +Patch0082: 0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0083: 0083-Add-auto-hide-menu-support.patch +Patch0084: 0084-Add-grub-set-bootflag-utility.patch +Patch0085: 0085-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0086: 0086-gentpl-add-disable-support.patch +Patch0087: 0087-gentpl-add-pc-firmware-type.patch +Patch0088: 0088-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0089: 0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0090: 0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0091: 0091-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0092: 0092-Rework-how-the-fdt-command-builds.patch +Patch0093: 0093-Disable-non-wordsize-allocations-on-arm.patch +Patch0094: 0094-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0095: 0095-Make-grub_error-more-verbose.patch +Patch0096: 0096-Make-reset-an-alias-for-the-reboot-command.patch +Patch0097: 0097-Add-a-version-command.patch +Patch0098: 0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0099: 0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0100: 0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0101: 0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0102: 0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0103: 0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0104: 0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0105: 0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0106: 0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0107: 0107-Fix-getroot.c-s-trampolines.patch +Patch0108: 0108-Do-not-allow-stack-trampolines-anywhere.patch +Patch0109: 0109-Reimplement-boot_counter.patch +Patch0110: 0110-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0111: 0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0112: 0112-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0113: 0113-Make-it-possible-to-subtract-conditions-from-debug.patch +Patch0114: 0114-Export-all-variables-from-the-initial-context-when-c.patch +Patch0115: 0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0116: 0116-Fix-systemctl-kexec-exit-status-check.patch +Patch0117: 0117-Print-grub-emu-linux-loader-messages-as-debug.patch +Patch0118: 0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0119: 0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0120: 0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0121: 0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0122: 0122-Add-start-symbol-for-RISC-V.patch +Patch0123: 0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0124: 0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0125: 0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0126: 0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0127: 0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0128: 0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0129: 0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0130: 0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0131: 0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0132: 0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0133: 0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0134: 0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0135: 0135-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0136: 0136-efi-http-fix-some-allocation-error-checking.patch +Patch0137: 0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0138: 0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0139: 0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0140: 0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0141: 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0144: 0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0145: 0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0146: 0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0147: 0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0148: 0148-grub-install-disable-support-for-EFI-platforms.patch +Patch0149: 0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0150: 0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0151: 0151-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0152: 0152-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0153: 0153-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0154: 0154-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0155: 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0156: 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0157: 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0158: 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0159: 0159-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0160: 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0161: 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0162: 0162-pgp-factor-out-rsa_pad.patch +Patch0163: 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0164: 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0165: 0165-libtasn1-import-libtasn1-4.16.0.patch +Patch0166: 0166-libtasn1-disable-code-not-needed-in-grub.patch +Patch0167: 0167-libtasn1-changes-for-grub-compatibility.patch +Patch0168: 0168-libtasn1-compile-into-asn1-module.patch +Patch0169: 0169-test_asn1-test-module-for-libtasn1.patch +Patch0170: 0170-grub-install-support-embedding-x509-certificates.patch +Patch0171: 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0172: 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0173: 0173-appended-signatures-support-verifying-appended-signa.patch +Patch0174: 0174-appended-signatures-verification-tests.patch +Patch0175: 0175-appended-signatures-documentation.patch +Patch0176: 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0177: 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0178: 0178-ieee1275-claim-more-memory.patch +Patch0179: 0179-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0180: 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0181: 0181-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0182: 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0183: 0183-efinet-Add-DHCP-proxy-support.patch +Patch0184: 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0185: 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0186: 0186-Suppress-gettext-error-message.patch +Patch0187: 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0188: 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0189: 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0190: 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0191: 0191-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0192: 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0193: 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0194: 0194-Print-module-name-on-license-check-failure.patch +Patch0195: 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0196: 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0197: 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0198: 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch +Patch0199: 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +Patch0200: 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +Patch0201: 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +Patch0202: 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +Patch0203: 0203-Use-visual-indentation-in-config.h.in.patch +Patch0204: 0204-Where-present-ensure-config-util.h-precedes-config.h.patch +Patch0205: 0205-Drop-gnulib-fix-base64.patch.patch +Patch0206: 0206-Drop-gnulib-no-abort.patch.patch +Patch0207: 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch +Patch0208: 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +Patch0209: 0209-search-new-efidisk-only-option-on-EFI-systems.patch +Patch0210: 0210-efi-new-connectefi-command.patch +Patch0211: 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0212: 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +Patch0213: 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0214: 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/grub2.spec b/grub2.spec index f0feedb5..789399ea 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 31%{?dist} +Release: 32%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Mar 31 2022 Robbie Harwood - 1:2.06-32 +- Switch to upstream man pages + * Wed Mar 30 2022 Robbie Harwood - 2.06-31 - Revert previous change (grub2-pc-modules is built on i32) From eeff7639b35c67554e65de4d618967fec93c39c4 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 31 Mar 2022 21:23:48 +0000 Subject: [PATCH 121/294] Drop i32 build for real this time Signed-off-by: Robbie Harwood --- grub.macros | 4 ++-- grub2.spec | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/grub.macros b/grub.macros index 4162b823..037230d5 100644 --- a/grub.macros +++ b/grub.macros @@ -226,8 +226,8 @@ %ifarch x86_64 %global with_efi_common 1 -%global with_legacy_modules 0 -%global with_legacy_common 0 +%global with_legacy_modules 1 +%global with_legacy_common 1 %else %global with_efi_common 0 %global with_legacy_common 1 diff --git a/grub2.spec b/grub2.spec index 789399ea..6ba76e79 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 32%{?dist} +Release: 33%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -58,7 +58,7 @@ BuildRequires: pesign >= 0.99-8 BuildRequires: ccache %endif -ExcludeArch: s390 s390x +ExcludeArch: s390 s390x %{ix86} Obsoletes: %{name} <= %{evr} %if 0%{with_legacy_arch} @@ -526,6 +526,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Mar 31 2022 Robbie Harwood - 1:2.06-33 +- Drop i32 build for real this time + * Thu Mar 31 2022 Robbie Harwood - 1:2.06-32 - Switch to upstream man pages From d17f80cfd556d8a582756ee393361f6d203f2d77 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 1 Apr 2022 13:50:04 -0400 Subject: [PATCH 122/294] Update rpminspect configuration Signed-off-by: Robbie Harwood --- rpminspect.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rpminspect.yaml b/rpminspect.yaml index 015af4ea..e05d04c4 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -9,9 +9,6 @@ inspections: patches: off upstream: off - # https://bugzilla.redhat.com/show_bug.cgi?id=2007427 - manpage: off - # https://bugzilla.redhat.com/show_bug.cgi?id=2007428 elf: off @@ -20,3 +17,6 @@ inspections: # https://bugzilla.redhat.com/show_bug.cgi?id=2007431 permissions: off + + # https://bugzilla.redhat.com/show_bug.cgi?id=2007431 + addedfiles: off From 2e106f9a3e56545d02b768a43e90247659048ddf Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 12 Apr 2022 14:42:54 -0400 Subject: [PATCH 123/294] Drop use of which and update requirements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original patches by Zbigniew Jędrzejewski-Szmek. Merges: #16 Signed-off-by: Robbie Harwood --- 0059-Add-BLS-support-to-grub-mkconfig.patch | 4 ++-- 0062-Add-grub2-switch-to-blscfg.patch | 2 +- ...e-cmdline-when-generating-legacy-menu.patch | 2 +- grub2.spec | 18 ++++++++++++------ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/0059-Add-BLS-support-to-grub-mkconfig.patch b/0059-Add-BLS-support-to-grub-mkconfig.patch index ccdd403b..ba68046f 100644 --- a/0059-Add-BLS-support-to-grub-mkconfig.patch +++ b/0059-Add-BLS-support-to-grub-mkconfig.patch @@ -131,7 +131,7 @@ index fafeac950..d8bb40693 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 7bb3a211a..9fcd77cac 100644 +index 7bb3a211a..f1548a260 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -82,6 +82,218 @@ case x"$GRUB_FS" in @@ -248,7 +248,7 @@ index 7bb3a211a..9fcd77cac 100644 +} + +# Make BLS the default if GRUB_ENABLE_BLSCFG was not set and grubby is not installed. -+if [ -z "${GRUB_ENABLE_BLSCFG}" ] && [ -z "$(which new-kernel-pkg 2> /dev/null)" ]; then ++if [ -z "${GRUB_ENABLE_BLSCFG}" ] && ! command -v new-kernel-pkg >/dev/null; then + GRUB_ENABLE_BLSCFG="true" +fi + diff --git a/0062-Add-grub2-switch-to-blscfg.patch b/0062-Add-grub2-switch-to-blscfg.patch index bc1ac3f3..e3532591 100644 --- a/0062-Add-grub2-switch-to-blscfg.patch +++ b/0062-Add-grub2-switch-to-blscfg.patch @@ -381,7 +381,7 @@ index 000000000..a851424be +# Bye. +exit 0 diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 9fcd77cac..70d56518b 100644 +index f1548a260..c02c1f082 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -138,7 +138,7 @@ blsdir="/boot/loader/entries" diff --git a/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index ab236fc0..074d650a 100644 --- a/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 70d56518b..f8e868b6c 100644 +index c02c1f082..6af84b44e 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -256,7 +256,9 @@ if [ -z "\${kernelopts}" ]; then diff --git a/grub2.spec b/grub2.spec index 6ba76e79..c4cffaf8 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 33%{?dist} +Release: 34%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -84,7 +84,9 @@ hardware devices.\ Summary: grub2 common layout BuildArch: noarch Conflicts: grubby < 8.40-18 -Requires(post): util-linux +Requires(posttrans): util-linux-core +Requires(posttrans): coreutils +Requires(posttrans): grep %description common This package provides some directories which are required by various grub2 @@ -94,9 +96,10 @@ subpackages. Summary: Support tools for GRUB. Obsoletes: %{name}-tools < %{evr} Requires: %{name}-common = %{epoch}:%{version}-%{release} -Requires: gettext os-prober which file +Requires: gettext os-prober file Requires(pre): dracut -Requires(post): dracut +Requires(pre): grep +Requires(pre): sed %description tools %{desc} @@ -105,7 +108,7 @@ This subpackage provides tools for support of all platforms. %ifarch x86_64 %package tools-efi Summary: Support tools for GRUB. -Requires: gettext os-prober which file +Requires: gettext os-prober file Requires: %{name}-common = %{epoch}:%{version}-%{release} Obsoletes: %{name}-tools < %{evr} @@ -126,7 +129,7 @@ This subpackage provides tools for support of all platforms. %package tools-extra Summary: Support tools for GRUB. -Requires: gettext os-prober which file +Requires: gettext os-prober file Requires: %{name}-tools-minimal = %{epoch}:%{version}-%{release} Requires: %{name}-common = %{epoch}:%{version}-%{release} Obsoletes: %{name}-tools < %{evr} @@ -526,6 +529,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Apr 12 2022 Robbie Harwood - 2.06-34 +- Bump for requirements updates; no code changes + * Thu Mar 31 2022 Robbie Harwood - 1:2.06-33 - Drop i32 build for real this time From 6c2cc464515fdd21bc934e0b4c3109c7cdc2448f Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 13 Apr 2022 15:13:22 +0000 Subject: [PATCH 124/294] Enable "read" module Resolves: #2071644 Signed-off-by: Robbie Harwood --- grub.macros | 2 +- grub2.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/grub.macros b/grub.macros index 037230d5..d1ac1dc6 100644 --- a/grub.macros +++ b/grub.macros @@ -416,7 +416,7 @@ GRUB_MODULES=" all_video boot blscfg btrfs \\\ loadenv loopback linux lvm lsefi lsefimmap luks \\\ luks2 mdraid09 mdraid1x minicmd net \\\ normal part_apple part_msdos part_gpt \\\ - password_pbkdf2 pgp png reboot \\\ + password_pbkdf2 pgp png read reboot \\\ regexp search search_fs_uuid search_fs_file \\\ search_label serial sleep syslinuxcfg test tftp \\\ version video xfs zstd " \ diff --git a/grub2.spec b/grub2.spec index c4cffaf8..906296e4 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 34%{?dist} +Release: 35%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -529,6 +529,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Apr 13 2022 Robbie Harwood - 2.06-35 +- Enable "read" module +- Resolves: #2071644 + * Tue Apr 12 2022 Robbie Harwood - 2.06-34 - Bump for requirements updates; no code changes From 1d98b5f26098166435e0e85c3b887000fe6e3961 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 18 Apr 2022 17:50:28 +0000 Subject: [PATCH 125/294] Fix permission change report from rpm verification on grub.cfg Signed-off-by: Robbie Harwood --- grub.macros | 4 ++-- grub2.spec | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/grub.macros b/grub.macros index d1ac1dc6..ff58cecd 100644 --- a/grub.macros +++ b/grub.macros @@ -592,7 +592,7 @@ ln -s ../boot/%{name}/grub.cfg \\\ %{expand:%%files %{1}} \ %defattr(-,root,root,-) \ %config(noreplace) %{_sysconfdir}/%{name}.cfg \ -%ghost %config(noreplace) /boot/%{name}/grub.cfg \ +%ghost %config(noreplace) %attr(0700,root,root)/boot/%{name}/grub.cfg \ %dir %attr(0700,root,root)/boot/loader/entries \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ \ @@ -620,7 +620,7 @@ ln -s ../boot/%{name}/grub.cfg \\\ %endif \ %attr(0700,root,root)/boot/%{name}/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ -%ghost %config(noreplace) /boot/%{name}/grub.cfg \ +%ghost %config(noreplace) %attr(0700,root,root)/boot/%{name}/grub.cfg \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ diff --git a/grub2.spec b/grub2.spec index 906296e4..704efdc6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 35%{?dist} +Release: 36%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -529,6 +529,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Apr 18 2022 Robbie Harwood - 2.06-36 +- Fix permission change report from rpm verification on grub.cfg + * Wed Apr 13 2022 Robbie Harwood - 2.06-35 - Enable "read" module - Resolves: #2071644 From f9344de20ac5e841101ea84ac4e95cd4fa59cd66 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 18 Apr 2022 17:01:36 -0400 Subject: [PATCH 126/294] Stop using %{name} for things in the spec file There's no point to this (the packaging isn't generic, confusion between grub and grub2 in places, it's not fewer characters to type, have to think about escaping in macros, ...) and it makes searching for things needlessly difficult. This finishes the revert of 967c5629ed9fdb4e8572daa78f3bb5ac5e675e77 ("Don't harcode grub2 in the spec file") that was begun in af038a0bdc38f46db45fc5aeaca0a6942fc22440 ("Revert "Don't harcode grub2 in the spec file""). Signed-off-by: Robbie Harwood --- grub.macros | 102 ++++++++++++------------- grub2.spec | 216 ++++++++++++++++++++++++++-------------------------- 2 files changed, 159 insertions(+), 159 deletions(-) diff --git a/grub.macros b/grub.macros index ff58cecd..d967035e 100644 --- a/grub.macros +++ b/grub.macros @@ -237,13 +237,13 @@ %define define_legacy_variant() \ %{expand:%%package %%{1}} \ Summary: Bootloader with support for Linux, Multiboot, and more \ -Provides: %{name} = %{evr} \ -Obsoletes: %{name} < %{evr} \ -Requires: %{name}-common = %{evr} \ -Requires: %{name}-tools-minimal = %{evr} \ -Requires: %{name}-%{1}-modules = %{evr} \ +Provides: grub2 = %{evr} \ +Obsoletes: grub2 < %{evr} \ +Requires: grub2-common = %{evr} \ +Requires: grub2-tools-minimal = %{evr} \ +Requires: grub2-%{1}-modules = %{evr} \ Requires: gettext which file \ -Requires: %{name}-tools = %{evr} \ +Requires: grub2-tools = %{evr} \ Requires(pre): dracut \ Requires(post): dracut \ %{expand:%%description %%{1}} \ @@ -255,7 +255,7 @@ This subpackage provides support for %{1} systems. \ %%package %%{1}-modules \ Summary: Modules used to build custom grub images \ BuildArch: noarch \ -Requires: %%{name}-common = %%{evr} \ +Requires: grub2-common = %%{evr} \ %%description %%{1}-modules \ %%{desc} \ This subpackage provides support for rebuilding your own grub.efi. \ @@ -266,8 +266,8 @@ This subpackage provides support for rebuilding your own grub.efi. \ %{expand:%%package %%{1}-tools} \ Summary: Support tools for GRUB. \ Requires: gettext os-prober which file system-logos \ -Requires: %{name}-common = %{evr} \ -Requires: %{name}-tools-minimal = %{evr} \ +Requires: grub2-common = %{evr} \ +Requires: grub2-tools-minimal = %{evr} \ Requires: os-prober >= 1.58-11 \ Requires: gettext which file \ \ @@ -280,12 +280,12 @@ This subpackage provides tools for support of %%{1} platforms. \ %{expand:%%package %{1}} \ Summary: GRUB for EFI systems. \ Requires: efi-filesystem \ -Requires: %{name}-common = %{evr} \ -Requires: %{name}-tools-minimal >= %{evr} \ -Requires: %{name}-tools = %{evr} \ -Provides: %{name}-efi = %{evr} \ -%{?legacy_provides:Provides: %{name} = %{evr}} \ -%{-o:Obsoletes: %{name}-efi < %{evr}} \ +Requires: grub2-common = %{evr} \ +Requires: grub2-tools-minimal >= %{evr} \ +Requires: grub2-tools = %{evr} \ +Provides: grub2-efi = %{evr} \ +%{?legacy_provides:Provides: grub2 = %{evr}} \ +%{-o:Obsoletes: grub2-efi < %{evr}} \ \ %{expand:%%description %{1}} \ %{desc} \ @@ -296,9 +296,9 @@ This subpackage provides support for %{1} systems. \ %{expand:%%package %{1}-modules} \ Summary: Modules used to build custom grub.efi images \ BuildArch: noarch \ -Requires: %{name}-common = %{evr} \ -Provides: %{name}-efi-modules = %{evr} \ -Obsoletes: %{name}-efi-modules < %{evr} \ +Requires: grub2-common = %{evr} \ +Provides: grub2-efi-modules = %{evr} \ +Obsoletes: grub2-efi-modules < %{evr} \ %{expand:%%description %{1}-modules} \ %{desc} \ This subpackage provides support for rebuilding your own grub.efi. \ @@ -306,8 +306,8 @@ This subpackage provides support for rebuilding your own grub.efi. \ \ %{expand:%%package %{1}-cdboot} \ Summary: Files used to boot removeable media with EFI \ -Requires: %{name}-common = %{evr} \ -Provides: %{name}-efi-cdboot = %{evr} \ +Requires: grub2-common = %{evr} \ +Provides: grub2-efi-cdboot = %{evr} \ %{expand:%%description %{1}-cdboot} \ %{desc} \ This subpackage provides optional components of grub used with removeable media on %{1} systems.\ @@ -327,7 +327,7 @@ git init \ echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore \ echo '!*.[[:digit:]]' > util/.gitignore \ echo '!config.h' > include/grub/emu/.gitignore \ -git config user.email "%{name}-owner@fedoraproject.org" \ +git config user.email "grub2-owner@fedoraproject.org" \ git config user.name "Fedora Ninjas" \ git config gc.auto 0 \ rm -f configure \ @@ -350,8 +350,8 @@ rm -r build-aux m4 \ --with-platform=efi \\\ --with-utils=host \\\ --target=%{1} \\\ - --with-grubdir=%{name} \\\ - --program-transform-name=s,grub,%{name}, \\\ + --with-grubdir=grub2 \\\ + --program-transform-name=s,grub,grub2, \\\ --disable-werror || ( cat config.log ; exit 1 ) \ git add . \ git commit -m "After efi configure" \ @@ -454,8 +454,8 @@ cd grub-%{1}-%{tarversion} \ --with-platform=%{platform} \\\ --with-utils=host \\\ --target=%{_target_platform} \\\ - --with-grubdir=%{name} \\\ - --program-transform-name=s,grub,%{name}, \\\ + --with-grubdir=grub2 \\\ + --program-transform-name=s,grub,grub2, \\\ --disable-werror || ( cat config.log ; exit 1 ) \ git add . \ git commit -m "After legacy configure" \ @@ -471,8 +471,8 @@ cd grub-emu-%{tarversion} \ HOST_CPPFLAGS="-I$(pwd)" \\\ HOST_LDFLAGS="%{legacy_host_ldflags}" \\\ --with-platform=emu \\\ - --with-grubdir=%{name} \\\ - --program-transform-name=s,grub,%{name}, \\\ + --with-grubdir=grub2 \\\ + --program-transform-name=s,grub,grub2, \\\ --disable-werror || ( cat config.log ; exit 1 ) \ git add . \ git commit -m "After emu configure" \ @@ -498,7 +498,7 @@ find . '(' -iname gdb_grub \\\ find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \ install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ -%{expand:%%do_install_protected_file %{name}-%{alt_package_arch}} \ +%{expand:%%do_install_protected_file grub2-%{alt_package_arch}} \ cd .. \ %{nil} @@ -512,18 +512,18 @@ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ fi \ find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \ -ln -s ../boot/%{name}/grub.cfg \\\ - $RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg \ +ln -s ../boot/grub2/grub.cfg \\\ + $RPM_BUILD_ROOT%{_sysconfdir}/grub2-efi.cfg \ install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ %ifarch %{arm} \ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ %endif \ install -D -m 700 unicode.pf2 \\\ - ${RPM_BUILD_ROOT}/boot/%{name}/fonts/unicode.pf2 \ -${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ - ${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \ -%{expand:%%do_install_protected_file %{name}-%{package_arch}} \ + ${RPM_BUILD_ROOT}/boot/grub2/fonts/unicode.pf2 \ +${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\ + ${RPM_BUILD_ROOT}/boot/grub2/grubenv create \ +%{expand:%%do_install_protected_file grub2-%{package_arch}} \ cd .. \ %{nil} @@ -541,10 +541,10 @@ if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \ $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \ fi \ if [ %{3} -eq 0 ]; then \ - ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\ - ${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \ + ${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\ + ${RPM_BUILD_ROOT}/boot/grub2/grubenv create \ fi \ -%{expand:%%do_install_protected_file %{name}-%{legacy_package_arch}} \ +%{expand:%%do_install_protected_file grub2-%{legacy_package_arch}} \ cd .. \ %{nil} @@ -571,30 +571,30 @@ install -d -m 0755 \\\ $RPM_BUILD_ROOT%{_infodir}/ \ cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\ $RPM_BUILD_ROOT%{_datarootdir}/locale/en \ -cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \ +cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/grub2.info \ cp docs/grub-dev.info \\\ - $RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \ + $RPM_BUILD_ROOT%{_infodir}/grub2-dev.info \ install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \ -install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \ +install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/themes/system \ install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \ install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig \ touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub \ ln -sf ../default/grub \\\ ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \ -touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ -ln -s ../boot/%{name}/grub.cfg \\\ +touch ${RPM_BUILD_ROOT}/boot/grub2/grub.cfg \ +ln -s ../boot/grub2/grub.cfg \\\ ${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \ %{nil} %define define_legacy_variant_files() \ %{expand:%%files %{1}} \ %defattr(-,root,root,-) \ -%config(noreplace) %{_sysconfdir}/%{name}.cfg \ -%ghost %config(noreplace) %attr(0700,root,root)/boot/%{name}/grub.cfg \ +%config(noreplace) %{_sysconfdir}/grub2.cfg \ +%ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \ %dir %attr(0700,root,root)/boot/loader/entries \ -%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ +%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ \ %{expand:%if 0%{?with_legacy_modules} \ %{expand:%%files %{1}-modules} \ @@ -612,18 +612,18 @@ ln -s ../boot/%{name}/grub.cfg \\\ %define define_efi_variant_files() \ %{expand:%%files %{1}} \ %defattr(-,root,root,-) \ -%config(noreplace) %{_sysconfdir}/%{name}.cfg \ -%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \ +%config(noreplace) %{_sysconfdir}/grub2.cfg \ +%config(noreplace) %{_sysconfdir}/grub2-efi.cfg \ %attr(0700,root,root)%{efi_esp_dir}/%{2} \ %ifarch %{arm} \ %attr(0700,root,root)%{efi_esp_boot}/BOOTARM.EFI \ %endif \ -%attr(0700,root,root)/boot/%{name}/fonts \ +%attr(0700,root,root)/boot/grub2/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ -%ghost %config(noreplace) %attr(0700,root,root)/boot/%{name}/grub.cfg \ +%ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \ %ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ -%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \ +%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ %exclude %{_libdir}/grub/%{6} \ %exclude %{_libdir}/grub/%{6}/* \ @@ -640,5 +640,5 @@ ln -s ../boot/%{name}/grub.cfg \\\ %{expand:%%files %{1}-cdboot} \ %defattr(-,root,root,-) \ %attr(0700,root,root)%{efi_esp_dir}/%{3} \ -%attr(0700,root,root)/boot/%{name}/fonts \ +%attr(0700,root,root)/boot/grub2/fonts \ %{nil} diff --git a/grub2.spec b/grub2.spec index 704efdc6..3ce0542c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -59,12 +59,12 @@ BuildRequires: ccache %endif ExcludeArch: s390 s390x %{ix86} -Obsoletes: %{name} <= %{evr} +Obsoletes: grub2 <= %{evr} %if 0%{with_legacy_arch} -Requires: %{name}-%{legacy_package_arch} = %{evr} +Requires: grub2-%{legacy_package_arch} = %{evr} %else -Requires: %{name}-%{package_arch} = %{evr} +Requires: grub2-%{package_arch} = %{evr} %endif %global desc \ @@ -94,8 +94,8 @@ subpackages. %package tools Summary: Support tools for GRUB. -Obsoletes: %{name}-tools < %{evr} -Requires: %{name}-common = %{epoch}:%{version}-%{release} +Obsoletes: grub2-tools < %{evr} +Requires: grub2-common = %{epoch}:%{version}-%{release} Requires: gettext os-prober file Requires(pre): dracut Requires(pre): grep @@ -109,8 +109,8 @@ This subpackage provides tools for support of all platforms. %package tools-efi Summary: Support tools for GRUB. Requires: gettext os-prober file -Requires: %{name}-common = %{epoch}:%{version}-%{release} -Obsoletes: %{name}-tools < %{evr} +Requires: grub2-common = %{epoch}:%{version}-%{release} +Obsoletes: grub2-tools < %{evr} %description tools-efi %{desc} @@ -120,8 +120,8 @@ This subpackage provides tools for support of EFI platforms. %package tools-minimal Summary: Support tools for GRUB. Requires: gettext -Requires: %{name}-common = %{epoch}:%{version}-%{release} -Obsoletes: %{name}-tools < %{evr} +Requires: grub2-common = %{epoch}:%{version}-%{release} +Obsoletes: grub2-tools < %{evr} %description tools-minimal %{desc} @@ -130,9 +130,9 @@ This subpackage provides tools for support of all platforms. %package tools-extra Summary: Support tools for GRUB. Requires: gettext os-prober file -Requires: %{name}-tools-minimal = %{epoch}:%{version}-%{release} -Requires: %{name}-common = %{epoch}:%{version}-%{release} -Obsoletes: %{name}-tools < %{evr} +Requires: grub2-tools-minimal = %{epoch}:%{version}-%{release} +Requires: grub2-common = %{epoch}:%{version}-%{release} +Obsoletes: grub2-tools < %{evr} %description tools-extra %{desc} @@ -151,7 +151,7 @@ This subpackage provides tools for support of all platforms. %if 0%{with_emu_arch} %package emu Summary: GRUB user-space emulation. -Requires: %{name}-tools-minimal = %{epoch}:%{version}-%{release} +Requires: grub2-tools-minimal = %{epoch}:%{version}-%{release} %description emu %{desc} @@ -159,7 +159,7 @@ This subpackage provides the GRUB user-space emulation support of all platforms. %package emu-modules Summary: GRUB user-space emulation modules. -Requires: %{name}-tools-minimal = %{epoch}:%{version}-%{release} +Requires: grub2-tools-minimal = %{epoch}:%{version}-%{release} %description emu-modules %{desc} @@ -236,14 +236,14 @@ rm -fr $RPM_BUILD_ROOT %{expand:%do_emu_install %%{package_arch}} %endif rm -f $RPM_BUILD_ROOT%{_infodir}/dir -ln -s %{name}-set-password ${RPM_BUILD_ROOT}/%{_sbindir}/%{name}-setpassword -echo '.so man8/%{name}-set-password.8' > ${RPM_BUILD_ROOT}/%{_datadir}/man/man8/%{name}-setpassword.8 +ln -s grub2-set-password ${RPM_BUILD_ROOT}/%{_sbindir}/grub2-setpassword +echo '.so man8/grub2-set-password.8' > ${RPM_BUILD_ROOT}/%{_datadir}/man/man8/grub2-setpassword.8 %ifnarch x86_64 -rm -vf ${RPM_BUILD_ROOT}/%{_bindir}/%{name}-render-label -rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/%{name}-bios-setup -rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/%{name}-macbless +rm -vf ${RPM_BUILD_ROOT}/%{_bindir}/grub2-render-label +rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/grub2-bios-setup +rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/grub2-macbless %endif -%{expand:%%do_install_protected_file %{name}-tools-minimal} +%{expand:%%do_install_protected_file grub2-tools-minimal} %find_lang grub @@ -364,9 +364,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %{_prefix}/lib/kernel/install.d/99-grub-mkconfig.install %dir %{_datarootdir}/grub %exclude %{_datarootdir}/grub/* -%dir /boot/%{name} -%dir /boot/%{name}/themes/ -%dir /boot/%{name}/themes/system +%dir /boot/grub2 +%dir /boot/grub2/themes/ +%dir /boot/grub2/themes/system %attr(0700,root,root) %dir /boot/grub2 %exclude /boot/grub2/* %dir %attr(0700,root,root) %{efi_esp_dir} @@ -379,30 +379,30 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %doc docs/font_char_metrics.png %files tools-minimal -%{_sbindir}/%{name}-get-kernel-settings -%{_sbindir}/%{name}-probe -%attr(4755, root, root) %{_sbindir}/%{name}-set-bootflag -%{_sbindir}/%{name}-set-default -%{_sbindir}/%{name}-set*password -%{_bindir}/%{name}-editenv -%{_bindir}/%{name}-mkpasswd-pbkdf2 -%{_bindir}/%{name}-mount -%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-tools-minimal.conf +%{_sbindir}/grub2-get-kernel-settings +%{_sbindir}/grub2-probe +%attr(4755, root, root) %{_sbindir}/grub2-set-bootflag +%{_sbindir}/grub2-set-default +%{_sbindir}/grub2-set*password +%{_bindir}/grub2-editenv +%{_bindir}/grub2-mkpasswd-pbkdf2 +%{_bindir}/grub2-mount +%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-tools-minimal.conf -%{_datadir}/man/man3/%{name}-get-kernel-settings* -%{_datadir}/man/man8/%{name}-set-default* -%{_datadir}/man/man8/%{name}-set*password* -%{_datadir}/man/man1/%{name}-editenv* -%{_datadir}/man/man1/%{name}-mkpasswd-* +%{_datadir}/man/man3/grub2-get-kernel-settings* +%{_datadir}/man/man8/grub2-set-default* +%{_datadir}/man/man8/grub2-set*password* +%{_datadir}/man/man1/grub2-editenv* +%{_datadir}/man/man1/grub2-mkpasswd-* %ifarch x86_64 %files tools-efi -%{_bindir}/%{name}-glue-efi -%{_bindir}/%{name}-render-label -%{_sbindir}/%{name}-macbless -%{_datadir}/man/man1/%{name}-glue-efi* -%{_datadir}/man/man1/%{name}-render-label* -%{_datadir}/man/man8/%{name}-macbless* +%{_bindir}/grub2-glue-efi +%{_bindir}/grub2-render-label +%{_sbindir}/grub2-macbless +%{_datadir}/man/man1/grub2-glue-efi* +%{_datadir}/man/man1/grub2-render-label* +%{_datadir}/man/man8/grub2-macbless* %endif %files tools @@ -414,98 +414,98 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %{_userunitdir}/timers.target.wants %{_unitdir}/grub-boot-indeterminate.service %{_unitdir}/system-update.target.wants -%{_unitdir}/%{name}-systemd-integration.service +%{_unitdir}/grub2-systemd-integration.service %{_unitdir}/reboot.target.wants %{_unitdir}/systemd-logind.service.d -%{_infodir}/%{name}* +%{_infodir}/grub2* %{_datarootdir}/grub/* -%{_sbindir}/%{name}-install +%{_sbindir}/grub2-install %exclude %{_datarootdir}/grub/themes %exclude %{_datarootdir}/grub/*.h %{_datarootdir}/bash-completion/completions/grub -%{_sbindir}/%{name}-mkconfig -%{_sbindir}/%{name}-switch-to-blscfg -%{_sbindir}/%{name}-rpm-sort -%{_sbindir}/%{name}-reboot -%{_bindir}/%{name}-file -%{_bindir}/%{name}-menulst2cfg -%{_bindir}/%{name}-mkimage -%{_bindir}/%{name}-mkrelpath -%{_bindir}/%{name}-script-check -%{_libexecdir}/%{name} +%{_sbindir}/grub2-mkconfig +%{_sbindir}/grub2-switch-to-blscfg +%{_sbindir}/grub2-rpm-sort +%{_sbindir}/grub2-reboot +%{_bindir}/grub2-file +%{_bindir}/grub2-menulst2cfg +%{_bindir}/grub2-mkimage +%{_bindir}/grub2-mkrelpath +%{_bindir}/grub2-script-check +%{_libexecdir}/grub2 %{_datadir}/man/man?/* # exclude man pages from tools-extra -%exclude %{_datadir}/man/man8/%{name}-sparc64-setup* -%exclude %{_datadir}/man/man1/%{name}-fstest* -%exclude %{_datadir}/man/man1/%{name}-glue-efi* -%exclude %{_datadir}/man/man1/%{name}-kbdcomp* -%exclude %{_datadir}/man/man1/%{name}-mkfont* -%exclude %{_datadir}/man/man1/%{name}-mklayout* -%exclude %{_datadir}/man/man1/%{name}-mknetdir* -%exclude %{_datadir}/man/man1/%{name}-mkrescue* -%exclude %{_datadir}/man/man1/%{name}-mkstandalone* -%exclude %{_datadir}/man/man1/%{name}-syslinux2cfg* +%exclude %{_datadir}/man/man8/grub2-sparc64-setup* +%exclude %{_datadir}/man/man1/grub2-fstest* +%exclude %{_datadir}/man/man1/grub2-glue-efi* +%exclude %{_datadir}/man/man1/grub2-kbdcomp* +%exclude %{_datadir}/man/man1/grub2-mkfont* +%exclude %{_datadir}/man/man1/grub2-mklayout* +%exclude %{_datadir}/man/man1/grub2-mknetdir* +%exclude %{_datadir}/man/man1/grub2-mkrescue* +%exclude %{_datadir}/man/man1/grub2-mkstandalone* +%exclude %{_datadir}/man/man1/grub2-syslinux2cfg* # exclude man pages from tools-minimal -%exclude %{_datadir}/man/man3/%{name}-get-kernel-settings* -%exclude %{_datadir}/man/man8/%{name}-set-default* -%exclude %{_datadir}/man/man8/%{name}-set*password* -%exclude %{_datadir}/man/man1/%{name}-editenv* -%exclude %{_datadir}/man/man1/%{name}-mkpasswd-* -%exclude %{_datadir}/man/man8/%{name}-macbless* -%exclude %{_datadir}/man/man1/%{name}-render-label* +%exclude %{_datadir}/man/man3/grub2-get-kernel-settings* +%exclude %{_datadir}/man/man8/grub2-set-default* +%exclude %{_datadir}/man/man8/grub2-set*password* +%exclude %{_datadir}/man/man1/grub2-editenv* +%exclude %{_datadir}/man/man1/grub2-mkpasswd-* +%exclude %{_datadir}/man/man8/grub2-macbless* +%exclude %{_datadir}/man/man1/grub2-render-label* %if %{with_legacy_arch} -%{_sbindir}/%{name}-install +%{_sbindir}/grub2-install %ifarch x86_64 -%{_sbindir}/%{name}-bios-setup +%{_sbindir}/grub2-bios-setup %else -%exclude %{_sbindir}/%{name}-bios-setup -%exclude %{_datadir}/man/man8/%{name}-bios-setup* +%exclude %{_sbindir}/grub2-bios-setup +%exclude %{_datadir}/man/man8/grub2-bios-setup* %endif %ifarch %{sparc} -%{_sbindir}/%{name}-sparc64-setup +%{_sbindir}/grub2-sparc64-setup %else -%exclude %{_sbindir}/%{name}-sparc64-setup -%exclude %{_datadir}/man/man8/%{name}-sparc64-setup* +%exclude %{_sbindir}/grub2-sparc64-setup +%exclude %{_datadir}/man/man8/grub2-sparc64-setup* %endif %ifarch %{sparc} ppc ppc64 ppc64le -%{_sbindir}/%{name}-ofpathname +%{_sbindir}/grub2-ofpathname %else -%exclude %{_sbindir}/%{name}-ofpathname -%exclude %{_datadir}/man/man8/%{name}-ofpathname* +%exclude %{_sbindir}/grub2-ofpathname +%exclude %{_datadir}/man/man8/grub2-ofpathname* %endif %endif %files tools-extra -%{_bindir}/%{name}-fstest -%{_bindir}/%{name}-kbdcomp -%{_bindir}/%{name}-mkfont -%{_bindir}/%{name}-mklayout -%{_bindir}/%{name}-mknetdir +%{_bindir}/grub2-fstest +%{_bindir}/grub2-kbdcomp +%{_bindir}/grub2-mkfont +%{_bindir}/grub2-mklayout +%{_bindir}/grub2-mknetdir %ifnarch %{sparc} -%{_bindir}/%{name}-mkrescue -%{_datadir}/man/man1/%{name}-mkrescue* +%{_bindir}/grub2-mkrescue +%{_datadir}/man/man1/grub2-mkrescue* %else -%exclude %{_datadir}/man/man1/%{name}-mkrescue* +%exclude %{_datadir}/man/man1/grub2-mkrescue* %endif -%{_bindir}/%{name}-mkstandalone -%{_bindir}/%{name}-syslinux2cfg +%{_bindir}/grub2-mkstandalone +%{_bindir}/grub2-syslinux2cfg %{_sysconfdir}/sysconfig/grub -%{_datadir}/man/man1/%{name}-fstest* -%{_datadir}/man/man1/%{name}-kbdcomp* -%{_datadir}/man/man1/%{name}-mkfont* -%{_datadir}/man/man1/%{name}-mklayout* -%{_datadir}/man/man1/%{name}-mknetdir* -%{_datadir}/man/man1/%{name}-mkstandalone* -%{_datadir}/man/man1/%{name}-syslinux2cfg* -%exclude %{_bindir}/%{name}-glue-efi -%exclude %{_sbindir}/%{name}-sparc64-setup -%exclude %{_sbindir}/%{name}-ofpathname -%exclude %{_datadir}/man/man1/%{name}-glue-efi* -%exclude %{_datadir}/man/man8/%{name}-ofpathname* -%exclude %{_datadir}/man/man8/%{name}-sparc64-setup* +%{_datadir}/man/man1/grub2-fstest* +%{_datadir}/man/man1/grub2-kbdcomp* +%{_datadir}/man/man1/grub2-mkfont* +%{_datadir}/man/man1/grub2-mklayout* +%{_datadir}/man/man1/grub2-mknetdir* +%{_datadir}/man/man1/grub2-mkstandalone* +%{_datadir}/man/man1/grub2-syslinux2cfg* +%exclude %{_bindir}/grub2-glue-efi +%exclude %{_sbindir}/grub2-sparc64-setup +%exclude %{_sbindir}/grub2-ofpathname +%exclude %{_datadir}/man/man1/grub2-glue-efi* +%exclude %{_datadir}/man/man8/grub2-ofpathname* +%exclude %{_datadir}/man/man8/grub2-sparc64-setup* %exclude %{_datarootdir}/grub/themes/starfield %if 0%{with_efi_arch} @@ -520,8 +520,8 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %if 0%{with_emu_arch} %files emu -%{_bindir}/%{name}-emu* -%{_datadir}/man/man1/%{name}-emu* +%{_bindir}/grub2-emu* +%{_datadir}/man/man1/grub2-emu* %files emu-modules %{_libdir}/grub/%{emuarch}-emu/* From e622855aa21390882a7378d758aea9e1c1d0d32b Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 18 Apr 2022 21:58:58 +0000 Subject: [PATCH 127/294] Attempt to fix version display Signed-off-by: Robbie Harwood --- ...-Fix-user-facing-typo-with-an-incorr.patch | 2 +- ...-Properly-disable-the-os-prober-by-d.patch | 4 +- ...tes-Disable-the-os-prober-by-default.patch | 4 +- ...d-support-for-Linux-EFI-stub-loading.patch | 26 ++++----- 0005-Rework-linux-command.patch | 2 +- 0006-Rework-linux16-command.patch | 2 +- ...ecureboot-support-on-efi-chainloader.patch | 14 ++--- ...loaders-that-link-in-efi-mode-honor-.patch | 32 +++++------ ...rch-64-on-32-boot-in-linuxefi-loader.patch | 6 +-- 0010-re-write-.gitignore.patch | 14 ++--- ...ient-architecture-CAS-reboot-support.patch | 8 +-- ...nsole-display-attr-when-clear-screen.patch | 2 +- ...video-support-for-IBM-power-machines.patch | 6 +-- 0014-Move-bash-completion-script-922997.patch | 4 +- ...o-include-entries-by-title-not-just-.patch | 2 +- 0016-Make-exit-take-a-return-code.patch | 28 +++++----- ...es-load-an-env-block-from-a-variable.patch | 4 +- 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch | 4 +- 0019-Add-fw_path-variable-revised.patch | 4 +- ...-hex-hex-straight-through-unmolested.patch | 6 +-- ...g-module-to-parse-Boot-Loader-Specif.patch | 20 +++---- 0022-Add-devicetree-loading.patch | 4 +- 0023-Enable-pager-by-default.-985860.patch | 2 +- ...n-t-say-GNU-Linux-in-generated-menus.patch | 53 +++++++++++++++++-- ...rame-to-list-of-relocations-stripped.patch | 2 +- ...password-to-boot-entries-generated-b.patch | 2 +- ...ix-when-fallback-searching-for-grub-.patch | 2 +- ...-before-grub.cfg-on-tftp-config-file.patch | 2 +- ...CLASS-in-10_linux-from-etc-os-releas.patch | 2 +- ...t-ordering-for-.debug-and-rescue-ker.patch | 2 +- 0031-Try-prefix-if-fw_path-doesn-t-work.patch | 6 +-- 0032-Use-rpm-s-sort-for-grub2-mkconfig.patch | 10 ++-- ...fig-construct-titles-that-look-like-.patch | 2 +- ...ly-grub2-password-config-tool-985962.patch | 12 ++--- 0035-tcp-add-window-scaling-support.patch | 2 +- ...net-and-bootp-add-support-for-dhcpv6.patch | 12 ++--- ...rnel-settings-and-use-it-in-10_linux.patch | 14 ++--- ...1374141-fix-incorrect-mask-for-ppc64.patch | 2 +- 0039-Make-grub_fatal-also-backtrace.patch | 10 ++-- ...fo-pages-say-grub2-where-appropriate.patch | 4 +- ...-chainloader-entries-don-t-try-any-x.patch | 2 +- ...-Add-ability-to-boot-from-subvolumes.patch | 4 +- ...port-btrfs_subvol-and-btrfs_subvolid.patch | 2 +- 0044-grub2-btrfs-03-follow_default.patch | 2 +- 0045-grub2-btrfs-04-grub2-install.patch | 12 ++--- 0046-grub2-btrfs-05-grub2-mkconfig.patch | 10 ++-- 0047-grub2-btrfs-06-subvol-mount.patch | 8 +-- ...subvol-name-scheme-to-support-old-sn.patch | 2 +- ...-correctly-with-btrfs-snapshots-bsc-.patch | 2 +- ...ocate_pool-and-grub_efi_free_pool-wr.patch | 2 +- ...fi_.-memory-helpers-where-reasonable.patch | 2 +- 0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 4 +- 0053-don-t-use-int-for-efi-status.patch | 2 +- ...INIT-declare-its-function-prototypes.patch | 2 +- ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 2 +- ...d-xen-or-multiboot-2-modules-as-need.patch | 2 +- ...-calibration-not-take-51-seconds-to-.patch | 2 +- 0058-align-struct-efi_variable-better.patch | 4 +- 0059-Add-BLS-support-to-grub-mkconfig.patch | 6 +-- ...-backtrace-on-grub_abort-for-grub-em.patch | 2 +- ...nux-and-initrd-commands-for-grub-emu.patch | 16 +++--- 0062-Add-grub2-switch-to-blscfg.patch | 10 ++-- 0063-make-better-backtraces.patch | 48 ++++++++--------- ...w-our-startup-message-if-debug-is-se.patch | 2 +- ...-some-minor-include-path-weirdnesses.patch | 8 +-- ...it-possible-to-enabled-build-id-sha1.patch | 4 +- ...f-grub_dprintf-without-the-file-line.patch | 4 +- ...dprintf-that-tells-us-load-addresses.patch | 8 +-- 0069-Fixup-for-newer-compiler.patch | 4 +- ...-export-the-start-and-_start-symbols.patch | 2 +- 0071-Fixup-for-newer-compiler.patch | 2 +- ...pport-for-non-Ethernet-network-cards.patch | 24 ++++----- ...racketed-ipv6-addrs-and-port-numbers.patch | 8 +-- 0074-bootp-New-net_bootp6-command.patch | 10 ++-- 0075-efinet-UEFI-IPv6-PXE-support.patch | 4 +- 0076-grub.texi-Add-net_bootp6-doument.patch | 2 +- ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 4 +- ...etting-network-from-UEFI-device-path.patch | 4 +- ...etting-DNS-server-from-UEFI-protocol.patch | 4 +- 0080-Support-UEFI-networking-protocols.patch | 34 ++++++------ 0081-AUDIT-0-http-boot-tracker-bug.patch | 4 +- ...-incr-command-to-increment-integer-v.patch | 2 +- 0083-Add-auto-hide-menu-support.patch | 6 +-- 0084-Add-grub-set-bootflag-utility.patch | 12 ++--- ...b-boot-indeterminate.service-example.patch | 2 +- 0086-gentpl-add-disable-support.patch | 2 +- 0087-gentpl-add-pc-firmware-type.patch | 2 +- ...e-the-firmware-acceleration-for-http.patch | 2 +- ...ot_url-reflect-the-protocol-hostname.patch | 2 +- ...n-tell-configure-which-cflags-utils-.patch | 6 +-- ...make-it-possible-to-run-checkers-on-.patch | 6 +-- 0092-Rework-how-the-fdt-command-builds.patch | 10 ++-- ...able-non-wordsize-allocations-on-arm.patch | 2 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 4 +- 0095-Make-grub_error-more-verbose.patch | 4 +- ...eset-an-alias-for-the-reboot-command.patch | 2 +- 0097-Add-a-version-command.patch | 18 ++++--- ...dprintf-and-nerf-dprintf-in-script.c.patch | 8 +-- ...-Better-memory-allocation-and-error-.patch | 4 +- ...tter-locations-for-kernel-and-initrd.patch | 16 +++--- ...p-all-the-places-Wsign-compare-error.patch | 22 ++++---- ...gn-compare-Wno-conversion-Wno-error-.patch | 4 +- ...ce-buffers-for-reading-to-addresses-.patch | 2 +- ...-arrange-grub_cmd_linux-a-little-bit.patch | 2 +- ...e-our-own-allocator-for-kernel-stuff.patch | 2 +- ...itrd-params-cmdline-allocations-abov.patch | 4 +- 0107-Fix-getroot.c-s-trampolines.patch | 2 +- ...not-allow-stack-trampolines-anywhere.patch | 4 +- 0109-Reimplement-boot_counter.patch | 8 +-- ...ntry-selection-based-on-ID-and-title.patch | 2 +- ...try-users-option-argument-to-be-opti.patch | 2 +- ...export-env-and-efi-load-env-commands.patch | 16 +++--- ...le-to-subtract-conditions-from-debug.patch | 2 +- ...bles-from-the-initial-context-when-c.patch | 4 +- ...-boot-success-reset-from-menu-auto-h.patch | 8 +-- ...ix-systemctl-kexec-exit-status-check.patch | 2 +- ...b-emu-linux-loader-messages-as-debug.patch | 2 +- ...t-boot-commands-will-only-return-on-.patch | 2 +- ...g-Update-comment-about-running-as-ro.patch | 2 +- ...g-Write-new-env-to-tmpfile-and-then-.patch | 2 +- ...indeterminate-getting-set-on-boot_su.patch | 2 +- 0122-Add-start-symbol-for-RISC-V.patch | 2 +- ...conf-Force-autogen.sh-to-use-python3.patch | 2 +- ...fw-http-_path-variables-to-make-them.patch | 4 +- ...-literal-IPv6-addresses-in-square-br.patch | 2 +- ...o-specify-a-port-number-in-addresses.patch | 2 +- ...mprove-check-to-detect-literal-IPv6-.patch | 2 +- ...debug-message-if-parsing-the-address.patch | 2 +- ...so-accept-F8-as-a-user-interrupt-key.patch | 2 +- ...se-address-before-jumping-to-the-PE-.patch | 2 +- ...ate-TPM-measurement-errors-to-the-ve.patch | 2 +- ...maximum-bounce-buffer-size-to-16-MiB.patch | 2 +- ...fix-when-the-HTTP-path-is-relative-a.patch | 2 +- ...turn-in-efi-export-env-and-efi-load-.patch | 2 +- ...p-fix-some-allocation-error-checking.patch | 2 +- ...p-fix-some-allocation-error-checking.patch | 2 +- ...g.c-fix-some-potential-allocation-ov.patch | 4 +- ...integer-overflows-in-grub_cmd_initrd.patch | 2 +- ...rnel-validation-without-shim-protoco.patch | 8 +-- ...ar-pointers-in-grub-core-net-bootp.c.patch | 2 +- ...ointers-in-grub-core-net-efi-ip4_con.patch | 2 +- ...ointers-in-grub-core-net-efi-ip6_con.patch | 2 +- ...-pointers-in-grub-core-net-efi-net.c.patch | 2 +- ...-pointers-in-grub-core-net-efi-pxe.c.patch | 2 +- ...gration-scripts-to-make-systemctl-re.patch | 12 ++--- ...ion.sh-Also-set-old-menu_show_once-g.patch | 2 +- ...set-1-when-keyboard-is-in-Translate-.patch | 4 +- ...ll-disable-support-for-EFI-platforms.patch | 4 +- ...imestamps-configure-flag-to-prepend-.patch | 6 +-- ...ements-to-grub_disk_open-and-grub_di.patch | 2 +- ...on-grub_debug_is_enabled-void-return.patch | 4 +- ...ear-screen-when-debugging-is-enabled.patch | 4 +- ..._-instrumentation-new-file-debug-tag.patch | 2 +- ...-Avoiding-many-unecessary-open-close.patch | 2 +- ...-implements-fibre-channel-discovery-.patch | 2 +- ...erpc-enables-device-mapper-discovery.patch | 2 +- ...fallback_set-var-to-force-the-set-ma.patch | 2 +- ...igning-grub-with-an-appended-signatu.patch | 12 ++--- ...rub-Document-signing-grub-under-UEFI.patch | 2 +- ...nt-signing-grub-with-an-appended-sig.patch | 2 +- ...e-grub_dl_set_persistent-for-the-emu.patch | 2 +- 0162-pgp-factor-out-rsa_pad.patch | 8 +-- ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 4 +- ...p-tweaks-in-preparation-for-libtasn1.patch | 6 +-- 0165-libtasn1-import-libtasn1-4.16.0.patch | 30 +++++------ ...asn1-disable-code-not-needed-in-grub.patch | 12 ++--- ...tasn1-changes-for-grub-compatibility.patch | 12 ++--- 0168-libtasn1-compile-into-asn1-module.patch | 4 +- 0169-test_asn1-test-module-for-libtasn1.patch | 32 +++++------ ...-support-embedding-x509-certificates.patch | 12 ++--- ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 4 +- ...res-parse-PKCS-7-signedData-and-X.50.patch | 8 +-- ...res-support-verifying-appended-signa.patch | 6 +-- ...pended-signatures-verification-tests.patch | 8 +-- 0175-appended-signatures-documentation.patch | 2 +- ...er-lockdown-based-on-ibm-secure-boot.patch | 8 +-- ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 2 +- 0178-ieee1275-claim-more-memory.patch | 4 +- ...-memory-with-ibm-client-architecture.patch | 6 +-- ...-Also-handle-the-Extended-Key-Usage-.patch | 6 +-- ...eee1275-ofdisk-retry-on-open-failure.patch | 4 +- ...ainloading-EFI-apps-from-loop-mounts.patch | 6 +-- 0183-efinet-Add-DHCP-proxy-support.patch | 2 +- ...gnore-checksum-seed-incompat-feature.patch | 2 +- ...-cmdline-when-generating-legacy-menu.patch | 2 +- 0186-Suppress-gettext-error-message.patch | 2 +- ...d-Always-use-boot-grub2-user.cfg-as-.patch | 2 +- ...for-EFI-at-runtime-instead-of-config.patch | 2 +- ...or-if-boot-to-firmware-setup-is-not-.patch | 2 +- ...x-EFI-loader-kernel-image-allocation.patch | 6 +-- ...over-the-device-to-read-the-config-f.patch | 2 +- ...etting-of-prefix-for-signed-binary-c.patch | 2 +- ...adable-filesystem-with-v4-superblock.patch | 2 +- ...module-name-on-license-check-failure.patch | 2 +- ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 4 +- ...-mkconfig-restore-umask-for-grub.cfg.patch | 2 +- ...btrfs-Use-full-btrfs-bootloader-area.patch | 4 +- ...-Fedora-location-of-DejaVu-SANS-font.patch | 2 +- ...t-show-Booting-s-msg-when-auto-booti.patch | 2 +- ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 2 +- ...ot-set-colorstate-until-the-first-te.patch | 2 +- ...ot-set-cursor-until-the-first-text-o.patch | 2 +- ...se-visual-indentation-in-config.h.in.patch | 2 +- ...sure-config-util.h-precedes-config.h.patch | 36 ++++++------- 0205-Drop-gnulib-fix-base64.patch.patch | 12 ++--- 0206-Drop-gnulib-no-abort.patch.patch | 8 +-- ...version-and-drop-most-gnulib-patches.patch | 34 ++++++------ ...Fix-bug-stopping-iteration-when-no-f.patch | 2 +- ...w-efidisk-only-option-on-EFI-systems.patch | 6 +-- 0210-efi-new-connectefi-command.patch | 16 +++--- ...-i386-efi-linux.c-do-not-validate-ke.patch | 2 +- ...-arm64-linux.c-do-not-validate-kerne.patch | 2 +- ...-efi-chainloader.c-do-not-validate-c.patch | 2 +- ...-efi-linux.c-drop-now-unused-grub_li.patch | 4 +- grub2.spec | 5 +- 215 files changed, 679 insertions(+), 631 deletions(-) diff --git a/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch b/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch index 3ddefe63..4824aa14 100644 --- a/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch +++ b/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch @@ -10,7 +10,7 @@ This reverts commit 722737630889607c3b5761f1f5a48f1674cd2821. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 5984e92d2..946224812 100644 +index 5984e92d29..9462248128 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -36,7 +36,7 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n diff --git a/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch b/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch index 5429c42c..05ac0f8e 100644 --- a/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch +++ b/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch @@ -10,7 +10,7 @@ This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925. 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f8cbb8d7a..d3e879b8e 100644 +index f8cbb8d7a2..d3e879b8e5 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -140,9 +140,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2 @@ -40,7 +40,7 @@ index f8cbb8d7a..d3e879b8e 100644 GRUB_SAVEDEFAULT \ GRUB_ENABLE_CRYPTODISK \ diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 946224812..80685b15f 100644 +index 9462248128..80685b15f4 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0003-Revert-templates-Disable-the-os-prober-by-default.patch b/0003-Revert-templates-Disable-the-os-prober-by-default.patch index 4e4dc55c..94927953 100644 --- a/0003-Revert-templates-Disable-the-os-prober-by-default.patch +++ b/0003-Revert-templates-Disable-the-os-prober-by-default.patch @@ -10,7 +10,7 @@ This reverts commit e346414725a70e5c74ee87ca14e580c66f517666. 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index f8b4b3b21..69f08d289 100644 +index f8b4b3b21a..69f08d289f 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1519,13 +1519,10 @@ boot sequence. If you have problems, set this option to @samp{text} and @@ -46,7 +46,7 @@ index f8b4b3b21..69f08d289 100644 First create a separate GRUB partition, big enough to hold GRUB. Some of the following entries show how to load OS installer images from this same partition, diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 80685b15f..1b91c102f 100644 +index 80685b15f4..1b91c102f3 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0004-Add-support-for-Linux-EFI-stub-loading.patch b/0004-Add-support-for-Linux-EFI-stub-loading.patch index bdd7dde5..745973e5 100644 --- a/0004-Add-support-for-Linux-EFI-stub-loading.patch +++ b/0004-Add-support-for-Linux-EFI-stub-loading.patch @@ -44,7 +44,7 @@ moves the check into grub_dl_load_file. create mode 100644 include/grub/efi/linux.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 8022e1c0a..45d3edaa4 100644 +index 8022e1c0a7..45d3edaa4d 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1734,13 +1734,6 @@ module = { @@ -88,7 +88,7 @@ index 8022e1c0a..45d3edaa4 100644 module = { diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 48f8a7907..b71493709 100644 +index 48f8a79073..b714937095 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -38,6 +38,14 @@ @@ -127,7 +127,7 @@ index 48f8a7907..b71493709 100644 file = grub_file_open (filename, GRUB_FILE_TYPE_GRUB_MODULE); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 8cff7be02..35b8f6706 100644 +index 8cff7be028..35b8f67060 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -286,6 +286,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -166,7 +166,7 @@ index 8cff7be02..35b8f6706 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 9838fb2f5..f6aef0ef6 100644 +index 9838fb2f50..f6aef0ef64 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address, @@ -209,7 +209,7 @@ index 9838fb2f5..f6aef0ef6 100644 void * grub_efi_allocate_pages_real (grub_efi_physical_address_t address, diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index ef3e9f944..a312c6686 100644 +index ef3e9f9444..a312c66868 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -29,6 +29,7 @@ @@ -390,7 +390,7 @@ index ef3e9f944..a312c6686 100644 linux_args = grub_malloc (cmdline_size); if (!linux_args) diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c -index 22cc25ecc..d9b7a9ba4 100644 +index 22cc25eccd..d9b7a9ba40 100644 --- a/grub-core/loader/arm64/xen_boot.c +++ b/grub-core/loader/arm64/xen_boot.c @@ -266,7 +266,6 @@ xen_boot (void) @@ -403,7 +403,7 @@ index 22cc25ecc..d9b7a9ba4 100644 diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c new file mode 100644 -index 000000000..c24202a5d +index 0000000000..c24202a5dd --- /dev/null +++ b/grub-core/loader/efi/linux.c @@ -0,0 +1,70 @@ @@ -479,7 +479,7 @@ index 000000000..c24202a5d +#pragma GCC diagnostic pop diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c new file mode 100644 -index 000000000..bb2616a80 +index 0000000000..bb2616a809 --- /dev/null +++ b/grub-core/loader/i386/efi/linux.c @@ -0,0 +1,335 @@ @@ -819,7 +819,7 @@ index 000000000..bb2616a80 + grub_unregister_command (cmd_initrdefi); +} diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 2a2995201..8be4c3b3f 100644 +index 2a29952016..8be4c3b3f4 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -474,14 +474,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), @@ -853,7 +853,7 @@ index 2a2995201..8be4c3b3f 100644 + grub_unregister_command (cmd_initrd16); } diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index bcd5a7eb1..b582f67f6 100644 +index bcd5a7eb18..b582f67f66 100644 --- a/include/grub/arm/linux.h +++ b/include/grub/arm/linux.h @@ -20,6 +20,7 @@ @@ -883,7 +883,7 @@ index bcd5a7eb1..b582f67f6 100644 #if defined GRUB_MACHINE_UBOOT diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index 7e22b4ab6..ea030312d 100644 +index 7e22b4ab69..ea030312df 100644 --- a/include/grub/arm64/linux.h +++ b/include/grub/arm64/linux.h @@ -19,6 +19,7 @@ @@ -913,7 +913,7 @@ index 7e22b4ab6..ea030312d 100644 #endif /* ! GRUB_ARM64_LINUX_HEADER */ diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 83d958f99..6295df85f 100644 +index 83d958f994..6295df85f3 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address, @@ -946,7 +946,7 @@ index 83d958f99..6295df85f 100644 grub_addr_t grub_efi_modules_addr (void); diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h new file mode 100644 -index 000000000..d9ede3677 +index 0000000000..d9ede36773 --- /dev/null +++ b/include/grub/efi/linux.h @@ -0,0 +1,31 @@ diff --git a/0005-Rework-linux-command.patch b/0005-Rework-linux-command.patch index 6f5f8794..694e4237 100644 --- a/0005-Rework-linux-command.patch +++ b/0005-Rework-linux-command.patch @@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 9f74a96b1..dccf3bb30 100644 +index 9f74a96b19..dccf3bb300 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -649,13 +649,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), diff --git a/0006-Rework-linux16-command.patch b/0006-Rework-linux16-command.patch index 63b1ad39..5adaaba6 100644 --- a/0006-Rework-linux16-command.patch +++ b/0006-Rework-linux16-command.patch @@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 8be4c3b3f..4b1750e36 100644 +index 8be4c3b3f4..4b1750e360 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), diff --git a/0007-Add-secureboot-support-on-efi-chainloader.patch b/0007-Add-secureboot-support-on-efi-chainloader.patch index 065d506a..34ead63b 100644 --- a/0007-Add-secureboot-support-on-efi-chainloader.patch +++ b/0007-Add-secureboot-support-on-efi-chainloader.patch @@ -190,7 +190,7 @@ Signed-off-by: David Abdurachmanov 7 files changed, 844 insertions(+), 90 deletions(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 35b8f6706..4a2259aa1 100644 +index 35b8f67060..4a2259aa1c 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -296,14 +296,20 @@ grub_efi_secure_boot (void) @@ -219,7 +219,7 @@ index 35b8f6706..4a2259aa1 100644 if (*secure_boot && !*setup_mode) ret = 1; diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index a312c6686..04994d5c6 100644 +index a312c66868..04994d5c67 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -284,6 +284,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -241,7 +241,7 @@ index a312c6686..04994d5c6 100644 grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); goto fail; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 2bd80f4db..e6a8d4ad0 100644 +index 2bd80f4db3..e6a8d4ad0e 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -32,6 +32,8 @@ @@ -1184,7 +1184,7 @@ index 2bd80f4db..e6a8d4ad0 100644 return grub_errno; diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index c24202a5d..c8ecce6df 100644 +index c24202a5dd..c8ecce6dfd 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -33,21 +33,34 @@ struct grub_efi_shim_lock @@ -1229,7 +1229,7 @@ index c24202a5d..c8ecce6df 100644 #pragma GCC diagnostic push diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index bb2616a80..6b24cbb94 100644 +index bb2616a809..6b24cbb948 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -117,6 +117,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), @@ -1297,7 +1297,7 @@ index bb2616a80..6b24cbb94 100644 grub_file_close (file); diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h -index d9ede3677..0033d9305 100644 +index d9ede36773..0033d9305a 100644 --- a/include/grub/efi/linux.h +++ b/include/grub/efi/linux.h @@ -22,7 +22,7 @@ @@ -1310,7 +1310,7 @@ index d9ede3677..0033d9305 100644 grub_err_t EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index 0ed8781f0..a43adf274 100644 +index 0ed8781f03..a43adf2746 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h @@ -223,7 +223,11 @@ struct grub_pe64_optional_header diff --git a/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 3f53d8b3..487d5c0b 100644 --- a/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -32,7 +32,7 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/sparc64/linux.h diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c -index 584baec8f..7b2999b14 100644 +index 584baec8f9..7b2999b14b 100644 --- a/grub-core/commands/iorw.c +++ b/grub-core/commands/iorw.c @@ -24,6 +24,7 @@ @@ -64,7 +64,7 @@ index 584baec8f..7b2999b14 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c -index d401a6db0..39cf3a06d 100644 +index d401a6db0e..39cf3a06db 100644 --- a/grub-core/commands/memrw.c +++ b/grub-core/commands/memrw.c @@ -23,6 +23,7 @@ @@ -96,7 +96,7 @@ index d401a6db0..39cf3a06d 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index b71493709..7afb9e6f7 100644 +index b714937095..7afb9e6f72 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -32,6 +32,7 @@ @@ -117,7 +117,7 @@ index b71493709..7afb9e6f7 100644 #if 0 /* This is an error, but grub2-mkconfig still generates a pile of diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 4a2259aa1..8cff7be02 100644 +index 4a2259aa1c..8cff7be028 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -286,40 +286,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -162,7 +162,7 @@ index 4a2259aa1..8cff7be02 100644 /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c -index 74888c463..585f2b573 100644 +index 74888c463b..585f2b5738 100644 --- a/grub-core/loader/efi/appleloader.c +++ b/grub-core/loader/efi/appleloader.c @@ -24,6 +24,7 @@ @@ -193,7 +193,7 @@ index 74888c463..585f2b573 100644 grub_unregister_command (cmd); } diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index e6a8d4ad0..07c493789 100644 +index e6a8d4ad0e..07c4937898 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -34,6 +34,7 @@ @@ -205,7 +205,7 @@ index e6a8d4ad0..07c493789 100644 #include #include diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 5f3290ce1..54befc266 100644 +index 5f3290ce17..54befc2662 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -40,6 +40,7 @@ @@ -237,7 +237,7 @@ index 5f3290ce1..54befc266 100644 grub_unregister_extcmd (cmd_openbsd); grub_unregister_extcmd (cmd_netbsd); diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index dccf3bb30..4aeb0e4b9 100644 +index dccf3bb300..4aeb0e4b9a 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -37,6 +37,7 @@ @@ -269,7 +269,7 @@ index dccf3bb30..4aeb0e4b9 100644 grub_unregister_command (cmd_initrd); } diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 4b1750e36..e3fa1221e 100644 +index 4b1750e360..e3fa1221e8 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -36,6 +36,7 @@ @@ -301,7 +301,7 @@ index 4b1750e36..e3fa1221e 100644 grub_unregister_command (cmd_linux16); grub_unregister_command (cmd_initrd); diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index facb13f3d..47e481f45 100644 +index facb13f3d3..47e481f457 100644 --- a/grub-core/loader/multiboot.c +++ b/grub-core/loader/multiboot.c @@ -50,6 +50,7 @@ @@ -333,7 +333,7 @@ index facb13f3d..47e481f45 100644 grub_unregister_command (cmd_module); } diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index 1c0cf6a43..baa54e652 100644 +index 1c0cf6a430..baa54e652a 100644 --- a/grub-core/loader/xnu.c +++ b/grub-core/loader/xnu.c @@ -35,6 +35,7 @@ @@ -365,7 +365,7 @@ index 1c0cf6a43..baa54e652 100644 grub_unregister_command (cmd_resume); #endif diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 6295df85f..585fa6662 100644 +index 6295df85f3..585fa6662b 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -91,7 +91,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, @@ -378,13 +378,13 @@ index 6295df85f..585fa6662 100644 const grub_efi_device_path_t *dp2); diff --git a/include/grub/ia64/linux.h b/include/grub/ia64/linux.h new file mode 100644 -index 000000000..e69de29bb +index 0000000000..e69de29bb2 diff --git a/include/grub/mips/linux.h b/include/grub/mips/linux.h new file mode 100644 -index 000000000..e69de29bb +index 0000000000..e69de29bb2 diff --git a/include/grub/powerpc/linux.h b/include/grub/powerpc/linux.h new file mode 100644 -index 000000000..e69de29bb +index 0000000000..e69de29bb2 diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h new file mode 100644 -index 000000000..e69de29bb +index 0000000000..e69de29bb2 diff --git a/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch b/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch index dc54e2d0..452f43c9 100644 --- a/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +++ b/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 3 files changed, 89 insertions(+), 37 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index c8ecce6df..0622dfa48 100644 +index c8ecce6dfd..0622dfa48d 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -69,12 +69,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size) @@ -37,7 +37,7 @@ index c8ecce6df..0622dfa48 100644 return GRUB_ERR_BUG; diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 6b24cbb94..3017d0f3e 100644 +index 6b24cbb948..3017d0f3e5 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -44,14 +44,10 @@ static char *linux_cmdline; @@ -245,7 +245,7 @@ index 6b24cbb94..3017d0f3e 100644 if (kernel_mem && !loaded) grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index eddf9251d..25ef52c04 100644 +index eddf9251d9..25ef52c04e 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -138,7 +138,12 @@ struct linux_i386_kernel_header diff --git a/0010-re-write-.gitignore.patch b/0010-re-write-.gitignore.patch index af1859ce..3e0b46c8 100644 --- a/0010-re-write-.gitignore.patch +++ b/0010-re-write-.gitignore.patch @@ -20,7 +20,7 @@ Subject: [PATCH] re-write .gitignore create mode 100644 util/bash-completion.d/.gitignore diff --git a/.gitignore b/.gitignore -index f6a1bd051..594d0134d 100644 +index f6a1bd0517..594d0134d3 100644 --- a/.gitignore +++ b/.gitignore @@ -275,3 +275,155 @@ widthspec.bin @@ -181,7 +181,7 @@ index f6a1bd051..594d0134d 100644 +/widthspec.h diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 -index 000000000..e1d849ef9 +index 0000000000..e1d849ef95 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,5 @@ @@ -192,7 +192,7 @@ index 000000000..e1d849ef9 +/version*.texi diff --git a/grub-core/.gitignore b/grub-core/.gitignore new file mode 100644 -index 000000000..2acce2811 +index 0000000000..2acce28115 --- /dev/null +++ b/grub-core/.gitignore @@ -0,0 +1,16 @@ @@ -214,14 +214,14 @@ index 000000000..2acce2811 +/trigtables.c diff --git a/grub-core/lib/.gitignore b/grub-core/lib/.gitignore new file mode 100644 -index 000000000..681545914 +index 0000000000..6815459140 --- /dev/null +++ b/grub-core/lib/.gitignore @@ -0,0 +1 @@ +/libgcrypt-grub/ diff --git a/include/grub/gcrypt/.gitignore b/include/grub/gcrypt/.gitignore new file mode 100644 -index 000000000..8fbf56462 +index 0000000000..8fbf564624 --- /dev/null +++ b/include/grub/gcrypt/.gitignore @@ -0,0 +1,2 @@ @@ -229,7 +229,7 @@ index 000000000..8fbf56462 +gcrypt.h diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 -index 000000000..f507e7741 +index 0000000000..f507e7741e --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,5 @@ @@ -240,7 +240,7 @@ index 000000000..f507e7741 +/stamp-po diff --git a/util/bash-completion.d/.gitignore b/util/bash-completion.d/.gitignore new file mode 100644 -index 000000000..6813a527a +index 0000000000..6813a527ad --- /dev/null +++ b/util/bash-completion.d/.gitignore @@ -0,0 +1,2 @@ diff --git a/0011-IBM-client-architecture-CAS-reboot-support.patch b/0011-IBM-client-architecture-CAS-reboot-support.patch index cea157b2..316b9eb2 100644 --- a/0011-IBM-client-architecture-CAS-reboot-support.patch +++ b/0011-IBM-client-architecture-CAS-reboot-support.patch @@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood 4 files changed, 91 insertions(+) diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c -index 4d493ab76..3a6689abb 100644 +index 4d493ab766..3a6689abb1 100644 --- a/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c @@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void) @@ -100,7 +100,7 @@ index 4d493ab76..3a6689abb 100644 + return 0; +} diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index c4ebe9e22..70614de15 100644 +index c4ebe9e22a..70614de156 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -34,6 +34,9 @@ @@ -137,7 +137,7 @@ index c4ebe9e22..70614de15 100644 grub_errno = GRUB_ERR_NONE; } diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index 25158407d..ad8039924 100644 +index 25158407dd..ad80399246 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -28,6 +28,9 @@ @@ -162,7 +162,7 @@ index 25158407d..ad8039924 100644 { char *line; diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 73e2f4644..0a599607f 100644 +index 73e2f46447..0a599607f3 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -254,6 +254,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali diff --git a/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch index fa459299..121af849 100644 --- a/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index 85ecf06b4..05c88dcf4 100644 +index 85ecf06b4d..05c88dcf49 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term, diff --git a/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch index aebfe75a..917943fd 100644 --- a/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch +++ b/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch @@ -15,7 +15,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 20cbbd761..04df9d2c6 100644 +index 20cbbd761e..04df9d2c66 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c @@ -90,7 +90,10 @@ grub_ieee1275_find_options (void) @@ -31,7 +31,7 @@ index 20cbbd761..04df9d2c6 100644 /* Old Macs have no key repeat, newer ones have fully working one. The ones inbetween when repeated key generates an escaoe sequence diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c -index 17a3dbbb5..b8e4b3feb 100644 +index 17a3dbbb57..b8e4b3feb3 100644 --- a/grub-core/video/ieee1275.c +++ b/grub-core/video/ieee1275.c @@ -352,9 +352,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter = @@ -51,7 +51,7 @@ index 17a3dbbb5..b8e4b3feb 100644 GRUB_MOD_FINI(ieee1275_fb) diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 0a599607f..b5a1d49bb 100644 +index 0a599607f3..b5a1d49bbc 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -148,6 +148,8 @@ enum grub_ieee1275_flag diff --git a/0014-Move-bash-completion-script-922997.patch b/0014-Move-bash-completion-script-922997.patch index ffc1685d..a84d66e5 100644 --- a/0014-Move-bash-completion-script-922997.patch +++ b/0014-Move-bash-completion-script-922997.patch @@ -10,7 +10,7 @@ Apparently these go in a new place now. 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 7517fc49d..8331f95b6 100644 +index 7517fc49d9..8331f95b64 100644 --- a/configure.ac +++ b/configure.ac @@ -314,6 +314,14 @@ AC_SUBST(grubdirname) @@ -39,7 +39,7 @@ index 7517fc49d..8331f95b6 100644 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then tmp_ac_tool_prefix="$ac_tool_prefix" diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am -index 136287cf1..61108f054 100644 +index 136287cf1b..61108f0542 100644 --- a/util/bash-completion.d/Makefile.am +++ b/util/bash-completion.d/Makefile.am @@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source) diff --git a/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch index 3141feae..6450a543 100644 --- a/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch +++ b/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 8397886fa..d7a222e68 100644 +index 8397886fa0..d7a222e681 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout) diff --git a/0016-Make-exit-take-a-return-code.patch b/0016-Make-exit-take-a-return-code.patch index a5381545..654ef73b 100644 --- a/0016-Make-exit-take-a-return-code.patch +++ b/0016-Make-exit-take-a-return-code.patch @@ -27,7 +27,7 @@ Signed-off-by: Peter Jones 14 files changed, 48 insertions(+), 21 deletions(-) diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c -index fa498931e..2bd3ac76f 100644 +index fa498931ed..2bd3ac76f2 100644 --- a/grub-core/commands/minicmd.c +++ b/grub-core/commands/minicmd.c @@ -182,12 +182,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), @@ -60,7 +60,7 @@ index fa498931e..2bd3ac76f 100644 } diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 8cff7be02..05d8237a9 100644 +index 8cff7be028..05d8237a9b 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -165,11 +165,16 @@ grub_reboot (void) @@ -83,7 +83,7 @@ index 8cff7be02..05d8237a9 100644 } diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 425bb9603..55ea5a11c 100644 +index 425bb96034..55ea5a11cc 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -67,7 +67,7 @@ grub_reboot (void) @@ -96,7 +96,7 @@ index 425bb9603..55ea5a11c 100644 grub_reboot (); } diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index dfd8a8ec4..0ff13bcaf 100644 +index dfd8a8ec48..0ff13bcaf8 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -151,9 +151,10 @@ xasprintf (const char *fmt, ...) @@ -113,7 +113,7 @@ index dfd8a8ec4..0ff13bcaf 100644 #endif diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c -index 3314f027f..36f9134b7 100644 +index 3314f027fe..36f9134b7b 100644 --- a/grub-core/kern/i386/coreboot/init.c +++ b/grub-core/kern/i386/coreboot/init.c @@ -41,7 +41,7 @@ extern grub_uint8_t _end[]; @@ -126,7 +126,7 @@ index 3314f027f..36f9134b7 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/i386/qemu/init.c b/grub-core/kern/i386/qemu/init.c -index 271b6fbfa..9fafe98f0 100644 +index 271b6fbfab..9fafe98f01 100644 --- a/grub-core/kern/i386/qemu/init.c +++ b/grub-core/kern/i386/qemu/init.c @@ -42,7 +42,7 @@ extern grub_uint8_t _end[]; @@ -139,7 +139,7 @@ index 271b6fbfa..9fafe98f0 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index d483e35ee..e71d15841 100644 +index d483e35eed..e71d158416 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack; @@ -152,7 +152,7 @@ index d483e35ee..e71d15841 100644 grub_ieee1275_exit (); } diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c -index 2ed3ff319..5c40c3407 100644 +index 2ed3ff3191..5c40c34078 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -276,7 +276,7 @@ grub_halt (void) @@ -165,7 +165,7 @@ index 2ed3ff319..5c40c3407 100644 GRUB_ARC_FIRMWARE_VECTOR->exit (); diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c -index 7b96531b9..dff598ca7 100644 +index 7b96531b98..dff598ca7b 100644 --- a/grub-core/kern/mips/loongson/init.c +++ b/grub-core/kern/mips/loongson/init.c @@ -304,7 +304,7 @@ grub_halt (void) @@ -178,7 +178,7 @@ index 7b96531b9..dff598ca7 100644 grub_halt (); } diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c -index be88b77d2..8b6c55ffc 100644 +index be88b77d22..8b6c55ffc0 100644 --- a/grub-core/kern/mips/qemu_mips/init.c +++ b/grub-core/kern/mips/qemu_mips/init.c @@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused))) @@ -191,7 +191,7 @@ index be88b77d2..8b6c55ffc 100644 grub_halt (); } diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 3af336ee2..63b586d09 100644 +index 3af336ee22..63b586d09c 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -1209,9 +1209,18 @@ grub_abort (void) @@ -215,7 +215,7 @@ index 3af336ee2..63b586d09 100644 grub_fatal (const char *fmt, ...) { diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c -index 3e338645c..be2a5be1d 100644 +index 3e338645c5..be2a5be1d0 100644 --- a/grub-core/kern/uboot/init.c +++ b/grub-core/kern/uboot/init.c @@ -39,9 +39,9 @@ extern grub_size_t grub_total_module_size; @@ -240,7 +240,7 @@ index 3e338645c..be2a5be1d 100644 else if (ver > API_SIG_VERSION) { diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c -index 782ca7295..708b060f3 100644 +index 782ca72952..708b060f32 100644 --- a/grub-core/kern/xen/init.c +++ b/grub-core/kern/xen/init.c @@ -584,7 +584,7 @@ grub_machine_init (void) @@ -253,7 +253,7 @@ index 782ca7295..708b060f3 100644 struct sched_shutdown arg; diff --git a/include/grub/misc.h b/include/grub/misc.h -index 7d2b55196..fd18e6320 100644 +index 7d2b551969..fd18e6320b 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -353,7 +353,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, diff --git a/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch b/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch index 7e702ada..ecfab5ae 100644 --- a/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch +++ b/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 45d3edaa4..c865a08b0 100644 +index 45d3edaa4d..c865a08b02 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -207,6 +207,7 @@ kernel = { @@ -22,7 +22,7 @@ index 45d3edaa4..c865a08b0 100644 i386_multiboot = kern/i386/pc/acpi.c; i386_coreboot = kern/acpi.c; diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 7facacf09..6d39bd3ad 100644 +index 7facacf09c..6d39bd3ad2 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -27,8 +27,11 @@ diff --git a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch index 070e4c9a..1e310e98 100644 --- a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -15,7 +15,7 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub.d/20_ppc_terminfo.in diff --git a/Makefile.util.def b/Makefile.util.def -index f8b356cc1..2c9b283a2 100644 +index f8b356cc1f..2c9b283a23 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -508,6 +508,13 @@ script = { @@ -34,7 +34,7 @@ index f8b356cc1..2c9b283a2 100644 common = util/grub.d/30_os-prober.in; diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in new file mode 100644 -index 000000000..10d665868 +index 0000000000..10d6658682 --- /dev/null +++ b/util/grub.d/20_ppc_terminfo.in @@ -0,0 +1,114 @@ diff --git a/0019-Add-fw_path-variable-revised.patch b/0019-Add-fw_path-variable-revised.patch index a1ea381f..804938bd 100644 --- a/0019-Add-fw_path-variable-revised.patch +++ b/0019-Add-fw_path-variable-revised.patch @@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 73967e2f5..d1de9fa68 100644 +index 73967e2f5b..d1de9fa687 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -128,16 +128,15 @@ grub_set_prefix_and_root (void) @@ -44,7 +44,7 @@ index 73967e2f5..d1de9fa68 100644 } diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 70614de15..62571e6df 100644 +index 70614de156..62571e6dfc 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0020-Pass-x-hex-hex-straight-through-unmolested.patch b/0020-Pass-x-hex-hex-straight-through-unmolested.patch index 853fcfd5..c2623acf 100644 --- a/0020-Pass-x-hex-hex-straight-through-unmolested.patch +++ b/0020-Pass-x-hex-hex-straight-through-unmolested.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index cc3290311..8f67a4be7 100644 +index cc3290311f..8f67a4be7f 100644 --- a/grub-core/commands/wildcard.c +++ b/grub-core/commands/wildcard.c @@ -488,6 +488,12 @@ check_file (const char *dir, const char *basename) @@ -47,7 +47,7 @@ index cc3290311..8f67a4be7 100644 *optr++ = iptr[1]; iptr += 2; diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index ed0b149dc..8e2294d8f 100644 +index ed0b149dca..8e2294d8ff 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/lib/cmdline.c @@ -20,6 +20,12 @@ @@ -97,7 +97,7 @@ index ed0b149dc..8e2294d8f 100644 *buf++ = *c; diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index ad8039924..0c6dd9c52 100644 +index ad80399246..0c6dd9c520 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0; diff --git a/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index 78ba64ac..c452b5f8 100644 --- a/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -28,7 +28,7 @@ Signed-off-by: Will Thompson create mode 100644 grub-core/commands/loadenv.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c865a08b0..c15e91943 100644 +index c865a08b02..c15e91943b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -814,6 +814,16 @@ module = { @@ -58,7 +58,7 @@ index c865a08b0..c15e91943 100644 diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c new file mode 100644 -index 000000000..e907a6a5d +index 0000000000..e907a6a5d2 --- /dev/null +++ b/grub-core/commands/blscfg.c @@ -0,0 +1,1177 @@ @@ -1240,7 +1240,7 @@ index 000000000..e907a6a5d + grub_unregister_extcmd (oldcmd); +} diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index cc5971f4d..782761c31 100644 +index cc5971f4db..782761c31a 100644 --- a/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c @@ -143,7 +143,7 @@ legacy_file (const char *filename) @@ -1263,7 +1263,7 @@ index cc5971f4d..782761c31 100644 } diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c -index 3fd664aac..163b9a090 100644 +index 3fd664aac3..163b9a0904 100644 --- a/grub-core/commands/loadenv.c +++ b/grub-core/commands/loadenv.c @@ -28,6 +28,8 @@ @@ -1358,7 +1358,7 @@ index 3fd664aac..163b9a090 100644 grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args) { diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index 720e6d8ea..b194123eb 100644 +index 720e6d8ea3..b194123eb6 100644 --- a/grub-core/commands/menuentry.c +++ b/grub-core/commands/menuentry.c @@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args, @@ -1430,7 +1430,7 @@ index 720e6d8ea..b194123eb 100644 src[len - 1] = ch; args[argc - 1] = src; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 62571e6df..7ca2e5400 100644 +index 62571e6dfc..7ca2e5400b 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -21,6 +21,7 @@ @@ -1455,7 +1455,7 @@ index 62571e6df..7ca2e5400 100644 grub_free ((void *) entry->title); diff --git a/grub-core/commands/loadenv.h b/grub-core/commands/loadenv.h new file mode 100644 -index 000000000..952f46121 +index 0000000000..952f46121b --- /dev/null +++ b/grub-core/commands/loadenv.h @@ -0,0 +1,93 @@ @@ -1553,7 +1553,7 @@ index 000000000..952f46121 + return 0; +} diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index 8f3be3ae7..ebafec689 100644 +index 8f3be3ae70..ebafec6895 100644 --- a/include/grub/compiler.h +++ b/include/grub/compiler.h @@ -56,4 +56,6 @@ @@ -1564,7 +1564,7 @@ index 8f3be3ae7..ebafec689 100644 + #endif /* ! GRUB_COMPILER_HEADER */ diff --git a/include/grub/menu.h b/include/grub/menu.h -index ee2b5e910..0acdc2aa6 100644 +index ee2b5e9104..0acdc2aa6b 100644 --- a/include/grub/menu.h +++ b/include/grub/menu.h @@ -20,6 +20,16 @@ @@ -1595,7 +1595,7 @@ index ee2b5e910..0acdc2aa6 100644 typedef struct grub_menu_entry *grub_menu_entry_t; diff --git a/include/grub/normal.h b/include/grub/normal.h -index 218cbabcc..8839ad85a 100644 +index 218cbabcca..8839ad85a1 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes, diff --git a/0022-Add-devicetree-loading.patch b/0022-Add-devicetree-loading.patch index 7d9ac65c..466ddba8 100644 --- a/0022-Add-devicetree-loading.patch +++ b/0022-Add-devicetree-loading.patch @@ -20,7 +20,7 @@ Signed-off-by: David A. Marlin 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index d3e879b8e..8ea2315eb 100644 +index d3e879b8e5..8ea2315ebc 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -248,7 +248,8 @@ export GRUB_DEFAULT \ @@ -34,7 +34,7 @@ index d3e879b8e..8ea2315eb 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index e8b01c0d0..dc75a1c30 100644 +index e8b01c0d0c..dc75a1c30b 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -153,6 +153,13 @@ EOF diff --git a/0023-Enable-pager-by-default.-985860.patch b/0023-Enable-pager-by-default.-985860.patch index 24f2cbf4..63cf787b 100644 --- a/0023-Enable-pager-by-default.-985860.patch +++ b/0023-Enable-pager-by-default.-985860.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 93a90233e..858b526c9 100644 +index 93a90233ea..858b526c92 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_ diff --git a/0024-Don-t-say-GNU-Linux-in-generated-menus.patch b/0024-Don-t-say-GNU-Linux-in-generated-menus.patch index f5c783aa..5b967849 100644 --- a/0024-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0024-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -3,13 +3,56 @@ From: Peter Jones Date: Mon, 14 Mar 2011 14:27:42 -0400 Subject: [PATCH] Don't say "GNU/Linux" in generated menus. +[rharwood: say it even less] --- - util/grub.d/10_linux.in | 4 ++-- - util/grub.d/20_linux_xen.in | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) + grub-core/normal/main.c | 2 +- + tests/util/grub-shell-tester.in | 2 +- + tests/util/grub-shell.in | 2 +- + util/grub.d/10_linux.in | 4 ++-- + util/grub.d/20_linux_xen.in | 4 ++-- + 5 files changed, 7 insertions(+), 7 deletions(-) +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index 7ca2e5400b..98372217ad 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -218,7 +218,7 @@ grub_normal_init_page (struct grub_term_output *term, + + grub_term_cls (term); + +- msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); ++ msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION); + if (!msg_formatted) + return; + +diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in +index 8a87109b15..9a4319d4f4 100644 +--- a/tests/util/grub-shell-tester.in ++++ b/tests/util/grub-shell-tester.in +@@ -56,7 +56,7 @@ for option in "$@"; do + usage + exit 0 ;; + -v | --version) +- echo "$0 (GNU GRUB ${PACKAGE_VERSION})" ++ echo "$0 (GRUB ${PACKAGE_VERSION})" + exit 0 ;; + --modules=*) + ms=`echo "$option" | sed -e 's/--modules=//'` +diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in +index 93e9f51484..ec1182bf93 100644 +--- a/tests/util/grub-shell.in ++++ b/tests/util/grub-shell.in +@@ -209,7 +209,7 @@ for option in "$@"; do + usage + exit 0 ;; + -v | --version) +- echo "$0 (GNU GRUB ${PACKAGE_VERSION})" ++ echo "$0 (GRUB ${PACKAGE_VERSION})" + exit 0 ;; + --trim) + trim=1 diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index dc75a1c30..4a499c53a 100644 +index dc75a1c30b..4a499c53a6 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -25,7 +68,7 @@ index dc75a1c30..4a499c53a 100644 fi diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 3b1f47049..ada20775a 100644 +index 3b1f470492..ada20775a1 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch index 2cdd762a..0532a041 100644 --- a/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch +++ b/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Add .eh_frame to list of relocations stripped 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 2a1a886f6..191b1a70c 100644 +index 2a1a886f6d..191b1a70c6 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding diff --git a/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch index 89d026ff..89887c11 100644 --- a/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 4a499c53a..cf8d11869 100644 +index 4a499c53a6..cf8d118698 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -26,7 +26,7 @@ datarootdir="@datarootdir@" diff --git a/0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index 619cd928..1da91e10 100644 --- a/0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -17,7 +17,7 @@ Signed-off-by: Mark Salter 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 7ca2e5400..025775021 100644 +index 98372217ad..bf24e65713 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index 54b8a05e..0d772813 100644 --- a/0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 025775021..880d0ebd4 100644 +index bf24e65713..0a99768f75 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index 6ad5b7a7..f22e6f9c 100644 --- a/0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index cf8d11869..5f6d3c8d5 100644 +index cf8d118698..5f6d3c8d52 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch index 6d8d6730..f4d83da1 100644 --- a/0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +++ b/0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 8 insertions(+) diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 301d1ac22..0f6505bf3 100644 +index 301d1ac229..0f6505bf3b 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -253,6 +253,14 @@ version_test_gt () diff --git a/0031-Try-prefix-if-fw_path-doesn-t-work.patch b/0031-Try-prefix-if-fw_path-doesn-t-work.patch index 2abb2397..a1c0d9e9 100644 --- a/0031-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0031-Try-prefix-if-fw_path-doesn-t-work.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 3 files changed, 82 insertions(+), 82 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index e71d15841..0cd2a6272 100644 +index e71d158416..0cd2a62723 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -127,23 +127,25 @@ grub_machine_get_bootlocation (char **device, char **path) @@ -56,7 +56,7 @@ index e71d15841..0cd2a6272 100644 } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 4d3eb5c1a..0ef148f4a 100644 +index 4d3eb5c1a5..0ef148f4ad 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1869,7 +1869,7 @@ grub_net_search_config_file (char *config) @@ -69,7 +69,7 @@ index 4d3eb5c1a..0ef148f4a 100644 static struct grub_preboot *fini_hnd; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 880d0ebd4..d5df4f815 100644 +index 0a99768f75..55558cc0b9 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config) diff --git a/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch b/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch index 2a1e3643..9463ef82 100644 --- a/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch +++ b/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch @@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood create mode 100644 docs/man/grub-rpm-sort.h2m diff --git a/configure.ac b/configure.ac -index 8331f95b6..87c8f1739 100644 +index 8331f95b64..87c8f17393 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -97,7 +97,7 @@ index 8331f95b6..87c8f1739 100644 echo starfield theme: Yes echo With DejaVuSans font from $DJVU_FONT_SOURCE diff --git a/Makefile.util.def b/Makefile.util.def -index 2c9b283a2..bc10cc797 100644 +index 2c9b283a23..bc10cc7972 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -703,6 +703,23 @@ program = { @@ -126,7 +126,7 @@ index 2c9b283a2..bc10cc797 100644 common = util/grub-mkconfig.in; diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c new file mode 100644 -index 000000000..f33bd1ed5 +index 0000000000..f33bd1ed56 --- /dev/null +++ b/util/grub-rpm-sort.c @@ -0,0 +1,281 @@ @@ -413,14 +413,14 @@ index 000000000..f33bd1ed5 +} diff --git a/docs/man/grub-rpm-sort.h2m b/docs/man/grub-rpm-sort.h2m new file mode 100644 -index 000000000..fe711ae10 +index 0000000000..fe711ae102 --- /dev/null +++ b/docs/man/grub-rpm-sort.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-rpm-sort \- sort input according to RPM version compare diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 0f6505bf3..42c2ea9ba 100644 +index 0f6505bf3b..42c2ea9ba5 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -33,6 +33,9 @@ fi diff --git a/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index 89a38795..db101c02 100644 --- a/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 5f6d3c8d5..786dbabb4 100644 +index 5f6d3c8d52..786dbabb4a 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -78,6 +78,32 @@ case x"$GRUB_FS" in diff --git a/0034-Add-friendly-grub2-password-config-tool-985962.patch b/0034-Add-friendly-grub2-password-config-tool-985962.patch index 40f9738e..49089f95 100644 --- a/0034-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0034-Add-friendly-grub2-password-config-tool-985962.patch @@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index 87c8f1739..916bede6b 100644 +index 87c8f17393..916bede6bf 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -41,7 +41,7 @@ index 87c8f1739..916bede6b 100644 grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) diff --git a/Makefile.util.def b/Makefile.util.def -index bc10cc797..8ca4c14f0 100644 +index bc10cc7972..8ca4c14f0b 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -452,6 +452,12 @@ script = { @@ -73,14 +73,14 @@ index bc10cc797..8ca4c14f0 100644 common = util/grub-mkconfig_lib.in; diff --git a/docs/man/grub-set-password.h2m b/docs/man/grub-set-password.h2m new file mode 100644 -index 000000000..10ee82f4d +index 0000000000..10ee82f4d5 --- /dev/null +++ b/docs/man/grub-set-password.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-set-password \- generate the user.cfg file containing the hashed grub bootloader password diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 8ea2315eb..ba14cf626 100644 +index 8ea2315ebc..ba14cf6261 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -276,6 +276,8 @@ for i in "${grub_mkconfig_dir}"/* ; do @@ -94,7 +94,7 @@ index 8ea2315eb..ba14cf626 100644 echo diff --git a/util/grub-set-password.in b/util/grub-set-password.in new file mode 100644 -index 000000000..5ebf50576 +index 0000000000..5ebf50576d --- /dev/null +++ b/util/grub-set-password.in @@ -0,0 +1,128 @@ @@ -228,7 +228,7 @@ index 000000000..5ebf50576 +fi diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in new file mode 100644 -index 000000000..db2f44bfb +index 0000000000..db2f44bfb7 --- /dev/null +++ b/util/grub.d/01_users.in @@ -0,0 +1,11 @@ diff --git a/0035-tcp-add-window-scaling-support.patch b/0035-tcp-add-window-scaling-support.patch index e19ddf8a..61b5a679 100644 --- a/0035-tcp-add-window-scaling-support.patch +++ b/0035-tcp-add-window-scaling-support.patch @@ -17,7 +17,7 @@ Signed-off-by: Josef Bacik 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c -index e8ad34b84..7d4b82262 100644 +index e8ad34b84d..7d4b822626 100644 --- a/grub-core/net/tcp.c +++ b/grub-core/net/tcp.c @@ -106,6 +106,18 @@ struct tcphdr diff --git a/0036-efinet-and-bootp-add-support-for-dhcpv6.patch b/0036-efinet-and-bootp-add-support-for-dhcpv6.patch index 4daf9e5e..efeeee0a 100644 --- a/0036-efinet-and-bootp-add-support-for-dhcpv6.patch +++ b/0036-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 6 files changed, 477 insertions(+), 14 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 6fb562702..e28fb6a09 100644 +index 6fb5627025..e28fb6a09f 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -902,6 +902,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), @@ -198,7 +198,7 @@ index 6fb562702..e28fb6a09 100644 grub_bootp_init (void) { diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 5388f952b..173fb6315 100644 +index 5388f952ba..173fb63153 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -18,11 +18,14 @@ @@ -307,7 +307,7 @@ index 5388f952b..173fb6315 100644 } } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0ef148f4a..22f2689aa 100644 +index 0ef148f4ad..22f2689aae 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -960,6 +960,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa @@ -390,7 +390,7 @@ index 0ef148f4a..22f2689aa 100644 grub_err_t grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter, diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 7f44b30f5..4ab2f5c73 100644 +index 7f44b30f52..4ab2f5c735 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -358,18 +358,22 @@ tftp_open (struct grub_file *file, const char *filename) @@ -417,7 +417,7 @@ index 7f44b30f5..4ab2f5c73 100644 return grub_errno; } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index f1a52210c..117469450 100644 +index f1a52210c0..117469450d 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -592,10 +592,16 @@ typedef void *grub_efi_handle_t; @@ -572,7 +572,7 @@ index f1a52210c..117469450 100644 typedef struct grub_efi_pxe diff --git a/include/grub/net.h b/include/grub/net.h -index 7ae4b6bd8..8a05ec4fe 100644 +index 7ae4b6bd80..8a05ec4fe7 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -447,6 +447,51 @@ struct grub_net_bootp_packet diff --git a/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index 80948ce7..b3f5df40 100644 --- a/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -24,7 +24,7 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 916bede6b..4f1676967 100644 +index 916bede6bf..4f1676967e 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) @@ -36,7 +36,7 @@ index 916bede6b..4f1676967 100644 grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) diff --git a/Makefile.util.def b/Makefile.util.def -index 8ca4c14f0..43a1c7453 100644 +index 8ca4c14f0b..43a1c7453b 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -733,6 +733,13 @@ script = { @@ -55,14 +55,14 @@ index 8ca4c14f0..43a1c7453 100644 common = util/grub-set-default.in; diff --git a/docs/man/grub-get-kernel-settings.h2m b/docs/man/grub-get-kernel-settings.h2m new file mode 100644 -index 000000000..b8051f01f +index 0000000000..b8051f01f3 --- /dev/null +++ b/docs/man/grub-get-kernel-settings.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-get-kernel-settings \- Evaluate the system's kernel installation settings for use while making a grub configuration file diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in -index 44bf135b9..5c4acd496 100644 +index 44bf135b9f..5c4acd496d 100644 --- a/util/bash-completion.d/grub-completion.bash.in +++ b/util/bash-completion.d/grub-completion.bash.in @@ -264,6 +264,28 @@ have ${__grub_sparc64_setup_program} && \ @@ -96,7 +96,7 @@ index 44bf135b9..5c4acd496 100644 # diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in new file mode 100644 -index 000000000..7e87dfccc +index 0000000000..7e87dfccc0 --- /dev/null +++ b/util/grub-get-kernel-settings.in @@ -0,0 +1,88 @@ @@ -189,7 +189,7 @@ index 000000000..7e87dfccc + echo export GRUB_UPDATE_DEFAULT_KERNEL +fi diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index ba14cf626..005f09380 100644 +index ba14cf6261..005f093809 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@" @@ -210,7 +210,7 @@ index ba14cf626..005f09380 100644 if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then GRUB_DISABLE_LINUX_UUID="true" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 786dbabb4..292e33332 100644 +index 786dbabb4a..292e333324 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -111,7 +111,8 @@ linux_entry () diff --git a/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch index feec4a6c..15b21114 100644 --- a/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch +++ b/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch @@ -33,7 +33,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index ac4e62a95..3860b6f78 100644 +index ac4e62a95c..3860b6f78d 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -220,8 +220,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, diff --git a/0039-Make-grub_fatal-also-backtrace.patch b/0039-Make-grub_fatal-also-backtrace.patch index ec24049f..f876575f 100644 --- a/0039-Make-grub_fatal-also-backtrace.patch +++ b/0039-Make-grub_fatal-also-backtrace.patch @@ -13,7 +13,7 @@ Subject: [PATCH] Make grub_fatal() also backtrace. create mode 100644 grub-core/lib/arm64/backtrace.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c15e91943..058c88ac3 100644 +index c15e91943b..058c88ac3a 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -188,6 +188,9 @@ kernel = { @@ -27,7 +27,7 @@ index c15e91943..058c88ac3 100644 i386_xen = kern/i386/dl.c; i386_xen_pvh = kern/i386/dl.c; diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 63b586d09..a3e215155 100644 +index 63b586d09c..a3e215155b 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -24,6 +24,7 @@ @@ -55,7 +55,7 @@ index 63b586d09..a3e215155 100644 #endif diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c new file mode 100644 -index 000000000..1079b5380 +index 0000000000..1079b5380e --- /dev/null +++ b/grub-core/lib/arm64/backtrace.c @@ -0,0 +1,62 @@ @@ -122,7 +122,7 @@ index 000000000..1079b5380 +} + diff --git a/grub-core/lib/backtrace.c b/grub-core/lib/backtrace.c -index 825a8800e..c0ad6ab8b 100644 +index 825a8800e2..c0ad6ab8be 100644 --- a/grub-core/lib/backtrace.c +++ b/grub-core/lib/backtrace.c @@ -29,6 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -142,7 +142,7 @@ index 825a8800e..c0ad6ab8b 100644 } diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c -index c3e03c727..c67273db3 100644 +index c3e03c7275..c67273db3a 100644 --- a/grub-core/lib/i386/backtrace.c +++ b/grub-core/lib/i386/backtrace.c @@ -15,11 +15,23 @@ diff --git a/0040-Make-our-info-pages-say-grub2-where-appropriate.patch b/0040-Make-our-info-pages-say-grub2-where-appropriate.patch index eda8d45d..afba285d 100644 --- a/0040-Make-our-info-pages-say-grub2-where-appropriate.patch +++ b/0040-Make-our-info-pages-say-grub2-where-appropriate.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 2 files changed, 171 insertions(+), 154 deletions(-) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 6c629a23e..19f708ee6 100644 +index 6c629a23e2..19f708ee66 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1,7 +1,7 @@ @@ -35,7 +35,7 @@ index 6c629a23e..19f708ee6 100644 @setchapternewpage odd diff --git a/docs/grub.texi b/docs/grub.texi -index 69f08d289..0615d0ed9 100644 +index 69f08d289f..0615d0ed97 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1,7 +1,7 @@ diff --git a/0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch index 56106615..8d3139d6 100644 --- a/0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch +++ b/0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch @@ -20,7 +20,7 @@ Signed-off-by: Peter Jones 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 1b91c102f..4b27bd201 100644 +index 1b91c102f3..4b27bd2015 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then diff --git a/0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch index bea6e328..57d2391a 100644 --- a/0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +++ b/0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch @@ -24,7 +24,7 @@ Signed-off-by: Jeff Mahoney 2 files changed, 533 insertions(+), 20 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 63203034d..f1fff7385 100644 +index 63203034df..f1fff7385b 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -38,6 +38,9 @@ @@ -690,7 +690,7 @@ index 63203034d..f1fff7385 100644 + +// vim: si et sw=2: diff --git a/include/grub/btrfs.h b/include/grub/btrfs.h -index 9d93fb6c1..234ad9767 100644 +index 9d93fb6c18..234ad97677 100644 --- a/include/grub/btrfs.h +++ b/include/grub/btrfs.h @@ -29,6 +29,7 @@ enum diff --git a/0043-export-btrfs_subvol-and-btrfs_subvolid.patch b/0043-export-btrfs_subvol-and-btrfs_subvolid.patch index 61d16996..719866e1 100644 --- a/0043-export-btrfs_subvol-and-btrfs_subvolid.patch +++ b/0043-export-btrfs_subvol-and-btrfs_subvolid.patch @@ -12,7 +12,7 @@ Signed-off-by: Michael Chang 1 file changed, 2 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index f1fff7385..ad1b56b71 100644 +index f1fff7385b..ad1b56b716 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -2714,6 +2714,8 @@ GRUB_MOD_INIT (btrfs) diff --git a/0044-grub2-btrfs-03-follow_default.patch b/0044-grub2-btrfs-03-follow_default.patch index f9a935e2..621f029e 100644 --- a/0044-grub2-btrfs-03-follow_default.patch +++ b/0044-grub2-btrfs-03-follow_default.patch @@ -10,7 +10,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 76 insertions(+), 31 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index ad1b56b71..113c1f746 100644 +index ad1b56b716..113c1f746c 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -1256,6 +1256,7 @@ grub_btrfs_mount (grub_device_t dev) diff --git a/0045-grub2-btrfs-04-grub2-install.patch b/0045-grub2-btrfs-04-grub2-install.patch index 2ce64b1c..6b2bc78e 100644 --- a/0045-grub2-btrfs-04-grub2-install.patch +++ b/0045-grub2-btrfs-04-grub2-install.patch @@ -15,7 +15,7 @@ Signed-off-by: Robbie Harwood 6 files changed, 54 insertions(+), 2 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 001b818fe..caf9b1ccd 100644 +index 001b818fe5..caf9b1ccd3 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_path) @@ -40,7 +40,7 @@ index 001b818fe..caf9b1ccd 100644 else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) { diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index 7d6325138..46a881530 100644 +index 7d6325138c..46a881530c 100644 --- a/grub-core/osdep/unix/config.c +++ b/grub-core/osdep/unix/config.c @@ -82,6 +82,19 @@ grub_util_load_config (struct grub_util_config *cfg) @@ -75,7 +75,7 @@ index 7d6325138..46a881530 100644 argv[2] = script; argv[3] = '\0'; diff --git a/util/config.c b/util/config.c -index ebcdd8f5e..f044a880a 100644 +index ebcdd8f5e2..f044a880a7 100644 --- a/util/config.c +++ b/util/config.c @@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct grub_util_config *cfg, int simple) @@ -96,7 +96,7 @@ index ebcdd8f5e..f044a880a 100644 sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) { diff --git a/util/grub-install.c b/util/grub-install.c -index 0fbe7f78c..0f66f36d2 100644 +index 0fbe7f78c6..0f66f36d23 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -827,6 +827,8 @@ fill_core_services (const char *core_services) @@ -136,7 +136,7 @@ index 0fbe7f78c..0f66f36d2 100644 char *install_drive = NULL; diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c -index 47a241a39..5db7a9a7d 100644 +index 47a241a391..5db7a9a7d9 100644 --- a/util/grub-mkrelpath.c +++ b/util/grub-mkrelpath.c @@ -40,9 +40,12 @@ struct arguments @@ -163,7 +163,7 @@ index 47a241a39..5db7a9a7d 100644 if (state->arg_num == 0) arguments->pathname = xstrdup (arg); diff --git a/include/grub/emu/config.h b/include/grub/emu/config.h -index 875d5896c..c9a7e5f4a 100644 +index 875d5896ce..c9a7e5f4ad 100644 --- a/include/grub/emu/config.h +++ b/include/grub/emu/config.h @@ -37,6 +37,7 @@ struct grub_util_config diff --git a/0046-grub2-btrfs-05-grub2-mkconfig.patch b/0046-grub2-btrfs-05-grub2-mkconfig.patch index 08b5224f..06d15a7c 100644 --- a/0046-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0046-grub2-btrfs-05-grub2-mkconfig.patch @@ -13,7 +13,7 @@ Signed-off-by: Michael Chang 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 005f09380..535c0f024 100644 +index 005f093809..535c0f0249 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -252,7 +252,8 @@ export GRUB_DEFAULT \ @@ -27,7 +27,7 @@ index 005f09380..535c0f024 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 42c2ea9ba..fafeac950 100644 +index 42c2ea9ba5..fafeac9506 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -52,7 +52,11 @@ grub_warn () @@ -43,7 +43,7 @@ index 42c2ea9ba..fafeac950 100644 is_path_readable_by_grub () diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 858b526c9..de727e6ee 100644 +index 858b526c92..de727e6ee6 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@" @@ -90,7 +90,7 @@ index 858b526c9..de727e6ee 100644 +EOF +fi diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 292e33332..7bb3a211a 100644 +index 292e333324..7bb3a211a7 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -66,10 +66,14 @@ fi @@ -109,7 +109,7 @@ index 292e33332..7bb3a211a 100644 xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index ada20775a..e9e73b815 100644 +index ada20775a1..e9e73b815f 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -73,10 +73,14 @@ fi diff --git a/0047-grub2-btrfs-06-subvol-mount.patch b/0047-grub2-btrfs-06-subvol-mount.patch index d36c966f..8cdf247d 100644 --- a/0047-grub2-btrfs-06-subvol-mount.patch +++ b/0047-grub2-btrfs-06-subvol-mount.patch @@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood 4 files changed, 392 insertions(+), 5 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 113c1f746..d323746ec 100644 +index 113c1f746c..d323746ecf 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -41,6 +41,7 @@ @@ -279,7 +279,7 @@ index 113c1f746..d323746ec 100644 grub_cmd_btrfs_list_subvols, 0, "[-p|-n] [-o var] DEVICE", diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index caf9b1ccd..28790307e 100644 +index caf9b1ccd3..28790307e0 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key @@ -462,7 +462,7 @@ index caf9b1ccd..28790307e 100644 grub_make_system_path_relative_to_its_root_os (const char *path) { diff --git a/util/grub-install.c b/util/grub-install.c -index 0f66f36d2..84ed6e88e 100644 +index 0f66f36d23..84ed6e88ec 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1569,6 +1569,55 @@ main (int argc, char *argv[]) @@ -522,7 +522,7 @@ index 0f66f36d2..84ed6e88e 100644 const char *core_name = NULL; diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h -index 73fa2d34a..9c642ae3f 100644 +index 73fa2d34ab..9c642ae3fe 100644 --- a/include/grub/emu/getroot.h +++ b/include/grub/emu/getroot.h @@ -53,6 +53,11 @@ char ** diff --git a/0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch index 8e56f313..a5db09ae 100644 --- a/0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +++ b/0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch @@ -10,7 +10,7 @@ Ref: bsc#953538 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index d323746ec..673ded035 100644 +index d323746ecf..673ded0352 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -1260,11 +1260,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) diff --git a/0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch index 49d8972a..99c106d5 100644 --- a/0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +++ b/0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch @@ -10,7 +10,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 238 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 673ded035..2b21cbaa6 100644 +index 673ded0352..2b21cbaa67 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -2887,6 +2887,238 @@ out: diff --git a/0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch index 071fa4ef..d07dd276 100644 --- a/0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +++ b/0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 585fa6662..03f9a9d01 100644 +index 585fa6662b..03f9a9d011 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -24,6 +24,10 @@ diff --git a/0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch index 11c7c27e..2a3d27b1 100644 --- a/0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch +++ b/0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 07c493789..89ac84cc6 100644 +index 07c4937898..89ac84cc66 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -65,7 +65,7 @@ grub_chainloader_unload (void) diff --git a/0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch index 5afc0959..f649c8c4 100644 --- a/0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +++ b/0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 89ac84cc6..ac8dfd40c 100644 +index 89ac84cc66..ac8dfd40c6 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -810,7 +810,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) @@ -26,7 +26,7 @@ index 89ac84cc6..ac8dfd40c 100644 efi_status = grub_efi_free_pool (buffer); diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 117469450..996288014 100644 +index 117469450d..9962880147 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -546,7 +546,16 @@ typedef grub_uint64_t grub_efi_uint64_t; diff --git a/0053-don-t-use-int-for-efi-status.patch b/0053-don-t-use-int-for-efi-status.patch index 808823e1..4d48e376 100644 --- a/0053-don-t-use-int-for-efi-status.patch +++ b/0053-don-t-use-int-for-efi-status.patch @@ -8,7 +8,7 @@ Subject: [PATCH] don't use int for efi status 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 05d8237a9..ae9885edb 100644 +index 05d8237a9b..ae9885edb8 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -167,7 +167,7 @@ grub_reboot (void) diff --git a/0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch index ce03b0b5..fb71ea50 100644 --- a/0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +++ b/0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch @@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes. 1 file changed, 2 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index b3753c9ca..91933b85f 100644 +index b3753c9ca2..91933b85f2 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -54,6 +54,7 @@ grub_mod_fini (void) diff --git a/0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch index 974f5ebc..ae8a8c68 100644 --- a/0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +++ b/0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch @@ -16,7 +16,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index 84ed6e88e..a2bec7446 100644 +index 84ed6e88ec..a2bec7446c 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -1190,18 +1190,8 @@ main (int argc, char *argv[]) diff --git a/0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch index b9902f23..cd58ff45 100644 --- a/0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +++ b/0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 5 insertions(+) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index e9e73b815..c23b064be 100644 +index e9e73b815f..c23b064be6 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -153,6 +153,7 @@ linux_entry_xsm () diff --git a/0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch index 06326961..beef0f3a 100644 --- a/0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +++ b/0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch @@ -63,7 +63,7 @@ Signed-off-by: Peter Jones 1 file changed, 89 insertions(+), 20 deletions(-) diff --git a/grub-core/kern/i386/tsc_pmtimer.c b/grub-core/kern/i386/tsc_pmtimer.c -index c9c361699..ca15c3aac 100644 +index c9c3616997..ca15c3aacd 100644 --- a/grub-core/kern/i386/tsc_pmtimer.c +++ b/grub-core/kern/i386/tsc_pmtimer.c @@ -28,40 +28,101 @@ diff --git a/0058-align-struct-efi_variable-better.patch b/0058-align-struct-efi_variable-better.patch index bbadf711..361cb130 100644 --- a/0058-align-struct-efi_variable-better.patch +++ b/0058-align-struct-efi_variable-better.patch @@ -9,7 +9,7 @@ Subject: [PATCH] align struct efi_variable better... 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h -index 36d2dedf4..9d93ba88b 100644 +index 36d2dedf47..9d93ba88ba 100644 --- a/include/grub/efiemu/runtime.h +++ b/include/grub/efiemu/runtime.h @@ -33,5 +33,5 @@ struct efi_variable @@ -20,7 +20,7 @@ index 36d2dedf4..9d93ba88b 100644 +} GRUB_PACKED GRUB_ALIGNED(8); #endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */ diff --git a/include/grub/types.h b/include/grub/types.h -index 0a3ff1591..ba446d990 100644 +index 0a3ff15913..ba446d9904 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -29,6 +29,7 @@ diff --git a/0059-Add-BLS-support-to-grub-mkconfig.patch b/0059-Add-BLS-support-to-grub-mkconfig.patch index ba68046f..4c3f56f9 100644 --- a/0059-Add-BLS-support-to-grub-mkconfig.patch +++ b/0059-Add-BLS-support-to-grub-mkconfig.patch @@ -33,7 +33,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 243 insertions(+), 6 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 535c0f024..f55339a3f 100644 +index 535c0f0249..f55339a3f6 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@" @@ -74,7 +74,7 @@ index 535c0f024..f55339a3f 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index fafeac950..d8bb40693 100644 +index fafeac9506..d8bb406936 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -30,6 +30,9 @@ fi @@ -131,7 +131,7 @@ index fafeac950..d8bb40693 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 7bb3a211a..f1548a260 100644 +index 7bb3a211a7..f1548a2605 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -82,6 +82,218 @@ case x"$GRUB_FS" in diff --git a/0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch index c1cdd3cd..1ac900c1 100644 --- a/0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +++ b/0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch @@ -12,7 +12,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index a3e215155..c60601b69 100644 +index a3e215155b..c60601b699 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -1201,7 +1201,7 @@ static void __attribute__ ((noreturn)) diff --git a/0061-Add-linux-and-initrd-commands-for-grub-emu.patch b/0061-Add-linux-and-initrd-commands-for-grub-emu.patch index 25838e74..419fde38 100644 --- a/0061-Add-linux-and-initrd-commands-for-grub-emu.patch +++ b/0061-Add-linux-and-initrd-commands-for-grub-emu.patch @@ -21,7 +21,7 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/loader/emu/linux.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 058c88ac3..5354f9613 100644 +index 058c88ac3a..5354f9613d 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1826,7 +1826,6 @@ module = { @@ -33,7 +33,7 @@ index 058c88ac3..5354f9613 100644 efi = loader/efi/linux.c; }; diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 55ea5a11c..846fe9715 100644 +index 55ea5a11cc..846fe9715e 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -107,6 +107,7 @@ static struct argp_option options[] = { @@ -55,7 +55,7 @@ index 55ea5a11c..846fe9715 100644 case ARGP_KEY_ARG: { diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 0ff13bcaf..eeea09275 100644 +index 0ff13bcaf8..eeea092752 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -39,6 +39,7 @@ @@ -103,7 +103,7 @@ index 0ff13bcaf..eeea09275 100644 +} diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c new file mode 100644 -index 000000000..fda9e00d2 +index 0000000000..fda9e00d24 --- /dev/null +++ b/grub-core/loader/emu/linux.c @@ -0,0 +1,172 @@ @@ -280,7 +280,7 @@ index 000000000..fda9e00d2 + grub_unregister_command (cmd_initrd); +} diff --git a/include/grub/emu/exec.h b/include/grub/emu/exec.h -index d1073ef86..1b61b4a2e 100644 +index d1073ef86a..1b61b4a2e5 100644 --- a/include/grub/emu/exec.h +++ b/include/grub/emu/exec.h @@ -23,6 +23,8 @@ @@ -302,7 +302,7 @@ index d1073ef86..1b61b4a2e 100644 grub_util_exec_redirect (const char *const *argv, const char *stdin_file, const char *stdout_file); diff --git a/include/grub/emu/hostfile.h b/include/grub/emu/hostfile.h -index cfb1e2b56..a61568e36 100644 +index cfb1e2b566..a61568e36e 100644 --- a/include/grub/emu/hostfile.h +++ b/include/grub/emu/hostfile.h @@ -22,6 +22,7 @@ @@ -323,7 +323,7 @@ index cfb1e2b56..a61568e36 100644 char * grub_util_path_concat (size_t n, ...); diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index ff9c48a64..01056954b 100644 +index ff9c48a649..01056954b9 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -57,6 +57,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format ( @@ -337,7 +337,7 @@ index ff9c48a64..01056954b 100644 #ifdef HAVE_DEVICE_MAPPER diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index ee88e44e9..80e7a83ed 100644 +index ee88e44e97..80e7a83edf 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -307,6 +307,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h diff --git a/0062-Add-grub2-switch-to-blscfg.patch b/0062-Add-grub2-switch-to-blscfg.patch index e3532591..e3144df6 100644 --- a/0062-Add-grub2-switch-to-blscfg.patch +++ b/0062-Add-grub2-switch-to-blscfg.patch @@ -20,7 +20,7 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index 43a1c7453..a90879fa9 100644 +index 43a1c7453b..a90879fa9b 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1365,6 +1365,13 @@ program = { @@ -39,14 +39,14 @@ index 43a1c7453..a90879fa9 100644 mansection = 1; diff --git a/docs/man/grub-switch-to-blscfg.h2m b/docs/man/grub-switch-to-blscfg.h2m new file mode 100644 -index 000000000..fa341426a +index 0000000000..fa341426a5 --- /dev/null +++ b/docs/man/grub-switch-to-blscfg.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-switch-to-blscfg \- switch to using BLS config files diff --git a/util/grub-set-password.in b/util/grub-set-password.in -index 5ebf50576..c0b5ebbfd 100644 +index 5ebf50576d..c0b5ebbfdc 100644 --- a/util/grub-set-password.in +++ b/util/grub-set-password.in @@ -1,6 +1,6 @@ @@ -59,7 +59,7 @@ index 5ebf50576..c0b5ebbfd 100644 else diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in new file mode 100644 -index 000000000..a851424be +index 0000000000..a851424beb --- /dev/null +++ b/util/grub-switch-to-blscfg.in @@ -0,0 +1,317 @@ @@ -381,7 +381,7 @@ index 000000000..a851424be +# Bye. +exit 0 diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index f1548a260..c02c1f082 100644 +index f1548a2605..c02c1f0820 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -138,7 +138,7 @@ blsdir="/boot/loader/entries" diff --git a/0063-make-better-backtraces.patch b/0063-make-better-backtraces.patch index 06a0a459..ffdb8953 100644 --- a/0063-make-better-backtraces.patch +++ b/0063-make-better-backtraces.patch @@ -38,7 +38,7 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index a90879fa9..48512bc63 100644 +index a90879fa9b..48512bc631 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -51,6 +51,12 @@ library = { @@ -55,7 +55,7 @@ index a90879fa9..48512bc63 100644 library = { diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 5354f9613..4b7c45a7b 100644 +index 5354f9613d..4b7c45a7b0 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -142,6 +142,12 @@ kernel = { @@ -103,7 +103,7 @@ diff --git a/grub-core/lib/backtrace.c b/grub-core/commands/backtrace.c similarity index 98% rename from grub-core/lib/backtrace.c rename to grub-core/commands/backtrace.c -index c0ad6ab8b..8b5ec3913 100644 +index c0ad6ab8be..8b5ec3913b 100644 --- a/grub-core/lib/backtrace.c +++ b/grub-core/commands/backtrace.c @@ -54,7 +54,7 @@ grub_cmd_backtrace (grub_command_t cmd __attribute__ ((unused)), @@ -116,7 +116,7 @@ index c0ad6ab8b..8b5ec3913 100644 } diff --git a/grub-core/gdb/cstub.c b/grub-core/gdb/cstub.c -index b64acd70f..99281472d 100644 +index b64acd70fe..99281472d3 100644 --- a/grub-core/gdb/cstub.c +++ b/grub-core/gdb/cstub.c @@ -215,7 +215,6 @@ grub_gdb_trap (int trap_no) @@ -129,7 +129,7 @@ index b64acd70f..99281472d 100644 diff --git a/grub-core/kern/arm64/backtrace.c b/grub-core/kern/arm64/backtrace.c new file mode 100644 -index 000000000..019c6fdfe +index 0000000000..019c6fdfef --- /dev/null +++ b/grub-core/kern/arm64/backtrace.c @@ -0,0 +1,94 @@ @@ -229,7 +229,7 @@ index 000000000..019c6fdfe +} diff --git a/grub-core/kern/backtrace.c b/grub-core/kern/backtrace.c new file mode 100644 -index 000000000..4a82e865c +index 0000000000..4a82e865cc --- /dev/null +++ b/grub-core/kern/backtrace.c @@ -0,0 +1,97 @@ @@ -331,7 +331,7 @@ index 000000000..4a82e865c + grub_backtrace (skip + 1); +} diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 7afb9e6f7..88d207770 100644 +index 7afb9e6f72..88d2077709 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name) @@ -395,7 +395,7 @@ index 7afb9e6f7..88d207770 100644 i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) diff --git a/grub-core/kern/i386/backtrace.c b/grub-core/kern/i386/backtrace.c new file mode 100644 -index 000000000..2413f9a57 +index 0000000000..2413f9a57d --- /dev/null +++ b/grub-core/kern/i386/backtrace.c @@ -0,0 +1,125 @@ @@ -525,7 +525,7 @@ index 000000000..2413f9a57 +#endif +} diff --git a/grub-core/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c -index 27bc68b8a..b51d0abfa 100644 +index 27bc68b8a5..b51d0abfa6 100644 --- a/grub-core/kern/i386/pc/init.c +++ b/grub-core/kern/i386/pc/init.c @@ -153,7 +153,7 @@ compact_mem_regions (void) @@ -547,7 +547,7 @@ index 27bc68b8a..b51d0abfa 100644 /* Initialize the console as early as possible. */ grub_console_init (); diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 0cd2a6272..937c1bc44 100644 +index 0cd2a62723..937c1bc44c 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -63,7 +63,6 @@ @@ -559,7 +559,7 @@ index 0cd2a6272..937c1bc44 100644 #ifdef __sparc__ diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index c60601b69..a432a6be5 100644 +index c60601b699..a432a6be54 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -1197,15 +1197,15 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) @@ -593,7 +593,7 @@ index c60601b69..a432a6be5 100644 grub_vprintf (_(fmt), ap); va_end (ap); diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index c070afc62..d8c837757 100644 +index c070afc621..d8c8377578 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c @@ -97,13 +97,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) @@ -615,7 +615,7 @@ index c070afc62..d8c837757 100644 diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c deleted file mode 100644 -index 1079b5380..000000000 +index 1079b5380e..0000000000 --- a/grub-core/lib/arm64/backtrace.c +++ /dev/null @@ -1,62 +0,0 @@ @@ -683,7 +683,7 @@ index 1079b5380..000000000 - diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c deleted file mode 100644 -index c67273db3..000000000 +index c67273db3a..0000000000 --- a/grub-core/lib/i386/backtrace.c +++ /dev/null @@ -1,78 +0,0 @@ @@ -766,7 +766,7 @@ index c67273db3..000000000 -} - diff --git a/include/grub/backtrace.h b/include/grub/backtrace.h -index 395519762..275cf85e2 100644 +index 395519762f..275cf85e2d 100644 --- a/include/grub/backtrace.h +++ b/include/grub/backtrace.h @@ -19,8 +19,14 @@ @@ -787,7 +787,7 @@ index 395519762..275cf85e2 100644 #endif diff --git a/include/grub/dl.h b/include/grub/dl.h -index 91933b85f..2f76e6b04 100644 +index 91933b85f2..2f76e6b043 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -259,6 +259,8 @@ grub_dl_is_persistent (grub_dl_t mod) @@ -800,7 +800,7 @@ index 91933b85f..2f76e6b04 100644 int isfunc, grub_dl_t mod); diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index abbca5ea3..300a9766c 100644 +index abbca5ea33..300a9766cd 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -111,6 +111,9 @@ grub_addr_t grub_modules_get_end (void); @@ -814,7 +814,7 @@ index abbca5ea3..300a9766c 100644 void grub_main (void) __attribute__ ((noreturn)); diff --git a/grub-core/kern/arm/efi/startup.S b/grub-core/kern/arm/efi/startup.S -index 9f8265315..f3bc41f9d 100644 +index 9f8265315a..f3bc41f9d0 100644 --- a/grub-core/kern/arm/efi/startup.S +++ b/grub-core/kern/arm/efi/startup.S @@ -23,6 +23,8 @@ @@ -827,7 +827,7 @@ index 9f8265315..f3bc41f9d 100644 /* * EFI_SYSTEM_TABLE and EFI_HANDLE are passed in r1/r0. diff --git a/grub-core/kern/arm/startup.S b/grub-core/kern/arm/startup.S -index 3946fe8e1..5679a1d00 100644 +index 3946fe8e18..5679a1d00a 100644 --- a/grub-core/kern/arm/startup.S +++ b/grub-core/kern/arm/startup.S @@ -48,6 +48,8 @@ @@ -840,7 +840,7 @@ index 3946fe8e1..5679a1d00 100644 b codestart diff --git a/grub-core/kern/arm64/efi/startup.S b/grub-core/kern/arm64/efi/startup.S -index 666a7ee3c..41676bdb2 100644 +index 666a7ee3c9..41676bdb2b 100644 --- a/grub-core/kern/arm64/efi/startup.S +++ b/grub-core/kern/arm64/efi/startup.S @@ -19,7 +19,9 @@ @@ -854,7 +854,7 @@ index 666a7ee3c..41676bdb2 100644 /* * EFI_SYSTEM_TABLE and EFI_HANDLE are passed in x1/x0. diff --git a/grub-core/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S -index 0d89858d9..939f182fc 100644 +index 0d89858d9b..939f182fc7 100644 --- a/grub-core/kern/i386/qemu/startup.S +++ b/grub-core/kern/i386/qemu/startup.S @@ -24,7 +24,8 @@ @@ -868,7 +868,7 @@ index 0d89858d9..939f182fc 100644 jmp codestart diff --git a/grub-core/kern/ia64/efi/startup.S b/grub-core/kern/ia64/efi/startup.S -index d75c6d7cc..8f2a593e5 100644 +index d75c6d7cc7..8f2a593e52 100644 --- a/grub-core/kern/ia64/efi/startup.S +++ b/grub-core/kern/ia64/efi/startup.S @@ -24,8 +24,9 @@ @@ -883,7 +883,7 @@ index d75c6d7cc..8f2a593e5 100644 alloc loc0=ar.pfs,2,4,0,0 mov loc1=rp diff --git a/grub-core/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S -index 03b916f05..701bf63ab 100644 +index 03b916f053..701bf63abc 100644 --- a/grub-core/kern/sparc64/ieee1275/crt0.S +++ b/grub-core/kern/sparc64/ieee1275/crt0.S @@ -22,7 +22,8 @@ @@ -897,7 +897,7 @@ index 03b916f05..701bf63ab 100644 ba codestart mov %o4, %o0 diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 80e7a83ed..f512573c0 100644 +index 80e7a83edf..f512573c0d 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h diff --git a/0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch index d872cb81..a9162990 100644 --- a/0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +++ b/0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch @@ -8,7 +8,7 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set 1 file changed, 3 insertions(+) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index d5df4f815..1970e4816 100644 +index 55558cc0b9..af9792c963 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -430,6 +430,9 @@ grub_normal_reader_init (int nested) diff --git a/0065-Work-around-some-minor-include-path-weirdnesses.patch b/0065-Work-around-some-minor-include-path-weirdnesses.patch index 589f3350..c7ae8d01 100644 --- a/0065-Work-around-some-minor-include-path-weirdnesses.patch +++ b/0065-Work-around-some-minor-include-path-weirdnesses.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Jones diff --git a/include/grub/arm/efi/console.h b/include/grub/arm/efi/console.h new file mode 100644 -index 000000000..1592f6f76 +index 0000000000..1592f6f76b --- /dev/null +++ b/include/grub/arm/efi/console.h @@ -0,0 +1,24 @@ @@ -47,7 +47,7 @@ index 000000000..1592f6f76 +#endif /* ! GRUB_ARM_EFI_CONSOLE_H */ diff --git a/include/grub/arm64/efi/console.h b/include/grub/arm64/efi/console.h new file mode 100644 -index 000000000..956893393 +index 0000000000..9568933938 --- /dev/null +++ b/include/grub/arm64/efi/console.h @@ -0,0 +1,24 @@ @@ -77,7 +77,7 @@ index 000000000..956893393 +#endif /* ! GRUB_ARM64_EFI_CONSOLE_H */ diff --git a/include/grub/i386/efi/console.h b/include/grub/i386/efi/console.h new file mode 100644 -index 000000000..9231375cb +index 0000000000..9231375cb0 --- /dev/null +++ b/include/grub/i386/efi/console.h @@ -0,0 +1,24 @@ @@ -107,7 +107,7 @@ index 000000000..9231375cb +#endif /* ! GRUB_I386_EFI_CONSOLE_H */ diff --git a/include/grub/x86_64/efi/console.h b/include/grub/x86_64/efi/console.h new file mode 100644 -index 000000000..dba9d8678 +index 0000000000..dba9d8678d --- /dev/null +++ b/include/grub/x86_64/efi/console.h @@ -0,0 +1,24 @@ diff --git a/0066-Make-it-possible-to-enabled-build-id-sha1.patch b/0066-Make-it-possible-to-enabled-build-id-sha1.patch index 5088c89a..592635aa 100644 --- a/0066-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0066-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index 4f1676967..b809c0078 100644 +index 4f1676967e..b809c00784 100644 --- a/configure.ac +++ b/configure.ac @@ -1443,7 +1443,15 @@ grub_PROG_TARGET_CC @@ -30,7 +30,7 @@ index 4f1676967..b809c0078 100644 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then if test ! -z "$TARGET_IMG_LDSCRIPT"; then diff --git a/acinclude.m4 b/acinclude.m4 -index 6e14bb553..21238fcfd 100644 +index 6e14bb553c..21238fcfd0 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then diff --git a/0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch index 20f19c6f..7658e9b8 100644 --- a/0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +++ b/0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 2 files changed, 20 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index a432a6be5..9a2fae639 100644 +index a432a6be54..9a2fae6398 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -191,6 +191,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, @@ -42,7 +42,7 @@ index a432a6be5..9a2fae639 100644 int diff --git a/include/grub/misc.h b/include/grub/misc.h -index fd18e6320..3adc4036e 100644 +index fd18e6320b..3adc4036e3 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, diff --git a/0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch index 91bc5576..ccf34a50 100644 --- a/0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +++ b/0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -20,7 +20,7 @@ Signed-off-by: Peter Jones 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 88d207770..955725403 100644 +index 88d2077709..9557254035 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -501,6 +501,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) @@ -95,7 +95,7 @@ index 88d207770..955725403 100644 { grub_dl_unload (mod); diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index ae9885edb..d6a2fb577 100644 +index ae9885edb8..d6a2fb5778 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -296,7 +296,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, @@ -117,7 +117,7 @@ index ae9885edb..d6a2fb577 100644 } diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 6d39bd3ad..2d12e6188 100644 +index 6d39bd3ad2..2d12e6188f 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -115,10 +115,33 @@ grub_efi_env_init (void) @@ -164,7 +164,7 @@ index 6d39bd3ad..2d12e6188 100644 } diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 03f9a9d01..2e0691454 100644 +index 03f9a9d011..2e0691454b 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -138,7 +138,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); diff --git a/0069-Fixup-for-newer-compiler.patch b/0069-Fixup-for-newer-compiler.patch index aff1662b..ed23271e 100644 --- a/0069-Fixup-for-newer-compiler.patch +++ b/0069-Fixup-for-newer-compiler.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Fixup for newer compiler 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 2b21cbaa6..4cc86e9b7 100644 +index 2b21cbaa67..4cc86e9b79 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -218,7 +218,7 @@ struct grub_btrfs_inode @@ -22,7 +22,7 @@ index 2b21cbaa6..4cc86e9b7 100644 struct grub_btrfs_extent_data { diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h -index 7a93f4329..8212697bf 100644 +index 7a93f43291..8212697bf6 100644 --- a/include/grub/gpt_partition.h +++ b/include/grub/gpt_partition.h @@ -76,7 +76,7 @@ struct grub_gpt_partentry diff --git a/0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch index 6d85ecc0..9b78c00c 100644 --- a/0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +++ b/0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+) diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index 300a9766c..55849777e 100644 +index 300a9766cd..55849777ea 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -111,8 +111,10 @@ grub_addr_t grub_modules_get_end (void); diff --git a/0071-Fixup-for-newer-compiler.patch b/0071-Fixup-for-newer-compiler.patch index f3844043..167dca18 100644 --- a/0071-Fixup-for-newer-compiler.patch +++ b/0071-Fixup-for-newer-compiler.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Fixup for newer compiler 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 191b1a70c..5f0ef9698 100644 +index 191b1a70c6..5f0ef96985 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding diff --git a/0072-Add-support-for-non-Ethernet-network-cards.patch b/0072-Add-support-for-non-Ethernet-network-cards.patch index e161fa04..fb446288 100644 --- a/0072-Add-support-for-non-Ethernet-network-cards.patch +++ b/0072-Add-support-for-non-Ethernet-network-cards.patch @@ -38,7 +38,7 @@ Signed-off-by: Mark Salter 12 files changed, 219 insertions(+), 152 deletions(-) diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index 54306e3b1..67b409a8a 100644 +index 54306e3b16..67b409a8ac 100644 --- a/grub-core/net/arp.c +++ b/grub-core/net/arp.c @@ -31,22 +31,12 @@ enum @@ -271,7 +271,7 @@ index 54306e3b1..67b409a8a 100644 /* Change operation to REPLY and send packet */ send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index e28fb6a09..08b6b2b5d 100644 +index e28fb6a09f..08b6b2b5d6 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -233,7 +233,6 @@ grub_net_configure_by_dhcp_ack (const char *name, @@ -318,7 +318,7 @@ index e28fb6a09..08b6b2b5d 100644 grub_netbuff_push (nb, sizeof (*udph)); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 173fb6315..a673bea80 100644 +index 173fb63153..a673bea807 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -279,6 +279,9 @@ grub_efinet_findcards (void) @@ -346,7 +346,7 @@ index 173fb6315..a673bea80 100644 card->efi_handle = *handle; diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c -index b19492086..5b6c5e16a 100644 +index b194920861..5b6c5e16a6 100644 --- a/grub-core/net/drivers/emu/emunet.c +++ b/grub-core/net/drivers/emu/emunet.c @@ -46,6 +46,7 @@ static struct grub_net_card emucard = @@ -358,7 +358,7 @@ index b19492086..5b6c5e16a 100644 }, .flags = 0 diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c -index 3f4152d03..9f8fb4b6d 100644 +index 3f4152d036..9f8fb4b6d2 100644 --- a/grub-core/net/drivers/i386/pc/pxe.c +++ b/grub-core/net/drivers/i386/pc/pxe.c @@ -386,20 +386,21 @@ GRUB_MOD_INIT(pxe) @@ -390,7 +390,7 @@ index 3f4152d03..9f8fb4b6d 100644 grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index 3860b6f78..bcb3f9ea0 100644 +index 3860b6f78d..bcb3f9ea02 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -160,6 +160,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, @@ -410,7 +410,7 @@ index 3860b6f78..bcb3f9ea0 100644 card->txbufsize = ALIGN_UP (card->mtu, 64) + 256; diff --git a/grub-core/net/drivers/uboot/ubootnet.c b/grub-core/net/drivers/uboot/ubootnet.c -index 056052e40..22ebcbf21 100644 +index 056052e40d..22ebcbf211 100644 --- a/grub-core/net/drivers/uboot/ubootnet.c +++ b/grub-core/net/drivers/uboot/ubootnet.c @@ -131,6 +131,7 @@ GRUB_MOD_INIT (ubootnet) @@ -422,7 +422,7 @@ index 056052e40..22ebcbf21 100644 card->txbufsize = ALIGN_UP (card->mtu, 64) + 256; card->txbuf = grub_zalloc (card->txbufsize); diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c -index 4d7ceed6f..9aae83a5e 100644 +index 4d7ceed6f9..9aae83a5eb 100644 --- a/grub-core/net/ethernet.c +++ b/grub-core/net/ethernet.c @@ -29,13 +29,6 @@ @@ -572,7 +572,7 @@ index 4d7ceed6f..9aae83a5e 100644 { /* ARP packet. */ diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c -index 2cbd95dce..56a3ec5c8 100644 +index 2cbd95dce2..56a3ec5c8e 100644 --- a/grub-core/net/icmp6.c +++ b/grub-core/net/icmp6.c @@ -231,8 +231,9 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb, @@ -612,7 +612,7 @@ index 2cbd95dce..56a3ec5c8 100644 } if (ohdr->type == OPTION_PREFIX && ohdr->len == 4) diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index ea5edf8f1..a5896f6dc 100644 +index ea5edf8f1f..a5896f6dc2 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c @@ -276,8 +276,8 @@ handle_dgram (struct grub_net_buff *nb, @@ -627,7 +627,7 @@ index ea5edf8f1..a5896f6dc 100644 grub_net_process_dhcp (nb, inf); grub_netbuff_free (nb); diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 22f2689aa..a46f82362 100644 +index 22f2689aae..a46f82362e 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -133,8 +133,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, @@ -713,7 +713,7 @@ index 22f2689aa..a46f82362 100644 int diff --git a/include/grub/net.h b/include/grub/net.h -index 8a05ec4fe..af0404db7 100644 +index 8a05ec4fe7..af0404db7e 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -29,7 +29,8 @@ diff --git a/0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch index 997c189d..307e33cf 100644 --- a/0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +++ b/0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch @@ -18,7 +18,7 @@ Signed-off-by: Peter Jones 4 files changed, 109 insertions(+), 12 deletions(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index b616cf40b..12a2632ea 100644 +index b616cf40b1..12a2632ea5 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -289,7 +289,9 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)), @@ -87,7 +87,7 @@ index b616cf40b..12a2632ea 100644 file); if (!data->sock) diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index a46f82362..0ce5e675e 100644 +index a46f82362e..0ce5e675ed 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -444,6 +444,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) @@ -225,7 +225,7 @@ index a46f82362..0ce5e675e 100644 } diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 4ab2f5c73..d54b13f09 100644 +index 4ab2f5c735..d54b13f09f 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c @@ -295,6 +295,7 @@ tftp_open (struct grub_file *file, const char *filename) @@ -257,7 +257,7 @@ index 4ab2f5c73..d54b13f09 100644 if (!data->sock) { diff --git a/include/grub/net.h b/include/grub/net.h -index af0404db7..d55d505a0 100644 +index af0404db7e..d55d505a03 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -273,6 +273,7 @@ typedef struct grub_net diff --git a/0074-bootp-New-net_bootp6-command.patch b/0074-bootp-New-net_bootp6-command.patch index 83074098..bef3acdc 100644 --- a/0074-bootp-New-net_bootp6-command.patch +++ b/0074-bootp-New-net_bootp6-command.patch @@ -19,7 +19,7 @@ Signed-off-by: Peter Jones 5 files changed, 1002 insertions(+), 209 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 08b6b2b5d..fe93b80f1 100644 +index 08b6b2b5d6..fe93b80f1c 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -24,6 +24,98 @@ @@ -1136,7 +1136,7 @@ index 08b6b2b5d..fe93b80f1 100644 grub_unregister_command (cmd_bootp); grub_unregister_command (cmd_dhcp); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index a673bea80..8e25680db 100644 +index a673bea807..8e25680db0 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -393,9 +393,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, @@ -1174,7 +1174,7 @@ index a673bea80..8e25680db 100644 } else diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index a5896f6dc..ce6bdc75c 100644 +index a5896f6dc2..ce6bdc75c6 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c @@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb, @@ -1224,7 +1224,7 @@ index a5896f6dc..ce6bdc75c 100644 { const struct grub_net_bootp_packet *bootp; diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 996288014..7614b58dc 100644 +index 9962880147..7614b58dca 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1532,7 +1532,7 @@ typedef struct grub_efi_pxe_ip_filter @@ -1237,7 +1237,7 @@ index 996288014..7614b58dc 100644 } grub_efi_pxe_ip_filter_t; diff --git a/include/grub/net.h b/include/grub/net.h -index d55d505a0..543251f72 100644 +index d55d505a03..543251f727 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -451,50 +451,65 @@ struct grub_net_bootp_packet diff --git a/0075-efinet-UEFI-IPv6-PXE-support.patch b/0075-efinet-UEFI-IPv6-PXE-support.patch index 8f1dca69..988c1784 100644 --- a/0075-efinet-UEFI-IPv6-PXE-support.patch +++ b/0075-efinet-UEFI-IPv6-PXE-support.patch @@ -15,7 +15,7 @@ Signed-off-by: Ken Lin 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 8e25680db..014e5bf98 100644 +index 8e25680db0..014e5bf980 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, @@ -28,7 +28,7 @@ index 8e25680db..014e5bf98 100644 else { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 7614b58dc..91ab528e4 100644 +index 7614b58dca..91ab528e4d 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1524,31 +1524,6 @@ typedef union diff --git a/0076-grub.texi-Add-net_bootp6-doument.patch b/0076-grub.texi-Add-net_bootp6-doument.patch index d12f33e2..b42e09bf 100644 --- a/0076-grub.texi-Add-net_bootp6-doument.patch +++ b/0076-grub.texi-Add-net_bootp6-doument.patch @@ -12,7 +12,7 @@ Signed-off-by: Ken Lin 1 file changed, 17 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 0615d0ed9..04ed6ac1f 100644 +index 0615d0ed97..04ed6ac1f0 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -5487,6 +5487,7 @@ This command is only available on AArch64 systems. diff --git a/0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch index 114f102e..abff9eb2 100644 --- a/0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +++ b/0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch @@ -22,7 +22,7 @@ Signed-off-by: Ken Lin 2 files changed, 56 insertions(+) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index fe93b80f1..8fb8918ae 100644 +index fe93b80f1c..8fb8918ae7 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -20,6 +20,7 @@ @@ -95,7 +95,7 @@ index fe93b80f1..8fb8918ae 100644 if (opt && opt_len) grub_env_set_net_property (name, "extensionspath", (const char *) opt, opt_len); diff --git a/include/grub/net.h b/include/grub/net.h -index 543251f72..42af7de25 100644 +index 543251f727..42af7de250 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -531,6 +531,7 @@ enum diff --git a/0078-efinet-Setting-network-from-UEFI-device-path.patch b/0078-efinet-Setting-network-from-UEFI-device-path.patch index 0aef614e..f4faf270 100644 --- a/0078-efinet-Setting-network-from-UEFI-device-path.patch +++ b/0078-efinet-Setting-network-from-UEFI-device-path.patch @@ -32,7 +32,7 @@ Signed-off-by: Ken Lin 2 files changed, 280 insertions(+), 15 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 014e5bf98..8171ecaa5 100644 +index 014e5bf980..8171ecaa5e 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -26,6 +26,7 @@ @@ -375,7 +375,7 @@ index 014e5bf98..8171ecaa5 100644 } } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 91ab528e4..4a51667ad 100644 +index 91ab528e4d..4a51667adb 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -864,6 +864,8 @@ struct grub_efi_ipv4_device_path diff --git a/0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch index a539267d..2d92ff07 100644 --- a/0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch +++ b/0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch @@ -33,7 +33,7 @@ Signed-off-by: Ken Lin 2 files changed, 238 insertions(+) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 8171ecaa5..715a6168d 100644 +index 8171ecaa5e..715a6168d7 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -242,7 +242,7 @@ index 8171ecaa5..715a6168d 100644 } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 4a51667ad..0b490195a 100644 +index 4a51667adb..0b490195ad 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -352,6 +352,15 @@ diff --git a/0080-Support-UEFI-networking-protocols.patch b/0080-Support-UEFI-networking-protocols.patch index ec8e1592..740a9f87 100644 --- a/0080-Support-UEFI-networking-protocols.patch +++ b/0080-Support-UEFI-networking-protocols.patch @@ -57,7 +57,7 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/net/efi.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 4b7c45a7b..c40170f2d 100644 +index 4b7c45a7b0..c40170f2dd 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2299,6 +2299,12 @@ module = { @@ -87,7 +87,7 @@ index 4b7c45a7b..c40170f2d 100644 module = { diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c -index a458c3aca..163773153 100644 +index a458c3aca7..1637731535 100644 --- a/grub-core/io/bufio.c +++ b/grub-core/io/bufio.c @@ -139,7 +139,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len) @@ -100,7 +100,7 @@ index a458c3aca..163773153 100644 if (file->offset + res < next_buf) { diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index d6a2fb577..2a446f503 100644 +index d6a2fb5778..2a446f5031 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -755,7 +755,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) @@ -231,7 +231,7 @@ index d6a2fb577..2a446f503 100644 grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype); break; diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 715a6168d..e11d759f1 100644 +index 715a6168d7..e11d759f19 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -27,6 +27,7 @@ @@ -304,7 +304,7 @@ index 715a6168d..e11d759f1 100644 diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c new file mode 100644 -index 000000000..dbef63d8c +index 0000000000..dbef63d8c0 --- /dev/null +++ b/grub-core/net/efi/dhcp.c @@ -0,0 +1,397 @@ @@ -707,7 +707,7 @@ index 000000000..dbef63d8c +grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6; diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c new file mode 100644 -index 000000000..ef371d885 +index 0000000000..ef371d885e --- /dev/null +++ b/grub-core/net/efi/efi_netfs.c @@ -0,0 +1,57 @@ @@ -770,7 +770,7 @@ index 000000000..ef371d885 +} diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c new file mode 100644 -index 000000000..3f61fd2fa +index 0000000000..3f61fd2fa5 --- /dev/null +++ b/grub-core/net/efi/http.c @@ -0,0 +1,419 @@ @@ -1195,7 +1195,7 @@ index 000000000..3f61fd2fa + }; diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c new file mode 100644 -index 000000000..b711a5d94 +index 0000000000..b711a5d945 --- /dev/null +++ b/grub-core/net/efi/ip4_config.c @@ -0,0 +1,398 @@ @@ -1599,7 +1599,7 @@ index 000000000..b711a5d94 + }; diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c new file mode 100644 -index 000000000..017c4d05b +index 0000000000..017c4d05bc --- /dev/null +++ b/grub-core/net/efi/ip6_config.c @@ -0,0 +1,422 @@ @@ -2027,7 +2027,7 @@ index 000000000..017c4d05b + }; diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c new file mode 100644 -index 000000000..86bce6535 +index 0000000000..86bce6535d --- /dev/null +++ b/grub-core/net/efi/net.c @@ -0,0 +1,1428 @@ @@ -3461,7 +3461,7 @@ index 000000000..86bce6535 +} diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c new file mode 100644 -index 000000000..531949cba +index 0000000000..531949cba5 --- /dev/null +++ b/grub-core/net/efi/pxe.c @@ -0,0 +1,424 @@ @@ -3890,7 +3890,7 @@ index 000000000..531949cba + }; + diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0ce5e675e..55aed9272 100644 +index 0ce5e675ed..55aed92722 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -32,6 +32,9 @@ @@ -4000,7 +4000,7 @@ index 0ce5e675e..55aed9272 100644 +#endif } diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c -index a2461cda1..77958dd9d 100644 +index a2461cda1c..77958dd9dd 100644 --- a/util/grub-mknetdir.c +++ b/util/grub-mknetdir.c @@ -32,13 +32,15 @@ @@ -4082,7 +4082,7 @@ index a2461cda1..77958dd9d 100644 if (!grub_install_source_directory) { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 0b490195a..f431f4997 100644 +index 0b490195ad..f431f49973 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -622,6 +622,23 @@ typedef union @@ -4333,7 +4333,7 @@ index 0b490195a..f431f4997 100644 || defined(__riscv) diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h new file mode 100644 -index 000000000..fdb88eb81 +index 0000000000..fdb88eb810 --- /dev/null +++ b/include/grub/efi/dhcp.h @@ -0,0 +1,343 @@ @@ -4682,7 +4682,7 @@ index 000000000..fdb88eb81 +#endif /* ! GRUB_EFI_DHCP_HEADER */ diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h new file mode 100644 -index 000000000..c5e9a89f5 +index 0000000000..c5e9a89f50 --- /dev/null +++ b/include/grub/efi/http.h @@ -0,0 +1,215 @@ @@ -4903,7 +4903,7 @@ index 000000000..c5e9a89f5 +#endif /* !GRUB_EFI_HTTP_HEADER */ diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h new file mode 100644 -index 000000000..de90d223e +index 0000000000..de90d223e8 --- /dev/null +++ b/include/grub/net/efi.h @@ -0,0 +1,144 @@ diff --git a/0081-AUDIT-0-http-boot-tracker-bug.patch b/0081-AUDIT-0-http-boot-tracker-bug.patch index d9a20a99..b4872711 100644 --- a/0081-AUDIT-0-http-boot-tracker-bug.patch +++ b/0081-AUDIT-0-http-boot-tracker-bug.patch @@ -22,7 +22,7 @@ Signed-off-by: Michael Chang 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 86bce6535..4bb308026 100644 +index 86bce6535d..4bb308026c 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -645,8 +645,10 @@ grub_efihttp_chunk_read (grub_file_t file, char *buf, @@ -38,7 +38,7 @@ index 86bce6535..4bb308026 100644 if (buf) { diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 12a2632ea..b52b558d6 100644 +index 12a2632ea5..b52b558d63 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch index b64dad25..6e2e4e27 100644 --- a/0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch +++ b/0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch @@ -17,7 +17,7 @@ Signed-off-by: Hans de Goede 1 file changed, 50 insertions(+) diff --git a/util/grub-editenv.c b/util/grub-editenv.c -index db6f187cc..948eec8a1 100644 +index db6f187cc6..948eec8a11 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -53,6 +53,9 @@ static struct argp_option options[] = { diff --git a/0083-Add-auto-hide-menu-support.patch b/0083-Add-auto-hide-menu-support.patch index d0122552..f5aed0e0 100644 --- a/0083-Add-auto-hide-menu-support.patch +++ b/0083-Add-auto-hide-menu-support.patch @@ -43,7 +43,7 @@ Signed-off-by: Hans de Goede create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index 48512bc63..314e6f2ac 100644 +index 48512bc631..314e6f2acf 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { @@ -61,7 +61,7 @@ index 48512bc63..314e6f2ac 100644 common = util/grub.d/01_users.in; diff --git a/util/grub.d/01_menu_auto_hide.in b/util/grub.d/01_menu_auto_hide.in new file mode 100644 -index 000000000..ad175870a +index 0000000000..ad175870a5 --- /dev/null +++ b/util/grub.d/01_menu_auto_hide.in @@ -0,0 +1,48 @@ @@ -114,7 +114,7 @@ index 000000000..ad175870a +fi +EOF diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 4b27bd201..3c9431cfc 100644 +index 4b27bd2015..3c9431cfcf 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -42,6 +42,7 @@ if [ -z "${OSPROBED}" ] ; then diff --git a/0084-Add-grub-set-bootflag-utility.patch b/0084-Add-grub-set-bootflag-utility.patch index a0a6da9b..4ee43cf4 100644 --- a/0084-Add-grub-set-bootflag-utility.patch +++ b/0084-Add-grub-set-bootflag-utility.patch @@ -49,7 +49,7 @@ Signed-off-by: Robbie Harwood create mode 100644 docs/man/grub-set-bootflag.h2m diff --git a/Makefile.util.def b/Makefile.util.def -index 314e6f2ac..0b85a7fce 100644 +index 314e6f2acf..0b85a7fce4 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1446,3 +1446,10 @@ program = { @@ -65,7 +65,7 @@ index 314e6f2ac..0b85a7fce 100644 +}; diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c new file mode 100644 -index 000000000..d506f7e75 +index 0000000000..d506f7e75b --- /dev/null +++ b/util/grub-set-bootflag.c @@ -0,0 +1,172 @@ @@ -242,7 +242,7 @@ index 000000000..d506f7e75 + return 0; +} diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 8f1485d52..ad235de7f 100644 +index 8f1485d52a..ad235de7fc 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -15,6 +15,9 @@ EXTRA_DIST += docs/man @@ -257,7 +257,7 @@ index 8f1485d52..ad235de7f 100644 diff --git a/docs/grub-boot-success.service b/docs/grub-boot-success.service new file mode 100644 -index 000000000..80e79584c +index 0000000000..80e79584c9 --- /dev/null +++ b/docs/grub-boot-success.service @@ -0,0 +1,6 @@ @@ -269,7 +269,7 @@ index 000000000..80e79584c +ExecStart=/usr/sbin/grub2-set-bootflag boot_success diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer new file mode 100644 -index 000000000..406f17200 +index 0000000000..406f172005 --- /dev/null +++ b/docs/grub-boot-success.timer @@ -0,0 +1,7 @@ @@ -282,7 +282,7 @@ index 000000000..406f17200 +OnActiveSec=2min diff --git a/docs/man/grub-set-bootflag.h2m b/docs/man/grub-set-bootflag.h2m new file mode 100644 -index 000000000..94ec0b92e +index 0000000000..94ec0b92ed --- /dev/null +++ b/docs/man/grub-set-bootflag.h2m @@ -0,0 +1,2 @@ diff --git a/0085-docs-Add-grub-boot-indeterminate.service-example.patch b/0085-docs-Add-grub-boot-indeterminate.service-example.patch index 5b8732a8..96eff368 100644 --- a/0085-docs-Add-grub-boot-indeterminate.service-example.patch +++ b/0085-docs-Add-grub-boot-indeterminate.service-example.patch @@ -16,7 +16,7 @@ Signed-off-by: Hans de Goede diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service new file mode 100644 -index 000000000..6c8dcb186 +index 0000000000..6c8dcb186b --- /dev/null +++ b/docs/grub-boot-indeterminate.service @@ -0,0 +1,11 @@ diff --git a/0086-gentpl-add-disable-support.patch b/0086-gentpl-add-disable-support.patch index fabba4b1..3b305e65 100644 --- a/0086-gentpl-add-disable-support.patch +++ b/0086-gentpl-add-disable-support.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gentpl.py b/gentpl.py -index c86550d4f..f3c5f84f8 100644 +index c86550d4f9..f3c5f84f85 100644 --- a/gentpl.py +++ b/gentpl.py @@ -592,11 +592,21 @@ def platform_conditional(platform, closure): diff --git a/0087-gentpl-add-pc-firmware-type.patch b/0087-gentpl-add-pc-firmware-type.patch index e3647875..0bfd2eac 100644 --- a/0087-gentpl-add-pc-firmware-type.patch +++ b/0087-gentpl-add-pc-firmware-type.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+) diff --git a/gentpl.py b/gentpl.py -index f3c5f84f8..f09b33686 100644 +index f3c5f84f85..f09b336869 100644 --- a/gentpl.py +++ b/gentpl.py @@ -51,6 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ] diff --git a/0088-efinet-also-use-the-firmware-acceleration-for-http.patch b/0088-efinet-also-use-the-firmware-acceleration-for-http.patch index 9fec27c8..a3a94002 100644 --- a/0088-efinet-also-use-the-firmware-acceleration-for-http.patch +++ b/0088-efinet-also-use-the-firmware-acceleration-for-http.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 4bb308026..6603cd83e 100644 +index 4bb308026c..6603cd83ed 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -1324,7 +1324,9 @@ grub_efi_net_boot_from_https (void) diff --git a/0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch index 1af9ba00..90d97773 100644 --- a/0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +++ b/0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 19 insertions(+) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 3f61fd2fa..243acbaa3 100644 +index 3f61fd2fa5..243acbaa35 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -4,6 +4,7 @@ diff --git a/0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index e77a96cf..a2c71369 100644 --- a/0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index b809c0078..b1ca89479 100644 +index b809c00784..b1ca894791 100644 --- a/configure.ac +++ b/configure.ac @@ -850,11 +850,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p @@ -88,7 +88,7 @@ index b809c0078..b1ca89479 100644 GRUB_PLATFORM="${platform}" diff --git a/conf/Makefile.common b/conf/Makefile.common -index 5f0ef9698..2ff9b3935 100644 +index 5f0ef96985..2ff9b39357 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 @@ -129,7 +129,7 @@ index 5f0ef9698..2ff9b3935 100644 # Other variables diff --git a/gentpl.py b/gentpl.py -index f09b33686..0e62e1466 100644 +index f09b336869..0e62e14666 100644 --- a/gentpl.py +++ b/gentpl.py @@ -697,10 +697,10 @@ def module(defn, platform): diff --git a/0091-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0091-module-verifier-make-it-possible-to-run-checkers-on-.patch index 5419b614..78c15d6f 100644 --- a/0091-module-verifier-make-it-possible-to-run-checkers-on-.patch +++ b/0091-module-verifier-make-it-possible-to-run-checkers-on-.patch @@ -22,7 +22,7 @@ Signed-off-by: Peter Jones 3 files changed, 13 insertions(+) diff --git a/util/grub-module-verifier32.c b/util/grub-module-verifier32.c -index 257229f8f..ba7d41aaf 100644 +index 257229f8f0..ba7d41aafe 100644 --- a/util/grub-module-verifier32.c +++ b/util/grub-module-verifier32.c @@ -1,2 +1,4 @@ @@ -31,7 +31,7 @@ index 257229f8f..ba7d41aaf 100644 #include "grub-module-verifierXX.c" +#endif diff --git a/util/grub-module-verifier64.c b/util/grub-module-verifier64.c -index 4db6b4bed..fc23ef800 100644 +index 4db6b4bedd..fc23ef800b 100644 --- a/util/grub-module-verifier64.c +++ b/util/grub-module-verifier64.c @@ -1,2 +1,4 @@ @@ -40,7 +40,7 @@ index 4db6b4bed..fc23ef800 100644 #include "grub-module-verifierXX.c" +#endif diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c -index ceb24309a..a98e2f9b1 100644 +index ceb24309ae..a98e2f9b1a 100644 --- a/util/grub-module-verifierXX.c +++ b/util/grub-module-verifierXX.c @@ -1,3 +1,12 @@ diff --git a/0092-Rework-how-the-fdt-command-builds.patch b/0092-Rework-how-the-fdt-command-builds.patch index 8cf19f0d..a374f90e 100644 --- a/0092-Rework-how-the-fdt-command-builds.patch +++ b/0092-Rework-how-the-fdt-command-builds.patch @@ -25,7 +25,7 @@ Signed-off-by: Robbie Harwood 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c40170f2d..84a3d89de 100644 +index c40170f2dd..84a3d89de9 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -177,7 +177,6 @@ kernel = { @@ -62,7 +62,7 @@ index c40170f2d..84a3d89de 100644 }; diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c -index 0d371c563..37e04bd69 100644 +index 0d371c5633..37e04bd69e 100644 --- a/grub-core/lib/fdt.c +++ b/grub-core/lib/fdt.c @@ -21,8 +21,6 @@ @@ -75,7 +75,7 @@ index 0d371c563..37e04bd69 100644 #define FDT_BEGIN_NODE 0x00000001 diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c -index c86f283d7..c572415d3 100644 +index c86f283d75..c572415d38 100644 --- a/grub-core/loader/efi/fdt.c +++ b/grub-core/loader/efi/fdt.c @@ -27,6 +27,8 @@ @@ -88,7 +88,7 @@ index c86f283d7..c572415d3 100644 static void *fdt; diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index e609c7e41..3514aa4a5 100644 +index e609c7e411..3514aa4a5b 100644 --- a/include/grub/fdt.h +++ b/include/grub/fdt.h @@ -19,6 +19,9 @@ @@ -110,7 +110,7 @@ index e609c7e41..3514aa4a5 100644 + #endif /* ! GRUB_FDT_HEADER */ diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index f512573c0..dd49939aa 100644 +index f512573c0d..dd49939aaa 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h diff --git a/0093-Disable-non-wordsize-allocations-on-arm.patch b/0093-Disable-non-wordsize-allocations-on-arm.patch index 60adf7e7..7105c7cb 100644 --- a/0093-Disable-non-wordsize-allocations-on-arm.patch +++ b/0093-Disable-non-wordsize-allocations-on-arm.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index b1ca89479..f42be6533 100644 +index b1ca894791..f42be65332 100644 --- a/configure.ac +++ b/configure.ac @@ -1261,6 +1261,26 @@ if test "x$target_cpu" = xarm; then diff --git a/0094-Prepend-prefix-when-HTTP-path-is-relative.patch b/0094-Prepend-prefix-when-HTTP-path-is-relative.patch index 787e6813..30d80753 100644 --- a/0094-Prepend-prefix-when-HTTP-path-is-relative.patch +++ b/0094-Prepend-prefix-when-HTTP-path-is-relative.patch @@ -16,7 +16,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index d1de9fa68..1c540fc8c 100644 +index d1de9fa687..1c540fc8c2 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -131,11 +131,19 @@ grub_set_prefix_and_root (void) @@ -41,7 +41,7 @@ index d1de9fa68..1c540fc8c 100644 } } diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 243acbaa3..de351b2cd 100644 +index 243acbaa35..de351b2cd0 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -9,10 +9,52 @@ diff --git a/0095-Make-grub_error-more-verbose.patch b/0095-Make-grub_error-more-verbose.patch index 8ecefea3..306a3d36 100644 --- a/0095-Make-grub_error-more-verbose.patch +++ b/0095-Make-grub_error-more-verbose.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c -index 53c734de7..aebfe0cf8 100644 +index 53c734de70..aebfe0cf83 100644 --- a/grub-core/kern/err.c +++ b/grub-core/kern/err.c @@ -33,15 +33,24 @@ static struct grub_error_saved grub_error_stack_items[GRUB_ERROR_STACK_SIZE]; @@ -41,7 +41,7 @@ index 53c734de7..aebfe0cf8 100644 return n; diff --git a/include/grub/err.h b/include/grub/err.h -index b08d5d0de..c0f90ef07 100644 +index b08d5d0de4..c0f90ef07c 100644 --- a/include/grub/err.h +++ b/include/grub/err.h @@ -85,8 +85,12 @@ struct grub_error_saved diff --git a/0096-Make-reset-an-alias-for-the-reboot-command.patch b/0096-Make-reset-an-alias-for-the-reboot-command.patch index f7bd8553..22475d65 100644 --- a/0096-Make-reset-an-alias-for-the-reboot-command.patch +++ b/0096-Make-reset-an-alias-for-the-reboot-command.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub-core/commands/reboot.c b/grub-core/commands/reboot.c -index 46d364c99..f5cc22836 100644 +index 46d364c99a..f5cc228363 100644 --- a/grub-core/commands/reboot.c +++ b/grub-core/commands/reboot.c @@ -32,15 +32,18 @@ grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)), diff --git a/0097-Add-a-version-command.patch b/0097-Add-a-version-command.patch index a70170fc..8daad53b 100644 --- a/0097-Add-a-version-command.patch +++ b/0097-Add-a-version-command.patch @@ -1,13 +1,15 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 11 Sep 2018 14:20:37 -0400 -Subject: [PATCH] Add a "version" command. +Subject: [PATCH] Add a "version" command -This adds a command that shows you info about grub's version, the grub target -platform, the compiler version, and if you built with +This adds a command that shows you info about grub's version, the grub +target platform, the compiler version, and if you built with --with-rpm-version=, the rpm package version. Signed-off-by: Peter Jones +[rharwood: don't say GNU, commit message cleanup] +Signed-off-by: Robbie Harwood --- configure.ac | 13 ++++++++++ grub-core/Makefile.core.def | 5 ++++ @@ -17,7 +19,7 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index f42be6533..2af5f23ad 100644 +index f42be65332..2af5f23adf 100644 --- a/configure.ac +++ b/configure.ac @@ -285,6 +285,19 @@ AC_SUBST(target_cpu) @@ -41,7 +43,7 @@ index f42be6533..2af5f23ad 100644 have_with_bootdir=n AC_ARG_WITH([bootdir], diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 84a3d89de..498ca1176 100644 +index 84a3d89de9..498ca11762 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -579,6 +579,11 @@ image = { @@ -58,7 +60,7 @@ index 84a3d89de..498ca1176 100644 common = lib/disk.c; diff --git a/grub-core/commands/version.c b/grub-core/commands/version.c new file mode 100644 -index 000000000..f0966a518 +index 0000000000..de0acb07ba --- /dev/null +++ b/grub-core/commands/version.c @@ -0,0 +1,56 @@ @@ -97,7 +99,7 @@ index 000000000..f0966a518 + if (argc != 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no arguments expected")); + -+ grub_printf (_("GNU GRUB version %s\n"), PACKAGE_VERSION); ++ grub_printf (_("GRUB version %s\n"), PACKAGE_VERSION); + grub_printf (_("Platform %s-%s\n"), GRUB_TARGET_CPU, GRUB_PLATFORM); + if (grub_strlen(GRUB_RPM_VERSION) != 0) + grub_printf (_("RPM package version %s\n"), GRUB_RPM_VERSION); @@ -119,7 +121,7 @@ index 000000000..f0966a518 + grub_unregister_command (cmd); +} diff --git a/config.h.in b/config.h.in -index 9e8f9911b..c7e316f0f 100644 +index 9e8f9911b1..c7e316f0f1 100644 --- a/config.h.in +++ b/config.h.in @@ -59,6 +59,7 @@ diff --git a/0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch index 32834958..72c8d304 100644 --- a/0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +++ b/0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 4 files changed, 10 insertions(+) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 032011566..7cdffe3eb 100644 +index 0320115662..7cdffe3ebd 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter) @@ -33,7 +33,7 @@ index 032011566..7cdffe3eb 100644 if (!pv->disk) return grub_errno; diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index f077b5f55..fe8ba6e6c 100644 +index f077b5f553..fe8ba6e6c9 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -855,6 +855,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) @@ -45,7 +45,7 @@ index f077b5f55..fe8ba6e6c 100644 grub_free (dup_dp); diff --git a/grub-core/kern/device.c b/grub-core/kern/device.c -index 73b8ecc0c..f58b58c89 100644 +index 73b8ecc0c0..f58b58c89d 100644 --- a/grub-core/kern/device.c +++ b/grub-core/kern/device.c @@ -34,6 +34,7 @@ grub_device_open (const char *name) @@ -57,7 +57,7 @@ index 73b8ecc0c..f58b58c89 100644 { name = grub_env_get ("root"); diff --git a/grub-core/script/script.c b/grub-core/script/script.c -index ec4d4337c..844e8343c 100644 +index ec4d4337c6..844e8343ca 100644 --- a/grub-core/script/script.c +++ b/grub-core/script/script.c @@ -22,6 +22,11 @@ diff --git a/0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch index 54e336c9..57d937cd 100644 --- a/0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch +++ b/0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch @@ -71,7 +71,7 @@ Signed-off-by: Peter Jones 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index f6aef0ef6..85ad4b449 100644 +index f6aef0ef64..85ad4b4494 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, @@ -146,7 +146,7 @@ index f6aef0ef6..85ad4b449 100644 grub_free(memory_map); diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 04994d5c6..70a0075ec 100644 +index 04994d5c67..70a0075ec5 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -71,20 +71,25 @@ finalize_params_linux (void) diff --git a/0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch index 83fc6108..4f42ea54 100644 --- a/0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch +++ b/0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch @@ -38,7 +38,7 @@ Signed-off-by: Robbie Harwood 8 files changed, 29 insertions(+), 12 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 85ad4b449..e84961d07 100644 +index 85ad4b4494..e84961d078 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, @@ -72,7 +72,7 @@ index 85ad4b449..e84961d07 100644 #endif diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3017d0f3e..33e981e76 100644 +index 3017d0f3e5..33e981e76e 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -27,6 +27,7 @@ @@ -138,7 +138,7 @@ index 3017d0f3e..33e981e76 100644 { grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel")); diff --git a/include/grub/arm/efi/memory.h b/include/grub/arm/efi/memory.h -index 2c64918e3..a4c2ec835 100644 +index 2c64918e3f..a4c2ec8350 100644 --- a/include/grub/arm/efi/memory.h +++ b/include/grub/arm/efi/memory.h @@ -2,5 +2,6 @@ @@ -149,7 +149,7 @@ index 2c64918e3..a4c2ec835 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/arm64/efi/memory.h b/include/grub/arm64/efi/memory.h -index c6cb32417..acb61dca4 100644 +index c6cb324171..acb61dca44 100644 --- a/include/grub/arm64/efi/memory.h +++ b/include/grub/arm64/efi/memory.h @@ -2,5 +2,6 @@ @@ -160,7 +160,7 @@ index c6cb32417..acb61dca4 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/i386/efi/memory.h b/include/grub/i386/efi/memory.h -index 2c64918e3..a4c2ec835 100644 +index 2c64918e3f..a4c2ec8350 100644 --- a/include/grub/i386/efi/memory.h +++ b/include/grub/i386/efi/memory.h @@ -2,5 +2,6 @@ @@ -171,7 +171,7 @@ index 2c64918e3..a4c2ec835 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/ia64/efi/memory.h b/include/grub/ia64/efi/memory.h -index 2c64918e3..a4c2ec835 100644 +index 2c64918e3f..a4c2ec8350 100644 --- a/include/grub/ia64/efi/memory.h +++ b/include/grub/ia64/efi/memory.h @@ -2,5 +2,6 @@ @@ -182,7 +182,7 @@ index 2c64918e3..a4c2ec835 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/riscv64/efi/memory.h b/include/grub/riscv64/efi/memory.h -index c6cb32417..acb61dca4 100644 +index c6cb324171..acb61dca44 100644 --- a/include/grub/riscv64/efi/memory.h +++ b/include/grub/riscv64/efi/memory.h @@ -2,5 +2,6 @@ @@ -193,7 +193,7 @@ index c6cb32417..acb61dca4 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h -index 46e9145a3..e81cfb322 100644 +index 46e9145a30..e81cfb3221 100644 --- a/include/grub/x86_64/efi/memory.h +++ b/include/grub/x86_64/efi/memory.h @@ -2,9 +2,11 @@ diff --git a/0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index f060b0f6..3ebf4b3e 100644 --- a/0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -19,7 +19,7 @@ Signed-off-by: Peter Jones 11 files changed, 18 insertions(+), 17 deletions(-) diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index eeea09275..f08a1bb84 100644 +index eeea092752..f08a1bb841 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -189,7 +189,7 @@ grub_util_get_image_size (const char *path) @@ -32,7 +32,7 @@ index eeea09275..f08a1bb84 100644 ret = (size_t) sz; diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c -index 467305b46..79037c093 100644 +index 467305b46a..79037c093f 100644 --- a/grub-core/lib/reed_solomon.c +++ b/grub-core/lib/reed_solomon.c @@ -157,7 +157,7 @@ static void @@ -54,7 +54,7 @@ index 467305b46..79037c093 100644 { grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE; diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c -index c77d6085c..42a315031 100644 +index c77d6085cc..42a315031f 100644 --- a/grub-core/osdep/linux/blocklist.c +++ b/grub-core/osdep/linux/blocklist.c @@ -109,7 +109,7 @@ grub_install_get_blocklist (grub_device_t root_dev, @@ -67,7 +67,7 @@ index c77d6085c..42a315031 100644 + fie1.fm_mapped_extents * sizeof (fie1.fm_extents[1])); diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 28790307e..9f730b351 100644 +index 28790307e0..9f730b3518 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -236,7 +236,7 @@ grub_find_root_devices_from_btrfs (const char *dir) @@ -80,7 +80,7 @@ index 28790307e..9f730b351 100644 fd = open (dir, 0); diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c -index da62f924e..7bc99ac1c 100644 +index da62f924e3..7bc99ac1c1 100644 --- a/grub-core/osdep/linux/hostdisk.c +++ b/grub-core/osdep/linux/hostdisk.c @@ -83,7 +83,7 @@ grub_util_get_fd_size_os (grub_util_fd_t fd, const char *name, unsigned *log_sec @@ -93,7 +93,7 @@ index da62f924e..7bc99ac1c 100644 if (log_secsize) diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index 838656420..bfcef852d 100644 +index 8386564200..bfcef852d8 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -323,7 +323,7 @@ cmd_cmp (char *src, char *dest) @@ -106,7 +106,7 @@ index 838656420..bfcef852d 100644 fseek (ff, 0, SEEK_END); if (pre != ftell (ff)) diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c -index a39f86939..358d60421 100644 +index a39f869394..358d604210 100644 --- a/util/grub-menulst2cfg.c +++ b/util/grub-menulst2cfg.c @@ -34,7 +34,7 @@ main (int argc, char **argv) @@ -119,7 +119,7 @@ index a39f86939..358d60421 100644 grub_util_host_init (&argc, &argv); diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c -index 0fe45a610..3e09240b9 100644 +index 0fe45a6103..3e09240b99 100644 --- a/util/grub-mkfont.c +++ b/util/grub-mkfont.c @@ -138,7 +138,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, @@ -173,7 +173,7 @@ index 0fe45a610..3e09240b9 100644 add_pixel (&data, &mask, glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] & diff --git a/util/grub-probe.c b/util/grub-probe.c -index c08e46bbb..c6fac732b 100644 +index c08e46bbb4..c6fac732b4 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -798,7 +798,7 @@ argp_parser (int key, char *arg, struct argp_state *state) @@ -186,7 +186,7 @@ index c08e46bbb..c6fac732b 100644 for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) if (strcmp (arg, targets[i]) == 0) diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c -index f33bd1ed5..834594410 100644 +index f33bd1ed56..8345944105 100644 --- a/util/grub-rpm-sort.c +++ b/util/grub-rpm-sort.c @@ -232,7 +232,7 @@ main (int argc, char *argv[]) @@ -199,7 +199,7 @@ index f33bd1ed5..834594410 100644 grub_util_host_init (&argc, &argv); diff --git a/util/setup.c b/util/setup.c -index da5f2c07f..8b22bb8cc 100644 +index da5f2c07f5..8b22bb8cca 100644 --- a/util/setup.c +++ b/util/setup.c @@ -406,7 +406,7 @@ SETUP (const char *dir, diff --git a/0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index bbcefd23..6e18f66d 100644 --- a/0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index 2af5f23ad..091ab3283 100644 +index 2af5f23adf..091ab32836 100644 --- a/configure.ac +++ b/configure.ac @@ -1453,11 +1453,11 @@ fi @@ -45,7 +45,7 @@ index 2af5f23ad..091ab3283 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index 2ff9b3935..35e14ff01 100644 +index 2ff9b39357..35e14ff017 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d diff --git a/0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch index 15f7e2cf..5a9c6f24 100644 --- a/0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +++ b/0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 33e981e76..2f0336809 100644 +index 33e981e76e..2f0336809e 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -35,11 +35,16 @@ static grub_dl_t my_mod; diff --git a/0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch index 56c524ca..9b10d688 100644 --- a/0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +++ b/0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 2f0336809..5f48fa556 100644 +index 2f0336809e..5f48fa5561 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -243,32 +243,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), diff --git a/0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch index bba44ec4..700c98b3 100644 --- a/0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +++ b/0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 1 file changed, 94 insertions(+), 73 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 5f48fa556..3e4f7ef39 100644 +index 5f48fa5561..3e4f7ef39f 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -47,6 +47,65 @@ static char *linux_cmdline; diff --git a/0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch index e30c4373..6ac11a1c 100644 --- a/0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +++ b/0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3e4f7ef39..6bc18d5ae 100644 +index 3e4f7ef39f..6bc18d5aef 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -52,13 +52,22 @@ struct allocation_choice { @@ -153,7 +153,7 @@ index 3e4f7ef39..6bc18d5ae 100644 grub_memcpy (kernel_mem, (char *)kernel + start, filelen - start); diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index 25ef52c04..fac22476c 100644 +index 25ef52c04e..fac22476cc 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -236,7 +236,11 @@ struct linux_kernel_params diff --git a/0107-Fix-getroot.c-s-trampolines.patch b/0107-Fix-getroot.c-s-trampolines.patch index dbf875cb..e744b779 100644 --- a/0107-Fix-getroot.c-s-trampolines.patch +++ b/0107-Fix-getroot.c-s-trampolines.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 9f730b351..f0c503f43 100644 +index 9f730b3518..f0c503f43d 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -1264,22 +1264,20 @@ grub_util_get_grub_dev_os (const char *os_dev) diff --git a/0108-Do-not-allow-stack-trampolines-anywhere.patch b/0108-Do-not-allow-stack-trampolines-anywhere.patch index b05a36ea..08995fcc 100644 --- a/0108-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0108-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 091ab3283..de707f7e0 100644 +index 091ab32836..de707f7e0b 100644 --- a/configure.ac +++ b/configure.ac @@ -2028,6 +2028,9 @@ if test x"$enable_wextra" != xno ; then @@ -24,7 +24,7 @@ index 091ab3283..de707f7e0 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index 35e14ff01..0647c53b9 100644 +index 35e14ff017..0647c53b91 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d diff --git a/0109-Reimplement-boot_counter.patch b/0109-Reimplement-boot_counter.patch index b884f817..22bd4ef6 100644 --- a/0109-Reimplement-boot_counter.patch +++ b/0109-Reimplement-boot_counter.patch @@ -23,7 +23,7 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index 0b85a7fce..27a13bc73 100644 +index 0b85a7fce4..27a13bc734 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { @@ -40,7 +40,7 @@ index 0b85a7fce..27a13bc73 100644 name = '01_menu_auto_hide'; common = util/grub.d/01_menu_auto_hide.in; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 498ca1176..1e1534510 100644 +index 498ca11762..1e15345107 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -398,6 +398,11 @@ kernel = { @@ -57,7 +57,7 @@ index 498ca1176..1e1534510 100644 mansection = 1; diff --git a/grub-core/commands/increment.c b/grub-core/commands/increment.c new file mode 100644 -index 000000000..79cf13765 +index 0000000000..79cf137656 --- /dev/null +++ b/grub-core/commands/increment.c @@ -0,0 +1,105 @@ @@ -168,7 +168,7 @@ index 000000000..79cf13765 +} diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in new file mode 100644 -index 000000000..be0e770ea +index 0000000000..be0e770ea8 --- /dev/null +++ b/util/grub.d/01_fallback_counting.in @@ -0,0 +1,22 @@ diff --git a/0110-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0110-Fix-menu-entry-selection-based-on-ID-and-title.patch index cd9e50f5..af749012 100644 --- a/0110-Fix-menu-entry-selection-based-on-ID-and-title.patch +++ b/0110-Fix-menu-entry-selection-based-on-ID-and-title.patch @@ -24,7 +24,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d7a222e68..4a02aadb0 100644 +index d7a222e681..4a02aadb01 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -164,12 +164,12 @@ grub_menu_set_timeout (int timeout) diff --git a/0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch index c2fbe655..68779ebf 100644 --- a/0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch +++ b/0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch @@ -23,7 +23,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index b194123eb..b175a1b43 100644 +index b194123eb6..b175a1b43b 100644 --- a/grub-core/commands/menuentry.c +++ b/grub-core/commands/menuentry.c @@ -29,7 +29,7 @@ static const struct grub_arg_option options[] = diff --git a/0112-Add-efi-export-env-and-efi-load-env-commands.patch b/0112-Add-efi-export-env-and-efi-load-env-commands.patch index abff17cb..ac028764 100644 --- a/0112-Add-efi-export-env-and-efi-load-env-commands.patch +++ b/0112-Add-efi-export-env-and-efi-load-env-commands.patch @@ -21,7 +21,7 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/efi/env.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 1e1534510..81fc27414 100644 +index 1e15345107..81fc274148 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -820,6 +820,12 @@ module = { @@ -39,7 +39,7 @@ index 1e1534510..81fc27414 100644 efi = commands/efi/efifwsetup.c; diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c new file mode 100644 -index 000000000..cbd13e03e +index 0000000000..cbd13e03e8 --- /dev/null +++ b/grub-core/commands/efi/env.c @@ -0,0 +1,168 @@ @@ -212,7 +212,7 @@ index 000000000..cbd13e03e + grub_unregister_command (loadenv_cmd); +} diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 2a446f503..14bc10eb5 100644 +index 2a446f5031..14bc10eb56 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -225,6 +225,9 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid, @@ -226,7 +226,7 @@ index 2a446f503..14bc10eb5 100644 } diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 2d12e6188..0574d8d62 100644 +index 2d12e6188f..0574d8d621 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -85,11 +85,6 @@ stack_protector_init (void) @@ -242,7 +242,7 @@ index 2d12e6188..0574d8d62 100644 static int set_var (const char *name, const char *value, diff --git a/grub-core/lib/envblk.c b/grub-core/lib/envblk.c -index 2e4e78b13..874506da1 100644 +index 2e4e78b132..874506da16 100644 --- a/grub-core/lib/envblk.c +++ b/grub-core/lib/envblk.c @@ -223,6 +223,49 @@ grub_envblk_delete (grub_envblk_t envblk, const char *name) @@ -296,7 +296,7 @@ index 2e4e78b13..874506da1 100644 grub_envblk_iterate (grub_envblk_t envblk, void *hook_data, diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index d506f7e75..a6ccc1138 100644 +index d506f7e75b..a6ccc11383 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -25,6 +25,7 @@ @@ -308,7 +308,7 @@ index d506f7e75..a6ccc1138 100644 #include #include diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 2e0691454..8dfc89a33 100644 +index 2e0691454b..8dfc89a33b 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -24,6 +24,11 @@ @@ -324,7 +324,7 @@ index 2e0691454..8dfc89a33 100644 extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table); extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle); diff --git a/include/grub/lib/envblk.h b/include/grub/lib/envblk.h -index c3e655921..ab969af24 100644 +index c3e6559217..ab969af246 100644 --- a/include/grub/lib/envblk.h +++ b/include/grub/lib/envblk.h @@ -22,6 +22,8 @@ diff --git a/0113-Make-it-possible-to-subtract-conditions-from-debug.patch b/0113-Make-it-possible-to-subtract-conditions-from-debug.patch index 53e28fd8..15305f85 100644 --- a/0113-Make-it-possible-to-subtract-conditions-from-debug.patch +++ b/0113-Make-it-possible-to-subtract-conditions-from-debug.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 9a2fae639..578bf51a5 100644 +index 9a2fae6398..578bf51a5f 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -164,12 +164,24 @@ int diff --git a/0114-Export-all-variables-from-the-initial-context-when-c.patch b/0114-Export-all-variables-from-the-initial-context-when-c.patch index 554884bf..214fa4f3 100644 --- a/0114-Export-all-variables-from-the-initial-context-when-c.patch +++ b/0114-Export-all-variables-from-the-initial-context-when-c.patch @@ -17,7 +17,7 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/grub-core/normal/context.c b/grub-core/normal/context.c -index ee53d4a68..87edd254c 100644 +index ee53d4a68e..87edd254c4 100644 --- a/grub-core/normal/context.c +++ b/grub-core/normal/context.c @@ -99,7 +99,7 @@ grub_env_new_context (int export_all) @@ -30,7 +30,7 @@ index ee53d4a68..87edd254c 100644 int grub_extractor_level = 0; diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 4a02aadb0..fe2e77a43 100644 +index 4a02aadb01..fe2e77a43e 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -375,8 +375,6 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) diff --git a/0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index ad2e25fd..0abe8ede 100644 --- a/0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -21,7 +21,7 @@ Signed-off-by: Robbie Harwood rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index 27a13bc73..2e6ad979c 100644 +index 27a13bc734..2e6ad979c3 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -459,14 +459,14 @@ script = { @@ -60,7 +60,7 @@ diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/08_fallback_count similarity index 65% rename from util/grub.d/01_fallback_counting.in rename to util/grub.d/08_fallback_counting.in -index be0e770ea..2e2c3ff7d 100644 +index be0e770ea8..2e2c3ff7d3 100644 --- a/util/grub.d/01_fallback_counting.in +++ b/util/grub.d/08_fallback_counting.in @@ -1,15 +1,17 @@ @@ -89,7 +89,7 @@ index be0e770ea..2e2c3ff7d 100644 set boot_counter=-1 diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in new file mode 100644 -index 000000000..6c88d933d +index 0000000000..6c88d933dd --- /dev/null +++ b/util/grub.d/10_reset_boot_success.in @@ -0,0 +1,25 @@ @@ -122,7 +122,7 @@ diff --git a/util/grub.d/01_menu_auto_hide.in b/util/grub.d/12_menu_auto_hide.in similarity index 58% rename from util/grub.d/01_menu_auto_hide.in rename to util/grub.d/12_menu_auto_hide.in -index ad175870a..6a7c0fa0d 100644 +index ad175870a5..6a7c0fa0d4 100644 --- a/util/grub.d/01_menu_auto_hide.in +++ b/util/grub.d/12_menu_auto_hide.in @@ -1,5 +1,8 @@ diff --git a/0116-Fix-systemctl-kexec-exit-status-check.patch b/0116-Fix-systemctl-kexec-exit-status-check.patch index e10d6499..567e6786 100644 --- a/0116-Fix-systemctl-kexec-exit-status-check.patch +++ b/0116-Fix-systemctl-kexec-exit-status-check.patch @@ -19,7 +19,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -index fda9e00d2..5b85b225e 100644 +index fda9e00d24..5b85b225ee 100644 --- a/grub-core/loader/emu/linux.c +++ b/grub-core/loader/emu/linux.c @@ -71,8 +71,10 @@ grub_linux_boot (void) diff --git a/0117-Print-grub-emu-linux-loader-messages-as-debug.patch b/0117-Print-grub-emu-linux-loader-messages-as-debug.patch index 5afe5113..2718a70b 100644 --- a/0117-Print-grub-emu-linux-loader-messages-as-debug.patch +++ b/0117-Print-grub-emu-linux-loader-messages-as-debug.patch @@ -11,7 +11,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -index 5b85b225e..22ab6af17 100644 +index 5b85b225ee..22ab6af172 100644 --- a/grub-core/loader/emu/linux.c +++ b/grub-core/loader/emu/linux.c @@ -50,7 +50,7 @@ grub_linux_boot (void) diff --git a/0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch index 96e56cfb..df365176 100644 --- a/0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch +++ b/0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch @@ -17,7 +17,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index fe2e77a43..ec0c92bad 100644 +index fe2e77a43e..ec0c92bade 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -285,7 +285,7 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) diff --git a/0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch index 16829c7d..9ffb3aec 100644 --- a/0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch +++ b/0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch @@ -13,7 +13,7 @@ Signed-off-by: Hans de Goede 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index a6ccc1138..3eb04beb5 100644 +index a6ccc11383..3eb04beb5e 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -18,7 +18,7 @@ diff --git a/0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch index bb611f63..11722d17 100644 --- a/0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +++ b/0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch @@ -13,7 +13,7 @@ Signed-off-by: Hans de Goede 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index 3eb04beb5..3b4c25ca2 100644 +index 3eb04beb5e..3b4c25ca2a 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -28,7 +28,9 @@ diff --git a/0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch index ff129c6f..948ff737 100644 --- a/0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +++ b/0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch @@ -53,7 +53,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in -index 6c88d933d..e73f4137b 100644 +index 6c88d933dd..e73f4137b3 100644 --- a/util/grub.d/10_reset_boot_success.in +++ b/util/grub.d/10_reset_boot_success.in @@ -6,18 +6,18 @@ diff --git a/0122-Add-start-symbol-for-RISC-V.patch b/0122-Add-start-symbol-for-RISC-V.patch index cc8aa6f4..2746fa25 100644 --- a/0122-Add-start-symbol-for-RISC-V.patch +++ b/0122-Add-start-symbol-for-RISC-V.patch @@ -15,7 +15,7 @@ Signed-off-by: David Abdurachmanov 1 file changed, 1 insertion(+) diff --git a/grub-core/kern/riscv/efi/startup.S b/grub-core/kern/riscv/efi/startup.S -index f2a7b2b1e..781773136 100644 +index f2a7b2b1ed..781773136e 100644 --- a/grub-core/kern/riscv/efi/startup.S +++ b/grub-core/kern/riscv/efi/startup.S @@ -29,6 +29,7 @@ diff --git a/0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch index 873ce0cc..8bfc964c 100644 --- a/0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +++ b/0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch @@ -19,7 +19,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf -index 6b043fc35..52d4af44b 100644 +index 6b043fc354..52d4af44be 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -92,7 +92,7 @@ bootstrap_post_import_hook () { diff --git a/0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch index 5f9b8a81..f745782b 100644 --- a/0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch +++ b/0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch @@ -25,7 +25,7 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 2 insertions(+) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 1c540fc8c..b573be665 100644 +index 1c540fc8c2..b573be6650 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -143,6 +143,7 @@ grub_set_prefix_and_root (void) @@ -37,7 +37,7 @@ index 1c540fc8c..b573be665 100644 grub_free (fw_path); } diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index de351b2cd..755b7a6d0 100644 +index de351b2cd0..755b7a6d05 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -39,6 +39,7 @@ http_configure (struct grub_efi_net_device *dev, int prefer_ip6) diff --git a/0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch index 69764f09..03d85c2c 100644 --- a/0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +++ b/0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch @@ -43,7 +43,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 755b7a6d0..fc8cb25ae 100644 +index 755b7a6d05..fc8cb25ae0 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -158,13 +158,7 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, diff --git a/0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch index 94268422..8fe26cd2 100644 --- a/0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +++ b/0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch @@ -25,7 +25,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 6603cd83e..84573937b 100644 +index 6603cd83ed..84573937b1 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -742,7 +742,7 @@ grub_efi_net_parse_address (const char *address, diff --git a/0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch index 807bda4d..2dc70010 100644 --- a/0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +++ b/0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch @@ -21,7 +21,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index b711a5d94..313c818b1 100644 +index b711a5d945..313c818b18 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -56,9 +56,20 @@ int diff --git a/0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch index 0f5ff978..da94e081 100644 --- a/0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch +++ b/0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch @@ -22,7 +22,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 84573937b..a3f0535d4 100644 +index 84573937b1..a3f0535d43 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -778,9 +778,9 @@ grub_efi_net_parse_address (const char *address, diff --git a/0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch index b8f4eeb2..8793b0df 100644 --- a/0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +++ b/0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch @@ -12,7 +12,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c -index 14d596498..4d61f4e97 100644 +index 14d5964983..4d61f4e979 100644 --- a/grub-core/kern/term.c +++ b/grub-core/kern/term.c @@ -144,9 +144,10 @@ grub_key_is_interrupt (int key) diff --git a/0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch index c3d2b9b4..6aa50136 100644 --- a/0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +++ b/0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch @@ -29,7 +29,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 14 insertions(+) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 0622dfa48..e8b9ecb17 100644 +index 0622dfa48d..e8b9ecb17f 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -72,6 +72,7 @@ grub_err_t diff --git a/0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch index 35a5a6ab..d1c7b176 100644 --- a/0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +++ b/0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch @@ -18,7 +18,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/grub-core/commands/tpm.c b/grub-core/commands/tpm.c -index 2052c36ea..e287d042e 100644 +index 2052c36eab..e287d042e6 100644 --- a/grub-core/commands/tpm.c +++ b/grub-core/commands/tpm.c @@ -42,7 +42,8 @@ grub_tpm_verify_init (grub_file_t io, diff --git a/0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch index 420bc23b..7c41e87e 100644 --- a/0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +++ b/0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 6bc18d5ae..15d40d6e3 100644 +index 6bc18d5aef..15d40d6e35 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -144,7 +144,7 @@ grub_linuxefi_unload (void) diff --git a/0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch index e62feb06..7fef93eb 100644 --- a/0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +++ b/0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index b52b558d6..7f878b561 100644 +index b52b558d63..7f878b5615 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -501,13 +501,20 @@ http_open (struct grub_file *file, const char *filename) diff --git a/0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch index 956208a4..f3b10c14 100644 --- a/0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +++ b/0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c -index cbd13e03e..977edb6b0 100644 +index cbd13e03e8..977edb6b06 100644 --- a/grub-core/commands/efi/env.c +++ b/grub-core/commands/efi/env.c @@ -149,6 +149,8 @@ grub_efi_load_env(grub_command_t cmd __attribute__ ((unused)), diff --git a/0135-efi-dhcp-fix-some-allocation-error-checking.patch b/0135-efi-dhcp-fix-some-allocation-error-checking.patch index b705d12d..90e7a34d 100644 --- a/0135-efi-dhcp-fix-some-allocation-error-checking.patch +++ b/0135-efi-dhcp-fix-some-allocation-error-checking.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c -index dbef63d8c..e5c79b748 100644 +index dbef63d8c0..e5c79b748b 100644 --- a/grub-core/net/efi/dhcp.c +++ b/grub-core/net/efi/dhcp.c @@ -80,7 +80,7 @@ grub_efi_dhcp4_parse_dns (grub_efi_dhcp4_protocol_t *dhcp4, grub_efi_dhcp4_packe diff --git a/0136-efi-http-fix-some-allocation-error-checking.patch b/0136-efi-http-fix-some-allocation-error-checking.patch index 6aa40dde..149ada89 100644 --- a/0136-efi-http-fix-some-allocation-error-checking.patch +++ b/0136-efi-http-fix-some-allocation-error-checking.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index fc8cb25ae..26647a50f 100644 +index fc8cb25ae0..26647a50fa 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -412,8 +412,8 @@ grub_efihttp_open (struct grub_efi_net_device *dev, diff --git a/0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch index b40c4c26..6413eb6d 100644 --- a/0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +++ b/0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index 313c818b1..9725e928f 100644 +index 313c818b18..9725e928f7 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -4,15 +4,20 @@ @@ -82,7 +82,7 @@ index 313c818b1..9725e928f 100644 char *subnet, *gateway, *mask; grub_uint32_t u32_subnet, u32_gateway; diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c -index 017c4d05b..a46f6f9b6 100644 +index 017c4d05bc..a46f6f9b68 100644 --- a/grub-core/net/efi/ip6_config.c +++ b/grub-core/net/efi/ip6_config.c @@ -3,6 +3,7 @@ diff --git a/0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch index e1db5339..8e63d1d9 100644 --- a/0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +++ b/0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch @@ -13,7 +13,7 @@ Signed-off-by: Colin Watson 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 15d40d6e3..f992ceeef 100644 +index 15d40d6e35..f992ceeef2 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -28,6 +28,8 @@ diff --git a/0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch index 2b5f6026..828fe16a 100644 --- a/0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch +++ b/0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch @@ -23,7 +23,7 @@ Signed-off-by: Dimitri John Ledkov 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 70a0075ec..47f8cf0d8 100644 +index 70a0075ec5..47f8cf0d84 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -34,6 +34,7 @@ @@ -55,7 +55,7 @@ index 70a0075ec..47f8cf0d8 100644 pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index ac8dfd40c..d41e8ea14 100644 +index ac8dfd40c6..d41e8ea14a 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -1084,6 +1084,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), @@ -67,7 +67,7 @@ index ac8dfd40c..d41e8ea14 100644 fail: if (dev) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index e8b9ecb17..9260731c1 100644 +index e8b9ecb17f..9260731c10 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -33,6 +33,7 @@ struct grub_efi_shim_lock @@ -79,7 +79,7 @@ index e8b9ecb17..9260731c1 100644 grub_linuxefi_secure_validate (void *data, grub_uint32_t size) { diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index f992ceeef..3cf0f9b33 100644 +index f992ceeef2..3cf0f9b330 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -30,6 +30,7 @@ diff --git a/0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch index b99d5e08..f20f5c79 100644 --- a/0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +++ b/0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 8fb8918ae..7baf3540c 100644 +index 8fb8918ae7..7baf3540c8 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -329,7 +329,7 @@ grub_net_configure_by_dhcp_ack (const char *name, diff --git a/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch index 346beb32..ea92110b 100644 --- a/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +++ b/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index 9725e928f..cb880fc3e 100644 +index 9725e928f7..cb880fc3e8 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -61,7 +61,8 @@ int diff --git a/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch index e8e411b7..915e6d72 100644 --- a/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +++ b/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c -index a46f6f9b6..1c5415d71 100644 +index a46f6f9b68..1c5415d718 100644 --- a/grub-core/net/efi/ip6_config.c +++ b/grub-core/net/efi/ip6_config.c @@ -85,7 +85,7 @@ grub_efi_string_to_ip6_address (const char *val, grub_efi_ipv6_address_t *addres diff --git a/0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch index fa350023..fbba65a7 100644 --- a/0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +++ b/0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index a3f0535d4..78e5442fc 100644 +index a3f0535d43..78e5442fc5 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -729,7 +729,7 @@ grub_efi_net_parse_address (const char *address, diff --git a/0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch index 8b55d80e..9b9acfea 100644 --- a/0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +++ b/0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c -index 531949cba..73e2bb01c 100644 +index 531949cba5..73e2bb01c1 100644 --- a/grub-core/net/efi/pxe.c +++ b/grub-core/net/efi/pxe.c @@ -187,7 +187,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) diff --git a/0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch index bef2e7d2..9e0fc884 100644 --- a/0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch +++ b/0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -65,7 +65,7 @@ Signed-off-by: Hans de Goede create mode 100644 util/systemd/systemd-integration.sh.in diff --git a/Makefile.util.def b/Makefile.util.def -index 2e6ad979c..9927c2cfd 100644 +index 2e6ad979c3..9927c2cfd6 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -470,6 +470,12 @@ script = { @@ -110,7 +110,7 @@ index 2e6ad979c..9927c2cfd 100644 mansection = 1; name = grub-mkrescue; diff --git a/conf/Makefile.common b/conf/Makefile.common -index 0647c53b9..9fe5863b2 100644 +index 0647c53b91..9fe5863b2d 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -63,8 +63,11 @@ CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS) @@ -137,7 +137,7 @@ index 0647c53b9..9fe5863b2 100644 EXTRA_DIST = diff --git a/util/grub.d/14_menu_show_once.in b/util/grub.d/14_menu_show_once.in new file mode 100755 -index 000000000..1cd7f3614 +index 0000000000..1cd7f36142 --- /dev/null +++ b/util/grub.d/14_menu_show_once.in @@ -0,0 +1,13 @@ @@ -156,7 +156,7 @@ index 000000000..1cd7f3614 +EOF diff --git a/util/systemd/10-grub-logind-service.conf.in b/util/systemd/10-grub-logind-service.conf.in new file mode 100644 -index 000000000..f2d4ac007 +index 0000000000..f2d4ac0073 --- /dev/null +++ b/util/systemd/10-grub-logind-service.conf.in @@ -0,0 +1,2 @@ @@ -164,7 +164,7 @@ index 000000000..f2d4ac007 +Environment=SYSTEMD_REBOOT_TO_BOOT_LOADER_MENU=true diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in new file mode 100644 -index 000000000..c81fb594c +index 0000000000..c81fb594ce --- /dev/null +++ b/util/systemd/grub-systemd-integration.service.in @@ -0,0 +1,8 @@ @@ -178,7 +178,7 @@ index 000000000..c81fb594c +ExecStart=@libexecdir@/@grubdirname@/systemd-integration.sh diff --git a/util/systemd/systemd-integration.sh.in b/util/systemd/systemd-integration.sh.in new file mode 100644 -index 000000000..dc1218597 +index 0000000000..dc1218597b --- /dev/null +++ b/util/systemd/systemd-integration.sh.in @@ -0,0 +1,6 @@ diff --git a/0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch index 77131a28..a16ed68e 100644 --- a/0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +++ b/0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch @@ -18,7 +18,7 @@ Signed-off-by: Hans de Goede 1 file changed, 5 insertions(+) diff --git a/util/systemd/systemd-integration.sh.in b/util/systemd/systemd-integration.sh.in -index dc1218597..a4c071c5b 100644 +index dc1218597b..a4c071c5b0 100644 --- a/util/systemd/systemd-integration.sh.in +++ b/util/systemd/systemd-integration.sh.in @@ -4,3 +4,8 @@ TIMEOUT_USEC=$(cat /run/systemd/reboot-to-boot-loader-menu) diff --git a/0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch index d16abcd8..f891a695 100644 --- a/0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +++ b/0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch @@ -29,7 +29,7 @@ Signed-off-by: Renaud Métrich 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index 597111077..260143826 100644 +index 597111077b..2601438260 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -135,20 +135,28 @@ query_mode (void) @@ -105,7 +105,7 @@ index 597111077..260143826 100644 } diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h -index bcb4d9ba7..9414dc1b9 100644 +index bcb4d9ba78..9414dc1b99 100644 --- a/include/grub/at_keyboard.h +++ b/include/grub/at_keyboard.h @@ -19,6 +19,10 @@ diff --git a/0148-grub-install-disable-support-for-EFI-platforms.patch b/0148-grub-install-disable-support-for-EFI-platforms.patch index 34d04d52..f6a75304 100644 --- a/0148-grub-install-disable-support-for-EFI-platforms.patch +++ b/0148-grub-install-disable-support-for-EFI-platforms.patch @@ -26,7 +26,7 @@ Signed-off-by: Jan Hlavac 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index a2bec7446..5babc7af5 100644 +index a2bec7446c..5babc7af55 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -899,6 +899,22 @@ main (int argc, char *argv[]) @@ -82,7 +82,7 @@ index a2bec7446..5babc7af5 100644 { grub_fs_t fs; diff --git a/docs/grub.texi b/docs/grub.texi -index 04ed6ac1f..4870faaa0 100644 +index 04ed6ac1f0..4870faaa00 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -6509,6 +6509,13 @@ grub2-install @var{install_device} diff --git a/0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch index d0a1f680..c32be3c1 100644 --- a/0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,7 +15,7 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index de707f7e0..f069d8403 100644 +index de707f7e0b..f069d84039 100644 --- a/configure.ac +++ b/configure.ac @@ -1586,6 +1586,17 @@ else @@ -58,7 +58,7 @@ index de707f7e0..f069d8403 100644 echo efiemu runtime: Yes else diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 578bf51a5..9f54b6b7d 100644 +index 578bf51a5f..9f54b6b7d2 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -25,6 +25,9 @@ @@ -99,7 +99,7 @@ index 578bf51a5..9f54b6b7d 100644 va_start (args, fmt); grub_vprintf (fmt, args); diff --git a/config.h.in b/config.h.in -index c7e316f0f..c80e3e0ab 100644 +index c7e316f0f1..c80e3e0aba 100644 --- a/config.h.in +++ b/config.h.in @@ -12,6 +12,7 @@ diff --git a/0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch index 71fa73ab..d26027c7 100644 --- a/0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +++ b/0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch @@ -13,7 +13,7 @@ Signed-off-by: Renaud Métrich 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c -index e1b0e073e..05a28ab14 100644 +index e1b0e073e0..05a28ab142 100644 --- a/grub-core/kern/disk.c +++ b/grub-core/kern/disk.c @@ -285,6 +285,8 @@ grub_disk_open (const char *name) diff --git a/0151-Introduce-function-grub_debug_is_enabled-void-return.patch b/0151-Introduce-function-grub_debug_is_enabled-void-return.patch index ef33974f..9ce5d9df 100644 --- a/0151-Introduce-function-grub_debug_is_enabled-void-return.patch +++ b/0151-Introduce-function-grub_debug_is_enabled-void-return.patch @@ -14,7 +14,7 @@ Signed-off-by: Renaud Métrich 2 files changed, 14 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 9f54b6b7d..a186ad3dd 100644 +index 9f54b6b7d2..a186ad3dd4 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -163,6 +163,19 @@ int grub_err_printf (const char *fmt, ...) @@ -38,7 +38,7 @@ index 9f54b6b7d..a186ad3dd 100644 grub_debug_enabled (const char * condition) { diff --git a/include/grub/misc.h b/include/grub/misc.h -index 3adc4036e..6c4aa85ac 100644 +index 3adc4036e3..6c4aa85ac5 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -340,6 +340,7 @@ grub_puts (const char *s) diff --git a/0152-Don-t-clear-screen-when-debugging-is-enabled.patch b/0152-Don-t-clear-screen-when-debugging-is-enabled.patch index ee987e72..c35d8a3c 100644 --- a/0152-Don-t-clear-screen-when-debugging-is-enabled.patch +++ b/0152-Don-t-clear-screen-when-debugging-is-enabled.patch @@ -14,7 +14,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 1970e4816..4ebdbd228 100644 +index af9792c963..7de9e4c36d 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -215,8 +215,9 @@ grub_normal_init_page (struct grub_term_output *term, @@ -27,5 +27,5 @@ index 1970e4816..4ebdbd228 100644 + if (! grub_debug_is_enabled ()) + grub_term_cls (term); - msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); + msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION); if (!msg_formatted) diff --git a/0153-grub_file_-instrumentation-new-file-debug-tag.patch b/0153-grub_file_-instrumentation-new-file-debug-tag.patch index da9c4ab4..908e1ff6 100644 --- a/0153-grub_file_-instrumentation-new-file-debug-tag.patch +++ b/0153-grub_file_-instrumentation-new-file-debug-tag.patch @@ -12,7 +12,7 @@ Signed-off-by: Renaud Métrich 1 file changed, 14 insertions(+) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index 58454458c..e19aea3e5 100644 +index 58454458c4..e19aea3e51 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -66,6 +66,8 @@ grub_file_open (const char *name, enum grub_file_type type) diff --git a/0154-ieee1275-Avoiding-many-unecessary-open-close.patch b/0154-ieee1275-Avoiding-many-unecessary-open-close.patch index 68b89ffc..f6c52441 100644 --- a/0154-ieee1275-Avoiding-many-unecessary-open-close.patch +++ b/0154-ieee1275-Avoiding-many-unecessary-open-close.patch @@ -9,7 +9,7 @@ Signed-off-by: Diego Domingos 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index 03674cb47..ea7f78ac7 100644 +index 03674cb477..ea7f78ac7d 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -44,7 +44,7 @@ struct ofdisk_hash_ent diff --git a/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch index 94f4eb7f..04c5c32e 100644 --- a/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +++ b/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch @@ -15,7 +15,7 @@ Signed-off-by: Diego Domingos 1 file changed, 49 insertions(+) diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index a6153d359..0f5d54e9f 100644 +index a6153d3595..0f5d54e9f2 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c @@ -350,6 +350,38 @@ of_path_of_ide(const char *sys_devname __attribute__((unused)), const char *devi diff --git a/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch index 8bb19345..85dbde77 100644 --- a/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch +++ b/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch @@ -17,7 +17,7 @@ Signed-off-by: Diego Domingos 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index 0f5d54e9f..cc849d9c9 100644 +index 0f5d54e9f2..cc849d9c94 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c @@ -37,6 +37,7 @@ diff --git a/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch index 7b8150a9..f938fd1a 100644 --- a/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +++ b/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch @@ -35,7 +35,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 96 insertions(+), 25 deletions(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index 260143826..dac0f946f 100644 +index 2601438260..dac0f946fe 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -31,6 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch index 9e42d64d..81660d4d 100644 --- a/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch +++ b/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -43,7 +43,7 @@ Signed-off-by: Rashmica Gupta 6 files changed, 80 insertions(+), 17 deletions(-) diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 4e212e690..a74fee16e 100644 +index 4e212e690c..a74fee16e2 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -461,10 +461,12 @@ static size_t npubkeys; @@ -99,7 +99,7 @@ index 4e212e690..a74fee16e 100644 while (dc--) grub_install_pop_module (); diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index c0d559937..8a5331054 100644 +index c0d5599370..8a53310548 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -84,6 +84,7 @@ static struct argp_option options[] = { @@ -153,7 +153,7 @@ index c0d559937..8a5331054 100644 if (grub_util_file_sync (fp) < 0) grub_util_error (_("cannot sync `%s': %s"), arguments.output ? : "stdout", diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index d78fa3e53..393119486 100644 +index d78fa3e533..393119486d 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -84,6 +84,15 @@ struct grub_ieee1275_note @@ -224,7 +224,7 @@ index d78fa3e53..393119486 100644 char *str_start = (elf_img + sizeof (*ehdr) + phnum * sizeof (*phdr) + shnum * sizeof (*shdr)); diff --git a/util/mkimage.c b/util/mkimage.c -index a26cf76f7..bab122760 100644 +index a26cf76f72..bab1227601 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -869,8 +869,9 @@ grub_install_generate_image (const char *dir, const char *prefix, @@ -256,7 +256,7 @@ index a26cf76f7..bab122760 100644 break; } diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index 7df3191f4..cf4531e02 100644 +index 7df3191f47..cf4531e02b 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -67,6 +67,9 @@ @@ -289,7 +289,7 @@ index 7df3191f4..cf4531e02 100644 const char *sbat_path, const int disable_shim_lock); diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h -index 3819a6744..6f1da89b9 100644 +index 3819a67441..6f1da89b9b 100644 --- a/include/grub/util/mkimage.h +++ b/include/grub/util/mkimage.h @@ -51,12 +51,12 @@ grub_mkimage_load_image64 (const char *kernel_path, diff --git a/0159-docs-grub-Document-signing-grub-under-UEFI.patch b/0159-docs-grub-Document-signing-grub-under-UEFI.patch index 328e5abd..f2b5c176 100644 --- a/0159-docs-grub-Document-signing-grub-under-UEFI.patch +++ b/0159-docs-grub-Document-signing-grub-under-UEFI.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 4870faaa0..365d1d693 100644 +index 4870faaa00..365d1d6931 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -5817,6 +5817,7 @@ environment variables and commands are listed in the same order. diff --git a/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch index 9e04af2b..ee3d6594 100644 --- a/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch +++ b/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 42 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 365d1d693..afbde7c1f 100644 +index 365d1d6931..afbde7c1f7 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -6087,6 +6087,48 @@ image works under UEFI secure boot and can maintain the secure-boot chain. It diff --git a/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch index 1d8012dd..b23ce49d 100644 --- a/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +++ b/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch @@ -16,7 +16,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 11 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index 2f76e6b04..20d870f2a 100644 +index 2f76e6b043..20d870f2a4 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -245,11 +245,22 @@ grub_dl_get (const char *name) diff --git a/0162-pgp-factor-out-rsa_pad.patch b/0162-pgp-factor-out-rsa_pad.patch index 1c566b21..f1e721db 100644 --- a/0162-pgp-factor-out-rsa_pad.patch +++ b/0162-pgp-factor-out-rsa_pad.patch @@ -27,7 +27,7 @@ Signed-off-by: Daniel Axtens create mode 100644 include/grub/pkcs1_v15.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 81fc27414..97347ae76 100644 +index 81fc274148..97347ae76f 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2510,6 +2510,14 @@ module = { @@ -46,7 +46,7 @@ index 81fc27414..97347ae76 100644 name = all_video; common = lib/fake_module.c; diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 5daa1e9d0..2408db499 100644 +index 5daa1e9d00..2408db4994 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -24,6 +24,7 @@ @@ -93,7 +93,7 @@ index 5daa1e9d0..2408db499 100644 struct grub_pubkey_context diff --git a/grub-core/lib/pkcs1_v15.c b/grub-core/lib/pkcs1_v15.c new file mode 100644 -index 000000000..dbacd563d +index 0000000000..dbacd563d0 --- /dev/null +++ b/grub-core/lib/pkcs1_v15.c @@ -0,0 +1,59 @@ @@ -158,7 +158,7 @@ index 000000000..dbacd563d +} diff --git a/include/grub/pkcs1_v15.h b/include/grub/pkcs1_v15.h new file mode 100644 -index 000000000..5c338c84a +index 0000000000..5c338c84a1 --- /dev/null +++ b/include/grub/pkcs1_v15.h @@ -0,0 +1,27 @@ diff --git a/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch index b104617d..541474e5 100644 --- a/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +++ b/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch @@ -40,7 +40,7 @@ Signed-off-by: Daniel Axtens 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 2408db499..355a43844 100644 +index 2408db4994..355a43844a 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -147,10 +147,6 @@ const char *hashes[] = { @@ -55,7 +55,7 @@ index 2408db499..355a43844 100644 dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval, const gcry_md_spec_t *hash, struct grub_public_subkey *sk); diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index ca334d5a4..c578128a5 100644 +index ca334d5a40..c578128a59 100644 --- a/grub-core/lib/crypto.c +++ b/grub-core/lib/crypto.c @@ -121,6 +121,10 @@ grub_md_unregister (gcry_md_spec_t *cipher) diff --git a/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch index fed345e3..3176f1b7 100644 --- a/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +++ b/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch @@ -23,7 +23,7 @@ Signed-off-by: Daniel Axtens 3 files changed, 10 insertions(+) diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h -index 7217138ff..591dbf328 100644 +index 7217138ffd..591dbf3289 100644 --- a/grub-core/lib/posix_wrap/limits.h +++ b/grub-core/lib/posix_wrap/limits.h @@ -37,5 +37,6 @@ @@ -34,7 +34,7 @@ index 7217138ff..591dbf328 100644 #endif diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h -index 7a8d385e9..4634db09f 100644 +index 7a8d385e97..4634db09f2 100644 --- a/grub-core/lib/posix_wrap/stdlib.h +++ b/grub-core/lib/posix_wrap/stdlib.h @@ -58,4 +58,12 @@ abs (int c) @@ -51,7 +51,7 @@ index 7a8d385e9..4634db09f 100644 + #endif diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h -index 854eb0122..f63412c8d 100644 +index 854eb0122e..f63412c8da 100644 --- a/grub-core/lib/posix_wrap/sys/types.h +++ b/grub-core/lib/posix_wrap/sys/types.h @@ -51,6 +51,7 @@ typedef grub_uint8_t byte; diff --git a/0165-libtasn1-import-libtasn1-4.16.0.patch b/0165-libtasn1-import-libtasn1-4.16.0.patch index 7a7b05d4..95876611 100644 --- a/0165-libtasn1-import-libtasn1-4.16.0.patch +++ b/0165-libtasn1-import-libtasn1-4.16.0.patch @@ -53,7 +53,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/lib/libtasn1/lib/coding.c b/grub-core/lib/libtasn1/lib/coding.c new file mode 100644 -index 000000000..245ea64cf +index 0000000000..245ea64cf0 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/coding.c @@ -0,0 +1,1415 @@ @@ -1474,7 +1474,7 @@ index 000000000..245ea64cf +} diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c new file mode 100644 -index 000000000..ff04eb778 +index 0000000000..ff04eb778c --- /dev/null +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -0,0 +1,2478 @@ @@ -3958,7 +3958,7 @@ index 000000000..ff04eb778 +} diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c new file mode 100644 -index 000000000..997eb2725 +index 0000000000..997eb2725d --- /dev/null +++ b/grub-core/lib/libtasn1/lib/element.c @@ -0,0 +1,1111 @@ @@ -5075,7 +5075,7 @@ index 000000000..997eb2725 +} diff --git a/grub-core/lib/libtasn1/lib/errors.c b/grub-core/lib/libtasn1/lib/errors.c new file mode 100644 -index 000000000..cee74daf7 +index 0000000000..cee74daf79 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/errors.c @@ -0,0 +1,100 @@ @@ -5181,7 +5181,7 @@ index 000000000..cee74daf7 +} diff --git a/grub-core/lib/libtasn1/lib/gstr.c b/grub-core/lib/libtasn1/lib/gstr.c new file mode 100644 -index 000000000..e91a3a151 +index 0000000000..e91a3a151c --- /dev/null +++ b/grub-core/lib/libtasn1/lib/gstr.c @@ -0,0 +1,74 @@ @@ -5261,7 +5261,7 @@ index 000000000..e91a3a151 +} diff --git a/grub-core/lib/libtasn1/lib/parser_aux.c b/grub-core/lib/libtasn1/lib/parser_aux.c new file mode 100644 -index 000000000..d5dbbf876 +index 0000000000..d5dbbf8765 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/parser_aux.c @@ -0,0 +1,1173 @@ @@ -6440,7 +6440,7 @@ index 000000000..d5dbbf876 +} diff --git a/grub-core/lib/libtasn1/lib/structure.c b/grub-core/lib/libtasn1/lib/structure.c new file mode 100644 -index 000000000..8189c56a4 +index 0000000000..8189c56a4c --- /dev/null +++ b/grub-core/lib/libtasn1/lib/structure.c @@ -0,0 +1,1220 @@ @@ -7666,7 +7666,7 @@ index 000000000..8189c56a4 +} diff --git a/grub-core/lib/libtasn1/lib/element.h b/grub-core/lib/libtasn1/lib/element.h new file mode 100644 -index 000000000..440a33f4b +index 0000000000..440a33f4bb --- /dev/null +++ b/grub-core/lib/libtasn1/lib/element.h @@ -0,0 +1,40 @@ @@ -7712,7 +7712,7 @@ index 000000000..440a33f4b +#endif diff --git a/grub-core/lib/libtasn1/lib/gstr.h b/grub-core/lib/libtasn1/lib/gstr.h new file mode 100644 -index 000000000..48229844f +index 0000000000..48229844ff --- /dev/null +++ b/grub-core/lib/libtasn1/lib/gstr.h @@ -0,0 +1,47 @@ @@ -7765,7 +7765,7 @@ index 000000000..48229844f +#endif /* GSTR_H */ diff --git a/grub-core/lib/libtasn1/lib/int.h b/grub-core/lib/libtasn1/lib/int.h new file mode 100644 -index 000000000..ea1625786 +index 0000000000..ea1625786c --- /dev/null +++ b/grub-core/lib/libtasn1/lib/int.h @@ -0,0 +1,221 @@ @@ -7992,7 +7992,7 @@ index 000000000..ea1625786 +#endif /* INT_H */ diff --git a/grub-core/lib/libtasn1/lib/parser_aux.h b/grub-core/lib/libtasn1/lib/parser_aux.h new file mode 100644 -index 000000000..598e684b3 +index 0000000000..598e684b35 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/parser_aux.h @@ -0,0 +1,172 @@ @@ -8170,7 +8170,7 @@ index 000000000..598e684b3 +#endif diff --git a/grub-core/lib/libtasn1/lib/structure.h b/grub-core/lib/libtasn1/lib/structure.h new file mode 100644 -index 000000000..99e685da0 +index 0000000000..99e685da07 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/structure.h @@ -0,0 +1,45 @@ @@ -8221,7 +8221,7 @@ index 000000000..99e685da0 +#endif diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h new file mode 100644 -index 000000000..6fd7a30dc +index 0000000000..6fd7a30dc3 --- /dev/null +++ b/include/grub/libtasn1.h @@ -0,0 +1,588 @@ @@ -8815,7 +8815,7 @@ index 000000000..6fd7a30dc +#endif /* LIBTASN1_H */ diff --git a/grub-core/lib/libtasn1/LICENSE b/grub-core/lib/libtasn1/LICENSE new file mode 100644 -index 000000000..e8b3628db +index 0000000000..e8b3628db9 --- /dev/null +++ b/grub-core/lib/libtasn1/LICENSE @@ -0,0 +1,16 @@ @@ -8837,7 +8837,7 @@ index 000000000..e8b3628db +note that the range specifies every single year in that closed interval. diff --git a/grub-core/lib/libtasn1/README.md b/grub-core/lib/libtasn1/README.md new file mode 100644 -index 000000000..50a864229 +index 0000000000..50a8642296 --- /dev/null +++ b/grub-core/lib/libtasn1/README.md @@ -0,0 +1,91 @@ diff --git a/0166-libtasn1-disable-code-not-needed-in-grub.patch b/0166-libtasn1-disable-code-not-needed-in-grub.patch index 082cdb9b..84dcbf05 100644 --- a/0166-libtasn1-disable-code-not-needed-in-grub.patch +++ b/0166-libtasn1-disable-code-not-needed-in-grub.patch @@ -25,7 +25,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/grub-core/lib/libtasn1/lib/coding.c b/grub-core/lib/libtasn1/lib/coding.c -index 245ea64cf..52def5983 100644 +index 245ea64cf0..52def59836 100644 --- a/grub-core/lib/libtasn1/lib/coding.c +++ b/grub-core/lib/libtasn1/lib/coding.c @@ -30,11 +30,11 @@ @@ -99,7 +99,7 @@ index 245ea64cf..52def5983 100644 +#endif \ No newline at end of file diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c -index ff04eb778..42f9a92b5 100644 +index ff04eb778c..42f9a92b5d 100644 --- a/grub-core/lib/libtasn1/lib/decoding.c +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -1613,6 +1613,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len, @@ -119,7 +119,7 @@ index ff04eb778..42f9a92b5 100644 /** * asn1_der_decoding_startEnd: diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c -index 997eb2725..539008d8e 100644 +index 997eb2725d..539008d8e9 100644 --- a/grub-core/lib/libtasn1/lib/element.c +++ b/grub-core/lib/libtasn1/lib/element.c @@ -191,7 +191,7 @@ _asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcache) @@ -141,7 +141,7 @@ index 997eb2725..539008d8e 100644 #define PUT_VALUE( ptr, ptr_size, data, data_size) \ *len = data_size; \ diff --git a/grub-core/lib/libtasn1/lib/errors.c b/grub-core/lib/libtasn1/lib/errors.c -index cee74daf7..42785e862 100644 +index cee74daf79..42785e8622 100644 --- a/grub-core/lib/libtasn1/lib/errors.c +++ b/grub-core/lib/libtasn1/lib/errors.c @@ -57,6 +57,8 @@ static const libtasn1_error_entry error_algorithms[] = { @@ -162,7 +162,7 @@ index cee74daf7..42785e862 100644 /** * asn1_strerror: diff --git a/grub-core/lib/libtasn1/lib/structure.c b/grub-core/lib/libtasn1/lib/structure.c -index 8189c56a4..fcfde01a3 100644 +index 8189c56a4c..fcfde01a39 100644 --- a/grub-core/lib/libtasn1/lib/structure.c +++ b/grub-core/lib/libtasn1/lib/structure.c @@ -76,7 +76,7 @@ _asn1_find_left (asn1_node_const node) @@ -218,7 +218,7 @@ index 8189c56a4..fcfde01a3 100644 /** * asn1_dup_node: diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h -index 6fd7a30dc..785eda2ae 100644 +index 6fd7a30dc3..785eda2ae3 100644 --- a/include/grub/libtasn1.h +++ b/include/grub/libtasn1.h @@ -319,6 +319,8 @@ typedef struct asn1_data_node_st asn1_data_node_st; diff --git a/0167-libtasn1-changes-for-grub-compatibility.patch b/0167-libtasn1-changes-for-grub-compatibility.patch index 35ceb569..7c756bd4 100644 --- a/0167-libtasn1-changes-for-grub-compatibility.patch +++ b/0167-libtasn1-changes-for-grub-compatibility.patch @@ -35,7 +35,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 22 insertions(+), 33 deletions(-) diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c -index 42f9a92b5..7856858b2 100644 +index 42f9a92b5d..7856858b27 100644 --- a/grub-core/lib/libtasn1/lib/decoding.c +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -32,7 +32,8 @@ @@ -71,7 +71,7 @@ index 42f9a92b5..7856858b2 100644 result = asn1_create_element (definitions, name, &aux); if (result == ASN1_SUCCESS) diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c -index 539008d8e..ed761ff56 100644 +index 539008d8e9..ed761ff56b 100644 --- a/grub-core/lib/libtasn1/lib/element.c +++ b/grub-core/lib/libtasn1/lib/element.c @@ -30,9 +30,10 @@ @@ -87,7 +87,7 @@ index 539008d8e..ed761ff56 100644 _asn1_hierarchical_name (asn1_node_const node, char *name, int name_size) { diff --git a/grub-core/lib/libtasn1/lib/gstr.c b/grub-core/lib/libtasn1/lib/gstr.c -index e91a3a151..e33875c2c 100644 +index e91a3a151c..e33875c2c7 100644 --- a/grub-core/lib/libtasn1/lib/gstr.c +++ b/grub-core/lib/libtasn1/lib/gstr.c @@ -36,13 +36,13 @@ _asn1_str_cat (char *dest, size_t dest_tot_size, const char *src) @@ -107,7 +107,7 @@ index e91a3a151..e33875c2c 100644 } } diff --git a/grub-core/lib/libtasn1/lib/parser_aux.c b/grub-core/lib/libtasn1/lib/parser_aux.c -index d5dbbf876..89c9be69d 100644 +index d5dbbf8765..89c9be69dc 100644 --- a/grub-core/lib/libtasn1/lib/parser_aux.c +++ b/grub-core/lib/libtasn1/lib/parser_aux.c @@ -26,7 +26,8 @@ @@ -139,7 +139,7 @@ index d5dbbf876..89c9be69d 100644 temp[start + count] = '0' + (char) r; count++; diff --git a/grub-core/lib/libtasn1/lib/int.h b/grub-core/lib/libtasn1/lib/int.h -index ea1625786..4a568efee 100644 +index ea1625786c..4a568efee9 100644 --- a/grub-core/lib/libtasn1/lib/int.h +++ b/grub-core/lib/libtasn1/lib/int.h @@ -35,7 +35,7 @@ @@ -161,7 +161,7 @@ index ea1625786..4a568efee 100644 #if SIZEOF_UNSIGNED_LONG_INT == 8 # define _asn1_strtou64(n,e,b) strtoul((const char *) n, e, b) diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h -index 785eda2ae..28dbf16c4 100644 +index 785eda2ae3..28dbf16c4e 100644 --- a/include/grub/libtasn1.h +++ b/include/grub/libtasn1.h @@ -38,29 +38,15 @@ diff --git a/0168-libtasn1-compile-into-asn1-module.patch b/0168-libtasn1-compile-into-asn1-module.patch index fe6ffddc..b5574036 100644 --- a/0168-libtasn1-compile-into-asn1-module.patch +++ b/0168-libtasn1-compile-into-asn1-module.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/lib/libtasn1_wrap/wrap.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 97347ae76..21d2c5418 100644 +index 97347ae76f..21d2c54185 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2576,3 +2576,18 @@ module = { @@ -38,7 +38,7 @@ index 97347ae76..21d2c5418 100644 +}; diff --git a/grub-core/lib/libtasn1_wrap/wrap.c b/grub-core/lib/libtasn1_wrap/wrap.c new file mode 100644 -index 000000000..622ba942e +index 0000000000..622ba942e3 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap.c @@ -0,0 +1,26 @@ diff --git a/0169-test_asn1-test-module-for-libtasn1.patch b/0169-test_asn1-test-module-for-libtasn1.patch index 6bacdb96..1588c511 100644 --- a/0169-test_asn1-test-module-for-libtasn1.patch +++ b/0169-test_asn1-test-module-for-libtasn1.patch @@ -51,7 +51,7 @@ Signed-off-by: Daniel Axtens create mode 100644 tests/test_asn1.in diff --git a/Makefile.util.def b/Makefile.util.def -index 9927c2cfd..3f191aa80 100644 +index 9927c2cfd6..3f191aa809 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1306,6 +1306,12 @@ script = { @@ -68,7 +68,7 @@ index 9927c2cfd..3f191aa80 100644 testcase; name = example_unit_test; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 21d2c5418..b4aaccf7b 100644 +index 21d2c54185..b4aaccf7b5 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2591,3 +2591,16 @@ module = { @@ -90,7 +90,7 @@ index 21d2c5418..b4aaccf7b 100644 +}; diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c new file mode 100644 -index 000000000..534e30452 +index 0000000000..534e304521 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c @@ -0,0 +1,61 @@ @@ -157,7 +157,7 @@ index 000000000..534e30452 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c b/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c new file mode 100644 -index 000000000..f48aea0ef +index 0000000000..f48aea0ef8 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c @@ -0,0 +1,138 @@ @@ -301,7 +301,7 @@ index 000000000..f48aea0ef +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_simple.c b/grub-core/lib/libtasn1_wrap/tests/Test_simple.c new file mode 100644 -index 000000000..9f01006dd +index 0000000000..9f01006ddf --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_simple.c @@ -0,0 +1,207 @@ @@ -514,7 +514,7 @@ index 000000000..9f01006dd +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_strings.c b/grub-core/lib/libtasn1_wrap/tests/Test_strings.c new file mode 100644 -index 000000000..dbe1474b2 +index 0000000000..dbe1474b20 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_strings.c @@ -0,0 +1,150 @@ @@ -670,7 +670,7 @@ index 000000000..dbe1474b2 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c b/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c new file mode 100644 -index 000000000..d367bbfb5 +index 0000000000..d367bbfb5a --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c @@ -0,0 +1,116 @@ @@ -792,7 +792,7 @@ index 000000000..d367bbfb5 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c b/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c new file mode 100644 -index 000000000..3a83b58c5 +index 0000000000..3a83b58c59 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c @@ -0,0 +1,120 @@ @@ -918,7 +918,7 @@ index 000000000..3a83b58c5 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/octet-string.c b/grub-core/lib/libtasn1_wrap/tests/octet-string.c new file mode 100644 -index 000000000..d8a049e8d +index 0000000000..d8a049e8df --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/octet-string.c @@ -0,0 +1,211 @@ @@ -1135,7 +1135,7 @@ index 000000000..d8a049e8d +} diff --git a/grub-core/lib/libtasn1_wrap/tests/reproducers.c b/grub-core/lib/libtasn1_wrap/tests/reproducers.c new file mode 100644 -index 000000000..dc7268d4c +index 0000000000..dc7268d4c6 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/reproducers.c @@ -0,0 +1,81 @@ @@ -1222,7 +1222,7 @@ index 000000000..dc7268d4c +} diff --git a/grub-core/lib/libtasn1_wrap/wrap_tests.c b/grub-core/lib/libtasn1_wrap/wrap_tests.c new file mode 100644 -index 000000000..75fcd21f0 +index 0000000000..75fcd21f0d --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap_tests.c @@ -0,0 +1,75 @@ @@ -1303,7 +1303,7 @@ index 000000000..75fcd21f0 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h new file mode 100644 -index 000000000..1e7d3d64f +index 0000000000..1e7d3d64f5 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h @@ -0,0 +1,32 @@ @@ -1341,7 +1341,7 @@ index 000000000..1e7d3d64f +}; diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h new file mode 100644 -index 000000000..e2561e5ec +index 0000000000..e2561e5ec6 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h @@ -0,0 +1,36 @@ @@ -1383,7 +1383,7 @@ index 000000000..e2561e5ec +}; diff --git a/grub-core/lib/libtasn1_wrap/wrap_tests.h b/grub-core/lib/libtasn1_wrap/wrap_tests.h new file mode 100644 -index 000000000..555e56dd2 +index 0000000000..555e56dd20 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap_tests.h @@ -0,0 +1,38 @@ @@ -1426,7 +1426,7 @@ index 000000000..555e56dd2 + +#endif diff --git a/.gitignore b/.gitignore -index 594d0134d..856e69bc5 100644 +index 594d0134d3..856e69bc5c 100644 --- a/.gitignore +++ b/.gitignore @@ -264,6 +264,7 @@ widthspec.bin @@ -1439,7 +1439,7 @@ index 594d0134d..856e69bc5 100644 /tests/syslinux/ubuntu10.04_grub.cfg diff --git a/tests/test_asn1.in b/tests/test_asn1.in new file mode 100644 -index 000000000..8173c5c27 +index 0000000000..8173c5c270 --- /dev/null +++ b/tests/test_asn1.in @@ -0,0 +1,12 @@ diff --git a/0170-grub-install-support-embedding-x509-certificates.patch b/0170-grub-install-support-embedding-x509-certificates.patch index c3c83a58..c4c35f4b 100644 --- a/0170-grub-install-support-embedding-x509-certificates.patch +++ b/0170-grub-install-support-embedding-x509-certificates.patch @@ -20,7 +20,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 80 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 355a43844..b81ac0ae4 100644 +index 355a43844a..b81ac0ae46 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -944,7 +944,7 @@ GRUB_MOD_INIT(pgp) @@ -33,7 +33,7 @@ index 355a43844..b81ac0ae4 100644 pseudo_file.fs = &pseudo_fs; diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index a74fee16e..c603f5b30 100644 +index a74fee16e2..c603f5b308 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -460,6 +460,8 @@ static char **pubkeys; @@ -95,7 +95,7 @@ index a74fee16e..c603f5b30 100644 disable_shim_lock); while (dc--) diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index 8a5331054..e1f111278 100644 +index 8a53310548..e1f1112784 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -75,7 +75,8 @@ static struct argp_option options[] = { @@ -142,7 +142,7 @@ index 8a5331054..e1f111278 100644 arguments.appsig_size, arguments.comp, arguments.dtb, arguments.sbat, diff --git a/util/mkimage.c b/util/mkimage.c -index bab122760..8319e8dfb 100644 +index bab1227601..8319e8dfbd 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -867,7 +867,8 @@ void @@ -212,7 +212,7 @@ index bab122760..8319e8dfb 100644 { struct grub_module_header *header; diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index 55849777e..98edc0863 100644 +index 55849777ea..98edc0863f 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -30,7 +30,9 @@ enum @@ -227,7 +227,7 @@ index 55849777e..98edc0863 100644 /* The module header. */ diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index cf4531e02..51f3b13ac 100644 +index cf4531e02b..51f3b13ac1 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -67,6 +67,8 @@ diff --git a/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch index a9ee5b4c..0ebc6c76 100644 --- a/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +++ b/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch @@ -22,7 +22,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/commands/appendedsig/gnutls_asn1_tab.c b/grub-core/commands/appendedsig/gnutls_asn1_tab.c new file mode 100644 -index 000000000..ddd1314e6 +index 0000000000..ddd1314e63 --- /dev/null +++ b/grub-core/commands/appendedsig/gnutls_asn1_tab.c @@ -0,0 +1,121 @@ @@ -149,7 +149,7 @@ index 000000000..ddd1314e6 +}; diff --git a/grub-core/commands/appendedsig/pkix_asn1_tab.c b/grub-core/commands/appendedsig/pkix_asn1_tab.c new file mode 100644 -index 000000000..adef69d95 +index 0000000000..adef69d95c --- /dev/null +++ b/grub-core/commands/appendedsig/pkix_asn1_tab.c @@ -0,0 +1,484 @@ diff --git a/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch index 7fb56881..5a13d5bc 100644 --- a/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +++ b/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch @@ -29,7 +29,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/commands/appendedsig/asn1util.c b/grub-core/commands/appendedsig/asn1util.c new file mode 100644 -index 000000000..eff095a9d +index 0000000000..eff095a9df --- /dev/null +++ b/grub-core/commands/appendedsig/asn1util.c @@ -0,0 +1,102 @@ @@ -137,7 +137,7 @@ index 000000000..eff095a9d +} diff --git a/grub-core/commands/appendedsig/pkcs7.c b/grub-core/commands/appendedsig/pkcs7.c new file mode 100644 -index 000000000..dc6afe203 +index 0000000000..dc6afe203f --- /dev/null +++ b/grub-core/commands/appendedsig/pkcs7.c @@ -0,0 +1,305 @@ @@ -448,7 +448,7 @@ index 000000000..dc6afe203 +} diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c new file mode 100644 -index 000000000..2b38b3670 +index 0000000000..2b38b3670a --- /dev/null +++ b/grub-core/commands/appendedsig/x509.c @@ -0,0 +1,958 @@ @@ -1412,7 +1412,7 @@ index 000000000..2b38b3670 +} diff --git a/grub-core/commands/appendedsig/appendedsig.h b/grub-core/commands/appendedsig/appendedsig.h new file mode 100644 -index 000000000..9792ef390 +index 0000000000..9792ef3901 --- /dev/null +++ b/grub-core/commands/appendedsig/appendedsig.h @@ -0,0 +1,110 @@ diff --git a/0173-appended-signatures-support-verifying-appended-signa.patch b/0173-appended-signatures-support-verifying-appended-signa.patch index 95451282..969293a4 100644 --- a/0173-appended-signatures-support-verifying-appended-signa.patch +++ b/0173-appended-signatures-support-verifying-appended-signa.patch @@ -30,7 +30,7 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/appendedsig/appendedsig.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index b4aaccf7b..77321d218 100644 +index b4aaccf7b5..77321d218c 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -980,6 +980,18 @@ module = { @@ -54,7 +54,7 @@ index b4aaccf7b..77321d218 100644 common = commands/hdparm.c; diff --git a/grub-core/commands/appendedsig/appendedsig.c b/grub-core/commands/appendedsig/appendedsig.c new file mode 100644 -index 000000000..bf8b18b62 +index 0000000000..bf8b18b620 --- /dev/null +++ b/grub-core/commands/appendedsig/appendedsig.c @@ -0,0 +1,645 @@ @@ -704,7 +704,7 @@ index 000000000..bf8b18b62 + grub_unregister_command (cmd_distrust); +} diff --git a/include/grub/file.h b/include/grub/file.h -index 31567483c..96827a4f8 100644 +index 31567483cc..96827a4f89 100644 --- a/include/grub/file.h +++ b/include/grub/file.h @@ -80,6 +80,8 @@ enum grub_file_type diff --git a/0174-appended-signatures-verification-tests.patch b/0174-appended-signatures-verification-tests.patch index 12ae1e83..982b3c82 100644 --- a/0174-appended-signatures-verification-tests.patch +++ b/0174-appended-signatures-verification-tests.patch @@ -17,7 +17,7 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/tests/appended_signatures.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 77321d218..6bddc841b 100644 +index 77321d218c..6bddc841b8 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2161,6 +2161,12 @@ module = { @@ -35,7 +35,7 @@ index 77321d218..6bddc841b 100644 common = tests/signature_test.c; diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c new file mode 100644 -index 000000000..88a485200 +index 0000000000..88a485200d --- /dev/null +++ b/grub-core/tests/appended_signature_test.c @@ -0,0 +1,281 @@ @@ -321,7 +321,7 @@ index 000000000..88a485200 + +GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c -index 96781fb39..403fa5c78 100644 +index 96781fb39b..403fa5c789 100644 --- a/grub-core/tests/lib/functional_test.c +++ b/grub-core/tests/lib/functional_test.c @@ -73,6 +73,7 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), @@ -334,7 +334,7 @@ index 96781fb39..403fa5c78 100644 grub_dl_load ("ctz_test"); diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h new file mode 100644 -index 000000000..aa3dc6278 +index 0000000000..aa3dc6278e --- /dev/null +++ b/grub-core/tests/appended_signatures.h @@ -0,0 +1,557 @@ diff --git a/0175-appended-signatures-documentation.patch b/0175-appended-signatures-documentation.patch index c67bcc18..eb580464 100644 --- a/0175-appended-signatures-documentation.patch +++ b/0175-appended-signatures-documentation.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 182 insertions(+), 17 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index afbde7c1f..4816be856 100644 +index afbde7c1f7..4816be8561 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -3214,6 +3214,7 @@ These variables have special meaning to GRUB. diff --git a/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch index 3e211b0b..ed4c684a 100644 --- a/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +++ b/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Axtens 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 6bddc841b..3f3459b2c 100644 +index 6bddc841b8..3f3459b2c7 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -323,6 +323,7 @@ kernel = { @@ -27,7 +27,7 @@ index 6bddc841b..3f3459b2c 100644 sparc64_ieee1275 = kern/sparc64/cache.S; sparc64_ieee1275 = kern/sparc64/dl.c; diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 937c1bc44..fc7d97127 100644 +index 937c1bc44c..fc7d971272 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -44,6 +44,7 @@ @@ -79,7 +79,7 @@ index 937c1bc44..fc7d97127 100644 void diff --git a/include/grub/lockdown.h b/include/grub/lockdown.h -index 40531fa82..ebfee4bf0 100644 +index 40531fa823..ebfee4bf06 100644 --- a/include/grub/lockdown.h +++ b/include/grub/lockdown.h @@ -24,7 +24,8 @@ @@ -93,7 +93,7 @@ index 40531fa82..ebfee4bf0 100644 EXPORT_FUNC (grub_lockdown) (void); extern int diff --git a/docs/grub.texi b/docs/grub.texi -index 4816be856..a4da9c2a1 100644 +index 4816be8561..a4da9c2a1b 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -6227,8 +6227,8 @@ Measured boot is currently only supported on EFI platforms. diff --git a/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch index 30efae78..a40caea7 100644 --- a/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +++ b/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch @@ -32,7 +32,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 17 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index fc7d97127..0dcd114ce 100644 +index fc7d971272..0dcd114ce5 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -46,9 +46,6 @@ diff --git a/0178-ieee1275-claim-more-memory.patch b/0178-ieee1275-claim-more-memory.patch index 27bab15e..6ec319be 100644 --- a/0178-ieee1275-claim-more-memory.patch +++ b/0178-ieee1275-claim-more-memory.patch @@ -86,7 +86,7 @@ Signed-off-by: Daniel Axtens 2 files changed, 69 insertions(+), 18 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 0dcd114ce..c61d91a02 100644 +index 0dcd114ce5..c61d91a028 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -46,11 +46,12 @@ @@ -227,7 +227,7 @@ index 0dcd114ce..c61d91a02 100644 #endif diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 19f708ee6..90083772c 100644 +index 19f708ee66..90083772c8 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1047,7 +1047,9 @@ space is limited to 4GiB. GRUB allocates pages from EFI for its heap, at most diff --git a/0179-ieee1275-request-memory-with-ibm-client-architecture.patch b/0179-ieee1275-request-memory-with-ibm-client-architecture.patch index edfbe929..4f3ab90c 100644 --- a/0179-ieee1275-request-memory-with-ibm-client-architecture.patch +++ b/0179-ieee1275-request-memory-with-ibm-client-architecture.patch @@ -69,7 +69,7 @@ Signed-off-by: Daniel Axtens 3 files changed, 152 insertions(+), 3 deletions(-) diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 04df9d2c6..6435628ec 100644 +index 04df9d2c66..6435628ec5 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c @@ -127,6 +127,9 @@ grub_ieee1275_find_options (void) @@ -83,7 +83,7 @@ index 04df9d2c6..6435628ec 100644 if (is_smartfirmware) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index c61d91a02..9704715c8 100644 +index c61d91a028..9704715c83 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -242,6 +242,135 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, @@ -248,7 +248,7 @@ index c61d91a02..9704715c8 100644 total = total / 4; diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index b5a1d49bb..e0a6c2ce1 100644 +index b5a1d49bbc..e0a6c2ce1e 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -149,7 +149,13 @@ enum grub_ieee1275_flag diff --git a/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch index 878bf608..5728f26d 100644 --- a/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +++ b/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch @@ -23,7 +23,7 @@ Signed-off-by: Daniel Axtens 3 files changed, 201 insertions(+), 3 deletions(-) diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c -index 2b38b3670..42ec65c54 100644 +index 2b38b3670a..42ec65c54a 100644 --- a/grub-core/commands/appendedsig/x509.c +++ b/grub-core/commands/appendedsig/x509.c @@ -47,6 +47,12 @@ const char *keyUsage_oid = "2.5.29.15"; @@ -156,7 +156,7 @@ index 2b38b3670..42ec65c54 100644 cleanup_value: diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c -index 88a485200..dbba06166 100644 +index 88a485200d..dbba061662 100644 --- a/grub-core/tests/appended_signature_test.c +++ b/grub-core/tests/appended_signature_test.c @@ -111,6 +111,22 @@ static struct grub_procfs_entry certificate_printable_der_entry = { @@ -225,7 +225,7 @@ index 88a485200..dbba06166 100644 GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h -index aa3dc6278..2e5ebd7d8 100644 +index aa3dc6278e..2e5ebd7d8b 100644 --- a/grub-core/tests/appended_signatures.h +++ b/grub-core/tests/appended_signatures.h @@ -555,3 +555,84 @@ unsigned char certificate_printable_der[] = { diff --git a/0181-ieee1275-ofdisk-retry-on-open-failure.patch b/0181-ieee1275-ofdisk-retry-on-open-failure.patch index 264c7c9c..91497730 100644 --- a/0181-ieee1275-ofdisk-retry-on-open-failure.patch +++ b/0181-ieee1275-ofdisk-retry-on-open-failure.patch @@ -16,7 +16,7 @@ Signed-off-by: Diego Domingos 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index ea7f78ac7..55346849d 100644 +index ea7f78ac7d..55346849d3 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -225,7 +225,9 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) @@ -85,7 +85,7 @@ index ea7f78ac7..55346849d 100644 } diff --git a/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h -index 2f69e3f19..7d2d54093 100644 +index 2f69e3f191..7d2d540930 100644 --- a/include/grub/ieee1275/ofdisk.h +++ b/include/grub/ieee1275/ofdisk.h @@ -22,4 +22,12 @@ diff --git a/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch index 32c6b601..c3101e10 100644 --- a/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch +++ b/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch @@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood create mode 100644 include/grub/loopback.h diff --git a/grub-core/disk/loopback.c b/grub-core/disk/loopback.c -index 41bebd14f..99f47924e 100644 +index 41bebd14fe..99f47924ec 100644 --- a/grub-core/disk/loopback.c +++ b/grub-core/disk/loopback.c @@ -21,20 +21,13 @@ @@ -39,7 +39,7 @@ index 41bebd14f..99f47924e 100644 static unsigned long last_id = 0; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index d41e8ea14..3af6b1229 100644 +index d41e8ea14a..3af6b12292 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -24,6 +24,7 @@ @@ -102,7 +102,7 @@ index d41e8ea14..3af6b1229 100644 diff --git a/include/grub/loopback.h b/include/grub/loopback.h new file mode 100644 -index 000000000..3b9a9e32e +index 0000000000..3b9a9e32e8 --- /dev/null +++ b/include/grub/loopback.h @@ -0,0 +1,30 @@ diff --git a/0183-efinet-Add-DHCP-proxy-support.patch b/0183-efinet-Add-DHCP-proxy-support.patch index f1fb5cb1..eed2dbb0 100644 --- a/0183-efinet-Add-DHCP-proxy-support.patch +++ b/0183-efinet-Add-DHCP-proxy-support.patch @@ -14,7 +14,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index e11d759f1..1a24f38a2 100644 +index e11d759f19..1a24f38a21 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -850,10 +850,31 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, diff --git a/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch index 8e3279ae..3d7c641a 100644 --- a/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +++ b/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch @@ -23,7 +23,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index e7dd78e66..731d346f8 100644 +index e7dd78e663..731d346f88 100644 --- a/grub-core/fs/ext2.c +++ b/grub-core/fs/ext2.c @@ -103,6 +103,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index 074d650a..1982847e 100644 --- a/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index c02c1f082..6af84b44e 100644 +index c02c1f0820..6af84b44e1 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -256,7 +256,9 @@ if [ -z "\${kernelopts}" ]; then diff --git a/0186-Suppress-gettext-error-message.patch b/0186-Suppress-gettext-error-message.patch index 2ca0ce09..64b219a8 100644 --- a/0186-Suppress-gettext-error-message.patch +++ b/0186-Suppress-gettext-error-message.patch @@ -14,7 +14,7 @@ Signed-off-by: Paulo Flabiano Smorigo 1 file changed, 7 insertions(+) diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c -index 4d02e62c1..7ec81ca0b 100644 +index 4d02e62c10..7ec81ca0b4 100644 --- a/grub-core/gettext/gettext.c +++ b/grub-core/gettext/gettext.c @@ -424,6 +424,13 @@ grub_gettext_init_ext (struct grub_gettext_context *ctx, diff --git a/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch index c83c5322..b5d5e5cb 100644 --- a/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +++ b/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch @@ -15,7 +15,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/util/grub-set-password.in b/util/grub-set-password.in -index c0b5ebbfd..d8005e5a1 100644 +index c0b5ebbfdc..d8005e5a14 100644 --- a/util/grub-set-password.in +++ b/util/grub-set-password.in @@ -1,11 +1,6 @@ diff --git a/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch index 79040b47..265b9672 100644 --- a/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch +++ b/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch @@ -30,7 +30,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in -index d344d3883..b6041b55e 100644 +index d344d3883d..b6041b55e2 100644 --- a/util/grub.d/30_uefi-firmware.in +++ b/util/grub.d/30_uefi-firmware.in @@ -26,19 +26,14 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch index 81ac3e9c..3b1a219d 100644 --- a/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +++ b/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch @@ -21,7 +21,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c -index eaca03283..328c45e82 100644 +index eaca032838..328c45e82e 100644 --- a/grub-core/commands/efi/efifwsetup.c +++ b/grub-core/commands/efi/efifwsetup.c @@ -27,6 +27,25 @@ diff --git a/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch index a206b72d..cc5458cc 100644 --- a/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch +++ b/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch @@ -24,7 +24,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 68 insertions(+), 34 deletions(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 47f8cf0d8..f18d90bd7 100644 +index 47f8cf0d84..f18d90bd74 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -41,6 +41,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -193,7 +193,7 @@ index 47f8cf0d8..f18d90bd7 100644 return grub_errno; } diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index b582f67f6..966a5074f 100644 +index b582f67f66..966a5074f5 100644 --- a/include/grub/arm/linux.h +++ b/include/grub/arm/linux.h @@ -44,6 +44,7 @@ struct grub_arm_linux_pe_header @@ -205,7 +205,7 @@ index b582f67f6..966a5074f 100644 # define grub_armxx_linux_pe_header grub_arm_linux_pe_header #endif diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index ea030312d..422bf2bf2 100644 +index ea030312df..422bf2bf24 100644 --- a/include/grub/arm64/linux.h +++ b/include/grub/arm64/linux.h @@ -48,6 +48,7 @@ struct grub_arm64_linux_pe_header diff --git a/0191-normal-main-Discover-the-device-to-read-the-config-f.patch b/0191-normal-main-Discover-the-device-to-read-the-config-f.patch index 5cf3cb28..2c9ca3a4 100644 --- a/0191-normal-main-Discover-the-device-to-read-the-config-f.patch +++ b/0191-normal-main-Discover-the-device-to-read-the-config-f.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 4ebdbd228..b72fe3d65 100644 +index 7de9e4c36d..8f5fd81003 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -337,18 +337,13 @@ grub_enter_normal_mode (const char *config) diff --git a/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch index b03e3d33..b9bc1400 100644 --- a/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +++ b/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch @@ -25,7 +25,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index b573be665..3fc340147 100644 +index b573be6650..3fc3401472 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -216,13 +216,52 @@ grub_set_prefix_and_root (void) diff --git a/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch index fbb0ee70..7fc40f1f 100644 --- a/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +++ b/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch @@ -81,7 +81,7 @@ Reviewed-by: Daniel Kiper 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 0f524c3a8..e3816d1ec 100644 +index 0f524c3a8a..e3816d1ec4 100644 --- a/grub-core/fs/xfs.c +++ b/grub-core/fs/xfs.c @@ -192,6 +192,11 @@ struct grub_xfs_time_legacy diff --git a/0194-Print-module-name-on-license-check-failure.patch b/0194-Print-module-name-on-license-check-failure.patch index f6c6041a..5c308593 100644 --- a/0194-Print-module-name-on-license-check-failure.patch +++ b/0194-Print-module-name-on-license-check-failure.patch @@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 955725403..f30449457 100644 +index 9557254035..f304494574 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -528,14 +528,16 @@ grub_dl_find_section_index (Elf_Ehdr *e, const char *name) diff --git a/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch index 121ed5bc..05417ed9 100644 --- a/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +++ b/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch @@ -79,7 +79,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 3f3459b2c..6b00eb555 100644 +index 3f3459b2c7..6b00eb5557 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -89,7 +89,7 @@ kernel = { @@ -92,7 +92,7 @@ index 3f3459b2c..6b00eb555 100644 mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)'; mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000'; diff --git a/include/grub/offsets.h b/include/grub/offsets.h -index 871e1cd4c..69211aa79 100644 +index 871e1cd4c3..69211aa798 100644 --- a/include/grub/offsets.h +++ b/include/grub/offsets.h @@ -63,7 +63,7 @@ diff --git a/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch index f4936a7a..76b73f52 100644 --- a/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch +++ b/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch @@ -25,7 +25,7 @@ Signed-off-by: Michael Chang 1 file changed, 2 insertions(+) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f55339a3f..520a672cd 100644 +index f55339a3f6..520a672cd2 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -311,7 +311,9 @@ and /etc/grub.d/* files or please file a bug report with diff --git a/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch index 81b7e1c0..3f7198f8 100644 --- a/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch +++ b/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch @@ -32,7 +32,7 @@ Reviewed-by: Daniel Kiper 2 files changed, 79 insertions(+), 13 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 4cc86e9b7..07c0ff874 100644 +index 4cc86e9b79..07c0ff874b 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -2476,6 +2476,33 @@ grub_btrfs_label (grub_device_t device, char **label) @@ -146,7 +146,7 @@ index 4cc86e9b7..07c0ff874 100644 return GRUB_ERR_NONE; } diff --git a/include/grub/disk.h b/include/grub/disk.h -index f95aca929..06210a704 100644 +index f95aca929a..06210a7049 100644 --- a/include/grub/disk.h +++ b/include/grub/disk.h @@ -182,6 +182,8 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t; diff --git a/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch index ba84f9c7..c3e45e4d 100644 --- a/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch +++ b/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch @@ -16,7 +16,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index f069d8403..88e33e0f0 100644 +index f069d84039..88e33e0f0c 100644 --- a/configure.ac +++ b/configure.ac @@ -1785,7 +1785,7 @@ fi diff --git a/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch index 3073238b..200cd51a 100644 --- a/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +++ b/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch @@ -18,7 +18,7 @@ Signed-off-by: Hans de Goede 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index ec0c92bad..c8516a5a0 100644 +index ec0c92bade..c8516a5a08 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -606,13 +606,15 @@ print_countdown (struct grub_term_coordinate *pos, int n) diff --git a/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch index de29340a..0f99c229 100644 --- a/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +++ b/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch @@ -22,7 +22,7 @@ Signed-off-by: Hans de Goede 1 file changed, 3 insertions(+) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 3fc340147..993b8a859 100644 +index 3fc3401472..993b8a8598 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -317,10 +317,13 @@ grub_main (void) diff --git a/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch index 1007041d..ade6aae0 100644 --- a/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +++ b/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch @@ -29,7 +29,7 @@ Signed-off-by: Hans de Goede 1 file changed, 10 insertions(+) diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index 2f1ae85ba..c44b2ac31 100644 +index 2f1ae85ba7..c44b2ac318 100644 --- a/grub-core/term/efi/console.c +++ b/grub-core/term/efi/console.c @@ -82,6 +82,16 @@ grub_console_setcolorstate (struct grub_term_output *term diff --git a/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch index c8674516..5fab5db8 100644 --- a/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +++ b/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch @@ -25,7 +25,7 @@ Signed-off-by: Hans de Goede 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index c44b2ac31..a3622e4fe 100644 +index c44b2ac318..a3622e4fe5 100644 --- a/grub-core/term/efi/console.c +++ b/grub-core/term/efi/console.c @@ -31,7 +31,15 @@ typedef enum { diff --git a/0203-Use-visual-indentation-in-config.h.in.patch b/0203-Use-visual-indentation-in-config.h.in.patch index 88818453..978eb078 100644 --- a/0203-Use-visual-indentation-in-config.h.in.patch +++ b/0203-Use-visual-indentation-in-config.h.in.patch @@ -11,7 +11,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/config.h.in b/config.h.in -index c80e3e0ab..f2ed0066e 100644 +index c80e3e0aba..f2ed0066ec 100644 --- a/config.h.in +++ b/config.h.in @@ -23,47 +23,47 @@ diff --git a/0204-Where-present-ensure-config-util.h-precedes-config.h.patch b/0204-Where-present-ensure-config-util.h-precedes-config.h.patch index 0bfb00e5..626c4b4d 100644 --- a/0204-Where-present-ensure-config-util.h-precedes-config.h.patch +++ b/0204-Where-present-ensure-config-util.h-precedes-config.h.patch @@ -31,7 +31,7 @@ Signed-off-by: Robbie Harwood 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/grub-core/disk/host.c b/grub-core/disk/host.c -index c151d225d..f34529f86 100644 +index c151d225df..f34529f86a 100644 --- a/grub-core/disk/host.c +++ b/grub-core/disk/host.c @@ -20,8 +20,8 @@ @@ -45,7 +45,7 @@ index c151d225d..f34529f86 100644 #include #include diff --git a/grub-core/kern/emu/argp_common.c b/grub-core/kern/emu/argp_common.c -index 166885870..8cb4608c3 100644 +index 1668858703..8cb4608c3d 100644 --- a/grub-core/kern/emu/argp_common.c +++ b/grub-core/kern/emu/argp_common.c @@ -17,8 +17,8 @@ @@ -59,7 +59,7 @@ index 166885870..8cb4608c3 100644 #pragma GCC diagnostic ignored "-Wmissing-prototypes" #pragma GCC diagnostic ignored "-Wmissing-declarations" diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 846fe9715..3e7929cc4 100644 +index 846fe9715e..3e7929cc4a 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -16,8 +16,8 @@ @@ -73,7 +73,7 @@ index 846fe9715..3e7929cc4 100644 #include #include diff --git a/grub-core/osdep/aros/config.c b/grub-core/osdep/aros/config.c -index c82d0ea8e..55f5728ef 100644 +index c82d0ea8e7..55f5728efc 100644 --- a/grub-core/osdep/aros/config.c +++ b/grub-core/osdep/aros/config.c @@ -16,8 +16,8 @@ @@ -87,7 +87,7 @@ index c82d0ea8e..55f5728ef 100644 #include #include diff --git a/grub-core/osdep/basic/emunet.c b/grub-core/osdep/basic/emunet.c -index 6362e5cfb..dbfd316d6 100644 +index 6362e5cfbb..dbfd316d61 100644 --- a/grub-core/osdep/basic/emunet.c +++ b/grub-core/osdep/basic/emunet.c @@ -16,8 +16,8 @@ @@ -101,7 +101,7 @@ index 6362e5cfb..dbfd316d6 100644 #include #include diff --git a/grub-core/osdep/basic/init.c b/grub-core/osdep/basic/init.c -index c54c710db..b104c7e16 100644 +index c54c710dbc..b104c7e162 100644 --- a/grub-core/osdep/basic/init.c +++ b/grub-core/osdep/basic/init.c @@ -16,8 +16,8 @@ @@ -115,7 +115,7 @@ index c54c710db..b104c7e16 100644 #include #include diff --git a/grub-core/osdep/haiku/getroot.c b/grub-core/osdep/haiku/getroot.c -index 4e123c090..927a1ebc9 100644 +index 4e123c0903..927a1ebc94 100644 --- a/grub-core/osdep/haiku/getroot.c +++ b/grub-core/osdep/haiku/getroot.c @@ -1,5 +1,5 @@ @@ -126,7 +126,7 @@ index 4e123c090..927a1ebc9 100644 #include #include diff --git a/grub-core/osdep/linux/emunet.c b/grub-core/osdep/linux/emunet.c -index 19b188f09..d5a641735 100644 +index 19b188f09e..d5a6417355 100644 --- a/grub-core/osdep/linux/emunet.c +++ b/grub-core/osdep/linux/emunet.c @@ -16,8 +16,8 @@ @@ -140,7 +140,7 @@ index 19b188f09..d5a641735 100644 #include #include diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index 46a881530..0ce0e309a 100644 +index 46a881530c..0ce0e309ac 100644 --- a/grub-core/osdep/unix/config.c +++ b/grub-core/osdep/unix/config.c @@ -16,8 +16,8 @@ @@ -154,7 +154,7 @@ index 46a881530..0ce0e309a 100644 #include #include diff --git a/grub-core/osdep/unix/cputime.c b/grub-core/osdep/unix/cputime.c -index cff359a3b..fb6ff55a1 100644 +index cff359a3b9..fb6ff55a1a 100644 --- a/grub-core/osdep/unix/cputime.c +++ b/grub-core/osdep/unix/cputime.c @@ -1,5 +1,5 @@ @@ -165,7 +165,7 @@ index cff359a3b..fb6ff55a1 100644 #include #include diff --git a/grub-core/osdep/unix/dl.c b/grub-core/osdep/unix/dl.c -index 562b101a2..99b189bc1 100644 +index 562b101a28..99b189bc1c 100644 --- a/grub-core/osdep/unix/dl.c +++ b/grub-core/osdep/unix/dl.c @@ -16,8 +16,8 @@ @@ -179,7 +179,7 @@ index 562b101a2..99b189bc1 100644 #include #include diff --git a/grub-core/osdep/unix/emuconsole.c b/grub-core/osdep/unix/emuconsole.c -index 7308798ef..cac159424 100644 +index 7308798efe..cac159424d 100644 --- a/grub-core/osdep/unix/emuconsole.c +++ b/grub-core/osdep/unix/emuconsole.c @@ -17,8 +17,8 @@ @@ -193,7 +193,7 @@ index 7308798ef..cac159424 100644 #include #include diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c -index 46d7116c6..4f436284c 100644 +index 46d7116c6e..4f436284ce 100644 --- a/grub-core/osdep/unix/getroot.c +++ b/grub-core/osdep/unix/getroot.c @@ -16,8 +16,8 @@ @@ -207,7 +207,7 @@ index 46d7116c6..4f436284c 100644 #include #include diff --git a/grub-core/osdep/windows/config.c b/grub-core/osdep/windows/config.c -index 928ab1a49..2bb8a2fd8 100644 +index 928ab1a49b..2bb8a2fd88 100644 --- a/grub-core/osdep/windows/config.c +++ b/grub-core/osdep/windows/config.c @@ -16,8 +16,8 @@ @@ -221,7 +221,7 @@ index 928ab1a49..2bb8a2fd8 100644 #include #include diff --git a/grub-core/osdep/windows/cputime.c b/grub-core/osdep/windows/cputime.c -index 3568aa2d3..5d06d79dd 100644 +index 3568aa2d35..5d06d79dd5 100644 --- a/grub-core/osdep/windows/cputime.c +++ b/grub-core/osdep/windows/cputime.c @@ -1,5 +1,5 @@ @@ -232,7 +232,7 @@ index 3568aa2d3..5d06d79dd 100644 #include #include diff --git a/grub-core/osdep/windows/dl.c b/grub-core/osdep/windows/dl.c -index eec6a24ad..8eab7057e 100644 +index eec6a24ad7..8eab7057e4 100644 --- a/grub-core/osdep/windows/dl.c +++ b/grub-core/osdep/windows/dl.c @@ -16,8 +16,8 @@ @@ -246,7 +246,7 @@ index eec6a24ad..8eab7057e 100644 #include #include diff --git a/grub-core/osdep/windows/emuconsole.c b/grub-core/osdep/windows/emuconsole.c -index 4fb3693cc..17a44de46 100644 +index 4fb3693cc0..17a44de469 100644 --- a/grub-core/osdep/windows/emuconsole.c +++ b/grub-core/osdep/windows/emuconsole.c @@ -16,8 +16,8 @@ @@ -260,7 +260,7 @@ index 4fb3693cc..17a44de46 100644 #include #include diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c -index 6297de632..51a9647dd 100644 +index 6297de6326..51a9647dde 100644 --- a/grub-core/osdep/windows/init.c +++ b/grub-core/osdep/windows/init.c @@ -16,8 +16,8 @@ diff --git a/0205-Drop-gnulib-fix-base64.patch.patch b/0205-Drop-gnulib-fix-base64.patch.patch index 9815550c..054e476e 100644 --- a/0205-Drop-gnulib-fix-base64.patch.patch +++ b/0205-Drop-gnulib-fix-base64.patch.patch @@ -31,7 +31,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h -index f63412c8d..2f3e86549 100644 +index f63412c8da..2f3e865495 100644 --- a/grub-core/lib/posix_wrap/sys/types.h +++ b/grub-core/lib/posix_wrap/sys/types.h @@ -23,11 +23,10 @@ @@ -50,7 +50,7 @@ index f63412c8d..2f3e86549 100644 typedef grub_uint8_t uint8_t; typedef grub_uint16_t uint16_t; diff --git a/grub-core/lib/xzembed/xz.h b/grub-core/lib/xzembed/xz.h -index f7b32d800..d1417039a 100644 +index f7b32d8003..d1417039aa 100644 --- a/grub-core/lib/xzembed/xz.h +++ b/grub-core/lib/xzembed/xz.h @@ -29,10 +29,7 @@ @@ -66,7 +66,7 @@ index f7b32d800..d1417039a 100644 /** * enum xz_ret - Return codes diff --git a/bootstrap.conf b/bootstrap.conf -index 52d4af44b..645e3a459 100644 +index 52d4af44be..645e3a459c 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -35,6 +35,7 @@ gnulib_modules=" @@ -87,7 +87,7 @@ index 52d4af44b..645e3a459 100644 patch -d grub-core/lib/gnulib -p2 \ < "grub-core/lib/gnulib-patches/$patchname.patch" diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index ad235de7f..f4791dc6c 100644 +index ad235de7fc..f4791dc6ca 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -31,7 +31,6 @@ EXTRA_DIST += grub-core/gensymlist.sh @@ -99,7 +99,7 @@ index ad235de7f..f4791dc6c 100644 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch diff --git a/config.h.in b/config.h.in -index f2ed0066e..9c7b4afaa 100644 +index f2ed0066ec..9c7b4afaaa 100644 --- a/config.h.in +++ b/config.h.in @@ -66,4 +66,8 @@ @@ -113,7 +113,7 @@ index f2ed0066e..9c7b4afaa 100644 #endif diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch deleted file mode 100644 -index 985db1279..000000000 +index 985db12797..0000000000 --- a/grub-core/lib/gnulib-patches/fix-base64.patch +++ /dev/null @@ -1,21 +0,0 @@ diff --git a/0206-Drop-gnulib-no-abort.patch.patch b/0206-Drop-gnulib-no-abort.patch.patch index a1a067a1..a12789f3 100644 --- a/0206-Drop-gnulib-no-abort.patch.patch +++ b/0206-Drop-gnulib-no-abort.patch.patch @@ -25,7 +25,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch diff --git a/bootstrap.conf b/bootstrap.conf -index 645e3a459..71ce943c7 100644 +index 645e3a459c..71ce943c7d 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -81,7 +81,7 @@ cp -a INSTALL INSTALL.grub @@ -38,7 +38,7 @@ index 645e3a459..71ce943c7 100644 < "grub-core/lib/gnulib-patches/$patchname.patch" done diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index f4791dc6c..5eef70833 100644 +index f4791dc6ca..5eef708338 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -38,7 +38,6 @@ EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch @@ -50,7 +50,7 @@ index f4791dc6c..5eef70833 100644 EXTRA_DIST += grub-core/lib/libgcrypt EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic diff --git a/config.h.in b/config.h.in -index 9c7b4afaa..c3134309c 100644 +index 9c7b4afaaa..c3134309c6 100644 --- a/config.h.in +++ b/config.h.in @@ -68,6 +68,9 @@ @@ -65,7 +65,7 @@ index 9c7b4afaa..c3134309c 100644 #endif diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch deleted file mode 100644 -index e469c4762..000000000 +index e469c4762e..0000000000 --- a/grub-core/lib/gnulib-patches/no-abort.patch +++ /dev/null @@ -1,26 +0,0 @@ diff --git a/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch index fd44c8f1..f0e2cc02 100644 --- a/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch +++ b/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch @@ -48,7 +48,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch diff --git a/configure.ac b/configure.ac -index 88e33e0f0..871235b91 100644 +index 88e33e0f0c..871235b91b 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,7 @@ AC_CANONICAL_TARGET @@ -61,7 +61,7 @@ index 88e33e0f0..871235b91 100644 AC_CONFIG_HEADER([config-util.h]) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 6b00eb555..39233096f 100644 +index 6b00eb5557..39233096f2 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -762,6 +762,9 @@ module = { @@ -75,7 +75,7 @@ index 6b00eb555..39233096f 100644 cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c -index 371a53b83..c917a5f91 100644 +index 371a53b837..c917a5f91e 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -389,7 +389,7 @@ luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key, @@ -97,7 +97,7 @@ index 371a53b83..c917a5f91 100644 const gcry_md_spec_t *hash; gcry_err_code_t gcry_ret; diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h -index 591dbf328..4be7b4080 100644 +index 591dbf3289..4be7b40806 100644 --- a/grub-core/lib/posix_wrap/limits.h +++ b/grub-core/lib/posix_wrap/limits.h @@ -25,7 +25,11 @@ @@ -114,7 +114,7 @@ index 591dbf328..4be7b4080 100644 #define SCHAR_MIN GRUB_SCHAR_MIN #define SCHAR_MAX GRUB_SCHAR_MAX diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index ebafec689..441a9eca0 100644 +index ebafec6895..441a9eca07 100644 --- a/include/grub/compiler.h +++ b/include/grub/compiler.h @@ -30,10 +30,10 @@ @@ -131,7 +131,7 @@ index ebafec689..441a9eca0 100644 #if GNUC_PREREQ(4,4) diff --git a/include/grub/list.h b/include/grub/list.h -index b13acb962..21f4b4b44 100644 +index b13acb9624..21f4b4b44a 100644 --- a/include/grub/list.h +++ b/include/grub/list.h @@ -40,7 +40,7 @@ void EXPORT_FUNC(grub_list_remove) (grub_list_t item); @@ -144,7 +144,7 @@ index b13acb962..21f4b4b44 100644 static inline void * grub_bad_type_cast_real (int line, const char *file) diff --git a/INSTALL b/INSTALL -index 79a0af7d9..ee9f536f7 100644 +index 79a0af7d93..ee9f536f76 100644 --- a/INSTALL +++ b/INSTALL @@ -42,7 +42,7 @@ If you use a development snapshot or want to hack on GRUB you may @@ -157,7 +157,7 @@ index 79a0af7d9..ee9f536f7 100644 Prerequisites for make-check: diff --git a/bootstrap b/bootstrap -index 5b08e7e2d..dc2238f4a 100755 +index 5b08e7e2d4..dc2238f4ad 100755 --- a/bootstrap +++ b/bootstrap @@ -1,10 +1,10 @@ @@ -563,7 +563,7 @@ index 5b08e7e2d..dc2238f4a 100755 # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" diff --git a/bootstrap.conf b/bootstrap.conf -index 71ce943c7..e4e5f3750 100644 +index 71ce943c7d..e4e5f3750a 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -1,6 +1,6 @@ @@ -618,7 +618,7 @@ index 71ce943c7..e4e5f3750 100644 0001-Support-POTFILES-shell \ 0002-Handle-gettext_printf-shell-function \ diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 5eef70833..26ac8765e 100644 +index 5eef708338..26ac8765e3 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -31,12 +31,6 @@ EXTRA_DIST += grub-core/gensymlist.sh @@ -635,7 +635,7 @@ index 5eef70833..26ac8765e 100644 EXTRA_DIST += grub-core/lib/libgcrypt diff --git a/config.h.in b/config.h.in -index c3134309c..512d1bbe1 100644 +index c3134309c6..512d1bbe13 100644 --- a/config.h.in +++ b/config.h.in @@ -67,10 +67,78 @@ @@ -719,7 +719,7 @@ index c3134309c..512d1bbe1 100644 #endif diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch deleted file mode 100644 -index 8fafa153a..000000000 +index 8fafa153a4..0000000000 --- a/grub-core/lib/gnulib-patches/fix-null-deref.patch +++ /dev/null @@ -1,13 +0,0 @@ @@ -738,7 +738,7 @@ index 8fafa153a..000000000 - struct parser *parser = state->pstate; diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch deleted file mode 100644 -index 813ec09c8..000000000 +index 813ec09c8a..0000000000 --- a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch +++ /dev/null @@ -1,12 +0,0 @@ @@ -756,7 +756,7 @@ index 813ec09c8..000000000 - "rmargin", up->name); diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch deleted file mode 100644 -index 02e06315d..000000000 +index 02e06315df..0000000000 --- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch +++ /dev/null @@ -1,15 +0,0 @@ @@ -777,7 +777,7 @@ index 02e06315d..000000000 - diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch deleted file mode 100644 -index db6dac9c9..000000000 +index db6dac9c9e..0000000000 --- a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch +++ /dev/null @@ -1,12 +0,0 @@ @@ -795,7 +795,7 @@ index db6dac9c9..000000000 - || (next_state_log_idx >= mctx->input.valid_len diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch deleted file mode 100644 -index 7b4d9f67a..000000000 +index 7b4d9f67af..0000000000 --- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch +++ /dev/null @@ -1,11 +0,0 @@ @@ -812,7 +812,7 @@ index 7b4d9f67a..000000000 - sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch deleted file mode 100644 -index ba51f1bf2..000000000 +index ba51f1bf22..0000000000 --- a/grub-core/lib/gnulib-patches/fix-unused-value.patch +++ /dev/null @@ -1,14 +0,0 @@ diff --git a/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch index 461a1b86..4f7feb93 100644 --- a/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +++ b/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch @@ -19,7 +19,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index ed090b3af..51656e361 100644 +index ed090b3af8..51656e361c 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -64,7 +64,7 @@ iterate_device (const char *name, void *data) diff --git a/0209-search-new-efidisk-only-option-on-EFI-systems.patch b/0209-search-new-efidisk-only-option-on-EFI-systems.patch index 02e2412a..3f6194ab 100644 --- a/0209-search-new-efidisk-only-option-on-EFI-systems.patch +++ b/0209-search-new-efidisk-only-option-on-EFI-systems.patch @@ -26,7 +26,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index 51656e361..57d26ced8 100644 +index 51656e361c..57d26ced8a 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -47,7 +47,7 @@ struct search_ctx @@ -86,7 +86,7 @@ index 51656e361..57d26ced8 100644 .nhints = nhints, .count = 0, diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c -index 47fc8eb99..0b62acf85 100644 +index 47fc8eb996..0b62acf853 100644 --- a/grub-core/commands/search_wrap.c +++ b/grub-core/commands/search_wrap.c @@ -40,6 +40,7 @@ static const struct grub_arg_option options[] = @@ -139,7 +139,7 @@ index 47fc8eb99..0b62acf85 100644 grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type"); diff --git a/include/grub/search.h b/include/grub/search.h -index d80347df3..4190aeb2c 100644 +index d80347df34..4190aeb2cb 100644 --- a/include/grub/search.h +++ b/include/grub/search.h @@ -19,11 +19,20 @@ diff --git a/0210-efi-new-connectefi-command.patch b/0210-efi-new-connectefi-command.patch index 524412ca..55a49fd1 100644 --- a/0210-efi-new-connectefi-command.patch +++ b/0210-efi-new-connectefi-command.patch @@ -64,7 +64,7 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/efi/connectefi.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 39233096f..3c0ac3b7b 100644 +index 39233096f2..3c0ac3b7bd 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -836,6 +836,12 @@ module = { @@ -82,7 +82,7 @@ index 39233096f..3c0ac3b7b 100644 common = commands/blocklist.c; diff --git a/grub-core/commands/efi/connectefi.c b/grub-core/commands/efi/connectefi.c new file mode 100644 -index 000000000..8ab75bd51 +index 0000000000..8ab75bd51b --- /dev/null +++ b/grub-core/commands/efi/connectefi.c @@ -0,0 +1,205 @@ @@ -292,7 +292,7 @@ index 000000000..8ab75bd51 + grub_unregister_command (cmd); +} diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c -index d1ce99af4..f2d2430e6 100644 +index d1ce99af43..f2d2430e66 100644 --- a/grub-core/commands/efi/lsefi.c +++ b/grub-core/commands/efi/lsefi.c @@ -19,6 +19,7 @@ @@ -304,7 +304,7 @@ index d1ce99af4..f2d2430e6 100644 #include #include diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index fe8ba6e6c..062143dff 100644 +index fe8ba6e6c9..062143dfff 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -396,6 +396,19 @@ enumerate_disks (void) @@ -328,7 +328,7 @@ index fe8ba6e6c..062143dff 100644 grub_efidisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, grub_disk_pull_t pull) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 14bc10eb5..7fcca69c1 100644 +index 14bc10eb56..7fcca69c17 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c @@ -95,6 +95,19 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type, @@ -352,7 +352,7 @@ index 14bc10eb5..7fcca69c1 100644 grub_efi_open_protocol (grub_efi_handle_t handle, grub_efi_guid_t *protocol, diff --git a/include/grub/efi/disk.h b/include/grub/efi/disk.h -index 254475c84..6845c2f1f 100644 +index 254475c842..6845c2f1fd 100644 --- a/include/grub/efi/disk.h +++ b/include/grub/efi/disk.h @@ -27,6 +27,8 @@ grub_efi_handle_t @@ -365,7 +365,7 @@ index 254475c84..6845c2f1f 100644 void grub_efidisk_fini (void); diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 8dfc89a33..ec52083c4 100644 +index 8dfc89a33b..ec52083c49 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -41,6 +41,11 @@ EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type, @@ -381,7 +381,7 @@ index 8dfc89a33..ec52083c4 100644 grub_efi_guid_t *protocol, grub_efi_uint32_t attributes); diff --git a/NEWS b/NEWS -index 73b8492bc..d7c1d23ae 100644 +index 73b8492bc4..d7c1d23aed 100644 --- a/NEWS +++ b/NEWS @@ -98,7 +98,7 @@ New in 2.02: diff --git a/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch index 869d0a4e..4fe8adf7 100644 --- a/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +++ b/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch @@ -34,7 +34,7 @@ Signed-off-by: Dimitri John Ledkov 1 file changed, 13 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3cf0f9b33..941df6400 100644 +index 3cf0f9b330..941df6400b 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -30,7 +30,6 @@ diff --git a/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch index 5d76beb3..5b450f9f 100644 --- a/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +++ b/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch @@ -19,7 +19,7 @@ Signed-off-by: Dimitri John Ledkov 1 file changed, 13 deletions(-) diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index f18d90bd7..d2af47c2c 100644 +index f18d90bd74..d2af47c2c0 100644 --- a/grub-core/loader/arm64/linux.c +++ b/grub-core/loader/arm64/linux.c @@ -34,7 +34,6 @@ diff --git a/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch index adc81794..4c56d60d 100644 --- a/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +++ b/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch @@ -39,7 +39,7 @@ Signed-off-by: Dimitri John Ledkov 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 3af6b1229..644cd2e56 100644 +index 3af6b12292..644cd2e56f 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -906,7 +906,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), diff --git a/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch index c298c04a..c683fcb7 100644 --- a/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +++ b/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch @@ -18,7 +18,7 @@ Signed-off-by: Dimitri John Ledkov 2 files changed, 42 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 9260731c1..9265cf420 100644 +index 9260731c10..9265cf4200 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -24,46 +24,6 @@ @@ -69,7 +69,7 @@ index 9260731c1..9265cf420 100644 #pragma GCC diagnostic ignored "-Wcast-align" diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h -index 0033d9305..887b02fd9 100644 +index 0033d9305a..887b02fd9f 100644 --- a/include/grub/efi/linux.h +++ b/include/grub/efi/linux.h @@ -22,8 +22,6 @@ diff --git a/grub2.spec b/grub2.spec index 3ce0542c..16d55873 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 36%{?dist} +Release: 37%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -529,6 +529,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Apr 18 2022 Robbie Harwood - 1:2.06-37 +- Attempt to fix version display + * Mon Apr 18 2022 Robbie Harwood - 2.06-36 - Fix permission change report from rpm verification on grub.cfg From ac52d21d8ab6b10186055178ade58a6d95164d76 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 19 Apr 2022 07:12:27 +0000 Subject: [PATCH 128/294] Fix mkformat error from grub2-mkrescue grub2-tools-extra missing dependency on mformat (mtools). [rharwood: NVR fix, commit message] Signed-off-by: Robbie Harwood --- grub2.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 16d55873..d8378f88 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 37%{?dist} +Release: 38%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -132,6 +132,7 @@ Summary: Support tools for GRUB. Requires: gettext os-prober file Requires: grub2-tools-minimal = %{epoch}:%{version}-%{release} Requires: grub2-common = %{epoch}:%{version}-%{release} +Requires: mtools Obsoletes: grub2-tools < %{evr} %description tools-extra @@ -529,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Apr 19 2022 Dominik Mierzejewski - 1:2.06-38 +- fix "grub2-mkrescue: error: `mformat` invocation failed" + * Mon Apr 18 2022 Robbie Harwood - 1:2.06-37 - Attempt to fix version display From d15d46b0e44d87390321bc5e0868b8d8a5002ec8 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 4 May 2022 18:00:02 +0000 Subject: [PATCH 129/294] ppc64le: CAS improvements, prefix detection, and vTPM support Signed-off-by: Robbie Harwood --- ...erpc-do-CAS-in-a-more-compatible-way.patch | 110 ++++++++ ...etection-support-device-names-with-c.patch | 71 ++++++ ...ort-for-trusted-boot-using-a-vTPM-2..patch | 236 ++++++++++++++++++ grub.patches | 3 + grub2.spec | 5 +- 5 files changed, 424 insertions(+), 1 deletion(-) create mode 100644 0215-powerpc-do-CAS-in-a-more-compatible-way.patch create mode 100644 0216-powerpc-prefix-detection-support-device-names-with-c.patch create mode 100644 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch diff --git a/0215-powerpc-do-CAS-in-a-more-compatible-way.patch b/0215-powerpc-do-CAS-in-a-more-compatible-way.patch new file mode 100644 index 00000000..20b95f75 --- /dev/null +++ b/0215-powerpc-do-CAS-in-a-more-compatible-way.patch @@ -0,0 +1,110 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 8 Apr 2022 12:35:28 +1000 +Subject: [PATCH] powerpc: do CAS in a more compatible way + +I wrongly assumed that the most compatible way to perform CAS +negotiation was to only set the minimum number of vectors required +to ask for more memory. It turns out that this messes up booting +if the minimum VP capacity would be less than the default 10% in +vector 4. + +Linux configures the minimum capacity to be 1%, so copy it for that +and for vector 3 which we now need to specify as well. + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/ieee1275/init.c | 54 ++++++++++++++++++++++++------------------ + 1 file changed, 31 insertions(+), 23 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 9704715c83..ef55107467 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -298,33 +298,37 @@ grub_ieee1275_total_mem (grub_uint64_t *total) + + /* Based on linux - arch/powerpc/kernel/prom_init.c */ + struct option_vector2 { +- grub_uint8_t byte1; +- grub_uint16_t reserved; +- grub_uint32_t real_base; +- grub_uint32_t real_size; +- grub_uint32_t virt_base; +- grub_uint32_t virt_size; +- grub_uint32_t load_base; +- grub_uint32_t min_rma; +- grub_uint32_t min_load; +- grub_uint8_t min_rma_percent; +- grub_uint8_t max_pft_size; ++ grub_uint8_t byte1; ++ grub_uint16_t reserved; ++ grub_uint32_t real_base; ++ grub_uint32_t real_size; ++ grub_uint32_t virt_base; ++ grub_uint32_t virt_size; ++ grub_uint32_t load_base; ++ grub_uint32_t min_rma; ++ grub_uint32_t min_load; ++ grub_uint8_t min_rma_percent; ++ grub_uint8_t max_pft_size; + } __attribute__((packed)); + + struct pvr_entry { +- grub_uint32_t mask; +- grub_uint32_t entry; ++ grub_uint32_t mask; ++ grub_uint32_t entry; + }; + + struct cas_vector { +- struct { +- struct pvr_entry terminal; +- } pvr_list; +- grub_uint8_t num_vecs; +- grub_uint8_t vec1_size; +- grub_uint8_t vec1; +- grub_uint8_t vec2_size; +- struct option_vector2 vec2; ++ struct { ++ struct pvr_entry terminal; ++ } pvr_list; ++ grub_uint8_t num_vecs; ++ grub_uint8_t vec1_size; ++ grub_uint8_t vec1; ++ grub_uint8_t vec2_size; ++ struct option_vector2 vec2; ++ grub_uint8_t vec3_size; ++ grub_uint16_t vec3; ++ grub_uint8_t vec4_size; ++ grub_uint16_t vec4; + } __attribute__((packed)); + + /* Call ibm,client-architecture-support to try to get more RMA. +@@ -345,13 +349,17 @@ grub_ieee1275_ibm_cas (void) + } args; + struct cas_vector vector = { + .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ +- .num_vecs = 2 - 1, ++ .num_vecs = 4 - 1, + .vec1_size = 0, + .vec1 = 0x80, /* ignore */ + .vec2_size = 1 + sizeof(struct option_vector2) - 2, + .vec2 = { + 0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48 + }, ++ .vec3_size = 2 - 1, ++ .vec3 = 0x00e0, // ask for FP + VMX + DFP but don't halt if unsatisfied ++ .vec4_size = 2 - 1, ++ .vec4 = 0x0001, // set required minimum capacity % to the lowest value + }; + + INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); +@@ -364,7 +372,7 @@ grub_ieee1275_ibm_cas (void) + args.ihandle = root; + args.cas_addr = (grub_ieee1275_cell_t)&vector; + +- grub_printf("Calling ibm,client-architecture-support..."); ++ grub_printf("Calling ibm,client-architecture-support from grub..."); + IEEE1275_CALL_ENTRY_FN (&args); + grub_printf("done\n"); + diff --git a/0216-powerpc-prefix-detection-support-device-names-with-c.patch b/0216-powerpc-prefix-detection-support-device-names-with-c.patch new file mode 100644 index 00000000..1c16fd39 --- /dev/null +++ b/0216-powerpc-prefix-detection-support-device-names-with-c.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 24 Mar 2022 14:34:32 +1100 +Subject: [PATCH] powerpc: prefix detection: support device names with commas + +Frustratingly, the device name itself can contain an embedded comma: +e.g /pci@800000020000015/pci1014,034A@0/sas/disk@5000c50098a0ee8b + +So my previous approach was wrong: we cannot rely upon the presence +of a comma to say that a partition has been specified! + +It turns out for prefixes like (,gpt2)/grub2 we really want to make +up a full (device,partition)/patch prefix, because root discovery code +in 10_linux will reset the root variable and use search to fill it again. +If you have run grub-install, you probably don't have search built in, +and if you don't have prefix containing (device,partition), grub will +construct ($root)$prefix/powerpc-ieee1275/search.mod - but because $root +has just been changed, this will no longer work, and the boot will fail! + +Retain the gist of the logic, but instead of looking for a comma, look for +a leading '('. This matches the earlier code better anyway. + +There's certainly a better fix to be had. But any time you chose to build +with a bare prefix like '/grub2', you're almost certainly going to build in +search anyway, so this will do. + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/main.c | 27 +++++++++++++++++++++------ + 1 file changed, 21 insertions(+), 6 deletions(-) + +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index 993b8a8598..e94a2f78fb 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -242,14 +242,29 @@ grub_set_prefix_and_root (void) + what sorts of paths represent disks with partition tables and those + without partition tables. + +- So we act unless there is a comma in the device, which would indicate +- a partition has already been specified. ++ - Frustratingly, the device name itself can contain an embedded comma: ++ /pci@800000020000015/pci1014,034A@0/sas/disk@5000c50098a0ee8b ++ So we cannot even rely upon the presence of a comma to say that a ++ partition has been specified! + +- (If we only have a path, the code in normal to discover config files +- will try both without partitions and then with any partitions so we +- will cover both CDs and HDs.) ++ If we only have a path in $prefix, the code in normal to discover ++ config files will try all disks, both without partitions and then with ++ any partitions so we will cover both CDs and HDs. ++ ++ However, it doesn't then set the prefix to be something like ++ (discovered partition)/path, and so it is fragile against runtime ++ changes to $root. For example some of the stuff done in 10_linux to ++ reload $root sets root differently and then uses search to find it ++ again. If the search module is not built in, when we change root, grub ++ will look in (new root)/path/powerpc-ieee1275, that won't work, and we ++ will not be able to load the search module and the boot will fail. ++ ++ This is particularly likely to hit us in the grub-install ++ (,msdos2)/grub2 case, so we act unless the supplied prefix starts with ++ '(', which would likely indicate a partition has already been ++ specified. + */ +- if (grub_strchr (device, ',') == NULL) ++ if (prefix && prefix[0] != '(') + grub_env_set ("prefix", path); + else + #endif diff --git a/0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch b/0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch new file mode 100644 index 00000000..3c73469d --- /dev/null +++ b/0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch @@ -0,0 +1,236 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stefan Berger +Date: Sun, 15 Mar 2020 12:37:10 -0400 +Subject: [PATCH] ibmvtpm: Add support for trusted boot using a vTPM 2.0 + +Add support for trusted boot using a vTPM 2.0 on the IBM IEEE1275 +PowerPC platform. With this patch grub now measures text and binary data +into the TPM's PCRs 8 and 9 in the same way as the x86_64 platform +does. + +This patch requires Daniel Axtens's patches for claiming more memory. + +For vTPM support to work on PowerVM, system driver levels 1010.30 +or 1020.00 are required. + +Note: Previous versions of firmware levels with the 2hash-ext-log +API call have a bug that, once this API call is invoked, has the +effect of disabling the vTPM driver under Linux causing an error +message to be displayed in the Linux kernel log. Those users will +have to update their machines to the firmware levels mentioned +above. + +Cc: Eric Snowberg +Signed-off-by: Stefan Berger +--- + grub-core/Makefile.core.def | 7 ++ + grub-core/commands/ieee1275/ibmvtpm.c | 152 ++++++++++++++++++++++++++++++++++ + include/grub/ieee1275/ieee1275.h | 3 + + docs/grub.texi | 3 +- + 4 files changed, 164 insertions(+), 1 deletion(-) + create mode 100644 grub-core/commands/ieee1275/ibmvtpm.c + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 3c0ac3b7bd..2c1608bca4 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -1175,6 +1175,13 @@ module = { + enable = powerpc_ieee1275; + }; + ++module = { ++ name = tpm; ++ common = commands/tpm.c; ++ ieee1275 = commands/ieee1275/ibmvtpm.c; ++ enable = powerpc_ieee1275; ++}; ++ + module = { + name = terminal; + common = commands/terminal.c; +diff --git a/grub-core/commands/ieee1275/ibmvtpm.c b/grub-core/commands/ieee1275/ibmvtpm.c +new file mode 100644 +index 0000000000..e68b8448bc +--- /dev/null ++++ b/grub-core/commands/ieee1275/ibmvtpm.c +@@ -0,0 +1,152 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2021 Free Software Foundation, Inc. ++ * Copyright (C) 2021 IBM Corporation ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ * ++ * IBM vTPM support code. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static grub_ieee1275_ihandle_t tpm_ihandle; ++static grub_uint8_t tpm_version; ++ ++#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_ihandle_t)0) ++ ++static void ++tpm_get_tpm_version (void) ++{ ++ grub_ieee1275_phandle_t vtpm; ++ char buffer[20]; ++ ++ if (!grub_ieee1275_finddevice ("/vdevice/vtpm", &vtpm) && ++ !grub_ieee1275_get_property (vtpm, "compatible", buffer, ++ sizeof (buffer), NULL) && ++ !grub_strcmp (buffer, "IBM,vtpm20")) ++ tpm_version = 2; ++} ++ ++static grub_err_t ++tpm_init (void) ++{ ++ static int init_success = 0; ++ ++ if (!init_success) ++ { ++ if (grub_ieee1275_open ("/vdevice/vtpm", &tpm_ihandle) < 0) { ++ tpm_ihandle = IEEE1275_IHANDLE_INVALID; ++ return GRUB_ERR_UNKNOWN_DEVICE; ++ } ++ ++ init_success = 1; ++ ++ tpm_get_tpm_version (); ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++static int ++ibmvtpm_2hash_ext_log (grub_uint8_t pcrindex, ++ grub_uint32_t eventtype, ++ const char *description, ++ grub_size_t description_size, ++ void *buf, grub_size_t size) ++{ ++ struct tpm_2hash_ext_log ++ { ++ struct grub_ieee1275_common_hdr common; ++ grub_ieee1275_cell_t method; ++ grub_ieee1275_cell_t ihandle; ++ grub_ieee1275_cell_t size; ++ grub_ieee1275_cell_t buf; ++ grub_ieee1275_cell_t description_size; ++ grub_ieee1275_cell_t description; ++ grub_ieee1275_cell_t eventtype; ++ grub_ieee1275_cell_t pcrindex; ++ grub_ieee1275_cell_t catch_result; ++ grub_ieee1275_cell_t rc; ++ } ++ args; ++ ++ INIT_IEEE1275_COMMON (&args.common, "call-method", 8, 2); ++ args.method = (grub_ieee1275_cell_t) "2hash-ext-log"; ++ args.ihandle = tpm_ihandle; ++ args.pcrindex = pcrindex; ++ args.eventtype = eventtype; ++ args.description = (grub_ieee1275_cell_t) description; ++ args.description_size = description_size; ++ args.buf = (grub_ieee1275_cell_t) buf; ++ args.size = (grub_ieee1275_cell_t) size; ++ ++ if (IEEE1275_CALL_ENTRY_FN (&args) == -1) ++ return -1; ++ ++ /* ++ * catch_result is set if firmware does not support 2hash-ext-log ++ * rc is GRUB_IEEE1275_CELL_FALSE (0) on failure ++ */ ++ if ((args.catch_result) || args.rc == GRUB_IEEE1275_CELL_FALSE) ++ return -1; ++ ++ return 0; ++} ++ ++static grub_err_t ++tpm2_log_event (unsigned char *buf, ++ grub_size_t size, grub_uint8_t pcr, ++ const char *description) ++{ ++ static int error_displayed = 0; ++ int err; ++ ++ err = ibmvtpm_2hash_ext_log (pcr, EV_IPL, ++ description, ++ grub_strlen(description) + 1, ++ buf, size); ++ if (err && !error_displayed) ++ { ++ error_displayed++; ++ return grub_error (GRUB_ERR_BAD_DEVICE, ++ "2HASH-EXT-LOG failed: Firmware is likely too old.\n"); ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++grub_err_t ++grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, ++ const char *description) ++{ ++ grub_err_t err = tpm_init(); ++ ++ /* Absence of a TPM isn't a failure. */ ++ if (err != GRUB_ERR_NONE) ++ return GRUB_ERR_NONE; ++ ++ grub_dprintf ("tpm", "log_event, pcr = %d, size = 0x%" PRIxGRUB_SIZE ", %s\n", ++ pcr, size, description); ++ ++ if (tpm_version == 2) ++ return tpm2_log_event (buf, size, pcr, description); ++ ++ return GRUB_ERR_NONE; ++} +diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h +index e0a6c2ce1e..f4c85265fe 100644 +--- a/include/grub/ieee1275/ieee1275.h ++++ b/include/grub/ieee1275/ieee1275.h +@@ -24,6 +24,9 @@ + #include + #include + ++#define GRUB_IEEE1275_CELL_FALSE ((grub_ieee1275_cell_t) 0) ++#define GRUB_IEEE1275_CELL_TRUE ((grub_ieee1275_cell_t) -1) ++ + struct grub_ieee1275_mem_region + { + unsigned int start; +diff --git a/docs/grub.texi b/docs/grub.texi +index a4da9c2a1b..c433240f34 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -6221,7 +6221,8 @@ tpm module is loaded. As such it is recommended that the tpm module be built + into @file{core.img} in order to avoid a potential gap in measurement between + @file{core.img} being loaded and the tpm module being loaded. + +-Measured boot is currently only supported on EFI platforms. ++Measured boot is currently only supported on EFI and IBM IEEE1275 PowerPC ++platforms. + + @node Lockdown + @section Lockdown when booting on a secure setup diff --git a/grub.patches b/grub.patches index 286d0113..31f747ba 100644 --- a/grub.patches +++ b/grub.patches @@ -212,3 +212,6 @@ Patch0211: 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch Patch0212: 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch Patch0213: 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch Patch0214: 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0215: 0215-powerpc-do-CAS-in-a-more-compatible-way.patch +Patch0216: 0216-powerpc-prefix-detection-support-device-names-with-c.patch +Patch0217: 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch diff --git a/grub2.spec b/grub2.spec index d8378f88..63806535 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 38%{?dist} +Release: 39%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed May 04 2022 Robbie Harwood - 1:2.06-39 +- ppc64le: CAS improvements, prefix detection, and vTPM support + * Tue Apr 19 2022 Dominik Mierzejewski - 1:2.06-38 - fix "grub2-mkrescue: error: `mformat` invocation failed" From ea7cfdf72690c5d6e15af02a3e395a40dd24f7c7 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 5 May 2022 22:14:21 +0000 Subject: [PATCH 130/294] Fix missing declaration of strchrnul in rpm-sort Signed-off-by: Robbie Harwood --- ...prereqs-for-declaration-of-strchrnul.patch | 36 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch diff --git a/0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch b/0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch new file mode 100644 index 00000000..d2458d00 --- /dev/null +++ b/0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Thu, 5 May 2022 18:01:05 -0400 +Subject: [PATCH] rpm-sort: add prereqs for declaration of strchrnul() + +Signed-off-by: Robbie Harwood +--- + util/grub-rpm-sort.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c +index 8345944105..71d038bb69 100644 +--- a/util/grub-rpm-sort.c ++++ b/util/grub-rpm-sort.c +@@ -1,13 +1,17 @@ ++#define _GNU_SOURCE 1 ++ + #include ++ ++#include ++#include ++#include + #include + #include ++#include + #include + #include ++#include + #include +-#include +-#include +-#include +-#include + + static size_t + read_file (const char *input, char **ret) diff --git a/grub.patches b/grub.patches index 31f747ba..7e54e28b 100644 --- a/grub.patches +++ b/grub.patches @@ -215,3 +215,4 @@ Patch0214: 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch Patch0215: 0215-powerpc-do-CAS-in-a-more-compatible-way.patch Patch0216: 0216-powerpc-prefix-detection-support-device-names-with-c.patch Patch0217: 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +Patch0218: 0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch diff --git a/grub2.spec b/grub2.spec index 63806535..44f66af9 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 39%{?dist} +Release: 40%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu May 05 2022 Robbie Harwood - 1:2.06-40 +- Fix missing declaration of strchrnul in rpm-sort + * Wed May 04 2022 Robbie Harwood - 1:2.06-39 - ppc64le: CAS improvements, prefix detection, and vTPM support From a44a6377ed136bded4d1f3a0fa03e0950b737a03 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 16 May 2022 21:15:56 +0000 Subject: [PATCH 131/294] ppc64le: make ofdisk retries optional Signed-off-by: Robbie Harwood --- 0219-make-ofdisk_retries-optional.patch | 43 +++++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 0219-make-ofdisk_retries-optional.patch diff --git a/0219-make-ofdisk_retries-optional.patch b/0219-make-ofdisk_retries-optional.patch new file mode 100644 index 00000000..fce9702d --- /dev/null +++ b/0219-make-ofdisk_retries-optional.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Diego Domingos +Date: Thu, 24 Mar 2022 13:14:42 -0400 +Subject: [PATCH] make ofdisk_retries optional + +The feature Retry on Fail added to GRUB can cause a LPM to take +longer if the SAN is slow. + +When a LPM to external site occur, the path of the disk can change +and thus the disk search function on grub can take some time since +it is used as a hint. This can cause the Retry on Fail feature to +try to access the disk 20x times (since this is hardcoded number) +and, if the SAN is slow, the boot time can increase a lot. +In some situations not acceptable. + +The following patch enables a configuration at user space of the +maximum number of retries we want for this feature. + +The variable ofdisk_retries should be set using grub2-editenv +and will be checked by retry function. If the variable is not set, +so the default number of retries will be used instead. +--- + include/grub/ieee1275/ofdisk.h | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h +index 7d2d540930..0074d55eee 100644 +--- a/include/grub/ieee1275/ofdisk.h ++++ b/include/grub/ieee1275/ofdisk.h +@@ -25,7 +25,12 @@ extern void grub_ofdisk_fini (void); + #define MAX_RETRIES 20 + + +-#define RETRY_IEEE1275_OFDISK_OPEN(device, last_ihandle) unsigned retry_i=0;for(retry_i=0; retry_i < MAX_RETRIES; retry_i++){ \ ++#define RETRY_IEEE1275_OFDISK_OPEN(device, last_ihandle) \ ++ unsigned max_retries = MAX_RETRIES; \ ++ if(grub_env_get("ofdisk_retries") != NULL) \ ++ max_retries = grub_strtoul(grub_env_get("ofdisk_retries"), 0, 10)+1; \ ++ grub_dprintf("ofdisk","MAX_RETRIES set to %u\n",max_retries); \ ++ unsigned retry_i=0;for(retry_i=0; retry_i < max_retries; retry_i++){ \ + if(!grub_ieee1275_open(device, last_ihandle)) \ + break; \ + grub_dprintf("ofdisk","Opening disk %s failed. Retrying...\n",device); } diff --git a/grub.patches b/grub.patches index 7e54e28b..b520d470 100644 --- a/grub.patches +++ b/grub.patches @@ -216,3 +216,4 @@ Patch0215: 0215-powerpc-do-CAS-in-a-more-compatible-way.patch Patch0216: 0216-powerpc-prefix-detection-support-device-names-with-c.patch Patch0217: 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch Patch0218: 0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch +Patch0219: 0219-make-ofdisk_retries-optional.patch diff --git a/grub2.spec b/grub2.spec index 44f66af9..bcebe4c7 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 40%{?dist} +Release: 41%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon May 16 2022 Robbie Harwood - 1:2.06-41 +- ppc64le: make ofdisk retries optional + * Thu May 05 2022 Robbie Harwood - 1:2.06-40 - Fix missing declaration of strchrnul in rpm-sort From f0ad2aaa267a5d99b47f5c5770a55de0a702fdf0 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 16 May 2022 21:17:35 +0000 Subject: [PATCH 132/294] CVE fixes for 2022-05-24 Resolves: CVE-2022-28736 CVE-2022-28735 CVE-2022-28734 CVE-2022-28733 Resolves: CVE-2021-3697 CVE-2021-3696 CVE-2021-3695 Signed-off-by: Robbie Harwood --- ...loader-grub_load_and_start_image-doe.patch | 69 +++ ...hainloader-simplify-the-loader-state.patch | 330 ++++++++++ ...ot-Add-API-to-pass-context-to-loader.patch | 158 +++++ ...i-chainloader-Use-grub_loader_set_ex.patch | 147 +++++ ...linux-Avoid-a-use-after-free-in-the-.patch | 41 ++ ...386-efi-linux-Use-grub_loader_set_ex.patch | 296 +++++++++ ...linux-Fix-a-memory-leak-in-the-initr.patch | 75 +++ ...ct-non-kernel-files-in-the-shim_lock.patch | 101 ++++ ...-leak-device_name-on-error-in-grub_f.patch | 39 ++ ...g-Abort-sooner-if-a-read-operation-f.patch | 198 ++++++ ...g-Refuse-to-handle-multiple-image-he.patch | 28 + ...g-Drop-greyscale-support-to-fix-heap.patch | 170 ++++++ ...g-Avoid-heap-OOB-R-W-inserting-huff-.patch | 40 ++ ...-png-Sanity-check-some-huffman-codes.patch | 40 ++ ...eg-Abort-sooner-if-a-read-operation-.patch | 255 ++++++++ ...eg-Do-not-reallocate-a-given-huff-ta.patch | 29 + ...eg-Refuse-to-handle-multiple-start-o.patch | 44 ++ ...eg-Block-int-underflow-wild-pointer-.patch | 53 ++ ...ix-array-out-of-bounds-formatting-un.patch | 34 ++ ...ff-Block-overly-large-netbuff-allocs.patch | 46 ++ 0240-net-ip-Do-IP-fragment-maths-safely.patch | 44 ++ ...le-free-addresses-on-corrupt-DNS-res.patch | 56 ++ ...ad-past-the-end-of-the-string-we-re-.patch | 71 +++ ...-a-UAF-and-double-free-from-a-failed.patch | 112 ++++ 0244-net-tftp-Avoid-a-trivial-UAF.patch | 35 ++ ...tear-down-socket-if-it-s-already-bee.patch | 42 ++ ...Fix-OOB-write-for-split-http-headers.patch | 46 ++ ...or-out-on-headers-with-LF-without-CR.patch | 48 ++ ...ead-past-the-end-of-nat-journal-entr.patch | 72 +++ ...-not-read-past-the-end-of-nat-bitmap.patch | 132 ++++ ...ot-copy-file-names-that-are-too-long.patch | 38 ++ ...eral-fuzz-issues-with-invalid-dir-it.patch | 79 +++ ...e-ASAN-and-SEGV-issues-found-with-fu.patch | 134 +++++ ...x-more-fuzz-issues-related-to-chunks.patch | 75 +++ ...grub_min-and-grub_max-more-resilient.patch | 83 +++ ...FS-switch-to-using-grub_min-grub_max.patch | 92 +++ ...oot_time-also-call-grub_dprintf-boot.patch | 46 ++ ...dules-make-.module_license-read-only.patch | 30 + ...p-.llvm_addrsig-sections-and-similar.patch | 39 ++ ...locate-space-for-non-allocable-secti.patch | 35 ++ ...eader-struct-and-fix-some-bad-naming.patch | 81 +++ ...nel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch | 85 +++ ...ule-sections-at-page-aligned-address.patch | 378 ++++++++++++ ...-nx-add-memory-attribute-get-set-API.patch | 317 ++++++++++ ...-page-permissions-for-loaded-modules.patch | 263 ++++++++ 0265-nx-set-attrs-in-our-kernel-loaders.patch | 565 ++++++++++++++++++ ...x-compatible-flag-in-EFI-grub-images.patch | 34 ++ grub.patches | 47 ++ grub2.spec | 7 +- sbat.csv.in | 4 +- 50 files changed, 5280 insertions(+), 3 deletions(-) create mode 100644 0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch create mode 100644 0221-loader-efi-chainloader-simplify-the-loader-state.patch create mode 100644 0222-commands-boot-Add-API-to-pass-context-to-loader.patch create mode 100644 0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch create mode 100644 0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch create mode 100644 0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch create mode 100644 0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch create mode 100644 0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch create mode 100644 0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch create mode 100644 0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch create mode 100644 0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch create mode 100644 0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch create mode 100644 0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch create mode 100644 0233-video-readers-png-Sanity-check-some-huffman-codes.patch create mode 100644 0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch create mode 100644 0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch create mode 100644 0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch create mode 100644 0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch create mode 100644 0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch create mode 100644 0239-net-netbuff-Block-overly-large-netbuff-allocs.patch create mode 100644 0240-net-ip-Do-IP-fragment-maths-safely.patch create mode 100644 0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch create mode 100644 0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch create mode 100644 0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch create mode 100644 0244-net-tftp-Avoid-a-trivial-UAF.patch create mode 100644 0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch create mode 100644 0246-net-http-Fix-OOB-write-for-split-http-headers.patch create mode 100644 0247-net-http-Error-out-on-headers-with-LF-without-CR.patch create mode 100644 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch create mode 100644 0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch create mode 100644 0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch create mode 100644 0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch create mode 100644 0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch create mode 100644 0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch create mode 100644 0254-misc-Make-grub_min-and-grub_max-more-resilient.patch create mode 100644 0255-ReiserFS-switch-to-using-grub_min-grub_max.patch create mode 100644 0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch create mode 100644 0257-modules-make-.module_license-read-only.patch create mode 100644 0258-modules-strip-.llvm_addrsig-sections-and-similar.patch create mode 100644 0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch create mode 100644 0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch create mode 100644 0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch create mode 100644 0262-modules-load-module-sections-at-page-aligned-address.patch create mode 100644 0263-nx-add-memory-attribute-get-set-API.patch create mode 100644 0264-nx-set-page-permissions-for-loaded-modules.patch create mode 100644 0265-nx-set-attrs-in-our-kernel-loaders.patch create mode 100644 0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch diff --git a/0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch b/0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch new file mode 100644 index 00000000..f61ed282 --- /dev/null +++ b/0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Thu, 28 Apr 2022 21:53:36 +0100 +Subject: [PATCH] loader/efi/chainloader: grub_load_and_start_image doesn't + load and start + +grub_load_and_start_image only loads an image - it still requires the +caller to start it. This renames it to grub_load_image. + +It's called from 2 places: +- grub_cmd_chainloader when not using the shim protocol. +- grub_secureboot_chainloader_boot if handle_image returns an error. +In this case, the image is loaded and then nothing else happens which +seems strange. I assume the intention is that it falls back to LoadImage +and StartImage if handle_image fails, so I've made it do that. + +Signed-off-by: Chris Coulson +(cherry picked from commit b4d70820a65c00561045856b7b8355461a9545f6) +--- + grub-core/loader/efi/chainloader.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 644cd2e56f..d3bf02ed8a 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -841,7 +841,7 @@ grub_secureboot_chainloader_unload (void) + } + + static grub_err_t +-grub_load_and_start_image(void *boot_image) ++grub_load_image(void *boot_image) + { + grub_efi_boot_services_t *b; + grub_efi_status_t status; +@@ -883,13 +883,23 @@ grub_load_and_start_image(void *boot_image) + static grub_err_t + grub_secureboot_chainloader_boot (void) + { ++ grub_efi_boot_services_t *b; + int rc; ++ + rc = handle_image ((void *)(unsigned long)address, fsize); + if (rc == 0) + { +- grub_load_and_start_image((void *)(unsigned long)address); ++ /* We weren't able to attempt to execute the image, so fall back ++ * to LoadImage / StartImage. ++ */ ++ rc = grub_load_image((void *)(unsigned long)address); ++ if (rc == 0) ++ grub_chainloader_boot (); + } + ++ b = grub_efi_system_table->boot_services; ++ efi_call_1 (b->unload_image, image_handle); ++ + grub_loader_unset (); + return grub_errno; + } +@@ -1091,7 +1101,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + } + else + { +- grub_load_and_start_image(boot_image); ++ grub_load_image(boot_image); + grub_file_close (file); + grub_device_close (dev); + grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); diff --git a/0221-loader-efi-chainloader-simplify-the-loader-state.patch b/0221-loader-efi-chainloader-simplify-the-loader-state.patch new file mode 100644 index 00000000..205124e4 --- /dev/null +++ b/0221-loader-efi-chainloader-simplify-the-loader-state.patch @@ -0,0 +1,330 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Fri, 29 Apr 2022 21:13:08 +0100 +Subject: [PATCH] loader/efi/chainloader: simplify the loader state + +When not using the shim lock protocol, the chainloader command retains +the source buffer and device path passed to LoadImage, requiring the +unload hook passed to grub_loader_set to free them. It isn't required +to retain this state though - they aren't required by StartImage or +anything else in the boot hook, so clean them up before +grub_cmd_chainloader finishes. + +This also wraps the loader state when using the shim lock protocol +inside a struct. + +Signed-off-by: Chris Coulson +(cherry picked from commit fa39862933b3be1553a580a3a5c28073257d8046) +[rharwood: fix unitialized handle and double-frees of file/dev] +Signed-off-by: Robbie Harwood +--- + grub-core/loader/efi/chainloader.c | 160 +++++++++++++++++++++++-------------- + 1 file changed, 102 insertions(+), 58 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index d3bf02ed8a..3342492ff1 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -48,38 +48,21 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + static grub_dl_t my_mod; + +-static grub_efi_physical_address_t address; +-static grub_efi_uintn_t pages; +-static grub_ssize_t fsize; +-static grub_efi_device_path_t *file_path; + static grub_efi_handle_t image_handle; +-static grub_efi_char16_t *cmdline; +-static grub_ssize_t cmdline_len; +-static grub_efi_handle_t dev_handle; + +-static grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); ++struct grub_secureboot_chainloader_context { ++ grub_efi_physical_address_t address; ++ grub_efi_uintn_t pages; ++ grub_ssize_t fsize; ++ grub_efi_device_path_t *file_path; ++ grub_efi_char16_t *cmdline; ++ grub_ssize_t cmdline_len; ++ grub_efi_handle_t dev_handle; ++}; ++static struct grub_secureboot_chainloader_context *sb_context; + + static grub_err_t +-grub_chainloader_unload (void) +-{ +- grub_efi_boot_services_t *b; +- +- b = grub_efi_system_table->boot_services; +- efi_call_1 (b->unload_image, image_handle); +- grub_efi_free_pages (address, pages); +- +- grub_free (file_path); +- grub_free (cmdline); +- cmdline = 0; +- file_path = 0; +- dev_handle = 0; +- +- grub_dl_unref (my_mod); +- return GRUB_ERR_NONE; +-} +- +-static grub_err_t +-grub_chainloader_boot (void) ++grub_start_image (grub_efi_handle_t handle) + { + grub_efi_boot_services_t *b; + grub_efi_status_t status; +@@ -87,7 +70,7 @@ grub_chainloader_boot (void) + grub_efi_char16_t *exit_data = NULL; + + b = grub_efi_system_table->boot_services; +- status = efi_call_3 (b->start_image, image_handle, &exit_data_size, &exit_data); ++ status = efi_call_3 (b->start_image, handle, &exit_data_size, &exit_data); + if (status != GRUB_EFI_SUCCESS) + { + if (exit_data) +@@ -111,11 +94,37 @@ grub_chainloader_boot (void) + if (exit_data) + grub_efi_free_pool (exit_data); + +- grub_loader_unset (); +- + return grub_errno; + } + ++static grub_err_t ++grub_chainloader_unload (void) ++{ ++ grub_efi_loaded_image_t *loaded_image; ++ grub_efi_boot_services_t *b; ++ ++ loaded_image = grub_efi_get_loaded_image (image_handle); ++ if (loaded_image != NULL) ++ grub_free (loaded_image->load_options); ++ ++ b = grub_efi_system_table->boot_services; ++ efi_call_1 (b->unload_image, image_handle); ++ ++ grub_dl_unref (my_mod); ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_chainloader_boot (void) ++{ ++ grub_err_t err; ++ ++ err = grub_start_image (image_handle); ++ ++ grub_loader_unset (); ++ return err; ++} ++ + static grub_err_t + copy_file_path (grub_efi_file_path_device_path_t *fp, + const char *str, grub_efi_uint16_t len) +@@ -150,7 +159,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) + char *dir_start; + char *dir_end; + grub_size_t size; +- grub_efi_device_path_t *d; ++ grub_efi_device_path_t *d, *file_path; + + dir_start = grub_strchr (filename, ')'); + if (! dir_start) +@@ -526,10 +535,12 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) + } + + static grub_efi_boolean_t +-handle_image (void *data, grub_efi_uint32_t datasize) ++handle_image (struct grub_secureboot_chainloader_context *load_context) + { + grub_efi_loaded_image_t *li, li_bak; + grub_efi_status_t efi_status; ++ void *data = (void *)(unsigned long)load_context->address; ++ grub_efi_uint32_t datasize = load_context->fsize; + void *buffer = NULL; + char *buffer_aligned = NULL; + grub_efi_uint32_t i; +@@ -540,6 +551,7 @@ handle_image (void *data, grub_efi_uint32_t datasize) + grub_uint32_t buffer_size; + int found_entry_point = 0; + int rc; ++ grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); + + rc = read_header (data, datasize, &context); + if (rc < 0) +@@ -797,10 +809,10 @@ handle_image (void *data, grub_efi_uint32_t datasize) + grub_memcpy (&li_bak, li, sizeof (grub_efi_loaded_image_t)); + li->image_base = buffer_aligned; + li->image_size = context.image_size; +- li->load_options = cmdline; +- li->load_options_size = cmdline_len; +- li->file_path = grub_efi_get_media_file_path (file_path); +- li->device_handle = dev_handle; ++ li->load_options = load_context->cmdline; ++ li->load_options_size = load_context->cmdline_len; ++ li->file_path = grub_efi_get_media_file_path (load_context->file_path); ++ li->device_handle = load_context->dev_handle; + if (!li->file_path) + { + grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching file path found"); +@@ -829,19 +841,22 @@ error_exit: + static grub_err_t + grub_secureboot_chainloader_unload (void) + { +- grub_efi_free_pages (address, pages); +- grub_free (file_path); +- grub_free (cmdline); +- cmdline = 0; +- file_path = 0; +- dev_handle = 0; ++ grub_efi_free_pages (sb_context->address, sb_context->pages); ++ grub_free (sb_context->file_path); ++ grub_free (sb_context->cmdline); ++ grub_free (sb_context); ++ ++ sb_context = 0; + + grub_dl_unref (my_mod); + return GRUB_ERR_NONE; + } + + static grub_err_t +-grub_load_image(void *boot_image) ++grub_load_image(grub_efi_device_path_t *file_path, void *boot_image, ++ grub_efi_uintn_t image_size, grub_efi_handle_t dev_handle, ++ grub_efi_char16_t *cmdline, grub_ssize_t cmdline_len, ++ grub_efi_handle_t *image_handle_out) + { + grub_efi_boot_services_t *b; + grub_efi_status_t status; +@@ -850,7 +865,7 @@ grub_load_image(void *boot_image) + b = grub_efi_system_table->boot_services; + + status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path, +- boot_image, fsize, &image_handle); ++ boot_image, image_size, image_handle_out); + if (status != GRUB_EFI_SUCCESS) + { + if (status == GRUB_EFI_OUT_OF_RESOURCES) +@@ -863,7 +878,7 @@ grub_load_image(void *boot_image) + /* LoadImage does not set a device handler when the image is + loaded from memory, so it is necessary to set it explicitly here. + This is a mess. */ +- loaded_image = grub_efi_get_loaded_image (image_handle); ++ loaded_image = grub_efi_get_loaded_image (*image_handle_out); + if (! loaded_image) + { + grub_error (GRUB_ERR_BAD_OS, "no loaded image available"); +@@ -885,20 +900,25 @@ grub_secureboot_chainloader_boot (void) + { + grub_efi_boot_services_t *b; + int rc; ++ grub_efi_handle_t handle = 0; + +- rc = handle_image ((void *)(unsigned long)address, fsize); ++ rc = handle_image (sb_context); + if (rc == 0) + { + /* We weren't able to attempt to execute the image, so fall back + * to LoadImage / StartImage. + */ +- rc = grub_load_image((void *)(unsigned long)address); ++ rc = grub_load_image(sb_context->file_path, ++ (void *)(unsigned long)sb_context->address, ++ sb_context->fsize, sb_context->dev_handle, ++ sb_context->cmdline, sb_context->cmdline_len, ++ &handle); + if (rc == 0) +- grub_chainloader_boot (); ++ grub_start_image (handle); + } + + b = grub_efi_system_table->boot_services; +- efi_call_1 (b->unload_image, image_handle); ++ efi_call_1 (b->unload_image, handle); + + grub_loader_unset (); + return grub_errno; +@@ -913,9 +933,15 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_efi_boot_services_t *b; + grub_device_t dev = 0; + grub_device_t orig_dev = 0; +- grub_efi_device_path_t *dp = 0; ++ grub_efi_device_path_t *dp = 0, *file_path = 0; + char *filename; + void *boot_image = 0; ++ grub_efi_physical_address_t address = 0; ++ grub_ssize_t fsize; ++ grub_efi_uintn_t pages = 0; ++ grub_efi_char16_t *cmdline = 0; ++ grub_ssize_t cmdline_len = 0; ++ grub_efi_handle_t dev_handle = 0; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); +@@ -923,12 +949,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + + grub_dl_ref (my_mod); + +- /* Initialize some global variables. */ +- address = 0; +- image_handle = 0; +- file_path = 0; +- dev_handle = 0; +- + b = grub_efi_system_table->boot_services; + + if (argc > 1) +@@ -1093,17 +1113,35 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + + if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) + { ++ sb_context = grub_malloc (sizeof (*sb_context)); ++ if (sb_context == NULL) ++ goto fail; ++ sb_context->address = address; ++ sb_context->fsize = fsize; ++ sb_context->pages = pages; ++ sb_context->file_path = file_path; ++ sb_context->cmdline = cmdline; ++ sb_context->cmdline_len = cmdline_len; ++ sb_context->dev_handle = dev_handle; ++ + grub_file_close (file); + grub_device_close (dev); ++ + grub_loader_set (grub_secureboot_chainloader_boot, + grub_secureboot_chainloader_unload, 0); + return 0; + } + else + { +- grub_load_image(boot_image); ++ grub_load_image(file_path, boot_image, fsize, dev_handle, cmdline, ++ cmdline_len, &image_handle); + grub_file_close (file); + grub_device_close (dev); ++ ++ /* We're finished with the source image buffer and file path now */ ++ efi_call_2 (b->free_pages, address, pages); ++ grub_free (file_path); ++ + grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); + + return 0; +@@ -1130,6 +1168,12 @@ fail: + if (cmdline) + grub_free (cmdline); + ++ if (image_handle != 0) ++ { ++ efi_call_1 (b->unload_image, image_handle); ++ image_handle = 0; ++ } ++ + grub_dl_unref (my_mod); + + return grub_errno; diff --git a/0222-commands-boot-Add-API-to-pass-context-to-loader.patch b/0222-commands-boot-Add-API-to-pass-context-to-loader.patch new file mode 100644 index 00000000..63a2d76e --- /dev/null +++ b/0222-commands-boot-Add-API-to-pass-context-to-loader.patch @@ -0,0 +1,158 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Fri, 29 Apr 2022 21:16:02 +0100 +Subject: [PATCH] commands/boot: Add API to pass context to loader + +Loaders rely on global variables for saving context which is consumed +in the boot hook and freed in the unload hook. In the case where a loader +command is executed twice, calling grub_loader_set a second time executes +the unload hook, but in some cases this runs when the loader's global +context has already been updated, resulting in the updated context being +freed and potential use-after-free bugs when the boot hook is subsequently +called. + +This adds a new API (grub_loader_set_ex) which allows a loader to specify +context that is passed to its boot and unload hooks. This is an alternative +to requiring that loaders call grub_loader_unset before mutating their +global context. + +Signed-off-by: Chris Coulson +(cherry picked from commit 4322a64dde7e8fedb58e50b79408667129d45dd3) +--- + grub-core/commands/boot.c | 66 +++++++++++++++++++++++++++++++++++++++++------ + include/grub/loader.h | 5 ++++ + 2 files changed, 63 insertions(+), 8 deletions(-) + +diff --git a/grub-core/commands/boot.c b/grub-core/commands/boot.c +index bbca81e947..53691a62d9 100644 +--- a/grub-core/commands/boot.c ++++ b/grub-core/commands/boot.c +@@ -27,10 +27,20 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + +-static grub_err_t (*grub_loader_boot_func) (void); +-static grub_err_t (*grub_loader_unload_func) (void); ++static grub_err_t (*grub_loader_boot_func) (void *); ++static grub_err_t (*grub_loader_unload_func) (void *); ++static void *grub_loader_context; + static int grub_loader_flags; + ++struct grub_simple_loader_hooks ++{ ++ grub_err_t (*boot) (void); ++ grub_err_t (*unload) (void); ++}; ++ ++/* Don't heap allocate this to avoid making grub_loader_set fallible. */ ++static struct grub_simple_loader_hooks simple_loader_hooks; ++ + struct grub_preboot + { + grub_err_t (*preboot_func) (int); +@@ -44,6 +54,29 @@ static int grub_loader_loaded; + static struct grub_preboot *preboots_head = 0, + *preboots_tail = 0; + ++static grub_err_t ++grub_simple_boot_hook (void *context) ++{ ++ struct grub_simple_loader_hooks *hooks; ++ ++ hooks = (struct grub_simple_loader_hooks *) context; ++ return hooks->boot (); ++} ++ ++static grub_err_t ++grub_simple_unload_hook (void *context) ++{ ++ struct grub_simple_loader_hooks *hooks; ++ grub_err_t ret; ++ ++ hooks = (struct grub_simple_loader_hooks *) context; ++ ++ ret = hooks->unload (); ++ grub_memset (hooks, 0, sizeof (*hooks)); ++ ++ return ret; ++} ++ + int + grub_loader_is_loaded (void) + { +@@ -110,28 +143,45 @@ grub_loader_unregister_preboot_hook (struct grub_preboot *hnd) + } + + void +-grub_loader_set (grub_err_t (*boot) (void), +- grub_err_t (*unload) (void), +- int flags) ++grub_loader_set_ex (grub_err_t (*boot) (void *), ++ grub_err_t (*unload) (void *), ++ void *context, ++ int flags) + { + if (grub_loader_loaded && grub_loader_unload_func) +- grub_loader_unload_func (); ++ grub_loader_unload_func (grub_loader_context); + + grub_loader_boot_func = boot; + grub_loader_unload_func = unload; ++ grub_loader_context = context; + grub_loader_flags = flags; + + grub_loader_loaded = 1; + } + ++void ++grub_loader_set (grub_err_t (*boot) (void), ++ grub_err_t (*unload) (void), ++ int flags) ++{ ++ grub_loader_set_ex (grub_simple_boot_hook, ++ grub_simple_unload_hook, ++ &simple_loader_hooks, ++ flags); ++ ++ simple_loader_hooks.boot = boot; ++ simple_loader_hooks.unload = unload; ++} ++ + void + grub_loader_unset(void) + { + if (grub_loader_loaded && grub_loader_unload_func) +- grub_loader_unload_func (); ++ grub_loader_unload_func (grub_loader_context); + + grub_loader_boot_func = 0; + grub_loader_unload_func = 0; ++ grub_loader_context = 0; + + grub_loader_loaded = 0; + } +@@ -158,7 +208,7 @@ grub_loader_boot (void) + return err; + } + } +- err = (grub_loader_boot_func) (); ++ err = (grub_loader_boot_func) (grub_loader_context); + + for (cur = preboots_tail; cur; cur = cur->prev) + if (! err) +diff --git a/include/grub/loader.h b/include/grub/loader.h +index b208642821..1846fa6c5f 100644 +--- a/include/grub/loader.h ++++ b/include/grub/loader.h +@@ -40,6 +40,11 @@ void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void), + grub_err_t (*unload) (void), + int flags); + ++void EXPORT_FUNC (grub_loader_set_ex) (grub_err_t (*boot) (void *), ++ grub_err_t (*unload) (void *), ++ void *context, ++ int flags); ++ + /* Unset current loader, if any. */ + void EXPORT_FUNC (grub_loader_unset) (void); + diff --git a/0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch b/0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch new file mode 100644 index 00000000..fc15b842 --- /dev/null +++ b/0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch @@ -0,0 +1,147 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Fri, 29 Apr 2022 21:30:56 +0100 +Subject: [PATCH] loader/efi/chainloader: Use grub_loader_set_ex + +This ports the EFI chainloader to use grub_loader_set_ex in order to fix +a use-after-free bug that occurs when grub_cmd_chainloader is executed +more than once before a boot attempt is performed. + +Signed-off-by: Chris Coulson +(cherry picked from commit 4b7f0402b7cb0f67a93be736f2b75b818d7f44c9) +[rharwood: context sludge from other change] +Signed-off-by: Robbie Harwood +--- + grub-core/loader/efi/chainloader.c | 38 ++++++++++++++++++++++---------------- + 1 file changed, 22 insertions(+), 16 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 3342492ff1..fb874f1855 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -48,8 +48,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + static grub_dl_t my_mod; + +-static grub_efi_handle_t image_handle; +- + struct grub_secureboot_chainloader_context { + grub_efi_physical_address_t address; + grub_efi_uintn_t pages; +@@ -59,7 +57,6 @@ struct grub_secureboot_chainloader_context { + grub_ssize_t cmdline_len; + grub_efi_handle_t dev_handle; + }; +-static struct grub_secureboot_chainloader_context *sb_context; + + static grub_err_t + grub_start_image (grub_efi_handle_t handle) +@@ -98,11 +95,14 @@ grub_start_image (grub_efi_handle_t handle) + } + + static grub_err_t +-grub_chainloader_unload (void) ++grub_chainloader_unload (void *context) + { ++ grub_efi_handle_t image_handle; + grub_efi_loaded_image_t *loaded_image; + grub_efi_boot_services_t *b; + ++ image_handle = (grub_efi_handle_t) context; ++ + loaded_image = grub_efi_get_loaded_image (image_handle); + if (loaded_image != NULL) + grub_free (loaded_image->load_options); +@@ -115,10 +115,12 @@ grub_chainloader_unload (void) + } + + static grub_err_t +-grub_chainloader_boot (void) ++grub_chainloader_boot (void *context) + { ++ grub_efi_handle_t image_handle; + grub_err_t err; + ++ image_handle = (grub_efi_handle_t) context; + err = grub_start_image (image_handle); + + grub_loader_unset (); +@@ -839,15 +841,17 @@ error_exit: + } + + static grub_err_t +-grub_secureboot_chainloader_unload (void) ++grub_secureboot_chainloader_unload (void *context) + { ++ struct grub_secureboot_chainloader_context *sb_context; ++ ++ sb_context = (struct grub_secureboot_chainloader_context *) context; ++ + grub_efi_free_pages (sb_context->address, sb_context->pages); + grub_free (sb_context->file_path); + grub_free (sb_context->cmdline); + grub_free (sb_context); + +- sb_context = 0; +- + grub_dl_unref (my_mod); + return GRUB_ERR_NONE; + } +@@ -896,12 +900,15 @@ grub_load_image(grub_efi_device_path_t *file_path, void *boot_image, + } + + static grub_err_t +-grub_secureboot_chainloader_boot (void) ++grub_secureboot_chainloader_boot (void *context) + { ++ struct grub_secureboot_chainloader_context *sb_context; + grub_efi_boot_services_t *b; + int rc; + grub_efi_handle_t handle = 0; + ++ sb_context = (struct grub_secureboot_chainloader_context *) context; ++ + rc = handle_image (sb_context); + if (rc == 0) + { +@@ -942,6 +949,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_efi_char16_t *cmdline = 0; + grub_ssize_t cmdline_len = 0; + grub_efi_handle_t dev_handle = 0; ++ grub_efi_handle_t image_handle = 0; ++ struct grub_secureboot_chainloader_context *sb_context = 0; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); +@@ -1127,8 +1136,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_file_close (file); + grub_device_close (dev); + +- grub_loader_set (grub_secureboot_chainloader_boot, +- grub_secureboot_chainloader_unload, 0); ++ grub_loader_set_ex (grub_secureboot_chainloader_boot, ++ grub_secureboot_chainloader_unload, sb_context, 0); + return 0; + } + else +@@ -1142,7 +1151,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + efi_call_2 (b->free_pages, address, pages); + grub_free (file_path); + +- grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); ++ grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0); + + return 0; + } +@@ -1169,10 +1178,7 @@ fail: + grub_free (cmdline); + + if (image_handle != 0) +- { +- efi_call_1 (b->unload_image, image_handle); +- image_handle = 0; +- } ++ efi_call_1 (b->unload_image, image_handle); + + grub_dl_unref (my_mod); + diff --git a/0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch b/0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch new file mode 100644 index 00000000..b79c78c5 --- /dev/null +++ b/0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Mon, 2 May 2022 14:39:31 +0200 +Subject: [PATCH] loader/i386/efi/linux: Avoid a use-after-free in the linuxefi + loader + +In some error paths in grub_cmd_linux, the pointer to lh may be +dereferenced after the buffer it points to has been freed. There aren't +any security implications from this because nothing else uses the +allocator after the buffer is freed and before the pointer is +dereferenced, but fix it anyway. + +Signed-off-by: Chris Coulson +(cherry picked from commit 8224f5a71af94bec8697de17e7e579792db9f9e2) +--- + grub-core/loader/i386/efi/linux.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 941df6400b..27bc2aa161 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -465,9 +465,6 @@ fail: + if (file) + grub_file_close (file); + +- if (kernel) +- grub_free (kernel); +- + if (grub_errno != GRUB_ERR_NONE) + { + grub_dl_unref (my_mod); +@@ -483,6 +480,8 @@ fail: + kernel_free (params, sizeof(*params)); + } + ++ grub_free (kernel); ++ + return grub_errno; + } + diff --git a/0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch b/0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch new file mode 100644 index 00000000..1a129dbe --- /dev/null +++ b/0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch @@ -0,0 +1,296 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Mon, 2 May 2022 17:04:23 +0200 +Subject: [PATCH] loader/i386/efi/linux: Use grub_loader_set_ex + +This ports the linuxefi loader to use grub_loader_set_ex in order to fix +a use-after-fre bug that occurs when grub_cmd_linux is executed more than +once before a boot attempt is performed. + +This is more complicated than for the chainloader command, as the initrd +command needs access to the loader state. To solve this, the linuxefi +module registers a dummy initrd command at startup that returns an error. +The linuxefi command then registers a proper initrd command with a higher +priority that is passed the loader state. + +Signed-off-by: Chris Coulson +(cherry picked from commit 7cf736436b4c934df5ddfa6f44b46a7e07d99fdc) +[rharwood/pjones: set kernel_size in context] +Signed-off-by: Robbie Harwood +--- + grub-core/loader/i386/efi/linux.c | 146 +++++++++++++++++++++++--------------- + 1 file changed, 87 insertions(+), 59 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 27bc2aa161..e3c2d6fe0b 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -34,13 +34,19 @@ + GRUB_MOD_LICENSE ("GPLv3+"); + + static grub_dl_t my_mod; +-static int loaded; +-static void *kernel_mem; +-static grub_uint64_t kernel_size; +-static void *initrd_mem; +-static grub_uint32_t handover_offset; +-struct linux_kernel_params *params; +-static char *linux_cmdline; ++ ++static grub_command_t cmd_linux, cmd_initrd; ++static grub_command_t cmd_linuxefi, cmd_initrdefi; ++ ++struct grub_linuxefi_context { ++ void *kernel_mem; ++ grub_uint64_t kernel_size; ++ grub_uint32_t handover_offset; ++ struct linux_kernel_params *params; ++ char *cmdline; ++ ++ void *initrd_mem; ++}; + + #define MIN(a, b) \ + ({ typeof (a) _a = (a); \ +@@ -123,25 +129,32 @@ kernel_alloc(grub_efi_uintn_t size, const char * const errmsg) + } + + static grub_err_t +-grub_linuxefi_boot (void) ++grub_linuxefi_boot (void *data) + { ++ struct grub_linuxefi_context *context = (struct grub_linuxefi_context *) data; ++ + asm volatile ("cli"); + +- return grub_efi_linux_boot ((char *)kernel_mem, +- handover_offset, +- params); ++ return grub_efi_linux_boot ((char *)context->kernel_mem, ++ context->handover_offset, ++ context->params); + } + + static grub_err_t +-grub_linuxefi_unload (void) ++grub_linuxefi_unload (void *data) + { ++ struct grub_linuxefi_context *context = (struct grub_linuxefi_context *) data; ++ struct linux_kernel_params *params = context->params; ++ + grub_dl_unref (my_mod); +- loaded = 0; + +- kernel_free(initrd_mem, params->ramdisk_size); +- kernel_free(linux_cmdline, params->cmdline_size + 1); +- kernel_free(kernel_mem, kernel_size); +- kernel_free(params, sizeof(*params)); ++ kernel_free (context->initrd_mem, params->ramdisk_size); ++ kernel_free (context->cmdline, params->cmdline_size + 1); ++ kernel_free (context->kernel_mem, context->kernel_size); ++ kernel_free (params, sizeof(*params)); ++ cmd_initrd->data = 0; ++ cmd_initrdefi->data = 0; ++ grub_free (context); + + return GRUB_ERR_NONE; + } +@@ -188,13 +201,14 @@ read(grub_file_t file, grub_uint8_t *bufp, grub_size_t len) + #define HIGH_U32(val) ((grub_uint32_t)(((grub_addr_t)(val) >> 32) & 0xffffffffull)) + + static grub_err_t +-grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +- int argc, char *argv[]) ++grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) + { + grub_file_t *files = 0; + int i, nfiles = 0; + grub_size_t size = 0; + grub_uint8_t *ptr; ++ struct grub_linuxefi_context *context = (struct grub_linuxefi_context *) cmd->data; ++ struct linux_kernel_params *params; + + if (argc == 0) + { +@@ -202,12 +216,14 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + +- if (!loaded) ++ if (!context) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first")); + goto fail; + } + ++ params = context->params; ++ + files = grub_calloc (argc, sizeof (files[0])); + if (!files) + goto fail; +@@ -225,19 +241,19 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + } + } + +- initrd_mem = kernel_alloc(size, N_("can't allocate initrd")); +- if (initrd_mem == NULL) ++ context->initrd_mem = kernel_alloc(size, N_("can't allocate initrd")); ++ if (context->initrd_mem == NULL) + goto fail; +- grub_dprintf ("linux", "initrd_mem = %p\n", initrd_mem); ++ grub_dprintf ("linux", "initrd_mem = %p\n", context->initrd_mem); + + params->ramdisk_size = LOW_U32(size); +- params->ramdisk_image = LOW_U32(initrd_mem); ++ params->ramdisk_image = LOW_U32(context->initrd_mem); + #if defined(__x86_64__) + params->ext_ramdisk_size = HIGH_U32(size); +- params->ext_ramdisk_image = HIGH_U32(initrd_mem); ++ params->ext_ramdisk_image = HIGH_U32(context->initrd_mem); + #endif + +- ptr = initrd_mem; ++ ptr = context->initrd_mem; + + for (i = 0; i < nfiles; i++) + { +@@ -261,8 +277,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + grub_file_close (files[i]); + grub_free (files); + +- if (initrd_mem && grub_errno) +- grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, ++ if (context->initrd_mem && grub_errno) ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)context->initrd_mem, + BYTES_TO_PAGES(size)); + + return grub_errno; +@@ -277,6 +293,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_ssize_t start, filelen; + void *kernel = NULL; + int setup_header_end_offset; ++ void *kernel_mem = 0; ++ grub_uint64_t kernel_size = 0; ++ grub_uint32_t handover_offset; ++ struct linux_kernel_params *params = 0; ++ char *cmdline = 0; ++ struct grub_linuxefi_context *context = 0; + + grub_dl_ref (my_mod); + +@@ -390,27 +412,27 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_dprintf ("linux", "new lh is at %p\n", lh); + + grub_dprintf ("linux", "setting up cmdline\n"); +- linux_cmdline = kernel_alloc (lh->cmdline_size + 1, N_("can't allocate cmdline")); +- if (!linux_cmdline) ++ cmdline = kernel_alloc (lh->cmdline_size + 1, N_("can't allocate cmdline")); ++ if (!cmdline) + goto fail; +- grub_dprintf ("linux", "linux_cmdline = %p\n", linux_cmdline); ++ grub_dprintf ("linux", "cmdline = %p\n", cmdline); + +- grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); ++ grub_memcpy (cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); + grub_create_loader_cmdline (argc, argv, +- linux_cmdline + sizeof (LINUX_IMAGE) - 1, ++ cmdline + sizeof (LINUX_IMAGE) - 1, + lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1), + GRUB_VERIFY_KERNEL_CMDLINE); + +- grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline); ++ grub_dprintf ("linux", "cmdline:%s\n", cmdline); + grub_dprintf ("linux", "setting lh->cmd_line_ptr to 0x%08x\n", +- LOW_U32(linux_cmdline)); +- lh->cmd_line_ptr = LOW_U32(linux_cmdline); ++ LOW_U32(cmdline)); ++ lh->cmd_line_ptr = LOW_U32(cmdline); + #if defined(__x86_64__) +- if ((grub_efi_uintn_t)linux_cmdline > 0xffffffffull) ++ if ((grub_efi_uintn_t)cmdline > 0xffffffffull) + { + grub_dprintf ("linux", "setting params->ext_cmd_line_ptr to 0x%08x\n", +- HIGH_U32(linux_cmdline)); +- params->ext_cmd_line_ptr = HIGH_U32(linux_cmdline); ++ HIGH_U32(cmdline)); ++ params->ext_cmd_line_ptr = HIGH_U32(cmdline); + } + #endif + +@@ -435,16 +457,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } + max_addresses[1].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; + max_addresses[2].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; +- kernel_mem = kernel_alloc (lh->init_size, N_("can't allocate kernel")); ++ kernel_size = lh->init_size; ++ kernel_mem = kernel_alloc (kernel_size, N_("can't allocate kernel")); + restore_addresses(); + if (!kernel_mem) + goto fail; + grub_dprintf("linux", "kernel_mem = %p\n", kernel_mem); + +- grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0); +- +- loaded = 1; +- + grub_dprintf ("linux", "setting lh->code32_start to 0x%08x\n", + LOW_U32(kernel_mem)); + lh->code32_start = LOW_U32(kernel_mem); +@@ -461,33 +480,42 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + "setting lh->ext_loader_{type,ver} = {0x%02x,0x%02x}\n", + params->ext_loader_type, params->ext_loader_ver); + ++ context = grub_zalloc (sizeof (*context)); ++ if (!context) ++ goto fail; ++ context->kernel_mem = kernel_mem; ++ context->kernel_size = kernel_size; ++ context->handover_offset = handover_offset; ++ context->params = params; ++ context->cmdline = cmdline; ++ ++ grub_loader_set_ex (grub_linuxefi_boot, grub_linuxefi_unload, context, 0); ++ ++ cmd_initrd->data = context; ++ cmd_initrdefi->data = context; ++ ++ grub_file_close (file); ++ grub_free (kernel); ++ return 0; ++ + fail: + if (file) + grub_file_close (file); + +- if (grub_errno != GRUB_ERR_NONE) +- { +- grub_dl_unref (my_mod); +- loaded = 0; +- } ++ grub_dl_unref (my_mod); + +- if (!loaded) +- { +- if (lh) +- kernel_free (linux_cmdline, lh->cmdline_size + 1); ++ if (lh) ++ kernel_free (cmdline, lh->cmdline_size + 1); + +- kernel_free (kernel_mem, kernel_size); +- kernel_free (params, sizeof(*params)); +- } ++ kernel_free (kernel_mem, kernel_size); ++ kernel_free (params, sizeof(*params)); + ++ grub_free (context); + grub_free (kernel); + + return grub_errno; + } + +-static grub_command_t cmd_linux, cmd_initrd; +-static grub_command_t cmd_linuxefi, cmd_initrdefi; +- + GRUB_MOD_INIT(linux) + { + cmd_linux = diff --git a/0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch b/0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch new file mode 100644 index 00000000..51953fd3 --- /dev/null +++ b/0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Tue, 3 May 2022 09:47:35 +0200 +Subject: [PATCH] loader/i386/efi/linux: Fix a memory leak in the initrd + command + +Subsequent invocations of the initrd command result in the previous +initrd being leaked, so fix that. + +Signed-off-by: Chris Coulson +(cherry picked from commit d98af31ce1e31bb22163960d53f5eb28c66582a0) +--- + grub-core/loader/i386/efi/linux.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index e3c2d6fe0b..9e5c11ac69 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -209,6 +209,7 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) + grub_uint8_t *ptr; + struct grub_linuxefi_context *context = (struct grub_linuxefi_context *) cmd->data; + struct linux_kernel_params *params; ++ void *initrd_mem = 0; + + if (argc == 0) + { +@@ -241,19 +242,19 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) + } + } + +- context->initrd_mem = kernel_alloc(size, N_("can't allocate initrd")); +- if (context->initrd_mem == NULL) ++ initrd_mem = kernel_alloc(size, N_("can't allocate initrd")); ++ if (initrd_mem == NULL) + goto fail; +- grub_dprintf ("linux", "initrd_mem = %p\n", context->initrd_mem); ++ grub_dprintf ("linux", "initrd_mem = %p\n", initrd_mem); + + params->ramdisk_size = LOW_U32(size); +- params->ramdisk_image = LOW_U32(context->initrd_mem); ++ params->ramdisk_image = LOW_U32(initrd_mem); + #if defined(__x86_64__) + params->ext_ramdisk_size = HIGH_U32(size); +- params->ext_ramdisk_image = HIGH_U32(context->initrd_mem); ++ params->ext_ramdisk_image = HIGH_U32(initrd_mem); + #endif + +- ptr = context->initrd_mem; ++ ptr = initrd_mem; + + for (i = 0; i < nfiles; i++) + { +@@ -270,6 +271,9 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) + ptr += ALIGN_UP_OVERHEAD (cursize, 4); + } + ++ kernel_free(context->initrd_mem, params->ramdisk_size); ++ ++ context->initrd_mem = initrd_mem; + params->ramdisk_size = size; + + fail: +@@ -277,9 +281,8 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) + grub_file_close (files[i]); + grub_free (files); + +- if (context->initrd_mem && grub_errno) +- grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)context->initrd_mem, +- BYTES_TO_PAGES(size)); ++ if (initrd_mem && grub_errno) ++ kernel_free (initrd_mem, size); + + return grub_errno; + } diff --git a/0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch b/0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch new file mode 100644 index 00000000..715e6e1d --- /dev/null +++ b/0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch @@ -0,0 +1,101 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Julian Andres Klode +Date: Thu, 2 Dec 2021 15:03:53 +0100 +Subject: [PATCH] kern/efi/sb: Reject non-kernel files in the shim_lock + verifier + +We must not allow other verifiers to pass things like the GRUB modules. +Instead of maintaining a blocklist, maintain an allowlist of things +that we do not care about. + +This allowlist really should be made reusable, and shared by the +lockdown verifier, but this is the minimal patch addressing +security concerns where the TPM verifier was able to mark modules +as verified (or the OpenPGP verifier for that matter), when it +should not do so on shim-powered secure boot systems. + +Fixes: CVE-2022-28735 + +Signed-off-by: Julian Andres Klode +Reviewed-by: Daniel Kiper +(cherry picked from commit fa61ad69861c1cb3f68bf853d78fae7fd93986a0) +--- + grub-core/kern/efi/sb.c | 39 ++++++++++++++++++++++++++++++++++++--- + include/grub/verify.h | 1 + + 2 files changed, 37 insertions(+), 3 deletions(-) + +diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c +index c52ec6226a..89c4bb3fd1 100644 +--- a/grub-core/kern/efi/sb.c ++++ b/grub-core/kern/efi/sb.c +@@ -119,10 +119,11 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)), + void **context __attribute__ ((unused)), + enum grub_verify_flags *flags) + { +- *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION; ++ *flags = GRUB_VERIFY_FLAGS_NONE; + + switch (type & GRUB_FILE_TYPE_MASK) + { ++ /* Files we check. */ + case GRUB_FILE_TYPE_LINUX_KERNEL: + case GRUB_FILE_TYPE_MULTIBOOT_KERNEL: + case GRUB_FILE_TYPE_BSD_KERNEL: +@@ -130,11 +131,43 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)), + case GRUB_FILE_TYPE_PLAN9_KERNEL: + case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE: + *flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK; ++ return GRUB_ERR_NONE; + +- /* Fall through. */ ++ /* Files that do not affect secureboot state. */ ++ case GRUB_FILE_TYPE_NONE: ++ case GRUB_FILE_TYPE_LOOPBACK: ++ case GRUB_FILE_TYPE_LINUX_INITRD: ++ case GRUB_FILE_TYPE_OPENBSD_RAMDISK: ++ case GRUB_FILE_TYPE_XNU_RAMDISK: ++ case GRUB_FILE_TYPE_SIGNATURE: ++ case GRUB_FILE_TYPE_PUBLIC_KEY: ++ case GRUB_FILE_TYPE_PUBLIC_KEY_TRUST: ++ case GRUB_FILE_TYPE_PRINT_BLOCKLIST: ++ case GRUB_FILE_TYPE_TESTLOAD: ++ case GRUB_FILE_TYPE_GET_SIZE: ++ case GRUB_FILE_TYPE_FONT: ++ case GRUB_FILE_TYPE_ZFS_ENCRYPTION_KEY: ++ case GRUB_FILE_TYPE_CAT: ++ case GRUB_FILE_TYPE_HEXCAT: ++ case GRUB_FILE_TYPE_CMP: ++ case GRUB_FILE_TYPE_HASHLIST: ++ case GRUB_FILE_TYPE_TO_HASH: ++ case GRUB_FILE_TYPE_KEYBOARD_LAYOUT: ++ case GRUB_FILE_TYPE_PIXMAP: ++ case GRUB_FILE_TYPE_GRUB_MODULE_LIST: ++ case GRUB_FILE_TYPE_CONFIG: ++ case GRUB_FILE_TYPE_THEME: ++ case GRUB_FILE_TYPE_GETTEXT_CATALOG: ++ case GRUB_FILE_TYPE_FS_SEARCH: ++ case GRUB_FILE_TYPE_LOADENV: ++ case GRUB_FILE_TYPE_SAVEENV: ++ case GRUB_FILE_TYPE_VERIFY_SIGNATURE: ++ *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION; ++ return GRUB_ERR_NONE; + ++ /* Other files. */ + default: +- return GRUB_ERR_NONE; ++ return grub_error (GRUB_ERR_ACCESS_DENIED, N_("prohibited by secure boot policy")); + } + } + +diff --git a/include/grub/verify.h b/include/grub/verify.h +index cd129c398f..672ae16924 100644 +--- a/include/grub/verify.h ++++ b/include/grub/verify.h +@@ -24,6 +24,7 @@ + + enum grub_verify_flags + { ++ GRUB_VERIFY_FLAGS_NONE = 0, + GRUB_VERIFY_FLAGS_SKIP_VERIFICATION = 1, + GRUB_VERIFY_FLAGS_SINGLE_CHUNK = 2, + /* Defer verification to another authority. */ diff --git a/0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch b/0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch new file mode 100644 index 00000000..bcc5503d --- /dev/null +++ b/0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 25 Jun 2021 02:19:05 +1000 +Subject: [PATCH] kern/file: Do not leak device_name on error in + grub_file_open() + +If we have an error in grub_file_open() before we free device_name, we +will leak it. + +Free device_name in the error path and null out the pointer in the good +path once we free it there. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 1499a5068839fa37cb77ecef4b5bdacbd1ed12ea) +--- + grub-core/kern/file.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c +index e19aea3e51..ed69fc0f0f 100644 +--- a/grub-core/kern/file.c ++++ b/grub-core/kern/file.c +@@ -81,6 +81,7 @@ grub_file_open (const char *name, enum grub_file_type type) + + device = grub_device_open (device_name); + grub_free (device_name); ++ device_name = NULL; + if (! device) + goto fail; + +@@ -135,6 +136,7 @@ grub_file_open (const char *name, enum grub_file_type type) + return file; + + fail: ++ grub_free (device_name); + if (device) + grub_device_close (device); + diff --git a/0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch b/0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch new file mode 100644 index 00000000..385d3ed0 --- /dev/null +++ b/0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch @@ -0,0 +1,198 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 6 Jul 2021 14:02:55 +1000 +Subject: [PATCH] video/readers/png: Abort sooner if a read operation fails + +Fuzzing revealed some inputs that were taking a long time, potentially +forever, because they did not bail quickly upon encountering an I/O error. + +Try to catch I/O errors sooner and bail out. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 882be97d1df6449b9fd4d593f0cb70005fde3494) +--- + grub-core/video/readers/png.c | 55 ++++++++++++++++++++++++++++++++++++------- + 1 file changed, 47 insertions(+), 8 deletions(-) + +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index 0157ff7420..e2a6b1cf3c 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -142,6 +142,7 @@ static grub_uint8_t + grub_png_get_byte (struct grub_png_data *data) + { + grub_uint8_t r; ++ grub_ssize_t bytes_read = 0; + + if ((data->inside_idat) && (data->idat_remain == 0)) + { +@@ -175,7 +176,14 @@ grub_png_get_byte (struct grub_png_data *data) + } + + r = 0; +- grub_file_read (data->file, &r, 1); ++ bytes_read = grub_file_read (data->file, &r, 1); ++ ++ if (bytes_read != 1) ++ { ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "png: unexpected end of data"); ++ return 0; ++ } + + if (data->inside_idat) + data->idat_remain--; +@@ -231,15 +239,16 @@ grub_png_decode_image_palette (struct grub_png_data *data, + if (len == 0) + return GRUB_ERR_NONE; + +- for (i = 0; 3 * i < len && i < 256; i++) ++ grub_errno = GRUB_ERR_NONE; ++ for (i = 0; 3 * i < len && i < 256 && grub_errno == GRUB_ERR_NONE; i++) + for (j = 0; j < 3; j++) + data->palette[i][j] = grub_png_get_byte (data); +- for (i *= 3; i < len; i++) ++ for (i *= 3; i < len && grub_errno == GRUB_ERR_NONE; i++) + grub_png_get_byte (data); + + grub_png_get_dword (data); + +- return GRUB_ERR_NONE; ++ return grub_errno; + } + + static grub_err_t +@@ -256,9 +265,13 @@ grub_png_decode_image_header (struct grub_png_data *data) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: invalid image size"); + + color_bits = grub_png_get_byte (data); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + data->is_16bit = (color_bits == 16); + + color_type = grub_png_get_byte (data); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + /* According to PNG spec, no other types are valid. */ + if ((color_type & ~(PNG_COLOR_MASK_ALPHA | PNG_COLOR_MASK_COLOR)) +@@ -340,14 +353,20 @@ grub_png_decode_image_header (struct grub_png_data *data) + if (grub_png_get_byte (data) != PNG_COMPRESSION_BASE) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "png: compression method not supported"); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + if (grub_png_get_byte (data) != PNG_FILTER_TYPE_BASE) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "png: filter method not supported"); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + if (grub_png_get_byte (data) != PNG_INTERLACE_NONE) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "png: interlace method not supported"); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + /* Skip crc checksum. */ + grub_png_get_dword (data); +@@ -449,7 +468,7 @@ grub_png_get_huff_code (struct grub_png_data *data, struct huff_table *ht) + int code, i; + + code = 0; +- for (i = 0; i < ht->max_length; i++) ++ for (i = 0; i < ht->max_length && grub_errno == GRUB_ERR_NONE; i++) + { + code = (code << 1) + grub_png_get_bits (data, 1); + if (code < ht->maxval[i]) +@@ -504,8 +523,14 @@ grub_png_init_dynamic_block (struct grub_png_data *data) + grub_uint8_t lens[DEFLATE_HCLEN_MAX]; + + nl = DEFLATE_HLIT_BASE + grub_png_get_bits (data, 5); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + nd = DEFLATE_HDIST_BASE + grub_png_get_bits (data, 5); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + nb = DEFLATE_HCLEN_BASE + grub_png_get_bits (data, 4); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + if ((nl > DEFLATE_HLIT_MAX) || (nd > DEFLATE_HDIST_MAX) || + (nb > DEFLATE_HCLEN_MAX)) +@@ -533,7 +558,7 @@ grub_png_init_dynamic_block (struct grub_png_data *data) + data->dist_offset); + + prev = 0; +- for (i = 0; i < nl + nd; i++) ++ for (i = 0; i < nl + nd && grub_errno == GRUB_ERR_NONE; i++) + { + int n, code; + struct huff_table *ht; +@@ -721,17 +746,21 @@ grub_png_read_dynamic_block (struct grub_png_data *data) + len = cplens[n]; + if (cplext[n]) + len += grub_png_get_bits (data, cplext[n]); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + n = grub_png_get_huff_code (data, &data->dist_table); + dist = cpdist[n]; + if (cpdext[n]) + dist += grub_png_get_bits (data, cpdext[n]); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + pos = data->wp - dist; + if (pos < 0) + pos += WSIZE; + +- while (len > 0) ++ while (len > 0 && grub_errno == GRUB_ERR_NONE) + { + data->slide[data->wp] = data->slide[pos]; + grub_png_output_byte (data, data->slide[data->wp]); +@@ -759,7 +788,11 @@ grub_png_decode_image_data (struct grub_png_data *data) + int final; + + cmf = grub_png_get_byte (data); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + flg = grub_png_get_byte (data); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + if ((cmf & 0xF) != Z_DEFLATED) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, +@@ -774,7 +807,11 @@ grub_png_decode_image_data (struct grub_png_data *data) + int block_type; + + final = grub_png_get_bits (data, 1); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + block_type = grub_png_get_bits (data, 2); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + switch (block_type) + { +@@ -790,7 +827,7 @@ grub_png_decode_image_data (struct grub_png_data *data) + grub_png_get_byte (data); + grub_png_get_byte (data); + +- for (i = 0; i < len; i++) ++ for (i = 0; i < len && grub_errno == GRUB_ERR_NONE; i++) + grub_png_output_byte (data, grub_png_get_byte (data)); + + break; +@@ -1045,6 +1082,8 @@ grub_png_decode_png (struct grub_png_data *data) + + len = grub_png_get_dword (data); + type = grub_png_get_dword (data); ++ if (grub_errno != GRUB_ERR_NONE) ++ break; + data->next_offset = data->file->offset + len + 4; + + switch (type) diff --git a/0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch b/0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch new file mode 100644 index 00000000..9168fe58 --- /dev/null +++ b/0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 6 Jul 2021 14:13:40 +1000 +Subject: [PATCH] video/readers/png: Refuse to handle multiple image headers + +This causes the bitmap to be leaked. Do not permit multiple image headers. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 8ce433557adeadbc46429aabb9f850b02ad2bdfb) +--- + grub-core/video/readers/png.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index e2a6b1cf3c..8955b8ecfd 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -258,6 +258,9 @@ grub_png_decode_image_header (struct grub_png_data *data) + int color_bits; + enum grub_video_blit_format blt; + ++ if (data->image_width || data->image_height) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: two image headers found"); ++ + data->image_width = grub_png_get_dword (data); + data->image_height = grub_png_get_dword (data); + diff --git a/0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch b/0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch new file mode 100644 index 00000000..4529cb8e --- /dev/null +++ b/0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch @@ -0,0 +1,170 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 6 Jul 2021 18:51:35 +1000 +Subject: [PATCH] video/readers/png: Drop greyscale support to fix heap + out-of-bounds write + +A 16-bit greyscale PNG without alpha is processed in the following loop: + + for (i = 0; i < (data->image_width * data->image_height); + i++, d1 += 4, d2 += 2) + { + d1[R3] = d2[1]; + d1[G3] = d2[1]; + d1[B3] = d2[1]; + } + +The increment of d1 is wrong. d1 is incremented by 4 bytes per iteration, +but there are only 3 bytes allocated for storage. This means that image +data will overwrite somewhat-attacker-controlled parts of memory - 3 bytes +out of every 4 following the end of the image. + +This has existed since greyscale support was added in 2013 in commit +3ccf16dff98f (grub-core/video/readers/png.c: Support grayscale). + +Saving starfield.png as a 16-bit greyscale image without alpha in the gimp +and attempting to load it causes grub-emu to crash - I don't think this code +has ever worked. + +Delete all PNG greyscale support. + +Fixes: CVE-2021-3695 + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 0e1d163382669bd734439d8864ee969616d971d9) +[rharwood: context conflict] +Signed-off-by: Robbie Harwood +--- + grub-core/video/readers/png.c | 85 +++---------------------------------------- + 1 file changed, 6 insertions(+), 79 deletions(-) + +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index 8955b8ecfd..a3161e25b6 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -100,7 +100,7 @@ struct grub_png_data + + unsigned image_width, image_height; + int bpp, is_16bit; +- int raw_bytes, is_gray, is_alpha, is_palette; ++ int raw_bytes, is_alpha, is_palette; + int row_bytes, color_bits; + grub_uint8_t *image_data; + +@@ -296,13 +296,13 @@ grub_png_decode_image_header (struct grub_png_data *data) + data->bpp = 3; + else + { +- data->is_gray = 1; +- data->bpp = 1; ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "png: color type not supported"); + } + + if ((color_bits != 8) && (color_bits != 16) + && (color_bits != 4 +- || !(data->is_gray || data->is_palette))) ++ || !data->is_palette)) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "png: bit depth must be 8 or 16"); + +@@ -331,7 +331,7 @@ grub_png_decode_image_header (struct grub_png_data *data) + } + + #ifndef GRUB_CPU_WORDS_BIGENDIAN +- if (data->is_16bit || data->is_gray || data->is_palette) ++ if (data->is_16bit || data->is_palette) + #endif + { + data->image_data = grub_calloc (data->image_height, data->row_bytes); +@@ -899,27 +899,8 @@ grub_png_convert_image (struct grub_png_data *data) + int shift; + int mask = (1 << data->color_bits) - 1; + unsigned j; +- if (data->is_gray) +- { +- /* Generic formula is +- (0xff * i) / ((1U << data->color_bits) - 1) +- but for allowed bit depth of 1, 2 and for it's +- equivalent to +- (0xff / ((1U << data->color_bits) - 1)) * i +- Precompute the multipliers to avoid division. +- */ + +- const grub_uint8_t multipliers[5] = { 0xff, 0xff, 0x55, 0x24, 0x11 }; +- for (i = 0; i < (1U << data->color_bits); i++) +- { +- grub_uint8_t col = multipliers[data->color_bits] * i; +- palette[i][0] = col; +- palette[i][1] = col; +- palette[i][2] = col; +- } +- } +- else +- grub_memcpy (palette, data->palette, 3 << data->color_bits); ++ grub_memcpy (palette, data->palette, 3 << data->color_bits); + d1c = d1; + d2c = d2; + for (j = 0; j < data->image_height; j++, d1c += data->image_width * 3, +@@ -956,60 +937,6 @@ grub_png_convert_image (struct grub_png_data *data) + } + return; + } +- +- if (data->is_gray) +- { +- switch (data->bpp) +- { +- case 4: +- /* 16-bit gray with alpha. */ +- for (i = 0; i < (data->image_width * data->image_height); +- i++, d1 += 4, d2 += 4) +- { +- d1[R4] = d2[3]; +- d1[G4] = d2[3]; +- d1[B4] = d2[3]; +- d1[A4] = d2[1]; +- } +- break; +- case 2: +- if (data->is_16bit) +- /* 16-bit gray without alpha. */ +- { +- for (i = 0; i < (data->image_width * data->image_height); +- i++, d1 += 4, d2 += 2) +- { +- d1[R3] = d2[1]; +- d1[G3] = d2[1]; +- d1[B3] = d2[1]; +- } +- } +- else +- /* 8-bit gray with alpha. */ +- { +- for (i = 0; i < (data->image_width * data->image_height); +- i++, d1 += 4, d2 += 2) +- { +- d1[R4] = d2[1]; +- d1[G4] = d2[1]; +- d1[B4] = d2[1]; +- d1[A4] = d2[0]; +- } +- } +- break; +- /* 8-bit gray without alpha. */ +- case 1: +- for (i = 0; i < (data->image_width * data->image_height); +- i++, d1 += 3, d2++) +- { +- d1[R3] = d2[0]; +- d1[G3] = d2[0]; +- d1[B3] = d2[0]; +- } +- break; +- } +- return; +- } + + { + /* Only copy the upper 8 bit. */ diff --git a/0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch b/0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch new file mode 100644 index 00000000..51dddfe5 --- /dev/null +++ b/0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 6 Jul 2021 23:25:07 +1000 +Subject: [PATCH] video/readers/png: Avoid heap OOB R/W inserting huff table + items + +In fuzzing we observed crashes where a code would attempt to be inserted +into a huffman table before the start, leading to a set of heap OOB reads +and writes as table entries with negative indices were shifted around and +the new code written in. + +Catch the case where we would underflow the array and bail. + +Fixes: CVE-2021-3696 + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 1ae9a91d42cb40da8a6f11fac65541858e340afa) +--- + grub-core/video/readers/png.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index a3161e25b6..d7ed5aa6cf 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -438,6 +438,13 @@ grub_png_insert_huff_item (struct huff_table *ht, int code, int len) + for (i = len; i < ht->max_length; i++) + n += ht->maxval[i]; + ++ if (n > ht->num_values) ++ { ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "png: out of range inserting huffman table item"); ++ return; ++ } ++ + for (i = 0; i < n; i++) + ht->values[ht->num_values - i] = ht->values[ht->num_values - i - 1]; + diff --git a/0233-video-readers-png-Sanity-check-some-huffman-codes.patch b/0233-video-readers-png-Sanity-check-some-huffman-codes.patch new file mode 100644 index 00000000..c9cef259 --- /dev/null +++ b/0233-video-readers-png-Sanity-check-some-huffman-codes.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 6 Jul 2021 19:19:11 +1000 +Subject: [PATCH] video/readers/png: Sanity check some huffman codes + +ASAN picked up two OOB global reads: we weren't checking if some code +values fit within the cplens or cpdext arrays. Check and throw an error +if not. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit c3a8ab0cbd24153ec7b1f84a96ddfdd72ef8d117) +--- + grub-core/video/readers/png.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index d7ed5aa6cf..7f2ba7849b 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -753,6 +753,9 @@ grub_png_read_dynamic_block (struct grub_png_data *data) + int len, dist, pos; + + n -= 257; ++ if (((unsigned int) n) >= ARRAY_SIZE (cplens)) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "png: invalid huff code"); + len = cplens[n]; + if (cplext[n]) + len += grub_png_get_bits (data, cplext[n]); +@@ -760,6 +763,9 @@ grub_png_read_dynamic_block (struct grub_png_data *data) + return grub_errno; + + n = grub_png_get_huff_code (data, &data->dist_table); ++ if (((unsigned int) n) >= ARRAY_SIZE (cpdist)) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "png: invalid huff code"); + dist = cpdist[n]; + if (cpdext[n]) + dist += grub_png_get_bits (data, cpdext[n]); diff --git a/0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch b/0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch new file mode 100644 index 00000000..54918163 --- /dev/null +++ b/0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch @@ -0,0 +1,255 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 28 Jun 2021 14:16:14 +1000 +Subject: [PATCH] video/readers/jpeg: Abort sooner if a read operation fails + +Fuzzing revealed some inputs that were taking a long time, potentially +forever, because they did not bail quickly upon encountering an I/O error. + +Try to catch I/O errors sooner and bail out. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit ab2e5d2e4bff488bbb557ed435a61ae102ef9f0c) +--- + grub-core/video/readers/jpeg.c | 86 ++++++++++++++++++++++++++++++++++-------- + 1 file changed, 70 insertions(+), 16 deletions(-) + +diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c +index e31602f766..10225abd53 100644 +--- a/grub-core/video/readers/jpeg.c ++++ b/grub-core/video/readers/jpeg.c +@@ -109,9 +109,17 @@ static grub_uint8_t + grub_jpeg_get_byte (struct grub_jpeg_data *data) + { + grub_uint8_t r; ++ grub_ssize_t bytes_read; + + r = 0; +- grub_file_read (data->file, &r, 1); ++ bytes_read = grub_file_read (data->file, &r, 1); ++ ++ if (bytes_read != 1) ++ { ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "jpeg: unexpected end of data"); ++ return 0; ++ } + + return r; + } +@@ -120,9 +128,17 @@ static grub_uint16_t + grub_jpeg_get_word (struct grub_jpeg_data *data) + { + grub_uint16_t r; ++ grub_ssize_t bytes_read; + + r = 0; +- grub_file_read (data->file, &r, sizeof (grub_uint16_t)); ++ bytes_read = grub_file_read (data->file, &r, sizeof (grub_uint16_t)); ++ ++ if (bytes_read != sizeof (grub_uint16_t)) ++ { ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "jpeg: unexpected end of data"); ++ return 0; ++ } + + return grub_be_to_cpu16 (r); + } +@@ -135,6 +151,11 @@ grub_jpeg_get_bit (struct grub_jpeg_data *data) + if (data->bit_mask == 0) + { + data->bit_save = grub_jpeg_get_byte (data); ++ if (grub_errno != GRUB_ERR_NONE) { ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "jpeg: file read error"); ++ return 0; ++ } + if (data->bit_save == JPEG_ESC_CHAR) + { + if (grub_jpeg_get_byte (data) != 0) +@@ -143,6 +164,11 @@ grub_jpeg_get_bit (struct grub_jpeg_data *data) + "jpeg: invalid 0xFF in data stream"); + return 0; + } ++ if (grub_errno != GRUB_ERR_NONE) ++ { ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: file read error"); ++ return 0; ++ } + } + data->bit_mask = 0x80; + } +@@ -161,7 +187,7 @@ grub_jpeg_get_number (struct grub_jpeg_data *data, int num) + return 0; + + msb = value = grub_jpeg_get_bit (data); +- for (i = 1; i < num; i++) ++ for (i = 1; i < num && grub_errno == GRUB_ERR_NONE; i++) + value = (value << 1) + (grub_jpeg_get_bit (data) != 0); + if (!msb) + value += 1 - (1 << num); +@@ -202,6 +228,8 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data) + while (data->file->offset + sizeof (count) + 1 <= next_marker) + { + id = grub_jpeg_get_byte (data); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + ac = (id >> 4) & 1; + id &= 0xF; + if (id > 1) +@@ -252,6 +280,8 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data) + + next_marker = data->file->offset; + next_marker += grub_jpeg_get_word (data); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + + if (next_marker > data->file->size) + { +@@ -263,6 +293,8 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data) + <= next_marker) + { + id = grub_jpeg_get_byte (data); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + if (id >= 0x10) /* Upper 4-bit is precision. */ + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: only 8-bit precision is supported"); +@@ -294,6 +326,9 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data) + next_marker = data->file->offset; + next_marker += grub_jpeg_get_word (data); + ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; ++ + if (grub_jpeg_get_byte (data) != 8) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: only 8-bit precision is supported"); +@@ -319,6 +354,8 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid index"); + + ss = grub_jpeg_get_byte (data); /* Sampling factor. */ ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + if (!id) + { + grub_uint8_t vs, hs; +@@ -498,7 +535,7 @@ grub_jpeg_idct_transform (jpeg_data_unit_t du) + } + } + +-static void ++static grub_err_t + grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du) + { + int h1, h2, qt; +@@ -513,6 +550,9 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du) + data->dc_value[id] += + grub_jpeg_get_number (data, grub_jpeg_get_huff_code (data, h1)); + ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; ++ + du[0] = data->dc_value[id] * (int) data->quan_table[qt][0]; + pos = 1; + while (pos < ARRAY_SIZE (data->quan_table[qt])) +@@ -527,11 +567,13 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du) + num >>= 4; + pos += num; + ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; ++ + if (pos >= ARRAY_SIZE (jpeg_zigzag_order)) + { +- grub_error (GRUB_ERR_BAD_FILE_TYPE, +- "jpeg: invalid position in zigzag order!?"); +- return; ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "jpeg: invalid position in zigzag order!?"); + } + + du[jpeg_zigzag_order[pos]] = val * (int) data->quan_table[qt][pos]; +@@ -539,6 +581,7 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du) + } + + grub_jpeg_idct_transform (du); ++ return GRUB_ERR_NONE; + } + + static void +@@ -597,7 +640,8 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data) + data_offset += grub_jpeg_get_word (data); + + cc = grub_jpeg_get_byte (data); +- ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + if (cc != 3 && cc != 1) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: component count must be 1 or 3"); +@@ -610,7 +654,8 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data) + id = grub_jpeg_get_byte (data) - 1; + if ((id < 0) || (id >= 3)) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid index"); +- ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + ht = grub_jpeg_get_byte (data); + data->comp_index[id][1] = (ht >> 4); + data->comp_index[id][2] = (ht & 0xF) + 2; +@@ -618,11 +663,14 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data) + if ((data->comp_index[id][1] < 0) || (data->comp_index[id][1] > 3) || + (data->comp_index[id][2] < 0) || (data->comp_index[id][2] > 3)) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid hufftable index"); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + } + + grub_jpeg_get_byte (data); /* Skip 3 unused bytes. */ + grub_jpeg_get_word (data); +- ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; + if (data->file->offset != data_offset) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: extra byte in sos"); + +@@ -640,6 +688,7 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) + { + unsigned c1, vb, hb, nr1, nc1; + int rst = data->dri; ++ grub_err_t err = GRUB_ERR_NONE; + + vb = 8 << data->log_vs; + hb = 8 << data->log_hs; +@@ -660,17 +709,22 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) + + for (r2 = 0; r2 < (1U << data->log_vs); r2++) + for (c2 = 0; c2 < (1U << data->log_hs); c2++) +- grub_jpeg_decode_du (data, 0, data->ydu[r2 * 2 + c2]); ++ { ++ err = grub_jpeg_decode_du (data, 0, data->ydu[r2 * 2 + c2]); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ } + + if (data->color_components >= 3) + { +- grub_jpeg_decode_du (data, 1, data->cbdu); +- grub_jpeg_decode_du (data, 2, data->crdu); ++ err = grub_jpeg_decode_du (data, 1, data->cbdu); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ err = grub_jpeg_decode_du (data, 2, data->crdu); ++ if (err != GRUB_ERR_NONE) ++ return err; + } + +- if (grub_errno) +- return grub_errno; +- + nr2 = (data->r1 == nr1 - 1) ? (data->image_height - data->r1 * vb) : vb; + nc2 = (c1 == nc1 - 1) ? (data->image_width - c1 * hb) : hb; + diff --git a/0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch b/0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch new file mode 100644 index 00000000..199ec32c --- /dev/null +++ b/0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 28 Jun 2021 14:16:58 +1000 +Subject: [PATCH] video/readers/jpeg: Do not reallocate a given huff table + +Fix a memory leak where an invalid file could cause us to reallocate +memory for a huffman table we had already allocated memory for. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit bc06e12b4de55cc6f926af9f064170c82b1403e9) +--- + grub-core/video/readers/jpeg.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c +index 10225abd53..caa211f06d 100644 +--- a/grub-core/video/readers/jpeg.c ++++ b/grub-core/video/readers/jpeg.c +@@ -245,6 +245,9 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data) + n += count[i]; + + id += ac * 2; ++ if (data->huff_value[id] != NULL) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "jpeg: attempt to reallocate huffman table"); + data->huff_value[id] = grub_malloc (n); + if (grub_errno) + return grub_errno; diff --git a/0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch b/0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch new file mode 100644 index 00000000..179238be --- /dev/null +++ b/0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 28 Jun 2021 14:25:17 +1000 +Subject: [PATCH] video/readers/jpeg: Refuse to handle multiple start of + streams + +An invalid file could contain multiple start of stream blocks, which +would cause us to reallocate and leak our bitmap. Refuse to handle +multiple start of streams. + +Additionally, fix a grub_error() call formatting. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit f3a854def3e281b7ad4bbea730cd3046de1da52f) +--- + grub-core/video/readers/jpeg.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c +index caa211f06d..1df1171d78 100644 +--- a/grub-core/video/readers/jpeg.c ++++ b/grub-core/video/readers/jpeg.c +@@ -677,6 +677,9 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data) + if (data->file->offset != data_offset) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: extra byte in sos"); + ++ if (*data->bitmap) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: too many start of scan blocks"); ++ + if (grub_video_bitmap_create (data->bitmap, data->image_width, + data->image_height, + GRUB_VIDEO_BLIT_FORMAT_RGB_888)) +@@ -699,8 +702,8 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) + nc1 = (data->image_width + hb - 1) >> (3 + data->log_hs); + + if (data->bitmap_ptr == NULL) +- return grub_error(GRUB_ERR_BAD_FILE_TYPE, +- "jpeg: attempted to decode data before start of stream"); ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "jpeg: attempted to decode data before start of stream"); + + for (; data->r1 < nr1 && (!data->dri || rst); + data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) diff --git a/0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch b/0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch new file mode 100644 index 00000000..99eeb621 --- /dev/null +++ b/0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Wed, 7 Jul 2021 15:38:19 +1000 +Subject: [PATCH] video/readers/jpeg: Block int underflow -> wild pointer write + +Certain 1 px wide images caused a wild pointer write in +grub_jpeg_ycrcb_to_rgb(). This was caused because in grub_jpeg_decode_data(), +we have the following loop: + +for (; data->r1 < nr1 && (!data->dri || rst); + data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) + +We did not check if vb * width >= hb * nc1. + +On a 64-bit platform, if that turns out to be negative, it will underflow, +be interpreted as unsigned 64-bit, then be added to the 64-bit pointer, so +we see data->bitmap_ptr jump, e.g.: + +0x6180_0000_0480 to +0x6181_0000_0498 + ^ + ~--- carry has occurred and this pointer is now far away from + any object. + +On a 32-bit platform, it will decrement the pointer, creating a pointer +that won't crash but will overwrite random data. + +Catch the underflow and error out. + +Fixes: CVE-2021-3697 + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 41aeb2004db9924fecd9f2dd64bc2a5a5594a4b5) +--- + grub-core/video/readers/jpeg.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c +index 1df1171d78..2da04094b3 100644 +--- a/grub-core/video/readers/jpeg.c ++++ b/grub-core/video/readers/jpeg.c +@@ -705,6 +705,10 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: attempted to decode data before start of stream"); + ++ if (vb * data->image_width <= hb * nc1) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "jpeg: cannot decode image with these dimensions"); ++ + for (; data->r1 < nr1 && (!data->dri || rst); + data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) + for (c1 = 0; c1 < nc1 && (!data->dri || rst); diff --git a/0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch b/0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch new file mode 100644 index 00000000..6e64ed86 --- /dev/null +++ b/0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 13 Jul 2021 13:24:38 +1000 +Subject: [PATCH] normal/charset: Fix array out-of-bounds formatting unicode + for display + +In some cases attempting to display arbitrary binary strings leads +to ASAN splats reading the widthspec array out of bounds. + +Check the index. If it would be out of bounds, return a width of 1. +I don't know if that's strictly correct, but we're not really expecting +great display of arbitrary binary data, and it's certainly not worse than +an OOB read. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit fdf32abc7a3928852422c0f291d8cd1dd6b34a8d) +--- + grub-core/normal/charset.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c +index 4dfcc31078..7a5a7c153c 100644 +--- a/grub-core/normal/charset.c ++++ b/grub-core/normal/charset.c +@@ -395,6 +395,8 @@ grub_unicode_estimate_width (const struct grub_unicode_glyph *c) + { + if (grub_unicode_get_comb_type (c->base)) + return 0; ++ if (((unsigned long) (c->base >> 3)) >= ARRAY_SIZE (widthspec)) ++ return 1; + if (widthspec[c->base >> 3] & (1 << (c->base & 7))) + return 2; + else diff --git a/0239-net-netbuff-Block-overly-large-netbuff-allocs.patch b/0239-net-netbuff-Block-overly-large-netbuff-allocs.patch new file mode 100644 index 00000000..2e10d49e --- /dev/null +++ b/0239-net-netbuff-Block-overly-large-netbuff-allocs.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 8 Mar 2022 23:47:46 +1100 +Subject: [PATCH] net/netbuff: Block overly large netbuff allocs + +A netbuff shouldn't be too huge. It's bounded by MTU and TCP segment +reassembly. + +This helps avoid some bugs (and provides a spot to instrument to catch +them at their source). + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit ee9591103004cd13b4efadda671536090ca7fd57) +--- + grub-core/net/netbuff.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/grub-core/net/netbuff.c b/grub-core/net/netbuff.c +index dbeeefe478..d5e9e9a0d7 100644 +--- a/grub-core/net/netbuff.c ++++ b/grub-core/net/netbuff.c +@@ -79,10 +79,23 @@ grub_netbuff_alloc (grub_size_t len) + + COMPILE_TIME_ASSERT (NETBUFF_ALIGN % sizeof (grub_properly_aligned_t) == 0); + ++ /* ++ * The largest size of a TCP packet is 64 KiB, and everything else ++ * should be a lot smaller - most MTUs are 1500 or less. Cap data ++ * size at 64 KiB + a buffer. ++ */ ++ if (len > 0xffffUL + 0x1000UL) ++ { ++ grub_error (GRUB_ERR_BUG, ++ "attempted to allocate a packet that is too big"); ++ return NULL; ++ } ++ + if (len < NETBUFFMINLEN) + len = NETBUFFMINLEN; + + len = ALIGN_UP (len, NETBUFF_ALIGN); ++ + #ifdef GRUB_MACHINE_EMU + data = grub_malloc (len + sizeof (*nb)); + #else diff --git a/0240-net-ip-Do-IP-fragment-maths-safely.patch b/0240-net-ip-Do-IP-fragment-maths-safely.patch new file mode 100644 index 00000000..118448d1 --- /dev/null +++ b/0240-net-ip-Do-IP-fragment-maths-safely.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 20 Dec 2021 19:41:21 +1100 +Subject: [PATCH] net/ip: Do IP fragment maths safely + +This avoids an underflow and subsequent unpleasantness. + +Fixes: CVE-2022-28733 + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit eb74e5743ca7e18a5e75c392fe0b21d1549a1936) +--- + grub-core/net/ip.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c +index ce6bdc75c6..cf74f1f794 100644 +--- a/grub-core/net/ip.c ++++ b/grub-core/net/ip.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + + struct iphdr { +@@ -551,7 +552,14 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, + { + rsm->total_len = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK) + + (nb->tail - nb->data)); +- rsm->total_len -= ((iph->verhdrlen & 0xf) * sizeof (grub_uint32_t)); ++ ++ if (grub_sub (rsm->total_len, (iph->verhdrlen & 0xf) * sizeof (grub_uint32_t), ++ &rsm->total_len)) ++ { ++ grub_dprintf ("net", "IP reassembly size underflow\n"); ++ return GRUB_ERR_NONE; ++ } ++ + rsm->asm_netbuff = grub_netbuff_alloc (rsm->total_len); + if (!rsm->asm_netbuff) + { diff --git a/0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch b/0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch new file mode 100644 index 00000000..19701b6a --- /dev/null +++ b/0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 16 Sep 2021 01:29:54 +1000 +Subject: [PATCH] net/dns: Fix double-free addresses on corrupt DNS response + +grub_net_dns_lookup() takes as inputs a pointer to an array of addresses +("addresses") for the given name, and pointer to a number of addresses +("naddresses"). grub_net_dns_lookup() is responsible for allocating +"addresses", and the caller is responsible for freeing it if +"naddresses" > 0. + +The DNS recv_hook will sometimes set and free the addresses array, +for example if the packet is too short: + + if (ptr + 10 >= nb->tail) + { + if (!*data->naddresses) + grub_free (*data->addresses); + grub_netbuff_free (nb); + return GRUB_ERR_NONE; + } + +Later on the nslookup command code unconditionally frees the "addresses" +array. Normally this is fine: the array is either populated with valid +data or is NULL. But in these sorts of error cases it is neither NULL +nor valid and we get a double-free. + +Only free "addresses" if "naddresses" > 0. + +It looks like the other use of grub_net_dns_lookup() is not affected. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit eb2e69fcf51307757e43f55ee8c9354d1ee42dd1) +--- + grub-core/net/dns.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c +index 906ec7d678..135faac035 100644 +--- a/grub-core/net/dns.c ++++ b/grub-core/net/dns.c +@@ -667,9 +667,11 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)), + grub_net_addr_to_str (&addresses[i], buf); + grub_printf ("%s\n", buf); + } +- grub_free (addresses); + if (naddresses) +- return GRUB_ERR_NONE; ++ { ++ grub_free (addresses); ++ return GRUB_ERR_NONE; ++ } + return grub_error (GRUB_ERR_NET_NO_DOMAIN, N_("no DNS record found")); + } + diff --git a/0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch b/0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch new file mode 100644 index 00000000..ab0d4712 --- /dev/null +++ b/0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 20 Dec 2021 21:55:43 +1100 +Subject: [PATCH] net/dns: Don't read past the end of the string we're checking + against + +I don't really understand what's going on here but fuzzing found +a bug where we read past the end of check_with. That's a C string, +so use grub_strlen() to make sure we don't overread it. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 6a97b3f4b1d5173aa516edc6dedbc63de7306d21) +--- + grub-core/net/dns.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c +index 135faac035..17961a9f18 100644 +--- a/grub-core/net/dns.c ++++ b/grub-core/net/dns.c +@@ -146,11 +146,18 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head, + int *length, char *set) + { + const char *readable_ptr = check_with; ++ int readable_len; + const grub_uint8_t *ptr; + char *optr = set; + int bytes_processed = 0; + if (length) + *length = 0; ++ ++ if (readable_ptr != NULL) ++ readable_len = grub_strlen (readable_ptr); ++ else ++ readable_len = 0; ++ + for (ptr = name_at; ptr < tail && bytes_processed < tail - head + 2; ) + { + /* End marker. */ +@@ -172,13 +179,16 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head, + ptr = head + (((ptr[0] & 0x3f) << 8) | ptr[1]); + continue; + } +- if (readable_ptr && grub_memcmp (ptr + 1, readable_ptr, *ptr) != 0) ++ if (readable_ptr != NULL && (*ptr > readable_len || grub_memcmp (ptr + 1, readable_ptr, *ptr) != 0)) + return 0; + if (grub_memchr (ptr + 1, 0, *ptr) + || grub_memchr (ptr + 1, '.', *ptr)) + return 0; + if (readable_ptr) +- readable_ptr += *ptr; ++ { ++ readable_ptr += *ptr; ++ readable_len -= *ptr; ++ } + if (readable_ptr && *readable_ptr != '.' && *readable_ptr != 0) + return 0; + bytes_processed += *ptr + 1; +@@ -192,7 +202,10 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head, + if (optr) + *optr++ = '.'; + if (readable_ptr && *readable_ptr) +- readable_ptr++; ++ { ++ readable_ptr++; ++ readable_len--; ++ } + ptr += *ptr + 1; + } + return 0; diff --git a/0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch b/0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch new file mode 100644 index 00000000..3ff7b6bb --- /dev/null +++ b/0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch @@ -0,0 +1,112 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 20 Sep 2021 01:12:24 +1000 +Subject: [PATCH] net/tftp: Prevent a UAF and double-free from a failed seek + +A malicious tftp server can cause UAFs and a double free. + +An attempt to read from a network file is handled by grub_net_fs_read(). If +the read is at an offset other than the current offset, grub_net_seek_real() +is invoked. + +In grub_net_seek_real(), if a backwards seek cannot be satisfied from the +currently received packets, and the underlying transport does not provide +a seek method, then grub_net_seek_real() will close and reopen the network +protocol layer. + +For tftp, the ->close() call goes to tftp_close() and frees the tftp_data_t +file->data. The file->data pointer is not nulled out after the free. + +If the ->open() call fails, the file->data will not be reallocated and will +continue point to a freed memory block. This could happen from a server +refusing to send the requisite ack to the new tftp request, for example. + +The seek and the read will then fail, but the grub_file continues to exist: +the failed seek does not necessarily cause the entire file to be thrown +away (e.g. where the file is checked to see if it is gzipped/lzio/xz/etc., +a read failure is interpreted as a decompressor passing on the file, not as +an invalidation of the entire grub_file_t structure). + +This means subsequent attempts to read or seek the file will use the old +file->data after free. Eventually, the file will be close()d again and +file->data will be freed again. + +Mark a net_fs file that doesn't reopen as broken. Do not permit read() or +close() on a broken file (seek is not exposed directly to the file API - +it is only called as part of read, so this blocks seeks as well). + +As an additional defence, null out the ->data pointer if tftp_open() fails. +That would have lead to a simple null pointer dereference rather than +a mess of UAFs. + +This may affect other protocols, I haven't checked. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit dada1dda695439bb55b2848dddc2d89843552f81) +--- + grub-core/net/net.c | 11 +++++++++-- + grub-core/net/tftp.c | 1 + + include/grub/net.h | 1 + + 3 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 55aed92722..1001c611d1 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -1625,7 +1625,8 @@ grub_net_fs_close (grub_file_t file) + grub_netbuff_free (file->device->net->packs.first->nb); + grub_net_remove_packet (file->device->net->packs.first); + } +- file->device->net->protocol->close (file); ++ if (!file->device->net->broken) ++ file->device->net->protocol->close (file); + grub_free (file->device->net->name); + return GRUB_ERR_NONE; + } +@@ -1847,7 +1848,10 @@ grub_net_seek_real (struct grub_file *file, grub_off_t offset) + file->device->net->stall = 0; + err = file->device->net->protocol->open (file, file->device->net->name); + if (err) +- return err; ++ { ++ file->device->net->broken = 1; ++ return err; ++ } + grub_net_fs_read_real (file, NULL, offset); + return grub_errno; + } +@@ -1856,6 +1860,9 @@ grub_net_seek_real (struct grub_file *file, grub_off_t offset) + static grub_ssize_t + grub_net_fs_read (grub_file_t file, char *buf, grub_size_t len) + { ++ if (file->device->net->broken) ++ return -1; ++ + if (file->offset != file->device->net->offset) + { + grub_err_t err; +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index d54b13f09f..788ad1dc44 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -408,6 +408,7 @@ tftp_open (struct grub_file *file, const char *filename) + { + grub_net_udp_close (data->sock); + grub_free (data); ++ file->data = NULL; + return grub_errno; + } + +diff --git a/include/grub/net.h b/include/grub/net.h +index 42af7de250..9e4898cc6b 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -280,6 +280,7 @@ typedef struct grub_net + grub_fs_t fs; + int eof; + int stall; ++ int broken; + } *grub_net_t; + + extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name); diff --git a/0244-net-tftp-Avoid-a-trivial-UAF.patch b/0244-net-tftp-Avoid-a-trivial-UAF.patch new file mode 100644 index 00000000..4ec3b562 --- /dev/null +++ b/0244-net-tftp-Avoid-a-trivial-UAF.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 18 Jan 2022 14:29:20 +1100 +Subject: [PATCH] net/tftp: Avoid a trivial UAF + +Under tftp errors, we print a tftp error message from the tftp header. +However, the tftph pointer is a pointer inside nb, the netbuff. Previously, +we were freeing the nb and then dereferencing it. Don't do that, use it +and then free it later. + +This isn't really _bad_ per se, especially as we're single-threaded, but +it trips up fuzzers. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 956f4329cec23e4375182030ca9b2be631a61ba5) +--- + grub-core/net/tftp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index 788ad1dc44..a95766dcbd 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -251,9 +251,9 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), + return GRUB_ERR_NONE; + case TFTP_ERROR: + data->have_oack = 1; +- grub_netbuff_free (nb); + grub_error (GRUB_ERR_IO, "%s", tftph->u.err.errmsg); + grub_error_save (&data->save_err); ++ grub_netbuff_free (nb); + return GRUB_ERR_NONE; + default: + grub_netbuff_free (nb); diff --git a/0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch b/0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch new file mode 100644 index 00000000..186f0c3d --- /dev/null +++ b/0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 1 Mar 2022 23:14:15 +1100 +Subject: [PATCH] net/http: Do not tear down socket if it's already been torn + down + +It's possible for data->sock to get torn down in tcp error handling. +If we unconditionally tear it down again we will end up doing writes +to an offset of the NULL pointer when we go to tear it down again. + +Detect if it has been torn down and don't do it again. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit ec233d3ecf995293304de443579aab5c46c49e85) +--- + grub-core/net/http.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index 7f878b5615..19cb8768e3 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -427,7 +427,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) + return err; + } + +- for (i = 0; !data->headers_recv && i < 100; i++) ++ for (i = 0; data->sock && !data->headers_recv && i < 100; i++) + { + grub_net_tcp_retransmit (); + grub_net_poll_cards (300, &data->headers_recv); +@@ -435,7 +435,8 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) + + if (!data->headers_recv) + { +- grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT); ++ if (data->sock) ++ grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT); + if (data->err) + { + char *str = data->errmsg; diff --git a/0246-net-http-Fix-OOB-write-for-split-http-headers.patch b/0246-net-http-Fix-OOB-write-for-split-http-headers.patch new file mode 100644 index 00000000..f22960b1 --- /dev/null +++ b/0246-net-http-Fix-OOB-write-for-split-http-headers.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 8 Mar 2022 18:17:03 +1100 +Subject: [PATCH] net/http: Fix OOB write for split http headers + +GRUB has special code for handling an http header that is split +across two packets. + +The code tracks the end of line by looking for a "\n" byte. The +code for split headers has always advanced the pointer just past the +end of the line, whereas the code that handles unsplit headers does +not advance the pointer. This extra advance causes the length to be +one greater, which breaks an assumption in parse_line(), leading to +it writing a NUL byte one byte past the end of the buffer where we +reconstruct the line from the two packets. + +It's conceivable that an attacker controlled set of packets could +cause this to zero out the first byte of the "next" pointer of the +grub_mm_region structure following the current_line buffer. + +Do not advance the pointer in the split header case. + +Fixes: CVE-2022-28734 + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit e9fb459638811c12b0989dbf64e3e124974ef617) +--- + grub-core/net/http.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index 19cb8768e3..58546739a2 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -193,9 +193,7 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)), + int have_line = 1; + char *t; + ptr = grub_memchr (nb->data, '\n', nb->tail - nb->data); +- if (ptr) +- ptr++; +- else ++ if (ptr == NULL) + { + have_line = 0; + ptr = (char *) nb->tail; diff --git a/0247-net-http-Error-out-on-headers-with-LF-without-CR.patch b/0247-net-http-Error-out-on-headers-with-LF-without-CR.patch new file mode 100644 index 00000000..b73c1691 --- /dev/null +++ b/0247-net-http-Error-out-on-headers-with-LF-without-CR.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 8 Mar 2022 19:04:40 +1100 +Subject: [PATCH] net/http: Error out on headers with LF without CR + +In a similar vein to the previous patch, parse_line() would write +a NUL byte past the end of the buffer if there was an HTTP header +with a LF rather than a CRLF. + +RFC-2616 says: + + Many HTTP/1.1 header field values consist of words separated by LWS + or special characters. These special characters MUST be in a quoted + string to be used within a parameter value (as defined in section 3.6). + +We don't support quoted sections or continuation lines, etc. + +If we see an LF that's not part of a CRLF, bail out. + +Fixes: CVE-2022-28734 + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit d232ad41ac4979a9de4d746e5fdff9caf0e303de) +--- + grub-core/net/http.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index 58546739a2..57d2721719 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -69,7 +69,15 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) + char *end = ptr + len; + while (end > ptr && *(end - 1) == '\r') + end--; ++ ++ /* LF without CR. */ ++ if (end == ptr + len) ++ { ++ data->errmsg = grub_strdup (_("invalid HTTP header - LF without CR")); ++ return GRUB_ERR_NONE; ++ } + *end = 0; ++ + /* Trailing CRLF. */ + if (data->in_chunk_len == 1) + { diff --git a/0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch b/0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch new file mode 100644 index 00000000..79df1c24 --- /dev/null +++ b/0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sudhakar Kuppusamy +Date: Wed, 6 Apr 2022 18:03:37 +0530 +Subject: [PATCH] fs/f2fs: Do not read past the end of nat journal entries + +A corrupt f2fs file system could specify a nat journal entry count +that is beyond the maximum NAT_JOURNAL_ENTRIES. + +Check if the specified nat journal entry count before accessing the +array, and throw an error if it is too large. + +Signed-off-by: Sudhakar Kuppusamy +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit a3988cb3f0a108dd67ac127a79a4c8479d23334e) +--- + grub-core/fs/f2fs.c | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c +index 8a9992ca9e..63702214b0 100644 +--- a/grub-core/fs/f2fs.c ++++ b/grub-core/fs/f2fs.c +@@ -632,23 +632,27 @@ get_nat_journal (struct grub_f2fs_data *data) + return err; + } + +-static grub_uint32_t +-get_blkaddr_from_nat_journal (struct grub_f2fs_data *data, grub_uint32_t nid) ++static grub_err_t ++get_blkaddr_from_nat_journal (struct grub_f2fs_data *data, grub_uint32_t nid, ++ grub_uint32_t *blkaddr) + { + grub_uint16_t n = grub_le_to_cpu16 (data->nat_j.n_nats); +- grub_uint32_t blkaddr = 0; + grub_uint16_t i; + ++ if (n >= NAT_JOURNAL_ENTRIES) ++ return grub_error (GRUB_ERR_BAD_FS, ++ "invalid number of nat journal entries"); ++ + for (i = 0; i < n; i++) + { + if (grub_le_to_cpu32 (data->nat_j.entries[i].nid) == nid) + { +- blkaddr = grub_le_to_cpu32 (data->nat_j.entries[i].ne.block_addr); ++ *blkaddr = grub_le_to_cpu32 (data->nat_j.entries[i].ne.block_addr); + break; + } + } + +- return blkaddr; ++ return GRUB_ERR_NONE; + } + + static grub_uint32_t +@@ -656,10 +660,13 @@ get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid) + { + struct grub_f2fs_nat_block *nat_block; + grub_uint32_t seg_off, block_off, entry_off, block_addr; +- grub_uint32_t blkaddr; ++ grub_uint32_t blkaddr = 0; + grub_err_t err; + +- blkaddr = get_blkaddr_from_nat_journal (data, nid); ++ err = get_blkaddr_from_nat_journal (data, nid, &blkaddr); ++ if (err != GRUB_ERR_NONE) ++ return 0; ++ + if (blkaddr) + return blkaddr; + diff --git a/0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch b/0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch new file mode 100644 index 00000000..855e8826 --- /dev/null +++ b/0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch @@ -0,0 +1,132 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sudhakar Kuppusamy +Date: Wed, 6 Apr 2022 18:49:09 +0530 +Subject: [PATCH] fs/f2fs: Do not read past the end of nat bitmap + +A corrupt f2fs filesystem could have a block offset or a bitmap +offset that would cause us to read beyond the bounds of the nat +bitmap. + +Introduce the nat_bitmap_size member in grub_f2fs_data which holds +the size of nat bitmap. + +Set the size when loading the nat bitmap in nat_bitmap_ptr(), and +catch when an invalid offset would create a pointer past the end of +the allocated space. + +Check against the bitmap size in grub_f2fs_test_bit() test bit to avoid +reading past the end of the nat bitmap. + +Signed-off-by: Sudhakar Kuppusamy +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 62d63d5e38c67a6e349148bf7cb87c560e935a7e) +--- + grub-core/fs/f2fs.c | 33 +++++++++++++++++++++++++++------ + 1 file changed, 27 insertions(+), 6 deletions(-) + +diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c +index 63702214b0..8898b235e0 100644 +--- a/grub-core/fs/f2fs.c ++++ b/grub-core/fs/f2fs.c +@@ -122,6 +122,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define F2FS_INLINE_DOTS 0x10 /* File having implicit dot dentries. */ + + #define MAX_VOLUME_NAME 512 ++#define MAX_NAT_BITMAP_SIZE 3900 + + enum FILE_TYPE + { +@@ -183,7 +184,7 @@ struct grub_f2fs_checkpoint + grub_uint32_t checksum_offset; + grub_uint64_t elapsed_time; + grub_uint8_t alloc_type[MAX_ACTIVE_LOGS]; +- grub_uint8_t sit_nat_version_bitmap[3900]; ++ grub_uint8_t sit_nat_version_bitmap[MAX_NAT_BITMAP_SIZE]; + grub_uint32_t checksum; + } GRUB_PACKED; + +@@ -302,6 +303,7 @@ struct grub_f2fs_data + + struct grub_f2fs_nat_journal nat_j; + char *nat_bitmap; ++ grub_uint32_t nat_bitmap_size; + + grub_disk_t disk; + struct grub_f2fs_node *inode; +@@ -377,15 +379,20 @@ sum_blk_addr (struct grub_f2fs_data *data, int base, int type) + } + + static void * +-nat_bitmap_ptr (struct grub_f2fs_data *data) ++nat_bitmap_ptr (struct grub_f2fs_data *data, grub_uint32_t *nat_bitmap_size) + { + struct grub_f2fs_checkpoint *ckpt = &data->ckpt; + grub_uint32_t offset; ++ *nat_bitmap_size = MAX_NAT_BITMAP_SIZE; + + if (grub_le_to_cpu32 (data->sblock.cp_payload) > 0) + return ckpt->sit_nat_version_bitmap; + + offset = grub_le_to_cpu32 (ckpt->sit_ver_bitmap_bytesize); ++ if (offset >= MAX_NAT_BITMAP_SIZE) ++ return NULL; ++ ++ *nat_bitmap_size = *nat_bitmap_size - offset; + + return ckpt->sit_nat_version_bitmap + offset; + } +@@ -438,11 +445,15 @@ grub_f2fs_crc_valid (grub_uint32_t blk_crc, void *buf, const grub_uint32_t len) + } + + static int +-grub_f2fs_test_bit (grub_uint32_t nr, const char *p) ++grub_f2fs_test_bit (grub_uint32_t nr, const char *p, grub_uint32_t len) + { + int mask; ++ grub_uint32_t shifted_nr = (nr >> 3); + +- p += (nr >> 3); ++ if (shifted_nr >= len) ++ return -1; ++ ++ p += shifted_nr; + mask = 1 << (7 - (nr & 0x07)); + + return mask & *p; +@@ -662,6 +673,7 @@ get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid) + grub_uint32_t seg_off, block_off, entry_off, block_addr; + grub_uint32_t blkaddr = 0; + grub_err_t err; ++ int result_bit; + + err = get_blkaddr_from_nat_journal (data, nid, &blkaddr); + if (err != GRUB_ERR_NONE) +@@ -682,8 +694,15 @@ get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid) + ((seg_off * data->blocks_per_seg) << 1) + + (block_off & (data->blocks_per_seg - 1)); + +- if (grub_f2fs_test_bit (block_off, data->nat_bitmap)) ++ result_bit = grub_f2fs_test_bit (block_off, data->nat_bitmap, ++ data->nat_bitmap_size); ++ if (result_bit > 0) + block_addr += data->blocks_per_seg; ++ else if (result_bit == -1) ++ { ++ grub_free (nat_block); ++ return 0; ++ } + + err = grub_f2fs_block_read (data, block_addr, nat_block); + if (err) +@@ -833,7 +852,9 @@ grub_f2fs_mount (grub_disk_t disk) + if (err) + goto fail; + +- data->nat_bitmap = nat_bitmap_ptr (data); ++ data->nat_bitmap = nat_bitmap_ptr (data, &data->nat_bitmap_size); ++ if (data->nat_bitmap == NULL) ++ goto fail; + + err = get_nat_journal (data); + if (err) diff --git a/0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch b/0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch new file mode 100644 index 00000000..0553d606 --- /dev/null +++ b/0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sudhakar Kuppusamy +Date: Wed, 6 Apr 2022 18:17:43 +0530 +Subject: [PATCH] fs/f2fs: Do not copy file names that are too long + +A corrupt f2fs file system might specify a name length which is greater +than the maximum name length supported by the GRUB f2fs driver. + +We will allocate enough memory to store the overly long name, but there +are only F2FS_NAME_LEN bytes in the source, so we would read past the end +of the source. + +While checking directory entries, do not copy a file name with an invalid +length. + +Signed-off-by: Sudhakar Kuppusamy +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 9a891f638509e031d322c94e3cbcf38d36f3993a) +--- + grub-core/fs/f2fs.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c +index 8898b235e0..df6beb544c 100644 +--- a/grub-core/fs/f2fs.c ++++ b/grub-core/fs/f2fs.c +@@ -1003,6 +1003,10 @@ grub_f2fs_check_dentries (struct grub_f2fs_dir_iter_ctx *ctx) + + ftype = ctx->dentry[i].file_type; + name_len = grub_le_to_cpu16 (ctx->dentry[i].name_len); ++ ++ if (name_len >= F2FS_NAME_LEN) ++ return 0; ++ + filename = grub_malloc (name_len + 1); + if (!filename) + return 0; diff --git a/0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch b/0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch new file mode 100644 index 00000000..7ff58218 --- /dev/null +++ b/0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Darren Kenny +Date: Tue, 29 Mar 2022 10:49:56 +0000 +Subject: [PATCH] fs/btrfs: Fix several fuzz issues with invalid dir item + sizing + +According to the btrfs code in Linux, the structure of a directory item +leaf should be of the form: + + |struct btrfs_dir_item|name|data| + +in GRUB the name len and data len are in the grub_btrfs_dir_item +structure's n and m fields respectively. + +The combined size of the structure, name and data should be less than +the allocated memory, a difference to the Linux kernel's struct +btrfs_dir_item is that the grub_btrfs_dir_item has an extra field for +where the name is stored, so we adjust for that too. + +Signed-off-by: Darren Kenny +Reviewed-by: Daniel Kiper +(cherry picked from commit 6d3f06c0b6a8992b9b1bb0e62af93ac5ff2781f0) +[rharwood: we've an extra variable here] +Signed-off-by: Robbie Harwood +--- + grub-core/fs/btrfs.c | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 07c0ff874b..2fcfb738fe 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -2254,6 +2254,7 @@ grub_btrfs_dir (grub_device_t device, const char *path, + grub_uint64_t tree; + grub_uint8_t type; + char *new_path = NULL; ++ grub_size_t est_size = 0; + + if (!data) + return grub_errno; +@@ -2320,6 +2321,18 @@ grub_btrfs_dir (grub_device_t device, const char *path, + break; + } + ++ if (direl == NULL || ++ grub_add (grub_le_to_cpu16 (direl->n), ++ grub_le_to_cpu16 (direl->m), &est_size) || ++ grub_add (est_size, sizeof (*direl), &est_size) || ++ grub_sub (est_size, sizeof (direl->name), &est_size) || ++ est_size > allocated) ++ { ++ grub_errno = GRUB_ERR_OUT_OF_RANGE; ++ r = -grub_errno; ++ goto out; ++ } ++ + for (cdirel = direl; + (grub_uint8_t *) cdirel - (grub_uint8_t *) direl + < (grub_ssize_t) elemsize; +@@ -2330,6 +2343,19 @@ grub_btrfs_dir (grub_device_t device, const char *path, + char c; + struct grub_btrfs_inode inode; + struct grub_dirhook_info info; ++ ++ if (cdirel == NULL || ++ grub_add (grub_le_to_cpu16 (cdirel->n), ++ grub_le_to_cpu16 (cdirel->m), &est_size) || ++ grub_add (est_size, sizeof (*cdirel), &est_size) || ++ grub_sub (est_size, sizeof (cdirel->name), &est_size) || ++ est_size > allocated) ++ { ++ grub_errno = GRUB_ERR_OUT_OF_RANGE; ++ r = -grub_errno; ++ goto out; ++ } ++ + err = grub_btrfs_read_inode (data, &inode, cdirel->key.object_id, + tree); + grub_memset (&info, 0, sizeof (info)); diff --git a/0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch b/0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch new file mode 100644 index 00000000..d638c117 --- /dev/null +++ b/0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch @@ -0,0 +1,134 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Darren Kenny +Date: Tue, 29 Mar 2022 15:52:46 +0000 +Subject: [PATCH] fs/btrfs: Fix more ASAN and SEGV issues found with fuzzing + +The fuzzer is generating btrfs file systems that have chunks with +invalid combinations of stripes and substripes for the given RAID +configurations. + +After examining the Linux kernel fs/btrfs/tree-checker.c code, it +appears that sub-stripes should only be applied to RAID10, and in that +case there should only ever be 2 of them. + +Similarly, RAID single should only have 1 stripe, and RAID1/1C3/1C4 +should have 2. 3 or 4 stripes respectively, which is what redundancy +corresponds. + +Some of the chunks ended up with a size of 0, which grub_malloc() still +returned memory for and in turn generated ASAN errors later when +accessed. + +While it would be possible to specifically limit the number of stripes, +a more correct test was on the combination of the chunk item, and the +number of stripes by the size of the chunk stripe structure in +comparison to the size of the chunk itself. + +Signed-off-by: Darren Kenny +Reviewed-by: Daniel Kiper +(cherry picked from commit 3849647b4b98a4419366708fc4b7f339c6f55ec7) +--- + grub-core/fs/btrfs.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 55 insertions(+) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 2fcfb738fe..0e9b450413 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -941,6 +941,12 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + return grub_error (GRUB_ERR_BAD_FS, + "couldn't find the chunk descriptor"); + ++ if (!chsize) ++ { ++ grub_dprintf ("btrfs", "zero-size chunk\n"); ++ return grub_error (GRUB_ERR_BAD_FS, ++ "got an invalid zero-size chunk"); ++ } + chunk = grub_malloc (chsize); + if (!chunk) + return grub_errno; +@@ -999,6 +1005,16 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + stripe_length = grub_divmod64 (grub_le_to_cpu64 (chunk->size), + nstripes, + NULL); ++ ++ /* For single, there should be exactly 1 stripe. */ ++ if (grub_le_to_cpu16 (chunk->nstripes) != 1) ++ { ++ grub_dprintf ("btrfs", "invalid RAID_SINGLE: nstripes != 1 (%u)\n", ++ grub_le_to_cpu16 (chunk->nstripes)); ++ return grub_error (GRUB_ERR_BAD_FS, ++ "invalid RAID_SINGLE: nstripes != 1 (%u)", ++ grub_le_to_cpu16 (chunk->nstripes)); ++ } + if (stripe_length == 0) + stripe_length = 512; + stripen = grub_divmod64 (off, stripe_length, &stripe_offset); +@@ -1018,6 +1034,19 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + stripen = 0; + stripe_offset = off; + csize = grub_le_to_cpu64 (chunk->size) - off; ++ ++ /* ++ * Redundancy, and substripes only apply to RAID10, and there ++ * should be exactly 2 sub-stripes. ++ */ ++ if (grub_le_to_cpu16 (chunk->nstripes) != redundancy) ++ { ++ grub_dprintf ("btrfs", "invalid RAID1: nstripes != %u (%u)\n", ++ redundancy, grub_le_to_cpu16 (chunk->nstripes)); ++ return grub_error (GRUB_ERR_BAD_FS, ++ "invalid RAID1: nstripes != %u (%u)", ++ redundancy, grub_le_to_cpu16 (chunk->nstripes)); ++ } + break; + } + case GRUB_BTRFS_CHUNK_TYPE_RAID0: +@@ -1054,6 +1083,20 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + stripe_offset = low + chunk_stripe_length + * high; + csize = chunk_stripe_length - low; ++ ++ /* ++ * Substripes only apply to RAID10, and there ++ * should be exactly 2 sub-stripes. ++ */ ++ if (grub_le_to_cpu16 (chunk->nsubstripes) != 2) ++ { ++ grub_dprintf ("btrfs", "invalid RAID10: nsubstripes != 2 (%u)", ++ grub_le_to_cpu16 (chunk->nsubstripes)); ++ return grub_error (GRUB_ERR_BAD_FS, ++ "invalid RAID10: nsubstripes != 2 (%u)", ++ grub_le_to_cpu16 (chunk->nsubstripes)); ++ } ++ + break; + } + case GRUB_BTRFS_CHUNK_TYPE_RAID5: +@@ -1153,6 +1196,8 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + + for (j = 0; j < 2; j++) + { ++ grub_size_t est_chunk_alloc = 0; ++ + grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T + "+0x%" PRIxGRUB_UINT64_T + " (%d stripes (%d substripes) of %" +@@ -1165,6 +1210,16 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + grub_dprintf ("btrfs", "reading laddr 0x%" PRIxGRUB_UINT64_T "\n", + addr); + ++ if (grub_mul (sizeof (struct grub_btrfs_chunk_stripe), ++ grub_le_to_cpu16 (chunk->nstripes), &est_chunk_alloc) || ++ grub_add (est_chunk_alloc, ++ sizeof (struct grub_btrfs_chunk_item), &est_chunk_alloc) || ++ est_chunk_alloc > chunk->size) ++ { ++ err = GRUB_ERR_BAD_FS; ++ break; ++ } ++ + if (is_raid56) + { + err = btrfs_read_from_chunk (data, chunk, stripen, diff --git a/0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch b/0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch new file mode 100644 index 00000000..2e5145fe --- /dev/null +++ b/0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Darren Kenny +Date: Thu, 7 Apr 2022 15:18:12 +0000 +Subject: [PATCH] fs/btrfs: Fix more fuzz issues related to chunks + +The corpus we generating issues in grub_btrfs_read_logical() when +attempting to iterate over nstripes entries in the boot mapping. + +In most cases the reason for the failure was that the number of strips +exceeded the possible space statically allocated in superblock bootmapping +space. Each stripe entry in the bootmapping block consists of +a grub_btrfs_key followed by a grub_btrfs_chunk_stripe. + +Another issue that came up was that while calculating the chunk size, +in an earlier piece of code in that function, depending on the data +provided in the btrfs file system, it would end up calculating a size +that was too small to contain even 1 grub_btrfs_chunk_item, which is +obviously invalid too. + +Signed-off-by: Darren Kenny +Reviewed-by: Daniel Kiper +(cherry picked from commit e00cd76cbadcc897a9cc4087cb2fcb5dbe15e596) +--- + grub-core/fs/btrfs.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 0e9b450413..47325f6ad7 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -947,6 +947,17 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + return grub_error (GRUB_ERR_BAD_FS, + "got an invalid zero-size chunk"); + } ++ ++ /* ++ * The space being allocated for a chunk should at least be able to ++ * contain one chunk item. ++ */ ++ if (chsize < sizeof (struct grub_btrfs_chunk_item)) ++ { ++ grub_dprintf ("btrfs", "chunk-size too small\n"); ++ return grub_error (GRUB_ERR_BAD_FS, ++ "got an invalid chunk size"); ++ } + chunk = grub_malloc (chsize); + if (!chunk) + return grub_errno; +@@ -1194,6 +1205,13 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + if (csize > (grub_uint64_t) size) + csize = size; + ++ /* ++ * The space for a chunk stripe is limited to the space provide in the super-block's ++ * bootstrap mapping with an initial btrfs key at the start of each chunk. ++ */ ++ grub_size_t avail_stripes = sizeof (data->sblock.bootstrap_mapping) / ++ (sizeof (struct grub_btrfs_key) + sizeof (struct grub_btrfs_chunk_stripe)); ++ + for (j = 0; j < 2; j++) + { + grub_size_t est_chunk_alloc = 0; +@@ -1220,6 +1238,12 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, + break; + } + ++ if (grub_le_to_cpu16 (chunk->nstripes) > avail_stripes) ++ { ++ err = GRUB_ERR_BAD_FS; ++ break; ++ } ++ + if (is_raid56) + { + err = btrfs_read_from_chunk (data, chunk, stripen, diff --git a/0254-misc-Make-grub_min-and-grub_max-more-resilient.patch b/0254-misc-Make-grub_min-and-grub_max-more-resilient.patch new file mode 100644 index 00000000..eb2e8fda --- /dev/null +++ b/0254-misc-Make-grub_min-and-grub_max-more-resilient.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 21 Mar 2022 16:06:10 -0400 +Subject: [PATCH] misc: Make grub_min() and grub_max() more resilient. + +grub_min(a,b) and grub_max(a,b) use a relatively naive implementation +which leads to several problems: +- they evaluate their parameters more than once +- the naive way to address this, to declare temporary variables in a + statement-expression, isn't resilient against nested uses, because + MIN(a,MIN(b,c)) results in the temporary variables being declared in + two nested scopes, which may result in a build warning depending on + your build options. + +This patch changes our implementation to use a statement-expression +inside a helper macro, and creates the symbols for the temporary +variables with __COUNTER__ (A GNU C cpp extension) and token pasting to +create uniquely named internal variables. + +Signed-off-by: Peter Jones +--- + grub-core/loader/multiboot_elfxx.c | 4 +--- + include/grub/misc.h | 25 +++++++++++++++++++++++-- + 2 files changed, 24 insertions(+), 5 deletions(-) + +diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c +index f2318e0d16..87f6e31aa6 100644 +--- a/grub-core/loader/multiboot_elfxx.c ++++ b/grub-core/loader/multiboot_elfxx.c +@@ -35,9 +35,7 @@ + #endif + + #include +- +-#define CONCAT(a,b) CONCAT_(a, b) +-#define CONCAT_(a,b) a ## b ++#include + + #pragma GCC diagnostic ignored "-Wcast-align" + +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 6c4aa85ac5..cf84aec1db 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -35,6 +35,14 @@ + #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0])) + #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } + ++#ifndef CONCAT_ ++#define CONCAT_(a, b) a ## b ++#endif ++ ++#ifndef CONCAT ++#define CONCAT(a, b) CONCAT_(a, b) ++#endif ++ + #define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, __VA_ARGS__) + + void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n); +@@ -498,8 +506,21 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file, + #define grub_boot_time(...) + #endif + +-#define grub_max(a, b) (((a) > (b)) ? (a) : (b)) +-#define grub_min(a, b) (((a) < (b)) ? (a) : (b)) ++#define _grub_min(a, b, _a, _b) \ ++ ({ typeof (a) _a = (a); \ ++ typeof (b) _b = (b); \ ++ _a < _b ? _a : _b; }) ++#define grub_min(a, b) _grub_min(a, b, \ ++ CONCAT(_a_,__COUNTER__), \ ++ CONCAT(_b_,__COUNTER__)) ++ ++#define _grub_max(a, b, _a, _b) \ ++ ({ typeof (a) _a = (a); \ ++ typeof (b) _b = (b); \ ++ _a > _b ? _a : _b; }) ++#define grub_max(a, b) _grub_max(a, b, \ ++ CONCAT(_a_,__COUNTER__), \ ++ CONCAT(_b_,__COUNTER__)) + + #define grub_log2ull(n) (GRUB_TYPE_BITS (grub_uint64_t) - __builtin_clzll (n) - 1) + diff --git a/0255-ReiserFS-switch-to-using-grub_min-grub_max.patch b/0255-ReiserFS-switch-to-using-grub_min-grub_max.patch new file mode 100644 index 00000000..0707af3e --- /dev/null +++ b/0255-ReiserFS-switch-to-using-grub_min-grub_max.patch @@ -0,0 +1,92 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 21 Apr 2022 16:31:17 -0400 +Subject: [PATCH] ReiserFS: switch to using grub_min()/grub_max() + +This is a minor cleanup patch to remove the bespoke MIN() and MAX() +definitions from the reiserfs driver, and uses grub_min() / grub_max() +instead. + +Signed-off-by: Peter Jones +--- + grub-core/fs/reiserfs.c | 28 +++++++++------------------- + 1 file changed, 9 insertions(+), 19 deletions(-) + +diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c +index af6a226a7f..b8253da7fe 100644 +--- a/grub-core/fs/reiserfs.c ++++ b/grub-core/fs/reiserfs.c +@@ -42,16 +42,6 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + +-#define MIN(a, b) \ +- ({ typeof (a) _a = (a); \ +- typeof (b) _b = (b); \ +- _a < _b ? _a : _b; }) +- +-#define MAX(a, b) \ +- ({ typeof (a) _a = (a); \ +- typeof (b) _b = (b); \ +- _a > _b ? _a : _b; }) +- + #define REISERFS_SUPER_BLOCK_OFFSET 0x10000 + #define REISERFS_MAGIC_LEN 12 + #define REISERFS_MAGIC_STRING "ReIsEr" +@@ -1076,7 +1066,7 @@ grub_reiserfs_read_real (struct grub_fshelp_node *node, + grub_reiserfs_set_key_type (&key, GRUB_REISERFS_ANY, 2); + initial_position = off; + current_position = 0; +- final_position = MIN (len + initial_position, node->size); ++ final_position = grub_min (len + initial_position, node->size); + grub_dprintf ("reiserfs", + "Reading from %lld to %lld (%lld instead of requested %ld)\n", + (unsigned long long) initial_position, +@@ -1115,8 +1105,8 @@ grub_reiserfs_read_real (struct grub_fshelp_node *node, + grub_dprintf ("reiserfs_blocktype", "D: %u\n", (unsigned) block); + if (initial_position < current_position + item_size) + { +- offset = MAX ((signed) (initial_position - current_position), 0); +- length = (MIN (item_size, final_position - current_position) ++ offset = grub_max ((signed) (initial_position - current_position), 0); ++ length = (grub_min (item_size, final_position - current_position) + - offset); + grub_dprintf ("reiserfs", + "Reading direct block %u from %u to %u...\n", +@@ -1161,9 +1151,9 @@ grub_reiserfs_read_real (struct grub_fshelp_node *node, + grub_dprintf ("reiserfs_blocktype", "I: %u\n", (unsigned) block); + if (current_position + block_size >= initial_position) + { +- offset = MAX ((signed) (initial_position - current_position), +- 0); +- length = (MIN (block_size, final_position - current_position) ++ offset = grub_max ((signed) (initial_position - current_position), ++ 0); ++ length = (grub_min (block_size, final_position - current_position) + - offset); + grub_dprintf ("reiserfs", + "Reading indirect block %u from %u to %u...\n", +@@ -1205,7 +1195,7 @@ grub_reiserfs_read_real (struct grub_fshelp_node *node, + switch (found.type) + { + case GRUB_REISERFS_DIRECT: +- read_length = MIN (len, item_size - file->offset); ++ read_length = grub_min (len, item_size - file->offset); + grub_disk_read (found.data->disk, + (found.block_number * block_size) / GRUB_DISK_SECTOR_SIZE, + grub_le_to_cpu16 (found.header.item_location) + file->offset, +@@ -1224,12 +1214,12 @@ grub_reiserfs_read_real (struct grub_fshelp_node *node, + item_size, (char *) indirect_block_ptr); + if (grub_errno) + goto fail; +- len = MIN (len, file->size - file->offset); ++ len = grub_min (len, file->size - file->offset); + for (indirect_block = file->offset / block_size; + indirect_block < indirect_block_count && read_length < len; + indirect_block++) + { +- read = MIN (block_size, len - read_length); ++ read = grub_min (block_size, len - read_length); + grub_disk_read (found.data->disk, + (grub_le_to_cpu32 (indirect_block_ptr[indirect_block]) * block_size) / GRUB_DISK_SECTOR_SIZE, + file->offset % block_size, read, diff --git a/0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch b/0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch new file mode 100644 index 00000000..a7ac6f2a --- /dev/null +++ b/0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 24 Mar 2022 14:40:01 -0400 +Subject: [PATCH] misc: make grub_boot_time() also call + grub_dprintf("boot",...) + +Currently grub_boot_time() includes valuable debugging messages, but if +you build without BOOT_TIME_STATS enabled, they are silently and +confusingly compiled away. + +This patch changes grub_boot_time() to also log when "boot" is enabled +in DEBUG, regardless of BOOT_TIME_STATS. + +Signed-off-by: Peter Jones +--- + grub-core/kern/misc.c | 3 ++- + include/grub/misc.h | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index a186ad3dd4..cb45461402 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -1334,7 +1334,8 @@ grub_real_boot_time (const char *file, + n->next = 0; + + va_start (args, fmt); +- n->msg = grub_xvasprintf (fmt, args); ++ n->msg = grub_xvasprintf (fmt, args); ++ grub_dprintf ("boot", "%s\n", n->msg); + va_end (args); + + *boot_time_last = n; +diff --git a/include/grub/misc.h b/include/grub/misc.h +index cf84aec1db..faae0ae860 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -503,7 +503,7 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file, + const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 3, 4))); + #define grub_boot_time(...) grub_real_boot_time(GRUB_FILE, __LINE__, __VA_ARGS__) + #else +-#define grub_boot_time(...) ++#define grub_boot_time(fmt, ...) grub_dprintf("boot", fmt "\n", ##__VA_ARGS__) + #endif + + #define _grub_min(a, b, _a, _b) \ diff --git a/0257-modules-make-.module_license-read-only.patch b/0257-modules-make-.module_license-read-only.patch new file mode 100644 index 00000000..ba3b3137 --- /dev/null +++ b/0257-modules-make-.module_license-read-only.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 24 Feb 2022 16:32:51 -0500 +Subject: [PATCH] modules: make .module_license read-only + +Currently .module_license is set writable (that is, the section has the +SHF_WRITE flag set) in the module's ELF headers. This probably never +actually matters, but it can't possibly be correct. + +This patch sets that data as "const", which causes that flag not to be +set. + +Signed-off-by: Peter Jones +--- + include/grub/dl.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/grub/dl.h b/include/grub/dl.h +index 20d870f2a4..618ae6f474 100644 +--- a/include/grub/dl.h ++++ b/include/grub/dl.h +@@ -121,7 +121,7 @@ grub_mod_fini (void) + #define ATTRIBUTE_USED __unused__ + #endif + #define GRUB_MOD_LICENSE(license) \ +- static char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), ATTRIBUTE_USED)) = "LICENSE=" license; ++ static const char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), ATTRIBUTE_USED)) = "LICENSE=" license; + #define GRUB_MOD_DEP(name) \ + static const char grub_module_depend_##name[] \ + __attribute__((section(GRUB_MOD_SECTION(moddeps)), ATTRIBUTE_USED)) = #name diff --git a/0258-modules-strip-.llvm_addrsig-sections-and-similar.patch b/0258-modules-strip-.llvm_addrsig-sections-and-similar.patch new file mode 100644 index 00000000..9f26115d --- /dev/null +++ b/0258-modules-strip-.llvm_addrsig-sections-and-similar.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 24 Feb 2022 16:40:11 -0500 +Subject: [PATCH] modules: strip .llvm_addrsig sections and similar. + +Currently grub modules built with clang or gcc have several sections +which we don't actually need or support. + +We already have a list of section to skip in genmod.sh, and this patch +adds the following sections to that list (as well as a few newlines): + +.note.gnu.property +.llvm* + +Note that the glob there won't work without a new enough linker, but the +failure is just reversion to the status quo, so that's not a big problem. + +Signed-off-by: Peter Jones +--- + grub-core/genmod.sh.in | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in +index 1250589b3f..c2c5280d75 100644 +--- a/grub-core/genmod.sh.in ++++ b/grub-core/genmod.sh.in +@@ -57,8 +57,11 @@ if test x@TARGET_APPLE_LINKER@ != x1; then + @TARGET_STRIP@ --strip-unneeded \ + -K grub_mod_init -K grub_mod_fini \ + -K _grub_mod_init -K _grub_mod_fini \ +- -R .note.gnu.gold-version -R .note.GNU-stack \ ++ -R .note.GNU-stack \ ++ -R .note.gnu.gold-version \ ++ -R .note.gnu.property \ + -R .gnu.build.attributes \ ++ -R '.llvm*' \ + -R .rel.gnu.build.attributes \ + -R .rela.gnu.build.attributes \ + -R .eh_frame -R .rela.eh_frame -R .rel.eh_frame \ diff --git a/0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch b/0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch new file mode 100644 index 00000000..d07d8386 --- /dev/null +++ b/0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 21 Mar 2022 16:56:10 -0400 +Subject: [PATCH] modules: Don't allocate space for non-allocable sections. + +Currently when loading grub modules, we allocate space for all sections, +including those without SHF_ALLOC set. We then copy the sections that +/do/ have SHF_ALLOC set into the allocated memory, leaving some of our +allocation untouched forever. Additionally, on platforms with GOT +fixups and trampolines, we currently compute alignment round-ups for the +sections and sections with sh_size = 0. + +This patch removes the extra space from the allocation computation, and +makes the allocation computation loop skip empty sections as the loading +loop does. + +Signed-off-by: Peter Jones +--- + grub-core/kern/dl.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index f304494574..aef8af8aa7 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -289,6 +289,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + i < e->e_shnum; + i++, s = (const Elf_Shdr *)((const char *) s + e->e_shentsize)) + { ++ if (s->sh_size == 0 || !(s->sh_flags & SHF_ALLOC)) ++ continue; ++ + tsize = ALIGN_UP (tsize, s->sh_addralign) + s->sh_size; + if (talign < s->sh_addralign) + talign = s->sh_addralign; diff --git a/0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch b/0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch new file mode 100644 index 00000000..ef51214f --- /dev/null +++ b/0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 25 Mar 2022 15:40:12 -0400 +Subject: [PATCH] pe: add the DOS header struct and fix some bad naming. + +In order to properly validate a loaded kernel's support for being loaded +without a writable stack or executable, we need to be able to properly +parse arbitrary PE headers. + +Currently, pe32.h is written in such a way that the MS-DOS header that +tells us where to find the PE header in the binary can't be accessed. +Further, for some reason it calls the DOS MZ magic "GRUB_PE32_MAGIC". + +This patch adds the structure for the DOS header, renames the DOS magic +define, and adds defines for the actual PE magic. + +Signed-off-by: Peter Jones +--- + grub-core/loader/arm64/linux.c | 2 +- + include/grub/efi/pe32.h | 28 ++++++++++++++++++++++++++-- + 2 files changed, 27 insertions(+), 3 deletions(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index d2af47c2c0..cc67f43906 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -58,7 +58,7 @@ 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) ++ if ((lh->code0 & 0xffff) != GRUB_DOS_MAGIC) + return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); + +diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h +index a43adf2746..2a5e1ee003 100644 +--- a/include/grub/efi/pe32.h ++++ b/include/grub/efi/pe32.h +@@ -46,7 +46,30 @@ + + #define GRUB_PE32_MSDOS_STUB_SIZE 0x80 + +-#define GRUB_PE32_MAGIC 0x5a4d ++#define GRUB_DOS_MAGIC 0x5a4d ++ ++struct grub_dos_header ++{ ++ grub_uint16_t magic; ++ grub_uint16_t cblp; ++ grub_uint16_t cp; ++ grub_uint16_t crlc; ++ grub_uint16_t cparhdr; ++ grub_uint16_t minalloc; ++ grub_uint16_t maxalloc; ++ grub_uint16_t ss; ++ grub_uint16_t sp; ++ grub_uint16_t csum; ++ grub_uint16_t ip; ++ grub_uint16_t cs; ++ grub_uint16_t lfarlc; ++ grub_uint16_t ovno; ++ grub_uint16_t res0[4]; ++ grub_uint16_t oemid; ++ grub_uint16_t oeminfo; ++ grub_uint16_t res1[10]; ++ grub_uint32_t lfanew; ++}; + + /* According to the spec, the minimal alignment is 512 bytes... + But some examples (such as EFI drivers in the Intel +@@ -280,7 +303,8 @@ struct grub_pe32_section_table + + + +-#define GRUB_PE32_SIGNATURE_SIZE 4 ++#define GRUB_PE32_SIGNATURE_SIZE 4 ++#define GRUB_PE32_SIGNATURE "PE\0\0" + + struct grub_pe32_header + { diff --git a/0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch b/0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch new file mode 100644 index 00000000..c6688cd1 --- /dev/null +++ b/0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch @@ -0,0 +1,85 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 9 Feb 2022 16:08:20 -0500 +Subject: [PATCH] EFI: allocate kernel in EFI_RUNTIME_SERVICES_CODE instead of + EFI_LOADER_DATA. + +On some of the firmwares with more security mitigations, EFI_LOADER_DATA +doesn't get you executable memory, and we take a fault and reboot when +we enter kernel. + +This patch correctly allocates the kernel code as EFI_RUNTIME_SERVICES_CODE +rather than EFI_LOADER_DATA. + +Signed-off-by: Peter Jones +[rharwood: use kernel_size] +Signed-off-by: Robbie Harwood +--- + grub-core/loader/i386/efi/linux.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 9e5c11ac69..92b2fb5091 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -86,7 +86,9 @@ kernel_free(void *addr, grub_efi_uintn_t size) + } + + static void * +-kernel_alloc(grub_efi_uintn_t size, const char * const errmsg) ++kernel_alloc(grub_efi_uintn_t size, ++ grub_efi_memory_type_t memtype, ++ const char * const errmsg) + { + void *addr = 0; + unsigned int i; +@@ -112,7 +114,7 @@ kernel_alloc(grub_efi_uintn_t size, const char * const errmsg) + prev_max = max; + addr = grub_efi_allocate_pages_real (max, pages, + max_addresses[i].alloc_type, +- GRUB_EFI_LOADER_DATA); ++ memtype); + if (addr) + grub_dprintf ("linux", "Allocated at %p\n", addr); + } +@@ -242,7 +244,8 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) + } + } + +- initrd_mem = kernel_alloc(size, N_("can't allocate initrd")); ++ initrd_mem = kernel_alloc(size, GRUB_EFI_RUNTIME_SERVICES_DATA, ++ N_("can't allocate initrd")); + if (initrd_mem == NULL) + goto fail; + grub_dprintf ("linux", "initrd_mem = %p\n", initrd_mem); +@@ -393,7 +396,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } + #endif + +- params = kernel_alloc (sizeof(*params), "cannot allocate kernel parameters"); ++ params = kernel_alloc (sizeof(*params), GRUB_EFI_RUNTIME_SERVICES_DATA, ++ "cannot allocate kernel parameters"); + if (!params) + goto fail; + grub_dprintf ("linux", "params = %p\n", params); +@@ -415,7 +419,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_dprintf ("linux", "new lh is at %p\n", lh); + + grub_dprintf ("linux", "setting up cmdline\n"); +- cmdline = kernel_alloc (lh->cmdline_size + 1, N_("can't allocate cmdline")); ++ cmdline = kernel_alloc (lh->cmdline_size + 1, ++ GRUB_EFI_RUNTIME_SERVICES_DATA, ++ N_("can't allocate cmdline")); + if (!cmdline) + goto fail; + grub_dprintf ("linux", "cmdline = %p\n", cmdline); +@@ -461,7 +467,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + max_addresses[1].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; + max_addresses[2].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; + kernel_size = lh->init_size; +- kernel_mem = kernel_alloc (kernel_size, N_("can't allocate kernel")); ++ kernel_mem = kernel_alloc (kernel_size, GRUB_EFI_RUNTIME_SERVICES_CODE, ++ N_("can't allocate kernel")); + restore_addresses(); + if (!kernel_mem) + goto fail; diff --git a/0262-modules-load-module-sections-at-page-aligned-address.patch b/0262-modules-load-module-sections-at-page-aligned-address.patch new file mode 100644 index 00000000..9a5048ce --- /dev/null +++ b/0262-modules-load-module-sections-at-page-aligned-address.patch @@ -0,0 +1,378 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 21 Mar 2022 17:45:40 -0400 +Subject: [PATCH] modules: load module sections at page-aligned addresses + +Currently we load module sections at whatever alignment gcc+ld happened +to dump into the ELF section header, which is often pretty useless. For +example, by default time.mod has these sections on a current x86_64 +build: + +$ eu-readelf -a grub-core/time.mod |& grep ^Section -A13 +Section Headers: +[Nr] Name Type Addr Off Size ES Flags Lk Inf Al +[ 0] NULL 0 00000000 00000000 0 0 0 0 +[ 1] .text PROGBITS 0 00000040 0000015e 0 AX 0 0 1 +[ 2] .rela.text RELA 0 00000458 000001e0 24 I 8 1 8 +[ 3] .rodata.str1.1 PROGBITS 0 0000019e 000000a1 1 AMS 0 0 1 +[ 4] .module_license PROGBITS 0 00000240 0000000f 0 A 0 0 8 +[ 5] .data PROGBITS 0 0000024f 00000000 0 WA 0 0 1 +[ 6] .bss NOBITS 0 00000250 00000008 0 WA 0 0 8 +[ 7] .modname PROGBITS 0 00000250 00000005 0 0 0 1 +[ 8] .symtab SYMTAB 0 00000258 00000150 24 9 6 8 +[ 9] .strtab STRTAB 0 000003a8 000000ab 0 0 0 1 +[10] .shstrtab STRTAB 0 00000638 00000059 0 0 0 1 + +With NX protections being page based, loading sections with either a 1 +or 8 *byte* alignment does absolutely nothing to help us out. + +This patch switches most EFI platforms to load module sections at 4kB +page-aligned addresses. To do so, it adds an new per-arch function, +grub_arch_dl_min_alignment(), which returns the alignment needed for +dynamically loaded sections (in bytes). Currently it sets it to 4096 +when GRUB_MACHINE_EFI is true on x86_64, i386, arm, arm64, and emu, and +1-byte alignment on everything else. + +It then changes the allocation size computation and the loader code in +grub_dl_load_segments() to align the locations and sizes up to these +boundaries, and fills any added padding with zeros. + +All of this happens before relocations are applied, so the relocations +factor that in with no change. + +As an aside, initially Daniel Kiper and I thought that it might be a +better idea to split the modules up into top-level sections as +.text.modules, .rodata.modules, .data.modules, etc., so that their page +permissions would get set by the loader that's loading grub itself. +This turns out to have two significant downsides: 1) either in mkimage +or in grub_dl_relocate_symbols(), you wind up having to dynamically +process the relocations to accommodate the moved module sections, and 2) +you then need to change the permissions on the modules and change them +back while relocating them in grub_dl_relocate_symbols(), which means +that any loader that /does/ honor the section flags but does /not/ +generally support NX with the memory attributes API will cause grub to +fail. + +Signed-off-by: Peter Jones +--- + grub-core/kern/arm/dl.c | 13 +++++++++++++ + grub-core/kern/arm64/dl.c | 13 +++++++++++++ + grub-core/kern/dl.c | 29 +++++++++++++++++++++-------- + grub-core/kern/emu/full.c | 13 +++++++++++++ + grub-core/kern/i386/dl.c | 13 +++++++++++++ + grub-core/kern/ia64/dl.c | 9 +++++++++ + grub-core/kern/mips/dl.c | 8 ++++++++ + grub-core/kern/powerpc/dl.c | 9 +++++++++ + grub-core/kern/riscv/dl.c | 13 +++++++++++++ + grub-core/kern/sparc64/dl.c | 9 +++++++++ + grub-core/kern/x86_64/dl.c | 13 +++++++++++++ + include/grub/dl.h | 2 ++ + docs/grub-dev.texi | 6 +++--- + 13 files changed, 139 insertions(+), 11 deletions(-) + +diff --git a/grub-core/kern/arm/dl.c b/grub-core/kern/arm/dl.c +index eab9d17ff2..9260737936 100644 +--- a/grub-core/kern/arm/dl.c ++++ b/grub-core/kern/arm/dl.c +@@ -278,3 +278,16 @@ grub_arch_dl_check_header (void *ehdr) + + return GRUB_ERR_NONE; + } ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++#ifdef GRUB_MACHINE_EFI ++ return 4096; ++#else ++ return 1; ++#endif ++} +diff --git a/grub-core/kern/arm64/dl.c b/grub-core/kern/arm64/dl.c +index 512e5a80b0..0d4a26857f 100644 +--- a/grub-core/kern/arm64/dl.c ++++ b/grub-core/kern/arm64/dl.c +@@ -196,3 +196,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + + return GRUB_ERR_NONE; + } ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++#ifdef GRUB_MACHINE_EFI ++ return 4096; ++#else ++ return 1; ++#endif ++} +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index aef8af8aa7..8c7aacef39 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -277,7 +277,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + { + unsigned i; + const Elf_Shdr *s; +- grub_size_t tsize = 0, talign = 1; ++ grub_size_t tsize = 0, talign = 1, arch_addralign = 1; + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) + grub_size_t tramp; + grub_size_t got; +@@ -285,16 +285,24 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + #endif + char *ptr; + ++ arch_addralign = grub_arch_dl_min_alignment (); ++ + for (i = 0, s = (const Elf_Shdr *)((const char *) e + e->e_shoff); + i < e->e_shnum; + i++, s = (const Elf_Shdr *)((const char *) s + e->e_shentsize)) + { ++ grub_size_t sh_addralign; ++ grub_size_t sh_size; ++ + if (s->sh_size == 0 || !(s->sh_flags & SHF_ALLOC)) + continue; + +- tsize = ALIGN_UP (tsize, s->sh_addralign) + s->sh_size; +- if (talign < s->sh_addralign) +- talign = s->sh_addralign; ++ sh_addralign = ALIGN_UP(s->sh_addralign, arch_addralign); ++ sh_size = ALIGN_UP(s->sh_size, sh_addralign); ++ ++ tsize = ALIGN_UP (tsize, sh_addralign) + sh_size; ++ if (talign < sh_addralign) ++ talign = sh_addralign; + } + + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) +@@ -323,6 +331,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + i < e->e_shnum; + i++, s = (Elf_Shdr *)((char *) s + e->e_shentsize)) + { ++ grub_size_t sh_addralign = ALIGN_UP(s->sh_addralign, arch_addralign); ++ grub_size_t sh_size = ALIGN_UP(s->sh_size, sh_addralign); ++ + if (s->sh_flags & SHF_ALLOC) + { + grub_dl_segment_t seg; +@@ -335,17 +346,19 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + { + void *addr; + +- ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, s->sh_addralign); ++ ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, sh_addralign); + addr = ptr; +- ptr += s->sh_size; ++ ptr += sh_size; + + switch (s->sh_type) + { + case SHT_PROGBITS: + grub_memcpy (addr, (char *) e + s->sh_offset, s->sh_size); ++ grub_memset ((char *)addr + s->sh_size, 0, ++ sh_size - s->sh_size); + break; + case SHT_NOBITS: +- grub_memset (addr, 0, s->sh_size); ++ grub_memset (addr, 0, sh_size); + break; + } + +@@ -354,7 +367,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + else + seg->addr = 0; + +- seg->size = s->sh_size; ++ seg->size = sh_size; + seg->section = i; + seg->next = mod->segment; + mod->segment = seg; +diff --git a/grub-core/kern/emu/full.c b/grub-core/kern/emu/full.c +index e8d63b1f5f..1de1c28eb0 100644 +--- a/grub-core/kern/emu/full.c ++++ b/grub-core/kern/emu/full.c +@@ -67,3 +67,16 @@ grub_arch_dl_init_linker (void) + } + #endif + ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++#ifdef GRUB_MACHINE_EFI ++ return 4096; ++#else ++ return 1; ++#endif ++} +diff --git a/grub-core/kern/i386/dl.c b/grub-core/kern/i386/dl.c +index 1346da5cc9..d6b4681fc9 100644 +--- a/grub-core/kern/i386/dl.c ++++ b/grub-core/kern/i386/dl.c +@@ -79,3 +79,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + + return GRUB_ERR_NONE; + } ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++#ifdef GRUB_MACHINE_EFI ++ return 4096; ++#else ++ return 1; ++#endif ++} +diff --git a/grub-core/kern/ia64/dl.c b/grub-core/kern/ia64/dl.c +index db59300fea..92d82c5750 100644 +--- a/grub-core/kern/ia64/dl.c ++++ b/grub-core/kern/ia64/dl.c +@@ -148,3 +148,12 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + } + return GRUB_ERR_NONE; + } ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++ return 1; ++} +diff --git a/grub-core/kern/mips/dl.c b/grub-core/kern/mips/dl.c +index 5d7d299c74..6d83bd71e9 100644 +--- a/grub-core/kern/mips/dl.c ++++ b/grub-core/kern/mips/dl.c +@@ -272,3 +272,11 @@ grub_arch_dl_init_linker (void) + grub_dl_register_symbol ("_gp_disp", &_gp_disp_dummy, 0, 0); + } + ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++ return 1; ++} +diff --git a/grub-core/kern/powerpc/dl.c b/grub-core/kern/powerpc/dl.c +index cdd61b305f..5d9ba2e158 100644 +--- a/grub-core/kern/powerpc/dl.c ++++ b/grub-core/kern/powerpc/dl.c +@@ -167,3 +167,12 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + + return GRUB_ERR_NONE; + } ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++ return 1; ++} +diff --git a/grub-core/kern/riscv/dl.c b/grub-core/kern/riscv/dl.c +index f26b12aaa4..aa18f9e990 100644 +--- a/grub-core/kern/riscv/dl.c ++++ b/grub-core/kern/riscv/dl.c +@@ -343,3 +343,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + + return GRUB_ERR_NONE; + } ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++#ifdef GRUB_MACHINE_EFI ++ return 4096; ++#else ++ return 1; ++#endif ++} +diff --git a/grub-core/kern/sparc64/dl.c b/grub-core/kern/sparc64/dl.c +index f3d960186b..f054f08241 100644 +--- a/grub-core/kern/sparc64/dl.c ++++ b/grub-core/kern/sparc64/dl.c +@@ -189,3 +189,12 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + + return GRUB_ERR_NONE; + } ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++ return 1; ++} +diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c +index e5a8bdcf4f..a105dc50ce 100644 +--- a/grub-core/kern/x86_64/dl.c ++++ b/grub-core/kern/x86_64/dl.c +@@ -119,3 +119,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + + return GRUB_ERR_NONE; + } ++ ++/* ++ * Tell the loader what our minimum section alignment is. ++ */ ++grub_size_t ++grub_arch_dl_min_alignment (void) ++{ ++#ifdef GRUB_MACHINE_EFI ++ return 4096; ++#else ++ return 1; ++#endif ++} +diff --git a/include/grub/dl.h b/include/grub/dl.h +index 618ae6f474..f36ed5cb17 100644 +--- a/include/grub/dl.h ++++ b/include/grub/dl.h +@@ -280,6 +280,8 @@ grub_err_t grub_arch_dl_check_header (void *ehdr); + grub_err_t + grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, + Elf_Shdr *s, grub_dl_segment_t seg); ++grub_size_t ++grub_arch_dl_min_alignment (void); + #endif + + #if defined (_mips) +diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi +index 90083772c8..c23ba313dc 100644 +--- a/docs/grub-dev.texi ++++ b/docs/grub-dev.texi +@@ -755,9 +755,9 @@ declare startup asm file ($cpu_$platform_startup) as well as any other files + (e.g. init.c and callwrap.S) (e.g. $cpu_$platform = kern/$cpu/$platform/init.c). + At this stage you will also need to add dummy dl.c and cache.S with functions + grub_err_t grub_arch_dl_check_header (void *ehdr), grub_err_t +-grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) (dl.c) and +-void grub_arch_sync_caches (void *address, grub_size_t len) (cache.S). They +-won't be used for now. ++grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) (dl.c), grub_uint32_t ++grub_arch_dl_min_alignment (void), and void grub_arch_sync_caches (void ++*address, grub_size_t len) (cache.S). They won't be used for now. + + You will need to create directory include/$cpu/$platform and a file + include/$cpu/types.h. The later folowing this template: diff --git a/0263-nx-add-memory-attribute-get-set-API.patch b/0263-nx-add-memory-attribute-get-set-API.patch new file mode 100644 index 00000000..91c9d2f5 --- /dev/null +++ b/0263-nx-add-memory-attribute-get-set-API.patch @@ -0,0 +1,317 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 22 Mar 2022 10:56:21 -0400 +Subject: [PATCH] nx: add memory attribute get/set API + +For NX, we need to set the page access permission attributes for write +and execute permissions. + +This patch adds two new primitives, grub_set_mem_attrs() and +grub_clear_mem_attrs(), and associated constant definitions, to be used +for that purpose. + +For most platforms, it adds a dummy implementation that returns +GRUB_ERR_NONE. On EFI platforms, it adds a common helper function, +grub_efi_status_to_err(), which translates EFI error codes to grub error +codes, adds headers for the EFI Memory Attribute Protocol (still pending +standardization), and an implementation of the grub nx primitives using +it. + +Signed-off-by: Peter Jones +[rharwood: add pjones's none/nyi fixup] +Signed-off-by: Robbie Harwood +--- + grub-core/kern/efi/efi.c | 36 +++++++++++++ + grub-core/kern/efi/mm.c | 131 +++++++++++++++++++++++++++++++++++++++++++++++ + include/grub/efi/api.h | 25 +++++++++ + include/grub/efi/efi.h | 2 + + include/grub/mm.h | 32 ++++++++++++ + 5 files changed, 226 insertions(+) + +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index 7fcca69c17..4ac2b2754e 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -1096,3 +1096,39 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1, + + return 0; + } ++ ++grub_err_t ++grub_efi_status_to_err (grub_efi_status_t status) ++{ ++ grub_err_t err; ++ switch (status) ++ { ++ case GRUB_EFI_SUCCESS: ++ err = GRUB_ERR_NONE; ++ break; ++ case GRUB_EFI_INVALID_PARAMETER: ++ default: ++ err = GRUB_ERR_BAD_ARGUMENT; ++ break; ++ case GRUB_EFI_OUT_OF_RESOURCES: ++ err = GRUB_ERR_OUT_OF_MEMORY; ++ break; ++ case GRUB_EFI_DEVICE_ERROR: ++ err = GRUB_ERR_IO; ++ break; ++ case GRUB_EFI_WRITE_PROTECTED: ++ err = GRUB_ERR_WRITE_ERROR; ++ break; ++ case GRUB_EFI_SECURITY_VIOLATION: ++ err = GRUB_ERR_ACCESS_DENIED; ++ break; ++ case GRUB_EFI_NOT_FOUND: ++ err = GRUB_ERR_FILE_NOT_FOUND; ++ break; ++ case GRUB_EFI_ABORTED: ++ err = GRUB_ERR_WAIT; ++ break; ++ } ++ ++ return err; ++} +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index e84961d078..2c33758ed7 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -738,3 +738,134 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) + return GRUB_ERR_NONE; + } + #endif ++ ++static inline grub_uint64_t ++grub_mem_attrs_to_uefi_mem_attrs (grub_uint64_t attrs) ++{ ++ grub_uint64_t ret = GRUB_EFI_MEMORY_RP | ++ GRUB_EFI_MEMORY_RO | ++ GRUB_EFI_MEMORY_XP; ++ ++ if (attrs & GRUB_MEM_ATTR_R) ++ ret &= ~GRUB_EFI_MEMORY_RP; ++ ++ if (attrs & GRUB_MEM_ATTR_W) ++ ret &= ~GRUB_EFI_MEMORY_RO; ++ ++ if (attrs & GRUB_MEM_ATTR_X) ++ ret &= ~GRUB_EFI_MEMORY_XP; ++ ++ return ret; ++} ++ ++static inline grub_uint64_t ++uefi_mem_attrs_to_grub_mem_attrs (grub_uint64_t attrs) ++{ ++ grub_uint64_t ret = GRUB_MEM_ATTR_R | ++ GRUB_MEM_ATTR_W | ++ GRUB_MEM_ATTR_X; ++ ++ if (attrs & GRUB_EFI_MEMORY_RP) ++ ret &= ~GRUB_MEM_ATTR_R; ++ ++ if (attrs & GRUB_EFI_MEMORY_RO) ++ ret &= ~GRUB_MEM_ATTR_W; ++ ++ if (attrs & GRUB_EFI_MEMORY_XP) ++ ret &= ~GRUB_MEM_ATTR_X; ++ ++ return ret; ++} ++ ++grub_err_t ++grub_get_mem_attrs (grub_addr_t addr, grub_size_t size, grub_uint64_t *attrs) ++{ ++ grub_efi_memory_attribute_protocol_t *proto; ++ grub_efi_physical_address_t physaddr = addr; ++ grub_efi_guid_t protocol_guid = GRUB_EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID; ++ grub_efi_status_t efi_status; ++ ++ proto = grub_efi_locate_protocol (&protocol_guid, 0); ++ if (!proto) ++ return GRUB_ERR_NOT_IMPLEMENTED_YET; ++ ++ if (physaddr & 0xfff || size & 0xfff || size == 0 || attrs == NULL) ++ { ++ grub_dprintf ("nx", "%s called on 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" and attrs %p\n", ++ __func__, physaddr, physaddr+size-1, attrs); ++ return 0; ++ } ++ ++ efi_status = efi_call_4(proto->get_memory_attributes, ++ proto, physaddr, size, attrs); ++ *attrs = uefi_mem_attrs_to_grub_mem_attrs (*attrs); ++ ++ return grub_efi_status_to_err (efi_status); ++} ++ ++grub_err_t ++grub_update_mem_attrs (grub_addr_t addr, grub_size_t size, ++ grub_uint64_t set_attrs, grub_uint64_t clear_attrs) ++{ ++ grub_efi_memory_attribute_protocol_t *proto; ++ grub_efi_physical_address_t physaddr = addr; ++ grub_efi_guid_t protocol_guid = GRUB_EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID; ++ grub_efi_status_t efi_status = GRUB_EFI_SUCCESS; ++ grub_uint64_t before = 0, after = 0, uefi_set_attrs, uefi_clear_attrs; ++ grub_err_t err; ++ ++ proto = grub_efi_locate_protocol (&protocol_guid, 0); ++ if (!proto) ++ return GRUB_ERR_NONE; ++ ++ err = grub_get_mem_attrs (addr, size, &before); ++ if (err) ++ grub_dprintf ("nx", "grub_get_mem_attrs(0x%"PRIxGRUB_ADDR", %"PRIuGRUB_SIZE", %p) -> 0x%x\n", ++ addr, size, &before, err); ++ ++ if (physaddr & 0xfff || size & 0xfff || size == 0) ++ { ++ grub_dprintf ("nx", "%s called on 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" +%s%s%s -%s%s%s\n", ++ __func__, physaddr, physaddr + size - 1, ++ (set_attrs & GRUB_MEM_ATTR_R) ? "r" : "", ++ (set_attrs & GRUB_MEM_ATTR_W) ? "w" : "", ++ (set_attrs & GRUB_MEM_ATTR_X) ? "x" : "", ++ (clear_attrs & GRUB_MEM_ATTR_R) ? "r" : "", ++ (clear_attrs & GRUB_MEM_ATTR_W) ? "w" : "", ++ (clear_attrs & GRUB_MEM_ATTR_X) ? "x" : ""); ++ return 0; ++ } ++ ++ uefi_set_attrs = grub_mem_attrs_to_uefi_mem_attrs (set_attrs); ++ grub_dprintf ("nx", "translating set_attrs from 0x%lx to 0x%lx\n", set_attrs, uefi_set_attrs); ++ uefi_clear_attrs = grub_mem_attrs_to_uefi_mem_attrs (clear_attrs); ++ grub_dprintf ("nx", "translating clear_attrs from 0x%lx to 0x%lx\n", clear_attrs, uefi_clear_attrs); ++ if (uefi_set_attrs) ++ efi_status = efi_call_4(proto->set_memory_attributes, ++ proto, physaddr, size, uefi_set_attrs); ++ if (efi_status == GRUB_EFI_SUCCESS && uefi_clear_attrs) ++ efi_status = efi_call_4(proto->clear_memory_attributes, ++ proto, physaddr, size, uefi_clear_attrs); ++ ++ err = grub_get_mem_attrs (addr, size, &after); ++ if (err) ++ grub_dprintf ("nx", "grub_get_mem_attrs(0x%"PRIxGRUB_ADDR", %"PRIuGRUB_SIZE", %p) -> 0x%x\n", ++ addr, size, &after, err); ++ ++ grub_dprintf ("nx", "set +%s%s%s -%s%s%s on 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" before:%c%c%c after:%c%c%c\n", ++ (set_attrs & GRUB_MEM_ATTR_R) ? "r" : "", ++ (set_attrs & GRUB_MEM_ATTR_W) ? "w" : "", ++ (set_attrs & GRUB_MEM_ATTR_X) ? "x" : "", ++ (clear_attrs & GRUB_MEM_ATTR_R) ? "r" : "", ++ (clear_attrs & GRUB_MEM_ATTR_W) ? "w" : "", ++ (clear_attrs & GRUB_MEM_ATTR_X) ? "x" : "", ++ addr, addr + size - 1, ++ (before & GRUB_MEM_ATTR_R) ? 'r' : '-', ++ (before & GRUB_MEM_ATTR_W) ? 'w' : '-', ++ (before & GRUB_MEM_ATTR_X) ? 'x' : '-', ++ (after & GRUB_MEM_ATTR_R) ? 'r' : '-', ++ (after & GRUB_MEM_ATTR_W) ? 'w' : '-', ++ (after & GRUB_MEM_ATTR_X) ? 'x' : '-'); ++ ++ return grub_efi_status_to_err (efi_status); ++} +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index f431f49973..464842ba37 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -363,6 +363,11 @@ + { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \ + } + ++#define GRUB_EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID \ ++ { 0xf4560cf6, 0x40ec, 0x4b4a, \ ++ { 0xa1, 0x92, 0xbf, 0x1d, 0x57, 0xd0, 0xb1, 0x89 } \ ++ } ++ + struct grub_efi_sal_system_table + { + grub_uint32_t signature; +@@ -2102,6 +2107,26 @@ struct grub_efi_ip6_config_manual_address { + }; + typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t; + ++struct grub_efi_memory_attribute_protocol ++{ ++ grub_efi_status_t (*get_memory_attributes) ( ++ struct grub_efi_memory_attribute_protocol *this, ++ grub_efi_physical_address_t base_address, ++ grub_efi_uint64_t length, ++ grub_efi_uint64_t *attributes); ++ grub_efi_status_t (*set_memory_attributes) ( ++ struct grub_efi_memory_attribute_protocol *this, ++ grub_efi_physical_address_t base_address, ++ grub_efi_uint64_t length, ++ grub_efi_uint64_t attributes); ++ grub_efi_status_t (*clear_memory_attributes) ( ++ struct grub_efi_memory_attribute_protocol *this, ++ grub_efi_physical_address_t base_address, ++ grub_efi_uint64_t length, ++ grub_efi_uint64_t attributes); ++}; ++typedef struct grub_efi_memory_attribute_protocol grub_efi_memory_attribute_protocol_t; ++ + #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ + || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ + || defined(__riscv) +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index ec52083c49..34825c4adc 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -164,4 +164,6 @@ struct grub_net_card; + grub_efi_handle_t + grub_efinet_get_device_handle (struct grub_net_card *card); + ++grub_err_t EXPORT_FUNC(grub_efi_status_to_err) (grub_efi_status_t status); ++ + #endif /* ! GRUB_EFI_EFI_HEADER */ +diff --git a/include/grub/mm.h b/include/grub/mm.h +index 9c38dd3ca5..d81623d226 100644 +--- a/include/grub/mm.h ++++ b/include/grub/mm.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + #include + + #ifndef NULL +@@ -38,6 +39,37 @@ void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size); + void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size); + #endif + ++#define GRUB_MEM_ATTR_R 0x0000000000000004LLU ++#define GRUB_MEM_ATTR_W 0x0000000000000002LLU ++#define GRUB_MEM_ATTR_X 0x0000000000000001LLU ++ ++#ifdef GRUB_MACHINE_EFI ++grub_err_t EXPORT_FUNC(grub_get_mem_attrs) (grub_addr_t addr, ++ grub_size_t size, ++ grub_uint64_t *attrs); ++grub_err_t EXPORT_FUNC(grub_update_mem_attrs) (grub_addr_t addr, ++ grub_size_t size, ++ grub_uint64_t set_attrs, ++ grub_uint64_t clear_attrs); ++#else /* !GRUB_MACHINE_EFI */ ++static inline grub_err_t ++grub_get_mem_attrs (grub_addr_t addr __attribute__((__unused__)), ++ grub_size_t size __attribute__((__unused__)), ++ grub_uint64_t *attrs __attribute__((__unused__))) ++{ ++ return GRUB_ERR_NONE; ++} ++ ++static inline grub_err_t ++grub_update_mem_attrs (grub_addr_t addr __attribute__((__unused__)), ++ grub_size_t size __attribute__((__unused__)), ++ grub_uint64_t set_attrs __attribute__((__unused__)), ++ grub_uint64_t clear_attrs __attribute__((__unused__))) ++{ ++ return GRUB_ERR_NONE; ++} ++#endif /* GRUB_MACHINE_EFI */ ++ + void grub_mm_check_real (const char *file, int line); + #define grub_mm_check() grub_mm_check_real (GRUB_FILE, __LINE__); + diff --git a/0264-nx-set-page-permissions-for-loaded-modules.patch b/0264-nx-set-page-permissions-for-loaded-modules.patch new file mode 100644 index 00000000..9e0aebbc --- /dev/null +++ b/0264-nx-set-page-permissions-for-loaded-modules.patch @@ -0,0 +1,263 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 21 Mar 2022 17:46:35 -0400 +Subject: [PATCH] nx: set page permissions for loaded modules. + +For NX, we need to set write and executable permissions on the sections +of grub modules when we load them. + +On sections with SHF_ALLOC set, which is typically everything except +.modname and the symbol and string tables, this patch clears the Read +Only flag on sections that have the ELF flag SHF_WRITE set, and clears +the No eXecute flag on sections with SHF_EXECINSTR set. In all other +cases it sets both flags. + +Signed-off-by: Peter Jones +[rharwood: arm tgptr -> tgaddr] +Signed-off-by: Robbie Harwood +--- + grub-core/kern/dl.c | 120 +++++++++++++++++++++++++++++++++++++++------------- + include/grub/dl.h | 44 +++++++++++++++++++ + 2 files changed, 134 insertions(+), 30 deletions(-) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index 8c7aacef39..d5de80186f 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -285,6 +285,8 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + #endif + char *ptr; + ++ grub_dprintf ("modules", "loading segments for \"%s\"\n", mod->name); ++ + arch_addralign = grub_arch_dl_min_alignment (); + + for (i = 0, s = (const Elf_Shdr *)((const char *) e + e->e_shoff); +@@ -384,6 +386,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + ptr += got; + #endif + ++ grub_dprintf ("modules", "done loading segments for \"%s\"\n", mod->name); + return GRUB_ERR_NONE; + } + +@@ -517,23 +520,6 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) + return s; + return NULL; + } +-static long +-grub_dl_find_section_index (Elf_Ehdr *e, const char *name) +-{ +- Elf_Shdr *s; +- const char *str; +- unsigned i; +- +- s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); +- str = (char *) e + s->sh_offset; +- +- for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); +- i < e->e_shnum; +- i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) +- if (grub_strcmp (str + s->sh_name, name) == 0) +- return (long)i; +- return -1; +-} + + /* Me, Vladimir Serbinenko, hereby I add this module check as per new + GNU module policy. Note that this license check is informative only. +@@ -662,6 +648,7 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) + Elf_Shdr *s; + unsigned i; + ++ grub_dprintf ("modules", "relocating symbols for \"%s\"\n", mod->name); + for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); + i < e->e_shnum; + i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) +@@ -670,24 +657,95 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) + grub_dl_segment_t seg; + grub_err_t err; + +- /* Find the target segment. */ +- for (seg = mod->segment; seg; seg = seg->next) +- if (seg->section == s->sh_info) +- break; ++ seg = grub_dl_find_segment(mod, s->sh_info); ++ if (!seg) ++ continue; + +- if (seg) +- { +- if (!mod->symtab) +- return grub_error (GRUB_ERR_BAD_MODULE, "relocation without symbol table"); ++ if (!mod->symtab) ++ return grub_error (GRUB_ERR_BAD_MODULE, "relocation without symbol table"); + +- err = grub_arch_dl_relocate_symbols (mod, ehdr, s, seg); +- if (err) +- return err; +- } ++ err = grub_arch_dl_relocate_symbols (mod, ehdr, s, seg); ++ if (err) ++ return err; + } + ++ grub_dprintf ("modules", "done relocating symbols for \"%s\"\n", mod->name); + return GRUB_ERR_NONE; + } ++ ++static grub_err_t ++grub_dl_set_mem_attrs (grub_dl_t mod, void *ehdr) ++{ ++ unsigned i; ++ const Elf_Shdr *s; ++ const Elf_Ehdr *e = ehdr; ++#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) ++ grub_size_t arch_addralign = grub_arch_dl_min_alignment (); ++ grub_addr_t tgaddr; ++ grub_uint64_t tgsz; ++#endif ++ ++ grub_dprintf ("modules", "updating memory attributes for \"%s\"\n", ++ mod->name); ++ for (i = 0, s = (const Elf_Shdr *)((const char *) e + e->e_shoff); ++ i < e->e_shnum; ++ i++, s = (const Elf_Shdr *)((const char *) s + e->e_shentsize)) ++ { ++ grub_dl_segment_t seg; ++ grub_uint64_t set_attrs = GRUB_MEM_ATTR_R; ++ grub_uint64_t clear_attrs = GRUB_MEM_ATTR_W|GRUB_MEM_ATTR_X; ++ ++ seg = grub_dl_find_segment(mod, i); ++ if (!seg) ++ continue; ++ ++ if (seg->size == 0 || !(s->sh_flags & SHF_ALLOC)) ++ continue; ++ ++ if (s->sh_flags & SHF_WRITE) ++ { ++ set_attrs |= GRUB_MEM_ATTR_W; ++ clear_attrs &= ~GRUB_MEM_ATTR_W; ++ } ++ ++ if (s->sh_flags & SHF_EXECINSTR) ++ { ++ set_attrs |= GRUB_MEM_ATTR_X; ++ clear_attrs &= ~GRUB_MEM_ATTR_X; ++ } ++ ++ grub_dprintf ("modules", "setting memory attrs for section \"%s\" to -%s%s%s+%s%s%s\n", ++ grub_dl_get_section_name(e, s), ++ (clear_attrs & GRUB_MEM_ATTR_R) ? "r" : "", ++ (clear_attrs & GRUB_MEM_ATTR_W) ? "w" : "", ++ (clear_attrs & GRUB_MEM_ATTR_X) ? "x" : "", ++ (set_attrs & GRUB_MEM_ATTR_R) ? "r" : "", ++ (set_attrs & GRUB_MEM_ATTR_W) ? "w" : "", ++ (set_attrs & GRUB_MEM_ATTR_X) ? "x" : ""); ++ grub_update_mem_attrs ((grub_addr_t)(seg->addr), seg->size, set_attrs, clear_attrs); ++ } ++ ++#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) ++ tgaddr = grub_min((grub_addr_t)mod->tramp, (grub_addr_t)mod->got); ++ tgsz = grub_max((grub_addr_t)mod->trampptr, (grub_addr_t)mod->gotptr) - tgaddr; ++ ++ if (tgsz) ++ { ++ tgsz = ALIGN_UP(tgsz, arch_addralign); ++ ++ grub_dprintf ("modules", "updating attributes for GOT and trampolines\n", ++ mod->name); ++ grub_update_mem_attrs (tgaddr, tgsz, GRUB_MEM_ATTR_R|GRUB_MEM_ATTR_X, ++ GRUB_MEM_ATTR_W); ++ } ++#endif ++ ++ grub_dprintf ("modules", "done updating module memory attributes for \"%s\"\n", ++ mod->name); ++ ++ return GRUB_ERR_NONE; ++} ++ + static void + grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e) + { +@@ -753,6 +811,7 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) + mod->ref_count = 1; + + grub_dprintf ("modules", "relocating to %p\n", mod); ++ + /* Me, Vladimir Serbinenko, hereby I add this module check as per new + GNU module policy. Note that this license check is informative only. + Modules have to be licensed under GPLv3 or GPLv3+ (optionally +@@ -766,7 +825,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) + || grub_dl_resolve_dependencies (mod, e) + || grub_dl_load_segments (mod, e) + || grub_dl_resolve_symbols (mod, e) +- || grub_dl_relocate_symbols (mod, e)) ++ || grub_dl_relocate_symbols (mod, e) ++ || grub_dl_set_mem_attrs (mod, e)) + { + mod->fini = 0; + grub_dl_unload (mod); +diff --git a/include/grub/dl.h b/include/grub/dl.h +index f36ed5cb17..45ac8e339f 100644 +--- a/include/grub/dl.h ++++ b/include/grub/dl.h +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #endif + + /* +@@ -268,6 +269,49 @@ grub_dl_is_persistent (grub_dl_t mod) + return mod->persistent; + } + ++static inline const char * ++grub_dl_get_section_name (const Elf_Ehdr *e, const Elf_Shdr *s) ++{ ++ Elf_Shdr *str_s; ++ const char *str; ++ ++ str_s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); ++ str = (char *) e + str_s->sh_offset; ++ ++ return str + s->sh_name; ++} ++ ++static inline long ++grub_dl_find_section_index (Elf_Ehdr *e, const char *name) ++{ ++ Elf_Shdr *s; ++ const char *str; ++ unsigned i; ++ ++ s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); ++ str = (char *) e + s->sh_offset; ++ ++ for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); ++ i < e->e_shnum; ++ i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) ++ if (grub_strcmp (str + s->sh_name, name) == 0) ++ return (long)i; ++ return -1; ++} ++ ++/* Return the segment for a section of index N */ ++static inline grub_dl_segment_t ++grub_dl_find_segment (grub_dl_t mod, unsigned n) ++{ ++ grub_dl_segment_t seg; ++ ++ for (seg = mod->segment; seg; seg = seg->next) ++ if (seg->section == n) ++ return seg; ++ ++ return NULL; ++} ++ + #endif + + void * EXPORT_FUNC(grub_resolve_symbol) (const char *name); diff --git a/0265-nx-set-attrs-in-our-kernel-loaders.patch b/0265-nx-set-attrs-in-our-kernel-loaders.patch new file mode 100644 index 00000000..514df1fe --- /dev/null +++ b/0265-nx-set-attrs-in-our-kernel-loaders.patch @@ -0,0 +1,565 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 22 Mar 2022 10:57:07 -0400 +Subject: [PATCH] nx: set attrs in our kernel loaders + +For NX, our kernel loaders need to set write and execute page +permissions on allocated pages and the stack. + +This patch adds those calls. + +Signed-off-by: Peter Jones +[rharwood: fix stack_attrs undefined, fix aarch64 callsites] +Signed-off-by: Robbie Harwood +--- + grub-core/kern/efi/mm.c | 77 +++++++++++++++++ + grub-core/loader/arm64/linux.c | 16 +++- + grub-core/loader/arm64/xen_boot.c | 4 +- + grub-core/loader/efi/chainloader.c | 11 +++ + grub-core/loader/efi/linux.c | 164 ++++++++++++++++++++++++++++++++++++- + grub-core/loader/i386/efi/linux.c | 26 +++++- + grub-core/loader/i386/linux.c | 5 ++ + include/grub/efi/efi.h | 6 +- + include/grub/efi/linux.h | 16 +++- + include/grub/efi/pe32.h | 2 + + 10 files changed, 312 insertions(+), 15 deletions(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index 2c33758ed7..e460b072e6 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -610,6 +610,81 @@ print_memory_map (grub_efi_memory_descriptor_t *memory_map, + } + #endif + ++grub_addr_t grub_stack_addr = (grub_addr_t)-1ll; ++grub_size_t grub_stack_size = 0; ++ ++static void ++grub_nx_init (void) ++{ ++ grub_uint64_t attrs, stack_attrs; ++ grub_err_t err; ++ grub_addr_t stack_current, stack_end; ++ const grub_uint64_t page_size = 4096; ++ const grub_uint64_t page_mask = ~(page_size - 1); ++ ++ /* ++ * These are to confirm that the flags are working as expected when ++ * debugging. ++ */ ++ attrs = 0; ++ stack_current = (grub_addr_t)grub_nx_init & page_mask; ++ err = grub_get_mem_attrs (stack_current, page_size, &attrs); ++ if (err) ++ { ++ grub_dprintf ("nx", ++ "grub_get_mem_attrs(0x%"PRIxGRUB_UINT64_T", ...) -> 0x%x\n", ++ stack_current, err); ++ grub_error_pop (); ++ } ++ else ++ grub_dprintf ("nx", "page attrs for grub_nx_init (%p) are %c%c%c\n", ++ grub_dl_load_core, ++ (attrs & GRUB_MEM_ATTR_R) ? 'r' : '-', ++ (attrs & GRUB_MEM_ATTR_R) ? 'w' : '-', ++ (attrs & GRUB_MEM_ATTR_R) ? 'x' : '-'); ++ ++ stack_current = (grub_addr_t)&stack_current & page_mask; ++ err = grub_get_mem_attrs (stack_current, page_size, &stack_attrs); ++ if (err) ++ { ++ grub_dprintf ("nx", ++ "grub_get_mem_attrs(0x%"PRIxGRUB_UINT64_T", ...) -> 0x%x\n", ++ stack_current, err); ++ grub_error_pop (); ++ } ++ else ++ { ++ attrs = stack_attrs; ++ grub_dprintf ("nx", "page attrs for stack (%p) are %c%c%c\n", ++ &attrs, ++ (attrs & GRUB_MEM_ATTR_R) ? 'r' : '-', ++ (attrs & GRUB_MEM_ATTR_R) ? 'w' : '-', ++ (attrs & GRUB_MEM_ATTR_R) ? 'x' : '-'); ++ } ++ for (stack_end = stack_current + page_size ; ++ !(attrs & GRUB_MEM_ATTR_R); ++ stack_end += page_size) ++ { ++ err = grub_get_mem_attrs (stack_current, page_size, &attrs); ++ if (err) ++ { ++ grub_dprintf ("nx", ++ "grub_get_mem_attrs(0x%"PRIxGRUB_UINT64_T", ...) -> 0x%x\n", ++ stack_current, err); ++ grub_error_pop (); ++ break; ++ } ++ } ++ if (stack_end > stack_current) ++ { ++ grub_stack_addr = stack_current; ++ grub_stack_size = stack_end - stack_current; ++ grub_dprintf ("nx", ++ "detected stack from 0x%"PRIxGRUB_ADDR" to 0x%"PRIxGRUB_ADDR"\n", ++ grub_stack_addr, grub_stack_addr + grub_stack_size - 1); ++ } ++} ++ + void + grub_efi_mm_init (void) + { +@@ -623,6 +698,8 @@ grub_efi_mm_init (void) + grub_efi_uint64_t required_pages; + int mm_status; + ++ grub_nx_init (); ++ + /* Prepare a memory region to store two memory maps. */ + memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); + if (! memory_map) +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index cc67f43906..de85583487 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -172,7 +172,8 @@ free_params (void) + } + + grub_err_t +-grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) ++grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args, ++ int nx_supported) + { + grub_err_t retval; + +@@ -182,7 +183,8 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) + + grub_dprintf ("linux", "linux command line: '%s'\n", args); + +- retval = grub_efi_linux_boot ((char *)addr, handover_offset, (void *)addr); ++ retval = grub_efi_linux_boot (addr, size, handover_offset, ++ (void *)addr, nx_supported); + + /* Never reached... */ + free_params(); +@@ -192,7 +194,10 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) + static grub_err_t + grub_linux_boot (void) + { +- return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args)); ++ return grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, ++ (grub_size_t)kernel_size, ++ linux_args, ++ 0); + } + + static grub_err_t +@@ -340,6 +345,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_off_t filelen; + grub_uint32_t align; + void *kernel = NULL; ++ int nx_supported = 1; + + grub_dl_ref (my_mod); + +@@ -376,6 +382,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_dprintf ("linux", "kernel entry offset : %d\n", handover_offset); + grub_dprintf ("linux", "kernel alignment : 0x%x\n", align); + ++ err = grub_efi_check_nx_image_support((grub_addr_t)kernel, filelen, &nx_supported); ++ if (err != GRUB_ERR_NONE) ++ goto fail; ++ + grub_loader_unset(); + + kernel_alloc_pages = GRUB_EFI_BYTES_TO_PAGES (kernel_size + align - 1); +diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c +index d9b7a9ba40..6e7e920416 100644 +--- a/grub-core/loader/arm64/xen_boot.c ++++ b/grub-core/loader/arm64/xen_boot.c +@@ -266,7 +266,9 @@ xen_boot (void) + return err; + + return grub_arch_efi_linux_boot_image (xen_hypervisor->start, +- xen_hypervisor->cmdline); ++ xen_hypervisor->size, ++ xen_hypervisor->cmdline, ++ 0); + } + + static void +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index fb874f1855..dd31ac9bb3 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -1070,6 +1070,17 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + ++ /* ++ * The OS kernel is going to set its own permissions when it takes over ++ * paging a few million instructions from now, and load_image() will set up ++ * anything that's needed based on the section headers, so there's no point ++ * in doing anything but clearing the protection bits here. ++ */ ++ grub_dprintf("nx", "setting attributes for %p (%lu bytes) to %llx\n", ++ (void *)(grub_addr_t)address, fsize, 0llu); ++ grub_update_mem_attrs (address, fsize, ++ GRUB_MEM_ATTR_R|GRUB_MEM_ATTR_W|GRUB_MEM_ATTR_X, 0); ++ + #if defined (__i386__) || defined (__x86_64__) + if (fsize >= (grub_ssize_t) sizeof (struct grub_macho_fat_header)) + { +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 9265cf4200..277f352e0c 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -26,16 +26,127 @@ + + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" ++#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" ++ ++grub_err_t ++grub_efi_check_nx_image_support (grub_addr_t kernel_addr, ++ grub_size_t kernel_size, ++ int *nx_supported) ++{ ++ struct grub_dos_header *doshdr; ++ grub_size_t sz = sizeof (*doshdr); ++ ++ struct grub_pe32_header_32 *pe32; ++ struct grub_pe32_header_64 *pe64; ++ ++ int image_is_compatible = 0; ++ int is_64_bit; ++ ++ if (kernel_size < sz) ++ return grub_error (GRUB_ERR_BAD_OS, N_("kernel is too small")); ++ ++ doshdr = (void *)kernel_addr; ++ ++ if ((doshdr->magic & 0xffff) != GRUB_DOS_MAGIC) ++ return grub_error (GRUB_ERR_BAD_OS, N_("kernel DOS magic is invalid")); ++ ++ sz = doshdr->lfanew + sizeof (*pe32); ++ if (kernel_size < sz) ++ return grub_error (GRUB_ERR_BAD_OS, N_("kernel is too small")); ++ ++ pe32 = (struct grub_pe32_header_32 *)(kernel_addr + doshdr->lfanew); ++ pe64 = (struct grub_pe32_header_64 *)pe32; ++ ++ if (grub_memcmp (pe32->signature, GRUB_PE32_SIGNATURE, ++ GRUB_PE32_SIGNATURE_SIZE) != 0) ++ return grub_error (GRUB_ERR_BAD_OS, N_("kernel PE magic is invalid")); ++ ++ switch (pe32->coff_header.machine) ++ { ++ case GRUB_PE32_MACHINE_ARMTHUMB_MIXED: ++ case GRUB_PE32_MACHINE_I386: ++ case GRUB_PE32_MACHINE_RISCV32: ++ is_64_bit = 0; ++ break; ++ case GRUB_PE32_MACHINE_ARM64: ++ case GRUB_PE32_MACHINE_IA64: ++ case GRUB_PE32_MACHINE_RISCV64: ++ case GRUB_PE32_MACHINE_X86_64: ++ is_64_bit = 1; ++ break; ++ default: ++ return grub_error (GRUB_ERR_BAD_OS, N_("PE machine type 0x%04hx unknown"), ++ pe32->coff_header.machine); ++ } ++ ++ if (is_64_bit) ++ { ++ sz = doshdr->lfanew + sizeof (*pe64); ++ if (kernel_size < sz) ++ return grub_error (GRUB_ERR_BAD_OS, N_("kernel is too small")); ++ ++ if (pe64->optional_header.dll_characteristics & GRUB_PE32_NX_COMPAT) ++ image_is_compatible = 1; ++ } ++ else ++ { ++ if (pe32->optional_header.dll_characteristics & GRUB_PE32_NX_COMPAT) ++ image_is_compatible = 1; ++ } ++ ++ *nx_supported = image_is_compatible; ++ return GRUB_ERR_NONE; ++} ++ ++grub_err_t ++grub_efi_check_nx_required (int *nx_required) ++{ ++ grub_efi_status_t status; ++ grub_efi_guid_t guid = GRUB_EFI_SHIM_LOCK_GUID; ++ grub_size_t mok_policy_sz = 0; ++ char *mok_policy = NULL; ++ grub_uint32_t mok_policy_attrs = 0; ++ ++ status = grub_efi_get_variable_with_attributes ("MokPolicy", &guid, ++ &mok_policy_sz, ++ (void **)&mok_policy, ++ &mok_policy_attrs); ++ if (status == GRUB_EFI_NOT_FOUND || ++ mok_policy_sz == 0 || ++ mok_policy == NULL) ++ { ++ *nx_required = 0; ++ return GRUB_ERR_NONE; ++ } ++ ++ *nx_required = 0; ++ if (mok_policy_sz < 1 || ++ mok_policy_attrs != (GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS | ++ GRUB_EFI_VARIABLE_RUNTIME_ACCESS) || ++ (mok_policy[mok_policy_sz-1] & GRUB_MOK_POLICY_NX_REQUIRED)) ++ *nx_required = 1; ++ ++ return GRUB_ERR_NONE; ++} + + typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *); + + grub_err_t +-grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, +- void *kernel_params) ++grub_efi_linux_boot (grub_addr_t kernel_addr, grub_size_t kernel_size, ++ grub_off_t handover_offset, void *kernel_params, ++ int nx_supported) + { + grub_efi_loaded_image_t *loaded_image = NULL; + handover_func hf; + int offset = 0; ++ grub_uint64_t stack_set_attrs = GRUB_MEM_ATTR_R | ++ GRUB_MEM_ATTR_W | ++ GRUB_MEM_ATTR_X; ++ grub_uint64_t stack_clear_attrs = 0; ++ grub_uint64_t kernel_set_attrs = stack_set_attrs; ++ grub_uint64_t kernel_clear_attrs = stack_clear_attrs; ++ grub_uint64_t attrs; ++ int nx_required = 0; + + #ifdef __x86_64__ + offset = 512; +@@ -48,12 +159,57 @@ grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, + */ + loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); + if (loaded_image) +- loaded_image->image_base = kernel_addr; ++ loaded_image->image_base = (void *)kernel_addr; + else + grub_dprintf ("linux", "Loaded Image base address could not be set\n"); + + grub_dprintf ("linux", "kernel_addr: %p handover_offset: %p params: %p\n", +- kernel_addr, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); ++ (void *)kernel_addr, (void *)handover_offset, kernel_params); ++ ++ ++ if (nx_required && !nx_supported) ++ return grub_error (GRUB_ERR_BAD_OS, N_("kernel does not support NX loading required by policy")); ++ ++ if (nx_supported) ++ { ++ kernel_set_attrs &= ~GRUB_MEM_ATTR_W; ++ kernel_clear_attrs |= GRUB_MEM_ATTR_W; ++ stack_set_attrs &= ~GRUB_MEM_ATTR_X; ++ stack_clear_attrs |= GRUB_MEM_ATTR_X; ++ } ++ ++ grub_dprintf ("nx", "Setting attributes for 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" to r%cx\n", ++ kernel_addr, kernel_addr + kernel_size - 1, ++ (kernel_set_attrs & GRUB_MEM_ATTR_W) ? 'w' : '-'); ++ grub_update_mem_attrs (kernel_addr, kernel_size, ++ kernel_set_attrs, kernel_clear_attrs); ++ ++ grub_get_mem_attrs (kernel_addr, 4096, &attrs); ++ grub_dprintf ("nx", "permissions for 0x%"PRIxGRUB_ADDR" are %s%s%s\n", ++ (grub_addr_t)kernel_addr, ++ (attrs & GRUB_MEM_ATTR_R) ? "r" : "-", ++ (attrs & GRUB_MEM_ATTR_W) ? "w" : "-", ++ (attrs & GRUB_MEM_ATTR_X) ? "x" : "-"); ++ if (grub_stack_addr != (grub_addr_t)-1ll) ++ { ++ grub_dprintf ("nx", "Setting attributes for stack at 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" to rw%c\n", ++ grub_stack_addr, grub_stack_addr + grub_stack_size - 1, ++ (stack_set_attrs & GRUB_MEM_ATTR_X) ? 'x' : '-'); ++ grub_update_mem_attrs (grub_stack_addr, grub_stack_size, ++ stack_set_attrs, stack_clear_attrs); ++ ++ grub_get_mem_attrs (grub_stack_addr, 4096, &attrs); ++ grub_dprintf ("nx", "permissions for 0x%"PRIxGRUB_ADDR" are %s%s%s\n", ++ grub_stack_addr, ++ (attrs & GRUB_MEM_ATTR_R) ? "r" : "-", ++ (attrs & GRUB_MEM_ATTR_W) ? "w" : "-", ++ (attrs & GRUB_MEM_ATTR_X) ? "x" : "-"); ++ } ++ ++#if defined(__i386__) || defined(__x86_64__) ++ asm volatile ("cli"); ++#endif ++ + hf = (handover_func)((char *)kernel_addr + handover_offset + offset); + hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 92b2fb5091..91ae274299 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -44,7 +44,7 @@ struct grub_linuxefi_context { + grub_uint32_t handover_offset; + struct linux_kernel_params *params; + char *cmdline; +- ++ int nx_supported; + void *initrd_mem; + }; + +@@ -110,13 +110,19 @@ kernel_alloc(grub_efi_uintn_t size, + pages = BYTES_TO_PAGES(size); + grub_dprintf ("linux", "Trying to allocate %lu pages from %p\n", + (unsigned long)pages, (void *)(unsigned long)max); ++ size = pages * GRUB_EFI_PAGE_SIZE; + + prev_max = max; + addr = grub_efi_allocate_pages_real (max, pages, + max_addresses[i].alloc_type, + memtype); + if (addr) +- grub_dprintf ("linux", "Allocated at %p\n", addr); ++ { ++ grub_dprintf ("linux", "Allocated at %p\n", addr); ++ grub_update_mem_attrs ((grub_addr_t)addr, size, ++ GRUB_MEM_ATTR_R|GRUB_MEM_ATTR_W, ++ GRUB_MEM_ATTR_X); ++ } + } + + while (grub_error_pop ()) +@@ -137,9 +143,11 @@ grub_linuxefi_boot (void *data) + + asm volatile ("cli"); + +- return grub_efi_linux_boot ((char *)context->kernel_mem, ++ return grub_efi_linux_boot ((grub_addr_t)context->kernel_mem, ++ context->kernel_size, + context->handover_offset, +- context->params); ++ context->params, ++ context->nx_supported); + } + + static grub_err_t +@@ -304,7 +312,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_uint32_t handover_offset; + struct linux_kernel_params *params = 0; + char *cmdline = 0; ++ int nx_supported = 1; + struct grub_linuxefi_context *context = 0; ++ grub_err_t err; + + grub_dl_ref (my_mod); + +@@ -334,6 +344,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + ++ err = grub_efi_check_nx_image_support ((grub_addr_t)kernel, filelen, ++ &nx_supported); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ grub_dprintf ("linux", "nx is%s supported by this kernel\n", ++ nx_supported ? "" : " not"); ++ + lh = (struct linux_i386_kernel_header *)kernel; + grub_dprintf ("linux", "original lh is at %p\n", kernel); + +@@ -498,6 +515,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + context->handover_offset = handover_offset; + context->params = params; + context->cmdline = cmdline; ++ context->nx_supported = nx_supported; + + grub_loader_set_ex (grub_linuxefi_boot, grub_linuxefi_unload, context, 0); + +diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c +index 4aeb0e4b9a..3c1ff64763 100644 +--- a/grub-core/loader/i386/linux.c ++++ b/grub-core/loader/i386/linux.c +@@ -805,6 +805,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + kernel_offset += len; + } + ++ grub_dprintf("efi", "setting attributes for %p (%zu bytes) to +rw-x\n", ++ &linux_params, sizeof (lh) + len); ++ grub_update_mem_attrs ((grub_addr_t)&linux_params, sizeof (lh) + len, ++ GRUB_MEM_ATTR_R|GRUB_MEM_ATTR_W, GRUB_MEM_ATTR_X); ++ + linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR; + linux_params.kernel_alignment = (1 << align); + linux_params.ps_mouse = linux_params.padding11 = 0; +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 34825c4adc..449e55269f 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -140,12 +140,16 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, + char **device, + char **path); + ++extern grub_addr_t EXPORT_VAR(grub_stack_addr); ++extern grub_size_t EXPORT_VAR(grub_stack_size); ++ + #if defined(__arm__) || defined(__aarch64__) || defined(__riscv) + void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); + grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); + #include + grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); +-grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args); ++grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, ++ char *args, int nx_enabled); + #endif + + grub_addr_t grub_efi_section_addr (const char *section); +diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h +index 887b02fd9f..b82f71006a 100644 +--- a/include/grub/efi/linux.h ++++ b/include/grub/efi/linux.h +@@ -22,8 +22,20 @@ + #include + #include + ++#define GRUB_MOK_POLICY_NX_REQUIRED 0x1 ++ + grub_err_t +-EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, +- void *kernel_param); ++EXPORT_FUNC(grub_efi_linux_boot) (grub_addr_t kernel_address, ++ grub_size_t kernel_size, ++ grub_off_t handover_offset, ++ void *kernel_param, int nx_enabled); ++ ++grub_err_t ++EXPORT_FUNC(grub_efi_check_nx_image_support) (grub_addr_t kernel_addr, ++ grub_size_t kernel_size, ++ int *nx_supported); ++ ++grub_err_t ++EXPORT_FUNC(grub_efi_check_nx_required) (int *nx_required); + + #endif /* ! GRUB_EFI_LINUX_HEADER */ +diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h +index 2a5e1ee003..a5e623eb04 100644 +--- a/include/grub/efi/pe32.h ++++ b/include/grub/efi/pe32.h +@@ -181,6 +181,8 @@ struct grub_pe32_optional_header + struct grub_pe32_data_directory reserved_entry; + }; + ++#define GRUB_PE32_NX_COMPAT 0x0100 ++ + struct grub_pe64_optional_header + { + grub_uint16_t magic; diff --git a/0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch b/0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch new file mode 100644 index 00000000..7da75a81 --- /dev/null +++ b/0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 22 Mar 2022 10:57:20 -0400 +Subject: [PATCH] nx: set the nx compatible flag in EFI grub images + +For NX, we need the grub binary to announce that it is compatible with +the NX feature. This implies that when loading the executable grub +image, several attributes are true: + +- the binary doesn't need an executable stack +- the binary doesn't need sections to be both executable and writable +- the binary knows how to use the EFI Memory Attributes protocol on code + it is loading. + +This patch adds a definition for the PE DLL Characteristics flag +GRUB_PE32_NX_COMPAT, and changes grub-mkimage to set that flag. + +Signed-off-by: Peter Jones +--- + util/mkimage.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/util/mkimage.c b/util/mkimage.c +index 8319e8dfbd..c3d33aaac8 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -1418,6 +1418,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + section = (struct grub_pe32_section_table *)(o64 + 1); + } + ++ PE_OHDR (o32, o64, dll_characteristics) = grub_host_to_target16 (GRUB_PE32_NX_COMPAT); + 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; diff --git a/grub.patches b/grub.patches index b520d470..f992ef2e 100644 --- a/grub.patches +++ b/grub.patches @@ -217,3 +217,50 @@ Patch0216: 0216-powerpc-prefix-detection-support-device-names-with-c.patch Patch0217: 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch Patch0218: 0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch Patch0219: 0219-make-ofdisk_retries-optional.patch +Patch0220: 0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch +Patch0221: 0221-loader-efi-chainloader-simplify-the-loader-state.patch +Patch0222: 0222-commands-boot-Add-API-to-pass-context-to-loader.patch +Patch0223: 0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch +Patch0224: 0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch +Patch0225: 0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch +Patch0226: 0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch +Patch0227: 0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch +Patch0228: 0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch +Patch0229: 0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch +Patch0230: 0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch +Patch0231: 0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch +Patch0232: 0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch +Patch0233: 0233-video-readers-png-Sanity-check-some-huffman-codes.patch +Patch0234: 0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch +Patch0235: 0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch +Patch0236: 0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch +Patch0237: 0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch +Patch0238: 0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch +Patch0239: 0239-net-netbuff-Block-overly-large-netbuff-allocs.patch +Patch0240: 0240-net-ip-Do-IP-fragment-maths-safely.patch +Patch0241: 0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch +Patch0242: 0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch +Patch0243: 0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch +Patch0244: 0244-net-tftp-Avoid-a-trivial-UAF.patch +Patch0245: 0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch +Patch0246: 0246-net-http-Fix-OOB-write-for-split-http-headers.patch +Patch0247: 0247-net-http-Error-out-on-headers-with-LF-without-CR.patch +Patch0248: 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch +Patch0249: 0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch +Patch0250: 0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch +Patch0251: 0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch +Patch0252: 0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch +Patch0253: 0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch +Patch0254: 0254-misc-Make-grub_min-and-grub_max-more-resilient.patch +Patch0255: 0255-ReiserFS-switch-to-using-grub_min-grub_max.patch +Patch0256: 0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch +Patch0257: 0257-modules-make-.module_license-read-only.patch +Patch0258: 0258-modules-strip-.llvm_addrsig-sections-and-similar.patch +Patch0259: 0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch +Patch0260: 0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch +Patch0261: 0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch +Patch0262: 0262-modules-load-module-sections-at-page-aligned-address.patch +Patch0263: 0263-nx-add-memory-attribute-get-set-API.patch +Patch0264: 0264-nx-set-page-permissions-for-loaded-modules.patch +Patch0265: 0265-nx-set-attrs-in-our-kernel-loaders.patch +Patch0266: 0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch diff --git a/grub2.spec b/grub2.spec index bcebe4c7..569e0a1a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 41%{?dist} +Release: 42%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon May 16 2022 Robbie Harwood 1:2.06-42 +- CVE fixes for 2022-05-24 +- Resolves: CVE-2022-28736 CVE-2022-28735 CVE-2022-28734 CVE-2022-28733 +- Resolves: CVE-2021-3697 CVE-2021-3696 CVE-2021-3695 + * Mon May 16 2022 Robbie Harwood - 1:2.06-41 - ppc64le: make ofdisk retries optional diff --git a/sbat.csv.in b/sbat.csv.in index ea697f51..55b3d10d 100755 --- a/sbat.csv.in +++ b/sbat.csv.in @@ -1,3 +1,3 @@ sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md -grub,1,Free Software Foundation,grub,@@VERSION@@,https//www.gnu.org/software/grub/ -grub.fedora,1,The Fedora Project,grub2,@@VERSION_RELEASE@@,https://src.fedoraproject.org/rpms/grub2 +grub,2,Free Software Foundation,grub,@@VERSION@@,https//www.gnu.org/software/grub/ +grub.rh,2,Red Hat,grub2,@@VERSION_RELEASE@@,mailto:secalert@redhat.com From e7aee52b19161da679328924af419750f33bd656 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 19 Jul 2022 16:24:58 +0000 Subject: [PATCH 133/294] Handle FAT mtime of 0 Resolves: #2096192 Signed-off-by: Robbie Harwood --- ...-document-the-behavior-of-multiple-v.patch | 25 ++++++++ ...probe-dprint-errors-from-filesystems.patch | 43 +++++++++++++ 0269-fs-fat-don-t-error-when-mtime-is-0.patch | 64 +++++++++++++++++++ grub.patches | 3 + grub2.spec | 8 ++- 5 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 0267-grub-probe-document-the-behavior-of-multiple-v.patch create mode 100644 0268-grub_fs_probe-dprint-errors-from-filesystems.patch create mode 100644 0269-fs-fat-don-t-error-when-mtime-is-0.patch diff --git a/0267-grub-probe-document-the-behavior-of-multiple-v.patch b/0267-grub-probe-document-the-behavior-of-multiple-v.patch new file mode 100644 index 00000000..4e9d7ccf --- /dev/null +++ b/0267-grub-probe-document-the-behavior-of-multiple-v.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Fri, 15 Jul 2022 15:49:25 -0400 +Subject: [PATCH] grub-probe: document the behavior of multiple -v + +Signed-off-by: Robbie Harwood +(cherry picked from commit 51a55233eed08f7f12276afd6b3724b807a0b680) +--- + util/grub-probe.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/util/grub-probe.c b/util/grub-probe.c +index c6fac732b4..ba867319a7 100644 +--- a/util/grub-probe.c ++++ b/util/grub-probe.c +@@ -732,7 +732,8 @@ static struct argp_option options[] = { + {"device-map", 'm', N_("FILE"), 0, + N_("use FILE as the device map [default=%s]"), 0}, + {"target", 't', N_("TARGET"), 0, 0, 0}, +- {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, ++ {"verbose", 'v', 0, 0, ++ N_("print verbose messages (pass twice to enable debug printing)."), 0}, + {0, '0', 0, 0, N_("separate items in output using ASCII NUL characters"), 0}, + { 0, 0, 0, 0, 0, 0 } + }; diff --git a/0268-grub_fs_probe-dprint-errors-from-filesystems.patch b/0268-grub_fs_probe-dprint-errors-from-filesystems.patch new file mode 100644 index 00000000..1455ae4b --- /dev/null +++ b/0268-grub_fs_probe-dprint-errors-from-filesystems.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Fri, 15 Jul 2022 15:39:41 -0400 +Subject: [PATCH] grub_fs_probe(): 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. + +Signed-off-by: Robbie Harwood +(cherry picked from commit 838c79d658797d0662ee7f9e033e38ee88059e02) +--- + grub-core/kern/fs.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c +index c698295bcb..b58e2ae1d2 100644 +--- a/grub-core/kern/fs.c ++++ b/grub-core/kern/fs.c +@@ -74,6 +74,7 @@ grub_fs_probe (grub_device_t device) + if (grub_errno == GRUB_ERR_NONE) + return p; + ++ grub_dprintf ("fs", _("error: %s.\n"), grub_errmsg); + grub_error_push (); + grub_dprintf ("fs", "%s detection failed.\n", p->name); + grub_error_pop (); diff --git a/0269-fs-fat-don-t-error-when-mtime-is-0.patch b/0269-fs-fat-don-t-error-when-mtime-is-0.patch new file mode 100644 index 00000000..f014f6c9 --- /dev/null +++ b/0269-fs-fat-don-t-error-when-mtime-is-0.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Fri, 15 Jul 2022 15:42:41 -0400 +Subject: [PATCH] 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"). + +Signed-off-by: Robbie Harwood +(cherry picked from commit 0615c4887352e32d7bb7198e9ad0d695f9dc2c31) +--- + 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 dd82e4ee35..ff6200c5be 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; diff --git a/grub.patches b/grub.patches index f992ef2e..ff3d92fd 100644 --- a/grub.patches +++ b/grub.patches @@ -264,3 +264,6 @@ Patch0263: 0263-nx-add-memory-attribute-get-set-API.patch Patch0264: 0264-nx-set-page-permissions-for-loaded-modules.patch Patch0265: 0265-nx-set-attrs-in-our-kernel-loaders.patch Patch0266: 0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch +Patch0267: 0267-grub-probe-document-the-behavior-of-multiple-v.patch +Patch0268: 0268-grub_fs_probe-dprint-errors-from-filesystems.patch +Patch0269: 0269-fs-fat-don-t-error-when-mtime-is-0.patch diff --git a/grub2.spec b/grub2.spec index 569e0a1a..8456134d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 42%{?dist} +Release: 43%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,7 +530,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog -* Mon May 16 2022 Robbie Harwood 1:2.06-42 +* Tue Jul 19 2022 Robbie Harwood - 2.06-43 +- Handle FAT mtime of 0 +- Resolves: #2096192 + +* Mon May 16 2022 Robbie Harwood - 1:2.06-42 - CVE fixes for 2022-05-24 - Resolves: CVE-2022-28736 CVE-2022-28735 CVE-2022-28734 CVE-2022-28733 - Resolves: CVE-2021-3697 CVE-2021-3696 CVE-2021-3695 From 5b44e10cf35669978f7bfc571352362ef1f08136 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 1 Aug 2022 21:57:55 +0000 Subject: [PATCH 134/294] Some allocator fixes for kernel Signed-off-by: Robbie Harwood --- ...file-show-which-file-filters-get-run.patch | 45 +++++++ ...i-make-the-default-arena-most-of-ram.patch | 73 ++++++++++ ...ed-array-positions-for-our-allocatio.patch | 81 +++++++++++ ...tion-policy-for-kernel-vs-initrd-mem.patch | 127 ++++++++++++++++++ grub.patches | 4 + grub2.spec | 5 +- 6 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 0270-Make-debug-file-show-which-file-filters-get-run.patch create mode 100644 0271-efi-make-the-default-arena-most-of-ram.patch create mode 100644 0272-efi-use-enumerated-array-positions-for-our-allocatio.patch create mode 100644 0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch diff --git a/0270-Make-debug-file-show-which-file-filters-get-run.patch b/0270-Make-debug-file-show-which-file-filters-get-run.patch new file mode 100644 index 00000000..12062a31 --- /dev/null +++ b/0270-Make-debug-file-show-which-file-filters-get-run.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 29 Jul 2022 15:56:00 -0400 +Subject: [PATCH] Make debug=file show which file filters get run. + +If one of the file filters breaks things, it's hard to figure out where +it has happened. + +This makes grub log which filter is being run, which makes it easier to +figure out where you are in the sequence of events. + +Signed-off-by: Peter Jones +--- + grub-core/kern/file.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c +index ed69fc0f0f..3f175630ea 100644 +--- a/grub-core/kern/file.c ++++ b/grub-core/kern/file.c +@@ -30,6 +30,14 @@ void (*EXPORT_VAR (grub_grubnet_fini)) (void); + + grub_file_filter_t grub_file_filters[GRUB_FILE_FILTER_MAX]; + ++static char *filter_names[] = { ++ [GRUB_FILE_FILTER_VERIFY] = "GRUB_FILE_FILTER_VERIFY", ++ [GRUB_FILE_FILTER_GZIO] = "GRUB_FILE_FILTER_GZIO", ++ [GRUB_FILE_FILTER_XZIO] = "GRUB_FILE_FILTER_XZIO", ++ [GRUB_FILE_FILTER_LZOPIO] = "GRUB_FILE_FILTER_LZOPIO", ++ [GRUB_FILE_FILTER_MAX] = "GRUB_FILE_FILTER_MAX" ++}; ++ + /* Get the device part of the filename NAME. It is enclosed by parentheses. */ + char * + grub_file_get_device_name (const char *name) +@@ -121,6 +129,9 @@ grub_file_open (const char *name, enum grub_file_type type) + if (grub_file_filters[filter]) + { + last_file = file; ++ if (filter < GRUB_FILE_FILTER_MAX) ++ grub_dprintf ("file", "Running %s file filter\n", ++ filter_names[filter]); + file = grub_file_filters[filter] (file, type); + if (file && file != last_file) + { diff --git a/0271-efi-make-the-default-arena-most-of-ram.patch b/0271-efi-make-the-default-arena-most-of-ram.patch new file mode 100644 index 00000000..49143703 --- /dev/null +++ b/0271-efi-make-the-default-arena-most-of-ram.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 29 Jul 2022 15:57:57 -0400 +Subject: [PATCH] efi: make the default arena most of ram + +Currently when populating the initial memory arena on EFI systems, we +count the available regions below GRUB_EFI_MAX_ALLOCATION_ADDRESS from +the EFI memory map and then allocates one quarter of that for our arena. + +Because many systems come up without IOMMUs, we currently set +GRUB_EFI_MAX_ALLOCATION_ADDRESS to 0x7fffffff, i.e. all addresses +allocated must be below 2G[0]. Due to firmware and other +considerations, this makes the most memory we can possibly have in our +arena 512M. + +Because our EFI loader doesn't get kernel and initrd memory from grub's +allocator, but rather reserves it directly from UEFI and then simply +marks those as allocated if they're within grub's arena, it was +historically possible to have initrds that are larger than 512M, because +we could use any memory region below 4G, without concern for grub's +choice of arena size. + +Unfortunately, when we switched to using the "verifiers" API (and thus +the file_filter_t API) to do measurement of kernel and initrd, this +introduced a pattern that allocates the entire file when we call +grub_file_open(), and buffers it to pass to the filter. This results in +needing to have enough space for the initramfs in the grub arena. + +This is bad. + +Since it's unlikely you're going to do anything *other* than loading a +kernel and initramfs that takes much of the available free memory from +UEFI, this patch introduces a workaround by changing the amount we give +to the arena be three quarters of the available memory, rather than one +quarter, thus changing our theoretical initrd limit to 1.5G. In +practice, it may still be smaller than that depending on allocation +fragmentation, but generally it will be most of it. + +Note that this doesn't fix the underlying flaw, which is that there is +no safe way to do the validation correctly using the "verifiers" system +with the current file API without buffering the whole file before +grub_file_read() is ever called, and thus you can't set an allocation +policy for the initial buffer of the file at all, so unless we raise the +allocation limit to >4G, it can't be allocated in the big region. + +[0] I'm not sure there was a good reason not to pick 4G, but even if we + had, at least one common firmware routes the first 2G of physical + RAM to 0x0, and any additional memory starting at 0x100000000. + +Related: rhbz#2112134 + +Signed-off-by: Peter Jones +--- + grub-core/kern/efi/mm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index e460b072e6..150e412ee7 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -737,10 +737,10 @@ grub_efi_mm_init (void) + filtered_memory_map_end = filter_memory_map (memory_map, filtered_memory_map, + desc_size, memory_map_end); + +- /* By default, request a quarter of the available memory. */ ++ /* By default, request three quarters of the available memory. */ + total_pages = get_total_pages (filtered_memory_map, desc_size, + filtered_memory_map_end); +- required_pages = (total_pages >> 2); ++ required_pages = (total_pages >> 1) + (total_pages >> 2); + if (required_pages < BYTES_TO_PAGES (MIN_HEAP_SIZE)) + required_pages = BYTES_TO_PAGES (MIN_HEAP_SIZE); + else if (required_pages > BYTES_TO_PAGES (MAX_HEAP_SIZE)) diff --git a/0272-efi-use-enumerated-array-positions-for-our-allocatio.patch b/0272-efi-use-enumerated-array-positions-for-our-allocatio.patch new file mode 100644 index 00000000..206e3a63 --- /dev/null +++ b/0272-efi-use-enumerated-array-positions-for-our-allocatio.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 1 Aug 2022 14:06:30 -0400 +Subject: [PATCH] efi: use enumerated array positions for our allocation + choices + +In our kernel allocator on EFI systems, we currently have a growing +amount of code that references the various allocation policies by +position in the array, and of course maintenance of this code scales +very poorly. + +This patch changes them to be enumerated, so they're easier to refer to +farther along in the code without confusion. + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/efi/linux.c | 31 ++++++++++++++++++++----------- + 1 file changed, 20 insertions(+), 11 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 91ae274299..8daa070132 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -60,17 +60,26 @@ struct allocation_choice { + grub_efi_allocate_type_t alloc_type; + }; + +-static struct allocation_choice max_addresses[4] = ++enum { ++ KERNEL_PREF_ADDRESS, ++ KERNEL_4G_LIMIT, ++ KERNEL_NO_LIMIT, ++}; ++ ++static struct allocation_choice max_addresses[] = + { + /* the kernel overrides this one with pref_address and + * GRUB_EFI_ALLOCATE_ADDRESS */ +- { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ [KERNEL_PREF_ADDRESS] = ++ { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ /* If the flag in params is set, this one gets changed to be above 4GB. */ ++ [KERNEL_4G_LIMIT] = ++ { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + /* this one is always below 4GB, which we still *prefer* even if the flag + * is set. */ +- { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, +- /* If the flag in params is set, this one gets changed to be above 4GB. */ +- { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, +- { 0, 0 } ++ [KERNEL_NO_LIMIT] = ++ { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ { NO_MEM, 0, 0 } + }; + static struct allocation_choice saved_addresses[4]; + +@@ -405,7 +414,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + if (lh->xloadflags & LINUX_XLF_CAN_BE_LOADED_ABOVE_4G) + { + grub_dprintf ("linux", "Loading kernel above 4GB is supported; enabling.\n"); +- max_addresses[2].addr = GRUB_EFI_MAX_USABLE_ADDRESS; ++ max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_MAX_USABLE_ADDRESS; + } + else + { +@@ -478,11 +487,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_dprintf ("linux", "lh->pref_address: %p\n", (void *)(grub_addr_t)lh->pref_address); + if (lh->pref_address < (grub_uint64_t)GRUB_EFI_MAX_ALLOCATION_ADDRESS) + { +- max_addresses[0].addr = lh->pref_address; +- max_addresses[0].alloc_type = GRUB_EFI_ALLOCATE_ADDRESS; ++ max_addresses[KERNEL_PREF_ADDRESS].addr = lh->pref_address; ++ max_addresses[KERNEL_PREF_ADDRESS].alloc_type = GRUB_EFI_ALLOCATE_ADDRESS; + } +- max_addresses[1].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; +- max_addresses[2].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; ++ max_addresses[KERNEL_4G_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; ++ max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; + kernel_size = lh->init_size; + kernel_mem = kernel_alloc (kernel_size, GRUB_EFI_RUNTIME_SERVICES_CODE, + N_("can't allocate kernel")); diff --git a/0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch b/0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch new file mode 100644 index 00000000..d25cf306 --- /dev/null +++ b/0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch @@ -0,0 +1,127 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 1 Aug 2022 14:24:39 -0400 +Subject: [PATCH] efi: split allocation policy for kernel vs initrd memories. + +Currently in our kernel allocator, we use the same set of choices for +all of our various kernel and initramfs allocations, though they do not +have exactly the same constraints. + +This patch adds the concept of an allocation purpose, which currently +can be KERNEL_MEM or INITRD_MEM, and updates kernel_alloc() calls +appropriately, but does not change any current policy decision. It +also adds a few debug prints. + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/efi/linux.c | 35 +++++++++++++++++++++++++++-------- + 1 file changed, 27 insertions(+), 8 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 8daa070132..e6b8998e5e 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -55,7 +55,14 @@ struct grub_linuxefi_context { + + #define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12) + ++typedef enum { ++ NO_MEM, ++ KERNEL_MEM, ++ INITRD_MEM, ++} kernel_alloc_purpose_t; ++ + struct allocation_choice { ++ kernel_alloc_purpose_t purpose; + grub_efi_physical_address_t addr; + grub_efi_allocate_type_t alloc_type; + }; +@@ -64,6 +71,7 @@ enum { + KERNEL_PREF_ADDRESS, + KERNEL_4G_LIMIT, + KERNEL_NO_LIMIT, ++ INITRD_MAX_ADDRESS, + }; + + static struct allocation_choice max_addresses[] = +@@ -71,14 +79,17 @@ static struct allocation_choice max_addresses[] = + /* the kernel overrides this one with pref_address and + * GRUB_EFI_ALLOCATE_ADDRESS */ + [KERNEL_PREF_ADDRESS] = +- { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + /* If the flag in params is set, this one gets changed to be above 4GB. */ + [KERNEL_4G_LIMIT] = +- { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + /* this one is always below 4GB, which we still *prefer* even if the flag + * is set. */ + [KERNEL_NO_LIMIT] = +- { GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ /* this is for the initrd */ ++ [INITRD_MAX_ADDRESS] = ++ { INITRD_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + { NO_MEM, 0, 0 } + }; + static struct allocation_choice saved_addresses[4]; +@@ -95,7 +106,8 @@ kernel_free(void *addr, grub_efi_uintn_t size) + } + + static void * +-kernel_alloc(grub_efi_uintn_t size, ++kernel_alloc(kernel_alloc_purpose_t purpose, ++ grub_efi_uintn_t size, + grub_efi_memory_type_t memtype, + const char * const errmsg) + { +@@ -108,6 +120,9 @@ kernel_alloc(grub_efi_uintn_t size, + grub_uint64_t max = max_addresses[i].addr; + grub_efi_uintn_t pages; + ++ if (purpose != max_addresses[i].purpose) ++ continue; ++ + /* + * When we're *not* loading the kernel, or >4GB allocations aren't + * supported, these entries are basically all the same, so don't re-try +@@ -261,7 +276,8 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) + } + } + +- initrd_mem = kernel_alloc(size, GRUB_EFI_RUNTIME_SERVICES_DATA, ++ grub_dprintf ("linux", "Trying to allocate initrd mem\n"); ++ initrd_mem = kernel_alloc(INITRD_MEM, size, GRUB_EFI_RUNTIME_SERVICES_DATA, + N_("can't allocate initrd")); + if (initrd_mem == NULL) + goto fail; +@@ -422,7 +438,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } + #endif + +- params = kernel_alloc (sizeof(*params), GRUB_EFI_RUNTIME_SERVICES_DATA, ++ params = kernel_alloc (KERNEL_MEM, sizeof(*params), ++ GRUB_EFI_RUNTIME_SERVICES_DATA, + "cannot allocate kernel parameters"); + if (!params) + goto fail; +@@ -445,7 +462,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_dprintf ("linux", "new lh is at %p\n", lh); + + grub_dprintf ("linux", "setting up cmdline\n"); +- cmdline = kernel_alloc (lh->cmdline_size + 1, ++ cmdline = kernel_alloc (KERNEL_MEM, lh->cmdline_size + 1, + GRUB_EFI_RUNTIME_SERVICES_DATA, + N_("can't allocate cmdline")); + if (!cmdline) +@@ -493,7 +510,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + max_addresses[KERNEL_4G_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; + max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; + kernel_size = lh->init_size; +- kernel_mem = kernel_alloc (kernel_size, GRUB_EFI_RUNTIME_SERVICES_CODE, ++ grub_dprintf ("linux", "Trying to allocate kernel mem\n"); ++ kernel_mem = kernel_alloc (KERNEL_MEM, kernel_size, ++ GRUB_EFI_RUNTIME_SERVICES_CODE, + N_("can't allocate kernel")); + restore_addresses(); + if (!kernel_mem) diff --git a/grub.patches b/grub.patches index ff3d92fd..fa23f7f2 100644 --- a/grub.patches +++ b/grub.patches @@ -267,3 +267,7 @@ Patch0266: 0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch Patch0267: 0267-grub-probe-document-the-behavior-of-multiple-v.patch Patch0268: 0268-grub_fs_probe-dprint-errors-from-filesystems.patch Patch0269: 0269-fs-fat-don-t-error-when-mtime-is-0.patch +Patch0270: 0270-Make-debug-file-show-which-file-filters-get-run.patch +Patch0271: 0271-efi-make-the-default-arena-most-of-ram.patch +Patch0272: 0272-efi-use-enumerated-array-positions-for-our-allocatio.patch +Patch0273: 0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch diff --git a/grub2.spec b/grub2.spec index 8456134d..9da7c452 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 43%{?dist} +Release: 44%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Aug 01 2022 Robbie Harwood - 2.06-44 +- Some allocator fixes for kernel + * Tue Jul 19 2022 Robbie Harwood - 2.06-43 - Handle FAT mtime of 0 - Resolves: #2096192 From 74d57bbd19ddad890b86943c7c5db067fa24e643 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 2 Aug 2022 14:39:11 +0000 Subject: [PATCH 135/294] Rest of allocator fixes Signed-off-by: Robbie Harwood --- ...-initrd-within-the-bounds-expressed-.patch | 57 +++++++++++++++++ ...ER_-CODE-DATA-for-kernel-and-initrd-.patch | 61 +++++++++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch create mode 100644 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch diff --git a/0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch b/0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch new file mode 100644 index 00000000..47e31e2f --- /dev/null +++ b/0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 1 Aug 2022 14:07:50 -0400 +Subject: [PATCH] efi: allocate the initrd within the bounds expressed by the + kernel + +Currently on x86, only linux kernels built with CONFIG_RELOCATABLE for +x86_64 can be loaded above 4G, but the maximum address for the initramfs +is specified via a HdrS field. This allows us to utilize that value, +and unless loading the kernel above 4G, uses the value present there. +If loading kernel above 4G is allowed, we assume loading the initramfs +above 4G also works; in practice this has been true in the kernel code +for quite some time. + +Resolves: rhbz#2112134 + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/efi/linux.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index e6b8998e5e..d003b474ee 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -190,6 +190,8 @@ grub_linuxefi_unload (void *data) + cmd_initrdefi->data = 0; + grub_free (context); + ++ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; ++ + return GRUB_ERR_NONE; + } + +@@ -426,11 +428,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + } + #endif + ++ max_addresses[INITRD_MAX_ADDRESS].addr = lh->initrd_addr_max; + #if defined(__x86_64__) + if (lh->xloadflags & LINUX_XLF_CAN_BE_LOADED_ABOVE_4G) + { + grub_dprintf ("linux", "Loading kernel above 4GB is supported; enabling.\n"); + max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_MAX_USABLE_ADDRESS; ++ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_USABLE_ADDRESS; + } + else + { +@@ -560,6 +564,8 @@ fail: + + grub_dl_unref (my_mod); + ++ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; ++ + if (lh) + kernel_free (cmdline, lh->cmdline_size + 1); + diff --git a/0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch b/0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch new file mode 100644 index 00000000..8451dbfc --- /dev/null +++ b/0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 1 Aug 2022 13:04:43 -0400 +Subject: [PATCH] efi: use EFI_LOADER_(CODE|DATA) for kernel and initrd + allocations + +At some point due to an erroneous kernel warning, we switched kernel and +initramfs to being loaded in EFI_RUNTIME_SERVICES_CODE and +EFI_RUNTIME_SERVICES_DATA memory pools. This doesn't appear to be +correct according to the spec, and that kernel warning has gone away. + +This patch puts them back in EFI_LOADER_CODE and EFI_LOADER_DATA +allocations, respectively. + +Resolves: rhbz#2108456 + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/efi/linux.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index d003b474ee..ac5ef50bdb 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -279,7 +279,7 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) + } + + grub_dprintf ("linux", "Trying to allocate initrd mem\n"); +- initrd_mem = kernel_alloc(INITRD_MEM, size, GRUB_EFI_RUNTIME_SERVICES_DATA, ++ initrd_mem = kernel_alloc(INITRD_MEM, size, GRUB_EFI_LOADER_DATA, + N_("can't allocate initrd")); + if (initrd_mem == NULL) + goto fail; +@@ -443,7 +443,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + #endif + + params = kernel_alloc (KERNEL_MEM, sizeof(*params), +- GRUB_EFI_RUNTIME_SERVICES_DATA, ++ GRUB_EFI_LOADER_DATA, + "cannot allocate kernel parameters"); + if (!params) + goto fail; +@@ -467,7 +467,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + grub_dprintf ("linux", "setting up cmdline\n"); + cmdline = kernel_alloc (KERNEL_MEM, lh->cmdline_size + 1, +- GRUB_EFI_RUNTIME_SERVICES_DATA, ++ GRUB_EFI_LOADER_DATA, + N_("can't allocate cmdline")); + if (!cmdline) + goto fail; +@@ -516,7 +516,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + kernel_size = lh->init_size; + grub_dprintf ("linux", "Trying to allocate kernel mem\n"); + kernel_mem = kernel_alloc (KERNEL_MEM, kernel_size, +- GRUB_EFI_RUNTIME_SERVICES_CODE, ++ GRUB_EFI_LOADER_CODE, + N_("can't allocate kernel")); + restore_addresses(); + if (!kernel_mem) diff --git a/grub.patches b/grub.patches index fa23f7f2..9caa186c 100644 --- a/grub.patches +++ b/grub.patches @@ -271,3 +271,5 @@ Patch0270: 0270-Make-debug-file-show-which-file-filters-get-run.patch Patch0271: 0271-efi-make-the-default-arena-most-of-ram.patch Patch0272: 0272-efi-use-enumerated-array-positions-for-our-allocatio.patch Patch0273: 0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch +Patch0274: 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch +Patch0275: 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch diff --git a/grub2.spec b/grub2.spec index 9da7c452..3caa84c0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 44%{?dist} +Release: 45%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Aug 02 2022 Robbie Harwood - 2.06-45 +- Rest of allocator fixes + * Mon Aug 01 2022 Robbie Harwood - 2.06-44 - Some allocator fixes for kernel From 11e6d3f1b04dd35cb22eda7b6dc704c881c4af18 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 2 Aug 2022 19:57:27 +0000 Subject: [PATCH 136/294] Populate /etc/kernel/cmdline during mkconfig Signed-off-by: Robbie Harwood --- ...e-etc-kernel-cmdline-during-mkconfig.patch | 27 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 7 +++-- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch diff --git a/0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch b/0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch new file mode 100644 index 00000000..7080b6f6 --- /dev/null +++ b/0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Tue, 2 Aug 2022 15:56:28 -0400 +Subject: [PATCH] BLS: create /etc/kernel/cmdline during mkconfig + +Signed-off-by: Robbie Harwood +--- + util/grub.d/10_linux.in | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 6af84b44e1..950a92f5e8 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -161,6 +161,12 @@ update_bls_cmdline() + local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + local -a files=($(get_sorted_bls)) + ++ if [[ ! -f /etc/kernel/cmdline ]]; then ++ # anaconda has the correct information to do this during install; ++ # afterward, grubby will take care of syncing on updates. ++ echo "$cmdline rhgb quiet" > /etc/kernel/cmdline ++ fi ++ + for bls in "${files[@]}"; do + local options="${cmdline}" + if [ -z "${bls##*debug*}" ]; then diff --git a/grub.patches b/grub.patches index 9caa186c..4a39c3a4 100644 --- a/grub.patches +++ b/grub.patches @@ -273,3 +273,4 @@ Patch0272: 0272-efi-use-enumerated-array-positions-for-our-allocatio.patch Patch0273: 0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch Patch0274: 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch Patch0275: 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch +Patch0276: 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch diff --git a/grub2.spec b/grub2.spec index 3caa84c0..e8553cfd 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 45%{?dist} +Release: 46%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,7 +530,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog -* Mon Aug 02 2022 Robbie Harwood - 2.06-45 +* Tue Aug 02 2022 Robbie Harwood - 2.06-46 +- Populate /etc/kernel/cmdline during mkconfig + +* Tue Aug 02 2022 Robbie Harwood - 2.06-45 - Rest of allocator fixes * Mon Aug 01 2022 Robbie Harwood - 2.06-44 From ac27fd45d7a7c718dea64db8ec5e0d9626dda55c Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 8 Aug 2022 16:32:19 +0000 Subject: [PATCH 137/294] Try reserving less RAM to fix windows booting Related: #2115202 Signed-off-by: Robbie Harwood --- 0277-Try-reserving-less-ram.patch | 34 +++++++++++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 0277-Try-reserving-less-ram.patch diff --git a/0277-Try-reserving-less-ram.patch b/0277-Try-reserving-less-ram.patch new file mode 100644 index 00000000..46fb871f --- /dev/null +++ b/0277-Try-reserving-less-ram.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Aug 2022 11:23:59 -0400 +Subject: [PATCH] Try reserving less ram... + +In 005a0aaaad2a00a1fa1e60d94cc4fd5407c22e7d, we switched from reserving +one quarter of the available free memory to three quarters. Apparently +this has some unfortunate side-affects for some workloads, and has +negatively effected chainloading[0] as well as Fedora CoreOS[1]. + +This patch changes it to reserve /half/ of available memory, in hopes +that this is a working compromise. + +[0] https://bugzilla.redhat.com/show_bug.cgi?id=2115202 +[1] https://github.com/coreos/fedora-coreos-tracker/issues/1271 + +Signed-off-by: Peter Jones +--- + grub-core/kern/efi/mm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index 150e412ee7..b4e012f5e7 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -740,7 +740,7 @@ grub_efi_mm_init (void) + /* By default, request three quarters of the available memory. */ + total_pages = get_total_pages (filtered_memory_map, desc_size, + filtered_memory_map_end); +- required_pages = (total_pages >> 1) + (total_pages >> 2); ++ required_pages = (total_pages >> 1); + if (required_pages < BYTES_TO_PAGES (MIN_HEAP_SIZE)) + required_pages = BYTES_TO_PAGES (MIN_HEAP_SIZE); + else if (required_pages > BYTES_TO_PAGES (MAX_HEAP_SIZE)) diff --git a/grub.patches b/grub.patches index 4a39c3a4..58ef3588 100644 --- a/grub.patches +++ b/grub.patches @@ -274,3 +274,4 @@ Patch0273: 0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch Patch0274: 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch Patch0275: 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch Patch0276: 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +Patch0277: 0277-Try-reserving-less-ram.patch diff --git a/grub2.spec b/grub2.spec index e8553cfd..1d6a5fdf 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 46%{?dist} +Release: 47%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Aug 08 2022 Robbie Harwood - 2.06-47 +- Try reserving less RAM to fix windows booting +- Related: #2115202 + * Tue Aug 02 2022 Robbie Harwood - 2.06-46 - Populate /etc/kernel/cmdline during mkconfig From 867b41f7d30ed05869a5b74357feae9bb0015852 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 15 Aug 2022 20:21:32 +0000 Subject: [PATCH 138/294] Use --with-rpm-version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: #2118390 Suggested-by: François Rigault Signed-off-by: Robbie Harwood --- grub.macros | 1 + grub2.spec | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/grub.macros b/grub.macros index d967035e..2b2ce2d4 100644 --- a/grub.macros +++ b/grub.macros @@ -347,6 +347,7 @@ rm -r build-aux m4 \ TARGET_CFLAGS="%{2}" \\\ TARGET_CPPFLAGS="-I$(pwd)" \\\ TARGET_LDFLAGS="%{efi_target_ldflags}" \\\ + --with-rpm-version=%{version}-%{release} \\\ --with-platform=efi \\\ --with-utils=host \\\ --target=%{1} \\\ diff --git a/grub2.spec b/grub2.spec index 1d6a5fdf..a9a9231f 100644 --- a/grub2.spec +++ b/grub2.spec @@ -530,6 +530,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Aug 15 2022 Robbie Harwood - 2.06-48 +- Use --with-rpm-version +- Resolves: #2118390 + * Mon Aug 08 2022 Robbie Harwood - 2.06-47 - Try reserving less RAM to fix windows booting - Related: #2115202 From 89d7a298b6d9f4a507f2a44073950a1a786ea21a Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 15 Aug 2022 20:50:19 +0000 Subject: [PATCH 139/294] Skip rpm mtime verification on likely-vfat filesystems Signed-off-by: Robbie Harwood --- grub.macros | 8 ++++---- grub2.spec | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/grub.macros b/grub.macros index 2b2ce2d4..2ab40944 100644 --- a/grub.macros +++ b/grub.macros @@ -615,14 +615,14 @@ ln -s ../boot/grub2/grub.cfg \\\ %defattr(-,root,root,-) \ %config(noreplace) %{_sysconfdir}/grub2.cfg \ %config(noreplace) %{_sysconfdir}/grub2-efi.cfg \ -%attr(0700,root,root)%{efi_esp_dir}/%{2} \ +%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{2} \ %ifarch %{arm} \ -%attr(0700,root,root)%{efi_esp_boot}/BOOTARM.EFI \ +%attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \ %endif \ %attr(0700,root,root)/boot/grub2/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \ -%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ +%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ @@ -640,6 +640,6 @@ ln -s ../boot/grub2/grub.cfg \\\ \ %{expand:%%files %{1}-cdboot} \ %defattr(-,root,root,-) \ -%attr(0700,root,root)%{efi_esp_dir}/%{3} \ +%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \ %attr(0700,root,root)/boot/grub2/fonts \ %{nil} diff --git a/grub2.spec b/grub2.spec index a9a9231f..484da561 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 47%{?dist} +Release: 48%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Aug 15 2022 Robbie Harwood - 2.06-49 +- Skip rpm mtime verification on likely-vfat filesystems + * Mon Aug 15 2022 Robbie Harwood - 2.06-48 - Use --with-rpm-version - Resolves: #2118390 From 2f39adbb146a382ec6f894e037dcab5783cbfcf5 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 16 Aug 2022 15:25:07 -0400 Subject: [PATCH 140/294] Fix nvr mismatch Signed-off-by: Robbie Harwood --- grub2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 484da561..805648a3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 48%{?dist} +Release: 49%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ From fc76aed5333f56dd05400521a35b944a5df52ebc Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 17 Aug 2022 15:03:25 +0000 Subject: [PATCH 141/294] Fix duplicated args and cope with /etc/default/grub modification Signed-off-by: Robbie Harwood --- ...sh-don-t-dup-rhgb-quiet-check-mtimes.patch | 35 +++++++++++++++++++ 20-grub.install | 4 +++ grub.patches | 1 + grub2.spec | 5 ++- 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch diff --git a/0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch b/0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch new file mode 100644 index 00000000..013b915e --- /dev/null +++ b/0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 17 Aug 2022 10:26:07 -0400 +Subject: [PATCH] squish: don't dup rhgb quiet, check mtimes + +Signed-off-by: Robbie Harwood +--- + util/grub.d/10_linux.in | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 950a92f5e8..03f091a4dc 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -161,10 +161,16 @@ update_bls_cmdline() + local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + local -a files=($(get_sorted_bls)) + +- if [[ ! -f /etc/kernel/cmdline ]]; then +- # anaconda has the correct information to do this during install; +- # afterward, grubby will take care of syncing on updates. +- echo "$cmdline rhgb quiet" > /etc/kernel/cmdline ++ if [[ ! -f /etc/kernel/cmdline ]] || ++ [[ /etc/kernel/cmdline -ot /etc/default/grub ]]; then ++ # anaconda has the correct information to create this during install; ++ # afterward, grubby will take care of syncing on updates. If the user ++ # has modified /etc/default/grub, try to cope. ++ if [[ ! "$cmdline" =~ "rhgb quiet" ]]; then ++ # ensure these only show up once ++ cmdline="$cmdline rhgb quiet" ++ fi ++ echo "$cmdline" > /etc/kernel/cmdline + fi + + for bls in "${files[@]}"; do diff --git a/20-grub.install b/20-grub.install index 2a0ac323..bc55a14b 100755 --- a/20-grub.install +++ b/20-grub.install @@ -87,6 +87,10 @@ case "$COMMAND" in if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then if [[ -f /etc/kernel/cmdline ]]; then + if [[ /etc/kernel/cmdline -ot /etc/default/grub ]]; then + # user modified /etc/default/grub manually; sync + grub2-mkconfig -o /etc/grub2.cfg + fi read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline elif [[ -f /usr/lib/kernel/cmdline ]]; then read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline diff --git a/grub.patches b/grub.patches index 58ef3588..4edcd529 100644 --- a/grub.patches +++ b/grub.patches @@ -275,3 +275,4 @@ Patch0274: 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch Patch0275: 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch Patch0276: 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch Patch0277: 0277-Try-reserving-less-ram.patch +Patch0278: 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch diff --git a/grub2.spec b/grub2.spec index 805648a3..f3bd0e83 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 49%{?dist} +Release: 50%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Aug 17 2022 Robbie Harwood - 2.06-50 +- Fix duplicated args and cope with /etc/default/grub modification + * Mon Aug 15 2022 Robbie Harwood - 2.06-49 - Skip rpm mtime verification on likely-vfat filesystems From bb8ac90efb64b265620cfc51c68a883d26bac524 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 17 Aug 2022 15:31:34 +0000 Subject: [PATCH 142/294] Give up on rhgb quiet Signed-off-by: Robbie Harwood --- 0279-squish-give-up-on-rhgb-quiet.patch | 25 +++++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 0279-squish-give-up-on-rhgb-quiet.patch diff --git a/0279-squish-give-up-on-rhgb-quiet.patch b/0279-squish-give-up-on-rhgb-quiet.patch new file mode 100644 index 00000000..bbead5e9 --- /dev/null +++ b/0279-squish-give-up-on-rhgb-quiet.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 17 Aug 2022 11:30:30 -0400 +Subject: [PATCH] squish: give up on rhgb quiet + +Signed-off-by: Robbie Harwood +--- + util/grub.d/10_linux.in | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 03f091a4dc..5ad624bfec 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -166,10 +166,6 @@ update_bls_cmdline() + # anaconda has the correct information to create this during install; + # afterward, grubby will take care of syncing on updates. If the user + # has modified /etc/default/grub, try to cope. +- if [[ ! "$cmdline" =~ "rhgb quiet" ]]; then +- # ensure these only show up once +- cmdline="$cmdline rhgb quiet" +- fi + echo "$cmdline" > /etc/kernel/cmdline + fi + diff --git a/grub.patches b/grub.patches index 4edcd529..3829ee89 100644 --- a/grub.patches +++ b/grub.patches @@ -276,3 +276,4 @@ Patch0275: 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch Patch0276: 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch Patch0277: 0277-Try-reserving-less-ram.patch Patch0278: 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +Patch0279: 0279-squish-give-up-on-rhgb-quiet.patch diff --git a/grub2.spec b/grub2.spec index f3bd0e83..9aa085ba 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 50%{?dist} +Release: 51%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Aug 17 2022 Robbie Harwood - 2.06-51 +- Give up on rhgb quiet + * Wed Aug 17 2022 Robbie Harwood - 2.06-50 - Fix duplicated args and cope with /etc/default/grub modification From 714559fb3d582fb52bfde8589803ee6094857edd Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 17 Aug 2022 16:09:22 +0000 Subject: [PATCH 143/294] Handle ostree's non-writable /etc/kernel Signed-off-by: Robbie Harwood --- ...write-etc-kernel-cmdline-if-writable.patch | 57 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch diff --git a/0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch b/0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch new file mode 100644 index 00000000..ed378b89 --- /dev/null +++ b/0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonathan Lebon +Date: Wed, 17 Aug 2022 10:26:03 -0400 +Subject: [PATCH] squish: BLS: only write /etc/kernel/cmdline if writable + +On OSTree systems, `grub2-mkconfig` is run with `/etc` mounted read-only +because as part of the promise of transactional updates, we want to make +sure that we're not modifying the current deployment's state (`/etc` or +`/var`). + +This conflicts with 0837dcdf1 ("BLS: create /etc/kernel/cmdline during +mkconfig") which wants to write to `/etc/kernel/cmdline`. I'm not +exactly sure on the background there, but based on the comment I think +the intent is to fulfill grubby's expectation that the file exists. + +However, in systems like Silverblue, kernel arguments are managed by the +rpm-ostree stack and grubby is not shipped at all. + +Adjust the script slightly so that we only write `/etc/kernel/cmdline` +if the parent directory is writable. + +In the future, we're hoping to simplify things further on rpm-ostree +systems by not running `grub2-mkconfig` at all since libostree already +directly writes BLS entries. Doing that would also have avoided this, +but ratcheting it into existing systems needs more careful thought. + +Signed-off-by: Jonathan Lebon + +Fixes: https://github.com/fedora-silverblue/issue-tracker/issues/322 +--- + util/grub.d/10_linux.in | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 5ad624bfec..e5e87a6d80 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -161,12 +161,13 @@ update_bls_cmdline() + local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + local -a files=($(get_sorted_bls)) + +- if [[ ! -f /etc/kernel/cmdline ]] || +- [[ /etc/kernel/cmdline -ot /etc/default/grub ]]; then +- # anaconda has the correct information to create this during install; +- # afterward, grubby will take care of syncing on updates. If the user +- # has modified /etc/default/grub, try to cope. +- echo "$cmdline" > /etc/kernel/cmdline ++ if [ -w /etc/kernel ] && ++ [[ ! -f /etc/kernel/cmdline || ++ /etc/kernel/cmdline -ot /etc/default/grub ]]; then ++ # anaconda has the correct information to create this during install; ++ # afterward, grubby will take care of syncing on updates. If the user ++ # has modified /etc/default/grub, try to cope. ++ echo "$cmdline" > /etc/kernel/cmdline + fi + + for bls in "${files[@]}"; do diff --git a/grub.patches b/grub.patches index 3829ee89..b0acec4a 100644 --- a/grub.patches +++ b/grub.patches @@ -277,3 +277,4 @@ Patch0276: 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch Patch0277: 0277-Try-reserving-less-ram.patch Patch0278: 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch Patch0279: 0279-squish-give-up-on-rhgb-quiet.patch +Patch0280: 0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch diff --git a/grub2.spec b/grub2.spec index 9aa085ba..b9e4543a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 51%{?dist} +Release: 52%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Aug 17 2022 Robbie Harwood - 2.06-52 +- Handle ostree's non-writable /etc/kernel + * Wed Aug 17 2022 Robbie Harwood - 2.06-51 - Give up on rhgb quiet From c814f068c6e6768abd11ac5bac8fa4f5e698df86 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 25 Aug 2022 15:40:30 +0000 Subject: [PATCH 144/294] ieee1275: implement vec5 for cas negotiation Signed-off-by: Robbie Harwood --- ...5-implement-vec5-for-cas-negotiation.patch | 70 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 0281-ieee1275-implement-vec5-for-cas-negotiation.patch diff --git a/0281-ieee1275-implement-vec5-for-cas-negotiation.patch b/0281-ieee1275-implement-vec5-for-cas-negotiation.patch new file mode 100644 index 00000000..2749d10c --- /dev/null +++ b/0281-ieee1275-implement-vec5-for-cas-negotiation.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Diego Domingos +Date: Thu, 25 Aug 2022 11:37:56 -0400 +Subject: [PATCH] ieee1275: implement vec5 for cas negotiation + +As a legacy support, if the vector 5 is not implemented, Power +Hypervisor will consider the max CPUs as 64 instead 256 currently +supported during client-architecture-support negotiation. + +This patch implements the vector 5 and set the MAX CPUs to 256 while +setting the others values to 0 (default). + +Signed-off-by: Diego Domingos +Signed-off-by: Robbie Harwood +--- + grub-core/kern/ieee1275/init.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index ef55107467..6a51c9efab 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -311,6 +311,18 @@ struct option_vector2 { + grub_uint8_t max_pft_size; + } __attribute__((packed)); + ++struct option_vector5 { ++ grub_uint8_t byte1; ++ grub_uint8_t byte2; ++ grub_uint8_t byte3; ++ grub_uint8_t cmo; ++ grub_uint8_t associativity; ++ grub_uint8_t bin_opts; ++ grub_uint8_t micro_checkpoint; ++ grub_uint8_t reserved0; ++ grub_uint32_t max_cpus; ++} __attribute__((packed)); ++ + struct pvr_entry { + grub_uint32_t mask; + grub_uint32_t entry; +@@ -329,6 +341,8 @@ struct cas_vector { + grub_uint16_t vec3; + grub_uint8_t vec4_size; + grub_uint16_t vec4; ++ grub_uint8_t vec5_size; ++ struct option_vector5 vec5; + } __attribute__((packed)); + + /* Call ibm,client-architecture-support to try to get more RMA. +@@ -349,7 +363,7 @@ grub_ieee1275_ibm_cas (void) + } args; + struct cas_vector vector = { + .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ +- .num_vecs = 4 - 1, ++ .num_vecs = 5 - 1, + .vec1_size = 0, + .vec1 = 0x80, /* ignore */ + .vec2_size = 1 + sizeof(struct option_vector2) - 2, +@@ -360,6 +374,10 @@ grub_ieee1275_ibm_cas (void) + .vec3 = 0x00e0, // ask for FP + VMX + DFP but don't halt if unsatisfied + .vec4_size = 2 - 1, + .vec4 = 0x0001, // set required minimum capacity % to the lowest value ++ .vec5_size = 1 + sizeof(struct option_vector5) - 2, ++ .vec5 = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 256 ++ } + }; + + INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); diff --git a/grub.patches b/grub.patches index b0acec4a..0b0f88a9 100644 --- a/grub.patches +++ b/grub.patches @@ -278,3 +278,4 @@ Patch0277: 0277-Try-reserving-less-ram.patch Patch0278: 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch Patch0279: 0279-squish-give-up-on-rhgb-quiet.patch Patch0280: 0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +Patch0281: 0281-ieee1275-implement-vec5-for-cas-negotiation.patch diff --git a/grub2.spec b/grub2.spec index b9e4543a..67040851 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 52%{?dist} +Release: 53%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Aug 25 2022 Robbie Harwood - 2.06-53 +- ieee1275: implement vec5 for cas negotiation + * Wed Aug 17 2022 Robbie Harwood - 2.06-52 - Handle ostree's non-writable /etc/kernel From d8336270fe958f9a96e1af8639836ed00d9423d4 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 25 Aug 2022 18:19:28 +0000 Subject: [PATCH 145/294] gettext to gettext-runtime migration from Jens Signed-off-by: Robbie Harwood --- grub2.spec | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/grub2.spec b/grub2.spec index 67040851..234ec8d6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 53%{?dist} +Release: 54%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -96,7 +96,7 @@ subpackages. Summary: Support tools for GRUB. Obsoletes: grub2-tools < %{evr} Requires: grub2-common = %{epoch}:%{version}-%{release} -Requires: gettext os-prober file +Requires: gettext-runtime os-prober file Requires(pre): dracut Requires(pre): grep Requires(pre): sed @@ -108,7 +108,7 @@ This subpackage provides tools for support of all platforms. %ifarch x86_64 %package tools-efi Summary: Support tools for GRUB. -Requires: gettext os-prober file +Requires: gettext-runtime os-prober file Requires: grub2-common = %{epoch}:%{version}-%{release} Obsoletes: grub2-tools < %{evr} @@ -119,7 +119,7 @@ This subpackage provides tools for support of EFI platforms. %package tools-minimal Summary: Support tools for GRUB. -Requires: gettext +Requires: gettext-runtime Requires: grub2-common = %{epoch}:%{version}-%{release} Obsoletes: grub2-tools < %{evr} @@ -129,7 +129,7 @@ This subpackage provides tools for support of all platforms. %package tools-extra Summary: Support tools for GRUB. -Requires: gettext os-prober file +Requires: gettext-runtime os-prober file Requires: grub2-tools-minimal = %{epoch}:%{version}-%{release} Requires: grub2-common = %{epoch}:%{version}-%{release} Requires: mtools @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Aug 25 2022 Robbie Harwood - 2.06-54 +- gettext to gettext-runtime migration from Jens + * Thu Aug 25 2022 Robbie Harwood - 2.06-53 - ieee1275: implement vec5 for cas negotiation From 82f5820dd4d745be76a2a59a7e95897b71d591d8 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 25 Aug 2022 21:59:45 +0000 Subject: [PATCH 146/294] Fix root definition for blscfg in emu Signed-off-by: Robbie Harwood --- ...scfg-Don-t-root-device-in-emu-builds.patch | 27 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 0282-blscfg-Don-t-root-device-in-emu-builds.patch diff --git a/0282-blscfg-Don-t-root-device-in-emu-builds.patch b/0282-blscfg-Don-t-root-device-in-emu-builds.patch new file mode 100644 index 00000000..3fe8baf2 --- /dev/null +++ b/0282-blscfg-Don-t-root-device-in-emu-builds.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Thu, 25 Aug 2022 17:57:55 -0400 +Subject: [PATCH] blscfg: Don't root device in emu builds + +Otherwise, we end up looking for kernel/initrd in /boot/boot which +doesn't work at all. Non-emu builds need to be looking in +($root)/boot/, which is what this is for. + +Signed-off-by: Robbie Harwood +--- + grub-core/commands/blscfg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index e907a6a5d2..dbd0899acf 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -41,7 +41,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + #define GRUB_BLS_CONFIG_PATH "/loader/entries/" + #ifdef GRUB_MACHINE_EMU +-#define GRUB_BOOT_DEVICE "/boot" ++#define GRUB_BOOT_DEVICE "" + #else + #define GRUB_BOOT_DEVICE "($root)" + #endif diff --git a/grub.patches b/grub.patches index 0b0f88a9..1156a0ee 100644 --- a/grub.patches +++ b/grub.patches @@ -279,3 +279,4 @@ Patch0278: 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch Patch0279: 0279-squish-give-up-on-rhgb-quiet.patch Patch0280: 0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch Patch0281: 0281-ieee1275-implement-vec5-for-cas-negotiation.patch +Patch0282: 0282-blscfg-Don-t-root-device-in-emu-builds.patch diff --git a/grub2.spec b/grub2.spec index 234ec8d6..36ae7245 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 54%{?dist} +Release: 55%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Aug 25 2022 Robbie Harwood - 2.06-55 +- Fix root definition for blscfg in emu + * Thu Aug 25 2022 Robbie Harwood - 2.06-54 - gettext to gettext-runtime migration from Jens From 2fa153d5c6a7974a73b151266625c17641b8af77 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 30 Aug 2022 11:00:13 -0400 Subject: [PATCH 147/294] Fix const-ness in file filters patch Signed-off-by: Robbie Harwood --- 0270-Make-debug-file-show-which-file-filters-get-run.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/0270-Make-debug-file-show-which-file-filters-get-run.patch b/0270-Make-debug-file-show-which-file-filters-get-run.patch index 12062a31..4ac32cb4 100644 --- a/0270-Make-debug-file-show-which-file-filters-get-run.patch +++ b/0270-Make-debug-file-show-which-file-filters-get-run.patch @@ -15,14 +15,14 @@ Signed-off-by: Peter Jones 1 file changed, 11 insertions(+) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index ed69fc0f0f..3f175630ea 100644 +index ed69fc0f0f..20a4c839aa 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -30,6 +30,14 @@ void (*EXPORT_VAR (grub_grubnet_fini)) (void); grub_file_filter_t grub_file_filters[GRUB_FILE_FILTER_MAX]; -+static char *filter_names[] = { ++static const char *filter_names[] = { + [GRUB_FILE_FILTER_VERIFY] = "GRUB_FILE_FILTER_VERIFY", + [GRUB_FILE_FILTER_GZIO] = "GRUB_FILE_FILTER_GZIO", + [GRUB_FILE_FILTER_XZIO] = "GRUB_FILE_FILTER_XZIO", From db229abffb31abbd845434b0003bccb18d5d60d3 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 7 Sep 2022 23:51:40 +0000 Subject: [PATCH 148/294] Revert patches to claim more memory for the arena Signed-off-by: Robbie Harwood --- ...i-make-the-default-arena-most-of-ram.patch | 73 ------------------- ...ed-array-positions-for-our-allocatio.patch | 0 ...tion-policy-for-kernel-vs-initrd-mem.patch | 0 ...-initrd-within-the-bounds-expressed-.patch | 0 ...ER_-CODE-DATA-for-kernel-and-initrd-.patch | 0 ...e-etc-kernel-cmdline-during-mkconfig.patch | 0 ...sh-don-t-dup-rhgb-quiet-check-mtimes.patch | 0 0277-Try-reserving-less-ram.patch | 34 --------- ...=> 0277-squish-give-up-on-rhgb-quiet.patch | 0 ...write-etc-kernel-cmdline-if-writable.patch | 0 ...5-implement-vec5-for-cas-negotiation.patch | 0 ...scfg-Don-t-root-device-in-emu-builds.patch | 0 grub.patches | 22 +++--- grub2.spec | 5 +- 14 files changed, 14 insertions(+), 120 deletions(-) delete mode 100644 0271-efi-make-the-default-arena-most-of-ram.patch rename 0272-efi-use-enumerated-array-positions-for-our-allocatio.patch => 0271-efi-use-enumerated-array-positions-for-our-allocatio.patch (100%) rename 0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch => 0272-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch (100%) rename 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch => 0273-efi-allocate-the-initrd-within-the-bounds-expressed-.patch (100%) rename 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch => 0274-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch (100%) rename 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch => 0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch (100%) rename 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch => 0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch (100%) delete mode 100644 0277-Try-reserving-less-ram.patch rename 0279-squish-give-up-on-rhgb-quiet.patch => 0277-squish-give-up-on-rhgb-quiet.patch (100%) rename 0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch => 0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch (100%) rename 0281-ieee1275-implement-vec5-for-cas-negotiation.patch => 0279-ieee1275-implement-vec5-for-cas-negotiation.patch (100%) rename 0282-blscfg-Don-t-root-device-in-emu-builds.patch => 0280-blscfg-Don-t-root-device-in-emu-builds.patch (100%) diff --git a/0271-efi-make-the-default-arena-most-of-ram.patch b/0271-efi-make-the-default-arena-most-of-ram.patch deleted file mode 100644 index 49143703..00000000 --- a/0271-efi-make-the-default-arena-most-of-ram.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 29 Jul 2022 15:57:57 -0400 -Subject: [PATCH] efi: make the default arena most of ram - -Currently when populating the initial memory arena on EFI systems, we -count the available regions below GRUB_EFI_MAX_ALLOCATION_ADDRESS from -the EFI memory map and then allocates one quarter of that for our arena. - -Because many systems come up without IOMMUs, we currently set -GRUB_EFI_MAX_ALLOCATION_ADDRESS to 0x7fffffff, i.e. all addresses -allocated must be below 2G[0]. Due to firmware and other -considerations, this makes the most memory we can possibly have in our -arena 512M. - -Because our EFI loader doesn't get kernel and initrd memory from grub's -allocator, but rather reserves it directly from UEFI and then simply -marks those as allocated if they're within grub's arena, it was -historically possible to have initrds that are larger than 512M, because -we could use any memory region below 4G, without concern for grub's -choice of arena size. - -Unfortunately, when we switched to using the "verifiers" API (and thus -the file_filter_t API) to do measurement of kernel and initrd, this -introduced a pattern that allocates the entire file when we call -grub_file_open(), and buffers it to pass to the filter. This results in -needing to have enough space for the initramfs in the grub arena. - -This is bad. - -Since it's unlikely you're going to do anything *other* than loading a -kernel and initramfs that takes much of the available free memory from -UEFI, this patch introduces a workaround by changing the amount we give -to the arena be three quarters of the available memory, rather than one -quarter, thus changing our theoretical initrd limit to 1.5G. In -practice, it may still be smaller than that depending on allocation -fragmentation, but generally it will be most of it. - -Note that this doesn't fix the underlying flaw, which is that there is -no safe way to do the validation correctly using the "verifiers" system -with the current file API without buffering the whole file before -grub_file_read() is ever called, and thus you can't set an allocation -policy for the initial buffer of the file at all, so unless we raise the -allocation limit to >4G, it can't be allocated in the big region. - -[0] I'm not sure there was a good reason not to pick 4G, but even if we - had, at least one common firmware routes the first 2G of physical - RAM to 0x0, and any additional memory starting at 0x100000000. - -Related: rhbz#2112134 - -Signed-off-by: Peter Jones ---- - grub-core/kern/efi/mm.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index e460b072e6..150e412ee7 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -737,10 +737,10 @@ grub_efi_mm_init (void) - filtered_memory_map_end = filter_memory_map (memory_map, filtered_memory_map, - desc_size, memory_map_end); - -- /* By default, request a quarter of the available memory. */ -+ /* By default, request three quarters of the available memory. */ - total_pages = get_total_pages (filtered_memory_map, desc_size, - filtered_memory_map_end); -- required_pages = (total_pages >> 2); -+ required_pages = (total_pages >> 1) + (total_pages >> 2); - if (required_pages < BYTES_TO_PAGES (MIN_HEAP_SIZE)) - required_pages = BYTES_TO_PAGES (MIN_HEAP_SIZE); - else if (required_pages > BYTES_TO_PAGES (MAX_HEAP_SIZE)) diff --git a/0272-efi-use-enumerated-array-positions-for-our-allocatio.patch b/0271-efi-use-enumerated-array-positions-for-our-allocatio.patch similarity index 100% rename from 0272-efi-use-enumerated-array-positions-for-our-allocatio.patch rename to 0271-efi-use-enumerated-array-positions-for-our-allocatio.patch diff --git a/0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch b/0272-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch similarity index 100% rename from 0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch rename to 0272-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch diff --git a/0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch b/0273-efi-allocate-the-initrd-within-the-bounds-expressed-.patch similarity index 100% rename from 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch rename to 0273-efi-allocate-the-initrd-within-the-bounds-expressed-.patch diff --git a/0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch b/0274-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch similarity index 100% rename from 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch rename to 0274-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch diff --git a/0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch b/0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch similarity index 100% rename from 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch rename to 0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch diff --git a/0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch b/0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch similarity index 100% rename from 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch rename to 0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch diff --git a/0277-Try-reserving-less-ram.patch b/0277-Try-reserving-less-ram.patch deleted file mode 100644 index 46fb871f..00000000 --- a/0277-Try-reserving-less-ram.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 8 Aug 2022 11:23:59 -0400 -Subject: [PATCH] Try reserving less ram... - -In 005a0aaaad2a00a1fa1e60d94cc4fd5407c22e7d, we switched from reserving -one quarter of the available free memory to three quarters. Apparently -this has some unfortunate side-affects for some workloads, and has -negatively effected chainloading[0] as well as Fedora CoreOS[1]. - -This patch changes it to reserve /half/ of available memory, in hopes -that this is a working compromise. - -[0] https://bugzilla.redhat.com/show_bug.cgi?id=2115202 -[1] https://github.com/coreos/fedora-coreos-tracker/issues/1271 - -Signed-off-by: Peter Jones ---- - grub-core/kern/efi/mm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 150e412ee7..b4e012f5e7 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -740,7 +740,7 @@ grub_efi_mm_init (void) - /* By default, request three quarters of the available memory. */ - total_pages = get_total_pages (filtered_memory_map, desc_size, - filtered_memory_map_end); -- required_pages = (total_pages >> 1) + (total_pages >> 2); -+ required_pages = (total_pages >> 1); - if (required_pages < BYTES_TO_PAGES (MIN_HEAP_SIZE)) - required_pages = BYTES_TO_PAGES (MIN_HEAP_SIZE); - else if (required_pages > BYTES_TO_PAGES (MAX_HEAP_SIZE)) diff --git a/0279-squish-give-up-on-rhgb-quiet.patch b/0277-squish-give-up-on-rhgb-quiet.patch similarity index 100% rename from 0279-squish-give-up-on-rhgb-quiet.patch rename to 0277-squish-give-up-on-rhgb-quiet.patch diff --git a/0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch b/0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch similarity index 100% rename from 0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch rename to 0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch diff --git a/0281-ieee1275-implement-vec5-for-cas-negotiation.patch b/0279-ieee1275-implement-vec5-for-cas-negotiation.patch similarity index 100% rename from 0281-ieee1275-implement-vec5-for-cas-negotiation.patch rename to 0279-ieee1275-implement-vec5-for-cas-negotiation.patch diff --git a/0282-blscfg-Don-t-root-device-in-emu-builds.patch b/0280-blscfg-Don-t-root-device-in-emu-builds.patch similarity index 100% rename from 0282-blscfg-Don-t-root-device-in-emu-builds.patch rename to 0280-blscfg-Don-t-root-device-in-emu-builds.patch diff --git a/grub.patches b/grub.patches index 1156a0ee..5bd36301 100644 --- a/grub.patches +++ b/grub.patches @@ -268,15 +268,13 @@ Patch0267: 0267-grub-probe-document-the-behavior-of-multiple-v.patch Patch0268: 0268-grub_fs_probe-dprint-errors-from-filesystems.patch Patch0269: 0269-fs-fat-don-t-error-when-mtime-is-0.patch Patch0270: 0270-Make-debug-file-show-which-file-filters-get-run.patch -Patch0271: 0271-efi-make-the-default-arena-most-of-ram.patch -Patch0272: 0272-efi-use-enumerated-array-positions-for-our-allocatio.patch -Patch0273: 0273-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch -Patch0274: 0274-efi-allocate-the-initrd-within-the-bounds-expressed-.patch -Patch0275: 0275-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch -Patch0276: 0276-BLS-create-etc-kernel-cmdline-during-mkconfig.patch -Patch0277: 0277-Try-reserving-less-ram.patch -Patch0278: 0278-squish-don-t-dup-rhgb-quiet-check-mtimes.patch -Patch0279: 0279-squish-give-up-on-rhgb-quiet.patch -Patch0280: 0280-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch -Patch0281: 0281-ieee1275-implement-vec5-for-cas-negotiation.patch -Patch0282: 0282-blscfg-Don-t-root-device-in-emu-builds.patch +Patch0271: 0271-efi-use-enumerated-array-positions-for-our-allocatio.patch +Patch0272: 0272-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch +Patch0273: 0273-efi-allocate-the-initrd-within-the-bounds-expressed-.patch +Patch0274: 0274-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch +Patch0275: 0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +Patch0276: 0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +Patch0277: 0277-squish-give-up-on-rhgb-quiet.patch +Patch0278: 0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +Patch0279: 0279-ieee1275-implement-vec5-for-cas-negotiation.patch +Patch0280: 0280-blscfg-Don-t-root-device-in-emu-builds.patch diff --git a/grub2.spec b/grub2.spec index 36ae7245..4e3ea39c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 55%{?dist} +Release: 56%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Sep 07 2022 Robbie Harwood - 2.06-56 +- Revert patches to claim more memory for the arena + * Thu Aug 25 2022 Robbie Harwood - 2.06-55 - Fix root definition for blscfg in emu From c50cc54b88d37b0aa9511c3fa4cc8cf106046870 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 8 Sep 2022 20:17:42 +0000 Subject: [PATCH 149/294] aa64: support pe/coff decompressor Signed-off-by: Robbie Harwood --- ...ux-Remove-magic-number-header-field-.patch | 43 +++++++++ 0282-Correct-BSS-zeroing-on-aarch64.patch | 95 +++++++++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 0281-loader-arm64-linux-Remove-magic-number-header-field-.patch create mode 100644 0282-Correct-BSS-zeroing-on-aarch64.patch diff --git a/0281-loader-arm64-linux-Remove-magic-number-header-field-.patch b/0281-loader-arm64-linux-Remove-magic-number-header-field-.patch new file mode 100644 index 00000000..faaa0713 --- /dev/null +++ b/0281-loader-arm64-linux-Remove-magic-number-header-field-.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Thu, 11 Aug 2022 16:51:57 +0200 +Subject: [PATCH] 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. + +Signed-off-by: Ard Biesheuvel +Reviewed-by: Daniel Kiper +Resolves: rhbz#2125069 +Signed-off-by: Jeremy Linton +(cherry-picked from commit 69edb31205602c29293a8c6e67363bba2a4a1e66) +Signed-off-by: Robbie Harwood +--- + 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 de85583487..489d0c7173 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_DOS_MAGIC) + return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); diff --git a/0282-Correct-BSS-zeroing-on-aarch64.patch b/0282-Correct-BSS-zeroing-on-aarch64.patch new file mode 100644 index 00000000..4f9a2b78 --- /dev/null +++ b/0282-Correct-BSS-zeroing-on-aarch64.patch @@ -0,0 +1,95 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Linton +Date: Tue, 6 Sep 2022 15:33:03 -0500 +Subject: [PATCH] Correct BSS zeroing on aarch64 + +The aarch64 loader doesn't use efi bootservices, and +therefor it has a very minimal loader which makes a lot +of assumptions about the kernel layout. With the ZBOOT +changes, the layout has changed a bit and we not should +really be parsing the PE sections to determine how much +data to copy, otherwise the BSS won't be setup properly. + +This code still makes a lot of assumptions about the +the kernel layout, so its far from ideal, but it works. + +Resolves: rhbz#2125069 + +Signed-off-by: Jeremy Linton +--- + grub-core/loader/arm64/linux.c | 27 ++++++++++++++++++++++----- + 1 file changed, 22 insertions(+), 5 deletions(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index 489d0c7173..419f2201df 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -316,10 +316,12 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + static grub_err_t + parse_pe_header (void *kernel, grub_uint64_t *total_size, + grub_uint32_t *entry_offset, +- grub_uint32_t *alignment) ++ grub_uint32_t *alignment,grub_uint32_t *code_size) + { + struct linux_arch_kernel_header *lh = kernel; + struct grub_armxx_linux_pe_header *pe; ++ grub_uint16_t i; ++ struct grub_pe32_section_table *sections; + + pe = (void *)((unsigned long)kernel + lh->hdr_offset); + +@@ -329,6 +331,19 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size, + *total_size = pe->opt.image_size; + *entry_offset = pe->opt.entry_addr; + *alignment = pe->opt.section_alignment; ++ *code_size = pe->opt.section_alignment; ++ ++ sections = (struct grub_pe32_section_table *) ((char *)&pe->opt + ++ pe->coff.optional_header_size); ++ grub_dprintf ("linux", "num_sections : %d\n", pe->coff.num_sections ); ++ for (i = 0 ; i < pe->coff.num_sections; i++) ++ { ++ grub_dprintf ("linux", "raw_size : %lld\n", ++ (long long) sections[i].raw_data_size); ++ grub_dprintf ("linux", "virt_size : %lld\n", ++ (long long) sections[i].virtual_size); ++ *code_size += sections[i].raw_data_size; ++ } + + return GRUB_ERR_NONE; + } +@@ -341,6 +356,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_err_t err; + grub_off_t filelen; + grub_uint32_t align; ++ grub_uint32_t code_size; + void *kernel = NULL; + int nx_supported = 1; + +@@ -373,11 +389,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + if (grub_arch_efi_linux_check_image (kernel) != GRUB_ERR_NONE) + goto fail; +- if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align) != GRUB_ERR_NONE) ++ if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align, &code_size) != GRUB_ERR_NONE) + goto fail; + grub_dprintf ("linux", "kernel mem size : %lld\n", (long long) kernel_size); + grub_dprintf ("linux", "kernel entry offset : %d\n", handover_offset); + grub_dprintf ("linux", "kernel alignment : 0x%x\n", align); ++ grub_dprintf ("linux", "kernel size : 0x%x\n", code_size); + + err = grub_efi_check_nx_image_support((grub_addr_t)kernel, filelen, &nx_supported); + if (err != GRUB_ERR_NONE) +@@ -396,9 +413,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + kernel_addr = (void *)ALIGN_UP((grub_uint64_t)kernel_alloc_addr, align); + + grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); +- grub_memcpy (kernel_addr, kernel, grub_min(filelen, kernel_size)); +- if (kernel_size > filelen) +- grub_memset ((char *)kernel_addr + filelen, 0, kernel_size - filelen); ++ grub_memcpy (kernel_addr, kernel, grub_min(code_size, kernel_size)); ++ if (kernel_size > code_size) ++ grub_memset ((char *)kernel_addr + code_size, 0, kernel_size - code_size); + grub_free(kernel); + kernel = NULL; + diff --git a/grub.patches b/grub.patches index 5bd36301..0b55963a 100644 --- a/grub.patches +++ b/grub.patches @@ -278,3 +278,5 @@ Patch0277: 0277-squish-give-up-on-rhgb-quiet.patch Patch0278: 0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch Patch0279: 0279-ieee1275-implement-vec5-for-cas-negotiation.patch Patch0280: 0280-blscfg-Don-t-root-device-in-emu-builds.patch +Patch0281: 0281-loader-arm64-linux-Remove-magic-number-header-field-.patch +Patch0282: 0282-Correct-BSS-zeroing-on-aarch64.patch diff --git a/grub2.spec b/grub2.spec index 4e3ea39c..bc968694 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 56%{?dist} +Release: 57%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Sep 08 2022 Robbie Harwood - 2.06-57 +- aa64: support pe/coff decompressor + * Wed Sep 07 2022 Robbie Harwood - 2.06-56 - Revert patches to claim more memory for the arena From c1f53c859616fdbf40811058b60bebe2930e3271 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Fri, 9 Sep 2022 17:52:05 +0800 Subject: [PATCH 150/294] grub.macros also needs updating to use gettext-runtime otherwise eg grub-pc still pulls in gettext in current rawhide Signed-off-by: Jens Petersen --- grub.macros | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/grub.macros b/grub.macros index 2ab40944..9fb2d9b2 100644 --- a/grub.macros +++ b/grub.macros @@ -242,7 +242,7 @@ Obsoletes: grub2 < %{evr} \ Requires: grub2-common = %{evr} \ Requires: grub2-tools-minimal = %{evr} \ Requires: grub2-%{1}-modules = %{evr} \ -Requires: gettext which file \ +Requires: gettext-runtime which file \ Requires: grub2-tools = %{evr} \ Requires(pre): dracut \ Requires(post): dracut \ @@ -265,11 +265,10 @@ This subpackage provides support for rebuilding your own grub.efi. \ %{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\ %{expand:%%package %%{1}-tools} \ Summary: Support tools for GRUB. \ -Requires: gettext os-prober which file system-logos \ +Requires: gettext-runtime os-prober which file system-logos \ Requires: grub2-common = %{evr} \ Requires: grub2-tools-minimal = %{evr} \ Requires: os-prober >= 1.58-11 \ -Requires: gettext which file \ \ %{expand:%%description %%{1}-tools} \ %{desc} \ From 7a1af0ff6de3c400dfa0510e85082dd44a2ff20a Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 9 Sep 2022 18:06:11 +0000 Subject: [PATCH 151/294] Bump spec for grub.macros gettext changes from Jens Signed-off-by: Robbie Harwood --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index bc968694..092aeb66 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 57%{?dist} +Release: 58%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Sep 09 2022 Robbie Harwood - 2.06-58 +- Bump spec for grub.macros gettext changes from Jens + * Thu Sep 08 2022 Robbie Harwood - 2.06-57 - aa64: support pe/coff decompressor From 4fa957c61cdab0c2c0d4e19ee44b62272f7dc9a8 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 4 Oct 2022 19:42:56 +0000 Subject: [PATCH 152/294] Flush instruction cache before starting aa64 kernel Signed-off-by: Robbie Harwood --- ...ate-i-cache-before-starting-the-kern.patch | 39 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch diff --git a/0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch b/0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch new file mode 100644 index 00000000..eff155d1 --- /dev/null +++ b/0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: dann frazier +Date: Thu, 25 Aug 2022 17:08:09 -0600 +Subject: [PATCH] linuxefi: Invalidate i-cache before starting the kernel + +We need to flush the memory range of the code we are about to execute +from the instruction cache before we can safely execute it. Not doing +so appears to be the source of rare synchronous exceptions a user +is seeing on a Cortex-A72-based platform while executing the Linux EFI +stub. Notably they seem to correlate with an instruction on a cache +line boundary. + +Signed-off-by: dann frazier +--- + grub-core/loader/efi/linux.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 277f352e0c..e413bdcc23 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -16,6 +16,7 @@ + * along with GRUB. If not, see . + */ + ++#include + #include + #include + #include +@@ -210,6 +211,9 @@ grub_efi_linux_boot (grub_addr_t kernel_addr, grub_size_t kernel_size, + asm volatile ("cli"); + #endif + ++ /* Invalidate the instruction cache */ ++ grub_arch_sync_caches((void *)kernel_addr, kernel_size); ++ + hf = (handover_func)((char *)kernel_addr + handover_offset + offset); + hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); + diff --git a/grub.patches b/grub.patches index 0b55963a..a4af6bfb 100644 --- a/grub.patches +++ b/grub.patches @@ -280,3 +280,4 @@ Patch0279: 0279-ieee1275-implement-vec5-for-cas-negotiation.patch Patch0280: 0280-blscfg-Don-t-root-device-in-emu-builds.patch Patch0281: 0281-loader-arm64-linux-Remove-magic-number-header-field-.patch Patch0282: 0282-Correct-BSS-zeroing-on-aarch64.patch +Patch0283: 0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch diff --git a/grub2.spec b/grub2.spec index 092aeb66..63fe40fb 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 58%{?dist} +Release: 59%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Oct 04 2022 Robbie Harwood - 2.06-59 +- Flush instruction cache before starting aa64 kernel + * Fri Sep 09 2022 Robbie Harwood - 2.06-58 - Bump spec for grub.macros gettext changes from Jens From fdd5c6f423983e905a40fb4d9d2212a08bf9b2d0 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 12 Oct 2022 18:08:53 +0000 Subject: [PATCH 153/294] x86-efi: Fix an incorrect array size in kernel allocation Signed-off-by: Robbie Harwood --- ...ncorrect-array-size-in-kernel-alloca.patch | 36 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch diff --git a/0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch b/0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch new file mode 100644 index 00000000..00797503 --- /dev/null +++ b/0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 11 Oct 2022 17:00:50 -0400 +Subject: [PATCH] x86-efi: Fix an incorrect array size in kernel allocation + +In 81a6ebf62bbe166ddc968463df2e8bd481bf697c ("efi: split allocation +policy for kernel vs initrd memories."), I introduced a split in the +kernel allocator to allow for different dynamic policies for the kernel +and the initrd allocations. + +Unfortunately, that change increased the size of the policy data used to +make decisions, but did not change the size of the temporary storage we +use to back it up and restore. This results in some of .data getting +clobbered at runtime, and hilarity ensues. + +This patch makes the size of the backup storage be based on the size of +the initial policy data. + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/efi/linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index ac5ef50bdb..9854b0defa 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -92,7 +92,7 @@ static struct allocation_choice max_addresses[] = + { INITRD_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + { NO_MEM, 0, 0 } + }; +-static struct allocation_choice saved_addresses[4]; ++static struct allocation_choice saved_addresses[sizeof(max_addresses) / sizeof(max_addresses[0])]; + + #define save_addresses() grub_memcpy(saved_addresses, max_addresses, sizeof(max_addresses)) + #define restore_addresses() grub_memcpy(max_addresses, saved_addresses, sizeof(max_addresses)) diff --git a/grub.patches b/grub.patches index a4af6bfb..0ca7cd5b 100644 --- a/grub.patches +++ b/grub.patches @@ -281,3 +281,4 @@ Patch0280: 0280-blscfg-Don-t-root-device-in-emu-builds.patch Patch0281: 0281-loader-arm64-linux-Remove-magic-number-header-field-.patch Patch0282: 0282-Correct-BSS-zeroing-on-aarch64.patch Patch0283: 0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch +Patch0284: 0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch diff --git a/grub2.spec b/grub2.spec index 63fe40fb..9b7fd655 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 59%{?dist} +Release: 60%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Oct 12 2022 Robbie Harwood - 2.06-60 +- x86-efi: Fix an incorrect array size in kernel allocation + * Tue Oct 04 2022 Robbie Harwood - 2.06-59 - Flush instruction cache before starting aa64 kernel From bc32a76babd8248cdfb058ce70c46ce86b836910 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 28 Oct 2022 16:58:27 +0000 Subject: [PATCH 154/294] TDX measurements to RTMR Signed-off-by: Robbie Harwood --- ...i-tpm-Refine-the-status-of-log-event.patch | 42 +++ ...-Use-grub_strcpy-instead-of-grub_mem.patch | 37 +++ ...-EFI_CC_MEASUREMENT_PROTOCOL-support.patch | 258 ++++++++++++++++++ grub.patches | 3 + grub2.spec | 5 +- 5 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 0285-commands-efi-tpm-Refine-the-status-of-log-event.patch create mode 100644 0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch create mode 100644 0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch diff --git a/0285-commands-efi-tpm-Refine-the-status-of-log-event.patch b/0285-commands-efi-tpm-Refine-the-status-of-log-event.patch new file mode 100644 index 00000000..896e49b5 --- /dev/null +++ b/0285-commands-efi-tpm-Refine-the-status-of-log-event.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lu Ken +Date: Wed, 13 Jul 2022 10:06:10 +0800 +Subject: [PATCH] commands/efi/tpm: Refine the status of log event + +1. Use macro GRUB_ERR_NONE instead of hard code 0. +2. Keep lowercase of the first char for the status string of log event. + +Signed-off-by: Lu Ken +Reviewed-by: Daniel Kiper +(cherry picked from commit 922898573e37135f5dedc16f3e15a1d1d4c53f8a) +--- + grub-core/commands/efi/tpm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c +index a97d85368a..7acf510499 100644 +--- a/grub-core/commands/efi/tpm.c ++++ b/grub-core/commands/efi/tpm.c +@@ -135,17 +135,17 @@ grub_efi_log_event_status (grub_efi_status_t status) + switch (status) + { + case GRUB_EFI_SUCCESS: +- return 0; ++ return GRUB_ERR_NONE; + case GRUB_EFI_DEVICE_ERROR: +- return grub_error (GRUB_ERR_IO, N_("Command failed")); ++ return grub_error (GRUB_ERR_IO, N_("command failed")); + case GRUB_EFI_INVALID_PARAMETER: +- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid parameter")); + case GRUB_EFI_BUFFER_TOO_SMALL: +- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("output buffer too small")); + case GRUB_EFI_NOT_FOUND: + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); + default: +- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("unknown TPM error")); + } + } + diff --git a/0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch b/0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch new file mode 100644 index 00000000..e04dcbc7 --- /dev/null +++ b/0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lu Ken +Date: Wed, 13 Jul 2022 10:06:11 +0800 +Subject: [PATCH] commands/efi/tpm: Use grub_strcpy() instead of grub_memcpy() + +The event description is a string, so using grub_strcpy() is cleaner than +using grub_memcpy(). + +Signed-off-by: Lu Ken +Reviewed-by: Daniel Kiper +(cherry picked from commit ef8679b645a63eb9eb191bb9539d7d25a9d6ff3b) +--- + grub-core/commands/efi/tpm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c +index 7acf510499..bb59599721 100644 +--- a/grub-core/commands/efi/tpm.c ++++ b/grub-core/commands/efi/tpm.c +@@ -175,7 +175,7 @@ grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf, + event->PCRIndex = pcr; + event->EventType = EV_IPL; + event->EventSize = grub_strlen (description) + 1; +- grub_memcpy (event->Event, description, event->EventSize); ++ grub_strcpy ((char *) event->Event, description); + + algorithm = TCG_ALG_SHA; + status = efi_call_7 (tpm->log_extend_event, tpm, (grub_addr_t) buf, (grub_uint64_t) size, +@@ -212,7 +212,7 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf, + event->Header.EventType = EV_IPL; + event->Size = + sizeof (*event) - sizeof (event->Event) + grub_strlen (description) + 1; +- grub_memcpy (event->Event, description, grub_strlen (description) + 1); ++ grub_strcpy ((char *) event->Event, description); + + status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_addr_t) buf, + (grub_uint64_t) size, event); diff --git a/0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch b/0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch new file mode 100644 index 00000000..610c81ac --- /dev/null +++ b/0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch @@ -0,0 +1,258 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lu Ken +Date: Wed, 13 Jul 2022 10:06:12 +0800 +Subject: [PATCH] efi/tpm: Add EFI_CC_MEASUREMENT_PROTOCOL support + +The EFI_CC_MEASUREMENT_PROTOCOL abstracts the measurement for virtual firmware +in confidential computing environment. It is similar to the EFI_TCG2_PROTOCOL. +It was proposed by Intel and ARM and approved by UEFI organization. + +It is defined in Intel GHCI specification: https://cdrdv2.intel.com/v1/dl/getContent/726790 . +The EDKII header file is available at https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Protocol/CcMeasurement.h . + +Signed-off-by: Lu Ken +Reviewed-by: Daniel Kiper +(cherry picked from commit 4c76565b6cb885b7e144dc27f3612066844e2d19) +--- + grub-core/commands/efi/tpm.c | 48 ++++++++++++++ + include/grub/efi/cc.h | 151 +++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 199 insertions(+) + create mode 100644 include/grub/efi/cc.h + +diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c +index bb59599721..ae09c1bf8b 100644 +--- a/grub-core/commands/efi/tpm.c ++++ b/grub-core/commands/efi/tpm.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -31,6 +32,7 @@ typedef TCG_PCR_EVENT grub_tpm_event_t; + + static grub_efi_guid_t tpm_guid = EFI_TPM_GUID; + static grub_efi_guid_t tpm2_guid = EFI_TPM2_GUID; ++static grub_efi_guid_t cc_measurement_guid = GRUB_EFI_CC_MEASUREMENT_PROTOCOL_GUID; + + static grub_efi_handle_t *grub_tpm_handle; + static grub_uint8_t grub_tpm_version; +@@ -221,6 +223,50 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf, + return grub_efi_log_event_status (status); + } + ++static void ++grub_cc_log_event (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, ++ const char *description) ++{ ++ grub_efi_cc_event_t *event; ++ grub_efi_status_t status; ++ grub_efi_cc_protocol_t *cc; ++ grub_efi_cc_mr_index_t mr; ++ ++ cc = grub_efi_locate_protocol (&cc_measurement_guid, NULL); ++ if (cc == NULL) ++ return; ++ ++ status = efi_call_3 (cc->map_pcr_to_mr_index, cc, pcr, &mr); ++ if (status != GRUB_EFI_SUCCESS) ++ { ++ grub_efi_log_event_status (status); ++ return; ++ } ++ ++ event = grub_zalloc (sizeof (grub_efi_cc_event_t) + ++ grub_strlen (description) + 1); ++ if (event == NULL) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate CC event buffer")); ++ return; ++ } ++ ++ event->Header.HeaderSize = sizeof (grub_efi_cc_event_header_t); ++ event->Header.HeaderVersion = GRUB_EFI_CC_EVENT_HEADER_VERSION; ++ event->Header.MrIndex = mr; ++ event->Header.EventType = EV_IPL; ++ event->Size = sizeof (*event) + grub_strlen (description) + 1; ++ grub_strcpy ((char *) event->Event, description); ++ ++ status = efi_call_5 (cc->hash_log_extend_event, cc, 0, ++ (grub_efi_physical_address_t)(grub_addr_t) buf, ++ (grub_efi_uint64_t) size, event); ++ grub_free (event); ++ ++ if (status != GRUB_EFI_SUCCESS) ++ grub_efi_log_event_status (status); ++} ++ + grub_err_t + grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, + const char *description) +@@ -228,6 +274,8 @@ grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, + grub_efi_handle_t tpm_handle; + grub_efi_uint8_t protocol_version; + ++ grub_cc_log_event(buf, size, pcr, description); ++ + if (!grub_tpm_handle_find (&tpm_handle, &protocol_version)) + return 0; + +diff --git a/include/grub/efi/cc.h b/include/grub/efi/cc.h +new file mode 100644 +index 0000000000..8960306890 +--- /dev/null ++++ b/include/grub/efi/cc.h +@@ -0,0 +1,151 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2022 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#ifndef GRUB_EFI_CC_H ++#define GRUB_EFI_CC_H 1 ++ ++#include ++#include ++#include ++ ++#define GRUB_EFI_CC_MEASUREMENT_PROTOCOL_GUID \ ++ { 0x96751a3d, 0x72f4, 0x41a6, \ ++ { 0xa7, 0x94, 0xed, 0x5d, 0x0e, 0x67, 0xae, 0x6b } \ ++ }; ++ ++struct grub_efi_cc_version ++{ ++ grub_efi_uint8_t Major; ++ grub_efi_uint8_t Minor; ++}; ++typedef struct grub_efi_cc_version grub_efi_cc_version_t; ++ ++/* EFI_CC Type/SubType definition. */ ++#define GRUB_EFI_CC_TYPE_NONE 0 ++#define GRUB_EFI_CC_TYPE_SEV 1 ++#define GRUB_EFI_CC_TYPE_TDX 2 ++ ++struct grub_efi_cc_type ++{ ++ grub_efi_uint8_t Type; ++ grub_efi_uint8_t SubType; ++}; ++typedef struct grub_efi_cc_type grub_efi_cc_type_t; ++ ++typedef grub_efi_uint32_t grub_efi_cc_event_log_bitmap_t; ++typedef grub_efi_uint32_t grub_efi_cc_event_log_format_t; ++typedef grub_efi_uint32_t grub_efi_cc_event_algorithm_bitmap_t; ++typedef grub_efi_uint32_t grub_efi_cc_mr_index_t; ++ ++/* Intel TDX measure register index. */ ++#define GRUB_TDX_MR_INDEX_MRTD 0 ++#define GRUB_TDX_MR_INDEX_RTMR0 1 ++#define GRUB_TDX_MR_INDEX_RTMR1 2 ++#define GRUB_TDX_MR_INDEX_RTMR2 3 ++#define GRUB_TDX_MR_INDEX_RTMR3 4 ++ ++#define GRUB_EFI_CC_EVENT_LOG_FORMAT_TCG_2 0x00000002 ++#define GRUB_EFI_CC_BOOT_HASH_ALG_SHA384 0x00000004 ++#define GRUB_EFI_CC_EVENT_HEADER_VERSION 1 ++ ++struct grub_efi_cc_event_header ++{ ++ /* Size of the event header itself (sizeof(EFI_TD_EVENT_HEADER)). */ ++ grub_efi_uint32_t HeaderSize; ++ ++ /* ++ * Header version. For this version of this specification, ++ * the value shall be 1. ++ */ ++ grub_efi_uint16_t HeaderVersion; ++ ++ /* Index of the MR that shall be extended. */ ++ grub_efi_cc_mr_index_t MrIndex; ++ ++ /* Type of the event that shall be extended (and optionally logged). */ ++ grub_efi_uint32_t EventType; ++} GRUB_PACKED; ++typedef struct grub_efi_cc_event_header grub_efi_cc_event_header_t; ++ ++struct grub_efi_cc_event ++{ ++ /* Total size of the event including the Size component, the header and the Event data. */ ++ grub_efi_uint32_t Size; ++ grub_efi_cc_event_header_t Header; ++ grub_efi_uint8_t Event[0]; ++} GRUB_PACKED; ++typedef struct grub_efi_cc_event grub_efi_cc_event_t; ++ ++struct grub_efi_cc_boot_service_capability ++{ ++ /* Allocated size of the structure. */ ++ grub_efi_uint8_t Size; ++ ++ /* ++ * Version of the grub_efi_cc_boot_service_capability_t structure itself. ++ * For this version of the protocol, the Major version shall be set to 1 ++ * and the Minor version shall be set to 1. ++ */ ++ grub_efi_cc_version_t StructureVersion; ++ ++ /* ++ * Version of the EFI TD protocol. ++ * For this version of the protocol, the Major version shall be set to 1 ++ * and the Minor version shall be set to 1. ++ */ ++ grub_efi_cc_version_t ProtocolVersion; ++ ++ /* Supported hash algorithms. */ ++ grub_efi_cc_event_algorithm_bitmap_t HashAlgorithmBitmap; ++ ++ /* Bitmap of supported event log formats. */ ++ grub_efi_cc_event_log_bitmap_t SupportedEventLogs; ++ ++ /* Indicates the CC type. */ ++ grub_efi_cc_type_t CcType; ++}; ++typedef struct grub_efi_cc_boot_service_capability grub_efi_cc_boot_service_capability_t; ++ ++struct grub_efi_cc_protocol ++{ ++ grub_efi_status_t ++ (*get_capability) (struct grub_efi_cc_protocol *this, ++ grub_efi_cc_boot_service_capability_t *ProtocolCapability); ++ ++ grub_efi_status_t ++ (*get_event_log) (struct grub_efi_cc_protocol *this, ++ grub_efi_cc_event_log_format_t EventLogFormat, ++ grub_efi_physical_address_t *EventLogLocation, ++ grub_efi_physical_address_t *EventLogLastEntry, ++ grub_efi_boolean_t *EventLogTruncated); ++ ++ grub_efi_status_t ++ (*hash_log_extend_event) (struct grub_efi_cc_protocol *this, ++ grub_efi_uint64_t Flags, ++ grub_efi_physical_address_t DataToHash, ++ grub_efi_uint64_t DataToHashLen, ++ grub_efi_cc_event_t *EfiCcEvent); ++ ++ grub_efi_status_t ++ (*map_pcr_to_mr_index) (struct grub_efi_cc_protocol *this, ++ grub_efi_uint32_t PcrIndex, ++ grub_efi_cc_mr_index_t *MrIndex); ++}; ++typedef struct grub_efi_cc_protocol grub_efi_cc_protocol_t; ++ ++#endif diff --git a/grub.patches b/grub.patches index 0ca7cd5b..ebbd8ac7 100644 --- a/grub.patches +++ b/grub.patches @@ -282,3 +282,6 @@ Patch0281: 0281-loader-arm64-linux-Remove-magic-number-header-field-.patch Patch0282: 0282-Correct-BSS-zeroing-on-aarch64.patch Patch0283: 0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch Patch0284: 0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch +Patch0285: 0285-commands-efi-tpm-Refine-the-status-of-log-event.patch +Patch0286: 0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch +Patch0287: 0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch diff --git a/grub2.spec b/grub2.spec index 9b7fd655..23c0c556 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 60%{?dist} +Release: 61%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -530,6 +530,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Oct 28 2022 Robbie Harwood - 2.06-61 +- TDX measurements to RTMR + * Wed Oct 12 2022 Robbie Harwood - 2.06-60 - x86-efi: Fix an incorrect array size in kernel allocation From 3d407d2111793408d7a5cf82729022b980525c7b Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 1 Nov 2022 17:28:58 +0000 Subject: [PATCH 155/294] Try dropping custom sort again See-also: https://github.com/rpm-software-management/rpm/pull/2249 Signed-off-by: Robbie Harwood --- 0010-re-write-.gitignore.patch | 10 +- ...fig-construct-titles-that-look-like-.patch | 0 0032-Use-rpm-s-sort-for-grub2-mkconfig.patch | 457 ---------------- ...ly-grub2-password-config-tool-985962.patch | 10 +- ... 0034-tcp-add-window-scaling-support.patch | 0 ...net-and-bootp-add-support-for-dhcpv6.patch | 0 ...rnel-settings-and-use-it-in-10_linux.patch | 6 +- ...1374141-fix-incorrect-mask-for-ppc64.patch | 0 ... 0038-Make-grub_fatal-also-backtrace.patch | 0 ...fo-pages-say-grub2-where-appropriate.patch | 0 ...-chainloader-entries-don-t-try-any-x.patch | 0 ...-Add-ability-to-boot-from-subvolumes.patch | 0 ...port-btrfs_subvol-and-btrfs_subvolid.patch | 0 ...> 0043-grub2-btrfs-03-follow_default.patch | 0 ...=> 0044-grub2-btrfs-04-grub2-install.patch | 0 ...> 0045-grub2-btrfs-05-grub2-mkconfig.patch | 4 +- ... => 0046-grub2-btrfs-06-subvol-mount.patch | 0 ...subvol-name-scheme-to-support-old-sn.patch | 0 ...-correctly-with-btrfs-snapshots-bsc-.patch | 0 ...ocate_pool-and-grub_efi_free_pool-wr.patch | 0 ...fi_.-memory-helpers-where-reasonable.patch | 0 ...1-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 0 ...=> 0052-don-t-use-int-for-efi-status.patch | 0 ...INIT-declare-its-function-prototypes.patch | 0 ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 0 ...d-xen-or-multiboot-2-modules-as-need.patch | 0 ...-calibration-not-take-51-seconds-to-.patch | 0 ...057-align-struct-efi_variable-better.patch | 0 ...058-Add-BLS-support-to-grub-mkconfig.patch | 12 +- ...-backtrace-on-grub_abort-for-grub-em.patch | 0 ...nux-and-initrd-commands-for-grub-emu.patch | 0 ...h => 0061-Add-grub2-switch-to-blscfg.patch | 6 +- ...patch => 0062-make-better-backtraces.patch | 2 +- ...w-our-startup-message-if-debug-is-se.patch | 0 ...-some-minor-include-path-weirdnesses.patch | 0 ...it-possible-to-enabled-build-id-sha1.patch | 4 +- ...f-grub_dprintf-without-the-file-line.patch | 0 ...dprintf-that-tells-us-load-addresses.patch | 0 ...tch => 0068-Fixup-for-newer-compiler.patch | 0 ...-export-the-start-and-_start-symbols.patch | 0 ...tch => 0070-Fixup-for-newer-compiler.patch | 0 ...pport-for-non-Ethernet-network-cards.patch | 0 ...racketed-ipv6-addrs-and-port-numbers.patch | 0 ...=> 0073-bootp-New-net_bootp6-command.patch | 0 ...=> 0074-efinet-UEFI-IPv6-PXE-support.patch | 0 ...075-grub.texi-Add-net_bootp6-doument.patch | 0 ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 0 ...etting-network-from-UEFI-device-path.patch | 0 ...etting-DNS-server-from-UEFI-protocol.patch | 0 ...79-Support-UEFI-networking-protocols.patch | 0 ...> 0080-AUDIT-0-http-boot-tracker-bug.patch | 0 ...-incr-command-to-increment-integer-v.patch | 0 ...h => 0082-Add-auto-hide-menu-support.patch | 2 +- ...> 0083-Add-grub-set-bootflag-utility.patch | 4 +- ...b-boot-indeterminate.service-example.patch | 0 ...h => 0085-gentpl-add-disable-support.patch | 0 ... => 0086-gentpl-add-pc-firmware-type.patch | 0 ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 6 +- ...make-it-possible-to-run-checkers-on-.patch | 0 ...91-Rework-how-the-fdt-command-builds.patch | 0 ...able-non-wordsize-allocations-on-arm.patch | 4 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 0 ...=> 0094-Make-grub_error-more-verbose.patch | 0 ...eset-an-alias-for-the-reboot-command.patch | 0 ....patch => 0096-Add-a-version-command.patch | 4 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 0 ...-Better-memory-allocation-and-error-.patch | 0 ...tter-locations-for-kernel-and-initrd.patch | 0 ...p-all-the-places-Wsign-compare-error.patch | 16 +- ...gn-compare-Wno-conversion-Wno-error-.patch | 6 +- ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 0 ...itrd-params-cmdline-allocations-abov.patch | 0 ... => 0106-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 4 +- ...tch => 0108-Reimplement-boot_counter.patch | 2 +- ...ntry-selection-based-on-ID-and-title.patch | 0 ...try-users-option-argument-to-be-opti.patch | 0 ...export-env-and-efi-load-env-commands.patch | 0 ...le-to-subtract-conditions-from-debug.patch | 0 ...bles-from-the-initial-context-when-c.patch | 0 ...-boot-success-reset-from-menu-auto-h.patch | 2 +- ...ix-systemctl-kexec-exit-status-check.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 0 ...g-Update-comment-about-running-as-ro.patch | 0 ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...indeterminate-getting-set-on-boot_su.patch | 0 ... => 0121-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 0 ...fw-http-_path-variables-to-make-them.patch | 0 ...-literal-IPv6-addresses-in-square-br.patch | 0 ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 0 ...se-address-before-jumping-to-the-PE-.patch | 0 ...ate-TPM-measurement-errors-to-the-ve.patch | 0 ...maximum-bounce-buffer-size-to-16-MiB.patch | 0 ...fix-when-the-HTTP-path-is-relative-a.patch | 0 ...turn-in-efi-export-env-and-efi-load-.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 0 ...rnel-validation-without-shim-protoco.patch | 0 ...ar-pointers-in-grub-core-net-bootp.c.patch | 0 ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 2 +- ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 0 ...ll-disable-support-for-EFI-platforms.patch | 0 ...imestamps-configure-flag-to-prepend-.patch | 8 +- ...ements-to-grub_disk_open-and-grub_di.patch | 0 ...on-grub_debug_is_enabled-void-return.patch | 0 ...ear-screen-when-debugging-is-enabled.patch | 0 ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 0 ...igning-grub-with-an-appended-signatu.patch | 0 ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0161-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0164-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...67-libtasn1-compile-into-asn1-module.patch | 0 ...8-test_asn1-test-module-for-libtasn1.patch | 6 +- ...-support-embedding-x509-certificates.patch | 0 ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 0 ...74-appended-signatures-documentation.patch | 0 ...er-lockdown-based-on-ibm-secure-boot.patch | 0 ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0177-ieee1275-claim-more-memory.patch | 0 ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 0 ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...ainloading-EFI-apps-from-loop-mounts.patch | 0 ...> 0182-efinet-Add-DHCP-proxy-support.patch | 0 ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 2 +- ... 0185-Suppress-gettext-error-message.patch | 0 ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 ...for-EFI-at-runtime-instead-of-config.patch | 0 ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 0 ...over-the-device-to-read-the-config-f.patch | 0 ...etting-of-prefix-for-signed-binary-c.patch | 0 ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 0 ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 0 ...-mkconfig-restore-umask-for-grub.cfg.patch | 0 ...btrfs-Use-full-btrfs-bootloader-area.patch | 0 ...-Fedora-location-of-DejaVu-SANS-font.patch | 4 +- ...t-show-Booting-s-msg-when-auto-booti.patch | 0 ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 0 ...ot-set-colorstate-until-the-first-te.patch | 0 ...ot-set-cursor-until-the-first-text-o.patch | 0 ...se-visual-indentation-in-config.h.in.patch | 0 ...sure-config-util.h-precedes-config.h.patch | 0 ...=> 0204-Drop-gnulib-fix-base64.patch.patch | 0 ...h => 0205-Drop-gnulib-no-abort.patch.patch | 0 ...version-and-drop-most-gnulib-patches.patch | 2 +- ...Fix-bug-stopping-iteration-when-no-f.patch | 0 ...w-efidisk-only-option-on-EFI-systems.patch | 0 ...h => 0209-efi-new-connectefi-command.patch | 0 ...-i386-efi-linux.c-do-not-validate-ke.patch | 0 ...-arm64-linux.c-do-not-validate-kerne.patch | 0 ...-efi-chainloader.c-do-not-validate-c.patch | 0 ...-efi-linux.c-drop-now-unused-grub_li.patch | 0 ...erpc-do-CAS-in-a-more-compatible-way.patch | 0 ...etection-support-device-names-with-c.patch | 0 ...ort-for-trusted-boot-using-a-vTPM-2..patch | 0 ...=> 0217-make-ofdisk_retries-optional.patch | 0 ...loader-grub_load_and_start_image-doe.patch | 0 ...prereqs-for-declaration-of-strchrnul.patch | 36 -- ...hainloader-simplify-the-loader-state.patch | 0 ...ot-Add-API-to-pass-context-to-loader.patch | 0 ...i-chainloader-Use-grub_loader_set_ex.patch | 0 ...linux-Avoid-a-use-after-free-in-the-.patch | 0 ...386-efi-linux-Use-grub_loader_set_ex.patch | 0 ...linux-Fix-a-memory-leak-in-the-initr.patch | 0 ...ct-non-kernel-files-in-the-shim_lock.patch | 0 ...-leak-device_name-on-error-in-grub_f.patch | 0 ...g-Abort-sooner-if-a-read-operation-f.patch | 0 ...g-Refuse-to-handle-multiple-image-he.patch | 0 ...g-Drop-greyscale-support-to-fix-heap.patch | 0 ...g-Avoid-heap-OOB-R-W-inserting-huff-.patch | 0 ...-png-Sanity-check-some-huffman-codes.patch | 0 ...eg-Abort-sooner-if-a-read-operation-.patch | 0 ...eg-Do-not-reallocate-a-given-huff-ta.patch | 0 ...eg-Refuse-to-handle-multiple-start-o.patch | 0 ...eg-Block-int-underflow-wild-pointer-.patch | 0 ...ix-array-out-of-bounds-formatting-un.patch | 0 ...ff-Block-overly-large-netbuff-allocs.patch | 0 ...8-net-ip-Do-IP-fragment-maths-safely.patch | 0 ...le-free-addresses-on-corrupt-DNS-res.patch | 0 ...ad-past-the-end-of-the-string-we-re-.patch | 0 ...-a-UAF-and-double-free-from-a-failed.patch | 0 ...=> 0242-net-tftp-Avoid-a-trivial-UAF.patch | 0 ...tear-down-socket-if-it-s-already-bee.patch | 0 ...Fix-OOB-write-for-split-http-headers.patch | 0 ...or-out-on-headers-with-LF-without-CR.patch | 0 ...ead-past-the-end-of-nat-journal-entr.patch | 0 ...-not-read-past-the-end-of-nat-bitmap.patch | 0 ...ot-copy-file-names-that-are-too-long.patch | 0 ...eral-fuzz-issues-with-invalid-dir-it.patch | 0 ...e-ASAN-and-SEGV-issues-found-with-fu.patch | 0 ...x-more-fuzz-issues-related-to-chunks.patch | 0 ...grub_min-and-grub_max-more-resilient.patch | 0 ...FS-switch-to-using-grub_min-grub_max.patch | 0 ...oot_time-also-call-grub_dprintf-boot.patch | 0 ...dules-make-.module_license-read-only.patch | 0 ...p-.llvm_addrsig-sections-and-similar.patch | 0 ...locate-space-for-non-allocable-secti.patch | 0 ...eader-struct-and-fix-some-bad-naming.patch | 0 ...nel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch | 0 ...ule-sections-at-page-aligned-address.patch | 0 ...-nx-add-memory-attribute-get-set-API.patch | 0 ...-page-permissions-for-loaded-modules.patch | 0 ...3-nx-set-attrs-in-our-kernel-loaders.patch | 0 ...x-compatible-flag-in-EFI-grub-images.patch | 0 ...-document-the-behavior-of-multiple-v.patch | 0 ...probe-dprint-errors-from-filesystems.patch | 0 ...7-fs-fat-don-t-error-when-mtime-is-0.patch | 0 ...file-show-which-file-filters-get-run.patch | 0 ...ed-array-positions-for-our-allocatio.patch | 0 ...tion-policy-for-kernel-vs-initrd-mem.patch | 0 ...-initrd-within-the-bounds-expressed-.patch | 0 ...ER_-CODE-DATA-for-kernel-and-initrd-.patch | 0 ...e-etc-kernel-cmdline-during-mkconfig.patch | 2 +- ...sh-don-t-dup-rhgb-quiet-check-mtimes.patch | 2 +- ...=> 0275-squish-give-up-on-rhgb-quiet.patch | 2 +- ...write-etc-kernel-cmdline-if-writable.patch | 2 +- ...5-implement-vec5-for-cas-negotiation.patch | 0 ...scfg-Don-t-root-device-in-emu-builds.patch | 0 ...ux-Remove-magic-number-header-field-.patch | 0 ... 0280-Correct-BSS-zeroing-on-aarch64.patch | 0 ...ate-i-cache-before-starting-the-kern.patch | 0 ...ncorrect-array-size-in-kernel-alloca.patch | 0 ...i-tpm-Refine-the-status-of-log-event.patch | 0 ...-Use-grub_strcpy-instead-of-grub_mem.patch | 0 ...-EFI_CC_MEASUREMENT_PROTOCOL-support.patch | 0 grub.patches | 510 +++++++++--------- grub2.spec | 7 +- 259 files changed, 319 insertions(+), 827 deletions(-) rename 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (100%) delete mode 100644 0032-Use-rpm-s-sort-for-grub2-mkconfig.patch rename 0034-Add-friendly-grub2-password-config-tool-985962.patch => 0033-Add-friendly-grub2-password-config-tool-985962.patch (97%) rename 0035-tcp-add-window-scaling-support.patch => 0034-tcp-add-window-scaling-support.patch (100%) rename 0036-efinet-and-bootp-add-support-for-dhcpv6.patch => 0035-efinet-and-bootp-add-support-for-dhcpv6.patch (100%) rename 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (98%) rename 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch => 0037-bz1374141-fix-incorrect-mask-for-ppc64.patch (100%) rename 0039-Make-grub_fatal-also-backtrace.patch => 0038-Make-grub_fatal-also-backtrace.patch (100%) rename 0040-Make-our-info-pages-say-grub2-where-appropriate.patch => 0039-Make-our-info-pages-say-grub2-where-appropriate.patch (100%) rename 0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch (100%) rename 0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (100%) rename 0043-export-btrfs_subvol-and-btrfs_subvolid.patch => 0042-export-btrfs_subvol-and-btrfs_subvolid.patch (100%) rename 0044-grub2-btrfs-03-follow_default.patch => 0043-grub2-btrfs-03-follow_default.patch (100%) rename 0045-grub2-btrfs-04-grub2-install.patch => 0044-grub2-btrfs-04-grub2-install.patch (100%) rename 0046-grub2-btrfs-05-grub2-mkconfig.patch => 0045-grub2-btrfs-05-grub2-mkconfig.patch (98%) rename 0047-grub2-btrfs-06-subvol-mount.patch => 0046-grub2-btrfs-06-subvol-mount.patch (100%) rename 0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (100%) rename 0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (100%) rename 0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (100%) rename 0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch => 0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch (100%) rename 0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch => 0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch (100%) rename 0053-don-t-use-int-for-efi-status.patch => 0052-don-t-use-int-for-efi-status.patch (100%) rename 0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (100%) rename 0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (100%) rename 0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (100%) rename 0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch => 0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch (100%) rename 0058-align-struct-efi_variable-better.patch => 0057-align-struct-efi_variable-better.patch (100%) rename 0059-Add-BLS-support-to-grub-mkconfig.patch => 0058-Add-BLS-support-to-grub-mkconfig.patch (97%) rename 0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (100%) rename 0061-Add-linux-and-initrd-commands-for-grub-emu.patch => 0060-Add-linux-and-initrd-commands-for-grub-emu.patch (100%) rename 0062-Add-grub2-switch-to-blscfg.patch => 0061-Add-grub2-switch-to-blscfg.patch (99%) rename 0063-make-better-backtraces.patch => 0062-make-better-backtraces.patch (99%) rename 0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0063-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (100%) rename 0065-Work-around-some-minor-include-path-weirdnesses.patch => 0064-Work-around-some-minor-include-path-weirdnesses.patch (100%) rename 0066-Make-it-possible-to-enabled-build-id-sha1.patch => 0065-Make-it-possible-to-enabled-build-id-sha1.patch (95%) rename 0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0066-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (100%) rename 0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0067-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (100%) rename 0069-Fixup-for-newer-compiler.patch => 0068-Fixup-for-newer-compiler.patch (100%) rename 0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0069-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (100%) rename 0071-Fixup-for-newer-compiler.patch => 0070-Fixup-for-newer-compiler.patch (100%) rename 0072-Add-support-for-non-Ethernet-network-cards.patch => 0071-Add-support-for-non-Ethernet-network-cards.patch (100%) rename 0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0072-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (100%) rename 0074-bootp-New-net_bootp6-command.patch => 0073-bootp-New-net_bootp6-command.patch (100%) rename 0075-efinet-UEFI-IPv6-PXE-support.patch => 0074-efinet-UEFI-IPv6-PXE-support.patch (100%) rename 0076-grub.texi-Add-net_bootp6-doument.patch => 0075-grub.texi-Add-net_bootp6-doument.patch (100%) rename 0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0076-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (100%) rename 0078-efinet-Setting-network-from-UEFI-device-path.patch => 0077-efinet-Setting-network-from-UEFI-device-path.patch (100%) rename 0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0078-efinet-Setting-DNS-server-from-UEFI-protocol.patch (100%) rename 0080-Support-UEFI-networking-protocols.patch => 0079-Support-UEFI-networking-protocols.patch (100%) rename 0081-AUDIT-0-http-boot-tracker-bug.patch => 0080-AUDIT-0-http-boot-tracker-bug.patch (100%) rename 0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0081-grub-editenv-Add-incr-command-to-increment-integer-v.patch (100%) rename 0083-Add-auto-hide-menu-support.patch => 0082-Add-auto-hide-menu-support.patch (99%) rename 0084-Add-grub-set-bootflag-utility.patch => 0083-Add-grub-set-bootflag-utility.patch (99%) rename 0085-docs-Add-grub-boot-indeterminate.service-example.patch => 0084-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0086-gentpl-add-disable-support.patch => 0085-gentpl-add-disable-support.patch (100%) rename 0087-gentpl-add-pc-firmware-type.patch => 0086-gentpl-add-pc-firmware-type.patch (100%) rename 0088-efinet-also-use-the-firmware-acceleration-for-http.patch => 0087-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0088-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (97%) rename 0091-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0090-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0092-Rework-how-the-fdt-command-builds.patch => 0091-Rework-how-the-fdt-command-builds.patch (100%) rename 0093-Disable-non-wordsize-allocations-on-arm.patch => 0092-Disable-non-wordsize-allocations-on-arm.patch (93%) rename 0094-Prepend-prefix-when-HTTP-path-is-relative.patch => 0093-Prepend-prefix-when-HTTP-path-is-relative.patch (100%) rename 0095-Make-grub_error-more-verbose.patch => 0094-Make-grub_error-more-verbose.patch (100%) rename 0096-Make-reset-an-alias-for-the-reboot-command.patch => 0095-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0097-Add-a-version-command.patch => 0096-Add-a-version-command.patch (98%) rename 0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0097-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (100%) rename 0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0098-arm-arm64-loader-Better-memory-allocation-and-error-.patch (100%) rename 0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0099-Try-to-pick-better-locations-for-kernel-and-initrd.patch (100%) rename 0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (93%) rename 0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (93%) rename 0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0102-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0103-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0104-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (100%) rename 0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0105-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (100%) rename 0107-Fix-getroot.c-s-trampolines.patch => 0106-Fix-getroot.c-s-trampolines.patch (100%) rename 0108-Do-not-allow-stack-trampolines-anywhere.patch => 0107-Do-not-allow-stack-trampolines-anywhere.patch (93%) rename 0109-Reimplement-boot_counter.patch => 0108-Reimplement-boot_counter.patch (99%) rename 0110-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0109-Fix-menu-entry-selection-based-on-ID-and-title.patch (100%) rename 0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0110-Make-the-menu-entry-users-option-argument-to-be-opti.patch (100%) rename 0112-Add-efi-export-env-and-efi-load-env-commands.patch => 0111-Add-efi-export-env-and-efi-load-env-commands.patch (100%) rename 0113-Make-it-possible-to-subtract-conditions-from-debug.patch => 0112-Make-it-possible-to-subtract-conditions-from-debug.patch (100%) rename 0114-Export-all-variables-from-the-initial-context-when-c.patch => 0113-Export-all-variables-from-the-initial-context-when-c.patch (100%) rename 0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (99%) rename 0116-Fix-systemctl-kexec-exit-status-check.patch => 0115-Fix-systemctl-kexec-exit-status-check.patch (100%) rename 0117-Print-grub-emu-linux-loader-messages-as-debug.patch => 0116-Print-grub-emu-linux-loader-messages-as-debug.patch (100%) rename 0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0117-Don-t-assume-that-boot-commands-will-only-return-on-.patch (100%) rename 0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0118-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) rename 0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0119-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) rename 0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0120-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (100%) rename 0122-Add-start-symbol-for-RISC-V.patch => 0121-Add-start-symbol-for-RISC-V.patch (100%) rename 0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0122-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (100%) rename 0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0123-efi-http-Export-fw-http-_path-variables-to-make-them.patch (100%) rename 0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0124-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) rename 0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0125-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0126-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) rename 0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0127-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) rename 0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0128-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (100%) rename 0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0129-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (100%) rename 0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0130-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (100%) rename 0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0131-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (100%) rename 0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0132-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (100%) rename 0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0133-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (100%) rename 0135-efi-dhcp-fix-some-allocation-error-checking.patch => 0134-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0136-efi-http-fix-some-allocation-error-checking.patch => 0135-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0136-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0137-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (100%) rename 0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0138-linuxefi-fail-kernel-validation-without-shim-protoco.patch (100%) rename 0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0139-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (100%) rename 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0140-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) rename 0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0142-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0143-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch (99%) rename 0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0145-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0146-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (100%) rename 0148-grub-install-disable-support-for-EFI-platforms.patch => 0147-grub-install-disable-support-for-EFI-platforms.patch (100%) rename 0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch (95%) rename 0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (100%) rename 0151-Introduce-function-grub_debug_is_enabled-void-return.patch => 0150-Introduce-function-grub_debug_is_enabled-void-return.patch (100%) rename 0152-Don-t-clear-screen-when-debugging-is-enabled.patch => 0151-Don-t-clear-screen-when-debugging-is-enabled.patch (100%) rename 0153-grub_file_-instrumentation-new-file-debug-tag.patch => 0152-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0154-ieee1275-Avoiding-many-unecessary-open-close.patch => 0153-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0154-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0155-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0156-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (100%) rename 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0157-Add-suport-for-signing-grub-with-an-appended-signatu.patch (100%) rename 0159-docs-grub-Document-signing-grub-under-UEFI.patch => 0158-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0159-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) rename 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0160-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0162-pgp-factor-out-rsa_pad.patch => 0161-pgp-factor-out-rsa_pad.patch (100%) rename 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0162-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0163-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0165-libtasn1-import-libtasn1-4.16.0.patch => 0164-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0166-libtasn1-disable-code-not-needed-in-grub.patch => 0165-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0167-libtasn1-changes-for-grub-compatibility.patch => 0166-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0168-libtasn1-compile-into-asn1-module.patch => 0167-libtasn1-compile-into-asn1-module.patch (100%) rename 0169-test_asn1-test-module-for-libtasn1.patch => 0168-test_asn1-test-module-for-libtasn1.patch (99%) rename 0170-grub-install-support-embedding-x509-certificates.patch => 0169-grub-install-support-embedding-x509-certificates.patch (100%) rename 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0170-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0171-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0173-appended-signatures-support-verifying-appended-signa.patch => 0172-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0174-appended-signatures-verification-tests.patch => 0173-appended-signatures-verification-tests.patch (100%) rename 0175-appended-signatures-documentation.patch => 0174-appended-signatures-documentation.patch (100%) rename 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0175-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (100%) rename 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0176-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0178-ieee1275-claim-more-memory.patch => 0177-ieee1275-claim-more-memory.patch (100%) rename 0179-ieee1275-request-memory-with-ibm-client-architecture.patch => 0178-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) rename 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0179-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) rename 0181-ieee1275-ofdisk-retry-on-open-failure.patch => 0180-ieee1275-ofdisk-retry-on-open-failure.patch (100%) rename 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0181-Allow-chainloading-EFI-apps-from-loop-mounts.patch (100%) rename 0183-efinet-Add-DHCP-proxy-support.patch => 0182-efinet-Add-DHCP-proxy-support.patch (100%) rename 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0183-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (97%) rename 0186-Suppress-gettext-error-message.patch => 0185-Suppress-gettext-error-message.patch (100%) rename 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0186-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) rename 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0187-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) rename 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0188-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0189-arm64-Fix-EFI-loader-kernel-image-allocation.patch (100%) rename 0191-normal-main-Discover-the-device-to-read-the-config-f.patch => 0190-normal-main-Discover-the-device-to-read-the-config-f.patch (100%) rename 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0191-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (100%) rename 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0192-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) rename 0194-Print-module-name-on-license-check-failure.patch => 0193-Print-module-name-on-license-check-failure.patch (100%) rename 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0194-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (100%) rename 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0195-grub-mkconfig-restore-umask-for-grub.cfg.patch (100%) rename 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0196-fs-btrfs-Use-full-btrfs-bootloader-area.patch (100%) rename 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch => 0197-Add-Fedora-location-of-DejaVu-SANS-font.patch (95%) rename 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch => 0198-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch (100%) rename 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch => 0199-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch (100%) rename 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch => 0200-EFI-console-Do-not-set-colorstate-until-the-first-te.patch (100%) rename 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch => 0201-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch (100%) rename 0203-Use-visual-indentation-in-config.h.in.patch => 0202-Use-visual-indentation-in-config.h.in.patch (100%) rename 0204-Where-present-ensure-config-util.h-precedes-config.h.patch => 0203-Where-present-ensure-config-util.h-precedes-config.h.patch (100%) rename 0205-Drop-gnulib-fix-base64.patch.patch => 0204-Drop-gnulib-fix-base64.patch.patch (100%) rename 0206-Drop-gnulib-no-abort.patch.patch => 0205-Drop-gnulib-no-abort.patch.patch (100%) rename 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch => 0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch (99%) rename 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch => 0207-commands-search-Fix-bug-stopping-iteration-when-no-f.patch (100%) rename 0209-search-new-efidisk-only-option-on-EFI-systems.patch => 0208-search-new-efidisk-only-option-on-EFI-systems.patch (100%) rename 0210-efi-new-connectefi-command.patch => 0209-efi-new-connectefi-command.patch (100%) rename 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch => 0210-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch (100%) rename 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch => 0211-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch (100%) rename 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch => 0212-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch (100%) rename 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch => 0213-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch (100%) rename 0215-powerpc-do-CAS-in-a-more-compatible-way.patch => 0214-powerpc-do-CAS-in-a-more-compatible-way.patch (100%) rename 0216-powerpc-prefix-detection-support-device-names-with-c.patch => 0215-powerpc-prefix-detection-support-device-names-with-c.patch (100%) rename 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch => 0216-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch (100%) rename 0219-make-ofdisk_retries-optional.patch => 0217-make-ofdisk_retries-optional.patch (100%) rename 0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch => 0218-loader-efi-chainloader-grub_load_and_start_image-doe.patch (100%) delete mode 100644 0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch rename 0221-loader-efi-chainloader-simplify-the-loader-state.patch => 0219-loader-efi-chainloader-simplify-the-loader-state.patch (100%) rename 0222-commands-boot-Add-API-to-pass-context-to-loader.patch => 0220-commands-boot-Add-API-to-pass-context-to-loader.patch (100%) rename 0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch => 0221-loader-efi-chainloader-Use-grub_loader_set_ex.patch (100%) rename 0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch => 0222-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch (100%) rename 0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch => 0223-loader-i386-efi-linux-Use-grub_loader_set_ex.patch (100%) rename 0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch => 0224-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch (100%) rename 0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch => 0225-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch (100%) rename 0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch => 0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch (100%) rename 0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch => 0227-video-readers-png-Abort-sooner-if-a-read-operation-f.patch (100%) rename 0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch => 0228-video-readers-png-Refuse-to-handle-multiple-image-he.patch (100%) rename 0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch => 0229-video-readers-png-Drop-greyscale-support-to-fix-heap.patch (100%) rename 0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch => 0230-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch (100%) rename 0233-video-readers-png-Sanity-check-some-huffman-codes.patch => 0231-video-readers-png-Sanity-check-some-huffman-codes.patch (100%) rename 0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch => 0232-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch (100%) rename 0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch => 0233-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch (100%) rename 0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch => 0234-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch (100%) rename 0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch => 0235-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch (100%) rename 0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch => 0236-normal-charset-Fix-array-out-of-bounds-formatting-un.patch (100%) rename 0239-net-netbuff-Block-overly-large-netbuff-allocs.patch => 0237-net-netbuff-Block-overly-large-netbuff-allocs.patch (100%) rename 0240-net-ip-Do-IP-fragment-maths-safely.patch => 0238-net-ip-Do-IP-fragment-maths-safely.patch (100%) rename 0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch => 0239-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch (100%) rename 0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch => 0240-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch (100%) rename 0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch => 0241-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch (100%) rename 0244-net-tftp-Avoid-a-trivial-UAF.patch => 0242-net-tftp-Avoid-a-trivial-UAF.patch (100%) rename 0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch => 0243-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch (100%) rename 0246-net-http-Fix-OOB-write-for-split-http-headers.patch => 0244-net-http-Fix-OOB-write-for-split-http-headers.patch (100%) rename 0247-net-http-Error-out-on-headers-with-LF-without-CR.patch => 0245-net-http-Error-out-on-headers-with-LF-without-CR.patch (100%) rename 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch => 0246-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch (100%) rename 0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch => 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch (100%) rename 0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch => 0248-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch (100%) rename 0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch => 0249-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch (100%) rename 0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch => 0250-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch (100%) rename 0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch => 0251-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch (100%) rename 0254-misc-Make-grub_min-and-grub_max-more-resilient.patch => 0252-misc-Make-grub_min-and-grub_max-more-resilient.patch (100%) rename 0255-ReiserFS-switch-to-using-grub_min-grub_max.patch => 0253-ReiserFS-switch-to-using-grub_min-grub_max.patch (100%) rename 0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch => 0254-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch (100%) rename 0257-modules-make-.module_license-read-only.patch => 0255-modules-make-.module_license-read-only.patch (100%) rename 0258-modules-strip-.llvm_addrsig-sections-and-similar.patch => 0256-modules-strip-.llvm_addrsig-sections-and-similar.patch (100%) rename 0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch => 0257-modules-Don-t-allocate-space-for-non-allocable-secti.patch (100%) rename 0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch => 0258-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch (100%) rename 0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch => 0259-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch (100%) rename 0262-modules-load-module-sections-at-page-aligned-address.patch => 0260-modules-load-module-sections-at-page-aligned-address.patch (100%) rename 0263-nx-add-memory-attribute-get-set-API.patch => 0261-nx-add-memory-attribute-get-set-API.patch (100%) rename 0264-nx-set-page-permissions-for-loaded-modules.patch => 0262-nx-set-page-permissions-for-loaded-modules.patch (100%) rename 0265-nx-set-attrs-in-our-kernel-loaders.patch => 0263-nx-set-attrs-in-our-kernel-loaders.patch (100%) rename 0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch => 0264-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch (100%) rename 0267-grub-probe-document-the-behavior-of-multiple-v.patch => 0265-grub-probe-document-the-behavior-of-multiple-v.patch (100%) rename 0268-grub_fs_probe-dprint-errors-from-filesystems.patch => 0266-grub_fs_probe-dprint-errors-from-filesystems.patch (100%) rename 0269-fs-fat-don-t-error-when-mtime-is-0.patch => 0267-fs-fat-don-t-error-when-mtime-is-0.patch (100%) rename 0270-Make-debug-file-show-which-file-filters-get-run.patch => 0268-Make-debug-file-show-which-file-filters-get-run.patch (100%) rename 0271-efi-use-enumerated-array-positions-for-our-allocatio.patch => 0269-efi-use-enumerated-array-positions-for-our-allocatio.patch (100%) rename 0272-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch => 0270-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch (100%) rename 0273-efi-allocate-the-initrd-within-the-bounds-expressed-.patch => 0271-efi-allocate-the-initrd-within-the-bounds-expressed-.patch (100%) rename 0274-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch => 0272-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch (100%) rename 0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch => 0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch (96%) rename 0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch => 0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch (97%) rename 0277-squish-give-up-on-rhgb-quiet.patch => 0275-squish-give-up-on-rhgb-quiet.patch (95%) rename 0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch => 0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch (98%) rename 0279-ieee1275-implement-vec5-for-cas-negotiation.patch => 0277-ieee1275-implement-vec5-for-cas-negotiation.patch (100%) rename 0280-blscfg-Don-t-root-device-in-emu-builds.patch => 0278-blscfg-Don-t-root-device-in-emu-builds.patch (100%) rename 0281-loader-arm64-linux-Remove-magic-number-header-field-.patch => 0279-loader-arm64-linux-Remove-magic-number-header-field-.patch (100%) rename 0282-Correct-BSS-zeroing-on-aarch64.patch => 0280-Correct-BSS-zeroing-on-aarch64.patch (100%) rename 0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch => 0281-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch (100%) rename 0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch => 0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch (100%) rename 0285-commands-efi-tpm-Refine-the-status-of-log-event.patch => 0283-commands-efi-tpm-Refine-the-status-of-log-event.patch (100%) rename 0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch => 0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch (100%) rename 0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch => 0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch (100%) diff --git a/0010-re-write-.gitignore.patch b/0010-re-write-.gitignore.patch index 3e0b46c8..b6fa0beb 100644 --- a/0010-re-write-.gitignore.patch +++ b/0010-re-write-.gitignore.patch @@ -4,14 +4,14 @@ Date: Mon, 8 Jul 2019 12:55:29 +0200 Subject: [PATCH] re-write .gitignore --- - .gitignore | 152 ++++++++++++++++++++++++++++++++++++++ + .gitignore | 150 ++++++++++++++++++++++++++++++++++++++ docs/.gitignore | 5 ++ grub-core/.gitignore | 16 ++++ grub-core/lib/.gitignore | 1 + include/grub/gcrypt/.gitignore | 2 + po/.gitignore | 5 ++ util/bash-completion.d/.gitignore | 2 + - 7 files changed, 183 insertions(+) + 7 files changed, 181 insertions(+) create mode 100644 docs/.gitignore create mode 100644 grub-core/.gitignore create mode 100644 grub-core/lib/.gitignore @@ -20,10 +20,10 @@ Subject: [PATCH] re-write .gitignore create mode 100644 util/bash-completion.d/.gitignore diff --git a/.gitignore b/.gitignore -index f6a1bd0517..594d0134d3 100644 +index f6a1bd0517..208d1d2325 100644 --- a/.gitignore +++ b/.gitignore -@@ -275,3 +275,155 @@ widthspec.bin +@@ -275,3 +275,153 @@ widthspec.bin /xfs_test /xzcompress_test /zfs_test @@ -152,8 +152,6 @@ index f6a1bd0517..594d0134d3 100644 +/grub*-reboot.8 +/grub*-render-label +/grub*-render-label.1 -+/grub*-rpm-sort -+/grub*-rpm-sort.8 +/grub*-script-check +/grub*-script-check.1 +/grub*-set-bootflag diff --git a/0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 100% rename from 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch diff --git a/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch b/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch deleted file mode 100644 index 9463ef82..00000000 --- a/0032-Use-rpm-s-sort-for-grub2-mkconfig.patch +++ /dev/null @@ -1,457 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robert Marshall -Date: Mon, 16 Mar 2015 14:14:19 -0400 -Subject: [PATCH] Use rpm's sort for grub2-mkconfig - -Add an option for rpm-based systems to use the rpm-sort library to sort -kernels. This avoids problems due to discrepancies between `sort -V` -and rpm. - -Signed-off-by: Robert Marshall -[pjones: fix --enable-rpm-sort configure option] -Signed-off-by: Peter Jones -[thierry.vignaud: fix build with rpm-4.16] -Signed-off-by: Thierry Vignaud -[tim: fix disabling grub-rpm-sort by ./configure] -Signed-off-by: Tim Landscheidt -[javierm: don't check for rpmvercmp in librpm] -Signed-off-by: Javier Martinez Canillas -[rharwood: commit message, migrate to h2m] -Signed-off-by: Robbie Harwood ---- - configure.ac | 36 ++++++ - Makefile.util.def | 17 +++ - util/grub-rpm-sort.c | 281 +++++++++++++++++++++++++++++++++++++++++++++ - docs/man/grub-rpm-sort.h2m | 2 + - util/grub-mkconfig_lib.in | 11 +- - 5 files changed, 346 insertions(+), 1 deletion(-) - create mode 100644 util/grub-rpm-sort.c - create mode 100644 docs/man/grub-rpm-sort.h2m - -diff --git a/configure.ac b/configure.ac -index 8331f95b64..87c8f17393 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) - grub_TRANSFORM([grub-mkrescue]) - grub_TRANSFORM([grub-probe]) - grub_TRANSFORM([grub-reboot]) -+grub_TRANSFORM([grub-rpm-sort]) - grub_TRANSFORM([grub-script-check]) - grub_TRANSFORM([grub-set-default]) - grub_TRANSFORM([grub-sparc64-setup]) -@@ -1837,6 +1838,35 @@ fi - - AC_SUBST([LIBDEVMAPPER]) - -+AC_ARG_ENABLE([rpm-sort], -+ [AS_HELP_STRING([--enable-rpm-sort], -+ [enable native rpm sorting of kernels in grub (default=guessed)])]) -+if test x"$enable_rpm_sort" = xno ; then -+ rpm_sort_excuse="explicitly disabled" -+else -+ enable_rpm_sort=yes -+fi -+ -+if test x"$rpm_sort_excuse" = x ; then -+ # Check for rpmlib header. -+ AC_CHECK_HEADER([rpm/rpmlib.h], [], -+ [rpm_sort_excuse="need rpm/rpmlib header"]) -+fi -+ -+if test x"$rpm_sort_excuse" = x ; then -+ # Check for rpmio library. -+ AC_CHECK_LIB([rpmio], [rpmvercmp], [], -+ [rpm_sort_excuse="rpmio missing rpmvercmp"]) -+fi -+ -+if test x"$rpm_sort_excuse" = x ; then -+ LIBRPM="-lrpmio"; -+ AC_DEFINE([HAVE_RPMIO], [1], -+ [Define to 1 if you have the rpmio library.]) -+fi -+ -+AC_SUBST([LIBRPM]) -+ - LIBGEOM= - if test x$host_kernel = xkfreebsd; then - AC_CHECK_LIB([geom], [geom_gettree], [], -@@ -2024,6 +2054,7 @@ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) - AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) - AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) - AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes]) -+AM_CONDITIONAL([COND_GRUB_RPM_SORT], [test x$enable_rpm_sort = xyes]) - AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) - if test x$FONT_SOURCE != x ; then - HAVE_FONT_SOURCE=1 -@@ -2145,6 +2176,11 @@ echo grub-mount: Yes - else - echo grub-mount: No "($grub_mount_excuse)" - fi -+if [ x"$rpm_sort_excuse" = x ]; then -+echo grub-rpm-sort: Yes -+else -+echo grub-rpm-sort: No "($rpm_sort_excuse)" -+fi - if [ x"$starfield_excuse" = x ]; then - echo starfield theme: Yes - echo With DejaVuSans font from $DJVU_FONT_SOURCE -diff --git a/Makefile.util.def b/Makefile.util.def -index 2c9b283a23..bc10cc7972 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -703,6 +703,23 @@ program = { - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - }; - -+program = { -+ name = grub-rpm-sort; -+ mansection = 8; -+ installdir = sbin; -+ -+ common = grub-core/kern/emu/misc.c; -+ common = grub-core/kern/emu/argp_common.c; -+ common = grub-core/osdep/init.c; -+ common = util/misc.c; -+ common = util/grub-rpm-sort.c; -+ -+ ldadd = libgrubkern.a; -+ ldadd = grub-core/lib/gnulib/libgnu.a; -+ ldadd = '$(LIBDEVMAPPER) $(LIBRPM)'; -+ condition = COND_GRUB_RPM_SORT; -+}; -+ - script = { - name = grub-mkconfig; - common = util/grub-mkconfig.in; -diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c -new file mode 100644 -index 0000000000..f33bd1ed56 ---- /dev/null -+++ b/util/grub-rpm-sort.c -@@ -0,0 +1,281 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static size_t -+read_file (const char *input, char **ret) -+{ -+ FILE *in; -+ size_t s; -+ size_t sz = 2048; -+ size_t offset = 0; -+ char *text; -+ -+ if (!strcmp(input, "-")) -+ in = stdin; -+ else -+ in = grub_util_fopen(input, "r"); -+ -+ text = xmalloc (sz); -+ -+ if (!in) -+ grub_util_error (_("cannot open `%s': %s"), input, strerror (errno)); -+ -+ while ((s = fread (text + offset, 1, sz - offset, in)) != 0) -+ { -+ offset += s; -+ if (sz - offset == 0) -+ { -+ sz += 2048; -+ text = xrealloc (text, sz); -+ } -+ } -+ -+ text[offset] = '\0'; -+ *ret = text; -+ -+ if (in != stdin) -+ fclose(in); -+ -+ return offset + 1; -+} -+ -+/* returns name/version/release */ -+/* NULL string pointer returned if nothing found */ -+static void -+split_package_string (char *package_string, char **name, -+ char **version, char **release) -+{ -+ char *package_version, *package_release; -+ -+ /* Release */ -+ package_release = strrchr (package_string, '-'); -+ -+ if (package_release != NULL) -+ *package_release++ = '\0'; -+ -+ *release = package_release; -+ -+ /* Version */ -+ package_version = strrchr(package_string, '-'); -+ -+ if (package_version != NULL) -+ *package_version++ = '\0'; -+ -+ *version = package_version; -+ /* Name */ -+ *name = package_string; -+ -+ /* Bubble up non-null values from release to name */ -+ if (*name == NULL) -+ { -+ *name = (*version == NULL ? *release : *version); -+ *version = *release; -+ *release = NULL; -+ } -+ if (*version == NULL) -+ { -+ *version = *release; -+ *release = NULL; -+ } -+} -+ -+/* -+ * package name-version-release comparator for qsort -+ * expects p, q which are pointers to character strings (char *) -+ * which will not be altered in this function -+ */ -+static int -+package_version_compare (const void *p, const void *q) -+{ -+ char *local_p, *local_q; -+ char *lhs_name, *lhs_version, *lhs_release; -+ char *rhs_name, *rhs_version, *rhs_release; -+ int vercmpflag = 0; -+ -+ local_p = alloca (strlen (*(char * const *)p) + 1); -+ local_q = alloca (strlen (*(char * const *)q) + 1); -+ -+ /* make sure these allocated */ -+ assert (local_p); -+ assert (local_q); -+ -+ strcpy (local_p, *(char * const *)p); -+ strcpy (local_q, *(char * const *)q); -+ -+ split_package_string (local_p, &lhs_name, &lhs_version, &lhs_release); -+ split_package_string (local_q, &rhs_name, &rhs_version, &rhs_release); -+ -+ /* Check Name and return if unequal */ -+ vercmpflag = rpmvercmp ((lhs_name == NULL ? "" : lhs_name), -+ (rhs_name == NULL ? "" : rhs_name)); -+ if (vercmpflag != 0) -+ return vercmpflag; -+ -+ /* Check version and return if unequal */ -+ vercmpflag = rpmvercmp ((lhs_version == NULL ? "" : lhs_version), -+ (rhs_version == NULL ? "" : rhs_version)); -+ if (vercmpflag != 0) -+ return vercmpflag; -+ -+ /* Check release and return the version compare value */ -+ vercmpflag = rpmvercmp ((lhs_release == NULL ? "" : lhs_release), -+ (rhs_release == NULL ? "" : rhs_release)); -+ -+ return vercmpflag; -+} -+ -+static void -+add_input (const char *filename, char ***package_names, size_t *n_package_names) -+{ -+ char *orig_input_buffer = NULL; -+ char *input_buffer; -+ char *position_of_newline; -+ char **names = *package_names; -+ char **new_names = NULL; -+ size_t n_names = *n_package_names; -+ -+ if (!*package_names) -+ new_names = names = xmalloc (sizeof (char *) * 2); -+ -+ if (read_file (filename, &orig_input_buffer) < 2) -+ { -+ if (new_names) -+ free (new_names); -+ if (orig_input_buffer) -+ free (orig_input_buffer); -+ return; -+ } -+ -+ input_buffer = orig_input_buffer; -+ while (input_buffer && *input_buffer && -+ (position_of_newline = strchrnul (input_buffer, '\n'))) -+ { -+ size_t sz = position_of_newline - input_buffer; -+ char *new; -+ -+ if (sz == 0) -+ { -+ input_buffer = position_of_newline + 1; -+ continue; -+ } -+ -+ new = xmalloc (sz+1); -+ strncpy (new, input_buffer, sz); -+ new[sz] = '\0'; -+ -+ names = xrealloc (names, sizeof (char *) * (n_names + 1)); -+ names[n_names] = new; -+ n_names++; -+ -+ /* move buffer ahead to next line */ -+ input_buffer = position_of_newline + 1; -+ if (*position_of_newline == '\0') -+ input_buffer = NULL; -+ } -+ -+ free (orig_input_buffer); -+ -+ *package_names = names; -+ *n_package_names = n_names; -+} -+ -+static char * -+help_filter (int key, const char *text, void *input __attribute__ ((unused))) -+{ -+ return (char *)text; -+} -+ -+static struct argp_option options[] = { -+ { 0, } -+}; -+ -+struct arguments -+{ -+ size_t ninputs; -+ size_t input_max; -+ char **inputs; -+}; -+ -+static error_t -+argp_parser (int key, char *arg, struct argp_state *state) -+{ -+ struct arguments *arguments = state->input; -+ switch (key) -+ { -+ case ARGP_KEY_ARG: -+ assert (arguments->ninputs < arguments->input_max); -+ arguments->inputs[arguments->ninputs++] = xstrdup (arg); -+ break; -+ default: -+ return ARGP_ERR_UNKNOWN; -+ } -+ return 0; -+} -+ -+static struct argp argp = { -+ options, argp_parser, N_("[INPUT_FILES]"), -+ N_("Sort a list of strings in RPM version sort order."), -+ NULL, help_filter, NULL -+}; -+ -+int -+main (int argc, char *argv[]) -+{ -+ struct arguments arguments; -+ char **package_names = NULL; -+ size_t n_package_names = 0; -+ int i; -+ -+ grub_util_host_init (&argc, &argv); -+ -+ memset (&arguments, 0, sizeof (struct arguments)); -+ arguments.input_max = argc+1; -+ arguments.inputs = xmalloc ((arguments.input_max + 1) -+ * sizeof (arguments.inputs[0])); -+ memset (arguments.inputs, 0, (arguments.input_max + 1) -+ * sizeof (arguments.inputs[0])); -+ -+ /* Parse our arguments */ -+ if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0) -+ grub_util_error ("%s", _("Error in parsing command line arguments\n")); -+ -+ /* If there's no inputs in argv, add one for stdin */ -+ if (!arguments.ninputs) -+ { -+ arguments.ninputs = 1; -+ arguments.inputs[0] = xmalloc (2); -+ strcpy(arguments.inputs[0], "-"); -+ } -+ -+ for (i = 0; i < arguments.ninputs; i++) -+ add_input(arguments.inputs[i], &package_names, &n_package_names); -+ -+ if (package_names == NULL || n_package_names < 1) -+ grub_util_error ("%s", _("Invalid input\n")); -+ -+ qsort (package_names, n_package_names, sizeof (char *), -+ package_version_compare); -+ -+ /* send sorted list to stdout */ -+ for (i = 0; i < n_package_names; i++) -+ { -+ fprintf (stdout, "%s\n", package_names[i]); -+ free (package_names[i]); -+ } -+ -+ free (package_names); -+ for (i = 0; i < arguments.ninputs; i++) -+ free (arguments.inputs[i]); -+ -+ free (arguments.inputs); -+ -+ return 0; -+} -diff --git a/docs/man/grub-rpm-sort.h2m b/docs/man/grub-rpm-sort.h2m -new file mode 100644 -index 0000000000..fe711ae102 ---- /dev/null -+++ b/docs/man/grub-rpm-sort.h2m -@@ -0,0 +1,2 @@ -+[NAME] -+grub-rpm-sort \- sort input according to RPM version compare -diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 0f6505bf3b..42c2ea9ba5 100644 ---- a/util/grub-mkconfig_lib.in -+++ b/util/grub-mkconfig_lib.in -@@ -33,6 +33,9 @@ fi - if test "x$grub_mkrelpath" = x; then - grub_mkrelpath="${bindir}/@grub_mkrelpath@" - fi -+if test "x$grub_rpm_sort" = x; then -+ grub_rpm_sort="${sbindir}/@grub_rpm_sort@" -+fi - - if command -v gettext >/dev/null; then - : -@@ -218,6 +221,12 @@ version_sort () - esac - } - -+if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then -+ kernel_sort="$grub_rpm_sort" -+else -+ kernel_sort=version_sort -+fi -+ - version_test_numeric () - { - version_test_numeric_a="$1" -@@ -234,7 +243,7 @@ version_test_numeric () - version_test_numeric_a="$version_test_numeric_b" - version_test_numeric_b="$version_test_numeric_c" - fi -- if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then -+ if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | "$kernel_sort" | head -n 1 | grep -qx "$version_test_numeric_b" ; then - return 0 - else - return 1 diff --git a/0034-Add-friendly-grub2-password-config-tool-985962.patch b/0033-Add-friendly-grub2-password-config-tool-985962.patch similarity index 97% rename from 0034-Add-friendly-grub2-password-config-tool-985962.patch rename to 0033-Add-friendly-grub2-password-config-tool-985962.patch index 49089f95..f430e966 100644 --- a/0034-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0033-Add-friendly-grub2-password-config-tool-985962.patch @@ -14,7 +14,7 @@ Signed-off-by: Robert Marshall Signed-off-by: Peter Jones [luto: fix grub-setpassword -o's output path] Signed-off-by: Andy Lutomirski -[rharwood: migrate man page to h2m] +[rharwood: migrate man page to h2m, context] Signed-off-by: Robbie Harwood --- configure.ac | 1 + @@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index 87c8f17393..916bede6bf 100644 +index 8331f95b64..7f59ad788f 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -37,11 +37,11 @@ index 87c8f17393..916bede6bf 100644 grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-reboot]) +grub_TRANSFORM([grub-set-password]) - grub_TRANSFORM([grub-rpm-sort]) grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) + grub_TRANSFORM([grub-sparc64-setup]) diff --git a/Makefile.util.def b/Makefile.util.def -index bc10cc7972..8ca4c14f0b 100644 +index 2c9b283a23..4ee22c5daa 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -452,6 +452,12 @@ script = { @@ -57,7 +57,7 @@ index bc10cc7972..8ca4c14f0b 100644 script = { name = '10_windows'; common = util/grub.d/10_windows.in; -@@ -741,6 +747,13 @@ script = { +@@ -724,6 +730,13 @@ script = { installdir = sbin; }; diff --git a/0035-tcp-add-window-scaling-support.patch b/0034-tcp-add-window-scaling-support.patch similarity index 100% rename from 0035-tcp-add-window-scaling-support.patch rename to 0034-tcp-add-window-scaling-support.patch diff --git a/0036-efinet-and-bootp-add-support-for-dhcpv6.patch b/0035-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 100% rename from 0036-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0035-efinet-and-bootp-add-support-for-dhcpv6.patch diff --git a/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 98% rename from 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index b3f5df40..95490cd0 100644 --- a/0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -24,7 +24,7 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 916bede6bf..4f1676967e 100644 +index 7f59ad788f..0d0e6782a1 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) @@ -36,10 +36,10 @@ index 916bede6bf..4f1676967e 100644 grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) diff --git a/Makefile.util.def b/Makefile.util.def -index 8ca4c14f0b..43a1c7453b 100644 +index 4ee22c5daa..18a9242776 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -733,6 +733,13 @@ script = { +@@ -716,6 +716,13 @@ script = { installdir = sbin; }; diff --git a/0038-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0037-bz1374141-fix-incorrect-mask-for-ppc64.patch similarity index 100% rename from 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch rename to 0037-bz1374141-fix-incorrect-mask-for-ppc64.patch diff --git a/0039-Make-grub_fatal-also-backtrace.patch b/0038-Make-grub_fatal-also-backtrace.patch similarity index 100% rename from 0039-Make-grub_fatal-also-backtrace.patch rename to 0038-Make-grub_fatal-also-backtrace.patch diff --git a/0040-Make-our-info-pages-say-grub2-where-appropriate.patch b/0039-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 100% rename from 0040-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0039-Make-our-info-pages-say-grub2-where-appropriate.patch diff --git a/0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 100% rename from 0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch diff --git a/0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 100% rename from 0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch diff --git a/0043-export-btrfs_subvol-and-btrfs_subvolid.patch b/0042-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 100% rename from 0043-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0042-export-btrfs_subvol-and-btrfs_subvolid.patch diff --git a/0044-grub2-btrfs-03-follow_default.patch b/0043-grub2-btrfs-03-follow_default.patch similarity index 100% rename from 0044-grub2-btrfs-03-follow_default.patch rename to 0043-grub2-btrfs-03-follow_default.patch diff --git a/0045-grub2-btrfs-04-grub2-install.patch b/0044-grub2-btrfs-04-grub2-install.patch similarity index 100% rename from 0045-grub2-btrfs-04-grub2-install.patch rename to 0044-grub2-btrfs-04-grub2-install.patch diff --git a/0046-grub2-btrfs-05-grub2-mkconfig.patch b/0045-grub2-btrfs-05-grub2-mkconfig.patch similarity index 98% rename from 0046-grub2-btrfs-05-grub2-mkconfig.patch rename to 0045-grub2-btrfs-05-grub2-mkconfig.patch index 06d15a7c..ca3f86b6 100644 --- a/0046-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0045-grub2-btrfs-05-grub2-mkconfig.patch @@ -27,10 +27,10 @@ index 005f093809..535c0f0249 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 42c2ea9ba5..fafeac9506 100644 +index 0f6505bf3b..5e96f6cc5d 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in -@@ -52,7 +52,11 @@ grub_warn () +@@ -49,7 +49,11 @@ grub_warn () make_system_path_relative_to_its_root () { diff --git a/0047-grub2-btrfs-06-subvol-mount.patch b/0046-grub2-btrfs-06-subvol-mount.patch similarity index 100% rename from 0047-grub2-btrfs-06-subvol-mount.patch rename to 0046-grub2-btrfs-06-subvol-mount.patch diff --git a/0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 100% rename from 0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch diff --git a/0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 100% rename from 0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch diff --git a/0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 100% rename from 0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch diff --git a/0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch similarity index 100% rename from 0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename to 0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch diff --git a/0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch similarity index 100% rename from 0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename to 0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch diff --git a/0053-don-t-use-int-for-efi-status.patch b/0052-don-t-use-int-for-efi-status.patch similarity index 100% rename from 0053-don-t-use-int-for-efi-status.patch rename to 0052-don-t-use-int-for-efi-status.patch diff --git a/0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 100% rename from 0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch diff --git a/0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 100% rename from 0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch diff --git a/0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 100% rename from 0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch diff --git a/0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch similarity index 100% rename from 0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename to 0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch diff --git a/0058-align-struct-efi_variable-better.patch b/0057-align-struct-efi_variable-better.patch similarity index 100% rename from 0058-align-struct-efi_variable-better.patch rename to 0057-align-struct-efi_variable-better.patch diff --git a/0059-Add-BLS-support-to-grub-mkconfig.patch b/0058-Add-BLS-support-to-grub-mkconfig.patch similarity index 97% rename from 0059-Add-BLS-support-to-grub-mkconfig.patch rename to 0058-Add-BLS-support-to-grub-mkconfig.patch index 4c3f56f9..3e5b230d 100644 --- a/0059-Add-BLS-support-to-grub-mkconfig.patch +++ b/0058-Add-BLS-support-to-grub-mkconfig.patch @@ -24,7 +24,7 @@ Signed-off-by: Peter Jones Signed-off-by: Javier Martinez Canillas [iwienand@redhat.com: skip machine ID check when updating entries] Signed-off-by: Ian Wienand -[rharwood: commit message composits, drop man pages] +[rharwood: use sort(1), commit message composits, drop man pages] Signed-off-by: Robbie Harwood --- util/grub-mkconfig.in | 9 +- @@ -74,7 +74,7 @@ index 535c0f0249..f55339a3f6 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index fafeac9506..d8bb406936 100644 +index 5e96f6cc5d..301d8a8a1e 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -30,6 +30,9 @@ fi @@ -87,7 +87,7 @@ index fafeac9506..d8bb406936 100644 if test "x$grub_mkrelpath" = x; then grub_mkrelpath="${bindir}/@grub_mkrelpath@" fi -@@ -125,8 +128,19 @@ EOF +@@ -122,8 +125,19 @@ EOF fi } @@ -107,7 +107,7 @@ index fafeac9506..d8bb406936 100644 old_ifs="$IFS" IFS=' ' -@@ -161,18 +175,18 @@ prepare_grub_to_access_device () +@@ -158,18 +172,18 @@ prepare_grub_to_access_device () # otherwise set root as per value in device.map. fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`" if [ "x$fs_hint" != x ]; then @@ -131,7 +131,7 @@ index fafeac9506..d8bb406936 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 7bb3a211a7..f1548a2605 100644 +index 7bb3a211a7..2851952659 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -82,6 +82,218 @@ case x"$GRUB_FS" in @@ -207,7 +207,7 @@ index 7bb3a211a7..f1548a2605 100644 + bls="${bls%.conf}" + bls="${bls##*/}" + echo "${bls}" -+ done | ${kernel_sort} 2>/dev/null | tac)) || : ++ done | sort -Vr 2>/dev/null)) || : + + echo "${files[@]}" +} diff --git a/0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 100% rename from 0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch diff --git a/0061-Add-linux-and-initrd-commands-for-grub-emu.patch b/0060-Add-linux-and-initrd-commands-for-grub-emu.patch similarity index 100% rename from 0061-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0060-Add-linux-and-initrd-commands-for-grub-emu.patch diff --git a/0062-Add-grub2-switch-to-blscfg.patch b/0061-Add-grub2-switch-to-blscfg.patch similarity index 99% rename from 0062-Add-grub2-switch-to-blscfg.patch rename to 0061-Add-grub2-switch-to-blscfg.patch index e3144df6..e3161161 100644 --- a/0062-Add-grub2-switch-to-blscfg.patch +++ b/0061-Add-grub2-switch-to-blscfg.patch @@ -20,10 +20,10 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index 43a1c7453b..a90879fa9b 100644 +index 18a9242776..88f55e35c4 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1365,6 +1365,13 @@ program = { +@@ -1348,6 +1348,13 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -381,7 +381,7 @@ index 0000000000..a851424beb +# Bye. +exit 0 diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index f1548a2605..c02c1f0820 100644 +index 2851952659..e490e1a43a 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -138,7 +138,7 @@ blsdir="/boot/loader/entries" diff --git a/0063-make-better-backtraces.patch b/0062-make-better-backtraces.patch similarity index 99% rename from 0063-make-better-backtraces.patch rename to 0062-make-better-backtraces.patch index ffdb8953..e6ae4e96 100644 --- a/0063-make-better-backtraces.patch +++ b/0062-make-better-backtraces.patch @@ -38,7 +38,7 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index a90879fa9b..48512bc631 100644 +index 88f55e35c4..bda9fd1211 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -51,6 +51,12 @@ library = { diff --git a/0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0063-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 100% rename from 0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0063-normal-don-t-draw-our-startup-message-if-debug-is-se.patch diff --git a/0065-Work-around-some-minor-include-path-weirdnesses.patch b/0064-Work-around-some-minor-include-path-weirdnesses.patch similarity index 100% rename from 0065-Work-around-some-minor-include-path-weirdnesses.patch rename to 0064-Work-around-some-minor-include-path-weirdnesses.patch diff --git a/0066-Make-it-possible-to-enabled-build-id-sha1.patch b/0065-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 95% rename from 0066-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0065-Make-it-possible-to-enabled-build-id-sha1.patch index 592635aa..99d80552 100644 --- a/0066-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0065-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index 4f1676967e..b809c00784 100644 +index 0d0e6782a1..302300711f 100644 --- a/configure.ac +++ b/configure.ac -@@ -1443,7 +1443,15 @@ grub_PROG_TARGET_CC +@@ -1442,7 +1442,15 @@ grub_PROG_TARGET_CC if test "x$TARGET_APPLE_LINKER" != x1 ; then grub_PROG_OBJCOPY_ABSOLUTE fi diff --git a/0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0066-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 100% rename from 0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0066-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch diff --git a/0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0067-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 100% rename from 0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0067-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch diff --git a/0069-Fixup-for-newer-compiler.patch b/0068-Fixup-for-newer-compiler.patch similarity index 100% rename from 0069-Fixup-for-newer-compiler.patch rename to 0068-Fixup-for-newer-compiler.patch diff --git a/0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0069-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 100% rename from 0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0069-Don-t-attempt-to-export-the-start-and-_start-symbols.patch diff --git a/0071-Fixup-for-newer-compiler.patch b/0070-Fixup-for-newer-compiler.patch similarity index 100% rename from 0071-Fixup-for-newer-compiler.patch rename to 0070-Fixup-for-newer-compiler.patch diff --git a/0072-Add-support-for-non-Ethernet-network-cards.patch b/0071-Add-support-for-non-Ethernet-network-cards.patch similarity index 100% rename from 0072-Add-support-for-non-Ethernet-network-cards.patch rename to 0071-Add-support-for-non-Ethernet-network-cards.patch diff --git a/0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0072-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 100% rename from 0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0072-net-read-bracketed-ipv6-addrs-and-port-numbers.patch diff --git a/0074-bootp-New-net_bootp6-command.patch b/0073-bootp-New-net_bootp6-command.patch similarity index 100% rename from 0074-bootp-New-net_bootp6-command.patch rename to 0073-bootp-New-net_bootp6-command.patch diff --git a/0075-efinet-UEFI-IPv6-PXE-support.patch b/0074-efinet-UEFI-IPv6-PXE-support.patch similarity index 100% rename from 0075-efinet-UEFI-IPv6-PXE-support.patch rename to 0074-efinet-UEFI-IPv6-PXE-support.patch diff --git a/0076-grub.texi-Add-net_bootp6-doument.patch b/0075-grub.texi-Add-net_bootp6-doument.patch similarity index 100% rename from 0076-grub.texi-Add-net_bootp6-doument.patch rename to 0075-grub.texi-Add-net_bootp6-doument.patch diff --git a/0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0076-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 100% rename from 0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0076-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch diff --git a/0078-efinet-Setting-network-from-UEFI-device-path.patch b/0077-efinet-Setting-network-from-UEFI-device-path.patch similarity index 100% rename from 0078-efinet-Setting-network-from-UEFI-device-path.patch rename to 0077-efinet-Setting-network-from-UEFI-device-path.patch diff --git a/0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0078-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 100% rename from 0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0078-efinet-Setting-DNS-server-from-UEFI-protocol.patch diff --git a/0080-Support-UEFI-networking-protocols.patch b/0079-Support-UEFI-networking-protocols.patch similarity index 100% rename from 0080-Support-UEFI-networking-protocols.patch rename to 0079-Support-UEFI-networking-protocols.patch diff --git a/0081-AUDIT-0-http-boot-tracker-bug.patch b/0080-AUDIT-0-http-boot-tracker-bug.patch similarity index 100% rename from 0081-AUDIT-0-http-boot-tracker-bug.patch rename to 0080-AUDIT-0-http-boot-tracker-bug.patch diff --git a/0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0081-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 100% rename from 0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0081-grub-editenv-Add-incr-command-to-increment-integer-v.patch diff --git a/0083-Add-auto-hide-menu-support.patch b/0082-Add-auto-hide-menu-support.patch similarity index 99% rename from 0083-Add-auto-hide-menu-support.patch rename to 0082-Add-auto-hide-menu-support.patch index f5aed0e0..a4fbe4a8 100644 --- a/0083-Add-auto-hide-menu-support.patch +++ b/0082-Add-auto-hide-menu-support.patch @@ -43,7 +43,7 @@ Signed-off-by: Hans de Goede create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index 48512bc631..314e6f2acf 100644 +index bda9fd1211..cb8e3c3270 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { diff --git a/0084-Add-grub-set-bootflag-utility.patch b/0083-Add-grub-set-bootflag-utility.patch similarity index 99% rename from 0084-Add-grub-set-bootflag-utility.patch rename to 0083-Add-grub-set-bootflag-utility.patch index 4ee43cf4..495bb139 100644 --- a/0084-Add-grub-set-bootflag-utility.patch +++ b/0083-Add-grub-set-bootflag-utility.patch @@ -49,10 +49,10 @@ Signed-off-by: Robbie Harwood create mode 100644 docs/man/grub-set-bootflag.h2m diff --git a/Makefile.util.def b/Makefile.util.def -index 314e6f2acf..0b85a7fce4 100644 +index cb8e3c3270..d066652e9b 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1446,3 +1446,10 @@ program = { +@@ -1429,3 +1429,10 @@ program = { ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; diff --git a/0085-docs-Add-grub-boot-indeterminate.service-example.patch b/0084-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0085-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0084-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0086-gentpl-add-disable-support.patch b/0085-gentpl-add-disable-support.patch similarity index 100% rename from 0086-gentpl-add-disable-support.patch rename to 0085-gentpl-add-disable-support.patch diff --git a/0087-gentpl-add-pc-firmware-type.patch b/0086-gentpl-add-pc-firmware-type.patch similarity index 100% rename from 0087-gentpl-add-pc-firmware-type.patch rename to 0086-gentpl-add-pc-firmware-type.patch diff --git a/0088-efinet-also-use-the-firmware-acceleration-for-http.patch b/0087-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0088-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0087-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0088-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0088-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 97% rename from 0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index a2c71369..6d2974f8 100644 --- a/0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,10 +17,10 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index b809c00784..b1ca894791 100644 +index 302300711f..008f6c273b 100644 --- a/configure.ac +++ b/configure.ac -@@ -850,11 +850,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p +@@ -849,11 +849,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" fi @@ -45,7 +45,7 @@ index b809c00784..b1ca894791 100644 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ grub_cv_target_cc_soft_float=no if test "x$target_cpu" = xarm64; then -@@ -1984,6 +1996,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +@@ -1954,6 +1966,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" diff --git a/0091-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0090-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0091-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0090-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0092-Rework-how-the-fdt-command-builds.patch b/0091-Rework-how-the-fdt-command-builds.patch similarity index 100% rename from 0092-Rework-how-the-fdt-command-builds.patch rename to 0091-Rework-how-the-fdt-command-builds.patch diff --git a/0093-Disable-non-wordsize-allocations-on-arm.patch b/0092-Disable-non-wordsize-allocations-on-arm.patch similarity index 93% rename from 0093-Disable-non-wordsize-allocations-on-arm.patch rename to 0092-Disable-non-wordsize-allocations-on-arm.patch index 7105c7cb..ea09b652 100644 --- a/0093-Disable-non-wordsize-allocations-on-arm.patch +++ b/0092-Disable-non-wordsize-allocations-on-arm.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index b1ca894791..f42be65332 100644 +index 008f6c273b..54462e0892 100644 --- a/configure.ac +++ b/configure.ac -@@ -1261,6 +1261,26 @@ if test "x$target_cpu" = xarm; then +@@ -1260,6 +1260,26 @@ if test "x$target_cpu" = xarm; then done ]) diff --git a/0094-Prepend-prefix-when-HTTP-path-is-relative.patch b/0093-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 100% rename from 0094-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0093-Prepend-prefix-when-HTTP-path-is-relative.patch diff --git a/0095-Make-grub_error-more-verbose.patch b/0094-Make-grub_error-more-verbose.patch similarity index 100% rename from 0095-Make-grub_error-more-verbose.patch rename to 0094-Make-grub_error-more-verbose.patch diff --git a/0096-Make-reset-an-alias-for-the-reboot-command.patch b/0095-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0096-Make-reset-an-alias-for-the-reboot-command.patch rename to 0095-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0097-Add-a-version-command.patch b/0096-Add-a-version-command.patch similarity index 98% rename from 0097-Add-a-version-command.patch rename to 0096-Add-a-version-command.patch index 8daad53b..10d40b32 100644 --- a/0097-Add-a-version-command.patch +++ b/0096-Add-a-version-command.patch @@ -19,10 +19,10 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index f42be65332..2af5f23adf 100644 +index 54462e0892..7b4e1854d3 100644 --- a/configure.ac +++ b/configure.ac -@@ -285,6 +285,19 @@ AC_SUBST(target_cpu) +@@ -284,6 +284,19 @@ AC_SUBST(target_cpu) AC_SUBST(platform) # Define default variables diff --git a/0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0097-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 100% rename from 0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0097-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch diff --git a/0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0098-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 100% rename from 0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0098-arm-arm64-loader-Better-memory-allocation-and-error-.patch diff --git a/0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0099-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 100% rename from 0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0099-Try-to-pick-better-locations-for-kernel-and-initrd.patch diff --git a/0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 93% rename from 0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index 3ebf4b3e..e94df4e7 100644 --- a/0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -14,9 +14,8 @@ Signed-off-by: Peter Jones util/grub-menulst2cfg.c | 2 +- util/grub-mkfont.c | 13 +++++++------ util/grub-probe.c | 2 +- - util/grub-rpm-sort.c | 2 +- util/setup.c | 2 +- - 11 files changed, 18 insertions(+), 17 deletions(-) + 10 files changed, 17 insertions(+), 16 deletions(-) diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c index eeea092752..f08a1bb841 100644 @@ -185,19 +184,6 @@ index c08e46bbb4..c6fac732b4 100644 for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) if (strcmp (arg, targets[i]) == 0) -diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c -index f33bd1ed56..8345944105 100644 ---- a/util/grub-rpm-sort.c -+++ b/util/grub-rpm-sort.c -@@ -232,7 +232,7 @@ main (int argc, char *argv[]) - struct arguments arguments; - char **package_names = NULL; - size_t n_package_names = 0; -- int i; -+ unsigned int i; - - grub_util_host_init (&argc, &argv); - diff --git a/util/setup.c b/util/setup.c index da5f2c07f5..8b22bb8cca 100644 --- a/util/setup.c diff --git a/0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 93% rename from 0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index 6e18f66d..03b4bbf3 100644 --- a/0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index 2af5f23adf..091ab32836 100644 +index 7b4e1854d3..490353713a 100644 --- a/configure.ac +++ b/configure.ac -@@ -1453,11 +1453,11 @@ fi +@@ -1452,11 +1452,11 @@ fi # Set them to their new values for the tests below. CC="$TARGET_CC" if test x"$platform" = xemu ; then @@ -29,7 +29,7 @@ index 2af5f23adf..091ab32836 100644 fi CPPFLAGS="$TARGET_CPPFLAGS" -@@ -2020,6 +2020,14 @@ if test x"$enable_werror" != xno ; then +@@ -1990,6 +1990,14 @@ if test x"$enable_werror" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Werror" fi diff --git a/0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0102-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0102-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0103-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0103-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0104-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 100% rename from 0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0104-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch diff --git a/0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0105-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 100% rename from 0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0105-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch diff --git a/0107-Fix-getroot.c-s-trampolines.patch b/0106-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0107-Fix-getroot.c-s-trampolines.patch rename to 0106-Fix-getroot.c-s-trampolines.patch diff --git a/0108-Do-not-allow-stack-trampolines-anywhere.patch b/0107-Do-not-allow-stack-trampolines-anywhere.patch similarity index 93% rename from 0108-Do-not-allow-stack-trampolines-anywhere.patch rename to 0107-Do-not-allow-stack-trampolines-anywhere.patch index 08995fcc..658c7a4c 100644 --- a/0108-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0107-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 091ab32836..de707f7e0b 100644 +index 490353713a..a02d40a05b 100644 --- a/configure.ac +++ b/configure.ac -@@ -2028,6 +2028,9 @@ if test x"$enable_wextra" != xno ; then +@@ -1998,6 +1998,9 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi diff --git a/0109-Reimplement-boot_counter.patch b/0108-Reimplement-boot_counter.patch similarity index 99% rename from 0109-Reimplement-boot_counter.patch rename to 0108-Reimplement-boot_counter.patch index 22bd4ef6..6104b87d 100644 --- a/0109-Reimplement-boot_counter.patch +++ b/0108-Reimplement-boot_counter.patch @@ -23,7 +23,7 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index 0b85a7fce4..27a13bc734 100644 +index d066652e9b..e10fe766d1 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -458,6 +458,12 @@ script = { diff --git a/0110-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0109-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 100% rename from 0110-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0109-Fix-menu-entry-selection-based-on-ID-and-title.patch diff --git a/0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0110-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 100% rename from 0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0110-Make-the-menu-entry-users-option-argument-to-be-opti.patch diff --git a/0112-Add-efi-export-env-and-efi-load-env-commands.patch b/0111-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 100% rename from 0112-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0111-Add-efi-export-env-and-efi-load-env-commands.patch diff --git a/0113-Make-it-possible-to-subtract-conditions-from-debug.patch b/0112-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 100% rename from 0113-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0112-Make-it-possible-to-subtract-conditions-from-debug.patch diff --git a/0114-Export-all-variables-from-the-initial-context-when-c.patch b/0113-Export-all-variables-from-the-initial-context-when-c.patch similarity index 100% rename from 0114-Export-all-variables-from-the-initial-context-when-c.patch rename to 0113-Export-all-variables-from-the-initial-context-when-c.patch diff --git a/0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 99% rename from 0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index 0abe8ede..43e8d168 100644 --- a/0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -21,7 +21,7 @@ Signed-off-by: Robbie Harwood rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index 27a13bc734..2e6ad979c3 100644 +index e10fe766d1..b4ce5383b7 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -459,14 +459,14 @@ script = { diff --git a/0116-Fix-systemctl-kexec-exit-status-check.patch b/0115-Fix-systemctl-kexec-exit-status-check.patch similarity index 100% rename from 0116-Fix-systemctl-kexec-exit-status-check.patch rename to 0115-Fix-systemctl-kexec-exit-status-check.patch diff --git a/0117-Print-grub-emu-linux-loader-messages-as-debug.patch b/0116-Print-grub-emu-linux-loader-messages-as-debug.patch similarity index 100% rename from 0117-Print-grub-emu-linux-loader-messages-as-debug.patch rename to 0116-Print-grub-emu-linux-loader-messages-as-debug.patch diff --git a/0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0117-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 100% rename from 0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0117-Don-t-assume-that-boot-commands-will-only-return-on-.patch diff --git a/0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0118-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0118-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0119-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0119-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0120-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 100% rename from 0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0120-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0122-Add-start-symbol-for-RISC-V.patch b/0121-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0122-Add-start-symbol-for-RISC-V.patch rename to 0121-Add-start-symbol-for-RISC-V.patch diff --git a/0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0122-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 100% rename from 0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0122-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0123-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 100% rename from 0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0123-efi-http-Export-fw-http-_path-variables-to-make-them.patch diff --git a/0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0124-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0124-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0125-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0125-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0126-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0126-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0127-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0127-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0128-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 100% rename from 0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0128-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch diff --git a/0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0129-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 100% rename from 0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0129-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0130-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 100% rename from 0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0130-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0131-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 100% rename from 0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0131-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0132-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 100% rename from 0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0132-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch diff --git a/0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0133-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 100% rename from 0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0133-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch diff --git a/0135-efi-dhcp-fix-some-allocation-error-checking.patch b/0134-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0135-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0134-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0136-efi-http-fix-some-allocation-error-checking.patch b/0135-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0136-efi-http-fix-some-allocation-error-checking.patch rename to 0135-efi-http-fix-some-allocation-error-checking.patch diff --git a/0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0136-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0136-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0137-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 100% rename from 0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0137-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch diff --git a/0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0138-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 100% rename from 0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0138-linuxefi-fail-kernel-validation-without-shim-protoco.patch diff --git a/0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0139-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 100% rename from 0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0139-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch diff --git a/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0140-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0140-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0142-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0142-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0143-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0143-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 99% rename from 0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch index 9e0fc884..8cf45c3e 100644 --- a/0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch +++ b/0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -65,7 +65,7 @@ Signed-off-by: Hans de Goede create mode 100644 util/systemd/systemd-integration.sh.in diff --git a/Makefile.util.def b/Makefile.util.def -index 2e6ad979c3..9927c2cfd6 100644 +index b4ce5383b7..6366442129 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -470,6 +470,12 @@ script = { diff --git a/0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0145-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0145-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0146-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 100% rename from 0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0146-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0148-grub-install-disable-support-for-EFI-platforms.patch b/0147-grub-install-disable-support-for-EFI-platforms.patch similarity index 100% rename from 0148-grub-install-disable-support-for-EFI-platforms.patch rename to 0147-grub-install-disable-support-for-EFI-platforms.patch diff --git a/0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 95% rename from 0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch index c32be3c1..ec5b30b0 100644 --- a/0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,10 +15,10 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index de707f7e0b..f069d84039 100644 +index a02d40a05b..ab0d326f00 100644 --- a/configure.ac +++ b/configure.ac -@@ -1586,6 +1586,17 @@ else +@@ -1585,6 +1585,17 @@ else fi AC_SUBST([BOOT_TIME_STATS]) @@ -36,7 +36,7 @@ index de707f7e0b..f069d84039 100644 AC_ARG_ENABLE([grub-emu-sdl], [AS_HELP_STRING([--enable-grub-emu-sdl], [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) -@@ -2167,6 +2178,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) +@@ -2136,6 +2147,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) @@ -44,7 +44,7 @@ index de707f7e0b..f069d84039 100644 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) -@@ -2262,6 +2274,12 @@ else +@@ -2231,6 +2243,12 @@ else echo With boot time statistics: No fi diff --git a/0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 100% rename from 0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch diff --git a/0151-Introduce-function-grub_debug_is_enabled-void-return.patch b/0150-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 100% rename from 0151-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0150-Introduce-function-grub_debug_is_enabled-void-return.patch diff --git a/0152-Don-t-clear-screen-when-debugging-is-enabled.patch b/0151-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 100% rename from 0152-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0151-Don-t-clear-screen-when-debugging-is-enabled.patch diff --git a/0153-grub_file_-instrumentation-new-file-debug-tag.patch b/0152-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0153-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0152-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0154-ieee1275-Avoiding-many-unecessary-open-close.patch b/0153-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0154-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0153-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0154-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0154-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0155-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0155-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0156-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 100% rename from 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0156-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0157-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 100% rename from 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0157-Add-suport-for-signing-grub-with-an-appended-signatu.patch diff --git a/0159-docs-grub-Document-signing-grub-under-UEFI.patch b/0158-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0159-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0158-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0159-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0159-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0160-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0160-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0162-pgp-factor-out-rsa_pad.patch b/0161-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0162-pgp-factor-out-rsa_pad.patch rename to 0161-pgp-factor-out-rsa_pad.patch diff --git a/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0162-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0162-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0163-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0163-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0165-libtasn1-import-libtasn1-4.16.0.patch b/0164-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0165-libtasn1-import-libtasn1-4.16.0.patch rename to 0164-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0166-libtasn1-disable-code-not-needed-in-grub.patch b/0165-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0166-libtasn1-disable-code-not-needed-in-grub.patch rename to 0165-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0167-libtasn1-changes-for-grub-compatibility.patch b/0166-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0167-libtasn1-changes-for-grub-compatibility.patch rename to 0166-libtasn1-changes-for-grub-compatibility.patch diff --git a/0168-libtasn1-compile-into-asn1-module.patch b/0167-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0168-libtasn1-compile-into-asn1-module.patch rename to 0167-libtasn1-compile-into-asn1-module.patch diff --git a/0169-test_asn1-test-module-for-libtasn1.patch b/0168-test_asn1-test-module-for-libtasn1.patch similarity index 99% rename from 0169-test_asn1-test-module-for-libtasn1.patch rename to 0168-test_asn1-test-module-for-libtasn1.patch index 1588c511..c95a00b3 100644 --- a/0169-test_asn1-test-module-for-libtasn1.patch +++ b/0168-test_asn1-test-module-for-libtasn1.patch @@ -51,10 +51,10 @@ Signed-off-by: Daniel Axtens create mode 100644 tests/test_asn1.in diff --git a/Makefile.util.def b/Makefile.util.def -index 9927c2cfd6..3f191aa809 100644 +index 6366442129..d04b3fe68a 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1306,6 +1306,12 @@ script = { +@@ -1289,6 +1289,12 @@ script = { common = tests/syslinux_test.in; }; @@ -1426,7 +1426,7 @@ index 0000000000..555e56dd20 + +#endif diff --git a/.gitignore b/.gitignore -index 594d0134d3..856e69bc5c 100644 +index 208d1d2325..1d005887e7 100644 --- a/.gitignore +++ b/.gitignore @@ -264,6 +264,7 @@ widthspec.bin diff --git a/0170-grub-install-support-embedding-x509-certificates.patch b/0169-grub-install-support-embedding-x509-certificates.patch similarity index 100% rename from 0170-grub-install-support-embedding-x509-certificates.patch rename to 0169-grub-install-support-embedding-x509-certificates.patch diff --git a/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0170-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0170-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0171-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0171-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0173-appended-signatures-support-verifying-appended-signa.patch b/0172-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0173-appended-signatures-support-verifying-appended-signa.patch rename to 0172-appended-signatures-support-verifying-appended-signa.patch diff --git a/0174-appended-signatures-verification-tests.patch b/0173-appended-signatures-verification-tests.patch similarity index 100% rename from 0174-appended-signatures-verification-tests.patch rename to 0173-appended-signatures-verification-tests.patch diff --git a/0175-appended-signatures-documentation.patch b/0174-appended-signatures-documentation.patch similarity index 100% rename from 0175-appended-signatures-documentation.patch rename to 0174-appended-signatures-documentation.patch diff --git a/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0175-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 100% rename from 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0175-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch diff --git a/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0176-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0176-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0178-ieee1275-claim-more-memory.patch b/0177-ieee1275-claim-more-memory.patch similarity index 100% rename from 0178-ieee1275-claim-more-memory.patch rename to 0177-ieee1275-claim-more-memory.patch diff --git a/0179-ieee1275-request-memory-with-ibm-client-architecture.patch b/0178-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0179-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0178-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0179-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0179-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0181-ieee1275-ofdisk-retry-on-open-failure.patch b/0180-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0181-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0180-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0181-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 100% rename from 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0181-Allow-chainloading-EFI-apps-from-loop-mounts.patch diff --git a/0183-efinet-Add-DHCP-proxy-support.patch b/0182-efinet-Add-DHCP-proxy-support.patch similarity index 100% rename from 0183-efinet-Add-DHCP-proxy-support.patch rename to 0182-efinet-Add-DHCP-proxy-support.patch diff --git a/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0183-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0183-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 97% rename from 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index 1982847e..b2783d13 100644 --- a/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,7 +20,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index c02c1f0820..6af84b44e1 100644 +index e490e1a43a..865af3d6c4 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -256,7 +256,9 @@ if [ -z "\${kernelopts}" ]; then diff --git a/0186-Suppress-gettext-error-message.patch b/0185-Suppress-gettext-error-message.patch similarity index 100% rename from 0186-Suppress-gettext-error-message.patch rename to 0185-Suppress-gettext-error-message.patch diff --git a/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0186-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0186-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0187-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 100% rename from 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0187-templates-Check-for-EFI-at-runtime-instead-of-config.patch diff --git a/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0188-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 100% rename from 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0188-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0189-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 100% rename from 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0189-arm64-Fix-EFI-loader-kernel-image-allocation.patch diff --git a/0191-normal-main-Discover-the-device-to-read-the-config-f.patch b/0190-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 100% rename from 0191-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0190-normal-main-Discover-the-device-to-read-the-config-f.patch diff --git a/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0191-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 100% rename from 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0191-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch diff --git a/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0192-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0192-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0194-Print-module-name-on-license-check-failure.patch b/0193-Print-module-name-on-license-check-failure.patch similarity index 100% rename from 0194-Print-module-name-on-license-check-failure.patch rename to 0193-Print-module-name-on-license-check-failure.patch diff --git a/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0194-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 100% rename from 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0194-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0195-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 100% rename from 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0195-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0196-fs-btrfs-Use-full-btrfs-bootloader-area.patch similarity index 100% rename from 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch rename to 0196-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0197-Add-Fedora-location-of-DejaVu-SANS-font.patch similarity index 95% rename from 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch rename to 0197-Add-Fedora-location-of-DejaVu-SANS-font.patch index c3e45e4d..070fc24a 100644 --- a/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch +++ b/0197-Add-Fedora-location-of-DejaVu-SANS-font.patch @@ -16,10 +16,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index f069d84039..88e33e0f0c 100644 +index ab0d326f00..40c4338bce 100644 --- a/configure.ac +++ b/configure.ac -@@ -1785,7 +1785,7 @@ fi +@@ -1784,7 +1784,7 @@ fi if test x"$starfield_excuse" = x; then for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do diff --git a/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0198-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch similarity index 100% rename from 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch rename to 0198-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch diff --git a/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0199-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch similarity index 100% rename from 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch rename to 0199-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch diff --git a/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0200-EFI-console-Do-not-set-colorstate-until-the-first-te.patch similarity index 100% rename from 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch rename to 0200-EFI-console-Do-not-set-colorstate-until-the-first-te.patch diff --git a/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0201-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch similarity index 100% rename from 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch rename to 0201-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch diff --git a/0203-Use-visual-indentation-in-config.h.in.patch b/0202-Use-visual-indentation-in-config.h.in.patch similarity index 100% rename from 0203-Use-visual-indentation-in-config.h.in.patch rename to 0202-Use-visual-indentation-in-config.h.in.patch diff --git a/0204-Where-present-ensure-config-util.h-precedes-config.h.patch b/0203-Where-present-ensure-config-util.h-precedes-config.h.patch similarity index 100% rename from 0204-Where-present-ensure-config-util.h-precedes-config.h.patch rename to 0203-Where-present-ensure-config-util.h-precedes-config.h.patch diff --git a/0205-Drop-gnulib-fix-base64.patch.patch b/0204-Drop-gnulib-fix-base64.patch.patch similarity index 100% rename from 0205-Drop-gnulib-fix-base64.patch.patch rename to 0204-Drop-gnulib-fix-base64.patch.patch diff --git a/0206-Drop-gnulib-no-abort.patch.patch b/0205-Drop-gnulib-no-abort.patch.patch similarity index 100% rename from 0206-Drop-gnulib-no-abort.patch.patch rename to 0205-Drop-gnulib-no-abort.patch.patch diff --git a/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch similarity index 99% rename from 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch rename to 0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch index f0e2cc02..f9fa2079 100644 --- a/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch +++ b/0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch @@ -48,7 +48,7 @@ Signed-off-by: Robbie Harwood delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch diff --git a/configure.ac b/configure.ac -index 88e33e0f0c..871235b91b 100644 +index 40c4338bce..79f45ef1e1 100644 --- a/configure.ac +++ b/configure.ac @@ -49,7 +49,7 @@ AC_CANONICAL_TARGET diff --git a/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0207-commands-search-Fix-bug-stopping-iteration-when-no-f.patch similarity index 100% rename from 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch rename to 0207-commands-search-Fix-bug-stopping-iteration-when-no-f.patch diff --git a/0209-search-new-efidisk-only-option-on-EFI-systems.patch b/0208-search-new-efidisk-only-option-on-EFI-systems.patch similarity index 100% rename from 0209-search-new-efidisk-only-option-on-EFI-systems.patch rename to 0208-search-new-efidisk-only-option-on-EFI-systems.patch diff --git a/0210-efi-new-connectefi-command.patch b/0209-efi-new-connectefi-command.patch similarity index 100% rename from 0210-efi-new-connectefi-command.patch rename to 0209-efi-new-connectefi-command.patch diff --git a/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0210-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch similarity index 100% rename from 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch rename to 0210-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch diff --git a/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0211-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch similarity index 100% rename from 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch rename to 0211-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch diff --git a/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0212-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch similarity index 100% rename from 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch rename to 0212-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch diff --git a/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0213-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch similarity index 100% rename from 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch rename to 0213-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/0215-powerpc-do-CAS-in-a-more-compatible-way.patch b/0214-powerpc-do-CAS-in-a-more-compatible-way.patch similarity index 100% rename from 0215-powerpc-do-CAS-in-a-more-compatible-way.patch rename to 0214-powerpc-do-CAS-in-a-more-compatible-way.patch diff --git a/0216-powerpc-prefix-detection-support-device-names-with-c.patch b/0215-powerpc-prefix-detection-support-device-names-with-c.patch similarity index 100% rename from 0216-powerpc-prefix-detection-support-device-names-with-c.patch rename to 0215-powerpc-prefix-detection-support-device-names-with-c.patch diff --git a/0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch b/0216-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch similarity index 100% rename from 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch rename to 0216-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch diff --git a/0219-make-ofdisk_retries-optional.patch b/0217-make-ofdisk_retries-optional.patch similarity index 100% rename from 0219-make-ofdisk_retries-optional.patch rename to 0217-make-ofdisk_retries-optional.patch diff --git a/0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch b/0218-loader-efi-chainloader-grub_load_and_start_image-doe.patch similarity index 100% rename from 0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch rename to 0218-loader-efi-chainloader-grub_load_and_start_image-doe.patch diff --git a/0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch b/0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch deleted file mode 100644 index d2458d00..00000000 --- a/0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Thu, 5 May 2022 18:01:05 -0400 -Subject: [PATCH] rpm-sort: add prereqs for declaration of strchrnul() - -Signed-off-by: Robbie Harwood ---- - util/grub-rpm-sort.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c -index 8345944105..71d038bb69 100644 ---- a/util/grub-rpm-sort.c -+++ b/util/grub-rpm-sort.c -@@ -1,13 +1,17 @@ -+#define _GNU_SOURCE 1 -+ - #include -+ -+#include -+#include -+#include - #include - #include -+#include - #include - #include -+#include - #include --#include --#include --#include --#include - - static size_t - read_file (const char *input, char **ret) diff --git a/0221-loader-efi-chainloader-simplify-the-loader-state.patch b/0219-loader-efi-chainloader-simplify-the-loader-state.patch similarity index 100% rename from 0221-loader-efi-chainloader-simplify-the-loader-state.patch rename to 0219-loader-efi-chainloader-simplify-the-loader-state.patch diff --git a/0222-commands-boot-Add-API-to-pass-context-to-loader.patch b/0220-commands-boot-Add-API-to-pass-context-to-loader.patch similarity index 100% rename from 0222-commands-boot-Add-API-to-pass-context-to-loader.patch rename to 0220-commands-boot-Add-API-to-pass-context-to-loader.patch diff --git a/0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch b/0221-loader-efi-chainloader-Use-grub_loader_set_ex.patch similarity index 100% rename from 0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch rename to 0221-loader-efi-chainloader-Use-grub_loader_set_ex.patch diff --git a/0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch b/0222-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch similarity index 100% rename from 0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch rename to 0222-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch diff --git a/0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch b/0223-loader-i386-efi-linux-Use-grub_loader_set_ex.patch similarity index 100% rename from 0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch rename to 0223-loader-i386-efi-linux-Use-grub_loader_set_ex.patch diff --git a/0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch b/0224-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch similarity index 100% rename from 0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch rename to 0224-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch diff --git a/0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch b/0225-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch similarity index 100% rename from 0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch rename to 0225-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch diff --git a/0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch b/0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch similarity index 100% rename from 0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch rename to 0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch diff --git a/0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch b/0227-video-readers-png-Abort-sooner-if-a-read-operation-f.patch similarity index 100% rename from 0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch rename to 0227-video-readers-png-Abort-sooner-if-a-read-operation-f.patch diff --git a/0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch b/0228-video-readers-png-Refuse-to-handle-multiple-image-he.patch similarity index 100% rename from 0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch rename to 0228-video-readers-png-Refuse-to-handle-multiple-image-he.patch diff --git a/0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch b/0229-video-readers-png-Drop-greyscale-support-to-fix-heap.patch similarity index 100% rename from 0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch rename to 0229-video-readers-png-Drop-greyscale-support-to-fix-heap.patch diff --git a/0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch b/0230-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch similarity index 100% rename from 0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch rename to 0230-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch diff --git a/0233-video-readers-png-Sanity-check-some-huffman-codes.patch b/0231-video-readers-png-Sanity-check-some-huffman-codes.patch similarity index 100% rename from 0233-video-readers-png-Sanity-check-some-huffman-codes.patch rename to 0231-video-readers-png-Sanity-check-some-huffman-codes.patch diff --git a/0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch b/0232-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch similarity index 100% rename from 0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch rename to 0232-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch diff --git a/0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch b/0233-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch similarity index 100% rename from 0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch rename to 0233-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch diff --git a/0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch b/0234-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch similarity index 100% rename from 0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch rename to 0234-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch diff --git a/0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch b/0235-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch similarity index 100% rename from 0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch rename to 0235-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch diff --git a/0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch b/0236-normal-charset-Fix-array-out-of-bounds-formatting-un.patch similarity index 100% rename from 0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch rename to 0236-normal-charset-Fix-array-out-of-bounds-formatting-un.patch diff --git a/0239-net-netbuff-Block-overly-large-netbuff-allocs.patch b/0237-net-netbuff-Block-overly-large-netbuff-allocs.patch similarity index 100% rename from 0239-net-netbuff-Block-overly-large-netbuff-allocs.patch rename to 0237-net-netbuff-Block-overly-large-netbuff-allocs.patch diff --git a/0240-net-ip-Do-IP-fragment-maths-safely.patch b/0238-net-ip-Do-IP-fragment-maths-safely.patch similarity index 100% rename from 0240-net-ip-Do-IP-fragment-maths-safely.patch rename to 0238-net-ip-Do-IP-fragment-maths-safely.patch diff --git a/0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch b/0239-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch similarity index 100% rename from 0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch rename to 0239-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch diff --git a/0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch b/0240-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch similarity index 100% rename from 0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch rename to 0240-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch diff --git a/0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch b/0241-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch similarity index 100% rename from 0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch rename to 0241-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch diff --git a/0244-net-tftp-Avoid-a-trivial-UAF.patch b/0242-net-tftp-Avoid-a-trivial-UAF.patch similarity index 100% rename from 0244-net-tftp-Avoid-a-trivial-UAF.patch rename to 0242-net-tftp-Avoid-a-trivial-UAF.patch diff --git a/0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch b/0243-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch similarity index 100% rename from 0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch rename to 0243-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch diff --git a/0246-net-http-Fix-OOB-write-for-split-http-headers.patch b/0244-net-http-Fix-OOB-write-for-split-http-headers.patch similarity index 100% rename from 0246-net-http-Fix-OOB-write-for-split-http-headers.patch rename to 0244-net-http-Fix-OOB-write-for-split-http-headers.patch diff --git a/0247-net-http-Error-out-on-headers-with-LF-without-CR.patch b/0245-net-http-Error-out-on-headers-with-LF-without-CR.patch similarity index 100% rename from 0247-net-http-Error-out-on-headers-with-LF-without-CR.patch rename to 0245-net-http-Error-out-on-headers-with-LF-without-CR.patch diff --git a/0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch b/0246-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch similarity index 100% rename from 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch rename to 0246-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch diff --git a/0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch b/0247-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch similarity index 100% rename from 0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch rename to 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch diff --git a/0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch b/0248-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch similarity index 100% rename from 0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch rename to 0248-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch diff --git a/0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch b/0249-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch similarity index 100% rename from 0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch rename to 0249-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch diff --git a/0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch b/0250-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch similarity index 100% rename from 0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch rename to 0250-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch diff --git a/0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch b/0251-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch similarity index 100% rename from 0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch rename to 0251-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch diff --git a/0254-misc-Make-grub_min-and-grub_max-more-resilient.patch b/0252-misc-Make-grub_min-and-grub_max-more-resilient.patch similarity index 100% rename from 0254-misc-Make-grub_min-and-grub_max-more-resilient.patch rename to 0252-misc-Make-grub_min-and-grub_max-more-resilient.patch diff --git a/0255-ReiserFS-switch-to-using-grub_min-grub_max.patch b/0253-ReiserFS-switch-to-using-grub_min-grub_max.patch similarity index 100% rename from 0255-ReiserFS-switch-to-using-grub_min-grub_max.patch rename to 0253-ReiserFS-switch-to-using-grub_min-grub_max.patch diff --git a/0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch b/0254-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch similarity index 100% rename from 0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch rename to 0254-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch diff --git a/0257-modules-make-.module_license-read-only.patch b/0255-modules-make-.module_license-read-only.patch similarity index 100% rename from 0257-modules-make-.module_license-read-only.patch rename to 0255-modules-make-.module_license-read-only.patch diff --git a/0258-modules-strip-.llvm_addrsig-sections-and-similar.patch b/0256-modules-strip-.llvm_addrsig-sections-and-similar.patch similarity index 100% rename from 0258-modules-strip-.llvm_addrsig-sections-and-similar.patch rename to 0256-modules-strip-.llvm_addrsig-sections-and-similar.patch diff --git a/0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch b/0257-modules-Don-t-allocate-space-for-non-allocable-secti.patch similarity index 100% rename from 0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch rename to 0257-modules-Don-t-allocate-space-for-non-allocable-secti.patch diff --git a/0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch b/0258-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch similarity index 100% rename from 0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch rename to 0258-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch diff --git a/0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch b/0259-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch similarity index 100% rename from 0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch rename to 0259-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch diff --git a/0262-modules-load-module-sections-at-page-aligned-address.patch b/0260-modules-load-module-sections-at-page-aligned-address.patch similarity index 100% rename from 0262-modules-load-module-sections-at-page-aligned-address.patch rename to 0260-modules-load-module-sections-at-page-aligned-address.patch diff --git a/0263-nx-add-memory-attribute-get-set-API.patch b/0261-nx-add-memory-attribute-get-set-API.patch similarity index 100% rename from 0263-nx-add-memory-attribute-get-set-API.patch rename to 0261-nx-add-memory-attribute-get-set-API.patch diff --git a/0264-nx-set-page-permissions-for-loaded-modules.patch b/0262-nx-set-page-permissions-for-loaded-modules.patch similarity index 100% rename from 0264-nx-set-page-permissions-for-loaded-modules.patch rename to 0262-nx-set-page-permissions-for-loaded-modules.patch diff --git a/0265-nx-set-attrs-in-our-kernel-loaders.patch b/0263-nx-set-attrs-in-our-kernel-loaders.patch similarity index 100% rename from 0265-nx-set-attrs-in-our-kernel-loaders.patch rename to 0263-nx-set-attrs-in-our-kernel-loaders.patch diff --git a/0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch b/0264-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch similarity index 100% rename from 0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch rename to 0264-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch diff --git a/0267-grub-probe-document-the-behavior-of-multiple-v.patch b/0265-grub-probe-document-the-behavior-of-multiple-v.patch similarity index 100% rename from 0267-grub-probe-document-the-behavior-of-multiple-v.patch rename to 0265-grub-probe-document-the-behavior-of-multiple-v.patch diff --git a/0268-grub_fs_probe-dprint-errors-from-filesystems.patch b/0266-grub_fs_probe-dprint-errors-from-filesystems.patch similarity index 100% rename from 0268-grub_fs_probe-dprint-errors-from-filesystems.patch rename to 0266-grub_fs_probe-dprint-errors-from-filesystems.patch diff --git a/0269-fs-fat-don-t-error-when-mtime-is-0.patch b/0267-fs-fat-don-t-error-when-mtime-is-0.patch similarity index 100% rename from 0269-fs-fat-don-t-error-when-mtime-is-0.patch rename to 0267-fs-fat-don-t-error-when-mtime-is-0.patch diff --git a/0270-Make-debug-file-show-which-file-filters-get-run.patch b/0268-Make-debug-file-show-which-file-filters-get-run.patch similarity index 100% rename from 0270-Make-debug-file-show-which-file-filters-get-run.patch rename to 0268-Make-debug-file-show-which-file-filters-get-run.patch diff --git a/0271-efi-use-enumerated-array-positions-for-our-allocatio.patch b/0269-efi-use-enumerated-array-positions-for-our-allocatio.patch similarity index 100% rename from 0271-efi-use-enumerated-array-positions-for-our-allocatio.patch rename to 0269-efi-use-enumerated-array-positions-for-our-allocatio.patch diff --git a/0272-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch b/0270-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch similarity index 100% rename from 0272-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch rename to 0270-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch diff --git a/0273-efi-allocate-the-initrd-within-the-bounds-expressed-.patch b/0271-efi-allocate-the-initrd-within-the-bounds-expressed-.patch similarity index 100% rename from 0273-efi-allocate-the-initrd-within-the-bounds-expressed-.patch rename to 0271-efi-allocate-the-initrd-within-the-bounds-expressed-.patch diff --git a/0274-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch b/0272-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch similarity index 100% rename from 0274-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch rename to 0272-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch diff --git a/0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch b/0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch similarity index 96% rename from 0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch rename to 0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch index 7080b6f6..50ba0fb2 100644 --- a/0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +++ b/0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch @@ -9,7 +9,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 6 insertions(+) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 6af84b44e1..950a92f5e8 100644 +index 865af3d6c4..9ebff661a9 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -161,6 +161,12 @@ update_bls_cmdline() diff --git a/0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch b/0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch similarity index 97% rename from 0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch rename to 0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch index 013b915e..67073ecf 100644 --- a/0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +++ b/0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch @@ -9,7 +9,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 950a92f5e8..03f091a4dc 100644 +index 9ebff661a9..41c6cb1dc2 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -161,10 +161,16 @@ update_bls_cmdline() diff --git a/0277-squish-give-up-on-rhgb-quiet.patch b/0275-squish-give-up-on-rhgb-quiet.patch similarity index 95% rename from 0277-squish-give-up-on-rhgb-quiet.patch rename to 0275-squish-give-up-on-rhgb-quiet.patch index bbead5e9..5858c917 100644 --- a/0277-squish-give-up-on-rhgb-quiet.patch +++ b/0275-squish-give-up-on-rhgb-quiet.patch @@ -9,7 +9,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 03f091a4dc..5ad624bfec 100644 +index 41c6cb1dc2..5d1fa072f2 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -166,10 +166,6 @@ update_bls_cmdline() diff --git a/0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch b/0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch similarity index 98% rename from 0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch rename to 0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch index ed378b89..d5ac923f 100644 --- a/0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +++ b/0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch @@ -32,7 +32,7 @@ Fixes: https://github.com/fedora-silverblue/issue-tracker/issues/322 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 5ad624bfec..e5e87a6d80 100644 +index 5d1fa072f2..4795a63b4c 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -161,12 +161,13 @@ update_bls_cmdline() diff --git a/0279-ieee1275-implement-vec5-for-cas-negotiation.patch b/0277-ieee1275-implement-vec5-for-cas-negotiation.patch similarity index 100% rename from 0279-ieee1275-implement-vec5-for-cas-negotiation.patch rename to 0277-ieee1275-implement-vec5-for-cas-negotiation.patch diff --git a/0280-blscfg-Don-t-root-device-in-emu-builds.patch b/0278-blscfg-Don-t-root-device-in-emu-builds.patch similarity index 100% rename from 0280-blscfg-Don-t-root-device-in-emu-builds.patch rename to 0278-blscfg-Don-t-root-device-in-emu-builds.patch diff --git a/0281-loader-arm64-linux-Remove-magic-number-header-field-.patch b/0279-loader-arm64-linux-Remove-magic-number-header-field-.patch similarity index 100% rename from 0281-loader-arm64-linux-Remove-magic-number-header-field-.patch rename to 0279-loader-arm64-linux-Remove-magic-number-header-field-.patch diff --git a/0282-Correct-BSS-zeroing-on-aarch64.patch b/0280-Correct-BSS-zeroing-on-aarch64.patch similarity index 100% rename from 0282-Correct-BSS-zeroing-on-aarch64.patch rename to 0280-Correct-BSS-zeroing-on-aarch64.patch diff --git a/0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch b/0281-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch similarity index 100% rename from 0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch rename to 0281-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch diff --git a/0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch b/0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch similarity index 100% rename from 0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch rename to 0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch diff --git a/0285-commands-efi-tpm-Refine-the-status-of-log-event.patch b/0283-commands-efi-tpm-Refine-the-status-of-log-event.patch similarity index 100% rename from 0285-commands-efi-tpm-Refine-the-status-of-log-event.patch rename to 0283-commands-efi-tpm-Refine-the-status-of-log-event.patch diff --git a/0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch b/0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch similarity index 100% rename from 0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch rename to 0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch diff --git a/0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch b/0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch similarity index 100% rename from 0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch rename to 0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch diff --git a/grub.patches b/grub.patches index ebbd8ac7..a90e9211 100644 --- a/grub.patches +++ b/grub.patches @@ -29,259 +29,257 @@ Patch0028: 0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch Patch0029: 0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch Patch0030: 0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch Patch0031: 0031-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0032: 0032-Use-rpm-s-sort-for-grub2-mkconfig.patch -Patch0033: 0033-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0034: 0034-Add-friendly-grub2-password-config-tool-985962.patch -Patch0035: 0035-tcp-add-window-scaling-support.patch -Patch0036: 0036-efinet-and-bootp-add-support-for-dhcpv6.patch -Patch0037: 0037-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0038: 0038-bz1374141-fix-incorrect-mask-for-ppc64.patch -Patch0039: 0039-Make-grub_fatal-also-backtrace.patch -Patch0040: 0040-Make-our-info-pages-say-grub2-where-appropriate.patch -Patch0041: 0041-macos-just-build-chainloader-entries-don-t-try-any-x.patch -Patch0042: 0042-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch -Patch0043: 0043-export-btrfs_subvol-and-btrfs_subvolid.patch -Patch0044: 0044-grub2-btrfs-03-follow_default.patch -Patch0045: 0045-grub2-btrfs-04-grub2-install.patch -Patch0046: 0046-grub2-btrfs-05-grub2-mkconfig.patch -Patch0047: 0047-grub2-btrfs-06-subvol-mount.patch -Patch0048: 0048-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch -Patch0049: 0049-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch -Patch0050: 0050-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch -Patch0051: 0051-Use-grub_efi_.-memory-helpers-where-reasonable.patch -Patch0052: 0052-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch -Patch0053: 0053-don-t-use-int-for-efi-status.patch -Patch0054: 0054-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch -Patch0055: 0055-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch -Patch0056: 0056-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch -Patch0057: 0057-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch -Patch0058: 0058-align-struct-efi_variable-better.patch -Patch0059: 0059-Add-BLS-support-to-grub-mkconfig.patch -Patch0060: 0060-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0061: 0061-Add-linux-and-initrd-commands-for-grub-emu.patch -Patch0062: 0062-Add-grub2-switch-to-blscfg.patch -Patch0063: 0063-make-better-backtraces.patch -Patch0064: 0064-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0065: 0065-Work-around-some-minor-include-path-weirdnesses.patch -Patch0066: 0066-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0067: 0067-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0068: 0068-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch -Patch0069: 0069-Fixup-for-newer-compiler.patch -Patch0070: 0070-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0071: 0071-Fixup-for-newer-compiler.patch -Patch0072: 0072-Add-support-for-non-Ethernet-network-cards.patch -Patch0073: 0073-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0074: 0074-bootp-New-net_bootp6-command.patch -Patch0075: 0075-efinet-UEFI-IPv6-PXE-support.patch -Patch0076: 0076-grub.texi-Add-net_bootp6-doument.patch -Patch0077: 0077-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0078: 0078-efinet-Setting-network-from-UEFI-device-path.patch -Patch0079: 0079-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0080: 0080-Support-UEFI-networking-protocols.patch -Patch0081: 0081-AUDIT-0-http-boot-tracker-bug.patch -Patch0082: 0082-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0083: 0083-Add-auto-hide-menu-support.patch -Patch0084: 0084-Add-grub-set-bootflag-utility.patch -Patch0085: 0085-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0086: 0086-gentpl-add-disable-support.patch -Patch0087: 0087-gentpl-add-pc-firmware-type.patch -Patch0088: 0088-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0089: 0089-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0090: 0090-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0091: 0091-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0092: 0092-Rework-how-the-fdt-command-builds.patch -Patch0093: 0093-Disable-non-wordsize-allocations-on-arm.patch -Patch0094: 0094-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0095: 0095-Make-grub_error-more-verbose.patch -Patch0096: 0096-Make-reset-an-alias-for-the-reboot-command.patch -Patch0097: 0097-Add-a-version-command.patch -Patch0098: 0098-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0099: 0099-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0100: 0100-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0101: 0101-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0102: 0102-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0103: 0103-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0104: 0104-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0105: 0105-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0106: 0106-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0107: 0107-Fix-getroot.c-s-trampolines.patch -Patch0108: 0108-Do-not-allow-stack-trampolines-anywhere.patch -Patch0109: 0109-Reimplement-boot_counter.patch -Patch0110: 0110-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0111: 0111-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0112: 0112-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0113: 0113-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0114: 0114-Export-all-variables-from-the-initial-context-when-c.patch -Patch0115: 0115-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0116: 0116-Fix-systemctl-kexec-exit-status-check.patch -Patch0117: 0117-Print-grub-emu-linux-loader-messages-as-debug.patch -Patch0118: 0118-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0119: 0119-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0120: 0120-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0121: 0121-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0122: 0122-Add-start-symbol-for-RISC-V.patch -Patch0123: 0123-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0124: 0124-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0125: 0125-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0126: 0126-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0127: 0127-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0128: 0128-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0129: 0129-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0130: 0130-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0131: 0131-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0132: 0132-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0133: 0133-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0134: 0134-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0135: 0135-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0136: 0136-efi-http-fix-some-allocation-error-checking.patch -Patch0137: 0137-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0138: 0138-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0139: 0139-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0140: 0140-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0141: 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0144: 0144-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0145: 0145-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0146: 0146-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0147: 0147-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0148: 0148-grub-install-disable-support-for-EFI-platforms.patch -Patch0149: 0149-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0150: 0150-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0151: 0151-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0152: 0152-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0153: 0153-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0154: 0154-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0155: 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0156: 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0157: 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0158: 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0159: 0159-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0160: 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0161: 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0162: 0162-pgp-factor-out-rsa_pad.patch -Patch0163: 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0164: 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0165: 0165-libtasn1-import-libtasn1-4.16.0.patch -Patch0166: 0166-libtasn1-disable-code-not-needed-in-grub.patch -Patch0167: 0167-libtasn1-changes-for-grub-compatibility.patch -Patch0168: 0168-libtasn1-compile-into-asn1-module.patch -Patch0169: 0169-test_asn1-test-module-for-libtasn1.patch -Patch0170: 0170-grub-install-support-embedding-x509-certificates.patch -Patch0171: 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0172: 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0173: 0173-appended-signatures-support-verifying-appended-signa.patch -Patch0174: 0174-appended-signatures-verification-tests.patch -Patch0175: 0175-appended-signatures-documentation.patch -Patch0176: 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0177: 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0178: 0178-ieee1275-claim-more-memory.patch -Patch0179: 0179-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0180: 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0181: 0181-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0182: 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0183: 0183-efinet-Add-DHCP-proxy-support.patch -Patch0184: 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0185: 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0186: 0186-Suppress-gettext-error-message.patch -Patch0187: 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0188: 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0189: 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0190: 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0191: 0191-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0192: 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0193: 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0194: 0194-Print-module-name-on-license-check-failure.patch -Patch0195: 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0196: 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0197: 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch -Patch0198: 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch -Patch0199: 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch -Patch0200: 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch -Patch0201: 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch -Patch0202: 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch -Patch0203: 0203-Use-visual-indentation-in-config.h.in.patch -Patch0204: 0204-Where-present-ensure-config-util.h-precedes-config.h.patch -Patch0205: 0205-Drop-gnulib-fix-base64.patch.patch -Patch0206: 0206-Drop-gnulib-no-abort.patch.patch -Patch0207: 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0208: 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch -Patch0209: 0209-search-new-efidisk-only-option-on-EFI-systems.patch -Patch0210: 0210-efi-new-connectefi-command.patch -Patch0211: 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch -Patch0212: 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch -Patch0213: 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch -Patch0214: 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch -Patch0215: 0215-powerpc-do-CAS-in-a-more-compatible-way.patch -Patch0216: 0216-powerpc-prefix-detection-support-device-names-with-c.patch -Patch0217: 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch -Patch0218: 0218-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch -Patch0219: 0219-make-ofdisk_retries-optional.patch -Patch0220: 0220-loader-efi-chainloader-grub_load_and_start_image-doe.patch -Patch0221: 0221-loader-efi-chainloader-simplify-the-loader-state.patch -Patch0222: 0222-commands-boot-Add-API-to-pass-context-to-loader.patch -Patch0223: 0223-loader-efi-chainloader-Use-grub_loader_set_ex.patch -Patch0224: 0224-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch -Patch0225: 0225-loader-i386-efi-linux-Use-grub_loader_set_ex.patch -Patch0226: 0226-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch -Patch0227: 0227-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch -Patch0228: 0228-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch -Patch0229: 0229-video-readers-png-Abort-sooner-if-a-read-operation-f.patch -Patch0230: 0230-video-readers-png-Refuse-to-handle-multiple-image-he.patch -Patch0231: 0231-video-readers-png-Drop-greyscale-support-to-fix-heap.patch -Patch0232: 0232-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch -Patch0233: 0233-video-readers-png-Sanity-check-some-huffman-codes.patch -Patch0234: 0234-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch -Patch0235: 0235-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch -Patch0236: 0236-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch -Patch0237: 0237-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch -Patch0238: 0238-normal-charset-Fix-array-out-of-bounds-formatting-un.patch -Patch0239: 0239-net-netbuff-Block-overly-large-netbuff-allocs.patch -Patch0240: 0240-net-ip-Do-IP-fragment-maths-safely.patch -Patch0241: 0241-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch -Patch0242: 0242-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch -Patch0243: 0243-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch -Patch0244: 0244-net-tftp-Avoid-a-trivial-UAF.patch -Patch0245: 0245-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch -Patch0246: 0246-net-http-Fix-OOB-write-for-split-http-headers.patch -Patch0247: 0247-net-http-Error-out-on-headers-with-LF-without-CR.patch -Patch0248: 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch -Patch0249: 0249-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch -Patch0250: 0250-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch -Patch0251: 0251-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch -Patch0252: 0252-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch -Patch0253: 0253-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch -Patch0254: 0254-misc-Make-grub_min-and-grub_max-more-resilient.patch -Patch0255: 0255-ReiserFS-switch-to-using-grub_min-grub_max.patch -Patch0256: 0256-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch -Patch0257: 0257-modules-make-.module_license-read-only.patch -Patch0258: 0258-modules-strip-.llvm_addrsig-sections-and-similar.patch -Patch0259: 0259-modules-Don-t-allocate-space-for-non-allocable-secti.patch -Patch0260: 0260-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch -Patch0261: 0261-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch -Patch0262: 0262-modules-load-module-sections-at-page-aligned-address.patch -Patch0263: 0263-nx-add-memory-attribute-get-set-API.patch -Patch0264: 0264-nx-set-page-permissions-for-loaded-modules.patch -Patch0265: 0265-nx-set-attrs-in-our-kernel-loaders.patch -Patch0266: 0266-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch -Patch0267: 0267-grub-probe-document-the-behavior-of-multiple-v.patch -Patch0268: 0268-grub_fs_probe-dprint-errors-from-filesystems.patch -Patch0269: 0269-fs-fat-don-t-error-when-mtime-is-0.patch -Patch0270: 0270-Make-debug-file-show-which-file-filters-get-run.patch -Patch0271: 0271-efi-use-enumerated-array-positions-for-our-allocatio.patch -Patch0272: 0272-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch -Patch0273: 0273-efi-allocate-the-initrd-within-the-bounds-expressed-.patch -Patch0274: 0274-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch -Patch0275: 0275-BLS-create-etc-kernel-cmdline-during-mkconfig.patch -Patch0276: 0276-squish-don-t-dup-rhgb-quiet-check-mtimes.patch -Patch0277: 0277-squish-give-up-on-rhgb-quiet.patch -Patch0278: 0278-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch -Patch0279: 0279-ieee1275-implement-vec5-for-cas-negotiation.patch -Patch0280: 0280-blscfg-Don-t-root-device-in-emu-builds.patch -Patch0281: 0281-loader-arm64-linux-Remove-magic-number-header-field-.patch -Patch0282: 0282-Correct-BSS-zeroing-on-aarch64.patch -Patch0283: 0283-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch -Patch0284: 0284-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch -Patch0285: 0285-commands-efi-tpm-Refine-the-status-of-log-event.patch -Patch0286: 0286-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch -Patch0287: 0287-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch +Patch0032: 0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0033: 0033-Add-friendly-grub2-password-config-tool-985962.patch +Patch0034: 0034-tcp-add-window-scaling-support.patch +Patch0035: 0035-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0036: 0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0037: 0037-bz1374141-fix-incorrect-mask-for-ppc64.patch +Patch0038: 0038-Make-grub_fatal-also-backtrace.patch +Patch0039: 0039-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0040: 0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0041: 0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0042: 0042-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0043: 0043-grub2-btrfs-03-follow_default.patch +Patch0044: 0044-grub2-btrfs-04-grub2-install.patch +Patch0045: 0045-grub2-btrfs-05-grub2-mkconfig.patch +Patch0046: 0046-grub2-btrfs-06-subvol-mount.patch +Patch0047: 0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0048: 0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0049: 0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0050: 0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0051: 0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0052: 0052-don-t-use-int-for-efi-status.patch +Patch0053: 0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0054: 0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +Patch0055: 0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +Patch0056: 0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +Patch0057: 0057-align-struct-efi_variable-better.patch +Patch0058: 0058-Add-BLS-support-to-grub-mkconfig.patch +Patch0059: 0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +Patch0060: 0060-Add-linux-and-initrd-commands-for-grub-emu.patch +Patch0061: 0061-Add-grub2-switch-to-blscfg.patch +Patch0062: 0062-make-better-backtraces.patch +Patch0063: 0063-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0064: 0064-Work-around-some-minor-include-path-weirdnesses.patch +Patch0065: 0065-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0066: 0066-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0067: 0067-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0068: 0068-Fixup-for-newer-compiler.patch +Patch0069: 0069-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +Patch0070: 0070-Fixup-for-newer-compiler.patch +Patch0071: 0071-Add-support-for-non-Ethernet-network-cards.patch +Patch0072: 0072-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0073: 0073-bootp-New-net_bootp6-command.patch +Patch0074: 0074-efinet-UEFI-IPv6-PXE-support.patch +Patch0075: 0075-grub.texi-Add-net_bootp6-doument.patch +Patch0076: 0076-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0077: 0077-efinet-Setting-network-from-UEFI-device-path.patch +Patch0078: 0078-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0079: 0079-Support-UEFI-networking-protocols.patch +Patch0080: 0080-AUDIT-0-http-boot-tracker-bug.patch +Patch0081: 0081-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0082: 0082-Add-auto-hide-menu-support.patch +Patch0083: 0083-Add-grub-set-bootflag-utility.patch +Patch0084: 0084-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0085: 0085-gentpl-add-disable-support.patch +Patch0086: 0086-gentpl-add-pc-firmware-type.patch +Patch0087: 0087-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0088: 0088-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0089: 0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0090: 0090-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0091: 0091-Rework-how-the-fdt-command-builds.patch +Patch0092: 0092-Disable-non-wordsize-allocations-on-arm.patch +Patch0093: 0093-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0094: 0094-Make-grub_error-more-verbose.patch +Patch0095: 0095-Make-reset-an-alias-for-the-reboot-command.patch +Patch0096: 0096-Add-a-version-command.patch +Patch0097: 0097-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0098: 0098-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0099: 0099-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0100: 0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0101: 0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0102: 0102-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0103: 0103-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0104: 0104-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0105: 0105-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0106: 0106-Fix-getroot.c-s-trampolines.patch +Patch0107: 0107-Do-not-allow-stack-trampolines-anywhere.patch +Patch0108: 0108-Reimplement-boot_counter.patch +Patch0109: 0109-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0110: 0110-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0111: 0111-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0112: 0112-Make-it-possible-to-subtract-conditions-from-debug.patch +Patch0113: 0113-Export-all-variables-from-the-initial-context-when-c.patch +Patch0114: 0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0115: 0115-Fix-systemctl-kexec-exit-status-check.patch +Patch0116: 0116-Print-grub-emu-linux-loader-messages-as-debug.patch +Patch0117: 0117-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0118: 0118-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0119: 0119-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0120: 0120-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0121: 0121-Add-start-symbol-for-RISC-V.patch +Patch0122: 0122-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0123: 0123-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0124: 0124-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0125: 0125-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0126: 0126-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0127: 0127-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0128: 0128-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0129: 0129-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0130: 0130-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0131: 0131-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0132: 0132-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0133: 0133-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0134: 0134-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0135: 0135-efi-http-fix-some-allocation-error-checking.patch +Patch0136: 0136-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0137: 0137-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0138: 0138-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0139: 0139-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0140: 0140-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0141: 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0144: 0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0145: 0145-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0146: 0146-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0147: 0147-grub-install-disable-support-for-EFI-platforms.patch +Patch0148: 0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0149: 0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0150: 0150-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0151: 0151-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0152: 0152-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0153: 0153-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0154: 0154-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0155: 0155-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0156: 0156-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0157: 0157-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0158: 0158-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0159: 0159-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0160: 0160-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0161: 0161-pgp-factor-out-rsa_pad.patch +Patch0162: 0162-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0163: 0163-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0164: 0164-libtasn1-import-libtasn1-4.16.0.patch +Patch0165: 0165-libtasn1-disable-code-not-needed-in-grub.patch +Patch0166: 0166-libtasn1-changes-for-grub-compatibility.patch +Patch0167: 0167-libtasn1-compile-into-asn1-module.patch +Patch0168: 0168-test_asn1-test-module-for-libtasn1.patch +Patch0169: 0169-grub-install-support-embedding-x509-certificates.patch +Patch0170: 0170-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0171: 0171-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0172: 0172-appended-signatures-support-verifying-appended-signa.patch +Patch0173: 0173-appended-signatures-verification-tests.patch +Patch0174: 0174-appended-signatures-documentation.patch +Patch0175: 0175-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0176: 0176-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0177: 0177-ieee1275-claim-more-memory.patch +Patch0178: 0178-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0179: 0179-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0180: 0180-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0181: 0181-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0182: 0182-efinet-Add-DHCP-proxy-support.patch +Patch0183: 0183-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0184: 0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0185: 0185-Suppress-gettext-error-message.patch +Patch0186: 0186-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0187: 0187-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0188: 0188-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0189: 0189-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0190: 0190-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0191: 0191-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0192: 0192-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0193: 0193-Print-module-name-on-license-check-failure.patch +Patch0194: 0194-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0195: 0195-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0196: 0196-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0197: 0197-Add-Fedora-location-of-DejaVu-SANS-font.patch +Patch0198: 0198-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +Patch0199: 0199-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +Patch0200: 0200-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +Patch0201: 0201-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +Patch0202: 0202-Use-visual-indentation-in-config.h.in.patch +Patch0203: 0203-Where-present-ensure-config-util.h-precedes-config.h.patch +Patch0204: 0204-Drop-gnulib-fix-base64.patch.patch +Patch0205: 0205-Drop-gnulib-no-abort.patch.patch +Patch0206: 0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch +Patch0207: 0207-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +Patch0208: 0208-search-new-efidisk-only-option-on-EFI-systems.patch +Patch0209: 0209-efi-new-connectefi-command.patch +Patch0210: 0210-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0211: 0211-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +Patch0212: 0212-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0213: 0213-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0214: 0214-powerpc-do-CAS-in-a-more-compatible-way.patch +Patch0215: 0215-powerpc-prefix-detection-support-device-names-with-c.patch +Patch0216: 0216-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +Patch0217: 0217-make-ofdisk_retries-optional.patch +Patch0218: 0218-loader-efi-chainloader-grub_load_and_start_image-doe.patch +Patch0219: 0219-loader-efi-chainloader-simplify-the-loader-state.patch +Patch0220: 0220-commands-boot-Add-API-to-pass-context-to-loader.patch +Patch0221: 0221-loader-efi-chainloader-Use-grub_loader_set_ex.patch +Patch0222: 0222-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch +Patch0223: 0223-loader-i386-efi-linux-Use-grub_loader_set_ex.patch +Patch0224: 0224-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch +Patch0225: 0225-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch +Patch0226: 0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch +Patch0227: 0227-video-readers-png-Abort-sooner-if-a-read-operation-f.patch +Patch0228: 0228-video-readers-png-Refuse-to-handle-multiple-image-he.patch +Patch0229: 0229-video-readers-png-Drop-greyscale-support-to-fix-heap.patch +Patch0230: 0230-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch +Patch0231: 0231-video-readers-png-Sanity-check-some-huffman-codes.patch +Patch0232: 0232-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch +Patch0233: 0233-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch +Patch0234: 0234-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch +Patch0235: 0235-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch +Patch0236: 0236-normal-charset-Fix-array-out-of-bounds-formatting-un.patch +Patch0237: 0237-net-netbuff-Block-overly-large-netbuff-allocs.patch +Patch0238: 0238-net-ip-Do-IP-fragment-maths-safely.patch +Patch0239: 0239-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch +Patch0240: 0240-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch +Patch0241: 0241-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch +Patch0242: 0242-net-tftp-Avoid-a-trivial-UAF.patch +Patch0243: 0243-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch +Patch0244: 0244-net-http-Fix-OOB-write-for-split-http-headers.patch +Patch0245: 0245-net-http-Error-out-on-headers-with-LF-without-CR.patch +Patch0246: 0246-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch +Patch0247: 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch +Patch0248: 0248-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch +Patch0249: 0249-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch +Patch0250: 0250-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch +Patch0251: 0251-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch +Patch0252: 0252-misc-Make-grub_min-and-grub_max-more-resilient.patch +Patch0253: 0253-ReiserFS-switch-to-using-grub_min-grub_max.patch +Patch0254: 0254-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch +Patch0255: 0255-modules-make-.module_license-read-only.patch +Patch0256: 0256-modules-strip-.llvm_addrsig-sections-and-similar.patch +Patch0257: 0257-modules-Don-t-allocate-space-for-non-allocable-secti.patch +Patch0258: 0258-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch +Patch0259: 0259-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch +Patch0260: 0260-modules-load-module-sections-at-page-aligned-address.patch +Patch0261: 0261-nx-add-memory-attribute-get-set-API.patch +Patch0262: 0262-nx-set-page-permissions-for-loaded-modules.patch +Patch0263: 0263-nx-set-attrs-in-our-kernel-loaders.patch +Patch0264: 0264-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch +Patch0265: 0265-grub-probe-document-the-behavior-of-multiple-v.patch +Patch0266: 0266-grub_fs_probe-dprint-errors-from-filesystems.patch +Patch0267: 0267-fs-fat-don-t-error-when-mtime-is-0.patch +Patch0268: 0268-Make-debug-file-show-which-file-filters-get-run.patch +Patch0269: 0269-efi-use-enumerated-array-positions-for-our-allocatio.patch +Patch0270: 0270-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch +Patch0271: 0271-efi-allocate-the-initrd-within-the-bounds-expressed-.patch +Patch0272: 0272-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch +Patch0273: 0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +Patch0274: 0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +Patch0275: 0275-squish-give-up-on-rhgb-quiet.patch +Patch0276: 0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +Patch0277: 0277-ieee1275-implement-vec5-for-cas-negotiation.patch +Patch0278: 0278-blscfg-Don-t-root-device-in-emu-builds.patch +Patch0279: 0279-loader-arm64-linux-Remove-magic-number-header-field-.patch +Patch0280: 0280-Correct-BSS-zeroing-on-aarch64.patch +Patch0281: 0281-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch +Patch0282: 0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch +Patch0283: 0283-commands-efi-tpm-Refine-the-status-of-log-event.patch +Patch0284: 0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch +Patch0285: 0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch diff --git a/grub2.spec b/grub2.spec index 23c0c556..0e504c2e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 61%{?dist} +Release: 62%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -426,7 +426,6 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %{_datarootdir}/bash-completion/completions/grub %{_sbindir}/grub2-mkconfig %{_sbindir}/grub2-switch-to-blscfg -%{_sbindir}/grub2-rpm-sort %{_sbindir}/grub2-reboot %{_bindir}/grub2-file %{_bindir}/grub2-menulst2cfg @@ -530,6 +529,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Nov 01 2022 Robbie Harwood - 1:2.06-62 +- Try dropping custom sort again +- See-also: https://github.com/rpm-software-management/rpm/pull/2249 + * Fri Oct 28 2022 Robbie Harwood - 2.06-61 - TDX measurements to RTMR From 3972172d4d8275fb75118d12eff4c6b543debbce Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 8 Nov 2022 16:00:37 +0000 Subject: [PATCH 156/294] Font fixes (CVE-2022-2601 batch) Signed-off-by: Robbie Harwood --- ...hs-exceeds-font-max_glyph_width-or-f.patch | 31 +++++ ...erflow-in-grub_font_get_glyph_intern.patch | 110 ++++++++++++++++++ ...-integer-overflows-in-grub_font_cons.patch | 79 +++++++++++++ 0289-font-Remove-grub_font_dup_glyph.patch | 40 +++++++ ...nteger-overflow-in-ensure_comb_space.patch | 46 ++++++++ ...nt-Fix-integer-overflow-in-BMP-index.patch | 63 ++++++++++ ...-underflow-in-binary-search-of-char-.patch | 83 +++++++++++++ ...b-Enforce-verification-of-font-files.patch | 52 +++++++++ 0294-fbutil-Fix-integer-overflow.patch | 83 +++++++++++++ ...ix-an-integer-underflow-in-blit_comb.patch | 89 ++++++++++++++ ..._font_blit_glyph-and-grub_font_blit_.patch | 73 ++++++++++++ ...l_font-to-glyphs-in-ascii_font_glyph.patch | 34 ++++++ ...ix-an-integer-overflow-in-grub_unico.patch | 53 +++++++++ grub.patches | 13 +++ grub2.spec | 5 +- sbat.csv.in | 2 +- 16 files changed, 854 insertions(+), 2 deletions(-) create mode 100644 0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch create mode 100644 0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch create mode 100644 0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch create mode 100644 0289-font-Remove-grub_font_dup_glyph.patch create mode 100644 0290-font-Fix-integer-overflow-in-ensure_comb_space.patch create mode 100644 0291-font-Fix-integer-overflow-in-BMP-index.patch create mode 100644 0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch create mode 100644 0293-kern-efi-sb-Enforce-verification-of-font-files.patch create mode 100644 0294-fbutil-Fix-integer-overflow.patch create mode 100644 0295-font-Fix-an-integer-underflow-in-blit_comb.patch create mode 100644 0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch create mode 100644 0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch create mode 100644 0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch diff --git a/0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch b/0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch new file mode 100644 index 00000000..e0dd347d --- /dev/null +++ b/0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Wed, 3 Aug 2022 19:45:33 +0800 +Subject: [PATCH] font: Reject glyphs exceeds font->max_glyph_width or + font->max_glyph_height + +Check glyph's width and height against limits specified in font's +metadata. Reject the glyph (and font) if such limits are exceeded. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 5760fcfd466cc757540ea0d591bad6a08caeaa16) +--- + grub-core/font/font.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index d09bb38d89..2f09a4a55b 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -760,7 +760,9 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) + || read_be_uint16 (font->file, &height) != 0 + || read_be_int16 (font->file, &xoff) != 0 + || read_be_int16 (font->file, &yoff) != 0 +- || read_be_int16 (font->file, &dwidth) != 0) ++ || read_be_int16 (font->file, &dwidth) != 0 ++ || width > font->max_char_width ++ || height > font->max_char_height) + { + remove_font (font); + return 0; diff --git a/0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch b/0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch new file mode 100644 index 00000000..b5f10f6e --- /dev/null +++ b/0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch @@ -0,0 +1,110 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Fri, 5 Aug 2022 00:51:20 +0800 +Subject: [PATCH] font: Fix size overflow in grub_font_get_glyph_internal() + +The length of memory allocation and file read may overflow. This patch +fixes the problem by using safemath macros. + +There is a lot of code repetition like "(x * y + 7) / 8". It is unsafe +if overflow happens. This patch introduces grub_video_bitmap_calc_1bpp_bufsz(). +It is safe replacement for such code. It has safemath-like prototype. + +This patch also introduces grub_cast(value, pointer), it casts value to +typeof(*pointer) then store the value to *pointer. It returns true when +overflow occurs or false if there is no overflow. The semantics of arguments +and return value are designed to be consistent with other safemath macros. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 941d10ad6f1dcbd12fb613002249e29ba035f985) +--- + grub-core/font/font.c | 17 +++++++++++++---- + include/grub/bitmap.h | 18 ++++++++++++++++++ + include/grub/safemath.h | 2 ++ + 3 files changed, 33 insertions(+), 4 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 2f09a4a55b..6a3fbebbd8 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -739,7 +739,8 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) + grub_int16_t xoff; + grub_int16_t yoff; + grub_int16_t dwidth; +- int len; ++ grub_ssize_t len; ++ grub_size_t sz; + + if (index_entry->glyph) + /* Return cached glyph. */ +@@ -768,9 +769,17 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) + return 0; + } + +- len = (width * height + 7) / 8; +- glyph = grub_malloc (sizeof (struct grub_font_glyph) + len); +- if (!glyph) ++ /* Calculate real struct size of current glyph. */ ++ if (grub_video_bitmap_calc_1bpp_bufsz (width, height, &len) || ++ grub_add (sizeof (struct grub_font_glyph), len, &sz)) ++ { ++ remove_font (font); ++ return 0; ++ } ++ ++ /* Allocate and initialize the glyph struct. */ ++ glyph = grub_malloc (sz); ++ if (glyph == NULL) + { + remove_font (font); + return 0; +diff --git a/include/grub/bitmap.h b/include/grub/bitmap.h +index 5728f8ca3a..0d9603f619 100644 +--- a/include/grub/bitmap.h ++++ b/include/grub/bitmap.h +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + struct grub_video_bitmap + { +@@ -79,6 +80,23 @@ grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap) + return bitmap->mode_info.height; + } + ++/* ++ * Calculate and store the size of data buffer of 1bit bitmap in result. ++ * Equivalent to "*result = (width * height + 7) / 8" if no overflow occurs. ++ * Return true when overflow occurs or false if there is no overflow. ++ * This function is intentionally implemented as a macro instead of ++ * an inline function. Although a bit awkward, it preserves data types for ++ * safemath macros and reduces macro side effects as much as possible. ++ * ++ * XXX: Will report false overflow if width * height > UINT64_MAX. ++ */ ++#define grub_video_bitmap_calc_1bpp_bufsz(width, height, result) \ ++({ \ ++ grub_uint64_t _bitmap_pixels; \ ++ grub_mul ((width), (height), &_bitmap_pixels) ? 1 : \ ++ grub_cast (_bitmap_pixels / GRUB_CHAR_BIT + !!(_bitmap_pixels % GRUB_CHAR_BIT), (result)); \ ++}) ++ + void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap, + struct grub_video_mode_info *mode_info); + +diff --git a/include/grub/safemath.h b/include/grub/safemath.h +index c17b89bba1..bb0f826de1 100644 +--- a/include/grub/safemath.h ++++ b/include/grub/safemath.h +@@ -30,6 +30,8 @@ + #define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res) + #define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res) + ++#define grub_cast(a, res) grub_add ((a), 0, (res)) ++ + #else + #error gcc 5.1 or newer or clang 3.8 or newer is required + #endif diff --git a/0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch b/0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch new file mode 100644 index 00000000..3c76eb46 --- /dev/null +++ b/0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Fri, 5 Aug 2022 01:58:27 +0800 +Subject: [PATCH] font: Fix several integer overflows in + grub_font_construct_glyph() + +This patch fixes several integer overflows in grub_font_construct_glyph(). +Glyphs of invalid size, zero or leading to an overflow, are rejected. +The inconsistency between "glyph" and "max_glyph_size" when grub_malloc() +returns NULL is fixed too. + +Fixes: CVE-2022-2601 + +Reported-by: Zhang Boyang +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit b1805f251b31a9d3cfae5c3572ddfa630145dbbf) +--- + grub-core/font/font.c | 29 +++++++++++++++++------------ + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 6a3fbebbd8..1fa181d4ca 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -1517,6 +1517,7 @@ grub_font_construct_glyph (grub_font_t hinted_font, + struct grub_video_signed_rect bounds; + static struct grub_font_glyph *glyph = 0; + static grub_size_t max_glyph_size = 0; ++ grub_size_t cur_glyph_size; + + ensure_comb_space (glyph_id); + +@@ -1533,29 +1534,33 @@ grub_font_construct_glyph (grub_font_t hinted_font, + if (!glyph_id->ncomb && !glyph_id->attributes) + return main_glyph; + +- if (max_glyph_size < sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) ++ if (grub_video_bitmap_calc_1bpp_bufsz (bounds.width, bounds.height, &cur_glyph_size) || ++ grub_add (sizeof (*glyph), cur_glyph_size, &cur_glyph_size)) ++ return main_glyph; ++ ++ if (max_glyph_size < cur_glyph_size) + { + grub_free (glyph); +- max_glyph_size = (sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) * 2; +- if (max_glyph_size < 8) +- max_glyph_size = 8; +- glyph = grub_malloc (max_glyph_size); ++ if (grub_mul (cur_glyph_size, 2, &max_glyph_size)) ++ max_glyph_size = 0; ++ glyph = max_glyph_size > 0 ? grub_malloc (max_glyph_size) : NULL; + } + if (!glyph) + { ++ max_glyph_size = 0; + grub_errno = GRUB_ERR_NONE; + return main_glyph; + } + +- grub_memset (glyph, 0, sizeof (*glyph) +- + (bounds.width * bounds.height +- + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT); ++ grub_memset (glyph, 0, cur_glyph_size); + + glyph->font = main_glyph->font; +- glyph->width = bounds.width; +- glyph->height = bounds.height; +- glyph->offset_x = bounds.x; +- glyph->offset_y = bounds.y; ++ if (bounds.width == 0 || bounds.height == 0 || ++ grub_cast (bounds.width, &glyph->width) || ++ grub_cast (bounds.height, &glyph->height) || ++ grub_cast (bounds.x, &glyph->offset_x) || ++ grub_cast (bounds.y, &glyph->offset_y)) ++ return main_glyph; + + if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR) + grub_font_blit_glyph_mirror (glyph, main_glyph, diff --git a/0289-font-Remove-grub_font_dup_glyph.patch b/0289-font-Remove-grub_font_dup_glyph.patch new file mode 100644 index 00000000..4c3db923 --- /dev/null +++ b/0289-font-Remove-grub_font_dup_glyph.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Fri, 5 Aug 2022 02:13:29 +0800 +Subject: [PATCH] font: Remove grub_font_dup_glyph() + +Remove grub_font_dup_glyph() since nobody is using it since 2013, and +I'm too lazy to fix the integer overflow problem in it. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 25ad31c19c331aaa2dbd9bd2b2e2655de5766a9d) +--- + grub-core/font/font.c | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 1fa181d4ca..a115a63b0c 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -1055,20 +1055,6 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code) + return best_glyph; + } + +-#if 0 +-static struct grub_font_glyph * +-grub_font_dup_glyph (struct grub_font_glyph *glyph) +-{ +- static struct grub_font_glyph *ret; +- ret = grub_malloc (sizeof (*ret) + (glyph->width * glyph->height + 7) / 8); +- if (!ret) +- return NULL; +- grub_memcpy (ret, glyph, sizeof (*ret) +- + (glyph->width * glyph->height + 7) / 8); +- return ret; +-} +-#endif +- + /* FIXME: suboptimal. */ + static void + grub_font_blit_glyph (struct grub_font_glyph *target, diff --git a/0290-font-Fix-integer-overflow-in-ensure_comb_space.patch b/0290-font-Fix-integer-overflow-in-ensure_comb_space.patch new file mode 100644 index 00000000..6b73038d --- /dev/null +++ b/0290-font-Fix-integer-overflow-in-ensure_comb_space.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Fri, 5 Aug 2022 02:27:05 +0800 +Subject: [PATCH] font: Fix integer overflow in ensure_comb_space() + +In fact it can't overflow at all because glyph_id->ncomb is only 8-bit +wide. But let's keep safe if somebody changes the width of glyph_id->ncomb +in the future. This patch also fixes the inconsistency between +render_max_comb_glyphs and render_combining_glyphs when grub_malloc() +returns NULL. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit b2740b7e4a03bb8331d48b54b119afea76bb9d5f) +--- + grub-core/font/font.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index a115a63b0c..d0e6340404 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -1468,14 +1468,18 @@ ensure_comb_space (const struct grub_unicode_glyph *glyph_id) + if (glyph_id->ncomb <= render_max_comb_glyphs) + return; + +- render_max_comb_glyphs = 2 * glyph_id->ncomb; +- if (render_max_comb_glyphs < 8) ++ if (grub_mul (glyph_id->ncomb, 2, &render_max_comb_glyphs)) ++ render_max_comb_glyphs = 0; ++ if (render_max_comb_glyphs > 0 && render_max_comb_glyphs < 8) + render_max_comb_glyphs = 8; + grub_free (render_combining_glyphs); +- render_combining_glyphs = grub_malloc (render_max_comb_glyphs +- * sizeof (render_combining_glyphs[0])); ++ render_combining_glyphs = (render_max_comb_glyphs > 0) ? ++ grub_calloc (render_max_comb_glyphs, sizeof (render_combining_glyphs[0])) : NULL; + if (!render_combining_glyphs) +- grub_errno = 0; ++ { ++ render_max_comb_glyphs = 0; ++ grub_errno = GRUB_ERR_NONE; ++ } + } + + int diff --git a/0291-font-Fix-integer-overflow-in-BMP-index.patch b/0291-font-Fix-integer-overflow-in-BMP-index.patch new file mode 100644 index 00000000..5e106991 --- /dev/null +++ b/0291-font-Fix-integer-overflow-in-BMP-index.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Mon, 15 Aug 2022 02:04:58 +0800 +Subject: [PATCH] font: Fix integer overflow in BMP index + +The BMP index (font->bmp_idx) is designed as a reverse lookup table of +char entries (font->char_index), in order to speed up lookups for BMP +chars (i.e. code < 0x10000). The values in BMP index are the subscripts +of the corresponding char entries, stored in grub_uint16_t, while 0xffff +means not found. + +This patch fixes the problem of large subscript truncated to grub_uint16_t, +leading BMP index to return wrong char entry or report false miss. The +code now checks for bounds and uses BMP index as a hint, and fallbacks +to binary-search if necessary. + +On the occasion add a comment about BMP index is initialized to 0xffff. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit afda8b60ba0712abe01ae1e64c5f7a067a0e6492) +--- + grub-core/font/font.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index d0e6340404..b208a28717 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -300,6 +300,8 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct + font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t)); + if (!font->bmp_idx) + return 1; ++ ++ /* Init the BMP index array to 0xffff. */ + grub_memset (font->bmp_idx, 0xff, 0x10000 * sizeof (grub_uint16_t)); + + +@@ -328,7 +330,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct + return 1; + } + +- if (entry->code < 0x10000) ++ if (entry->code < 0x10000 && i < 0xffff) + font->bmp_idx[entry->code] = i; + + last_code = entry->code; +@@ -696,9 +698,12 @@ find_glyph (const grub_font_t font, grub_uint32_t code) + /* Use BMP index if possible. */ + if (code < 0x10000 && font->bmp_idx) + { +- if (font->bmp_idx[code] == 0xffff) +- return 0; +- return &table[font->bmp_idx[code]]; ++ if (font->bmp_idx[code] < 0xffff) ++ return &table[font->bmp_idx[code]]; ++ /* ++ * When we are here then lookup in BMP index result in miss, ++ * fallthough to binary-search. ++ */ + } + + /* Do a binary search in `char_index', which is ordered by code point. */ diff --git a/0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch b/0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch new file mode 100644 index 00000000..e81824ba --- /dev/null +++ b/0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Sun, 14 Aug 2022 18:09:38 +0800 +Subject: [PATCH] font: Fix integer underflow in binary search of char index + +If search target is less than all entries in font->index then "hi" +variable is set to -1, which translates to SIZE_MAX and leads to errors. + +This patch fixes the problem by replacing the entire binary search code +with the libstdc++'s std::lower_bound() implementation. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit c140a086838e7c9af87842036f891b8393a8c4bc) +--- + grub-core/font/font.c | 40 ++++++++++++++++++++++------------------ + 1 file changed, 22 insertions(+), 18 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index b208a28717..193dfec045 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -688,12 +688,12 @@ read_be_int16 (grub_file_t file, grub_int16_t * value) + static inline struct char_index_entry * + find_glyph (const grub_font_t font, grub_uint32_t code) + { +- struct char_index_entry *table; +- grub_size_t lo; +- grub_size_t hi; +- grub_size_t mid; ++ struct char_index_entry *table, *first, *end; ++ grub_size_t len; + + table = font->char_index; ++ if (table == NULL) ++ return NULL; + + /* Use BMP index if possible. */ + if (code < 0x10000 && font->bmp_idx) +@@ -706,25 +706,29 @@ find_glyph (const grub_font_t font, grub_uint32_t code) + */ + } + +- /* Do a binary search in `char_index', which is ordered by code point. */ +- lo = 0; +- hi = font->num_chars - 1; ++ /* ++ * Do a binary search in char_index which is ordered by code point. ++ * The code below is the same as libstdc++'s std::lower_bound(). ++ */ ++ first = table; ++ len = font->num_chars; ++ end = first + len; + +- if (!table) +- return 0; +- +- while (lo <= hi) ++ while (len > 0) + { +- mid = lo + (hi - lo) / 2; +- if (code < table[mid].code) +- hi = mid - 1; +- else if (code > table[mid].code) +- lo = mid + 1; ++ grub_size_t half = len >> 1; ++ struct char_index_entry *middle = first + half; ++ ++ if (middle->code < code) ++ { ++ first = middle + 1; ++ len = len - half - 1; ++ } + else +- return &table[mid]; ++ len = half; + } + +- return 0; ++ return (first < end && first->code == code) ? first : NULL; + } + + /* Get a glyph for the Unicode character CODE in FONT. The glyph is loaded diff --git a/0293-kern-efi-sb-Enforce-verification-of-font-files.patch b/0293-kern-efi-sb-Enforce-verification-of-font-files.patch new file mode 100644 index 00000000..1a381b0d --- /dev/null +++ b/0293-kern-efi-sb-Enforce-verification-of-font-files.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Sun, 14 Aug 2022 15:51:54 +0800 +Subject: [PATCH] kern/efi/sb: Enforce verification of font files + +As a mitigation and hardening measure enforce verification of font +files. Then only trusted font files can be load. This will reduce the +attack surface at cost of losing the ability of end-users to customize +fonts if e.g. UEFI Secure Boot is enabled. Vendors can always customize +fonts because they have ability to pack fonts into their GRUB bundles. + +This goal is achieved by: + + * Removing GRUB_FILE_TYPE_FONT from shim lock verifier's + skip-verification list. + + * Adding GRUB_FILE_TYPE_FONT to lockdown verifier's defer-auth list, + so font files must be verified by a verifier before they can be loaded. + +Suggested-by: Daniel Kiper +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 630deb8c0d8b02b670ced4b7030414bcf17aa080) +--- + grub-core/kern/efi/sb.c | 1 - + grub-core/kern/lockdown.c | 1 + + 2 files changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c +index 89c4bb3fd1..db42c2539f 100644 +--- a/grub-core/kern/efi/sb.c ++++ b/grub-core/kern/efi/sb.c +@@ -145,7 +145,6 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)), + case GRUB_FILE_TYPE_PRINT_BLOCKLIST: + case GRUB_FILE_TYPE_TESTLOAD: + case GRUB_FILE_TYPE_GET_SIZE: +- case GRUB_FILE_TYPE_FONT: + case GRUB_FILE_TYPE_ZFS_ENCRYPTION_KEY: + case GRUB_FILE_TYPE_CAT: + case GRUB_FILE_TYPE_HEXCAT: +diff --git a/grub-core/kern/lockdown.c b/grub-core/kern/lockdown.c +index 0bc70fd42d..af6d493cd3 100644 +--- a/grub-core/kern/lockdown.c ++++ b/grub-core/kern/lockdown.c +@@ -51,6 +51,7 @@ lockdown_verifier_init (grub_file_t io __attribute__ ((unused)), + case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE: + case GRUB_FILE_TYPE_ACPI_TABLE: + case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE: ++ case GRUB_FILE_TYPE_FONT: + *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH; + + /* Fall through. */ diff --git a/0294-fbutil-Fix-integer-overflow.patch b/0294-fbutil-Fix-integer-overflow.patch new file mode 100644 index 00000000..4d32dbda --- /dev/null +++ b/0294-fbutil-Fix-integer-overflow.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Tue, 6 Sep 2022 03:03:21 +0800 +Subject: [PATCH] fbutil: Fix integer overflow + +Expressions like u64 = u32 * u32 are unsafe because their products are +truncated to u32 even if left hand side is u64. This patch fixes all +problems like that one in fbutil. + +To get right result not only left hand side have to be u64 but it's also +necessary to cast at least one of the operands of all leaf operators of +right hand side to u64, e.g. u64 = u32 * u32 + u32 * u32 should be +u64 = (u64)u32 * u32 + (u64)u32 * u32. + +For 1-bit bitmaps grub_uint64_t have to be used. It's safe because any +combination of values in (grub_uint64_t)u32 * u32 + u32 expression will +not overflow grub_uint64_t. + +Other expressions like ptr + u32 * u32 + u32 * u32 are also vulnerable. +They should be ptr + (grub_addr_t)u32 * u32 + (grub_addr_t)u32 * u32. + +This patch also adds a comment to grub_video_fb_get_video_ptr() which +says it's arguments must be valid and no sanity check is performed +(like its siblings in grub-core/video/fb/fbutil.c). + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 50a11a81bc842c58962244a2dc86bbd31a426e12) +--- + grub-core/video/fb/fbutil.c | 4 ++-- + include/grub/fbutil.h | 13 +++++++++---- + 2 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/grub-core/video/fb/fbutil.c b/grub-core/video/fb/fbutil.c +index b98bb51fe8..25ef39f47d 100644 +--- a/grub-core/video/fb/fbutil.c ++++ b/grub-core/video/fb/fbutil.c +@@ -67,7 +67,7 @@ get_pixel (struct grub_video_fbblit_info *source, + case 1: + if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED) + { +- int bit_index = y * source->mode_info->width + x; ++ grub_uint64_t bit_index = (grub_uint64_t) y * source->mode_info->width + x; + grub_uint8_t *ptr = source->data + bit_index / 8; + int bit_pos = 7 - bit_index % 8; + color = (*ptr >> bit_pos) & 0x01; +@@ -138,7 +138,7 @@ set_pixel (struct grub_video_fbblit_info *source, + case 1: + if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED) + { +- int bit_index = y * source->mode_info->width + x; ++ grub_uint64_t bit_index = (grub_uint64_t) y * source->mode_info->width + x; + grub_uint8_t *ptr = source->data + bit_index / 8; + int bit_pos = 7 - bit_index % 8; + *ptr = (*ptr & ~(1 << bit_pos)) | ((color & 0x01) << bit_pos); +diff --git a/include/grub/fbutil.h b/include/grub/fbutil.h +index 4205eb917f..78a1ab3b45 100644 +--- a/include/grub/fbutil.h ++++ b/include/grub/fbutil.h +@@ -31,14 +31,19 @@ struct grub_video_fbblit_info + grub_uint8_t *data; + }; + +-/* Don't use for 1-bit bitmaps, addressing needs to be done at the bit level +- and it doesn't make sense, in general, to ask for a pointer +- to a particular pixel's data. */ ++/* ++ * Don't use for 1-bit bitmaps, addressing needs to be done at the bit level ++ * and it doesn't make sense, in general, to ask for a pointer ++ * to a particular pixel's data. ++ * ++ * This function assumes that bounds checking has been done in previous phase ++ * and they are opted out in here. ++ */ + static inline void * + grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source, + unsigned int x, unsigned int y) + { +- return source->data + y * source->mode_info->pitch + x * source->mode_info->bytes_per_pixel; ++ return source->data + (grub_addr_t) y * source->mode_info->pitch + (grub_addr_t) x * source->mode_info->bytes_per_pixel; + } + + /* Advance pointer by VAL bytes. If there is no unaligned access available, diff --git a/0295-font-Fix-an-integer-underflow-in-blit_comb.patch b/0295-font-Fix-an-integer-underflow-in-blit_comb.patch new file mode 100644 index 00000000..72f4308e --- /dev/null +++ b/0295-font-Fix-an-integer-underflow-in-blit_comb.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Mon, 24 Oct 2022 08:05:35 +0800 +Subject: [PATCH] font: Fix an integer underflow in blit_comb() + +The expression (ctx.bounds.height - combining_glyphs[i]->height) / 2 may +evaluate to a very big invalid value even if both ctx.bounds.height and +combining_glyphs[i]->height are small integers. For example, if +ctx.bounds.height is 10 and combining_glyphs[i]->height is 12, this +expression evaluates to 2147483647 (expected -1). This is because +coordinates are allowed to be negative but ctx.bounds.height is an +unsigned int. So, the subtraction operates on unsigned ints and +underflows to a very big value. The division makes things even worse. +The quotient is still an invalid value even if converted back to int. + +This patch fixes the problem by casting ctx.bounds.height to int. As +a result the subtraction will operate on int and grub_uint16_t which +will be promoted to an int. So, the underflow will no longer happen. Other +uses of ctx.bounds.height (and ctx.bounds.width) are also casted to int, +to ensure coordinates are always calculated on signed integers. + +Fixes: CVE-2022-3775 + +Reported-by: Daniel Axtens +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 6d2668dea3774ed74c4cd1eadd146f1b846bc3d4) +--- + grub-core/font/font.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 193dfec045..12a5f0d08c 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -1203,12 +1203,12 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + ctx.bounds.height = main_glyph->height; + + above_rightx = main_glyph->offset_x + main_glyph->width; +- above_righty = ctx.bounds.y + ctx.bounds.height; ++ above_righty = ctx.bounds.y + (int) ctx.bounds.height; + + above_leftx = main_glyph->offset_x; +- above_lefty = ctx.bounds.y + ctx.bounds.height; ++ above_lefty = ctx.bounds.y + (int) ctx.bounds.height; + +- below_rightx = ctx.bounds.x + ctx.bounds.width; ++ below_rightx = ctx.bounds.x + (int) ctx.bounds.width; + below_righty = ctx.bounds.y; + + comb = grub_unicode_get_comb (glyph_id); +@@ -1221,7 +1221,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + + if (!combining_glyphs[i]) + continue; +- targetx = (ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x; ++ targetx = ((int) ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x; + /* CGJ is to avoid diacritics reordering. */ + if (comb[i].code + == GRUB_UNICODE_COMBINING_GRAPHEME_JOINER) +@@ -1231,8 +1231,8 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + case GRUB_UNICODE_COMB_OVERLAY: + do_blit (combining_glyphs[i], + targetx, +- (ctx.bounds.height - combining_glyphs[i]->height) / 2 +- - (ctx.bounds.height + ctx.bounds.y), &ctx); ++ ((int) ctx.bounds.height - combining_glyphs[i]->height) / 2 ++ - ((int) ctx.bounds.height + ctx.bounds.y), &ctx); + if (min_devwidth < combining_glyphs[i]->width) + min_devwidth = combining_glyphs[i]->width; + break; +@@ -1305,7 +1305,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + /* Fallthrough. */ + case GRUB_UNICODE_STACK_ATTACHED_ABOVE: + do_blit (combining_glyphs[i], targetx, +- -(ctx.bounds.height + ctx.bounds.y + space ++ -((int) ctx.bounds.height + ctx.bounds.y + space + + combining_glyphs[i]->height), &ctx); + if (min_devwidth < combining_glyphs[i]->width) + min_devwidth = combining_glyphs[i]->width; +@@ -1313,7 +1313,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + + case GRUB_UNICODE_COMB_HEBREW_DAGESH: + do_blit (combining_glyphs[i], targetx, +- -(ctx.bounds.height / 2 + ctx.bounds.y ++ -((int) ctx.bounds.height / 2 + ctx.bounds.y + + combining_glyphs[i]->height / 2), &ctx); + if (min_devwidth < combining_glyphs[i]->width) + min_devwidth = combining_glyphs[i]->width; diff --git a/0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch b/0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch new file mode 100644 index 00000000..5207c128 --- /dev/null +++ b/0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Mon, 24 Oct 2022 07:15:41 +0800 +Subject: [PATCH] font: Harden grub_font_blit_glyph() and + grub_font_blit_glyph_mirror() + +As a mitigation and hardening measure add sanity checks to +grub_font_blit_glyph() and grub_font_blit_glyph_mirror(). This patch +makes these two functions do nothing if target blitting area isn't fully +contained in target bitmap. Therefore, if complex calculations in caller +overflows and malicious coordinates are given, we are still safe because +any coordinates which result in out-of-bound-write are rejected. However, +this patch only checks for invalid coordinates, and doesn't provide any +protection against invalid source glyph or destination glyph, e.g. +mismatch between glyph size and buffer size. + +This hardening measure is designed to mitigate possible overflows in +blit_comb(). If overflow occurs, it may return invalid bounding box +during dry run and call grub_font_blit_glyph() with malicious +coordinates during actual blitting. However, we are still safe because +the scratch glyph itself is valid, although its size makes no sense, and +any invalid coordinates are rejected. + +It would be better to call grub_fatal() if illegal parameter is detected. +However, doing this may end up in a dangerous recursion because grub_fatal() +would print messages to the screen and we are in the progress of drawing +characters on the screen. + +Reported-by: Daniel Axtens +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit fcd7aa0c278f7cf3fb9f93f1a3966e1792339eb6) +--- + grub-core/font/font.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 12a5f0d08c..29fbb94294 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -1069,8 +1069,15 @@ static void + grub_font_blit_glyph (struct grub_font_glyph *target, + struct grub_font_glyph *src, unsigned dx, unsigned dy) + { ++ grub_uint16_t max_x, max_y; + unsigned src_bit, tgt_bit, src_byte, tgt_byte; + unsigned i, j; ++ ++ /* Harden against out-of-bound writes. */ ++ if ((grub_add (dx, src->width, &max_x) || max_x > target->width) || ++ (grub_add (dy, src->height, &max_y) || max_y > target->height)) ++ return; ++ + for (i = 0; i < src->height; i++) + { + src_bit = (src->width * i) % 8; +@@ -1102,9 +1109,16 @@ grub_font_blit_glyph_mirror (struct grub_font_glyph *target, + struct grub_font_glyph *src, + unsigned dx, unsigned dy) + { ++ grub_uint16_t max_x, max_y; + unsigned tgt_bit, src_byte, tgt_byte; + signed src_bit; + unsigned i, j; ++ ++ /* Harden against out-of-bound writes. */ ++ if ((grub_add (dx, src->width, &max_x) || max_x > target->width) || ++ (grub_add (dy, src->height, &max_y) || max_y > target->height)) ++ return; ++ + for (i = 0; i < src->height; i++) + { + src_bit = (src->width * i + src->width - 1) % 8; diff --git a/0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch b/0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch new file mode 100644 index 00000000..c2bcc18f --- /dev/null +++ b/0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Fri, 28 Oct 2022 17:29:16 +0800 +Subject: [PATCH] font: Assign null_font to glyphs in ascii_font_glyph[] + +The calculations in blit_comb() need information from glyph's font, e.g. +grub_font_get_xheight(main_glyph->font). However, main_glyph->font is +NULL if main_glyph comes from ascii_font_glyph[]. Therefore +grub_font_get_*() crashes because of NULL pointer. + +There is already a solution, the null_font. So, assign it to those glyphs +in ascii_font_glyph[]. + +Reported-by: Daniel Axtens +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit dd539d695482069d28b40f2d3821f710cdcf6ee6) +--- + grub-core/font/font.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 29fbb94294..e6616e610c 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -137,7 +137,7 @@ ascii_glyph_lookup (grub_uint32_t code) + ascii_font_glyph[current]->offset_x = 0; + ascii_font_glyph[current]->offset_y = -2; + ascii_font_glyph[current]->device_width = 8; +- ascii_font_glyph[current]->font = NULL; ++ ascii_font_glyph[current]->font = &null_font; + + grub_memcpy (ascii_font_glyph[current]->bitmap, + &ascii_bitmaps[current * ASCII_BITMAP_SIZE], diff --git a/0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch b/0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch new file mode 100644 index 00000000..ec2184f0 --- /dev/null +++ b/0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Fri, 28 Oct 2022 21:31:39 +0800 +Subject: [PATCH] normal/charset: Fix an integer overflow in + grub_unicode_aglomerate_comb() + +The out->ncomb is a bit-field of 8 bits. So, the max possible value is 255. +However, code in grub_unicode_aglomerate_comb() doesn't check for an +overflow when incrementing out->ncomb. If out->ncomb is already 255, +after incrementing it will get 0 instead of 256, and cause illegal +memory access in subsequent processing. + +This patch introduces GRUB_UNICODE_NCOMB_MAX to represent the max +acceptable value of ncomb. The code now checks for this limit and +ignores additional combining characters when limit is reached. + +Reported-by: Daniel Axtens +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit da90d62316a3b105d2fbd7334d6521936bd6dcf6) +--- + grub-core/normal/charset.c | 3 +++ + include/grub/unicode.h | 2 ++ + 2 files changed, 5 insertions(+) + +diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c +index 7a5a7c153c..c243ca6dae 100644 +--- a/grub-core/normal/charset.c ++++ b/grub-core/normal/charset.c +@@ -472,6 +472,9 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, + if (!haveout) + continue; + ++ if (out->ncomb == GRUB_UNICODE_NCOMB_MAX) ++ continue; ++ + if (comb_type == GRUB_UNICODE_COMB_MC + || comb_type == GRUB_UNICODE_COMB_ME + || comb_type == GRUB_UNICODE_COMB_MN) +diff --git a/include/grub/unicode.h b/include/grub/unicode.h +index 4de986a857..c4f6fca043 100644 +--- a/include/grub/unicode.h ++++ b/include/grub/unicode.h +@@ -147,7 +147,9 @@ struct grub_unicode_glyph + grub_uint8_t bidi_level:6; /* minimum: 6 */ + enum grub_bidi_type bidi_type:5; /* minimum: :5 */ + ++#define GRUB_UNICODE_NCOMB_MAX ((1 << 8) - 1) + unsigned ncomb:8; ++ + /* Hint by unicode subsystem how wide this character usually is. + Real width is determined by font. Set only in UTF-8 stream. */ + int estimated_width:8; diff --git a/grub.patches b/grub.patches index a90e9211..f0f1d834 100644 --- a/grub.patches +++ b/grub.patches @@ -283,3 +283,16 @@ Patch0282: 0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch Patch0283: 0283-commands-efi-tpm-Refine-the-status-of-log-event.patch Patch0284: 0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch Patch0285: 0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch +Patch0286: 0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch +Patch0287: 0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch +Patch0288: 0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch +Patch0289: 0289-font-Remove-grub_font_dup_glyph.patch +Patch0290: 0290-font-Fix-integer-overflow-in-ensure_comb_space.patch +Patch0291: 0291-font-Fix-integer-overflow-in-BMP-index.patch +Patch0292: 0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch +Patch0293: 0293-kern-efi-sb-Enforce-verification-of-font-files.patch +Patch0294: 0294-fbutil-Fix-integer-overflow.patch +Patch0295: 0295-font-Fix-an-integer-underflow-in-blit_comb.patch +Patch0296: 0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch +Patch0297: 0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch +Patch0298: 0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch diff --git a/grub2.spec b/grub2.spec index 0e504c2e..9022dcb0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 62%{?dist} +Release: 63%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -529,6 +529,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Nov 08 2022 Robbie Harwood - 1:2.06-63 +- Font fixes (CVE-2022-2601 batch) + * Tue Nov 01 2022 Robbie Harwood - 1:2.06-62 - Try dropping custom sort again - See-also: https://github.com/rpm-software-management/rpm/pull/2249 diff --git a/sbat.csv.in b/sbat.csv.in index 55b3d10d..b338b5f5 100755 --- a/sbat.csv.in +++ b/sbat.csv.in @@ -1,3 +1,3 @@ sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md -grub,2,Free Software Foundation,grub,@@VERSION@@,https//www.gnu.org/software/grub/ +grub,3,Free Software Foundation,grub,@@VERSION@@,https//www.gnu.org/software/grub/ grub.rh,2,Red Hat,grub2,@@VERSION_RELEASE@@,mailto:secalert@redhat.com From 06e51d2a652884f3ef8b8fc97b3f9e7b2e41cc44 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 21 Nov 2022 19:58:18 +0000 Subject: [PATCH 157/294] Forward-port ppc64le image creation (with nerfed signing) Signed-off-by: Robbie Harwood --- grub.macros | 126 +++++++++++++++++++++++++++++++++++++++++----------- grub2.spec | 8 +++- 2 files changed, 106 insertions(+), 28 deletions(-) diff --git a/grub.macros b/grub.macros index 9fb2d9b2..34f2934e 100644 --- a/grub.macros +++ b/grub.macros @@ -77,6 +77,7 @@ %global emuarch %{_arch} %global grubefiarch %{nil} %global grublegacyarch %{nil} +%global grubelfname %{nil} # sparc is always compiled 64 bit %ifarch %{sparc} @@ -116,11 +117,20 @@ %{!?with_efi_only:%global without_efi_only 0} %{?with_efi_only:%global without_efi_only 1} -### fixme +%ifarch %{efi_arch} +%global efi_modules " efi_netfs efifwsetup efinet lsefi lsefimmap connectefi " +%endif + +%ifarch x86_64 %{ix86} +%global platform_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard " +%endif + +%ifarch ppc64le +%global platform_modules " appendedsig tpm ofnet " +%endif + %ifarch aarch64 %{arm} riscv64 -%global efi_modules " " -%else -%global efi_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard connectefi " +%global platform_modules " " %endif %ifarch aarch64 %{arm} riscv64 @@ -220,6 +230,7 @@ %global with_legacy_arch 1 %global grublegacyarch %{legacy_target_cpu_name}-%{platform} %global moduledir %{legacy_target_cpu_name}-%{platform} +%global grubelfname core.elf %endif %global evr %{epoch}:%{version}-%{release} @@ -380,14 +391,31 @@ install -m 644 %{1}.conf ${RPM_BUILD_ROOT}/etc/dnf/protected.d/ \ rm -f %{1}.conf \ %{nil} +%global grub_modules " all_video boot blscfg btrfs \\\ + cat configfile cryptodisk \\\ + echo ext2 f2fs fat font \\\ + gcry_rijndael gcry_rsa gcry_serpent \\\ + gcry_sha256 gcry_twofish gcry_whirlpool \\\ + gfxmenu gfxterm gzio \\\ + halt hfsplus http increment iso9660 \\\ + jpeg loadenv loopback linux lvm luks \\\ + luks2 mdraid09 mdraid1x minicmd net \\\ + normal part_apple part_msdos part_gpt \\\ + password_pbkdf2 pgp png reboot regexp \\\ + search search_fs_uuid search_fs_file \\\ + search_label serial sleep syslinuxcfg \\\ + test tftp version video xfs zstd " \ + %ifarch x86_64 aarch64 %{arm} riscv64 -%define mkimage() \ +%define efi_mkimage() \ %{4}./grub-mkimage -O %{1} -o %{2}.orig \\\ - -p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \\\ - --sbat %{4}./sbat.csv \ + -p /EFI/%{efi_vendor} -d grub-core \\\ + --sbat %{4}./sbat.csv \\\ + ${GRUB_MODULES} \ %{4}./grub-mkimage -O %{1} -o %{3}.orig \\\ - -p /EFI/BOOT -d grub-core ${GRUB_MODULES} \\\ - --sbat %{4}./sbat.csv \ + -p /EFI/BOOT -d grub-core \\\ + --sbat %{4}./sbat.csv \\\ + ${GRUB_MODULES} \ %{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \ %{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \ %{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.onesig -a %%{5} -c %%{6} -n %%{7}}} \ @@ -397,31 +425,65 @@ rm -f %{1}.conf \ %{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \ %{nil} %else -%define mkimage() \ +%define efi_mkimage() \ %{4}./grub-mkimage -O %{1} -o %{2} \\\ - -p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \ + -p /EFI/%{efi_vendor} -d grub-core \\\ + ${GRUB_MODULES} \ %{4}./grub-mkimage -O %{1} -o %{3} \\\ - -p /EFI/BOOT -d grub-core ${GRUB_MODULES} \ + -p /EFI/BOOT -d grub-core \\\ + ${GRUB_MODULES} \ %{nil} %endif +%ifarch ppc64le +%if 0%{?rhel} +%define ieee1275_mkimage() \ +APPENDED_SIG_SIZE=0 \ +if [ -x /usr/bin/rpm-sign ]; then \ + touch empty.unsigned \ + rpm-sign --key %{4} \\\ + --lkmsign empty.unsigned \\\ + --output empty.signed \ + APPENDED_SIG_SIZE="$(stat -c '%s' empty.signed)" \ + rm empty.{un,}signed \ +fi \ +# FIXME: using this prefix is fragile, must be done properly \ +./grub-mkimage -O %{1} -o %{2}.orig \\\ + -p '/grub2' -d grub-core \\\ + -x %{3} \\\ + --appended-signature-size ${APPENDED_SIG_SIZE} \\\ + ${GRUB_MODULES} \ +if [ -x /usr/bin/rpm-sign ]; then \ + truncate -s -${APPENDED_SIG_SIZE} %{2}.orig \ + rpm-sign --key %{4} \\\ + --lkmsign %{2}.orig \\\ + --output %{2} \ +else \ + mv %{2}.orig %{2} \ +fi \ +%{nil} +%else +# Fedora et al. +%define ieee1275_mkimage() \ +./grub-mkimage -O %{1} -o %{2}.orig -p '/grub2' -d grub-core ${GRUB_MODULES} \ +mv %{2}.orig %{2} +%{nil} +%endif +%endif + %define do_efi_build_images() \ -GRUB_MODULES=" all_video boot blscfg btrfs \\\ - cat configfile cryptodisk \\\ - echo efi_netfs efifwsetup efinet ext2 f2fs \\\ - fat font gcry_rijndael gcry_rsa gcry_serpent \\\ - gcry_sha256 gcry_twofish gcry_whirlpool \\\ - gfxmenu gfxterm gzio \\\ - halt hfsplus http increment iso9660 jpeg \\\ - loadenv loopback linux lvm lsefi lsefimmap luks \\\ - luks2 mdraid09 mdraid1x minicmd net \\\ - normal part_apple part_msdos part_gpt \\\ - password_pbkdf2 pgp png read reboot \\\ - regexp search search_fs_uuid search_fs_file \\\ - search_label serial sleep syslinuxcfg test tftp \\\ - version video xfs zstd " \ +GRUB_MODULES+=%{grub_modules} \ GRUB_MODULES+=%{efi_modules} \ -%{expand:%%{mkimage %{1} %{2} %{3} %{4}}} \ +GRUB_MODULES+=%{platform_modules} \ +%{expand:%%{efi_mkimage %{1} %{2} %{3} %{4}}} \ +%{nil} + +%define do_ieee1275_build_images() \ +GRUB_MODULES+=%{grub_modules} \ +GRUB_MODULES+=%{platform_modules} \ +cd grub-%{1}-%{tarversion} \ +%{expand:%%ieee1275_mkimage %%{1} %%{2} %%{3} %%{4}} \ +cd .. \ %{nil} %define do_primary_efi_build() \ @@ -536,6 +598,9 @@ fi \ if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ fi \ +%{expand:%ifarch ppc64le \ + install -m 700 %{grubelfname} $RPM_BUILD_ROOT/%{_libdir}/grub/%{1} \ +%endif} \ if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \ mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\ $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \ @@ -595,12 +660,19 @@ ln -s ../boot/grub2/grub.cfg \\\ %ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \ %dir %attr(0700,root,root)/boot/loader/entries \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ +%ifarch ppc64le \ +%dir %{_libdir}/grub/%{2}/ \ +%{_libdir}/grub/%{2}/%{grubelfname} \ +%endif \ \ %{expand:%if 0%{?with_legacy_modules} \ %{expand:%%files %{1}-modules} \ %defattr(-,root,root) \ %dir %{_libdir}/grub/%{2}/ \ %{_libdir}/grub/%{2}/* \ +%ifarch ppc64le \ +%exclude %{_libdir}/grub/%{2}/%{grubelfname} \ +%endif \ %exclude %{_libdir}/grub/%{2}/*.module \ %exclude %{_libdir}/grub/%{2}/{boot,boot_hybrid,cdboot,diskboot,lzma_decompress,pxeboot}.image \ %exclude %{_libdir}/grub/%{2}/*.o \ diff --git a/grub2.spec b/grub2.spec index 9022dcb0..386350df 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 63%{?dist} +Release: 64%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -210,6 +210,9 @@ git commit -m "After making subdirs" %if 0%{with_emu_arch} %{expand:%do_emu_build} %endif +%ifarch ppc64le +%{expand:%do_ieee1275_build_images %%{grublegacyarch} %{grubelfname} %{sb_cer} %{sb_key}} +%endif makeinfo --info --no-split -I docs -o docs/grub-dev.info \ docs/grub-dev.texi makeinfo --info --no-split -I docs -o docs/grub.info \ @@ -529,6 +532,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Nov 21 2022 Robbie Harwood - 1:2.06-64 +- Forward-port ppc64le image creation (with nerfed signing) + * Tue Nov 08 2022 Robbie Harwood - 1:2.06-63 - Font fixes (CVE-2022-2601 batch) From 558410c2d90bc1c28affccebf15a9c4ce82a109f Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 22 Nov 2022 14:48:06 +0000 Subject: [PATCH 158/294] Don't obsolete the tools package with extra/efi The extra/efi packages aren't needed in a lot of use cases. The efi subpackage is actually only useful on EFI based macs. The extra subpackage isn't useful on cloud/server and a lot of places where there's no need for pretty GUIs. Stop obsoleting the tools package so that they're pulled in with every update even though they may have been actively remove by images or users. Signed-off-by: Peter Robinson [rharwood: bump spec] Signed-off-by: Robbie Harwood --- grub2.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grub2.spec b/grub2.spec index 386350df..a73e4d87 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 64%{?dist} +Release: 65%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -94,7 +94,6 @@ subpackages. %package tools Summary: Support tools for GRUB. -Obsoletes: grub2-tools < %{evr} Requires: grub2-common = %{epoch}:%{version}-%{release} Requires: gettext-runtime os-prober file Requires(pre): dracut @@ -110,7 +109,6 @@ This subpackage provides tools for support of all platforms. Summary: Support tools for GRUB. Requires: gettext-runtime os-prober file Requires: grub2-common = %{epoch}:%{version}-%{release} -Obsoletes: grub2-tools < %{evr} %description tools-efi %{desc} @@ -133,7 +131,6 @@ Requires: gettext-runtime os-prober file Requires: grub2-tools-minimal = %{epoch}:%{version}-%{release} Requires: grub2-common = %{epoch}:%{version}-%{release} Requires: mtools -Obsoletes: grub2-tools < %{evr} %description tools-extra %{desc} @@ -532,6 +529,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Nov 22 2022 Robbie Harwood - 1:2.06-65 +- Don't obsolete the tools package with extra/efi (pbrobinson) + * Mon Nov 21 2022 Robbie Harwood - 1:2.06-64 - Forward-port ppc64le image creation (with nerfed signing) From 0ccadff7a2be9fcc858e0a1cb7825beb5d81f8c6 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 22 Nov 2022 22:51:32 +0000 Subject: [PATCH 159/294] Bundle unicode.pf2 with images Resolves: #2143725 Resolves: #2144113 Signed-off-by: Robbie Harwood --- ...ening-fonts-from-the-bundled-memdisk.patch | 78 +++++++++++++++++++ grub.macros | 32 ++++---- grub.patches | 1 + grub2.spec | 7 +- 4 files changed, 101 insertions(+), 17 deletions(-) create mode 100644 0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch diff --git a/0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch b/0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch new file mode 100644 index 00000000..bad9d903 --- /dev/null +++ b/0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Wed, 16 Nov 2022 14:40:04 +0000 +Subject: [PATCH] font: Try opening fonts from the bundled memdisk + +Signed-off-by: Robbie Harwood +--- + grub-core/font/font.c | 48 +++++++++++++++++++++++++++++++----------------- + 1 file changed, 31 insertions(+), 17 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index e6616e610c..e421d1ae6f 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -409,6 +409,27 @@ read_section_as_short (struct font_file_section *section, + return 0; + } + ++static grub_file_t ++try_open_from_prefix (const char *prefix, const char *filename) ++{ ++ grub_file_t file; ++ char *fullname, *ptr; ++ ++ fullname = grub_malloc (grub_strlen (prefix) + grub_strlen (filename) + 1 ++ + sizeof ("/fonts/") + sizeof (".pf2")); ++ if (!fullname) ++ return 0; ++ ptr = grub_stpcpy (fullname, prefix); ++ ptr = grub_stpcpy (ptr, "/fonts/"); ++ ptr = grub_stpcpy (ptr, filename); ++ ptr = grub_stpcpy (ptr, ".pf2"); ++ *ptr = 0; ++ ++ file = grub_buffile_open (fullname, GRUB_FILE_TYPE_FONT, 1024); ++ grub_free (fullname); ++ return file; ++} ++ + /* Load a font and add it to the beginning of the global font list. + Returns 0 upon success, nonzero upon failure. */ + grub_font_t +@@ -427,25 +448,18 @@ grub_font_load (const char *filename) + file = grub_buffile_open (filename, GRUB_FILE_TYPE_FONT, 1024); + else + { +- const char *prefix = grub_env_get ("prefix"); +- char *fullname, *ptr; +- if (!prefix) ++ file = try_open_from_prefix ("(memdisk)", filename); ++ if (!file) + { +- grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), +- "prefix"); +- goto fail; ++ const char *prefix = grub_env_get ("prefix"); ++ if (!prefix) ++ { ++ grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), ++ "prefix"); ++ goto fail; ++ } ++ file = try_open_from_prefix (prefix, filename); + } +- fullname = grub_malloc (grub_strlen (prefix) + grub_strlen (filename) + 1 +- + sizeof ("/fonts/") + sizeof (".pf2")); +- if (!fullname) +- goto fail; +- ptr = grub_stpcpy (fullname, prefix); +- ptr = grub_stpcpy (ptr, "/fonts/"); +- ptr = grub_stpcpy (ptr, filename); +- ptr = grub_stpcpy (ptr, ".pf2"); +- *ptr = 0; +- file = grub_buffile_open (fullname, GRUB_FILE_TYPE_FONT, 1024); +- grub_free (fullname); + } + if (!file) + goto fail; diff --git a/grub.macros b/grub.macros index 34f2934e..7228e205 100644 --- a/grub.macros +++ b/grub.macros @@ -399,22 +399,31 @@ rm -f %{1}.conf \ gfxmenu gfxterm gzio \\\ halt hfsplus http increment iso9660 \\\ jpeg loadenv loopback linux lvm luks \\\ - luks2 mdraid09 mdraid1x minicmd net \\\ + luks2 \\\ + memdisk \\\ + mdraid09 mdraid1x minicmd net \\\ normal part_apple part_msdos part_gpt \\\ password_pbkdf2 pgp png reboot regexp \\\ search search_fs_uuid search_fs_file \\\ - search_label serial sleep syslinuxcfg \\\ + search_label serial sleep \\\ + squash4 \\\ + syslinuxcfg \\\ test tftp version video xfs zstd " \ -%ifarch x86_64 aarch64 %{arm} riscv64 +%ifarch %{efi_arch} %define efi_mkimage() \ +mkdir -p memdisk/fonts \ +cp %{4}/unicode.pf2 memdisk/fonts \ +mksquashfs memdisk memdisk.squashfs -comp xz \ %{4}./grub-mkimage -O %{1} -o %{2}.orig \\\ -p /EFI/%{efi_vendor} -d grub-core \\\ --sbat %{4}./sbat.csv \\\ + -m memdisk.squashfs \\\ ${GRUB_MODULES} \ %{4}./grub-mkimage -O %{1} -o %{3}.orig \\\ -p /EFI/BOOT -d grub-core \\\ --sbat %{4}./sbat.csv \\\ + -m memdisk.squashfs \\\ ${GRUB_MODULES} \ %{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \ %{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \ @@ -424,20 +433,14 @@ rm -f %{1}.conf \ %{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \ %{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \ %{nil} -%else -%define efi_mkimage() \ -%{4}./grub-mkimage -O %{1} -o %{2} \\\ - -p /EFI/%{efi_vendor} -d grub-core \\\ - ${GRUB_MODULES} \ -%{4}./grub-mkimage -O %{1} -o %{3} \\\ - -p /EFI/BOOT -d grub-core \\\ - ${GRUB_MODULES} \ -%{nil} %endif %ifarch ppc64le %if 0%{?rhel} %define ieee1275_mkimage() \ +mkdir -p memdisk/fonts \ +cp %{4}/unicode.pf2 memdisk/fonts \ +mksquashfs memdisk memdisk.squashfs -comp xz \ APPENDED_SIG_SIZE=0 \ if [ -x /usr/bin/rpm-sign ]; then \ touch empty.unsigned \ @@ -450,6 +453,7 @@ fi \ # FIXME: using this prefix is fragile, must be done properly \ ./grub-mkimage -O %{1} -o %{2}.orig \\\ -p '/grub2' -d grub-core \\\ + -m memdisk.squashfs \\\ -x %{3} \\\ --appended-signature-size ${APPENDED_SIG_SIZE} \\\ ${GRUB_MODULES} \ @@ -581,8 +585,6 @@ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ %ifarch %{arm} \ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ %endif \ -install -D -m 700 unicode.pf2 \\\ - ${RPM_BUILD_ROOT}/boot/grub2/fonts/unicode.pf2 \ ${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\ ${RPM_BUILD_ROOT}/boot/grub2/grubenv create \ %{expand:%%do_install_protected_file grub2-%{package_arch}} \ @@ -690,7 +692,6 @@ ln -s ../boot/grub2/grub.cfg \\\ %ifarch %{arm} \ %attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \ %endif \ -%attr(0700,root,root)/boot/grub2/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \ %ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ @@ -712,5 +713,4 @@ ln -s ../boot/grub2/grub.cfg \\\ %{expand:%%files %{1}-cdboot} \ %defattr(-,root,root,-) \ %attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \ -%attr(0700,root,root)/boot/grub2/fonts \ %{nil} diff --git a/grub.patches b/grub.patches index f0f1d834..0d543751 100644 --- a/grub.patches +++ b/grub.patches @@ -296,3 +296,4 @@ Patch0295: 0295-font-Fix-an-integer-underflow-in-blit_comb.patch Patch0296: 0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch Patch0297: 0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch Patch0298: 0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch +Patch0299: 0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch diff --git a/grub2.spec b/grub2.spec index a73e4d87..5f5f8018 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 65%{?dist} +Release: 66%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -529,6 +529,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Nov 22 2022 Robbie Harwood - 2.06-66 +- Bundle unicode.pf2 with images +- Resolves: #2143725 +- Resolves: #2144113 + * Tue Nov 22 2022 Robbie Harwood - 1:2.06-65 - Don't obsolete the tools package with extra/efi (pbrobinson) From f09f9764c671c745db89ef0817fe825b2c8c1010 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 22 Nov 2022 18:18:54 -0500 Subject: [PATCH 160/294] Add BR on squashfs-tools Signed-off-by: Robbie Harwood --- grub2.spec | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/grub2.spec b/grub2.spec index 5f5f8018..ff8cc280 100644 --- a/grub2.spec +++ b/grub2.spec @@ -38,22 +38,37 @@ Source12: sbat.csv.in %include %{SOURCE1} -BuildRequires: gcc efi-srpm-macros -BuildRequires: flex bison binutils python3 -BuildRequires: ncurses-devel xz-devel bzip2-devel +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: binutils +BuildRequires: bison +BuildRequires: bzip2-devel +BuildRequires: dejavu-sans-fonts +BuildRequires: device-mapper-devel +BuildRequires: efi-srpm-macros +BuildRequires: flex +BuildRequires: freetype-devel BuildRequires: freetype-devel BuildRequires: fuse-devel -BuildRequires: rpm-devel rpm-libs -BuildRequires: autoconf automake device-mapper-devel -BuildRequires: freetype-devel gettext-devel git -BuildRequires: texinfo -BuildRequires: dejavu-sans-fonts +BuildRequires: gcc +BuildRequires: gettext-devel +BuildRequires: git BuildRequires: help2man +BuildRequires: ncurses-devel +BuildRequires: python3 +BuildRequires: rpm-devel +BuildRequires: rpm-libs +BuildRequires: squashfs-tools +BuildRequires: texinfo +BuildRequires: xz-devel + # For %%_userunitdir macro BuildRequires: systemd + %ifarch %{efi_arch} BuildRequires: pesign >= 0.99-8 %endif + %if %{?_with_ccache: 1}%{?!_with_ccache: 0} BuildRequires: ccache %endif From 1af394246eccd2dbc1fdbe3f199ba28b0e36b935 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 23 Nov 2022 09:26:54 -0800 Subject: [PATCH 161/294] Go back to installing unicode.pf2 lorax has its own code for building EFI images, and it needs the font file to do that successfully, so let's make sure it's there for lorax to find. This doesn't revert the embedding change, it just reverts the part where we don't bother to install the font to /boot/grub2/fonts any more. Signed-off-by: Adam Williamson --- grub.macros | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/grub.macros b/grub.macros index 7228e205..b87b427a 100644 --- a/grub.macros +++ b/grub.macros @@ -585,6 +585,8 @@ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ %ifarch %{arm} \ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ %endif \ +install -D -m 700 unicode.pf2 \\\ + ${RPM_BUILD_ROOT}/boot/grub2/fonts/unicode.pf2 \ ${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\ ${RPM_BUILD_ROOT}/boot/grub2/grubenv create \ %{expand:%%do_install_protected_file grub2-%{package_arch}} \ @@ -692,6 +694,7 @@ ln -s ../boot/grub2/grub.cfg \\\ %ifarch %{arm} \ %attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \ %endif \ +%attr(0700,root,root)/boot/grub2/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \ %ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ @@ -713,4 +716,5 @@ ln -s ../boot/grub2/grub.cfg \\\ %{expand:%%files %{1}-cdboot} \ %defattr(-,root,root,-) \ %attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \ +%attr(0700,root,root)/boot/grub2/fonts \ %{nil} From 81ed67d3a8a05c31bd4643b0cf7fc5de4d738b4a Mon Sep 17 00:00:00 2001 From: Tomas Hrcka Date: Wed, 23 Nov 2022 20:45:18 +0100 Subject: [PATCH 162/294] Bump release to install unicode.pf2 Signed-off-by: Tomas Hrcka --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index ff8cc280..f10c8bed 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 66%{?dist} +Release: 67%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Nov 23 2022 Tomas Hrcka - 1:2.06-67 +- install unicode.pf2 into place so lorax works + * Tue Nov 22 2022 Robbie Harwood - 2.06-66 - Bundle unicode.pf2 with images - Resolves: #2143725 From 78d64adfbe3cd089df8e41166c3688f026acdad1 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Sun, 4 Dec 2022 19:41:23 -0500 Subject: [PATCH 163/294] Allow for xz'd symvers file The Fedora/ARK kernel is moving to removing gzip as a dependency and replacing it with xz. Use xz instead of gz as an extension for the symvers file. Signed-off-by: Prarit Bhargava --- 20-grub.install | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/20-grub.install b/20-grub.install index bc55a14b..bb0d5299 100755 --- a/20-grub.install +++ b/20-grub.install @@ -75,6 +75,7 @@ case "$COMMAND" in command -v restorecon &>/dev/null && \ restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" fi + # OLD method using gzip'd file (will be deprecated and removed in the future) # symvers is symvers-.gz symlink, needs a special treatment i="$KERNEL_DIR/symvers.gz" if [[ -e "$i" ]]; then @@ -83,6 +84,14 @@ case "$COMMAND" in command -v restorecon &>/dev/null && \ restorecon "/boot/symvers-${KERNEL_VERSION}.gz" fi + # symvers is symvers-.bz symlink, needs a special treatment + i="$KERNEL_DIR/symvers.bz" + if [[ -e "$i" ]]; then + rm -f "/boot/symvers-${KERNEL_VERSION}.bz" + ln -s "$i" "/boot/symvers-${KERNEL_VERSION}.bz" + command -v restorecon &>/dev/null && \ + restorecon "/boot/symvers-${KERNEL_VERSION}.bz" + fi fi if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then From 9b063ec0c53b0656457d674dbc65e5739b7e385c Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 5 Dec 2022 17:24:34 +0000 Subject: [PATCH 164/294] Bump spec for "Allow for xz'd symvers file" Signed-off-by: Robbie Harwood --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index f10c8bed..2f08c20f 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 67%{?dist} +Release: 68%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Dec 05 2022 Robbie Harwood - 2.06-68 +- Allow for xz'd symvers file (prarit) + * Wed Nov 23 2022 Tomas Hrcka - 1:2.06-67 - install unicode.pf2 into place so lorax works From 85cfe6dd3062173cc5e5716bd628490d8f83a4fc Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 6 Dec 2022 15:57:14 +0000 Subject: [PATCH 165/294] Fix error handling in grub_file_open() Signed-off-by: Robbie Harwood --- ...Fix-error-handling-in-grub_file_open.patch | 34 ++ ..._-instrumentation-new-file-debug-tag.patch | 16 +- ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 0 ...igning-grub-with-an-appended-signatu.patch | 0 ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0162-pgp-factor-out-rsa_pad.patch | 0 ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0165-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...68-libtasn1-compile-into-asn1-module.patch | 0 ...9-test_asn1-test-module-for-libtasn1.patch | 0 ...-support-embedding-x509-certificates.patch | 0 ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 0 ...pended-signatures-verification-tests.patch | 0 ...75-appended-signatures-documentation.patch | 0 ...er-lockdown-based-on-ibm-secure-boot.patch | 0 ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0178-ieee1275-claim-more-memory.patch | 0 ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 0 ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...ainloading-EFI-apps-from-loop-mounts.patch | 0 ...> 0183-efinet-Add-DHCP-proxy-support.patch | 0 ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 0 ... 0186-Suppress-gettext-error-message.patch | 0 ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 ...for-EFI-at-runtime-instead-of-config.patch | 0 ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 0 ...over-the-device-to-read-the-config-f.patch | 0 ...etting-of-prefix-for-signed-binary-c.patch | 0 ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 0 ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 0 ...-mkconfig-restore-umask-for-grub.cfg.patch | 0 ...btrfs-Use-full-btrfs-bootloader-area.patch | 0 ...-Fedora-location-of-DejaVu-SANS-font.patch | 0 ...t-show-Booting-s-msg-when-auto-booti.patch | 0 ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 0 ...ot-set-colorstate-until-the-first-te.patch | 0 ...ot-set-cursor-until-the-first-text-o.patch | 0 ...se-visual-indentation-in-config.h.in.patch | 0 ...sure-config-util.h-precedes-config.h.patch | 0 ...=> 0205-Drop-gnulib-fix-base64.patch.patch | 0 ...h => 0206-Drop-gnulib-no-abort.patch.patch | 0 ...version-and-drop-most-gnulib-patches.patch | 0 ...Fix-bug-stopping-iteration-when-no-f.patch | 0 ...w-efidisk-only-option-on-EFI-systems.patch | 0 ...h => 0210-efi-new-connectefi-command.patch | 0 ...-i386-efi-linux.c-do-not-validate-ke.patch | 0 ...-arm64-linux.c-do-not-validate-kerne.patch | 0 ...-efi-chainloader.c-do-not-validate-c.patch | 0 ...-efi-linux.c-drop-now-unused-grub_li.patch | 0 ...erpc-do-CAS-in-a-more-compatible-way.patch | 0 ...etection-support-device-names-with-c.patch | 0 ...ort-for-trusted-boot-using-a-vTPM-2..patch | 0 ...=> 0218-make-ofdisk_retries-optional.patch | 0 ...loader-grub_load_and_start_image-doe.patch | 0 ...hainloader-simplify-the-loader-state.patch | 0 ...ot-Add-API-to-pass-context-to-loader.patch | 0 ...i-chainloader-Use-grub_loader_set_ex.patch | 0 ...linux-Avoid-a-use-after-free-in-the-.patch | 0 ...386-efi-linux-Use-grub_loader_set_ex.patch | 0 ...linux-Fix-a-memory-leak-in-the-initr.patch | 0 ...ct-non-kernel-files-in-the-shim_lock.patch | 0 ...-leak-device_name-on-error-in-grub_f.patch | 6 +- ...g-Abort-sooner-if-a-read-operation-f.patch | 0 ...g-Refuse-to-handle-multiple-image-he.patch | 0 ...g-Drop-greyscale-support-to-fix-heap.patch | 0 ...g-Avoid-heap-OOB-R-W-inserting-huff-.patch | 0 ...-png-Sanity-check-some-huffman-codes.patch | 0 ...eg-Abort-sooner-if-a-read-operation-.patch | 0 ...eg-Do-not-reallocate-a-given-huff-ta.patch | 0 ...eg-Refuse-to-handle-multiple-start-o.patch | 0 ...eg-Block-int-underflow-wild-pointer-.patch | 0 ...ix-array-out-of-bounds-formatting-un.patch | 0 ...ff-Block-overly-large-netbuff-allocs.patch | 0 ...9-net-ip-Do-IP-fragment-maths-safely.patch | 0 ...le-free-addresses-on-corrupt-DNS-res.patch | 0 ...ad-past-the-end-of-the-string-we-re-.patch | 0 ...-a-UAF-and-double-free-from-a-failed.patch | 0 ...=> 0243-net-tftp-Avoid-a-trivial-UAF.patch | 0 ...tear-down-socket-if-it-s-already-bee.patch | 0 ...Fix-OOB-write-for-split-http-headers.patch | 0 ...or-out-on-headers-with-LF-without-CR.patch | 0 ...ead-past-the-end-of-nat-journal-entr.patch | 0 ...-not-read-past-the-end-of-nat-bitmap.patch | 0 ...ot-copy-file-names-that-are-too-long.patch | 0 ...eral-fuzz-issues-with-invalid-dir-it.patch | 0 ...e-ASAN-and-SEGV-issues-found-with-fu.patch | 0 ...x-more-fuzz-issues-related-to-chunks.patch | 0 ...grub_min-and-grub_max-more-resilient.patch | 0 ...FS-switch-to-using-grub_min-grub_max.patch | 0 ...oot_time-also-call-grub_dprintf-boot.patch | 0 ...dules-make-.module_license-read-only.patch | 0 ...p-.llvm_addrsig-sections-and-similar.patch | 0 ...locate-space-for-non-allocable-secti.patch | 0 ...eader-struct-and-fix-some-bad-naming.patch | 0 ...nel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch | 0 ...ule-sections-at-page-aligned-address.patch | 0 ...-nx-add-memory-attribute-get-set-API.patch | 0 ...-page-permissions-for-loaded-modules.patch | 0 ...4-nx-set-attrs-in-our-kernel-loaders.patch | 0 ...x-compatible-flag-in-EFI-grub-images.patch | 0 ...-document-the-behavior-of-multiple-v.patch | 0 ...probe-dprint-errors-from-filesystems.patch | 0 ...8-fs-fat-don-t-error-when-mtime-is-0.patch | 0 ...file-show-which-file-filters-get-run.patch | 4 +- ...ed-array-positions-for-our-allocatio.patch | 0 ...tion-policy-for-kernel-vs-initrd-mem.patch | 0 ...-initrd-within-the-bounds-expressed-.patch | 0 ...ER_-CODE-DATA-for-kernel-and-initrd-.patch | 0 ...e-etc-kernel-cmdline-during-mkconfig.patch | 0 ...sh-don-t-dup-rhgb-quiet-check-mtimes.patch | 0 ...=> 0276-squish-give-up-on-rhgb-quiet.patch | 0 ...write-etc-kernel-cmdline-if-writable.patch | 0 ...5-implement-vec5-for-cas-negotiation.patch | 0 ...scfg-Don-t-root-device-in-emu-builds.patch | 0 ...ux-Remove-magic-number-header-field-.patch | 0 ... 0281-Correct-BSS-zeroing-on-aarch64.patch | 0 ...ate-i-cache-before-starting-the-kern.patch | 0 ...ncorrect-array-size-in-kernel-alloca.patch | 0 ...i-tpm-Refine-the-status-of-log-event.patch | 0 ...-Use-grub_strcpy-instead-of-grub_mem.patch | 0 ...-EFI_CC_MEASUREMENT_PROTOCOL-support.patch | 0 ...hs-exceeds-font-max_glyph_width-or-f.patch | 0 ...erflow-in-grub_font_get_glyph_intern.patch | 0 ...-integer-overflows-in-grub_font_cons.patch | 0 ...0290-font-Remove-grub_font_dup_glyph.patch | 0 ...nteger-overflow-in-ensure_comb_space.patch | 0 ...nt-Fix-integer-overflow-in-BMP-index.patch | 0 ...-underflow-in-binary-search-of-char-.patch | 0 ...b-Enforce-verification-of-font-files.patch | 0 ... => 0295-fbutil-Fix-integer-overflow.patch | 0 ...ix-an-integer-underflow-in-blit_comb.patch | 0 ..._font_blit_glyph-and-grub_font_blit_.patch | 0 ...l_font-to-glyphs-in-ascii_font_glyph.patch | 0 ...ix-an-integer-overflow-in-grub_unico.patch | 0 ...ening-fonts-from-the-bundled-memdisk.patch | 0 grub.patches | 297 +++++++++--------- grub2.spec | 5 +- 151 files changed, 200 insertions(+), 162 deletions(-) create mode 100644 0152-kern-file-Fix-error-handling-in-grub_file_open.patch rename 0152-grub_file_-instrumentation-new-file-debug-tag.patch => 0153-grub_file_-instrumentation-new-file-debug-tag.patch (82%) rename 0153-ieee1275-Avoiding-many-unecessary-open-close.patch => 0154-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0154-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0155-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0156-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (100%) rename 0157-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch (100%) rename 0158-docs-grub-Document-signing-grub-under-UEFI.patch => 0159-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0159-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) rename 0160-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0161-pgp-factor-out-rsa_pad.patch => 0162-pgp-factor-out-rsa_pad.patch (100%) rename 0162-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0163-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0164-libtasn1-import-libtasn1-4.16.0.patch => 0165-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0165-libtasn1-disable-code-not-needed-in-grub.patch => 0166-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0166-libtasn1-changes-for-grub-compatibility.patch => 0167-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0167-libtasn1-compile-into-asn1-module.patch => 0168-libtasn1-compile-into-asn1-module.patch (100%) rename 0168-test_asn1-test-module-for-libtasn1.patch => 0169-test_asn1-test-module-for-libtasn1.patch (100%) rename 0169-grub-install-support-embedding-x509-certificates.patch => 0170-grub-install-support-embedding-x509-certificates.patch (100%) rename 0170-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0171-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0172-appended-signatures-support-verifying-appended-signa.patch => 0173-appended-signatures-support-verifying-appended-signa.patch (100%) rename 0173-appended-signatures-verification-tests.patch => 0174-appended-signatures-verification-tests.patch (100%) rename 0174-appended-signatures-documentation.patch => 0175-appended-signatures-documentation.patch (100%) rename 0175-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (100%) rename 0176-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0177-ieee1275-claim-more-memory.patch => 0178-ieee1275-claim-more-memory.patch (100%) rename 0178-ieee1275-request-memory-with-ibm-client-architecture.patch => 0179-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) rename 0179-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) rename 0180-ieee1275-ofdisk-retry-on-open-failure.patch => 0181-ieee1275-ofdisk-retry-on-open-failure.patch (100%) rename 0181-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch (100%) rename 0182-efinet-Add-DHCP-proxy-support.patch => 0183-efinet-Add-DHCP-proxy-support.patch (100%) rename 0183-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (100%) rename 0185-Suppress-gettext-error-message.patch => 0186-Suppress-gettext-error-message.patch (100%) rename 0186-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) rename 0187-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) rename 0188-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0189-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch (100%) rename 0190-normal-main-Discover-the-device-to-read-the-config-f.patch => 0191-normal-main-Discover-the-device-to-read-the-config-f.patch (100%) rename 0191-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (100%) rename 0192-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) rename 0193-Print-module-name-on-license-check-failure.patch => 0194-Print-module-name-on-license-check-failure.patch (100%) rename 0194-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (100%) rename 0195-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch (100%) rename 0196-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch (100%) rename 0197-Add-Fedora-location-of-DejaVu-SANS-font.patch => 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch (100%) rename 0198-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch => 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch (100%) rename 0199-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch => 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch (100%) rename 0200-EFI-console-Do-not-set-colorstate-until-the-first-te.patch => 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch (100%) rename 0201-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch => 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch (100%) rename 0202-Use-visual-indentation-in-config.h.in.patch => 0203-Use-visual-indentation-in-config.h.in.patch (100%) rename 0203-Where-present-ensure-config-util.h-precedes-config.h.patch => 0204-Where-present-ensure-config-util.h-precedes-config.h.patch (100%) rename 0204-Drop-gnulib-fix-base64.patch.patch => 0205-Drop-gnulib-fix-base64.patch.patch (100%) rename 0205-Drop-gnulib-no-abort.patch.patch => 0206-Drop-gnulib-no-abort.patch.patch (100%) rename 0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch => 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch (100%) rename 0207-commands-search-Fix-bug-stopping-iteration-when-no-f.patch => 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch (100%) rename 0208-search-new-efidisk-only-option-on-EFI-systems.patch => 0209-search-new-efidisk-only-option-on-EFI-systems.patch (100%) rename 0209-efi-new-connectefi-command.patch => 0210-efi-new-connectefi-command.patch (100%) rename 0210-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch => 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch (100%) rename 0211-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch => 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch (100%) rename 0212-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch => 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch (100%) rename 0213-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch => 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch (100%) rename 0214-powerpc-do-CAS-in-a-more-compatible-way.patch => 0215-powerpc-do-CAS-in-a-more-compatible-way.patch (100%) rename 0215-powerpc-prefix-detection-support-device-names-with-c.patch => 0216-powerpc-prefix-detection-support-device-names-with-c.patch (100%) rename 0216-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch => 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch (100%) rename 0217-make-ofdisk_retries-optional.patch => 0218-make-ofdisk_retries-optional.patch (100%) rename 0218-loader-efi-chainloader-grub_load_and_start_image-doe.patch => 0219-loader-efi-chainloader-grub_load_and_start_image-doe.patch (100%) rename 0219-loader-efi-chainloader-simplify-the-loader-state.patch => 0220-loader-efi-chainloader-simplify-the-loader-state.patch (100%) rename 0220-commands-boot-Add-API-to-pass-context-to-loader.patch => 0221-commands-boot-Add-API-to-pass-context-to-loader.patch (100%) rename 0221-loader-efi-chainloader-Use-grub_loader_set_ex.patch => 0222-loader-efi-chainloader-Use-grub_loader_set_ex.patch (100%) rename 0222-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch => 0223-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch (100%) rename 0223-loader-i386-efi-linux-Use-grub_loader_set_ex.patch => 0224-loader-i386-efi-linux-Use-grub_loader_set_ex.patch (100%) rename 0224-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch => 0225-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch (100%) rename 0225-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch => 0226-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch (100%) rename 0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch => 0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch (86%) rename 0227-video-readers-png-Abort-sooner-if-a-read-operation-f.patch => 0228-video-readers-png-Abort-sooner-if-a-read-operation-f.patch (100%) rename 0228-video-readers-png-Refuse-to-handle-multiple-image-he.patch => 0229-video-readers-png-Refuse-to-handle-multiple-image-he.patch (100%) rename 0229-video-readers-png-Drop-greyscale-support-to-fix-heap.patch => 0230-video-readers-png-Drop-greyscale-support-to-fix-heap.patch (100%) rename 0230-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch => 0231-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch (100%) rename 0231-video-readers-png-Sanity-check-some-huffman-codes.patch => 0232-video-readers-png-Sanity-check-some-huffman-codes.patch (100%) rename 0232-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch => 0233-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch (100%) rename 0233-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch => 0234-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch (100%) rename 0234-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch => 0235-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch (100%) rename 0235-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch => 0236-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch (100%) rename 0236-normal-charset-Fix-array-out-of-bounds-formatting-un.patch => 0237-normal-charset-Fix-array-out-of-bounds-formatting-un.patch (100%) rename 0237-net-netbuff-Block-overly-large-netbuff-allocs.patch => 0238-net-netbuff-Block-overly-large-netbuff-allocs.patch (100%) rename 0238-net-ip-Do-IP-fragment-maths-safely.patch => 0239-net-ip-Do-IP-fragment-maths-safely.patch (100%) rename 0239-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch => 0240-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch (100%) rename 0240-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch => 0241-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch (100%) rename 0241-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch => 0242-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch (100%) rename 0242-net-tftp-Avoid-a-trivial-UAF.patch => 0243-net-tftp-Avoid-a-trivial-UAF.patch (100%) rename 0243-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch => 0244-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch (100%) rename 0244-net-http-Fix-OOB-write-for-split-http-headers.patch => 0245-net-http-Fix-OOB-write-for-split-http-headers.patch (100%) rename 0245-net-http-Error-out-on-headers-with-LF-without-CR.patch => 0246-net-http-Error-out-on-headers-with-LF-without-CR.patch (100%) rename 0246-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch => 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch (100%) rename 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch => 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch (100%) rename 0248-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch => 0249-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch (100%) rename 0249-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch => 0250-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch (100%) rename 0250-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch => 0251-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch (100%) rename 0251-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch => 0252-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch (100%) rename 0252-misc-Make-grub_min-and-grub_max-more-resilient.patch => 0253-misc-Make-grub_min-and-grub_max-more-resilient.patch (100%) rename 0253-ReiserFS-switch-to-using-grub_min-grub_max.patch => 0254-ReiserFS-switch-to-using-grub_min-grub_max.patch (100%) rename 0254-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch => 0255-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch (100%) rename 0255-modules-make-.module_license-read-only.patch => 0256-modules-make-.module_license-read-only.patch (100%) rename 0256-modules-strip-.llvm_addrsig-sections-and-similar.patch => 0257-modules-strip-.llvm_addrsig-sections-and-similar.patch (100%) rename 0257-modules-Don-t-allocate-space-for-non-allocable-secti.patch => 0258-modules-Don-t-allocate-space-for-non-allocable-secti.patch (100%) rename 0258-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch => 0259-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch (100%) rename 0259-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch => 0260-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch (100%) rename 0260-modules-load-module-sections-at-page-aligned-address.patch => 0261-modules-load-module-sections-at-page-aligned-address.patch (100%) rename 0261-nx-add-memory-attribute-get-set-API.patch => 0262-nx-add-memory-attribute-get-set-API.patch (100%) rename 0262-nx-set-page-permissions-for-loaded-modules.patch => 0263-nx-set-page-permissions-for-loaded-modules.patch (100%) rename 0263-nx-set-attrs-in-our-kernel-loaders.patch => 0264-nx-set-attrs-in-our-kernel-loaders.patch (100%) rename 0264-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch => 0265-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch (100%) rename 0265-grub-probe-document-the-behavior-of-multiple-v.patch => 0266-grub-probe-document-the-behavior-of-multiple-v.patch (100%) rename 0266-grub_fs_probe-dprint-errors-from-filesystems.patch => 0267-grub_fs_probe-dprint-errors-from-filesystems.patch (100%) rename 0267-fs-fat-don-t-error-when-mtime-is-0.patch => 0268-fs-fat-don-t-error-when-mtime-is-0.patch (100%) rename 0268-Make-debug-file-show-which-file-filters-get-run.patch => 0269-Make-debug-file-show-which-file-filters-get-run.patch (93%) rename 0269-efi-use-enumerated-array-positions-for-our-allocatio.patch => 0270-efi-use-enumerated-array-positions-for-our-allocatio.patch (100%) rename 0270-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch => 0271-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch (100%) rename 0271-efi-allocate-the-initrd-within-the-bounds-expressed-.patch => 0272-efi-allocate-the-initrd-within-the-bounds-expressed-.patch (100%) rename 0272-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch => 0273-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch (100%) rename 0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch => 0274-BLS-create-etc-kernel-cmdline-during-mkconfig.patch (100%) rename 0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch => 0275-squish-don-t-dup-rhgb-quiet-check-mtimes.patch (100%) rename 0275-squish-give-up-on-rhgb-quiet.patch => 0276-squish-give-up-on-rhgb-quiet.patch (100%) rename 0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch => 0277-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch (100%) rename 0277-ieee1275-implement-vec5-for-cas-negotiation.patch => 0278-ieee1275-implement-vec5-for-cas-negotiation.patch (100%) rename 0278-blscfg-Don-t-root-device-in-emu-builds.patch => 0279-blscfg-Don-t-root-device-in-emu-builds.patch (100%) rename 0279-loader-arm64-linux-Remove-magic-number-header-field-.patch => 0280-loader-arm64-linux-Remove-magic-number-header-field-.patch (100%) rename 0280-Correct-BSS-zeroing-on-aarch64.patch => 0281-Correct-BSS-zeroing-on-aarch64.patch (100%) rename 0281-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch => 0282-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch (100%) rename 0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch => 0283-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch (100%) rename 0283-commands-efi-tpm-Refine-the-status-of-log-event.patch => 0284-commands-efi-tpm-Refine-the-status-of-log-event.patch (100%) rename 0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch => 0285-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch (100%) rename 0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch => 0286-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch (100%) rename 0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch => 0287-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch (100%) rename 0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch => 0288-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch (100%) rename 0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch => 0289-font-Fix-several-integer-overflows-in-grub_font_cons.patch (100%) rename 0289-font-Remove-grub_font_dup_glyph.patch => 0290-font-Remove-grub_font_dup_glyph.patch (100%) rename 0290-font-Fix-integer-overflow-in-ensure_comb_space.patch => 0291-font-Fix-integer-overflow-in-ensure_comb_space.patch (100%) rename 0291-font-Fix-integer-overflow-in-BMP-index.patch => 0292-font-Fix-integer-overflow-in-BMP-index.patch (100%) rename 0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch => 0293-font-Fix-integer-underflow-in-binary-search-of-char-.patch (100%) rename 0293-kern-efi-sb-Enforce-verification-of-font-files.patch => 0294-kern-efi-sb-Enforce-verification-of-font-files.patch (100%) rename 0294-fbutil-Fix-integer-overflow.patch => 0295-fbutil-Fix-integer-overflow.patch (100%) rename 0295-font-Fix-an-integer-underflow-in-blit_comb.patch => 0296-font-Fix-an-integer-underflow-in-blit_comb.patch (100%) rename 0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch => 0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch (100%) rename 0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch => 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch (100%) rename 0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch => 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch (100%) rename 0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch => 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch (100%) diff --git a/0152-kern-file-Fix-error-handling-in-grub_file_open.patch b/0152-kern-file-Fix-error-handling-in-grub_file_open.patch new file mode 100644 index 00000000..e4443250 --- /dev/null +++ b/0152-kern-file-Fix-error-handling-in-grub_file_open.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Steve McIntyre +Date: Tue, 6 Dec 2022 01:45:11 +0000 +Subject: [PATCH] kern/file: Fix error handling in grub_file_open() + +grub_file_open() calls grub_file_get_device_name(), but doesn't check +the return. Instead, it checks if grub_errno is set. + +However, nothing initialises grub_errno here when grub_file_open() +starts. This means that trying to open one file that doesn't exist and +then trying to open another file that does will (incorrectly) also +fail to open that second file. + +Let's fix that. + +Signed-off-by: Steve McIntyre +--- + grub-core/kern/file.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c +index 58454458c4..5b58f45cfd 100644 +--- a/grub-core/kern/file.c ++++ b/grub-core/kern/file.c +@@ -66,6 +66,9 @@ grub_file_open (const char *name, enum grub_file_type type) + const char *file_name; + grub_file_filter_id_t filter; + ++ /* Reset grub_errno before we start */ ++ grub_errno = GRUB_ERR_NONE; ++ + device_name = grub_file_get_device_name (name); + if (grub_errno) + goto fail; diff --git a/0152-grub_file_-instrumentation-new-file-debug-tag.patch b/0153-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 82% rename from 0152-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0153-grub_file_-instrumentation-new-file-debug-tag.patch index 908e1ff6..63278992 100644 --- a/0152-grub_file_-instrumentation-new-file-debug-tag.patch +++ b/0153-grub_file_-instrumentation-new-file-debug-tag.patch @@ -12,7 +12,7 @@ Signed-off-by: Renaud Métrich 1 file changed, 14 insertions(+) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index 58454458c4..e19aea3e51 100644 +index 5b58f45cfd..ec10e54fc0 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -66,6 +66,8 @@ grub_file_open (const char *name, enum grub_file_type type) @@ -21,10 +21,10 @@ index 58454458c4..e19aea3e51 100644 + grub_dprintf ("file", "Opening `%s' ...\n", name); + - device_name = grub_file_get_device_name (name); - if (grub_errno) - goto fail; -@@ -128,6 +130,8 @@ grub_file_open (const char *name, enum grub_file_type type) + /* Reset grub_errno before we start */ + grub_errno = GRUB_ERR_NONE; + +@@ -131,6 +133,8 @@ grub_file_open (const char *name, enum grub_file_type type) if (!file) grub_file_close (last_file); @@ -33,7 +33,7 @@ index 58454458c4..e19aea3e51 100644 return file; fail: -@@ -138,6 +142,8 @@ grub_file_open (const char *name, enum grub_file_type type) +@@ -141,6 +145,8 @@ grub_file_open (const char *name, enum grub_file_type type) grub_free (file); @@ -42,7 +42,7 @@ index 58454458c4..e19aea3e51 100644 return 0; } -@@ -169,6 +175,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) +@@ -172,6 +178,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) if (len == 0) return 0; @@ -50,7 +50,7 @@ index 58454458c4..e19aea3e51 100644 read_hook = file->read_hook; read_hook_data = file->read_hook_data; if (!file->read_hook) -@@ -189,11 +196,18 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) +@@ -192,11 +199,18 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) grub_err_t grub_file_close (grub_file_t file) { diff --git a/0153-ieee1275-Avoiding-many-unecessary-open-close.patch b/0154-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0153-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0154-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0154-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0154-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0155-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0155-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0156-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 100% rename from 0156-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0157-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 100% rename from 0157-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch diff --git a/0158-docs-grub-Document-signing-grub-under-UEFI.patch b/0159-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0158-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0159-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0159-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0159-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0160-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0160-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0161-pgp-factor-out-rsa_pad.patch b/0162-pgp-factor-out-rsa_pad.patch similarity index 100% rename from 0161-pgp-factor-out-rsa_pad.patch rename to 0162-pgp-factor-out-rsa_pad.patch diff --git a/0162-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0162-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0163-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0163-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0164-libtasn1-import-libtasn1-4.16.0.patch b/0165-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0164-libtasn1-import-libtasn1-4.16.0.patch rename to 0165-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0165-libtasn1-disable-code-not-needed-in-grub.patch b/0166-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0165-libtasn1-disable-code-not-needed-in-grub.patch rename to 0166-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0166-libtasn1-changes-for-grub-compatibility.patch b/0167-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0166-libtasn1-changes-for-grub-compatibility.patch rename to 0167-libtasn1-changes-for-grub-compatibility.patch diff --git a/0167-libtasn1-compile-into-asn1-module.patch b/0168-libtasn1-compile-into-asn1-module.patch similarity index 100% rename from 0167-libtasn1-compile-into-asn1-module.patch rename to 0168-libtasn1-compile-into-asn1-module.patch diff --git a/0168-test_asn1-test-module-for-libtasn1.patch b/0169-test_asn1-test-module-for-libtasn1.patch similarity index 100% rename from 0168-test_asn1-test-module-for-libtasn1.patch rename to 0169-test_asn1-test-module-for-libtasn1.patch diff --git a/0169-grub-install-support-embedding-x509-certificates.patch b/0170-grub-install-support-embedding-x509-certificates.patch similarity index 100% rename from 0169-grub-install-support-embedding-x509-certificates.patch rename to 0170-grub-install-support-embedding-x509-certificates.patch diff --git a/0170-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0170-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0171-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0171-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0172-appended-signatures-support-verifying-appended-signa.patch b/0173-appended-signatures-support-verifying-appended-signa.patch similarity index 100% rename from 0172-appended-signatures-support-verifying-appended-signa.patch rename to 0173-appended-signatures-support-verifying-appended-signa.patch diff --git a/0173-appended-signatures-verification-tests.patch b/0174-appended-signatures-verification-tests.patch similarity index 100% rename from 0173-appended-signatures-verification-tests.patch rename to 0174-appended-signatures-verification-tests.patch diff --git a/0174-appended-signatures-documentation.patch b/0175-appended-signatures-documentation.patch similarity index 100% rename from 0174-appended-signatures-documentation.patch rename to 0175-appended-signatures-documentation.patch diff --git a/0175-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 100% rename from 0175-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch diff --git a/0176-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0176-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0177-ieee1275-claim-more-memory.patch b/0178-ieee1275-claim-more-memory.patch similarity index 100% rename from 0177-ieee1275-claim-more-memory.patch rename to 0178-ieee1275-claim-more-memory.patch diff --git a/0178-ieee1275-request-memory-with-ibm-client-architecture.patch b/0179-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0178-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0179-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0179-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0179-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0180-ieee1275-ofdisk-retry-on-open-failure.patch b/0181-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0180-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0181-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0181-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 100% rename from 0181-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch diff --git a/0182-efinet-Add-DHCP-proxy-support.patch b/0183-efinet-Add-DHCP-proxy-support.patch similarity index 100% rename from 0182-efinet-Add-DHCP-proxy-support.patch rename to 0183-efinet-Add-DHCP-proxy-support.patch diff --git a/0183-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0183-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 100% rename from 0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch diff --git a/0185-Suppress-gettext-error-message.patch b/0186-Suppress-gettext-error-message.patch similarity index 100% rename from 0185-Suppress-gettext-error-message.patch rename to 0186-Suppress-gettext-error-message.patch diff --git a/0186-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0186-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0187-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 100% rename from 0187-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch diff --git a/0188-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 100% rename from 0188-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0189-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 100% rename from 0189-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch diff --git a/0190-normal-main-Discover-the-device-to-read-the-config-f.patch b/0191-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 100% rename from 0190-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0191-normal-main-Discover-the-device-to-read-the-config-f.patch diff --git a/0191-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 100% rename from 0191-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch diff --git a/0192-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0192-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0193-Print-module-name-on-license-check-failure.patch b/0194-Print-module-name-on-license-check-failure.patch similarity index 100% rename from 0193-Print-module-name-on-license-check-failure.patch rename to 0194-Print-module-name-on-license-check-failure.patch diff --git a/0194-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 100% rename from 0194-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/0195-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 100% rename from 0195-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/0196-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch similarity index 100% rename from 0196-fs-btrfs-Use-full-btrfs-bootloader-area.patch rename to 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/0197-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch similarity index 100% rename from 0197-Add-Fedora-location-of-DejaVu-SANS-font.patch rename to 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch diff --git a/0198-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch similarity index 100% rename from 0198-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch rename to 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch diff --git a/0199-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch similarity index 100% rename from 0199-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch rename to 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch diff --git a/0200-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch similarity index 100% rename from 0200-EFI-console-Do-not-set-colorstate-until-the-first-te.patch rename to 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch diff --git a/0201-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch similarity index 100% rename from 0201-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch rename to 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch diff --git a/0202-Use-visual-indentation-in-config.h.in.patch b/0203-Use-visual-indentation-in-config.h.in.patch similarity index 100% rename from 0202-Use-visual-indentation-in-config.h.in.patch rename to 0203-Use-visual-indentation-in-config.h.in.patch diff --git a/0203-Where-present-ensure-config-util.h-precedes-config.h.patch b/0204-Where-present-ensure-config-util.h-precedes-config.h.patch similarity index 100% rename from 0203-Where-present-ensure-config-util.h-precedes-config.h.patch rename to 0204-Where-present-ensure-config-util.h-precedes-config.h.patch diff --git a/0204-Drop-gnulib-fix-base64.patch.patch b/0205-Drop-gnulib-fix-base64.patch.patch similarity index 100% rename from 0204-Drop-gnulib-fix-base64.patch.patch rename to 0205-Drop-gnulib-fix-base64.patch.patch diff --git a/0205-Drop-gnulib-no-abort.patch.patch b/0206-Drop-gnulib-no-abort.patch.patch similarity index 100% rename from 0205-Drop-gnulib-no-abort.patch.patch rename to 0206-Drop-gnulib-no-abort.patch.patch diff --git a/0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch similarity index 100% rename from 0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch rename to 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch diff --git a/0207-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch similarity index 100% rename from 0207-commands-search-Fix-bug-stopping-iteration-when-no-f.patch rename to 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch diff --git a/0208-search-new-efidisk-only-option-on-EFI-systems.patch b/0209-search-new-efidisk-only-option-on-EFI-systems.patch similarity index 100% rename from 0208-search-new-efidisk-only-option-on-EFI-systems.patch rename to 0209-search-new-efidisk-only-option-on-EFI-systems.patch diff --git a/0209-efi-new-connectefi-command.patch b/0210-efi-new-connectefi-command.patch similarity index 100% rename from 0209-efi-new-connectefi-command.patch rename to 0210-efi-new-connectefi-command.patch diff --git a/0210-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch similarity index 100% rename from 0210-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch rename to 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch diff --git a/0211-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch similarity index 100% rename from 0211-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch rename to 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch diff --git a/0212-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch similarity index 100% rename from 0212-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch rename to 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch diff --git a/0213-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch similarity index 100% rename from 0213-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch rename to 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/0214-powerpc-do-CAS-in-a-more-compatible-way.patch b/0215-powerpc-do-CAS-in-a-more-compatible-way.patch similarity index 100% rename from 0214-powerpc-do-CAS-in-a-more-compatible-way.patch rename to 0215-powerpc-do-CAS-in-a-more-compatible-way.patch diff --git a/0215-powerpc-prefix-detection-support-device-names-with-c.patch b/0216-powerpc-prefix-detection-support-device-names-with-c.patch similarity index 100% rename from 0215-powerpc-prefix-detection-support-device-names-with-c.patch rename to 0216-powerpc-prefix-detection-support-device-names-with-c.patch diff --git a/0216-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch b/0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch similarity index 100% rename from 0216-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch rename to 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch diff --git a/0217-make-ofdisk_retries-optional.patch b/0218-make-ofdisk_retries-optional.patch similarity index 100% rename from 0217-make-ofdisk_retries-optional.patch rename to 0218-make-ofdisk_retries-optional.patch diff --git a/0218-loader-efi-chainloader-grub_load_and_start_image-doe.patch b/0219-loader-efi-chainloader-grub_load_and_start_image-doe.patch similarity index 100% rename from 0218-loader-efi-chainloader-grub_load_and_start_image-doe.patch rename to 0219-loader-efi-chainloader-grub_load_and_start_image-doe.patch diff --git a/0219-loader-efi-chainloader-simplify-the-loader-state.patch b/0220-loader-efi-chainloader-simplify-the-loader-state.patch similarity index 100% rename from 0219-loader-efi-chainloader-simplify-the-loader-state.patch rename to 0220-loader-efi-chainloader-simplify-the-loader-state.patch diff --git a/0220-commands-boot-Add-API-to-pass-context-to-loader.patch b/0221-commands-boot-Add-API-to-pass-context-to-loader.patch similarity index 100% rename from 0220-commands-boot-Add-API-to-pass-context-to-loader.patch rename to 0221-commands-boot-Add-API-to-pass-context-to-loader.patch diff --git a/0221-loader-efi-chainloader-Use-grub_loader_set_ex.patch b/0222-loader-efi-chainloader-Use-grub_loader_set_ex.patch similarity index 100% rename from 0221-loader-efi-chainloader-Use-grub_loader_set_ex.patch rename to 0222-loader-efi-chainloader-Use-grub_loader_set_ex.patch diff --git a/0222-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch b/0223-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch similarity index 100% rename from 0222-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch rename to 0223-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch diff --git a/0223-loader-i386-efi-linux-Use-grub_loader_set_ex.patch b/0224-loader-i386-efi-linux-Use-grub_loader_set_ex.patch similarity index 100% rename from 0223-loader-i386-efi-linux-Use-grub_loader_set_ex.patch rename to 0224-loader-i386-efi-linux-Use-grub_loader_set_ex.patch diff --git a/0224-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch b/0225-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch similarity index 100% rename from 0224-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch rename to 0225-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch diff --git a/0225-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch b/0226-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch similarity index 100% rename from 0225-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch rename to 0226-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch diff --git a/0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch b/0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch similarity index 86% rename from 0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch rename to 0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch index bcc5503d..59f94718 100644 --- a/0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch +++ b/0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch @@ -18,10 +18,10 @@ Reviewed-by: Daniel Kiper 1 file changed, 2 insertions(+) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index e19aea3e51..ed69fc0f0f 100644 +index ec10e54fc0..db938e099d 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c -@@ -81,6 +81,7 @@ grub_file_open (const char *name, enum grub_file_type type) +@@ -84,6 +84,7 @@ grub_file_open (const char *name, enum grub_file_type type) device = grub_device_open (device_name); grub_free (device_name); @@ -29,7 +29,7 @@ index e19aea3e51..ed69fc0f0f 100644 if (! device) goto fail; -@@ -135,6 +136,7 @@ grub_file_open (const char *name, enum grub_file_type type) +@@ -138,6 +139,7 @@ grub_file_open (const char *name, enum grub_file_type type) return file; fail: diff --git a/0227-video-readers-png-Abort-sooner-if-a-read-operation-f.patch b/0228-video-readers-png-Abort-sooner-if-a-read-operation-f.patch similarity index 100% rename from 0227-video-readers-png-Abort-sooner-if-a-read-operation-f.patch rename to 0228-video-readers-png-Abort-sooner-if-a-read-operation-f.patch diff --git a/0228-video-readers-png-Refuse-to-handle-multiple-image-he.patch b/0229-video-readers-png-Refuse-to-handle-multiple-image-he.patch similarity index 100% rename from 0228-video-readers-png-Refuse-to-handle-multiple-image-he.patch rename to 0229-video-readers-png-Refuse-to-handle-multiple-image-he.patch diff --git a/0229-video-readers-png-Drop-greyscale-support-to-fix-heap.patch b/0230-video-readers-png-Drop-greyscale-support-to-fix-heap.patch similarity index 100% rename from 0229-video-readers-png-Drop-greyscale-support-to-fix-heap.patch rename to 0230-video-readers-png-Drop-greyscale-support-to-fix-heap.patch diff --git a/0230-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch b/0231-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch similarity index 100% rename from 0230-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch rename to 0231-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch diff --git a/0231-video-readers-png-Sanity-check-some-huffman-codes.patch b/0232-video-readers-png-Sanity-check-some-huffman-codes.patch similarity index 100% rename from 0231-video-readers-png-Sanity-check-some-huffman-codes.patch rename to 0232-video-readers-png-Sanity-check-some-huffman-codes.patch diff --git a/0232-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch b/0233-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch similarity index 100% rename from 0232-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch rename to 0233-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch diff --git a/0233-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch b/0234-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch similarity index 100% rename from 0233-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch rename to 0234-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch diff --git a/0234-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch b/0235-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch similarity index 100% rename from 0234-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch rename to 0235-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch diff --git a/0235-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch b/0236-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch similarity index 100% rename from 0235-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch rename to 0236-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch diff --git a/0236-normal-charset-Fix-array-out-of-bounds-formatting-un.patch b/0237-normal-charset-Fix-array-out-of-bounds-formatting-un.patch similarity index 100% rename from 0236-normal-charset-Fix-array-out-of-bounds-formatting-un.patch rename to 0237-normal-charset-Fix-array-out-of-bounds-formatting-un.patch diff --git a/0237-net-netbuff-Block-overly-large-netbuff-allocs.patch b/0238-net-netbuff-Block-overly-large-netbuff-allocs.patch similarity index 100% rename from 0237-net-netbuff-Block-overly-large-netbuff-allocs.patch rename to 0238-net-netbuff-Block-overly-large-netbuff-allocs.patch diff --git a/0238-net-ip-Do-IP-fragment-maths-safely.patch b/0239-net-ip-Do-IP-fragment-maths-safely.patch similarity index 100% rename from 0238-net-ip-Do-IP-fragment-maths-safely.patch rename to 0239-net-ip-Do-IP-fragment-maths-safely.patch diff --git a/0239-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch b/0240-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch similarity index 100% rename from 0239-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch rename to 0240-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch diff --git a/0240-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch b/0241-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch similarity index 100% rename from 0240-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch rename to 0241-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch diff --git a/0241-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch b/0242-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch similarity index 100% rename from 0241-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch rename to 0242-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch diff --git a/0242-net-tftp-Avoid-a-trivial-UAF.patch b/0243-net-tftp-Avoid-a-trivial-UAF.patch similarity index 100% rename from 0242-net-tftp-Avoid-a-trivial-UAF.patch rename to 0243-net-tftp-Avoid-a-trivial-UAF.patch diff --git a/0243-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch b/0244-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch similarity index 100% rename from 0243-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch rename to 0244-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch diff --git a/0244-net-http-Fix-OOB-write-for-split-http-headers.patch b/0245-net-http-Fix-OOB-write-for-split-http-headers.patch similarity index 100% rename from 0244-net-http-Fix-OOB-write-for-split-http-headers.patch rename to 0245-net-http-Fix-OOB-write-for-split-http-headers.patch diff --git a/0245-net-http-Error-out-on-headers-with-LF-without-CR.patch b/0246-net-http-Error-out-on-headers-with-LF-without-CR.patch similarity index 100% rename from 0245-net-http-Error-out-on-headers-with-LF-without-CR.patch rename to 0246-net-http-Error-out-on-headers-with-LF-without-CR.patch diff --git a/0246-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch b/0247-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch similarity index 100% rename from 0246-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch rename to 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch diff --git a/0247-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch b/0248-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch similarity index 100% rename from 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch rename to 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch diff --git a/0248-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch b/0249-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch similarity index 100% rename from 0248-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch rename to 0249-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch diff --git a/0249-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch b/0250-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch similarity index 100% rename from 0249-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch rename to 0250-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch diff --git a/0250-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch b/0251-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch similarity index 100% rename from 0250-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch rename to 0251-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch diff --git a/0251-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch b/0252-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch similarity index 100% rename from 0251-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch rename to 0252-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch diff --git a/0252-misc-Make-grub_min-and-grub_max-more-resilient.patch b/0253-misc-Make-grub_min-and-grub_max-more-resilient.patch similarity index 100% rename from 0252-misc-Make-grub_min-and-grub_max-more-resilient.patch rename to 0253-misc-Make-grub_min-and-grub_max-more-resilient.patch diff --git a/0253-ReiserFS-switch-to-using-grub_min-grub_max.patch b/0254-ReiserFS-switch-to-using-grub_min-grub_max.patch similarity index 100% rename from 0253-ReiserFS-switch-to-using-grub_min-grub_max.patch rename to 0254-ReiserFS-switch-to-using-grub_min-grub_max.patch diff --git a/0254-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch b/0255-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch similarity index 100% rename from 0254-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch rename to 0255-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch diff --git a/0255-modules-make-.module_license-read-only.patch b/0256-modules-make-.module_license-read-only.patch similarity index 100% rename from 0255-modules-make-.module_license-read-only.patch rename to 0256-modules-make-.module_license-read-only.patch diff --git a/0256-modules-strip-.llvm_addrsig-sections-and-similar.patch b/0257-modules-strip-.llvm_addrsig-sections-and-similar.patch similarity index 100% rename from 0256-modules-strip-.llvm_addrsig-sections-and-similar.patch rename to 0257-modules-strip-.llvm_addrsig-sections-and-similar.patch diff --git a/0257-modules-Don-t-allocate-space-for-non-allocable-secti.patch b/0258-modules-Don-t-allocate-space-for-non-allocable-secti.patch similarity index 100% rename from 0257-modules-Don-t-allocate-space-for-non-allocable-secti.patch rename to 0258-modules-Don-t-allocate-space-for-non-allocable-secti.patch diff --git a/0258-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch b/0259-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch similarity index 100% rename from 0258-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch rename to 0259-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch diff --git a/0259-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch b/0260-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch similarity index 100% rename from 0259-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch rename to 0260-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch diff --git a/0260-modules-load-module-sections-at-page-aligned-address.patch b/0261-modules-load-module-sections-at-page-aligned-address.patch similarity index 100% rename from 0260-modules-load-module-sections-at-page-aligned-address.patch rename to 0261-modules-load-module-sections-at-page-aligned-address.patch diff --git a/0261-nx-add-memory-attribute-get-set-API.patch b/0262-nx-add-memory-attribute-get-set-API.patch similarity index 100% rename from 0261-nx-add-memory-attribute-get-set-API.patch rename to 0262-nx-add-memory-attribute-get-set-API.patch diff --git a/0262-nx-set-page-permissions-for-loaded-modules.patch b/0263-nx-set-page-permissions-for-loaded-modules.patch similarity index 100% rename from 0262-nx-set-page-permissions-for-loaded-modules.patch rename to 0263-nx-set-page-permissions-for-loaded-modules.patch diff --git a/0263-nx-set-attrs-in-our-kernel-loaders.patch b/0264-nx-set-attrs-in-our-kernel-loaders.patch similarity index 100% rename from 0263-nx-set-attrs-in-our-kernel-loaders.patch rename to 0264-nx-set-attrs-in-our-kernel-loaders.patch diff --git a/0264-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch b/0265-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch similarity index 100% rename from 0264-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch rename to 0265-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch diff --git a/0265-grub-probe-document-the-behavior-of-multiple-v.patch b/0266-grub-probe-document-the-behavior-of-multiple-v.patch similarity index 100% rename from 0265-grub-probe-document-the-behavior-of-multiple-v.patch rename to 0266-grub-probe-document-the-behavior-of-multiple-v.patch diff --git a/0266-grub_fs_probe-dprint-errors-from-filesystems.patch b/0267-grub_fs_probe-dprint-errors-from-filesystems.patch similarity index 100% rename from 0266-grub_fs_probe-dprint-errors-from-filesystems.patch rename to 0267-grub_fs_probe-dprint-errors-from-filesystems.patch diff --git a/0267-fs-fat-don-t-error-when-mtime-is-0.patch b/0268-fs-fat-don-t-error-when-mtime-is-0.patch similarity index 100% rename from 0267-fs-fat-don-t-error-when-mtime-is-0.patch rename to 0268-fs-fat-don-t-error-when-mtime-is-0.patch diff --git a/0268-Make-debug-file-show-which-file-filters-get-run.patch b/0269-Make-debug-file-show-which-file-filters-get-run.patch similarity index 93% rename from 0268-Make-debug-file-show-which-file-filters-get-run.patch rename to 0269-Make-debug-file-show-which-file-filters-get-run.patch index 4ac32cb4..78bc095d 100644 --- a/0268-Make-debug-file-show-which-file-filters-get-run.patch +++ b/0269-Make-debug-file-show-which-file-filters-get-run.patch @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones 1 file changed, 11 insertions(+) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index ed69fc0f0f..20a4c839aa 100644 +index db938e099d..868ce3b63e 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -30,6 +30,14 @@ void (*EXPORT_VAR (grub_grubnet_fini)) (void); @@ -33,7 +33,7 @@ index ed69fc0f0f..20a4c839aa 100644 /* Get the device part of the filename NAME. It is enclosed by parentheses. */ char * grub_file_get_device_name (const char *name) -@@ -121,6 +129,9 @@ grub_file_open (const char *name, enum grub_file_type type) +@@ -124,6 +132,9 @@ grub_file_open (const char *name, enum grub_file_type type) if (grub_file_filters[filter]) { last_file = file; diff --git a/0269-efi-use-enumerated-array-positions-for-our-allocatio.patch b/0270-efi-use-enumerated-array-positions-for-our-allocatio.patch similarity index 100% rename from 0269-efi-use-enumerated-array-positions-for-our-allocatio.patch rename to 0270-efi-use-enumerated-array-positions-for-our-allocatio.patch diff --git a/0270-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch b/0271-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch similarity index 100% rename from 0270-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch rename to 0271-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch diff --git a/0271-efi-allocate-the-initrd-within-the-bounds-expressed-.patch b/0272-efi-allocate-the-initrd-within-the-bounds-expressed-.patch similarity index 100% rename from 0271-efi-allocate-the-initrd-within-the-bounds-expressed-.patch rename to 0272-efi-allocate-the-initrd-within-the-bounds-expressed-.patch diff --git a/0272-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch b/0273-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch similarity index 100% rename from 0272-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch rename to 0273-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch diff --git a/0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch b/0274-BLS-create-etc-kernel-cmdline-during-mkconfig.patch similarity index 100% rename from 0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch rename to 0274-BLS-create-etc-kernel-cmdline-during-mkconfig.patch diff --git a/0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch b/0275-squish-don-t-dup-rhgb-quiet-check-mtimes.patch similarity index 100% rename from 0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch rename to 0275-squish-don-t-dup-rhgb-quiet-check-mtimes.patch diff --git a/0275-squish-give-up-on-rhgb-quiet.patch b/0276-squish-give-up-on-rhgb-quiet.patch similarity index 100% rename from 0275-squish-give-up-on-rhgb-quiet.patch rename to 0276-squish-give-up-on-rhgb-quiet.patch diff --git a/0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch b/0277-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch similarity index 100% rename from 0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch rename to 0277-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch diff --git a/0277-ieee1275-implement-vec5-for-cas-negotiation.patch b/0278-ieee1275-implement-vec5-for-cas-negotiation.patch similarity index 100% rename from 0277-ieee1275-implement-vec5-for-cas-negotiation.patch rename to 0278-ieee1275-implement-vec5-for-cas-negotiation.patch diff --git a/0278-blscfg-Don-t-root-device-in-emu-builds.patch b/0279-blscfg-Don-t-root-device-in-emu-builds.patch similarity index 100% rename from 0278-blscfg-Don-t-root-device-in-emu-builds.patch rename to 0279-blscfg-Don-t-root-device-in-emu-builds.patch diff --git a/0279-loader-arm64-linux-Remove-magic-number-header-field-.patch b/0280-loader-arm64-linux-Remove-magic-number-header-field-.patch similarity index 100% rename from 0279-loader-arm64-linux-Remove-magic-number-header-field-.patch rename to 0280-loader-arm64-linux-Remove-magic-number-header-field-.patch diff --git a/0280-Correct-BSS-zeroing-on-aarch64.patch b/0281-Correct-BSS-zeroing-on-aarch64.patch similarity index 100% rename from 0280-Correct-BSS-zeroing-on-aarch64.patch rename to 0281-Correct-BSS-zeroing-on-aarch64.patch diff --git a/0281-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch b/0282-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch similarity index 100% rename from 0281-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch rename to 0282-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch diff --git a/0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch b/0283-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch similarity index 100% rename from 0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch rename to 0283-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch diff --git a/0283-commands-efi-tpm-Refine-the-status-of-log-event.patch b/0284-commands-efi-tpm-Refine-the-status-of-log-event.patch similarity index 100% rename from 0283-commands-efi-tpm-Refine-the-status-of-log-event.patch rename to 0284-commands-efi-tpm-Refine-the-status-of-log-event.patch diff --git a/0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch b/0285-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch similarity index 100% rename from 0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch rename to 0285-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch diff --git a/0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch b/0286-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch similarity index 100% rename from 0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch rename to 0286-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch diff --git a/0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch b/0287-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch similarity index 100% rename from 0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch rename to 0287-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch diff --git a/0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch b/0288-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch similarity index 100% rename from 0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch rename to 0288-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch diff --git a/0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch b/0289-font-Fix-several-integer-overflows-in-grub_font_cons.patch similarity index 100% rename from 0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch rename to 0289-font-Fix-several-integer-overflows-in-grub_font_cons.patch diff --git a/0289-font-Remove-grub_font_dup_glyph.patch b/0290-font-Remove-grub_font_dup_glyph.patch similarity index 100% rename from 0289-font-Remove-grub_font_dup_glyph.patch rename to 0290-font-Remove-grub_font_dup_glyph.patch diff --git a/0290-font-Fix-integer-overflow-in-ensure_comb_space.patch b/0291-font-Fix-integer-overflow-in-ensure_comb_space.patch similarity index 100% rename from 0290-font-Fix-integer-overflow-in-ensure_comb_space.patch rename to 0291-font-Fix-integer-overflow-in-ensure_comb_space.patch diff --git a/0291-font-Fix-integer-overflow-in-BMP-index.patch b/0292-font-Fix-integer-overflow-in-BMP-index.patch similarity index 100% rename from 0291-font-Fix-integer-overflow-in-BMP-index.patch rename to 0292-font-Fix-integer-overflow-in-BMP-index.patch diff --git a/0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch b/0293-font-Fix-integer-underflow-in-binary-search-of-char-.patch similarity index 100% rename from 0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch rename to 0293-font-Fix-integer-underflow-in-binary-search-of-char-.patch diff --git a/0293-kern-efi-sb-Enforce-verification-of-font-files.patch b/0294-kern-efi-sb-Enforce-verification-of-font-files.patch similarity index 100% rename from 0293-kern-efi-sb-Enforce-verification-of-font-files.patch rename to 0294-kern-efi-sb-Enforce-verification-of-font-files.patch diff --git a/0294-fbutil-Fix-integer-overflow.patch b/0295-fbutil-Fix-integer-overflow.patch similarity index 100% rename from 0294-fbutil-Fix-integer-overflow.patch rename to 0295-fbutil-Fix-integer-overflow.patch diff --git a/0295-font-Fix-an-integer-underflow-in-blit_comb.patch b/0296-font-Fix-an-integer-underflow-in-blit_comb.patch similarity index 100% rename from 0295-font-Fix-an-integer-underflow-in-blit_comb.patch rename to 0296-font-Fix-an-integer-underflow-in-blit_comb.patch diff --git a/0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch b/0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch similarity index 100% rename from 0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch rename to 0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch diff --git a/0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch b/0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch similarity index 100% rename from 0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch rename to 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch diff --git a/0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch b/0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch similarity index 100% rename from 0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch rename to 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch diff --git a/0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch b/0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch similarity index 100% rename from 0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch rename to 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch diff --git a/grub.patches b/grub.patches index 0d543751..fd531aea 100644 --- a/grub.patches +++ b/grub.patches @@ -149,151 +149,152 @@ Patch0148: 0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch Patch0149: 0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch Patch0150: 0150-Introduce-function-grub_debug_is_enabled-void-return.patch Patch0151: 0151-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0152: 0152-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0153: 0153-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0154: 0154-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0155: 0155-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0156: 0156-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0157: 0157-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0158: 0158-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0159: 0159-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0160: 0160-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0161: 0161-pgp-factor-out-rsa_pad.patch -Patch0162: 0162-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0163: 0163-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0164: 0164-libtasn1-import-libtasn1-4.16.0.patch -Patch0165: 0165-libtasn1-disable-code-not-needed-in-grub.patch -Patch0166: 0166-libtasn1-changes-for-grub-compatibility.patch -Patch0167: 0167-libtasn1-compile-into-asn1-module.patch -Patch0168: 0168-test_asn1-test-module-for-libtasn1.patch -Patch0169: 0169-grub-install-support-embedding-x509-certificates.patch -Patch0170: 0170-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0171: 0171-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0172: 0172-appended-signatures-support-verifying-appended-signa.patch -Patch0173: 0173-appended-signatures-verification-tests.patch -Patch0174: 0174-appended-signatures-documentation.patch -Patch0175: 0175-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0176: 0176-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0177: 0177-ieee1275-claim-more-memory.patch -Patch0178: 0178-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0179: 0179-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0180: 0180-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0181: 0181-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0182: 0182-efinet-Add-DHCP-proxy-support.patch -Patch0183: 0183-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0184: 0184-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0185: 0185-Suppress-gettext-error-message.patch -Patch0186: 0186-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0187: 0187-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0188: 0188-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0189: 0189-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0190: 0190-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0191: 0191-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0192: 0192-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0193: 0193-Print-module-name-on-license-check-failure.patch -Patch0194: 0194-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0195: 0195-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0196: 0196-fs-btrfs-Use-full-btrfs-bootloader-area.patch -Patch0197: 0197-Add-Fedora-location-of-DejaVu-SANS-font.patch -Patch0198: 0198-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch -Patch0199: 0199-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch -Patch0200: 0200-EFI-console-Do-not-set-colorstate-until-the-first-te.patch -Patch0201: 0201-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch -Patch0202: 0202-Use-visual-indentation-in-config.h.in.patch -Patch0203: 0203-Where-present-ensure-config-util.h-precedes-config.h.patch -Patch0204: 0204-Drop-gnulib-fix-base64.patch.patch -Patch0205: 0205-Drop-gnulib-no-abort.patch.patch -Patch0206: 0206-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0207: 0207-commands-search-Fix-bug-stopping-iteration-when-no-f.patch -Patch0208: 0208-search-new-efidisk-only-option-on-EFI-systems.patch -Patch0209: 0209-efi-new-connectefi-command.patch -Patch0210: 0210-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch -Patch0211: 0211-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch -Patch0212: 0212-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch -Patch0213: 0213-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch -Patch0214: 0214-powerpc-do-CAS-in-a-more-compatible-way.patch -Patch0215: 0215-powerpc-prefix-detection-support-device-names-with-c.patch -Patch0216: 0216-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch -Patch0217: 0217-make-ofdisk_retries-optional.patch -Patch0218: 0218-loader-efi-chainloader-grub_load_and_start_image-doe.patch -Patch0219: 0219-loader-efi-chainloader-simplify-the-loader-state.patch -Patch0220: 0220-commands-boot-Add-API-to-pass-context-to-loader.patch -Patch0221: 0221-loader-efi-chainloader-Use-grub_loader_set_ex.patch -Patch0222: 0222-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch -Patch0223: 0223-loader-i386-efi-linux-Use-grub_loader_set_ex.patch -Patch0224: 0224-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch -Patch0225: 0225-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch -Patch0226: 0226-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch -Patch0227: 0227-video-readers-png-Abort-sooner-if-a-read-operation-f.patch -Patch0228: 0228-video-readers-png-Refuse-to-handle-multiple-image-he.patch -Patch0229: 0229-video-readers-png-Drop-greyscale-support-to-fix-heap.patch -Patch0230: 0230-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch -Patch0231: 0231-video-readers-png-Sanity-check-some-huffman-codes.patch -Patch0232: 0232-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch -Patch0233: 0233-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch -Patch0234: 0234-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch -Patch0235: 0235-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch -Patch0236: 0236-normal-charset-Fix-array-out-of-bounds-formatting-un.patch -Patch0237: 0237-net-netbuff-Block-overly-large-netbuff-allocs.patch -Patch0238: 0238-net-ip-Do-IP-fragment-maths-safely.patch -Patch0239: 0239-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch -Patch0240: 0240-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch -Patch0241: 0241-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch -Patch0242: 0242-net-tftp-Avoid-a-trivial-UAF.patch -Patch0243: 0243-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch -Patch0244: 0244-net-http-Fix-OOB-write-for-split-http-headers.patch -Patch0245: 0245-net-http-Error-out-on-headers-with-LF-without-CR.patch -Patch0246: 0246-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch -Patch0247: 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch -Patch0248: 0248-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch -Patch0249: 0249-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch -Patch0250: 0250-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch -Patch0251: 0251-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch -Patch0252: 0252-misc-Make-grub_min-and-grub_max-more-resilient.patch -Patch0253: 0253-ReiserFS-switch-to-using-grub_min-grub_max.patch -Patch0254: 0254-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch -Patch0255: 0255-modules-make-.module_license-read-only.patch -Patch0256: 0256-modules-strip-.llvm_addrsig-sections-and-similar.patch -Patch0257: 0257-modules-Don-t-allocate-space-for-non-allocable-secti.patch -Patch0258: 0258-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch -Patch0259: 0259-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch -Patch0260: 0260-modules-load-module-sections-at-page-aligned-address.patch -Patch0261: 0261-nx-add-memory-attribute-get-set-API.patch -Patch0262: 0262-nx-set-page-permissions-for-loaded-modules.patch -Patch0263: 0263-nx-set-attrs-in-our-kernel-loaders.patch -Patch0264: 0264-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch -Patch0265: 0265-grub-probe-document-the-behavior-of-multiple-v.patch -Patch0266: 0266-grub_fs_probe-dprint-errors-from-filesystems.patch -Patch0267: 0267-fs-fat-don-t-error-when-mtime-is-0.patch -Patch0268: 0268-Make-debug-file-show-which-file-filters-get-run.patch -Patch0269: 0269-efi-use-enumerated-array-positions-for-our-allocatio.patch -Patch0270: 0270-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch -Patch0271: 0271-efi-allocate-the-initrd-within-the-bounds-expressed-.patch -Patch0272: 0272-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch -Patch0273: 0273-BLS-create-etc-kernel-cmdline-during-mkconfig.patch -Patch0274: 0274-squish-don-t-dup-rhgb-quiet-check-mtimes.patch -Patch0275: 0275-squish-give-up-on-rhgb-quiet.patch -Patch0276: 0276-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch -Patch0277: 0277-ieee1275-implement-vec5-for-cas-negotiation.patch -Patch0278: 0278-blscfg-Don-t-root-device-in-emu-builds.patch -Patch0279: 0279-loader-arm64-linux-Remove-magic-number-header-field-.patch -Patch0280: 0280-Correct-BSS-zeroing-on-aarch64.patch -Patch0281: 0281-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch -Patch0282: 0282-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch -Patch0283: 0283-commands-efi-tpm-Refine-the-status-of-log-event.patch -Patch0284: 0284-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch -Patch0285: 0285-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch -Patch0286: 0286-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch -Patch0287: 0287-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch -Patch0288: 0288-font-Fix-several-integer-overflows-in-grub_font_cons.patch -Patch0289: 0289-font-Remove-grub_font_dup_glyph.patch -Patch0290: 0290-font-Fix-integer-overflow-in-ensure_comb_space.patch -Patch0291: 0291-font-Fix-integer-overflow-in-BMP-index.patch -Patch0292: 0292-font-Fix-integer-underflow-in-binary-search-of-char-.patch -Patch0293: 0293-kern-efi-sb-Enforce-verification-of-font-files.patch -Patch0294: 0294-fbutil-Fix-integer-overflow.patch -Patch0295: 0295-font-Fix-an-integer-underflow-in-blit_comb.patch -Patch0296: 0296-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch -Patch0297: 0297-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch -Patch0298: 0298-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch -Patch0299: 0299-font-Try-opening-fonts-from-the-bundled-memdisk.patch +Patch0152: 0152-kern-file-Fix-error-handling-in-grub_file_open.patch +Patch0153: 0153-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0154: 0154-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0155: 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0156: 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0157: 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0158: 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0159: 0159-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0160: 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0161: 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0162: 0162-pgp-factor-out-rsa_pad.patch +Patch0163: 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0164: 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0165: 0165-libtasn1-import-libtasn1-4.16.0.patch +Patch0166: 0166-libtasn1-disable-code-not-needed-in-grub.patch +Patch0167: 0167-libtasn1-changes-for-grub-compatibility.patch +Patch0168: 0168-libtasn1-compile-into-asn1-module.patch +Patch0169: 0169-test_asn1-test-module-for-libtasn1.patch +Patch0170: 0170-grub-install-support-embedding-x509-certificates.patch +Patch0171: 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0172: 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0173: 0173-appended-signatures-support-verifying-appended-signa.patch +Patch0174: 0174-appended-signatures-verification-tests.patch +Patch0175: 0175-appended-signatures-documentation.patch +Patch0176: 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0177: 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0178: 0178-ieee1275-claim-more-memory.patch +Patch0179: 0179-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0180: 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0181: 0181-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0182: 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0183: 0183-efinet-Add-DHCP-proxy-support.patch +Patch0184: 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0185: 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0186: 0186-Suppress-gettext-error-message.patch +Patch0187: 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0188: 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0189: 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0190: 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0191: 0191-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0192: 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0193: 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0194: 0194-Print-module-name-on-license-check-failure.patch +Patch0195: 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0196: 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0197: 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0198: 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch +Patch0199: 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +Patch0200: 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +Patch0201: 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +Patch0202: 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +Patch0203: 0203-Use-visual-indentation-in-config.h.in.patch +Patch0204: 0204-Where-present-ensure-config-util.h-precedes-config.h.patch +Patch0205: 0205-Drop-gnulib-fix-base64.patch.patch +Patch0206: 0206-Drop-gnulib-no-abort.patch.patch +Patch0207: 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch +Patch0208: 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +Patch0209: 0209-search-new-efidisk-only-option-on-EFI-systems.patch +Patch0210: 0210-efi-new-connectefi-command.patch +Patch0211: 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0212: 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +Patch0213: 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0214: 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0215: 0215-powerpc-do-CAS-in-a-more-compatible-way.patch +Patch0216: 0216-powerpc-prefix-detection-support-device-names-with-c.patch +Patch0217: 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +Patch0218: 0218-make-ofdisk_retries-optional.patch +Patch0219: 0219-loader-efi-chainloader-grub_load_and_start_image-doe.patch +Patch0220: 0220-loader-efi-chainloader-simplify-the-loader-state.patch +Patch0221: 0221-commands-boot-Add-API-to-pass-context-to-loader.patch +Patch0222: 0222-loader-efi-chainloader-Use-grub_loader_set_ex.patch +Patch0223: 0223-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch +Patch0224: 0224-loader-i386-efi-linux-Use-grub_loader_set_ex.patch +Patch0225: 0225-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch +Patch0226: 0226-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch +Patch0227: 0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch +Patch0228: 0228-video-readers-png-Abort-sooner-if-a-read-operation-f.patch +Patch0229: 0229-video-readers-png-Refuse-to-handle-multiple-image-he.patch +Patch0230: 0230-video-readers-png-Drop-greyscale-support-to-fix-heap.patch +Patch0231: 0231-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch +Patch0232: 0232-video-readers-png-Sanity-check-some-huffman-codes.patch +Patch0233: 0233-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch +Patch0234: 0234-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch +Patch0235: 0235-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch +Patch0236: 0236-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch +Patch0237: 0237-normal-charset-Fix-array-out-of-bounds-formatting-un.patch +Patch0238: 0238-net-netbuff-Block-overly-large-netbuff-allocs.patch +Patch0239: 0239-net-ip-Do-IP-fragment-maths-safely.patch +Patch0240: 0240-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch +Patch0241: 0241-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch +Patch0242: 0242-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch +Patch0243: 0243-net-tftp-Avoid-a-trivial-UAF.patch +Patch0244: 0244-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch +Patch0245: 0245-net-http-Fix-OOB-write-for-split-http-headers.patch +Patch0246: 0246-net-http-Error-out-on-headers-with-LF-without-CR.patch +Patch0247: 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch +Patch0248: 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch +Patch0249: 0249-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch +Patch0250: 0250-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch +Patch0251: 0251-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch +Patch0252: 0252-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch +Patch0253: 0253-misc-Make-grub_min-and-grub_max-more-resilient.patch +Patch0254: 0254-ReiserFS-switch-to-using-grub_min-grub_max.patch +Patch0255: 0255-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch +Patch0256: 0256-modules-make-.module_license-read-only.patch +Patch0257: 0257-modules-strip-.llvm_addrsig-sections-and-similar.patch +Patch0258: 0258-modules-Don-t-allocate-space-for-non-allocable-secti.patch +Patch0259: 0259-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch +Patch0260: 0260-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch +Patch0261: 0261-modules-load-module-sections-at-page-aligned-address.patch +Patch0262: 0262-nx-add-memory-attribute-get-set-API.patch +Patch0263: 0263-nx-set-page-permissions-for-loaded-modules.patch +Patch0264: 0264-nx-set-attrs-in-our-kernel-loaders.patch +Patch0265: 0265-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch +Patch0266: 0266-grub-probe-document-the-behavior-of-multiple-v.patch +Patch0267: 0267-grub_fs_probe-dprint-errors-from-filesystems.patch +Patch0268: 0268-fs-fat-don-t-error-when-mtime-is-0.patch +Patch0269: 0269-Make-debug-file-show-which-file-filters-get-run.patch +Patch0270: 0270-efi-use-enumerated-array-positions-for-our-allocatio.patch +Patch0271: 0271-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch +Patch0272: 0272-efi-allocate-the-initrd-within-the-bounds-expressed-.patch +Patch0273: 0273-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch +Patch0274: 0274-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +Patch0275: 0275-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +Patch0276: 0276-squish-give-up-on-rhgb-quiet.patch +Patch0277: 0277-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +Patch0278: 0278-ieee1275-implement-vec5-for-cas-negotiation.patch +Patch0279: 0279-blscfg-Don-t-root-device-in-emu-builds.patch +Patch0280: 0280-loader-arm64-linux-Remove-magic-number-header-field-.patch +Patch0281: 0281-Correct-BSS-zeroing-on-aarch64.patch +Patch0282: 0282-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch +Patch0283: 0283-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch +Patch0284: 0284-commands-efi-tpm-Refine-the-status-of-log-event.patch +Patch0285: 0285-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch +Patch0286: 0286-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch +Patch0287: 0287-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch +Patch0288: 0288-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch +Patch0289: 0289-font-Fix-several-integer-overflows-in-grub_font_cons.patch +Patch0290: 0290-font-Remove-grub_font_dup_glyph.patch +Patch0291: 0291-font-Fix-integer-overflow-in-ensure_comb_space.patch +Patch0292: 0292-font-Fix-integer-overflow-in-BMP-index.patch +Patch0293: 0293-font-Fix-integer-underflow-in-binary-search-of-char-.patch +Patch0294: 0294-kern-efi-sb-Enforce-verification-of-font-files.patch +Patch0295: 0295-fbutil-Fix-integer-overflow.patch +Patch0296: 0296-font-Fix-an-integer-underflow-in-blit_comb.patch +Patch0297: 0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch +Patch0298: 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch +Patch0299: 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch +Patch0300: 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch diff --git a/grub2.spec b/grub2.spec index 2f08c20f..4c72b60e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 68%{?dist} +Release: 69%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Dec 06 2022 Robbie Harwood - 2.06-69 +- Fix error handling in grub_file_open() + * Mon Dec 05 2022 Robbie Harwood - 2.06-68 - Allow for xz'd symvers file (prarit) From fa48146e4cbec9e04ede2dcfb38beeff6d3fa85f Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 14 Dec 2022 19:30:52 +0000 Subject: [PATCH 166/294] ppc64le: fix lpar cas5 Resolves: #2152547 Signed-off-by: Robbie Harwood --- 0301-Correction-in-vector-5-values.patch | 30 ++++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 ++++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 0301-Correction-in-vector-5-values.patch diff --git a/0301-Correction-in-vector-5-values.patch b/0301-Correction-in-vector-5-values.patch new file mode 100644 index 00000000..9be1f4a4 --- /dev/null +++ b/0301-Correction-in-vector-5-values.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Avnish Chouhan +Date: Tue, 22 Nov 2022 08:01:47 -0500 +Subject: [PATCH] Correction in vector 5 values + +This patch is to update the vector 5 values which is troubling some +machines to bootup properly. Max out the values of all the properties of +Vector 5 (similar to vector 2) except max cpu property, which were set +as 0 earlier. + +Signed-off-by: Avnish Chouhan +[rharwood: rewrap comit message] +Signed-off-by: Robbie Harwood +--- + grub-core/kern/ieee1275/init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 6a51c9efab..28a3bd4621 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -376,7 +376,7 @@ grub_ieee1275_ibm_cas (void) + .vec4 = 0x0001, // set required minimum capacity % to the lowest value + .vec5_size = 1 + sizeof(struct option_vector5) - 2, + .vec5 = { +- 0, 0, 0, 0, 0, 0, 0, 0, 256 ++ -1, -1, -1, -1, -1, -1, -1, -1, 256 + } + }; + diff --git a/grub.patches b/grub.patches index fd531aea..fae414f3 100644 --- a/grub.patches +++ b/grub.patches @@ -298,3 +298,4 @@ Patch0297: 0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch Patch0298: 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch Patch0299: 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch Patch0300: 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch +Patch0301: 0301-Correction-in-vector-5-values.patch diff --git a/grub2.spec b/grub2.spec index 4c72b60e..b3b8d7b0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 69%{?dist} +Release: 70%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Dec 14 2022 Robbie Harwood - 2.06-70 +- ppc64le: fix lpar cas5 +- Resolves: #2152547 + * Tue Dec 06 2022 Robbie Harwood - 2.06-69 - Fix error handling in grub_file_open() From 55921d8655750b6f1b4a8fe39aeb69881b72dee9 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 19 Dec 2022 18:55:40 +0000 Subject: [PATCH 167/294] Attempt to fix eln build Signed-off-by: Robbie Harwood --- grub.macros | 20 +++++++++++--------- grub2.spec | 5 ++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/grub.macros b/grub.macros index b87b427a..1670c060 100644 --- a/grub.macros +++ b/grub.macros @@ -436,10 +436,18 @@ mksquashfs memdisk memdisk.squashfs -comp xz \ %endif %ifarch ppc64le -%if 0%{?rhel} +# RHEL signs, Fedora + ELN don't (but ELN defines rhel) +%if 0%{?fedora} || 0%{?eln} %define ieee1275_mkimage() \ mkdir -p memdisk/fonts \ -cp %{4}/unicode.pf2 memdisk/fonts \ +cp %{5}/unicode.pf2 memdisk/fonts \ +mksquashfs memdisk memdisk.squashfs -comp xz \ +./grub-mkimage -O %{1} -o %{2} -p '/grub2' -d grub-core ${GRUB_MODULES} \ +%{nil} +%else +%define ieee1275_mkimage() \ +mkdir -p memdisk/fonts \ +cp %{5}/unicode.pf2 memdisk/fonts \ mksquashfs memdisk memdisk.squashfs -comp xz \ APPENDED_SIG_SIZE=0 \ if [ -x /usr/bin/rpm-sign ]; then \ @@ -466,12 +474,6 @@ else \ mv %{2}.orig %{2} \ fi \ %{nil} -%else -# Fedora et al. -%define ieee1275_mkimage() \ -./grub-mkimage -O %{1} -o %{2}.orig -p '/grub2' -d grub-core ${GRUB_MODULES} \ -mv %{2}.orig %{2} -%{nil} %endif %endif @@ -486,7 +488,7 @@ GRUB_MODULES+=%{platform_modules} \ GRUB_MODULES+=%{grub_modules} \ GRUB_MODULES+=%{platform_modules} \ cd grub-%{1}-%{tarversion} \ -%{expand:%%ieee1275_mkimage %%{1} %%{2} %%{3} %%{4}} \ +%{expand:%%ieee1275_mkimage %%{1} %%{2} %%{3} %%{4} ./ }\ cd .. \ %{nil} diff --git a/grub2.spec b/grub2.spec index b3b8d7b0..c6babdfa 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 70%{?dist} +Release: 71%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Dec 19 2022 Robbie Harwood - 2.06-71 +- Attempt to fix eln build + * Wed Dec 14 2022 Robbie Harwood - 2.06-70 - ppc64le: fix lpar cas5 - Resolves: #2152547 From 9e46a970c68ca4b13b96b44d72efeed05f6bce16 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 21 Dec 2022 22:35:22 +0000 Subject: [PATCH 168/294] Fix prefix setting with memdisk creation for network boot Signed-off-by: Robbie Harwood --- grub.macros | 9 ++++++--- grub2.spec | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/grub.macros b/grub.macros index 1670c060..9591ff00 100644 --- a/grub.macros +++ b/grub.macros @@ -416,14 +416,16 @@ mkdir -p memdisk/fonts \ cp %{4}/unicode.pf2 memdisk/fonts \ mksquashfs memdisk memdisk.squashfs -comp xz \ %{4}./grub-mkimage -O %{1} -o %{2}.orig \\\ - -p /EFI/%{efi_vendor} -d grub-core \\\ + -d grub-core \\\ --sbat %{4}./sbat.csv \\\ -m memdisk.squashfs \\\ + -p /EFI/%{efi_vendor} \\\ ${GRUB_MODULES} \ %{4}./grub-mkimage -O %{1} -o %{3}.orig \\\ - -p /EFI/BOOT -d grub-core \\\ + -d grub-core \\\ --sbat %{4}./sbat.csv \\\ -m memdisk.squashfs \\\ + -p /EFI/BOOT \\\ ${GRUB_MODULES} \ %{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \ %{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \ @@ -460,8 +462,9 @@ if [ -x /usr/bin/rpm-sign ]; then \ fi \ # FIXME: using this prefix is fragile, must be done properly \ ./grub-mkimage -O %{1} -o %{2}.orig \\\ - -p '/grub2' -d grub-core \\\ + -d grub-core \\\ -m memdisk.squashfs \\\ + -p '/grub2' \\\ -x %{3} \\\ --appended-signature-size ${APPENDED_SIG_SIZE} \\\ ${GRUB_MODULES} \ diff --git a/grub2.spec b/grub2.spec index c6babdfa..d06732d3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 71%{?dist} +Release: 72%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Dec 21 2022 Robbie Harwood - 2.06-72 +- Fix prefix setting with memdisk creation for network boot + * Mon Dec 19 2022 Robbie Harwood - 2.06-71 - Attempt to fix eln build From d2ad09e81a0eb3910585645d52bd48d5eb2f914f Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 10 Jan 2023 19:49:15 +0000 Subject: [PATCH 169/294] Allow internal grub allocations over 4GB Signed-off-by: Robbie Harwood --- ...w-internal-grub-allocations-over-4GB.patch | 105 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 0302-Allow-internal-grub-allocations-over-4GB.patch diff --git a/0302-Allow-internal-grub-allocations-over-4GB.patch b/0302-Allow-internal-grub-allocations-over-4GB.patch new file mode 100644 index 00000000..9c97dfcc --- /dev/null +++ b/0302-Allow-internal-grub-allocations-over-4GB.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Julian Andres Klode +Date: Tue, 6 Dec 2022 15:29:13 +0100 +Subject: [PATCH] Allow internal grub allocations over 4GB + +Previous commits introduced support for loading kernel and +initrd over 4GB if necessary, but only for the actual loading. + +Grub also needs to load large initrds into memory as part of +the verifiers framework. + +Increase the maximum allocation limit to the maximum usable +address, and at the same time, to preserve existing behavior, +define a 4G limit that behaves like the old one. + +Signed-off-by: Julian Andres Klode +(cherry picked from commit cf6516128ea03294156fc59a50ce90856bd3ebd2) +--- + grub-core/loader/i386/efi/linux.c | 20 +++++++++++--------- + include/grub/x86_64/efi/memory.h | 2 +- + 2 files changed, 12 insertions(+), 10 deletions(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 9854b0defa..0cc1c0d9a5 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -31,6 +31,8 @@ + #include + #include + ++#define GRUB_EFI_4G_ALLOCATION_ADDRESS 0x7fffffff ++ + GRUB_MOD_LICENSE ("GPLv3+"); + + static grub_dl_t my_mod; +@@ -79,17 +81,17 @@ static struct allocation_choice max_addresses[] = + /* the kernel overrides this one with pref_address and + * GRUB_EFI_ALLOCATE_ADDRESS */ + [KERNEL_PREF_ADDRESS] = +- { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ { KERNEL_MEM, GRUB_EFI_4G_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + /* If the flag in params is set, this one gets changed to be above 4GB. */ + [KERNEL_4G_LIMIT] = +- { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ { KERNEL_MEM, GRUB_EFI_4G_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + /* this one is always below 4GB, which we still *prefer* even if the flag + * is set. */ + [KERNEL_NO_LIMIT] = +- { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ { KERNEL_MEM, GRUB_EFI_4G_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + /* this is for the initrd */ + [INITRD_MAX_ADDRESS] = +- { INITRD_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, ++ { INITRD_MEM, GRUB_EFI_4G_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, + { NO_MEM, 0, 0 } + }; + static struct allocation_choice saved_addresses[sizeof(max_addresses) / sizeof(max_addresses[0])]; +@@ -190,7 +192,7 @@ grub_linuxefi_unload (void *data) + cmd_initrdefi->data = 0; + grub_free (context); + +- max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; ++ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_4G_ALLOCATION_ADDRESS; + + return GRUB_ERR_NONE; + } +@@ -506,13 +508,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + */ + save_addresses(); + grub_dprintf ("linux", "lh->pref_address: %p\n", (void *)(grub_addr_t)lh->pref_address); +- if (lh->pref_address < (grub_uint64_t)GRUB_EFI_MAX_ALLOCATION_ADDRESS) ++ if (lh->pref_address < (grub_uint64_t)GRUB_EFI_4G_ALLOCATION_ADDRESS) + { + max_addresses[KERNEL_PREF_ADDRESS].addr = lh->pref_address; + max_addresses[KERNEL_PREF_ADDRESS].alloc_type = GRUB_EFI_ALLOCATE_ADDRESS; + } +- max_addresses[KERNEL_4G_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; +- max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; ++ max_addresses[KERNEL_4G_LIMIT].addr = GRUB_EFI_4G_ALLOCATION_ADDRESS; ++ max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_4G_ALLOCATION_ADDRESS; + kernel_size = lh->init_size; + grub_dprintf ("linux", "Trying to allocate kernel mem\n"); + kernel_mem = kernel_alloc (KERNEL_MEM, kernel_size, +@@ -564,7 +566,7 @@ fail: + + grub_dl_unref (my_mod); + +- max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; ++ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_4G_ALLOCATION_ADDRESS; + + if (lh) + kernel_free (cmdline, lh->cmdline_size + 1); +diff --git a/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h +index e81cfb3221..547e3f82f8 100644 +--- a/include/grub/x86_64/efi/memory.h ++++ b/include/grub/x86_64/efi/memory.h +@@ -3,7 +3,7 @@ + + #if defined (__code_model_large__) + #define GRUB_EFI_MAX_USABLE_ADDRESS __UINTPTR_MAX__ +-#define GRUB_EFI_MAX_ALLOCATION_ADDRESS 0x7fffffff ++#define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS + #else + #define GRUB_EFI_MAX_USABLE_ADDRESS 0x7fffffff + #define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS diff --git a/grub.patches b/grub.patches index fae414f3..9abbf109 100644 --- a/grub.patches +++ b/grub.patches @@ -299,3 +299,4 @@ Patch0298: 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch Patch0299: 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch Patch0300: 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch Patch0301: 0301-Correction-in-vector-5-values.patch +Patch0302: 0302-Allow-internal-grub-allocations-over-4GB.patch diff --git a/grub2.spec b/grub2.spec index d06732d3..19936587 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 72%{?dist} +Release: 73%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jan 10 2023 Robbie Harwood - 2.06-73 +- Allow internal grub allocations over 4GB + * Wed Dec 21 2022 Robbie Harwood - 2.06-72 - Fix prefix setting with memdisk creation for network boot From b84b21f7a2fec8c95a6f40ddb40007deab799813 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 11 Jan 2023 15:40:17 +0000 Subject: [PATCH 170/294] Apply more hardening to host binaries Signed-off-by: Robbie Harwood --- grub.macros | 4 ++-- grub2.spec | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/grub.macros b/grub.macros index 9591ff00..63f63c99 100644 --- a/grub.macros +++ b/grub.macros @@ -32,10 +32,10 @@ -e 's/^/ -fno-strict-aliasing /' \\\ %{nil} -%global host_cflags %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})} +%global host_cflags %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})} -fstack-protector-strong -fcf-protection %global legacy_host_cflags \\\ %{expand:%%(echo %{host_cflags} | \\\ - %{cflags_sed} \\\ + sed \\\ -e 's/-m64//g' \\\ -e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\ )} diff --git a/grub2.spec b/grub2.spec index 19936587..d5965df2 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 73%{?dist} +Release: 74%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Jan 11 2023 Robbie Harwood - 2.06-74 +- Apply more hardening to host binaries + * Tue Jan 10 2023 Robbie Harwood - 2.06-73 - Allow internal grub allocations over 4GB From 217ae25d887e4842d9518962d412078c243b5066 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 11 Jan 2023 11:00:47 -0500 Subject: [PATCH 171/294] Fix previous commit for non-x64 Signed-off-by: Robbie Harwood --- grub.macros | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index 63f63c99..af3d0e55 100644 --- a/grub.macros +++ b/grub.macros @@ -32,7 +32,12 @@ -e 's/^/ -fno-strict-aliasing /' \\\ %{nil} -%global host_cflags %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})} -fstack-protector-strong -fcf-protection +%global host_cflags_ %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})} -fstack-protector-strong +%ifarch x86_64 +%global host_cflags %{host_cflags_} -fcf-protection +%else +%global host_cflags %{host_cflags_} +%endif %global legacy_host_cflags \\\ %{expand:%%(echo %{host_cflags} | \\\ sed \\\ From 7be2bf00c3aa7f7610ad092dec1569202a1e00e6 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 11 Jan 2023 18:57:23 +0000 Subject: [PATCH 172/294] Pull allocator improvements from upstream Signed-off-by: Robbie Harwood --- ...w-internal-grub-allocations-over-4GB.patch | 105 --------- 0302-mm-Clarify-grub_real_malloc.patch | 183 ++++++++++++++++ ...loc-Make-small-allocs-comment-match-.patch | 32 +++ 0304-mm-Document-grub_free.patch | 120 +++++++++++ 0305-mm-Document-grub_mm_init_region.patch | 73 +++++++ ...-internal-memory-management-structur.patch | 78 +++++++ ...e-preserve-header-vs-region-alignmen.patch | 56 +++++ ...-region-merge-with-region-after-as-w.patch | 203 ++++++++++++++++++ ...-Debug-support-for-region-operations.patch | 71 ++++++ ...p-unused-unloading-of-modules-on-OOM.patch | 80 +++++++ ...ally-requesting-additional-memory-re.patch | 130 +++++++++++ ...ys-request-a-fixed-number-of-pages-o.patch | 103 +++++++++ ...tract-function-to-add-memory-regions.patch | 85 ++++++++ ...ss-up-errors-from-add_memory_regions.patch | 87 ++++++++ ...-Implement-runtime-addition-of-pages.patch | 75 +++++++ ...-default-memory-allocation-to-32-MiB.patch | 31 +++ ...e-disk-caches-last-when-out-of-memor.patch | 57 +++++ grub.patches | 17 +- grub2.spec | 5 +- 19 files changed, 1484 insertions(+), 107 deletions(-) delete mode 100644 0302-Allow-internal-grub-allocations-over-4GB.patch create mode 100644 0302-mm-Clarify-grub_real_malloc.patch create mode 100644 0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch create mode 100644 0304-mm-Document-grub_free.patch create mode 100644 0305-mm-Document-grub_mm_init_region.patch create mode 100644 0306-mm-Document-GRUB-internal-memory-management-structur.patch create mode 100644 0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch create mode 100644 0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch create mode 100644 0309-mm-Debug-support-for-region-operations.patch create mode 100644 0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch create mode 100644 0311-mm-Allow-dynamically-requesting-additional-memory-re.patch create mode 100644 0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch create mode 100644 0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch create mode 100644 0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch create mode 100644 0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch create mode 100644 0316-efi-Increase-default-memory-allocation-to-32-MiB.patch create mode 100644 0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch diff --git a/0302-Allow-internal-grub-allocations-over-4GB.patch b/0302-Allow-internal-grub-allocations-over-4GB.patch deleted file mode 100644 index 9c97dfcc..00000000 --- a/0302-Allow-internal-grub-allocations-over-4GB.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Julian Andres Klode -Date: Tue, 6 Dec 2022 15:29:13 +0100 -Subject: [PATCH] Allow internal grub allocations over 4GB - -Previous commits introduced support for loading kernel and -initrd over 4GB if necessary, but only for the actual loading. - -Grub also needs to load large initrds into memory as part of -the verifiers framework. - -Increase the maximum allocation limit to the maximum usable -address, and at the same time, to preserve existing behavior, -define a 4G limit that behaves like the old one. - -Signed-off-by: Julian Andres Klode -(cherry picked from commit cf6516128ea03294156fc59a50ce90856bd3ebd2) ---- - grub-core/loader/i386/efi/linux.c | 20 +++++++++++--------- - include/grub/x86_64/efi/memory.h | 2 +- - 2 files changed, 12 insertions(+), 10 deletions(-) - -diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 9854b0defa..0cc1c0d9a5 100644 ---- a/grub-core/loader/i386/efi/linux.c -+++ b/grub-core/loader/i386/efi/linux.c -@@ -31,6 +31,8 @@ - #include - #include - -+#define GRUB_EFI_4G_ALLOCATION_ADDRESS 0x7fffffff -+ - GRUB_MOD_LICENSE ("GPLv3+"); - - static grub_dl_t my_mod; -@@ -79,17 +81,17 @@ static struct allocation_choice max_addresses[] = - /* the kernel overrides this one with pref_address and - * GRUB_EFI_ALLOCATE_ADDRESS */ - [KERNEL_PREF_ADDRESS] = -- { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, -+ { KERNEL_MEM, GRUB_EFI_4G_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, - /* If the flag in params is set, this one gets changed to be above 4GB. */ - [KERNEL_4G_LIMIT] = -- { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, -+ { KERNEL_MEM, GRUB_EFI_4G_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, - /* this one is always below 4GB, which we still *prefer* even if the flag - * is set. */ - [KERNEL_NO_LIMIT] = -- { KERNEL_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, -+ { KERNEL_MEM, GRUB_EFI_4G_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, - /* this is for the initrd */ - [INITRD_MAX_ADDRESS] = -- { INITRD_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, -+ { INITRD_MEM, GRUB_EFI_4G_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS }, - { NO_MEM, 0, 0 } - }; - static struct allocation_choice saved_addresses[sizeof(max_addresses) / sizeof(max_addresses[0])]; -@@ -190,7 +192,7 @@ grub_linuxefi_unload (void *data) - cmd_initrdefi->data = 0; - grub_free (context); - -- max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; -+ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_4G_ALLOCATION_ADDRESS; - - return GRUB_ERR_NONE; - } -@@ -506,13 +508,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - */ - save_addresses(); - grub_dprintf ("linux", "lh->pref_address: %p\n", (void *)(grub_addr_t)lh->pref_address); -- if (lh->pref_address < (grub_uint64_t)GRUB_EFI_MAX_ALLOCATION_ADDRESS) -+ if (lh->pref_address < (grub_uint64_t)GRUB_EFI_4G_ALLOCATION_ADDRESS) - { - max_addresses[KERNEL_PREF_ADDRESS].addr = lh->pref_address; - max_addresses[KERNEL_PREF_ADDRESS].alloc_type = GRUB_EFI_ALLOCATE_ADDRESS; - } -- max_addresses[KERNEL_4G_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; -- max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; -+ max_addresses[KERNEL_4G_LIMIT].addr = GRUB_EFI_4G_ALLOCATION_ADDRESS; -+ max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_4G_ALLOCATION_ADDRESS; - kernel_size = lh->init_size; - grub_dprintf ("linux", "Trying to allocate kernel mem\n"); - kernel_mem = kernel_alloc (KERNEL_MEM, kernel_size, -@@ -564,7 +566,7 @@ fail: - - grub_dl_unref (my_mod); - -- max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; -+ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_4G_ALLOCATION_ADDRESS; - - if (lh) - kernel_free (cmdline, lh->cmdline_size + 1); -diff --git a/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h -index e81cfb3221..547e3f82f8 100644 ---- a/include/grub/x86_64/efi/memory.h -+++ b/include/grub/x86_64/efi/memory.h -@@ -3,7 +3,7 @@ - - #if defined (__code_model_large__) - #define GRUB_EFI_MAX_USABLE_ADDRESS __UINTPTR_MAX__ --#define GRUB_EFI_MAX_ALLOCATION_ADDRESS 0x7fffffff -+#define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS - #else - #define GRUB_EFI_MAX_USABLE_ADDRESS 0x7fffffff - #define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS diff --git a/0302-mm-Clarify-grub_real_malloc.patch b/0302-mm-Clarify-grub_real_malloc.patch new file mode 100644 index 00000000..0a99c081 --- /dev/null +++ b/0302-mm-Clarify-grub_real_malloc.patch @@ -0,0 +1,183 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 25 Nov 2021 02:22:46 +1100 +Subject: [PATCH] mm: Clarify grub_real_malloc() + +When iterating through the singly linked list of free blocks, +grub_real_malloc() uses p and q for the current and previous blocks +respectively. This isn't super clear, so swap to using prev and cur. + +This makes another quirk more obvious. The comment at the top of +grub_real_malloc() might lead you to believe that the function will +allocate from *first if there is space in that block. + +It actually doesn't do that, and it can't do that with the current +data structures. If we used up all of *first, we would need to change +the ->next of the previous block to point to *first->next, but we +can't do that because it's a singly linked list and we don't have +access to *first's previous block. + +What grub_real_malloc() actually does is set *first to the initial +previous block, and *first->next is the block we try to allocate +from. That allows us to keep all the data structures consistent. + +Document that. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 246ad6a44c281bb13486ddea0a26bb661db73106) +--- + grub-core/kern/mm.c | 76 +++++++++++++++++++++++++++++------------------------ + 1 file changed, 41 insertions(+), 35 deletions(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index d8c8377578..fb20e93acf 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -178,13 +178,20 @@ grub_mm_init_region (void *addr, grub_size_t size) + } + + /* Allocate the number of units N with the alignment ALIGN from the ring +- buffer starting from *FIRST. ALIGN must be a power of two. Both N and +- ALIGN are in units of GRUB_MM_ALIGN. Return a non-NULL if successful, +- otherwise return NULL. */ ++ * buffer given in *FIRST. ALIGN must be a power of two. Both N and ++ * ALIGN are in units of GRUB_MM_ALIGN. Return a non-NULL if successful, ++ * otherwise return NULL. ++ * ++ * Note: because in certain circumstances we need to adjust the ->next ++ * pointer of the previous block, we iterate over the singly linked ++ * list with the pair (prev, cur). *FIRST is our initial previous, and ++ * *FIRST->next is our initial current pointer. So we will actually ++ * allocate from *FIRST->next first and *FIRST itself last. ++ */ + static void * + grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) + { +- grub_mm_header_t p, q; ++ grub_mm_header_t cur, prev; + + /* When everything is allocated side effect is that *first will have alloc + magic marked, meaning that there is no room in this region. */ +@@ -192,24 +199,24 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) + return 0; + + /* Try to search free slot for allocation in this memory region. */ +- for (q = *first, p = q->next; ; q = p, p = p->next) ++ for (prev = *first, cur = prev->next; ; prev = cur, cur = cur->next) + { + grub_off_t extra; + +- extra = ((grub_addr_t) (p + 1) >> GRUB_MM_ALIGN_LOG2) & (align - 1); ++ extra = ((grub_addr_t) (cur + 1) >> GRUB_MM_ALIGN_LOG2) & (align - 1); + if (extra) + extra = align - extra; + +- if (! p) ++ if (! cur) + grub_fatal ("null in the ring"); + +- if (p->magic != GRUB_MM_FREE_MAGIC) +- grub_fatal ("free magic is broken at %p: 0x%x", p, p->magic); ++ if (cur->magic != GRUB_MM_FREE_MAGIC) ++ grub_fatal ("free magic is broken at %p: 0x%x", cur, cur->magic); + +- if (p->size >= n + extra) ++ if (cur->size >= n + extra) + { +- extra += (p->size - extra - n) & (~(align - 1)); +- if (extra == 0 && p->size == n) ++ extra += (cur->size - extra - n) & (~(align - 1)); ++ if (extra == 0 && cur->size == n) + { + /* There is no special alignment requirement and memory block + is complete match. +@@ -222,9 +229,9 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) + | alloc, size=n | | + +---------------+ v + */ +- q->next = p->next; ++ prev->next = cur->next; + } +- else if (align == 1 || p->size == n + extra) ++ else if (align == 1 || cur->size == n + extra) + { + /* There might be alignment requirement, when taking it into + account memory block fits in. +@@ -241,23 +248,22 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) + | alloc, size=n | | + +---------------+ v + */ +- +- p->size -= n; +- p += p->size; ++ cur->size -= n; ++ cur += cur->size; + } + else if (extra == 0) + { + grub_mm_header_t r; + +- r = p + extra + n; ++ r = cur + extra + n; + r->magic = GRUB_MM_FREE_MAGIC; +- r->size = p->size - extra - n; +- r->next = p->next; +- q->next = r; ++ r->size = cur->size - extra - n; ++ r->next = cur->next; ++ prev->next = r; + +- if (q == p) ++ if (prev == cur) + { +- q = r; ++ prev = r; + r->next = r; + } + } +@@ -284,32 +290,32 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) + */ + grub_mm_header_t r; + +- r = p + extra + n; ++ r = cur + extra + n; + r->magic = GRUB_MM_FREE_MAGIC; +- r->size = p->size - extra - n; +- r->next = p; ++ r->size = cur->size - extra - n; ++ r->next = cur; + +- p->size = extra; +- q->next = r; +- p += extra; ++ cur->size = extra; ++ prev->next = r; ++ cur += extra; + } + +- p->magic = GRUB_MM_ALLOC_MAGIC; +- p->size = n; ++ cur->magic = GRUB_MM_ALLOC_MAGIC; ++ cur->size = n; + + /* Mark find as a start marker for next allocation to fasten it. + This will have side effect of fragmenting memory as small + pieces before this will be un-used. */ + /* So do it only for chunks under 64K. */ + if (n < (0x8000 >> GRUB_MM_ALIGN_LOG2) +- || *first == p) +- *first = q; ++ || *first == cur) ++ *first = prev; + +- return p + 1; ++ return cur + 1; + } + + /* Search was completed without result. */ +- if (p == *first) ++ if (cur == *first) + break; + } + diff --git a/0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch b/0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch new file mode 100644 index 00000000..a5601c92 --- /dev/null +++ b/0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 25 Nov 2021 02:22:47 +1100 +Subject: [PATCH] mm: grub_real_malloc(): Make small allocs comment match code + +Small allocations move the region's *first pointer. The comment +says that this happens for allocations under 64K. The code says +it's for allocations under 32K. Commit 45bf8b3a7549 changed the +code intentionally: make the comment match. + +Fixes: 45bf8b3a7549 (* grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the) + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit a847895a8d000bdf27ad4d4326f883a0eed769ca) +--- + grub-core/kern/mm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index fb20e93acf..db7e0b2a5b 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -306,7 +306,7 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) + /* Mark find as a start marker for next allocation to fasten it. + This will have side effect of fragmenting memory as small + pieces before this will be un-used. */ +- /* So do it only for chunks under 64K. */ ++ /* So do it only for chunks under 32K. */ + if (n < (0x8000 >> GRUB_MM_ALIGN_LOG2) + || *first == cur) + *first = prev; diff --git a/0304-mm-Document-grub_free.patch b/0304-mm-Document-grub_free.patch new file mode 100644 index 00000000..6c9b7cc6 --- /dev/null +++ b/0304-mm-Document-grub_free.patch @@ -0,0 +1,120 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 25 Nov 2021 02:22:48 +1100 +Subject: [PATCH] mm: Document grub_free() + +The grub_free() possesses a surprising number of quirks, and also +uses single-letter variable names confusingly to iterate through +the free list. + +Document what's going on. + +Use prev and cur to iterate over the free list. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 1f8d0b01738e49767d662d6426af3570a64565f0) +--- + grub-core/kern/mm.c | 63 ++++++++++++++++++++++++++++++++++------------------- + 1 file changed, 41 insertions(+), 22 deletions(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index db7e0b2a5b..0351171cf9 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -446,54 +446,73 @@ grub_free (void *ptr) + } + else + { +- grub_mm_header_t q, s; ++ grub_mm_header_t cur, prev; + + #if 0 +- q = r->first; ++ cur = r->first; + do + { + grub_printf ("%s:%d: q=%p, q->size=0x%x, q->magic=0x%x\n", +- GRUB_FILE, __LINE__, q, q->size, q->magic); +- q = q->next; ++ GRUB_FILE, __LINE__, cur, cur->size, cur->magic); ++ cur = cur->next; + } +- while (q != r->first); ++ while (cur != r->first); + #endif +- +- for (s = r->first, q = s->next; q <= p || q->next >= p; s = q, q = s->next) ++ /* Iterate over all blocks in the free ring. ++ * ++ * The free ring is arranged from high addresses to low ++ * addresses, modulo wraparound. ++ * ++ * We are looking for a block with a higher address than p or ++ * whose next address is lower than p. ++ */ ++ for (prev = r->first, cur = prev->next; cur <= p || cur->next >= p; ++ prev = cur, cur = prev->next) + { +- if (q->magic != GRUB_MM_FREE_MAGIC) +- grub_fatal ("free magic is broken at %p: 0x%x", q, q->magic); ++ if (cur->magic != GRUB_MM_FREE_MAGIC) ++ grub_fatal ("free magic is broken at %p: 0x%x", cur, cur->magic); + +- if (q <= q->next && (q > p || q->next < p)) ++ /* Deal with wrap-around */ ++ if (cur <= cur->next && (cur > p || cur->next < p)) + break; + } + ++ /* mark p as free and insert it between cur and cur->next */ + p->magic = GRUB_MM_FREE_MAGIC; +- p->next = q->next; +- q->next = p; ++ p->next = cur->next; ++ cur->next = p; + ++ /* ++ * If the block we are freeing can be merged with the next ++ * free block, do that. ++ */ + if (p->next + p->next->size == p) + { + p->magic = 0; + + p->next->size += p->size; +- q->next = p->next; ++ cur->next = p->next; + p = p->next; + } + +- r->first = q; ++ r->first = cur; + +- if (q == p + p->size) ++ /* Likewise if can be merged with the preceeding free block */ ++ if (cur == p + p->size) + { +- q->magic = 0; +- p->size += q->size; +- if (q == s) +- s = p; +- s->next = p; +- q = s; ++ cur->magic = 0; ++ p->size += cur->size; ++ if (cur == prev) ++ prev = p; ++ prev->next = p; ++ cur = prev; + } + +- r->first = q; ++ /* ++ * Set r->first such that the just free()d block is tried first. ++ * (An allocation is tried from *first->next, and cur->next == p.) ++ */ ++ r->first = cur; + } + } + diff --git a/0305-mm-Document-grub_mm_init_region.patch b/0305-mm-Document-grub_mm_init_region.patch new file mode 100644 index 00000000..0173f045 --- /dev/null +++ b/0305-mm-Document-grub_mm_init_region.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 25 Nov 2021 02:22:49 +1100 +Subject: [PATCH] mm: Document grub_mm_init_region() + +The grub_mm_init_region() does some things that seem magical, especially +around region merging. Make it a bit clearer. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 246d69b7ea619fc1e77dcc5960e37aea45a9808c) +--- + grub-core/kern/mm.c | 31 ++++++++++++++++++++++++++++++- + 1 file changed, 30 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index 0351171cf9..1cbf98c7ab 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -128,23 +128,52 @@ grub_mm_init_region (void *addr, grub_size_t size) + if (((grub_addr_t) addr + 0x1000) > ~(grub_addr_t) size) + size = ((grub_addr_t) -0x1000) - (grub_addr_t) addr; + ++ /* Attempt to merge this region with every existing region */ + for (p = &grub_mm_base, q = *p; q; p = &(q->next), q = *p) ++ /* ++ * Is the new region immediately below an existing region? That ++ * is, is the address of the memory we're adding now (addr) + size ++ * of the memory we're adding (size) + the bytes we couldn't use ++ * at the start of the region we're considering (q->pre_size) ++ * equal to the address of q? In other words, does the memory ++ * looks like this? ++ * ++ * addr q ++ * |----size-----|-q->pre_size-|| ++ */ + if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q) + { ++ /* ++ * Yes, we can merge the memory starting at addr into the ++ * existing region from below. Align up addr to GRUB_MM_ALIGN ++ * so that our new region has proper alignment. ++ */ + r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); ++ /* Copy the region data across */ + *r = *q; ++ /* Consider all the new size as pre-size */ + r->pre_size += size; +- ++ ++ /* ++ * If we have enough pre-size to create a block, create a ++ * block with it. Mark it as allocated and pass it to ++ * grub_free (), which will sort out getting it into the free ++ * list. ++ */ + if (r->pre_size >> GRUB_MM_ALIGN_LOG2) + { + h = (grub_mm_header_t) (r + 1); ++ /* block size is pre-size converted to cells */ + h->size = (r->pre_size >> GRUB_MM_ALIGN_LOG2); + h->magic = GRUB_MM_ALLOC_MAGIC; ++ /* region size grows by block size converted back to bytes */ + r->size += h->size << GRUB_MM_ALIGN_LOG2; ++ /* adjust pre_size to be accurate */ + r->pre_size &= (GRUB_MM_ALIGN - 1); + *p = r; + grub_free (h + 1); + } ++ /* Replace the old region with the new region */ + *p = r; + return; + } diff --git a/0306-mm-Document-GRUB-internal-memory-management-structur.patch b/0306-mm-Document-GRUB-internal-memory-management-structur.patch new file mode 100644 index 00000000..c7939264 --- /dev/null +++ b/0306-mm-Document-GRUB-internal-memory-management-structur.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 25 Nov 2021 02:22:45 +1100 +Subject: [PATCH] mm: Document GRUB internal memory management structures + +I spent more than a trivial quantity of time figuring out pre_size and +whether a memory region's size contains the header cell or not. + +Document the meanings of all the properties. Hopefully now no-one else +has to figure it out! + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit a6c5c52ccffd2674d43db25fb4baa9c528526aa0) +--- + include/grub/mm_private.h | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/include/grub/mm_private.h b/include/grub/mm_private.h +index c2c4cb1511..203533cc3d 100644 +--- a/include/grub/mm_private.h ++++ b/include/grub/mm_private.h +@@ -21,15 +21,27 @@ + + #include + ++/* For context, see kern/mm.c */ ++ + /* Magic words. */ + #define GRUB_MM_FREE_MAGIC 0x2d3c2808 + #define GRUB_MM_ALLOC_MAGIC 0x6db08fa4 + ++/* A header describing a block of memory - either allocated or free */ + typedef struct grub_mm_header + { ++ /* ++ * The 'next' free block in this region's circular free list. ++ * Only meaningful if the block is free. ++ */ + struct grub_mm_header *next; ++ /* The block size, not in bytes but the number of cells of ++ * GRUB_MM_ALIGN bytes. Includes the header cell. ++ */ + grub_size_t size; ++ /* either free or alloc magic, depending on the block type. */ + grub_size_t magic; ++ /* pad to cell size: see the top of kern/mm.c. */ + #if GRUB_CPU_SIZEOF_VOID_P == 4 + char padding[4]; + #elif GRUB_CPU_SIZEOF_VOID_P == 8 +@@ -48,11 +60,27 @@ typedef struct grub_mm_header + + #define GRUB_MM_ALIGN (1 << GRUB_MM_ALIGN_LOG2) + ++/* A region from which we can make allocations. */ + typedef struct grub_mm_region + { ++ /* The first free block in this region. */ + struct grub_mm_header *first; ++ ++ /* ++ * The next region in the linked list of regions. Regions are initially ++ * sorted in order of increasing size, but can grow, in which case the ++ * ordering may not be preserved. ++ */ + struct grub_mm_region *next; ++ ++ /* ++ * A grub_mm_region will always be aligned to cell size. The pre-size is ++ * the number of bytes we were given but had to skip in order to get that ++ * alignment. ++ */ + grub_size_t pre_size; ++ ++ /* How many bytes are in this region? (free and allocated) */ + grub_size_t size; + } + *grub_mm_region_t; diff --git a/0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch b/0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch new file mode 100644 index 00000000..2893784a --- /dev/null +++ b/0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 21 Apr 2022 15:24:14 +1000 +Subject: [PATCH] mm: Assert that we preserve header vs region alignment + +grub_mm_region_init() does: + + h = (grub_mm_header_t) (r + 1); + +where h is a grub_mm_header_t and r is a grub_mm_region_t. + +Cells are supposed to be GRUB_MM_ALIGN aligned, but while grub_mm_dump +ensures this vs the region header, grub_mm_region_init() does not. + +It's better to be explicit than implicit here: rather than changing +grub_mm_region_init() to ALIGN_UP(), require that the struct is +explicitly a multiple of the header size. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 1df8fe66c57087eb33bd6dc69f786ed124615aa7) +--- + include/grub/mm_private.h | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/include/grub/mm_private.h b/include/grub/mm_private.h +index 203533cc3d..a688b92a83 100644 +--- a/include/grub/mm_private.h ++++ b/include/grub/mm_private.h +@@ -20,6 +20,7 @@ + #define GRUB_MM_PRIVATE_H 1 + + #include ++#include + + /* For context, see kern/mm.c */ + +@@ -89,4 +90,17 @@ typedef struct grub_mm_region + extern grub_mm_region_t EXPORT_VAR (grub_mm_base); + #endif + ++static inline void ++grub_mm_size_sanity_check (void) { ++ /* Ensure we preserve alignment when doing h = (grub_mm_header_t) (r + 1). */ ++ COMPILE_TIME_ASSERT ((sizeof (struct grub_mm_region) % ++ sizeof (struct grub_mm_header)) == 0); ++ ++ /* ++ * GRUB_MM_ALIGN is supposed to represent cell size, and a mm_header is ++ * supposed to be 1 cell. ++ */ ++ COMPILE_TIME_ASSERT (sizeof (struct grub_mm_header) == GRUB_MM_ALIGN); ++} ++ + #endif diff --git a/0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch b/0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch new file mode 100644 index 00000000..52cfeee0 --- /dev/null +++ b/0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch @@ -0,0 +1,203 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 21 Apr 2022 15:24:15 +1000 +Subject: [PATCH] mm: When adding a region, merge with region after as well as + before + +On x86_64-efi (at least) regions seem to be added from top down. The mm +code will merge a new region with an existing region that comes +immediately before the new region. This allows larger allocations to be +satisfied that would otherwise be the case. + +On powerpc-ieee1275, however, regions are added from bottom up. So if +we add 3x 32MB regions, we can still only satisfy a 32MB allocation, +rather than the 96MB allocation we might otherwise be able to satisfy. + + * Define 'post_size' as being bytes lost to the end of an allocation + due to being given weird sizes from firmware that are not multiples + of GRUB_MM_ALIGN. + + * Allow merging of regions immediately _after_ existing regions, not + just before. As with the other approach, we create an allocated + block to represent the new space and the pass it to grub_free() to + get the metadata right. + +Signed-off-by: Daniel Axtens +Tested-by: Stefan Berger +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 052e6068be622ff53f1238b449c300dbd0a8abcd) +--- + grub-core/kern/mm.c | 128 +++++++++++++++++++++++++++++----------------- + include/grub/mm_private.h | 9 ++++ + 2 files changed, 91 insertions(+), 46 deletions(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index 1cbf98c7ab..7be33e23bf 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -130,53 +130,88 @@ grub_mm_init_region (void *addr, grub_size_t size) + + /* Attempt to merge this region with every existing region */ + for (p = &grub_mm_base, q = *p; q; p = &(q->next), q = *p) +- /* +- * Is the new region immediately below an existing region? That +- * is, is the address of the memory we're adding now (addr) + size +- * of the memory we're adding (size) + the bytes we couldn't use +- * at the start of the region we're considering (q->pre_size) +- * equal to the address of q? In other words, does the memory +- * looks like this? +- * +- * addr q +- * |----size-----|-q->pre_size-|| +- */ +- if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q) +- { +- /* +- * Yes, we can merge the memory starting at addr into the +- * existing region from below. Align up addr to GRUB_MM_ALIGN +- * so that our new region has proper alignment. +- */ +- r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); +- /* Copy the region data across */ +- *r = *q; +- /* Consider all the new size as pre-size */ +- r->pre_size += size; ++ { ++ /* ++ * Is the new region immediately below an existing region? That ++ * is, is the address of the memory we're adding now (addr) + size ++ * of the memory we're adding (size) + the bytes we couldn't use ++ * at the start of the region we're considering (q->pre_size) ++ * equal to the address of q? In other words, does the memory ++ * looks like this? ++ * ++ * addr q ++ * |----size-----|-q->pre_size-|| ++ */ ++ if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q) ++ { ++ /* ++ * Yes, we can merge the memory starting at addr into the ++ * existing region from below. Align up addr to GRUB_MM_ALIGN ++ * so that our new region has proper alignment. ++ */ ++ r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); ++ /* Copy the region data across */ ++ *r = *q; ++ /* Consider all the new size as pre-size */ ++ r->pre_size += size; + +- /* +- * If we have enough pre-size to create a block, create a +- * block with it. Mark it as allocated and pass it to +- * grub_free (), which will sort out getting it into the free +- * list. +- */ +- if (r->pre_size >> GRUB_MM_ALIGN_LOG2) +- { +- h = (grub_mm_header_t) (r + 1); +- /* block size is pre-size converted to cells */ +- h->size = (r->pre_size >> GRUB_MM_ALIGN_LOG2); +- h->magic = GRUB_MM_ALLOC_MAGIC; +- /* region size grows by block size converted back to bytes */ +- r->size += h->size << GRUB_MM_ALIGN_LOG2; +- /* adjust pre_size to be accurate */ +- r->pre_size &= (GRUB_MM_ALIGN - 1); +- *p = r; +- grub_free (h + 1); +- } +- /* Replace the old region with the new region */ +- *p = r; +- return; +- } ++ /* ++ * If we have enough pre-size to create a block, create a ++ * block with it. Mark it as allocated and pass it to ++ * grub_free (), which will sort out getting it into the free ++ * list. ++ */ ++ if (r->pre_size >> GRUB_MM_ALIGN_LOG2) ++ { ++ h = (grub_mm_header_t) (r + 1); ++ /* block size is pre-size converted to cells */ ++ h->size = (r->pre_size >> GRUB_MM_ALIGN_LOG2); ++ h->magic = GRUB_MM_ALLOC_MAGIC; ++ /* region size grows by block size converted back to bytes */ ++ r->size += h->size << GRUB_MM_ALIGN_LOG2; ++ /* adjust pre_size to be accurate */ ++ r->pre_size &= (GRUB_MM_ALIGN - 1); ++ *p = r; ++ grub_free (h + 1); ++ } ++ /* Replace the old region with the new region */ ++ *p = r; ++ return; ++ } ++ ++ /* ++ * Is the new region immediately above an existing region? That ++ * is: ++ * q addr ++ * ||-q->post_size-|----size-----| ++ */ ++ if ((grub_uint8_t *) q + sizeof (*q) + q->size + q->post_size == ++ (grub_uint8_t *) addr) ++ { ++ /* ++ * Yes! Follow a similar pattern to above, but simpler. ++ * Our header starts at address - post_size, which should align us ++ * to a cell boundary. ++ * ++ * Cast to (void *) first to avoid the following build error: ++ * kern/mm.c: In function ‘grub_mm_init_region’: ++ * kern/mm.c:211:15: error: cast increases required alignment of target type [-Werror=cast-align] ++ * 211 | h = (grub_mm_header_t) ((grub_uint8_t *) addr - q->post_size); ++ * | ^ ++ * It is safe to do that because proper alignment is enforced in grub_mm_size_sanity_check(). ++ */ ++ h = (grub_mm_header_t)(void *) ((grub_uint8_t *) addr - q->post_size); ++ /* our size is the allocated size plus post_size, in cells */ ++ h->size = (size + q->post_size) >> GRUB_MM_ALIGN_LOG2; ++ h->magic = GRUB_MM_ALLOC_MAGIC; ++ /* region size grows by block size converted back to bytes */ ++ q->size += h->size << GRUB_MM_ALIGN_LOG2; ++ /* adjust new post_size to be accurate */ ++ q->post_size = (q->post_size + size) & (GRUB_MM_ALIGN - 1); ++ grub_free (h + 1); ++ return; ++ } ++ } + + /* Allocate a region from the head. */ + r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); +@@ -195,6 +230,7 @@ grub_mm_init_region (void *addr, grub_size_t size) + r->first = h; + r->pre_size = (grub_addr_t) r - (grub_addr_t) addr; + r->size = (h->size << GRUB_MM_ALIGN_LOG2); ++ r->post_size = size - r->size; + + /* Find where to insert this region. Put a smaller one before bigger ones, + to prevent fragmentation. */ +diff --git a/include/grub/mm_private.h b/include/grub/mm_private.h +index a688b92a83..96c2d816be 100644 +--- a/include/grub/mm_private.h ++++ b/include/grub/mm_private.h +@@ -81,8 +81,17 @@ typedef struct grub_mm_region + */ + grub_size_t pre_size; + ++ /* ++ * Likewise, the post-size is the number of bytes we wasted at the end ++ * of the allocation because it wasn't a multiple of GRUB_MM_ALIGN ++ */ ++ grub_size_t post_size; ++ + /* How many bytes are in this region? (free and allocated) */ + grub_size_t size; ++ ++ /* pad to a multiple of cell size */ ++ char padding[3 * GRUB_CPU_SIZEOF_VOID_P]; + } + *grub_mm_region_t; + diff --git a/0309-mm-Debug-support-for-region-operations.patch b/0309-mm-Debug-support-for-region-operations.patch new file mode 100644 index 00000000..f434260f --- /dev/null +++ b/0309-mm-Debug-support-for-region-operations.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Thu, 21 Apr 2022 15:24:16 +1000 +Subject: [PATCH] mm: Debug support for region operations + +This is handy for debugging. Enable with "set debug=regions". + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 8afa5ef45b797ba5d8147ceee85ac2c59dcc7f09) +--- + grub-core/kern/mm.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index 7be33e23bf..38bfb01df9 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -115,9 +115,8 @@ grub_mm_init_region (void *addr, grub_size_t size) + grub_mm_header_t h; + grub_mm_region_t r, *p, q; + +-#if 0 +- grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size); +-#endif ++ grub_dprintf ("regions", "Using memory for heap: start=%p, end=%p\n", ++ addr, (char *) addr + (unsigned int) size); + + /* Exclude last 4K to avoid overflows. */ + /* If addr + 0x1000 overflows then whole region is in excluded zone. */ +@@ -142,8 +141,14 @@ grub_mm_init_region (void *addr, grub_size_t size) + * addr q + * |----size-----|-q->pre_size-|| + */ ++ grub_dprintf ("regions", "Can we extend into region above?" ++ " %p + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " ?=? %p\n", ++ (grub_uint8_t *) addr, size, q->pre_size, (grub_uint8_t *) q); + if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q) + { ++ grub_dprintf ("regions", "Yes: extending a region: (%p -> %p) -> (%p -> %p)\n", ++ q, (grub_uint8_t *) q + sizeof (*q) + q->size, ++ addr, (grub_uint8_t *) q + sizeof (*q) + q->size); + /* + * Yes, we can merge the memory starting at addr into the + * existing region from below. Align up addr to GRUB_MM_ALIGN +@@ -185,9 +190,15 @@ grub_mm_init_region (void *addr, grub_size_t size) + * q addr + * ||-q->post_size-|----size-----| + */ ++ grub_dprintf ("regions", "Can we extend into region below?" ++ " %p + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " ?=? %p\n", ++ (grub_uint8_t *) q, sizeof(*q), q->size, q->post_size, (grub_uint8_t *) addr); + if ((grub_uint8_t *) q + sizeof (*q) + q->size + q->post_size == + (grub_uint8_t *) addr) + { ++ grub_dprintf ("regions", "Yes: extending a region: (%p -> %p) -> (%p -> %p)\n", ++ q, (grub_uint8_t *) q + sizeof (*q) + q->size, ++ q, (grub_uint8_t *) addr + size); + /* + * Yes! Follow a similar pattern to above, but simpler. + * Our header starts at address - post_size, which should align us +@@ -213,6 +224,8 @@ grub_mm_init_region (void *addr, grub_size_t size) + } + } + ++ grub_dprintf ("regions", "No: considering a new region at %p of size %" PRIxGRUB_SIZE "\n", ++ addr, size); + /* Allocate a region from the head. */ + r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); + diff --git a/0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch b/0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch new file mode 100644 index 00000000..a18d9122 --- /dev/null +++ b/0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Steinhardt +Date: Thu, 21 Apr 2022 15:24:17 +1000 +Subject: [PATCH] mm: Drop unused unloading of modules on OOM + +In grub_memalign(), there's a commented section which would allow for +unloading of unneeded modules in case where there is not enough free +memory available to satisfy a request. Given that this code is never +compiled in, let's remove it together with grub_dl_unload_unneeded(). + +Signed-off-by: Patrick Steinhardt +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 139fd9b134a01e0b5fe0ebefafa7f48d1ffb6d60) +--- + grub-core/kern/dl.c | 20 -------------------- + grub-core/kern/mm.c | 8 -------- + include/grub/dl.h | 1 - + 3 files changed, 29 deletions(-) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index d5de80186f..ab9101a5ad 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -998,23 +998,3 @@ grub_dl_unload (grub_dl_t mod) + grub_free (mod); + return 1; + } +- +-/* Unload unneeded modules. */ +-void +-grub_dl_unload_unneeded (void) +-{ +- /* Because grub_dl_remove modifies the list of modules, this +- implementation is tricky. */ +- grub_dl_t p = grub_dl_head; +- +- while (p) +- { +- if (grub_dl_unload (p)) +- { +- p = grub_dl_head; +- continue; +- } +- +- p = p->next; +- } +-} +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index 38bfb01df9..1825dc8289 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -444,14 +444,6 @@ grub_memalign (grub_size_t align, grub_size_t size) + count++; + goto again; + +-#if 0 +- case 1: +- /* Unload unneeded modules. */ +- grub_dl_unload_unneeded (); +- count++; +- goto again; +-#endif +- + default: + break; + } +diff --git a/include/grub/dl.h b/include/grub/dl.h +index 45ac8e339f..6bc2560bf0 100644 +--- a/include/grub/dl.h ++++ b/include/grub/dl.h +@@ -206,7 +206,6 @@ grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name); + grub_dl_t grub_dl_load_core (void *addr, grub_size_t size); + grub_dl_t EXPORT_FUNC(grub_dl_load_core_noinit) (void *addr, grub_size_t size); + int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod); +-extern void grub_dl_unload_unneeded (void); + extern int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); + extern int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); + extern int EXPORT_FUNC(grub_dl_ref_count) (grub_dl_t mod); diff --git a/0311-mm-Allow-dynamically-requesting-additional-memory-re.patch b/0311-mm-Allow-dynamically-requesting-additional-memory-re.patch new file mode 100644 index 00000000..d225c108 --- /dev/null +++ b/0311-mm-Allow-dynamically-requesting-additional-memory-re.patch @@ -0,0 +1,130 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Steinhardt +Date: Thu, 21 Apr 2022 15:24:18 +1000 +Subject: [PATCH] mm: Allow dynamically requesting additional memory regions + +Currently, all platforms will set up their heap on initialization of the +platform code. While this works mostly fine, it poses some limitations +on memory management on us. Most notably, allocating big chunks of +memory in the gigabyte range would require us to pre-request this many +bytes from the firmware and add it to the heap from the beginning on +some platforms like EFI. As this isn't needed for most configurations, +it is inefficient and may even negatively impact some usecases when, +e.g., chainloading. Nonetheless, allocating big chunks of memory is +required sometimes, where one example is the upcoming support for the +Argon2 key derival function in LUKS2. + +In order to avoid pre-allocating big chunks of memory, this commit +implements a runtime mechanism to add more pages to the system. When +a given allocation cannot be currently satisfied, we'll call a given +callback set up by the platform's own memory management subsystem, +asking it to add a memory area with at least "n" bytes. If this +succeeds, we retry searching for a valid memory region, which should +now succeed. + +If this fails, we try asking for "n" bytes, possibly spread across +multiple regions, in hopes that region merging means that we end up +with enough memory for things to work out. + +Signed-off-by: Patrick Steinhardt +Signed-off-by: Daniel Axtens +Tested-by: Stefan Berger +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 887f98f0db43e33fba4ec1f85e42fae1185700bc) +--- + grub-core/kern/mm.c | 30 ++++++++++++++++++++++++++++++ + include/grub/mm.h | 18 ++++++++++++++++++ + 2 files changed, 48 insertions(+) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index 1825dc8289..f2e27f263b 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -28,6 +28,9 @@ + - multiple regions may be used as free space. They may not be + contiguous. + ++ - if existing regions are insufficient to satisfy an allocation, a new ++ region can be requested from firmware. ++ + Regions are managed by a singly linked list, and the meta information is + stored in the beginning of each region. Space after the meta information + is used to allocate memory. +@@ -81,6 +84,7 @@ + + + grub_mm_region_t grub_mm_base; ++grub_mm_add_region_func_t grub_mm_add_region_fn; + + /* Get a header from the pointer PTR, and set *P and *R to a pointer + to the header and a pointer to its region, respectively. PTR must +@@ -444,6 +448,32 @@ grub_memalign (grub_size_t align, grub_size_t size) + count++; + goto again; + ++ case 1: ++ /* Request additional pages, contiguous */ ++ count++; ++ ++ if (grub_mm_add_region_fn != NULL && ++ grub_mm_add_region_fn (size, GRUB_MM_ADD_REGION_CONSECUTIVE) == GRUB_ERR_NONE) ++ goto again; ++ ++ /* fallthrough */ ++ ++ case 2: ++ /* Request additional pages, anything at all */ ++ count++; ++ ++ if (grub_mm_add_region_fn != NULL) ++ { ++ /* ++ * Try again even if this fails, in case it was able to partially ++ * satisfy the request ++ */ ++ grub_mm_add_region_fn (size, GRUB_MM_ADD_REGION_NONE); ++ goto again; ++ } ++ ++ /* fallthrough */ ++ + default: + break; + } +diff --git a/include/grub/mm.h b/include/grub/mm.h +index d81623d226..7c6f925ffd 100644 +--- a/include/grub/mm.h ++++ b/include/grub/mm.h +@@ -20,6 +20,7 @@ + #ifndef GRUB_MM_H + #define GRUB_MM_H 1 + ++#include + #include + #include + #include +@@ -29,6 +30,23 @@ + # define NULL ((void *) 0) + #endif + ++#define GRUB_MM_ADD_REGION_NONE 0 ++#define GRUB_MM_ADD_REGION_CONSECUTIVE (1 << 0) ++ ++/* ++ * Function used to request memory regions of `grub_size_t` bytes. The second ++ * parameter is a bitfield of `GRUB_MM_ADD_REGION` flags. ++ */ ++typedef grub_err_t (*grub_mm_add_region_func_t) (grub_size_t, unsigned int); ++ ++/* ++ * Set this function pointer to enable adding memory-regions at runtime in case ++ * a memory allocation cannot be satisfied with existing regions. ++ */ ++#ifndef GRUB_MACHINE_EMU ++extern grub_mm_add_region_func_t EXPORT_VAR(grub_mm_add_region_fn); ++#endif ++ + void grub_mm_init_region (void *addr, grub_size_t size); + void *EXPORT_FUNC(grub_calloc) (grub_size_t nmemb, grub_size_t size); + void *EXPORT_FUNC(grub_malloc) (grub_size_t size); diff --git a/0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch b/0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch new file mode 100644 index 00000000..6fa378c9 --- /dev/null +++ b/0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch @@ -0,0 +1,103 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Steinhardt +Date: Thu, 21 Apr 2022 15:24:19 +1000 +Subject: [PATCH] kern/efi/mm: Always request a fixed number of pages on init + +When initializing the EFI memory subsystem, we will by default request +a quarter of the available memory, bounded by a minimum/maximum value. +Given that we're about to extend the EFI memory system to dynamically +request additional pages from the firmware as required, this scaling of +requested memory based on available memory will not make a lot of sense +anymore. + +Remove this logic as a preparatory patch such that we'll instead defer +to the runtime memory allocator. Note that ideally, we'd want to change +this after dynamic requesting of pages has been implemented for the EFI +platform. But because we'll need to split up initialization of the +memory subsystem and the request of pages from the firmware, we'd have +to duplicate quite some logic at first only to remove it afterwards +again. This seems quite pointless, so we instead have patches slightly +out of order. + +Signed-off-by: Patrick Steinhardt +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 938c3760b8c0fca759140be48307179b50107ff6) +--- + grub-core/kern/efi/mm.c | 35 +++-------------------------------- + 1 file changed, 3 insertions(+), 32 deletions(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index e460b072e6..782a1365a1 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -38,9 +38,8 @@ + a multiplier of 4KB. */ + #define MEMORY_MAP_SIZE 0x3000 + +-/* The minimum and maximum heap size for GRUB itself. */ +-#define MIN_HEAP_SIZE 0x100000 +-#define MAX_HEAP_SIZE (1600 * 0x100000) ++/* The default heap size for GRUB itself in bytes. */ ++#define DEFAULT_HEAP_SIZE 0x100000 + + static void *finish_mmap_buf = 0; + static grub_efi_uintn_t finish_mmap_size = 0; +@@ -514,23 +513,6 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + return filtered_desc; + } + +-/* Return the total number of pages. */ +-static grub_efi_uint64_t +-get_total_pages (grub_efi_memory_descriptor_t *memory_map, +- grub_efi_uintn_t desc_size, +- grub_efi_memory_descriptor_t *memory_map_end) +-{ +- grub_efi_memory_descriptor_t *desc; +- grub_efi_uint64_t total = 0; +- +- for (desc = memory_map; +- desc < memory_map_end; +- desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) +- total += desc->num_pages; +- +- return total; +-} +- + /* Add memory regions. */ + static void + add_memory_regions (grub_efi_memory_descriptor_t *memory_map, +@@ -694,8 +676,6 @@ grub_efi_mm_init (void) + grub_efi_memory_descriptor_t *filtered_memory_map_end; + grub_efi_uintn_t map_size; + grub_efi_uintn_t desc_size; +- grub_efi_uint64_t total_pages; +- grub_efi_uint64_t required_pages; + int mm_status; + + grub_nx_init (); +@@ -737,22 +717,13 @@ grub_efi_mm_init (void) + filtered_memory_map_end = filter_memory_map (memory_map, filtered_memory_map, + desc_size, memory_map_end); + +- /* By default, request a quarter of the available memory. */ +- total_pages = get_total_pages (filtered_memory_map, desc_size, +- filtered_memory_map_end); +- required_pages = (total_pages >> 2); +- if (required_pages < BYTES_TO_PAGES (MIN_HEAP_SIZE)) +- required_pages = BYTES_TO_PAGES (MIN_HEAP_SIZE); +- else if (required_pages > BYTES_TO_PAGES (MAX_HEAP_SIZE)) +- required_pages = BYTES_TO_PAGES (MAX_HEAP_SIZE); +- + /* Sort the filtered descriptors, so that GRUB can allocate pages + from smaller regions. */ + sort_memory_map (filtered_memory_map, desc_size, filtered_memory_map_end); + + /* Allocate memory regions for GRUB's memory management. */ + add_memory_regions (filtered_memory_map, desc_size, +- filtered_memory_map_end, required_pages); ++ filtered_memory_map_end, BYTES_TO_PAGES (DEFAULT_HEAP_SIZE)); + + #if 0 + /* For debug. */ diff --git a/0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch b/0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch new file mode 100644 index 00000000..28cf2e75 --- /dev/null +++ b/0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch @@ -0,0 +1,85 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Steinhardt +Date: Thu, 21 Apr 2022 15:24:20 +1000 +Subject: [PATCH] kern/efi/mm: Extract function to add memory regions + +In preparation of support for runtime-allocating additional memory +region, this patch extracts the function to retrieve the EFI memory +map and add a subset of it to GRUB's own memory regions. + +Signed-off-by: Patrick Steinhardt +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 96a7ea29e3cb61b6c2302e260e8e6a6117e17fa3) +[rharwood: backport around our nx] +--- + grub-core/kern/efi/mm.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index 782a1365a1..a1d3b51fe6 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -667,8 +667,8 @@ grub_nx_init (void) + } + } + +-void +-grub_efi_mm_init (void) ++static grub_err_t ++grub_efi_mm_add_regions (grub_size_t required_bytes) + { + grub_efi_memory_descriptor_t *memory_map; + grub_efi_memory_descriptor_t *memory_map_end; +@@ -683,7 +683,7 @@ grub_efi_mm_init (void) + /* Prepare a memory region to store two memory maps. */ + memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); + if (! memory_map) +- grub_fatal ("cannot allocate memory"); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory for memory map"); + + /* Obtain descriptors for available memory. */ + map_size = MEMORY_MAP_SIZE; +@@ -701,14 +701,14 @@ grub_efi_mm_init (void) + + memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES (map_size)); + if (! memory_map) +- grub_fatal ("cannot allocate memory"); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory for new memory map"); + + mm_status = grub_efi_get_memory_map (&map_size, memory_map, 0, + &desc_size, 0); + } + + if (mm_status < 0) +- grub_fatal ("cannot get memory map"); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "error fetching memory map from EFI"); + + memory_map_end = NEXT_MEMORY_DESCRIPTOR (memory_map, map_size); + +@@ -723,7 +723,7 @@ grub_efi_mm_init (void) + + /* Allocate memory regions for GRUB's memory management. */ + add_memory_regions (filtered_memory_map, desc_size, +- filtered_memory_map_end, BYTES_TO_PAGES (DEFAULT_HEAP_SIZE)); ++ filtered_memory_map_end, BYTES_TO_PAGES (required_bytes)); + + #if 0 + /* For debug. */ +@@ -741,6 +741,15 @@ grub_efi_mm_init (void) + /* Release the memory maps. */ + grub_efi_free_pages ((grub_addr_t) memory_map, + 2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); ++ ++ return GRUB_ERR_NONE; ++} ++ ++void ++grub_efi_mm_init (void) ++{ ++ if (grub_efi_mm_add_regions (DEFAULT_HEAP_SIZE) != GRUB_ERR_NONE) ++ grub_fatal ("%s", grub_errmsg); + } + + #if defined (__aarch64__) || defined (__arm__) || defined (__riscv) diff --git a/0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch b/0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch new file mode 100644 index 00000000..b4b7891b --- /dev/null +++ b/0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch @@ -0,0 +1,87 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Steinhardt +Date: Thu, 21 Apr 2022 15:24:21 +1000 +Subject: [PATCH] kern/efi/mm: Pass up errors from add_memory_regions() + +The function add_memory_regions() is currently only called on system +initialization to allocate a fixed amount of pages. As such, it didn't +need to return any errors: in case it failed, we cannot proceed anyway. +This will change with the upcoming support for requesting more memory +from the firmware at runtime, where it doesn't make sense anymore to +fail hard. + +Refactor the function to return an error to prepare for this. Note that +this does not change the behaviour when initializing the memory system +because grub_efi_mm_init() knows to call grub_fatal() in case +grub_efi_mm_add_regions() returns an error. + +Signed-off-by: Patrick Steinhardt +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 15a015698921240adc1ac266a3b5bc5fcbd81521) +--- + grub-core/kern/efi/mm.c | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index a1d3b51fe6..e0ebc65dba 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -514,7 +514,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + } + + /* Add memory regions. */ +-static void ++static grub_err_t + add_memory_regions (grub_efi_memory_descriptor_t *memory_map, + grub_efi_uintn_t desc_size, + grub_efi_memory_descriptor_t *memory_map_end, +@@ -542,9 +542,9 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, + GRUB_EFI_ALLOCATE_ADDRESS, + GRUB_EFI_LOADER_CODE); + if (! addr) +- grub_fatal ("cannot allocate conventional memory %p with %u pages", +- (void *) ((grub_addr_t) start), +- (unsigned) pages); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "Memory starting at %p (%u pages) marked as free, but EFI would not allocate", ++ (void *) ((grub_addr_t) start), (unsigned) pages); + + grub_mm_init_region (addr, PAGES_TO_BYTES (pages)); + +@@ -554,7 +554,11 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, + } + + if (required_pages > 0) +- grub_fatal ("too little memory"); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, ++ "could not allocate all requested memory: %" PRIuGRUB_UINT64_T " pages still required after iterating EFI memory map", ++ required_pages); ++ ++ return GRUB_ERR_NONE; + } + + void +@@ -676,6 +680,7 @@ grub_efi_mm_add_regions (grub_size_t required_bytes) + grub_efi_memory_descriptor_t *filtered_memory_map_end; + grub_efi_uintn_t map_size; + grub_efi_uintn_t desc_size; ++ grub_err_t err; + int mm_status; + + grub_nx_init (); +@@ -722,8 +727,11 @@ grub_efi_mm_add_regions (grub_size_t required_bytes) + sort_memory_map (filtered_memory_map, desc_size, filtered_memory_map_end); + + /* Allocate memory regions for GRUB's memory management. */ +- add_memory_regions (filtered_memory_map, desc_size, +- filtered_memory_map_end, BYTES_TO_PAGES (required_bytes)); ++ err = add_memory_regions (filtered_memory_map, desc_size, ++ filtered_memory_map_end, ++ BYTES_TO_PAGES (required_bytes)); ++ if (err != GRUB_ERR_NONE) ++ return err; + + #if 0 + /* For debug. */ diff --git a/0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch b/0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch new file mode 100644 index 00000000..1f52581f --- /dev/null +++ b/0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Steinhardt +Date: Thu, 21 Apr 2022 15:24:22 +1000 +Subject: [PATCH] kern/efi/mm: Implement runtime addition of pages + +Adjust the interface of grub_efi_mm_add_regions() to take a set of +GRUB_MM_ADD_REGION_* flags, which most notably is currently only the +GRUB_MM_ADD_REGION_CONSECUTIVE flag. This allows us to set the function +up as callback for the memory subsystem and have it call out to us in +case there's not enough pages available in the current heap. + +Signed-off-by: Patrick Steinhardt +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +Tested-by: Patrick Steinhardt +(cherry picked from commit 1df2934822df4c1170dde069d97cfbf7a9572bba) +--- + grub-core/kern/efi/mm.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index e0ebc65dba..016ba6cf2f 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -518,7 +518,8 @@ static grub_err_t + add_memory_regions (grub_efi_memory_descriptor_t *memory_map, + grub_efi_uintn_t desc_size, + grub_efi_memory_descriptor_t *memory_map_end, +- grub_efi_uint64_t required_pages) ++ grub_efi_uint64_t required_pages, ++ unsigned int flags) + { + grub_efi_memory_descriptor_t *desc; + +@@ -532,6 +533,10 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, + + start = desc->physical_start; + pages = desc->num_pages; ++ ++ if (pages < required_pages && (flags & GRUB_MM_ADD_REGION_CONSECUTIVE)) ++ continue; ++ + if (pages > required_pages) + { + start += PAGES_TO_BYTES (pages - required_pages); +@@ -672,7 +677,7 @@ grub_nx_init (void) + } + + static grub_err_t +-grub_efi_mm_add_regions (grub_size_t required_bytes) ++grub_efi_mm_add_regions (grub_size_t required_bytes, unsigned int flags) + { + grub_efi_memory_descriptor_t *memory_map; + grub_efi_memory_descriptor_t *memory_map_end; +@@ -729,7 +734,8 @@ grub_efi_mm_add_regions (grub_size_t required_bytes) + /* Allocate memory regions for GRUB's memory management. */ + err = add_memory_regions (filtered_memory_map, desc_size, + filtered_memory_map_end, +- BYTES_TO_PAGES (required_bytes)); ++ BYTES_TO_PAGES (required_bytes), ++ flags); + if (err != GRUB_ERR_NONE) + return err; + +@@ -756,8 +762,9 @@ grub_efi_mm_add_regions (grub_size_t required_bytes) + void + grub_efi_mm_init (void) + { +- if (grub_efi_mm_add_regions (DEFAULT_HEAP_SIZE) != GRUB_ERR_NONE) ++ if (grub_efi_mm_add_regions (DEFAULT_HEAP_SIZE, GRUB_MM_ADD_REGION_NONE) != GRUB_ERR_NONE) + grub_fatal ("%s", grub_errmsg); ++ grub_mm_add_region_fn = grub_efi_mm_add_regions; + } + + #if defined (__aarch64__) || defined (__arm__) || defined (__riscv) diff --git a/0316-efi-Increase-default-memory-allocation-to-32-MiB.patch b/0316-efi-Increase-default-memory-allocation-to-32-MiB.patch new file mode 100644 index 00000000..b70c3cce --- /dev/null +++ b/0316-efi-Increase-default-memory-allocation-to-32-MiB.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Tue, 20 Sep 2022 00:30:30 +1000 +Subject: [PATCH] efi: Increase default memory allocation to 32 MiB + +We have multiple reports of things being slower with a 1 MiB initial static +allocation, and a report (more difficult to nail down) of a boot failure +as a result of the smaller initial allocation. + +Make the initial memory allocation 32 MiB. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 75e38e86e7d9202f050b093f20500d9ad4c6dad9) +--- + grub-core/kern/efi/mm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index 016ba6cf2f..b27e966e1f 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -39,7 +39,7 @@ + #define MEMORY_MAP_SIZE 0x3000 + + /* The default heap size for GRUB itself in bytes. */ +-#define DEFAULT_HEAP_SIZE 0x100000 ++#define DEFAULT_HEAP_SIZE 0x2000000 + + static void *finish_mmap_buf = 0; + static grub_efi_uintn_t finish_mmap_size = 0; diff --git a/0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch b/0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch new file mode 100644 index 00000000..c919891c --- /dev/null +++ b/0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Sat, 15 Oct 2022 22:15:11 +0800 +Subject: [PATCH] mm: Try invalidate disk caches last when out of memory + +Every heap grow will cause all disk caches invalidated which decreases +performance severely. This patch moves disk cache invalidation code to +the last of memory squeezing measures. So, disk caches are released only +when there are no other ways to get free memory. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +Reviewed-by: Patrick Steinhardt +(cherry picked from commit 17975d10a80e2457e5237f87fa58a7943031983e) +--- + grub-core/kern/mm.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index f2e27f263b..da1ac9427c 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -443,12 +443,6 @@ grub_memalign (grub_size_t align, grub_size_t size) + switch (count) + { + case 0: +- /* Invalidate disk caches. */ +- grub_disk_cache_invalidate_all (); +- count++; +- goto again; +- +- case 1: + /* Request additional pages, contiguous */ + count++; + +@@ -458,7 +452,7 @@ grub_memalign (grub_size_t align, grub_size_t size) + + /* fallthrough */ + +- case 2: ++ case 1: + /* Request additional pages, anything at all */ + count++; + +@@ -474,6 +468,12 @@ grub_memalign (grub_size_t align, grub_size_t size) + + /* fallthrough */ + ++ case 2: ++ /* Invalidate disk caches. */ ++ grub_disk_cache_invalidate_all (); ++ count++; ++ goto again; ++ + default: + break; + } diff --git a/grub.patches b/grub.patches index 9abbf109..7e4782a7 100644 --- a/grub.patches +++ b/grub.patches @@ -299,4 +299,19 @@ Patch0298: 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch Patch0299: 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch Patch0300: 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch Patch0301: 0301-Correction-in-vector-5-values.patch -Patch0302: 0302-Allow-internal-grub-allocations-over-4GB.patch +Patch0302: 0302-mm-Clarify-grub_real_malloc.patch +Patch0303: 0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch +Patch0304: 0304-mm-Document-grub_free.patch +Patch0305: 0305-mm-Document-grub_mm_init_region.patch +Patch0306: 0306-mm-Document-GRUB-internal-memory-management-structur.patch +Patch0307: 0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch +Patch0308: 0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch +Patch0309: 0309-mm-Debug-support-for-region-operations.patch +Patch0310: 0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch +Patch0311: 0311-mm-Allow-dynamically-requesting-additional-memory-re.patch +Patch0312: 0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch +Patch0313: 0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch +Patch0314: 0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch +Patch0315: 0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch +Patch0316: 0316-efi-Increase-default-memory-allocation-to-32-MiB.patch +Patch0317: 0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch diff --git a/grub2.spec b/grub2.spec index d5965df2..ac0c5586 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 74%{?dist} +Release: 75%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Jan 11 2023 Robbie Harwood - 2.06-75 +- Pull allocator improvements from upstream + * Wed Jan 11 2023 Robbie Harwood - 2.06-74 - Apply more hardening to host binaries From ac206cb17b137c788a13c7ea2b340851fa28f1c9 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 13 Jan 2023 20:28:48 +0000 Subject: [PATCH 173/294] ppc64le: fix issues using core.elf on boot media Signed-off-by: Robbie Harwood --- 0318-Skip-diskfilter-on-powerpc-CDs.patch | 58 +++++++++++++++++++ 0319-Fix-prefix-and-root-on-ppc64le-CDs.patch | 53 +++++++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 0318-Skip-diskfilter-on-powerpc-CDs.patch create mode 100644 0319-Fix-prefix-and-root-on-ppc64le-CDs.patch diff --git a/0318-Skip-diskfilter-on-powerpc-CDs.patch b/0318-Skip-diskfilter-on-powerpc-CDs.patch new file mode 100644 index 00000000..c983e903 --- /dev/null +++ b/0318-Skip-diskfilter-on-powerpc-CDs.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Thu, 12 Jan 2023 16:03:03 -0500 +Subject: [PATCH] Skip diskfilter on powerpc CDs + +Prior to this change, on ppc64le with part_msdos and the mdraid* modules +enabled, we see: + + disk/diskfilter.c:191: scanning ieee1275/cdrom + kern/disk.c:196: Opening `ieee1275/cdrom'... + disk/ieee1275/ofdisk.c:477: Opening `cdrom'. + disk/ieee1275/ofdisk.c:502: MAX_RETRIES set to 20 + kern/disk.c:288: Opening `ieee1275/cdrom' succeeded. + disk/diskfilter.c:136: Scanning for DISKFILTER devices on disk ieee1275/cdrom + partmap/msdos.c:184: partition 0: flag 0x80, type 0x96, start 0x0, len + 0x6a5d70 + disk/diskfilter.c:136: Scanning for DISKFILTER devices on disk ieee1275/cdrom + SCSI-DISK: Access beyond end of device ! + SCSI-DISK: Access beyond end of device ! + SCSI-DISK: Access beyond end of device ! + SCSI-DISK: Access beyond end of device ! + SCSI-DISK: Access beyond end of device ! + disk/ieee1275/ofdisk.c:578: MAX_RETRIES set to 20 + +These latter two lines repeat many times, eventually ending in: + + kern/disk.c:388: ieee1275/cdrom read failed + error: ../../grub-core/disk/ieee1275/ofdisk.c:608:failure reading sector + 0x1a9720 from `ieee1275/cdrom'. + +and the system drops to a "grub>" prompt. + +The firmware and the iso image appear to diagree on the blocksize (512 +vs. 2048), and the diskfilter RAID probing is too much for it. We won't +be seeing RAID on bootable CDs, so just turn it off. + +Signed-off-by: Robbie Harwood +(cherry picked from commit 35614da6ef0296d1a2d1583ae23822230c25a334) +--- + grub-core/disk/diskfilter.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c +index 7cdffe3ebd..f9140f7493 100644 +--- a/grub-core/disk/diskfilter.c ++++ b/grub-core/disk/diskfilter.c +@@ -133,6 +133,11 @@ scan_disk_partition_iter (grub_disk_t disk, grub_partition_t p, void *data) + struct grub_diskfilter_pv_id id; + grub_diskfilter_t diskfilter; + ++#ifdef __powerpc__ ++ if (!grub_strcmp (name, "ieee1275/cdrom")) ++ return 0; ++#endif ++ + grub_dprintf ("diskfilter", "Scanning for DISKFILTER devices on disk %s\n", + name); + #ifdef GRUB_UTIL diff --git a/0319-Fix-prefix-and-root-on-ppc64le-CDs.patch b/0319-Fix-prefix-and-root-on-ppc64le-CDs.patch new file mode 100644 index 00000000..e968e4bb --- /dev/null +++ b/0319-Fix-prefix-and-root-on-ppc64le-CDs.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Fri, 13 Jan 2023 12:36:29 -0500 +Subject: [PATCH] Fix prefix and root on ppc64le CDs + +CHRP requires grub at /boot/grub. On CDs, this means any other prefix +will be invalid. In particular, a distro grub might prefer /grub2 - but +prefix is hardcoded into the signed core.elf, and will always be wrong +here. + +Also work around a conflict between OF naming and that used by +part_msdos: on CDs, we always want the raw device. This fixes an issue +where grub would successfully load the menu from an image, but then +produce the error: + + error: ../../grub-core/net/net.c:1552:disk `ieee1275/cdrom,0' not found. + +and fail to boot further. + +Signed-off-by: Robbie Harwood +(cherry picked from commit 68e5981a5e808a32350aca4a2414717fa4605ca0) +--- + grub-core/kern/main.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index e94a2f78fb..ab06033534 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -278,6 +278,23 @@ grub_set_prefix_and_root (void) + } + + grub_env_set ("root", device); ++ ++#ifdef __powerpc__ ++ /* When booting from a CD, if part_msdos is enabled, grub will detect ++ and create access points starting at (ieee1275/cdrom,msdos1). ++ However, the device detection and OF name transformation will produce ++ a device named (ieee1275/cdrom,0) - i.e., missing the msdos and also ++ differently indexed. Furthermore, CHRP mandates boot/grub as prefix, ++ but our signed images are built with /grub2 to reflect installed ++ systems. Just ignore both messes. ++ */ ++ if (!grub_strncmp (device[0] == '(' ? device + 1 : device, ++ "ieee1275/cdrom", grub_strlen ("ieee1275/cdrom"))) ++ { ++ grub_env_set ("prefix", "/boot/grub"); ++ grub_env_set ("root", "ieee1275/cdrom"); ++ } ++#endif + } + + grub_free (device); diff --git a/grub.patches b/grub.patches index 7e4782a7..51a622fc 100644 --- a/grub.patches +++ b/grub.patches @@ -315,3 +315,5 @@ Patch0314: 0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch Patch0315: 0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch Patch0316: 0316-efi-Increase-default-memory-allocation-to-32-MiB.patch Patch0317: 0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch +Patch0318: 0318-Skip-diskfilter-on-powerpc-CDs.patch +Patch0319: 0319-Fix-prefix-and-root-on-ppc64le-CDs.patch diff --git a/grub2.spec b/grub2.spec index ac0c5586..088265a8 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 75%{?dist} +Release: 76%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Jan 13 2023 Robbie Harwood - 2.06-76 +- ppc64le: fix issues using core.elf on boot media + * Wed Jan 11 2023 Robbie Harwood - 2.06-75 - Pull allocator improvements from upstream From 3ce59ed7e124df0ecf8f51d7d2012d7acf59fef1 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 27 Jan 2023 18:59:45 +0000 Subject: [PATCH 174/294] ppc64le: update signed media fixes Signed-off-by: Robbie Harwood --- 0318-Skip-diskfilter-on-powerpc-CDs.patch | 58 ---------- 0318-ppc64le-signed-boot-media-changes.patch | 102 ++++++++++++++++++ 0319-Fix-prefix-and-root-on-ppc64le-CDs.patch | 53 --------- grub.macros | 2 +- grub.patches | 3 +- grub2.spec | 5 +- 6 files changed, 108 insertions(+), 115 deletions(-) delete mode 100644 0318-Skip-diskfilter-on-powerpc-CDs.patch create mode 100644 0318-ppc64le-signed-boot-media-changes.patch delete mode 100644 0319-Fix-prefix-and-root-on-ppc64le-CDs.patch diff --git a/0318-Skip-diskfilter-on-powerpc-CDs.patch b/0318-Skip-diskfilter-on-powerpc-CDs.patch deleted file mode 100644 index c983e903..00000000 --- a/0318-Skip-diskfilter-on-powerpc-CDs.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Thu, 12 Jan 2023 16:03:03 -0500 -Subject: [PATCH] Skip diskfilter on powerpc CDs - -Prior to this change, on ppc64le with part_msdos and the mdraid* modules -enabled, we see: - - disk/diskfilter.c:191: scanning ieee1275/cdrom - kern/disk.c:196: Opening `ieee1275/cdrom'... - disk/ieee1275/ofdisk.c:477: Opening `cdrom'. - disk/ieee1275/ofdisk.c:502: MAX_RETRIES set to 20 - kern/disk.c:288: Opening `ieee1275/cdrom' succeeded. - disk/diskfilter.c:136: Scanning for DISKFILTER devices on disk ieee1275/cdrom - partmap/msdos.c:184: partition 0: flag 0x80, type 0x96, start 0x0, len - 0x6a5d70 - disk/diskfilter.c:136: Scanning for DISKFILTER devices on disk ieee1275/cdrom - SCSI-DISK: Access beyond end of device ! - SCSI-DISK: Access beyond end of device ! - SCSI-DISK: Access beyond end of device ! - SCSI-DISK: Access beyond end of device ! - SCSI-DISK: Access beyond end of device ! - disk/ieee1275/ofdisk.c:578: MAX_RETRIES set to 20 - -These latter two lines repeat many times, eventually ending in: - - kern/disk.c:388: ieee1275/cdrom read failed - error: ../../grub-core/disk/ieee1275/ofdisk.c:608:failure reading sector - 0x1a9720 from `ieee1275/cdrom'. - -and the system drops to a "grub>" prompt. - -The firmware and the iso image appear to diagree on the blocksize (512 -vs. 2048), and the diskfilter RAID probing is too much for it. We won't -be seeing RAID on bootable CDs, so just turn it off. - -Signed-off-by: Robbie Harwood -(cherry picked from commit 35614da6ef0296d1a2d1583ae23822230c25a334) ---- - grub-core/disk/diskfilter.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 7cdffe3ebd..f9140f7493 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -133,6 +133,11 @@ scan_disk_partition_iter (grub_disk_t disk, grub_partition_t p, void *data) - struct grub_diskfilter_pv_id id; - grub_diskfilter_t diskfilter; - -+#ifdef __powerpc__ -+ if (!grub_strcmp (name, "ieee1275/cdrom")) -+ return 0; -+#endif -+ - grub_dprintf ("diskfilter", "Scanning for DISKFILTER devices on disk %s\n", - name); - #ifdef GRUB_UTIL diff --git a/0318-ppc64le-signed-boot-media-changes.patch b/0318-ppc64le-signed-boot-media-changes.patch new file mode 100644 index 00000000..835f7c96 --- /dev/null +++ b/0318-ppc64le-signed-boot-media-changes.patch @@ -0,0 +1,102 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 25 Jan 2023 16:10:58 -0500 +Subject: [PATCH] ppc64le: signed boot media changes + +Skip diskfilter on isos since mdraid* can't even + +Prior to this change, on ppc64le with part_msdos and the mdraid* modules +enabled, we see: + + disk/diskfilter.c:191: scanning ieee1275/cdrom + kern/disk.c:196: Opening `ieee1275/cdrom'... + disk/ieee1275/ofdisk.c:477: Opening `cdrom'. + disk/ieee1275/ofdisk.c:502: MAX_RETRIES set to 20 + kern/disk.c:288: Opening `ieee1275/cdrom' succeeded. + disk/diskfilter.c:136: Scanning for DISKFILTER devices on disk ieee1275/cdrom + partmap/msdos.c:184: partition 0: flag 0x80, type 0x96, start 0x0, len + 0x6a5d70 + disk/diskfilter.c:136: Scanning for DISKFILTER devices on disk ieee1275/cdrom + SCSI-DISK: Access beyond end of device ! + SCSI-DISK: Access beyond end of device ! + SCSI-DISK: Access beyond end of device ! + SCSI-DISK: Access beyond end of device ! + SCSI-DISK: Access beyond end of device ! + disk/ieee1275/ofdisk.c:578: MAX_RETRIES set to 20 + +These latter two lines repeat many times, eventually ending in: + + kern/disk.c:388: ieee1275/cdrom read failed + error: ../../grub-core/disk/ieee1275/ofdisk.c:608:failure reading sector + 0x1a9720 from `ieee1275/cdrom'. + +and the system drops to a "grub>" prompt. + +The firmware and the iso image appear to diagree on the blocksize (512 +vs. 2048), and the diskfilter RAID probing is too much for it. We won't +be seeing RAID on bootable CDs, so just turn it off. + +Fix detection of root. + +Try the chrp path as a fallback if the built prefix doesn't work. + +Signed-off-by: Robbie Harwood +--- + grub-core/disk/diskfilter.c | 6 ++++++ + grub-core/kern/ieee1275/openfw.c | 2 +- + grub-core/normal/main.c | 5 +++++ + 3 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c +index 7cdffe3ebd..27fbca903f 100644 +--- a/grub-core/disk/diskfilter.c ++++ b/grub-core/disk/diskfilter.c +@@ -139,6 +139,12 @@ scan_disk_partition_iter (grub_disk_t disk, grub_partition_t p, void *data) + grub_util_info ("Scanning for DISKFILTER devices on disk %s", name); + #endif + ++ if (p->parent == NULL || p->parent->len == 0) ++ { ++ grub_dprintf ("diskfilter", "skipping %s due to unknown parent partition length", name); ++ return 0; ++ } ++ + disk->partition = p; + + for (arr = array_list; arr != NULL; arr = arr->next) +diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c +index 3a6689abb1..0278054c61 100644 +--- a/grub-core/kern/ieee1275/openfw.c ++++ b/grub-core/kern/ieee1275/openfw.c +@@ -499,7 +499,7 @@ grub_ieee1275_encode_devname (const char *path) + *optr++ ='\\'; + *optr++ = *iptr++; + } +- if (partition && partition[0]) ++ if (partition && partition[0] >= '0' && partition[0] <= '9') + { + unsigned int partno = grub_strtoul (partition, 0, 0); + +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index 8f5fd81003..d59145f861 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -372,6 +372,7 @@ grub_try_normal_prefix (const char *prefix) + file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); + if (file) + { ++ grub_env_set ("prefix", prefix); + grub_file_close (file); + err = GRUB_ERR_NONE; + } +@@ -447,6 +448,10 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), + err = grub_try_normal ("fw_path"); + if (err == GRUB_ERR_FILE_NOT_FOUND) + err = grub_try_normal ("prefix"); ++#ifdef __powerpc__ ++ if (err == GRUB_ERR_FILE_NOT_FOUND) ++ err = grub_try_normal_prefix ("/boot/grub"); ++#endif + if (err == GRUB_ERR_FILE_NOT_FOUND) + err = grub_try_normal_discover (); + if (err == GRUB_ERR_FILE_NOT_FOUND) diff --git a/0319-Fix-prefix-and-root-on-ppc64le-CDs.patch b/0319-Fix-prefix-and-root-on-ppc64le-CDs.patch deleted file mode 100644 index e968e4bb..00000000 --- a/0319-Fix-prefix-and-root-on-ppc64le-CDs.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Fri, 13 Jan 2023 12:36:29 -0500 -Subject: [PATCH] Fix prefix and root on ppc64le CDs - -CHRP requires grub at /boot/grub. On CDs, this means any other prefix -will be invalid. In particular, a distro grub might prefer /grub2 - but -prefix is hardcoded into the signed core.elf, and will always be wrong -here. - -Also work around a conflict between OF naming and that used by -part_msdos: on CDs, we always want the raw device. This fixes an issue -where grub would successfully load the menu from an image, but then -produce the error: - - error: ../../grub-core/net/net.c:1552:disk `ieee1275/cdrom,0' not found. - -and fail to boot further. - -Signed-off-by: Robbie Harwood -(cherry picked from commit 68e5981a5e808a32350aca4a2414717fa4605ca0) ---- - grub-core/kern/main.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index e94a2f78fb..ab06033534 100644 ---- a/grub-core/kern/main.c -+++ b/grub-core/kern/main.c -@@ -278,6 +278,23 @@ grub_set_prefix_and_root (void) - } - - grub_env_set ("root", device); -+ -+#ifdef __powerpc__ -+ /* When booting from a CD, if part_msdos is enabled, grub will detect -+ and create access points starting at (ieee1275/cdrom,msdos1). -+ However, the device detection and OF name transformation will produce -+ a device named (ieee1275/cdrom,0) - i.e., missing the msdos and also -+ differently indexed. Furthermore, CHRP mandates boot/grub as prefix, -+ but our signed images are built with /grub2 to reflect installed -+ systems. Just ignore both messes. -+ */ -+ if (!grub_strncmp (device[0] == '(' ? device + 1 : device, -+ "ieee1275/cdrom", grub_strlen ("ieee1275/cdrom"))) -+ { -+ grub_env_set ("prefix", "/boot/grub"); -+ grub_env_set ("root", "ieee1275/cdrom"); -+ } -+#endif - } - - grub_free (device); diff --git a/grub.macros b/grub.macros index af3d0e55..344f5b20 100644 --- a/grub.macros +++ b/grub.macros @@ -23,7 +23,7 @@ -e 's/-fplugin=annobin//g' \\\ -e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]*,,g' \\\ -e 's/-fstack-protector[[:alpha:]-]\\+//g' \\\ - -e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\\+//g' \\\ + -e 's/-[^ ]*D_FORTIFY_SOURCE=[[:digit:]][^ ]*\\+//g' \\\ -e 's/--param=ssp-buffer-size=4//g' \\\ -e 's/-mregparm=3/-mregparm=4/g' \\\ -e 's/-fexceptions//g' \\\ diff --git a/grub.patches b/grub.patches index 51a622fc..b5e46f08 100644 --- a/grub.patches +++ b/grub.patches @@ -315,5 +315,4 @@ Patch0314: 0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch Patch0315: 0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch Patch0316: 0316-efi-Increase-default-memory-allocation-to-32-MiB.patch Patch0317: 0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch -Patch0318: 0318-Skip-diskfilter-on-powerpc-CDs.patch -Patch0319: 0319-Fix-prefix-and-root-on-ppc64le-CDs.patch +Patch0318: 0318-ppc64le-signed-boot-media-changes.patch diff --git a/grub2.spec b/grub2.spec index 088265a8..9ec503d1 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 76%{?dist} +Release: 77%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Jan 27 2023 Robbie Harwood - 2.06-77 +- ppc64le: update signed media fixes + * Fri Jan 13 2023 Robbie Harwood - 2.06-76 - ppc64le: fix issues using core.elf on boot media From f8f88e12359e2f459bbf2661df537122e2c79526 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 27 Jan 2023 20:42:56 +0000 Subject: [PATCH 175/294] Fix grub2-probe issue with previous commit Resolves: #2165136 Signed-off-by: Robbie Harwood --- 0318-ppc64le-signed-boot-media-changes.patch | 4 ++-- grub2.spec | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/0318-ppc64le-signed-boot-media-changes.patch b/0318-ppc64le-signed-boot-media-changes.patch index 835f7c96..d6ab9614 100644 --- a/0318-ppc64le-signed-boot-media-changes.patch +++ b/0318-ppc64le-signed-boot-media-changes.patch @@ -48,14 +48,14 @@ Signed-off-by: Robbie Harwood 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 7cdffe3ebd..27fbca903f 100644 +index 7cdffe3ebd..68c836fc64 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -139,6 +139,12 @@ scan_disk_partition_iter (grub_disk_t disk, grub_partition_t p, void *data) grub_util_info ("Scanning for DISKFILTER devices on disk %s", name); #endif -+ if (p->parent == NULL || p->parent->len == 0) ++ if (p != NULL && (p->parent == NULL || p->parent->len == 0)) + { + grub_dprintf ("diskfilter", "skipping %s due to unknown parent partition length", name); + return 0; diff --git a/grub2.spec b/grub2.spec index 9ec503d1..f6ce92a7 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 77%{?dist} +Release: 78%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Jan 27 2023 Robbie Harwood - 2.06-78 +- Fix grub2-probe issue with previous commit +- Resolves: #2165136 + * Fri Jan 27 2023 Robbie Harwood - 2.06-77 - ppc64le: update signed media fixes From e4be65856a5714bf68af27eebb62d104591c6475 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 31 Jan 2023 18:54:07 +0000 Subject: [PATCH 176/294] Disable mdraid < 1.1 on ppc64le Signed-off-by: Robbie Harwood --- 0318-ppc64le-signed-boot-media-changes.patch | 73 +++++++++++++------- grub2.spec | 5 +- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/0318-ppc64le-signed-boot-media-changes.patch b/0318-ppc64le-signed-boot-media-changes.patch index d6ab9614..bd714374 100644 --- a/0318-ppc64le-signed-boot-media-changes.patch +++ b/0318-ppc64le-signed-boot-media-changes.patch @@ -3,7 +3,7 @@ From: Robbie Harwood Date: Wed, 25 Jan 2023 16:10:58 -0500 Subject: [PATCH] ppc64le: signed boot media changes -Skip diskfilter on isos since mdraid* can't even +Skip mdraid < 1.1 on isos since mdraid* can't even Prior to this change, on ppc64le with part_msdos and the mdraid* modules enabled, we see: @@ -32,38 +32,61 @@ These latter two lines repeat many times, eventually ending in: and the system drops to a "grub>" prompt. -The firmware and the iso image appear to diagree on the blocksize (512 -vs. 2048), and the diskfilter RAID probing is too much for it. We won't -be seeing RAID on bootable CDs, so just turn it off. +Prior to 1.1, mdraid stored the superblock offset from the end of the +disk, and the firmware really doesn't like reads there. Best guess was +that the firmware and the iso image appear to diagree on the blocksize +(512 vs. 2048), and the diskfilter RAID probing is too much for it. +It's tempting to just skip probing for cdroms, but unfortunately isos +can be virtualized elsewhere - such as regular disks. -Fix detection of root. - -Try the chrp path as a fallback if the built prefix doesn't work. +Also fix detection of root, and try the chrp path as a fallback if the +built prefix doesn't work. Signed-off-by: Robbie Harwood + +wip --- - grub-core/disk/diskfilter.c | 6 ++++++ + grub-core/disk/mdraid1x_linux.c | 8 +++++++- + grub-core/disk/mdraid_linux.c | 5 +++++ grub-core/kern/ieee1275/openfw.c | 2 +- grub-core/normal/main.c | 5 +++++ - 3 files changed, 12 insertions(+), 1 deletion(-) + 4 files changed, 18 insertions(+), 2 deletions(-) -diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 7cdffe3ebd..68c836fc64 100644 ---- a/grub-core/disk/diskfilter.c -+++ b/grub-core/disk/diskfilter.c -@@ -139,6 +139,12 @@ scan_disk_partition_iter (grub_disk_t disk, grub_partition_t p, void *data) - grub_util_info ("Scanning for DISKFILTER devices on disk %s", name); - #endif - -+ if (p != NULL && (p->parent == NULL || p->parent->len == 0)) -+ { -+ grub_dprintf ("diskfilter", "skipping %s due to unknown parent partition length", name); -+ return 0; -+ } +diff --git a/grub-core/disk/mdraid1x_linux.c b/grub-core/disk/mdraid1x_linux.c +index 38444b02c7..08c57ae16e 100644 +--- a/grub-core/disk/mdraid1x_linux.c ++++ b/grub-core/disk/mdraid1x_linux.c +@@ -129,7 +129,13 @@ grub_mdraid_detect (grub_disk_t disk, + grub_uint32_t level; + struct grub_diskfilter_vg *array; + char *uuid; +- + - disk->partition = p; - - for (arr = array_list; arr != NULL; arr = arr->next) ++#ifdef __powerpc__ ++ /* Firmware will yell at us for reading too far. */ ++ if (minor_version == 0) ++ continue; ++#endif ++ + if (size == GRUB_DISK_SIZE_UNKNOWN && minor_version == 0) + continue; + +diff --git a/grub-core/disk/mdraid_linux.c b/grub-core/disk/mdraid_linux.c +index e40216f511..98fcfb1be6 100644 +--- a/grub-core/disk/mdraid_linux.c ++++ b/grub-core/disk/mdraid_linux.c +@@ -189,6 +189,11 @@ grub_mdraid_detect (grub_disk_t disk, + grub_uint32_t level; + struct grub_diskfilter_vg *ret; + ++#ifdef __powerpc__ ++ /* Firmware will yell at us for reading too far. */ ++ return NULL; ++#endif ++ + /* The sector where the mdraid 0.90 superblock is stored, if available. */ + size = grub_disk_native_sectors (disk); + if (size == GRUB_DISK_SIZE_UNKNOWN) diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c index 3a6689abb1..0278054c61 100644 --- a/grub-core/kern/ieee1275/openfw.c diff --git a/grub2.spec b/grub2.spec index f6ce92a7..5b502b7d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 78%{?dist} +Release: 79%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jan 31 2023 Robbie Harwood - 2.06-79 +- Disable mdraid < 1.1 on ppc64le + * Fri Jan 27 2023 Robbie Harwood - 2.06-78 - Fix grub2-probe issue with previous commit - Resolves: #2165136 From 1163f8ebfd7fe7b61f3caea143bc66d75f090ebb Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 1 Feb 2023 20:54:24 +0000 Subject: [PATCH 177/294] Bump to re-run signing Signed-off-by: Robbie Harwood --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 5b502b7d..5817228c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 79%{?dist} +Release: 80%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Feb 01 2023 Robbie Harwood - 2.06-80 +- Bump to re-run signing + * Tue Jan 31 2023 Robbie Harwood - 2.06-79 - Disable mdraid < 1.1 on ppc64le From 22838ae9d70c0bedc6ef46144273dd84a9fc5d46 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 1 Feb 2023 22:40:47 +0100 Subject: [PATCH 178/294] 20-grub-install: Explicitly check '+debug' suffix for debug kernels The kernel-install script is also used to install kernels when built from source using the `make install` target. And if this source contains modifications, a '+' is added as suffix by the scripts/setlocalversion if no LOCALVERSION was set in the kernel config. This confuses the grub2 kernel-install plugin, since it currently assumes that any kernel that contain a version with a '+' suffix is a debug kernel. But the match is too greedy, just having '+debug' should be enough to check whether the kernel to install is a debug kernel or not. Resolves: #2148351 Signed-off-by: Javier Martinez Canillas --- 20-grub.install | 2 +- grub2.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/20-grub.install b/20-grub.install index bb0d5299..aa9272dd 100755 --- a/20-grub.install +++ b/20-grub.install @@ -139,7 +139,7 @@ case "$COMMAND" in sed -i -e "s,^initrd.*,initrd ${BOOTPREFIX}${INITRD},g" "${BLS_TARGET}" fi - if [[ "$KERNEL_VERSION" == *\+* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ]; then + if [[ "$KERNEL_VERSION" == *\+debug* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ]; then GRUB_UPDATE_DEFAULT_KERNEL=false fi diff --git a/grub2.spec b/grub2.spec index 5817228c..053b6988 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 80%{?dist} +Release: 81%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Feb 01 2023 Javier Martinez Canillas - 2.06-81 +- 20-grub-install: Explicitly check '+debug' suffix for debug kernels +- Resolves: #2148351 + * Wed Feb 01 2023 Robbie Harwood - 2.06-80 - Bump to re-run signing From 3a3516d36054d05c69e378e2350e6e88a19b8b5b Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 6 Feb 2023 18:54:15 +0000 Subject: [PATCH 179/294] Fix implicit function declaration warnings Signed-off-by: Robbie Harwood --- ...veral-implicit-function-declarations.patch | 54 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 0319-core-Fix-several-implicit-function-declarations.patch diff --git a/0319-core-Fix-several-implicit-function-declarations.patch b/0319-core-Fix-several-implicit-function-declarations.patch new file mode 100644 index 00000000..48c5bb04 --- /dev/null +++ b/0319-core-Fix-several-implicit-function-declarations.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Arjun Shankar +Date: Sun, 5 Feb 2023 11:13:55 +0100 +Subject: [PATCH] core: Fix several implicit function declarations + +These #include lines ensure that grub2 continues to build with C99 +where implicit function declarations are removed. + +Related to: + + + +--- + grub-core/commands/efi/connectefi.c | 1 + + grub-core/net/http.c | 1 + + grub-core/term/at_keyboard.c | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/grub-core/commands/efi/connectefi.c b/grub-core/commands/efi/connectefi.c +index 8ab75bd51b..3752ae17ed 100644 +--- a/grub-core/commands/efi/connectefi.c ++++ b/grub-core/commands/efi/connectefi.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index 57d2721719..5f956b743e 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index dac0f946fe..de3e4abe44 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + diff --git a/grub.patches b/grub.patches index b5e46f08..a0cba84a 100644 --- a/grub.patches +++ b/grub.patches @@ -316,3 +316,4 @@ Patch0315: 0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch Patch0316: 0316-efi-Increase-default-memory-allocation-to-32-MiB.patch Patch0317: 0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch Patch0318: 0318-ppc64le-signed-boot-media-changes.patch +Patch0319: 0319-core-Fix-several-implicit-function-declarations.patch diff --git a/grub2.spec b/grub2.spec index 053b6988..fa45fcf6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 81%{?dist} +Release: 82%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Feb 06 2023 Robbie Harwood - 2.06-82 +- Fix implicit function declaration warnings + * Wed Feb 01 2023 Javier Martinez Canillas - 2.06-81 - 20-grub-install: Explicitly check '+debug' suffix for debug kernels - Resolves: #2148351 From a5299c3192aa8b65eb2d24a5462be3382b4bef76 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 6 Feb 2023 20:29:49 +0000 Subject: [PATCH 180/294] ppc64le: cas5, take 3 Signed-off-by: Robbie Harwood --- 0301-Correction-in-vector-5-values.patch | 30 --------------- ... => 0301-mm-Clarify-grub_real_malloc.patch | 0 ...loc-Make-small-allocs-comment-match-.patch | 0 ....patch => 0303-mm-Document-grub_free.patch | 0 ...0304-mm-Document-grub_mm_init_region.patch | 0 ...-internal-memory-management-structur.patch | 0 ...e-preserve-header-vs-region-alignmen.patch | 0 ...-region-merge-with-region-after-as-w.patch | 0 ...-Debug-support-for-region-operations.patch | 0 ...p-unused-unloading-of-modules-on-OOM.patch | 0 ...ally-requesting-additional-memory-re.patch | 0 ...ys-request-a-fixed-number-of-pages-o.patch | 0 ...tract-function-to-add-memory-regions.patch | 0 ...ss-up-errors-from-add_memory_regions.patch | 0 ...-Implement-runtime-addition-of-pages.patch | 0 ...-default-memory-allocation-to-32-MiB.patch | 0 ...e-disk-caches-last-when-out-of-memor.patch | 0 ...17-ppc64le-signed-boot-media-changes.patch | 0 ...veral-implicit-function-declarations.patch | 0 ...le-shared-processor-mode-in-vector-5.patch | 26 +++++++++++++ grub.patches | 38 +++++++++---------- grub2.spec | 5 ++- 22 files changed, 49 insertions(+), 50 deletions(-) delete mode 100644 0301-Correction-in-vector-5-values.patch rename 0302-mm-Clarify-grub_real_malloc.patch => 0301-mm-Clarify-grub_real_malloc.patch (100%) rename 0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch => 0302-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch (100%) rename 0304-mm-Document-grub_free.patch => 0303-mm-Document-grub_free.patch (100%) rename 0305-mm-Document-grub_mm_init_region.patch => 0304-mm-Document-grub_mm_init_region.patch (100%) rename 0306-mm-Document-GRUB-internal-memory-management-structur.patch => 0305-mm-Document-GRUB-internal-memory-management-structur.patch (100%) rename 0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch => 0306-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch (100%) rename 0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch => 0307-mm-When-adding-a-region-merge-with-region-after-as-w.patch (100%) rename 0309-mm-Debug-support-for-region-operations.patch => 0308-mm-Debug-support-for-region-operations.patch (100%) rename 0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch => 0309-mm-Drop-unused-unloading-of-modules-on-OOM.patch (100%) rename 0311-mm-Allow-dynamically-requesting-additional-memory-re.patch => 0310-mm-Allow-dynamically-requesting-additional-memory-re.patch (100%) rename 0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch => 0311-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch (100%) rename 0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch => 0312-kern-efi-mm-Extract-function-to-add-memory-regions.patch (100%) rename 0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch => 0313-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch (100%) rename 0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch => 0314-kern-efi-mm-Implement-runtime-addition-of-pages.patch (100%) rename 0316-efi-Increase-default-memory-allocation-to-32-MiB.patch => 0315-efi-Increase-default-memory-allocation-to-32-MiB.patch (100%) rename 0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch => 0316-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch (100%) rename 0318-ppc64le-signed-boot-media-changes.patch => 0317-ppc64le-signed-boot-media-changes.patch (100%) rename 0319-core-Fix-several-implicit-function-declarations.patch => 0318-core-Fix-several-implicit-function-declarations.patch (100%) create mode 100644 0319-Enable-shared-processor-mode-in-vector-5.patch diff --git a/0301-Correction-in-vector-5-values.patch b/0301-Correction-in-vector-5-values.patch deleted file mode 100644 index 9be1f4a4..00000000 --- a/0301-Correction-in-vector-5-values.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Avnish Chouhan -Date: Tue, 22 Nov 2022 08:01:47 -0500 -Subject: [PATCH] Correction in vector 5 values - -This patch is to update the vector 5 values which is troubling some -machines to bootup properly. Max out the values of all the properties of -Vector 5 (similar to vector 2) except max cpu property, which were set -as 0 earlier. - -Signed-off-by: Avnish Chouhan -[rharwood: rewrap comit message] -Signed-off-by: Robbie Harwood ---- - grub-core/kern/ieee1275/init.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 6a51c9efab..28a3bd4621 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -376,7 +376,7 @@ grub_ieee1275_ibm_cas (void) - .vec4 = 0x0001, // set required minimum capacity % to the lowest value - .vec5_size = 1 + sizeof(struct option_vector5) - 2, - .vec5 = { -- 0, 0, 0, 0, 0, 0, 0, 0, 256 -+ -1, -1, -1, -1, -1, -1, -1, -1, 256 - } - }; - diff --git a/0302-mm-Clarify-grub_real_malloc.patch b/0301-mm-Clarify-grub_real_malloc.patch similarity index 100% rename from 0302-mm-Clarify-grub_real_malloc.patch rename to 0301-mm-Clarify-grub_real_malloc.patch diff --git a/0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch b/0302-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch similarity index 100% rename from 0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch rename to 0302-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch diff --git a/0304-mm-Document-grub_free.patch b/0303-mm-Document-grub_free.patch similarity index 100% rename from 0304-mm-Document-grub_free.patch rename to 0303-mm-Document-grub_free.patch diff --git a/0305-mm-Document-grub_mm_init_region.patch b/0304-mm-Document-grub_mm_init_region.patch similarity index 100% rename from 0305-mm-Document-grub_mm_init_region.patch rename to 0304-mm-Document-grub_mm_init_region.patch diff --git a/0306-mm-Document-GRUB-internal-memory-management-structur.patch b/0305-mm-Document-GRUB-internal-memory-management-structur.patch similarity index 100% rename from 0306-mm-Document-GRUB-internal-memory-management-structur.patch rename to 0305-mm-Document-GRUB-internal-memory-management-structur.patch diff --git a/0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch b/0306-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch similarity index 100% rename from 0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch rename to 0306-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch diff --git a/0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch b/0307-mm-When-adding-a-region-merge-with-region-after-as-w.patch similarity index 100% rename from 0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch rename to 0307-mm-When-adding-a-region-merge-with-region-after-as-w.patch diff --git a/0309-mm-Debug-support-for-region-operations.patch b/0308-mm-Debug-support-for-region-operations.patch similarity index 100% rename from 0309-mm-Debug-support-for-region-operations.patch rename to 0308-mm-Debug-support-for-region-operations.patch diff --git a/0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch b/0309-mm-Drop-unused-unloading-of-modules-on-OOM.patch similarity index 100% rename from 0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch rename to 0309-mm-Drop-unused-unloading-of-modules-on-OOM.patch diff --git a/0311-mm-Allow-dynamically-requesting-additional-memory-re.patch b/0310-mm-Allow-dynamically-requesting-additional-memory-re.patch similarity index 100% rename from 0311-mm-Allow-dynamically-requesting-additional-memory-re.patch rename to 0310-mm-Allow-dynamically-requesting-additional-memory-re.patch diff --git a/0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch b/0311-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch similarity index 100% rename from 0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch rename to 0311-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch diff --git a/0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch b/0312-kern-efi-mm-Extract-function-to-add-memory-regions.patch similarity index 100% rename from 0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch rename to 0312-kern-efi-mm-Extract-function-to-add-memory-regions.patch diff --git a/0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch b/0313-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch similarity index 100% rename from 0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch rename to 0313-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch diff --git a/0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch b/0314-kern-efi-mm-Implement-runtime-addition-of-pages.patch similarity index 100% rename from 0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch rename to 0314-kern-efi-mm-Implement-runtime-addition-of-pages.patch diff --git a/0316-efi-Increase-default-memory-allocation-to-32-MiB.patch b/0315-efi-Increase-default-memory-allocation-to-32-MiB.patch similarity index 100% rename from 0316-efi-Increase-default-memory-allocation-to-32-MiB.patch rename to 0315-efi-Increase-default-memory-allocation-to-32-MiB.patch diff --git a/0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch b/0316-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch similarity index 100% rename from 0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch rename to 0316-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch diff --git a/0318-ppc64le-signed-boot-media-changes.patch b/0317-ppc64le-signed-boot-media-changes.patch similarity index 100% rename from 0318-ppc64le-signed-boot-media-changes.patch rename to 0317-ppc64le-signed-boot-media-changes.patch diff --git a/0319-core-Fix-several-implicit-function-declarations.patch b/0318-core-Fix-several-implicit-function-declarations.patch similarity index 100% rename from 0319-core-Fix-several-implicit-function-declarations.patch rename to 0318-core-Fix-several-implicit-function-declarations.patch diff --git a/0319-Enable-shared-processor-mode-in-vector-5.patch b/0319-Enable-shared-processor-mode-in-vector-5.patch new file mode 100644 index 00000000..ec540a7a --- /dev/null +++ b/0319-Enable-shared-processor-mode-in-vector-5.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Avnish Chouhan +Date: Tue, 24 Jan 2023 08:01:47 -0500 +Subject: [PATCH] Enable shared processor mode in vector 5 + +This patch is to update the vector 5 which is troubling some +machines to bootup properly in shared processor mode. + +Signed-off-by: Avnish Chouhan +--- + grub-core/kern/ieee1275/init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 6a51c9efab..7c8b6facec 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -376,7 +376,7 @@ grub_ieee1275_ibm_cas (void) + .vec4 = 0x0001, // set required minimum capacity % to the lowest value + .vec5_size = 1 + sizeof(struct option_vector5) - 2, + .vec5 = { +- 0, 0, 0, 0, 0, 0, 0, 0, 256 ++ 0, 192, 0, 128, 0, 0, 0, 0, 256 + } + }; + diff --git a/grub.patches b/grub.patches index a0cba84a..8f3e1808 100644 --- a/grub.patches +++ b/grub.patches @@ -298,22 +298,22 @@ Patch0297: 0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch Patch0298: 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch Patch0299: 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch Patch0300: 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch -Patch0301: 0301-Correction-in-vector-5-values.patch -Patch0302: 0302-mm-Clarify-grub_real_malloc.patch -Patch0303: 0303-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch -Patch0304: 0304-mm-Document-grub_free.patch -Patch0305: 0305-mm-Document-grub_mm_init_region.patch -Patch0306: 0306-mm-Document-GRUB-internal-memory-management-structur.patch -Patch0307: 0307-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch -Patch0308: 0308-mm-When-adding-a-region-merge-with-region-after-as-w.patch -Patch0309: 0309-mm-Debug-support-for-region-operations.patch -Patch0310: 0310-mm-Drop-unused-unloading-of-modules-on-OOM.patch -Patch0311: 0311-mm-Allow-dynamically-requesting-additional-memory-re.patch -Patch0312: 0312-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch -Patch0313: 0313-kern-efi-mm-Extract-function-to-add-memory-regions.patch -Patch0314: 0314-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch -Patch0315: 0315-kern-efi-mm-Implement-runtime-addition-of-pages.patch -Patch0316: 0316-efi-Increase-default-memory-allocation-to-32-MiB.patch -Patch0317: 0317-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch -Patch0318: 0318-ppc64le-signed-boot-media-changes.patch -Patch0319: 0319-core-Fix-several-implicit-function-declarations.patch +Patch0301: 0301-mm-Clarify-grub_real_malloc.patch +Patch0302: 0302-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch +Patch0303: 0303-mm-Document-grub_free.patch +Patch0304: 0304-mm-Document-grub_mm_init_region.patch +Patch0305: 0305-mm-Document-GRUB-internal-memory-management-structur.patch +Patch0306: 0306-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch +Patch0307: 0307-mm-When-adding-a-region-merge-with-region-after-as-w.patch +Patch0308: 0308-mm-Debug-support-for-region-operations.patch +Patch0309: 0309-mm-Drop-unused-unloading-of-modules-on-OOM.patch +Patch0310: 0310-mm-Allow-dynamically-requesting-additional-memory-re.patch +Patch0311: 0311-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch +Patch0312: 0312-kern-efi-mm-Extract-function-to-add-memory-regions.patch +Patch0313: 0313-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch +Patch0314: 0314-kern-efi-mm-Implement-runtime-addition-of-pages.patch +Patch0315: 0315-efi-Increase-default-memory-allocation-to-32-MiB.patch +Patch0316: 0316-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch +Patch0317: 0317-ppc64le-signed-boot-media-changes.patch +Patch0318: 0318-core-Fix-several-implicit-function-declarations.patch +Patch0319: 0319-Enable-shared-processor-mode-in-vector-5.patch diff --git a/grub2.spec b/grub2.spec index fa45fcf6..eb3fe3f9 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 82%{?dist} +Release: 83%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Feb 06 2023 Robbie Harwood - 2.06-83 +- ppc64le: cas5, take 3 + * Mon Feb 06 2023 Robbie Harwood - 2.06-82 - Fix implicit function declaration warnings From ed1787d5fc890038845f07000728a462f9852a40 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 6 Feb 2023 22:43:11 +0000 Subject: [PATCH 181/294] emu: support newer kexec syscall Signed-off-by: Robbie Harwood --- ...h => 0060-Add-grub2-switch-to-blscfg.patch | 0 ...patch => 0061-make-better-backtraces.patch | 6 +- ...w-our-startup-message-if-debug-is-se.patch | 0 ...-some-minor-include-path-weirdnesses.patch | 0 ...it-possible-to-enabled-build-id-sha1.patch | 0 ...f-grub_dprintf-without-the-file-line.patch | 0 ...dprintf-that-tells-us-load-addresses.patch | 0 ...tch => 0067-Fixup-for-newer-compiler.patch | 0 ...-export-the-start-and-_start-symbols.patch | 0 ...tch => 0069-Fixup-for-newer-compiler.patch | 0 ...pport-for-non-Ethernet-network-cards.patch | 0 ...racketed-ipv6-addrs-and-port-numbers.patch | 0 ...=> 0072-bootp-New-net_bootp6-command.patch | 0 ...=> 0073-efinet-UEFI-IPv6-PXE-support.patch | 0 ...074-grub.texi-Add-net_bootp6-doument.patch | 0 ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 0 ...etting-network-from-UEFI-device-path.patch | 0 ...etting-DNS-server-from-UEFI-protocol.patch | 0 ...78-Support-UEFI-networking-protocols.patch | 6 +- ...> 0079-AUDIT-0-http-boot-tracker-bug.patch | 0 ...-incr-command-to-increment-integer-v.patch | 0 ...h => 0081-Add-auto-hide-menu-support.patch | 0 ...> 0082-Add-grub-set-bootflag-utility.patch | 0 ...b-boot-indeterminate.service-example.patch | 0 ...h => 0084-gentpl-add-disable-support.patch | 0 ... => 0085-gentpl-add-pc-firmware-type.patch | 0 ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 0 ...make-it-possible-to-run-checkers-on-.patch | 0 ...90-Rework-how-the-fdt-command-builds.patch | 6 +- ...able-non-wordsize-allocations-on-arm.patch | 0 ...nd-prefix-when-HTTP-path-is-relative.patch | 0 ...=> 0093-Make-grub_error-more-verbose.patch | 0 ...eset-an-alias-for-the-reboot-command.patch | 0 ....patch => 0095-Add-a-version-command.patch | 2 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 0 ...-Better-memory-allocation-and-error-.patch | 0 ...tter-locations-for-kernel-and-initrd.patch | 0 ...p-all-the-places-Wsign-compare-error.patch | 4 +- ...gn-compare-Wno-conversion-Wno-error-.patch | 0 ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 0 ...itrd-params-cmdline-allocations-abov.patch | 0 ... => 0105-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 0 ...tch => 0107-Reimplement-boot_counter.patch | 2 +- ...ntry-selection-based-on-ID-and-title.patch | 0 ...try-users-option-argument-to-be-opti.patch | 0 ...export-env-and-efi-load-env-commands.patch | 2 +- ...le-to-subtract-conditions-from-debug.patch | 0 ...bles-from-the-initial-context-when-c.patch | 0 ...-boot-success-reset-from-menu-auto-h.patch | 0 ...t-boot-commands-will-only-return-on-.patch | 0 ...ix-systemctl-kexec-exit-status-check.patch | 37 -- ...g-Update-comment-about-running-as-ro.patch | 0 ...b-emu-linux-loader-messages-as-debug.patch | 34 -- ...g-Write-new-env-to-tmpfile-and-then-.patch | 0 ...indeterminate-getting-set-on-boot_su.patch | 0 ... => 0118-Add-start-symbol-for-RISC-V.patch | 0 ...conf-Force-autogen.sh-to-use-python3.patch | 0 ...fw-http-_path-variables-to-make-them.patch | 0 ...-literal-IPv6-addresses-in-square-br.patch | 0 ...o-specify-a-port-number-in-addresses.patch | 0 ...mprove-check-to-detect-literal-IPv6-.patch | 0 ...debug-message-if-parsing-the-address.patch | 0 ...so-accept-F8-as-a-user-interrupt-key.patch | 0 ...se-address-before-jumping-to-the-PE-.patch | 0 ...ate-TPM-measurement-errors-to-the-ve.patch | 0 ...maximum-bounce-buffer-size-to-16-MiB.patch | 0 ...fix-when-the-HTTP-path-is-relative-a.patch | 0 ...turn-in-efi-export-env-and-efi-load-.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...p-fix-some-allocation-error-checking.patch | 0 ...g.c-fix-some-potential-allocation-ov.patch | 0 ...integer-overflows-in-grub_cmd_initrd.patch | 0 ...rnel-validation-without-shim-protoco.patch | 0 ...ar-pointers-in-grub-core-net-bootp.c.patch | 0 ...ointers-in-grub-core-net-efi-ip4_con.patch | 0 ...ointers-in-grub-core-net-efi-ip6_con.patch | 0 ...-pointers-in-grub-core-net-efi-net.c.patch | 0 ...-pointers-in-grub-core-net-efi-pxe.c.patch | 0 ...gration-scripts-to-make-systemctl-re.patch | 0 ...ion.sh-Also-set-old-menu_show_once-g.patch | 0 ...set-1-when-keyboard-is-in-Translate-.patch | 0 ...ll-disable-support-for-EFI-platforms.patch | 0 ...imestamps-configure-flag-to-prepend-.patch | 0 ...ements-to-grub_disk_open-and-grub_di.patch | 0 ...on-grub_debug_is_enabled-void-return.patch | 0 ...ear-screen-when-debugging-is-enabled.patch | 0 ...Fix-error-handling-in-grub_file_open.patch | 0 ..._-instrumentation-new-file-debug-tag.patch | 0 ...-Avoiding-many-unecessary-open-close.patch | 0 ...-implements-fibre-channel-discovery-.patch | 0 ...erpc-enables-device-mapper-discovery.patch | 0 ...fallback_set-var-to-force-the-set-ma.patch | 0 ...igning-grub-with-an-appended-signatu.patch | 0 ...rub-Document-signing-grub-under-UEFI.patch | 0 ...nt-signing-grub-with-an-appended-sig.patch | 0 ...e-grub_dl_set_persistent-for-the-emu.patch | 0 ...patch => 0159-pgp-factor-out-rsa_pad.patch | 4 +- ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 0 ...p-tweaks-in-preparation-for-libtasn1.patch | 0 ...0162-libtasn1-import-libtasn1-4.16.0.patch | 0 ...asn1-disable-code-not-needed-in-grub.patch | 0 ...tasn1-changes-for-grub-compatibility.patch | 0 ...65-libtasn1-compile-into-asn1-module.patch | 4 +- ...6-test_asn1-test-module-for-libtasn1.patch | 4 +- ...-support-embedding-x509-certificates.patch | 0 ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 0 ...res-parse-PKCS-7-signedData-and-X.50.patch | 0 ...res-support-verifying-appended-signa.patch | 2 +- ...pended-signatures-verification-tests.patch | 4 +- ...72-appended-signatures-documentation.patch | 0 ...er-lockdown-based-on-ibm-secure-boot.patch | 2 +- ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 0 ...h => 0175-ieee1275-claim-more-memory.patch | 0 ...-memory-with-ibm-client-architecture.patch | 0 ...-Also-handle-the-Extended-Key-Usage-.patch | 0 ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...ainloading-EFI-apps-from-loop-mounts.patch | 0 ...> 0180-efinet-Add-DHCP-proxy-support.patch | 0 ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 0 ... 0183-Suppress-gettext-error-message.patch | 0 ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 ...for-EFI-at-runtime-instead-of-config.patch | 0 ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 0 ...over-the-device-to-read-the-config-f.patch | 0 ...etting-of-prefix-for-signed-binary-c.patch | 0 ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 0 ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 2 +- ...-mkconfig-restore-umask-for-grub.cfg.patch | 0 ...btrfs-Use-full-btrfs-bootloader-area.patch | 0 ...-Fedora-location-of-DejaVu-SANS-font.patch | 0 ...t-show-Booting-s-msg-when-auto-booti.patch | 0 ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 0 ...ot-set-colorstate-until-the-first-te.patch | 0 ...ot-set-cursor-until-the-first-text-o.patch | 0 ...se-visual-indentation-in-config.h.in.patch | 0 ...sure-config-util.h-precedes-config.h.patch | 2 +- ...=> 0202-Drop-gnulib-fix-base64.patch.patch | 0 ...h => 0203-Drop-gnulib-no-abort.patch.patch | 0 ...version-and-drop-most-gnulib-patches.patch | 2 +- ...Fix-bug-stopping-iteration-when-no-f.patch | 0 ...w-efidisk-only-option-on-EFI-systems.patch | 0 ...h => 0207-efi-new-connectefi-command.patch | 2 +- ...-i386-efi-linux.c-do-not-validate-ke.patch | 0 ...-arm64-linux.c-do-not-validate-kerne.patch | 0 ...-efi-chainloader.c-do-not-validate-c.patch | 0 ...-efi-linux.c-drop-now-unused-grub_li.patch | 0 ...erpc-do-CAS-in-a-more-compatible-way.patch | 0 ...etection-support-device-names-with-c.patch | 0 ...ort-for-trusted-boot-using-a-vTPM-2..patch | 2 +- ...=> 0215-make-ofdisk_retries-optional.patch | 0 ...loader-grub_load_and_start_image-doe.patch | 0 ...hainloader-simplify-the-loader-state.patch | 0 ...ot-Add-API-to-pass-context-to-loader.patch | 0 ...i-chainloader-Use-grub_loader_set_ex.patch | 0 ...linux-Avoid-a-use-after-free-in-the-.patch | 0 ...386-efi-linux-Use-grub_loader_set_ex.patch | 0 ...linux-Fix-a-memory-leak-in-the-initr.patch | 0 ...ct-non-kernel-files-in-the-shim_lock.patch | 0 ...-leak-device_name-on-error-in-grub_f.patch | 0 ...g-Abort-sooner-if-a-read-operation-f.patch | 0 ...g-Refuse-to-handle-multiple-image-he.patch | 0 ...g-Drop-greyscale-support-to-fix-heap.patch | 0 ...g-Avoid-heap-OOB-R-W-inserting-huff-.patch | 0 ...-png-Sanity-check-some-huffman-codes.patch | 0 ...eg-Abort-sooner-if-a-read-operation-.patch | 0 ...eg-Do-not-reallocate-a-given-huff-ta.patch | 0 ...eg-Refuse-to-handle-multiple-start-o.patch | 0 ...eg-Block-int-underflow-wild-pointer-.patch | 0 ...ix-array-out-of-bounds-formatting-un.patch | 0 ...ff-Block-overly-large-netbuff-allocs.patch | 0 ...6-net-ip-Do-IP-fragment-maths-safely.patch | 0 ...le-free-addresses-on-corrupt-DNS-res.patch | 0 ...ad-past-the-end-of-the-string-we-re-.patch | 0 ...-a-UAF-and-double-free-from-a-failed.patch | 0 ...=> 0240-net-tftp-Avoid-a-trivial-UAF.patch | 0 ...tear-down-socket-if-it-s-already-bee.patch | 0 ...Fix-OOB-write-for-split-http-headers.patch | 0 ...or-out-on-headers-with-LF-without-CR.patch | 0 ...ead-past-the-end-of-nat-journal-entr.patch | 0 ...-not-read-past-the-end-of-nat-bitmap.patch | 0 ...ot-copy-file-names-that-are-too-long.patch | 0 ...eral-fuzz-issues-with-invalid-dir-it.patch | 0 ...e-ASAN-and-SEGV-issues-found-with-fu.patch | 0 ...x-more-fuzz-issues-related-to-chunks.patch | 0 ...grub_min-and-grub_max-more-resilient.patch | 0 ...FS-switch-to-using-grub_min-grub_max.patch | 0 ...oot_time-also-call-grub_dprintf-boot.patch | 0 ...dules-make-.module_license-read-only.patch | 0 ...p-.llvm_addrsig-sections-and-similar.patch | 0 ...locate-space-for-non-allocable-secti.patch | 0 ...eader-struct-and-fix-some-bad-naming.patch | 0 ...nel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch | 0 ...ule-sections-at-page-aligned-address.patch | 0 ...-nx-add-memory-attribute-get-set-API.patch | 0 ...-page-permissions-for-loaded-modules.patch | 0 ...1-nx-set-attrs-in-our-kernel-loaders.patch | 0 ...x-compatible-flag-in-EFI-grub-images.patch | 0 ...-document-the-behavior-of-multiple-v.patch | 0 ...probe-dprint-errors-from-filesystems.patch | 0 ...5-fs-fat-don-t-error-when-mtime-is-0.patch | 0 ...file-show-which-file-filters-get-run.patch | 0 ...ed-array-positions-for-our-allocatio.patch | 0 ...tion-policy-for-kernel-vs-initrd-mem.patch | 0 ...-initrd-within-the-bounds-expressed-.patch | 0 ...ER_-CODE-DATA-for-kernel-and-initrd-.patch | 0 ...e-etc-kernel-cmdline-during-mkconfig.patch | 0 ...sh-don-t-dup-rhgb-quiet-check-mtimes.patch | 0 ...=> 0273-squish-give-up-on-rhgb-quiet.patch | 0 ...write-etc-kernel-cmdline-if-writable.patch | 0 ...5-implement-vec5-for-cas-negotiation.patch | 0 ...scfg-Don-t-root-device-in-emu-builds.patch | 0 ...ux-Remove-magic-number-header-field-.patch | 0 ... 0278-Correct-BSS-zeroing-on-aarch64.patch | 0 ...ate-i-cache-before-starting-the-kern.patch | 0 ...ncorrect-array-size-in-kernel-alloca.patch | 0 ...i-tpm-Refine-the-status-of-log-event.patch | 0 ...-Use-grub_strcpy-instead-of-grub_mem.patch | 0 ...-EFI_CC_MEASUREMENT_PROTOCOL-support.patch | 0 ...hs-exceeds-font-max_glyph_width-or-f.patch | 0 ...erflow-in-grub_font_get_glyph_intern.patch | 0 ...-integer-overflows-in-grub_font_cons.patch | 0 ...0287-font-Remove-grub_font_dup_glyph.patch | 0 ...nteger-overflow-in-ensure_comb_space.patch | 0 ...nt-Fix-integer-overflow-in-BMP-index.patch | 0 ...-underflow-in-binary-search-of-char-.patch | 0 ...b-Enforce-verification-of-font-files.patch | 0 ... => 0292-fbutil-Fix-integer-overflow.patch | 0 ...ix-an-integer-underflow-in-blit_comb.patch | 0 ..._font_blit_glyph-and-grub_font_blit_.patch | 0 ...l_font-to-glyphs-in-ascii_font_glyph.patch | 0 ...ix-an-integer-overflow-in-grub_unico.patch | 0 ...ening-fonts-from-the-bundled-memdisk.patch | 0 0298-Correction-in-vector-5-values.patch | 30 + ... => 0299-mm-Clarify-grub_real_malloc.patch | 0 ...loc-Make-small-allocs-comment-match-.patch | 0 ....patch => 0301-mm-Document-grub_free.patch | 0 ...0302-mm-Document-grub_mm_init_region.patch | 0 ...-internal-memory-management-structur.patch | 0 ...e-preserve-header-vs-region-alignmen.patch | 0 ...-region-merge-with-region-after-as-w.patch | 0 ...-Debug-support-for-region-operations.patch | 0 ...p-unused-unloading-of-modules-on-OOM.patch | 0 ...ally-requesting-additional-memory-re.patch | 0 ...ys-request-a-fixed-number-of-pages-o.patch | 0 ...tract-function-to-add-memory-regions.patch | 0 ...ss-up-errors-from-add_memory_regions.patch | 0 ...-Implement-runtime-addition-of-pages.patch | 0 ...-default-memory-allocation-to-32-MiB.patch | 0 ...e-disk-caches-last-when-out-of-memor.patch | 0 ...15-ppc64le-signed-boot-media-changes.patch | 0 ...veral-implicit-function-declarations.patch | 0 ...rt-for-grub-emu-to-kexec-Linux-menu-.patch | 255 ++++++--- ...le-shared-processor-mode-in-vector-5.patch | 26 - grub.patches | 518 +++++++++--------- grub2.spec | 5 +- 263 files changed, 489 insertions(+), 474 deletions(-) rename 0061-Add-grub2-switch-to-blscfg.patch => 0060-Add-grub2-switch-to-blscfg.patch (100%) rename 0062-make-better-backtraces.patch => 0061-make-better-backtraces.patch (99%) rename 0063-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (100%) rename 0064-Work-around-some-minor-include-path-weirdnesses.patch => 0063-Work-around-some-minor-include-path-weirdnesses.patch (100%) rename 0065-Make-it-possible-to-enabled-build-id-sha1.patch => 0064-Make-it-possible-to-enabled-build-id-sha1.patch (100%) rename 0066-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (100%) rename 0067-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch => 0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch (100%) rename 0068-Fixup-for-newer-compiler.patch => 0067-Fixup-for-newer-compiler.patch (100%) rename 0069-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (100%) rename 0070-Fixup-for-newer-compiler.patch => 0069-Fixup-for-newer-compiler.patch (100%) rename 0071-Add-support-for-non-Ethernet-network-cards.patch => 0070-Add-support-for-non-Ethernet-network-cards.patch (100%) rename 0072-net-read-bracketed-ipv6-addrs-and-port-numbers.patch => 0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch (100%) rename 0073-bootp-New-net_bootp6-command.patch => 0072-bootp-New-net_bootp6-command.patch (100%) rename 0074-efinet-UEFI-IPv6-PXE-support.patch => 0073-efinet-UEFI-IPv6-PXE-support.patch (100%) rename 0075-grub.texi-Add-net_bootp6-doument.patch => 0074-grub.texi-Add-net_bootp6-doument.patch (100%) rename 0076-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (100%) rename 0077-efinet-Setting-network-from-UEFI-device-path.patch => 0076-efinet-Setting-network-from-UEFI-device-path.patch (100%) rename 0078-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch (100%) rename 0079-Support-UEFI-networking-protocols.patch => 0078-Support-UEFI-networking-protocols.patch (99%) rename 0080-AUDIT-0-http-boot-tracker-bug.patch => 0079-AUDIT-0-http-boot-tracker-bug.patch (100%) rename 0081-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch (100%) rename 0082-Add-auto-hide-menu-support.patch => 0081-Add-auto-hide-menu-support.patch (100%) rename 0083-Add-grub-set-bootflag-utility.patch => 0082-Add-grub-set-bootflag-utility.patch (100%) rename 0084-docs-Add-grub-boot-indeterminate.service-example.patch => 0083-docs-Add-grub-boot-indeterminate.service-example.patch (100%) rename 0085-gentpl-add-disable-support.patch => 0084-gentpl-add-disable-support.patch (100%) rename 0086-gentpl-add-pc-firmware-type.patch => 0085-gentpl-add-pc-firmware-type.patch (100%) rename 0087-efinet-also-use-the-firmware-acceleration-for-http.patch => 0086-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0088-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (100%) rename 0090-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0089-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0091-Rework-how-the-fdt-command-builds.patch => 0090-Rework-how-the-fdt-command-builds.patch (97%) rename 0092-Disable-non-wordsize-allocations-on-arm.patch => 0091-Disable-non-wordsize-allocations-on-arm.patch (100%) rename 0093-Prepend-prefix-when-HTTP-path-is-relative.patch => 0092-Prepend-prefix-when-HTTP-path-is-relative.patch (100%) rename 0094-Make-grub_error-more-verbose.patch => 0093-Make-grub_error-more-verbose.patch (100%) rename 0095-Make-reset-an-alias-for-the-reboot-command.patch => 0094-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0096-Add-a-version-command.patch => 0095-Add-a-version-command.patch (99%) rename 0097-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (100%) rename 0098-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch (100%) rename 0099-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch (100%) rename 0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (98%) rename 0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (100%) rename 0102-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0103-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0104-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (100%) rename 0105-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (100%) rename 0106-Fix-getroot.c-s-trampolines.patch => 0105-Fix-getroot.c-s-trampolines.patch (100%) rename 0107-Do-not-allow-stack-trampolines-anywhere.patch => 0106-Do-not-allow-stack-trampolines-anywhere.patch (100%) rename 0108-Reimplement-boot_counter.patch => 0107-Reimplement-boot_counter.patch (99%) rename 0109-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0108-Fix-menu-entry-selection-based-on-ID-and-title.patch (100%) rename 0110-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch (100%) rename 0111-Add-efi-export-env-and-efi-load-env-commands.patch => 0110-Add-efi-export-env-and-efi-load-env-commands.patch (99%) rename 0112-Make-it-possible-to-subtract-conditions-from-debug.patch => 0111-Make-it-possible-to-subtract-conditions-from-debug.patch (100%) rename 0113-Export-all-variables-from-the-initial-context-when-c.patch => 0112-Export-all-variables-from-the-initial-context-when-c.patch (100%) rename 0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (100%) rename 0117-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch (100%) delete mode 100644 0115-Fix-systemctl-kexec-exit-status-check.patch rename 0118-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch (100%) delete mode 100644 0116-Print-grub-emu-linux-loader-messages-as-debug.patch rename 0119-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (100%) rename 0120-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (100%) rename 0121-Add-start-symbol-for-RISC-V.patch => 0118-Add-start-symbol-for-RISC-V.patch (100%) rename 0122-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (100%) rename 0123-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch (100%) rename 0124-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (100%) rename 0125-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (100%) rename 0126-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (100%) rename 0127-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch (100%) rename 0128-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (100%) rename 0129-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (100%) rename 0130-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch => 0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch (100%) rename 0131-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (100%) rename 0132-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (100%) rename 0133-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (100%) rename 0134-efi-dhcp-fix-some-allocation-error-checking.patch => 0131-efi-dhcp-fix-some-allocation-error-checking.patch (100%) rename 0135-efi-http-fix-some-allocation-error-checking.patch => 0132-efi-http-fix-some-allocation-error-checking.patch (100%) rename 0136-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (100%) rename 0137-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (100%) rename 0138-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch (100%) rename 0139-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (100%) rename 0140-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (100%) rename 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (100%) rename 0142-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (100%) rename 0143-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (100%) rename 0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch (100%) rename 0145-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (100%) rename 0146-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (100%) rename 0147-grub-install-disable-support-for-EFI-platforms.patch => 0144-grub-install-disable-support-for-EFI-platforms.patch (100%) rename 0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch (100%) rename 0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (100%) rename 0150-Introduce-function-grub_debug_is_enabled-void-return.patch => 0147-Introduce-function-grub_debug_is_enabled-void-return.patch (100%) rename 0151-Don-t-clear-screen-when-debugging-is-enabled.patch => 0148-Don-t-clear-screen-when-debugging-is-enabled.patch (100%) rename 0152-kern-file-Fix-error-handling-in-grub_file_open.patch => 0149-kern-file-Fix-error-handling-in-grub_file_open.patch (100%) rename 0153-grub_file_-instrumentation-new-file-debug-tag.patch => 0150-grub_file_-instrumentation-new-file-debug-tag.patch (100%) rename 0154-ieee1275-Avoiding-many-unecessary-open-close.patch => 0151-ieee1275-Avoiding-many-unecessary-open-close.patch (100%) rename 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (100%) rename 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0153-ieee1275-powerpc-enables-device-mapper-discovery.patch (100%) rename 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (100%) rename 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch (100%) rename 0159-docs-grub-Document-signing-grub-under-UEFI.patch => 0156-docs-grub-Document-signing-grub-under-UEFI.patch (100%) rename 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch (100%) rename 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (100%) rename 0162-pgp-factor-out-rsa_pad.patch => 0159-pgp-factor-out-rsa_pad.patch (98%) rename 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (100%) rename 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (100%) rename 0165-libtasn1-import-libtasn1-4.16.0.patch => 0162-libtasn1-import-libtasn1-4.16.0.patch (100%) rename 0166-libtasn1-disable-code-not-needed-in-grub.patch => 0163-libtasn1-disable-code-not-needed-in-grub.patch (100%) rename 0167-libtasn1-changes-for-grub-compatibility.patch => 0164-libtasn1-changes-for-grub-compatibility.patch (100%) rename 0168-libtasn1-compile-into-asn1-module.patch => 0165-libtasn1-compile-into-asn1-module.patch (97%) rename 0169-test_asn1-test-module-for-libtasn1.patch => 0166-test_asn1-test-module-for-libtasn1.patch (99%) rename 0170-grub-install-support-embedding-x509-certificates.patch => 0167-grub-install-support-embedding-x509-certificates.patch (100%) rename 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (100%) rename 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (100%) rename 0173-appended-signatures-support-verifying-appended-signa.patch => 0170-appended-signatures-support-verifying-appended-signa.patch (99%) rename 0174-appended-signatures-verification-tests.patch => 0171-appended-signatures-verification-tests.patch (99%) rename 0175-appended-signatures-documentation.patch => 0172-appended-signatures-documentation.patch (100%) rename 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (98%) rename 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch => 0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch (100%) rename 0178-ieee1275-claim-more-memory.patch => 0175-ieee1275-claim-more-memory.patch (100%) rename 0179-ieee1275-request-memory-with-ibm-client-architecture.patch => 0176-ieee1275-request-memory-with-ibm-client-architecture.patch (100%) rename 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0177-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) rename 0181-ieee1275-ofdisk-retry-on-open-failure.patch => 0178-ieee1275-ofdisk-retry-on-open-failure.patch (100%) rename 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0179-Allow-chainloading-EFI-apps-from-loop-mounts.patch (100%) rename 0183-efinet-Add-DHCP-proxy-support.patch => 0180-efinet-Add-DHCP-proxy-support.patch (100%) rename 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0181-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0182-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (100%) rename 0186-Suppress-gettext-error-message.patch => 0183-Suppress-gettext-error-message.patch (100%) rename 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0184-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) rename 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0185-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) rename 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0186-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0187-arm64-Fix-EFI-loader-kernel-image-allocation.patch (100%) rename 0191-normal-main-Discover-the-device-to-read-the-config-f.patch => 0188-normal-main-Discover-the-device-to-read-the-config-f.patch (100%) rename 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0189-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (100%) rename 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0190-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) rename 0194-Print-module-name-on-license-check-failure.patch => 0191-Print-module-name-on-license-check-failure.patch (100%) rename 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (99%) rename 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0193-grub-mkconfig-restore-umask-for-grub.cfg.patch (100%) rename 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0194-fs-btrfs-Use-full-btrfs-bootloader-area.patch (100%) rename 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch => 0195-Add-Fedora-location-of-DejaVu-SANS-font.patch (100%) rename 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch => 0196-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch (100%) rename 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch => 0197-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch (100%) rename 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch => 0198-EFI-console-Do-not-set-colorstate-until-the-first-te.patch (100%) rename 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch => 0199-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch (100%) rename 0203-Use-visual-indentation-in-config.h.in.patch => 0200-Use-visual-indentation-in-config.h.in.patch (100%) rename 0204-Where-present-ensure-config-util.h-precedes-config.h.patch => 0201-Where-present-ensure-config-util.h-precedes-config.h.patch (99%) rename 0205-Drop-gnulib-fix-base64.patch.patch => 0202-Drop-gnulib-fix-base64.patch.patch (100%) rename 0206-Drop-gnulib-no-abort.patch.patch => 0203-Drop-gnulib-no-abort.patch.patch (100%) rename 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch => 0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch (99%) rename 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch => 0205-commands-search-Fix-bug-stopping-iteration-when-no-f.patch (100%) rename 0209-search-new-efidisk-only-option-on-EFI-systems.patch => 0206-search-new-efidisk-only-option-on-EFI-systems.patch (100%) rename 0210-efi-new-connectefi-command.patch => 0207-efi-new-connectefi-command.patch (99%) rename 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch => 0208-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch (100%) rename 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch => 0209-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch (100%) rename 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch => 0210-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch (100%) rename 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch => 0211-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch (100%) rename 0215-powerpc-do-CAS-in-a-more-compatible-way.patch => 0212-powerpc-do-CAS-in-a-more-compatible-way.patch (100%) rename 0216-powerpc-prefix-detection-support-device-names-with-c.patch => 0213-powerpc-prefix-detection-support-device-names-with-c.patch (100%) rename 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch => 0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch (99%) rename 0218-make-ofdisk_retries-optional.patch => 0215-make-ofdisk_retries-optional.patch (100%) rename 0219-loader-efi-chainloader-grub_load_and_start_image-doe.patch => 0216-loader-efi-chainloader-grub_load_and_start_image-doe.patch (100%) rename 0220-loader-efi-chainloader-simplify-the-loader-state.patch => 0217-loader-efi-chainloader-simplify-the-loader-state.patch (100%) rename 0221-commands-boot-Add-API-to-pass-context-to-loader.patch => 0218-commands-boot-Add-API-to-pass-context-to-loader.patch (100%) rename 0222-loader-efi-chainloader-Use-grub_loader_set_ex.patch => 0219-loader-efi-chainloader-Use-grub_loader_set_ex.patch (100%) rename 0223-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch => 0220-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch (100%) rename 0224-loader-i386-efi-linux-Use-grub_loader_set_ex.patch => 0221-loader-i386-efi-linux-Use-grub_loader_set_ex.patch (100%) rename 0225-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch => 0222-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch (100%) rename 0226-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch => 0223-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch (100%) rename 0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch => 0224-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch (100%) rename 0228-video-readers-png-Abort-sooner-if-a-read-operation-f.patch => 0225-video-readers-png-Abort-sooner-if-a-read-operation-f.patch (100%) rename 0229-video-readers-png-Refuse-to-handle-multiple-image-he.patch => 0226-video-readers-png-Refuse-to-handle-multiple-image-he.patch (100%) rename 0230-video-readers-png-Drop-greyscale-support-to-fix-heap.patch => 0227-video-readers-png-Drop-greyscale-support-to-fix-heap.patch (100%) rename 0231-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch => 0228-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch (100%) rename 0232-video-readers-png-Sanity-check-some-huffman-codes.patch => 0229-video-readers-png-Sanity-check-some-huffman-codes.patch (100%) rename 0233-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch => 0230-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch (100%) rename 0234-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch => 0231-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch (100%) rename 0235-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch => 0232-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch (100%) rename 0236-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch => 0233-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch (100%) rename 0237-normal-charset-Fix-array-out-of-bounds-formatting-un.patch => 0234-normal-charset-Fix-array-out-of-bounds-formatting-un.patch (100%) rename 0238-net-netbuff-Block-overly-large-netbuff-allocs.patch => 0235-net-netbuff-Block-overly-large-netbuff-allocs.patch (100%) rename 0239-net-ip-Do-IP-fragment-maths-safely.patch => 0236-net-ip-Do-IP-fragment-maths-safely.patch (100%) rename 0240-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch => 0237-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch (100%) rename 0241-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch => 0238-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch (100%) rename 0242-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch => 0239-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch (100%) rename 0243-net-tftp-Avoid-a-trivial-UAF.patch => 0240-net-tftp-Avoid-a-trivial-UAF.patch (100%) rename 0244-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch => 0241-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch (100%) rename 0245-net-http-Fix-OOB-write-for-split-http-headers.patch => 0242-net-http-Fix-OOB-write-for-split-http-headers.patch (100%) rename 0246-net-http-Error-out-on-headers-with-LF-without-CR.patch => 0243-net-http-Error-out-on-headers-with-LF-without-CR.patch (100%) rename 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch => 0244-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch (100%) rename 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch => 0245-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch (100%) rename 0249-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch => 0246-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch (100%) rename 0250-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch => 0247-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch (100%) rename 0251-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch => 0248-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch (100%) rename 0252-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch => 0249-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch (100%) rename 0253-misc-Make-grub_min-and-grub_max-more-resilient.patch => 0250-misc-Make-grub_min-and-grub_max-more-resilient.patch (100%) rename 0254-ReiserFS-switch-to-using-grub_min-grub_max.patch => 0251-ReiserFS-switch-to-using-grub_min-grub_max.patch (100%) rename 0255-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch => 0252-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch (100%) rename 0256-modules-make-.module_license-read-only.patch => 0253-modules-make-.module_license-read-only.patch (100%) rename 0257-modules-strip-.llvm_addrsig-sections-and-similar.patch => 0254-modules-strip-.llvm_addrsig-sections-and-similar.patch (100%) rename 0258-modules-Don-t-allocate-space-for-non-allocable-secti.patch => 0255-modules-Don-t-allocate-space-for-non-allocable-secti.patch (100%) rename 0259-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch => 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch (100%) rename 0260-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch => 0257-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch (100%) rename 0261-modules-load-module-sections-at-page-aligned-address.patch => 0258-modules-load-module-sections-at-page-aligned-address.patch (100%) rename 0262-nx-add-memory-attribute-get-set-API.patch => 0259-nx-add-memory-attribute-get-set-API.patch (100%) rename 0263-nx-set-page-permissions-for-loaded-modules.patch => 0260-nx-set-page-permissions-for-loaded-modules.patch (100%) rename 0264-nx-set-attrs-in-our-kernel-loaders.patch => 0261-nx-set-attrs-in-our-kernel-loaders.patch (100%) rename 0265-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch => 0262-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch (100%) rename 0266-grub-probe-document-the-behavior-of-multiple-v.patch => 0263-grub-probe-document-the-behavior-of-multiple-v.patch (100%) rename 0267-grub_fs_probe-dprint-errors-from-filesystems.patch => 0264-grub_fs_probe-dprint-errors-from-filesystems.patch (100%) rename 0268-fs-fat-don-t-error-when-mtime-is-0.patch => 0265-fs-fat-don-t-error-when-mtime-is-0.patch (100%) rename 0269-Make-debug-file-show-which-file-filters-get-run.patch => 0266-Make-debug-file-show-which-file-filters-get-run.patch (100%) rename 0270-efi-use-enumerated-array-positions-for-our-allocatio.patch => 0267-efi-use-enumerated-array-positions-for-our-allocatio.patch (100%) rename 0271-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch => 0268-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch (100%) rename 0272-efi-allocate-the-initrd-within-the-bounds-expressed-.patch => 0269-efi-allocate-the-initrd-within-the-bounds-expressed-.patch (100%) rename 0273-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch => 0270-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch (100%) rename 0274-BLS-create-etc-kernel-cmdline-during-mkconfig.patch => 0271-BLS-create-etc-kernel-cmdline-during-mkconfig.patch (100%) rename 0275-squish-don-t-dup-rhgb-quiet-check-mtimes.patch => 0272-squish-don-t-dup-rhgb-quiet-check-mtimes.patch (100%) rename 0276-squish-give-up-on-rhgb-quiet.patch => 0273-squish-give-up-on-rhgb-quiet.patch (100%) rename 0277-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch => 0274-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch (100%) rename 0278-ieee1275-implement-vec5-for-cas-negotiation.patch => 0275-ieee1275-implement-vec5-for-cas-negotiation.patch (100%) rename 0279-blscfg-Don-t-root-device-in-emu-builds.patch => 0276-blscfg-Don-t-root-device-in-emu-builds.patch (100%) rename 0280-loader-arm64-linux-Remove-magic-number-header-field-.patch => 0277-loader-arm64-linux-Remove-magic-number-header-field-.patch (100%) rename 0281-Correct-BSS-zeroing-on-aarch64.patch => 0278-Correct-BSS-zeroing-on-aarch64.patch (100%) rename 0282-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch => 0279-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch (100%) rename 0283-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch => 0280-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch (100%) rename 0284-commands-efi-tpm-Refine-the-status-of-log-event.patch => 0281-commands-efi-tpm-Refine-the-status-of-log-event.patch (100%) rename 0285-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch => 0282-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch (100%) rename 0286-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch => 0283-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch (100%) rename 0287-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch => 0284-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch (100%) rename 0288-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch => 0285-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch (100%) rename 0289-font-Fix-several-integer-overflows-in-grub_font_cons.patch => 0286-font-Fix-several-integer-overflows-in-grub_font_cons.patch (100%) rename 0290-font-Remove-grub_font_dup_glyph.patch => 0287-font-Remove-grub_font_dup_glyph.patch (100%) rename 0291-font-Fix-integer-overflow-in-ensure_comb_space.patch => 0288-font-Fix-integer-overflow-in-ensure_comb_space.patch (100%) rename 0292-font-Fix-integer-overflow-in-BMP-index.patch => 0289-font-Fix-integer-overflow-in-BMP-index.patch (100%) rename 0293-font-Fix-integer-underflow-in-binary-search-of-char-.patch => 0290-font-Fix-integer-underflow-in-binary-search-of-char-.patch (100%) rename 0294-kern-efi-sb-Enforce-verification-of-font-files.patch => 0291-kern-efi-sb-Enforce-verification-of-font-files.patch (100%) rename 0295-fbutil-Fix-integer-overflow.patch => 0292-fbutil-Fix-integer-overflow.patch (100%) rename 0296-font-Fix-an-integer-underflow-in-blit_comb.patch => 0293-font-Fix-an-integer-underflow-in-blit_comb.patch (100%) rename 0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch => 0294-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch (100%) rename 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch => 0295-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch (100%) rename 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch => 0296-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch (100%) rename 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch => 0297-font-Try-opening-fonts-from-the-bundled-memdisk.patch (100%) create mode 100644 0298-Correction-in-vector-5-values.patch rename 0301-mm-Clarify-grub_real_malloc.patch => 0299-mm-Clarify-grub_real_malloc.patch (100%) rename 0302-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch => 0300-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch (100%) rename 0303-mm-Document-grub_free.patch => 0301-mm-Document-grub_free.patch (100%) rename 0304-mm-Document-grub_mm_init_region.patch => 0302-mm-Document-grub_mm_init_region.patch (100%) rename 0305-mm-Document-GRUB-internal-memory-management-structur.patch => 0303-mm-Document-GRUB-internal-memory-management-structur.patch (100%) rename 0306-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch => 0304-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch (100%) rename 0307-mm-When-adding-a-region-merge-with-region-after-as-w.patch => 0305-mm-When-adding-a-region-merge-with-region-after-as-w.patch (100%) rename 0308-mm-Debug-support-for-region-operations.patch => 0306-mm-Debug-support-for-region-operations.patch (100%) rename 0309-mm-Drop-unused-unloading-of-modules-on-OOM.patch => 0307-mm-Drop-unused-unloading-of-modules-on-OOM.patch (100%) rename 0310-mm-Allow-dynamically-requesting-additional-memory-re.patch => 0308-mm-Allow-dynamically-requesting-additional-memory-re.patch (100%) rename 0311-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch => 0309-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch (100%) rename 0312-kern-efi-mm-Extract-function-to-add-memory-regions.patch => 0310-kern-efi-mm-Extract-function-to-add-memory-regions.patch (100%) rename 0313-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch => 0311-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch (100%) rename 0314-kern-efi-mm-Implement-runtime-addition-of-pages.patch => 0312-kern-efi-mm-Implement-runtime-addition-of-pages.patch (100%) rename 0315-efi-Increase-default-memory-allocation-to-32-MiB.patch => 0313-efi-Increase-default-memory-allocation-to-32-MiB.patch (100%) rename 0316-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch => 0314-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch (100%) rename 0317-ppc64le-signed-boot-media-changes.patch => 0315-ppc64le-signed-boot-media-changes.patch (100%) rename 0318-core-Fix-several-implicit-function-declarations.patch => 0316-core-Fix-several-implicit-function-declarations.patch (100%) rename 0060-Add-linux-and-initrd-commands-for-grub-emu.patch => 0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch (51%) delete mode 100644 0319-Enable-shared-processor-mode-in-vector-5.patch diff --git a/0061-Add-grub2-switch-to-blscfg.patch b/0060-Add-grub2-switch-to-blscfg.patch similarity index 100% rename from 0061-Add-grub2-switch-to-blscfg.patch rename to 0060-Add-grub2-switch-to-blscfg.patch diff --git a/0062-make-better-backtraces.patch b/0061-make-better-backtraces.patch similarity index 99% rename from 0062-make-better-backtraces.patch rename to 0061-make-better-backtraces.patch index e6ae4e96..7fdcaf74 100644 --- a/0062-make-better-backtraces.patch +++ b/0061-make-better-backtraces.patch @@ -55,7 +55,7 @@ index 88f55e35c4..bda9fd1211 100644 library = { diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 5354f9613d..4b7c45a7b0 100644 +index 058c88ac3a..52ec0fafcd 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -142,6 +142,12 @@ kernel = { @@ -81,7 +81,7 @@ index 5354f9613d..4b7c45a7b0 100644 i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; i386_xen_pvh = kern/i386/dl.c; -@@ -2398,15 +2401,12 @@ module = { +@@ -2399,15 +2402,12 @@ module = { module = { name = backtrace; @@ -897,7 +897,7 @@ index 03b916f053..701bf63abc 100644 ba codestart mov %o4, %o0 diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index 80e7a83edf..f512573c0d 100644 +index ee88e44e97..bfd29a3bf0 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h diff --git a/0063-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 100% rename from 0063-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch diff --git a/0064-Work-around-some-minor-include-path-weirdnesses.patch b/0063-Work-around-some-minor-include-path-weirdnesses.patch similarity index 100% rename from 0064-Work-around-some-minor-include-path-weirdnesses.patch rename to 0063-Work-around-some-minor-include-path-weirdnesses.patch diff --git a/0065-Make-it-possible-to-enabled-build-id-sha1.patch b/0064-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 100% rename from 0065-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0064-Make-it-possible-to-enabled-build-id-sha1.patch diff --git a/0066-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 100% rename from 0066-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch diff --git a/0067-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch similarity index 100% rename from 0067-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename to 0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch diff --git a/0068-Fixup-for-newer-compiler.patch b/0067-Fixup-for-newer-compiler.patch similarity index 100% rename from 0068-Fixup-for-newer-compiler.patch rename to 0067-Fixup-for-newer-compiler.patch diff --git a/0069-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 100% rename from 0069-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch diff --git a/0070-Fixup-for-newer-compiler.patch b/0069-Fixup-for-newer-compiler.patch similarity index 100% rename from 0070-Fixup-for-newer-compiler.patch rename to 0069-Fixup-for-newer-compiler.patch diff --git a/0071-Add-support-for-non-Ethernet-network-cards.patch b/0070-Add-support-for-non-Ethernet-network-cards.patch similarity index 100% rename from 0071-Add-support-for-non-Ethernet-network-cards.patch rename to 0070-Add-support-for-non-Ethernet-network-cards.patch diff --git a/0072-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch similarity index 100% rename from 0072-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename to 0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch diff --git a/0073-bootp-New-net_bootp6-command.patch b/0072-bootp-New-net_bootp6-command.patch similarity index 100% rename from 0073-bootp-New-net_bootp6-command.patch rename to 0072-bootp-New-net_bootp6-command.patch diff --git a/0074-efinet-UEFI-IPv6-PXE-support.patch b/0073-efinet-UEFI-IPv6-PXE-support.patch similarity index 100% rename from 0074-efinet-UEFI-IPv6-PXE-support.patch rename to 0073-efinet-UEFI-IPv6-PXE-support.patch diff --git a/0075-grub.texi-Add-net_bootp6-doument.patch b/0074-grub.texi-Add-net_bootp6-doument.patch similarity index 100% rename from 0075-grub.texi-Add-net_bootp6-doument.patch rename to 0074-grub.texi-Add-net_bootp6-doument.patch diff --git a/0076-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 100% rename from 0076-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch diff --git a/0077-efinet-Setting-network-from-UEFI-device-path.patch b/0076-efinet-Setting-network-from-UEFI-device-path.patch similarity index 100% rename from 0077-efinet-Setting-network-from-UEFI-device-path.patch rename to 0076-efinet-Setting-network-from-UEFI-device-path.patch diff --git a/0078-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 100% rename from 0078-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch diff --git a/0079-Support-UEFI-networking-protocols.patch b/0078-Support-UEFI-networking-protocols.patch similarity index 99% rename from 0079-Support-UEFI-networking-protocols.patch rename to 0078-Support-UEFI-networking-protocols.patch index 740a9f87..145becfd 100644 --- a/0079-Support-UEFI-networking-protocols.patch +++ b/0078-Support-UEFI-networking-protocols.patch @@ -57,10 +57,10 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/net/efi.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 4b7c45a7b0..c40170f2dd 100644 +index 52ec0fafcd..12797336c9 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2299,6 +2299,12 @@ module = { +@@ -2300,6 +2300,12 @@ module = { common = hook/datehook.c; }; @@ -73,7 +73,7 @@ index 4b7c45a7b0..c40170f2dd 100644 module = { name = net; common = net/net.c; -@@ -2312,6 +2318,12 @@ module = { +@@ -2313,6 +2319,12 @@ module = { common = net/ethernet.c; common = net/arp.c; common = net/netbuff.c; diff --git a/0080-AUDIT-0-http-boot-tracker-bug.patch b/0079-AUDIT-0-http-boot-tracker-bug.patch similarity index 100% rename from 0080-AUDIT-0-http-boot-tracker-bug.patch rename to 0079-AUDIT-0-http-boot-tracker-bug.patch diff --git a/0081-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 100% rename from 0081-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch diff --git a/0082-Add-auto-hide-menu-support.patch b/0081-Add-auto-hide-menu-support.patch similarity index 100% rename from 0082-Add-auto-hide-menu-support.patch rename to 0081-Add-auto-hide-menu-support.patch diff --git a/0083-Add-grub-set-bootflag-utility.patch b/0082-Add-grub-set-bootflag-utility.patch similarity index 100% rename from 0083-Add-grub-set-bootflag-utility.patch rename to 0082-Add-grub-set-bootflag-utility.patch diff --git a/0084-docs-Add-grub-boot-indeterminate.service-example.patch b/0083-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 100% rename from 0084-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0083-docs-Add-grub-boot-indeterminate.service-example.patch diff --git a/0085-gentpl-add-disable-support.patch b/0084-gentpl-add-disable-support.patch similarity index 100% rename from 0085-gentpl-add-disable-support.patch rename to 0084-gentpl-add-disable-support.patch diff --git a/0086-gentpl-add-pc-firmware-type.patch b/0085-gentpl-add-pc-firmware-type.patch similarity index 100% rename from 0086-gentpl-add-pc-firmware-type.patch rename to 0085-gentpl-add-pc-firmware-type.patch diff --git a/0087-efinet-also-use-the-firmware-acceleration-for-http.patch b/0086-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0087-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0086-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0088-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0088-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 100% rename from 0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch diff --git a/0090-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0089-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0090-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0089-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0091-Rework-how-the-fdt-command-builds.patch b/0090-Rework-how-the-fdt-command-builds.patch similarity index 97% rename from 0091-Rework-how-the-fdt-command-builds.patch rename to 0090-Rework-how-the-fdt-command-builds.patch index a374f90e..8f412723 100644 --- a/0091-Rework-how-the-fdt-command-builds.patch +++ b/0090-Rework-how-the-fdt-command-builds.patch @@ -25,7 +25,7 @@ Signed-off-by: Robbie Harwood 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c40170f2dd..84a3d89de9 100644 +index 12797336c9..4e7d90da76 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -177,7 +177,6 @@ kernel = { @@ -53,7 +53,7 @@ index c40170f2dd..84a3d89de9 100644 common = loader/linux.c; common = lib/cmdline.c; -@@ -1836,7 +1836,6 @@ module = { +@@ -1837,7 +1837,6 @@ module = { module = { name = fdt; efi = loader/efi/fdt.c; @@ -110,7 +110,7 @@ index e609c7e411..3514aa4a5b 100644 + #endif /* ! GRUB_FDT_HEADER */ diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index f512573c0d..dd49939aaa 100644 +index bfd29a3bf0..c2e8a82bce 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h diff --git a/0092-Disable-non-wordsize-allocations-on-arm.patch b/0091-Disable-non-wordsize-allocations-on-arm.patch similarity index 100% rename from 0092-Disable-non-wordsize-allocations-on-arm.patch rename to 0091-Disable-non-wordsize-allocations-on-arm.patch diff --git a/0093-Prepend-prefix-when-HTTP-path-is-relative.patch b/0092-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 100% rename from 0093-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0092-Prepend-prefix-when-HTTP-path-is-relative.patch diff --git a/0094-Make-grub_error-more-verbose.patch b/0093-Make-grub_error-more-verbose.patch similarity index 100% rename from 0094-Make-grub_error-more-verbose.patch rename to 0093-Make-grub_error-more-verbose.patch diff --git a/0095-Make-reset-an-alias-for-the-reboot-command.patch b/0094-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0095-Make-reset-an-alias-for-the-reboot-command.patch rename to 0094-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0096-Add-a-version-command.patch b/0095-Add-a-version-command.patch similarity index 99% rename from 0096-Add-a-version-command.patch rename to 0095-Add-a-version-command.patch index 10d40b32..18c355c2 100644 --- a/0096-Add-a-version-command.patch +++ b/0095-Add-a-version-command.patch @@ -43,7 +43,7 @@ index 54462e0892..7b4e1854d3 100644 have_with_bootdir=n AC_ARG_WITH([bootdir], diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 84a3d89de9..498ca11762 100644 +index 4e7d90da76..4f203533f5 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -579,6 +579,11 @@ image = { diff --git a/0097-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 100% rename from 0097-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch diff --git a/0098-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 100% rename from 0098-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch diff --git a/0099-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 100% rename from 0099-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch diff --git a/0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 98% rename from 0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index e94df4e7..77db523d 100644 --- a/0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -18,10 +18,10 @@ Signed-off-by: Peter Jones 10 files changed, 17 insertions(+), 16 deletions(-) diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index eeea092752..f08a1bb841 100644 +index 0ff13bcaf8..d278c2921f 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -189,7 +189,7 @@ grub_util_get_image_size (const char *path) +@@ -185,7 +185,7 @@ grub_util_get_image_size (const char *path) sz = ftello (f); if (sz < 0) grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); diff --git a/0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 100% rename from 0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch diff --git a/0102-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0102-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0103-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0103-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0104-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 100% rename from 0104-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch diff --git a/0105-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 100% rename from 0105-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch diff --git a/0106-Fix-getroot.c-s-trampolines.patch b/0105-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0106-Fix-getroot.c-s-trampolines.patch rename to 0105-Fix-getroot.c-s-trampolines.patch diff --git a/0107-Do-not-allow-stack-trampolines-anywhere.patch b/0106-Do-not-allow-stack-trampolines-anywhere.patch similarity index 100% rename from 0107-Do-not-allow-stack-trampolines-anywhere.patch rename to 0106-Do-not-allow-stack-trampolines-anywhere.patch diff --git a/0108-Reimplement-boot_counter.patch b/0107-Reimplement-boot_counter.patch similarity index 99% rename from 0108-Reimplement-boot_counter.patch rename to 0107-Reimplement-boot_counter.patch index 6104b87d..d018de43 100644 --- a/0108-Reimplement-boot_counter.patch +++ b/0107-Reimplement-boot_counter.patch @@ -40,7 +40,7 @@ index d066652e9b..e10fe766d1 100644 name = '01_menu_auto_hide'; common = util/grub.d/01_menu_auto_hide.in; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 498ca11762..1e15345107 100644 +index 4f203533f5..ea4d59f51b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -398,6 +398,11 @@ kernel = { diff --git a/0109-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0108-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 100% rename from 0109-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0108-Fix-menu-entry-selection-based-on-ID-and-title.patch diff --git a/0110-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 100% rename from 0110-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch diff --git a/0111-Add-efi-export-env-and-efi-load-env-commands.patch b/0110-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 99% rename from 0111-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0110-Add-efi-export-env-and-efi-load-env-commands.patch index ac028764..33d27240 100644 --- a/0111-Add-efi-export-env-and-efi-load-env-commands.patch +++ b/0110-Add-efi-export-env-and-efi-load-env-commands.patch @@ -21,7 +21,7 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/efi/env.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 1e15345107..81fc274148 100644 +index ea4d59f51b..dc9fea6f44 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -820,6 +820,12 @@ module = { diff --git a/0112-Make-it-possible-to-subtract-conditions-from-debug.patch b/0111-Make-it-possible-to-subtract-conditions-from-debug.patch similarity index 100% rename from 0112-Make-it-possible-to-subtract-conditions-from-debug.patch rename to 0111-Make-it-possible-to-subtract-conditions-from-debug.patch diff --git a/0113-Export-all-variables-from-the-initial-context-when-c.patch b/0112-Export-all-variables-from-the-initial-context-when-c.patch similarity index 100% rename from 0113-Export-all-variables-from-the-initial-context-when-c.patch rename to 0112-Export-all-variables-from-the-initial-context-when-c.patch diff --git a/0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 100% rename from 0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch diff --git a/0117-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 100% rename from 0117-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch diff --git a/0115-Fix-systemctl-kexec-exit-status-check.patch b/0115-Fix-systemctl-kexec-exit-status-check.patch deleted file mode 100644 index 567e6786..00000000 --- a/0115-Fix-systemctl-kexec-exit-status-check.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 9 Apr 2019 12:30:38 +0200 -Subject: [PATCH] Fix systemctl kexec exit status check - -There's always an error printed even when the systemctl kexec command does -succeed. That's because systemctl executes it asynchronously, but the emu -loader seems to expect it to be synchronous and that should never return. - -Also, it's wrong to test if kexecute == 1 since we already know that's the -case or otherwise the function wouldn't had called grub_fatal() earlier. - -Finally, systemctl kexec failing shouldn't be a fatal error since the emu -loader fallbacks to executing the kexec command in case of a failure. - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/loader/emu/linux.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -index fda9e00d24..5b85b225ee 100644 ---- a/grub-core/loader/emu/linux.c -+++ b/grub-core/loader/emu/linux.c -@@ -71,8 +71,10 @@ grub_linux_boot (void) - (kexecute==1) ? "do-or-die" : "just-in-case"); - rc = grub_util_exec (systemctl); - -- if (kexecute == 1) -- grub_fatal (N_("Error trying to perform 'systemctl kexec'")); -+ if (rc == GRUB_ERR_NONE) -+ return rc; -+ -+ grub_error (rc, N_("Error trying to perform 'systemctl kexec'")); - - /* need to check read-only root before resetting hard!? */ - grub_printf("Performing 'kexec -e'"); diff --git a/0118-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 100% rename from 0118-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch diff --git a/0116-Print-grub-emu-linux-loader-messages-as-debug.patch b/0116-Print-grub-emu-linux-loader-messages-as-debug.patch deleted file mode 100644 index 2718a70b..00000000 --- a/0116-Print-grub-emu-linux-loader-messages-as-debug.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 9 Apr 2019 12:42:37 +0200 -Subject: [PATCH] Print grub-emu linux loader messages as debug - -They just polute the output and should better be debug messages instead. - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/loader/emu/linux.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -index 5b85b225ee..22ab6af172 100644 ---- a/grub-core/loader/emu/linux.c -+++ b/grub-core/loader/emu/linux.c -@@ -50,7 +50,7 @@ grub_linux_boot (void) - initrd_param = grub_xasprintf("%s", ""); - } - -- grub_printf("%serforming 'kexec -l %s %s %s'\n", -+ grub_dprintf ("linux", "%serforming 'kexec -l %s %s %s'\n", - (kexecute) ? "P" : "Not p", - kernel_path, initrd_param, boot_cmdline); - -@@ -67,7 +67,7 @@ grub_linux_boot (void) - if (kexecute < 1) - grub_fatal (N_("Use '"PACKAGE"-emu --kexec' to force a system restart.")); - -- grub_printf("Performing 'systemctl kexec' (%s) ", -+ grub_dprintf ("linux", "Performing 'systemctl kexec' (%s) ", - (kexecute==1) ? "do-or-die" : "just-in-case"); - rc = grub_util_exec (systemctl); - diff --git a/0119-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 100% rename from 0119-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch diff --git a/0120-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 100% rename from 0120-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch diff --git a/0121-Add-start-symbol-for-RISC-V.patch b/0118-Add-start-symbol-for-RISC-V.patch similarity index 100% rename from 0121-Add-start-symbol-for-RISC-V.patch rename to 0118-Add-start-symbol-for-RISC-V.patch diff --git a/0122-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 100% rename from 0122-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch diff --git a/0123-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 100% rename from 0123-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch diff --git a/0124-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 100% rename from 0124-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch diff --git a/0125-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 100% rename from 0125-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch diff --git a/0126-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 100% rename from 0126-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch diff --git a/0127-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 100% rename from 0127-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch diff --git a/0128-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 100% rename from 0128-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch diff --git a/0129-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 100% rename from 0129-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch diff --git a/0130-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch similarity index 100% rename from 0130-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename to 0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch diff --git a/0131-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 100% rename from 0131-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch diff --git a/0132-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 100% rename from 0132-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch diff --git a/0133-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 100% rename from 0133-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch diff --git a/0134-efi-dhcp-fix-some-allocation-error-checking.patch b/0131-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 100% rename from 0134-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0131-efi-dhcp-fix-some-allocation-error-checking.patch diff --git a/0135-efi-http-fix-some-allocation-error-checking.patch b/0132-efi-http-fix-some-allocation-error-checking.patch similarity index 100% rename from 0135-efi-http-fix-some-allocation-error-checking.patch rename to 0132-efi-http-fix-some-allocation-error-checking.patch diff --git a/0136-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 100% rename from 0136-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch diff --git a/0137-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 100% rename from 0137-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch diff --git a/0138-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 100% rename from 0138-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch diff --git a/0139-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 100% rename from 0139-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch diff --git a/0140-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 100% rename from 0140-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch diff --git a/0141-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 100% rename from 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch diff --git a/0142-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 100% rename from 0142-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch diff --git a/0143-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 100% rename from 0143-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch diff --git a/0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 100% rename from 0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch diff --git a/0145-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 100% rename from 0145-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch diff --git a/0146-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 100% rename from 0146-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch diff --git a/0147-grub-install-disable-support-for-EFI-platforms.patch b/0144-grub-install-disable-support-for-EFI-platforms.patch similarity index 100% rename from 0147-grub-install-disable-support-for-EFI-platforms.patch rename to 0144-grub-install-disable-support-for-EFI-platforms.patch diff --git a/0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 100% rename from 0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch diff --git a/0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 100% rename from 0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch diff --git a/0150-Introduce-function-grub_debug_is_enabled-void-return.patch b/0147-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 100% rename from 0150-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0147-Introduce-function-grub_debug_is_enabled-void-return.patch diff --git a/0151-Don-t-clear-screen-when-debugging-is-enabled.patch b/0148-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 100% rename from 0151-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0148-Don-t-clear-screen-when-debugging-is-enabled.patch diff --git a/0152-kern-file-Fix-error-handling-in-grub_file_open.patch b/0149-kern-file-Fix-error-handling-in-grub_file_open.patch similarity index 100% rename from 0152-kern-file-Fix-error-handling-in-grub_file_open.patch rename to 0149-kern-file-Fix-error-handling-in-grub_file_open.patch diff --git a/0153-grub_file_-instrumentation-new-file-debug-tag.patch b/0150-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 100% rename from 0153-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0150-grub_file_-instrumentation-new-file-debug-tag.patch diff --git a/0154-ieee1275-Avoiding-many-unecessary-open-close.patch b/0151-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 100% rename from 0154-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0151-ieee1275-Avoiding-many-unecessary-open-close.patch diff --git a/0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 100% rename from 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch diff --git a/0156-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0153-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 100% rename from 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0153-ieee1275-powerpc-enables-device-mapper-discovery.patch diff --git a/0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 100% rename from 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch diff --git a/0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 100% rename from 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch diff --git a/0159-docs-grub-Document-signing-grub-under-UEFI.patch b/0156-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 100% rename from 0159-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0156-docs-grub-Document-signing-grub-under-UEFI.patch diff --git a/0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 100% rename from 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch diff --git a/0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 100% rename from 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch diff --git a/0162-pgp-factor-out-rsa_pad.patch b/0159-pgp-factor-out-rsa_pad.patch similarity index 98% rename from 0162-pgp-factor-out-rsa_pad.patch rename to 0159-pgp-factor-out-rsa_pad.patch index f1e721db..43fd8828 100644 --- a/0162-pgp-factor-out-rsa_pad.patch +++ b/0159-pgp-factor-out-rsa_pad.patch @@ -27,10 +27,10 @@ Signed-off-by: Daniel Axtens create mode 100644 include/grub/pkcs1_v15.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 81fc274148..97347ae76f 100644 +index dc9fea6f44..64cc758835 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2510,6 +2510,14 @@ module = { +@@ -2511,6 +2511,14 @@ module = { cppflags = '$(CPPFLAGS_GCRY)'; }; diff --git a/0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 100% rename from 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch diff --git a/0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch diff --git a/0165-libtasn1-import-libtasn1-4.16.0.patch b/0162-libtasn1-import-libtasn1-4.16.0.patch similarity index 100% rename from 0165-libtasn1-import-libtasn1-4.16.0.patch rename to 0162-libtasn1-import-libtasn1-4.16.0.patch diff --git a/0166-libtasn1-disable-code-not-needed-in-grub.patch b/0163-libtasn1-disable-code-not-needed-in-grub.patch similarity index 100% rename from 0166-libtasn1-disable-code-not-needed-in-grub.patch rename to 0163-libtasn1-disable-code-not-needed-in-grub.patch diff --git a/0167-libtasn1-changes-for-grub-compatibility.patch b/0164-libtasn1-changes-for-grub-compatibility.patch similarity index 100% rename from 0167-libtasn1-changes-for-grub-compatibility.patch rename to 0164-libtasn1-changes-for-grub-compatibility.patch diff --git a/0168-libtasn1-compile-into-asn1-module.patch b/0165-libtasn1-compile-into-asn1-module.patch similarity index 97% rename from 0168-libtasn1-compile-into-asn1-module.patch rename to 0165-libtasn1-compile-into-asn1-module.patch index b5574036..0fb433ff 100644 --- a/0168-libtasn1-compile-into-asn1-module.patch +++ b/0165-libtasn1-compile-into-asn1-module.patch @@ -14,10 +14,10 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/lib/libtasn1_wrap/wrap.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 97347ae76f..21d2c54185 100644 +index 64cc758835..ea92468fa2 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2576,3 +2576,18 @@ module = { +@@ -2577,3 +2577,18 @@ module = { common = commands/i386/wrmsr.c; enable = x86; }; diff --git a/0169-test_asn1-test-module-for-libtasn1.patch b/0166-test_asn1-test-module-for-libtasn1.patch similarity index 99% rename from 0169-test_asn1-test-module-for-libtasn1.patch rename to 0166-test_asn1-test-module-for-libtasn1.patch index c95a00b3..6cc13bd8 100644 --- a/0169-test_asn1-test-module-for-libtasn1.patch +++ b/0166-test_asn1-test-module-for-libtasn1.patch @@ -68,10 +68,10 @@ index 6366442129..d04b3fe68a 100644 testcase; name = example_unit_test; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 21d2c54185..b4aaccf7b5 100644 +index ea92468fa2..a32e6ada59 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2591,3 +2591,16 @@ module = { +@@ -2592,3 +2592,16 @@ module = { // -Wno-type-limits comes from libtasn1's configure.ac cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB) -I$(srcdir)/lib/libtasn1/lib -Wno-type-limits'; }; diff --git a/0170-grub-install-support-embedding-x509-certificates.patch b/0167-grub-install-support-embedding-x509-certificates.patch similarity index 100% rename from 0170-grub-install-support-embedding-x509-certificates.patch rename to 0167-grub-install-support-embedding-x509-certificates.patch diff --git a/0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 100% rename from 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch diff --git a/0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 100% rename from 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch diff --git a/0173-appended-signatures-support-verifying-appended-signa.patch b/0170-appended-signatures-support-verifying-appended-signa.patch similarity index 99% rename from 0173-appended-signatures-support-verifying-appended-signa.patch rename to 0170-appended-signatures-support-verifying-appended-signa.patch index 969293a4..9e90d3be 100644 --- a/0173-appended-signatures-support-verifying-appended-signa.patch +++ b/0170-appended-signatures-support-verifying-appended-signa.patch @@ -30,7 +30,7 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/appendedsig/appendedsig.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index b4aaccf7b5..77321d218c 100644 +index a32e6ada59..6404384d90 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -980,6 +980,18 @@ module = { diff --git a/0174-appended-signatures-verification-tests.patch b/0171-appended-signatures-verification-tests.patch similarity index 99% rename from 0174-appended-signatures-verification-tests.patch rename to 0171-appended-signatures-verification-tests.patch index 982b3c82..b39a5afe 100644 --- a/0174-appended-signatures-verification-tests.patch +++ b/0171-appended-signatures-verification-tests.patch @@ -17,10 +17,10 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/tests/appended_signatures.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 77321d218c..6bddc841b8 100644 +index 6404384d90..9ea5fb38f1 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2161,6 +2161,12 @@ module = { +@@ -2162,6 +2162,12 @@ module = { common = tests/setjmp_test.c; }; diff --git a/0175-appended-signatures-documentation.patch b/0172-appended-signatures-documentation.patch similarity index 100% rename from 0175-appended-signatures-documentation.patch rename to 0172-appended-signatures-documentation.patch diff --git a/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 98% rename from 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch index ed4c684a..c90cc7ea 100644 --- a/0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +++ b/0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Axtens 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 6bddc841b8..3f3459b2c7 100644 +index 9ea5fb38f1..4a57de975e 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -323,6 +323,7 @@ kernel = { diff --git a/0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch similarity index 100% rename from 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename to 0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch diff --git a/0178-ieee1275-claim-more-memory.patch b/0175-ieee1275-claim-more-memory.patch similarity index 100% rename from 0178-ieee1275-claim-more-memory.patch rename to 0175-ieee1275-claim-more-memory.patch diff --git a/0179-ieee1275-request-memory-with-ibm-client-architecture.patch b/0176-ieee1275-request-memory-with-ibm-client-architecture.patch similarity index 100% rename from 0179-ieee1275-request-memory-with-ibm-client-architecture.patch rename to 0176-ieee1275-request-memory-with-ibm-client-architecture.patch diff --git a/0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0177-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0177-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0181-ieee1275-ofdisk-retry-on-open-failure.patch b/0178-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0181-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0178-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0179-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 100% rename from 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0179-Allow-chainloading-EFI-apps-from-loop-mounts.patch diff --git a/0183-efinet-Add-DHCP-proxy-support.patch b/0180-efinet-Add-DHCP-proxy-support.patch similarity index 100% rename from 0183-efinet-Add-DHCP-proxy-support.patch rename to 0180-efinet-Add-DHCP-proxy-support.patch diff --git a/0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0181-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0181-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0182-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 100% rename from 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0182-Don-t-update-the-cmdline-when-generating-legacy-menu.patch diff --git a/0186-Suppress-gettext-error-message.patch b/0183-Suppress-gettext-error-message.patch similarity index 100% rename from 0186-Suppress-gettext-error-message.patch rename to 0183-Suppress-gettext-error-message.patch diff --git a/0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0184-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0184-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0185-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 100% rename from 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0185-templates-Check-for-EFI-at-runtime-instead-of-config.patch diff --git a/0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0186-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 100% rename from 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0186-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0187-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 100% rename from 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0187-arm64-Fix-EFI-loader-kernel-image-allocation.patch diff --git a/0191-normal-main-Discover-the-device-to-read-the-config-f.patch b/0188-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 100% rename from 0191-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0188-normal-main-Discover-the-device-to-read-the-config-f.patch diff --git a/0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0189-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 100% rename from 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0189-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch diff --git a/0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0190-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0190-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0194-Print-module-name-on-license-check-failure.patch b/0191-Print-module-name-on-license-check-failure.patch similarity index 100% rename from 0194-Print-module-name-on-license-check-failure.patch rename to 0191-Print-module-name-on-license-check-failure.patch diff --git a/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 99% rename from 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch index 05417ed9..216418b2 100644 --- a/0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +++ b/0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch @@ -79,7 +79,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 3f3459b2c7..6b00eb5557 100644 +index 4a57de975e..08ac0fb15f 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -89,7 +89,7 @@ kernel = { diff --git a/0196-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0193-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 100% rename from 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0193-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0194-fs-btrfs-Use-full-btrfs-bootloader-area.patch similarity index 100% rename from 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch rename to 0194-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/0198-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0195-Add-Fedora-location-of-DejaVu-SANS-font.patch similarity index 100% rename from 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch rename to 0195-Add-Fedora-location-of-DejaVu-SANS-font.patch diff --git a/0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0196-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch similarity index 100% rename from 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch rename to 0196-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch diff --git a/0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0197-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch similarity index 100% rename from 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch rename to 0197-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch diff --git a/0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0198-EFI-console-Do-not-set-colorstate-until-the-first-te.patch similarity index 100% rename from 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch rename to 0198-EFI-console-Do-not-set-colorstate-until-the-first-te.patch diff --git a/0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0199-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch similarity index 100% rename from 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch rename to 0199-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch diff --git a/0203-Use-visual-indentation-in-config.h.in.patch b/0200-Use-visual-indentation-in-config.h.in.patch similarity index 100% rename from 0203-Use-visual-indentation-in-config.h.in.patch rename to 0200-Use-visual-indentation-in-config.h.in.patch diff --git a/0204-Where-present-ensure-config-util.h-precedes-config.h.patch b/0201-Where-present-ensure-config-util.h-precedes-config.h.patch similarity index 99% rename from 0204-Where-present-ensure-config-util.h-precedes-config.h.patch rename to 0201-Where-present-ensure-config-util.h-precedes-config.h.patch index 626c4b4d..22c2d9c3 100644 --- a/0204-Where-present-ensure-config-util.h-precedes-config.h.patch +++ b/0201-Where-present-ensure-config-util.h-precedes-config.h.patch @@ -59,7 +59,7 @@ index 1668858703..8cb4608c3d 100644 #pragma GCC diagnostic ignored "-Wmissing-prototypes" #pragma GCC diagnostic ignored "-Wmissing-declarations" diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 846fe9715e..3e7929cc4a 100644 +index 55ea5a11cc..12277c34d2 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -16,8 +16,8 @@ diff --git a/0205-Drop-gnulib-fix-base64.patch.patch b/0202-Drop-gnulib-fix-base64.patch.patch similarity index 100% rename from 0205-Drop-gnulib-fix-base64.patch.patch rename to 0202-Drop-gnulib-fix-base64.patch.patch diff --git a/0206-Drop-gnulib-no-abort.patch.patch b/0203-Drop-gnulib-no-abort.patch.patch similarity index 100% rename from 0206-Drop-gnulib-no-abort.patch.patch rename to 0203-Drop-gnulib-no-abort.patch.patch diff --git a/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch similarity index 99% rename from 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch rename to 0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch index f9fa2079..c2c50f1f 100644 --- a/0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch +++ b/0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch @@ -61,7 +61,7 @@ index 40c4338bce..79f45ef1e1 100644 AC_CONFIG_HEADER([config-util.h]) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 6b00eb5557..39233096f2 100644 +index 08ac0fb15f..ec1ec5083b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -762,6 +762,9 @@ module = { diff --git a/0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0205-commands-search-Fix-bug-stopping-iteration-when-no-f.patch similarity index 100% rename from 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch rename to 0205-commands-search-Fix-bug-stopping-iteration-when-no-f.patch diff --git a/0209-search-new-efidisk-only-option-on-EFI-systems.patch b/0206-search-new-efidisk-only-option-on-EFI-systems.patch similarity index 100% rename from 0209-search-new-efidisk-only-option-on-EFI-systems.patch rename to 0206-search-new-efidisk-only-option-on-EFI-systems.patch diff --git a/0210-efi-new-connectefi-command.patch b/0207-efi-new-connectefi-command.patch similarity index 99% rename from 0210-efi-new-connectefi-command.patch rename to 0207-efi-new-connectefi-command.patch index 55a49fd1..f80de22c 100644 --- a/0210-efi-new-connectefi-command.patch +++ b/0207-efi-new-connectefi-command.patch @@ -64,7 +64,7 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/efi/connectefi.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 39233096f2..3c0ac3b7bd 100644 +index ec1ec5083b..741a033978 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -836,6 +836,12 @@ module = { diff --git a/0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0208-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch similarity index 100% rename from 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch rename to 0208-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch diff --git a/0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0209-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch similarity index 100% rename from 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch rename to 0209-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch diff --git a/0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0210-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch similarity index 100% rename from 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch rename to 0210-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch diff --git a/0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0211-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch similarity index 100% rename from 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch rename to 0211-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/0215-powerpc-do-CAS-in-a-more-compatible-way.patch b/0212-powerpc-do-CAS-in-a-more-compatible-way.patch similarity index 100% rename from 0215-powerpc-do-CAS-in-a-more-compatible-way.patch rename to 0212-powerpc-do-CAS-in-a-more-compatible-way.patch diff --git a/0216-powerpc-prefix-detection-support-device-names-with-c.patch b/0213-powerpc-prefix-detection-support-device-names-with-c.patch similarity index 100% rename from 0216-powerpc-prefix-detection-support-device-names-with-c.patch rename to 0213-powerpc-prefix-detection-support-device-names-with-c.patch diff --git a/0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch b/0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch similarity index 99% rename from 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch rename to 0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch index 3c73469d..5e3a7940 100644 --- a/0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +++ b/0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch @@ -31,7 +31,7 @@ Signed-off-by: Stefan Berger create mode 100644 grub-core/commands/ieee1275/ibmvtpm.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 3c0ac3b7bd..2c1608bca4 100644 +index 741a033978..e038c5e6fd 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1175,6 +1175,13 @@ module = { diff --git a/0218-make-ofdisk_retries-optional.patch b/0215-make-ofdisk_retries-optional.patch similarity index 100% rename from 0218-make-ofdisk_retries-optional.patch rename to 0215-make-ofdisk_retries-optional.patch diff --git a/0219-loader-efi-chainloader-grub_load_and_start_image-doe.patch b/0216-loader-efi-chainloader-grub_load_and_start_image-doe.patch similarity index 100% rename from 0219-loader-efi-chainloader-grub_load_and_start_image-doe.patch rename to 0216-loader-efi-chainloader-grub_load_and_start_image-doe.patch diff --git a/0220-loader-efi-chainloader-simplify-the-loader-state.patch b/0217-loader-efi-chainloader-simplify-the-loader-state.patch similarity index 100% rename from 0220-loader-efi-chainloader-simplify-the-loader-state.patch rename to 0217-loader-efi-chainloader-simplify-the-loader-state.patch diff --git a/0221-commands-boot-Add-API-to-pass-context-to-loader.patch b/0218-commands-boot-Add-API-to-pass-context-to-loader.patch similarity index 100% rename from 0221-commands-boot-Add-API-to-pass-context-to-loader.patch rename to 0218-commands-boot-Add-API-to-pass-context-to-loader.patch diff --git a/0222-loader-efi-chainloader-Use-grub_loader_set_ex.patch b/0219-loader-efi-chainloader-Use-grub_loader_set_ex.patch similarity index 100% rename from 0222-loader-efi-chainloader-Use-grub_loader_set_ex.patch rename to 0219-loader-efi-chainloader-Use-grub_loader_set_ex.patch diff --git a/0223-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch b/0220-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch similarity index 100% rename from 0223-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch rename to 0220-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch diff --git a/0224-loader-i386-efi-linux-Use-grub_loader_set_ex.patch b/0221-loader-i386-efi-linux-Use-grub_loader_set_ex.patch similarity index 100% rename from 0224-loader-i386-efi-linux-Use-grub_loader_set_ex.patch rename to 0221-loader-i386-efi-linux-Use-grub_loader_set_ex.patch diff --git a/0225-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch b/0222-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch similarity index 100% rename from 0225-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch rename to 0222-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch diff --git a/0226-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch b/0223-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch similarity index 100% rename from 0226-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch rename to 0223-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch diff --git a/0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch b/0224-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch similarity index 100% rename from 0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch rename to 0224-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch diff --git a/0228-video-readers-png-Abort-sooner-if-a-read-operation-f.patch b/0225-video-readers-png-Abort-sooner-if-a-read-operation-f.patch similarity index 100% rename from 0228-video-readers-png-Abort-sooner-if-a-read-operation-f.patch rename to 0225-video-readers-png-Abort-sooner-if-a-read-operation-f.patch diff --git a/0229-video-readers-png-Refuse-to-handle-multiple-image-he.patch b/0226-video-readers-png-Refuse-to-handle-multiple-image-he.patch similarity index 100% rename from 0229-video-readers-png-Refuse-to-handle-multiple-image-he.patch rename to 0226-video-readers-png-Refuse-to-handle-multiple-image-he.patch diff --git a/0230-video-readers-png-Drop-greyscale-support-to-fix-heap.patch b/0227-video-readers-png-Drop-greyscale-support-to-fix-heap.patch similarity index 100% rename from 0230-video-readers-png-Drop-greyscale-support-to-fix-heap.patch rename to 0227-video-readers-png-Drop-greyscale-support-to-fix-heap.patch diff --git a/0231-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch b/0228-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch similarity index 100% rename from 0231-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch rename to 0228-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch diff --git a/0232-video-readers-png-Sanity-check-some-huffman-codes.patch b/0229-video-readers-png-Sanity-check-some-huffman-codes.patch similarity index 100% rename from 0232-video-readers-png-Sanity-check-some-huffman-codes.patch rename to 0229-video-readers-png-Sanity-check-some-huffman-codes.patch diff --git a/0233-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch b/0230-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch similarity index 100% rename from 0233-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch rename to 0230-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch diff --git a/0234-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch b/0231-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch similarity index 100% rename from 0234-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch rename to 0231-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch diff --git a/0235-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch b/0232-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch similarity index 100% rename from 0235-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch rename to 0232-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch diff --git a/0236-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch b/0233-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch similarity index 100% rename from 0236-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch rename to 0233-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch diff --git a/0237-normal-charset-Fix-array-out-of-bounds-formatting-un.patch b/0234-normal-charset-Fix-array-out-of-bounds-formatting-un.patch similarity index 100% rename from 0237-normal-charset-Fix-array-out-of-bounds-formatting-un.patch rename to 0234-normal-charset-Fix-array-out-of-bounds-formatting-un.patch diff --git a/0238-net-netbuff-Block-overly-large-netbuff-allocs.patch b/0235-net-netbuff-Block-overly-large-netbuff-allocs.patch similarity index 100% rename from 0238-net-netbuff-Block-overly-large-netbuff-allocs.patch rename to 0235-net-netbuff-Block-overly-large-netbuff-allocs.patch diff --git a/0239-net-ip-Do-IP-fragment-maths-safely.patch b/0236-net-ip-Do-IP-fragment-maths-safely.patch similarity index 100% rename from 0239-net-ip-Do-IP-fragment-maths-safely.patch rename to 0236-net-ip-Do-IP-fragment-maths-safely.patch diff --git a/0240-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch b/0237-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch similarity index 100% rename from 0240-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch rename to 0237-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch diff --git a/0241-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch b/0238-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch similarity index 100% rename from 0241-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch rename to 0238-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch diff --git a/0242-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch b/0239-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch similarity index 100% rename from 0242-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch rename to 0239-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch diff --git a/0243-net-tftp-Avoid-a-trivial-UAF.patch b/0240-net-tftp-Avoid-a-trivial-UAF.patch similarity index 100% rename from 0243-net-tftp-Avoid-a-trivial-UAF.patch rename to 0240-net-tftp-Avoid-a-trivial-UAF.patch diff --git a/0244-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch b/0241-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch similarity index 100% rename from 0244-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch rename to 0241-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch diff --git a/0245-net-http-Fix-OOB-write-for-split-http-headers.patch b/0242-net-http-Fix-OOB-write-for-split-http-headers.patch similarity index 100% rename from 0245-net-http-Fix-OOB-write-for-split-http-headers.patch rename to 0242-net-http-Fix-OOB-write-for-split-http-headers.patch diff --git a/0246-net-http-Error-out-on-headers-with-LF-without-CR.patch b/0243-net-http-Error-out-on-headers-with-LF-without-CR.patch similarity index 100% rename from 0246-net-http-Error-out-on-headers-with-LF-without-CR.patch rename to 0243-net-http-Error-out-on-headers-with-LF-without-CR.patch diff --git a/0247-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch b/0244-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch similarity index 100% rename from 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch rename to 0244-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch diff --git a/0248-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch b/0245-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch similarity index 100% rename from 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch rename to 0245-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch diff --git a/0249-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch b/0246-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch similarity index 100% rename from 0249-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch rename to 0246-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch diff --git a/0250-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch b/0247-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch similarity index 100% rename from 0250-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch rename to 0247-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch diff --git a/0251-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch b/0248-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch similarity index 100% rename from 0251-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch rename to 0248-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch diff --git a/0252-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch b/0249-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch similarity index 100% rename from 0252-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch rename to 0249-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch diff --git a/0253-misc-Make-grub_min-and-grub_max-more-resilient.patch b/0250-misc-Make-grub_min-and-grub_max-more-resilient.patch similarity index 100% rename from 0253-misc-Make-grub_min-and-grub_max-more-resilient.patch rename to 0250-misc-Make-grub_min-and-grub_max-more-resilient.patch diff --git a/0254-ReiserFS-switch-to-using-grub_min-grub_max.patch b/0251-ReiserFS-switch-to-using-grub_min-grub_max.patch similarity index 100% rename from 0254-ReiserFS-switch-to-using-grub_min-grub_max.patch rename to 0251-ReiserFS-switch-to-using-grub_min-grub_max.patch diff --git a/0255-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch b/0252-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch similarity index 100% rename from 0255-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch rename to 0252-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch diff --git a/0256-modules-make-.module_license-read-only.patch b/0253-modules-make-.module_license-read-only.patch similarity index 100% rename from 0256-modules-make-.module_license-read-only.patch rename to 0253-modules-make-.module_license-read-only.patch diff --git a/0257-modules-strip-.llvm_addrsig-sections-and-similar.patch b/0254-modules-strip-.llvm_addrsig-sections-and-similar.patch similarity index 100% rename from 0257-modules-strip-.llvm_addrsig-sections-and-similar.patch rename to 0254-modules-strip-.llvm_addrsig-sections-and-similar.patch diff --git a/0258-modules-Don-t-allocate-space-for-non-allocable-secti.patch b/0255-modules-Don-t-allocate-space-for-non-allocable-secti.patch similarity index 100% rename from 0258-modules-Don-t-allocate-space-for-non-allocable-secti.patch rename to 0255-modules-Don-t-allocate-space-for-non-allocable-secti.patch diff --git a/0259-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch b/0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch similarity index 100% rename from 0259-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch rename to 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch diff --git a/0260-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch b/0257-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch similarity index 100% rename from 0260-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch rename to 0257-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch diff --git a/0261-modules-load-module-sections-at-page-aligned-address.patch b/0258-modules-load-module-sections-at-page-aligned-address.patch similarity index 100% rename from 0261-modules-load-module-sections-at-page-aligned-address.patch rename to 0258-modules-load-module-sections-at-page-aligned-address.patch diff --git a/0262-nx-add-memory-attribute-get-set-API.patch b/0259-nx-add-memory-attribute-get-set-API.patch similarity index 100% rename from 0262-nx-add-memory-attribute-get-set-API.patch rename to 0259-nx-add-memory-attribute-get-set-API.patch diff --git a/0263-nx-set-page-permissions-for-loaded-modules.patch b/0260-nx-set-page-permissions-for-loaded-modules.patch similarity index 100% rename from 0263-nx-set-page-permissions-for-loaded-modules.patch rename to 0260-nx-set-page-permissions-for-loaded-modules.patch diff --git a/0264-nx-set-attrs-in-our-kernel-loaders.patch b/0261-nx-set-attrs-in-our-kernel-loaders.patch similarity index 100% rename from 0264-nx-set-attrs-in-our-kernel-loaders.patch rename to 0261-nx-set-attrs-in-our-kernel-loaders.patch diff --git a/0265-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch b/0262-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch similarity index 100% rename from 0265-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch rename to 0262-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch diff --git a/0266-grub-probe-document-the-behavior-of-multiple-v.patch b/0263-grub-probe-document-the-behavior-of-multiple-v.patch similarity index 100% rename from 0266-grub-probe-document-the-behavior-of-multiple-v.patch rename to 0263-grub-probe-document-the-behavior-of-multiple-v.patch diff --git a/0267-grub_fs_probe-dprint-errors-from-filesystems.patch b/0264-grub_fs_probe-dprint-errors-from-filesystems.patch similarity index 100% rename from 0267-grub_fs_probe-dprint-errors-from-filesystems.patch rename to 0264-grub_fs_probe-dprint-errors-from-filesystems.patch diff --git a/0268-fs-fat-don-t-error-when-mtime-is-0.patch b/0265-fs-fat-don-t-error-when-mtime-is-0.patch similarity index 100% rename from 0268-fs-fat-don-t-error-when-mtime-is-0.patch rename to 0265-fs-fat-don-t-error-when-mtime-is-0.patch diff --git a/0269-Make-debug-file-show-which-file-filters-get-run.patch b/0266-Make-debug-file-show-which-file-filters-get-run.patch similarity index 100% rename from 0269-Make-debug-file-show-which-file-filters-get-run.patch rename to 0266-Make-debug-file-show-which-file-filters-get-run.patch diff --git a/0270-efi-use-enumerated-array-positions-for-our-allocatio.patch b/0267-efi-use-enumerated-array-positions-for-our-allocatio.patch similarity index 100% rename from 0270-efi-use-enumerated-array-positions-for-our-allocatio.patch rename to 0267-efi-use-enumerated-array-positions-for-our-allocatio.patch diff --git a/0271-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch b/0268-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch similarity index 100% rename from 0271-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch rename to 0268-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch diff --git a/0272-efi-allocate-the-initrd-within-the-bounds-expressed-.patch b/0269-efi-allocate-the-initrd-within-the-bounds-expressed-.patch similarity index 100% rename from 0272-efi-allocate-the-initrd-within-the-bounds-expressed-.patch rename to 0269-efi-allocate-the-initrd-within-the-bounds-expressed-.patch diff --git a/0273-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch b/0270-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch similarity index 100% rename from 0273-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch rename to 0270-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch diff --git a/0274-BLS-create-etc-kernel-cmdline-during-mkconfig.patch b/0271-BLS-create-etc-kernel-cmdline-during-mkconfig.patch similarity index 100% rename from 0274-BLS-create-etc-kernel-cmdline-during-mkconfig.patch rename to 0271-BLS-create-etc-kernel-cmdline-during-mkconfig.patch diff --git a/0275-squish-don-t-dup-rhgb-quiet-check-mtimes.patch b/0272-squish-don-t-dup-rhgb-quiet-check-mtimes.patch similarity index 100% rename from 0275-squish-don-t-dup-rhgb-quiet-check-mtimes.patch rename to 0272-squish-don-t-dup-rhgb-quiet-check-mtimes.patch diff --git a/0276-squish-give-up-on-rhgb-quiet.patch b/0273-squish-give-up-on-rhgb-quiet.patch similarity index 100% rename from 0276-squish-give-up-on-rhgb-quiet.patch rename to 0273-squish-give-up-on-rhgb-quiet.patch diff --git a/0277-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch b/0274-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch similarity index 100% rename from 0277-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch rename to 0274-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch diff --git a/0278-ieee1275-implement-vec5-for-cas-negotiation.patch b/0275-ieee1275-implement-vec5-for-cas-negotiation.patch similarity index 100% rename from 0278-ieee1275-implement-vec5-for-cas-negotiation.patch rename to 0275-ieee1275-implement-vec5-for-cas-negotiation.patch diff --git a/0279-blscfg-Don-t-root-device-in-emu-builds.patch b/0276-blscfg-Don-t-root-device-in-emu-builds.patch similarity index 100% rename from 0279-blscfg-Don-t-root-device-in-emu-builds.patch rename to 0276-blscfg-Don-t-root-device-in-emu-builds.patch diff --git a/0280-loader-arm64-linux-Remove-magic-number-header-field-.patch b/0277-loader-arm64-linux-Remove-magic-number-header-field-.patch similarity index 100% rename from 0280-loader-arm64-linux-Remove-magic-number-header-field-.patch rename to 0277-loader-arm64-linux-Remove-magic-number-header-field-.patch diff --git a/0281-Correct-BSS-zeroing-on-aarch64.patch b/0278-Correct-BSS-zeroing-on-aarch64.patch similarity index 100% rename from 0281-Correct-BSS-zeroing-on-aarch64.patch rename to 0278-Correct-BSS-zeroing-on-aarch64.patch diff --git a/0282-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch b/0279-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch similarity index 100% rename from 0282-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch rename to 0279-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch diff --git a/0283-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch b/0280-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch similarity index 100% rename from 0283-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch rename to 0280-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch diff --git a/0284-commands-efi-tpm-Refine-the-status-of-log-event.patch b/0281-commands-efi-tpm-Refine-the-status-of-log-event.patch similarity index 100% rename from 0284-commands-efi-tpm-Refine-the-status-of-log-event.patch rename to 0281-commands-efi-tpm-Refine-the-status-of-log-event.patch diff --git a/0285-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch b/0282-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch similarity index 100% rename from 0285-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch rename to 0282-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch diff --git a/0286-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch b/0283-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch similarity index 100% rename from 0286-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch rename to 0283-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch diff --git a/0287-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch b/0284-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch similarity index 100% rename from 0287-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch rename to 0284-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch diff --git a/0288-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch b/0285-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch similarity index 100% rename from 0288-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch rename to 0285-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch diff --git a/0289-font-Fix-several-integer-overflows-in-grub_font_cons.patch b/0286-font-Fix-several-integer-overflows-in-grub_font_cons.patch similarity index 100% rename from 0289-font-Fix-several-integer-overflows-in-grub_font_cons.patch rename to 0286-font-Fix-several-integer-overflows-in-grub_font_cons.patch diff --git a/0290-font-Remove-grub_font_dup_glyph.patch b/0287-font-Remove-grub_font_dup_glyph.patch similarity index 100% rename from 0290-font-Remove-grub_font_dup_glyph.patch rename to 0287-font-Remove-grub_font_dup_glyph.patch diff --git a/0291-font-Fix-integer-overflow-in-ensure_comb_space.patch b/0288-font-Fix-integer-overflow-in-ensure_comb_space.patch similarity index 100% rename from 0291-font-Fix-integer-overflow-in-ensure_comb_space.patch rename to 0288-font-Fix-integer-overflow-in-ensure_comb_space.patch diff --git a/0292-font-Fix-integer-overflow-in-BMP-index.patch b/0289-font-Fix-integer-overflow-in-BMP-index.patch similarity index 100% rename from 0292-font-Fix-integer-overflow-in-BMP-index.patch rename to 0289-font-Fix-integer-overflow-in-BMP-index.patch diff --git a/0293-font-Fix-integer-underflow-in-binary-search-of-char-.patch b/0290-font-Fix-integer-underflow-in-binary-search-of-char-.patch similarity index 100% rename from 0293-font-Fix-integer-underflow-in-binary-search-of-char-.patch rename to 0290-font-Fix-integer-underflow-in-binary-search-of-char-.patch diff --git a/0294-kern-efi-sb-Enforce-verification-of-font-files.patch b/0291-kern-efi-sb-Enforce-verification-of-font-files.patch similarity index 100% rename from 0294-kern-efi-sb-Enforce-verification-of-font-files.patch rename to 0291-kern-efi-sb-Enforce-verification-of-font-files.patch diff --git a/0295-fbutil-Fix-integer-overflow.patch b/0292-fbutil-Fix-integer-overflow.patch similarity index 100% rename from 0295-fbutil-Fix-integer-overflow.patch rename to 0292-fbutil-Fix-integer-overflow.patch diff --git a/0296-font-Fix-an-integer-underflow-in-blit_comb.patch b/0293-font-Fix-an-integer-underflow-in-blit_comb.patch similarity index 100% rename from 0296-font-Fix-an-integer-underflow-in-blit_comb.patch rename to 0293-font-Fix-an-integer-underflow-in-blit_comb.patch diff --git a/0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch b/0294-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch similarity index 100% rename from 0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch rename to 0294-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch diff --git a/0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch b/0295-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch similarity index 100% rename from 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch rename to 0295-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch diff --git a/0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch b/0296-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch similarity index 100% rename from 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch rename to 0296-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch diff --git a/0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch b/0297-font-Try-opening-fonts-from-the-bundled-memdisk.patch similarity index 100% rename from 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch rename to 0297-font-Try-opening-fonts-from-the-bundled-memdisk.patch diff --git a/0298-Correction-in-vector-5-values.patch b/0298-Correction-in-vector-5-values.patch new file mode 100644 index 00000000..9be1f4a4 --- /dev/null +++ b/0298-Correction-in-vector-5-values.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Avnish Chouhan +Date: Tue, 22 Nov 2022 08:01:47 -0500 +Subject: [PATCH] Correction in vector 5 values + +This patch is to update the vector 5 values which is troubling some +machines to bootup properly. Max out the values of all the properties of +Vector 5 (similar to vector 2) except max cpu property, which were set +as 0 earlier. + +Signed-off-by: Avnish Chouhan +[rharwood: rewrap comit message] +Signed-off-by: Robbie Harwood +--- + grub-core/kern/ieee1275/init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 6a51c9efab..28a3bd4621 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -376,7 +376,7 @@ grub_ieee1275_ibm_cas (void) + .vec4 = 0x0001, // set required minimum capacity % to the lowest value + .vec5_size = 1 + sizeof(struct option_vector5) - 2, + .vec5 = { +- 0, 0, 0, 0, 0, 0, 0, 0, 256 ++ -1, -1, -1, -1, -1, -1, -1, -1, 256 + } + }; + diff --git a/0301-mm-Clarify-grub_real_malloc.patch b/0299-mm-Clarify-grub_real_malloc.patch similarity index 100% rename from 0301-mm-Clarify-grub_real_malloc.patch rename to 0299-mm-Clarify-grub_real_malloc.patch diff --git a/0302-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch b/0300-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch similarity index 100% rename from 0302-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch rename to 0300-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch diff --git a/0303-mm-Document-grub_free.patch b/0301-mm-Document-grub_free.patch similarity index 100% rename from 0303-mm-Document-grub_free.patch rename to 0301-mm-Document-grub_free.patch diff --git a/0304-mm-Document-grub_mm_init_region.patch b/0302-mm-Document-grub_mm_init_region.patch similarity index 100% rename from 0304-mm-Document-grub_mm_init_region.patch rename to 0302-mm-Document-grub_mm_init_region.patch diff --git a/0305-mm-Document-GRUB-internal-memory-management-structur.patch b/0303-mm-Document-GRUB-internal-memory-management-structur.patch similarity index 100% rename from 0305-mm-Document-GRUB-internal-memory-management-structur.patch rename to 0303-mm-Document-GRUB-internal-memory-management-structur.patch diff --git a/0306-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch b/0304-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch similarity index 100% rename from 0306-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch rename to 0304-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch diff --git a/0307-mm-When-adding-a-region-merge-with-region-after-as-w.patch b/0305-mm-When-adding-a-region-merge-with-region-after-as-w.patch similarity index 100% rename from 0307-mm-When-adding-a-region-merge-with-region-after-as-w.patch rename to 0305-mm-When-adding-a-region-merge-with-region-after-as-w.patch diff --git a/0308-mm-Debug-support-for-region-operations.patch b/0306-mm-Debug-support-for-region-operations.patch similarity index 100% rename from 0308-mm-Debug-support-for-region-operations.patch rename to 0306-mm-Debug-support-for-region-operations.patch diff --git a/0309-mm-Drop-unused-unloading-of-modules-on-OOM.patch b/0307-mm-Drop-unused-unloading-of-modules-on-OOM.patch similarity index 100% rename from 0309-mm-Drop-unused-unloading-of-modules-on-OOM.patch rename to 0307-mm-Drop-unused-unloading-of-modules-on-OOM.patch diff --git a/0310-mm-Allow-dynamically-requesting-additional-memory-re.patch b/0308-mm-Allow-dynamically-requesting-additional-memory-re.patch similarity index 100% rename from 0310-mm-Allow-dynamically-requesting-additional-memory-re.patch rename to 0308-mm-Allow-dynamically-requesting-additional-memory-re.patch diff --git a/0311-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch b/0309-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch similarity index 100% rename from 0311-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch rename to 0309-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch diff --git a/0312-kern-efi-mm-Extract-function-to-add-memory-regions.patch b/0310-kern-efi-mm-Extract-function-to-add-memory-regions.patch similarity index 100% rename from 0312-kern-efi-mm-Extract-function-to-add-memory-regions.patch rename to 0310-kern-efi-mm-Extract-function-to-add-memory-regions.patch diff --git a/0313-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch b/0311-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch similarity index 100% rename from 0313-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch rename to 0311-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch diff --git a/0314-kern-efi-mm-Implement-runtime-addition-of-pages.patch b/0312-kern-efi-mm-Implement-runtime-addition-of-pages.patch similarity index 100% rename from 0314-kern-efi-mm-Implement-runtime-addition-of-pages.patch rename to 0312-kern-efi-mm-Implement-runtime-addition-of-pages.patch diff --git a/0315-efi-Increase-default-memory-allocation-to-32-MiB.patch b/0313-efi-Increase-default-memory-allocation-to-32-MiB.patch similarity index 100% rename from 0315-efi-Increase-default-memory-allocation-to-32-MiB.patch rename to 0313-efi-Increase-default-memory-allocation-to-32-MiB.patch diff --git a/0316-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch b/0314-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch similarity index 100% rename from 0316-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch rename to 0314-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch diff --git a/0317-ppc64le-signed-boot-media-changes.patch b/0315-ppc64le-signed-boot-media-changes.patch similarity index 100% rename from 0317-ppc64le-signed-boot-media-changes.patch rename to 0315-ppc64le-signed-boot-media-changes.patch diff --git a/0318-core-Fix-several-implicit-function-declarations.patch b/0316-core-Fix-several-implicit-function-declarations.patch similarity index 100% rename from 0318-core-Fix-several-implicit-function-declarations.patch rename to 0316-core-Fix-several-implicit-function-declarations.patch diff --git a/0060-Add-linux-and-initrd-commands-for-grub-emu.patch b/0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch similarity index 51% rename from 0060-Add-linux-and-initrd-commands-for-grub-emu.patch rename to 0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch index 419fde38..61fe8764 100644 --- a/0060-Add-linux-and-initrd-commands-for-grub-emu.patch +++ b/0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch @@ -1,46 +1,70 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Raymund Will -Date: Tue, 6 Feb 2018 09:09:00 +0100 -Subject: [PATCH] Add linux and initrd commands for grub-emu +Date: Mon, 24 Oct 2022 14:33:50 -0400 +Subject: [PATCH] loader: Add support for grub-emu to kexec Linux menu entries -When using grub-emu, the linux and initrd commands are used as arguments -to the kexec command line tool, to allow booting the selected menu entry. +The GRUB emulator is used as a debugging utility but it could also be +used as a user-space bootloader if there is support to boot an operating +system. + +The Linux kernel is already able to (re)boot another kernel via the +kexec boot mechanism. So the grub-emu tool could rely on this feature +and have linux and initrd commands that are used to pass a kernel, +initramfs image and command line parameters to kexec for booting +a selected menu entry. + +By default the systemctl kexec option is used so systemd can shutdown +all of the running services before doing a reboot using kexec. But if +this is not present, it can fall back to executing the kexec user-space +tool directly. The ability to force a kexec-reboot when systemctl kexec +fails must only be used in controlled environments to avoid possible +filesystem corruption and data loss. Signed-off-by: Raymund Will +Signed-off-by: John Jolly +Signed-off-by: Javier Martinez Canillas Signed-off-by: Robbie Harwood +Reviewed-by: Daniel Kiper +(cherry picked from commit e364307f6acc2f631b4c1fefda0791b9ce1f205f) +[rharwood: conflicts around makefile and grub_exit return code] --- - grub-core/Makefile.core.def | 1 - + grub-core/Makefile.core.def | 3 - grub-core/kern/emu/main.c | 4 + grub-core/kern/emu/misc.c | 18 ++++- - grub-core/loader/emu/linux.c | 172 +++++++++++++++++++++++++++++++++++++++++++ + grub-core/loader/emu/linux.c | 178 +++++++++++++++++++++++++++++++++++++++++++ include/grub/emu/exec.h | 4 +- include/grub/emu/hostfile.h | 3 +- include/grub/emu/misc.h | 3 + + docs/grub.texi | 30 ++++++-- grub-core/Makefile.am | 1 + - 8 files changed, 202 insertions(+), 4 deletions(-) + 9 files changed, 230 insertions(+), 14 deletions(-) create mode 100644 grub-core/loader/emu/linux.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 058c88ac3a..5354f9613d 100644 +index e038c5e6fd..02ea718652 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1826,7 +1826,6 @@ module = { - +@@ -1871,11 +1871,8 @@ module = { + riscv32 = loader/riscv/linux.c; + riscv64 = loader/riscv/linux.c; + emu = loader/emu/linux.c; +- common = loader/linux.c; common = lib/cmdline.c; - enable = noemu; - +- efi = loader/efi/linux.c; }; + diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 55ea5a11cc..846fe9715e 100644 +index 12277c34d2..68e2b283bb 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -107,6 +107,7 @@ static struct argp_option options[] = { N_("use GRUB files in the directory DIR [default=%s]"), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, {"hold", 'H', N_("SECS"), OPTION_ARG_OPTIONAL, N_("wait until a debugger will attach"), 0}, -+ {"kexec", 'X', 0, 0, N_("try the untryable."), 0}, ++ {"kexec", 'X', 0, 0, N_("use kexec to boot Linux kernels via systemctl (pass twice to enable dangerous fallback to non-systemctl)."), 0}, { 0, 0, 0, 0, 0, 0 } }; @@ -49,13 +73,13 @@ index 55ea5a11cc..846fe9715e 100644 verbosity++; break; + case 'X': -+ grub_util_set_kexecute(); ++ grub_util_set_kexecute (); + break; case ARGP_KEY_ARG: { diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 0ff13bcaf8..eeea092752 100644 +index d278c2921f..02d27c3440 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -39,6 +39,7 @@ @@ -80,7 +104,7 @@ index 0ff13bcaf8..eeea092752 100644 grub_exit (int rc) { +#if defined (GRUB_KERNEL) -+ grub_reboot(); ++ grub_reboot (); +#endif exit (rc < 0 ? 1 : rc); } @@ -91,25 +115,25 @@ index 0ff13bcaf8..eeea092752 100644 } + +void -+grub_util_set_kexecute(void) ++grub_util_set_kexecute (void) +{ + kexecute++; +} + +int -+grub_util_get_kexecute(void) ++grub_util_get_kexecute (void) +{ + return kexecute; +} diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c new file mode 100644 -index 0000000000..fda9e00d24 +index 0000000000..0cf378a376 --- /dev/null +++ b/grub-core/loader/emu/linux.c -@@ -0,0 +1,172 @@ +@@ -0,0 +1,178 @@ +/* + * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. ++ * Copyright (C) 2022 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -147,49 +171,55 @@ index 0000000000..fda9e00d24 +{ + grub_err_t rc = GRUB_ERR_NONE; + char *initrd_param; -+ const char *kexec[] = { "kexec", "-l", kernel_path, boot_cmdline, NULL, NULL }; -+ const char *systemctl[] = { "systemctl", "kexec", NULL }; -+ int kexecute = grub_util_get_kexecute(); ++ const char *kexec[] = {"kexec", "-la", kernel_path, boot_cmdline, NULL, NULL}; ++ const char *systemctl[] = {"systemctl", "kexec", NULL}; ++ int kexecute = grub_util_get_kexecute (); + -+ if (initrd_path) { -+ initrd_param = grub_xasprintf("--initrd=%s", initrd_path); -+ kexec[3] = initrd_param; -+ kexec[4] = boot_cmdline; -+ } else { -+ initrd_param = grub_xasprintf("%s", ""); -+ } ++ if (initrd_path) ++ { ++ initrd_param = grub_xasprintf ("--initrd=%s", initrd_path); ++ kexec[3] = initrd_param; ++ kexec[4] = boot_cmdline; ++ } ++ else ++ initrd_param = grub_xasprintf ("%s", ""); + -+ grub_printf("%serforming 'kexec -l %s %s %s'\n", -+ (kexecute) ? "P" : "Not p", -+ kernel_path, initrd_param, boot_cmdline); ++ grub_dprintf ("linux", "%serforming 'kexec -la %s %s %s'\n", ++ (kexecute) ? "P" : "Not p", ++ kernel_path, initrd_param, boot_cmdline); + + if (kexecute) -+ rc = grub_util_exec(kexec); ++ rc = grub_util_exec (kexec); + -+ grub_free(initrd_param); ++ grub_free (initrd_param); ++ ++ if (rc != GRUB_ERR_NONE) ++ { ++ grub_error (rc, N_("error trying to perform kexec load operation")); ++ grub_sleep (3); ++ return rc; ++ } + -+ if (rc != GRUB_ERR_NONE) { -+ grub_error (rc, N_("Error trying to perform kexec load operation.")); -+ grub_sleep (3); -+ return rc; -+ } + if (kexecute < 1) -+ grub_fatal (N_("Use '"PACKAGE"-emu --kexec' to force a system restart.")); ++ grub_fatal (N_("use '"PACKAGE"-emu --kexec' to force a system restart")); + -+ grub_printf("Performing 'systemctl kexec' (%s) ", ++ grub_dprintf ("linux", "Performing 'systemctl kexec' (%s) ", + (kexecute==1) ? "do-or-die" : "just-in-case"); + rc = grub_util_exec (systemctl); + + if (kexecute == 1) -+ grub_fatal (N_("Error trying to perform 'systemctl kexec'")); ++ grub_fatal (N_("error trying to perform 'systemctl kexec': %d"), rc); + -+ /* need to check read-only root before resetting hard!? */ -+ grub_printf("Performing 'kexec -e'"); -+ kexec[1] = "-e"; ++ /* ++ * WARNING: forcible reset should only be used in read-only environments. ++ * grub-emu cannot check for these - users beware. ++ */ ++ grub_dprintf ("linux", "Performing 'kexec -ex'"); ++ kexec[1] = "-ex"; + kexec[2] = NULL; -+ rc = grub_util_exec(kexec); -+ if ( rc != GRUB_ERR_NONE ) -+ grub_fatal (N_("Error trying to directly perform 'kexec -e'.")); ++ rc = grub_util_exec (kexec); ++ if (rc != GRUB_ERR_NONE) ++ grub_fatal (N_("error trying to directly perform 'kexec -ex': %d"), rc); + + return rc; +} @@ -197,46 +227,46 @@ index 0000000000..fda9e00d24 +static grub_err_t +grub_linux_unload (void) +{ ++ /* Unloading: we're no longer in use. */ + grub_dl_unref (my_mod); -+ if ( boot_cmdline != NULL ) -+ grub_free (boot_cmdline); ++ grub_free (boot_cmdline); + boot_cmdline = NULL; + return GRUB_ERR_NONE; +} + +static grub_err_t -+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) ++grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), int argc, ++ char *argv[]) +{ + int i; + char *tempstr; + ++ /* Mark ourselves as in-use. */ + grub_dl_ref (my_mod); + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); + -+ if ( !grub_util_is_regular(argv[0]) ) -+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("Cannot find kernel file %s"), argv[0]); ++ if (!grub_util_is_regular (argv[0])) ++ return grub_error (GRUB_ERR_FILE_NOT_FOUND, ++ N_("cannot find kernel file %s"), argv[0]); + -+ if ( kernel_path != NULL ) -+ grub_free(kernel_path); ++ grub_free (kernel_path); ++ kernel_path = grub_xasprintf ("%s", argv[0]); + -+ kernel_path = grub_xasprintf("%s", argv[0]); ++ grub_free (boot_cmdline); ++ boot_cmdline = NULL; + -+ if ( boot_cmdline != NULL ) { -+ grub_free(boot_cmdline); -+ boot_cmdline = NULL; -+ } -+ -+ if ( argc > 1 ) -+ { -+ boot_cmdline = grub_xasprintf("--command-line=%s", argv[1]); -+ for ( i = 2; i < argc; i++ ) { -+ tempstr = grub_xasprintf("%s %s", boot_cmdline, argv[i]); -+ grub_free(boot_cmdline); -+ boot_cmdline = tempstr; ++ if (argc > 1) ++ { ++ boot_cmdline = grub_xasprintf ("--command-line=%s", argv[1]); ++ for (i = 2; i < argc; i++) ++ { ++ tempstr = grub_xasprintf ("%s %s", boot_cmdline, argv[i]); ++ grub_free (boot_cmdline); ++ boot_cmdline = tempstr; ++ } + } -+ } + + grub_loader_set (grub_linux_boot, grub_linux_unload, 0); + @@ -244,19 +274,20 @@ index 0000000000..fda9e00d24 +} + +static grub_err_t -+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) ++grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, ++ char *argv[]) +{ + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); + -+ if ( !grub_util_is_regular(argv[0]) ) -+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("Cannot find initrd file %s"), argv[0]); ++ if (!grub_util_is_regular (argv[0])) ++ return grub_error (GRUB_ERR_FILE_NOT_FOUND, ++ N_("Cannot find initrd file %s"), argv[0]); + -+ if ( initrd_path != NULL ) -+ grub_free(initrd_path); -+ -+ initrd_path = grub_xasprintf("%s", argv[0]); ++ grub_free (initrd_path); ++ initrd_path = grub_xasprintf ("%s", argv[0]); + ++ /* We are done - mark ourselves as on longer in use. */ + grub_dl_unref (my_mod); + + return GRUB_ERR_NONE; @@ -264,17 +295,16 @@ index 0000000000..fda9e00d24 + +static grub_command_t cmd_linux, cmd_initrd; + -+GRUB_MOD_INIT(linux) ++GRUB_MOD_INIT (linux) +{ -+ cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux.")); -+ cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, 0, N_("Load initrd.")); ++ cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, ++ N_("Load Linux.")); ++ cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, 0, ++ N_("Load initrd.")); + my_mod = mod; -+ kernel_path = NULL; -+ initrd_path = NULL; -+ boot_cmdline = NULL; +} + -+GRUB_MOD_FINI(linux) ++GRUB_MOD_FINI (linux) +{ + grub_unregister_command (cmd_linux); + grub_unregister_command (cmd_initrd); @@ -336,11 +366,62 @@ index ff9c48a649..01056954b9 100644 grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); #ifdef HAVE_DEVICE_MAPPER +diff --git a/docs/grub.texi b/docs/grub.texi +index c433240f34..825278a7f3 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -923,17 +923,17 @@ magic. + @node General boot methods + @section How to boot operating systems + +-GRUB has two distinct boot methods. One of the two is to load an +-operating system directly, and the other is to chain-load another boot +-loader which then will load an operating system actually. Generally +-speaking, the former is more desirable, because you don't need to +-install or maintain other boot loaders and GRUB is flexible enough to +-load an operating system from an arbitrary disk/partition. However, +-the latter is sometimes required, since GRUB doesn't support all the +-existing operating systems natively. ++GRUB has three distinct boot methods: loading an operating system ++directly, using kexec from userspace, and chainloading another ++bootloader. Generally speaking, the first two are more desirable ++because you don't need to install or maintain other boot loaders and ++GRUB is flexible enough to load an operating system from an arbitrary ++disk/partition. However, chainloading is sometimes required, as GRUB ++doesn't support all existing operating systems natively. + + @menu + * Loading an operating system directly:: ++* Kexec:: + * Chain-loading:: + @end menu + +@@ -959,6 +959,20 @@ use more complicated instructions. @xref{DOS/Windows}, for more + information. + + ++@node Kexec ++@subsection Kexec with grub2-emu ++ ++GRUB can be run in userspace by invoking the grub2-emu tool. It will ++read all configuration scripts as if booting directly (see @xref{Loading ++an operating system directly}). With the @code{--kexec} flag, and ++kexec(8) support from the operating system, the @command{linux} command ++will directly boot the target image. For systems that lack working ++systemctl(1) support for kexec, passing the @code{--kexec} flag twice ++will fallback to invoking kexec(8) directly; note however that this ++fallback may be unsafe outside read-only environments, as it does not ++invoke shutdown machinery. ++ ++ + @node Chain-loading + @subsection Chain-loading an OS + diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index ee88e44e97..80e7a83edf 100644 +index c2e8a82bce..dd49939aaa 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am -@@ -307,6 +307,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h +@@ -309,6 +309,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h diff --git a/0319-Enable-shared-processor-mode-in-vector-5.patch b/0319-Enable-shared-processor-mode-in-vector-5.patch deleted file mode 100644 index ec540a7a..00000000 --- a/0319-Enable-shared-processor-mode-in-vector-5.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Avnish Chouhan -Date: Tue, 24 Jan 2023 08:01:47 -0500 -Subject: [PATCH] Enable shared processor mode in vector 5 - -This patch is to update the vector 5 which is troubling some -machines to bootup properly in shared processor mode. - -Signed-off-by: Avnish Chouhan ---- - grub-core/kern/ieee1275/init.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 6a51c9efab..7c8b6facec 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -376,7 +376,7 @@ grub_ieee1275_ibm_cas (void) - .vec4 = 0x0001, // set required minimum capacity % to the lowest value - .vec5_size = 1 + sizeof(struct option_vector5) - 2, - .vec5 = { -- 0, 0, 0, 0, 0, 0, 0, 0, 256 -+ 0, 192, 0, 128, 0, 0, 0, 0, 256 - } - }; - diff --git a/grub.patches b/grub.patches index 8f3e1808..ae57994f 100644 --- a/grub.patches +++ b/grub.patches @@ -57,263 +57,261 @@ Patch0056: 0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch Patch0057: 0057-align-struct-efi_variable-better.patch Patch0058: 0058-Add-BLS-support-to-grub-mkconfig.patch Patch0059: 0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0060: 0060-Add-linux-and-initrd-commands-for-grub-emu.patch -Patch0061: 0061-Add-grub2-switch-to-blscfg.patch -Patch0062: 0062-make-better-backtraces.patch -Patch0063: 0063-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0064: 0064-Work-around-some-minor-include-path-weirdnesses.patch -Patch0065: 0065-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0066: 0066-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0067: 0067-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch -Patch0068: 0068-Fixup-for-newer-compiler.patch -Patch0069: 0069-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0070: 0070-Fixup-for-newer-compiler.patch -Patch0071: 0071-Add-support-for-non-Ethernet-network-cards.patch -Patch0072: 0072-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0073: 0073-bootp-New-net_bootp6-command.patch -Patch0074: 0074-efinet-UEFI-IPv6-PXE-support.patch -Patch0075: 0075-grub.texi-Add-net_bootp6-doument.patch -Patch0076: 0076-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0077: 0077-efinet-Setting-network-from-UEFI-device-path.patch -Patch0078: 0078-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0079: 0079-Support-UEFI-networking-protocols.patch -Patch0080: 0080-AUDIT-0-http-boot-tracker-bug.patch -Patch0081: 0081-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0082: 0082-Add-auto-hide-menu-support.patch -Patch0083: 0083-Add-grub-set-bootflag-utility.patch -Patch0084: 0084-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0085: 0085-gentpl-add-disable-support.patch -Patch0086: 0086-gentpl-add-pc-firmware-type.patch -Patch0087: 0087-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0088: 0088-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0089: 0089-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0090: 0090-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0091: 0091-Rework-how-the-fdt-command-builds.patch -Patch0092: 0092-Disable-non-wordsize-allocations-on-arm.patch -Patch0093: 0093-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0094: 0094-Make-grub_error-more-verbose.patch -Patch0095: 0095-Make-reset-an-alias-for-the-reboot-command.patch -Patch0096: 0096-Add-a-version-command.patch -Patch0097: 0097-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0098: 0098-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0099: 0099-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0100: 0100-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0101: 0101-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0102: 0102-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0103: 0103-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0104: 0104-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0105: 0105-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0106: 0106-Fix-getroot.c-s-trampolines.patch -Patch0107: 0107-Do-not-allow-stack-trampolines-anywhere.patch -Patch0108: 0108-Reimplement-boot_counter.patch -Patch0109: 0109-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0110: 0110-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0111: 0111-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0112: 0112-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0113: 0113-Export-all-variables-from-the-initial-context-when-c.patch -Patch0114: 0114-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0115: 0115-Fix-systemctl-kexec-exit-status-check.patch -Patch0116: 0116-Print-grub-emu-linux-loader-messages-as-debug.patch -Patch0117: 0117-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0118: 0118-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0119: 0119-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0120: 0120-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0121: 0121-Add-start-symbol-for-RISC-V.patch -Patch0122: 0122-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0123: 0123-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0124: 0124-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0125: 0125-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0126: 0126-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0127: 0127-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0128: 0128-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0129: 0129-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0130: 0130-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0131: 0131-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0132: 0132-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0133: 0133-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0134: 0134-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0135: 0135-efi-http-fix-some-allocation-error-checking.patch -Patch0136: 0136-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0137: 0137-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0138: 0138-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0139: 0139-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0140: 0140-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0141: 0141-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0142: 0142-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0143: 0143-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0144: 0144-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0145: 0145-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0146: 0146-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0147: 0147-grub-install-disable-support-for-EFI-platforms.patch -Patch0148: 0148-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0149: 0149-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0150: 0150-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0151: 0151-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0152: 0152-kern-file-Fix-error-handling-in-grub_file_open.patch -Patch0153: 0153-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0154: 0154-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0155: 0155-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0156: 0156-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0157: 0157-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0158: 0158-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0159: 0159-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0160: 0160-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0161: 0161-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0162: 0162-pgp-factor-out-rsa_pad.patch -Patch0163: 0163-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0164: 0164-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0165: 0165-libtasn1-import-libtasn1-4.16.0.patch -Patch0166: 0166-libtasn1-disable-code-not-needed-in-grub.patch -Patch0167: 0167-libtasn1-changes-for-grub-compatibility.patch -Patch0168: 0168-libtasn1-compile-into-asn1-module.patch -Patch0169: 0169-test_asn1-test-module-for-libtasn1.patch -Patch0170: 0170-grub-install-support-embedding-x509-certificates.patch -Patch0171: 0171-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0172: 0172-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0173: 0173-appended-signatures-support-verifying-appended-signa.patch -Patch0174: 0174-appended-signatures-verification-tests.patch -Patch0175: 0175-appended-signatures-documentation.patch -Patch0176: 0176-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0177: 0177-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0178: 0178-ieee1275-claim-more-memory.patch -Patch0179: 0179-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0180: 0180-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0181: 0181-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0182: 0182-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0183: 0183-efinet-Add-DHCP-proxy-support.patch -Patch0184: 0184-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0185: 0185-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0186: 0186-Suppress-gettext-error-message.patch -Patch0187: 0187-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0188: 0188-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0189: 0189-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0190: 0190-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0191: 0191-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0192: 0192-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0193: 0193-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0194: 0194-Print-module-name-on-license-check-failure.patch -Patch0195: 0195-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0196: 0196-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0197: 0197-fs-btrfs-Use-full-btrfs-bootloader-area.patch -Patch0198: 0198-Add-Fedora-location-of-DejaVu-SANS-font.patch -Patch0199: 0199-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch -Patch0200: 0200-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch -Patch0201: 0201-EFI-console-Do-not-set-colorstate-until-the-first-te.patch -Patch0202: 0202-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch -Patch0203: 0203-Use-visual-indentation-in-config.h.in.patch -Patch0204: 0204-Where-present-ensure-config-util.h-precedes-config.h.patch -Patch0205: 0205-Drop-gnulib-fix-base64.patch.patch -Patch0206: 0206-Drop-gnulib-no-abort.patch.patch -Patch0207: 0207-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0208: 0208-commands-search-Fix-bug-stopping-iteration-when-no-f.patch -Patch0209: 0209-search-new-efidisk-only-option-on-EFI-systems.patch -Patch0210: 0210-efi-new-connectefi-command.patch -Patch0211: 0211-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch -Patch0212: 0212-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch -Patch0213: 0213-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch -Patch0214: 0214-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch -Patch0215: 0215-powerpc-do-CAS-in-a-more-compatible-way.patch -Patch0216: 0216-powerpc-prefix-detection-support-device-names-with-c.patch -Patch0217: 0217-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch -Patch0218: 0218-make-ofdisk_retries-optional.patch -Patch0219: 0219-loader-efi-chainloader-grub_load_and_start_image-doe.patch -Patch0220: 0220-loader-efi-chainloader-simplify-the-loader-state.patch -Patch0221: 0221-commands-boot-Add-API-to-pass-context-to-loader.patch -Patch0222: 0222-loader-efi-chainloader-Use-grub_loader_set_ex.patch -Patch0223: 0223-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch -Patch0224: 0224-loader-i386-efi-linux-Use-grub_loader_set_ex.patch -Patch0225: 0225-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch -Patch0226: 0226-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch -Patch0227: 0227-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch -Patch0228: 0228-video-readers-png-Abort-sooner-if-a-read-operation-f.patch -Patch0229: 0229-video-readers-png-Refuse-to-handle-multiple-image-he.patch -Patch0230: 0230-video-readers-png-Drop-greyscale-support-to-fix-heap.patch -Patch0231: 0231-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch -Patch0232: 0232-video-readers-png-Sanity-check-some-huffman-codes.patch -Patch0233: 0233-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch -Patch0234: 0234-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch -Patch0235: 0235-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch -Patch0236: 0236-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch -Patch0237: 0237-normal-charset-Fix-array-out-of-bounds-formatting-un.patch -Patch0238: 0238-net-netbuff-Block-overly-large-netbuff-allocs.patch -Patch0239: 0239-net-ip-Do-IP-fragment-maths-safely.patch -Patch0240: 0240-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch -Patch0241: 0241-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch -Patch0242: 0242-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch -Patch0243: 0243-net-tftp-Avoid-a-trivial-UAF.patch -Patch0244: 0244-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch -Patch0245: 0245-net-http-Fix-OOB-write-for-split-http-headers.patch -Patch0246: 0246-net-http-Error-out-on-headers-with-LF-without-CR.patch -Patch0247: 0247-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch -Patch0248: 0248-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch -Patch0249: 0249-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch -Patch0250: 0250-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch -Patch0251: 0251-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch -Patch0252: 0252-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch -Patch0253: 0253-misc-Make-grub_min-and-grub_max-more-resilient.patch -Patch0254: 0254-ReiserFS-switch-to-using-grub_min-grub_max.patch -Patch0255: 0255-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch -Patch0256: 0256-modules-make-.module_license-read-only.patch -Patch0257: 0257-modules-strip-.llvm_addrsig-sections-and-similar.patch -Patch0258: 0258-modules-Don-t-allocate-space-for-non-allocable-secti.patch -Patch0259: 0259-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch -Patch0260: 0260-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch -Patch0261: 0261-modules-load-module-sections-at-page-aligned-address.patch -Patch0262: 0262-nx-add-memory-attribute-get-set-API.patch -Patch0263: 0263-nx-set-page-permissions-for-loaded-modules.patch -Patch0264: 0264-nx-set-attrs-in-our-kernel-loaders.patch -Patch0265: 0265-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch -Patch0266: 0266-grub-probe-document-the-behavior-of-multiple-v.patch -Patch0267: 0267-grub_fs_probe-dprint-errors-from-filesystems.patch -Patch0268: 0268-fs-fat-don-t-error-when-mtime-is-0.patch -Patch0269: 0269-Make-debug-file-show-which-file-filters-get-run.patch -Patch0270: 0270-efi-use-enumerated-array-positions-for-our-allocatio.patch -Patch0271: 0271-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch -Patch0272: 0272-efi-allocate-the-initrd-within-the-bounds-expressed-.patch -Patch0273: 0273-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch -Patch0274: 0274-BLS-create-etc-kernel-cmdline-during-mkconfig.patch -Patch0275: 0275-squish-don-t-dup-rhgb-quiet-check-mtimes.patch -Patch0276: 0276-squish-give-up-on-rhgb-quiet.patch -Patch0277: 0277-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch -Patch0278: 0278-ieee1275-implement-vec5-for-cas-negotiation.patch -Patch0279: 0279-blscfg-Don-t-root-device-in-emu-builds.patch -Patch0280: 0280-loader-arm64-linux-Remove-magic-number-header-field-.patch -Patch0281: 0281-Correct-BSS-zeroing-on-aarch64.patch -Patch0282: 0282-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch -Patch0283: 0283-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch -Patch0284: 0284-commands-efi-tpm-Refine-the-status-of-log-event.patch -Patch0285: 0285-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch -Patch0286: 0286-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch -Patch0287: 0287-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch -Patch0288: 0288-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch -Patch0289: 0289-font-Fix-several-integer-overflows-in-grub_font_cons.patch -Patch0290: 0290-font-Remove-grub_font_dup_glyph.patch -Patch0291: 0291-font-Fix-integer-overflow-in-ensure_comb_space.patch -Patch0292: 0292-font-Fix-integer-overflow-in-BMP-index.patch -Patch0293: 0293-font-Fix-integer-underflow-in-binary-search-of-char-.patch -Patch0294: 0294-kern-efi-sb-Enforce-verification-of-font-files.patch -Patch0295: 0295-fbutil-Fix-integer-overflow.patch -Patch0296: 0296-font-Fix-an-integer-underflow-in-blit_comb.patch -Patch0297: 0297-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch -Patch0298: 0298-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch -Patch0299: 0299-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch -Patch0300: 0300-font-Try-opening-fonts-from-the-bundled-memdisk.patch -Patch0301: 0301-mm-Clarify-grub_real_malloc.patch -Patch0302: 0302-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch -Patch0303: 0303-mm-Document-grub_free.patch -Patch0304: 0304-mm-Document-grub_mm_init_region.patch -Patch0305: 0305-mm-Document-GRUB-internal-memory-management-structur.patch -Patch0306: 0306-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch -Patch0307: 0307-mm-When-adding-a-region-merge-with-region-after-as-w.patch -Patch0308: 0308-mm-Debug-support-for-region-operations.patch -Patch0309: 0309-mm-Drop-unused-unloading-of-modules-on-OOM.patch -Patch0310: 0310-mm-Allow-dynamically-requesting-additional-memory-re.patch -Patch0311: 0311-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch -Patch0312: 0312-kern-efi-mm-Extract-function-to-add-memory-regions.patch -Patch0313: 0313-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch -Patch0314: 0314-kern-efi-mm-Implement-runtime-addition-of-pages.patch -Patch0315: 0315-efi-Increase-default-memory-allocation-to-32-MiB.patch -Patch0316: 0316-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch -Patch0317: 0317-ppc64le-signed-boot-media-changes.patch -Patch0318: 0318-core-Fix-several-implicit-function-declarations.patch -Patch0319: 0319-Enable-shared-processor-mode-in-vector-5.patch +Patch0060: 0060-Add-grub2-switch-to-blscfg.patch +Patch0061: 0061-make-better-backtraces.patch +Patch0062: 0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0063: 0063-Work-around-some-minor-include-path-weirdnesses.patch +Patch0064: 0064-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0065: 0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0066: 0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0067: 0067-Fixup-for-newer-compiler.patch +Patch0068: 0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +Patch0069: 0069-Fixup-for-newer-compiler.patch +Patch0070: 0070-Add-support-for-non-Ethernet-network-cards.patch +Patch0071: 0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +Patch0072: 0072-bootp-New-net_bootp6-command.patch +Patch0073: 0073-efinet-UEFI-IPv6-PXE-support.patch +Patch0074: 0074-grub.texi-Add-net_bootp6-doument.patch +Patch0075: 0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0076: 0076-efinet-Setting-network-from-UEFI-device-path.patch +Patch0077: 0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0078: 0078-Support-UEFI-networking-protocols.patch +Patch0079: 0079-AUDIT-0-http-boot-tracker-bug.patch +Patch0080: 0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0081: 0081-Add-auto-hide-menu-support.patch +Patch0082: 0082-Add-grub-set-bootflag-utility.patch +Patch0083: 0083-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0084: 0084-gentpl-add-disable-support.patch +Patch0085: 0085-gentpl-add-pc-firmware-type.patch +Patch0086: 0086-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0087: 0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0088: 0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0089: 0089-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0090: 0090-Rework-how-the-fdt-command-builds.patch +Patch0091: 0091-Disable-non-wordsize-allocations-on-arm.patch +Patch0092: 0092-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0093: 0093-Make-grub_error-more-verbose.patch +Patch0094: 0094-Make-reset-an-alias-for-the-reboot-command.patch +Patch0095: 0095-Add-a-version-command.patch +Patch0096: 0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0097: 0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0098: 0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0099: 0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0100: 0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0101: 0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0102: 0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0103: 0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0104: 0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0105: 0105-Fix-getroot.c-s-trampolines.patch +Patch0106: 0106-Do-not-allow-stack-trampolines-anywhere.patch +Patch0107: 0107-Reimplement-boot_counter.patch +Patch0108: 0108-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0109: 0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0110: 0110-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0111: 0111-Make-it-possible-to-subtract-conditions-from-debug.patch +Patch0112: 0112-Export-all-variables-from-the-initial-context-when-c.patch +Patch0113: 0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0114: 0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0115: 0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0116: 0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0117: 0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0118: 0118-Add-start-symbol-for-RISC-V.patch +Patch0119: 0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0120: 0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0121: 0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0122: 0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0123: 0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0124: 0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0125: 0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0126: 0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0127: 0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +Patch0128: 0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0129: 0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0130: 0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0131: 0131-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0132: 0132-efi-http-fix-some-allocation-error-checking.patch +Patch0133: 0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0134: 0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0135: 0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0136: 0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0137: 0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0138: 0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0139: 0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0140: 0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0141: 0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0142: 0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0143: 0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0144: 0144-grub-install-disable-support-for-EFI-platforms.patch +Patch0145: 0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0146: 0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0147: 0147-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0148: 0148-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0149: 0149-kern-file-Fix-error-handling-in-grub_file_open.patch +Patch0150: 0150-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0151: 0151-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0152: 0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0153: 0153-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0154: 0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0155: 0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0156: 0156-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0157: 0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0158: 0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0159: 0159-pgp-factor-out-rsa_pad.patch +Patch0160: 0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0161: 0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0162: 0162-libtasn1-import-libtasn1-4.16.0.patch +Patch0163: 0163-libtasn1-disable-code-not-needed-in-grub.patch +Patch0164: 0164-libtasn1-changes-for-grub-compatibility.patch +Patch0165: 0165-libtasn1-compile-into-asn1-module.patch +Patch0166: 0166-test_asn1-test-module-for-libtasn1.patch +Patch0167: 0167-grub-install-support-embedding-x509-certificates.patch +Patch0168: 0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0169: 0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0170: 0170-appended-signatures-support-verifying-appended-signa.patch +Patch0171: 0171-appended-signatures-verification-tests.patch +Patch0172: 0172-appended-signatures-documentation.patch +Patch0173: 0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0174: 0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0175: 0175-ieee1275-claim-more-memory.patch +Patch0176: 0176-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0177: 0177-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0178: 0178-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0179: 0179-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0180: 0180-efinet-Add-DHCP-proxy-support.patch +Patch0181: 0181-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0182: 0182-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0183: 0183-Suppress-gettext-error-message.patch +Patch0184: 0184-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0185: 0185-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0186: 0186-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0187: 0187-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0188: 0188-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0189: 0189-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0190: 0190-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0191: 0191-Print-module-name-on-license-check-failure.patch +Patch0192: 0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0193: 0193-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0194: 0194-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0195: 0195-Add-Fedora-location-of-DejaVu-SANS-font.patch +Patch0196: 0196-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +Patch0197: 0197-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +Patch0198: 0198-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +Patch0199: 0199-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +Patch0200: 0200-Use-visual-indentation-in-config.h.in.patch +Patch0201: 0201-Where-present-ensure-config-util.h-precedes-config.h.patch +Patch0202: 0202-Drop-gnulib-fix-base64.patch.patch +Patch0203: 0203-Drop-gnulib-no-abort.patch.patch +Patch0204: 0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch +Patch0205: 0205-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +Patch0206: 0206-search-new-efidisk-only-option-on-EFI-systems.patch +Patch0207: 0207-efi-new-connectefi-command.patch +Patch0208: 0208-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0209: 0209-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +Patch0210: 0210-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0211: 0211-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0212: 0212-powerpc-do-CAS-in-a-more-compatible-way.patch +Patch0213: 0213-powerpc-prefix-detection-support-device-names-with-c.patch +Patch0214: 0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +Patch0215: 0215-make-ofdisk_retries-optional.patch +Patch0216: 0216-loader-efi-chainloader-grub_load_and_start_image-doe.patch +Patch0217: 0217-loader-efi-chainloader-simplify-the-loader-state.patch +Patch0218: 0218-commands-boot-Add-API-to-pass-context-to-loader.patch +Patch0219: 0219-loader-efi-chainloader-Use-grub_loader_set_ex.patch +Patch0220: 0220-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch +Patch0221: 0221-loader-i386-efi-linux-Use-grub_loader_set_ex.patch +Patch0222: 0222-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch +Patch0223: 0223-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch +Patch0224: 0224-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch +Patch0225: 0225-video-readers-png-Abort-sooner-if-a-read-operation-f.patch +Patch0226: 0226-video-readers-png-Refuse-to-handle-multiple-image-he.patch +Patch0227: 0227-video-readers-png-Drop-greyscale-support-to-fix-heap.patch +Patch0228: 0228-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch +Patch0229: 0229-video-readers-png-Sanity-check-some-huffman-codes.patch +Patch0230: 0230-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch +Patch0231: 0231-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch +Patch0232: 0232-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch +Patch0233: 0233-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch +Patch0234: 0234-normal-charset-Fix-array-out-of-bounds-formatting-un.patch +Patch0235: 0235-net-netbuff-Block-overly-large-netbuff-allocs.patch +Patch0236: 0236-net-ip-Do-IP-fragment-maths-safely.patch +Patch0237: 0237-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch +Patch0238: 0238-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch +Patch0239: 0239-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch +Patch0240: 0240-net-tftp-Avoid-a-trivial-UAF.patch +Patch0241: 0241-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch +Patch0242: 0242-net-http-Fix-OOB-write-for-split-http-headers.patch +Patch0243: 0243-net-http-Error-out-on-headers-with-LF-without-CR.patch +Patch0244: 0244-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch +Patch0245: 0245-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch +Patch0246: 0246-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch +Patch0247: 0247-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch +Patch0248: 0248-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch +Patch0249: 0249-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch +Patch0250: 0250-misc-Make-grub_min-and-grub_max-more-resilient.patch +Patch0251: 0251-ReiserFS-switch-to-using-grub_min-grub_max.patch +Patch0252: 0252-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch +Patch0253: 0253-modules-make-.module_license-read-only.patch +Patch0254: 0254-modules-strip-.llvm_addrsig-sections-and-similar.patch +Patch0255: 0255-modules-Don-t-allocate-space-for-non-allocable-secti.patch +Patch0256: 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch +Patch0257: 0257-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch +Patch0258: 0258-modules-load-module-sections-at-page-aligned-address.patch +Patch0259: 0259-nx-add-memory-attribute-get-set-API.patch +Patch0260: 0260-nx-set-page-permissions-for-loaded-modules.patch +Patch0261: 0261-nx-set-attrs-in-our-kernel-loaders.patch +Patch0262: 0262-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch +Patch0263: 0263-grub-probe-document-the-behavior-of-multiple-v.patch +Patch0264: 0264-grub_fs_probe-dprint-errors-from-filesystems.patch +Patch0265: 0265-fs-fat-don-t-error-when-mtime-is-0.patch +Patch0266: 0266-Make-debug-file-show-which-file-filters-get-run.patch +Patch0267: 0267-efi-use-enumerated-array-positions-for-our-allocatio.patch +Patch0268: 0268-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch +Patch0269: 0269-efi-allocate-the-initrd-within-the-bounds-expressed-.patch +Patch0270: 0270-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch +Patch0271: 0271-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +Patch0272: 0272-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +Patch0273: 0273-squish-give-up-on-rhgb-quiet.patch +Patch0274: 0274-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +Patch0275: 0275-ieee1275-implement-vec5-for-cas-negotiation.patch +Patch0276: 0276-blscfg-Don-t-root-device-in-emu-builds.patch +Patch0277: 0277-loader-arm64-linux-Remove-magic-number-header-field-.patch +Patch0278: 0278-Correct-BSS-zeroing-on-aarch64.patch +Patch0279: 0279-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch +Patch0280: 0280-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch +Patch0281: 0281-commands-efi-tpm-Refine-the-status-of-log-event.patch +Patch0282: 0282-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch +Patch0283: 0283-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch +Patch0284: 0284-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch +Patch0285: 0285-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch +Patch0286: 0286-font-Fix-several-integer-overflows-in-grub_font_cons.patch +Patch0287: 0287-font-Remove-grub_font_dup_glyph.patch +Patch0288: 0288-font-Fix-integer-overflow-in-ensure_comb_space.patch +Patch0289: 0289-font-Fix-integer-overflow-in-BMP-index.patch +Patch0290: 0290-font-Fix-integer-underflow-in-binary-search-of-char-.patch +Patch0291: 0291-kern-efi-sb-Enforce-verification-of-font-files.patch +Patch0292: 0292-fbutil-Fix-integer-overflow.patch +Patch0293: 0293-font-Fix-an-integer-underflow-in-blit_comb.patch +Patch0294: 0294-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch +Patch0295: 0295-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch +Patch0296: 0296-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch +Patch0297: 0297-font-Try-opening-fonts-from-the-bundled-memdisk.patch +Patch0298: 0298-Correction-in-vector-5-values.patch +Patch0299: 0299-mm-Clarify-grub_real_malloc.patch +Patch0300: 0300-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch +Patch0301: 0301-mm-Document-grub_free.patch +Patch0302: 0302-mm-Document-grub_mm_init_region.patch +Patch0303: 0303-mm-Document-GRUB-internal-memory-management-structur.patch +Patch0304: 0304-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch +Patch0305: 0305-mm-When-adding-a-region-merge-with-region-after-as-w.patch +Patch0306: 0306-mm-Debug-support-for-region-operations.patch +Patch0307: 0307-mm-Drop-unused-unloading-of-modules-on-OOM.patch +Patch0308: 0308-mm-Allow-dynamically-requesting-additional-memory-re.patch +Patch0309: 0309-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch +Patch0310: 0310-kern-efi-mm-Extract-function-to-add-memory-regions.patch +Patch0311: 0311-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch +Patch0312: 0312-kern-efi-mm-Implement-runtime-addition-of-pages.patch +Patch0313: 0313-efi-Increase-default-memory-allocation-to-32-MiB.patch +Patch0314: 0314-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch +Patch0315: 0315-ppc64le-signed-boot-media-changes.patch +Patch0316: 0316-core-Fix-several-implicit-function-declarations.patch +Patch0317: 0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch diff --git a/grub2.spec b/grub2.spec index eb3fe3f9..d4fa2381 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 83%{?dist} +Release: 84%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Feb 06 2023 Robbie Harwood - 2.06-84 +- emu: support newer kexec syscall + * Mon Feb 06 2023 Robbie Harwood - 2.06-83 - ppc64le: cas5, take 3 From 851216d61a810951712de325eb1dcb884c4220c3 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 8 Feb 2023 20:07:44 +0000 Subject: [PATCH 182/294] ppc64le: sync cas/tpm patchset with upstream Signed-off-by: Robbie Harwood --- ...-Also-handle-the-Extended-Key-Usage-.patch | 0 0175-ieee1275-claim-more-memory.patch | 252 ---------- ...eee1275-ofdisk-retry-on-open-failure.patch | 0 ...-memory-with-ibm-client-architecture.patch | 268 ----------- ...ainloading-EFI-apps-from-loop-mounts.patch | 0 ...> 0178-efinet-Add-DHCP-proxy-support.patch | 0 ...gnore-checksum-seed-incompat-feature.patch | 0 ...-cmdline-when-generating-legacy-menu.patch | 0 ... 0181-Suppress-gettext-error-message.patch | 0 ...d-Always-use-boot-grub2-user.cfg-as-.patch | 0 ...for-EFI-at-runtime-instead-of-config.patch | 0 ...or-if-boot-to-firmware-setup-is-not-.patch | 0 ...x-EFI-loader-kernel-image-allocation.patch | 0 ...over-the-device-to-read-the-config-f.patch | 0 ...etting-of-prefix-for-signed-binary-c.patch | 0 ...adable-filesystem-with-v4-superblock.patch | 0 ...module-name-on-license-check-failure.patch | 0 ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 0 ...-mkconfig-restore-umask-for-grub.cfg.patch | 0 ...btrfs-Use-full-btrfs-bootloader-area.patch | 0 ...-Fedora-location-of-DejaVu-SANS-font.patch | 0 ...t-show-Booting-s-msg-when-auto-booti.patch | 0 ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 0 ...ot-set-colorstate-until-the-first-te.patch | 0 ...ot-set-cursor-until-the-first-text-o.patch | 0 ...se-visual-indentation-in-config.h.in.patch | 0 ...sure-config-util.h-precedes-config.h.patch | 0 ...=> 0200-Drop-gnulib-fix-base64.patch.patch | 0 ...h => 0201-Drop-gnulib-no-abort.patch.patch | 0 ...version-and-drop-most-gnulib-patches.patch | 0 ...Fix-bug-stopping-iteration-when-no-f.patch | 0 ...w-efidisk-only-option-on-EFI-systems.patch | 0 ...h => 0205-efi-new-connectefi-command.patch | 0 ...-i386-efi-linux.c-do-not-validate-ke.patch | 0 ...-arm64-linux.c-do-not-validate-kerne.patch | 0 ...-efi-chainloader.c-do-not-validate-c.patch | 0 ...-efi-linux.c-drop-now-unused-grub_li.patch | 0 ...etection-support-device-names-with-c.patch | 0 ...=> 0211-make-ofdisk_retries-optional.patch | 0 ...loader-grub_load_and_start_image-doe.patch | 0 ...erpc-do-CAS-in-a-more-compatible-way.patch | 110 ----- ...hainloader-simplify-the-loader-state.patch | 0 ...ot-Add-API-to-pass-context-to-loader.patch | 0 ...i-chainloader-Use-grub_loader_set_ex.patch | 0 ...linux-Avoid-a-use-after-free-in-the-.patch | 0 ...386-efi-linux-Use-grub_loader_set_ex.patch | 0 ...linux-Fix-a-memory-leak-in-the-initr.patch | 0 ...ct-non-kernel-files-in-the-shim_lock.patch | 0 ...-leak-device_name-on-error-in-grub_f.patch | 0 ...g-Abort-sooner-if-a-read-operation-f.patch | 0 ...g-Refuse-to-handle-multiple-image-he.patch | 0 ...g-Drop-greyscale-support-to-fix-heap.patch | 0 ...g-Avoid-heap-OOB-R-W-inserting-huff-.patch | 0 ...-png-Sanity-check-some-huffman-codes.patch | 0 ...eg-Abort-sooner-if-a-read-operation-.patch | 0 ...eg-Do-not-reallocate-a-given-huff-ta.patch | 0 ...eg-Refuse-to-handle-multiple-start-o.patch | 0 ...eg-Block-int-underflow-wild-pointer-.patch | 0 ...ix-array-out-of-bounds-formatting-un.patch | 0 ...ff-Block-overly-large-netbuff-allocs.patch | 0 ...2-net-ip-Do-IP-fragment-maths-safely.patch | 0 ...le-free-addresses-on-corrupt-DNS-res.patch | 0 ...ad-past-the-end-of-the-string-we-re-.patch | 0 ...-a-UAF-and-double-free-from-a-failed.patch | 0 ...=> 0236-net-tftp-Avoid-a-trivial-UAF.patch | 0 ...tear-down-socket-if-it-s-already-bee.patch | 0 ...Fix-OOB-write-for-split-http-headers.patch | 0 ...or-out-on-headers-with-LF-without-CR.patch | 0 ...ead-past-the-end-of-nat-journal-entr.patch | 0 ...-not-read-past-the-end-of-nat-bitmap.patch | 0 ...ot-copy-file-names-that-are-too-long.patch | 0 ...eral-fuzz-issues-with-invalid-dir-it.patch | 0 ...e-ASAN-and-SEGV-issues-found-with-fu.patch | 0 ...x-more-fuzz-issues-related-to-chunks.patch | 0 ...grub_min-and-grub_max-more-resilient.patch | 0 ...FS-switch-to-using-grub_min-grub_max.patch | 0 ...oot_time-also-call-grub_dprintf-boot.patch | 0 ...dules-make-.module_license-read-only.patch | 0 ...p-.llvm_addrsig-sections-and-similar.patch | 0 ...locate-space-for-non-allocable-secti.patch | 0 ...eader-struct-and-fix-some-bad-naming.patch | 0 ...nel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch | 0 ...ule-sections-at-page-aligned-address.patch | 2 +- ...-nx-add-memory-attribute-get-set-API.patch | 0 ...-page-permissions-for-loaded-modules.patch | 0 ...7-nx-set-attrs-in-our-kernel-loaders.patch | 0 ...x-compatible-flag-in-EFI-grub-images.patch | 0 ...-document-the-behavior-of-multiple-v.patch | 0 ...probe-dprint-errors-from-filesystems.patch | 0 ...1-fs-fat-don-t-error-when-mtime-is-0.patch | 0 ...file-show-which-file-filters-get-run.patch | 0 ...ed-array-positions-for-our-allocatio.patch | 0 ...tion-policy-for-kernel-vs-initrd-mem.patch | 0 ...-initrd-within-the-bounds-expressed-.patch | 0 ...ER_-CODE-DATA-for-kernel-and-initrd-.patch | 0 ...e-etc-kernel-cmdline-during-mkconfig.patch | 0 ...sh-don-t-dup-rhgb-quiet-check-mtimes.patch | 0 ...=> 0269-squish-give-up-on-rhgb-quiet.patch | 0 ...write-etc-kernel-cmdline-if-writable.patch | 0 ...scfg-Don-t-root-device-in-emu-builds.patch | 0 ...ux-Remove-magic-number-header-field-.patch | 0 ... 0273-Correct-BSS-zeroing-on-aarch64.patch | 0 ...ate-i-cache-before-starting-the-kern.patch | 0 ...5-implement-vec5-for-cas-negotiation.patch | 70 --- ...ncorrect-array-size-in-kernel-alloca.patch | 0 ...i-tpm-Refine-the-status-of-log-event.patch | 0 ...-Use-grub_strcpy-instead-of-grub_mem.patch | 0 ...-EFI_CC_MEASUREMENT_PROTOCOL-support.patch | 0 ...hs-exceeds-font-max_glyph_width-or-f.patch | 0 ...erflow-in-grub_font_get_glyph_intern.patch | 0 ...-integer-overflows-in-grub_font_cons.patch | 0 ...0282-font-Remove-grub_font_dup_glyph.patch | 0 ...nteger-overflow-in-ensure_comb_space.patch | 0 ...nt-Fix-integer-overflow-in-BMP-index.patch | 0 ...-underflow-in-binary-search-of-char-.patch | 0 ...b-Enforce-verification-of-font-files.patch | 0 ... => 0287-fbutil-Fix-integer-overflow.patch | 0 ...ix-an-integer-underflow-in-blit_comb.patch | 0 ..._font_blit_glyph-and-grub_font_blit_.patch | 0 ...l_font-to-glyphs-in-ascii_font_glyph.patch | 0 ...ix-an-integer-overflow-in-grub_unico.patch | 0 ...ening-fonts-from-the-bundled-memdisk.patch | 0 ... => 0293-mm-Clarify-grub_real_malloc.patch | 0 ...loc-Make-small-allocs-comment-match-.patch | 0 ....patch => 0295-mm-Document-grub_free.patch | 0 ...0296-mm-Document-grub_mm_init_region.patch | 0 ...-internal-memory-management-structur.patch | 0 0298-Correction-in-vector-5-values.patch | 30 -- ...e-preserve-header-vs-region-alignmen.patch | 0 ...-region-merge-with-region-after-as-w.patch | 0 ...-Debug-support-for-region-operations.patch | 0 ...p-unused-unloading-of-modules-on-OOM.patch | 0 ...ally-requesting-additional-memory-re.patch | 0 ...ys-request-a-fixed-number-of-pages-o.patch | 0 ...tract-function-to-add-memory-regions.patch | 0 ...ss-up-errors-from-add_memory_regions.patch | 0 ...-Implement-runtime-addition-of-pages.patch | 0 ...-default-memory-allocation-to-32-MiB.patch | 0 ...e-disk-caches-last-when-out-of-memor.patch | 0 ...09-ppc64le-signed-boot-media-changes.patch | 0 ...veral-implicit-function-declarations.patch | 0 ...rt-for-grub-emu-to-kexec-Linux-menu-.patch | 6 +- ...n-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch | 111 +++++ ...-memory-with-ibm-client-architecture.patch | 308 +++++++++++++ ...ee1275-drop-len-1-quirk-in-heap_init.patch | 36 ++ ...1275-support-runtime-memory-claiming.patch | 435 ++++++++++++++++++ ...5-implement-vec5-for-cas-negotiation.patch | 74 +++ ...ort-for-trusted-boot-using-a-vTPM-2..patch | 66 +-- 0318-powerpc-Drop-Open-Hack-Ware.patch | 69 +++ grub.patches | 287 ++++++------ grub2.spec | 5 +- 151 files changed, 1223 insertions(+), 906 deletions(-) rename 0177-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (100%) delete mode 100644 0175-ieee1275-claim-more-memory.patch rename 0178-ieee1275-ofdisk-retry-on-open-failure.patch => 0176-ieee1275-ofdisk-retry-on-open-failure.patch (100%) delete mode 100644 0176-ieee1275-request-memory-with-ibm-client-architecture.patch rename 0179-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch (100%) rename 0180-efinet-Add-DHCP-proxy-support.patch => 0178-efinet-Add-DHCP-proxy-support.patch (100%) rename 0181-fs-ext2-Ignore-checksum-seed-incompat-feature.patch => 0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch (100%) rename 0182-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (100%) rename 0183-Suppress-gettext-error-message.patch => 0181-Suppress-gettext-error-message.patch (100%) rename 0184-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (100%) rename 0185-templates-Check-for-EFI-at-runtime-instead-of-config.patch => 0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch (100%) rename 0186-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch => 0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch (100%) rename 0187-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch (100%) rename 0188-normal-main-Discover-the-device-to-read-the-config-f.patch => 0186-normal-main-Discover-the-device-to-read-the-config-f.patch (100%) rename 0189-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (100%) rename 0190-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch => 0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch (100%) rename 0191-Print-module-name-on-license-check-failure.patch => 0189-Print-module-name-on-license-check-failure.patch (100%) rename 0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (100%) rename 0193-grub-mkconfig-restore-umask-for-grub.cfg.patch => 0191-grub-mkconfig-restore-umask-for-grub.cfg.patch (100%) rename 0194-fs-btrfs-Use-full-btrfs-bootloader-area.patch => 0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch (100%) rename 0195-Add-Fedora-location-of-DejaVu-SANS-font.patch => 0193-Add-Fedora-location-of-DejaVu-SANS-font.patch (100%) rename 0196-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch => 0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch (100%) rename 0197-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch => 0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch (100%) rename 0198-EFI-console-Do-not-set-colorstate-until-the-first-te.patch => 0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch (100%) rename 0199-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch => 0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch (100%) rename 0200-Use-visual-indentation-in-config.h.in.patch => 0198-Use-visual-indentation-in-config.h.in.patch (100%) rename 0201-Where-present-ensure-config-util.h-precedes-config.h.patch => 0199-Where-present-ensure-config-util.h-precedes-config.h.patch (100%) rename 0202-Drop-gnulib-fix-base64.patch.patch => 0200-Drop-gnulib-fix-base64.patch.patch (100%) rename 0203-Drop-gnulib-no-abort.patch.patch => 0201-Drop-gnulib-no-abort.patch.patch (100%) rename 0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch => 0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch (100%) rename 0205-commands-search-Fix-bug-stopping-iteration-when-no-f.patch => 0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch (100%) rename 0206-search-new-efidisk-only-option-on-EFI-systems.patch => 0204-search-new-efidisk-only-option-on-EFI-systems.patch (100%) rename 0207-efi-new-connectefi-command.patch => 0205-efi-new-connectefi-command.patch (100%) rename 0208-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch => 0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch (100%) rename 0209-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch => 0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch (100%) rename 0210-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch => 0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch (100%) rename 0211-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch => 0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch (100%) rename 0213-powerpc-prefix-detection-support-device-names-with-c.patch => 0210-powerpc-prefix-detection-support-device-names-with-c.patch (100%) rename 0215-make-ofdisk_retries-optional.patch => 0211-make-ofdisk_retries-optional.patch (100%) rename 0216-loader-efi-chainloader-grub_load_and_start_image-doe.patch => 0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch (100%) delete mode 100644 0212-powerpc-do-CAS-in-a-more-compatible-way.patch rename 0217-loader-efi-chainloader-simplify-the-loader-state.patch => 0213-loader-efi-chainloader-simplify-the-loader-state.patch (100%) rename 0218-commands-boot-Add-API-to-pass-context-to-loader.patch => 0214-commands-boot-Add-API-to-pass-context-to-loader.patch (100%) rename 0219-loader-efi-chainloader-Use-grub_loader_set_ex.patch => 0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch (100%) rename 0220-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch => 0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch (100%) rename 0221-loader-i386-efi-linux-Use-grub_loader_set_ex.patch => 0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch (100%) rename 0222-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch => 0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch (100%) rename 0223-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch => 0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch (100%) rename 0224-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch => 0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch (100%) rename 0225-video-readers-png-Abort-sooner-if-a-read-operation-f.patch => 0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch (100%) rename 0226-video-readers-png-Refuse-to-handle-multiple-image-he.patch => 0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch (100%) rename 0227-video-readers-png-Drop-greyscale-support-to-fix-heap.patch => 0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch (100%) rename 0228-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch => 0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch (100%) rename 0229-video-readers-png-Sanity-check-some-huffman-codes.patch => 0225-video-readers-png-Sanity-check-some-huffman-codes.patch (100%) rename 0230-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch => 0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch (100%) rename 0231-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch => 0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch (100%) rename 0232-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch => 0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch (100%) rename 0233-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch => 0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch (100%) rename 0234-normal-charset-Fix-array-out-of-bounds-formatting-un.patch => 0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch (100%) rename 0235-net-netbuff-Block-overly-large-netbuff-allocs.patch => 0231-net-netbuff-Block-overly-large-netbuff-allocs.patch (100%) rename 0236-net-ip-Do-IP-fragment-maths-safely.patch => 0232-net-ip-Do-IP-fragment-maths-safely.patch (100%) rename 0237-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch => 0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch (100%) rename 0238-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch => 0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch (100%) rename 0239-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch => 0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch (100%) rename 0240-net-tftp-Avoid-a-trivial-UAF.patch => 0236-net-tftp-Avoid-a-trivial-UAF.patch (100%) rename 0241-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch => 0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch (100%) rename 0242-net-http-Fix-OOB-write-for-split-http-headers.patch => 0238-net-http-Fix-OOB-write-for-split-http-headers.patch (100%) rename 0243-net-http-Error-out-on-headers-with-LF-without-CR.patch => 0239-net-http-Error-out-on-headers-with-LF-without-CR.patch (100%) rename 0244-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch => 0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch (100%) rename 0245-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch => 0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch (100%) rename 0246-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch => 0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch (100%) rename 0247-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch => 0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch (100%) rename 0248-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch => 0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch (100%) rename 0249-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch => 0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch (100%) rename 0250-misc-Make-grub_min-and-grub_max-more-resilient.patch => 0246-misc-Make-grub_min-and-grub_max-more-resilient.patch (100%) rename 0251-ReiserFS-switch-to-using-grub_min-grub_max.patch => 0247-ReiserFS-switch-to-using-grub_min-grub_max.patch (100%) rename 0252-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch => 0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch (100%) rename 0253-modules-make-.module_license-read-only.patch => 0249-modules-make-.module_license-read-only.patch (100%) rename 0254-modules-strip-.llvm_addrsig-sections-and-similar.patch => 0250-modules-strip-.llvm_addrsig-sections-and-similar.patch (100%) rename 0255-modules-Don-t-allocate-space-for-non-allocable-secti.patch => 0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch (100%) rename 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch => 0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch (100%) rename 0257-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch => 0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch (100%) rename 0258-modules-load-module-sections-at-page-aligned-address.patch => 0254-modules-load-module-sections-at-page-aligned-address.patch (99%) rename 0259-nx-add-memory-attribute-get-set-API.patch => 0255-nx-add-memory-attribute-get-set-API.patch (100%) rename 0260-nx-set-page-permissions-for-loaded-modules.patch => 0256-nx-set-page-permissions-for-loaded-modules.patch (100%) rename 0261-nx-set-attrs-in-our-kernel-loaders.patch => 0257-nx-set-attrs-in-our-kernel-loaders.patch (100%) rename 0262-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch => 0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch (100%) rename 0263-grub-probe-document-the-behavior-of-multiple-v.patch => 0259-grub-probe-document-the-behavior-of-multiple-v.patch (100%) rename 0264-grub_fs_probe-dprint-errors-from-filesystems.patch => 0260-grub_fs_probe-dprint-errors-from-filesystems.patch (100%) rename 0265-fs-fat-don-t-error-when-mtime-is-0.patch => 0261-fs-fat-don-t-error-when-mtime-is-0.patch (100%) rename 0266-Make-debug-file-show-which-file-filters-get-run.patch => 0262-Make-debug-file-show-which-file-filters-get-run.patch (100%) rename 0267-efi-use-enumerated-array-positions-for-our-allocatio.patch => 0263-efi-use-enumerated-array-positions-for-our-allocatio.patch (100%) rename 0268-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch => 0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch (100%) rename 0269-efi-allocate-the-initrd-within-the-bounds-expressed-.patch => 0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch (100%) rename 0270-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch => 0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch (100%) rename 0271-BLS-create-etc-kernel-cmdline-during-mkconfig.patch => 0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch (100%) rename 0272-squish-don-t-dup-rhgb-quiet-check-mtimes.patch => 0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch (100%) rename 0273-squish-give-up-on-rhgb-quiet.patch => 0269-squish-give-up-on-rhgb-quiet.patch (100%) rename 0274-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch => 0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch (100%) rename 0276-blscfg-Don-t-root-device-in-emu-builds.patch => 0271-blscfg-Don-t-root-device-in-emu-builds.patch (100%) rename 0277-loader-arm64-linux-Remove-magic-number-header-field-.patch => 0272-loader-arm64-linux-Remove-magic-number-header-field-.patch (100%) rename 0278-Correct-BSS-zeroing-on-aarch64.patch => 0273-Correct-BSS-zeroing-on-aarch64.patch (100%) rename 0279-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch => 0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch (100%) delete mode 100644 0275-ieee1275-implement-vec5-for-cas-negotiation.patch rename 0280-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch => 0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch (100%) rename 0281-commands-efi-tpm-Refine-the-status-of-log-event.patch => 0276-commands-efi-tpm-Refine-the-status-of-log-event.patch (100%) rename 0282-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch => 0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch (100%) rename 0283-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch => 0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch (100%) rename 0284-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch => 0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch (100%) rename 0285-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch => 0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch (100%) rename 0286-font-Fix-several-integer-overflows-in-grub_font_cons.patch => 0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch (100%) rename 0287-font-Remove-grub_font_dup_glyph.patch => 0282-font-Remove-grub_font_dup_glyph.patch (100%) rename 0288-font-Fix-integer-overflow-in-ensure_comb_space.patch => 0283-font-Fix-integer-overflow-in-ensure_comb_space.patch (100%) rename 0289-font-Fix-integer-overflow-in-BMP-index.patch => 0284-font-Fix-integer-overflow-in-BMP-index.patch (100%) rename 0290-font-Fix-integer-underflow-in-binary-search-of-char-.patch => 0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch (100%) rename 0291-kern-efi-sb-Enforce-verification-of-font-files.patch => 0286-kern-efi-sb-Enforce-verification-of-font-files.patch (100%) rename 0292-fbutil-Fix-integer-overflow.patch => 0287-fbutil-Fix-integer-overflow.patch (100%) rename 0293-font-Fix-an-integer-underflow-in-blit_comb.patch => 0288-font-Fix-an-integer-underflow-in-blit_comb.patch (100%) rename 0294-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch => 0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch (100%) rename 0295-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch => 0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch (100%) rename 0296-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch => 0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch (100%) rename 0297-font-Try-opening-fonts-from-the-bundled-memdisk.patch => 0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch (100%) rename 0299-mm-Clarify-grub_real_malloc.patch => 0293-mm-Clarify-grub_real_malloc.patch (100%) rename 0300-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch => 0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch (100%) rename 0301-mm-Document-grub_free.patch => 0295-mm-Document-grub_free.patch (100%) rename 0302-mm-Document-grub_mm_init_region.patch => 0296-mm-Document-grub_mm_init_region.patch (100%) rename 0303-mm-Document-GRUB-internal-memory-management-structur.patch => 0297-mm-Document-GRUB-internal-memory-management-structur.patch (100%) delete mode 100644 0298-Correction-in-vector-5-values.patch rename 0304-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch => 0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch (100%) rename 0305-mm-When-adding-a-region-merge-with-region-after-as-w.patch => 0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch (100%) rename 0306-mm-Debug-support-for-region-operations.patch => 0300-mm-Debug-support-for-region-operations.patch (100%) rename 0307-mm-Drop-unused-unloading-of-modules-on-OOM.patch => 0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch (100%) rename 0308-mm-Allow-dynamically-requesting-additional-memory-re.patch => 0302-mm-Allow-dynamically-requesting-additional-memory-re.patch (100%) rename 0309-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch => 0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch (100%) rename 0310-kern-efi-mm-Extract-function-to-add-memory-regions.patch => 0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch (100%) rename 0311-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch => 0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch (100%) rename 0312-kern-efi-mm-Implement-runtime-addition-of-pages.patch => 0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch (100%) rename 0313-efi-Increase-default-memory-allocation-to-32-MiB.patch => 0307-efi-Increase-default-memory-allocation-to-32-MiB.patch (100%) rename 0314-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch => 0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch (100%) rename 0315-ppc64le-signed-boot-media-changes.patch => 0309-ppc64le-signed-boot-media-changes.patch (100%) rename 0316-core-Fix-several-implicit-function-declarations.patch => 0310-core-Fix-several-implicit-function-declarations.patch (100%) rename 0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch => 0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch (99%) create mode 100644 0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch create mode 100644 0313-ieee1275-request-memory-with-ibm-client-architecture.patch create mode 100644 0314-ieee1275-drop-len-1-quirk-in-heap_init.patch create mode 100644 0315-ieee1275-support-runtime-memory-claiming.patch create mode 100644 0316-ieee1275-implement-vec5-for-cas-negotiation.patch rename 0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch => 0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch (80%) create mode 100644 0318-powerpc-Drop-Open-Hack-Ware.patch diff --git a/0177-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 100% rename from 0177-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch diff --git a/0175-ieee1275-claim-more-memory.patch b/0175-ieee1275-claim-more-memory.patch deleted file mode 100644 index 6ec319be..00000000 --- a/0175-ieee1275-claim-more-memory.patch +++ /dev/null @@ -1,252 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Wed, 15 Apr 2020 23:28:29 +1000 -Subject: [PATCH] ieee1275: claim more memory - -On powerpc-ieee1275, we are running out of memory trying to verify -anything. This is because: - - - we have to load an entire file into memory to verify it. This is - extremely difficult to change with appended signatures. - - We only have 32MB of heap. - - Distro kernels are now often around 30MB. - -So we want to claim more memory from OpenFirmware for our heap. - -There are some complications: - - - The grub mm code isn't the only thing that will make claims on - memory from OpenFirmware: - - * PFW/SLOF will have claimed some for their own use. - - * The ieee1275 loader will try to find other bits of memory that we - haven't claimed to place the kernel and initrd when we go to boot. - - * Once we load Linux, it will also try to claim memory. It claims - memory without any reference to /memory/available, it just starts - at min(top of RMO, 768MB) and works down. So we need to avoid this - area. See arch/powerpc/kernel/prom_init.c as of v5.11. - - - The smallest amount of memory a ppc64 KVM guest can have is 256MB. - It doesn't work with distro kernels but can work with custom kernels. - We should maintain support for that. (ppc32 can boot with even less, - and we shouldn't break that either.) - - - Even if a VM has more memory, the memory OpenFirmware makes available - as Real Memory Area can be restricted. A freshly created LPAR on a - PowerVM machine is likely to have only 256MB available to OpenFirmware - even if it has many gigabytes of memory allocated. - -EFI systems will attempt to allocate 1/4th of the available memory, -clamped to between 1M and 1600M. That seems like a good sort of -approach, we just need to figure out if 1/4 is the right fraction -for us. - -We don't know in advance how big the kernel and initrd are going to be, -which makes figuring out how much memory we can take a bit tricky. - -To figure out how much memory we should leave unused, I looked at: - - - an Ubuntu 20.04.1 ppc64le pseries KVM guest: - vmlinux: ~30MB - initrd: ~50MB - - - a RHEL8.2 ppc64le pseries KVM guest: - vmlinux: ~30MB - initrd: ~30MB - -Ubuntu VMs struggle to boot with just 256MB under SLOF. -RHEL likewise has a higher minimum supported memory figure. -So lets first consider a distro kernel and 512MB of addressible memory. -(This is the default case for anything booting under PFW.) Say we lose -131MB to PFW (based on some tests). This leaves us 381MB. 1/4 of 381MB -is ~95MB. That should be enough to verify a 30MB vmlinux and should -leave plenty of space to load Linux and the initrd. - -If we consider 256MB of RMA under PFW, we have just 125MB remaining. 1/4 -of that is a smidge under 32MB, which gives us very poor odds of verifying -a distro-sized kernel. However, if we need 80MB just to put the kernel -and initrd in memory, we can't claim any more than 45MB anyway. So 1/4 -will do. We'll come back to this later. - -grub is always built as a 32-bit binary, even if it's loading a ppc64 -kernel. So we can't address memory beyond 4GB. This gives a natural cap -of 1GB for powerpc-ieee1275. - -Also apply this 1/4 approach to i386-ieee1275, but keep the 32MB cap. - -make check still works for both i386 and powerpc and I've booted -powerpc grub with this change under SLOF and PFW. - -Signed-off-by: Daniel Axtens ---- - grub-core/kern/ieee1275/init.c | 81 +++++++++++++++++++++++++++++++++--------- - docs/grub-dev.texi | 6 ++-- - 2 files changed, 69 insertions(+), 18 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 0dcd114ce5..c61d91a028 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -46,11 +46,12 @@ - #endif - #include - --/* The maximum heap size we're going to claim */ -+/* The maximum heap size we're going to claim. Not used by sparc. -+ We allocate 1/4 of the available memory under 4G, up to this limit. */ - #ifdef __i386__ - #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) --#else --#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024) -+#else // __powerpc__ -+#define HEAP_MAX_SIZE (unsigned long) (1 * 1024 * 1024 * 1024) - #endif - - extern char _end[]; -@@ -147,16 +148,45 @@ grub_claim_heap (void) - + GRUB_KERNEL_MACHINE_STACK_SIZE), 0x200000); - } - #else --/* Helper for grub_claim_heap. */ -+/* Helper for grub_claim_heap on powerpc. */ -+static int -+heap_size (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, -+ void *data) -+{ -+ grub_uint32_t total = *(grub_uint32_t *)data; -+ -+ if (type != GRUB_MEMORY_AVAILABLE) -+ return 0; -+ -+ /* Do not consider memory beyond 4GB */ -+ if (addr > 0xffffffffUL) -+ return 0; -+ -+ if (addr + len > 0xffffffffUL) -+ len = 0xffffffffUL - addr; -+ -+ total += len; -+ *(grub_uint32_t *)data = total; -+ -+ return 0; -+} -+ - static int - heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - void *data) - { -- unsigned long *total = data; -+ grub_uint32_t total = *(grub_uint32_t *)data; - - if (type != GRUB_MEMORY_AVAILABLE) - return 0; - -+ /* Do not consider memory beyond 4GB */ -+ if (addr > 0xffffffffUL) -+ return 0; -+ -+ if (addr + len > 0xffffffffUL) -+ len = 0xffffffffUL - addr; -+ - if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM)) - { - if (addr + len <= 0x180000) -@@ -170,10 +200,6 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - } - len -= 1; /* Required for some firmware. */ - -- /* Never exceed HEAP_MAX_SIZE */ -- if (*total + len > HEAP_MAX_SIZE) -- len = HEAP_MAX_SIZE - *total; -- - /* In theory, firmware should already prevent this from happening by not - listing our own image in /memory/available. The check below is intended - as a safeguard in case that doesn't happen. However, it doesn't protect -@@ -185,6 +211,18 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - len = 0; - } - -+ /* If this block contains 0x30000000 (768MB), do not claim below that. -+ Linux likes to claim memory at min(RMO top, 768MB) and works down -+ without reference to /memory/available. */ -+ if ((addr < 0x30000000) && ((addr + len) > 0x30000000)) -+ { -+ len = len - (0x30000000 - addr); -+ addr = 0x30000000; -+ } -+ -+ if (len > total) -+ len = total; -+ - if (len) - { - grub_err_t err; -@@ -193,10 +231,12 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - if (err) - return err; - grub_mm_init_region ((void *) (grub_addr_t) addr, len); -+ total -= len; - } - -- *total += len; -- if (*total >= HEAP_MAX_SIZE) -+ *(grub_uint32_t *)data = total; -+ -+ if (total == 0) - return 1; - - return 0; -@@ -205,13 +245,22 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - static void - grub_claim_heap (void) - { -- unsigned long total = 0; -+ grub_uint32_t total = 0; - - if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) -- heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, -- 1, &total); -- else -- grub_machine_mmap_iterate (heap_init, &total); -+ { -+ heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, -+ 1, &total); -+ return; -+ } -+ -+ grub_machine_mmap_iterate (heap_size, &total); -+ -+ total = total / 4; -+ if (total > HEAP_MAX_SIZE) -+ total = HEAP_MAX_SIZE; -+ -+ grub_machine_mmap_iterate (heap_init, &total); - } - #endif - -diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 19f708ee66..90083772c8 100644 ---- a/docs/grub-dev.texi -+++ b/docs/grub-dev.texi -@@ -1047,7 +1047,9 @@ space is limited to 4GiB. GRUB allocates pages from EFI for its heap, at most - 1.6 GiB. - - On i386-ieee1275 and powerpc-ieee1275 GRUB uses same stack as IEEE1275. --It allocates at most 32MiB for its heap. -+ -+On i386-ieee1275, GRUB allocates at most 32MiB for its heap. On -+powerpc-ieee1275, GRUB allocates up to 1GiB. - - On sparc64-ieee1275 stack is 256KiB and heap is 2MiB. - -@@ -1075,7 +1077,7 @@ In short: - @item i386-qemu @tab 60 KiB @tab < 4 GiB - @item *-efi @tab ? @tab < 1.6 GiB - @item i386-ieee1275 @tab ? @tab < 32 MiB --@item powerpc-ieee1275 @tab ? @tab < 32 MiB -+@item powerpc-ieee1275 @tab ? @tab < 1 GiB - @item sparc64-ieee1275 @tab 256KiB @tab 2 MiB - @item arm-uboot @tab 256KiB @tab 2 MiB - @item mips(el)-qemu_mips @tab 2MiB @tab 253 MiB diff --git a/0178-ieee1275-ofdisk-retry-on-open-failure.patch b/0176-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 100% rename from 0178-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0176-ieee1275-ofdisk-retry-on-open-failure.patch diff --git a/0176-ieee1275-request-memory-with-ibm-client-architecture.patch b/0176-ieee1275-request-memory-with-ibm-client-architecture.patch deleted file mode 100644 index 4f3ab90c..00000000 --- a/0176-ieee1275-request-memory-with-ibm-client-architecture.patch +++ /dev/null @@ -1,268 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Fri, 16 Apr 2021 11:48:46 +1000 -Subject: [PATCH] ieee1275: request memory with ibm,client-architecture-support - -On PowerVM, the first time we boot a Linux partition, we may only get -256MB of real memory area, even if the partition has more memory. - -This isn't really enough. Fortunately, the Power Architecture Platform -Reference (PAPR) defines a method we can call to ask for more memory. -This is part of the broad and powerful ibm,client-architecture-support -(CAS) method. - -CAS can do an enormous amount of things on a PAPR platform: as well as -asking for memory, you can set the supported processor level, the interrupt -controller, hash vs radix mmu, and so on. We want to touch as little of -this as possible because we don't want to step on the toes of the future OS. - -If: - - - we are running under what we think is PowerVM (compatible property of / - begins with "IBM"), and - - - the full amount of RMA is less than 512MB (as determined by the reg - property of /memory) - -then call CAS as follows: (refer to the Linux on Power Architecture -Reference, LoPAR, which is public, at B.5.2.3): - - - Use the "any" PVR value and supply 2 option vectors. - - - Set option vector 1 (PowerPC Server Processor Architecture Level) - to "ignore". - - - Set option vector 2 with default or Linux-like options, including a - min-rma-size of 512MB. - -This will cause a CAS reboot and the partition will restart with 512MB -of RMA. Grub will notice the 512MB and not call CAS again. - -(A partition can be configured with only 256MB of memory, which would -mean this request couldn't be satisfied, but PFW refuses to load with -only 256MB of memory, so it's a bit moot. SLOF will run fine with 256MB, -but we will never call CAS under qemu/SLOF because /compatible won't -begin with "IBM".) - -One of the first things Linux does while still running under OpenFirmware -is to call CAS with a much fuller set of options (including asking for -512MB of memory). This includes a much more restrictive set of PVR values -and processor support levels, and this will induce another reboot. On this -reboot grub will again notice the higher RMA, and not call CAS. We will get -to Linux, Linux will call CAS but because the values are now set for Linux -this will not induce another CAS reboot and we will finally boot. - -On all subsequent boots, everything will be configured with 512MB of RMA -and all the settings Linux likes, so there will be no further CAS reboots. - -(phyp is super sticky with the RMA size - it persists even on cold boots. -So if you've ever booted Linux in a partition, you'll probably never have -grub call CAS. It'll only ever fire the first time a partition loads grub, -or if you deliberately lower the amount of memory your partition has below -512MB.) - -Signed-off-by: Daniel Axtens ---- - grub-core/kern/ieee1275/cmain.c | 3 + - grub-core/kern/ieee1275/init.c | 144 ++++++++++++++++++++++++++++++++++++++- - include/grub/ieee1275/ieee1275.h | 8 ++- - 3 files changed, 152 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 04df9d2c66..6435628ec5 100644 ---- a/grub-core/kern/ieee1275/cmain.c -+++ b/grub-core/kern/ieee1275/cmain.c -@@ -127,6 +127,9 @@ grub_ieee1275_find_options (void) - break; - } - } -+ -+ if (grub_strncmp (tmp, "IBM,", 4) == 0) -+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY); - } - - if (is_smartfirmware) -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index c61d91a028..9704715c83 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -242,6 +242,135 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - return 0; - } - -+/* How much memory does OF believe it has? (regardless of whether -+ it's accessible or not) */ -+static grub_err_t -+grub_ieee1275_total_mem (grub_uint64_t *total) -+{ -+ grub_ieee1275_phandle_t root; -+ grub_ieee1275_phandle_t memory; -+ grub_uint32_t reg[4]; -+ grub_ssize_t reg_size; -+ grub_uint32_t address_cells = 1; -+ grub_uint32_t size_cells = 1; -+ grub_uint64_t size; -+ -+ /* If we fail to get to the end, report 0. */ -+ *total = 0; -+ -+ /* Determine the format of each entry in `reg'. */ -+ grub_ieee1275_finddevice ("/", &root); -+ grub_ieee1275_get_integer_property (root, "#address-cells", &address_cells, -+ sizeof address_cells, 0); -+ grub_ieee1275_get_integer_property (root, "#size-cells", &size_cells, -+ sizeof size_cells, 0); -+ -+ if (size_cells > address_cells) -+ address_cells = size_cells; -+ -+ /* Load `/memory/reg'. */ -+ if (grub_ieee1275_finddevice ("/memory", &memory)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, -+ "couldn't find /memory node"); -+ if (grub_ieee1275_get_integer_property (memory, "reg", reg, -+ sizeof reg, ®_size)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, -+ "couldn't examine /memory/reg property"); -+ if (reg_size < 0 || (grub_size_t) reg_size > sizeof (reg)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, -+ "/memory response buffer exceeded"); -+ -+ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS)) -+ { -+ address_cells = 1; -+ size_cells = 1; -+ } -+ -+ /* Decode only the size */ -+ size = reg[address_cells]; -+ if (size_cells == 2) -+ size = (size << 32) | reg[address_cells + 1]; -+ -+ *total = size; -+ -+ return grub_errno; -+} -+ -+/* Based on linux - arch/powerpc/kernel/prom_init.c */ -+struct option_vector2 { -+ grub_uint8_t byte1; -+ grub_uint16_t reserved; -+ grub_uint32_t real_base; -+ grub_uint32_t real_size; -+ grub_uint32_t virt_base; -+ grub_uint32_t virt_size; -+ grub_uint32_t load_base; -+ grub_uint32_t min_rma; -+ grub_uint32_t min_load; -+ grub_uint8_t min_rma_percent; -+ grub_uint8_t max_pft_size; -+} __attribute__((packed)); -+ -+struct pvr_entry { -+ grub_uint32_t mask; -+ grub_uint32_t entry; -+}; -+ -+struct cas_vector { -+ struct { -+ struct pvr_entry terminal; -+ } pvr_list; -+ grub_uint8_t num_vecs; -+ grub_uint8_t vec1_size; -+ grub_uint8_t vec1; -+ grub_uint8_t vec2_size; -+ struct option_vector2 vec2; -+} __attribute__((packed)); -+ -+/* Call ibm,client-architecture-support to try to get more RMA. -+ We ask for 512MB which should be enough to verify a distro kernel. -+ We ignore most errors: if we don't succeed we'll proceed with whatever -+ memory we have. */ -+static void -+grub_ieee1275_ibm_cas (void) -+{ -+ int rc; -+ grub_ieee1275_ihandle_t root; -+ struct cas_args { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_ihandle_t ihandle; -+ grub_ieee1275_cell_t cas_addr; -+ grub_ieee1275_cell_t result; -+ } args; -+ struct cas_vector vector = { -+ .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ -+ .num_vecs = 2 - 1, -+ .vec1_size = 0, -+ .vec1 = 0x80, /* ignore */ -+ .vec2_size = 1 + sizeof(struct option_vector2) - 2, -+ .vec2 = { -+ 0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48 -+ }, -+ }; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); -+ args.method = (grub_ieee1275_cell_t)"ibm,client-architecture-support"; -+ rc = grub_ieee1275_open("/", &root); -+ if (rc) { -+ grub_error (GRUB_ERR_IO, "could not open root when trying to call CAS"); -+ return; -+ } -+ args.ihandle = root; -+ args.cas_addr = (grub_ieee1275_cell_t)&vector; -+ -+ grub_printf("Calling ibm,client-architecture-support..."); -+ IEEE1275_CALL_ENTRY_FN (&args); -+ grub_printf("done\n"); -+ -+ grub_ieee1275_close(root); -+} -+ - static void - grub_claim_heap (void) - { -@@ -249,11 +378,22 @@ grub_claim_heap (void) - - if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) - { -- heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, -- 1, &total); -+ heap_init (GRUB_IEEE1275_STATIC_HEAP_START, -+ GRUB_IEEE1275_STATIC_HEAP_LEN, 1, &total); - return; - } - -+ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) -+ { -+ grub_uint64_t rma_size; -+ grub_err_t err; -+ -+ err = grub_ieee1275_total_mem (&rma_size); -+ /* if we have an error, don't call CAS, just hope for the best */ -+ if (!err && rma_size < (512 * 1024 * 1024)) -+ grub_ieee1275_ibm_cas(); -+ } -+ - grub_machine_mmap_iterate (heap_size, &total); - - total = total / 4; -diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index b5a1d49bbc..e0a6c2ce1e 100644 ---- a/include/grub/ieee1275/ieee1275.h -+++ b/include/grub/ieee1275/ieee1275.h -@@ -149,7 +149,13 @@ enum grub_ieee1275_flag - - GRUB_IEEE1275_FLAG_RAW_DEVNAMES, - -- GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT -+ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT, -+ -+ /* On PFW, the first time we boot a Linux partition, we may only get 256MB -+ of real memory area, even if the partition has more memory. Set this flag -+ if we think we're running under PFW. Then, if this flag is set, and the -+ RMA is only 256MB in size, try asking for more with CAS. */ -+ GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY, - }; - - extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); diff --git a/0179-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 100% rename from 0179-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch diff --git a/0180-efinet-Add-DHCP-proxy-support.patch b/0178-efinet-Add-DHCP-proxy-support.patch similarity index 100% rename from 0180-efinet-Add-DHCP-proxy-support.patch rename to 0178-efinet-Add-DHCP-proxy-support.patch diff --git a/0181-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch similarity index 100% rename from 0181-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename to 0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch diff --git a/0182-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 100% rename from 0182-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch diff --git a/0183-Suppress-gettext-error-message.patch b/0181-Suppress-gettext-error-message.patch similarity index 100% rename from 0183-Suppress-gettext-error-message.patch rename to 0181-Suppress-gettext-error-message.patch diff --git a/0184-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 100% rename from 0184-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch diff --git a/0185-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch similarity index 100% rename from 0185-templates-Check-for-EFI-at-runtime-instead-of-config.patch rename to 0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch diff --git a/0186-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch similarity index 100% rename from 0186-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch rename to 0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch diff --git a/0187-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 100% rename from 0187-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch diff --git a/0188-normal-main-Discover-the-device-to-read-the-config-f.patch b/0186-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 100% rename from 0188-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0186-normal-main-Discover-the-device-to-read-the-config-f.patch diff --git a/0189-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 100% rename from 0189-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch diff --git a/0190-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch similarity index 100% rename from 0190-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename to 0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch diff --git a/0191-Print-module-name-on-license-check-failure.patch b/0189-Print-module-name-on-license-check-failure.patch similarity index 100% rename from 0191-Print-module-name-on-license-check-failure.patch rename to 0189-Print-module-name-on-license-check-failure.patch diff --git a/0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 100% rename from 0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch diff --git a/0193-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0191-grub-mkconfig-restore-umask-for-grub.cfg.patch similarity index 100% rename from 0193-grub-mkconfig-restore-umask-for-grub.cfg.patch rename to 0191-grub-mkconfig-restore-umask-for-grub.cfg.patch diff --git a/0194-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch similarity index 100% rename from 0194-fs-btrfs-Use-full-btrfs-bootloader-area.patch rename to 0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch diff --git a/0195-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0193-Add-Fedora-location-of-DejaVu-SANS-font.patch similarity index 100% rename from 0195-Add-Fedora-location-of-DejaVu-SANS-font.patch rename to 0193-Add-Fedora-location-of-DejaVu-SANS-font.patch diff --git a/0196-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch similarity index 100% rename from 0196-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch rename to 0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch diff --git a/0197-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch similarity index 100% rename from 0197-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch rename to 0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch diff --git a/0198-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch similarity index 100% rename from 0198-EFI-console-Do-not-set-colorstate-until-the-first-te.patch rename to 0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch diff --git a/0199-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch similarity index 100% rename from 0199-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch rename to 0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch diff --git a/0200-Use-visual-indentation-in-config.h.in.patch b/0198-Use-visual-indentation-in-config.h.in.patch similarity index 100% rename from 0200-Use-visual-indentation-in-config.h.in.patch rename to 0198-Use-visual-indentation-in-config.h.in.patch diff --git a/0201-Where-present-ensure-config-util.h-precedes-config.h.patch b/0199-Where-present-ensure-config-util.h-precedes-config.h.patch similarity index 100% rename from 0201-Where-present-ensure-config-util.h-precedes-config.h.patch rename to 0199-Where-present-ensure-config-util.h-precedes-config.h.patch diff --git a/0202-Drop-gnulib-fix-base64.patch.patch b/0200-Drop-gnulib-fix-base64.patch.patch similarity index 100% rename from 0202-Drop-gnulib-fix-base64.patch.patch rename to 0200-Drop-gnulib-fix-base64.patch.patch diff --git a/0203-Drop-gnulib-no-abort.patch.patch b/0201-Drop-gnulib-no-abort.patch.patch similarity index 100% rename from 0203-Drop-gnulib-no-abort.patch.patch rename to 0201-Drop-gnulib-no-abort.patch.patch diff --git a/0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch similarity index 100% rename from 0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch rename to 0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch diff --git a/0205-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch similarity index 100% rename from 0205-commands-search-Fix-bug-stopping-iteration-when-no-f.patch rename to 0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch diff --git a/0206-search-new-efidisk-only-option-on-EFI-systems.patch b/0204-search-new-efidisk-only-option-on-EFI-systems.patch similarity index 100% rename from 0206-search-new-efidisk-only-option-on-EFI-systems.patch rename to 0204-search-new-efidisk-only-option-on-EFI-systems.patch diff --git a/0207-efi-new-connectefi-command.patch b/0205-efi-new-connectefi-command.patch similarity index 100% rename from 0207-efi-new-connectefi-command.patch rename to 0205-efi-new-connectefi-command.patch diff --git a/0208-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch similarity index 100% rename from 0208-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch rename to 0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch diff --git a/0209-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch similarity index 100% rename from 0209-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch rename to 0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch diff --git a/0210-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch similarity index 100% rename from 0210-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch rename to 0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch diff --git a/0211-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch similarity index 100% rename from 0211-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch rename to 0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch diff --git a/0213-powerpc-prefix-detection-support-device-names-with-c.patch b/0210-powerpc-prefix-detection-support-device-names-with-c.patch similarity index 100% rename from 0213-powerpc-prefix-detection-support-device-names-with-c.patch rename to 0210-powerpc-prefix-detection-support-device-names-with-c.patch diff --git a/0215-make-ofdisk_retries-optional.patch b/0211-make-ofdisk_retries-optional.patch similarity index 100% rename from 0215-make-ofdisk_retries-optional.patch rename to 0211-make-ofdisk_retries-optional.patch diff --git a/0216-loader-efi-chainloader-grub_load_and_start_image-doe.patch b/0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch similarity index 100% rename from 0216-loader-efi-chainloader-grub_load_and_start_image-doe.patch rename to 0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch diff --git a/0212-powerpc-do-CAS-in-a-more-compatible-way.patch b/0212-powerpc-do-CAS-in-a-more-compatible-way.patch deleted file mode 100644 index 20b95f75..00000000 --- a/0212-powerpc-do-CAS-in-a-more-compatible-way.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Fri, 8 Apr 2022 12:35:28 +1000 -Subject: [PATCH] powerpc: do CAS in a more compatible way - -I wrongly assumed that the most compatible way to perform CAS -negotiation was to only set the minimum number of vectors required -to ask for more memory. It turns out that this messes up booting -if the minimum VP capacity would be less than the default 10% in -vector 4. - -Linux configures the minimum capacity to be 1%, so copy it for that -and for vector 3 which we now need to specify as well. - -Signed-off-by: Daniel Axtens ---- - grub-core/kern/ieee1275/init.c | 54 ++++++++++++++++++++++++------------------ - 1 file changed, 31 insertions(+), 23 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 9704715c83..ef55107467 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -298,33 +298,37 @@ grub_ieee1275_total_mem (grub_uint64_t *total) - - /* Based on linux - arch/powerpc/kernel/prom_init.c */ - struct option_vector2 { -- grub_uint8_t byte1; -- grub_uint16_t reserved; -- grub_uint32_t real_base; -- grub_uint32_t real_size; -- grub_uint32_t virt_base; -- grub_uint32_t virt_size; -- grub_uint32_t load_base; -- grub_uint32_t min_rma; -- grub_uint32_t min_load; -- grub_uint8_t min_rma_percent; -- grub_uint8_t max_pft_size; -+ grub_uint8_t byte1; -+ grub_uint16_t reserved; -+ grub_uint32_t real_base; -+ grub_uint32_t real_size; -+ grub_uint32_t virt_base; -+ grub_uint32_t virt_size; -+ grub_uint32_t load_base; -+ grub_uint32_t min_rma; -+ grub_uint32_t min_load; -+ grub_uint8_t min_rma_percent; -+ grub_uint8_t max_pft_size; - } __attribute__((packed)); - - struct pvr_entry { -- grub_uint32_t mask; -- grub_uint32_t entry; -+ grub_uint32_t mask; -+ grub_uint32_t entry; - }; - - struct cas_vector { -- struct { -- struct pvr_entry terminal; -- } pvr_list; -- grub_uint8_t num_vecs; -- grub_uint8_t vec1_size; -- grub_uint8_t vec1; -- grub_uint8_t vec2_size; -- struct option_vector2 vec2; -+ struct { -+ struct pvr_entry terminal; -+ } pvr_list; -+ grub_uint8_t num_vecs; -+ grub_uint8_t vec1_size; -+ grub_uint8_t vec1; -+ grub_uint8_t vec2_size; -+ struct option_vector2 vec2; -+ grub_uint8_t vec3_size; -+ grub_uint16_t vec3; -+ grub_uint8_t vec4_size; -+ grub_uint16_t vec4; - } __attribute__((packed)); - - /* Call ibm,client-architecture-support to try to get more RMA. -@@ -345,13 +349,17 @@ grub_ieee1275_ibm_cas (void) - } args; - struct cas_vector vector = { - .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ -- .num_vecs = 2 - 1, -+ .num_vecs = 4 - 1, - .vec1_size = 0, - .vec1 = 0x80, /* ignore */ - .vec2_size = 1 + sizeof(struct option_vector2) - 2, - .vec2 = { - 0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48 - }, -+ .vec3_size = 2 - 1, -+ .vec3 = 0x00e0, // ask for FP + VMX + DFP but don't halt if unsatisfied -+ .vec4_size = 2 - 1, -+ .vec4 = 0x0001, // set required minimum capacity % to the lowest value - }; - - INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); -@@ -364,7 +372,7 @@ grub_ieee1275_ibm_cas (void) - args.ihandle = root; - args.cas_addr = (grub_ieee1275_cell_t)&vector; - -- grub_printf("Calling ibm,client-architecture-support..."); -+ grub_printf("Calling ibm,client-architecture-support from grub..."); - IEEE1275_CALL_ENTRY_FN (&args); - grub_printf("done\n"); - diff --git a/0217-loader-efi-chainloader-simplify-the-loader-state.patch b/0213-loader-efi-chainloader-simplify-the-loader-state.patch similarity index 100% rename from 0217-loader-efi-chainloader-simplify-the-loader-state.patch rename to 0213-loader-efi-chainloader-simplify-the-loader-state.patch diff --git a/0218-commands-boot-Add-API-to-pass-context-to-loader.patch b/0214-commands-boot-Add-API-to-pass-context-to-loader.patch similarity index 100% rename from 0218-commands-boot-Add-API-to-pass-context-to-loader.patch rename to 0214-commands-boot-Add-API-to-pass-context-to-loader.patch diff --git a/0219-loader-efi-chainloader-Use-grub_loader_set_ex.patch b/0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch similarity index 100% rename from 0219-loader-efi-chainloader-Use-grub_loader_set_ex.patch rename to 0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch diff --git a/0220-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch b/0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch similarity index 100% rename from 0220-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch rename to 0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch diff --git a/0221-loader-i386-efi-linux-Use-grub_loader_set_ex.patch b/0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch similarity index 100% rename from 0221-loader-i386-efi-linux-Use-grub_loader_set_ex.patch rename to 0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch diff --git a/0222-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch b/0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch similarity index 100% rename from 0222-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch rename to 0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch diff --git a/0223-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch b/0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch similarity index 100% rename from 0223-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch rename to 0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch diff --git a/0224-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch b/0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch similarity index 100% rename from 0224-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch rename to 0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch diff --git a/0225-video-readers-png-Abort-sooner-if-a-read-operation-f.patch b/0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch similarity index 100% rename from 0225-video-readers-png-Abort-sooner-if-a-read-operation-f.patch rename to 0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch diff --git a/0226-video-readers-png-Refuse-to-handle-multiple-image-he.patch b/0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch similarity index 100% rename from 0226-video-readers-png-Refuse-to-handle-multiple-image-he.patch rename to 0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch diff --git a/0227-video-readers-png-Drop-greyscale-support-to-fix-heap.patch b/0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch similarity index 100% rename from 0227-video-readers-png-Drop-greyscale-support-to-fix-heap.patch rename to 0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch diff --git a/0228-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch b/0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch similarity index 100% rename from 0228-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch rename to 0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch diff --git a/0229-video-readers-png-Sanity-check-some-huffman-codes.patch b/0225-video-readers-png-Sanity-check-some-huffman-codes.patch similarity index 100% rename from 0229-video-readers-png-Sanity-check-some-huffman-codes.patch rename to 0225-video-readers-png-Sanity-check-some-huffman-codes.patch diff --git a/0230-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch b/0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch similarity index 100% rename from 0230-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch rename to 0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch diff --git a/0231-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch b/0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch similarity index 100% rename from 0231-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch rename to 0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch diff --git a/0232-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch b/0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch similarity index 100% rename from 0232-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch rename to 0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch diff --git a/0233-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch b/0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch similarity index 100% rename from 0233-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch rename to 0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch diff --git a/0234-normal-charset-Fix-array-out-of-bounds-formatting-un.patch b/0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch similarity index 100% rename from 0234-normal-charset-Fix-array-out-of-bounds-formatting-un.patch rename to 0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch diff --git a/0235-net-netbuff-Block-overly-large-netbuff-allocs.patch b/0231-net-netbuff-Block-overly-large-netbuff-allocs.patch similarity index 100% rename from 0235-net-netbuff-Block-overly-large-netbuff-allocs.patch rename to 0231-net-netbuff-Block-overly-large-netbuff-allocs.patch diff --git a/0236-net-ip-Do-IP-fragment-maths-safely.patch b/0232-net-ip-Do-IP-fragment-maths-safely.patch similarity index 100% rename from 0236-net-ip-Do-IP-fragment-maths-safely.patch rename to 0232-net-ip-Do-IP-fragment-maths-safely.patch diff --git a/0237-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch b/0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch similarity index 100% rename from 0237-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch rename to 0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch diff --git a/0238-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch b/0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch similarity index 100% rename from 0238-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch rename to 0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch diff --git a/0239-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch b/0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch similarity index 100% rename from 0239-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch rename to 0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch diff --git a/0240-net-tftp-Avoid-a-trivial-UAF.patch b/0236-net-tftp-Avoid-a-trivial-UAF.patch similarity index 100% rename from 0240-net-tftp-Avoid-a-trivial-UAF.patch rename to 0236-net-tftp-Avoid-a-trivial-UAF.patch diff --git a/0241-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch b/0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch similarity index 100% rename from 0241-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch rename to 0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch diff --git a/0242-net-http-Fix-OOB-write-for-split-http-headers.patch b/0238-net-http-Fix-OOB-write-for-split-http-headers.patch similarity index 100% rename from 0242-net-http-Fix-OOB-write-for-split-http-headers.patch rename to 0238-net-http-Fix-OOB-write-for-split-http-headers.patch diff --git a/0243-net-http-Error-out-on-headers-with-LF-without-CR.patch b/0239-net-http-Error-out-on-headers-with-LF-without-CR.patch similarity index 100% rename from 0243-net-http-Error-out-on-headers-with-LF-without-CR.patch rename to 0239-net-http-Error-out-on-headers-with-LF-without-CR.patch diff --git a/0244-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch b/0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch similarity index 100% rename from 0244-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch rename to 0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch diff --git a/0245-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch b/0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch similarity index 100% rename from 0245-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch rename to 0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch diff --git a/0246-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch b/0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch similarity index 100% rename from 0246-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch rename to 0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch diff --git a/0247-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch b/0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch similarity index 100% rename from 0247-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch rename to 0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch diff --git a/0248-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch b/0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch similarity index 100% rename from 0248-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch rename to 0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch diff --git a/0249-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch b/0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch similarity index 100% rename from 0249-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch rename to 0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch diff --git a/0250-misc-Make-grub_min-and-grub_max-more-resilient.patch b/0246-misc-Make-grub_min-and-grub_max-more-resilient.patch similarity index 100% rename from 0250-misc-Make-grub_min-and-grub_max-more-resilient.patch rename to 0246-misc-Make-grub_min-and-grub_max-more-resilient.patch diff --git a/0251-ReiserFS-switch-to-using-grub_min-grub_max.patch b/0247-ReiserFS-switch-to-using-grub_min-grub_max.patch similarity index 100% rename from 0251-ReiserFS-switch-to-using-grub_min-grub_max.patch rename to 0247-ReiserFS-switch-to-using-grub_min-grub_max.patch diff --git a/0252-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch b/0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch similarity index 100% rename from 0252-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch rename to 0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch diff --git a/0253-modules-make-.module_license-read-only.patch b/0249-modules-make-.module_license-read-only.patch similarity index 100% rename from 0253-modules-make-.module_license-read-only.patch rename to 0249-modules-make-.module_license-read-only.patch diff --git a/0254-modules-strip-.llvm_addrsig-sections-and-similar.patch b/0250-modules-strip-.llvm_addrsig-sections-and-similar.patch similarity index 100% rename from 0254-modules-strip-.llvm_addrsig-sections-and-similar.patch rename to 0250-modules-strip-.llvm_addrsig-sections-and-similar.patch diff --git a/0255-modules-Don-t-allocate-space-for-non-allocable-secti.patch b/0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch similarity index 100% rename from 0255-modules-Don-t-allocate-space-for-non-allocable-secti.patch rename to 0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch diff --git a/0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch b/0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch similarity index 100% rename from 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch rename to 0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch diff --git a/0257-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch b/0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch similarity index 100% rename from 0257-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch rename to 0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch diff --git a/0258-modules-load-module-sections-at-page-aligned-address.patch b/0254-modules-load-module-sections-at-page-aligned-address.patch similarity index 99% rename from 0258-modules-load-module-sections-at-page-aligned-address.patch rename to 0254-modules-load-module-sections-at-page-aligned-address.patch index 9a5048ce..eb171f5e 100644 --- a/0258-modules-load-module-sections-at-page-aligned-address.patch +++ b/0254-modules-load-module-sections-at-page-aligned-address.patch @@ -360,7 +360,7 @@ index 618ae6f474..f36ed5cb17 100644 #if defined (_mips) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 90083772c8..c23ba313dc 100644 +index 19f708ee66..7b2455a8fe 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -755,9 +755,9 @@ declare startup asm file ($cpu_$platform_startup) as well as any other files diff --git a/0259-nx-add-memory-attribute-get-set-API.patch b/0255-nx-add-memory-attribute-get-set-API.patch similarity index 100% rename from 0259-nx-add-memory-attribute-get-set-API.patch rename to 0255-nx-add-memory-attribute-get-set-API.patch diff --git a/0260-nx-set-page-permissions-for-loaded-modules.patch b/0256-nx-set-page-permissions-for-loaded-modules.patch similarity index 100% rename from 0260-nx-set-page-permissions-for-loaded-modules.patch rename to 0256-nx-set-page-permissions-for-loaded-modules.patch diff --git a/0261-nx-set-attrs-in-our-kernel-loaders.patch b/0257-nx-set-attrs-in-our-kernel-loaders.patch similarity index 100% rename from 0261-nx-set-attrs-in-our-kernel-loaders.patch rename to 0257-nx-set-attrs-in-our-kernel-loaders.patch diff --git a/0262-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch b/0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch similarity index 100% rename from 0262-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch rename to 0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch diff --git a/0263-grub-probe-document-the-behavior-of-multiple-v.patch b/0259-grub-probe-document-the-behavior-of-multiple-v.patch similarity index 100% rename from 0263-grub-probe-document-the-behavior-of-multiple-v.patch rename to 0259-grub-probe-document-the-behavior-of-multiple-v.patch diff --git a/0264-grub_fs_probe-dprint-errors-from-filesystems.patch b/0260-grub_fs_probe-dprint-errors-from-filesystems.patch similarity index 100% rename from 0264-grub_fs_probe-dprint-errors-from-filesystems.patch rename to 0260-grub_fs_probe-dprint-errors-from-filesystems.patch diff --git a/0265-fs-fat-don-t-error-when-mtime-is-0.patch b/0261-fs-fat-don-t-error-when-mtime-is-0.patch similarity index 100% rename from 0265-fs-fat-don-t-error-when-mtime-is-0.patch rename to 0261-fs-fat-don-t-error-when-mtime-is-0.patch diff --git a/0266-Make-debug-file-show-which-file-filters-get-run.patch b/0262-Make-debug-file-show-which-file-filters-get-run.patch similarity index 100% rename from 0266-Make-debug-file-show-which-file-filters-get-run.patch rename to 0262-Make-debug-file-show-which-file-filters-get-run.patch diff --git a/0267-efi-use-enumerated-array-positions-for-our-allocatio.patch b/0263-efi-use-enumerated-array-positions-for-our-allocatio.patch similarity index 100% rename from 0267-efi-use-enumerated-array-positions-for-our-allocatio.patch rename to 0263-efi-use-enumerated-array-positions-for-our-allocatio.patch diff --git a/0268-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch b/0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch similarity index 100% rename from 0268-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch rename to 0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch diff --git a/0269-efi-allocate-the-initrd-within-the-bounds-expressed-.patch b/0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch similarity index 100% rename from 0269-efi-allocate-the-initrd-within-the-bounds-expressed-.patch rename to 0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch diff --git a/0270-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch b/0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch similarity index 100% rename from 0270-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch rename to 0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch diff --git a/0271-BLS-create-etc-kernel-cmdline-during-mkconfig.patch b/0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch similarity index 100% rename from 0271-BLS-create-etc-kernel-cmdline-during-mkconfig.patch rename to 0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch diff --git a/0272-squish-don-t-dup-rhgb-quiet-check-mtimes.patch b/0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch similarity index 100% rename from 0272-squish-don-t-dup-rhgb-quiet-check-mtimes.patch rename to 0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch diff --git a/0273-squish-give-up-on-rhgb-quiet.patch b/0269-squish-give-up-on-rhgb-quiet.patch similarity index 100% rename from 0273-squish-give-up-on-rhgb-quiet.patch rename to 0269-squish-give-up-on-rhgb-quiet.patch diff --git a/0274-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch b/0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch similarity index 100% rename from 0274-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch rename to 0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch diff --git a/0276-blscfg-Don-t-root-device-in-emu-builds.patch b/0271-blscfg-Don-t-root-device-in-emu-builds.patch similarity index 100% rename from 0276-blscfg-Don-t-root-device-in-emu-builds.patch rename to 0271-blscfg-Don-t-root-device-in-emu-builds.patch diff --git a/0277-loader-arm64-linux-Remove-magic-number-header-field-.patch b/0272-loader-arm64-linux-Remove-magic-number-header-field-.patch similarity index 100% rename from 0277-loader-arm64-linux-Remove-magic-number-header-field-.patch rename to 0272-loader-arm64-linux-Remove-magic-number-header-field-.patch diff --git a/0278-Correct-BSS-zeroing-on-aarch64.patch b/0273-Correct-BSS-zeroing-on-aarch64.patch similarity index 100% rename from 0278-Correct-BSS-zeroing-on-aarch64.patch rename to 0273-Correct-BSS-zeroing-on-aarch64.patch diff --git a/0279-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch b/0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch similarity index 100% rename from 0279-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch rename to 0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch diff --git a/0275-ieee1275-implement-vec5-for-cas-negotiation.patch b/0275-ieee1275-implement-vec5-for-cas-negotiation.patch deleted file mode 100644 index 2749d10c..00000000 --- a/0275-ieee1275-implement-vec5-for-cas-negotiation.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Diego Domingos -Date: Thu, 25 Aug 2022 11:37:56 -0400 -Subject: [PATCH] ieee1275: implement vec5 for cas negotiation - -As a legacy support, if the vector 5 is not implemented, Power -Hypervisor will consider the max CPUs as 64 instead 256 currently -supported during client-architecture-support negotiation. - -This patch implements the vector 5 and set the MAX CPUs to 256 while -setting the others values to 0 (default). - -Signed-off-by: Diego Domingos -Signed-off-by: Robbie Harwood ---- - grub-core/kern/ieee1275/init.c | 20 +++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index ef55107467..6a51c9efab 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -311,6 +311,18 @@ struct option_vector2 { - grub_uint8_t max_pft_size; - } __attribute__((packed)); - -+struct option_vector5 { -+ grub_uint8_t byte1; -+ grub_uint8_t byte2; -+ grub_uint8_t byte3; -+ grub_uint8_t cmo; -+ grub_uint8_t associativity; -+ grub_uint8_t bin_opts; -+ grub_uint8_t micro_checkpoint; -+ grub_uint8_t reserved0; -+ grub_uint32_t max_cpus; -+} __attribute__((packed)); -+ - struct pvr_entry { - grub_uint32_t mask; - grub_uint32_t entry; -@@ -329,6 +341,8 @@ struct cas_vector { - grub_uint16_t vec3; - grub_uint8_t vec4_size; - grub_uint16_t vec4; -+ grub_uint8_t vec5_size; -+ struct option_vector5 vec5; - } __attribute__((packed)); - - /* Call ibm,client-architecture-support to try to get more RMA. -@@ -349,7 +363,7 @@ grub_ieee1275_ibm_cas (void) - } args; - struct cas_vector vector = { - .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ -- .num_vecs = 4 - 1, -+ .num_vecs = 5 - 1, - .vec1_size = 0, - .vec1 = 0x80, /* ignore */ - .vec2_size = 1 + sizeof(struct option_vector2) - 2, -@@ -360,6 +374,10 @@ grub_ieee1275_ibm_cas (void) - .vec3 = 0x00e0, // ask for FP + VMX + DFP but don't halt if unsatisfied - .vec4_size = 2 - 1, - .vec4 = 0x0001, // set required minimum capacity % to the lowest value -+ .vec5_size = 1 + sizeof(struct option_vector5) - 2, -+ .vec5 = { -+ 0, 0, 0, 0, 0, 0, 0, 0, 256 -+ } - }; - - INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); diff --git a/0280-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch b/0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch similarity index 100% rename from 0280-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch rename to 0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch diff --git a/0281-commands-efi-tpm-Refine-the-status-of-log-event.patch b/0276-commands-efi-tpm-Refine-the-status-of-log-event.patch similarity index 100% rename from 0281-commands-efi-tpm-Refine-the-status-of-log-event.patch rename to 0276-commands-efi-tpm-Refine-the-status-of-log-event.patch diff --git a/0282-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch b/0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch similarity index 100% rename from 0282-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch rename to 0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch diff --git a/0283-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch b/0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch similarity index 100% rename from 0283-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch rename to 0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch diff --git a/0284-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch b/0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch similarity index 100% rename from 0284-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch rename to 0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch diff --git a/0285-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch b/0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch similarity index 100% rename from 0285-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch rename to 0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch diff --git a/0286-font-Fix-several-integer-overflows-in-grub_font_cons.patch b/0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch similarity index 100% rename from 0286-font-Fix-several-integer-overflows-in-grub_font_cons.patch rename to 0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch diff --git a/0287-font-Remove-grub_font_dup_glyph.patch b/0282-font-Remove-grub_font_dup_glyph.patch similarity index 100% rename from 0287-font-Remove-grub_font_dup_glyph.patch rename to 0282-font-Remove-grub_font_dup_glyph.patch diff --git a/0288-font-Fix-integer-overflow-in-ensure_comb_space.patch b/0283-font-Fix-integer-overflow-in-ensure_comb_space.patch similarity index 100% rename from 0288-font-Fix-integer-overflow-in-ensure_comb_space.patch rename to 0283-font-Fix-integer-overflow-in-ensure_comb_space.patch diff --git a/0289-font-Fix-integer-overflow-in-BMP-index.patch b/0284-font-Fix-integer-overflow-in-BMP-index.patch similarity index 100% rename from 0289-font-Fix-integer-overflow-in-BMP-index.patch rename to 0284-font-Fix-integer-overflow-in-BMP-index.patch diff --git a/0290-font-Fix-integer-underflow-in-binary-search-of-char-.patch b/0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch similarity index 100% rename from 0290-font-Fix-integer-underflow-in-binary-search-of-char-.patch rename to 0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch diff --git a/0291-kern-efi-sb-Enforce-verification-of-font-files.patch b/0286-kern-efi-sb-Enforce-verification-of-font-files.patch similarity index 100% rename from 0291-kern-efi-sb-Enforce-verification-of-font-files.patch rename to 0286-kern-efi-sb-Enforce-verification-of-font-files.patch diff --git a/0292-fbutil-Fix-integer-overflow.patch b/0287-fbutil-Fix-integer-overflow.patch similarity index 100% rename from 0292-fbutil-Fix-integer-overflow.patch rename to 0287-fbutil-Fix-integer-overflow.patch diff --git a/0293-font-Fix-an-integer-underflow-in-blit_comb.patch b/0288-font-Fix-an-integer-underflow-in-blit_comb.patch similarity index 100% rename from 0293-font-Fix-an-integer-underflow-in-blit_comb.patch rename to 0288-font-Fix-an-integer-underflow-in-blit_comb.patch diff --git a/0294-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch b/0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch similarity index 100% rename from 0294-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch rename to 0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch diff --git a/0295-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch b/0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch similarity index 100% rename from 0295-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch rename to 0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch diff --git a/0296-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch b/0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch similarity index 100% rename from 0296-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch rename to 0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch diff --git a/0297-font-Try-opening-fonts-from-the-bundled-memdisk.patch b/0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch similarity index 100% rename from 0297-font-Try-opening-fonts-from-the-bundled-memdisk.patch rename to 0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch diff --git a/0299-mm-Clarify-grub_real_malloc.patch b/0293-mm-Clarify-grub_real_malloc.patch similarity index 100% rename from 0299-mm-Clarify-grub_real_malloc.patch rename to 0293-mm-Clarify-grub_real_malloc.patch diff --git a/0300-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch b/0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch similarity index 100% rename from 0300-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch rename to 0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch diff --git a/0301-mm-Document-grub_free.patch b/0295-mm-Document-grub_free.patch similarity index 100% rename from 0301-mm-Document-grub_free.patch rename to 0295-mm-Document-grub_free.patch diff --git a/0302-mm-Document-grub_mm_init_region.patch b/0296-mm-Document-grub_mm_init_region.patch similarity index 100% rename from 0302-mm-Document-grub_mm_init_region.patch rename to 0296-mm-Document-grub_mm_init_region.patch diff --git a/0303-mm-Document-GRUB-internal-memory-management-structur.patch b/0297-mm-Document-GRUB-internal-memory-management-structur.patch similarity index 100% rename from 0303-mm-Document-GRUB-internal-memory-management-structur.patch rename to 0297-mm-Document-GRUB-internal-memory-management-structur.patch diff --git a/0298-Correction-in-vector-5-values.patch b/0298-Correction-in-vector-5-values.patch deleted file mode 100644 index 9be1f4a4..00000000 --- a/0298-Correction-in-vector-5-values.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Avnish Chouhan -Date: Tue, 22 Nov 2022 08:01:47 -0500 -Subject: [PATCH] Correction in vector 5 values - -This patch is to update the vector 5 values which is troubling some -machines to bootup properly. Max out the values of all the properties of -Vector 5 (similar to vector 2) except max cpu property, which were set -as 0 earlier. - -Signed-off-by: Avnish Chouhan -[rharwood: rewrap comit message] -Signed-off-by: Robbie Harwood ---- - grub-core/kern/ieee1275/init.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 6a51c9efab..28a3bd4621 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -376,7 +376,7 @@ grub_ieee1275_ibm_cas (void) - .vec4 = 0x0001, // set required minimum capacity % to the lowest value - .vec5_size = 1 + sizeof(struct option_vector5) - 2, - .vec5 = { -- 0, 0, 0, 0, 0, 0, 0, 0, 256 -+ -1, -1, -1, -1, -1, -1, -1, -1, 256 - } - }; - diff --git a/0304-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch b/0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch similarity index 100% rename from 0304-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch rename to 0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch diff --git a/0305-mm-When-adding-a-region-merge-with-region-after-as-w.patch b/0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch similarity index 100% rename from 0305-mm-When-adding-a-region-merge-with-region-after-as-w.patch rename to 0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch diff --git a/0306-mm-Debug-support-for-region-operations.patch b/0300-mm-Debug-support-for-region-operations.patch similarity index 100% rename from 0306-mm-Debug-support-for-region-operations.patch rename to 0300-mm-Debug-support-for-region-operations.patch diff --git a/0307-mm-Drop-unused-unloading-of-modules-on-OOM.patch b/0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch similarity index 100% rename from 0307-mm-Drop-unused-unloading-of-modules-on-OOM.patch rename to 0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch diff --git a/0308-mm-Allow-dynamically-requesting-additional-memory-re.patch b/0302-mm-Allow-dynamically-requesting-additional-memory-re.patch similarity index 100% rename from 0308-mm-Allow-dynamically-requesting-additional-memory-re.patch rename to 0302-mm-Allow-dynamically-requesting-additional-memory-re.patch diff --git a/0309-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch b/0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch similarity index 100% rename from 0309-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch rename to 0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch diff --git a/0310-kern-efi-mm-Extract-function-to-add-memory-regions.patch b/0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch similarity index 100% rename from 0310-kern-efi-mm-Extract-function-to-add-memory-regions.patch rename to 0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch diff --git a/0311-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch b/0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch similarity index 100% rename from 0311-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch rename to 0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch diff --git a/0312-kern-efi-mm-Implement-runtime-addition-of-pages.patch b/0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch similarity index 100% rename from 0312-kern-efi-mm-Implement-runtime-addition-of-pages.patch rename to 0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch diff --git a/0313-efi-Increase-default-memory-allocation-to-32-MiB.patch b/0307-efi-Increase-default-memory-allocation-to-32-MiB.patch similarity index 100% rename from 0313-efi-Increase-default-memory-allocation-to-32-MiB.patch rename to 0307-efi-Increase-default-memory-allocation-to-32-MiB.patch diff --git a/0314-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch b/0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch similarity index 100% rename from 0314-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch rename to 0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch diff --git a/0315-ppc64le-signed-boot-media-changes.patch b/0309-ppc64le-signed-boot-media-changes.patch similarity index 100% rename from 0315-ppc64le-signed-boot-media-changes.patch rename to 0309-ppc64le-signed-boot-media-changes.patch diff --git a/0316-core-Fix-several-implicit-function-declarations.patch b/0310-core-Fix-several-implicit-function-declarations.patch similarity index 100% rename from 0316-core-Fix-several-implicit-function-declarations.patch rename to 0310-core-Fix-several-implicit-function-declarations.patch diff --git a/0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch b/0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch similarity index 99% rename from 0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch rename to 0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch index 61fe8764..65834d8d 100644 --- a/0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch +++ b/0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch @@ -41,10 +41,10 @@ Reviewed-by: Daniel Kiper create mode 100644 grub-core/loader/emu/linux.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index e038c5e6fd..02ea718652 100644 +index 741a033978..f21da23213 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1871,11 +1871,8 @@ module = { +@@ -1864,11 +1864,8 @@ module = { riscv32 = loader/riscv/linux.c; riscv64 = loader/riscv/linux.c; emu = loader/emu/linux.c; @@ -367,7 +367,7 @@ index ff9c48a649..01056954b9 100644 #ifdef HAVE_DEVICE_MAPPER diff --git a/docs/grub.texi b/docs/grub.texi -index c433240f34..825278a7f3 100644 +index a4da9c2a1b..1750b72ee9 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -923,17 +923,17 @@ magic. diff --git a/0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch b/0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch new file mode 100644 index 00000000..735075a3 --- /dev/null +++ b/0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch @@ -0,0 +1,111 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 6 Sep 2021 15:46:12 +1000 +Subject: [PATCH] powerpc: Drop Open Hack'Ware - remove + GRUB_IEEE1275_FLAG_FORCE_CLAIM + +Open Hack'Ware was the only user. It added a lot of complexity. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 333e63b356f1ce833cda1937ed8351618cbdf9d3) +--- + grub-core/kern/ieee1275/init.c | 6 +----- + grub-core/lib/ieee1275/relocator.c | 4 ---- + grub-core/loader/powerpc/ieee1275/linux.c | 14 -------------- + include/grub/ieee1275/ieee1275.h | 11 ----------- + 4 files changed, 1 insertion(+), 34 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 0dcd114ce5..6581c2c996 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -207,11 +207,7 @@ grub_claim_heap (void) + { + unsigned long total = 0; + +- if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) +- heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, +- 1, &total); +- else +- grub_machine_mmap_iterate (heap_init, &total); ++ grub_machine_mmap_iterate (heap_init, &total); + } + #endif + +diff --git a/grub-core/lib/ieee1275/relocator.c b/grub-core/lib/ieee1275/relocator.c +index c6dd8facb0..d1bb45c75e 100644 +--- a/grub-core/lib/ieee1275/relocator.c ++++ b/grub-core/lib/ieee1275/relocator.c +@@ -38,8 +38,6 @@ grub_relocator_firmware_get_max_events (void) + { + int counter = 0; + +- if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) +- return 0; + grub_machine_mmap_iterate (count, &counter); + return 2 * counter; + } +@@ -92,8 +90,6 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events) + .counter = 0 + }; + +- if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) +- return 0; + grub_machine_mmap_iterate (grub_relocator_firmware_fill_events_iter, &ctx); + return ctx.counter; + } +diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c +index 818b2a86d1..6fdd863130 100644 +--- a/grub-core/loader/powerpc/ieee1275/linux.c ++++ b/grub-core/loader/powerpc/ieee1275/linux.c +@@ -111,20 +111,6 @@ grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size, + .found_addr = (grub_addr_t) -1 + }; + +- if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) +- { +- grub_uint64_t addr = target; +- if (addr < GRUB_IEEE1275_STATIC_HEAP_START +- + GRUB_IEEE1275_STATIC_HEAP_LEN) +- addr = GRUB_IEEE1275_STATIC_HEAP_START +- + GRUB_IEEE1275_STATIC_HEAP_LEN; +- addr = ALIGN_UP (addr, align); +- if (grub_claimmap (addr, size) == GRUB_ERR_NONE) +- return addr; +- return (grub_addr_t) -1; +- } +- +- + grub_machine_mmap_iterate (alloc_mem, &ctx); + + return ctx.found_addr; +diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h +index b5a1d49bbc..6a1d3e5d70 100644 +--- a/include/grub/ieee1275/ieee1275.h ++++ b/include/grub/ieee1275/ieee1275.h +@@ -85,14 +85,6 @@ extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu); + + extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *) GRUB_IEEE1275_ENTRY_FN_ATTRIBUTE; + +-/* Static heap, used only if FORCE_CLAIM is set, +- happens on Open Hack'Ware. Should be in platform-specific +- header but is used only on PPC anyway. +-*/ +-#define GRUB_IEEE1275_STATIC_HEAP_START 0x1000000 +-#define GRUB_IEEE1275_STATIC_HEAP_LEN 0x1000000 +- +- + enum grub_ieee1275_flag + { + /* Old World Macintosh firmware fails seek when "dev:0" is opened. */ +@@ -119,9 +111,6 @@ enum grub_ieee1275_flag + /* Open Hack'Ware stops when grub_ieee1275_interpret is used. */ + GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, + +- /* Open Hack'Ware has no memory map, just claim what we need. */ +- GRUB_IEEE1275_FLAG_FORCE_CLAIM, +- + /* Open Hack'Ware don't support the ANSI sequence. */ + GRUB_IEEE1275_FLAG_NO_ANSI, + diff --git a/0313-ieee1275-request-memory-with-ibm-client-architecture.patch b/0313-ieee1275-request-memory-with-ibm-client-architecture.patch new file mode 100644 index 00000000..4e95630c --- /dev/null +++ b/0313-ieee1275-request-memory-with-ibm-client-architecture.patch @@ -0,0 +1,308 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 6 Feb 2023 10:03:20 -0500 +Subject: [PATCH] ieee1275: request memory with ibm, + client-architecture-support + +On PowerVM, the first time we boot a Linux partition, we may only get +256MB of real memory area, even if the partition has more memory. + +This isn't enough to reliably verify a kernel. Fortunately, the Power +Architecture Platform Reference (PAPR) defines a method we can call to ask +for more memory: the broad and powerful ibm,client-architecture-support +(CAS) method. + +CAS can do an enormous amount of things on a PAPR platform: as well as +asking for memory, you can set the supported processor level, the interrupt +controller, hash vs radix mmu, and so on. + +If: + + - we are running under what we think is PowerVM (compatible property of / + begins with "IBM"), and + + - the full amount of RMA is less than 512MB (as determined by the reg + property of /memory) + +then call CAS as follows: (refer to the Linux on Power Architecture +Reference, LoPAR, which is public, at B.5.2.3): + + - Use the "any" PVR value and supply 2 option vectors. + + - Set option vector 1 (PowerPC Server Processor Architecture Level) + to "ignore". + + - Set option vector 2 with default or Linux-like options, including a + min-rma-size of 512MB. + + - Set option vector 3 to request Floating Point, VMX and Decimal Floating + point, but don't abort the boot if we can't get them. + + - Set option vector 4 to request a minimum VP percentage to 1%, which is + what Linux requests, and is below the default of 10%. Without this, + some systems with very large or very small configurations fail to boot. + +This will cause a CAS reboot and the partition will restart with 512MB +of RMA. Importantly, grub will notice the 512MB and not call CAS again. + +Notes about the choices of parameters: + + - A partition can be configured with only 256MB of memory, which would + mean this request couldn't be satisfied, but PFW refuses to load with + only 256MB of memory, so it's a bit moot. SLOF will run fine with 256MB, + but we will never call CAS under qemu/SLOF because /compatible won't + begin with "IBM".) + + - unspecified CAS vectors take on default values. Some of these values + might restrict the ability of certain hardware configurations to boot. + This is why we need to specify the VP percentage in vector 4, which is + in turn why we need to specify vector 3. + +Finally, we should have enough memory to verify a kernel, and we will +reach Linux. One of the first things Linux does while still running under +OpenFirmware is to call CAS with a much fuller set of options (including +asking for 512MB of memory). Linux includes a much more restrictive set of +PVR values and processor support levels, and this CAS invocation will likely +induce another reboot. On this reboot grub will again notice the higher RMA, +and not call CAS. We will get to Linux again, Linux will call CAS again, but +because the values are now set for Linux this will not induce another CAS +reboot and we will finally boot all the way to userspace. + +On all subsequent boots, everything will be configured with 512MB of RMA, +so there will be no further CAS reboots from grub. (phyp is super sticky +with the RMA size - it persists even on cold boots. So if you've ever booted +Linux in a partition, you'll probably never have grub call CAS. It'll only +ever fire the first time a partition loads grub, or if you deliberately lower +the amount of memory your partition has below 512MB.) + +Signed-off-by: Daniel Axtens +Signed-off-by: Stefan Berger +Reviewed-by: Daniel Kiper +(cherry picked from commit d5571590b7de61887efac1c298901455697ba307) +--- + grub-core/kern/ieee1275/cmain.c | 5 ++ + grub-core/kern/ieee1275/init.c | 167 ++++++++++++++++++++++++++++++++++++++- + include/grub/ieee1275/ieee1275.h | 12 ++- + 3 files changed, 182 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c +index 04df9d2c66..dce7b84922 100644 +--- a/grub-core/kern/ieee1275/cmain.c ++++ b/grub-core/kern/ieee1275/cmain.c +@@ -127,6 +127,11 @@ grub_ieee1275_find_options (void) + break; + } + } ++ ++#if defined(__powerpc__) ++ if (grub_strncmp (tmp, "IBM,", 4) == 0) ++ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY); ++#endif + } + + if (is_smartfirmware) +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 6581c2c996..8ae405bc79 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -202,11 +202,176 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + return 0; + } + +-static void ++/* ++ * How much memory does OF believe it has? (regardless of whether ++ * it's accessible or not) ++ */ ++static grub_err_t ++grub_ieee1275_total_mem (grub_uint64_t *total) ++{ ++ grub_ieee1275_phandle_t root; ++ grub_ieee1275_phandle_t memory; ++ grub_uint32_t reg[4]; ++ grub_ssize_t reg_size; ++ grub_uint32_t address_cells = 1; ++ grub_uint32_t size_cells = 1; ++ grub_uint64_t size; ++ ++ /* If we fail to get to the end, report 0. */ ++ *total = 0; ++ ++ /* Determine the format of each entry in `reg'. */ ++ if (grub_ieee1275_finddevice ("/", &root)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't find / node"); ++ if (grub_ieee1275_get_integer_property (root, "#address-cells", &address_cells, ++ sizeof (address_cells), 0)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't examine #address-cells"); ++ if (grub_ieee1275_get_integer_property (root, "#size-cells", &size_cells, ++ sizeof (size_cells), 0)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't examine #size-cells"); ++ ++ if (size_cells > address_cells) ++ address_cells = size_cells; ++ ++ /* Load `/memory/reg'. */ ++ if (grub_ieee1275_finddevice ("/memory", &memory)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't find /memory node"); ++ if (grub_ieee1275_get_integer_property (memory, "reg", reg, ++ sizeof (reg), ®_size)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't examine /memory/reg property"); ++ if (reg_size < 0 || (grub_size_t) reg_size > sizeof (reg)) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "/memory response buffer exceeded"); ++ ++ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS)) ++ { ++ address_cells = 1; ++ size_cells = 1; ++ } ++ ++ /* Decode only the size */ ++ size = reg[address_cells]; ++ if (size_cells == 2) ++ size = (size << 32) | reg[address_cells + 1]; ++ ++ *total = size; ++ ++ return grub_errno; ++} ++ ++#if defined(__powerpc__) ++ ++/* See PAPR or arch/powerpc/kernel/prom_init.c */ ++struct option_vector2 ++{ ++ grub_uint8_t byte1; ++ grub_uint16_t reserved; ++ grub_uint32_t real_base; ++ grub_uint32_t real_size; ++ grub_uint32_t virt_base; ++ grub_uint32_t virt_size; ++ grub_uint32_t load_base; ++ grub_uint32_t min_rma; ++ grub_uint32_t min_load; ++ grub_uint8_t min_rma_percent; ++ grub_uint8_t max_pft_size; ++} GRUB_PACKED; ++ ++struct pvr_entry ++{ ++ grub_uint32_t mask; ++ grub_uint32_t entry; ++}; ++ ++struct cas_vector ++{ ++ struct ++ { ++ struct pvr_entry terminal; ++ } pvr_list; ++ grub_uint8_t num_vecs; ++ grub_uint8_t vec1_size; ++ grub_uint8_t vec1; ++ grub_uint8_t vec2_size; ++ struct option_vector2 vec2; ++ grub_uint8_t vec3_size; ++ grub_uint16_t vec3; ++ grub_uint8_t vec4_size; ++ grub_uint16_t vec4; ++} GRUB_PACKED; ++ ++/* ++ * Call ibm,client-architecture-support to try to get more RMA. ++ * We ask for 512MB which should be enough to verify a distro kernel. ++ * We ignore most errors: if we don't succeed we'll proceed with whatever ++ * memory we have. ++ */ ++static void ++grub_ieee1275_ibm_cas (void) ++{ ++ int rc; ++ grub_ieee1275_ihandle_t root; ++ struct cas_args ++ { ++ struct grub_ieee1275_common_hdr common; ++ grub_ieee1275_cell_t method; ++ grub_ieee1275_ihandle_t ihandle; ++ grub_ieee1275_cell_t cas_addr; ++ grub_ieee1275_cell_t result; ++ } args; ++ struct cas_vector vector = ++ { ++ .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ ++ .num_vecs = 4 - 1, ++ .vec1_size = 0, ++ .vec1 = 0x80, /* ignore */ ++ .vec2_size = 1 + sizeof (struct option_vector2) - 2, ++ .vec2 = { ++ 0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48 ++ }, ++ .vec3_size = 2 - 1, ++ .vec3 = 0x00e0, /* ask for FP + VMX + DFP but don't halt if unsatisfied */ ++ .vec4_size = 2 - 1, ++ .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ ++ }; ++ ++ INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); ++ args.method = (grub_ieee1275_cell_t) "ibm,client-architecture-support"; ++ rc = grub_ieee1275_open ("/", &root); ++ if (rc) ++ { ++ grub_error (GRUB_ERR_IO, "could not open root when trying to call CAS"); ++ return; ++ } ++ args.ihandle = root; ++ args.cas_addr = (grub_ieee1275_cell_t) &vector; ++ ++ grub_printf ("Calling ibm,client-architecture-support from grub..."); ++ IEEE1275_CALL_ENTRY_FN (&args); ++ grub_printf ("done\n"); ++ ++ grub_ieee1275_close (root); ++} ++ ++#endif /* __powerpc__ */ ++ ++static void + grub_claim_heap (void) + { + unsigned long total = 0; + ++#if defined(__powerpc__) ++ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) ++ { ++ grub_uint64_t rma_size; ++ grub_err_t err; ++ ++ err = grub_ieee1275_total_mem (&rma_size); ++ /* if we have an error, don't call CAS, just hope for the best */ ++ if (err == GRUB_ERR_NONE && rma_size < (512 * 1024 * 1024)) ++ grub_ieee1275_ibm_cas (); ++ } ++#endif ++ + grub_machine_mmap_iterate (heap_init, &total); + } + #endif +diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h +index 6a1d3e5d70..560c968460 100644 +--- a/include/grub/ieee1275/ieee1275.h ++++ b/include/grub/ieee1275/ieee1275.h +@@ -138,7 +138,17 @@ enum grub_ieee1275_flag + + GRUB_IEEE1275_FLAG_RAW_DEVNAMES, + +- GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT ++ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT, ++ ++#if defined(__powerpc__) ++ /* ++ * On PFW, the first time we boot a Linux partition, we may only get 256MB of ++ * real memory area, even if the partition has more memory. Set this flag if ++ * we think we're running under PFW. Then, if this flag is set, and the RMA is ++ * only 256MB in size, try asking for more with CAS. ++ */ ++ GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY, ++#endif + }; + + extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); diff --git a/0314-ieee1275-drop-len-1-quirk-in-heap_init.patch b/0314-ieee1275-drop-len-1-quirk-in-heap_init.patch new file mode 100644 index 00000000..4ce064ba --- /dev/null +++ b/0314-ieee1275-drop-len-1-quirk-in-heap_init.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 6 Feb 2023 10:03:21 -0500 +Subject: [PATCH] ieee1275: drop len -= 1 quirk in heap_init + +This was apparently 'required by some firmware': commit dc9468500919 +("2007-02-12 Hollis Blanchard "). + +It's not clear what firmware that was, and what platform from 14 years ago +which exhibited the bug then is still both in use and buggy now. + +It doesn't cause issues on qemu (mac99 or pseries) or under PFW for Power8. + +I don't have access to old Mac hardware, but if anyone feels especially +strongly we can put it under some feature flag. I really want to disable +it under pseries because it will mess with region merging. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit fc639d430297321ee4f77c5d2d698f698cec0dc7) +--- + grub-core/kern/ieee1275/init.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 8ae405bc79..c8d551759d 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -168,7 +168,6 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + addr = 0x180000; + } + } +- len -= 1; /* Required for some firmware. */ + + /* Never exceed HEAP_MAX_SIZE */ + if (*total + len > HEAP_MAX_SIZE) diff --git a/0315-ieee1275-support-runtime-memory-claiming.patch b/0315-ieee1275-support-runtime-memory-claiming.patch new file mode 100644 index 00000000..17ad61d9 --- /dev/null +++ b/0315-ieee1275-support-runtime-memory-claiming.patch @@ -0,0 +1,435 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 6 Feb 2023 10:03:22 -0500 +Subject: [PATCH] ieee1275: support runtime memory claiming + +On powerpc-ieee1275, we are running out of memory trying to verify +anything. This is because: + + - we have to load an entire file into memory to verify it. This is + difficult to change with appended signatures. + - We only have 32MB of heap. + - Distro kernels are now often around 30MB. + +So we want to be able to claim more memory from OpenFirmware for our heap +at runtime. + +There are some complications: + + - The grub mm code isn't the only thing that will make claims on + memory from OpenFirmware: + + * PFW/SLOF will have claimed some for their own use. + + * The ieee1275 loader will try to find other bits of memory that we + haven't claimed to place the kernel and initrd when we go to boot. + + * Once we load Linux, it will also try to claim memory. It claims + memory without any reference to /memory/available, it just starts + at min(top of RMO, 768MB) and works down. So we need to avoid this + area. See arch/powerpc/kernel/prom_init.c as of v5.11. + + - The smallest amount of memory a ppc64 KVM guest can have is 256MB. + It doesn't work with distro kernels but can work with custom kernels. + We should maintain support for that. (ppc32 can boot with even less, + and we shouldn't break that either.) + + - Even if a VM has more memory, the memory OpenFirmware makes available + as Real Memory Area can be restricted. Even with our CAS work, an LPAR + on a PowerVM box is likely to have only 512MB available to OpenFirmware + even if it has many gigabytes of memory allocated. + +What should we do? + +We don't know in advance how big the kernel and initrd are going to be, +which makes figuring out how much memory we can take a bit tricky. + +To figure out how much memory we should leave unused, I looked at: + + - an Ubuntu 20.04.1 ppc64le pseries KVM guest: + vmlinux: ~30MB + initrd: ~50MB + + - a RHEL8.2 ppc64le pseries KVM guest: + vmlinux: ~30MB + initrd: ~30MB + +So to give us a little wriggle room, I think we want to leave at least +128MB for the loader to put vmlinux and initrd in memory and leave Linux +with space to satisfy its early allocations. + +Allow other space to be allocated at runtime. + +Tested-by: Stefan Berger +Signed-off-by: Daniel Axtens +(cherry picked from commit a5c710789ccdd27a84ae4a34c7d453bd585e2b66) +[rharwood: _start?] +--- + grub-core/kern/ieee1275/init.c | 270 ++++++++++++++++++++++++++++++++++++++--- + docs/grub-dev.texi | 7 +- + 2 files changed, 257 insertions(+), 20 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index c8d551759d..85af8fa97b 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -46,13 +46,26 @@ + #endif + #include + +-/* The maximum heap size we're going to claim */ ++/* The maximum heap size we're going to claim at boot. Not used by sparc. */ + #ifdef __i386__ + #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) +-#else ++#else /* __powerpc__ */ + #define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024) + #endif + ++/* RMO max. address at 768 MB */ ++#define RMO_ADDR_MAX (grub_uint64_t) (768 * 1024 * 1024) ++ ++/* ++ * The amount of OF space we will not claim here so as to leave space for ++ * the loader and linux to service early allocations. ++ * ++ * In 2021, Daniel Axtens claims that we should leave at least 128MB to ++ * ensure we can load a stock kernel and initrd on a pseries guest with ++ * a 512MB real memory area under PowerVM. ++ */ ++#define RUNTIME_MIN_SPACE (128UL * 1024 * 1024) ++ + extern char _end[]; + + #ifdef __sparc__ +@@ -147,16 +160,52 @@ grub_claim_heap (void) + + GRUB_KERNEL_MACHINE_STACK_SIZE), 0x200000); + } + #else +-/* Helper for grub_claim_heap. */ ++/* Helpers for mm on powerpc. */ ++ ++/* ++ * How much memory does OF believe exists in total? ++ * ++ * This isn't necessarily the true total. It can be the total memory ++ * accessible in real mode for a pseries guest, for example. ++ */ ++static grub_uint64_t rmo_top; ++ + static int +-heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, +- void *data) ++count_free (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, ++ void *data) + { +- unsigned long *total = data; ++ if (type != GRUB_MEMORY_AVAILABLE) ++ return 0; ++ ++ /* Do not consider memory beyond 4GB */ ++ if (addr > 0xffffffffULL) ++ return 0; ++ ++ if (addr + len > 0xffffffffULL) ++ len = 0xffffffffULL - addr; ++ ++ *(grub_uint32_t *) data += len; ++ ++ return 0; ++} ++ ++static int ++regions_claim (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, ++ unsigned int flags, void *data) ++{ ++ grub_uint32_t total = *(grub_uint32_t *) data; ++ grub_uint64_t linux_rmo_save; + + if (type != GRUB_MEMORY_AVAILABLE) + return 0; + ++ /* Do not consider memory beyond 4GB */ ++ if (addr > 0xffffffffULL) ++ return 0; ++ ++ if (addr + len > 0xffffffffULL) ++ len = 0xffffffffULL - addr; ++ + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM)) + { + if (addr + len <= 0x180000) +@@ -169,10 +218,6 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + } + } + +- /* Never exceed HEAP_MAX_SIZE */ +- if (*total + len > HEAP_MAX_SIZE) +- len = HEAP_MAX_SIZE - *total; +- + /* In theory, firmware should already prevent this from happening by not + listing our own image in /memory/available. The check below is intended + as a safeguard in case that doesn't happen. However, it doesn't protect +@@ -184,6 +229,108 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + len = 0; + } + ++ /* ++ * Linux likes to claim memory at min(RMO top, 768MB) and works down ++ * without reference to /memory/available. (See prom_init.c::alloc_down) ++ * ++ * If this block contains min(RMO top, 768MB), do not claim below that for ++ * at least a few MB (this is where RTAS, SML and potentially TCEs live). ++ * ++ * We also need to leave enough space for the DT in the RMA. (See ++ * prom_init.c::alloc_up) ++ * ++ * Finally, we also want to make sure that when grub loads the kernel, ++ * it isn't going to use up all the memory we're trying to reserve! So ++ * enforce our entire RUNTIME_MIN_SPACE here: ++ * ++ * |---------- Top of memory ----------| ++ * | | ++ * | available | ++ * | | ++ * |---------- 768 MB ----------| ++ * | | ++ * | reserved | ++ * | | ++ * |--- 768 MB - runtime min space ---| ++ * | | ++ * | available | ++ * | | ++ * |---------- 0 MB ----------| ++ * ++ * Edge cases: ++ * ++ * - Total memory less than RUNTIME_MIN_SPACE: only claim up to HEAP_MAX_SIZE. ++ * (enforced elsewhere) ++ * ++ * - Total memory between RUNTIME_MIN_SPACE and 768MB: ++ * ++ * |---------- Top of memory ----------| ++ * | | ++ * | reserved | ++ * | | ++ * |---- top - runtime min space ----| ++ * | | ++ * | available | ++ * | | ++ * |---------- 0 MB ----------| ++ * ++ * This by itself would not leave us with RUNTIME_MIN_SPACE of free bytes: if ++ * rmo_top < 768MB, we will almost certainly have FW claims in the reserved ++ * region. We try to address that elsewhere: grub_ieee1275_mm_add_region will ++ * not call us if the resulting free space would be less than RUNTIME_MIN_SPACE. ++ */ ++ linux_rmo_save = grub_min (RMO_ADDR_MAX, rmo_top) - RUNTIME_MIN_SPACE; ++ if (rmo_top > RUNTIME_MIN_SPACE) ++ { ++ if (rmo_top <= RMO_ADDR_MAX) ++ { ++ if (addr > linux_rmo_save) ++ { ++ grub_dprintf ("ieee1275", "rejecting region in RUNTIME_MIN_SPACE reservation (%llx)\n", ++ addr); ++ return 0; ++ } ++ else if (addr + len > linux_rmo_save) ++ { ++ grub_dprintf ("ieee1275", "capping region: (%llx -> %llx) -> (%llx -> %llx)\n", ++ addr, addr + len, addr, rmo_top - RUNTIME_MIN_SPACE); ++ len = linux_rmo_save - addr; ++ } ++ } ++ else ++ { ++ /* ++ * we order these cases to prefer higher addresses and avoid some ++ * splitting issues ++ */ ++ if (addr < RMO_ADDR_MAX && (addr + len) > RMO_ADDR_MAX) ++ { ++ grub_dprintf ("ieee1275", ++ "adjusting region for RUNTIME_MIN_SPACE: (%llx -> %llx) -> (%llx -> %llx)\n", ++ addr, addr + len, RMO_ADDR_MAX, addr + len); ++ len = (addr + len) - RMO_ADDR_MAX; ++ addr = RMO_ADDR_MAX; ++ } ++ else if ((addr < linux_rmo_save) && ((addr + len) > linux_rmo_save)) ++ { ++ grub_dprintf ("ieee1275", "capping region: (%llx -> %llx) -> (%llx -> %llx)\n", ++ addr, addr + len, addr, linux_rmo_save); ++ len = linux_rmo_save - addr; ++ } ++ else if (addr >= linux_rmo_save && (addr + len) <= RMO_ADDR_MAX) ++ { ++ grub_dprintf ("ieee1275", "rejecting region in RUNTIME_MIN_SPACE reservation (%llx)\n", ++ addr); ++ return 0; ++ } ++ } ++ } ++ if (flags & GRUB_MM_ADD_REGION_CONSECUTIVE && len < total) ++ return 0; ++ ++ if (len > total) ++ len = total; ++ + if (len) + { + grub_err_t err; +@@ -192,15 +339,95 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + if (err) + return err; + grub_mm_init_region ((void *) (grub_addr_t) addr, len); ++ total -= len; + } + +- *total += len; +- if (*total >= HEAP_MAX_SIZE) ++ *(grub_uint32_t *) data = total; ++ ++ if (total == 0) + return 1; + + return 0; + } + ++static int ++heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, ++ void *data) ++{ ++ return regions_claim (addr, len, type, GRUB_MM_ADD_REGION_NONE, data); ++} ++ ++static int ++region_claim (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, ++ void *data) ++{ ++ return regions_claim (addr, len, type, GRUB_MM_ADD_REGION_CONSECUTIVE, data); ++} ++ ++static grub_err_t ++grub_ieee1275_mm_add_region (grub_size_t size, unsigned int flags) ++{ ++ grub_uint32_t free_memory = 0; ++ grub_uint32_t avail = 0; ++ grub_uint32_t total; ++ ++ grub_dprintf ("ieee1275", "mm requested region of size %x, flags %x\n", ++ size, flags); ++ ++ /* ++ * Update free memory each time, which is a bit inefficient but guards us ++ * against a situation where some OF driver goes out to firmware for ++ * memory and we don't realise. ++ */ ++ grub_machine_mmap_iterate (count_free, &free_memory); ++ ++ /* Ensure we leave enough space to boot. */ ++ if (free_memory <= RUNTIME_MIN_SPACE + size) ++ { ++ grub_dprintf ("ieee1275", "Cannot satisfy allocation and retain minimum runtime space\n"); ++ return GRUB_ERR_OUT_OF_MEMORY; ++ } ++ ++ if (free_memory > RUNTIME_MIN_SPACE) ++ avail = free_memory - RUNTIME_MIN_SPACE; ++ ++ grub_dprintf ("ieee1275", "free = 0x%x available = 0x%x\n", free_memory, avail); ++ ++ if (flags & GRUB_MM_ADD_REGION_CONSECUTIVE) ++ { ++ /* first try rounding up hard for the sake of speed */ ++ total = grub_max (ALIGN_UP (size, 1024 * 1024) + 1024 * 1024, 32 * 1024 * 1024); ++ total = grub_min (avail, total); ++ ++ grub_dprintf ("ieee1275", "looking for %x bytes of memory (%x requested)\n", total, size); ++ ++ grub_machine_mmap_iterate (region_claim, &total); ++ grub_dprintf ("ieee1275", "get memory from fw %s\n", total == 0 ? "succeeded" : "failed"); ++ ++ if (total != 0) ++ { ++ total = grub_min (avail, size); ++ ++ grub_dprintf ("ieee1275", "fallback for %x bytes of memory (%x requested)\n", total, size); ++ ++ grub_machine_mmap_iterate (region_claim, &total); ++ grub_dprintf ("ieee1275", "fallback from fw %s\n", total == 0 ? "succeeded" : "failed"); ++ } ++ } ++ else ++ { ++ /* provide padding for a grub_mm_header_t and region */ ++ total = grub_min (avail, size); ++ grub_machine_mmap_iterate (heap_init, &total); ++ grub_dprintf ("ieee1275", "get noncontig memory from fw %s\n", total == 0 ? "succeeded" : "failed"); ++ } ++ ++ if (total == 0) ++ return GRUB_ERR_NONE; ++ else ++ return GRUB_ERR_OUT_OF_MEMORY; ++} ++ + /* + * How much memory does OF believe it has? (regardless of whether + * it's accessible or not) +@@ -356,17 +583,24 @@ grub_ieee1275_ibm_cas (void) + static void + grub_claim_heap (void) + { +- unsigned long total = 0; ++ grub_err_t err; ++ grub_uint32_t total = HEAP_MAX_SIZE; ++ ++ err = grub_ieee1275_total_mem (&rmo_top); ++ ++ /* ++ * If we cannot size the available memory, we can't be sure we're leaving ++ * space for the kernel, initrd and things Linux loads early in boot. So only ++ * allow further allocations from firmware on success ++ */ ++ if (err == GRUB_ERR_NONE) ++ grub_mm_add_region_fn = grub_ieee1275_mm_add_region; + + #if defined(__powerpc__) + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) + { +- grub_uint64_t rma_size; +- grub_err_t err; +- +- err = grub_ieee1275_total_mem (&rma_size); + /* if we have an error, don't call CAS, just hope for the best */ +- if (err == GRUB_ERR_NONE && rma_size < (512 * 1024 * 1024)) ++ if (err == GRUB_ERR_NONE && rmo_top < (512 * 1024 * 1024)) + grub_ieee1275_ibm_cas (); + } + #endif +diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi +index 7b2455a8fe..7edc5b7e2b 100644 +--- a/docs/grub-dev.texi ++++ b/docs/grub-dev.texi +@@ -1047,7 +1047,10 @@ space is limited to 4GiB. GRUB allocates pages from EFI for its heap, at most + 1.6 GiB. + + On i386-ieee1275 and powerpc-ieee1275 GRUB uses same stack as IEEE1275. +-It allocates at most 32MiB for its heap. ++ ++On i386-ieee1275 and powerpc-ieee1275, GRUB will allocate 32MiB for its heap on ++startup. It may allocate more at runtime, as long as at least 128MiB remain free ++in OpenFirmware. + + On sparc64-ieee1275 stack is 256KiB and heap is 2MiB. + +@@ -1075,7 +1078,7 @@ In short: + @item i386-qemu @tab 60 KiB @tab < 4 GiB + @item *-efi @tab ? @tab < 1.6 GiB + @item i386-ieee1275 @tab ? @tab < 32 MiB +-@item powerpc-ieee1275 @tab ? @tab < 32 MiB ++@item powerpc-ieee1275 @tab ? @tab available memory - 128MiB + @item sparc64-ieee1275 @tab 256KiB @tab 2 MiB + @item arm-uboot @tab 256KiB @tab 2 MiB + @item mips(el)-qemu_mips @tab 2MiB @tab 253 MiB diff --git a/0316-ieee1275-implement-vec5-for-cas-negotiation.patch b/0316-ieee1275-implement-vec5-for-cas-negotiation.patch new file mode 100644 index 00000000..fad39db7 --- /dev/null +++ b/0316-ieee1275-implement-vec5-for-cas-negotiation.patch @@ -0,0 +1,74 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Diego Domingos +Date: Mon, 6 Feb 2023 10:03:23 -0500 +Subject: [PATCH] ieee1275: implement vec5 for cas negotiation + +As a legacy support, if the vector 5 is not implemented, Power Hypervisor will +consider the max CPUs as 64 instead 256 currently supported during +client-architecture-support negotiation. + +This patch implements the vector 5 and set the MAX CPUs to 256 while setting the +others values to 0 (default). + +Signed-off-by: Diego Domingos +Acked-by: Daniel Axtens +Signed-off-by: Stefan Berger +Signed-off-by: Avnish Chouhan +(cherry picked from commit 942f19959fe7465fb52a1da39ff271a7ab704892) +--- + grub-core/kern/ieee1275/init.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 85af8fa97b..72d4fed312 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -502,6 +502,19 @@ struct option_vector2 + grub_uint8_t max_pft_size; + } GRUB_PACKED; + ++struct option_vector5 ++{ ++ grub_uint8_t byte1; ++ grub_uint8_t byte2; ++ grub_uint8_t byte3; ++ grub_uint8_t cmo; ++ grub_uint8_t associativity; ++ grub_uint8_t bin_opts; ++ grub_uint8_t micro_checkpoint; ++ grub_uint8_t reserved0; ++ grub_uint32_t max_cpus; ++} GRUB_PACKED; ++ + struct pvr_entry + { + grub_uint32_t mask; +@@ -523,6 +536,8 @@ struct cas_vector + grub_uint16_t vec3; + grub_uint8_t vec4_size; + grub_uint16_t vec4; ++ grub_uint8_t vec5_size; ++ struct option_vector5 vec5; + } GRUB_PACKED; + + /* +@@ -547,7 +562,7 @@ grub_ieee1275_ibm_cas (void) + struct cas_vector vector = + { + .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ +- .num_vecs = 4 - 1, ++ .num_vecs = 5 - 1, + .vec1_size = 0, + .vec1 = 0x80, /* ignore */ + .vec2_size = 1 + sizeof (struct option_vector2) - 2, +@@ -558,6 +573,10 @@ grub_ieee1275_ibm_cas (void) + .vec3 = 0x00e0, /* ask for FP + VMX + DFP but don't halt if unsatisfied */ + .vec4_size = 2 - 1, + .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ ++ .vec5_size = 1 + sizeof (struct option_vector5) - 2, ++ .vec5 = { ++ 0, 192, 0, 128, 0, 0, 0, 0, 256 ++ } + }; + + INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); diff --git a/0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch b/0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch similarity index 80% rename from 0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch rename to 0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch index 5e3a7940..02c02829 100644 --- a/0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +++ b/0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Stefan Berger -Date: Sun, 15 Mar 2020 12:37:10 -0400 +Date: Mon, 6 Feb 2023 10:03:25 -0500 Subject: [PATCH] ibmvtpm: Add support for trusted boot using a vTPM 2.0 Add support for trusted boot using a vTPM 2.0 on the IBM IEEE1275 @@ -10,6 +10,10 @@ does. This patch requires Daniel Axtens's patches for claiming more memory. +Note: The tpm_init() function cannot be called from GRUB_MOD_INIT() since +it does not find the device nodes upon module initialization and +therefore the call to tpm_init() must be deferred to grub_tpm_measure(). + For vTPM support to work on PowerVM, system driver levels 1010.30 or 1020.00 are required. @@ -22,16 +26,19 @@ above. Cc: Eric Snowberg Signed-off-by: Stefan Berger +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit 2aa5ef83743dfea79377309ff4f5e9c9a55de355) --- grub-core/Makefile.core.def | 7 ++ - grub-core/commands/ieee1275/ibmvtpm.c | 152 ++++++++++++++++++++++++++++++++++ + grub-core/commands/ieee1275/ibmvtpm.c | 155 ++++++++++++++++++++++++++++++++++ include/grub/ieee1275/ieee1275.h | 3 + docs/grub.texi | 3 +- - 4 files changed, 164 insertions(+), 1 deletion(-) + 4 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 grub-core/commands/ieee1275/ibmvtpm.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 741a033978..e038c5e6fd 100644 +index f21da23213..02ea718652 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1175,6 +1175,13 @@ module = { @@ -50,14 +57,14 @@ index 741a033978..e038c5e6fd 100644 common = commands/terminal.c; diff --git a/grub-core/commands/ieee1275/ibmvtpm.c b/grub-core/commands/ieee1275/ibmvtpm.c new file mode 100644 -index 0000000000..e68b8448bc +index 0000000000..239942d27e --- /dev/null +++ b/grub-core/commands/ieee1275/ibmvtpm.c -@@ -0,0 +1,152 @@ +@@ -0,0 +1,155 @@ +/* + * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2021 Free Software Foundation, Inc. -+ * Copyright (C) 2021 IBM Corporation ++ * Copyright (C) 2022 Free Software Foundation, Inc. ++ * Copyright (C) 2022 IBM Corporation + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -85,7 +92,7 @@ index 0000000000..e68b8448bc +static grub_ieee1275_ihandle_t tpm_ihandle; +static grub_uint8_t tpm_version; + -+#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_ihandle_t)0) ++#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_ihandle_t) 0) + +static void +tpm_get_tpm_version (void) @@ -107,10 +114,11 @@ index 0000000000..e68b8448bc + + if (!init_success) + { -+ if (grub_ieee1275_open ("/vdevice/vtpm", &tpm_ihandle) < 0) { -+ tpm_ihandle = IEEE1275_IHANDLE_INVALID; -+ return GRUB_ERR_UNKNOWN_DEVICE; -+ } ++ if (grub_ieee1275_open ("/vdevice/vtpm", &tpm_ihandle) < 0) ++ { ++ tpm_ihandle = IEEE1275_IHANDLE_INVALID; ++ return GRUB_ERR_UNKNOWN_DEVICE; ++ } + + init_success = 1; + @@ -140,8 +148,8 @@ index 0000000000..e68b8448bc + grub_ieee1275_cell_t pcrindex; + grub_ieee1275_cell_t catch_result; + grub_ieee1275_cell_t rc; -+ } -+ args; ++ }; ++ struct tpm_2hash_ext_log args; + + INIT_IEEE1275_COMMON (&args.common, "call-method", 8, 2); + args.method = (grub_ieee1275_cell_t) "2hash-ext-log"; @@ -167,22 +175,20 @@ index 0000000000..e68b8448bc +} + +static grub_err_t -+tpm2_log_event (unsigned char *buf, -+ grub_size_t size, grub_uint8_t pcr, ++tpm2_log_event (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, + const char *description) +{ + static int error_displayed = 0; -+ int err; ++ int rc; + -+ err = ibmvtpm_2hash_ext_log (pcr, EV_IPL, -+ description, -+ grub_strlen(description) + 1, -+ buf, size); -+ if (err && !error_displayed) ++ rc = ibmvtpm_2hash_ext_log (pcr, EV_IPL, ++ description, grub_strlen(description) + 1, ++ buf, size); ++ if (rc && !error_displayed) + { + error_displayed++; + return grub_error (GRUB_ERR_BAD_DEVICE, -+ "2HASH-EXT-LOG failed: Firmware is likely too old.\n"); ++ "2HASH-EXT-LOG failed: Firmware is likely too old.\n"); + } + + return GRUB_ERR_NONE; @@ -192,7 +198,11 @@ index 0000000000..e68b8448bc +grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, + const char *description) +{ -+ grub_err_t err = tpm_init(); ++ /* ++ * Call tpm_init() 'late' rather than from GRUB_MOD_INIT() so that device nodes ++ * can be found. ++ */ ++ grub_err_t err = tpm_init (); + + /* Absence of a TPM isn't a failure. */ + if (err != GRUB_ERR_NONE) @@ -207,7 +217,7 @@ index 0000000000..e68b8448bc + return GRUB_ERR_NONE; +} diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index e0a6c2ce1e..f4c85265fe 100644 +index 560c968460..27b9cf259b 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -24,6 +24,9 @@ @@ -221,10 +231,10 @@ index e0a6c2ce1e..f4c85265fe 100644 { unsigned int start; diff --git a/docs/grub.texi b/docs/grub.texi -index a4da9c2a1b..c433240f34 100644 +index 1750b72ee9..825278a7f3 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -6221,7 +6221,8 @@ tpm module is loaded. As such it is recommended that the tpm module be built +@@ -6235,7 +6235,8 @@ tpm module is loaded. As such it is recommended that the tpm module be built into @file{core.img} in order to avoid a potential gap in measurement between @file{core.img} being loaded and the tpm module being loaded. diff --git a/0318-powerpc-Drop-Open-Hack-Ware.patch b/0318-powerpc-Drop-Open-Hack-Ware.patch new file mode 100644 index 00000000..1d201d3f --- /dev/null +++ b/0318-powerpc-Drop-Open-Hack-Ware.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 6 Sep 2021 15:46:11 +1000 +Subject: [PATCH] powerpc: Drop Open Hack'Ware + +Open Hack'Ware was an alternative firmware of powerpc under QEMU. + +The last commit to any Open Hack'Ware repo I can find is from 2014 [1]. + +Open Hack'Ware was used for the QEMU "prep" machine type, which was +deprecated in QEMU in commit 54c86f5a4844 (hw/ppc: deprecate the +machine type 'prep', replaced by '40p') in QEMU v3.1, and had reportedly +been broken for years before without anyone noticing. Support was removed +in February 2020 by commit b2ce76a0730e (hw/ppc/prep: Remove the +deprecated "prep" machine and the OpenHackware BIOS). + +Open Hack'Ware's limitations require some messy code in GRUB. This +complexity is not worth carrying any more. + +Remove detection of Open Hack'Ware. We will clean up the feature flags +in following commits. + +[1]: https://github.com/qemu/openhackware and + https://repo.or.cz/w/openhackware.git are QEMU submodules. They have + only small changes on top of OHW v0.4.1, which was imported into + QEMU SCM in 2010. I can't find anything resembling an official repo + any more. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +(cherry picked from commit f9ce538eec88c5cffbfde021c4e8a95a5e9d0e8f) +--- + grub-core/kern/ieee1275/cmain.c | 16 ---------------- + 1 file changed, 16 deletions(-) + +diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c +index dce7b84922..cb42f60ebe 100644 +--- a/grub-core/kern/ieee1275/cmain.c ++++ b/grub-core/kern/ieee1275/cmain.c +@@ -49,7 +49,6 @@ grub_ieee1275_find_options (void) + grub_ieee1275_phandle_t root; + grub_ieee1275_phandle_t options; + grub_ieee1275_phandle_t openprom; +- grub_ieee1275_phandle_t bootrom; + int rc; + grub_uint32_t realmode = 0; + char tmp[256]; +@@ -198,21 +197,6 @@ grub_ieee1275_find_options (void) + + grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_HAS_CURSORONOFF); + } +- +- if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom) +- || ! grub_ieee1275_finddevice ("/boot-rom", &bootrom)) +- { +- rc = grub_ieee1275_get_property (bootrom, "model", tmp, sizeof (tmp), 0); +- if (rc >= 0 && !grub_strncmp (tmp, "PPC Open Hack'Ware", +- sizeof ("PPC Open Hack'Ware") - 1)) +- { +- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT); +- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS); +- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET); +- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM); +- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_ANSI); +- } +- } + } + + void diff --git a/grub.patches b/grub.patches index ae57994f..45eb5530 100644 --- a/grub.patches +++ b/grub.patches @@ -172,146 +172,147 @@ Patch0171: 0171-appended-signatures-verification-tests.patch Patch0172: 0172-appended-signatures-documentation.patch Patch0173: 0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch Patch0174: 0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0175: 0175-ieee1275-claim-more-memory.patch -Patch0176: 0176-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0177: 0177-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0178: 0178-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0179: 0179-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0180: 0180-efinet-Add-DHCP-proxy-support.patch -Patch0181: 0181-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0182: 0182-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0183: 0183-Suppress-gettext-error-message.patch -Patch0184: 0184-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0185: 0185-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0186: 0186-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0187: 0187-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0188: 0188-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0189: 0189-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0190: 0190-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0191: 0191-Print-module-name-on-license-check-failure.patch -Patch0192: 0192-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0193: 0193-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0194: 0194-fs-btrfs-Use-full-btrfs-bootloader-area.patch -Patch0195: 0195-Add-Fedora-location-of-DejaVu-SANS-font.patch -Patch0196: 0196-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch -Patch0197: 0197-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch -Patch0198: 0198-EFI-console-Do-not-set-colorstate-until-the-first-te.patch -Patch0199: 0199-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch -Patch0200: 0200-Use-visual-indentation-in-config.h.in.patch -Patch0201: 0201-Where-present-ensure-config-util.h-precedes-config.h.patch -Patch0202: 0202-Drop-gnulib-fix-base64.patch.patch -Patch0203: 0203-Drop-gnulib-no-abort.patch.patch -Patch0204: 0204-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0205: 0205-commands-search-Fix-bug-stopping-iteration-when-no-f.patch -Patch0206: 0206-search-new-efidisk-only-option-on-EFI-systems.patch -Patch0207: 0207-efi-new-connectefi-command.patch -Patch0208: 0208-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch -Patch0209: 0209-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch -Patch0210: 0210-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch -Patch0211: 0211-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch -Patch0212: 0212-powerpc-do-CAS-in-a-more-compatible-way.patch -Patch0213: 0213-powerpc-prefix-detection-support-device-names-with-c.patch -Patch0214: 0214-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch -Patch0215: 0215-make-ofdisk_retries-optional.patch -Patch0216: 0216-loader-efi-chainloader-grub_load_and_start_image-doe.patch -Patch0217: 0217-loader-efi-chainloader-simplify-the-loader-state.patch -Patch0218: 0218-commands-boot-Add-API-to-pass-context-to-loader.patch -Patch0219: 0219-loader-efi-chainloader-Use-grub_loader_set_ex.patch -Patch0220: 0220-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch -Patch0221: 0221-loader-i386-efi-linux-Use-grub_loader_set_ex.patch -Patch0222: 0222-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch -Patch0223: 0223-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch -Patch0224: 0224-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch -Patch0225: 0225-video-readers-png-Abort-sooner-if-a-read-operation-f.patch -Patch0226: 0226-video-readers-png-Refuse-to-handle-multiple-image-he.patch -Patch0227: 0227-video-readers-png-Drop-greyscale-support-to-fix-heap.patch -Patch0228: 0228-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch -Patch0229: 0229-video-readers-png-Sanity-check-some-huffman-codes.patch -Patch0230: 0230-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch -Patch0231: 0231-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch -Patch0232: 0232-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch -Patch0233: 0233-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch -Patch0234: 0234-normal-charset-Fix-array-out-of-bounds-formatting-un.patch -Patch0235: 0235-net-netbuff-Block-overly-large-netbuff-allocs.patch -Patch0236: 0236-net-ip-Do-IP-fragment-maths-safely.patch -Patch0237: 0237-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch -Patch0238: 0238-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch -Patch0239: 0239-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch -Patch0240: 0240-net-tftp-Avoid-a-trivial-UAF.patch -Patch0241: 0241-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch -Patch0242: 0242-net-http-Fix-OOB-write-for-split-http-headers.patch -Patch0243: 0243-net-http-Error-out-on-headers-with-LF-without-CR.patch -Patch0244: 0244-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch -Patch0245: 0245-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch -Patch0246: 0246-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch -Patch0247: 0247-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch -Patch0248: 0248-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch -Patch0249: 0249-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch -Patch0250: 0250-misc-Make-grub_min-and-grub_max-more-resilient.patch -Patch0251: 0251-ReiserFS-switch-to-using-grub_min-grub_max.patch -Patch0252: 0252-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch -Patch0253: 0253-modules-make-.module_license-read-only.patch -Patch0254: 0254-modules-strip-.llvm_addrsig-sections-and-similar.patch -Patch0255: 0255-modules-Don-t-allocate-space-for-non-allocable-secti.patch -Patch0256: 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch -Patch0257: 0257-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch -Patch0258: 0258-modules-load-module-sections-at-page-aligned-address.patch -Patch0259: 0259-nx-add-memory-attribute-get-set-API.patch -Patch0260: 0260-nx-set-page-permissions-for-loaded-modules.patch -Patch0261: 0261-nx-set-attrs-in-our-kernel-loaders.patch -Patch0262: 0262-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch -Patch0263: 0263-grub-probe-document-the-behavior-of-multiple-v.patch -Patch0264: 0264-grub_fs_probe-dprint-errors-from-filesystems.patch -Patch0265: 0265-fs-fat-don-t-error-when-mtime-is-0.patch -Patch0266: 0266-Make-debug-file-show-which-file-filters-get-run.patch -Patch0267: 0267-efi-use-enumerated-array-positions-for-our-allocatio.patch -Patch0268: 0268-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch -Patch0269: 0269-efi-allocate-the-initrd-within-the-bounds-expressed-.patch -Patch0270: 0270-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch -Patch0271: 0271-BLS-create-etc-kernel-cmdline-during-mkconfig.patch -Patch0272: 0272-squish-don-t-dup-rhgb-quiet-check-mtimes.patch -Patch0273: 0273-squish-give-up-on-rhgb-quiet.patch -Patch0274: 0274-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch -Patch0275: 0275-ieee1275-implement-vec5-for-cas-negotiation.patch -Patch0276: 0276-blscfg-Don-t-root-device-in-emu-builds.patch -Patch0277: 0277-loader-arm64-linux-Remove-magic-number-header-field-.patch -Patch0278: 0278-Correct-BSS-zeroing-on-aarch64.patch -Patch0279: 0279-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch -Patch0280: 0280-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch -Patch0281: 0281-commands-efi-tpm-Refine-the-status-of-log-event.patch -Patch0282: 0282-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch -Patch0283: 0283-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch -Patch0284: 0284-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch -Patch0285: 0285-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch -Patch0286: 0286-font-Fix-several-integer-overflows-in-grub_font_cons.patch -Patch0287: 0287-font-Remove-grub_font_dup_glyph.patch -Patch0288: 0288-font-Fix-integer-overflow-in-ensure_comb_space.patch -Patch0289: 0289-font-Fix-integer-overflow-in-BMP-index.patch -Patch0290: 0290-font-Fix-integer-underflow-in-binary-search-of-char-.patch -Patch0291: 0291-kern-efi-sb-Enforce-verification-of-font-files.patch -Patch0292: 0292-fbutil-Fix-integer-overflow.patch -Patch0293: 0293-font-Fix-an-integer-underflow-in-blit_comb.patch -Patch0294: 0294-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch -Patch0295: 0295-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch -Patch0296: 0296-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch -Patch0297: 0297-font-Try-opening-fonts-from-the-bundled-memdisk.patch -Patch0298: 0298-Correction-in-vector-5-values.patch -Patch0299: 0299-mm-Clarify-grub_real_malloc.patch -Patch0300: 0300-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch -Patch0301: 0301-mm-Document-grub_free.patch -Patch0302: 0302-mm-Document-grub_mm_init_region.patch -Patch0303: 0303-mm-Document-GRUB-internal-memory-management-structur.patch -Patch0304: 0304-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch -Patch0305: 0305-mm-When-adding-a-region-merge-with-region-after-as-w.patch -Patch0306: 0306-mm-Debug-support-for-region-operations.patch -Patch0307: 0307-mm-Drop-unused-unloading-of-modules-on-OOM.patch -Patch0308: 0308-mm-Allow-dynamically-requesting-additional-memory-re.patch -Patch0309: 0309-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch -Patch0310: 0310-kern-efi-mm-Extract-function-to-add-memory-regions.patch -Patch0311: 0311-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch -Patch0312: 0312-kern-efi-mm-Implement-runtime-addition-of-pages.patch -Patch0313: 0313-efi-Increase-default-memory-allocation-to-32-MiB.patch -Patch0314: 0314-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch -Patch0315: 0315-ppc64le-signed-boot-media-changes.patch -Patch0316: 0316-core-Fix-several-implicit-function-declarations.patch -Patch0317: 0317-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch +Patch0175: 0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0176: 0176-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0177: 0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0178: 0178-efinet-Add-DHCP-proxy-support.patch +Patch0179: 0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +Patch0180: 0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0181: 0181-Suppress-gettext-error-message.patch +Patch0182: 0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0183: 0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch +Patch0184: 0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +Patch0185: 0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0186: 0186-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0187: 0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0188: 0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +Patch0189: 0189-Print-module-name-on-license-check-failure.patch +Patch0190: 0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0191: 0191-grub-mkconfig-restore-umask-for-grub.cfg.patch +Patch0192: 0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch +Patch0193: 0193-Add-Fedora-location-of-DejaVu-SANS-font.patch +Patch0194: 0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +Patch0195: 0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +Patch0196: 0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +Patch0197: 0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +Patch0198: 0198-Use-visual-indentation-in-config.h.in.patch +Patch0199: 0199-Where-present-ensure-config-util.h-precedes-config.h.patch +Patch0200: 0200-Drop-gnulib-fix-base64.patch.patch +Patch0201: 0201-Drop-gnulib-no-abort.patch.patch +Patch0202: 0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch +Patch0203: 0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +Patch0204: 0204-search-new-efidisk-only-option-on-EFI-systems.patch +Patch0205: 0205-efi-new-connectefi-command.patch +Patch0206: 0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0207: 0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +Patch0208: 0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0209: 0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0210: 0210-powerpc-prefix-detection-support-device-names-with-c.patch +Patch0211: 0211-make-ofdisk_retries-optional.patch +Patch0212: 0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch +Patch0213: 0213-loader-efi-chainloader-simplify-the-loader-state.patch +Patch0214: 0214-commands-boot-Add-API-to-pass-context-to-loader.patch +Patch0215: 0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch +Patch0216: 0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch +Patch0217: 0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch +Patch0218: 0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch +Patch0219: 0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch +Patch0220: 0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch +Patch0221: 0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch +Patch0222: 0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch +Patch0223: 0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch +Patch0224: 0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch +Patch0225: 0225-video-readers-png-Sanity-check-some-huffman-codes.patch +Patch0226: 0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch +Patch0227: 0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch +Patch0228: 0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch +Patch0229: 0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch +Patch0230: 0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch +Patch0231: 0231-net-netbuff-Block-overly-large-netbuff-allocs.patch +Patch0232: 0232-net-ip-Do-IP-fragment-maths-safely.patch +Patch0233: 0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch +Patch0234: 0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch +Patch0235: 0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch +Patch0236: 0236-net-tftp-Avoid-a-trivial-UAF.patch +Patch0237: 0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch +Patch0238: 0238-net-http-Fix-OOB-write-for-split-http-headers.patch +Patch0239: 0239-net-http-Error-out-on-headers-with-LF-without-CR.patch +Patch0240: 0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch +Patch0241: 0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch +Patch0242: 0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch +Patch0243: 0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch +Patch0244: 0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch +Patch0245: 0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch +Patch0246: 0246-misc-Make-grub_min-and-grub_max-more-resilient.patch +Patch0247: 0247-ReiserFS-switch-to-using-grub_min-grub_max.patch +Patch0248: 0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch +Patch0249: 0249-modules-make-.module_license-read-only.patch +Patch0250: 0250-modules-strip-.llvm_addrsig-sections-and-similar.patch +Patch0251: 0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch +Patch0252: 0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch +Patch0253: 0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch +Patch0254: 0254-modules-load-module-sections-at-page-aligned-address.patch +Patch0255: 0255-nx-add-memory-attribute-get-set-API.patch +Patch0256: 0256-nx-set-page-permissions-for-loaded-modules.patch +Patch0257: 0257-nx-set-attrs-in-our-kernel-loaders.patch +Patch0258: 0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch +Patch0259: 0259-grub-probe-document-the-behavior-of-multiple-v.patch +Patch0260: 0260-grub_fs_probe-dprint-errors-from-filesystems.patch +Patch0261: 0261-fs-fat-don-t-error-when-mtime-is-0.patch +Patch0262: 0262-Make-debug-file-show-which-file-filters-get-run.patch +Patch0263: 0263-efi-use-enumerated-array-positions-for-our-allocatio.patch +Patch0264: 0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch +Patch0265: 0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch +Patch0266: 0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch +Patch0267: 0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +Patch0268: 0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +Patch0269: 0269-squish-give-up-on-rhgb-quiet.patch +Patch0270: 0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +Patch0271: 0271-blscfg-Don-t-root-device-in-emu-builds.patch +Patch0272: 0272-loader-arm64-linux-Remove-magic-number-header-field-.patch +Patch0273: 0273-Correct-BSS-zeroing-on-aarch64.patch +Patch0274: 0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch +Patch0275: 0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch +Patch0276: 0276-commands-efi-tpm-Refine-the-status-of-log-event.patch +Patch0277: 0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch +Patch0278: 0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch +Patch0279: 0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch +Patch0280: 0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch +Patch0281: 0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch +Patch0282: 0282-font-Remove-grub_font_dup_glyph.patch +Patch0283: 0283-font-Fix-integer-overflow-in-ensure_comb_space.patch +Patch0284: 0284-font-Fix-integer-overflow-in-BMP-index.patch +Patch0285: 0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch +Patch0286: 0286-kern-efi-sb-Enforce-verification-of-font-files.patch +Patch0287: 0287-fbutil-Fix-integer-overflow.patch +Patch0288: 0288-font-Fix-an-integer-underflow-in-blit_comb.patch +Patch0289: 0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch +Patch0290: 0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch +Patch0291: 0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch +Patch0292: 0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch +Patch0293: 0293-mm-Clarify-grub_real_malloc.patch +Patch0294: 0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch +Patch0295: 0295-mm-Document-grub_free.patch +Patch0296: 0296-mm-Document-grub_mm_init_region.patch +Patch0297: 0297-mm-Document-GRUB-internal-memory-management-structur.patch +Patch0298: 0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch +Patch0299: 0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch +Patch0300: 0300-mm-Debug-support-for-region-operations.patch +Patch0301: 0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch +Patch0302: 0302-mm-Allow-dynamically-requesting-additional-memory-re.patch +Patch0303: 0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch +Patch0304: 0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch +Patch0305: 0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch +Patch0306: 0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch +Patch0307: 0307-efi-Increase-default-memory-allocation-to-32-MiB.patch +Patch0308: 0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch +Patch0309: 0309-ppc64le-signed-boot-media-changes.patch +Patch0310: 0310-core-Fix-several-implicit-function-declarations.patch +Patch0311: 0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch +Patch0312: 0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch +Patch0313: 0313-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0314: 0314-ieee1275-drop-len-1-quirk-in-heap_init.patch +Patch0315: 0315-ieee1275-support-runtime-memory-claiming.patch +Patch0316: 0316-ieee1275-implement-vec5-for-cas-negotiation.patch +Patch0317: 0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +Patch0318: 0318-powerpc-Drop-Open-Hack-Ware.patch diff --git a/grub2.spec b/grub2.spec index d4fa2381..1367fe68 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 84%{?dist} +Release: 85%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Feb 08 2023 Robbie Harwood - 2.06-85 +- ppc64le: sync cas/tpm patchset with upstream + * Mon Feb 06 2023 Robbie Harwood - 2.06-84 - emu: support newer kexec syscall From 63b29f783e1266164955f0fa0c253b85d398e856 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 10 Feb 2023 21:50:45 +0000 Subject: [PATCH 183/294] Override the linker and force nonexecutable stacks Signed-off-by: Robbie Harwood --- grub.macros | 2 +- grub2.spec | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/grub.macros b/grub.macros index 344f5b20..e88a2893 100644 --- a/grub.macros +++ b/grub.macros @@ -15,7 +15,7 @@ %endif # gnulib actively ignores CFLAGS because it's terrible -%global cc_equals "CC=%{ccpath} -fPIE" +%global cc_equals "CC=%{ccpath} -fPIE -Wl,-z,noexecstack" %global cflags_sed \\\ sed \\\ diff --git a/grub2.spec b/grub2.spec index 1367fe68..697cbeeb 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 85%{?dist} +Release: 86%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Feb 10 2023 Robbie Harwood - 2.06-86 +- Override the linker and force nonexecutable stacks + * Wed Feb 08 2023 Robbie Harwood - 2.06-85 - ppc64le: sync cas/tpm patchset with upstream From b86fd390b81a1cfeb4870c69334a9bf3a767fa91 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 16 Feb 2023 14:24:30 +0000 Subject: [PATCH 184/294] Fix disk sector size computation Signed-off-by: Robbie Harwood --- ...disk-Modify-sector-by-sysfs-as-disk-.patch | 70 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch diff --git a/0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch b/0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch new file mode 100644 index 00000000..6e7b17fe --- /dev/null +++ b/0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mukesh Kumar Chaurasiya +Date: Thu, 9 Feb 2023 13:09:16 +0530 +Subject: [PATCH] osdep/linux/hostdisk: Modify sector by sysfs as disk sector + +The disk sector size provided by sysfs file system considers the sector +size of 512 irrespective of disk sector size, thus causing the read by +the GRUB to an incorrect offset from what was originally intended. + +Considering the 512 sector size of sysfs data the actual sector needs to +be modified corresponding to disk sector size. + +Signed-off-by: Mukesh Kumar Chaurasiya +Reviewed-by: Daniel Kiper +(cherry picked from commit f7564844f82b57078d601befadc438b5bc1fa01b) +--- + grub-core/osdep/linux/hostdisk.c | 7 ++++--- + include/grub/disk.h | 7 +++++++ + 2 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c +index 7bc99ac1c1..a9ea0bb465 100644 +--- a/grub-core/osdep/linux/hostdisk.c ++++ b/grub-core/osdep/linux/hostdisk.c +@@ -240,7 +240,8 @@ have_devfs (void) + #pragma GCC diagnostic ignored "-Wformat-nonliteral" + + static int +-grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector) ++grub_hostdisk_linux_find_partition (const grub_disk_t disk, char *dev, ++ grub_disk_addr_t sector) + { + size_t len = strlen (dev); + const char *format; +@@ -305,7 +306,7 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector) + if (fstat (fd, &st) < 0 + || !grub_util_device_is_mapped_stat (&st) + || !grub_util_get_dm_node_linear_info (st.st_rdev, 0, 0, &start)) +- start = grub_util_find_partition_start_os (real_dev); ++ start = grub_disk_to_native_sector (disk, grub_util_find_partition_start_os (real_dev)); + /* We don't care about errors here. */ + grub_errno = GRUB_ERR_NONE; + +@@ -386,7 +387,7 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f + && strncmp (dev, "/dev/", 5) == 0) + { + if (sector >= part_start) +- is_partition = grub_hostdisk_linux_find_partition (dev, part_start); ++ is_partition = grub_hostdisk_linux_find_partition (disk, dev, part_start); + else + *max = part_start - sector; + } +diff --git a/include/grub/disk.h b/include/grub/disk.h +index 06210a7049..881addcc77 100644 +--- a/include/grub/disk.h ++++ b/include/grub/disk.h +@@ -208,6 +208,13 @@ grub_disk_from_native_sector (grub_disk_t disk, grub_disk_addr_t sector) + return sector << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); + } + ++/* Convert from GRUB native disk sized sector to disk sized sector. */ ++static inline grub_disk_addr_t ++grub_disk_to_native_sector (grub_disk_t disk, grub_disk_addr_t sector) ++{ ++ return sector >> (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); ++} ++ + /* This is called from the memory manager. */ + void grub_disk_cache_invalidate_all (void); + diff --git a/grub.patches b/grub.patches index 45eb5530..02e4c7b4 100644 --- a/grub.patches +++ b/grub.patches @@ -316,3 +316,4 @@ Patch0315: 0315-ieee1275-support-runtime-memory-claiming.patch Patch0316: 0316-ieee1275-implement-vec5-for-cas-negotiation.patch Patch0317: 0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch Patch0318: 0318-powerpc-Drop-Open-Hack-Ware.patch +Patch0319: 0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch diff --git a/grub2.spec b/grub2.spec index 697cbeeb..85c783d0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 86%{?dist} +Release: 87%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Feb 16 2023 Robbie Harwood - 2.06-87 +- Fix disk sector size computation + * Fri Feb 10 2023 Robbie Harwood - 2.06-86 - Override the linker and force nonexecutable stacks From 5c83f50804890b471354a13ac368b9f0b0f8cd2e Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 20 Feb 2023 16:49:18 +0000 Subject: [PATCH 185/294] Update mm fixes from upstream Signed-off-by: Robbie Harwood --- ...gion-size-to-take-management-overhea.patch | 145 ++++++++++++++++++ ...e-some-space-when-adding-new-regions.patch | 53 +++++++ ...complex-heap-growth-math-in-hot-path.patch | 72 +++++++++ grub.patches | 3 + grub2.spec | 5 +- 5 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 0320-mm-Adjust-new-region-size-to-take-management-overhea.patch create mode 100644 0321-mm-Preallocate-some-space-when-adding-new-regions.patch create mode 100644 0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch diff --git a/0320-mm-Adjust-new-region-size-to-take-management-overhea.patch b/0320-mm-Adjust-new-region-size-to-take-management-overhea.patch new file mode 100644 index 00000000..456f8f7d --- /dev/null +++ b/0320-mm-Adjust-new-region-size-to-take-management-overhea.patch @@ -0,0 +1,145 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Sun, 29 Jan 2023 19:49:31 +0800 +Subject: [PATCH] mm: Adjust new region size to take management overhead into + account + +When grub_memalign() encounters out-of-memory, it will try +grub_mm_add_region_fn() to request more memory from system firmware. +However, the size passed to it doesn't take region management overhead +into account. Adding a memory area of "size" bytes may result in a heap +region of less than "size" bytes really available. Thus, the new region +may not be adequate for current allocation request, confusing +out-of-memory handling code. + +This patch introduces GRUB_MM_MGMT_OVERHEAD to address the region +management overhead (e.g. metadata, padding). The value of this new +constant must be large enough to make sure grub_memalign(align, size) +always succeeds after a successful call to + grub_mm_init_region(addr, size + align + GRUB_MM_MGMT_OVERHEAD), +for any given addr and size (assuming no integer overflow). + +The size passed to grub_mm_add_region_fn() is now correctly adjusted, +thus if grub_mm_add_region_fn() succeeded, current allocation request +can always succeed. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 2282cbfe5aa1ff6c1bbcbdcd2003089ad7c03ba3) +--- + grub-core/kern/mm.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 61 insertions(+), 3 deletions(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index da1ac9427c..f29a3e5cbd 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -83,6 +83,46 @@ + + + ++/* ++ * GRUB_MM_MGMT_OVERHEAD is an upper bound of management overhead of ++ * each region, with any possible padding taken into account. ++ * ++ * The value must be large enough to make sure grub_memalign(align, size) ++ * always succeeds after a successful call to ++ * grub_mm_init_region(addr, size + align + GRUB_MM_MGMT_OVERHEAD), ++ * for any given addr, align and size (assuming no interger overflow). ++ * ++ * The worst case which has maximum overhead is shown in the figure below: ++ * ++ * +-- addr ++ * v |<- size + align ->| ++ * +---------+----------------+----------------+------------------+---------+ ++ * | padding | grub_mm_region | grub_mm_header | usable bytes | padding | ++ * +---------+----------------+----------------+------------------+---------+ ++ * |<- a ->|<- b ->|<- c ->|<- d ->|<- e ->| ++ * ^ ++ * b == sizeof (struct grub_mm_region) | / Assuming no other suitable ++ * c == sizeof (struct grub_mm_header) | | block is available, then: ++ * d == size + align +-| If align == 0, this will be ++ * | the pointer returned by next ++ * Assuming addr % GRUB_MM_ALIGN == 1, then: | grub_memalign(align, size). ++ * a == GRUB_MM_ALIGN - 1 | If align > 0, this chunk may ++ * | need to be split to fulfill ++ * Assuming d % GRUB_MM_ALIGN == 1, then: | alignment requirements, and ++ * e == GRUB_MM_ALIGN - 1 | the returned pointer may be ++ * \ inside these usable bytes. ++ * Therefore, the maximum overhead is: ++ * a + b + c + e == (GRUB_MM_ALIGN - 1) + sizeof (struct grub_mm_region) ++ * + sizeof (struct grub_mm_header) + (GRUB_MM_ALIGN - 1) ++ */ ++#define GRUB_MM_MGMT_OVERHEAD ((GRUB_MM_ALIGN - 1) \ ++ + sizeof (struct grub_mm_region) \ ++ + sizeof (struct grub_mm_header) \ ++ + (GRUB_MM_ALIGN - 1)) ++ ++/* The size passed to grub_mm_add_region_fn() is aligned up by this value. */ ++#define GRUB_MM_HEAP_GROW_ALIGN 4096 ++ + grub_mm_region_t grub_mm_base; + grub_mm_add_region_func_t grub_mm_add_region_fn; + +@@ -230,6 +270,11 @@ grub_mm_init_region (void *addr, grub_size_t size) + + grub_dprintf ("regions", "No: considering a new region at %p of size %" PRIxGRUB_SIZE "\n", + addr, size); ++ /* ++ * If you want to modify the code below, please also take a look at ++ * GRUB_MM_MGMT_OVERHEAD and make sure it is synchronized with the code. ++ */ ++ + /* Allocate a region from the head. */ + r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); + +@@ -410,6 +455,7 @@ grub_memalign (grub_size_t align, grub_size_t size) + { + grub_mm_region_t r; + grub_size_t n = ((size + GRUB_MM_ALIGN - 1) >> GRUB_MM_ALIGN_LOG2) + 1; ++ grub_size_t grow; + int count = 0; + + if (!grub_mm_base) +@@ -418,10 +464,22 @@ grub_memalign (grub_size_t align, grub_size_t size) + if (size > ~(grub_size_t) align) + goto fail; + ++ /* ++ * Pre-calculate the necessary size of heap growth (if applicable), ++ * with region management overhead taken into account. ++ */ ++ if (grub_add (size + align, GRUB_MM_MGMT_OVERHEAD, &grow)) ++ goto fail; ++ ++ /* Align up heap growth to make it friendly to CPU/MMU. */ ++ if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) ++ goto fail; ++ grow = ALIGN_UP (grow, GRUB_MM_HEAP_GROW_ALIGN); ++ + /* We currently assume at least a 32-bit grub_size_t, + so limiting allocations to - 1MiB + in name of sanity is beneficial. */ +- if ((size + align) > ~(grub_size_t) 0x100000) ++ if (grow > ~(grub_size_t) 0x100000) + goto fail; + + align = (align >> GRUB_MM_ALIGN_LOG2); +@@ -447,7 +505,7 @@ grub_memalign (grub_size_t align, grub_size_t size) + count++; + + if (grub_mm_add_region_fn != NULL && +- grub_mm_add_region_fn (size, GRUB_MM_ADD_REGION_CONSECUTIVE) == GRUB_ERR_NONE) ++ grub_mm_add_region_fn (grow, GRUB_MM_ADD_REGION_CONSECUTIVE) == GRUB_ERR_NONE) + goto again; + + /* fallthrough */ +@@ -462,7 +520,7 @@ grub_memalign (grub_size_t align, grub_size_t size) + * Try again even if this fails, in case it was able to partially + * satisfy the request + */ +- grub_mm_add_region_fn (size, GRUB_MM_ADD_REGION_NONE); ++ grub_mm_add_region_fn (grow, GRUB_MM_ADD_REGION_NONE); + goto again; + } + diff --git a/0321-mm-Preallocate-some-space-when-adding-new-regions.patch b/0321-mm-Preallocate-some-space-when-adding-new-regions.patch new file mode 100644 index 00000000..291092d2 --- /dev/null +++ b/0321-mm-Preallocate-some-space-when-adding-new-regions.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Sun, 29 Jan 2023 19:49:32 +0800 +Subject: [PATCH] mm: Preallocate some space when adding new regions + +When grub_memalign() encounters out-of-memory, it will try +grub_mm_add_region_fn() to request more memory from system firmware. +However, it doesn't preallocate memory space for future allocation +requests. In extreme cases, it requires one call to +grub_mm_add_region_fn() for each memory allocation request. This can +be very slow. + +This patch introduces GRUB_MM_HEAP_GROW_EXTRA, the minimal heap growth +granularity. The new region size is now set to the bigger one of its +original value and GRUB_MM_HEAP_GROW_EXTRA. Thus, it will result in some +memory space preallocated if current allocations request is small. + +The value of GRUB_MM_HEAP_GROW_EXTRA is set to 1MB. If this value is +smaller, the cost of small memory allocations will be higher. If this +value is larger, more memory will be wasted and it might cause +out-of-memory on machines with small amount of RAM. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 21869baec15239b6d99122b32b14a778af4c754f) +--- + grub-core/kern/mm.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index f29a3e5cbd..cc8a4703bc 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -123,6 +123,9 @@ + /* The size passed to grub_mm_add_region_fn() is aligned up by this value. */ + #define GRUB_MM_HEAP_GROW_ALIGN 4096 + ++/* Minimal heap growth granularity when existing heap space is exhausted. */ ++#define GRUB_MM_HEAP_GROW_EXTRA 0x100000 ++ + grub_mm_region_t grub_mm_base; + grub_mm_add_region_func_t grub_mm_add_region_fn; + +@@ -471,6 +474,9 @@ grub_memalign (grub_size_t align, grub_size_t size) + if (grub_add (size + align, GRUB_MM_MGMT_OVERHEAD, &grow)) + goto fail; + ++ /* Preallocate some extra space if heap growth is small. */ ++ grow = grub_max (grow, GRUB_MM_HEAP_GROW_EXTRA); ++ + /* Align up heap growth to make it friendly to CPU/MMU. */ + if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) + goto fail; diff --git a/0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch b/0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch new file mode 100644 index 00000000..fe6b3e16 --- /dev/null +++ b/0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Sun, 29 Jan 2023 19:49:33 +0800 +Subject: [PATCH] mm: Avoid complex heap growth math in hot path + +We do a lot of math about heap growth in hot path of grub_memalign(). +However, the result is only used if out of memory is encountered, which +is seldom. + +This patch moves these calculations away from hot path. These +calculations are now only done if out of memory is encountered. This +change can also help compiler to optimize integer overflow checks away. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper +(cherry picked from commit 65bc45963014773e2062ccc63ff34a089d2e352e) +--- + grub-core/kern/mm.c | 34 ++++++++++++++++++++-------------- + 1 file changed, 20 insertions(+), 14 deletions(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index cc8a4703bc..630d7be0e2 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -467,20 +467,7 @@ grub_memalign (grub_size_t align, grub_size_t size) + if (size > ~(grub_size_t) align) + goto fail; + +- /* +- * Pre-calculate the necessary size of heap growth (if applicable), +- * with region management overhead taken into account. +- */ +- if (grub_add (size + align, GRUB_MM_MGMT_OVERHEAD, &grow)) +- goto fail; +- +- /* Preallocate some extra space if heap growth is small. */ +- grow = grub_max (grow, GRUB_MM_HEAP_GROW_EXTRA); +- +- /* Align up heap growth to make it friendly to CPU/MMU. */ +- if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) +- goto fail; +- grow = ALIGN_UP (grow, GRUB_MM_HEAP_GROW_ALIGN); ++ grow = size + align; + + /* We currently assume at least a 32-bit grub_size_t, + so limiting allocations to - 1MiB +@@ -510,6 +497,25 @@ grub_memalign (grub_size_t align, grub_size_t size) + /* Request additional pages, contiguous */ + count++; + ++ /* ++ * Calculate the necessary size of heap growth (if applicable), ++ * with region management overhead taken into account. ++ */ ++ if (grub_add (grow, GRUB_MM_MGMT_OVERHEAD, &grow)) ++ goto fail; ++ ++ /* Preallocate some extra space if heap growth is small. */ ++ grow = grub_max (grow, GRUB_MM_HEAP_GROW_EXTRA); ++ ++ /* Align up heap growth to make it friendly to CPU/MMU. */ ++ if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) ++ goto fail; ++ grow = ALIGN_UP (grow, GRUB_MM_HEAP_GROW_ALIGN); ++ ++ /* Do the same sanity check again. */ ++ if (grow > ~(grub_size_t) 0x100000) ++ goto fail; ++ + if (grub_mm_add_region_fn != NULL && + grub_mm_add_region_fn (grow, GRUB_MM_ADD_REGION_CONSECUTIVE) == GRUB_ERR_NONE) + goto again; diff --git a/grub.patches b/grub.patches index 02e4c7b4..510ab16f 100644 --- a/grub.patches +++ b/grub.patches @@ -317,3 +317,6 @@ Patch0316: 0316-ieee1275-implement-vec5-for-cas-negotiation.patch Patch0317: 0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch Patch0318: 0318-powerpc-Drop-Open-Hack-Ware.patch Patch0319: 0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch +Patch0320: 0320-mm-Adjust-new-region-size-to-take-management-overhea.patch +Patch0321: 0321-mm-Preallocate-some-space-when-adding-new-regions.patch +Patch0322: 0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch diff --git a/grub2.spec b/grub2.spec index 85c783d0..a465a393 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 87%{?dist} +Release: 88%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Feb 20 2023 Robbie Harwood - 2.06-88 +- Update mm fixes from upstream + * Thu Feb 16 2023 Robbie Harwood - 2.06-87 - Fix disk sector size computation From 4db0050f31f6eaa30f72d074485b26b22f287373 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Tue, 21 Feb 2023 10:54:07 -0500 Subject: [PATCH 186/294] Update rpminspect configuration Signed-off-by: Robbie Harwood --- rpminspect.dson | 10 ++++++++++ rpminspect.yaml | 22 ---------------------- 2 files changed, 10 insertions(+), 22 deletions(-) create mode 100644 rpminspect.dson delete mode 100644 rpminspect.yaml diff --git a/rpminspect.dson b/rpminspect.dson new file mode 100644 index 00000000..8c98989c --- /dev/null +++ b/rpminspect.dson @@ -0,0 +1,10 @@ +such "inspections" is such "javabytecode" is "off", + "changedfiles" is "off". + "filesize" is "off"? + "patches" is "off"! + "upstream" is "off"? + "permissions" is "off". + "debuginfo" is "off" wow, + "elf" is such "ignore" is so + "/usr/lib/grub/i386-pc/kernel.*" and + "/usr/lib/grub/i386-pc/lnxboot.image" many wow wow diff --git a/rpminspect.yaml b/rpminspect.yaml deleted file mode 100644 index e05d04c4..00000000 --- a/rpminspect.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -inspections: - # Not a Java package - javabytecode: off - - # These just flag when things change "too much" - changedfiles: off - filesize: off - patches: off - upstream: off - - # https://bugzilla.redhat.com/show_bug.cgi?id=2007428 - elf: off - - # https://bugzilla.redhat.com/show_bug.cgi?id=1961250 - annocheck: off - - # https://bugzilla.redhat.com/show_bug.cgi?id=2007431 - permissions: off - - # https://bugzilla.redhat.com/show_bug.cgi?id=2007431 - addedfiles: off From 48cf39de05df77b18f86a307f3c821e4f41e472f Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 9 Mar 2023 16:48:40 +0000 Subject: [PATCH 187/294] emu: handle BLS /boot weirdness Signed-off-by: Robbie Harwood --- ...-work-around-proc-not-reporting-size.patch | 93 ++++++++++++++ ...blscfg-check-for-mounted-boot-in-emu.patch | 118 ++++++++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 0323-hostdisk-work-around-proc-not-reporting-size.patch create mode 100644 0324-blscfg-check-for-mounted-boot-in-emu.patch diff --git a/0323-hostdisk-work-around-proc-not-reporting-size.patch b/0323-hostdisk-work-around-proc-not-reporting-size.patch new file mode 100644 index 00000000..5f2fa08c --- /dev/null +++ b/0323-hostdisk-work-around-proc-not-reporting-size.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Thu, 9 Mar 2023 11:18:19 -0500 +Subject: [PATCH] hostdisk: work around /proc not reporting size + +fstat(2) of files in /proc will yield st_size == 0 regardless of file +contents. Use a negative value in grub_file_t's size to denote "ignore" +and plumb through. + +Signed-off-by: Robbie Harwood +--- + grub-core/kern/file.c | 28 ++++++++++++++++------------ + grub-core/lib/progress.c | 2 +- + grub-core/osdep/unix/hostdisk.c | 6 ++++++ + 3 files changed, 23 insertions(+), 13 deletions(-) + +diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c +index 868ce3b63e..4ea6d1ce95 100644 +--- a/grub-core/kern/file.c ++++ b/grub-core/kern/file.c +@@ -172,26 +172,30 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) + grub_disk_read_hook_t read_hook; + void *read_hook_data; + +- if (file->offset > file->size) +- { +- grub_error (GRUB_ERR_OUT_OF_RANGE, +- N_("attempt to read past the end of file")); +- return -1; +- } +- + if (len == 0) + return 0; + +- if (len > file->size - file->offset) +- len = file->size - file->offset; ++#ifdef GRUB_MACHINE_EMU ++ if (file->size >= 0) ++ { ++#endif ++ if (file->offset > file->size) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ N_("attempt to read past the end of file")); ++ return -1; ++ } ++ ++ if (len > file->size - file->offset) ++ len = file->size - file->offset; ++#ifdef GRUB_MACHINE_EMU ++ } ++#endif + + /* Prevent an overflow. */ + if ((grub_ssize_t) len < 0) + len >>= 1; + +- if (len == 0) +- return 0; +- + read_hook = file->read_hook; + read_hook_data = file->read_hook_data; + if (!file->read_hook) +diff --git a/grub-core/lib/progress.c b/grub-core/lib/progress.c +index 4b7cbbca6d..f3226b6898 100644 +--- a/grub-core/lib/progress.c ++++ b/grub-core/lib/progress.c +@@ -71,7 +71,7 @@ grub_file_progress_hook_real (grub_disk_addr_t sector __attribute__ ((unused)), + * 100ULL * 1000ULL, + now - file->last_progress_time, 0); + +- if (file->size == 0) ++ if (file->size <= 0) + percent = 100; + else + percent = grub_divmod64 (100 * file->progress_offset, +diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c +index 3a00d7451a..e5f4b4d5f9 100644 +--- a/grub-core/osdep/unix/hostdisk.c ++++ b/grub-core/osdep/unix/hostdisk.c +@@ -71,6 +71,12 @@ grub_util_get_fd_size (grub_util_fd_t fd, const char *name, unsigned *log_secsiz + if (log_secsize) + *log_secsize = 9; + ++#ifdef GRUB_MACHINE_EMU ++ /* /proc doesn't behave itself and gives 0 for file sizes to stat. */ ++ if (st.st_size == 0 && !grub_strncmp ("/proc", name, 5)) ++ return -1; ++#endif ++ + return st.st_size; + } + diff --git a/0324-blscfg-check-for-mounted-boot-in-emu.patch b/0324-blscfg-check-for-mounted-boot-in-emu.patch new file mode 100644 index 00000000..69ebe156 --- /dev/null +++ b/0324-blscfg-check-for-mounted-boot-in-emu.patch @@ -0,0 +1,118 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Tue, 7 Mar 2023 18:59:40 -0500 +Subject: [PATCH] blscfg: check for mounted /boot in emu + +Irritatingly, BLS defines paths relatives to the mountpoint of the +filesystem which contains its snippets, not / or any other fixed +location. So grub2-emu needs to know whether /boot is a separate +filesysem from / and conditionally prepend a path. + +Signed-off-by: Robbie Harwood +--- + grub-core/commands/blscfg.c | 54 ++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 49 insertions(+), 5 deletions(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index dbd0899acf..6e398fc175 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -40,8 +40,9 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #include "loadenv.h" + + #define GRUB_BLS_CONFIG_PATH "/loader/entries/" ++ + #ifdef GRUB_MACHINE_EMU +-#define GRUB_BOOT_DEVICE "" ++#define GRUB_BOOT_DEVICE "/boot" + #else + #define GRUB_BOOT_DEVICE "($root)" + #endif +@@ -54,8 +55,50 @@ struct keyval + + static struct bls_entry *entries = NULL; + ++/* Cache probing in frob_boot_device(). Used for linux entry also. ++ * Always true in non-emu, meaning to prefix things with GRUB_BOOT_DEVICE. */ ++static int separate_boot = -1; ++ + #define FOR_BLS_ENTRIES(var) FOR_LIST_ELEMENTS (var, entries) + ++/* BLS appears to make paths relative to the filesystem that snippets are ++ * on, not /. Attempt to cope. */ ++static char *frob_boot_device(char *tmp) ++{ ++#ifdef GRUB_MACHINE_EMU ++ grub_file_t f; ++ char *line = NULL; ++ ++ if (separate_boot != -1) ++ goto probed; ++ ++ separate_boot = 0; ++ ++ f = grub_file_open ("/proc/mounts", GRUB_FILE_TYPE_CONFIG); ++ if (f == NULL) ++ goto probed; ++ ++ while ((line = grub_file_getline (f))) ++ { ++ if (grub_strstr (line, " " GRUB_BOOT_DEVICE " ")) ++ { ++ separate_boot = 1; ++ grub_free (line); ++ break; ++ } ++ ++ grub_free(line); ++ } ++ ++ grub_file_close (f); ++ probed: ++ if (!separate_boot) ++ return grub_stpcpy (tmp, " "); ++#endif ++ ++ return grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); ++} ++ + static int bls_add_keyval(struct bls_entry *entry, char *key, char *val) + { + char *k, *v; +@@ -842,7 +885,7 @@ static void create_entry (struct bls_entry *entry) + for (i = 0; early_initrds != NULL && early_initrds[i] != NULL; i++) + { + grub_dprintf ("blscfg", "adding early initrd %s\n", early_initrds[i]); +- tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); ++ tmp = frob_boot_device (tmp); + tmp = grub_stpcpy (tmp, initrd_prefix); + tmp = grub_stpcpy (tmp, early_initrds[i]); + grub_free(early_initrds[i]); +@@ -851,7 +894,7 @@ static void create_entry (struct bls_entry *entry) + for (i = 0; initrds != NULL && initrds[i] != NULL; i++) + { + grub_dprintf ("blscfg", "adding initrd %s\n", initrds[i]); +- tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); ++ tmp = frob_boot_device (tmp); + tmp = grub_stpcpy (tmp, initrds[i]); + } + tmp = grub_stpcpy (tmp, "\n"); +@@ -888,7 +931,7 @@ static void create_entry (struct bls_entry *entry) + } + char *tmp = dt; + tmp = grub_stpcpy (dt, "devicetree"); +- tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE); ++ tmp = frob_boot_device (tmp); + if (add_dt_prefix) + tmp = grub_stpcpy (tmp, prefix); + tmp = grub_stpcpy (tmp, devicetree); +@@ -907,7 +950,8 @@ static void create_entry (struct bls_entry *entry) + "linux %s%s%s%s\n" + "%s%s", + savedefault ? "savedefault\n" : "", +- GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", ++ separate_boot ? GRUB_BOOT_DEVICE : "", ++ clinux, options ? " " : "", options ? options : "", + initrd ? initrd : "", dt ? dt : ""); + + grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry); diff --git a/grub.patches b/grub.patches index 510ab16f..a4fd33fd 100644 --- a/grub.patches +++ b/grub.patches @@ -320,3 +320,5 @@ Patch0319: 0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch Patch0320: 0320-mm-Adjust-new-region-size-to-take-management-overhea.patch Patch0321: 0321-mm-Preallocate-some-space-when-adding-new-regions.patch Patch0322: 0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch +Patch0323: 0323-hostdisk-work-around-proc-not-reporting-size.patch +Patch0324: 0324-blscfg-check-for-mounted-boot-in-emu.patch diff --git a/grub2.spec b/grub2.spec index a465a393..3705490e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 88%{?dist} +Release: 89%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Mar 09 2023 Robbie Harwood - 2.06-89 +- emu: handle BLS /boot weirdness + * Mon Feb 20 2023 Robbie Harwood - 2.06-88 - Update mm fixes from upstream From 6a9365c88dd81cc541d5a940229693ba50be051b Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 22 Mar 2023 18:39:56 +0000 Subject: [PATCH 188/294] emu: work around systemctl bad behavior Signed-off-by: Robbie Harwood --- ...ork-around-systemctl-kexec-returning.patch | 41 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 0325-emu-linux-work-around-systemctl-kexec-returning.patch diff --git a/0325-emu-linux-work-around-systemctl-kexec-returning.patch b/0325-emu-linux-work-around-systemctl-kexec-returning.patch new file mode 100644 index 00000000..eaef5ff1 --- /dev/null +++ b/0325-emu-linux-work-around-systemctl-kexec-returning.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 22 Mar 2023 14:19:43 -0400 +Subject: [PATCH] emu/linux: work around systemctl kexec returning + +Per systemctl(1), it "is asynchronous; it will return after the reboot +operation is enqueued, without waiting for it to complete". This +differs from kexec(8), which calls reboot(2) and therefore does not +return. + +When not using fallback, this results in the confusing-but-harmless: + + error trying to perform 'systemctl kexec': 0 + Aborted. Press any key to exit. + +on screen for a bit, followed by successful kexec. + +To reduce the liklihood of hitting this case, add a delay on succesful +return. Ultimately, the systemd interface is racy: we can't avoid it +entirely unless we never fallback on success. + +Signed-off-by: Robbie Harwood +--- + grub-core/loader/emu/linux.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c +index 0cf378a376..7de3f7f861 100644 +--- a/grub-core/loader/emu/linux.c ++++ b/grub-core/loader/emu/linux.c +@@ -74,6 +74,10 @@ grub_linux_boot (void) + (kexecute==1) ? "do-or-die" : "just-in-case"); + rc = grub_util_exec (systemctl); + ++ /* `systemctl kexec` is "asynchronous" and will return even on success. */ ++ if (rc == 0) ++ grub_sleep (10); ++ + if (kexecute == 1) + grub_fatal (N_("error trying to perform 'systemctl kexec': %d"), rc); + diff --git a/grub.patches b/grub.patches index a4fd33fd..b625760f 100644 --- a/grub.patches +++ b/grub.patches @@ -322,3 +322,4 @@ Patch0321: 0321-mm-Preallocate-some-space-when-adding-new-regions.patch Patch0322: 0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch Patch0323: 0323-hostdisk-work-around-proc-not-reporting-size.patch Patch0324: 0324-blscfg-check-for-mounted-boot-in-emu.patch +Patch0325: 0325-emu-linux-work-around-systemctl-kexec-returning.patch diff --git a/grub2.spec b/grub2.spec index 3705490e..2dc55b45 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 89%{?dist} +Release: 90%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Mar 22 2023 Robbie Harwood - 2.06-90 +- emu: work around systemctl bad behavior + * Thu Mar 09 2023 Robbie Harwood - 2.06-89 - emu: handle BLS /boot weirdness From ecd22580aee36703e3b902652911f35a81bf3cca Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 30 Mar 2023 12:31:37 +0000 Subject: [PATCH 189/294] ppc64le: more cas vec5 shenanigans Signed-off-by: Robbie Harwood --- ...it-Convert-plain-numbers-to-constant.patch | 48 +++++++ ...ee1275-init-Extended-support-in-Vec5.patch | 127 ++++++++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch create mode 100644 0327-kern-ieee1275-init-Extended-support-in-Vec5.patch diff --git a/0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch b/0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch new file mode 100644 index 00000000..ca82e33c --- /dev/null +++ b/0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Avnish Chouhan +Date: Mon, 27 Mar 2023 12:25:39 +0530 +Subject: [PATCH] kern/ieee1275/init: Convert plain numbers to constants in + Vec5 + +This patch converts the plain numbers used in Vec5 properties to constants. + +1. LPAR: Client program supports logical partitioning and + associated hcall()s. +2. SPLPAR: Client program supports the Shared + Processor LPAR Option. +3. CMO: Enables the Cooperative Memory Over-commitment Option. +4. MAX_CPU: Defines maximum number of CPUs supported. + +Signed-off-by: Avnish Chouhan +Reviewed-by: Daniel Kiper +(cherry picked from commit 8406cfe4774eb2da3db4bf0bc2b2ff6592ecbdaf) +--- + grub-core/kern/ieee1275/init.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 72d4fed312..5d79580341 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -72,6 +72,12 @@ extern char _end[]; + grub_addr_t grub_ieee1275_original_stack; + #endif + ++#define LPAR 0x80 ++#define SPLPAR 0x40 ++#define BYTE2 (LPAR | SPLPAR) ++#define CMO 0x80 ++#define MAX_CPU 256 ++ + void + grub_exit (int rc __attribute__((unused))) + { +@@ -575,7 +581,7 @@ grub_ieee1275_ibm_cas (void) + .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ + .vec5_size = 1 + sizeof (struct option_vector5) - 2, + .vec5 = { +- 0, 192, 0, 128, 0, 0, 0, 0, 256 ++ 0, BYTE2, 0, CMO, 0, 0, 0, 0, MAX_CPU + } + }; + diff --git a/0327-kern-ieee1275-init-Extended-support-in-Vec5.patch b/0327-kern-ieee1275-init-Extended-support-in-Vec5.patch new file mode 100644 index 00000000..b8b481f9 --- /dev/null +++ b/0327-kern-ieee1275-init-Extended-support-in-Vec5.patch @@ -0,0 +1,127 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Avnish Chouhan +Date: Mon, 27 Mar 2023 12:25:40 +0530 +Subject: [PATCH] kern/ieee1275/init: Extended support in Vec5 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch enables multiple options in Vec5 which are required and +solves the boot issues seen on some machines which are looking for +these specific options. + +1. LPAR: Client program supports logical partitioning and + associated hcall()s. +2. SPLPAR: Client program supports the Shared + Processor LPAR Option. +3. DYN_RCON_MEM: Client program supports the + “ibm,dynamic-reconfiguration-memory” property and it may be + presented in the device tree. +4. LARGE_PAGES: Client supports pages larger than 4 KB. +5. DONATE_DCPU_CLS: Client supports donating dedicated processor cycles. +6. PCI_EXP: Client supports PCI Express implementations + utilizing Message Signaled Interrupts (MSIs). + +7. CMOC: Enables the Cooperative Memory Over-commitment Option. +8. EXT_CMO: Enables the Extended Cooperative Memory Over-commit Option. + +9. ASSOC_REF: Enables “ibm,associativity” and + “ibm,associativity-reference-points” properties. +10. AFFINITY: Enables Platform Resource Reassignment Notification. +11. NUMA: Supports NUMA Distance Lookup Table Option. + +12. HOTPLUG_INTRPT: Supports Hotplug Interrupts. +13. HPT_RESIZE: Enable Hash Page Table Resize Option. + +14. MAX_CPU: Defines maximum number of CPUs supported. + +15. PFO_HWRNG: Supports Random Number Generator. +16. PFO_HW_COMP: Supports Compression Engine. +17. PFO_ENCRYPT: Supports Encryption Engine. + +18. SUB_PROCESSORS: Supports Sub-Processors. + +19. DY_MEM_V2: Client program supports the “ibm,dynamic-memory-v2” property in the + “ibm,dynamic-reconfiguration-memory” node and it may be presented in the device tree. +20. DRC_INFO: Client program supports the “ibm,drc-info” property definition and it may be + presented in the device tree. + +Signed-off-by: Avnish Chouhan +Reviewed-by: Daniel Kiper +(cherry picked from commit 98d0df0351fbff7a4acc64c7594d538889a43e2d) +--- + grub-core/kern/ieee1275/init.c | 47 ++++++++++++++++++++++++++++++++++++------ + 1 file changed, 41 insertions(+), 6 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 5d79580341..3d4ad9d1f1 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -72,11 +72,41 @@ extern char _end[]; + grub_addr_t grub_ieee1275_original_stack; + #endif + +-#define LPAR 0x80 +-#define SPLPAR 0x40 +-#define BYTE2 (LPAR | SPLPAR) +-#define CMO 0x80 +-#define MAX_CPU 256 ++/* Options vector5 properties. */ ++ ++#define LPAR 0x80 ++#define SPLPAR 0x40 ++#define DYN_RCON_MEM 0x20 ++#define LARGE_PAGES 0x10 ++#define DONATE_DCPU_CLS 0x02 ++#define PCI_EXP 0x01 ++#define BYTE2 (LPAR | SPLPAR | DYN_RCON_MEM | LARGE_PAGES | DONATE_DCPU_CLS | PCI_EXP) ++ ++#define CMOC 0x80 ++#define EXT_CMO 0x40 ++#define CMO (CMOC | EXT_CMO) ++ ++#define ASSOC_REF 0x80 ++#define AFFINITY 0x40 ++#define NUMA 0x20 ++#define ASSOCIATIVITY (ASSOC_REF | AFFINITY | NUMA) ++ ++#define HOTPLUG_INTRPT 0x04 ++#define HPT_RESIZE 0x01 ++#define BIN_OPTS (HOTPLUG_INTRPT | HPT_RESIZE) ++ ++#define MAX_CPU 256 ++ ++#define PFO_HWRNG 0x80000000 ++#define PFO_HW_COMP 0x40000000 ++#define PFO_ENCRYPT 0x20000000 ++#define PLATFORM_FACILITIES (PFO_HWRNG | PFO_HW_COMP | PFO_ENCRYPT) ++ ++#define SUB_PROCESSORS 1 ++ ++#define DY_MEM_V2 0x80 ++#define DRC_INFO 0x40 ++#define BYTE22 (DY_MEM_V2 | DRC_INFO) + + void + grub_exit (int rc __attribute__((unused))) +@@ -519,6 +549,11 @@ struct option_vector5 + grub_uint8_t micro_checkpoint; + grub_uint8_t reserved0; + grub_uint32_t max_cpus; ++ grub_uint16_t base_papr; ++ grub_uint16_t mem_reference; ++ grub_uint32_t platform_facilities; ++ grub_uint8_t sub_processors; ++ grub_uint8_t byte22; + } GRUB_PACKED; + + struct pvr_entry +@@ -581,7 +616,7 @@ grub_ieee1275_ibm_cas (void) + .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ + .vec5_size = 1 + sizeof (struct option_vector5) - 2, + .vec5 = { +- 0, BYTE2, 0, CMO, 0, 0, 0, 0, MAX_CPU ++ 0, BYTE2, 0, CMO, ASSOCIATIVITY, BIN_OPTS, 0, 0, MAX_CPU, 0, 0, PLATFORM_FACILITIES, SUB_PROCESSORS, BYTE22 + } + }; + diff --git a/grub.patches b/grub.patches index b625760f..0268a422 100644 --- a/grub.patches +++ b/grub.patches @@ -323,3 +323,5 @@ Patch0322: 0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch Patch0323: 0323-hostdisk-work-around-proc-not-reporting-size.patch Patch0324: 0324-blscfg-check-for-mounted-boot-in-emu.patch Patch0325: 0325-emu-linux-work-around-systemctl-kexec-returning.patch +Patch0326: 0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch +Patch0327: 0327-kern-ieee1275-init-Extended-support-in-Vec5.patch diff --git a/grub2.spec b/grub2.spec index 2dc55b45..e84d7f1d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 90%{?dist} +Release: 91%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Mar 30 2023 Robbie Harwood - 2.06-91 +- ppc64le: more cas vec5 shenanigans + * Wed Mar 22 2023 Robbie Harwood - 2.06-90 - emu: work around systemctl bad behavior From dc0bc065607e95dc5b2d13d5f3319364f3d8202d Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 30 Mar 2023 12:47:20 +0000 Subject: [PATCH 190/294] Disable the tpm verifier if the TPM device is not present Signed-off-by: Robbie Harwood --- ...tpm-verifier-if-the-TPM-device-is-no.patch | 156 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch diff --git a/0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch b/0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch new file mode 100644 index 00000000..9c2522c8 --- /dev/null +++ b/0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch @@ -0,0 +1,156 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Wed, 22 Mar 2023 12:25:43 +0800 +Subject: [PATCH] tpm: Disable the tpm verifier if the TPM device is not + present + +When the tpm module is loaded, the verifier reads entire file into +memory, measures it and uses verified content as a backing buffer for +file accesses. However, this process may result in high memory +utilization for file operations, sometimes causing a system to run out +of memory which may finally lead to boot failure. To address this issue, +among others, the commit 887f98f0d (mm: Allow dynamically requesting +additional memory regions) have optimized memory management by +dynamically allocating heap space to maximize memory usage and reduce +threat of memory exhaustion. But in some cases problems may still arise, +e.g., when large ISO images are mounted using loopback or when dealing +with embedded systems with limited memory resources. + +Unfortunately current implementation of the tpm module doesn't allow +elimination of the back buffer once it is loaded. Even if the TPM device +is not present or it has been explicitly disabled. This may unnecessary +allocate a lot memory. To solve this issue, a patch has been developed +to detect the TPM status at module load and skip verifier registration +if the device is missing or deactivated. This prevents allocation of +memory for the back buffer, avoiding wasting memory when no real measure +boot functionality is performed. Disabling the TPM device in the system +can reduce memory usage in the GRUB. It is useful in scenarios where +high memory utilization is a concern and measurements of loaded +artifacts are not necessary. + +Signed-off-by: Michael Chang +Signed-off-by: Stefan Berger +Reviewed-by: Daniel Kiper +(cherry picked from commit 30708dfe3bebd62a5487437554da8a24253f519f) +--- + grub-core/commands/efi/tpm.c | 37 +++++++++++++++++++++++++++++++++++ + grub-core/commands/ieee1275/ibmvtpm.c | 20 +++++++++---------- + grub-core/commands/tpm.c | 10 ++++++++++ + include/grub/tpm.h | 1 + + 4 files changed, 58 insertions(+), 10 deletions(-) + +diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c +index ae09c1bf8b..e1f343fea3 100644 +--- a/grub-core/commands/efi/tpm.c ++++ b/grub-core/commands/efi/tpm.c +@@ -287,3 +287,40 @@ grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, + else + return grub_tpm2_log_event (tpm_handle, buf, size, pcr, description); + } ++ ++int ++grub_tpm_present (void) ++{ ++ grub_efi_handle_t tpm_handle; ++ grub_efi_uint8_t protocol_version; ++ ++ if (!grub_tpm_handle_find (&tpm_handle, &protocol_version)) ++ return 0; ++ ++ if (protocol_version == 1) ++ { ++ grub_efi_tpm_protocol_t *tpm; ++ ++ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, ++ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ if (!tpm) ++ { ++ grub_dprintf ("tpm", "Cannot open TPM protocol\n"); ++ return 0; ++ } ++ return grub_tpm1_present (tpm); ++ } ++ else ++ { ++ grub_efi_tpm2_protocol_t *tpm; ++ ++ tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid, ++ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ if (!tpm) ++ { ++ grub_dprintf ("tpm", "Cannot open TPM protocol\n"); ++ return 0; ++ } ++ return grub_tpm2_present (tpm); ++ } ++} +diff --git a/grub-core/commands/ieee1275/ibmvtpm.c b/grub-core/commands/ieee1275/ibmvtpm.c +index 239942d27e..a6fee5c516 100644 +--- a/grub-core/commands/ieee1275/ibmvtpm.c ++++ b/grub-core/commands/ieee1275/ibmvtpm.c +@@ -135,16 +135,6 @@ grub_err_t + grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, + const char *description) + { +- /* +- * Call tpm_init() 'late' rather than from GRUB_MOD_INIT() so that device nodes +- * can be found. +- */ +- grub_err_t err = tpm_init (); +- +- /* Absence of a TPM isn't a failure. */ +- if (err != GRUB_ERR_NONE) +- return GRUB_ERR_NONE; +- + grub_dprintf ("tpm", "log_event, pcr = %d, size = 0x%" PRIxGRUB_SIZE ", %s\n", + pcr, size, description); + +@@ -153,3 +143,13 @@ grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, + + return GRUB_ERR_NONE; + } ++ ++int ++grub_tpm_present (void) ++{ ++ /* ++ * Call tpm_init() "late" rather than from GRUB_MOD_INIT() so that device nodes ++ * can be found. ++ */ ++ return tpm_init() == GRUB_ERR_NONE; ++} +diff --git a/grub-core/commands/tpm.c b/grub-core/commands/tpm.c +index e287d042e6..5839053d3d 100644 +--- a/grub-core/commands/tpm.c ++++ b/grub-core/commands/tpm.c +@@ -86,10 +86,20 @@ struct grub_file_verifier grub_tpm_verifier = { + + GRUB_MOD_INIT (tpm) + { ++ /* ++ * Even though this now calls ibmvtpm's grub_tpm_present() from GRUB_MOD_INIT(), ++ * it does seem to call it late enough in the initialization sequence so ++ * that whatever discovered "device nodes" before this GRUB_MOD_INIT() is ++ * called, enables the ibmvtpm driver to see the device nodes. ++ */ ++ if (!grub_tpm_present()) ++ return; + grub_verifier_register (&grub_tpm_verifier); + } + + GRUB_MOD_FINI (tpm) + { ++ if (!grub_tpm_present()) ++ return; + grub_verifier_unregister (&grub_tpm_verifier); + } +diff --git a/include/grub/tpm.h b/include/grub/tpm.h +index 5c285cbc52..c19fcbd0a6 100644 +--- a/include/grub/tpm.h ++++ b/include/grub/tpm.h +@@ -36,4 +36,5 @@ + + grub_err_t grub_tpm_measure (unsigned char *buf, grub_size_t size, + grub_uint8_t pcr, const char *description); ++int grub_tpm_present (void); + #endif diff --git a/grub.patches b/grub.patches index 0268a422..10c552f8 100644 --- a/grub.patches +++ b/grub.patches @@ -325,3 +325,4 @@ Patch0324: 0324-blscfg-check-for-mounted-boot-in-emu.patch Patch0325: 0325-emu-linux-work-around-systemctl-kexec-returning.patch Patch0326: 0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch Patch0327: 0327-kern-ieee1275-init-Extended-support-in-Vec5.patch +Patch0328: 0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch diff --git a/grub2.spec b/grub2.spec index e84d7f1d..811756ba 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 91%{?dist} +Release: 92%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Mar 30 2023 Robbie Harwood - 2.06-92 +- Disable the tpm verifier if the TPM device is not present + * Thu Mar 30 2023 Robbie Harwood - 2.06-91 - ppc64le: more cas vec5 shenanigans From 9d4d1e919cd197b8d6a2d81d5152fa06eb291d49 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Mon, 13 Mar 2023 11:55:04 -0500 Subject: [PATCH 191/294] Provide a legacy PXE boot core.0 This enables PXE booting with grub2 rather than syslinux. Signed-off-by: Chris Adams [rharwood: bump spec, fix commit message] Signed-off-by: Robbie Harwood --- grub.macros | 10 ++++++++++ grub2.spec | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index e88a2893..ce50aebd 100644 --- a/grub.macros +++ b/grub.macros @@ -623,6 +623,16 @@ if [ %{3} -eq 0 ]; then \ ${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\ ${RPM_BUILD_ROOT}/boot/grub2/grubenv create \ fi \ +mkdir pxe \ +./grub-mknetdir \\\ + --directory ./grub-core \\\ + --fonts="" \\\ + --locales="" \\\ + --themes="" \\\ + --modules="configfile gzio linux reboot test" \\\ + --net-directory=pxe \\\ + --subdir . \ +mv pxe/*/core.0 $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/ \ %{expand:%%do_install_protected_file grub2-%{legacy_package_arch}} \ cd .. \ %{nil} diff --git a/grub2.spec b/grub2.spec index 811756ba..7a3bad66 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 92%{?dist} +Release: 93%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Mar 31 2023 Robbie Harwood - 2.06-93 +- Add legacy pxe core.0 (cmadams) + * Thu Mar 30 2023 Robbie Harwood - 2.06-92 - Disable the tpm verifier if the TPM device is not present From ab62564e2f6f3bf897f65547b6e9155104c283b7 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 31 Mar 2023 17:47:53 -0400 Subject: [PATCH 192/294] tmp Signed-off-by: Robbie Harwood --- grub.macros | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grub.macros b/grub.macros index ce50aebd..959b9729 100644 --- a/grub.macros +++ b/grub.macros @@ -623,6 +623,7 @@ if [ %{3} -eq 0 ]; then \ ${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\ ${RPM_BUILD_ROOT}/boot/grub2/grubenv create \ fi \ +%{expand:%ifnarch ppc64le \ mkdir pxe \ ./grub-mknetdir \\\ --directory ./grub-core \\\ @@ -633,6 +634,7 @@ mkdir pxe \ --net-directory=pxe \\\ --subdir . \ mv pxe/*/core.0 $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/ \ +%endif} \ %{expand:%%do_install_protected_file grub2-%{legacy_package_arch}} \ cd .. \ %{nil} From e6b8f35a698e3206c0945a19be4090edfc584c6d Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mon, 10 Apr 2023 16:44:09 +0000 Subject: [PATCH 193/294] Fix aa64 page fault with EFI_MEMORY_ATTRIBUTE_PROTOCOL Signed-off-by: Robbie Harwood --- ...b_dl_set_mem_attrs-fix-format-string.patch | 38 +++++ ...attrs-add-self-check-for-the-tramp-G.patch | 140 ++++++++++++++++++ ...ments-page-align-the-tramp-GOT-areas.patch | 70 +++++++++ grub.patches | 3 + grub2.spec | 5 +- 5 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 0329-grub_dl_set_mem_attrs-fix-format-string.patch create mode 100644 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch create mode 100644 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch diff --git a/0329-grub_dl_set_mem_attrs-fix-format-string.patch b/0329-grub_dl_set_mem_attrs-fix-format-string.patch new file mode 100644 index 00000000..ee505914 --- /dev/null +++ b/0329-grub_dl_set_mem_attrs-fix-format-string.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Apr 2023 14:54:35 +0200 +Subject: [PATCH] grub_dl_set_mem_attrs(): fix format string + +The grub_dprintf() call for printing the message + + updating attributes for GOT and trampolines + +passes the argument "mod->name", but the format string doesn't accept that +argument. + +Print the module name too. + +Example output: + +> kern/dl.c:736: updating attributes for GOT and trampolines ("video_fb") + +Fixes: ad1b904d325b (nx: set page permissions for loaded modules.) +Signed-off-by: Laszlo Ersek +--- + grub-core/kern/dl.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index ab9101a5ad..a97f4a8b13 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -733,7 +733,8 @@ grub_dl_set_mem_attrs (grub_dl_t mod, void *ehdr) + { + tgsz = ALIGN_UP(tgsz, arch_addralign); + +- grub_dprintf ("modules", "updating attributes for GOT and trampolines\n", ++ grub_dprintf ("modules", ++ "updating attributes for GOT and trampolines (\"%s\")\n", + mod->name); + grub_update_mem_attrs (tgaddr, tgsz, GRUB_MEM_ATTR_R|GRUB_MEM_ATTR_X, + GRUB_MEM_ATTR_W); diff --git a/0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch b/0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch new file mode 100644 index 00000000..b95e6783 --- /dev/null +++ b/0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch @@ -0,0 +1,140 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Apr 2023 16:21:54 +0200 +Subject: [PATCH] grub_dl_set_mem_attrs(): add self-check for the tramp/GOT + sizes + +On aarch64 UEFI, we currently have a crasher: + + grub_dl_load_core() + grub_dl_load_core_noinit() + + /* independent allocation: must remain writable */ + mod = grub_zalloc(); + + /* allocates module image with incorrect tail alignment */ + grub_dl_load_segments() + + /* write-protecting the module image makes "mod" read-only! */ + grub_dl_set_mem_attrs() + grub_update_mem_attrs() + + grub_dl_init() + /* page fault, crash */ + mod->next = ...; + +- Commit 887f1d8fa976 ("modules: load module sections at page-aligned + addresses", 2023-02-08) forgot to page-align the allocation of the + trampolines and GOT areas of grub2 modules, in grub_dl_load_segments(). + +- Commit ad1b904d325b ("nx: set page permissions for loaded modules.", + 2023-02-08) calculated a common bounding box for the trampolines and GOT + areas in grub_dl_set_mem_attrs(), rounded the box size up to a whole + multiple of EFI page size ("arch_addralign"), and write-protected the + resultant page range. + +Consequently, grub_dl_load_segments() places the module image in memory +such that its tail -- the end of the trampolines and GOT areas -- lands at +the head of a page whose tail in turn contains independent memory +allocations, such as "mod". grub_dl_set_mem_attrs() will then unwittingly +write-protect these other allocations too. + +But "mod" must remain writable: we assign "mod->next" in grub_dl_init() +subsequently. Currently we crash there with a page fault / permission +fault. + +(The crash is not trivial to hit: the tramp/GOT areas are irrelevant on +x86_64, plus the page protection depends on the UEFI platform firmware +providing EFI_MEMORY_ATTRIBUTE_PROTOCOL. In practice, the crash is +restricted to aarch64 edk2 (ArmVirtQemu) builds containing commit +1c4dfadb4611, "ArmPkg/CpuDxe: Implement EFI memory attributes protocol", +2023-03-16.) + +Example log before the patch: + +> kern/dl.c:736: updating attributes for GOT and trampolines ("video_fb") +> kern/efi/mm.c:927: set +rx -w on 0x13b88b000-0x13b88bfff before:rwx after:r-x +> kern/dl.c:744: done updating module memory attributes for "video_fb" +> kern/dl.c:639: flushing 0xe4f0 bytes at 0x13b87d000 +> kern/arm64/cache.c:42: D$ line size: 64 +> kern/arm64/cache.c:43: I$ line size: 64 +> kern/dl.c:839: module name: video_fb +> kern/dl.c:840: init function: 0x0 +> kern/dl.c:865: Initing module video_fb +> +> Synchronous Exception at 0x000000013B8A76EC +> PC 0x00013B8A76EC +> +> X0 0x000000013B88B960 X1 0x0000000000000000 X2 0x000000013F93587C X3 0x0000000000000075 +> +> SP 0x00000000470745C0 ELR 0x000000013B8A76EC SPSR 0x60000205 FPSR 0x00000000 +> ESR 0x9600004F FAR 0x000000013B88B9D0 +> +> ESR : EC 0x25 IL 0x1 ISS 0x0000004F +> +> Data abort: Permission fault, third level + +Note the following: + +- The whole 4K page at 0x1_3B88_B000 is write-protected. + +- The "video_fb" module actually lives at [0x1_3B87_D000, 0x1_3B88_B4F0) + -- left-inclusive, right-exclusive --; that is, in the last page (at + 0x1_3B88_B000), it only occupies the first 0x4F0 bytes. + +- The instruction at 0x1_3B8A_76EC faults. Not shown here, but it is a + store instruction, which writes to the field at offset 0x70 of the + structure pointed-to by the X0 register. This is the "mod->next" + assignment from grub_dl_init(). + +- The faulting address is therefore (X0 + 0x70), i.e., 0x1_3B88_B9D0. This + is indeed the value held in the FAR register. + +- The faulting address 0x1_3B88_B9D0 falls in the above-noted page (at + 0x1_3B88_B000), namely at offset 0x9D0. This is *beyond* the first 0x4F0 + bytes that the very tail of the "video_fb" module occupies at the front + of that page. + +For now, add a self-check that reports this bug (and prevents the crash by +skipping the write protection). + +Example log after the patch: + +> kern/dl.c:742:BUG: trying to protect pages outside of module allocation +> ("video_fb"): module base 0x13b87d000, size 0xe4f0; tramp/GOT base +> 0x13b88b000, size 0x1000 + +Signed-off-by: Laszlo Ersek +--- + grub-core/kern/dl.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index a97f4a8b13..3b66fa410e 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -682,7 +682,7 @@ grub_dl_set_mem_attrs (grub_dl_t mod, void *ehdr) + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) + grub_size_t arch_addralign = grub_arch_dl_min_alignment (); + grub_addr_t tgaddr; +- grub_uint64_t tgsz; ++ grub_size_t tgsz; + #endif + + grub_dprintf ("modules", "updating memory attributes for \"%s\"\n", +@@ -736,6 +736,15 @@ grub_dl_set_mem_attrs (grub_dl_t mod, void *ehdr) + grub_dprintf ("modules", + "updating attributes for GOT and trampolines (\"%s\")\n", + mod->name); ++ if (tgaddr < (grub_addr_t)mod->base || ++ tgsz > (grub_addr_t)-1 - tgaddr || ++ tgaddr + tgsz > (grub_addr_t)mod->base + mod->sz) ++ return grub_error (GRUB_ERR_BUG, ++ "BUG: trying to protect pages outside of module " ++ "allocation (\"%s\"): module base %p, size 0x%" ++ PRIxGRUB_SIZE "; tramp/GOT base 0x%" PRIxGRUB_ADDR ++ ", size 0x%" PRIxGRUB_SIZE, ++ mod->name, mod->base, mod->sz, tgaddr, tgsz); + grub_update_mem_attrs (tgaddr, tgsz, GRUB_MEM_ATTR_R|GRUB_MEM_ATTR_X, + GRUB_MEM_ATTR_W); + } diff --git a/0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch b/0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch new file mode 100644 index 00000000..f29609d0 --- /dev/null +++ b/0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 7 Apr 2023 16:56:09 +0200 +Subject: [PATCH] grub_dl_load_segments(): page-align the tramp/GOT areas too + +The tramp/GOT write-protection in grub_dl_set_mem_attrs() requires that +the tramp/GOT areas of the module image *not* share a page with any other +memory allocations. Page-align the tramp/GOT areas, while satisfying their +intrinsic alignment requirements too. + +Fixes: 887f1d8fa976 (modules: load module sections at page-aligned addresses) +Fixes: ad1b904d325b (nx: set page permissions for loaded modules.) +Signed-off-by: Laszlo Ersek +--- + grub-core/kern/dl.c | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index 3b66fa410e..f3cdb9e0ba 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -280,7 +280,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + grub_size_t tsize = 0, talign = 1, arch_addralign = 1; + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) + grub_size_t tramp; ++ grub_size_t tramp_align; + grub_size_t got; ++ grub_size_t got_align; + grub_err_t err; + #endif + char *ptr; +@@ -311,12 +313,18 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got); + if (err) + return err; +- tsize += ALIGN_UP (tramp, GRUB_ARCH_DL_TRAMP_ALIGN); +- if (talign < GRUB_ARCH_DL_TRAMP_ALIGN) +- talign = GRUB_ARCH_DL_TRAMP_ALIGN; +- tsize += ALIGN_UP (got, GRUB_ARCH_DL_GOT_ALIGN); +- if (talign < GRUB_ARCH_DL_GOT_ALIGN) +- talign = GRUB_ARCH_DL_GOT_ALIGN; ++ tramp_align = GRUB_ARCH_DL_TRAMP_ALIGN; ++ if (tramp_align < arch_addralign) ++ tramp_align = arch_addralign; ++ tsize += ALIGN_UP (tramp, tramp_align); ++ if (talign < tramp_align) ++ talign = tramp_align; ++ got_align = GRUB_ARCH_DL_GOT_ALIGN; ++ if (got_align < arch_addralign) ++ got_align = arch_addralign; ++ tsize += ALIGN_UP (got, got_align); ++ if (talign < got_align) ++ talign = got_align; + #endif + + #ifdef GRUB_MACHINE_EMU +@@ -376,11 +384,11 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + } + } + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) +- ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN); ++ ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, tramp_align); + mod->tramp = ptr; + mod->trampptr = ptr; + ptr += tramp; +- ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALIGN); ++ ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, got_align); + mod->got = ptr; + mod->gotptr = ptr; + ptr += got; diff --git a/grub.patches b/grub.patches index 10c552f8..0781c1b7 100644 --- a/grub.patches +++ b/grub.patches @@ -326,3 +326,6 @@ Patch0325: 0325-emu-linux-work-around-systemctl-kexec-returning.patch Patch0326: 0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch Patch0327: 0327-kern-ieee1275-init-Extended-support-in-Vec5.patch Patch0328: 0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch +Patch0329: 0329-grub_dl_set_mem_attrs-fix-format-string.patch +Patch0330: 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch +Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch diff --git a/grub2.spec b/grub2.spec index 7a3bad66..34fdfe31 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 93%{?dist} +Release: 94%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Apr 10 2023 Robbie Harwood - 2.06-94 +- Fix aa64 page fault with EFI_MEMORY_ATTRIBUTE_PROTOCOL + * Fri Mar 31 2023 Robbie Harwood - 2.06-93 - Add legacy pxe core.0 (cmadams) From dc5c4e3f52ab2a829168e81bd1e9eafced9b7c09 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 12 Apr 2023 15:23:39 +0000 Subject: [PATCH 194/294] Add switch-root support to grub-emu Signed-off-by: Robbie Harwood --- 0332-emu-Add-switch-root-to-grub-emu.patch | 330 +++++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 335 insertions(+), 1 deletion(-) create mode 100644 0332-emu-Add-switch-root-to-grub-emu.patch diff --git a/0332-emu-Add-switch-root-to-grub-emu.patch b/0332-emu-Add-switch-root-to-grub-emu.patch new file mode 100644 index 00000000..2a0f34ba --- /dev/null +++ b/0332-emu-Add-switch-root-to-grub-emu.patch @@ -0,0 +1,330 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Fri, 31 Mar 2023 20:47:58 +0200 +Subject: [PATCH] emu: Add switch-root to grub-emu + +If the kernel running grub emu is the same as the one we want to +boot, it makes sense that we just switch-root instead of kexec +the same kernel again by doing grub2-emu --switch-root + +Signed-off-by: Nicolas Frayer +--- + grub-core/kern/emu/main.c | 5 +- + grub-core/kern/emu/misc.c | 13 +++ + grub-core/loader/emu/linux.c | 209 +++++++++++++++++++++++++++++++++++++++++-- + include/grub/emu/exec.h | 2 +- + include/grub/emu/misc.h | 2 + + 5 files changed, 223 insertions(+), 8 deletions(-) + +diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c +index 68e2b283bb..ccb2863f5b 100644 +--- a/grub-core/kern/emu/main.c ++++ b/grub-core/kern/emu/main.c +@@ -108,6 +108,7 @@ static struct argp_option options[] = { + {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, + {"hold", 'H', N_("SECS"), OPTION_ARG_OPTIONAL, N_("wait until a debugger will attach"), 0}, + {"kexec", 'X', 0, 0, N_("use kexec to boot Linux kernels via systemctl (pass twice to enable dangerous fallback to non-systemctl)."), 0}, ++ {"switch-root", 'W', 0, 0, N_("use switch-root to only switch root filesystem without restarting the kernel."), 0}, + { 0, 0, 0, 0, 0, 0 } + }; + +@@ -168,7 +169,9 @@ argp_parser (int key, char *arg, struct argp_state *state) + case 'X': + grub_util_set_kexecute (); + break; +- ++ case 'W': ++ grub_util_set_switch_root (); ++ break; + case ARGP_KEY_ARG: + { + /* Too many arguments. */ +diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c +index 02d27c3440..4b5123ef96 100644 +--- a/grub-core/kern/emu/misc.c ++++ b/grub-core/kern/emu/misc.c +@@ -40,6 +40,7 @@ + + int verbosity; + int kexecute; ++int switchroot = 0; + + void + grub_util_warn (const char *fmt, ...) +@@ -231,3 +232,15 @@ grub_util_get_kexecute (void) + { + return kexecute; + } ++ ++void ++grub_util_set_switch_root (void) ++{ ++ switchroot = 1; ++} ++ ++int ++grub_util_get_switch_root (void) ++{ ++ return switchroot; ++} +diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c +index 7de3f7f861..6feb0412c5 100644 +--- a/grub-core/loader/emu/linux.c ++++ b/grub-core/loader/emu/linux.c +@@ -15,7 +15,6 @@ + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ +- + #include + #include + #include +@@ -33,6 +32,196 @@ static char *kernel_path; + static char *initrd_path; + static char *boot_cmdline; + ++static grub_err_t ++grub_switch_root (void) ++{ ++ char *tmp = NULL; ++ char *options_cmd = NULL; ++ char *options = NULL; ++ char *subvol = NULL; ++ char *root_uuid = NULL; ++ char *kernel_release = NULL; ++ grub_err_t rc = GRUB_ERR_NONE; ++ const char *subvol_param = "subvol="; ++ const char *kernel_release_prefix = "/boot/vmlinuz-"; ++ const char *root_prefix = "root="; ++ const char *systemctl[] = {"systemctl", "--force", "switch-root", "/sysroot", NULL}; ++ const char *mountrootfs[] = {"mount", root_uuid, "/sysroot", options_cmd, options, NULL}; ++ const char *unamer[] = {"uname", "-r", NULL}; ++ char *uname_buf = NULL; ++ int i = 0; ++ ++ /* Extract the kernel release tag from kernel_path */ ++ if (!kernel_path) ++ { ++ rc = GRUB_ERR_BAD_ARGUMENT; ++ grub_dprintf ("linux", "switch_root: No kernel_path found\n"); ++ goto out; ++ } ++ ++ if ((kernel_release = grub_xasprintf ("%s", (kernel_path + grub_strlen (kernel_release_prefix)))) == NULL) ++ { ++ grub_dprintf ("linux", "switch_root: Failed to allocate memory\n"); ++ rc = GRUB_ERR_BAD_ARGUMENT; ++ goto out; ++ } ++ ++ ++ /* Check for kernel mismatch */ ++ /* Retrieve the current kernel relase tag */ ++ grub_util_exec_redirect (unamer, NULL, "/tmp/version"); ++ ++ grub_file_t f = grub_file_open ("/tmp/version", GRUB_FILE_TYPE_FS_SEARCH); ++ ++ if (f == NULL) ++ { ++ grub_dprintf ("linux", "failed opening file.\n"); ++ rc = GRUB_ERR_FILE_NOT_FOUND; ++ goto out; ++ } ++ ++ if ((uname_buf = grub_malloc (f->size)) == NULL) ++ { ++ grub_dprintf ("linux", "switch_root: Failed to allocate memory\n"); ++ rc = GRUB_ERR_OUT_OF_MEMORY; ++ goto out; ++ } ++ ++ if (grub_file_read (f, uname_buf, f->size) < 0) ++ { ++ grub_dprintf ("linux", "switch_root: failed to read from file\n"); ++ rc = GRUB_ERR_FILE_READ_ERROR; ++ goto out; ++ } ++ ++ grub_file_close (f); ++ ++ if (grub_strstr (uname_buf, kernel_release) == NULL) ++ { ++ grub_dprintf ("linux", "switch_root: kernel mismatch, not performing switch-root ...\n"); ++ rc = GRUB_ERR_NO_KERNEL; ++ goto out; ++ } ++ ++ /* Extract the root partition from boot_cmdline */ ++ if (!boot_cmdline) ++ { ++ rc = GRUB_ERR_BAD_ARGUMENT; ++ goto out; ++ } ++ ++ tmp = grub_strdup (boot_cmdline); ++ ++ if (tmp == NULL) ++ { ++ rc = GRUB_ERR_OUT_OF_MEMORY; ++ goto out; ++ } ++ ++ if ((root_uuid = grub_strstr (tmp, root_prefix)) == NULL) ++ { ++ rc = GRUB_ERR_BAD_ARGUMENT; ++ grub_dprintf ("linux", "switch_root: Can't find rootfs\n"); ++ goto out; ++ } ++ ++ root_uuid += grub_strlen (root_prefix); ++ ++ while (root_uuid[i] != ' ' && root_uuid[i] != '\0') ++ i++; ++ ++ root_uuid[i] = '\0'; ++ ++ /* Allocate a new buffer holding root_uuid */ ++ root_uuid = grub_xasprintf ("%s", root_uuid); ++ ++ if (root_uuid == NULL) ++ { ++ grub_dprintf ("linux", "switch_root: Failed to allocated memory\n"); ++ rc = GRUB_ERR_OUT_OF_MEMORY; ++ goto out; ++ } ++ ++ /* Check for subvol parameter */ ++ grub_strcpy (tmp, boot_cmdline); ++ ++ if ((subvol = grub_strstr(tmp, subvol_param)) != NULL) ++ { ++ i = 0; ++ ++ while (subvol[i] != ' ' && subvol[i] != '\0') ++ i++; ++ ++ subvol[i] = '\0'; ++ ++ /* Allocate a new buffer holding subvol */ ++ subvol = grub_xasprintf("%s", subvol); ++ ++ if (subvol == NULL) ++ { ++ grub_dprintf ("linux", "switch_root: Failed to allocated memory\n"); ++ rc = GRUB_ERR_OUT_OF_MEMORY; ++ goto out; ++ } ++ ++ options_cmd = grub_xasprintf("%s", "-o"); ++ options = grub_xasprintf("%s", subvol); ++ } ++ ++ if (options == NULL) ++ { ++ mountrootfs[3] = NULL; ++ } ++ else ++ { ++ mountrootfs[3] = options_cmd; ++ mountrootfs[4] = options; ++ } ++ ++ mountrootfs[1] = root_uuid; ++ ++ grub_dprintf ("linux", "Executing:\n"); ++ grub_dprintf ("linux", "%s %s %s %s %s\n", mountrootfs[0], mountrootfs[1], ++ mountrootfs[2], mountrootfs[3], mountrootfs[4]); ++ ++ /* Mount the rootfs */ ++ rc = grub_util_exec (mountrootfs); ++ ++ if (rc != GRUB_ERR_NONE) ++ { ++ grub_dprintf ("linux", "switch_root: Failed.\n"); ++ rc = GRUB_ERR_INVALID_COMMAND; ++ goto out; ++ } ++ ++ grub_dprintf ("linux", "Done.\n"); ++ ++ grub_dprintf ("linux", "%s %s %s %s\n", systemctl[0], systemctl[1], ++ systemctl[2], systemctl[3]); ++ ++ /* Switch root */ ++ rc = grub_util_exec (systemctl); ++ ++ if (rc != GRUB_ERR_NONE) ++ { ++ grub_dprintf ("linux", "switch_root: Failed.\n"); ++ rc = GRUB_ERR_INVALID_COMMAND; ++ goto out; ++ } ++ ++ grub_dprintf ("linux", "Done.\n"); ++ ++out: ++ grub_free (tmp); ++ grub_free (options_cmd); ++ grub_free (options); ++ grub_free (subvol); ++ grub_free (root_uuid); ++ grub_free (uname_buf); ++ grub_free (kernel_release); ++ return rc; ++} ++ + static grub_err_t + grub_linux_boot (void) + { +@@ -51,12 +240,20 @@ grub_linux_boot (void) + else + initrd_param = grub_xasprintf ("%s", ""); + +- grub_dprintf ("linux", "%serforming 'kexec -la %s %s %s'\n", +- (kexecute) ? "P" : "Not p", +- kernel_path, initrd_param, boot_cmdline); ++ if (grub_util_get_switch_root() == 1) ++ { ++ rc = grub_switch_root(); ++ if (rc != GRUB_ERR_NONE) ++ grub_fatal (N_("Failed to execute switch_root\n")); ++ } ++ else if (kexecute) ++ { ++ grub_dprintf ("linux", "%serforming 'kexec -la %s %s %s'\n", ++ (kexecute) ? "P" : "Not p", ++ kernel_path, initrd_param, boot_cmdline); + +- if (kexecute) +- rc = grub_util_exec (kexec); ++ rc = grub_util_exec (kexec); ++ } + + grub_free (initrd_param); + +diff --git a/include/grub/emu/exec.h b/include/grub/emu/exec.h +index 1b61b4a2e5..e82f13215e 100644 +--- a/include/grub/emu/exec.h ++++ b/include/grub/emu/exec.h +@@ -36,7 +36,7 @@ grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, + int + EXPORT_FUNC(grub_util_exec) (const char *const *argv); + int +-grub_util_exec_redirect (const char *const *argv, const char *stdin_file, ++EXPORT_FUNC(grub_util_exec_redirect) (const char *const *argv, const char *stdin_file, + const char *stdout_file); + int + grub_util_exec_redirect_null (const char *const *argv); +diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h +index 01056954b9..f3a712a8b2 100644 +--- a/include/grub/emu/misc.h ++++ b/include/grub/emu/misc.h +@@ -59,6 +59,8 @@ void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format + + void EXPORT_FUNC(grub_util_set_kexecute) (void); + int EXPORT_FUNC(grub_util_get_kexecute) (void) WARN_UNUSED_RESULT; ++void EXPORT_FUNC(grub_util_set_switch_root) (void); ++int EXPORT_FUNC(grub_util_get_switch_root) (void); + + grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); + diff --git a/grub.patches b/grub.patches index 0781c1b7..18e904a8 100644 --- a/grub.patches +++ b/grub.patches @@ -329,3 +329,4 @@ Patch0328: 0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch Patch0329: 0329-grub_dl_set_mem_attrs-fix-format-string.patch Patch0330: 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch +Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch diff --git a/grub2.spec b/grub2.spec index 34fdfe31..aba7d63a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 94%{?dist} +Release: 95%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Apr 12 2023 Robbie Harwood - 2.06-95 +- Add switch-root support to grub-emu + * Mon Apr 10 2023 Robbie Harwood - 2.06-94 - Fix aa64 page fault with EFI_MEMORY_ATTRIBUTE_PROTOCOL From 5184f7bcf1595623f172cf1482c634bbb63370b4 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 22 Aug 2023 14:14:44 +0200 Subject: [PATCH 195/294] util: Enable default kernel for updates Signed-off-by: Nicolas Frayer --- ...il-Enable-default-kernel-for-updates.patch | 34 +++++++++++++++++++ 20-grub.install | 6 +++- grub.patches | 1 + grub2.spec | 5 ++- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 0333-util-Enable-default-kernel-for-updates.patch diff --git a/0333-util-Enable-default-kernel-for-updates.patch b/0333-util-Enable-default-kernel-for-updates.patch new file mode 100644 index 00000000..ac9ef0ba --- /dev/null +++ b/0333-util-Enable-default-kernel-for-updates.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Marta Lewandowska +Date: Wed, 24 May 2023 11:22:47 +0200 +Subject: [PATCH] util: Enable default kernel for updates + +Several kernel variants can be installed on a system in parallel. +In order to allow the user to choose which kernel will be set to +default after an update, re-enable grub's usage of DEFAULTKERNEL as +set in /etc/sysconfig/kernel + +Signed-off-by: Marta Lewandowska +--- + util/grub-get-kernel-settings.in | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in +index 7e87dfccc0e4..f71bc64360b0 100644 +--- a/util/grub-get-kernel-settings.in ++++ b/util/grub-get-kernel-settings.in +@@ -68,6 +68,14 @@ if test -f /etc/sysconfig/kernel ; then + . /etc/sysconfig/kernel + fi + ++GRUB_DEFAULT_KERNEL_TYPE=${DEFAULTKERNEL/-core/} ++if [ "$GRUB_DEFAULT_KERNEL_TYPE" != "kernel" ]; then ++ echo GRUB_NON_STANDARD_KERNEL=true ++ echo export GRUB_NON_STANDARD_KERNEL ++ GRUB_DEFAULT_KERNEL_TYPE=${GRUB_DEFAULT_KERNEL_TYPE/kernel-/} ++fi ++echo GRUB_DEFAULT_KERNEL_TYPE=$GRUB_DEFAULT_KERNEL_TYPE ++echo export GRUB_DEFAULT_KERNEL_TYPE + if [ "$MAKEDEBUG" = "yes" ]; then + echo GRUB_LINUX_MAKE_DEBUG=true + echo export GRUB_LINUX_MAKE_DEBUG diff --git a/20-grub.install b/20-grub.install index aa9272dd..8a86cc07 100755 --- a/20-grub.install +++ b/20-grub.install @@ -139,7 +139,11 @@ case "$COMMAND" in sed -i -e "s,^initrd.*,initrd ${BOOTPREFIX}${INITRD},g" "${BLS_TARGET}" fi - if [[ "$KERNEL_VERSION" == *\+debug* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ]; then + if ( [[ "$KERNEL_VERSION" != *${GRUB_DEFAULT_KERNEL_TYPE}* ]] && \ + [ "x$GRUB_NON_STANDARD_KERNEL" == "xtrue" ] ) || \ + ( echo "$KERNEL_VERSION" | grep -E -q "64k|auto|rt|uki" && \ + [ "x$GRUB_NON_STANDARD_KERNEL" != "xtrue" ] ) || \ + ( [[ "$KERNEL_VERSION" == *debug* ]] && [ "x$GRUB_DEFAULT_TO_DEBUG" != "xtrue" ] ); then GRUB_UPDATE_DEFAULT_KERNEL=false fi diff --git a/grub.patches b/grub.patches index 18e904a8..37eb21ce 100644 --- a/grub.patches +++ b/grub.patches @@ -330,3 +330,4 @@ Patch0329: 0329-grub_dl_set_mem_attrs-fix-format-string.patch Patch0330: 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch +Patch0333: 0333-util-Enable-default-kernel-for-updates.patch diff --git a/grub2.spec b/grub2.spec index aba7d63a..e13bad07 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 95%{?dist} +Release: 96%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Aug 22 2023 Nicolas Frayer - 2.06-96 +- util: Enable default kernel for updates + * Wed Apr 12 2023 Robbie Harwood - 2.06-95 - Add switch-root support to grub-emu From 6d1f9f4a80c5ab1c80a60667ce41a0a14f287c0a Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 22 Aug 2023 14:25:39 +0200 Subject: [PATCH 196/294] efi/http: change uint32_t to uintn_t Signed-off-by: Nicolas Frayer --- ...-efi-http-change-uint32_t-to-uintn_t.patch | 30 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 0334-efi-http-change-uint32_t-to-uintn_t.patch diff --git a/0334-efi-http-change-uint32_t-to-uintn_t.patch b/0334-efi-http-change-uint32_t-to-uintn_t.patch new file mode 100644 index 00000000..f970eb15 --- /dev/null +++ b/0334-efi-http-change-uint32_t-to-uintn_t.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Keng-Yu Lin +Date: Wed, 26 Apr 2023 01:43:16 -0400 +Subject: [PATCH] efi/http: change uint32_t to uintn_t + +Modify UINT32 to UINTN in EFI_HTTP_MESSAGE to +be UEFI 2.9 compliant. + +Signed-off-by: Keng-Yu Lin +Signed-off-by: Nicolas Frayer +--- + include/grub/efi/http.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h +index c5e9a89f5050..ad164ba1913d 100644 +--- a/include/grub/efi/http.h ++++ b/include/grub/efi/http.h +@@ -171,9 +171,9 @@ typedef struct { + grub_efi_http_request_data_t *request; + grub_efi_http_response_data_t *response; + } data; +- grub_efi_uint32_t header_count; ++ grub_efi_uintn_t header_count; + grub_efi_http_header_t *headers; +- grub_efi_uint32_t body_length; ++ grub_efi_uintn_t body_length; + void *body; + } grub_efi_http_message_t; + diff --git a/grub.patches b/grub.patches index 37eb21ce..7e0f096c 100644 --- a/grub.patches +++ b/grub.patches @@ -331,3 +331,4 @@ Patch0330: 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch Patch0333: 0333-util-Enable-default-kernel-for-updates.patch +Patch0334: 0334-efi-http-change-uint32_t-to-uintn_t.patch diff --git a/grub2.spec b/grub2.spec index e13bad07..3d205816 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 96%{?dist} +Release: 97%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -544,6 +544,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Aug 22 2023 Nicolas Frayer - 2.06-97 +- efi/http: change uint32_t to uintn_t + * Tue Aug 22 2023 Nicolas Frayer - 2.06-96 - util: Enable default kernel for updates From 5c4529ecac2526c65e25a09e17c25e18818a438a Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Thu, 31 Aug 2023 15:05:19 +0200 Subject: [PATCH 197/294] spec: Modified posttrans to harden grub config detection Resolves: #2235692 Signed-off-by: Nicolas Frayer --- grub2.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/grub2.spec b/grub2.spec index 3d205816..162769e5 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 97%{?dist} +Release: 98%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -348,8 +348,8 @@ if test ! -f ${EFI_HOME}/grub.cfg; then grub2-mkconfig -o ${EFI_HOME}/grub.cfg fi -if grep -q "configfile" ${EFI_HOME}/grub.cfg; then - exit 0 # already unified, nothing to do +if ((grep -q "configfile" ${EFI_HOME}/grub.cfg || grep -q "source" ${EFI_HOME}/grub.cfg) && ! grep -q "# It is automatically generated by grub2-mkconfig using templates" ${EFI_HOME}/grub.cfg); then + exit 0 #Already unified fi # create a stub grub2 config in EFI @@ -544,6 +544,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Aug 31 2023 Nicolas Frayer - 2.06-98 +- spec: Modified posttrans to harden grub config detection +- Resolves: #2235692 + * Tue Aug 22 2023 Nicolas Frayer - 2.06-97 - efi/http: change uint32_t to uintn_t From d161705351ffc8b445103e9c39f8dcb6ce6661c5 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 12 Sep 2023 22:24:05 +0200 Subject: [PATCH 198/294] spec: Use systemd presets and macros for units in tools package Resolves: #2230575 Signed-off-by: Christian Glombek --- ...Install-section-to-aux-systemd-units.patch | 52 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 38 ++++++++------ 3 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 0335-Add-Install-section-to-aux-systemd-units.patch diff --git a/0335-Add-Install-section-to-aux-systemd-units.patch b/0335-Add-Install-section-to-aux-systemd-units.patch new file mode 100644 index 00000000..c7268501 --- /dev/null +++ b/0335-Add-Install-section-to-aux-systemd-units.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Glombek +Date: Wed, 9 Aug 2023 18:11:25 +0200 +Subject: [PATCH] Add [Install] section to aux systemd units + +Currently in Fedora, these services are statically enabled by symlinks, +with no other way to disable them than to manually delete those symlinks. +This is problematic in Fedora IoT, where grub-boot-success.timer is +not supposed to be enabled. + +This change adds `[Install]` sections to all systemd units that are +currently enabled statically, so that they can be enabled dynamically +via presets or manually instead. +--- + docs/grub-boot-indeterminate.service | 3 +++ + docs/grub-boot-success.timer | 3 +++ + util/systemd/grub-systemd-integration.service.in | 3 +++ + 3 files changed, 9 insertions(+) + +diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service +index 6c8dcb186b63..5bcb474a3d31 100644 +--- a/docs/grub-boot-indeterminate.service ++++ b/docs/grub-boot-indeterminate.service +@@ -9,3 +9,6 @@ Before=system-update-pre.target + [Service] + Type=oneshot + ExecStart=/usr/bin/grub2-editenv - incr boot_indeterminate ++ ++[Install] ++WantedBy=system-update.target +diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer +index 406f17200560..1d124cccc146 100644 +--- a/docs/grub-boot-success.timer ++++ b/docs/grub-boot-success.timer +@@ -5,3 +5,6 @@ ConditionVirtualization=!container + + [Timer] + OnActiveSec=2min ++ ++[Install] ++WantedBy=timers.target +diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in +index c81fb594ce17..22ca1ca4885e 100644 +--- a/util/systemd/grub-systemd-integration.service.in ++++ b/util/systemd/grub-systemd-integration.service.in +@@ -6,3 +6,6 @@ ConditionPathExists=/run/systemd/reboot-to-boot-loader-menu + + [Service] + ExecStart=@libexecdir@/@grubdirname@/systemd-integration.sh ++ ++[Install] ++WantedBy=reboot.target diff --git a/grub.patches b/grub.patches index 7e0f096c..47616374 100644 --- a/grub.patches +++ b/grub.patches @@ -332,3 +332,4 @@ Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch Patch0333: 0333-util-Enable-default-kernel-for-updates.patch Patch0334: 0334-efi-http-change-uint32_t-to-uintn_t.patch +Patch0335: 0335-Add-Install-section-to-aux-systemd-units.patch diff --git a/grub2.spec b/grub2.spec index 162769e5..8fd1e448 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 98%{?dist} +Release: 99%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -62,8 +62,8 @@ BuildRequires: squashfs-tools BuildRequires: texinfo BuildRequires: xz-devel -# For %%_userunitdir macro -BuildRequires: systemd +# For %%_userunitdir and %%systemd_* macros +BuildRequires: systemd-rpm-macros %ifarch %{efi_arch} BuildRequires: pesign >= 0.99-8 @@ -114,6 +114,7 @@ Requires: gettext-runtime os-prober file Requires(pre): dracut Requires(pre): grep Requires(pre): sed +%{?systemd_requires} %description tools %{desc} @@ -271,17 +272,8 @@ install -d -m 0755 %{buildroot}%{_sysconfdir}/kernel/install.d/ # Install systemd user service to set the boot_success flag install -D -m 0755 -t %{buildroot}%{_userunitdir} \ docs/grub-boot-success.{timer,service} -install -d -m 0755 %{buildroot}%{_userunitdir}/timers.target.wants -ln -s ../grub-boot-success.timer \ - %{buildroot}%{_userunitdir}/timers.target.wants # Install systemd system-update unit to set boot_indeterminate for offline-upd install -D -m 0755 -t %{buildroot}%{_unitdir} docs/grub-boot-indeterminate.service -install -d -m 0755 %{buildroot}%{_unitdir}/system-update.target.wants -install -d -m 0755 %{buildroot}%{_unitdir}/reboot.target.wants -ln -s ../grub-boot-indeterminate.service \ - %{buildroot}%{_unitdir}/system-update.target.wants -ln -s ../grub2-systemd-integration.service \ - %{buildroot}%{_unitdir}/reboot.target.wants # Don't run debuginfo on all the grub modules and whatnot; it just # rejects them, complains, and slows down extraction. @@ -332,6 +324,21 @@ elif [ -f /etc/grub.d/01_users ] && \ fi fi +%post tools +%systemd_post grub-boot-indeterminate.service +%systemd_post grub-systemd-integration.service +%systemd_user_post grub-boot-success.timer + +%preun tools +%systemd_preun grub-boot-indeterminate.service +%systemd_preun grub-systemd-integration.service +%systemd_user_preun grub-boot-success.timer + +%postun tools +%systemd_postun_with_restart grub-boot-indeterminate.service +%systemd_postun_with_restart grub-systemd-integration.service +%systemd_user_postun_with_restart grub-boot-success.timer + %posttrans common set -eu @@ -427,11 +434,8 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %{_sysconfdir}/grub.d/README %{_userunitdir}/grub-boot-success.timer %{_userunitdir}/grub-boot-success.service -%{_userunitdir}/timers.target.wants %{_unitdir}/grub-boot-indeterminate.service -%{_unitdir}/system-update.target.wants %{_unitdir}/grub2-systemd-integration.service -%{_unitdir}/reboot.target.wants %{_unitdir}/systemd-logind.service.d %{_infodir}/grub2* %{_datarootdir}/grub/* @@ -544,6 +548,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Sep 01 2023 Christian Glombek - 2.06-99 +- spec: Use systemd presets and macros for units in tools package +- Resolves: #2230575 + * Thu Aug 31 2023 Nicolas Frayer - 2.06-98 - spec: Modified posttrans to harden grub config detection - Resolves: #2235692 From 52d23fe6f6870eda54fd58db721abfb6205bf7e2 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Wed, 13 Sep 2023 00:10:53 +0200 Subject: [PATCH 199/294] arm64: Use proper memory type for kernel allocation Resolves: #2149020 Signed-off-by: Nicolas Frayer --- ...er-memory-type-for-kernel-allocation.patch | 44 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 ++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch diff --git a/0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch b/0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch new file mode 100644 index 00000000..e77fcbf6 --- /dev/null +++ b/0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Tue, 28 Jun 2022 23:06:46 +0200 +Subject: [PATCH] arm64: Use proper memory type for kernel allocation + +Currently, the kernel pages are allocated with type EFI_LOADER_DATA. +While the vast majority of systems will happily execute code from those +pages (i.e. don't care about memory protection), the Microsoft Surface +Pro X stalls, as this memory is not designated as "executable". + +Therefore, allocate the kernel pages as EFI_LOADER_CODE to request +memory that is actually executable. + +Signed-off-by: Maximilian Luz +--- + grub-core/loader/arm64/linux.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index 419f2201df8b..a3a193c255e9 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -26,7 +26,9 @@ + #include + #include + #include ++#include + #include ++#include + #include + #include + #include +@@ -403,7 +405,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_loader_unset(); + + kernel_alloc_pages = GRUB_EFI_BYTES_TO_PAGES (kernel_size + align - 1); +- kernel_alloc_addr = grub_efi_allocate_any_pages (kernel_alloc_pages); ++ kernel_alloc_addr = grub_efi_allocate_pages_real (GRUB_EFI_MAX_USABLE_ADDRESS, ++ kernel_alloc_pages, ++ GRUB_EFI_ALLOCATE_MAX_ADDRESS, ++ GRUB_EFI_LOADER_CODE); + grub_dprintf ("linux", "kernel numpages: %d\n", kernel_alloc_pages); + if (!kernel_alloc_addr) + { diff --git a/grub.patches b/grub.patches index 47616374..b870cefe 100644 --- a/grub.patches +++ b/grub.patches @@ -333,3 +333,4 @@ Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch Patch0333: 0333-util-Enable-default-kernel-for-updates.patch Patch0334: 0334-efi-http-change-uint32_t-to-uintn_t.patch Patch0335: 0335-Add-Install-section-to-aux-systemd-units.patch +Patch0336: 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch diff --git a/grub2.spec b/grub2.spec index 8fd1e448..65f59156 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 99%{?dist} +Release: 100%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -548,6 +548,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Sep 13 2023 Nicolas Frayer - 2.06-100 +- arm64: Use proper memory type for kernel allocation +- Resolves: #2149020 + * Fri Sep 01 2023 Christian Glombek - 2.06-99 - spec: Use systemd presets and macros for units in tools package - Resolves: #2230575 From 6c038d7d020877cf6a4f9942e04691abb138047c Mon Sep 17 00:00:00 2001 From: Christian Glombek Date: Thu, 28 Sep 2023 19:05:51 +0200 Subject: [PATCH 200/294] spec: Fix grub2-systemd-integration.service name Signed-off-by: Christian Glombek --- grub2.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub2.spec b/grub2.spec index 65f59156..6a8ad61e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 100%{?dist} +Release: 101%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -326,17 +326,17 @@ fi %post tools %systemd_post grub-boot-indeterminate.service -%systemd_post grub-systemd-integration.service +%systemd_post grub2-systemd-integration.service %systemd_user_post grub-boot-success.timer %preun tools %systemd_preun grub-boot-indeterminate.service -%systemd_preun grub-systemd-integration.service +%systemd_preun grub2-systemd-integration.service %systemd_user_preun grub-boot-success.timer %postun tools %systemd_postun_with_restart grub-boot-indeterminate.service -%systemd_postun_with_restart grub-systemd-integration.service +%systemd_postun_with_restart grub2-systemd-integration.service %systemd_user_postun_with_restart grub-boot-success.timer %posttrans common @@ -548,6 +548,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Sep 28 2023 Christian Glombek - 2.06-101 +- spec: Fix grub2-systemd-integration.service name + * Wed Sep 13 2023 Nicolas Frayer - 2.06-100 - arm64: Use proper memory type for kernel allocation - Resolves: #2149020 From aa936e7b0ca808422456ad706f81378c4db003fc Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 29 Sep 2023 18:06:49 +0200 Subject: [PATCH 201/294] ofdisk: Fix missing #include in ofdisk.c Signed-off-by: Nicolas Frayer --- 0337-Fix-missing-include-in-ofdisk.c.patch | 28 ++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 0337-Fix-missing-include-in-ofdisk.c.patch diff --git a/0337-Fix-missing-include-in-ofdisk.c.patch b/0337-Fix-missing-include-in-ofdisk.c.patch new file mode 100644 index 00000000..84a12405 --- /dev/null +++ b/0337-Fix-missing-include-in-ofdisk.c.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 29 Sep 2023 10:56:11 -0400 +Subject: [PATCH] Fix missing #include in ofdisk.c + +Recently we started building with -Werror=implicit-function-declaration, +and discovered that ofdisk.c is missing an include to declare +grub_env_get(). + +This patch adds that #include. + +Signed-off-by: Peter Jones +--- + grub-core/disk/ieee1275/ofdisk.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index 5534684..6e33d5d 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + static char *last_devpath; + static grub_ieee1275_ihandle_t last_ihandle; diff --git a/grub.patches b/grub.patches index b870cefe..5ae522f4 100644 --- a/grub.patches +++ b/grub.patches @@ -334,3 +334,4 @@ Patch0333: 0333-util-Enable-default-kernel-for-updates.patch Patch0334: 0334-efi-http-change-uint32_t-to-uintn_t.patch Patch0335: 0335-Add-Install-section-to-aux-systemd-units.patch Patch0336: 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch +Patch0337: 0337-Fix-missing-include-in-ofdisk.c.patch diff --git a/grub2.spec b/grub2.spec index 6a8ad61e..74cf9716 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 101%{?dist} +Release: 102%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -548,6 +548,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Sep 29 2023 Nicolas Frayer - 2.06-102 +- ofdisk: Fix missing #include in ofdisk.c + * Thu Sep 28 2023 Christian Glombek - 2.06-101 - spec: Fix grub2-systemd-integration.service name From af4f1536b6e498b88c1b07d00fc047184453839a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 27 Sep 2023 17:05:21 +0200 Subject: [PATCH 202/294] Rename installed kernel to match name used in boot entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mkbls() function would write 'linux /vmlinuz-${kernelver}' into the boot loader entry. But the code that actually copies the file would use the original file name with a version suffix ('cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}"'). In case of a local kernel build calling /sbin/installkernel this file name was e.g. 'bzImage', so we would end up with '/bzImage-${KERNEL_VERSION}', which of course doesn't match '/vmlinuz-*'. The script would later call 'grub2-mkrel' on the name taken from the boot entry which would fail because the file does not exist. Rename the argument to "vmlinuz", so that both parts match. Tested by doing a local kernel build with 'sudo make install' at the end. Signed-off-by: Zbigniew Jędrzejewski-Szmek --- 20-grub.install | 7 ++++++- grub2.spec | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/20-grub.install b/20-grub.install index 8a86cc07..952322f3 100755 --- a/20-grub.install +++ b/20-grub.install @@ -54,8 +54,13 @@ EOF case "$COMMAND" in add) if [[ "${KERNEL_DIR}" != "/boot" ]]; then + # rename to match the name used in the pseudo-BLS snippet above + rm -f "/boot/vmlinuz-${KERNEL_VERSION}" + cp -aT "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}" + command -v restorecon &>/dev/null && \ + restorecon -R "/boot/vmlinuz-${KERNEL_VERSION}" + for i in \ - "$KERNEL_IMAGE" \ "$KERNEL_DIR"/System.map \ "$KERNEL_DIR"/config \ "$KERNEL_DIR"/zImage.stub \ diff --git a/grub2.spec b/grub2.spec index 74cf9716..a99ce0eb 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 102%{?dist} +Release: 103%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -548,6 +548,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Sep 29 2023 Zbigniew Jedrzejewski-Szmek - 1:2.06-103 +- Rename installed kernel to match name used in boot entry +- Resolves: #2239008 + * Fri Sep 29 2023 Nicolas Frayer - 2.06-102 - ofdisk: Fix missing #include in ofdisk.c From 8800efcb0bea5750f77f88a05ac9211a19cbc7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 28 Sep 2023 12:05:19 +0200 Subject: [PATCH 203/294] Do not preserve ownership or xattrs on copied files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As noticed in https://bugzilla.redhat.com/show_bug.cgi?id=2239008#c16, when compiling a kernel as a user and doing 'sudo make install', and when using a non-vfat fs for the install destination, the file would end up owned by the user. This is not useful at all, so let's only preserve the timestamps on the copied file, no other attributes. Signed-off-by: Zbigniew Jędrzejewski-Szmek --- 20-grub.install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/20-grub.install b/20-grub.install index 952322f3..58a998ee 100755 --- a/20-grub.install +++ b/20-grub.install @@ -56,7 +56,7 @@ case "$COMMAND" in if [[ "${KERNEL_DIR}" != "/boot" ]]; then # rename to match the name used in the pseudo-BLS snippet above rm -f "/boot/vmlinuz-${KERNEL_VERSION}" - cp -aT "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}" + cp --preserve=timestamps -T "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}" command -v restorecon &>/dev/null && \ restorecon -R "/boot/vmlinuz-${KERNEL_VERSION}" @@ -68,7 +68,7 @@ case "$COMMAND" in do [[ -e "$i" ]] || continue rm -f "/boot/${i##*/}-${KERNEL_VERSION}" - cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}" + cp --preserve=timestamps -T "$i" "/boot/${i##*/}-${KERNEL_VERSION}" command -v restorecon &>/dev/null && \ restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}" done @@ -76,7 +76,7 @@ case "$COMMAND" in i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" if [[ -e "$i" ]]; then rm -f "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" - cp -a "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" + cp --preserve=timestamps "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" command -v restorecon &>/dev/null && \ restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" fi @@ -158,7 +158,7 @@ case "$COMMAND" in if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" - cp -aT "${BLS_TARGET}" "${BLS_DEBUG}" + cp --preserve=timestamps -T "${BLS_TARGET}" "${BLS_DEBUG}" TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')" OPTIONS="$(echo "${BOOT_OPTIONS[*]} ${GRUB_CMDLINE_LINUX_DEBUG}" | sed -e 's/\//\\\//g')" sed -i -e "s/^title.*/title ${TITLE}${GRUB_LINUX_DEBUG_TITLE_POSTFIX}/" "${BLS_DEBUG}" From e1206cf45b3bdde97e166d5c0d55842c864a1c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 28 Sep 2023 12:09:09 +0200 Subject: [PATCH 204/294] Let ln and cp remove the destination files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No functional change, but makes the script a bit shorter. Signed-off-by: Zbigniew Jędrzejewski-Szmek --- 20-grub.install | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/20-grub.install b/20-grub.install index 58a998ee..1114cf53 100755 --- a/20-grub.install +++ b/20-grub.install @@ -55,8 +55,7 @@ case "$COMMAND" in add) if [[ "${KERNEL_DIR}" != "/boot" ]]; then # rename to match the name used in the pseudo-BLS snippet above - rm -f "/boot/vmlinuz-${KERNEL_VERSION}" - cp --preserve=timestamps -T "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}" + cp --remove-destination --preserve=timestamps -T "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}" command -v restorecon &>/dev/null && \ restorecon -R "/boot/vmlinuz-${KERNEL_VERSION}" @@ -67,16 +66,14 @@ case "$COMMAND" in "$KERNEL_DIR"/dtb do [[ -e "$i" ]] || continue - rm -f "/boot/${i##*/}-${KERNEL_VERSION}" - cp --preserve=timestamps -T "$i" "/boot/${i##*/}-${KERNEL_VERSION}" + cp --remove-destination --preserve=timestamps -T "$i" "/boot/${i##*/}-${KERNEL_VERSION}" command -v restorecon &>/dev/null && \ restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}" done # hmac is .vmlinuz-.hmac so needs a special treatment i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" if [[ -e "$i" ]]; then - rm -f "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" - cp --preserve=timestamps "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" + cp --remove-destination --preserve=timestamps "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" command -v restorecon &>/dev/null && \ restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" fi @@ -84,16 +81,14 @@ case "$COMMAND" in # symvers is symvers-.gz symlink, needs a special treatment i="$KERNEL_DIR/symvers.gz" if [[ -e "$i" ]]; then - rm -f "/boot/symvers-${KERNEL_VERSION}.gz" - ln -s "$i" "/boot/symvers-${KERNEL_VERSION}.gz" + ln -fs "$i" "/boot/symvers-${KERNEL_VERSION}.gz" command -v restorecon &>/dev/null && \ restorecon "/boot/symvers-${KERNEL_VERSION}.gz" fi # symvers is symvers-.bz symlink, needs a special treatment i="$KERNEL_DIR/symvers.bz" if [[ -e "$i" ]]; then - rm -f "/boot/symvers-${KERNEL_VERSION}.bz" - ln -s "$i" "/boot/symvers-${KERNEL_VERSION}.bz" + ln -fs "$i" "/boot/symvers-${KERNEL_VERSION}.bz" command -v restorecon &>/dev/null && \ restorecon "/boot/symvers-${KERNEL_VERSION}.bz" fi From 45dbc926bfb57c24ab8835a361dd4fc5b1d75a84 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Fri, 25 Aug 2023 13:31:05 +0200 Subject: [PATCH 205/294] Don't run 20-grub.install for UKIs When kernel-install is called for a UKI, 20-grub.install copies it to /boot which is totally unneeded, UKIs are now handled by the standard systemd's 90-uki-copy.install (systemd-253+) correctly which places them to the ESP. Signed-off-by: Vitaly Kuznetsov --- 20-grub.install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/20-grub.install b/20-grub.install index 1114cf53..5ef21321 100755 --- a/20-grub.install +++ b/20-grub.install @@ -19,6 +19,9 @@ MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID # If ${BOOT_DIR_ABS} exists, some other boot loader is active. [[ -d "${BOOT_DIR_ABS}" ]] && exit 0 +# UKIs are BLS type 2 entries, 90-uki-copy.install takes care of them +[ "x$KERNEL_INSTALL_LAYOUT" != "xuki" ] || exit 0 + BLS_DIR="/boot/loader/entries" mkbls() { From 62027d5ee343bb6dac40e9ad723bd348c8d63c40 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Tue, 10 Oct 2023 18:43:25 +0000 Subject: [PATCH 206/294] 20-grub.install: Copy device-tree directory recursively 8800efcb0bea replaced '-a' with '--preserve=timestamps' to avoid preserving ownership information on non vfat file systems. This breaks copying of the 'dtb' directory on aarch64 systems since '-a' implies '-r'. Add '-r' to the single place where 'dtb/' is copied to /boot. Resolves: #2243060 Fixes: 8800efcb0bea ("Do not preserve ownership or xattrs on copied files") Signed-off-by: Janne Grunau Signed-off-by: Nicolas Frayer --- 20-grub.install | 2 +- grub2.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/20-grub.install b/20-grub.install index 5ef21321..afc706dd 100755 --- a/20-grub.install +++ b/20-grub.install @@ -69,7 +69,7 @@ case "$COMMAND" in "$KERNEL_DIR"/dtb do [[ -e "$i" ]] || continue - cp --remove-destination --preserve=timestamps -T "$i" "/boot/${i##*/}-${KERNEL_VERSION}" + cp --remove-destination --preserve=timestamps -rT "$i" "/boot/${i##*/}-${KERNEL_VERSION}" command -v restorecon &>/dev/null && \ restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}" done diff --git a/grub2.spec b/grub2.spec index a99ce0eb..f744a47d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 103%{?dist} +Release: 104%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -548,6 +548,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Oct 11 2023 Janne Grunau - 2.06-104 +- 20-grub.install: Copy device-tree directory recursively +- Resolves: #2243060 + * Fri Sep 29 2023 Zbigniew Jedrzejewski-Szmek - 1:2.06-103 - Rename installed kernel to match name used in boot entry - Resolves: #2239008 From 07412b4a976474d887a083532c09f42e65050c70 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 20 Oct 2023 18:11:41 +0200 Subject: [PATCH 207/294] kern/ieee1275/init: ppc64: Restrict high memory in presence of fadump Signed-off-by: Nicolas Frayer --- ...it-ppc64-Restrict-high-memory-in-pre.patch | 226 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +- 3 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch diff --git a/0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch b/0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch new file mode 100644 index 00000000..5c7e1a38 --- /dev/null +++ b/0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch @@ -0,0 +1,226 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stefan Berger +Date: Tue, 25 Jul 2023 13:23:10 -0400 +Subject: [PATCH] kern/ieee1275/init: ppc64: Restrict high memory in presence + of fadump + +When a kernel dump is present then restrict the high memory regions to +avoid allocating memory where the kernel dump resides. Use the +ibm,kernel-dump node under /rtas to determine whether a kernel dump exists +and up to which limit grub can use available memory. Set the +upper_mem_limit to the size of the kernel dump section of type +'REAL_MODE_REGION' and therefore only allow grub's memory usage for high +addresses from RMO_ADDR_MAX to 'upper_mem_limit'. This means that grub can +use high memory in the range of RMO_ADDR_MAX (768MB) to upper_mem_limit and +the kernel-dump memory regions above 'upper_mem_limit' remain untouched. +This change has no effect on memory allocations below 'linux_rmo_save' +(typically at 640MB). + +Also, fall back to allocating below rmo_linux_save in case the chunk of +memory there would be larger than the chunk of memory above RMO_ADDR_MAX. +This can for example occur if a free memory area is found starting at 300MB +extending up to 1GB but a kernel dump is located at 768MB and therefore +does not allow the allocation of the high memory area but requiring to use +the chunk starting at 300MB to avoid an unnecessary out-of-memory +condition. + +Signed-off-by: Stefan Berger +Reviewed-by: Hari Bathini +Cc: Pavithra Prakash +Cc: Michael Ellerman +Cc: Carolyn Scherrer +Cc: Mahesh Salgaonkar +Cc: Sourabh Jain +--- + grub-core/kern/ieee1275/init.c | 144 ++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 142 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 3d4ad9d1f162..8e7f742fad46 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -17,6 +17,8 @@ + * along with GRUB. If not, see . + */ + ++#include /* offsetof() */ ++ + #include + #include + #include +@@ -198,6 +200,96 @@ grub_claim_heap (void) + #else + /* Helpers for mm on powerpc. */ + ++/* ibm,kernel-dump data structures */ ++struct kd_section ++{ ++ grub_uint32_t flags; ++ grub_uint16_t src_datatype; ++#define KD_SRC_DATATYPE_REAL_MODE_REGION 0x0011 ++ grub_uint16_t error_flags; ++ grub_uint64_t src_address; ++ grub_uint64_t num_bytes; ++ grub_uint64_t act_bytes; ++ grub_uint64_t dst_address; ++} GRUB_PACKED; ++ ++#define MAX_KD_SECTIONS 10 ++ ++struct kernel_dump ++{ ++ grub_uint32_t format; ++ grub_uint16_t num_sections; ++ grub_uint16_t status_flags; ++ grub_uint32_t offset_1st_section; ++ grub_uint32_t num_blocks; ++ grub_uint64_t start_block; ++ grub_uint64_t num_blocks_avail; ++ grub_uint32_t offet_path_string; ++ grub_uint32_t max_time_allowed; ++ struct kd_section kds[MAX_KD_SECTIONS]; /* offset_1st_section should point to kds[0] */ ++} GRUB_PACKED; ++ ++/* ++ * Determine if a kernel dump exists and if it does, then determine the highest ++ * address that grub can use for memory allocations. ++ * The caller must have initialized *highest to rmo_top. *highest will not ++ * be modified if no kernel dump is found. ++ */ ++static void ++check_kernel_dump (grub_uint64_t *highest) ++{ ++ struct kernel_dump kernel_dump; ++ grub_ssize_t kernel_dump_size; ++ grub_ieee1275_phandle_t rtas; ++ struct kd_section *kds; ++ grub_size_t i; ++ ++ /* If there's a kernel-dump it must have at least one section */ ++ if (grub_ieee1275_finddevice ("/rtas", &rtas) || ++ grub_ieee1275_get_property (rtas, "ibm,kernel-dump", &kernel_dump, ++ sizeof (kernel_dump), &kernel_dump_size) || ++ kernel_dump_size <= (grub_ssize_t) offsetof (struct kernel_dump, kds[1])) ++ return; ++ ++ kernel_dump_size = grub_min (kernel_dump_size, (grub_ssize_t) sizeof (kernel_dump)); ++ ++ if (grub_be_to_cpu32 (kernel_dump.format) != 1) ++ { ++ grub_printf (_("Error: ibm,kernel-dump has an unexpected format version '%u'\n"), ++ grub_be_to_cpu32 (kernel_dump.format)); ++ return; ++ } ++ ++ if (grub_be_to_cpu16 (kernel_dump.num_sections) > MAX_KD_SECTIONS) ++ { ++ grub_printf (_("Error: Too many kernel dump sections: %d\n"), ++ grub_be_to_cpu32 (kernel_dump.num_sections)); ++ return; ++ } ++ ++ for (i = 0; i < grub_be_to_cpu16 (kernel_dump.num_sections); i++) ++ { ++ kds = (struct kd_section *) ((grub_addr_t) &kernel_dump + ++ grub_be_to_cpu32 (kernel_dump.offset_1st_section) + ++ i * sizeof (struct kd_section)); ++ /* sanity check the address is within the 'kernel_dump' struct */ ++ if ((grub_addr_t) kds > (grub_addr_t) &kernel_dump + kernel_dump_size + sizeof (*kds)) ++ { ++ grub_printf (_("Error: 'kds' address beyond last available section\n")); ++ return; ++ } ++ ++ if ((grub_be_to_cpu16 (kds->src_datatype) == KD_SRC_DATATYPE_REAL_MODE_REGION) && ++ (grub_be_to_cpu64 (kds->src_address) == 0)) ++ { ++ *highest = grub_min (*highest, grub_be_to_cpu64 (kds->num_bytes)); ++ break; ++ } ++ } ++ ++ return; ++} ++ + /* + * How much memory does OF believe exists in total? + * +@@ -277,10 +369,31 @@ regions_claim (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + * + * Finally, we also want to make sure that when grub loads the kernel, + * it isn't going to use up all the memory we're trying to reserve! So +- * enforce our entire RUNTIME_MIN_SPACE here: ++ * enforce our entire RUNTIME_MIN_SPACE here (no fadump): ++ * ++ * | Top of memory == upper_mem_limit -| ++ * | | ++ * | available | ++ * | | ++ * |---------- 768 MB ----------| ++ * | | ++ * | reserved | ++ * | | ++ * |--- 768 MB - runtime min space ---| ++ * | | ++ * | available | ++ * | | ++ * |---------- 0 MB ----------| ++ * ++ * In case fadump is used, we allow the following: + * + * |---------- Top of memory ----------| + * | | ++ * | unavailable | ++ * | (kernel dump area) | ++ * | | ++ * |--------- upper_mem_limit ---------| ++ * | | + * | available | + * | | + * |---------- 768 MB ----------| +@@ -335,17 +448,44 @@ regions_claim (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, + } + else + { ++ grub_uint64_t upper_mem_limit = rmo_top; ++ grub_uint64_t orig_addr = addr; ++ ++ check_kernel_dump (&upper_mem_limit); ++ + /* + * we order these cases to prefer higher addresses and avoid some + * splitting issues ++ * The following shows the order of variables: ++ * no kernel dump: linux_rmo_save < RMO_ADDR_MAX <= upper_mem_limit == rmo_top ++ * with kernel dump: liuxx_rmo_save < RMO_ADDR_MAX <= upper_mem_limit <= rmo_top + */ +- if (addr < RMO_ADDR_MAX && (addr + len) > RMO_ADDR_MAX) ++ if (addr < RMO_ADDR_MAX && (addr + len) > RMO_ADDR_MAX && upper_mem_limit >= RMO_ADDR_MAX) + { + grub_dprintf ("ieee1275", + "adjusting region for RUNTIME_MIN_SPACE: (%llx -> %llx) -> (%llx -> %llx)\n", + addr, addr + len, RMO_ADDR_MAX, addr + len); + len = (addr + len) - RMO_ADDR_MAX; + addr = RMO_ADDR_MAX; ++ ++ /* We must not exceed the upper_mem_limit (assuming it's >= RMO_ADDR_MAX) */ ++ if (addr + len > upper_mem_limit) ++ { ++ /* take the bigger chunk from either below linux_rmo_save or above upper_mem_limit */ ++ len = upper_mem_limit - addr; ++ if (orig_addr < linux_rmo_save && linux_rmo_save - orig_addr > len) ++ { ++ /* lower part is bigger */ ++ addr = orig_addr; ++ len = linux_rmo_save - addr; ++ } ++ ++ grub_dprintf ("ieee1275", "re-adjusted region to: (%llx -> %llx)\n", ++ addr, addr + len); ++ ++ if (len == 0) ++ return 0; ++ } + } + else if ((addr < linux_rmo_save) && ((addr + len) > linux_rmo_save)) + { diff --git a/grub.patches b/grub.patches index 5ae522f4..28241dad 100644 --- a/grub.patches +++ b/grub.patches @@ -335,3 +335,4 @@ Patch0334: 0334-efi-http-change-uint32_t-to-uintn_t.patch Patch0335: 0335-Add-Install-section-to-aux-systemd-units.patch Patch0336: 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch Patch0337: 0337-Fix-missing-include-in-ofdisk.c.patch +Patch0338: 0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch diff --git a/grub2.spec b/grub2.spec index f744a47d..03b33ca5 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 104%{?dist} +Release: 105%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -548,6 +548,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Oct 20 2023 Nicolas Frayer - 2.06-105 +- kern/ieee1275/init: ppc64: Restrict high memory in presence + of fadump + * Wed Oct 11 2023 Janne Grunau - 2.06-104 - 20-grub.install: Copy device-tree directory recursively - Resolves: #2243060 From 8a9297c4314b61eac1f47ab6444615eb9f13874d Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Mon, 6 Nov 2023 18:10:09 +0100 Subject: [PATCH 208/294] util: grub-install on EFI if forced Resolves: #1917213 Resolves: #2240994 Signed-off-by: Nicolas Frayer --- 0339-grub-install-on-EFI-if-forced.patch | 77 ++++++++++++++++++++++++ grub.patches | 1 + grub2.spec | 7 ++- 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 0339-grub-install-on-EFI-if-forced.patch diff --git a/0339-grub-install-on-EFI-if-forced.patch b/0339-grub-install-on-EFI-if-forced.patch new file mode 100644 index 00000000..ad231ac5 --- /dev/null +++ b/0339-grub-install-on-EFI-if-forced.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Marta Lewandowska +Date: Fri, 13 Oct 2023 09:13:41 +0200 +Subject: [PATCH] grub-install on EFI if forced + +UEFI Secure Boot requires signed grub binaries to work, so grub- +install should not be used. However, users who have Secure Boot +disabled and wish to use the command should not be prevented from +doing so if they invoke --force. + +fixes bz#1917213 / bz#2240994 + +Signed-off-by: Marta Lewandowska +--- + util/grub-install.c | 42 ++++++++++++++++++++++++++---------------- + 1 file changed, 26 insertions(+), 16 deletions(-) + +diff --git a/util/grub-install.c b/util/grub-install.c +index 5babc7af5518..162162bec6e2 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -899,22 +899,6 @@ main (int argc, char *argv[]) + + platform = grub_install_get_target (grub_install_source_directory); + +- switch (platform) +- { +- case GRUB_INSTALL_PLATFORM_ARM_EFI: +- case GRUB_INSTALL_PLATFORM_ARM64_EFI: +- case GRUB_INSTALL_PLATFORM_I386_EFI: +- case GRUB_INSTALL_PLATFORM_IA64_EFI: +- case GRUB_INSTALL_PLATFORM_X86_64_EFI: +- is_efi = 1; +- grub_util_error (_("this utility cannot be used for EFI platforms" +- " because it does not support UEFI Secure Boot")); +- break; +- default: +- is_efi = 0; +- break; +- } +- + { + char *platname = grub_install_get_platform_name (platform); + fprintf (stderr, _("Installing for %s platform.\n"), platname); +@@ -1027,6 +1011,32 @@ main (int argc, char *argv[]) + grub_hostfs_init (); + grub_host_init (); + ++ switch (platform) ++ { ++ case GRUB_INSTALL_PLATFORM_I386_EFI: ++ case GRUB_INSTALL_PLATFORM_X86_64_EFI: ++ case GRUB_INSTALL_PLATFORM_ARM_EFI: ++ case GRUB_INSTALL_PLATFORM_ARM64_EFI: ++ case GRUB_INSTALL_PLATFORM_RISCV32_EFI: ++ case GRUB_INSTALL_PLATFORM_RISCV64_EFI: ++ case GRUB_INSTALL_PLATFORM_IA64_EFI: ++ is_efi = 1; ++ if (!force) ++ grub_util_error (_("This utility should not be used for EFI platforms" ++ " because it does not support UEFI Secure Boot." ++ " If you really wish to proceed, invoke the --force" ++ " option.\nMake sure Secure Boot is disabled before" ++ " proceeding")); ++ break; ++ default: ++ is_efi = 0; ++ break; ++ ++ /* pacify warning. */ ++ case GRUB_INSTALL_PLATFORM_MAX: ++ break; ++ } ++ + /* Find the EFI System Partition. */ + if (is_efi) + { diff --git a/grub.patches b/grub.patches index 28241dad..90e54622 100644 --- a/grub.patches +++ b/grub.patches @@ -336,3 +336,4 @@ Patch0335: 0335-Add-Install-section-to-aux-systemd-units.patch Patch0336: 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch Patch0337: 0337-Fix-missing-include-in-ofdisk.c.patch Patch0338: 0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch +Patch0339: 0339-grub-install-on-EFI-if-forced.patch diff --git a/grub2.spec b/grub2.spec index 03b33ca5..2fee4480 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 105%{?dist} +Release: 106%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -548,6 +548,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Nov 6 2023 Nicolas Frayer - 2.06-106 +- util: grub-install on EFI if forced +- Resolves: #1917213 +- Resolves: #2240994 + * Fri Oct 20 2023 Nicolas Frayer - 2.06-105 - kern/ieee1275/init: ppc64: Restrict high memory in presence of fadump From 94ecc476ab30c172221a6acddc1c6542a641a7d8 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 14 Nov 2023 12:15:47 +0100 Subject: [PATCH 209/294] spec: Fix enablement of grub services and timer Fix enablement of grub services and timer: - Switch back to static enablement for grub services in tools package - Add %%triggerpostun to apply grub-boot-success.timer preset when upgrading from older versions where this was not a preset Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2247635 Signed-off-by: Christian Glombek Signed-off-by: Hans de Goede --- grub2.spec | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/grub2.spec b/grub2.spec index 2fee4480..0c650983 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 106%{?dist} +Release: 107%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -274,6 +274,12 @@ install -D -m 0755 -t %{buildroot}%{_userunitdir} \ docs/grub-boot-success.{timer,service} # Install systemd system-update unit to set boot_indeterminate for offline-upd install -D -m 0755 -t %{buildroot}%{_unitdir} docs/grub-boot-indeterminate.service +install -d -m 0755 %{buildroot}%{_unitdir}/system-update.target.wants +install -d -m 0755 %{buildroot}%{_unitdir}/reboot.target.wants +ln -s ../grub-boot-indeterminate.service \ + %{buildroot}%{_unitdir}/system-update.target.wants +ln -s ../grub2-systemd-integration.service \ + %{buildroot}%{_unitdir}/reboot.target.wants # Don't run debuginfo on all the grub modules and whatnot; it just # rejects them, complains, and slows down extraction. @@ -325,20 +331,19 @@ elif [ -f /etc/grub.d/01_users ] && \ fi %post tools -%systemd_post grub-boot-indeterminate.service -%systemd_post grub2-systemd-integration.service %systemd_user_post grub-boot-success.timer %preun tools -%systemd_preun grub-boot-indeterminate.service -%systemd_preun grub2-systemd-integration.service %systemd_user_preun grub-boot-success.timer %postun tools -%systemd_postun_with_restart grub-boot-indeterminate.service -%systemd_postun_with_restart grub2-systemd-integration.service %systemd_user_postun_with_restart grub-boot-success.timer +%triggerpostun tools -- grub2-tools < 1:2.06-107 +# grub-boot-success.timer was moved from a hard symlink under /lib/systemd +# to a preset, apply the preset when upgrading from pre-preset versions +/usr/lib/systemd/systemd-update-helper install-user-units grub-boot-success.timer + %posttrans common set -eu @@ -435,7 +440,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %{_userunitdir}/grub-boot-success.timer %{_userunitdir}/grub-boot-success.service %{_unitdir}/grub-boot-indeterminate.service +%{_unitdir}/system-update.target.wants %{_unitdir}/grub2-systemd-integration.service +%{_unitdir}/reboot.target.wants %{_unitdir}/systemd-logind.service.d %{_infodir}/grub2* %{_datarootdir}/grub/* @@ -548,6 +555,12 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Nov 14 2023 Hans de Goede - 2.06-107 +- spec: Switch back to static enablement for grub services in tools package +- spec: Add %%triggerpostun to apply grub-boot-success.timer preset + when upgrading from older versions where this was not a preset +- Resolves: #2247635 + * Mon Nov 6 2023 Nicolas Frayer - 2.06-106 - util: grub-install on EFI if forced - Resolves: #1917213 From 88924af5542a25edcd1515b2db0540a600eebf09 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 14 Nov 2023 15:56:01 +0100 Subject: [PATCH 210/294] Remove [Install] section from aux systemd units Related: #2247635 Signed-off-by: Nicolas Frayer --- ...stall-section-from-aux-systemd-units.patch | 33 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 0340-Remove-Install-section-from-aux-systemd-units.patch diff --git a/0340-Remove-Install-section-from-aux-systemd-units.patch b/0340-Remove-Install-section-from-aux-systemd-units.patch new file mode 100644 index 00000000..1a62cddb --- /dev/null +++ b/0340-Remove-Install-section-from-aux-systemd-units.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Glombek +Date: Tue, 14 Nov 2023 07:54:59 +0100 +Subject: [PATCH] Remove [Install] section from aux systemd units + +See https://bugzilla.redhat.com/show_bug.cgi?id=2247635#c7 +--- + docs/grub-boot-indeterminate.service | 3 --- + util/systemd/grub-systemd-integration.service.in | 3 --- + 2 files changed, 6 deletions(-) + +diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service +index 5bcb474a3d31..6c8dcb186b63 100644 +--- a/docs/grub-boot-indeterminate.service ++++ b/docs/grub-boot-indeterminate.service +@@ -9,6 +9,3 @@ Before=system-update-pre.target + [Service] + Type=oneshot + ExecStart=/usr/bin/grub2-editenv - incr boot_indeterminate +- +-[Install] +-WantedBy=system-update.target +diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in +index 22ca1ca4885e..c81fb594ce17 100644 +--- a/util/systemd/grub-systemd-integration.service.in ++++ b/util/systemd/grub-systemd-integration.service.in +@@ -6,6 +6,3 @@ ConditionPathExists=/run/systemd/reboot-to-boot-loader-menu + + [Service] + ExecStart=@libexecdir@/@grubdirname@/systemd-integration.sh +- +-[Install] +-WantedBy=reboot.target diff --git a/grub.patches b/grub.patches index 90e54622..7228ddef 100644 --- a/grub.patches +++ b/grub.patches @@ -337,3 +337,4 @@ Patch0336: 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch Patch0337: 0337-Fix-missing-include-in-ofdisk.c.patch Patch0338: 0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch Patch0339: 0339-grub-install-on-EFI-if-forced.patch +Patch0340: 0340-Remove-Install-section-from-aux-systemd-units.patch diff --git a/grub2.spec b/grub2.spec index 0c650983..2f5a9942 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 107%{?dist} +Release: 108%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Nov 14 2023 Nicolas Frayer - 2.06-108 +- Remove [Install] section from aux systemd units +- Related: #2247635 + * Tue Nov 14 2023 Hans de Goede - 2.06-107 - spec: Switch back to static enablement for grub services in tools package - spec: Add %%triggerpostun to apply grub-boot-success.timer preset From 7b857b827a7ace777e9aebde3dbd5c70a8c3c67c Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Thu, 9 Nov 2023 18:05:37 +0100 Subject: [PATCH 211/294] Linker: added --no-warn-rwx-segments linker option added --no-warn-rwx-segments as build will fail after ld.bfd default options have been changed. Please refer: https://fedoraproject.org/wiki/Changes/Linker_Error_On_Security_Issues Signed-off-by: Nicolas Frayer --- grub.macros | 4 ++-- grub2.spec | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/grub.macros b/grub.macros index 959b9729..0198ffc3 100644 --- a/grub.macros +++ b/grub.macros @@ -15,7 +15,7 @@ %endif # gnulib actively ignores CFLAGS because it's terrible -%global cc_equals "CC=%{ccpath} -fPIE -Wl,-z,noexecstack" +%global cc_equals "CC=%{ccpath} -fPIE -Wl,-z,noexecstack -Wl,--no-warn-rwx-segments" %global cflags_sed \\\ sed \\\ @@ -68,7 +68,7 @@ )} %global efi_host_ldflags %{expand:%%(echo %{host_ldflags})} -%global target_ldflags %{expand:%%(echo %{build_ldflags} -static | %{ldflags_sed})} +%global target_ldflags %{expand:%%(echo %{build_ldflags} -Wl,--no-warn-rwx-segments -static | %{ldflags_sed})} %global legacy_target_ldflags \\\ %{expand:%%(echo %{target_ldflags} | \\\ %{ldflags_sed} \\\ diff --git a/grub2.spec b/grub2.spec index 2f5a9942..456b70f0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 108%{?dist} +Release: 109%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Nov 15 2023 Nicolas Frayer - 2.06-109 +- Linker: added --no-warn-rwx-segments as build will fail after +ld.bfd default options have been changed. +https://fedoraproject.org/wiki/Changes/Linker_Error_On_Security_Issues + * Tue Nov 14 2023 Nicolas Frayer - 2.06-108 - Remove [Install] section from aux systemd units - Related: #2247635 From c4a49e5c9acf320544d35f83eeab02818eb8df2a Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 1 Dec 2023 10:31:36 +0100 Subject: [PATCH 212/294] fs/xfs: Add several fixes/improvements to xfs fs from upstream Resolves: #2247926 Signed-off-by: Nicolas Frayer --- 0341-fs-Remove-trailing-whitespaces.patch | 1681 +++++++++++++++++ ...s-xfs-Fix-memory-leaks-in-XFS-module.patch | 47 + ...s-found-while-fuzzing-the-XFS-filesy.patch | 106 ++ ...-short-form-directory-data-boundary-.patch | 47 + ...xfs-Fix-XFS-directory-extent-parsing.patch | 168 ++ ...-extent-counters-incompat-feature-su.patch | 115 ++ grub.patches | 6 + grub2.spec | 6 +- 8 files changed, 2175 insertions(+), 1 deletion(-) create mode 100644 0341-fs-Remove-trailing-whitespaces.patch create mode 100644 0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch create mode 100644 0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch create mode 100644 0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch create mode 100644 0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch create mode 100644 0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch diff --git a/0341-fs-Remove-trailing-whitespaces.patch b/0341-fs-Remove-trailing-whitespaces.patch new file mode 100644 index 00000000..a876f6b1 --- /dev/null +++ b/0341-fs-Remove-trailing-whitespaces.patch @@ -0,0 +1,1681 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Elyes Haouas +Date: Fri, 4 Mar 2022 07:41:59 +0100 +Subject: [PATCH] fs: Remove trailing whitespaces + +Signed-off-by: Elyes Haouas +Reviewed-by: Daniel Kiper +--- + grub-core/fs/affs.c | 4 +- + grub-core/fs/archelp.c | 4 +- + grub-core/fs/bfs.c | 10 +- + grub-core/fs/cpio_common.c | 2 +- + grub-core/fs/fat.c | 6 +- + grub-core/fs/fshelp.c | 6 +- + grub-core/fs/hfs.c | 14 +-- + grub-core/fs/hfsplus.c | 8 +- + grub-core/fs/hfspluscomp.c | 6 +- + grub-core/fs/iso9660.c | 12 +-- + grub-core/fs/minix.c | 6 +- + grub-core/fs/nilfs2.c | 8 +- + grub-core/fs/ntfs.c | 8 +- + grub-core/fs/reiserfs.c | 2 +- + grub-core/fs/romfs.c | 8 +- + grub-core/fs/squash4.c | 26 ++--- + grub-core/fs/udf.c | 2 +- + grub-core/fs/ufs.c | 4 +- + grub-core/fs/xfs.c | 2 +- + grub-core/fs/zfs/zfs.c | 224 ++++++++++++++++++++-------------------- + grub-core/fs/zfs/zfs_fletcher.c | 12 +-- + grub-core/fs/zfs/zfs_sha256.c | 14 +-- + grub-core/fs/zfs/zfscrypt.c | 14 +-- + 23 files changed, 201 insertions(+), 201 deletions(-) + +diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c +index cafcd0fba916..0d90e9d1a895 100644 +--- a/grub-core/fs/affs.c ++++ b/grub-core/fs/affs.c +@@ -345,7 +345,7 @@ grub_affs_create_node (grub_fshelp_node_t dir, + if (len > sizeof (fil->name)) + len = sizeof (fil->name); + *grub_latin1_to_utf8 (name_u8, fil->name, len) = '\0'; +- ++ + (*node)->di = *fil; + for (nest = 0; nest < 8; nest++) + { +@@ -408,7 +408,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir, + node = orig_node = grub_zalloc (sizeof (*node)); + if (!node) + return 1; +- ++ + *node = *dir; + if (hook (".", GRUB_FSHELP_DIR, node, hook_data)) + return 1; +diff --git a/grub-core/fs/archelp.c b/grub-core/fs/archelp.c +index 0cf544f6fdfe..998de88b865c 100644 +--- a/grub-core/fs/archelp.c ++++ b/grub-core/fs/archelp.c +@@ -75,7 +75,7 @@ handle_symlink (struct grub_archelp_data *data, + || !arcops->get_link_target) + return GRUB_ERR_NONE; + flen = grub_strlen (fn); +- if (grub_memcmp (*name, fn, flen) != 0 ++ if (grub_memcmp (*name, fn, flen) != 0 + || ((*name)[flen] != 0 && (*name)[flen] != '/')) + return GRUB_ERR_NONE; + rest = *name + flen; +@@ -251,7 +251,7 @@ grub_archelp_open (struct grub_archelp_data *data, + grub_uint32_t mode; + grub_int32_t mtime; + int restart; +- ++ + if (arcops->find_file (data, &fn, &mtime, &mode)) + goto fail; + +diff --git a/grub-core/fs/bfs.c b/grub-core/fs/bfs.c +index 47dbe2011a14..a75876010d30 100644 +--- a/grub-core/fs/bfs.c ++++ b/grub-core/fs/bfs.c +@@ -530,13 +530,13 @@ iterate_in_b_tree (grub_disk_t disk, + err = read_b_node (disk, sb, ino, + node_off, + &node, +- &key_data, ++ &key_data, + &keylen_idx, + &key_values); + + if (err) + return 0; +- ++ + for (i = 0; i < grub_bfs_to_cpu_treehead (node->count_keys); i++) + { + char c; +@@ -682,7 +682,7 @@ find_in_b_tree (grub_disk_t disk, + level--; + grub_free (node); + continue; +- } ++ } + } + else if (level != 0 + && i + 1 < grub_bfs_to_cpu_treehead (node->count_keys)) +@@ -827,7 +827,7 @@ mount (grub_disk_t disk, struct grub_bfs_superblock *sb) + grub_err_t err; + err = grub_disk_read (disk, SUPERBLOCK, 0, sizeof (*sb), sb); + if (err == GRUB_ERR_OUT_OF_RANGE) +- return grub_error (GRUB_ERR_BAD_FS, ++ return grub_error (GRUB_ERR_BAD_FS, + #ifdef MODE_AFS + "not an AFS filesystem" + #else +@@ -843,7 +843,7 @@ mount (grub_disk_t disk, struct grub_bfs_superblock *sb) + || (grub_bfs_to_cpu32 (sb->bsize) + != (1U << grub_bfs_to_cpu32 (sb->log2_bsize))) + || grub_bfs_to_cpu32 (sb->log2_bsize) < GRUB_DISK_SECTOR_BITS) +- return grub_error (GRUB_ERR_BAD_FS, ++ return grub_error (GRUB_ERR_BAD_FS, + #ifdef MODE_AFS + "not an AFS filesystem" + #else +diff --git a/grub-core/fs/cpio_common.c b/grub-core/fs/cpio_common.c +index 4e885d62313e..5d41b6fdbe1c 100644 +--- a/grub-core/fs/cpio_common.c ++++ b/grub-core/fs/cpio_common.c +@@ -117,7 +117,7 @@ grub_cpio_get_link_target (struct grub_archelp_data *data) + if (!ret) + return NULL; + +- err = grub_disk_read (data->disk, 0, data->dofs, data->size, ++ err = grub_disk_read (data->disk, 0, data->dofs, data->size, + ret); + if (err) + { +diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c +index ff6200c5be5d..c5efed724124 100644 +--- a/grub-core/fs/fat.c ++++ b/grub-core/fs/fat.c +@@ -246,7 +246,7 @@ grub_fat_mount (grub_disk_t disk) + #ifdef MODE_EXFAT + if (grub_memcmp ((const char *) bpb.oem_name, "EXFAT ", + sizeof (bpb.oem_name)) != 0) +- goto fail; ++ goto fail; + #endif + + /* Get the sizes of logical sectors and clusters. */ +@@ -321,7 +321,7 @@ grub_fat_mount (grub_disk_t disk) + #endif + + #ifdef MODE_EXFAT +- data->cluster_sector = (grub_le_to_cpu32 (bpb.cluster_offset) ++ data->cluster_sector = (grub_le_to_cpu32 (bpb.cluster_offset) + << data->logical_sector_bits); + data->num_clusters = (grub_le_to_cpu32 (bpb.cluster_count) + << data->logical_sector_bits); +@@ -694,7 +694,7 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, + { + int j; + for (j = 0; j < 15; j++) +- ctxt->unibuf[slots * 15 + j] ++ ctxt->unibuf[slots * 15 + j] + = grub_le_to_cpu16 (sec.type_specific.file_name.str[j]); + slots++; + } +diff --git a/grub-core/fs/fshelp.c b/grub-core/fs/fshelp.c +index a2d0d297a520..cb41934b4fec 100644 +--- a/grub-core/fs/fshelp.c ++++ b/grub-core/fs/fshelp.c +@@ -215,7 +215,7 @@ find_file (char *currpath, + break; + + push_node (ctx, foundnode, foundtype); +- ++ + /* Read in the symlink and follow it. */ + if (ctx->currnode->type == GRUB_FSHELP_SYMLINK) + { +@@ -326,7 +326,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode, + enum grub_fshelp_filetype expecttype) + { + return grub_fshelp_find_file_real (path, rootnode, foundnode, +- iterate_dir, NULL, ++ iterate_dir, NULL, + read_symlink, expecttype); + + } +@@ -339,7 +339,7 @@ grub_fshelp_find_file_lookup (const char *path, grub_fshelp_node_t rootnode, + enum grub_fshelp_filetype expecttype) + { + return grub_fshelp_find_file_real (path, rootnode, foundnode, +- NULL, lookup_file, ++ NULL, lookup_file, + read_symlink, expecttype); + + } +diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c +index f419965d154f..91dc0e69c3de 100644 +--- a/grub-core/fs/hfs.c ++++ b/grub-core/fs/hfs.c +@@ -883,7 +883,7 @@ grub_hfs_iterate_dir_it_dir (struct grub_hfs_node *hnd __attribute ((unused)), + { + struct grub_hfs_catalog_key *ckey = rec->key; + struct grub_hfs_iterate_dir_node_found_ctx *ctx = hook_arg; +- ++ + /* Stop when the entries do not match anymore. */ + if (ckey->parent_dir != ctx->dir_be) + return 1; +@@ -1077,7 +1077,7 @@ macroman_to_utf8 (char *to, const grub_uint8_t *from, grub_size_t len, + { + *optr++ = ':'; + continue; +- } ++ } + if (!(*iptr & 0x80)) + { + *optr++ = *iptr; +@@ -1094,7 +1094,7 @@ utf8_to_macroman (grub_uint8_t *to, const char *from) + grub_uint8_t *end = to + 31; + grub_uint8_t *optr = to; + const char *iptr = from; +- ++ + while (*iptr && optr < end) + { + int i, clen; +@@ -1104,7 +1104,7 @@ utf8_to_macroman (grub_uint8_t *to, const char *from) + *optr++ = '/'; + iptr++; + continue; +- } ++ } + if (!(*iptr & 0x80)) + { + *optr++ = *iptr++; +@@ -1165,7 +1165,7 @@ lookup_file (grub_fshelp_node_t dir, + *foundnode = grub_malloc (sizeof (struct grub_fshelp_node)); + if (!*foundnode) + return grub_errno; +- ++ + (*foundnode)->inode = grub_be_to_cpu32 (fdrec.dir.dirid); + (*foundnode)->fdrec = fdrec; + (*foundnode)->data = dir->data; +@@ -1266,7 +1266,7 @@ grub_hfs_dir (grub_device_t device, const char *path, grub_fs_dir_hook_t hook, + .hook_data = hook_data + }; + grub_fshelp_node_t found = NULL; +- ++ + grub_dl_ref (my_mod); + + data = grub_hfs_mount (device->disk); +@@ -1295,7 +1295,7 @@ grub_hfs_open (struct grub_file *file, const char *name) + { + struct grub_hfs_data *data; + grub_fshelp_node_t found = NULL; +- ++ + grub_dl_ref (my_mod); + + data = grub_hfs_mount (file->device->disk); +diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c +index 19c7b3367987..6337cbfcbec6 100644 +--- a/grub-core/fs/hfsplus.c ++++ b/grub-core/fs/hfsplus.c +@@ -19,7 +19,7 @@ + + /* HFS+ is documented at http://developer.apple.com/technotes/tn/tn1150.html */ + +-#define grub_fshelp_node grub_hfsplus_file ++#define grub_fshelp_node grub_hfsplus_file + #include + #include + #include +@@ -146,7 +146,7 @@ grub_hfsplus_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + { + struct grub_hfsplus_btnode *nnode = 0; + grub_disk_addr_t blksleft = fileblock; +- struct grub_hfsplus_extent *extents = node->compressed ++ struct grub_hfsplus_extent *extents = node->compressed + ? &node->resource_extents[0] : &node->extents[0]; + + while (1) +@@ -477,7 +477,7 @@ grub_hfsplus_cmp_extkey (struct grub_hfsplus_key *keya, + + if (extkey_a->type < extkey_b->type) + return -1; +- ++ + akey = grub_be_to_cpu32 (extkey_a->start); + if (akey > extkey_b->start) + return 1; +@@ -568,7 +568,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree, + struct grub_hfsplus_key_internal *key, + int (*compare_keys) (struct grub_hfsplus_key *keya, + struct grub_hfsplus_key_internal *keyb), +- struct grub_hfsplus_btnode **matchnode, ++ struct grub_hfsplus_btnode **matchnode, + grub_off_t *keyoffset) + { + grub_uint64_t currnode; +diff --git a/grub-core/fs/hfspluscomp.c b/grub-core/fs/hfspluscomp.c +index d76f3f137a92..095ea48c9a62 100644 +--- a/grub-core/fs/hfspluscomp.c ++++ b/grub-core/fs/hfspluscomp.c +@@ -179,7 +179,7 @@ hfsplus_read_compressed_real (struct grub_hfsplus_file *node, + return len0; + } + +-static grub_err_t ++static grub_err_t + hfsplus_open_compressed_real (struct grub_hfsplus_file *node) + { + grub_err_t err; +@@ -306,8 +306,8 @@ hfsplus_open_compressed_real (struct grub_hfsplus_file *node) + + GRUB_MOD_INIT(hfspluscomp) + { +- grub_hfsplus_open_compressed = hfsplus_open_compressed_real; +- grub_hfsplus_read_compressed = hfsplus_read_compressed_real; ++ grub_hfsplus_open_compressed = hfsplus_open_compressed_real; ++ grub_hfsplus_read_compressed = hfsplus_read_compressed_real; + } + + GRUB_MOD_FINI(hfspluscomp) +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index ac011950a64f..91817ec1f5ad 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -181,7 +181,7 @@ static grub_err_t + iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int64_t *nix) + { + struct grub_datetime datetime; +- ++ + if (! i->year[0] && ! i->year[1] + && ! i->year[2] && ! i->year[3] + && ! i->month[0] && ! i->month[1] +@@ -198,7 +198,7 @@ iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int64_t *nix) + datetime.hour = (i->hour[0] - '0') * 10 + (i->hour[1] - '0'); + datetime.minute = (i->minute[0] - '0') * 10 + (i->minute[1] - '0'); + datetime.second = (i->second[0] - '0') * 10 + (i->second[1] - '0'); +- ++ + if (!grub_datetime2unixtime (&datetime, nix)) + return grub_error (GRUB_ERR_BAD_NUMBER, "incorrect date"); + *nix -= i->offset * 60 * 15; +@@ -216,7 +216,7 @@ iso9660_to_unixtime2 (const struct grub_iso9660_date2 *i, grub_int64_t *nix) + datetime.hour = i->hour; + datetime.minute = i->minute; + datetime.second = i->second; +- ++ + if (!grub_datetime2unixtime (&datetime, nix)) + return 0; + *nix -= i->offset * 60 * 15; +@@ -499,7 +499,7 @@ grub_iso9660_mount (grub_disk_t disk) + static char * + grub_iso9660_read_symlink (grub_fshelp_node_t node) + { +- return node->have_symlink ++ return node->have_symlink + ? grub_strdup (node->symlink + + (node->have_dirents) * sizeof (node->dirents[0]) + - sizeof (node->dirents)) : grub_strdup (""); +@@ -549,7 +549,7 @@ add_part (struct iterate_dir_ctx *ctx, + ctx->symlink = new; + + grub_memcpy (ctx->symlink + size, part, len2); +- ctx->symlink[size + len2] = 0; ++ ctx->symlink[size + len2] = 0; + } + + static grub_err_t +@@ -1106,7 +1106,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid) + } + + /* Get writing time of filesystem. */ +-static grub_err_t ++static grub_err_t + grub_iso9660_mtime (grub_device_t device, grub_int64_t *timebuf) + { + struct grub_iso9660_data *data; +diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c +index 3cd18c85b302..953df11916b8 100644 +--- a/grub-core/fs/minix.c ++++ b/grub-core/fs/minix.c +@@ -98,10 +98,10 @@ struct grub_minix_sblock + grub_uint32_t max_file_size; + grub_uint32_t zones; + grub_uint16_t magic; +- ++ + grub_uint16_t pad2; + grub_uint16_t block_size; +- grub_uint8_t disk_version; ++ grub_uint8_t disk_version; + }; + #else + struct grub_minix_sblock +@@ -351,7 +351,7 @@ grub_minix_read_inode (struct grub_minix_data *data, grub_minix_ino_t ino) + int offs = (ino % (GRUB_DISK_SECTOR_SIZE + / sizeof (struct grub_minix_inode)) + * sizeof (struct grub_minix_inode)); +- ++ + grub_disk_read (data->disk, block, offs, + sizeof (struct grub_minix_inode), &data->inode); + +diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c +index 3c248a910b42..fc7374ead490 100644 +--- a/grub-core/fs/nilfs2.c ++++ b/grub-core/fs/nilfs2.c +@@ -1,5 +1,5 @@ +-/* +- * nilfs2.c - New Implementation of Log filesystem ++/* ++ * nilfs2.c - New Implementation of Log filesystem + * + * Written by Jiro SEKIBA + * +@@ -680,12 +680,12 @@ grub_nilfs2_read_checkpoint (struct grub_nilfs2_data *data, + grub_disk_t disk = data->disk; + unsigned int nilfs2_block_count = (1 << LOG2_NILFS2_BLOCK_SIZE (data)); + +- /* Assume sizeof(struct grub_nilfs2_cpfile_header) < ++ /* Assume sizeof(struct grub_nilfs2_cpfile_header) < + sizeof(struct grub_nilfs2_checkpoint). + */ + blockno = grub_divmod64 (cpno, NILFS2_BLOCK_SIZE (data) / + sizeof (struct grub_nilfs2_checkpoint), &offset); +- ++ + pptr = grub_nilfs2_bmap_lookup (data, &data->sroot.sr_cpfile, blockno, 1); + if (pptr == (grub_uint64_t) - 1) + { +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 2f34f76da88c..3511e4e2cb6f 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -17,7 +17,7 @@ + * along with this program. If not, see . + */ + +-#define grub_fshelp_node grub_ntfs_file ++#define grub_fshelp_node grub_ntfs_file + + #include + #include +@@ -32,7 +32,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + static grub_dl_t my_mod; + +-#define grub_fshelp_node grub_ntfs_file ++#define grub_fshelp_node grub_ntfs_file + + static inline grub_uint16_t + u16at (void *ptr, grub_size_t ofs) +@@ -725,7 +725,7 @@ grub_ntfs_read_symlink (grub_fshelp_node_t node) + && grub_isalpha (buf[4])) + { + grub_memmove (buf, buf + 6, end - buf + 1 - 6); +- end -= 6; ++ end -= 6; + } + return buf; + } +@@ -992,7 +992,7 @@ grub_ntfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype, + grub_memset (&info, 0, sizeof (info)); + info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR); + info.mtimeset = 1; +- info.mtime = grub_divmod64 (node->mtime, 10000000, 0) ++ info.mtime = grub_divmod64 (node->mtime, 10000000, 0) + - 86400ULL * 365 * (1970 - 1601) + - 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100); + grub_free (node); +diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c +index b8253da7fed2..42818c376229 100644 +--- a/grub-core/fs/reiserfs.c ++++ b/grub-core/fs/reiserfs.c +@@ -775,7 +775,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item, + char *entry_name; + char *entry_name_end = 0; + char c; +- ++ + if (!(entry_state & GRUB_REISERFS_VISIBLE_MASK)) + continue; + +diff --git a/grub-core/fs/romfs.c b/grub-core/fs/romfs.c +index d97b8fbb8c36..1f7dcfca1d3a 100644 +--- a/grub-core/fs/romfs.c ++++ b/grub-core/fs/romfs.c +@@ -112,7 +112,7 @@ grub_romfs_mount (grub_device_t dev) + { + grub_error (GRUB_ERR_BAD_FS, "not romfs"); + return NULL; +- } ++ } + err = do_checksum (&sb, sizeof (sb) < grub_be_to_cpu32 (sb.sb.total_size) ? + sizeof (sb) : grub_be_to_cpu32 (sb.sb.total_size)); + if (err) +@@ -271,7 +271,7 @@ grub_romfs_iterate_dir (grub_fshelp_node_t dir, + while (1) + { + char buf[16]; +- err = grub_disk_read (dir->data->disk, ++ err = grub_disk_read (dir->data->disk, + laddr >> GRUB_DISK_SECTOR_BITS, + laddr & (GRUB_DISK_SECTOR_SIZE - 1), + 16, buf); +@@ -298,7 +298,7 @@ grub_romfs_iterate_dir (grub_fshelp_node_t dir, + node->data_addr = grub_be_to_cpu32 (node->file.spec); + filetype = GRUB_FSHELP_DIR; + } +- ++ + break; + } + } +@@ -402,7 +402,7 @@ grub_romfs_read (grub_file_t file, char *buf, grub_size_t len) + data->data->disk->read_hook_data = file->read_hook_data; + grub_disk_read (data->data->disk, + (data->data_addr + file->offset) >> GRUB_DISK_SECTOR_BITS, +- (data->data_addr + file->offset) & (GRUB_DISK_SECTOR_SIZE - 1), ++ (data->data_addr + file->offset) & (GRUB_DISK_SECTOR_SIZE - 1), + len, buf); + data->data->disk->read_hook = NULL; + +diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c +index 6dd731e231ee..02b1f9b6d101 100644 +--- a/grub-core/fs/squash4.c ++++ b/grub-core/fs/squash4.c +@@ -210,7 +210,7 @@ struct grub_fshelp_node + struct grub_squash_data *data; + struct grub_squash_inode ino; + grub_size_t stsize; +- struct ++ struct + { + grub_disk_addr_t ino_chunk; + grub_uint16_t ino_offset; +@@ -243,7 +243,7 @@ read_chunk (struct grub_squash_data *data, void *buf, grub_size_t len, + csize = SQUASH_CHUNK_SIZE - offset; + if (csize > len) + csize = len; +- ++ + if (grub_le_to_cpu16 (d) & SQUASH_CHUNK_UNCOMPRESSED) + { + grub_disk_addr_t a = chunk_start + 2 + offset; +@@ -256,7 +256,7 @@ read_chunk (struct grub_squash_data *data, void *buf, grub_size_t len, + else + { + char *tmp; +- grub_size_t bsize = grub_le_to_cpu16 (d) & ~SQUASH_CHUNK_FLAGS; ++ grub_size_t bsize = grub_le_to_cpu16 (d) & ~SQUASH_CHUNK_FLAGS; + grub_disk_addr_t a = chunk_start + 2; + tmp = grub_malloc (bsize); + if (!tmp) +@@ -339,7 +339,7 @@ xz_decompress (char *inbuf, grub_size_t insize, grub_off_t off, + while (len) + { + enum xz_ret xzret; +- ++ + buf.out_pos = 0; + + xzret = xz_dec_run (data->xzdec, &buf); +@@ -399,9 +399,9 @@ squash_mount (grub_disk_t disk) + return NULL; + } + +- err = grub_disk_read (disk, ++ err = grub_disk_read (disk, + grub_le_to_cpu64 (sb.unk1offset) +- >> GRUB_DISK_SECTOR_BITS, ++ >> GRUB_DISK_SECTOR_BITS, + grub_le_to_cpu64 (sb.unk1offset) + & (GRUB_DISK_SECTOR_SIZE - 1), sizeof (frag), &frag); + if (grub_errno == GRUB_ERR_OUT_OF_RANGE) +@@ -448,7 +448,7 @@ squash_mount (grub_disk_t disk) + } + + data->blksz = grub_le_to_cpu32 (data->sb.block_size); +- for (data->log2_blksz = 0; ++ for (data->log2_blksz = 0; + (1U << data->log2_blksz) < data->blksz; + data->log2_blksz++); + +@@ -643,7 +643,7 @@ make_root_node (struct grub_squash_data *data, struct grub_fshelp_node *root) + root->stack[0].ino_chunk = grub_le_to_cpu32 (data->sb.root_ino_chunk); + root->stack[0].ino_offset = grub_cpu_to_le16 (data->sb.root_ino_offset); + return read_chunk (data, &root->ino, sizeof (root->ino), +- grub_le_to_cpu64 (data->sb.inodeoffset) ++ grub_le_to_cpu64 (data->sb.inodeoffset) + + root->stack[0].ino_chunk, + root->stack[0].ino_offset); + } +@@ -765,7 +765,7 @@ grub_squash_open (struct grub_file *file, const char *name) + } + + static grub_ssize_t +-direct_read (struct grub_squash_data *data, ++direct_read (struct grub_squash_data *data, + struct grub_squash_cache_inode *ino, + grub_off_t off, char *buf, grub_size_t len) + { +@@ -882,7 +882,7 @@ direct_read (struct grub_squash_data *data, + grub_free (block); + } + else +- err = grub_disk_read (data->disk, ++ err = grub_disk_read (data->disk, + (ino->cumulated_block_sizes[i] + a + boff) + >> GRUB_DISK_SECTOR_BITS, + (ino->cumulated_block_sizes[i] + a + boff) +@@ -946,7 +946,7 @@ grub_squash_read (grub_file_t file, char *buf, grub_size_t len) + } + else + off -= direct_len; +- ++ + err = read_chunk (data, &frag, sizeof (frag), + data->fragments, sizeof (frag) * fragment); + if (err) +@@ -957,7 +957,7 @@ grub_squash_read (grub_file_t file, char *buf, grub_size_t len) + b = grub_le_to_cpu32 (ino->ino.long_file.offset) + off; + else + b = grub_le_to_cpu32 (ino->ino.file.offset) + off; +- ++ + /* FIXME: cache uncompressed chunks. */ + if (compressed) + { +@@ -1013,7 +1013,7 @@ grub_squash_mtime (grub_device_t dev, grub_int64_t *tm) + *tm = grub_le_to_cpu32 (data->sb.creation_time); + squash_unmount (data); + return GRUB_ERR_NONE; +-} ++} + + static struct grub_fs grub_squash_fs = + { +diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c +index 2ac5c1d0048f..5a665093ed77 100644 +--- a/grub-core/fs/udf.c ++++ b/grub-core/fs/udf.c +@@ -567,7 +567,7 @@ grub_udf_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + (buf + sizeof (struct grub_udf_aed)); + continue; + } +- ++ + if (filebytes < adlen) + { + grub_uint32_t ad_block_num = ad->block.block_num; +diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c +index 34a698b71b8d..a354c92d936a 100644 +--- a/grub-core/fs/ufs.c ++++ b/grub-core/fs/ufs.c +@@ -568,7 +568,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path) + { + dirino = data->ino; + grub_ufs_read_inode (data, grub_ufs_to_cpu32 (dirent.ino), 0); +- ++ + if ((INODE_MODE(data) & GRUB_UFS_ATTR_TYPE) + == GRUB_UFS_ATTR_LNK) + { +@@ -613,7 +613,7 @@ grub_ufs_mount (grub_disk_t disk) + && ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0) + && data->sblock.ino_per_group != 0) + { +- for (data->log2_blksz = 0; ++ for (data->log2_blksz = 0; + (1U << data->log2_blksz) < grub_ufs_to_cpu32 (data->sblock.bsize); + data->log2_blksz++); + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index e3816d1ec4a9..d6de7f1a2dd2 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -894,7 +894,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + tag, which is not used by GRUB. So it can be overwritten. */ + filename[direntry->len] = '\0'; + +- if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode), ++ if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode), + filename, &ctx)) + { + grub_free (dirblock); +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index cf4d2ab189a5..5961818abc9a 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -176,7 +176,7 @@ typedef struct decomp_entry + /* + * Signature for checksum functions. + */ +-typedef void zio_checksum_t(const void *data, grub_uint64_t size, ++typedef void zio_checksum_t(const void *data, grub_uint64_t size, + grub_zfs_endian_t endian, zio_cksum_t *zcp); + + /* +@@ -297,7 +297,7 @@ check_feature(const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx) + static grub_err_t + check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data ); + +-static grub_err_t ++static grub_err_t + zlib_decompress (void *s, void *d, + grub_size_t slen, grub_size_t dlen) + { +@@ -310,7 +310,7 @@ zlib_decompress (void *s, void *d, + return grub_errno; + } + +-static grub_err_t ++static grub_err_t + zle_decompress (void *s, void *d, + grub_size_t slen, grub_size_t dlen) + { +@@ -415,7 +415,7 @@ static zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { + */ + static grub_err_t + zio_checksum_verify (zio_cksum_t zc, grub_uint32_t checksum, +- grub_zfs_endian_t endian, ++ grub_zfs_endian_t endian, + char *buf, grub_size_t size) + { + zio_eck_t *zec = (zio_eck_t *) (buf + size) - 1; +@@ -425,14 +425,14 @@ zio_checksum_verify (zio_cksum_t zc, grub_uint32_t checksum, + if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func == NULL) + { + grub_dprintf ("zfs", "unknown checksum function %d\n", checksum); +- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "unknown checksum function %d", checksum); + } + + if (ci->ci_eck) + { +- expected_cksum = zec->zec_cksum; +- zec->zec_cksum = zc; ++ expected_cksum = zec->zec_cksum; ++ zec->zec_cksum = zc; + ci->ci_func (buf, size, endian, &actual_cksum); + zec->zec_cksum = expected_cksum; + zc = expected_cksum; +@@ -445,14 +445,14 @@ zio_checksum_verify (zio_cksum_t zc, grub_uint32_t checksum, + { + grub_dprintf ("zfs", "checksum %s verification failed\n", ci->ci_name); + grub_dprintf ("zfs", "actual checksum %016llx %016llx %016llx %016llx\n", +- (unsigned long long) actual_cksum.zc_word[0], ++ (unsigned long long) actual_cksum.zc_word[0], + (unsigned long long) actual_cksum.zc_word[1], +- (unsigned long long) actual_cksum.zc_word[2], ++ (unsigned long long) actual_cksum.zc_word[2], + (unsigned long long) actual_cksum.zc_word[3]); + grub_dprintf ("zfs", "expected checksum %016llx %016llx %016llx %016llx\n", +- (unsigned long long) zc.zc_word[0], ++ (unsigned long long) zc.zc_word[0], + (unsigned long long) zc.zc_word[1], +- (unsigned long long) zc.zc_word[2], ++ (unsigned long long) zc.zc_word[2], + (unsigned long long) zc.zc_word[3]); + return grub_error (GRUB_ERR_BAD_FS, N_("checksum verification failed")); + } +@@ -485,17 +485,17 @@ vdev_uberblock_compare (uberblock_t * ub1, uberblock_t * ub2) + else + ub2_endian = GRUB_ZFS_BIG_ENDIAN; + +- if (grub_zfs_to_cpu64 (ub1->ub_txg, ub1_endian) ++ if (grub_zfs_to_cpu64 (ub1->ub_txg, ub1_endian) + < grub_zfs_to_cpu64 (ub2->ub_txg, ub2_endian)) + return -1; +- if (grub_zfs_to_cpu64 (ub1->ub_txg, ub1_endian) ++ if (grub_zfs_to_cpu64 (ub1->ub_txg, ub1_endian) + > grub_zfs_to_cpu64 (ub2->ub_txg, ub2_endian)) + return 1; + +- if (grub_zfs_to_cpu64 (ub1->ub_timestamp, ub1_endian) ++ if (grub_zfs_to_cpu64 (ub1->ub_timestamp, ub1_endian) + < grub_zfs_to_cpu64 (ub2->ub_timestamp, ub2_endian)) + return -1; +- if (grub_zfs_to_cpu64 (ub1->ub_timestamp, ub1_endian) ++ if (grub_zfs_to_cpu64 (ub1->ub_timestamp, ub1_endian) + > grub_zfs_to_cpu64 (ub2->ub_timestamp, ub2_endian)) + return 1; + +@@ -573,7 +573,7 @@ find_bestub (uberblock_phys_t * ub_array, + grub_errno = GRUB_ERR_NONE; + continue; + } +- if (ubbest == NULL ++ if (ubbest == NULL + || vdev_uberblock_compare (&(ubptr->ubp_uberblock), + &(ubbest->ubp_uberblock)) > 0) + ubbest = ubptr; +@@ -594,10 +594,10 @@ get_psize (blkptr_t * bp, grub_zfs_endian_t endian) + static grub_uint64_t + dva_get_offset (const dva_t *dva, grub_zfs_endian_t endian) + { +- grub_dprintf ("zfs", "dva=%llx, %llx\n", +- (unsigned long long) dva->dva_word[0], ++ grub_dprintf ("zfs", "dva=%llx, %llx\n", ++ (unsigned long long) dva->dva_word[0], + (unsigned long long) dva->dva_word[1]); +- return grub_zfs_to_cpu64 ((dva)->dva_word[1], ++ return grub_zfs_to_cpu64 ((dva)->dva_word[1], + endian) << SPA_MINBLOCKSHIFT; + } + +@@ -720,7 +720,7 @@ fill_vdev_info_real (struct grub_zfs_data *data, + if (!fill->children) + { + fill->n_children = nelm; +- ++ + fill->children = grub_zalloc (fill->n_children + * sizeof (fill->children[0])); + } +@@ -839,7 +839,7 @@ nvlist_next_nvpair (const char *nvl, const char *nvpair) + { + /* skip over header, nvl_version and nvl_nvflag */ + nvpair = nvl + 4 * 3; +- } ++ } + else + { + /* skip to the next nvpair */ +@@ -873,10 +873,10 @@ nvlist_next_nvpair (const char *nvl, const char *nvpair) + name_len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp)); + nvp += 4; + +- nvp = nvp + ((name_len + 3) & ~3); // align +- if (nvp + 4 >= nvl + VDEV_PHYS_SIZE ++ nvp = nvp + ((name_len + 3) & ~3); // align ++ if (nvp + 4 >= nvl + VDEV_PHYS_SIZE + || encode_size < 0 +- || nvp + 4 + encode_size > nvl + VDEV_PHYS_SIZE) ++ || nvp + 4 + encode_size > nvl + VDEV_PHYS_SIZE) + { + grub_dprintf ("zfs", "nvlist overflow\n"); + grub_error (GRUB_ERR_BAD_FS, "incorrect nvlist"); +@@ -896,7 +896,7 @@ nvpair_name (const char *nvp, char **buf, grub_size_t *buflen) + { + /* skip over encode/decode size */ + nvp += 4 * 2; +- ++ + *buf = (char *) (nvp + 4); + *buflen = grub_be_to_cpu32 (grub_get_unaligned32 (nvp)); + +@@ -943,7 +943,7 @@ nvpair_value (const char *nvp,char **val, + + /* skip over name */ + nvp = nvp + ((name_len + 3) & ~3); /* align */ +- ++ + /* skip over type */ + nvp += 4; + nelm = grub_be_to_cpu32 (grub_get_unaligned32 (nvp)); +@@ -957,7 +957,7 @@ nvpair_value (const char *nvp,char **val, + *size_out = encode_size; + if (nelm_out) + *nelm_out = nelm; +- ++ + return 1; + } + +@@ -1183,7 +1183,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data, + desc.vdev_phys_sector + = label * (sizeof (vdev_label_t) >> SPA_MINBLOCKSHIFT) + + ((VDEV_SKIP_SIZE + VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT) +- + (label < VDEV_LABELS / 2 ? 0 : ++ + (label < VDEV_LABELS / 2 ? 0 : + ALIGN_DOWN (grub_disk_native_sectors (dev->disk), sizeof (vdev_label_t)) + - VDEV_LABELS * (sizeof (vdev_label_t) >> SPA_MINBLOCKSHIFT)); + +@@ -1229,7 +1229,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data, + grub_free (bh); + return GRUB_ERR_NONE; + } +- ++ + grub_free (ub_array); + grub_free (bh); + +@@ -1269,7 +1269,7 @@ scan_devices_iter (const char *name, void *hook_data) + + if (!inserted) + grub_device_close (dev); +- ++ + return 0; + } + +@@ -1386,7 +1386,7 @@ recovery (grub_uint8_t *bufs[4], grub_size_t s, const int nbufs, + for (i = 0; i < nbufs; i++) + { + grub_uint8_t mul; +- for (j = i; j < nbufs; j++) ++ for (j = i; j < nbufs; j++) + if (matrix1[i][j]) + break; + if (j == nbufs) +@@ -1453,7 +1453,7 @@ recovery (grub_uint8_t *bufs[4], grub_size_t s, const int nbufs, + } + default: + return grub_error (GRUB_ERR_BUG, "too big matrix"); +- } ++ } + } + + static grub_err_t +@@ -1510,7 +1510,7 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc, + int idx, orig_idx; + + if (desc->nparity < 1 || desc->nparity > 3) +- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "raidz%d is not supported", desc->nparity); + + if (desc->n_children <= desc->nparity || desc->n_children < 1) +@@ -1659,7 +1659,7 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc, + len -= csize; + idx--; + } +- for (i = 0; i < failed_devices ++ for (i = 0; i < failed_devices + && recovery_len[i] == recovery_len[0]; + i++); + /* Since the chunks have variable length handle the last block +@@ -1782,7 +1782,7 @@ zio_read_gang (blkptr_t * bp, grub_zfs_endian_t endian, dva_t * dva, void *buf, + * Read in a block of raw data to buf. + */ + static grub_err_t +-zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian, void *buf, ++zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian, void *buf, + struct grub_zfs_data *data) + { + int i, psize; +@@ -1850,7 +1850,7 @@ decode_embedded_bp_compressed(const blkptr_t *bp, void *buf) + * and put the uncompressed data in buf. + */ + static grub_err_t +-zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, ++zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, + grub_size_t *size, struct grub_zfs_data *data) + { + grub_size_t lsize, psize; +@@ -1936,7 +1936,7 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, + if (encrypted) + { + if (!grub_zfs_decrypt) +- err = grub_error (GRUB_ERR_BAD_FS, ++ err = grub_error (GRUB_ERR_BAD_FS, + N_("module `%s' isn't loaded"), + "zfscrypt"); + else +@@ -1960,7 +1960,7 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, + endian)); + return grub_error (GRUB_ERR_BAD_FS, "no key found in keychain"); + } +- grub_dprintf ("zfs", "using key %u (%" PRIxGRUB_UINT64_T ++ grub_dprintf ("zfs", "using key %u (%" PRIxGRUB_UINT64_T + ", %p) for txg %" PRIxGRUB_UINT64_T "\n", + besti, data->subvol.keyring[besti].txg, + data->subvol.keyring[besti].cipher, +@@ -2008,7 +2008,7 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, + * + */ + static grub_err_t +-dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, ++dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, + grub_zfs_endian_t *endian_out, struct grub_zfs_data *data) + { + int level; +@@ -2038,8 +2038,8 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, + + if (BP_IS_HOLE (bp)) + { +- grub_size_t size = grub_zfs_to_cpu16 (dn->dn.dn_datablkszsec, +- dn->endian) ++ grub_size_t size = grub_zfs_to_cpu16 (dn->dn.dn_datablkszsec, ++ dn->endian) + << SPA_MINBLOCKSHIFT; + *buf = grub_malloc (size); + if (!*buf) +@@ -2103,7 +2103,7 @@ mzap_lookup (mzap_phys_t * zapobj, grub_zfs_endian_t endian, + } + + static int +-mzap_iterate (mzap_phys_t * zapobj, grub_zfs_endian_t endian, int objsize, ++mzap_iterate (mzap_phys_t * zapobj, grub_zfs_endian_t endian, int objsize, + int (*hook) (const char *name, grub_uint64_t val, + struct grub_zfs_dir_ctx *ctx), + struct grub_zfs_dir_ctx *ctx) +@@ -2117,7 +2117,7 @@ mzap_iterate (mzap_phys_t * zapobj, grub_zfs_endian_t endian, int objsize, + grub_dprintf ("zfs", "zap: name = %s, value = %llx, cd = %x\n", + mzap_ent[i].mze_name, (long long)mzap_ent[i].mze_value, + (int)mzap_ent[i].mze_cd); +- if (hook (mzap_ent[i].mze_name, ++ if (hook (mzap_ent[i].mze_name, + grub_zfs_to_cpu64 (mzap_ent[i].mze_value, endian), ctx)) + return 1; + } +@@ -2178,12 +2178,12 @@ name_cmp (const char *s1, const char *s2, grub_size_t n, + + if (!case_insensitive) + return grub_memcmp (t1, t2, n); +- ++ + while (n--) + { + if (grub_toupper (*t1) != grub_toupper (*t2)) + return (int) grub_toupper (*t1) - (int) grub_toupper (*t2); +- ++ + t1++; + t2++; + } +@@ -2221,7 +2221,7 @@ zap_leaf_array_equal (zap_leaf_phys_t * l, grub_zfs_endian_t endian, + + /* XXX */ + static grub_err_t +-zap_leaf_array_get (zap_leaf_phys_t * l, grub_zfs_endian_t endian, int blksft, ++zap_leaf_array_get (zap_leaf_phys_t * l, grub_zfs_endian_t endian, int blksft, + int chunk, grub_size_t array_len, char *buf) + { + grub_size_t bseen = 0; +@@ -2285,7 +2285,7 @@ zap_leaf_lookup (zap_leaf_phys_t * l, grub_zfs_endian_t endian, + + grub_dprintf ("zfs", "fzap: length %d\n", (int) le->le_name_length); + +- if (zap_leaf_array_equal (l, endian, blksft, ++ if (zap_leaf_array_equal (l, endian, blksft, + grub_zfs_to_cpu16 (le->le_name_chunk,endian), + grub_zfs_to_cpu16 (le->le_name_length, endian), + name, case_insensitive)) +@@ -2334,7 +2334,7 @@ fzap_lookup (dnode_end_t * zap_dnode, zap_phys_t * zap, + { + void *l; + grub_uint64_t hash, idx, blkid; +- int blksft = zfs_log2 (grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, ++ int blksft = zfs_log2 (grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, + zap_dnode->endian) << DNODE_SHIFT); + grub_err_t err; + grub_zfs_endian_t leafendian; +@@ -2347,7 +2347,7 @@ fzap_lookup (dnode_end_t * zap_dnode, zap_phys_t * zap, + + /* get block id from index */ + if (zap->zap_ptrtbl.zt_numblks != 0) +- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "external pointer tables not supported"); + idx = ZAP_HASH_IDX (hash, zap->zap_ptrtbl.zt_shift); + blkid = grub_zfs_to_cpu64 (((grub_uint64_t *) zap)[idx + (1 << (blksft - 3 - 1))], zap_dnode->endian); +@@ -2379,7 +2379,7 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap, + void *l_in; + grub_uint64_t idx, idx2, blkid; + grub_uint16_t chunk; +- int blksft = zfs_log2 (grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, ++ int blksft = zfs_log2 (grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, + zap_dnode->endian) << DNODE_SHIFT); + grub_err_t err; + grub_zfs_endian_t endian; +@@ -2390,7 +2390,7 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap, + /* get block id from index */ + if (zap->zap_ptrtbl.zt_numblks != 0) + { +- grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "external pointer tables not supported"); + return 0; + } +@@ -2517,7 +2517,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, + grub_dprintf ("zfs", "micro zap\n"); + err = mzap_lookup (zapbuf, endian, size, name, val, + case_insensitive); +- grub_dprintf ("zfs", "returned %d\n", err); ++ grub_dprintf ("zfs", "returned %d\n", err); + grub_free (zapbuf); + return err; + } +@@ -2527,7 +2527,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, + /* this is a fat zap */ + err = fzap_lookup (zap_dnode, zapbuf, name, val, data, + case_insensitive); +- grub_dprintf ("zfs", "returned %d\n", err); ++ grub_dprintf ("zfs", "returned %d\n", err); + grub_free (zapbuf); + return err; + } +@@ -2560,7 +2560,7 @@ zap_iterate_u64_transform (const void *name, + } + + static int +-zap_iterate_u64 (dnode_end_t * zap_dnode, ++zap_iterate_u64 (dnode_end_t * zap_dnode, + int (*hook) (const char *name, grub_uint64_t val, + struct grub_zfs_dir_ctx *ctx), + struct grub_zfs_data *data, struct grub_zfs_dir_ctx *ctx) +@@ -2607,7 +2607,7 @@ zap_iterate_u64 (dnode_end_t * zap_dnode, + } + + static int +-zap_iterate (dnode_end_t * zap_dnode, ++zap_iterate (dnode_end_t * zap_dnode, + grub_size_t nameelemlen, + int (*hook) (const void *name, grub_size_t namelen, + const void *val_in, +@@ -2667,7 +2667,7 @@ dnode_get (dnode_end_t * mdn, grub_uint64_t objnum, grub_uint8_t type, + grub_err_t err; + grub_zfs_endian_t endian; + +- blksz = grub_zfs_to_cpu16 (mdn->dn.dn_datablkszsec, ++ blksz = grub_zfs_to_cpu16 (mdn->dn.dn_datablkszsec, + mdn->endian) << SPA_MINBLOCKSHIFT; + epbs = zfs_log2 (blksz) - DNODE_SHIFT; + +@@ -2678,18 +2678,18 @@ dnode_get (dnode_end_t * mdn, grub_uint64_t objnum, grub_uint8_t type, + blkid = objnum >> epbs; + idx = objnum & ((1 << epbs) - 1); + +- if (data->dnode_buf != NULL && grub_memcmp (data->dnode_mdn, mdn, +- sizeof (*mdn)) == 0 ++ if (data->dnode_buf != NULL && grub_memcmp (data->dnode_mdn, mdn, ++ sizeof (*mdn)) == 0 + && objnum >= data->dnode_start && objnum < data->dnode_end) + { + grub_memmove (&(buf->dn), &(data->dnode_buf)[idx], DNODE_SIZE); + buf->endian = data->dnode_endian; +- if (type && buf->dn.dn_type != type) +- return grub_error(GRUB_ERR_BAD_FS, "incorrect dnode type"); ++ if (type && buf->dn.dn_type != type) ++ return grub_error(GRUB_ERR_BAD_FS, "incorrect dnode type"); + return GRUB_ERR_NONE; + } + +- grub_dprintf ("zfs", "endian = %d, blkid=%llx\n", mdn->endian, ++ grub_dprintf ("zfs", "endian = %d, blkid=%llx\n", mdn->endian, + (unsigned long long) blkid); + err = dmu_read (mdn, blkid, &dnbuf, &endian, data); + if (err) +@@ -2715,8 +2715,8 @@ dnode_get (dnode_end_t * mdn, grub_uint64_t objnum, grub_uint8_t type, + + grub_memmove (&(buf->dn), (dnode_phys_t *) dnbuf + idx, DNODE_SIZE); + buf->endian = endian; +- if (type && buf->dn.dn_type != type) +- return grub_error(GRUB_ERR_BAD_FS, "incorrect dnode type"); ++ if (type && buf->dn.dn_type != type) ++ return grub_error(GRUB_ERR_BAD_FS, "incorrect dnode type"); + + return GRUB_ERR_NONE; + } +@@ -2740,7 +2740,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + struct dnode_chain + { + struct dnode_chain *next; +- dnode_end_t dn; ++ dnode_end_t dn; + }; + struct dnode_chain *dnode_path = 0, *dn_new, *root; + +@@ -2750,7 +2750,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + dn_new->next = 0; + dnode_path = root = dn_new; + +- err = dnode_get (&subvol->mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE, ++ err = dnode_get (&subvol->mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE, + &(dnode_path->dn), data); + if (err) + { +@@ -2801,7 +2801,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + grub_free (dn_new); + return grub_errno; + } +- ++ + while (1) + { + /* skip leading slashes */ +@@ -2827,7 +2827,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + } + else + { +- err = grub_error (GRUB_ERR_FILE_NOT_FOUND, ++ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, + "can't resolve .."); + break; + } +@@ -2877,7 +2877,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + { + grub_size_t block; + grub_size_t blksz; +- blksz = (grub_zfs_to_cpu16 (dnode_path->dn.dn.dn_datablkszsec, ++ blksz = (grub_zfs_to_cpu16 (dnode_path->dn.dn.dn_datablkszsec, + dnode_path->dn.endian) + << SPA_MINBLOCKSHIFT); + +@@ -2916,7 +2916,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + if (err) + break; + free_symval = 1; +- } ++ } + path = path_buf = grub_malloc (sym_sz + grub_strlen (oldpath) + 1); + if (!path_buf) + { +@@ -2930,9 +2930,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + if (free_symval) + grub_free (sym_value); + path [sym_sz] = 0; +- grub_memcpy (path + grub_strlen (path), oldpath, ++ grub_memcpy (path + grub_strlen (path), oldpath, + grub_strlen (oldpath) + 1); +- ++ + grub_free (oldpathbuf); + if (path[0] != '/') + { +@@ -2951,7 +2951,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + { + void *sahdrp; + int hdrsize; +- ++ + if (dnode_path->dn.dn.dn_bonuslen != 0) + { + sahdrp = DN_BONUS (&dnode_path->dn.dn); +@@ -2959,7 +2959,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + else if (dnode_path->dn.dn.dn_flags & DNODE_FLAG_SPILL_BLKPTR) + { + blkptr_t *bp = &dnode_path->dn.dn.dn_spill; +- ++ + err = zio_read (bp, dnode_path->dn.endian, &sahdrp, NULL, data); + if (err) + break; +@@ -2978,7 +2978,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + dnode_path->dn.endian) >> 12) & 0xf) == 0xa) + { + char *sym_value = (char *) sahdrp + hdrsize + SA_SYMLINK_OFFSET; +- grub_size_t sym_sz = ++ grub_size_t sym_sz = + grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + + hdrsize + + SA_SIZE_OFFSET), +@@ -2993,9 +2993,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + } + grub_memcpy (path, sym_value, sym_sz); + path [sym_sz] = 0; +- grub_memcpy (path + grub_strlen (path), oldpath, ++ grub_memcpy (path + grub_strlen (path), oldpath, + grub_strlen (oldpath) + 1); +- ++ + grub_free (oldpathbuf); + if (path[0] != '/') + { +@@ -3096,7 +3096,7 @@ get_filesystem_dnode (dnode_end_t * mosmdn, char *fsname, + + grub_dprintf ("zfs", "endian = %d\n", mosmdn->endian); + +- err = dnode_get (mosmdn, DMU_POOL_DIRECTORY_OBJECT, ++ err = dnode_get (mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, mdn, data); + if (err) + return err; +@@ -3119,7 +3119,7 @@ get_filesystem_dnode (dnode_end_t * mosmdn, char *fsname, + { + grub_uint64_t childobj; + char *cname, ch; +- ++ + while (*fsname == '/') + fsname++; + +@@ -3279,7 +3279,7 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, + filename = ptr_slash; + else + filename = "/"; +- grub_dprintf ("zfs", "fsname = '%s' snapname='%s' filename = '%s'\n", ++ grub_dprintf ("zfs", "fsname = '%s' snapname='%s' filename = '%s'\n", + fsname, snapname, filename); + } + grub_dprintf ("zfs", "alive\n"); +@@ -3365,7 +3365,7 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, + + snapobj = grub_zfs_to_cpu64 (((dsl_dataset_phys_t *) DN_BONUS (&subvol->mdn.dn))->ds_snapnames_zapobj, subvol->mdn.endian); + +- err = dnode_get (&(data->mos), snapobj, ++ err = dnode_get (&(data->mos), snapobj, + DMU_OT_DSL_DS_SNAP_MAP, &subvol->mdn, data); + if (!err) + err = zap_lookup (&subvol->mdn, snapname, &headobj, data, 0); +@@ -3383,13 +3383,13 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, + subvol->obj = headobj; + + make_mdn (&subvol->mdn, data); +- ++ + grub_dprintf ("zfs", "endian = %d\n", subvol->mdn.endian); + + if (*isfs) + { + grub_free (fsname); +- grub_free (snapname); ++ grub_free (snapname); + return GRUB_ERR_NONE; + } + err = dnode_get_path (subvol, filename, dn, data); +@@ -3409,9 +3409,9 @@ nvlist_find_value (const char *nvlist_in, const char *name, + char *nvp_name; + + /* Verify if the 1st and 2nd byte in the nvlist are valid. */ +- /* NOTE: independently of what endianness header announces all ++ /* NOTE: independently of what endianness header announces all + subsequent values are big-endian. */ +- if (nvlist[0] != NV_ENCODE_XDR || (nvlist[1] != NV_LITTLE_ENDIAN ++ if (nvlist[0] != NV_ENCODE_XDR || (nvlist[1] != NV_LITTLE_ENDIAN + && nvlist[1] != NV_BIG_ENDIAN)) + { + grub_dprintf ("zfs", "incorrect nvlist header\n"); +@@ -3532,13 +3532,13 @@ get_nvlist_size (const char *beg, const char *limit) + { + const char *ptr; + grub_uint32_t encode_size; +- ++ + ptr = beg + 8; + + while (ptr < limit + && (encode_size = grub_be_to_cpu32 (grub_get_unaligned32 (ptr)))) + ptr += encode_size; /* goto the next nvpair */ +- ptr += 8; ++ ptr += 8; + return (ptr > limit) ? -1 : (ptr - beg); + } + +@@ -3674,8 +3674,8 @@ zfs_mount (grub_device_t dev) + } + + ub = &(data->current_uberblock); +- ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic, +- GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC ++ ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic, ++ GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC + ? GRUB_ZFS_LITTLE_ENDIAN : GRUB_ZFS_BIG_ENDIAN); + + err = zio_read (&ub->ub_rootbp, ub_endian, +@@ -3728,7 +3728,7 @@ grub_zfs_fetch_nvlist (grub_device_t dev, char **nvlist) + return err; + } + +-static grub_err_t ++static grub_err_t + zfs_label (grub_device_t device, char **label) + { + char *nvlist; +@@ -3740,7 +3740,7 @@ zfs_label (grub_device_t device, char **label) + return grub_errno; + + err = zfs_fetch_nvlist (data->device_original, &nvlist); +- if (err) ++ if (err) + { + zfs_unmount (data); + return err; +@@ -3752,7 +3752,7 @@ zfs_label (grub_device_t device, char **label) + return grub_errno; + } + +-static grub_err_t ++static grub_err_t + zfs_uuid (grub_device_t device, char **uuid) + { + struct grub_zfs_data *data; +@@ -3770,7 +3770,7 @@ zfs_uuid (grub_device_t device, char **uuid) + return GRUB_ERR_NONE; + } + +-static grub_err_t ++static grub_err_t + zfs_mtime (grub_device_t device, grub_int64_t *mt) + { + struct grub_zfs_data *data; +@@ -3784,8 +3784,8 @@ zfs_mtime (grub_device_t device, grub_int64_t *mt) + return grub_errno; + + ub = &(data->current_uberblock); +- ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic, +- GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC ++ ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic, ++ GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC + ? GRUB_ZFS_LITTLE_ENDIAN : GRUB_ZFS_BIG_ENDIAN); + + *mt = grub_zfs_to_cpu64 (ub->ub_timestamp, ub_endian); +@@ -3823,7 +3823,7 @@ grub_zfs_open (struct grub_file *file, const char *fsfilename) + } + + /* We found the dnode for this file. Verify if it is a plain file. */ +- if (data->dnode.dn.dn_type != DMU_OT_PLAIN_FILE_CONTENTS) ++ if (data->dnode.dn.dn_type != DMU_OT_PLAIN_FILE_CONTENTS) + { + zfs_unmount (data); + return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file")); +@@ -3898,7 +3898,7 @@ grub_zfs_read (grub_file_t file, char *buf, grub_size_t len) + return len; + } + +- blksz = grub_zfs_to_cpu16 (data->dnode.dn.dn_datablkszsec, ++ blksz = grub_zfs_to_cpu16 (data->dnode.dn.dn_datablkszsec, + data->dnode.endian) << SPA_MINBLOCKSHIFT; + + if (blksz == 0) +@@ -3991,11 +3991,11 @@ fill_fs_info (struct grub_dirhook_info *info, + dnode_end_t dn; + grub_uint64_t objnum; + grub_uint64_t headobj; +- ++ + grub_memset (info, 0, sizeof (*info)); +- ++ + info->dir = 1; +- ++ + if (mdn.dn.dn_type == DMU_OT_DSL_DIR) + { + headobj = grub_zfs_to_cpu64 (((dsl_dir_phys_t *) DN_BONUS (&mdn.dn))->dd_head_dataset_obj, mdn.endian); +@@ -4010,28 +4010,28 @@ fill_fs_info (struct grub_dirhook_info *info, + err = make_mdn (&mdn, data); + if (err) + return err; +- err = dnode_get (&mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE, ++ err = dnode_get (&mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE, + &dn, data); + if (err) + { + grub_dprintf ("zfs", "failed here\n"); + return err; + } +- ++ + err = zap_lookup (&dn, ZFS_ROOT_OBJ, &objnum, data, 0); + if (err) + { + grub_dprintf ("zfs", "failed here\n"); + return err; + } +- ++ + err = dnode_get (&mdn, objnum, 0, &dn, data); + if (err) + { + grub_dprintf ("zfs", "failed here\n"); + return err; + } +- ++ + if (dn.dn.dn_bonustype == DMU_OT_SA) + { + void *sahdrp; +@@ -4117,15 +4117,15 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx) + info.mtime = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_MTIME_OFFSET), dn.endian); + info.case_insensitive = ctx->data->subvol.case_insensitive; + } +- ++ + if (dn.dn.dn_bonustype == DMU_OT_ZNODE) +- { ++ { + info.mtimeset = 1; + info.mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0], + dn.endian); + } + info.dir = (dn.dn.dn_type == DMU_OT_DIRECTORY_CONTENTS); +- grub_dprintf ("zfs", "type=%d, name=%s\n", ++ grub_dprintf ("zfs", "type=%d, name=%s\n", + (int)dn.dn.dn_type, (char *)name); + return ctx->hook (name, &info, ctx->hook_data); + } +@@ -4219,7 +4219,7 @@ grub_zfs_dir (grub_device_t device, const char *path, + + if (isfs) + { +- grub_uint64_t childobj, headobj; ++ grub_uint64_t childobj, headobj; + grub_uint64_t snapobj; + dnode_end_t dn; + struct grub_dirhook_info info; +@@ -4247,7 +4247,7 @@ grub_zfs_dir (grub_device_t device, const char *path, + } + + zap_iterate_u64 (&dn, iterate_zap_fs, data, &ctx); +- ++ + err = dnode_get (&(data->mos), headobj, DMU_OT_DSL_DATASET, &dn, data); + if (err) + { +@@ -4289,8 +4289,8 @@ check_feature (const char *name, grub_uint64_t val, + return 0; + if (name[0] == 0) + return 0; +- for (i = 0; spa_feature_names[i] != NULL; i++) +- if (grub_strcmp (name, spa_feature_names[i]) == 0) ++ for (i = 0; spa_feature_names[i] != NULL; i++) ++ if (grub_strcmp (name, spa_feature_names[i]) == 0) + return 0; + return 1; + } +@@ -4303,7 +4303,7 @@ check_feature (const char *name, grub_uint64_t val, + * 0: Success. + * errnum: Failure. + */ +- ++ + static grub_err_t + check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data ) + { +@@ -4328,7 +4328,7 @@ check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct gru + errnum = zap_lookup(&dn, DMU_POOL_FEATURES_FOR_READ, &objnum, data,0); + if (errnum != 0) + return errnum; +- ++ + errnum = dnode_get(&mosmdn, objnum, DMU_OTN_ZAP_METADATA, &dn, data); + if (errnum != 0) + return errnum; +diff --git a/grub-core/fs/zfs/zfs_fletcher.c b/grub-core/fs/zfs/zfs_fletcher.c +index 7d27b053dc7a..ad3be6705479 100644 +--- a/grub-core/fs/zfs/zfs_fletcher.c ++++ b/grub-core/fs/zfs/zfs_fletcher.c +@@ -39,14 +39,14 @@ + #include + + void +-fletcher_2(const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, ++fletcher_2(const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, + zio_cksum_t *zcp) + { + const grub_uint64_t *ip = buf; + const grub_uint64_t *ipend = ip + (size / sizeof (grub_uint64_t)); + grub_uint64_t a0, b0, a1, b1; +- +- for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) ++ ++ for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) + { + a0 += grub_zfs_to_cpu64 (ip[0], endian); + a1 += grub_zfs_to_cpu64 (ip[1], endian); +@@ -61,14 +61,14 @@ fletcher_2(const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, + } + + void +-fletcher_4 (const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, ++fletcher_4 (const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, + zio_cksum_t *zcp) + { + const grub_uint32_t *ip = buf; + const grub_uint32_t *ipend = ip + (size / sizeof (grub_uint32_t)); + grub_uint64_t a, b, c, d; +- +- for (a = b = c = d = 0; ip < ipend; ip++) ++ ++ for (a = b = c = d = 0; ip < ipend; ip++) + { + a += grub_zfs_to_cpu32 (ip[0], endian);; + b += a; +diff --git a/grub-core/fs/zfs/zfs_sha256.c b/grub-core/fs/zfs/zfs_sha256.c +index a181f076c54c..f042fa61ab89 100644 +--- a/grub-core/fs/zfs/zfs_sha256.c ++++ b/grub-core/fs/zfs/zfs_sha256.c +@@ -116,23 +116,23 @@ zio_checksum_SHA256(const void *buf, grub_uint64_t size, + grub_uint8_t pad[128]; + unsigned padsize = size & 63; + unsigned i; +- ++ + for (i = 0; i < size - padsize; i += 64) + SHA256Transform(H, (grub_uint8_t *)buf + i); +- ++ + for (i = 0; i < padsize; i++) + pad[i] = ((grub_uint8_t *)buf)[i]; +- ++ + for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) + pad[padsize] = 0; +- ++ + for (i = 0; i < 8; i++) + pad[padsize++] = (size << 3) >> (56 - 8 * i); +- ++ + for (i = 0; i < padsize && i <= 64; i += 64) + SHA256Transform(H, pad + i); +- +- zcp->zc_word[0] = grub_cpu_to_zfs64 ((grub_uint64_t)H[0] << 32 | H[1], ++ ++ zcp->zc_word[0] = grub_cpu_to_zfs64 ((grub_uint64_t)H[0] << 32 | H[1], + endian); + zcp->zc_word[1] = grub_cpu_to_zfs64 ((grub_uint64_t)H[2] << 32 | H[3], + endian); +diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c +index de3b015f5827..da30e9ab33dd 100644 +--- a/grub-core/fs/zfs/zfscrypt.c ++++ b/grub-core/fs/zfs/zfscrypt.c +@@ -46,7 +46,7 @@ + GRUB_MOD_LICENSE ("GPLv3+"); + + /* +- Mostly based on following article: ++ Mostly based on following article: + https://blogs.oracle.com/darren/entry/zfs_encryption_what_is_on + */ + +@@ -179,7 +179,7 @@ grub_gcm_mul (grub_uint8_t *a, const grub_uint8_t *b) + grub_crypto_xor (res, res, bs, 16); + grub_gcm_mul_x (bs); + } +- ++ + grub_memcpy (a, res, 16); + } + +@@ -275,7 +275,7 @@ algo_decrypt (grub_crypto_cipher_handle_t cipher, grub_uint64_t algo, + } + + static grub_err_t +-grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, ++grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, + grub_uint64_t algo, + void *nonce, + char *buf, grub_size_t size, +@@ -286,7 +286,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, + unsigned i; + grub_uint32_t sw[4]; + gcry_err_code_t err; +- ++ + grub_memcpy (sw, nonce, 16); + if (endian != GRUB_ZFS_BIG_ENDIAN) + for (i = 0; i < 4; i++) +@@ -302,7 +302,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, + sw + 1, 3, 12); + if (err) + return grub_crypto_gcry_error (err); +- ++ + for (i = 0; i < 3; i++) + if (grub_zfs_to_cpu32 (expected_mac[i], endian) + != grub_be_to_cpu32 (mac[i])) +@@ -362,7 +362,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, + grub_crypto_cipher_close (cipher); + continue; + } +- ++ + err = grub_crypto_cipher_set_key (cipher, wrap_key_real, + keylen); + if (err) +@@ -371,7 +371,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, + grub_crypto_cipher_close (cipher); + continue; + } +- ++ + err = algo_decrypt (cipher, algo, decrypted, key->unknown_purpose_key, 32, + mac, key->unknown_purpose_nonce, 2, 16); + if (err || (grub_crypto_memcmp (mac, key->unknown_purpose_key + 32, 16) diff --git a/0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch b/0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch new file mode 100644 index 00000000..f5421ce3 --- /dev/null +++ b/0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: "t.feng" +Date: Tue, 29 Nov 2022 17:14:15 +0800 +Subject: [PATCH] fs/xfs: Fix memory leaks in XFS module + +Signed-off-by: t.feng +Reviewed-by: Daniel Kiper +--- + grub-core/fs/xfs.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index d6de7f1a2dd2..b67407690c1a 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -585,7 +585,10 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + if (grub_disk_read (node->data->disk, + GRUB_XFS_FSB_TO_BLOCK (node->data, get_fsb (keys, i - 1 + recoffset)) << (node->data->sblock.log2_bsize - GRUB_DISK_SECTOR_BITS), + 0, node->data->bsize, leaf)) +- return 0; ++ { ++ grub_free (leaf); ++ return 0; ++ } + + if ((!node->data->hascrc && + grub_strncmp ((char *) leaf->magic, "BMAP", 4)) || +@@ -751,6 +754,7 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename, + if (err) + { + grub_print_error (); ++ grub_free (fdiro); + return 0; + } + +@@ -861,7 +865,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + blk << dirblk_log2, + dirblk_size, dirblock, 0); + if (numread != dirblk_size) +- return 0; ++ { ++ grub_free (dirblock); ++ return 0; ++ } + + entries = (grub_be_to_cpu32 (tail->leaf_count) + - grub_be_to_cpu32 (tail->leaf_stale)); diff --git a/0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch b/0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch new file mode 100644 index 00000000..7083a57b --- /dev/null +++ b/0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Darren Kenny +Date: Fri, 2 Jun 2023 18:08:44 +0000 +Subject: [PATCH] fs/xfs: Fix issues found while fuzzing the XFS filesystem + +While performing fuzz testing with XFS filesystem images with ASAN +enabled, several issues were found where the memory accesses are made +beyond the data that is allocated into the struct grub_xfs_data +structure's data field. + +The existing structure didn't store the size of the memory allocated into +the buffer in the data field and had no way to check it. To resolve these +issues, the data size is stored to enable checks into the data buffer. + +With these checks in place, the fuzzing corpus no longer cause any crashes. + +Signed-off-by: Darren Kenny +Signed-off-by: Robbie Harwood +Signed-off-by: Marta Lewandowska +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/xfs.c | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index b67407690c1a..b91cd32b49ab 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -239,6 +239,7 @@ struct grub_fshelp_node + + struct grub_xfs_data + { ++ grub_size_t data_size; + struct grub_xfs_sblock sblock; + grub_disk_t disk; + int pos; +@@ -611,8 +612,20 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + } + else if (node->inode.format == XFS_INODE_FORMAT_EXT) + { ++ grub_addr_t exts_end = 0; ++ grub_addr_t data_end = 0; ++ + nrec = grub_be_to_cpu32 (node->inode.nextents); + exts = (struct grub_xfs_extent *) grub_xfs_inode_data(&node->inode); ++ ++ if (grub_mul (sizeof (struct grub_xfs_extent), nrec, &exts_end) || ++ grub_add ((grub_addr_t) node->data, exts_end, &exts_end) || ++ grub_add ((grub_addr_t) node->data, node->data->data_size, &data_end) || ++ exts_end > data_end) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "invalid number of XFS extents"); ++ return 0; ++ } + } + else + { +@@ -803,6 +816,9 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + grub_uint8_t *inopos = grub_xfs_inline_de_inopos(dir->data, de); + grub_uint8_t c; + ++ if ((inopos + (smallino ? 4 : 8)) > (grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)) ++ return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode"); ++ + /* inopos might be unaligned. */ + if (smallino) + ino = (((grub_uint32_t) inopos[0]) << 24) +@@ -829,6 +845,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + de->name[de->len] = c; + + de = grub_xfs_inline_next_de(dir->data, head, de); ++ ++ if ((grub_uint8_t *) de >= (grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)) ++ return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); ++ + } + break; + } +@@ -897,6 +917,9 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + } + + filename = (char *)(direntry + 1); ++ if (filename + direntry->len - 1 > (char *) tail) ++ return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); ++ + /* The byte after the filename is for the filetype, padding, or + tag, which is not used by GRUB. So it can be overwritten. */ + filename[direntry->len] = '\0'; +@@ -941,6 +964,8 @@ grub_xfs_mount (grub_disk_t disk) + if (!data) + return 0; + ++ data->data_size = sizeof (struct grub_xfs_data); ++ + grub_dprintf("xfs", "Reading sb\n"); + /* Read the superblock. */ + if (grub_disk_read (disk, 0, 0, +@@ -962,6 +987,7 @@ grub_xfs_mount (grub_disk_t disk) + if (! data) + goto fail; + ++ data->data_size = sz; + data->diropen.data = data; + data->diropen.ino = grub_be_to_cpu64(data->sblock.rootino); + data->diropen.inode_read = 1; diff --git a/0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch b/0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch new file mode 100644 index 00000000..d70ec5ad --- /dev/null +++ b/0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Thu, 28 Sep 2023 22:33:44 +0000 +Subject: [PATCH] fs/xfs: Incorrect short form directory data boundary check + +After parsing of the current entry, the entry pointer is advanced +to the next entry at the end of the "for" loop. In case where the +last entry is at the end of the data boundary, the advanced entry +pointer can point off the data boundary. The subsequent boundary +check for the advanced entry pointer can cause a failure. + +The fix is to include the boundary check into the "for" loop +condition. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +Tested-by: Sebastian Andrzej Siewior +Tested-by: Marta Lewandowska +--- + grub-core/fs/xfs.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index b91cd32b49ab..ebf962793fa7 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -810,7 +810,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + if (iterate_dir_call_hook (parent, "..", &ctx)) + return 1; + +- for (i = 0; i < head->count; i++) ++ for (i = 0; i < head->count && ++ (grub_uint8_t *) de < ((grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)); i++) + { + grub_uint64_t ino; + grub_uint8_t *inopos = grub_xfs_inline_de_inopos(dir->data, de); +@@ -845,10 +846,6 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + de->name[de->len] = c; + + de = grub_xfs_inline_next_de(dir->data, head, de); +- +- if ((grub_uint8_t *) de >= (grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)) +- return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); +- + } + break; + } diff --git a/0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch b/0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch new file mode 100644 index 00000000..c0057310 --- /dev/null +++ b/0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch @@ -0,0 +1,168 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jon DeVree +Date: Tue, 17 Oct 2023 23:03:47 -0400 +Subject: [PATCH] fs/xfs: Fix XFS directory extent parsing + +The XFS directory entry parsing code has never been completely correct +for extent based directories. The parser correctly handles the case +where the directory is contained in a single extent, but then mistakenly +assumes the data blocks for the multiple extent case are each identical +to the single extent case. The difference in the format of the data +blocks between the two cases is tiny enough that its gone unnoticed for +a very long time. + +A recent change introduced some additional bounds checking into the XFS +parser. Like GRUB's existing parser, it is correct for the single extent +case but incorrect for the multiple extent case. When parsing a directory +with multiple extents, this new bounds checking is sometimes (but not +always) tripped and triggers an "invalid XFS directory entry" error. This +probably would have continued to go unnoticed but the /boot/grub/ +directory is large enough that it often has multiple extents. + +The difference between the two cases is that when there are multiple +extents, the data blocks do not contain a trailer nor do they contain +any leaf information. That information is stored in a separate set of +extents dedicated to just the leaf information. These extents come after +the directory entry extents and are not included in the inode size. So +the existing parser already ignores the leaf extents. + +The only reason to read the trailer/leaf information at all is so that +the parser can avoid misinterpreting that data as directory entries. So +this updates the parser as follows: + +For the single extent case the parser doesn't change much: +1. Read the size of the leaf information from the trailer +2. Set the end pointer for the parser to the start of the leaf + information. (The previous bounds checking set the end pointer to the + start of the trailer, so this is actually a small improvement.) +3. Set the entries variable to the expected number of directory entries. + +For the multiple extent case: +1. Set the end pointer to the end of the block. +2. Do not set up the entries variable. Figuring out how many entries are + in each individual block is complex and does not seem worth it when + it appears to be safe to just iterate over the entire block. + +The bounds check itself was also dependent upon the faulty XFS parser +because it accidentally used "filename + length - 1". Presumably this +was able to pass the fuzzer because in the old parser there was always +8 bytes of slack space between the tail pointer and the actual end of +the block. Since this is no longer the case the bounds check needs to be +updated to "filename + length + 1" in order to prevent a regression in +the handling of corrupt fliesystems. + +Notes: +* When there is only one extent there will only ever be one block. If + more than one block is required then XFS will always switch to holding + leaf information in a separate extent. +* B-tree based directories seems to be parsed properly by the same code + that handles multiple extents. This is unlikely to ever occur within + /boot though because its only used when there are an extremely large + number of directory entries. + +Fixes: ef7850c75 (fs/xfs: Fix issues found while fuzzing the XFS filesystem) +Fixes: b2499b29c (Adds support for the XFS filesystem.) +Fixes: https://savannah.gnu.org/bugs/?64376 + +Signed-off-by: Jon DeVree +Reviewed-by: Daniel Kiper +Tested-by: Sebastian Andrzej Siewior +Tested-by: Marta Lewandowska +--- + grub-core/fs/xfs.c | 52 ++++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 38 insertions(+), 14 deletions(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index ebf962793fa7..18edfcff486c 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -223,6 +223,12 @@ struct grub_xfs_inode + /* Size of struct grub_xfs_inode v2, up to unused4 member included. */ + #define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76) + ++struct grub_xfs_dir_leaf_entry ++{ ++ grub_uint32_t hashval; ++ grub_uint32_t address; ++} GRUB_PACKED; ++ + struct grub_xfs_dirblock_tail + { + grub_uint32_t leaf_count; +@@ -874,9 +880,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + { + struct grub_xfs_dir2_entry *direntry = + grub_xfs_first_de(dir->data, dirblock); +- int entries; +- struct grub_xfs_dirblock_tail *tail = +- grub_xfs_dir_tail(dir->data, dirblock); ++ int entries = -1; ++ char *end = dirblock + dirblk_size; + + numread = grub_xfs_read_file (dir, 0, 0, + blk << dirblk_log2, +@@ -887,14 +892,27 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + return 0; + } + +- entries = (grub_be_to_cpu32 (tail->leaf_count) +- - grub_be_to_cpu32 (tail->leaf_stale)); ++ /* ++ * Leaf and tail information are only in the data block if the number ++ * of extents is 1. ++ */ ++ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) ++ { ++ struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock); + +- if (!entries) +- continue; ++ end = (char *) tail; ++ ++ /* Subtract the space used by leaf nodes. */ ++ end -= grub_be_to_cpu32 (tail->leaf_count) * sizeof (struct grub_xfs_dir_leaf_entry); ++ ++ entries = grub_be_to_cpu32 (tail->leaf_count) - grub_be_to_cpu32 (tail->leaf_stale); ++ ++ if (!entries) ++ continue; ++ } + + /* Iterate over all entries within this block. */ +- while ((char *)direntry < (char *)tail) ++ while ((char *) direntry < (char *) end) + { + grub_uint8_t *freetag; + char *filename; +@@ -914,7 +932,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + } + + filename = (char *)(direntry + 1); +- if (filename + direntry->len - 1 > (char *) tail) ++ if (filename + direntry->len + 1 > (char *) end) + return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); + + /* The byte after the filename is for the filetype, padding, or +@@ -928,11 +946,17 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + return 1; + } + +- /* Check if last direntry in this block is +- reached. */ +- entries--; +- if (!entries) +- break; ++ /* ++ * The expected number of directory entries is only tracked for the ++ * single extent case. ++ */ ++ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) ++ { ++ /* Check if last direntry in this block is reached. */ ++ entries--; ++ if (!entries) ++ break; ++ } + + /* Select the next directory entry. */ + direntry = grub_xfs_next_de(dir->data, direntry); diff --git a/0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch b/0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch new file mode 100644 index 00000000..8c414a8e --- /dev/null +++ b/0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch @@ -0,0 +1,115 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Anthony Iliopoulos +Date: Thu, 26 Oct 2023 11:53:39 +0200 +Subject: [PATCH] fs/xfs: Add large extent counters incompat feature support + +XFS introduced 64-bit extent counters for inodes via a series of +upstream commits and the feature was marked as stable in v6.5 via +commit 61d7e8274cd8 (xfs: drop EXPERIMENTAL tag for large extent +counts). + +Further, xfsprogs release v6.5.0 switched this feature on by default +in mkfs.xfs via commit e5b18d7d1d96 (mkfs: enable large extent counts +by default). + +Filesystems formatted with large extent count support, nrext64=1, are +thus currently not recognizable by GRUB, since this is an incompat +feature. Add the required support so that those filesystems and inodes +with large extent counters can be read by GRUB. + +Signed-off-by: Anthony Iliopoulos +Reviewed-by: Andrey Albershteyn +Reviewed-by: Daniel Kiper +Tested-by: Marta Lewandowska +Tested-by: Sebastian Andrzej Siewior +--- + grub-core/fs/xfs.c | 30 +++++++++++++++++++++++++----- + 1 file changed, 25 insertions(+), 5 deletions(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 18edfcff486c..bc2224dbb463 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -79,6 +79,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + /* Inode flags2 flags */ + #define XFS_DIFLAG2_BIGTIME_BIT 3 + #define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT) ++#define XFS_DIFLAG2_NREXT64_BIT 4 ++#define XFS_DIFLAG2_NREXT64 (1 << XFS_DIFLAG2_NREXT64_BIT) + + /* incompat feature flags */ + #define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ +@@ -86,6 +88,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ + #define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */ + #define XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR (1 << 4) /* needs xfs_repair */ ++#define XFS_SB_FEAT_INCOMPAT_NREXT64 (1 << 5) /* large extent counters */ + + /* + * Directory entries with ftype are explicitly handled by GRUB code. +@@ -101,7 +104,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); + XFS_SB_FEAT_INCOMPAT_SPINODES | \ + XFS_SB_FEAT_INCOMPAT_META_UUID | \ + XFS_SB_FEAT_INCOMPAT_BIGTIME | \ +- XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR) ++ XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR | \ ++ XFS_SB_FEAT_INCOMPAT_NREXT64) + + struct grub_xfs_sblock + { +@@ -203,7 +207,8 @@ struct grub_xfs_inode + grub_uint16_t mode; + grub_uint8_t version; + grub_uint8_t format; +- grub_uint8_t unused2[26]; ++ grub_uint8_t unused2[18]; ++ grub_uint64_t nextents_big; + grub_uint64_t atime; + grub_uint64_t mtime; + grub_uint64_t ctime; +@@ -545,11 +550,26 @@ get_fsb (const void *keys, int idx) + return grub_be_to_cpu64 (grub_get_unaligned64 (p)); + } + ++static int ++grub_xfs_inode_has_large_extent_counts (const struct grub_xfs_inode *inode) ++{ ++ return inode->version >= 3 && ++ (inode->flags2 & grub_cpu_to_be64_compile_time (XFS_DIFLAG2_NREXT64)); ++} ++ ++static grub_uint64_t ++grub_xfs_get_inode_nextents (struct grub_xfs_inode *inode) ++{ ++ return (grub_xfs_inode_has_large_extent_counts (inode)) ? ++ grub_be_to_cpu64 (inode->nextents_big) : ++ grub_be_to_cpu32 (inode->nextents); ++} ++ + static grub_disk_addr_t + grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + { + struct grub_xfs_btree_node *leaf = 0; +- int ex, nrec; ++ grub_uint64_t ex, nrec; + struct grub_xfs_extent *exts; + grub_uint64_t ret = 0; + +@@ -574,7 +594,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + / (2 * sizeof (grub_uint64_t)); + do + { +- int i; ++ grub_uint64_t i; + + for (i = 0; i < nrec; i++) + { +@@ -621,7 +641,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + grub_addr_t exts_end = 0; + grub_addr_t data_end = 0; + +- nrec = grub_be_to_cpu32 (node->inode.nextents); ++ nrec = grub_xfs_get_inode_nextents (&node->inode); + exts = (struct grub_xfs_extent *) grub_xfs_inode_data(&node->inode); + + if (grub_mul (sizeof (struct grub_xfs_extent), nrec, &exts_end) || diff --git a/grub.patches b/grub.patches index 7228ddef..0ce0db20 100644 --- a/grub.patches +++ b/grub.patches @@ -338,3 +338,9 @@ Patch0337: 0337-Fix-missing-include-in-ofdisk.c.patch Patch0338: 0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch Patch0339: 0339-grub-install-on-EFI-if-forced.patch Patch0340: 0340-Remove-Install-section-from-aux-systemd-units.patch +Patch0341: 0341-fs-Remove-trailing-whitespaces.patch +Patch0342: 0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch +Patch0343: 0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch +Patch0344: 0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch +Patch0345: 0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch +Patch0346: 0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch diff --git a/grub2.spec b/grub2.spec index 456b70f0..262196ed 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 109%{?dist} +Release: 110%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Dec 1 2023 Nicolas Frayer - 2.06-110 +- fs/xfs: Add several fixes/improvements to xfs fs from upstream +- Resolves: #2247926 + * Wed Nov 15 2023 Nicolas Frayer - 2.06-109 - Linker: added --no-warn-rwx-segments as build will fail after ld.bfd default options have been changed. From cadd7a1196718a194f7e7cb650826f8c00eac1ed Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 1 Dec 2023 17:09:13 +0100 Subject: [PATCH 213/294] Migrate to SPDX license Please refer to https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_2 Signed-off-by: Nicolas Frayer --- grub2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 262196ed..5509ccb4 100644 --- a/grub2.spec +++ b/grub2.spec @@ -19,7 +19,7 @@ Epoch: 1 Version: 2.06 Release: 110%{?dist} Summary: Bootloader with support for Linux, Multiboot and more -License: GPLv3+ +License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ Obsoletes: grub < 1:0.98 Source0: https://ftp.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz From 4562b72afc296be6d0a9fa16d8b0e5729d32cca0 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Tue, 12 Dec 2023 18:26:32 -0600 Subject: [PATCH 214/294] chainloader: remove device path debug message Signed-off-by: Leo Sandoval --- ...der-remove-device-path-debug-message.patch | 28 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 0347-chainloader-remove-device-path-debug-message.patch diff --git a/0347-chainloader-remove-device-path-debug-message.patch b/0347-chainloader-remove-device-path-debug-message.patch new file mode 100644 index 00000000..ef7720f8 --- /dev/null +++ b/0347-chainloader-remove-device-path-debug-message.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: raravind +Date: Tue, 9 May 2023 11:29:35 +0200 +Subject: [PATCH] chainloader: remove device path debug message + +Remove the debug message "/EndEntire" while using GRUB chainloader command. + +Signed-off-by: raravind +(cherry picked from commit f75f5386b7a6a7cb2e10d30f817a3564c0a28dd7) +--- + grub-core/loader/efi/chainloader.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index dd31ac9bb..b1c86dab2 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -210,7 +210,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) + /* Fill the file path for the directory. */ + d = (grub_efi_device_path_t *) ((char *) file_path + + ((char *) d - (char *) dp)); +- grub_efi_print_device_path (d); + if (copy_file_path ((grub_efi_file_path_device_path_t *) d, + dir_start, dir_end - dir_start) != GRUB_ERR_NONE) + { +-- +2.43.0 + diff --git a/grub.patches b/grub.patches index 0ce0db20..76772d43 100644 --- a/grub.patches +++ b/grub.patches @@ -344,3 +344,4 @@ Patch0343: 0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch Patch0344: 0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch Patch0345: 0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch Patch0346: 0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch +Patch0347: 0347-chainloader-remove-device-path-debug-message.patch \ No newline at end of file diff --git a/grub2.spec b/grub2.spec index 5509ccb4..59799230 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 110%{?dist} +Release: 111%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Dec 12 2023 leo sandoval - 2.06-111 +- chainloader: remove device path debug message + * Fri Dec 1 2023 Nicolas Frayer - 2.06-110 - fs/xfs: Add several fixes/improvements to xfs fs from upstream - Resolves: #2247926 From d11c8385d62892c56b33ffad2cb280e0ec4fe9e5 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 19 Dec 2023 17:32:37 +0100 Subject: [PATCH 215/294] normal: fix prefix when loading modules Resolves: #2209435 Resolves: #2173015 Signed-off-by: Nicolas Frayer --- ...ub_env_set-prefix-in-grub_try_normal.patch | 27 +++++++++++++++++++ grub.patches | 3 ++- grub2.spec | 7 ++++- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch diff --git a/0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch b/0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch new file mode 100644 index 00000000..900c59a0 --- /dev/null +++ b/0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Tue, 19 Dec 2023 16:52:05 +0100 +Subject: [PATCH] normal: Remove grub_env_set prefix in grub_try_normal_prefix + +Commit de735a453aa35 added a grub_env_set where the prefix contains +the arch name in the pathname. This create issues when trying to +load modules using this prefix as the pathname contains a "doubled" +arch name in it (ie .../powerpc-ieee1275/powerpc-ieee1275/). + +Signed-off-by: Nicolas Frayer +--- + grub-core/normal/main.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index d59145f861d5..bac7b8a0e1d8 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -372,7 +372,6 @@ grub_try_normal_prefix (const char *prefix) + file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); + if (file) + { +- grub_env_set ("prefix", prefix); + grub_file_close (file); + err = GRUB_ERR_NONE; + } diff --git a/grub.patches b/grub.patches index 76772d43..7faf27d5 100644 --- a/grub.patches +++ b/grub.patches @@ -344,4 +344,5 @@ Patch0343: 0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch Patch0344: 0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch Patch0345: 0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch Patch0346: 0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch -Patch0347: 0347-chainloader-remove-device-path-debug-message.patch \ No newline at end of file +Patch0347: 0347-chainloader-remove-device-path-debug-message.patch +Patch0348: 0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch diff --git a/grub2.spec b/grub2.spec index 59799230..b37e5f27 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 111%{?dist} +Release: 112%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Dec 19 2023 Nicolas Frayer - 2.06-112 +- normal: fix prefix when loading modules +- Resolves: #2209435 +- Resolves: #2173015 + * Tue Dec 12 2023 leo sandoval - 2.06-111 - chainloader: remove device path debug message From a162c0412f5681d22d4e2d457fb65d0136b0ba19 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 11 Jan 2024 18:52:21 +0100 Subject: [PATCH 216/294] Drop grub2-tools obsoletes for grub2-tools-minimal When installing grub2-tools grub2-tools-minimal is pulled in which obsoletes grub2-tools causing grub2-tools to not get installed. Remove the obsoletes so that grub2-tools can be installed again. Signed-off-by: Daan De Meyer --- grub2.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grub2.spec b/grub2.spec index b37e5f27..194ff010 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 112%{?dist} +Release: 113%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -135,7 +135,6 @@ This subpackage provides tools for support of EFI platforms. Summary: Support tools for GRUB. Requires: gettext-runtime Requires: grub2-common = %{epoch}:%{version}-%{release} -Obsoletes: grub2-tools < %{evr} %description tools-minimal %{desc} @@ -555,6 +554,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Jan 11 2024 Daan De Meyer - 2.06-113 +- Don't obsolete the tools package with minimal + * Tue Dec 19 2023 Nicolas Frayer - 2.06-112 - normal: fix prefix when loading modules - Resolves: #2209435 From 0c1c9228d28a5f89403662ab0df73878b21421b6 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Wed, 10 Jan 2024 22:35:30 +0900 Subject: [PATCH 217/294] Switch memdisk compression to lzop xz decompression is very slow and slows down boot by around 5 seconds on aarch64/Apple M1 when using the default font. Switch to lzop, which takes less than one second to uncompress. This increases EFI core image size by around 11%. Signed-off-by: Hector Martin --- grub.macros | 6 +++--- grub2.spec | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/grub.macros b/grub.macros index 0198ffc3..241baf82 100644 --- a/grub.macros +++ b/grub.macros @@ -419,7 +419,7 @@ rm -f %{1}.conf \ %define efi_mkimage() \ mkdir -p memdisk/fonts \ cp %{4}/unicode.pf2 memdisk/fonts \ -mksquashfs memdisk memdisk.squashfs -comp xz \ +mksquashfs memdisk memdisk.squashfs -comp lzo \ %{4}./grub-mkimage -O %{1} -o %{2}.orig \\\ -d grub-core \\\ --sbat %{4}./sbat.csv \\\ @@ -448,14 +448,14 @@ mksquashfs memdisk memdisk.squashfs -comp xz \ %define ieee1275_mkimage() \ mkdir -p memdisk/fonts \ cp %{5}/unicode.pf2 memdisk/fonts \ -mksquashfs memdisk memdisk.squashfs -comp xz \ +mksquashfs memdisk memdisk.squashfs -comp lzo \ ./grub-mkimage -O %{1} -o %{2} -p '/grub2' -d grub-core ${GRUB_MODULES} \ %{nil} %else %define ieee1275_mkimage() \ mkdir -p memdisk/fonts \ cp %{5}/unicode.pf2 memdisk/fonts \ -mksquashfs memdisk memdisk.squashfs -comp xz \ +mksquashfs memdisk memdisk.squashfs -comp lzo \ APPENDED_SIG_SIZE=0 \ if [ -x /usr/bin/rpm-sign ]; then \ touch empty.unsigned \ diff --git a/grub2.spec b/grub2.spec index 194ff010..d22be547 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 113%{?dist} +Release: 114%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -554,6 +554,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Sat Jan 13 2024 Hector Martin - 2.06-114 +- Switch memdisk compression to lzop + * Thu Jan 11 2024 Daan De Meyer - 2.06-113 - Don't obsolete the tools package with minimal From ebd311ec521055eee09f81f2b97bf6231217135e Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Mon, 8 Jan 2024 16:19:01 +0100 Subject: [PATCH 218/294] xfs: Remove directory extent parsing patch Some bios systems can't boot with one of the xfs upstream patches Resolves: #2254370 Signed-off-by: Nicolas Frayer --- ...-extent-counters-incompat-feature-su.patch | 0 ...xfs-Fix-XFS-directory-extent-parsing.patch | 168 ------------------ ...der-remove-device-path-debug-message.patch | 0 ...ub_env_set-prefix-in-grub_try_normal.patch | 0 grub.patches | 7 +- grub2.spec | 6 +- 6 files changed, 8 insertions(+), 173 deletions(-) rename 0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch => 0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch (100%) delete mode 100644 0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch rename 0347-chainloader-remove-device-path-debug-message.patch => 0346-chainloader-remove-device-path-debug-message.patch (100%) rename 0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch => 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch (100%) diff --git a/0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch b/0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch similarity index 100% rename from 0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch rename to 0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch diff --git a/0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch b/0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch deleted file mode 100644 index c0057310..00000000 --- a/0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jon DeVree -Date: Tue, 17 Oct 2023 23:03:47 -0400 -Subject: [PATCH] fs/xfs: Fix XFS directory extent parsing - -The XFS directory entry parsing code has never been completely correct -for extent based directories. The parser correctly handles the case -where the directory is contained in a single extent, but then mistakenly -assumes the data blocks for the multiple extent case are each identical -to the single extent case. The difference in the format of the data -blocks between the two cases is tiny enough that its gone unnoticed for -a very long time. - -A recent change introduced some additional bounds checking into the XFS -parser. Like GRUB's existing parser, it is correct for the single extent -case but incorrect for the multiple extent case. When parsing a directory -with multiple extents, this new bounds checking is sometimes (but not -always) tripped and triggers an "invalid XFS directory entry" error. This -probably would have continued to go unnoticed but the /boot/grub/ -directory is large enough that it often has multiple extents. - -The difference between the two cases is that when there are multiple -extents, the data blocks do not contain a trailer nor do they contain -any leaf information. That information is stored in a separate set of -extents dedicated to just the leaf information. These extents come after -the directory entry extents and are not included in the inode size. So -the existing parser already ignores the leaf extents. - -The only reason to read the trailer/leaf information at all is so that -the parser can avoid misinterpreting that data as directory entries. So -this updates the parser as follows: - -For the single extent case the parser doesn't change much: -1. Read the size of the leaf information from the trailer -2. Set the end pointer for the parser to the start of the leaf - information. (The previous bounds checking set the end pointer to the - start of the trailer, so this is actually a small improvement.) -3. Set the entries variable to the expected number of directory entries. - -For the multiple extent case: -1. Set the end pointer to the end of the block. -2. Do not set up the entries variable. Figuring out how many entries are - in each individual block is complex and does not seem worth it when - it appears to be safe to just iterate over the entire block. - -The bounds check itself was also dependent upon the faulty XFS parser -because it accidentally used "filename + length - 1". Presumably this -was able to pass the fuzzer because in the old parser there was always -8 bytes of slack space between the tail pointer and the actual end of -the block. Since this is no longer the case the bounds check needs to be -updated to "filename + length + 1" in order to prevent a regression in -the handling of corrupt fliesystems. - -Notes: -* When there is only one extent there will only ever be one block. If - more than one block is required then XFS will always switch to holding - leaf information in a separate extent. -* B-tree based directories seems to be parsed properly by the same code - that handles multiple extents. This is unlikely to ever occur within - /boot though because its only used when there are an extremely large - number of directory entries. - -Fixes: ef7850c75 (fs/xfs: Fix issues found while fuzzing the XFS filesystem) -Fixes: b2499b29c (Adds support for the XFS filesystem.) -Fixes: https://savannah.gnu.org/bugs/?64376 - -Signed-off-by: Jon DeVree -Reviewed-by: Daniel Kiper -Tested-by: Sebastian Andrzej Siewior -Tested-by: Marta Lewandowska ---- - grub-core/fs/xfs.c | 52 ++++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 38 insertions(+), 14 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index ebf962793fa7..18edfcff486c 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -223,6 +223,12 @@ struct grub_xfs_inode - /* Size of struct grub_xfs_inode v2, up to unused4 member included. */ - #define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76) - -+struct grub_xfs_dir_leaf_entry -+{ -+ grub_uint32_t hashval; -+ grub_uint32_t address; -+} GRUB_PACKED; -+ - struct grub_xfs_dirblock_tail - { - grub_uint32_t leaf_count; -@@ -874,9 +880,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - { - struct grub_xfs_dir2_entry *direntry = - grub_xfs_first_de(dir->data, dirblock); -- int entries; -- struct grub_xfs_dirblock_tail *tail = -- grub_xfs_dir_tail(dir->data, dirblock); -+ int entries = -1; -+ char *end = dirblock + dirblk_size; - - numread = grub_xfs_read_file (dir, 0, 0, - blk << dirblk_log2, -@@ -887,14 +892,27 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - return 0; - } - -- entries = (grub_be_to_cpu32 (tail->leaf_count) -- - grub_be_to_cpu32 (tail->leaf_stale)); -+ /* -+ * Leaf and tail information are only in the data block if the number -+ * of extents is 1. -+ */ -+ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) -+ { -+ struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock); - -- if (!entries) -- continue; -+ end = (char *) tail; -+ -+ /* Subtract the space used by leaf nodes. */ -+ end -= grub_be_to_cpu32 (tail->leaf_count) * sizeof (struct grub_xfs_dir_leaf_entry); -+ -+ entries = grub_be_to_cpu32 (tail->leaf_count) - grub_be_to_cpu32 (tail->leaf_stale); -+ -+ if (!entries) -+ continue; -+ } - - /* Iterate over all entries within this block. */ -- while ((char *)direntry < (char *)tail) -+ while ((char *) direntry < (char *) end) - { - grub_uint8_t *freetag; - char *filename; -@@ -914,7 +932,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - } - - filename = (char *)(direntry + 1); -- if (filename + direntry->len - 1 > (char *) tail) -+ if (filename + direntry->len + 1 > (char *) end) - return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); - - /* The byte after the filename is for the filetype, padding, or -@@ -928,11 +946,17 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - return 1; - } - -- /* Check if last direntry in this block is -- reached. */ -- entries--; -- if (!entries) -- break; -+ /* -+ * The expected number of directory entries is only tracked for the -+ * single extent case. -+ */ -+ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) -+ { -+ /* Check if last direntry in this block is reached. */ -+ entries--; -+ if (!entries) -+ break; -+ } - - /* Select the next directory entry. */ - direntry = grub_xfs_next_de(dir->data, direntry); diff --git a/0347-chainloader-remove-device-path-debug-message.patch b/0346-chainloader-remove-device-path-debug-message.patch similarity index 100% rename from 0347-chainloader-remove-device-path-debug-message.patch rename to 0346-chainloader-remove-device-path-debug-message.patch diff --git a/0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch b/0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch similarity index 100% rename from 0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch rename to 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch diff --git a/grub.patches b/grub.patches index 7faf27d5..e791a0ba 100644 --- a/grub.patches +++ b/grub.patches @@ -342,7 +342,6 @@ Patch0341: 0341-fs-Remove-trailing-whitespaces.patch Patch0342: 0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch Patch0343: 0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch Patch0344: 0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch -Patch0345: 0345-fs-xfs-Fix-XFS-directory-extent-parsing.patch -Patch0346: 0346-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch -Patch0347: 0347-chainloader-remove-device-path-debug-message.patch -Patch0348: 0348-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch +Patch0345: 0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch +Patch0346: 0346-chainloader-remove-device-path-debug-message.patch +Patch0347: 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch diff --git a/grub2.spec b/grub2.spec index d22be547..ee8599ea 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 114%{?dist} +Release: 115%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -554,6 +554,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Jan 17 2024 Nicolas Frayer - 2.06-115 +- xfs: some bios systems can't boot with one of the xfs upstream patches +- Resolves: #2254370 + * Sat Jan 13 2024 Hector Martin - 2.06-114 - Switch memdisk compression to lzop From d2d9f6012b8fb9173db0317e316c89f74f716319 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Wed, 25 Oct 2023 16:57:09 +0200 Subject: [PATCH 219/294] grub-core/commands: add flag to only search root dev Resolves: #2223437 Resolves: #2224951 Resolves: #2258096 Resolves: CVE-2023-4001 Signed-off-by: Nicolas Frayer --- 0348-add-flag-to-only-search-root-dev.patch | 160 ++++++++++++++++++++ grub.patches | 1 + grub2.spec | 11 +- 3 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 0348-add-flag-to-only-search-root-dev.patch diff --git a/0348-add-flag-to-only-search-root-dev.patch b/0348-add-flag-to-only-search-root-dev.patch new file mode 100644 index 00000000..8ae8875a --- /dev/null +++ b/0348-add-flag-to-only-search-root-dev.patch @@ -0,0 +1,160 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Marta Lewandowska +Date: Mon, 9 Oct 2023 08:53:18 +0200 +Subject: [PATCH] add flag to only search root dev + +fixes bz#2223437 + +Signed-off-by: Marta Lewandowska +--- + grub-core/commands/search.c | 36 ++++++++++++++++++++++++++++++++++++ + grub-core/commands/search_wrap.c | 5 +++++ + grub-core/kern/misc.c | 30 ++++++++++++++++++++++++++++++ + include/grub/misc.h | 1 + + include/grub/search.h | 3 ++- + 5 files changed, 74 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index 57d26ced8a8e..819231751c38 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -85,6 +85,42 @@ iterate_device (const char *name, void *data) + grub_device_close (dev); + } + ++ /* Skip it if it's not the root device when requested. */ ++ if (ctx->flags & SEARCH_FLAGS_ROOTDEV_ONLY) ++ { ++ const char *root_dev; ++ root_dev = grub_env_get ("root"); ++ if (root_dev != NULL && *root_dev != '\0') ++ { ++ char *root_disk = grub_malloc (grub_strlen(root_dev) + 1); ++ char *name_disk = grub_malloc (grub_strlen(name) + 1); ++ char *rem_1 = grub_malloc(grub_strlen(root_dev) + 1); ++ char *rem_2 = grub_malloc(grub_strlen(name) + 1); ++ ++ if (root_disk != NULL && name_disk != NULL && ++ rem_1 != NULL && rem_2 != NULL) ++ { ++ /* get just the disk name; partitions will be different. */ ++ grub_str_sep (root_dev, root_disk, ',', rem_1); ++ grub_str_sep (name, name_disk, ',', rem_2); ++ if (root_disk != NULL && *root_disk != '\0' && ++ name_disk != NULL && *name_disk != '\0') ++ if (grub_strcmp(root_disk, name_disk) != 0) ++ { ++ grub_free (root_disk); ++ grub_free (name_disk); ++ grub_free (rem_1); ++ grub_free (rem_2); ++ return 0; ++ } ++ } ++ grub_free (root_disk); ++ grub_free (name_disk); ++ grub_free (rem_1); ++ grub_free (rem_2); ++ } ++ } ++ + #ifdef DO_SEARCH_FS_UUID + #define compare_fn grub_strcasecmp + #else +diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c +index 0b62acf85359..06b5f51eefb5 100644 +--- a/grub-core/commands/search_wrap.c ++++ b/grub-core/commands/search_wrap.c +@@ -41,6 +41,7 @@ static const struct grub_arg_option options[] = + ARG_TYPE_STRING}, + {"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0}, + {"efidisk-only", 0, 0, N_("Only probe EFI disks."), 0, 0}, ++ {"root-dev-only", 'r', 0, N_("Only probe root device."), 0, 0}, + {"hint", 'h', GRUB_ARG_OPTION_REPEATABLE, + N_("First try the device HINT. If HINT ends in comma, " + "also try subpartitions"), N_("HINT"), ARG_TYPE_STRING}, +@@ -75,6 +76,7 @@ enum options + SEARCH_SET, + SEARCH_NO_FLOPPY, + SEARCH_EFIDISK_ONLY, ++ SEARCH_ROOTDEV_ONLY, + SEARCH_HINT, + SEARCH_HINT_IEEE1275, + SEARCH_HINT_BIOS, +@@ -189,6 +191,9 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) + if (state[SEARCH_EFIDISK_ONLY].set) + flags |= SEARCH_FLAGS_EFIDISK_ONLY; + ++ if (state[SEARCH_ROOTDEV_ONLY].set) ++ flags |= SEARCH_FLAGS_ROOTDEV_ONLY; ++ + if (state[SEARCH_LABEL].set) + grub_search_label (id, var, flags, hints, nhints); + else if (state[SEARCH_FS_UUID].set) +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index cb454614022f..c0ac7fee6cc2 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -619,6 +619,36 @@ grub_reverse (char *str) + } + } + ++/* Separate string into two parts, broken up by delimiter delim. */ ++void ++grub_str_sep (const char *s, char *p, char delim, char *r) ++{ ++ char* t = grub_strndup(s, grub_strlen(s)); ++ ++ if (t != NULL && *t != '\0') ++ { ++ char* tmp = t; ++ ++ while (((*p = *t) != '\0') && ((*p = *t) != delim)) ++ { ++ p++; ++ t++; ++ } ++ *p = '\0'; ++ ++ if (*t != '\0') ++ { ++ t++; ++ while ((*r++ = *t++) != '\0') ++ ; ++ *r = '\0'; ++ } ++ grub_free (tmp); ++ } ++ else ++ grub_free (t); ++} ++ + /* Divide N by D, return the quotient, and store the remainder in *R. */ + grub_uint64_t + grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) +diff --git a/include/grub/misc.h b/include/grub/misc.h +index faae0ae8606c..981526644d29 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -314,6 +314,7 @@ void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); + grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) WARN_UNUSED_RESULT; + int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); + int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); ++void EXPORT_FUNC(grub_str_sep) (const char *s, char *p, char delim, char *r); + + /* Replace all `ch' characters of `input' with `with' and copy the + result into `output'; return EOS address of `output'. */ +diff --git a/include/grub/search.h b/include/grub/search.h +index 4190aeb2cbf5..321d1400e451 100644 +--- a/include/grub/search.h ++++ b/include/grub/search.h +@@ -22,7 +22,8 @@ + enum search_flags + { + SEARCH_FLAGS_NO_FLOPPY = 1, +- SEARCH_FLAGS_EFIDISK_ONLY = 2 ++ SEARCH_FLAGS_EFIDISK_ONLY = 2, ++ SEARCH_FLAGS_ROOTDEV_ONLY = 4 + }; + + void grub_search_fs_file (const char *key, const char *var, diff --git a/grub.patches b/grub.patches index e791a0ba..caf506f6 100644 --- a/grub.patches +++ b/grub.patches @@ -345,3 +345,4 @@ Patch0344: 0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch Patch0345: 0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch Patch0346: 0346-chainloader-remove-device-path-debug-message.patch Patch0347: 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch +Patch0348: 0348-add-flag-to-only-search-root-dev.patch diff --git a/grub2.spec b/grub2.spec index ee8599ea..29291756 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 115%{?dist} +Release: 116%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -368,7 +368,7 @@ BOOT_UUID=$(grub2-probe --target=fs_uuid ${GRUB_HOME}) GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME}) cat << EOF > ${EFI_HOME}/grub.cfg.stb -search --no-floppy --fs-uuid --set=dev ${BOOT_UUID} +search --no-floppy --root-dev-only --fs-uuid --set=dev ${BOOT_UUID} set prefix=(\$dev)${GRUB_DIR} export \$prefix configfile \$prefix/grub.cfg @@ -554,6 +554,13 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Jan 17 2024 Nicolas Frayer - 2.06-116 +- grub-core/commands: add flag to only search root dev +- Resolves: #2223437 +- Resolves: #2224951 +- Resolves: #2258096 +- Resolves: CVE-2023-4001 + * Wed Jan 17 2024 Nicolas Frayer - 2.06-115 - xfs: some bios systems can't boot with one of the xfs upstream patches - Resolves: #2254370 From 6cc927e76bffc1176bd888f527020e8985096747 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Wed, 17 Jan 2024 21:20:45 +0100 Subject: [PATCH 220/294] Compiler flags: ignore incompatible types for now as it prevents CI builds Signed-off-by: Nicolas Frayer --- ...nore-warnings-for-incompatible-types.patch | 28 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 0349-Ignore-warnings-for-incompatible-types.patch diff --git a/0349-Ignore-warnings-for-incompatible-types.patch b/0349-Ignore-warnings-for-incompatible-types.patch new file mode 100644 index 00000000..73e99109 --- /dev/null +++ b/0349-Ignore-warnings-for-incompatible-types.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Wed, 17 Jan 2024 21:15:14 +0100 +Subject: [PATCH] Ignore warnings for incompatible types + +Add -Wno-incompatible-pointer-types to ignore warnings for incompatible +types + +Signed-off-by: Nicolas Frayer +--- + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 79f45ef1e14c..b66e07c67851 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2009,8 +2009,8 @@ if test x"$enable_wextra" != xno ; then + HOST_CFLAGS="$HOST_CFLAGS -Wextra" + fi + +-TARGET_CFLAGS="$TARGET_CFLAGS -Werror=trampolines -fno-trampolines" +-HOST_CFLAGS="$HOST_CFLAGS -Werror=trampolines -fno-trampolines" ++TARGET_CFLAGS="$TARGET_CFLAGS -Werror=trampolines -fno-trampolines -Wno-incompatible-pointer-types" ++HOST_CFLAGS="$HOST_CFLAGS -Werror=trampolines -fno-trampolines -Wno-incompatible-pointer-types" + + TARGET_CPP="$TARGET_CC -E" + TARGET_CCAS=$TARGET_CC diff --git a/grub.patches b/grub.patches index caf506f6..addf3e58 100644 --- a/grub.patches +++ b/grub.patches @@ -346,3 +346,4 @@ Patch0345: 0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch Patch0346: 0346-chainloader-remove-device-path-debug-message.patch Patch0347: 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch Patch0348: 0348-add-flag-to-only-search-root-dev.patch +Patch0349: 0349-Ignore-warnings-for-incompatible-types.patch diff --git a/grub2.spec b/grub2.spec index 29291756..34a3c8fd 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 116%{?dist} +Release: 117%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -554,6 +554,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Jan 17 2024 Nicolas Frayer - 2.06-117 +- Compiler flags: ignore incompatible types for now as it prevents +CI builds + * Wed Jan 17 2024 Nicolas Frayer - 2.06-116 - grub-core/commands: add flag to only search root dev - Resolves: #2223437 From 29406ad33366ac899ae5035cf26589d82652bc9e Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Tue, 23 Jan 2024 11:40:22 -0600 Subject: [PATCH 221/294] xfs: include directory extent parsing patch Patch is required to boot XFS-formatted partitions created with xfsprogs 6.5.0 Resolves: #2259266 Signed-off-by: Leo Sandoval --- ...xfs-Fix-XFS-directory-extent-parsing.patch | 168 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 8 +- 3 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch diff --git a/0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch b/0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch new file mode 100644 index 00000000..c0057310 --- /dev/null +++ b/0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch @@ -0,0 +1,168 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jon DeVree +Date: Tue, 17 Oct 2023 23:03:47 -0400 +Subject: [PATCH] fs/xfs: Fix XFS directory extent parsing + +The XFS directory entry parsing code has never been completely correct +for extent based directories. The parser correctly handles the case +where the directory is contained in a single extent, but then mistakenly +assumes the data blocks for the multiple extent case are each identical +to the single extent case. The difference in the format of the data +blocks between the two cases is tiny enough that its gone unnoticed for +a very long time. + +A recent change introduced some additional bounds checking into the XFS +parser. Like GRUB's existing parser, it is correct for the single extent +case but incorrect for the multiple extent case. When parsing a directory +with multiple extents, this new bounds checking is sometimes (but not +always) tripped and triggers an "invalid XFS directory entry" error. This +probably would have continued to go unnoticed but the /boot/grub/ +directory is large enough that it often has multiple extents. + +The difference between the two cases is that when there are multiple +extents, the data blocks do not contain a trailer nor do they contain +any leaf information. That information is stored in a separate set of +extents dedicated to just the leaf information. These extents come after +the directory entry extents and are not included in the inode size. So +the existing parser already ignores the leaf extents. + +The only reason to read the trailer/leaf information at all is so that +the parser can avoid misinterpreting that data as directory entries. So +this updates the parser as follows: + +For the single extent case the parser doesn't change much: +1. Read the size of the leaf information from the trailer +2. Set the end pointer for the parser to the start of the leaf + information. (The previous bounds checking set the end pointer to the + start of the trailer, so this is actually a small improvement.) +3. Set the entries variable to the expected number of directory entries. + +For the multiple extent case: +1. Set the end pointer to the end of the block. +2. Do not set up the entries variable. Figuring out how many entries are + in each individual block is complex and does not seem worth it when + it appears to be safe to just iterate over the entire block. + +The bounds check itself was also dependent upon the faulty XFS parser +because it accidentally used "filename + length - 1". Presumably this +was able to pass the fuzzer because in the old parser there was always +8 bytes of slack space between the tail pointer and the actual end of +the block. Since this is no longer the case the bounds check needs to be +updated to "filename + length + 1" in order to prevent a regression in +the handling of corrupt fliesystems. + +Notes: +* When there is only one extent there will only ever be one block. If + more than one block is required then XFS will always switch to holding + leaf information in a separate extent. +* B-tree based directories seems to be parsed properly by the same code + that handles multiple extents. This is unlikely to ever occur within + /boot though because its only used when there are an extremely large + number of directory entries. + +Fixes: ef7850c75 (fs/xfs: Fix issues found while fuzzing the XFS filesystem) +Fixes: b2499b29c (Adds support for the XFS filesystem.) +Fixes: https://savannah.gnu.org/bugs/?64376 + +Signed-off-by: Jon DeVree +Reviewed-by: Daniel Kiper +Tested-by: Sebastian Andrzej Siewior +Tested-by: Marta Lewandowska +--- + grub-core/fs/xfs.c | 52 ++++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 38 insertions(+), 14 deletions(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index ebf962793fa7..18edfcff486c 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -223,6 +223,12 @@ struct grub_xfs_inode + /* Size of struct grub_xfs_inode v2, up to unused4 member included. */ + #define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76) + ++struct grub_xfs_dir_leaf_entry ++{ ++ grub_uint32_t hashval; ++ grub_uint32_t address; ++} GRUB_PACKED; ++ + struct grub_xfs_dirblock_tail + { + grub_uint32_t leaf_count; +@@ -874,9 +880,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + { + struct grub_xfs_dir2_entry *direntry = + grub_xfs_first_de(dir->data, dirblock); +- int entries; +- struct grub_xfs_dirblock_tail *tail = +- grub_xfs_dir_tail(dir->data, dirblock); ++ int entries = -1; ++ char *end = dirblock + dirblk_size; + + numread = grub_xfs_read_file (dir, 0, 0, + blk << dirblk_log2, +@@ -887,14 +892,27 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + return 0; + } + +- entries = (grub_be_to_cpu32 (tail->leaf_count) +- - grub_be_to_cpu32 (tail->leaf_stale)); ++ /* ++ * Leaf and tail information are only in the data block if the number ++ * of extents is 1. ++ */ ++ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) ++ { ++ struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock); + +- if (!entries) +- continue; ++ end = (char *) tail; ++ ++ /* Subtract the space used by leaf nodes. */ ++ end -= grub_be_to_cpu32 (tail->leaf_count) * sizeof (struct grub_xfs_dir_leaf_entry); ++ ++ entries = grub_be_to_cpu32 (tail->leaf_count) - grub_be_to_cpu32 (tail->leaf_stale); ++ ++ if (!entries) ++ continue; ++ } + + /* Iterate over all entries within this block. */ +- while ((char *)direntry < (char *)tail) ++ while ((char *) direntry < (char *) end) + { + grub_uint8_t *freetag; + char *filename; +@@ -914,7 +932,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + } + + filename = (char *)(direntry + 1); +- if (filename + direntry->len - 1 > (char *) tail) ++ if (filename + direntry->len + 1 > (char *) end) + return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); + + /* The byte after the filename is for the filetype, padding, or +@@ -928,11 +946,17 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + return 1; + } + +- /* Check if last direntry in this block is +- reached. */ +- entries--; +- if (!entries) +- break; ++ /* ++ * The expected number of directory entries is only tracked for the ++ * single extent case. ++ */ ++ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) ++ { ++ /* Check if last direntry in this block is reached. */ ++ entries--; ++ if (!entries) ++ break; ++ } + + /* Select the next directory entry. */ + direntry = grub_xfs_next_de(dir->data, direntry); diff --git a/grub.patches b/grub.patches index addf3e58..9df6ce7d 100644 --- a/grub.patches +++ b/grub.patches @@ -347,3 +347,4 @@ Patch0346: 0346-chainloader-remove-device-path-debug-message.patch Patch0347: 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch Patch0348: 0348-add-flag-to-only-search-root-dev.patch Patch0349: 0349-Ignore-warnings-for-incompatible-types.patch +Patch0350: 0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch \ No newline at end of file diff --git a/grub2.spec b/grub2.spec index 34a3c8fd..dcc99a48 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 117%{?dist} +Release: 118%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -554,6 +554,12 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jan 23 2024 Leo Sandoval - 2.06-118 +- xfs: include the 'directory extent parsing patch', otherwise +XFS-formatted partitions do not boot. This change effectively +reverts 2.06-115 +- Resolves: #2259266 + * Wed Jan 17 2024 Nicolas Frayer - 2.06-117 - Compiler flags: ignore incompatible types for now as it prevents CI builds From de8520b84a00acd5152bfacb433cc577fe825bca Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Wed, 7 Feb 2024 10:40:35 +0100 Subject: [PATCH 222/294] grub-set-bootflag: Fix for CVE-2024-1048 (CVE-2024-1048) Resolves: #2256678 Signed-off-by: Nicolas Frayer --- ...g-Conservative-partial-fix-for-CVE-2.patch | 146 ++++++++++++++ ...g-More-complete-fix-for-CVE-2024-104.patch | 187 ++++++++++++++++++ ...g-Exit-calmly-when-not-running-as-ro.patch | 36 ++++ grub.patches | 5 +- grub2.spec | 7 +- 5 files changed, 379 insertions(+), 2 deletions(-) create mode 100644 0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch create mode 100644 0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch create mode 100644 0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch diff --git a/0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch b/0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch new file mode 100644 index 00000000..d20f909b --- /dev/null +++ b/0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch @@ -0,0 +1,146 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Solar Designer +Date: Tue, 6 Feb 2024 21:39:41 +0100 +Subject: [PATCH] grub-set-bootflag: Conservative partial fix for CVE-2024-1048 + +Following up on CVE-2019-14865 and taking a fresh look at +grub2-set-bootflag now (through my work at CIQ on Rocky Linux), I saw some +other ways in which users could still abuse this little program: + +1. After CVE-2019-14865 fix, grub2-set-bootflag no longer rewrites the +grubenv file in-place, but writes into a temporary file and renames it +over the original, checking for error returns from each call first. +This prevents the original file truncation vulnerability, but it can +leave the temporary file around if the program is killed before it can +rename or remove the file. There are still many ways to get the program +killed, such as through RLIMIT_FSIZE triggering SIGXFSZ (tested, +reliable) or by careful timing (tricky) of signals sent by process group +leader, pty, pre-scheduled timers, SIGXCPU (probably not an exhaustive +list). Invoking the program multiple times fills up /boot (or if /boot +is not separate, then it can fill up the root filesystem). Since the +files are tiny, the filesystem is likely to run out of free inodes +before it'd run out of blocks, but the effect is similar - can't create +new files after this point (but still can add data to existing files, +such as logs). + +2. After CVE-2019-14865 fix, grub2-set-bootflag naively tries to protect +itself from signals by becoming full root. (This does protect it from +signals sent by the user directly to the PID, but e.g. "kill -9 -1" by +the user still works.) A side effect of such "protection" is that it's +possible to invoke more concurrent instances of grub2-set-bootflag than +the user's RLIMIT_NPROC would normally permit (as specified e.g. in +/etc/security/limits.conf, or say in Apache httpd's RLimitNPROC if +grub2-set-bootflag would be abused by a website script), thereby +exhausting system resources (e.g., bypassing RAM usage limit if +RLIMIT_AS was also set). + +3. umask is inherited. Again, due to how the CVE-2019-14865 fix creates +a new file, and due to how mkstemp() works, this affects grubenv's new +file permissions. Luckily, mkstemp() forces them to be no more relaxed +than 0600, but the user ends up being able to set them e.g. to 0. +Luckily, at least in my testing GRUB still works fine even when the file +has such (lack of) permissions. + +This commit deals with the abuses above as follows: + +1. RLIMIT_FSIZE is pre-checked, so this specific way to get the process +killed should no longer work. However, this isn't a complete fix +because there are other ways to get the process killed after it has +created the temporary file. + +The commit also fixes bug 1975892 ("RFE: grub2-set-bootflag should not +write the grubenv when the flag being written is already set") and +similar for "menu_show_once", which further reduces the abuse potential. + +2. RLIMIT_NPROC bypass should be avoided by not becoming full root (aka +dropping the partial "kill protection"). + +3. A safe umask is set. + +This is a partial fix (temporary files can still accumulate, but this is +harder to trigger). + +While at it, this commit also fixes potential 1- or 2-byte over-read of +env[] if its content is malformed - this was not a security issue since the +grubenv file is trusted input, and the fix is just for robustness. + +Signed-off-by: Solar Designer +--- + util/grub-set-bootflag.c | 29 ++++++++++++++++------------- + 1 file changed, 16 insertions(+), 13 deletions(-) + +diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c +index 3b4c25ca2ac6..5bbbef804391 100644 +--- a/util/grub-set-bootflag.c ++++ b/util/grub-set-bootflag.c +@@ -33,6 +33,8 @@ + #include + #include + #include ++#include ++#include + + #include "progname.h" + +@@ -57,12 +59,17 @@ static void usage(FILE *out) + int main(int argc, char *argv[]) + { + /* NOTE buf must be at least the longest bootflag length + 4 bytes */ +- char env[GRUBENV_SIZE + 1], buf[64], *s; ++ char env[GRUBENV_SIZE + 1 + 2], buf[64], *s; + /* +1 for 0 termination, +6 for "XXXXXX" in tmp filename */ + char env_filename[PATH_MAX + 1], tmp_filename[PATH_MAX + 6 + 1]; + const char *bootflag; + int i, fd, len, ret; + FILE *f; ++ struct rlimit rlim; ++ ++ if (getrlimit(RLIMIT_FSIZE, &rlim) || rlim.rlim_cur < GRUBENV_SIZE || rlim.rlim_max < GRUBENV_SIZE) ++ return 1; ++ umask(077); + + if (argc != 2) + { +@@ -94,20 +101,11 @@ int main(int argc, char *argv[]) + len = strlen (bootflag); + + /* +- * Really become root. setuid avoids an user killing us, possibly leaking +- * the tmpfile. setgid avoids the new grubenv's gid being that of the user. ++ * setegid avoids the new grubenv's gid being that of the user. + */ +- ret = setuid(0); +- if (ret) ++ if (setegid(0)) + { +- perror ("Error setuid(0) failed"); +- return 1; +- } +- +- ret = setgid(0); +- if (ret) +- { +- perror ("Error setgid(0) failed"); ++ perror ("Error setegid(0) failed"); + return 1; + } + +@@ -136,6 +134,9 @@ int main(int argc, char *argv[]) + + /* 0 terminate env */ + env[GRUBENV_SIZE] = 0; ++ /* not a valid flag value */ ++ env[GRUBENV_SIZE + 1] = 0; ++ env[GRUBENV_SIZE + 2] = 0; + + if (strncmp (env, GRUB_ENVBLK_SIGNATURE, strlen (GRUB_ENVBLK_SIGNATURE))) + { +@@ -171,6 +172,8 @@ int main(int argc, char *argv[]) + + /* The grubenv is not 0 terminated, so memcpy the name + '=' , '1', '\n' */ + snprintf(buf, sizeof(buf), "%s=1\n", bootflag); ++ if (!memcmp(s, buf, len + 3)) ++ return 0; /* nothing to do */ + memcpy(s, buf, len + 3); + + diff --git a/0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch b/0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch new file mode 100644 index 00000000..b47b3110 --- /dev/null +++ b/0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch @@ -0,0 +1,187 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Solar Designer +Date: Tue, 6 Feb 2024 21:56:21 +0100 +Subject: [PATCH] grub-set-bootflag: More complete fix for CVE-2024-1048 + +Switch to per-user fixed temporary filenames along with a weird locking +mechanism, which is explained in source code comments. This is a more +complete fix than the previous commit (temporary files can't accumulate). +Unfortunately, it introduces new risks (by working on a temporary file +shared between the user's invocations), which are _hopefully_ avoided by +the patch's elaborate logic. I actually got it wrong at first, which +suggests that this logic is hard to reason about, and more errors or +omissions are possible. It also relies on the kernel's primitives' exact +semantics to a greater extent (nothing out of the ordinary, though). + +Remaining issues that I think cannot reasonably be fixed without a +redesign (e.g., having per-flag files with nothing else in them) and +without introducing new issues: + +A. A user can still revert a concurrent user's attempt of setting the +other flag - or of making other changes to grubenv by means other than +this program. + +B. One leftover temporary file per user is still possible. + +Signed-off-by: Solar Designer +--- + util/grub-set-bootflag.c | 95 ++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 79 insertions(+), 16 deletions(-) + +diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c +index 5bbbef804391..514c4f9091ac 100644 +--- a/util/grub-set-bootflag.c ++++ b/util/grub-set-bootflag.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -60,15 +61,12 @@ int main(int argc, char *argv[]) + { + /* NOTE buf must be at least the longest bootflag length + 4 bytes */ + char env[GRUBENV_SIZE + 1 + 2], buf[64], *s; +- /* +1 for 0 termination, +6 for "XXXXXX" in tmp filename */ +- char env_filename[PATH_MAX + 1], tmp_filename[PATH_MAX + 6 + 1]; ++ /* +1 for 0 termination, +11 for ".%u" in tmp filename */ ++ char env_filename[PATH_MAX + 1], tmp_filename[PATH_MAX + 11 + 1]; + const char *bootflag; + int i, fd, len, ret; + FILE *f; +- struct rlimit rlim; + +- if (getrlimit(RLIMIT_FSIZE, &rlim) || rlim.rlim_cur < GRUBENV_SIZE || rlim.rlim_max < GRUBENV_SIZE) +- return 1; + umask(077); + + if (argc != 2) +@@ -105,7 +103,7 @@ int main(int argc, char *argv[]) + */ + if (setegid(0)) + { +- perror ("Error setegid(0) failed"); ++ perror ("setegid(0) failed"); + return 1; + } + +@@ -176,19 +174,82 @@ int main(int argc, char *argv[]) + return 0; /* nothing to do */ + memcpy(s, buf, len + 3); + ++ struct rlimit rlim; ++ if (getrlimit(RLIMIT_FSIZE, &rlim) || rlim.rlim_cur < GRUBENV_SIZE || rlim.rlim_max < GRUBENV_SIZE) ++ { ++ fprintf (stderr, "Resource limits undetermined or too low\n"); ++ return 1; ++ } ++ ++ /* ++ * Here we work under the premise that we shouldn't write into the target ++ * file directly because we might not be able to have all of our changes ++ * written completely and atomically. That was CVE-2019-14865, known to ++ * have been triggerable via RLIMIT_FSIZE. While we've dealt with that ++ * specific attack via the check above, there may be other possibilities. ++ */ + + /* + * Create a tempfile for writing the new env. Use the canonicalized filename + * for the template so that the tmpfile is in the same dir / on same fs. ++ * ++ * We now use per-user fixed temporary filenames, so that a user cannot cause ++ * multiple files to accumulate. ++ * ++ * We don't use O_EXCL so that a stale temporary file doesn't prevent further ++ * usage of the program by the user. + */ +- snprintf(tmp_filename, sizeof(tmp_filename), "%sXXXXXX", env_filename); +- fd = mkstemp(tmp_filename); ++ snprintf(tmp_filename, sizeof(tmp_filename), "%s.%u", env_filename, getuid()); ++ fd = open(tmp_filename, O_CREAT | O_WRONLY, 0600); + if (fd == -1) + { + perror ("Creating tmpfile failed"); + return 1; + } + ++ /* ++ * The lock prevents the same user from reaching further steps ending in ++ * rename() concurrently, in which case the temporary file only partially ++ * written by one invocation could be renamed to the target file by another. ++ * ++ * The lock also guards the slow fsync() from concurrent calls. After the ++ * first time that and the rename() complete, further invocations for the ++ * same flag become no-ops. ++ * ++ * We lock the temporary file rather than the target file because locking the ++ * latter would allow any user having SIGSTOP'ed their process to make all ++ * other users' invocations fail (or lock up if we'd use blocking mode). ++ * ++ * We use non-blocking mode (LOCK_NB) because the lock having been taken by ++ * another process implies that the other process would normally have already ++ * renamed the file to target by the time it releases the lock (and we could ++ * acquire it), so we'd be working directly on the target if we proceeded, ++ * which is undesirable, and we'd kind of fail on the already-done rename. ++ */ ++ if (flock(fd, LOCK_EX | LOCK_NB)) ++ { ++ perror ("Locking tmpfile failed"); ++ return 1; ++ } ++ ++ /* ++ * Deal with the potential that another invocation proceeded all the way to ++ * rename() and process exit while we were between open() and flock(). ++ */ ++ { ++ struct stat st1, st2; ++ if (fstat(fd, &st1) || stat(tmp_filename, &st2)) ++ { ++ perror ("stat of tmpfile failed"); ++ return 1; ++ } ++ if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) ++ { ++ fprintf (stderr, "Another invocation won race\n"); ++ return 1; ++ } ++ } ++ + f = fdopen (fd, "w"); + if (!f) + { +@@ -213,6 +274,14 @@ int main(int argc, char *argv[]) + return 1; + } + ++ ret = ftruncate (fileno (f), GRUBENV_SIZE); ++ if (ret) ++ { ++ perror ("Error truncating tmpfile"); ++ unlink(tmp_filename); ++ return 1; ++ } ++ + ret = fsync (fileno (f)); + if (ret) + { +@@ -221,15 +290,9 @@ int main(int argc, char *argv[]) + return 1; + } + +- ret = fclose (f); +- if (ret) +- { +- perror ("Error closing tmpfile"); +- unlink(tmp_filename); +- return 1; +- } +- + /* ++ * We must not close the file before rename() as that would remove the lock. ++ * + * And finally rename the tmpfile with the new env over the old env, the + * linux kernel guarantees that this is atomic (from a syscall pov). + */ diff --git a/0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch b/0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch new file mode 100644 index 00000000..dba46d4a --- /dev/null +++ b/0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Solar Designer +Date: Tue, 6 Feb 2024 22:05:45 +0100 +Subject: [PATCH] grub-set-bootflag: Exit calmly when not running as root + +Exit calmly when not installed SUID root and invoked by non-root. This +allows installing user/grub-boot-success.service unconditionally while +supporting non-SUID installation of the program for some limited usage. + +Signed-off-by: Solar Designer +--- + util/grub-set-bootflag.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c +index 514c4f9091ac..31a868aeca8a 100644 +--- a/util/grub-set-bootflag.c ++++ b/util/grub-set-bootflag.c +@@ -98,6 +98,17 @@ int main(int argc, char *argv[]) + bootflag = bootflags[i]; + len = strlen (bootflag); + ++ /* ++ * Exit calmly when not installed SUID root and invoked by non-root. This ++ * allows installing user/grub-boot-success.service unconditionally while ++ * supporting non-SUID installation of the program for some limited usage. ++ */ ++ if (geteuid()) ++ { ++ printf ("grub-set-bootflag not running as root, no action taken\n"); ++ return 0; ++ } ++ + /* + * setegid avoids the new grubenv's gid being that of the user. + */ diff --git a/grub.patches b/grub.patches index 9df6ce7d..14401950 100644 --- a/grub.patches +++ b/grub.patches @@ -347,4 +347,7 @@ Patch0346: 0346-chainloader-remove-device-path-debug-message.patch Patch0347: 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch Patch0348: 0348-add-flag-to-only-search-root-dev.patch Patch0349: 0349-Ignore-warnings-for-incompatible-types.patch -Patch0350: 0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch \ No newline at end of file +Patch0350: 0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch +Patch0351: 0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch +Patch0352: 0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch +Patch0353: 0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch diff --git a/grub2.spec b/grub2.spec index dcc99a48..f2ed0d90 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 118%{?dist} +Release: 119%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -554,6 +554,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Feb 7 2024 Nicolas Frayer - 2.06-119 +- grub-set-bootflag: Fix for CVE-2024-1048 +- (CVE-2024-1048) +- Resolves: #2256678 + * Tue Jan 23 2024 Leo Sandoval - 2.06-118 - xfs: include the 'directory extent parsing patch', otherwise XFS-formatted partitions do not boot. This change effectively From d2fcd91e363b55a6080af0e2bd427948014e51a9 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 8 Mar 2024 14:43:07 +0100 Subject: [PATCH 223/294] GRUB2 NTFS driver vulnerabilities (CVE-2023-4692) (CVE-2023-4693) Resolves: #2236613 Resolves: #2241978 Resolves: #2241976 Resolves: #2238343 Signed-off-by: Nicolas Frayer --- ...OB-write-when-parsing-the-ATTRIBUTE_.patch | 90 ++++++++++ ...OB-read-when-reading-data-from-the-r.patch | 55 ++++++ ...OB-read-when-parsing-directory-entri.patch | 70 ++++++++ ...OB-read-when-parsing-bitmaps-for-ind.patch | 48 ++++++ ...OOB-read-when-parsing-a-volume-label.patch | 58 +++++++ 0359-fs-ntfs-Make-code-more-readable.patch | 156 ++++++++++++++++++ grub.patches | 6 + grub2.spec | 11 +- 8 files changed, 493 insertions(+), 1 deletion(-) create mode 100644 0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch create mode 100644 0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch create mode 100644 0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch create mode 100644 0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch create mode 100644 0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch create mode 100644 0359-fs-ntfs-Make-code-more-readable.patch diff --git a/0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch b/0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch new file mode 100644 index 00000000..8c2905a6 --- /dev/null +++ b/0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch @@ -0,0 +1,90 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Tue, 3 Oct 2023 19:12:23 +0200 +Subject: [PATCH] fs/ntfs: Fix an OOB write when parsing the $ATTRIBUTE_LIST + attribute for the $MFT file + +When parsing an extremely fragmented $MFT file, i.e., the file described +using the $ATTRIBUTE_LIST attribute, current NTFS code will reuse a buffer +containing bytes read from the underlying drive to store sector numbers, +which are consumed later to read data from these sectors into another buffer. + +These sectors numbers, two 32-bit integers, are always stored at predefined +offsets, 0x10 and 0x14, relative to first byte of the selected entry within +the $ATTRIBUTE_LIST attribute. Usually, this won't cause any problem. + +However, when parsing a specially-crafted file system image, this may cause +the NTFS code to write these integers beyond the buffer boundary, likely +causing the GRUB memory allocator to misbehave or fail. These integers contain +values which are controlled by on-disk structures of the NTFS file system. + +Such modification and resulting misbehavior may touch a memory range not +assigned to the GRUB and owned by firmware or another EFI application/driver. + +This fix introduces checks to ensure that these sector numbers are never +written beyond the boundary. + +Fixes: CVE-2023-4692 + +Reported-by: Maxim Suhanov +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 3511e4e2cb6f..4681c7ac32a8 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -184,7 +184,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + } + if (at->attr_end) + { +- grub_uint8_t *pa; ++ grub_uint8_t *pa, *pa_end; + + at->emft_buf = grub_malloc (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); + if (at->emft_buf == NULL) +@@ -209,11 +209,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + } + at->attr_nxt = at->edat_buf; + at->attr_end = at->edat_buf + u32at (pa, 0x30); ++ pa_end = at->edat_buf + n; + } + else + { + at->attr_nxt = at->attr_end + u16at (pa, 0x14); + at->attr_end = at->attr_end + u32at (pa, 4); ++ pa_end = at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); + } + at->flags |= GRUB_NTFS_AF_ALST; + while (at->attr_nxt < at->attr_end) +@@ -230,6 +232,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + at->flags |= GRUB_NTFS_AF_GPOS; + at->attr_cur = at->attr_nxt; + pa = at->attr_cur; ++ ++ if ((pa >= pa_end) || (pa_end - pa < 0x18)) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "can\'t parse attribute list"); ++ return NULL; ++ } ++ + grub_set_unaligned32 ((char *) pa + 0x10, + grub_cpu_to_le32 (at->mft->data->mft_start)); + grub_set_unaligned32 ((char *) pa + 0x14, +@@ -240,6 +249,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + { + if (*pa != attr) + break; ++ ++ if ((pa >= pa_end) || (pa_end - pa < 0x18)) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "can\'t parse attribute list"); ++ return NULL; ++ } ++ + if (read_attr + (at, pa + 0x10, + u32at (pa, 0x10) * (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR), diff --git a/0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch b/0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch new file mode 100644 index 00000000..4b506f4f --- /dev/null +++ b/0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Tue, 3 Oct 2023 19:12:24 +0200 +Subject: [PATCH] fs/ntfs: Fix an OOB read when reading data from the resident + $DATA attribute + +When reading a file containing resident data, i.e., the file data is stored in +the $DATA attribute within the NTFS file record, not in external clusters, +there are no checks that this resident data actually fits the corresponding +file record segment. + +When parsing a specially-crafted file system image, the current NTFS code will +read the file data from an arbitrary, attacker-chosen memory offset and of +arbitrary, attacker-chosen length. + +This allows an attacker to display arbitrary chunks of memory, which could +contain sensitive information like password hashes or even plain-text, +obfuscated passwords from BS EFI variables. + +This fix implements a check to ensure that resident data is read from the +corresponding file record segment only. + +Fixes: CVE-2023-4693 + +Reported-by: Maxim Suhanov +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 4681c7ac32a8..1949d48a494f 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -401,7 +401,18 @@ read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, grub_uint8_t *dest, + { + if (ofs + len > u32at (pa, 0x10)) + return grub_error (GRUB_ERR_BAD_FS, "read out of range"); +- grub_memcpy (dest, pa + u32at (pa, 0x14) + ofs, len); ++ ++ if (u32at (pa, 0x10) > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) ++ return grub_error (GRUB_ERR_BAD_FS, "resident attribute too large"); ++ ++ if (pa >= at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) ++ return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range"); ++ ++ if (u16at (pa, 0x14) + u32at (pa, 0x10) > ++ (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) pa) ++ return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range"); ++ ++ grub_memcpy (dest, pa + u16at (pa, 0x14) + ofs, len); + return 0; + } + diff --git a/0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch b/0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch new file mode 100644 index 00000000..3b02cd5a --- /dev/null +++ b/0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Tue, 3 Oct 2023 19:12:25 +0200 +Subject: [PATCH] fs/ntfs: Fix an OOB read when parsing directory entries from + resident and non-resident index attributes + +This fix introduces checks to ensure that index entries are never read +beyond the corresponding directory index. + +The lack of this check is a minor issue, likely not exploitable in any way. + +Reported-by: Maxim Suhanov +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 1949d48a494f..72302033281a 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -599,7 +599,7 @@ get_utf8 (grub_uint8_t *in, grub_size_t len) + } + + static int +-list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, ++list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, grub_uint8_t *end_pos, + grub_fshelp_iterate_dir_hook_t hook, void *hook_data) + { + grub_uint8_t *np; +@@ -610,6 +610,9 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, + grub_uint8_t namespace; + char *ustr; + ++ if ((pos >= end_pos) || (end_pos - pos < 0x52)) ++ break; ++ + if (pos[0xC] & 2) /* end signature */ + break; + +@@ -617,6 +620,9 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, + ns = *(np++); + namespace = *(np++); + ++ if (2 * ns > end_pos - pos - 0x52) ++ break; ++ + /* + * Ignore files in DOS namespace, as they will reappear as Win32 + * names. +@@ -802,7 +808,9 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, + } + + cur_pos += 0x10; /* Skip index root */ +- ret = list_file (mft, cur_pos + u16at (cur_pos, 0), hook, hook_data); ++ ret = list_file (mft, cur_pos + u16at (cur_pos, 0), ++ at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR), ++ hook, hook_data); + if (ret) + goto done; + +@@ -889,6 +897,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, + (const grub_uint8_t *) "INDX"))) + goto done; + ret = list_file (mft, &indx[0x18 + u16at (indx, 0x18)], ++ indx + (mft->data->idx_size << GRUB_NTFS_BLK_SHR), + hook, hook_data); + if (ret) + goto done; diff --git a/0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch b/0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch new file mode 100644 index 00000000..6e332b03 --- /dev/null +++ b/0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Tue, 3 Oct 2023 19:12:26 +0200 +Subject: [PATCH] fs/ntfs: Fix an OOB read when parsing bitmaps for index + attributes + +This fix introduces checks to ensure that bitmaps for directory indices +are never read beyond their actual sizes. + +The lack of this check is a minor issue, likely not exploitable in any way. + +Reported-by: Maxim Suhanov +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 72302033281a..74515114287f 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -839,6 +839,25 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, + + if (is_resident) + { ++ if (bitmap_len > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "resident bitmap too large"); ++ goto done; ++ } ++ ++ if (cur_pos >= at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "resident bitmap out of range"); ++ goto done; ++ } ++ ++ if (u16at (cur_pos, 0x14) + u32at (cur_pos, 0x10) > ++ (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) cur_pos) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "resident bitmap out of range"); ++ goto done; ++ } ++ + grub_memcpy (bmp, cur_pos + u16at (cur_pos, 0x14), + bitmap_len); + } diff --git a/0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch b/0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch new file mode 100644 index 00000000..4821d6cb --- /dev/null +++ b/0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Tue, 3 Oct 2023 19:12:27 +0200 +Subject: [PATCH] fs/ntfs: Fix an OOB read when parsing a volume label + +This fix introduces checks to ensure that an NTFS volume label is always +read from the corresponding file record segment. + +The current NTFS code allows the volume label string to be read from an +arbitrary, attacker-chosen memory location. However, the bytes read are +always treated as UTF-16LE. So, the final string displayed is mostly +unreadable and it can't be easily converted back to raw bytes. + +The lack of this check is a minor issue, likely not causing a significant +data leak. + +Reported-by: Maxim Suhanov +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 74515114287f..32ba8276dd8d 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -1209,13 +1209,29 @@ grub_ntfs_label (grub_device_t device, char **label) + + init_attr (&mft->attr, mft); + pa = find_attr (&mft->attr, GRUB_NTFS_AT_VOLUME_NAME); ++ ++ if (pa >= mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR)) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "can\'t parse volume label"); ++ goto fail; ++ } ++ ++ if (mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR) - pa < 0x16) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "can\'t parse volume label"); ++ goto fail; ++ } ++ + if ((pa) && (pa[8] == 0) && (u32at (pa, 0x10))) + { + int len; + + len = u32at (pa, 0x10) / 2; + pa += u16at (pa, 0x14); +- *label = get_utf8 (pa, len); ++ if (mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR) - pa >= 2 * len) ++ *label = get_utf8 (pa, len); ++ else ++ grub_error (GRUB_ERR_BAD_FS, "can\'t parse volume label"); + } + + fail: diff --git a/0359-fs-ntfs-Make-code-more-readable.patch b/0359-fs-ntfs-Make-code-more-readable.patch new file mode 100644 index 00000000..dcd1906e --- /dev/null +++ b/0359-fs-ntfs-Make-code-more-readable.patch @@ -0,0 +1,156 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Tue, 3 Oct 2023 19:12:28 +0200 +Subject: [PATCH] fs/ntfs: Make code more readable + +Move some calls used to access NTFS attribute header fields into +functions with human-readable names. + +Suggested-by: Daniel Kiper +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 48 +++++++++++++++++++++++++++++++++--------------- + 1 file changed, 33 insertions(+), 15 deletions(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 32ba8276dd8d..991b1c2094f5 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -52,6 +52,24 @@ u64at (void *ptr, grub_size_t ofs) + return grub_le_to_cpu64 (grub_get_unaligned64 ((char *) ptr + ofs)); + } + ++static grub_uint16_t ++first_attr_off (void *mft_buf_ptr) ++{ ++ return u16at (mft_buf_ptr, 0x14); ++} ++ ++static grub_uint16_t ++res_attr_data_off (void *res_attr_ptr) ++{ ++ return u16at (res_attr_ptr, 0x14); ++} ++ ++static grub_uint32_t ++res_attr_data_len (void *res_attr_ptr) ++{ ++ return u32at (res_attr_ptr, 0x10); ++} ++ + grub_ntfscomp_func_t grub_ntfscomp_func; + + static grub_err_t +@@ -106,7 +124,7 @@ init_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft) + { + at->mft = mft; + at->flags = (mft == &mft->data->mmft) ? GRUB_NTFS_AF_MMFT : 0; +- at->attr_nxt = mft->buf + u16at (mft->buf, 0x14); ++ at->attr_nxt = mft->buf + first_attr_off (mft->buf); + at->attr_end = at->emft_buf = at->edat_buf = at->sbuf = NULL; + } + +@@ -154,7 +172,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + return NULL; + } + +- new_pos = &at->emft_buf[u16at (at->emft_buf, 0x14)]; ++ new_pos = &at->emft_buf[first_attr_off (at->emft_buf)]; + while (*new_pos != 0xFF) + { + if ((*new_pos == *at->attr_cur) +@@ -213,7 +231,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + } + else + { +- at->attr_nxt = at->attr_end + u16at (pa, 0x14); ++ at->attr_nxt = at->attr_end + res_attr_data_off (pa); + at->attr_end = at->attr_end + u32at (pa, 4); + pa_end = at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); + } +@@ -399,20 +417,20 @@ read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, grub_uint8_t *dest, + + if (pa[8] == 0) + { +- if (ofs + len > u32at (pa, 0x10)) ++ if (ofs + len > res_attr_data_len (pa)) + return grub_error (GRUB_ERR_BAD_FS, "read out of range"); + +- if (u32at (pa, 0x10) > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) ++ if (res_attr_data_len (pa) > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) + return grub_error (GRUB_ERR_BAD_FS, "resident attribute too large"); + + if (pa >= at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) + return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range"); + +- if (u16at (pa, 0x14) + u32at (pa, 0x10) > ++ if (res_attr_data_off (pa) + res_attr_data_len (pa) > + (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) pa) + return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range"); + +- grub_memcpy (dest, pa + u16at (pa, 0x14) + ofs, len); ++ grub_memcpy (dest, pa + res_attr_data_off (pa) + ofs, len); + return 0; + } + +@@ -556,7 +574,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint64_t mftno) + (unsigned long long) mftno); + + if (!pa[8]) +- mft->size = u32at (pa, 0x10); ++ mft->size = res_attr_data_len (pa); + else + mft->size = u64at (pa, 0x30); + +@@ -801,7 +819,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, + (u32at (cur_pos, 0x18) != 0x490024) || + (u32at (cur_pos, 0x1C) != 0x300033)) + continue; +- cur_pos += u16at (cur_pos, 0x14); ++ cur_pos += res_attr_data_off (cur_pos); + if (*cur_pos != 0x30) /* Not filename index */ + continue; + break; +@@ -830,7 +848,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, + { + int is_resident = (cur_pos[8] == 0); + +- bitmap_len = ((is_resident) ? u32at (cur_pos, 0x10) : ++ bitmap_len = ((is_resident) ? res_attr_data_len (cur_pos) : + u32at (cur_pos, 0x28)); + + bmp = grub_malloc (bitmap_len); +@@ -851,14 +869,14 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, + goto done; + } + +- if (u16at (cur_pos, 0x14) + u32at (cur_pos, 0x10) > ++ if (res_attr_data_off (cur_pos) + res_attr_data_len (cur_pos) > + (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) cur_pos) + { + grub_error (GRUB_ERR_BAD_FS, "resident bitmap out of range"); + goto done; + } + +- grub_memcpy (bmp, cur_pos + u16at (cur_pos, 0x14), ++ grub_memcpy (bmp, cur_pos + res_attr_data_off (cur_pos), + bitmap_len); + } + else +@@ -1222,12 +1240,12 @@ grub_ntfs_label (grub_device_t device, char **label) + goto fail; + } + +- if ((pa) && (pa[8] == 0) && (u32at (pa, 0x10))) ++ if ((pa) && (pa[8] == 0) && (res_attr_data_len (pa))) + { + int len; + +- len = u32at (pa, 0x10) / 2; +- pa += u16at (pa, 0x14); ++ len = res_attr_data_len (pa) / 2; ++ pa += res_attr_data_off (pa); + if (mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR) - pa >= 2 * len) + *label = get_utf8 (pa, len); + else diff --git a/grub.patches b/grub.patches index 14401950..4c674800 100644 --- a/grub.patches +++ b/grub.patches @@ -351,3 +351,9 @@ Patch0350: 0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch Patch0351: 0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch Patch0352: 0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch Patch0353: 0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch +Patch0354: 0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch +Patch0355: 0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch +Patch0356: 0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch +Patch0357: 0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch +Patch0358: 0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch +Patch0359: 0359-fs-ntfs-Make-code-more-readable.patch diff --git a/grub2.spec b/grub2.spec index f2ed0d90..a3d8f26c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 119%{?dist} +Release: 120%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -554,6 +554,15 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Mar 8 2024 Nicolas Frayer - 2.06-120 +- GRUB2 NTFS driver vulnerabilities +- (CVE-2023-4692) +- (CVE-2023-4693) +- Resolves: #2236613 +- Resolves: #2241978 +- Resolves: #2241976 +- Resolves: #2238343 + * Wed Feb 7 2024 Nicolas Frayer - 2.06-119 - grub-set-bootflag: Fix for CVE-2024-1048 - (CVE-2024-1048) From 3e8a58128890ce5f7c3547fe08db7fb3ce4298f5 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Mon, 15 Apr 2024 11:05:24 +0200 Subject: [PATCH 224/294] fs/xfs: Handle non-continuous data blocks in directory extents Related: #2254370 Signed-off-by: Nicolas Frayer --- ...n-continuous-data-blocks-in-director.patch | 54 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 ++- 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch diff --git a/0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch b/0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch new file mode 100644 index 00000000..a3ed1a8c --- /dev/null +++ b/0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jon DeVree +Date: Sun, 11 Feb 2024 10:34:58 -0500 +Subject: [PATCH] fs/xfs: Handle non-continuous data blocks in directory + extents + +The directory extent list does not have to be a continuous list of data +blocks. When GRUB tries to read a non-existant member of the list, +grub_xfs_read_file() will return a block of zero'ed memory. Checking for +a zero'ed magic number is sufficient to skip this non-existant data block. + +Prior to commit 07318ee7e (fs/xfs: Fix XFS directory extent parsing) +this was handled as a subtle side effect of reading the (non-existant) +tail data structure. Since the block was zero'ed the computation of the +number of directory entries in the block would return 0 as well. + +Fixes: 07318ee7e (fs/xfs: Fix XFS directory extent parsing) +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2254370 + +Signed-off-by: Jon DeVree +Reviewed-By: Vladimir Serbinenko +Reviewed-by: Daniel Kiper +--- + grub-core/fs/xfs.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index bc2224dbb463..8e02ab4a3014 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -902,6 +902,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + grub_xfs_first_de(dir->data, dirblock); + int entries = -1; + char *end = dirblock + dirblk_size; ++ grub_uint32_t magic; + + numread = grub_xfs_read_file (dir, 0, 0, + blk << dirblk_log2, +@@ -912,6 +913,15 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + return 0; + } + ++ /* ++ * If this data block isn't actually part of the extent list then ++ * grub_xfs_read_file() returns a block of zeros. So, if the magic ++ * number field is all zeros then this block should be skipped. ++ */ ++ magic = *(grub_uint32_t *)(void *) dirblock; ++ if (!magic) ++ continue; ++ + /* + * Leaf and tail information are only in the data block if the number + * of extents is 1. diff --git a/grub.patches b/grub.patches index 4c674800..0a8b3319 100644 --- a/grub.patches +++ b/grub.patches @@ -357,3 +357,4 @@ Patch0356: 0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch Patch0357: 0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch Patch0358: 0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch Patch0359: 0359-fs-ntfs-Make-code-more-readable.patch +Patch0360: 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch diff --git a/grub2.spec b/grub2.spec index a3d8f26c..1f80842c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 120%{?dist} +Release: 121%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -554,6 +554,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Apr 12 2024 Nicolas Frayer - 2.06-121 +- fs/xfs: Handle non-continuous data blocks in directory extents +- Related: #2254370 + * Fri Mar 8 2024 Nicolas Frayer - 2.06-120 - GRUB2 NTFS driver vulnerabilities - (CVE-2023-4692) From 434cc479bc458663fbadbf7cb5a23abb92e6dde5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 17 Apr 2024 13:41:17 +0200 Subject: [PATCH 225/294] Fix build when %_bindir==%_sbindir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Preparation for https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin. Also remove duplicate listing in %files. Signed-off-by: Zbigniew Jędrzejewski-Szmek --- grub2.spec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/grub2.spec b/grub2.spec index 1f80842c..a6084da7 100644 --- a/grub2.spec +++ b/grub2.spec @@ -287,8 +287,9 @@ ln -s ../grub2-systemd-integration.service \ %global dip RPM_BUILD_ROOT=%{finddebugroot} %{__debug_install_post} %define __debug_install_post ( \ mkdir -p %{finddebugroot}/usr \ - mv ${RPM_BUILD_ROOT}/usr/bin %{finddebugroot}/usr/bin \ - mv ${RPM_BUILD_ROOT}/usr/sbin %{finddebugroot}/usr/sbin \ + mv %{buildroot}/usr/bin %{finddebugroot}/usr/bin \ + [ "%{_sbindir}" != "%{_bindir}" ] && \\\ + mv %{buildroot}/usr/sbin %{finddebugroot}/usr/sbin \ %{dip} \ install -m 0755 -d %{buildroot}/usr/lib/ %{buildroot}/usr/src/ \ cp -al %{finddebugroot}/usr/lib/debug/ \\\ @@ -296,7 +297,8 @@ ln -s ../grub2-systemd-integration.service \ cp -al %{finddebugroot}/usr/src/debug/ \\\ %{buildroot}/usr/src/debug/ ) \ mv %{finddebugroot}/usr/bin %{buildroot}/usr/bin \ - mv %{finddebugroot}/usr/sbin %{buildroot}/usr/sbin \ + [ "%{_sbindir}" != "%{_bindir}" ] && \\\ + mv %{finddebugroot}/usr/sbin %{buildroot}/usr/sbin \ %{nil} %undefine buildsubdir @@ -482,7 +484,6 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %exclude %{_datadir}/man/man1/grub2-render-label* %if %{with_legacy_arch} -%{_sbindir}/grub2-install %ifarch x86_64 %{_sbindir}/grub2-bios-setup %else From 92efc5d3cd70882a182885c2b944d613d55fad97 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Thu, 23 May 2024 10:58:35 +0200 Subject: [PATCH 226/294] cmd/search: Rework of CVE-2023-4001 fix Related: #2224951 Resolved: #2263369 Signed-off-by: Nicolas Frayer --- ...d-search-Rework-of-CVE-2023-4001-fix.patch | 180 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 13 +- 3 files changed, 190 insertions(+), 4 deletions(-) create mode 100644 0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch diff --git a/0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch b/0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch new file mode 100644 index 00000000..2c2e628d --- /dev/null +++ b/0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch @@ -0,0 +1,180 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Thu, 16 May 2024 10:58:32 +0200 +Subject: [PATCH] cmd/search: Rework of CVE-2023-4001 fix + +The initial fix implemented a new flag that forces the grub cfg +stub to be located on the same disk as grub. This created several +issues such as RAID machines not being able to boot as their +partition names under grub were different from the partition where +grub is located. It also simply means that any machines with the +/boot partition located on a disk other than the one containing grub +won't boot. +This commit denies booting if the grub cfg stub is located on a USB +drive with a duplicated UUID (UUID being the same as the partition +containing the actual grub cfg stub) + +Signed-off-by: Nicolas Frayer +--- + grub-core/commands/search.c | 134 +++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 126 insertions(+), 8 deletions(-) + +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index 4735feefcde5..5956b39dca72 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -30,6 +30,8 @@ + #include + #include + #include ++#include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -54,6 +56,100 @@ struct search_ctx + int is_cache; + }; + ++static int ++is_device_usb (const char *name) ++{ ++ int ret = 0; ++ ++ grub_device_t dev = grub_device_open(name); ++ ++ if (dev) ++ { ++ struct grub_efidisk_data ++ { ++ grub_efi_handle_t handle; ++ grub_efi_device_path_t *device_path; ++ grub_efi_device_path_t *last_device_path; ++ grub_efi_block_io_t *block_io; ++ struct grub_efidisk_data *next; ++ }; ++ ++ if (dev->disk && dev->disk->data) ++ { ++ struct grub_efidisk_data *dp = dev->disk->data; ++ ++ if ( GRUB_EFI_DEVICE_PATH_TYPE (dp->last_device_path) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE && ++ GRUB_EFI_DEVICE_PATH_SUBTYPE (dp->last_device_path) == GRUB_EFI_USB_DEVICE_PATH_SUBTYPE) ++ { ++ ret = 1; ++ } ++ } ++ grub_device_close(dev); ++ } ++ ++ return ret; ++} ++ ++static int ++get_device_uuid(const char *name, char** quid) ++{ ++ int ret = 0; ++ ++ grub_device_t dev_part = grub_device_open(name); ++ ++ if (dev_part) ++ { ++ grub_fs_t fs; ++ ++ fs = grub_fs_probe (dev_part); ++ ++#ifdef DO_SEARCH_FS_UUID ++#define read_fn fs_uuid ++#else ++#define read_fn fs_label ++#endif ++ if (fs && fs->read_fn) ++ { ++ fs->read_fn (dev_part, quid); ++ ++ if (grub_errno == GRUB_ERR_NONE && *quid) ++ { ++ ret = 1; ++ } ++ ++ } ++ grub_device_close (dev_part); ++ } ++ ++ return ret; ++} ++struct uuid_context { ++ char* name; ++ char* uuid; ++}; ++ ++static int ++check_for_duplicate (const char *name, void *data) ++{ ++ int ret = 0; ++ struct uuid_context * uuid_ctx = (struct uuid_context *)data; ++ char *quid = 0; ++ ++ get_device_uuid(name, &quid); ++ ++ if (quid == NULL) ++ return 0; ++ ++ if (!grub_strcasecmp(quid, uuid_ctx->uuid) && grub_strcasecmp(name, uuid_ctx->name)) ++ { ++ ret = 1; ++ } ++ ++ grub_free(quid); ++ ++ return ret; ++} ++ + /* Helper for FUNC_NAME. */ + static int + iterate_device (const char *name, void *data) +@@ -106,14 +202,36 @@ iterate_device (const char *name, void *data) + grub_str_sep (name, name_disk, ',', rem_2); + if (root_disk != NULL && *root_disk != '\0' && + name_disk != NULL && *name_disk != '\0') +- if (grub_strcmp(root_disk, name_disk) != 0) +- { +- grub_free (root_disk); +- grub_free (name_disk); +- grub_free (rem_1); +- grub_free (rem_2); +- return 0; +- } ++ { ++ grub_device_t dev, dev_part; ++ ++ if (is_device_usb(name) && !is_device_usb(root_dev)) ++ { ++ char *quid_name = NULL; ++ int longlist = 0; ++ struct uuid_context uuid_ctx; ++ int ret = 0; ++ ++ get_device_uuid(name, &quid_name); ++ if (!grub_strcmp(quid_name, ctx->key)) ++ { ++ uuid_ctx.name = name; ++ uuid_ctx.uuid = quid_name; ++ ++ ret = grub_device_iterate (check_for_duplicate, &uuid_ctx); ++ ++ if (ret) ++ { ++ grub_printf("Duplicated media UUID found, rebooting ...\n"); ++ grub_sleep(10); ++ grub_reboot(); ++ } ++ } ++ ++ if (quid_name) grub_free (quid_name); ++ ++ } ++ } + } + grub_free (root_disk); + grub_free (name_disk); diff --git a/grub.patches b/grub.patches index 0a8b3319..5494862a 100644 --- a/grub.patches +++ b/grub.patches @@ -358,3 +358,4 @@ Patch0357: 0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch Patch0358: 0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch Patch0359: 0359-fs-ntfs-Make-code-more-readable.patch Patch0360: 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch +Patch0361: 0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch diff --git a/grub2.spec b/grub2.spec index a6084da7..fe966cab 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 121%{?dist} +Release: 122%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -359,9 +359,11 @@ fi if test ! -f ${EFI_HOME}/grub.cfg; then # there's no config in ESP, create one grub2-mkconfig -o ${EFI_HOME}/grub.cfg + cp -a ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave + cp -a ${EFI_HOME}/grub.cfg ${GRUB_HOME}/ fi -if ((grep -q "configfile" ${EFI_HOME}/grub.cfg || grep -q "source" ${EFI_HOME}/grub.cfg) && ! grep -q "# It is automatically generated by grub2-mkconfig using templates" ${EFI_HOME}/grub.cfg); then +if (((grep -q "configfile" ${EFI_HOME}/grub.cfg && grep -q "root-dev-only" ${EFI_HOME}/grub.cfg) || grep -q "source" ${EFI_HOME}/grub.cfg) && ! grep -q "# It is automatically generated by grub2-mkconfig using templates" ${EFI_HOME}/grub.cfg); then exit 0 #Already unified fi @@ -381,8 +383,6 @@ if test -f ${EFI_HOME}/grubenv; then mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv fi -cp -a ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave -cp -a ${EFI_HOME}/grub.cfg ${GRUB_HOME}/ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %files common -f grub.lang @@ -555,6 +555,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu May 23 2024 Nicolas Frayer - 2.06-122 +- cmd/search: Rework of CVE-2023-4001 fix +- Related: #2224951 +- Resolved: #2263369 + * Fri Apr 12 2024 Nicolas Frayer - 2.06-121 - fs/xfs: Handle non-continuous data blocks in directory extents - Related: #2254370 From a137559e7192ae1054312d6b537c80aff10ffd8b Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Fri, 24 May 2024 18:10:46 -0600 Subject: [PATCH 227/294] grub-mkconfig.in: turn off executable owner bit Resolves: #2281464 Signed-off-by: Leo Sandoval --- ...fig.in-turn-off-executable-owner-bit.patch | 30 +++++++++++++++++++ grub.macros | 6 ++-- grub.patches | 1 + grub2.spec | 6 +++- 4 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch diff --git a/0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch b/0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch new file mode 100644 index 00000000..ddd74e9b --- /dev/null +++ b/0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch @@ -0,0 +1,30 @@ +From 4062ab33c8cd86ac15cefe1b4f2f422b28467f54 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Fri, 24 May 2024 18:22:17 -0600 +Subject: [PATCH] grub-mkconfig.in: turn off executable owner bit + +Stricker permissions are required on the grub.cfg file, resulting in +at most 0600 owner's file permissions. This resolves conflicting +requirement permissions on grub2-pc package's grub2.cfg file. + +Signed-off-by: Leo Sandoval +--- + util/grub-mkconfig.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index 520a672cd..fb382b648 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -311,7 +311,7 @@ and /etc/grub.d/* files or please file a bug report with + exit 1 + else + # none of the children aborted with error, install the new grub.cfg +- oldumask=$(umask); umask 077 ++ oldumask=$(umask); umask 177 + cat ${grub_cfg}.new > ${grub_cfg} + umask $oldumask + rm -f ${grub_cfg}.new +-- +2.44.0 + diff --git a/grub.macros b/grub.macros index 241baf82..205a9538 100644 --- a/grub.macros +++ b/grub.macros @@ -683,7 +683,7 @@ ln -s ../boot/grub2/grub.cfg \\\ %{expand:%%files %{1}} \ %defattr(-,root,root,-) \ %config(noreplace) %{_sysconfdir}/grub2.cfg \ -%ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \ +%ghost %config(noreplace) %attr(0600,root,root)/boot/grub2/grub.cfg \ %dir %attr(0700,root,root)/boot/loader/entries \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ %ifarch ppc64le \ @@ -718,8 +718,8 @@ ln -s ../boot/grub2/grub.cfg \\\ %endif \ %attr(0700,root,root)/boot/grub2/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ -%ghost %config(noreplace) %attr(0700,root,root)/boot/grub2/grub.cfg \ -%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ +%ghost %config(noreplace) %attr(0600,root,root)/boot/grub2/grub.cfg \ +%ghost %config(noreplace) %verify(not mtime) %attr(0600,root,root)%{efi_esp_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ diff --git a/grub.patches b/grub.patches index 5494862a..673fa2ad 100644 --- a/grub.patches +++ b/grub.patches @@ -359,3 +359,4 @@ Patch0358: 0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch Patch0359: 0359-fs-ntfs-Make-code-more-readable.patch Patch0360: 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch Patch0361: 0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch +Patch0362: 0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch diff --git a/grub2.spec b/grub2.spec index fe966cab..ffbe6388 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 122%{?dist} +Release: 123%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue May 28 2024 Leo Sandoval - 2.06.123 +- grub-mkconfig.in: turn off executable owner bit +- Resolves: #2281464 + * Thu May 23 2024 Nicolas Frayer - 2.06-122 - cmd/search: Rework of CVE-2023-4001 fix - Related: #2224951 From ce0dd8c0561d9e78f0d8846f7ec4b384995dd9fa Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 2 Jul 2024 10:17:51 +0200 Subject: [PATCH 228/294] KVM/PowerVM: Add support for KVM on PowerVM Resolved: #2294883 Signed-off-by: Nicolas Frayer --- ...it-Add-IEEE-1275-Radix-support-for-K.patch | 119 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +- 3 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch diff --git a/0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch b/0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch new file mode 100644 index 00000000..fcd2557c --- /dev/null +++ b/0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch @@ -0,0 +1,119 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Avnish Chouhan +Date: Thu, 23 May 2024 18:43:14 +0530 +Subject: [PATCH] kern/ieee1275/init: Add IEEE 1275 Radix support for KVM on + Power + +This patch adds support for Radix, Xive and Radix_gtse in Options +vector5 which is required for KVM LPARs. KVM LPARs ONLY support +Radix and not the Hash. Not enabling Radix on any PowerVM KVM LPARs +will result in boot failure. + +Signed-off-by: Avnish Chouhan +Reviewed-by: Daniel Kiper +--- + grub-core/kern/ieee1275/init.c | 63 +++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 62 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 8e7f742fad46..4ec6598cfbb8 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -110,6 +110,16 @@ grub_addr_t grub_ieee1275_original_stack; + #define DRC_INFO 0x40 + #define BYTE22 (DY_MEM_V2 | DRC_INFO) + ++/* For ibm,arch-vec-5-platform-support. */ ++#define XIVE_INDEX 0x17 ++#define MMU_INDEX 0x18 ++#define RADIX_GTSE_INDEX 0x1a ++#define RADIX_ENABLED 0x40 ++#define XIVE_ENABLED 0x40 ++#define HASH_ENABLED 0x00 ++#define MAX_SUPPORTED 0xC0 ++#define RADIX_GTSE_ENABLED 0x40 ++ + void + grub_exit (int rc __attribute__((unused))) + { +@@ -694,6 +704,10 @@ struct option_vector5 + grub_uint32_t platform_facilities; + grub_uint8_t sub_processors; + grub_uint8_t byte22; ++ grub_uint8_t xive; ++ grub_uint8_t mmu; ++ grub_uint8_t hpt_ext; ++ grub_uint8_t radix_gtse; + } GRUB_PACKED; + + struct pvr_entry +@@ -732,6 +746,13 @@ grub_ieee1275_ibm_cas (void) + { + int rc; + grub_ieee1275_ihandle_t root; ++ grub_uint8_t ibm_arch_platform_support[8]; ++ grub_ssize_t actual; ++ grub_uint8_t xive_support = 0; ++ grub_uint8_t mmu_support = 0; ++ grub_uint8_t radix_gtse_support = 0; ++ int i = 0; ++ int prop_len = 8; + struct cas_args + { + struct grub_ieee1275_common_hdr common; +@@ -740,6 +761,46 @@ grub_ieee1275_ibm_cas (void) + grub_ieee1275_cell_t cas_addr; + grub_ieee1275_cell_t result; + } args; ++ ++ grub_ieee1275_get_integer_property (grub_ieee1275_chosen, ++ "ibm,arch-vec-5-platform-support", ++ (grub_uint32_t *) ibm_arch_platform_support, ++ sizeof (ibm_arch_platform_support), ++ &actual); ++ ++ for (i = 0; i < prop_len; i++) ++ { ++ switch (ibm_arch_platform_support[i]) ++ { ++ case XIVE_INDEX: ++ if (ibm_arch_platform_support[i + 1] & MAX_SUPPORTED) ++ xive_support = XIVE_ENABLED; ++ else ++ xive_support = 0; ++ break; ++ ++ case MMU_INDEX: ++ if (ibm_arch_platform_support[i + 1] & MAX_SUPPORTED) ++ mmu_support = RADIX_ENABLED; ++ else ++ mmu_support = HASH_ENABLED; ++ break; ++ ++ case RADIX_GTSE_INDEX: ++ if (mmu_support == RADIX_ENABLED) ++ radix_gtse_support = ibm_arch_platform_support[i + 1] & RADIX_GTSE_ENABLED; ++ else ++ radix_gtse_support = 0; ++ break; ++ ++ default: ++ /* Ignoring the other indexes of ibm,arch-vec-5-platform-support. */ ++ break; ++ } ++ /* Skipping the property value. */ ++ i++; ++ } ++ + struct cas_vector vector = + { + .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ +@@ -756,7 +817,7 @@ grub_ieee1275_ibm_cas (void) + .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ + .vec5_size = 1 + sizeof (struct option_vector5) - 2, + .vec5 = { +- 0, BYTE2, 0, CMO, ASSOCIATIVITY, BIN_OPTS, 0, 0, MAX_CPU, 0, 0, PLATFORM_FACILITIES, SUB_PROCESSORS, BYTE22 ++ 0, BYTE2, 0, CMO, ASSOCIATIVITY, BIN_OPTS, 0, 0, MAX_CPU, 0, 0, PLATFORM_FACILITIES, SUB_PROCESSORS, BYTE22, xive_support, mmu_support, 0, radix_gtse_support + } + }; + diff --git a/grub.patches b/grub.patches index 673fa2ad..2b636116 100644 --- a/grub.patches +++ b/grub.patches @@ -360,3 +360,4 @@ Patch0359: 0359-fs-ntfs-Make-code-more-readable.patch Patch0360: 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch Patch0361: 0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch Patch0362: 0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch +Patch0363: 0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch diff --git a/grub2.spec b/grub2.spec index ffbe6388..b8c69334 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 123%{?dist} +Release: 124%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jul 2 2024 Nicolas Frayer - 2.06-124 +- KVM/PowerVM: Add support for KVM on PowerVM +- Resolved: #2294883 + * Tue May 28 2024 Leo Sandoval - 2.06.123 - grub-mkconfig.in: turn off executable owner bit - Resolves: #2281464 From d4811852b4d7bc3995d2ee65c42ab2ab8acd9ca5 Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Mon, 10 Jun 2024 20:12:59 +0200 Subject: [PATCH 229/294] 20-grub.install: Add variable for per-kernel devicetree setting In the old days before BLS, setting the GRUB_DEFAULT_DTB variable would create a devicetree entry for each kernel, which would be prepended by /dtb-${kernelver}, so it was possible to test a different dtb per installed kernel. In the transition to BLS, the variable was kept but the functionality is now slightly different. The value of GRUB_DEFAULT_DTB goes to the grubenv and that dtb is loaded from the /dtb symlink instead, which may change with kernel installs. This patch introduces a different variable which restores the previous behavior, and adds the devicetree entry to each BLS entry, if set. This variable is not set by default in an install, so it does not affect users with default settings. It is useful for developers and users of boards with not yet stable upstream support, where changes to the dtb may cause behavior difference. In these cases, it is desirable to not pick the dtb of just the latest installed kernel, but keep previous kernel+dtb choices unaffected as a fallback. Signed-off-by: Erico Nunes --- 20-grub.install | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/20-grub.install b/20-grub.install index afc706dd..d9d1d1d7 100755 --- a/20-grub.install +++ b/20-grub.install @@ -32,6 +32,7 @@ mkbls() { local debugname="" local debugid="" local flavor="" + local devicetree_entry="" if [[ "$kernelver" == *\+* ]] ; then local flavor=-"${kernelver##*+}" @@ -41,6 +42,12 @@ mkbls() { fi fi + # Define devicetree_entry if the user defined GRUB_DEVICETREE + # in /etc/default/grub, otherwise leave it empty + if [ -n "$GRUB_DEVICETREE" ] ; then + local devicetree_entry="devicetree /dtb-${kernelver}/$GRUB_DEVICETREE" + fi + cat < Date: Tue, 2 Jul 2024 13:54:10 +0200 Subject: [PATCH 230/294] 99-grub-mkconfig: Avoid disabling BLS usage for Xen HVM VMs Xen PV and PVH guest use direct kernel boot and may use 'pygrub' tool to parse guest's grub config. The tool is incompatible with BLS and thus 99-grub-mkconfig.install disables it. The problem is observed with HVM guests which are 'normal' VMs and don't require pygrub compatibility. E.g. legacy AWS instance types are of this kind. Disabling BLS for them is undesired and unjustified. Luckily, kernel driver for Xen provides '/sys/hypervisor/guest_type' interface telling us which type of guest are we running in. Signed-off-by: Vitaly Kuznetsov --- 99-grub-mkconfig.install | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index d9686b51..1411f6ac 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -8,8 +8,10 @@ fi # also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from # 10_linux. So BLS support needs to be disabled for both Xen Dom0 and DomU. if [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then - RUN_MKCONFIG=true - DISABLE_BLS=true + if [ ! -e /sys/hypervisor/guest_type ] || ! grep -q "^HVM$" /sys/hypervisor/guest_type; then + RUN_MKCONFIG=true + DISABLE_BLS=true + fi fi ARCH=$(uname -m) From ce5e45b5054d2aa51b3bc3aaf5a4003961c2a7af Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 10 Jul 2024 10:07:44 -0400 Subject: [PATCH 231/294] Add package.cfg for ELN Starting with fedpkg 1.45, we can now have `fedpkg build` automatically trigger both the Rawhide and ELN build of this package, since it cannot be rebuilt by the normal ELN auto-rebuild service due to the restricted nature of this package. By adding this file, the maintainer does not need to remember to build it for both releases manually. Signed-off-by: Stephen Gallagher --- package.cfg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 package.cfg diff --git a/package.cfg b/package.cfg new file mode 100644 index 00000000..0cf8855f --- /dev/null +++ b/package.cfg @@ -0,0 +1,3 @@ +[koji] +targets = rawhide eln + From f28d50ee44af0bcfa363493ae214ea88da546b35 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 16 Jul 2024 15:19:37 +0200 Subject: [PATCH 232/294] grub2-mkconfig: Prevent mkconfig from overwriting grub cfg stub Signed-off-by: Nicolas Frayer --- ...nsure-grub-cfg-stub-is-not-overwritt.patch | 40 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch diff --git a/0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch b/0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch new file mode 100644 index 00000000..2ac42f60 --- /dev/null +++ b/0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Tue, 16 Jul 2024 11:11:43 +0200 +Subject: [PATCH] grub2-mkconfig: Ensure grub cfg stub is not overwritten + +/boot/efi/EFI/$os_name/grub.cfg contains a grub cfg stub +that should not be overwritten by grub2-mkconfig. +Ensure that we prevent this from happening. + +Signed-off-by: Marta Lewandowska +Signed-off-by: Nicolas Frayer +--- + util/grub-mkconfig.in | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index fb382b648b87..efa36cc45a69 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -109,6 +109,20 @@ do + esac + done + ++os_name=$(grep '^ID=' /etc/os-release | sed 's/ID=//') ++if test "$os_name" = '"rhel"'; then ++ os_name=redhat ++elif test "$os_name" = '"centos"'; then ++ os_name=centos ++fi ++if test "x${grub_cfg}" = "x/boot/efi/EFI/$os_name/grub.cfg" &&\ ++ mountpoint -q /boot/efi; then ++ gettext_printf "Running \`grub2-mkconfig -o %s' will overwrite the GRUB wrapper.\n" "$grub_cfg" 1>&2 ++ gettext_printf "Please run \`grub2-mkconfig -o /boot/grub2/grub.cfg' instead to update grub.cfg.\n" 1>&2 ++ gettext_printf "GRUB configuration file was not updated.\n" 1>&2 ++ exit 1 ++fi ++ + if [ "x$EUID" = "x" ] ; then + EUID=`id -u` + fi diff --git a/grub.patches b/grub.patches index 2b636116..d37e8978 100644 --- a/grub.patches +++ b/grub.patches @@ -361,3 +361,4 @@ Patch0360: 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch Patch0361: 0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch Patch0362: 0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch Patch0363: 0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch +Patch0364: 0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch diff --git a/grub2.spec b/grub2.spec index b8c69334..88f1fcdd 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 124%{?dist} +Release: 125%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -555,6 +555,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jul 16 2024 Nicolas Frayer - 2.06-125 +- grub2-mkconfig: Prevent mkconfig from overwriting grub cfg stub + * Tue Jul 2 2024 Nicolas Frayer - 2.06-124 - KVM/PowerVM: Add support for KVM on PowerVM - Resolved: #2294883 From 7b5da77f7395a5ab06a013fee8676154f88dc5a4 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Wed, 17 Jul 2024 12:36:16 -0600 Subject: [PATCH 233/294] grub.cfg: Fix rpm grub.cfg verification issues Fix the rpm verificaton issues (see below) introduced in 2.06.123 [1]. On the other hand, 2.06.125 [2] introduced a change on grub2-mkconfig where it prevents overwritting {EFI_HOME}/grub.cfg with side effects on the %posttrans spec script, where it tries to recreate it in case this file does not exist but due to [2] the {EFI}/grub.cfg file is never created. Fix the %posttrans code with the logic but applied to {GRUB_HOME}/grub.cfg. Issue detected on RHEL CI but also reproduced on fedora since 2.06.123, where this change fixes it. $ rpm -Vqa . . .M....... c /boot/grub2/grub.cfg .M....... c /boot/efi/EFI/fedora/grub.cfg .M....... c /boot/grub2/grub.cfg .M....... c /boot/efi/EFI/fedora/grub.cfg .M....... c /boot/grub2/grub.cfg [1] https://src.fedoraproject.org/rpms/grub2/c/a137559e7192ae1054312d6b537c80aff10ffd8b?branch=rawhide [2] https://src.fedoraproject.org/rpms/grub2/c/f28d50ee44af0bcfa363493ae214ea88da546b35?branch=rawhide Signed-off-by: Leo Sandoval --- grub.macros | 5 +++-- grub2.spec | 13 +++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/grub.macros b/grub.macros index 205a9538..061c7782 100644 --- a/grub.macros +++ b/grub.macros @@ -674,7 +674,8 @@ install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig \ touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub \ ln -sf ../default/grub \\\ ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \ -touch ${RPM_BUILD_ROOT}/boot/grub2/grub.cfg \ +touch grub.cfg \ +install -m 0600 grub.cfg ${RPM_BUILD_ROOT}/boot/grub2/ \ ln -s ../boot/grub2/grub.cfg \\\ ${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \ %{nil} @@ -719,7 +720,7 @@ ln -s ../boot/grub2/grub.cfg \\\ %attr(0700,root,root)/boot/grub2/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0600,root,root)/boot/grub2/grub.cfg \ -%ghost %config(noreplace) %verify(not mtime) %attr(0600,root,root)%{efi_esp_dir}/grub.cfg \ +%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ diff --git a/grub2.spec b/grub2.spec index 88f1fcdd..9b801990 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 125%{?dist} +Release: 126%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -356,11 +356,9 @@ if ! mountpoint -q ${ESP_PATH}; then exit 0 # no ESP mounted, nothing to do fi -if test ! -f ${EFI_HOME}/grub.cfg; then - # there's no config in ESP, create one - grub2-mkconfig -o ${EFI_HOME}/grub.cfg - cp -a ${EFI_HOME}/grub.cfg ${EFI_HOME}/grub.cfg.rpmsave - cp -a ${EFI_HOME}/grub.cfg ${GRUB_HOME}/ +if test ! -f ${GRUB_HOME}/grub.cfg; then + # there's no config in GRUB home, create one + grub2-mkconfig -o ${GRUB_HOME}/grub.cfg fi if (((grep -q "configfile" ${EFI_HOME}/grub.cfg && grep -q "root-dev-only" ${EFI_HOME}/grub.cfg) || grep -q "source" ${EFI_HOME}/grub.cfg) && ! grep -q "# It is automatically generated by grub2-mkconfig using templates" ${EFI_HOME}/grub.cfg); then @@ -555,6 +553,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Jul 22 2024 Leo Sandoval - 2.06.126 +- grub.cfg: Fix rpm grub.cfg verification issues + * Tue Jul 16 2024 Nicolas Frayer - 2.06-125 - grub2-mkconfig: Prevent mkconfig from overwriting grub cfg stub From f9093b2645a19e708605d484d936d397c7645be4 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Fri, 2 Aug 2024 11:34:29 -0600 Subject: [PATCH 234/294] grub2.spec: Conditionally set grub config stub to 0600 mode When upgrading from <=2.06-126 to newer versions, the grub config stub may have different mode than 0600, so set the latter if this is the case. Signed-off-by: Leo Sandoval --- grub2.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index 9b801990..202137b0 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 126%{?dist} +Release: 127%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -359,6 +359,13 @@ fi if test ! -f ${GRUB_HOME}/grub.cfg; then # there's no config in GRUB home, create one grub2-mkconfig -o ${GRUB_HOME}/grub.cfg +else + GRUB_CFG_MODE=$(stat --format="%a" ${GRUB_HOME}/grub.cfg) + if ! test "${GRUB_CFG_MODE}" = "600"; then + # when upgrading from <=2.06-126 to newer versions, the grub config stub + # may have different mode than 0600, so set the latter if this is the case + chmod 0600 ${GRUB_HOME}/grub.cfg + fi fi if (((grep -q "configfile" ${EFI_HOME}/grub.cfg && grep -q "root-dev-only" ${EFI_HOME}/grub.cfg) || grep -q "source" ${EFI_HOME}/grub.cfg) && ! grep -q "# It is automatically generated by grub2-mkconfig using templates" ${EFI_HOME}/grub.cfg); then @@ -553,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Aug 2 2024 Leo Sandoval - 2.06-127 +- Set /boot/grub2/grub.cfg to 0600 mode if present + * Mon Jul 22 2024 Leo Sandoval - 2.06.126 - grub.cfg: Fix rpm grub.cfg verification issues From ab7ed2db6ea68c8d53f8cf27bc60831ab77e3f8a Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Wed, 10 Jul 2024 12:20:32 -0600 Subject: [PATCH 235/294] Rebased to release grub2-2.12 for fedora-41 Signed-off-by: Leo Sandoval --- ...-Fix-user-facing-typo-with-an-incorr.patch | 2 +- ...-Properly-disable-the-os-prober-by-d.patch | 6 +- ...tes-Disable-the-os-prober-by-default.patch | 8 +- ...d.patch => 0004-Rework-linux-command.patch | 16 +- ...patch => 0005-Rework-linux16-command.patch | 2 +- ...re.patch => 0006-re-write-.gitignore.patch | 16 +- ...ient-architecture-CAS-reboot-support.patch | 10 +- ...nsole-display-attr-when-clear-screen.patch | 2 +- ...video-support-for-IBM-power-machines.patch | 18 +- ...0-Move-bash-completion-script-922997.patch | 8 +- ...o-include-entries-by-title-not-just-.patch | 2 +- ...=> 0012-Make-exit-take-a-return-code.patch | 67 +- ...es-load-an-env-block-from-a-variable.patch | 33 +- ...014-Migrate-PPC-from-Yaboot-to-Grub2.patch | 8 +- ...=> 0015-Add-fw_path-variable-revised.patch | 4 +- ...-hex-hex-straight-through-unmolested.patch | 6 +- ...g-module-to-parse-Boot-Loader-Specif.patch | 24 +- ...patch => 0018-Add-devicetree-loading.patch | 10 +- ...0019-Enable-pager-by-default.-985860.patch | 2 +- ...n-t-say-GNU-Linux-in-generated-menus.patch | 18 +- ...rame-to-list-of-relocations-stripped.patch | 11 +- ...password-to-boot-entries-generated-b.patch | 2 +- ...ix-when-fallback-searching-for-grub-.patch | 2 +- ...-before-grub.cfg-on-tftp-config-file.patch | 2 +- ...CLASS-in-10_linux-from-etc-os-releas.patch | 2 +- ...6-Try-prefix-if-fw_path-doesn-t-work.patch | 51 +- ...fig-construct-titles-that-look-like-.patch | 6 +- ...ly-grub2-password-config-tool-985962.patch | 20 +- ... 0029-tcp-add-window-scaling-support.patch | 6 +- ...net-and-bootp-add-support-for-dhcpv6.patch | 127 +- ...=> 0031-bootp-New-net_bootp6-command.patch | 54 +- ...rnel-settings-and-use-it-in-10_linux.patch | 32 +- ... 0033-Make-grub_fatal-also-backtrace.patch | 31 +- ...fo-pages-say-grub2-where-appropriate.patch | 314 +-- ...-chainloader-entries-don-t-try-any-x.patch | 4 +- ...-Add-ability-to-boot-from-subvolumes.patch | 43 +- 0037-btrfs-fix-a-bad-null-check.patch | 40 + ...1374141-fix-incorrect-mask-for-ppc64.patch | 48 - ...port-btrfs_subvol-and-btrfs_subvolid.patch | 4 +- ...> 0039-grub2-btrfs-03-follow_default.patch | 20 +- ...=> 0040-grub2-btrfs-04-grub2-install.patch | 33 +- ...> 0041-grub2-btrfs-05-grub2-mkconfig.patch | 16 +- ... => 0042-grub2-btrfs-06-subvol-mount.patch | 32 +- ...subvol-name-scheme-to-support-old-sn.patch | 4 +- ...-correctly-with-btrfs-snapshots-bsc-.patch | 8 +- ...ocate_pool-and-grub_efi_free_pool-wr.patch | 18 +- ...fi_.-memory-helpers-where-reasonable.patch | 36 + 0047-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 33 + ...=> 0048-don-t-use-int-for-efi-status.patch | 4 +- ...INIT-declare-its-function-prototypes.patch | 2 +- ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 4 +- ...fi_.-memory-helpers-where-reasonable.patch | 106 -- ...d-xen-or-multiboot-2-modules-as-need.patch | 14 +- 0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch | 48 - ...052-align-struct-efi_variable-better.patch | 6 +- ...053-Add-BLS-support-to-grub-mkconfig.patch | 20 +- ...-backtrace-on-grub_abort-for-grub-em.patch | 4 +- ...h => 0055-Add-grub2-switch-to-blscfg.patch | 14 +- ...-calibration-not-take-51-seconds-to-.patch | 211 --- ...w-our-startup-message-if-debug-is-se.patch | 4 +- ...-some-minor-include-path-weirdnesses.patch | 8 +- ...it-possible-to-enabled-build-id-sha1.patch | 6 +- ...patch => 0059-make-better-backtraces.patch | 84 +- 0060-Fixup-for-newer-compiler.patch | 22 + ...-export-the-start-and-_start-symbols.patch | 2 +- ...tch => 0062-Fixup-for-newer-compiler.patch | 10 +- ...pport-for-non-Ethernet-network-cards.patch | 128 +- ...=> 0064-efinet-UEFI-IPv6-PXE-support.patch | 14 +- ...065-grub.texi-Add-net_bootp6-doument.patch | 6 +- ...dprintf-that-tells-us-load-addresses.patch | 178 -- ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 8 +- ...ar-pointers-in-grub-core-net-bootp.c.patch | 4 +- 0067-Fixup-for-newer-compiler.patch | 36 - ...etting-network-from-UEFI-device-path.patch | 61 +- ...etting-DNS-server-from-UEFI-protocol.patch | 79 +- ...70-Support-UEFI-networking-protocols.patch | 331 ++-- ...> 0071-AUDIT-0-http-boot-tracker-bug.patch | 25 +- ...racketed-ipv6-addrs-and-port-numbers.patch | 270 --- ...-incr-command-to-increment-integer-v.patch | 2 +- ...h => 0073-Add-auto-hide-menu-support.patch | 20 +- ...> 0074-Add-grub-set-bootflag-utility.patch | 14 +- ...b-boot-indeterminate.service-example.patch | 2 +- ...h => 0076-gentpl-add-disable-support.patch | 6 +- ... => 0077-gentpl-add-pc-firmware-type.patch | 8 +- ...e-the-firmware-acceleration-for-http.patch | 2 +- ...ot_url-reflect-the-protocol-hostname.patch | 4 +- ...n-tell-configure-which-cflags-utils-.patch | 24 +- ...81-Rework-how-the-fdt-command-builds.patch | 28 +- ...able-non-wordsize-allocations-on-arm.patch | 4 +- ...nd-prefix-when-HTTP-path-is-relative.patch | 6 +- ...=> 0084-Make-grub_error-more-verbose.patch | 6 +- ...eset-an-alias-for-the-reboot-command.patch | 2 +- ....patch => 0086-Add-a-version-command.patch | 22 +- ...dprintf-and-nerf-dprintf-in-script.c.patch | 12 +- ...p-all-the-places-Wsign-compare-error.patch | 56 +- ...gn-compare-Wno-conversion-Wno-error-.patch | 38 +- ...make-it-possible-to-run-checkers-on-.patch | 58 - ... => 0090-Fix-getroot.c-s-trampolines.patch | 4 +- ...not-allow-stack-trampolines-anywhere.patch | 12 +- ...tch => 0092-Reimplement-boot_counter.patch | 12 +- ...ntry-selection-based-on-ID-and-title.patch | 2 +- ...try-users-option-argument-to-be-opti.patch | 2 +- ...export-env-and-efi-load-env-commands.patch | 30 +- ...bles-from-the-initial-context-when-c.patch | 4 +- ...-boot-success-reset-from-menu-auto-h.patch | 12 +- ...t-boot-commands-will-only-return-on-.patch | 2 +- ...g-Update-comment-about-running-as-ro.patch | 2 +- ...g-Write-new-env-to-tmpfile-and-then-.patch | 2 +- ...indeterminate-getting-set-on-boot_su.patch | 2 +- ... => 0102-Add-start-symbol-for-RISC-V.patch | 2 +- ...conf-Force-autogen.sh-to-use-python3.patch | 4 +- ...fw-http-_path-variables-to-make-them.patch | 4 +- ...-literal-IPv6-addresses-in-square-br.patch | 8 +- ...o-specify-a-port-number-in-addresses.patch | 2 +- ...mprove-check-to-detect-literal-IPv6-.patch | 2 +- ...debug-message-if-parsing-the-address.patch | 2 +- ...so-accept-F8-as-a-user-interrupt-key.patch | 2 +- ...fix-when-the-HTTP-path-is-relative-a.patch | 4 +- ...turn-in-efi-export-env-and-efi-load-.patch | 2 +- ...le-to-subtract-conditions-from-debug.patch | 45 - ...p-fix-some-allocation-error-checking.patch | 6 +- ...p-fix-some-allocation-error-checking.patch | 6 +- ...g.c-fix-some-potential-allocation-ov.patch | 4 +- ...ointers-in-grub-core-net-efi-ip4_con.patch | 2 +- ...ointers-in-grub-core-net-efi-ip6_con.patch | 2 +- ...-pointers-in-grub-core-net-efi-net.c.patch | 2 +- ...-pointers-in-grub-core-net-efi-pxe.c.patch | 2 +- ...gration-scripts-to-make-systemctl-re.patch | 28 +- ...ion.sh-Also-set-old-menu_show_once-g.patch | 2 +- ...set-1-when-keyboard-is-in-Translate-.patch | 12 +- ...ll-disable-support-for-EFI-platforms.patch | 24 +- ...imestamps-configure-flag-to-prepend-.patch | 30 +- ...ements-to-grub_disk_open-and-grub_di.patch | 17 +- ...on-grub_debug_is_enabled-void-return.patch | 8 +- ...ear-screen-when-debugging-is-enabled.patch | 12 +- ..._-instrumentation-new-file-debug-tag.patch | 12 +- ...ate-TPM-measurement-errors-to-the-ve.patch | 62 - ...-Avoiding-many-unecessary-open-close.patch | 8 +- ...-implements-fibre-channel-discovery-.patch | 2 +- ...erpc-enables-device-mapper-discovery.patch | 2 +- ...fallback_set-var-to-force-the-set-ma.patch | 20 +- ...igning-grub-with-an-appended-signatu.patch | 68 +- ...rub-Document-signing-grub-under-UEFI.patch | 8 +- ...nt-signing-grub-with-an-appended-sig.patch | 4 +- ...e-grub_dl_set_persistent-for-the-emu.patch | 4 +- ...patch => 0136-pgp-factor-out-rsa_pad.patch | 10 +- ...rage-for-grub_crypto_pk_-to-crypto.c.patch | 4 +- ...p-tweaks-in-preparation-for-libtasn1.patch | 14 +- ...0139-libtasn1-import-libtasn1-4.16.0.patch | 30 +- ...asn1-disable-code-not-needed-in-grub.patch | 12 +- ...tasn1-changes-for-grub-compatibility.patch | 12 +- ...42-libtasn1-compile-into-asn1-module.patch | 10 +- ...3-test_asn1-test-module-for-libtasn1.patch | 47 +- ...-support-embedding-x509-certificates.patch | 42 +- ...res-import-GNUTLS-s-ASN.1-descriptio.patch | 4 +- ...res-parse-PKCS-7-signedData-and-X.50.patch | 8 +- ...res-support-verifying-appended-signa.patch | 10 +- ...pended-signatures-verification-tests.patch | 10 +- ...49-appended-signatures-documentation.patch | 42 +- ...Fix-error-handling-in-grub_file_open.patch | 34 - ...er-lockdown-based-on-ibm-secure-boot.patch | 26 +- ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 46 + ...-Also-handle-the-Extended-Key-Usage-.patch | 6 +- ...eee1275-ofdisk-retry-on-open-failure.patch | 10 +- ...> 0154-efinet-Add-DHCP-proxy-support.patch | 24 +- ...-cmdline-when-generating-legacy-menu.patch | 4 +- ... 0156-Suppress-gettext-error-message.patch | 2 +- ...d-Always-use-boot-grub2-user.cfg-as-.patch | 2 +- ...over-the-device-to-read-the-config-f.patch | 2 +- ...etting-of-prefix-for-signed-binary-c.patch | 12 +- ...pc-ieee1275-load-grub-at-4MB-not-2MB.patch | 6 +- ...-Fedora-location-of-DejaVu-SANS-font.patch | 30 + ...h => 0162-efi-new-connectefi-command.patch | 34 +- ...etection-support-device-names-with-c.patch | 2 +- ...=> 0164-make-ofdisk_retries-optional.patch | 2 +- ...grub_min-and-grub_max-more-resilient.patch | 8 +- ...FS-switch-to-using-grub_min-grub_max.patch | 2 +- ...oot_time-also-call-grub_dprintf-boot.patch | 16 +- ...dules-make-.module_license-read-only.patch | 2 +- ...p-.llvm_addrsig-sections-and-similar.patch | 2 +- ...locate-space-for-non-allocable-secti.patch | 4 +- ...ule-sections-at-page-aligned-address.patch | 50 +- ...-nx-add-memory-attribute-get-set-API.patch | 44 +- ...-page-permissions-for-loaded-modules.patch | 61 +- ...275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch | 75 - ...x-compatible-flag-in-EFI-grub-images.patch | 28 +- ...probe-dprint-errors-from-filesystems.patch | 6 +- ...file-show-which-file-filters-get-run.patch | 2 +- ...e-etc-kernel-cmdline-during-mkconfig.patch | 4 +- ...sh-don-t-dup-rhgb-quiet-check-mtimes.patch | 4 +- ...gnore-checksum-seed-incompat-feature.patch | 54 - ...=> 0179-squish-give-up-on-rhgb-quiet.patch | 4 +- ...write-etc-kernel-cmdline-if-writable.patch | 4 +- ...scfg-Don-t-root-device-in-emu-builds.patch | 2 +- ...82-ppc64le-signed-boot-media-changes.patch | 20 +- ...veral-implicit-function-declarations.patch | 6 +- ...for-EFI-at-runtime-instead-of-config.patch | 63 - ...or-if-boot-to-firmware-setup-is-not-.patch | 92 - ...-memory-with-ibm-client-architecture.patch | 109 ++ ...-work-around-proc-not-reporting-size.patch | 8 +- ...blscfg-check-for-mounted-boot-in-emu.patch | 2 +- ...b_dl_set_mem_attrs-fix-format-string.patch | 2 +- ...adable-filesystem-with-v4-superblock.patch | 118 -- ...attrs-add-self-check-for-the-tramp-G.patch | 2 +- ...module-name-on-license-check-failure.patch | 48 - ...ments-page-align-the-tramp-GOT-areas.patch | 16 +- ...0190-emu-Add-switch-root-to-grub-emu.patch | 10 +- ...-mkconfig-restore-umask-for-grub.cfg.patch | 40 - ...il-Enable-default-kernel-for-updates.patch | 2 +- ...-efi-http-change-uint32_t-to-uintn_t.patch | 2 +- ...btrfs-Use-full-btrfs-bootloader-area.patch | 160 -- ...-Fedora-location-of-DejaVu-SANS-font.patch | 30 - ...Install-section-to-aux-systemd-units.patch | 6 +- ...0194-Fix-missing-include-in-ofdisk.c.patch | 2 +- ...t-show-Booting-s-msg-when-auto-booti.patch | 90 - ...-Welcome-to-GRUB-message-in-EFI-buil.patch | 41 - ...195-add-flag-to-only-search-root-dev.patch | 24 +- ...ot-set-colorstate-until-the-first-te.patch | 51 - ...ptdisk-fix-incorrect-sign-comparison.patch | 28 + ...ot-set-cursor-until-the-first-text-o.patch | 71 - ...-install-fix-a-sign-comparison-error.patch | 25 + ...se-visual-indentation-in-config.h.in.patch | 93 - ...t-work-around-bad-integer-comparison.patch | 50 + ...sure-config-util.h-precedes-config.h.patch | 275 --- ...-use-after-free-in-get_slave_from_dm.patch | 32 + 0200-Drop-gnulib-fix-base64.patch.patch | 140 -- 0200-Fix-some-sign-comparison-errors.patch | 37 + 0201-Drop-gnulib-no-abort.patch.patch | 97 - 0201-normal-Fix-a-discarded-const.patch | 23 + ...version-and-drop-most-gnulib-patches.patch | 832 -------- ...-grub_keyboard_controller_write-unus.patch | 35 + ...-another-minor-sign-comparison-error.patch | 23 + ...Fix-bug-stopping-iteration-when-no-f.patch | 33 - ...odule-dependencies-in-Makefile.core..patch | 124 ++ ...w-efidisk-only-option-on-EFI-systems.patch | 168 -- ...-that-we-preserve-header-vs-region-a.patch | 75 + ...U-variety-of-build-flags-for-PROGRAM.patch | 38 + 0207-Work-around-extra_deps.lst-issue.patch | 24 + ...-arm64-linux.c-do-not-validate-kerne.patch | 58 - ...ttribute-for-an-EFI-API-call-definit.patch | 42 + 0209-cast-grub_error-status-parameter.patch | 67 + 0210-remove-unused-varible.patch | 31 + 0211-cast-grub_net_bootp_packet-pointer.patch | 42 + ...libtasn1-fix-string-overflow-warning.patch | 56 + ...d-support-for-Linux-EFI-stub-loading.patch | 486 +---- ...ot-Add-API-to-pass-context-to-loader.patch | 158 -- 0214-fix-i386_pc-on-legacycfg-module.patch | 21 + ...ecureboot-support-on-efi-chainloader.patch | 269 ++- ...loaders-that-link-in-efi-mode-honor-.patch | 151 +- ...t-ordering-for-.debug-and-rescue-ker.patch | 4 +- ...f-grub_dprintf-without-the-file-line.patch | 12 +- ...dprintf-that-tells-us-load-addresses.patch | 83 + ...ct-non-kernel-files-in-the-shim_lock.patch | 101 - ...rch-64-on-32-boot-in-linuxefi-loader.patch | 56 +- ...-leak-device_name-on-error-in-grub_f.patch | 39 - ...tter-locations-for-kernel-and-initrd.patch | 22 +- ...g-Abort-sooner-if-a-read-operation-f.patch | 198 -- ...g-Refuse-to-handle-multiple-image-he.patch | 28 - ...ce-buffers-for-reading-to-addresses-.patch | 4 +- ...g-Drop-greyscale-support-to-fix-heap.patch | 170 -- ...-arrange-grub_cmd_linux-a-little-bit.patch | 4 +- ...g-Avoid-heap-OOB-R-W-inserting-huff-.patch | 40 - ...e-our-own-allocator-for-kernel-stuff.patch | 33 +- ...-png-Sanity-check-some-huffman-codes.patch | 40 - ...itrd-params-cmdline-allocations-abov.patch | 20 +- ...se-address-before-jumping-to-the-PE-.patch | 16 +- ...eg-Abort-sooner-if-a-read-operation-.patch | 255 --- ...eg-Do-not-reallocate-a-given-huff-ta.patch | 29 - ...maximum-bounce-buffer-size-to-16-MiB.patch | 2 +- ...integer-overflows-in-grub_cmd_initrd.patch | 2 +- ...eg-Refuse-to-handle-multiple-start-o.patch | 44 - ...rnel-validation-without-shim-protoco.patch | 49 +- ...eg-Block-int-underflow-wild-pointer-.patch | 53 - ...ainloading-EFI-apps-from-loop-mounts.patch | 37 +- ...ix-array-out-of-bounds-formatting-un.patch | 34 - ...-i386-efi-linux.c-do-not-validate-ke.patch | 2 +- ...ff-Block-overly-large-netbuff-allocs.patch | 46 - ...-efi-chainloader.c-do-not-validate-c.patch | 18 +- 0232-net-ip-Do-IP-fragment-maths-safely.patch | 44 - ...-efi-linux.c-drop-now-unused-grub_li.patch | 24 +- ...le-free-addresses-on-corrupt-DNS-res.patch | 56 - ...loader-grub_load_and_start_image-doe.patch | 10 +- ...ad-past-the-end-of-the-string-we-re-.patch | 71 - ...hainloader-simplify-the-loader-state.patch | 126 +- ...-a-UAF-and-double-free-from-a-failed.patch | 112 -- ...i-chainloader-Use-grub_loader_set_ex.patch | 39 +- 0236-net-tftp-Avoid-a-trivial-UAF.patch | 35 - ...linux-Avoid-a-use-after-free-in-the-.patch | 6 +- ...tear-down-socket-if-it-s-already-bee.patch | 42 - ...386-efi-linux-Use-grub_loader_set_ex.patch | 19 +- ...Fix-OOB-write-for-split-http-headers.patch | 46 - ...linux-Fix-a-memory-leak-in-the-initr.patch | 2 +- ...or-out-on-headers-with-LF-without-CR.patch | 48 - ...nel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch | 2 +- ...ead-past-the-end-of-nat-journal-entr.patch | 72 - ...ed-array-positions-for-our-allocatio.patch | 6 +- ...-not-read-past-the-end-of-nat-bitmap.patch | 132 -- ...tion-policy-for-kernel-vs-initrd-mem.patch | 10 +- ...ot-copy-file-names-that-are-too-long.patch | 38 - ...-initrd-within-the-bounds-expressed-.patch | 8 +- ...eral-fuzz-issues-with-invalid-dir-it.patch | 79 - ...ER_-CODE-DATA-for-kernel-and-initrd-.patch | 10 +- ...e-ASAN-and-SEGV-issues-found-with-fu.patch | 134 -- ...x-more-fuzz-issues-related-to-chunks.patch | 75 - ...ncorrect-array-size-in-kernel-alloca.patch | 2 +- ...> 0246-grub-install-on-EFI-if-forced.patch | 47 +- ...stall-section-from-aux-systemd-units.patch | 4 +- ...der-remove-device-path-debug-message.patch | 7 +- ...g-Conservative-partial-fix-for-CVE-2.patch | 2 +- ...g-More-complete-fix-for-CVE-2024-104.patch | 2 +- ...g-Exit-calmly-when-not-running-as-ro.patch | 2 +- 0252-Makefile.core.def-fix-linux-module.patch | 61 + ...Linux-EFI-stub-loading-on-arm-archit.patch | 270 +++ ...-Better-memory-allocation-and-error-.patch | 112 +- ...x-EFI-loader-kernel-image-allocation.patch | 165 +- ...eader-struct-and-fix-some-bad-naming.patch | 36 +- ... 0257-Correct-BSS-zeroing-on-aarch64.patch | 38 +- ...er-memory-type-for-kernel-allocation.patch | 18 +- ...-document-the-behavior-of-multiple-v.patch | 25 - ...ub_env_set-prefix-in-grub_try_normal.patch | 2 +- ...n-continuous-data-blocks-in-director.patch | 2 +- ...nore-warnings-for-incompatible-types.patch | 4 +- 0261-fs-fat-don-t-error-when-mtime-is-0.patch | 64 - ...d-search-Rework-of-CVE-2023-4001-fix.patch | 2 +- ....c-read-the-kernel-image-before-head.patch | 69 + ...4-nx-set-attrs-in-our-kernel-loaders.patch | 261 +-- ...-wrappers-for-load_image-start_image.patch | 183 ++ ...oader-protocol-for-EFI-image-verific.patch | 191 ++ ...lback-to-legacy-Linux-loader-when-sh.patch | 66 + ...le-stack-sections-on-EFI-assembly-fi.patch | 47 + ...fig.in-turn-off-executable-owner-bit.patch | 17 +- ...it-Add-IEEE-1275-Radix-support-for-K.patch | 12 +- ...nsure-grub-cfg-stub-is-not-overwritt.patch | 40 + ...ux-Remove-magic-number-header-field-.patch | 43 - ...ate-i-cache-before-starting-the-kern.patch | 39 - ...i-tpm-Refine-the-status-of-log-event.patch | 42 - ...-Use-grub_strcpy-instead-of-grub_mem.patch | 37 - ...-EFI_CC_MEASUREMENT_PROTOCOL-support.patch | 258 --- ...hs-exceeds-font-max_glyph_width-or-f.patch | 31 - ...erflow-in-grub_font_get_glyph_intern.patch | 110 -- ...-integer-overflows-in-grub_font_cons.patch | 79 - 0282-font-Remove-grub_font_dup_glyph.patch | 40 - ...nteger-overflow-in-ensure_comb_space.patch | 46 - ...nt-Fix-integer-overflow-in-BMP-index.patch | 63 - ...-underflow-in-binary-search-of-char-.patch | 83 - ...b-Enforce-verification-of-font-files.patch | 52 - 0287-fbutil-Fix-integer-overflow.patch | 83 - ...ix-an-integer-underflow-in-blit_comb.patch | 89 - ..._font_blit_glyph-and-grub_font_blit_.patch | 73 - ...l_font-to-glyphs-in-ascii_font_glyph.patch | 34 - ...ix-an-integer-overflow-in-grub_unico.patch | 53 - ...ening-fonts-from-the-bundled-memdisk.patch | 78 - 0293-mm-Clarify-grub_real_malloc.patch | 183 -- ...loc-Make-small-allocs-comment-match-.patch | 32 - 0295-mm-Document-grub_free.patch | 120 -- 0296-mm-Document-grub_mm_init_region.patch | 73 - ...-internal-memory-management-structur.patch | 78 - ...e-preserve-header-vs-region-alignmen.patch | 56 - ...-region-merge-with-region-after-as-w.patch | 203 -- ...-Debug-support-for-region-operations.patch | 71 - ...p-unused-unloading-of-modules-on-OOM.patch | 80 - ...ally-requesting-additional-memory-re.patch | 130 -- ...ys-request-a-fixed-number-of-pages-o.patch | 103 - ...tract-function-to-add-memory-regions.patch | 85 - ...ss-up-errors-from-add_memory_regions.patch | 87 - ...-Implement-runtime-addition-of-pages.patch | 75 - ...-default-memory-allocation-to-32-MiB.patch | 31 - ...e-disk-caches-last-when-out-of-memor.patch | 57 - ...rt-for-grub-emu-to-kexec-Linux-menu-.patch | 431 ----- ...n-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch | 111 -- ...-memory-with-ibm-client-architecture.patch | 308 --- ...ee1275-drop-len-1-quirk-in-heap_init.patch | 36 - ...1275-support-runtime-memory-claiming.patch | 435 ----- ...5-implement-vec5-for-cas-negotiation.patch | 74 - ...ort-for-trusted-boot-using-a-vTPM-2..patch | 246 --- 0318-powerpc-Drop-Open-Hack-Ware.patch | 69 - ...disk-Modify-sector-by-sysfs-as-disk-.patch | 70 - ...gion-size-to-take-management-overhea.patch | 145 -- ...e-some-space-when-adding-new-regions.patch | 53 - ...complex-heap-growth-math-in-hot-path.patch | 72 - ...ork-around-systemctl-kexec-returning.patch | 41 - ...it-Convert-plain-numbers-to-constant.patch | 48 - ...ee1275-init-Extended-support-in-Vec5.patch | 127 -- ...tpm-verifier-if-the-TPM-device-is-no.patch | 156 -- ...it-ppc64-Restrict-high-memory-in-pre.patch | 226 --- 0341-fs-Remove-trailing-whitespaces.patch | 1681 ----------------- ...s-xfs-Fix-memory-leaks-in-XFS-module.patch | 47 - ...s-found-while-fuzzing-the-XFS-filesy.patch | 106 -- ...-short-form-directory-data-boundary-.patch | 47 - ...-extent-counters-incompat-feature-su.patch | 115 -- ...xfs-Fix-XFS-directory-extent-parsing.patch | 168 -- ...OB-write-when-parsing-the-ATTRIBUTE_.patch | 90 - ...OB-read-when-reading-data-from-the-r.patch | 55 - ...OB-read-when-parsing-directory-entri.patch | 70 - ...OB-read-when-parsing-bitmaps-for-ind.patch | 48 - ...OOB-read-when-parsing-a-volume-label.patch | 58 - 0359-fs-ntfs-Make-code-more-readable.patch | 156 -- bootstrap | 319 ++-- bootstrap.conf | 26 +- gitignore | 4 + grub.patches | 629 +++--- grub2.spec | 9 +- sources | 2 +- 403 files changed, 5164 insertions(+), 17560 deletions(-) rename 0005-Rework-linux-command.patch => 0004-Rework-linux-command.patch (86%) rename 0006-Rework-linux16-command.patch => 0005-Rework-linux16-command.patch (98%) rename 0010-re-write-.gitignore.patch => 0006-re-write-.gitignore.patch (94%) rename 0011-IBM-client-architecture-CAS-reboot-support.patch => 0007-IBM-client-architecture-CAS-reboot-support.patch (96%) rename 0012-for-ppc-reset-console-display-attr-when-clear-screen.patch => 0008-for-ppc-reset-console-display-attr-when-clear-screen.patch (97%) rename 0013-Disable-GRUB-video-support-for-IBM-power-machines.patch => 0009-Disable-GRUB-video-support-for-IBM-power-machines.patch (85%) rename 0014-Move-bash-completion-script-922997.patch => 0010-Move-bash-completion-script-922997.patch (89%) rename 0015-Allow-fallback-to-include-entries-by-title-not-just-.patch => 0011-Allow-fallback-to-include-entries-by-title-not-just-.patch (98%) rename 0016-Make-exit-take-a-return-code.patch => 0012-Make-exit-take-a-return-code.patch (82%) rename 0017-Make-efi-machines-load-an-env-block-from-a-variable.patch => 0013-Make-efi-machines-load-an-env-block-from-a-variable.patch (71%) rename 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch => 0014-Migrate-PPC-from-Yaboot-to-Grub2.patch (96%) rename 0019-Add-fw_path-variable-revised.patch => 0015-Add-fw_path-variable-revised.patch (96%) rename 0020-Pass-x-hex-hex-straight-through-unmolested.patch => 0016-Pass-x-hex-hex-straight-through-unmolested.patch (97%) rename 0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch => 0017-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch (98%) rename 0022-Add-devicetree-loading.patch => 0018-Add-devicetree-loading.patch (90%) rename 0023-Enable-pager-by-default.-985860.patch => 0019-Enable-pager-by-default.-985860.patch (94%) rename 0024-Don-t-say-GNU-Linux-in-generated-menus.patch => 0020-Don-t-say-GNU-Linux-in-generated-menus.patch (91%) rename 0025-Add-.eh_frame-to-list-of-relocations-stripped.patch => 0021-Add-.eh_frame-to-list-of-relocations-stripped.patch (76%) rename 0026-Don-t-require-a-password-to-boot-entries-generated-b.patch => 0022-Don-t-require-a-password-to-boot-entries-generated-b.patch (96%) rename 0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch => 0023-use-fw_path-prefix-when-fallback-searching-for-grub-.patch (97%) rename 0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch => 0024-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch (99%) rename 0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch => 0025-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch (96%) rename 0031-Try-prefix-if-fw_path-doesn-t-work.patch => 0026-Try-prefix-if-fw_path-doesn-t-work.patch (93%) rename 0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch => 0027-Make-grub2-mkconfig-construct-titles-that-look-like-.patch (95%) rename 0033-Add-friendly-grub2-password-config-tool-985962.patch => 0028-Add-friendly-grub2-password-config-tool-985962.patch (94%) rename 0034-tcp-add-window-scaling-support.patch => 0029-tcp-add-window-scaling-support.patch (95%) rename 0035-efinet-and-bootp-add-support-for-dhcpv6.patch => 0030-efinet-and-bootp-add-support-for-dhcpv6.patch (84%) rename 0072-bootp-New-net_bootp6-command.patch => 0031-bootp-New-net_bootp6-command.patch (96%) rename 0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch => 0032-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch (92%) rename 0038-Make-grub_fatal-also-backtrace.patch => 0033-Make-grub_fatal-also-backtrace.patch (89%) rename 0039-Make-our-info-pages-say-grub2-where-appropriate.patch => 0034-Make-our-info-pages-say-grub2-where-appropriate.patch (80%) rename 0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch => 0035-macos-just-build-chainloader-entries-don-t-try-any-x.patch (98%) rename 0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch => 0036-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch (94%) create mode 100644 0037-btrfs-fix-a-bad-null-check.patch delete mode 100644 0037-bz1374141-fix-incorrect-mask-for-ppc64.patch rename 0042-export-btrfs_subvol-and-btrfs_subvolid.patch => 0038-export-btrfs_subvol-and-btrfs_subvolid.patch (91%) rename 0043-grub2-btrfs-03-follow_default.patch => 0039-grub2-btrfs-03-follow_default.patch (90%) rename 0044-grub2-btrfs-04-grub2-install.patch => 0040-grub2-btrfs-04-grub2-install.patch (87%) rename 0045-grub2-btrfs-05-grub2-mkconfig.patch => 0041-grub2-btrfs-05-grub2-mkconfig.patch (93%) rename 0046-grub2-btrfs-06-subvol-mount.patch => 0042-grub2-btrfs-06-subvol-mount.patch (94%) rename 0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch => 0043-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch (94%) rename 0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch => 0044-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch (97%) rename 0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch => 0045-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch (82%) create mode 100644 0046-Use-grub_efi_.-memory-helpers-where-reasonable.patch create mode 100644 0047-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename 0052-don-t-use-int-for-efi-status.patch => 0048-don-t-use-int-for-efi-status.patch (88%) rename 0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch => 0049-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch (96%) rename 0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch => 0050-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch (92%) delete mode 100644 0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch rename 0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch => 0051-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch (85%) delete mode 100644 0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch rename 0057-align-struct-efi_variable-better.patch => 0052-align-struct-efi_variable-better.patch (91%) rename 0058-Add-BLS-support-to-grub-mkconfig.patch => 0053-Add-BLS-support-to-grub-mkconfig.patch (96%) rename 0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch => 0054-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch (89%) rename 0060-Add-grub2-switch-to-blscfg.patch => 0055-Add-grub2-switch-to-blscfg.patch (97%) delete mode 100644 0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch rename 0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch => 0056-normal-don-t-draw-our-startup-message-if-debug-is-se.patch (87%) rename 0063-Work-around-some-minor-include-path-weirdnesses.patch => 0057-Work-around-some-minor-include-path-weirdnesses.patch (97%) rename 0064-Make-it-possible-to-enabled-build-id-sha1.patch => 0058-Make-it-possible-to-enabled-build-id-sha1.patch (93%) rename 0061-make-better-backtraces.patch => 0059-make-better-backtraces.patch (93%) create mode 100644 0060-Fixup-for-newer-compiler.patch rename 0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch => 0061-Don-t-attempt-to-export-the-start-and-_start-symbols.patch (97%) rename 0069-Fixup-for-newer-compiler.patch => 0062-Fixup-for-newer-compiler.patch (79%) rename 0070-Add-support-for-non-Ethernet-network-cards.patch => 0063-Add-support-for-non-Ethernet-network-cards.patch (90%) rename 0073-efinet-UEFI-IPv6-PXE-support.patch => 0064-efinet-UEFI-IPv6-PXE-support.patch (92%) rename 0074-grub.texi-Add-net_bootp6-doument.patch => 0065-grub.texi-Add-net_bootp6-doument.patch (88%) delete mode 100644 0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch rename 0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch => 0066-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch (95%) rename 0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch => 0067-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch (93%) delete mode 100644 0067-Fixup-for-newer-compiler.patch rename 0076-efinet-Setting-network-from-UEFI-device-path.patch => 0068-efinet-Setting-network-from-UEFI-device-path.patch (89%) rename 0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch => 0069-efinet-Setting-DNS-server-from-UEFI-protocol.patch (84%) rename 0078-Support-UEFI-networking-protocols.patch => 0070-Support-UEFI-networking-protocols.patch (94%) rename 0079-AUDIT-0-http-boot-tracker-bug.patch => 0071-AUDIT-0-http-boot-tracker-bug.patch (82%) delete mode 100644 0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch rename 0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch => 0072-grub-editenv-Add-incr-command-to-increment-integer-v.patch (98%) rename 0081-Add-auto-hide-menu-support.patch => 0073-Add-auto-hide-menu-support.patch (94%) rename 0082-Add-grub-set-bootflag-utility.patch => 0074-Add-grub-set-bootflag-utility.patch (97%) rename 0083-docs-Add-grub-boot-indeterminate.service-example.patch => 0075-docs-Add-grub-boot-indeterminate.service-example.patch (97%) rename 0084-gentpl-add-disable-support.patch => 0076-gentpl-add-disable-support.patch (89%) rename 0085-gentpl-add-pc-firmware-type.patch => 0077-gentpl-add-pc-firmware-type.patch (74%) rename 0086-efinet-also-use-the-firmware-acceleration-for-http.patch => 0078-efinet-also-use-the-firmware-acceleration-for-http.patch (96%) rename 0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0079-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (93%) rename 0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0080-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (87%) rename 0090-Rework-how-the-fdt-command-builds.patch => 0081-Rework-how-the-fdt-command-builds.patch (85%) rename 0091-Disable-non-wordsize-allocations-on-arm.patch => 0082-Disable-non-wordsize-allocations-on-arm.patch (93%) rename 0092-Prepend-prefix-when-HTTP-path-is-relative.patch => 0083-Prepend-prefix-when-HTTP-path-is-relative.patch (97%) rename 0093-Make-grub_error-more-verbose.patch => 0084-Make-grub_error-more-verbose.patch (94%) rename 0094-Make-reset-an-alias-for-the-reboot-command.patch => 0085-Make-reset-an-alias-for-the-reboot-command.patch (97%) rename 0095-Add-a-version-command.patch => 0086-Add-a-version-command.patch (89%) rename 0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0087-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (89%) rename 0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0088-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (77%) rename 0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0089-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (55%) delete mode 100644 0089-module-verifier-make-it-possible-to-run-checkers-on-.patch rename 0105-Fix-getroot.c-s-trampolines.patch => 0090-Fix-getroot.c-s-trampolines.patch (92%) rename 0106-Do-not-allow-stack-trampolines-anywhere.patch => 0091-Do-not-allow-stack-trampolines-anywhere.patch (65%) rename 0107-Reimplement-boot_counter.patch => 0092-Reimplement-boot_counter.patch (96%) rename 0108-Fix-menu-entry-selection-based-on-ID-and-title.patch => 0093-Fix-menu-entry-selection-based-on-ID-and-title.patch (99%) rename 0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch => 0094-Make-the-menu-entry-users-option-argument-to-be-opti.patch (97%) rename 0110-Add-efi-export-env-and-efi-load-env-commands.patch => 0095-Add-efi-export-env-and-efi-load-env-commands.patch (93%) rename 0112-Export-all-variables-from-the-initial-context-when-c.patch => 0096-Export-all-variables-from-the-initial-context-when-c.patch (95%) rename 0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch => 0097-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch (96%) rename 0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch => 0098-Don-t-assume-that-boot-commands-will-only-return-on-.patch (98%) rename 0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch => 0099-grub-set-bootflag-Update-comment-about-running-as-ro.patch (96%) rename 0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch => 0100-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch (99%) rename 0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch => 0101-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch (98%) rename 0118-Add-start-symbol-for-RISC-V.patch => 0102-Add-start-symbol-for-RISC-V.patch (95%) rename 0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch => 0103-bootstrap.conf-Force-autogen.sh-to-use-python3.patch (92%) rename 0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch => 0104-efi-http-Export-fw-http-_path-variables-to-make-them.patch (95%) rename 0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch => 0105-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch (94%) rename 0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch => 0106-efi-net-Allow-to-specify-a-port-number-in-addresses.patch (97%) rename 0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch => 0107-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch (97%) rename 0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch => 0108-efi-net-Print-a-debug-message-if-parsing-the-address.patch (98%) rename 0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch => 0109-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch (96%) rename 0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch => 0110-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch (93%) rename 0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch => 0111-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch (95%) delete mode 100644 0111-Make-it-possible-to-subtract-conditions-from-debug.patch rename 0131-efi-dhcp-fix-some-allocation-error-checking.patch => 0112-efi-dhcp-fix-some-allocation-error-checking.patch (83%) rename 0132-efi-http-fix-some-allocation-error-checking.patch => 0113-efi-http-fix-some-allocation-error-checking.patch (84%) rename 0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch => 0114-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch (98%) rename 0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch => 0115-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch (97%) rename 0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch => 0116-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch (96%) rename 0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch => 0117-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch (97%) rename 0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch => 0118-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch (97%) rename 0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch => 0119-Add-systemd-integration-scripts-to-make-systemctl-re.patch (91%) rename 0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch => 0120-systemd-integration.sh-Also-set-old-menu_show_once-g.patch (97%) rename 0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch => 0121-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch (93%) rename 0144-grub-install-disable-support-for-EFI-platforms.patch => 0122-grub-install-disable-support-for-EFI-platforms.patch (81%) rename 0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch => 0123-New-with-debug-timestamps-configure-flag-to-prepend-.patch (84%) rename 0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch => 0124-Added-debug-statements-to-grub_disk_open-and-grub_di.patch (67%) rename 0147-Introduce-function-grub_debug_is_enabled-void-return.patch => 0125-Introduce-function-grub_debug_is_enabled-void-return.patch (87%) rename 0148-Don-t-clear-screen-when-debugging-is-enabled.patch => 0126-Don-t-clear-screen-when-debugging-is-enabled.patch (80%) rename 0150-grub_file_-instrumentation-new-file-debug-tag.patch => 0127-grub_file_-instrumentation-new-file-debug-tag.patch (83%) delete mode 100644 0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch rename 0151-ieee1275-Avoiding-many-unecessary-open-close.patch => 0128-ieee1275-Avoiding-many-unecessary-open-close.patch (94%) rename 0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch => 0129-ieee1275-powerpc-implements-fibre-channel-discovery-.patch (98%) rename 0153-ieee1275-powerpc-enables-device-mapper-discovery.patch => 0130-ieee1275-powerpc-enables-device-mapper-discovery.patch (98%) rename 0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch => 0131-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch (94%) rename 0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch => 0132-Add-suport-for-signing-grub-with-an-appended-signatu.patch (86%) rename 0156-docs-grub-Document-signing-grub-under-UEFI.patch => 0133-docs-grub-Document-signing-grub-under-UEFI.patch (92%) rename 0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch => 0134-docs-grub-Document-signing-grub-with-an-appended-sig.patch (95%) rename 0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch => 0135-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch (92%) rename 0159-pgp-factor-out-rsa_pad.patch => 0136-pgp-factor-out-rsa_pad.patch (97%) rename 0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch => 0137-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch (96%) rename 0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch => 0138-posix_wrap-tweaks-in-preparation-for-libtasn1.patch (89%) rename 0162-libtasn1-import-libtasn1-4.16.0.patch => 0139-libtasn1-import-libtasn1-4.16.0.patch (99%) rename 0163-libtasn1-disable-code-not-needed-in-grub.patch => 0140-libtasn1-disable-code-not-needed-in-grub.patch (97%) rename 0164-libtasn1-changes-for-grub-compatibility.patch => 0141-libtasn1-changes-for-grub-compatibility.patch (96%) rename 0165-libtasn1-compile-into-asn1-module.patch => 0142-libtasn1-compile-into-asn1-module.patch (94%) rename 0166-test_asn1-test-module-for-libtasn1.patch => 0143-test_asn1-test-module-for-libtasn1.patch (99%) rename 0167-grub-install-support-embedding-x509-certificates.patch => 0144-grub-install-support-embedding-x509-certificates.patch (90%) rename 0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch => 0145-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch (99%) rename 0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch => 0146-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch (99%) rename 0170-appended-signatures-support-verifying-appended-signa.patch => 0147-appended-signatures-support-verifying-appended-signa.patch (98%) rename 0171-appended-signatures-verification-tests.patch => 0148-appended-signatures-verification-tests.patch (99%) rename 0172-appended-signatures-documentation.patch => 0149-appended-signatures-documentation.patch (91%) delete mode 100644 0149-kern-file-Fix-error-handling-in-grub_file_open.patch rename 0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch => 0150-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch (84%) create mode 100644 0151-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename 0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch => 0152-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch (99%) rename 0176-ieee1275-ofdisk-retry-on-open-failure.patch => 0153-ieee1275-ofdisk-retry-on-open-failure.patch (93%) rename 0178-efinet-Add-DHCP-proxy-support.patch => 0154-efinet-Add-DHCP-proxy-support.patch (80%) rename 0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch => 0155-Don-t-update-the-cmdline-when-generating-legacy-menu.patch (92%) rename 0181-Suppress-gettext-error-message.patch => 0156-Suppress-gettext-error-message.patch (96%) rename 0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch => 0157-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch (97%) rename 0186-normal-main-Discover-the-device-to-read-the-config-f.patch => 0158-normal-main-Discover-the-device-to-read-the-config-f.patch (98%) rename 0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch => 0159-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch (92%) rename 0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch => 0160-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch (97%) create mode 100644 0161-Add-Fedora-location-of-DejaVu-SANS-font.patch rename 0205-efi-new-connectefi-command.patch => 0162-efi-new-connectefi-command.patch (94%) rename 0210-powerpc-prefix-detection-support-device-names-with-c.patch => 0163-powerpc-prefix-detection-support-device-names-with-c.patch (98%) rename 0211-make-ofdisk_retries-optional.patch => 0164-make-ofdisk_retries-optional.patch (98%) rename 0246-misc-Make-grub_min-and-grub_max-more-resilient.patch => 0165-misc-Make-grub_min-and-grub_max-more-resilient.patch (94%) rename 0247-ReiserFS-switch-to-using-grub_min-grub_max.patch => 0166-ReiserFS-switch-to-using-grub_min-grub_max.patch (99%) rename 0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch => 0167-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch (76%) rename 0249-modules-make-.module_license-read-only.patch => 0168-modules-make-.module_license-read-only.patch (97%) rename 0250-modules-strip-.llvm_addrsig-sections-and-similar.patch => 0169-modules-strip-.llvm_addrsig-sections-and-similar.patch (97%) rename 0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch => 0170-modules-Don-t-allocate-space-for-non-allocable-secti.patch (92%) rename 0254-modules-load-module-sections-at-page-aligned-address.patch => 0171-modules-load-module-sections-at-page-aligned-address.patch (90%) rename 0255-nx-add-memory-attribute-get-set-API.patch => 0172-nx-add-memory-attribute-get-set-API.patch (89%) rename 0256-nx-set-page-permissions-for-loaded-modules.patch => 0173-nx-set-page-permissions-for-loaded-modules.patch (81%) delete mode 100644 0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch rename 0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch => 0174-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch (63%) rename 0260-grub_fs_probe-dprint-errors-from-filesystems.patch => 0175-grub_fs_probe-dprint-errors-from-filesystems.patch (89%) rename 0262-Make-debug-file-show-which-file-filters-get-run.patch => 0176-Make-debug-file-show-which-file-filters-get-run.patch (97%) rename 0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch => 0177-BLS-create-etc-kernel-cmdline-during-mkconfig.patch (92%) rename 0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch => 0178-squish-don-t-dup-rhgb-quiet-check-mtimes.patch (94%) delete mode 100644 0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch rename 0269-squish-give-up-on-rhgb-quiet.patch => 0179-squish-give-up-on-rhgb-quiet.patch (91%) rename 0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch => 0180-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch (96%) rename 0271-blscfg-Don-t-root-device-in-emu-builds.patch => 0181-blscfg-Don-t-root-device-in-emu-builds.patch (95%) rename 0309-ppc64le-signed-boot-media-changes.patch => 0182-ppc64le-signed-boot-media-changes.patch (92%) rename 0310-core-Fix-several-implicit-function-declarations.patch => 0183-core-Fix-several-implicit-function-declarations.patch (93%) delete mode 100644 0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch delete mode 100644 0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch create mode 100644 0184-ieee1275-request-memory-with-ibm-client-architecture.patch rename 0323-hostdisk-work-around-proc-not-reporting-size.patch => 0185-hostdisk-work-around-proc-not-reporting-size.patch (93%) rename 0324-blscfg-check-for-mounted-boot-in-emu.patch => 0186-blscfg-check-for-mounted-boot-in-emu.patch (99%) rename 0329-grub_dl_set_mem_attrs-fix-format-string.patch => 0187-grub_dl_set_mem_attrs-fix-format-string.patch (97%) delete mode 100644 0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch rename 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch => 0188-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch (99%) delete mode 100644 0189-Print-module-name-on-license-check-failure.patch rename 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch => 0189-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch (88%) rename 0332-emu-Add-switch-root-to-grub-emu.patch => 0190-emu-Add-switch-root-to-grub-emu.patch (98%) delete mode 100644 0191-grub-mkconfig-restore-umask-for-grub.cfg.patch rename 0333-util-Enable-default-kernel-for-updates.patch => 0191-util-Enable-default-kernel-for-updates.patch (97%) rename 0334-efi-http-change-uint32_t-to-uintn_t.patch => 0192-efi-http-change-uint32_t-to-uintn_t.patch (95%) delete mode 100644 0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch delete mode 100644 0193-Add-Fedora-location-of-DejaVu-SANS-font.patch rename 0335-Add-Install-section-to-aux-systemd-units.patch => 0193-Add-Install-section-to-aux-systemd-units.patch (93%) rename 0337-Fix-missing-include-in-ofdisk.c.patch => 0194-Fix-missing-include-in-ofdisk.c.patch (95%) delete mode 100644 0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch delete mode 100644 0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch rename 0348-add-flag-to-only-search-root-dev.patch => 0195-add-flag-to-only-search-root-dev.patch (88%) delete mode 100644 0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch create mode 100644 0196-cryptdisk-fix-incorrect-sign-comparison.patch delete mode 100644 0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch create mode 100644 0197-grub-install-fix-a-sign-comparison-error.patch delete mode 100644 0198-Use-visual-indentation-in-config.h.in.patch create mode 100644 0198-grub-mount-work-around-bad-integer-comparison.patch delete mode 100644 0199-Where-present-ensure-config-util.h-precedes-config.h.patch create mode 100644 0199-power-Fix-use-after-free-in-get_slave_from_dm.patch delete mode 100644 0200-Drop-gnulib-fix-base64.patch.patch create mode 100644 0200-Fix-some-sign-comparison-errors.patch delete mode 100644 0201-Drop-gnulib-no-abort.patch.patch create mode 100644 0201-normal-Fix-a-discarded-const.patch delete mode 100644 0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch create mode 100644 0202-at_keyboard-mark-grub_keyboard_controller_write-unus.patch create mode 100644 0203-Fix-another-minor-sign-comparison-error.patch delete mode 100644 0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch create mode 100644 0204-Track-explicit-module-dependencies-in-Makefile.core..patch delete mode 100644 0204-search-new-efidisk-only-option-on-EFI-systems.patch create mode 100644 0205-Revert-mm-Assert-that-we-preserve-header-vs-region-a.patch create mode 100644 0206-make-use-the-_CPU-variety-of-build-flags-for-PROGRAM.patch create mode 100644 0207-Work-around-extra_deps.lst-issue.patch delete mode 100644 0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch create mode 100644 0208-include-proper-attribute-for-an-EFI-API-call-definit.patch create mode 100644 0209-cast-grub_error-status-parameter.patch create mode 100644 0210-remove-unused-varible.patch create mode 100644 0211-cast-grub_net_bootp_packet-pointer.patch create mode 100644 0212-libtasn1-fix-string-overflow-warning.patch rename 0004-Add-support-for-Linux-EFI-stub-loading.patch => 0213-Add-support-for-Linux-EFI-stub-loading.patch (55%) delete mode 100644 0214-commands-boot-Add-API-to-pass-context-to-loader.patch create mode 100644 0214-fix-i386_pc-on-legacycfg-module.patch rename 0007-Add-secureboot-support-on-efi-chainloader.patch => 0215-Add-secureboot-support-on-efi-chainloader.patch (88%) rename 0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch => 0216-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch (66%) rename 0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch => 0217-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch (93%) rename 0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch => 0218-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch (79%) create mode 100644 0219-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch delete mode 100644 0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch rename 0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch => 0220-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch (84%) delete mode 100644 0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch rename 0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0221-Try-to-pick-better-locations-for-kernel-and-initrd.patch (94%) delete mode 100644 0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch delete mode 100644 0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch rename 0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0222-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (97%) delete mode 100644 0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch rename 0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0223-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (98%) delete mode 100644 0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch rename 0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0224-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (90%) delete mode 100644 0225-video-readers-png-Sanity-check-some-huffman-codes.patch rename 0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0225-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (92%) rename 0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch => 0226-efi-Set-image-base-address-before-jumping-to-the-PE-.patch (78%) delete mode 100644 0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch delete mode 100644 0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch rename 0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch => 0227-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch (97%) rename 0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch => 0228-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch (97%) delete mode 100644 0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch rename 0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch => 0229-linuxefi-fail-kernel-validation-without-shim-protoco.patch (69%) delete mode 100644 0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch rename 0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch => 0230-Allow-chainloading-EFI-apps-from-loop-mounts.patch (81%) delete mode 100644 0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch rename 0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch => 0231-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch (98%) delete mode 100644 0231-net-netbuff-Block-overly-large-netbuff-allocs.patch rename 0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch => 0232-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch (86%) delete mode 100644 0232-net-ip-Do-IP-fragment-maths-safely.patch rename 0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch => 0233-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch (83%) delete mode 100644 0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch rename 0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch => 0234-loader-efi-chainloader-grub_load_and_start_image-doe.patch (87%) delete mode 100644 0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch rename 0213-loader-efi-chainloader-simplify-the-loader-state.patch => 0235-loader-efi-chainloader-simplify-the-loader-state.patch (76%) delete mode 100644 0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch rename 0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch => 0236-loader-efi-chainloader-Use-grub_loader_set_ex.patch (79%) delete mode 100644 0236-net-tftp-Avoid-a-trivial-UAF.patch rename 0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch => 0237-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch (93%) delete mode 100644 0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch rename 0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch => 0238-loader-i386-efi-linux-Use-grub_loader_set_ex.patch (94%) delete mode 100644 0238-net-http-Fix-OOB-write-for-split-http-headers.patch rename 0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch => 0239-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch (98%) delete mode 100644 0239-net-http-Error-out-on-headers-with-LF-without-CR.patch rename 0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch => 0240-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch (98%) delete mode 100644 0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch rename 0263-efi-use-enumerated-array-positions-for-our-allocatio.patch => 0241-efi-use-enumerated-array-positions-for-our-allocatio.patch (95%) delete mode 100644 0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch rename 0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch => 0242-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch (94%) delete mode 100644 0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch rename 0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch => 0243-efi-allocate-the-initrd-within-the-bounds-expressed-.patch (90%) delete mode 100644 0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch rename 0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch => 0244-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch (87%) delete mode 100644 0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch delete mode 100644 0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch rename 0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch => 0245-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch (97%) rename 0339-grub-install-on-EFI-if-forced.patch => 0246-grub-install-on-EFI-if-forced.patch (73%) rename 0340-Remove-Install-section-from-aux-systemd-units.patch => 0247-Remove-Install-section-from-aux-systemd-units.patch (93%) rename 0346-chainloader-remove-device-path-debug-message.patch => 0248-chainloader-remove-device-path-debug-message.patch (89%) rename 0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch => 0249-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch (99%) rename 0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch => 0250-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch (99%) rename 0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch => 0251-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch (96%) create mode 100644 0252-Makefile.core.def-fix-linux-module.patch create mode 100644 0253-Add-support-for-Linux-EFI-stub-loading-on-arm-archit.patch rename 0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0254-arm-arm64-loader-Better-memory-allocation-and-error-.patch (80%) rename 0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch => 0255-arm64-Fix-EFI-loader-kernel-image-allocation.patch (67%) rename 0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch => 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch (68%) rename 0273-Correct-BSS-zeroing-on-aarch64.patch => 0257-Correct-BSS-zeroing-on-aarch64.patch (76%) rename 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch => 0258-arm64-Use-proper-memory-type-for-kernel-allocation.patch (77%) delete mode 100644 0259-grub-probe-document-the-behavior-of-multiple-v.patch rename 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch => 0259-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch (96%) rename 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch => 0260-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch (98%) rename 0349-Ignore-warnings-for-incompatible-types.patch => 0261-Ignore-warnings-for-incompatible-types.patch (90%) delete mode 100644 0261-fs-fat-don-t-error-when-mtime-is-0.patch rename 0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch => 0262-cmd-search-Rework-of-CVE-2023-4001-fix.patch (99%) create mode 100644 0263-loader-efi-linux.c-read-the-kernel-image-before-head.patch rename 0257-nx-set-attrs-in-our-kernel-loaders.patch => 0264-nx-set-attrs-in-our-kernel-loaders.patch (77%) create mode 100644 0265-efi-Provide-wrappers-for-load_image-start_image.patch create mode 100644 0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch create mode 100644 0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch create mode 100644 0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch rename 0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch => 0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch (71%) rename 0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch => 0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch (92%) create mode 100644 0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch delete mode 100644 0272-loader-arm64-linux-Remove-magic-number-header-field-.patch delete mode 100644 0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch delete mode 100644 0276-commands-efi-tpm-Refine-the-status-of-log-event.patch delete mode 100644 0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch delete mode 100644 0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch delete mode 100644 0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch delete mode 100644 0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch delete mode 100644 0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch delete mode 100644 0282-font-Remove-grub_font_dup_glyph.patch delete mode 100644 0283-font-Fix-integer-overflow-in-ensure_comb_space.patch delete mode 100644 0284-font-Fix-integer-overflow-in-BMP-index.patch delete mode 100644 0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch delete mode 100644 0286-kern-efi-sb-Enforce-verification-of-font-files.patch delete mode 100644 0287-fbutil-Fix-integer-overflow.patch delete mode 100644 0288-font-Fix-an-integer-underflow-in-blit_comb.patch delete mode 100644 0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch delete mode 100644 0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch delete mode 100644 0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch delete mode 100644 0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch delete mode 100644 0293-mm-Clarify-grub_real_malloc.patch delete mode 100644 0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch delete mode 100644 0295-mm-Document-grub_free.patch delete mode 100644 0296-mm-Document-grub_mm_init_region.patch delete mode 100644 0297-mm-Document-GRUB-internal-memory-management-structur.patch delete mode 100644 0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch delete mode 100644 0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch delete mode 100644 0300-mm-Debug-support-for-region-operations.patch delete mode 100644 0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch delete mode 100644 0302-mm-Allow-dynamically-requesting-additional-memory-re.patch delete mode 100644 0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch delete mode 100644 0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch delete mode 100644 0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch delete mode 100644 0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch delete mode 100644 0307-efi-Increase-default-memory-allocation-to-32-MiB.patch delete mode 100644 0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch delete mode 100644 0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch delete mode 100644 0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch delete mode 100644 0313-ieee1275-request-memory-with-ibm-client-architecture.patch delete mode 100644 0314-ieee1275-drop-len-1-quirk-in-heap_init.patch delete mode 100644 0315-ieee1275-support-runtime-memory-claiming.patch delete mode 100644 0316-ieee1275-implement-vec5-for-cas-negotiation.patch delete mode 100644 0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch delete mode 100644 0318-powerpc-Drop-Open-Hack-Ware.patch delete mode 100644 0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch delete mode 100644 0320-mm-Adjust-new-region-size-to-take-management-overhea.patch delete mode 100644 0321-mm-Preallocate-some-space-when-adding-new-regions.patch delete mode 100644 0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch delete mode 100644 0325-emu-linux-work-around-systemctl-kexec-returning.patch delete mode 100644 0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch delete mode 100644 0327-kern-ieee1275-init-Extended-support-in-Vec5.patch delete mode 100644 0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch delete mode 100644 0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch delete mode 100644 0341-fs-Remove-trailing-whitespaces.patch delete mode 100644 0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch delete mode 100644 0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch delete mode 100644 0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch delete mode 100644 0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch delete mode 100644 0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch delete mode 100644 0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch delete mode 100644 0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch delete mode 100644 0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch delete mode 100644 0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch delete mode 100644 0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch delete mode 100644 0359-fs-ntfs-Make-code-more-readable.patch diff --git a/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch b/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch index 4824aa14..51621653 100644 --- a/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch +++ b/0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch @@ -10,7 +10,7 @@ This reverts commit 722737630889607c3b5761f1f5a48f1674cd2821. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 5984e92d29..9462248128 100644 +index 656301eaf22..376ca47efe4 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -36,7 +36,7 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n diff --git a/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch b/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch index 05ac0f8e..aa5a3263 100644 --- a/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch +++ b/0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch @@ -10,7 +10,7 @@ This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925. 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f8cbb8d7a2..d3e879b8e5 100644 +index 32c480daeb2..7516a015be0 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -140,9 +140,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2 @@ -31,7 +31,7 @@ index f8cbb8d7a2..d3e879b8e5 100644 GRUB_FS \ GRUB_FONT \ GRUB_PRELOAD_MODULES \ -@@ -246,6 +242,7 @@ export GRUB_DEFAULT \ +@@ -250,6 +246,7 @@ export GRUB_DEFAULT \ GRUB_BACKGROUND \ GRUB_THEME \ GRUB_GFXPAYLOAD_LINUX \ @@ -40,7 +40,7 @@ index f8cbb8d7a2..d3e879b8e5 100644 GRUB_SAVEDEFAULT \ GRUB_ENABLE_CRYPTODISK \ diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 9462248128..80685b15f4 100644 +index 376ca47efe4..30f27f15b83 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0003-Revert-templates-Disable-the-os-prober-by-default.patch b/0003-Revert-templates-Disable-the-os-prober-by-default.patch index 94927953..a51779d9 100644 --- a/0003-Revert-templates-Disable-the-os-prober-by-default.patch +++ b/0003-Revert-templates-Disable-the-os-prober-by-default.patch @@ -10,10 +10,10 @@ This reverts commit e346414725a70e5c74ee87ca14e580c66f517666. 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index f8b4b3b21a..69f08d289f 100644 +index a225f9a88d2..974bc0ddb07 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -1519,13 +1519,10 @@ boot sequence. If you have problems, set this option to @samp{text} and +@@ -1552,13 +1552,10 @@ boot sequence. If you have problems, set this option to @samp{text} and GRUB will tell Linux to boot in normal text mode. @item GRUB_DISABLE_OS_PROBER @@ -31,7 +31,7 @@ index f8b4b3b21a..69f08d289f 100644 @item GRUB_OS_PROBER_SKIP_LIST List of space-separated FS UUIDs of filesystems to be ignored from os-prober -@@ -1853,9 +1850,10 @@ than zero; otherwise 0. +@@ -1889,9 +1886,10 @@ than zero; otherwise 0. @section Multi-boot manual config Currently autogenerating config files for multi-boot environments depends on @@ -46,7 +46,7 @@ index f8b4b3b21a..69f08d289f 100644 First create a separate GRUB partition, big enough to hold GRUB. Some of the following entries show how to load OS installer images from this same partition, diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 80685b15f4..1b91c102f3 100644 +index 30f27f15b83..f300e46fc6a 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0005-Rework-linux-command.patch b/0004-Rework-linux-command.patch similarity index 86% rename from 0005-Rework-linux-command.patch rename to 0004-Rework-linux-command.patch index 694e4237..26d10ac8 100644 --- a/0005-Rework-linux-command.patch +++ b/0004-Rework-linux-command.patch @@ -13,10 +13,10 @@ Signed-off-by: Matthew Garrett 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 9f74a96b19..dccf3bb300 100644 +index 977757f2cc9..10f967f2563 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c -@@ -649,13 +649,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -661,13 +661,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), { grub_file_t file = 0; struct linux_i386_kernel_header lh; @@ -33,7 +33,7 @@ index 9f74a96b19..dccf3bb300 100644 grub_dl_ref (my_mod); -@@ -669,7 +671,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -681,7 +683,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (! file) goto fail; @@ -50,7 +50,7 @@ index 9f74a96b19..dccf3bb300 100644 { if (!grub_errno) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -677,6 +687,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -689,6 +699,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -60,7 +60,7 @@ index 9f74a96b19..dccf3bb300 100644 if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) { grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); -@@ -784,13 +797,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -796,13 +809,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), /* We've already read lh so there is no need to read it second time. */ len -= sizeof(lh); @@ -78,7 +78,7 @@ index 9f74a96b19..dccf3bb300 100644 } linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR; -@@ -853,7 +864,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -865,7 +876,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), /* The other parameters are filled when booting. */ @@ -87,7 +87,7 @@ index 9f74a96b19..dccf3bb300 100644 grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n", (unsigned) real_size, (unsigned) prot_size); -@@ -1007,9 +1018,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -1019,9 +1030,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } len = prot_file_size; @@ -98,7 +98,7 @@ index 9f74a96b19..dccf3bb300 100644 if (grub_errno == GRUB_ERR_NONE) { -@@ -1020,6 +1029,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -1032,6 +1041,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), fail: diff --git a/0006-Rework-linux16-command.patch b/0005-Rework-linux16-command.patch similarity index 98% rename from 0006-Rework-linux16-command.patch rename to 0005-Rework-linux16-command.patch index 5adaaba6..50a648c8 100644 --- a/0006-Rework-linux16-command.patch +++ b/0005-Rework-linux16-command.patch @@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 8be4c3b3f4..4b1750e360 100644 +index 4adeee9ae00..600530a742b 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), diff --git a/0010-re-write-.gitignore.patch b/0006-re-write-.gitignore.patch similarity index 94% rename from 0010-re-write-.gitignore.patch rename to 0006-re-write-.gitignore.patch index b6fa0beb..36b0efd8 100644 --- a/0010-re-write-.gitignore.patch +++ b/0006-re-write-.gitignore.patch @@ -20,10 +20,10 @@ Subject: [PATCH] re-write .gitignore create mode 100644 util/bash-completion.d/.gitignore diff --git a/.gitignore b/.gitignore -index f6a1bd0517..208d1d2325 100644 +index 4d0dfb700e4..a18787dcfe6 100644 --- a/.gitignore +++ b/.gitignore -@@ -275,3 +275,153 @@ widthspec.bin +@@ -279,3 +279,153 @@ widthspec.bin /xfs_test /xzcompress_test /zfs_test @@ -179,7 +179,7 @@ index f6a1bd0517..208d1d2325 100644 +/widthspec.h diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 -index 0000000000..e1d849ef95 +index 00000000000..e1d849ef95b --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,5 @@ @@ -190,7 +190,7 @@ index 0000000000..e1d849ef95 +/version*.texi diff --git a/grub-core/.gitignore b/grub-core/.gitignore new file mode 100644 -index 0000000000..2acce28115 +index 00000000000..2acce281159 --- /dev/null +++ b/grub-core/.gitignore @@ -0,0 +1,16 @@ @@ -212,14 +212,14 @@ index 0000000000..2acce28115 +/trigtables.c diff --git a/grub-core/lib/.gitignore b/grub-core/lib/.gitignore new file mode 100644 -index 0000000000..6815459140 +index 00000000000..68154591404 --- /dev/null +++ b/grub-core/lib/.gitignore @@ -0,0 +1 @@ +/libgcrypt-grub/ diff --git a/include/grub/gcrypt/.gitignore b/include/grub/gcrypt/.gitignore new file mode 100644 -index 0000000000..8fbf564624 +index 00000000000..8fbf5646246 --- /dev/null +++ b/include/grub/gcrypt/.gitignore @@ -0,0 +1,2 @@ @@ -227,7 +227,7 @@ index 0000000000..8fbf564624 +gcrypt.h diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 -index 0000000000..f507e7741e +index 00000000000..f507e7741e3 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1,5 @@ @@ -238,7 +238,7 @@ index 0000000000..f507e7741e +/stamp-po diff --git a/util/bash-completion.d/.gitignore b/util/bash-completion.d/.gitignore new file mode 100644 -index 0000000000..6813a527ad +index 00000000000..6813a527ad3 --- /dev/null +++ b/util/bash-completion.d/.gitignore @@ -0,0 +1,2 @@ diff --git a/0011-IBM-client-architecture-CAS-reboot-support.patch b/0007-IBM-client-architecture-CAS-reboot-support.patch similarity index 96% rename from 0011-IBM-client-architecture-CAS-reboot-support.patch rename to 0007-IBM-client-architecture-CAS-reboot-support.patch index 316b9eb2..44755349 100644 --- a/0011-IBM-client-architecture-CAS-reboot-support.patch +++ b/0007-IBM-client-architecture-CAS-reboot-support.patch @@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood 4 files changed, 91 insertions(+) diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c -index 4d493ab766..3a6689abb1 100644 +index 11b2beb2ff2..e2ecc65d2d8 100644 --- a/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c @@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void) @@ -100,7 +100,7 @@ index 4d493ab766..3a6689abb1 100644 + return 0; +} diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index c4ebe9e22a..70614de156 100644 +index bd44310005d..d3f53d93d87 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -34,6 +34,9 @@ @@ -137,7 +137,7 @@ index c4ebe9e22a..70614de156 100644 grub_errno = GRUB_ERR_NONE; } diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index 25158407dd..ad80399246 100644 +index 14ff09094f0..dab8fd2aeb0 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -28,6 +28,9 @@ @@ -162,10 +162,10 @@ index 25158407dd..ad80399246 100644 { char *line; diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 73e2f46447..0a599607f3 100644 +index dddb385149e..4f6e6aaa098 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h -@@ -254,6 +254,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali +@@ -251,6 +251,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias); void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath, struct grub_ieee1275_devalias *alias); diff --git a/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch b/0008-for-ppc-reset-console-display-attr-when-clear-screen.patch similarity index 97% rename from 0012-for-ppc-reset-console-display-attr-when-clear-screen.patch rename to 0008-for-ppc-reset-console-display-attr-when-clear-screen.patch index 121af849..63359395 100644 --- a/0012-for-ppc-reset-console-display-attr-when-clear-screen.patch +++ b/0008-for-ppc-reset-console-display-attr-when-clear-screen.patch @@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c -index 85ecf06b4d..05c88dcf49 100644 +index 4e534c683eb..3dbe88e8933 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term, diff --git a/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch b/0009-Disable-GRUB-video-support-for-IBM-power-machines.patch similarity index 85% rename from 0013-Disable-GRUB-video-support-for-IBM-power-machines.patch rename to 0009-Disable-GRUB-video-support-for-IBM-power-machines.patch index 917943fd..d55e7d03 100644 --- a/0013-Disable-GRUB-video-support-for-IBM-power-machines.patch +++ b/0009-Disable-GRUB-video-support-for-IBM-power-machines.patch @@ -15,10 +15,10 @@ Signed-off-by: Robbie Harwood 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 20cbbd761e..04df9d2c66 100644 +index e74de32483f..810a089a934 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c -@@ -90,7 +90,10 @@ grub_ieee1275_find_options (void) +@@ -89,7 +89,10 @@ grub_ieee1275_find_options (void) } if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0) @@ -31,10 +31,10 @@ index 20cbbd761e..04df9d2c66 100644 /* Old Macs have no key repeat, newer ones have fully working one. The ones inbetween when repeated key generates an escaoe sequence diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c -index 17a3dbbb57..b8e4b3feb3 100644 +index ca3d3c3b2c8..5592e4bb7c9 100644 --- a/grub-core/video/ieee1275.c +++ b/grub-core/video/ieee1275.c -@@ -352,9 +352,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter = +@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter = GRUB_MOD_INIT(ieee1275_fb) { @@ -51,14 +51,14 @@ index 17a3dbbb57..b8e4b3feb3 100644 GRUB_MOD_FINI(ieee1275_fb) diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 0a599607f3..b5a1d49bbc 100644 +index 4f6e6aaa098..db0ec5f4c68 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h -@@ -148,6 +148,8 @@ enum grub_ieee1275_flag - GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN, +@@ -145,6 +145,8 @@ enum grub_ieee1275_flag + GRUB_IEEE1275_FLAG_POWER_VM, - GRUB_IEEE1275_FLAG_RAW_DEVNAMES, -+ + GRUB_IEEE1275_FLAG_POWER_KVM, ++ + GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT }; diff --git a/0014-Move-bash-completion-script-922997.patch b/0010-Move-bash-completion-script-922997.patch similarity index 89% rename from 0014-Move-bash-completion-script-922997.patch rename to 0010-Move-bash-completion-script-922997.patch index a84d66e5..113f8b08 100644 --- a/0014-Move-bash-completion-script-922997.patch +++ b/0010-Move-bash-completion-script-922997.patch @@ -10,10 +10,10 @@ Apparently these go in a new place now. 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 7517fc49d9..8331f95b64 100644 +index cd667a2eb75..ae3a49321ad 100644 --- a/configure.ac +++ b/configure.ac -@@ -314,6 +314,14 @@ AC_SUBST(grubdirname) +@@ -319,6 +319,14 @@ AC_SUBST(grubdirname) AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", [Default grub directory name]) @@ -28,7 +28,7 @@ index 7517fc49d9..8331f95b64 100644 # # Checks for build programs. # -@@ -525,6 +533,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" +@@ -534,6 +542,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" # Check for target programs. # @@ -39,7 +39,7 @@ index 7517fc49d9..8331f95b64 100644 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then tmp_ac_tool_prefix="$ac_tool_prefix" diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am -index 136287cf1b..61108f0542 100644 +index 136287cf1bf..61108f05429 100644 --- a/util/bash-completion.d/Makefile.am +++ b/util/bash-completion.d/Makefile.am @@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source) diff --git a/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch b/0011-Allow-fallback-to-include-entries-by-title-not-just-.patch similarity index 98% rename from 0015-Allow-fallback-to-include-entries-by-title-not-just-.patch rename to 0011-Allow-fallback-to-include-entries-by-title-not-just-.patch index 6450a543..b85e5e6e 100644 --- a/0015-Allow-fallback-to-include-entries-by-title-not-just-.patch +++ b/0011-Allow-fallback-to-include-entries-by-title-not-just-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 8397886fa0..d7a222e681 100644 +index 6a90e091f22..6444ee6f969 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout) diff --git a/0016-Make-exit-take-a-return-code.patch b/0012-Make-exit-take-a-return-code.patch similarity index 82% rename from 0016-Make-exit-take-a-return-code.patch rename to 0012-Make-exit-take-a-return-code.patch index 654ef73b..87e03ad8 100644 --- a/0016-Make-exit-take-a-return-code.patch +++ b/0012-Make-exit-take-a-return-code.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones grub-core/commands/minicmd.c | 20 ++++++++++++++++---- grub-core/kern/efi/efi.c | 9 +++++++-- grub-core/kern/emu/main.c | 2 +- - grub-core/kern/emu/misc.c | 5 +++-- + grub-core/kern/emu/misc.c | 9 +++++---- grub-core/kern/i386/coreboot/init.c | 2 +- grub-core/kern/i386/qemu/init.c | 2 +- grub-core/kern/ieee1275/init.c | 2 +- @@ -24,10 +24,10 @@ Signed-off-by: Peter Jones grub-core/kern/uboot/init.c | 6 +++--- grub-core/kern/xen/init.c | 2 +- include/grub/misc.h | 2 +- - 14 files changed, 48 insertions(+), 21 deletions(-) + 14 files changed, 50 insertions(+), 23 deletions(-) diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c -index fa498931ed..2bd3ac76f2 100644 +index fa498931ed2..2bd3ac76f2d 100644 --- a/grub-core/commands/minicmd.c +++ b/grub-core/commands/minicmd.c @@ -182,12 +182,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), @@ -60,10 +60,10 @@ index fa498931ed..2bd3ac76f2 100644 } diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 8cff7be028..05d8237a9b 100644 +index b93ae3aba12..885d7c6420e 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -165,11 +165,16 @@ grub_reboot (void) +@@ -175,11 +175,16 @@ grub_reboot (void) } void @@ -76,14 +76,14 @@ index 8cff7be028..05d8237a9b 100644 + rc = GRUB_EFI_SUCCESS; + grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); - efi_call_4 (grub_efi_system_table->boot_services->exit, -- grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0); -+ grub_efi_image_handle, rc, 0, 0); + grub_efi_system_table->boot_services->exit (grub_efi_image_handle, +- GRUB_EFI_SUCCESS, 0, 0); ++ rc, 0, 0); for (;;) ; } diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 425bb96034..55ea5a11cc 100644 +index 855b11c3dec..38c1576a2ef 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -67,7 +67,7 @@ grub_reboot (void) @@ -96,10 +96,19 @@ index 425bb96034..55ea5a11cc 100644 grub_reboot (); } diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index dfd8a8ec48..0ff13bcaf8 100644 +index 521220b49d2..16c79bc9488 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -151,9 +151,10 @@ xasprintf (const char *fmt, ...) +@@ -83,7 +83,7 @@ grub_util_error (const char *fmt, ...) + vfprintf (stderr, fmt, ap); + va_end (ap); + fprintf (stderr, ".\n"); +- grub_exit (); ++ grub_exit (1); + } + + void * +@@ -152,12 +152,13 @@ xasprintf (const char *fmt, ...) #if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL) void @@ -107,13 +116,17 @@ index dfd8a8ec48..0ff13bcaf8 100644 +__attribute__ ((noreturn)) +grub_exit (int rc) { +-#if defined (GRUB_KERNEL) ++#if defined (GRUB_KERNEL) && !defined (GRUB_MACHINE_EFI) + grub_reboot (); + #endif - exit (1); + exit (rc < 0 ? 1 : rc); } #endif diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c -index 3314f027fe..36f9134b7b 100644 +index 4fae8b571f1..feaf9295e30 100644 --- a/grub-core/kern/i386/coreboot/init.c +++ b/grub-core/kern/i386/coreboot/init.c @@ -41,7 +41,7 @@ extern grub_uint8_t _end[]; @@ -126,7 +139,7 @@ index 3314f027fe..36f9134b7b 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/i386/qemu/init.c b/grub-core/kern/i386/qemu/init.c -index 271b6fbfab..9fafe98f01 100644 +index 08f81d25e68..604fc94b5a0 100644 --- a/grub-core/kern/i386/qemu/init.c +++ b/grub-core/kern/i386/qemu/init.c @@ -42,7 +42,7 @@ extern grub_uint8_t _end[]; @@ -139,11 +152,11 @@ index 271b6fbfab..9fafe98f01 100644 /* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index d483e35eed..e71d158416 100644 +index fb7d1a3bacf..50c65b2f6e5 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack; - #endif +@@ -114,7 +114,7 @@ grub_addr_t grub_ieee1275_original_stack; + #define BYTE22 (DY_MEM_V2 | DRC_INFO) void -grub_exit (void) @@ -152,7 +165,7 @@ index d483e35eed..e71d158416 100644 grub_ieee1275_exit (); } diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c -index 2ed3ff3191..5c40c34078 100644 +index 2ed3ff3191e..5c40c34078d 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -276,7 +276,7 @@ grub_halt (void) @@ -165,7 +178,7 @@ index 2ed3ff3191..5c40c34078 100644 GRUB_ARC_FIRMWARE_VECTOR->exit (); diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c -index 7b96531b98..dff598ca7b 100644 +index 5bd721260f6..97b09b0eeea 100644 --- a/grub-core/kern/mips/loongson/init.c +++ b/grub-core/kern/mips/loongson/init.c @@ -304,7 +304,7 @@ grub_halt (void) @@ -178,7 +191,7 @@ index 7b96531b98..dff598ca7b 100644 grub_halt (); } diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c -index be88b77d22..8b6c55ffc0 100644 +index b5477b87ffa..69488a34e7c 100644 --- a/grub-core/kern/mips/qemu_mips/init.c +++ b/grub-core/kern/mips/qemu_mips/init.c @@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused))) @@ -191,10 +204,10 @@ index be88b77d22..8b6c55ffc0 100644 grub_halt (); } diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 3af336ee22..63b586d09c 100644 +index 7cee5d75c3c..11037dc0227 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -1209,9 +1209,18 @@ grub_abort (void) +@@ -1311,9 +1311,18 @@ grub_abort (void) grub_getkey (); } @@ -215,7 +228,7 @@ index 3af336ee22..63b586d09c 100644 grub_fatal (const char *fmt, ...) { diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c -index 3e338645c5..be2a5be1d0 100644 +index 3e338645c57..be2a5be1d07 100644 --- a/grub-core/kern/uboot/init.c +++ b/grub-core/kern/uboot/init.c @@ -39,9 +39,9 @@ extern grub_size_t grub_total_module_size; @@ -240,7 +253,7 @@ index 3e338645c5..be2a5be1d0 100644 else if (ver > API_SIG_VERSION) { diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c -index 782ca72952..708b060f32 100644 +index 782ca72952a..708b060f324 100644 --- a/grub-core/kern/xen/init.c +++ b/grub-core/kern/xen/init.c @@ -584,7 +584,7 @@ grub_machine_init (void) @@ -253,15 +266,15 @@ index 782ca72952..708b060f32 100644 struct sched_shutdown arg; diff --git a/include/grub/misc.h b/include/grub/misc.h -index 7d2b551969..fd18e6320b 100644 +index 1b35a167fde..72aff15750d 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h -@@ -353,7 +353,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, - char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...) +@@ -385,7 +385,7 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT; char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) WARN_UNUSED_RESULT; + -void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn)); +void EXPORT_FUNC(grub_exit) (int rc) __attribute__ ((noreturn)); + void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn)); grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, grub_uint64_t d, - grub_uint64_t *r); diff --git a/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch b/0013-Make-efi-machines-load-an-env-block-from-a-variable.patch similarity index 71% rename from 0017-Make-efi-machines-load-an-env-block-from-a-variable.patch rename to 0013-Make-efi-machines-load-an-env-block-from-a-variable.patch index ecfab5ae..93552985 100644 --- a/0017-Make-efi-machines-load-an-env-block-from-a-variable.patch +++ b/0013-Make-efi-machines-load-an-env-block-from-a-variable.patch @@ -6,14 +6,14 @@ Subject: [PATCH] Make efi machines load an env block from a variable Signed-off-by: Peter Jones --- grub-core/Makefile.core.def | 1 + - grub-core/kern/efi/init.c | 36 +++++++++++++++++++++++++++++++++++- - 2 files changed, 36 insertions(+), 1 deletion(-) + grub-core/kern/efi/init.c | 34 ++++++++++++++++++++++++++++++++++ + 2 files changed, 35 insertions(+) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 45d3edaa4d..c865a08b02 100644 +index 1571421d7e8..0bffbfea917 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -207,6 +207,7 @@ kernel = { +@@ -219,6 +219,7 @@ kernel = { efi = kern/efi/acpi.c; efi = kern/efi/sb.c; efi = kern/lockdown.c; @@ -22,10 +22,10 @@ index 45d3edaa4d..c865a08b02 100644 i386_multiboot = kern/i386/pc/acpi.c; i386_coreboot = kern/acpi.c; diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 7facacf09c..6d39bd3ad2 100644 +index 6c54af6e79e..b5201974a76 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c -@@ -27,8 +27,11 @@ +@@ -28,8 +28,11 @@ #include #include #include @@ -36,8 +36,8 @@ index 7facacf09c..6d39bd3ad2 100644 + #ifdef GRUB_STACK_PROTECTOR - static grub_efi_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID; -@@ -82,6 +85,36 @@ stack_protector_init (void) + static grub_efi_char16_t stack_chk_fail_msg[] = +@@ -103,6 +106,36 @@ stack_protector_init (void) grub_addr_t grub_modbase; @@ -58,7 +58,7 @@ index 7facacf09c..6d39bd3ad2 100644 +static void +grub_efi_env_init (void) +{ -+ grub_efi_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID; ++ grub_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID; + struct grub_envblk envblk_s = { NULL, 0 }; + grub_envblk_t envblk = &envblk_s; + @@ -71,19 +71,14 @@ index 7facacf09c..6d39bd3ad2 100644 + grub_free (envblk_s.buf); +} + - void + __attribute__ ((__optimize__ ("-fno-stack-protector"))) void grub_efi_init (void) { -@@ -108,10 +141,11 @@ grub_efi_init (void) - efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer, - 0, 0, 0, NULL); +@@ -128,6 +161,7 @@ grub_efi_init (void) + + grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL); + grub_efi_env_init (); grub_efidisk_init (); - } - --void (*grub_efi_net_config) (grub_efi_handle_t hnd, -+void (*grub_efi_net_config) (grub_efi_handle_t hnd, - char **device, - char **path); + grub_efi_register_debug_commands (); diff --git a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch b/0014-Migrate-PPC-from-Yaboot-to-Grub2.patch similarity index 96% rename from 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch rename to 0014-Migrate-PPC-from-Yaboot-to-Grub2.patch index 1e310e98..1ff254cc 100644 --- a/0018-Migrate-PPC-from-Yaboot-to-Grub2.patch +++ b/0014-Migrate-PPC-from-Yaboot-to-Grub2.patch @@ -15,11 +15,11 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub.d/20_ppc_terminfo.in diff --git a/Makefile.util.def b/Makefile.util.def -index f8b356cc1f..2c9b283a23 100644 +index 9432365a9df..09bfcadd976 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -508,6 +508,13 @@ script = { - condition = COND_HOST_LINUX; +@@ -517,6 +517,13 @@ script = { + installdir = grubconf; }; +script = { @@ -34,7 +34,7 @@ index f8b356cc1f..2c9b283a23 100644 common = util/grub.d/30_os-prober.in; diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in new file mode 100644 -index 0000000000..10d6658682 +index 00000000000..10d66586820 --- /dev/null +++ b/util/grub.d/20_ppc_terminfo.in @@ -0,0 +1,114 @@ diff --git a/0019-Add-fw_path-variable-revised.patch b/0015-Add-fw_path-variable-revised.patch similarity index 96% rename from 0019-Add-fw_path-variable-revised.patch rename to 0015-Add-fw_path-variable-revised.patch index 804938bd..4012f3fe 100644 --- a/0019-Add-fw_path-variable-revised.patch +++ b/0015-Add-fw_path-variable-revised.patch @@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 73967e2f5b..d1de9fa687 100644 +index 731c07c2901..463dafdba02 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -128,16 +128,15 @@ grub_set_prefix_and_root (void) @@ -44,7 +44,7 @@ index 73967e2f5b..d1de9fa687 100644 } diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 70614de156..62571e6dfc 100644 +index d3f53d93d87..08f48c71df1 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0020-Pass-x-hex-hex-straight-through-unmolested.patch b/0016-Pass-x-hex-hex-straight-through-unmolested.patch similarity index 97% rename from 0020-Pass-x-hex-hex-straight-through-unmolested.patch rename to 0016-Pass-x-hex-hex-straight-through-unmolested.patch index c2623acf..e1aa1aff 100644 --- a/0020-Pass-x-hex-hex-straight-through-unmolested.patch +++ b/0016-Pass-x-hex-hex-straight-through-unmolested.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c -index cc3290311f..8f67a4be7f 100644 +index ed65865050a..5455242c352 100644 --- a/grub-core/commands/wildcard.c +++ b/grub-core/commands/wildcard.c @@ -488,6 +488,12 @@ check_file (const char *dir, const char *basename) @@ -47,7 +47,7 @@ index cc3290311f..8f67a4be7f 100644 *optr++ = iptr[1]; iptr += 2; diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index ed0b149dca..8e2294d8ff 100644 +index ed0b149dca5..8e2294d8ff6 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/lib/cmdline.c @@ -20,6 +20,12 @@ @@ -97,7 +97,7 @@ index ed0b149dca..8e2294d8ff 100644 *buf++ = *c; diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c -index ad80399246..0c6dd9c520 100644 +index dab8fd2aeb0..c19b4bf700e 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0; diff --git a/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch b/0017-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch similarity index 98% rename from 0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch rename to 0017-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch index c452b5f8..56582e58 100644 --- a/0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +++ b/0017-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch @@ -28,10 +28,10 @@ Signed-off-by: Will Thompson create mode 100644 grub-core/commands/loadenv.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c865a08b02..c15e91943b 100644 +index 0bffbfea917..47c0fc755a2 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -814,6 +814,16 @@ module = { +@@ -842,6 +842,16 @@ module = { common = commands/blocklist.c; }; @@ -48,7 +48,7 @@ index c865a08b02..c15e91943b 100644 module = { name = boot; common = commands/boot.c; -@@ -980,6 +990,7 @@ module = { +@@ -1009,6 +1019,7 @@ module = { module = { name = loadenv; common = commands/loadenv.c; @@ -58,7 +58,7 @@ index c865a08b02..c15e91943b 100644 diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c new file mode 100644 -index 0000000000..e907a6a5d2 +index 00000000000..e907a6a5d28 --- /dev/null +++ b/grub-core/commands/blscfg.c @@ -0,0 +1,1177 @@ @@ -1240,7 +1240,7 @@ index 0000000000..e907a6a5d2 + grub_unregister_extcmd (oldcmd); +} diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index cc5971f4db..782761c31a 100644 +index e9e9d94eff5..2c5d1a0ef9a 100644 --- a/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c @@ -143,7 +143,7 @@ legacy_file (const char *filename) @@ -1263,7 +1263,7 @@ index cc5971f4db..782761c31a 100644 } diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c -index 3fd664aac3..163b9a0904 100644 +index 16644584978..dfcb19e0ff8 100644 --- a/grub-core/commands/loadenv.c +++ b/grub-core/commands/loadenv.c @@ -28,6 +28,8 @@ @@ -1358,7 +1358,7 @@ index 3fd664aac3..163b9a0904 100644 grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args) { diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index 720e6d8ea3..b194123eb6 100644 +index 720e6d8ea3b..b194123eb67 100644 --- a/grub-core/commands/menuentry.c +++ b/grub-core/commands/menuentry.c @@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args, @@ -1430,7 +1430,7 @@ index 720e6d8ea3..b194123eb6 100644 src[len - 1] = ch; args[argc - 1] = src; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 62571e6dfc..7ca2e5400b 100644 +index 08f48c71df1..1317279c081 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -21,6 +21,7 @@ @@ -1455,7 +1455,7 @@ index 62571e6dfc..7ca2e5400b 100644 grub_free ((void *) entry->title); diff --git a/grub-core/commands/loadenv.h b/grub-core/commands/loadenv.h new file mode 100644 -index 0000000000..952f46121b +index 00000000000..952f46121bd --- /dev/null +++ b/grub-core/commands/loadenv.h @@ -0,0 +1,93 @@ @@ -1553,7 +1553,7 @@ index 0000000000..952f46121b + return 0; +} diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index 8f3be3ae70..ebafec6895 100644 +index 0c5519387b2..441a9eca07c 100644 --- a/include/grub/compiler.h +++ b/include/grub/compiler.h @@ -56,4 +56,6 @@ @@ -1564,7 +1564,7 @@ index 8f3be3ae70..ebafec6895 100644 + #endif /* ! GRUB_COMPILER_HEADER */ diff --git a/include/grub/menu.h b/include/grub/menu.h -index ee2b5e9104..0acdc2aa6b 100644 +index ee2b5e91045..0acdc2aa6bf 100644 --- a/include/grub/menu.h +++ b/include/grub/menu.h @@ -20,6 +20,16 @@ @@ -1595,7 +1595,7 @@ index ee2b5e9104..0acdc2aa6b 100644 typedef struct grub_menu_entry *grub_menu_entry_t; diff --git a/include/grub/normal.h b/include/grub/normal.h -index 218cbabcca..8839ad85a1 100644 +index 218cbabccaf..8839ad85a19 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes, diff --git a/0022-Add-devicetree-loading.patch b/0018-Add-devicetree-loading.patch similarity index 90% rename from 0022-Add-devicetree-loading.patch rename to 0018-Add-devicetree-loading.patch index 466ddba8..3897a2a6 100644 --- a/0022-Add-devicetree-loading.patch +++ b/0018-Add-devicetree-loading.patch @@ -20,10 +20,10 @@ Signed-off-by: David A. Marlin 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index d3e879b8e5..8ea2315ebc 100644 +index 7516a015be0..7b355115dd4 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -248,7 +248,8 @@ export GRUB_DEFAULT \ +@@ -252,7 +252,8 @@ export GRUB_DEFAULT \ GRUB_ENABLE_CRYPTODISK \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ @@ -34,10 +34,10 @@ index d3e879b8e5..8ea2315ebc 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index e8b01c0d0c..dc75a1c30b 100644 +index cc393be7eda..00d4b220ccb 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -153,6 +153,13 @@ EOF +@@ -155,6 +155,13 @@ EOF sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' initrd $(echo $initrd_path) @@ -51,7 +51,7 @@ index e8b01c0d0c..dc75a1c30b 100644 EOF fi sed "s/^/$submenu_indentation/" << EOF -@@ -236,6 +243,14 @@ while [ "x$list" != "x" ] ; do +@@ -250,6 +257,14 @@ for linux in ${reverse_sorted_list}; do gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 fi diff --git a/0023-Enable-pager-by-default.-985860.patch b/0019-Enable-pager-by-default.-985860.patch similarity index 94% rename from 0023-Enable-pager-by-default.-985860.patch rename to 0019-Enable-pager-by-default.-985860.patch index 63cf787b..8f38cc2b 100644 --- a/0023-Enable-pager-by-default.-985860.patch +++ b/0019-Enable-pager-by-default.-985860.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 93a90233ea..858b526c92 100644 +index 6a316a5ba77..c2d8b093762 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_ diff --git a/0024-Don-t-say-GNU-Linux-in-generated-menus.patch b/0020-Don-t-say-GNU-Linux-in-generated-menus.patch similarity index 91% rename from 0024-Don-t-say-GNU-Linux-in-generated-menus.patch rename to 0020-Don-t-say-GNU-Linux-in-generated-menus.patch index 5b967849..a299f052 100644 --- a/0024-Don-t-say-GNU-Linux-in-generated-menus.patch +++ b/0020-Don-t-say-GNU-Linux-in-generated-menus.patch @@ -13,20 +13,20 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus. 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 7ca2e5400b..98372217ad 100644 +index 1317279c081..568c2adfa16 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -218,7 +218,7 @@ grub_normal_init_page (struct grub_term_output *term, - + grub_term_cls (term); - msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); + msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION); if (!msg_formatted) return; - + diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in -index 8a87109b15..9a4319d4f4 100644 +index 8a87109b152..9a4319d4f4f 100644 --- a/tests/util/grub-shell-tester.in +++ b/tests/util/grub-shell-tester.in @@ -56,7 +56,7 @@ for option in "$@"; do @@ -39,10 +39,10 @@ index 8a87109b15..9a4319d4f4 100644 --modules=*) ms=`echo "$option" | sed -e 's/--modules=//'` diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in -index 93e9f51484..ec1182bf93 100644 +index 496e1bab33c..e0570c88e15 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in -@@ -209,7 +209,7 @@ for option in "$@"; do +@@ -243,7 +243,7 @@ for option in "$@"; do usage exit 0 ;; -v | --version) @@ -50,9 +50,9 @@ index 93e9f51484..ec1182bf93 100644 + echo "$0 (GRUB ${PACKAGE_VERSION})" exit 0 ;; --trim) - trim=1 + trim=1 ;; diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index dc75a1c30b..4a499c53a6 100644 +index 00d4b220ccb..901745707f1 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -68,7 +68,7 @@ index dc75a1c30b..4a499c53a6 100644 fi diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index 3b1f470492..ada20775a1 100644 +index 94dd8be1342..98ee5bc58dc 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch b/0021-Add-.eh_frame-to-list-of-relocations-stripped.patch similarity index 76% rename from 0025-Add-.eh_frame-to-list-of-relocations-stripped.patch rename to 0021-Add-.eh_frame-to-list-of-relocations-stripped.patch index 0532a041..9344171f 100644 --- a/0025-Add-.eh_frame-to-list-of-relocations-stripped.patch +++ b/0021-Add-.eh_frame-to-list-of-relocations-stripped.patch @@ -3,20 +3,21 @@ From: Fedora Ninjas Date: Mon, 13 Jan 2014 21:50:59 -0500 Subject: [PATCH] Add .eh_frame to list of relocations stripped +Signed-off-by: Peter Jones --- conf/Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 2a1a886f6d..191b1a70c6 100644 +index b8f216f6cd3..ece9ed8a1bf 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common -@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding +@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) -STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx +STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx - - CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding - LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d + if !COND_emu + if COND_HAVE_ASM_USCORE + LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free diff --git a/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch b/0022-Don-t-require-a-password-to-boot-entries-generated-b.patch similarity index 96% rename from 0026-Don-t-require-a-password-to-boot-entries-generated-b.patch rename to 0022-Don-t-require-a-password-to-boot-entries-generated-b.patch index 89887c11..b2806860 100644 --- a/0026-Don-t-require-a-password-to-boot-entries-generated-b.patch +++ b/0022-Don-t-require-a-password-to-boot-entries-generated-b.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 4a499c53a6..cf8d118698 100644 +index 901745707f1..9c31a94decb 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -26,7 +26,7 @@ datarootdir="@datarootdir@" diff --git a/0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch b/0023-use-fw_path-prefix-when-fallback-searching-for-grub-.patch similarity index 97% rename from 0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch rename to 0023-use-fw_path-prefix-when-fallback-searching-for-grub-.patch index 1da91e10..40f598dd 100644 --- a/0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +++ b/0023-use-fw_path-prefix-when-fallback-searching-for-grub-.patch @@ -17,7 +17,7 @@ Signed-off-by: Mark Salter 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 98372217ad..bf24e65713 100644 +index 568c2adfa16..0b2bbee19c3 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch b/0024-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch similarity index 99% rename from 0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch rename to 0024-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch index 0d772813..be44d1a5 100644 --- a/0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +++ b/0024-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index bf24e65713..0a99768f75 100644 +index 0b2bbee19c3..4c89892fa70 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), diff --git a/0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch b/0025-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch similarity index 96% rename from 0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch rename to 0025-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch index f22e6f9c..d29c0aff 100644 --- a/0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +++ b/0025-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index cf8d118698..5f6d3c8d52 100644 +index 9c31a94decb..b7809091b36 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" diff --git a/0031-Try-prefix-if-fw_path-doesn-t-work.patch b/0026-Try-prefix-if-fw_path-doesn-t-work.patch similarity index 93% rename from 0031-Try-prefix-if-fw_path-doesn-t-work.patch rename to 0026-Try-prefix-if-fw_path-doesn-t-work.patch index a1c0d9e9..effa3510 100644 --- a/0031-Try-prefix-if-fw_path-doesn-t-work.patch +++ b/0026-Try-prefix-if-fw_path-doesn-t-work.patch @@ -7,38 +7,26 @@ Related: rhbz#1148652 Signed-off-by: Peter Jones --- - grub-core/kern/ieee1275/init.c | 28 +++++---- + grub-core/kern/ieee1275/init.c | 34 ++++++----- grub-core/net/net.c | 2 +- grub-core/normal/main.c | 134 ++++++++++++++++++++--------------------- - 3 files changed, 82 insertions(+), 82 deletions(-) + 3 files changed, 85 insertions(+), 85 deletions(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index e71d158416..0cd2a62723 100644 +index 50c65b2f6e5..51c1e1c9d9f 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -127,23 +127,25 @@ grub_machine_get_bootlocation (char **device, char **path) +@@ -170,23 +170,25 @@ grub_machine_get_bootlocation (char **device, char **path) grub_free (canon); } else - *device = grub_ieee1275_encode_devname (bootpath); -- grub_free (type); -- -- filename = grub_ieee1275_get_filename (bootpath); -- if (filename) - { -- char *lastslash = grub_strrchr (filename, '\\'); -- -- /* Truncate at last directory. */ -- if (lastslash) ++ { + filename = grub_ieee1275_get_filename (bootpath); + if (filename) - { -- *lastslash = '\0'; -- grub_translate_ieee1275_path (filename); ++ { + char *lastslash = grub_strrchr (filename, '\\'); - -- *path = filename; -- } ++ + /* Truncate at last directory. */ + if (lastslash) + { @@ -49,17 +37,32 @@ index e71d158416..0cd2a62723 100644 + } + } + *device = grub_ieee1275_encode_devname (bootpath); - } ++ } + -+ grub_free (type); + grub_free (type); +- +- filename = grub_ieee1275_get_filename (bootpath); +- if (filename) +- { +- char *lastslash = grub_strrchr (filename, '\\'); +- +- /* Truncate at last directory. */ +- if (lastslash) +- { +- *lastslash = '\0'; +- grub_translate_ieee1275_path (filename); +- +- *path = filename; +- } +- } grub_free (bootpath); } diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 4d3eb5c1a5..0ef148f4ad 100644 +index 8cad4fb6d4d..54451cea2a7 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c -@@ -1869,7 +1869,7 @@ grub_net_search_config_file (char *config) +@@ -2005,7 +2005,7 @@ grub_net_search_config_file (char *config) /* Remove the remaining minus sign at the end. */ config[config_len] = '\0'; @@ -69,7 +72,7 @@ index 4d3eb5c1a5..0ef148f4ad 100644 static struct grub_preboot *fini_hnd; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 0a99768f75..55558cc0b9 100644 +index 4c89892fa70..3463f444f74 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config) diff --git a/0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch b/0027-Make-grub2-mkconfig-construct-titles-that-look-like-.patch similarity index 95% rename from 0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch rename to 0027-Make-grub2-mkconfig-construct-titles-that-look-like-.patch index db101c02..1fb624e3 100644 --- a/0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +++ b/0027-Make-grub2-mkconfig-construct-titles-that-look-like-.patch @@ -12,10 +12,10 @@ Signed-off-by: Peter Jones 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 5f6d3c8d52..786dbabb4a 100644 +index b7809091b36..993c53ad92e 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -78,6 +78,32 @@ case x"$GRUB_FS" in +@@ -80,6 +80,32 @@ case x"$GRUB_FS" in ;; esac @@ -48,7 +48,7 @@ index 5f6d3c8d52..786dbabb4a 100644 title_correction_code= linux_entry () -@@ -91,17 +117,11 @@ linux_entry () +@@ -93,17 +119,11 @@ linux_entry () boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi if [ x$type != xsimple ] ; then diff --git a/0033-Add-friendly-grub2-password-config-tool-985962.patch b/0028-Add-friendly-grub2-password-config-tool-985962.patch similarity index 94% rename from 0033-Add-friendly-grub2-password-config-tool-985962.patch rename to 0028-Add-friendly-grub2-password-config-tool-985962.patch index f430e966..2e1ba2cd 100644 --- a/0033-Add-friendly-grub2-password-config-tool-985962.patch +++ b/0028-Add-friendly-grub2-password-config-tool-985962.patch @@ -29,10 +29,10 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub.d/01_users.in diff --git a/configure.ac b/configure.ac -index 8331f95b64..7f59ad788f 100644 +index ae3a49321ad..493e336ec6c 100644 --- a/configure.ac +++ b/configure.ac -@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath]) +@@ -77,6 +77,7 @@ grub_TRANSFORM([grub-mkrelpath]) grub_TRANSFORM([grub-mkrescue]) grub_TRANSFORM([grub-probe]) grub_TRANSFORM([grub-reboot]) @@ -41,10 +41,10 @@ index 8331f95b64..7f59ad788f 100644 grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-sparc64-setup]) diff --git a/Makefile.util.def b/Makefile.util.def -index 2c9b283a23..4ee22c5daa 100644 +index 09bfcadd976..95884956a68 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -452,6 +452,12 @@ script = { +@@ -455,6 +455,12 @@ script = { installdir = grubconf; }; @@ -57,7 +57,7 @@ index 2c9b283a23..4ee22c5daa 100644 script = { name = '10_windows'; common = util/grub.d/10_windows.in; -@@ -724,6 +730,13 @@ script = { +@@ -733,6 +739,13 @@ script = { installdir = sbin; }; @@ -73,17 +73,17 @@ index 2c9b283a23..4ee22c5daa 100644 common = util/grub-mkconfig_lib.in; diff --git a/docs/man/grub-set-password.h2m b/docs/man/grub-set-password.h2m new file mode 100644 -index 0000000000..10ee82f4d5 +index 00000000000..10ee82f4d52 --- /dev/null +++ b/docs/man/grub-set-password.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-set-password \- generate the user.cfg file containing the hashed grub bootloader password diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 8ea2315ebc..ba14cf6261 100644 +index 7b355115dd4..5f2824d4f58 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -276,6 +276,8 @@ for i in "${grub_mkconfig_dir}"/* ; do +@@ -280,6 +280,8 @@ for i in "${grub_mkconfig_dir}"/* ; do *~) ;; # emacsen autosave files. FIXME: support other editors */\#*\#) ;; @@ -94,7 +94,7 @@ index 8ea2315ebc..ba14cf6261 100644 echo diff --git a/util/grub-set-password.in b/util/grub-set-password.in new file mode 100644 -index 0000000000..5ebf50576d +index 00000000000..5ebf50576d6 --- /dev/null +++ b/util/grub-set-password.in @@ -0,0 +1,128 @@ @@ -228,7 +228,7 @@ index 0000000000..5ebf50576d +fi diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in new file mode 100644 -index 0000000000..db2f44bfb7 +index 00000000000..db2f44bfb78 --- /dev/null +++ b/util/grub.d/01_users.in @@ -0,0 +1,11 @@ diff --git a/0034-tcp-add-window-scaling-support.patch b/0029-tcp-add-window-scaling-support.patch similarity index 95% rename from 0034-tcp-add-window-scaling-support.patch rename to 0029-tcp-add-window-scaling-support.patch index 61b5a679..ef3a81ee 100644 --- a/0034-tcp-add-window-scaling-support.patch +++ b/0029-tcp-add-window-scaling-support.patch @@ -17,7 +17,7 @@ Signed-off-by: Josef Bacik 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c -index e8ad34b84d..7d4b822626 100644 +index 93dee0caa1b..902ab7e8ae6 100644 --- a/grub-core/net/tcp.c +++ b/grub-core/net/tcp.c @@ -106,6 +106,18 @@ struct tcphdr @@ -39,7 +39,7 @@ index e8ad34b84d..7d4b822626 100644 struct tcp_pseudohdr { grub_uint32_t src; -@@ -566,7 +578,7 @@ grub_net_tcp_open (char *server, +@@ -571,7 +583,7 @@ grub_net_tcp_open (char *server, grub_net_tcp_socket_t socket; static grub_uint16_t in_port = 21550; struct grub_net_buff *nb; @@ -48,7 +48,7 @@ index e8ad34b84d..7d4b822626 100644 int i; grub_uint8_t *nbd; grub_net_link_level_address_t ll_target_addr; -@@ -635,20 +647,24 @@ grub_net_tcp_open (char *server, +@@ -640,20 +652,24 @@ grub_net_tcp_open (char *server, } tcph = (void *) nb->data; diff --git a/0035-efinet-and-bootp-add-support-for-dhcpv6.patch b/0030-efinet-and-bootp-add-support-for-dhcpv6.patch similarity index 84% rename from 0035-efinet-and-bootp-add-support-for-dhcpv6.patch rename to 0030-efinet-and-bootp-add-support-for-dhcpv6.patch index efeeee0a..19a63c5b 100644 --- a/0035-efinet-and-bootp-add-support-for-dhcpv6.patch +++ b/0030-efinet-and-bootp-add-support-for-dhcpv6.patch @@ -6,18 +6,18 @@ Subject: [PATCH] efinet and bootp: add support for dhcpv6 Signed-off-by: Peter Jones --- grub-core/net/bootp.c | 173 +++++++++++++++++++++++++++++++++++++ - grub-core/net/drivers/efi/efinet.c | 53 ++++++++++-- + grub-core/net/drivers/efi/efinet.c | 84 +++++++++++++----- grub-core/net/net.c | 72 +++++++++++++++ - grub-core/net/tftp.c | 4 + + grub-core/net/tftp.c | 3 + include/grub/efi/api.h | 129 +++++++++++++++++++++++++-- include/grub/net.h | 60 +++++++++++++ - 6 files changed, 477 insertions(+), 14 deletions(-) + 6 files changed, 491 insertions(+), 30 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 6fb5627025..e28fb6a09f 100644 +index abe45ef7bf6..02d2c2614cb 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c -@@ -902,6 +902,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), +@@ -905,6 +905,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp; @@ -198,7 +198,7 @@ index 6fb5627025..e28fb6a09f 100644 grub_bootp_init (void) { diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 5388f952ba..173fb63153 100644 +index 3ea25cf9894..2af8742f904 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -18,11 +18,14 @@ @@ -216,16 +216,16 @@ index 5388f952ba..173fb63153 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -329,7 +332,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -346,7 +349,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, char **path) { struct grub_net_card *card; - grub_efi_device_path_t *dp; + grub_efi_device_path_t *dp, *ldp = NULL; - - dp = grub_efi_get_device_path (hnd); - if (! dp) -@@ -340,14 +343,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + struct grub_net_network_level_interface *inter; + grub_efi_device_path_t *vlan_dp; + grub_efi_uint16_t vlan_dp_len; +@@ -361,14 +364,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, grub_efi_device_path_t *cdp; struct grub_efi_pxe *pxe; struct grub_efi_pxe_mode *pxe_mode; @@ -246,7 +246,7 @@ index 5388f952ba..173fb63153 100644 int match; /* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6 -@@ -356,7 +364,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -377,7 +385,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, devices. We skip them when enumerating cards, so here we need to find matching MAC device. */ @@ -254,7 +254,7 @@ index 5388f952ba..173fb63153 100644 if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) -@@ -373,16 +380,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -394,41 +401,70 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, if (!match) continue; } @@ -265,11 +265,6 @@ index 5388f952ba..173fb63153 100644 continue; + pxe_mode = pxe->mode; -- grub_net_configure_by_dhcp_ack (card->name, card, 0, -- (struct grub_net_bootp_packet *) -- &pxe_mode->dhcp_ack, -- sizeof (pxe_mode->dhcp_ack), -- 1, device, path); + if (pxe_mode->using_ipv6) + { + grub_net_link_level_address_t hwaddr; @@ -281,41 +276,86 @@ index 5388f952ba..173fb63153 100644 + pxe_mode->dhcp_ack_received ? "" : " cannot continue"); + if (!pxe_mode->dhcp_ack_received) + continue; -+ + +- inter = grub_net_configure_by_dhcp_ack (card->name, card, 0, +- (struct grub_net_bootp_packet *) +- &pxe_mode->dhcp_ack, +- sizeof (pxe_mode->dhcp_ack), +- 1, device, path); + hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; + grub_memcpy (hwaddr.mac, + card->efi_net->mode->current_address, + sizeof (hwaddr.mac)); -+ -+ intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr, + +- if (inter != NULL) ++ inter = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr, + (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6, + 1, device, path); -+ if (intf && device && path) ++ if (inter && device && path) + grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); + } + else -+ { + { +- /* +- * Search the device path for any VLAN subtype and use it +- * to configure the interface. +- */ +- vlan_dp = dp; + grub_dprintf ("efinet", "using ipv4 and dhcp\n"); -+ grub_net_configure_by_dhcp_ack (card->name, card, 0, -+ (struct grub_net_bootp_packet *) -+ &pxe_mode->dhcp_ack, -+ sizeof (pxe_mode->dhcp_ack), -+ 1, device, path); ++ inter = grub_net_configure_by_dhcp_ack (card->name, card, 0, ++ (struct grub_net_bootp_packet *) ++ &pxe_mode->dhcp_ack, ++ sizeof (pxe_mode->dhcp_ack), ++ 1, device, path); + +- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp)) + grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); -+ } - return; ++ if (inter != NULL) + { +- if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE && +- GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE) ++ /* ++ * Search the device path for any VLAN subtype and use it ++ * to configure the interface. ++ */ ++ vlan_dp = dp; ++ ++ while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp)) + { +- vlan = (grub_efi_vlan_device_path_t *) vlan_dp; +- inter->vlantag = vlan->vlan_id; +- break; ++ if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE && ++ GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE) ++ { ++ vlan = (grub_efi_vlan_device_path_t *) vlan_dp; ++ inter->vlantag = vlan->vlan_id; ++ break; ++ } ++ ++ vlan_dp_len = GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp); ++ vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len); + } +- +- vlan_dp_len = GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp); +- vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len); + } ++ return; + } +- return; } } + diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0ef148f4ad..22f2689aae 100644 +index 54451cea2a7..20c55257647 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c -@@ -960,6 +960,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa +@@ -984,6 +984,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa grub_net_network_level_interfaces = inter; } +int -+grub_ipv6_get_masksize (grub_uint16_t be_mask[8]) ++grub_ipv6_get_masksize (grub_uint16_t *be_mask) +{ + grub_uint8_t *mask; + grub_uint16_t mask16[8]; @@ -390,10 +430,10 @@ index 0ef148f4ad..22f2689aae 100644 grub_err_t grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter, diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 7f44b30f52..4ab2f5c735 100644 +index 409b1d09bcd..f300a9d4007 100644 --- a/grub-core/net/tftp.c +++ b/grub-core/net/tftp.c -@@ -358,18 +358,22 @@ tftp_open (struct grub_file *file, const char *filename) +@@ -359,6 +359,7 @@ tftp_open (struct grub_file *file, const char *filename) file->not_easily_seekable = 1; file->data = data; @@ -401,14 +441,13 @@ index 7f44b30f52..4ab2f5c735 100644 err = grub_net_resolve_address (file->device->net->server, &addr); if (err) { -+ grub_dprintf("tftp", "Address resolution failed: %d\n", err); - grub_free (data); +@@ -369,11 +370,13 @@ tftp_open (struct grub_file *file, const char *filename) return err; } + grub_dprintf("tftp", "opening connection\n"); data->sock = grub_net_udp_open (addr, - TFTP_SERVER_PORT, tftp_receive, + port ? port : TFTP_SERVER_PORT, tftp_receive, file); if (!data->sock) { @@ -417,10 +456,10 @@ index 7f44b30f52..4ab2f5c735 100644 return grub_errno; } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index f1a52210c0..117469450d 100644 +index d44d00ad7d5..c6d702831f7 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -592,10 +592,16 @@ typedef void *grub_efi_handle_t; +@@ -637,10 +637,16 @@ typedef void *grub_efi_handle_t; typedef void *grub_efi_event_t; typedef grub_efi_uint64_t grub_efi_lba_t; typedef grub_efi_uintn_t grub_efi_tpl_t; @@ -441,7 +480,7 @@ index f1a52210c0..117469450d 100644 typedef grub_efi_uint64_t grub_efi_physical_address_t; typedef grub_efi_uint64_t grub_efi_virtual_address_t; -@@ -1474,16 +1480,127 @@ struct grub_efi_simple_text_output_interface +@@ -1521,16 +1527,127 @@ struct grub_efi_simple_text_output_interface }; typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t; @@ -572,10 +611,10 @@ index f1a52210c0..117469450d 100644 typedef struct grub_efi_pxe diff --git a/include/grub/net.h b/include/grub/net.h -index 7ae4b6bd80..8a05ec4fe7 100644 +index 844e501c128..bf8430a6364 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -447,6 +447,51 @@ struct grub_net_bootp_packet +@@ -450,6 +450,51 @@ struct grub_net_bootp_packet grub_uint8_t vendor[0]; } GRUB_PACKED; @@ -627,7 +666,7 @@ index 7ae4b6bd80..8a05ec4fe7 100644 #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 #define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82 #define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53 -@@ -482,6 +527,21 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -485,6 +530,21 @@ grub_net_configure_by_dhcp_ack (const char *name, grub_size_t size, int is_def, char **device, char **path); diff --git a/0072-bootp-New-net_bootp6-command.patch b/0031-bootp-New-net_bootp6-command.patch similarity index 96% rename from 0072-bootp-New-net_bootp6-command.patch rename to 0031-bootp-New-net_bootp6-command.patch index bef3acdc..91e58f29 100644 --- a/0072-bootp-New-net_bootp6-command.patch +++ b/0031-bootp-New-net_bootp6-command.patch @@ -12,14 +12,14 @@ Signed-off-by: Ken Lin Signed-off-by: Peter Jones --- grub-core/net/bootp.c | 1059 ++++++++++++++++++++++++++++++------ - grub-core/net/drivers/efi/efinet.c | 20 +- + grub-core/net/drivers/efi/efinet.c | 18 +- grub-core/net/ip.c | 39 ++ include/grub/efi/api.h | 2 +- include/grub/net.h | 91 ++-- - 5 files changed, 1002 insertions(+), 209 deletions(-) + 5 files changed, 1001 insertions(+), 208 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 08b6b2b5d6..fe93b80f1c 100644 +index 02d2c2614cb..e0aec25233d 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -24,6 +24,98 @@ @@ -121,7 +121,7 @@ index 08b6b2b5d6..fe93b80f1c 100644 struct grub_dhcp_discover_options { -@@ -604,6 +696,584 @@ out: +@@ -610,6 +702,584 @@ out: return err; } @@ -427,7 +427,7 @@ index 08b6b2b5d6..fe93b80f1c 100644 + grub_dhcp6_session_t se; + struct grub_datetime date; + grub_err_t err; -+ grub_int32_t t = 0; ++ grub_int64_t t = 0; + + se = grub_malloc (sizeof (*se)); + @@ -706,7 +706,7 @@ index 08b6b2b5d6..fe93b80f1c 100644 /* * This is called directly from net/ip.c:handle_dgram(), because those * BOOTP/DHCP packets are a bit special due to their improper -@@ -672,6 +1342,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb, +@@ -678,6 +1348,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb, } } @@ -784,7 +784,7 @@ index 08b6b2b5d6..fe93b80f1c 100644 static grub_err_t grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), int argc, char **args) -@@ -897,180 +1638,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), +@@ -903,180 +1644,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), return err; } @@ -1119,7 +1119,7 @@ index 08b6b2b5d6..fe93b80f1c 100644 void grub_bootp_init (void) -@@ -1084,11 +1819,15 @@ grub_bootp_init (void) +@@ -1090,11 +1825,15 @@ grub_bootp_init (void) cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt, N_("VAR INTERFACE NUMBER DESCRIPTION"), N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value.")); @@ -1136,10 +1136,10 @@ index 08b6b2b5d6..fe93b80f1c 100644 grub_unregister_command (cmd_bootp); grub_unregister_command (cmd_dhcp); diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index a673bea807..8e25680db0 100644 +index 2af8742f904..3e2432fb61c 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -393,9 +393,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -410,9 +410,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, pxe_mode = pxe->mode; if (pxe_mode->using_ipv6) { @@ -1149,7 +1149,7 @@ index a673bea807..8e25680db0 100644 grub_dprintf ("efinet", "using ipv6 and dhcpv6\n"); grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n", pxe_mode->dhcp_ack_received ? "yes" : "no", -@@ -403,15 +400,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -420,14 +417,13 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, if (!pxe_mode->dhcp_ack_received) continue; @@ -1158,26 +1158,24 @@ index a673bea807..8e25680db0 100644 - card->efi_net->mode->current_address, - sizeof (hwaddr.mac)); - -- intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr, +- inter = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr, - (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6, - 1, device, path); -- if (intf && device && path) -+ grub_net_configure_by_dhcpv6_reply (card->name, card, 0, -+ (struct grub_net_dhcp6_packet *) -+ &pxe_mode->dhcp_ack, -+ sizeof (pxe_mode->dhcp_ack), -+ 1, device, path); ++ inter = grub_net_configure_by_dhcpv6_reply (card->name, card, 0, ++ (struct grub_net_dhcp6_packet *) ++ &pxe_mode->dhcp_ack, ++ sizeof (pxe_mode->dhcp_ack), ++ 1, device, path); + if (grub_errno) + grub_print_error (); -+ if (device && path) + if (inter && device && path) grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); } - else diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index a5896f6dc2..ce6bdc75c6 100644 +index 3c3d0be0e57..f967618e53f 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c -@@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb, +@@ -240,6 +240,45 @@ handle_dgram (struct grub_net_buff *nb, { struct udphdr *udph; udph = (struct udphdr *) nb->data; @@ -1224,10 +1222,10 @@ index a5896f6dc2..ce6bdc75c6 100644 { const struct grub_net_bootp_packet *bootp; diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 9962880147..7614b58dca 100644 +index c6d702831f7..c1b869db520 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -1532,7 +1532,7 @@ typedef struct grub_efi_pxe_ip_filter +@@ -1570,7 +1570,7 @@ typedef struct grub_efi_pxe_ip_filter { grub_efi_uint8_t filters; grub_efi_uint8_t ip_count; @@ -1237,10 +1235,10 @@ index 9962880147..7614b58dca 100644 } grub_efi_pxe_ip_filter_t; diff --git a/include/grub/net.h b/include/grub/net.h -index d55d505a03..543251f727 100644 +index bf8430a6364..ff901b96e22 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -451,50 +451,65 @@ struct grub_net_bootp_packet +@@ -450,50 +450,65 @@ struct grub_net_bootp_packet grub_uint8_t vendor[0]; } GRUB_PACKED; @@ -1336,7 +1334,7 @@ index d55d505a03..543251f727 100644 #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 #define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82 -@@ -532,12 +547,12 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -531,12 +546,12 @@ grub_net_configure_by_dhcp_ack (const char *name, int is_def, char **device, char **path); struct grub_net_network_level_interface * @@ -1355,7 +1353,7 @@ index d55d505a03..543251f727 100644 int grub_ipv6_get_masksize(grub_uint16_t *mask); -@@ -554,6 +569,10 @@ void +@@ -553,6 +568,10 @@ void grub_net_process_dhcp (struct grub_net_buff *nb, struct grub_net_network_level_interface *iface); diff --git a/0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch b/0032-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch similarity index 92% rename from 0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch rename to 0032-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch index 95490cd0..8890e10d 100644 --- a/0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +++ b/0032-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch @@ -24,10 +24,10 @@ Resolves: rhbz#1226325 create mode 100644 util/grub-get-kernel-settings.in diff --git a/configure.ac b/configure.ac -index 7f59ad788f..0d0e6782a1 100644 +index 493e336ec6c..3602b4ab62b 100644 --- a/configure.ac +++ b/configure.ac -@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install]) +@@ -70,6 +70,7 @@ grub_TRANSFORM([grub-install]) grub_TRANSFORM([grub-mkconfig]) grub_TRANSFORM([grub-mkfont]) grub_TRANSFORM([grub-mkimage]) @@ -36,10 +36,10 @@ index 7f59ad788f..0d0e6782a1 100644 grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) diff --git a/Makefile.util.def b/Makefile.util.def -index 4ee22c5daa..18a9242776 100644 +index 95884956a68..84a17ef5cfa 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -716,6 +716,13 @@ script = { +@@ -725,6 +725,13 @@ script = { installdir = sbin; }; @@ -55,17 +55,17 @@ index 4ee22c5daa..18a9242776 100644 common = util/grub-set-default.in; diff --git a/docs/man/grub-get-kernel-settings.h2m b/docs/man/grub-get-kernel-settings.h2m new file mode 100644 -index 0000000000..b8051f01f3 +index 00000000000..b8051f01f3a --- /dev/null +++ b/docs/man/grub-get-kernel-settings.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-get-kernel-settings \- Evaluate the system's kernel installation settings for use while making a grub configuration file diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in -index 44bf135b9f..5c4acd496d 100644 +index 213ce1e57cf..da7fca5efac 100644 --- a/util/bash-completion.d/grub-completion.bash.in +++ b/util/bash-completion.d/grub-completion.bash.in -@@ -264,6 +264,28 @@ have ${__grub_sparc64_setup_program} && \ +@@ -275,6 +275,28 @@ have ${__grub_sparc64_setup_program} && \ unset __grub_sparc64_setup_program @@ -96,7 +96,7 @@ index 44bf135b9f..5c4acd496d 100644 # diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in new file mode 100644 -index 0000000000..7e87dfccc0 +index 00000000000..7e87dfccc0e --- /dev/null +++ b/util/grub-get-kernel-settings.in @@ -0,0 +1,88 @@ @@ -189,7 +189,7 @@ index 0000000000..7e87dfccc0 + echo export GRUB_UPDATE_DEFAULT_KERNEL +fi diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index ba14cf6261..005f093809 100644 +index 5f2824d4f58..28e92515795 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@" @@ -210,10 +210,10 @@ index ba14cf6261..005f093809 100644 if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then GRUB_DISABLE_LINUX_UUID="true" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 786dbabb4a..292e333324 100644 +index 993c53ad92e..e8ab4082f87 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -111,7 +111,8 @@ linux_entry () +@@ -113,7 +113,8 @@ linux_entry () os="$1" version="$2" type="$3" @@ -223,7 +223,7 @@ index 786dbabb4a..292e333324 100644 if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" -@@ -123,6 +124,9 @@ linux_entry () +@@ -125,6 +126,9 @@ linux_entry () quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" fi @@ -233,7 +233,7 @@ index 786dbabb4a..292e333324 100644 echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" else echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -@@ -306,11 +310,15 @@ while [ "x$list" != "x" ] ; do +@@ -320,11 +324,15 @@ for linux in ${reverse_sorted_list}; do fi if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then @@ -251,7 +251,7 @@ index 786dbabb4a..292e333324 100644 if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi -@@ -319,10 +327,15 @@ while [ "x$list" != "x" ] ; do +@@ -333,10 +341,15 @@ for linux in ${reverse_sorted_list}; do is_top_level=false fi @@ -266,6 +266,6 @@ index 786dbabb4a..292e333324 100644 if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then - linux_entry "${OS}" "${version}" recovery \ + linux_entry "${OS}" "${version}" recovery standard \ - "single ${GRUB_CMDLINE_LINUX}" + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" fi - + done diff --git a/0038-Make-grub_fatal-also-backtrace.patch b/0033-Make-grub_fatal-also-backtrace.patch similarity index 89% rename from 0038-Make-grub_fatal-also-backtrace.patch rename to 0033-Make-grub_fatal-also-backtrace.patch index f876575f..1cfe7639 100644 --- a/0038-Make-grub_fatal-also-backtrace.patch +++ b/0033-Make-grub_fatal-also-backtrace.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Make grub_fatal() also backtrace. --- grub-core/Makefile.core.def | 3 ++ - grub-core/kern/misc.c | 8 +++++- + grub-core/kern/misc.c | 6 ++++ grub-core/lib/arm64/backtrace.c | 62 +++++++++++++++++++++++++++++++++++++++++ grub-core/lib/backtrace.c | 2 ++ grub-core/lib/i386/backtrace.c | 14 +++++++++- - 5 files changed, 87 insertions(+), 2 deletions(-) + 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 grub-core/lib/arm64/backtrace.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index c15e91943b..058c88ac3a 100644 +index 47c0fc755a2..63f053b3add 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -188,6 +188,9 @@ kernel = { +@@ -199,6 +199,9 @@ kernel = { softdiv = lib/division.c; @@ -27,19 +27,19 @@ index c15e91943b..058c88ac3a 100644 i386_xen = kern/i386/dl.c; i386_xen_pvh = kern/i386/dl.c; diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 63b586d09c..a3e215155b 100644 +index 11037dc0227..465a8e74ea7 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -24,6 +24,7 @@ - #include - #include +@@ -26,6 +26,7 @@ #include + #include + #include +#include union printf_arg { -@@ -1199,8 +1200,13 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) - static void __attribute__ ((noreturn)) +@@ -1301,6 +1302,11 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) + void __attribute__ ((noreturn)) grub_abort (void) { +#ifndef GRUB_UTIL @@ -48,14 +48,11 @@ index 63b586d09c..a3e215155b 100644 +#endif +#endif grub_printf ("\nAborted."); -- -+ + #ifndef GRUB_UTIL - if (grub_term_inputs) - #endif diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c new file mode 100644 -index 0000000000..1079b5380e +index 00000000000..1079b5380e1 --- /dev/null +++ b/grub-core/lib/arm64/backtrace.c @@ -0,0 +1,62 @@ @@ -122,7 +119,7 @@ index 0000000000..1079b5380e +} + diff --git a/grub-core/lib/backtrace.c b/grub-core/lib/backtrace.c -index 825a8800e2..c0ad6ab8be 100644 +index 825a8800e25..c0ad6ab8be1 100644 --- a/grub-core/lib/backtrace.c +++ b/grub-core/lib/backtrace.c @@ -29,6 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -142,7 +139,7 @@ index 825a8800e2..c0ad6ab8be 100644 } diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c -index c3e03c7275..c67273db3a 100644 +index c3e03c7275c..c67273db3ae 100644 --- a/grub-core/lib/i386/backtrace.c +++ b/grub-core/lib/i386/backtrace.c @@ -15,11 +15,23 @@ diff --git a/0039-Make-our-info-pages-say-grub2-where-appropriate.patch b/0034-Make-our-info-pages-say-grub2-where-appropriate.patch similarity index 80% rename from 0039-Make-our-info-pages-say-grub2-where-appropriate.patch rename to 0034-Make-our-info-pages-say-grub2-where-appropriate.patch index afba285d..992bb439 100644 --- a/0039-Make-our-info-pages-say-grub2-where-appropriate.patch +++ b/0034-Make-our-info-pages-say-grub2-where-appropriate.patch @@ -9,11 +9,11 @@ time. Signed-off-by: Peter Jones --- docs/grub-dev.texi | 4 +- - docs/grub.texi | 321 ++++++++++++++++++++++++++++------------------------- - 2 files changed, 171 insertions(+), 154 deletions(-) + docs/grub.texi | 357 ++++++++++++++++++++++++++++------------------------- + 2 files changed, 189 insertions(+), 172 deletions(-) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 6c629a23e2..19f708ee66 100644 +index 1276c59302a..04c6678cb6b 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1,7 +1,7 @@ @@ -35,7 +35,7 @@ index 6c629a23e2..19f708ee66 100644 @setchapternewpage odd diff --git a/docs/grub.texi b/docs/grub.texi -index 69f08d289f..0615d0ed97 100644 +index 974bc0ddb07..c30701b4e1f 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1,7 +1,7 @@ @@ -72,31 +72,7 @@ index 69f08d289f..0615d0ed97 100644 @end direntry @setchapternewpage odd -@@ -103,15 +103,15 @@ This edition documents version @value{VERSION}. - * Platform-specific operations:: Platform-specific operations - * Supported kernels:: The list of supported kernels - * Troubleshooting:: Error messages produced by GRUB --* Invoking grub-install:: How to use the GRUB installer --* Invoking grub-mkconfig:: Generate a GRUB configuration file --* Invoking grub-mkpasswd-pbkdf2:: -+* Invoking grub2-install:: How to use the GRUB installer -+* Invoking grub2-mkconfig:: Generate a GRUB configuration file -+* Invoking grub2-mkpasswd-pbkdf2:: - Generate GRUB password hashes --* Invoking grub-mkrelpath:: Make system path relative to its root --* Invoking grub-mkrescue:: Make a GRUB rescue image --* Invoking grub-mount:: Mount a file system using GRUB --* Invoking grub-probe:: Probe device information for GRUB --* Invoking grub-script-check:: Check GRUB script file for syntax errors -+* Invoking grub2-mkrelpath:: Make system path relative to its root -+* Invoking grub2-mkrescue:: Make a GRUB rescue image -+* Invoking grub2-mount:: Mount a file system using GRUB -+* Invoking grub2-probe:: Probe device information for GRUB -+* Invoking grub2-script-check:: Check GRUB script file for syntax errors - * Obtaining and Building GRUB:: How to obtain and build GRUB - * Reporting bugs:: Where you should send a bug report - * Future:: Some future plans on GRUB -@@ -230,7 +230,7 @@ surprising. +@@ -223,7 +223,7 @@ surprising. @item @file{grub.cfg} is typically automatically generated by @@ -105,7 +81,7 @@ index 69f08d289f..0615d0ed97 100644 easier to handle versioned kernel upgrades. @item -@@ -244,7 +244,7 @@ scripting language: variables, conditionals, and loops are available. +@@ -237,7 +237,7 @@ scripting language: variables, conditionals, and loops are available. @item A small amount of persistent storage is available across reboots, using the @command{save_env} and @command{load_env} commands in GRUB and the @@ -114,7 +90,7 @@ index 69f08d289f..0615d0ed97 100644 (@pxref{Environment block}). @item -@@ -549,7 +549,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the +@@ -542,7 +542,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the OS name. E.g. for GNU/Linux: @example @@ -123,7 +99,7 @@ index 69f08d289f..0615d0ed97 100644 @end example On AROS we use another syntax. For volumes: -@@ -572,7 +572,7 @@ For disks we use syntax: +@@ -565,7 +565,7 @@ For disks we use syntax: E.g. @example @@ -132,7 +108,7 @@ index 69f08d289f..0615d0ed97 100644 @end example On Windows we use UNC path. For volumes it's typically -@@ -599,7 +599,7 @@ For disks it's +@@ -592,7 +592,7 @@ For disks it's E.g. @example @@ -141,7 +117,7 @@ index 69f08d289f..0615d0ed97 100644 @end example Beware that you may need to further escape the backslashes depending on your -@@ -609,7 +609,7 @@ When compiled with cygwin support then cygwin drive names are automatically +@@ -602,7 +602,7 @@ When compiled with cygwin support then cygwin drive names are automatically when needed. E.g. @example @@ -150,7 +126,7 @@ index 69f08d289f..0615d0ed97 100644 @end example @node Installation -@@ -622,7 +622,7 @@ from the source tarball, or as a package for your OS. +@@ -615,7 +615,7 @@ from the source tarball, or as a package for your OS. After you have done that, you need to install the boot loader on a drive (floppy or hard disk) by using the utility @@ -159,7 +135,7 @@ index 69f08d289f..0615d0ed97 100644 GRUB comes with boot images, which are normally put in the directory @file{/usr/lib/grub/-} (for BIOS-based machines -@@ -633,22 +633,22 @@ loader needs to find them (usually @file{/boot}) will be called +@@ -626,22 +626,22 @@ loader needs to find them (usually @file{/boot}) will be called the @dfn{boot directory}. @menu @@ -187,7 +163,7 @@ index 69f08d289f..0615d0ed97 100644 The usage is basically very simple. You only need to specify one argument to the program, namely, where to install the boot loader. The -@@ -657,13 +657,13 @@ For example, under Linux the following will install GRUB into the MBR +@@ -650,13 +650,13 @@ For example, under Linux the following will install GRUB into the MBR of the first IDE disk: @example @@ -203,7 +179,7 @@ index 69f08d289f..0615d0ed97 100644 @end example But all the above examples assume that GRUB should put images under -@@ -677,7 +677,7 @@ boot floppy with a filesystem. Here is an example: +@@ -670,7 +670,7 @@ boot floppy with a filesystem. Here is an example: # @kbd{mke2fs /dev/fd0} # @kbd{mount -t ext2 /dev/fd0 /mnt} # @kbd{mkdir /mnt/boot} @@ -212,7 +188,7 @@ index 69f08d289f..0615d0ed97 100644 # @kbd{umount /mnt} @end group @end example -@@ -689,30 +689,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it +@@ -682,30 +682,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it @example # @kbd{losetup /dev/loop0 /dev/sdb1} # @kbd{mount /dev/loop0 /mnt/usb} @@ -254,7 +230,7 @@ index 69f08d289f..0615d0ed97 100644 @end example @node Making a GRUB bootable CD-ROM -@@ -732,10 +739,10 @@ usually also need to include a configuration file @file{grub.cfg} and some +@@ -725,10 +732,10 @@ usually also need to include a configuration file @file{grub.cfg} and some other GRUB modules. To make a simple generic GRUB rescue CD, you can use the @@ -267,7 +243,7 @@ index 69f08d289f..0615d0ed97 100644 @end example You will often need to include other files in your image. To do this, first -@@ -758,7 +765,7 @@ directory @file{iso/}. +@@ -751,7 +758,7 @@ directory @file{iso/}. Finally, make the image: @example @@ -276,7 +252,7 @@ index 69f08d289f..0615d0ed97 100644 @end example This produces a file named @file{grub.iso}, which then can be burned -@@ -774,7 +781,7 @@ storage devices. +@@ -767,7 +774,7 @@ storage devices. @node Device map @section The map between BIOS drives and OS devices @@ -285,7 +261,7 @@ index 69f08d289f..0615d0ed97 100644 etc.) read it to map BIOS drives to OS devices. This file consists of lines like this: -@@ -1254,23 +1261,23 @@ need to write the whole thing by hand. +@@ -1269,23 +1276,23 @@ need to write the whole thing by hand. @node Simple configuration @section Simple configuration handling @@ -314,7 +290,7 @@ index 69f08d289f..0615d0ed97 100644 valid POSIX shell input; normally, it will just be a sequence of @samp{KEY=value} lines, but if the value contains spaces or other special characters then it must be quoted. For example: -@@ -1308,7 +1315,7 @@ works it's not recommended since titles often contain unstable device names +@@ -1323,7 +1330,7 @@ works it's not recommended since titles often contain unstable device names and may be translated If you set this to @samp{saved}, then the default menu entry will be that @@ -323,7 +299,7 @@ index 69f08d289f..0615d0ed97 100644 the environment block, which may not be available in all situations (@pxref{Environment block}). -@@ -1319,7 +1326,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save +@@ -1334,7 +1341,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save it as a new default entry for use by future runs of GRUB. This is only useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because @samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with @@ -332,7 +308,7 @@ index 69f08d289f..0615d0ed97 100644 This option relies on the environment block, which may not be available in all situations (@pxref{Environment block}). -@@ -1449,7 +1456,7 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode +@@ -1481,15 +1488,15 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode @end example @item GRUB_DISABLE_LINUX_UUID @@ -341,7 +317,17 @@ index 69f08d289f..0615d0ed97 100644 universally-unique identifiers (UUIDs) to identify the root filesystem to the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is usually more reliable, but in some cases it may not be appropriate. To -@@ -1471,7 +1478,7 @@ If this option is set to @samp{true}, disable the generation of recovery + disable the use of UUIDs, set this option to @samp{true}. + + @item GRUB_DISABLE_LINUX_PARTUUID +-If @command{grub-mkconfig} cannot identify the root filesystem via its +-universally-unique indentifier (UUID), @command{grub-mkconfig} can use the UUID ++If @command{grub2-mkconfig} cannot identify the root filesystem via its ++universally-unique indentifier (UUID), @command{grub2-mkconfig} can use the UUID + of the partition containing the filesystem to identify the root filesystem to + the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not + as reliable as using the filesystem UUID, but is more reliable than using the +@@ -1503,7 +1510,7 @@ If this option is set to @samp{true}, disable the generation of recovery mode menu entries. @item GRUB_DISABLE_UUID @@ -350,7 +336,7 @@ index 69f08d289f..0615d0ed97 100644 universally-unique identifiers (UUIDs) to identify various filesystems to search for files. This is usually more reliable, but in some cases it may not be appropriate. To disable this use of UUIDs, set this option to -@@ -1482,12 +1489,12 @@ not be appropriate. To disable this use of UUIDs, set this option to +@@ -1514,12 +1521,12 @@ not be appropriate. To disable this use of UUIDs, set this option to @item GRUB_VIDEO_BACKEND If graphical video support is required, either because the @samp{gfxterm} graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set, @@ -366,7 +352,7 @@ index 69f08d289f..0615d0ed97 100644 @item GRUB_GFXMODE Set the resolution used on the @samp{gfxterm} graphical terminal. Note that -@@ -1519,7 +1526,7 @@ boot sequence. If you have problems, set this option to @samp{text} and +@@ -1552,7 +1559,7 @@ boot sequence. If you have problems, set this option to @samp{text} and GRUB will tell Linux to boot in normal text mode. @item GRUB_DISABLE_OS_PROBER @@ -375,7 +361,7 @@ index 69f08d289f..0615d0ed97 100644 @command{os-prober} program, if installed, to discover other operating systems installed on the same system and generate appropriate menu entries for them. Set this option to @samp{true} to disable this. -@@ -1529,7 +1536,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober +@@ -1562,7 +1569,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober output. For efi chainloaders it's @@ @item GRUB_DISABLE_SUBMENU @@ -384,7 +370,7 @@ index 69f08d289f..0615d0ed97 100644 the kernel with highest version number and put all other found kernels or alternative menu entries for recovery mode in submenu. For entries returned by @command{os-prober} first entry will be put on top level and all others -@@ -1537,11 +1544,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries +@@ -1570,11 +1577,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries on top level will be generated instead. Changing this option will require changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback}) and @samp{default} (@pxref{default}) environment variables as well as saved @@ -399,7 +385,7 @@ index 69f08d289f..0615d0ed97 100644 check for encrypted disks and generate additional commands needed to access them during boot. Note that in this case unattended boot is not possible because GRUB will wait for passphrase to unlock encrypted container. -@@ -1600,7 +1607,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or +@@ -1633,7 +1640,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or @end table @@ -408,7 +394,48 @@ index 69f08d289f..0615d0ed97 100644 edit the scripts in @file{/etc/grub.d} directly. @file{/etc/grub.d/40_custom} is particularly useful for adding entire custom menu entries; simply type the menu entries you want to add at the end of -@@ -1862,7 +1869,7 @@ images as well. +@@ -1641,14 +1648,14 @@ that file, making sure to leave at least the first two lines intact. + + @node Root Identifcation Heuristics + @section Root Identifcation Heuristics +-If the target operating system uses the Linux kernel, @command{grub-mkconfig} ++If the target operating system uses the Linux kernel, @command{grub2-mkconfig} + attempts to identify the root file system via a heuristic algoirthm. This + algorithm selects the identification method of the root file system by + considering three factors. The first is if an initrd for the target operating + system is also present. The second is @samp{GRUB_DISABLE_LINUX_UUID} and if set +-to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file ++to @samp{true}, prevents @command{grub2-mkconfig} from identifying the root file + system by its UUID. The third is @samp{GRUB_DISABLE_LINUX_PARTUUID} and if set +-to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file ++to @samp{true}, prevents @command{grub2-mkconfig} from identifying the root file + system via the UUID of its enclosing partition. If the variables are assigned + any other value, that value is considered equivalent to @samp{false}. The + variables are also considered to be set to @samp{false} if they are not set. +@@ -1658,18 +1665,18 @@ filesystem to the initrd. Most initrd images determine the root file system by + checking the Linux kernel's command-line for the @samp{root} key and use its + value as the identification method of the root file system. To improve the + reliability of booting, most initrd images also allow the root file system to be +-identified by its UUID. Because of this behavior, the @command{grub-mkconfig} ++identified by its UUID. Because of this behavior, the @command{grub2-mkconfig} + command will set @samp{root} to @samp{root=UUID=...} to provide the initrd with + the filesystem UUID of the root file system. + + If no initrd is detected or @samp{GRUB_DISABLE_LINUX_UUID} is set to @samp{true} +-then @command{grub-command} will identify the root filesystem by setting the ++then @command{grub2-command} will identify the root filesystem by setting the + kernel command-line variable @samp{root} to @samp{root=PARTUUID=...} unless + @samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}. If + @samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}, +-@command{grub-command} will identify by its Linux device name. ++@command{grub2-command} will identify by its Linux device name. + +-The following table summarizes the behavior of the @command{grub-mkconfig} ++The following table summarizes the behavior of the @command{grub2-mkconfig} + command. + + @multitable {detected} {GRUB_DISABLE_LINUX_PARTUUID} {GRUB_DISABLE_LINUX_UUID} {Linux Root} +@@ -1898,7 +1905,7 @@ images as well. Mount this partition on/mnt/boot and disable GRUB in all OSes and manually install self-compiled latest GRUB with: @@ -417,7 +444,7 @@ index 69f08d289f..0615d0ed97 100644 In all the OSes install GRUB tools but disable installing GRUB in bootsector, so you'll have menu.lst and grub.cfg available for use. Also disable os-prober -@@ -1872,20 +1879,20 @@ use by setting: +@@ -1908,20 +1915,20 @@ use by setting: in /etc/default/grub @@ -441,7 +468,7 @@ index 69f08d289f..0615d0ed97 100644 @} menuentry "Windows XP" @{ -@@ -1948,15 +1955,15 @@ GRUB supports embedding a configuration file directly into the core image, +@@ -1984,15 +1991,15 @@ GRUB supports embedding a configuration file directly into the core image, so that it is loaded before entering normal mode. This is useful, for example, when it is not straightforward to find the real configuration file, or when you need to debug problems with loading that file. @@ -460,7 +487,7 @@ index 69f08d289f..0615d0ed97 100644 After the embedded configuration file (if any) is executed, GRUB will load the @samp{normal} module (@pxref{normal}), which will then read the real -@@ -1991,13 +1998,13 @@ included in the core image: +@@ -2027,13 +2034,13 @@ included in the core image: @example @group search.fs_label grub root @@ -478,7 +505,7 @@ index 69f08d289f..0615d0ed97 100644 else echo "Could not find an example configuration file!" fi -@@ -2521,7 +2528,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 +@@ -2557,7 +2564,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38 @end group @end example @@ -487,7 +514,7 @@ index 69f08d289f..0615d0ed97 100644 server. The grub.cfg file is placed in the same directory as the path output by -@@ -2715,7 +2722,7 @@ team are: +@@ -2760,7 +2767,7 @@ team are: @end table To take full advantage of this function, install GRUB into the MBR @@ -496,7 +523,7 @@ index 69f08d289f..0615d0ed97 100644 If you have a laptop which has a similar feature and not in the above list could you figure your address and contribute? -@@ -2776,7 +2783,7 @@ bytes. +@@ -2821,7 +2828,7 @@ bytes. The sole function of @file{boot.img} is to read the first sector of the core image from a local disk and jump to it. Because of the size restriction, @file{boot.img} cannot understand any file system structure, so @@ -505,7 +532,7 @@ index 69f08d289f..0615d0ed97 100644 core image into @file{boot.img} when installing GRUB. @item diskboot.img -@@ -2806,7 +2813,7 @@ images. +@@ -2851,7 +2858,7 @@ images. @item core.img This is the core image of GRUB. It is built dynamically from the kernel @@ -514,7 +541,7 @@ index 69f08d289f..0615d0ed97 100644 program. Usually, it contains enough modules to access @file{/boot/grub}, and loads everything else (including menu handling, the ability to load target operating systems, and so on) from the file system at run-time. The -@@ -2858,7 +2865,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from +@@ -2903,7 +2910,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from In GRUB 2, images for booting from CD-ROM drives are now constructed using @file{cdboot.img} and @file{core.img}, making sure that the core image contains the @samp{iso9660} module. It is usually best to use the @@ -523,7 +550,7 @@ index 69f08d289f..0615d0ed97 100644 @item nbgrub There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by -@@ -3014,8 +3021,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by +@@ -3071,8 +3078,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by An absolute file name resembles a Unix absolute file name, using @samp{/} for the directory separator (not @samp{\} as in DOS). One @@ -534,7 +561,7 @@ index 69f08d289f..0615d0ed97 100644 disk. If you omit the device name in an absolute file name, GRUB uses GRUB's @dfn{root device} implicitly. So if you set the root device to, say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}), -@@ -3023,8 +3030,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}. +@@ -3080,8 +3087,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}. On ZFS filesystem the first path component must be @var{volume}@samp{@@}[@var{snapshot}]. @@ -545,7 +572,7 @@ index 69f08d289f..0615d0ed97 100644 @samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if snapshot name is omitted. -@@ -3427,7 +3434,7 @@ The more recent release of Minix would then be identified as +@@ -3500,7 +3507,7 @@ The more recent release of Minix would then be identified as @samp{other>minix>minix-3.4.0}. This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple @@ -554,7 +581,7 @@ index 69f08d289f..0615d0ed97 100644 @node fallback -@@ -3517,7 +3524,7 @@ If this variable is set, it names the language code that the +@@ -3590,7 +3597,7 @@ If this variable is set, it names the language code that the example, French would be named as @samp{fr}, and Simplified Chinese as @samp{zh_CN}. @@ -563,7 +590,7 @@ index 69f08d289f..0615d0ed97 100644 reasonable default for this variable based on the system locale. -@@ -3525,10 +3532,10 @@ reasonable default for this variable based on the system locale. +@@ -3598,10 +3605,10 @@ reasonable default for this variable based on the system locale. @subsection locale_dir If this variable is set, it names the directory where translation files may @@ -576,7 +603,7 @@ index 69f08d289f..0615d0ed97 100644 default for this variable if internationalization is needed and any translation files are available. -@@ -3646,7 +3653,7 @@ input. The default is not to pause output. +@@ -3738,7 +3745,7 @@ input. The default is not to pause output. The location of the @samp{/boot/grub} directory as an absolute file name (@pxref{File name syntax}). This is normally set by GRUB at startup based @@ -585,7 +612,7 @@ index 69f08d289f..0615d0ed97 100644 dynamically loaded from this directory, so it must be set correctly in order for many parts of GRUB to work. -@@ -3737,17 +3744,17 @@ GRUB provides an ``environment block'' which can be used to save a small +@@ -3850,17 +3857,17 @@ GRUB provides an ``environment block'' which can be used to save a small amount of state. The environment block is a preallocated 1024-byte file, which normally lives @@ -605,8 +632,8 @@ index 69f08d289f..0615d0ed97 100644 +@command{grub2-mkconfig} uses this facility to implement @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}). - -@@ -4476,7 +4483,7 @@ Translate @var{string} into the current language. + @node Modules +@@ -4922,7 +4929,7 @@ Translate @var{string} into the current language. The current language code is stored in the @samp{lang} variable in GRUB's environment (@pxref{lang}). Translation files in MO format are read from @@ -615,7 +642,7 @@ index 69f08d289f..0615d0ed97 100644 @end deffn -@@ -4871,7 +4878,7 @@ Define a user named @var{user} with password @var{clear-password}. +@@ -5274,7 +5281,7 @@ Define a user named @var{user} with password @var{clear-password}. @deffn Command password_pbkdf2 user hashed-password Define a user named @var{user} with password hash @var{hashed-password}. @@ -624,7 +651,7 @@ index 69f08d289f..0615d0ed97 100644 to generate password hashes. @xref{Security}. @end deffn -@@ -5814,8 +5821,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} +@@ -6400,8 +6407,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2} which has an associated password. @samp{password} sets the password in plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2} sets the password hashed using the Password-Based Key Derivation Function @@ -635,7 +662,7 @@ index 69f08d289f..0615d0ed97 100644 In order to enable authentication support, the @samp{superusers} environment variable must be set to a list of usernames, separated by any of spaces, -@@ -5860,7 +5867,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ +@@ -6446,7 +6453,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{ @end group @end example @@ -644,11 +671,13 @@ index 69f08d289f..0615d0ed97 100644 generating configuration files with authentication. You can use @file{/etc/grub.d/40_custom} to add simple superuser authentication, by adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} -@@ -5887,7 +5894,17 @@ may halt or otherwise impact the boot process. +@@ -6472,8 +6479,18 @@ validation fails, then file @file{foo} cannot be opened. This failure + may halt or otherwise impact the boot process. An initial trusted public key can be embedded within the GRUB @file{core.img} - using the @code{--pubkey} option to @command{grub-install} +-using the @code{--pubkey} option to @command{grub-install} -(@pxref{Invoking grub-install}). ++using the @code{--pubkey} option to @command{grub2-install} +(@pxref{Invoking grub2-install}). + +@comment Unfortunately --pubkey is not yet supported by grub2-install, @@ -663,7 +692,7 @@ index 69f08d289f..0615d0ed97 100644 GRUB uses GPG-style detached signatures (meaning that a file @file{foo.sig} will be produced when file @file{foo} is signed), and -@@ -5907,8 +5924,8 @@ gpg --detach-sign /path/to/file +@@ -6493,8 +6510,8 @@ gpg --detach-sign /path/to/file For successful validation of all of GRUB's subcomponents and the loaded OS kernel, they must all be signed. One way to accomplish this is the following (after having already produced the desired @@ -674,7 +703,7 @@ index 69f08d289f..0615d0ed97 100644 @example @group -@@ -5930,7 +5947,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, +@@ -6516,7 +6533,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust}, Note that internally signature enforcement is controlled by setting the environment variable @code{check_signatures} equal to @code{enforce}. Passing one or more @code{--pubkey} options to @@ -683,7 +712,16 @@ index 69f08d289f..0615d0ed97 100644 equal to @code{enforce} in @file{core.img} prior to processing any configuration files. -@@ -6388,10 +6405,10 @@ Required files are: +@@ -6564,7 +6581,7 @@ UTF-8 strings as comma-separated values (CSV). See + @uref{https://github.com/rhboot/shim/blob/main/SBAT.md} for more details. + + To add a data section containing the SBAT information into the binary, the +-@option{--sbat} option of @command{grub-mkimage} command should be used. The content ++@option{--sbat} option of @command{grub2-mkimage} command should be used. The content + of a CSV file, encoded with UTF-8, is copied as is to the .sbat data section into + the generated EFI binary. The CSV file can be stored anywhere on the file system. + +@@ -6975,10 +6992,10 @@ Required files are: GRUB's normal start-up procedure involves setting the @samp{prefix} environment variable to a value set in the core image by @@ -696,7 +734,7 @@ index 69f08d289f..0615d0ed97 100644 things GRUB is supposed to do. If, instead, you only get a rescue shell, this usually means that GRUB -@@ -6417,8 +6434,8 @@ normal +@@ -7004,8 +7021,8 @@ normal However, any problem that leaves you in the rescue shell probably means that GRUB was not correctly installed. It may be more useful to try to reinstall @@ -707,7 +745,7 @@ index 69f08d289f..0615d0ed97 100644 @itemize @bullet{} @item -@@ -6430,7 +6447,7 @@ is usually better to use UUIDs or file system labels and avoid depending on +@@ -7017,7 +7034,7 @@ is usually better to use UUIDs or file system labels and avoid depending on drive ordering entirely. @item @@ -716,14 +754,34 @@ index 69f08d289f..0615d0ed97 100644 to a partition but GRUB has already been installed in the master boot record, then the GRUB installation in the partition will be ignored. -@@ -6461,21 +6478,21 @@ entry which claims partition start at block 0. This change will not hamper - bootability on other machines. +@@ -7052,33 +7069,33 @@ bootability on other machines. + @chapter User-space utilities + + @menu +-* Invoking grub-install:: How to use the GRUB installer +-* Invoking grub-mkconfig:: Generate a GRUB configuration file +-* Invoking grub-mkpasswd-pbkdf2:: ++* Invoking grub2-install:: How to use the GRUB installer ++* Invoking grub2-mkconfig:: Generate a GRUB configuration file ++* Invoking grub2-mkpasswd-pbkdf2:: + Generate GRUB password hashes +-* Invoking grub-mkrelpath:: Make system path relative to its root +-* Invoking grub-mkrescue:: Make a GRUB rescue image +-* Invoking grub-mount:: Mount a file system using GRUB +-* Invoking grub-probe:: Probe device information for GRUB +-* Invoking grub-script-check:: Check GRUB script file for syntax errors ++* Invoking grub2-mkrelpath:: Make system path relative to its root ++* Invoking grub2-mkrescue:: Make a GRUB rescue image ++* Invoking grub2-mount:: Mount a file system using GRUB ++* Invoking grub2-probe:: Probe device information for GRUB ++* Invoking grub2-script-check:: Check GRUB script file for syntax errors + @end menu -@node Invoking grub-install --@chapter Invoking grub-install +-@section Invoking grub-install +@node Invoking grub2-install -+@chapter Invoking grub2-install ++@section Invoking grub2-install -The program @command{grub-install} generates a GRUB core image using -@command{grub-mkimage} and installs it on your system. You must specify the @@ -744,7 +802,7 @@ index 69f08d289f..0615d0ed97 100644 @table @option @item --help -@@ -6491,13 +6508,13 @@ separate partition or a removable disk. +@@ -7094,13 +7111,13 @@ separate partition or a removable disk. If this option is not specified then it defaults to @file{/boot}, so @example @@ -760,7 +818,7 @@ index 69f08d289f..0615d0ed97 100644 @end example Here is an example in which you have a separate @dfn{boot} partition which is -@@ -6505,16 +6522,16 @@ mounted on +@@ -7108,16 +7125,16 @@ mounted on @file{/mnt/boot}: @example @@ -780,14 +838,14 @@ index 69f08d289f..0615d0ed97 100644 extra space in the bootloader embedding area for Reed-Solomon error-correcting codes. This enables GRUB to still boot successfully if some blocks are corrupted. The exact amount of protection offered -@@ -6527,17 +6544,17 @@ installation}) where GRUB does not reside in any unpartitioned space +@@ -7130,17 +7147,17 @@ installation}) where GRUB does not reside in any unpartitioned space outside of the MBR. Disable the Reed-Solomon codes with this option. @end table -@node Invoking grub-mkconfig --@chapter Invoking grub-mkconfig +-@section Invoking grub-mkconfig +@node Invoking grub2-mkconfig -+@chapter Invoking grub2-mkconfig ++@section Invoking grub2-mkconfig -The program @command{grub-mkconfig} generates a configuration file for GRUB +The program @command{grub2-mkconfig} generates a configuration file for GRUB @@ -795,7 +853,7 @@ index 69f08d289f..0615d0ed97 100644 @example -grub-mkconfig -o /boot/grub/grub.cfg -+grub-mkconfig -o /boot/grub2/grub.cfg ++grub2-mkconfig -o /boot/grub2/grub.cfg @end example -@command{grub-mkconfig} accepts the following options: @@ -803,21 +861,22 @@ index 69f08d289f..0615d0ed97 100644 @table @option @item --help -@@ -6553,17 +6570,17 @@ it to standard output. +@@ -7156,17 +7173,17 @@ it to standard output. @end table -@node Invoking grub-mkpasswd-pbkdf2 --@chapter Invoking grub-mkpasswd-pbkdf2 +-@section Invoking grub-mkpasswd-pbkdf2 +@node Invoking grub2-mkpasswd-pbkdf2 -+@chapter Invoking grub2-mkpasswd-pbkdf2 ++@section Invoking grub2-mkpasswd-pbkdf2 -The program @command{grub-mkpasswd-pbkdf2} generates password hashes for +The program @command{grub2-mkpasswd-pbkdf2} generates password hashes for GRUB (@pxref{Security}). @example - grub-mkpasswd-pbkdf2 +-grub-mkpasswd-pbkdf2 ++grub2-mkpasswd-pbkdf2 @end example -@command{grub-mkpasswd-pbkdf2} accepts the following options: @@ -825,14 +884,14 @@ index 69f08d289f..0615d0ed97 100644 @table @option @item -c @var{number} -@@ -6581,23 +6598,23 @@ Length of the salt. Defaults to 64. +@@ -7184,23 +7201,23 @@ Length of the salt. Defaults to 64. @end table -@node Invoking grub-mkrelpath --@chapter Invoking grub-mkrelpath +-@section Invoking grub-mkrelpath +@node Invoking grub2-mkrelpath -+@chapter Invoking grub2-mkrelpath ++@section Invoking grub2-mkrelpath -The program @command{grub-mkrelpath} makes a file system path relative to +The program @command{grub2-mkrelpath} makes a file system path relative to @@ -855,21 +914,22 @@ index 69f08d289f..0615d0ed97 100644 @table @option @item --help -@@ -6608,17 +6625,17 @@ Print the version number of GRUB and exit. +@@ -7211,17 +7228,17 @@ Print the version number of GRUB and exit. @end table -@node Invoking grub-mkrescue --@chapter Invoking grub-mkrescue +-@section Invoking grub-mkrescue +@node Invoking grub2-mkrescue -+@chapter Invoking grub2-mkrescue ++@section Invoking grub2-mkrescue -The program @command{grub-mkrescue} generates a bootable GRUB rescue image +The program @command{grub2-mkrescue} generates a bootable GRUB rescue image (@pxref{Making a GRUB bootable CD-ROM}). @example - grub-mkrescue -o grub.iso +-grub-mkrescue -o grub.iso ++grub2-mkrescue -o grub.iso @end example -All arguments not explicitly listed as @command{grub-mkrescue} options are @@ -877,8 +937,12 @@ index 69f08d289f..0615d0ed97 100644 passed on directly to @command{xorriso} in @command{mkisofs} emulation mode. Options passed to @command{xorriso} will normally be interpreted as @command{mkisofs} options; if the option @samp{--} is used, then anything -@@ -6633,7 +6650,7 @@ mkdir -p disk/boot/grub - grub-mkrescue -o grub.iso disk +@@ -7233,10 +7250,10 @@ commonly used to add extra files to the image: + @example + mkdir -p disk/boot/grub + @r{(add extra files to @file{disk/boot/grub})} +-grub-mkrescue -o grub.iso disk ++grub2-mkrescue -o grub.iso disk @end example -@command{grub-mkrescue} accepts the following options: @@ -886,7 +950,7 @@ index 69f08d289f..0615d0ed97 100644 @table @option @item --help -@@ -6661,15 +6678,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in +@@ -7264,15 +7281,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in default. @item --grub-mkimage=@var{file} @@ -897,16 +961,16 @@ index 69f08d289f..0615d0ed97 100644 -@node Invoking grub-mount --@chapter Invoking grub-mount +-@section Invoking grub-mount +@node Invoking grub2-mount -+@chapter Invoking grub2-mount ++@section Invoking grub2-mount -The program @command{grub-mount} performs a read-only mount of any file +The program @command{grub2-mount} performs a read-only mount of any file system or file system image that GRUB understands, using GRUB's file system drivers via FUSE. (It is only available if FUSE development files were present when GRUB was built.) This has a number of uses: -@@ -6701,13 +6718,13 @@ even if nobody has yet written a FUSE module specifically for that file +@@ -7304,13 +7321,13 @@ even if nobody has yet written a FUSE module specifically for that file system type. @end itemize @@ -914,7 +978,8 @@ index 69f08d289f..0615d0ed97 100644 +Using @command{grub2-mount} is normally as simple as: @example - grub-mount /dev/sda1 /mnt +-grub-mount /dev/sda1 /mnt ++grub2-mount /dev/sda1 /mnt @end example -@command{grub-mount} must be given one or more images and a mount point as @@ -922,7 +987,7 @@ index 69f08d289f..0615d0ed97 100644 non-option arguments (if it is given more than one image, it will treat them as a RAID set), and also accepts the following options: -@@ -6729,13 +6746,13 @@ Show debugging output for conditions matching @var{string}. +@@ -7332,13 +7349,13 @@ Show debugging output for conditions matching @var{string}. @item -K prompt|@var{file} @itemx --zfs-key=prompt|@var{file} Load a ZFS encryption key. If you use @samp{prompt} as the argument, @@ -938,22 +1003,33 @@ index 69f08d289f..0615d0ed97 100644 root of the supplied file system. If @var{device} is just a number, then it will be treated as a partition -@@ -6753,10 +6770,10 @@ Print verbose messages. +@@ -7347,7 +7364,7 @@ an entire disk in @file{disk.img}, then you can use this command to mount + its second partition: + + @example +-grub-mount -r 2 disk.img mount-point ++grub2-mount -r 2 disk.img mount-point + @end example + + @item -v +@@ -7356,18 +7373,18 @@ Print verbose messages. @end table -@node Invoking grub-probe --@chapter Invoking grub-probe +-@section Invoking grub-probe +@node Invoking grub2-probe -+@chapter Invoking grub2-probe ++@section Invoking grub2-probe -The program @command{grub-probe} probes device information for a given path +The program @command{grub2-probe} probes device information for a given path or device. @example -@@ -6764,7 +6781,7 @@ grub-probe --target=fs /boot/grub - grub-probe --target=drive --device /dev/sda1 +-grub-probe --target=fs /boot/grub +-grub-probe --target=drive --device /dev/sda1 ++grub2-probe --target=fs /boot/grub ++grub2-probe --target=drive --device /dev/sda1 @end example -@command{grub-probe} must be given a path or device as a non-option @@ -961,7 +1037,7 @@ index 69f08d289f..0615d0ed97 100644 argument, and also accepts the following options: @table @option -@@ -6777,16 +6794,16 @@ Print the version number of GRUB and exit. +@@ -7380,16 +7397,16 @@ Print the version number of GRUB and exit. @item -d @itemx --device If this option is given, then the non-option argument is a system device @@ -981,14 +1057,14 @@ index 69f08d289f..0615d0ed97 100644 @item -t @var{target} @itemx --target=@var{target} -@@ -6839,19 +6856,19 @@ Print verbose messages. +@@ -7442,19 +7459,19 @@ Print verbose messages. @end table -@node Invoking grub-script-check --@chapter Invoking grub-script-check +-@section Invoking grub-script-check +@node Invoking grub2-script-check -+@chapter Invoking grub2-script-check ++@section Invoking grub2-script-check -The program @command{grub-script-check} takes a GRUB script file +The program @command{grub2-script-check} takes a GRUB script file @@ -998,7 +1074,7 @@ index 69f08d289f..0615d0ed97 100644 @example -grub-script-check /boot/grub/grub.cfg -+grub-script-check /boot/grub2/grub.cfg ++grub2-script-check /boot/grub2/grub.cfg @end example -@command{grub-script-check} accepts the following options: diff --git a/0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch b/0035-macos-just-build-chainloader-entries-don-t-try-any-x.patch similarity index 98% rename from 0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch rename to 0035-macos-just-build-chainloader-entries-don-t-try-any-x.patch index 8d3139d6..3246b116 100644 --- a/0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch +++ b/0035-macos-just-build-chainloader-entries-don-t-try-any-x.patch @@ -20,7 +20,7 @@ Signed-off-by: Peter Jones 1 file changed, 18 insertions(+), 60 deletions(-) diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 1b91c102f3..4b27bd2015 100644 +index f300e46fc6a..d7d423b2eaf 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then @@ -104,7 +104,7 @@ index 1b91c102f3..4b27bd2015 100644 } EOF } -@@ -292,11 +249,12 @@ EOF +@@ -296,11 +253,12 @@ EOF echo "$title_correction_code" ;; macosx) diff --git a/0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch b/0036-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch similarity index 94% rename from 0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch rename to 0036-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch index 57d2391a..ad004426 100644 --- a/0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +++ b/0036-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch @@ -19,12 +19,12 @@ variable and loading the config file from the subvolume. Signed-off-by: Jeff Mahoney --- - grub-core/fs/btrfs.c | 552 +++++++++++++++++++++++++++++++++++++++++++++++++-- + grub-core/fs/btrfs.c | 558 ++++++++++++++++++++++++++++++++++++++++++++++++--- include/grub/btrfs.h | 1 + - 2 files changed, 533 insertions(+), 20 deletions(-) + 2 files changed, 536 insertions(+), 23 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 63203034df..f1fff7385b 100644 +index ba0c583526d..f14fe9c1bda 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -38,6 +38,9 @@ @@ -89,7 +89,7 @@ index 63203034df..f1fff7385b 100644 static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2, 256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2 }; -@@ -1173,6 +1195,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, +@@ -1252,6 +1274,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, return GRUB_ERR_NONE; } @@ -152,7 +152,7 @@ index 63203034df..f1fff7385b 100644 static struct grub_btrfs_data * grub_btrfs_mount (grub_device_t dev) { -@@ -1208,6 +1286,13 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1287,6 +1365,13 @@ grub_btrfs_mount (grub_device_t dev) data->devices_attached[0].dev = dev; data->devices_attached[0].id = data->sblock.this_device.device_id; @@ -166,7 +166,7 @@ index 63203034df..f1fff7385b 100644 return data; } -@@ -1673,6 +1758,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, +@@ -1784,6 +1869,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, return GRUB_ERR_NONE; } @@ -258,7 +258,7 @@ index 63203034df..f1fff7385b 100644 static grub_err_t find_path (struct grub_btrfs_data *data, const char *path, struct grub_btrfs_key *key, -@@ -1691,14 +1861,26 @@ find_path (struct grub_btrfs_data *data, +@@ -1802,14 +1972,26 @@ find_path (struct grub_btrfs_data *data, char *origpath = NULL; unsigned symlinks_max = 32; @@ -289,15 +289,18 @@ index 63203034df..f1fff7385b 100644 while (1) { while (path[0] == '/') -@@ -1871,9 +2053,21 @@ find_path (struct grub_btrfs_data *data, +@@ -1982,13 +2164,25 @@ find_path (struct grub_btrfs_data *data, path = path_alloc = tmp; if (path[0] == '/') { - err = get_root (data, key, tree, type); - if (err) -- return err; + if (data->fs_tree) -+ { + { +- grub_free (direl); +- grub_free (path_alloc); +- grub_free (origpath); +- return err; + *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; + *tree = data->fs_tree; + /* This is a tree root, so everything starts at objectid 256 */ @@ -309,12 +312,16 @@ index 63203034df..f1fff7385b 100644 + { + err = get_root (data, key, tree, type); + if (err) -+ return err; -+ } ++ { ++ grub_free (direl); ++ grub_free (path_alloc); ++ grub_free (origpath); ++ return err; ++ } + } } continue; - } -@@ -2114,18 +2308,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len) +@@ -2256,18 +2450,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len) data->tree, file->offset, buf, len); } @@ -336,7 +343,7 @@ index 63203034df..f1fff7385b 100644 grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]), grub_be_to_cpu16 (data->sblock.uuid[2]), -@@ -2134,6 +2320,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid) +@@ -2276,6 +2462,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid) grub_be_to_cpu16 (data->sblock.uuid[5]), grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[7])); @@ -357,7 +364,7 @@ index 63203034df..f1fff7385b 100644 grub_btrfs_unmount (data); -@@ -2190,6 +2390,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), +@@ -2396,6 +2596,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), } #endif @@ -600,7 +607,7 @@ index 63203034df..f1fff7385b 100644 static struct grub_fs grub_btrfs_fs = { .name = "btrfs", .fs_dir = grub_btrfs_dir, -@@ -2205,12 +2641,88 @@ static struct grub_fs grub_btrfs_fs = { +@@ -2411,12 +2847,88 @@ static struct grub_fs grub_btrfs_fs = { #endif }; @@ -690,7 +697,7 @@ index 63203034df..f1fff7385b 100644 + +// vim: si et sw=2: diff --git a/include/grub/btrfs.h b/include/grub/btrfs.h -index 9d93fb6c18..234ad97677 100644 +index 9d93fb6c182..234ad976771 100644 --- a/include/grub/btrfs.h +++ b/include/grub/btrfs.h @@ -29,6 +29,7 @@ enum diff --git a/0037-btrfs-fix-a-bad-null-check.patch b/0037-btrfs-fix-a-bad-null-check.patch new file mode 100644 index 00000000..093ca650 --- /dev/null +++ b/0037-btrfs-fix-a-bad-null-check.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Jan 2024 15:41:52 -0500 +Subject: [PATCH] btrfs: fix a bad null check +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +current gcc complains: + + grub-core/fs/btrfs.c: In function ‘grub_cmd_btrfs_info’: + grub-core/fs/btrfs.c:2745:7: error: the comparison will always evaluate as ‘true’ for the address of ‘label’ will never be NULL [-Werror=address] + 2745 | if (data->sblock.label) + | ^~~~ + grub-core/fs/btrfs.c:92:8: note: ‘label’ declared here + 92 | char label[0x100]; + | ^~~~~ + cc1: all warnings being treated as errors + +Obviously this check should be on the first data byte instead of the +symbol itself. + +Signed-off-by: Peter Jones +--- + grub-core/fs/btrfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index f14fe9c1bda..8e2b1e9f7bc 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -2625,7 +2625,7 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, + return grub_error (GRUB_ERR_BAD_ARGUMENT, "failed to open fs"); + } + +- if (data->sblock.label) ++ if (data->sblock.label[0]) + grub_printf("Label: '%s' ", data->sblock.label); + else + grub_printf("Label: none "); diff --git a/0037-bz1374141-fix-incorrect-mask-for-ppc64.patch b/0037-bz1374141-fix-incorrect-mask-for-ppc64.patch deleted file mode 100644 index 15b21114..00000000 --- a/0037-bz1374141-fix-incorrect-mask-for-ppc64.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Masahiro Matsuya -Date: Sat, 29 Oct 2016 08:35:26 +0900 -Subject: [PATCH] bz1374141 fix incorrect mask for ppc64 - -The netmask configured in firmware is not respected on ppc64 (big endian). -When 255.255.252.0 is set as netmask in firmware, the following is the value of bootpath string in grub_ieee1275_parse_bootpath(). - - /vdevice/l-lan@30000002:speed=auto,duplex=auto,192.168.88.10,,192.168.89.113,192.168.88.1,5,5,255.255.252.0,512 - -The netmask in this bootpath is no problem, since it's a value specified in firmware. But, -The value of 'subnet_mask.ipv4' was set with 0xfffffc00, and __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)) returned 16 (not 22). -As a result, 16 was used for netmask wrongly. - -1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00) -0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4) -1111 1111 0000 0011 0000 0000 0000 0000 # ~grub_le_to_cpu32 (subnet_mask.ipv4) - -And, the count of zero with __builtin_ctz can be 16. -This patch changes it as below. - -1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00) -0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4) -1111 1111 1111 1111 1111 1100 0000 0000 # grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4)) -0000 0000 0000 0000 0000 0011 1111 1111 # ~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4)) - -The count of zero with __builtin_clz can be 22. (clz counts the number of one bits preceding the most significant zero bit) - -Signed-off-by: Masahiro Matsuya -Signed-off-by: Robbie Harwood ---- - grub-core/net/drivers/ieee1275/ofnet.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index ac4e62a95c..3860b6f78d 100644 ---- a/grub-core/net/drivers/ieee1275/ofnet.c -+++ b/grub-core/net/drivers/ieee1275/ofnet.c -@@ -220,8 +220,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, - flags); - inter->vlantag = vlantag; - grub_net_add_ipv4_local (inter, -- __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4))); -- -+ __builtin_clz (~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4)))); - } - - if (gateway_addr.ipv4 != 0) diff --git a/0042-export-btrfs_subvol-and-btrfs_subvolid.patch b/0038-export-btrfs_subvol-and-btrfs_subvolid.patch similarity index 91% rename from 0042-export-btrfs_subvol-and-btrfs_subvolid.patch rename to 0038-export-btrfs_subvol-and-btrfs_subvolid.patch index 719866e1..d35f598e 100644 --- a/0042-export-btrfs_subvol-and-btrfs_subvolid.patch +++ b/0038-export-btrfs_subvol-and-btrfs_subvolid.patch @@ -12,10 +12,10 @@ Signed-off-by: Michael Chang 1 file changed, 2 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index f1fff7385b..ad1b56b716 100644 +index 8e2b1e9f7bc..14e38a4df02 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -2714,6 +2714,8 @@ GRUB_MOD_INIT (btrfs) +@@ -2920,6 +2920,8 @@ GRUB_MOD_INIT (btrfs) subvol_set_env); grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, subvolid_set_env); diff --git a/0043-grub2-btrfs-03-follow_default.patch b/0039-grub2-btrfs-03-follow_default.patch similarity index 90% rename from 0043-grub2-btrfs-03-follow_default.patch rename to 0039-grub2-btrfs-03-follow_default.patch index 621f029e..bbe2fbc0 100644 --- a/0043-grub2-btrfs-03-follow_default.patch +++ b/0039-grub2-btrfs-03-follow_default.patch @@ -10,10 +10,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 76 insertions(+), 31 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index ad1b56b716..113c1f746c 100644 +index 14e38a4df02..d47f9ab0352 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -1256,6 +1256,7 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1335,6 +1335,7 @@ grub_btrfs_mount (grub_device_t dev) { struct grub_btrfs_data *data; grub_err_t err; @@ -21,7 +21,7 @@ index ad1b56b716..113c1f746c 100644 if (!dev->disk) { -@@ -1286,11 +1287,14 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1365,11 +1366,14 @@ grub_btrfs_mount (grub_device_t dev) data->devices_attached[0].dev = dev; data->devices_attached[0].id = data->sblock.this_device.device_id; @@ -40,7 +40,7 @@ index ad1b56b716..113c1f746c 100644 } return data; -@@ -1855,24 +1859,39 @@ find_path (struct grub_btrfs_data *data, +@@ -1966,24 +1970,39 @@ find_path (struct grub_btrfs_data *data, grub_size_t allocated = 0; struct grub_btrfs_dir_item *direl = NULL; struct grub_btrfs_key key_out; @@ -87,7 +87,7 @@ index ad1b56b716..113c1f746c 100644 } else { -@@ -1883,15 +1902,23 @@ find_path (struct grub_btrfs_data *data, +@@ -1994,15 +2013,23 @@ find_path (struct grub_btrfs_data *data, while (1) { @@ -120,7 +120,7 @@ index ad1b56b716..113c1f746c 100644 if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) { -@@ -1902,7 +1929,9 @@ find_path (struct grub_btrfs_data *data, +@@ -2013,7 +2040,9 @@ find_path (struct grub_btrfs_data *data, if (ctokenlen == 1 && ctoken[0] == '.') { @@ -131,7 +131,7 @@ index ad1b56b716..113c1f746c 100644 continue; } if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.') -@@ -1933,8 +1962,9 @@ find_path (struct grub_btrfs_data *data, +@@ -2044,8 +2073,9 @@ find_path (struct grub_btrfs_data *data, *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; key->object_id = key_out.offset; @@ -143,7 +143,7 @@ index ad1b56b716..113c1f746c 100644 continue; } -@@ -2003,7 +2033,9 @@ find_path (struct grub_btrfs_data *data, +@@ -2114,7 +2144,9 @@ find_path (struct grub_btrfs_data *data, return err; } @@ -154,7 +154,7 @@ index ad1b56b716..113c1f746c 100644 if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK) { struct grub_btrfs_inode inode; -@@ -2053,14 +2085,26 @@ find_path (struct grub_btrfs_data *data, +@@ -2164,14 +2196,26 @@ find_path (struct grub_btrfs_data *data, path = path_alloc = tmp; if (path[0] == '/') { @@ -188,7 +188,7 @@ index ad1b56b716..113c1f746c 100644 } else { -@@ -2716,6 +2760,7 @@ GRUB_MOD_INIT (btrfs) +@@ -2922,6 +2966,7 @@ GRUB_MOD_INIT (btrfs) subvolid_set_env); grub_env_export ("btrfs_subvol"); grub_env_export ("btrfs_subvolid"); diff --git a/0044-grub2-btrfs-04-grub2-install.patch b/0040-grub2-btrfs-04-grub2-install.patch similarity index 87% rename from 0044-grub2-btrfs-04-grub2-install.patch rename to 0040-grub2-btrfs-04-grub2-install.patch index 6b2bc78e..c7b56564 100644 --- a/0044-grub2-btrfs-04-grub2-install.patch +++ b/0040-grub2-btrfs-04-grub2-install.patch @@ -9,16 +9,16 @@ Signed-off-by: Robbie Harwood grub-core/osdep/linux/getroot.c | 7 +++++++ grub-core/osdep/unix/config.c | 17 +++++++++++++++-- util/config.c | 10 ++++++++++ - util/grub-install.c | 15 +++++++++++++++ + util/grub-install.c | 14 ++++++++++++++ util/grub-mkrelpath.c | 6 ++++++ include/grub/emu/config.h | 1 + - 6 files changed, 54 insertions(+), 2 deletions(-) + 6 files changed, 53 insertions(+), 2 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 001b818fe5..caf9b1ccd3 100644 +index 7dd775d2ad9..7c29b3523b4 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c -@@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_path) +@@ -373,6 +373,7 @@ get_btrfs_fs_prefix (const char *mount_path) return NULL; } @@ -26,7 +26,7 @@ index 001b818fe5..caf9b1ccd3 100644 char ** grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) -@@ -519,6 +520,12 @@ again: +@@ -516,6 +517,12 @@ again: { ret = grub_find_root_devices_from_btrfs (dir); fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); @@ -40,7 +40,7 @@ index 001b818fe5..caf9b1ccd3 100644 else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) { diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index 7d6325138c..46a881530c 100644 +index 0b1f7618d21..0ce0e309ac0 100644 --- a/grub-core/osdep/unix/config.c +++ b/grub-core/osdep/unix/config.c @@ -82,6 +82,19 @@ grub_util_load_config (struct grub_util_config *cfg) @@ -75,7 +75,7 @@ index 7d6325138c..46a881530c 100644 argv[2] = script; argv[3] = '\0'; diff --git a/util/config.c b/util/config.c -index ebcdd8f5e2..f044a880a7 100644 +index ebcdd8f5e22..f044a880a76 100644 --- a/util/config.c +++ b/util/config.c @@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct grub_util_config *cfg, int simple) @@ -96,19 +96,19 @@ index ebcdd8f5e2..f044a880a7 100644 sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) { diff --git a/util/grub-install.c b/util/grub-install.c -index 0fbe7f78c6..0f66f36d23 100644 +index 7dc5657bb67..ec3ed49674b 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -827,6 +827,8 @@ fill_core_services (const char *core_services) - free (sysv_plist); +@@ -843,6 +843,8 @@ try_open (const char *path) } + #endif +extern int use_relative_path_on_btrfs; + int main (int argc, char *argv[]) { -@@ -860,6 +862,9 @@ main (int argc, char *argv[]) +@@ -876,6 +878,9 @@ main (int argc, char *argv[]) grub_util_load_config (&config); @@ -118,11 +118,10 @@ index 0fbe7f78c6..0f66f36d23 100644 if (!bootloader_id && config.grub_distributor) { char *ptr; -@@ -1352,6 +1357,16 @@ main (int argc, char *argv[]) - fprintf (load_cfg_f, "set debug='%s'\n", - debug_image); +@@ -1366,6 +1371,15 @@ main (int argc, char *argv[]) + relative_grubdir = xstrdup ("/"); } -+ + + if (config.is_suse_btrfs_snapshot_enabled + && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0) + { @@ -136,7 +135,7 @@ index 0fbe7f78c6..0f66f36d23 100644 char *install_drive = NULL; diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c -index 47a241a391..5db7a9a7d9 100644 +index 47a241a391b..5db7a9a7d97 100644 --- a/util/grub-mkrelpath.c +++ b/util/grub-mkrelpath.c @@ -40,9 +40,12 @@ struct arguments @@ -163,7 +162,7 @@ index 47a241a391..5db7a9a7d9 100644 if (state->arg_num == 0) arguments->pathname = xstrdup (arg); diff --git a/include/grub/emu/config.h b/include/grub/emu/config.h -index 875d5896ce..c9a7e5f4ad 100644 +index 875d5896ce1..c9a7e5f4ade 100644 --- a/include/grub/emu/config.h +++ b/include/grub/emu/config.h @@ -37,6 +37,7 @@ struct grub_util_config diff --git a/0045-grub2-btrfs-05-grub2-mkconfig.patch b/0041-grub2-btrfs-05-grub2-mkconfig.patch similarity index 93% rename from 0045-grub2-btrfs-05-grub2-mkconfig.patch rename to 0041-grub2-btrfs-05-grub2-mkconfig.patch index ca3f86b6..f1187fdc 100644 --- a/0045-grub2-btrfs-05-grub2-mkconfig.patch +++ b/0041-grub2-btrfs-05-grub2-mkconfig.patch @@ -13,10 +13,10 @@ Signed-off-by: Michael Chang 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 005f093809..535c0f0249 100644 +index 28e92515795..884e4d363ca 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -252,7 +252,8 @@ export GRUB_DEFAULT \ +@@ -256,7 +256,8 @@ export GRUB_DEFAULT \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ GRUB_DISABLE_SUBMENU \ @@ -27,7 +27,7 @@ index 005f093809..535c0f0249 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 0f6505bf3b..5e96f6cc5d 100644 +index 33e1750aebb..0ba0e0e1c65 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -49,7 +49,11 @@ grub_warn () @@ -43,7 +43,7 @@ index 0f6505bf3b..5e96f6cc5d 100644 is_path_readable_by_grub () diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 858b526c92..de727e6ee6 100644 +index c2d8b093762..3e1b77265db 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@" @@ -90,10 +90,10 @@ index 858b526c92..de727e6ee6 100644 +EOF +fi diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 292e333324..7bb3a211a7 100644 +index e8ab4082f87..48ff32c1da4 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -66,10 +66,14 @@ fi +@@ -68,10 +68,14 @@ fi case x"$GRUB_FS" in xbtrfs) @@ -109,10 +109,10 @@ index 292e333324..7bb3a211a7 100644 xzfs) rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index ada20775a1..e9e73b815f 100644 +index 98ee5bc58dc..efcded0fbb4 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in -@@ -73,10 +73,14 @@ fi +@@ -75,10 +75,14 @@ fi case x"$GRUB_FS" in xbtrfs) diff --git a/0046-grub2-btrfs-06-subvol-mount.patch b/0042-grub2-btrfs-06-subvol-mount.patch similarity index 94% rename from 0046-grub2-btrfs-06-subvol-mount.patch rename to 0042-grub2-btrfs-06-subvol-mount.patch index 8cdf247d..7ddae569 100644 --- a/0046-grub2-btrfs-06-subvol-mount.patch +++ b/0042-grub2-btrfs-06-subvol-mount.patch @@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood 4 files changed, 392 insertions(+), 5 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 113c1f746c..d323746ecf 100644 +index d47f9ab0352..d44a1c73b8a 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -41,6 +41,7 @@ @@ -37,7 +37,7 @@ index 113c1f746c..d323746ecf 100644 static grub_err_t read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) -@@ -1223,9 +1230,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) +@@ -1302,9 +1309,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) grub_err_t err; grub_uint64_t tree = 0; grub_uint8_t type; @@ -64,10 +64,10 @@ index 113c1f746c..d323746ecf 100644 if (err) return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); -@@ -2199,11 +2223,20 @@ grub_btrfs_dir (grub_device_t device, const char *path, - int r = 0; +@@ -2316,11 +2340,20 @@ grub_btrfs_dir (grub_device_t device, const char *path, grub_uint64_t tree; grub_uint8_t type; + grub_size_t est_size = 0; + char *new_path = NULL; if (!data) @@ -86,7 +86,7 @@ index 113c1f746c..d323746ecf 100644 if (err) { grub_btrfs_unmount (data); -@@ -2305,11 +2338,21 @@ grub_btrfs_open (struct grub_file *file, const char *name) +@@ -2447,11 +2480,21 @@ grub_btrfs_open (struct grub_file *file, const char *name) struct grub_btrfs_inode inode; grub_uint8_t type; struct grub_btrfs_key key_in; @@ -109,7 +109,7 @@ index 113c1f746c..d323746ecf 100644 if (err) { grub_btrfs_unmount (data); -@@ -2480,6 +2523,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, +@@ -2686,6 +2729,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, return 0; } @@ -260,7 +260,7 @@ index 113c1f746c..d323746ecf 100644 static grub_err_t get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, grub_uint64_t objectid, grub_uint64_t offset, -@@ -2686,6 +2873,7 @@ static struct grub_fs grub_btrfs_fs = { +@@ -2892,6 +3079,7 @@ static struct grub_fs grub_btrfs_fs = { }; static grub_command_t cmd_info; @@ -268,7 +268,7 @@ index 113c1f746c..d323746ecf 100644 static grub_extcmd_t cmd_list_subvols; static char * -@@ -2749,6 +2937,9 @@ GRUB_MOD_INIT (btrfs) +@@ -2955,6 +3143,9 @@ GRUB_MOD_INIT (btrfs) cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, "DEVICE", "Print BtrFS info about DEVICE."); @@ -279,10 +279,10 @@ index 113c1f746c..d323746ecf 100644 grub_cmd_btrfs_list_subvols, 0, "[-p|-n] [-o var] DEVICE", diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index caf9b1ccd3..28790307e0 100644 +index 7c29b3523b4..74a48c03026 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c -@@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key +@@ -103,6 +103,14 @@ struct btrfs_ioctl_search_key grub_uint32_t unused[9]; }; @@ -297,7 +297,7 @@ index caf9b1ccd3..28790307e0 100644 struct btrfs_ioctl_search_args { struct btrfs_ioctl_search_key key; grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key)) -@@ -378,6 +386,109 @@ get_btrfs_fs_prefix (const char *mount_path) +@@ -375,6 +383,109 @@ get_btrfs_fs_prefix (const char *mount_path) int use_relative_path_on_btrfs = 0; @@ -407,7 +407,7 @@ index caf9b1ccd3..28790307e0 100644 char ** grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) { -@@ -519,12 +630,15 @@ again: +@@ -516,12 +627,15 @@ again: else if (grub_strcmp (entries[i].fstype, "btrfs") == 0) { ret = grub_find_root_devices_from_btrfs (dir); @@ -426,7 +426,7 @@ index caf9b1ccd3..28790307e0 100644 } } else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) -@@ -1150,6 +1264,34 @@ grub_util_get_grub_dev_os (const char *os_dev) +@@ -1147,6 +1261,34 @@ grub_util_get_grub_dev_os (const char *os_dev) return grub_dev; } @@ -462,10 +462,10 @@ index caf9b1ccd3..28790307e0 100644 grub_make_system_path_relative_to_its_root_os (const char *path) { diff --git a/util/grub-install.c b/util/grub-install.c -index 0f66f36d23..84ed6e88ec 100644 +index ec3ed49674b..d3ec2570d1d 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -1569,6 +1569,55 @@ main (int argc, char *argv[]) +@@ -1615,6 +1615,55 @@ main (int argc, char *argv[]) prefix_drive = xasprintf ("(%s)", grub_drives[0]); } @@ -522,7 +522,7 @@ index 0f66f36d23..84ed6e88ec 100644 const char *core_name = NULL; diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h -index 73fa2d34ab..9c642ae3fe 100644 +index 73fa2d34abb..9c642ae3fe3 100644 --- a/include/grub/emu/getroot.h +++ b/include/grub/emu/getroot.h @@ -53,6 +53,11 @@ char ** diff --git a/0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch b/0043-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch similarity index 94% rename from 0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch rename to 0043-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch index a5db09ae..1b3a969a 100644 --- a/0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +++ b/0043-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch @@ -10,10 +10,10 @@ Ref: bsc#953538 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index d323746ecf..673ded0352 100644 +index d44a1c73b8a..dba86d19b1a 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -1260,11 +1260,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) +@@ -1339,11 +1339,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path) return GRUB_ERR_NONE; } diff --git a/0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch b/0044-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch similarity index 97% rename from 0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch rename to 0044-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch index 99c106d5..add5764e 100644 --- a/0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +++ b/0044-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch @@ -10,10 +10,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 238 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 673ded0352..2b21cbaa67 100644 +index dba86d19b1a..87e4dd1a07a 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c -@@ -2887,6 +2887,238 @@ out: +@@ -3093,6 +3093,238 @@ out: return 0; } @@ -252,7 +252,7 @@ index 673ded0352..2b21cbaa67 100644 static struct grub_fs grub_btrfs_fs = { .name = "btrfs", .fs_dir = grub_btrfs_dir, -@@ -2905,6 +3137,7 @@ static struct grub_fs grub_btrfs_fs = { +@@ -3111,6 +3343,7 @@ static struct grub_fs grub_btrfs_fs = { static grub_command_t cmd_info; static grub_command_t cmd_mount_subvol; static grub_extcmd_t cmd_list_subvols; @@ -260,7 +260,7 @@ index 673ded0352..2b21cbaa67 100644 static char * subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)), -@@ -2975,6 +3208,11 @@ GRUB_MOD_INIT (btrfs) +@@ -3181,6 +3414,11 @@ GRUB_MOD_INIT (btrfs) "[-p|-n] [-o var] DEVICE", "Print list of BtrFS subvolumes on " "DEVICE.", options); diff --git a/0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch b/0045-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch similarity index 82% rename from 0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch rename to 0045-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch index d07dd276..b88fbab7 100644 --- a/0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +++ b/0045-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch @@ -10,21 +10,21 @@ Signed-off-by: Peter Jones 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 585fa6662b..03f9a9d011 100644 +index a5cd99e5afa..8d98203a784 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -24,6 +24,10 @@ - #include - #include +@@ -36,6 +36,10 @@ struct linux_arch_kernel_header { + struct grub_pe_image_header pe_image_header; + }; +/* Variables. */ +extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table); +extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle); + /* Functions. */ - void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol, + void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_guid_t *protocol, void *registration); -@@ -60,6 +64,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, +@@ -71,6 +75,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, grub_efi_uintn_t *descriptor_size, grub_efi_uint32_t *descriptor_version); void grub_efi_memory_fini (void); @@ -39,7 +39,7 @@ index 585fa6662b..03f9a9d011 100644 + grub_efi_status_t status; + + b = grub_efi_system_table->boot_services; -+ status = efi_call_3 (b->allocate_pool, pool_type, buffer_size, buffer); ++ status = b->allocate_pool(pool_type, buffer_size, buffer); + return status; +} + @@ -51,14 +51,14 @@ index 585fa6662b..03f9a9d011 100644 + grub_efi_status_t status; + + b = grub_efi_system_table->boot_services; -+ status = efi_call_1 (b->free_pool, buffer); ++ status = b->free_pool(buffer); + return status; +} + grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle); void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp); char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp); -@@ -115,10 +146,7 @@ void grub_efi_init (void); +@@ -140,10 +171,7 @@ void grub_efi_init (void); void grub_efi_fini (void); void grub_efi_set_prefix (void); diff --git a/0046-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0046-Use-grub_efi_.-memory-helpers-where-reasonable.patch new file mode 100644 index 00000000..0523c643 --- /dev/null +++ b/0046-Use-grub_efi_.-memory-helpers-where-reasonable.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 1 Jun 2017 10:06:38 -0400 +Subject: [PATCH] Use grub_efi_...() memory helpers where reasonable. + +This uses grub_efi_allocate_pool(), grub_efi_free_pool(), and +grub_efi_free_pages() instead of open-coded efi_call_N() calls, so we +get more reasonable type checking. + +Signed-off-by: Peter Jones +--- + grub-core/loader/efi/chainloader.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 1de98f78313..2036924504b 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -95,7 +95,7 @@ grub_chainloader_boot (void *context) + } + + if (exit_data) +- b->free_pool (exit_data); ++ grub_efi_free_pool (exit_data); + + grub_loader_unset (); + +@@ -419,7 +419,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_free (file_path); + + if (address) +- b->free_pages (address, pages); ++ grub_efi_free_pages (address, pages); + + if (image_handle != NULL) + b->unload_image (image_handle); diff --git a/0047-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0047-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch new file mode 100644 index 00000000..c852ced5 --- /dev/null +++ b/0047-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 1 Jun 2017 10:07:50 -0400 +Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it. + +This avoids syntax checkers getting confused about if it's llx or lx. + +Signed-off-by: Peter Jones +--- + include/grub/efi/api.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index c1b869db520..daa9268fdaa 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -577,7 +577,16 @@ typedef grub_uint64_t grub_efi_uint64_t; + typedef grub_uint8_t grub_efi_char8_t; + typedef grub_uint16_t grub_efi_char16_t; + ++ + typedef grub_efi_uintn_t grub_efi_status_t; ++/* Make grub_efi_status_t reasonably printable. */ ++#if GRUB_CPU_SIZEOF_VOID_P == 8 ++#define PRIxGRUB_EFI_STATUS "lx" ++#define PRIdGRUB_EFI_STATUS "ld" ++#else ++#define PRIxGRUB_EFI_STATUS "llx" ++#define PRIdGRUB_EFI_STATUS "lld" ++#endif + + /* + * On x86, the EFI calling convention may deviate from the local one, so diff --git a/0052-don-t-use-int-for-efi-status.patch b/0048-don-t-use-int-for-efi-status.patch similarity index 88% rename from 0052-don-t-use-int-for-efi-status.patch rename to 0048-don-t-use-int-for-efi-status.patch index 4d48e376..de4367d4 100644 --- a/0052-don-t-use-int-for-efi-status.patch +++ b/0048-don-t-use-int-for-efi-status.patch @@ -8,10 +8,10 @@ Subject: [PATCH] don't use int for efi status 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 05d8237a9b..ae9885edb8 100644 +index 885d7c6420e..2bb8a0e7a38 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -167,7 +167,7 @@ grub_reboot (void) +@@ -177,7 +177,7 @@ grub_reboot (void) void grub_exit (int retval) { diff --git a/0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch b/0049-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch similarity index 96% rename from 0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch rename to 0049-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch index fb71ea50..44c08198 100644 --- a/0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +++ b/0049-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch @@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes. 1 file changed, 2 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index b3753c9ca2..91933b85f2 100644 +index cd1f46c8bad..f2bf50eb98d 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -54,6 +54,7 @@ grub_mod_fini (void) diff --git a/0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0050-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch similarity index 92% rename from 0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch rename to 0050-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch index ae8a8c68..8dfb85fd 100644 --- a/0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +++ b/0050-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch @@ -16,10 +16,10 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index 84ed6e88ec..a2bec7446c 100644 +index d3ec2570d1d..66ef9494d9d 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -1190,18 +1190,8 @@ main (int argc, char *argv[]) +@@ -1234,18 +1234,8 @@ main (int argc, char *argv[]) char *d; is_guess = 1; diff --git a/0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch b/0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch deleted file mode 100644 index 2a3d27b1..00000000 --- a/0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 1 Jun 2017 10:06:38 -0400 -Subject: [PATCH] Use grub_efi_...() memory helpers where reasonable. - -This uses grub_efi_allocate_pool(), grub_efi_free_pool(), and -grub_efi_free_pages() instead of open-coded efi_call_N() calls, so we -get more reasonable type checking. - -Signed-off-by: Peter Jones ---- - grub-core/loader/efi/chainloader.c | 24 +++++++++--------------- - 1 file changed, 9 insertions(+), 15 deletions(-) - -diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 07c4937898..89ac84cc66 100644 ---- a/grub-core/loader/efi/chainloader.c -+++ b/grub-core/loader/efi/chainloader.c -@@ -65,7 +65,7 @@ grub_chainloader_unload (void) - - b = grub_efi_system_table->boot_services; - efi_call_1 (b->unload_image, image_handle); -- efi_call_2 (b->free_pages, address, pages); -+ grub_efi_free_pages (address, pages); - - grub_free (file_path); - grub_free (cmdline); -@@ -108,7 +108,7 @@ grub_chainloader_boot (void) - } - - if (exit_data) -- efi_call_1 (b->free_pool, exit_data); -+ grub_efi_free_pool (exit_data); - - grub_loader_unset (); - -@@ -527,10 +527,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) - static grub_efi_boolean_t - handle_image (void *data, grub_efi_uint32_t datasize) - { -- grub_efi_boot_services_t *b; - grub_efi_loaded_image_t *li, li_bak; - grub_efi_status_t efi_status; -- char *buffer = NULL; -+ void *buffer = NULL; - char *buffer_aligned = NULL; - grub_efi_uint32_t i; - struct grub_pe32_section_table *section; -@@ -541,8 +540,6 @@ handle_image (void *data, grub_efi_uint32_t datasize) - int found_entry_point = 0; - int rc; - -- b = grub_efi_system_table->boot_services; -- - rc = read_header (data, datasize, &context); - if (rc < 0) - { -@@ -582,8 +579,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) - grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n", - context.image_size, datasize); - -- efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA, -- buffer_size, &buffer); -+ efi_status = grub_efi_allocate_pool (GRUB_EFI_LOADER_DATA, buffer_size, -+ &buffer); - - if (efi_status != GRUB_EFI_SUCCESS) - { -@@ -815,14 +812,14 @@ handle_image (void *data, grub_efi_uint32_t datasize) - - grub_dprintf ("chain", "entry_point returned %ld\n", efi_status); - grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); -- efi_status = efi_call_1 (b->free_pool, buffer); -+ efi_status = grub_efi_free_pool (buffer); - - return 1; - - error_exit: - grub_dprintf ("chain", "error_exit: grub_errno: %d\n", grub_errno); - if (buffer) -- efi_call_1 (b->free_pool, buffer); -+ grub_efi_free_pool (buffer); - - return 0; - } -@@ -830,10 +827,7 @@ error_exit: - static grub_err_t - grub_secureboot_chainloader_unload (void) - { -- grub_efi_boot_services_t *b; -- -- b = grub_efi_system_table->boot_services; -- efi_call_2 (b->free_pages, address, pages); -+ grub_efi_free_pages (address, pages); - grub_free (file_path); - grub_free (cmdline); - cmdline = 0; -@@ -1100,7 +1094,7 @@ fail: - grub_free (file_path); - - if (address) -- efi_call_2 (b->free_pages, address, pages); -+ grub_efi_free_pages (address, pages); - - if (cmdline) - grub_free (cmdline); diff --git a/0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch b/0051-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch similarity index 85% rename from 0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch rename to 0051-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch index cd58ff45..026fe5e8 100644 --- a/0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +++ b/0051-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 5 insertions(+) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in -index e9e73b815f..c23b064be6 100644 +index efcded0fbb4..4ecf5deea17 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in -@@ -153,6 +153,7 @@ linux_entry_xsm () +@@ -156,6 +156,7 @@ linux_entry_xsm () else xen_rm_opts="no-real-mode edd=off" fi @@ -20,15 +20,15 @@ index e9e73b815f..c23b064be6 100644 ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} echo '$(echo "$lmessage" | grub_quote)' ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} -@@ -166,6 +167,7 @@ EOF - done - sed "s/^/$submenu_indentation/" << EOF +@@ -168,6 +169,7 @@ EOF + initrd_path="${rel_dirname}/${i}" + sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' + insmod ${xen_module} ${module_loader} --nounzip $(echo $initrd_path) EOF - fi -@@ -253,13 +255,16 @@ while [ "x${xen_list}" != "x" ] ; do + done +@@ -269,13 +271,16 @@ for current_xen in ${reverse_sorted_xen_list}; do echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" fi if ($grub_file --is-arm64-efi $current_xen); then diff --git a/0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch b/0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch deleted file mode 100644 index f649c8c4..00000000 --- a/0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 1 Jun 2017 10:07:50 -0400 -Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it. - -This avoids syntax checkers getting confused about if it's llx or lx. - -Signed-off-by: Peter Jones ---- - grub-core/loader/efi/chainloader.c | 3 ++- - include/grub/efi/api.h | 9 +++++++++ - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 89ac84cc66..ac8dfd40c6 100644 ---- a/grub-core/loader/efi/chainloader.c -+++ b/grub-core/loader/efi/chainloader.c -@@ -810,7 +810,8 @@ handle_image (void *data, grub_efi_uint32_t datasize) - efi_status = efi_call_2 (entry_point, grub_efi_image_handle, - grub_efi_system_table); - -- grub_dprintf ("chain", "entry_point returned %ld\n", efi_status); -+ grub_dprintf ("chain", "entry_point returned 0x%"PRIxGRUB_EFI_STATUS"\n", -+ efi_status); - grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); - efi_status = grub_efi_free_pool (buffer); - -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 117469450d..9962880147 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h -@@ -546,7 +546,16 @@ typedef grub_uint64_t grub_efi_uint64_t; - typedef grub_uint8_t grub_efi_char8_t; - typedef grub_uint16_t grub_efi_char16_t; - -+ - typedef grub_efi_uintn_t grub_efi_status_t; -+/* Make grub_efi_status_t reasonably printable. */ -+#if GRUB_CPU_SIZEOF_VOID_P == 8 -+#define PRIxGRUB_EFI_STATUS "lx" -+#define PRIdGRUB_EFI_STATUS "ld" -+#else -+#define PRIxGRUB_EFI_STATUS "llx" -+#define PRIdGRUB_EFI_STATUS "lld" -+#endif - - #define GRUB_EFI_ERROR_CODE(value) \ - ((((grub_efi_status_t) 1) << (sizeof (grub_efi_status_t) * 8 - 1)) | (value)) diff --git a/0057-align-struct-efi_variable-better.patch b/0052-align-struct-efi_variable-better.patch similarity index 91% rename from 0057-align-struct-efi_variable-better.patch rename to 0052-align-struct-efi_variable-better.patch index 361cb130..24c32375 100644 --- a/0057-align-struct-efi_variable-better.patch +++ b/0052-align-struct-efi_variable-better.patch @@ -9,7 +9,7 @@ Subject: [PATCH] align struct efi_variable better... 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h -index 36d2dedf47..9d93ba88ba 100644 +index 2ff42984545..6363fd522e1 100644 --- a/include/grub/efiemu/runtime.h +++ b/include/grub/efiemu/runtime.h @@ -33,5 +33,5 @@ struct efi_variable @@ -20,10 +20,10 @@ index 36d2dedf47..9d93ba88ba 100644 +} GRUB_PACKED GRUB_ALIGNED(8); #endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */ diff --git a/include/grub/types.h b/include/grub/types.h -index 0a3ff15913..ba446d9904 100644 +index 064066e2e18..59e030268c2 100644 --- a/include/grub/types.h +++ b/include/grub/types.h -@@ -29,6 +29,7 @@ +@@ -30,6 +30,7 @@ #else #define GRUB_PACKED __attribute__ ((packed)) #endif diff --git a/0058-Add-BLS-support-to-grub-mkconfig.patch b/0053-Add-BLS-support-to-grub-mkconfig.patch similarity index 96% rename from 0058-Add-BLS-support-to-grub-mkconfig.patch rename to 0053-Add-BLS-support-to-grub-mkconfig.patch index 3e5b230d..6b60ee76 100644 --- a/0058-Add-BLS-support-to-grub-mkconfig.patch +++ b/0053-Add-BLS-support-to-grub-mkconfig.patch @@ -33,7 +33,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 243 insertions(+), 6 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 535c0f0249..f55339a3f6 100644 +index 884e4d363ca..bec52e052fc 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@" @@ -63,7 +63,7 @@ index 535c0f0249..f55339a3f6 100644 -*) gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2 usage -@@ -253,7 +259,8 @@ export GRUB_DEFAULT \ +@@ -257,7 +263,8 @@ export GRUB_DEFAULT \ GRUB_OS_PROBER_SKIP_LIST \ GRUB_DISABLE_SUBMENU \ GRUB_DEFAULT_DTB \ @@ -74,7 +74,7 @@ index 535c0f0249..f55339a3f6 100644 if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 5e96f6cc5d..301d8a8a1e 100644 +index 0ba0e0e1c65..c2e107b41ab 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -30,6 +30,9 @@ fi @@ -131,10 +131,10 @@ index 5e96f6cc5d..301d8a8a1e 100644 fi IFS="$old_ifs" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 7bb3a211a7..2851952659 100644 +index 48ff32c1da4..cd9aea0cc01 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -82,6 +82,218 @@ case x"$GRUB_FS" in +@@ -84,6 +84,218 @@ case x"$GRUB_FS" in ;; esac @@ -353,7 +353,7 @@ index 7bb3a211a7..2851952659 100644 mktitle () { local title_type -@@ -121,6 +333,7 @@ linux_entry () +@@ -123,6 +335,7 @@ linux_entry () if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi @@ -361,15 +361,15 @@ index 7bb3a211a7..2851952659 100644 if [ x$type != xsimple ] ; then title=$(mktitle "$type" "$version") if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then -@@ -231,6 +444,7 @@ is_top_level=true - while [ "x$list" != "x" ] ; do - linux=`version_find_latest $list` +@@ -243,6 +456,7 @@ fi + is_top_level=true + for linux in ${reverse_sorted_list}; do gettext_printf "Found linux image: %s\n" "$linux" >&2 + basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` -@@ -269,7 +483,9 @@ while [ "x$list" != "x" ] ; do +@@ -283,7 +497,9 @@ for linux in ${reverse_sorted_list}; do for i in ${initrd}; do initrd_display="${initrd_display} ${dirname}/${i}" done diff --git a/0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch b/0054-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch similarity index 89% rename from 0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch rename to 0054-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch index 1ac900c1..4b925a58 100644 --- a/0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +++ b/0054-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch @@ -12,10 +12,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index a3e215155b..c60601b699 100644 +index 465a8e74ea7..b1d399d37d7 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -1201,7 +1201,7 @@ static void __attribute__ ((noreturn)) +@@ -1303,7 +1303,7 @@ void __attribute__ ((noreturn)) grub_abort (void) { #ifndef GRUB_UTIL diff --git a/0060-Add-grub2-switch-to-blscfg.patch b/0055-Add-grub2-switch-to-blscfg.patch similarity index 97% rename from 0060-Add-grub2-switch-to-blscfg.patch rename to 0055-Add-grub2-switch-to-blscfg.patch index e3161161..cb97a284 100644 --- a/0060-Add-grub2-switch-to-blscfg.patch +++ b/0055-Add-grub2-switch-to-blscfg.patch @@ -20,10 +20,10 @@ Signed-off-by: Robbie Harwood create mode 100644 util/grub-switch-to-blscfg.in diff --git a/Makefile.util.def b/Makefile.util.def -index 18a9242776..88f55e35c4 100644 +index 84a17ef5cfa..acbcc8c208c 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1348,6 +1348,13 @@ program = { +@@ -1387,6 +1387,13 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -39,14 +39,14 @@ index 18a9242776..88f55e35c4 100644 mansection = 1; diff --git a/docs/man/grub-switch-to-blscfg.h2m b/docs/man/grub-switch-to-blscfg.h2m new file mode 100644 -index 0000000000..fa341426a5 +index 00000000000..fa341426a50 --- /dev/null +++ b/docs/man/grub-switch-to-blscfg.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-switch-to-blscfg \- switch to using BLS config files diff --git a/util/grub-set-password.in b/util/grub-set-password.in -index 5ebf50576d..c0b5ebbfdc 100644 +index 5ebf50576d6..c0b5ebbfdc5 100644 --- a/util/grub-set-password.in +++ b/util/grub-set-password.in @@ -1,6 +1,6 @@ @@ -59,7 +59,7 @@ index 5ebf50576d..c0b5ebbfdc 100644 else diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in new file mode 100644 -index 0000000000..a851424beb +index 00000000000..a851424beb2 --- /dev/null +++ b/util/grub-switch-to-blscfg.in @@ -0,0 +1,317 @@ @@ -381,10 +381,10 @@ index 0000000000..a851424beb +# Bye. +exit 0 diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 2851952659..e490e1a43a 100644 +index cd9aea0cc01..b8bc37e92aa 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -138,7 +138,7 @@ blsdir="/boot/loader/entries" +@@ -140,7 +140,7 @@ blsdir="/boot/loader/entries" get_sorted_bls() { diff --git a/0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch b/0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch deleted file mode 100644 index beef0f3a..00000000 --- a/0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch +++ /dev/null @@ -1,211 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 7 Nov 2017 17:12:17 -0500 -Subject: [PATCH] Make pmtimer tsc calibration not take 51 seconds to fail. - -On my laptop running at 2.4GHz, if I run a VM where tsc calibration -using pmtimer will fail presuming a broken pmtimer, it takes ~51 seconds -to do so (as measured with the stopwatch on my phone), with a tsc delta -of 0x1cd1c85300, or around 125 billion cycles. - -If instead of trying to wait for 5-200ms to show up on the pmtimer, we try -to wait for 5-200us, it decides it's broken in ~0x2626aa0 TSCs, aka ~2.4 -million cycles, or more or less instantly. - -Additionally, this reading the pmtimer was returning 0xffffffff anyway, -and that's obviously an invalid return. I've added a check for that and -0 so we don't bother waiting for the test if what we're seeing is dead -pins with no response at all. - -If "debug" is includes "pmtimer", you will see one of the following -three outcomes. If pmtimer gives all 0 or all 1 bits, you will see: - -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 1 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 2 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 3 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 4 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 5 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 6 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 7 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 8 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 9 -kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 10 -kern/i386/tsc_pmtimer.c:78: timer is broken; giving up. - -This outcome was tested using qemu+kvm with UEFI (OVMF) firmware and -these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX - -If pmtimer gives any other bit patterns but is not actually marching -forward fast enough to use for clock calibration, you will see: - -kern/i386/tsc_pmtimer.c:121: pmtimer delta is 0x0 (1904 iterations) -kern/i386/tsc_pmtimer.c:124: tsc delta is implausible: 0x2626aa0 - -This outcome was tested using grub compiled with GRUB_PMTIMER_IGNORE_BAD_READS -defined (so as not to trip the bad read test) using qemu+kvm with UEFI -(OVMF) firmware, and these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX - -If pmtimer actually works, you'll see something like: - -kern/i386/tsc_pmtimer.c:121: pmtimer delta is 0x0 (1904 iterations) -kern/i386/tsc_pmtimer.c:124: tsc delta is implausible: 0x2626aa0 - -This outcome was tested using qemu+kvm with UEFI (OVMF) firmware, and -these options: -machine pc-i440fx-2.4 -cpu Broadwell-noTSX - -I've also tested this outcome on a real Intel Xeon E3-1275v3 on an Intel -Server Board S1200V3RPS using the SDV.RP.B8 "Release" build here: -https://firmware.intel.com/sites/default/files/UEFIDevKit_S1200RP_vB8.zip - -Signed-off-by: Peter Jones ---- - grub-core/kern/i386/tsc_pmtimer.c | 109 +++++++++++++++++++++++++++++++------- - 1 file changed, 89 insertions(+), 20 deletions(-) - -diff --git a/grub-core/kern/i386/tsc_pmtimer.c b/grub-core/kern/i386/tsc_pmtimer.c -index c9c3616997..ca15c3aacd 100644 ---- a/grub-core/kern/i386/tsc_pmtimer.c -+++ b/grub-core/kern/i386/tsc_pmtimer.c -@@ -28,40 +28,101 @@ - #include - #include - -+/* -+ * Define GRUB_PMTIMER_IGNORE_BAD_READS if you're trying to test a timer that's -+ * present but doesn't keep time well. -+ */ -+// #define GRUB_PMTIMER_IGNORE_BAD_READS -+ - grub_uint64_t - grub_pmtimer_wait_count_tsc (grub_port_t pmtimer, - grub_uint16_t num_pm_ticks) - { - grub_uint32_t start; -- grub_uint32_t last; -- grub_uint32_t cur, end; -+ grub_uint64_t cur, end; - grub_uint64_t start_tsc; - grub_uint64_t end_tsc; -- int num_iter = 0; -+ unsigned int num_iter = 0; -+#ifndef GRUB_PMTIMER_IGNORE_BAD_READS -+ int bad_reads = 0; -+#endif - -- start = grub_inl (pmtimer) & 0xffffff; -- last = start; -+ /* -+ * Some timers are 24-bit and some are 32-bit, but it doesn't make much -+ * difference to us. Caring which one we have isn't really worth it since -+ * the low-order digits will give us enough data to calibrate TSC. So just -+ * mask the top-order byte off. -+ */ -+ cur = start = grub_inl (pmtimer) & 0xffffffUL; - end = start + num_pm_ticks; - start_tsc = grub_get_tsc (); - while (1) - { -- cur = grub_inl (pmtimer) & 0xffffff; -- if (cur < last) -- cur |= 0x1000000; -- num_iter++; -+ cur &= 0xffffffffff000000ULL; -+ cur |= grub_inl (pmtimer) & 0xffffffUL; -+ -+ end_tsc = grub_get_tsc(); -+ -+#ifndef GRUB_PMTIMER_IGNORE_BAD_READS -+ /* -+ * If we get 10 reads in a row that are obviously dead pins, there's no -+ * reason to do this thousands of times. -+ */ -+ if (cur == 0xffffffUL || cur == 0) -+ { -+ bad_reads++; -+ grub_dprintf ("pmtimer", -+ "pmtimer: 0x%"PRIxGRUB_UINT64_T" bad_reads: %d\n", -+ cur, bad_reads); -+ grub_dprintf ("pmtimer", "timer is broken; giving up.\n"); -+ -+ if (bad_reads == 10) -+ return 0; -+ } -+#endif -+ -+ if (cur < start) -+ cur += 0x1000000; -+ - if (cur >= end) - { -- end_tsc = grub_get_tsc (); -+ grub_dprintf ("pmtimer", "pmtimer delta is 0x%"PRIxGRUB_UINT64_T"\n", -+ cur - start); -+ grub_dprintf ("pmtimer", "tsc delta is 0x%"PRIxGRUB_UINT64_T"\n", -+ end_tsc - start_tsc); - return end_tsc - start_tsc; - } -- /* Check for broken PM timer. -- 50000000 TSCs is between 5 ms (10GHz) and 200 ms (250 MHz) -- if after this time we still don't have 1 ms on pmtimer, then -- pmtimer is broken. -+ -+ /* -+ * Check for broken PM timer. 1ms at 10GHz should be 1E+7 TSCs; at -+ * 250MHz it should be 2.5E6. So if after 4E+7 TSCs on a 10GHz machine, -+ * we should have seen pmtimer show 4ms of change (i.e. cur =~ -+ * start+14320); on a 250MHz machine that should be 16ms (start+57280). -+ * If after this a time we still don't have 1ms on pmtimer, then pmtimer -+ * is broken. -+ * -+ * Likewise, if our code is perfectly efficient and introduces no delays -+ * whatsoever, on a 10GHz system we should see a TSC delta of 3580 in -+ * ~3580 iterations. On a 250MHz machine that should be ~900 iterations. -+ * -+ * With those factors in mind, there are two limits here. There's a hard -+ * limit here at 8x our desired pm timer delta, picked as an arbitrarily -+ * large value that's still not a lot of time to humans, because if we -+ * get that far this is either an implausibly fast machine or the pmtimer -+ * is not running. And there's another limit on 4x our 10GHz tsc delta -+ * without seeing cur converge on our target value. - */ -- if ((num_iter & 0xffffff) == 0 && grub_get_tsc () - start_tsc > 5000000) { -- return 0; -- } -+ if ((++num_iter > (grub_uint32_t)num_pm_ticks << 3UL) || -+ end_tsc - start_tsc > 40000000) -+ { -+ grub_dprintf ("pmtimer", -+ "pmtimer delta is 0x%"PRIxGRUB_UINT64_T" (%u iterations)\n", -+ cur - start, num_iter); -+ grub_dprintf ("pmtimer", -+ "tsc delta is implausible: 0x%"PRIxGRUB_UINT64_T"\n", -+ end_tsc - start_tsc); -+ return 0; -+ } - } - } - -@@ -74,12 +135,20 @@ grub_tsc_calibrate_from_pmtimer (void) - - fadt = grub_acpi_find_fadt (); - if (!fadt) -- return 0; -+ { -+ grub_dprintf ("pmtimer", "No FADT found; not using pmtimer.\n"); -+ return 0; -+ } - pmtimer = fadt->pmtimer; - if (!pmtimer) -- return 0; -+ { -+ grub_dprintf ("pmtimer", "FADT does not specify pmtimer; skipping.\n"); -+ return 0; -+ } - -- /* It's 3.579545 MHz clock. Wait 1 ms. */ -+ /* -+ * It's 3.579545 MHz clock. Wait 1 ms. -+ */ - tsc_diff = grub_pmtimer_wait_count_tsc (pmtimer, 3580); - if (tsc_diff == 0) - return 0; diff --git a/0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch b/0056-normal-don-t-draw-our-startup-message-if-debug-is-se.patch similarity index 87% rename from 0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch rename to 0056-normal-don-t-draw-our-startup-message-if-debug-is-se.patch index a9162990..7b261665 100644 --- a/0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +++ b/0056-normal-don-t-draw-our-startup-message-if-debug-is-se.patch @@ -8,7 +8,7 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set 1 file changed, 3 insertions(+) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 55558cc0b9..af9792c963 100644 +index 3463f444f74..b5fa6156549 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -430,6 +430,9 @@ grub_normal_reader_init (int nested) @@ -20,4 +20,4 @@ index 55558cc0b9..af9792c963 100644 + msg_formatted = grub_xasprintf (_("Minimal BASH-like line editing is supported. For " "the first word, TAB lists possible command completions. Anywhere " - "else TAB lists possible device or file completions. %s"), + "else TAB lists possible device or file completions. To enable " diff --git a/0063-Work-around-some-minor-include-path-weirdnesses.patch b/0057-Work-around-some-minor-include-path-weirdnesses.patch similarity index 97% rename from 0063-Work-around-some-minor-include-path-weirdnesses.patch rename to 0057-Work-around-some-minor-include-path-weirdnesses.patch index c7ae8d01..460d7927 100644 --- a/0063-Work-around-some-minor-include-path-weirdnesses.patch +++ b/0057-Work-around-some-minor-include-path-weirdnesses.patch @@ -17,7 +17,7 @@ Signed-off-by: Peter Jones diff --git a/include/grub/arm/efi/console.h b/include/grub/arm/efi/console.h new file mode 100644 -index 0000000000..1592f6f76b +index 00000000000..1592f6f76b5 --- /dev/null +++ b/include/grub/arm/efi/console.h @@ -0,0 +1,24 @@ @@ -47,7 +47,7 @@ index 0000000000..1592f6f76b +#endif /* ! GRUB_ARM_EFI_CONSOLE_H */ diff --git a/include/grub/arm64/efi/console.h b/include/grub/arm64/efi/console.h new file mode 100644 -index 0000000000..9568933938 +index 00000000000..95689339384 --- /dev/null +++ b/include/grub/arm64/efi/console.h @@ -0,0 +1,24 @@ @@ -77,7 +77,7 @@ index 0000000000..9568933938 +#endif /* ! GRUB_ARM64_EFI_CONSOLE_H */ diff --git a/include/grub/i386/efi/console.h b/include/grub/i386/efi/console.h new file mode 100644 -index 0000000000..9231375cb0 +index 00000000000..9231375cb07 --- /dev/null +++ b/include/grub/i386/efi/console.h @@ -0,0 +1,24 @@ @@ -107,7 +107,7 @@ index 0000000000..9231375cb0 +#endif /* ! GRUB_I386_EFI_CONSOLE_H */ diff --git a/include/grub/x86_64/efi/console.h b/include/grub/x86_64/efi/console.h new file mode 100644 -index 0000000000..dba9d8678d +index 00000000000..dba9d8678d0 --- /dev/null +++ b/include/grub/x86_64/efi/console.h @@ -0,0 +1,24 @@ diff --git a/0064-Make-it-possible-to-enabled-build-id-sha1.patch b/0058-Make-it-possible-to-enabled-build-id-sha1.patch similarity index 93% rename from 0064-Make-it-possible-to-enabled-build-id-sha1.patch rename to 0058-Make-it-possible-to-enabled-build-id-sha1.patch index 99d80552..201081d5 100644 --- a/0064-Make-it-possible-to-enabled-build-id-sha1.patch +++ b/0058-Make-it-possible-to-enabled-build-id-sha1.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac -index 0d0e6782a1..302300711f 100644 +index 3602b4ab62b..fcfbcbb664d 100644 --- a/configure.ac +++ b/configure.ac -@@ -1442,7 +1442,15 @@ grub_PROG_TARGET_CC +@@ -1540,7 +1540,15 @@ grub_PROG_TARGET_CC if test "x$TARGET_APPLE_LINKER" != x1 ; then grub_PROG_OBJCOPY_ABSOLUTE fi @@ -30,7 +30,7 @@ index 0d0e6782a1..302300711f 100644 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then if test ! -z "$TARGET_IMG_LDSCRIPT"; then diff --git a/acinclude.m4 b/acinclude.m4 -index 6e14bb553c..21238fcfd0 100644 +index fa7840f09af..0231e64e337 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then diff --git a/0061-make-better-backtraces.patch b/0059-make-better-backtraces.patch similarity index 93% rename from 0061-make-better-backtraces.patch rename to 0059-make-better-backtraces.patch index 7fdcaf74..d7f64a66 100644 --- a/0061-make-better-backtraces.patch +++ b/0059-make-better-backtraces.patch @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones grub-core/kern/i386/backtrace.c | 125 ++++++++++++++++++++++++++++++++ grub-core/kern/i386/pc/init.c | 4 +- grub-core/kern/ieee1275/init.c | 1 - - grub-core/kern/misc.c | 13 ++-- + grub-core/kern/misc.c | 11 +-- grub-core/kern/mm.c | 6 +- grub-core/lib/arm64/backtrace.c | 62 ---------------- grub-core/lib/i386/backtrace.c | 78 -------------------- @@ -29,7 +29,7 @@ Signed-off-by: Peter Jones grub-core/kern/ia64/efi/startup.S | 3 +- grub-core/kern/sparc64/ieee1275/crt0.S | 3 +- grub-core/Makefile.am | 1 + - 24 files changed, 414 insertions(+), 167 deletions(-) + 24 files changed, 413 insertions(+), 166 deletions(-) rename grub-core/{lib => commands}/backtrace.c (98%) create mode 100644 grub-core/kern/arm64/backtrace.c create mode 100644 grub-core/kern/backtrace.c @@ -38,7 +38,7 @@ Signed-off-by: Peter Jones delete mode 100644 grub-core/lib/i386/backtrace.c diff --git a/Makefile.util.def b/Makefile.util.def -index 88f55e35c4..bda9fd1211 100644 +index acbcc8c208c..1079add5bbe 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -51,6 +51,12 @@ library = { @@ -55,10 +55,10 @@ index 88f55e35c4..bda9fd1211 100644 library = { diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 058c88ac3a..52ec0fafcd 100644 +index 63f053b3add..6645fbae34f 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -142,6 +142,12 @@ kernel = { +@@ -153,6 +153,12 @@ kernel = { common = kern/rescue_reader.c; common = kern/term.c; common = kern/verifiers.c; @@ -71,7 +71,7 @@ index 058c88ac3a..52ec0fafcd 100644 noemu = kern/compiler-rt.c; noemu = kern/mm.c; -@@ -188,9 +194,6 @@ kernel = { +@@ -199,9 +205,6 @@ kernel = { softdiv = lib/division.c; @@ -81,7 +81,7 @@ index 058c88ac3a..52ec0fafcd 100644 i386 = kern/i386/dl.c; i386_xen = kern/i386/dl.c; i386_xen_pvh = kern/i386/dl.c; -@@ -2399,15 +2402,12 @@ module = { +@@ -2455,15 +2458,12 @@ module = { module = { name = backtrace; @@ -103,7 +103,7 @@ diff --git a/grub-core/lib/backtrace.c b/grub-core/commands/backtrace.c similarity index 98% rename from grub-core/lib/backtrace.c rename to grub-core/commands/backtrace.c -index c0ad6ab8be..8b5ec3913b 100644 +index c0ad6ab8be1..8b5ec3913b5 100644 --- a/grub-core/lib/backtrace.c +++ b/grub-core/commands/backtrace.c @@ -54,7 +54,7 @@ grub_cmd_backtrace (grub_command_t cmd __attribute__ ((unused)), @@ -116,7 +116,7 @@ index c0ad6ab8be..8b5ec3913b 100644 } diff --git a/grub-core/gdb/cstub.c b/grub-core/gdb/cstub.c -index b64acd70fe..99281472d3 100644 +index b64acd70fee..99281472d36 100644 --- a/grub-core/gdb/cstub.c +++ b/grub-core/gdb/cstub.c @@ -215,7 +215,6 @@ grub_gdb_trap (int trap_no) @@ -129,7 +129,7 @@ index b64acd70fe..99281472d3 100644 diff --git a/grub-core/kern/arm64/backtrace.c b/grub-core/kern/arm64/backtrace.c new file mode 100644 -index 0000000000..019c6fdfef +index 00000000000..019c6fdfef2 --- /dev/null +++ b/grub-core/kern/arm64/backtrace.c @@ -0,0 +1,94 @@ @@ -229,7 +229,7 @@ index 0000000000..019c6fdfef +} diff --git a/grub-core/kern/backtrace.c b/grub-core/kern/backtrace.c new file mode 100644 -index 0000000000..4a82e865cc +index 00000000000..4a82e865cc6 --- /dev/null +++ b/grub-core/kern/backtrace.c @@ -0,0 +1,97 @@ @@ -331,10 +331,10 @@ index 0000000000..4a82e865cc + grub_backtrace (skip + 1); +} diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 7afb9e6f72..88d2077709 100644 +index 0bf40caa61a..931f6e41442 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c -@@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name) +@@ -115,6 +115,50 @@ grub_dl_resolve_symbol (const char *name) return 0; } @@ -385,7 +385,7 @@ index 7afb9e6f72..88d2077709 100644 /* Register a symbol with the name NAME and the address ADDR. */ grub_err_t grub_dl_register_symbol (const char *name, void *addr, int isfunc, -@@ -336,6 +380,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) +@@ -330,6 +374,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) const char *str; Elf_Word size, entsize; @@ -395,7 +395,7 @@ index 7afb9e6f72..88d2077709 100644 i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) diff --git a/grub-core/kern/i386/backtrace.c b/grub-core/kern/i386/backtrace.c new file mode 100644 -index 0000000000..2413f9a57d +index 00000000000..2413f9a57db --- /dev/null +++ b/grub-core/kern/i386/backtrace.c @@ -0,0 +1,125 @@ @@ -525,7 +525,7 @@ index 0000000000..2413f9a57d +#endif +} diff --git a/grub-core/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c -index 27bc68b8a5..b51d0abfa6 100644 +index 326d491c586..fe7ad14d45c 100644 --- a/grub-core/kern/i386/pc/init.c +++ b/grub-core/kern/i386/pc/init.c @@ -153,7 +153,7 @@ compact_mem_regions (void) @@ -537,7 +537,7 @@ index 27bc68b8a5..b51d0abfa6 100644 /* Helper for grub_machine_init. */ static int -@@ -217,7 +217,7 @@ grub_machine_init (void) +@@ -226,7 +226,7 @@ grub_machine_init (void) /* This has to happen before any BIOS calls. */ grub_via_workaround_init (); @@ -547,27 +547,23 @@ index 27bc68b8a5..b51d0abfa6 100644 /* Initialize the console as early as possible. */ grub_console_init (); diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 0cd2a62723..937c1bc44c 100644 +index 51c1e1c9d9f..c4d6962197b 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -63,7 +63,6 @@ - #define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024) - #endif +@@ -70,7 +70,6 @@ + */ + #define RUNTIME_MIN_SPACE (128UL * 1024 * 1024) -extern char _start[]; extern char _end[]; #ifdef __sparc__ diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index c60601b699..a432a6be54 100644 +index b1d399d37d7..779586658cb 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -1197,15 +1197,15 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) - - - /* Abort GRUB. This function does not return. */ --static void __attribute__ ((noreturn)) -+static inline void __attribute__ ((noreturn)) +@@ -1302,12 +1302,12 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) + void __attribute__ ((noreturn)) grub_abort (void) { -#ifndef GRUB_UTIL @@ -584,7 +580,7 @@ index c60601b699..a432a6be54 100644 #ifndef GRUB_UTIL if (grub_term_inputs) -@@ -1232,6 +1232,7 @@ grub_fatal (const char *fmt, ...) +@@ -1334,6 +1334,7 @@ grub_fatal (const char *fmt, ...) { va_list ap; @@ -593,10 +589,10 @@ index c60601b699..a432a6be54 100644 grub_vprintf (_(fmt), ap); va_end (ap); diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index c070afc621..d8c8377578 100644 +index 027a25cd1f0..1aeeba9e27e 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c -@@ -97,13 +97,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) +@@ -144,13 +144,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) break; if (! *r) @@ -615,7 +611,7 @@ index c070afc621..d8c8377578 100644 diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c deleted file mode 100644 -index 1079b5380e..0000000000 +index 1079b5380e1..00000000000 --- a/grub-core/lib/arm64/backtrace.c +++ /dev/null @@ -1,62 +0,0 @@ @@ -683,7 +679,7 @@ index 1079b5380e..0000000000 - diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c deleted file mode 100644 -index c67273db3a..0000000000 +index c67273db3ae..00000000000 --- a/grub-core/lib/i386/backtrace.c +++ /dev/null @@ -1,78 +0,0 @@ @@ -766,7 +762,7 @@ index c67273db3a..0000000000 -} - diff --git a/include/grub/backtrace.h b/include/grub/backtrace.h -index 395519762f..275cf85e2d 100644 +index 395519762f0..275cf85e2d3 100644 --- a/include/grub/backtrace.h +++ b/include/grub/backtrace.h @@ -19,8 +19,14 @@ @@ -787,10 +783,10 @@ index 395519762f..275cf85e2d 100644 #endif diff --git a/include/grub/dl.h b/include/grub/dl.h -index 91933b85f2..2f76e6b043 100644 +index f2bf50eb98d..8a3d188d1d1 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h -@@ -259,6 +259,8 @@ grub_dl_is_persistent (grub_dl_t mod) +@@ -258,6 +258,8 @@ grub_dl_is_persistent (grub_dl_t mod) #endif @@ -800,7 +796,7 @@ index 91933b85f2..2f76e6b043 100644 int isfunc, grub_dl_t mod); diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index abbca5ea33..300a9766cd 100644 +index abbca5ea335..300a9766cda 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -111,6 +111,9 @@ grub_addr_t grub_modules_get_end (void); @@ -814,7 +810,7 @@ index abbca5ea33..300a9766cd 100644 void grub_main (void) __attribute__ ((noreturn)); diff --git a/grub-core/kern/arm/efi/startup.S b/grub-core/kern/arm/efi/startup.S -index 9f8265315a..f3bc41f9d0 100644 +index 9f8265315a9..f3bc41f9d0f 100644 --- a/grub-core/kern/arm/efi/startup.S +++ b/grub-core/kern/arm/efi/startup.S @@ -23,6 +23,8 @@ @@ -827,7 +823,7 @@ index 9f8265315a..f3bc41f9d0 100644 /* * EFI_SYSTEM_TABLE and EFI_HANDLE are passed in r1/r0. diff --git a/grub-core/kern/arm/startup.S b/grub-core/kern/arm/startup.S -index 3946fe8e18..5679a1d00a 100644 +index 3946fe8e183..5679a1d00ad 100644 --- a/grub-core/kern/arm/startup.S +++ b/grub-core/kern/arm/startup.S @@ -48,6 +48,8 @@ @@ -840,7 +836,7 @@ index 3946fe8e18..5679a1d00a 100644 b codestart diff --git a/grub-core/kern/arm64/efi/startup.S b/grub-core/kern/arm64/efi/startup.S -index 666a7ee3c9..41676bdb2b 100644 +index 666a7ee3c92..41676bdb2b8 100644 --- a/grub-core/kern/arm64/efi/startup.S +++ b/grub-core/kern/arm64/efi/startup.S @@ -19,7 +19,9 @@ @@ -854,7 +850,7 @@ index 666a7ee3c9..41676bdb2b 100644 /* * EFI_SYSTEM_TABLE and EFI_HANDLE are passed in x1/x0. diff --git a/grub-core/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S -index 0d89858d9b..939f182fc7 100644 +index 0d89858d9b3..939f182fc74 100644 --- a/grub-core/kern/i386/qemu/startup.S +++ b/grub-core/kern/i386/qemu/startup.S @@ -24,7 +24,8 @@ @@ -868,7 +864,7 @@ index 0d89858d9b..939f182fc7 100644 jmp codestart diff --git a/grub-core/kern/ia64/efi/startup.S b/grub-core/kern/ia64/efi/startup.S -index d75c6d7cc7..8f2a593e52 100644 +index d75c6d7cc74..8f2a593e529 100644 --- a/grub-core/kern/ia64/efi/startup.S +++ b/grub-core/kern/ia64/efi/startup.S @@ -24,8 +24,9 @@ @@ -883,7 +879,7 @@ index d75c6d7cc7..8f2a593e52 100644 alloc loc0=ar.pfs,2,4,0,0 mov loc1=rp diff --git a/grub-core/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S -index 03b916f053..701bf63abc 100644 +index 03b916f0534..701bf63abcf 100644 --- a/grub-core/kern/sparc64/ieee1275/crt0.S +++ b/grub-core/kern/sparc64/ieee1275/crt0.S @@ -22,7 +22,8 @@ @@ -897,7 +893,7 @@ index 03b916f053..701bf63abc 100644 ba codestart mov %o4, %o0 diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index ee88e44e97..bfd29a3bf0 100644 +index f18550c1c98..b7192a3da82 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h diff --git a/0060-Fixup-for-newer-compiler.patch b/0060-Fixup-for-newer-compiler.patch new file mode 100644 index 00000000..b0c1966d --- /dev/null +++ b/0060-Fixup-for-newer-compiler.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 10 May 2018 13:40:19 -0400 +Subject: [PATCH] Fixup for newer compiler + +--- + grub-core/fs/btrfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 87e4dd1a07a..ad35e75750b 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -218,7 +218,7 @@ struct grub_btrfs_inode + grub_uint64_t size; + grub_uint8_t dummy2[0x70]; + struct grub_btrfs_time mtime; +-} GRUB_PACKED; ++} GRUB_PACKED __attribute__ ((aligned(8))); + + struct grub_btrfs_extent_data + { diff --git a/0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch b/0061-Don-t-attempt-to-export-the-start-and-_start-symbols.patch similarity index 97% rename from 0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch rename to 0061-Don-t-attempt-to-export-the-start-and-_start-symbols.patch index 9b78c00c..0e925eef 100644 --- a/0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +++ b/0061-Don-t-attempt-to-export-the-start-and-_start-symbols.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+) diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index 300a9766cd..55849777ea 100644 +index 300a9766cda..55849777eaa 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -111,8 +111,10 @@ grub_addr_t grub_modules_get_end (void); diff --git a/0069-Fixup-for-newer-compiler.patch b/0062-Fixup-for-newer-compiler.patch similarity index 79% rename from 0069-Fixup-for-newer-compiler.patch rename to 0062-Fixup-for-newer-compiler.patch index 167dca18..0d495c14 100644 --- a/0069-Fixup-for-newer-compiler.patch +++ b/0062-Fixup-for-newer-compiler.patch @@ -8,15 +8,15 @@ Subject: [PATCH] Fixup for newer compiler 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.common -index 191b1a70c6..5f0ef96985 100644 +index ece9ed8a1bf..6262f21a772 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common -@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding +@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) -STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx +STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes - - CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding - LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d + if !COND_emu + if COND_HAVE_ASM_USCORE + LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free diff --git a/0070-Add-support-for-non-Ethernet-network-cards.patch b/0063-Add-support-for-non-Ethernet-network-cards.patch similarity index 90% rename from 0070-Add-support-for-non-Ethernet-network-cards.patch rename to 0063-Add-support-for-non-Ethernet-network-cards.patch index fb446288..95ea8fc9 100644 --- a/0070-Add-support-for-non-Ethernet-network-cards.patch +++ b/0063-Add-support-for-non-Ethernet-network-cards.patch @@ -23,22 +23,22 @@ Signed-off-by: Andrzej Kacprowski [msalter: Fix max string calculation in grub_net_hwaddr_to_str] Signed-off-by: Mark Salter --- - grub-core/net/arp.c | 155 ++++++++++++++++++++++----------- + grub-core/net/arp.c | 156 ++++++++++++++++++++++----------- grub-core/net/bootp.c | 15 ++-- grub-core/net/drivers/efi/efinet.c | 8 +- grub-core/net/drivers/emu/emunet.c | 1 + grub-core/net/drivers/i386/pc/pxe.c | 13 +-- grub-core/net/drivers/ieee1275/ofnet.c | 2 + grub-core/net/drivers/uboot/ubootnet.c | 1 + - grub-core/net/ethernet.c | 88 +++++++++---------- + grub-core/net/ethernet.c | 89 +++++++++---------- grub-core/net/icmp6.c | 15 ++-- grub-core/net/ip.c | 4 +- grub-core/net/net.c | 50 ++++++----- include/grub/net.h | 19 ++-- - 12 files changed, 219 insertions(+), 152 deletions(-) + 12 files changed, 220 insertions(+), 153 deletions(-) diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c -index 54306e3b16..67b409a8ac 100644 +index 1d367436cfc..8bf0a06e193 100644 --- a/grub-core/net/arp.c +++ b/grub-core/net/arp.c @@ -31,22 +31,12 @@ enum @@ -137,7 +137,7 @@ index 54306e3b16..67b409a8ac 100644 nbd = nb.data; send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP); -@@ -114,28 +124,53 @@ grub_err_t +@@ -114,30 +124,56 @@ grub_err_t grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, grub_uint16_t *vlantag) { @@ -177,33 +177,36 @@ index 54306e3b16..67b409a8ac 100644 + + /* The source protocol address. */ sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; -+ grub_memcpy(&sender_addr.ipv4, tmp_ptr, pln); -+ tmp_ptr += pln; -+ -+ grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1); -+ -+ /* The target hardware address. */ -+ tmp_ptr += hln; -+ -+ /* The target protocol address. */ - target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; +- target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; - sender_addr.ipv4 = arp_packet->sender_ip; - target_addr.ipv4 = arp_packet->recv_ip; + sender_addr.option = 0; + target_addr.option = 0; - if (arp_packet->sender_ip == pending_req) -+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln); -+ -+ if (sender_addr.ipv4 == pending_req) - have_pending = 1; +- have_pending = 1; - sender_mac_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; - grub_memcpy (sender_mac_addr.mac, arp_packet->sender_mac, - sizeof (sender_mac_addr.mac)); -- grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1); -- ++ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln); ++ tmp_ptr += pln; ++ + grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1); + ++ /* The target hardware address. */ ++ tmp_ptr += hln; ++ ++ /* The target protocol address. */ ++ target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; ++ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln); ++ ++ if (sender_addr.ipv4 == pending_req) ++ have_pending = 1; ++ FOR_NET_NETWORK_LEVEL_INTERFACES (inf) { /* Verify vlantag id */ -@@ -148,11 +183,11 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, +@@ -150,11 +186,11 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, /* Am I the protocol address target? */ if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 @@ -217,7 +220,7 @@ index 54306e3b16..67b409a8ac 100644 grub_uint8_t arp_data[128]; grub_err_t err; -@@ -161,25 +196,39 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, +@@ -163,25 +199,39 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, grub_netbuff_clear (&nb_reply); grub_netbuff_reserve (&nb_reply, 128); @@ -271,10 +274,10 @@ index 54306e3b16..67b409a8ac 100644 /* Change operation to REPLY and send packet */ send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index e28fb6a09f..08b6b2b5d6 100644 +index e0aec25233d..76e4c11a46f 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c -@@ -233,7 +233,6 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -325,7 +325,6 @@ grub_net_configure_by_dhcp_ack (const char *name, int is_def, char **device, char **path) { grub_net_network_level_address_t addr; @@ -282,7 +285,7 @@ index e28fb6a09f..08b6b2b5d6 100644 struct grub_net_network_level_interface *inter; int mask = -1; char server_ip[sizeof ("xxx.xxx.xxx.xxx")]; -@@ -250,12 +249,8 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -343,12 +342,8 @@ grub_net_configure_by_dhcp_ack (const char *name, if (path) *path = 0; @@ -297,7 +300,7 @@ index e28fb6a09f..08b6b2b5d6 100644 if (!inter) return 0; -@@ -567,7 +562,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) +@@ -660,7 +655,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) grub_memset (pack, 0, sizeof (*pack)); pack->opcode = 1; pack->hw_type = 1; @@ -308,20 +311,20 @@ index e28fb6a09f..08b6b2b5d6 100644 err = grub_get_datetime (&date); if (err || !grub_datetime2unixtime (&date, &t)) { -@@ -580,7 +577,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) +@@ -673,7 +670,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface) else pack->ident = iface->xid; - grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, 6); + grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, pack->hw_len); - grub_netbuff_push (nb, sizeof (*udph)); - + err = grub_netbuff_push (nb, sizeof (*udph)); + if (err) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 173fb63153..a673bea807 100644 +index 3e2432fb61c..7deb0a32efd 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -279,6 +279,9 @@ grub_efinet_findcards (void) +@@ -288,6 +288,9 @@ grub_efinet_findcards (void) /* This should not happen... Why? */ continue; @@ -329,12 +332,12 @@ index 173fb63153..a673bea807 100644 + continue; + if (net->mode->state == GRUB_EFI_NETWORK_STOPPED - && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS) + && net->start (net) != GRUB_EFI_SUCCESS) continue; -@@ -315,10 +318,11 @@ grub_efinet_findcards (void) - card->name = grub_xasprintf ("efinet%d", i++); - card->driver = &efidriver; - card->flags = 0; +@@ -332,10 +335,11 @@ grub_efinet_findcards (void) + * such as LoadFile2 for initrd loading. + */ + card->flags = GRUB_NET_CARD_NO_CLOSE_ON_FINI_HW; - card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; + card->default_address.type = net->mode->if_type; + card->default_address.len = net->mode->hwaddr_size; @@ -346,7 +349,7 @@ index 173fb63153..a673bea807 100644 card->efi_handle = *handle; diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c -index b194920861..5b6c5e16a6 100644 +index 5f311d40f49..7461d13bbc2 100644 --- a/grub-core/net/drivers/emu/emunet.c +++ b/grub-core/net/drivers/emu/emunet.c @@ -46,6 +46,7 @@ static struct grub_net_card emucard = @@ -358,7 +361,7 @@ index b194920861..5b6c5e16a6 100644 }, .flags = 0 diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c -index 3f4152d036..9f8fb4b6d2 100644 +index db17186ee7d..816d1d0eeda 100644 --- a/grub-core/net/drivers/i386/pc/pxe.c +++ b/grub-core/net/drivers/i386/pc/pxe.c @@ -386,20 +386,21 @@ GRUB_MOD_INIT(pxe) @@ -390,7 +393,7 @@ index 3f4152d036..9f8fb4b6d2 100644 grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c -index 3860b6f78d..bcb3f9ea02 100644 +index 78f03df8e21..c56461ff1ae 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -160,6 +160,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath, @@ -401,7 +404,7 @@ index 3860b6f78d..bcb3f9ea02 100644 args = bootpath + grub_strlen (devpath) + 1; do -@@ -503,6 +504,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias) +@@ -491,6 +492,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias) grub_memcpy (&lla.mac, pprop, 6); lla.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; @@ -410,7 +413,7 @@ index 3860b6f78d..bcb3f9ea02 100644 card->txbufsize = ALIGN_UP (card->mtu, 64) + 256; diff --git a/grub-core/net/drivers/uboot/ubootnet.c b/grub-core/net/drivers/uboot/ubootnet.c -index 056052e40d..22ebcbf211 100644 +index b9d5a0cd494..9f3354a1b74 100644 --- a/grub-core/net/drivers/uboot/ubootnet.c +++ b/grub-core/net/drivers/uboot/ubootnet.c @@ -131,6 +131,7 @@ GRUB_MOD_INIT (ubootnet) @@ -422,7 +425,7 @@ index 056052e40d..22ebcbf211 100644 card->txbufsize = ALIGN_UP (card->mtu, 64) + 256; card->txbuf = grub_zalloc (card->txbufsize); diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c -index 4d7ceed6f9..9aae83a5eb 100644 +index 707bbb12cb2..1441a1bacff 100644 --- a/grub-core/net/ethernet.c +++ b/grub-core/net/ethernet.c @@ -29,13 +29,6 @@ @@ -447,7 +450,7 @@ index 4d7ceed6f9..9aae83a5eb 100644 + grub_uint8_t *eth; grub_err_t err; - grub_uint8_t etherhdr_size; -- grub_uint16_t vlantag_id = VLANTAG_IDENTIFIER; +- grub_uint16_t vlantag_id = grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER); + grub_uint32_t vlantag = 0; + grub_uint8_t hw_addr_len = inf->card->default_address.len; + grub_uint8_t etherhdr_size = 2 * hw_addr_len + 2; @@ -487,7 +490,7 @@ index 4d7ceed6f9..9aae83a5eb 100644 if (!inf->card->opened) { err = GRUB_ERR_NONE; -@@ -85,18 +91,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, +@@ -85,19 +91,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, inf->card->opened = 1; } @@ -499,14 +502,15 @@ index 4d7ceed6f9..9aae83a5eb 100644 - (char *) nb->data + etherhdr_size - 6, 2); - - /* Add the tag in the middle */ +- grub_uint16_t vlan = grub_cpu_to_be16 (inf->vlantag); - grub_memcpy ((char *) nb->data + etherhdr_size - 6, &vlantag_id, 2); -- grub_memcpy ((char *) nb->data + etherhdr_size - 4, (char *) &(inf->vlantag), 2); +- grub_memcpy ((char *) nb->data + etherhdr_size - 4, &vlan, 2); - } - return inf->card->driver->send (inf->card, nb); } -@@ -104,31 +98,40 @@ grub_err_t +@@ -105,31 +98,40 @@ grub_err_t grub_net_recv_ethernet_packet (struct grub_net_buff *nb, struct grub_net_card *card) { @@ -528,7 +532,7 @@ index 4d7ceed6f9..9aae83a5eb 100644 - /* Check if a vlan-tag is present. If so, the ethernet header is 4 bytes */ - /* longer than the original one. The vlantag id is extracted and the header */ - /* is reseted to the original size. */ -- if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == VLANTAG_IDENTIFIER) +- if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER)) + hwaddress.type = card->default_address.type; + hwaddress.len = hw_addr_len; + grub_memcpy (hwaddress.mac, eth, hw_addr_len); @@ -542,7 +546,7 @@ index 4d7ceed6f9..9aae83a5eb 100644 + type = grub_be_to_cpu16 (*(grub_uint16_t*)(eth)); + if (type == VLANTAG_IDENTIFIER) { -- vlantag = grub_get_unaligned16 (nb->data + etherhdr_size); +- vlantag = grub_be_to_cpu16 (grub_get_unaligned16 (nb->data + etherhdr_size)); + /* Skip vlan tag */ + eth += 2; + vlantag = grub_be_to_cpu16 (*(grub_uint16_t*)(eth)); @@ -559,7 +563,7 @@ index 4d7ceed6f9..9aae83a5eb 100644 err = grub_netbuff_pull (nb, etherhdr_size); if (err) return err; -@@ -148,11 +151,6 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, +@@ -149,11 +151,6 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, } } @@ -572,7 +576,7 @@ index 4d7ceed6f9..9aae83a5eb 100644 { /* ARP packet. */ diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c -index 2cbd95dce2..56a3ec5c8e 100644 +index 9a8c4511285..5924fd53aca 100644 --- a/grub-core/net/icmp6.c +++ b/grub-core/net/icmp6.c @@ -231,8 +231,9 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb, @@ -612,10 +616,10 @@ index 2cbd95dce2..56a3ec5c8e 100644 } if (ohdr->type == OPTION_PREFIX && ohdr->len == 4) diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index ea5edf8f1f..a5896f6dc2 100644 +index f967618e53f..3c475762cc0 100644 --- a/grub-core/net/ip.c +++ b/grub-core/net/ip.c -@@ -276,8 +276,8 @@ handle_dgram (struct grub_net_buff *nb, +@@ -316,8 +316,8 @@ handle_dgram (struct grub_net_buff *nb, if (inf->card == card && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV && inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET @@ -627,7 +631,7 @@ index ea5edf8f1f..a5896f6dc2 100644 grub_net_process_dhcp (nb, inf); grub_netbuff_free (nb); diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 22f2689aae..a46f82362e 100644 +index 20c55257647..fa6b6537142 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -133,8 +133,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, @@ -650,7 +654,7 @@ index 22f2689aae..a46f82362e 100644 hw_addr->mac[0] = 0x33; hw_addr->mac[1] = 0x33; hw_addr->mac[2] = ((grub_be_to_cpu64 (proto_addr->ipv6[1]) >> 24) & 0xff); -@@ -762,23 +764,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf) +@@ -772,23 +774,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf) void grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str) { @@ -688,8 +692,8 @@ index 22f2689aae..a46f82362e 100644 - grub_printf (_("Unsupported hw address type %d\n"), addr->type); } - int -@@ -789,13 +791,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a, + void +@@ -813,13 +815,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a, return -1; if (a->type > b->type) return +1; @@ -713,7 +717,7 @@ index 22f2689aae..a46f82362e 100644 int diff --git a/include/grub/net.h b/include/grub/net.h -index 8a05ec4fe7..af0404db7e 100644 +index ff901b96e22..1d76fd9a1f5 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -29,7 +29,8 @@ @@ -728,7 +732,7 @@ index 8a05ec4fe7..af0404db7e 100644 GRUB_NET_OUR_IPV4_HEADER_SIZE = 20, @@ -42,15 +43,17 @@ enum - typedef enum grub_link_level_protocol_id + typedef enum grub_link_level_protocol_id { - GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET + /* IANA ARP constant to define hardware type. */ @@ -746,7 +750,7 @@ index 8a05ec4fe7..af0404db7e 100644 }; } grub_net_link_level_address_t; -@@ -566,11 +569,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a, +@@ -588,11 +591,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a, #define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX") /* @@ -762,5 +766,5 @@ index 8a05ec4fe7..af0404db7e 100644 + "XX:XX:XX:XX:XX:XX:XX:XX:"\ + "XX:XX:XX:XX:XX:XX:XX:XX")) - void - grub_net_addr_to_str (const grub_net_network_level_address_t *target, + /* Max VLAN id = 4094 */ + #define GRUB_NET_MAX_STR_VLAN_LEN (sizeof ("vlanXXXX")) diff --git a/0073-efinet-UEFI-IPv6-PXE-support.patch b/0064-efinet-UEFI-IPv6-PXE-support.patch similarity index 92% rename from 0073-efinet-UEFI-IPv6-PXE-support.patch rename to 0064-efinet-UEFI-IPv6-PXE-support.patch index 988c1784..2d8a3ae4 100644 --- a/0073-efinet-UEFI-IPv6-PXE-support.patch +++ b/0064-efinet-UEFI-IPv6-PXE-support.patch @@ -15,12 +15,12 @@ Signed-off-by: Ken Lin 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 8e25680db0..014e5bf980 100644 +index 7deb0a32efd..92bb7444782 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -430,6 +430,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, grub_print_error (); - if (device && path) + if (inter && device && path) grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); + if (grub_errno) + grub_print_error (); @@ -28,10 +28,10 @@ index 8e25680db0..014e5bf980 100644 else { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 7614b58dca..91ab528e4d 100644 +index daa9268fdaa..53f5c781ac3 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -1524,31 +1524,6 @@ typedef union +@@ -1571,31 +1571,6 @@ typedef union grub_efi_pxe_dhcpv6_packet_t dhcpv6; } grub_efi_pxe_packet_t; @@ -63,7 +63,7 @@ index 7614b58dca..91ab528e4d 100644 typedef struct grub_efi_pxe_icmp_error { grub_efi_uint8_t type; -@@ -1574,6 +1549,48 @@ typedef struct grub_efi_pxe_tftp_error +@@ -1621,6 +1596,48 @@ typedef struct grub_efi_pxe_tftp_error grub_efi_char8_t error_string[127]; } grub_efi_pxe_tftp_error_t; @@ -112,7 +112,7 @@ index 7614b58dca..91ab528e4d 100644 typedef struct grub_efi_pxe_mode { grub_efi_boolean_t started; -@@ -1605,9 +1622,9 @@ typedef struct grub_efi_pxe_mode +@@ -1652,9 +1669,9 @@ typedef struct grub_efi_pxe_mode grub_efi_pxe_packet_t pxe_bis_reply; grub_efi_pxe_ip_filter_t ip_filter; grub_efi_uint32_t arp_cache_entries; diff --git a/0074-grub.texi-Add-net_bootp6-doument.patch b/0065-grub.texi-Add-net_bootp6-doument.patch similarity index 88% rename from 0074-grub.texi-Add-net_bootp6-doument.patch rename to 0065-grub.texi-Add-net_bootp6-doument.patch index b42e09bf..72863180 100644 --- a/0074-grub.texi-Add-net_bootp6-doument.patch +++ b/0065-grub.texi-Add-net_bootp6-doument.patch @@ -12,10 +12,10 @@ Signed-off-by: Ken Lin 1 file changed, 17 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 0615d0ed97..04ed6ac1f0 100644 +index c30701b4e1f..44c4e665a0d 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5487,6 +5487,7 @@ This command is only available on AArch64 systems. +@@ -5955,6 +5955,7 @@ Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}). * net_add_dns:: Add a DNS server * net_add_route:: Add routing entry * net_bootp:: Perform a bootp/DHCP autoconfiguration @@ -23,7 +23,7 @@ index 0615d0ed97..04ed6ac1f0 100644 * net_del_addr:: Remove IP address from interface * net_del_dns:: Remove a DNS server * net_del_route:: Remove a route entry -@@ -5611,6 +5612,22 @@ Sets environment variable @samp{net_}@var{}@samp{_boot_file} +@@ -6080,6 +6081,22 @@ Sets environment variable @samp{net_}@var{}@samp{_boot_file} @end deffn diff --git a/0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch deleted file mode 100644 index ccf34a50..00000000 --- a/0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 25 Jun 2015 15:11:36 -0400 -Subject: [PATCH] Make a "gdb" dprintf that tells us load addresses. - -This makes a grub_dprintf() call during platform init and during module -loading that tells us the virtual addresses of the .text and .data -sections of grub-core/kernel.exec and any modules it loads. - -Specifically, it displays them in the gdb "add-symbol-file" syntax, with -the presumption that there's a variable $grubdir that reflects the path -to any such binaries. - -Signed-off-by: Peter Jones ---- - grub-core/kern/dl.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++ - grub-core/kern/efi/efi.c | 4 ++-- - grub-core/kern/efi/init.c | 26 +++++++++++++++++++++++- - include/grub/efi/efi.h | 2 +- - 4 files changed, 78 insertions(+), 4 deletions(-) - -diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 88d2077709..9557254035 100644 ---- a/grub-core/kern/dl.c -+++ b/grub-core/kern/dl.c -@@ -501,6 +501,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) - return s; - return NULL; - } -+static long -+grub_dl_find_section_index (Elf_Ehdr *e, const char *name) -+{ -+ Elf_Shdr *s; -+ const char *str; -+ unsigned i; -+ -+ s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); -+ str = (char *) e + s->sh_offset; -+ -+ for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); -+ i < e->e_shnum; -+ i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) -+ if (grub_strcmp (str + s->sh_name, name) == 0) -+ return (long)i; -+ return -1; -+} - - /* Me, Vladimir Serbinenko, hereby I add this module check as per new - GNU module policy. Note that this license check is informative only. -@@ -653,6 +670,37 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) - - return GRUB_ERR_NONE; - } -+static void -+grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e) -+{ -+ void *text, *data = NULL; -+ long idx; -+ -+ idx = grub_dl_find_section_index (e, ".text"); -+ if (idx < 0) -+ return; -+ -+ text = grub_dl_get_section_addr (mod, idx); -+ if (!text) -+ return; -+ -+ idx = grub_dl_find_section_index (e, ".data"); -+ if (idx >= 0) -+ data = grub_dl_get_section_addr (mod, idx); -+ -+ if (data) -+ grub_qdprintf ("gdb", "add-symbol-file \\\n" -+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " -+ "\\\n %p -s .data %p\n", -+ GRUB_TARGET_CPU, GRUB_PLATFORM, -+ mod->name, text, data); -+ else -+ grub_qdprintf ("gdb", "add-symbol-file \\\n" -+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " -+ "\\\n%p\n", -+ GRUB_TARGET_CPU, GRUB_PLATFORM, -+ mod->name, text); -+} - - /* Load a module from core memory. */ - grub_dl_t -@@ -712,6 +760,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) - grub_dprintf ("modules", "module name: %s\n", mod->name); - grub_dprintf ("modules", "init function: %p\n", mod->init); - -+ grub_dl_print_gdb_info (mod, e); -+ - if (grub_dl_add (mod)) - { - grub_dl_unload (mod); -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index ae9885edb8..d6a2fb5778 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -296,7 +296,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, - /* Search the mods section from the PE32/PE32+ image. This code uses - a PE32 header, but should work with PE32+ as well. */ - grub_addr_t --grub_efi_modules_addr (void) -+grub_efi_section_addr (const char *section_name) - { - grub_efi_loaded_image_t *image; - struct grub_pe32_header *header; -@@ -321,7 +321,7 @@ grub_efi_modules_addr (void) - i < coff_header->num_sections; - i++, section++) - { -- if (grub_strcmp (section->name, "mods") == 0) -+ if (grub_strcmp (section->name, section_name) == 0) - break; - } - -diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 6d39bd3ad2..2d12e6188f 100644 ---- a/grub-core/kern/efi/init.c -+++ b/grub-core/kern/efi/init.c -@@ -115,10 +115,33 @@ grub_efi_env_init (void) - grub_free (envblk_s.buf); - } - -+static void -+grub_efi_print_gdb_info (void) -+{ -+ grub_addr_t text; -+ grub_addr_t data; -+ -+ text = grub_efi_section_addr (".text"); -+ if (!text) -+ return; -+ -+ data = grub_efi_section_addr (".data"); -+ if (data) -+ grub_qdprintf ("gdb", -+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/" -+ "kernel.exec %p -s .data %p\n", -+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text, (void *)data); -+ else -+ grub_qdprintf ("gdb", -+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/" -+ "kernel.exec %p\n", -+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text); -+} -+ - void - grub_efi_init (void) - { -- grub_modbase = grub_efi_modules_addr (); -+ grub_modbase = grub_efi_section_addr ("mods"); - /* First of all, initialize the console so that GRUB can display - messages. */ - grub_console_init (); -@@ -142,6 +165,7 @@ grub_efi_init (void) - 0, 0, 0, NULL); - - grub_efi_env_init (); -+ grub_efi_print_gdb_info (); - grub_efidisk_init (); - } - -diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 03f9a9d011..2e0691454b 100644 ---- a/include/grub/efi/efi.h -+++ b/include/grub/efi/efi.h -@@ -138,7 +138,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); - grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args); - #endif - --grub_addr_t grub_efi_modules_addr (void); -+grub_addr_t grub_efi_section_addr (const char *section); - - void grub_efi_mm_init (void); - void grub_efi_mm_fini (void); diff --git a/0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0066-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch similarity index 95% rename from 0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch rename to 0066-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch index abff9eb2..7109c4e3 100644 --- a/0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +++ b/0066-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch @@ -22,7 +22,7 @@ Signed-off-by: Ken Lin 2 files changed, 56 insertions(+) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index fe93b80f1c..8fb8918ae7 100644 +index 76e4c11a46f..f56b293ac72 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -20,6 +20,7 @@ @@ -33,7 +33,7 @@ index fe93b80f1c..8fb8918ae7 100644 #include #include #include -@@ -500,6 +501,60 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -501,6 +502,60 @@ grub_net_configure_by_dhcp_ack (const char *name, if (opt && opt_len) grub_env_set_net_property (name, "rootpath", (const char *) opt, opt_len); @@ -95,10 +95,10 @@ index fe93b80f1c..8fb8918ae7 100644 if (opt && opt_len) grub_env_set_net_property (name, "extensionspath", (const char *) opt, opt_len); diff --git a/include/grub/net.h b/include/grub/net.h -index 543251f727..42af7de250 100644 +index 1d76fd9a1f5..868c9a2ef29 100644 --- a/include/grub/net.h +++ b/include/grub/net.h -@@ -531,6 +531,7 @@ enum +@@ -533,6 +533,7 @@ enum GRUB_NET_DHCP_MESSAGE_TYPE = 53, GRUB_NET_DHCP_SERVER_IDENTIFIER = 54, GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55, diff --git a/0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch b/0067-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch similarity index 93% rename from 0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch rename to 0067-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch index f20f5c79..4d843714 100644 --- a/0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +++ b/0067-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 8fb8918ae7..7baf3540c8 100644 +index f56b293ac72..9cbdc2264c9 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -329,7 +329,7 @@ grub_net_configure_by_dhcp_ack (const char *name, @@ -26,7 +26,7 @@ index 8fb8918ae7..7baf3540c8 100644 grub_uint8_t opt_len, overload = 0; const char *boot_file = 0, *server_name = 0; grub_size_t boot_file_len, server_name_len; -@@ -505,7 +505,7 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -506,7 +506,7 @@ grub_net_configure_by_dhcp_ack (const char *name, if (opt && opt_len) { grub_env_set_net_property (name, "vendor_class_identifier", (const char *) opt, opt_len); diff --git a/0067-Fixup-for-newer-compiler.patch b/0067-Fixup-for-newer-compiler.patch deleted file mode 100644 index ed23271e..00000000 --- a/0067-Fixup-for-newer-compiler.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 10 May 2018 13:40:19 -0400 -Subject: [PATCH] Fixup for newer compiler - ---- - grub-core/fs/btrfs.c | 2 +- - include/grub/gpt_partition.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 2b21cbaa67..4cc86e9b79 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -218,7 +218,7 @@ struct grub_btrfs_inode - grub_uint64_t size; - grub_uint8_t dummy2[0x70]; - struct grub_btrfs_time mtime; --} GRUB_PACKED; -+} GRUB_PACKED __attribute__ ((aligned(8))); - - struct grub_btrfs_extent_data - { -diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h -index 7a93f43291..8212697bf6 100644 ---- a/include/grub/gpt_partition.h -+++ b/include/grub/gpt_partition.h -@@ -76,7 +76,7 @@ struct grub_gpt_partentry - grub_uint64_t end; - grub_uint64_t attrib; - char name[72]; --} GRUB_PACKED; -+} GRUB_PACKED __attribute__ ((aligned(8))); - - grub_err_t - grub_gpt_partition_map_iterate (grub_disk_t disk, diff --git a/0076-efinet-Setting-network-from-UEFI-device-path.patch b/0068-efinet-Setting-network-from-UEFI-device-path.patch similarity index 89% rename from 0076-efinet-Setting-network-from-UEFI-device-path.patch rename to 0068-efinet-Setting-network-from-UEFI-device-path.patch index f4faf270..71536301 100644 --- a/0076-efinet-Setting-network-from-UEFI-device-path.patch +++ b/0068-efinet-Setting-network-from-UEFI-device-path.patch @@ -27,12 +27,12 @@ the same way it used to be. Signed-off-by: Michael Chang Signed-off-by: Ken Lin --- - grub-core/net/drivers/efi/efinet.c | 284 +++++++++++++++++++++++++++++++++++-- + grub-core/net/drivers/efi/efinet.c | 286 ++++++++++++++++++++++++++++++++++--- include/grub/efi/api.h | 11 ++ - 2 files changed, 280 insertions(+), 15 deletions(-) + 2 files changed, 281 insertions(+), 16 deletions(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 014e5bf980..8171ecaa5e 100644 +index 92bb7444782..eb68de22023 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -26,6 +26,7 @@ @@ -43,7 +43,7 @@ index 014e5bf980..8171ecaa5e 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -331,6 +332,227 @@ grub_efinet_findcards (void) +@@ -348,6 +349,227 @@ grub_efinet_findcards (void) grub_free (handles); } @@ -271,7 +271,7 @@ index 014e5bf980..8171ecaa5e 100644 static void grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, char **path) -@@ -346,7 +568,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -367,7 +589,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, { grub_efi_device_path_t *cdp; struct grub_efi_pxe *pxe; @@ -284,7 +284,7 @@ index 014e5bf980..8171ecaa5e 100644 if (card->driver != &efidriver) continue; -@@ -370,11 +596,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -391,11 +617,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, */ if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE @@ -307,7 +307,7 @@ index 014e5bf980..8171ecaa5e 100644 dup_ldp = grub_efi_find_last_device_path (dup_dp); dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -@@ -387,23 +623,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -408,23 +644,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, pxe = grub_efi_open_protocol (hnd, &pxe_io_guid, GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); @@ -347,38 +347,45 @@ index 014e5bf980..8171ecaa5e 100644 + pxe_mode->dhcp_ack_received ? "yes" : "no", + pxe_mode->dhcp_ack_received ? "" : " cannot continue"); - grub_net_configure_by_dhcpv6_reply (card->name, card, 0, - (struct grub_net_dhcp6_packet *) -- &pxe_mode->dhcp_ack, -- sizeof (pxe_mode->dhcp_ack), -+ packet_buf, -+ packet_bufsz, - 1, device, path); + inter = grub_net_configure_by_dhcpv6_reply (card->name, card, 0, + (struct grub_net_dhcp6_packet *) +- &pxe_mode->dhcp_ack, +- sizeof (pxe_mode->dhcp_ack), ++ packet_buf, ++ packet_bufsz, + 1, device, path); if (grub_errno) grub_print_error (); -@@ -417,11 +667,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -438,8 +688,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, grub_dprintf ("efinet", "using ipv4 and dhcp\n"); - grub_net_configure_by_dhcp_ack (card->name, card, 0, - (struct grub_net_bootp_packet *) -- &pxe_mode->dhcp_ack, -- sizeof (pxe_mode->dhcp_ack), -+ packet_buf, -+ packet_bufsz, - 1, device, path); + inter = grub_net_configure_by_dhcp_ack (card->name, card, 0, + (struct grub_net_bootp_packet *) +- &pxe_mode->dhcp_ack, +- sizeof (pxe_mode->dhcp_ack), ++ packet_buf, ++ packet_bufsz, + 1, device, path); + grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); +@@ -465,8 +715,12 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len); + } + } +- return; } + + if (nb) + grub_netbuff_free (nb); + - return; ++ return; } } + diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 91ab528e4d..4a51667adb 100644 +index 53f5c781ac3..fa528e73a27 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -864,6 +864,8 @@ struct grub_efi_ipv4_device_path +@@ -891,6 +891,8 @@ struct grub_efi_ipv4_device_path grub_efi_uint16_t remote_port; grub_efi_uint16_t protocol; grub_efi_uint8_t static_ip_address; @@ -387,9 +394,9 @@ index 91ab528e4d..4a51667adb 100644 } GRUB_PACKED; typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t; -@@ -918,6 +920,15 @@ struct grub_efi_sata_device_path +@@ -954,6 +956,15 @@ struct grub_efi_vlan_device_path } GRUB_PACKED; - typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t; + typedef struct grub_efi_vlan_device_path grub_efi_vlan_device_path_t; +#define GRUB_EFI_URI_DEVICE_PATH_SUBTYPE 24 + diff --git a/0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0069-efinet-Setting-DNS-server-from-UEFI-protocol.patch similarity index 84% rename from 0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch rename to 0069-efinet-Setting-DNS-server-from-UEFI-protocol.patch index 2d92ff07..43d2df03 100644 --- a/0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch +++ b/0069-efinet-Setting-DNS-server-from-UEFI-protocol.patch @@ -29,34 +29,34 @@ Signed-off-by: Michael Chang Signed-off-by: Ken Lin --- grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++ - include/grub/efi/api.h | 75 +++++++++++++++++ - 2 files changed, 238 insertions(+) + include/grub/efi/api.h | 76 +++++++++++++++++ + 2 files changed, 239 insertions(+) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 8171ecaa5e..715a6168d7 100644 +index eb68de22023..a91df09ee6d 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); /* GUID. */ - static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID; - static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; -+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID; -+static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID; + static grub_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID; + static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; ++static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID; ++static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID; static grub_err_t send_card_buffer (struct grub_net_card *dev, -@@ -332,6 +334,125 @@ grub_efinet_findcards (void) +@@ -349,6 +351,125 @@ grub_efinet_findcards (void) grub_free (handles); } +static grub_efi_handle_t -+grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path, ++grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path, + grub_efi_device_path_t **r_device_path) +{ + grub_efi_handle_t handle; + grub_efi_status_t status; + -+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path, ++ status = grub_efi_system_table->boot_services->locate_device_path( + protocol, &device_path, &handle); + + if (status != GRUB_EFI_SUCCESS) @@ -92,9 +92,9 @@ index 8171ecaa5e..715a6168d7 100644 + if (!addrs) + return 0; + -+ status = efi_call_4 (conf->get_data, conf, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, -+ &data_size, addrs); ++ status = conf->get_data(conf, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, ++ &data_size, addrs); + + if (status == GRUB_EFI_BUFFER_TOO_SMALL) + { @@ -103,9 +103,9 @@ index 8171ecaa5e..715a6168d7 100644 + if (!addrs) + return 0; + -+ status = efi_call_4 (conf->get_data, conf, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, -+ &data_size, addrs); ++ status = conf->get_data(conf, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, ++ &data_size, addrs); + } + + if (status != GRUB_EFI_SUCCESS) @@ -142,9 +142,9 @@ index 8171ecaa5e..715a6168d7 100644 + if (!addrs) + return 0; + -+ status = efi_call_4 (conf->get_data, conf, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, -+ &data_size, addrs); ++ status = conf->get_data(conf, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, ++ &data_size, addrs); + + if (status == GRUB_EFI_BUFFER_TOO_SMALL) + { @@ -153,9 +153,9 @@ index 8171ecaa5e..715a6168d7 100644 + if (!addrs) + return 0; + -+ status = efi_call_4 (conf->get_data, conf, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, -+ &data_size, addrs); ++ status = conf->get_data(conf, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, ++ &data_size, addrs); + } + + if (status != GRUB_EFI_SUCCESS) @@ -171,7 +171,7 @@ index 8171ecaa5e..715a6168d7 100644 static struct grub_net_buff * grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6) { -@@ -390,6 +511,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -407,6 +528,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp; struct grub_net_bootp_packet *bp; grub_uint8_t *ptr; @@ -180,7 +180,7 @@ index 8171ecaa5e..715a6168d7 100644 bp = (struct grub_net_bootp_packet *) nb->tail; err = grub_netbuff_put (nb, sizeof (*bp) + 4); -@@ -451,6 +574,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -468,6 +591,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u *ptr++ = sizeof ("HTTPClient") - 1; grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1); @@ -206,7 +206,7 @@ index 8171ecaa5e..715a6168d7 100644 ptr = nb->tail; err = grub_netbuff_put (nb, 1); if (err) -@@ -483,6 +625,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -500,6 +642,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u struct grub_net_dhcp6_option *opt; struct grub_net_dhcp6_option_iana *iana; struct grub_net_dhcp6_option_iaaddr *iaaddr; @@ -215,7 +215,7 @@ index 8171ecaa5e..715a6168d7 100644 d6p = (struct grub_net_dhcp6_packet *)nb->tail; err = grub_netbuff_put (nb, sizeof(*d6p)); -@@ -546,6 +690,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -563,6 +707,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u opt->len = grub_cpu_to_be16 (uri_len); grub_memcpy (opt->data, uri_dp->uri, uri_len); @@ -242,14 +242,13 @@ index 8171ecaa5e..715a6168d7 100644 } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 4a51667adb..0b490195ad 100644 +index fa528e73a27..248d6a28ff9 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -352,6 +352,15 @@ - #define GRUB_EFI_RNG_PROTOCOL_GUID \ - { 0x3152bca5, 0xeade, 0x433d, \ +@@ -369,6 +369,16 @@ { 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \ -+ + } + +#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \ + { 0x5b446ed1, 0xe30b, 0x4faa, \ + { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ @@ -258,12 +257,14 @@ index 4a51667adb..0b490195ad 100644 +#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \ + { 0x937fe521, 0x95ae, 0x4d1a, \ + { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \ - } - - struct grub_efi_sal_system_table -@@ -1883,6 +1892,72 @@ struct grub_efi_rng_protocol ++ } ++ + #define LINUX_EFI_INITRD_MEDIA_GUID \ + { 0x5568e427, 0x68fc, 0x4f3d, \ + { 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68 } \ +@@ -1963,6 +1973,72 @@ struct grub_efi_load_file2 }; - typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t; + typedef struct grub_efi_load_file2 grub_efi_load_file2_t; +enum grub_efi_ip4_config2_data_type { + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, @@ -331,6 +332,6 @@ index 4a51667adb..0b490195ad 100644 +}; +typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t; + - #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ - || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ - || defined(__riscv) + struct initrd_media_device_path { + grub_efi_vendor_media_device_path_t vendor; + grub_efi_device_path_t end; diff --git a/0078-Support-UEFI-networking-protocols.patch b/0070-Support-UEFI-networking-protocols.patch similarity index 94% rename from 0078-Support-UEFI-networking-protocols.patch rename to 0070-Support-UEFI-networking-protocols.patch index 145becfd..efa3659a 100644 --- a/0078-Support-UEFI-networking-protocols.patch +++ b/0070-Support-UEFI-networking-protocols.patch @@ -33,18 +33,18 @@ Signed-off-by: Peter Jones grub-core/net/drivers/efi/efinet.c | 27 + grub-core/net/efi/dhcp.c | 397 ++++++++++ grub-core/net/efi/efi_netfs.c | 57 ++ - grub-core/net/efi/http.c | 419 +++++++++++ + grub-core/net/efi/http.c | 410 +++++++++++ grub-core/net/efi/ip4_config.c | 398 ++++++++++ grub-core/net/efi/ip6_config.c | 422 +++++++++++ grub-core/net/efi/net.c | 1428 ++++++++++++++++++++++++++++++++++++ grub-core/net/efi/pxe.c | 424 +++++++++++ grub-core/net/net.c | 74 ++ util/grub-mknetdir.c | 23 +- - include/grub/efi/api.h | 180 ++++- + include/grub/efi/api.h | 195 ++++- include/grub/efi/dhcp.h | 343 +++++++++ include/grub/efi/http.h | 215 ++++++ include/grub/net/efi.h | 144 ++++ - 17 files changed, 4620 insertions(+), 41 deletions(-) + 17 files changed, 4618 insertions(+), 49 deletions(-) create mode 100644 grub-core/net/efi/dhcp.c create mode 100644 grub-core/net/efi/efi_netfs.c create mode 100644 grub-core/net/efi/http.c @@ -57,10 +57,10 @@ Signed-off-by: Peter Jones create mode 100644 include/grub/net/efi.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 52ec0fafcd..12797336c9 100644 +index 6645fbae34f..56eb6a828e8 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2300,6 +2300,12 @@ module = { +@@ -2356,6 +2356,12 @@ module = { common = hook/datehook.c; }; @@ -73,7 +73,7 @@ index 52ec0fafcd..12797336c9 100644 module = { name = net; common = net/net.c; -@@ -2313,6 +2319,12 @@ module = { +@@ -2369,6 +2375,12 @@ module = { common = net/ethernet.c; common = net/arp.c; common = net/netbuff.c; @@ -87,7 +87,7 @@ index 52ec0fafcd..12797336c9 100644 module = { diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c -index a458c3aca7..1637731535 100644 +index a458c3aca78..1637731535e 100644 --- a/grub-core/io/bufio.c +++ b/grub-core/io/bufio.c @@ -139,7 +139,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len) @@ -100,10 +100,10 @@ index a458c3aca7..1637731535 100644 if (file->offset + res < next_buf) { diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index d6a2fb5778..2a446f5031 100644 +index 2bb8a0e7a38..bf16c4307bc 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -755,7 +755,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -775,7 +775,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) { grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) dp; @@ -112,7 +112,7 @@ index d6a2fb5778..2a446f5031 100644 (unsigned) ipv4->local_ip_address[0], (unsigned) ipv4->local_ip_address[1], (unsigned) ipv4->local_ip_address[2], -@@ -768,33 +768,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -788,33 +788,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) (unsigned) ipv4->remote_port, (unsigned) ipv4->protocol, (unsigned) ipv4->static_ip_address); @@ -190,7 +190,7 @@ index d6a2fb5778..2a446f5031 100644 } break; case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE: -@@ -834,6 +861,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -861,6 +888,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) dump_vendor_path ("Messaging", (grub_efi_vendor_device_path_t *) dp); break; @@ -231,7 +231,7 @@ index d6a2fb5778..2a446f5031 100644 grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype); break; diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 715a6168d7..e11d759f19 100644 +index a91df09ee6d..225dc896da0 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -27,6 +27,7 @@ @@ -242,7 +242,7 @@ index 715a6168d7..e11d759f19 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -491,6 +492,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -508,6 +509,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u ldp = grub_efi_find_last_device_path (ddp); @@ -260,7 +260,7 @@ index 715a6168d7..e11d759f19 100644 if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) -@@ -760,6 +772,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -781,6 +793,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE @@ -268,7 +268,7 @@ index 715a6168d7..e11d759f19 100644 && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)) continue; dup_dp = grub_efi_duplicate_device_path (dp); -@@ -774,6 +787,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -795,6 +808,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, dup_ldp->length = sizeof (*dup_ldp); } @@ -284,7 +284,7 @@ index 715a6168d7..e11d759f19 100644 dup_ldp = grub_efi_find_last_device_path (dup_dp); dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -@@ -845,6 +867,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -889,6 +911,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, GRUB_MOD_INIT(efinet) { @@ -294,8 +294,8 @@ index 715a6168d7..e11d759f19 100644 grub_efinet_findcards (); grub_efi_net_config = grub_efi_net_config_real; } -@@ -856,5 +881,7 @@ GRUB_MOD_FINI(efinet) - FOR_NET_CARDS_SAFE (card, next) +@@ -900,5 +925,7 @@ GRUB_MOD_FINI(efinet) + FOR_NET_CARDS_SAFE (card, next) if (card->driver == &efidriver) grub_net_card_unregister (card); + @@ -304,7 +304,7 @@ index 715a6168d7..e11d759f19 100644 diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c new file mode 100644 -index 0000000000..dbef63d8c0 +index 00000000000..ca19902441b --- /dev/null +++ b/grub-core/net/efi/dhcp.c @@ -0,0 +1,397 @@ @@ -385,7 +385,7 @@ index 0000000000..dbef63d8c0 + grub_efi_uint32_t option_count = 0; + grub_efi_uint32_t i; + -+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, NULL); ++ status = dhcp4->parse(dhcp4, reply_packet, &option_count, NULL); + + if (status != GRUB_EFI_BUFFER_TOO_SMALL) + return NULL; @@ -394,7 +394,7 @@ index 0000000000..dbef63d8c0 + if (!option_list) + return NULL; + -+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, option_list); ++ status = dhcp4->parse(dhcp4, reply_packet, &option_count, option_list); + if (status != GRUB_EFI_SUCCESS) + { + grub_free (option_list); @@ -443,13 +443,13 @@ index 0000000000..dbef63d8c0 + + if (!mode->started) + { -+ status = efi_call_2 (pxe->start, pxe, 0); ++ status = pxe->start(pxe, 0); + + if (status != GRUB_EFI_SUCCESS) + grub_printf ("Couldn't start PXE\n"); + } + -+ status = efi_call_2 (pxe->dhcp, pxe, 0); ++ status = pxe->dhcp(pxe, 0); + if (status != GRUB_EFI_SUCCESS) + { + grub_printf ("dhcp4 configure failed, %d\n", (int)status); @@ -500,7 +500,7 @@ index 0000000000..dbef63d8c0 + config.option_list = &options; + + /* FIXME: What if the dhcp has bounded */ -+ status = efi_call_2 (netdev->dhcp4->configure, netdev->dhcp4, &config); ++ status = netdev->dhcp4->configure(netdev->dhcp4, &config); + grub_free (options); + if (status != GRUB_EFI_SUCCESS) + { @@ -508,14 +508,14 @@ index 0000000000..dbef63d8c0 + continue; + } + -+ status = efi_call_2 (netdev->dhcp4->start, netdev->dhcp4, NULL); ++ status = netdev->dhcp4->start(netdev->dhcp4, NULL); + if (status != GRUB_EFI_SUCCESS) + { + grub_printf ("dhcp4 start failed, %d\n", (int)status); + continue; + } + -+ status = efi_call_2 (netdev->dhcp4->get_mode_data, netdev->dhcp4, &mode); ++ status = netdev->dhcp4->get_mode_data(netdev->dhcp4, &mode); + if (status != GRUB_EFI_SUCCESS) + { + grub_printf ("dhcp4 get mode failed, %d\n", (int)status); @@ -616,21 +616,21 @@ index 0000000000..dbef63d8c0 + config.rapid_commit = 0; + config.solicit_retransmission = &retrans; + -+ status = efi_call_2 (dev->dhcp6->configure, dev->dhcp6, &config); ++ status = dev->dhcp6->configure(dev->dhcp6, &config); + grub_free (opt); + if (status != GRUB_EFI_SUCCESS) + { + grub_printf ("dhcp6 configure failed, %d\n", (int)status); + continue; + } -+ status = efi_call_1 (dev->dhcp6->start, dev->dhcp6); ++ status = dev->dhcp6->start(dev->dhcp6); + if (status != GRUB_EFI_SUCCESS) + { + grub_printf ("dhcp6 start failed, %d\n", (int)status); + continue; + } + -+ status = efi_call_3 (dev->dhcp6->get_mode_data, dev->dhcp6, &mode, NULL); ++ status = dev->dhcp6->get_mode_data(dev->dhcp6, &mode, NULL); + if (status != GRUB_EFI_SUCCESS) + { + grub_printf ("dhcp4 get mode failed, %d\n", (int)status); @@ -666,12 +666,12 @@ index 0000000000..dbef63d8c0 + grub_efi_dhcp6_packet_option_t **options = NULL; + grub_efi_uint32_t i; + -+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, NULL); ++ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, NULL); + + if (status == GRUB_EFI_BUFFER_TOO_SMALL && count) + { + options = grub_malloc (count * sizeof(*options)); -+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options); ++ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, options); + } + + if (status != GRUB_EFI_SUCCESS) @@ -696,8 +696,8 @@ index 0000000000..dbef63d8c0 + grub_free (options); + } + -+ efi_call_1 (b->free_pool, mode.client_id); -+ efi_call_1 (b->free_pool, mode.ia); ++ b->free_pool(mode.client_id); ++ b->free_pool(mode.ia); + } + + return GRUB_ERR_NONE; @@ -707,7 +707,7 @@ index 0000000000..dbef63d8c0 +grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6; diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c new file mode 100644 -index 0000000000..ef371d885e +index 00000000000..ef371d885ea --- /dev/null +++ b/grub-core/net/efi/efi_netfs.c @@ -0,0 +1,57 @@ @@ -770,10 +770,10 @@ index 0000000000..ef371d885e +} diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c new file mode 100644 -index 0000000000..3f61fd2fa5 +index 00000000000..de28badccb0 --- /dev/null +++ b/grub-core/net/efi/http.c -@@ -0,0 +1,419 @@ +@@ -0,0 +1,410 @@ + +#include +#include @@ -802,9 +802,9 @@ index 0000000000..3f61fd2fa5 + + http_config.local_address_is_ipv6 = 1; + sz = sizeof (manual_address); -+ status = efi_call_4 (dev->ip6_config->get_data, dev->ip6_config, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, -+ &sz, &manual_address); ++ status = dev->ip6_config->get_data(dev->ip6_config, ++ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, ++ &sz, &manual_address); + + if (status == GRUB_EFI_NOT_FOUND) + { @@ -834,19 +834,19 @@ index 0000000000..3f61fd2fa5 + http_config.access_point.ipv4_node = &httpv4_node; + } + -+ status = efi_call_2 (http->configure, http, &http_config); ++ status = http->configure(http, &http_config); + + if (status == GRUB_EFI_ALREADY_STARTED) + { + /* XXX: This hangs HTTPS boot */ +#if 0 -+ if (efi_call_2 (http->configure, http, NULL) != GRUB_EFI_SUCCESS) ++ if (http->configure(http, NULL) != GRUB_EFI_SUCCESS) + { + grub_error (GRUB_ERR_IO, N_("couldn't reset http instance")); + grub_print_error (); + return; + } -+ status = efi_call_2 (http->configure, http, &http_config); ++ status = http->configure(http, &http_config); +#endif + return; + } @@ -945,12 +945,9 @@ index 0000000000..3f61fd2fa5 + request_token.message = &request_message; + + request_callback_done = 0; -+ status = efi_call_5 (b->create_event, -+ GRUB_EFI_EVT_NOTIFY_SIGNAL, -+ GRUB_EFI_TPL_CALLBACK, -+ grub_efi_http_request_callback, -+ NULL, -+ &request_token.event); ++ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK, ++ grub_efi_http_request_callback, NULL, ++ &request_token.event); + + if (status != GRUB_EFI_SUCCESS) + { @@ -958,17 +955,17 @@ index 0000000000..3f61fd2fa5 + return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); + } + -+ status = efi_call_2 (http->request, http, &request_token); ++ status = http->request(http, &request_token); + + if (status != GRUB_EFI_SUCCESS) + { -+ efi_call_1 (b->close_event, request_token.event); ++ b->close_event(request_token.event); + grub_free (request_data.url); + return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status); + } + /* TODO: Add Timeout */ + while (!request_callback_done) -+ efi_call_1(http->poll, http); ++ http->poll(http); + + response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS; + response_message.data.response = &response_data; @@ -981,16 +978,13 @@ index 0000000000..3f61fd2fa5 + response_message.body = NULL; + response_token.event = NULL; + -+ status = efi_call_5 (b->create_event, -+ GRUB_EFI_EVT_NOTIFY_SIGNAL, -+ GRUB_EFI_TPL_CALLBACK, -+ grub_efi_http_response_callback, -+ NULL, -+ &response_token.event); ++ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK, ++ grub_efi_http_response_callback, NULL, ++ &response_token.event); + + if (status != GRUB_EFI_SUCCESS) + { -+ efi_call_1 (b->close_event, request_token.event); ++ b->close_event(request_token.event); + grub_free (request_data.url); + return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); + } @@ -1000,28 +994,28 @@ index 0000000000..3f61fd2fa5 + + /* wait for HTTP response */ + response_callback_done = 0; -+ status = efi_call_2 (http->response, http, &response_token); ++ status = http->response(http, &response_token); + + if (status != GRUB_EFI_SUCCESS) + { -+ efi_call_1 (b->close_event, response_token.event); -+ efi_call_1 (b->close_event, request_token.event); ++ b->close_event(response_token.event); ++ b->close_event(request_token.event); + grub_free (request_data.url); + return grub_error (GRUB_ERR_IO, "Fail to receive a response! status=%d\n", (int)status); + } + + /* TODO: Add Timeout */ + while (!response_callback_done) -+ efi_call_1 (http->poll, http); ++ http->poll(http); + + if (response_message.data.response->status_code != GRUB_EFI_HTTP_STATUS_200_OK) + { + grub_efi_http_status_code_t status_code = response_message.data.response->status_code; + + if (response_message.headers) -+ efi_call_1 (b->free_pool, response_message.headers); -+ efi_call_1 (b->close_event, response_token.event); -+ efi_call_1 (b->close_event, request_token.event); ++ b->free_pool(response_message.headers); ++ b->close_event(response_token.event); ++ b->close_event(request_token.event); + grub_free (request_data.url); + if (status_code == GRUB_EFI_HTTP_STATUS_404_NOT_FOUND) + { @@ -1049,9 +1043,9 @@ index 0000000000..3f61fd2fa5 + } + + if (response_message.headers) -+ efi_call_1 (b->free_pool, response_message.headers); -+ efi_call_1 (b->close_event, response_token.event); -+ efi_call_1 (b->close_event, request_token.event); ++ b->free_pool(response_message.headers); ++ b->close_event(response_token.event); ++ b->close_event(request_token.event); + grub_free (request_data.url); + + return GRUB_ERR_NONE; @@ -1076,12 +1070,9 @@ index 0000000000..3f61fd2fa5 + return -1; + } + -+ efi_call_5 (b->create_event, -+ GRUB_EFI_EVT_NOTIFY_SIGNAL, -+ GRUB_EFI_TPL_CALLBACK, -+ grub_efi_http_response_callback, -+ NULL, -+ &response_token.event); ++ b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK, ++ grub_efi_http_response_callback, NULL, ++ &response_token.event); + + while (len) + { @@ -1096,23 +1087,23 @@ index 0000000000..3f61fd2fa5 + + response_callback_done = 0; + -+ status = efi_call_2 (http->response, http, &response_token); ++ status = http->response(http, &response_token); + if (status != GRUB_EFI_SUCCESS) + { -+ efi_call_1 (b->close_event, response_token.event); ++ b->close_event(response_token.event); + grub_error (GRUB_ERR_IO, "Error! status=%d\n", (int)status); + return -1; + } + + while (!response_callback_done) -+ efi_call_1(http->poll, http); ++ http->poll(http); + + sum += response_message.body_length; + buf += response_message.body_length; + len -= response_message.body_length; + } + -+ efi_call_1 (b->close_event, response_token.event); ++ b->close_event(response_token.event); + + return sum; +} @@ -1195,7 +1186,7 @@ index 0000000000..3f61fd2fa5 + }; diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c new file mode 100644 -index 0000000000..b711a5d945 +index 00000000000..1deba25e79e --- /dev/null +++ b/grub-core/net/efi/ip4_config.c @@ -0,0 +1,398 @@ @@ -1305,17 +1296,17 @@ index 0000000000..b711a5d945 + if (!interface_info) + return NULL; + -+ status = efi_call_4 (ip4_config->get_data, ip4_config, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, -+ &sz, interface_info); ++ status = ip4_config->get_data(ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, ++ &sz, interface_info); + + if (status == GRUB_EFI_BUFFER_TOO_SMALL) + { + grub_free (interface_info); + interface_info = grub_malloc (sz); -+ status = efi_call_4 (ip4_config->get_data, ip4_config, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, -+ &sz, interface_info); ++ status = ip4_config->get_data(ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, ++ &sz, interface_info); + } + + if (status != GRUB_EFI_SUCCESS) @@ -1339,9 +1330,9 @@ index 0000000000..b711a5d945 + if (!manual_address) + return NULL; + -+ status = efi_call_4 (ip4_config->get_data, ip4_config, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, -+ &sz, manual_address); ++ status = ip4_config->get_data(ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, ++ &sz, manual_address); + + if (status != GRUB_EFI_SUCCESS) + { @@ -1546,7 +1537,7 @@ index 0000000000..b711a5d945 + } + } + -+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, ++ status = dev->ip4_config->set_data(dev->ip4_config, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, + sizeof(*address), address); + @@ -1562,9 +1553,9 @@ index 0000000000..b711a5d945 +{ + grub_efi_status_t status; + -+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY, -+ sizeof (address->ip4), &address->ip4); ++ status = dev->ip4_config->set_data(dev->ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY, ++ sizeof (address->ip4), &address->ip4); + + if (status != GRUB_EFI_SUCCESS) + return 0; @@ -1578,9 +1569,9 @@ index 0000000000..b711a5d945 +{ + grub_efi_status_t status; + -+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, -+ sizeof (address->ip4), &address->ip4); ++ status = dev->ip4_config->set_data(dev->ip4_config, ++ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, ++ sizeof (address->ip4), &address->ip4); + + if (status != GRUB_EFI_SUCCESS) + return 0; @@ -1599,7 +1590,7 @@ index 0000000000..b711a5d945 + }; diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c new file mode 100644 -index 0000000000..017c4d05bc +index 00000000000..29a03973265 --- /dev/null +++ b/grub-core/net/efi/ip6_config.c @@ -0,0 +1,422 @@ @@ -1729,7 +1720,7 @@ index 0000000000..017c4d05bc + sz = sizeof (*interface_info) + sizeof (*interface_info->route_table); + interface_info = grub_malloc (sz); + -+ status = efi_call_4 (ip6_config->get_data, ip6_config, ++ status = ip6_config->get_data(ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, + &sz, interface_info); + @@ -1737,7 +1728,7 @@ index 0000000000..017c4d05bc + { + grub_free (interface_info); + interface_info = grub_malloc (sz); -+ status = efi_call_4 (ip6_config->get_data, ip6_config, ++ status = ip6_config->get_data(ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, + &sz, interface_info); + } @@ -1763,7 +1754,7 @@ index 0000000000..017c4d05bc + if (!manual_address) + return NULL; + -+ status = efi_call_4 (ip6_config->get_data, ip6_config, ++ status = ip6_config->get_data(ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, + &sz, manual_address); + @@ -1974,7 +1965,7 @@ index 0000000000..017c4d05bc + } + } + -+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ status = dev->ip6_config->set_data(dev->ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, + sizeof(*address), address); + @@ -1990,7 +1981,7 @@ index 0000000000..017c4d05bc +{ + grub_efi_status_t status; + -+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ status = dev->ip6_config->set_data(dev->ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY, + sizeof (address->ip6), &address->ip6); + @@ -2006,7 +1997,7 @@ index 0000000000..017c4d05bc + + grub_efi_status_t status; + -+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ status = dev->ip6_config->set_data(dev->ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, + sizeof (address->ip6), &address->ip6); + @@ -2027,7 +2018,7 @@ index 0000000000..017c4d05bc + }; diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c new file mode 100644 -index 0000000000..86bce6535d +index 00000000000..1a19ee27144 --- /dev/null +++ b/grub-core/net/efi/net.c @@ -0,0 +1,1428 @@ @@ -2050,15 +2041,15 @@ index 0000000000..86bce6535d + +#define GRUB_EFI_IP6_PREFIX_LENGTH 64 + -+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID; -+static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID; -+static grub_efi_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID; -+static grub_efi_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID; -+static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; -+static grub_efi_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID; -+static grub_efi_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID; -+static grub_efi_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID; -+static grub_efi_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID; ++static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID; ++static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID; ++static grub_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID; ++static grub_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID; ++static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; ++static grub_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID; ++static grub_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID; ++static grub_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID; ++static grub_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID; + +struct grub_efi_net_device *net_devices; + @@ -2073,13 +2064,13 @@ index 0000000000..86bce6535d +#define efi_net_interface(m,...) efi_net_interface_ ## m (net_interface, ## __VA_ARGS__) + +static grub_efi_handle_t -+grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path, ++grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path, + grub_efi_device_path_t **r_device_path) +{ + grub_efi_handle_t handle; + grub_efi_status_t status; + -+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path, ++ status = grub_efi_system_table->boot_services->locate_device_path( + protocol, &device_path, &handle); + + if (status != GRUB_EFI_SUCCESS) @@ -2721,7 +2712,7 @@ index 0000000000..86bce6535d +} + +static grub_efi_handle_t -+grub_efi_service_binding (grub_efi_handle_t dev, grub_efi_guid_t *service_binding_guid) ++grub_efi_service_binding (grub_efi_handle_t dev, grub_guid_t *service_binding_guid) +{ + grub_efi_service_binding_t *service; + grub_efi_status_t status; @@ -2734,7 +2725,7 @@ index 0000000000..86bce6535d + return NULL; + } + -+ status = efi_call_2 (service->create_child, service, &child_dev); ++ status = service->create_child(service, &child_dev); + if (status != GRUB_EFI_SUCCESS) + { + grub_error (GRUB_ERR_IO, N_("Failed to create child device of http service %x"), status); @@ -2944,7 +2935,7 @@ index 0000000000..86bce6535d + { + grub_efi_ip4_config2_policy_t ip4_policy = GRUB_EFI_IP4_CONFIG2_POLICY_STATIC; + -+ if (efi_call_4 (dev->ip4_config->set_data, dev->ip4_config, ++ if (dev->ip4_config->set_data(dev->ip4_config, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY, + sizeof (ip4_policy), &ip4_policy) != GRUB_EFI_SUCCESS) + grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP4_CONFIG2_POLICY_STATIC on dev `%s'", dev->card_name); @@ -2953,7 +2944,7 @@ index 0000000000..86bce6535d + { + grub_efi_ip6_config_policy_t ip6_policy = GRUB_EFI_IP6_CONFIG_POLICY_MANUAL; + -+ if (efi_call_4 (dev->ip6_config->set_data, dev->ip6_config, ++ if (dev->ip6_config->set_data(dev->ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY, + sizeof (ip6_policy), &ip6_policy) != GRUB_EFI_SUCCESS) + grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP6_CONFIG_POLICY_MANUAL on dev `%s'", dev->card_name); @@ -3461,7 +3452,7 @@ index 0000000000..86bce6535d +} diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c new file mode 100644 -index 0000000000..531949cba5 +index 00000000000..b84f86ea470 --- /dev/null +++ b/grub-core/net/efi/pxe.c @@ -0,0 +1,424 @@ @@ -3484,7 +3475,7 @@ index 0000000000..531949cba5 + if (!manual_address) + return NULL; + -+ status = efi_call_4 (ip6_config->get_data, ip6_config, ++ status = ip6_config->get_data(ip6_config, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, + &sz, manual_address); + @@ -3509,7 +3500,7 @@ index 0000000000..531949cba5 + if (!manual_address) + return NULL; + -+ status = efi_call_4 (ip4_config->get_data, ip4_config, ++ status = ip4_config->get_data(ip4_config, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, + &sz, manual_address); + @@ -3532,7 +3523,7 @@ index 0000000000..531949cba5 + if (!mode->started) + { + grub_efi_status_t status; -+ status = efi_call_2 (pxe->start, pxe, prefer_ip6); ++ status = pxe->start(pxe, prefer_ip6); + + if (status != GRUB_EFI_SUCCESS) + grub_printf ("Couldn't start PXE\n"); @@ -3555,7 +3546,7 @@ index 0000000000..531949cba5 + grub_efi_pxe_ip_address_t station_ip; + + grub_memcpy (station_ip.v6.addr, manual_address->address, sizeof (station_ip.v6.addr)); -+ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, NULL); ++ status = pxe->set_station_ip(pxe, &station_ip, NULL); + + if (status != GRUB_EFI_SUCCESS) + grub_printf ("Couldn't set station ip\n"); @@ -3578,7 +3569,7 @@ index 0000000000..531949cba5 + grub_memcpy (station_ip.v4.addr, manual_address->address, sizeof (station_ip.v4.addr)); + grub_memcpy (subnet_mask.v4.addr, manual_address->subnet_mask, sizeof (subnet_mask.v4.addr)); + -+ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, &subnet_mask); ++ status = pxe->set_station_ip(pxe, &station_ip, &subnet_mask); + + if (status != GRUB_EFI_SUCCESS) + grub_printf ("Couldn't set station ip\n"); @@ -3731,7 +3722,7 @@ index 0000000000..531949cba5 + server_ip.v4.addr[i] = grub_strtoul (p, &p, 10); + } + -+ status = efi_call_10 (pxe->mtftp, ++ status = pxe->mtftp( + pxe, + GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, + NULL, @@ -3816,7 +3807,7 @@ index 0000000000..531949cba5 + server_ip.v4.addr[i] = grub_strtoul (p, &p, 10); + } + -+ status = efi_call_10 (pxe->mtftp, ++ status = pxe->mtftp( + pxe, + GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE, + buf, @@ -3847,7 +3838,7 @@ index 0000000000..531949cba5 + return 0; + } + -+ status = efi_call_10 (pxe->mtftp, ++ status = pxe->mtftp( + pxe, + GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE, + buf2, @@ -3890,7 +3881,7 @@ index 0000000000..531949cba5 + }; + diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 0ce5e675ed..55aed92722 100644 +index fa6b6537142..fdec64d55ee 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -32,6 +32,9 @@ @@ -3903,8 +3894,8 @@ index 0ce5e675ed..55aed92722 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -2033,8 +2036,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; - static grub_command_t cmd_lsroutes, cmd_lscards; +@@ -2092,8 +2095,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; + static grub_command_t cmd_setvlan, cmd_lsroutes, cmd_lscards; static grub_command_t cmd_lsaddr, cmd_slaac; +#ifdef GRUB_MACHINE_EFI @@ -3953,7 +3944,7 @@ index 0ce5e675ed..55aed92722 100644 grub_register_variable_hook ("net_default_server", defserver_get_env, defserver_set_env); grub_env_export ("net_default_server"); -@@ -2082,10 +2126,37 @@ GRUB_MOD_INIT(net) +@@ -2144,10 +2188,37 @@ GRUB_MOD_INIT(net) grub_net_restore_hw, GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK); grub_net_poll_cards_idle = grub_net_poll_cards_idle_real; @@ -3991,16 +3982,16 @@ index 0ce5e675ed..55aed92722 100644 grub_register_variable_hook ("net_default_server", 0, 0); grub_register_variable_hook ("pxe_default_server", 0, 0); -@@ -2104,4 +2175,7 @@ GRUB_MOD_FINI(net) +@@ -2166,4 +2237,7 @@ GRUB_MOD_FINI(net) grub_net_fini_hw (0); grub_loader_unregister_preboot_hook (fini_hnd); - grub_net_poll_cards_idle = grub_net_poll_cards_idle_real; + grub_net_poll_cards_idle = NULL; +#ifdef GRUB_MACHINE_EFI + init_mode = INIT_MODE_NONE; +#endif } diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c -index a2461cda1c..77958dd9dd 100644 +index 46f304c2b47..11c9db11775 100644 --- a/util/grub-mknetdir.c +++ b/util/grub-mknetdir.c @@ -32,13 +32,15 @@ @@ -4055,7 +4046,7 @@ index a2461cda1c..77958dd9dd 100644 { const char *mkimage_target; const char *netmodule; -@@ -156,6 +161,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) +@@ -157,6 +162,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) grub_install_push_module (targets[platform].netmodule); output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext); @@ -4063,7 +4054,7 @@ index a2461cda1c..77958dd9dd 100644 grub_install_make_image_wrap (input_dir, prefix, output, 0, load_cfg, targets[platform].mkimage_target, 0); -@@ -195,7 +201,16 @@ main (int argc, char *argv[]) +@@ -196,7 +202,16 @@ main (int argc, char *argv[]) grub_install_mkdir_p (base); @@ -4082,10 +4073,10 @@ index a2461cda1c..77958dd9dd 100644 if (!grub_install_source_directory) { diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 0b490195ad..f431f49973 100644 +index 248d6a28ff9..805a9d7adf9 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -622,6 +622,23 @@ typedef union +@@ -668,6 +668,23 @@ typedef union typedef grub_efi_uint64_t grub_efi_physical_address_t; typedef grub_efi_uint64_t grub_efi_virtual_address_t; @@ -4107,9 +4098,9 @@ index 0b490195ad..f431f49973 100644 + grub_efi_pxe_ipv6_address_t v6; +} grub_efi_pxe_ip_address_t; - struct grub_efi_guid - { -@@ -889,6 +906,8 @@ struct grub_efi_ipv6_device_path + /* XXX although the spec does not specify the padding, this actually + must have the padding! */ +@@ -917,6 +934,8 @@ struct grub_efi_ipv6_device_path grub_efi_uint16_t remote_port; grub_efi_uint16_t protocol; grub_efi_uint8_t static_ip_address; @@ -4118,7 +4109,7 @@ index 0b490195ad..f431f49973 100644 } GRUB_PACKED; typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t; -@@ -938,6 +957,15 @@ struct grub_efi_uri_device_path +@@ -975,6 +994,15 @@ struct grub_efi_uri_device_path } GRUB_PACKED; typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t; @@ -4134,7 +4125,7 @@ index 0b490195ad..f431f49973 100644 #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10 /* Media Device Path. */ -@@ -1020,6 +1048,23 @@ struct grub_efi_bios_device_path +@@ -1057,6 +1085,23 @@ struct grub_efi_bios_device_path } GRUB_PACKED; typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t; @@ -4158,7 +4149,7 @@ index 0b490195ad..f431f49973 100644 struct grub_efi_open_protocol_information_entry { grub_efi_handle_t agent_handle; -@@ -1569,23 +1614,27 @@ typedef struct grub_efi_pxe_tftp_error +@@ -1617,23 +1662,27 @@ typedef struct grub_efi_pxe_tftp_error grub_efi_char8_t error_string[127]; } grub_efi_pxe_tftp_error_t; @@ -4200,18 +4191,27 @@ index 0b490195ad..f431f49973 100644 #define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8 typedef struct grub_efi_pxe_ip_filter -@@ -1652,17 +1701,31 @@ typedef struct grub_efi_pxe_mode +@@ -1700,18 +1749,31 @@ typedef struct grub_efi_pxe_mode typedef struct grub_efi_pxe { grub_uint64_t rev; -- void (*start) (void); +- void *start; +- void *stop; +- void *dhcp; +- void *discover; +- void *mftp; +- void *udpwrite; +- void *udpread; +- void *setipfilter; +- void *arp; +- void *setparams; +- void *setstationip; +- void *setpackets; + grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6); - void (*stop) (void); -- void (*dhcp) (void); ++ void (*stop) (void); + grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this, + grub_efi_boolean_t sort_offers); - void (*discover) (void); -- void (*mftp) (void); ++ void (*discover) (void); + grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this, + grub_efi_pxe_base_code_tftp_opcode_t operation, + void *buffer_ptr, @@ -4223,20 +4223,19 @@ index 0b490195ad..f431f49973 100644 + grub_efi_char8_t *filename, + grub_efi_pxe_base_code_mtftp_info_t *info, + grub_efi_boolean_t dont_use_buffer); - void (*udpwrite) (void); - void (*udpread) (void); - void (*setipfilter) (void); - void (*arp) (void); - void (*setparams) (void); -- void (*setstationip) (void); ++ void (*udpwrite) (void); ++ void (*udpread) (void); ++ void (*setipfilter) (void); ++ void (*arp) (void); ++ void (*setparams) (void); + grub_efi_status_t (*set_station_ip) (struct grub_efi_pxe *this, + grub_efi_pxe_ip_address_t *new_station_ip, + grub_efi_pxe_ip_address_t *new_subnet_mask); -+ //void (*setstationip) (void); - void (*setpackets) (void); ++ void (*setpackets) (void); struct grub_efi_pxe_mode *mode; } grub_efi_pxe_t; -@@ -1924,6 +1987,44 @@ struct grub_efi_ip4_config2_protocol + +@@ -2005,6 +2067,44 @@ struct grub_efi_ip4_config2_protocol }; typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t; @@ -4281,7 +4280,7 @@ index 0b490195ad..f431f49973 100644 enum grub_efi_ip6_config_data_type { GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID, -@@ -1958,6 +2059,49 @@ struct grub_efi_ip6_config_protocol +@@ -2039,6 +2139,49 @@ struct grub_efi_ip6_config_protocol }; typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t; @@ -4328,12 +4327,12 @@ index 0b490195ad..f431f49973 100644 +}; +typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t; + - #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ - || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ - || defined(__riscv) + struct initrd_media_device_path { + grub_efi_vendor_media_device_path_t vendor; + grub_efi_device_path_t end; diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h new file mode 100644 -index 0000000000..fdb88eb810 +index 00000000000..fdb88eb810e --- /dev/null +++ b/include/grub/efi/dhcp.h @@ -0,0 +1,343 @@ @@ -4682,7 +4681,7 @@ index 0000000000..fdb88eb810 +#endif /* ! GRUB_EFI_DHCP_HEADER */ diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h new file mode 100644 -index 0000000000..c5e9a89f50 +index 00000000000..c5e9a89f505 --- /dev/null +++ b/include/grub/efi/http.h @@ -0,0 +1,215 @@ @@ -4903,7 +4902,7 @@ index 0000000000..c5e9a89f50 +#endif /* !GRUB_EFI_HTTP_HEADER */ diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h new file mode 100644 -index 0000000000..de90d223e8 +index 00000000000..de90d223e8e --- /dev/null +++ b/include/grub/net/efi.h @@ -0,0 +1,144 @@ diff --git a/0079-AUDIT-0-http-boot-tracker-bug.patch b/0071-AUDIT-0-http-boot-tracker-bug.patch similarity index 82% rename from 0079-AUDIT-0-http-boot-tracker-bug.patch rename to 0071-AUDIT-0-http-boot-tracker-bug.patch index b4872711..db7f9c75 100644 --- a/0079-AUDIT-0-http-boot-tracker-bug.patch +++ b/0071-AUDIT-0-http-boot-tracker-bug.patch @@ -18,11 +18,11 @@ signed code is allowed to be executed. Signed-off-by: Michael Chang --- grub-core/net/efi/net.c | 4 +++- - grub-core/net/http.c | 5 ++++- - 2 files changed, 7 insertions(+), 2 deletions(-) + grub-core/net/http.c | 8 +++++++- + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 86bce6535d..4bb308026c 100644 +index 1a19ee27144..ed04f05ad21 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -645,8 +645,10 @@ grub_efihttp_chunk_read (grub_file_t file, char *buf, @@ -38,20 +38,23 @@ index 86bce6535d..4bb308026c 100644 if (buf) { diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 12a2632ea5..b52b558d63 100644 +index f389bf03d96..af486198399 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c -@@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); +@@ -29,7 +29,11 @@ - enum - { -- HTTP_PORT = 80 + GRUB_MOD_LICENSE ("GPLv3+"); + +-#define HTTP_PORT ((grub_uint16_t) 80) ++enum ++ { + HTTP_PORT = 80, + HTTP_MAX_CHUNK_SIZE = 0x80000000 - }; ++ }; - -@@ -78,6 +79,8 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) + typedef struct http_data + { +@@ -82,6 +86,8 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) if (data->in_chunk_len == 2) { data->chunk_rem = grub_strtoul (ptr, 0, 16); diff --git a/0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch deleted file mode 100644 index 307e33cf..00000000 --- a/0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +++ /dev/null @@ -1,270 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aaron Miller -Date: Fri, 29 Jul 2016 17:41:38 +0800 -Subject: [PATCH] net: read bracketed ipv6 addrs and port numbers - -Allow specifying port numbers for http and tftp paths, and allow ipv6 addresses -to be recognized with brackets around them, which is required to specify a port -number - -Signed-off-by: Aaron Miller -[pjones: various bug fixes] -Signed-off-by: Peter Jones ---- - grub-core/net/http.c | 25 ++++++++++++--- - grub-core/net/net.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++--- - grub-core/net/tftp.c | 8 +++-- - include/grub/net.h | 1 + - 4 files changed, 109 insertions(+), 12 deletions(-) - -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index b616cf40b1..12a2632ea5 100644 ---- a/grub-core/net/http.c -+++ b/grub-core/net/http.c -@@ -289,7 +289,9 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)), - nb2 = grub_netbuff_alloc (data->chunk_rem); - if (!nb2) - return grub_errno; -- grub_netbuff_put (nb2, data->chunk_rem); -+ err = grub_netbuff_put (nb2, data->chunk_rem); -+ if (err) -+ return grub_errno; - grub_memcpy (nb2->data, nb->data, data->chunk_rem); - if (file->device->net->packs.count >= 20) - { -@@ -312,12 +314,14 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - int i; - struct grub_net_buff *nb; - grub_err_t err; -+ char* server = file->device->net->server; -+ int port = file->device->net->port; - - nb = grub_netbuff_alloc (GRUB_NET_TCP_RESERVE_SIZE - + sizeof ("GET ") - 1 - + grub_strlen (data->filename) - + sizeof (" HTTP/1.1\r\nHost: ") - 1 -- + grub_strlen (file->device->net->server) -+ + grub_strlen (server) + sizeof (":XXXXXXXXXX") - + sizeof ("\r\nUser-Agent: " PACKAGE_STRING - "\r\n") - 1 - + sizeof ("Range: bytes=XXXXXXXXXXXXXXXXXXXX" -@@ -356,7 +360,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - sizeof (" HTTP/1.1\r\nHost: ") - 1); - - ptr = nb->tail; -- err = grub_netbuff_put (nb, grub_strlen (file->device->net->server)); -+ err = grub_netbuff_put (nb, grub_strlen (server)); - if (err) - { - grub_netbuff_free (nb); -@@ -365,6 +369,15 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - grub_memcpy (ptr, file->device->net->server, - grub_strlen (file->device->net->server)); - -+ if (port) -+ { -+ ptr = nb->tail; -+ grub_snprintf ((char *) ptr, -+ sizeof (":XXXXXXXXXX"), -+ ":%d", -+ port); -+ } -+ - ptr = nb->tail; - err = grub_netbuff_put (nb, - sizeof ("\r\nUser-Agent: " PACKAGE_STRING "\r\n") -@@ -390,8 +403,10 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - grub_netbuff_put (nb, 2); - grub_memcpy (ptr, "\r\n", 2); - -- data->sock = grub_net_tcp_open (file->device->net->server, -- HTTP_PORT, http_receive, -+ grub_dprintf ("http", "opening path %s on host %s TCP port %d\n", -+ data->filename, server, port ? port : HTTP_PORT); -+ data->sock = grub_net_tcp_open (server, -+ port ? port : HTTP_PORT, http_receive, - http_err, NULL, - file); - if (!data->sock) -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index a46f82362e..0ce5e675ed 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -444,6 +444,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) - grub_uint16_t newip[8]; - const char *ptr = val; - int word, quaddot = -1; -+ int bracketed = 0; -+ -+ if (ptr[0] == '[') -+ { -+ bracketed = 1; -+ ptr++; -+ } - - if (ptr[0] == ':' && ptr[1] != ':') - return 0; -@@ -482,6 +489,8 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) - grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0])); - } - grub_memcpy (ip, newip, 16); -+ if (bracketed && *ptr == ']') -+ ptr++; - if (rest) - *rest = ptr; - return 1; -@@ -1343,8 +1352,10 @@ grub_net_open_real (const char *name) - { - grub_net_app_level_t proto; - const char *protname, *server; -+ char *host; - grub_size_t protnamelen; - int try; -+ int port = 0; - - if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0) - { -@@ -1382,6 +1393,72 @@ grub_net_open_real (const char *name) - return NULL; - } - -+ char* port_start; -+ /* ipv6 or port specified? */ -+ if ((port_start = grub_strchr (server, ':'))) -+ { -+ char* ipv6_begin; -+ if((ipv6_begin = grub_strchr (server, '['))) -+ { -+ char* ipv6_end = grub_strchr (server, ']'); -+ if(!ipv6_end) -+ { -+ grub_error (GRUB_ERR_NET_BAD_ADDRESS, -+ N_("mismatched [ in address")); -+ return NULL; -+ } -+ /* port number after bracketed ipv6 addr */ -+ if(ipv6_end[1] == ':') -+ { -+ port = grub_strtoul (ipv6_end + 2, NULL, 10); -+ if(port > 65535) -+ { -+ grub_error (GRUB_ERR_NET_BAD_ADDRESS, -+ N_("bad port number")); -+ return NULL; -+ } -+ } -+ host = grub_strndup (ipv6_begin, (ipv6_end - ipv6_begin) + 1); -+ } -+ else -+ { -+ if (grub_strchr (port_start + 1, ':')) -+ { -+ int iplen = grub_strlen (server); -+ /* bracket bare ipv6 addrs */ -+ host = grub_malloc (iplen + 3); -+ if(!host) -+ { -+ return NULL; -+ } -+ host[0] = '['; -+ grub_memcpy (host + 1, server, iplen); -+ host[iplen + 1] = ']'; -+ host[iplen + 2] = '\0'; -+ } -+ else -+ { -+ /* hostname:port or ipv4:port */ -+ port = grub_strtol (port_start + 1, NULL, 10); -+ if(port > 65535) -+ { -+ grub_error (GRUB_ERR_NET_BAD_ADDRESS, -+ N_("bad port number")); -+ return NULL; -+ } -+ host = grub_strndup (server, port_start - server); -+ } -+ } -+ } -+ else -+ { -+ host = grub_strdup (server); -+ } -+ if (!host) -+ { -+ return NULL; -+ } -+ - for (try = 0; try < 2; try++) - { - FOR_NET_APP_LEVEL (proto) -@@ -1391,14 +1468,13 @@ grub_net_open_real (const char *name) - { - grub_net_t ret = grub_zalloc (sizeof (*ret)); - if (!ret) -- return NULL; -- ret->protocol = proto; -- ret->server = grub_strdup (server); -- if (!ret->server) - { -- grub_free (ret); -+ grub_free (host); - return NULL; - } -+ ret->protocol = proto; -+ ret->port = port; -+ ret->server = host; - ret->fs = &grub_net_fs; - return ret; - } -@@ -1473,6 +1549,7 @@ grub_net_open_real (const char *name) - grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"), - name); - -+ grub_free (host); - return NULL; - } - -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 4ab2f5c735..d54b13f09f 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -295,6 +295,7 @@ tftp_open (struct grub_file *file, const char *filename) - grub_err_t err; - grub_uint8_t *nbd; - grub_net_network_level_address_t addr; -+ int port = file->device->net->port; - - data = grub_zalloc (sizeof (*data)); - if (!data) -@@ -362,14 +363,17 @@ tftp_open (struct grub_file *file, const char *filename) - err = grub_net_resolve_address (file->device->net->server, &addr); - if (err) - { -- grub_dprintf("tftp", "Address resolution failed: %d\n", err); -+ grub_dprintf ("tftp", "Address resolution failed: %d\n", err); -+ grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n", -+ (unsigned long long)data->file_size, -+ (unsigned long long)data->block_size); - grub_free (data); - return err; - } - - grub_dprintf("tftp", "opening connection\n"); - data->sock = grub_net_udp_open (addr, -- TFTP_SERVER_PORT, tftp_receive, -+ port ? port : TFTP_SERVER_PORT, tftp_receive, - file); - if (!data->sock) - { -diff --git a/include/grub/net.h b/include/grub/net.h -index af0404db7e..d55d505a03 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -273,6 +273,7 @@ typedef struct grub_net - { - char *server; - char *name; -+ int port; - grub_net_app_level_t protocol; - grub_net_packets_t packs; - grub_off_t offset; diff --git a/0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch b/0072-grub-editenv-Add-incr-command-to-increment-integer-v.patch similarity index 98% rename from 0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch rename to 0072-grub-editenv-Add-incr-command-to-increment-integer-v.patch index 6e2e4e27..f8de42a3 100644 --- a/0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch +++ b/0072-grub-editenv-Add-incr-command-to-increment-integer-v.patch @@ -17,7 +17,7 @@ Signed-off-by: Hans de Goede 1 file changed, 50 insertions(+) diff --git a/util/grub-editenv.c b/util/grub-editenv.c -index db6f187cc6..948eec8a11 100644 +index db6f187cc63..948eec8a114 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -53,6 +53,9 @@ static struct argp_option options[] = { diff --git a/0081-Add-auto-hide-menu-support.patch b/0073-Add-auto-hide-menu-support.patch similarity index 94% rename from 0081-Add-auto-hide-menu-support.patch rename to 0073-Add-auto-hide-menu-support.patch index a4fbe4a8..5b9a0d7a 100644 --- a/0081-Add-auto-hide-menu-support.patch +++ b/0073-Add-auto-hide-menu-support.patch @@ -43,10 +43,10 @@ Signed-off-by: Hans de Goede create mode 100644 util/grub.d/01_menu_auto_hide.in diff --git a/Makefile.util.def b/Makefile.util.def -index bda9fd1211..cb8e3c3270 100644 +index 1079add5bbe..5b9f85d4869 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -458,6 +458,12 @@ script = { +@@ -461,6 +461,12 @@ script = { installdir = grubconf; }; @@ -61,7 +61,7 @@ index bda9fd1211..cb8e3c3270 100644 common = util/grub.d/01_users.in; diff --git a/util/grub.d/01_menu_auto_hide.in b/util/grub.d/01_menu_auto_hide.in new file mode 100644 -index 0000000000..ad175870a5 +index 00000000000..ad175870a54 --- /dev/null +++ b/util/grub.d/01_menu_auto_hide.in @@ -0,0 +1,48 @@ @@ -114,7 +114,7 @@ index 0000000000..ad175870a5 +fi +EOF diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in -index 4b27bd2015..3c9431cfcf 100644 +index d7d423b2eaf..18fe02cefd8 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -42,6 +42,7 @@ if [ -z "${OSPROBED}" ] ; then @@ -125,7 +125,7 @@ index 4b27bd2015..3c9431cfcf 100644 # TRANSLATORS: it refers on the OS residing on device %s onstr="$(gettext_printf "(on %s)" "${DEVICE}")" hints="" -@@ -102,6 +103,7 @@ for OS in ${OSPROBED} ; do +@@ -106,6 +107,7 @@ for OS in ${OSPROBED} ; do case ${BOOT} in chain) @@ -133,7 +133,7 @@ index 4b27bd2015..3c9431cfcf 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -@@ -132,6 +134,7 @@ EOF +@@ -136,6 +138,7 @@ EOF EOF ;; efi) @@ -141,7 +141,7 @@ index 4b27bd2015..3c9431cfcf 100644 EFIPATH=${DEVICE#*@} DEVICE=${DEVICE%@*} -@@ -176,6 +179,7 @@ EOF +@@ -180,6 +183,7 @@ EOF LINITRD="${LINITRD#/boot}" fi @@ -149,7 +149,7 @@ index 4b27bd2015..3c9431cfcf 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" recovery_params="$(echo "${LPARAMS}" | grep single)" || true counter=1 -@@ -257,6 +261,7 @@ EOF +@@ -261,6 +265,7 @@ EOF done ;; hurd) @@ -157,7 +157,7 @@ index 4b27bd2015..3c9431cfcf 100644 onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' { -@@ -283,6 +288,7 @@ EOF +@@ -287,6 +292,7 @@ EOF EOF ;; minix) @@ -165,7 +165,7 @@ index 4b27bd2015..3c9431cfcf 100644 cat << EOF menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" { EOF -@@ -299,3 +305,15 @@ EOF +@@ -303,3 +309,15 @@ EOF ;; esac done diff --git a/0082-Add-grub-set-bootflag-utility.patch b/0074-Add-grub-set-bootflag-utility.patch similarity index 97% rename from 0082-Add-grub-set-bootflag-utility.patch rename to 0074-Add-grub-set-bootflag-utility.patch index 495bb139..f6dc7314 100644 --- a/0082-Add-grub-set-bootflag-utility.patch +++ b/0074-Add-grub-set-bootflag-utility.patch @@ -49,10 +49,10 @@ Signed-off-by: Robbie Harwood create mode 100644 docs/man/grub-set-bootflag.h2m diff --git a/Makefile.util.def b/Makefile.util.def -index cb8e3c3270..d066652e9b 100644 +index 5b9f85d4869..01096ded815 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1429,3 +1429,10 @@ program = { +@@ -1468,3 +1468,10 @@ program = { ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; @@ -65,7 +65,7 @@ index cb8e3c3270..d066652e9b 100644 +}; diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c new file mode 100644 -index 0000000000..d506f7e75b +index 00000000000..d506f7e75bc --- /dev/null +++ b/util/grub-set-bootflag.c @@ -0,0 +1,172 @@ @@ -242,7 +242,7 @@ index 0000000000..d506f7e75b + return 0; +} diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 8f1485d52a..ad235de7fc 100644 +index 5e7126f9878..26ac8765e30 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -15,6 +15,9 @@ EXTRA_DIST += docs/man @@ -257,7 +257,7 @@ index 8f1485d52a..ad235de7fc 100644 diff --git a/docs/grub-boot-success.service b/docs/grub-boot-success.service new file mode 100644 -index 0000000000..80e79584c9 +index 00000000000..80e79584c91 --- /dev/null +++ b/docs/grub-boot-success.service @@ -0,0 +1,6 @@ @@ -269,7 +269,7 @@ index 0000000000..80e79584c9 +ExecStart=/usr/sbin/grub2-set-bootflag boot_success diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer new file mode 100644 -index 0000000000..406f172005 +index 00000000000..406f1720056 --- /dev/null +++ b/docs/grub-boot-success.timer @@ -0,0 +1,7 @@ @@ -282,7 +282,7 @@ index 0000000000..406f172005 +OnActiveSec=2min diff --git a/docs/man/grub-set-bootflag.h2m b/docs/man/grub-set-bootflag.h2m new file mode 100644 -index 0000000000..94ec0b92ed +index 00000000000..94ec0b92ede --- /dev/null +++ b/docs/man/grub-set-bootflag.h2m @@ -0,0 +1,2 @@ diff --git a/0083-docs-Add-grub-boot-indeterminate.service-example.patch b/0075-docs-Add-grub-boot-indeterminate.service-example.patch similarity index 97% rename from 0083-docs-Add-grub-boot-indeterminate.service-example.patch rename to 0075-docs-Add-grub-boot-indeterminate.service-example.patch index 96eff368..44f6ad39 100644 --- a/0083-docs-Add-grub-boot-indeterminate.service-example.patch +++ b/0075-docs-Add-grub-boot-indeterminate.service-example.patch @@ -16,7 +16,7 @@ Signed-off-by: Hans de Goede diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service new file mode 100644 -index 0000000000..6c8dcb186b +index 00000000000..6c8dcb186b6 --- /dev/null +++ b/docs/grub-boot-indeterminate.service @@ -0,0 +1,11 @@ diff --git a/0084-gentpl-add-disable-support.patch b/0076-gentpl-add-disable-support.patch similarity index 89% rename from 0084-gentpl-add-disable-support.patch rename to 0076-gentpl-add-disable-support.patch index 3b305e65..949cfe8f 100644 --- a/0084-gentpl-add-disable-support.patch +++ b/0076-gentpl-add-disable-support.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gentpl.py b/gentpl.py -index c86550d4f9..f3c5f84f85 100644 +index bfab2113a1d..6cad9b8231f 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -592,11 +592,21 @@ def platform_conditional(platform, closure): +@@ -594,11 +594,21 @@ def platform_conditional(platform, closure): # }; # def foreach_enabled_platform(defn, closure): @@ -35,7 +35,7 @@ index c86550d4f9..f3c5f84f85 100644 for platform in GRUB_PLATFORMS: platform_conditional(platform, closure) -@@ -655,6 +665,8 @@ def first_time(defn, snippet): +@@ -657,6 +667,8 @@ def first_time(defn, snippet): def is_platform_independent(defn): if 'enable' in defn: return False diff --git a/0085-gentpl-add-pc-firmware-type.patch b/0077-gentpl-add-pc-firmware-type.patch similarity index 74% rename from 0085-gentpl-add-pc-firmware-type.patch rename to 0077-gentpl-add-pc-firmware-type.patch index 0bfd2eac..608582a5 100644 --- a/0085-gentpl-add-pc-firmware-type.patch +++ b/0077-gentpl-add-pc-firmware-type.patch @@ -9,14 +9,14 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+) diff --git a/gentpl.py b/gentpl.py -index f3c5f84f85..f09b336869 100644 +index 6cad9b8231f..597129a2bc4 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -51,6 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ] - GROUPS["riscv64"] = [ "riscv64_efi" ] +@@ -52,6 +52,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ] + GROUPS["riscv64"] = [ "riscv64_efi" ] # Groups based on firmware +GROUPS["pc"] = [ "i386_pc" ] GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi", - "riscv32_efi", "riscv64_efi" ] + "loongarch64_efi", "riscv32_efi", "riscv64_efi" ] GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] diff --git a/0086-efinet-also-use-the-firmware-acceleration-for-http.patch b/0078-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 96% rename from 0086-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0078-efinet-also-use-the-firmware-acceleration-for-http.patch index a3a94002..8ce3e014 100644 --- a/0086-efinet-also-use-the-firmware-acceleration-for-http.patch +++ b/0078-efinet-also-use-the-firmware-acceleration-for-http.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 4bb308026c..6603cd83ed 100644 +index ed04f05ad21..1f7e1b63557 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -1324,7 +1324,9 @@ grub_efi_net_boot_from_https (void) diff --git a/0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0079-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 93% rename from 0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0079-efi-http-Make-root_url-reflect-the-protocol-hostname.patch index 90d97773..6f98f25e 100644 --- a/0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +++ b/0079-efi-http-Make-root_url-reflect-the-protocol-hostname.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 19 insertions(+) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 3f61fd2fa5..243acbaa35 100644 +index de28badccb0..b94dbc68eef 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -4,6 +4,7 @@ @@ -23,7 +23,7 @@ index 3f61fd2fa5..243acbaa35 100644 static void http_configure (struct grub_efi_net_device *dev, int prefer_ip6) -@@ -351,6 +352,24 @@ grub_efihttp_open (struct grub_efi_net_device *dev, +@@ -342,6 +343,24 @@ grub_efihttp_open (struct grub_efi_net_device *dev, grub_err_t err; grub_off_t size; char *buf; diff --git a/0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0080-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 87% rename from 0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0080-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch index 6d2974f8..9d8be1eb 100644 --- a/0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +++ b/0080-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch @@ -17,11 +17,11 @@ Signed-off-by: Peter Jones 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac -index 302300711f..008f6c273b 100644 +index fcfbcbb664d..c17e83acf87 100644 --- a/configure.ac +++ b/configure.ac -@@ -849,11 +849,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p - TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" +@@ -914,11 +914,23 @@ if test "x$target_cpu" = xloongarch64; then + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mla-global-with-abs" fi +# Should grub utils get the host CFLAGS, or the target CFLAGS? @@ -45,7 +45,7 @@ index 302300711f..008f6c273b 100644 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [ grub_cv_target_cc_soft_float=no if test "x$target_cpu" = xarm64; then -@@ -1954,6 +1966,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +@@ -2111,6 +2123,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" @@ -88,19 +88,19 @@ index 302300711f..008f6c273b 100644 GRUB_PLATFORM="${platform}" diff --git a/conf/Makefile.common b/conf/Makefile.common -index 5f0ef96985..2ff9b39357 100644 +index 6262f21a772..54f0f7f7664 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common -@@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 - CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes +@@ -50,24 +50,25 @@ else + endif + endif -CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding --LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d +-LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r -CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) +CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_PLATFORM) -ffreestanding -+LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d ++LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r +CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) @@ -129,10 +129,10 @@ index 5f0ef96985..2ff9b39357 100644 # Other variables diff --git a/gentpl.py b/gentpl.py -index f09b336869..0e62e14666 100644 +index 597129a2bc4..5826a6b14e8 100644 --- a/gentpl.py +++ b/gentpl.py -@@ -697,10 +697,10 @@ def module(defn, platform): +@@ -699,10 +699,10 @@ def module(defn, platform): var_set(cname(defn) + "_SOURCES", platform_sources(defn, platform) + " ## platform sources") var_set("nodist_" + cname(defn) + "_SOURCES", platform_nodist_sources(defn, platform) + " ## platform nodist sources") var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform)) diff --git a/0090-Rework-how-the-fdt-command-builds.patch b/0081-Rework-how-the-fdt-command-builds.patch similarity index 85% rename from 0090-Rework-how-the-fdt-command-builds.patch rename to 0081-Rework-how-the-fdt-command-builds.patch index 8f412723..8c00d382 100644 --- a/0090-Rework-how-the-fdt-command-builds.patch +++ b/0081-Rework-how-the-fdt-command-builds.patch @@ -17,18 +17,18 @@ Signed-off-by: Peter Jones Signed-off-by: Javier Martinez Canillas Signed-off-by: Robbie Harwood --- - grub-core/Makefile.core.def | 5 ++--- + grub-core/Makefile.core.def | 4 ++-- grub-core/lib/fdt.c | 2 -- grub-core/loader/efi/fdt.c | 2 ++ include/grub/fdt.h | 6 ++++++ grub-core/Makefile.am | 1 + - 5 files changed, 11 insertions(+), 5 deletions(-) + 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 12797336c9..4e7d90da76 100644 +index 56eb6a828e8..4629c179e40 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -177,7 +177,6 @@ kernel = { +@@ -188,7 +188,6 @@ kernel = { arm_coreboot = kern/arm/coreboot/init.c; arm_coreboot = kern/arm/coreboot/timer.c; arm_coreboot = kern/arm/coreboot/coreboot.S; @@ -36,7 +36,7 @@ index 12797336c9..4e7d90da76 100644 arm_coreboot = bus/fdt.c; arm_coreboot = term/ps2.c; arm_coreboot = term/arm/pl050.c; -@@ -351,6 +350,8 @@ kernel = { +@@ -370,6 +369,8 @@ kernel = { riscv64 = kern/riscv/cache_flush.S; riscv64 = kern/riscv/dl.c; @@ -45,15 +45,7 @@ index 12797336c9..4e7d90da76 100644 emu = disk/host.c; emu = kern/emu/cache_s.S; emu = kern/emu/hostdisk.c; -@@ -1825,7 +1826,6 @@ module = { - riscv32 = loader/riscv/linux.c; - riscv64 = loader/riscv/linux.c; - emu = loader/emu/linux.c; -- fdt = lib/fdt.c; - - common = loader/linux.c; - common = lib/cmdline.c; -@@ -1837,7 +1837,6 @@ module = { +@@ -1882,7 +1883,6 @@ module = { module = { name = fdt; efi = loader/efi/fdt.c; @@ -62,7 +54,7 @@ index 12797336c9..4e7d90da76 100644 }; diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c -index 0d371c5633..37e04bd69e 100644 +index 73cfa94a2df..fbf749e1d61 100644 --- a/grub-core/lib/fdt.c +++ b/grub-core/lib/fdt.c @@ -21,8 +21,6 @@ @@ -75,7 +67,7 @@ index 0d371c5633..37e04bd69e 100644 #define FDT_BEGIN_NODE 0x00000001 diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c -index c86f283d75..c572415d38 100644 +index 439964b9ca6..e08d8738afc 100644 --- a/grub-core/loader/efi/fdt.c +++ b/grub-core/loader/efi/fdt.c @@ -27,6 +27,8 @@ @@ -88,7 +80,7 @@ index c86f283d75..c572415d38 100644 static void *fdt; diff --git a/include/grub/fdt.h b/include/grub/fdt.h -index e609c7e411..3514aa4a5b 100644 +index e609c7e4111..3514aa4a5b6 100644 --- a/include/grub/fdt.h +++ b/include/grub/fdt.h @@ -19,6 +19,9 @@ @@ -110,7 +102,7 @@ index e609c7e411..3514aa4a5b 100644 + #endif /* ! GRUB_FDT_HEADER */ diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index bfd29a3bf0..c2e8a82bce 100644 +index b7192a3da82..7953ba95399 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h diff --git a/0091-Disable-non-wordsize-allocations-on-arm.patch b/0082-Disable-non-wordsize-allocations-on-arm.patch similarity index 93% rename from 0091-Disable-non-wordsize-allocations-on-arm.patch rename to 0082-Disable-non-wordsize-allocations-on-arm.patch index ea09b652..e8c46418 100644 --- a/0091-Disable-non-wordsize-allocations-on-arm.patch +++ b/0082-Disable-non-wordsize-allocations-on-arm.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac -index 008f6c273b..54462e0892 100644 +index c17e83acf87..3f3a170ab17 100644 --- a/configure.ac +++ b/configure.ac -@@ -1260,6 +1260,26 @@ if test "x$target_cpu" = xarm; then +@@ -1346,6 +1346,26 @@ if test "x$target_cpu" = xarm; then done ]) diff --git a/0092-Prepend-prefix-when-HTTP-path-is-relative.patch b/0083-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 97% rename from 0092-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0083-Prepend-prefix-when-HTTP-path-is-relative.patch index 30d80753..ac6c8062 100644 --- a/0092-Prepend-prefix-when-HTTP-path-is-relative.patch +++ b/0083-Prepend-prefix-when-HTTP-path-is-relative.patch @@ -16,7 +16,7 @@ Signed-off-by: Robbie Harwood 2 files changed, 71 insertions(+), 21 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index d1de9fa687..1c540fc8c2 100644 +index 463dafdba02..7347a8de676 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -131,11 +131,19 @@ grub_set_prefix_and_root (void) @@ -41,7 +41,7 @@ index d1de9fa687..1c540fc8c2 100644 } } diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 243acbaa35..de351b2cd0 100644 +index b94dbc68eef..5e97f5d5e70 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -9,10 +9,52 @@ @@ -97,7 +97,7 @@ index 243acbaa35..de351b2cd0 100644 grub_efi_http_t *http = dev->http; -@@ -352,32 +394,32 @@ grub_efihttp_open (struct grub_efi_net_device *dev, +@@ -343,32 +385,32 @@ grub_efihttp_open (struct grub_efi_net_device *dev, grub_err_t err; grub_off_t size; char *buf; diff --git a/0093-Make-grub_error-more-verbose.patch b/0084-Make-grub_error-more-verbose.patch similarity index 94% rename from 0093-Make-grub_error-more-verbose.patch rename to 0084-Make-grub_error-more-verbose.patch index 306a3d36..5ad26840 100644 --- a/0093-Make-grub_error-more-verbose.patch +++ b/0084-Make-grub_error-more-verbose.patch @@ -10,7 +10,7 @@ Signed-off-by: Peter Jones 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c -index 53c734de70..aebfe0cf83 100644 +index 53c734de70e..aebfe0cf839 100644 --- a/grub-core/kern/err.c +++ b/grub-core/kern/err.c @@ -33,15 +33,24 @@ static struct grub_error_saved grub_error_stack_items[GRUB_ERROR_STACK_SIZE]; @@ -41,10 +41,10 @@ index 53c734de70..aebfe0cf83 100644 return n; diff --git a/include/grub/err.h b/include/grub/err.h -index b08d5d0de4..c0f90ef07c 100644 +index 1c07034cd60..3c587b9b822 100644 --- a/include/grub/err.h +++ b/include/grub/err.h -@@ -85,8 +85,12 @@ struct grub_error_saved +@@ -86,8 +86,12 @@ struct grub_error_saved extern grub_err_t EXPORT_VAR(grub_errno); extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG]; diff --git a/0094-Make-reset-an-alias-for-the-reboot-command.patch b/0085-Make-reset-an-alias-for-the-reboot-command.patch similarity index 97% rename from 0094-Make-reset-an-alias-for-the-reboot-command.patch rename to 0085-Make-reset-an-alias-for-the-reboot-command.patch index 22475d65..c86acf18 100644 --- a/0094-Make-reset-an-alias-for-the-reboot-command.patch +++ b/0085-Make-reset-an-alias-for-the-reboot-command.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub-core/commands/reboot.c b/grub-core/commands/reboot.c -index 46d364c99a..f5cc228363 100644 +index 46d364c99a9..f5cc2283636 100644 --- a/grub-core/commands/reboot.c +++ b/grub-core/commands/reboot.c @@ -32,15 +32,18 @@ grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)), diff --git a/0095-Add-a-version-command.patch b/0086-Add-a-version-command.patch similarity index 89% rename from 0095-Add-a-version-command.patch rename to 0086-Add-a-version-command.patch index 18c355c2..b8770eed 100644 --- a/0095-Add-a-version-command.patch +++ b/0086-Add-a-version-command.patch @@ -19,10 +19,10 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/version.c diff --git a/configure.ac b/configure.ac -index 54462e0892..7b4e1854d3 100644 +index 3f3a170ab17..2175aa56997 100644 --- a/configure.ac +++ b/configure.ac -@@ -284,6 +284,19 @@ AC_SUBST(target_cpu) +@@ -289,6 +289,19 @@ AC_SUBST(target_cpu) AC_SUBST(platform) # Define default variables @@ -43,10 +43,10 @@ index 54462e0892..7b4e1854d3 100644 have_with_bootdir=n AC_ARG_WITH([bootdir], diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 4e7d90da76..4f203533f5 100644 +index 4629c179e40..f26c689723c 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -579,6 +579,11 @@ image = { +@@ -598,6 +598,11 @@ image = { enable = mips_loongson; }; @@ -60,7 +60,7 @@ index 4e7d90da76..4f203533f5 100644 common = lib/disk.c; diff --git a/grub-core/commands/version.c b/grub-core/commands/version.c new file mode 100644 -index 0000000000..de0acb07ba +index 00000000000..de0acb07ba2 --- /dev/null +++ b/grub-core/commands/version.c @@ -0,0 +1,56 @@ @@ -121,14 +121,14 @@ index 0000000000..de0acb07ba + grub_unregister_command (cmd); +} diff --git a/config.h.in b/config.h.in -index 9e8f9911b1..c7e316f0f1 100644 +index 9b1d3997185..d294d2c653f 100644 --- a/config.h.in +++ b/config.h.in -@@ -59,6 +59,7 @@ +@@ -63,6 +63,7 @@ - #define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@" - #define GRUB_PLATFORM "@GRUB_PLATFORM@" -+#define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@" + # define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@" + # define GRUB_PLATFORM "@GRUB_PLATFORM@" ++# define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@" - #define RE_ENABLE_I18N 1 + # define GRUB_STACK_PROTECTOR_INIT @GRUB_STACK_PROTECTOR_INIT@ diff --git a/0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0087-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 89% rename from 0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0087-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch index 72c8d304..9ad4036f 100644 --- a/0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +++ b/0087-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 4 files changed, 10 insertions(+) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c -index 0320115662..7cdffe3ebd 100644 +index 21e2395111a..c35ce8915b2 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter) @@ -24,7 +24,7 @@ index 0320115662..7cdffe3ebd 100644 if (!accept_diskfilter && is_valid_diskfilter_name (name)) return 0; -@@ -1212,6 +1214,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id, +@@ -1247,6 +1249,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id, the same. */ if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size) return GRUB_ERR_NONE; @@ -33,10 +33,10 @@ index 0320115662..7cdffe3ebd 100644 if (!pv->disk) return grub_errno; diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index f077b5f553..fe8ba6e6c9 100644 +index 3b5ed569133..822005456eb 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c -@@ -855,6 +855,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) +@@ -865,6 +865,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) return 0; } @@ -45,7 +45,7 @@ index f077b5f553..fe8ba6e6c9 100644 grub_free (dup_dp); diff --git a/grub-core/kern/device.c b/grub-core/kern/device.c -index 73b8ecc0c0..f58b58c89d 100644 +index 670e213cf3c..d019637470d 100644 --- a/grub-core/kern/device.c +++ b/grub-core/kern/device.c @@ -34,6 +34,7 @@ grub_device_open (const char *name) @@ -57,7 +57,7 @@ index 73b8ecc0c0..f58b58c89d 100644 { name = grub_env_get ("root"); diff --git a/grub-core/script/script.c b/grub-core/script/script.c -index ec4d4337c6..844e8343ca 100644 +index ec4d4337c66..844e8343ca7 100644 --- a/grub-core/script/script.c +++ b/grub-core/script/script.c @@ -22,6 +22,11 @@ diff --git a/0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0088-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 77% rename from 0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0088-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch index 77db523d..2868f23e 100644 --- a/0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +++ b/0088-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch @@ -9,19 +9,18 @@ Signed-off-by: Peter Jones grub-core/lib/reed_solomon.c | 4 ++-- grub-core/osdep/linux/blocklist.c | 2 +- grub-core/osdep/linux/getroot.c | 2 +- - grub-core/osdep/linux/hostdisk.c | 2 +- util/grub-fstest.c | 2 +- util/grub-menulst2cfg.c | 2 +- util/grub-mkfont.c | 13 +++++++------ util/grub-probe.c | 2 +- util/setup.c | 2 +- - 10 files changed, 17 insertions(+), 16 deletions(-) + 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 0ff13bcaf8..d278c2921f 100644 +index 16c79bc9488..d145e5796b3 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c -@@ -185,7 +185,7 @@ grub_util_get_image_size (const char *path) +@@ -189,7 +189,7 @@ grub_util_get_image_size (const char *path) sz = ftello (f); if (sz < 0) grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); @@ -31,10 +30,10 @@ index 0ff13bcaf8..d278c2921f 100644 ret = (size_t) sz; diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c -index 467305b46a..79037c093f 100644 +index 562bd2e3e3f..5fee7f2a1a4 100644 --- a/grub-core/lib/reed_solomon.c +++ b/grub-core/lib/reed_solomon.c -@@ -157,7 +157,7 @@ static void +@@ -162,7 +162,7 @@ static void rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs) { gf_single_t *rs_polynomial; @@ -43,7 +42,7 @@ index 467305b46a..79037c093f 100644 gf_single_t *m; m = xcalloc (s + rs, sizeof (gf_single_t)); grub_memcpy (m, data, s * sizeof (gf_single_t)); -@@ -324,7 +324,7 @@ static void +@@ -333,7 +333,7 @@ static void encode_block (gf_single_t *ptr, grub_size_t s, gf_single_t *rptr, grub_size_t rs) { @@ -53,7 +52,7 @@ index 467305b46a..79037c093f 100644 { grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE; diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c -index c77d6085cc..42a315031f 100644 +index 2efee2c2aee..902cfee53ae 100644 --- a/grub-core/osdep/linux/blocklist.c +++ b/grub-core/osdep/linux/blocklist.c @@ -109,7 +109,7 @@ grub_install_get_blocklist (grub_device_t root_dev, @@ -66,10 +65,10 @@ index c77d6085cc..42a315031f 100644 + fie1.fm_mapped_extents * sizeof (fie1.fm_extents[1])); diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 28790307e0..9f730b3518 100644 +index 74a48c03026..477fb420992 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c -@@ -236,7 +236,7 @@ grub_find_root_devices_from_btrfs (const char *dir) +@@ -233,7 +233,7 @@ grub_find_root_devices_from_btrfs (const char *dir) { int fd; struct btrfs_ioctl_fs_info_args fsi; @@ -78,24 +77,11 @@ index 28790307e0..9f730b3518 100644 char **ret; fd = open (dir, 0); -diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c -index da62f924e3..7bc99ac1c1 100644 ---- a/grub-core/osdep/linux/hostdisk.c -+++ b/grub-core/osdep/linux/hostdisk.c -@@ -83,7 +83,7 @@ grub_util_get_fd_size_os (grub_util_fd_t fd, const char *name, unsigned *log_sec - if (sector_size & (sector_size - 1) || !sector_size) - return -1; - for (log_sector_size = 0; -- (1 << log_sector_size) < sector_size; -+ (1U << log_sector_size) < sector_size; - log_sector_size++); - - if (log_secsize) diff --git a/util/grub-fstest.c b/util/grub-fstest.c -index 8386564200..bfcef852d8 100644 +index 25ae52ab6f4..982ce9ed7d8 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c -@@ -323,7 +323,7 @@ cmd_cmp (char *src, char *dest) +@@ -329,7 +329,7 @@ cmd_cmp (char *src, char *dest) read_file (src, cmp_hook, ff); { @@ -105,7 +91,7 @@ index 8386564200..bfcef852d8 100644 fseek (ff, 0, SEEK_END); if (pre != ftell (ff)) diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c -index a39f869394..358d604210 100644 +index b80e15cc36e..1ea2a86e129 100644 --- a/util/grub-menulst2cfg.c +++ b/util/grub-menulst2cfg.c @@ -34,7 +34,7 @@ main (int argc, char **argv) @@ -118,10 +104,10 @@ index a39f869394..358d604210 100644 grub_util_host_init (&argc, &argv); diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c -index 0fe45a6103..3e09240b99 100644 +index 7624d7808b7..e8a914021b2 100644 --- a/util/grub-mkfont.c +++ b/util/grub-mkfont.c -@@ -138,7 +138,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, +@@ -143,7 +143,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, int width, height; int cuttop, cutbottom, cutleft, cutright; grub_uint8_t *data; @@ -131,7 +117,7 @@ index 0fe45a6103..3e09240b99 100644 FT_GlyphSlot glyph; int flag = FT_LOAD_RENDER | FT_LOAD_MONOCHROME; FT_Error err; -@@ -183,7 +184,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, +@@ -188,7 +189,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, cuttop = cutbottom = cutleft = cutright = 0; else { @@ -140,7 +126,7 @@ index 0fe45a6103..3e09240b99 100644 { for (j = 0; j < glyph->bitmap.width; j++) if (glyph->bitmap.buffer[j / 8 + cuttop * glyph->bitmap.pitch] -@@ -203,10 +204,10 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, +@@ -208,10 +209,10 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, break; } cutbottom = glyph->bitmap.rows - 1 - cutbottom; @@ -153,7 +139,7 @@ index 0fe45a6103..3e09240b99 100644 { for (j = 0; j < glyph->bitmap.rows; j++) if (glyph->bitmap.buffer[cutleft / 8 + j * glyph->bitmap.pitch] -@@ -225,7 +226,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, +@@ -230,7 +231,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, break; } cutright = glyph->bitmap.width - 1 - cutright; @@ -162,7 +148,7 @@ index 0fe45a6103..3e09240b99 100644 cutright = 0; } -@@ -262,7 +263,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, +@@ -267,7 +268,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face, mask = 0; data = &glyph_info->bitmap[0] - 1; @@ -172,10 +158,10 @@ index 0fe45a6103..3e09240b99 100644 add_pixel (&data, &mask, glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] & diff --git a/util/grub-probe.c b/util/grub-probe.c -index c08e46bbb4..c6fac732b4 100644 +index 65c1ca3f8b6..08ae915e8d7 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c -@@ -798,7 +798,7 @@ argp_parser (int key, char *arg, struct argp_state *state) +@@ -799,7 +799,7 @@ argp_parser (int key, char *arg, struct argp_state *state) case 't': { @@ -185,7 +171,7 @@ index c08e46bbb4..c6fac732b4 100644 for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) if (strcmp (arg, targets[i]) == 0) diff --git a/util/setup.c b/util/setup.c -index da5f2c07f5..8b22bb8cca 100644 +index 87a889ff7e3..7aab468b0eb 100644 --- a/util/setup.c +++ b/util/setup.c @@ -406,7 +406,7 @@ SETUP (const char *dir, diff --git a/0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0089-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 55% rename from 0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0089-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch index 03b4bbf3..668a20ce 100644 --- a/0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +++ b/0089-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch @@ -4,33 +4,21 @@ Date: Thu, 11 Jul 2019 18:20:37 +0200 Subject: [PATCH] Don't use -Wno-sign-compare -Wno-conversion -Wno-error, do use -Wextra. +Updated for grub-2.12 which introduced new sign comparison problems: +we're using -Wno-error=sign-compare + Signed-off-by: Peter Jones --- - configure.ac | 14 +++++++++++--- - conf/Makefile.common | 2 +- - 2 files changed, 12 insertions(+), 4 deletions(-) + configure.ac | 8 ++++++++ + conf/Makefile.common | 2 +- + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 7b4e1854d3..490353713a 100644 +index 2175aa56997..81240397384 100644 --- a/configure.ac +++ b/configure.ac -@@ -1452,11 +1452,11 @@ fi - # Set them to their new values for the tests below. - CC="$TARGET_CC" - if test x"$platform" = xemu ; then --CFLAGS="$TARGET_CFLAGS -Wno-error" -+CFLAGS="$TARGET_CFLAGS" - elif test "x$TARGET_APPLE_LINKER" = x1 ; then --CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error" -+CFLAGS="$TARGET_CFLAGS -nostdlib -static" - else --CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error" -+CFLAGS="$TARGET_CFLAGS -nostdlib" - fi - CPPFLAGS="$TARGET_CPPFLAGS" - -@@ -1990,6 +1990,14 @@ if test x"$enable_werror" != xno ; then - HOST_CFLAGS="$HOST_CFLAGS -Werror" +@@ -2147,6 +2147,14 @@ if test x"$enable_werror" != xno ; then + fi fi +AC_ARG_ENABLE([wextra], @@ -45,15 +33,15 @@ index 7b4e1854d3..490353713a 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index 2ff9b39357..35e14ff017 100644 +index 54f0f7f7664..e53ff352407 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common -@@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d +@@ -76,7 +76,7 @@ grubconfdir = $(sysconfdir)/grub.d platformdir = $(pkglibdir)/$(target_cpu)-$(platform) starfielddir = $(pkgdatadir)/themes/starfield --CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -+CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code +-CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-error=attributes ++CFLAGS_GNULIB = -Wno-undef -Wno-error=sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-error=attributes CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib CFLAGS_POSIX = -fno-builtin diff --git a/0089-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0089-module-verifier-make-it-possible-to-run-checkers-on-.patch deleted file mode 100644 index 78c15d6f..00000000 --- a/0089-module-verifier-make-it-possible-to-run-checkers-on-.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 1 Aug 2018 10:24:52 -0400 -Subject: [PATCH] module-verifier: make it possible to run checkers on - grub-module-verifierxx.c - -This makes it so you can treat grub-module-verifierxx.c as a file you can -build directly, so syntax checkers like vim's "syntastic" plugin, which uses -"gcc -x c -fsyntax-only" to build it, will work. - -One still has to do whatever setup is required to make it pick the right -include dirs, which -W options we use, etc., but this makes it so you can do -the checking on the file you're editing, rather than on a different file. - -v2: fix the typo in the #else clause in util/grub-module-verifierXX.c - -Signed-off-by: Peter Jones ---- - util/grub-module-verifier32.c | 2 ++ - util/grub-module-verifier64.c | 2 ++ - util/grub-module-verifierXX.c | 9 +++++++++ - 3 files changed, 13 insertions(+) - -diff --git a/util/grub-module-verifier32.c b/util/grub-module-verifier32.c -index 257229f8f0..ba7d41aafe 100644 ---- a/util/grub-module-verifier32.c -+++ b/util/grub-module-verifier32.c -@@ -1,2 +1,4 @@ - #define MODULEVERIFIER_ELF32 1 -+#ifndef GRUB_MODULE_VERIFIERXX - #include "grub-module-verifierXX.c" -+#endif -diff --git a/util/grub-module-verifier64.c b/util/grub-module-verifier64.c -index 4db6b4bedd..fc23ef800b 100644 ---- a/util/grub-module-verifier64.c -+++ b/util/grub-module-verifier64.c -@@ -1,2 +1,4 @@ - #define MODULEVERIFIER_ELF64 1 -+#ifndef GRUB_MODULE_VERIFIERXX - #include "grub-module-verifierXX.c" -+#endif -diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c -index ceb24309ae..a98e2f9b1a 100644 ---- a/util/grub-module-verifierXX.c -+++ b/util/grub-module-verifierXX.c -@@ -1,3 +1,12 @@ -+#define GRUB_MODULE_VERIFIERXX -+#if !defined(MODULEVERIFIER_ELF32) && !defined(MODULEVERIFIER_ELF64) -+#if __SIZEOF_POINTER__ == 8 -+#include "grub-module-verifier64.c" -+#else -+#include "grub-module-verifier32.c" -+#endif -+#endif -+ - #include - - #include diff --git a/0105-Fix-getroot.c-s-trampolines.patch b/0090-Fix-getroot.c-s-trampolines.patch similarity index 92% rename from 0105-Fix-getroot.c-s-trampolines.patch rename to 0090-Fix-getroot.c-s-trampolines.patch index e744b779..b1f65dea 100644 --- a/0105-Fix-getroot.c-s-trampolines.patch +++ b/0090-Fix-getroot.c-s-trampolines.patch @@ -12,10 +12,10 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c -index 9f730b3518..f0c503f43d 100644 +index 477fb420992..b32582eb302 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c -@@ -1264,22 +1264,20 @@ grub_util_get_grub_dev_os (const char *os_dev) +@@ -1261,22 +1261,20 @@ grub_util_get_grub_dev_os (const char *os_dev) return grub_dev; } diff --git a/0106-Do-not-allow-stack-trampolines-anywhere.patch b/0091-Do-not-allow-stack-trampolines-anywhere.patch similarity index 65% rename from 0106-Do-not-allow-stack-trampolines-anywhere.patch rename to 0091-Do-not-allow-stack-trampolines-anywhere.patch index 658c7a4c..0c3b2985 100644 --- a/0106-Do-not-allow-stack-trampolines-anywhere.patch +++ b/0091-Do-not-allow-stack-trampolines-anywhere.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 490353713a..a02d40a05b 100644 +index 81240397384..ae7683d0693 100644 --- a/configure.ac +++ b/configure.ac -@@ -1998,6 +1998,9 @@ if test x"$enable_wextra" != xno ; then +@@ -2155,6 +2155,9 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi @@ -24,15 +24,15 @@ index 490353713a..a02d40a05b 100644 TARGET_CCAS=$TARGET_CC diff --git a/conf/Makefile.common b/conf/Makefile.common -index 35e14ff017..0647c53b91 100644 +index e53ff352407..91ff6c905fb 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common -@@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d +@@ -76,7 +76,7 @@ grubconfdir = $(sysconfdir)/grub.d platformdir = $(pkglibdir)/$(target_cpu)-$(platform) starfielddir = $(pkgdatadir)/themes/starfield --CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -+CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Werror=trampolines -fno-trampolines +-CFLAGS_GNULIB = -Wno-undef -Wno-error=sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-error=attributes ++CFLAGS_GNULIB = -Wno-undef -Wno-error=sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-error=attributes -Werror=trampolines -fno-trampolines CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib CFLAGS_POSIX = -fno-builtin diff --git a/0107-Reimplement-boot_counter.patch b/0092-Reimplement-boot_counter.patch similarity index 96% rename from 0107-Reimplement-boot_counter.patch rename to 0092-Reimplement-boot_counter.patch index d018de43..1f0cb967 100644 --- a/0107-Reimplement-boot_counter.patch +++ b/0092-Reimplement-boot_counter.patch @@ -23,10 +23,10 @@ Signed-off-by: Christian Glombek create mode 100644 util/grub.d/01_fallback_counting.in diff --git a/Makefile.util.def b/Makefile.util.def -index d066652e9b..e10fe766d1 100644 +index 01096ded815..0bb47c6d40a 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -458,6 +458,12 @@ script = { +@@ -461,6 +461,12 @@ script = { installdir = grubconf; }; @@ -40,10 +40,10 @@ index d066652e9b..e10fe766d1 100644 name = '01_menu_auto_hide'; common = util/grub.d/01_menu_auto_hide.in; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 4f203533f5..ea4d59f51b 100644 +index f26c689723c..08c0c67bcf2 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -398,6 +398,11 @@ kernel = { +@@ -417,6 +417,11 @@ kernel = { extra_dist = kern/mips/cache_flush.S; }; @@ -57,7 +57,7 @@ index 4f203533f5..ea4d59f51b 100644 mansection = 1; diff --git a/grub-core/commands/increment.c b/grub-core/commands/increment.c new file mode 100644 -index 0000000000..79cf137656 +index 00000000000..79cf137656c --- /dev/null +++ b/grub-core/commands/increment.c @@ -0,0 +1,105 @@ @@ -168,7 +168,7 @@ index 0000000000..79cf137656 +} diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in new file mode 100644 -index 0000000000..be0e770ea8 +index 00000000000..be0e770ea82 --- /dev/null +++ b/util/grub.d/01_fallback_counting.in @@ -0,0 +1,22 @@ diff --git a/0108-Fix-menu-entry-selection-based-on-ID-and-title.patch b/0093-Fix-menu-entry-selection-based-on-ID-and-title.patch similarity index 99% rename from 0108-Fix-menu-entry-selection-based-on-ID-and-title.patch rename to 0093-Fix-menu-entry-selection-based-on-ID-and-title.patch index af749012..597e0c1c 100644 --- a/0108-Fix-menu-entry-selection-based-on-ID-and-title.patch +++ b/0093-Fix-menu-entry-selection-based-on-ID-and-title.patch @@ -24,7 +24,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index d7a222e681..4a02aadb01 100644 +index 6444ee6f969..b0cfa32ddd8 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -164,12 +164,12 @@ grub_menu_set_timeout (int timeout) diff --git a/0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch b/0094-Make-the-menu-entry-users-option-argument-to-be-opti.patch similarity index 97% rename from 0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch rename to 0094-Make-the-menu-entry-users-option-argument-to-be-opti.patch index 68779ebf..e0d36db7 100644 --- a/0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch +++ b/0094-Make-the-menu-entry-users-option-argument-to-be-opti.patch @@ -23,7 +23,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index b194123eb6..b175a1b43b 100644 +index b194123eb67..b175a1b43b7 100644 --- a/grub-core/commands/menuentry.c +++ b/grub-core/commands/menuentry.c @@ -29,7 +29,7 @@ static const struct grub_arg_option options[] = diff --git a/0110-Add-efi-export-env-and-efi-load-env-commands.patch b/0095-Add-efi-export-env-and-efi-load-env-commands.patch similarity index 93% rename from 0110-Add-efi-export-env-and-efi-load-env-commands.patch rename to 0095-Add-efi-export-env-and-efi-load-env-commands.patch index 33d27240..6a5abefe 100644 --- a/0110-Add-efi-export-env-and-efi-load-env-commands.patch +++ b/0095-Add-efi-export-env-and-efi-load-env-commands.patch @@ -21,10 +21,10 @@ Signed-off-by: Peter Jones create mode 100644 grub-core/commands/efi/env.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index ea4d59f51b..dc9fea6f44 100644 +index 08c0c67bcf2..4aa20cdfc13 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -820,6 +820,12 @@ module = { +@@ -842,6 +842,12 @@ module = { enable = efi; }; @@ -39,7 +39,7 @@ index ea4d59f51b..dc9fea6f44 100644 efi = commands/efi/efifwsetup.c; diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c new file mode 100644 -index 0000000000..cbd13e03e8 +index 00000000000..45f107ccd5b --- /dev/null +++ b/grub-core/commands/efi/env.c @@ -0,0 +1,168 @@ @@ -74,7 +74,7 @@ index 0000000000..cbd13e03e8 + +GRUB_MOD_LICENSE ("GPLv3+"); + -+static const grub_efi_guid_t grub_env_guid = GRUB_EFI_GRUB_VARIABLE_GUID; ++static const grub_guid_t grub_env_guid = GRUB_EFI_GRUB_VARIABLE_GUID; + +static grub_err_t +grub_efi_export_env(grub_command_t cmd __attribute__ ((unused)), @@ -212,10 +212,10 @@ index 0000000000..cbd13e03e8 + grub_unregister_command (loadenv_cmd); +} diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 2a446f5031..14bc10eb56 100644 +index bf16c4307bc..ef837387368 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -225,6 +225,9 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid, +@@ -227,6 +227,9 @@ grub_efi_set_variable_with_attributes (const char *var, const grub_guid_t *guid, if (status == GRUB_EFI_SUCCESS) return GRUB_ERR_NONE; @@ -226,10 +226,10 @@ index 2a446f5031..14bc10eb56 100644 } diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 2d12e6188f..0574d8d621 100644 +index b5201974a76..dee3918fd35 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c -@@ -85,11 +85,6 @@ stack_protector_init (void) +@@ -106,11 +106,6 @@ stack_protector_init (void) grub_addr_t grub_modbase; @@ -242,7 +242,7 @@ index 2d12e6188f..0574d8d621 100644 static int set_var (const char *name, const char *value, diff --git a/grub-core/lib/envblk.c b/grub-core/lib/envblk.c -index 2e4e78b132..874506da16 100644 +index 2e4e78b132d..874506da169 100644 --- a/grub-core/lib/envblk.c +++ b/grub-core/lib/envblk.c @@ -223,6 +223,49 @@ grub_envblk_delete (grub_envblk_t envblk, const char *name) @@ -296,7 +296,7 @@ index 2e4e78b132..874506da16 100644 grub_envblk_iterate (grub_envblk_t envblk, void *hook_data, diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index d506f7e75b..a6ccc11383 100644 +index d506f7e75bc..a6ccc113839 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -25,6 +25,7 @@ @@ -308,12 +308,12 @@ index d506f7e75b..a6ccc11383 100644 #include #include diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 2e0691454b..8dfc89a33b 100644 +index 8d98203a784..6c2c1f36e37 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -24,6 +24,11 @@ - #include - #include +@@ -36,6 +36,11 @@ struct linux_arch_kernel_header { + struct grub_pe_image_header pe_image_header; + }; +#define GRUB_EFI_GRUB_VARIABLE_GUID \ + { 0x91376aff, 0xcba6, 0x42be, \ @@ -324,7 +324,7 @@ index 2e0691454b..8dfc89a33b 100644 extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table); extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle); diff --git a/include/grub/lib/envblk.h b/include/grub/lib/envblk.h -index c3e6559217..ab969af246 100644 +index c3e65592170..ab969af2461 100644 --- a/include/grub/lib/envblk.h +++ b/include/grub/lib/envblk.h @@ -22,6 +22,8 @@ diff --git a/0112-Export-all-variables-from-the-initial-context-when-c.patch b/0096-Export-all-variables-from-the-initial-context-when-c.patch similarity index 95% rename from 0112-Export-all-variables-from-the-initial-context-when-c.patch rename to 0096-Export-all-variables-from-the-initial-context-when-c.patch index 214fa4f3..a35174b4 100644 --- a/0112-Export-all-variables-from-the-initial-context-when-c.patch +++ b/0096-Export-all-variables-from-the-initial-context-when-c.patch @@ -17,7 +17,7 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/grub-core/normal/context.c b/grub-core/normal/context.c -index ee53d4a68e..87edd254c4 100644 +index ba185e91599..b4baa4392cd 100644 --- a/grub-core/normal/context.c +++ b/grub-core/normal/context.c @@ -99,7 +99,7 @@ grub_env_new_context (int export_all) @@ -30,7 +30,7 @@ index ee53d4a68e..87edd254c4 100644 int grub_extractor_level = 0; diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 4a02aadb01..fe2e77a43e 100644 +index b0cfa32ddd8..30ddcea0c11 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -375,8 +375,6 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) diff --git a/0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch b/0097-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch similarity index 96% rename from 0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch rename to 0097-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch index 43e8d168..08cc5632 100644 --- a/0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +++ b/0097-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch @@ -21,10 +21,10 @@ Signed-off-by: Robbie Harwood rename util/grub.d/{01_menu_auto_hide.in => 12_menu_auto_hide.in} (58%) diff --git a/Makefile.util.def b/Makefile.util.def -index e10fe766d1..b4ce5383b7 100644 +index 0bb47c6d40a..885dc688a60 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -459,14 +459,14 @@ script = { +@@ -462,14 +462,14 @@ script = { }; script = { @@ -43,7 +43,7 @@ index e10fe766d1..b4ce5383b7 100644 installdir = grubconf; }; -@@ -518,6 +518,12 @@ script = { +@@ -521,6 +521,12 @@ script = { condition = COND_HOST_LINUX; }; @@ -60,7 +60,7 @@ diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/08_fallback_count similarity index 65% rename from util/grub.d/01_fallback_counting.in rename to util/grub.d/08_fallback_counting.in -index be0e770ea8..2e2c3ff7d3 100644 +index be0e770ea82..2e2c3ff7d31 100644 --- a/util/grub.d/01_fallback_counting.in +++ b/util/grub.d/08_fallback_counting.in @@ -1,15 +1,17 @@ @@ -89,7 +89,7 @@ index be0e770ea8..2e2c3ff7d3 100644 set boot_counter=-1 diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in new file mode 100644 -index 0000000000..6c88d933dd +index 00000000000..6c88d933dde --- /dev/null +++ b/util/grub.d/10_reset_boot_success.in @@ -0,0 +1,25 @@ @@ -122,7 +122,7 @@ diff --git a/util/grub.d/01_menu_auto_hide.in b/util/grub.d/12_menu_auto_hide.in similarity index 58% rename from util/grub.d/01_menu_auto_hide.in rename to util/grub.d/12_menu_auto_hide.in -index ad175870a5..6a7c0fa0d4 100644 +index ad175870a54..6a7c0fa0d43 100644 --- a/util/grub.d/01_menu_auto_hide.in +++ b/util/grub.d/12_menu_auto_hide.in @@ -1,5 +1,8 @@ diff --git a/0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch b/0098-Don-t-assume-that-boot-commands-will-only-return-on-.patch similarity index 98% rename from 0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch rename to 0098-Don-t-assume-that-boot-commands-will-only-return-on-.patch index df365176..06c6581d 100644 --- a/0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch +++ b/0098-Don-t-assume-that-boot-commands-will-only-return-on-.patch @@ -17,7 +17,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index fe2e77a43e..ec0c92bade 100644 +index 30ddcea0c11..cda10fa8b3f 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -285,7 +285,7 @@ get_and_remove_first_entry_number (grub_menu_t menu, const char *name) diff --git a/0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch b/0099-grub-set-bootflag-Update-comment-about-running-as-ro.patch similarity index 96% rename from 0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch rename to 0099-grub-set-bootflag-Update-comment-about-running-as-ro.patch index 9ffb3aec..4fa4df49 100644 --- a/0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch +++ b/0099-grub-set-bootflag-Update-comment-about-running-as-ro.patch @@ -13,7 +13,7 @@ Signed-off-by: Hans de Goede 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index a6ccc11383..3eb04beb5e 100644 +index a6ccc113839..3eb04beb5e7 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -18,7 +18,7 @@ diff --git a/0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch b/0100-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch similarity index 99% rename from 0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch rename to 0100-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch index 11722d17..ab3f79ea 100644 --- a/0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +++ b/0100-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch @@ -13,7 +13,7 @@ Signed-off-by: Hans de Goede 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index 3eb04beb5e..3b4c25ca2a 100644 +index 3eb04beb5e7..3b4c25ca2ac 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -28,7 +28,9 @@ diff --git a/0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch b/0101-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch similarity index 98% rename from 0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch rename to 0101-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch index 948ff737..a32c1465 100644 --- a/0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +++ b/0101-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch @@ -53,7 +53,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in -index 6c88d933dd..e73f4137b3 100644 +index 6c88d933dde..e73f4137b36 100644 --- a/util/grub.d/10_reset_boot_success.in +++ b/util/grub.d/10_reset_boot_success.in @@ -6,18 +6,18 @@ diff --git a/0118-Add-start-symbol-for-RISC-V.patch b/0102-Add-start-symbol-for-RISC-V.patch similarity index 95% rename from 0118-Add-start-symbol-for-RISC-V.patch rename to 0102-Add-start-symbol-for-RISC-V.patch index 2746fa25..677efae0 100644 --- a/0118-Add-start-symbol-for-RISC-V.patch +++ b/0102-Add-start-symbol-for-RISC-V.patch @@ -15,7 +15,7 @@ Signed-off-by: David Abdurachmanov 1 file changed, 1 insertion(+) diff --git a/grub-core/kern/riscv/efi/startup.S b/grub-core/kern/riscv/efi/startup.S -index f2a7b2b1ed..781773136e 100644 +index f2a7b2b1ede..781773136e8 100644 --- a/grub-core/kern/riscv/efi/startup.S +++ b/grub-core/kern/riscv/efi/startup.S @@ -29,6 +29,7 @@ diff --git a/0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch b/0103-bootstrap.conf-Force-autogen.sh-to-use-python3.patch similarity index 92% rename from 0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch rename to 0103-bootstrap.conf-Force-autogen.sh-to-use-python3.patch index 8bfc964c..c25b28ea 100644 --- a/0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +++ b/0103-bootstrap.conf-Force-autogen.sh-to-use-python3.patch @@ -19,10 +19,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf -index 6b043fc354..52d4af44be 100644 +index 7a7813d2825..60de0597c50 100644 --- a/bootstrap.conf +++ b/bootstrap.conf -@@ -92,7 +92,7 @@ bootstrap_post_import_hook () { +@@ -94,7 +94,7 @@ bootstrap_post_import_hook () { patch -d po -p3 \ < "po/gettext-patches/$patchname.patch" done diff --git a/0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch b/0104-efi-http-Export-fw-http-_path-variables-to-make-them.patch similarity index 95% rename from 0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch rename to 0104-efi-http-Export-fw-http-_path-variables-to-make-them.patch index f745782b..55cce245 100644 --- a/0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch +++ b/0104-efi-http-Export-fw-http-_path-variables-to-make-them.patch @@ -25,7 +25,7 @@ Signed-off-by: Javier Martinez Canillas 2 files changed, 2 insertions(+) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 1c540fc8c2..b573be6650 100644 +index 7347a8de676..353a62ef1e1 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -143,6 +143,7 @@ grub_set_prefix_and_root (void) @@ -37,7 +37,7 @@ index 1c540fc8c2..b573be6650 100644 grub_free (fw_path); } diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index de351b2cd0..755b7a6d05 100644 +index 5e97f5d5e70..3be86c141f5 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -39,6 +39,7 @@ http_configure (struct grub_efi_net_device *dev, int prefer_ip6) diff --git a/0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch b/0105-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch similarity index 94% rename from 0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch rename to 0105-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch index 03d85c2c..30d206e8 100644 --- a/0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +++ b/0105-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch @@ -43,7 +43,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index 755b7a6d05..fc8cb25ae0 100644 +index 3be86c141f5..c37c359c713 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c @@ -158,13 +158,7 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, @@ -102,13 +102,13 @@ index 755b7a6d05..fc8cb25ae0 100644 request_data.method = (headeronly > 0) ? GRUB_EFI_HTTPMETHODHEAD : GRUB_EFI_HTTPMETHODGET; request_message.data.request = &request_data; -@@ -228,6 +244,9 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, +@@ -225,6 +241,9 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, - status = efi_call_2 (http->request, http, &request_token); + status = http->request(http, &request_token); + if (hostname) + grub_free (hostname); + if (status != GRUB_EFI_SUCCESS) { - efi_call_1 (b->close_event, request_token.event); + b->close_event(request_token.event); diff --git a/0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch b/0106-efi-net-Allow-to-specify-a-port-number-in-addresses.patch similarity index 97% rename from 0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch rename to 0106-efi-net-Allow-to-specify-a-port-number-in-addresses.patch index 8fe26cd2..96ebab3e 100644 --- a/0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +++ b/0106-efi-net-Allow-to-specify-a-port-number-in-addresses.patch @@ -25,7 +25,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 6603cd83ed..84573937b1 100644 +index 1f7e1b63557..4ef3f709ee2 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -742,7 +742,7 @@ grub_efi_net_parse_address (const char *address, diff --git a/0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch b/0107-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch similarity index 97% rename from 0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch rename to 0107-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch index 2dc70010..eb342e8c 100644 --- a/0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +++ b/0107-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch @@ -21,7 +21,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index b711a5d945..313c818b18 100644 +index 1deba25e79e..fb2fe850d0e 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -56,9 +56,20 @@ int diff --git a/0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch b/0108-efi-net-Print-a-debug-message-if-parsing-the-address.patch similarity index 98% rename from 0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch rename to 0108-efi-net-Print-a-debug-message-if-parsing-the-address.patch index da94e081..8ef8514f 100644 --- a/0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch +++ b/0108-efi-net-Print-a-debug-message-if-parsing-the-address.patch @@ -22,7 +22,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 84573937b1..a3f0535d43 100644 +index 4ef3f709ee2..a9536c66550 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -778,9 +778,9 @@ grub_efi_net_parse_address (const char *address, diff --git a/0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch b/0109-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch similarity index 96% rename from 0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch rename to 0109-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch index 8793b0df..3dd525af 100644 --- a/0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +++ b/0109-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch @@ -12,7 +12,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c -index 14d5964983..4d61f4e979 100644 +index 14d59649832..4d61f4e9790 100644 --- a/grub-core/kern/term.c +++ b/grub-core/kern/term.c @@ -144,9 +144,10 @@ grub_key_is_interrupt (int key) diff --git a/0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch b/0110-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch similarity index 93% rename from 0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch rename to 0110-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch index 7fef93eb..2f443d7a 100644 --- a/0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +++ b/0110-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch @@ -20,10 +20,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index b52b558d63..7f878b5615 100644 +index af486198399..ce2b492c353 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c -@@ -501,13 +501,20 @@ http_open (struct grub_file *file, const char *filename) +@@ -502,13 +502,20 @@ http_open (struct grub_file *file, const char *filename) { grub_err_t err; struct http_data *data; diff --git a/0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch b/0111-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch similarity index 95% rename from 0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch rename to 0111-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch index f3b10c14..f29706f3 100644 --- a/0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +++ b/0111-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+) diff --git a/grub-core/commands/efi/env.c b/grub-core/commands/efi/env.c -index cbd13e03e8..977edb6b06 100644 +index 45f107ccd5b..4080f24fdb8 100644 --- a/grub-core/commands/efi/env.c +++ b/grub-core/commands/efi/env.c @@ -149,6 +149,8 @@ grub_efi_load_env(grub_command_t cmd __attribute__ ((unused)), diff --git a/0111-Make-it-possible-to-subtract-conditions-from-debug.patch b/0111-Make-it-possible-to-subtract-conditions-from-debug.patch deleted file mode 100644 index 15305f85..00000000 --- a/0111-Make-it-possible-to-subtract-conditions-from-debug.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 17 Jan 2019 13:10:39 -0500 -Subject: [PATCH] Make it possible to subtract conditions from debug= - -This makes it so you can do set debug to "all,-scripting,-lexer" and get the -obvious outcome. Any negation present will take preference over that -conditional, so "all,-scripting,scripting" is the same thing as -"all,-scripting". - -Signed-off-by: Peter Jones ---- - grub-core/kern/misc.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 9a2fae6398..578bf51a5f 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -164,12 +164,24 @@ int - grub_debug_enabled (const char * condition) - { - const char *debug; -+ char *negcond; -+ int negated = 0; - - debug = grub_env_get ("debug"); - if (!debug) - return 0; - -- if (grub_strword (debug, "all") || grub_strword (debug, condition)) -+ negcond = grub_zalloc (grub_strlen (condition) + 2); -+ if (negcond) -+ { -+ grub_strcpy (negcond, "-"); -+ grub_strcpy (negcond+1, condition); -+ negated = grub_strword (debug, negcond); -+ grub_free (negcond); -+ } -+ -+ if (!negated && -+ (grub_strword (debug, "all") || grub_strword (debug, condition))) - return 1; - - return 0; diff --git a/0131-efi-dhcp-fix-some-allocation-error-checking.patch b/0112-efi-dhcp-fix-some-allocation-error-checking.patch similarity index 83% rename from 0131-efi-dhcp-fix-some-allocation-error-checking.patch rename to 0112-efi-dhcp-fix-some-allocation-error-checking.patch index 90e7a34d..e891757c 100644 --- a/0131-efi-dhcp-fix-some-allocation-error-checking.patch +++ b/0112-efi-dhcp-fix-some-allocation-error-checking.patch @@ -9,7 +9,7 @@ Signed-off-by: Peter Jones 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c -index dbef63d8c0..e5c79b748b 100644 +index ca19902441b..6cc0dad85a7 100644 --- a/grub-core/net/efi/dhcp.c +++ b/grub-core/net/efi/dhcp.c @@ -80,7 +80,7 @@ grub_efi_dhcp4_parse_dns (grub_efi_dhcp4_protocol_t *dhcp4, grub_efi_dhcp4_packe @@ -26,10 +26,10 @@ index dbef63d8c0..e5c79b748b 100644 if (status == GRUB_EFI_BUFFER_TOO_SMALL && count) { - options = grub_malloc (count * sizeof(*options)); -- status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options); +- status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, options); + options = grub_calloc (count, sizeof(*options)); + if (options) -+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options); ++ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, options); + else + status = GRUB_EFI_OUT_OF_RESOURCES; } diff --git a/0132-efi-http-fix-some-allocation-error-checking.patch b/0113-efi-http-fix-some-allocation-error-checking.patch similarity index 84% rename from 0132-efi-http-fix-some-allocation-error-checking.patch rename to 0113-efi-http-fix-some-allocation-error-checking.patch index 149ada89..ba34e7fb 100644 --- a/0132-efi-http-fix-some-allocation-error-checking.patch +++ b/0113-efi-http-fix-some-allocation-error-checking.patch @@ -9,10 +9,10 @@ Signed-off-by: Peter Jones 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -index fc8cb25ae0..26647a50fa 100644 +index c37c359c713..0568ea5d43e 100644 --- a/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c -@@ -412,8 +412,8 @@ grub_efihttp_open (struct grub_efi_net_device *dev, +@@ -403,8 +403,8 @@ grub_efihttp_open (struct grub_efi_net_device *dev, int type) { grub_err_t err; @@ -23,7 +23,7 @@ index fc8cb25ae0..26647a50fa 100644 char *file_name = NULL; const char *http_path; -@@ -441,8 +441,11 @@ grub_efihttp_open (struct grub_efi_net_device *dev, +@@ -432,8 +432,11 @@ grub_efihttp_open (struct grub_efi_net_device *dev, return err; } diff --git a/0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch b/0114-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch similarity index 98% rename from 0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch rename to 0114-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch index 6413eb6d..c4beaa47 100644 --- a/0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +++ b/0114-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index 313c818b18..9725e928f7 100644 +index fb2fe850d0e..e9fc24865ec 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -4,15 +4,20 @@ @@ -82,7 +82,7 @@ index 313c818b18..9725e928f7 100644 char *subnet, *gateway, *mask; grub_uint32_t u32_subnet, u32_gateway; diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c -index 017c4d05bc..a46f6f9b68 100644 +index 29a03973265..050af4fbfd1 100644 --- a/grub-core/net/efi/ip6_config.c +++ b/grub-core/net/efi/ip6_config.c @@ -3,6 +3,7 @@ diff --git a/0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch b/0115-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch similarity index 97% rename from 0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch rename to 0115-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch index ea92110b..d0dd8870 100644 --- a/0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +++ b/0115-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -index 9725e928f7..cb880fc3e8 100644 +index e9fc24865ec..85a090ec422 100644 --- a/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c @@ -61,7 +61,8 @@ int diff --git a/0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch b/0116-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch similarity index 96% rename from 0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch rename to 0116-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch index 915e6d72..1ecbfd88 100644 --- a/0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +++ b/0116-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c -index a46f6f9b68..1c5415d718 100644 +index 050af4fbfd1..952bda9fa74 100644 --- a/grub-core/net/efi/ip6_config.c +++ b/grub-core/net/efi/ip6_config.c @@ -85,7 +85,7 @@ grub_efi_string_to_ip6_address (const char *val, grub_efi_ipv6_address_t *addres diff --git a/0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch b/0117-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch similarity index 97% rename from 0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch rename to 0117-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch index fbba65a7..fe583d35 100644 --- a/0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +++ b/0117-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index a3f0535d43..78e5442fc5 100644 +index a9536c66550..0a1e604b5bd 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c @@ -729,7 +729,7 @@ grub_efi_net_parse_address (const char *address, diff --git a/0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch b/0118-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch similarity index 97% rename from 0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch rename to 0118-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch index 9b9acfea..ea5be7c4 100644 --- a/0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +++ b/0118-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch @@ -14,7 +14,7 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c -index 531949cba5..73e2bb01c1 100644 +index b84f86ea470..e828fb23e96 100644 --- a/grub-core/net/efi/pxe.c +++ b/grub-core/net/efi/pxe.c @@ -187,7 +187,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) diff --git a/0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch b/0119-Add-systemd-integration-scripts-to-make-systemctl-re.patch similarity index 91% rename from 0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch rename to 0119-Add-systemd-integration-scripts-to-make-systemctl-re.patch index 8cf45c3e..ce424e17 100644 --- a/0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch +++ b/0119-Add-systemd-integration-scripts-to-make-systemctl-re.patch @@ -65,10 +65,10 @@ Signed-off-by: Hans de Goede create mode 100644 util/systemd/systemd-integration.sh.in diff --git a/Makefile.util.def b/Makefile.util.def -index b4ce5383b7..6366442129 100644 +index 885dc688a60..8e52e48c780 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -470,6 +470,12 @@ script = { +@@ -473,6 +473,12 @@ script = { installdir = grubconf; }; @@ -81,7 +81,7 @@ index b4ce5383b7..6366442129 100644 script = { name = '01_users'; common = util/grub.d/01_users.in; -@@ -569,6 +575,27 @@ script = { +@@ -578,6 +584,27 @@ script = { installdir = grubconf; }; @@ -110,10 +110,10 @@ index b4ce5383b7..6366442129 100644 mansection = 1; name = grub-mkrescue; diff --git a/conf/Makefile.common b/conf/Makefile.common -index 0647c53b91..9fe5863b2d 100644 +index 91ff6c905fb..c8756d8146f 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common -@@ -63,8 +63,11 @@ CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS) +@@ -73,8 +73,11 @@ CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS) # Other variables grubconfdir = $(sysconfdir)/grub.d @@ -123,21 +123,21 @@ index 0647c53b91..9fe5863b2d 100644 +systemdunitdir = ${prefix}/lib/systemd/system +systemd_logind_service_ddir = $(systemdunitdir)/systemd-logind.service.d - CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Werror=trampolines -fno-trampolines + CFLAGS_GNULIB = -Wno-undef -Wno-error=sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-error=attributes -Werror=trampolines -fno-trampolines CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib -@@ -121,6 +124,9 @@ noinst_LIBRARIES = - dist_noinst_DATA = - platform_SCRIPTS = +@@ -133,6 +136,9 @@ platform_SCRIPTS = platform_PROGRAMS = + sbin_SCRIPTS = + sbin_PROGRAMS = +grublibexec_SCRIPTS = +systemdunit_SCRIPTS = +systemd_logind_service_d_SCRIPTS = - TESTS = EXTRA_DIST = + CLEANFILES = diff --git a/util/grub.d/14_menu_show_once.in b/util/grub.d/14_menu_show_once.in new file mode 100755 -index 0000000000..1cd7f36142 +index 00000000000..1cd7f36142b --- /dev/null +++ b/util/grub.d/14_menu_show_once.in @@ -0,0 +1,13 @@ @@ -156,7 +156,7 @@ index 0000000000..1cd7f36142 +EOF diff --git a/util/systemd/10-grub-logind-service.conf.in b/util/systemd/10-grub-logind-service.conf.in new file mode 100644 -index 0000000000..f2d4ac0073 +index 00000000000..f2d4ac00732 --- /dev/null +++ b/util/systemd/10-grub-logind-service.conf.in @@ -0,0 +1,2 @@ @@ -164,7 +164,7 @@ index 0000000000..f2d4ac0073 +Environment=SYSTEMD_REBOOT_TO_BOOT_LOADER_MENU=true diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in new file mode 100644 -index 0000000000..c81fb594ce +index 00000000000..c81fb594ce1 --- /dev/null +++ b/util/systemd/grub-systemd-integration.service.in @@ -0,0 +1,8 @@ @@ -178,7 +178,7 @@ index 0000000000..c81fb594ce +ExecStart=@libexecdir@/@grubdirname@/systemd-integration.sh diff --git a/util/systemd/systemd-integration.sh.in b/util/systemd/systemd-integration.sh.in new file mode 100644 -index 0000000000..dc1218597b +index 00000000000..dc1218597bc --- /dev/null +++ b/util/systemd/systemd-integration.sh.in @@ -0,0 +1,6 @@ diff --git a/0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch b/0120-systemd-integration.sh-Also-set-old-menu_show_once-g.patch similarity index 97% rename from 0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch rename to 0120-systemd-integration.sh-Also-set-old-menu_show_once-g.patch index a16ed68e..9021de50 100644 --- a/0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +++ b/0120-systemd-integration.sh-Also-set-old-menu_show_once-g.patch @@ -18,7 +18,7 @@ Signed-off-by: Hans de Goede 1 file changed, 5 insertions(+) diff --git a/util/systemd/systemd-integration.sh.in b/util/systemd/systemd-integration.sh.in -index dc1218597b..a4c071c5b0 100644 +index dc1218597bc..a4c071c5b0c 100644 --- a/util/systemd/systemd-integration.sh.in +++ b/util/systemd/systemd-integration.sh.in @@ -4,3 +4,8 @@ TIMEOUT_USEC=$(cat /run/systemd/reboot-to-boot-loader-menu) diff --git a/0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch b/0121-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch similarity index 93% rename from 0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch rename to 0121-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch index f891a695..6011b339 100644 --- a/0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +++ b/0121-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch @@ -29,10 +29,10 @@ Signed-off-by: Renaud Métrich 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index 597111077b..2601438260 100644 +index f8a129eb7f1..2d9ab65aee0 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c -@@ -135,20 +135,28 @@ query_mode (void) +@@ -145,20 +145,28 @@ query_mode (void) int e; e = write_mode (0); @@ -65,7 +65,7 @@ index 597111077b..2601438260 100644 return 0; } -@@ -165,7 +173,13 @@ set_scancodes (void) +@@ -175,7 +183,13 @@ set_scancodes (void) } #if !USE_SCANCODE_SET @@ -80,7 +80,7 @@ index 597111077b..2601438260 100644 return; #else -@@ -266,6 +280,7 @@ grub_keyboard_controller_init (void) +@@ -276,6 +290,7 @@ grub_keyboard_controller_init (void) grub_keyboard_orig_set = 2; #else grub_keyboard_controller_orig = grub_keyboard_controller_read (); @@ -88,7 +88,7 @@ index 597111077b..2601438260 100644 grub_keyboard_orig_set = query_mode (); #endif set_scancodes (); -@@ -275,11 +290,15 @@ grub_keyboard_controller_init (void) +@@ -285,11 +300,15 @@ grub_keyboard_controller_init (void) static grub_err_t grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused))) { @@ -105,7 +105,7 @@ index 597111077b..2601438260 100644 } diff --git a/include/grub/at_keyboard.h b/include/grub/at_keyboard.h -index bcb4d9ba78..9414dc1b99 100644 +index bcb4d9ba78f..9414dc1b996 100644 --- a/include/grub/at_keyboard.h +++ b/include/grub/at_keyboard.h @@ -19,6 +19,10 @@ diff --git a/0144-grub-install-disable-support-for-EFI-platforms.patch b/0122-grub-install-disable-support-for-EFI-platforms.patch similarity index 81% rename from 0144-grub-install-disable-support-for-EFI-platforms.patch rename to 0122-grub-install-disable-support-for-EFI-platforms.patch index f6a75304..380dbef1 100644 --- a/0144-grub-install-disable-support-for-EFI-platforms.patch +++ b/0122-grub-install-disable-support-for-EFI-platforms.patch @@ -21,15 +21,15 @@ Resolves: rhbz#1737444 Signed-off-by: Jan Hlavac [rharwood: drop man page] --- - util/grub-install.c | 37 ++++++++++++++++--------------------- + util/grub-install.c | 41 +++++++++++++++++++---------------------- docs/grub.texi | 7 +++++++ - 2 files changed, 23 insertions(+), 21 deletions(-) + 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index a2bec7446c..5babc7af55 100644 +index 66ef9494d9d..828e8722ba5 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -899,6 +899,22 @@ main (int argc, char *argv[]) +@@ -915,6 +915,25 @@ main (int argc, char *argv[]) platform = grub_install_get_target (grub_install_source_directory); @@ -39,6 +39,9 @@ index a2bec7446c..5babc7af55 100644 + case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_I386_EFI: + case GRUB_INSTALL_PLATFORM_IA64_EFI: ++ case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: ++ case GRUB_INSTALL_PLATFORM_RISCV32_EFI: ++ case GRUB_INSTALL_PLATFORM_RISCV64_EFI: + case GRUB_INSTALL_PLATFORM_X86_64_EFI: + is_efi = 1; + grub_util_error (_("this utility cannot be used for EFI platforms" @@ -52,7 +55,7 @@ index a2bec7446c..5babc7af55 100644 { char *platname = grub_install_get_platform_name (platform); fprintf (stderr, _("Installing for %s platform.\n"), platname); -@@ -1011,28 +1027,7 @@ main (int argc, char *argv[]) +@@ -1029,27 +1048,6 @@ main (int argc, char *argv[]) grub_hostfs_init (); grub_host_init (); @@ -62,6 +65,7 @@ index a2bec7446c..5babc7af55 100644 - case GRUB_INSTALL_PLATFORM_X86_64_EFI: - case GRUB_INSTALL_PLATFORM_ARM_EFI: - case GRUB_INSTALL_PLATFORM_ARM64_EFI: +- case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: - case GRUB_INSTALL_PLATFORM_RISCV32_EFI: - case GRUB_INSTALL_PLATFORM_RISCV64_EFI: - case GRUB_INSTALL_PLATFORM_IA64_EFI: @@ -76,16 +80,22 @@ index a2bec7446c..5babc7af55 100644 - break; - } - + switch (platform) + { + case GRUB_INSTALL_PLATFORM_I386_IEEE1275: +@@ -1065,7 +1063,6 @@ main (int argc, char *argv[]) + } + /* Find the EFI System Partition. */ - if (is_efi) { grub_fs_t fs; diff --git a/docs/grub.texi b/docs/grub.texi -index 04ed6ac1f0..4870faaa00 100644 +index 44c4e665a0d..1e577d2fee9 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -6509,6 +6509,13 @@ grub2-install @var{install_device} +@@ -7112,6 +7112,13 @@ grub2-install @var{install_device} The device name @var{install_device} is an OS device name or a GRUB device name. diff --git a/0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch b/0123-New-with-debug-timestamps-configure-flag-to-prepend-.patch similarity index 84% rename from 0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch rename to 0123-New-with-debug-timestamps-configure-flag-to-prepend-.patch index ec5b30b0..426d5be9 100644 --- a/0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch +++ b/0123-New-with-debug-timestamps-configure-flag-to-prepend-.patch @@ -15,10 +15,10 @@ Signed-off-by: Renaud Métrich 3 files changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac -index a02d40a05b..ab0d326f00 100644 +index ae7683d0693..016cd3d4e0e 100644 --- a/configure.ac +++ b/configure.ac -@@ -1585,6 +1585,17 @@ else +@@ -1686,6 +1686,17 @@ else fi AC_SUBST([BOOT_TIME_STATS]) @@ -33,10 +33,10 @@ index a02d40a05b..ab0d326f00 100644 +fi +AC_SUBST([DEBUG_WITH_TIMESTAMPS]) + - AC_ARG_ENABLE([grub-emu-sdl], - [AS_HELP_STRING([--enable-grub-emu-sdl], - [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])]) -@@ -2136,6 +2147,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) + AC_ARG_ENABLE([grub-emu-sdl2], + [AS_HELP_STRING([--enable-grub-emu-sdl2], + [build and install the `grub-emu' debugging utility with SDL2 support (default=guessed)])]) +@@ -2296,6 +2307,7 @@ AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) @@ -44,7 +44,7 @@ index a02d40a05b..ab0d326f00 100644 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) -@@ -2231,6 +2243,12 @@ else +@@ -2397,6 +2409,12 @@ else echo With boot time statistics: No fi @@ -58,12 +58,12 @@ index a02d40a05b..ab0d326f00 100644 echo efiemu runtime: Yes else diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 578bf51a5f..9f54b6b7d2 100644 +index 779586658cb..d40586b9268 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -25,6 +25,9 @@ - #include - #include +@@ -27,6 +27,9 @@ + #include + #include #include +#if DEBUG_WITH_TIMESTAMPS +#include @@ -71,7 +71,7 @@ index 578bf51a5f..9f54b6b7d2 100644 union printf_arg { -@@ -192,9 +195,26 @@ grub_real_dprintf (const char *file, const int line, const char *condition, +@@ -236,9 +239,26 @@ grub_real_dprintf (const char *file, const int line, const char *condition, const char *fmt, ...) { va_list args; @@ -95,14 +95,14 @@ index 578bf51a5f..9f54b6b7d2 100644 + else + last_had_cr = 0; +#endif - grub_printf ("%s:%d: ", file, line); + grub_printf ("%s:%d:%s: ", file, line, condition); va_start (args, fmt); grub_vprintf (fmt, args); diff --git a/config.h.in b/config.h.in -index c7e316f0f1..c80e3e0aba 100644 +index d294d2c653f..39f4e5472ce 100644 --- a/config.h.in +++ b/config.h.in -@@ -12,6 +12,7 @@ +@@ -16,6 +16,7 @@ /* Define to 1 to enable disk cache statistics. */ #define DISK_CACHE_STATS @DISK_CACHE_STATS@ #define BOOT_TIME_STATS @BOOT_TIME_STATS@ diff --git a/0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch b/0124-Added-debug-statements-to-grub_disk_open-and-grub_di.patch similarity index 67% rename from 0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch rename to 0124-Added-debug-statements-to-grub_disk_open-and-grub_di.patch index d26027c7..0cd12c44 100644 --- a/0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +++ b/0124-Added-debug-statements-to-grub_disk_open-and-grub_di.patch @@ -9,11 +9,11 @@ Content-Transfer-Encoding: 8bit Signed-off-by: Renaud Métrich --- - grub-core/kern/disk.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) + grub-core/kern/disk.c | 4 ++++ + 1 file changed, 4 insertions(+) diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c -index e1b0e073e0..05a28ab142 100644 +index 1eda58fe9a1..355b6579d87 100644 --- a/grub-core/kern/disk.c +++ b/grub-core/kern/disk.c @@ -285,6 +285,8 @@ grub_disk_open (const char *name) @@ -25,16 +25,7 @@ index e1b0e073e0..05a28ab142 100644 return disk; } -@@ -292,7 +294,7 @@ void - grub_disk_close (grub_disk_t disk) - { - grub_partition_t part; -- grub_dprintf ("disk", "Closing `%s'.\n", disk->name); -+ grub_dprintf ("disk", "Closing `%s'...\n", disk->name); - - if (disk->dev && disk->dev->disk_close) - (disk->dev->disk_close) (disk); -@@ -306,8 +308,10 @@ grub_disk_close (grub_disk_t disk) +@@ -310,8 +312,10 @@ grub_disk_close (grub_disk_t disk) grub_free (disk->partition); disk->partition = part; } diff --git a/0147-Introduce-function-grub_debug_is_enabled-void-return.patch b/0125-Introduce-function-grub_debug_is_enabled-void-return.patch similarity index 87% rename from 0147-Introduce-function-grub_debug_is_enabled-void-return.patch rename to 0125-Introduce-function-grub_debug_is_enabled-void-return.patch index 9ce5d9df..224d2044 100644 --- a/0147-Introduce-function-grub_debug_is_enabled-void-return.patch +++ b/0125-Introduce-function-grub_debug_is_enabled-void-return.patch @@ -14,10 +14,10 @@ Signed-off-by: Renaud Métrich 2 files changed, 14 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index 9f54b6b7d2..a186ad3dd4 100644 +index d40586b9268..d3a493e3552 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -163,6 +163,19 @@ int grub_err_printf (const char *fmt, ...) +@@ -186,6 +186,19 @@ int grub_err_printf (const char *fmt, ...) __attribute__ ((alias("grub_printf"))); #endif @@ -38,10 +38,10 @@ index 9f54b6b7d2..a186ad3dd4 100644 grub_debug_enabled (const char * condition) { diff --git a/include/grub/misc.h b/include/grub/misc.h -index 3adc4036e3..6c4aa85ac5 100644 +index 72aff15750d..3f5f5b61695 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h -@@ -340,6 +340,7 @@ grub_puts (const char *s) +@@ -369,6 +369,7 @@ grub_puts (const char *s) } int EXPORT_FUNC(grub_puts_) (const char *s); diff --git a/0148-Don-t-clear-screen-when-debugging-is-enabled.patch b/0126-Don-t-clear-screen-when-debugging-is-enabled.patch similarity index 80% rename from 0148-Don-t-clear-screen-when-debugging-is-enabled.patch rename to 0126-Don-t-clear-screen-when-debugging-is-enabled.patch index c35d8a3c..8cca97ca 100644 --- a/0148-Don-t-clear-screen-when-debugging-is-enabled.patch +++ b/0126-Don-t-clear-screen-when-debugging-is-enabled.patch @@ -10,20 +10,18 @@ Signed-off-by: Renaud Métrich [rharwood@redhat.com: rebase fuzz] Signed-off-by: Robbie Harwood --- - grub-core/normal/main.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) + grub-core/normal/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index af9792c963..7de9e4c36d 100644 +index b5fa6156549..0ea27d3c534 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -215,8 +215,9 @@ grub_normal_init_page (struct grub_term_output *term, - char *msg_formatted; +@@ -216,7 +216,8 @@ grub_normal_init_page (struct grub_term_output *term, grub_uint32_t *unicode_msg; grub_uint32_t *last_position; -- + - grub_term_cls (term); -+ + if (! grub_debug_is_enabled ()) + grub_term_cls (term); diff --git a/0150-grub_file_-instrumentation-new-file-debug-tag.patch b/0127-grub_file_-instrumentation-new-file-debug-tag.patch similarity index 83% rename from 0150-grub_file_-instrumentation-new-file-debug-tag.patch rename to 0127-grub_file_-instrumentation-new-file-debug-tag.patch index 63278992..1d35707f 100644 --- a/0150-grub_file_-instrumentation-new-file-debug-tag.patch +++ b/0127-grub_file_-instrumentation-new-file-debug-tag.patch @@ -12,7 +12,7 @@ Signed-off-by: Renaud Métrich 1 file changed, 14 insertions(+) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index 5b58f45cfd..ec10e54fc0 100644 +index 750177248f9..264211b1143 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -66,6 +66,8 @@ grub_file_open (const char *name, enum grub_file_type type) @@ -21,10 +21,10 @@ index 5b58f45cfd..ec10e54fc0 100644 + grub_dprintf ("file", "Opening `%s' ...\n", name); + - /* Reset grub_errno before we start */ + /* Reset grub_errno before we start. */ grub_errno = GRUB_ERR_NONE; -@@ -131,6 +133,8 @@ grub_file_open (const char *name, enum grub_file_type type) +@@ -132,6 +134,8 @@ grub_file_open (const char *name, enum grub_file_type type) if (!file) grub_file_close (last_file); @@ -33,7 +33,7 @@ index 5b58f45cfd..ec10e54fc0 100644 return file; fail: -@@ -141,6 +145,8 @@ grub_file_open (const char *name, enum grub_file_type type) +@@ -143,6 +147,8 @@ grub_file_open (const char *name, enum grub_file_type type) grub_free (file); @@ -42,7 +42,7 @@ index 5b58f45cfd..ec10e54fc0 100644 return 0; } -@@ -172,6 +178,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) +@@ -174,6 +180,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) if (len == 0) return 0; @@ -50,7 +50,7 @@ index 5b58f45cfd..ec10e54fc0 100644 read_hook = file->read_hook; read_hook_data = file->read_hook_data; if (!file->read_hook) -@@ -192,11 +199,18 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) +@@ -194,11 +201,18 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) grub_err_t grub_file_close (grub_file_t file) { diff --git a/0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch b/0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch deleted file mode 100644 index d1c7b176..00000000 --- a/0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Sat, 16 May 2020 11:33:18 +0200 -Subject: [PATCH] tpm: Don't propagate TPM measurement errors to the verifiers - layer - -Currently if the EFI firmware fails to do a TPM measurement for a file, -the error will be propagated to the verifiers framework and so opening -the file will not succeed. - -This mean that buggy firmwares will prevent the system to boot since the -loader won't be able to open any file. But failing to do TPM measurements -shouldn't be a fatal error and the system should still be able to boot. - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/tpm.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/grub-core/commands/tpm.c b/grub-core/commands/tpm.c -index 2052c36eab..e287d042e6 100644 ---- a/grub-core/commands/tpm.c -+++ b/grub-core/commands/tpm.c -@@ -42,7 +42,8 @@ grub_tpm_verify_init (grub_file_t io, - static grub_err_t - grub_tpm_verify_write (void *context, void *buf, grub_size_t size) - { -- return grub_tpm_measure (buf, size, GRUB_BINARY_PCR, context); -+ grub_tpm_measure (buf, size, GRUB_BINARY_PCR, context); -+ return GRUB_ERR_NONE; - } - - static grub_err_t -@@ -50,7 +51,6 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type) - { - const char *prefix = NULL; - char *description; -- grub_err_t status; - - switch (type) - { -@@ -66,15 +66,15 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type) - } - description = grub_malloc (grub_strlen (str) + grub_strlen (prefix) + 1); - if (!description) -- return grub_errno; -+ return GRUB_ERR_NONE; - grub_memcpy (description, prefix, grub_strlen (prefix)); - grub_memcpy (description + grub_strlen (prefix), str, - grub_strlen (str) + 1); -- status = -- grub_tpm_measure ((unsigned char *) str, grub_strlen (str), -- GRUB_STRING_PCR, description); -+ -+ grub_tpm_measure ((unsigned char *) str, grub_strlen (str), GRUB_STRING_PCR, -+ description); - grub_free (description); -- return status; -+ return GRUB_ERR_NONE; - } - - struct grub_file_verifier grub_tpm_verifier = { diff --git a/0151-ieee1275-Avoiding-many-unecessary-open-close.patch b/0128-ieee1275-Avoiding-many-unecessary-open-close.patch similarity index 94% rename from 0151-ieee1275-Avoiding-many-unecessary-open-close.patch rename to 0128-ieee1275-Avoiding-many-unecessary-open-close.patch index f6c52441..fac8dc7e 100644 --- a/0151-ieee1275-Avoiding-many-unecessary-open-close.patch +++ b/0128-ieee1275-Avoiding-many-unecessary-open-close.patch @@ -9,7 +9,7 @@ Signed-off-by: Diego Domingos 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index 03674cb477..ea7f78ac7d 100644 +index c6cba0c8aaf..629fc15f284 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -44,7 +44,7 @@ struct ofdisk_hash_ent @@ -94,7 +94,7 @@ index 03674cb477..ea7f78ac7d 100644 if (err) { grub_free (devpath); -@@ -532,13 +555,6 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) +@@ -528,13 +551,6 @@ grub_ofdisk_open (const char *name, grub_disk_t disk) static void grub_ofdisk_close (grub_disk_t disk) { @@ -108,7 +108,7 @@ index 03674cb477..ea7f78ac7d 100644 disk->data = 0; } -@@ -685,7 +701,7 @@ grub_ofdisk_init (void) +@@ -681,7 +697,7 @@ grub_ofdisk_init (void) } static grub_err_t @@ -117,7 +117,7 @@ index 03674cb477..ea7f78ac7d 100644 struct ofdisk_hash_ent *op) { struct size_args_ieee1275 -@@ -698,16 +714,6 @@ grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, +@@ -694,16 +710,6 @@ grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size, grub_ieee1275_cell_t size2; } args_ieee1275; diff --git a/0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch b/0129-ieee1275-powerpc-implements-fibre-channel-discovery-.patch similarity index 98% rename from 0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch rename to 0129-ieee1275-powerpc-implements-fibre-channel-discovery-.patch index 04c5c32e..9fa02bb1 100644 --- a/0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +++ b/0129-ieee1275-powerpc-implements-fibre-channel-discovery-.patch @@ -15,7 +15,7 @@ Signed-off-by: Diego Domingos 1 file changed, 49 insertions(+) diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index a6153d3595..0f5d54e9f2 100644 +index a6153d35954..0f5d54e9f2d 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c @@ -350,6 +350,38 @@ of_path_of_ide(const char *sys_devname __attribute__((unused)), const char *devi diff --git a/0153-ieee1275-powerpc-enables-device-mapper-discovery.patch b/0130-ieee1275-powerpc-enables-device-mapper-discovery.patch similarity index 98% rename from 0153-ieee1275-powerpc-enables-device-mapper-discovery.patch rename to 0130-ieee1275-powerpc-enables-device-mapper-discovery.patch index 85dbde77..6f1c21b3 100644 --- a/0153-ieee1275-powerpc-enables-device-mapper-discovery.patch +++ b/0130-ieee1275-powerpc-enables-device-mapper-discovery.patch @@ -17,7 +17,7 @@ Signed-off-by: Diego Domingos 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c -index 0f5d54e9f2..cc849d9c94 100644 +index 0f5d54e9f2d..cc849d9c94c 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c @@ -37,6 +37,7 @@ diff --git a/0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch b/0131-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch similarity index 94% rename from 0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch rename to 0131-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch index f938fd1a..65646f7d 100644 --- a/0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +++ b/0131-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch @@ -35,7 +35,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 96 insertions(+), 25 deletions(-) diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index 2601438260..dac0f946fe 100644 +index 2d9ab65aee0..378deb321d9 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -31,6 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -46,7 +46,7 @@ index 2601438260..dac0f946fe 100644 static int ping_sent; -@@ -76,6 +77,8 @@ at_command (grub_uint8_t data) +@@ -86,6 +87,8 @@ at_command (grub_uint8_t data) break; return 0; } @@ -55,7 +55,7 @@ index 2601438260..dac0f946fe 100644 return (i != GRUB_AT_TRIES); } -@@ -105,6 +108,21 @@ grub_keyboard_controller_read (void) +@@ -115,6 +118,21 @@ grub_keyboard_controller_read (void) #endif @@ -77,7 +77,7 @@ index 2601438260..dac0f946fe 100644 static int write_mode (int mode) { -@@ -113,11 +131,14 @@ write_mode (int mode) +@@ -123,11 +141,14 @@ write_mode (int mode) { grub_uint8_t ack; keyboard_controller_wait_until_ready (); @@ -92,7 +92,7 @@ index 2601438260..dac0f946fe 100644 if (ack == GRUB_AT_NACK) continue; if (ack == GRUB_AT_ACK) -@@ -125,6 +146,9 @@ write_mode (int mode) +@@ -135,6 +156,9 @@ write_mode (int mode) return 0; } @@ -102,7 +102,7 @@ index 2601438260..dac0f946fe 100644 return (i != GRUB_AT_TRIES); } -@@ -132,31 +156,66 @@ static int +@@ -142,31 +166,66 @@ static int query_mode (void) { grub_uint8_t ret; @@ -189,7 +189,7 @@ index 2601438260..dac0f946fe 100644 return 0; } -@@ -165,14 +224,25 @@ set_scancodes (void) +@@ -175,14 +234,25 @@ set_scancodes (void) { /* You must have visited computer museum. Keyboard without scancode set knowledge. Assume XT. */ @@ -219,7 +219,7 @@ index 2601438260..dac0f946fe 100644 if ((grub_keyboard_controller_orig & KEYBOARD_AT_TRANSLATE) == KEYBOARD_AT_TRANSLATE) { grub_dprintf ("atkeyb", "queried set is %d but keyboard in Translate mode, so actually in set 1\n", grub_keyboard_orig_set); ps2_state.current_set = 1; -@@ -261,6 +331,7 @@ grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) +@@ -271,6 +341,7 @@ grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused))) static void grub_keyboard_controller_init (void) { @@ -227,7 +227,7 @@ index 2601438260..dac0f946fe 100644 ps2_state.at_keyboard_status = 0; /* Drain input buffer. */ while (1) -@@ -282,6 +353,7 @@ grub_keyboard_controller_init (void) +@@ -292,6 +363,7 @@ grub_keyboard_controller_init (void) grub_keyboard_controller_orig = grub_keyboard_controller_read (); grub_dprintf ("atkeyb", "grub_keyboard_controller_orig = 0x%x\n", grub_keyboard_controller_orig); grub_keyboard_orig_set = query_mode (); @@ -235,7 +235,7 @@ index 2601438260..dac0f946fe 100644 #endif set_scancodes (); keyboard_controller_led (ps2_state.led_status); -@@ -329,7 +401,6 @@ grub_at_restore_hw (void) +@@ -339,7 +411,6 @@ grub_at_restore_hw (void) return GRUB_ERR_NONE; } diff --git a/0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch b/0132-Add-suport-for-signing-grub-with-an-appended-signatu.patch similarity index 86% rename from 0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch rename to 0132-Add-suport-for-signing-grub-with-an-appended-signatu.patch index 81660d4d..c9a45b1d 100644 --- a/0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch +++ b/0132-Add-suport-for-signing-grub-with-an-appended-signatu.patch @@ -34,19 +34,19 @@ under this scheme. Signed-off-by: Daniel Axtens Signed-off-by: Rashmica Gupta --- - util/grub-install-common.c | 18 ++++++++++++++---- + util/grub-install-common.c | 14 ++++++++++++-- util/grub-mkimage.c | 15 +++++++++++++-- util/grub-mkimagexx.c | 39 ++++++++++++++++++++++++++++++++++++++- util/mkimage.c | 13 +++++++------ include/grub/util/install.h | 8 ++++++-- include/grub/util/mkimage.h | 4 ++-- - 6 files changed, 80 insertions(+), 17 deletions(-) + 6 files changed, 78 insertions(+), 15 deletions(-) diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index 4e212e690c..a74fee16e2 100644 +index ce854d86f86..1fa0f7f6f00 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c -@@ -461,10 +461,12 @@ static size_t npubkeys; +@@ -466,10 +466,12 @@ static size_t npubkeys; static char *sbat; static int disable_shim_lock; static grub_compression_t compression; @@ -58,8 +58,8 @@ index 4e212e690c..a74fee16e2 100644 + const char *end; switch (key) { - case 'C': -@@ -562,6 +564,12 @@ grub_install_parse (int key, char *arg) + case GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS: +@@ -567,6 +569,12 @@ grub_install_parse (int key, char *arg) grub_util_error (_("Unrecognized compression `%s'"), arg); case GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE: return 1; @@ -72,24 +72,20 @@ index 4e212e690c..a74fee16e2 100644 default: return 0; } -@@ -661,11 +669,13 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, - " --output '%s' " - " --dtb '%s' " - "--sbat '%s' " -- "--format '%s' --compression '%s' %s %s %s\n", -+ "--format '%s' --compression '%s' " -+ "--appended-signature-size %zu %s %s %s\n", - dir, prefix, - outname, dtb ? : "", sbat ? : "", mkimage_target, -- compnames[compression], note ? "--note" : "", -- disable_shim_lock ? "--disable-shim-lock" : "", s); -+ compnames[compression], appsig_size, -+ disable_shim_lock ? "--disable-shim-lock" : "", -+ note ? "--note" : "", s); - free (s); +@@ -679,9 +687,11 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + *p = '\0'; - tgt = grub_install_get_image_target (mkimage_target); -@@ -675,7 +685,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + grub_util_info ("grub-mkimage --directory '%s' --prefix '%s' --output '%s'" +- " --format '%s' --compression '%s'%s%s%s\n", ++ " --format '%s' --compression '%s'" ++ " --appended-signture-size %zu %s%s%s\n", + dir, prefix, outname, + mkimage_target, compnames[compression], ++ appsig_size, + note ? " --note" : "", + disable_shim_lock ? " --disable-shim-lock" : "", s); + free (s); +@@ -693,7 +703,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, pubkeys, npubkeys, config_path, tgt, @@ -99,7 +95,7 @@ index 4e212e690c..a74fee16e2 100644 while (dc--) grub_install_pop_module (); diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index c0d5599370..8a53310548 100644 +index c0d55993702..8a53310548b 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -84,6 +84,7 @@ static struct argp_option options[] = { @@ -153,10 +149,10 @@ index c0d5599370..8a53310548 100644 if (grub_util_file_sync (fp) < 0) grub_util_error (_("cannot sync `%s': %s"), arguments.output ? : "stdout", diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index d78fa3e533..393119486d 100644 +index e50b29533c6..9488f052510 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c -@@ -84,6 +84,15 @@ struct grub_ieee1275_note +@@ -85,6 +85,15 @@ struct grub_ieee1275_note struct grub_ieee1275_note_desc descriptor; }; @@ -172,7 +168,7 @@ index d78fa3e533..393119486d 100644 #define GRUB_XEN_NOTE_NAME "Xen" struct fixup_block_list -@@ -207,7 +216,7 @@ grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr sym_addr) +@@ -208,7 +217,7 @@ grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr sym_addr) void SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc *image_target, @@ -181,7 +177,7 @@ index d78fa3e533..393119486d 100644 Elf_Addr target_addr, struct grub_mkimage_layout *layout) { -@@ -221,6 +230,12 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc +@@ -222,6 +231,12 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc int shnum = 4; int string_size = sizeof (".text") + sizeof ("mods") + 1; @@ -194,7 +190,7 @@ index d78fa3e533..393119486d 100644 if (image_target->id != IMAGE_LOONGSON_ELF) phnum += 2; -@@ -484,6 +499,28 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc +@@ -485,6 +500,28 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc phdr->p_offset = grub_host_to_target32 (header_size + program_size); } @@ -224,10 +220,10 @@ index d78fa3e533..393119486d 100644 char *str_start = (elf_img + sizeof (*ehdr) + phnum * sizeof (*phdr) + shnum * sizeof (*shdr)); diff --git a/util/mkimage.c b/util/mkimage.c -index a26cf76f72..bab1227601 100644 +index 4237383acaf..d33838bec6b 100644 --- a/util/mkimage.c +++ b/util/mkimage.c -@@ -869,8 +869,9 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -885,8 +885,9 @@ grub_install_generate_image (const char *dir, const char *prefix, char *memdisk_path, char **pubkey_paths, size_t npubkeys, char *config_path, const struct grub_install_image_target_desc *image_target, @@ -239,7 +235,7 @@ index a26cf76f72..bab1227601 100644 { char *kernel_img, *core_img; size_t total_module_size, core_size; -@@ -1773,11 +1774,11 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -1810,11 +1811,11 @@ grub_install_generate_image (const char *dir, const char *prefix, else target_addr = image_target->link_addr; if (image_target->voidp_sizeof == 4) @@ -256,7 +252,7 @@ index a26cf76f72..bab1227601 100644 break; } diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index 7df3191f47..cf4531e02b 100644 +index 35cf17a8d93..2720428602b 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -67,6 +67,9 @@ @@ -269,7 +265,7 @@ index 7df3191f47..cf4531e02b 100644 { "verbose", 'v', 0, 0, \ N_("print verbose messages."), 1 } -@@ -128,7 +131,8 @@ enum grub_install_options { +@@ -129,7 +132,8 @@ enum grub_install_options { GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, GRUB_INSTALL_OPTIONS_DTB, GRUB_INSTALL_OPTIONS_SBAT, @@ -279,7 +275,7 @@ index 7df3191f47..cf4531e02b 100644 }; extern char *grub_install_source_directory; -@@ -188,7 +192,7 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -189,7 +193,7 @@ grub_install_generate_image (const char *dir, const char *prefix, size_t npubkeys, char *config_path, const struct grub_install_image_target_desc *image_target, @@ -289,7 +285,7 @@ index 7df3191f47..cf4531e02b 100644 const char *sbat_path, const int disable_shim_lock); diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h -index 3819a67441..6f1da89b9b 100644 +index 3819a67441c..6f1da89b9b6 100644 --- a/include/grub/util/mkimage.h +++ b/include/grub/util/mkimage.h @@ -51,12 +51,12 @@ grub_mkimage_load_image64 (const char *kernel_path, diff --git a/0156-docs-grub-Document-signing-grub-under-UEFI.patch b/0133-docs-grub-Document-signing-grub-under-UEFI.patch similarity index 92% rename from 0156-docs-grub-Document-signing-grub-under-UEFI.patch rename to 0133-docs-grub-Document-signing-grub-under-UEFI.patch index f2b5c176..69c352d4 100644 --- a/0156-docs-grub-Document-signing-grub-under-UEFI.patch +++ b/0133-docs-grub-Document-signing-grub-under-UEFI.patch @@ -13,10 +13,10 @@ Signed-off-by: Daniel Axtens 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/grub.texi b/docs/grub.texi -index 4870faaa00..365d1d6931 100644 +index 1e577d2fee9..30d4046a931 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5817,6 +5817,7 @@ environment variables and commands are listed in the same order. +@@ -6403,6 +6403,7 @@ environment variables and commands are listed in the same order. * Secure Boot Advanced Targeting:: Embedded information for generation number based revocation * Measured Boot:: Measuring boot components * Lockdown:: Lockdown when booting on a secure setup @@ -24,7 +24,7 @@ index 4870faaa00..365d1d6931 100644 @end menu @node Authentication and authorisation -@@ -5895,7 +5896,7 @@ commands. +@@ -6481,7 +6482,7 @@ commands. GRUB's @file{core.img} can optionally provide enforcement that all files subsequently read from disk are covered by a valid digital signature. @@ -33,7 +33,7 @@ index 4870faaa00..365d1d6931 100644 platform's firmware (e.g., Coreboot) validates @file{core.img}. If environment variable @code{check_signatures} -@@ -6067,6 +6068,25 @@ be restricted and some operations/commands cannot be executed. +@@ -6654,6 +6655,25 @@ be restricted and some operations/commands cannot be executed. The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down. Otherwise it does not exit. diff --git a/0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch b/0134-docs-grub-Document-signing-grub-with-an-appended-sig.patch similarity index 95% rename from 0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch rename to 0134-docs-grub-Document-signing-grub-with-an-appended-sig.patch index ee3d6594..e5c63208 100644 --- a/0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch +++ b/0134-docs-grub-Document-signing-grub-with-an-appended-sig.patch @@ -13,10 +13,10 @@ Signed-off-by: Daniel Axtens 1 file changed, 42 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index 365d1d6931..afbde7c1f7 100644 +index 30d4046a931..0ac0a1b3735 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -6087,6 +6087,48 @@ image works under UEFI secure boot and can maintain the secure-boot chain. It +@@ -6674,6 +6674,48 @@ image works under UEFI secure boot and can maintain the secure-boot chain. It will also be necessary to enrol the public key used into a relevant firmware key database. diff --git a/0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch b/0135-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch similarity index 92% rename from 0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch rename to 0135-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch index b23ce49d..c25927d5 100644 --- a/0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +++ b/0135-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch @@ -16,10 +16,10 @@ Signed-off-by: Daniel Axtens 1 file changed, 11 insertions(+) diff --git a/include/grub/dl.h b/include/grub/dl.h -index 2f76e6b043..20d870f2a4 100644 +index 8a3d188d1d1..3f10e27d62c 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h -@@ -245,11 +245,22 @@ grub_dl_get (const char *name) +@@ -244,11 +244,22 @@ grub_dl_get (const char *name) return 0; } diff --git a/0159-pgp-factor-out-rsa_pad.patch b/0136-pgp-factor-out-rsa_pad.patch similarity index 97% rename from 0159-pgp-factor-out-rsa_pad.patch rename to 0136-pgp-factor-out-rsa_pad.patch index 43fd8828..6e629a4f 100644 --- a/0159-pgp-factor-out-rsa_pad.patch +++ b/0136-pgp-factor-out-rsa_pad.patch @@ -27,10 +27,10 @@ Signed-off-by: Daniel Axtens create mode 100644 include/grub/pkcs1_v15.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index dc9fea6f44..64cc758835 100644 +index 4aa20cdfc13..82f2e169ad1 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2511,6 +2511,14 @@ module = { +@@ -2568,6 +2568,14 @@ module = { cppflags = '$(CPPFLAGS_GCRY)'; }; @@ -46,7 +46,7 @@ index dc9fea6f44..64cc758835 100644 name = all_video; common = lib/fake_module.c; diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 5daa1e9d00..2408db4994 100644 +index c6766f044aa..b084dc9a22f 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -24,6 +24,7 @@ @@ -93,7 +93,7 @@ index 5daa1e9d00..2408db4994 100644 struct grub_pubkey_context diff --git a/grub-core/lib/pkcs1_v15.c b/grub-core/lib/pkcs1_v15.c new file mode 100644 -index 0000000000..dbacd563d0 +index 00000000000..dbacd563d01 --- /dev/null +++ b/grub-core/lib/pkcs1_v15.c @@ -0,0 +1,59 @@ @@ -158,7 +158,7 @@ index 0000000000..dbacd563d0 +} diff --git a/include/grub/pkcs1_v15.h b/include/grub/pkcs1_v15.h new file mode 100644 -index 0000000000..5c338c84a1 +index 00000000000..5c338c84a15 --- /dev/null +++ b/include/grub/pkcs1_v15.h @@ -0,0 +1,27 @@ diff --git a/0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch b/0137-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch similarity index 96% rename from 0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch rename to 0137-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch index 541474e5..732b91c4 100644 --- a/0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +++ b/0137-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch @@ -40,7 +40,7 @@ Signed-off-by: Daniel Axtens 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 2408db4994..355a43844a 100644 +index b084dc9a22f..a45c2213c4a 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -147,10 +147,6 @@ const char *hashes[] = { @@ -55,7 +55,7 @@ index 2408db4994..355a43844a 100644 dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval, const gcry_md_spec_t *hash, struct grub_public_subkey *sk); diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c -index ca334d5a40..c578128a59 100644 +index 396f7641080..d53ddbe2c44 100644 --- a/grub-core/lib/crypto.c +++ b/grub-core/lib/crypto.c @@ -121,6 +121,10 @@ grub_md_unregister (gcry_md_spec_t *cipher) diff --git a/0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch b/0138-posix_wrap-tweaks-in-preparation-for-libtasn1.patch similarity index 89% rename from 0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch rename to 0138-posix_wrap-tweaks-in-preparation-for-libtasn1.patch index 3176f1b7..a473c1de 100644 --- a/0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +++ b/0138-posix_wrap-tweaks-in-preparation-for-libtasn1.patch @@ -23,10 +23,10 @@ Signed-off-by: Daniel Axtens 3 files changed, 10 insertions(+) diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h -index 7217138ffd..591dbf3289 100644 +index 26918c8a01b..4be7b408063 100644 --- a/grub-core/lib/posix_wrap/limits.h +++ b/grub-core/lib/posix_wrap/limits.h -@@ -37,5 +37,6 @@ +@@ -41,5 +41,6 @@ #define LONG_MAX GRUB_LONG_MAX #define CHAR_BIT 8 @@ -34,11 +34,11 @@ index 7217138ffd..591dbf3289 100644 #endif diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h -index 7a8d385e97..4634db09f2 100644 +index f5279756abe..14e4efdd0d6 100644 --- a/grub-core/lib/posix_wrap/stdlib.h +++ b/grub-core/lib/posix_wrap/stdlib.h -@@ -58,4 +58,12 @@ abs (int c) - return (c >= 0) ? c : -c; +@@ -64,4 +64,12 @@ abort (void) + grub_abort (); } +#define strtol grub_strtol @@ -51,10 +51,10 @@ index 7a8d385e97..4634db09f2 100644 + #endif diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h -index 854eb0122e..f63412c8da 100644 +index eeda543c47e..2f3e865495a 100644 --- a/grub-core/lib/posix_wrap/sys/types.h +++ b/grub-core/lib/posix_wrap/sys/types.h -@@ -51,6 +51,7 @@ typedef grub_uint8_t byte; +@@ -50,6 +50,7 @@ typedef grub_uint8_t byte; typedef grub_addr_t uintptr_t; #define SIZEOF_UNSIGNED_LONG GRUB_CPU_SIZEOF_LONG diff --git a/0162-libtasn1-import-libtasn1-4.16.0.patch b/0139-libtasn1-import-libtasn1-4.16.0.patch similarity index 99% rename from 0162-libtasn1-import-libtasn1-4.16.0.patch rename to 0139-libtasn1-import-libtasn1-4.16.0.patch index 95876611..89552c88 100644 --- a/0162-libtasn1-import-libtasn1-4.16.0.patch +++ b/0139-libtasn1-import-libtasn1-4.16.0.patch @@ -53,7 +53,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/lib/libtasn1/lib/coding.c b/grub-core/lib/libtasn1/lib/coding.c new file mode 100644 -index 0000000000..245ea64cf0 +index 00000000000..245ea64cf0a --- /dev/null +++ b/grub-core/lib/libtasn1/lib/coding.c @@ -0,0 +1,1415 @@ @@ -1474,7 +1474,7 @@ index 0000000000..245ea64cf0 +} diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c new file mode 100644 -index 0000000000..ff04eb778c +index 00000000000..ff04eb778cb --- /dev/null +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -0,0 +1,2478 @@ @@ -3958,7 +3958,7 @@ index 0000000000..ff04eb778c +} diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c new file mode 100644 -index 0000000000..997eb2725d +index 00000000000..997eb2725dc --- /dev/null +++ b/grub-core/lib/libtasn1/lib/element.c @@ -0,0 +1,1111 @@ @@ -5075,7 +5075,7 @@ index 0000000000..997eb2725d +} diff --git a/grub-core/lib/libtasn1/lib/errors.c b/grub-core/lib/libtasn1/lib/errors.c new file mode 100644 -index 0000000000..cee74daf79 +index 00000000000..cee74daf795 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/errors.c @@ -0,0 +1,100 @@ @@ -5181,7 +5181,7 @@ index 0000000000..cee74daf79 +} diff --git a/grub-core/lib/libtasn1/lib/gstr.c b/grub-core/lib/libtasn1/lib/gstr.c new file mode 100644 -index 0000000000..e91a3a151c +index 00000000000..e91a3a151c0 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/gstr.c @@ -0,0 +1,74 @@ @@ -5261,7 +5261,7 @@ index 0000000000..e91a3a151c +} diff --git a/grub-core/lib/libtasn1/lib/parser_aux.c b/grub-core/lib/libtasn1/lib/parser_aux.c new file mode 100644 -index 0000000000..d5dbbf8765 +index 00000000000..d5dbbf8765d --- /dev/null +++ b/grub-core/lib/libtasn1/lib/parser_aux.c @@ -0,0 +1,1173 @@ @@ -6440,7 +6440,7 @@ index 0000000000..d5dbbf8765 +} diff --git a/grub-core/lib/libtasn1/lib/structure.c b/grub-core/lib/libtasn1/lib/structure.c new file mode 100644 -index 0000000000..8189c56a4c +index 00000000000..8189c56a4c9 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/structure.c @@ -0,0 +1,1220 @@ @@ -7666,7 +7666,7 @@ index 0000000000..8189c56a4c +} diff --git a/grub-core/lib/libtasn1/lib/element.h b/grub-core/lib/libtasn1/lib/element.h new file mode 100644 -index 0000000000..440a33f4bb +index 00000000000..440a33f4bb1 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/element.h @@ -0,0 +1,40 @@ @@ -7712,7 +7712,7 @@ index 0000000000..440a33f4bb +#endif diff --git a/grub-core/lib/libtasn1/lib/gstr.h b/grub-core/lib/libtasn1/lib/gstr.h new file mode 100644 -index 0000000000..48229844ff +index 00000000000..48229844ff3 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/gstr.h @@ -0,0 +1,47 @@ @@ -7765,7 +7765,7 @@ index 0000000000..48229844ff +#endif /* GSTR_H */ diff --git a/grub-core/lib/libtasn1/lib/int.h b/grub-core/lib/libtasn1/lib/int.h new file mode 100644 -index 0000000000..ea1625786c +index 00000000000..ea1625786c1 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/int.h @@ -0,0 +1,221 @@ @@ -7992,7 +7992,7 @@ index 0000000000..ea1625786c +#endif /* INT_H */ diff --git a/grub-core/lib/libtasn1/lib/parser_aux.h b/grub-core/lib/libtasn1/lib/parser_aux.h new file mode 100644 -index 0000000000..598e684b35 +index 00000000000..598e684b355 --- /dev/null +++ b/grub-core/lib/libtasn1/lib/parser_aux.h @@ -0,0 +1,172 @@ @@ -8170,7 +8170,7 @@ index 0000000000..598e684b35 +#endif diff --git a/grub-core/lib/libtasn1/lib/structure.h b/grub-core/lib/libtasn1/lib/structure.h new file mode 100644 -index 0000000000..99e685da07 +index 00000000000..99e685da07a --- /dev/null +++ b/grub-core/lib/libtasn1/lib/structure.h @@ -0,0 +1,45 @@ @@ -8221,7 +8221,7 @@ index 0000000000..99e685da07 +#endif diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h new file mode 100644 -index 0000000000..6fd7a30dc3 +index 00000000000..6fd7a30dc35 --- /dev/null +++ b/include/grub/libtasn1.h @@ -0,0 +1,588 @@ @@ -8815,7 +8815,7 @@ index 0000000000..6fd7a30dc3 +#endif /* LIBTASN1_H */ diff --git a/grub-core/lib/libtasn1/LICENSE b/grub-core/lib/libtasn1/LICENSE new file mode 100644 -index 0000000000..e8b3628db9 +index 00000000000..e8b3628db9b --- /dev/null +++ b/grub-core/lib/libtasn1/LICENSE @@ -0,0 +1,16 @@ @@ -8837,7 +8837,7 @@ index 0000000000..e8b3628db9 +note that the range specifies every single year in that closed interval. diff --git a/grub-core/lib/libtasn1/README.md b/grub-core/lib/libtasn1/README.md new file mode 100644 -index 0000000000..50a8642296 +index 00000000000..50a8642296c --- /dev/null +++ b/grub-core/lib/libtasn1/README.md @@ -0,0 +1,91 @@ diff --git a/0163-libtasn1-disable-code-not-needed-in-grub.patch b/0140-libtasn1-disable-code-not-needed-in-grub.patch similarity index 97% rename from 0163-libtasn1-disable-code-not-needed-in-grub.patch rename to 0140-libtasn1-disable-code-not-needed-in-grub.patch index 84dcbf05..00f55888 100644 --- a/0163-libtasn1-disable-code-not-needed-in-grub.patch +++ b/0140-libtasn1-disable-code-not-needed-in-grub.patch @@ -25,7 +25,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/grub-core/lib/libtasn1/lib/coding.c b/grub-core/lib/libtasn1/lib/coding.c -index 245ea64cf0..52def59836 100644 +index 245ea64cf0a..52def598368 100644 --- a/grub-core/lib/libtasn1/lib/coding.c +++ b/grub-core/lib/libtasn1/lib/coding.c @@ -30,11 +30,11 @@ @@ -99,7 +99,7 @@ index 245ea64cf0..52def59836 100644 +#endif \ No newline at end of file diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c -index ff04eb778c..42f9a92b5d 100644 +index ff04eb778cb..42f9a92b5d4 100644 --- a/grub-core/lib/libtasn1/lib/decoding.c +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -1613,6 +1613,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len, @@ -119,7 +119,7 @@ index ff04eb778c..42f9a92b5d 100644 /** * asn1_der_decoding_startEnd: diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c -index 997eb2725d..539008d8e9 100644 +index 997eb2725dc..539008d8e94 100644 --- a/grub-core/lib/libtasn1/lib/element.c +++ b/grub-core/lib/libtasn1/lib/element.c @@ -191,7 +191,7 @@ _asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcache) @@ -141,7 +141,7 @@ index 997eb2725d..539008d8e9 100644 #define PUT_VALUE( ptr, ptr_size, data, data_size) \ *len = data_size; \ diff --git a/grub-core/lib/libtasn1/lib/errors.c b/grub-core/lib/libtasn1/lib/errors.c -index cee74daf79..42785e8622 100644 +index cee74daf795..42785e8622b 100644 --- a/grub-core/lib/libtasn1/lib/errors.c +++ b/grub-core/lib/libtasn1/lib/errors.c @@ -57,6 +57,8 @@ static const libtasn1_error_entry error_algorithms[] = { @@ -162,7 +162,7 @@ index cee74daf79..42785e8622 100644 /** * asn1_strerror: diff --git a/grub-core/lib/libtasn1/lib/structure.c b/grub-core/lib/libtasn1/lib/structure.c -index 8189c56a4c..fcfde01a39 100644 +index 8189c56a4c9..fcfde01a393 100644 --- a/grub-core/lib/libtasn1/lib/structure.c +++ b/grub-core/lib/libtasn1/lib/structure.c @@ -76,7 +76,7 @@ _asn1_find_left (asn1_node_const node) @@ -218,7 +218,7 @@ index 8189c56a4c..fcfde01a39 100644 /** * asn1_dup_node: diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h -index 6fd7a30dc3..785eda2ae3 100644 +index 6fd7a30dc35..785eda2ae3f 100644 --- a/include/grub/libtasn1.h +++ b/include/grub/libtasn1.h @@ -319,6 +319,8 @@ typedef struct asn1_data_node_st asn1_data_node_st; diff --git a/0164-libtasn1-changes-for-grub-compatibility.patch b/0141-libtasn1-changes-for-grub-compatibility.patch similarity index 96% rename from 0164-libtasn1-changes-for-grub-compatibility.patch rename to 0141-libtasn1-changes-for-grub-compatibility.patch index 7c756bd4..9b2275ca 100644 --- a/0164-libtasn1-changes-for-grub-compatibility.patch +++ b/0141-libtasn1-changes-for-grub-compatibility.patch @@ -35,7 +35,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 22 insertions(+), 33 deletions(-) diff --git a/grub-core/lib/libtasn1/lib/decoding.c b/grub-core/lib/libtasn1/lib/decoding.c -index 42f9a92b5d..7856858b27 100644 +index 42f9a92b5d4..7856858b272 100644 --- a/grub-core/lib/libtasn1/lib/decoding.c +++ b/grub-core/lib/libtasn1/lib/decoding.c @@ -32,7 +32,8 @@ @@ -71,7 +71,7 @@ index 42f9a92b5d..7856858b27 100644 result = asn1_create_element (definitions, name, &aux); if (result == ASN1_SUCCESS) diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c -index 539008d8e9..ed761ff56b 100644 +index 539008d8e94..ed761ff56bd 100644 --- a/grub-core/lib/libtasn1/lib/element.c +++ b/grub-core/lib/libtasn1/lib/element.c @@ -30,9 +30,10 @@ @@ -87,7 +87,7 @@ index 539008d8e9..ed761ff56b 100644 _asn1_hierarchical_name (asn1_node_const node, char *name, int name_size) { diff --git a/grub-core/lib/libtasn1/lib/gstr.c b/grub-core/lib/libtasn1/lib/gstr.c -index e91a3a151c..e33875c2c7 100644 +index e91a3a151c0..e33875c2c7c 100644 --- a/grub-core/lib/libtasn1/lib/gstr.c +++ b/grub-core/lib/libtasn1/lib/gstr.c @@ -36,13 +36,13 @@ _asn1_str_cat (char *dest, size_t dest_tot_size, const char *src) @@ -107,7 +107,7 @@ index e91a3a151c..e33875c2c7 100644 } } diff --git a/grub-core/lib/libtasn1/lib/parser_aux.c b/grub-core/lib/libtasn1/lib/parser_aux.c -index d5dbbf8765..89c9be69dc 100644 +index d5dbbf8765d..89c9be69dc2 100644 --- a/grub-core/lib/libtasn1/lib/parser_aux.c +++ b/grub-core/lib/libtasn1/lib/parser_aux.c @@ -26,7 +26,8 @@ @@ -139,7 +139,7 @@ index d5dbbf8765..89c9be69dc 100644 temp[start + count] = '0' + (char) r; count++; diff --git a/grub-core/lib/libtasn1/lib/int.h b/grub-core/lib/libtasn1/lib/int.h -index ea1625786c..4a568efee9 100644 +index ea1625786c1..4a568efee9c 100644 --- a/grub-core/lib/libtasn1/lib/int.h +++ b/grub-core/lib/libtasn1/lib/int.h @@ -35,7 +35,7 @@ @@ -161,7 +161,7 @@ index ea1625786c..4a568efee9 100644 #if SIZEOF_UNSIGNED_LONG_INT == 8 # define _asn1_strtou64(n,e,b) strtoul((const char *) n, e, b) diff --git a/include/grub/libtasn1.h b/include/grub/libtasn1.h -index 785eda2ae3..28dbf16c4e 100644 +index 785eda2ae3f..28dbf16c4e0 100644 --- a/include/grub/libtasn1.h +++ b/include/grub/libtasn1.h @@ -38,29 +38,15 @@ diff --git a/0165-libtasn1-compile-into-asn1-module.patch b/0142-libtasn1-compile-into-asn1-module.patch similarity index 94% rename from 0165-libtasn1-compile-into-asn1-module.patch rename to 0142-libtasn1-compile-into-asn1-module.patch index 0fb433ff..bdd6f631 100644 --- a/0165-libtasn1-compile-into-asn1-module.patch +++ b/0142-libtasn1-compile-into-asn1-module.patch @@ -14,12 +14,12 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/lib/libtasn1_wrap/wrap.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 64cc758835..ea92468fa2 100644 +index 82f2e169ad1..05b976d9a77 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2577,3 +2577,18 @@ module = { - common = commands/i386/wrmsr.c; - enable = x86; +@@ -2646,3 +2646,18 @@ module = { + efi = commands/bli.c; + enable = efi; }; + +module = { @@ -38,7 +38,7 @@ index 64cc758835..ea92468fa2 100644 +}; diff --git a/grub-core/lib/libtasn1_wrap/wrap.c b/grub-core/lib/libtasn1_wrap/wrap.c new file mode 100644 -index 0000000000..622ba942e3 +index 00000000000..622ba942e33 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap.c @@ -0,0 +1,26 @@ diff --git a/0166-test_asn1-test-module-for-libtasn1.patch b/0143-test_asn1-test-module-for-libtasn1.patch similarity index 99% rename from 0166-test_asn1-test-module-for-libtasn1.patch rename to 0143-test_asn1-test-module-for-libtasn1.patch index 6cc13bd8..23f4bbf0 100644 --- a/0166-test_asn1-test-module-for-libtasn1.patch +++ b/0143-test_asn1-test-module-for-libtasn1.patch @@ -18,6 +18,9 @@ This doesn't test the full decoder but that will be exercised in test suites for coming patch sets. Signed-off-by: Daniel Axtens + +[pjones updated the Makefile.util.def part to have "testcase = native;" +syntax.] --- Makefile.util.def | 6 + grub-core/Makefile.core.def | 13 ++ @@ -51,27 +54,27 @@ Signed-off-by: Daniel Axtens create mode 100644 tests/test_asn1.in diff --git a/Makefile.util.def b/Makefile.util.def -index 6366442129..d04b3fe68a 100644 +index 8e52e48c780..ef344f5aa8c 100644 --- a/Makefile.util.def +++ b/Makefile.util.def -@@ -1289,6 +1289,12 @@ script = { - common = tests/syslinux_test.in; +@@ -1328,6 +1328,12 @@ script = { + common = tests/luks2_test.in; }; +script = { -+ testcase; ++ testcase = native; + name = test_asn1; + common = tests/test_asn1.in; +}; + program = { - testcase; + testcase = native; name = example_unit_test; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index ea92468fa2..a32e6ada59 100644 +index 05b976d9a77..0e65fefb195 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2592,3 +2592,16 @@ module = { +@@ -2661,3 +2661,16 @@ module = { // -Wno-type-limits comes from libtasn1's configure.ac cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB) -I$(srcdir)/lib/libtasn1/lib -Wno-type-limits'; }; @@ -90,7 +93,7 @@ index ea92468fa2..a32e6ada59 100644 +}; diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c new file mode 100644 -index 0000000000..534e304521 +index 00000000000..534e304521e --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654.c @@ -0,0 +1,61 @@ @@ -157,7 +160,7 @@ index 0000000000..534e304521 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c b/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c new file mode 100644 -index 0000000000..f48aea0ef8 +index 00000000000..f48aea0ef8b --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_overflow.c @@ -0,0 +1,138 @@ @@ -301,7 +304,7 @@ index 0000000000..f48aea0ef8 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_simple.c b/grub-core/lib/libtasn1_wrap/tests/Test_simple.c new file mode 100644 -index 0000000000..9f01006ddf +index 00000000000..9f01006ddf4 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_simple.c @@ -0,0 +1,207 @@ @@ -514,7 +517,7 @@ index 0000000000..9f01006ddf +} diff --git a/grub-core/lib/libtasn1_wrap/tests/Test_strings.c b/grub-core/lib/libtasn1_wrap/tests/Test_strings.c new file mode 100644 -index 0000000000..dbe1474b20 +index 00000000000..dbe1474b204 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/Test_strings.c @@ -0,0 +1,150 @@ @@ -670,7 +673,7 @@ index 0000000000..dbe1474b20 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c b/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c new file mode 100644 -index 0000000000..d367bbfb5a +index 00000000000..d367bbfb5a7 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/object-id-decoding.c @@ -0,0 +1,116 @@ @@ -792,7 +795,7 @@ index 0000000000..d367bbfb5a +} diff --git a/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c b/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c new file mode 100644 -index 0000000000..3a83b58c59 +index 00000000000..3a83b58c59f --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/object-id-encoding.c @@ -0,0 +1,120 @@ @@ -918,7 +921,7 @@ index 0000000000..3a83b58c59 +} diff --git a/grub-core/lib/libtasn1_wrap/tests/octet-string.c b/grub-core/lib/libtasn1_wrap/tests/octet-string.c new file mode 100644 -index 0000000000..d8a049e8df +index 00000000000..d8a049e8df0 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/octet-string.c @@ -0,0 +1,211 @@ @@ -1135,7 +1138,7 @@ index 0000000000..d8a049e8df +} diff --git a/grub-core/lib/libtasn1_wrap/tests/reproducers.c b/grub-core/lib/libtasn1_wrap/tests/reproducers.c new file mode 100644 -index 0000000000..dc7268d4c6 +index 00000000000..dc7268d4c6c --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/reproducers.c @@ -0,0 +1,81 @@ @@ -1222,7 +1225,7 @@ index 0000000000..dc7268d4c6 +} diff --git a/grub-core/lib/libtasn1_wrap/wrap_tests.c b/grub-core/lib/libtasn1_wrap/wrap_tests.c new file mode 100644 -index 0000000000..75fcd21f0d +index 00000000000..75fcd21f0d5 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap_tests.c @@ -0,0 +1,75 @@ @@ -1303,7 +1306,7 @@ index 0000000000..75fcd21f0d +} diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h new file mode 100644 -index 0000000000..1e7d3d64f5 +index 00000000000..1e7d3d64f55 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-1_asn1_tab.h @@ -0,0 +1,32 @@ @@ -1341,7 +1344,7 @@ index 0000000000..1e7d3d64f5 +}; diff --git a/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h new file mode 100644 -index 0000000000..e2561e5ec6 +index 00000000000..e2561e5ec6d --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/tests/CVE-2018-1000654-2_asn1_tab.h @@ -0,0 +1,36 @@ @@ -1383,7 +1386,7 @@ index 0000000000..e2561e5ec6 +}; diff --git a/grub-core/lib/libtasn1_wrap/wrap_tests.h b/grub-core/lib/libtasn1_wrap/wrap_tests.h new file mode 100644 -index 0000000000..555e56dd20 +index 00000000000..555e56dd202 --- /dev/null +++ b/grub-core/lib/libtasn1_wrap/wrap_tests.h @@ -0,0 +1,38 @@ @@ -1426,10 +1429,10 @@ index 0000000000..555e56dd20 + +#endif diff --git a/.gitignore b/.gitignore -index 208d1d2325..1d005887e7 100644 +index a18787dcfe6..f2e8e1e42d7 100644 --- a/.gitignore +++ b/.gitignore -@@ -264,6 +264,7 @@ widthspec.bin +@@ -268,6 +268,7 @@ widthspec.bin /stamp-h1 /syslinux_test /tar_test @@ -1439,7 +1442,7 @@ index 208d1d2325..1d005887e7 100644 /tests/syslinux/ubuntu10.04_grub.cfg diff --git a/tests/test_asn1.in b/tests/test_asn1.in new file mode 100644 -index 0000000000..8173c5c270 +index 00000000000..8173c5c270e --- /dev/null +++ b/tests/test_asn1.in @@ -0,0 +1,12 @@ diff --git a/0167-grub-install-support-embedding-x509-certificates.patch b/0144-grub-install-support-embedding-x509-certificates.patch similarity index 90% rename from 0167-grub-install-support-embedding-x509-certificates.patch rename to 0144-grub-install-support-embedding-x509-certificates.patch index c4c35f4b..9ebbeb02 100644 --- a/0167-grub-install-support-embedding-x509-certificates.patch +++ b/0144-grub-install-support-embedding-x509-certificates.patch @@ -20,7 +20,7 @@ Signed-off-by: Daniel Axtens 6 files changed, 80 insertions(+), 9 deletions(-) diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c -index 355a43844a..b81ac0ae46 100644 +index a45c2213c4a..847a5046a5c 100644 --- a/grub-core/commands/pgp.c +++ b/grub-core/commands/pgp.c @@ -944,7 +944,7 @@ GRUB_MOD_INIT(pgp) @@ -33,10 +33,10 @@ index 355a43844a..b81ac0ae46 100644 pseudo_file.fs = &pseudo_fs; diff --git a/util/grub-install-common.c b/util/grub-install-common.c -index a74fee16e2..c603f5b308 100644 +index 1fa0f7f6f00..b58539111da 100644 --- a/util/grub-install-common.c +++ b/util/grub-install-common.c -@@ -460,6 +460,8 @@ static char **pubkeys; +@@ -465,6 +465,8 @@ static char **pubkeys; static size_t npubkeys; static char *sbat; static int disable_shim_lock; @@ -45,7 +45,7 @@ index a74fee16e2..c603f5b308 100644 static grub_compression_t compression; static size_t appsig_size; -@@ -501,6 +503,12 @@ grub_install_parse (int key, char *arg) +@@ -506,6 +508,12 @@ grub_install_parse (int key, char *arg) case GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK: disable_shim_lock = 1; return 1; @@ -58,18 +58,18 @@ index a74fee16e2..c603f5b308 100644 case GRUB_INSTALL_OPTIONS_VERBOSITY: verbosity++; -@@ -627,6 +635,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, +@@ -636,6 +644,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, for (pk = pubkeys; pk < pubkeys + npubkeys; pk++) - slen += 20 + grub_strlen (*pk); + slen += sizeof (" --pubkey ''") + grub_strlen (*pk); + for (pk = x509keys; pk < x509keys + nx509keys; pk++) + slen += 10 + grub_strlen (*pk); + for (md = modules.entries; *md; md++) - { - slen += 10 + grub_strlen (*md); -@@ -655,6 +666,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, - *p++ = ' '; + slen += sizeof (" ''") + grub_strlen (*md); + +@@ -676,6 +687,14 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + *p++ = '\''; } + for (pk = x509keys; pk < x509keys + nx509keys; pk++) @@ -82,8 +82,8 @@ index a74fee16e2..c603f5b308 100644 + for (md = modules.entries; *md; md++) { - *p++ = '\''; -@@ -684,7 +703,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + *p++ = ' '; +@@ -702,7 +721,9 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, grub_install_generate_image (dir, prefix, fp, outname, modules.entries, memdisk_path, @@ -95,7 +95,7 @@ index a74fee16e2..c603f5b308 100644 disable_shim_lock); while (dc--) diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c -index 8a53310548..e1f1112784 100644 +index 8a53310548b..e1f1112784a 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -75,7 +75,8 @@ static struct argp_option options[] = { @@ -142,10 +142,10 @@ index 8a53310548..e1f1112784 100644 arguments.appsig_size, arguments.comp, arguments.dtb, arguments.sbat, diff --git a/util/mkimage.c b/util/mkimage.c -index bab1227601..8319e8dfbd 100644 +index d33838bec6b..e2bb4d4cd05 100644 --- a/util/mkimage.c +++ b/util/mkimage.c -@@ -867,7 +867,8 @@ void +@@ -883,7 +883,8 @@ void grub_install_generate_image (const char *dir, const char *prefix, FILE *out, const char *outname, char *mods[], char *memdisk_path, char **pubkey_paths, @@ -155,7 +155,7 @@ index bab1227601..8319e8dfbd 100644 const struct grub_install_image_target_desc *image_target, int note, size_t appsig_size, grub_compression_t comp, const char *dtb_path, const char *sbat_path, -@@ -913,6 +914,19 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -929,6 +930,19 @@ grub_install_generate_image (const char *dir, const char *prefix, } } @@ -175,7 +175,7 @@ index bab1227601..8319e8dfbd 100644 if (memdisk_path) { memdisk_size = ALIGN_UP(grub_util_get_image_size (memdisk_path), 512); -@@ -1034,7 +1048,7 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -1050,7 +1064,7 @@ grub_install_generate_image (const char *dir, const char *prefix, curs = grub_util_get_image_size (pubkey_paths[i]); header = (struct grub_module_header *) (kernel_img + offset); @@ -184,7 +184,7 @@ index bab1227601..8319e8dfbd 100644 header->size = grub_host_to_target32 (curs + sizeof (*header)); offset += sizeof (*header); -@@ -1043,6 +1057,26 @@ grub_install_generate_image (const char *dir, const char *prefix, +@@ -1059,6 +1073,26 @@ grub_install_generate_image (const char *dir, const char *prefix, } } @@ -212,7 +212,7 @@ index bab1227601..8319e8dfbd 100644 { struct grub_module_header *header; diff --git a/include/grub/kernel.h b/include/grub/kernel.h -index 55849777ea..98edc0863f 100644 +index 55849777eaa..98edc0863f6 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -30,7 +30,9 @@ enum @@ -227,7 +227,7 @@ index 55849777ea..98edc0863f 100644 /* The module header. */ diff --git a/include/grub/util/install.h b/include/grub/util/install.h -index cf4531e02b..51f3b13ac1 100644 +index 2720428602b..59eabb9bb86 100644 --- a/include/grub/util/install.h +++ b/include/grub/util/install.h @@ -67,6 +67,8 @@ @@ -239,7 +239,7 @@ index cf4531e02b..51f3b13ac1 100644 { "appended-signature-size", GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE,\ "SIZE", 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), \ 1}, \ -@@ -188,8 +190,9 @@ void +@@ -189,8 +191,9 @@ void grub_install_generate_image (const char *dir, const char *prefix, FILE *out, const char *outname, char *mods[], diff --git a/0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch b/0145-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch similarity index 99% rename from 0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch rename to 0145-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch index 0ebc6c76..7b7d70c4 100644 --- a/0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +++ b/0145-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch @@ -22,7 +22,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/commands/appendedsig/gnutls_asn1_tab.c b/grub-core/commands/appendedsig/gnutls_asn1_tab.c new file mode 100644 -index 0000000000..ddd1314e63 +index 00000000000..ddd1314e63b --- /dev/null +++ b/grub-core/commands/appendedsig/gnutls_asn1_tab.c @@ -0,0 +1,121 @@ @@ -149,7 +149,7 @@ index 0000000000..ddd1314e63 +}; diff --git a/grub-core/commands/appendedsig/pkix_asn1_tab.c b/grub-core/commands/appendedsig/pkix_asn1_tab.c new file mode 100644 -index 0000000000..adef69d95c +index 00000000000..adef69d95ce --- /dev/null +++ b/grub-core/commands/appendedsig/pkix_asn1_tab.c @@ -0,0 +1,484 @@ diff --git a/0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch b/0146-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch similarity index 99% rename from 0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch rename to 0146-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch index 5a13d5bc..04bf1df4 100644 --- a/0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +++ b/0146-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch @@ -29,7 +29,7 @@ Signed-off-by: Daniel Axtens diff --git a/grub-core/commands/appendedsig/asn1util.c b/grub-core/commands/appendedsig/asn1util.c new file mode 100644 -index 0000000000..eff095a9df +index 00000000000..eff095a9df2 --- /dev/null +++ b/grub-core/commands/appendedsig/asn1util.c @@ -0,0 +1,102 @@ @@ -137,7 +137,7 @@ index 0000000000..eff095a9df +} diff --git a/grub-core/commands/appendedsig/pkcs7.c b/grub-core/commands/appendedsig/pkcs7.c new file mode 100644 -index 0000000000..dc6afe203f +index 00000000000..dc6afe203f7 --- /dev/null +++ b/grub-core/commands/appendedsig/pkcs7.c @@ -0,0 +1,305 @@ @@ -448,7 +448,7 @@ index 0000000000..dc6afe203f +} diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c new file mode 100644 -index 0000000000..2b38b3670a +index 00000000000..2b38b3670a2 --- /dev/null +++ b/grub-core/commands/appendedsig/x509.c @@ -0,0 +1,958 @@ @@ -1412,7 +1412,7 @@ index 0000000000..2b38b3670a +} diff --git a/grub-core/commands/appendedsig/appendedsig.h b/grub-core/commands/appendedsig/appendedsig.h new file mode 100644 -index 0000000000..9792ef3901 +index 00000000000..9792ef3901e --- /dev/null +++ b/grub-core/commands/appendedsig/appendedsig.h @@ -0,0 +1,110 @@ diff --git a/0170-appended-signatures-support-verifying-appended-signa.patch b/0147-appended-signatures-support-verifying-appended-signa.patch similarity index 98% rename from 0170-appended-signatures-support-verifying-appended-signa.patch rename to 0147-appended-signatures-support-verifying-appended-signa.patch index 9e90d3be..01442649 100644 --- a/0170-appended-signatures-support-verifying-appended-signa.patch +++ b/0147-appended-signatures-support-verifying-appended-signa.patch @@ -30,10 +30,10 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/appendedsig/appendedsig.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index a32e6ada59..6404384d90 100644 +index 0e65fefb195..ebe98551960 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -980,6 +980,18 @@ module = { +@@ -1009,6 +1009,18 @@ module = { cppflags = '-I$(srcdir)/lib/posix_wrap'; }; @@ -54,7 +54,7 @@ index a32e6ada59..6404384d90 100644 common = commands/hdparm.c; diff --git a/grub-core/commands/appendedsig/appendedsig.c b/grub-core/commands/appendedsig/appendedsig.c new file mode 100644 -index 0000000000..bf8b18b620 +index 00000000000..1b8a8078061 --- /dev/null +++ b/grub-core/commands/appendedsig/appendedsig.c @@ -0,0 +1,645 @@ @@ -462,7 +462,7 @@ index 0000000000..bf8b18b620 + } + + return grub_error (GRUB_ERR_BAD_ARGUMENT, -+ N_("No certificate number %d found - only %d certificates in the store"), ++ N_("No certificate number %lu found - only %lu certificates in the store"), + cert_num, i - 1); +} + @@ -704,7 +704,7 @@ index 0000000000..bf8b18b620 + grub_unregister_command (cmd_distrust); +} diff --git a/include/grub/file.h b/include/grub/file.h -index 31567483cc..96827a4f89 100644 +index a5bf3a792d6..d678de06325 100644 --- a/include/grub/file.h +++ b/include/grub/file.h @@ -80,6 +80,8 @@ enum grub_file_type diff --git a/0171-appended-signatures-verification-tests.patch b/0148-appended-signatures-verification-tests.patch similarity index 99% rename from 0171-appended-signatures-verification-tests.patch rename to 0148-appended-signatures-verification-tests.patch index b39a5afe..7c4ae86f 100644 --- a/0171-appended-signatures-verification-tests.patch +++ b/0148-appended-signatures-verification-tests.patch @@ -17,10 +17,10 @@ Signed-off-by: Daniel Axtens create mode 100644 grub-core/tests/appended_signatures.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 6404384d90..9ea5fb38f1 100644 +index ebe98551960..c81c9107249 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -2162,6 +2162,12 @@ module = { +@@ -2211,6 +2211,12 @@ module = { common = tests/setjmp_test.c; }; @@ -35,7 +35,7 @@ index 6404384d90..9ea5fb38f1 100644 common = tests/signature_test.c; diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c new file mode 100644 -index 0000000000..88a485200d +index 00000000000..88a485200d8 --- /dev/null +++ b/grub-core/tests/appended_signature_test.c @@ -0,0 +1,281 @@ @@ -321,7 +321,7 @@ index 0000000000..88a485200d + +GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c -index 96781fb39b..403fa5c789 100644 +index 96781fb39b5..403fa5c789a 100644 --- a/grub-core/tests/lib/functional_test.c +++ b/grub-core/tests/lib/functional_test.c @@ -73,6 +73,7 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), @@ -334,7 +334,7 @@ index 96781fb39b..403fa5c789 100644 grub_dl_load ("ctz_test"); diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h new file mode 100644 -index 0000000000..aa3dc6278e +index 00000000000..aa3dc6278e3 --- /dev/null +++ b/grub-core/tests/appended_signatures.h @@ -0,0 +1,557 @@ diff --git a/0172-appended-signatures-documentation.patch b/0149-appended-signatures-documentation.patch similarity index 91% rename from 0172-appended-signatures-documentation.patch rename to 0149-appended-signatures-documentation.patch index eb580464..c212ed3c 100644 --- a/0172-appended-signatures-documentation.patch +++ b/0149-appended-signatures-documentation.patch @@ -13,10 +13,10 @@ Signed-off-by: Daniel Axtens 1 file changed, 182 insertions(+), 17 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi -index afbde7c1f7..4816be8561 100644 +index 0ac0a1b3735..eab81718a59 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -3214,6 +3214,7 @@ These variables have special meaning to GRUB. +@@ -3275,6 +3275,7 @@ These variables have special meaning to GRUB. @menu * biosnum:: @@ -24,7 +24,7 @@ index afbde7c1f7..4816be8561 100644 * check_signatures:: * chosen:: * cmdpath:: -@@ -3273,11 +3274,18 @@ For an alternative approach which also changes BIOS drive mappings for the +@@ -3339,11 +3340,18 @@ For an alternative approach which also changes BIOS drive mappings for the chain-loaded system, @pxref{drivemap}. @@ -45,23 +45,23 @@ index afbde7c1f7..4816be8561 100644 @node chosen @subsection chosen -@@ -3994,6 +4002,7 @@ you forget a command, you can run the command @command{help} +@@ -4362,6 +4370,7 @@ you forget a command, you can run the command @command{help} * date:: Display or set current date and time * devicetree:: Load a device tree blob * distrust:: Remove a pubkey from trusted keys +* distrust_certificate:: Remove a certificate from the list of trusted certificates * drivemap:: Map a drive to another * echo:: Display a line of text - * eval:: Evaluate agruments as GRUB commands -@@ -4010,6 +4019,7 @@ you forget a command, you can run the command @command{help} + * efitextmode:: Set/Get text output mode resolution +@@ -4378,6 +4387,7 @@ you forget a command, you can run the command @command{help} + * hexdump:: Show raw contents of a file or memory + * insmod:: Insert a module * keystatus:: Check key modifier status - * linux:: Load a Linux kernel - * linux16:: Load a Linux kernel (16-bit mode) +* list_certificates:: List trusted certificates * list_env:: List variables in environment block * list_trusted:: List trusted public keys * load_env:: Load variables from environment block -@@ -4047,8 +4057,10 @@ you forget a command, you can run the command @command{help} +@@ -4416,8 +4426,10 @@ you forget a command, you can run the command @command{help} * test:: Check file types and compare values * true:: Do nothing, successfully * trust:: Add public key to list of trusted keys @@ -71,8 +71,8 @@ index afbde7c1f7..4816be8561 100644 +* verify_appended:: Verify appended digital signature * verify_detached:: Verify detached digital signature * videoinfo:: List available video modes - @comment * xen_*:: Xen boot commands for AArch64 -@@ -4376,9 +4388,28 @@ These keys are used to validate signatures when environment variable + * wrmsr:: Write values to model-specific registers +@@ -4757,9 +4769,28 @@ These keys are used to validate signatures when environment variable @code{check_signatures} is set to @code{enforce} (@pxref{check_signatures}), and by some invocations of @command{verify_detached} (@pxref{verify_detached}). @xref{Using @@ -102,7 +102,7 @@ index afbde7c1f7..4816be8561 100644 @node drivemap @subsection drivemap -@@ -4636,6 +4667,21 @@ This command is only available on x86 systems. +@@ -5036,6 +5067,21 @@ only if checking key modifier status is supported. @end deffn @@ -124,7 +124,7 @@ index afbde7c1f7..4816be8561 100644 @node list_env @subsection list_env -@@ -4655,7 +4701,7 @@ The output is in GPG's v4 key fingerprint format (i.e., the output of +@@ -5055,7 +5101,7 @@ The output is in GPG's v4 key fingerprint format (i.e., the output of @code{gpg --fingerprint}). The least significant four bytes (last eight hexadecimal digits) can be used as an argument to @command{distrust} (@pxref{distrust}). @@ -133,7 +133,7 @@ index afbde7c1f7..4816be8561 100644 these keys. @end deffn -@@ -4690,8 +4736,13 @@ When used with care, @option{--skip-sig} and the whitelist enable an +@@ -5090,8 +5136,13 @@ When used with care, @option{--skip-sig} and the whitelist enable an administrator to configure a system to boot only signed configurations, but to allow the user to select from among multiple configurations, and to enable ``one-shot'' boot attempts and @@ -148,7 +148,7 @@ index afbde7c1f7..4816be8561 100644 @end deffn -@@ -4987,7 +5038,7 @@ read. It is possible to modify a digitally signed environment block +@@ -5462,7 +5513,7 @@ read. It is possible to modify a digitally signed environment block file from within GRUB using this command, such that its signature will no longer be valid on subsequent boots. Care should be taken in such advanced configurations to avoid rendering the system @@ -157,7 +157,7 @@ index afbde7c1f7..4816be8561 100644 @end deffn -@@ -5387,11 +5438,32 @@ signatures when environment variable @code{check_signatures} is set to +@@ -5878,11 +5929,32 @@ signatures when environment variable @code{check_signatures} is set to must itself be properly signed. The @option{--skip-sig} option can be used to disable signature-checking when reading @var{pubkey_file} itself. It is expected that @option{--skip-sig} is useful for testing @@ -191,7 +191,7 @@ index afbde7c1f7..4816be8561 100644 @node unset @subsection unset -@@ -5410,6 +5482,18 @@ only on PC BIOS platforms. +@@ -5901,6 +5973,18 @@ only on PC BIOS platforms. @end deffn @end ignore @@ -210,7 +210,7 @@ index afbde7c1f7..4816be8561 100644 @node verify_detached @subsection verify_detached -@@ -5428,7 +5512,7 @@ tried. +@@ -5919,7 +6003,7 @@ tried. Exit code @code{$?} is set to 0 if the signature validates successfully. If validation fails, it is set to a non-zero value. @@ -219,7 +219,7 @@ index afbde7c1f7..4816be8561 100644 @end deffn @node videoinfo -@@ -5811,13 +5895,14 @@ environment variables and commands are listed in the same order. +@@ -6397,13 +6481,14 @@ environment variables and commands are listed in the same order. @chapter Security @menu @@ -241,7 +241,7 @@ index afbde7c1f7..4816be8561 100644 @end menu @node Authentication and authorisation -@@ -5891,8 +5976,8 @@ generating configuration files with authentication. You can use +@@ -6477,8 +6562,8 @@ generating configuration files with authentication. You can use adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} commands. @@ -252,7 +252,7 @@ index afbde7c1f7..4816be8561 100644 GRUB's @file{core.img} can optionally provide enforcement that all files subsequently read from disk are covered by a valid digital signature. -@@ -5985,6 +6070,86 @@ or BIOS) configuration to cause the machine to boot from a different +@@ -6571,6 +6656,86 @@ or BIOS) configuration to cause the machine to boot from a different (attacker-controlled) device. GRUB is at best only one link in a secure boot chain. diff --git a/0149-kern-file-Fix-error-handling-in-grub_file_open.patch b/0149-kern-file-Fix-error-handling-in-grub_file_open.patch deleted file mode 100644 index e4443250..00000000 --- a/0149-kern-file-Fix-error-handling-in-grub_file_open.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Steve McIntyre -Date: Tue, 6 Dec 2022 01:45:11 +0000 -Subject: [PATCH] kern/file: Fix error handling in grub_file_open() - -grub_file_open() calls grub_file_get_device_name(), but doesn't check -the return. Instead, it checks if grub_errno is set. - -However, nothing initialises grub_errno here when grub_file_open() -starts. This means that trying to open one file that doesn't exist and -then trying to open another file that does will (incorrectly) also -fail to open that second file. - -Let's fix that. - -Signed-off-by: Steve McIntyre ---- - grub-core/kern/file.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index 58454458c4..5b58f45cfd 100644 ---- a/grub-core/kern/file.c -+++ b/grub-core/kern/file.c -@@ -66,6 +66,9 @@ grub_file_open (const char *name, enum grub_file_type type) - const char *file_name; - grub_file_filter_id_t filter; - -+ /* Reset grub_errno before we start */ -+ grub_errno = GRUB_ERR_NONE; -+ - device_name = grub_file_get_device_name (name); - if (grub_errno) - goto fail; diff --git a/0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch b/0150-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch similarity index 84% rename from 0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch rename to 0150-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch index c90cc7ea..a8fdba36 100644 --- a/0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +++ b/0150-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch @@ -15,10 +15,10 @@ Signed-off-by: Daniel Axtens 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 9ea5fb38f1..4a57de975e 100644 +index c81c9107249..c748a37b4c5 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -323,6 +323,7 @@ kernel = { +@@ -337,6 +337,7 @@ kernel = { powerpc_ieee1275 = kern/powerpc/cache.S; powerpc_ieee1275 = kern/powerpc/dl.c; powerpc_ieee1275 = kern/powerpc/compiler-rt.S; @@ -27,18 +27,18 @@ index 9ea5fb38f1..4a57de975e 100644 sparc64_ieee1275 = kern/sparc64/cache.S; sparc64_ieee1275 = kern/sparc64/dl.c; diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 937c1bc44c..fc7d971272 100644 +index c4d6962197b..85d50e2965f 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -44,6 +44,7 @@ - #ifdef __sparc__ - #include +@@ -49,6 +49,7 @@ + #if defined(__powerpc__) || defined(__i386__) + #include #endif +#include - /* The minimal heap size we can live with. */ - #define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024) -@@ -271,6 +272,30 @@ grub_parse_cmdline (void) + /* The maximum heap size we're going to claim at boot. Not used by sparc. */ + #ifdef __i386__ +@@ -893,6 +894,30 @@ grub_parse_cmdline (void) } } @@ -69,7 +69,7 @@ index 937c1bc44c..fc7d971272 100644 grub_addr_t grub_modbase; void -@@ -296,6 +321,8 @@ grub_machine_init (void) +@@ -918,6 +943,8 @@ grub_machine_init (void) #else grub_install_get_time_ms (grub_rtc_get_time_ms); #endif @@ -79,7 +79,7 @@ index 937c1bc44c..fc7d971272 100644 void diff --git a/include/grub/lockdown.h b/include/grub/lockdown.h -index 40531fa823..ebfee4bf06 100644 +index 40531fa823b..ebfee4bf06e 100644 --- a/include/grub/lockdown.h +++ b/include/grub/lockdown.h @@ -24,7 +24,8 @@ @@ -93,10 +93,10 @@ index 40531fa823..ebfee4bf06 100644 EXPORT_FUNC (grub_lockdown) (void); extern int diff --git a/docs/grub.texi b/docs/grub.texi -index 4816be8561..a4da9c2a1b 100644 +index eab81718a59..096a3cde075 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -6227,8 +6227,8 @@ Measured boot is currently only supported on EFI platforms. +@@ -6814,8 +6814,8 @@ platforms. @section Lockdown when booting on a secure setup The GRUB can be locked down when booted on a secure boot environment, for example diff --git a/0151-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0151-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch new file mode 100644 index 00000000..3ca51396 --- /dev/null +++ b/0151-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Wed, 14 Apr 2021 20:10:23 +1000 +Subject: [PATCH] ieee1275: drop HEAP_MAX_ADDR, HEAP_MIN_SIZE + +HEAP_MAX_ADDR is confusing. Currently it is set to 32MB, except +on ieee1275 on x86, where it is 64MB. + +There is a comment which purports to explain it: + +/* If possible, we will avoid claiming heap above this address, because it + seems to cause relocation problems with OSes that link at 4 MiB */ + +This doesn't make a lot of sense when the constants are well above 4MB +already. It was not always this way. Prior to +commit 7b5d0fe4440c ("Increase heap limit") in 2010, HEAP_MAX_SIZE and +HEAP_MAX_ADDR were indeed 4MB. However, when the constants were increased +the comment was left unchanged. + +It's been over a decade. It doesn't seem like we have problems with +claims over 4MB on powerpc or x86 ieee1275. (sparc does things completely +differently and never used the constant.) + +Drop the constant and the check. + +The only use of HEAP_MIN_SIZE was to potentially override the +HEAP_MAX_ADDR check. It is now unused. Remove it. + +Signed-off-by: Daniel Axtens +--- + grub-core/kern/ieee1275/init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 85d50e2965f..8ce1a0f09ee 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -51,7 +51,7 @@ + #endif + #include + +-/* The maximum heap size we're going to claim at boot. Not used by sparc. */ ++/* The maximum heap size we're going to claim. Not used by sparc. */ + #ifdef __i386__ + #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) + #else /* __powerpc__ */ diff --git a/0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch b/0152-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch similarity index 99% rename from 0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch rename to 0152-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch index 5728f26d..a237a217 100644 --- a/0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +++ b/0152-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch @@ -23,7 +23,7 @@ Signed-off-by: Daniel Axtens 3 files changed, 201 insertions(+), 3 deletions(-) diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c -index 2b38b3670a..42ec65c54a 100644 +index 2b38b3670a2..42ec65c54aa 100644 --- a/grub-core/commands/appendedsig/x509.c +++ b/grub-core/commands/appendedsig/x509.c @@ -47,6 +47,12 @@ const char *keyUsage_oid = "2.5.29.15"; @@ -156,7 +156,7 @@ index 2b38b3670a..42ec65c54a 100644 cleanup_value: diff --git a/grub-core/tests/appended_signature_test.c b/grub-core/tests/appended_signature_test.c -index 88a485200d..dbba061662 100644 +index 88a485200d8..dbba0616621 100644 --- a/grub-core/tests/appended_signature_test.c +++ b/grub-core/tests/appended_signature_test.c @@ -111,6 +111,22 @@ static struct grub_procfs_entry certificate_printable_der_entry = { @@ -225,7 +225,7 @@ index 88a485200d..dbba061662 100644 GRUB_FUNCTIONAL_TEST (appended_signature_test, appended_signature_test); diff --git a/grub-core/tests/appended_signatures.h b/grub-core/tests/appended_signatures.h -index aa3dc6278e..2e5ebd7d8b 100644 +index aa3dc6278e3..2e5ebd7d8bd 100644 --- a/grub-core/tests/appended_signatures.h +++ b/grub-core/tests/appended_signatures.h @@ -555,3 +555,84 @@ unsigned char certificate_printable_der[] = { diff --git a/0176-ieee1275-ofdisk-retry-on-open-failure.patch b/0153-ieee1275-ofdisk-retry-on-open-failure.patch similarity index 93% rename from 0176-ieee1275-ofdisk-retry-on-open-failure.patch rename to 0153-ieee1275-ofdisk-retry-on-open-failure.patch index 91497730..160f0c9f 100644 --- a/0176-ieee1275-ofdisk-retry-on-open-failure.patch +++ b/0153-ieee1275-ofdisk-retry-on-open-failure.patch @@ -16,7 +16,7 @@ Signed-off-by: Diego Domingos 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index ea7f78ac7d..55346849d3 100644 +index 629fc15f284..b413822bb87 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -225,7 +225,9 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) @@ -50,7 +50,7 @@ index ea7f78ac7d..55346849d3 100644 if (! last_ihandle) return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); last_devpath = op->open_path; -@@ -571,7 +575,7 @@ grub_ofdisk_prepare (grub_disk_t disk, grub_disk_addr_t sector) +@@ -567,7 +571,7 @@ grub_ofdisk_prepare (grub_disk_t disk, grub_disk_addr_t sector) last_ihandle = 0; last_devpath = NULL; @@ -58,8 +58,8 @@ index ea7f78ac7d..55346849d3 100644 + RETRY_IEEE1275_OFDISK_OPEN(disk->data, &last_ihandle); if (! last_ihandle) return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); - last_devpath = disk->data; -@@ -598,12 +602,23 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector, + last_devpath = disk->data; +@@ -594,12 +598,23 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector, return err; grub_ieee1275_read (last_ihandle, buf, size << disk->log_sector_size, &actual); @@ -85,7 +85,7 @@ index ea7f78ac7d..55346849d3 100644 } diff --git a/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h -index 2f69e3f191..7d2d540930 100644 +index 2f69e3f191d..7d2d5409305 100644 --- a/include/grub/ieee1275/ofdisk.h +++ b/include/grub/ieee1275/ofdisk.h @@ -22,4 +22,12 @@ diff --git a/0178-efinet-Add-DHCP-proxy-support.patch b/0154-efinet-Add-DHCP-proxy-support.patch similarity index 80% rename from 0178-efinet-Add-DHCP-proxy-support.patch rename to 0154-efinet-Add-DHCP-proxy-support.patch index eed2dbb0..6d1b6da5 100644 --- a/0178-efinet-Add-DHCP-proxy-support.patch +++ b/0154-efinet-Add-DHCP-proxy-support.patch @@ -10,14 +10,14 @@ server ack packet. Currently that case is not handled, add support for it. Signed-off-by: Ian Page Hands Signed-off-by: Robbie Harwood --- - grub-core/net/drivers/efi/efinet.c | 25 +++++++++++++++++++++++-- - 1 file changed, 23 insertions(+), 2 deletions(-) + grub-core/net/drivers/efi/efinet.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index e11d759f19..1a24f38a21 100644 +index 225dc896da0..83005ea9f88 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c -@@ -850,10 +850,31 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -871,12 +871,32 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, else { grub_dprintf ("efinet", "using ipv4 and dhcp\n"); @@ -42,12 +42,12 @@ index e11d759f19..1a24f38a21 100644 + } + } + - grub_net_configure_by_dhcp_ack (card->name, card, 0, - (struct grub_net_bootp_packet *) -- packet_buf, -- packet_bufsz, -+ &pxe_mode->dhcp_ack, -+ sizeof (pxe_mode->dhcp_ack), - 1, device, path); + inter = grub_net_configure_by_dhcp_ack (card->name, card, 0, + (struct grub_net_bootp_packet *) + packet_buf, + packet_bufsz, + 1, device, path); +- grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); - } + if (inter != NULL) + { diff --git a/0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch b/0155-Don-t-update-the-cmdline-when-generating-legacy-menu.patch similarity index 92% rename from 0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch rename to 0155-Don-t-update-the-cmdline-when-generating-legacy-menu.patch index b2783d13..47eca898 100644 --- a/0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +++ b/0155-Don-t-update-the-cmdline-when-generating-legacy-menu.patch @@ -20,10 +20,10 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index e490e1a43a..865af3d6c4 100644 +index b8bc37e92aa..360ce26e5f9 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -256,7 +256,9 @@ if [ -z "\${kernelopts}" ]; then +@@ -258,7 +258,9 @@ if [ -z "\${kernelopts}" ]; then fi EOF diff --git a/0181-Suppress-gettext-error-message.patch b/0156-Suppress-gettext-error-message.patch similarity index 96% rename from 0181-Suppress-gettext-error-message.patch rename to 0156-Suppress-gettext-error-message.patch index 64b219a8..e2484951 100644 --- a/0181-Suppress-gettext-error-message.patch +++ b/0156-Suppress-gettext-error-message.patch @@ -14,7 +14,7 @@ Signed-off-by: Paulo Flabiano Smorigo 1 file changed, 7 insertions(+) diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c -index 4d02e62c10..7ec81ca0b4 100644 +index 7a1c14e4f33..631af7a946b 100644 --- a/grub-core/gettext/gettext.c +++ b/grub-core/gettext/gettext.c @@ -424,6 +424,13 @@ grub_gettext_init_ext (struct grub_gettext_context *ctx, diff --git a/0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch b/0157-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch similarity index 97% rename from 0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch rename to 0157-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch index b5d5e5cb..7ecea22d 100644 --- a/0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +++ b/0157-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch @@ -15,7 +15,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/util/grub-set-password.in b/util/grub-set-password.in -index c0b5ebbfdc..d8005e5a14 100644 +index c0b5ebbfdc5..d8005e5a142 100644 --- a/util/grub-set-password.in +++ b/util/grub-set-password.in @@ -1,11 +1,6 @@ diff --git a/0186-normal-main-Discover-the-device-to-read-the-config-f.patch b/0158-normal-main-Discover-the-device-to-read-the-config-f.patch similarity index 98% rename from 0186-normal-main-Discover-the-device-to-read-the-config-f.patch rename to 0158-normal-main-Discover-the-device-to-read-the-config-f.patch index 2c9ca3a4..d6420264 100644 --- a/0186-normal-main-Discover-the-device-to-read-the-config-f.patch +++ b/0158-normal-main-Discover-the-device-to-read-the-config-f.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 7de9e4c36d..8f5fd81003 100644 +index 0ea27d3c534..fc3ed551cec 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -337,18 +337,13 @@ grub_enter_normal_mode (const char *config) diff --git a/0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch b/0159-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch similarity index 92% rename from 0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch rename to 0159-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch index b9bc1400..61bb0b5c 100644 --- a/0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +++ b/0159-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch @@ -21,21 +21,19 @@ Signed-off-by: Daniel Axtens [rharwood@redhat.com: squash in fixup commit] Signed-off-by: Robbie Harwood --- - grub-core/kern/main.c | 49 ++++++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 44 insertions(+), 5 deletions(-) + grub-core/kern/main.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index b573be6650..3fc3401472 100644 +index 353a62ef1e1..dbd4f596fbe 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c -@@ -216,13 +216,52 @@ grub_set_prefix_and_root (void) - if (device) +@@ -217,12 +217,51 @@ grub_set_prefix_and_root (void) { char *prefix_set; -- + - prefix_set = grub_xasprintf ("(%s)%s", device, path ? : ""); - if (prefix_set) -+ +#ifdef __powerpc__ + /* We have to be careful here on powerpc-ieee1275 + signed grub. We + will have signed something with a prefix that doesn't have a device diff --git a/0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch b/0160-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch similarity index 97% rename from 0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch rename to 0160-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch index 216418b2..a6b31cc6 100644 --- a/0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +++ b/0160-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch @@ -79,10 +79,10 @@ Signed-off-by: Robbie Harwood 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 4a57de975e..08ac0fb15f 100644 +index c748a37b4c5..ceb15879272 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -89,7 +89,7 @@ kernel = { +@@ -99,7 +99,7 @@ kernel = { i386_xen_pvh_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x100000'; mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; @@ -92,7 +92,7 @@ index 4a57de975e..08ac0fb15f 100644 mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)'; mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000'; diff --git a/include/grub/offsets.h b/include/grub/offsets.h -index 871e1cd4c3..69211aa798 100644 +index 871e1cd4c38..69211aa798b 100644 --- a/include/grub/offsets.h +++ b/include/grub/offsets.h @@ -63,7 +63,7 @@ diff --git a/0161-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0161-Add-Fedora-location-of-DejaVu-SANS-font.patch new file mode 100644 index 00000000..63bbc18a --- /dev/null +++ b/0161-Add-Fedora-location-of-DejaVu-SANS-font.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: fluteze +Date: Sat, 27 Nov 2021 10:54:44 -0600 +Subject: [PATCH] Add Fedora location of DejaVu SANS font + +In Fedora 35, and possibly earlier, grub would fail to configure with a +complaint about DejaVu being "not found" even though it was installed. +The DejaVu sans font search path is updated to reflect the +distribution's current install path. + +Signed-off-by: Erik Edwards +[rharwood@redhat.com: slight commit message edits] +Signed-off-by: Robbie Harwood +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 016cd3d4e0e..d223fe3ef6e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1924,7 +1924,7 @@ if test "x$with_dejavufont" = x; then + # search in well-known directories + if test x"$starfield_excuse" = x; then + for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do +- for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype /usr/pkg/share/fonts/X11/TTF /usr/local/share/fonts/dejavu /usr/X11R6/lib/X11/fonts/TTF; do ++ for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype /usr/pkg/share/fonts/X11/TTF /usr/local/share/fonts/dejavu /usr/X11R6/lib/X11/fonts/TTF /usr/share/fonts/dejavu-sans-fonts; do + if test -f "$dir/DejaVuSans.$ext"; then + DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" + break 2 diff --git a/0205-efi-new-connectefi-command.patch b/0162-efi-new-connectefi-command.patch similarity index 94% rename from 0205-efi-new-connectefi-command.patch rename to 0162-efi-new-connectefi-command.patch index f80de22c..f36d9ca0 100644 --- a/0205-efi-new-connectefi-command.patch +++ b/0162-efi-new-connectefi-command.patch @@ -64,10 +64,10 @@ Signed-off-by: Robbie Harwood create mode 100644 grub-core/commands/efi/connectefi.c diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index ec1ec5083b..741a033978 100644 +index ceb15879272..c9dcfa00e85 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -836,6 +836,12 @@ module = { +@@ -861,6 +861,12 @@ module = { enable = efi; }; @@ -82,7 +82,7 @@ index ec1ec5083b..741a033978 100644 common = commands/blocklist.c; diff --git a/grub-core/commands/efi/connectefi.c b/grub-core/commands/efi/connectefi.c new file mode 100644 -index 0000000000..8ab75bd51b +index 00000000000..0f840ea0575 --- /dev/null +++ b/grub-core/commands/efi/connectefi.c @@ -0,0 +1,205 @@ @@ -165,7 +165,7 @@ index 0000000000..8ab75bd51b + +typedef struct searched_item +{ -+ grub_efi_guid_t guid; ++ grub_guid_t guid; + const char *name; + searched_item_flags flags; +} searched_items; @@ -292,7 +292,7 @@ index 0000000000..8ab75bd51b + grub_unregister_command (cmd); +} diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c -index d1ce99af43..f2d2430e66 100644 +index 7b8316d4184..3635cd99b75 100644 --- a/grub-core/commands/efi/lsefi.c +++ b/grub-core/commands/efi/lsefi.c @@ -19,6 +19,7 @@ @@ -304,7 +304,7 @@ index d1ce99af43..f2d2430e66 100644 #include #include diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c -index fe8ba6e6c9..062143dfff 100644 +index 822005456eb..af69cc3bc8a 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -396,6 +396,19 @@ enumerate_disks (void) @@ -328,10 +328,10 @@ index fe8ba6e6c9..062143dfff 100644 grub_efidisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, grub_disk_pull_t pull) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 14bc10eb56..7fcca69c17 100644 +index ef837387368..412a2073f41 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -95,6 +95,19 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type, +@@ -96,6 +96,19 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type, return buffer; } @@ -344,15 +344,15 @@ index 14bc10eb56..7fcca69c17 100644 + grub_efi_boot_services_t *b; + + b = grub_efi_system_table->boot_services; -+ return efi_call_4 (b->connect_controller, controller_handle, ++ return b->connect_controller(controller_handle, + driver_image_handle, remaining_device_path, recursive); +} + void * grub_efi_open_protocol (grub_efi_handle_t handle, - grub_efi_guid_t *protocol, + grub_guid_t *protocol, diff --git a/include/grub/efi/disk.h b/include/grub/efi/disk.h -index 254475c842..6845c2f1fd 100644 +index 254475c8428..6845c2f1fd8 100644 --- a/include/grub/efi/disk.h +++ b/include/grub/efi/disk.h @@ -27,6 +27,8 @@ grub_efi_handle_t @@ -365,11 +365,11 @@ index 254475c842..6845c2f1fd 100644 void grub_efidisk_fini (void); diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 8dfc89a33b..ec52083c49 100644 +index 6c2c1f36e37..736d6f25694 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -41,6 +41,11 @@ EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type, - grub_efi_guid_t *protocol, +@@ -53,6 +53,11 @@ EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type, + grub_guid_t *protocol, void *search_key, grub_efi_uintn_t *num_handles); +grub_efi_status_t @@ -378,13 +378,13 @@ index 8dfc89a33b..ec52083c49 100644 + grub_efi_device_path_protocol_t *remaining_device_path, + grub_efi_boolean_t recursive); void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle, - grub_efi_guid_t *protocol, + grub_guid_t *protocol, grub_efi_uint32_t attributes); diff --git a/NEWS b/NEWS -index 73b8492bc4..d7c1d23aed 100644 +index 3101309621b..e3cfcd569c2 100644 --- a/NEWS +++ b/NEWS -@@ -98,7 +98,7 @@ New in 2.02: +@@ -118,7 +118,7 @@ New in 2.02: * Prefer pmtimer for TSC calibration. * New/improved platform support: diff --git a/0210-powerpc-prefix-detection-support-device-names-with-c.patch b/0163-powerpc-prefix-detection-support-device-names-with-c.patch similarity index 98% rename from 0210-powerpc-prefix-detection-support-device-names-with-c.patch rename to 0163-powerpc-prefix-detection-support-device-names-with-c.patch index 1c16fd39..57444137 100644 --- a/0210-powerpc-prefix-detection-support-device-names-with-c.patch +++ b/0163-powerpc-prefix-detection-support-device-names-with-c.patch @@ -30,7 +30,7 @@ Signed-off-by: Daniel Axtens 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 993b8a8598..e94a2f78fb 100644 +index dbd4f596fbe..8e89763f43b 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -242,14 +242,29 @@ grub_set_prefix_and_root (void) diff --git a/0211-make-ofdisk_retries-optional.patch b/0164-make-ofdisk_retries-optional.patch similarity index 98% rename from 0211-make-ofdisk_retries-optional.patch rename to 0164-make-ofdisk_retries-optional.patch index fce9702d..791c0a6f 100644 --- a/0211-make-ofdisk_retries-optional.patch +++ b/0164-make-ofdisk_retries-optional.patch @@ -24,7 +24,7 @@ so the default number of retries will be used instead. 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h -index 7d2d540930..0074d55eee 100644 +index 7d2d5409305..0074d55eee4 100644 --- a/include/grub/ieee1275/ofdisk.h +++ b/include/grub/ieee1275/ofdisk.h @@ -25,7 +25,12 @@ extern void grub_ofdisk_fini (void); diff --git a/0246-misc-Make-grub_min-and-grub_max-more-resilient.patch b/0165-misc-Make-grub_min-and-grub_max-more-resilient.patch similarity index 94% rename from 0246-misc-Make-grub_min-and-grub_max-more-resilient.patch rename to 0165-misc-Make-grub_min-and-grub_max-more-resilient.patch index eb2e8fda..a9afc998 100644 --- a/0246-misc-Make-grub_min-and-grub_max-more-resilient.patch +++ b/0165-misc-Make-grub_min-and-grub_max-more-resilient.patch @@ -24,10 +24,10 @@ Signed-off-by: Peter Jones 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c -index f2318e0d16..87f6e31aa6 100644 +index 1edad05948c..8d370b0b3f5 100644 --- a/grub-core/loader/multiboot_elfxx.c +++ b/grub-core/loader/multiboot_elfxx.c -@@ -35,9 +35,7 @@ +@@ -45,9 +45,7 @@ #endif #include @@ -39,7 +39,7 @@ index f2318e0d16..87f6e31aa6 100644 #pragma GCC diagnostic ignored "-Wcast-align" diff --git a/include/grub/misc.h b/include/grub/misc.h -index 6c4aa85ac5..cf84aec1db 100644 +index 3f5f5b61695..252bdb161eb 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -35,6 +35,14 @@ @@ -57,7 +57,7 @@ index 6c4aa85ac5..cf84aec1db 100644 #define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, __VA_ARGS__) void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n); -@@ -498,8 +506,21 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file, +@@ -525,8 +533,21 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file, #define grub_boot_time(...) #endif diff --git a/0247-ReiserFS-switch-to-using-grub_min-grub_max.patch b/0166-ReiserFS-switch-to-using-grub_min-grub_max.patch similarity index 99% rename from 0247-ReiserFS-switch-to-using-grub_min-grub_max.patch rename to 0166-ReiserFS-switch-to-using-grub_min-grub_max.patch index 0707af3e..76d44ac3 100644 --- a/0247-ReiserFS-switch-to-using-grub_min-grub_max.patch +++ b/0166-ReiserFS-switch-to-using-grub_min-grub_max.patch @@ -13,7 +13,7 @@ Signed-off-by: Peter Jones 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c -index af6a226a7f..b8253da7fe 100644 +index 36b26ac98a0..42818c37622 100644 --- a/grub-core/fs/reiserfs.c +++ b/grub-core/fs/reiserfs.c @@ -42,16 +42,6 @@ diff --git a/0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch b/0167-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch similarity index 76% rename from 0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch rename to 0167-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch index a7ac6f2a..9293ba93 100644 --- a/0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch +++ b/0167-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch @@ -13,29 +13,27 @@ in DEBUG, regardless of BOOT_TIME_STATS. Signed-off-by: Peter Jones --- - grub-core/kern/misc.c | 3 ++- + grub-core/kern/misc.c | 1 + include/grub/misc.h | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index a186ad3dd4..cb45461402 100644 +index d3a493e3552..f607244e7ae 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -1334,7 +1334,8 @@ grub_real_boot_time (const char *file, - n->next = 0; +@@ -1438,6 +1438,7 @@ grub_real_boot_time (const char *file, va_start (args, fmt); -- n->msg = grub_xvasprintf (fmt, args); -+ n->msg = grub_xvasprintf (fmt, args); + n->msg = grub_xvasprintf (fmt, args); + grub_dprintf ("boot", "%s\n", n->msg); va_end (args); *boot_time_last = n; diff --git a/include/grub/misc.h b/include/grub/misc.h -index cf84aec1db..faae0ae860 100644 +index 252bdb161eb..c3c735371dc 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h -@@ -503,7 +503,7 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file, +@@ -530,7 +530,7 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file, const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 3, 4))); #define grub_boot_time(...) grub_real_boot_time(GRUB_FILE, __LINE__, __VA_ARGS__) #else diff --git a/0249-modules-make-.module_license-read-only.patch b/0168-modules-make-.module_license-read-only.patch similarity index 97% rename from 0249-modules-make-.module_license-read-only.patch rename to 0168-modules-make-.module_license-read-only.patch index ba3b3137..368386d0 100644 --- a/0249-modules-make-.module_license-read-only.patch +++ b/0168-modules-make-.module_license-read-only.patch @@ -16,7 +16,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grub/dl.h b/include/grub/dl.h -index 20d870f2a4..618ae6f474 100644 +index 3f10e27d62c..216f8b903ac 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -121,7 +121,7 @@ grub_mod_fini (void) diff --git a/0250-modules-strip-.llvm_addrsig-sections-and-similar.patch b/0169-modules-strip-.llvm_addrsig-sections-and-similar.patch similarity index 97% rename from 0250-modules-strip-.llvm_addrsig-sections-and-similar.patch rename to 0169-modules-strip-.llvm_addrsig-sections-and-similar.patch index 9f26115d..c86b9997 100644 --- a/0250-modules-strip-.llvm_addrsig-sections-and-similar.patch +++ b/0169-modules-strip-.llvm_addrsig-sections-and-similar.patch @@ -21,7 +21,7 @@ Signed-off-by: Peter Jones 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in -index 1250589b3f..c2c5280d75 100644 +index e57c4d9205c..337753c574c 100644 --- a/grub-core/genmod.sh.in +++ b/grub-core/genmod.sh.in @@ -57,8 +57,11 @@ if test x@TARGET_APPLE_LINKER@ != x1; then diff --git a/0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch b/0170-modules-Don-t-allocate-space-for-non-allocable-secti.patch similarity index 92% rename from 0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch rename to 0170-modules-Don-t-allocate-space-for-non-allocable-secti.patch index d07d8386..19c7fdd1 100644 --- a/0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch +++ b/0170-modules-Don-t-allocate-space-for-non-allocable-secti.patch @@ -20,10 +20,10 @@ Signed-off-by: Peter Jones 1 file changed, 3 insertions(+) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index f304494574..aef8af8aa7 100644 +index 931f6e41442..832c6188df4 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c -@@ -289,6 +289,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) +@@ -281,6 +281,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) i < e->e_shnum; i++, s = (const Elf_Shdr *)((const char *) s + e->e_shentsize)) { diff --git a/0254-modules-load-module-sections-at-page-aligned-address.patch b/0171-modules-load-module-sections-at-page-aligned-address.patch similarity index 90% rename from 0254-modules-load-module-sections-at-page-aligned-address.patch rename to 0171-modules-load-module-sections-at-page-aligned-address.patch index eb171f5e..8ace83db 100644 --- a/0254-modules-load-module-sections-at-page-aligned-address.patch +++ b/0171-modules-load-module-sections-at-page-aligned-address.patch @@ -71,7 +71,7 @@ Signed-off-by: Peter Jones 13 files changed, 139 insertions(+), 11 deletions(-) diff --git a/grub-core/kern/arm/dl.c b/grub-core/kern/arm/dl.c -index eab9d17ff2..9260737936 100644 +index eab9d17ff2d..92607379366 100644 --- a/grub-core/kern/arm/dl.c +++ b/grub-core/kern/arm/dl.c @@ -278,3 +278,16 @@ grub_arch_dl_check_header (void *ehdr) @@ -92,7 +92,7 @@ index eab9d17ff2..9260737936 100644 +#endif +} diff --git a/grub-core/kern/arm64/dl.c b/grub-core/kern/arm64/dl.c -index 512e5a80b0..0d4a26857f 100644 +index a2b5789a9dd..95c6d5bf4e5 100644 --- a/grub-core/kern/arm64/dl.c +++ b/grub-core/kern/arm64/dl.c @@ -196,3 +196,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, @@ -113,19 +113,19 @@ index 512e5a80b0..0d4a26857f 100644 +#endif +} diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index aef8af8aa7..8c7aacef39 100644 +index 832c6188df4..775b367287e 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c -@@ -277,7 +277,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) +@@ -268,7 +268,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) { unsigned i; const Elf_Shdr *s; - grub_size_t tsize = 0, talign = 1; + grub_size_t tsize = 0, talign = 1, arch_addralign = 1; - #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && \ + !defined (__loongarch__) grub_size_t tramp; - grub_size_t got; -@@ -285,16 +285,24 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) +@@ -277,16 +277,24 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) #endif char *ptr; @@ -152,8 +152,8 @@ index aef8af8aa7..8c7aacef39 100644 + talign = sh_addralign; } - #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) -@@ -323,6 +331,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && \ +@@ -316,6 +324,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) i < e->e_shnum; i++, s = (Elf_Shdr *)((char *) s + e->e_shentsize)) { @@ -163,7 +163,7 @@ index aef8af8aa7..8c7aacef39 100644 if (s->sh_flags & SHF_ALLOC) { grub_dl_segment_t seg; -@@ -335,17 +346,19 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) +@@ -328,17 +339,19 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) { void *addr; @@ -186,7 +186,7 @@ index aef8af8aa7..8c7aacef39 100644 break; } -@@ -354,7 +367,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) +@@ -347,7 +360,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) else seg->addr = 0; @@ -196,7 +196,7 @@ index aef8af8aa7..8c7aacef39 100644 seg->next = mod->segment; mod->segment = seg; diff --git a/grub-core/kern/emu/full.c b/grub-core/kern/emu/full.c -index e8d63b1f5f..1de1c28eb0 100644 +index e8d63b1f5f9..1de1c28eb09 100644 --- a/grub-core/kern/emu/full.c +++ b/grub-core/kern/emu/full.c @@ -67,3 +67,16 @@ grub_arch_dl_init_linker (void) @@ -217,7 +217,7 @@ index e8d63b1f5f..1de1c28eb0 100644 +#endif +} diff --git a/grub-core/kern/i386/dl.c b/grub-core/kern/i386/dl.c -index 1346da5cc9..d6b4681fc9 100644 +index 1346da5cc91..d6b4681fc93 100644 --- a/grub-core/kern/i386/dl.c +++ b/grub-core/kern/i386/dl.c @@ -79,3 +79,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, @@ -238,7 +238,7 @@ index 1346da5cc9..d6b4681fc9 100644 +#endif +} diff --git a/grub-core/kern/ia64/dl.c b/grub-core/kern/ia64/dl.c -index db59300fea..92d82c5750 100644 +index db59300fea3..92d82c57505 100644 --- a/grub-core/kern/ia64/dl.c +++ b/grub-core/kern/ia64/dl.c @@ -148,3 +148,12 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, @@ -255,7 +255,7 @@ index db59300fea..92d82c5750 100644 + return 1; +} diff --git a/grub-core/kern/mips/dl.c b/grub-core/kern/mips/dl.c -index 5d7d299c74..6d83bd71e9 100644 +index 5b02f97fca7..db411899dbe 100644 --- a/grub-core/kern/mips/dl.c +++ b/grub-core/kern/mips/dl.c @@ -272,3 +272,11 @@ grub_arch_dl_init_linker (void) @@ -271,7 +271,7 @@ index 5d7d299c74..6d83bd71e9 100644 + return 1; +} diff --git a/grub-core/kern/powerpc/dl.c b/grub-core/kern/powerpc/dl.c -index cdd61b305f..5d9ba2e158 100644 +index 7b6418eabd7..0eb8bc5bd31 100644 --- a/grub-core/kern/powerpc/dl.c +++ b/grub-core/kern/powerpc/dl.c @@ -167,3 +167,12 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, @@ -288,10 +288,10 @@ index cdd61b305f..5d9ba2e158 100644 + return 1; +} diff --git a/grub-core/kern/riscv/dl.c b/grub-core/kern/riscv/dl.c -index f26b12aaa4..aa18f9e990 100644 +index 896653bb41c..1fa085b4acf 100644 --- a/grub-core/kern/riscv/dl.c +++ b/grub-core/kern/riscv/dl.c -@@ -343,3 +343,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, +@@ -344,3 +344,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, return GRUB_ERR_NONE; } @@ -309,7 +309,7 @@ index f26b12aaa4..aa18f9e990 100644 +#endif +} diff --git a/grub-core/kern/sparc64/dl.c b/grub-core/kern/sparc64/dl.c -index f3d960186b..f054f08241 100644 +index f3d960186ba..f054f08241d 100644 --- a/grub-core/kern/sparc64/dl.c +++ b/grub-core/kern/sparc64/dl.c @@ -189,3 +189,12 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, @@ -326,7 +326,7 @@ index f3d960186b..f054f08241 100644 + return 1; +} diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c -index e5a8bdcf4f..a105dc50ce 100644 +index e5a8bdcf4f9..a105dc50cea 100644 --- a/grub-core/kern/x86_64/dl.c +++ b/grub-core/kern/x86_64/dl.c @@ -119,3 +119,16 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, @@ -347,10 +347,10 @@ index e5a8bdcf4f..a105dc50ce 100644 +#endif +} diff --git a/include/grub/dl.h b/include/grub/dl.h -index 618ae6f474..f36ed5cb17 100644 +index 216f8b903ac..9f86765c8e9 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h -@@ -280,6 +280,8 @@ grub_err_t grub_arch_dl_check_header (void *ehdr); +@@ -279,6 +279,8 @@ grub_err_t grub_arch_dl_check_header (void *ehdr); grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, Elf_Shdr *s, grub_dl_segment_t seg); @@ -360,10 +360,10 @@ index 618ae6f474..f36ed5cb17 100644 #if defined (_mips) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 19f708ee66..7b2455a8fe 100644 +index 04c6678cb6b..8ad5494f5ce 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi -@@ -755,9 +755,9 @@ declare startup asm file ($cpu_$platform_startup) as well as any other files +@@ -996,9 +996,9 @@ declare startup asm file ($cpu_$platform_startup) as well as any other files (e.g. init.c and callwrap.S) (e.g. $cpu_$platform = kern/$cpu/$platform/init.c). At this stage you will also need to add dummy dl.c and cache.S with functions grub_err_t grub_arch_dl_check_header (void *ehdr), grub_err_t @@ -375,4 +375,4 @@ index 19f708ee66..7b2455a8fe 100644 +*address, grub_size_t len) (cache.S). They won't be used for now. You will need to create directory include/$cpu/$platform and a file - include/$cpu/types.h. The later folowing this template: + include/$cpu/types.h. The latter following this template: diff --git a/0255-nx-add-memory-attribute-get-set-API.patch b/0172-nx-add-memory-attribute-get-set-API.patch similarity index 89% rename from 0255-nx-add-memory-attribute-get-set-API.patch rename to 0172-nx-add-memory-attribute-get-set-API.patch index 91c9d2f5..6a473411 100644 --- a/0255-nx-add-memory-attribute-get-set-API.patch +++ b/0172-nx-add-memory-attribute-get-set-API.patch @@ -29,10 +29,10 @@ Signed-off-by: Robbie Harwood 5 files changed, 226 insertions(+) diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 7fcca69c17..4ac2b2754e 100644 +index 412a2073f41..cdfc11565c7 100644 --- a/grub-core/kern/efi/efi.c +++ b/grub-core/kern/efi/efi.c -@@ -1096,3 +1096,39 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1, +@@ -1130,3 +1130,39 @@ grub_efi_find_configuration_table (const grub_guid_t *target_guid) return 0; } @@ -73,10 +73,10 @@ index 7fcca69c17..4ac2b2754e 100644 + return err; +} diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index e84961d078..2c33758ed7 100644 +index 6a6fba89184..df443f434d4 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c -@@ -738,3 +738,134 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) +@@ -687,3 +687,134 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) return GRUB_ERR_NONE; } #endif @@ -124,7 +124,7 @@ index e84961d078..2c33758ed7 100644 +{ + grub_efi_memory_attribute_protocol_t *proto; + grub_efi_physical_address_t physaddr = addr; -+ grub_efi_guid_t protocol_guid = GRUB_EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID; ++ grub_guid_t protocol_guid = GRUB_EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID; + grub_efi_status_t efi_status; + + proto = grub_efi_locate_protocol (&protocol_guid, 0); @@ -138,7 +138,7 @@ index e84961d078..2c33758ed7 100644 + return 0; + } + -+ efi_status = efi_call_4(proto->get_memory_attributes, ++ efi_status = proto->get_memory_attributes( + proto, physaddr, size, attrs); + *attrs = uefi_mem_attrs_to_grub_mem_attrs (*attrs); + @@ -151,7 +151,7 @@ index e84961d078..2c33758ed7 100644 +{ + grub_efi_memory_attribute_protocol_t *proto; + grub_efi_physical_address_t physaddr = addr; -+ grub_efi_guid_t protocol_guid = GRUB_EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID; ++ grub_guid_t protocol_guid = GRUB_EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID; + grub_efi_status_t efi_status = GRUB_EFI_SUCCESS; + grub_uint64_t before = 0, after = 0, uefi_set_attrs, uefi_clear_attrs; + grub_err_t err; @@ -183,10 +183,10 @@ index e84961d078..2c33758ed7 100644 + uefi_clear_attrs = grub_mem_attrs_to_uefi_mem_attrs (clear_attrs); + grub_dprintf ("nx", "translating clear_attrs from 0x%lx to 0x%lx\n", clear_attrs, uefi_clear_attrs); + if (uefi_set_attrs) -+ efi_status = efi_call_4(proto->set_memory_attributes, ++ efi_status = proto->set_memory_attributes( + proto, physaddr, size, uefi_set_attrs); + if (efi_status == GRUB_EFI_SUCCESS && uefi_clear_attrs) -+ efi_status = efi_call_4(proto->clear_memory_attributes, ++ efi_status = proto->clear_memory_attributes( + proto, physaddr, size, uefi_clear_attrs); + + err = grub_get_mem_attrs (addr, size, &after); @@ -212,11 +212,11 @@ index e84961d078..2c33758ed7 100644 + return grub_efi_status_to_err (efi_status); +} diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index f431f49973..464842ba37 100644 +index 805a9d7adf9..76c88fbdcb0 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h -@@ -363,6 +363,11 @@ - { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \ +@@ -389,6 +389,11 @@ + {0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f } \ } +#define GRUB_EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID \ @@ -227,7 +227,7 @@ index f431f49973..464842ba37 100644 struct grub_efi_sal_system_table { grub_uint32_t signature; -@@ -2102,6 +2107,26 @@ struct grub_efi_ip6_config_manual_address { +@@ -2182,6 +2187,26 @@ struct grub_efi_ip6_config_manual_address { }; typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t; @@ -251,14 +251,14 @@ index f431f49973..464842ba37 100644 +}; +typedef struct grub_efi_memory_attribute_protocol grub_efi_memory_attribute_protocol_t; + - #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ - || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ - || defined(__riscv) + struct initrd_media_device_path { + grub_efi_vendor_media_device_path_t vendor; + grub_efi_device_path_t end; diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index ec52083c49..34825c4adc 100644 +index 736d6f25694..3670eddc52b 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -164,4 +164,6 @@ struct grub_net_card; +@@ -189,4 +189,6 @@ struct grub_net_card; grub_efi_handle_t grub_efinet_get_device_handle (struct grub_net_card *card); @@ -266,18 +266,18 @@ index ec52083c49..34825c4adc 100644 + #endif /* ! GRUB_EFI_EFI_HEADER */ diff --git a/include/grub/mm.h b/include/grub/mm.h -index 9c38dd3ca5..d81623d226 100644 +index f3bf87fa0f9..8ee1fc7171c 100644 --- a/include/grub/mm.h +++ b/include/grub/mm.h -@@ -22,6 +22,7 @@ - +@@ -23,6 +23,7 @@ + #include #include #include +#include #include #ifndef NULL -@@ -38,6 +39,37 @@ void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size); +@@ -56,6 +57,37 @@ void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size); void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size); #endif diff --git a/0256-nx-set-page-permissions-for-loaded-modules.patch b/0173-nx-set-page-permissions-for-loaded-modules.patch similarity index 81% rename from 0256-nx-set-page-permissions-for-loaded-modules.patch rename to 0173-nx-set-page-permissions-for-loaded-modules.patch index 9e0aebbc..416caedb 100644 --- a/0256-nx-set-page-permissions-for-loaded-modules.patch +++ b/0173-nx-set-page-permissions-for-loaded-modules.patch @@ -16,15 +16,15 @@ Signed-off-by: Peter Jones [rharwood: arm tgptr -> tgaddr] Signed-off-by: Robbie Harwood --- - grub-core/kern/dl.c | 120 +++++++++++++++++++++++++++++++++++++++------------- - include/grub/dl.h | 44 +++++++++++++++++++ - 2 files changed, 134 insertions(+), 30 deletions(-) + grub-core/kern/dl.c | 102 +++++++++++++++++++++++++++++++++++++++++++++------- + include/grub/dl.h | 44 +++++++++++++++++++++++ + 2 files changed, 133 insertions(+), 13 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 8c7aacef39..d5de80186f 100644 +index 775b367287e..25666ae383f 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c -@@ -285,6 +285,8 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) +@@ -277,6 +277,8 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) #endif char *ptr; @@ -33,7 +33,7 @@ index 8c7aacef39..d5de80186f 100644 arch_addralign = grub_arch_dl_min_alignment (); for (i = 0, s = (const Elf_Shdr *)((const char *) e + e->e_shoff); -@@ -384,6 +386,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) +@@ -378,6 +380,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) ptr += got; #endif @@ -41,31 +41,7 @@ index 8c7aacef39..d5de80186f 100644 return GRUB_ERR_NONE; } -@@ -517,23 +520,6 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name) - return s; - return NULL; - } --static long --grub_dl_find_section_index (Elf_Ehdr *e, const char *name) --{ -- Elf_Shdr *s; -- const char *str; -- unsigned i; -- -- s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); -- str = (char *) e + s->sh_offset; -- -- for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); -- i < e->e_shnum; -- i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) -- if (grub_strcmp (str + s->sh_name, name) == 0) -- return (long)i; -- return -1; --} - - /* Me, Vladimir Serbinenko, hereby I add this module check as per new - GNU module policy. Note that this license check is informative only. -@@ -662,6 +648,7 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) +@@ -645,6 +648,7 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) Elf_Shdr *s; unsigned i; @@ -73,7 +49,7 @@ index 8c7aacef39..d5de80186f 100644 for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); i < e->e_shnum; i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) -@@ -670,24 +657,95 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) +@@ -653,22 +657,92 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) grub_dl_segment_t seg; grub_err_t err; @@ -102,8 +78,8 @@ index 8c7aacef39..d5de80186f 100644 } + grub_dprintf ("modules", "done relocating symbols for \"%s\"\n", mod->name); - return GRUB_ERR_NONE; - } ++ return GRUB_ERR_NONE; ++} + +static grub_err_t +grub_dl_set_mem_attrs (grub_dl_t mod, void *ehdr) @@ -175,13 +151,10 @@ index 8c7aacef39..d5de80186f 100644 + grub_dprintf ("modules", "done updating module memory attributes for \"%s\"\n", + mod->name); + -+ return GRUB_ERR_NONE; -+} -+ - static void - grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e) - { -@@ -753,6 +811,7 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) + return GRUB_ERR_NONE; + } + +@@ -705,6 +779,7 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) mod->ref_count = 1; grub_dprintf ("modules", "relocating to %p\n", mod); @@ -189,7 +162,7 @@ index 8c7aacef39..d5de80186f 100644 /* Me, Vladimir Serbinenko, hereby I add this module check as per new GNU module policy. Note that this license check is informative only. Modules have to be licensed under GPLv3 or GPLv3+ (optionally -@@ -766,7 +825,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) +@@ -718,7 +793,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) || grub_dl_resolve_dependencies (mod, e) || grub_dl_load_segments (mod, e) || grub_dl_resolve_symbols (mod, e) @@ -200,7 +173,7 @@ index 8c7aacef39..d5de80186f 100644 mod->fini = 0; grub_dl_unload (mod); diff --git a/include/grub/dl.h b/include/grub/dl.h -index f36ed5cb17..45ac8e339f 100644 +index 9f86765c8e9..1e1262a283b 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -27,6 +27,7 @@ @@ -211,7 +184,7 @@ index f36ed5cb17..45ac8e339f 100644 #endif /* -@@ -268,6 +269,49 @@ grub_dl_is_persistent (grub_dl_t mod) +@@ -267,6 +268,49 @@ grub_dl_is_persistent (grub_dl_t mod) return mod->persistent; } diff --git a/0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch b/0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch deleted file mode 100644 index a40caea7..00000000 --- a/0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Wed, 14 Apr 2021 20:10:23 +1000 -Subject: [PATCH] ieee1275: drop HEAP_MAX_ADDR, HEAP_MIN_SIZE - -HEAP_MAX_ADDR is confusing. Currently it is set to 32MB, except -on ieee1275 on x86, where it is 64MB. - -There is a comment which purports to explain it: - -/* If possible, we will avoid claiming heap above this address, because it - seems to cause relocation problems with OSes that link at 4 MiB */ - -This doesn't make a lot of sense when the constants are well above 4MB -already. It was not always this way. Prior to -commit 7b5d0fe4440c ("Increase heap limit") in 2010, HEAP_MAX_SIZE and -HEAP_MAX_ADDR were indeed 4MB. However, when the constants were increased -the comment was left unchanged. - -It's been over a decade. It doesn't seem like we have problems with -claims over 4MB on powerpc or x86 ieee1275. (sparc does things completely -differently and never used the constant.) - -Drop the constant and the check. - -The only use of HEAP_MIN_SIZE was to potentially override the -HEAP_MAX_ADDR check. It is now unused. Remove it. - -Signed-off-by: Daniel Axtens ---- - grub-core/kern/ieee1275/init.c | 17 ----------------- - 1 file changed, 17 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index fc7d971272..0dcd114ce5 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -46,9 +46,6 @@ - #endif - #include - --/* The minimal heap size we can live with. */ --#define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024) -- - /* The maximum heap size we're going to claim */ - #ifdef __i386__ - #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) -@@ -56,14 +53,6 @@ - #define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024) - #endif - --/* If possible, we will avoid claiming heap above this address, because it -- seems to cause relocation problems with OSes that link at 4 MiB */ --#ifdef __i386__ --#define HEAP_MAX_ADDR (unsigned long) (64 * 1024 * 1024) --#else --#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024) --#endif -- - extern char _end[]; - - #ifdef __sparc__ -@@ -185,12 +174,6 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - if (*total + len > HEAP_MAX_SIZE) - len = HEAP_MAX_SIZE - *total; - -- /* Avoid claiming anything above HEAP_MAX_ADDR, if possible. */ -- if ((addr < HEAP_MAX_ADDR) && /* if it's too late, don't bother */ -- (addr + len > HEAP_MAX_ADDR) && /* if it wasn't available anyway, don't bother */ -- (*total + (HEAP_MAX_ADDR - addr) > HEAP_MIN_SIZE)) /* only limit ourselves when we can afford to */ -- len = HEAP_MAX_ADDR - addr; -- - /* In theory, firmware should already prevent this from happening by not - listing our own image in /memory/available. The check below is intended - as a safeguard in case that doesn't happen. However, it doesn't protect diff --git a/0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch b/0174-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch similarity index 63% rename from 0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch rename to 0174-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch index 7da75a81..c2a4c048 100644 --- a/0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch +++ b/0174-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch @@ -17,18 +17,32 @@ GRUB_PE32_NX_COMPAT, and changes grub-mkimage to set that flag. Signed-off-by: Peter Jones --- - util/mkimage.c | 1 + - 1 file changed, 1 insertion(+) + util/mkimage.c | 1 + + include/grub/efi/pe32.h | 2 ++ + 2 files changed, 3 insertions(+) diff --git a/util/mkimage.c b/util/mkimage.c -index 8319e8dfbd..c3d33aaac8 100644 +index e2bb4d4cd05..425d920ff92 100644 --- a/util/mkimage.c +++ b/util/mkimage.c -@@ -1418,6 +1418,7 @@ grub_install_generate_image (const char *dir, const char *prefix, - section = (struct grub_pe32_section_table *)(o64 + 1); - } - +@@ -1438,6 +1438,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdangling-pointer" + #endif + PE_OHDR (o32, o64, dll_characteristics) = grub_host_to_target16 (GRUB_PE32_NX_COMPAT); 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; +diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h +index 4e6e9d254bd..9887e14b278 100644 +--- a/include/grub/efi/pe32.h ++++ b/include/grub/efi/pe32.h +@@ -231,6 +231,8 @@ struct grub_pe64_optional_header + + #define GRUB_PE32_SUBSYSTEM_EFI_APPLICATION 10 + ++#define GRUB_PE32_NX_COMPAT 0x0100 ++ + #define GRUB_PE32_NUM_DATA_DIRECTORIES 16 + + struct grub_pe32_section_table diff --git a/0260-grub_fs_probe-dprint-errors-from-filesystems.patch b/0175-grub_fs_probe-dprint-errors-from-filesystems.patch similarity index 89% rename from 0260-grub_fs_probe-dprint-errors-from-filesystems.patch rename to 0175-grub_fs_probe-dprint-errors-from-filesystems.patch index 1455ae4b..fdd2932f 100644 --- a/0260-grub_fs_probe-dprint-errors-from-filesystems.patch +++ b/0175-grub_fs_probe-dprint-errors-from-filesystems.patch @@ -30,7 +30,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+) diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c -index c698295bcb..b58e2ae1d2 100644 +index 7ad0aaf4e29..f25bace620b 100644 --- a/grub-core/kern/fs.c +++ b/grub-core/kern/fs.c @@ -74,6 +74,7 @@ grub_fs_probe (grub_device_t device) @@ -39,5 +39,5 @@ index c698295bcb..b58e2ae1d2 100644 + grub_dprintf ("fs", _("error: %s.\n"), grub_errmsg); grub_error_push (); - grub_dprintf ("fs", "%s detection failed.\n", p->name); - grub_error_pop (); + /* The grub_error_push() does not touch grub_errmsg. */ + grub_dprintf ("fs", _("error: %s.\n"), grub_errmsg); diff --git a/0262-Make-debug-file-show-which-file-filters-get-run.patch b/0176-Make-debug-file-show-which-file-filters-get-run.patch similarity index 97% rename from 0262-Make-debug-file-show-which-file-filters-get-run.patch rename to 0176-Make-debug-file-show-which-file-filters-get-run.patch index 78bc095d..3bd69d83 100644 --- a/0262-Make-debug-file-show-which-file-filters-get-run.patch +++ b/0176-Make-debug-file-show-which-file-filters-get-run.patch @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones 1 file changed, 11 insertions(+) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index db938e099d..868ce3b63e 100644 +index 264211b1143..1794d022fb0 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -30,6 +30,14 @@ void (*EXPORT_VAR (grub_grubnet_fini)) (void); diff --git a/0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch b/0177-BLS-create-etc-kernel-cmdline-during-mkconfig.patch similarity index 92% rename from 0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch rename to 0177-BLS-create-etc-kernel-cmdline-during-mkconfig.patch index 50ba0fb2..05e83252 100644 --- a/0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +++ b/0177-BLS-create-etc-kernel-cmdline-during-mkconfig.patch @@ -9,10 +9,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 6 insertions(+) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 865af3d6c4..9ebff661a9 100644 +index 360ce26e5f9..a6568caf7d1 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -161,6 +161,12 @@ update_bls_cmdline() +@@ -163,6 +163,12 @@ update_bls_cmdline() local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" local -a files=($(get_sorted_bls)) diff --git a/0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch b/0178-squish-don-t-dup-rhgb-quiet-check-mtimes.patch similarity index 94% rename from 0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch rename to 0178-squish-don-t-dup-rhgb-quiet-check-mtimes.patch index 67073ecf..fa279f1f 100644 --- a/0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +++ b/0178-squish-don-t-dup-rhgb-quiet-check-mtimes.patch @@ -9,10 +9,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 9ebff661a9..41c6cb1dc2 100644 +index a6568caf7d1..079bb9a0961 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -161,10 +161,16 @@ update_bls_cmdline() +@@ -163,10 +163,16 @@ update_bls_cmdline() local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" local -a files=($(get_sorted_bls)) diff --git a/0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch b/0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch deleted file mode 100644 index 3d7c641a..00000000 --- a/0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Fri, 11 Jun 2021 00:01:29 +0200 -Subject: [PATCH] fs/ext2: Ignore checksum seed incompat feature - -This incompat feature is used to denote that the filesystem stored its -metadata checksum seed in the superblock. This is used to allow tune2fs -to change the UUID on a mounted metadata_csum filesystem without having -to rewrite all the disk metadata. - -But GRUB doesn't use the metadata checksum in anyway, so can just ignore -this feature if is enabled. This is consistent with GRUB filesystem code -in general which just does a best effort to access the filesystem's data. - -It may be removed from the ignored list in the future if supports to do -metadata checksumming verification is added to the read-only FS driver. - -Suggested-by: Eric Sandeen -Suggested-by: Lukas Czerner -Signed-off-by: Javier Martinez Canillas ---- - grub-core/fs/ext2.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c -index e7dd78e663..731d346f88 100644 ---- a/grub-core/fs/ext2.c -+++ b/grub-core/fs/ext2.c -@@ -103,6 +103,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 - #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 - #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 -+#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000 - #define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000 - - /* The set of back-incompatible features this driver DOES support. Add (OR) -@@ -123,9 +124,16 @@ GRUB_MOD_LICENSE ("GPLv3+"); - * mmp: Not really back-incompatible - was added as such to - * avoid multiple read-write mounts. Safe to ignore for this - * RO driver. -+ * checksum seed: Not really back-incompatible - was added to allow tools -+ * such as tune2fs to change the UUID on a mounted metadata -+ * checksummed filesystem. Safe to ignore for now since the -+ * driver doesn't support checksum verification. But it must -+ * be removed from this list if that support is added later. -+ * - */ - #define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \ -- | EXT4_FEATURE_INCOMPAT_MMP) -+ | EXT4_FEATURE_INCOMPAT_MMP \ -+ | EXT4_FEATURE_INCOMPAT_CSUM_SEED) - - - #define EXT3_JOURNAL_MAGIC_NUMBER 0xc03b3998U diff --git a/0269-squish-give-up-on-rhgb-quiet.patch b/0179-squish-give-up-on-rhgb-quiet.patch similarity index 91% rename from 0269-squish-give-up-on-rhgb-quiet.patch rename to 0179-squish-give-up-on-rhgb-quiet.patch index 5858c917..c1cbf6da 100644 --- a/0269-squish-give-up-on-rhgb-quiet.patch +++ b/0179-squish-give-up-on-rhgb-quiet.patch @@ -9,10 +9,10 @@ Signed-off-by: Robbie Harwood 1 file changed, 4 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 41c6cb1dc2..5d1fa072f2 100644 +index 079bb9a0961..2dddc39816f 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -166,10 +166,6 @@ update_bls_cmdline() +@@ -168,10 +168,6 @@ update_bls_cmdline() # anaconda has the correct information to create this during install; # afterward, grubby will take care of syncing on updates. If the user # has modified /etc/default/grub, try to cope. diff --git a/0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch b/0180-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch similarity index 96% rename from 0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch rename to 0180-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch index d5ac923f..2c5c7c54 100644 --- a/0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +++ b/0180-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch @@ -32,10 +32,10 @@ Fixes: https://github.com/fedora-silverblue/issue-tracker/issues/322 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in -index 5d1fa072f2..4795a63b4c 100644 +index 2dddc39816f..11c19304f8b 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in -@@ -161,12 +161,13 @@ update_bls_cmdline() +@@ -163,12 +163,13 @@ update_bls_cmdline() local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" local -a files=($(get_sorted_bls)) diff --git a/0271-blscfg-Don-t-root-device-in-emu-builds.patch b/0181-blscfg-Don-t-root-device-in-emu-builds.patch similarity index 95% rename from 0271-blscfg-Don-t-root-device-in-emu-builds.patch rename to 0181-blscfg-Don-t-root-device-in-emu-builds.patch index 3fe8baf2..d61b1b23 100644 --- a/0271-blscfg-Don-t-root-device-in-emu-builds.patch +++ b/0181-blscfg-Don-t-root-device-in-emu-builds.patch @@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index e907a6a5d2..dbd0899acf 100644 +index e907a6a5d28..dbd0899acf3 100644 --- a/grub-core/commands/blscfg.c +++ b/grub-core/commands/blscfg.c @@ -41,7 +41,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0309-ppc64le-signed-boot-media-changes.patch b/0182-ppc64le-signed-boot-media-changes.patch similarity index 92% rename from 0309-ppc64le-signed-boot-media-changes.patch rename to 0182-ppc64le-signed-boot-media-changes.patch index bd714374..f92570e3 100644 --- a/0309-ppc64le-signed-boot-media-changes.patch +++ b/0182-ppc64le-signed-boot-media-changes.patch @@ -46,22 +46,20 @@ Signed-off-by: Robbie Harwood wip --- - grub-core/disk/mdraid1x_linux.c | 8 +++++++- + grub-core/disk/mdraid1x_linux.c | 6 ++++++ grub-core/disk/mdraid_linux.c | 5 +++++ grub-core/kern/ieee1275/openfw.c | 2 +- grub-core/normal/main.c | 5 +++++ - 4 files changed, 18 insertions(+), 2 deletions(-) + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/grub-core/disk/mdraid1x_linux.c b/grub-core/disk/mdraid1x_linux.c -index 38444b02c7..08c57ae16e 100644 +index 72e5cb6f481..3b5b6c42342 100644 --- a/grub-core/disk/mdraid1x_linux.c +++ b/grub-core/disk/mdraid1x_linux.c -@@ -129,7 +129,13 @@ grub_mdraid_detect (grub_disk_t disk, - grub_uint32_t level; +@@ -130,6 +130,12 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_diskfilter_vg *array; char *uuid; -- -+ + +#ifdef __powerpc__ + /* Firmware will yell at us for reading too far. */ + if (minor_version == 0) @@ -70,9 +68,9 @@ index 38444b02c7..08c57ae16e 100644 + if (size == GRUB_DISK_SIZE_UNKNOWN && minor_version == 0) continue; - + diff --git a/grub-core/disk/mdraid_linux.c b/grub-core/disk/mdraid_linux.c -index e40216f511..98fcfb1be6 100644 +index e40216f5111..98fcfb1be69 100644 --- a/grub-core/disk/mdraid_linux.c +++ b/grub-core/disk/mdraid_linux.c @@ -189,6 +189,11 @@ grub_mdraid_detect (grub_disk_t disk, @@ -88,7 +86,7 @@ index e40216f511..98fcfb1be6 100644 size = grub_disk_native_sectors (disk); if (size == GRUB_DISK_SIZE_UNKNOWN) diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c -index 3a6689abb1..0278054c61 100644 +index e2ecc65d2d8..65616254e02 100644 --- a/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c @@ -499,7 +499,7 @@ grub_ieee1275_encode_devname (const char *path) @@ -101,7 +99,7 @@ index 3a6689abb1..0278054c61 100644 unsigned int partno = grub_strtoul (partition, 0, 0); diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 8f5fd81003..d59145f861 100644 +index fc3ed551cec..e903f291732 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -372,6 +372,7 @@ grub_try_normal_prefix (const char *prefix) diff --git a/0310-core-Fix-several-implicit-function-declarations.patch b/0183-core-Fix-several-implicit-function-declarations.patch similarity index 93% rename from 0310-core-Fix-several-implicit-function-declarations.patch rename to 0183-core-Fix-several-implicit-function-declarations.patch index 48c5bb04..a8140332 100644 --- a/0310-core-Fix-several-implicit-function-declarations.patch +++ b/0183-core-Fix-several-implicit-function-declarations.patch @@ -17,7 +17,7 @@ Related to: 3 files changed, 3 insertions(+) diff --git a/grub-core/commands/efi/connectefi.c b/grub-core/commands/efi/connectefi.c -index 8ab75bd51b..3752ae17ed 100644 +index 0f840ea0575..6c397f8f508 100644 --- a/grub-core/commands/efi/connectefi.c +++ b/grub-core/commands/efi/connectefi.c @@ -21,6 +21,7 @@ @@ -29,7 +29,7 @@ index 8ab75bd51b..3752ae17ed 100644 #include #include diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 57d2721719..5f956b743e 100644 +index ce2b492c353..40df19426c8 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -26,6 +26,7 @@ @@ -41,7 +41,7 @@ index 57d2721719..5f956b743e 100644 GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c -index dac0f946fe..de3e4abe44 100644 +index 378deb321d9..e667d0a862c 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -25,6 +25,7 @@ diff --git a/0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch b/0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch deleted file mode 100644 index 265b9672..00000000 --- a/0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 6 Jul 2021 00:38:40 +0200 -Subject: [PATCH] templates: Check for EFI at runtime instead of config - generation time - -The 30_uefi-firmware template checks if an OsIndicationsSupported UEFI var -exists and EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit is set, to decide whether -a "fwsetup" menu entry would be added or not to the GRUB menu. - -But this has the problem that it will only work if the configuration file -was created on an UEFI machine that supports booting to a firmware UI. - -This for example doesn't support creating GRUB config files when executing -on systems that support both UEFI and legacy BIOS booting. Since creating -the config file from legacy BIOS wouldn't allow to access the firmware UI. - -To prevent this, make the template to unconditionally create the grub.cfg -snippet but check at runtime if was booted through UEFI to decide if this -entry should be added. That way it won't be added when booting with BIOS. - -There's no need to check if EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit is set, -since that's already done by the "fwsetup" command when is executed. - -Resolves: rhbz#1823864 - -Signed-off-by: Javier Martinez Canillas ---- - util/grub.d/30_uefi-firmware.in | 21 ++++++++------------- - 1 file changed, 8 insertions(+), 13 deletions(-) - -diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in -index d344d3883d..b6041b55e2 100644 ---- a/util/grub.d/30_uefi-firmware.in -+++ b/util/grub.d/30_uefi-firmware.in -@@ -26,19 +26,14 @@ export TEXTDOMAINDIR="@localedir@" - - . "$pkgdatadir/grub-mkconfig_lib" - --EFI_VARS_DIR=/sys/firmware/efi/efivars --EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c --OS_INDICATIONS="$EFI_VARS_DIR/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE" -+LABEL="UEFI Firmware Settings" - --if [ -e "$OS_INDICATIONS" ] && \ -- [ "$(( $(printf 0x%x \'"$(cat $OS_INDICATIONS | cut -b5)"\') & 1 ))" = 1 ]; then -- LABEL="UEFI Firmware Settings" -+gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2 - -- gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2 -- -- cat << EOF --menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { -- fwsetup --} --EOF -+cat << EOF -+if [ "\$grub_platform" = "efi" ]; then -+ menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { -+ fwsetup -+ } - fi -+EOF diff --git a/0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch b/0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch deleted file mode 100644 index 3b1a219d..00000000 --- a/0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Javier Martinez Canillas -Date: Tue, 6 Jul 2021 01:10:18 +0200 -Subject: [PATCH] efi: Print an error if boot to firmware setup is not - supported - -The "fwsetup" command is only registered if the firmware supports booting -to the firmware setup UI. But it could be possible that the GRUB config -already contains a "fwsetup" entry, because it was generated in a machine -that has support for this feature. - -To prevent users getting a "can't find command `fwsetup`" error if it is -not supported by the firmware, let's just always register the command but -print a more accurate message if the firmware doesn't support this option. - -Resolves: rhbz#1823864 - -Signed-off-by: Javier Martinez Canillas ---- - grub-core/commands/efi/efifwsetup.c | 43 ++++++++++++++++++++----------------- - 1 file changed, 23 insertions(+), 20 deletions(-) - -diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c -index eaca032838..328c45e82e 100644 ---- a/grub-core/commands/efi/efifwsetup.c -+++ b/grub-core/commands/efi/efifwsetup.c -@@ -27,6 +27,25 @@ - - GRUB_MOD_LICENSE ("GPLv3+"); - -+static grub_efi_boolean_t -+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_get_variable ("OsIndicationsSupported", &global, &oi_size, -+ (void **) &os_indications_supported); -+ -+ if (!os_indications_supported) -+ return 0; -+ -+ if (*os_indications_supported & GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI) -+ return 1; -+ -+ return 0; -+} -+ - static grub_err_t - grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)), - int argc __attribute__ ((unused)), -@@ -38,6 +57,10 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)), - grub_size_t oi_size; - grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID; - -+ if (!efifwsetup_is_supported ()) -+ return grub_error (GRUB_ERR_INVALID_COMMAND, -+ N_("Reboot to firmware setup is not supported")); -+ - grub_efi_get_variable ("OsIndications", &global, &oi_size, - (void **) &old_os_indications); - -@@ -56,28 +79,8 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)), - - static grub_command_t cmd = NULL; - --static grub_efi_boolean_t --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_get_variable ("OsIndicationsSupported", &global, &oi_size, -- (void **) &os_indications_supported); -- -- if (!os_indications_supported) -- return 0; -- -- if (*os_indications_supported & GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI) -- return 1; -- -- return 0; --} -- - GRUB_MOD_INIT (efifwsetup) - { -- if (efifwsetup_is_supported ()) - cmd = grub_register_command ("fwsetup", grub_cmd_fwsetup, NULL, - N_("Reboot into firmware setup menu.")); - diff --git a/0184-ieee1275-request-memory-with-ibm-client-architecture.patch b/0184-ieee1275-request-memory-with-ibm-client-architecture.patch new file mode 100644 index 00000000..bd598850 --- /dev/null +++ b/0184-ieee1275-request-memory-with-ibm-client-architecture.patch @@ -0,0 +1,109 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 6 Feb 2023 10:03:20 -0500 +Subject: [PATCH] ieee1275: request memory with ibm, + client-architecture-support + +On PowerVM, the first time we boot a Linux partition, we may only get +256MB of real memory area, even if the partition has more memory. + +This isn't enough to reliably verify a kernel. Fortunately, the Power +Architecture Platform Reference (PAPR) defines a method we can call to ask +for more memory: the broad and powerful ibm,client-architecture-support +(CAS) method. + +CAS can do an enormous amount of things on a PAPR platform: as well as +asking for memory, you can set the supported processor level, the interrupt +controller, hash vs radix mmu, and so on. + +If: + + - we are running under what we think is PowerVM (compatible property of / + begins with "IBM"), and + + - the full amount of RMA is less than 512MB (as determined by the reg + property of /memory) + +then call CAS as follows: (refer to the Linux on Power Architecture +Reference, LoPAR, which is public, at B.5.2.3): + + - Use the "any" PVR value and supply 2 option vectors. + + - Set option vector 1 (PowerPC Server Processor Architecture Level) + to "ignore". + + - Set option vector 2 with default or Linux-like options, including a + min-rma-size of 512MB. + + - Set option vector 3 to request Floating Point, VMX and Decimal Floating + point, but don't abort the boot if we can't get them. + + - Set option vector 4 to request a minimum VP percentage to 1%, which is + what Linux requests, and is below the default of 10%. Without this, + some systems with very large or very small configurations fail to boot. + +This will cause a CAS reboot and the partition will restart with 512MB +of RMA. Importantly, grub will notice the 512MB and not call CAS again. + +Notes about the choices of parameters: + + - A partition can be configured with only 256MB of memory, which would + mean this request couldn't be satisfied, but PFW refuses to load with + only 256MB of memory, so it's a bit moot. SLOF will run fine with 256MB, + but we will never call CAS under qemu/SLOF because /compatible won't + begin with "IBM".) + + - unspecified CAS vectors take on default values. Some of these values + might restrict the ability of certain hardware configurations to boot. + This is why we need to specify the VP percentage in vector 4, which is + in turn why we need to specify vector 3. + +Finally, we should have enough memory to verify a kernel, and we will +reach Linux. One of the first things Linux does while still running under +OpenFirmware is to call CAS with a much fuller set of options (including +asking for 512MB of memory). Linux includes a much more restrictive set of +PVR values and processor support levels, and this CAS invocation will likely +induce another reboot. On this reboot grub will again notice the higher RMA, +and not call CAS. We will get to Linux again, Linux will call CAS again, but +because the values are now set for Linux this will not induce another CAS +reboot and we will finally boot all the way to userspace. + +On all subsequent boots, everything will be configured with 512MB of RMA, +so there will be no further CAS reboots from grub. (phyp is super sticky +with the RMA size - it persists even on cold boots. So if you've ever booted +Linux in a partition, you'll probably never have grub call CAS. It'll only +ever fire the first time a partition loads grub, or if you deliberately lower +the amount of memory your partition has below 512MB.) + +Signed-off-by: Daniel Axtens +Signed-off-by: Stefan Berger +Reviewed-by: Daniel Kiper +(cherry picked from commit d5571590b7de61887efac1c298901455697ba307) +--- + grub-core/kern/ieee1275/init.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 8ce1a0f09ee..13e8a5b4bb8 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -850,6 +850,19 @@ grub_claim_heap (void) + } + #endif + ++#if defined(__powerpc__) ++ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) ++ { ++ grub_uint64_t rma_size; ++ grub_err_t err; ++ ++ err = grub_ieee1275_total_mem (&rma_size); ++ /* if we have an error, don't call CAS, just hope for the best */ ++ if (err == GRUB_ERR_NONE && rma_size < (512 * 1024 * 1024)) ++ grub_ieee1275_ibm_cas (); ++ } ++#endif ++ + grub_machine_mmap_iterate (heap_init, &total); + } + #endif diff --git a/0323-hostdisk-work-around-proc-not-reporting-size.patch b/0185-hostdisk-work-around-proc-not-reporting-size.patch similarity index 93% rename from 0323-hostdisk-work-around-proc-not-reporting-size.patch rename to 0185-hostdisk-work-around-proc-not-reporting-size.patch index 5f2fa08c..72715ae3 100644 --- a/0323-hostdisk-work-around-proc-not-reporting-size.patch +++ b/0185-hostdisk-work-around-proc-not-reporting-size.patch @@ -15,7 +15,7 @@ Signed-off-by: Robbie Harwood 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index 868ce3b63e..4ea6d1ce95 100644 +index 1794d022fb0..75510df7c92 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -172,26 +172,30 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) @@ -62,10 +62,10 @@ index 868ce3b63e..4ea6d1ce95 100644 read_hook_data = file->read_hook_data; if (!file->read_hook) diff --git a/grub-core/lib/progress.c b/grub-core/lib/progress.c -index 4b7cbbca6d..f3226b6898 100644 +index 4f4389dd586..eb1b7d13cfd 100644 --- a/grub-core/lib/progress.c +++ b/grub-core/lib/progress.c -@@ -71,7 +71,7 @@ grub_file_progress_hook_real (grub_disk_addr_t sector __attribute__ ((unused)), +@@ -72,7 +72,7 @@ grub_file_progress_hook_real (grub_disk_addr_t sector __attribute__ ((unused)), * 100ULL * 1000ULL, now - file->last_progress_time, 0); @@ -75,7 +75,7 @@ index 4b7cbbca6d..f3226b6898 100644 else percent = grub_divmod64 (100 * file->progress_offset, diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c -index 3a00d7451a..e5f4b4d5f9 100644 +index 3a00d7451a5..e5f4b4d5f9c 100644 --- a/grub-core/osdep/unix/hostdisk.c +++ b/grub-core/osdep/unix/hostdisk.c @@ -71,6 +71,12 @@ grub_util_get_fd_size (grub_util_fd_t fd, const char *name, unsigned *log_secsiz diff --git a/0324-blscfg-check-for-mounted-boot-in-emu.patch b/0186-blscfg-check-for-mounted-boot-in-emu.patch similarity index 99% rename from 0324-blscfg-check-for-mounted-boot-in-emu.patch rename to 0186-blscfg-check-for-mounted-boot-in-emu.patch index 69ebe156..54b3cf01 100644 --- a/0324-blscfg-check-for-mounted-boot-in-emu.patch +++ b/0186-blscfg-check-for-mounted-boot-in-emu.patch @@ -14,7 +14,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c -index dbd0899acf..6e398fc175 100644 +index dbd0899acf3..6e398fc1757 100644 --- a/grub-core/commands/blscfg.c +++ b/grub-core/commands/blscfg.c @@ -40,8 +40,9 @@ GRUB_MOD_LICENSE ("GPLv3+"); diff --git a/0329-grub_dl_set_mem_attrs-fix-format-string.patch b/0187-grub_dl_set_mem_attrs-fix-format-string.patch similarity index 97% rename from 0329-grub_dl_set_mem_attrs-fix-format-string.patch rename to 0187-grub_dl_set_mem_attrs-fix-format-string.patch index ee505914..646c609d 100644 --- a/0329-grub_dl_set_mem_attrs-fix-format-string.patch +++ b/0187-grub_dl_set_mem_attrs-fix-format-string.patch @@ -23,7 +23,7 @@ Signed-off-by: Laszlo Ersek 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index ab9101a5ad..a97f4a8b13 100644 +index 25666ae383f..101e0794dd8 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -733,7 +733,8 @@ grub_dl_set_mem_attrs (grub_dl_t mod, void *ehdr) diff --git a/0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch b/0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch deleted file mode 100644 index 7fc40f1f..00000000 --- a/0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Erwan Velu -Date: Wed, 25 Aug 2021 15:31:52 +0200 -Subject: [PATCH] fs/xfs: Fix unreadable filesystem with v4 superblock - -The commit 8b1e5d193 (fs/xfs: Add bigtime incompat feature support) -introduced the bigtime support by adding some features in v3 inodes. -This change extended grub_xfs_inode struct by 76 bytes but also changed -the computation of XFS_V2_INODE_SIZE and XFS_V3_INODE_SIZE. Prior this -commit, XFS_V2_INODE_SIZE was 100 bytes. After the commit it's 84 bytes -XFS_V2_INODE_SIZE becomes 16 bytes too small. - -As a result, the data structures aren't properly aligned and the GRUB -generates "attempt to read or write outside of partition" errors when -trying to read the XFS filesystem: - - GNU GRUB version 2.11 - .... - grub> set debug=efi,gpt,xfs - grub> insmod part_gpt - grub> ls (hd0,gpt1)/ - partmap/gpt.c:93: Read a valid GPT header - partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 - fs/xfs.c:931: Reading sb - fs/xfs.c:270: Validating superblock - fs/xfs.c:295: XFS v4 superblock detected - fs/xfs.c:962: Reading root ino 128 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (739521961424144223) - 344365866970255880, 3840 - error: attempt to read or write outside of partition. - -This commit change the XFS_V2_INODE_SIZE computation by subtracting 76 -bytes instead of 92 bytes from the actual size of grub_xfs_inode struct. -This 76 bytes value comes from added members: - 20 grub_uint8_t unused5 - 1 grub_uint64_t flags2 - 48 grub_uint8_t unused6 - -This patch explicitly splits the v2 and v3 parts of the structure. -The unused4 is still ending of the v2 structures and the v3 starts -at unused5. Thanks to this we will avoid future corruptions of v2 -or v3 inodes. - -The XFS_V2_INODE_SIZE is returning to its expected size and the -filesystem is back to a readable state: - - GNU GRUB version 2.11 - .... - grub> set debug=efi,gpt,xfs - grub> insmod part_gpt - grub> ls (hd0,gpt1)/ - partmap/gpt.c:93: Read a valid GPT header - partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125 - fs/xfs.c:931: Reading sb - fs/xfs.c:270: Validating superblock - fs/xfs.c:295: XFS v4 superblock detected - fs/xfs.c:962: Reading root ino 128 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:931: Reading sb - fs/xfs.c:270: Validating superblock - fs/xfs.c:295: XFS v4 superblock detected - fs/xfs.c:962: Reading root ino 128 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (128) - 64, 0 - fs/xfs.c:515: Reading inode (131) - 64, 768 - efi/ fs/xfs.c:515: Reading inode (3145856) - 1464904, 0 - grub2/ fs/xfs.c:515: Reading inode (132) - 64, 1024 - grub/ fs/xfs.c:515: Reading inode (139) - 64, 2816 - grub> - -Fixes: 8b1e5d193 (fs/xfs: Add bigtime incompat feature support) - -Signed-off-by: Erwan Velu -Tested-by: Carlos Maiolino -Reviewed-by: Daniel Kiper -(cherry picked from commit a4b495520e4dc41a896a8b916a64eda9970c50ea) ---- - grub-core/fs/xfs.c | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 0f524c3a8a..e3816d1ec4 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -192,6 +192,11 @@ struct grub_xfs_time_legacy - grub_uint32_t nanosec; - } GRUB_PACKED; - -+/* -+ * The struct grub_xfs_inode layout was taken from the -+ * struct xfs_dinode_core which is described here: -+ * https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf -+ */ - struct grub_xfs_inode - { - grub_uint8_t magic[2]; -@@ -208,14 +213,15 @@ struct grub_xfs_inode - grub_uint32_t nextents; - grub_uint16_t unused3; - grub_uint8_t fork_offset; -- grub_uint8_t unused4[37]; -+ grub_uint8_t unused4[17]; /* Last member of inode v2. */ -+ grub_uint8_t unused5[20]; /* First member of inode v3. */ - grub_uint64_t flags2; -- grub_uint8_t unused5[48]; -+ grub_uint8_t unused6[48]; /* Last member of inode v3. */ - } GRUB_PACKED; - - #define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode) --/* Size of struct grub_xfs_inode until fork_offset (included). */ --#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 92) -+/* Size of struct grub_xfs_inode v2, up to unused4 member included. */ -+#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76) - - struct grub_xfs_dirblock_tail - { diff --git a/0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch b/0188-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch similarity index 99% rename from 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch rename to 0188-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch index b95e6783..6543a9e2 100644 --- a/0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch +++ b/0188-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch @@ -110,7 +110,7 @@ Signed-off-by: Laszlo Ersek 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index a97f4a8b13..3b66fa410e 100644 +index 101e0794dd8..bad0ad4b945 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -682,7 +682,7 @@ grub_dl_set_mem_attrs (grub_dl_t mod, void *ehdr) diff --git a/0189-Print-module-name-on-license-check-failure.patch b/0189-Print-module-name-on-license-check-failure.patch deleted file mode 100644 index 5c308593..00000000 --- a/0189-Print-module-name-on-license-check-failure.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Tue, 12 Oct 2021 12:34:23 -0400 -Subject: [PATCH] Print module name on license check failure - -At the very least, this will make it easier to track down the problem -module - or, if something else has gone wrong, provide more information -for debugging. - -Signed-off-by: Robbie Harwood ---- - grub-core/kern/dl.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 9557254035..f304494574 100644 ---- a/grub-core/kern/dl.c -+++ b/grub-core/kern/dl.c -@@ -528,14 +528,16 @@ grub_dl_find_section_index (Elf_Ehdr *e, const char *name) - Be sure to understand your license obligations. - */ - static grub_err_t --grub_dl_check_license (Elf_Ehdr *e) -+grub_dl_check_license (grub_dl_t mod, Elf_Ehdr *e) - { - Elf_Shdr *s = grub_dl_find_section (e, ".module_license"); - if (s && (grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv3") == 0 - || grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv3+") == 0 - || grub_strcmp ((char *) e + s->sh_offset, "LICENSE=GPLv2+") == 0)) - return GRUB_ERR_NONE; -- return grub_error (GRUB_ERR_BAD_MODULE, "incompatible license"); -+ return grub_error (GRUB_ERR_BAD_MODULE, -+ "incompatible license in module %s: %s", mod->name, -+ (char *) e + s->sh_offset); - } - - static grub_err_t -@@ -743,8 +745,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) - constitutes linking) and GRUB core being licensed under GPLv3+. - Be sure to understand your license obligations. - */ -- if (grub_dl_check_license (e) -- || grub_dl_resolve_name (mod, e) -+ if (grub_dl_resolve_name (mod, e) -+ || grub_dl_check_license (mod, e) - || grub_dl_resolve_dependencies (mod, e) - || grub_dl_load_segments (mod, e) - || grub_dl_resolve_symbols (mod, e) diff --git a/0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch b/0189-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch similarity index 88% rename from 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch rename to 0189-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch index f29609d0..9ccf4122 100644 --- a/0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch +++ b/0189-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch @@ -16,12 +16,12 @@ Signed-off-by: Laszlo Ersek 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 3b66fa410e..f3cdb9e0ba 100644 +index bad0ad4b945..c55f0ecf931 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c -@@ -280,7 +280,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) - grub_size_t tsize = 0, talign = 1, arch_addralign = 1; - #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) +@@ -272,7 +272,9 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && \ + !defined (__loongarch__) grub_size_t tramp; + grub_size_t tramp_align; grub_size_t got; @@ -29,7 +29,7 @@ index 3b66fa410e..f3cdb9e0ba 100644 grub_err_t err; #endif char *ptr; -@@ -311,12 +313,18 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) +@@ -304,12 +306,18 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got); if (err) return err; @@ -54,10 +54,10 @@ index 3b66fa410e..f3cdb9e0ba 100644 #endif #ifdef GRUB_MACHINE_EMU -@@ -376,11 +384,11 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) - } +@@ -370,11 +378,11 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) } - #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) + #if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && \ + !defined (__loongarch__) - ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN); + ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, tramp_align); mod->tramp = ptr; diff --git a/0332-emu-Add-switch-root-to-grub-emu.patch b/0190-emu-Add-switch-root-to-grub-emu.patch similarity index 98% rename from 0332-emu-Add-switch-root-to-grub-emu.patch rename to 0190-emu-Add-switch-root-to-grub-emu.patch index 2a0f34ba..3fabaae5 100644 --- a/0332-emu-Add-switch-root-to-grub-emu.patch +++ b/0190-emu-Add-switch-root-to-grub-emu.patch @@ -17,7 +17,7 @@ Signed-off-by: Nicolas Frayer 5 files changed, 223 insertions(+), 8 deletions(-) diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 68e2b283bb..ccb2863f5b 100644 +index 38c1576a2ef..61b3181775b 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -108,6 +108,7 @@ static struct argp_option options[] = { @@ -40,7 +40,7 @@ index 68e2b283bb..ccb2863f5b 100644 { /* Too many arguments. */ diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index 02d27c3440..4b5123ef96 100644 +index d145e5796b3..7b9731b7efa 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -40,6 +40,7 @@ @@ -68,7 +68,7 @@ index 02d27c3440..4b5123ef96 100644 + return switchroot; +} diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -index 7de3f7f861..6feb0412c5 100644 +index 7de3f7f8610..6feb0412c58 100644 --- a/grub-core/loader/emu/linux.c +++ b/grub-core/loader/emu/linux.c @@ -15,7 +15,6 @@ @@ -303,7 +303,7 @@ index 7de3f7f861..6feb0412c5 100644 grub_free (initrd_param); diff --git a/include/grub/emu/exec.h b/include/grub/emu/exec.h -index 1b61b4a2e5..e82f13215e 100644 +index 1b61b4a2e5d..e82f13215e0 100644 --- a/include/grub/emu/exec.h +++ b/include/grub/emu/exec.h @@ -36,7 +36,7 @@ grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, @@ -316,7 +316,7 @@ index 1b61b4a2e5..e82f13215e 100644 int grub_util_exec_redirect_null (const char *const *argv); diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index 01056954b9..f3a712a8b2 100644 +index 01056954b96..f3a712a8b2f 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -59,6 +59,8 @@ void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format diff --git a/0191-grub-mkconfig-restore-umask-for-grub.cfg.patch b/0191-grub-mkconfig-restore-umask-for-grub.cfg.patch deleted file mode 100644 index 76b73f52..00000000 --- a/0191-grub-mkconfig-restore-umask-for-grub.cfg.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Chang via Grub-devel -Date: Fri, 3 Dec 2021 16:13:28 +0800 -Subject: [PATCH] grub-mkconfig: restore umask for grub.cfg - -Since commit: - - ab2e53c8a grub-mkconfig: Honor a symlink when generating configuration -by grub-mkconfig - -has inadvertently discarded umask for creating grub.cfg in the process -of grub-mkconfig. The resulting wrong permission (0644) would allow -unprivileged users to read grub's configuration file content. This -presents a low confidentiality risk as grub.cfg may contain non-secured -plain-text passwords. - -This patch restores the missing umask and set the file mode of creation -to 0600 preventing unprivileged access. - -Fixes: CVE-2021-3981 - -Signed-off-by: Michael Chang ---- - util/grub-mkconfig.in | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f55339a3f6..520a672cd2 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -311,7 +311,9 @@ and /etc/grub.d/* files or please file a bug report with - exit 1 - else - # none of the children aborted with error, install the new grub.cfg -+ oldumask=$(umask); umask 077 - cat ${grub_cfg}.new > ${grub_cfg} -+ umask $oldumask - rm -f ${grub_cfg}.new - fi - fi diff --git a/0333-util-Enable-default-kernel-for-updates.patch b/0191-util-Enable-default-kernel-for-updates.patch similarity index 97% rename from 0333-util-Enable-default-kernel-for-updates.patch rename to 0191-util-Enable-default-kernel-for-updates.patch index ac9ef0ba..5682df04 100644 --- a/0333-util-Enable-default-kernel-for-updates.patch +++ b/0191-util-Enable-default-kernel-for-updates.patch @@ -14,7 +14,7 @@ Signed-off-by: Marta Lewandowska 1 file changed, 8 insertions(+) diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in -index 7e87dfccc0e4..f71bc64360b0 100644 +index 7e87dfccc0e..f71bc64360b 100644 --- a/util/grub-get-kernel-settings.in +++ b/util/grub-get-kernel-settings.in @@ -68,6 +68,14 @@ if test -f /etc/sysconfig/kernel ; then diff --git a/0334-efi-http-change-uint32_t-to-uintn_t.patch b/0192-efi-http-change-uint32_t-to-uintn_t.patch similarity index 95% rename from 0334-efi-http-change-uint32_t-to-uintn_t.patch rename to 0192-efi-http-change-uint32_t-to-uintn_t.patch index f970eb15..ec22c360 100644 --- a/0334-efi-http-change-uint32_t-to-uintn_t.patch +++ b/0192-efi-http-change-uint32_t-to-uintn_t.patch @@ -13,7 +13,7 @@ Signed-off-by: Nicolas Frayer 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h -index c5e9a89f5050..ad164ba1913d 100644 +index c5e9a89f505..ad164ba1913 100644 --- a/include/grub/efi/http.h +++ b/include/grub/efi/http.h @@ -171,9 +171,9 @@ typedef struct { diff --git a/0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch b/0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch deleted file mode 100644 index 3f7198f8..00000000 --- a/0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Mon, 13 Dec 2021 14:25:49 +0800 -Subject: [PATCH] fs/btrfs: Use full btrfs bootloader area - -Up to now GRUB can only embed to the first 64 KiB before primary -superblock of btrfs, effectively limiting the GRUB core size. That -could consequently pose restrictions to feature enablement like -advanced zstd compression. - -This patch attempts to utilize full unused area reserved by btrfs for -the bootloader outlined in the document [1]: - - The first 1MiB on each device is unused with the exception of primary - superblock that is on the offset 64KiB and spans 4KiB. - -Apart from that, adjacent sectors to superblock and first block group -are not used for embedding in case of overflow and logged access to -adjacent sectors could be useful for tracing it up. - -This patch has been tested to provide out of the box support for btrfs -zstd compression with which GRUB has been installed to the partition. - -[1] https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#BOOTLOADER_SUPPORT - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper -(cherry picked from commit b0f06a81c6f31b6fa20be67a96b6683bba8210c9) ---- - grub-core/fs/btrfs.c | 90 ++++++++++++++++++++++++++++++++++++++++++++-------- - include/grub/disk.h | 2 ++ - 2 files changed, 79 insertions(+), 13 deletions(-) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 4cc86e9b79..07c0ff874b 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -2476,6 +2476,33 @@ grub_btrfs_label (grub_device_t device, char **label) - } - - #ifdef GRUB_UTIL -+ -+struct embed_region { -+ unsigned int start; -+ unsigned int secs; -+}; -+ -+/* -+ * https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#BOOTLOADER_SUPPORT -+ * The first 1 MiB on each device is unused with the exception of primary -+ * superblock that is on the offset 64 KiB and spans 4 KiB. -+ */ -+ -+static const struct { -+ struct embed_region available; -+ struct embed_region used[6]; -+} btrfs_head = { -+ .available = {0, GRUB_DISK_KiB_TO_SECTORS (1024)}, /* The first 1 MiB. */ -+ .used = { -+ {0, 1}, /* boot.S. */ -+ {GRUB_DISK_KiB_TO_SECTORS (64) - 1, 1}, /* Overflow guard. */ -+ {GRUB_DISK_KiB_TO_SECTORS (64), GRUB_DISK_KiB_TO_SECTORS (4)}, /* 4 KiB superblock. */ -+ {GRUB_DISK_KiB_TO_SECTORS (68), 1}, /* Overflow guard. */ -+ {GRUB_DISK_KiB_TO_SECTORS (1024) - 1, 1}, /* Overflow guard. */ -+ {0, 0} /* Array terminator. */ -+ } -+}; -+ - static grub_err_t - grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), - unsigned int *nsectors, -@@ -2483,25 +2510,62 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)), - grub_embed_type_t embed_type, - grub_disk_addr_t **sectors) - { -- unsigned i; -+ unsigned int i, j, n = 0; -+ const struct embed_region *u; -+ grub_disk_addr_t *map; - - if (embed_type != GRUB_EMBED_PCBIOS) - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - "BtrFS currently supports only PC-BIOS embedding"); - -- if (64 * 2 - 1 < *nsectors) -- return grub_error (GRUB_ERR_OUT_OF_RANGE, -- N_("your core.img is unusually large. " -- "It won't fit in the embedding area")); -- -- *nsectors = 64 * 2 - 1; -- if (*nsectors > max_nsectors) -- *nsectors = max_nsectors; -- *sectors = grub_calloc (*nsectors, sizeof (**sectors)); -- if (!*sectors) -+ map = grub_calloc (btrfs_head.available.secs, sizeof (*map)); -+ if (map == NULL) - return grub_errno; -- for (i = 0; i < *nsectors; i++) -- (*sectors)[i] = i + 1; -+ -+ /* -+ * Populating the map array so that it can be used to index if a disk -+ * address is available to embed: -+ * - 0: available, -+ * - 1: unavailable. -+ */ -+ for (u = btrfs_head.used; u->secs; ++u) -+ { -+ unsigned int end = u->start + u->secs; -+ -+ if (end > btrfs_head.available.secs) -+ end = btrfs_head.available.secs; -+ for (i = u->start; i < end; ++i) -+ map[i] = 1; -+ } -+ -+ /* Adding up n until it matches total size of available embedding area. */ -+ for (i = 0; i < btrfs_head.available.secs; ++i) -+ if (map[i] == 0) -+ n++; -+ -+ if (n < *nsectors) -+ { -+ grub_free (map); -+ return grub_error (GRUB_ERR_OUT_OF_RANGE, -+ N_("your core.img is unusually large. " -+ "It won't fit in the embedding area")); -+ } -+ -+ if (n > max_nsectors) -+ n = max_nsectors; -+ -+ /* -+ * Populating the array so that it can used to index disk block address for -+ * an image file's offset to be embedded on disk (the unit is in sectors): -+ * - i: The disk block address relative to btrfs_head.available.start, -+ * - j: The offset in image file. -+ */ -+ for (i = 0, j = 0; i < btrfs_head.available.secs && j < n; ++i) -+ if (map[i] == 0) -+ map[j++] = btrfs_head.available.start + i; -+ -+ *nsectors = n; -+ *sectors = map; - - return GRUB_ERR_NONE; - } -diff --git a/include/grub/disk.h b/include/grub/disk.h -index f95aca929a..06210a7049 100644 ---- a/include/grub/disk.h -+++ b/include/grub/disk.h -@@ -182,6 +182,8 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t; - /* Return value of grub_disk_native_sectors() in case disk size is unknown. */ - #define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL - -+#define GRUB_DISK_KiB_TO_SECTORS(x) ((x) << (10 - GRUB_DISK_SECTOR_BITS)) -+ - /* Convert sector number from one sector size to another. */ - static inline grub_disk_addr_t - grub_convert_sector (grub_disk_addr_t sector, diff --git a/0193-Add-Fedora-location-of-DejaVu-SANS-font.patch b/0193-Add-Fedora-location-of-DejaVu-SANS-font.patch deleted file mode 100644 index 070fc24a..00000000 --- a/0193-Add-Fedora-location-of-DejaVu-SANS-font.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: fluteze -Date: Sat, 27 Nov 2021 10:54:44 -0600 -Subject: [PATCH] Add Fedora location of DejaVu SANS font - -In Fedora 35, and possibly earlier, grub would fail to configure with a -complaint about DejaVu being "not found" even though it was installed. -The DejaVu sans font search path is updated to reflect the -distribution's current install path. - -Signed-off-by: Erik Edwards -[rharwood@redhat.com: slight commit message edits] -Signed-off-by: Robbie Harwood ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index ab0d326f00..40c4338bce 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1784,7 +1784,7 @@ fi - - if test x"$starfield_excuse" = x; then - for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do -- for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do -+ for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype /usr/share/fonts/dejavu-sans-fonts; do - if test -f "$dir/DejaVuSans.$ext"; then - DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" - break 2 diff --git a/0335-Add-Install-section-to-aux-systemd-units.patch b/0193-Add-Install-section-to-aux-systemd-units.patch similarity index 93% rename from 0335-Add-Install-section-to-aux-systemd-units.patch rename to 0193-Add-Install-section-to-aux-systemd-units.patch index c7268501..69812255 100644 --- a/0335-Add-Install-section-to-aux-systemd-units.patch +++ b/0193-Add-Install-section-to-aux-systemd-units.patch @@ -18,7 +18,7 @@ via presets or manually instead. 3 files changed, 9 insertions(+) diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service -index 6c8dcb186b63..5bcb474a3d31 100644 +index 6c8dcb186b6..5bcb474a3d3 100644 --- a/docs/grub-boot-indeterminate.service +++ b/docs/grub-boot-indeterminate.service @@ -9,3 +9,6 @@ Before=system-update-pre.target @@ -29,7 +29,7 @@ index 6c8dcb186b63..5bcb474a3d31 100644 +[Install] +WantedBy=system-update.target diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer -index 406f17200560..1d124cccc146 100644 +index 406f1720056..1d124cccc14 100644 --- a/docs/grub-boot-success.timer +++ b/docs/grub-boot-success.timer @@ -5,3 +5,6 @@ ConditionVirtualization=!container @@ -40,7 +40,7 @@ index 406f17200560..1d124cccc146 100644 +[Install] +WantedBy=timers.target diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in -index c81fb594ce17..22ca1ca4885e 100644 +index c81fb594ce1..22ca1ca4885 100644 --- a/util/systemd/grub-systemd-integration.service.in +++ b/util/systemd/grub-systemd-integration.service.in @@ -6,3 +6,6 @@ ConditionPathExists=/run/systemd/reboot-to-boot-loader-menu diff --git a/0337-Fix-missing-include-in-ofdisk.c.patch b/0194-Fix-missing-include-in-ofdisk.c.patch similarity index 95% rename from 0337-Fix-missing-include-in-ofdisk.c.patch rename to 0194-Fix-missing-include-in-ofdisk.c.patch index 84a12405..a2b90476 100644 --- a/0337-Fix-missing-include-in-ofdisk.c.patch +++ b/0194-Fix-missing-include-in-ofdisk.c.patch @@ -15,7 +15,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c -index 5534684..6e33d5d 100644 +index b413822bb87..57624fde55c 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -24,6 +24,7 @@ diff --git a/0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch b/0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch deleted file mode 100644 index 200cd51a..00000000 --- a/0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 28 Jan 2022 11:30:32 +0100 -Subject: [PATCH] normal/menu: Don't show "Booting `%s'" msg when auto-booting - with TIMEOUT_STYLE_HIDDEN - -When the user has asked the menu code to be hidden/quiet and the current -entry is being autobooted because the timeout has expired don't show -the "Booting `%s'" msg. - -This is necessary to let flicker-free boots really be flicker free, -otherwise the "Booting `%s'" msg will kick the EFI fb into text mode -and show the msg, breaking the flicker-free experience. - -Signed-off-by: Hans de Goede ---- - grub-core/normal/menu.c | 24 ++++++++++++++++-------- - 1 file changed, 16 insertions(+), 8 deletions(-) - -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index ec0c92bade..c8516a5a08 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -606,13 +606,15 @@ print_countdown (struct grub_term_coordinate *pos, int n) - entry to be executed is a result of an automatic default selection because - of the timeout. */ - static int --run_menu (grub_menu_t menu, int nested, int *auto_boot) -+run_menu (grub_menu_t menu, int nested, int *auto_boot, int *notify_boot) - { - grub_uint64_t saved_time; - int default_entry, current_entry; - int timeout; - enum timeout_style timeout_style; - -+ *notify_boot = 1; -+ - default_entry = get_entry_number (menu, "default"); - - /* If DEFAULT_ENTRY is not within the menu entries, fall back to -@@ -687,6 +689,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) - if (timeout == 0) - { - *auto_boot = 1; -+ *notify_boot = timeout_style != TIMEOUT_STYLE_HIDDEN; - return default_entry; - } - -@@ -840,12 +843,16 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) - - /* Callback invoked immediately before a menu entry is executed. */ - static void --notify_booting (grub_menu_entry_t entry, -- void *userdata __attribute__((unused))) -+notify_booting (grub_menu_entry_t entry, void *userdata) - { -- grub_printf (" "); -- grub_printf_ (N_("Booting `%s'"), entry->title); -- grub_printf ("\n\n"); -+ int *notify_boot = userdata; -+ -+ if (*notify_boot) -+ { -+ grub_printf (" "); -+ grub_printf_ (N_("Booting `%s'"), entry->title); -+ grub_printf ("\n\n"); -+ } - } - - /* Callback invoked when a default menu entry executed because of a timeout -@@ -893,8 +900,9 @@ show_menu (grub_menu_t menu, int nested, int autobooted) - int boot_entry; - grub_menu_entry_t e; - int auto_boot; -+ int notify_boot; - -- boot_entry = run_menu (menu, nested, &auto_boot); -+ boot_entry = run_menu (menu, nested, &auto_boot, ¬ify_boot); - if (boot_entry < 0) - break; - -@@ -906,7 +914,7 @@ show_menu (grub_menu_t menu, int nested, int autobooted) - - if (auto_boot) - grub_menu_execute_with_fallback (menu, e, autobooted, -- &execution_callback, 0); -+ &execution_callback, ¬ify_boot); - else - grub_menu_execute_entry (e, 0); - if (autobooted) diff --git a/0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch b/0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch deleted file mode 100644 index 0f99c229..00000000 --- a/0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 28 Jan 2022 11:30:33 +0100 -Subject: [PATCH] EFI: suppress the "Welcome to GRUB!" message in EFI builds - -Grub EFI builds are now often used in combination with flicker-free -boot, but this breaks with upstream grub because the "Welcome to GRUB!" -message will kick the EFI fb into text mode and show the msg, -breaking the flicker-free experience. - -EFI systems are so fast, that when the menu or the countdown are enabled -the message will be immediately overwritten, so in these cases not -printing the message does not matter. - -And in case when the timeout_style is set to TIMEOUT_STYLE_HIDDEN, -the user has asked grub to be quiet (for example to allow flickfree -boot) annd thus the message should not be printed. - -Signed-off-by: Hans de Goede ---- - grub-core/kern/main.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 3fc3401472..993b8a8598 100644 ---- a/grub-core/kern/main.c -+++ b/grub-core/kern/main.c -@@ -317,10 +317,13 @@ grub_main (void) - - grub_boot_time ("After machine init."); - -+ /* This breaks flicker-free boot on EFI systems, so disable it there. */ -+#ifndef GRUB_MACHINE_EFI - /* Hello. */ - grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); - grub_printf ("Welcome to GRUB!\n\n"); - grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); -+#endif - - /* Init verifiers API. */ - grub_verifiers_init (); diff --git a/0348-add-flag-to-only-search-root-dev.patch b/0195-add-flag-to-only-search-root-dev.patch similarity index 88% rename from 0348-add-flag-to-only-search-root-dev.patch rename to 0195-add-flag-to-only-search-root-dev.patch index 8ae8875a..9061f39b 100644 --- a/0348-add-flag-to-only-search-root-dev.patch +++ b/0195-add-flag-to-only-search-root-dev.patch @@ -15,10 +15,10 @@ Signed-off-by: Marta Lewandowska 5 files changed, 74 insertions(+), 1 deletion(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index 57d26ced8a8e..819231751c38 100644 +index 263f1501cdf..db8692ffbfb 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c -@@ -85,6 +85,42 @@ iterate_device (const char *name, void *data) +@@ -86,6 +86,42 @@ iterate_device (const char *name, void *data) grub_device_close (dev); } @@ -62,7 +62,7 @@ index 57d26ced8a8e..819231751c38 100644 #define compare_fn grub_strcasecmp #else diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c -index 0b62acf85359..06b5f51eefb5 100644 +index 318581f3b1e..4fe6440c65b 100644 --- a/grub-core/commands/search_wrap.c +++ b/grub-core/commands/search_wrap.c @@ -41,6 +41,7 @@ static const struct grub_arg_option options[] = @@ -92,10 +92,10 @@ index 0b62acf85359..06b5f51eefb5 100644 grub_search_label (id, var, flags, hints, nhints); else if (state[SEARCH_FS_UUID].set) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index cb454614022f..c0ac7fee6cc2 100644 +index f607244e7ae..96ab7c96b52 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -619,6 +619,36 @@ grub_reverse (char *str) +@@ -645,6 +645,36 @@ grub_reverse (char *str) } } @@ -133,24 +133,24 @@ index cb454614022f..c0ac7fee6cc2 100644 grub_uint64_t grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) diff --git a/include/grub/misc.h b/include/grub/misc.h -index faae0ae8606c..981526644d29 100644 +index c3c735371dc..3e9a00f0a9c 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h -@@ -314,6 +314,7 @@ void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); +@@ -343,6 +343,7 @@ char *EXPORT_FUNC(grub_strdup) (const char *s) WARN_UNUSED_RESULT; + char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n) WARN_UNUSED_RESULT; + void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) WARN_UNUSED_RESULT; - int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); - int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); +void EXPORT_FUNC(grub_str_sep) (const char *s, char *p, char delim, char *r); /* Replace all `ch' characters of `input' with `with' and copy the result into `output'; return EOS address of `output'. */ diff --git a/include/grub/search.h b/include/grub/search.h -index 4190aeb2cbf5..321d1400e451 100644 +index ffd2411ca1a..9343c66b134 100644 --- a/include/grub/search.h +++ b/include/grub/search.h -@@ -22,7 +22,8 @@ - enum search_flags +@@ -23,7 +23,8 @@ enum search_flags { + SEARCH_FLAGS_NONE = 0, SEARCH_FLAGS_NO_FLOPPY = 1, - SEARCH_FLAGS_EFIDISK_ONLY = 2 + SEARCH_FLAGS_EFIDISK_ONLY = 2, diff --git a/0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch b/0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch deleted file mode 100644 index ade6aae0..00000000 --- a/0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 28 Jan 2022 12:43:48 +0100 -Subject: [PATCH] EFI: console: Do not set colorstate until the first text - output - -GRUB_MOD_INIT(normal) does an unconditional: - -grub_env_set ("color_normal", "light-gray/black"); - -which triggers a grub_term_setcolorstate() call. The original version -of the "efi/console: Do not set text-mode until we actually need it" patch: -https://lists.gnu.org/archive/html/grub-devel/2018-03/msg00125.html - -Protected against this by caching the requested state in -grub_console_setcolorstate () and then only applying it when the first -text output actually happens. During refactoring to move the -grub_console_setcolorstate () up higher in the grub-core/term/efi/console.c -file the code to cache the color-state + bail early was accidentally -dropped. - -Restore the cache the color-state + bail early behavior from the original. - -Cc: Javier Martinez Canillas -Fixes: 2d7c3abd871f ("efi/console: Do not set text-mode until we actually need it") -Signed-off-by: Hans de Goede ---- - grub-core/term/efi/console.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index 2f1ae85ba7..c44b2ac318 100644 ---- a/grub-core/term/efi/console.c -+++ b/grub-core/term/efi/console.c -@@ -82,6 +82,16 @@ grub_console_setcolorstate (struct grub_term_output *term - { - grub_efi_simple_text_output_interface_t *o; - -+ if (grub_efi_is_finished || text_mode != GRUB_TEXT_MODE_AVAILABLE) -+ { -+ /* -+ * Cache colorstate changes before the first text-output, this avoids -+ * "color_normal" environment writes causing a switch to textmode. -+ */ -+ text_colorstate = state; -+ return; -+ } -+ - if (grub_efi_is_finished) - return; - diff --git a/0196-cryptdisk-fix-incorrect-sign-comparison.patch b/0196-cryptdisk-fix-incorrect-sign-comparison.patch new file mode 100644 index 00000000..dbb4fc2e --- /dev/null +++ b/0196-cryptdisk-fix-incorrect-sign-comparison.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Jan 2024 15:44:27 -0500 +Subject: [PATCH] cryptdisk: fix incorrect sign comparison + +grub_util_get_fd_size() returns a signed integer, but we're assigning it +to an unsigned integer and then testing against -1. That's wrong. + +This patch makes the variable a signed integer. + +Signed-off-by: Peter Jones +--- + grub-core/disk/cryptodisk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c +index 2246af51b6a..98e176a139c 100644 +--- a/grub-core/disk/cryptodisk.c ++++ b/grub-core/disk/cryptodisk.c +@@ -721,7 +721,7 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk) + #ifdef GRUB_UTIL + if (dev->cheat) + { +- grub_uint64_t cheat_dev_size; ++ grub_int64_t cheat_dev_size; + unsigned int cheat_log_sector_size; + + if (!GRUB_UTIL_FD_IS_VALID (dev->cheat_fd)) diff --git a/0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch b/0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch deleted file mode 100644 index 5fab5db8..00000000 --- a/0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 28 Jan 2022 12:43:49 +0100 -Subject: [PATCH] EFI: console: Do not set cursor until the first text output - -To allow flickerfree boot the EFI console code does not call -grub_efi_set_text_mode (1) until some text is actually output. - -Depending on if the output text is because of an error loading -e.g. the .cfg file; or because of showing the menu the cursor needs -to be on or off when the first text is shown. - -So far the cursor was hardcoded to being on, but this is causing -drawing artifacts + slow drawing of the menu as reported here: -https://bugzilla.redhat.com/show_bug.cgi?id=1946969 - -Handle the cursorstate in the same way as the colorstate to fix this, -when no text has been output yet, just cache the cursorstate and -then use the last set value when the first text is output. - -Fixes: 2d7c3abd871f ("efi/console: Do not set text-mode until we actually need it") -Signed-off-by: Hans de Goede ---- - grub-core/term/efi/console.c | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) - -diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c -index c44b2ac318..a3622e4fe5 100644 ---- a/grub-core/term/efi/console.c -+++ b/grub-core/term/efi/console.c -@@ -31,7 +31,15 @@ typedef enum { - } - grub_text_mode; - -+typedef enum { -+ GRUB_CURSOR_MODE_UNDEFINED = -1, -+ GRUB_CURSOR_MODE_OFF = 0, -+ GRUB_CURSUR_MODE_ON -+} -+grub_cursor_mode; -+ - static grub_text_mode text_mode = GRUB_TEXT_MODE_UNDEFINED; -+static grub_cursor_mode cursor_mode = GRUB_CURSOR_MODE_UNDEFINED; - static grub_term_color_state text_colorstate = GRUB_TERM_COLOR_UNDEFINED; - - static grub_uint32_t -@@ -119,8 +127,12 @@ grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)), - { - grub_efi_simple_text_output_interface_t *o; - -- if (grub_efi_is_finished) -- return; -+ if (grub_efi_is_finished || text_mode != GRUB_TEXT_MODE_AVAILABLE) -+ { -+ /* Cache cursor changes before the first text-output */ -+ cursor_mode = on; -+ return; -+ } - - o = grub_efi_system_table->con_out; - efi_call_2 (o->enable_cursor, o, on); -@@ -143,7 +155,8 @@ grub_prepare_for_text_output (struct grub_term_output *term) - return GRUB_ERR_BAD_DEVICE; - } - -- grub_console_setcursor (term, 1); -+ if (cursor_mode != GRUB_CURSOR_MODE_UNDEFINED) -+ grub_console_setcursor (term, cursor_mode); - if (text_colorstate != GRUB_TERM_COLOR_UNDEFINED) - grub_console_setcolorstate (term, text_colorstate); - text_mode = GRUB_TEXT_MODE_AVAILABLE; diff --git a/0197-grub-install-fix-a-sign-comparison-error.patch b/0197-grub-install-fix-a-sign-comparison-error.patch new file mode 100644 index 00000000..7b63b082 --- /dev/null +++ b/0197-grub-install-fix-a-sign-comparison-error.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Jan 2024 15:45:57 -0500 +Subject: [PATCH] grub-install: fix a sign comparison error + +This is a trivial sign comparison fix. + +Signed-off-by: Peter Jones +--- + util/grub-install-common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub-install-common.c b/util/grub-install-common.c +index b58539111da..67afc2eedf4 100644 +--- a/util/grub-install-common.c ++++ b/util/grub-install-common.c +@@ -368,7 +368,7 @@ char *grub_install_themes_directory = NULL; + int + grub_install_is_short_mbrgap_supported (void) + { +- int i, j; ++ unsigned int i, j; + static const char *whitelist[] = + { + "part_msdos", "biosdisk", "affs", "afs", "bfs", "archelp", diff --git a/0198-Use-visual-indentation-in-config.h.in.patch b/0198-Use-visual-indentation-in-config.h.in.patch deleted file mode 100644 index 978eb078..00000000 --- a/0198-Use-visual-indentation-in-config.h.in.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Wed, 15 Dec 2021 15:46:13 -0500 -Subject: [PATCH] Use visual indentation in config.h.in - -Signed-off-by: Robbie Harwood -(cherry picked from commit de8051f34de0aa55c921a510974e5bb27e39c17b) -[rharwood: GRUB_RPM_CONFIG presence] ---- - config.h.in | 58 +++++++++++++++++++++++++++++----------------------------- - 1 file changed, 29 insertions(+), 29 deletions(-) - -diff --git a/config.h.in b/config.h.in -index c80e3e0aba..f2ed0066ec 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -23,47 +23,47 @@ - #define MINILZO_CFG_SKIP_LZO1X_DECOMPRESS 1 - - #if defined (GRUB_BUILD) --#undef ENABLE_NLS --#define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@ --#define BUILD_SIZEOF_VOID_P @BUILD_SIZEOF_VOID_P@ --#if defined __APPLE__ --# if defined __BIG_ENDIAN__ --# define BUILD_WORDS_BIGENDIAN 1 --# else --# define BUILD_WORDS_BIGENDIAN 0 --# endif --#else --#define BUILD_WORDS_BIGENDIAN @BUILD_WORDS_BIGENDIAN@ --#endif -+# undef ENABLE_NLS -+# define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@ -+# define BUILD_SIZEOF_VOID_P @BUILD_SIZEOF_VOID_P@ -+# if defined __APPLE__ -+# if defined __BIG_ENDIAN__ -+# define BUILD_WORDS_BIGENDIAN 1 -+# else -+# define BUILD_WORDS_BIGENDIAN 0 -+# endif -+# else /* !defined __APPLE__ */ -+# define BUILD_WORDS_BIGENDIAN @BUILD_WORDS_BIGENDIAN@ -+# endif /* !defined __APPLE__ */ - #elif defined (GRUB_UTIL) || !defined (GRUB_MACHINE) --#include --#else --#define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@ -+# include -+#else /* !defined GRUB_UTIL && defined GRUB_MACHINE */ -+# define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@ - /* Define if C symbols get an underscore after compilation. */ --#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@ -+# define HAVE_ASM_USCORE @HAVE_ASM_USCORE@ - /* Define it to one of __bss_start, edata and _edata. */ --#define BSS_START_SYMBOL @BSS_START_SYMBOL@ -+# define BSS_START_SYMBOL @BSS_START_SYMBOL@ - /* Define it to either end or _end. */ --#define END_SYMBOL @END_SYMBOL@ -+# define END_SYMBOL @END_SYMBOL@ - /* Name of package. */ --#define PACKAGE "@PACKAGE@" -+# define PACKAGE "@PACKAGE@" - /* Version number of package. */ --#define VERSION "@VERSION@" -+# define VERSION "@VERSION@" - /* Define to the full name and version of this package. */ --#define PACKAGE_STRING "@PACKAGE_STRING@" -+# define PACKAGE_STRING "@PACKAGE_STRING@" - /* Define to the version of this package. */ --#define PACKAGE_VERSION "@PACKAGE_VERSION@" -+# define PACKAGE_VERSION "@PACKAGE_VERSION@" - /* Define to the full name of this package. */ --#define PACKAGE_NAME "@PACKAGE_NAME@" -+# define PACKAGE_NAME "@PACKAGE_NAME@" - /* Define to the address where bug reports for this package should be sent. */ --#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" -+# define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" - --#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@" --#define GRUB_PLATFORM "@GRUB_PLATFORM@" --#define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@" -+# define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@" -+# define GRUB_PLATFORM "@GRUB_PLATFORM@" -+# define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@" - --#define RE_ENABLE_I18N 1 -+# define RE_ENABLE_I18N 1 - --#define _GNU_SOURCE 1 -+# define _GNU_SOURCE 1 - - #endif diff --git a/0198-grub-mount-work-around-bad-integer-comparison.patch b/0198-grub-mount-work-around-bad-integer-comparison.patch new file mode 100644 index 00000000..d303801a --- /dev/null +++ b/0198-grub-mount-work-around-bad-integer-comparison.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Jan 2024 15:54:31 -0500 +Subject: [PATCH] grub-mount: work around bad integer comparison. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +gcc says: + + util/grub-mount.c: In function ‘fuse_read’: + util/grub-mount.c:273:11: error: comparison of integer expressions of different signedness: ‘off_t’ {aka ‘long int’} and ‘grub_off_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] + 273 | if (off > file->size) + | ^ + +This is happening because grub_off_t is unsigned but the system's off_t is +signed. + +That's too much work to fix today, so this patch works around it with +tests and typecasting. + +Signed-off-by: Peter Jones +--- + util/grub-mount.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/util/grub-mount.c b/util/grub-mount.c +index bf4c8b891be..d369e21666e 100644 +--- a/util/grub-mount.c ++++ b/util/grub-mount.c +@@ -269,11 +269,17 @@ fuse_read (const char *path, char *buf, size_t sz, off_t off, + { + grub_file_t file = files[fi->fh]; + grub_ssize_t size; ++ grub_off_t offset; + +- if (off > file->size) ++ if (off < 0) + return -EINVAL; + +- file->offset = off; ++ if ((grub_off_t)off > file->size) ++ return -EINVAL; ++ ++ offset = (grub_off_t)off; ++ ++ file->offset = offset; + + size = grub_file_read (file, buf, sz); + if (size < 0) diff --git a/0199-Where-present-ensure-config-util.h-precedes-config.h.patch b/0199-Where-present-ensure-config-util.h-precedes-config.h.patch deleted file mode 100644 index 22c2d9c3..00000000 --- a/0199-Where-present-ensure-config-util.h-precedes-config.h.patch +++ /dev/null @@ -1,275 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Tue, 22 Feb 2022 16:57:54 -0500 -Subject: [PATCH] Where present, ensure config-util.h precedes config.h - -gnulib defines go in config-util.h, and we need to know whether to -provide duplicates in config.h or not. - -Signed-off-by: Robbie Harwood -(cherry picked from commit 46e82b28e1a75703d0424c7e13d009171310c6cd) -[rharwood: gensymlist isn't part of tarballs] ---- - grub-core/disk/host.c | 2 +- - grub-core/kern/emu/argp_common.c | 2 +- - grub-core/kern/emu/main.c | 2 +- - grub-core/osdep/aros/config.c | 2 +- - grub-core/osdep/basic/emunet.c | 2 +- - grub-core/osdep/basic/init.c | 2 +- - grub-core/osdep/haiku/getroot.c | 2 +- - grub-core/osdep/linux/emunet.c | 2 +- - grub-core/osdep/unix/config.c | 2 +- - grub-core/osdep/unix/cputime.c | 2 +- - grub-core/osdep/unix/dl.c | 2 +- - grub-core/osdep/unix/emuconsole.c | 2 +- - grub-core/osdep/unix/getroot.c | 2 +- - grub-core/osdep/windows/config.c | 2 +- - grub-core/osdep/windows/cputime.c | 2 +- - grub-core/osdep/windows/dl.c | 2 +- - grub-core/osdep/windows/emuconsole.c | 2 +- - grub-core/osdep/windows/init.c | 2 +- - 18 files changed, 18 insertions(+), 18 deletions(-) - -diff --git a/grub-core/disk/host.c b/grub-core/disk/host.c -index c151d225df..f34529f86a 100644 ---- a/grub-core/disk/host.c -+++ b/grub-core/disk/host.c -@@ -20,8 +20,8 @@ - /* When using the disk, make a reference to this module. Otherwise - the user will end up with a useless module :-). */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/kern/emu/argp_common.c b/grub-core/kern/emu/argp_common.c -index 1668858703..8cb4608c3d 100644 ---- a/grub-core/kern/emu/argp_common.c -+++ b/grub-core/kern/emu/argp_common.c -@@ -17,8 +17,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #pragma GCC diagnostic ignored "-Wmissing-prototypes" - #pragma GCC diagnostic ignored "-Wmissing-declarations" -diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 55ea5a11cc..12277c34d2 100644 ---- a/grub-core/kern/emu/main.c -+++ b/grub-core/kern/emu/main.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/aros/config.c b/grub-core/osdep/aros/config.c -index c82d0ea8e7..55f5728efc 100644 ---- a/grub-core/osdep/aros/config.c -+++ b/grub-core/osdep/aros/config.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/basic/emunet.c b/grub-core/osdep/basic/emunet.c -index 6362e5cfbb..dbfd316d61 100644 ---- a/grub-core/osdep/basic/emunet.c -+++ b/grub-core/osdep/basic/emunet.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/basic/init.c b/grub-core/osdep/basic/init.c -index c54c710dbc..b104c7e162 100644 ---- a/grub-core/osdep/basic/init.c -+++ b/grub-core/osdep/basic/init.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/haiku/getroot.c b/grub-core/osdep/haiku/getroot.c -index 4e123c0903..927a1ebc94 100644 ---- a/grub-core/osdep/haiku/getroot.c -+++ b/grub-core/osdep/haiku/getroot.c -@@ -1,5 +1,5 @@ --#include - #include -+#include - #include - #include - #include -diff --git a/grub-core/osdep/linux/emunet.c b/grub-core/osdep/linux/emunet.c -index 19b188f09e..d5a6417355 100644 ---- a/grub-core/osdep/linux/emunet.c -+++ b/grub-core/osdep/linux/emunet.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c -index 46a881530c..0ce0e309ac 100644 ---- a/grub-core/osdep/unix/config.c -+++ b/grub-core/osdep/unix/config.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/unix/cputime.c b/grub-core/osdep/unix/cputime.c -index cff359a3b9..fb6ff55a1a 100644 ---- a/grub-core/osdep/unix/cputime.c -+++ b/grub-core/osdep/unix/cputime.c -@@ -1,5 +1,5 @@ --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/unix/dl.c b/grub-core/osdep/unix/dl.c -index 562b101a28..99b189bc1c 100644 ---- a/grub-core/osdep/unix/dl.c -+++ b/grub-core/osdep/unix/dl.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/unix/emuconsole.c b/grub-core/osdep/unix/emuconsole.c -index 7308798efe..cac159424d 100644 ---- a/grub-core/osdep/unix/emuconsole.c -+++ b/grub-core/osdep/unix/emuconsole.c -@@ -17,8 +17,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c -index 46d7116c6e..4f436284ce 100644 ---- a/grub-core/osdep/unix/getroot.c -+++ b/grub-core/osdep/unix/getroot.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/windows/config.c b/grub-core/osdep/windows/config.c -index 928ab1a49b..2bb8a2fd88 100644 ---- a/grub-core/osdep/windows/config.c -+++ b/grub-core/osdep/windows/config.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/windows/cputime.c b/grub-core/osdep/windows/cputime.c -index 3568aa2d35..5d06d79dd5 100644 ---- a/grub-core/osdep/windows/cputime.c -+++ b/grub-core/osdep/windows/cputime.c -@@ -1,5 +1,5 @@ --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/windows/dl.c b/grub-core/osdep/windows/dl.c -index eec6a24ad7..8eab7057e4 100644 ---- a/grub-core/osdep/windows/dl.c -+++ b/grub-core/osdep/windows/dl.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/windows/emuconsole.c b/grub-core/osdep/windows/emuconsole.c -index 4fb3693cc0..17a44de469 100644 ---- a/grub-core/osdep/windows/emuconsole.c -+++ b/grub-core/osdep/windows/emuconsole.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - - #include - #include -diff --git a/grub-core/osdep/windows/init.c b/grub-core/osdep/windows/init.c -index 6297de6326..51a9647dde 100644 ---- a/grub-core/osdep/windows/init.c -+++ b/grub-core/osdep/windows/init.c -@@ -16,8 +16,8 @@ - * along with GRUB. If not, see . - */ - --#include - #include -+#include - #include - #include - #include diff --git a/0199-power-Fix-use-after-free-in-get_slave_from_dm.patch b/0199-power-Fix-use-after-free-in-get_slave_from_dm.patch new file mode 100644 index 00000000..b4520e7d --- /dev/null +++ b/0199-power-Fix-use-after-free-in-get_slave_from_dm.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Jan 2024 16:03:54 -0500 +Subject: [PATCH] power: Fix use after free in get_slave_from_dm() + +Signed-off-by: Peter Jones +--- + grub-core/osdep/linux/ofpath.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c +index cc849d9c94c..72772c87a66 100644 +--- a/grub-core/osdep/linux/ofpath.c ++++ b/grub-core/osdep/linux/ofpath.c +@@ -775,6 +775,8 @@ get_slave_from_dm(const char * device){ + + device_path = grub_xasprintf ("/sys/block/%s/slaves", curr_device); + dp = opendir(device_path); ++ if (dp == NULL) ++ grub_util_warn (_("cannot open directory `%s'"), device_path); + free(device_path); + + if (dp != NULL) +@@ -800,8 +802,6 @@ get_slave_from_dm(const char * device){ + } + closedir (dp); + } +- else +- grub_util_warn (_("cannot open directory `%s'"), device_path); + } + + free (directory); diff --git a/0200-Drop-gnulib-fix-base64.patch.patch b/0200-Drop-gnulib-fix-base64.patch.patch deleted file mode 100644 index 054e476e..00000000 --- a/0200-Drop-gnulib-fix-base64.patch.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Thu, 28 Oct 2021 15:07:50 -0400 -Subject: [PATCH] Drop gnulib fix-base64.patch - -Originally added in 9fbdec2f6b4fa8b549daa4d49134d1fe89d95ef9 and -subsequently modified in 552c9fd08122a3036c724ce96dfe68aa2f75705f, -fix-base64.patch handled two problems we have using gnulib, which are -exerciesd by the base64 module but not directly caused by it. - -First, grub2 defines its own bool type, while gnulib expects the -equivalent of stdbool.h to be present. Rather than patching gnulib, -instead use gnulib's stdbool module to provide a bool type if needed. -(Suggested by Simon Josefsson.) - -Second, our config.h doesn't always inherit config-util.h, which is -where gnulib-related options like _GL_ATTRIBUTE_CONST end up. -fix-base64.h worked around this by defining the attribute away, but this -workaround is better placed in config.h itself, not a gnulib patch. - -Signed-off-by: Robbie Harwood -(cherry picked from commit 54fd1c3301dd15f6b6212c12887265e8a6cbc076) ---- - grub-core/lib/posix_wrap/sys/types.h | 7 +++---- - grub-core/lib/xzembed/xz.h | 5 +---- - bootstrap.conf | 3 ++- - conf/Makefile.extra-dist | 1 - - config.h.in | 4 ++++ - grub-core/lib/gnulib-patches/fix-base64.patch | 21 --------------------- - 6 files changed, 10 insertions(+), 31 deletions(-) - delete mode 100644 grub-core/lib/gnulib-patches/fix-base64.patch - -diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h -index f63412c8da..2f3e865495 100644 ---- a/grub-core/lib/posix_wrap/sys/types.h -+++ b/grub-core/lib/posix_wrap/sys/types.h -@@ -23,11 +23,10 @@ - - #include - -+/* Provided by gnulib if not present. */ -+#include -+ - typedef grub_ssize_t ssize_t; --#ifndef GRUB_POSIX_BOOL_DEFINED --typedef enum { false = 0, true = 1 } bool; --#define GRUB_POSIX_BOOL_DEFINED 1 --#endif - - typedef grub_uint8_t uint8_t; - typedef grub_uint16_t uint16_t; -diff --git a/grub-core/lib/xzembed/xz.h b/grub-core/lib/xzembed/xz.h -index f7b32d8003..d1417039aa 100644 ---- a/grub-core/lib/xzembed/xz.h -+++ b/grub-core/lib/xzembed/xz.h -@@ -29,10 +29,7 @@ - #include - #include - #include -- --#ifndef GRUB_POSIX_BOOL_DEFINED --typedef enum { false = 0, true = 1 } bool; --#endif -+#include - - /** - * enum xz_ret - Return codes -diff --git a/bootstrap.conf b/bootstrap.conf -index 52d4af44be..645e3a459c 100644 ---- a/bootstrap.conf -+++ b/bootstrap.conf -@@ -35,6 +35,7 @@ gnulib_modules=" - realloc-gnu - regex - save-cwd -+ stdbool - " - - gnulib_tool_option_extras="\ -@@ -79,7 +80,7 @@ cp -a INSTALL INSTALL.grub - - bootstrap_post_import_hook () { - set -e -- for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ -+ for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ - fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do - patch -d grub-core/lib/gnulib -p2 \ - < "grub-core/lib/gnulib-patches/$patchname.patch" -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index ad235de7fc..f4791dc6ca 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -31,7 +31,6 @@ EXTRA_DIST += grub-core/gensymlist.sh - EXTRA_DIST += grub-core/genemuinit.sh - EXTRA_DIST += grub-core/genemuinitheader.sh - --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch - EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch - EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch - EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch -diff --git a/config.h.in b/config.h.in -index f2ed0066ec..9c7b4afaaa 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -66,4 +66,8 @@ - - # define _GNU_SOURCE 1 - -+# ifndef _GL_INLINE_HEADER_BEGIN -+# define _GL_ATTRIBUTE_CONST __attribute__ ((const)) -+# endif /* !_GL_INLINE_HEADER_BEGIN */ -+ - #endif -diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch -deleted file mode 100644 -index 985db12797..0000000000 ---- a/grub-core/lib/gnulib-patches/fix-base64.patch -+++ /dev/null -@@ -1,21 +0,0 @@ --diff --git a/lib/base64.h b/lib/base64.h --index 9cd0183b8..185a2afa1 100644 ----- a/lib/base64.h --+++ b/lib/base64.h --@@ -21,8 +21,14 @@ -- /* Get size_t. */ -- # include -- ---/* Get bool. */ ---# include --+#ifndef GRUB_POSIX_BOOL_DEFINED --+typedef enum { false = 0, true = 1 } bool; --+#define GRUB_POSIX_BOOL_DEFINED 1 --+#endif --+ --+#ifndef _GL_ATTRIBUTE_CONST --+# define _GL_ATTRIBUTE_CONST /* empty */ --+#endif -- -- # ifdef __cplusplus -- extern "C" { diff --git a/0200-Fix-some-sign-comparison-errors.patch b/0200-Fix-some-sign-comparison-errors.patch new file mode 100644 index 00000000..a3e5b250 --- /dev/null +++ b/0200-Fix-some-sign-comparison-errors.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Jan 2024 19:08:33 -0500 +Subject: [PATCH] Fix some sign comparison errors + +Signed-off-by: Peter Jones +--- + grub-core/loader/i386/pc/truecrypt.c | 2 +- + grub-core/loader/multiboot_elfxx.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/loader/i386/pc/truecrypt.c b/grub-core/loader/i386/pc/truecrypt.c +index bae1ad031b3..7bf801603f4 100644 +--- a/grub-core/loader/i386/pc/truecrypt.c ++++ b/grub-core/loader/i386/pc/truecrypt.c +@@ -176,7 +176,7 @@ grub_cmd_truecrypt (grub_command_t cmd __attribute__ ((unused)), + + edx = (dh << 8) | grub_get_root_biosnumber (); + +- destaddr = ALIGN_DOWN (grub_min (0x90000, grub_mmap_get_lower ()) ++ destaddr = ALIGN_DOWN (grub_min (0x90000ull, grub_mmap_get_lower ()) + - truecryptmemsize, 64 * 1024); + + { +diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c +index 8d370b0b3f5..24480df5053 100644 +--- a/grub-core/loader/multiboot_elfxx.c ++++ b/grub-core/loader/multiboot_elfxx.c +@@ -99,7 +99,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld) + return err; + + /* FIXME: Should we support program headers at strange locations? */ +- phlimit = grub_min (MULTIBOOT_SEARCH, grub_file_size (mld->file)); ++ phlimit = grub_min ((grub_off_t)MULTIBOOT_SEARCH, grub_file_size (mld->file)); + if ((grub_off_t) ehdr->e_phoff + phnum * ehdr->e_phentsize > phlimit) + return grub_error (GRUB_ERR_BAD_OS, "program header at a too high offset"); + diff --git a/0201-Drop-gnulib-no-abort.patch.patch b/0201-Drop-gnulib-no-abort.patch.patch deleted file mode 100644 index a12789f3..00000000 --- a/0201-Drop-gnulib-no-abort.patch.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Wed, 5 Jan 2022 16:42:11 -0500 -Subject: [PATCH] Drop gnulib no-abort.patch - -Originally added in db7337a3d353a817ffe9eb4a3702120527100be9, this -patched out all relevant invocations of abort() in gnulib. While it was -not documented why at the time, testing suggests that there's no abort() -implementation available for gnulib to use. - -gnulib's position is that the use of abort() is correct here, since it -happens when input violates a "shall" from POSIX. Additionally, the -code in question is probably not reachable. Since abort() is more -friendly to user-space, they prefer to make no change, so we can just -carry a define instead. (Suggested by Paul Eggert.) - -Signed-off-by: Robbie Harwood -(cherry picked from commit 5137c8eb3ec11c3217acea1a93a3f88f3fa4cbca) ---- - bootstrap.conf | 2 +- - conf/Makefile.extra-dist | 1 - - config.h.in | 3 +++ - grub-core/lib/gnulib-patches/no-abort.patch | 26 -------------------------- - 4 files changed, 4 insertions(+), 28 deletions(-) - delete mode 100644 grub-core/lib/gnulib-patches/no-abort.patch - -diff --git a/bootstrap.conf b/bootstrap.conf -index 645e3a459c..71ce943c7d 100644 ---- a/bootstrap.conf -+++ b/bootstrap.conf -@@ -81,7 +81,7 @@ cp -a INSTALL INSTALL.grub - bootstrap_post_import_hook () { - set -e - for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ -- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do -+ fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do - patch -d grub-core/lib/gnulib -p2 \ - < "grub-core/lib/gnulib-patches/$patchname.patch" - done -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index f4791dc6ca..5eef708338 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -38,7 +38,6 @@ EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch - EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch - EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch - EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch - - EXTRA_DIST += grub-core/lib/libgcrypt - EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic -diff --git a/config.h.in b/config.h.in -index 9c7b4afaaa..c3134309c6 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -68,6 +68,9 @@ - - # ifndef _GL_INLINE_HEADER_BEGIN - # define _GL_ATTRIBUTE_CONST __attribute__ ((const)) -+ -+/* We don't have an abort() for gnulib to call in regexp. */ -+# define abort __builtin_unreachable - # endif /* !_GL_INLINE_HEADER_BEGIN */ - - #endif -diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch -deleted file mode 100644 -index e469c4762e..0000000000 ---- a/grub-core/lib/gnulib-patches/no-abort.patch -+++ /dev/null -@@ -1,26 +0,0 @@ --diff --git a/lib/regcomp.c b/lib/regcomp.c --index cc85f35ac..de45ebb5c 100644 ----- a/lib/regcomp.c --+++ b/lib/regcomp.c --@@ -528,9 +528,9 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf, -- to this routine. If we are given anything else, or if other regex -- code generates an invalid error code, then the program has a bug. -- Dump core so we can fix it. */ --- abort (); --- --- msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); --+ msg = gettext ("unknown regexp error"); --+ else --+ msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); -- -- msg_size = strlen (msg) + 1; /* Includes the null. */ -- --@@ -1136,7 +1136,7 @@ optimize_utf8 (re_dfa_t *dfa) -- } -- break; -- default: --- abort (); --+ break; -- } -- -- if (mb_chars || has_period) diff --git a/0201-normal-Fix-a-discarded-const.patch b/0201-normal-Fix-a-discarded-const.patch new file mode 100644 index 00000000..57598db1 --- /dev/null +++ b/0201-normal-Fix-a-discarded-const.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Jan 2024 19:12:15 -0500 +Subject: [PATCH] normal: Fix a discarded const. + +Signed-off-by: Peter Jones +--- + grub-core/normal/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index e903f291732..803b9656d36 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -406,7 +406,7 @@ grub_try_normal_dev (const char *name, void *data) + static grub_err_t + grub_try_normal_discover (void) + { +- char *prefix = grub_env_get ("prefix"); ++ const char *prefix = grub_env_get ("prefix"); + grub_err_t err = GRUB_ERR_FILE_NOT_FOUND; + + if (!prefix) diff --git a/0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch b/0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch deleted file mode 100644 index c2c50f1f..00000000 --- a/0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch +++ /dev/null @@ -1,832 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Wed, 15 Dec 2021 15:07:50 -0500 -Subject: [PATCH] Update gnulib version and drop most gnulib patches - -In addition to the changes carried in our gnulib patches, several -Coverity and code hygiene fixes that were previously downstream are also -included in this 3-year gnulib increment. - -Unfortunately, fix-width.patch is retained. - -Bump minimum autoconf version from 2.63 to 2.64 and automake from 1.11 -to 1.14, as required by gnulib. - -Sync bootstrap script itself with gnulib. - -Update regexp module for new dynarray dependency. - -Fix various new warnings. - -Signed-off-by: Robbie Harwood -(cherry picked from commit deb18ff931c3133c2aa536a92bd92e50d6615303) -[rharwood: backport around requirements in INSTALL] ---- - configure.ac | 2 +- - grub-core/Makefile.core.def | 3 + - grub-core/disk/luks2.c | 4 +- - grub-core/lib/posix_wrap/limits.h | 6 +- - include/grub/compiler.h | 4 +- - include/grub/list.h | 2 +- - INSTALL | 2 +- - bootstrap | 291 ++++++++++++--------- - bootstrap.conf | 22 +- - conf/Makefile.extra-dist | 6 - - config.h.in | 68 +++++ - grub-core/lib/gnulib-patches/fix-null-deref.patch | 13 - - .../lib/gnulib-patches/fix-null-state-deref.patch | 12 - - .../gnulib-patches/fix-regcomp-uninit-token.patch | 15 -- - .../gnulib-patches/fix-regexec-null-deref.patch | 12 - - .../lib/gnulib-patches/fix-uninit-structure.patch | 11 - - .../lib/gnulib-patches/fix-unused-value.patch | 14 - - 17 files changed, 262 insertions(+), 225 deletions(-) - delete mode 100644 grub-core/lib/gnulib-patches/fix-null-deref.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch - delete mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch - -diff --git a/configure.ac b/configure.ac -index 40c4338bce..79f45ef1e1 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -49,7 +49,7 @@ AC_CANONICAL_TARGET - program_prefix="${save_program_prefix}" - - AM_INIT_AUTOMAKE([1.11]) --AC_PREREQ(2.63) -+AC_PREREQ(2.64) - AC_CONFIG_SRCDIR([include/grub/dl.h]) - AC_CONFIG_HEADER([config-util.h]) - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 08ac0fb15f..ec1ec5083b 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -762,6 +762,9 @@ module = { - name = regexp; - common = commands/regexp.c; - common = commands/wildcard.c; -+ common = lib/gnulib/malloc/dynarray_finalize.c; -+ common = lib/gnulib/malloc/dynarray_emplace_enlarge.c; -+ common = lib/gnulib/malloc/dynarray_resize.c; - common = lib/gnulib/regex.c; - cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; - cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; -diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c -index 371a53b837..c917a5f91e 100644 ---- a/grub-core/disk/luks2.c -+++ b/grub-core/disk/luks2.c -@@ -389,7 +389,7 @@ luks2_verify_key (grub_luks2_digest_t *d, grub_uint8_t *candidate_key, - { - grub_uint8_t candidate_digest[GRUB_CRYPTODISK_MAX_KEYLEN]; - grub_uint8_t digest[GRUB_CRYPTODISK_MAX_KEYLEN], salt[GRUB_CRYPTODISK_MAX_KEYLEN]; -- grub_size_t saltlen = sizeof (salt), digestlen = sizeof (digest); -+ idx_t saltlen = sizeof (salt), digestlen = sizeof (digest); - const gcry_md_spec_t *hash; - gcry_err_code_t gcry_ret; - -@@ -428,7 +428,7 @@ luks2_decrypt_key (grub_uint8_t *out_key, - grub_uint8_t area_key[GRUB_CRYPTODISK_MAX_KEYLEN]; - grub_uint8_t salt[GRUB_CRYPTODISK_MAX_KEYLEN]; - grub_uint8_t *split_key = NULL; -- grub_size_t saltlen = sizeof (salt); -+ idx_t saltlen = sizeof (salt); - char cipher[32], *p; - const gcry_md_spec_t *hash; - gcry_err_code_t gcry_ret; -diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h -index 591dbf3289..4be7b40806 100644 ---- a/grub-core/lib/posix_wrap/limits.h -+++ b/grub-core/lib/posix_wrap/limits.h -@@ -25,7 +25,11 @@ - #define USHRT_MAX GRUB_USHRT_MAX - #define UINT_MAX GRUB_UINT_MAX - #define ULONG_MAX GRUB_ULONG_MAX --#define SIZE_MAX GRUB_SIZE_MAX -+ -+/* gnulib also defines this type */ -+#ifndef SIZE_MAX -+# define SIZE_MAX GRUB_SIZE_MAX -+#endif - - #define SCHAR_MIN GRUB_SCHAR_MIN - #define SCHAR_MAX GRUB_SCHAR_MAX -diff --git a/include/grub/compiler.h b/include/grub/compiler.h -index ebafec6895..441a9eca07 100644 ---- a/include/grub/compiler.h -+++ b/include/grub/compiler.h -@@ -30,10 +30,10 @@ - - /* Does this compiler support compile-time error attributes? */ - #if GNUC_PREREQ(4,3) --# define ATTRIBUTE_ERROR(msg) \ -+# define GRUB_ATTRIBUTE_ERROR(msg) \ - __attribute__ ((__error__ (msg))) - #else --# define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn)) -+# define GRUB_ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn)) - #endif - - #if GNUC_PREREQ(4,4) -diff --git a/include/grub/list.h b/include/grub/list.h -index b13acb9624..21f4b4b44a 100644 ---- a/include/grub/list.h -+++ b/include/grub/list.h -@@ -40,7 +40,7 @@ void EXPORT_FUNC(grub_list_remove) (grub_list_t item); - - static inline void * - grub_bad_type_cast_real (int line, const char *file) -- ATTRIBUTE_ERROR ("bad type cast between incompatible grub types"); -+ GRUB_ATTRIBUTE_ERROR ("bad type cast between incompatible grub types"); - - static inline void * - grub_bad_type_cast_real (int line, const char *file) -diff --git a/INSTALL b/INSTALL -index 79a0af7d93..ee9f536f76 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -42,7 +42,7 @@ If you use a development snapshot or want to hack on GRUB you may - need the following. - - * Python 2.6 or later --* Autoconf 2.63 or later -+* Autoconf 2.64 or later - * Automake 1.11 or later - - Prerequisites for make-check: -diff --git a/bootstrap b/bootstrap -index 5b08e7e2d4..dc2238f4ad 100755 ---- a/bootstrap -+++ b/bootstrap -@@ -1,10 +1,10 @@ - #! /bin/sh - # Print a version string. --scriptversion=2019-01-04.17; # UTC -+scriptversion=2022-01-26.05; # UTC - - # Bootstrap this package from checked-out sources. - --# Copyright (C) 2003-2019 Free Software Foundation, Inc. -+# Copyright (C) 2003-2022 Free Software Foundation, Inc. - - # This program is free software: you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by -@@ -47,7 +47,7 @@ PERL="${PERL-perl}" - - me=$0 - --default_gnulib_url=git://git.sv.gnu.org/gnulib -+default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git - - usage() { - cat </dev/null) -+if test -z "$package"; then -+ package=$(sed -n "$extract_package_name" configure.ac) \ -+ || die 'cannot find package name in configure.ac' -+fi - gnulib_name=lib$package - - build_aux=build-aux -@@ -290,6 +313,116 @@ find_tool () - eval "export $find_tool_envvar" - } - -+# Strip blank and comment lines to leave significant entries. -+gitignore_entries() { -+ sed '/^#/d; /^$/d' "$@" -+} -+ -+# If $STR is not already on a line by itself in $FILE, insert it at the start. -+# Entries are inserted at the start of the ignore list to ensure existing -+# entries starting with ! are not overridden. Such entries support -+# whitelisting exceptions after a more generic blacklist pattern. -+insert_if_absent() { -+ file=$1 -+ str=$2 -+ test -f $file || touch $file -+ test -r $file || die "Error: failed to read ignore file: $file" -+ duplicate_entries=$(gitignore_entries $file | sort | uniq -d) -+ if [ "$duplicate_entries" ] ; then -+ die "Error: Duplicate entries in $file: " $duplicate_entries -+ fi -+ linesold=$(gitignore_entries $file | wc -l) -+ linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) -+ if [ $linesold != $linesnew ] ; then -+ { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ -+ || die "insert_if_absent $file $str: failed" -+ fi -+} -+ -+# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with -+# insert_if_absent. -+insert_vc_ignore() { -+ vc_ignore_file="$1" -+ pattern="$2" -+ case $vc_ignore_file in -+ *.gitignore) -+ # A .gitignore entry that does not start with '/' applies -+ # recursively to subdirectories, so prepend '/' to every -+ # .gitignore entry. -+ pattern=$(echo "$pattern" | sed s,^,/,);; -+ esac -+ insert_if_absent "$vc_ignore_file" "$pattern" -+} -+ -+symlink_to_dir() -+{ -+ src=$1/$2 -+ dst=${3-$2} -+ -+ test -f "$src" && { -+ -+ # If the destination directory doesn't exist, create it. -+ # This is required at least for "lib/uniwidth/cjk.h". -+ dst_dir=$(dirname "$dst") -+ if ! test -d "$dst_dir"; then -+ mkdir -p "$dst_dir" -+ -+ # If we've just created a directory like lib/uniwidth, -+ # tell version control system(s) it's ignorable. -+ # FIXME: for now, this does only one level -+ parent=$(dirname "$dst_dir") -+ for dot_ig in x $vc_ignore; do -+ test $dot_ig = x && continue -+ ig=$parent/$dot_ig -+ insert_vc_ignore $ig "${dst_dir##*/}" -+ done -+ fi -+ -+ if $copy; then -+ { -+ test ! -h "$dst" || { -+ echo "$me: rm -f $dst" && -+ rm -f "$dst" -+ } -+ } && -+ test -f "$dst" && -+ cmp -s "$src" "$dst" || { -+ echo "$me: cp -fp $src $dst" && -+ cp -fp "$src" "$dst" -+ } -+ else -+ # Leave any existing symlink alone, if it already points to the source, -+ # so that broken build tools that care about symlink times -+ # aren't confused into doing unnecessary builds. Conversely, if the -+ # existing symlink's timestamp is older than the source, make it afresh, -+ # so that broken tools aren't confused into skipping needed builds. See -+ # . -+ test -h "$dst" && -+ src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && -+ dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && -+ test "$src_i" = "$dst_i" && -+ both_ls=$(ls -dt "$src" "$dst") && -+ test "X$both_ls" = "X$dst$nl$src" || { -+ dot_dots= -+ case $src in -+ /*) ;; -+ *) -+ case /$dst/ in -+ *//* | */../* | */./* | /*/*/*/*/*/) -+ die "invalid symlink calculation: $src -> $dst";; -+ /*/*/*/*/) dot_dots=../../../;; -+ /*/*/*/) dot_dots=../../;; -+ /*/*/) dot_dots=../;; -+ esac;; -+ esac -+ -+ echo "$me: ln -fs $dot_dots$src $dst" && -+ ln -fs "$dot_dots$src" "$dst" -+ } -+ fi -+ } -+} -+ - # Override the default configuration, if necessary. - # Make sure that bootstrap.conf is sourced from the current directory - # if we were invoked as "sh bootstrap". -@@ -320,6 +453,12 @@ do - --help) - usage - exit;; -+ --version) -+ set -e -+ echo "bootstrap $scriptversion" -+ echo "$copyright" -+ exit 0 -+ ;; - --gnulib-srcdir=*) - GNULIB_SRCDIR=${option#--gnulib-srcdir=};; - --skip-po) -@@ -335,7 +474,7 @@ do - --no-git) - use_git=false;; - *) -- die "$option: unknown option";; -+ bootstrap_option_hook $option || die "$option: unknown option";; - esac - done - -@@ -346,47 +485,6 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then - die "Bootstrapping from a non-checked-out distribution is risky." - fi - --# Strip blank and comment lines to leave significant entries. --gitignore_entries() { -- sed '/^#/d; /^$/d' "$@" --} -- --# If $STR is not already on a line by itself in $FILE, insert it at the start. --# Entries are inserted at the start of the ignore list to ensure existing --# entries starting with ! are not overridden. Such entries support --# whitelisting exceptions after a more generic blacklist pattern. --insert_if_absent() { -- file=$1 -- str=$2 -- test -f $file || touch $file -- test -r $file || die "Error: failed to read ignore file: $file" -- duplicate_entries=$(gitignore_entries $file | sort | uniq -d) -- if [ "$duplicate_entries" ] ; then -- die "Error: Duplicate entries in $file: " $duplicate_entries -- fi -- linesold=$(gitignore_entries $file | wc -l) -- linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) -- if [ $linesold != $linesnew ] ; then -- { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ -- || die "insert_if_absent $file $str: failed" -- fi --} -- --# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with --# insert_if_absent. --insert_vc_ignore() { -- vc_ignore_file="$1" -- pattern="$2" -- case $vc_ignore_file in -- *.gitignore) -- # A .gitignore entry that does not start with '/' applies -- # recursively to subdirectories, so prepend '/' to every -- # .gitignore entry. -- pattern=$(echo "$pattern" | sed s,^,/,);; -- esac -- insert_if_absent "$vc_ignore_file" "$pattern" --} -- - # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. - found_aux_dir=no - grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ -@@ -665,9 +763,25 @@ if $use_gnulib; then - shallow= - if test -z "$GNULIB_REVISION"; then - git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' -+ git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ -+ || cleanup_gnulib -+ else -+ git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' -+ mkdir -p "$gnulib_path" -+ # Only want a shallow checkout of $GNULIB_REVISION, but git does not -+ # support cloning by commit hash. So attempt a shallow fetch by commit -+ # hash to minimize the amount of data downloaded and changes needed to -+ # be processed, which can drastically reduce download and processing -+ # time for checkout. If the fetch by commit fails, a shallow fetch can -+ # not be performed because we do not know what the depth of the commit -+ # is without fetching all commits. So fallback to fetching all commits. -+ git -C "$gnulib_path" init -+ git -C "$gnulib_path" remote add origin ${GNULIB_URL:-$default_gnulib_url} -+ git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \ -+ || git -C "$gnulib_path" fetch origin \ -+ || cleanup_gnulib -+ git -C "$gnulib_path" reset --hard FETCH_HEAD - fi -- git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ -- || cleanup_gnulib - - trap - 1 2 13 15 - fi -@@ -784,75 +898,6 @@ case $SKIP_PO in - fi;; - esac - --symlink_to_dir() --{ -- src=$1/$2 -- dst=${3-$2} -- -- test -f "$src" && { -- -- # If the destination directory doesn't exist, create it. -- # This is required at least for "lib/uniwidth/cjk.h". -- dst_dir=$(dirname "$dst") -- if ! test -d "$dst_dir"; then -- mkdir -p "$dst_dir" -- -- # If we've just created a directory like lib/uniwidth, -- # tell version control system(s) it's ignorable. -- # FIXME: for now, this does only one level -- parent=$(dirname "$dst_dir") -- for dot_ig in x $vc_ignore; do -- test $dot_ig = x && continue -- ig=$parent/$dot_ig -- insert_vc_ignore $ig "${dst_dir##*/}" -- done -- fi -- -- if $copy; then -- { -- test ! -h "$dst" || { -- echo "$me: rm -f $dst" && -- rm -f "$dst" -- } -- } && -- test -f "$dst" && -- cmp -s "$src" "$dst" || { -- echo "$me: cp -fp $src $dst" && -- cp -fp "$src" "$dst" -- } -- else -- # Leave any existing symlink alone, if it already points to the source, -- # so that broken build tools that care about symlink times -- # aren't confused into doing unnecessary builds. Conversely, if the -- # existing symlink's timestamp is older than the source, make it afresh, -- # so that broken tools aren't confused into skipping needed builds. See -- # . -- test -h "$dst" && -- src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && -- dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && -- test "$src_i" = "$dst_i" && -- both_ls=$(ls -dt "$src" "$dst") && -- test "X$both_ls" = "X$dst$nl$src" || { -- dot_dots= -- case $src in -- /*) ;; -- *) -- case /$dst/ in -- *//* | */../* | */./* | /*/*/*/*/*/) -- die "invalid symlink calculation: $src -> $dst";; -- /*/*/*/*/) dot_dots=../../../;; -- /*/*/*/) dot_dots=../../;; -- /*/*/) dot_dots=../;; -- esac;; -- esac -- -- echo "$me: ln -fs $dot_dots$src $dst" && -- ln -fs "$dot_dots$src" "$dst" -- } -- fi -- } --} -- - version_controlled_file() { - parent=$1 - file=$2 -@@ -970,7 +1015,7 @@ bootstrap_post_import_hook \ - # Uninitialized submodules are listed with an initial dash. - if $use_git && git submodule | grep '^-' >/dev/null; then - die "some git submodules are not initialized. " \ -- "Run 'git submodule init' and bootstrap again." -+ "Run 'git submodule update --init' and bootstrap again." - fi - - # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some -@@ -1064,7 +1109,7 @@ bootstrap_epilogue - - echo "$0: done. Now you can run './configure'." - --# Local variables: -+# Local Variables: - # eval: (add-hook 'before-save-hook 'time-stamp) - # time-stamp-start: "scriptversion=" - # time-stamp-format: "%:y-%02m-%02d.%02H" -diff --git a/bootstrap.conf b/bootstrap.conf -index 71ce943c7d..e4e5f3750a 100644 ---- a/bootstrap.conf -+++ b/bootstrap.conf -@@ -1,6 +1,6 @@ - # Bootstrap configuration. - --# Copyright (C) 2006-2019 Free Software Foundation, Inc. -+# Copyright (C) 2006-2022 Free Software Foundation, Inc. - - # This program is free software: you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by -@@ -16,11 +16,10 @@ - # along with this program. If not, see . - - --GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 -+GNULIB_REVISION=9f48fb992a3d7e96610c4ce8be969cff2d61a01b - - # gnulib modules used by this package. --# mbswidth is used by gnulib-fix-width.diff's changes to argp rather than --# directly. -+# mbswidth is used by fix-width.diff's changes to argp rather than directly. - gnulib_modules=" - argp - base64 -@@ -67,8 +66,8 @@ SKIP_PO=t - - # Build prerequisites - buildreq="\ --autoconf 2.63 --automake 1.11 -+autoconf 2.64 -+automake 1.14 - gettext 0.18.3 - git 1.5.5 - tar - -@@ -80,11 +79,12 @@ cp -a INSTALL INSTALL.grub - - bootstrap_post_import_hook () { - set -e -- for patchname in fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ -- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width; do -- patch -d grub-core/lib/gnulib -p2 \ -- < "grub-core/lib/gnulib-patches/$patchname.patch" -- done -+ -+ # Instead of patching our gnulib and therefore maintaining a fork, submit -+ # changes to gnulib and update the hash above when they've merged. Do not -+ # add new patches here. -+ patch -d grub-core/lib/gnulib -p2 < grub-core/lib/gnulib-patches/fix-width.patch -+ - for patchname in \ - 0001-Support-POTFILES-shell \ - 0002-Handle-gettext_printf-shell-function \ -diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist -index 5eef708338..26ac8765e3 100644 ---- a/conf/Makefile.extra-dist -+++ b/conf/Makefile.extra-dist -@@ -31,12 +31,6 @@ EXTRA_DIST += grub-core/gensymlist.sh - EXTRA_DIST += grub-core/genemuinit.sh - EXTRA_DIST += grub-core/genemuinitheader.sh - --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch --EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch - EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch - - EXTRA_DIST += grub-core/lib/libgcrypt -diff --git a/config.h.in b/config.h.in -index c3134309c6..512d1bbe13 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -67,10 +67,78 @@ - # define _GNU_SOURCE 1 - - # ifndef _GL_INLINE_HEADER_BEGIN -+/* gnulib gets configured against the host, not the target, and the rest of -+ * our buildsystem works around that. This is difficult to avoid as gnulib's -+ * detection requires a more capable system than our target. Instead, we -+ * reach in and set values appropriately - intentionally setting more than the -+ * bare minimum. If, when updating gnulib, something breaks, there's probably -+ * a change needed here or in grub-core/Makefile.core.def. */ -+# define SIZE_MAX ((size_t) -1) -+# define _GL_ATTRIBUTE_ALLOC_SIZE(args) \ -+ __attribute__ ((__alloc_size__ args)) -+# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) -+# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) -+# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) - # define _GL_ATTRIBUTE_CONST __attribute__ ((const)) -+# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute ((__malloc__ (f, i))) -+# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) -+# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) -+# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) -+# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE \ -+ __attribute__ ((externally_visible)) -+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) -+# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) -+# define _GL_ATTRIBUTE_MALLOC __attribute__ ((malloc)) -+# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED -+# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) -+# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) -+# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) -+# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) -+# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) -+# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) -+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -+# define _GL_ATTRIBUTE_RETURNS_NONNULL \ -+ __attribute__ ((__returns_nonnull__)) -+# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) -+# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -+# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) -+# define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) -+# define _GL_GNUC_PREREQ GNUC_PREREQ -+# define _GL_INLINE inline -+# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED -+ -+/* We can't use __has_attribute for these because gcc-5.1 is too old for -+ * that. Everything above is present in that version, though. */ -+# if __GNUC__ >= 7 -+# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((fallthrough)) -+# else -+# define _GL_ATTRIBUTE_FALLTHROUGH /* empty */ -+# endif -+ -+# ifndef ASM_FILE -+typedef __INT_FAST32_TYPE__ int_fast32_t; -+typedef __UINT_FAST32_TYPE__ uint_fast32_t; -+# endif -+ -+/* Ensure ialloc nests static/non-static inline properly. */ -+# define IALLOC_INLINE static inline -+ -+/* gnulib uses these for blocking out warnings they can't/won't fix. gnulib -+ * also makes the decision about whether to provide a declaration for -+ * reallocarray() at compile-time, so this is a convenient place to override - -+ * it's used by the ialloc module, which is used by base64. */ -+# define _GL_INLINE_HEADER_BEGIN _Pragma ("GCC diagnostic push") \ -+ void * \ -+ reallocarray (void *ptr, unsigned int nmemb, unsigned int size); -+# define _GL_INLINE_HEADER_END _Pragma ("GCC diagnostic pop") - - /* We don't have an abort() for gnulib to call in regexp. */ - # define abort __builtin_unreachable - # endif /* !_GL_INLINE_HEADER_BEGIN */ - -+/* gnulib doesn't build cleanly with older compilers. */ -+# if __GNUC__ < 11 -+_Pragma ("GCC diagnostic ignored \"-Wtype-limits\"") -+# endif -+ - #endif -diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch -deleted file mode 100644 -index 8fafa153a4..0000000000 ---- a/grub-core/lib/gnulib-patches/fix-null-deref.patch -+++ /dev/null -@@ -1,13 +0,0 @@ --diff --git a/lib/argp-parse.c b/lib/argp-parse.c --index 6dec57310..900adad54 100644 ----- a/lib/argp-parse.c --+++ b/lib/argp-parse.c --@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse) -- void * -- __argp_input (const struct argp *argp, const struct argp_state *state) -- { --- if (state) --+ if (state && state->pstate) -- { -- struct group *group; -- struct parser *parser = state->pstate; -diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch -deleted file mode 100644 -index 813ec09c8a..0000000000 ---- a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch -+++ /dev/null -@@ -1,12 +0,0 @@ ----- a/lib/argp-help.c 2020-10-28 14:32:19.189215988 +0000 --+++ b/lib/argp-help.c 2020-10-28 14:38:21.204673940 +0000 --@@ -145,7 +145,8 @@ -- if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin) -- { -- __argp_failure (state, 0, 0, --- dgettext (state->root_argp->argp_domain, --+ dgettext (state == NULL ? NULL --+ : state->root_argp->argp_domain, -- "\ -- ARGP_HELP_FMT: %s value is less than or equal to %s"), -- "rmargin", up->name); -diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch -deleted file mode 100644 -index 02e06315df..0000000000 ---- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch -+++ /dev/null -@@ -1,15 +0,0 @@ ----- a/lib/regcomp.c 2020-11-24 17:06:08.159223858 +0000 --+++ b/lib/regcomp.c 2020-11-24 17:06:15.630253923 +0000 --@@ -3808,11 +3808,7 @@ -- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, -- re_token_type_t type) -- { --- re_token_t t; ---#if defined GCC_LINT || defined lint --- memset (&t, 0, sizeof t); ---#endif --- t.type = type; --+ re_token_t t = { .type = type }; -- return create_token_tree (dfa, left, right, &t); -- } -- -diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch -deleted file mode 100644 -index db6dac9c9e..0000000000 ---- a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch -+++ /dev/null -@@ -1,12 +0,0 @@ ----- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 --+++ b/lib/regexec.c 2020-11-05 10:55:09.621542984 +0000 --@@ -1692,6 +1692,9 @@ -- { -- Idx top = mctx->state_log_top; -- --+ if (mctx->state_log == NULL) --+ return REG_NOERROR; --+ -- if ((next_state_log_idx >= mctx->input.bufs_len -- && mctx->input.bufs_len < mctx->input.len) -- || (next_state_log_idx >= mctx->input.valid_len -diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch -deleted file mode 100644 -index 7b4d9f67af..0000000000 ---- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch -+++ /dev/null -@@ -1,11 +0,0 @@ ----- a/lib/regcomp.c 2020-10-22 13:49:06.770168928 +0000 --+++ b/lib/regcomp.c 2020-10-22 13:50:37.026528298 +0000 --@@ -3662,7 +3662,7 @@ -- Idx alloc = 0; -- #endif /* not RE_ENABLE_I18N */ -- reg_errcode_t ret; --- re_token_t br_token; --+ re_token_t br_token = {0}; -- bin_tree_t *tree; -- -- sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); -diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch -deleted file mode 100644 -index ba51f1bf22..0000000000 ---- a/grub-core/lib/gnulib-patches/fix-unused-value.patch -+++ /dev/null -@@ -1,14 +0,0 @@ ----- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 --+++ b/lib/regexec.c 2020-10-21 14:32:07.961765604 +0000 --@@ -828,7 +828,11 @@ -- break; -- if (__glibc_unlikely (err != REG_NOMATCH)) -- goto free_return; --+#ifdef DEBUG --+ /* Only used for assertion below when DEBUG is set, otherwise --+ it will be over-written when we loop around. */ -- match_last = -1; --+#endif -- } -- else -- break; /* We found a match. */ diff --git a/0202-at_keyboard-mark-grub_keyboard_controller_write-unus.patch b/0202-at_keyboard-mark-grub_keyboard_controller_write-unus.patch new file mode 100644 index 00000000..058340d7 --- /dev/null +++ b/0202-at_keyboard-mark-grub_keyboard_controller_write-unus.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 8 Jan 2024 19:14:06 -0500 +Subject: [PATCH] at_keyboard: mark grub_keyboard_controller_write unused + +It's used sometimes and not others by #ifdef, so mark it unused so the +compiler doesn't complain. + +Signed-off-by: Peter Jones +--- + grub-core/term/at_keyboard.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c +index e667d0a862c..d2b716b5b4f 100644 +--- a/grub-core/term/at_keyboard.c ++++ b/grub-core/term/at_keyboard.c +@@ -93,7 +93,7 @@ at_command (grub_uint8_t data) + return (i != GRUB_AT_TRIES); + } + +-static void ++static void __attribute__((__unused__)) + grub_keyboard_controller_write (grub_uint8_t c) + { + at_command (KEYBOARD_COMMAND_WRITE); +@@ -170,7 +170,7 @@ query_mode (void) + grub_uint64_t endtime; + unsigned i; + int e; +- char *envvar; ++ const char *envvar; + + for (i = 0; i < GRUB_AT_TRIES; i++) { + grub_dprintf ("atkeyb", "query_mode: sending command to controller\n"); diff --git a/0203-Fix-another-minor-sign-comparison-error.patch b/0203-Fix-another-minor-sign-comparison-error.patch new file mode 100644 index 00000000..24c343cc --- /dev/null +++ b/0203-Fix-another-minor-sign-comparison-error.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 9 Jan 2024 14:37:25 -0500 +Subject: [PATCH] Fix another minor sign comparison error. + +Signed-off-by: Peter Jones +--- + grub-core/kern/mm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c +index 1aeeba9e27e..819bc5126a6 100644 +--- a/grub-core/kern/mm.c ++++ b/grub-core/kern/mm.c +@@ -505,7 +505,7 @@ grub_memalign (grub_size_t align, grub_size_t size) + goto fail; + + /* Preallocate some extra space if heap growth is small. */ +- grow = grub_max (grow, GRUB_MM_HEAP_GROW_EXTRA); ++ grow = grub_max (grow, (grub_size_t)GRUB_MM_HEAP_GROW_EXTRA); + + /* Align up heap growth to make it friendly to CPU/MMU. */ + if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) diff --git a/0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch b/0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch deleted file mode 100644 index 4f7feb93..00000000 --- a/0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Renaud=20M=C3=A9trich?= -Date: Tue, 8 Feb 2022 08:39:10 +0100 -Subject: [PATCH] commands/search: Fix bug stopping iteration when --no-floppy - is used -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When using --no-floppy and a floppy was encountered, iterate_device() -was returning 1, causing the iteration to stop instead of continuing. - -Signed-off-by: Renaud Métrich -Reviewed-by: Daniel Kiper -(cherry picked from commit 68ba54c2298604146be83cae144dafd1cfd1fe2d) -Signed-off-by: Robbie Harwood ---- - grub-core/commands/search.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index ed090b3af8..51656e361c 100644 ---- a/grub-core/commands/search.c -+++ b/grub-core/commands/search.c -@@ -64,7 +64,7 @@ iterate_device (const char *name, void *data) - /* Skip floppy drives when requested. */ - if (ctx->no_floppy && - name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9') -- return 1; -+ return 0; - - #ifdef DO_SEARCH_FS_UUID - #define compare_fn grub_strcasecmp diff --git a/0204-Track-explicit-module-dependencies-in-Makefile.core..patch b/0204-Track-explicit-module-dependencies-in-Makefile.core..patch new file mode 100644 index 00000000..c5311c1f --- /dev/null +++ b/0204-Track-explicit-module-dependencies-in-Makefile.core..patch @@ -0,0 +1,124 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Oliver Steffen +Date: Wed, 28 Feb 2024 13:36:00 +0100 +Subject: [PATCH] Track explicit module dependencies in Makefile.core.def + +Add a new keyword, "depends", to the module definition syntax +used in Makefile.core.def. This allows specifying explicit module +dependencies together with the module definition. + +Make use of this new keyword in the bli module definition. + +Signed-off-by: Oliver Steffen +Reviewed-by: Daniel Kiper +Tested-by: Oskari Pirhonen +--- + grub-core/Makefile.core.def | 1 + + .gitignore | 1 - + conf/Makefile.common | 1 + + gentpl.py | 7 +++++++ + grub-core/Makefile.am | 9 ++++++--- + grub-core/genmoddep.awk | 2 +- + 6 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index c9dcfa00e85..a5a3ee31800 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2670,6 +2670,7 @@ module = { + name = bli; + efi = commands/bli.c; + enable = efi; ++ depends = part_gpt; + }; + + module = { +diff --git a/.gitignore b/.gitignore +index f2e8e1e42d7..c603c15d66c 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -11,7 +11,6 @@ + *.img + *.log + *.lst +-!/grub-core/extra_deps.lst + *.marker + *.mod + *.o +diff --git a/conf/Makefile.common b/conf/Makefile.common +index c8756d8146f..9feac7434da 100644 +--- a/conf/Makefile.common ++++ b/conf/Makefile.common +@@ -115,6 +115,7 @@ MOD_FILES = + MODULE_FILES = + MARKER_FILES = + KERNEL_HEADER_FILES = ++EXTRA_DEPS = + + bin_SCRIPTS = + bin_PROGRAMS = +diff --git a/gentpl.py b/gentpl.py +index 5826a6b14e8..0f8d009ef21 100644 +--- a/gentpl.py ++++ b/gentpl.py +@@ -642,6 +642,9 @@ def platform_values(defn, platform, suffix): + def extra_dist(defn): + return foreach_value(defn, "extra_dist", lambda value: value + " ") + ++def extra_dep(defn): ++ return foreach_value(defn, "depends", lambda value: value + " ") ++ + def platform_sources(defn, p): return platform_values(defn, p, "") + def platform_nodist_sources(defn, p): return platform_values(defn, p, "_nodist") + +@@ -712,6 +715,10 @@ def module(defn, platform): + gvar_add("MOD_FILES", name + ".mod") + gvar_add("MARKER_FILES", name + ".marker") + gvar_add("CLEANFILES", name + ".marker") ++ ++ for dep in defn.find_all("depends"): ++ gvar_add("EXTRA_DEPS", "depends " + name + " " + dep + ":") ++ + output(""" + """ + name + """.marker: $(""" + cname(defn) + """_SOURCES) $(nodist_""" + cname(defn) + """_SOURCES) + $(TARGET_CPP) -DGRUB_LST_GENERATOR $(CPPFLAGS_MARKER) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname(defn) + """_CPPFLAGS) $(CPPFLAGS) $^ > $@.new || (rm -f $@; exit 1) +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index 7953ba95399..77f8329cd43 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -456,8 +456,11 @@ crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst + platform_DATA += crypto.lst + CLEANFILES += crypto.lst + +-syminfo.lst: gensyminfo.sh kernel_syms.lst $(top_srcdir)/grub-core/extra_deps.lst $(MODULE_FILES) +- cat kernel_syms.lst $(top_srcdir)/grub-core/extra_deps.lst > $@.new ++extra_deps.lst: ++ @echo $(EXTRA_DEPS) | sed "s/\s*:\s*/\n/g" > $@ ++ ++syminfo.lst: gensyminfo.sh kernel_syms.lst extra_deps.lst $(MODULE_FILES) ++ cat kernel_syms.lst extra_deps.lst > $@.new + for m in $(MODULE_FILES); do \ + sh $< $$m >> $@.new || exit 1; \ + done +@@ -467,7 +470,7 @@ syminfo.lst: gensyminfo.sh kernel_syms.lst $(top_srcdir)/grub-core/extra_deps.ls + moddep.lst: syminfo.lst genmoddep.awk video.lst + cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1) + platform_DATA += moddep.lst +-CLEANFILES += config.log syminfo.lst moddep.lst ++CLEANFILES += config.log syminfo.lst moddep.lst extra_deps.lst + + $(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) build-grub-module-verifier$(BUILD_EXEEXT) + TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@ +diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk +index cc987a53aa8..ab457cb2b56 100644 +--- a/grub-core/genmoddep.awk ++++ b/grub-core/genmoddep.awk +@@ -35,7 +35,7 @@ BEGIN { + for (i = 3; i <= NF; i++) { + modtab[$2] = modtab[$2] " " $i; + } +- } ++ } else if ($1 == "") {} #Skip empty lines + else { + printf "error: %u: unrecognized input format\n", NR >"/dev/stderr"; + error++; diff --git a/0204-search-new-efidisk-only-option-on-EFI-systems.patch b/0204-search-new-efidisk-only-option-on-EFI-systems.patch deleted file mode 100644 index 3f6194ab..00000000 --- a/0204-search-new-efidisk-only-option-on-EFI-systems.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Renaud=20M=C3=A9trich?= -Date: Tue, 8 Feb 2022 08:39:11 +0100 -Subject: [PATCH] search: new --efidisk-only option on EFI systems -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When using 'search' on EFI systems, we sometimes want to exclude devices -that are not EFI disks (e.g. md, lvm). -This is typically used when wanting to chainload when having a software -raid (md) for EFI partition: -with no option, 'search --file /EFI/redhat/shimx64.efi' sets root envvar -to 'md/boot_efi' which cannot be used for chainloading since there is no -effective EFI device behind. - -This commit also refactors handling of --no-floppy option. - -Signed-off-by: Renaud Métrich -[rharwood: apply rmetrich's flags initialization fix] -Signed-off-by: Robbie Harwood ---- - grub-core/commands/search.c | 27 +++++++++++++++++++++++---- - grub-core/commands/search_wrap.c | 18 ++++++++++++------ - include/grub/search.h | 15 ++++++++++++--- - 3 files changed, 47 insertions(+), 13 deletions(-) - -diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index 51656e361c..57d26ced8a 100644 ---- a/grub-core/commands/search.c -+++ b/grub-core/commands/search.c -@@ -47,7 +47,7 @@ struct search_ctx - { - const char *key; - const char *var; -- int no_floppy; -+ enum search_flags flags; - char **hints; - unsigned nhints; - int count; -@@ -62,10 +62,29 @@ iterate_device (const char *name, void *data) - int found = 0; - - /* Skip floppy drives when requested. */ -- if (ctx->no_floppy && -+ if (ctx->flags & SEARCH_FLAGS_NO_FLOPPY && - name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9') - return 0; - -+ /* Limit to EFI disks when requested. */ -+ if (ctx->flags & SEARCH_FLAGS_EFIDISK_ONLY) -+ { -+ grub_device_t dev; -+ dev = grub_device_open (name); -+ if (! dev) -+ { -+ grub_errno = GRUB_ERR_NONE; -+ return 0; -+ } -+ if (! dev->disk || dev->disk->dev->id != GRUB_DISK_DEVICE_EFIDISK_ID) -+ { -+ grub_device_close (dev); -+ grub_errno = GRUB_ERR_NONE; -+ return 0; -+ } -+ grub_device_close (dev); -+ } -+ - #ifdef DO_SEARCH_FS_UUID - #define compare_fn grub_strcasecmp - #else -@@ -261,13 +280,13 @@ try (struct search_ctx *ctx) - } - - void --FUNC_NAME (const char *key, const char *var, int no_floppy, -+FUNC_NAME (const char *key, const char *var, enum search_flags flags, - char **hints, unsigned nhints) - { - struct search_ctx ctx = { - .key = key, - .var = var, -- .no_floppy = no_floppy, -+ .flags = flags, - .hints = hints, - .nhints = nhints, - .count = 0, -diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c -index 47fc8eb996..0b62acf853 100644 ---- a/grub-core/commands/search_wrap.c -+++ b/grub-core/commands/search_wrap.c -@@ -40,6 +40,7 @@ static const struct grub_arg_option options[] = - N_("Set a variable to the first device found."), N_("VARNAME"), - ARG_TYPE_STRING}, - {"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0}, -+ {"efidisk-only", 0, 0, N_("Only probe EFI disks."), 0, 0}, - {"hint", 'h', GRUB_ARG_OPTION_REPEATABLE, - N_("First try the device HINT. If HINT ends in comma, " - "also try subpartitions"), N_("HINT"), ARG_TYPE_STRING}, -@@ -73,6 +74,7 @@ enum options - SEARCH_FS_UUID, - SEARCH_SET, - SEARCH_NO_FLOPPY, -+ SEARCH_EFIDISK_ONLY, - SEARCH_HINT, - SEARCH_HINT_IEEE1275, - SEARCH_HINT_BIOS, -@@ -89,6 +91,7 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) - const char *id = 0; - int i = 0, j = 0, nhints = 0; - char **hints = NULL; -+ enum search_flags flags = 0; - - if (state[SEARCH_HINT].set) - for (i = 0; state[SEARCH_HINT].args[i]; i++) -@@ -180,15 +183,18 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) - goto out; - } - -+ if (state[SEARCH_NO_FLOPPY].set) -+ flags |= SEARCH_FLAGS_NO_FLOPPY; -+ -+ if (state[SEARCH_EFIDISK_ONLY].set) -+ flags |= SEARCH_FLAGS_EFIDISK_ONLY; -+ - if (state[SEARCH_LABEL].set) -- grub_search_label (id, var, state[SEARCH_NO_FLOPPY].set, -- hints, nhints); -+ grub_search_label (id, var, flags, hints, nhints); - else if (state[SEARCH_FS_UUID].set) -- grub_search_fs_uuid (id, var, state[SEARCH_NO_FLOPPY].set, -- hints, nhints); -+ grub_search_fs_uuid (id, var, flags, hints, nhints); - else if (state[SEARCH_FILE].set) -- grub_search_fs_file (id, var, state[SEARCH_NO_FLOPPY].set, -- hints, nhints); -+ grub_search_fs_file (id, var, flags, hints, nhints); - else - grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type"); - -diff --git a/include/grub/search.h b/include/grub/search.h -index d80347df34..4190aeb2cb 100644 ---- a/include/grub/search.h -+++ b/include/grub/search.h -@@ -19,11 +19,20 @@ - #ifndef GRUB_SEARCH_HEADER - #define GRUB_SEARCH_HEADER 1 - --void grub_search_fs_file (const char *key, const char *var, int no_floppy, -+enum search_flags -+ { -+ SEARCH_FLAGS_NO_FLOPPY = 1, -+ SEARCH_FLAGS_EFIDISK_ONLY = 2 -+ }; -+ -+void grub_search_fs_file (const char *key, const char *var, -+ enum search_flags flags, - char **hints, unsigned nhints); --void grub_search_fs_uuid (const char *key, const char *var, int no_floppy, -+void grub_search_fs_uuid (const char *key, const char *var, -+ enum search_flags flags, - char **hints, unsigned nhints); --void grub_search_label (const char *key, const char *var, int no_floppy, -+void grub_search_label (const char *key, const char *var, -+ enum search_flags flags, - char **hints, unsigned nhints); - - #endif diff --git a/0205-Revert-mm-Assert-that-we-preserve-header-vs-region-a.patch b/0205-Revert-mm-Assert-that-we-preserve-header-vs-region-a.patch new file mode 100644 index 00000000..1a224b3d --- /dev/null +++ b/0205-Revert-mm-Assert-that-we-preserve-header-vs-region-a.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Fri, 8 Mar 2024 16:54:43 -0600 +Subject: [PATCH] Revert "mm: Assert that we preserve header vs region + alignment" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 1df8fe66c57087eb33bd6dc69f786ed124615aa7. + +This is temporal while we find the reason for + +In file included from ../../include/grub/mm_private.h:23, + from ../../include/grub/relocator_private.h:24, + from ../../grub-core/lib/efi/relocator.c:20: +../../include/grub/mm_private.h: In function ‘grub_mm_size_sanity_check’: +../../include/grub/misc.h:36:56: error: duplicate case value + 36 | #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } + | ^~~~ +../../include/grub/mm_private.h:105:3: note: in expansion of macro ‘COMPILE_TIME_ASSERT’ + 105 | COMPILE_TIME_ASSERT ((sizeof (struct grub_mm_region) % + | ^~~~~~~~~~~~~~~~~~~ +../../include/grub/misc.h:36:48: note: previously used here + 36 | #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } + | ^~~~ +../../include/grub/mm_private.h:105:3: note: in expansion of macro ‘COMPILE_TIME_ASSERT’ + 105 | COMPILE_TIME_ASSERT ((sizeof (struct grub_mm_region) % + | ^~~~~~~~~~~~~~~~~~~ +../../include/grub/misc.h:36:56: error: duplicate case value + 36 | #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } + | ^~~~ +../../include/grub/mm_private.h:112:3: note: in expansion of macro ‘COMPILE_TIME_ASSERT’ + 112 | COMPILE_TIME_ASSERT (sizeof (struct grub_mm_header) == GRUB_MM_ALIGN); + | ^~~~~~~~~~~~~~~~~~~ +../../include/grub/misc.h:36:48: note: previously used here + 36 | #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } + | ^~~~ +../../include/grub/mm_private.h:112:3: note: in expansion of macro ‘COMPILE_TIME_ASSERT’ + 112 | COMPILE_TIME_ASSERT (sizeof (struct grub_mm_header) == GRUB_MM_ALIGN); + | ^~~~~~~~~~~~~~~~~~~ +--- + include/grub/mm_private.h | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/include/grub/mm_private.h b/include/grub/mm_private.h +index 96c2d816be6..2481ee1fa20 100644 +--- a/include/grub/mm_private.h ++++ b/include/grub/mm_private.h +@@ -20,7 +20,6 @@ + #define GRUB_MM_PRIVATE_H 1 + + #include +-#include + + /* For context, see kern/mm.c */ + +@@ -99,17 +98,4 @@ typedef struct grub_mm_region + extern grub_mm_region_t EXPORT_VAR (grub_mm_base); + #endif + +-static inline void +-grub_mm_size_sanity_check (void) { +- /* Ensure we preserve alignment when doing h = (grub_mm_header_t) (r + 1). */ +- COMPILE_TIME_ASSERT ((sizeof (struct grub_mm_region) % +- sizeof (struct grub_mm_header)) == 0); +- +- /* +- * GRUB_MM_ALIGN is supposed to represent cell size, and a mm_header is +- * supposed to be 1 cell. +- */ +- COMPILE_TIME_ASSERT (sizeof (struct grub_mm_header) == GRUB_MM_ALIGN); +-} +- + #endif diff --git a/0206-make-use-the-_CPU-variety-of-build-flags-for-PROGRAM.patch b/0206-make-use-the-_CPU-variety-of-build-flags-for-PROGRAM.patch new file mode 100644 index 00000000..4f56149d --- /dev/null +++ b/0206-make-use-the-_CPU-variety-of-build-flags-for-PROGRAM.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 13 Mar 2024 15:11:15 -0600 +Subject: [PATCH] make: use the _CPU variety of build flags for PROGRAM and + LIBRARY + +Signed-off-by: Peter Jones +--- + conf/Makefile.common | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/conf/Makefile.common b/conf/Makefile.common +index 9feac7434da..f8c2f6bd881 100644 +--- a/conf/Makefile.common ++++ b/conf/Makefile.common +@@ -60,15 +60,14 @@ LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S + CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) + CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +-CFLAGS_PROGRAM = $(UTILS_CFLAGS) +-LDFLAGS_PROGRAM = $(UTILS_LDFLAGS) +-CPPFLAGS_PROGRAM = $(UTILS_CPPFLAGS) +-CCASFLAGS_PROGRAM = $(UTILS_CCASFLAGS) ++CFLAGS_PROGRAM = $(CFLAGS_CPU) ++LDFLAGS_PROGRAM = $(LDFLAGS_CPU) ++CPPFLAGS_PROGRAM = $(CPPFLAGS_CPU) ++CCASFLAGS_PROGRAM = $(CCASFLAGS_CPU) + +-CFLAGS_LIBRARY = $(UTILS_CFLAGS) +-LDFLAGS_LIBRARY = $(UTILS_LDFLAGS) +-CPPFLAGS_LIBRARY = $(UTILS_CPPFLAGS) +-CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS) ++CFLAGS_LIBRARY = $(CFLAGS_CPU) ++CPPFLAGS_LIBRARY = $(CPPFLAGS_CPU) ++CCASFLAGS_LIBRARY = $(CCASFLAGS_CPU) + + # Other variables + diff --git a/0207-Work-around-extra_deps.lst-issue.patch b/0207-Work-around-extra_deps.lst-issue.patch new file mode 100644 index 00000000..0481cd55 --- /dev/null +++ b/0207-Work-around-extra_deps.lst-issue.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 13 Mar 2024 14:06:43 -0400 +Subject: [PATCH] Work around extra_deps.lst issue + +--- + grub-core/Makefile.am | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am +index 77f8329cd43..aa172391fdf 100644 +--- a/grub-core/Makefile.am ++++ b/grub-core/Makefile.am +@@ -460,6 +460,10 @@ extra_deps.lst: + @echo $(EXTRA_DEPS) | sed "s/\s*:\s*/\n/g" > $@ + + syminfo.lst: gensyminfo.sh kernel_syms.lst extra_deps.lst $(MODULE_FILES) ++ if ! [ -f extra_deps.lst ] ; then \ ++ echo Missing extra_deps.lst ; \ ++ echo $(EXTRA_DEPS) | sed "s/\s*:\s*/\n/g" > extra_deps.lst ; \ ++ fi + cat kernel_syms.lst extra_deps.lst > $@.new + for m in $(MODULE_FILES); do \ + sh $< $$m >> $@.new || exit 1; \ diff --git a/0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch b/0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch deleted file mode 100644 index 5b450f9f..00000000 --- a/0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Dimitri John Ledkov -Date: Fri, 4 Mar 2022 11:29:31 +0100 -Subject: [PATCH] grub-core/loader/arm64/linux.c: do not validate kernel twice - -Call to grub_file_open(, GRUB_FILE_TYPE_LINUX_KERNEL) already passes -the kernel file through shim-lock verifier when secureboot is on. Thus -there is no need to validate the kernel image again. And when doing so -again, duplicate PCR measurement is performed, breaking measurements -compatibility with 2.04+linuxefi. - -This patch must not be ported to older editions of grub code bases -that do not have verifiers framework, or it is not builtin, or -shim-lock-verifier is an optional module. - -Signed-off-by: Dimitri John Ledkov ---- - grub-core/loader/arm64/linux.c | 13 ------------- - 1 file changed, 13 deletions(-) - -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index f18d90bd74..d2af47c2c0 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -34,7 +34,6 @@ - #include - #include - #include --#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -341,7 +340,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - grub_off_t filelen; - grub_uint32_t align; - void *kernel = NULL; -- int rc; - - grub_dl_ref (my_mod); - -@@ -370,17 +368,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - goto fail; - } - -- if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) -- { -- rc = grub_linuxefi_secure_validate (kernel, filelen); -- if (rc <= 0) -- { -- grub_error (GRUB_ERR_INVALID_COMMAND, -- N_("%s has invalid signature"), argv[0]); -- goto fail; -- } -- } -- - if (grub_arch_efi_linux_check_image (kernel) != GRUB_ERR_NONE) - goto fail; - if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align) != GRUB_ERR_NONE) diff --git a/0208-include-proper-attribute-for-an-EFI-API-call-definit.patch b/0208-include-proper-attribute-for-an-EFI-API-call-definit.patch new file mode 100644 index 00000000..ad965b6c --- /dev/null +++ b/0208-include-proper-attribute-for-an-EFI-API-call-definit.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Thu, 21 Mar 2024 16:27:25 -0600 +Subject: [PATCH] include proper attribute for an EFI API call definition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Otherwise we observe the following issue + +../../grub-core/net/efi/http.c: In function ‘efihttp_request’: +../../grub-core/net/efi/http.c:233:28: error: passing argument 3 of ‘b->create_event’ from incompatible pointer type [-Wincompatible-pointer-types] + 233 | grub_efi_http_request_callback, NULL, + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | | + | void (*)(void *, void *) +../../grub-core/net/efi/http.c:233:28: note: expected ‘void (__attribute__((ms_abi)) *)(void *, void *)’ but argument is of type ‘void (*)(void *, void *)’ +--- + grub-core/net/efi/http.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c +index 0568ea5d43e..6fecb261c55 100644 +--- a/grub-core/net/efi/http.c ++++ b/grub-core/net/efi/http.c +@@ -131,14 +131,14 @@ static grub_efi_boolean_t request_callback_done; + static grub_efi_boolean_t response_callback_done; + + static void +-grub_efi_http_request_callback (grub_efi_event_t event __attribute__ ((unused)), ++__grub_efi_api grub_efi_http_request_callback (grub_efi_event_t event __attribute__ ((unused)), + void *context __attribute__ ((unused))) + { + request_callback_done = 1; + } + + static void +-grub_efi_http_response_callback (grub_efi_event_t event __attribute__ ((unused)), ++__grub_efi_api grub_efi_http_response_callback (grub_efi_event_t event __attribute__ ((unused)), + void *context __attribute__ ((unused))) + { + response_callback_done = 1; diff --git a/0209-cast-grub_error-status-parameter.patch b/0209-cast-grub_error-status-parameter.patch new file mode 100644 index 00000000..0cea65b2 --- /dev/null +++ b/0209-cast-grub_error-status-parameter.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Fri, 22 Mar 2024 12:12:02 -0600 +Subject: [PATCH] cast grub_error status parameter +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +For some reason, the compiler concludes that the status variable is +ultimately a 'long unsigned int' but status is a 'unsigned' (not a +long) so temporally cast it to unsigned otherwise we see the following + +../../grub-core/net/efi/http.c: In function ‘efihttp_request’: +../../grub-core/net/efi/http.c:251:39: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘grub_efi_status_t’ {aka ‘long unsigned int’} [-Wformat=] + 251 | return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ + | | + | grub_efi_status_t {aka long unsigned int} +--- + grub-core/net/efi/http.c | 6 +++--- + grub-core/net/efi/net.c | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c +index 6fecb261c55..5bdb47548f8 100644 +--- a/grub-core/net/efi/http.c ++++ b/grub-core/net/efi/http.c +@@ -236,7 +236,7 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, + if (status != GRUB_EFI_SUCCESS) + { + grub_free (request_data.url); +- return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); ++ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", (unsigned) status); + } + + status = http->request(http, &request_token); +@@ -248,7 +248,7 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, + { + b->close_event(request_token.event); + grub_free (request_data.url); +- return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status); ++ return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", (unsigned) status); + } + /* TODO: Add Timeout */ + while (!request_callback_done) +@@ -273,7 +273,7 @@ efihttp_request (grub_efi_http_t *http, char *server, char *name, int use_https, + { + b->close_event(request_token.event); + grub_free (request_data.url); +- return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); ++ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", (unsigned) status); + } + + response_token.status = GRUB_EFI_SUCCESS; +diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c +index 0a1e604b5bd..1b13603a63c 100644 +--- a/grub-core/net/efi/net.c ++++ b/grub-core/net/efi/net.c +@@ -706,7 +706,7 @@ grub_efi_service_binding (grub_efi_handle_t dev, grub_guid_t *service_binding_gu + status = service->create_child(service, &child_dev); + if (status != GRUB_EFI_SUCCESS) + { +- grub_error (GRUB_ERR_IO, N_("Failed to create child device of http service %x"), status); ++ grub_error (GRUB_ERR_IO, N_("Failed to create child device of http service %x"), (unsigned) status); + return NULL; + } + diff --git a/0210-remove-unused-varible.patch b/0210-remove-unused-varible.patch new file mode 100644 index 00000000..2a10b101 --- /dev/null +++ b/0210-remove-unused-varible.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Fri, 22 Mar 2024 14:20:06 -0600 +Subject: [PATCH] remove unused varible +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Otherwise compiler complains with: + +../../grub-core/commands/efi/connectefi.c:143:20: error: unused variable ‘j’ [-Werror=unused-variable] + 143 | unsigned j; + | ^ + +Signed-off-by: Leo Sandoval +--- + grub-core/commands/efi/connectefi.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/grub-core/commands/efi/connectefi.c b/grub-core/commands/efi/connectefi.c +index 6c397f8f508..9d02f2780f6 100644 +--- a/grub-core/commands/efi/connectefi.c ++++ b/grub-core/commands/efi/connectefi.c +@@ -140,7 +140,6 @@ loop: + { + grub_efi_handle_t handle = handles[i]; + grub_efi_status_t status; +- unsigned j; + + /* Skip already handled handles */ + if (is_in_list (handle)) diff --git a/0211-cast-grub_net_bootp_packet-pointer.patch b/0211-cast-grub_net_bootp_packet-pointer.patch new file mode 100644 index 00000000..b98d9b21 --- /dev/null +++ b/0211-cast-grub_net_bootp_packet-pointer.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Fri, 22 Mar 2024 18:28:17 -0600 +Subject: [PATCH] cast grub_net_bootp_packet pointer +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Otherwise compiler complains with: + +../../grub-core/net/drivers/efi/efinet.c: In function ‘grub_efi_net_config_real’: +../../grub-core/net/drivers/efi/efinet.c:876:28: error: cannot convert to a pointer type + 876 | dhcp_ack = (struct grub_net_bootp_packet *) pxe_mode->dhcp_ack; + | ^~~~~~~~~~~~~~~~~~~~~ +../../grub-core/net/drivers/efi/efinet.c:881:57: error: initialization of ‘struct grub_net_bootp_packet *’ from incompatible pointer type ‘grub_efi_pxe_packet_t *’ [-Wincompatible-pointer-types] + 881 | struct grub_net_bootp_packet *proxy_offer = &pxe_mode->proxy_offer; + | ^ + +Signed-off-by: Leo Sandoval +--- + grub-core/net/drivers/efi/efinet.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 83005ea9f88..4591d0757ec 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -872,12 +872,12 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, + { + grub_dprintf ("efinet", "using ipv4 and dhcp\n"); + +- struct grub_net_bootp_packet *dhcp_ack = &pxe_mode->dhcp_ack; ++ struct grub_net_bootp_packet *dhcp_ack = (struct grub_net_bootp_packet *) &pxe_mode->dhcp_ack; + + if (pxe_mode->proxy_offer_received) + { + grub_dprintf ("efinet", "proxy offer receive"); +- struct grub_net_bootp_packet *proxy_offer = &pxe_mode->proxy_offer; ++ struct grub_net_bootp_packet *proxy_offer = (struct grub_net_bootp_packet *) &pxe_mode->proxy_offer; + + if (proxy_offer && dhcp_ack->boot_file[0] == '\0') + { diff --git a/0212-libtasn1-fix-string-overflow-warning.patch b/0212-libtasn1-fix-string-overflow-warning.patch new file mode 100644 index 00000000..50d151ab --- /dev/null +++ b/0212-libtasn1-fix-string-overflow-warning.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Thu, 11 Jan 2024 12:05:20 -0600 +Subject: [PATCH] libtasn1: fix string overflow warning + +Patched also at the libtasn1 project with commit + + c54e523d9dacdb7eec7f20964df12df9b80f467c + Author: Simo Sorce + AuthorDate: Tue May 11 14:18:10 2021 -0400 + Commit: Simo Sorce + CommitDate: Tue May 11 14:26:04 2021 -0400 + + Parent: 890a8a9 Fix resource leak (node) + Contained: master + Follows: v4.16.0 (48) + Precedes: v4.17.0 (5) + + Fix String overflow warning + + Scanner Output + -------------- + rror: COMPILER_WARNING (CWE-758): [#def2] + libtasn1-4.16.0/lib/element.c: scope_hint: In function '_asn1_append_sequence_set' + libtasn1-4.16.0/lib/element.c:186:7: warning[-Wstringop-overflow=]: '_asn1_ltostr' accessing 22 bytes in a region of size 21 + # 186 | _asn1_ltostr (n, temp + 1); + # | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + libtasn1-4.16.0/lib/element.c:186:7: note: referencing argument 2 of type 'char *' + libtasn1-4.16.0/lib/element.c:30: included_from: Included from here. + libtasn1-4.16.0/lib/parser_aux.h:70:7: note: in a call to function '_asn1_ltostr' + # 70 | char *_asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]); + # | ^~~~~~~~~~~~ + # 184| n++; + # 185| temp[0] = '?'; + # 186|-> _asn1_ltostr (n, temp + 1); + # 187| } + # 188| _asn1_set_name (p2, temp); + +Signed-off-by: Leo Sandoval +--- + grub-core/lib/libtasn1/lib/element.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/lib/libtasn1/lib/element.c b/grub-core/lib/libtasn1/lib/element.c +index ed761ff56bd..8cc73455aee 100644 +--- a/grub-core/lib/libtasn1/lib/element.c ++++ b/grub-core/lib/libtasn1/lib/element.c +@@ -143,7 +143,7 @@ int + _asn1_append_sequence_set (asn1_node node, struct node_tail_cache_st *pcache) + { + asn1_node p, p2; +- char temp[LTOSTR_MAX_SIZE]; ++ char temp[LTOSTR_MAX_SIZE + 1]; + long n; + + if (!node || !(node->down)) diff --git a/0004-Add-support-for-Linux-EFI-stub-loading.patch b/0213-Add-support-for-Linux-EFI-stub-loading.patch similarity index 55% rename from 0004-Add-support-for-Linux-EFI-stub-loading.patch rename to 0213-Add-support-for-Linux-EFI-stub-loading.patch index 745973e5..c930f1c3 100644 --- a/0004-Add-support-for-Linux-EFI-stub-loading.patch +++ b/0213-Add-support-for-Linux-EFI-stub-loading.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Matthew Garrett -Date: Tue, 10 Jul 2012 11:58:52 -0400 +Date: Mon, 1 Apr 2024 13:20:18 -0600 Subject: [PATCH] Add support for Linux EFI stub loading. Also: @@ -26,32 +26,25 @@ grub-2.00-no-insmod-on-sb.patch), but this should be more correct. It moves the check into grub_dl_load_file. --- grub-core/Makefile.core.def | 16 +- - grub-core/kern/dl.c | 21 +++ - grub-core/kern/efi/efi.c | 28 ++++ + grub-core/kern/dl.c | 22 +++ grub-core/kern/efi/mm.c | 32 ++++ - grub-core/loader/arm64/linux.c | 118 +++++++------- - grub-core/loader/arm64/xen_boot.c | 1 - - grub-core/loader/efi/linux.c | 70 ++++++++ + grub-core/loader/efi/linux.c | 47 ++++++ grub-core/loader/i386/efi/linux.c | 335 ++++++++++++++++++++++++++++++++++++++ grub-core/loader/i386/pc/linux.c | 10 +- - include/grub/arm/linux.h | 9 + - include/grub/arm64/linux.h | 9 + - include/grub/efi/efi.h | 7 +- + include/grub/efi/efi.h | 3 + include/grub/efi/linux.h | 31 ++++ - 13 files changed, 618 insertions(+), 69 deletions(-) - create mode 100644 grub-core/loader/efi/linux.c + 8 files changed, 485 insertions(+), 11 deletions(-) create mode 100644 grub-core/loader/i386/efi/linux.c create mode 100644 include/grub/efi/linux.h diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 8022e1c0a7..45d3edaa4d 100644 +index a5a3ee31800..3f6e944d6a5 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def -@@ -1734,13 +1734,6 @@ module = { - enable = i386_pc; +@@ -1831,12 +1831,6 @@ module = { }; -- + -module = { - name = linux16; - common = loader/i386/pc/linux.c; @@ -61,37 +54,47 @@ index 8022e1c0a7..45d3edaa4d 100644 module = { name = ntldr; i386_pc = loader/i386/pc/ntldr.c; -@@ -1796,7 +1789,9 @@ module = { +@@ -1892,10 +1886,9 @@ module = { module = { name = linux; - x86 = loader/i386/linux.c; -+ i386_pc = loader/i386/pc/linux.c; -+ x86_64_efi = loader/i386/efi/linux.c; -+ i386_efi = loader/i386/efi/linux.c; i386_xen_pvh = loader/i386/linux.c; xen = loader/i386/xen.c; - i386_pc = lib/i386/pc/vesa_modes_table.c; -@@ -1811,9 +1806,14 @@ module = { - arm64 = loader/arm64/linux.c; - riscv32 = loader/riscv/linux.c; - riscv64 = loader/riscv/linux.c; -+ emu = loader/emu/linux.c; +- i386_pc = lib/i386/pc/vesa_modes_table.c; ++ i386_pc = loader/i386/pc/linux.c; + i386_xen_pvh = lib/i386/pc/vesa_modes_table.c; + mips = loader/mips/linux.c; + powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c; +@@ -1908,11 +1901,14 @@ module = { + loongarch64 = loader/efi/linux.c; + riscv32 = loader/efi/linux.c; + riscv64 = loader/efi/linux.c; +- i386_efi = loader/efi/linux.c; +- x86_64_efi = loader/efi/linux.c; ++ i386_efi = loader/i386/efi/linux.c; ++ x86_64_efi = loader/i386/efi/linux.c; + emu = loader/emu/linux.c; + fdt = lib/fdt.c; -+ common = loader/linux.c; common = lib/cmdline.c; - enable = noemu; -+ + efi = loader/efi/linux.c; ++ efi = loader/i386/linux.c; }; module = { diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index 48f8a79073..b714937095 100644 +index c55f0ecf931..d48d4131ba7 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c -@@ -38,6 +38,14 @@ +@@ -32,12 +32,21 @@ + #include + #include + #include ++#include + + /* Platforms where modules are in a readonly area of memory. */ + #if defined(GRUB_MACHINE_QEMU) #define GRUB_MODULES_MACHINE_READONLY #endif @@ -106,12 +109,12 @@ index 48f8a79073..b714937095 100644 #pragma GCC diagnostic ignored "-Wcast-align" -@@ -695,6 +703,19 @@ grub_dl_load_file (const char *filename) +@@ -861,6 +870,19 @@ grub_dl_load_file (const char *filename) void *core = 0; grub_dl_t mod = 0; +#ifdef GRUB_MACHINE_EFI -+ if (grub_efi_secure_boot ()) ++ if (grub_efi_get_secureboot ()) + { +#if 0 + /* This is an error, but grub2-mkconfig still generates a pile of @@ -126,50 +129,11 @@ index 48f8a79073..b714937095 100644 grub_boot_time ("Loading module %s", filename); file = grub_file_open (filename, GRUB_FILE_TYPE_GRUB_MODULE); -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 8cff7be028..35b8f67060 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -286,6 +286,34 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, - return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL); - } - -+grub_efi_boolean_t -+grub_efi_secure_boot (void) -+{ -+ grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID; -+ grub_size_t datasize; -+ char *secure_boot = NULL; -+ char *setup_mode = NULL; -+ grub_efi_boolean_t ret = 0; -+ -+ secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize); -+ -+ if (datasize != 1 || !secure_boot) -+ goto out; -+ -+ setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize); -+ -+ if (datasize != 1 || !setup_mode) -+ goto out; -+ -+ if (*secure_boot && !*setup_mode) -+ ret = 1; -+ -+ out: -+ grub_free (secure_boot); -+ grub_free (setup_mode); -+ return ret; -+} -+ - #pragma GCC diagnostic ignored "-Wcast-align" - - /* Search the mods section from the PE32/PE32+ image. This code uses diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 9838fb2f50..f6aef0ef64 100644 +index df443f434d4..fb9dbf52528 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c -@@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address, +@@ -112,6 +112,38 @@ grub_efi_drop_alloc (grub_efi_physical_address_t address, } } @@ -186,7 +150,7 @@ index 9838fb2f50..f6aef0ef64 100644 + return 0; + + b = grub_efi_system_table->boot_services; -+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address); ++ status = b->allocate_pages (GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address); + + if (status != GRUB_EFI_SUCCESS) + return 0; @@ -196,7 +160,7 @@ index 9838fb2f50..f6aef0ef64 100644 + /* Uggh, the address 0 was allocated... This is too annoying, + so reallocate another one. */ + address = max; -+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address); ++ status = b->allocate_pages (GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address); + grub_efi_free_pages (0, pages); + if (status != GRUB_EFI_SUCCESS) + return 0; @@ -208,231 +172,27 @@ index 9838fb2f50..f6aef0ef64 100644 /* Allocate pages. Return the pointer to the first of allocated pages. */ void * grub_efi_allocate_pages_real (grub_efi_physical_address_t address, -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index ef3e9f9444..a312c66868 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -29,6 +29,7 @@ +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index bfbd95aeef0..925394d1767 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -25,10 +25,12 @@ + #include + #include + #include ++#include #include #include #include -+#include #include ++#include + #include #include #include -@@ -41,6 +42,7 @@ static int loaded; +@@ -87,6 +89,51 @@ static grub_efi_load_file2_t initrd_lf2 = { + grub_efi_initrd_load_file2 + }; - static void *kernel_addr; - static grub_uint64_t kernel_size; -+static grub_uint32_t handover_offset; - - static char *linux_args; - static grub_uint32_t cmdline_size; -@@ -67,7 +69,8 @@ grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh) - static grub_err_t - finalize_params_linux (void) - { -- int node, retval; -+ grub_efi_loaded_image_t *loaded_image = NULL; -+ int node, retval, len; - - void *fdt; - -@@ -102,79 +105,70 @@ finalize_params_linux (void) - if (grub_fdt_install() != GRUB_ERR_NONE) - goto failure; - -- return GRUB_ERR_NONE; -- --failure: -- grub_fdt_unload(); -- return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT"); --} -- --grub_err_t --grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) --{ -- grub_efi_memory_mapped_device_path_t *mempath; -- grub_efi_handle_t image_handle; -- grub_efi_boot_services_t *b; -- grub_efi_status_t status; -- grub_efi_loaded_image_t *loaded_image; -- int len; -- -- mempath = grub_malloc (2 * sizeof (grub_efi_memory_mapped_device_path_t)); -- if (!mempath) -- return grub_errno; -- -- mempath[0].header.type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE; -- mempath[0].header.subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE; -- mempath[0].header.length = grub_cpu_to_le16_compile_time (sizeof (*mempath)); -- mempath[0].memory_type = GRUB_EFI_LOADER_DATA; -- mempath[0].start_address = addr; -- mempath[0].end_address = addr + size; -- -- mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE; -- mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -- mempath[1].header.length = sizeof (grub_efi_device_path_t); -- -- b = grub_efi_system_table->boot_services; -- status = b->load_image (0, grub_efi_image_handle, -- (grub_efi_device_path_t *) mempath, -- (void *) addr, size, &image_handle); -- if (status != GRUB_EFI_SUCCESS) -- return grub_error (GRUB_ERR_BAD_OS, "cannot load image"); -- -- grub_dprintf ("linux", "linux command line: '%s'\n", args); -+ grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n", -+ fdt); - - /* Convert command line to UCS-2 */ -- loaded_image = grub_efi_get_loaded_image (image_handle); -+ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); -+ if (!loaded_image) -+ goto failure; -+ - loaded_image->load_options_size = len = -- (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t); -+ (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t); - loaded_image->load_options = - grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); - if (!loaded_image->load_options) -- return grub_errno; -+ return grub_error(GRUB_ERR_BAD_OS, "failed to create kernel parameters"); - - loaded_image->load_options_size = - 2 * grub_utf8_to_utf16 (loaded_image->load_options, len, -- (grub_uint8_t *) args, len, NULL); -+ (grub_uint8_t *) linux_args, len, NULL); - -- grub_dprintf ("linux", "starting image %p\n", image_handle); -- status = b->start_image (image_handle, 0, NULL); -+ return GRUB_ERR_NONE; - -- /* When successful, not reached */ -- b->unload_image (image_handle); -- grub_efi_free_pages ((grub_addr_t) loaded_image->load_options, -- GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); -+failure: -+ grub_fdt_unload(); -+ return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT"); -+} - -- return grub_errno; -+static void -+free_params (void) -+{ -+ grub_efi_loaded_image_t *loaded_image = NULL; -+ -+ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); -+ if (loaded_image) -+ { -+ if (loaded_image->load_options) -+ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_efi_uintn_t)loaded_image->load_options, -+ GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); -+ loaded_image->load_options = NULL; -+ loaded_image->load_options_size = 0; -+ } -+} -+ -+grub_err_t -+grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) -+{ -+ grub_err_t retval; -+ -+ retval = finalize_params_linux (); -+ if (retval != GRUB_ERR_NONE) -+ return grub_errno; -+ -+ grub_dprintf ("linux", "linux command line: '%s'\n", args); -+ -+ retval = grub_efi_linux_boot ((char *)addr, handover_offset, (void *)addr); -+ -+ /* Never reached... */ -+ free_params(); -+ return retval; - } - - static grub_err_t - grub_linux_boot (void) - { -- if (finalize_params_linux () != GRUB_ERR_NONE) -- return grub_errno; -- -- return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, -- kernel_size, linux_args)); -+ return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args)); - } - - static grub_err_t -@@ -288,6 +282,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - { - grub_file_t file = 0; - struct linux_arch_kernel_header lh; -+ struct grub_armxx_linux_pe_header *pe; - grub_err_t err; - - grub_dl_ref (my_mod); -@@ -333,6 +328,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); - -+ if (!grub_linuxefi_secure_validate (kernel_addr, kernel_size)) -+ { -+ grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); -+ goto fail; -+ } -+ -+ pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); -+ handover_offset = pe->opt.entry_addr; -+ - cmdline_size = grub_loader_cmdline_size (argc, argv) + sizeof (LINUX_IMAGE); - linux_args = grub_malloc (cmdline_size); - if (!linux_args) -diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c -index 22cc25eccd..d9b7a9ba40 100644 ---- a/grub-core/loader/arm64/xen_boot.c -+++ b/grub-core/loader/arm64/xen_boot.c -@@ -266,7 +266,6 @@ xen_boot (void) - return err; - - return grub_arch_efi_linux_boot_image (xen_hypervisor->start, -- xen_hypervisor->size, - xen_hypervisor->cmdline); - } - -diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -new file mode 100644 -index 0000000000..c24202a5dd ---- /dev/null -+++ b/grub-core/loader/efi/linux.c -@@ -0,0 +1,70 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2014 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ +#define SHIM_LOCK_GUID \ + { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} } + @@ -445,7 +205,7 @@ index 0000000000..c24202a5dd +grub_efi_boolean_t +grub_linuxefi_secure_validate (void *data, grub_uint32_t size) +{ -+ grub_efi_guid_t guid = SHIM_LOCK_GUID; ++ grub_guid_t guid = SHIM_LOCK_GUID; + grub_efi_shim_lock_t *shim_lock; + + shim_lock = grub_efi_locate_protocol(&guid, NULL); @@ -465,21 +225,25 @@ index 0000000000..c24202a5dd +typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *); + +grub_err_t -+grub_efi_linux_boot (void *kernel_addr, grub_off_t offset, ++grub_efi_linux_boot (void *kernel_address, grub_off_t offset, + void *kernel_params) +{ + handover_func hf; + -+ hf = (handover_func)((char *)kernel_addr + offset); ++ hf = (handover_func)((char *)kernel_address + offset); + hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); + + return GRUB_ERR_BUG; +} + +#pragma GCC diagnostic pop ++ + grub_err_t + grub_arch_efi_linux_load_image_header (grub_file_t file, + struct linux_arch_kernel_header * lh) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c new file mode 100644 -index 0000000000..bb2616a809 +index 00000000000..9bfb4ab9e3e --- /dev/null +++ b/grub-core/loader/i386/efi/linux.c @@ -0,0 +1,335 @@ @@ -537,7 +301,7 @@ index 0000000000..bb2616a809 + asm volatile ("cli"); + + return grub_efi_linux_boot ((char *)kernel_mem, handover_offset + offset, -+ params); ++ params); +} + +static grub_err_t @@ -547,17 +311,17 @@ index 0000000000..bb2616a809 + loaded = 0; + if (initrd_mem) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, -+ BYTES_TO_PAGES(params->ramdisk_size)); ++ BYTES_TO_PAGES(params->ramdisk_size)); + if (linux_cmdline) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t) -+ linux_cmdline, -+ BYTES_TO_PAGES(params->cmdline_size + 1)); ++ linux_cmdline, ++ BYTES_TO_PAGES(params->cmdline_size + 1)); + if (kernel_mem) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, -+ BYTES_TO_PAGES(kernel_size)); ++ BYTES_TO_PAGES(kernel_size)); + if (params) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params, -+ BYTES_TO_PAGES(16384)); ++ BYTES_TO_PAGES(16384)); + return GRUB_ERR_NONE; +} + @@ -631,14 +395,14 @@ index 0000000000..bb2616a809 + + if (initrd_mem && grub_errno) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, -+ BYTES_TO_PAGES(size)); ++ BYTES_TO_PAGES(size)); + + return grub_errno; +} + +static grub_err_t +grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), -+ int argc, char *argv[]) ++ int argc, char *argv[]) +{ + grub_file_t file = 0; + struct linux_i386_kernel_header lh; @@ -676,7 +440,7 @@ index 0000000000..bb2616a809 + if (! grub_linuxefi_secure_validate (kernel, filelen)) + { + grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), -+ argv[0]); ++ argv[0]); + goto fail; + } + @@ -718,7 +482,7 @@ index 0000000000..bb2616a809 + + grub_dprintf ("linux", "setting up cmdline\n"); + linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff, -+ BYTES_TO_PAGES(lh.cmdline_size + 1)); ++ BYTES_TO_PAGES(lh.cmdline_size + 1)); + + if (!linux_cmdline) + { @@ -729,8 +493,8 @@ index 0000000000..bb2616a809 + grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); + grub_create_loader_cmdline (argc, argv, + linux_cmdline + sizeof (LINUX_IMAGE) - 1, -+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1), -+ GRUB_VERIFY_KERNEL_CMDLINE); ++ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1), ++ GRUB_VERIFY_KERNEL_CMDLINE); + + lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; + @@ -740,11 +504,11 @@ index 0000000000..bb2616a809 + len = grub_file_size(file) - start; + + kernel_mem = grub_efi_allocate_pages_max(lh.pref_address, -+ BYTES_TO_PAGES(lh.init_size)); ++ BYTES_TO_PAGES(lh.init_size)); + + if (!kernel_mem) + kernel_mem = grub_efi_allocate_pages_max(0x3fffffff, -+ BYTES_TO_PAGES(lh.init_size)); ++ BYTES_TO_PAGES(lh.init_size)); + + if (!kernel_mem) + { @@ -777,16 +541,16 @@ index 0000000000..bb2616a809 + + if (linux_cmdline && !loaded) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t) -+ linux_cmdline, -+ BYTES_TO_PAGES(lh.cmdline_size + 1)); ++ linux_cmdline, ++ BYTES_TO_PAGES(lh.cmdline_size + 1)); + + if (kernel_mem && !loaded) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, -+ BYTES_TO_PAGES(kernel_size)); ++ BYTES_TO_PAGES(kernel_size)); + + if (params && !loaded) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params, -+ BYTES_TO_PAGES(16384)); ++ BYTES_TO_PAGES(16384)); + + return grub_errno; +} @@ -819,10 +583,10 @@ index 0000000000..bb2616a809 + grub_unregister_command (cmd_initrdefi); +} diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 2a29952016..8be4c3b3f4 100644 +index 600530a742b..8593d74737f 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c -@@ -474,14 +474,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -483,14 +483,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), return grub_errno; } @@ -844,7 +608,7 @@ index 2a29952016..8be4c3b3f4 100644 grub_register_command ("initrd16", grub_cmd_initrd, 0, N_("Load initrd.")); my_mod = mod; -@@ -490,5 +496,7 @@ GRUB_MOD_INIT(linux16) +@@ -499,5 +505,7 @@ GRUB_MOD_INIT(linux16) GRUB_MOD_FINI(linux16) { grub_unregister_command (cmd_linux); @@ -852,71 +616,11 @@ index 2a29952016..8be4c3b3f4 100644 grub_unregister_command (cmd_initrd); + grub_unregister_command (cmd_initrd16); } -diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index bcd5a7eb18..b582f67f66 100644 ---- a/include/grub/arm/linux.h -+++ b/include/grub/arm/linux.h -@@ -20,6 +20,7 @@ - #ifndef GRUB_ARM_LINUX_HEADER - #define GRUB_ARM_LINUX_HEADER 1 - -+#include - #include "system.h" - - #define GRUB_LINUX_ARM_MAGIC_SIGNATURE 0x016f2818 -@@ -34,9 +35,17 @@ struct linux_arm_kernel_header { - grub_uint32_t hdr_offset; - }; - -+struct grub_arm_linux_pe_header -+{ -+ grub_uint32_t magic; -+ struct grub_pe32_coff_header coff; -+ struct grub_pe32_optional_header opt; -+}; -+ - #if defined(__arm__) - # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE - # define linux_arch_kernel_header linux_arm_kernel_header -+# define grub_armxx_linux_pe_header grub_arm_linux_pe_header - #endif - - #if defined GRUB_MACHINE_UBOOT -diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index 7e22b4ab69..ea030312df 100644 ---- a/include/grub/arm64/linux.h -+++ b/include/grub/arm64/linux.h -@@ -19,6 +19,7 @@ - #ifndef GRUB_ARM64_LINUX_HEADER - #define GRUB_ARM64_LINUX_HEADER 1 - -+#include - #include - - #define GRUB_LINUX_ARM64_MAGIC_SIGNATURE 0x644d5241 /* 'ARM\x64' */ -@@ -38,9 +39,17 @@ struct linux_arm64_kernel_header - grub_uint32_t hdr_offset; /* Offset of PE/COFF header */ - }; - -+struct grub_arm64_linux_pe_header -+{ -+ grub_uint32_t magic; -+ struct grub_pe32_coff_header coff; -+ struct grub_pe64_optional_header opt; -+}; -+ - #if defined(__aarch64__) - # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE - # define linux_arch_kernel_header linux_arm64_kernel_header -+# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header - #endif - - #endif /* ! GRUB_ARM64_LINUX_HEADER */ diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 83d958f994..6295df85f3 100644 +index 3670eddc52b..83ddbe26e57 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address, +@@ -75,6 +75,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address, grub_efi_uintn_t pages); void * EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages); @@ -926,27 +630,9 @@ index 83d958f994..6295df85f3 100644 void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address, grub_efi_uintn_t pages); grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void); -@@ -88,6 +91,7 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, - const grub_efi_guid_t *guid, - void *data, - grub_size_t datasize); -+grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void); - int - EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, - const grub_efi_device_path_t *dp2); -@@ -101,8 +105,7 @@ void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); - grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); - #include - grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); --grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, -- char *args); -+grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args); - #endif - - grub_addr_t grub_efi_modules_addr (void); diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h new file mode 100644 -index 0000000000..d9ede36773 +index 00000000000..d224daafa4f --- /dev/null +++ b/include/grub/efi/linux.h @@ -0,0 +1,31 @@ @@ -978,6 +664,6 @@ index 0000000000..d9ede36773 +EXPORT_FUNC(grub_linuxefi_secure_validate) (void *data, grub_uint32_t size); +grub_err_t +EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, -+ void *kernel_param); ++ void *kernel_param); + +#endif /* ! GRUB_EFI_LINUX_HEADER */ diff --git a/0214-commands-boot-Add-API-to-pass-context-to-loader.patch b/0214-commands-boot-Add-API-to-pass-context-to-loader.patch deleted file mode 100644 index 63a2d76e..00000000 --- a/0214-commands-boot-Add-API-to-pass-context-to-loader.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chris Coulson -Date: Fri, 29 Apr 2022 21:16:02 +0100 -Subject: [PATCH] commands/boot: Add API to pass context to loader - -Loaders rely on global variables for saving context which is consumed -in the boot hook and freed in the unload hook. In the case where a loader -command is executed twice, calling grub_loader_set a second time executes -the unload hook, but in some cases this runs when the loader's global -context has already been updated, resulting in the updated context being -freed and potential use-after-free bugs when the boot hook is subsequently -called. - -This adds a new API (grub_loader_set_ex) which allows a loader to specify -context that is passed to its boot and unload hooks. This is an alternative -to requiring that loaders call grub_loader_unset before mutating their -global context. - -Signed-off-by: Chris Coulson -(cherry picked from commit 4322a64dde7e8fedb58e50b79408667129d45dd3) ---- - grub-core/commands/boot.c | 66 +++++++++++++++++++++++++++++++++++++++++------ - include/grub/loader.h | 5 ++++ - 2 files changed, 63 insertions(+), 8 deletions(-) - -diff --git a/grub-core/commands/boot.c b/grub-core/commands/boot.c -index bbca81e947..53691a62d9 100644 ---- a/grub-core/commands/boot.c -+++ b/grub-core/commands/boot.c -@@ -27,10 +27,20 @@ - - GRUB_MOD_LICENSE ("GPLv3+"); - --static grub_err_t (*grub_loader_boot_func) (void); --static grub_err_t (*grub_loader_unload_func) (void); -+static grub_err_t (*grub_loader_boot_func) (void *); -+static grub_err_t (*grub_loader_unload_func) (void *); -+static void *grub_loader_context; - static int grub_loader_flags; - -+struct grub_simple_loader_hooks -+{ -+ grub_err_t (*boot) (void); -+ grub_err_t (*unload) (void); -+}; -+ -+/* Don't heap allocate this to avoid making grub_loader_set fallible. */ -+static struct grub_simple_loader_hooks simple_loader_hooks; -+ - struct grub_preboot - { - grub_err_t (*preboot_func) (int); -@@ -44,6 +54,29 @@ static int grub_loader_loaded; - static struct grub_preboot *preboots_head = 0, - *preboots_tail = 0; - -+static grub_err_t -+grub_simple_boot_hook (void *context) -+{ -+ struct grub_simple_loader_hooks *hooks; -+ -+ hooks = (struct grub_simple_loader_hooks *) context; -+ return hooks->boot (); -+} -+ -+static grub_err_t -+grub_simple_unload_hook (void *context) -+{ -+ struct grub_simple_loader_hooks *hooks; -+ grub_err_t ret; -+ -+ hooks = (struct grub_simple_loader_hooks *) context; -+ -+ ret = hooks->unload (); -+ grub_memset (hooks, 0, sizeof (*hooks)); -+ -+ return ret; -+} -+ - int - grub_loader_is_loaded (void) - { -@@ -110,28 +143,45 @@ grub_loader_unregister_preboot_hook (struct grub_preboot *hnd) - } - - void --grub_loader_set (grub_err_t (*boot) (void), -- grub_err_t (*unload) (void), -- int flags) -+grub_loader_set_ex (grub_err_t (*boot) (void *), -+ grub_err_t (*unload) (void *), -+ void *context, -+ int flags) - { - if (grub_loader_loaded && grub_loader_unload_func) -- grub_loader_unload_func (); -+ grub_loader_unload_func (grub_loader_context); - - grub_loader_boot_func = boot; - grub_loader_unload_func = unload; -+ grub_loader_context = context; - grub_loader_flags = flags; - - grub_loader_loaded = 1; - } - -+void -+grub_loader_set (grub_err_t (*boot) (void), -+ grub_err_t (*unload) (void), -+ int flags) -+{ -+ grub_loader_set_ex (grub_simple_boot_hook, -+ grub_simple_unload_hook, -+ &simple_loader_hooks, -+ flags); -+ -+ simple_loader_hooks.boot = boot; -+ simple_loader_hooks.unload = unload; -+} -+ - void - grub_loader_unset(void) - { - if (grub_loader_loaded && grub_loader_unload_func) -- grub_loader_unload_func (); -+ grub_loader_unload_func (grub_loader_context); - - grub_loader_boot_func = 0; - grub_loader_unload_func = 0; -+ grub_loader_context = 0; - - grub_loader_loaded = 0; - } -@@ -158,7 +208,7 @@ grub_loader_boot (void) - return err; - } - } -- err = (grub_loader_boot_func) (); -+ err = (grub_loader_boot_func) (grub_loader_context); - - for (cur = preboots_tail; cur; cur = cur->prev) - if (! err) -diff --git a/include/grub/loader.h b/include/grub/loader.h -index b208642821..1846fa6c5f 100644 ---- a/include/grub/loader.h -+++ b/include/grub/loader.h -@@ -40,6 +40,11 @@ void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void), - grub_err_t (*unload) (void), - int flags); - -+void EXPORT_FUNC (grub_loader_set_ex) (grub_err_t (*boot) (void *), -+ grub_err_t (*unload) (void *), -+ void *context, -+ int flags); -+ - /* Unset current loader, if any. */ - void EXPORT_FUNC (grub_loader_unset) (void); - diff --git a/0214-fix-i386_pc-on-legacycfg-module.patch b/0214-fix-i386_pc-on-legacycfg-module.patch new file mode 100644 index 00000000..9461a9f2 --- /dev/null +++ b/0214-fix-i386_pc-on-legacycfg-module.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Tue, 2 Apr 2024 12:59:10 -0600 +Subject: [PATCH] fix i386_pc on legacycfg module + +--- + grub-core/Makefile.core.def | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 3f6e944d6a5..b045aac7c91 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -2459,6 +2459,7 @@ module = { + common = commands/legacycfg.c; + common = lib/legacy_parse.c; + emu = lib/i386/pc/vesa_modes_table.c; ++ i386_pc = lib/i386/pc/vesa_modes_table.c; + i386_efi = lib/i386/pc/vesa_modes_table.c; + x86_64_efi = lib/i386/pc/vesa_modes_table.c; + xen = lib/i386/pc/vesa_modes_table.c; diff --git a/0007-Add-secureboot-support-on-efi-chainloader.patch b/0215-Add-secureboot-support-on-efi-chainloader.patch similarity index 88% rename from 0007-Add-secureboot-support-on-efi-chainloader.patch rename to 0215-Add-secureboot-support-on-efi-chainloader.patch index 34ead63b..2e993cb6 100644 --- a/0007-Add-secureboot-support-on-efi-chainloader.patch +++ b/0215-Add-secureboot-support-on-efi-chainloader.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Raymund Will -Date: Mon, 8 Jul 2019 11:55:18 +0200 +Date: Tue, 2 Apr 2024 16:39:53 -0600 Subject: [PATCH] Add secureboot support on efi chainloader Expand the chainloader to be able to verify the image by means of shim @@ -180,103 +180,77 @@ supported yet. This patch might need a new revision once that's the case. Signed-off-by: David Abdurachmanov --- - grub-core/kern/efi/efi.c | 14 +- - grub-core/loader/arm64/linux.c | 4 +- - grub-core/loader/efi/chainloader.c | 820 +++++++++++++++++++++++++++++++++---- + grub-core/loader/efi/chainloader.c | 849 +++++++++++++++++++++++++++++++++---- grub-core/loader/efi/linux.c | 25 +- grub-core/loader/i386/efi/linux.c | 17 +- include/grub/efi/linux.h | 2 +- - include/grub/efi/pe32.h | 52 ++- - 7 files changed, 844 insertions(+), 90 deletions(-) + include/grub/efi/pe32.h | 51 ++- + 5 files changed, 848 insertions(+), 96 deletions(-) -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 35b8f67060..4a2259aa1c 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -296,14 +296,20 @@ grub_efi_secure_boot (void) - grub_efi_boolean_t ret = 0; - - secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize); -- - if (datasize != 1 || !secure_boot) -- goto out; -+ { -+ grub_dprintf ("secureboot", "No SecureBoot variable\n"); -+ goto out; -+ } -+ grub_dprintf ("secureboot", "SecureBoot: %d\n", *secure_boot); - - setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize); -- - if (datasize != 1 || !setup_mode) -- goto out; -+ { -+ grub_dprintf ("secureboot", "No SetupMode variable\n"); -+ goto out; -+ } -+ grub_dprintf ("secureboot", "SetupMode: %d\n", *setup_mode); - - if (*secure_boot && !*setup_mode) - ret = 1; -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index a312c66868..04994d5c67 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -284,6 +284,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - struct linux_arch_kernel_header lh; - struct grub_armxx_linux_pe_header *pe; - grub_err_t err; -+ int rc; - - grub_dl_ref (my_mod); - -@@ -328,7 +329,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); - -- if (!grub_linuxefi_secure_validate (kernel_addr, kernel_size)) -+ rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size); -+ if (rc < 0) - { - grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); - goto fail; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 2bd80f4db3..e6a8d4ad0e 100644 +index 2036924504b..e4ac39c87b4 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -32,6 +32,8 @@ +@@ -32,6 +32,9 @@ #include #include #include +#include ++#include +#include + #include #include #include - #include -@@ -46,9 +48,14 @@ static grub_dl_t my_mod; +@@ -45,13 +48,24 @@ GRUB_MOD_LICENSE ("GPLv3+"); - static grub_efi_physical_address_t address; - static grub_efi_uintn_t pages; + static grub_dl_t my_mod; + ++static grub_efi_physical_address_t address; ++static grub_efi_uintn_t pages; +static grub_ssize_t fsize; - static grub_efi_device_path_t *file_path; - static grub_efi_handle_t image_handle; - static grub_efi_char16_t *cmdline; ++static grub_efi_device_path_t *file_path; ++static grub_efi_handle_t image_handle; ++static grub_efi_char16_t *cmdline; +static grub_ssize_t cmdline_len; +static grub_efi_handle_t dev_handle; + -+static grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); - ++static grub_efi_status_t (__grub_efi_api *entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); ++ static grub_err_t - grub_chainloader_unload (void) -@@ -63,6 +70,7 @@ grub_chainloader_unload (void) - grub_free (cmdline); - cmdline = 0; - file_path = 0; -+ dev_handle = 0; + grub_chainloader_unload (void *context) + { +- grub_efi_handle_t image_handle = (grub_efi_handle_t) context; + grub_efi_loaded_image_t *loaded_image; + grub_efi_boot_services_t *b; - grub_dl_unref (my_mod); - return GRUB_ERR_NONE; -@@ -213,20 +221,694 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) ++ image_handle = (grub_efi_handle_t) context; + loaded_image = grub_efi_get_loaded_image (image_handle); + if (loaded_image != NULL) + grub_free (loaded_image->load_options); +@@ -66,12 +80,12 @@ grub_chainloader_unload (void *context) + static grub_err_t + grub_chainloader_boot (void *context) + { +- grub_efi_handle_t image_handle = (grub_efi_handle_t) context; + grub_efi_boot_services_t *b; + grub_efi_status_t status; + grub_efi_uintn_t exit_data_size; + grub_efi_char16_t *exit_data = NULL; + ++ image_handle = (grub_efi_handle_t) context; + b = grub_efi_system_table->boot_services; + status = b->start_image (image_handle, &exit_data_size, &exit_data); + if (status != GRUB_EFI_SUCCESS) +@@ -136,7 +150,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) + char *dir_start; + char *dir_end; + grub_size_t size; +- grub_efi_device_path_t *d, *file_path; ++ grub_efi_device_path_t *d; + + dir_start = grub_strchr (filename, ')'); + if (! dir_start) +@@ -209,24 +223,701 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) return file_path; } @@ -327,7 +301,7 @@ index 2bd80f4db3..e6a8d4ad0e 100644 +read_header (void *data, grub_efi_uint32_t size, + pe_coff_loader_image_context_t *context) +{ -+ grub_efi_guid_t guid = SHIM_LOCK_GUID; ++ grub_guid_t guid = SHIM_LOCK_GUID; + grub_efi_shim_lock_t *shim_lock; + grub_efi_status_t status; + @@ -640,8 +614,8 @@ index 2bd80f4db3..e6a8d4ad0e 100644 + grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n", + context.image_size, datasize); + -+ efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA, -+ buffer_size, &buffer); ++ efi_status = b->allocate_pool (GRUB_EFI_LOADER_DATA, ++ buffer_size, (void**)&buffer); + + if (efi_status != GRUB_EFI_SUCCESS) + { @@ -868,19 +842,19 @@ index 2bd80f4db3..e6a8d4ad0e 100644 + } + + grub_dprintf ("chain", "booting via entry point\n"); -+ efi_status = efi_call_2 (entry_point, grub_efi_image_handle, -+ grub_efi_system_table); ++ efi_status = entry_point (grub_efi_image_handle, ++ grub_efi_system_table); + + grub_dprintf ("chain", "entry_point returned %ld\n", efi_status); + grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); -+ efi_status = efi_call_1 (b->free_pool, buffer); ++ efi_status = b->free_pool (buffer); + + return 1; + +error_exit: + grub_dprintf ("chain", "error_exit: grub_errno: %d\n", grub_errno); + if (buffer) -+ efi_call_1 (b->free_pool, buffer); ++ b->free_pool (buffer); + + return 0; +} @@ -891,7 +865,7 @@ index 2bd80f4db3..e6a8d4ad0e 100644 + grub_efi_boot_services_t *b; + + b = grub_efi_system_table->boot_services; -+ efi_call_2 (b->free_pages, address, pages); ++ b->free_pages (address, pages); + grub_free (file_path); + grub_free (cmdline); + cmdline = 0; @@ -911,8 +885,8 @@ index 2bd80f4db3..e6a8d4ad0e 100644 + + b = grub_efi_system_table->boot_services; + -+ status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path, -+ boot_image, fsize, &image_handle); ++ status = b->load_image (0, grub_efi_image_handle, file_path, ++ boot_image, fsize, &image_handle); + if (status != GRUB_EFI_SUCCESS) + { + if (status == GRUB_EFI_OUT_OF_RESOURCES) @@ -965,20 +939,28 @@ index 2bd80f4db3..e6a8d4ad0e 100644 grub_efi_status_t status; grub_efi_boot_services_t *b; grub_device_t dev = 0; - grub_efi_device_path_t *dp = 0; +- grub_efi_device_path_t *dp = NULL, *file_path = NULL; - grub_efi_loaded_image_t *loaded_image; ++ grub_efi_device_path_t *dp = NULL; char *filename; void *boot_image = 0; - grub_efi_handle_t dev_handle = 0; +- grub_efi_physical_address_t address = 0; +- grub_efi_uintn_t pages = 0; +- grub_efi_char16_t *cmdline = NULL; +- grub_efi_handle_t image_handle = NULL; + int rc; ++ ++ file_path = NULL; ++ address = 0; ++ pages = 0; ++ cmdline = NULL; ++ image_handle = NULL; ++ dev_handle = 0; if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -238,15 +920,45 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), - address = 0; - image_handle = 0; - file_path = 0; -+ dev_handle = 0; +@@ -236,12 +927,42 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), b = grub_efi_system_table->boot_services; @@ -1007,6 +989,7 @@ index 2bd80f4db3..e6a8d4ad0e 100644 + } + *(--p16) = 0; + } ++ + file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE); if (! file) @@ -1019,16 +1002,18 @@ index 2bd80f4db3..e6a8d4ad0e 100644 + dev = grub_device_open (devname); + if (devname) + grub_free (devname); - if (! dev) - goto fail; - -@@ -283,17 +995,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), - if (! file_path) - goto fail; - -- grub_printf ("file path: "); -- grub_efi_print_device_path (file_path); + if (dev == NULL) + ; + else if (dev->disk) +@@ -272,19 +993,16 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + file_path = make_file_path (dp, filename); + if (file_path == NULL) + goto fail; - +- grub_printf ("file path: "); +- grub_efi_print_device_path (file_path); + } + - size = grub_file_size (file); - if (!size) + fsize = grub_file_size (file); @@ -1038,12 +1023,12 @@ index 2bd80f4db3..e6a8d4ad0e 100644 filename); goto fail; } -- pages = (((grub_efi_uintn_t) size + ((1 << 12) - 1)) >> 12); -+ pages = (((grub_efi_uintn_t) fsize + ((1 << 12) - 1)) >> 12); +- pages = (grub_efi_uintn_t) GRUB_EFI_BYTES_TO_PAGES (size); ++ pages = (grub_efi_uintn_t) GRUB_EFI_BYTES_TO_PAGES (fsize); - status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES, + status = b->allocate_pages (GRUB_EFI_ALLOCATE_ANY_PAGES, GRUB_EFI_LOADER_CODE, -@@ -307,7 +1016,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -298,7 +1016,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } boot_image = (void *) ((grub_addr_t) address); @@ -1052,7 +1037,7 @@ index 2bd80f4db3..e6a8d4ad0e 100644 { if (grub_errno == GRUB_ERR_NONE) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -317,7 +1026,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -308,7 +1026,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } #if defined (__i386__) || defined (__x86_64__) @@ -1061,7 +1046,7 @@ index 2bd80f4db3..e6a8d4ad0e 100644 { struct grub_macho_fat_header *head = boot_image; if (head->magic -@@ -326,6 +1035,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -317,6 +1035,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_uint32_t i; struct grub_macho_fat_arch *archs = (struct grub_macho_fat_arch *) (head + 1); @@ -1076,7 +1061,7 @@ index 2bd80f4db3..e6a8d4ad0e 100644 for (i = 0; i < grub_cpu_to_le32 (head->nfat_arch); i++) { if (GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT (archs[i].cputype)) -@@ -340,79 +1057,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -331,83 +1057,39 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), > ~grub_cpu_to_le32 (archs[i].size) || grub_cpu_to_le32 (archs[i].offset) + grub_cpu_to_le32 (archs[i].size) @@ -1094,9 +1079,9 @@ index 2bd80f4db3..e6a8d4ad0e 100644 } #endif -- status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path, -- boot_image, size, -- &image_handle); +- status = b->load_image (0, grub_efi_image_handle, file_path, +- boot_image, size, +- &image_handle); - if (status != GRUB_EFI_SUCCESS) + rc = grub_linuxefi_secure_validate((void *)(unsigned long)address, fsize); + grub_dprintf ("chain", "linuxefi_secure_validate: %d\n", rc); @@ -1127,6 +1112,7 @@ index 2bd80f4db3..e6a8d4ad0e 100644 - } - loaded_image->device_handle = dev_handle; - +- /* Build load options with arguments from chainloader command line. */ - if (argc > 1) - { - int i, len; @@ -1142,7 +1128,7 @@ index 2bd80f4db3..e6a8d4ad0e 100644 + grub_load_and_start_image(boot_image); + grub_file_close (file); + grub_device_close (dev); -+ grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); ++ grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0); - for (i = 1; i < argc; i++) - { @@ -1164,30 +1150,33 @@ index 2bd80f4db3..e6a8d4ad0e 100644 - grub_file_close (file); - grub_device_close (dev); - -- grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); +- /* We're finished with the source image buffer and file path now. */ +- b->free_pages (address, pages); +- grub_free (file_path); +- +- grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0); - return 0; - - fail: -- +fail: + if (dev) grub_device_close (dev); - -@@ -424,6 +1101,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -421,6 +1103,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (address) - efi_call_2 (b->free_pages, address, pages); + grub_efi_free_pages (address, pages); + if (cmdline) + grub_free (cmdline); + - grub_dl_unref (my_mod); + if (image_handle != NULL) + b->unload_image (image_handle); - return grub_errno; diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index c24202a5dd..c8ecce6dfd 100644 +index 925394d1767..0a7f8208022 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c -@@ -33,21 +33,34 @@ struct grub_efi_shim_lock +@@ -98,21 +98,36 @@ struct grub_efi_shim_lock }; typedef struct grub_efi_shim_lock grub_efi_shim_lock_t; @@ -1195,12 +1184,12 @@ index c24202a5dd..c8ecce6dfd 100644 +int grub_linuxefi_secure_validate (void *data, grub_uint32_t size) { - grub_efi_guid_t guid = SHIM_LOCK_GUID; + grub_guid_t guid = SHIM_LOCK_GUID; grub_efi_shim_lock_t *shim_lock; + grub_efi_status_t status; shim_lock = grub_efi_locate_protocol(&guid, NULL); -- + + grub_dprintf ("secureboot", "shim_lock: %p\n", shim_lock); if (!shim_lock) - return 1; @@ -1219,17 +1208,18 @@ index c24202a5dd..c8ecce6dfd 100644 + grub_dprintf ("secureboot", "Kernel signature verification passed\n"); + return 1; + } - -- return 0; ++ + grub_dprintf ("secureboot", "Kernel signature verification failed (0x%lx)\n", + (unsigned long) status); + + return -1; + +- return 0; } #pragma GCC diagnostic push diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index bb2616a809..6b24cbb948 100644 +index 9bfb4ab9e3e..b59d125286d 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -117,6 +117,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), @@ -1255,7 +1245,7 @@ index bb2616a809..6b24cbb948 100644 { - grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]); + grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), -+ argv[0]); ++ argv[0]); goto fail; } @@ -1264,7 +1254,7 @@ index bb2616a809..6b24cbb948 100644 + if (rc < 0) { grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), - argv[0]); + argv[0]); @@ -203,6 +208,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -1279,7 +1269,7 @@ index bb2616a809..6b24cbb948 100644 } + grub_dprintf ("linux", "linux_cmdline = %lx\n", -+ (unsigned long)linux_cmdline); ++ (unsigned long)linux_cmdline); + grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); grub_create_loader_cmdline (argc, argv, @@ -1289,7 +1279,7 @@ index bb2616a809..6b24cbb948 100644 params->type_of_loader = 0x21; + grub_dprintf("linux", "kernel_mem: %p handover_offset: %08x\n", -+ kernel_mem, handover_offset); ++ kernel_mem, handover_offset); fail: - @@ -1297,7 +1287,7 @@ index bb2616a809..6b24cbb948 100644 grub_file_close (file); diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h -index d9ede36773..0033d9305a 100644 +index d224daafa4f..b2cfd8c1f44 100644 --- a/include/grub/efi/linux.h +++ b/include/grub/efi/linux.h @@ -22,7 +22,7 @@ @@ -1310,10 +1300,10 @@ index d9ede36773..0033d9305a 100644 grub_err_t EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index 0ed8781f03..a43adf2746 100644 +index 9887e14b278..a39743396dc 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h -@@ -223,7 +223,11 @@ struct grub_pe64_optional_header +@@ -238,7 +238,11 @@ struct grub_pe64_optional_header struct grub_pe32_section_table { char name[8]; @@ -1326,7 +1316,7 @@ index 0ed8781f03..a43adf2746 100644 grub_uint32_t virtual_address; grub_uint32_t raw_data_size; grub_uint32_t raw_data_offset; -@@ -234,12 +238,18 @@ struct grub_pe32_section_table +@@ -249,12 +253,18 @@ struct grub_pe32_section_table grub_uint32_t characteristics; }; @@ -1349,7 +1339,7 @@ index 0ed8781f03..a43adf2746 100644 #define GRUB_PE32_SCN_ALIGN_1BYTES 0x00100000 #define GRUB_PE32_SCN_ALIGN_2BYTES 0x00200000 -@@ -248,10 +258,28 @@ struct grub_pe32_section_table +@@ -263,10 +273,26 @@ struct grub_pe32_section_table #define GRUB_PE32_SCN_ALIGN_16BYTES 0x00500000 #define GRUB_PE32_SCN_ALIGN_32BYTES 0x00600000 #define GRUB_PE32_SCN_ALIGN_64BYTES 0x00700000 @@ -1372,13 +1362,11 @@ index 0ed8781f03..a43adf2746 100644 +#define GRUB_PE32_SCN_MEM_EXECUTE 0x20000000 +#define GRUB_PE32_SCN_MEM_READ 0x40000000 +#define GRUB_PE32_SCN_MEM_WRITE 0x80000000 -+ -+ + #define GRUB_PE32_SIGNATURE_SIZE 4 - struct grub_pe32_header -@@ -274,6 +302,20 @@ struct grub_pe32_header + #if GRUB_TARGET_SIZEOF_VOID_P == 8 +@@ -292,6 +318,21 @@ struct grub_pe_image_header #endif }; @@ -1395,6 +1383,7 @@ index 0ed8781f03..a43adf2746 100644 + struct grub_pe32_coff_header coff_header; + struct grub_pe64_optional_header optional_header; +}; ++ + struct grub_pe32_fixup_block { diff --git a/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch b/0216-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch similarity index 66% rename from 0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch rename to 0216-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch index 487d5c0b..8313e06c 100644 --- a/0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +++ b/0216-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Tue, 6 Oct 2015 16:09:25 -0400 +Date: Tue, 13 Feb 2024 16:30:24 -0600 Subject: [PATCH] Make any of the loaders that link in efi mode honor secure boot. @@ -9,30 +9,27 @@ won't register commands if SB is enabled." Signed-off-by: Peter Jones --- - grub-core/commands/iorw.c | 7 +++++++ - grub-core/commands/memrw.c | 7 +++++++ - grub-core/kern/dl.c | 3 ++- - grub-core/kern/efi/efi.c | 34 ---------------------------------- - grub-core/loader/efi/appleloader.c | 7 +++++++ - grub-core/loader/efi/chainloader.c | 1 + - grub-core/loader/i386/bsd.c | 7 +++++++ - grub-core/loader/i386/linux.c | 7 +++++++ - grub-core/loader/i386/pc/linux.c | 7 +++++++ - grub-core/loader/multiboot.c | 7 +++++++ - grub-core/loader/xnu.c | 7 +++++++ - include/grub/efi/efi.h | 1 - - include/grub/ia64/linux.h | 0 - include/grub/mips/linux.h | 0 - include/grub/powerpc/linux.h | 0 - include/grub/sparc64/linux.h | 0 - 16 files changed, 59 insertions(+), 36 deletions(-) + grub-core/commands/iorw.c | 7 +++++++ + grub-core/commands/memrw.c | 7 +++++++ + grub-core/kern/dl.c | 4 ++-- + grub-core/loader/efi/appleloader.c | 7 +++++++ + grub-core/loader/i386/bsd.c | 7 +++++++ + grub-core/loader/i386/linux.c | 7 +++++++ + grub-core/loader/i386/pc/linux.c | 7 +++++++ + grub-core/loader/multiboot.c | 7 +++++++ + grub-core/loader/xnu.c | 7 +++++++ + include/grub/ia64/linux.h | 0 + include/grub/mips/linux.h | 0 + include/grub/powerpc/linux.h | 0 + include/grub/sparc64/linux.h | 0 + 13 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 include/grub/ia64/linux.h create mode 100644 include/grub/mips/linux.h create mode 100644 include/grub/powerpc/linux.h create mode 100644 include/grub/sparc64/linux.h diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c -index 584baec8f9..7b2999b14b 100644 +index 584baec8f91..7b2999b14b5 100644 --- a/grub-core/commands/iorw.c +++ b/grub-core/commands/iorw.c @@ -24,6 +24,7 @@ @@ -64,7 +61,7 @@ index 584baec8f9..7b2999b14b 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c -index d401a6db0e..39cf3a06db 100644 +index d401a6db0ef..39cf3a06dbd 100644 --- a/grub-core/commands/memrw.c +++ b/grub-core/commands/memrw.c @@ -23,6 +23,7 @@ @@ -96,73 +93,27 @@ index d401a6db0e..39cf3a06db 100644 grub_unregister_extcmd (cmd_read_word); grub_unregister_extcmd (cmd_read_dword); diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index b714937095..7afb9e6f72 100644 +index d48d4131ba7..2a9ae9fc894 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - /* Platforms where modules are in a readonly area of memory. */ - #if defined(GRUB_MACHINE_QEMU) -@@ -704,7 +705,7 @@ grub_dl_load_file (const char *filename) +@@ -871,13 +871,13 @@ grub_dl_load_file (const char *filename) grub_dl_t mod = 0; #ifdef GRUB_MACHINE_EFI -- if (grub_efi_secure_boot ()) +- if (grub_efi_get_secureboot ()) + if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) { #if 0 /* This is an error, but grub2-mkconfig still generates a pile of -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 4a2259aa1c..8cff7be028 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -286,40 +286,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid, - return grub_efi_get_variable_with_attributes (var, guid, datasize_out, data_out, NULL); - } - --grub_efi_boolean_t --grub_efi_secure_boot (void) --{ -- grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID; -- grub_size_t datasize; -- char *secure_boot = NULL; -- char *setup_mode = NULL; -- grub_efi_boolean_t ret = 0; -- -- secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize); -- if (datasize != 1 || !secure_boot) -- { -- grub_dprintf ("secureboot", "No SecureBoot variable\n"); -- goto out; -- } -- grub_dprintf ("secureboot", "SecureBoot: %d\n", *secure_boot); -- -- setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize); -- if (datasize != 1 || !setup_mode) -- { -- grub_dprintf ("secureboot", "No SetupMode variable\n"); -- goto out; -- } -- grub_dprintf ("secureboot", "SetupMode: %d\n", *setup_mode); -- -- if (*secure_boot && !*setup_mode) -- ret = 1; -- -- out: -- grub_free (secure_boot); -- grub_free (setup_mode); -- return ret; --} -- - #pragma GCC diagnostic ignored "-Wcast-align" - - /* Search the mods section from the PE32/PE32+ image. This code uses + * insmod commands, so emitting it would be mostly just obnoxious. */ + grub_error (GRUB_ERR_ACCESS_DENIED, +- "Secure Boot forbids loading module from %s", filename); ++ "Secure Boot forbids loading module from %s", filename); + #endif + return 0; + } diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c -index 74888c463b..585f2b5738 100644 +index a0b61a240b7..35d53c5f85d 100644 --- a/grub-core/loader/efi/appleloader.c +++ b/grub-core/loader/efi/appleloader.c @@ -24,6 +24,7 @@ @@ -192,20 +143,8 @@ index 74888c463b..585f2b5738 100644 + grub_unregister_command (cmd); } -diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index e6a8d4ad0e..07c4937898 100644 ---- a/grub-core/loader/efi/chainloader.c -+++ b/grub-core/loader/efi/chainloader.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - #include - #include - #include diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c -index 5f3290ce17..54befc2662 100644 +index 1f9128f6f20..8075ac9b06a 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -40,6 +40,7 @@ @@ -237,7 +176,7 @@ index 5f3290ce17..54befc2662 100644 grub_unregister_extcmd (cmd_openbsd); grub_unregister_extcmd (cmd_netbsd); diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index dccf3bb300..4aeb0e4b9a 100644 +index 10f967f2563..5a257552234 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -37,6 +37,7 @@ @@ -248,7 +187,7 @@ index dccf3bb300..4aeb0e4b9a 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -1138,6 +1139,9 @@ static grub_command_t cmd_linux, cmd_initrd; +@@ -1164,6 +1165,9 @@ static grub_command_t cmd_linux, cmd_initrd; GRUB_MOD_INIT(linux) { @@ -258,7 +197,7 @@ index dccf3bb300..4aeb0e4b9a 100644 cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux.")); cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, -@@ -1147,6 +1151,9 @@ GRUB_MOD_INIT(linux) +@@ -1173,6 +1177,9 @@ GRUB_MOD_INIT(linux) GRUB_MOD_FINI(linux) { @@ -269,7 +208,7 @@ index dccf3bb300..4aeb0e4b9a 100644 grub_unregister_command (cmd_initrd); } diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index 4b1750e360..e3fa1221e8 100644 +index 8593d74737f..54a76504a79 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -36,6 +36,7 @@ @@ -301,7 +240,7 @@ index 4b1750e360..e3fa1221e8 100644 grub_unregister_command (cmd_linux16); grub_unregister_command (cmd_initrd); diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index facb13f3d3..47e481f457 100644 +index 94be512c4d0..94c112a29d4 100644 --- a/grub-core/loader/multiboot.c +++ b/grub-core/loader/multiboot.c @@ -50,6 +50,7 @@ @@ -333,7 +272,7 @@ index facb13f3d3..47e481f457 100644 grub_unregister_command (cmd_module); } diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c -index 1c0cf6a430..baa54e652a 100644 +index 4cca55df92d..f76f511ac2d 100644 --- a/grub-core/loader/xnu.c +++ b/grub-core/loader/xnu.c @@ -35,6 +35,7 @@ @@ -364,27 +303,15 @@ index 1c0cf6a430..baa54e652a 100644 #ifndef GRUB_MACHINE_EMU grub_unregister_command (cmd_resume); #endif -diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 6295df85f3..585fa6662b 100644 ---- a/include/grub/efi/efi.h -+++ b/include/grub/efi/efi.h -@@ -91,7 +91,6 @@ EXPORT_FUNC (grub_efi_set_variable) (const char *var, - const grub_efi_guid_t *guid, - void *data, - grub_size_t datasize); --grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void); - int - EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, - const grub_efi_device_path_t *dp2); diff --git a/include/grub/ia64/linux.h b/include/grub/ia64/linux.h new file mode 100644 -index 0000000000..e69de29bb2 +index 00000000000..e69de29bb2d diff --git a/include/grub/mips/linux.h b/include/grub/mips/linux.h new file mode 100644 -index 0000000000..e69de29bb2 +index 00000000000..e69de29bb2d diff --git a/include/grub/powerpc/linux.h b/include/grub/powerpc/linux.h new file mode 100644 -index 0000000000..e69de29bb2 +index 00000000000..e69de29bb2d diff --git a/include/grub/sparc64/linux.h b/include/grub/sparc64/linux.h new file mode 100644 -index 0000000000..e69de29bb2 +index 00000000000..e69de29bb2d diff --git a/0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch b/0217-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch similarity index 93% rename from 0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch rename to 0217-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch index f4d83da1..428737cd 100644 --- a/0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +++ b/0217-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch @@ -10,10 +10,10 @@ Signed-off-by: Peter Jones 1 file changed, 8 insertions(+) diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in -index 301d1ac229..0f6505bf3b 100644 +index c2e107b41ab..4eadcba4b85 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in -@@ -253,6 +253,14 @@ version_test_gt () +@@ -299,6 +299,14 @@ version_test_gt () *.old:*.old) ;; *.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;; *:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;; diff --git a/0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch b/0218-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch similarity index 79% rename from 0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch rename to 0218-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch index 7658e9b8..c0f17078 100644 --- a/0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +++ b/0218-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch @@ -13,10 +13,10 @@ Signed-off-by: Peter Jones 2 files changed, 20 insertions(+) diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index a432a6be54..9a2fae6398 100644 +index 96ab7c96b52..98700423d79 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c -@@ -191,6 +191,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, +@@ -280,6 +280,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition, } } @@ -42,13 +42,13 @@ index a432a6be54..9a2fae6398 100644 int diff --git a/include/grub/misc.h b/include/grub/misc.h -index fd18e6320b..3adc4036e3 100644 +index 3e9a00f0a9c..db517acd592 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h -@@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, - const int line, - const char *condition, +@@ -386,6 +386,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file, const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5))); + int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); + int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); +void EXPORT_FUNC(grub_qdprintf) (const char *condition, + const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3))); int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args); diff --git a/0219-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch b/0219-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch new file mode 100644 index 00000000..c7d42e4d --- /dev/null +++ b/0219-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 4 Apr 2024 11:57:54 -0600 +Subject: [PATCH] Make a "gdb" dprintf that tells us load addresses. + +This makes a grub_dprintf() call during platform init and during module +loading that tells us the virtual addresses of the .text and .data +sections of grub-core/kernel.exec and any modules it loads. + +Specifically, it displays them in the gdb "add-symbol-file" syntax, with +the presumption that there's a variable $grubdir that reflects the path +to any such binaries. + +Signed-off-by: Peter Jones +--- + grub-core/kern/dl.c | 34 ++++++++++++++++++++++++++++++++++ + grub-core/kern/efi/init.c | 1 + + 2 files changed, 35 insertions(+) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index 2a9ae9fc894..2eaef7150ed 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -690,6 +690,38 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) + return GRUB_ERR_NONE; + } + ++static void ++grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e) ++{ ++ void *text, *data = NULL; ++ long idx; ++ ++ idx = grub_dl_find_section_index (e, ".text"); ++ if (idx < 0) ++ return; ++ ++ text = grub_dl_get_section_addr (mod, idx); ++ if (!text) ++ return; ++ ++ idx = grub_dl_find_section_index (e, ".data"); ++ if (idx >= 0) ++ data = grub_dl_get_section_addr (mod, idx); ++ ++ if (data) ++ grub_qdprintf ("gdb", "add-symbol-file \\\n" ++ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " ++ "\\\n %p -s .data %p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, ++ mod->name, text, data); ++ else ++ grub_qdprintf ("gdb", "add-symbol-file \\\n" ++ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug " ++ "\\\n%p\n", ++ GRUB_TARGET_CPU, GRUB_PLATFORM, ++ mod->name, text); ++} ++ + static grub_err_t + grub_dl_set_mem_attrs (grub_dl_t mod, void *ehdr) + { +@@ -833,6 +865,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size) + grub_dprintf ("modules", "module name: %s\n", mod->name); + grub_dprintf ("modules", "init function: %p\n", mod->init); + ++ grub_dl_print_gdb_info (mod, e); ++ + if (grub_dl_add (mod)) + { + grub_dl_unload (mod); +diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index dee3918fd35..d35d6974734 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -157,6 +157,7 @@ grub_efi_init (void) + grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL); + + grub_efi_env_init (); ++ grub_efi_print_gdb_info (); + grub_efidisk_init (); + + grub_efi_register_debug_commands (); diff --git a/0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch b/0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch deleted file mode 100644 index 715e6e1d..00000000 --- a/0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Julian Andres Klode -Date: Thu, 2 Dec 2021 15:03:53 +0100 -Subject: [PATCH] kern/efi/sb: Reject non-kernel files in the shim_lock - verifier - -We must not allow other verifiers to pass things like the GRUB modules. -Instead of maintaining a blocklist, maintain an allowlist of things -that we do not care about. - -This allowlist really should be made reusable, and shared by the -lockdown verifier, but this is the minimal patch addressing -security concerns where the TPM verifier was able to mark modules -as verified (or the OpenPGP verifier for that matter), when it -should not do so on shim-powered secure boot systems. - -Fixes: CVE-2022-28735 - -Signed-off-by: Julian Andres Klode -Reviewed-by: Daniel Kiper -(cherry picked from commit fa61ad69861c1cb3f68bf853d78fae7fd93986a0) ---- - grub-core/kern/efi/sb.c | 39 ++++++++++++++++++++++++++++++++++++--- - include/grub/verify.h | 1 + - 2 files changed, 37 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c -index c52ec6226a..89c4bb3fd1 100644 ---- a/grub-core/kern/efi/sb.c -+++ b/grub-core/kern/efi/sb.c -@@ -119,10 +119,11 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)), - void **context __attribute__ ((unused)), - enum grub_verify_flags *flags) - { -- *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION; -+ *flags = GRUB_VERIFY_FLAGS_NONE; - - switch (type & GRUB_FILE_TYPE_MASK) - { -+ /* Files we check. */ - case GRUB_FILE_TYPE_LINUX_KERNEL: - case GRUB_FILE_TYPE_MULTIBOOT_KERNEL: - case GRUB_FILE_TYPE_BSD_KERNEL: -@@ -130,11 +131,43 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)), - case GRUB_FILE_TYPE_PLAN9_KERNEL: - case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE: - *flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK; -+ return GRUB_ERR_NONE; - -- /* Fall through. */ -+ /* Files that do not affect secureboot state. */ -+ case GRUB_FILE_TYPE_NONE: -+ case GRUB_FILE_TYPE_LOOPBACK: -+ case GRUB_FILE_TYPE_LINUX_INITRD: -+ case GRUB_FILE_TYPE_OPENBSD_RAMDISK: -+ case GRUB_FILE_TYPE_XNU_RAMDISK: -+ case GRUB_FILE_TYPE_SIGNATURE: -+ case GRUB_FILE_TYPE_PUBLIC_KEY: -+ case GRUB_FILE_TYPE_PUBLIC_KEY_TRUST: -+ case GRUB_FILE_TYPE_PRINT_BLOCKLIST: -+ case GRUB_FILE_TYPE_TESTLOAD: -+ case GRUB_FILE_TYPE_GET_SIZE: -+ case GRUB_FILE_TYPE_FONT: -+ case GRUB_FILE_TYPE_ZFS_ENCRYPTION_KEY: -+ case GRUB_FILE_TYPE_CAT: -+ case GRUB_FILE_TYPE_HEXCAT: -+ case GRUB_FILE_TYPE_CMP: -+ case GRUB_FILE_TYPE_HASHLIST: -+ case GRUB_FILE_TYPE_TO_HASH: -+ case GRUB_FILE_TYPE_KEYBOARD_LAYOUT: -+ case GRUB_FILE_TYPE_PIXMAP: -+ case GRUB_FILE_TYPE_GRUB_MODULE_LIST: -+ case GRUB_FILE_TYPE_CONFIG: -+ case GRUB_FILE_TYPE_THEME: -+ case GRUB_FILE_TYPE_GETTEXT_CATALOG: -+ case GRUB_FILE_TYPE_FS_SEARCH: -+ case GRUB_FILE_TYPE_LOADENV: -+ case GRUB_FILE_TYPE_SAVEENV: -+ case GRUB_FILE_TYPE_VERIFY_SIGNATURE: -+ *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION; -+ return GRUB_ERR_NONE; - -+ /* Other files. */ - default: -- return GRUB_ERR_NONE; -+ return grub_error (GRUB_ERR_ACCESS_DENIED, N_("prohibited by secure boot policy")); - } - } - -diff --git a/include/grub/verify.h b/include/grub/verify.h -index cd129c398f..672ae16924 100644 ---- a/include/grub/verify.h -+++ b/include/grub/verify.h -@@ -24,6 +24,7 @@ - - enum grub_verify_flags - { -+ GRUB_VERIFY_FLAGS_NONE = 0, - GRUB_VERIFY_FLAGS_SKIP_VERIFICATION = 1, - GRUB_VERIFY_FLAGS_SINGLE_CHUNK = 2, - /* Defer verification to another authority. */ diff --git a/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch b/0220-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch similarity index 84% rename from 0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch rename to 0220-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch index 452f43c9..0284cc64 100644 --- a/0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +++ b/0220-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch @@ -7,40 +7,40 @@ Allow booting 64-bit kernels on 32-bit EFI on x86. Signed-off-by: Peter Jones --- - grub-core/loader/efi/linux.c | 9 +++- - grub-core/loader/i386/efi/linux.c | 110 ++++++++++++++++++++++++++------------ - include/grub/i386/linux.h | 7 ++- - 3 files changed, 89 insertions(+), 37 deletions(-) + grub-core/loader/efi/linux.c | 9 ++- + grub-core/loader/i386/efi/linux.c | 116 ++++++++++++++++++++++++++------------ + include/grub/i386/linux.h | 5 ++ + 3 files changed, 91 insertions(+), 39 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index c8ecce6dfd..0622dfa48d 100644 +index 0a7f8208022..742e8e9af35 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c -@@ -69,12 +69,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size) +@@ -136,12 +136,17 @@ grub_linuxefi_secure_validate (void *data, grub_uint32_t size) typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *); grub_err_t --grub_efi_linux_boot (void *kernel_addr, grub_off_t offset, -+grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, +-grub_efi_linux_boot (void *kernel_address, grub_off_t offset, ++grub_efi_linux_boot (void *kernel_address, grub_off_t handover_offset, void *kernel_params) { handover_func hf; + int offset = 0; -- hf = (handover_func)((char *)kernel_addr + offset); +- hf = (handover_func)((char *)kernel_address + offset); +#ifdef __x86_64__ + offset = 512; +#endif + -+ hf = (handover_func)((char *)kernel_addr + handover_offset + offset); ++ hf = (handover_func)((char *)kernel_address + handover_offset + offset); hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); return GRUB_ERR_BUG; diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 6b24cbb948..3017d0f3e5 100644 +index b59d125286d..3c2e30f8751 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -44,14 +44,10 @@ static char *linux_cmdline; +@@ -44,15 +44,11 @@ static char *linux_cmdline; static grub_err_t grub_linuxefi_boot (void) { @@ -52,11 +52,13 @@ index 6b24cbb948..3017d0f3e5 100644 asm volatile ("cli"); - return grub_efi_linux_boot ((char *)kernel_mem, handover_offset + offset, +- params); + return grub_efi_linux_boot ((char *)kernel_mem, + handover_offset, - params); ++ params); } + static grub_err_t @@ -153,14 +149,20 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), return grub_errno; } @@ -68,7 +70,7 @@ index 6b24cbb948..3017d0f3e5 100644 + static grub_err_t grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) + int argc, char *argv[]) { grub_file_t file = 0; - struct linux_i386_kernel_header lh; @@ -166,7 +168,7 @@ index 6b24cbb948..3017d0f3e5 100644 + grub_dprintf ("linux", "setting up cmdline\n"); linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff, -- BYTES_TO_PAGES(lh.cmdline_size + 1)); +- BYTES_TO_PAGES(lh.cmdline_size + 1)); - + BYTES_TO_PAGES(lh->cmdline_size + 1)); if (!linux_cmdline) @@ -176,9 +178,10 @@ index 6b24cbb948..3017d0f3e5 100644 grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); grub_create_loader_cmdline (argc, argv, linux_cmdline + sizeof (LINUX_IMAGE) - 1, -- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1), +- lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1), +- GRUB_VERIFY_KERNEL_CMDLINE); + lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1), - GRUB_VERIFY_KERNEL_CMDLINE); ++ GRUB_VERIFY_KERNEL_CMDLINE); - lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; + grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline); @@ -194,13 +197,13 @@ index 6b24cbb948..3017d0f3e5 100644 + start = (lh->setup_sects + 1) * 512; - kernel_mem = grub_efi_allocate_pages_max(lh.pref_address, -- BYTES_TO_PAGES(lh.init_size)); +- BYTES_TO_PAGES(lh.init_size)); + kernel_mem = grub_efi_allocate_pages_max(lh->pref_address, + BYTES_TO_PAGES(lh->init_size)); if (!kernel_mem) kernel_mem = grub_efi_allocate_pages_max(0x3fffffff, -- BYTES_TO_PAGES(lh.init_size)); +- BYTES_TO_PAGES(lh.init_size)); + BYTES_TO_PAGES(lh->init_size)); if (!kernel_mem) @@ -229,7 +232,7 @@ index 6b24cbb948..3017d0f3e5 100644 + params->ext_loader_type = 0; + params->ext_loader_ver = 2; grub_dprintf("linux", "kernel_mem: %p handover_offset: %08x\n", - kernel_mem, handover_offset); + kernel_mem, handover_offset); @@ -301,10 +343,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), loaded = 0; @@ -238,27 +241,26 @@ index 6b24cbb948..3017d0f3e5 100644 - if (linux_cmdline && !loaded) + if (linux_cmdline && lh && !loaded) grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t) - linux_cmdline, -- BYTES_TO_PAGES(lh.cmdline_size + 1)); +- linux_cmdline, +- BYTES_TO_PAGES(lh.cmdline_size + 1)); ++ linux_cmdline, + BYTES_TO_PAGES(lh->cmdline_size + 1)); if (kernel_mem && !loaded) grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index eddf9251d9..25ef52c04e 100644 +index d4b55086953..4ccd9d7d9f2 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h -@@ -138,7 +138,12 @@ struct linux_i386_kernel_header +@@ -148,6 +148,11 @@ struct linux_i386_kernel_header grub_uint32_t kernel_alignment; grub_uint8_t relocatable; grub_uint8_t min_alignment; -- grub_uint8_t pad[2]; +#define LINUX_XLF_KERNEL_64 (1<<0) +#define LINUX_XLF_CAN_BE_LOADED_ABOVE_4G (1<<1) +#define LINUX_XLF_EFI_HANDOVER_32 (1<<2) +#define LINUX_XLF_EFI_HANDOVER_64 (1<<3) +#define LINUX_XLF_EFI_KEXEC (1<<4) -+ grub_uint16_t xloadflags; + grub_uint16_t xloadflags; grub_uint32_t cmdline_size; grub_uint32_t hardware_subarch; - grub_uint64_t hardware_subarch_data; diff --git a/0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch b/0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch deleted file mode 100644 index 59f94718..00000000 --- a/0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Fri, 25 Jun 2021 02:19:05 +1000 -Subject: [PATCH] kern/file: Do not leak device_name on error in - grub_file_open() - -If we have an error in grub_file_open() before we free device_name, we -will leak it. - -Free device_name in the error path and null out the pointer in the good -path once we free it there. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 1499a5068839fa37cb77ecef4b5bdacbd1ed12ea) ---- - grub-core/kern/file.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c -index ec10e54fc0..db938e099d 100644 ---- a/grub-core/kern/file.c -+++ b/grub-core/kern/file.c -@@ -84,6 +84,7 @@ grub_file_open (const char *name, enum grub_file_type type) - - device = grub_device_open (device_name); - grub_free (device_name); -+ device_name = NULL; - if (! device) - goto fail; - -@@ -138,6 +139,7 @@ grub_file_open (const char *name, enum grub_file_type type) - return file; - - fail: -+ grub_free (device_name); - if (device) - grub_device_close (device); - diff --git a/0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0221-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 94% rename from 0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0221-Try-to-pick-better-locations-for-kernel-and-initrd.patch index 4f42ea54..2927f4b4 100644 --- a/0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch +++ b/0221-Try-to-pick-better-locations-for-kernel-and-initrd.patch @@ -38,10 +38,10 @@ Signed-off-by: Robbie Harwood 8 files changed, 29 insertions(+), 12 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 85ad4b4494..e84961d078 100644 +index fb9dbf52528..8f75205a732 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, +@@ -121,7 +121,7 @@ grub_efi_allocate_pages_max (grub_efi_physical_address_t max, grub_efi_boot_services_t *b; grub_efi_physical_address_t address = max; @@ -50,7 +50,7 @@ index 85ad4b4494..e84961d078 100644 return 0; b = grub_efi_system_table->boot_services; -@@ -480,7 +480,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -477,7 +477,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, { if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY #if 1 @@ -59,7 +59,7 @@ index 85ad4b4494..e84961d078 100644 #endif && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 && desc->num_pages != 0) -@@ -498,9 +498,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -495,9 +495,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 @@ -72,7 +72,7 @@ index 85ad4b4494..e84961d078 100644 #endif diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3017d0f3e5..33e981e76e 100644 +index 3c2e30f8751..9e5dca9458a 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -27,6 +27,7 @@ @@ -138,7 +138,7 @@ index 3017d0f3e5..33e981e76e 100644 { grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel")); diff --git a/include/grub/arm/efi/memory.h b/include/grub/arm/efi/memory.h -index 2c64918e3f..a4c2ec8350 100644 +index 2c64918e3f7..a4c2ec83502 100644 --- a/include/grub/arm/efi/memory.h +++ b/include/grub/arm/efi/memory.h @@ -2,5 +2,6 @@ @@ -149,7 +149,7 @@ index 2c64918e3f..a4c2ec8350 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/arm64/efi/memory.h b/include/grub/arm64/efi/memory.h -index c6cb324171..acb61dca44 100644 +index c6cb3241714..acb61dca44b 100644 --- a/include/grub/arm64/efi/memory.h +++ b/include/grub/arm64/efi/memory.h @@ -2,5 +2,6 @@ @@ -160,7 +160,7 @@ index c6cb324171..acb61dca44 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/i386/efi/memory.h b/include/grub/i386/efi/memory.h -index 2c64918e3f..a4c2ec8350 100644 +index 2c64918e3f7..a4c2ec83502 100644 --- a/include/grub/i386/efi/memory.h +++ b/include/grub/i386/efi/memory.h @@ -2,5 +2,6 @@ @@ -171,7 +171,7 @@ index 2c64918e3f..a4c2ec8350 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/ia64/efi/memory.h b/include/grub/ia64/efi/memory.h -index 2c64918e3f..a4c2ec8350 100644 +index 2c64918e3f7..a4c2ec83502 100644 --- a/include/grub/ia64/efi/memory.h +++ b/include/grub/ia64/efi/memory.h @@ -2,5 +2,6 @@ @@ -182,7 +182,7 @@ index 2c64918e3f..a4c2ec8350 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/riscv64/efi/memory.h b/include/grub/riscv64/efi/memory.h -index c6cb324171..acb61dca44 100644 +index c6cb3241714..acb61dca44b 100644 --- a/include/grub/riscv64/efi/memory.h +++ b/include/grub/riscv64/efi/memory.h @@ -2,5 +2,6 @@ @@ -193,7 +193,7 @@ index c6cb324171..acb61dca44 100644 #endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h -index 46e9145a30..e81cfb3221 100644 +index 46e9145a308..e81cfb32213 100644 --- a/include/grub/x86_64/efi/memory.h +++ b/include/grub/x86_64/efi/memory.h @@ -2,9 +2,11 @@ diff --git a/0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch b/0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch deleted file mode 100644 index 385d3ed0..00000000 --- a/0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch +++ /dev/null @@ -1,198 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 6 Jul 2021 14:02:55 +1000 -Subject: [PATCH] video/readers/png: Abort sooner if a read operation fails - -Fuzzing revealed some inputs that were taking a long time, potentially -forever, because they did not bail quickly upon encountering an I/O error. - -Try to catch I/O errors sooner and bail out. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 882be97d1df6449b9fd4d593f0cb70005fde3494) ---- - grub-core/video/readers/png.c | 55 ++++++++++++++++++++++++++++++++++++------- - 1 file changed, 47 insertions(+), 8 deletions(-) - -diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c -index 0157ff7420..e2a6b1cf3c 100644 ---- a/grub-core/video/readers/png.c -+++ b/grub-core/video/readers/png.c -@@ -142,6 +142,7 @@ static grub_uint8_t - grub_png_get_byte (struct grub_png_data *data) - { - grub_uint8_t r; -+ grub_ssize_t bytes_read = 0; - - if ((data->inside_idat) && (data->idat_remain == 0)) - { -@@ -175,7 +176,14 @@ grub_png_get_byte (struct grub_png_data *data) - } - - r = 0; -- grub_file_read (data->file, &r, 1); -+ bytes_read = grub_file_read (data->file, &r, 1); -+ -+ if (bytes_read != 1) -+ { -+ grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "png: unexpected end of data"); -+ return 0; -+ } - - if (data->inside_idat) - data->idat_remain--; -@@ -231,15 +239,16 @@ grub_png_decode_image_palette (struct grub_png_data *data, - if (len == 0) - return GRUB_ERR_NONE; - -- for (i = 0; 3 * i < len && i < 256; i++) -+ grub_errno = GRUB_ERR_NONE; -+ for (i = 0; 3 * i < len && i < 256 && grub_errno == GRUB_ERR_NONE; i++) - for (j = 0; j < 3; j++) - data->palette[i][j] = grub_png_get_byte (data); -- for (i *= 3; i < len; i++) -+ for (i *= 3; i < len && grub_errno == GRUB_ERR_NONE; i++) - grub_png_get_byte (data); - - grub_png_get_dword (data); - -- return GRUB_ERR_NONE; -+ return grub_errno; - } - - static grub_err_t -@@ -256,9 +265,13 @@ grub_png_decode_image_header (struct grub_png_data *data) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: invalid image size"); - - color_bits = grub_png_get_byte (data); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - data->is_16bit = (color_bits == 16); - - color_type = grub_png_get_byte (data); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - /* According to PNG spec, no other types are valid. */ - if ((color_type & ~(PNG_COLOR_MASK_ALPHA | PNG_COLOR_MASK_COLOR)) -@@ -340,14 +353,20 @@ grub_png_decode_image_header (struct grub_png_data *data) - if (grub_png_get_byte (data) != PNG_COMPRESSION_BASE) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "png: compression method not supported"); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - if (grub_png_get_byte (data) != PNG_FILTER_TYPE_BASE) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "png: filter method not supported"); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - if (grub_png_get_byte (data) != PNG_INTERLACE_NONE) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "png: interlace method not supported"); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - /* Skip crc checksum. */ - grub_png_get_dword (data); -@@ -449,7 +468,7 @@ grub_png_get_huff_code (struct grub_png_data *data, struct huff_table *ht) - int code, i; - - code = 0; -- for (i = 0; i < ht->max_length; i++) -+ for (i = 0; i < ht->max_length && grub_errno == GRUB_ERR_NONE; i++) - { - code = (code << 1) + grub_png_get_bits (data, 1); - if (code < ht->maxval[i]) -@@ -504,8 +523,14 @@ grub_png_init_dynamic_block (struct grub_png_data *data) - grub_uint8_t lens[DEFLATE_HCLEN_MAX]; - - nl = DEFLATE_HLIT_BASE + grub_png_get_bits (data, 5); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - nd = DEFLATE_HDIST_BASE + grub_png_get_bits (data, 5); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - nb = DEFLATE_HCLEN_BASE + grub_png_get_bits (data, 4); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - if ((nl > DEFLATE_HLIT_MAX) || (nd > DEFLATE_HDIST_MAX) || - (nb > DEFLATE_HCLEN_MAX)) -@@ -533,7 +558,7 @@ grub_png_init_dynamic_block (struct grub_png_data *data) - data->dist_offset); - - prev = 0; -- for (i = 0; i < nl + nd; i++) -+ for (i = 0; i < nl + nd && grub_errno == GRUB_ERR_NONE; i++) - { - int n, code; - struct huff_table *ht; -@@ -721,17 +746,21 @@ grub_png_read_dynamic_block (struct grub_png_data *data) - len = cplens[n]; - if (cplext[n]) - len += grub_png_get_bits (data, cplext[n]); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - n = grub_png_get_huff_code (data, &data->dist_table); - dist = cpdist[n]; - if (cpdext[n]) - dist += grub_png_get_bits (data, cpdext[n]); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - pos = data->wp - dist; - if (pos < 0) - pos += WSIZE; - -- while (len > 0) -+ while (len > 0 && grub_errno == GRUB_ERR_NONE) - { - data->slide[data->wp] = data->slide[pos]; - grub_png_output_byte (data, data->slide[data->wp]); -@@ -759,7 +788,11 @@ grub_png_decode_image_data (struct grub_png_data *data) - int final; - - cmf = grub_png_get_byte (data); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - flg = grub_png_get_byte (data); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - if ((cmf & 0xF) != Z_DEFLATED) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, -@@ -774,7 +807,11 @@ grub_png_decode_image_data (struct grub_png_data *data) - int block_type; - - final = grub_png_get_bits (data, 1); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - block_type = grub_png_get_bits (data, 2); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - switch (block_type) - { -@@ -790,7 +827,7 @@ grub_png_decode_image_data (struct grub_png_data *data) - grub_png_get_byte (data); - grub_png_get_byte (data); - -- for (i = 0; i < len; i++) -+ for (i = 0; i < len && grub_errno == GRUB_ERR_NONE; i++) - grub_png_output_byte (data, grub_png_get_byte (data)); - - break; -@@ -1045,6 +1082,8 @@ grub_png_decode_png (struct grub_png_data *data) - - len = grub_png_get_dword (data); - type = grub_png_get_dword (data); -+ if (grub_errno != GRUB_ERR_NONE) -+ break; - data->next_offset = data->file->offset + len + 4; - - switch (type) diff --git a/0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch b/0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch deleted file mode 100644 index 9168fe58..00000000 --- a/0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 6 Jul 2021 14:13:40 +1000 -Subject: [PATCH] video/readers/png: Refuse to handle multiple image headers - -This causes the bitmap to be leaked. Do not permit multiple image headers. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 8ce433557adeadbc46429aabb9f850b02ad2bdfb) ---- - grub-core/video/readers/png.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c -index e2a6b1cf3c..8955b8ecfd 100644 ---- a/grub-core/video/readers/png.c -+++ b/grub-core/video/readers/png.c -@@ -258,6 +258,9 @@ grub_png_decode_image_header (struct grub_png_data *data) - int color_bits; - enum grub_video_blit_format blt; - -+ if (data->image_width || data->image_height) -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: two image headers found"); -+ - data->image_width = grub_png_get_dword (data); - data->image_height = grub_png_get_dword (data); - diff --git a/0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0222-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 97% rename from 0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0222-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch index 5a9c6f24..83c02c90 100644 --- a/0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +++ b/0222-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch @@ -12,7 +12,7 @@ Signed-off-by: Peter Jones 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 33e981e76e..2f0336809e 100644 +index 9e5dca9458a..3a940bec7f6 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -35,11 +35,16 @@ static grub_dl_t my_mod; @@ -98,4 +98,4 @@ index 33e981e76e..2f0336809e 100644 - static grub_err_t grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) + int argc, char *argv[]) diff --git a/0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch b/0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch deleted file mode 100644 index 4529cb8e..00000000 --- a/0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 6 Jul 2021 18:51:35 +1000 -Subject: [PATCH] video/readers/png: Drop greyscale support to fix heap - out-of-bounds write - -A 16-bit greyscale PNG without alpha is processed in the following loop: - - for (i = 0; i < (data->image_width * data->image_height); - i++, d1 += 4, d2 += 2) - { - d1[R3] = d2[1]; - d1[G3] = d2[1]; - d1[B3] = d2[1]; - } - -The increment of d1 is wrong. d1 is incremented by 4 bytes per iteration, -but there are only 3 bytes allocated for storage. This means that image -data will overwrite somewhat-attacker-controlled parts of memory - 3 bytes -out of every 4 following the end of the image. - -This has existed since greyscale support was added in 2013 in commit -3ccf16dff98f (grub-core/video/readers/png.c: Support grayscale). - -Saving starfield.png as a 16-bit greyscale image without alpha in the gimp -and attempting to load it causes grub-emu to crash - I don't think this code -has ever worked. - -Delete all PNG greyscale support. - -Fixes: CVE-2021-3695 - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 0e1d163382669bd734439d8864ee969616d971d9) -[rharwood: context conflict] -Signed-off-by: Robbie Harwood ---- - grub-core/video/readers/png.c | 85 +++---------------------------------------- - 1 file changed, 6 insertions(+), 79 deletions(-) - -diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c -index 8955b8ecfd..a3161e25b6 100644 ---- a/grub-core/video/readers/png.c -+++ b/grub-core/video/readers/png.c -@@ -100,7 +100,7 @@ struct grub_png_data - - unsigned image_width, image_height; - int bpp, is_16bit; -- int raw_bytes, is_gray, is_alpha, is_palette; -+ int raw_bytes, is_alpha, is_palette; - int row_bytes, color_bits; - grub_uint8_t *image_data; - -@@ -296,13 +296,13 @@ grub_png_decode_image_header (struct grub_png_data *data) - data->bpp = 3; - else - { -- data->is_gray = 1; -- data->bpp = 1; -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "png: color type not supported"); - } - - if ((color_bits != 8) && (color_bits != 16) - && (color_bits != 4 -- || !(data->is_gray || data->is_palette))) -+ || !data->is_palette)) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "png: bit depth must be 8 or 16"); - -@@ -331,7 +331,7 @@ grub_png_decode_image_header (struct grub_png_data *data) - } - - #ifndef GRUB_CPU_WORDS_BIGENDIAN -- if (data->is_16bit || data->is_gray || data->is_palette) -+ if (data->is_16bit || data->is_palette) - #endif - { - data->image_data = grub_calloc (data->image_height, data->row_bytes); -@@ -899,27 +899,8 @@ grub_png_convert_image (struct grub_png_data *data) - int shift; - int mask = (1 << data->color_bits) - 1; - unsigned j; -- if (data->is_gray) -- { -- /* Generic formula is -- (0xff * i) / ((1U << data->color_bits) - 1) -- but for allowed bit depth of 1, 2 and for it's -- equivalent to -- (0xff / ((1U << data->color_bits) - 1)) * i -- Precompute the multipliers to avoid division. -- */ - -- const grub_uint8_t multipliers[5] = { 0xff, 0xff, 0x55, 0x24, 0x11 }; -- for (i = 0; i < (1U << data->color_bits); i++) -- { -- grub_uint8_t col = multipliers[data->color_bits] * i; -- palette[i][0] = col; -- palette[i][1] = col; -- palette[i][2] = col; -- } -- } -- else -- grub_memcpy (palette, data->palette, 3 << data->color_bits); -+ grub_memcpy (palette, data->palette, 3 << data->color_bits); - d1c = d1; - d2c = d2; - for (j = 0; j < data->image_height; j++, d1c += data->image_width * 3, -@@ -956,60 +937,6 @@ grub_png_convert_image (struct grub_png_data *data) - } - return; - } -- -- if (data->is_gray) -- { -- switch (data->bpp) -- { -- case 4: -- /* 16-bit gray with alpha. */ -- for (i = 0; i < (data->image_width * data->image_height); -- i++, d1 += 4, d2 += 4) -- { -- d1[R4] = d2[3]; -- d1[G4] = d2[3]; -- d1[B4] = d2[3]; -- d1[A4] = d2[1]; -- } -- break; -- case 2: -- if (data->is_16bit) -- /* 16-bit gray without alpha. */ -- { -- for (i = 0; i < (data->image_width * data->image_height); -- i++, d1 += 4, d2 += 2) -- { -- d1[R3] = d2[1]; -- d1[G3] = d2[1]; -- d1[B3] = d2[1]; -- } -- } -- else -- /* 8-bit gray with alpha. */ -- { -- for (i = 0; i < (data->image_width * data->image_height); -- i++, d1 += 4, d2 += 2) -- { -- d1[R4] = d2[1]; -- d1[G4] = d2[1]; -- d1[B4] = d2[1]; -- d1[A4] = d2[0]; -- } -- } -- break; -- /* 8-bit gray without alpha. */ -- case 1: -- for (i = 0; i < (data->image_width * data->image_height); -- i++, d1 += 3, d2++) -- { -- d1[R3] = d2[0]; -- d1[G3] = d2[0]; -- d1[B3] = d2[0]; -- } -- break; -- } -- return; -- } - - { - /* Only copy the upper 8 bit. */ diff --git a/0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0223-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 98% rename from 0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0223-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch index 9b10d688..e4c80fe3 100644 --- a/0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +++ b/0223-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch @@ -11,7 +11,7 @@ Signed-off-by: Peter Jones 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 2f0336809e..5f48fa5561 100644 +index 3a940bec7f6..8d0b9436011 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -243,32 +243,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), @@ -121,7 +121,7 @@ index 2f0336809e..5f48fa5561 100644 params->ext_loader_type = 0; params->ext_loader_ver = 2; - grub_dprintf("linux", "kernel_mem: %p handover_offset: %08x\n", -- kernel_mem, handover_offset); +- kernel_mem, handover_offset); + grub_dprintf ("linux", + "setting lh->ext_loader_{type,ver} = {0x%02x,0x%02x}\n", + params->ext_loader_type, params->ext_loader_ver); diff --git a/0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch b/0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch deleted file mode 100644 index 51dddfe5..00000000 --- a/0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 6 Jul 2021 23:25:07 +1000 -Subject: [PATCH] video/readers/png: Avoid heap OOB R/W inserting huff table - items - -In fuzzing we observed crashes where a code would attempt to be inserted -into a huffman table before the start, leading to a set of heap OOB reads -and writes as table entries with negative indices were shifted around and -the new code written in. - -Catch the case where we would underflow the array and bail. - -Fixes: CVE-2021-3696 - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 1ae9a91d42cb40da8a6f11fac65541858e340afa) ---- - grub-core/video/readers/png.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c -index a3161e25b6..d7ed5aa6cf 100644 ---- a/grub-core/video/readers/png.c -+++ b/grub-core/video/readers/png.c -@@ -438,6 +438,13 @@ grub_png_insert_huff_item (struct huff_table *ht, int code, int len) - for (i = len; i < ht->max_length; i++) - n += ht->maxval[i]; - -+ if (n > ht->num_values) -+ { -+ grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "png: out of range inserting huffman table item"); -+ return; -+ } -+ - for (i = 0; i < n; i++) - ht->values[ht->num_values - i] = ht->values[ht->num_values - i - 1]; - diff --git a/0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0224-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 90% rename from 0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0224-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch index 700c98b3..afd82c38 100644 --- a/0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +++ b/0224-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch @@ -7,11 +7,11 @@ This helps enable allocations above 4GB. Signed-off-by: Peter Jones --- - grub-core/loader/i386/efi/linux.c | 167 +++++++++++++++++++++----------------- - 1 file changed, 94 insertions(+), 73 deletions(-) + grub-core/loader/i386/efi/linux.c | 166 +++++++++++++++++++++----------------- + 1 file changed, 93 insertions(+), 73 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 5f48fa5561..3e4f7ef39f 100644 +index 8d0b9436011..039b40e321d 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -47,6 +47,65 @@ static char *linux_cmdline; @@ -86,17 +86,17 @@ index 5f48fa5561..3e4f7ef39f 100644 loaded = 0; - if (initrd_mem) - grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, -- BYTES_TO_PAGES(params->ramdisk_size)); +- BYTES_TO_PAGES(params->ramdisk_size)); - if (linux_cmdline) - grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t) -- linux_cmdline, -- BYTES_TO_PAGES(params->cmdline_size + 1)); +- linux_cmdline, +- BYTES_TO_PAGES(params->cmdline_size + 1)); - if (kernel_mem) - grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, -- BYTES_TO_PAGES(kernel_size)); +- BYTES_TO_PAGES(kernel_size)); - if (params) - grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params, -- BYTES_TO_PAGES(16384)); +- BYTES_TO_PAGES(16384)); + + kernel_free(initrd_mem, params->ramdisk_size); + kernel_free(linux_cmdline, params->cmdline_size + 1); @@ -127,7 +127,7 @@ index 5f48fa5561..3e4f7ef39f 100644 params->ramdisk_size = size; - params->ramdisk_image = (grub_uint32_t)(grub_addr_t) initrd_mem; -+ params->ramdisk_image = initrd_mem; ++ params->ramdisk_image = (grub_uint64_t) initrd_mem; ptr = initrd_mem; @@ -185,21 +185,20 @@ index 5f48fa5561..3e4f7ef39f 100644 - } - - grub_dprintf ("linux", "linux_cmdline = %lx\n", -- (unsigned long)linux_cmdline); +- (unsigned long)linux_cmdline); + goto fail; + grub_dprintf ("linux", "linux_cmdline = %p\n", linux_cmdline); grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); grub_create_loader_cmdline (argc, argv, -@@ -343,27 +371,24 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -343,27 +371,23 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), GRUB_VERIFY_KERNEL_CMDLINE); grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline); - grub_dprintf ("linux", "setting lh->cmd_line_ptr\n"); - lh->cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; -+ grub_dprintf ("linux", "setting lh->cmd_line_ptr to 0x%08x\n", -+ linux_cmdline); -+ lh->cmd_line_ptr = linux_cmdline; ++ ++ lh->cmd_line_ptr = (grub_uint64_t) linux_cmdline; handover_offset = lh->handover_offset; - grub_dprintf("linux", "handover_offset: %08x\n", handover_offset); @@ -230,7 +229,7 @@ index 5f48fa5561..3e4f7ef39f 100644 grub_dprintf("linux", "kernel_mem = %p\n", kernel_mem); grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0); -@@ -398,18 +423,14 @@ fail: +@@ -398,18 +422,14 @@ fail: loaded = 0; } @@ -245,11 +244,11 @@ index 5f48fa5561..3e4f7ef39f 100644 - if (kernel_mem && !loaded) - grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, -- BYTES_TO_PAGES(kernel_size)); +- BYTES_TO_PAGES(kernel_size)); - - if (params && !loaded) - grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)params, -- BYTES_TO_PAGES(16384)); +- BYTES_TO_PAGES(16384)); + kernel_free (kernel_mem, kernel_size); + kernel_free (params, sizeof(*params)); + } diff --git a/0225-video-readers-png-Sanity-check-some-huffman-codes.patch b/0225-video-readers-png-Sanity-check-some-huffman-codes.patch deleted file mode 100644 index c9cef259..00000000 --- a/0225-video-readers-png-Sanity-check-some-huffman-codes.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 6 Jul 2021 19:19:11 +1000 -Subject: [PATCH] video/readers/png: Sanity check some huffman codes - -ASAN picked up two OOB global reads: we weren't checking if some code -values fit within the cplens or cpdext arrays. Check and throw an error -if not. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit c3a8ab0cbd24153ec7b1f84a96ddfdd72ef8d117) ---- - grub-core/video/readers/png.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c -index d7ed5aa6cf..7f2ba7849b 100644 ---- a/grub-core/video/readers/png.c -+++ b/grub-core/video/readers/png.c -@@ -753,6 +753,9 @@ grub_png_read_dynamic_block (struct grub_png_data *data) - int len, dist, pos; - - n -= 257; -+ if (((unsigned int) n) >= ARRAY_SIZE (cplens)) -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "png: invalid huff code"); - len = cplens[n]; - if (cplext[n]) - len += grub_png_get_bits (data, cplext[n]); -@@ -760,6 +763,9 @@ grub_png_read_dynamic_block (struct grub_png_data *data) - return grub_errno; - - n = grub_png_get_huff_code (data, &data->dist_table); -+ if (((unsigned int) n) >= ARRAY_SIZE (cpdist)) -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "png: invalid huff code"); - dist = cpdist[n]; - if (cpdext[n]) - dist += grub_png_get_bits (data, cpdext[n]); diff --git a/0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0225-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 92% rename from 0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0225-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch index 6ac11a1c..a3b68e66 100644 --- a/0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +++ b/0225-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch @@ -11,10 +11,10 @@ Signed-off-by: Peter Jones --- grub-core/loader/i386/efi/linux.c | 67 +++++++++++++++++++++++++++++++++++---- include/grub/i386/linux.h | 6 +++- - 2 files changed, 65 insertions(+), 8 deletions(-) + 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3e4f7ef39f..6bc18d5aef 100644 +index 039b40e321d..015bb01d4c4 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -52,13 +52,22 @@ struct allocation_choice { @@ -68,7 +68,7 @@ index 3e4f7ef39f..6bc18d5aef 100644 grub_dprintf ("linux", "initrd_mem = %p\n", initrd_mem); - params->ramdisk_size = size; -- params->ramdisk_image = initrd_mem; +- params->ramdisk_image = (grub_uint64_t) initrd_mem; + params->ramdisk_size = LOW_U32(size); + params->ramdisk_image = LOW_U32(initrd_mem); +#if defined(__x86_64__) @@ -97,12 +97,12 @@ index 3e4f7ef39f..6bc18d5aef 100644 params = kernel_alloc (sizeof(*params), "cannot allocate kernel parameters"); if (!params) goto fail; -@@ -372,21 +405,40 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -372,20 +405,41 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline); - grub_dprintf ("linux", "setting lh->cmd_line_ptr to 0x%08x\n", -- linux_cmdline); -- lh->cmd_line_ptr = linux_cmdline; + +- lh->cmd_line_ptr = (grub_uint64_t) linux_cmdline; ++ grub_dprintf ("linux", "setting lh->cmd_line_ptr to 0x%08x\n", + LOW_U32(linux_cmdline)); + lh->cmd_line_ptr = LOW_U32(linux_cmdline); +#if defined(__x86_64__) @@ -140,7 +140,7 @@ index 3e4f7ef39f..6bc18d5aef 100644 if (!kernel_mem) goto fail; grub_dprintf("linux", "kernel_mem = %p\n", kernel_mem); -@@ -395,8 +447,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -394,8 +448,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), loaded = 1; @@ -153,10 +153,10 @@ index 3e4f7ef39f..6bc18d5aef 100644 grub_memcpy (kernel_mem, (char *)kernel + start, filelen - start); diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h -index 25ef52c04e..fac22476cc 100644 +index 4ccd9d7d9f2..461097781fd 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h -@@ -236,7 +236,11 @@ struct linux_kernel_params +@@ -246,7 +246,11 @@ struct linux_kernel_params grub_uint32_t ofw_cif_handler; /* b8 */ grub_uint32_t ofw_idt; /* bc */ diff --git a/0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0226-efi-Set-image-base-address-before-jumping-to-the-PE-.patch similarity index 78% rename from 0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch rename to 0226-efi-Set-image-base-address-before-jumping-to-the-PE-.patch index 6aa50136..f6176ba0 100644 --- a/0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +++ b/0226-efi-Set-image-base-address-before-jumping-to-the-PE-.patch @@ -29,18 +29,18 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 14 insertions(+) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 0622dfa48d..e8b9ecb17f 100644 +index 742e8e9af35..32766bf7b19 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c -@@ -72,6 +72,7 @@ grub_err_t - grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, +@@ -139,6 +139,7 @@ grub_err_t + grub_efi_linux_boot (void *kernel_address, grub_off_t handover_offset, void *kernel_params) { + grub_efi_loaded_image_t *loaded_image = NULL; handover_func hf; int offset = 0; -@@ -79,6 +80,19 @@ grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, +@@ -146,6 +147,19 @@ grub_efi_linux_boot (void *kernel_address, grub_off_t handover_offset, offset = 512; #endif @@ -51,12 +51,12 @@ index 0622dfa48d..e8b9ecb17f 100644 + */ + loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); + if (loaded_image) -+ loaded_image->image_base = kernel_addr; ++ loaded_image->image_base = kernel_address; + else + grub_dprintf ("linux", "Loaded Image base address could not be set\n"); + -+ grub_dprintf ("linux", "kernel_addr: %p handover_offset: %p params: %p\n", -+ kernel_addr, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); - hf = (handover_func)((char *)kernel_addr + handover_offset + offset); ++ grub_dprintf ("linux", "kernel_address: %p handover_offset: %p params: %p\n", ++ kernel_address, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); + hf = (handover_func)((char *)kernel_address + handover_offset + offset); hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); diff --git a/0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch b/0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch deleted file mode 100644 index 54918163..00000000 --- a/0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch +++ /dev/null @@ -1,255 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 28 Jun 2021 14:16:14 +1000 -Subject: [PATCH] video/readers/jpeg: Abort sooner if a read operation fails - -Fuzzing revealed some inputs that were taking a long time, potentially -forever, because they did not bail quickly upon encountering an I/O error. - -Try to catch I/O errors sooner and bail out. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit ab2e5d2e4bff488bbb557ed435a61ae102ef9f0c) ---- - grub-core/video/readers/jpeg.c | 86 ++++++++++++++++++++++++++++++++++-------- - 1 file changed, 70 insertions(+), 16 deletions(-) - -diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c -index e31602f766..10225abd53 100644 ---- a/grub-core/video/readers/jpeg.c -+++ b/grub-core/video/readers/jpeg.c -@@ -109,9 +109,17 @@ static grub_uint8_t - grub_jpeg_get_byte (struct grub_jpeg_data *data) - { - grub_uint8_t r; -+ grub_ssize_t bytes_read; - - r = 0; -- grub_file_read (data->file, &r, 1); -+ bytes_read = grub_file_read (data->file, &r, 1); -+ -+ if (bytes_read != 1) -+ { -+ grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "jpeg: unexpected end of data"); -+ return 0; -+ } - - return r; - } -@@ -120,9 +128,17 @@ static grub_uint16_t - grub_jpeg_get_word (struct grub_jpeg_data *data) - { - grub_uint16_t r; -+ grub_ssize_t bytes_read; - - r = 0; -- grub_file_read (data->file, &r, sizeof (grub_uint16_t)); -+ bytes_read = grub_file_read (data->file, &r, sizeof (grub_uint16_t)); -+ -+ if (bytes_read != sizeof (grub_uint16_t)) -+ { -+ grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "jpeg: unexpected end of data"); -+ return 0; -+ } - - return grub_be_to_cpu16 (r); - } -@@ -135,6 +151,11 @@ grub_jpeg_get_bit (struct grub_jpeg_data *data) - if (data->bit_mask == 0) - { - data->bit_save = grub_jpeg_get_byte (data); -+ if (grub_errno != GRUB_ERR_NONE) { -+ grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "jpeg: file read error"); -+ return 0; -+ } - if (data->bit_save == JPEG_ESC_CHAR) - { - if (grub_jpeg_get_byte (data) != 0) -@@ -143,6 +164,11 @@ grub_jpeg_get_bit (struct grub_jpeg_data *data) - "jpeg: invalid 0xFF in data stream"); - return 0; - } -+ if (grub_errno != GRUB_ERR_NONE) -+ { -+ grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: file read error"); -+ return 0; -+ } - } - data->bit_mask = 0x80; - } -@@ -161,7 +187,7 @@ grub_jpeg_get_number (struct grub_jpeg_data *data, int num) - return 0; - - msb = value = grub_jpeg_get_bit (data); -- for (i = 1; i < num; i++) -+ for (i = 1; i < num && grub_errno == GRUB_ERR_NONE; i++) - value = (value << 1) + (grub_jpeg_get_bit (data) != 0); - if (!msb) - value += 1 - (1 << num); -@@ -202,6 +228,8 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data) - while (data->file->offset + sizeof (count) + 1 <= next_marker) - { - id = grub_jpeg_get_byte (data); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - ac = (id >> 4) & 1; - id &= 0xF; - if (id > 1) -@@ -252,6 +280,8 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data) - - next_marker = data->file->offset; - next_marker += grub_jpeg_get_word (data); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - - if (next_marker > data->file->size) - { -@@ -263,6 +293,8 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data) - <= next_marker) - { - id = grub_jpeg_get_byte (data); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - if (id >= 0x10) /* Upper 4-bit is precision. */ - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: only 8-bit precision is supported"); -@@ -294,6 +326,9 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data) - next_marker = data->file->offset; - next_marker += grub_jpeg_get_word (data); - -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; -+ - if (grub_jpeg_get_byte (data) != 8) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: only 8-bit precision is supported"); -@@ -319,6 +354,8 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid index"); - - ss = grub_jpeg_get_byte (data); /* Sampling factor. */ -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - if (!id) - { - grub_uint8_t vs, hs; -@@ -498,7 +535,7 @@ grub_jpeg_idct_transform (jpeg_data_unit_t du) - } - } - --static void -+static grub_err_t - grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du) - { - int h1, h2, qt; -@@ -513,6 +550,9 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du) - data->dc_value[id] += - grub_jpeg_get_number (data, grub_jpeg_get_huff_code (data, h1)); - -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; -+ - du[0] = data->dc_value[id] * (int) data->quan_table[qt][0]; - pos = 1; - while (pos < ARRAY_SIZE (data->quan_table[qt])) -@@ -527,11 +567,13 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du) - num >>= 4; - pos += num; - -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; -+ - if (pos >= ARRAY_SIZE (jpeg_zigzag_order)) - { -- grub_error (GRUB_ERR_BAD_FILE_TYPE, -- "jpeg: invalid position in zigzag order!?"); -- return; -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "jpeg: invalid position in zigzag order!?"); - } - - du[jpeg_zigzag_order[pos]] = val * (int) data->quan_table[qt][pos]; -@@ -539,6 +581,7 @@ grub_jpeg_decode_du (struct grub_jpeg_data *data, int id, jpeg_data_unit_t du) - } - - grub_jpeg_idct_transform (du); -+ return GRUB_ERR_NONE; - } - - static void -@@ -597,7 +640,8 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data) - data_offset += grub_jpeg_get_word (data); - - cc = grub_jpeg_get_byte (data); -- -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - if (cc != 3 && cc != 1) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: component count must be 1 or 3"); -@@ -610,7 +654,8 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data) - id = grub_jpeg_get_byte (data) - 1; - if ((id < 0) || (id >= 3)) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid index"); -- -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - ht = grub_jpeg_get_byte (data); - data->comp_index[id][1] = (ht >> 4); - data->comp_index[id][2] = (ht & 0xF) + 2; -@@ -618,11 +663,14 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data) - if ((data->comp_index[id][1] < 0) || (data->comp_index[id][1] > 3) || - (data->comp_index[id][2] < 0) || (data->comp_index[id][2] > 3)) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: invalid hufftable index"); -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - } - - grub_jpeg_get_byte (data); /* Skip 3 unused bytes. */ - grub_jpeg_get_word (data); -- -+ if (grub_errno != GRUB_ERR_NONE) -+ return grub_errno; - if (data->file->offset != data_offset) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: extra byte in sos"); - -@@ -640,6 +688,7 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) - { - unsigned c1, vb, hb, nr1, nc1; - int rst = data->dri; -+ grub_err_t err = GRUB_ERR_NONE; - - vb = 8 << data->log_vs; - hb = 8 << data->log_hs; -@@ -660,17 +709,22 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) - - for (r2 = 0; r2 < (1U << data->log_vs); r2++) - for (c2 = 0; c2 < (1U << data->log_hs); c2++) -- grub_jpeg_decode_du (data, 0, data->ydu[r2 * 2 + c2]); -+ { -+ err = grub_jpeg_decode_du (data, 0, data->ydu[r2 * 2 + c2]); -+ if (err != GRUB_ERR_NONE) -+ return err; -+ } - - if (data->color_components >= 3) - { -- grub_jpeg_decode_du (data, 1, data->cbdu); -- grub_jpeg_decode_du (data, 2, data->crdu); -+ err = grub_jpeg_decode_du (data, 1, data->cbdu); -+ if (err != GRUB_ERR_NONE) -+ return err; -+ err = grub_jpeg_decode_du (data, 2, data->crdu); -+ if (err != GRUB_ERR_NONE) -+ return err; - } - -- if (grub_errno) -- return grub_errno; -- - nr2 = (data->r1 == nr1 - 1) ? (data->image_height - data->r1 * vb) : vb; - nc2 = (c1 == nc1 - 1) ? (data->image_width - c1 * hb) : hb; - diff --git a/0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch b/0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch deleted file mode 100644 index 199ec32c..00000000 --- a/0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 28 Jun 2021 14:16:58 +1000 -Subject: [PATCH] video/readers/jpeg: Do not reallocate a given huff table - -Fix a memory leak where an invalid file could cause us to reallocate -memory for a huffman table we had already allocated memory for. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit bc06e12b4de55cc6f926af9f064170c82b1403e9) ---- - grub-core/video/readers/jpeg.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c -index 10225abd53..caa211f06d 100644 ---- a/grub-core/video/readers/jpeg.c -+++ b/grub-core/video/readers/jpeg.c -@@ -245,6 +245,9 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data) - n += count[i]; - - id += ac * 2; -+ if (data->huff_value[id] != NULL) -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "jpeg: attempt to reallocate huffman table"); - data->huff_value[id] = grub_malloc (n); - if (grub_errno) - return grub_errno; diff --git a/0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch b/0227-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch similarity index 97% rename from 0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch rename to 0227-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch index 7c41e87e..35c0f323 100644 --- a/0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +++ b/0227-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch @@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 6bc18d5aef..15d40d6e35 100644 +index 015bb01d4c4..adfb2739ae4 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -144,7 +144,7 @@ grub_linuxefi_unload (void) diff --git a/0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch b/0228-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch similarity index 97% rename from 0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch rename to 0228-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch index 8e63d1d9..7b507d9c 100644 --- a/0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +++ b/0228-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch @@ -13,7 +13,7 @@ Signed-off-by: Colin Watson 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 15d40d6e35..f992ceeef2 100644 +index adfb2739ae4..325aa594db1 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -28,6 +28,8 @@ diff --git a/0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch b/0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch deleted file mode 100644 index 179238be..00000000 --- a/0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 28 Jun 2021 14:25:17 +1000 -Subject: [PATCH] video/readers/jpeg: Refuse to handle multiple start of - streams - -An invalid file could contain multiple start of stream blocks, which -would cause us to reallocate and leak our bitmap. Refuse to handle -multiple start of streams. - -Additionally, fix a grub_error() call formatting. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit f3a854def3e281b7ad4bbea730cd3046de1da52f) ---- - grub-core/video/readers/jpeg.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c -index caa211f06d..1df1171d78 100644 ---- a/grub-core/video/readers/jpeg.c -+++ b/grub-core/video/readers/jpeg.c -@@ -677,6 +677,9 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data) - if (data->file->offset != data_offset) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: extra byte in sos"); - -+ if (*data->bitmap) -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "jpeg: too many start of scan blocks"); -+ - if (grub_video_bitmap_create (data->bitmap, data->image_width, - data->image_height, - GRUB_VIDEO_BLIT_FORMAT_RGB_888)) -@@ -699,8 +702,8 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) - nc1 = (data->image_width + hb - 1) >> (3 + data->log_hs); - - if (data->bitmap_ptr == NULL) -- return grub_error(GRUB_ERR_BAD_FILE_TYPE, -- "jpeg: attempted to decode data before start of stream"); -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "jpeg: attempted to decode data before start of stream"); - - for (; data->r1 < nr1 && (!data->dri || rst); - data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) diff --git a/0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0229-linuxefi-fail-kernel-validation-without-shim-protoco.patch similarity index 69% rename from 0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch rename to 0229-linuxefi-fail-kernel-validation-without-shim-protoco.patch index 828fe16a..0bf7b19e 100644 --- a/0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch +++ b/0229-linuxefi-fail-kernel-validation-without-shim-protoco.patch @@ -16,61 +16,28 @@ CVE-2020-15705 Reported-by: Mathieu Trudel-Lapierre Signed-off-by: Dimitri John Ledkov --- - grub-core/loader/arm64/linux.c | 13 +++++++++---- grub-core/loader/efi/chainloader.c | 1 + grub-core/loader/efi/linux.c | 1 + grub-core/loader/i386/efi/linux.c | 17 +++++++++++------ - 4 files changed, 22 insertions(+), 10 deletions(-) + 3 files changed, 13 insertions(+), 6 deletions(-) -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 70a0075ec5..47f8cf0d84 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -363,11 +364,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); - -- rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size); -- if (rc < 0) -+ if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) - { -- grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); -- goto fail; -+ rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size); -+ if (rc <= 0) -+ { -+ grub_error (GRUB_ERR_INVALID_COMMAND, -+ N_("%s has invalid signature"), argv[0]); -+ goto fail; -+ } - } - - pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index ac8dfd40c6..d41e8ea14a 100644 +index e4ac39c87b4..0ec682e2988 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -1084,6 +1084,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -1088,6 +1088,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), return 0; } + // -1 fall-through to fail fail: - if (dev) + diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index e8b9ecb17f..9260731c10 100644 +index 32766bf7b19..ecb6d593cef 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c -@@ -33,6 +33,7 @@ struct grub_efi_shim_lock +@@ -98,6 +98,7 @@ struct grub_efi_shim_lock }; typedef struct grub_efi_shim_lock grub_efi_shim_lock_t; @@ -79,7 +46,7 @@ index e8b9ecb17f..9260731c10 100644 grub_linuxefi_secure_validate (void *data, grub_uint32_t size) { diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index f992ceeef2..3cf0f9b330 100644 +index 325aa594db1..97484bbe24d 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -30,6 +30,7 @@ @@ -108,7 +75,7 @@ index f992ceeef2..3cf0f9b330 100644 + if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) { - grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), -- argv[0]); +- argv[0]); - goto fail; + rc = grub_linuxefi_secure_validate (kernel, filelen); + if (rc <= 0) diff --git a/0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch b/0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch deleted file mode 100644 index 99eeb621..00000000 --- a/0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Wed, 7 Jul 2021 15:38:19 +1000 -Subject: [PATCH] video/readers/jpeg: Block int underflow -> wild pointer write - -Certain 1 px wide images caused a wild pointer write in -grub_jpeg_ycrcb_to_rgb(). This was caused because in grub_jpeg_decode_data(), -we have the following loop: - -for (; data->r1 < nr1 && (!data->dri || rst); - data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) - -We did not check if vb * width >= hb * nc1. - -On a 64-bit platform, if that turns out to be negative, it will underflow, -be interpreted as unsigned 64-bit, then be added to the 64-bit pointer, so -we see data->bitmap_ptr jump, e.g.: - -0x6180_0000_0480 to -0x6181_0000_0498 - ^ - ~--- carry has occurred and this pointer is now far away from - any object. - -On a 32-bit platform, it will decrement the pointer, creating a pointer -that won't crash but will overwrite random data. - -Catch the underflow and error out. - -Fixes: CVE-2021-3697 - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 41aeb2004db9924fecd9f2dd64bc2a5a5594a4b5) ---- - grub-core/video/readers/jpeg.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c -index 1df1171d78..2da04094b3 100644 ---- a/grub-core/video/readers/jpeg.c -+++ b/grub-core/video/readers/jpeg.c -@@ -705,6 +705,10 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: attempted to decode data before start of stream"); - -+ if (vb * data->image_width <= hb * nc1) -+ return grub_error (GRUB_ERR_BAD_FILE_TYPE, -+ "jpeg: cannot decode image with these dimensions"); -+ - for (; data->r1 < nr1 && (!data->dri || rst); - data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3) - for (c1 = 0; c1 < nc1 && (!data->dri || rst); diff --git a/0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch b/0230-Allow-chainloading-EFI-apps-from-loop-mounts.patch similarity index 81% rename from 0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch rename to 0230-Allow-chainloading-EFI-apps-from-loop-mounts.patch index c3101e10..c5e44570 100644 --- a/0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch +++ b/0230-Allow-chainloading-EFI-apps-from-loop-mounts.patch @@ -7,13 +7,13 @@ Signed-off-by: Dimitri John Ledkov Signed-off-by: Robbie Harwood --- grub-core/disk/loopback.c | 9 +-------- - grub-core/loader/efi/chainloader.c | 23 +++++++++++++++++++++++ + grub-core/loader/efi/chainloader.c | 24 ++++++++++++++++++++++++ include/grub/loopback.h | 30 ++++++++++++++++++++++++++++++ - 3 files changed, 54 insertions(+), 8 deletions(-) + 3 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 include/grub/loopback.h diff --git a/grub-core/disk/loopback.c b/grub-core/disk/loopback.c -index 41bebd14fe..99f47924ec 100644 +index 4635dcfdeec..11a5e0cbd02 100644 --- a/grub-core/disk/loopback.c +++ b/grub-core/disk/loopback.c @@ -21,20 +21,13 @@ @@ -39,7 +39,7 @@ index 41bebd14fe..99f47924ec 100644 static unsigned long last_id = 0; diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index d41e8ea14a..3af6b12292 100644 +index 0ec682e2988..efbe2bd38aa 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c @@ -24,6 +24,7 @@ @@ -50,20 +50,21 @@ index d41e8ea14a..3af6b12292 100644 #include #include #include -@@ -901,6 +902,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -907,6 +908,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_efi_status_t status; grub_efi_boot_services_t *b; grub_device_t dev = 0; + grub_device_t orig_dev = 0; - grub_efi_device_path_t *dp = 0; + grub_efi_device_path_t *dp = NULL; char *filename; void *boot_image = 0; -@@ -958,6 +960,15 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), - if (! dev) - goto fail; - +@@ -963,6 +965,16 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + dev = grub_device_open (devname); + if (devname) + grub_free (devname); ++ + /* if device is loopback, use underlying dev */ -+ if (dev->disk->dev->id == GRUB_DISK_DEVICE_LOOPBACK_ID) ++ if (dev && dev->disk->dev->id == GRUB_DISK_DEVICE_LOOPBACK_ID) + { + struct grub_loopback *d; + orig_dev = dev; @@ -71,10 +72,10 @@ index d41e8ea14a..3af6b12292 100644 + dev = d->file->device; + } + - if (dev->disk) - dev_handle = grub_efidisk_get_device_handle (dev->disk); - else if (dev->net && dev->net->server) -@@ -1065,6 +1076,12 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + if (dev == NULL) + ; + else if (dev->disk) +@@ -1069,6 +1081,12 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } #endif @@ -87,10 +88,10 @@ index d41e8ea14a..3af6b12292 100644 rc = grub_linuxefi_secure_validate((void *)(unsigned long)address, fsize); grub_dprintf ("chain", "linuxefi_secure_validate: %d\n", rc); if (rc > 0) -@@ -1087,6 +1104,12 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), - // -1 fall-through to fail +@@ -1092,6 +1110,12 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), fail: + + if (orig_dev) + { + dev = orig_dev; @@ -102,7 +103,7 @@ index d41e8ea14a..3af6b12292 100644 diff --git a/include/grub/loopback.h b/include/grub/loopback.h new file mode 100644 -index 0000000000..3b9a9e32e8 +index 00000000000..3b9a9e32e80 --- /dev/null +++ b/include/grub/loopback.h @@ -0,0 +1,30 @@ diff --git a/0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch b/0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch deleted file mode 100644 index 6e64ed86..00000000 --- a/0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 13 Jul 2021 13:24:38 +1000 -Subject: [PATCH] normal/charset: Fix array out-of-bounds formatting unicode - for display - -In some cases attempting to display arbitrary binary strings leads -to ASAN splats reading the widthspec array out of bounds. - -Check the index. If it would be out of bounds, return a width of 1. -I don't know if that's strictly correct, but we're not really expecting -great display of arbitrary binary data, and it's certainly not worse than -an OOB read. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit fdf32abc7a3928852422c0f291d8cd1dd6b34a8d) ---- - grub-core/normal/charset.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c -index 4dfcc31078..7a5a7c153c 100644 ---- a/grub-core/normal/charset.c -+++ b/grub-core/normal/charset.c -@@ -395,6 +395,8 @@ grub_unicode_estimate_width (const struct grub_unicode_glyph *c) - { - if (grub_unicode_get_comb_type (c->base)) - return 0; -+ if (((unsigned long) (c->base >> 3)) >= ARRAY_SIZE (widthspec)) -+ return 1; - if (widthspec[c->base >> 3] & (1 << (c->base & 7))) - return 2; - else diff --git a/0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch b/0231-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch similarity index 98% rename from 0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch rename to 0231-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch index 4fe8adf7..084be2f8 100644 --- a/0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +++ b/0231-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch @@ -34,7 +34,7 @@ Signed-off-by: Dimitri John Ledkov 1 file changed, 13 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 3cf0f9b330..941df6400b 100644 +index 97484bbe24d..1dd787081f2 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -30,7 +30,6 @@ diff --git a/0231-net-netbuff-Block-overly-large-netbuff-allocs.patch b/0231-net-netbuff-Block-overly-large-netbuff-allocs.patch deleted file mode 100644 index 2e10d49e..00000000 --- a/0231-net-netbuff-Block-overly-large-netbuff-allocs.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 8 Mar 2022 23:47:46 +1100 -Subject: [PATCH] net/netbuff: Block overly large netbuff allocs - -A netbuff shouldn't be too huge. It's bounded by MTU and TCP segment -reassembly. - -This helps avoid some bugs (and provides a spot to instrument to catch -them at their source). - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit ee9591103004cd13b4efadda671536090ca7fd57) ---- - grub-core/net/netbuff.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/grub-core/net/netbuff.c b/grub-core/net/netbuff.c -index dbeeefe478..d5e9e9a0d7 100644 ---- a/grub-core/net/netbuff.c -+++ b/grub-core/net/netbuff.c -@@ -79,10 +79,23 @@ grub_netbuff_alloc (grub_size_t len) - - COMPILE_TIME_ASSERT (NETBUFF_ALIGN % sizeof (grub_properly_aligned_t) == 0); - -+ /* -+ * The largest size of a TCP packet is 64 KiB, and everything else -+ * should be a lot smaller - most MTUs are 1500 or less. Cap data -+ * size at 64 KiB + a buffer. -+ */ -+ if (len > 0xffffUL + 0x1000UL) -+ { -+ grub_error (GRUB_ERR_BUG, -+ "attempted to allocate a packet that is too big"); -+ return NULL; -+ } -+ - if (len < NETBUFFMINLEN) - len = NETBUFFMINLEN; - - len = ALIGN_UP (len, NETBUFF_ALIGN); -+ - #ifdef GRUB_MACHINE_EMU - data = grub_malloc (len + sizeof (*nb)); - #else diff --git a/0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch b/0232-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch similarity index 86% rename from 0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch rename to 0232-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch index 4c56d60d..1ec47877 100644 --- a/0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +++ b/0232-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch @@ -39,18 +39,18 @@ Signed-off-by: Dimitri John Ledkov 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 3af6b12292..644cd2e56f 100644 +index efbe2bd38aa..3a3b55c1d61 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -906,7 +906,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), - grub_efi_device_path_t *dp = 0; +@@ -912,7 +912,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_efi_device_path_t *dp = NULL; char *filename; void *boot_image = 0; - int rc; - if (argc == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -1082,9 +1081,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + file_path = NULL; + address = 0; +@@ -1087,9 +1086,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), orig_dev = 0; } @@ -61,7 +61,7 @@ index 3af6b12292..644cd2e56f 100644 { grub_file_close (file); grub_device_close (dev); -@@ -1092,7 +1089,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -1097,7 +1094,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_secureboot_chainloader_unload, 0); return 0; } @@ -70,11 +70,11 @@ index 3af6b12292..644cd2e56f 100644 { grub_load_and_start_image(boot_image); grub_file_close (file); -@@ -1101,7 +1098,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -1106,7 +1103,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), return 0; } - // -1 fall-through to fail fail: - if (orig_dev) + diff --git a/0232-net-ip-Do-IP-fragment-maths-safely.patch b/0232-net-ip-Do-IP-fragment-maths-safely.patch deleted file mode 100644 index 118448d1..00000000 --- a/0232-net-ip-Do-IP-fragment-maths-safely.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 20 Dec 2021 19:41:21 +1100 -Subject: [PATCH] net/ip: Do IP fragment maths safely - -This avoids an underflow and subsequent unpleasantness. - -Fixes: CVE-2022-28733 - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit eb74e5743ca7e18a5e75c392fe0b21d1549a1936) ---- - grub-core/net/ip.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index ce6bdc75c6..cf74f1f794 100644 ---- a/grub-core/net/ip.c -+++ b/grub-core/net/ip.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #include - - struct iphdr { -@@ -551,7 +552,14 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb, - { - rsm->total_len = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK) - + (nb->tail - nb->data)); -- rsm->total_len -= ((iph->verhdrlen & 0xf) * sizeof (grub_uint32_t)); -+ -+ if (grub_sub (rsm->total_len, (iph->verhdrlen & 0xf) * sizeof (grub_uint32_t), -+ &rsm->total_len)) -+ { -+ grub_dprintf ("net", "IP reassembly size underflow\n"); -+ return GRUB_ERR_NONE; -+ } -+ - rsm->asm_netbuff = grub_netbuff_alloc (rsm->total_len); - if (!rsm->asm_netbuff) - { diff --git a/0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch b/0233-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch similarity index 83% rename from 0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch rename to 0233-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch index c683fcb7..a9f78884 100644 --- a/0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +++ b/0233-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Dimitri John Ledkov -Date: Fri, 4 Mar 2022 11:36:09 +0100 +From: Leo Sandoval +Date: Mon, 8 Apr 2024 10:59:25 -0600 Subject: [PATCH] grub-core/loader/efi/linux.c: drop now unused grub_linuxefi_secure_validate @@ -13,17 +13,17 @@ shim-lock-verifier is an optional module. Signed-off-by: Dimitri John Ledkov --- - grub-core/loader/efi/linux.c | 40 ---------------------------------------- + grub-core/loader/efi/linux.c | 42 ------------------------------------------ include/grub/efi/linux.h | 2 -- - 2 files changed, 42 deletions(-) + 2 files changed, 44 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 9260731c10..9265cf4200 100644 +index ecb6d593cef..f5ab0128991 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c -@@ -24,46 +24,6 @@ - #include - #include +@@ -89,48 +89,6 @@ static grub_efi_load_file2_t initrd_lf2 = { + grub_efi_initrd_load_file2 + }; -#define SHIM_LOCK_GUID \ - { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} } @@ -38,11 +38,12 @@ index 9260731c10..9265cf4200 100644 -int -grub_linuxefi_secure_validate (void *data, grub_uint32_t size) -{ -- grub_efi_guid_t guid = SHIM_LOCK_GUID; +- grub_guid_t guid = SHIM_LOCK_GUID; - grub_efi_shim_lock_t *shim_lock; - grub_efi_status_t status; - - shim_lock = grub_efi_locate_protocol(&guid, NULL); +- - grub_dprintf ("secureboot", "shim_lock: %p\n", shim_lock); - if (!shim_lock) - { @@ -63,13 +64,14 @@ index 9260731c10..9265cf4200 100644 - (unsigned long) status); - - return -1; +- -} - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h -index 0033d9305a..887b02fd9f 100644 +index b2cfd8c1f44..c806a7757f3 100644 --- a/include/grub/efi/linux.h +++ b/include/grub/efi/linux.h @@ -22,8 +22,6 @@ @@ -80,4 +82,4 @@ index 0033d9305a..887b02fd9f 100644 -EXPORT_FUNC(grub_linuxefi_secure_validate) (void *data, grub_uint32_t size); grub_err_t EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, - void *kernel_param); + void *kernel_param); diff --git a/0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch b/0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch deleted file mode 100644 index 19701b6a..00000000 --- a/0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 16 Sep 2021 01:29:54 +1000 -Subject: [PATCH] net/dns: Fix double-free addresses on corrupt DNS response - -grub_net_dns_lookup() takes as inputs a pointer to an array of addresses -("addresses") for the given name, and pointer to a number of addresses -("naddresses"). grub_net_dns_lookup() is responsible for allocating -"addresses", and the caller is responsible for freeing it if -"naddresses" > 0. - -The DNS recv_hook will sometimes set and free the addresses array, -for example if the packet is too short: - - if (ptr + 10 >= nb->tail) - { - if (!*data->naddresses) - grub_free (*data->addresses); - grub_netbuff_free (nb); - return GRUB_ERR_NONE; - } - -Later on the nslookup command code unconditionally frees the "addresses" -array. Normally this is fine: the array is either populated with valid -data or is NULL. But in these sorts of error cases it is neither NULL -nor valid and we get a double-free. - -Only free "addresses" if "naddresses" > 0. - -It looks like the other use of grub_net_dns_lookup() is not affected. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit eb2e69fcf51307757e43f55ee8c9354d1ee42dd1) ---- - grub-core/net/dns.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c -index 906ec7d678..135faac035 100644 ---- a/grub-core/net/dns.c -+++ b/grub-core/net/dns.c -@@ -667,9 +667,11 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)), - grub_net_addr_to_str (&addresses[i], buf); - grub_printf ("%s\n", buf); - } -- grub_free (addresses); - if (naddresses) -- return GRUB_ERR_NONE; -+ { -+ grub_free (addresses); -+ return GRUB_ERR_NONE; -+ } - return grub_error (GRUB_ERR_NET_NO_DOMAIN, N_("no DNS record found")); - } - diff --git a/0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch b/0234-loader-efi-chainloader-grub_load_and_start_image-doe.patch similarity index 87% rename from 0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch rename to 0234-loader-efi-chainloader-grub_load_and_start_image-doe.patch index f61ed282..75cb622c 100644 --- a/0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch +++ b/0234-loader-efi-chainloader-grub_load_and_start_image-doe.patch @@ -21,10 +21,10 @@ Signed-off-by: Chris Coulson 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 644cd2e56f..d3bf02ed8a 100644 +index 3a3b55c1d61..9c6a5f92600 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -841,7 +841,7 @@ grub_secureboot_chainloader_unload (void) +@@ -847,7 +847,7 @@ grub_secureboot_chainloader_unload (void) } static grub_err_t @@ -33,7 +33,7 @@ index 644cd2e56f..d3bf02ed8a 100644 { grub_efi_boot_services_t *b; grub_efi_status_t status; -@@ -883,13 +883,23 @@ grub_load_and_start_image(void *boot_image) +@@ -889,13 +889,23 @@ grub_load_and_start_image(void *boot_image) static grub_err_t grub_secureboot_chainloader_boot (void) { @@ -58,7 +58,7 @@ index 644cd2e56f..d3bf02ed8a 100644 grub_loader_unset (); return grub_errno; } -@@ -1091,7 +1101,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -1096,7 +1106,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), } else { @@ -66,4 +66,4 @@ index 644cd2e56f..d3bf02ed8a 100644 + grub_load_image(boot_image); grub_file_close (file); grub_device_close (dev); - grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); + grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0); diff --git a/0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch b/0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch deleted file mode 100644 index ab0d4712..00000000 --- a/0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 20 Dec 2021 21:55:43 +1100 -Subject: [PATCH] net/dns: Don't read past the end of the string we're checking - against - -I don't really understand what's going on here but fuzzing found -a bug where we read past the end of check_with. That's a C string, -so use grub_strlen() to make sure we don't overread it. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 6a97b3f4b1d5173aa516edc6dedbc63de7306d21) ---- - grub-core/net/dns.c | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) - -diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c -index 135faac035..17961a9f18 100644 ---- a/grub-core/net/dns.c -+++ b/grub-core/net/dns.c -@@ -146,11 +146,18 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head, - int *length, char *set) - { - const char *readable_ptr = check_with; -+ int readable_len; - const grub_uint8_t *ptr; - char *optr = set; - int bytes_processed = 0; - if (length) - *length = 0; -+ -+ if (readable_ptr != NULL) -+ readable_len = grub_strlen (readable_ptr); -+ else -+ readable_len = 0; -+ - for (ptr = name_at; ptr < tail && bytes_processed < tail - head + 2; ) - { - /* End marker. */ -@@ -172,13 +179,16 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head, - ptr = head + (((ptr[0] & 0x3f) << 8) | ptr[1]); - continue; - } -- if (readable_ptr && grub_memcmp (ptr + 1, readable_ptr, *ptr) != 0) -+ if (readable_ptr != NULL && (*ptr > readable_len || grub_memcmp (ptr + 1, readable_ptr, *ptr) != 0)) - return 0; - if (grub_memchr (ptr + 1, 0, *ptr) - || grub_memchr (ptr + 1, '.', *ptr)) - return 0; - if (readable_ptr) -- readable_ptr += *ptr; -+ { -+ readable_ptr += *ptr; -+ readable_len -= *ptr; -+ } - if (readable_ptr && *readable_ptr != '.' && *readable_ptr != 0) - return 0; - bytes_processed += *ptr + 1; -@@ -192,7 +202,10 @@ check_name_real (const grub_uint8_t *name_at, const grub_uint8_t *head, - if (optr) - *optr++ = '.'; - if (readable_ptr && *readable_ptr) -- readable_ptr++; -+ { -+ readable_ptr++; -+ readable_len--; -+ } - ptr += *ptr + 1; - } - return 0; diff --git a/0213-loader-efi-chainloader-simplify-the-loader-state.patch b/0235-loader-efi-chainloader-simplify-the-loader-state.patch similarity index 76% rename from 0213-loader-efi-chainloader-simplify-the-loader-state.patch rename to 0235-loader-efi-chainloader-simplify-the-loader-state.patch index 205124e4..d9962f07 100644 --- a/0213-loader-efi-chainloader-simplify-the-loader-state.patch +++ b/0235-loader-efi-chainloader-simplify-the-loader-state.patch @@ -18,14 +18,14 @@ Signed-off-by: Chris Coulson [rharwood: fix unitialized handle and double-frees of file/dev] Signed-off-by: Robbie Harwood --- - grub-core/loader/efi/chainloader.c | 160 +++++++++++++++++++++++-------------- - 1 file changed, 102 insertions(+), 58 deletions(-) + grub-core/loader/efi/chainloader.c | 161 ++++++++++++++++++++++++------------- + 1 file changed, 103 insertions(+), 58 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index d3bf02ed8a..3342492ff1 100644 +index 9c6a5f92600..cbe028cd8af 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -48,38 +48,21 @@ GRUB_MOD_LICENSE ("GPLv3+"); +@@ -49,46 +49,30 @@ GRUB_MOD_LICENSE ("GPLv3+"); static grub_dl_t my_mod; @@ -38,7 +38,7 @@ index d3bf02ed8a..3342492ff1 100644 -static grub_ssize_t cmdline_len; -static grub_efi_handle_t dev_handle; --static grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); +-static grub_efi_status_t (__grub_efi_api *entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); +struct grub_secureboot_chainloader_context { + grub_efi_physical_address_t address; + grub_efi_uintn_t pages; @@ -51,40 +51,41 @@ index d3bf02ed8a..3342492ff1 100644 +static struct grub_secureboot_chainloader_context *sb_context; static grub_err_t --grub_chainloader_unload (void) +-grub_chainloader_unload (void *context) -{ +- grub_efi_loaded_image_t *loaded_image; - grub_efi_boot_services_t *b; - -- b = grub_efi_system_table->boot_services; -- efi_call_1 (b->unload_image, image_handle); -- grub_efi_free_pages (address, pages); +- image_handle = (grub_efi_handle_t) context; +- loaded_image = grub_efi_get_loaded_image (image_handle); +- if (loaded_image != NULL) +- grub_free (loaded_image->load_options); - -- grub_free (file_path); -- grub_free (cmdline); -- cmdline = 0; -- file_path = 0; -- dev_handle = 0; +- b = grub_efi_system_table->boot_services; +- b->unload_image (image_handle); - - grub_dl_unref (my_mod); - return GRUB_ERR_NONE; -} - -static grub_err_t --grub_chainloader_boot (void) +-grub_chainloader_boot (void *context) +grub_start_image (grub_efi_handle_t handle) { grub_efi_boot_services_t *b; grub_efi_status_t status; -@@ -87,7 +70,7 @@ grub_chainloader_boot (void) + grub_efi_uintn_t exit_data_size; grub_efi_char16_t *exit_data = NULL; +- image_handle = (grub_efi_handle_t) context; b = grub_efi_system_table->boot_services; -- status = efi_call_3 (b->start_image, image_handle, &exit_data_size, &exit_data); -+ status = efi_call_3 (b->start_image, handle, &exit_data_size, &exit_data); +- status = b->start_image (image_handle, &exit_data_size, &exit_data); ++ ++ status = b->start_image (handle, &exit_data_size, &exit_data); if (status != GRUB_EFI_SUCCESS) { if (exit_data) -@@ -111,11 +94,37 @@ grub_chainloader_boot (void) +@@ -112,11 +96,37 @@ grub_chainloader_boot (void *context) if (exit_data) grub_efi_free_pool (exit_data); @@ -104,7 +105,7 @@ index d3bf02ed8a..3342492ff1 100644 + grub_free (loaded_image->load_options); + + b = grub_efi_system_table->boot_services; -+ efi_call_1 (b->unload_image, image_handle); ++ b->unload_image (image_handle); + + grub_dl_unref (my_mod); + return GRUB_ERR_NONE; @@ -124,7 +125,7 @@ index d3bf02ed8a..3342492ff1 100644 static grub_err_t copy_file_path (grub_efi_file_path_device_path_t *fp, const char *str, grub_efi_uint16_t len) -@@ -150,7 +159,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) +@@ -151,7 +161,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) char *dir_start; char *dir_end; grub_size_t size; @@ -133,29 +134,32 @@ index d3bf02ed8a..3342492ff1 100644 dir_start = grub_strchr (filename, ')'); if (! dir_start) -@@ -526,10 +535,12 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) +@@ -527,12 +537,14 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp) } static grub_efi_boolean_t -handle_image (void *data, grub_efi_uint32_t datasize) +handle_image (struct grub_secureboot_chainloader_context *load_context) { + grub_efi_boot_services_t *b; grub_efi_loaded_image_t *li, li_bak; grub_efi_status_t efi_status; +- char *buffer = NULL; + void *data = (void *)(unsigned long)load_context->address; + grub_efi_uint32_t datasize = load_context->fsize; - void *buffer = NULL; ++ void *buffer = NULL; char *buffer_aligned = NULL; grub_efi_uint32_t i; -@@ -540,6 +551,7 @@ handle_image (void *data, grub_efi_uint32_t datasize) + struct grub_pe32_section_table *section; +@@ -542,6 +554,7 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_uint32_t buffer_size; int found_entry_point = 0; int rc; + grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); - rc = read_header (data, datasize, &context); - if (rc < 0) -@@ -797,10 +809,10 @@ handle_image (void *data, grub_efi_uint32_t datasize) + b = grub_efi_system_table->boot_services; + +@@ -801,10 +814,10 @@ handle_image (void *data, grub_efi_uint32_t datasize) grub_memcpy (&li_bak, li, sizeof (grub_efi_loaded_image_t)); li->image_base = buffer_aligned; li->image_size = context.image_size; @@ -170,21 +174,23 @@ index d3bf02ed8a..3342492ff1 100644 if (!li->file_path) { grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching file path found"); -@@ -829,19 +841,22 @@ error_exit: +@@ -832,22 +845,22 @@ error_exit: static grub_err_t grub_secureboot_chainloader_unload (void) { -- grub_efi_free_pages (address, pages); +- grub_efi_boot_services_t *b; ++ grub_efi_free_pages (sb_context->address, sb_context->pages); ++ grub_free (sb_context->file_path); ++ grub_free (sb_context->cmdline); ++ grub_free (sb_context); + +- b = grub_efi_system_table->boot_services; +- b->free_pages (address, pages); - grub_free (file_path); - grub_free (cmdline); - cmdline = 0; - file_path = 0; - dev_handle = 0; -+ grub_efi_free_pages (sb_context->address, sb_context->pages); -+ grub_free (sb_context->file_path); -+ grub_free (sb_context->cmdline); -+ grub_free (sb_context); -+ + sb_context = 0; grub_dl_unref (my_mod); @@ -200,16 +206,16 @@ index d3bf02ed8a..3342492ff1 100644 { grub_efi_boot_services_t *b; grub_efi_status_t status; -@@ -850,7 +865,7 @@ grub_load_image(void *boot_image) +@@ -856,7 +869,7 @@ grub_load_image(void *boot_image) b = grub_efi_system_table->boot_services; - status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path, -- boot_image, fsize, &image_handle); -+ boot_image, image_size, image_handle_out); + status = b->load_image (0, grub_efi_image_handle, file_path, +- boot_image, fsize, &image_handle); ++ boot_image, image_size, image_handle_out); if (status != GRUB_EFI_SUCCESS) { if (status == GRUB_EFI_OUT_OF_RESOURCES) -@@ -863,7 +878,7 @@ grub_load_image(void *boot_image) +@@ -869,7 +882,7 @@ grub_load_image(void *boot_image) /* LoadImage does not set a device handler when the image is loaded from memory, so it is necessary to set it explicitly here. This is a mess. */ @@ -218,7 +224,7 @@ index d3bf02ed8a..3342492ff1 100644 if (! loaded_image) { grub_error (GRUB_ERR_BAD_OS, "no loaded image available"); -@@ -885,20 +900,25 @@ grub_secureboot_chainloader_boot (void) +@@ -891,20 +904,25 @@ grub_secureboot_chainloader_boot (void) { grub_efi_boot_services_t *b; int rc; @@ -244,15 +250,15 @@ index d3bf02ed8a..3342492ff1 100644 b = grub_efi_system_table->boot_services; - efi_call_1 (b->unload_image, image_handle); -+ efi_call_1 (b->unload_image, handle); ++ b->unload_image (handle); grub_loader_unset (); return grub_errno; -@@ -913,9 +933,15 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -919,9 +937,15 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_efi_boot_services_t *b; grub_device_t dev = 0; grub_device_t orig_dev = 0; -- grub_efi_device_path_t *dp = 0; +- grub_efi_device_path_t *dp = NULL; + grub_efi_device_path_t *dp = 0, *file_path = 0; char *filename; void *boot_image = 0; @@ -263,22 +269,9 @@ index d3bf02ed8a..3342492ff1 100644 + grub_ssize_t cmdline_len = 0; + grub_efi_handle_t dev_handle = 0; - if (argc == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -923,12 +949,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), - - grub_dl_ref (my_mod); - -- /* Initialize some global variables. */ -- address = 0; -- image_handle = 0; -- file_path = 0; -- dev_handle = 0; -- - b = grub_efi_system_table->boot_services; - - if (argc > 1) -@@ -1093,17 +1113,35 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + file_path = NULL; + address = 0; +@@ -1098,18 +1122,36 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) { @@ -307,24 +300,27 @@ index d3bf02ed8a..3342492ff1 100644 + cmdline_len, &image_handle); grub_file_close (file); grub_device_close (dev); +- grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0); + + /* We're finished with the source image buffer and file path now */ -+ efi_call_2 (b->free_pages, address, pages); ++ b->free_pages (address, pages); + grub_free (file_path); + - grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); ++ grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); return 0; -@@ -1130,6 +1168,12 @@ fail: + } +@@ -1137,8 +1179,11 @@ fail: if (cmdline) grub_free (cmdline); +- if (image_handle != NULL) +- b->unload_image (image_handle); + if (image_handle != 0) + { -+ efi_call_1 (b->unload_image, image_handle); ++ b->unload_image (image_handle); + image_handle = 0; + } -+ + grub_dl_unref (my_mod); - return grub_errno; diff --git a/0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch b/0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch deleted file mode 100644 index 3ff7b6bb..00000000 --- a/0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 20 Sep 2021 01:12:24 +1000 -Subject: [PATCH] net/tftp: Prevent a UAF and double-free from a failed seek - -A malicious tftp server can cause UAFs and a double free. - -An attempt to read from a network file is handled by grub_net_fs_read(). If -the read is at an offset other than the current offset, grub_net_seek_real() -is invoked. - -In grub_net_seek_real(), if a backwards seek cannot be satisfied from the -currently received packets, and the underlying transport does not provide -a seek method, then grub_net_seek_real() will close and reopen the network -protocol layer. - -For tftp, the ->close() call goes to tftp_close() and frees the tftp_data_t -file->data. The file->data pointer is not nulled out after the free. - -If the ->open() call fails, the file->data will not be reallocated and will -continue point to a freed memory block. This could happen from a server -refusing to send the requisite ack to the new tftp request, for example. - -The seek and the read will then fail, but the grub_file continues to exist: -the failed seek does not necessarily cause the entire file to be thrown -away (e.g. where the file is checked to see if it is gzipped/lzio/xz/etc., -a read failure is interpreted as a decompressor passing on the file, not as -an invalidation of the entire grub_file_t structure). - -This means subsequent attempts to read or seek the file will use the old -file->data after free. Eventually, the file will be close()d again and -file->data will be freed again. - -Mark a net_fs file that doesn't reopen as broken. Do not permit read() or -close() on a broken file (seek is not exposed directly to the file API - -it is only called as part of read, so this blocks seeks as well). - -As an additional defence, null out the ->data pointer if tftp_open() fails. -That would have lead to a simple null pointer dereference rather than -a mess of UAFs. - -This may affect other protocols, I haven't checked. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit dada1dda695439bb55b2848dddc2d89843552f81) ---- - grub-core/net/net.c | 11 +++++++++-- - grub-core/net/tftp.c | 1 + - include/grub/net.h | 1 + - 3 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 55aed92722..1001c611d1 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -1625,7 +1625,8 @@ grub_net_fs_close (grub_file_t file) - grub_netbuff_free (file->device->net->packs.first->nb); - grub_net_remove_packet (file->device->net->packs.first); - } -- file->device->net->protocol->close (file); -+ if (!file->device->net->broken) -+ file->device->net->protocol->close (file); - grub_free (file->device->net->name); - return GRUB_ERR_NONE; - } -@@ -1847,7 +1848,10 @@ grub_net_seek_real (struct grub_file *file, grub_off_t offset) - file->device->net->stall = 0; - err = file->device->net->protocol->open (file, file->device->net->name); - if (err) -- return err; -+ { -+ file->device->net->broken = 1; -+ return err; -+ } - grub_net_fs_read_real (file, NULL, offset); - return grub_errno; - } -@@ -1856,6 +1860,9 @@ grub_net_seek_real (struct grub_file *file, grub_off_t offset) - static grub_ssize_t - grub_net_fs_read (grub_file_t file, char *buf, grub_size_t len) - { -+ if (file->device->net->broken) -+ return -1; -+ - if (file->offset != file->device->net->offset) - { - grub_err_t err; -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index d54b13f09f..788ad1dc44 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -408,6 +408,7 @@ tftp_open (struct grub_file *file, const char *filename) - { - grub_net_udp_close (data->sock); - grub_free (data); -+ file->data = NULL; - return grub_errno; - } - -diff --git a/include/grub/net.h b/include/grub/net.h -index 42af7de250..9e4898cc6b 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -280,6 +280,7 @@ typedef struct grub_net - grub_fs_t fs; - int eof; - int stall; -+ int broken; - } *grub_net_t; - - extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name); diff --git a/0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch b/0236-loader-efi-chainloader-Use-grub_loader_set_ex.patch similarity index 79% rename from 0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch rename to 0236-loader-efi-chainloader-Use-grub_loader_set_ex.patch index fc15b842..ce98152d 100644 --- a/0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch +++ b/0236-loader-efi-chainloader-Use-grub_loader_set_ex.patch @@ -12,14 +12,14 @@ Signed-off-by: Chris Coulson [rharwood: context sludge from other change] Signed-off-by: Robbie Harwood --- - grub-core/loader/efi/chainloader.c | 38 ++++++++++++++++++++++---------------- - 1 file changed, 22 insertions(+), 16 deletions(-) + grub-core/loader/efi/chainloader.c | 39 +++++++++++++++++++++----------------- + 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index 3342492ff1..fb874f1855 100644 +index cbe028cd8af..b40acdeda80 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -48,8 +48,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); +@@ -49,8 +49,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); static grub_dl_t my_mod; @@ -28,7 +28,7 @@ index 3342492ff1..fb874f1855 100644 struct grub_secureboot_chainloader_context { grub_efi_physical_address_t address; grub_efi_uintn_t pages; -@@ -59,7 +57,6 @@ struct grub_secureboot_chainloader_context { +@@ -60,7 +58,6 @@ struct grub_secureboot_chainloader_context { grub_ssize_t cmdline_len; grub_efi_handle_t dev_handle; }; @@ -36,7 +36,7 @@ index 3342492ff1..fb874f1855 100644 static grub_err_t grub_start_image (grub_efi_handle_t handle) -@@ -98,11 +95,14 @@ grub_start_image (grub_efi_handle_t handle) +@@ -100,11 +97,14 @@ grub_start_image (grub_efi_handle_t handle) } static grub_err_t @@ -52,7 +52,7 @@ index 3342492ff1..fb874f1855 100644 loaded_image = grub_efi_get_loaded_image (image_handle); if (loaded_image != NULL) grub_free (loaded_image->load_options); -@@ -115,10 +115,12 @@ grub_chainloader_unload (void) +@@ -117,10 +117,12 @@ grub_chainloader_unload (void) } static grub_err_t @@ -66,7 +66,7 @@ index 3342492ff1..fb874f1855 100644 err = grub_start_image (image_handle); grub_loader_unset (); -@@ -839,15 +841,17 @@ error_exit: +@@ -843,15 +845,17 @@ error_exit: } static grub_err_t @@ -87,7 +87,7 @@ index 3342492ff1..fb874f1855 100644 grub_dl_unref (my_mod); return GRUB_ERR_NONE; } -@@ -896,12 +900,15 @@ grub_load_image(grub_efi_device_path_t *file_path, void *boot_image, +@@ -900,12 +904,15 @@ grub_load_image(grub_efi_device_path_t *file_path, void *boot_image, } static grub_err_t @@ -104,16 +104,16 @@ index 3342492ff1..fb874f1855 100644 rc = handle_image (sb_context); if (rc == 0) { -@@ -942,6 +949,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -946,6 +953,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_efi_char16_t *cmdline = 0; grub_ssize_t cmdline_len = 0; grub_efi_handle_t dev_handle = 0; + grub_efi_handle_t image_handle = 0; + struct grub_secureboot_chainloader_context *sb_context = 0; - if (argc == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -1127,8 +1136,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + file_path = NULL; + address = 0; +@@ -1136,8 +1145,8 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), grub_file_close (file); grub_device_close (dev); @@ -124,8 +124,8 @@ index 3342492ff1..fb874f1855 100644 return 0; } else -@@ -1142,7 +1151,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), - efi_call_2 (b->free_pages, address, pages); +@@ -1151,7 +1160,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + b->free_pages (address, pages); grub_free (file_path); - grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); @@ -133,15 +133,16 @@ index 3342492ff1..fb874f1855 100644 return 0; } -@@ -1169,10 +1178,7 @@ fail: +@@ -1179,11 +1188,7 @@ fail: + if (cmdline) grub_free (cmdline); - if (image_handle != 0) +- if (image_handle != 0) - { -- efi_call_1 (b->unload_image, image_handle); +- b->unload_image (image_handle); - image_handle = 0; - } -+ efi_call_1 (b->unload_image, image_handle); ++ b->unload_image (image_handle); grub_dl_unref (my_mod); diff --git a/0236-net-tftp-Avoid-a-trivial-UAF.patch b/0236-net-tftp-Avoid-a-trivial-UAF.patch deleted file mode 100644 index 4ec3b562..00000000 --- a/0236-net-tftp-Avoid-a-trivial-UAF.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 18 Jan 2022 14:29:20 +1100 -Subject: [PATCH] net/tftp: Avoid a trivial UAF - -Under tftp errors, we print a tftp error message from the tftp header. -However, the tftph pointer is a pointer inside nb, the netbuff. Previously, -we were freeing the nb and then dereferencing it. Don't do that, use it -and then free it later. - -This isn't really _bad_ per se, especially as we're single-threaded, but -it trips up fuzzers. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 956f4329cec23e4375182030ca9b2be631a61ba5) ---- - grub-core/net/tftp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 788ad1dc44..a95766dcbd 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -251,9 +251,9 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), - return GRUB_ERR_NONE; - case TFTP_ERROR: - data->have_oack = 1; -- grub_netbuff_free (nb); - grub_error (GRUB_ERR_IO, "%s", tftph->u.err.errmsg); - grub_error_save (&data->save_err); -+ grub_netbuff_free (nb); - return GRUB_ERR_NONE; - default: - grub_netbuff_free (nb); diff --git a/0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch b/0237-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch similarity index 93% rename from 0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch rename to 0237-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch index b79c78c5..4d080a0b 100644 --- a/0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch +++ b/0237-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch @@ -17,10 +17,10 @@ Signed-off-by: Chris Coulson 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 941df6400b..27bc2aa161 100644 +index 1dd787081f2..8f7eddaa962 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -465,9 +465,6 @@ fail: +@@ -466,9 +466,6 @@ fail: if (file) grub_file_close (file); @@ -30,7 +30,7 @@ index 941df6400b..27bc2aa161 100644 if (grub_errno != GRUB_ERR_NONE) { grub_dl_unref (my_mod); -@@ -483,6 +480,8 @@ fail: +@@ -484,6 +481,8 @@ fail: kernel_free (params, sizeof(*params)); } diff --git a/0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch b/0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch deleted file mode 100644 index 186f0c3d..00000000 --- a/0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 1 Mar 2022 23:14:15 +1100 -Subject: [PATCH] net/http: Do not tear down socket if it's already been torn - down - -It's possible for data->sock to get torn down in tcp error handling. -If we unconditionally tear it down again we will end up doing writes -to an offset of the NULL pointer when we go to tear it down again. - -Detect if it has been torn down and don't do it again. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit ec233d3ecf995293304de443579aab5c46c49e85) ---- - grub-core/net/http.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 7f878b5615..19cb8768e3 100644 ---- a/grub-core/net/http.c -+++ b/grub-core/net/http.c -@@ -427,7 +427,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - return err; - } - -- for (i = 0; !data->headers_recv && i < 100; i++) -+ for (i = 0; data->sock && !data->headers_recv && i < 100; i++) - { - grub_net_tcp_retransmit (); - grub_net_poll_cards (300, &data->headers_recv); -@@ -435,7 +435,8 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - - if (!data->headers_recv) - { -- grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT); -+ if (data->sock) -+ grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT); - if (data->err) - { - char *str = data->errmsg; diff --git a/0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch b/0238-loader-i386-efi-linux-Use-grub_loader_set_ex.patch similarity index 94% rename from 0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch rename to 0238-loader-i386-efi-linux-Use-grub_loader_set_ex.patch index 1a129dbe..428c4981 100644 --- a/0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch +++ b/0238-loader-i386-efi-linux-Use-grub_loader_set_ex.patch @@ -18,11 +18,11 @@ Signed-off-by: Chris Coulson [rharwood/pjones: set kernel_size in context] Signed-off-by: Robbie Harwood --- - grub-core/loader/i386/efi/linux.c | 146 +++++++++++++++++++++++--------------- - 1 file changed, 87 insertions(+), 59 deletions(-) + grub-core/loader/i386/efi/linux.c | 149 ++++++++++++++++++++++---------------- + 1 file changed, 88 insertions(+), 61 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 27bc2aa161..e3c2d6fe0b 100644 +index 8f7eddaa962..3aaa2e9f175 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -34,13 +34,19 @@ @@ -154,17 +154,19 @@ index 27bc2aa161..e3c2d6fe0b 100644 for (i = 0; i < nfiles; i++) { -@@ -261,8 +277,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +@@ -261,9 +277,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), grub_file_close (files[i]); grub_free (files); - if (initrd_mem && grub_errno) - grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, +- BYTES_TO_PAGES(size)); + if (context->initrd_mem && grub_errno) + grub_efi_free_pages ((grub_efi_physical_address_t)(grub_addr_t)context->initrd_mem, - BYTES_TO_PAGES(size)); ++ BYTES_TO_PAGES(size)); return grub_errno; + } @@ -277,6 +293,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_ssize_t start, filelen; void *kernel = NULL; @@ -178,7 +180,7 @@ index 27bc2aa161..e3c2d6fe0b 100644 grub_dl_ref (my_mod); -@@ -390,27 +412,27 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -390,28 +412,27 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "new lh is at %p\n", lh); grub_dprintf ("linux", "setting up cmdline\n"); @@ -199,6 +201,7 @@ index 27bc2aa161..e3c2d6fe0b 100644 GRUB_VERIFY_KERNEL_CMDLINE); - grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline); +- + grub_dprintf ("linux", "cmdline:%s\n", cmdline); grub_dprintf ("linux", "setting lh->cmd_line_ptr to 0x%08x\n", - LOW_U32(linux_cmdline)); @@ -217,7 +220,7 @@ index 27bc2aa161..e3c2d6fe0b 100644 } #endif -@@ -435,16 +457,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -436,16 +457,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } max_addresses[1].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; max_addresses[2].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; @@ -236,7 +239,7 @@ index 27bc2aa161..e3c2d6fe0b 100644 grub_dprintf ("linux", "setting lh->code32_start to 0x%08x\n", LOW_U32(kernel_mem)); lh->code32_start = LOW_U32(kernel_mem); -@@ -461,33 +480,42 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -462,33 +480,42 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), "setting lh->ext_loader_{type,ver} = {0x%02x,0x%02x}\n", params->ext_loader_type, params->ext_loader_ver); diff --git a/0238-net-http-Fix-OOB-write-for-split-http-headers.patch b/0238-net-http-Fix-OOB-write-for-split-http-headers.patch deleted file mode 100644 index f22960b1..00000000 --- a/0238-net-http-Fix-OOB-write-for-split-http-headers.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 8 Mar 2022 18:17:03 +1100 -Subject: [PATCH] net/http: Fix OOB write for split http headers - -GRUB has special code for handling an http header that is split -across two packets. - -The code tracks the end of line by looking for a "\n" byte. The -code for split headers has always advanced the pointer just past the -end of the line, whereas the code that handles unsplit headers does -not advance the pointer. This extra advance causes the length to be -one greater, which breaks an assumption in parse_line(), leading to -it writing a NUL byte one byte past the end of the buffer where we -reconstruct the line from the two packets. - -It's conceivable that an attacker controlled set of packets could -cause this to zero out the first byte of the "next" pointer of the -grub_mm_region structure following the current_line buffer. - -Do not advance the pointer in the split header case. - -Fixes: CVE-2022-28734 - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit e9fb459638811c12b0989dbf64e3e124974ef617) ---- - grub-core/net/http.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 19cb8768e3..58546739a2 100644 ---- a/grub-core/net/http.c -+++ b/grub-core/net/http.c -@@ -193,9 +193,7 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)), - int have_line = 1; - char *t; - ptr = grub_memchr (nb->data, '\n', nb->tail - nb->data); -- if (ptr) -- ptr++; -- else -+ if (ptr == NULL) - { - have_line = 0; - ptr = (char *) nb->tail; diff --git a/0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch b/0239-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch similarity index 98% rename from 0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch rename to 0239-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch index 51953fd3..e3b44f12 100644 --- a/0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch +++ b/0239-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch @@ -14,7 +14,7 @@ Signed-off-by: Chris Coulson 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index e3c2d6fe0b..9e5c11ac69 100644 +index 3aaa2e9f175..71c7ed6a76e 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -209,6 +209,7 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) diff --git a/0239-net-http-Error-out-on-headers-with-LF-without-CR.patch b/0239-net-http-Error-out-on-headers-with-LF-without-CR.patch deleted file mode 100644 index b73c1691..00000000 --- a/0239-net-http-Error-out-on-headers-with-LF-without-CR.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 8 Mar 2022 19:04:40 +1100 -Subject: [PATCH] net/http: Error out on headers with LF without CR - -In a similar vein to the previous patch, parse_line() would write -a NUL byte past the end of the buffer if there was an HTTP header -with a LF rather than a CRLF. - -RFC-2616 says: - - Many HTTP/1.1 header field values consist of words separated by LWS - or special characters. These special characters MUST be in a quoted - string to be used within a parameter value (as defined in section 3.6). - -We don't support quoted sections or continuation lines, etc. - -If we see an LF that's not part of a CRLF, bail out. - -Fixes: CVE-2022-28734 - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit d232ad41ac4979a9de4d746e5fdff9caf0e303de) ---- - grub-core/net/http.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 58546739a2..57d2721719 100644 ---- a/grub-core/net/http.c -+++ b/grub-core/net/http.c -@@ -69,7 +69,15 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) - char *end = ptr + len; - while (end > ptr && *(end - 1) == '\r') - end--; -+ -+ /* LF without CR. */ -+ if (end == ptr + len) -+ { -+ data->errmsg = grub_strdup (_("invalid HTTP header - LF without CR")); -+ return GRUB_ERR_NONE; -+ } - *end = 0; -+ - /* Trailing CRLF. */ - if (data->in_chunk_len == 1) - { diff --git a/0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch b/0240-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch similarity index 98% rename from 0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch rename to 0240-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch index c6688cd1..ed359158 100644 --- a/0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch +++ b/0240-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch @@ -19,7 +19,7 @@ Signed-off-by: Robbie Harwood 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 9e5c11ac69..92b2fb5091 100644 +index 71c7ed6a76e..3ec9bb09c52 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -86,7 +86,9 @@ kernel_free(void *addr, grub_efi_uintn_t size) diff --git a/0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch b/0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch deleted file mode 100644 index 79df1c24..00000000 --- a/0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Sudhakar Kuppusamy -Date: Wed, 6 Apr 2022 18:03:37 +0530 -Subject: [PATCH] fs/f2fs: Do not read past the end of nat journal entries - -A corrupt f2fs file system could specify a nat journal entry count -that is beyond the maximum NAT_JOURNAL_ENTRIES. - -Check if the specified nat journal entry count before accessing the -array, and throw an error if it is too large. - -Signed-off-by: Sudhakar Kuppusamy -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit a3988cb3f0a108dd67ac127a79a4c8479d23334e) ---- - grub-core/fs/f2fs.c | 21 ++++++++++++++------- - 1 file changed, 14 insertions(+), 7 deletions(-) - -diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c -index 8a9992ca9e..63702214b0 100644 ---- a/grub-core/fs/f2fs.c -+++ b/grub-core/fs/f2fs.c -@@ -632,23 +632,27 @@ get_nat_journal (struct grub_f2fs_data *data) - return err; - } - --static grub_uint32_t --get_blkaddr_from_nat_journal (struct grub_f2fs_data *data, grub_uint32_t nid) -+static grub_err_t -+get_blkaddr_from_nat_journal (struct grub_f2fs_data *data, grub_uint32_t nid, -+ grub_uint32_t *blkaddr) - { - grub_uint16_t n = grub_le_to_cpu16 (data->nat_j.n_nats); -- grub_uint32_t blkaddr = 0; - grub_uint16_t i; - -+ if (n >= NAT_JOURNAL_ENTRIES) -+ return grub_error (GRUB_ERR_BAD_FS, -+ "invalid number of nat journal entries"); -+ - for (i = 0; i < n; i++) - { - if (grub_le_to_cpu32 (data->nat_j.entries[i].nid) == nid) - { -- blkaddr = grub_le_to_cpu32 (data->nat_j.entries[i].ne.block_addr); -+ *blkaddr = grub_le_to_cpu32 (data->nat_j.entries[i].ne.block_addr); - break; - } - } - -- return blkaddr; -+ return GRUB_ERR_NONE; - } - - static grub_uint32_t -@@ -656,10 +660,13 @@ get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid) - { - struct grub_f2fs_nat_block *nat_block; - grub_uint32_t seg_off, block_off, entry_off, block_addr; -- grub_uint32_t blkaddr; -+ grub_uint32_t blkaddr = 0; - grub_err_t err; - -- blkaddr = get_blkaddr_from_nat_journal (data, nid); -+ err = get_blkaddr_from_nat_journal (data, nid, &blkaddr); -+ if (err != GRUB_ERR_NONE) -+ return 0; -+ - if (blkaddr) - return blkaddr; - diff --git a/0263-efi-use-enumerated-array-positions-for-our-allocatio.patch b/0241-efi-use-enumerated-array-positions-for-our-allocatio.patch similarity index 95% rename from 0263-efi-use-enumerated-array-positions-for-our-allocatio.patch rename to 0241-efi-use-enumerated-array-positions-for-our-allocatio.patch index 206e3a63..24f9131d 100644 --- a/0263-efi-use-enumerated-array-positions-for-our-allocatio.patch +++ b/0241-efi-use-enumerated-array-positions-for-our-allocatio.patch @@ -18,7 +18,7 @@ Signed-off-by: Peter Jones 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 91ae274299..8daa070132 100644 +index 3ec9bb09c52..ef5875b7697 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -60,17 +60,26 @@ struct allocation_choice { @@ -54,7 +54,7 @@ index 91ae274299..8daa070132 100644 }; static struct allocation_choice saved_addresses[4]; -@@ -405,7 +414,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -388,7 +397,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (lh->xloadflags & LINUX_XLF_CAN_BE_LOADED_ABOVE_4G) { grub_dprintf ("linux", "Loading kernel above 4GB is supported; enabling.\n"); @@ -63,7 +63,7 @@ index 91ae274299..8daa070132 100644 } else { -@@ -478,11 +487,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -461,11 +470,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "lh->pref_address: %p\n", (void *)(grub_addr_t)lh->pref_address); if (lh->pref_address < (grub_uint64_t)GRUB_EFI_MAX_ALLOCATION_ADDRESS) { diff --git a/0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch b/0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch deleted file mode 100644 index 855e8826..00000000 --- a/0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Sudhakar Kuppusamy -Date: Wed, 6 Apr 2022 18:49:09 +0530 -Subject: [PATCH] fs/f2fs: Do not read past the end of nat bitmap - -A corrupt f2fs filesystem could have a block offset or a bitmap -offset that would cause us to read beyond the bounds of the nat -bitmap. - -Introduce the nat_bitmap_size member in grub_f2fs_data which holds -the size of nat bitmap. - -Set the size when loading the nat bitmap in nat_bitmap_ptr(), and -catch when an invalid offset would create a pointer past the end of -the allocated space. - -Check against the bitmap size in grub_f2fs_test_bit() test bit to avoid -reading past the end of the nat bitmap. - -Signed-off-by: Sudhakar Kuppusamy -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 62d63d5e38c67a6e349148bf7cb87c560e935a7e) ---- - grub-core/fs/f2fs.c | 33 +++++++++++++++++++++++++++------ - 1 file changed, 27 insertions(+), 6 deletions(-) - -diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c -index 63702214b0..8898b235e0 100644 ---- a/grub-core/fs/f2fs.c -+++ b/grub-core/fs/f2fs.c -@@ -122,6 +122,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define F2FS_INLINE_DOTS 0x10 /* File having implicit dot dentries. */ - - #define MAX_VOLUME_NAME 512 -+#define MAX_NAT_BITMAP_SIZE 3900 - - enum FILE_TYPE - { -@@ -183,7 +184,7 @@ struct grub_f2fs_checkpoint - grub_uint32_t checksum_offset; - grub_uint64_t elapsed_time; - grub_uint8_t alloc_type[MAX_ACTIVE_LOGS]; -- grub_uint8_t sit_nat_version_bitmap[3900]; -+ grub_uint8_t sit_nat_version_bitmap[MAX_NAT_BITMAP_SIZE]; - grub_uint32_t checksum; - } GRUB_PACKED; - -@@ -302,6 +303,7 @@ struct grub_f2fs_data - - struct grub_f2fs_nat_journal nat_j; - char *nat_bitmap; -+ grub_uint32_t nat_bitmap_size; - - grub_disk_t disk; - struct grub_f2fs_node *inode; -@@ -377,15 +379,20 @@ sum_blk_addr (struct grub_f2fs_data *data, int base, int type) - } - - static void * --nat_bitmap_ptr (struct grub_f2fs_data *data) -+nat_bitmap_ptr (struct grub_f2fs_data *data, grub_uint32_t *nat_bitmap_size) - { - struct grub_f2fs_checkpoint *ckpt = &data->ckpt; - grub_uint32_t offset; -+ *nat_bitmap_size = MAX_NAT_BITMAP_SIZE; - - if (grub_le_to_cpu32 (data->sblock.cp_payload) > 0) - return ckpt->sit_nat_version_bitmap; - - offset = grub_le_to_cpu32 (ckpt->sit_ver_bitmap_bytesize); -+ if (offset >= MAX_NAT_BITMAP_SIZE) -+ return NULL; -+ -+ *nat_bitmap_size = *nat_bitmap_size - offset; - - return ckpt->sit_nat_version_bitmap + offset; - } -@@ -438,11 +445,15 @@ grub_f2fs_crc_valid (grub_uint32_t blk_crc, void *buf, const grub_uint32_t len) - } - - static int --grub_f2fs_test_bit (grub_uint32_t nr, const char *p) -+grub_f2fs_test_bit (grub_uint32_t nr, const char *p, grub_uint32_t len) - { - int mask; -+ grub_uint32_t shifted_nr = (nr >> 3); - -- p += (nr >> 3); -+ if (shifted_nr >= len) -+ return -1; -+ -+ p += shifted_nr; - mask = 1 << (7 - (nr & 0x07)); - - return mask & *p; -@@ -662,6 +673,7 @@ get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid) - grub_uint32_t seg_off, block_off, entry_off, block_addr; - grub_uint32_t blkaddr = 0; - grub_err_t err; -+ int result_bit; - - err = get_blkaddr_from_nat_journal (data, nid, &blkaddr); - if (err != GRUB_ERR_NONE) -@@ -682,8 +694,15 @@ get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid) - ((seg_off * data->blocks_per_seg) << 1) + - (block_off & (data->blocks_per_seg - 1)); - -- if (grub_f2fs_test_bit (block_off, data->nat_bitmap)) -+ result_bit = grub_f2fs_test_bit (block_off, data->nat_bitmap, -+ data->nat_bitmap_size); -+ if (result_bit > 0) - block_addr += data->blocks_per_seg; -+ else if (result_bit == -1) -+ { -+ grub_free (nat_block); -+ return 0; -+ } - - err = grub_f2fs_block_read (data, block_addr, nat_block); - if (err) -@@ -833,7 +852,9 @@ grub_f2fs_mount (grub_disk_t disk) - if (err) - goto fail; - -- data->nat_bitmap = nat_bitmap_ptr (data); -+ data->nat_bitmap = nat_bitmap_ptr (data, &data->nat_bitmap_size); -+ if (data->nat_bitmap == NULL) -+ goto fail; - - err = get_nat_journal (data); - if (err) diff --git a/0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch b/0242-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch similarity index 94% rename from 0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch rename to 0242-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch index d25cf306..20f3c660 100644 --- a/0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch +++ b/0242-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch @@ -18,7 +18,7 @@ Signed-off-by: Peter Jones 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 8daa070132..e6b8998e5e 100644 +index ef5875b7697..1d7ced3d1f8 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -55,7 +55,14 @@ struct grub_linuxefi_context { @@ -85,7 +85,7 @@ index 8daa070132..e6b8998e5e 100644 /* * When we're *not* loading the kernel, or >4GB allocations aren't * supported, these entries are basically all the same, so don't re-try -@@ -261,7 +276,8 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) +@@ -253,7 +268,8 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) } } @@ -95,7 +95,7 @@ index 8daa070132..e6b8998e5e 100644 N_("can't allocate initrd")); if (initrd_mem == NULL) goto fail; -@@ -422,7 +438,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -405,7 +421,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } #endif @@ -105,7 +105,7 @@ index 8daa070132..e6b8998e5e 100644 "cannot allocate kernel parameters"); if (!params) goto fail; -@@ -445,7 +462,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -428,7 +445,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "new lh is at %p\n", lh); grub_dprintf ("linux", "setting up cmdline\n"); @@ -114,7 +114,7 @@ index 8daa070132..e6b8998e5e 100644 GRUB_EFI_RUNTIME_SERVICES_DATA, N_("can't allocate cmdline")); if (!cmdline) -@@ -493,7 +510,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -476,7 +493,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), max_addresses[KERNEL_4G_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS; kernel_size = lh->init_size; diff --git a/0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch b/0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch deleted file mode 100644 index 0553d606..00000000 --- a/0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Sudhakar Kuppusamy -Date: Wed, 6 Apr 2022 18:17:43 +0530 -Subject: [PATCH] fs/f2fs: Do not copy file names that are too long - -A corrupt f2fs file system might specify a name length which is greater -than the maximum name length supported by the GRUB f2fs driver. - -We will allocate enough memory to store the overly long name, but there -are only F2FS_NAME_LEN bytes in the source, so we would read past the end -of the source. - -While checking directory entries, do not copy a file name with an invalid -length. - -Signed-off-by: Sudhakar Kuppusamy -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 9a891f638509e031d322c94e3cbcf38d36f3993a) ---- - grub-core/fs/f2fs.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c -index 8898b235e0..df6beb544c 100644 ---- a/grub-core/fs/f2fs.c -+++ b/grub-core/fs/f2fs.c -@@ -1003,6 +1003,10 @@ grub_f2fs_check_dentries (struct grub_f2fs_dir_iter_ctx *ctx) - - ftype = ctx->dentry[i].file_type; - name_len = grub_le_to_cpu16 (ctx->dentry[i].name_len); -+ -+ if (name_len >= F2FS_NAME_LEN) -+ return 0; -+ - filename = grub_malloc (name_len + 1); - if (!filename) - return 0; diff --git a/0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch b/0243-efi-allocate-the-initrd-within-the-bounds-expressed-.patch similarity index 90% rename from 0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch rename to 0243-efi-allocate-the-initrd-within-the-bounds-expressed-.patch index 47e31e2f..922088b3 100644 --- a/0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch +++ b/0243-efi-allocate-the-initrd-within-the-bounds-expressed-.patch @@ -20,10 +20,10 @@ Signed-off-by: Peter Jones 1 file changed, 6 insertions(+) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index e6b8998e5e..d003b474ee 100644 +index 1d7ced3d1f8..a798da334ab 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -190,6 +190,8 @@ grub_linuxefi_unload (void *data) +@@ -182,6 +182,8 @@ grub_linuxefi_unload (void *data) cmd_initrdefi->data = 0; grub_free (context); @@ -32,7 +32,7 @@ index e6b8998e5e..d003b474ee 100644 return GRUB_ERR_NONE; } -@@ -426,11 +428,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -409,11 +411,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } #endif @@ -46,7 +46,7 @@ index e6b8998e5e..d003b474ee 100644 } else { -@@ -560,6 +564,8 @@ fail: +@@ -542,6 +546,8 @@ fail: grub_dl_unref (my_mod); diff --git a/0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch b/0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch deleted file mode 100644 index 7ff58218..00000000 --- a/0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Darren Kenny -Date: Tue, 29 Mar 2022 10:49:56 +0000 -Subject: [PATCH] fs/btrfs: Fix several fuzz issues with invalid dir item - sizing - -According to the btrfs code in Linux, the structure of a directory item -leaf should be of the form: - - |struct btrfs_dir_item|name|data| - -in GRUB the name len and data len are in the grub_btrfs_dir_item -structure's n and m fields respectively. - -The combined size of the structure, name and data should be less than -the allocated memory, a difference to the Linux kernel's struct -btrfs_dir_item is that the grub_btrfs_dir_item has an extra field for -where the name is stored, so we adjust for that too. - -Signed-off-by: Darren Kenny -Reviewed-by: Daniel Kiper -(cherry picked from commit 6d3f06c0b6a8992b9b1bb0e62af93ac5ff2781f0) -[rharwood: we've an extra variable here] -Signed-off-by: Robbie Harwood ---- - grub-core/fs/btrfs.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 07c0ff874b..2fcfb738fe 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -2254,6 +2254,7 @@ grub_btrfs_dir (grub_device_t device, const char *path, - grub_uint64_t tree; - grub_uint8_t type; - char *new_path = NULL; -+ grub_size_t est_size = 0; - - if (!data) - return grub_errno; -@@ -2320,6 +2321,18 @@ grub_btrfs_dir (grub_device_t device, const char *path, - break; - } - -+ if (direl == NULL || -+ grub_add (grub_le_to_cpu16 (direl->n), -+ grub_le_to_cpu16 (direl->m), &est_size) || -+ grub_add (est_size, sizeof (*direl), &est_size) || -+ grub_sub (est_size, sizeof (direl->name), &est_size) || -+ est_size > allocated) -+ { -+ grub_errno = GRUB_ERR_OUT_OF_RANGE; -+ r = -grub_errno; -+ goto out; -+ } -+ - for (cdirel = direl; - (grub_uint8_t *) cdirel - (grub_uint8_t *) direl - < (grub_ssize_t) elemsize; -@@ -2330,6 +2343,19 @@ grub_btrfs_dir (grub_device_t device, const char *path, - char c; - struct grub_btrfs_inode inode; - struct grub_dirhook_info info; -+ -+ if (cdirel == NULL || -+ grub_add (grub_le_to_cpu16 (cdirel->n), -+ grub_le_to_cpu16 (cdirel->m), &est_size) || -+ grub_add (est_size, sizeof (*cdirel), &est_size) || -+ grub_sub (est_size, sizeof (cdirel->name), &est_size) || -+ est_size > allocated) -+ { -+ grub_errno = GRUB_ERR_OUT_OF_RANGE; -+ r = -grub_errno; -+ goto out; -+ } -+ - err = grub_btrfs_read_inode (data, &inode, cdirel->key.object_id, - tree); - grub_memset (&info, 0, sizeof (info)); diff --git a/0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch b/0244-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch similarity index 87% rename from 0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch rename to 0244-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch index 8451dbfc..914ad43f 100644 --- a/0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch +++ b/0244-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch @@ -20,10 +20,10 @@ Signed-off-by: Peter Jones 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index d003b474ee..ac5ef50bdb 100644 +index a798da334ab..03d27c81fd3 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c -@@ -279,7 +279,7 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) +@@ -271,7 +271,7 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[]) } grub_dprintf ("linux", "Trying to allocate initrd mem\n"); @@ -32,7 +32,7 @@ index d003b474ee..ac5ef50bdb 100644 N_("can't allocate initrd")); if (initrd_mem == NULL) goto fail; -@@ -443,7 +443,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -426,7 +426,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), #endif params = kernel_alloc (KERNEL_MEM, sizeof(*params), @@ -41,7 +41,7 @@ index d003b474ee..ac5ef50bdb 100644 "cannot allocate kernel parameters"); if (!params) goto fail; -@@ -467,7 +467,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -450,7 +450,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_dprintf ("linux", "setting up cmdline\n"); cmdline = kernel_alloc (KERNEL_MEM, lh->cmdline_size + 1, @@ -50,7 +50,7 @@ index d003b474ee..ac5ef50bdb 100644 N_("can't allocate cmdline")); if (!cmdline) goto fail; -@@ -516,7 +516,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -499,7 +499,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), kernel_size = lh->init_size; grub_dprintf ("linux", "Trying to allocate kernel mem\n"); kernel_mem = kernel_alloc (KERNEL_MEM, kernel_size, diff --git a/0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch b/0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch deleted file mode 100644 index d638c117..00000000 --- a/0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Darren Kenny -Date: Tue, 29 Mar 2022 15:52:46 +0000 -Subject: [PATCH] fs/btrfs: Fix more ASAN and SEGV issues found with fuzzing - -The fuzzer is generating btrfs file systems that have chunks with -invalid combinations of stripes and substripes for the given RAID -configurations. - -After examining the Linux kernel fs/btrfs/tree-checker.c code, it -appears that sub-stripes should only be applied to RAID10, and in that -case there should only ever be 2 of them. - -Similarly, RAID single should only have 1 stripe, and RAID1/1C3/1C4 -should have 2. 3 or 4 stripes respectively, which is what redundancy -corresponds. - -Some of the chunks ended up with a size of 0, which grub_malloc() still -returned memory for and in turn generated ASAN errors later when -accessed. - -While it would be possible to specifically limit the number of stripes, -a more correct test was on the combination of the chunk item, and the -number of stripes by the size of the chunk stripe structure in -comparison to the size of the chunk itself. - -Signed-off-by: Darren Kenny -Reviewed-by: Daniel Kiper -(cherry picked from commit 3849647b4b98a4419366708fc4b7f339c6f55ec7) ---- - grub-core/fs/btrfs.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 55 insertions(+) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 2fcfb738fe..0e9b450413 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -941,6 +941,12 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - return grub_error (GRUB_ERR_BAD_FS, - "couldn't find the chunk descriptor"); - -+ if (!chsize) -+ { -+ grub_dprintf ("btrfs", "zero-size chunk\n"); -+ return grub_error (GRUB_ERR_BAD_FS, -+ "got an invalid zero-size chunk"); -+ } - chunk = grub_malloc (chsize); - if (!chunk) - return grub_errno; -@@ -999,6 +1005,16 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - stripe_length = grub_divmod64 (grub_le_to_cpu64 (chunk->size), - nstripes, - NULL); -+ -+ /* For single, there should be exactly 1 stripe. */ -+ if (grub_le_to_cpu16 (chunk->nstripes) != 1) -+ { -+ grub_dprintf ("btrfs", "invalid RAID_SINGLE: nstripes != 1 (%u)\n", -+ grub_le_to_cpu16 (chunk->nstripes)); -+ return grub_error (GRUB_ERR_BAD_FS, -+ "invalid RAID_SINGLE: nstripes != 1 (%u)", -+ grub_le_to_cpu16 (chunk->nstripes)); -+ } - if (stripe_length == 0) - stripe_length = 512; - stripen = grub_divmod64 (off, stripe_length, &stripe_offset); -@@ -1018,6 +1034,19 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - stripen = 0; - stripe_offset = off; - csize = grub_le_to_cpu64 (chunk->size) - off; -+ -+ /* -+ * Redundancy, and substripes only apply to RAID10, and there -+ * should be exactly 2 sub-stripes. -+ */ -+ if (grub_le_to_cpu16 (chunk->nstripes) != redundancy) -+ { -+ grub_dprintf ("btrfs", "invalid RAID1: nstripes != %u (%u)\n", -+ redundancy, grub_le_to_cpu16 (chunk->nstripes)); -+ return grub_error (GRUB_ERR_BAD_FS, -+ "invalid RAID1: nstripes != %u (%u)", -+ redundancy, grub_le_to_cpu16 (chunk->nstripes)); -+ } - break; - } - case GRUB_BTRFS_CHUNK_TYPE_RAID0: -@@ -1054,6 +1083,20 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - stripe_offset = low + chunk_stripe_length - * high; - csize = chunk_stripe_length - low; -+ -+ /* -+ * Substripes only apply to RAID10, and there -+ * should be exactly 2 sub-stripes. -+ */ -+ if (grub_le_to_cpu16 (chunk->nsubstripes) != 2) -+ { -+ grub_dprintf ("btrfs", "invalid RAID10: nsubstripes != 2 (%u)", -+ grub_le_to_cpu16 (chunk->nsubstripes)); -+ return grub_error (GRUB_ERR_BAD_FS, -+ "invalid RAID10: nsubstripes != 2 (%u)", -+ grub_le_to_cpu16 (chunk->nsubstripes)); -+ } -+ - break; - } - case GRUB_BTRFS_CHUNK_TYPE_RAID5: -@@ -1153,6 +1196,8 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - - for (j = 0; j < 2; j++) - { -+ grub_size_t est_chunk_alloc = 0; -+ - grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T - "+0x%" PRIxGRUB_UINT64_T - " (%d stripes (%d substripes) of %" -@@ -1165,6 +1210,16 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - grub_dprintf ("btrfs", "reading laddr 0x%" PRIxGRUB_UINT64_T "\n", - addr); - -+ if (grub_mul (sizeof (struct grub_btrfs_chunk_stripe), -+ grub_le_to_cpu16 (chunk->nstripes), &est_chunk_alloc) || -+ grub_add (est_chunk_alloc, -+ sizeof (struct grub_btrfs_chunk_item), &est_chunk_alloc) || -+ est_chunk_alloc > chunk->size) -+ { -+ err = GRUB_ERR_BAD_FS; -+ break; -+ } -+ - if (is_raid56) - { - err = btrfs_read_from_chunk (data, chunk, stripen, diff --git a/0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch b/0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch deleted file mode 100644 index 2e5145fe..00000000 --- a/0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Darren Kenny -Date: Thu, 7 Apr 2022 15:18:12 +0000 -Subject: [PATCH] fs/btrfs: Fix more fuzz issues related to chunks - -The corpus we generating issues in grub_btrfs_read_logical() when -attempting to iterate over nstripes entries in the boot mapping. - -In most cases the reason for the failure was that the number of strips -exceeded the possible space statically allocated in superblock bootmapping -space. Each stripe entry in the bootmapping block consists of -a grub_btrfs_key followed by a grub_btrfs_chunk_stripe. - -Another issue that came up was that while calculating the chunk size, -in an earlier piece of code in that function, depending on the data -provided in the btrfs file system, it would end up calculating a size -that was too small to contain even 1 grub_btrfs_chunk_item, which is -obviously invalid too. - -Signed-off-by: Darren Kenny -Reviewed-by: Daniel Kiper -(cherry picked from commit e00cd76cbadcc897a9cc4087cb2fcb5dbe15e596) ---- - grub-core/fs/btrfs.c | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 0e9b450413..47325f6ad7 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -947,6 +947,17 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - return grub_error (GRUB_ERR_BAD_FS, - "got an invalid zero-size chunk"); - } -+ -+ /* -+ * The space being allocated for a chunk should at least be able to -+ * contain one chunk item. -+ */ -+ if (chsize < sizeof (struct grub_btrfs_chunk_item)) -+ { -+ grub_dprintf ("btrfs", "chunk-size too small\n"); -+ return grub_error (GRUB_ERR_BAD_FS, -+ "got an invalid chunk size"); -+ } - chunk = grub_malloc (chsize); - if (!chunk) - return grub_errno; -@@ -1194,6 +1205,13 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - if (csize > (grub_uint64_t) size) - csize = size; - -+ /* -+ * The space for a chunk stripe is limited to the space provide in the super-block's -+ * bootstrap mapping with an initial btrfs key at the start of each chunk. -+ */ -+ grub_size_t avail_stripes = sizeof (data->sblock.bootstrap_mapping) / -+ (sizeof (struct grub_btrfs_key) + sizeof (struct grub_btrfs_chunk_stripe)); -+ - for (j = 0; j < 2; j++) - { - grub_size_t est_chunk_alloc = 0; -@@ -1220,6 +1238,12 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr, - break; - } - -+ if (grub_le_to_cpu16 (chunk->nstripes) > avail_stripes) -+ { -+ err = GRUB_ERR_BAD_FS; -+ break; -+ } -+ - if (is_raid56) - { - err = btrfs_read_from_chunk (data, chunk, stripen, diff --git a/0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch b/0245-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch similarity index 97% rename from 0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch rename to 0245-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch index 00797503..e19f1543 100644 --- a/0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch +++ b/0245-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch @@ -22,7 +22,7 @@ Signed-off-by: Peter Jones 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index ac5ef50bdb..9854b0defa 100644 +index 03d27c81fd3..f97b123a51e 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -92,7 +92,7 @@ static struct allocation_choice max_addresses[] = diff --git a/0339-grub-install-on-EFI-if-forced.patch b/0246-grub-install-on-EFI-if-forced.patch similarity index 73% rename from 0339-grub-install-on-EFI-if-forced.patch rename to 0246-grub-install-on-EFI-if-forced.patch index ad231ac5..e569cf16 100644 --- a/0339-grub-install-on-EFI-if-forced.patch +++ b/0246-grub-install-on-EFI-if-forced.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Marta Lewandowska -Date: Fri, 13 Oct 2023 09:13:41 +0200 +Date: Tue, 6 Feb 2024 17:42:47 -0600 Subject: [PATCH] grub-install on EFI if forced UEFI Secure Boot requires signed grub binaries to work, so grub- @@ -12,14 +12,14 @@ fixes bz#1917213 / bz#2240994 Signed-off-by: Marta Lewandowska --- - util/grub-install.c | 42 ++++++++++++++++++++++++++---------------- - 1 file changed, 26 insertions(+), 16 deletions(-) + util/grub-install.c | 38 +++++++++++++++++++------------------- + 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index 5babc7af5518..162162bec6e2 100644 +index 828e8722ba5..314b6143b8e 100644 --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -899,22 +899,6 @@ main (int argc, char *argv[]) +@@ -915,25 +915,6 @@ main (int argc, char *argv[]) platform = grub_install_get_target (grub_install_source_directory); @@ -29,6 +29,9 @@ index 5babc7af5518..162162bec6e2 100644 - case GRUB_INSTALL_PLATFORM_ARM64_EFI: - case GRUB_INSTALL_PLATFORM_I386_EFI: - case GRUB_INSTALL_PLATFORM_IA64_EFI: +- case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: +- case GRUB_INSTALL_PLATFORM_RISCV32_EFI: +- case GRUB_INSTALL_PLATFORM_RISCV64_EFI: - case GRUB_INSTALL_PLATFORM_X86_64_EFI: - is_efi = 1; - grub_util_error (_("this utility cannot be used for EFI platforms" @@ -42,19 +45,18 @@ index 5babc7af5518..162162bec6e2 100644 { char *platname = grub_install_get_platform_name (platform); fprintf (stderr, _("Installing for %s platform.\n"), platname); -@@ -1027,6 +1011,32 @@ main (int argc, char *argv[]) - grub_hostfs_init (); - grub_host_init (); +@@ -1050,6 +1031,22 @@ main (int argc, char *argv[]) -+ switch (platform) -+ { -+ case GRUB_INSTALL_PLATFORM_I386_EFI: -+ case GRUB_INSTALL_PLATFORM_X86_64_EFI: + switch (platform) + { + case GRUB_INSTALL_PLATFORM_ARM_EFI: + case GRUB_INSTALL_PLATFORM_ARM64_EFI: ++ case GRUB_INSTALL_PLATFORM_I386_EFI: ++ case GRUB_INSTALL_PLATFORM_IA64_EFI: ++ case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI: + case GRUB_INSTALL_PLATFORM_RISCV32_EFI: + case GRUB_INSTALL_PLATFORM_RISCV64_EFI: -+ case GRUB_INSTALL_PLATFORM_IA64_EFI: ++ case GRUB_INSTALL_PLATFORM_X86_64_EFI: + is_efi = 1; + if (!force) + grub_util_error (_("This utility should not be used for EFI platforms" @@ -63,15 +65,16 @@ index 5babc7af5518..162162bec6e2 100644 + " option.\nMake sure Secure Boot is disabled before" + " proceeding")); + break; -+ default: -+ is_efi = 0; -+ break; -+ + case GRUB_INSTALL_PLATFORM_I386_IEEE1275: + case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275: + #ifdef __linux__ +@@ -1058,6 +1055,9 @@ main (int argc, char *argv[]) + try_open ("/dev/nvram"); + #endif + break; + /* pacify warning. */ + case GRUB_INSTALL_PLATFORM_MAX: + break; -+ } -+ - /* Find the EFI System Partition. */ - if (is_efi) - { + default: + break; + } diff --git a/0340-Remove-Install-section-from-aux-systemd-units.patch b/0247-Remove-Install-section-from-aux-systemd-units.patch similarity index 93% rename from 0340-Remove-Install-section-from-aux-systemd-units.patch rename to 0247-Remove-Install-section-from-aux-systemd-units.patch index 1a62cddb..500b9f59 100644 --- a/0340-Remove-Install-section-from-aux-systemd-units.patch +++ b/0247-Remove-Install-section-from-aux-systemd-units.patch @@ -10,7 +10,7 @@ See https://bugzilla.redhat.com/show_bug.cgi?id=2247635#c7 2 files changed, 6 deletions(-) diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service -index 5bcb474a3d31..6c8dcb186b63 100644 +index 5bcb474a3d3..6c8dcb186b6 100644 --- a/docs/grub-boot-indeterminate.service +++ b/docs/grub-boot-indeterminate.service @@ -9,6 +9,3 @@ Before=system-update-pre.target @@ -21,7 +21,7 @@ index 5bcb474a3d31..6c8dcb186b63 100644 -[Install] -WantedBy=system-update.target diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in -index 22ca1ca4885e..c81fb594ce17 100644 +index 22ca1ca4885..c81fb594ce1 100644 --- a/util/systemd/grub-systemd-integration.service.in +++ b/util/systemd/grub-systemd-integration.service.in @@ -6,6 +6,3 @@ ConditionPathExists=/run/systemd/reboot-to-boot-loader-menu diff --git a/0346-chainloader-remove-device-path-debug-message.patch b/0248-chainloader-remove-device-path-debug-message.patch similarity index 89% rename from 0346-chainloader-remove-device-path-debug-message.patch rename to 0248-chainloader-remove-device-path-debug-message.patch index ef7720f8..306aad38 100644 --- a/0346-chainloader-remove-device-path-debug-message.patch +++ b/0248-chainloader-remove-device-path-debug-message.patch @@ -12,10 +12,10 @@ Signed-off-by: raravind 1 file changed, 1 deletion(-) diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index dd31ac9bb..b1c86dab2 100644 +index b40acdeda80..badff5e50b5 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -210,7 +210,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) +@@ -212,7 +212,6 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) /* Fill the file path for the directory. */ d = (grub_efi_device_path_t *) ((char *) file_path + ((char *) d - (char *) dp)); @@ -23,6 +23,3 @@ index dd31ac9bb..b1c86dab2 100644 if (copy_file_path ((grub_efi_file_path_device_path_t *) d, dir_start, dir_end - dir_start) != GRUB_ERR_NONE) { --- -2.43.0 - diff --git a/0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch b/0249-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch similarity index 99% rename from 0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch rename to 0249-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch index d20f909b..995181f2 100644 --- a/0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch +++ b/0249-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch @@ -70,7 +70,7 @@ Signed-off-by: Solar Designer 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index 3b4c25ca2ac6..5bbbef804391 100644 +index 3b4c25ca2ac..5bbbef80439 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -33,6 +33,8 @@ diff --git a/0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch b/0250-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch similarity index 99% rename from 0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch rename to 0250-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch index b47b3110..615b04de 100644 --- a/0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch +++ b/0250-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch @@ -29,7 +29,7 @@ Signed-off-by: Solar Designer 1 file changed, 79 insertions(+), 16 deletions(-) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index 5bbbef804391..514c4f9091ac 100644 +index 5bbbef80439..514c4f9091a 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -33,6 +33,7 @@ diff --git a/0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch b/0251-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch similarity index 96% rename from 0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch rename to 0251-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch index dba46d4a..5b41025b 100644 --- a/0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch +++ b/0251-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch @@ -13,7 +13,7 @@ Signed-off-by: Solar Designer 1 file changed, 11 insertions(+) diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c -index 514c4f9091ac..31a868aeca8a 100644 +index 514c4f9091a..31a868aeca8 100644 --- a/util/grub-set-bootflag.c +++ b/util/grub-set-bootflag.c @@ -98,6 +98,17 @@ int main(int argc, char *argv[]) diff --git a/0252-Makefile.core.def-fix-linux-module.patch b/0252-Makefile.core.def-fix-linux-module.patch new file mode 100644 index 00000000..83d8d8e8 --- /dev/null +++ b/0252-Makefile.core.def-fix-linux-module.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Mon, 15 Apr 2024 09:24:47 -0600 +Subject: [PATCH] Makefile.core.def: fix linux module + +Set EFI source file targets specifically for i386 and x86_64 archs, +otherwise we observe build failures at aarch64 + +../../grub-core/tests/videotest_checksum.c > videotest_checksum.marker.new || (rm -f videotest_checksum.marker; exit 1) +../../grub-core/loader/efi/linux.c:28:10: fatal error: grub/cpu/linux.h: No such file or directory + 28 | #include + | ^~~~~~~~~~~~~~~~~~ +compilation terminated. +. +. +. +../../grub-core/loader/i386/linux.c:30:10: fatal error: grub/cpu/linux.h: No such file or directory + 30 | #include + | ^~~~~~~~~~~~~~~~~~ +compilation terminated. + +Signed-off-by: Leo Sandoval +--- + grub-core/Makefile.core.def | 7 ++++--- + grub-core/loader/efi/linux.c | 1 - + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index b045aac7c91..6ff4835340d 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -1902,13 +1902,14 @@ module = { + riscv32 = loader/efi/linux.c; + riscv64 = loader/efi/linux.c; + i386_efi = loader/i386/efi/linux.c; ++ i386_efi = loader/efi/linux.c; ++ i386_efi = loader/i386/linux.c; + x86_64_efi = loader/i386/efi/linux.c; ++ x86_64_efi = loader/efi/linux.c; ++ x86_64_efi = loader/i386/linux.c; + emu = loader/emu/linux.c; +- fdt = lib/fdt.c; + common = loader/linux.c; + common = lib/cmdline.c; +- efi = loader/efi/linux.c; +- efi = loader/i386/linux.c; + }; + + module = { +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index f5ab0128991..44587df3858 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -25,7 +25,6 @@ + #include + #include + #include +-#include + #include + #include + #include diff --git a/0253-Add-support-for-Linux-EFI-stub-loading-on-arm-archit.patch b/0253-Add-support-for-Linux-EFI-stub-loading-on-arm-archit.patch new file mode 100644 index 00000000..d9ff0b61 --- /dev/null +++ b/0253-Add-support-for-Linux-EFI-stub-loading-on-arm-archit.patch @@ -0,0 +1,270 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matthew Garrett +Date: Mon, 15 Apr 2024 11:19:31 -0600 +Subject: [PATCH] Add support for Linux EFI stub loading on arm architectures + +--- + grub-core/loader/arm64/xen_boot.c | 1 - + grub-core/loader/efi/linux.c | 116 ++++++++++++++++++-------------------- + include/grub/efi/efi.h | 28 ++++++++- + 3 files changed, 80 insertions(+), 65 deletions(-) + +diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c +index 26e1472c9d2..9838a0f878b 100644 +--- a/grub-core/loader/arm64/xen_boot.c ++++ b/grub-core/loader/arm64/xen_boot.c +@@ -252,7 +252,6 @@ xen_boot (void) + return err; + + return grub_arch_efi_linux_boot_image (xen_hypervisor->start, +- xen_hypervisor->size, + xen_hypervisor->cmdline); + } + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 44587df3858..8742e303d85 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -42,6 +43,7 @@ static int loaded; + + static void *kernel_addr; + static grub_uint64_t kernel_size; ++static grub_uint32_t handover_offset; + + static char *linux_args; + static grub_uint32_t cmdline_size; +@@ -94,7 +96,7 @@ static grub_efi_load_file2_t initrd_lf2 = { + typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *); + + grub_err_t +-grub_efi_linux_boot (void *kernel_address, grub_off_t handover_offset, ++grub_efi_linux_boot (void *kernel_address, grub_off_t ho_offset, + void *kernel_params) + { + grub_efi_loaded_image_t *loaded_image = NULL; +@@ -117,8 +119,8 @@ grub_efi_linux_boot (void *kernel_address, grub_off_t handover_offset, + grub_dprintf ("linux", "Loaded Image base address could not be set\n"); + + grub_dprintf ("linux", "kernel_address: %p handover_offset: %p params: %p\n", +- kernel_address, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); +- hf = (handover_func)((char *)kernel_address + handover_offset + offset); ++ kernel_address, (void *)(grub_efi_uintn_t)ho_offset, kernel_params); ++ hf = (handover_func)((char *)kernel_address + ho_offset + offset); + hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); + + return GRUB_ERR_BUG; +@@ -178,7 +180,8 @@ grub_arch_efi_linux_load_image_header (grub_file_t file, + static grub_err_t + finalize_params_linux (void) + { +- int node, retval; ++ grub_efi_loaded_image_t *loaded_image = NULL; ++ int node, retval, len; + + void *fdt; + +@@ -213,79 +216,65 @@ finalize_params_linux (void) + if (grub_fdt_install() != GRUB_ERR_NONE) + goto failure; + +- return GRUB_ERR_NONE; +- +-failure: +- grub_fdt_unload(); +- return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT"); +-} +-#endif +- +-grub_err_t +-grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) +-{ +- grub_efi_memory_mapped_device_path_t *mempath; +- grub_efi_handle_t image_handle; +- grub_efi_boot_services_t *b; +- grub_efi_status_t status; +- grub_efi_loaded_image_t *loaded_image; +- int len; +- +- mempath = grub_malloc (2 * sizeof (grub_efi_memory_mapped_device_path_t)); +- if (!mempath) +- return grub_errno; +- +- mempath[0].header.type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE; +- mempath[0].header.subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE; +- mempath[0].header.length = grub_cpu_to_le16_compile_time (sizeof (*mempath)); +- mempath[0].memory_type = GRUB_EFI_LOADER_DATA; +- mempath[0].start_address = addr; +- mempath[0].end_address = addr + size; +- +- mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE; +- mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; +- mempath[1].header.length = sizeof (grub_efi_device_path_t); +- +- b = grub_efi_system_table->boot_services; +- status = b->load_image (0, grub_efi_image_handle, +- (grub_efi_device_path_t *) mempath, +- (void *) addr, size, &image_handle); +- if (status != GRUB_EFI_SUCCESS) +- return grub_error (GRUB_ERR_BAD_OS, "cannot load image"); +- +- grub_dprintf ("linux", "linux command line: '%s'\n", args); ++ grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n", ++ fdt); + + /* Convert command line to UCS-2 */ +- loaded_image = grub_efi_get_loaded_image (image_handle); ++ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); + if (loaded_image == NULL) + { + grub_error (GRUB_ERR_BAD_FIRMWARE, "missing loaded_image proto"); +- goto unload; ++ goto failure; + } + loaded_image->load_options_size = len = +- (grub_strlen (args) + 1) * sizeof (grub_efi_char16_t); ++ (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t); + loaded_image->load_options = + grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); + if (!loaded_image->load_options) +- return grub_errno; ++ return grub_error(GRUB_ERR_BAD_OS, "failed to create kernel parameters"); + + loaded_image->load_options_size = + 2 * grub_utf8_to_utf16 (loaded_image->load_options, len, +- (grub_uint8_t *) args, len, NULL); ++ (grub_uint8_t *) linux_args, len, NULL); + +- grub_dprintf ("linux", "starting image %p\n", image_handle); +- status = b->start_image (image_handle, 0, NULL); ++ return GRUB_ERR_NONE; + +- /* When successful, not reached */ +- grub_error (GRUB_ERR_BAD_OS, "start_image() returned 0x%" PRIxGRUB_EFI_UINTN_T, status); +- grub_efi_free_pages ((grub_addr_t) loaded_image->load_options, +- GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); +-unload: +- b->unload_image (image_handle); ++failure: ++ grub_fdt_unload(); ++ return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT"); ++} ++#endif ++ ++static void ++free_params (void) ++{ ++ grub_efi_loaded_image_t *loaded_image = NULL; + +- return grub_errno; ++ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); ++ if (loaded_image) ++ { ++ if (loaded_image->load_options) ++ grub_efi_free_pages ((grub_efi_physical_address_t)(grub_efi_uintn_t)loaded_image->load_options, ++ GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); ++ loaded_image->load_options = NULL; ++ loaded_image->load_options_size = 0; ++ } + } + ++grub_err_t ++grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) ++{ ++ grub_err_t retval; ++ ++ grub_dprintf ("linux", "linux command line: '%s'\n", args); ++ ++ retval = grub_efi_linux_boot ((char *)addr, handover_offset, (void *)addr); ++ ++ /* Never reached... */ ++ free_params(); ++ return retval; ++ } ++ + static grub_err_t + grub_linux_boot (void) + { +@@ -294,8 +283,7 @@ grub_linux_boot (void) + return grub_errno; + #endif + +- return grub_arch_efi_linux_boot_image ((grub_addr_t) kernel_addr, +- kernel_size, linux_args); ++ return grub_arch_efi_linux_boot_image ((grub_addr_t) kernel_addr, linux_args); + } + + static grub_err_t +@@ -572,6 +560,12 @@ fallback: + + grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); + ++#if !defined(__i386__) && !defined(__x86_64__) ++ struct grub_armxx_linux_pe_header *pe; ++ pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); ++ handover_offset = pe->opt.entry_addr; ++#endif ++ + cmdline_size = grub_loader_cmdline_size (argc, argv) + sizeof (LINUX_IMAGE); + linux_args = grub_malloc (cmdline_size); + if (!linux_args) +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 83ddbe26e57..bff833468ee 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -20,6 +20,7 @@ + #ifndef GRUB_EFI_EFI_HEADER + #define GRUB_EFI_EFI_HEADER 1 + ++#include + #include + #include + #include +@@ -36,7 +37,29 @@ struct linux_arch_kernel_header { + struct grub_pe_image_header pe_image_header; + }; + +-#define GRUB_EFI_GRUB_VARIABLE_GUID \ ++struct grub_arm_linux_pe_header ++{ ++ grub_uint32_t magic; ++ struct grub_pe32_coff_header coff; ++ struct grub_pe32_optional_header opt; ++}; ++ ++struct grub_arm64_linux_pe_header ++{ ++ grub_uint32_t magic; ++ struct grub_pe32_coff_header coff; ++ struct grub_pe64_optional_header opt; ++}; ++ ++#if defined(__arm__) ++# define grub_armxx_linux_pe_header grub_arm_linux_pe_header ++#endif ++ ++#if defined(__aarch64__) ++# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header ++#endif ++ ++#define GRUB_EFI_GRUB_VARIABLE_GUID \ + { 0x91376aff, 0xcba6, 0x42be, \ + { 0x94, 0x9d, 0x06, 0xfd, 0xe8, 0x11, 0x28, 0xe8 } \ + } +@@ -173,8 +196,7 @@ grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); + #include + grub_err_t grub_arch_efi_linux_load_image_header(grub_file_t file, + struct linux_arch_kernel_header *lh); +-grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, +- char *args); ++grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args); + + grub_addr_t grub_efi_section_addr (const char *section); + diff --git a/0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0254-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 80% rename from 0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0254-arm-arm64-loader-Better-memory-allocation-and-error-.patch index 57d937cd..b6c1dc91 100644 --- a/0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch +++ b/0254-arm-arm64-loader-Better-memory-allocation-and-error-.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Thu, 11 Jul 2019 14:38:57 +0200 +Date: Mon, 15 Apr 2024 12:58:13 -0600 Subject: [PATCH] arm/arm64 loader: Better memory allocation and error messages. @@ -66,28 +66,31 @@ per-platform constraints on its given address are maintained. Signed-off-by: Peter Jones --- - grub-core/kern/efi/mm.c | 33 +++++++++++++++----- - grub-core/loader/arm64/linux.c | 68 +++++++++++++++++++++++++++++++----------- - 2 files changed, 76 insertions(+), 25 deletions(-) + grub-core/kern/efi/mm.c | 35 ++++++++++++++++++------ + grub-core/loader/efi/linux.c | 65 +++++++++++++++++++++++++++++++++----------- + 2 files changed, 75 insertions(+), 25 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index f6aef0ef64..85ad4b4494 100644 +index 8f75205a732..560b859b6f4 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, +@@ -153,8 +153,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, { grub_efi_status_t status; grub_efi_boot_services_t *b; + grub_efi_physical_address_t ret = address; - /* Limit the memory access to less than 4GB for 32-bit platforms. */ +- /* Limit the memory access to less than 4GB for 32-bit platforms. */ ++/* Limit the memory access to less than 4GB for 32-bit platforms. */ if (address > GRUB_EFI_MAX_USABLE_ADDRESS) -@@ -170,19 +171,22 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, + { + char inv_addr[17], max_addr[17]; /* log16(2^64) = 16, plus NUL. */ +@@ -169,19 +170,22 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, } b = grub_efi_system_table->boot_services; -- status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address); -+ status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &ret); +- status = b->allocate_pages (alloctype, memtype, pages, &address); ++ status = b->allocate_pages (alloctype, memtype, pages, &ret); if (status != GRUB_EFI_SUCCESS) { + grub_dprintf ("efi", @@ -103,13 +106,13 @@ index f6aef0ef64..85ad4b4494 100644 /* Uggh, the address 0 was allocated... This is too annoying, so reallocate another one. */ - address = GRUB_EFI_MAX_USABLE_ADDRESS; -- status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &address); +- status = b->allocate_pages (alloctype, memtype, pages, &address); + ret = address; -+ status = efi_call_4 (b->allocate_pages, alloctype, memtype, pages, &ret); ++ status = b->allocate_pages (alloctype, memtype, pages, &ret); grub_efi_free_pages (0, pages); if (status != GRUB_EFI_SUCCESS) { -@@ -191,9 +195,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, +@@ -190,9 +194,9 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, } } @@ -121,7 +124,7 @@ index f6aef0ef64..85ad4b4494 100644 } void * -@@ -713,8 +717,21 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) +@@ -711,8 +715,21 @@ grub_efi_get_ram_base(grub_addr_t *base_addr) for (desc = memory_map, *base_addr = GRUB_EFI_MAX_USABLE_ADDRESS; (grub_addr_t) desc < ((grub_addr_t) memory_map + memory_map_size); desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) @@ -145,11 +148,11 @@ index f6aef0ef64..85ad4b4494 100644 grub_free(memory_map); -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 04994d5c67..70a0075ec5 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -71,20 +71,25 @@ finalize_params_linux (void) +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 8742e303d85..ddb27834131 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -182,7 +182,7 @@ finalize_params_linux (void) { grub_efi_loaded_image_t *loaded_image = NULL; int node, retval, len; @@ -157,29 +160,32 @@ index 04994d5c67..70a0075ec5 100644 + grub_err_t err = GRUB_ERR_NONE; void *fdt; - fdt = grub_fdt_load (GRUB_EFI_LINUX_FDT_EXTRA_SPACE); -- - if (!fdt) -- goto failure; -+ { -+ err = grub_error(GRUB_ERR_BAD_OS, "failed to load FDT"); -+ goto failure; -+ } - - node = grub_fdt_find_subnode (fdt, 0, "chosen"); - if (node < 0) - node = grub_fdt_add_subnode (fdt, 0, "chosen"); - - if (node < 1) -- goto failure; -+ { -+ err = grub_error(grub_errno, "failed to load chosen fdt node."); -+ goto failure; -+ } - /* Set initrd info */ - if (initrd_start && initrd_end > initrd_start) -@@ -95,15 +100,26 @@ finalize_params_linux (void) +@@ -191,14 +191,21 @@ finalize_params_linux (void) + fdt = grub_fdt_load (GRUB_EFI_LINUX_FDT_EXTRA_SPACE); + + if (!fdt) +- goto failure; ++ { ++ err = grub_error(GRUB_ERR_BAD_OS, "failed to load FDT"); ++ goto failure; ++ } ++ + + node = grub_fdt_find_subnode (fdt, 0, "chosen"); + if (node < 0) + node = grub_fdt_add_subnode (fdt, 0, "chosen"); + + if (node < 1) +- goto failure; ++ { ++ err = grub_error(grub_errno, "failed to load chosen fdt node."); ++ goto failure; ++ } + + grub_dprintf ("linux", "Initrd @ %p-%p\n", + (void *) initrd_start, (void *) initrd_end); +@@ -206,15 +213,26 @@ finalize_params_linux (void) retval = grub_fdt_set_prop64 (fdt, node, "linux,initrd-start", initrd_start); if (retval) @@ -210,18 +216,16 @@ index 04994d5c67..70a0075ec5 100644 grub_dprintf ("linux", "Installed/updated FDT configuration table @ %p\n", fdt); -@@ -111,14 +127,20 @@ finalize_params_linux (void) - /* Convert command line to UCS-2 */ +@@ -223,7 +241,7 @@ finalize_params_linux (void) loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); - if (!loaded_image) -- goto failure; -+ { + if (loaded_image == NULL) + { +- grub_error (GRUB_ERR_BAD_FIRMWARE, "missing loaded_image proto"); + err = grub_error(grub_errno, "Failed to install fdt"); -+ goto failure; -+ } - + goto failure; + } loaded_image->load_options_size = len = - (grub_strlen (linux_args) + 1) * sizeof (grub_efi_char16_t); +@@ -231,7 +249,10 @@ finalize_params_linux (void) loaded_image->load_options = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size)); if (!loaded_image->load_options) @@ -233,16 +237,16 @@ index 04994d5c67..70a0075ec5 100644 loaded_image->load_options_size = 2 * grub_utf8_to_utf16 (loaded_image->load_options, len, -@@ -128,7 +150,7 @@ finalize_params_linux (void) +@@ -241,7 +262,7 @@ finalize_params_linux (void) failure: grub_fdt_unload(); - return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT"); + return err; } + #endif - static void -@@ -212,16 +234,28 @@ grub_linux_unload (void) +@@ -344,16 +365,28 @@ grub_linux_unload (void) static void * allocate_initrd_mem (int initrd_pages) { @@ -275,5 +279,5 @@ index 04994d5c67..70a0075ec5 100644 + grub_dprintf ("linux", "got 0x%016llx\n", (unsigned long long)ret); + return ret; } + #endif - static grub_err_t diff --git a/0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch b/0255-arm64-Fix-EFI-loader-kernel-image-allocation.patch similarity index 67% rename from 0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch rename to 0255-arm64-Fix-EFI-loader-kernel-image-allocation.patch index cc5458cc..61f6d44b 100644 --- a/0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch +++ b/0255-arm64-Fix-EFI-loader-kernel-image-allocation.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt -Date: Mon, 2 Aug 2021 23:10:01 +1000 +Date: Tue, 16 Apr 2024 12:22:54 -0600 Subject: [PATCH] arm64: Fix EFI loader kernel image allocation We are currently allocating just enough memory for the file size, @@ -18,15 +18,14 @@ Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Peter Jones Signed-off-by: Robbie Harwood --- - grub-core/loader/arm64/linux.c | 100 +++++++++++++++++++++++++++-------------- - include/grub/arm/linux.h | 1 + - include/grub/arm64/linux.h | 1 + - 3 files changed, 68 insertions(+), 34 deletions(-) + grub-core/loader/efi/linux.c | 93 +++++++++++++++++++++++++++++++------------- + include/grub/efi/efi.h | 3 +- + 2 files changed, 68 insertions(+), 28 deletions(-) -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 47f8cf0d84..f18d90bd74 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index ddb27834131..cb9de5565de 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c @@ -41,6 +41,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); static grub_dl_t my_mod; static int loaded; @@ -36,7 +35,7 @@ index 47f8cf0d84..f18d90bd74 100644 static void *kernel_addr; static grub_uint64_t kernel_size; static grub_uint32_t handover_offset; -@@ -204,9 +206,8 @@ grub_linux_unload (void) +@@ -319,9 +321,8 @@ grub_linux_unload (void) GRUB_EFI_BYTES_TO_PAGES (initrd_end - initrd_start)); initrd_start = initrd_end = 0; grub_free (linux_args); @@ -45,13 +44,14 @@ index 47f8cf0d84..f18d90bd74 100644 - GRUB_EFI_BYTES_TO_PAGES (kernel_size)); + if (kernel_alloc_addr) + grub_efi_free_pages ((grub_addr_t) kernel_alloc_addr, kernel_alloc_pages); + #if !defined(__i386__) && !defined(__x86_64__) grub_fdt_unload (); - return GRUB_ERR_NONE; - } -@@ -311,14 +312,35 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), + #endif +@@ -512,12 +513,37 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), return grub_errno; } ++#if !defined(__i386__) && !defined(__x86_64__) +static grub_err_t +parse_pe_header (void *kernel, grub_uint64_t *total_size, + grub_uint32_t *entry_offset, @@ -71,106 +71,96 @@ index 47f8cf0d84..f18d90bd74 100644 + + return GRUB_ERR_NONE; +} ++#endif + static grub_err_t grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) { grub_file_t file = 0; -- struct linux_arch_kernel_header lh; -- struct grub_armxx_linux_pe_header *pe; - grub_err_t err; + struct linux_arch_kernel_header lh; + grub_off_t filelen; + grub_uint32_t align; + void *kernel = NULL; - int rc; + grub_err_t err; grub_dl_ref (my_mod); -@@ -333,40 +355,24 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -548,8 +574,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (!file) goto fail; - kernel_size = grub_file_size (file); - -- if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh)) -- return grub_errno; -- -- if (grub_arch_efi_linux_check_image (&lh) != GRUB_ERR_NONE) -- goto fail; -- -- grub_loader_unset(); -- -- grub_dprintf ("linux", "kernel file size: %lld\n", (long long) kernel_size); -- kernel_addr = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (kernel_size)); -- grub_dprintf ("linux", "kernel numpages: %lld\n", -- (long long) GRUB_EFI_BYTES_TO_PAGES (kernel_size)); -- if (!kernel_addr) + if (grub_arch_efi_linux_load_image_header (file, &lh) != GRUB_ERR_NONE) + #if !defined(__i386__) && !defined(__x86_64__) + goto fail; +@@ -570,33 +594,46 @@ fallback: + } + #endif + + filelen = grub_file_size (file); + kernel = grub_malloc(filelen); + if (!kernel) - { -- grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); ++ { + grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel load buffer")); - goto fail; - } - -- grub_file_seek (file, 0); -- if (grub_file_read (file, kernel_addr, kernel_size) -- < (grub_int64_t) kernel_size) ++ goto fail; ++ } ++ + if (grub_file_read (file, kernel, filelen) < (grub_ssize_t)filelen) - { -- if (!grub_errno) -- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), argv[0]); ++ { + grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), + argv[0]); - goto fail; - } - -- grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); -- - if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED) - { -- rc = grub_linuxefi_secure_validate (kernel_addr, kernel_size); -+ rc = grub_linuxefi_secure_validate (kernel, filelen); - if (rc <= 0) - { - grub_error (GRUB_ERR_INVALID_COMMAND, -@@ -375,8 +381,32 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - } - } - -- pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); -- handover_offset = pe->opt.entry_addr; -+ if (grub_arch_efi_linux_check_image (kernel) != GRUB_ERR_NONE) -+ goto fail; ++ goto fail; ++ } ++ ++#if !defined(__i386__) && !defined(__x86_64__) + if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align) != GRUB_ERR_NONE) + goto fail; + grub_dprintf ("linux", "kernel mem size : %lld\n", (long long) kernel_size); + grub_dprintf ("linux", "kernel entry offset : %d\n", handover_offset); + grub_dprintf ("linux", "kernel alignment : 0x%x\n", align); + -+ grub_loader_unset(); -+ + grub_loader_unset(); + +- grub_dprintf ("linux", "kernel file size: %lld\n", (long long) kernel_size); +- kernel_addr = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (kernel_size)); +- grub_dprintf ("linux", "kernel numpages: %lld\n", +- (long long) GRUB_EFI_BYTES_TO_PAGES (kernel_size)); +- if (!kernel_addr) + kernel_alloc_pages = GRUB_EFI_BYTES_TO_PAGES (kernel_size + align - 1); + kernel_alloc_addr = grub_efi_allocate_any_pages (kernel_alloc_pages); + grub_dprintf ("linux", "kernel numpages: %d\n", kernel_alloc_pages); + if (!kernel_alloc_addr) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -+ goto fail; -+ } + { + grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); + goto fail; + } +- +- grub_file_seek (file, 0); +- if (grub_file_read (file, kernel_addr, kernel_size) +- < (grub_int64_t) kernel_size) +- { +- if (!grub_errno) +- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), argv[0]); +- goto fail; +- } + kernel_addr = (void *)ALIGN_UP((grub_uint64_t)kernel_alloc_addr, align); -+ -+ grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); + + grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); +- +-#if !defined(__i386__) && !defined(__x86_64__) +- struct grub_armxx_linux_pe_header *pe; +- pe = (void *)((unsigned long)kernel_addr + lh.hdr_offset); +- handover_offset = pe->opt.entry_addr; + grub_memcpy (kernel_addr, kernel, grub_min(filelen, kernel_size)); + if (kernel_size > filelen) + grub_memset ((char *)kernel_addr + filelen, 0, kernel_size - filelen); + grub_free(kernel); + kernel = NULL; + #endif cmdline_size = grub_loader_cmdline_size (argc, argv) + sizeof (LINUX_IMAGE); - linux_args = grub_malloc (cmdline_size); -@@ -400,6 +430,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -621,6 +658,9 @@ fallback: } fail: @@ -180,7 +170,7 @@ index 47f8cf0d84..f18d90bd74 100644 if (file) grub_file_close (file); -@@ -412,9 +445,8 @@ fail: +@@ -633,9 +673,8 @@ fail: if (linux_args && !loaded) grub_free (linux_args); @@ -192,27 +182,28 @@ index 47f8cf0d84..f18d90bd74 100644 return grub_errno; } -diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h -index b582f67f66..966a5074f5 100644 ---- a/include/grub/arm/linux.h -+++ b/include/grub/arm/linux.h -@@ -44,6 +44,7 @@ struct grub_arm_linux_pe_header +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index bff833468ee..c40684821e1 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -20,7 +20,6 @@ + #ifndef GRUB_EFI_EFI_HEADER + #define GRUB_EFI_EFI_HEADER 1 + +-#include + #include + #include + #include +@@ -52,10 +51,12 @@ struct grub_arm64_linux_pe_header + }; #if defined(__arm__) - # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE +# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE32_MAGIC - # define linux_arch_kernel_header linux_arm_kernel_header # define grub_armxx_linux_pe_header grub_arm_linux_pe_header #endif -diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h -index ea030312df..422bf2bf24 100644 ---- a/include/grub/arm64/linux.h -+++ b/include/grub/arm64/linux.h -@@ -48,6 +48,7 @@ struct grub_arm64_linux_pe_header #if defined(__aarch64__) - # define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE +# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE64_MAGIC - # define linux_arch_kernel_header linux_arm64_kernel_header # define grub_armxx_linux_pe_header grub_arm64_linux_pe_header #endif + diff --git a/0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch b/0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch similarity index 68% rename from 0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch rename to 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch index ef51214f..222a13c5 100644 --- a/0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch +++ b/0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Fri, 25 Mar 2022 15:40:12 -0400 +Date: Tue, 16 Apr 2024 12:51:50 -0600 Subject: [PATCH] pe: add the DOS header struct and fix some bad naming. In order to properly validate a loaded kernel's support for being loaded @@ -16,17 +16,17 @@ define, and adds defines for the actual PE magic. Signed-off-by: Peter Jones --- - grub-core/loader/arm64/linux.c | 2 +- - include/grub/efi/pe32.h | 28 ++++++++++++++++++++++++++-- + grub-core/loader/efi/linux.c | 2 +- + include/grub/efi/pe32.h | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index d2af47c2c0..cc67f43906 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -58,7 +58,7 @@ 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"); +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index cb9de5565de..ecaa8c18c4d 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -138,7 +138,7 @@ grub_arch_efi_linux_load_image_header (grub_file_t file, + if (grub_file_read (file, lh, sizeof (*lh)) < (grub_ssize_t) sizeof (*lh)) + return grub_error(GRUB_ERR_FILE_READ_ERROR, "failed to read Linux image header"); - if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC) + if ((lh->code0 & 0xffff) != GRUB_DOS_MAGIC) @@ -34,7 +34,7 @@ index d2af47c2c0..cc67f43906 100644 N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index a43adf2746..2a5e1ee003 100644 +index a39743396dc..13fdd0e7d98 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h @@ -46,7 +46,30 @@ @@ -67,15 +67,15 @@ index a43adf2746..2a5e1ee003 100644 + grub_uint32_t lfanew; +}; - /* According to the spec, the minimal alignment is 512 bytes... - But some examples (such as EFI drivers in the Intel -@@ -280,7 +303,8 @@ struct grub_pe32_section_table - - + struct grub_msdos_image_header + { +@@ -293,7 +316,8 @@ struct grub_pe32_section_table + #define GRUB_PE32_SCN_MEM_READ 0x40000000 + #define GRUB_PE32_SCN_MEM_WRITE 0x80000000 -#define GRUB_PE32_SIGNATURE_SIZE 4 +#define GRUB_PE32_SIGNATURE_SIZE 4 +#define GRUB_PE32_SIGNATURE "PE\0\0" - struct grub_pe32_header - { + #if GRUB_TARGET_SIZEOF_VOID_P == 8 + #define GRUB_PE32_NATIVE_MAGIC GRUB_PE32_PE64_MAGIC diff --git a/0273-Correct-BSS-zeroing-on-aarch64.patch b/0257-Correct-BSS-zeroing-on-aarch64.patch similarity index 76% rename from 0273-Correct-BSS-zeroing-on-aarch64.patch rename to 0257-Correct-BSS-zeroing-on-aarch64.patch index 4f9a2b78..232393f7 100644 --- a/0273-Correct-BSS-zeroing-on-aarch64.patch +++ b/0257-Correct-BSS-zeroing-on-aarch64.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Linton -Date: Tue, 6 Sep 2022 15:33:03 -0500 +Date: Tue, 16 Apr 2024 13:26:55 -0600 Subject: [PATCH] Correct BSS zeroing on aarch64 The aarch64 loader doesn't use efi bootservices, and @@ -17,19 +17,19 @@ Resolves: rhbz#2125069 Signed-off-by: Jeremy Linton --- - grub-core/loader/arm64/linux.c | 27 ++++++++++++++++++++++----- + grub-core/loader/efi/linux.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 489d0c7173..419f2201df 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -316,10 +316,12 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index ecaa8c18c4d..55c5c8600d4 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -517,10 +517,12 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), static grub_err_t parse_pe_header (void *kernel, grub_uint64_t *total_size, grub_uint32_t *entry_offset, - grub_uint32_t *alignment) -+ grub_uint32_t *alignment,grub_uint32_t *code_size) ++ grub_uint32_t *alignment, grub_uint32_t *code_size) { struct linux_arch_kernel_header *lh = kernel; struct grub_armxx_linux_pe_header *pe; @@ -38,7 +38,7 @@ index 489d0c7173..419f2201df 100644 pe = (void *)((unsigned long)kernel + lh->hdr_offset); -@@ -329,6 +331,19 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size, +@@ -530,6 +532,19 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size, *total_size = pe->opt.image_size; *entry_offset = pe->opt.entry_addr; *alignment = pe->opt.section_alignment; @@ -58,18 +58,18 @@ index 489d0c7173..419f2201df 100644 return GRUB_ERR_NONE; } -@@ -341,6 +356,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - grub_err_t err; +@@ -543,6 +558,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + struct linux_arch_kernel_header lh; grub_off_t filelen; grub_uint32_t align; + grub_uint32_t code_size; void *kernel = NULL; - int nx_supported = 1; + grub_err_t err; -@@ -373,11 +389,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -610,11 +626,12 @@ fallback: + } - if (grub_arch_efi_linux_check_image (kernel) != GRUB_ERR_NONE) - goto fail; + #if !defined(__i386__) && !defined(__x86_64__) - if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align) != GRUB_ERR_NONE) + if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align, &code_size) != GRUB_ERR_NONE) goto fail; @@ -78,9 +78,9 @@ index 489d0c7173..419f2201df 100644 grub_dprintf ("linux", "kernel alignment : 0x%x\n", align); + grub_dprintf ("linux", "kernel size : 0x%x\n", code_size); - err = grub_efi_check_nx_image_support((grub_addr_t)kernel, filelen, &nx_supported); - if (err != GRUB_ERR_NONE) -@@ -396,9 +413,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_loader_unset(); + +@@ -629,9 +646,9 @@ fallback: kernel_addr = (void *)ALIGN_UP((grub_uint64_t)kernel_alloc_addr, align); grub_dprintf ("linux", "kernel @ %p\n", kernel_addr); @@ -92,4 +92,4 @@ index 489d0c7173..419f2201df 100644 + grub_memset ((char *)kernel_addr + code_size, 0, kernel_size - code_size); grub_free(kernel); kernel = NULL; - + #endif diff --git a/0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch b/0258-arm64-Use-proper-memory-type-for-kernel-allocation.patch similarity index 77% rename from 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch rename to 0258-arm64-Use-proper-memory-type-for-kernel-allocation.patch index e77fcbf6..453ee578 100644 --- a/0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch +++ b/0258-arm64-Use-proper-memory-type-for-kernel-allocation.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Maximilian Luz -Date: Tue, 28 Jun 2022 23:06:46 +0200 +Date: Tue, 16 Apr 2024 14:21:49 -0600 Subject: [PATCH] arm64: Use proper memory type for kernel allocation Currently, the kernel pages are allocated with type EFI_LOADER_DATA. @@ -13,24 +13,24 @@ memory that is actually executable. Signed-off-by: Maximilian Luz --- - grub-core/loader/arm64/linux.c | 7 ++++++- + grub-core/loader/efi/linux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index 419f2201df8b..a3a193c255e9 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -26,7 +26,9 @@ +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 55c5c8600d4..d9ded7c4f12 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -25,7 +25,9 @@ + #include #include #include - #include +#include #include +#include #include #include #include -@@ -403,7 +405,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -636,7 +638,10 @@ fallback: grub_loader_unset(); kernel_alloc_pages = GRUB_EFI_BYTES_TO_PAGES (kernel_size + align - 1); diff --git a/0259-grub-probe-document-the-behavior-of-multiple-v.patch b/0259-grub-probe-document-the-behavior-of-multiple-v.patch deleted file mode 100644 index 4e9d7ccf..00000000 --- a/0259-grub-probe-document-the-behavior-of-multiple-v.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Fri, 15 Jul 2022 15:49:25 -0400 -Subject: [PATCH] grub-probe: document the behavior of multiple -v - -Signed-off-by: Robbie Harwood -(cherry picked from commit 51a55233eed08f7f12276afd6b3724b807a0b680) ---- - util/grub-probe.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/util/grub-probe.c b/util/grub-probe.c -index c6fac732b4..ba867319a7 100644 ---- a/util/grub-probe.c -+++ b/util/grub-probe.c -@@ -732,7 +732,8 @@ static struct argp_option options[] = { - {"device-map", 'm', N_("FILE"), 0, - N_("use FILE as the device map [default=%s]"), 0}, - {"target", 't', N_("TARGET"), 0, 0, 0}, -- {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, -+ {"verbose", 'v', 0, 0, -+ N_("print verbose messages (pass twice to enable debug printing)."), 0}, - {0, '0', 0, 0, N_("separate items in output using ASCII NUL characters"), 0}, - { 0, 0, 0, 0, 0, 0 } - }; diff --git a/0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch b/0259-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch similarity index 96% rename from 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch rename to 0259-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch index 900c59a0..af24bccb 100644 --- a/0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch +++ b/0259-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch @@ -14,7 +14,7 @@ Signed-off-by: Nicolas Frayer 1 file changed, 1 deletion(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index d59145f861d5..bac7b8a0e1d8 100644 +index 803b9656d36..26872ce9477 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -372,7 +372,6 @@ grub_try_normal_prefix (const char *prefix) diff --git a/0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch b/0260-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch similarity index 98% rename from 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch rename to 0260-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch index a3ed1a8c..2198ce3c 100644 --- a/0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch +++ b/0260-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch @@ -25,7 +25,7 @@ Reviewed-by: Daniel Kiper 1 file changed, 10 insertions(+) diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index bc2224dbb463..8e02ab4a3014 100644 +index bc2224dbb46..8e02ab4a301 100644 --- a/grub-core/fs/xfs.c +++ b/grub-core/fs/xfs.c @@ -902,6 +902,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, diff --git a/0349-Ignore-warnings-for-incompatible-types.patch b/0261-Ignore-warnings-for-incompatible-types.patch similarity index 90% rename from 0349-Ignore-warnings-for-incompatible-types.patch rename to 0261-Ignore-warnings-for-incompatible-types.patch index 73e99109..ad7dacb9 100644 --- a/0349-Ignore-warnings-for-incompatible-types.patch +++ b/0261-Ignore-warnings-for-incompatible-types.patch @@ -12,10 +12,10 @@ Signed-off-by: Nicolas Frayer 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 79f45ef1e14c..b66e07c67851 100644 +index d223fe3ef6e..4788f3d6adc 100644 --- a/configure.ac +++ b/configure.ac -@@ -2009,8 +2009,8 @@ if test x"$enable_wextra" != xno ; then +@@ -2166,8 +2166,8 @@ if test x"$enable_wextra" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Wextra" fi diff --git a/0261-fs-fat-don-t-error-when-mtime-is-0.patch b/0261-fs-fat-don-t-error-when-mtime-is-0.patch deleted file mode 100644 index f014f6c9..00000000 --- a/0261-fs-fat-don-t-error-when-mtime-is-0.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Fri, 15 Jul 2022 15:42:41 -0400 -Subject: [PATCH] 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"). - -Signed-off-by: Robbie Harwood -(cherry picked from commit 0615c4887352e32d7bb7198e9ad0d695f9dc2c31) ---- - 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 dd82e4ee35..ff6200c5be 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; diff --git a/0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch b/0262-cmd-search-Rework-of-CVE-2023-4001-fix.patch similarity index 99% rename from 0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch rename to 0262-cmd-search-Rework-of-CVE-2023-4001-fix.patch index 2c2e628d..c63fc3e8 100644 --- a/0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch +++ b/0262-cmd-search-Rework-of-CVE-2023-4001-fix.patch @@ -20,7 +20,7 @@ Signed-off-by: Nicolas Frayer 1 file changed, 126 insertions(+), 8 deletions(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c -index 4735feefcde5..5956b39dca72 100644 +index db8692ffbfb..9dd937e6df4 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -30,6 +30,8 @@ diff --git a/0263-loader-efi-linux.c-read-the-kernel-image-before-head.patch b/0263-loader-efi-linux.c-read-the-kernel-image-before-head.patch new file mode 100644 index 00000000..e8dc2231 --- /dev/null +++ b/0263-loader-efi-linux.c-read-the-kernel-image-before-head.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 29 May 2024 17:35:35 -0600 +Subject: [PATCH] loader/efi/linux.c: read the kernel image before header + +Signed-off-by: Leo Sandoval +--- + grub-core/loader/efi/linux.c | 34 ++++++++++++++++++++-------------- + 1 file changed, 20 insertions(+), 14 deletions(-) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index d9ded7c4f12..3ada50ed969 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -559,6 +559,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_file_t file = 0; + struct linux_arch_kernel_header lh; + grub_off_t filelen; ++ grub_off_t filereadlen; + grub_uint32_t align; + grub_uint32_t code_size; + void *kernel = NULL; +@@ -592,6 +593,25 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + if (!file) + goto fail; + ++ filelen = grub_file_size (file); ++ kernel = grub_malloc(filelen); ++ if (!kernel) ++ { ++ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel load buffer")); ++ goto fail; ++ } ++ ++ filereadlen = grub_file_read (file, kernel, filelen); ++ grub_dprintf ("linux", "filelen : %lld\n", (long long) filelen); ++ grub_dprintf ("linux", "filereadlen : %lld\n", (long long) filereadlen); ++ ++ if (filereadlen < filelen) ++ { ++ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), ++ argv[0]); ++ goto fail; ++ } ++ + if (grub_arch_efi_linux_load_image_header (file, &lh) != GRUB_ERR_NONE) + #if !defined(__i386__) && !defined(__x86_64__) + goto fail; +@@ -612,20 +632,6 @@ fallback: + } + #endif + +- filelen = grub_file_size (file); +- kernel = grub_malloc(filelen); +- if (!kernel) +- { +- grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel load buffer")); +- goto fail; +- } +- +- if (grub_file_read (file, kernel, filelen) < (grub_ssize_t)filelen) +- { +- grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), +- argv[0]); +- goto fail; +- } + + #if !defined(__i386__) && !defined(__x86_64__) + if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align, &code_size) != GRUB_ERR_NONE) diff --git a/0257-nx-set-attrs-in-our-kernel-loaders.patch b/0264-nx-set-attrs-in-our-kernel-loaders.patch similarity index 77% rename from 0257-nx-set-attrs-in-our-kernel-loaders.patch rename to 0264-nx-set-attrs-in-our-kernel-loaders.patch index 514df1fe..6b0aa1d2 100644 --- a/0257-nx-set-attrs-in-our-kernel-loaders.patch +++ b/0264-nx-set-attrs-in-our-kernel-loaders.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Peter Jones -Date: Tue, 22 Mar 2022 10:57:07 -0400 +Date: Wed, 3 Jul 2024 17:54:41 -0600 Subject: [PATCH] nx: set attrs in our kernel loaders For NX, our kernel loaders need to set write and execute page @@ -12,23 +12,22 @@ Signed-off-by: Peter Jones [rharwood: fix stack_attrs undefined, fix aarch64 callsites] Signed-off-by: Robbie Harwood --- - grub-core/kern/efi/mm.c | 77 +++++++++++++++++ - grub-core/loader/arm64/linux.c | 16 +++- - grub-core/loader/arm64/xen_boot.c | 4 +- + grub-core/kern/efi/mm.c | 79 ++++++++++++++++ + grub-core/loader/arm64/xen_boot.c | 5 +- grub-core/loader/efi/chainloader.c | 11 +++ - grub-core/loader/efi/linux.c | 164 ++++++++++++++++++++++++++++++++++++- - grub-core/loader/i386/efi/linux.c | 26 +++++- - grub-core/loader/i386/linux.c | 5 ++ + grub-core/loader/efi/linux.c | 188 ++++++++++++++++++++++++++++++++++--- + grub-core/loader/i386/efi/linux.c | 26 ++++- + grub-core/loader/i386/linux.c | 5 + include/grub/efi/efi.h | 6 +- include/grub/efi/linux.h | 16 +++- include/grub/efi/pe32.h | 2 + - 10 files changed, 312 insertions(+), 15 deletions(-) + 9 files changed, 319 insertions(+), 19 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 2c33758ed7..e460b072e6 100644 +index 560b859b6f4..464fe1c3c01 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c -@@ -610,6 +610,81 @@ print_memory_map (grub_efi_memory_descriptor_t *memory_map, +@@ -603,6 +603,83 @@ print_memory_map (grub_efi_memory_descriptor_t *memory_map, } #endif @@ -107,11 +106,13 @@ index 2c33758ed7..e460b072e6 100644 + } +} + - void - grub_efi_mm_init (void) ++ ++ + static grub_err_t + grub_efi_mm_add_regions (grub_size_t required_bytes, unsigned int flags) { -@@ -623,6 +698,8 @@ grub_efi_mm_init (void) - grub_efi_uint64_t required_pages; +@@ -615,6 +692,8 @@ grub_efi_mm_add_regions (grub_size_t required_bytes, unsigned int flags) + grub_err_t err; int mm_status; + grub_nx_init (); @@ -119,66 +120,11 @@ index 2c33758ed7..e460b072e6 100644 /* Prepare a memory region to store two memory maps. */ memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); if (! memory_map) -diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c -index cc67f43906..de85583487 100644 ---- a/grub-core/loader/arm64/linux.c -+++ b/grub-core/loader/arm64/linux.c -@@ -172,7 +172,8 @@ free_params (void) - } - - grub_err_t --grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) -+grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args, -+ int nx_supported) - { - grub_err_t retval; - -@@ -182,7 +183,8 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) - - grub_dprintf ("linux", "linux command line: '%s'\n", args); - -- retval = grub_efi_linux_boot ((char *)addr, handover_offset, (void *)addr); -+ retval = grub_efi_linux_boot (addr, size, handover_offset, -+ (void *)addr, nx_supported); - - /* Never reached... */ - free_params(); -@@ -192,7 +194,10 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) - static grub_err_t - grub_linux_boot (void) - { -- return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, linux_args)); -+ return grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, -+ (grub_size_t)kernel_size, -+ linux_args, -+ 0); - } - - static grub_err_t -@@ -340,6 +345,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - grub_off_t filelen; - grub_uint32_t align; - void *kernel = NULL; -+ int nx_supported = 1; - - grub_dl_ref (my_mod); - -@@ -376,6 +382,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - grub_dprintf ("linux", "kernel entry offset : %d\n", handover_offset); - grub_dprintf ("linux", "kernel alignment : 0x%x\n", align); - -+ err = grub_efi_check_nx_image_support((grub_addr_t)kernel, filelen, &nx_supported); -+ if (err != GRUB_ERR_NONE) -+ goto fail; -+ - grub_loader_unset(); - - kernel_alloc_pages = GRUB_EFI_BYTES_TO_PAGES (kernel_size + align - 1); diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c -index d9b7a9ba40..6e7e920416 100644 +index 9838a0f878b..5d7c8603db9 100644 --- a/grub-core/loader/arm64/xen_boot.c +++ b/grub-core/loader/arm64/xen_boot.c -@@ -266,7 +266,9 @@ xen_boot (void) +@@ -252,7 +252,10 @@ xen_boot (void) return err; return grub_arch_efi_linux_boot_image (xen_hypervisor->start, @@ -186,14 +132,15 @@ index d9b7a9ba40..6e7e920416 100644 + xen_hypervisor->size, + xen_hypervisor->cmdline, + 0); ++ } static void diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index fb874f1855..dd31ac9bb3 100644 +index badff5e50b5..5cd6f6a5993 100644 --- a/grub-core/loader/efi/chainloader.c +++ b/grub-core/loader/efi/chainloader.c -@@ -1070,6 +1070,17 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), +@@ -1078,6 +1078,17 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -212,18 +159,18 @@ index fb874f1855..dd31ac9bb3 100644 if (fsize >= (grub_ssize_t) sizeof (struct grub_macho_fat_header)) { diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 9265cf4200..277f352e0c 100644 +index 3ada50ed969..fe48001442a 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c -@@ -26,16 +26,127 @@ +@@ -96,16 +96,127 @@ static grub_efi_load_file2_t initrd_lf2 = { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" + +grub_err_t -+grub_efi_check_nx_image_support (grub_addr_t kernel_addr, -+ grub_size_t kernel_size, ++grub_efi_check_nx_image_support (grub_addr_t k_add, ++ grub_size_t k_size, + int *nx_supported) +{ + struct grub_dos_header *doshdr; @@ -235,19 +182,19 @@ index 9265cf4200..277f352e0c 100644 + int image_is_compatible = 0; + int is_64_bit; + -+ if (kernel_size < sz) ++ if (k_size < sz) + return grub_error (GRUB_ERR_BAD_OS, N_("kernel is too small")); + -+ doshdr = (void *)kernel_addr; ++ doshdr = (void *)k_add; + + if ((doshdr->magic & 0xffff) != GRUB_DOS_MAGIC) + return grub_error (GRUB_ERR_BAD_OS, N_("kernel DOS magic is invalid")); + + sz = doshdr->lfanew + sizeof (*pe32); -+ if (kernel_size < sz) ++ if (k_size < sz) + return grub_error (GRUB_ERR_BAD_OS, N_("kernel is too small")); + -+ pe32 = (struct grub_pe32_header_32 *)(kernel_addr + doshdr->lfanew); ++ pe32 = (struct grub_pe32_header_32 *)(k_add + doshdr->lfanew); + pe64 = (struct grub_pe32_header_64 *)pe32; + + if (grub_memcmp (pe32->signature, GRUB_PE32_SIGNATURE, @@ -275,7 +222,7 @@ index 9265cf4200..277f352e0c 100644 + if (is_64_bit) + { + sz = doshdr->lfanew + sizeof (*pe64); -+ if (kernel_size < sz) ++ if (k_size < sz) + return grub_error (GRUB_ERR_BAD_OS, N_("kernel is too small")); + + if (pe64->optional_header.dll_characteristics & GRUB_PE32_NX_COMPAT) @@ -295,7 +242,7 @@ index 9265cf4200..277f352e0c 100644 +grub_efi_check_nx_required (int *nx_required) +{ + grub_efi_status_t status; -+ grub_efi_guid_t guid = GRUB_EFI_SHIM_LOCK_GUID; ++ grub_guid_t guid = GRUB_EFI_SHIM_LOCK_GUID; + grub_size_t mok_policy_sz = 0; + char *mok_policy = NULL; + grub_uint32_t mok_policy_attrs = 0; @@ -325,10 +272,10 @@ index 9265cf4200..277f352e0c 100644 typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *); grub_err_t --grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, +-grub_efi_linux_boot (void *kernel_address, grub_off_t ho_offset, - void *kernel_params) -+grub_efi_linux_boot (grub_addr_t kernel_addr, grub_size_t kernel_size, -+ grub_off_t handover_offset, void *kernel_params, ++grub_efi_linux_boot (grub_addr_t k_address, grub_size_t k_size, ++ grub_off_t h_offset, void *k_params, + int nx_supported) { grub_efi_loaded_image_t *loaded_image = NULL; @@ -345,18 +292,20 @@ index 9265cf4200..277f352e0c 100644 #ifdef __x86_64__ offset = 512; -@@ -48,12 +159,57 @@ grub_efi_linux_boot (void *kernel_addr, grub_off_t handover_offset, +@@ -118,14 +229,59 @@ grub_efi_linux_boot (void *kernel_address, grub_off_t ho_offset, */ loaded_image = grub_efi_get_loaded_image (grub_efi_image_handle); if (loaded_image) -- loaded_image->image_base = kernel_addr; -+ loaded_image->image_base = (void *)kernel_addr; +- loaded_image->image_base = kernel_address; ++ loaded_image->image_base = (void *)k_address; else grub_dprintf ("linux", "Loaded Image base address could not be set\n"); - grub_dprintf ("linux", "kernel_addr: %p handover_offset: %p params: %p\n", -- kernel_addr, (void *)(grub_efi_uintn_t)handover_offset, kernel_params); -+ (void *)kernel_addr, (void *)handover_offset, kernel_params); + grub_dprintf ("linux", "kernel_address: %p handover_offset: %p params: %p\n", +- kernel_address, (void *)(grub_efi_uintn_t)ho_offset, kernel_params); +- hf = (handover_func)((char *)kernel_address + ho_offset + offset); +- hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); ++ (void *)k_address, (void *)h_offset, k_params); + + + if (nx_required && !nx_supported) @@ -371,14 +320,14 @@ index 9265cf4200..277f352e0c 100644 + } + + grub_dprintf ("nx", "Setting attributes for 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" to r%cx\n", -+ kernel_addr, kernel_addr + kernel_size - 1, ++ k_address, k_address + k_size - 1, + (kernel_set_attrs & GRUB_MEM_ATTR_W) ? 'w' : '-'); -+ grub_update_mem_attrs (kernel_addr, kernel_size, ++ grub_update_mem_attrs (k_address, k_size, + kernel_set_attrs, kernel_clear_attrs); + -+ grub_get_mem_attrs (kernel_addr, 4096, &attrs); ++ grub_get_mem_attrs (k_address, 4096, &attrs); + grub_dprintf ("nx", "permissions for 0x%"PRIxGRUB_ADDR" are %s%s%s\n", -+ (grub_addr_t)kernel_addr, ++ (grub_addr_t)k_address, + (attrs & GRUB_MEM_ATTR_R) ? "r" : "-", + (attrs & GRUB_MEM_ATTR_W) ? "w" : "-", + (attrs & GRUB_MEM_ATTR_X) ? "x" : "-"); @@ -402,11 +351,75 @@ index 9265cf4200..277f352e0c 100644 + asm volatile ("cli"); +#endif + - hf = (handover_func)((char *)kernel_addr + handover_offset + offset); - hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); ++ hf = (handover_func)((char *)k_address + h_offset + offset); ++ hf (grub_efi_image_handle, grub_efi_system_table, k_params); + return GRUB_ERR_BUG; + } +@@ -287,13 +443,15 @@ free_params (void) + } + + grub_err_t +-grub_arch_efi_linux_boot_image (grub_addr_t addr, char *args) ++grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args, ++ int nx_supported) + { + grub_err_t retval; + + grub_dprintf ("linux", "linux command line: '%s'\n", args); + +- retval = grub_efi_linux_boot ((char *)addr, handover_offset, (void *)addr); ++ retval = grub_efi_linux_boot (addr, size, handover_offset, ++ (void *)addr, nx_supported); + + /* Never reached... */ + free_params(); +@@ -308,7 +466,10 @@ grub_linux_boot (void) + return grub_errno; + #endif + +- return grub_arch_efi_linux_boot_image ((grub_addr_t) kernel_addr, linux_args); ++ return grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr, ++ (grub_size_t)kernel_size, ++ linux_args, ++ 0); + } + + static grub_err_t +@@ -560,10 +721,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + struct linux_arch_kernel_header lh; + grub_off_t filelen; + grub_off_t filereadlen; +- grub_uint32_t align; +- grub_uint32_t code_size; + void *kernel = NULL; + grub_err_t err; ++ int nx_supported = 1; + + grub_dl_ref (my_mod); + +@@ -634,6 +794,8 @@ fallback: + + + #if !defined(__i386__) && !defined(__x86_64__) ++ grub_uint32_t align; ++ grub_uint32_t code_size; + if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align, &code_size) != GRUB_ERR_NONE) + goto fail; + grub_dprintf ("linux", "kernel mem size : %lld\n", (long long) kernel_size); +@@ -641,6 +803,10 @@ fallback: + grub_dprintf ("linux", "kernel alignment : 0x%x\n", align); + grub_dprintf ("linux", "kernel size : 0x%x\n", code_size); + ++ err = grub_efi_check_nx_image_support((grub_addr_t)kernel, filelen, &nx_supported); ++ if (err != GRUB_ERR_NONE) ++ goto fail; ++ + grub_loader_unset(); + + kernel_alloc_pages = GRUB_EFI_BYTES_TO_PAGES (kernel_size + align - 1); diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c -index 92b2fb5091..91ae274299 100644 +index f97b123a51e..abbf6b24f50 100644 --- a/grub-core/loader/i386/efi/linux.c +++ b/grub-core/loader/i386/efi/linux.c @@ -44,7 +44,7 @@ struct grub_linuxefi_context { @@ -418,7 +431,7 @@ index 92b2fb5091..91ae274299 100644 void *initrd_mem; }; -@@ -110,13 +110,19 @@ kernel_alloc(grub_efi_uintn_t size, +@@ -134,13 +134,19 @@ kernel_alloc(kernel_alloc_purpose_t purpose, pages = BYTES_TO_PAGES(size); grub_dprintf ("linux", "Trying to allocate %lu pages from %p\n", (unsigned long)pages, (void *)(unsigned long)max); @@ -439,7 +452,7 @@ index 92b2fb5091..91ae274299 100644 } while (grub_error_pop ()) -@@ -137,9 +143,11 @@ grub_linuxefi_boot (void *data) +@@ -161,9 +167,11 @@ grub_linuxefi_boot (void *data) asm volatile ("cli"); @@ -453,7 +466,7 @@ index 92b2fb5091..91ae274299 100644 } static grub_err_t -@@ -304,7 +312,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -331,7 +339,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), grub_uint32_t handover_offset; struct linux_kernel_params *params = 0; char *cmdline = 0; @@ -463,7 +476,7 @@ index 92b2fb5091..91ae274299 100644 grub_dl_ref (my_mod); -@@ -334,6 +344,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -361,6 +371,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } @@ -477,7 +490,7 @@ index 92b2fb5091..91ae274299 100644 lh = (struct linux_i386_kernel_header *)kernel; grub_dprintf ("linux", "original lh is at %p\n", kernel); -@@ -498,6 +515,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -530,6 +547,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), context->handover_offset = handover_offset; context->params = params; context->cmdline = cmdline; @@ -486,10 +499,10 @@ index 92b2fb5091..91ae274299 100644 grub_loader_set_ex (grub_linuxefi_boot, grub_linuxefi_unload, context, 0); diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c -index 4aeb0e4b9a..3c1ff64763 100644 +index 5a257552234..90121e9bc5a 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c -@@ -805,6 +805,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), +@@ -817,6 +817,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), kernel_offset += len; } @@ -502,29 +515,31 @@ index 4aeb0e4b9a..3c1ff64763 100644 linux_params.kernel_alignment = (1 << align); linux_params.ps_mouse = linux_params.padding11 = 0; diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 34825c4adc..449e55269f 100644 +index c40684821e1..2c0e7f24bda 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h -@@ -140,12 +140,16 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, - char **device, - char **path); +@@ -190,6 +190,9 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd, + void * + EXPORT_FUNC (grub_efi_find_configuration_table) (const grub_guid_t *target_guid); +extern grub_addr_t EXPORT_VAR(grub_stack_addr); +extern grub_size_t EXPORT_VAR(grub_stack_size); + - #if defined(__arm__) || defined(__aarch64__) || defined(__riscv) + #if defined(__arm__) || defined(__aarch64__) || defined(__riscv) || defined(__loongarch__) void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void); grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); - #include - grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh); +@@ -197,7 +200,8 @@ grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *); + #include + grub_err_t grub_arch_efi_linux_load_image_header(grub_file_t file, + struct linux_arch_kernel_header *lh); -grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args); +grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, + char *args, int nx_enabled); - #endif grub_addr_t grub_efi_section_addr (const char *section); + diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h -index 887b02fd9f..b82f71006a 100644 +index c806a7757f3..5b4e626c37c 100644 --- a/include/grub/efi/linux.h +++ b/include/grub/efi/linux.h @@ -22,8 +22,20 @@ @@ -535,26 +550,26 @@ index 887b02fd9f..b82f71006a 100644 + grub_err_t -EXPORT_FUNC(grub_efi_linux_boot) (void *kernel_address, grub_off_t offset, -- void *kernel_param); +- void *kernel_param); +EXPORT_FUNC(grub_efi_linux_boot) (grub_addr_t kernel_address, -+ grub_size_t kernel_size, -+ grub_off_t handover_offset, -+ void *kernel_param, int nx_enabled); ++ grub_size_t kernel_size, ++ grub_off_t handover_offset, ++ void *kernel_param, int nx_enabled); + +grub_err_t +EXPORT_FUNC(grub_efi_check_nx_image_support) (grub_addr_t kernel_addr, -+ grub_size_t kernel_size, -+ int *nx_supported); ++ grub_size_t kernel_size, ++ int *nx_supported); + +grub_err_t +EXPORT_FUNC(grub_efi_check_nx_required) (int *nx_required); #endif /* ! GRUB_EFI_LINUX_HEADER */ diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h -index 2a5e1ee003..a5e623eb04 100644 +index 13fdd0e7d98..a4d62373cc9 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h -@@ -181,6 +181,8 @@ struct grub_pe32_optional_header +@@ -194,6 +194,8 @@ struct grub_pe32_optional_header struct grub_pe32_data_directory reserved_entry; }; diff --git a/0265-efi-Provide-wrappers-for-load_image-start_image.patch b/0265-efi-Provide-wrappers-for-load_image-start_image.patch new file mode 100644 index 00000000..1ee0f327 --- /dev/null +++ b/0265-efi-Provide-wrappers-for-load_image-start_image.patch @@ -0,0 +1,183 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Julian Andres Klode +Date: Tue, 9 Jul 2024 16:46:05 -0600 +Subject: [PATCH] efi: Provide wrappers for load_image, start_image, + +These can be used to register a different implementation later, +for example, when shim provides a protocol with those functions. + +Signed-off-by: Mate Kukri +--- + grub-core/kern/efi/efi.c | 57 ++++++++++++++++++++++++++++++++++++++ + grub-core/loader/efi/chainloader.c | 13 ++++----- + include/grub/efi/efi.h | 37 +++++++++++++++++++++++++ + 3 files changed, 100 insertions(+), 7 deletions(-) + +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index cdfc11565c7..b5b8a329622 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -1131,6 +1131,63 @@ grub_efi_find_configuration_table (const grub_guid_t *target_guid) + return 0; + } + ++static const grub_efi_loader_t *override_loader = NULL; ++ ++grub_err_t ++grub_efi_register_loader (const grub_efi_loader_t *loader) ++{ ++ if (override_loader != NULL) ++ return grub_error (GRUB_ERR_BUG, "trying to register different loader"); ++ override_loader = loader; ++ return GRUB_ERR_NONE; ++} ++ ++grub_err_t ++grub_efi_unregister_loader (const grub_efi_loader_t *loader) ++{ ++ if (loader != override_loader) ++ return grub_error (GRUB_ERR_BUG, "trying to unregister different loader"); ++ ++ override_loader = NULL; ++ return GRUB_ERR_NONE; ++} ++ ++grub_efi_status_t ++grub_efi_load_image (grub_efi_boolean_t boot_policy, ++ grub_efi_handle_t parent_image_handle, ++ grub_efi_device_path_t *file_path, void *source_buffer, ++ grub_efi_uintn_t source_size, ++ grub_efi_handle_t *image_handle) ++{ ++ if (override_loader != NULL) ++ return override_loader->load_image (boot_policy, parent_image_handle, ++ file_path, source_buffer, source_size, ++ image_handle); ++ return grub_efi_system_table->boot_services->load_image ( ++ boot_policy, parent_image_handle, file_path, source_buffer, source_size, ++ image_handle); ++} ++ ++grub_efi_status_t ++grub_efi_start_image (grub_efi_handle_t image_handle, ++ grub_efi_uintn_t *exit_data_size, ++ grub_efi_char16_t **exit_data) ++{ ++ if (override_loader != NULL) ++ return override_loader->start_image (image_handle, exit_data_size, ++ exit_data); ++ return grub_efi_system_table->boot_services->start_image ( ++ image_handle, exit_data_size, exit_data); ++} ++ ++grub_efi_status_t ++grub_efi_unload_image (grub_efi_handle_t image_handle) ++{ ++ if (override_loader != NULL) ++ return override_loader->unload_image (image_handle); ++ return grub_efi_system_table->boot_services->unload_image (image_handle); ++} ++ + grub_err_t + grub_efi_status_to_err (grub_efi_status_t status) + { +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 5cd6f6a5993..9b1cc3fd41d 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -69,7 +69,7 @@ grub_start_image (grub_efi_handle_t handle) + + b = grub_efi_system_table->boot_services; + +- status = b->start_image (handle, &exit_data_size, &exit_data); ++ status = grub_efi_start_image (handle, &exit_data_size, &exit_data); + if (status != GRUB_EFI_SUCCESS) + { + if (exit_data) +@@ -101,7 +101,6 @@ grub_chainloader_unload (void *context) + { + grub_efi_handle_t image_handle; + grub_efi_loaded_image_t *loaded_image; +- grub_efi_boot_services_t *b; + + image_handle = (grub_efi_handle_t) context; + +@@ -109,8 +108,7 @@ grub_chainloader_unload (void *context) + if (loaded_image != NULL) + grub_free (loaded_image->load_options); + +- b = grub_efi_system_table->boot_services; +- b->unload_image (image_handle); ++ grub_efi_unload_image (image_handle); + + grub_dl_unref (my_mod); + return GRUB_ERR_NONE; +@@ -871,8 +869,8 @@ grub_load_image(grub_efi_device_path_t *file_path, void *boot_image, + + b = grub_efi_system_table->boot_services; + +- status = b->load_image (0, grub_efi_image_handle, file_path, +- boot_image, image_size, image_handle_out); ++ status = grub_efi_load_image (0, grub_efi_image_handle, file_path, ++ boot_image, image_size, image_handle_out); + if (status != GRUB_EFI_SUCCESS) + { + if (status == GRUB_EFI_OUT_OF_RESOURCES) +@@ -1198,7 +1196,8 @@ fail: + if (cmdline) + grub_free (cmdline); + +- b->unload_image (image_handle); ++ if (image_handle != NULL) ++ grub_efi_unload_image (image_handle); + + grub_dl_unref (my_mod); + +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 2c0e7f24bda..7eed1bd791d 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -202,6 +202,43 @@ grub_err_t grub_arch_efi_linux_load_image_header(grub_file_t file, + struct linux_arch_kernel_header *lh); + grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size, + char *args, int nx_enabled); ++grub_efi_status_t ++EXPORT_FUNC (grub_efi_load_image) (grub_efi_boolean_t boot_policy, ++ grub_efi_handle_t parent_image_handle, ++ grub_efi_device_path_t *file_path, ++ void *source_buffer, grub_efi_uintn_t source_size, ++ grub_efi_handle_t *image_handle); ++ ++grub_efi_status_t ++EXPORT_FUNC (grub_efi_start_image) (grub_efi_handle_t image_handle, ++ grub_efi_uintn_t *exit_data_size, ++ grub_efi_char16_t **exit_data); ++ ++grub_efi_status_t ++EXPORT_FUNC (grub_efi_unload_image) (grub_efi_handle_t image_handle); ++ ++typedef struct grub_efi_loader ++{ ++ grub_efi_status_t (__grub_efi_api *load_image) (grub_efi_boolean_t boot_policy, ++ grub_efi_handle_t parent_image_handle, ++ grub_efi_device_path_t *file_path, ++ void *source_buffer, ++ grub_efi_uintn_t source_size, ++ grub_efi_handle_t *image_handle); ++ ++ grub_efi_status_t (__grub_efi_api *start_image) (grub_efi_handle_t image_handle, ++ grub_efi_uintn_t *exit_data_size, ++ grub_efi_char16_t **exit_data); ++ ++ grub_efi_status_t (__grub_efi_api *unload_image) (grub_efi_handle_t image_handle); ++} grub_efi_loader_t; ++ ++grub_err_t ++EXPORT_FUNC (grub_efi_register_loader) (const grub_efi_loader_t *loader); ++ ++grub_err_t ++EXPORT_FUNC (grub_efi_unregister_loader) (const grub_efi_loader_t *loader); ++ + + grub_addr_t grub_efi_section_addr (const char *section); + diff --git a/0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch b/0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch new file mode 100644 index 00000000..ba160548 --- /dev/null +++ b/0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch @@ -0,0 +1,191 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mate Kukri +Date: Wed, 12 Jun 2024 16:57:12 +0100 +Subject: [PATCH] efi: Use shim's loader protocol for EFI image verification + and loading + +Signed-off-by: Mate Kukri +--- + grub-core/kern/efi/sb.c | 39 ++++++++++++++------------------------- + grub-core/loader/efi/linux.c | 16 ---------------- + include/grub/efi/api.h | 5 +++++ + include/grub/efi/efi.h | 19 ++++++++++++------- + include/grub/efi/sb.h | 3 --- + 5 files changed, 31 insertions(+), 51 deletions(-) + +diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c +index 8d3e413608b..d3de3959989 100644 +--- a/grub-core/kern/efi/sb.c ++++ b/grub-core/kern/efi/sb.c +@@ -31,8 +31,9 @@ + #include + + static grub_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID; ++static grub_guid_t shim_loader_guid = GRUB_EFI_SHIM_IMAGE_LOADER_GUID; + +-static bool shim_lock_enabled = false; ++static grub_efi_loader_t *shim_loader = NULL; + + /* + * Determine whether we're in secure boot mode. +@@ -95,14 +96,6 @@ grub_efi_get_secureboot (void) + if (!(attr & GRUB_EFI_VARIABLE_RUNTIME_ACCESS) && *moksbstate == 1) + { + secureboot = GRUB_EFI_SECUREBOOT_MODE_DISABLED; +- /* +- * TODO: Replace this all with shim's LoadImage protocol, delegating policy to it. +- * +- * We need to set shim_lock_enabled here because we disabled secure boot +- * validation *inside* shim but not in the firmware, so we set this variable +- * here to trigger that code path, whereas the actual verifier is not enabled. +- */ +- shim_lock_enabled = true; + goto out; + } + +@@ -183,14 +176,16 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)), + static grub_err_t + shim_lock_verifier_write (void *context __attribute__ ((unused)), void *buf, grub_size_t size) + { +- grub_efi_shim_lock_protocol_t *sl = grub_efi_locate_protocol (&shim_lock_guid, 0); ++ grub_efi_handle_t image_handle; + +- if (!sl) +- return grub_error (GRUB_ERR_ACCESS_DENIED, N_("shim_lock protocol not found")); ++ if (!shim_loader) ++ return grub_error (GRUB_ERR_ACCESS_DENIED, N_("shim loader protocol not found")); + +- if (sl->verify (buf, size) != GRUB_EFI_SUCCESS) ++ if (shim_loader->load_image (false, grub_efi_image_handle, NULL, buf, size, &image_handle) != GRUB_EFI_SUCCESS) + return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad shim signature")); + ++ shim_loader->unload_image(image_handle); ++ + return GRUB_ERR_NONE; + } + +@@ -205,11 +200,10 @@ void + grub_shim_lock_verifier_setup (void) + { + struct grub_module_header *header; +- grub_efi_shim_lock_protocol_t *sl = +- grub_efi_locate_protocol (&shim_lock_guid, 0); ++ shim_loader = grub_efi_locate_protocol (&shim_loader_guid, 0); + +- /* shim_lock is missing, check if GRUB image is built with --disable-shim-lock. */ +- if (!sl) ++ /* shim loader protocol is missing, check if GRUB image is built with --disable-shim-lock. */ ++ if (!shim_loader) + { + FOR_MODULES (header) + { +@@ -222,17 +216,12 @@ grub_shim_lock_verifier_setup (void) + if (grub_efi_get_secureboot () != GRUB_EFI_SECUREBOOT_MODE_ENABLED) + return; + ++ /* register loader */ ++ grub_efi_register_loader(shim_loader); ++ + /* Enforce shim_lock_verifier. */ + grub_verifier_register (&shim_lock_verifier); + +- shim_lock_enabled = true; +- + grub_env_set ("shim_lock", "y"); + grub_env_export ("shim_lock"); + } +- +-bool +-grub_is_shim_lock_enabled (void) +-{ +- return shim_lock_enabled; +-} +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index fe48001442a..da5dcafad8b 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -727,22 +727,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + + grub_dl_ref (my_mod); + +- if (grub_is_shim_lock_enabled () == true) +- { +-#if defined(__i386__) || defined(__x86_64__) +- grub_dprintf ("linux", "shim_lock enabled, falling back to legacy Linux kernel loader\n"); +- +- err = grub_cmd_linux_x86_legacy (cmd, argc, argv); +- +- if (err == GRUB_ERR_NONE) +- return GRUB_ERR_NONE; +- else +- goto fail; +-#else +- grub_dprintf ("linux", "shim_lock enabled, trying Linux kernel EFI stub loader\n"); +-#endif +- } +- + if (argc == 0) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index 76c88fbdcb0..da51f57fd4a 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -364,6 +364,11 @@ + { 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23 } \ + } + ++#define GRUB_EFI_SHIM_IMAGE_LOADER_GUID \ ++ { 0x1f492041, 0xfadb, 0x4e59, \ ++ {0x9e, 0x57, 0x7c, 0xaf, 0xe7, 0x3a, 0x55, 0xab } \ ++ } ++ + #define GRUB_EFI_RNG_PROTOCOL_GUID \ + { 0x3152bca5, 0xeade, 0x433d, \ + { 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \ +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 7eed1bd791d..77d067977f6 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -220,15 +220,20 @@ EXPORT_FUNC (grub_efi_unload_image) (grub_efi_handle_t image_handle); + typedef struct grub_efi_loader + { + grub_efi_status_t (__grub_efi_api *load_image) (grub_efi_boolean_t boot_policy, +- grub_efi_handle_t parent_image_handle, +- grub_efi_device_path_t *file_path, +- void *source_buffer, +- grub_efi_uintn_t source_size, +- grub_efi_handle_t *image_handle); ++ grub_efi_handle_t parent_image_handle, ++ grub_efi_device_path_t *file_path, ++ void *source_buffer, ++ grub_efi_uintn_t source_size, ++ grub_efi_handle_t *image_handle); + + grub_efi_status_t (__grub_efi_api *start_image) (grub_efi_handle_t image_handle, +- grub_efi_uintn_t *exit_data_size, +- grub_efi_char16_t **exit_data); ++ grub_efi_uintn_t *exit_data_size, ++ grub_efi_char16_t **exit_data); ++ ++ grub_efi_status_t (__grub_efi_api *exit) (grub_efi_handle_t image_handle, ++ grub_efi_status_t exit_status, ++ grub_efi_uintn_t exit_data_size, ++ grub_efi_char16_t *exit_data); + + grub_efi_status_t (__grub_efi_api *unload_image) (grub_efi_handle_t image_handle); + } grub_efi_loader_t; +diff --git a/include/grub/efi/sb.h b/include/grub/efi/sb.h +index 49a9ad01cc9..bf8d2db5ff2 100644 +--- a/include/grub/efi/sb.h ++++ b/include/grub/efi/sb.h +@@ -31,9 +31,6 @@ + extern grub_uint8_t + EXPORT_FUNC (grub_efi_get_secureboot) (void); + +-extern bool +-EXPORT_FUNC (grub_is_shim_lock_enabled) (void); +- + extern void + grub_shim_lock_verifier_setup (void); + #else diff --git a/0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch b/0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch new file mode 100644 index 00000000..9b9104f0 --- /dev/null +++ b/0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mate Kukri +Date: Wed, 10 Jul 2024 12:07:17 -0600 +Subject: [PATCH] efi: Disallow fallback to legacy Linux loader when shim says + NX is required. + +Signed-off-by: Mate Kukri +--- + grub-core/loader/efi/linux.c | 13 ++++++++----- + include/grub/efi/api.h | 2 ++ + 2 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index da5dcafad8b..21aad881ba0 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -724,6 +724,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + void *kernel = NULL; + grub_err_t err; + int nx_supported = 1; ++ int nx_required = 0; + + grub_dl_ref (my_mod); + +@@ -756,21 +757,23 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + } + ++#if !defined(__i386__) && !defined(__x86_64__) + if (grub_arch_efi_linux_load_image_header (file, &lh) != GRUB_ERR_NONE) +-#if !defined(__i386__) && !defined(__x86_64__) + goto fail; + #else +- goto fallback; +- +- if (!initrd_use_loadfile2) ++ if (grub_arch_efi_linux_load_image_header (file, &lh) != GRUB_ERR_NONE || ++ !initrd_use_loadfile2) + { ++ /* We cannot use the legacy loader when NX is required */ ++ if (grub_efi_check_nx_required(&nx_required)) ++ goto fail; ++ + /* + * This is a EFI stub image but it is too old to implement the LoadFile2 + * based initrd loading scheme, and Linux/x86 does not support the DT + * based method either. So fall back to the x86-specific loader that + * enters Linux in EFI mode but without going through its EFI stub. + */ +-fallback: + grub_file_close (file); + return grub_cmd_linux_x86_legacy (cmd, argc, argv); + } +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index da51f57fd4a..637b1272d17 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -2011,6 +2011,8 @@ struct grub_efi_block_io + }; + typedef struct grub_efi_block_io grub_efi_block_io_t; + ++#define GRUB_MOK_POLICY_NX_REQUIRED 0x1 ++ + struct grub_efi_shim_lock_protocol + { + /* diff --git a/0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch b/0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch new file mode 100644 index 00000000..2f249143 --- /dev/null +++ b/0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Mon, 5 Aug 2024 13:19:28 -0600 +Subject: [PATCH] Set non-executable stack sections on EFI assembly files + +For those manual assembly files created where no '.note.GNU-stack' +section is explicitly added, linker defaults it as executable and this +is the reason that RHEL CI rpminspect & annocheck tests are +failing. The proposed change sets the corresponding GNU-stack +sections otherwise CI detects the following security vulnerability + + $ annocheck annocheck --ignore-unknown --verbose --profile=el9 *.rpm 2>&1 | grep FAIL | grep stack + (standard input):(standard input):Hardened: ./usr/lib/grub/x86_64-efi/kernel.exec: FAIL: gnu-stack test because .note.GNU-stack section has execute permission + (standard input):(standard input):Hardened: ./usr/lib/grub/x86_64-efi/kernel.img: FAIL: gnu-stack test because .note.GNU-stack section has execute permission + +Signed-off-by: Leo Sandoval +--- + grub-core/kern/i386/efi/startup.S | 5 +++++ + grub-core/kern/x86_64/efi/startup.S | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/grub-core/kern/i386/efi/startup.S b/grub-core/kern/i386/efi/startup.S +index fc5ea3dac..36d1b1a68 100644 +--- a/grub-core/kern/i386/efi/startup.S ++++ b/grub-core/kern/i386/efi/startup.S +@@ -34,3 +34,8 @@ _start: + movl %eax, EXT_C(grub_efi_system_table) + call EXT_C(grub_main) + ret ++ ++/* An executable stack is not required for these functions. */ ++#if defined (__linux__) && defined (__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif +diff --git a/grub-core/kern/x86_64/efi/startup.S b/grub-core/kern/x86_64/efi/startup.S +index 9357e5c5d..f5c6bc3d8 100644 +--- a/grub-core/kern/x86_64/efi/startup.S ++++ b/grub-core/kern/x86_64/efi/startup.S +@@ -33,3 +33,8 @@ _start: + andq $~0xf, %rsp + call EXT_C(grub_main) + /* Doesn't return. */ ++ ++/* An executable stack is not required for these functions. */ ++#if defined (__linux__) && defined (__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif diff --git a/0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch b/0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch similarity index 71% rename from 0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch rename to 0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch index ddd74e9b..e7dd610c 100644 --- a/0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch +++ b/0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch @@ -1,6 +1,6 @@ -From 4062ab33c8cd86ac15cefe1b4f2f422b28467f54 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Leo Sandoval -Date: Fri, 24 May 2024 18:22:17 -0600 +Date: Mon, 6 May 2024 15:35:41 -0600 Subject: [PATCH] grub-mkconfig.in: turn off executable owner bit Stricker permissions are required on the grub.cfg file, resulting in @@ -13,18 +13,15 @@ Signed-off-by: Leo Sandoval 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index 520a672cd..fb382b648 100644 +index bec52e052..461df7f09 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in -@@ -311,7 +311,7 @@ and /etc/grub.d/* files or please file a bug report with - exit 1 +@@ -316,7 +316,7 @@ and /etc/grub.d/* files or please file a bug report with else # none of the children aborted with error, install the new grub.cfg -- oldumask=$(umask); umask 077 -+ oldumask=$(umask); umask 177 + oldumask=$(umask) +- umask 077 ++ umask 177 cat ${grub_cfg}.new > ${grub_cfg} umask $oldumask rm -f ${grub_cfg}.new --- -2.44.0 - diff --git a/0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch b/0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch similarity index 92% rename from 0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch rename to 0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch index fcd2557c..619ff06b 100644 --- a/0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch +++ b/0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch @@ -16,10 +16,10 @@ Reviewed-by: Daniel Kiper 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 8e7f742fad46..4ec6598cfbb8 100644 +index 13e8a5b4b..6c5f4fb77 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c -@@ -110,6 +110,16 @@ grub_addr_t grub_ieee1275_original_stack; +@@ -113,6 +113,16 @@ grub_addr_t grub_ieee1275_original_stack; #define DRC_INFO 0x40 #define BYTE22 (DY_MEM_V2 | DRC_INFO) @@ -36,7 +36,7 @@ index 8e7f742fad46..4ec6598cfbb8 100644 void grub_exit (int rc __attribute__((unused))) { -@@ -694,6 +704,10 @@ struct option_vector5 +@@ -739,6 +749,10 @@ struct option_vector5 grub_uint32_t platform_facilities; grub_uint8_t sub_processors; grub_uint8_t byte22; @@ -47,7 +47,7 @@ index 8e7f742fad46..4ec6598cfbb8 100644 } GRUB_PACKED; struct pvr_entry -@@ -732,6 +746,13 @@ grub_ieee1275_ibm_cas (void) +@@ -777,6 +791,13 @@ grub_ieee1275_ibm_cas (void) { int rc; grub_ieee1275_ihandle_t root; @@ -61,7 +61,7 @@ index 8e7f742fad46..4ec6598cfbb8 100644 struct cas_args { struct grub_ieee1275_common_hdr common; -@@ -740,6 +761,46 @@ grub_ieee1275_ibm_cas (void) +@@ -785,6 +806,46 @@ grub_ieee1275_ibm_cas (void) grub_ieee1275_cell_t cas_addr; grub_ieee1275_cell_t result; } args; @@ -108,7 +108,7 @@ index 8e7f742fad46..4ec6598cfbb8 100644 struct cas_vector vector = { .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ -@@ -756,7 +817,7 @@ grub_ieee1275_ibm_cas (void) +@@ -801,7 +862,7 @@ grub_ieee1275_ibm_cas (void) .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ .vec5_size = 1 + sizeof (struct option_vector5) - 2, .vec5 = { diff --git a/0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch b/0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch new file mode 100644 index 00000000..60f36bce --- /dev/null +++ b/0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Tue, 16 Jul 2024 11:11:43 +0200 +Subject: [PATCH] grub2-mkconfig: Ensure grub cfg stub is not overwritten + +/boot/efi/EFI/$os_name/grub.cfg contains a grub cfg stub +that should not be overwritten by grub2-mkconfig. +Ensure that we prevent this from happening. + +Signed-off-by: Marta Lewandowska +Signed-off-by: Nicolas Frayer +--- + util/grub-mkconfig.in | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index 461df7f09..b560aae6c 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -109,6 +109,20 @@ do + esac + done + ++os_name=$(grep '^ID=' /etc/os-release | sed 's/ID=//') ++if test "$os_name" = '"rhel"'; then ++ os_name=redhat ++elif test "$os_name" = '"centos"'; then ++ os_name=centos ++fi ++if test "x${grub_cfg}" = "x/boot/efi/EFI/$os_name/grub.cfg" &&\ ++ mountpoint -q /boot/efi; then ++ gettext_printf "Running \`grub2-mkconfig -o %s' will overwrite the GRUB wrapper.\n" "$grub_cfg" 1>&2 ++ gettext_printf "Please run \`grub2-mkconfig -o /boot/grub2/grub.cfg' instead to update grub.cfg.\n" 1>&2 ++ gettext_printf "GRUB configuration file was not updated.\n" 1>&2 ++ exit 1 ++fi ++ + if [ "x$EUID" = "x" ] ; then + EUID=`id -u` + fi diff --git a/0272-loader-arm64-linux-Remove-magic-number-header-field-.patch b/0272-loader-arm64-linux-Remove-magic-number-header-field-.patch deleted file mode 100644 index faaa0713..00000000 --- a/0272-loader-arm64-linux-Remove-magic-number-header-field-.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ard Biesheuvel -Date: Thu, 11 Aug 2022 16:51:57 +0200 -Subject: [PATCH] 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. - -Signed-off-by: Ard Biesheuvel -Reviewed-by: Daniel Kiper -Resolves: rhbz#2125069 -Signed-off-by: Jeremy Linton -(cherry-picked from commit 69edb31205602c29293a8c6e67363bba2a4a1e66) -Signed-off-by: Robbie Harwood ---- - 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 de85583487..489d0c7173 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_DOS_MAGIC) - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled")); diff --git a/0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch b/0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch deleted file mode 100644 index eff155d1..00000000 --- a/0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dann frazier -Date: Thu, 25 Aug 2022 17:08:09 -0600 -Subject: [PATCH] linuxefi: Invalidate i-cache before starting the kernel - -We need to flush the memory range of the code we are about to execute -from the instruction cache before we can safely execute it. Not doing -so appears to be the source of rare synchronous exceptions a user -is seeing on a Cortex-A72-based platform while executing the Linux EFI -stub. Notably they seem to correlate with an instruction on a cache -line boundary. - -Signed-off-by: dann frazier ---- - grub-core/loader/efi/linux.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index 277f352e0c..e413bdcc23 100644 ---- a/grub-core/loader/efi/linux.c -+++ b/grub-core/loader/efi/linux.c -@@ -16,6 +16,7 @@ - * along with GRUB. If not, see . - */ - -+#include - #include - #include - #include -@@ -210,6 +211,9 @@ grub_efi_linux_boot (grub_addr_t kernel_addr, grub_size_t kernel_size, - asm volatile ("cli"); - #endif - -+ /* Invalidate the instruction cache */ -+ grub_arch_sync_caches((void *)kernel_addr, kernel_size); -+ - hf = (handover_func)((char *)kernel_addr + handover_offset + offset); - hf (grub_efi_image_handle, grub_efi_system_table, kernel_params); - diff --git a/0276-commands-efi-tpm-Refine-the-status-of-log-event.patch b/0276-commands-efi-tpm-Refine-the-status-of-log-event.patch deleted file mode 100644 index 896e49b5..00000000 --- a/0276-commands-efi-tpm-Refine-the-status-of-log-event.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lu Ken -Date: Wed, 13 Jul 2022 10:06:10 +0800 -Subject: [PATCH] commands/efi/tpm: Refine the status of log event - -1. Use macro GRUB_ERR_NONE instead of hard code 0. -2. Keep lowercase of the first char for the status string of log event. - -Signed-off-by: Lu Ken -Reviewed-by: Daniel Kiper -(cherry picked from commit 922898573e37135f5dedc16f3e15a1d1d4c53f8a) ---- - grub-core/commands/efi/tpm.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c -index a97d85368a..7acf510499 100644 ---- a/grub-core/commands/efi/tpm.c -+++ b/grub-core/commands/efi/tpm.c -@@ -135,17 +135,17 @@ grub_efi_log_event_status (grub_efi_status_t status) - switch (status) - { - case GRUB_EFI_SUCCESS: -- return 0; -+ return GRUB_ERR_NONE; - case GRUB_EFI_DEVICE_ERROR: -- return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ return grub_error (GRUB_ERR_IO, N_("command failed")); - case GRUB_EFI_INVALID_PARAMETER: -- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid parameter")); - case GRUB_EFI_BUFFER_TOO_SMALL: -- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("output buffer too small")); - case GRUB_EFI_NOT_FOUND: - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); - default: -- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("unknown TPM error")); - } - } - diff --git a/0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch b/0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch deleted file mode 100644 index e04dcbc7..00000000 --- a/0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lu Ken -Date: Wed, 13 Jul 2022 10:06:11 +0800 -Subject: [PATCH] commands/efi/tpm: Use grub_strcpy() instead of grub_memcpy() - -The event description is a string, so using grub_strcpy() is cleaner than -using grub_memcpy(). - -Signed-off-by: Lu Ken -Reviewed-by: Daniel Kiper -(cherry picked from commit ef8679b645a63eb9eb191bb9539d7d25a9d6ff3b) ---- - grub-core/commands/efi/tpm.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c -index 7acf510499..bb59599721 100644 ---- a/grub-core/commands/efi/tpm.c -+++ b/grub-core/commands/efi/tpm.c -@@ -175,7 +175,7 @@ grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf, - event->PCRIndex = pcr; - event->EventType = EV_IPL; - event->EventSize = grub_strlen (description) + 1; -- grub_memcpy (event->Event, description, event->EventSize); -+ grub_strcpy ((char *) event->Event, description); - - algorithm = TCG_ALG_SHA; - status = efi_call_7 (tpm->log_extend_event, tpm, (grub_addr_t) buf, (grub_uint64_t) size, -@@ -212,7 +212,7 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf, - event->Header.EventType = EV_IPL; - event->Size = - sizeof (*event) - sizeof (event->Event) + grub_strlen (description) + 1; -- grub_memcpy (event->Event, description, grub_strlen (description) + 1); -+ grub_strcpy ((char *) event->Event, description); - - status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_addr_t) buf, - (grub_uint64_t) size, event); diff --git a/0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch b/0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch deleted file mode 100644 index 610c81ac..00000000 --- a/0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch +++ /dev/null @@ -1,258 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lu Ken -Date: Wed, 13 Jul 2022 10:06:12 +0800 -Subject: [PATCH] efi/tpm: Add EFI_CC_MEASUREMENT_PROTOCOL support - -The EFI_CC_MEASUREMENT_PROTOCOL abstracts the measurement for virtual firmware -in confidential computing environment. It is similar to the EFI_TCG2_PROTOCOL. -It was proposed by Intel and ARM and approved by UEFI organization. - -It is defined in Intel GHCI specification: https://cdrdv2.intel.com/v1/dl/getContent/726790 . -The EDKII header file is available at https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Protocol/CcMeasurement.h . - -Signed-off-by: Lu Ken -Reviewed-by: Daniel Kiper -(cherry picked from commit 4c76565b6cb885b7e144dc27f3612066844e2d19) ---- - grub-core/commands/efi/tpm.c | 48 ++++++++++++++ - include/grub/efi/cc.h | 151 +++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 199 insertions(+) - create mode 100644 include/grub/efi/cc.h - -diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c -index bb59599721..ae09c1bf8b 100644 ---- a/grub-core/commands/efi/tpm.c -+++ b/grub-core/commands/efi/tpm.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -31,6 +32,7 @@ typedef TCG_PCR_EVENT grub_tpm_event_t; - - static grub_efi_guid_t tpm_guid = EFI_TPM_GUID; - static grub_efi_guid_t tpm2_guid = EFI_TPM2_GUID; -+static grub_efi_guid_t cc_measurement_guid = GRUB_EFI_CC_MEASUREMENT_PROTOCOL_GUID; - - static grub_efi_handle_t *grub_tpm_handle; - static grub_uint8_t grub_tpm_version; -@@ -221,6 +223,50 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf, - return grub_efi_log_event_status (status); - } - -+static void -+grub_cc_log_event (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ grub_efi_cc_event_t *event; -+ grub_efi_status_t status; -+ grub_efi_cc_protocol_t *cc; -+ grub_efi_cc_mr_index_t mr; -+ -+ cc = grub_efi_locate_protocol (&cc_measurement_guid, NULL); -+ if (cc == NULL) -+ return; -+ -+ status = efi_call_3 (cc->map_pcr_to_mr_index, cc, pcr, &mr); -+ if (status != GRUB_EFI_SUCCESS) -+ { -+ grub_efi_log_event_status (status); -+ return; -+ } -+ -+ event = grub_zalloc (sizeof (grub_efi_cc_event_t) + -+ grub_strlen (description) + 1); -+ if (event == NULL) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate CC event buffer")); -+ return; -+ } -+ -+ event->Header.HeaderSize = sizeof (grub_efi_cc_event_header_t); -+ event->Header.HeaderVersion = GRUB_EFI_CC_EVENT_HEADER_VERSION; -+ event->Header.MrIndex = mr; -+ event->Header.EventType = EV_IPL; -+ event->Size = sizeof (*event) + grub_strlen (description) + 1; -+ grub_strcpy ((char *) event->Event, description); -+ -+ status = efi_call_5 (cc->hash_log_extend_event, cc, 0, -+ (grub_efi_physical_address_t)(grub_addr_t) buf, -+ (grub_efi_uint64_t) size, event); -+ grub_free (event); -+ -+ if (status != GRUB_EFI_SUCCESS) -+ grub_efi_log_event_status (status); -+} -+ - grub_err_t - grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, - const char *description) -@@ -228,6 +274,8 @@ grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, - grub_efi_handle_t tpm_handle; - grub_efi_uint8_t protocol_version; - -+ grub_cc_log_event(buf, size, pcr, description); -+ - if (!grub_tpm_handle_find (&tpm_handle, &protocol_version)) - return 0; - -diff --git a/include/grub/efi/cc.h b/include/grub/efi/cc.h -new file mode 100644 -index 0000000000..8960306890 ---- /dev/null -+++ b/include/grub/efi/cc.h -@@ -0,0 +1,151 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2022 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_EFI_CC_H -+#define GRUB_EFI_CC_H 1 -+ -+#include -+#include -+#include -+ -+#define GRUB_EFI_CC_MEASUREMENT_PROTOCOL_GUID \ -+ { 0x96751a3d, 0x72f4, 0x41a6, \ -+ { 0xa7, 0x94, 0xed, 0x5d, 0x0e, 0x67, 0xae, 0x6b } \ -+ }; -+ -+struct grub_efi_cc_version -+{ -+ grub_efi_uint8_t Major; -+ grub_efi_uint8_t Minor; -+}; -+typedef struct grub_efi_cc_version grub_efi_cc_version_t; -+ -+/* EFI_CC Type/SubType definition. */ -+#define GRUB_EFI_CC_TYPE_NONE 0 -+#define GRUB_EFI_CC_TYPE_SEV 1 -+#define GRUB_EFI_CC_TYPE_TDX 2 -+ -+struct grub_efi_cc_type -+{ -+ grub_efi_uint8_t Type; -+ grub_efi_uint8_t SubType; -+}; -+typedef struct grub_efi_cc_type grub_efi_cc_type_t; -+ -+typedef grub_efi_uint32_t grub_efi_cc_event_log_bitmap_t; -+typedef grub_efi_uint32_t grub_efi_cc_event_log_format_t; -+typedef grub_efi_uint32_t grub_efi_cc_event_algorithm_bitmap_t; -+typedef grub_efi_uint32_t grub_efi_cc_mr_index_t; -+ -+/* Intel TDX measure register index. */ -+#define GRUB_TDX_MR_INDEX_MRTD 0 -+#define GRUB_TDX_MR_INDEX_RTMR0 1 -+#define GRUB_TDX_MR_INDEX_RTMR1 2 -+#define GRUB_TDX_MR_INDEX_RTMR2 3 -+#define GRUB_TDX_MR_INDEX_RTMR3 4 -+ -+#define GRUB_EFI_CC_EVENT_LOG_FORMAT_TCG_2 0x00000002 -+#define GRUB_EFI_CC_BOOT_HASH_ALG_SHA384 0x00000004 -+#define GRUB_EFI_CC_EVENT_HEADER_VERSION 1 -+ -+struct grub_efi_cc_event_header -+{ -+ /* Size of the event header itself (sizeof(EFI_TD_EVENT_HEADER)). */ -+ grub_efi_uint32_t HeaderSize; -+ -+ /* -+ * Header version. For this version of this specification, -+ * the value shall be 1. -+ */ -+ grub_efi_uint16_t HeaderVersion; -+ -+ /* Index of the MR that shall be extended. */ -+ grub_efi_cc_mr_index_t MrIndex; -+ -+ /* Type of the event that shall be extended (and optionally logged). */ -+ grub_efi_uint32_t EventType; -+} GRUB_PACKED; -+typedef struct grub_efi_cc_event_header grub_efi_cc_event_header_t; -+ -+struct grub_efi_cc_event -+{ -+ /* Total size of the event including the Size component, the header and the Event data. */ -+ grub_efi_uint32_t Size; -+ grub_efi_cc_event_header_t Header; -+ grub_efi_uint8_t Event[0]; -+} GRUB_PACKED; -+typedef struct grub_efi_cc_event grub_efi_cc_event_t; -+ -+struct grub_efi_cc_boot_service_capability -+{ -+ /* Allocated size of the structure. */ -+ grub_efi_uint8_t Size; -+ -+ /* -+ * Version of the grub_efi_cc_boot_service_capability_t structure itself. -+ * For this version of the protocol, the Major version shall be set to 1 -+ * and the Minor version shall be set to 1. -+ */ -+ grub_efi_cc_version_t StructureVersion; -+ -+ /* -+ * Version of the EFI TD protocol. -+ * For this version of the protocol, the Major version shall be set to 1 -+ * and the Minor version shall be set to 1. -+ */ -+ grub_efi_cc_version_t ProtocolVersion; -+ -+ /* Supported hash algorithms. */ -+ grub_efi_cc_event_algorithm_bitmap_t HashAlgorithmBitmap; -+ -+ /* Bitmap of supported event log formats. */ -+ grub_efi_cc_event_log_bitmap_t SupportedEventLogs; -+ -+ /* Indicates the CC type. */ -+ grub_efi_cc_type_t CcType; -+}; -+typedef struct grub_efi_cc_boot_service_capability grub_efi_cc_boot_service_capability_t; -+ -+struct grub_efi_cc_protocol -+{ -+ grub_efi_status_t -+ (*get_capability) (struct grub_efi_cc_protocol *this, -+ grub_efi_cc_boot_service_capability_t *ProtocolCapability); -+ -+ grub_efi_status_t -+ (*get_event_log) (struct grub_efi_cc_protocol *this, -+ grub_efi_cc_event_log_format_t EventLogFormat, -+ grub_efi_physical_address_t *EventLogLocation, -+ grub_efi_physical_address_t *EventLogLastEntry, -+ grub_efi_boolean_t *EventLogTruncated); -+ -+ grub_efi_status_t -+ (*hash_log_extend_event) (struct grub_efi_cc_protocol *this, -+ grub_efi_uint64_t Flags, -+ grub_efi_physical_address_t DataToHash, -+ grub_efi_uint64_t DataToHashLen, -+ grub_efi_cc_event_t *EfiCcEvent); -+ -+ grub_efi_status_t -+ (*map_pcr_to_mr_index) (struct grub_efi_cc_protocol *this, -+ grub_efi_uint32_t PcrIndex, -+ grub_efi_cc_mr_index_t *MrIndex); -+}; -+typedef struct grub_efi_cc_protocol grub_efi_cc_protocol_t; -+ -+#endif diff --git a/0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch b/0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch deleted file mode 100644 index e0dd347d..00000000 --- a/0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Wed, 3 Aug 2022 19:45:33 +0800 -Subject: [PATCH] font: Reject glyphs exceeds font->max_glyph_width or - font->max_glyph_height - -Check glyph's width and height against limits specified in font's -metadata. Reject the glyph (and font) if such limits are exceeded. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 5760fcfd466cc757540ea0d591bad6a08caeaa16) ---- - grub-core/font/font.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index d09bb38d89..2f09a4a55b 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -760,7 +760,9 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) - || read_be_uint16 (font->file, &height) != 0 - || read_be_int16 (font->file, &xoff) != 0 - || read_be_int16 (font->file, &yoff) != 0 -- || read_be_int16 (font->file, &dwidth) != 0) -+ || read_be_int16 (font->file, &dwidth) != 0 -+ || width > font->max_char_width -+ || height > font->max_char_height) - { - remove_font (font); - return 0; diff --git a/0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch b/0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch deleted file mode 100644 index b5f10f6e..00000000 --- a/0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Fri, 5 Aug 2022 00:51:20 +0800 -Subject: [PATCH] font: Fix size overflow in grub_font_get_glyph_internal() - -The length of memory allocation and file read may overflow. This patch -fixes the problem by using safemath macros. - -There is a lot of code repetition like "(x * y + 7) / 8". It is unsafe -if overflow happens. This patch introduces grub_video_bitmap_calc_1bpp_bufsz(). -It is safe replacement for such code. It has safemath-like prototype. - -This patch also introduces grub_cast(value, pointer), it casts value to -typeof(*pointer) then store the value to *pointer. It returns true when -overflow occurs or false if there is no overflow. The semantics of arguments -and return value are designed to be consistent with other safemath macros. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 941d10ad6f1dcbd12fb613002249e29ba035f985) ---- - grub-core/font/font.c | 17 +++++++++++++---- - include/grub/bitmap.h | 18 ++++++++++++++++++ - include/grub/safemath.h | 2 ++ - 3 files changed, 33 insertions(+), 4 deletions(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 2f09a4a55b..6a3fbebbd8 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -739,7 +739,8 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) - grub_int16_t xoff; - grub_int16_t yoff; - grub_int16_t dwidth; -- int len; -+ grub_ssize_t len; -+ grub_size_t sz; - - if (index_entry->glyph) - /* Return cached glyph. */ -@@ -768,9 +769,17 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) - return 0; - } - -- len = (width * height + 7) / 8; -- glyph = grub_malloc (sizeof (struct grub_font_glyph) + len); -- if (!glyph) -+ /* Calculate real struct size of current glyph. */ -+ if (grub_video_bitmap_calc_1bpp_bufsz (width, height, &len) || -+ grub_add (sizeof (struct grub_font_glyph), len, &sz)) -+ { -+ remove_font (font); -+ return 0; -+ } -+ -+ /* Allocate and initialize the glyph struct. */ -+ glyph = grub_malloc (sz); -+ if (glyph == NULL) - { - remove_font (font); - return 0; -diff --git a/include/grub/bitmap.h b/include/grub/bitmap.h -index 5728f8ca3a..0d9603f619 100644 ---- a/include/grub/bitmap.h -+++ b/include/grub/bitmap.h -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - struct grub_video_bitmap - { -@@ -79,6 +80,23 @@ grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap) - return bitmap->mode_info.height; - } - -+/* -+ * Calculate and store the size of data buffer of 1bit bitmap in result. -+ * Equivalent to "*result = (width * height + 7) / 8" if no overflow occurs. -+ * Return true when overflow occurs or false if there is no overflow. -+ * This function is intentionally implemented as a macro instead of -+ * an inline function. Although a bit awkward, it preserves data types for -+ * safemath macros and reduces macro side effects as much as possible. -+ * -+ * XXX: Will report false overflow if width * height > UINT64_MAX. -+ */ -+#define grub_video_bitmap_calc_1bpp_bufsz(width, height, result) \ -+({ \ -+ grub_uint64_t _bitmap_pixels; \ -+ grub_mul ((width), (height), &_bitmap_pixels) ? 1 : \ -+ grub_cast (_bitmap_pixels / GRUB_CHAR_BIT + !!(_bitmap_pixels % GRUB_CHAR_BIT), (result)); \ -+}) -+ - void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap, - struct grub_video_mode_info *mode_info); - -diff --git a/include/grub/safemath.h b/include/grub/safemath.h -index c17b89bba1..bb0f826de1 100644 ---- a/include/grub/safemath.h -+++ b/include/grub/safemath.h -@@ -30,6 +30,8 @@ - #define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res) - #define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res) - -+#define grub_cast(a, res) grub_add ((a), 0, (res)) -+ - #else - #error gcc 5.1 or newer or clang 3.8 or newer is required - #endif diff --git a/0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch b/0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch deleted file mode 100644 index 3c76eb46..00000000 --- a/0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Fri, 5 Aug 2022 01:58:27 +0800 -Subject: [PATCH] font: Fix several integer overflows in - grub_font_construct_glyph() - -This patch fixes several integer overflows in grub_font_construct_glyph(). -Glyphs of invalid size, zero or leading to an overflow, are rejected. -The inconsistency between "glyph" and "max_glyph_size" when grub_malloc() -returns NULL is fixed too. - -Fixes: CVE-2022-2601 - -Reported-by: Zhang Boyang -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit b1805f251b31a9d3cfae5c3572ddfa630145dbbf) ---- - grub-core/font/font.c | 29 +++++++++++++++++------------ - 1 file changed, 17 insertions(+), 12 deletions(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 6a3fbebbd8..1fa181d4ca 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -1517,6 +1517,7 @@ grub_font_construct_glyph (grub_font_t hinted_font, - struct grub_video_signed_rect bounds; - static struct grub_font_glyph *glyph = 0; - static grub_size_t max_glyph_size = 0; -+ grub_size_t cur_glyph_size; - - ensure_comb_space (glyph_id); - -@@ -1533,29 +1534,33 @@ grub_font_construct_glyph (grub_font_t hinted_font, - if (!glyph_id->ncomb && !glyph_id->attributes) - return main_glyph; - -- if (max_glyph_size < sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) -+ if (grub_video_bitmap_calc_1bpp_bufsz (bounds.width, bounds.height, &cur_glyph_size) || -+ grub_add (sizeof (*glyph), cur_glyph_size, &cur_glyph_size)) -+ return main_glyph; -+ -+ if (max_glyph_size < cur_glyph_size) - { - grub_free (glyph); -- max_glyph_size = (sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) * 2; -- if (max_glyph_size < 8) -- max_glyph_size = 8; -- glyph = grub_malloc (max_glyph_size); -+ if (grub_mul (cur_glyph_size, 2, &max_glyph_size)) -+ max_glyph_size = 0; -+ glyph = max_glyph_size > 0 ? grub_malloc (max_glyph_size) : NULL; - } - if (!glyph) - { -+ max_glyph_size = 0; - grub_errno = GRUB_ERR_NONE; - return main_glyph; - } - -- grub_memset (glyph, 0, sizeof (*glyph) -- + (bounds.width * bounds.height -- + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT); -+ grub_memset (glyph, 0, cur_glyph_size); - - glyph->font = main_glyph->font; -- glyph->width = bounds.width; -- glyph->height = bounds.height; -- glyph->offset_x = bounds.x; -- glyph->offset_y = bounds.y; -+ if (bounds.width == 0 || bounds.height == 0 || -+ grub_cast (bounds.width, &glyph->width) || -+ grub_cast (bounds.height, &glyph->height) || -+ grub_cast (bounds.x, &glyph->offset_x) || -+ grub_cast (bounds.y, &glyph->offset_y)) -+ return main_glyph; - - if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR) - grub_font_blit_glyph_mirror (glyph, main_glyph, diff --git a/0282-font-Remove-grub_font_dup_glyph.patch b/0282-font-Remove-grub_font_dup_glyph.patch deleted file mode 100644 index 4c3db923..00000000 --- a/0282-font-Remove-grub_font_dup_glyph.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Fri, 5 Aug 2022 02:13:29 +0800 -Subject: [PATCH] font: Remove grub_font_dup_glyph() - -Remove grub_font_dup_glyph() since nobody is using it since 2013, and -I'm too lazy to fix the integer overflow problem in it. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 25ad31c19c331aaa2dbd9bd2b2e2655de5766a9d) ---- - grub-core/font/font.c | 14 -------------- - 1 file changed, 14 deletions(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 1fa181d4ca..a115a63b0c 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -1055,20 +1055,6 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code) - return best_glyph; - } - --#if 0 --static struct grub_font_glyph * --grub_font_dup_glyph (struct grub_font_glyph *glyph) --{ -- static struct grub_font_glyph *ret; -- ret = grub_malloc (sizeof (*ret) + (glyph->width * glyph->height + 7) / 8); -- if (!ret) -- return NULL; -- grub_memcpy (ret, glyph, sizeof (*ret) -- + (glyph->width * glyph->height + 7) / 8); -- return ret; --} --#endif -- - /* FIXME: suboptimal. */ - static void - grub_font_blit_glyph (struct grub_font_glyph *target, diff --git a/0283-font-Fix-integer-overflow-in-ensure_comb_space.patch b/0283-font-Fix-integer-overflow-in-ensure_comb_space.patch deleted file mode 100644 index 6b73038d..00000000 --- a/0283-font-Fix-integer-overflow-in-ensure_comb_space.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Fri, 5 Aug 2022 02:27:05 +0800 -Subject: [PATCH] font: Fix integer overflow in ensure_comb_space() - -In fact it can't overflow at all because glyph_id->ncomb is only 8-bit -wide. But let's keep safe if somebody changes the width of glyph_id->ncomb -in the future. This patch also fixes the inconsistency between -render_max_comb_glyphs and render_combining_glyphs when grub_malloc() -returns NULL. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit b2740b7e4a03bb8331d48b54b119afea76bb9d5f) ---- - grub-core/font/font.c | 14 +++++++++----- - 1 file changed, 9 insertions(+), 5 deletions(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index a115a63b0c..d0e6340404 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -1468,14 +1468,18 @@ ensure_comb_space (const struct grub_unicode_glyph *glyph_id) - if (glyph_id->ncomb <= render_max_comb_glyphs) - return; - -- render_max_comb_glyphs = 2 * glyph_id->ncomb; -- if (render_max_comb_glyphs < 8) -+ if (grub_mul (glyph_id->ncomb, 2, &render_max_comb_glyphs)) -+ render_max_comb_glyphs = 0; -+ if (render_max_comb_glyphs > 0 && render_max_comb_glyphs < 8) - render_max_comb_glyphs = 8; - grub_free (render_combining_glyphs); -- render_combining_glyphs = grub_malloc (render_max_comb_glyphs -- * sizeof (render_combining_glyphs[0])); -+ render_combining_glyphs = (render_max_comb_glyphs > 0) ? -+ grub_calloc (render_max_comb_glyphs, sizeof (render_combining_glyphs[0])) : NULL; - if (!render_combining_glyphs) -- grub_errno = 0; -+ { -+ render_max_comb_glyphs = 0; -+ grub_errno = GRUB_ERR_NONE; -+ } - } - - int diff --git a/0284-font-Fix-integer-overflow-in-BMP-index.patch b/0284-font-Fix-integer-overflow-in-BMP-index.patch deleted file mode 100644 index 5e106991..00000000 --- a/0284-font-Fix-integer-overflow-in-BMP-index.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Mon, 15 Aug 2022 02:04:58 +0800 -Subject: [PATCH] font: Fix integer overflow in BMP index - -The BMP index (font->bmp_idx) is designed as a reverse lookup table of -char entries (font->char_index), in order to speed up lookups for BMP -chars (i.e. code < 0x10000). The values in BMP index are the subscripts -of the corresponding char entries, stored in grub_uint16_t, while 0xffff -means not found. - -This patch fixes the problem of large subscript truncated to grub_uint16_t, -leading BMP index to return wrong char entry or report false miss. The -code now checks for bounds and uses BMP index as a hint, and fallbacks -to binary-search if necessary. - -On the occasion add a comment about BMP index is initialized to 0xffff. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit afda8b60ba0712abe01ae1e64c5f7a067a0e6492) ---- - grub-core/font/font.c | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index d0e6340404..b208a28717 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -300,6 +300,8 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct - font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t)); - if (!font->bmp_idx) - return 1; -+ -+ /* Init the BMP index array to 0xffff. */ - grub_memset (font->bmp_idx, 0xff, 0x10000 * sizeof (grub_uint16_t)); - - -@@ -328,7 +330,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct - return 1; - } - -- if (entry->code < 0x10000) -+ if (entry->code < 0x10000 && i < 0xffff) - font->bmp_idx[entry->code] = i; - - last_code = entry->code; -@@ -696,9 +698,12 @@ find_glyph (const grub_font_t font, grub_uint32_t code) - /* Use BMP index if possible. */ - if (code < 0x10000 && font->bmp_idx) - { -- if (font->bmp_idx[code] == 0xffff) -- return 0; -- return &table[font->bmp_idx[code]]; -+ if (font->bmp_idx[code] < 0xffff) -+ return &table[font->bmp_idx[code]]; -+ /* -+ * When we are here then lookup in BMP index result in miss, -+ * fallthough to binary-search. -+ */ - } - - /* Do a binary search in `char_index', which is ordered by code point. */ diff --git a/0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch b/0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch deleted file mode 100644 index e81824ba..00000000 --- a/0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Sun, 14 Aug 2022 18:09:38 +0800 -Subject: [PATCH] font: Fix integer underflow in binary search of char index - -If search target is less than all entries in font->index then "hi" -variable is set to -1, which translates to SIZE_MAX and leads to errors. - -This patch fixes the problem by replacing the entire binary search code -with the libstdc++'s std::lower_bound() implementation. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit c140a086838e7c9af87842036f891b8393a8c4bc) ---- - grub-core/font/font.c | 40 ++++++++++++++++++++++------------------ - 1 file changed, 22 insertions(+), 18 deletions(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index b208a28717..193dfec045 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -688,12 +688,12 @@ read_be_int16 (grub_file_t file, grub_int16_t * value) - static inline struct char_index_entry * - find_glyph (const grub_font_t font, grub_uint32_t code) - { -- struct char_index_entry *table; -- grub_size_t lo; -- grub_size_t hi; -- grub_size_t mid; -+ struct char_index_entry *table, *first, *end; -+ grub_size_t len; - - table = font->char_index; -+ if (table == NULL) -+ return NULL; - - /* Use BMP index if possible. */ - if (code < 0x10000 && font->bmp_idx) -@@ -706,25 +706,29 @@ find_glyph (const grub_font_t font, grub_uint32_t code) - */ - } - -- /* Do a binary search in `char_index', which is ordered by code point. */ -- lo = 0; -- hi = font->num_chars - 1; -+ /* -+ * Do a binary search in char_index which is ordered by code point. -+ * The code below is the same as libstdc++'s std::lower_bound(). -+ */ -+ first = table; -+ len = font->num_chars; -+ end = first + len; - -- if (!table) -- return 0; -- -- while (lo <= hi) -+ while (len > 0) - { -- mid = lo + (hi - lo) / 2; -- if (code < table[mid].code) -- hi = mid - 1; -- else if (code > table[mid].code) -- lo = mid + 1; -+ grub_size_t half = len >> 1; -+ struct char_index_entry *middle = first + half; -+ -+ if (middle->code < code) -+ { -+ first = middle + 1; -+ len = len - half - 1; -+ } - else -- return &table[mid]; -+ len = half; - } - -- return 0; -+ return (first < end && first->code == code) ? first : NULL; - } - - /* Get a glyph for the Unicode character CODE in FONT. The glyph is loaded diff --git a/0286-kern-efi-sb-Enforce-verification-of-font-files.patch b/0286-kern-efi-sb-Enforce-verification-of-font-files.patch deleted file mode 100644 index 1a381b0d..00000000 --- a/0286-kern-efi-sb-Enforce-verification-of-font-files.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Sun, 14 Aug 2022 15:51:54 +0800 -Subject: [PATCH] kern/efi/sb: Enforce verification of font files - -As a mitigation and hardening measure enforce verification of font -files. Then only trusted font files can be load. This will reduce the -attack surface at cost of losing the ability of end-users to customize -fonts if e.g. UEFI Secure Boot is enabled. Vendors can always customize -fonts because they have ability to pack fonts into their GRUB bundles. - -This goal is achieved by: - - * Removing GRUB_FILE_TYPE_FONT from shim lock verifier's - skip-verification list. - - * Adding GRUB_FILE_TYPE_FONT to lockdown verifier's defer-auth list, - so font files must be verified by a verifier before they can be loaded. - -Suggested-by: Daniel Kiper -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 630deb8c0d8b02b670ced4b7030414bcf17aa080) ---- - grub-core/kern/efi/sb.c | 1 - - grub-core/kern/lockdown.c | 1 + - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c -index 89c4bb3fd1..db42c2539f 100644 ---- a/grub-core/kern/efi/sb.c -+++ b/grub-core/kern/efi/sb.c -@@ -145,7 +145,6 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)), - case GRUB_FILE_TYPE_PRINT_BLOCKLIST: - case GRUB_FILE_TYPE_TESTLOAD: - case GRUB_FILE_TYPE_GET_SIZE: -- case GRUB_FILE_TYPE_FONT: - case GRUB_FILE_TYPE_ZFS_ENCRYPTION_KEY: - case GRUB_FILE_TYPE_CAT: - case GRUB_FILE_TYPE_HEXCAT: -diff --git a/grub-core/kern/lockdown.c b/grub-core/kern/lockdown.c -index 0bc70fd42d..af6d493cd3 100644 ---- a/grub-core/kern/lockdown.c -+++ b/grub-core/kern/lockdown.c -@@ -51,6 +51,7 @@ lockdown_verifier_init (grub_file_t io __attribute__ ((unused)), - case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE: - case GRUB_FILE_TYPE_ACPI_TABLE: - case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE: -+ case GRUB_FILE_TYPE_FONT: - *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH; - - /* Fall through. */ diff --git a/0287-fbutil-Fix-integer-overflow.patch b/0287-fbutil-Fix-integer-overflow.patch deleted file mode 100644 index 4d32dbda..00000000 --- a/0287-fbutil-Fix-integer-overflow.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Tue, 6 Sep 2022 03:03:21 +0800 -Subject: [PATCH] fbutil: Fix integer overflow - -Expressions like u64 = u32 * u32 are unsafe because their products are -truncated to u32 even if left hand side is u64. This patch fixes all -problems like that one in fbutil. - -To get right result not only left hand side have to be u64 but it's also -necessary to cast at least one of the operands of all leaf operators of -right hand side to u64, e.g. u64 = u32 * u32 + u32 * u32 should be -u64 = (u64)u32 * u32 + (u64)u32 * u32. - -For 1-bit bitmaps grub_uint64_t have to be used. It's safe because any -combination of values in (grub_uint64_t)u32 * u32 + u32 expression will -not overflow grub_uint64_t. - -Other expressions like ptr + u32 * u32 + u32 * u32 are also vulnerable. -They should be ptr + (grub_addr_t)u32 * u32 + (grub_addr_t)u32 * u32. - -This patch also adds a comment to grub_video_fb_get_video_ptr() which -says it's arguments must be valid and no sanity check is performed -(like its siblings in grub-core/video/fb/fbutil.c). - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 50a11a81bc842c58962244a2dc86bbd31a426e12) ---- - grub-core/video/fb/fbutil.c | 4 ++-- - include/grub/fbutil.h | 13 +++++++++---- - 2 files changed, 11 insertions(+), 6 deletions(-) - -diff --git a/grub-core/video/fb/fbutil.c b/grub-core/video/fb/fbutil.c -index b98bb51fe8..25ef39f47d 100644 ---- a/grub-core/video/fb/fbutil.c -+++ b/grub-core/video/fb/fbutil.c -@@ -67,7 +67,7 @@ get_pixel (struct grub_video_fbblit_info *source, - case 1: - if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED) - { -- int bit_index = y * source->mode_info->width + x; -+ grub_uint64_t bit_index = (grub_uint64_t) y * source->mode_info->width + x; - grub_uint8_t *ptr = source->data + bit_index / 8; - int bit_pos = 7 - bit_index % 8; - color = (*ptr >> bit_pos) & 0x01; -@@ -138,7 +138,7 @@ set_pixel (struct grub_video_fbblit_info *source, - case 1: - if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED) - { -- int bit_index = y * source->mode_info->width + x; -+ grub_uint64_t bit_index = (grub_uint64_t) y * source->mode_info->width + x; - grub_uint8_t *ptr = source->data + bit_index / 8; - int bit_pos = 7 - bit_index % 8; - *ptr = (*ptr & ~(1 << bit_pos)) | ((color & 0x01) << bit_pos); -diff --git a/include/grub/fbutil.h b/include/grub/fbutil.h -index 4205eb917f..78a1ab3b45 100644 ---- a/include/grub/fbutil.h -+++ b/include/grub/fbutil.h -@@ -31,14 +31,19 @@ struct grub_video_fbblit_info - grub_uint8_t *data; - }; - --/* Don't use for 1-bit bitmaps, addressing needs to be done at the bit level -- and it doesn't make sense, in general, to ask for a pointer -- to a particular pixel's data. */ -+/* -+ * Don't use for 1-bit bitmaps, addressing needs to be done at the bit level -+ * and it doesn't make sense, in general, to ask for a pointer -+ * to a particular pixel's data. -+ * -+ * This function assumes that bounds checking has been done in previous phase -+ * and they are opted out in here. -+ */ - static inline void * - grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source, - unsigned int x, unsigned int y) - { -- return source->data + y * source->mode_info->pitch + x * source->mode_info->bytes_per_pixel; -+ return source->data + (grub_addr_t) y * source->mode_info->pitch + (grub_addr_t) x * source->mode_info->bytes_per_pixel; - } - - /* Advance pointer by VAL bytes. If there is no unaligned access available, diff --git a/0288-font-Fix-an-integer-underflow-in-blit_comb.patch b/0288-font-Fix-an-integer-underflow-in-blit_comb.patch deleted file mode 100644 index 72f4308e..00000000 --- a/0288-font-Fix-an-integer-underflow-in-blit_comb.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Mon, 24 Oct 2022 08:05:35 +0800 -Subject: [PATCH] font: Fix an integer underflow in blit_comb() - -The expression (ctx.bounds.height - combining_glyphs[i]->height) / 2 may -evaluate to a very big invalid value even if both ctx.bounds.height and -combining_glyphs[i]->height are small integers. For example, if -ctx.bounds.height is 10 and combining_glyphs[i]->height is 12, this -expression evaluates to 2147483647 (expected -1). This is because -coordinates are allowed to be negative but ctx.bounds.height is an -unsigned int. So, the subtraction operates on unsigned ints and -underflows to a very big value. The division makes things even worse. -The quotient is still an invalid value even if converted back to int. - -This patch fixes the problem by casting ctx.bounds.height to int. As -a result the subtraction will operate on int and grub_uint16_t which -will be promoted to an int. So, the underflow will no longer happen. Other -uses of ctx.bounds.height (and ctx.bounds.width) are also casted to int, -to ensure coordinates are always calculated on signed integers. - -Fixes: CVE-2022-3775 - -Reported-by: Daniel Axtens -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 6d2668dea3774ed74c4cd1eadd146f1b846bc3d4) ---- - grub-core/font/font.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 193dfec045..12a5f0d08c 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -1203,12 +1203,12 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, - ctx.bounds.height = main_glyph->height; - - above_rightx = main_glyph->offset_x + main_glyph->width; -- above_righty = ctx.bounds.y + ctx.bounds.height; -+ above_righty = ctx.bounds.y + (int) ctx.bounds.height; - - above_leftx = main_glyph->offset_x; -- above_lefty = ctx.bounds.y + ctx.bounds.height; -+ above_lefty = ctx.bounds.y + (int) ctx.bounds.height; - -- below_rightx = ctx.bounds.x + ctx.bounds.width; -+ below_rightx = ctx.bounds.x + (int) ctx.bounds.width; - below_righty = ctx.bounds.y; - - comb = grub_unicode_get_comb (glyph_id); -@@ -1221,7 +1221,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, - - if (!combining_glyphs[i]) - continue; -- targetx = (ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x; -+ targetx = ((int) ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x; - /* CGJ is to avoid diacritics reordering. */ - if (comb[i].code - == GRUB_UNICODE_COMBINING_GRAPHEME_JOINER) -@@ -1231,8 +1231,8 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, - case GRUB_UNICODE_COMB_OVERLAY: - do_blit (combining_glyphs[i], - targetx, -- (ctx.bounds.height - combining_glyphs[i]->height) / 2 -- - (ctx.bounds.height + ctx.bounds.y), &ctx); -+ ((int) ctx.bounds.height - combining_glyphs[i]->height) / 2 -+ - ((int) ctx.bounds.height + ctx.bounds.y), &ctx); - if (min_devwidth < combining_glyphs[i]->width) - min_devwidth = combining_glyphs[i]->width; - break; -@@ -1305,7 +1305,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, - /* Fallthrough. */ - case GRUB_UNICODE_STACK_ATTACHED_ABOVE: - do_blit (combining_glyphs[i], targetx, -- -(ctx.bounds.height + ctx.bounds.y + space -+ -((int) ctx.bounds.height + ctx.bounds.y + space - + combining_glyphs[i]->height), &ctx); - if (min_devwidth < combining_glyphs[i]->width) - min_devwidth = combining_glyphs[i]->width; -@@ -1313,7 +1313,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, - - case GRUB_UNICODE_COMB_HEBREW_DAGESH: - do_blit (combining_glyphs[i], targetx, -- -(ctx.bounds.height / 2 + ctx.bounds.y -+ -((int) ctx.bounds.height / 2 + ctx.bounds.y - + combining_glyphs[i]->height / 2), &ctx); - if (min_devwidth < combining_glyphs[i]->width) - min_devwidth = combining_glyphs[i]->width; diff --git a/0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch b/0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch deleted file mode 100644 index 5207c128..00000000 --- a/0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Mon, 24 Oct 2022 07:15:41 +0800 -Subject: [PATCH] font: Harden grub_font_blit_glyph() and - grub_font_blit_glyph_mirror() - -As a mitigation and hardening measure add sanity checks to -grub_font_blit_glyph() and grub_font_blit_glyph_mirror(). This patch -makes these two functions do nothing if target blitting area isn't fully -contained in target bitmap. Therefore, if complex calculations in caller -overflows and malicious coordinates are given, we are still safe because -any coordinates which result in out-of-bound-write are rejected. However, -this patch only checks for invalid coordinates, and doesn't provide any -protection against invalid source glyph or destination glyph, e.g. -mismatch between glyph size and buffer size. - -This hardening measure is designed to mitigate possible overflows in -blit_comb(). If overflow occurs, it may return invalid bounding box -during dry run and call grub_font_blit_glyph() with malicious -coordinates during actual blitting. However, we are still safe because -the scratch glyph itself is valid, although its size makes no sense, and -any invalid coordinates are rejected. - -It would be better to call grub_fatal() if illegal parameter is detected. -However, doing this may end up in a dangerous recursion because grub_fatal() -would print messages to the screen and we are in the progress of drawing -characters on the screen. - -Reported-by: Daniel Axtens -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit fcd7aa0c278f7cf3fb9f93f1a3966e1792339eb6) ---- - grub-core/font/font.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 12a5f0d08c..29fbb94294 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -1069,8 +1069,15 @@ static void - grub_font_blit_glyph (struct grub_font_glyph *target, - struct grub_font_glyph *src, unsigned dx, unsigned dy) - { -+ grub_uint16_t max_x, max_y; - unsigned src_bit, tgt_bit, src_byte, tgt_byte; - unsigned i, j; -+ -+ /* Harden against out-of-bound writes. */ -+ if ((grub_add (dx, src->width, &max_x) || max_x > target->width) || -+ (grub_add (dy, src->height, &max_y) || max_y > target->height)) -+ return; -+ - for (i = 0; i < src->height; i++) - { - src_bit = (src->width * i) % 8; -@@ -1102,9 +1109,16 @@ grub_font_blit_glyph_mirror (struct grub_font_glyph *target, - struct grub_font_glyph *src, - unsigned dx, unsigned dy) - { -+ grub_uint16_t max_x, max_y; - unsigned tgt_bit, src_byte, tgt_byte; - signed src_bit; - unsigned i, j; -+ -+ /* Harden against out-of-bound writes. */ -+ if ((grub_add (dx, src->width, &max_x) || max_x > target->width) || -+ (grub_add (dy, src->height, &max_y) || max_y > target->height)) -+ return; -+ - for (i = 0; i < src->height; i++) - { - src_bit = (src->width * i + src->width - 1) % 8; diff --git a/0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch b/0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch deleted file mode 100644 index c2bcc18f..00000000 --- a/0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Fri, 28 Oct 2022 17:29:16 +0800 -Subject: [PATCH] font: Assign null_font to glyphs in ascii_font_glyph[] - -The calculations in blit_comb() need information from glyph's font, e.g. -grub_font_get_xheight(main_glyph->font). However, main_glyph->font is -NULL if main_glyph comes from ascii_font_glyph[]. Therefore -grub_font_get_*() crashes because of NULL pointer. - -There is already a solution, the null_font. So, assign it to those glyphs -in ascii_font_glyph[]. - -Reported-by: Daniel Axtens -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit dd539d695482069d28b40f2d3821f710cdcf6ee6) ---- - grub-core/font/font.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index 29fbb94294..e6616e610c 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -137,7 +137,7 @@ ascii_glyph_lookup (grub_uint32_t code) - ascii_font_glyph[current]->offset_x = 0; - ascii_font_glyph[current]->offset_y = -2; - ascii_font_glyph[current]->device_width = 8; -- ascii_font_glyph[current]->font = NULL; -+ ascii_font_glyph[current]->font = &null_font; - - grub_memcpy (ascii_font_glyph[current]->bitmap, - &ascii_bitmaps[current * ASCII_BITMAP_SIZE], diff --git a/0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch b/0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch deleted file mode 100644 index ec2184f0..00000000 --- a/0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Fri, 28 Oct 2022 21:31:39 +0800 -Subject: [PATCH] normal/charset: Fix an integer overflow in - grub_unicode_aglomerate_comb() - -The out->ncomb is a bit-field of 8 bits. So, the max possible value is 255. -However, code in grub_unicode_aglomerate_comb() doesn't check for an -overflow when incrementing out->ncomb. If out->ncomb is already 255, -after incrementing it will get 0 instead of 256, and cause illegal -memory access in subsequent processing. - -This patch introduces GRUB_UNICODE_NCOMB_MAX to represent the max -acceptable value of ncomb. The code now checks for this limit and -ignores additional combining characters when limit is reached. - -Reported-by: Daniel Axtens -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit da90d62316a3b105d2fbd7334d6521936bd6dcf6) ---- - grub-core/normal/charset.c | 3 +++ - include/grub/unicode.h | 2 ++ - 2 files changed, 5 insertions(+) - -diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c -index 7a5a7c153c..c243ca6dae 100644 ---- a/grub-core/normal/charset.c -+++ b/grub-core/normal/charset.c -@@ -472,6 +472,9 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, - if (!haveout) - continue; - -+ if (out->ncomb == GRUB_UNICODE_NCOMB_MAX) -+ continue; -+ - if (comb_type == GRUB_UNICODE_COMB_MC - || comb_type == GRUB_UNICODE_COMB_ME - || comb_type == GRUB_UNICODE_COMB_MN) -diff --git a/include/grub/unicode.h b/include/grub/unicode.h -index 4de986a857..c4f6fca043 100644 ---- a/include/grub/unicode.h -+++ b/include/grub/unicode.h -@@ -147,7 +147,9 @@ struct grub_unicode_glyph - grub_uint8_t bidi_level:6; /* minimum: 6 */ - enum grub_bidi_type bidi_type:5; /* minimum: :5 */ - -+#define GRUB_UNICODE_NCOMB_MAX ((1 << 8) - 1) - unsigned ncomb:8; -+ - /* Hint by unicode subsystem how wide this character usually is. - Real width is determined by font. Set only in UTF-8 stream. */ - int estimated_width:8; diff --git a/0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch b/0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch deleted file mode 100644 index bad9d903..00000000 --- a/0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chris Coulson -Date: Wed, 16 Nov 2022 14:40:04 +0000 -Subject: [PATCH] font: Try opening fonts from the bundled memdisk - -Signed-off-by: Robbie Harwood ---- - grub-core/font/font.c | 48 +++++++++++++++++++++++++++++++----------------- - 1 file changed, 31 insertions(+), 17 deletions(-) - -diff --git a/grub-core/font/font.c b/grub-core/font/font.c -index e6616e610c..e421d1ae6f 100644 ---- a/grub-core/font/font.c -+++ b/grub-core/font/font.c -@@ -409,6 +409,27 @@ read_section_as_short (struct font_file_section *section, - return 0; - } - -+static grub_file_t -+try_open_from_prefix (const char *prefix, const char *filename) -+{ -+ grub_file_t file; -+ char *fullname, *ptr; -+ -+ fullname = grub_malloc (grub_strlen (prefix) + grub_strlen (filename) + 1 -+ + sizeof ("/fonts/") + sizeof (".pf2")); -+ if (!fullname) -+ return 0; -+ ptr = grub_stpcpy (fullname, prefix); -+ ptr = grub_stpcpy (ptr, "/fonts/"); -+ ptr = grub_stpcpy (ptr, filename); -+ ptr = grub_stpcpy (ptr, ".pf2"); -+ *ptr = 0; -+ -+ file = grub_buffile_open (fullname, GRUB_FILE_TYPE_FONT, 1024); -+ grub_free (fullname); -+ return file; -+} -+ - /* Load a font and add it to the beginning of the global font list. - Returns 0 upon success, nonzero upon failure. */ - grub_font_t -@@ -427,25 +448,18 @@ grub_font_load (const char *filename) - file = grub_buffile_open (filename, GRUB_FILE_TYPE_FONT, 1024); - else - { -- const char *prefix = grub_env_get ("prefix"); -- char *fullname, *ptr; -- if (!prefix) -+ file = try_open_from_prefix ("(memdisk)", filename); -+ if (!file) - { -- grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), -- "prefix"); -- goto fail; -+ const char *prefix = grub_env_get ("prefix"); -+ if (!prefix) -+ { -+ grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), -+ "prefix"); -+ goto fail; -+ } -+ file = try_open_from_prefix (prefix, filename); - } -- fullname = grub_malloc (grub_strlen (prefix) + grub_strlen (filename) + 1 -- + sizeof ("/fonts/") + sizeof (".pf2")); -- if (!fullname) -- goto fail; -- ptr = grub_stpcpy (fullname, prefix); -- ptr = grub_stpcpy (ptr, "/fonts/"); -- ptr = grub_stpcpy (ptr, filename); -- ptr = grub_stpcpy (ptr, ".pf2"); -- *ptr = 0; -- file = grub_buffile_open (fullname, GRUB_FILE_TYPE_FONT, 1024); -- grub_free (fullname); - } - if (!file) - goto fail; diff --git a/0293-mm-Clarify-grub_real_malloc.patch b/0293-mm-Clarify-grub_real_malloc.patch deleted file mode 100644 index 0a99c081..00000000 --- a/0293-mm-Clarify-grub_real_malloc.patch +++ /dev/null @@ -1,183 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 25 Nov 2021 02:22:46 +1100 -Subject: [PATCH] mm: Clarify grub_real_malloc() - -When iterating through the singly linked list of free blocks, -grub_real_malloc() uses p and q for the current and previous blocks -respectively. This isn't super clear, so swap to using prev and cur. - -This makes another quirk more obvious. The comment at the top of -grub_real_malloc() might lead you to believe that the function will -allocate from *first if there is space in that block. - -It actually doesn't do that, and it can't do that with the current -data structures. If we used up all of *first, we would need to change -the ->next of the previous block to point to *first->next, but we -can't do that because it's a singly linked list and we don't have -access to *first's previous block. - -What grub_real_malloc() actually does is set *first to the initial -previous block, and *first->next is the block we try to allocate -from. That allows us to keep all the data structures consistent. - -Document that. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 246ad6a44c281bb13486ddea0a26bb661db73106) ---- - grub-core/kern/mm.c | 76 +++++++++++++++++++++++++++++------------------------ - 1 file changed, 41 insertions(+), 35 deletions(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index d8c8377578..fb20e93acf 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -178,13 +178,20 @@ grub_mm_init_region (void *addr, grub_size_t size) - } - - /* Allocate the number of units N with the alignment ALIGN from the ring -- buffer starting from *FIRST. ALIGN must be a power of two. Both N and -- ALIGN are in units of GRUB_MM_ALIGN. Return a non-NULL if successful, -- otherwise return NULL. */ -+ * buffer given in *FIRST. ALIGN must be a power of two. Both N and -+ * ALIGN are in units of GRUB_MM_ALIGN. Return a non-NULL if successful, -+ * otherwise return NULL. -+ * -+ * Note: because in certain circumstances we need to adjust the ->next -+ * pointer of the previous block, we iterate over the singly linked -+ * list with the pair (prev, cur). *FIRST is our initial previous, and -+ * *FIRST->next is our initial current pointer. So we will actually -+ * allocate from *FIRST->next first and *FIRST itself last. -+ */ - static void * - grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) - { -- grub_mm_header_t p, q; -+ grub_mm_header_t cur, prev; - - /* When everything is allocated side effect is that *first will have alloc - magic marked, meaning that there is no room in this region. */ -@@ -192,24 +199,24 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) - return 0; - - /* Try to search free slot for allocation in this memory region. */ -- for (q = *first, p = q->next; ; q = p, p = p->next) -+ for (prev = *first, cur = prev->next; ; prev = cur, cur = cur->next) - { - grub_off_t extra; - -- extra = ((grub_addr_t) (p + 1) >> GRUB_MM_ALIGN_LOG2) & (align - 1); -+ extra = ((grub_addr_t) (cur + 1) >> GRUB_MM_ALIGN_LOG2) & (align - 1); - if (extra) - extra = align - extra; - -- if (! p) -+ if (! cur) - grub_fatal ("null in the ring"); - -- if (p->magic != GRUB_MM_FREE_MAGIC) -- grub_fatal ("free magic is broken at %p: 0x%x", p, p->magic); -+ if (cur->magic != GRUB_MM_FREE_MAGIC) -+ grub_fatal ("free magic is broken at %p: 0x%x", cur, cur->magic); - -- if (p->size >= n + extra) -+ if (cur->size >= n + extra) - { -- extra += (p->size - extra - n) & (~(align - 1)); -- if (extra == 0 && p->size == n) -+ extra += (cur->size - extra - n) & (~(align - 1)); -+ if (extra == 0 && cur->size == n) - { - /* There is no special alignment requirement and memory block - is complete match. -@@ -222,9 +229,9 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) - | alloc, size=n | | - +---------------+ v - */ -- q->next = p->next; -+ prev->next = cur->next; - } -- else if (align == 1 || p->size == n + extra) -+ else if (align == 1 || cur->size == n + extra) - { - /* There might be alignment requirement, when taking it into - account memory block fits in. -@@ -241,23 +248,22 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) - | alloc, size=n | | - +---------------+ v - */ -- -- p->size -= n; -- p += p->size; -+ cur->size -= n; -+ cur += cur->size; - } - else if (extra == 0) - { - grub_mm_header_t r; - -- r = p + extra + n; -+ r = cur + extra + n; - r->magic = GRUB_MM_FREE_MAGIC; -- r->size = p->size - extra - n; -- r->next = p->next; -- q->next = r; -+ r->size = cur->size - extra - n; -+ r->next = cur->next; -+ prev->next = r; - -- if (q == p) -+ if (prev == cur) - { -- q = r; -+ prev = r; - r->next = r; - } - } -@@ -284,32 +290,32 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) - */ - grub_mm_header_t r; - -- r = p + extra + n; -+ r = cur + extra + n; - r->magic = GRUB_MM_FREE_MAGIC; -- r->size = p->size - extra - n; -- r->next = p; -+ r->size = cur->size - extra - n; -+ r->next = cur; - -- p->size = extra; -- q->next = r; -- p += extra; -+ cur->size = extra; -+ prev->next = r; -+ cur += extra; - } - -- p->magic = GRUB_MM_ALLOC_MAGIC; -- p->size = n; -+ cur->magic = GRUB_MM_ALLOC_MAGIC; -+ cur->size = n; - - /* Mark find as a start marker for next allocation to fasten it. - This will have side effect of fragmenting memory as small - pieces before this will be un-used. */ - /* So do it only for chunks under 64K. */ - if (n < (0x8000 >> GRUB_MM_ALIGN_LOG2) -- || *first == p) -- *first = q; -+ || *first == cur) -+ *first = prev; - -- return p + 1; -+ return cur + 1; - } - - /* Search was completed without result. */ -- if (p == *first) -+ if (cur == *first) - break; - } - diff --git a/0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch b/0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch deleted file mode 100644 index a5601c92..00000000 --- a/0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 25 Nov 2021 02:22:47 +1100 -Subject: [PATCH] mm: grub_real_malloc(): Make small allocs comment match code - -Small allocations move the region's *first pointer. The comment -says that this happens for allocations under 64K. The code says -it's for allocations under 32K. Commit 45bf8b3a7549 changed the -code intentionally: make the comment match. - -Fixes: 45bf8b3a7549 (* grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the) - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit a847895a8d000bdf27ad4d4326f883a0eed769ca) ---- - grub-core/kern/mm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index fb20e93acf..db7e0b2a5b 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -306,7 +306,7 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) - /* Mark find as a start marker for next allocation to fasten it. - This will have side effect of fragmenting memory as small - pieces before this will be un-used. */ -- /* So do it only for chunks under 64K. */ -+ /* So do it only for chunks under 32K. */ - if (n < (0x8000 >> GRUB_MM_ALIGN_LOG2) - || *first == cur) - *first = prev; diff --git a/0295-mm-Document-grub_free.patch b/0295-mm-Document-grub_free.patch deleted file mode 100644 index 6c9b7cc6..00000000 --- a/0295-mm-Document-grub_free.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 25 Nov 2021 02:22:48 +1100 -Subject: [PATCH] mm: Document grub_free() - -The grub_free() possesses a surprising number of quirks, and also -uses single-letter variable names confusingly to iterate through -the free list. - -Document what's going on. - -Use prev and cur to iterate over the free list. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 1f8d0b01738e49767d662d6426af3570a64565f0) ---- - grub-core/kern/mm.c | 63 ++++++++++++++++++++++++++++++++++------------------- - 1 file changed, 41 insertions(+), 22 deletions(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index db7e0b2a5b..0351171cf9 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -446,54 +446,73 @@ grub_free (void *ptr) - } - else - { -- grub_mm_header_t q, s; -+ grub_mm_header_t cur, prev; - - #if 0 -- q = r->first; -+ cur = r->first; - do - { - grub_printf ("%s:%d: q=%p, q->size=0x%x, q->magic=0x%x\n", -- GRUB_FILE, __LINE__, q, q->size, q->magic); -- q = q->next; -+ GRUB_FILE, __LINE__, cur, cur->size, cur->magic); -+ cur = cur->next; - } -- while (q != r->first); -+ while (cur != r->first); - #endif -- -- for (s = r->first, q = s->next; q <= p || q->next >= p; s = q, q = s->next) -+ /* Iterate over all blocks in the free ring. -+ * -+ * The free ring is arranged from high addresses to low -+ * addresses, modulo wraparound. -+ * -+ * We are looking for a block with a higher address than p or -+ * whose next address is lower than p. -+ */ -+ for (prev = r->first, cur = prev->next; cur <= p || cur->next >= p; -+ prev = cur, cur = prev->next) - { -- if (q->magic != GRUB_MM_FREE_MAGIC) -- grub_fatal ("free magic is broken at %p: 0x%x", q, q->magic); -+ if (cur->magic != GRUB_MM_FREE_MAGIC) -+ grub_fatal ("free magic is broken at %p: 0x%x", cur, cur->magic); - -- if (q <= q->next && (q > p || q->next < p)) -+ /* Deal with wrap-around */ -+ if (cur <= cur->next && (cur > p || cur->next < p)) - break; - } - -+ /* mark p as free and insert it between cur and cur->next */ - p->magic = GRUB_MM_FREE_MAGIC; -- p->next = q->next; -- q->next = p; -+ p->next = cur->next; -+ cur->next = p; - -+ /* -+ * If the block we are freeing can be merged with the next -+ * free block, do that. -+ */ - if (p->next + p->next->size == p) - { - p->magic = 0; - - p->next->size += p->size; -- q->next = p->next; -+ cur->next = p->next; - p = p->next; - } - -- r->first = q; -+ r->first = cur; - -- if (q == p + p->size) -+ /* Likewise if can be merged with the preceeding free block */ -+ if (cur == p + p->size) - { -- q->magic = 0; -- p->size += q->size; -- if (q == s) -- s = p; -- s->next = p; -- q = s; -+ cur->magic = 0; -+ p->size += cur->size; -+ if (cur == prev) -+ prev = p; -+ prev->next = p; -+ cur = prev; - } - -- r->first = q; -+ /* -+ * Set r->first such that the just free()d block is tried first. -+ * (An allocation is tried from *first->next, and cur->next == p.) -+ */ -+ r->first = cur; - } - } - diff --git a/0296-mm-Document-grub_mm_init_region.patch b/0296-mm-Document-grub_mm_init_region.patch deleted file mode 100644 index 0173f045..00000000 --- a/0296-mm-Document-grub_mm_init_region.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 25 Nov 2021 02:22:49 +1100 -Subject: [PATCH] mm: Document grub_mm_init_region() - -The grub_mm_init_region() does some things that seem magical, especially -around region merging. Make it a bit clearer. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 246d69b7ea619fc1e77dcc5960e37aea45a9808c) ---- - grub-core/kern/mm.c | 31 ++++++++++++++++++++++++++++++- - 1 file changed, 30 insertions(+), 1 deletion(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index 0351171cf9..1cbf98c7ab 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -128,23 +128,52 @@ grub_mm_init_region (void *addr, grub_size_t size) - if (((grub_addr_t) addr + 0x1000) > ~(grub_addr_t) size) - size = ((grub_addr_t) -0x1000) - (grub_addr_t) addr; - -+ /* Attempt to merge this region with every existing region */ - for (p = &grub_mm_base, q = *p; q; p = &(q->next), q = *p) -+ /* -+ * Is the new region immediately below an existing region? That -+ * is, is the address of the memory we're adding now (addr) + size -+ * of the memory we're adding (size) + the bytes we couldn't use -+ * at the start of the region we're considering (q->pre_size) -+ * equal to the address of q? In other words, does the memory -+ * looks like this? -+ * -+ * addr q -+ * |----size-----|-q->pre_size-|| -+ */ - if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q) - { -+ /* -+ * Yes, we can merge the memory starting at addr into the -+ * existing region from below. Align up addr to GRUB_MM_ALIGN -+ * so that our new region has proper alignment. -+ */ - r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); -+ /* Copy the region data across */ - *r = *q; -+ /* Consider all the new size as pre-size */ - r->pre_size += size; -- -+ -+ /* -+ * If we have enough pre-size to create a block, create a -+ * block with it. Mark it as allocated and pass it to -+ * grub_free (), which will sort out getting it into the free -+ * list. -+ */ - if (r->pre_size >> GRUB_MM_ALIGN_LOG2) - { - h = (grub_mm_header_t) (r + 1); -+ /* block size is pre-size converted to cells */ - h->size = (r->pre_size >> GRUB_MM_ALIGN_LOG2); - h->magic = GRUB_MM_ALLOC_MAGIC; -+ /* region size grows by block size converted back to bytes */ - r->size += h->size << GRUB_MM_ALIGN_LOG2; -+ /* adjust pre_size to be accurate */ - r->pre_size &= (GRUB_MM_ALIGN - 1); - *p = r; - grub_free (h + 1); - } -+ /* Replace the old region with the new region */ - *p = r; - return; - } diff --git a/0297-mm-Document-GRUB-internal-memory-management-structur.patch b/0297-mm-Document-GRUB-internal-memory-management-structur.patch deleted file mode 100644 index c7939264..00000000 --- a/0297-mm-Document-GRUB-internal-memory-management-structur.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 25 Nov 2021 02:22:45 +1100 -Subject: [PATCH] mm: Document GRUB internal memory management structures - -I spent more than a trivial quantity of time figuring out pre_size and -whether a memory region's size contains the header cell or not. - -Document the meanings of all the properties. Hopefully now no-one else -has to figure it out! - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit a6c5c52ccffd2674d43db25fb4baa9c528526aa0) ---- - include/grub/mm_private.h | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - -diff --git a/include/grub/mm_private.h b/include/grub/mm_private.h -index c2c4cb1511..203533cc3d 100644 ---- a/include/grub/mm_private.h -+++ b/include/grub/mm_private.h -@@ -21,15 +21,27 @@ - - #include - -+/* For context, see kern/mm.c */ -+ - /* Magic words. */ - #define GRUB_MM_FREE_MAGIC 0x2d3c2808 - #define GRUB_MM_ALLOC_MAGIC 0x6db08fa4 - -+/* A header describing a block of memory - either allocated or free */ - typedef struct grub_mm_header - { -+ /* -+ * The 'next' free block in this region's circular free list. -+ * Only meaningful if the block is free. -+ */ - struct grub_mm_header *next; -+ /* The block size, not in bytes but the number of cells of -+ * GRUB_MM_ALIGN bytes. Includes the header cell. -+ */ - grub_size_t size; -+ /* either free or alloc magic, depending on the block type. */ - grub_size_t magic; -+ /* pad to cell size: see the top of kern/mm.c. */ - #if GRUB_CPU_SIZEOF_VOID_P == 4 - char padding[4]; - #elif GRUB_CPU_SIZEOF_VOID_P == 8 -@@ -48,11 +60,27 @@ typedef struct grub_mm_header - - #define GRUB_MM_ALIGN (1 << GRUB_MM_ALIGN_LOG2) - -+/* A region from which we can make allocations. */ - typedef struct grub_mm_region - { -+ /* The first free block in this region. */ - struct grub_mm_header *first; -+ -+ /* -+ * The next region in the linked list of regions. Regions are initially -+ * sorted in order of increasing size, but can grow, in which case the -+ * ordering may not be preserved. -+ */ - struct grub_mm_region *next; -+ -+ /* -+ * A grub_mm_region will always be aligned to cell size. The pre-size is -+ * the number of bytes we were given but had to skip in order to get that -+ * alignment. -+ */ - grub_size_t pre_size; -+ -+ /* How many bytes are in this region? (free and allocated) */ - grub_size_t size; - } - *grub_mm_region_t; diff --git a/0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch b/0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch deleted file mode 100644 index 2893784a..00000000 --- a/0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 21 Apr 2022 15:24:14 +1000 -Subject: [PATCH] mm: Assert that we preserve header vs region alignment - -grub_mm_region_init() does: - - h = (grub_mm_header_t) (r + 1); - -where h is a grub_mm_header_t and r is a grub_mm_region_t. - -Cells are supposed to be GRUB_MM_ALIGN aligned, but while grub_mm_dump -ensures this vs the region header, grub_mm_region_init() does not. - -It's better to be explicit than implicit here: rather than changing -grub_mm_region_init() to ALIGN_UP(), require that the struct is -explicitly a multiple of the header size. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 1df8fe66c57087eb33bd6dc69f786ed124615aa7) ---- - include/grub/mm_private.h | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/include/grub/mm_private.h b/include/grub/mm_private.h -index 203533cc3d..a688b92a83 100644 ---- a/include/grub/mm_private.h -+++ b/include/grub/mm_private.h -@@ -20,6 +20,7 @@ - #define GRUB_MM_PRIVATE_H 1 - - #include -+#include - - /* For context, see kern/mm.c */ - -@@ -89,4 +90,17 @@ typedef struct grub_mm_region - extern grub_mm_region_t EXPORT_VAR (grub_mm_base); - #endif - -+static inline void -+grub_mm_size_sanity_check (void) { -+ /* Ensure we preserve alignment when doing h = (grub_mm_header_t) (r + 1). */ -+ COMPILE_TIME_ASSERT ((sizeof (struct grub_mm_region) % -+ sizeof (struct grub_mm_header)) == 0); -+ -+ /* -+ * GRUB_MM_ALIGN is supposed to represent cell size, and a mm_header is -+ * supposed to be 1 cell. -+ */ -+ COMPILE_TIME_ASSERT (sizeof (struct grub_mm_header) == GRUB_MM_ALIGN); -+} -+ - #endif diff --git a/0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch b/0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch deleted file mode 100644 index 52cfeee0..00000000 --- a/0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch +++ /dev/null @@ -1,203 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 21 Apr 2022 15:24:15 +1000 -Subject: [PATCH] mm: When adding a region, merge with region after as well as - before - -On x86_64-efi (at least) regions seem to be added from top down. The mm -code will merge a new region with an existing region that comes -immediately before the new region. This allows larger allocations to be -satisfied that would otherwise be the case. - -On powerpc-ieee1275, however, regions are added from bottom up. So if -we add 3x 32MB regions, we can still only satisfy a 32MB allocation, -rather than the 96MB allocation we might otherwise be able to satisfy. - - * Define 'post_size' as being bytes lost to the end of an allocation - due to being given weird sizes from firmware that are not multiples - of GRUB_MM_ALIGN. - - * Allow merging of regions immediately _after_ existing regions, not - just before. As with the other approach, we create an allocated - block to represent the new space and the pass it to grub_free() to - get the metadata right. - -Signed-off-by: Daniel Axtens -Tested-by: Stefan Berger -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 052e6068be622ff53f1238b449c300dbd0a8abcd) ---- - grub-core/kern/mm.c | 128 +++++++++++++++++++++++++++++----------------- - include/grub/mm_private.h | 9 ++++ - 2 files changed, 91 insertions(+), 46 deletions(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index 1cbf98c7ab..7be33e23bf 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -130,53 +130,88 @@ grub_mm_init_region (void *addr, grub_size_t size) - - /* Attempt to merge this region with every existing region */ - for (p = &grub_mm_base, q = *p; q; p = &(q->next), q = *p) -- /* -- * Is the new region immediately below an existing region? That -- * is, is the address of the memory we're adding now (addr) + size -- * of the memory we're adding (size) + the bytes we couldn't use -- * at the start of the region we're considering (q->pre_size) -- * equal to the address of q? In other words, does the memory -- * looks like this? -- * -- * addr q -- * |----size-----|-q->pre_size-|| -- */ -- if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q) -- { -- /* -- * Yes, we can merge the memory starting at addr into the -- * existing region from below. Align up addr to GRUB_MM_ALIGN -- * so that our new region has proper alignment. -- */ -- r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); -- /* Copy the region data across */ -- *r = *q; -- /* Consider all the new size as pre-size */ -- r->pre_size += size; -+ { -+ /* -+ * Is the new region immediately below an existing region? That -+ * is, is the address of the memory we're adding now (addr) + size -+ * of the memory we're adding (size) + the bytes we couldn't use -+ * at the start of the region we're considering (q->pre_size) -+ * equal to the address of q? In other words, does the memory -+ * looks like this? -+ * -+ * addr q -+ * |----size-----|-q->pre_size-|| -+ */ -+ if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q) -+ { -+ /* -+ * Yes, we can merge the memory starting at addr into the -+ * existing region from below. Align up addr to GRUB_MM_ALIGN -+ * so that our new region has proper alignment. -+ */ -+ r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); -+ /* Copy the region data across */ -+ *r = *q; -+ /* Consider all the new size as pre-size */ -+ r->pre_size += size; - -- /* -- * If we have enough pre-size to create a block, create a -- * block with it. Mark it as allocated and pass it to -- * grub_free (), which will sort out getting it into the free -- * list. -- */ -- if (r->pre_size >> GRUB_MM_ALIGN_LOG2) -- { -- h = (grub_mm_header_t) (r + 1); -- /* block size is pre-size converted to cells */ -- h->size = (r->pre_size >> GRUB_MM_ALIGN_LOG2); -- h->magic = GRUB_MM_ALLOC_MAGIC; -- /* region size grows by block size converted back to bytes */ -- r->size += h->size << GRUB_MM_ALIGN_LOG2; -- /* adjust pre_size to be accurate */ -- r->pre_size &= (GRUB_MM_ALIGN - 1); -- *p = r; -- grub_free (h + 1); -- } -- /* Replace the old region with the new region */ -- *p = r; -- return; -- } -+ /* -+ * If we have enough pre-size to create a block, create a -+ * block with it. Mark it as allocated and pass it to -+ * grub_free (), which will sort out getting it into the free -+ * list. -+ */ -+ if (r->pre_size >> GRUB_MM_ALIGN_LOG2) -+ { -+ h = (grub_mm_header_t) (r + 1); -+ /* block size is pre-size converted to cells */ -+ h->size = (r->pre_size >> GRUB_MM_ALIGN_LOG2); -+ h->magic = GRUB_MM_ALLOC_MAGIC; -+ /* region size grows by block size converted back to bytes */ -+ r->size += h->size << GRUB_MM_ALIGN_LOG2; -+ /* adjust pre_size to be accurate */ -+ r->pre_size &= (GRUB_MM_ALIGN - 1); -+ *p = r; -+ grub_free (h + 1); -+ } -+ /* Replace the old region with the new region */ -+ *p = r; -+ return; -+ } -+ -+ /* -+ * Is the new region immediately above an existing region? That -+ * is: -+ * q addr -+ * ||-q->post_size-|----size-----| -+ */ -+ if ((grub_uint8_t *) q + sizeof (*q) + q->size + q->post_size == -+ (grub_uint8_t *) addr) -+ { -+ /* -+ * Yes! Follow a similar pattern to above, but simpler. -+ * Our header starts at address - post_size, which should align us -+ * to a cell boundary. -+ * -+ * Cast to (void *) first to avoid the following build error: -+ * kern/mm.c: In function ‘grub_mm_init_region’: -+ * kern/mm.c:211:15: error: cast increases required alignment of target type [-Werror=cast-align] -+ * 211 | h = (grub_mm_header_t) ((grub_uint8_t *) addr - q->post_size); -+ * | ^ -+ * It is safe to do that because proper alignment is enforced in grub_mm_size_sanity_check(). -+ */ -+ h = (grub_mm_header_t)(void *) ((grub_uint8_t *) addr - q->post_size); -+ /* our size is the allocated size plus post_size, in cells */ -+ h->size = (size + q->post_size) >> GRUB_MM_ALIGN_LOG2; -+ h->magic = GRUB_MM_ALLOC_MAGIC; -+ /* region size grows by block size converted back to bytes */ -+ q->size += h->size << GRUB_MM_ALIGN_LOG2; -+ /* adjust new post_size to be accurate */ -+ q->post_size = (q->post_size + size) & (GRUB_MM_ALIGN - 1); -+ grub_free (h + 1); -+ return; -+ } -+ } - - /* Allocate a region from the head. */ - r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); -@@ -195,6 +230,7 @@ grub_mm_init_region (void *addr, grub_size_t size) - r->first = h; - r->pre_size = (grub_addr_t) r - (grub_addr_t) addr; - r->size = (h->size << GRUB_MM_ALIGN_LOG2); -+ r->post_size = size - r->size; - - /* Find where to insert this region. Put a smaller one before bigger ones, - to prevent fragmentation. */ -diff --git a/include/grub/mm_private.h b/include/grub/mm_private.h -index a688b92a83..96c2d816be 100644 ---- a/include/grub/mm_private.h -+++ b/include/grub/mm_private.h -@@ -81,8 +81,17 @@ typedef struct grub_mm_region - */ - grub_size_t pre_size; - -+ /* -+ * Likewise, the post-size is the number of bytes we wasted at the end -+ * of the allocation because it wasn't a multiple of GRUB_MM_ALIGN -+ */ -+ grub_size_t post_size; -+ - /* How many bytes are in this region? (free and allocated) */ - grub_size_t size; -+ -+ /* pad to a multiple of cell size */ -+ char padding[3 * GRUB_CPU_SIZEOF_VOID_P]; - } - *grub_mm_region_t; - diff --git a/0300-mm-Debug-support-for-region-operations.patch b/0300-mm-Debug-support-for-region-operations.patch deleted file mode 100644 index f434260f..00000000 --- a/0300-mm-Debug-support-for-region-operations.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Thu, 21 Apr 2022 15:24:16 +1000 -Subject: [PATCH] mm: Debug support for region operations - -This is handy for debugging. Enable with "set debug=regions". - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 8afa5ef45b797ba5d8147ceee85ac2c59dcc7f09) ---- - grub-core/kern/mm.c | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index 7be33e23bf..38bfb01df9 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -115,9 +115,8 @@ grub_mm_init_region (void *addr, grub_size_t size) - grub_mm_header_t h; - grub_mm_region_t r, *p, q; - --#if 0 -- grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size); --#endif -+ grub_dprintf ("regions", "Using memory for heap: start=%p, end=%p\n", -+ addr, (char *) addr + (unsigned int) size); - - /* Exclude last 4K to avoid overflows. */ - /* If addr + 0x1000 overflows then whole region is in excluded zone. */ -@@ -142,8 +141,14 @@ grub_mm_init_region (void *addr, grub_size_t size) - * addr q - * |----size-----|-q->pre_size-|| - */ -+ grub_dprintf ("regions", "Can we extend into region above?" -+ " %p + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " ?=? %p\n", -+ (grub_uint8_t *) addr, size, q->pre_size, (grub_uint8_t *) q); - if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q) - { -+ grub_dprintf ("regions", "Yes: extending a region: (%p -> %p) -> (%p -> %p)\n", -+ q, (grub_uint8_t *) q + sizeof (*q) + q->size, -+ addr, (grub_uint8_t *) q + sizeof (*q) + q->size); - /* - * Yes, we can merge the memory starting at addr into the - * existing region from below. Align up addr to GRUB_MM_ALIGN -@@ -185,9 +190,15 @@ grub_mm_init_region (void *addr, grub_size_t size) - * q addr - * ||-q->post_size-|----size-----| - */ -+ grub_dprintf ("regions", "Can we extend into region below?" -+ " %p + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " ?=? %p\n", -+ (grub_uint8_t *) q, sizeof(*q), q->size, q->post_size, (grub_uint8_t *) addr); - if ((grub_uint8_t *) q + sizeof (*q) + q->size + q->post_size == - (grub_uint8_t *) addr) - { -+ grub_dprintf ("regions", "Yes: extending a region: (%p -> %p) -> (%p -> %p)\n", -+ q, (grub_uint8_t *) q + sizeof (*q) + q->size, -+ q, (grub_uint8_t *) addr + size); - /* - * Yes! Follow a similar pattern to above, but simpler. - * Our header starts at address - post_size, which should align us -@@ -213,6 +224,8 @@ grub_mm_init_region (void *addr, grub_size_t size) - } - } - -+ grub_dprintf ("regions", "No: considering a new region at %p of size %" PRIxGRUB_SIZE "\n", -+ addr, size); - /* Allocate a region from the head. */ - r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); - diff --git a/0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch b/0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch deleted file mode 100644 index a18d9122..00000000 --- a/0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Patrick Steinhardt -Date: Thu, 21 Apr 2022 15:24:17 +1000 -Subject: [PATCH] mm: Drop unused unloading of modules on OOM - -In grub_memalign(), there's a commented section which would allow for -unloading of unneeded modules in case where there is not enough free -memory available to satisfy a request. Given that this code is never -compiled in, let's remove it together with grub_dl_unload_unneeded(). - -Signed-off-by: Patrick Steinhardt -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 139fd9b134a01e0b5fe0ebefafa7f48d1ffb6d60) ---- - grub-core/kern/dl.c | 20 -------------------- - grub-core/kern/mm.c | 8 -------- - include/grub/dl.h | 1 - - 3 files changed, 29 deletions(-) - -diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c -index d5de80186f..ab9101a5ad 100644 ---- a/grub-core/kern/dl.c -+++ b/grub-core/kern/dl.c -@@ -998,23 +998,3 @@ grub_dl_unload (grub_dl_t mod) - grub_free (mod); - return 1; - } -- --/* Unload unneeded modules. */ --void --grub_dl_unload_unneeded (void) --{ -- /* Because grub_dl_remove modifies the list of modules, this -- implementation is tricky. */ -- grub_dl_t p = grub_dl_head; -- -- while (p) -- { -- if (grub_dl_unload (p)) -- { -- p = grub_dl_head; -- continue; -- } -- -- p = p->next; -- } --} -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index 38bfb01df9..1825dc8289 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -444,14 +444,6 @@ grub_memalign (grub_size_t align, grub_size_t size) - count++; - goto again; - --#if 0 -- case 1: -- /* Unload unneeded modules. */ -- grub_dl_unload_unneeded (); -- count++; -- goto again; --#endif -- - default: - break; - } -diff --git a/include/grub/dl.h b/include/grub/dl.h -index 45ac8e339f..6bc2560bf0 100644 ---- a/include/grub/dl.h -+++ b/include/grub/dl.h -@@ -206,7 +206,6 @@ grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name); - grub_dl_t grub_dl_load_core (void *addr, grub_size_t size); - grub_dl_t EXPORT_FUNC(grub_dl_load_core_noinit) (void *addr, grub_size_t size); - int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod); --extern void grub_dl_unload_unneeded (void); - extern int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); - extern int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); - extern int EXPORT_FUNC(grub_dl_ref_count) (grub_dl_t mod); diff --git a/0302-mm-Allow-dynamically-requesting-additional-memory-re.patch b/0302-mm-Allow-dynamically-requesting-additional-memory-re.patch deleted file mode 100644 index d225c108..00000000 --- a/0302-mm-Allow-dynamically-requesting-additional-memory-re.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Patrick Steinhardt -Date: Thu, 21 Apr 2022 15:24:18 +1000 -Subject: [PATCH] mm: Allow dynamically requesting additional memory regions - -Currently, all platforms will set up their heap on initialization of the -platform code. While this works mostly fine, it poses some limitations -on memory management on us. Most notably, allocating big chunks of -memory in the gigabyte range would require us to pre-request this many -bytes from the firmware and add it to the heap from the beginning on -some platforms like EFI. As this isn't needed for most configurations, -it is inefficient and may even negatively impact some usecases when, -e.g., chainloading. Nonetheless, allocating big chunks of memory is -required sometimes, where one example is the upcoming support for the -Argon2 key derival function in LUKS2. - -In order to avoid pre-allocating big chunks of memory, this commit -implements a runtime mechanism to add more pages to the system. When -a given allocation cannot be currently satisfied, we'll call a given -callback set up by the platform's own memory management subsystem, -asking it to add a memory area with at least "n" bytes. If this -succeeds, we retry searching for a valid memory region, which should -now succeed. - -If this fails, we try asking for "n" bytes, possibly spread across -multiple regions, in hopes that region merging means that we end up -with enough memory for things to work out. - -Signed-off-by: Patrick Steinhardt -Signed-off-by: Daniel Axtens -Tested-by: Stefan Berger -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 887f98f0db43e33fba4ec1f85e42fae1185700bc) ---- - grub-core/kern/mm.c | 30 ++++++++++++++++++++++++++++++ - include/grub/mm.h | 18 ++++++++++++++++++ - 2 files changed, 48 insertions(+) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index 1825dc8289..f2e27f263b 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -28,6 +28,9 @@ - - multiple regions may be used as free space. They may not be - contiguous. - -+ - if existing regions are insufficient to satisfy an allocation, a new -+ region can be requested from firmware. -+ - Regions are managed by a singly linked list, and the meta information is - stored in the beginning of each region. Space after the meta information - is used to allocate memory. -@@ -81,6 +84,7 @@ - - - grub_mm_region_t grub_mm_base; -+grub_mm_add_region_func_t grub_mm_add_region_fn; - - /* Get a header from the pointer PTR, and set *P and *R to a pointer - to the header and a pointer to its region, respectively. PTR must -@@ -444,6 +448,32 @@ grub_memalign (grub_size_t align, grub_size_t size) - count++; - goto again; - -+ case 1: -+ /* Request additional pages, contiguous */ -+ count++; -+ -+ if (grub_mm_add_region_fn != NULL && -+ grub_mm_add_region_fn (size, GRUB_MM_ADD_REGION_CONSECUTIVE) == GRUB_ERR_NONE) -+ goto again; -+ -+ /* fallthrough */ -+ -+ case 2: -+ /* Request additional pages, anything at all */ -+ count++; -+ -+ if (grub_mm_add_region_fn != NULL) -+ { -+ /* -+ * Try again even if this fails, in case it was able to partially -+ * satisfy the request -+ */ -+ grub_mm_add_region_fn (size, GRUB_MM_ADD_REGION_NONE); -+ goto again; -+ } -+ -+ /* fallthrough */ -+ - default: - break; - } -diff --git a/include/grub/mm.h b/include/grub/mm.h -index d81623d226..7c6f925ffd 100644 ---- a/include/grub/mm.h -+++ b/include/grub/mm.h -@@ -20,6 +20,7 @@ - #ifndef GRUB_MM_H - #define GRUB_MM_H 1 - -+#include - #include - #include - #include -@@ -29,6 +30,23 @@ - # define NULL ((void *) 0) - #endif - -+#define GRUB_MM_ADD_REGION_NONE 0 -+#define GRUB_MM_ADD_REGION_CONSECUTIVE (1 << 0) -+ -+/* -+ * Function used to request memory regions of `grub_size_t` bytes. The second -+ * parameter is a bitfield of `GRUB_MM_ADD_REGION` flags. -+ */ -+typedef grub_err_t (*grub_mm_add_region_func_t) (grub_size_t, unsigned int); -+ -+/* -+ * Set this function pointer to enable adding memory-regions at runtime in case -+ * a memory allocation cannot be satisfied with existing regions. -+ */ -+#ifndef GRUB_MACHINE_EMU -+extern grub_mm_add_region_func_t EXPORT_VAR(grub_mm_add_region_fn); -+#endif -+ - void grub_mm_init_region (void *addr, grub_size_t size); - void *EXPORT_FUNC(grub_calloc) (grub_size_t nmemb, grub_size_t size); - void *EXPORT_FUNC(grub_malloc) (grub_size_t size); diff --git a/0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch b/0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch deleted file mode 100644 index 6fa378c9..00000000 --- a/0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Patrick Steinhardt -Date: Thu, 21 Apr 2022 15:24:19 +1000 -Subject: [PATCH] kern/efi/mm: Always request a fixed number of pages on init - -When initializing the EFI memory subsystem, we will by default request -a quarter of the available memory, bounded by a minimum/maximum value. -Given that we're about to extend the EFI memory system to dynamically -request additional pages from the firmware as required, this scaling of -requested memory based on available memory will not make a lot of sense -anymore. - -Remove this logic as a preparatory patch such that we'll instead defer -to the runtime memory allocator. Note that ideally, we'd want to change -this after dynamic requesting of pages has been implemented for the EFI -platform. But because we'll need to split up initialization of the -memory subsystem and the request of pages from the firmware, we'd have -to duplicate quite some logic at first only to remove it afterwards -again. This seems quite pointless, so we instead have patches slightly -out of order. - -Signed-off-by: Patrick Steinhardt -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 938c3760b8c0fca759140be48307179b50107ff6) ---- - grub-core/kern/efi/mm.c | 35 +++-------------------------------- - 1 file changed, 3 insertions(+), 32 deletions(-) - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index e460b072e6..782a1365a1 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -38,9 +38,8 @@ - a multiplier of 4KB. */ - #define MEMORY_MAP_SIZE 0x3000 - --/* The minimum and maximum heap size for GRUB itself. */ --#define MIN_HEAP_SIZE 0x100000 --#define MAX_HEAP_SIZE (1600 * 0x100000) -+/* The default heap size for GRUB itself in bytes. */ -+#define DEFAULT_HEAP_SIZE 0x100000 - - static void *finish_mmap_buf = 0; - static grub_efi_uintn_t finish_mmap_size = 0; -@@ -514,23 +513,6 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, - return filtered_desc; - } - --/* Return the total number of pages. */ --static grub_efi_uint64_t --get_total_pages (grub_efi_memory_descriptor_t *memory_map, -- grub_efi_uintn_t desc_size, -- grub_efi_memory_descriptor_t *memory_map_end) --{ -- grub_efi_memory_descriptor_t *desc; -- grub_efi_uint64_t total = 0; -- -- for (desc = memory_map; -- desc < memory_map_end; -- desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) -- total += desc->num_pages; -- -- return total; --} -- - /* Add memory regions. */ - static void - add_memory_regions (grub_efi_memory_descriptor_t *memory_map, -@@ -694,8 +676,6 @@ grub_efi_mm_init (void) - grub_efi_memory_descriptor_t *filtered_memory_map_end; - grub_efi_uintn_t map_size; - grub_efi_uintn_t desc_size; -- grub_efi_uint64_t total_pages; -- grub_efi_uint64_t required_pages; - int mm_status; - - grub_nx_init (); -@@ -737,22 +717,13 @@ grub_efi_mm_init (void) - filtered_memory_map_end = filter_memory_map (memory_map, filtered_memory_map, - desc_size, memory_map_end); - -- /* By default, request a quarter of the available memory. */ -- total_pages = get_total_pages (filtered_memory_map, desc_size, -- filtered_memory_map_end); -- required_pages = (total_pages >> 2); -- if (required_pages < BYTES_TO_PAGES (MIN_HEAP_SIZE)) -- required_pages = BYTES_TO_PAGES (MIN_HEAP_SIZE); -- else if (required_pages > BYTES_TO_PAGES (MAX_HEAP_SIZE)) -- required_pages = BYTES_TO_PAGES (MAX_HEAP_SIZE); -- - /* Sort the filtered descriptors, so that GRUB can allocate pages - from smaller regions. */ - sort_memory_map (filtered_memory_map, desc_size, filtered_memory_map_end); - - /* Allocate memory regions for GRUB's memory management. */ - add_memory_regions (filtered_memory_map, desc_size, -- filtered_memory_map_end, required_pages); -+ filtered_memory_map_end, BYTES_TO_PAGES (DEFAULT_HEAP_SIZE)); - - #if 0 - /* For debug. */ diff --git a/0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch b/0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch deleted file mode 100644 index 28cf2e75..00000000 --- a/0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Patrick Steinhardt -Date: Thu, 21 Apr 2022 15:24:20 +1000 -Subject: [PATCH] kern/efi/mm: Extract function to add memory regions - -In preparation of support for runtime-allocating additional memory -region, this patch extracts the function to retrieve the EFI memory -map and add a subset of it to GRUB's own memory regions. - -Signed-off-by: Patrick Steinhardt -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 96a7ea29e3cb61b6c2302e260e8e6a6117e17fa3) -[rharwood: backport around our nx] ---- - grub-core/kern/efi/mm.c | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 782a1365a1..a1d3b51fe6 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -667,8 +667,8 @@ grub_nx_init (void) - } - } - --void --grub_efi_mm_init (void) -+static grub_err_t -+grub_efi_mm_add_regions (grub_size_t required_bytes) - { - grub_efi_memory_descriptor_t *memory_map; - grub_efi_memory_descriptor_t *memory_map_end; -@@ -683,7 +683,7 @@ grub_efi_mm_init (void) - /* Prepare a memory region to store two memory maps. */ - memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); - if (! memory_map) -- grub_fatal ("cannot allocate memory"); -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory for memory map"); - - /* Obtain descriptors for available memory. */ - map_size = MEMORY_MAP_SIZE; -@@ -701,14 +701,14 @@ grub_efi_mm_init (void) - - memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES (map_size)); - if (! memory_map) -- grub_fatal ("cannot allocate memory"); -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory for new memory map"); - - mm_status = grub_efi_get_memory_map (&map_size, memory_map, 0, - &desc_size, 0); - } - - if (mm_status < 0) -- grub_fatal ("cannot get memory map"); -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "error fetching memory map from EFI"); - - memory_map_end = NEXT_MEMORY_DESCRIPTOR (memory_map, map_size); - -@@ -723,7 +723,7 @@ grub_efi_mm_init (void) - - /* Allocate memory regions for GRUB's memory management. */ - add_memory_regions (filtered_memory_map, desc_size, -- filtered_memory_map_end, BYTES_TO_PAGES (DEFAULT_HEAP_SIZE)); -+ filtered_memory_map_end, BYTES_TO_PAGES (required_bytes)); - - #if 0 - /* For debug. */ -@@ -741,6 +741,15 @@ grub_efi_mm_init (void) - /* Release the memory maps. */ - grub_efi_free_pages ((grub_addr_t) memory_map, - 2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); -+ -+ return GRUB_ERR_NONE; -+} -+ -+void -+grub_efi_mm_init (void) -+{ -+ if (grub_efi_mm_add_regions (DEFAULT_HEAP_SIZE) != GRUB_ERR_NONE) -+ grub_fatal ("%s", grub_errmsg); - } - - #if defined (__aarch64__) || defined (__arm__) || defined (__riscv) diff --git a/0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch b/0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch deleted file mode 100644 index b4b7891b..00000000 --- a/0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Patrick Steinhardt -Date: Thu, 21 Apr 2022 15:24:21 +1000 -Subject: [PATCH] kern/efi/mm: Pass up errors from add_memory_regions() - -The function add_memory_regions() is currently only called on system -initialization to allocate a fixed amount of pages. As such, it didn't -need to return any errors: in case it failed, we cannot proceed anyway. -This will change with the upcoming support for requesting more memory -from the firmware at runtime, where it doesn't make sense anymore to -fail hard. - -Refactor the function to return an error to prepare for this. Note that -this does not change the behaviour when initializing the memory system -because grub_efi_mm_init() knows to call grub_fatal() in case -grub_efi_mm_add_regions() returns an error. - -Signed-off-by: Patrick Steinhardt -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 15a015698921240adc1ac266a3b5bc5fcbd81521) ---- - grub-core/kern/efi/mm.c | 22 +++++++++++++++------- - 1 file changed, 15 insertions(+), 7 deletions(-) - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index a1d3b51fe6..e0ebc65dba 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -514,7 +514,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, - } - - /* Add memory regions. */ --static void -+static grub_err_t - add_memory_regions (grub_efi_memory_descriptor_t *memory_map, - grub_efi_uintn_t desc_size, - grub_efi_memory_descriptor_t *memory_map_end, -@@ -542,9 +542,9 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, - GRUB_EFI_ALLOCATE_ADDRESS, - GRUB_EFI_LOADER_CODE); - if (! addr) -- grub_fatal ("cannot allocate conventional memory %p with %u pages", -- (void *) ((grub_addr_t) start), -- (unsigned) pages); -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ "Memory starting at %p (%u pages) marked as free, but EFI would not allocate", -+ (void *) ((grub_addr_t) start), (unsigned) pages); - - grub_mm_init_region (addr, PAGES_TO_BYTES (pages)); - -@@ -554,7 +554,11 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, - } - - if (required_pages > 0) -- grub_fatal ("too little memory"); -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ "could not allocate all requested memory: %" PRIuGRUB_UINT64_T " pages still required after iterating EFI memory map", -+ required_pages); -+ -+ return GRUB_ERR_NONE; - } - - void -@@ -676,6 +680,7 @@ grub_efi_mm_add_regions (grub_size_t required_bytes) - grub_efi_memory_descriptor_t *filtered_memory_map_end; - grub_efi_uintn_t map_size; - grub_efi_uintn_t desc_size; -+ grub_err_t err; - int mm_status; - - grub_nx_init (); -@@ -722,8 +727,11 @@ grub_efi_mm_add_regions (grub_size_t required_bytes) - sort_memory_map (filtered_memory_map, desc_size, filtered_memory_map_end); - - /* Allocate memory regions for GRUB's memory management. */ -- add_memory_regions (filtered_memory_map, desc_size, -- filtered_memory_map_end, BYTES_TO_PAGES (required_bytes)); -+ err = add_memory_regions (filtered_memory_map, desc_size, -+ filtered_memory_map_end, -+ BYTES_TO_PAGES (required_bytes)); -+ if (err != GRUB_ERR_NONE) -+ return err; - - #if 0 - /* For debug. */ diff --git a/0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch b/0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch deleted file mode 100644 index 1f52581f..00000000 --- a/0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Patrick Steinhardt -Date: Thu, 21 Apr 2022 15:24:22 +1000 -Subject: [PATCH] kern/efi/mm: Implement runtime addition of pages - -Adjust the interface of grub_efi_mm_add_regions() to take a set of -GRUB_MM_ADD_REGION_* flags, which most notably is currently only the -GRUB_MM_ADD_REGION_CONSECUTIVE flag. This allows us to set the function -up as callback for the memory subsystem and have it call out to us in -case there's not enough pages available in the current heap. - -Signed-off-by: Patrick Steinhardt -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -Tested-by: Patrick Steinhardt -(cherry picked from commit 1df2934822df4c1170dde069d97cfbf7a9572bba) ---- - grub-core/kern/efi/mm.c | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index e0ebc65dba..016ba6cf2f 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -518,7 +518,8 @@ static grub_err_t - add_memory_regions (grub_efi_memory_descriptor_t *memory_map, - grub_efi_uintn_t desc_size, - grub_efi_memory_descriptor_t *memory_map_end, -- grub_efi_uint64_t required_pages) -+ grub_efi_uint64_t required_pages, -+ unsigned int flags) - { - grub_efi_memory_descriptor_t *desc; - -@@ -532,6 +533,10 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, - - start = desc->physical_start; - pages = desc->num_pages; -+ -+ if (pages < required_pages && (flags & GRUB_MM_ADD_REGION_CONSECUTIVE)) -+ continue; -+ - if (pages > required_pages) - { - start += PAGES_TO_BYTES (pages - required_pages); -@@ -672,7 +677,7 @@ grub_nx_init (void) - } - - static grub_err_t --grub_efi_mm_add_regions (grub_size_t required_bytes) -+grub_efi_mm_add_regions (grub_size_t required_bytes, unsigned int flags) - { - grub_efi_memory_descriptor_t *memory_map; - grub_efi_memory_descriptor_t *memory_map_end; -@@ -729,7 +734,8 @@ grub_efi_mm_add_regions (grub_size_t required_bytes) - /* Allocate memory regions for GRUB's memory management. */ - err = add_memory_regions (filtered_memory_map, desc_size, - filtered_memory_map_end, -- BYTES_TO_PAGES (required_bytes)); -+ BYTES_TO_PAGES (required_bytes), -+ flags); - if (err != GRUB_ERR_NONE) - return err; - -@@ -756,8 +762,9 @@ grub_efi_mm_add_regions (grub_size_t required_bytes) - void - grub_efi_mm_init (void) - { -- if (grub_efi_mm_add_regions (DEFAULT_HEAP_SIZE) != GRUB_ERR_NONE) -+ if (grub_efi_mm_add_regions (DEFAULT_HEAP_SIZE, GRUB_MM_ADD_REGION_NONE) != GRUB_ERR_NONE) - grub_fatal ("%s", grub_errmsg); -+ grub_mm_add_region_fn = grub_efi_mm_add_regions; - } - - #if defined (__aarch64__) || defined (__arm__) || defined (__riscv) diff --git a/0307-efi-Increase-default-memory-allocation-to-32-MiB.patch b/0307-efi-Increase-default-memory-allocation-to-32-MiB.patch deleted file mode 100644 index b70c3cce..00000000 --- a/0307-efi-Increase-default-memory-allocation-to-32-MiB.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Tue, 20 Sep 2022 00:30:30 +1000 -Subject: [PATCH] efi: Increase default memory allocation to 32 MiB - -We have multiple reports of things being slower with a 1 MiB initial static -allocation, and a report (more difficult to nail down) of a boot failure -as a result of the smaller initial allocation. - -Make the initial memory allocation 32 MiB. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 75e38e86e7d9202f050b093f20500d9ad4c6dad9) ---- - grub-core/kern/efi/mm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index 016ba6cf2f..b27e966e1f 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -39,7 +39,7 @@ - #define MEMORY_MAP_SIZE 0x3000 - - /* The default heap size for GRUB itself in bytes. */ --#define DEFAULT_HEAP_SIZE 0x100000 -+#define DEFAULT_HEAP_SIZE 0x2000000 - - static void *finish_mmap_buf = 0; - static grub_efi_uintn_t finish_mmap_size = 0; diff --git a/0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch b/0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch deleted file mode 100644 index c919891c..00000000 --- a/0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Sat, 15 Oct 2022 22:15:11 +0800 -Subject: [PATCH] mm: Try invalidate disk caches last when out of memory - -Every heap grow will cause all disk caches invalidated which decreases -performance severely. This patch moves disk cache invalidation code to -the last of memory squeezing measures. So, disk caches are released only -when there are no other ways to get free memory. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -Reviewed-by: Patrick Steinhardt -(cherry picked from commit 17975d10a80e2457e5237f87fa58a7943031983e) ---- - grub-core/kern/mm.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index f2e27f263b..da1ac9427c 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -443,12 +443,6 @@ grub_memalign (grub_size_t align, grub_size_t size) - switch (count) - { - case 0: -- /* Invalidate disk caches. */ -- grub_disk_cache_invalidate_all (); -- count++; -- goto again; -- -- case 1: - /* Request additional pages, contiguous */ - count++; - -@@ -458,7 +452,7 @@ grub_memalign (grub_size_t align, grub_size_t size) - - /* fallthrough */ - -- case 2: -+ case 1: - /* Request additional pages, anything at all */ - count++; - -@@ -474,6 +468,12 @@ grub_memalign (grub_size_t align, grub_size_t size) - - /* fallthrough */ - -+ case 2: -+ /* Invalidate disk caches. */ -+ grub_disk_cache_invalidate_all (); -+ count++; -+ goto again; -+ - default: - break; - } diff --git a/0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch b/0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch deleted file mode 100644 index 65834d8d..00000000 --- a/0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch +++ /dev/null @@ -1,431 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Raymund Will -Date: Mon, 24 Oct 2022 14:33:50 -0400 -Subject: [PATCH] loader: Add support for grub-emu to kexec Linux menu entries - -The GRUB emulator is used as a debugging utility but it could also be -used as a user-space bootloader if there is support to boot an operating -system. - -The Linux kernel is already able to (re)boot another kernel via the -kexec boot mechanism. So the grub-emu tool could rely on this feature -and have linux and initrd commands that are used to pass a kernel, -initramfs image and command line parameters to kexec for booting -a selected menu entry. - -By default the systemctl kexec option is used so systemd can shutdown -all of the running services before doing a reboot using kexec. But if -this is not present, it can fall back to executing the kexec user-space -tool directly. The ability to force a kexec-reboot when systemctl kexec -fails must only be used in controlled environments to avoid possible -filesystem corruption and data loss. - -Signed-off-by: Raymund Will -Signed-off-by: John Jolly -Signed-off-by: Javier Martinez Canillas -Signed-off-by: Robbie Harwood -Reviewed-by: Daniel Kiper -(cherry picked from commit e364307f6acc2f631b4c1fefda0791b9ce1f205f) -[rharwood: conflicts around makefile and grub_exit return code] ---- - grub-core/Makefile.core.def | 3 - - grub-core/kern/emu/main.c | 4 + - grub-core/kern/emu/misc.c | 18 ++++- - grub-core/loader/emu/linux.c | 178 +++++++++++++++++++++++++++++++++++++++++++ - include/grub/emu/exec.h | 4 +- - include/grub/emu/hostfile.h | 3 +- - include/grub/emu/misc.h | 3 + - docs/grub.texi | 30 ++++++-- - grub-core/Makefile.am | 1 + - 9 files changed, 230 insertions(+), 14 deletions(-) - create mode 100644 grub-core/loader/emu/linux.c - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index 741a033978..f21da23213 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -1864,11 +1864,8 @@ module = { - riscv32 = loader/riscv/linux.c; - riscv64 = loader/riscv/linux.c; - emu = loader/emu/linux.c; -- - common = loader/linux.c; - common = lib/cmdline.c; -- enable = noemu; -- - efi = loader/efi/linux.c; - }; - -diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c -index 12277c34d2..68e2b283bb 100644 ---- a/grub-core/kern/emu/main.c -+++ b/grub-core/kern/emu/main.c -@@ -107,6 +107,7 @@ static struct argp_option options[] = { - N_("use GRUB files in the directory DIR [default=%s]"), 0}, - {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, - {"hold", 'H', N_("SECS"), OPTION_ARG_OPTIONAL, N_("wait until a debugger will attach"), 0}, -+ {"kexec", 'X', 0, 0, N_("use kexec to boot Linux kernels via systemctl (pass twice to enable dangerous fallback to non-systemctl)."), 0}, - { 0, 0, 0, 0, 0, 0 } - }; - -@@ -164,6 +165,9 @@ argp_parser (int key, char *arg, struct argp_state *state) - case 'v': - verbosity++; - break; -+ case 'X': -+ grub_util_set_kexecute (); -+ break; - - case ARGP_KEY_ARG: - { -diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c -index d278c2921f..02d27c3440 100644 ---- a/grub-core/kern/emu/misc.c -+++ b/grub-core/kern/emu/misc.c -@@ -39,6 +39,7 @@ - #include - - int verbosity; -+int kexecute; - - void - grub_util_warn (const char *fmt, ...) -@@ -82,7 +83,7 @@ grub_util_error (const char *fmt, ...) - vfprintf (stderr, fmt, ap); - va_end (ap); - fprintf (stderr, ".\n"); -- exit (1); -+ grub_exit (1); - } - - void * -@@ -154,6 +155,9 @@ void - __attribute__ ((noreturn)) - grub_exit (int rc) - { -+#if defined (GRUB_KERNEL) -+ grub_reboot (); -+#endif - exit (rc < 0 ? 1 : rc); - } - #endif -@@ -215,3 +219,15 @@ grub_util_load_image (const char *path, char *buf) - - fclose (fp); - } -+ -+void -+grub_util_set_kexecute (void) -+{ -+ kexecute++; -+} -+ -+int -+grub_util_get_kexecute (void) -+{ -+ return kexecute; -+} -diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -new file mode 100644 -index 0000000000..0cf378a376 ---- /dev/null -+++ b/grub-core/loader/emu/linux.c -@@ -0,0 +1,178 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2022 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_dl_t my_mod; -+ -+static char *kernel_path; -+static char *initrd_path; -+static char *boot_cmdline; -+ -+static grub_err_t -+grub_linux_boot (void) -+{ -+ grub_err_t rc = GRUB_ERR_NONE; -+ char *initrd_param; -+ const char *kexec[] = {"kexec", "-la", kernel_path, boot_cmdline, NULL, NULL}; -+ const char *systemctl[] = {"systemctl", "kexec", NULL}; -+ int kexecute = grub_util_get_kexecute (); -+ -+ if (initrd_path) -+ { -+ initrd_param = grub_xasprintf ("--initrd=%s", initrd_path); -+ kexec[3] = initrd_param; -+ kexec[4] = boot_cmdline; -+ } -+ else -+ initrd_param = grub_xasprintf ("%s", ""); -+ -+ grub_dprintf ("linux", "%serforming 'kexec -la %s %s %s'\n", -+ (kexecute) ? "P" : "Not p", -+ kernel_path, initrd_param, boot_cmdline); -+ -+ if (kexecute) -+ rc = grub_util_exec (kexec); -+ -+ grub_free (initrd_param); -+ -+ if (rc != GRUB_ERR_NONE) -+ { -+ grub_error (rc, N_("error trying to perform kexec load operation")); -+ grub_sleep (3); -+ return rc; -+ } -+ -+ if (kexecute < 1) -+ grub_fatal (N_("use '"PACKAGE"-emu --kexec' to force a system restart")); -+ -+ grub_dprintf ("linux", "Performing 'systemctl kexec' (%s) ", -+ (kexecute==1) ? "do-or-die" : "just-in-case"); -+ rc = grub_util_exec (systemctl); -+ -+ if (kexecute == 1) -+ grub_fatal (N_("error trying to perform 'systemctl kexec': %d"), rc); -+ -+ /* -+ * WARNING: forcible reset should only be used in read-only environments. -+ * grub-emu cannot check for these - users beware. -+ */ -+ grub_dprintf ("linux", "Performing 'kexec -ex'"); -+ kexec[1] = "-ex"; -+ kexec[2] = NULL; -+ rc = grub_util_exec (kexec); -+ if (rc != GRUB_ERR_NONE) -+ grub_fatal (N_("error trying to directly perform 'kexec -ex': %d"), rc); -+ -+ return rc; -+} -+ -+static grub_err_t -+grub_linux_unload (void) -+{ -+ /* Unloading: we're no longer in use. */ -+ grub_dl_unref (my_mod); -+ grub_free (boot_cmdline); -+ boot_cmdline = NULL; -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), int argc, -+ char *argv[]) -+{ -+ int i; -+ char *tempstr; -+ -+ /* Mark ourselves as in-use. */ -+ grub_dl_ref (my_mod); -+ -+ if (argc == 0) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -+ -+ if (!grub_util_is_regular (argv[0])) -+ return grub_error (GRUB_ERR_FILE_NOT_FOUND, -+ N_("cannot find kernel file %s"), argv[0]); -+ -+ grub_free (kernel_path); -+ kernel_path = grub_xasprintf ("%s", argv[0]); -+ -+ grub_free (boot_cmdline); -+ boot_cmdline = NULL; -+ -+ if (argc > 1) -+ { -+ boot_cmdline = grub_xasprintf ("--command-line=%s", argv[1]); -+ for (i = 2; i < argc; i++) -+ { -+ tempstr = grub_xasprintf ("%s %s", boot_cmdline, argv[i]); -+ grub_free (boot_cmdline); -+ boot_cmdline = tempstr; -+ } -+ } -+ -+ grub_loader_set (grub_linux_boot, grub_linux_unload, 0); -+ -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, -+ char *argv[]) -+{ -+ if (argc == 0) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -+ -+ if (!grub_util_is_regular (argv[0])) -+ return grub_error (GRUB_ERR_FILE_NOT_FOUND, -+ N_("Cannot find initrd file %s"), argv[0]); -+ -+ grub_free (initrd_path); -+ initrd_path = grub_xasprintf ("%s", argv[0]); -+ -+ /* We are done - mark ourselves as on longer in use. */ -+ grub_dl_unref (my_mod); -+ -+ return GRUB_ERR_NONE; -+} -+ -+static grub_command_t cmd_linux, cmd_initrd; -+ -+GRUB_MOD_INIT (linux) -+{ -+ cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, -+ N_("Load Linux.")); -+ cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, 0, -+ N_("Load initrd.")); -+ my_mod = mod; -+} -+ -+GRUB_MOD_FINI (linux) -+{ -+ grub_unregister_command (cmd_linux); -+ grub_unregister_command (cmd_initrd); -+} -diff --git a/include/grub/emu/exec.h b/include/grub/emu/exec.h -index d1073ef86a..1b61b4a2e5 100644 ---- a/include/grub/emu/exec.h -+++ b/include/grub/emu/exec.h -@@ -23,6 +23,8 @@ - #include - - #include -+#include -+ - pid_t - grub_util_exec_pipe (const char *const *argv, int *fd); - pid_t -@@ -32,7 +34,7 @@ int - grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, - const char *stdout_file, const char *stderr_file); - int --grub_util_exec (const char *const *argv); -+EXPORT_FUNC(grub_util_exec) (const char *const *argv); - int - grub_util_exec_redirect (const char *const *argv, const char *stdin_file, - const char *stdout_file); -diff --git a/include/grub/emu/hostfile.h b/include/grub/emu/hostfile.h -index cfb1e2b566..a61568e36e 100644 ---- a/include/grub/emu/hostfile.h -+++ b/include/grub/emu/hostfile.h -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - - int -@@ -29,7 +30,7 @@ grub_util_is_directory (const char *path); - int - grub_util_is_special_file (const char *path); - int --grub_util_is_regular (const char *path); -+EXPORT_FUNC(grub_util_is_regular) (const char *path); - - char * - grub_util_path_concat (size_t n, ...); -diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h -index ff9c48a649..01056954b9 100644 ---- a/include/grub/emu/misc.h -+++ b/include/grub/emu/misc.h -@@ -57,6 +57,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format ( - void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); - void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2), noreturn)); - -+void EXPORT_FUNC(grub_util_set_kexecute) (void); -+int EXPORT_FUNC(grub_util_get_kexecute) (void) WARN_UNUSED_RESULT; -+ - grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); - - #ifdef HAVE_DEVICE_MAPPER -diff --git a/docs/grub.texi b/docs/grub.texi -index a4da9c2a1b..1750b72ee9 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -923,17 +923,17 @@ magic. - @node General boot methods - @section How to boot operating systems - --GRUB has two distinct boot methods. One of the two is to load an --operating system directly, and the other is to chain-load another boot --loader which then will load an operating system actually. Generally --speaking, the former is more desirable, because you don't need to --install or maintain other boot loaders and GRUB is flexible enough to --load an operating system from an arbitrary disk/partition. However, --the latter is sometimes required, since GRUB doesn't support all the --existing operating systems natively. -+GRUB has three distinct boot methods: loading an operating system -+directly, using kexec from userspace, and chainloading another -+bootloader. Generally speaking, the first two are more desirable -+because you don't need to install or maintain other boot loaders and -+GRUB is flexible enough to load an operating system from an arbitrary -+disk/partition. However, chainloading is sometimes required, as GRUB -+doesn't support all existing operating systems natively. - - @menu - * Loading an operating system directly:: -+* Kexec:: - * Chain-loading:: - @end menu - -@@ -959,6 +959,20 @@ use more complicated instructions. @xref{DOS/Windows}, for more - information. - - -+@node Kexec -+@subsection Kexec with grub2-emu -+ -+GRUB can be run in userspace by invoking the grub2-emu tool. It will -+read all configuration scripts as if booting directly (see @xref{Loading -+an operating system directly}). With the @code{--kexec} flag, and -+kexec(8) support from the operating system, the @command{linux} command -+will directly boot the target image. For systems that lack working -+systemctl(1) support for kexec, passing the @code{--kexec} flag twice -+will fallback to invoking kexec(8) directly; note however that this -+fallback may be unsafe outside read-only environments, as it does not -+invoke shutdown machinery. -+ -+ - @node Chain-loading - @subsection Chain-loading an OS - -diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am -index c2e8a82bce..dd49939aaa 100644 ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am -@@ -309,6 +309,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/exec.h - if COND_GRUB_EMU_SDL - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h - endif diff --git a/0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch b/0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch deleted file mode 100644 index 735075a3..00000000 --- a/0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 6 Sep 2021 15:46:12 +1000 -Subject: [PATCH] powerpc: Drop Open Hack'Ware - remove - GRUB_IEEE1275_FLAG_FORCE_CLAIM - -Open Hack'Ware was the only user. It added a lot of complexity. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 333e63b356f1ce833cda1937ed8351618cbdf9d3) ---- - grub-core/kern/ieee1275/init.c | 6 +----- - grub-core/lib/ieee1275/relocator.c | 4 ---- - grub-core/loader/powerpc/ieee1275/linux.c | 14 -------------- - include/grub/ieee1275/ieee1275.h | 11 ----------- - 4 files changed, 1 insertion(+), 34 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 0dcd114ce5..6581c2c996 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -207,11 +207,7 @@ grub_claim_heap (void) - { - unsigned long total = 0; - -- if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) -- heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, -- 1, &total); -- else -- grub_machine_mmap_iterate (heap_init, &total); -+ grub_machine_mmap_iterate (heap_init, &total); - } - #endif - -diff --git a/grub-core/lib/ieee1275/relocator.c b/grub-core/lib/ieee1275/relocator.c -index c6dd8facb0..d1bb45c75e 100644 ---- a/grub-core/lib/ieee1275/relocator.c -+++ b/grub-core/lib/ieee1275/relocator.c -@@ -38,8 +38,6 @@ grub_relocator_firmware_get_max_events (void) - { - int counter = 0; - -- if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) -- return 0; - grub_machine_mmap_iterate (count, &counter); - return 2 * counter; - } -@@ -92,8 +90,6 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events) - .counter = 0 - }; - -- if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) -- return 0; - grub_machine_mmap_iterate (grub_relocator_firmware_fill_events_iter, &ctx); - return ctx.counter; - } -diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c -index 818b2a86d1..6fdd863130 100644 ---- a/grub-core/loader/powerpc/ieee1275/linux.c -+++ b/grub-core/loader/powerpc/ieee1275/linux.c -@@ -111,20 +111,6 @@ grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size, - .found_addr = (grub_addr_t) -1 - }; - -- if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) -- { -- grub_uint64_t addr = target; -- if (addr < GRUB_IEEE1275_STATIC_HEAP_START -- + GRUB_IEEE1275_STATIC_HEAP_LEN) -- addr = GRUB_IEEE1275_STATIC_HEAP_START -- + GRUB_IEEE1275_STATIC_HEAP_LEN; -- addr = ALIGN_UP (addr, align); -- if (grub_claimmap (addr, size) == GRUB_ERR_NONE) -- return addr; -- return (grub_addr_t) -1; -- } -- -- - grub_machine_mmap_iterate (alloc_mem, &ctx); - - return ctx.found_addr; -diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index b5a1d49bbc..6a1d3e5d70 100644 ---- a/include/grub/ieee1275/ieee1275.h -+++ b/include/grub/ieee1275/ieee1275.h -@@ -85,14 +85,6 @@ extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu); - - extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *) GRUB_IEEE1275_ENTRY_FN_ATTRIBUTE; - --/* Static heap, used only if FORCE_CLAIM is set, -- happens on Open Hack'Ware. Should be in platform-specific -- header but is used only on PPC anyway. --*/ --#define GRUB_IEEE1275_STATIC_HEAP_START 0x1000000 --#define GRUB_IEEE1275_STATIC_HEAP_LEN 0x1000000 -- -- - enum grub_ieee1275_flag - { - /* Old World Macintosh firmware fails seek when "dev:0" is opened. */ -@@ -119,9 +111,6 @@ enum grub_ieee1275_flag - /* Open Hack'Ware stops when grub_ieee1275_interpret is used. */ - GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, - -- /* Open Hack'Ware has no memory map, just claim what we need. */ -- GRUB_IEEE1275_FLAG_FORCE_CLAIM, -- - /* Open Hack'Ware don't support the ANSI sequence. */ - GRUB_IEEE1275_FLAG_NO_ANSI, - diff --git a/0313-ieee1275-request-memory-with-ibm-client-architecture.patch b/0313-ieee1275-request-memory-with-ibm-client-architecture.patch deleted file mode 100644 index 4e95630c..00000000 --- a/0313-ieee1275-request-memory-with-ibm-client-architecture.patch +++ /dev/null @@ -1,308 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 6 Feb 2023 10:03:20 -0500 -Subject: [PATCH] ieee1275: request memory with ibm, - client-architecture-support - -On PowerVM, the first time we boot a Linux partition, we may only get -256MB of real memory area, even if the partition has more memory. - -This isn't enough to reliably verify a kernel. Fortunately, the Power -Architecture Platform Reference (PAPR) defines a method we can call to ask -for more memory: the broad and powerful ibm,client-architecture-support -(CAS) method. - -CAS can do an enormous amount of things on a PAPR platform: as well as -asking for memory, you can set the supported processor level, the interrupt -controller, hash vs radix mmu, and so on. - -If: - - - we are running under what we think is PowerVM (compatible property of / - begins with "IBM"), and - - - the full amount of RMA is less than 512MB (as determined by the reg - property of /memory) - -then call CAS as follows: (refer to the Linux on Power Architecture -Reference, LoPAR, which is public, at B.5.2.3): - - - Use the "any" PVR value and supply 2 option vectors. - - - Set option vector 1 (PowerPC Server Processor Architecture Level) - to "ignore". - - - Set option vector 2 with default or Linux-like options, including a - min-rma-size of 512MB. - - - Set option vector 3 to request Floating Point, VMX and Decimal Floating - point, but don't abort the boot if we can't get them. - - - Set option vector 4 to request a minimum VP percentage to 1%, which is - what Linux requests, and is below the default of 10%. Without this, - some systems with very large or very small configurations fail to boot. - -This will cause a CAS reboot and the partition will restart with 512MB -of RMA. Importantly, grub will notice the 512MB and not call CAS again. - -Notes about the choices of parameters: - - - A partition can be configured with only 256MB of memory, which would - mean this request couldn't be satisfied, but PFW refuses to load with - only 256MB of memory, so it's a bit moot. SLOF will run fine with 256MB, - but we will never call CAS under qemu/SLOF because /compatible won't - begin with "IBM".) - - - unspecified CAS vectors take on default values. Some of these values - might restrict the ability of certain hardware configurations to boot. - This is why we need to specify the VP percentage in vector 4, which is - in turn why we need to specify vector 3. - -Finally, we should have enough memory to verify a kernel, and we will -reach Linux. One of the first things Linux does while still running under -OpenFirmware is to call CAS with a much fuller set of options (including -asking for 512MB of memory). Linux includes a much more restrictive set of -PVR values and processor support levels, and this CAS invocation will likely -induce another reboot. On this reboot grub will again notice the higher RMA, -and not call CAS. We will get to Linux again, Linux will call CAS again, but -because the values are now set for Linux this will not induce another CAS -reboot and we will finally boot all the way to userspace. - -On all subsequent boots, everything will be configured with 512MB of RMA, -so there will be no further CAS reboots from grub. (phyp is super sticky -with the RMA size - it persists even on cold boots. So if you've ever booted -Linux in a partition, you'll probably never have grub call CAS. It'll only -ever fire the first time a partition loads grub, or if you deliberately lower -the amount of memory your partition has below 512MB.) - -Signed-off-by: Daniel Axtens -Signed-off-by: Stefan Berger -Reviewed-by: Daniel Kiper -(cherry picked from commit d5571590b7de61887efac1c298901455697ba307) ---- - grub-core/kern/ieee1275/cmain.c | 5 ++ - grub-core/kern/ieee1275/init.c | 167 ++++++++++++++++++++++++++++++++++++++- - include/grub/ieee1275/ieee1275.h | 12 ++- - 3 files changed, 182 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index 04df9d2c66..dce7b84922 100644 ---- a/grub-core/kern/ieee1275/cmain.c -+++ b/grub-core/kern/ieee1275/cmain.c -@@ -127,6 +127,11 @@ grub_ieee1275_find_options (void) - break; - } - } -+ -+#if defined(__powerpc__) -+ if (grub_strncmp (tmp, "IBM,", 4) == 0) -+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY); -+#endif - } - - if (is_smartfirmware) -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 6581c2c996..8ae405bc79 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -202,11 +202,176 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - return 0; - } - --static void -+/* -+ * How much memory does OF believe it has? (regardless of whether -+ * it's accessible or not) -+ */ -+static grub_err_t -+grub_ieee1275_total_mem (grub_uint64_t *total) -+{ -+ grub_ieee1275_phandle_t root; -+ grub_ieee1275_phandle_t memory; -+ grub_uint32_t reg[4]; -+ grub_ssize_t reg_size; -+ grub_uint32_t address_cells = 1; -+ grub_uint32_t size_cells = 1; -+ grub_uint64_t size; -+ -+ /* If we fail to get to the end, report 0. */ -+ *total = 0; -+ -+ /* Determine the format of each entry in `reg'. */ -+ if (grub_ieee1275_finddevice ("/", &root)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't find / node"); -+ if (grub_ieee1275_get_integer_property (root, "#address-cells", &address_cells, -+ sizeof (address_cells), 0)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't examine #address-cells"); -+ if (grub_ieee1275_get_integer_property (root, "#size-cells", &size_cells, -+ sizeof (size_cells), 0)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't examine #size-cells"); -+ -+ if (size_cells > address_cells) -+ address_cells = size_cells; -+ -+ /* Load `/memory/reg'. */ -+ if (grub_ieee1275_finddevice ("/memory", &memory)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't find /memory node"); -+ if (grub_ieee1275_get_integer_property (memory, "reg", reg, -+ sizeof (reg), ®_size)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "couldn't examine /memory/reg property"); -+ if (reg_size < 0 || (grub_size_t) reg_size > sizeof (reg)) -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "/memory response buffer exceeded"); -+ -+ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS)) -+ { -+ address_cells = 1; -+ size_cells = 1; -+ } -+ -+ /* Decode only the size */ -+ size = reg[address_cells]; -+ if (size_cells == 2) -+ size = (size << 32) | reg[address_cells + 1]; -+ -+ *total = size; -+ -+ return grub_errno; -+} -+ -+#if defined(__powerpc__) -+ -+/* See PAPR or arch/powerpc/kernel/prom_init.c */ -+struct option_vector2 -+{ -+ grub_uint8_t byte1; -+ grub_uint16_t reserved; -+ grub_uint32_t real_base; -+ grub_uint32_t real_size; -+ grub_uint32_t virt_base; -+ grub_uint32_t virt_size; -+ grub_uint32_t load_base; -+ grub_uint32_t min_rma; -+ grub_uint32_t min_load; -+ grub_uint8_t min_rma_percent; -+ grub_uint8_t max_pft_size; -+} GRUB_PACKED; -+ -+struct pvr_entry -+{ -+ grub_uint32_t mask; -+ grub_uint32_t entry; -+}; -+ -+struct cas_vector -+{ -+ struct -+ { -+ struct pvr_entry terminal; -+ } pvr_list; -+ grub_uint8_t num_vecs; -+ grub_uint8_t vec1_size; -+ grub_uint8_t vec1; -+ grub_uint8_t vec2_size; -+ struct option_vector2 vec2; -+ grub_uint8_t vec3_size; -+ grub_uint16_t vec3; -+ grub_uint8_t vec4_size; -+ grub_uint16_t vec4; -+} GRUB_PACKED; -+ -+/* -+ * Call ibm,client-architecture-support to try to get more RMA. -+ * We ask for 512MB which should be enough to verify a distro kernel. -+ * We ignore most errors: if we don't succeed we'll proceed with whatever -+ * memory we have. -+ */ -+static void -+grub_ieee1275_ibm_cas (void) -+{ -+ int rc; -+ grub_ieee1275_ihandle_t root; -+ struct cas_args -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_ihandle_t ihandle; -+ grub_ieee1275_cell_t cas_addr; -+ grub_ieee1275_cell_t result; -+ } args; -+ struct cas_vector vector = -+ { -+ .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ -+ .num_vecs = 4 - 1, -+ .vec1_size = 0, -+ .vec1 = 0x80, /* ignore */ -+ .vec2_size = 1 + sizeof (struct option_vector2) - 2, -+ .vec2 = { -+ 0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48 -+ }, -+ .vec3_size = 2 - 1, -+ .vec3 = 0x00e0, /* ask for FP + VMX + DFP but don't halt if unsatisfied */ -+ .vec4_size = 2 - 1, -+ .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ -+ }; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); -+ args.method = (grub_ieee1275_cell_t) "ibm,client-architecture-support"; -+ rc = grub_ieee1275_open ("/", &root); -+ if (rc) -+ { -+ grub_error (GRUB_ERR_IO, "could not open root when trying to call CAS"); -+ return; -+ } -+ args.ihandle = root; -+ args.cas_addr = (grub_ieee1275_cell_t) &vector; -+ -+ grub_printf ("Calling ibm,client-architecture-support from grub..."); -+ IEEE1275_CALL_ENTRY_FN (&args); -+ grub_printf ("done\n"); -+ -+ grub_ieee1275_close (root); -+} -+ -+#endif /* __powerpc__ */ -+ -+static void - grub_claim_heap (void) - { - unsigned long total = 0; - -+#if defined(__powerpc__) -+ if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) -+ { -+ grub_uint64_t rma_size; -+ grub_err_t err; -+ -+ err = grub_ieee1275_total_mem (&rma_size); -+ /* if we have an error, don't call CAS, just hope for the best */ -+ if (err == GRUB_ERR_NONE && rma_size < (512 * 1024 * 1024)) -+ grub_ieee1275_ibm_cas (); -+ } -+#endif -+ - grub_machine_mmap_iterate (heap_init, &total); - } - #endif -diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 6a1d3e5d70..560c968460 100644 ---- a/include/grub/ieee1275/ieee1275.h -+++ b/include/grub/ieee1275/ieee1275.h -@@ -138,7 +138,17 @@ enum grub_ieee1275_flag - - GRUB_IEEE1275_FLAG_RAW_DEVNAMES, - -- GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT -+ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT, -+ -+#if defined(__powerpc__) -+ /* -+ * On PFW, the first time we boot a Linux partition, we may only get 256MB of -+ * real memory area, even if the partition has more memory. Set this flag if -+ * we think we're running under PFW. Then, if this flag is set, and the RMA is -+ * only 256MB in size, try asking for more with CAS. -+ */ -+ GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY, -+#endif - }; - - extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); diff --git a/0314-ieee1275-drop-len-1-quirk-in-heap_init.patch b/0314-ieee1275-drop-len-1-quirk-in-heap_init.patch deleted file mode 100644 index 4ce064ba..00000000 --- a/0314-ieee1275-drop-len-1-quirk-in-heap_init.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 6 Feb 2023 10:03:21 -0500 -Subject: [PATCH] ieee1275: drop len -= 1 quirk in heap_init - -This was apparently 'required by some firmware': commit dc9468500919 -("2007-02-12 Hollis Blanchard "). - -It's not clear what firmware that was, and what platform from 14 years ago -which exhibited the bug then is still both in use and buggy now. - -It doesn't cause issues on qemu (mac99 or pseries) or under PFW for Power8. - -I don't have access to old Mac hardware, but if anyone feels especially -strongly we can put it under some feature flag. I really want to disable -it under pseries because it will mess with region merging. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit fc639d430297321ee4f77c5d2d698f698cec0dc7) ---- - grub-core/kern/ieee1275/init.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 8ae405bc79..c8d551759d 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -168,7 +168,6 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - addr = 0x180000; - } - } -- len -= 1; /* Required for some firmware. */ - - /* Never exceed HEAP_MAX_SIZE */ - if (*total + len > HEAP_MAX_SIZE) diff --git a/0315-ieee1275-support-runtime-memory-claiming.patch b/0315-ieee1275-support-runtime-memory-claiming.patch deleted file mode 100644 index 17ad61d9..00000000 --- a/0315-ieee1275-support-runtime-memory-claiming.patch +++ /dev/null @@ -1,435 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 6 Feb 2023 10:03:22 -0500 -Subject: [PATCH] ieee1275: support runtime memory claiming - -On powerpc-ieee1275, we are running out of memory trying to verify -anything. This is because: - - - we have to load an entire file into memory to verify it. This is - difficult to change with appended signatures. - - We only have 32MB of heap. - - Distro kernels are now often around 30MB. - -So we want to be able to claim more memory from OpenFirmware for our heap -at runtime. - -There are some complications: - - - The grub mm code isn't the only thing that will make claims on - memory from OpenFirmware: - - * PFW/SLOF will have claimed some for their own use. - - * The ieee1275 loader will try to find other bits of memory that we - haven't claimed to place the kernel and initrd when we go to boot. - - * Once we load Linux, it will also try to claim memory. It claims - memory without any reference to /memory/available, it just starts - at min(top of RMO, 768MB) and works down. So we need to avoid this - area. See arch/powerpc/kernel/prom_init.c as of v5.11. - - - The smallest amount of memory a ppc64 KVM guest can have is 256MB. - It doesn't work with distro kernels but can work with custom kernels. - We should maintain support for that. (ppc32 can boot with even less, - and we shouldn't break that either.) - - - Even if a VM has more memory, the memory OpenFirmware makes available - as Real Memory Area can be restricted. Even with our CAS work, an LPAR - on a PowerVM box is likely to have only 512MB available to OpenFirmware - even if it has many gigabytes of memory allocated. - -What should we do? - -We don't know in advance how big the kernel and initrd are going to be, -which makes figuring out how much memory we can take a bit tricky. - -To figure out how much memory we should leave unused, I looked at: - - - an Ubuntu 20.04.1 ppc64le pseries KVM guest: - vmlinux: ~30MB - initrd: ~50MB - - - a RHEL8.2 ppc64le pseries KVM guest: - vmlinux: ~30MB - initrd: ~30MB - -So to give us a little wriggle room, I think we want to leave at least -128MB for the loader to put vmlinux and initrd in memory and leave Linux -with space to satisfy its early allocations. - -Allow other space to be allocated at runtime. - -Tested-by: Stefan Berger -Signed-off-by: Daniel Axtens -(cherry picked from commit a5c710789ccdd27a84ae4a34c7d453bd585e2b66) -[rharwood: _start?] ---- - grub-core/kern/ieee1275/init.c | 270 ++++++++++++++++++++++++++++++++++++++--- - docs/grub-dev.texi | 7 +- - 2 files changed, 257 insertions(+), 20 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index c8d551759d..85af8fa97b 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -46,13 +46,26 @@ - #endif - #include - --/* The maximum heap size we're going to claim */ -+/* The maximum heap size we're going to claim at boot. Not used by sparc. */ - #ifdef __i386__ - #define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024) --#else -+#else /* __powerpc__ */ - #define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024) - #endif - -+/* RMO max. address at 768 MB */ -+#define RMO_ADDR_MAX (grub_uint64_t) (768 * 1024 * 1024) -+ -+/* -+ * The amount of OF space we will not claim here so as to leave space for -+ * the loader and linux to service early allocations. -+ * -+ * In 2021, Daniel Axtens claims that we should leave at least 128MB to -+ * ensure we can load a stock kernel and initrd on a pseries guest with -+ * a 512MB real memory area under PowerVM. -+ */ -+#define RUNTIME_MIN_SPACE (128UL * 1024 * 1024) -+ - extern char _end[]; - - #ifdef __sparc__ -@@ -147,16 +160,52 @@ grub_claim_heap (void) - + GRUB_KERNEL_MACHINE_STACK_SIZE), 0x200000); - } - #else --/* Helper for grub_claim_heap. */ -+/* Helpers for mm on powerpc. */ -+ -+/* -+ * How much memory does OF believe exists in total? -+ * -+ * This isn't necessarily the true total. It can be the total memory -+ * accessible in real mode for a pseries guest, for example. -+ */ -+static grub_uint64_t rmo_top; -+ - static int --heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, -- void *data) -+count_free (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, -+ void *data) - { -- unsigned long *total = data; -+ if (type != GRUB_MEMORY_AVAILABLE) -+ return 0; -+ -+ /* Do not consider memory beyond 4GB */ -+ if (addr > 0xffffffffULL) -+ return 0; -+ -+ if (addr + len > 0xffffffffULL) -+ len = 0xffffffffULL - addr; -+ -+ *(grub_uint32_t *) data += len; -+ -+ return 0; -+} -+ -+static int -+regions_claim (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, -+ unsigned int flags, void *data) -+{ -+ grub_uint32_t total = *(grub_uint32_t *) data; -+ grub_uint64_t linux_rmo_save; - - if (type != GRUB_MEMORY_AVAILABLE) - return 0; - -+ /* Do not consider memory beyond 4GB */ -+ if (addr > 0xffffffffULL) -+ return 0; -+ -+ if (addr + len > 0xffffffffULL) -+ len = 0xffffffffULL - addr; -+ - if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM)) - { - if (addr + len <= 0x180000) -@@ -169,10 +218,6 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - } - } - -- /* Never exceed HEAP_MAX_SIZE */ -- if (*total + len > HEAP_MAX_SIZE) -- len = HEAP_MAX_SIZE - *total; -- - /* In theory, firmware should already prevent this from happening by not - listing our own image in /memory/available. The check below is intended - as a safeguard in case that doesn't happen. However, it doesn't protect -@@ -184,6 +229,108 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - len = 0; - } - -+ /* -+ * Linux likes to claim memory at min(RMO top, 768MB) and works down -+ * without reference to /memory/available. (See prom_init.c::alloc_down) -+ * -+ * If this block contains min(RMO top, 768MB), do not claim below that for -+ * at least a few MB (this is where RTAS, SML and potentially TCEs live). -+ * -+ * We also need to leave enough space for the DT in the RMA. (See -+ * prom_init.c::alloc_up) -+ * -+ * Finally, we also want to make sure that when grub loads the kernel, -+ * it isn't going to use up all the memory we're trying to reserve! So -+ * enforce our entire RUNTIME_MIN_SPACE here: -+ * -+ * |---------- Top of memory ----------| -+ * | | -+ * | available | -+ * | | -+ * |---------- 768 MB ----------| -+ * | | -+ * | reserved | -+ * | | -+ * |--- 768 MB - runtime min space ---| -+ * | | -+ * | available | -+ * | | -+ * |---------- 0 MB ----------| -+ * -+ * Edge cases: -+ * -+ * - Total memory less than RUNTIME_MIN_SPACE: only claim up to HEAP_MAX_SIZE. -+ * (enforced elsewhere) -+ * -+ * - Total memory between RUNTIME_MIN_SPACE and 768MB: -+ * -+ * |---------- Top of memory ----------| -+ * | | -+ * | reserved | -+ * | | -+ * |---- top - runtime min space ----| -+ * | | -+ * | available | -+ * | | -+ * |---------- 0 MB ----------| -+ * -+ * This by itself would not leave us with RUNTIME_MIN_SPACE of free bytes: if -+ * rmo_top < 768MB, we will almost certainly have FW claims in the reserved -+ * region. We try to address that elsewhere: grub_ieee1275_mm_add_region will -+ * not call us if the resulting free space would be less than RUNTIME_MIN_SPACE. -+ */ -+ linux_rmo_save = grub_min (RMO_ADDR_MAX, rmo_top) - RUNTIME_MIN_SPACE; -+ if (rmo_top > RUNTIME_MIN_SPACE) -+ { -+ if (rmo_top <= RMO_ADDR_MAX) -+ { -+ if (addr > linux_rmo_save) -+ { -+ grub_dprintf ("ieee1275", "rejecting region in RUNTIME_MIN_SPACE reservation (%llx)\n", -+ addr); -+ return 0; -+ } -+ else if (addr + len > linux_rmo_save) -+ { -+ grub_dprintf ("ieee1275", "capping region: (%llx -> %llx) -> (%llx -> %llx)\n", -+ addr, addr + len, addr, rmo_top - RUNTIME_MIN_SPACE); -+ len = linux_rmo_save - addr; -+ } -+ } -+ else -+ { -+ /* -+ * we order these cases to prefer higher addresses and avoid some -+ * splitting issues -+ */ -+ if (addr < RMO_ADDR_MAX && (addr + len) > RMO_ADDR_MAX) -+ { -+ grub_dprintf ("ieee1275", -+ "adjusting region for RUNTIME_MIN_SPACE: (%llx -> %llx) -> (%llx -> %llx)\n", -+ addr, addr + len, RMO_ADDR_MAX, addr + len); -+ len = (addr + len) - RMO_ADDR_MAX; -+ addr = RMO_ADDR_MAX; -+ } -+ else if ((addr < linux_rmo_save) && ((addr + len) > linux_rmo_save)) -+ { -+ grub_dprintf ("ieee1275", "capping region: (%llx -> %llx) -> (%llx -> %llx)\n", -+ addr, addr + len, addr, linux_rmo_save); -+ len = linux_rmo_save - addr; -+ } -+ else if (addr >= linux_rmo_save && (addr + len) <= RMO_ADDR_MAX) -+ { -+ grub_dprintf ("ieee1275", "rejecting region in RUNTIME_MIN_SPACE reservation (%llx)\n", -+ addr); -+ return 0; -+ } -+ } -+ } -+ if (flags & GRUB_MM_ADD_REGION_CONSECUTIVE && len < total) -+ return 0; -+ -+ if (len > total) -+ len = total; -+ - if (len) - { - grub_err_t err; -@@ -192,15 +339,95 @@ heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - if (err) - return err; - grub_mm_init_region ((void *) (grub_addr_t) addr, len); -+ total -= len; - } - -- *total += len; -- if (*total >= HEAP_MAX_SIZE) -+ *(grub_uint32_t *) data = total; -+ -+ if (total == 0) - return 1; - - return 0; - } - -+static int -+heap_init (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, -+ void *data) -+{ -+ return regions_claim (addr, len, type, GRUB_MM_ADD_REGION_NONE, data); -+} -+ -+static int -+region_claim (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, -+ void *data) -+{ -+ return regions_claim (addr, len, type, GRUB_MM_ADD_REGION_CONSECUTIVE, data); -+} -+ -+static grub_err_t -+grub_ieee1275_mm_add_region (grub_size_t size, unsigned int flags) -+{ -+ grub_uint32_t free_memory = 0; -+ grub_uint32_t avail = 0; -+ grub_uint32_t total; -+ -+ grub_dprintf ("ieee1275", "mm requested region of size %x, flags %x\n", -+ size, flags); -+ -+ /* -+ * Update free memory each time, which is a bit inefficient but guards us -+ * against a situation where some OF driver goes out to firmware for -+ * memory and we don't realise. -+ */ -+ grub_machine_mmap_iterate (count_free, &free_memory); -+ -+ /* Ensure we leave enough space to boot. */ -+ if (free_memory <= RUNTIME_MIN_SPACE + size) -+ { -+ grub_dprintf ("ieee1275", "Cannot satisfy allocation and retain minimum runtime space\n"); -+ return GRUB_ERR_OUT_OF_MEMORY; -+ } -+ -+ if (free_memory > RUNTIME_MIN_SPACE) -+ avail = free_memory - RUNTIME_MIN_SPACE; -+ -+ grub_dprintf ("ieee1275", "free = 0x%x available = 0x%x\n", free_memory, avail); -+ -+ if (flags & GRUB_MM_ADD_REGION_CONSECUTIVE) -+ { -+ /* first try rounding up hard for the sake of speed */ -+ total = grub_max (ALIGN_UP (size, 1024 * 1024) + 1024 * 1024, 32 * 1024 * 1024); -+ total = grub_min (avail, total); -+ -+ grub_dprintf ("ieee1275", "looking for %x bytes of memory (%x requested)\n", total, size); -+ -+ grub_machine_mmap_iterate (region_claim, &total); -+ grub_dprintf ("ieee1275", "get memory from fw %s\n", total == 0 ? "succeeded" : "failed"); -+ -+ if (total != 0) -+ { -+ total = grub_min (avail, size); -+ -+ grub_dprintf ("ieee1275", "fallback for %x bytes of memory (%x requested)\n", total, size); -+ -+ grub_machine_mmap_iterate (region_claim, &total); -+ grub_dprintf ("ieee1275", "fallback from fw %s\n", total == 0 ? "succeeded" : "failed"); -+ } -+ } -+ else -+ { -+ /* provide padding for a grub_mm_header_t and region */ -+ total = grub_min (avail, size); -+ grub_machine_mmap_iterate (heap_init, &total); -+ grub_dprintf ("ieee1275", "get noncontig memory from fw %s\n", total == 0 ? "succeeded" : "failed"); -+ } -+ -+ if (total == 0) -+ return GRUB_ERR_NONE; -+ else -+ return GRUB_ERR_OUT_OF_MEMORY; -+} -+ - /* - * How much memory does OF believe it has? (regardless of whether - * it's accessible or not) -@@ -356,17 +583,24 @@ grub_ieee1275_ibm_cas (void) - static void - grub_claim_heap (void) - { -- unsigned long total = 0; -+ grub_err_t err; -+ grub_uint32_t total = HEAP_MAX_SIZE; -+ -+ err = grub_ieee1275_total_mem (&rmo_top); -+ -+ /* -+ * If we cannot size the available memory, we can't be sure we're leaving -+ * space for the kernel, initrd and things Linux loads early in boot. So only -+ * allow further allocations from firmware on success -+ */ -+ if (err == GRUB_ERR_NONE) -+ grub_mm_add_region_fn = grub_ieee1275_mm_add_region; - - #if defined(__powerpc__) - if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) - { -- grub_uint64_t rma_size; -- grub_err_t err; -- -- err = grub_ieee1275_total_mem (&rma_size); - /* if we have an error, don't call CAS, just hope for the best */ -- if (err == GRUB_ERR_NONE && rma_size < (512 * 1024 * 1024)) -+ if (err == GRUB_ERR_NONE && rmo_top < (512 * 1024 * 1024)) - grub_ieee1275_ibm_cas (); - } - #endif -diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi -index 7b2455a8fe..7edc5b7e2b 100644 ---- a/docs/grub-dev.texi -+++ b/docs/grub-dev.texi -@@ -1047,7 +1047,10 @@ space is limited to 4GiB. GRUB allocates pages from EFI for its heap, at most - 1.6 GiB. - - On i386-ieee1275 and powerpc-ieee1275 GRUB uses same stack as IEEE1275. --It allocates at most 32MiB for its heap. -+ -+On i386-ieee1275 and powerpc-ieee1275, GRUB will allocate 32MiB for its heap on -+startup. It may allocate more at runtime, as long as at least 128MiB remain free -+in OpenFirmware. - - On sparc64-ieee1275 stack is 256KiB and heap is 2MiB. - -@@ -1075,7 +1078,7 @@ In short: - @item i386-qemu @tab 60 KiB @tab < 4 GiB - @item *-efi @tab ? @tab < 1.6 GiB - @item i386-ieee1275 @tab ? @tab < 32 MiB --@item powerpc-ieee1275 @tab ? @tab < 32 MiB -+@item powerpc-ieee1275 @tab ? @tab available memory - 128MiB - @item sparc64-ieee1275 @tab 256KiB @tab 2 MiB - @item arm-uboot @tab 256KiB @tab 2 MiB - @item mips(el)-qemu_mips @tab 2MiB @tab 253 MiB diff --git a/0316-ieee1275-implement-vec5-for-cas-negotiation.patch b/0316-ieee1275-implement-vec5-for-cas-negotiation.patch deleted file mode 100644 index fad39db7..00000000 --- a/0316-ieee1275-implement-vec5-for-cas-negotiation.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Diego Domingos -Date: Mon, 6 Feb 2023 10:03:23 -0500 -Subject: [PATCH] ieee1275: implement vec5 for cas negotiation - -As a legacy support, if the vector 5 is not implemented, Power Hypervisor will -consider the max CPUs as 64 instead 256 currently supported during -client-architecture-support negotiation. - -This patch implements the vector 5 and set the MAX CPUs to 256 while setting the -others values to 0 (default). - -Signed-off-by: Diego Domingos -Acked-by: Daniel Axtens -Signed-off-by: Stefan Berger -Signed-off-by: Avnish Chouhan -(cherry picked from commit 942f19959fe7465fb52a1da39ff271a7ab704892) ---- - grub-core/kern/ieee1275/init.c | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 85af8fa97b..72d4fed312 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -502,6 +502,19 @@ struct option_vector2 - grub_uint8_t max_pft_size; - } GRUB_PACKED; - -+struct option_vector5 -+{ -+ grub_uint8_t byte1; -+ grub_uint8_t byte2; -+ grub_uint8_t byte3; -+ grub_uint8_t cmo; -+ grub_uint8_t associativity; -+ grub_uint8_t bin_opts; -+ grub_uint8_t micro_checkpoint; -+ grub_uint8_t reserved0; -+ grub_uint32_t max_cpus; -+} GRUB_PACKED; -+ - struct pvr_entry - { - grub_uint32_t mask; -@@ -523,6 +536,8 @@ struct cas_vector - grub_uint16_t vec3; - grub_uint8_t vec4_size; - grub_uint16_t vec4; -+ grub_uint8_t vec5_size; -+ struct option_vector5 vec5; - } GRUB_PACKED; - - /* -@@ -547,7 +562,7 @@ grub_ieee1275_ibm_cas (void) - struct cas_vector vector = - { - .pvr_list = { { 0x00000000, 0xffffffff } }, /* any processor */ -- .num_vecs = 4 - 1, -+ .num_vecs = 5 - 1, - .vec1_size = 0, - .vec1 = 0x80, /* ignore */ - .vec2_size = 1 + sizeof (struct option_vector2) - 2, -@@ -558,6 +573,10 @@ grub_ieee1275_ibm_cas (void) - .vec3 = 0x00e0, /* ask for FP + VMX + DFP but don't halt if unsatisfied */ - .vec4_size = 2 - 1, - .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ -+ .vec5_size = 1 + sizeof (struct option_vector5) - 2, -+ .vec5 = { -+ 0, 192, 0, 128, 0, 0, 0, 0, 256 -+ } - }; - - INIT_IEEE1275_COMMON (&args.common, "call-method", 3, 2); diff --git a/0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch b/0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch deleted file mode 100644 index 02c02829..00000000 --- a/0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch +++ /dev/null @@ -1,246 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Stefan Berger -Date: Mon, 6 Feb 2023 10:03:25 -0500 -Subject: [PATCH] ibmvtpm: Add support for trusted boot using a vTPM 2.0 - -Add support for trusted boot using a vTPM 2.0 on the IBM IEEE1275 -PowerPC platform. With this patch grub now measures text and binary data -into the TPM's PCRs 8 and 9 in the same way as the x86_64 platform -does. - -This patch requires Daniel Axtens's patches for claiming more memory. - -Note: The tpm_init() function cannot be called from GRUB_MOD_INIT() since -it does not find the device nodes upon module initialization and -therefore the call to tpm_init() must be deferred to grub_tpm_measure(). - -For vTPM support to work on PowerVM, system driver levels 1010.30 -or 1020.00 are required. - -Note: Previous versions of firmware levels with the 2hash-ext-log -API call have a bug that, once this API call is invoked, has the -effect of disabling the vTPM driver under Linux causing an error -message to be displayed in the Linux kernel log. Those users will -have to update their machines to the firmware levels mentioned -above. - -Cc: Eric Snowberg -Signed-off-by: Stefan Berger -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit 2aa5ef83743dfea79377309ff4f5e9c9a55de355) ---- - grub-core/Makefile.core.def | 7 ++ - grub-core/commands/ieee1275/ibmvtpm.c | 155 ++++++++++++++++++++++++++++++++++ - include/grub/ieee1275/ieee1275.h | 3 + - docs/grub.texi | 3 +- - 4 files changed, 167 insertions(+), 1 deletion(-) - create mode 100644 grub-core/commands/ieee1275/ibmvtpm.c - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index f21da23213..02ea718652 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -1175,6 +1175,13 @@ module = { - enable = powerpc_ieee1275; - }; - -+module = { -+ name = tpm; -+ common = commands/tpm.c; -+ ieee1275 = commands/ieee1275/ibmvtpm.c; -+ enable = powerpc_ieee1275; -+}; -+ - module = { - name = terminal; - common = commands/terminal.c; -diff --git a/grub-core/commands/ieee1275/ibmvtpm.c b/grub-core/commands/ieee1275/ibmvtpm.c -new file mode 100644 -index 0000000000..239942d27e ---- /dev/null -+++ b/grub-core/commands/ieee1275/ibmvtpm.c -@@ -0,0 +1,155 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2022 Free Software Foundation, Inc. -+ * Copyright (C) 2022 IBM Corporation -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ * -+ * IBM vTPM support code. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static grub_ieee1275_ihandle_t tpm_ihandle; -+static grub_uint8_t tpm_version; -+ -+#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_ihandle_t) 0) -+ -+static void -+tpm_get_tpm_version (void) -+{ -+ grub_ieee1275_phandle_t vtpm; -+ char buffer[20]; -+ -+ if (!grub_ieee1275_finddevice ("/vdevice/vtpm", &vtpm) && -+ !grub_ieee1275_get_property (vtpm, "compatible", buffer, -+ sizeof (buffer), NULL) && -+ !grub_strcmp (buffer, "IBM,vtpm20")) -+ tpm_version = 2; -+} -+ -+static grub_err_t -+tpm_init (void) -+{ -+ static int init_success = 0; -+ -+ if (!init_success) -+ { -+ if (grub_ieee1275_open ("/vdevice/vtpm", &tpm_ihandle) < 0) -+ { -+ tpm_ihandle = IEEE1275_IHANDLE_INVALID; -+ return GRUB_ERR_UNKNOWN_DEVICE; -+ } -+ -+ init_success = 1; -+ -+ tpm_get_tpm_version (); -+ } -+ -+ return GRUB_ERR_NONE; -+} -+ -+static int -+ibmvtpm_2hash_ext_log (grub_uint8_t pcrindex, -+ grub_uint32_t eventtype, -+ const char *description, -+ grub_size_t description_size, -+ void *buf, grub_size_t size) -+{ -+ struct tpm_2hash_ext_log -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t size; -+ grub_ieee1275_cell_t buf; -+ grub_ieee1275_cell_t description_size; -+ grub_ieee1275_cell_t description; -+ grub_ieee1275_cell_t eventtype; -+ grub_ieee1275_cell_t pcrindex; -+ grub_ieee1275_cell_t catch_result; -+ grub_ieee1275_cell_t rc; -+ }; -+ struct tpm_2hash_ext_log args; -+ -+ INIT_IEEE1275_COMMON (&args.common, "call-method", 8, 2); -+ args.method = (grub_ieee1275_cell_t) "2hash-ext-log"; -+ args.ihandle = tpm_ihandle; -+ args.pcrindex = pcrindex; -+ args.eventtype = eventtype; -+ args.description = (grub_ieee1275_cell_t) description; -+ args.description_size = description_size; -+ args.buf = (grub_ieee1275_cell_t) buf; -+ args.size = (grub_ieee1275_cell_t) size; -+ -+ if (IEEE1275_CALL_ENTRY_FN (&args) == -1) -+ return -1; -+ -+ /* -+ * catch_result is set if firmware does not support 2hash-ext-log -+ * rc is GRUB_IEEE1275_CELL_FALSE (0) on failure -+ */ -+ if ((args.catch_result) || args.rc == GRUB_IEEE1275_CELL_FALSE) -+ return -1; -+ -+ return 0; -+} -+ -+static grub_err_t -+tpm2_log_event (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ static int error_displayed = 0; -+ int rc; -+ -+ rc = ibmvtpm_2hash_ext_log (pcr, EV_IPL, -+ description, grub_strlen(description) + 1, -+ buf, size); -+ if (rc && !error_displayed) -+ { -+ error_displayed++; -+ return grub_error (GRUB_ERR_BAD_DEVICE, -+ "2HASH-EXT-LOG failed: Firmware is likely too old.\n"); -+ } -+ -+ return GRUB_ERR_NONE; -+} -+ -+grub_err_t -+grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ /* -+ * Call tpm_init() 'late' rather than from GRUB_MOD_INIT() so that device nodes -+ * can be found. -+ */ -+ grub_err_t err = tpm_init (); -+ -+ /* Absence of a TPM isn't a failure. */ -+ if (err != GRUB_ERR_NONE) -+ return GRUB_ERR_NONE; -+ -+ grub_dprintf ("tpm", "log_event, pcr = %d, size = 0x%" PRIxGRUB_SIZE ", %s\n", -+ pcr, size, description); -+ -+ if (tpm_version == 2) -+ return tpm2_log_event (buf, size, pcr, description); -+ -+ return GRUB_ERR_NONE; -+} -diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h -index 560c968460..27b9cf259b 100644 ---- a/include/grub/ieee1275/ieee1275.h -+++ b/include/grub/ieee1275/ieee1275.h -@@ -24,6 +24,9 @@ - #include - #include - -+#define GRUB_IEEE1275_CELL_FALSE ((grub_ieee1275_cell_t) 0) -+#define GRUB_IEEE1275_CELL_TRUE ((grub_ieee1275_cell_t) -1) -+ - struct grub_ieee1275_mem_region - { - unsigned int start; -diff --git a/docs/grub.texi b/docs/grub.texi -index 1750b72ee9..825278a7f3 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -6235,7 +6235,8 @@ tpm module is loaded. As such it is recommended that the tpm module be built - into @file{core.img} in order to avoid a potential gap in measurement between - @file{core.img} being loaded and the tpm module being loaded. - --Measured boot is currently only supported on EFI platforms. -+Measured boot is currently only supported on EFI and IBM IEEE1275 PowerPC -+platforms. - - @node Lockdown - @section Lockdown when booting on a secure setup diff --git a/0318-powerpc-Drop-Open-Hack-Ware.patch b/0318-powerpc-Drop-Open-Hack-Ware.patch deleted file mode 100644 index 1d201d3f..00000000 --- a/0318-powerpc-Drop-Open-Hack-Ware.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Axtens -Date: Mon, 6 Sep 2021 15:46:11 +1000 -Subject: [PATCH] powerpc: Drop Open Hack'Ware - -Open Hack'Ware was an alternative firmware of powerpc under QEMU. - -The last commit to any Open Hack'Ware repo I can find is from 2014 [1]. - -Open Hack'Ware was used for the QEMU "prep" machine type, which was -deprecated in QEMU in commit 54c86f5a4844 (hw/ppc: deprecate the -machine type 'prep', replaced by '40p') in QEMU v3.1, and had reportedly -been broken for years before without anyone noticing. Support was removed -in February 2020 by commit b2ce76a0730e (hw/ppc/prep: Remove the -deprecated "prep" machine and the OpenHackware BIOS). - -Open Hack'Ware's limitations require some messy code in GRUB. This -complexity is not worth carrying any more. - -Remove detection of Open Hack'Ware. We will clean up the feature flags -in following commits. - -[1]: https://github.com/qemu/openhackware and - https://repo.or.cz/w/openhackware.git are QEMU submodules. They have - only small changes on top of OHW v0.4.1, which was imported into - QEMU SCM in 2010. I can't find anything resembling an official repo - any more. - -Signed-off-by: Daniel Axtens -Reviewed-by: Daniel Kiper -(cherry picked from commit f9ce538eec88c5cffbfde021c4e8a95a5e9d0e8f) ---- - grub-core/kern/ieee1275/cmain.c | 16 ---------------- - 1 file changed, 16 deletions(-) - -diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c -index dce7b84922..cb42f60ebe 100644 ---- a/grub-core/kern/ieee1275/cmain.c -+++ b/grub-core/kern/ieee1275/cmain.c -@@ -49,7 +49,6 @@ grub_ieee1275_find_options (void) - grub_ieee1275_phandle_t root; - grub_ieee1275_phandle_t options; - grub_ieee1275_phandle_t openprom; -- grub_ieee1275_phandle_t bootrom; - int rc; - grub_uint32_t realmode = 0; - char tmp[256]; -@@ -198,21 +197,6 @@ grub_ieee1275_find_options (void) - - grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_HAS_CURSORONOFF); - } -- -- if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom) -- || ! grub_ieee1275_finddevice ("/boot-rom", &bootrom)) -- { -- rc = grub_ieee1275_get_property (bootrom, "model", tmp, sizeof (tmp), 0); -- if (rc >= 0 && !grub_strncmp (tmp, "PPC Open Hack'Ware", -- sizeof ("PPC Open Hack'Ware") - 1)) -- { -- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT); -- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS); -- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET); -- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM); -- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_ANSI); -- } -- } - } - - void diff --git a/0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch b/0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch deleted file mode 100644 index 6e7b17fe..00000000 --- a/0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mukesh Kumar Chaurasiya -Date: Thu, 9 Feb 2023 13:09:16 +0530 -Subject: [PATCH] osdep/linux/hostdisk: Modify sector by sysfs as disk sector - -The disk sector size provided by sysfs file system considers the sector -size of 512 irrespective of disk sector size, thus causing the read by -the GRUB to an incorrect offset from what was originally intended. - -Considering the 512 sector size of sysfs data the actual sector needs to -be modified corresponding to disk sector size. - -Signed-off-by: Mukesh Kumar Chaurasiya -Reviewed-by: Daniel Kiper -(cherry picked from commit f7564844f82b57078d601befadc438b5bc1fa01b) ---- - grub-core/osdep/linux/hostdisk.c | 7 ++++--- - include/grub/disk.h | 7 +++++++ - 2 files changed, 11 insertions(+), 3 deletions(-) - -diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c -index 7bc99ac1c1..a9ea0bb465 100644 ---- a/grub-core/osdep/linux/hostdisk.c -+++ b/grub-core/osdep/linux/hostdisk.c -@@ -240,7 +240,8 @@ have_devfs (void) - #pragma GCC diagnostic ignored "-Wformat-nonliteral" - - static int --grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector) -+grub_hostdisk_linux_find_partition (const grub_disk_t disk, char *dev, -+ grub_disk_addr_t sector) - { - size_t len = strlen (dev); - const char *format; -@@ -305,7 +306,7 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector) - if (fstat (fd, &st) < 0 - || !grub_util_device_is_mapped_stat (&st) - || !grub_util_get_dm_node_linear_info (st.st_rdev, 0, 0, &start)) -- start = grub_util_find_partition_start_os (real_dev); -+ start = grub_disk_to_native_sector (disk, grub_util_find_partition_start_os (real_dev)); - /* We don't care about errors here. */ - grub_errno = GRUB_ERR_NONE; - -@@ -386,7 +387,7 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f - && strncmp (dev, "/dev/", 5) == 0) - { - if (sector >= part_start) -- is_partition = grub_hostdisk_linux_find_partition (dev, part_start); -+ is_partition = grub_hostdisk_linux_find_partition (disk, dev, part_start); - else - *max = part_start - sector; - } -diff --git a/include/grub/disk.h b/include/grub/disk.h -index 06210a7049..881addcc77 100644 ---- a/include/grub/disk.h -+++ b/include/grub/disk.h -@@ -208,6 +208,13 @@ grub_disk_from_native_sector (grub_disk_t disk, grub_disk_addr_t sector) - return sector << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); - } - -+/* Convert from GRUB native disk sized sector to disk sized sector. */ -+static inline grub_disk_addr_t -+grub_disk_to_native_sector (grub_disk_t disk, grub_disk_addr_t sector) -+{ -+ return sector >> (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); -+} -+ - /* This is called from the memory manager. */ - void grub_disk_cache_invalidate_all (void); - diff --git a/0320-mm-Adjust-new-region-size-to-take-management-overhea.patch b/0320-mm-Adjust-new-region-size-to-take-management-overhea.patch deleted file mode 100644 index 456f8f7d..00000000 --- a/0320-mm-Adjust-new-region-size-to-take-management-overhea.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Sun, 29 Jan 2023 19:49:31 +0800 -Subject: [PATCH] mm: Adjust new region size to take management overhead into - account - -When grub_memalign() encounters out-of-memory, it will try -grub_mm_add_region_fn() to request more memory from system firmware. -However, the size passed to it doesn't take region management overhead -into account. Adding a memory area of "size" bytes may result in a heap -region of less than "size" bytes really available. Thus, the new region -may not be adequate for current allocation request, confusing -out-of-memory handling code. - -This patch introduces GRUB_MM_MGMT_OVERHEAD to address the region -management overhead (e.g. metadata, padding). The value of this new -constant must be large enough to make sure grub_memalign(align, size) -always succeeds after a successful call to - grub_mm_init_region(addr, size + align + GRUB_MM_MGMT_OVERHEAD), -for any given addr and size (assuming no integer overflow). - -The size passed to grub_mm_add_region_fn() is now correctly adjusted, -thus if grub_mm_add_region_fn() succeeded, current allocation request -can always succeed. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 2282cbfe5aa1ff6c1bbcbdcd2003089ad7c03ba3) ---- - grub-core/kern/mm.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 61 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index da1ac9427c..f29a3e5cbd 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -83,6 +83,46 @@ - - - -+/* -+ * GRUB_MM_MGMT_OVERHEAD is an upper bound of management overhead of -+ * each region, with any possible padding taken into account. -+ * -+ * The value must be large enough to make sure grub_memalign(align, size) -+ * always succeeds after a successful call to -+ * grub_mm_init_region(addr, size + align + GRUB_MM_MGMT_OVERHEAD), -+ * for any given addr, align and size (assuming no interger overflow). -+ * -+ * The worst case which has maximum overhead is shown in the figure below: -+ * -+ * +-- addr -+ * v |<- size + align ->| -+ * +---------+----------------+----------------+------------------+---------+ -+ * | padding | grub_mm_region | grub_mm_header | usable bytes | padding | -+ * +---------+----------------+----------------+------------------+---------+ -+ * |<- a ->|<- b ->|<- c ->|<- d ->|<- e ->| -+ * ^ -+ * b == sizeof (struct grub_mm_region) | / Assuming no other suitable -+ * c == sizeof (struct grub_mm_header) | | block is available, then: -+ * d == size + align +-| If align == 0, this will be -+ * | the pointer returned by next -+ * Assuming addr % GRUB_MM_ALIGN == 1, then: | grub_memalign(align, size). -+ * a == GRUB_MM_ALIGN - 1 | If align > 0, this chunk may -+ * | need to be split to fulfill -+ * Assuming d % GRUB_MM_ALIGN == 1, then: | alignment requirements, and -+ * e == GRUB_MM_ALIGN - 1 | the returned pointer may be -+ * \ inside these usable bytes. -+ * Therefore, the maximum overhead is: -+ * a + b + c + e == (GRUB_MM_ALIGN - 1) + sizeof (struct grub_mm_region) -+ * + sizeof (struct grub_mm_header) + (GRUB_MM_ALIGN - 1) -+ */ -+#define GRUB_MM_MGMT_OVERHEAD ((GRUB_MM_ALIGN - 1) \ -+ + sizeof (struct grub_mm_region) \ -+ + sizeof (struct grub_mm_header) \ -+ + (GRUB_MM_ALIGN - 1)) -+ -+/* The size passed to grub_mm_add_region_fn() is aligned up by this value. */ -+#define GRUB_MM_HEAP_GROW_ALIGN 4096 -+ - grub_mm_region_t grub_mm_base; - grub_mm_add_region_func_t grub_mm_add_region_fn; - -@@ -230,6 +270,11 @@ grub_mm_init_region (void *addr, grub_size_t size) - - grub_dprintf ("regions", "No: considering a new region at %p of size %" PRIxGRUB_SIZE "\n", - addr, size); -+ /* -+ * If you want to modify the code below, please also take a look at -+ * GRUB_MM_MGMT_OVERHEAD and make sure it is synchronized with the code. -+ */ -+ - /* Allocate a region from the head. */ - r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); - -@@ -410,6 +455,7 @@ grub_memalign (grub_size_t align, grub_size_t size) - { - grub_mm_region_t r; - grub_size_t n = ((size + GRUB_MM_ALIGN - 1) >> GRUB_MM_ALIGN_LOG2) + 1; -+ grub_size_t grow; - int count = 0; - - if (!grub_mm_base) -@@ -418,10 +464,22 @@ grub_memalign (grub_size_t align, grub_size_t size) - if (size > ~(grub_size_t) align) - goto fail; - -+ /* -+ * Pre-calculate the necessary size of heap growth (if applicable), -+ * with region management overhead taken into account. -+ */ -+ if (grub_add (size + align, GRUB_MM_MGMT_OVERHEAD, &grow)) -+ goto fail; -+ -+ /* Align up heap growth to make it friendly to CPU/MMU. */ -+ if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) -+ goto fail; -+ grow = ALIGN_UP (grow, GRUB_MM_HEAP_GROW_ALIGN); -+ - /* We currently assume at least a 32-bit grub_size_t, - so limiting allocations to - 1MiB - in name of sanity is beneficial. */ -- if ((size + align) > ~(grub_size_t) 0x100000) -+ if (grow > ~(grub_size_t) 0x100000) - goto fail; - - align = (align >> GRUB_MM_ALIGN_LOG2); -@@ -447,7 +505,7 @@ grub_memalign (grub_size_t align, grub_size_t size) - count++; - - if (grub_mm_add_region_fn != NULL && -- grub_mm_add_region_fn (size, GRUB_MM_ADD_REGION_CONSECUTIVE) == GRUB_ERR_NONE) -+ grub_mm_add_region_fn (grow, GRUB_MM_ADD_REGION_CONSECUTIVE) == GRUB_ERR_NONE) - goto again; - - /* fallthrough */ -@@ -462,7 +520,7 @@ grub_memalign (grub_size_t align, grub_size_t size) - * Try again even if this fails, in case it was able to partially - * satisfy the request - */ -- grub_mm_add_region_fn (size, GRUB_MM_ADD_REGION_NONE); -+ grub_mm_add_region_fn (grow, GRUB_MM_ADD_REGION_NONE); - goto again; - } - diff --git a/0321-mm-Preallocate-some-space-when-adding-new-regions.patch b/0321-mm-Preallocate-some-space-when-adding-new-regions.patch deleted file mode 100644 index 291092d2..00000000 --- a/0321-mm-Preallocate-some-space-when-adding-new-regions.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Sun, 29 Jan 2023 19:49:32 +0800 -Subject: [PATCH] mm: Preallocate some space when adding new regions - -When grub_memalign() encounters out-of-memory, it will try -grub_mm_add_region_fn() to request more memory from system firmware. -However, it doesn't preallocate memory space for future allocation -requests. In extreme cases, it requires one call to -grub_mm_add_region_fn() for each memory allocation request. This can -be very slow. - -This patch introduces GRUB_MM_HEAP_GROW_EXTRA, the minimal heap growth -granularity. The new region size is now set to the bigger one of its -original value and GRUB_MM_HEAP_GROW_EXTRA. Thus, it will result in some -memory space preallocated if current allocations request is small. - -The value of GRUB_MM_HEAP_GROW_EXTRA is set to 1MB. If this value is -smaller, the cost of small memory allocations will be higher. If this -value is larger, more memory will be wasted and it might cause -out-of-memory on machines with small amount of RAM. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 21869baec15239b6d99122b32b14a778af4c754f) ---- - grub-core/kern/mm.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index f29a3e5cbd..cc8a4703bc 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -123,6 +123,9 @@ - /* The size passed to grub_mm_add_region_fn() is aligned up by this value. */ - #define GRUB_MM_HEAP_GROW_ALIGN 4096 - -+/* Minimal heap growth granularity when existing heap space is exhausted. */ -+#define GRUB_MM_HEAP_GROW_EXTRA 0x100000 -+ - grub_mm_region_t grub_mm_base; - grub_mm_add_region_func_t grub_mm_add_region_fn; - -@@ -471,6 +474,9 @@ grub_memalign (grub_size_t align, grub_size_t size) - if (grub_add (size + align, GRUB_MM_MGMT_OVERHEAD, &grow)) - goto fail; - -+ /* Preallocate some extra space if heap growth is small. */ -+ grow = grub_max (grow, GRUB_MM_HEAP_GROW_EXTRA); -+ - /* Align up heap growth to make it friendly to CPU/MMU. */ - if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) - goto fail; diff --git a/0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch b/0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch deleted file mode 100644 index fe6b3e16..00000000 --- a/0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zhang Boyang -Date: Sun, 29 Jan 2023 19:49:33 +0800 -Subject: [PATCH] mm: Avoid complex heap growth math in hot path - -We do a lot of math about heap growth in hot path of grub_memalign(). -However, the result is only used if out of memory is encountered, which -is seldom. - -This patch moves these calculations away from hot path. These -calculations are now only done if out of memory is encountered. This -change can also help compiler to optimize integer overflow checks away. - -Signed-off-by: Zhang Boyang -Reviewed-by: Daniel Kiper -(cherry picked from commit 65bc45963014773e2062ccc63ff34a089d2e352e) ---- - grub-core/kern/mm.c | 34 ++++++++++++++++++++-------------- - 1 file changed, 20 insertions(+), 14 deletions(-) - -diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c -index cc8a4703bc..630d7be0e2 100644 ---- a/grub-core/kern/mm.c -+++ b/grub-core/kern/mm.c -@@ -467,20 +467,7 @@ grub_memalign (grub_size_t align, grub_size_t size) - if (size > ~(grub_size_t) align) - goto fail; - -- /* -- * Pre-calculate the necessary size of heap growth (if applicable), -- * with region management overhead taken into account. -- */ -- if (grub_add (size + align, GRUB_MM_MGMT_OVERHEAD, &grow)) -- goto fail; -- -- /* Preallocate some extra space if heap growth is small. */ -- grow = grub_max (grow, GRUB_MM_HEAP_GROW_EXTRA); -- -- /* Align up heap growth to make it friendly to CPU/MMU. */ -- if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) -- goto fail; -- grow = ALIGN_UP (grow, GRUB_MM_HEAP_GROW_ALIGN); -+ grow = size + align; - - /* We currently assume at least a 32-bit grub_size_t, - so limiting allocations to - 1MiB -@@ -510,6 +497,25 @@ grub_memalign (grub_size_t align, grub_size_t size) - /* Request additional pages, contiguous */ - count++; - -+ /* -+ * Calculate the necessary size of heap growth (if applicable), -+ * with region management overhead taken into account. -+ */ -+ if (grub_add (grow, GRUB_MM_MGMT_OVERHEAD, &grow)) -+ goto fail; -+ -+ /* Preallocate some extra space if heap growth is small. */ -+ grow = grub_max (grow, GRUB_MM_HEAP_GROW_EXTRA); -+ -+ /* Align up heap growth to make it friendly to CPU/MMU. */ -+ if (grow > ~(grub_size_t) (GRUB_MM_HEAP_GROW_ALIGN - 1)) -+ goto fail; -+ grow = ALIGN_UP (grow, GRUB_MM_HEAP_GROW_ALIGN); -+ -+ /* Do the same sanity check again. */ -+ if (grow > ~(grub_size_t) 0x100000) -+ goto fail; -+ - if (grub_mm_add_region_fn != NULL && - grub_mm_add_region_fn (grow, GRUB_MM_ADD_REGION_CONSECUTIVE) == GRUB_ERR_NONE) - goto again; diff --git a/0325-emu-linux-work-around-systemctl-kexec-returning.patch b/0325-emu-linux-work-around-systemctl-kexec-returning.patch deleted file mode 100644 index eaef5ff1..00000000 --- a/0325-emu-linux-work-around-systemctl-kexec-returning.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Robbie Harwood -Date: Wed, 22 Mar 2023 14:19:43 -0400 -Subject: [PATCH] emu/linux: work around systemctl kexec returning - -Per systemctl(1), it "is asynchronous; it will return after the reboot -operation is enqueued, without waiting for it to complete". This -differs from kexec(8), which calls reboot(2) and therefore does not -return. - -When not using fallback, this results in the confusing-but-harmless: - - error trying to perform 'systemctl kexec': 0 - Aborted. Press any key to exit. - -on screen for a bit, followed by successful kexec. - -To reduce the liklihood of hitting this case, add a delay on succesful -return. Ultimately, the systemd interface is racy: we can't avoid it -entirely unless we never fallback on success. - -Signed-off-by: Robbie Harwood ---- - grub-core/loader/emu/linux.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c -index 0cf378a376..7de3f7f861 100644 ---- a/grub-core/loader/emu/linux.c -+++ b/grub-core/loader/emu/linux.c -@@ -74,6 +74,10 @@ grub_linux_boot (void) - (kexecute==1) ? "do-or-die" : "just-in-case"); - rc = grub_util_exec (systemctl); - -+ /* `systemctl kexec` is "asynchronous" and will return even on success. */ -+ if (rc == 0) -+ grub_sleep (10); -+ - if (kexecute == 1) - grub_fatal (N_("error trying to perform 'systemctl kexec': %d"), rc); - diff --git a/0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch b/0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch deleted file mode 100644 index ca82e33c..00000000 --- a/0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Avnish Chouhan -Date: Mon, 27 Mar 2023 12:25:39 +0530 -Subject: [PATCH] kern/ieee1275/init: Convert plain numbers to constants in - Vec5 - -This patch converts the plain numbers used in Vec5 properties to constants. - -1. LPAR: Client program supports logical partitioning and - associated hcall()s. -2. SPLPAR: Client program supports the Shared - Processor LPAR Option. -3. CMO: Enables the Cooperative Memory Over-commitment Option. -4. MAX_CPU: Defines maximum number of CPUs supported. - -Signed-off-by: Avnish Chouhan -Reviewed-by: Daniel Kiper -(cherry picked from commit 8406cfe4774eb2da3db4bf0bc2b2ff6592ecbdaf) ---- - grub-core/kern/ieee1275/init.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 72d4fed312..5d79580341 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -72,6 +72,12 @@ extern char _end[]; - grub_addr_t grub_ieee1275_original_stack; - #endif - -+#define LPAR 0x80 -+#define SPLPAR 0x40 -+#define BYTE2 (LPAR | SPLPAR) -+#define CMO 0x80 -+#define MAX_CPU 256 -+ - void - grub_exit (int rc __attribute__((unused))) - { -@@ -575,7 +581,7 @@ grub_ieee1275_ibm_cas (void) - .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ - .vec5_size = 1 + sizeof (struct option_vector5) - 2, - .vec5 = { -- 0, 192, 0, 128, 0, 0, 0, 0, 256 -+ 0, BYTE2, 0, CMO, 0, 0, 0, 0, MAX_CPU - } - }; - diff --git a/0327-kern-ieee1275-init-Extended-support-in-Vec5.patch b/0327-kern-ieee1275-init-Extended-support-in-Vec5.patch deleted file mode 100644 index b8b481f9..00000000 --- a/0327-kern-ieee1275-init-Extended-support-in-Vec5.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Avnish Chouhan -Date: Mon, 27 Mar 2023 12:25:40 +0530 -Subject: [PATCH] kern/ieee1275/init: Extended support in Vec5 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This patch enables multiple options in Vec5 which are required and -solves the boot issues seen on some machines which are looking for -these specific options. - -1. LPAR: Client program supports logical partitioning and - associated hcall()s. -2. SPLPAR: Client program supports the Shared - Processor LPAR Option. -3. DYN_RCON_MEM: Client program supports the - “ibm,dynamic-reconfiguration-memory” property and it may be - presented in the device tree. -4. LARGE_PAGES: Client supports pages larger than 4 KB. -5. DONATE_DCPU_CLS: Client supports donating dedicated processor cycles. -6. PCI_EXP: Client supports PCI Express implementations - utilizing Message Signaled Interrupts (MSIs). - -7. CMOC: Enables the Cooperative Memory Over-commitment Option. -8. EXT_CMO: Enables the Extended Cooperative Memory Over-commit Option. - -9. ASSOC_REF: Enables “ibm,associativity” and - “ibm,associativity-reference-points” properties. -10. AFFINITY: Enables Platform Resource Reassignment Notification. -11. NUMA: Supports NUMA Distance Lookup Table Option. - -12. HOTPLUG_INTRPT: Supports Hotplug Interrupts. -13. HPT_RESIZE: Enable Hash Page Table Resize Option. - -14. MAX_CPU: Defines maximum number of CPUs supported. - -15. PFO_HWRNG: Supports Random Number Generator. -16. PFO_HW_COMP: Supports Compression Engine. -17. PFO_ENCRYPT: Supports Encryption Engine. - -18. SUB_PROCESSORS: Supports Sub-Processors. - -19. DY_MEM_V2: Client program supports the “ibm,dynamic-memory-v2” property in the - “ibm,dynamic-reconfiguration-memory” node and it may be presented in the device tree. -20. DRC_INFO: Client program supports the “ibm,drc-info” property definition and it may be - presented in the device tree. - -Signed-off-by: Avnish Chouhan -Reviewed-by: Daniel Kiper -(cherry picked from commit 98d0df0351fbff7a4acc64c7594d538889a43e2d) ---- - grub-core/kern/ieee1275/init.c | 47 ++++++++++++++++++++++++++++++++++++------ - 1 file changed, 41 insertions(+), 6 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 5d79580341..3d4ad9d1f1 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -72,11 +72,41 @@ extern char _end[]; - grub_addr_t grub_ieee1275_original_stack; - #endif - --#define LPAR 0x80 --#define SPLPAR 0x40 --#define BYTE2 (LPAR | SPLPAR) --#define CMO 0x80 --#define MAX_CPU 256 -+/* Options vector5 properties. */ -+ -+#define LPAR 0x80 -+#define SPLPAR 0x40 -+#define DYN_RCON_MEM 0x20 -+#define LARGE_PAGES 0x10 -+#define DONATE_DCPU_CLS 0x02 -+#define PCI_EXP 0x01 -+#define BYTE2 (LPAR | SPLPAR | DYN_RCON_MEM | LARGE_PAGES | DONATE_DCPU_CLS | PCI_EXP) -+ -+#define CMOC 0x80 -+#define EXT_CMO 0x40 -+#define CMO (CMOC | EXT_CMO) -+ -+#define ASSOC_REF 0x80 -+#define AFFINITY 0x40 -+#define NUMA 0x20 -+#define ASSOCIATIVITY (ASSOC_REF | AFFINITY | NUMA) -+ -+#define HOTPLUG_INTRPT 0x04 -+#define HPT_RESIZE 0x01 -+#define BIN_OPTS (HOTPLUG_INTRPT | HPT_RESIZE) -+ -+#define MAX_CPU 256 -+ -+#define PFO_HWRNG 0x80000000 -+#define PFO_HW_COMP 0x40000000 -+#define PFO_ENCRYPT 0x20000000 -+#define PLATFORM_FACILITIES (PFO_HWRNG | PFO_HW_COMP | PFO_ENCRYPT) -+ -+#define SUB_PROCESSORS 1 -+ -+#define DY_MEM_V2 0x80 -+#define DRC_INFO 0x40 -+#define BYTE22 (DY_MEM_V2 | DRC_INFO) - - void - grub_exit (int rc __attribute__((unused))) -@@ -519,6 +549,11 @@ struct option_vector5 - grub_uint8_t micro_checkpoint; - grub_uint8_t reserved0; - grub_uint32_t max_cpus; -+ grub_uint16_t base_papr; -+ grub_uint16_t mem_reference; -+ grub_uint32_t platform_facilities; -+ grub_uint8_t sub_processors; -+ grub_uint8_t byte22; - } GRUB_PACKED; - - struct pvr_entry -@@ -581,7 +616,7 @@ grub_ieee1275_ibm_cas (void) - .vec4 = 0x0001, /* set required minimum capacity % to the lowest value */ - .vec5_size = 1 + sizeof (struct option_vector5) - 2, - .vec5 = { -- 0, BYTE2, 0, CMO, 0, 0, 0, 0, MAX_CPU -+ 0, BYTE2, 0, CMO, ASSOCIATIVITY, BIN_OPTS, 0, 0, MAX_CPU, 0, 0, PLATFORM_FACILITIES, SUB_PROCESSORS, BYTE22 - } - }; - diff --git a/0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch b/0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch deleted file mode 100644 index 9c2522c8..00000000 --- a/0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Wed, 22 Mar 2023 12:25:43 +0800 -Subject: [PATCH] tpm: Disable the tpm verifier if the TPM device is not - present - -When the tpm module is loaded, the verifier reads entire file into -memory, measures it and uses verified content as a backing buffer for -file accesses. However, this process may result in high memory -utilization for file operations, sometimes causing a system to run out -of memory which may finally lead to boot failure. To address this issue, -among others, the commit 887f98f0d (mm: Allow dynamically requesting -additional memory regions) have optimized memory management by -dynamically allocating heap space to maximize memory usage and reduce -threat of memory exhaustion. But in some cases problems may still arise, -e.g., when large ISO images are mounted using loopback or when dealing -with embedded systems with limited memory resources. - -Unfortunately current implementation of the tpm module doesn't allow -elimination of the back buffer once it is loaded. Even if the TPM device -is not present or it has been explicitly disabled. This may unnecessary -allocate a lot memory. To solve this issue, a patch has been developed -to detect the TPM status at module load and skip verifier registration -if the device is missing or deactivated. This prevents allocation of -memory for the back buffer, avoiding wasting memory when no real measure -boot functionality is performed. Disabling the TPM device in the system -can reduce memory usage in the GRUB. It is useful in scenarios where -high memory utilization is a concern and measurements of loaded -artifacts are not necessary. - -Signed-off-by: Michael Chang -Signed-off-by: Stefan Berger -Reviewed-by: Daniel Kiper -(cherry picked from commit 30708dfe3bebd62a5487437554da8a24253f519f) ---- - grub-core/commands/efi/tpm.c | 37 +++++++++++++++++++++++++++++++++++ - grub-core/commands/ieee1275/ibmvtpm.c | 20 +++++++++---------- - grub-core/commands/tpm.c | 10 ++++++++++ - include/grub/tpm.h | 1 + - 4 files changed, 58 insertions(+), 10 deletions(-) - -diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c -index ae09c1bf8b..e1f343fea3 100644 ---- a/grub-core/commands/efi/tpm.c -+++ b/grub-core/commands/efi/tpm.c -@@ -287,3 +287,40 @@ grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, - else - return grub_tpm2_log_event (tpm_handle, buf, size, pcr, description); - } -+ -+int -+grub_tpm_present (void) -+{ -+ grub_efi_handle_t tpm_handle; -+ grub_efi_uint8_t protocol_version; -+ -+ if (!grub_tpm_handle_find (&tpm_handle, &protocol_version)) -+ return 0; -+ -+ if (protocol_version == 1) -+ { -+ grub_efi_tpm_protocol_t *tpm; -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ if (!tpm) -+ { -+ grub_dprintf ("tpm", "Cannot open TPM protocol\n"); -+ return 0; -+ } -+ return grub_tpm1_present (tpm); -+ } -+ else -+ { -+ grub_efi_tpm2_protocol_t *tpm; -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ if (!tpm) -+ { -+ grub_dprintf ("tpm", "Cannot open TPM protocol\n"); -+ return 0; -+ } -+ return grub_tpm2_present (tpm); -+ } -+} -diff --git a/grub-core/commands/ieee1275/ibmvtpm.c b/grub-core/commands/ieee1275/ibmvtpm.c -index 239942d27e..a6fee5c516 100644 ---- a/grub-core/commands/ieee1275/ibmvtpm.c -+++ b/grub-core/commands/ieee1275/ibmvtpm.c -@@ -135,16 +135,6 @@ grub_err_t - grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, - const char *description) - { -- /* -- * Call tpm_init() 'late' rather than from GRUB_MOD_INIT() so that device nodes -- * can be found. -- */ -- grub_err_t err = tpm_init (); -- -- /* Absence of a TPM isn't a failure. */ -- if (err != GRUB_ERR_NONE) -- return GRUB_ERR_NONE; -- - grub_dprintf ("tpm", "log_event, pcr = %d, size = 0x%" PRIxGRUB_SIZE ", %s\n", - pcr, size, description); - -@@ -153,3 +143,13 @@ grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, - - return GRUB_ERR_NONE; - } -+ -+int -+grub_tpm_present (void) -+{ -+ /* -+ * Call tpm_init() "late" rather than from GRUB_MOD_INIT() so that device nodes -+ * can be found. -+ */ -+ return tpm_init() == GRUB_ERR_NONE; -+} -diff --git a/grub-core/commands/tpm.c b/grub-core/commands/tpm.c -index e287d042e6..5839053d3d 100644 ---- a/grub-core/commands/tpm.c -+++ b/grub-core/commands/tpm.c -@@ -86,10 +86,20 @@ struct grub_file_verifier grub_tpm_verifier = { - - GRUB_MOD_INIT (tpm) - { -+ /* -+ * Even though this now calls ibmvtpm's grub_tpm_present() from GRUB_MOD_INIT(), -+ * it does seem to call it late enough in the initialization sequence so -+ * that whatever discovered "device nodes" before this GRUB_MOD_INIT() is -+ * called, enables the ibmvtpm driver to see the device nodes. -+ */ -+ if (!grub_tpm_present()) -+ return; - grub_verifier_register (&grub_tpm_verifier); - } - - GRUB_MOD_FINI (tpm) - { -+ if (!grub_tpm_present()) -+ return; - grub_verifier_unregister (&grub_tpm_verifier); - } -diff --git a/include/grub/tpm.h b/include/grub/tpm.h -index 5c285cbc52..c19fcbd0a6 100644 ---- a/include/grub/tpm.h -+++ b/include/grub/tpm.h -@@ -36,4 +36,5 @@ - - grub_err_t grub_tpm_measure (unsigned char *buf, grub_size_t size, - grub_uint8_t pcr, const char *description); -+int grub_tpm_present (void); - #endif diff --git a/0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch b/0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch deleted file mode 100644 index 5c7e1a38..00000000 --- a/0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch +++ /dev/null @@ -1,226 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Stefan Berger -Date: Tue, 25 Jul 2023 13:23:10 -0400 -Subject: [PATCH] kern/ieee1275/init: ppc64: Restrict high memory in presence - of fadump - -When a kernel dump is present then restrict the high memory regions to -avoid allocating memory where the kernel dump resides. Use the -ibm,kernel-dump node under /rtas to determine whether a kernel dump exists -and up to which limit grub can use available memory. Set the -upper_mem_limit to the size of the kernel dump section of type -'REAL_MODE_REGION' and therefore only allow grub's memory usage for high -addresses from RMO_ADDR_MAX to 'upper_mem_limit'. This means that grub can -use high memory in the range of RMO_ADDR_MAX (768MB) to upper_mem_limit and -the kernel-dump memory regions above 'upper_mem_limit' remain untouched. -This change has no effect on memory allocations below 'linux_rmo_save' -(typically at 640MB). - -Also, fall back to allocating below rmo_linux_save in case the chunk of -memory there would be larger than the chunk of memory above RMO_ADDR_MAX. -This can for example occur if a free memory area is found starting at 300MB -extending up to 1GB but a kernel dump is located at 768MB and therefore -does not allow the allocation of the high memory area but requiring to use -the chunk starting at 300MB to avoid an unnecessary out-of-memory -condition. - -Signed-off-by: Stefan Berger -Reviewed-by: Hari Bathini -Cc: Pavithra Prakash -Cc: Michael Ellerman -Cc: Carolyn Scherrer -Cc: Mahesh Salgaonkar -Cc: Sourabh Jain ---- - grub-core/kern/ieee1275/init.c | 144 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 142 insertions(+), 2 deletions(-) - -diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c -index 3d4ad9d1f162..8e7f742fad46 100644 ---- a/grub-core/kern/ieee1275/init.c -+++ b/grub-core/kern/ieee1275/init.c -@@ -17,6 +17,8 @@ - * along with GRUB. If not, see . - */ - -+#include /* offsetof() */ -+ - #include - #include - #include -@@ -198,6 +200,96 @@ grub_claim_heap (void) - #else - /* Helpers for mm on powerpc. */ - -+/* ibm,kernel-dump data structures */ -+struct kd_section -+{ -+ grub_uint32_t flags; -+ grub_uint16_t src_datatype; -+#define KD_SRC_DATATYPE_REAL_MODE_REGION 0x0011 -+ grub_uint16_t error_flags; -+ grub_uint64_t src_address; -+ grub_uint64_t num_bytes; -+ grub_uint64_t act_bytes; -+ grub_uint64_t dst_address; -+} GRUB_PACKED; -+ -+#define MAX_KD_SECTIONS 10 -+ -+struct kernel_dump -+{ -+ grub_uint32_t format; -+ grub_uint16_t num_sections; -+ grub_uint16_t status_flags; -+ grub_uint32_t offset_1st_section; -+ grub_uint32_t num_blocks; -+ grub_uint64_t start_block; -+ grub_uint64_t num_blocks_avail; -+ grub_uint32_t offet_path_string; -+ grub_uint32_t max_time_allowed; -+ struct kd_section kds[MAX_KD_SECTIONS]; /* offset_1st_section should point to kds[0] */ -+} GRUB_PACKED; -+ -+/* -+ * Determine if a kernel dump exists and if it does, then determine the highest -+ * address that grub can use for memory allocations. -+ * The caller must have initialized *highest to rmo_top. *highest will not -+ * be modified if no kernel dump is found. -+ */ -+static void -+check_kernel_dump (grub_uint64_t *highest) -+{ -+ struct kernel_dump kernel_dump; -+ grub_ssize_t kernel_dump_size; -+ grub_ieee1275_phandle_t rtas; -+ struct kd_section *kds; -+ grub_size_t i; -+ -+ /* If there's a kernel-dump it must have at least one section */ -+ if (grub_ieee1275_finddevice ("/rtas", &rtas) || -+ grub_ieee1275_get_property (rtas, "ibm,kernel-dump", &kernel_dump, -+ sizeof (kernel_dump), &kernel_dump_size) || -+ kernel_dump_size <= (grub_ssize_t) offsetof (struct kernel_dump, kds[1])) -+ return; -+ -+ kernel_dump_size = grub_min (kernel_dump_size, (grub_ssize_t) sizeof (kernel_dump)); -+ -+ if (grub_be_to_cpu32 (kernel_dump.format) != 1) -+ { -+ grub_printf (_("Error: ibm,kernel-dump has an unexpected format version '%u'\n"), -+ grub_be_to_cpu32 (kernel_dump.format)); -+ return; -+ } -+ -+ if (grub_be_to_cpu16 (kernel_dump.num_sections) > MAX_KD_SECTIONS) -+ { -+ grub_printf (_("Error: Too many kernel dump sections: %d\n"), -+ grub_be_to_cpu32 (kernel_dump.num_sections)); -+ return; -+ } -+ -+ for (i = 0; i < grub_be_to_cpu16 (kernel_dump.num_sections); i++) -+ { -+ kds = (struct kd_section *) ((grub_addr_t) &kernel_dump + -+ grub_be_to_cpu32 (kernel_dump.offset_1st_section) + -+ i * sizeof (struct kd_section)); -+ /* sanity check the address is within the 'kernel_dump' struct */ -+ if ((grub_addr_t) kds > (grub_addr_t) &kernel_dump + kernel_dump_size + sizeof (*kds)) -+ { -+ grub_printf (_("Error: 'kds' address beyond last available section\n")); -+ return; -+ } -+ -+ if ((grub_be_to_cpu16 (kds->src_datatype) == KD_SRC_DATATYPE_REAL_MODE_REGION) && -+ (grub_be_to_cpu64 (kds->src_address) == 0)) -+ { -+ *highest = grub_min (*highest, grub_be_to_cpu64 (kds->num_bytes)); -+ break; -+ } -+ } -+ -+ return; -+} -+ - /* - * How much memory does OF believe exists in total? - * -@@ -277,10 +369,31 @@ regions_claim (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - * - * Finally, we also want to make sure that when grub loads the kernel, - * it isn't going to use up all the memory we're trying to reserve! So -- * enforce our entire RUNTIME_MIN_SPACE here: -+ * enforce our entire RUNTIME_MIN_SPACE here (no fadump): -+ * -+ * | Top of memory == upper_mem_limit -| -+ * | | -+ * | available | -+ * | | -+ * |---------- 768 MB ----------| -+ * | | -+ * | reserved | -+ * | | -+ * |--- 768 MB - runtime min space ---| -+ * | | -+ * | available | -+ * | | -+ * |---------- 0 MB ----------| -+ * -+ * In case fadump is used, we allow the following: - * - * |---------- Top of memory ----------| - * | | -+ * | unavailable | -+ * | (kernel dump area) | -+ * | | -+ * |--------- upper_mem_limit ---------| -+ * | | - * | available | - * | | - * |---------- 768 MB ----------| -@@ -335,17 +448,44 @@ regions_claim (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type, - } - else - { -+ grub_uint64_t upper_mem_limit = rmo_top; -+ grub_uint64_t orig_addr = addr; -+ -+ check_kernel_dump (&upper_mem_limit); -+ - /* - * we order these cases to prefer higher addresses and avoid some - * splitting issues -+ * The following shows the order of variables: -+ * no kernel dump: linux_rmo_save < RMO_ADDR_MAX <= upper_mem_limit == rmo_top -+ * with kernel dump: liuxx_rmo_save < RMO_ADDR_MAX <= upper_mem_limit <= rmo_top - */ -- if (addr < RMO_ADDR_MAX && (addr + len) > RMO_ADDR_MAX) -+ if (addr < RMO_ADDR_MAX && (addr + len) > RMO_ADDR_MAX && upper_mem_limit >= RMO_ADDR_MAX) - { - grub_dprintf ("ieee1275", - "adjusting region for RUNTIME_MIN_SPACE: (%llx -> %llx) -> (%llx -> %llx)\n", - addr, addr + len, RMO_ADDR_MAX, addr + len); - len = (addr + len) - RMO_ADDR_MAX; - addr = RMO_ADDR_MAX; -+ -+ /* We must not exceed the upper_mem_limit (assuming it's >= RMO_ADDR_MAX) */ -+ if (addr + len > upper_mem_limit) -+ { -+ /* take the bigger chunk from either below linux_rmo_save or above upper_mem_limit */ -+ len = upper_mem_limit - addr; -+ if (orig_addr < linux_rmo_save && linux_rmo_save - orig_addr > len) -+ { -+ /* lower part is bigger */ -+ addr = orig_addr; -+ len = linux_rmo_save - addr; -+ } -+ -+ grub_dprintf ("ieee1275", "re-adjusted region to: (%llx -> %llx)\n", -+ addr, addr + len); -+ -+ if (len == 0) -+ return 0; -+ } - } - else if ((addr < linux_rmo_save) && ((addr + len) > linux_rmo_save)) - { diff --git a/0341-fs-Remove-trailing-whitespaces.patch b/0341-fs-Remove-trailing-whitespaces.patch deleted file mode 100644 index a876f6b1..00000000 --- a/0341-fs-Remove-trailing-whitespaces.patch +++ /dev/null @@ -1,1681 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Elyes Haouas -Date: Fri, 4 Mar 2022 07:41:59 +0100 -Subject: [PATCH] fs: Remove trailing whitespaces - -Signed-off-by: Elyes Haouas -Reviewed-by: Daniel Kiper ---- - grub-core/fs/affs.c | 4 +- - grub-core/fs/archelp.c | 4 +- - grub-core/fs/bfs.c | 10 +- - grub-core/fs/cpio_common.c | 2 +- - grub-core/fs/fat.c | 6 +- - grub-core/fs/fshelp.c | 6 +- - grub-core/fs/hfs.c | 14 +-- - grub-core/fs/hfsplus.c | 8 +- - grub-core/fs/hfspluscomp.c | 6 +- - grub-core/fs/iso9660.c | 12 +-- - grub-core/fs/minix.c | 6 +- - grub-core/fs/nilfs2.c | 8 +- - grub-core/fs/ntfs.c | 8 +- - grub-core/fs/reiserfs.c | 2 +- - grub-core/fs/romfs.c | 8 +- - grub-core/fs/squash4.c | 26 ++--- - grub-core/fs/udf.c | 2 +- - grub-core/fs/ufs.c | 4 +- - grub-core/fs/xfs.c | 2 +- - grub-core/fs/zfs/zfs.c | 224 ++++++++++++++++++++-------------------- - grub-core/fs/zfs/zfs_fletcher.c | 12 +-- - grub-core/fs/zfs/zfs_sha256.c | 14 +-- - grub-core/fs/zfs/zfscrypt.c | 14 +-- - 23 files changed, 201 insertions(+), 201 deletions(-) - -diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c -index cafcd0fba916..0d90e9d1a895 100644 ---- a/grub-core/fs/affs.c -+++ b/grub-core/fs/affs.c -@@ -345,7 +345,7 @@ grub_affs_create_node (grub_fshelp_node_t dir, - if (len > sizeof (fil->name)) - len = sizeof (fil->name); - *grub_latin1_to_utf8 (name_u8, fil->name, len) = '\0'; -- -+ - (*node)->di = *fil; - for (nest = 0; nest < 8; nest++) - { -@@ -408,7 +408,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir, - node = orig_node = grub_zalloc (sizeof (*node)); - if (!node) - return 1; -- -+ - *node = *dir; - if (hook (".", GRUB_FSHELP_DIR, node, hook_data)) - return 1; -diff --git a/grub-core/fs/archelp.c b/grub-core/fs/archelp.c -index 0cf544f6fdfe..998de88b865c 100644 ---- a/grub-core/fs/archelp.c -+++ b/grub-core/fs/archelp.c -@@ -75,7 +75,7 @@ handle_symlink (struct grub_archelp_data *data, - || !arcops->get_link_target) - return GRUB_ERR_NONE; - flen = grub_strlen (fn); -- if (grub_memcmp (*name, fn, flen) != 0 -+ if (grub_memcmp (*name, fn, flen) != 0 - || ((*name)[flen] != 0 && (*name)[flen] != '/')) - return GRUB_ERR_NONE; - rest = *name + flen; -@@ -251,7 +251,7 @@ grub_archelp_open (struct grub_archelp_data *data, - grub_uint32_t mode; - grub_int32_t mtime; - int restart; -- -+ - if (arcops->find_file (data, &fn, &mtime, &mode)) - goto fail; - -diff --git a/grub-core/fs/bfs.c b/grub-core/fs/bfs.c -index 47dbe2011a14..a75876010d30 100644 ---- a/grub-core/fs/bfs.c -+++ b/grub-core/fs/bfs.c -@@ -530,13 +530,13 @@ iterate_in_b_tree (grub_disk_t disk, - err = read_b_node (disk, sb, ino, - node_off, - &node, -- &key_data, -+ &key_data, - &keylen_idx, - &key_values); - - if (err) - return 0; -- -+ - for (i = 0; i < grub_bfs_to_cpu_treehead (node->count_keys); i++) - { - char c; -@@ -682,7 +682,7 @@ find_in_b_tree (grub_disk_t disk, - level--; - grub_free (node); - continue; -- } -+ } - } - else if (level != 0 - && i + 1 < grub_bfs_to_cpu_treehead (node->count_keys)) -@@ -827,7 +827,7 @@ mount (grub_disk_t disk, struct grub_bfs_superblock *sb) - grub_err_t err; - err = grub_disk_read (disk, SUPERBLOCK, 0, sizeof (*sb), sb); - if (err == GRUB_ERR_OUT_OF_RANGE) -- return grub_error (GRUB_ERR_BAD_FS, -+ return grub_error (GRUB_ERR_BAD_FS, - #ifdef MODE_AFS - "not an AFS filesystem" - #else -@@ -843,7 +843,7 @@ mount (grub_disk_t disk, struct grub_bfs_superblock *sb) - || (grub_bfs_to_cpu32 (sb->bsize) - != (1U << grub_bfs_to_cpu32 (sb->log2_bsize))) - || grub_bfs_to_cpu32 (sb->log2_bsize) < GRUB_DISK_SECTOR_BITS) -- return grub_error (GRUB_ERR_BAD_FS, -+ return grub_error (GRUB_ERR_BAD_FS, - #ifdef MODE_AFS - "not an AFS filesystem" - #else -diff --git a/grub-core/fs/cpio_common.c b/grub-core/fs/cpio_common.c -index 4e885d62313e..5d41b6fdbe1c 100644 ---- a/grub-core/fs/cpio_common.c -+++ b/grub-core/fs/cpio_common.c -@@ -117,7 +117,7 @@ grub_cpio_get_link_target (struct grub_archelp_data *data) - if (!ret) - return NULL; - -- err = grub_disk_read (data->disk, 0, data->dofs, data->size, -+ err = grub_disk_read (data->disk, 0, data->dofs, data->size, - ret); - if (err) - { -diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c -index ff6200c5be5d..c5efed724124 100644 ---- a/grub-core/fs/fat.c -+++ b/grub-core/fs/fat.c -@@ -246,7 +246,7 @@ grub_fat_mount (grub_disk_t disk) - #ifdef MODE_EXFAT - if (grub_memcmp ((const char *) bpb.oem_name, "EXFAT ", - sizeof (bpb.oem_name)) != 0) -- goto fail; -+ goto fail; - #endif - - /* Get the sizes of logical sectors and clusters. */ -@@ -321,7 +321,7 @@ grub_fat_mount (grub_disk_t disk) - #endif - - #ifdef MODE_EXFAT -- data->cluster_sector = (grub_le_to_cpu32 (bpb.cluster_offset) -+ data->cluster_sector = (grub_le_to_cpu32 (bpb.cluster_offset) - << data->logical_sector_bits); - data->num_clusters = (grub_le_to_cpu32 (bpb.cluster_count) - << data->logical_sector_bits); -@@ -694,7 +694,7 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, - { - int j; - for (j = 0; j < 15; j++) -- ctxt->unibuf[slots * 15 + j] -+ ctxt->unibuf[slots * 15 + j] - = grub_le_to_cpu16 (sec.type_specific.file_name.str[j]); - slots++; - } -diff --git a/grub-core/fs/fshelp.c b/grub-core/fs/fshelp.c -index a2d0d297a520..cb41934b4fec 100644 ---- a/grub-core/fs/fshelp.c -+++ b/grub-core/fs/fshelp.c -@@ -215,7 +215,7 @@ find_file (char *currpath, - break; - - push_node (ctx, foundnode, foundtype); -- -+ - /* Read in the symlink and follow it. */ - if (ctx->currnode->type == GRUB_FSHELP_SYMLINK) - { -@@ -326,7 +326,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode, - enum grub_fshelp_filetype expecttype) - { - return grub_fshelp_find_file_real (path, rootnode, foundnode, -- iterate_dir, NULL, -+ iterate_dir, NULL, - read_symlink, expecttype); - - } -@@ -339,7 +339,7 @@ grub_fshelp_find_file_lookup (const char *path, grub_fshelp_node_t rootnode, - enum grub_fshelp_filetype expecttype) - { - return grub_fshelp_find_file_real (path, rootnode, foundnode, -- NULL, lookup_file, -+ NULL, lookup_file, - read_symlink, expecttype); - - } -diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c -index f419965d154f..91dc0e69c3de 100644 ---- a/grub-core/fs/hfs.c -+++ b/grub-core/fs/hfs.c -@@ -883,7 +883,7 @@ grub_hfs_iterate_dir_it_dir (struct grub_hfs_node *hnd __attribute ((unused)), - { - struct grub_hfs_catalog_key *ckey = rec->key; - struct grub_hfs_iterate_dir_node_found_ctx *ctx = hook_arg; -- -+ - /* Stop when the entries do not match anymore. */ - if (ckey->parent_dir != ctx->dir_be) - return 1; -@@ -1077,7 +1077,7 @@ macroman_to_utf8 (char *to, const grub_uint8_t *from, grub_size_t len, - { - *optr++ = ':'; - continue; -- } -+ } - if (!(*iptr & 0x80)) - { - *optr++ = *iptr; -@@ -1094,7 +1094,7 @@ utf8_to_macroman (grub_uint8_t *to, const char *from) - grub_uint8_t *end = to + 31; - grub_uint8_t *optr = to; - const char *iptr = from; -- -+ - while (*iptr && optr < end) - { - int i, clen; -@@ -1104,7 +1104,7 @@ utf8_to_macroman (grub_uint8_t *to, const char *from) - *optr++ = '/'; - iptr++; - continue; -- } -+ } - if (!(*iptr & 0x80)) - { - *optr++ = *iptr++; -@@ -1165,7 +1165,7 @@ lookup_file (grub_fshelp_node_t dir, - *foundnode = grub_malloc (sizeof (struct grub_fshelp_node)); - if (!*foundnode) - return grub_errno; -- -+ - (*foundnode)->inode = grub_be_to_cpu32 (fdrec.dir.dirid); - (*foundnode)->fdrec = fdrec; - (*foundnode)->data = dir->data; -@@ -1266,7 +1266,7 @@ grub_hfs_dir (grub_device_t device, const char *path, grub_fs_dir_hook_t hook, - .hook_data = hook_data - }; - grub_fshelp_node_t found = NULL; -- -+ - grub_dl_ref (my_mod); - - data = grub_hfs_mount (device->disk); -@@ -1295,7 +1295,7 @@ grub_hfs_open (struct grub_file *file, const char *name) - { - struct grub_hfs_data *data; - grub_fshelp_node_t found = NULL; -- -+ - grub_dl_ref (my_mod); - - data = grub_hfs_mount (file->device->disk); -diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c -index 19c7b3367987..6337cbfcbec6 100644 ---- a/grub-core/fs/hfsplus.c -+++ b/grub-core/fs/hfsplus.c -@@ -19,7 +19,7 @@ - - /* HFS+ is documented at http://developer.apple.com/technotes/tn/tn1150.html */ - --#define grub_fshelp_node grub_hfsplus_file -+#define grub_fshelp_node grub_hfsplus_file - #include - #include - #include -@@ -146,7 +146,7 @@ grub_hfsplus_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - { - struct grub_hfsplus_btnode *nnode = 0; - grub_disk_addr_t blksleft = fileblock; -- struct grub_hfsplus_extent *extents = node->compressed -+ struct grub_hfsplus_extent *extents = node->compressed - ? &node->resource_extents[0] : &node->extents[0]; - - while (1) -@@ -477,7 +477,7 @@ grub_hfsplus_cmp_extkey (struct grub_hfsplus_key *keya, - - if (extkey_a->type < extkey_b->type) - return -1; -- -+ - akey = grub_be_to_cpu32 (extkey_a->start); - if (akey > extkey_b->start) - return 1; -@@ -568,7 +568,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree, - struct grub_hfsplus_key_internal *key, - int (*compare_keys) (struct grub_hfsplus_key *keya, - struct grub_hfsplus_key_internal *keyb), -- struct grub_hfsplus_btnode **matchnode, -+ struct grub_hfsplus_btnode **matchnode, - grub_off_t *keyoffset) - { - grub_uint64_t currnode; -diff --git a/grub-core/fs/hfspluscomp.c b/grub-core/fs/hfspluscomp.c -index d76f3f137a92..095ea48c9a62 100644 ---- a/grub-core/fs/hfspluscomp.c -+++ b/grub-core/fs/hfspluscomp.c -@@ -179,7 +179,7 @@ hfsplus_read_compressed_real (struct grub_hfsplus_file *node, - return len0; - } - --static grub_err_t -+static grub_err_t - hfsplus_open_compressed_real (struct grub_hfsplus_file *node) - { - grub_err_t err; -@@ -306,8 +306,8 @@ hfsplus_open_compressed_real (struct grub_hfsplus_file *node) - - GRUB_MOD_INIT(hfspluscomp) - { -- grub_hfsplus_open_compressed = hfsplus_open_compressed_real; -- grub_hfsplus_read_compressed = hfsplus_read_compressed_real; -+ grub_hfsplus_open_compressed = hfsplus_open_compressed_real; -+ grub_hfsplus_read_compressed = hfsplus_read_compressed_real; - } - - GRUB_MOD_FINI(hfspluscomp) -diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c -index ac011950a64f..91817ec1f5ad 100644 ---- a/grub-core/fs/iso9660.c -+++ b/grub-core/fs/iso9660.c -@@ -181,7 +181,7 @@ static grub_err_t - iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int64_t *nix) - { - struct grub_datetime datetime; -- -+ - if (! i->year[0] && ! i->year[1] - && ! i->year[2] && ! i->year[3] - && ! i->month[0] && ! i->month[1] -@@ -198,7 +198,7 @@ iso9660_to_unixtime (const struct grub_iso9660_date *i, grub_int64_t *nix) - datetime.hour = (i->hour[0] - '0') * 10 + (i->hour[1] - '0'); - datetime.minute = (i->minute[0] - '0') * 10 + (i->minute[1] - '0'); - datetime.second = (i->second[0] - '0') * 10 + (i->second[1] - '0'); -- -+ - if (!grub_datetime2unixtime (&datetime, nix)) - return grub_error (GRUB_ERR_BAD_NUMBER, "incorrect date"); - *nix -= i->offset * 60 * 15; -@@ -216,7 +216,7 @@ iso9660_to_unixtime2 (const struct grub_iso9660_date2 *i, grub_int64_t *nix) - datetime.hour = i->hour; - datetime.minute = i->minute; - datetime.second = i->second; -- -+ - if (!grub_datetime2unixtime (&datetime, nix)) - return 0; - *nix -= i->offset * 60 * 15; -@@ -499,7 +499,7 @@ grub_iso9660_mount (grub_disk_t disk) - static char * - grub_iso9660_read_symlink (grub_fshelp_node_t node) - { -- return node->have_symlink -+ return node->have_symlink - ? grub_strdup (node->symlink - + (node->have_dirents) * sizeof (node->dirents[0]) - - sizeof (node->dirents)) : grub_strdup (""); -@@ -549,7 +549,7 @@ add_part (struct iterate_dir_ctx *ctx, - ctx->symlink = new; - - grub_memcpy (ctx->symlink + size, part, len2); -- ctx->symlink[size + len2] = 0; -+ ctx->symlink[size + len2] = 0; - } - - static grub_err_t -@@ -1106,7 +1106,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid) - } - - /* Get writing time of filesystem. */ --static grub_err_t -+static grub_err_t - grub_iso9660_mtime (grub_device_t device, grub_int64_t *timebuf) - { - struct grub_iso9660_data *data; -diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c -index 3cd18c85b302..953df11916b8 100644 ---- a/grub-core/fs/minix.c -+++ b/grub-core/fs/minix.c -@@ -98,10 +98,10 @@ struct grub_minix_sblock - grub_uint32_t max_file_size; - grub_uint32_t zones; - grub_uint16_t magic; -- -+ - grub_uint16_t pad2; - grub_uint16_t block_size; -- grub_uint8_t disk_version; -+ grub_uint8_t disk_version; - }; - #else - struct grub_minix_sblock -@@ -351,7 +351,7 @@ grub_minix_read_inode (struct grub_minix_data *data, grub_minix_ino_t ino) - int offs = (ino % (GRUB_DISK_SECTOR_SIZE - / sizeof (struct grub_minix_inode)) - * sizeof (struct grub_minix_inode)); -- -+ - grub_disk_read (data->disk, block, offs, - sizeof (struct grub_minix_inode), &data->inode); - -diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c -index 3c248a910b42..fc7374ead490 100644 ---- a/grub-core/fs/nilfs2.c -+++ b/grub-core/fs/nilfs2.c -@@ -1,5 +1,5 @@ --/* -- * nilfs2.c - New Implementation of Log filesystem -+/* -+ * nilfs2.c - New Implementation of Log filesystem - * - * Written by Jiro SEKIBA - * -@@ -680,12 +680,12 @@ grub_nilfs2_read_checkpoint (struct grub_nilfs2_data *data, - grub_disk_t disk = data->disk; - unsigned int nilfs2_block_count = (1 << LOG2_NILFS2_BLOCK_SIZE (data)); - -- /* Assume sizeof(struct grub_nilfs2_cpfile_header) < -+ /* Assume sizeof(struct grub_nilfs2_cpfile_header) < - sizeof(struct grub_nilfs2_checkpoint). - */ - blockno = grub_divmod64 (cpno, NILFS2_BLOCK_SIZE (data) / - sizeof (struct grub_nilfs2_checkpoint), &offset); -- -+ - pptr = grub_nilfs2_bmap_lookup (data, &data->sroot.sr_cpfile, blockno, 1); - if (pptr == (grub_uint64_t) - 1) - { -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 2f34f76da88c..3511e4e2cb6f 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -17,7 +17,7 @@ - * along with this program. If not, see . - */ - --#define grub_fshelp_node grub_ntfs_file -+#define grub_fshelp_node grub_ntfs_file - - #include - #include -@@ -32,7 +32,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - - static grub_dl_t my_mod; - --#define grub_fshelp_node grub_ntfs_file -+#define grub_fshelp_node grub_ntfs_file - - static inline grub_uint16_t - u16at (void *ptr, grub_size_t ofs) -@@ -725,7 +725,7 @@ grub_ntfs_read_symlink (grub_fshelp_node_t node) - && grub_isalpha (buf[4])) - { - grub_memmove (buf, buf + 6, end - buf + 1 - 6); -- end -= 6; -+ end -= 6; - } - return buf; - } -@@ -992,7 +992,7 @@ grub_ntfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype, - grub_memset (&info, 0, sizeof (info)); - info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR); - info.mtimeset = 1; -- info.mtime = grub_divmod64 (node->mtime, 10000000, 0) -+ info.mtime = grub_divmod64 (node->mtime, 10000000, 0) - - 86400ULL * 365 * (1970 - 1601) - - 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100); - grub_free (node); -diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c -index b8253da7fed2..42818c376229 100644 ---- a/grub-core/fs/reiserfs.c -+++ b/grub-core/fs/reiserfs.c -@@ -775,7 +775,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item, - char *entry_name; - char *entry_name_end = 0; - char c; -- -+ - if (!(entry_state & GRUB_REISERFS_VISIBLE_MASK)) - continue; - -diff --git a/grub-core/fs/romfs.c b/grub-core/fs/romfs.c -index d97b8fbb8c36..1f7dcfca1d3a 100644 ---- a/grub-core/fs/romfs.c -+++ b/grub-core/fs/romfs.c -@@ -112,7 +112,7 @@ grub_romfs_mount (grub_device_t dev) - { - grub_error (GRUB_ERR_BAD_FS, "not romfs"); - return NULL; -- } -+ } - err = do_checksum (&sb, sizeof (sb) < grub_be_to_cpu32 (sb.sb.total_size) ? - sizeof (sb) : grub_be_to_cpu32 (sb.sb.total_size)); - if (err) -@@ -271,7 +271,7 @@ grub_romfs_iterate_dir (grub_fshelp_node_t dir, - while (1) - { - char buf[16]; -- err = grub_disk_read (dir->data->disk, -+ err = grub_disk_read (dir->data->disk, - laddr >> GRUB_DISK_SECTOR_BITS, - laddr & (GRUB_DISK_SECTOR_SIZE - 1), - 16, buf); -@@ -298,7 +298,7 @@ grub_romfs_iterate_dir (grub_fshelp_node_t dir, - node->data_addr = grub_be_to_cpu32 (node->file.spec); - filetype = GRUB_FSHELP_DIR; - } -- -+ - break; - } - } -@@ -402,7 +402,7 @@ grub_romfs_read (grub_file_t file, char *buf, grub_size_t len) - data->data->disk->read_hook_data = file->read_hook_data; - grub_disk_read (data->data->disk, - (data->data_addr + file->offset) >> GRUB_DISK_SECTOR_BITS, -- (data->data_addr + file->offset) & (GRUB_DISK_SECTOR_SIZE - 1), -+ (data->data_addr + file->offset) & (GRUB_DISK_SECTOR_SIZE - 1), - len, buf); - data->data->disk->read_hook = NULL; - -diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c -index 6dd731e231ee..02b1f9b6d101 100644 ---- a/grub-core/fs/squash4.c -+++ b/grub-core/fs/squash4.c -@@ -210,7 +210,7 @@ struct grub_fshelp_node - struct grub_squash_data *data; - struct grub_squash_inode ino; - grub_size_t stsize; -- struct -+ struct - { - grub_disk_addr_t ino_chunk; - grub_uint16_t ino_offset; -@@ -243,7 +243,7 @@ read_chunk (struct grub_squash_data *data, void *buf, grub_size_t len, - csize = SQUASH_CHUNK_SIZE - offset; - if (csize > len) - csize = len; -- -+ - if (grub_le_to_cpu16 (d) & SQUASH_CHUNK_UNCOMPRESSED) - { - grub_disk_addr_t a = chunk_start + 2 + offset; -@@ -256,7 +256,7 @@ read_chunk (struct grub_squash_data *data, void *buf, grub_size_t len, - else - { - char *tmp; -- grub_size_t bsize = grub_le_to_cpu16 (d) & ~SQUASH_CHUNK_FLAGS; -+ grub_size_t bsize = grub_le_to_cpu16 (d) & ~SQUASH_CHUNK_FLAGS; - grub_disk_addr_t a = chunk_start + 2; - tmp = grub_malloc (bsize); - if (!tmp) -@@ -339,7 +339,7 @@ xz_decompress (char *inbuf, grub_size_t insize, grub_off_t off, - while (len) - { - enum xz_ret xzret; -- -+ - buf.out_pos = 0; - - xzret = xz_dec_run (data->xzdec, &buf); -@@ -399,9 +399,9 @@ squash_mount (grub_disk_t disk) - return NULL; - } - -- err = grub_disk_read (disk, -+ err = grub_disk_read (disk, - grub_le_to_cpu64 (sb.unk1offset) -- >> GRUB_DISK_SECTOR_BITS, -+ >> GRUB_DISK_SECTOR_BITS, - grub_le_to_cpu64 (sb.unk1offset) - & (GRUB_DISK_SECTOR_SIZE - 1), sizeof (frag), &frag); - if (grub_errno == GRUB_ERR_OUT_OF_RANGE) -@@ -448,7 +448,7 @@ squash_mount (grub_disk_t disk) - } - - data->blksz = grub_le_to_cpu32 (data->sb.block_size); -- for (data->log2_blksz = 0; -+ for (data->log2_blksz = 0; - (1U << data->log2_blksz) < data->blksz; - data->log2_blksz++); - -@@ -643,7 +643,7 @@ make_root_node (struct grub_squash_data *data, struct grub_fshelp_node *root) - root->stack[0].ino_chunk = grub_le_to_cpu32 (data->sb.root_ino_chunk); - root->stack[0].ino_offset = grub_cpu_to_le16 (data->sb.root_ino_offset); - return read_chunk (data, &root->ino, sizeof (root->ino), -- grub_le_to_cpu64 (data->sb.inodeoffset) -+ grub_le_to_cpu64 (data->sb.inodeoffset) - + root->stack[0].ino_chunk, - root->stack[0].ino_offset); - } -@@ -765,7 +765,7 @@ grub_squash_open (struct grub_file *file, const char *name) - } - - static grub_ssize_t --direct_read (struct grub_squash_data *data, -+direct_read (struct grub_squash_data *data, - struct grub_squash_cache_inode *ino, - grub_off_t off, char *buf, grub_size_t len) - { -@@ -882,7 +882,7 @@ direct_read (struct grub_squash_data *data, - grub_free (block); - } - else -- err = grub_disk_read (data->disk, -+ err = grub_disk_read (data->disk, - (ino->cumulated_block_sizes[i] + a + boff) - >> GRUB_DISK_SECTOR_BITS, - (ino->cumulated_block_sizes[i] + a + boff) -@@ -946,7 +946,7 @@ grub_squash_read (grub_file_t file, char *buf, grub_size_t len) - } - else - off -= direct_len; -- -+ - err = read_chunk (data, &frag, sizeof (frag), - data->fragments, sizeof (frag) * fragment); - if (err) -@@ -957,7 +957,7 @@ grub_squash_read (grub_file_t file, char *buf, grub_size_t len) - b = grub_le_to_cpu32 (ino->ino.long_file.offset) + off; - else - b = grub_le_to_cpu32 (ino->ino.file.offset) + off; -- -+ - /* FIXME: cache uncompressed chunks. */ - if (compressed) - { -@@ -1013,7 +1013,7 @@ grub_squash_mtime (grub_device_t dev, grub_int64_t *tm) - *tm = grub_le_to_cpu32 (data->sb.creation_time); - squash_unmount (data); - return GRUB_ERR_NONE; --} -+} - - static struct grub_fs grub_squash_fs = - { -diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c -index 2ac5c1d0048f..5a665093ed77 100644 ---- a/grub-core/fs/udf.c -+++ b/grub-core/fs/udf.c -@@ -567,7 +567,7 @@ grub_udf_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - (buf + sizeof (struct grub_udf_aed)); - continue; - } -- -+ - if (filebytes < adlen) - { - grub_uint32_t ad_block_num = ad->block.block_num; -diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c -index 34a698b71b8d..a354c92d936a 100644 ---- a/grub-core/fs/ufs.c -+++ b/grub-core/fs/ufs.c -@@ -568,7 +568,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path) - { - dirino = data->ino; - grub_ufs_read_inode (data, grub_ufs_to_cpu32 (dirent.ino), 0); -- -+ - if ((INODE_MODE(data) & GRUB_UFS_ATTR_TYPE) - == GRUB_UFS_ATTR_LNK) - { -@@ -613,7 +613,7 @@ grub_ufs_mount (grub_disk_t disk) - && ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0) - && data->sblock.ino_per_group != 0) - { -- for (data->log2_blksz = 0; -+ for (data->log2_blksz = 0; - (1U << data->log2_blksz) < grub_ufs_to_cpu32 (data->sblock.bsize); - data->log2_blksz++); - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index e3816d1ec4a9..d6de7f1a2dd2 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -894,7 +894,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - tag, which is not used by GRUB. So it can be overwritten. */ - filename[direntry->len] = '\0'; - -- if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode), -+ if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode), - filename, &ctx)) - { - grub_free (dirblock); -diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c -index cf4d2ab189a5..5961818abc9a 100644 ---- a/grub-core/fs/zfs/zfs.c -+++ b/grub-core/fs/zfs/zfs.c -@@ -176,7 +176,7 @@ typedef struct decomp_entry - /* - * Signature for checksum functions. - */ --typedef void zio_checksum_t(const void *data, grub_uint64_t size, -+typedef void zio_checksum_t(const void *data, grub_uint64_t size, - grub_zfs_endian_t endian, zio_cksum_t *zcp); - - /* -@@ -297,7 +297,7 @@ check_feature(const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx) - static grub_err_t - check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data ); - --static grub_err_t -+static grub_err_t - zlib_decompress (void *s, void *d, - grub_size_t slen, grub_size_t dlen) - { -@@ -310,7 +310,7 @@ zlib_decompress (void *s, void *d, - return grub_errno; - } - --static grub_err_t -+static grub_err_t - zle_decompress (void *s, void *d, - grub_size_t slen, grub_size_t dlen) - { -@@ -415,7 +415,7 @@ static zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { - */ - static grub_err_t - zio_checksum_verify (zio_cksum_t zc, grub_uint32_t checksum, -- grub_zfs_endian_t endian, -+ grub_zfs_endian_t endian, - char *buf, grub_size_t size) - { - zio_eck_t *zec = (zio_eck_t *) (buf + size) - 1; -@@ -425,14 +425,14 @@ zio_checksum_verify (zio_cksum_t zc, grub_uint32_t checksum, - if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func == NULL) - { - grub_dprintf ("zfs", "unknown checksum function %d\n", checksum); -- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - "unknown checksum function %d", checksum); - } - - if (ci->ci_eck) - { -- expected_cksum = zec->zec_cksum; -- zec->zec_cksum = zc; -+ expected_cksum = zec->zec_cksum; -+ zec->zec_cksum = zc; - ci->ci_func (buf, size, endian, &actual_cksum); - zec->zec_cksum = expected_cksum; - zc = expected_cksum; -@@ -445,14 +445,14 @@ zio_checksum_verify (zio_cksum_t zc, grub_uint32_t checksum, - { - grub_dprintf ("zfs", "checksum %s verification failed\n", ci->ci_name); - grub_dprintf ("zfs", "actual checksum %016llx %016llx %016llx %016llx\n", -- (unsigned long long) actual_cksum.zc_word[0], -+ (unsigned long long) actual_cksum.zc_word[0], - (unsigned long long) actual_cksum.zc_word[1], -- (unsigned long long) actual_cksum.zc_word[2], -+ (unsigned long long) actual_cksum.zc_word[2], - (unsigned long long) actual_cksum.zc_word[3]); - grub_dprintf ("zfs", "expected checksum %016llx %016llx %016llx %016llx\n", -- (unsigned long long) zc.zc_word[0], -+ (unsigned long long) zc.zc_word[0], - (unsigned long long) zc.zc_word[1], -- (unsigned long long) zc.zc_word[2], -+ (unsigned long long) zc.zc_word[2], - (unsigned long long) zc.zc_word[3]); - return grub_error (GRUB_ERR_BAD_FS, N_("checksum verification failed")); - } -@@ -485,17 +485,17 @@ vdev_uberblock_compare (uberblock_t * ub1, uberblock_t * ub2) - else - ub2_endian = GRUB_ZFS_BIG_ENDIAN; - -- if (grub_zfs_to_cpu64 (ub1->ub_txg, ub1_endian) -+ if (grub_zfs_to_cpu64 (ub1->ub_txg, ub1_endian) - < grub_zfs_to_cpu64 (ub2->ub_txg, ub2_endian)) - return -1; -- if (grub_zfs_to_cpu64 (ub1->ub_txg, ub1_endian) -+ if (grub_zfs_to_cpu64 (ub1->ub_txg, ub1_endian) - > grub_zfs_to_cpu64 (ub2->ub_txg, ub2_endian)) - return 1; - -- if (grub_zfs_to_cpu64 (ub1->ub_timestamp, ub1_endian) -+ if (grub_zfs_to_cpu64 (ub1->ub_timestamp, ub1_endian) - < grub_zfs_to_cpu64 (ub2->ub_timestamp, ub2_endian)) - return -1; -- if (grub_zfs_to_cpu64 (ub1->ub_timestamp, ub1_endian) -+ if (grub_zfs_to_cpu64 (ub1->ub_timestamp, ub1_endian) - > grub_zfs_to_cpu64 (ub2->ub_timestamp, ub2_endian)) - return 1; - -@@ -573,7 +573,7 @@ find_bestub (uberblock_phys_t * ub_array, - grub_errno = GRUB_ERR_NONE; - continue; - } -- if (ubbest == NULL -+ if (ubbest == NULL - || vdev_uberblock_compare (&(ubptr->ubp_uberblock), - &(ubbest->ubp_uberblock)) > 0) - ubbest = ubptr; -@@ -594,10 +594,10 @@ get_psize (blkptr_t * bp, grub_zfs_endian_t endian) - static grub_uint64_t - dva_get_offset (const dva_t *dva, grub_zfs_endian_t endian) - { -- grub_dprintf ("zfs", "dva=%llx, %llx\n", -- (unsigned long long) dva->dva_word[0], -+ grub_dprintf ("zfs", "dva=%llx, %llx\n", -+ (unsigned long long) dva->dva_word[0], - (unsigned long long) dva->dva_word[1]); -- return grub_zfs_to_cpu64 ((dva)->dva_word[1], -+ return grub_zfs_to_cpu64 ((dva)->dva_word[1], - endian) << SPA_MINBLOCKSHIFT; - } - -@@ -720,7 +720,7 @@ fill_vdev_info_real (struct grub_zfs_data *data, - if (!fill->children) - { - fill->n_children = nelm; -- -+ - fill->children = grub_zalloc (fill->n_children - * sizeof (fill->children[0])); - } -@@ -839,7 +839,7 @@ nvlist_next_nvpair (const char *nvl, const char *nvpair) - { - /* skip over header, nvl_version and nvl_nvflag */ - nvpair = nvl + 4 * 3; -- } -+ } - else - { - /* skip to the next nvpair */ -@@ -873,10 +873,10 @@ nvlist_next_nvpair (const char *nvl, const char *nvpair) - name_len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp)); - nvp += 4; - -- nvp = nvp + ((name_len + 3) & ~3); // align -- if (nvp + 4 >= nvl + VDEV_PHYS_SIZE -+ nvp = nvp + ((name_len + 3) & ~3); // align -+ if (nvp + 4 >= nvl + VDEV_PHYS_SIZE - || encode_size < 0 -- || nvp + 4 + encode_size > nvl + VDEV_PHYS_SIZE) -+ || nvp + 4 + encode_size > nvl + VDEV_PHYS_SIZE) - { - grub_dprintf ("zfs", "nvlist overflow\n"); - grub_error (GRUB_ERR_BAD_FS, "incorrect nvlist"); -@@ -896,7 +896,7 @@ nvpair_name (const char *nvp, char **buf, grub_size_t *buflen) - { - /* skip over encode/decode size */ - nvp += 4 * 2; -- -+ - *buf = (char *) (nvp + 4); - *buflen = grub_be_to_cpu32 (grub_get_unaligned32 (nvp)); - -@@ -943,7 +943,7 @@ nvpair_value (const char *nvp,char **val, - - /* skip over name */ - nvp = nvp + ((name_len + 3) & ~3); /* align */ -- -+ - /* skip over type */ - nvp += 4; - nelm = grub_be_to_cpu32 (grub_get_unaligned32 (nvp)); -@@ -957,7 +957,7 @@ nvpair_value (const char *nvp,char **val, - *size_out = encode_size; - if (nelm_out) - *nelm_out = nelm; -- -+ - return 1; - } - -@@ -1183,7 +1183,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data, - desc.vdev_phys_sector - = label * (sizeof (vdev_label_t) >> SPA_MINBLOCKSHIFT) - + ((VDEV_SKIP_SIZE + VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT) -- + (label < VDEV_LABELS / 2 ? 0 : -+ + (label < VDEV_LABELS / 2 ? 0 : - ALIGN_DOWN (grub_disk_native_sectors (dev->disk), sizeof (vdev_label_t)) - - VDEV_LABELS * (sizeof (vdev_label_t) >> SPA_MINBLOCKSHIFT)); - -@@ -1229,7 +1229,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data, - grub_free (bh); - return GRUB_ERR_NONE; - } -- -+ - grub_free (ub_array); - grub_free (bh); - -@@ -1269,7 +1269,7 @@ scan_devices_iter (const char *name, void *hook_data) - - if (!inserted) - grub_device_close (dev); -- -+ - return 0; - } - -@@ -1386,7 +1386,7 @@ recovery (grub_uint8_t *bufs[4], grub_size_t s, const int nbufs, - for (i = 0; i < nbufs; i++) - { - grub_uint8_t mul; -- for (j = i; j < nbufs; j++) -+ for (j = i; j < nbufs; j++) - if (matrix1[i][j]) - break; - if (j == nbufs) -@@ -1453,7 +1453,7 @@ recovery (grub_uint8_t *bufs[4], grub_size_t s, const int nbufs, - } - default: - return grub_error (GRUB_ERR_BUG, "too big matrix"); -- } -+ } - } - - static grub_err_t -@@ -1510,7 +1510,7 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc, - int idx, orig_idx; - - if (desc->nparity < 1 || desc->nparity > 3) -- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - "raidz%d is not supported", desc->nparity); - - if (desc->n_children <= desc->nparity || desc->n_children < 1) -@@ -1659,7 +1659,7 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc, - len -= csize; - idx--; - } -- for (i = 0; i < failed_devices -+ for (i = 0; i < failed_devices - && recovery_len[i] == recovery_len[0]; - i++); - /* Since the chunks have variable length handle the last block -@@ -1782,7 +1782,7 @@ zio_read_gang (blkptr_t * bp, grub_zfs_endian_t endian, dva_t * dva, void *buf, - * Read in a block of raw data to buf. - */ - static grub_err_t --zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian, void *buf, -+zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian, void *buf, - struct grub_zfs_data *data) - { - int i, psize; -@@ -1850,7 +1850,7 @@ decode_embedded_bp_compressed(const blkptr_t *bp, void *buf) - * and put the uncompressed data in buf. - */ - static grub_err_t --zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, -+zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, - grub_size_t *size, struct grub_zfs_data *data) - { - grub_size_t lsize, psize; -@@ -1936,7 +1936,7 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, - if (encrypted) - { - if (!grub_zfs_decrypt) -- err = grub_error (GRUB_ERR_BAD_FS, -+ err = grub_error (GRUB_ERR_BAD_FS, - N_("module `%s' isn't loaded"), - "zfscrypt"); - else -@@ -1960,7 +1960,7 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, - endian)); - return grub_error (GRUB_ERR_BAD_FS, "no key found in keychain"); - } -- grub_dprintf ("zfs", "using key %u (%" PRIxGRUB_UINT64_T -+ grub_dprintf ("zfs", "using key %u (%" PRIxGRUB_UINT64_T - ", %p) for txg %" PRIxGRUB_UINT64_T "\n", - besti, data->subvol.keyring[besti].txg, - data->subvol.keyring[besti].cipher, -@@ -2008,7 +2008,7 @@ zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf, - * - */ - static grub_err_t --dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, -+dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, - grub_zfs_endian_t *endian_out, struct grub_zfs_data *data) - { - int level; -@@ -2038,8 +2038,8 @@ dmu_read (dnode_end_t * dn, grub_uint64_t blkid, void **buf, - - if (BP_IS_HOLE (bp)) - { -- grub_size_t size = grub_zfs_to_cpu16 (dn->dn.dn_datablkszsec, -- dn->endian) -+ grub_size_t size = grub_zfs_to_cpu16 (dn->dn.dn_datablkszsec, -+ dn->endian) - << SPA_MINBLOCKSHIFT; - *buf = grub_malloc (size); - if (!*buf) -@@ -2103,7 +2103,7 @@ mzap_lookup (mzap_phys_t * zapobj, grub_zfs_endian_t endian, - } - - static int --mzap_iterate (mzap_phys_t * zapobj, grub_zfs_endian_t endian, int objsize, -+mzap_iterate (mzap_phys_t * zapobj, grub_zfs_endian_t endian, int objsize, - int (*hook) (const char *name, grub_uint64_t val, - struct grub_zfs_dir_ctx *ctx), - struct grub_zfs_dir_ctx *ctx) -@@ -2117,7 +2117,7 @@ mzap_iterate (mzap_phys_t * zapobj, grub_zfs_endian_t endian, int objsize, - grub_dprintf ("zfs", "zap: name = %s, value = %llx, cd = %x\n", - mzap_ent[i].mze_name, (long long)mzap_ent[i].mze_value, - (int)mzap_ent[i].mze_cd); -- if (hook (mzap_ent[i].mze_name, -+ if (hook (mzap_ent[i].mze_name, - grub_zfs_to_cpu64 (mzap_ent[i].mze_value, endian), ctx)) - return 1; - } -@@ -2178,12 +2178,12 @@ name_cmp (const char *s1, const char *s2, grub_size_t n, - - if (!case_insensitive) - return grub_memcmp (t1, t2, n); -- -+ - while (n--) - { - if (grub_toupper (*t1) != grub_toupper (*t2)) - return (int) grub_toupper (*t1) - (int) grub_toupper (*t2); -- -+ - t1++; - t2++; - } -@@ -2221,7 +2221,7 @@ zap_leaf_array_equal (zap_leaf_phys_t * l, grub_zfs_endian_t endian, - - /* XXX */ - static grub_err_t --zap_leaf_array_get (zap_leaf_phys_t * l, grub_zfs_endian_t endian, int blksft, -+zap_leaf_array_get (zap_leaf_phys_t * l, grub_zfs_endian_t endian, int blksft, - int chunk, grub_size_t array_len, char *buf) - { - grub_size_t bseen = 0; -@@ -2285,7 +2285,7 @@ zap_leaf_lookup (zap_leaf_phys_t * l, grub_zfs_endian_t endian, - - grub_dprintf ("zfs", "fzap: length %d\n", (int) le->le_name_length); - -- if (zap_leaf_array_equal (l, endian, blksft, -+ if (zap_leaf_array_equal (l, endian, blksft, - grub_zfs_to_cpu16 (le->le_name_chunk,endian), - grub_zfs_to_cpu16 (le->le_name_length, endian), - name, case_insensitive)) -@@ -2334,7 +2334,7 @@ fzap_lookup (dnode_end_t * zap_dnode, zap_phys_t * zap, - { - void *l; - grub_uint64_t hash, idx, blkid; -- int blksft = zfs_log2 (grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, -+ int blksft = zfs_log2 (grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, - zap_dnode->endian) << DNODE_SHIFT); - grub_err_t err; - grub_zfs_endian_t leafendian; -@@ -2347,7 +2347,7 @@ fzap_lookup (dnode_end_t * zap_dnode, zap_phys_t * zap, - - /* get block id from index */ - if (zap->zap_ptrtbl.zt_numblks != 0) -- return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - "external pointer tables not supported"); - idx = ZAP_HASH_IDX (hash, zap->zap_ptrtbl.zt_shift); - blkid = grub_zfs_to_cpu64 (((grub_uint64_t *) zap)[idx + (1 << (blksft - 3 - 1))], zap_dnode->endian); -@@ -2379,7 +2379,7 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap, - void *l_in; - grub_uint64_t idx, idx2, blkid; - grub_uint16_t chunk; -- int blksft = zfs_log2 (grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, -+ int blksft = zfs_log2 (grub_zfs_to_cpu16 (zap_dnode->dn.dn_datablkszsec, - zap_dnode->endian) << DNODE_SHIFT); - grub_err_t err; - grub_zfs_endian_t endian; -@@ -2390,7 +2390,7 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap, - /* get block id from index */ - if (zap->zap_ptrtbl.zt_numblks != 0) - { -- grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, -+ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, - "external pointer tables not supported"); - return 0; - } -@@ -2517,7 +2517,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, - grub_dprintf ("zfs", "micro zap\n"); - err = mzap_lookup (zapbuf, endian, size, name, val, - case_insensitive); -- grub_dprintf ("zfs", "returned %d\n", err); -+ grub_dprintf ("zfs", "returned %d\n", err); - grub_free (zapbuf); - return err; - } -@@ -2527,7 +2527,7 @@ zap_lookup (dnode_end_t * zap_dnode, const char *name, grub_uint64_t *val, - /* this is a fat zap */ - err = fzap_lookup (zap_dnode, zapbuf, name, val, data, - case_insensitive); -- grub_dprintf ("zfs", "returned %d\n", err); -+ grub_dprintf ("zfs", "returned %d\n", err); - grub_free (zapbuf); - return err; - } -@@ -2560,7 +2560,7 @@ zap_iterate_u64_transform (const void *name, - } - - static int --zap_iterate_u64 (dnode_end_t * zap_dnode, -+zap_iterate_u64 (dnode_end_t * zap_dnode, - int (*hook) (const char *name, grub_uint64_t val, - struct grub_zfs_dir_ctx *ctx), - struct grub_zfs_data *data, struct grub_zfs_dir_ctx *ctx) -@@ -2607,7 +2607,7 @@ zap_iterate_u64 (dnode_end_t * zap_dnode, - } - - static int --zap_iterate (dnode_end_t * zap_dnode, -+zap_iterate (dnode_end_t * zap_dnode, - grub_size_t nameelemlen, - int (*hook) (const void *name, grub_size_t namelen, - const void *val_in, -@@ -2667,7 +2667,7 @@ dnode_get (dnode_end_t * mdn, grub_uint64_t objnum, grub_uint8_t type, - grub_err_t err; - grub_zfs_endian_t endian; - -- blksz = grub_zfs_to_cpu16 (mdn->dn.dn_datablkszsec, -+ blksz = grub_zfs_to_cpu16 (mdn->dn.dn_datablkszsec, - mdn->endian) << SPA_MINBLOCKSHIFT; - epbs = zfs_log2 (blksz) - DNODE_SHIFT; - -@@ -2678,18 +2678,18 @@ dnode_get (dnode_end_t * mdn, grub_uint64_t objnum, grub_uint8_t type, - blkid = objnum >> epbs; - idx = objnum & ((1 << epbs) - 1); - -- if (data->dnode_buf != NULL && grub_memcmp (data->dnode_mdn, mdn, -- sizeof (*mdn)) == 0 -+ if (data->dnode_buf != NULL && grub_memcmp (data->dnode_mdn, mdn, -+ sizeof (*mdn)) == 0 - && objnum >= data->dnode_start && objnum < data->dnode_end) - { - grub_memmove (&(buf->dn), &(data->dnode_buf)[idx], DNODE_SIZE); - buf->endian = data->dnode_endian; -- if (type && buf->dn.dn_type != type) -- return grub_error(GRUB_ERR_BAD_FS, "incorrect dnode type"); -+ if (type && buf->dn.dn_type != type) -+ return grub_error(GRUB_ERR_BAD_FS, "incorrect dnode type"); - return GRUB_ERR_NONE; - } - -- grub_dprintf ("zfs", "endian = %d, blkid=%llx\n", mdn->endian, -+ grub_dprintf ("zfs", "endian = %d, blkid=%llx\n", mdn->endian, - (unsigned long long) blkid); - err = dmu_read (mdn, blkid, &dnbuf, &endian, data); - if (err) -@@ -2715,8 +2715,8 @@ dnode_get (dnode_end_t * mdn, grub_uint64_t objnum, grub_uint8_t type, - - grub_memmove (&(buf->dn), (dnode_phys_t *) dnbuf + idx, DNODE_SIZE); - buf->endian = endian; -- if (type && buf->dn.dn_type != type) -- return grub_error(GRUB_ERR_BAD_FS, "incorrect dnode type"); -+ if (type && buf->dn.dn_type != type) -+ return grub_error(GRUB_ERR_BAD_FS, "incorrect dnode type"); - - return GRUB_ERR_NONE; - } -@@ -2740,7 +2740,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - struct dnode_chain - { - struct dnode_chain *next; -- dnode_end_t dn; -+ dnode_end_t dn; - }; - struct dnode_chain *dnode_path = 0, *dn_new, *root; - -@@ -2750,7 +2750,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - dn_new->next = 0; - dnode_path = root = dn_new; - -- err = dnode_get (&subvol->mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE, -+ err = dnode_get (&subvol->mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE, - &(dnode_path->dn), data); - if (err) - { -@@ -2801,7 +2801,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - grub_free (dn_new); - return grub_errno; - } -- -+ - while (1) - { - /* skip leading slashes */ -@@ -2827,7 +2827,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - } - else - { -- err = grub_error (GRUB_ERR_FILE_NOT_FOUND, -+ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, - "can't resolve .."); - break; - } -@@ -2877,7 +2877,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - { - grub_size_t block; - grub_size_t blksz; -- blksz = (grub_zfs_to_cpu16 (dnode_path->dn.dn.dn_datablkszsec, -+ blksz = (grub_zfs_to_cpu16 (dnode_path->dn.dn.dn_datablkszsec, - dnode_path->dn.endian) - << SPA_MINBLOCKSHIFT); - -@@ -2916,7 +2916,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - if (err) - break; - free_symval = 1; -- } -+ } - path = path_buf = grub_malloc (sym_sz + grub_strlen (oldpath) + 1); - if (!path_buf) - { -@@ -2930,9 +2930,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - if (free_symval) - grub_free (sym_value); - path [sym_sz] = 0; -- grub_memcpy (path + grub_strlen (path), oldpath, -+ grub_memcpy (path + grub_strlen (path), oldpath, - grub_strlen (oldpath) + 1); -- -+ - grub_free (oldpathbuf); - if (path[0] != '/') - { -@@ -2951,7 +2951,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - { - void *sahdrp; - int hdrsize; -- -+ - if (dnode_path->dn.dn.dn_bonuslen != 0) - { - sahdrp = DN_BONUS (&dnode_path->dn.dn); -@@ -2959,7 +2959,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - else if (dnode_path->dn.dn.dn_flags & DNODE_FLAG_SPILL_BLKPTR) - { - blkptr_t *bp = &dnode_path->dn.dn.dn_spill; -- -+ - err = zio_read (bp, dnode_path->dn.endian, &sahdrp, NULL, data); - if (err) - break; -@@ -2978,7 +2978,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - dnode_path->dn.endian) >> 12) & 0xf) == 0xa) - { - char *sym_value = (char *) sahdrp + hdrsize + SA_SYMLINK_OFFSET; -- grub_size_t sym_sz = -+ grub_size_t sym_sz = - grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp - + hdrsize - + SA_SIZE_OFFSET), -@@ -2993,9 +2993,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, - } - grub_memcpy (path, sym_value, sym_sz); - path [sym_sz] = 0; -- grub_memcpy (path + grub_strlen (path), oldpath, -+ grub_memcpy (path + grub_strlen (path), oldpath, - grub_strlen (oldpath) + 1); -- -+ - grub_free (oldpathbuf); - if (path[0] != '/') - { -@@ -3096,7 +3096,7 @@ get_filesystem_dnode (dnode_end_t * mosmdn, char *fsname, - - grub_dprintf ("zfs", "endian = %d\n", mosmdn->endian); - -- err = dnode_get (mosmdn, DMU_POOL_DIRECTORY_OBJECT, -+ err = dnode_get (mosmdn, DMU_POOL_DIRECTORY_OBJECT, - DMU_OT_OBJECT_DIRECTORY, mdn, data); - if (err) - return err; -@@ -3119,7 +3119,7 @@ get_filesystem_dnode (dnode_end_t * mosmdn, char *fsname, - { - grub_uint64_t childobj; - char *cname, ch; -- -+ - while (*fsname == '/') - fsname++; - -@@ -3279,7 +3279,7 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, - filename = ptr_slash; - else - filename = "/"; -- grub_dprintf ("zfs", "fsname = '%s' snapname='%s' filename = '%s'\n", -+ grub_dprintf ("zfs", "fsname = '%s' snapname='%s' filename = '%s'\n", - fsname, snapname, filename); - } - grub_dprintf ("zfs", "alive\n"); -@@ -3365,7 +3365,7 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, - - snapobj = grub_zfs_to_cpu64 (((dsl_dataset_phys_t *) DN_BONUS (&subvol->mdn.dn))->ds_snapnames_zapobj, subvol->mdn.endian); - -- err = dnode_get (&(data->mos), snapobj, -+ err = dnode_get (&(data->mos), snapobj, - DMU_OT_DSL_DS_SNAP_MAP, &subvol->mdn, data); - if (!err) - err = zap_lookup (&subvol->mdn, snapname, &headobj, data, 0); -@@ -3383,13 +3383,13 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, - subvol->obj = headobj; - - make_mdn (&subvol->mdn, data); -- -+ - grub_dprintf ("zfs", "endian = %d\n", subvol->mdn.endian); - - if (*isfs) - { - grub_free (fsname); -- grub_free (snapname); -+ grub_free (snapname); - return GRUB_ERR_NONE; - } - err = dnode_get_path (subvol, filename, dn, data); -@@ -3409,9 +3409,9 @@ nvlist_find_value (const char *nvlist_in, const char *name, - char *nvp_name; - - /* Verify if the 1st and 2nd byte in the nvlist are valid. */ -- /* NOTE: independently of what endianness header announces all -+ /* NOTE: independently of what endianness header announces all - subsequent values are big-endian. */ -- if (nvlist[0] != NV_ENCODE_XDR || (nvlist[1] != NV_LITTLE_ENDIAN -+ if (nvlist[0] != NV_ENCODE_XDR || (nvlist[1] != NV_LITTLE_ENDIAN - && nvlist[1] != NV_BIG_ENDIAN)) - { - grub_dprintf ("zfs", "incorrect nvlist header\n"); -@@ -3532,13 +3532,13 @@ get_nvlist_size (const char *beg, const char *limit) - { - const char *ptr; - grub_uint32_t encode_size; -- -+ - ptr = beg + 8; - - while (ptr < limit - && (encode_size = grub_be_to_cpu32 (grub_get_unaligned32 (ptr)))) - ptr += encode_size; /* goto the next nvpair */ -- ptr += 8; -+ ptr += 8; - return (ptr > limit) ? -1 : (ptr - beg); - } - -@@ -3674,8 +3674,8 @@ zfs_mount (grub_device_t dev) - } - - ub = &(data->current_uberblock); -- ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic, -- GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC -+ ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic, -+ GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC - ? GRUB_ZFS_LITTLE_ENDIAN : GRUB_ZFS_BIG_ENDIAN); - - err = zio_read (&ub->ub_rootbp, ub_endian, -@@ -3728,7 +3728,7 @@ grub_zfs_fetch_nvlist (grub_device_t dev, char **nvlist) - return err; - } - --static grub_err_t -+static grub_err_t - zfs_label (grub_device_t device, char **label) - { - char *nvlist; -@@ -3740,7 +3740,7 @@ zfs_label (grub_device_t device, char **label) - return grub_errno; - - err = zfs_fetch_nvlist (data->device_original, &nvlist); -- if (err) -+ if (err) - { - zfs_unmount (data); - return err; -@@ -3752,7 +3752,7 @@ zfs_label (grub_device_t device, char **label) - return grub_errno; - } - --static grub_err_t -+static grub_err_t - zfs_uuid (grub_device_t device, char **uuid) - { - struct grub_zfs_data *data; -@@ -3770,7 +3770,7 @@ zfs_uuid (grub_device_t device, char **uuid) - return GRUB_ERR_NONE; - } - --static grub_err_t -+static grub_err_t - zfs_mtime (grub_device_t device, grub_int64_t *mt) - { - struct grub_zfs_data *data; -@@ -3784,8 +3784,8 @@ zfs_mtime (grub_device_t device, grub_int64_t *mt) - return grub_errno; - - ub = &(data->current_uberblock); -- ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic, -- GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC -+ ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic, -+ GRUB_ZFS_LITTLE_ENDIAN) == UBERBLOCK_MAGIC - ? GRUB_ZFS_LITTLE_ENDIAN : GRUB_ZFS_BIG_ENDIAN); - - *mt = grub_zfs_to_cpu64 (ub->ub_timestamp, ub_endian); -@@ -3823,7 +3823,7 @@ grub_zfs_open (struct grub_file *file, const char *fsfilename) - } - - /* We found the dnode for this file. Verify if it is a plain file. */ -- if (data->dnode.dn.dn_type != DMU_OT_PLAIN_FILE_CONTENTS) -+ if (data->dnode.dn.dn_type != DMU_OT_PLAIN_FILE_CONTENTS) - { - zfs_unmount (data); - return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a regular file")); -@@ -3898,7 +3898,7 @@ grub_zfs_read (grub_file_t file, char *buf, grub_size_t len) - return len; - } - -- blksz = grub_zfs_to_cpu16 (data->dnode.dn.dn_datablkszsec, -+ blksz = grub_zfs_to_cpu16 (data->dnode.dn.dn_datablkszsec, - data->dnode.endian) << SPA_MINBLOCKSHIFT; - - if (blksz == 0) -@@ -3991,11 +3991,11 @@ fill_fs_info (struct grub_dirhook_info *info, - dnode_end_t dn; - grub_uint64_t objnum; - grub_uint64_t headobj; -- -+ - grub_memset (info, 0, sizeof (*info)); -- -+ - info->dir = 1; -- -+ - if (mdn.dn.dn_type == DMU_OT_DSL_DIR) - { - headobj = grub_zfs_to_cpu64 (((dsl_dir_phys_t *) DN_BONUS (&mdn.dn))->dd_head_dataset_obj, mdn.endian); -@@ -4010,28 +4010,28 @@ fill_fs_info (struct grub_dirhook_info *info, - err = make_mdn (&mdn, data); - if (err) - return err; -- err = dnode_get (&mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE, -+ err = dnode_get (&mdn, MASTER_NODE_OBJ, DMU_OT_MASTER_NODE, - &dn, data); - if (err) - { - grub_dprintf ("zfs", "failed here\n"); - return err; - } -- -+ - err = zap_lookup (&dn, ZFS_ROOT_OBJ, &objnum, data, 0); - if (err) - { - grub_dprintf ("zfs", "failed here\n"); - return err; - } -- -+ - err = dnode_get (&mdn, objnum, 0, &dn, data); - if (err) - { - grub_dprintf ("zfs", "failed here\n"); - return err; - } -- -+ - if (dn.dn.dn_bonustype == DMU_OT_SA) - { - void *sahdrp; -@@ -4117,15 +4117,15 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx) - info.mtime = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_MTIME_OFFSET), dn.endian); - info.case_insensitive = ctx->data->subvol.case_insensitive; - } -- -+ - if (dn.dn.dn_bonustype == DMU_OT_ZNODE) -- { -+ { - info.mtimeset = 1; - info.mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0], - dn.endian); - } - info.dir = (dn.dn.dn_type == DMU_OT_DIRECTORY_CONTENTS); -- grub_dprintf ("zfs", "type=%d, name=%s\n", -+ grub_dprintf ("zfs", "type=%d, name=%s\n", - (int)dn.dn.dn_type, (char *)name); - return ctx->hook (name, &info, ctx->hook_data); - } -@@ -4219,7 +4219,7 @@ grub_zfs_dir (grub_device_t device, const char *path, - - if (isfs) - { -- grub_uint64_t childobj, headobj; -+ grub_uint64_t childobj, headobj; - grub_uint64_t snapobj; - dnode_end_t dn; - struct grub_dirhook_info info; -@@ -4247,7 +4247,7 @@ grub_zfs_dir (grub_device_t device, const char *path, - } - - zap_iterate_u64 (&dn, iterate_zap_fs, data, &ctx); -- -+ - err = dnode_get (&(data->mos), headobj, DMU_OT_DSL_DATASET, &dn, data); - if (err) - { -@@ -4289,8 +4289,8 @@ check_feature (const char *name, grub_uint64_t val, - return 0; - if (name[0] == 0) - return 0; -- for (i = 0; spa_feature_names[i] != NULL; i++) -- if (grub_strcmp (name, spa_feature_names[i]) == 0) -+ for (i = 0; spa_feature_names[i] != NULL; i++) -+ if (grub_strcmp (name, spa_feature_names[i]) == 0) - return 0; - return 1; - } -@@ -4303,7 +4303,7 @@ check_feature (const char *name, grub_uint64_t val, - * 0: Success. - * errnum: Failure. - */ -- -+ - static grub_err_t - check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data ) - { -@@ -4328,7 +4328,7 @@ check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct gru - errnum = zap_lookup(&dn, DMU_POOL_FEATURES_FOR_READ, &objnum, data,0); - if (errnum != 0) - return errnum; -- -+ - errnum = dnode_get(&mosmdn, objnum, DMU_OTN_ZAP_METADATA, &dn, data); - if (errnum != 0) - return errnum; -diff --git a/grub-core/fs/zfs/zfs_fletcher.c b/grub-core/fs/zfs/zfs_fletcher.c -index 7d27b053dc7a..ad3be6705479 100644 ---- a/grub-core/fs/zfs/zfs_fletcher.c -+++ b/grub-core/fs/zfs/zfs_fletcher.c -@@ -39,14 +39,14 @@ - #include - - void --fletcher_2(const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, -+fletcher_2(const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, - zio_cksum_t *zcp) - { - const grub_uint64_t *ip = buf; - const grub_uint64_t *ipend = ip + (size / sizeof (grub_uint64_t)); - grub_uint64_t a0, b0, a1, b1; -- -- for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) -+ -+ for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) - { - a0 += grub_zfs_to_cpu64 (ip[0], endian); - a1 += grub_zfs_to_cpu64 (ip[1], endian); -@@ -61,14 +61,14 @@ fletcher_2(const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, - } - - void --fletcher_4 (const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, -+fletcher_4 (const void *buf, grub_uint64_t size, grub_zfs_endian_t endian, - zio_cksum_t *zcp) - { - const grub_uint32_t *ip = buf; - const grub_uint32_t *ipend = ip + (size / sizeof (grub_uint32_t)); - grub_uint64_t a, b, c, d; -- -- for (a = b = c = d = 0; ip < ipend; ip++) -+ -+ for (a = b = c = d = 0; ip < ipend; ip++) - { - a += grub_zfs_to_cpu32 (ip[0], endian);; - b += a; -diff --git a/grub-core/fs/zfs/zfs_sha256.c b/grub-core/fs/zfs/zfs_sha256.c -index a181f076c54c..f042fa61ab89 100644 ---- a/grub-core/fs/zfs/zfs_sha256.c -+++ b/grub-core/fs/zfs/zfs_sha256.c -@@ -116,23 +116,23 @@ zio_checksum_SHA256(const void *buf, grub_uint64_t size, - grub_uint8_t pad[128]; - unsigned padsize = size & 63; - unsigned i; -- -+ - for (i = 0; i < size - padsize; i += 64) - SHA256Transform(H, (grub_uint8_t *)buf + i); -- -+ - for (i = 0; i < padsize; i++) - pad[i] = ((grub_uint8_t *)buf)[i]; -- -+ - for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) - pad[padsize] = 0; -- -+ - for (i = 0; i < 8; i++) - pad[padsize++] = (size << 3) >> (56 - 8 * i); -- -+ - for (i = 0; i < padsize && i <= 64; i += 64) - SHA256Transform(H, pad + i); -- -- zcp->zc_word[0] = grub_cpu_to_zfs64 ((grub_uint64_t)H[0] << 32 | H[1], -+ -+ zcp->zc_word[0] = grub_cpu_to_zfs64 ((grub_uint64_t)H[0] << 32 | H[1], - endian); - zcp->zc_word[1] = grub_cpu_to_zfs64 ((grub_uint64_t)H[2] << 32 | H[3], - endian); -diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c -index de3b015f5827..da30e9ab33dd 100644 ---- a/grub-core/fs/zfs/zfscrypt.c -+++ b/grub-core/fs/zfs/zfscrypt.c -@@ -46,7 +46,7 @@ - GRUB_MOD_LICENSE ("GPLv3+"); - - /* -- Mostly based on following article: -+ Mostly based on following article: - https://blogs.oracle.com/darren/entry/zfs_encryption_what_is_on - */ - -@@ -179,7 +179,7 @@ grub_gcm_mul (grub_uint8_t *a, const grub_uint8_t *b) - grub_crypto_xor (res, res, bs, 16); - grub_gcm_mul_x (bs); - } -- -+ - grub_memcpy (a, res, 16); - } - -@@ -275,7 +275,7 @@ algo_decrypt (grub_crypto_cipher_handle_t cipher, grub_uint64_t algo, - } - - static grub_err_t --grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, -+grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, - grub_uint64_t algo, - void *nonce, - char *buf, grub_size_t size, -@@ -286,7 +286,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, - unsigned i; - grub_uint32_t sw[4]; - gcry_err_code_t err; -- -+ - grub_memcpy (sw, nonce, 16); - if (endian != GRUB_ZFS_BIG_ENDIAN) - for (i = 0; i < 4; i++) -@@ -302,7 +302,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher, - sw + 1, 3, 12); - if (err) - return grub_crypto_gcry_error (err); -- -+ - for (i = 0; i < 3; i++) - if (grub_zfs_to_cpu32 (expected_mac[i], endian) - != grub_be_to_cpu32 (mac[i])) -@@ -362,7 +362,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, - grub_crypto_cipher_close (cipher); - continue; - } -- -+ - err = grub_crypto_cipher_set_key (cipher, wrap_key_real, - keylen); - if (err) -@@ -371,7 +371,7 @@ grub_zfs_load_key_real (const struct grub_zfs_key *key, - grub_crypto_cipher_close (cipher); - continue; - } -- -+ - err = algo_decrypt (cipher, algo, decrypted, key->unknown_purpose_key, 32, - mac, key->unknown_purpose_nonce, 2, 16); - if (err || (grub_crypto_memcmp (mac, key->unknown_purpose_key + 32, 16) diff --git a/0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch b/0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch deleted file mode 100644 index f5421ce3..00000000 --- a/0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "t.feng" -Date: Tue, 29 Nov 2022 17:14:15 +0800 -Subject: [PATCH] fs/xfs: Fix memory leaks in XFS module - -Signed-off-by: t.feng -Reviewed-by: Daniel Kiper ---- - grub-core/fs/xfs.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index d6de7f1a2dd2..b67407690c1a 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -585,7 +585,10 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - if (grub_disk_read (node->data->disk, - GRUB_XFS_FSB_TO_BLOCK (node->data, get_fsb (keys, i - 1 + recoffset)) << (node->data->sblock.log2_bsize - GRUB_DISK_SECTOR_BITS), - 0, node->data->bsize, leaf)) -- return 0; -+ { -+ grub_free (leaf); -+ return 0; -+ } - - if ((!node->data->hascrc && - grub_strncmp ((char *) leaf->magic, "BMAP", 4)) || -@@ -751,6 +754,7 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename, - if (err) - { - grub_print_error (); -+ grub_free (fdiro); - return 0; - } - -@@ -861,7 +865,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - blk << dirblk_log2, - dirblk_size, dirblock, 0); - if (numread != dirblk_size) -- return 0; -+ { -+ grub_free (dirblock); -+ return 0; -+ } - - entries = (grub_be_to_cpu32 (tail->leaf_count) - - grub_be_to_cpu32 (tail->leaf_stale)); diff --git a/0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch b/0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch deleted file mode 100644 index 7083a57b..00000000 --- a/0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Darren Kenny -Date: Fri, 2 Jun 2023 18:08:44 +0000 -Subject: [PATCH] fs/xfs: Fix issues found while fuzzing the XFS filesystem - -While performing fuzz testing with XFS filesystem images with ASAN -enabled, several issues were found where the memory accesses are made -beyond the data that is allocated into the struct grub_xfs_data -structure's data field. - -The existing structure didn't store the size of the memory allocated into -the buffer in the data field and had no way to check it. To resolve these -issues, the data size is stored to enable checks into the data buffer. - -With these checks in place, the fuzzing corpus no longer cause any crashes. - -Signed-off-by: Darren Kenny -Signed-off-by: Robbie Harwood -Signed-off-by: Marta Lewandowska -Signed-off-by: Lidong Chen -Reviewed-by: Daniel Kiper ---- - grub-core/fs/xfs.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index b67407690c1a..b91cd32b49ab 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -239,6 +239,7 @@ struct grub_fshelp_node - - struct grub_xfs_data - { -+ grub_size_t data_size; - struct grub_xfs_sblock sblock; - grub_disk_t disk; - int pos; -@@ -611,8 +612,20 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - } - else if (node->inode.format == XFS_INODE_FORMAT_EXT) - { -+ grub_addr_t exts_end = 0; -+ grub_addr_t data_end = 0; -+ - nrec = grub_be_to_cpu32 (node->inode.nextents); - exts = (struct grub_xfs_extent *) grub_xfs_inode_data(&node->inode); -+ -+ if (grub_mul (sizeof (struct grub_xfs_extent), nrec, &exts_end) || -+ grub_add ((grub_addr_t) node->data, exts_end, &exts_end) || -+ grub_add ((grub_addr_t) node->data, node->data->data_size, &data_end) || -+ exts_end > data_end) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "invalid number of XFS extents"); -+ return 0; -+ } - } - else - { -@@ -803,6 +816,9 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - grub_uint8_t *inopos = grub_xfs_inline_de_inopos(dir->data, de); - grub_uint8_t c; - -+ if ((inopos + (smallino ? 4 : 8)) > (grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)) -+ return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode"); -+ - /* inopos might be unaligned. */ - if (smallino) - ino = (((grub_uint32_t) inopos[0]) << 24) -@@ -829,6 +845,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - de->name[de->len] = c; - - de = grub_xfs_inline_next_de(dir->data, head, de); -+ -+ if ((grub_uint8_t *) de >= (grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)) -+ return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); -+ - } - break; - } -@@ -897,6 +917,9 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - } - - filename = (char *)(direntry + 1); -+ if (filename + direntry->len - 1 > (char *) tail) -+ return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); -+ - /* The byte after the filename is for the filetype, padding, or - tag, which is not used by GRUB. So it can be overwritten. */ - filename[direntry->len] = '\0'; -@@ -941,6 +964,8 @@ grub_xfs_mount (grub_disk_t disk) - if (!data) - return 0; - -+ data->data_size = sizeof (struct grub_xfs_data); -+ - grub_dprintf("xfs", "Reading sb\n"); - /* Read the superblock. */ - if (grub_disk_read (disk, 0, 0, -@@ -962,6 +987,7 @@ grub_xfs_mount (grub_disk_t disk) - if (! data) - goto fail; - -+ data->data_size = sz; - data->diropen.data = data; - data->diropen.ino = grub_be_to_cpu64(data->sblock.rootino); - data->diropen.inode_read = 1; diff --git a/0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch b/0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch deleted file mode 100644 index d70ec5ad..00000000 --- a/0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lidong Chen -Date: Thu, 28 Sep 2023 22:33:44 +0000 -Subject: [PATCH] fs/xfs: Incorrect short form directory data boundary check - -After parsing of the current entry, the entry pointer is advanced -to the next entry at the end of the "for" loop. In case where the -last entry is at the end of the data boundary, the advanced entry -pointer can point off the data boundary. The subsequent boundary -check for the advanced entry pointer can cause a failure. - -The fix is to include the boundary check into the "for" loop -condition. - -Signed-off-by: Lidong Chen -Reviewed-by: Daniel Kiper -Tested-by: Sebastian Andrzej Siewior -Tested-by: Marta Lewandowska ---- - grub-core/fs/xfs.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index b91cd32b49ab..ebf962793fa7 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -810,7 +810,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - if (iterate_dir_call_hook (parent, "..", &ctx)) - return 1; - -- for (i = 0; i < head->count; i++) -+ for (i = 0; i < head->count && -+ (grub_uint8_t *) de < ((grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)); i++) - { - grub_uint64_t ino; - grub_uint8_t *inopos = grub_xfs_inline_de_inopos(dir->data, de); -@@ -845,10 +846,6 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - de->name[de->len] = c; - - de = grub_xfs_inline_next_de(dir->data, head, de); -- -- if ((grub_uint8_t *) de >= (grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)) -- return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); -- - } - break; - } diff --git a/0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch b/0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch deleted file mode 100644 index 8c414a8e..00000000 --- a/0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anthony Iliopoulos -Date: Thu, 26 Oct 2023 11:53:39 +0200 -Subject: [PATCH] fs/xfs: Add large extent counters incompat feature support - -XFS introduced 64-bit extent counters for inodes via a series of -upstream commits and the feature was marked as stable in v6.5 via -commit 61d7e8274cd8 (xfs: drop EXPERIMENTAL tag for large extent -counts). - -Further, xfsprogs release v6.5.0 switched this feature on by default -in mkfs.xfs via commit e5b18d7d1d96 (mkfs: enable large extent counts -by default). - -Filesystems formatted with large extent count support, nrext64=1, are -thus currently not recognizable by GRUB, since this is an incompat -feature. Add the required support so that those filesystems and inodes -with large extent counters can be read by GRUB. - -Signed-off-by: Anthony Iliopoulos -Reviewed-by: Andrey Albershteyn -Reviewed-by: Daniel Kiper -Tested-by: Marta Lewandowska -Tested-by: Sebastian Andrzej Siewior ---- - grub-core/fs/xfs.c | 30 +++++++++++++++++++++++++----- - 1 file changed, 25 insertions(+), 5 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index 18edfcff486c..bc2224dbb463 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -79,6 +79,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); - /* Inode flags2 flags */ - #define XFS_DIFLAG2_BIGTIME_BIT 3 - #define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT) -+#define XFS_DIFLAG2_NREXT64_BIT 4 -+#define XFS_DIFLAG2_NREXT64 (1 << XFS_DIFLAG2_NREXT64_BIT) - - /* incompat feature flags */ - #define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ -@@ -86,6 +88,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ - #define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */ - #define XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR (1 << 4) /* needs xfs_repair */ -+#define XFS_SB_FEAT_INCOMPAT_NREXT64 (1 << 5) /* large extent counters */ - - /* - * Directory entries with ftype are explicitly handled by GRUB code. -@@ -101,7 +104,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); - XFS_SB_FEAT_INCOMPAT_SPINODES | \ - XFS_SB_FEAT_INCOMPAT_META_UUID | \ - XFS_SB_FEAT_INCOMPAT_BIGTIME | \ -- XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR) -+ XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR | \ -+ XFS_SB_FEAT_INCOMPAT_NREXT64) - - struct grub_xfs_sblock - { -@@ -203,7 +207,8 @@ struct grub_xfs_inode - grub_uint16_t mode; - grub_uint8_t version; - grub_uint8_t format; -- grub_uint8_t unused2[26]; -+ grub_uint8_t unused2[18]; -+ grub_uint64_t nextents_big; - grub_uint64_t atime; - grub_uint64_t mtime; - grub_uint64_t ctime; -@@ -545,11 +550,26 @@ get_fsb (const void *keys, int idx) - return grub_be_to_cpu64 (grub_get_unaligned64 (p)); - } - -+static int -+grub_xfs_inode_has_large_extent_counts (const struct grub_xfs_inode *inode) -+{ -+ return inode->version >= 3 && -+ (inode->flags2 & grub_cpu_to_be64_compile_time (XFS_DIFLAG2_NREXT64)); -+} -+ -+static grub_uint64_t -+grub_xfs_get_inode_nextents (struct grub_xfs_inode *inode) -+{ -+ return (grub_xfs_inode_has_large_extent_counts (inode)) ? -+ grub_be_to_cpu64 (inode->nextents_big) : -+ grub_be_to_cpu32 (inode->nextents); -+} -+ - static grub_disk_addr_t - grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - { - struct grub_xfs_btree_node *leaf = 0; -- int ex, nrec; -+ grub_uint64_t ex, nrec; - struct grub_xfs_extent *exts; - grub_uint64_t ret = 0; - -@@ -574,7 +594,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - / (2 * sizeof (grub_uint64_t)); - do - { -- int i; -+ grub_uint64_t i; - - for (i = 0; i < nrec; i++) - { -@@ -621,7 +641,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) - grub_addr_t exts_end = 0; - grub_addr_t data_end = 0; - -- nrec = grub_be_to_cpu32 (node->inode.nextents); -+ nrec = grub_xfs_get_inode_nextents (&node->inode); - exts = (struct grub_xfs_extent *) grub_xfs_inode_data(&node->inode); - - if (grub_mul (sizeof (struct grub_xfs_extent), nrec, &exts_end) || diff --git a/0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch b/0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch deleted file mode 100644 index c0057310..00000000 --- a/0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jon DeVree -Date: Tue, 17 Oct 2023 23:03:47 -0400 -Subject: [PATCH] fs/xfs: Fix XFS directory extent parsing - -The XFS directory entry parsing code has never been completely correct -for extent based directories. The parser correctly handles the case -where the directory is contained in a single extent, but then mistakenly -assumes the data blocks for the multiple extent case are each identical -to the single extent case. The difference in the format of the data -blocks between the two cases is tiny enough that its gone unnoticed for -a very long time. - -A recent change introduced some additional bounds checking into the XFS -parser. Like GRUB's existing parser, it is correct for the single extent -case but incorrect for the multiple extent case. When parsing a directory -with multiple extents, this new bounds checking is sometimes (but not -always) tripped and triggers an "invalid XFS directory entry" error. This -probably would have continued to go unnoticed but the /boot/grub/ -directory is large enough that it often has multiple extents. - -The difference between the two cases is that when there are multiple -extents, the data blocks do not contain a trailer nor do they contain -any leaf information. That information is stored in a separate set of -extents dedicated to just the leaf information. These extents come after -the directory entry extents and are not included in the inode size. So -the existing parser already ignores the leaf extents. - -The only reason to read the trailer/leaf information at all is so that -the parser can avoid misinterpreting that data as directory entries. So -this updates the parser as follows: - -For the single extent case the parser doesn't change much: -1. Read the size of the leaf information from the trailer -2. Set the end pointer for the parser to the start of the leaf - information. (The previous bounds checking set the end pointer to the - start of the trailer, so this is actually a small improvement.) -3. Set the entries variable to the expected number of directory entries. - -For the multiple extent case: -1. Set the end pointer to the end of the block. -2. Do not set up the entries variable. Figuring out how many entries are - in each individual block is complex and does not seem worth it when - it appears to be safe to just iterate over the entire block. - -The bounds check itself was also dependent upon the faulty XFS parser -because it accidentally used "filename + length - 1". Presumably this -was able to pass the fuzzer because in the old parser there was always -8 bytes of slack space between the tail pointer and the actual end of -the block. Since this is no longer the case the bounds check needs to be -updated to "filename + length + 1" in order to prevent a regression in -the handling of corrupt fliesystems. - -Notes: -* When there is only one extent there will only ever be one block. If - more than one block is required then XFS will always switch to holding - leaf information in a separate extent. -* B-tree based directories seems to be parsed properly by the same code - that handles multiple extents. This is unlikely to ever occur within - /boot though because its only used when there are an extremely large - number of directory entries. - -Fixes: ef7850c75 (fs/xfs: Fix issues found while fuzzing the XFS filesystem) -Fixes: b2499b29c (Adds support for the XFS filesystem.) -Fixes: https://savannah.gnu.org/bugs/?64376 - -Signed-off-by: Jon DeVree -Reviewed-by: Daniel Kiper -Tested-by: Sebastian Andrzej Siewior -Tested-by: Marta Lewandowska ---- - grub-core/fs/xfs.c | 52 ++++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 38 insertions(+), 14 deletions(-) - -diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c -index ebf962793fa7..18edfcff486c 100644 ---- a/grub-core/fs/xfs.c -+++ b/grub-core/fs/xfs.c -@@ -223,6 +223,12 @@ struct grub_xfs_inode - /* Size of struct grub_xfs_inode v2, up to unused4 member included. */ - #define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76) - -+struct grub_xfs_dir_leaf_entry -+{ -+ grub_uint32_t hashval; -+ grub_uint32_t address; -+} GRUB_PACKED; -+ - struct grub_xfs_dirblock_tail - { - grub_uint32_t leaf_count; -@@ -874,9 +880,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - { - struct grub_xfs_dir2_entry *direntry = - grub_xfs_first_de(dir->data, dirblock); -- int entries; -- struct grub_xfs_dirblock_tail *tail = -- grub_xfs_dir_tail(dir->data, dirblock); -+ int entries = -1; -+ char *end = dirblock + dirblk_size; - - numread = grub_xfs_read_file (dir, 0, 0, - blk << dirblk_log2, -@@ -887,14 +892,27 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - return 0; - } - -- entries = (grub_be_to_cpu32 (tail->leaf_count) -- - grub_be_to_cpu32 (tail->leaf_stale)); -+ /* -+ * Leaf and tail information are only in the data block if the number -+ * of extents is 1. -+ */ -+ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) -+ { -+ struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock); - -- if (!entries) -- continue; -+ end = (char *) tail; -+ -+ /* Subtract the space used by leaf nodes. */ -+ end -= grub_be_to_cpu32 (tail->leaf_count) * sizeof (struct grub_xfs_dir_leaf_entry); -+ -+ entries = grub_be_to_cpu32 (tail->leaf_count) - grub_be_to_cpu32 (tail->leaf_stale); -+ -+ if (!entries) -+ continue; -+ } - - /* Iterate over all entries within this block. */ -- while ((char *)direntry < (char *)tail) -+ while ((char *) direntry < (char *) end) - { - grub_uint8_t *freetag; - char *filename; -@@ -914,7 +932,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - } - - filename = (char *)(direntry + 1); -- if (filename + direntry->len - 1 > (char *) tail) -+ if (filename + direntry->len + 1 > (char *) end) - return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry"); - - /* The byte after the filename is for the filetype, padding, or -@@ -928,11 +946,17 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, - return 1; - } - -- /* Check if last direntry in this block is -- reached. */ -- entries--; -- if (!entries) -- break; -+ /* -+ * The expected number of directory entries is only tracked for the -+ * single extent case. -+ */ -+ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) -+ { -+ /* Check if last direntry in this block is reached. */ -+ entries--; -+ if (!entries) -+ break; -+ } - - /* Select the next directory entry. */ - direntry = grub_xfs_next_de(dir->data, direntry); diff --git a/0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch b/0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch deleted file mode 100644 index 8c2905a6..00000000 --- a/0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Suhanov -Date: Tue, 3 Oct 2023 19:12:23 +0200 -Subject: [PATCH] fs/ntfs: Fix an OOB write when parsing the $ATTRIBUTE_LIST - attribute for the $MFT file - -When parsing an extremely fragmented $MFT file, i.e., the file described -using the $ATTRIBUTE_LIST attribute, current NTFS code will reuse a buffer -containing bytes read from the underlying drive to store sector numbers, -which are consumed later to read data from these sectors into another buffer. - -These sectors numbers, two 32-bit integers, are always stored at predefined -offsets, 0x10 and 0x14, relative to first byte of the selected entry within -the $ATTRIBUTE_LIST attribute. Usually, this won't cause any problem. - -However, when parsing a specially-crafted file system image, this may cause -the NTFS code to write these integers beyond the buffer boundary, likely -causing the GRUB memory allocator to misbehave or fail. These integers contain -values which are controlled by on-disk structures of the NTFS file system. - -Such modification and resulting misbehavior may touch a memory range not -assigned to the GRUB and owned by firmware or another EFI application/driver. - -This fix introduces checks to ensure that these sector numbers are never -written beyond the boundary. - -Fixes: CVE-2023-4692 - -Reported-by: Maxim Suhanov -Signed-off-by: Maxim Suhanov -Reviewed-by: Daniel Kiper ---- - grub-core/fs/ntfs.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 3511e4e2cb6f..4681c7ac32a8 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -184,7 +184,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) - } - if (at->attr_end) - { -- grub_uint8_t *pa; -+ grub_uint8_t *pa, *pa_end; - - at->emft_buf = grub_malloc (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); - if (at->emft_buf == NULL) -@@ -209,11 +209,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) - } - at->attr_nxt = at->edat_buf; - at->attr_end = at->edat_buf + u32at (pa, 0x30); -+ pa_end = at->edat_buf + n; - } - else - { - at->attr_nxt = at->attr_end + u16at (pa, 0x14); - at->attr_end = at->attr_end + u32at (pa, 4); -+ pa_end = at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); - } - at->flags |= GRUB_NTFS_AF_ALST; - while (at->attr_nxt < at->attr_end) -@@ -230,6 +232,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) - at->flags |= GRUB_NTFS_AF_GPOS; - at->attr_cur = at->attr_nxt; - pa = at->attr_cur; -+ -+ if ((pa >= pa_end) || (pa_end - pa < 0x18)) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "can\'t parse attribute list"); -+ return NULL; -+ } -+ - grub_set_unaligned32 ((char *) pa + 0x10, - grub_cpu_to_le32 (at->mft->data->mft_start)); - grub_set_unaligned32 ((char *) pa + 0x14, -@@ -240,6 +249,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) - { - if (*pa != attr) - break; -+ -+ if ((pa >= pa_end) || (pa_end - pa < 0x18)) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "can\'t parse attribute list"); -+ return NULL; -+ } -+ - if (read_attr - (at, pa + 0x10, - u32at (pa, 0x10) * (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR), diff --git a/0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch b/0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch deleted file mode 100644 index 4b506f4f..00000000 --- a/0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Suhanov -Date: Tue, 3 Oct 2023 19:12:24 +0200 -Subject: [PATCH] fs/ntfs: Fix an OOB read when reading data from the resident - $DATA attribute - -When reading a file containing resident data, i.e., the file data is stored in -the $DATA attribute within the NTFS file record, not in external clusters, -there are no checks that this resident data actually fits the corresponding -file record segment. - -When parsing a specially-crafted file system image, the current NTFS code will -read the file data from an arbitrary, attacker-chosen memory offset and of -arbitrary, attacker-chosen length. - -This allows an attacker to display arbitrary chunks of memory, which could -contain sensitive information like password hashes or even plain-text, -obfuscated passwords from BS EFI variables. - -This fix implements a check to ensure that resident data is read from the -corresponding file record segment only. - -Fixes: CVE-2023-4693 - -Reported-by: Maxim Suhanov -Signed-off-by: Maxim Suhanov -Reviewed-by: Daniel Kiper ---- - grub-core/fs/ntfs.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 4681c7ac32a8..1949d48a494f 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -401,7 +401,18 @@ read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, grub_uint8_t *dest, - { - if (ofs + len > u32at (pa, 0x10)) - return grub_error (GRUB_ERR_BAD_FS, "read out of range"); -- grub_memcpy (dest, pa + u32at (pa, 0x14) + ofs, len); -+ -+ if (u32at (pa, 0x10) > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) -+ return grub_error (GRUB_ERR_BAD_FS, "resident attribute too large"); -+ -+ if (pa >= at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) -+ return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range"); -+ -+ if (u16at (pa, 0x14) + u32at (pa, 0x10) > -+ (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) pa) -+ return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range"); -+ -+ grub_memcpy (dest, pa + u16at (pa, 0x14) + ofs, len); - return 0; - } - diff --git a/0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch b/0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch deleted file mode 100644 index 3b02cd5a..00000000 --- a/0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Suhanov -Date: Tue, 3 Oct 2023 19:12:25 +0200 -Subject: [PATCH] fs/ntfs: Fix an OOB read when parsing directory entries from - resident and non-resident index attributes - -This fix introduces checks to ensure that index entries are never read -beyond the corresponding directory index. - -The lack of this check is a minor issue, likely not exploitable in any way. - -Reported-by: Maxim Suhanov -Signed-off-by: Maxim Suhanov -Reviewed-by: Daniel Kiper ---- - grub-core/fs/ntfs.c | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 1949d48a494f..72302033281a 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -599,7 +599,7 @@ get_utf8 (grub_uint8_t *in, grub_size_t len) - } - - static int --list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, -+list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, grub_uint8_t *end_pos, - grub_fshelp_iterate_dir_hook_t hook, void *hook_data) - { - grub_uint8_t *np; -@@ -610,6 +610,9 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, - grub_uint8_t namespace; - char *ustr; - -+ if ((pos >= end_pos) || (end_pos - pos < 0x52)) -+ break; -+ - if (pos[0xC] & 2) /* end signature */ - break; - -@@ -617,6 +620,9 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, - ns = *(np++); - namespace = *(np++); - -+ if (2 * ns > end_pos - pos - 0x52) -+ break; -+ - /* - * Ignore files in DOS namespace, as they will reappear as Win32 - * names. -@@ -802,7 +808,9 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, - } - - cur_pos += 0x10; /* Skip index root */ -- ret = list_file (mft, cur_pos + u16at (cur_pos, 0), hook, hook_data); -+ ret = list_file (mft, cur_pos + u16at (cur_pos, 0), -+ at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR), -+ hook, hook_data); - if (ret) - goto done; - -@@ -889,6 +897,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, - (const grub_uint8_t *) "INDX"))) - goto done; - ret = list_file (mft, &indx[0x18 + u16at (indx, 0x18)], -+ indx + (mft->data->idx_size << GRUB_NTFS_BLK_SHR), - hook, hook_data); - if (ret) - goto done; diff --git a/0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch b/0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch deleted file mode 100644 index 6e332b03..00000000 --- a/0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Suhanov -Date: Tue, 3 Oct 2023 19:12:26 +0200 -Subject: [PATCH] fs/ntfs: Fix an OOB read when parsing bitmaps for index - attributes - -This fix introduces checks to ensure that bitmaps for directory indices -are never read beyond their actual sizes. - -The lack of this check is a minor issue, likely not exploitable in any way. - -Reported-by: Maxim Suhanov -Signed-off-by: Maxim Suhanov -Reviewed-by: Daniel Kiper ---- - grub-core/fs/ntfs.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 72302033281a..74515114287f 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -839,6 +839,25 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, - - if (is_resident) - { -+ if (bitmap_len > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "resident bitmap too large"); -+ goto done; -+ } -+ -+ if (cur_pos >= at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "resident bitmap out of range"); -+ goto done; -+ } -+ -+ if (u16at (cur_pos, 0x14) + u32at (cur_pos, 0x10) > -+ (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) cur_pos) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "resident bitmap out of range"); -+ goto done; -+ } -+ - grub_memcpy (bmp, cur_pos + u16at (cur_pos, 0x14), - bitmap_len); - } diff --git a/0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch b/0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch deleted file mode 100644 index 4821d6cb..00000000 --- a/0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Suhanov -Date: Tue, 3 Oct 2023 19:12:27 +0200 -Subject: [PATCH] fs/ntfs: Fix an OOB read when parsing a volume label - -This fix introduces checks to ensure that an NTFS volume label is always -read from the corresponding file record segment. - -The current NTFS code allows the volume label string to be read from an -arbitrary, attacker-chosen memory location. However, the bytes read are -always treated as UTF-16LE. So, the final string displayed is mostly -unreadable and it can't be easily converted back to raw bytes. - -The lack of this check is a minor issue, likely not causing a significant -data leak. - -Reported-by: Maxim Suhanov -Signed-off-by: Maxim Suhanov -Reviewed-by: Daniel Kiper ---- - grub-core/fs/ntfs.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 74515114287f..32ba8276dd8d 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -1209,13 +1209,29 @@ grub_ntfs_label (grub_device_t device, char **label) - - init_attr (&mft->attr, mft); - pa = find_attr (&mft->attr, GRUB_NTFS_AT_VOLUME_NAME); -+ -+ if (pa >= mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR)) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "can\'t parse volume label"); -+ goto fail; -+ } -+ -+ if (mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR) - pa < 0x16) -+ { -+ grub_error (GRUB_ERR_BAD_FS, "can\'t parse volume label"); -+ goto fail; -+ } -+ - if ((pa) && (pa[8] == 0) && (u32at (pa, 0x10))) - { - int len; - - len = u32at (pa, 0x10) / 2; - pa += u16at (pa, 0x14); -- *label = get_utf8 (pa, len); -+ if (mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR) - pa >= 2 * len) -+ *label = get_utf8 (pa, len); -+ else -+ grub_error (GRUB_ERR_BAD_FS, "can\'t parse volume label"); - } - - fail: diff --git a/0359-fs-ntfs-Make-code-more-readable.patch b/0359-fs-ntfs-Make-code-more-readable.patch deleted file mode 100644 index dcd1906e..00000000 --- a/0359-fs-ntfs-Make-code-more-readable.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Maxim Suhanov -Date: Tue, 3 Oct 2023 19:12:28 +0200 -Subject: [PATCH] fs/ntfs: Make code more readable - -Move some calls used to access NTFS attribute header fields into -functions with human-readable names. - -Suggested-by: Daniel Kiper -Signed-off-by: Maxim Suhanov -Reviewed-by: Daniel Kiper ---- - grub-core/fs/ntfs.c | 48 +++++++++++++++++++++++++++++++++--------------- - 1 file changed, 33 insertions(+), 15 deletions(-) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 32ba8276dd8d..991b1c2094f5 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -52,6 +52,24 @@ u64at (void *ptr, grub_size_t ofs) - return grub_le_to_cpu64 (grub_get_unaligned64 ((char *) ptr + ofs)); - } - -+static grub_uint16_t -+first_attr_off (void *mft_buf_ptr) -+{ -+ return u16at (mft_buf_ptr, 0x14); -+} -+ -+static grub_uint16_t -+res_attr_data_off (void *res_attr_ptr) -+{ -+ return u16at (res_attr_ptr, 0x14); -+} -+ -+static grub_uint32_t -+res_attr_data_len (void *res_attr_ptr) -+{ -+ return u32at (res_attr_ptr, 0x10); -+} -+ - grub_ntfscomp_func_t grub_ntfscomp_func; - - static grub_err_t -@@ -106,7 +124,7 @@ init_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft) - { - at->mft = mft; - at->flags = (mft == &mft->data->mmft) ? GRUB_NTFS_AF_MMFT : 0; -- at->attr_nxt = mft->buf + u16at (mft->buf, 0x14); -+ at->attr_nxt = mft->buf + first_attr_off (mft->buf); - at->attr_end = at->emft_buf = at->edat_buf = at->sbuf = NULL; - } - -@@ -154,7 +172,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) - return NULL; - } - -- new_pos = &at->emft_buf[u16at (at->emft_buf, 0x14)]; -+ new_pos = &at->emft_buf[first_attr_off (at->emft_buf)]; - while (*new_pos != 0xFF) - { - if ((*new_pos == *at->attr_cur) -@@ -213,7 +231,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) - } - else - { -- at->attr_nxt = at->attr_end + u16at (pa, 0x14); -+ at->attr_nxt = at->attr_end + res_attr_data_off (pa); - at->attr_end = at->attr_end + u32at (pa, 4); - pa_end = at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); - } -@@ -399,20 +417,20 @@ read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, grub_uint8_t *dest, - - if (pa[8] == 0) - { -- if (ofs + len > u32at (pa, 0x10)) -+ if (ofs + len > res_attr_data_len (pa)) - return grub_error (GRUB_ERR_BAD_FS, "read out of range"); - -- if (u32at (pa, 0x10) > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) -+ if (res_attr_data_len (pa) > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) - return grub_error (GRUB_ERR_BAD_FS, "resident attribute too large"); - - if (pa >= at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR)) - return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range"); - -- if (u16at (pa, 0x14) + u32at (pa, 0x10) > -+ if (res_attr_data_off (pa) + res_attr_data_len (pa) > - (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) pa) - return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range"); - -- grub_memcpy (dest, pa + u16at (pa, 0x14) + ofs, len); -+ grub_memcpy (dest, pa + res_attr_data_off (pa) + ofs, len); - return 0; - } - -@@ -556,7 +574,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint64_t mftno) - (unsigned long long) mftno); - - if (!pa[8]) -- mft->size = u32at (pa, 0x10); -+ mft->size = res_attr_data_len (pa); - else - mft->size = u64at (pa, 0x30); - -@@ -801,7 +819,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, - (u32at (cur_pos, 0x18) != 0x490024) || - (u32at (cur_pos, 0x1C) != 0x300033)) - continue; -- cur_pos += u16at (cur_pos, 0x14); -+ cur_pos += res_attr_data_off (cur_pos); - if (*cur_pos != 0x30) /* Not filename index */ - continue; - break; -@@ -830,7 +848,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, - { - int is_resident = (cur_pos[8] == 0); - -- bitmap_len = ((is_resident) ? u32at (cur_pos, 0x10) : -+ bitmap_len = ((is_resident) ? res_attr_data_len (cur_pos) : - u32at (cur_pos, 0x28)); - - bmp = grub_malloc (bitmap_len); -@@ -851,14 +869,14 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, - goto done; - } - -- if (u16at (cur_pos, 0x14) + u32at (cur_pos, 0x10) > -+ if (res_attr_data_off (cur_pos) + res_attr_data_len (cur_pos) > - (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) cur_pos) - { - grub_error (GRUB_ERR_BAD_FS, "resident bitmap out of range"); - goto done; - } - -- grub_memcpy (bmp, cur_pos + u16at (cur_pos, 0x14), -+ grub_memcpy (bmp, cur_pos + res_attr_data_off (cur_pos), - bitmap_len); - } - else -@@ -1222,12 +1240,12 @@ grub_ntfs_label (grub_device_t device, char **label) - goto fail; - } - -- if ((pa) && (pa[8] == 0) && (u32at (pa, 0x10))) -+ if ((pa) && (pa[8] == 0) && (res_attr_data_len (pa))) - { - int len; - -- len = u32at (pa, 0x10) / 2; -- pa += u16at (pa, 0x14); -+ len = res_attr_data_len (pa) / 2; -+ pa += res_attr_data_off (pa); - if (mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR) - pa >= 2 * len) - *label = get_utf8 (pa, len); - else diff --git a/bootstrap b/bootstrap index 5b08e7e2..c6d434da 100755 --- a/bootstrap +++ b/bootstrap @@ -1,10 +1,10 @@ #! /bin/sh # Print a version string. -scriptversion=2019-01-04.17; # UTC +scriptversion=2024-07-10.18; # UTC # Bootstrap this package from checked-out sources. -# Copyright (C) 2003-2019 Free Software Foundation, Inc. +# Copyright (C) 2003-2022 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ PERL="${PERL-perl}" me=$0 -default_gnulib_url=git://git.sv.gnu.org/gnulib +default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git usage() { cat </dev/null) +if test -z "$package"; then + package=$(sed -n "$extract_package_name" configure.ac) \ + || die 'cannot find package name in configure.ac' +fi gnulib_name=lib$package build_aux=build-aux @@ -290,62 +313,6 @@ find_tool () eval "export $find_tool_envvar" } -# Override the default configuration, if necessary. -# Make sure that bootstrap.conf is sourced from the current directory -# if we were invoked as "sh bootstrap". -case "$0" in - */*) test -r "$0.conf" && . "$0.conf" ;; - *) test -r "$0.conf" && . ./"$0.conf" ;; -esac - -if test "$vc_ignore" = auto; then - vc_ignore= - test -d .git && vc_ignore=.gitignore - test -d CVS && vc_ignore="$vc_ignore .cvsignore" -fi - -if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then - use_gnulib=false -else - use_gnulib=true -fi - -# Translate configuration into internal form. - -# Parse options. - -for option -do - case $option in - --help) - usage - exit;; - --gnulib-srcdir=*) - GNULIB_SRCDIR=${option#--gnulib-srcdir=};; - --skip-po) - SKIP_PO=t;; - --force) - checkout_only_file=;; - --copy) - copy=true;; - --bootstrap-sync) - bootstrap_sync=true;; - --no-bootstrap-sync) - bootstrap_sync=false;; - --no-git) - use_git=false;; - *) - die "$option: unknown option";; - esac -done - -$use_git || test -d "$GNULIB_SRCDIR" \ - || die "Error: --no-git requires --gnulib-srcdir" - -if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then - die "Bootstrapping from a non-checked-out distribution is risky." -fi - # Strip blank and comment lines to leave significant entries. gitignore_entries() { sed '/^#/d; /^$/d' "$@" @@ -387,6 +354,137 @@ insert_vc_ignore() { insert_if_absent "$vc_ignore_file" "$pattern" } +symlink_to_dir() +{ + src=$1/$2 + dst=${3-$2} + + test -f "$src" && { + + # If the destination directory doesn't exist, create it. + # This is required at least for "lib/uniwidth/cjk.h". + dst_dir=$(dirname "$dst") + if ! test -d "$dst_dir"; then + mkdir -p "$dst_dir" + + # If we've just created a directory like lib/uniwidth, + # tell version control system(s) it's ignorable. + # FIXME: for now, this does only one level + parent=$(dirname "$dst_dir") + for dot_ig in x $vc_ignore; do + test $dot_ig = x && continue + ig=$parent/$dot_ig + insert_vc_ignore $ig "${dst_dir##*/}" + done + fi + + if $copy; then + { + test ! -h "$dst" || { + echo "$me: rm -f $dst" && + rm -f "$dst" + } + } && + test -f "$dst" && + cmp -s "$src" "$dst" || { + echo "$me: cp -fp $src $dst" && + cp -fp "$src" "$dst" + } + else + # Leave any existing symlink alone, if it already points to the source, + # so that broken build tools that care about symlink times + # aren't confused into doing unnecessary builds. Conversely, if the + # existing symlink's timestamp is older than the source, make it afresh, + # so that broken tools aren't confused into skipping needed builds. See + # . + test -h "$dst" && + src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && + dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && + test "$src_i" = "$dst_i" && + both_ls=$(ls -dt "$src" "$dst") && + test "X$both_ls" = "X$dst$nl$src" || { + dot_dots= + case $src in + /*) ;; + *) + case /$dst/ in + *//* | */../* | */./* | /*/*/*/*/*/) + die "invalid symlink calculation: $src -> $dst";; + /*/*/*/*/) dot_dots=../../../;; + /*/*/*/) dot_dots=../../;; + /*/*/) dot_dots=../;; + esac;; + esac + + echo "$me: ln -fs $dot_dots$src $dst" && + ln -fs "$dot_dots$src" "$dst" + } + fi + } +} + +# Override the default configuration, if necessary. +# Make sure that bootstrap.conf is sourced from the current directory +# if we were invoked as "sh bootstrap". +case "$0" in + */*) test -r "$0.conf" && . "$0.conf" ;; + *) test -r "$0.conf" && . ./"$0.conf" ;; +esac + +if test "$vc_ignore" = auto; then + vc_ignore= + test -d .git && vc_ignore=.gitignore + test -d CVS && vc_ignore="$vc_ignore .cvsignore" +fi + +if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then + use_gnulib=false +else + use_gnulib=true +fi + +# Translate configuration into internal form. + +# Parse options. + +for option +do + case $option in + --help) + usage + exit;; + --version) + set -e + echo "bootstrap $scriptversion" + echo "$copyright" + exit 0 + ;; + --gnulib-srcdir=*) + GNULIB_SRCDIR=${option#--gnulib-srcdir=};; + --skip-po) + SKIP_PO=t;; + --force) + checkout_only_file=;; + --copy) + copy=true;; + --bootstrap-sync) + bootstrap_sync=true;; + --no-bootstrap-sync) + bootstrap_sync=false;; + --no-git) + use_git=false;; + *) + bootstrap_option_hook $option || die "$option: unknown option";; + esac +done + +$use_git || test -d "$GNULIB_SRCDIR" \ + || die "Error: --no-git requires --gnulib-srcdir" + +if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then + die "Bootstrapping from a non-checked-out distribution is risky." +fi + # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. found_aux_dir=no grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \ @@ -665,9 +763,25 @@ if $use_gnulib; then shallow= if test -z "$GNULIB_REVISION"; then git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' + git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ + || cleanup_gnulib + else + git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2' + mkdir -p "$gnulib_path" + # Only want a shallow checkout of $GNULIB_REVISION, but git does not + # support cloning by commit hash. So attempt a shallow fetch by commit + # hash to minimize the amount of data downloaded and changes needed to + # be processed, which can drastically reduce download and processing + # time for checkout. If the fetch by commit fails, a shallow fetch can + # not be performed because we do not know what the depth of the commit + # is without fetching all commits. So fallback to fetching all commits. + git -C "$gnulib_path" init + git -C "$gnulib_path" remote add origin ${GNULIB_URL:-$default_gnulib_url} + git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \ + || git -C "$gnulib_path" fetch origin \ + || cleanup_gnulib + git -C "$gnulib_path" reset --hard FETCH_HEAD fi - git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \ - || cleanup_gnulib trap - 1 2 13 15 fi @@ -784,75 +898,6 @@ case $SKIP_PO in fi;; esac -symlink_to_dir() -{ - src=$1/$2 - dst=${3-$2} - - test -f "$src" && { - - # If the destination directory doesn't exist, create it. - # This is required at least for "lib/uniwidth/cjk.h". - dst_dir=$(dirname "$dst") - if ! test -d "$dst_dir"; then - mkdir -p "$dst_dir" - - # If we've just created a directory like lib/uniwidth, - # tell version control system(s) it's ignorable. - # FIXME: for now, this does only one level - parent=$(dirname "$dst_dir") - for dot_ig in x $vc_ignore; do - test $dot_ig = x && continue - ig=$parent/$dot_ig - insert_vc_ignore $ig "${dst_dir##*/}" - done - fi - - if $copy; then - { - test ! -h "$dst" || { - echo "$me: rm -f $dst" && - rm -f "$dst" - } - } && - test -f "$dst" && - cmp -s "$src" "$dst" || { - echo "$me: cp -fp $src $dst" && - cp -fp "$src" "$dst" - } - else - # Leave any existing symlink alone, if it already points to the source, - # so that broken build tools that care about symlink times - # aren't confused into doing unnecessary builds. Conversely, if the - # existing symlink's timestamp is older than the source, make it afresh, - # so that broken tools aren't confused into skipping needed builds. See - # . - test -h "$dst" && - src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 && - dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 && - test "$src_i" = "$dst_i" && - both_ls=$(ls -dt "$src" "$dst") && - test "X$both_ls" = "X$dst$nl$src" || { - dot_dots= - case $src in - /*) ;; - *) - case /$dst/ in - *//* | */../* | */./* | /*/*/*/*/*/) - die "invalid symlink calculation: $src -> $dst";; - /*/*/*/*/) dot_dots=../../../;; - /*/*/*/) dot_dots=../../;; - /*/*/) dot_dots=../;; - esac;; - esac - - echo "$me: ln -fs $dot_dots$src $dst" && - ln -fs "$dot_dots$src" "$dst" - } - fi - } -} - version_controlled_file() { parent=$1 file=$2 @@ -970,7 +1015,7 @@ bootstrap_post_import_hook \ # Uninitialized submodules are listed with an initial dash. if $use_git && git submodule | grep '^-' >/dev/null; then die "some git submodules are not initialized. " \ - "Run 'git submodule init' and bootstrap again." + "Run 'git submodule update --init' and bootstrap again." fi # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some @@ -1064,7 +1109,7 @@ bootstrap_epilogue echo "$0: done. Now you can run './configure'." -# Local variables: +# Local Variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" diff --git a/bootstrap.conf b/bootstrap.conf index 6b043fc3..7a7813d2 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -1,6 +1,6 @@ # Bootstrap configuration. -# Copyright (C) 2006-2019 Free Software Foundation, Inc. +# Copyright (C) 2006-2022 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,11 +16,10 @@ # along with this program. If not, see . -GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263 +GNULIB_REVISION=9f48fb992a3d7e96610c4ce8be969cff2d61a01b # gnulib modules used by this package. -# mbswidth is used by gnulib-fix-width.diff's changes to argp rather than -# directly. +# mbswidth is used by fix-width.diff's changes to argp rather than directly. gnulib_modules=" argp base64 @@ -35,6 +34,7 @@ gnulib_modules=" realloc-gnu regex save-cwd + stdbool " gnulib_tool_option_extras="\ @@ -66,10 +66,11 @@ SKIP_PO=t # Build prerequisites buildreq="\ -autoconf 2.63 -automake 1.11 -gettext 0.18.3 +autoconf 2.64 +automake 1.14 +gettext - git 1.5.5 +patch - tar - " @@ -79,11 +80,12 @@ cp -a INSTALL INSTALL.grub bootstrap_post_import_hook () { set -e - for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \ - fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do - patch -d grub-core/lib/gnulib -p2 \ - < "grub-core/lib/gnulib-patches/$patchname.patch" - done + + # Instead of patching our gnulib and therefore maintaining a fork, submit + # changes to gnulib and update the hash above when they've merged. Do not + # add new patches here. + patch -d grub-core/lib/gnulib -p2 < grub-core/lib/gnulib-patches/fix-width.patch + for patchname in \ 0001-Support-POTFILES-shell \ 0002-Handle-gettext_printf-shell-function \ diff --git a/gitignore b/gitignore index f6a1bd05..4d0dfb70 100644 --- a/gitignore +++ b/gitignore @@ -11,11 +11,13 @@ *.img *.log *.lst +!/grub-core/extra_deps.lst *.marker *.mod *.o *.pf2 *.pp +*.pyc *.trs *~ .deps-core/ @@ -230,6 +232,8 @@ widthspec.bin /lib/libgcrypt-grub /libgrub_a_init.c /lzocompress_test +/luks1_test +/luks2_test /m4/ /minixfs_test /missing diff --git a/grub.patches b/grub.patches index d37e8978..c0d6a4e1 100644 --- a/grub.patches +++ b/grub.patches @@ -1,364 +1,271 @@ Patch0001: 0001-Revert-templates-Fix-user-facing-typo-with-an-incorr.patch Patch0002: 0002-Revert-templates-Properly-disable-the-os-prober-by-d.patch Patch0003: 0003-Revert-templates-Disable-the-os-prober-by-default.patch -Patch0004: 0004-Add-support-for-Linux-EFI-stub-loading.patch -Patch0005: 0005-Rework-linux-command.patch -Patch0006: 0006-Rework-linux16-command.patch -Patch0007: 0007-Add-secureboot-support-on-efi-chainloader.patch -Patch0008: 0008-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch -Patch0009: 0009-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch -Patch0010: 0010-re-write-.gitignore.patch -Patch0011: 0011-IBM-client-architecture-CAS-reboot-support.patch -Patch0012: 0012-for-ppc-reset-console-display-attr-when-clear-screen.patch -Patch0013: 0013-Disable-GRUB-video-support-for-IBM-power-machines.patch -Patch0014: 0014-Move-bash-completion-script-922997.patch -Patch0015: 0015-Allow-fallback-to-include-entries-by-title-not-just-.patch -Patch0016: 0016-Make-exit-take-a-return-code.patch -Patch0017: 0017-Make-efi-machines-load-an-env-block-from-a-variable.patch -Patch0018: 0018-Migrate-PPC-from-Yaboot-to-Grub2.patch -Patch0019: 0019-Add-fw_path-variable-revised.patch -Patch0020: 0020-Pass-x-hex-hex-straight-through-unmolested.patch -Patch0021: 0021-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch -Patch0022: 0022-Add-devicetree-loading.patch -Patch0023: 0023-Enable-pager-by-default.-985860.patch -Patch0024: 0024-Don-t-say-GNU-Linux-in-generated-menus.patch -Patch0025: 0025-Add-.eh_frame-to-list-of-relocations-stripped.patch -Patch0026: 0026-Don-t-require-a-password-to-boot-entries-generated-b.patch -Patch0027: 0027-use-fw_path-prefix-when-fallback-searching-for-grub-.patch -Patch0028: 0028-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch -Patch0029: 0029-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch -Patch0030: 0030-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch -Patch0031: 0031-Try-prefix-if-fw_path-doesn-t-work.patch -Patch0032: 0032-Make-grub2-mkconfig-construct-titles-that-look-like-.patch -Patch0033: 0033-Add-friendly-grub2-password-config-tool-985962.patch -Patch0034: 0034-tcp-add-window-scaling-support.patch -Patch0035: 0035-efinet-and-bootp-add-support-for-dhcpv6.patch -Patch0036: 0036-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch -Patch0037: 0037-bz1374141-fix-incorrect-mask-for-ppc64.patch -Patch0038: 0038-Make-grub_fatal-also-backtrace.patch -Patch0039: 0039-Make-our-info-pages-say-grub2-where-appropriate.patch -Patch0040: 0040-macos-just-build-chainloader-entries-don-t-try-any-x.patch -Patch0041: 0041-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch -Patch0042: 0042-export-btrfs_subvol-and-btrfs_subvolid.patch -Patch0043: 0043-grub2-btrfs-03-follow_default.patch -Patch0044: 0044-grub2-btrfs-04-grub2-install.patch -Patch0045: 0045-grub2-btrfs-05-grub2-mkconfig.patch -Patch0046: 0046-grub2-btrfs-06-subvol-mount.patch -Patch0047: 0047-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch -Patch0048: 0048-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch -Patch0049: 0049-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch -Patch0050: 0050-Use-grub_efi_.-memory-helpers-where-reasonable.patch -Patch0051: 0051-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch -Patch0052: 0052-don-t-use-int-for-efi-status.patch -Patch0053: 0053-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch -Patch0054: 0054-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch -Patch0055: 0055-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch -Patch0056: 0056-Make-pmtimer-tsc-calibration-not-take-51-seconds-to-.patch -Patch0057: 0057-align-struct-efi_variable-better.patch -Patch0058: 0058-Add-BLS-support-to-grub-mkconfig.patch -Patch0059: 0059-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch -Patch0060: 0060-Add-grub2-switch-to-blscfg.patch -Patch0061: 0061-make-better-backtraces.patch -Patch0062: 0062-normal-don-t-draw-our-startup-message-if-debug-is-se.patch -Patch0063: 0063-Work-around-some-minor-include-path-weirdnesses.patch -Patch0064: 0064-Make-it-possible-to-enabled-build-id-sha1.patch -Patch0065: 0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch -Patch0066: 0066-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch -Patch0067: 0067-Fixup-for-newer-compiler.patch -Patch0068: 0068-Don-t-attempt-to-export-the-start-and-_start-symbols.patch -Patch0069: 0069-Fixup-for-newer-compiler.patch -Patch0070: 0070-Add-support-for-non-Ethernet-network-cards.patch -Patch0071: 0071-net-read-bracketed-ipv6-addrs-and-port-numbers.patch -Patch0072: 0072-bootp-New-net_bootp6-command.patch -Patch0073: 0073-efinet-UEFI-IPv6-PXE-support.patch -Patch0074: 0074-grub.texi-Add-net_bootp6-doument.patch -Patch0075: 0075-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch0076: 0076-efinet-Setting-network-from-UEFI-device-path.patch -Patch0077: 0077-efinet-Setting-DNS-server-from-UEFI-protocol.patch -Patch0078: 0078-Support-UEFI-networking-protocols.patch -Patch0079: 0079-AUDIT-0-http-boot-tracker-bug.patch -Patch0080: 0080-grub-editenv-Add-incr-command-to-increment-integer-v.patch -Patch0081: 0081-Add-auto-hide-menu-support.patch -Patch0082: 0082-Add-grub-set-bootflag-utility.patch -Patch0083: 0083-docs-Add-grub-boot-indeterminate.service-example.patch -Patch0084: 0084-gentpl-add-disable-support.patch -Patch0085: 0085-gentpl-add-pc-firmware-type.patch -Patch0086: 0086-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0087: 0087-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0088: 0088-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0089: 0089-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0090: 0090-Rework-how-the-fdt-command-builds.patch -Patch0091: 0091-Disable-non-wordsize-allocations-on-arm.patch -Patch0092: 0092-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0093: 0093-Make-grub_error-more-verbose.patch -Patch0094: 0094-Make-reset-an-alias-for-the-reboot-command.patch -Patch0095: 0095-Add-a-version-command.patch -Patch0096: 0096-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0097: 0097-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0098: 0098-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0099: 0099-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0100: 0100-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0101: 0101-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0102: 0102-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0103: 0103-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0104: 0104-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0105: 0105-Fix-getroot.c-s-trampolines.patch -Patch0106: 0106-Do-not-allow-stack-trampolines-anywhere.patch -Patch0107: 0107-Reimplement-boot_counter.patch -Patch0108: 0108-Fix-menu-entry-selection-based-on-ID-and-title.patch -Patch0109: 0109-Make-the-menu-entry-users-option-argument-to-be-opti.patch -Patch0110: 0110-Add-efi-export-env-and-efi-load-env-commands.patch -Patch0111: 0111-Make-it-possible-to-subtract-conditions-from-debug.patch -Patch0112: 0112-Export-all-variables-from-the-initial-context-when-c.patch -Patch0113: 0113-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch -Patch0114: 0114-Don-t-assume-that-boot-commands-will-only-return-on-.patch -Patch0115: 0115-grub-set-bootflag-Update-comment-about-running-as-ro.patch -Patch0116: 0116-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch -Patch0117: 0117-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch -Patch0118: 0118-Add-start-symbol-for-RISC-V.patch -Patch0119: 0119-bootstrap.conf-Force-autogen.sh-to-use-python3.patch -Patch0120: 0120-efi-http-Export-fw-http-_path-variables-to-make-them.patch -Patch0121: 0121-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch -Patch0122: 0122-efi-net-Allow-to-specify-a-port-number-in-addresses.patch -Patch0123: 0123-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch -Patch0124: 0124-efi-net-Print-a-debug-message-if-parsing-the-address.patch -Patch0125: 0125-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch -Patch0126: 0126-efi-Set-image-base-address-before-jumping-to-the-PE-.patch -Patch0127: 0127-tpm-Don-t-propagate-TPM-measurement-errors-to-the-ve.patch -Patch0128: 0128-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch -Patch0129: 0129-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch -Patch0130: 0130-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch -Patch0131: 0131-efi-dhcp-fix-some-allocation-error-checking.patch -Patch0132: 0132-efi-http-fix-some-allocation-error-checking.patch -Patch0133: 0133-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch -Patch0134: 0134-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch -Patch0135: 0135-linuxefi-fail-kernel-validation-without-shim-protoco.patch -Patch0136: 0136-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch -Patch0137: 0137-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch -Patch0138: 0138-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch -Patch0139: 0139-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch -Patch0140: 0140-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch -Patch0141: 0141-Add-systemd-integration-scripts-to-make-systemctl-re.patch -Patch0142: 0142-systemd-integration.sh-Also-set-old-menu_show_once-g.patch -Patch0143: 0143-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch -Patch0144: 0144-grub-install-disable-support-for-EFI-platforms.patch -Patch0145: 0145-New-with-debug-timestamps-configure-flag-to-prepend-.patch -Patch0146: 0146-Added-debug-statements-to-grub_disk_open-and-grub_di.patch -Patch0147: 0147-Introduce-function-grub_debug_is_enabled-void-return.patch -Patch0148: 0148-Don-t-clear-screen-when-debugging-is-enabled.patch -Patch0149: 0149-kern-file-Fix-error-handling-in-grub_file_open.patch -Patch0150: 0150-grub_file_-instrumentation-new-file-debug-tag.patch -Patch0151: 0151-ieee1275-Avoiding-many-unecessary-open-close.patch -Patch0152: 0152-ieee1275-powerpc-implements-fibre-channel-discovery-.patch -Patch0153: 0153-ieee1275-powerpc-enables-device-mapper-discovery.patch -Patch0154: 0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch -Patch0155: 0155-Add-suport-for-signing-grub-with-an-appended-signatu.patch -Patch0156: 0156-docs-grub-Document-signing-grub-under-UEFI.patch -Patch0157: 0157-docs-grub-Document-signing-grub-with-an-appended-sig.patch -Patch0158: 0158-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch -Patch0159: 0159-pgp-factor-out-rsa_pad.patch -Patch0160: 0160-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch -Patch0161: 0161-posix_wrap-tweaks-in-preparation-for-libtasn1.patch -Patch0162: 0162-libtasn1-import-libtasn1-4.16.0.patch -Patch0163: 0163-libtasn1-disable-code-not-needed-in-grub.patch -Patch0164: 0164-libtasn1-changes-for-grub-compatibility.patch -Patch0165: 0165-libtasn1-compile-into-asn1-module.patch -Patch0166: 0166-test_asn1-test-module-for-libtasn1.patch -Patch0167: 0167-grub-install-support-embedding-x509-certificates.patch -Patch0168: 0168-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch -Patch0169: 0169-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch -Patch0170: 0170-appended-signatures-support-verifying-appended-signa.patch -Patch0171: 0171-appended-signatures-verification-tests.patch -Patch0172: 0172-appended-signatures-documentation.patch -Patch0173: 0173-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch -Patch0174: 0174-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch -Patch0175: 0175-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch -Patch0176: 0176-ieee1275-ofdisk-retry-on-open-failure.patch -Patch0177: 0177-Allow-chainloading-EFI-apps-from-loop-mounts.patch -Patch0178: 0178-efinet-Add-DHCP-proxy-support.patch -Patch0179: 0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch -Patch0180: 0180-Don-t-update-the-cmdline-when-generating-legacy-menu.patch -Patch0181: 0181-Suppress-gettext-error-message.patch -Patch0182: 0182-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch -Patch0183: 0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch -Patch0184: 0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch -Patch0185: 0185-arm64-Fix-EFI-loader-kernel-image-allocation.patch -Patch0186: 0186-normal-main-Discover-the-device-to-read-the-config-f.patch -Patch0187: 0187-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch -Patch0188: 0188-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch -Patch0189: 0189-Print-module-name-on-license-check-failure.patch -Patch0190: 0190-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch -Patch0191: 0191-grub-mkconfig-restore-umask-for-grub.cfg.patch -Patch0192: 0192-fs-btrfs-Use-full-btrfs-bootloader-area.patch -Patch0193: 0193-Add-Fedora-location-of-DejaVu-SANS-font.patch -Patch0194: 0194-normal-menu-Don-t-show-Booting-s-msg-when-auto-booti.patch -Patch0195: 0195-EFI-suppress-the-Welcome-to-GRUB-message-in-EFI-buil.patch -Patch0196: 0196-EFI-console-Do-not-set-colorstate-until-the-first-te.patch -Patch0197: 0197-EFI-console-Do-not-set-cursor-until-the-first-text-o.patch -Patch0198: 0198-Use-visual-indentation-in-config.h.in.patch -Patch0199: 0199-Where-present-ensure-config-util.h-precedes-config.h.patch -Patch0200: 0200-Drop-gnulib-fix-base64.patch.patch -Patch0201: 0201-Drop-gnulib-no-abort.patch.patch -Patch0202: 0202-Update-gnulib-version-and-drop-most-gnulib-patches.patch -Patch0203: 0203-commands-search-Fix-bug-stopping-iteration-when-no-f.patch -Patch0204: 0204-search-new-efidisk-only-option-on-EFI-systems.patch -Patch0205: 0205-efi-new-connectefi-command.patch -Patch0206: 0206-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch -Patch0207: 0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch -Patch0208: 0208-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch -Patch0209: 0209-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch -Patch0210: 0210-powerpc-prefix-detection-support-device-names-with-c.patch -Patch0211: 0211-make-ofdisk_retries-optional.patch -Patch0212: 0212-loader-efi-chainloader-grub_load_and_start_image-doe.patch -Patch0213: 0213-loader-efi-chainloader-simplify-the-loader-state.patch -Patch0214: 0214-commands-boot-Add-API-to-pass-context-to-loader.patch -Patch0215: 0215-loader-efi-chainloader-Use-grub_loader_set_ex.patch -Patch0216: 0216-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch -Patch0217: 0217-loader-i386-efi-linux-Use-grub_loader_set_ex.patch -Patch0218: 0218-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch -Patch0219: 0219-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch -Patch0220: 0220-kern-file-Do-not-leak-device_name-on-error-in-grub_f.patch -Patch0221: 0221-video-readers-png-Abort-sooner-if-a-read-operation-f.patch -Patch0222: 0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch -Patch0223: 0223-video-readers-png-Drop-greyscale-support-to-fix-heap.patch -Patch0224: 0224-video-readers-png-Avoid-heap-OOB-R-W-inserting-huff-.patch -Patch0225: 0225-video-readers-png-Sanity-check-some-huffman-codes.patch -Patch0226: 0226-video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch -Patch0227: 0227-video-readers-jpeg-Do-not-reallocate-a-given-huff-ta.patch -Patch0228: 0228-video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch -Patch0229: 0229-video-readers-jpeg-Block-int-underflow-wild-pointer-.patch -Patch0230: 0230-normal-charset-Fix-array-out-of-bounds-formatting-un.patch -Patch0231: 0231-net-netbuff-Block-overly-large-netbuff-allocs.patch -Patch0232: 0232-net-ip-Do-IP-fragment-maths-safely.patch -Patch0233: 0233-net-dns-Fix-double-free-addresses-on-corrupt-DNS-res.patch -Patch0234: 0234-net-dns-Don-t-read-past-the-end-of-the-string-we-re-.patch -Patch0235: 0235-net-tftp-Prevent-a-UAF-and-double-free-from-a-failed.patch -Patch0236: 0236-net-tftp-Avoid-a-trivial-UAF.patch -Patch0237: 0237-net-http-Do-not-tear-down-socket-if-it-s-already-bee.patch -Patch0238: 0238-net-http-Fix-OOB-write-for-split-http-headers.patch -Patch0239: 0239-net-http-Error-out-on-headers-with-LF-without-CR.patch -Patch0240: 0240-fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch -Patch0241: 0241-fs-f2fs-Do-not-read-past-the-end-of-nat-bitmap.patch -Patch0242: 0242-fs-f2fs-Do-not-copy-file-names-that-are-too-long.patch -Patch0243: 0243-fs-btrfs-Fix-several-fuzz-issues-with-invalid-dir-it.patch -Patch0244: 0244-fs-btrfs-Fix-more-ASAN-and-SEGV-issues-found-with-fu.patch -Patch0245: 0245-fs-btrfs-Fix-more-fuzz-issues-related-to-chunks.patch -Patch0246: 0246-misc-Make-grub_min-and-grub_max-more-resilient.patch -Patch0247: 0247-ReiserFS-switch-to-using-grub_min-grub_max.patch -Patch0248: 0248-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch -Patch0249: 0249-modules-make-.module_license-read-only.patch -Patch0250: 0250-modules-strip-.llvm_addrsig-sections-and-similar.patch -Patch0251: 0251-modules-Don-t-allocate-space-for-non-allocable-secti.patch -Patch0252: 0252-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch -Patch0253: 0253-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch -Patch0254: 0254-modules-load-module-sections-at-page-aligned-address.patch -Patch0255: 0255-nx-add-memory-attribute-get-set-API.patch -Patch0256: 0256-nx-set-page-permissions-for-loaded-modules.patch -Patch0257: 0257-nx-set-attrs-in-our-kernel-loaders.patch -Patch0258: 0258-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch -Patch0259: 0259-grub-probe-document-the-behavior-of-multiple-v.patch -Patch0260: 0260-grub_fs_probe-dprint-errors-from-filesystems.patch -Patch0261: 0261-fs-fat-don-t-error-when-mtime-is-0.patch -Patch0262: 0262-Make-debug-file-show-which-file-filters-get-run.patch -Patch0263: 0263-efi-use-enumerated-array-positions-for-our-allocatio.patch -Patch0264: 0264-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch -Patch0265: 0265-efi-allocate-the-initrd-within-the-bounds-expressed-.patch -Patch0266: 0266-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch -Patch0267: 0267-BLS-create-etc-kernel-cmdline-during-mkconfig.patch -Patch0268: 0268-squish-don-t-dup-rhgb-quiet-check-mtimes.patch -Patch0269: 0269-squish-give-up-on-rhgb-quiet.patch -Patch0270: 0270-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch -Patch0271: 0271-blscfg-Don-t-root-device-in-emu-builds.patch -Patch0272: 0272-loader-arm64-linux-Remove-magic-number-header-field-.patch -Patch0273: 0273-Correct-BSS-zeroing-on-aarch64.patch -Patch0274: 0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch -Patch0275: 0275-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch -Patch0276: 0276-commands-efi-tpm-Refine-the-status-of-log-event.patch -Patch0277: 0277-commands-efi-tpm-Use-grub_strcpy-instead-of-grub_mem.patch -Patch0278: 0278-efi-tpm-Add-EFI_CC_MEASUREMENT_PROTOCOL-support.patch -Patch0279: 0279-font-Reject-glyphs-exceeds-font-max_glyph_width-or-f.patch -Patch0280: 0280-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch -Patch0281: 0281-font-Fix-several-integer-overflows-in-grub_font_cons.patch -Patch0282: 0282-font-Remove-grub_font_dup_glyph.patch -Patch0283: 0283-font-Fix-integer-overflow-in-ensure_comb_space.patch -Patch0284: 0284-font-Fix-integer-overflow-in-BMP-index.patch -Patch0285: 0285-font-Fix-integer-underflow-in-binary-search-of-char-.patch -Patch0286: 0286-kern-efi-sb-Enforce-verification-of-font-files.patch -Patch0287: 0287-fbutil-Fix-integer-overflow.patch -Patch0288: 0288-font-Fix-an-integer-underflow-in-blit_comb.patch -Patch0289: 0289-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch -Patch0290: 0290-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch -Patch0291: 0291-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch -Patch0292: 0292-font-Try-opening-fonts-from-the-bundled-memdisk.patch -Patch0293: 0293-mm-Clarify-grub_real_malloc.patch -Patch0294: 0294-mm-grub_real_malloc-Make-small-allocs-comment-match-.patch -Patch0295: 0295-mm-Document-grub_free.patch -Patch0296: 0296-mm-Document-grub_mm_init_region.patch -Patch0297: 0297-mm-Document-GRUB-internal-memory-management-structur.patch -Patch0298: 0298-mm-Assert-that-we-preserve-header-vs-region-alignmen.patch -Patch0299: 0299-mm-When-adding-a-region-merge-with-region-after-as-w.patch -Patch0300: 0300-mm-Debug-support-for-region-operations.patch -Patch0301: 0301-mm-Drop-unused-unloading-of-modules-on-OOM.patch -Patch0302: 0302-mm-Allow-dynamically-requesting-additional-memory-re.patch -Patch0303: 0303-kern-efi-mm-Always-request-a-fixed-number-of-pages-o.patch -Patch0304: 0304-kern-efi-mm-Extract-function-to-add-memory-regions.patch -Patch0305: 0305-kern-efi-mm-Pass-up-errors-from-add_memory_regions.patch -Patch0306: 0306-kern-efi-mm-Implement-runtime-addition-of-pages.patch -Patch0307: 0307-efi-Increase-default-memory-allocation-to-32-MiB.patch -Patch0308: 0308-mm-Try-invalidate-disk-caches-last-when-out-of-memor.patch -Patch0309: 0309-ppc64le-signed-boot-media-changes.patch -Patch0310: 0310-core-Fix-several-implicit-function-declarations.patch -Patch0311: 0311-loader-Add-support-for-grub-emu-to-kexec-Linux-menu-.patch -Patch0312: 0312-powerpc-Drop-Open-Hack-Ware-remove-GRUB_IEEE1275_FLA.patch -Patch0313: 0313-ieee1275-request-memory-with-ibm-client-architecture.patch -Patch0314: 0314-ieee1275-drop-len-1-quirk-in-heap_init.patch -Patch0315: 0315-ieee1275-support-runtime-memory-claiming.patch -Patch0316: 0316-ieee1275-implement-vec5-for-cas-negotiation.patch -Patch0317: 0317-ibmvtpm-Add-support-for-trusted-boot-using-a-vTPM-2..patch -Patch0318: 0318-powerpc-Drop-Open-Hack-Ware.patch -Patch0319: 0319-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch -Patch0320: 0320-mm-Adjust-new-region-size-to-take-management-overhea.patch -Patch0321: 0321-mm-Preallocate-some-space-when-adding-new-regions.patch -Patch0322: 0322-mm-Avoid-complex-heap-growth-math-in-hot-path.patch -Patch0323: 0323-hostdisk-work-around-proc-not-reporting-size.patch -Patch0324: 0324-blscfg-check-for-mounted-boot-in-emu.patch -Patch0325: 0325-emu-linux-work-around-systemctl-kexec-returning.patch -Patch0326: 0326-kern-ieee1275-init-Convert-plain-numbers-to-constant.patch -Patch0327: 0327-kern-ieee1275-init-Extended-support-in-Vec5.patch -Patch0328: 0328-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch -Patch0329: 0329-grub_dl_set_mem_attrs-fix-format-string.patch -Patch0330: 0330-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch -Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch -Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch -Patch0333: 0333-util-Enable-default-kernel-for-updates.patch -Patch0334: 0334-efi-http-change-uint32_t-to-uintn_t.patch -Patch0335: 0335-Add-Install-section-to-aux-systemd-units.patch -Patch0336: 0336-arm64-Use-proper-memory-type-for-kernel-allocation.patch -Patch0337: 0337-Fix-missing-include-in-ofdisk.c.patch -Patch0338: 0338-kern-ieee1275-init-ppc64-Restrict-high-memory-in-pre.patch -Patch0339: 0339-grub-install-on-EFI-if-forced.patch -Patch0340: 0340-Remove-Install-section-from-aux-systemd-units.patch -Patch0341: 0341-fs-Remove-trailing-whitespaces.patch -Patch0342: 0342-fs-xfs-Fix-memory-leaks-in-XFS-module.patch -Patch0343: 0343-fs-xfs-Fix-issues-found-while-fuzzing-the-XFS-filesy.patch -Patch0344: 0344-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch -Patch0345: 0345-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch -Patch0346: 0346-chainloader-remove-device-path-debug-message.patch -Patch0347: 0347-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch -Patch0348: 0348-add-flag-to-only-search-root-dev.patch -Patch0349: 0349-Ignore-warnings-for-incompatible-types.patch -Patch0350: 0350-fs-xfs-Fix-XFS-directory-extent-parsing.patch -Patch0351: 0351-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch -Patch0352: 0352-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch -Patch0353: 0353-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch -Patch0354: 0354-fs-ntfs-Fix-an-OOB-write-when-parsing-the-ATTRIBUTE_.patch -Patch0355: 0355-fs-ntfs-Fix-an-OOB-read-when-reading-data-from-the-r.patch -Patch0356: 0356-fs-ntfs-Fix-an-OOB-read-when-parsing-directory-entri.patch -Patch0357: 0357-fs-ntfs-Fix-an-OOB-read-when-parsing-bitmaps-for-ind.patch -Patch0358: 0358-fs-ntfs-Fix-an-OOB-read-when-parsing-a-volume-label.patch -Patch0359: 0359-fs-ntfs-Make-code-more-readable.patch -Patch0360: 0360-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch -Patch0361: 0361-cmd-search-Rework-of-CVE-2023-4001-fix.patch -Patch0362: 0362-grub-mkconfig.in-turn-off-executable-owner-bit.patch -Patch0363: 0363-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch -Patch0364: 0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch +Patch0004: 0004-Rework-linux-command.patch +Patch0005: 0005-Rework-linux16-command.patch +Patch0006: 0006-re-write-.gitignore.patch +Patch0007: 0007-IBM-client-architecture-CAS-reboot-support.patch +Patch0008: 0008-for-ppc-reset-console-display-attr-when-clear-screen.patch +Patch0009: 0009-Disable-GRUB-video-support-for-IBM-power-machines.patch +Patch0010: 0010-Move-bash-completion-script-922997.patch +Patch0011: 0011-Allow-fallback-to-include-entries-by-title-not-just-.patch +Patch0012: 0012-Make-exit-take-a-return-code.patch +Patch0013: 0013-Make-efi-machines-load-an-env-block-from-a-variable.patch +Patch0014: 0014-Migrate-PPC-from-Yaboot-to-Grub2.patch +Patch0015: 0015-Add-fw_path-variable-revised.patch +Patch0016: 0016-Pass-x-hex-hex-straight-through-unmolested.patch +Patch0017: 0017-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch +Patch0018: 0018-Add-devicetree-loading.patch +Patch0019: 0019-Enable-pager-by-default.-985860.patch +Patch0020: 0020-Don-t-say-GNU-Linux-in-generated-menus.patch +Patch0021: 0021-Add-.eh_frame-to-list-of-relocations-stripped.patch +Patch0022: 0022-Don-t-require-a-password-to-boot-entries-generated-b.patch +Patch0023: 0023-use-fw_path-prefix-when-fallback-searching-for-grub-.patch +Patch0024: 0024-Try-mac-guid-etc-before-grub.cfg-on-tftp-config-file.patch +Patch0025: 0025-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch +Patch0026: 0026-Try-prefix-if-fw_path-doesn-t-work.patch +Patch0027: 0027-Make-grub2-mkconfig-construct-titles-that-look-like-.patch +Patch0028: 0028-Add-friendly-grub2-password-config-tool-985962.patch +Patch0029: 0029-tcp-add-window-scaling-support.patch +Patch0030: 0030-efinet-and-bootp-add-support-for-dhcpv6.patch +Patch0031: 0031-bootp-New-net_bootp6-command.patch +Patch0032: 0032-Add-grub-get-kernel-settings-and-use-it-in-10_linux.patch +Patch0033: 0033-Make-grub_fatal-also-backtrace.patch +Patch0034: 0034-Make-our-info-pages-say-grub2-where-appropriate.patch +Patch0035: 0035-macos-just-build-chainloader-entries-don-t-try-any-x.patch +Patch0036: 0036-grub2-btrfs-Add-ability-to-boot-from-subvolumes.patch +Patch0037: 0037-btrfs-fix-a-bad-null-check.patch +Patch0038: 0038-export-btrfs_subvol-and-btrfs_subvolid.patch +Patch0039: 0039-grub2-btrfs-03-follow_default.patch +Patch0040: 0040-grub2-btrfs-04-grub2-install.patch +Patch0041: 0041-grub2-btrfs-05-grub2-mkconfig.patch +Patch0042: 0042-grub2-btrfs-06-subvol-mount.patch +Patch0043: 0043-Fallback-to-old-subvol-name-scheme-to-support-old-sn.patch +Patch0044: 0044-Grub-not-working-correctly-with-btrfs-snapshots-bsc-.patch +Patch0045: 0045-Add-grub_efi_allocate_pool-and-grub_efi_free_pool-wr.patch +Patch0046: 0046-Use-grub_efi_.-memory-helpers-where-reasonable.patch +Patch0047: 0047-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch +Patch0048: 0048-don-t-use-int-for-efi-status.patch +Patch0049: 0049-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch +Patch0050: 0050-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch +Patch0051: 0051-20_linux_xen-load-xen-or-multiboot-2-modules-as-need.patch +Patch0052: 0052-align-struct-efi_variable-better.patch +Patch0053: 0053-Add-BLS-support-to-grub-mkconfig.patch +Patch0054: 0054-Don-t-attempt-to-backtrace-on-grub_abort-for-grub-em.patch +Patch0055: 0055-Add-grub2-switch-to-blscfg.patch +Patch0056: 0056-normal-don-t-draw-our-startup-message-if-debug-is-se.patch +Patch0057: 0057-Work-around-some-minor-include-path-weirdnesses.patch +Patch0058: 0058-Make-it-possible-to-enabled-build-id-sha1.patch +Patch0059: 0059-make-better-backtraces.patch +Patch0060: 0060-Fixup-for-newer-compiler.patch +Patch0061: 0061-Don-t-attempt-to-export-the-start-and-_start-symbols.patch +Patch0062: 0062-Fixup-for-newer-compiler.patch +Patch0063: 0063-Add-support-for-non-Ethernet-network-cards.patch +Patch0064: 0064-efinet-UEFI-IPv6-PXE-support.patch +Patch0065: 0065-grub.texi-Add-net_bootp6-doument.patch +Patch0066: 0066-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +Patch0067: 0067-Fix-const-char-pointers-in-grub-core-net-bootp.c.patch +Patch0068: 0068-efinet-Setting-network-from-UEFI-device-path.patch +Patch0069: 0069-efinet-Setting-DNS-server-from-UEFI-protocol.patch +Patch0070: 0070-Support-UEFI-networking-protocols.patch +Patch0071: 0071-AUDIT-0-http-boot-tracker-bug.patch +Patch0072: 0072-grub-editenv-Add-incr-command-to-increment-integer-v.patch +Patch0073: 0073-Add-auto-hide-menu-support.patch +Patch0074: 0074-Add-grub-set-bootflag-utility.patch +Patch0075: 0075-docs-Add-grub-boot-indeterminate.service-example.patch +Patch0076: 0076-gentpl-add-disable-support.patch +Patch0077: 0077-gentpl-add-pc-firmware-type.patch +Patch0078: 0078-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0079: 0079-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0080: 0080-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0081: 0081-Rework-how-the-fdt-command-builds.patch +Patch0082: 0082-Disable-non-wordsize-allocations-on-arm.patch +Patch0083: 0083-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0084: 0084-Make-grub_error-more-verbose.patch +Patch0085: 0085-Make-reset-an-alias-for-the-reboot-command.patch +Patch0086: 0086-Add-a-version-command.patch +Patch0087: 0087-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0088: 0088-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0089: 0089-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0090: 0090-Fix-getroot.c-s-trampolines.patch +Patch0091: 0091-Do-not-allow-stack-trampolines-anywhere.patch +Patch0092: 0092-Reimplement-boot_counter.patch +Patch0093: 0093-Fix-menu-entry-selection-based-on-ID-and-title.patch +Patch0094: 0094-Make-the-menu-entry-users-option-argument-to-be-opti.patch +Patch0095: 0095-Add-efi-export-env-and-efi-load-env-commands.patch +Patch0096: 0096-Export-all-variables-from-the-initial-context-when-c.patch +Patch0097: 0097-grub.d-Split-out-boot-success-reset-from-menu-auto-h.patch +Patch0098: 0098-Don-t-assume-that-boot-commands-will-only-return-on-.patch +Patch0099: 0099-grub-set-bootflag-Update-comment-about-running-as-ro.patch +Patch0100: 0100-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch +Patch0101: 0101-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0102: 0102-Add-start-symbol-for-RISC-V.patch +Patch0103: 0103-bootstrap.conf-Force-autogen.sh-to-use-python3.patch +Patch0104: 0104-efi-http-Export-fw-http-_path-variables-to-make-them.patch +Patch0105: 0105-efi-http-Enclose-literal-IPv6-addresses-in-square-br.patch +Patch0106: 0106-efi-net-Allow-to-specify-a-port-number-in-addresses.patch +Patch0107: 0107-efi-ip4_config-Improve-check-to-detect-literal-IPv6-.patch +Patch0108: 0108-efi-net-Print-a-debug-message-if-parsing-the-address.patch +Patch0109: 0109-kern-term-Also-accept-F8-as-a-user-interrupt-key.patch +Patch0110: 0110-http-Prepend-prefix-when-the-HTTP-path-is-relative-a.patch +Patch0111: 0111-Fix-a-missing-return-in-efi-export-env-and-efi-load-.patch +Patch0112: 0112-efi-dhcp-fix-some-allocation-error-checking.patch +Patch0113: 0113-efi-http-fix-some-allocation-error-checking.patch +Patch0114: 0114-efi-ip-46-_config.c-fix-some-potential-allocation-ov.patch +Patch0115: 0115-Fix-const-char-pointers-in-grub-core-net-efi-ip4_con.patch +Patch0116: 0116-Fix-const-char-pointers-in-grub-core-net-efi-ip6_con.patch +Patch0117: 0117-Fix-const-char-pointers-in-grub-core-net-efi-net.c.patch +Patch0118: 0118-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch +Patch0119: 0119-Add-systemd-integration-scripts-to-make-systemctl-re.patch +Patch0120: 0120-systemd-integration.sh-Also-set-old-menu_show_once-g.patch +Patch0121: 0121-at_keyboard-use-set-1-when-keyboard-is-in-Translate-.patch +Patch0122: 0122-grub-install-disable-support-for-EFI-platforms.patch +Patch0123: 0123-New-with-debug-timestamps-configure-flag-to-prepend-.patch +Patch0124: 0124-Added-debug-statements-to-grub_disk_open-and-grub_di.patch +Patch0125: 0125-Introduce-function-grub_debug_is_enabled-void-return.patch +Patch0126: 0126-Don-t-clear-screen-when-debugging-is-enabled.patch +Patch0127: 0127-grub_file_-instrumentation-new-file-debug-tag.patch +Patch0128: 0128-ieee1275-Avoiding-many-unecessary-open-close.patch +Patch0129: 0129-ieee1275-powerpc-implements-fibre-channel-discovery-.patch +Patch0130: 0130-ieee1275-powerpc-enables-device-mapper-discovery.patch +Patch0131: 0131-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch +Patch0132: 0132-Add-suport-for-signing-grub-with-an-appended-signatu.patch +Patch0133: 0133-docs-grub-Document-signing-grub-under-UEFI.patch +Patch0134: 0134-docs-grub-Document-signing-grub-with-an-appended-sig.patch +Patch0135: 0135-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch +Patch0136: 0136-pgp-factor-out-rsa_pad.patch +Patch0137: 0137-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch +Patch0138: 0138-posix_wrap-tweaks-in-preparation-for-libtasn1.patch +Patch0139: 0139-libtasn1-import-libtasn1-4.16.0.patch +Patch0140: 0140-libtasn1-disable-code-not-needed-in-grub.patch +Patch0141: 0141-libtasn1-changes-for-grub-compatibility.patch +Patch0142: 0142-libtasn1-compile-into-asn1-module.patch +Patch0143: 0143-test_asn1-test-module-for-libtasn1.patch +Patch0144: 0144-grub-install-support-embedding-x509-certificates.patch +Patch0145: 0145-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch +Patch0146: 0146-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch +Patch0147: 0147-appended-signatures-support-verifying-appended-signa.patch +Patch0148: 0148-appended-signatures-verification-tests.patch +Patch0149: 0149-appended-signatures-documentation.patch +Patch0150: 0150-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch +Patch0151: 0151-ieee1275-drop-HEAP_MAX_ADDR-HEAP_MIN_SIZE.patch +Patch0152: 0152-appendedsig-x509-Also-handle-the-Extended-Key-Usage-.patch +Patch0153: 0153-ieee1275-ofdisk-retry-on-open-failure.patch +Patch0154: 0154-efinet-Add-DHCP-proxy-support.patch +Patch0155: 0155-Don-t-update-the-cmdline-when-generating-legacy-menu.patch +Patch0156: 0156-Suppress-gettext-error-message.patch +Patch0157: 0157-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch +Patch0158: 0158-normal-main-Discover-the-device-to-read-the-config-f.patch +Patch0159: 0159-powerpc-adjust-setting-of-prefix-for-signed-binary-c.patch +Patch0160: 0160-powerpc-ieee1275-load-grub-at-4MB-not-2MB.patch +Patch0161: 0161-Add-Fedora-location-of-DejaVu-SANS-font.patch +Patch0162: 0162-efi-new-connectefi-command.patch +Patch0163: 0163-powerpc-prefix-detection-support-device-names-with-c.patch +Patch0164: 0164-make-ofdisk_retries-optional.patch +Patch0165: 0165-misc-Make-grub_min-and-grub_max-more-resilient.patch +Patch0166: 0166-ReiserFS-switch-to-using-grub_min-grub_max.patch +Patch0167: 0167-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch +Patch0168: 0168-modules-make-.module_license-read-only.patch +Patch0169: 0169-modules-strip-.llvm_addrsig-sections-and-similar.patch +Patch0170: 0170-modules-Don-t-allocate-space-for-non-allocable-secti.patch +Patch0171: 0171-modules-load-module-sections-at-page-aligned-address.patch +Patch0172: 0172-nx-add-memory-attribute-get-set-API.patch +Patch0173: 0173-nx-set-page-permissions-for-loaded-modules.patch +Patch0174: 0174-nx-set-the-nx-compatible-flag-in-EFI-grub-images.patch +Patch0175: 0175-grub_fs_probe-dprint-errors-from-filesystems.patch +Patch0176: 0176-Make-debug-file-show-which-file-filters-get-run.patch +Patch0177: 0177-BLS-create-etc-kernel-cmdline-during-mkconfig.patch +Patch0178: 0178-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +Patch0179: 0179-squish-give-up-on-rhgb-quiet.patch +Patch0180: 0180-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch +Patch0181: 0181-blscfg-Don-t-root-device-in-emu-builds.patch +Patch0182: 0182-ppc64le-signed-boot-media-changes.patch +Patch0183: 0183-core-Fix-several-implicit-function-declarations.patch +Patch0184: 0184-ieee1275-request-memory-with-ibm-client-architecture.patch +Patch0185: 0185-hostdisk-work-around-proc-not-reporting-size.patch +Patch0186: 0186-blscfg-check-for-mounted-boot-in-emu.patch +Patch0187: 0187-grub_dl_set_mem_attrs-fix-format-string.patch +Patch0188: 0188-grub_dl_set_mem_attrs-add-self-check-for-the-tramp-G.patch +Patch0189: 0189-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch +Patch0190: 0190-emu-Add-switch-root-to-grub-emu.patch +Patch0191: 0191-util-Enable-default-kernel-for-updates.patch +Patch0192: 0192-efi-http-change-uint32_t-to-uintn_t.patch +Patch0193: 0193-Add-Install-section-to-aux-systemd-units.patch +Patch0194: 0194-Fix-missing-include-in-ofdisk.c.patch +Patch0195: 0195-add-flag-to-only-search-root-dev.patch +Patch0196: 0196-cryptdisk-fix-incorrect-sign-comparison.patch +Patch0197: 0197-grub-install-fix-a-sign-comparison-error.patch +Patch0198: 0198-grub-mount-work-around-bad-integer-comparison.patch +Patch0199: 0199-power-Fix-use-after-free-in-get_slave_from_dm.patch +Patch0200: 0200-Fix-some-sign-comparison-errors.patch +Patch0201: 0201-normal-Fix-a-discarded-const.patch +Patch0202: 0202-at_keyboard-mark-grub_keyboard_controller_write-unus.patch +Patch0203: 0203-Fix-another-minor-sign-comparison-error.patch +Patch0204: 0204-Track-explicit-module-dependencies-in-Makefile.core..patch +Patch0205: 0205-Revert-mm-Assert-that-we-preserve-header-vs-region-a.patch +Patch0206: 0206-make-use-the-_CPU-variety-of-build-flags-for-PROGRAM.patch +Patch0207: 0207-Work-around-extra_deps.lst-issue.patch +Patch0208: 0208-include-proper-attribute-for-an-EFI-API-call-definit.patch +Patch0209: 0209-cast-grub_error-status-parameter.patch +Patch0210: 0210-remove-unused-varible.patch +Patch0211: 0211-cast-grub_net_bootp_packet-pointer.patch +Patch0212: 0212-libtasn1-fix-string-overflow-warning.patch +Patch0213: 0213-Add-support-for-Linux-EFI-stub-loading.patch +Patch0214: 0214-fix-i386_pc-on-legacycfg-module.patch +Patch0215: 0215-Add-secureboot-support-on-efi-chainloader.patch +Patch0216: 0216-Make-any-of-the-loaders-that-link-in-efi-mode-honor-.patch +Patch0217: 0217-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch +Patch0218: 0218-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch +Patch0219: 0219-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch +Patch0220: 0220-Handle-multi-arch-64-on-32-boot-in-linuxefi-loader.patch +Patch0221: 0221-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0222: 0222-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0223: 0223-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0224: 0224-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0225: 0225-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0226: 0226-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0227: 0227-x86-efi-Reduce-maximum-bounce-buffer-size-to-16-MiB.patch +Patch0228: 0228-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch +Patch0229: 0229-linuxefi-fail-kernel-validation-without-shim-protoco.patch +Patch0230: 0230-Allow-chainloading-EFI-apps-from-loop-mounts.patch +Patch0231: 0231-grub-core-loader-i386-efi-linux.c-do-not-validate-ke.patch +Patch0232: 0232-grub-core-loader-efi-chainloader.c-do-not-validate-c.patch +Patch0233: 0233-grub-core-loader-efi-linux.c-drop-now-unused-grub_li.patch +Patch0234: 0234-loader-efi-chainloader-grub_load_and_start_image-doe.patch +Patch0235: 0235-loader-efi-chainloader-simplify-the-loader-state.patch +Patch0236: 0236-loader-efi-chainloader-Use-grub_loader_set_ex.patch +Patch0237: 0237-loader-i386-efi-linux-Avoid-a-use-after-free-in-the-.patch +Patch0238: 0238-loader-i386-efi-linux-Use-grub_loader_set_ex.patch +Patch0239: 0239-loader-i386-efi-linux-Fix-a-memory-leak-in-the-initr.patch +Patch0240: 0240-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_CODE-ins.patch +Patch0241: 0241-efi-use-enumerated-array-positions-for-our-allocatio.patch +Patch0242: 0242-efi-split-allocation-policy-for-kernel-vs-initrd-mem.patch +Patch0243: 0243-efi-allocate-the-initrd-within-the-bounds-expressed-.patch +Patch0244: 0244-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch +Patch0245: 0245-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch +Patch0246: 0246-grub-install-on-EFI-if-forced.patch +Patch0247: 0247-Remove-Install-section-from-aux-systemd-units.patch +Patch0248: 0248-chainloader-remove-device-path-debug-message.patch +Patch0249: 0249-grub-set-bootflag-Conservative-partial-fix-for-CVE-2.patch +Patch0250: 0250-grub-set-bootflag-More-complete-fix-for-CVE-2024-104.patch +Patch0251: 0251-grub-set-bootflag-Exit-calmly-when-not-running-as-ro.patch +Patch0252: 0252-Makefile.core.def-fix-linux-module.patch +Patch0253: 0253-Add-support-for-Linux-EFI-stub-loading-on-arm-archit.patch +Patch0254: 0254-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0255: 0255-arm64-Fix-EFI-loader-kernel-image-allocation.patch +Patch0256: 0256-pe-add-the-DOS-header-struct-and-fix-some-bad-naming.patch +Patch0257: 0257-Correct-BSS-zeroing-on-aarch64.patch +Patch0258: 0258-arm64-Use-proper-memory-type-for-kernel-allocation.patch +Patch0259: 0259-normal-Remove-grub_env_set-prefix-in-grub_try_normal.patch +Patch0260: 0260-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch +Patch0261: 0261-Ignore-warnings-for-incompatible-types.patch +Patch0262: 0262-cmd-search-Rework-of-CVE-2023-4001-fix.patch +Patch0263: 0263-loader-efi-linux.c-read-the-kernel-image-before-head.patch +Patch0264: 0264-nx-set-attrs-in-our-kernel-loaders.patch +Patch0265: 0265-efi-Provide-wrappers-for-load_image-start_image.patch +Patch0266: 0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch +Patch0267: 0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch +Patch0268: 0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch +Patch0269: 0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch +Patch0270: 0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch +Patch0271: 0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch diff --git a/grub2.spec b/grub2.spec index 202137b0..67118412 100644 --- a/grub2.spec +++ b/grub2.spec @@ -6,7 +6,7 @@ %undefine _hardened_build %undefine _package_note_file -%global tarversion 2.06 +%global tarversion 2.12 %undefine _missing_build_ids_terminate_build %global _configure_gnuconfig_hack 0 @@ -16,8 +16,8 @@ Name: grub2 Epoch: 1 -Version: 2.06 -Release: 127%{?dist} +Version: 2.12 +Release: 1%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Aug 5 2024 Leo Sandoval - 2.12-1 +- Rebased to release grub2-2.12 + * Fri Aug 2 2024 Leo Sandoval - 2.06-127 - Set /boot/grub2/grub.cfg to 0600 mode if present diff --git a/sources b/sources index 5f2ba311..d510fb5f 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ SHA512 (unifont-13.0.06.pcf.gz) = 25f1ea4e316cd77b65cf4f60aa10ed054db6df2195be7344216673dee6628ab055ebcdeea186996d931fd1e9e4f519f4a2e4b4544b8a9ad2fe410aadc4eecd2d SHA512 (theme.tar.bz2) = 0f6f914d5f801509403094b28b8cfe5169cb56ae9bdd808ae21a6780a8236b434161a068351508dd78729c25ee2fed066c124c1eef9e15102750b409b4576a5c -SHA512 (grub-2.06.tar.xz) = 4f11c648f3078567e53fc0c74d5026fdc6da4be27d188975e79d9a4df817ade0fe5ad2ddd694238a07edc45adfa02943d83c57767dd51548102b375e529e8efe +SHA512 (grub-2.12.tar.xz) = 761c060a4c3da9c0e810b0ea967e3ebc66baa4ddd682a503ae3d30a83707626bccaf49359304a16b3a26fc4435fe6bea1ee90be910c84de3c2b5485a31a15be3 SHA512 (gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz) = 6887dede2d4a403422ea045329ee9bd7ca4c1561bcaf39e805e1d1ce8f4c050a65ce286e7d8362fb8e815b5fab0b405730a3f93194e343e2aedcf9b4411a285e From dd5f2023b048216adca6e2439ed0ef0bae62203e Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 6 Aug 2024 12:29:47 +0200 Subject: [PATCH 236/294] mkconfig: More hardening to prevent overwriting grub cfg stub Simplified os detection and remove mountpoint to accommodate hybrid VMs Signed-off-by: Nicolas Frayer --- ...-mkconfig-Simplify-os_name-detection.patch | 27 +++++++++++++ ...move-check-for-mount-point-for-grub-.patch | 29 ++++++++++++++ ...nsure-grub-cfg-stub-is-not-overwritt.patch | 40 ------------------- grub.patches | 2 + grub2.spec | 5 ++- 5 files changed, 62 insertions(+), 41 deletions(-) create mode 100644 0272-grub2-mkconfig-Simplify-os_name-detection.patch create mode 100644 0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch delete mode 100644 0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch diff --git a/0272-grub2-mkconfig-Simplify-os_name-detection.patch b/0272-grub2-mkconfig-Simplify-os_name-detection.patch new file mode 100644 index 00000000..bd7ba1b4 --- /dev/null +++ b/0272-grub2-mkconfig-Simplify-os_name-detection.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Andrew Lukoshko +Date: Wed, 31 Jul 2024 16:06:10 +0000 +Subject: [PATCH] grub2-mkconfig: Simplify os_name detection + +--- + util/grub-mkconfig.in | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index efa36cc45a69..8b7883072e46 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -109,12 +109,7 @@ do + esac + done + +-os_name=$(grep '^ID=' /etc/os-release | sed 's/ID=//') +-if test "$os_name" = '"rhel"'; then +- os_name=redhat +-elif test "$os_name" = '"centos"'; then +- os_name=centos +-fi ++os_name=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g') + if test "x${grub_cfg}" = "x/boot/efi/EFI/$os_name/grub.cfg" &&\ + mountpoint -q /boot/efi; then + gettext_printf "Running \`grub2-mkconfig -o %s' will overwrite the GRUB wrapper.\n" "$grub_cfg" 1>&2 diff --git a/0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch b/0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch new file mode 100644 index 00000000..fc3ec414 --- /dev/null +++ b/0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Thu, 1 Aug 2024 11:13:20 +0200 +Subject: [PATCH] grub/mkconfig: Remove check for mount point for grub cfg stub + +Remove mountpoint when checking whether or not the grub cfg stub +exists and add -s to the test. This should cover scenarios where +the ESP doesn't have a seperate partition but still uses a grub +cfg stub + +Signed-off-by: Nicolas Frayer +--- + util/grub-mkconfig.in | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index 8b7883072e46..31a72a39e0cf 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -110,8 +110,7 @@ do + done + + os_name=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g') +-if test "x${grub_cfg}" = "x/boot/efi/EFI/$os_name/grub.cfg" &&\ +- mountpoint -q /boot/efi; then ++if test -s "${grub_cfg}" && test "x${grub_cfg}" = "x/boot/efi/EFI/$os_name/grub.cfg"; then + gettext_printf "Running \`grub2-mkconfig -o %s' will overwrite the GRUB wrapper.\n" "$grub_cfg" 1>&2 + gettext_printf "Please run \`grub2-mkconfig -o /boot/grub2/grub.cfg' instead to update grub.cfg.\n" 1>&2 + gettext_printf "GRUB configuration file was not updated.\n" 1>&2 diff --git a/0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch b/0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch deleted file mode 100644 index 2ac42f60..00000000 --- a/0364-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nicolas Frayer -Date: Tue, 16 Jul 2024 11:11:43 +0200 -Subject: [PATCH] grub2-mkconfig: Ensure grub cfg stub is not overwritten - -/boot/efi/EFI/$os_name/grub.cfg contains a grub cfg stub -that should not be overwritten by grub2-mkconfig. -Ensure that we prevent this from happening. - -Signed-off-by: Marta Lewandowska -Signed-off-by: Nicolas Frayer ---- - util/grub-mkconfig.in | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index fb382b648b87..efa36cc45a69 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -109,6 +109,20 @@ do - esac - done - -+os_name=$(grep '^ID=' /etc/os-release | sed 's/ID=//') -+if test "$os_name" = '"rhel"'; then -+ os_name=redhat -+elif test "$os_name" = '"centos"'; then -+ os_name=centos -+fi -+if test "x${grub_cfg}" = "x/boot/efi/EFI/$os_name/grub.cfg" &&\ -+ mountpoint -q /boot/efi; then -+ gettext_printf "Running \`grub2-mkconfig -o %s' will overwrite the GRUB wrapper.\n" "$grub_cfg" 1>&2 -+ gettext_printf "Please run \`grub2-mkconfig -o /boot/grub2/grub.cfg' instead to update grub.cfg.\n" 1>&2 -+ gettext_printf "GRUB configuration file was not updated.\n" 1>&2 -+ exit 1 -+fi -+ - if [ "x$EUID" = "x" ] ; then - EUID=`id -u` - fi diff --git a/grub.patches b/grub.patches index c0d6a4e1..f4de23f4 100644 --- a/grub.patches +++ b/grub.patches @@ -269,3 +269,5 @@ Patch0268: 0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch Patch0269: 0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch Patch0270: 0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch Patch0271: 0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch +Patch0272: 0272-grub2-mkconfig-Simplify-os_name-detection.patch +Patch0273: 0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch diff --git a/grub2.spec b/grub2.spec index 67118412..9cbb5d02 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Aug 6 2024 Nicolas Frayer - 2.12-2 +- mkconfig: More hardening to prevent overwriting grub cfg stub + * Mon Aug 5 2024 Leo Sandoval - 2.12-1 - Rebased to release grub2-2.12 From 5c315b462ca8cb312cb2bd5c513c9341290ab338 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Tue, 6 Aug 2024 14:30:42 -0600 Subject: [PATCH 237/294] Remove 'efi: Use shim's loader protocol for EFI image verification' Although this patch is correct and at some point it will be re-introduced, currently shim does not support the loader protocol so drop it in the meanwhile. Signed-off-by: Leo Sandoval --- ...lback-to-legacy-Linux-loader-when-sh.patch | 0 ...oader-protocol-for-EFI-image-verific.patch | 191 ------------------ ...le-stack-sections-on-EFI-assembly-fi.patch | 0 ...fig.in-turn-off-executable-owner-bit.patch | 0 ...it-Add-IEEE-1275-Radix-support-for-K.patch | 0 ...nsure-grub-cfg-stub-is-not-overwritt.patch | 0 ...-mkconfig-Simplify-os_name-detection.patch | 0 ...move-check-for-mount-point-for-grub-.patch | 0 grub.patches | 15 +- grub2.spec | 5 +- 10 files changed, 11 insertions(+), 200 deletions(-) rename 0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch => 0266-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch (100%) delete mode 100644 0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch rename 0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch => 0267-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch (100%) rename 0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch => 0268-grub-mkconfig.in-turn-off-executable-owner-bit.patch (100%) rename 0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch => 0269-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch (100%) rename 0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch => 0270-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch (100%) rename 0272-grub2-mkconfig-Simplify-os_name-detection.patch => 0271-grub2-mkconfig-Simplify-os_name-detection.patch (100%) rename 0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch => 0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch (100%) diff --git a/0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch b/0266-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch similarity index 100% rename from 0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch rename to 0266-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch diff --git a/0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch b/0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch deleted file mode 100644 index ba160548..00000000 --- a/0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mate Kukri -Date: Wed, 12 Jun 2024 16:57:12 +0100 -Subject: [PATCH] efi: Use shim's loader protocol for EFI image verification - and loading - -Signed-off-by: Mate Kukri ---- - grub-core/kern/efi/sb.c | 39 ++++++++++++++------------------------- - grub-core/loader/efi/linux.c | 16 ---------------- - include/grub/efi/api.h | 5 +++++ - include/grub/efi/efi.h | 19 ++++++++++++------- - include/grub/efi/sb.h | 3 --- - 5 files changed, 31 insertions(+), 51 deletions(-) - -diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c -index 8d3e413608b..d3de3959989 100644 ---- a/grub-core/kern/efi/sb.c -+++ b/grub-core/kern/efi/sb.c -@@ -31,8 +31,9 @@ - #include - - static grub_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID; -+static grub_guid_t shim_loader_guid = GRUB_EFI_SHIM_IMAGE_LOADER_GUID; - --static bool shim_lock_enabled = false; -+static grub_efi_loader_t *shim_loader = NULL; - - /* - * Determine whether we're in secure boot mode. -@@ -95,14 +96,6 @@ grub_efi_get_secureboot (void) - if (!(attr & GRUB_EFI_VARIABLE_RUNTIME_ACCESS) && *moksbstate == 1) - { - secureboot = GRUB_EFI_SECUREBOOT_MODE_DISABLED; -- /* -- * TODO: Replace this all with shim's LoadImage protocol, delegating policy to it. -- * -- * We need to set shim_lock_enabled here because we disabled secure boot -- * validation *inside* shim but not in the firmware, so we set this variable -- * here to trigger that code path, whereas the actual verifier is not enabled. -- */ -- shim_lock_enabled = true; - goto out; - } - -@@ -183,14 +176,16 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)), - static grub_err_t - shim_lock_verifier_write (void *context __attribute__ ((unused)), void *buf, grub_size_t size) - { -- grub_efi_shim_lock_protocol_t *sl = grub_efi_locate_protocol (&shim_lock_guid, 0); -+ grub_efi_handle_t image_handle; - -- if (!sl) -- return grub_error (GRUB_ERR_ACCESS_DENIED, N_("shim_lock protocol not found")); -+ if (!shim_loader) -+ return grub_error (GRUB_ERR_ACCESS_DENIED, N_("shim loader protocol not found")); - -- if (sl->verify (buf, size) != GRUB_EFI_SUCCESS) -+ if (shim_loader->load_image (false, grub_efi_image_handle, NULL, buf, size, &image_handle) != GRUB_EFI_SUCCESS) - return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad shim signature")); - -+ shim_loader->unload_image(image_handle); -+ - return GRUB_ERR_NONE; - } - -@@ -205,11 +200,10 @@ void - grub_shim_lock_verifier_setup (void) - { - struct grub_module_header *header; -- grub_efi_shim_lock_protocol_t *sl = -- grub_efi_locate_protocol (&shim_lock_guid, 0); -+ shim_loader = grub_efi_locate_protocol (&shim_loader_guid, 0); - -- /* shim_lock is missing, check if GRUB image is built with --disable-shim-lock. */ -- if (!sl) -+ /* shim loader protocol is missing, check if GRUB image is built with --disable-shim-lock. */ -+ if (!shim_loader) - { - FOR_MODULES (header) - { -@@ -222,17 +216,12 @@ grub_shim_lock_verifier_setup (void) - if (grub_efi_get_secureboot () != GRUB_EFI_SECUREBOOT_MODE_ENABLED) - return; - -+ /* register loader */ -+ grub_efi_register_loader(shim_loader); -+ - /* Enforce shim_lock_verifier. */ - grub_verifier_register (&shim_lock_verifier); - -- shim_lock_enabled = true; -- - grub_env_set ("shim_lock", "y"); - grub_env_export ("shim_lock"); - } -- --bool --grub_is_shim_lock_enabled (void) --{ -- return shim_lock_enabled; --} -diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c -index fe48001442a..da5dcafad8b 100644 ---- a/grub-core/loader/efi/linux.c -+++ b/grub-core/loader/efi/linux.c -@@ -727,22 +727,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - grub_dl_ref (my_mod); - -- if (grub_is_shim_lock_enabled () == true) -- { --#if defined(__i386__) || defined(__x86_64__) -- grub_dprintf ("linux", "shim_lock enabled, falling back to legacy Linux kernel loader\n"); -- -- err = grub_cmd_linux_x86_legacy (cmd, argc, argv); -- -- if (err == GRUB_ERR_NONE) -- return GRUB_ERR_NONE; -- else -- goto fail; --#else -- grub_dprintf ("linux", "shim_lock enabled, trying Linux kernel EFI stub loader\n"); --#endif -- } -- - if (argc == 0) - { - grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 76c88fbdcb0..da51f57fd4a 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h -@@ -364,6 +364,11 @@ - { 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23 } \ - } - -+#define GRUB_EFI_SHIM_IMAGE_LOADER_GUID \ -+ { 0x1f492041, 0xfadb, 0x4e59, \ -+ {0x9e, 0x57, 0x7c, 0xaf, 0xe7, 0x3a, 0x55, 0xab } \ -+ } -+ - #define GRUB_EFI_RNG_PROTOCOL_GUID \ - { 0x3152bca5, 0xeade, 0x433d, \ - { 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \ -diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 7eed1bd791d..77d067977f6 100644 ---- a/include/grub/efi/efi.h -+++ b/include/grub/efi/efi.h -@@ -220,15 +220,20 @@ EXPORT_FUNC (grub_efi_unload_image) (grub_efi_handle_t image_handle); - typedef struct grub_efi_loader - { - grub_efi_status_t (__grub_efi_api *load_image) (grub_efi_boolean_t boot_policy, -- grub_efi_handle_t parent_image_handle, -- grub_efi_device_path_t *file_path, -- void *source_buffer, -- grub_efi_uintn_t source_size, -- grub_efi_handle_t *image_handle); -+ grub_efi_handle_t parent_image_handle, -+ grub_efi_device_path_t *file_path, -+ void *source_buffer, -+ grub_efi_uintn_t source_size, -+ grub_efi_handle_t *image_handle); - - grub_efi_status_t (__grub_efi_api *start_image) (grub_efi_handle_t image_handle, -- grub_efi_uintn_t *exit_data_size, -- grub_efi_char16_t **exit_data); -+ grub_efi_uintn_t *exit_data_size, -+ grub_efi_char16_t **exit_data); -+ -+ grub_efi_status_t (__grub_efi_api *exit) (grub_efi_handle_t image_handle, -+ grub_efi_status_t exit_status, -+ grub_efi_uintn_t exit_data_size, -+ grub_efi_char16_t *exit_data); - - grub_efi_status_t (__grub_efi_api *unload_image) (grub_efi_handle_t image_handle); - } grub_efi_loader_t; -diff --git a/include/grub/efi/sb.h b/include/grub/efi/sb.h -index 49a9ad01cc9..bf8d2db5ff2 100644 ---- a/include/grub/efi/sb.h -+++ b/include/grub/efi/sb.h -@@ -31,9 +31,6 @@ - extern grub_uint8_t - EXPORT_FUNC (grub_efi_get_secureboot) (void); - --extern bool --EXPORT_FUNC (grub_is_shim_lock_enabled) (void); -- - extern void - grub_shim_lock_verifier_setup (void); - #else diff --git a/0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch b/0267-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch similarity index 100% rename from 0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch rename to 0267-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch diff --git a/0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch b/0268-grub-mkconfig.in-turn-off-executable-owner-bit.patch similarity index 100% rename from 0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch rename to 0268-grub-mkconfig.in-turn-off-executable-owner-bit.patch diff --git a/0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch b/0269-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch similarity index 100% rename from 0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch rename to 0269-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch diff --git a/0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch b/0270-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch similarity index 100% rename from 0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch rename to 0270-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch diff --git a/0272-grub2-mkconfig-Simplify-os_name-detection.patch b/0271-grub2-mkconfig-Simplify-os_name-detection.patch similarity index 100% rename from 0272-grub2-mkconfig-Simplify-os_name-detection.patch rename to 0271-grub2-mkconfig-Simplify-os_name-detection.patch diff --git a/0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch b/0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch similarity index 100% rename from 0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch rename to 0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch diff --git a/grub.patches b/grub.patches index f4de23f4..ecde23db 100644 --- a/grub.patches +++ b/grub.patches @@ -263,11 +263,10 @@ Patch0262: 0262-cmd-search-Rework-of-CVE-2023-4001-fix.patch Patch0263: 0263-loader-efi-linux.c-read-the-kernel-image-before-head.patch Patch0264: 0264-nx-set-attrs-in-our-kernel-loaders.patch Patch0265: 0265-efi-Provide-wrappers-for-load_image-start_image.patch -Patch0266: 0266-efi-Use-shim-s-loader-protocol-for-EFI-image-verific.patch -Patch0267: 0267-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch -Patch0268: 0268-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch -Patch0269: 0269-grub-mkconfig.in-turn-off-executable-owner-bit.patch -Patch0270: 0270-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch -Patch0271: 0271-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch -Patch0272: 0272-grub2-mkconfig-Simplify-os_name-detection.patch -Patch0273: 0273-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch +Patch0266: 0266-efi-Disallow-fallback-to-legacy-Linux-loader-when-sh.patch +Patch0267: 0267-Set-non-executable-stack-sections-on-EFI-assembly-fi.patch +Patch0268: 0268-grub-mkconfig.in-turn-off-executable-owner-bit.patch +Patch0269: 0269-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch +Patch0270: 0270-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch +Patch0271: 0271-grub2-mkconfig-Simplify-os_name-detection.patch +Patch0272: 0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch diff --git a/grub2.spec b/grub2.spec index 9cbb5d02..6267997e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Aug 6 2024 Leo Sandoval - 2.12-3 +- Remove 'efi: Use shim's loader protocol for EFI image verification' + * Tue Aug 6 2024 Nicolas Frayer - 2.12-2 - mkconfig: More hardening to prevent overwriting grub cfg stub From 863039eee208bb902d037d93b81c92625a1028a3 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 8 Aug 2024 13:08:37 +0100 Subject: [PATCH 238/294] Build using fuse3 --- grub2.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grub2.spec b/grub2.spec index 6267997e..ae49392d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -49,7 +49,7 @@ BuildRequires: efi-srpm-macros BuildRequires: flex BuildRequires: freetype-devel BuildRequires: freetype-devel -BuildRequires: fuse-devel +BuildRequires: fuse3-devel BuildRequires: gcc BuildRequires: gettext-devel BuildRequires: git @@ -560,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Aug 08 2024 Peter Robinson 2.12-4 +- Build using fuse3 + * Tue Aug 6 2024 Leo Sandoval - 2.12-3 - Remove 'efi: Use shim's loader protocol for EFI image verification' From e3f47a4834fdb21cb91cb1fb30d2e1e9182a7356 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Thu, 29 Aug 2024 10:56:35 -0600 Subject: [PATCH 239/294] Fix netbooting regressions introduced at 2.12-1 Signed-off-by: Leo Sandoval --- ...e-missing-__grub_efi_api-macros-on-E.patch | 495 ++++++++++++++++++ ...rub-core-net-arp.c-fix-variable-name.patch | 23 + grub.patches | 2 + grub2.spec | 6 +- 4 files changed, 525 insertions(+), 1 deletion(-) create mode 100644 0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch create mode 100644 0274-grub-core-net-arp.c-fix-variable-name.patch diff --git a/0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch b/0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch new file mode 100644 index 00000000..61ffbdcd --- /dev/null +++ b/0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch @@ -0,0 +1,495 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 29 Aug 2024 12:11:11 -0600 +Subject: [PATCH] efi/api.h: include missing __grub_efi_api macros on EFI + functions + +Signed-off-by: Peter Jones +Signed-off-by: Leo Sandoval +--- + grub-core/loader/efi/chainloader.c | 2 +- + include/grub/efi/api.h | 34 +++++++++++++------------- + include/grub/efi/dhcp.h | 42 ++++++++++++++++---------------- + include/grub/efi/edid.h | 2 +- + include/grub/efi/http.h | 12 ++++----- + include/grub/efi/pci.h | 50 +++++++++++++++++++------------------- + 6 files changed, 71 insertions(+), 71 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 5cd6f6a59..460a44041 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -555,7 +555,7 @@ handle_image (struct grub_secureboot_chainloader_context *load_context) + grub_uint32_t buffer_size; + int found_entry_point = 0; + int rc; +- grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); ++ grub_efi_status_t (__grub_efi_api *entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); + + b = grub_efi_system_table->boot_services; + +diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h +index 2376182d7..5047ecf28 100644 +--- a/include/grub/efi/api.h ++++ b/include/grub/efi/api.h +@@ -1094,11 +1094,11 @@ typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t; + struct grub_efi_service_binding; + + typedef grub_efi_status_t +-(*grub_efi_service_binding_create_child) (struct grub_efi_service_binding *this, ++(__grub_efi_api *grub_efi_service_binding_create_child) (struct grub_efi_service_binding *this, + grub_efi_handle_t *child_handle); + + typedef grub_efi_status_t +-(*grub_efi_service_binding_destroy_child) (struct grub_efi_service_binding *this, ++(__grub_efi_api *grub_efi_service_binding_destroy_child) (struct grub_efi_service_binding *this, + grub_efi_handle_t *child_handle); + + typedef struct grub_efi_service_binding +@@ -1754,12 +1754,12 @@ typedef struct grub_efi_pxe_mode + typedef struct grub_efi_pxe + { + grub_uint64_t rev; +- grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6); ++ grub_efi_status_t (__grub_efi_api *start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6); + void (*stop) (void); +- grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this, ++ grub_efi_status_t (__grub_efi_api *dhcp) (struct grub_efi_pxe *this, + grub_efi_boolean_t sort_offers); + void (*discover) (void); +- grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this, ++ grub_efi_status_t (__grub_efi_api *mtftp) (struct grub_efi_pxe *this, + grub_efi_pxe_base_code_tftp_opcode_t operation, + void *buffer_ptr, + grub_efi_boolean_t overwrite, +@@ -1775,7 +1775,7 @@ typedef struct grub_efi_pxe + void (*setipfilter) (void); + void (*arp) (void); + void (*setparams) (void); +- grub_efi_status_t (*set_station_ip) (struct grub_efi_pxe *this, ++ grub_efi_status_t (__grub_efi_api *set_station_ip) (struct grub_efi_pxe *this, + grub_efi_pxe_ip_address_t *new_station_ip, + grub_efi_pxe_ip_address_t *new_subnet_mask); + void (*setpackets) (void); +@@ -2054,21 +2054,21 @@ typedef enum grub_efi_ip4_config2_data_type grub_efi_ip4_config2_data_type_t; + + struct grub_efi_ip4_config2_protocol + { +- grub_efi_status_t (*set_data) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_status_t (__grub_efi_api *set_data) (struct grub_efi_ip4_config2_protocol *this, + grub_efi_ip4_config2_data_type_t data_type, + grub_efi_uintn_t data_size, + void *data); + +- grub_efi_status_t (*get_data) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_status_t (__grub_efi_api *get_data) (struct grub_efi_ip4_config2_protocol *this, + grub_efi_ip4_config2_data_type_t data_type, + grub_efi_uintn_t *data_size, + void *data); + +- grub_efi_status_t (*register_data_notify) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_status_t (__grub_efi_api *register_data_notify) (struct grub_efi_ip4_config2_protocol *this, + grub_efi_ip4_config2_data_type_t data_type, + grub_efi_event_t event); + +- grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip4_config2_protocol *this, ++ grub_efi_status_t (__grub_efi_api *unregister_datanotify) (struct grub_efi_ip4_config2_protocol *this, + grub_efi_ip4_config2_data_type_t data_type, + grub_efi_event_t event); + }; +@@ -2126,21 +2126,21 @@ typedef enum grub_efi_ip6_config_data_type grub_efi_ip6_config_data_type_t; + + struct grub_efi_ip6_config_protocol + { +- grub_efi_status_t (*set_data) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_status_t (__grub_efi_api *set_data) (struct grub_efi_ip6_config_protocol *this, + grub_efi_ip6_config_data_type_t data_type, + grub_efi_uintn_t data_size, + void *data); + +- grub_efi_status_t (*get_data) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_status_t (__grub_efi_api *get_data) (struct grub_efi_ip6_config_protocol *this, + grub_efi_ip6_config_data_type_t data_type, + grub_efi_uintn_t *data_size, + void *data); + +- grub_efi_status_t (*register_data_notify) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_status_t (__grub_efi_api *register_data_notify) (struct grub_efi_ip6_config_protocol *this, + grub_efi_ip6_config_data_type_t data_type, + grub_efi_event_t event); + +- grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip6_config_protocol *this, ++ grub_efi_status_t (__grub_efi_api *unregister_datanotify) (struct grub_efi_ip6_config_protocol *this, + grub_efi_ip6_config_data_type_t data_type, + grub_efi_event_t event); + }; +@@ -2191,17 +2191,17 @@ typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_add + + struct grub_efi_memory_attribute_protocol + { +- grub_efi_status_t (*get_memory_attributes) ( ++ grub_efi_status_t (__grub_efi_api *get_memory_attributes) ( + struct grub_efi_memory_attribute_protocol *this, + grub_efi_physical_address_t base_address, + grub_efi_uint64_t length, + grub_efi_uint64_t *attributes); +- grub_efi_status_t (*set_memory_attributes) ( ++ grub_efi_status_t (__grub_efi_api *set_memory_attributes) ( + struct grub_efi_memory_attribute_protocol *this, + grub_efi_physical_address_t base_address, + grub_efi_uint64_t length, + grub_efi_uint64_t attributes); +- grub_efi_status_t (*clear_memory_attributes) ( ++ grub_efi_status_t (__grub_efi_api *clear_memory_attributes) ( + struct grub_efi_memory_attribute_protocol *this, + grub_efi_physical_address_t base_address, + grub_efi_uint64_t length, +diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h +index fdb88eb81..d996716e4 100644 +--- a/include/grub/efi/dhcp.h ++++ b/include/grub/efi/dhcp.h +@@ -123,7 +123,7 @@ struct grub_efi_dhcp4_config_data { + grub_efi_uint32_t request_try_count; + grub_efi_uint32_t *request_timeout; + grub_efi_ipv4_address_t client_address; +- grub_efi_status_t (*dhcp4_callback) ( ++ grub_efi_status_t (__grub_efi_api *dhcp4_callback) ( + grub_efi_dhcp4_protocol_t *this, + void *context, + grub_efi_dhcp4_state_t current_state, +@@ -153,27 +153,27 @@ struct grub_efi_dhcp4_mode_data { + typedef struct grub_efi_dhcp4_mode_data grub_efi_dhcp4_mode_data_t; + + struct grub_efi_dhcp4_protocol { +- grub_efi_status_t (*get_mode_data) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *get_mode_data) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_mode_data_t *dhcp4_mode_data); +- grub_efi_status_t (*configure) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *configure) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_config_data_t *dhcp4_cfg_data); +- grub_efi_status_t (*start) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *start) (grub_efi_dhcp4_protocol_t *this, + grub_efi_event_t completion_event); +- grub_efi_status_t (*renew_rebind) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *renew_rebind) (grub_efi_dhcp4_protocol_t *this, + grub_efi_boolean_t rebind_request, + grub_efi_event_t completion_event); +- grub_efi_status_t (*release) (grub_efi_dhcp4_protocol_t *this); +- grub_efi_status_t (*stop) (grub_efi_dhcp4_protocol_t *this); +- grub_efi_status_t (*build) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *release) (grub_efi_dhcp4_protocol_t *this); ++ grub_efi_status_t (__grub_efi_api *stop) (grub_efi_dhcp4_protocol_t *this); ++ grub_efi_status_t (__grub_efi_api *build) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_packet_t *seed_packet, + grub_efi_uint32_t delete_count, + grub_efi_uint8_t *delete_list, + grub_efi_uint32_t append_count, + grub_efi_dhcp4_packet_option_t *append_list[], + grub_efi_dhcp4_packet_t **new_packet); +- grub_efi_status_t (*transmit_receive) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *transmit_receive) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_transmit_receive_token_t *token); +- grub_efi_status_t (*parse) (grub_efi_dhcp4_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *parse) (grub_efi_dhcp4_protocol_t *this, + grub_efi_dhcp4_packet_t *packet, + grub_efi_uint32_t *option_count, + grub_efi_dhcp4_packet_option_t *packet_option_list[]); +@@ -289,7 +289,7 @@ struct grub_efi_dhcp6_mode_data { + typedef struct grub_efi_dhcp6_mode_data grub_efi_dhcp6_mode_data_t; + + struct grub_efi_dhcp6_config_data { +- grub_efi_status_t (*dhcp6_callback) (grub_efi_dhcp6_protocol_t this, ++ grub_efi_status_t (__grub_efi_api *dhcp6_callback) (grub_efi_dhcp6_protocol_t this, + void *context, + grub_efi_dhcp6_state_t current_state, + grub_efi_dhcp6_event_t dhcp6_event, +@@ -308,33 +308,33 @@ struct grub_efi_dhcp6_config_data { + typedef struct grub_efi_dhcp6_config_data grub_efi_dhcp6_config_data_t; + + struct grub_efi_dhcp6_protocol { +- grub_efi_status_t (*get_mode_data) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *get_mode_data) (grub_efi_dhcp6_protocol_t *this, + grub_efi_dhcp6_mode_data_t *dhcp6_mode_data, + grub_efi_dhcp6_config_data_t *dhcp6_config_data); +- grub_efi_status_t (*configure) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *configure) (grub_efi_dhcp6_protocol_t *this, + grub_efi_dhcp6_config_data_t *dhcp6_cfg_data); +- grub_efi_status_t (*start) (grub_efi_dhcp6_protocol_t *this); +- grub_efi_status_t (*info_request) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *start) (grub_efi_dhcp6_protocol_t *this); ++ grub_efi_status_t (__grub_efi_api *info_request) (grub_efi_dhcp6_protocol_t *this, + grub_efi_boolean_t send_client_id, + grub_efi_dhcp6_packet_option_t *option_request, + grub_efi_uint32_t option_count, + grub_efi_dhcp6_packet_option_t *option_list[], + grub_efi_dhcp6_retransmission_t *retransmission, + grub_efi_event_t timeout_event, +- grub_efi_status_t (*reply_callback) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *reply_callback) (grub_efi_dhcp6_protocol_t *this, + void *context, + grub_efi_dhcp6_packet_t *packet), + void *callback_context); +- grub_efi_status_t (*renew_rebind) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *renew_rebind) (grub_efi_dhcp6_protocol_t *this, + grub_efi_boolean_t rebind_request); +- grub_efi_status_t (*decline) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *decline) (grub_efi_dhcp6_protocol_t *this, + grub_efi_uint32_t address_count, + grub_efi_ipv6_address_t *addresses); +- grub_efi_status_t (*release) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *release) (grub_efi_dhcp6_protocol_t *this, + grub_efi_uint32_t address_count, + grub_efi_ipv6_address_t *addresses); +- grub_efi_status_t (*stop) (grub_efi_dhcp6_protocol_t *this); +- grub_efi_status_t (*parse) (grub_efi_dhcp6_protocol_t *this, ++ grub_efi_status_t (__grub_efi_api *stop) (grub_efi_dhcp6_protocol_t *this); ++ grub_efi_status_t (__grub_efi_api *parse) (grub_efi_dhcp6_protocol_t *this, + grub_efi_dhcp6_packet_t *packet, + grub_efi_uint32_t *option_count, + grub_efi_dhcp6_packet_option_t *packet_option_list[]); +diff --git a/include/grub/efi/edid.h b/include/grub/efi/edid.h +index 43c0c4372..ac1b8e2fd 100644 +--- a/include/grub/efi/edid.h ++++ b/include/grub/efi/edid.h +@@ -33,7 +33,7 @@ + struct grub_efi_edid_override; + + typedef grub_efi_status_t +-(*grub_efi_edid_override_get_edid) (struct grub_efi_edid_override *this, ++(__grub_efi_api *grub_efi_edid_override_get_edid) (struct grub_efi_edid_override *this, + grub_efi_handle_t *childhandle, + grub_efi_uint32_t *attributes, + grub_efi_uintn_t *edidsize, +diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h +index ad164ba19..242d001b6 100644 +--- a/include/grub/efi/http.h ++++ b/include/grub/efi/http.h +@@ -188,27 +188,27 @@ typedef struct { + + struct grub_efi_http { + grub_efi_status_t +- (*get_mode_data) (struct grub_efi_http *this, ++ (__grub_efi_api *get_mode_data) (struct grub_efi_http *this, + grub_efi_http_config_data_t *http_config_data); + + grub_efi_status_t +- (*configure) (struct grub_efi_http *this, ++ (__grub_efi_api *configure) (struct grub_efi_http *this, + grub_efi_http_config_data_t *http_config_data); + + grub_efi_status_t +- (*request) (struct grub_efi_http *this, ++ (__grub_efi_api *request) (struct grub_efi_http *this, + grub_efi_http_token_t *token); + + grub_efi_status_t +- (*cancel) (struct grub_efi_http *this, ++ (__grub_efi_api *cancel) (struct grub_efi_http *this, + grub_efi_http_token_t *token); + + grub_efi_status_t +- (*response) (struct grub_efi_http *this, ++ (__grub_efi_api *response) (struct grub_efi_http *this, + grub_efi_http_token_t *token); + + grub_efi_status_t +- (*poll) (struct grub_efi_http *this); ++ (__grub_efi_api *poll) (struct grub_efi_http *this); + }; + typedef struct grub_efi_http grub_efi_http_t; + +diff --git a/include/grub/efi/pci.h b/include/grub/efi/pci.h +index b17245549..a90f61042 100644 +--- a/include/grub/efi/pci.h ++++ b/include/grub/efi/pci.h +@@ -48,7 +48,7 @@ typedef enum + struct grub_efi_pci_io; + + typedef grub_efi_status_t +-(*grub_efi_pci_io_mem_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_mem_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint8_t bar_index, + grub_efi_uint64_t offset, +@@ -56,7 +56,7 @@ typedef grub_efi_status_t + void *buffer); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_config_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_config_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint32_t offset, + grub_efi_uintn_t count, +@@ -113,7 +113,7 @@ typedef enum + grub_efi_pci_io_attribute_operation_t; + + typedef grub_efi_status_t +-(*grub_efi_pci_io_poll_io_mem_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_poll_io_mem_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint8_t bar_ndex, + grub_efi_uint64_t offset, +@@ -123,7 +123,7 @@ typedef grub_efi_status_t + grub_efi_uint64_t *result); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_copy_mem_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_copy_mem_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint8_t dest_bar_index, + grub_efi_uint64_t dest_offset, +@@ -132,7 +132,7 @@ typedef grub_efi_status_t + grub_efi_uintn_t count); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_map_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_map_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_operation_t operation, + void *host_address, + grub_efi_uintn_t *number_of_bytes, +@@ -140,11 +140,11 @@ typedef grub_efi_status_t + void **mapping); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_unmap_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_unmap_t) (struct grub_efi_pci_io *this, + void *mapping); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_allocate_buffer_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_allocate_buffer_t) (struct grub_efi_pci_io *this, + grub_efi_allocate_type_t type, + grub_efi_memory_type_t memory_type, + grub_efi_uintn_t pages, +@@ -152,7 +152,7 @@ typedef grub_efi_status_t + grub_efi_uint64_t attributes); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_free_buffer_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_free_buffer_t) (struct grub_efi_pci_io *this, + grub_efi_allocate_type_t type, + grub_efi_memory_type_t memory_type, + grub_efi_uintn_t pages, +@@ -160,29 +160,29 @@ typedef grub_efi_status_t + grub_efi_uint64_t attributes); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_flush_t) (struct grub_efi_pci_io *this); ++(__grub_efi_api *grub_efi_pci_io_flush_t) (struct grub_efi_pci_io *this); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_get_location_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_get_location_t) (struct grub_efi_pci_io *this, + grub_efi_uintn_t *segment_number, + grub_efi_uintn_t *bus_number, + grub_efi_uintn_t *device_number, + grub_efi_uintn_t *function_number); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_attributes_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_attributes_t) (struct grub_efi_pci_io *this, + grub_efi_pci_io_attribute_operation_t operation, + grub_efi_uint64_t attributes, + grub_efi_uint64_t *result); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_get_bar_attributes_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_get_bar_attributes_t) (struct grub_efi_pci_io *this, + grub_efi_uint8_t bar_index, + grub_efi_uint64_t *supports, + void **resources); + + typedef grub_efi_status_t +-(*grub_efi_pci_io_set_bar_attributes_t) (struct grub_efi_pci_io *this, ++(__grub_efi_api *grub_efi_pci_io_set_bar_attributes_t) (struct grub_efi_pci_io *this, + grub_efi_uint64_t attributes, + grub_efi_uint8_t bar_index, + grub_efi_uint64_t *offset, +@@ -212,12 +212,12 @@ struct grub_efi_pci_root_io; + + typedef struct + { +- grub_efi_status_t(*read) (struct grub_efi_pci_root_io *this, ++ grub_efi_status_t(__grub_efi_api *read) (struct grub_efi_pci_root_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint64_t address, + grub_efi_uintn_t count, + void *buffer); +- grub_efi_status_t(*write) (struct grub_efi_pci_root_io *this, ++ grub_efi_status_t(__grub_efi_api *write) (struct grub_efi_pci_root_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint64_t address, + grub_efi_uintn_t count, +@@ -237,7 +237,7 @@ typedef enum + grub_efi_pci_root_io_operation_t; + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_poll_io_mem_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_poll_io_mem_t) (struct grub_efi_pci_root_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint64_t address, + grub_efi_uint64_t mask, +@@ -246,7 +246,7 @@ typedef grub_efi_status_t + grub_efi_uint64_t *result); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_copy_mem_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_copy_mem_t) (struct grub_efi_pci_root_io *this, + grub_efi_pci_io_width_t width, + grub_efi_uint64_t dest_offset, + grub_efi_uint64_t src_offset, +@@ -254,7 +254,7 @@ typedef grub_efi_status_t + + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_map_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_map_t) (struct grub_efi_pci_root_io *this, + grub_efi_pci_root_io_operation_t operation, + void *host_address, + grub_efi_uintn_t *number_of_bytes, +@@ -262,11 +262,11 @@ typedef grub_efi_status_t + void **mapping); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_unmap_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_unmap_t) (struct grub_efi_pci_root_io *this, + void *mapping); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_allocate_buffer_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_allocate_buffer_t) (struct grub_efi_pci_root_io *this, + grub_efi_allocate_type_t type, + grub_efi_memory_type_t memory_type, + grub_efi_uintn_t pages, +@@ -274,26 +274,26 @@ typedef grub_efi_status_t + grub_efi_uint64_t attributes); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_free_buffer_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_free_buffer_t) (struct grub_efi_pci_root_io *this, + grub_efi_uintn_t pages, + void **host_address); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_flush_t) (struct grub_efi_pci_root_io *this); ++(__grub_efi_api *grub_efi_pci_root_io_flush_t) (struct grub_efi_pci_root_io *this); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_get_attributes_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_get_attributes_t) (struct grub_efi_pci_root_io *this, + grub_efi_uint64_t *supports, + void **resources); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_set_attributes_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_set_attributes_t) (struct grub_efi_pci_root_io *this, + grub_efi_uint64_t attributes, + grub_efi_uint64_t *offset, + grub_efi_uint64_t *length); + + typedef grub_efi_status_t +-(*grub_efi_pci_root_io_configuration_t) (struct grub_efi_pci_root_io *this, ++(__grub_efi_api *grub_efi_pci_root_io_configuration_t) (struct grub_efi_pci_root_io *this, + void **resources); + + struct grub_efi_pci_root_io { diff --git a/0274-grub-core-net-arp.c-fix-variable-name.patch b/0274-grub-core-net-arp.c-fix-variable-name.patch new file mode 100644 index 00000000..a94167c6 --- /dev/null +++ b/0274-grub-core-net-arp.c-fix-variable-name.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 28 Aug 2024 13:37:42 -0600 +Subject: [PATCH] grub-core/net/arp.c: fix variable name + +Signed-off-by: Leo Sandoval +--- + grub-core/net/arp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c +index 8bf0a06e1..7adeb7447 100644 +--- a/grub-core/net/arp.c ++++ b/grub-core/net/arp.c +@@ -159,7 +159,7 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, + sender_addr.option = 0; + target_addr.option = 0; + +- grub_memcpy(&target_addr.ipv4, tmp_ptr, pln); ++ grub_memcpy(&sender_addr.ipv4, tmp_ptr, pln); + tmp_ptr += pln; + + grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1); diff --git a/grub.patches b/grub.patches index ecde23db..bf760636 100644 --- a/grub.patches +++ b/grub.patches @@ -270,3 +270,5 @@ Patch0269: 0269-kern-ieee1275-init-Add-IEEE-1275-Radix-support-for-K.patch Patch0270: 0270-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch Patch0271: 0271-grub2-mkconfig-Simplify-os_name-detection.patch Patch0272: 0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch +Patch0273: 0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch +Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch \ No newline at end of file diff --git a/grub2.spec b/grub2.spec index ae49392d..58b7ff31 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Aug 29 2024 Leo Sandoval - 2.12-5 +- Fix netbooting regressions introduced at 2.12-1 +- Resolves: #2303727 + * Thu Aug 08 2024 Peter Robinson 2.12-4 - Build using fuse3 From 3a9809b30ef7f9512b765450eb404ee836106257 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Thu, 5 Sep 2024 12:37:59 -0600 Subject: [PATCH 240/294] load EFI commands inside test expressions Resolves: #2305291 Signed-off-by: Leo Sandoval --- ...EFI-commands-inside-test-expressions.patch | 44 +++++++++++++++++++ grub.patches | 3 +- grub2.spec | 6 ++- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 0275-load-EFI-commands-inside-test-expressions.patch diff --git a/0275-load-EFI-commands-inside-test-expressions.patch b/0275-load-EFI-commands-inside-test-expressions.patch new file mode 100644 index 00000000..137890ef --- /dev/null +++ b/0275-load-EFI-commands-inside-test-expressions.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 4 Sep 2024 13:25:23 -0600 +Subject: [PATCH] load EFI commands inside test expressions + +These two commands may fail interrumping the normal boot process, +so placing these inside test expressions is a safer approach. + +Resolves: #2305291 +Suggested-by: Kan-Ru Chen: +Signed-off-by: Leo Sandoval +--- + util/grub.d/25_bli.in | 4 +++- + util/grub.d/30_uefi-firmware.in | 3 +-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/util/grub.d/25_bli.in b/util/grub.d/25_bli.in +index 26e27a019..00a8d7159 100644 +--- a/util/grub.d/25_bli.in ++++ b/util/grub.d/25_bli.in +@@ -19,6 +19,8 @@ set -e + + cat << EOF + if [ "\$grub_platform" = "efi" ]; then +- insmod bli ++ if [ ! insmod bli ]; then ++ echo "bli module not available" ++ fi + fi + EOF +diff --git a/util/grub.d/30_uefi-firmware.in b/util/grub.d/30_uefi-firmware.in +index 1c2365ddb..1ef31e08f 100644 +--- a/util/grub.d/30_uefi-firmware.in ++++ b/util/grub.d/30_uefi-firmware.in +@@ -32,8 +32,7 @@ gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2 + + cat << EOF + if [ "\$grub_platform" = "efi" ]; then +- fwsetup --is-supported +- if [ "\$?" = 0 ]; then ++ if [ fwsetup --is-supported ]; then + menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { + fwsetup + } diff --git a/grub.patches b/grub.patches index bf760636..f096b8df 100644 --- a/grub.patches +++ b/grub.patches @@ -271,4 +271,5 @@ Patch0270: 0270-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch Patch0271: 0271-grub2-mkconfig-Simplify-os_name-detection.patch Patch0272: 0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch Patch0273: 0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch -Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch \ No newline at end of file +Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch +Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch \ No newline at end of file diff --git a/grub2.spec b/grub2.spec index 58b7ff31..f4c00ca7 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Sep 5 2024 Leo Sandoval - 2.12-6 +- load EFI commands inside test expressions +- Resolves: #2305291 + * Thu Aug 29 2024 Leo Sandoval - 2.12-5 - Fix netbooting regressions introduced at 2.12-1 - Resolves: #2303727 From 19dcf163e6367477fa5ab9156c152266a67c7552 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Thu, 12 Sep 2024 12:49:02 +0200 Subject: [PATCH 241/294] aarch64/macros: Build gnulib with -mbranch-protection=standard Signed-off-by: Nicolas Frayer --- grub.macros | 5 +++++ grub2.spec | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index 061c7782..77be76d4 100644 --- a/grub.macros +++ b/grub.macros @@ -15,7 +15,12 @@ %endif # gnulib actively ignores CFLAGS because it's terrible +# build aarch64 gnulib with branch protection +%ifarch aarch64 +%global cc_equals "CC=%{ccpath} -fPIE -Wl,-z,noexecstack -Wl,--no-warn-rwx-segments -mbranch-protection=standard" +%else %global cc_equals "CC=%{ccpath} -fPIE -Wl,-z,noexecstack -Wl,--no-warn-rwx-segments" +%endif %global cflags_sed \\\ sed \\\ diff --git a/grub2.spec b/grub2.spec index f4c00ca7..c5e03c03 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Sep 17 2024 Nicolas Frayer - 2.12-7 +- aarch64/macros: Build gnulib with -mbranch-protection=standard + * Thu Sep 5 2024 Leo Sandoval - 2.12-6 - load EFI commands inside test expressions - Resolves: #2305291 From d0e3049f97af0c8bcbf1cded598439ed29e27ba2 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Mon, 12 Aug 2024 22:19:36 +0200 Subject: [PATCH 242/294] NX: efi/loader, add a call to grub_efi_check_nx_required() nx_required was initialized to 0 but was never assigned a value. Call grub_efi_check_nx_required() to solve this. Signed-off-by: Nicolas Frayer --- ...-if-NX-is-required-in-grub_efi_linux.patch | 25 +++++++++++++++++++ grub.patches | 3 ++- grub2.spec | 5 +++- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch diff --git a/0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch b/0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch new file mode 100644 index 00000000..0942ea42 --- /dev/null +++ b/0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Wed, 25 Sep 2024 17:23:33 +0200 +Subject: [PATCH] efi/loader: Check if NX is required in grub_efi_linux_boot() + +Call grub_efi_check_nx_required() passing it nx_required to +assign the correct value + +Signed-off-by: Nicolas Frayer +--- + grub-core/loader/efi/linux.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 0d1804b602da..5889e3f36f89 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -236,6 +236,7 @@ grub_efi_linux_boot (grub_addr_t k_address, grub_size_t k_size, + grub_dprintf ("linux", "kernel_address: %p handover_offset: %p params: %p\n", + (void *)k_address, (void *)h_offset, k_params); + ++ grub_efi_check_nx_required(&nx_required); + + if (nx_required && !nx_supported) + return grub_error (GRUB_ERR_BAD_OS, N_("kernel does not support NX loading required by policy")); diff --git a/grub.patches b/grub.patches index f096b8df..8b3e1be4 100644 --- a/grub.patches +++ b/grub.patches @@ -272,4 +272,5 @@ Patch0271: 0271-grub2-mkconfig-Simplify-os_name-detection.patch Patch0272: 0272-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch Patch0273: 0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch -Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch \ No newline at end of file +Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch +Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch diff --git a/grub2.spec b/grub2.spec index c5e03c03..fc394efa 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Sep 25 2024 Nicolas Frayer 2.12-8 +- NX: efi/loader, add a call to grub_efi_check_nx_required() + * Tue Sep 17 2024 Nicolas Frayer - 2.12-7 - aarch64/macros: Build gnulib with -mbranch-protection=standard From e42444fde3bfd35f892a800b49f18136fa1298ef Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Thu, 3 Oct 2024 15:10:19 +0200 Subject: [PATCH 243/294] Stop grub.efi from always printing "dynamic_load_symbols %p\n" during boot Resolves: #2316279 Signed-off-by: Nicolas Frayer --- ...om-always-printing-dynamic_load_symb.patch | 80 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +- 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch diff --git a/0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch b/0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch new file mode 100644 index 00000000..02a64177 --- /dev/null +++ b/0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 3 Oct 2024 12:26:07 +0200 +Subject: [PATCH] Stop grub.efi from always printing "dynamic_load_symbols + %p\n" during boot + +Commit 972aa68d2bf5 ("Make a "gdb" dprintf that tells us load addresses.") +added some debug prints to help with running gdb against grub. + +Besides adding a new grub_dl_print_gdb_info () function which uses +`grub_qdprintf ("gdb", ...);` it also adds a new grub_efi_print_gdb_info () +call to grub_efi_init (). + +grub_efi_print_gdb_info () is intended for the gdbinfo command and uses +a non debug grub_printf () call leading to grub now always printing this +message during boot breaking flicker-free boot. + +Add a new "debug" parameter to grub_efi_print_gdb_info () and use +`grub_qdprintf ("gdb", ...);` when this is set to silence the printing +done from grub_efi_init () when debugging is not enabled. + +Fixes: 972aa68d2bf5 ("Make a "gdb" dprintf that tells us load addresses.") +Signed-off-by: Hans de Goede +--- + grub-core/kern/efi/debug.c | 2 +- + grub-core/kern/efi/init.c | 2 +- + include/grub/efi/debug.h | 7 +++++-- + 3 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/grub-core/kern/efi/debug.c b/grub-core/kern/efi/debug.c +index 5d2ab1a36ff4..5ac194fc8f46 100644 +--- a/grub-core/kern/efi/debug.c ++++ b/grub-core/kern/efi/debug.c +@@ -26,7 +26,7 @@ grub_cmd_gdbinfo (struct grub_command *cmd __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char **args __attribute__ ((unused))) + { +- grub_efi_print_gdb_info (); ++ grub_efi_print_gdb_info (false); + return 0; + } + +diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c +index d35d69747342..ce8a7fe7122f 100644 +--- a/grub-core/kern/efi/init.c ++++ b/grub-core/kern/efi/init.c +@@ -157,7 +157,7 @@ grub_efi_init (void) + grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL); + + grub_efi_env_init (); +- grub_efi_print_gdb_info (); ++ grub_efi_print_gdb_info (true); + grub_efidisk_init (); + + grub_efi_register_debug_commands (); +diff --git a/include/grub/efi/debug.h b/include/grub/efi/debug.h +index c2d2a03b06f1..961e591afa3e 100644 +--- a/include/grub/efi/debug.h ++++ b/include/grub/efi/debug.h +@@ -27,7 +27,7 @@ + void grub_efi_register_debug_commands (void); + + static inline void +-grub_efi_print_gdb_info (void) ++grub_efi_print_gdb_info (bool debug) + { + grub_addr_t text; + +@@ -35,7 +35,10 @@ grub_efi_print_gdb_info (void) + if (!text) + return; + +- grub_printf ("dynamic_load_symbols %p\n", (void *)text); ++ if (debug) ++ grub_qdprintf ("gdb", "dynamic_load_symbols %p\n", (void *)text); ++ else ++ grub_printf ("dynamic_load_symbols %p\n", (void *)text); + } + + #endif /* ! GRUB_EFI_DEBUG_HEADER */ diff --git a/grub.patches b/grub.patches index 8b3e1be4..452a66f9 100644 --- a/grub.patches +++ b/grub.patches @@ -274,3 +274,4 @@ Patch0273: 0273-efi-api.h-include-missing-__grub_efi_api-macros-on-E.patch Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch +Patch0277: 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch diff --git a/grub2.spec b/grub2.spec index fc394efa..6be3ceac 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Oct 3 2024 Nicolas Frayer 2.12-9 +- Stop grub.efi from always printing "dynamic_load_symbols %p\n" during boot +- Resolves: #2316279 + * Wed Sep 25 2024 Nicolas Frayer 2.12-8 - NX: efi/loader, add a call to grub_efi_check_nx_required() From 7b0d0e6fb517ac528f0e71745975aeecc52f1170 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Thu, 17 Oct 2024 09:29:05 +0200 Subject: [PATCH 244/294] acpi: Fix out of bounds access in grub_acpi_xsdt_find_table() Resolves: #2317048 Signed-off-by: Nicolas Frayer --- ...bounds-access-in-grub_acpi_xsdt_find.patch | 34 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch diff --git a/0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch b/0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch new file mode 100644 index 00000000..20d2de34 --- /dev/null +++ b/0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Herrenschmidt +Date: Wed, 16 Oct 2024 16:20:24 +1100 +Subject: [PATCH] acpi: Fix out of bounds access in grub_acpi_xsdt_find_table() + +The calculation of the size of the table was incorrect (copy/pasta from +grub_acpi_rsdt_find_table() I assume...). The entries are 64-bit long. + +This causes us to access beyond the end of the table which is causing +crashes during boot on some systems. Typically this is causing a crash +on VMWare when using UEFI and enabling serial autodetection, as + +grub_acpi_find_table (GRUB_ACPI_SPCR_SIGNATURE); + +Will goes past the end of the table (the SPCR table doesn't exits) + +Signed-off-by: Benjamin Herrenschmidt +--- + grub-core/kern/acpi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/acpi.c b/grub-core/kern/acpi.c +index 48ded4e2ea6e..8ff0835d501f 100644 +--- a/grub-core/kern/acpi.c ++++ b/grub-core/kern/acpi.c +@@ -75,7 +75,7 @@ grub_acpi_xsdt_find_table (struct grub_acpi_table_header *xsdt, const char *sig) + return 0; + + ptr = (grub_unaligned_uint64_t *) (xsdt + 1); +- s = (xsdt->length - sizeof (*xsdt)) / sizeof (grub_uint32_t); ++ s = (xsdt->length - sizeof (*xsdt)) / sizeof (grub_uint64_t); + for (; s; s--, ptr++) + { + struct grub_acpi_table_header *tbl; diff --git a/grub.patches b/grub.patches index 452a66f9..ff170a18 100644 --- a/grub.patches +++ b/grub.patches @@ -275,3 +275,4 @@ Patch0274: 0274-grub-core-net-arp.c-fix-variable-name.patch Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch Patch0277: 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch +Patch0278: 0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch diff --git a/grub2.spec b/grub2.spec index 6be3ceac..a320533d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Oct 17 2024 Nicolas Frayer 2.12-10 +- acpi: Fix out of bounds access in grub_acpi_xsdt_find_table() +- Resolves: #2317048 + * Thu Oct 3 2024 Nicolas Frayer 2.12-9 - Stop grub.efi from always printing "dynamic_load_symbols %p\n" during boot - Resolves: #2316279 From 0a3394ca4b9865770a05f13762e0a8b3041c2bba Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Wed, 23 Oct 2024 12:15:08 +0200 Subject: [PATCH 245/294] cmd/search: Fix a possible NULL ptr dereference Signed-off-by: Nicolas Frayer --- ...-Fix-a-possible-NULL-ptr-dereference.patch | 59 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch diff --git a/0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch b/0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch new file mode 100644 index 00000000..7da6e10b --- /dev/null +++ b/0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Wed, 16 Oct 2024 15:50:32 +0200 +Subject: [PATCH] cmd/search: Fix a possible NULL ptr dereference + +When querying about a partition UUID, we're not checking +for get_device_uuid() return value, which can possibly +result in dereferencing a NULL pointer. + +Signed-off-by: Nicolas Frayer +Co-authored-by: Chuong Tran +--- + grub-core/commands/search.c | 28 +++++++++++++++------------- + 1 file changed, 15 insertions(+), 13 deletions(-) + +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index 9dd937e6df4e..d538b36219fb 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -212,24 +212,26 @@ iterate_device (const char *name, void *data) + struct uuid_context uuid_ctx; + int ret = 0; + +- get_device_uuid(name, &quid_name); +- if (!grub_strcmp(quid_name, ctx->key)) ++ if (get_device_uuid(name, &quid_name)) + { +- uuid_ctx.name = name; +- uuid_ctx.uuid = quid_name; ++ if (!grub_strcmp(quid_name, ctx->key)) ++ { ++ uuid_ctx.name = name; ++ uuid_ctx.uuid = quid_name; + +- ret = grub_device_iterate (check_for_duplicate, &uuid_ctx); ++ ret = grub_device_iterate (check_for_duplicate, &uuid_ctx); + +- if (ret) +- { +- grub_printf("Duplicated media UUID found, rebooting ...\n"); +- grub_sleep(10); +- grub_reboot(); +- } +- } ++ if (ret) ++ { ++ grub_printf("Duplicated media UUID found, rebooting ...\n"); ++ grub_sleep(10); ++ grub_reboot(); ++ } ++ } + +- if (quid_name) grub_free (quid_name); ++ if (quid_name) grub_free (quid_name); + ++ } + } + } + } diff --git a/grub.patches b/grub.patches index ff170a18..23f1ac19 100644 --- a/grub.patches +++ b/grub.patches @@ -276,3 +276,4 @@ Patch0275: 0275-load-EFI-commands-inside-test-expressions.patch Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch Patch0277: 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch Patch0278: 0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch +Patch0279: 0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch diff --git a/grub2.spec b/grub2.spec index a320533d..fdfe73b9 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Oct 23 2024 Nicolas Frayer 2.12-11 +- cmd/search: Fix a possible NULL ptr dereference + * Thu Oct 17 2024 Nicolas Frayer 2.12-10 - acpi: Fix out of bounds access in grub_acpi_xsdt_find_table() - Resolves: #2317048 From 9eb852fbc529cb4ace0e63ae13e6f16d5a3bbce2 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Mon, 21 Oct 2024 12:08:48 -0600 Subject: [PATCH 246/294] do-rebase: refactor command line parameters Removes the logic to search for a distro release version based on the --dist argument and instead makes this as required parameter provided by the user, reducing code size considerably as the expense of letting the user responsibility to define it. The --dist argument was also used as branch name in some cases (where --dist was not defined) so this change splits the original parameter semantic in two: one for defining the distro release version (--dist) and another to define the branch name (--branch). Finally, a short README with single scenario as example. Signed-off-by: Leo Sandoval --- README.do-rebase | 21 ++++++++++ do-rebase | 104 ++++++++++++++++------------------------------- grub2.spec | 5 ++- 3 files changed, 61 insertions(+), 69 deletions(-) create mode 100644 README.do-rebase diff --git a/README.do-rebase b/README.do-rebase new file mode 100644 index 00000000..42b7716b --- /dev/null +++ b/README.do-rebase @@ -0,0 +1,21 @@ +do-rebase script +================ + +The `do-rebase` is a useful script that helps the developers to take patches from +a remote repository & branch, apply those and create a commit. Although this sounds like +easy steps, each may take time and it is prone to errors (as any manual work). + +To see in action, supposed you have a one or more patches for `f42` release that fixes (or +enhances) a bug at the repository `git@github.com:someuser/grub2.git` with branch +name `hotfix`; the way to call the script is by + + $ ./do-rebase --dist=f42 --repo=git@github.com:someuser/grub2.git --branch=hotfix + +the script will then fetch the repository in a separate directory (`.rhboot.git`), compare +those `hotfix` commits that has not been merged in `master` (`git format-patch master..hotfix` +on the `.rhboot.git` repo), replace these with the ones in current working dir, finally create +a commit that you can of course amend. + +The script supports other useful options: `--amend --commit --nocommit --bumpspec --nobumpspec --pkgtool=`. +Worth mentioning that you do not have to specify a --pkgtool option: it is infered from the --dist parameter but in +case you want to override it, the options is there. diff --git a/do-rebase b/do-rebase index 685cef68..8af199e2 100755 --- a/do-rebase +++ b/do-rebase @@ -1,6 +1,7 @@ #!/bin/bash set -e set -u + shopt -qu globstar shopt -qs expand_aliases export LC_COLLATE=C @@ -18,24 +19,33 @@ usage() exec 1>&2 retcode=$1 fi - echo usage: "do-rebase [OPTIONS] [--dist RELEASEVER | RELEASEVER ] [GITREPO]" - echo OPTIONS: --dist=RELEASEVER --repo=REPO --amend --nocommit --nobumpspec - exit $retcode + echo usage: "do-rebase [OPTIONS] --dist= --repo= --branch=" + echo OPTIONS: "--amend --commit --nocommit --bumpspec --nobumpspec" + exit "$retcode" } -if ! git status | grep -q 'nothing to commit, working .* clean' ; then +on_error() { + exec 1>&2 + echo "An error occurred. Exiting..." + git reset --hard + exit 1 +} + +trap 'on_error' ERR + +# Check if the working directory is clean (no changes) +if ! git diff-index --quiet HEAD --; then echo "Working directory is not clean, cannot rebase." 1>&2 exit 1 fi -gitrepo="git@github.com:rhboot/grub2.git" +gitrepo="" +branch="" releasever="" amend="" commit=1 bumpspec=1 -declare -a savedargs -savedargs=() while [ $# -gt 0 ]; do case $1 in --help|-h|--usage|-?|-u) @@ -55,6 +65,13 @@ while [ $# -gt 0 ]; do shift gitrepo=$1 ;; + --branch=*) + branch=${1##--branch=} + ;; + --branch) + shift + branch=$1 + ;; --amend) amend="--amend" ;; @@ -74,93 +91,44 @@ while [ $# -gt 0 ]; do bumpspec=0 ;; *) - savedargs[${#savedargs[@]}]="$1" + echo "Unknown parameter $1" ;; esac shift done -set -- "${savedargs[@]}" -if [ -z "${releasever}" -a $# -gt 0 ]; then - releasever=$1 - shift -else - dist=$(git status | grep "On branch" | cut -d\ -f3-) - if [ -z "$dist" ]; then - echo "Could not figure out distro release version" 1>&2 - usage 1 - fi - case "$(eval echo \${dist})" in - .fc*) - releasever=$(echo ${dist} | \ - sed 's/^\.fc\([[:digit:]]\+\)$/fedora-\1/') - ;; - .*) - releasever=$(echo $dist | \ - sed 's/^\.\([[:alpha:]]\+\)\([[:digit:]]\+\)$/\1-\2/') - ;; - rhel*) - releasever=${dist} - dist=.el${releasever##rhel-} - ;; - esac - if [ -z "${releasever}" -o "${releasever}" = "${dist}" ]; then - echo "Could not figure out distro release version" 1>&2 - usage 1 - fi +# check must params +if [ -z "$releasever" ] || [ -z "$gitrepo" ] || [ -z "$branch" ]; then + usage fi -if [ -z "$releasever" ]; then - echo "Could not figure out distro release version" 1>&2 - usage 1 -fi - -if [ -n "${1:-}" ]; then - gitrepo=$1 - shift -fi - -if [ $# -ge 1 ]; then - echo "Unknown argument \"$1\"" 1>&2 - usage 1 -fi - -if [ ! -d $PWD/.rhboot.git ]; then +if [ ! -d "$PWD/.rhboot.git" ]; then othergit init othergit config core.abbrev 11 - if ! othergit remote add \ - rhboot $gitrepo \ - >/dev/null 2>&1 ; then + if ! othergit remote add rhboot "$gitrepo" >/dev/null 2>&1 ; then echo "Could not add remote: rhboot" 1>&2 exit 1 fi elif othergit remote show -n rhboot | grep -q "URL: github$" ; then - if ! othergit remote add \ - rhboot $gitrepo \ - >/dev/null 2>&1 ; then + if ! othergit remote add rhboot "$gitrepo" >/dev/null 2>&1 ; then echo "Could not add remote: rhboot" 1>&2 exit 1 fi else - othergit remote set-url rhboot ${gitrepo} + othergit remote set-url rhboot "${gitrepo}" fi othergit fetch rhboot -remote=$(othergit branch --list -r "rhboot/${releasever}" 2>/dev/null) -if [ "${remote}" != " rhboot/${releasever}" ]; then - echo branch \"${releasever}\" does not appear to exist 1>&2 - exit 1 -fi unset LC_ALL git rm -q 0*.patch -fedpkg sources +fedpkg --release "$releasever" sources > grub.patches -patches=$(formatpatch refs/remotes/rhboot/master..refs/remotes/rhboot/${releasever}) +patches=$(formatpatch refs/remotes/rhboot/master..refs/remotes/rhboot/"${branch}") for x in $patches ; do - echo Patch$(echo ${x} | cut -d- -f1): ${x} >> grub.patches + echo "Patch$(echo "${x}" | cut -d- -f1): ${x}" >> grub.patches done if [[ -z "$amend" && ${bumpspec} -gt 0 ]] || [[ ${bumpspec} -ge 2 ]] ; then rpmdev-bumpspec -c "- Rebased to newer upstream for ${releasever}" grub2.spec @@ -168,7 +136,7 @@ fi git add 0*.patch grub2.spec grub.patches if [[ ${commit} -eq 1 ]] ; then if [ -z "$amend" ]; then - fedpkg commit -s -c + fedpkg --release "$releasever" commit -s -c else git commit --amend fi diff --git a/grub2.spec b/grub2.spec index fdfe73b9..314cecc5 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -560,6 +560,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Oct 23 2024 Leo Sandoval 2.12-12 +- do-rebase: refactor command line parameters + * Wed Oct 23 2024 Nicolas Frayer 2.12-11 - cmd/search: Fix a possible NULL ptr dereference From 283797a45d93f94a7ea1844271bd918590136750 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 15 Nov 2024 17:54:04 +0100 Subject: [PATCH 247/294] posttrans: added check for efi_home/grub.cfg Resolves: #2326502 Signed-off-by: Nicolas Frayer --- grub2.spec | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/grub2.spec b/grub2.spec index 314cecc5..5c76835a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 12%{?dist} +Release: 13%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -368,8 +368,10 @@ else fi fi -if (((grep -q "configfile" ${EFI_HOME}/grub.cfg && grep -q "root-dev-only" ${EFI_HOME}/grub.cfg) || grep -q "source" ${EFI_HOME}/grub.cfg) && ! grep -q "# It is automatically generated by grub2-mkconfig using templates" ${EFI_HOME}/grub.cfg); then - exit 0 #Already unified +if test -f ${EFI_HOME}/grub.cfg; then + if (((grep -q "configfile" ${EFI_HOME}/grub.cfg && grep -q "root-dev-only" ${EFI_HOME}/grub.cfg) || grep -q "source" ${EFI_HOME}/grub.cfg) && ! grep -q "# It is automatically generated by grub2-mkconfig using templates" ${EFI_HOME}/grub.cfg); then + exit 0 #Already unified + fi fi # create a stub grub2 config in EFI @@ -560,6 +562,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Nov 15 2024 Nicolas Frayer 2.12-13 +- posttrans: added check for efi_home/grub.cfg +- Resolves: #2326502 + * Wed Oct 23 2024 Leo Sandoval 2.12-12 - do-rebase: refactor command line parameters From a0dbec9c2afb8043cafb67f669ccaa525ba9d1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Kroupa?= Date: Fri, 30 Aug 2024 16:54:18 +0200 Subject: [PATCH 248/294] Build modules for Xen PV and PVH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The grub2-mkimage tool can be used for building custom images for various platforms and architectures. But it needs modules for that specific target. The x86_64-xen target is for PV guest type, the i386-xen_pvh is for PVH guest type (even for x86_64). Signed-off-by: Matyáš Kroupa Signed-off-by: Nicolas Frayer --- ...ing-blscfg-module-on-xen-and-xen_pvh.patch | 32 ++++ grub.macros | 169 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 45 ++++- 4 files changed, 246 insertions(+), 1 deletion(-) create mode 100644 0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch diff --git a/0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch b/0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch new file mode 100644 index 00000000..d1747377 --- /dev/null +++ b/0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Matyáš Kroupa +Date: Fri, 30 Aug 2024 16:28:21 +0200 +Subject: [PATCH] Enable building blscfg module on xen and xen_pvh +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Building blscfg module for Xen targets makes it possible to include them +in custom pvgrub2 and pvhgrub2 images. Those are then used to boot PV and +PVH domUs. + +Signed-off-by: Matyáš Kroupa +--- + grub-core/Makefile.core.def | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 6ff4835..95fd18d 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -880,6 +880,8 @@ module = { + enable = efi; + enable = i386_pc; + enable = emu; ++ enable = xen; ++ enable = i386_xen_pvh; + }; + + module = { +-- +2.46.0 diff --git a/grub.macros b/grub.macros index 77be76d4..ba7ff0f5 100644 --- a/grub.macros +++ b/grub.macros @@ -50,6 +50,8 @@ -e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\ )} %global efi_host_cflags %{expand:%%(echo %{host_cflags})} +%global xen_host_cflags %{expand:%%(echo %{host_cflags})} +%global xen_pvh_host_cflags %{expand:%%(echo %{host_cflags})} %global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})} %global legacy_target_cflags \\\ @@ -59,6 +61,8 @@ -e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\ )} %global efi_target_cflags %{expand:%%(echo %{target_cflags})} +%global xen_target_cflags %{expand:%%(echo %{target_cflags})} +%global xen_pvh_target_cflags %{expand:%%(echo %{target_cflags})} %global ldflags_sed \\\ sed \\\ @@ -72,6 +76,8 @@ %{ldflags_sed} \\\ )} %global efi_host_ldflags %{expand:%%(echo %{host_ldflags})} +%global xen_host_ldflags %{expand:%%(echo %{host_ldflags})} +%global xen_pvh_host_ldflags %{expand:%%(echo %{host_ldflags})} %global target_ldflags %{expand:%%(echo %{build_ldflags} -Wl,--no-warn-rwx-segments -static | %{ldflags_sed})} %global legacy_target_ldflags \\\ @@ -79,15 +85,21 @@ %{ldflags_sed} \\\ )} %global efi_target_ldflags %{expand:%%(echo %{target_ldflags})} +%global xen_target_ldflags %{expand:%%(echo %{target_ldflags})} +%global xen_pvh_target_ldflags %{expand:%%(echo %{target_ldflags})} %global with_efi_arch 0 %global with_alt_efi_arch 0 %global with_legacy_arch 0 %global with_emu_arch 1 +%global with_xen_arch 0 +%global with_xen_pvh_arch 0 %global emuarch %{_arch} %global grubefiarch %{nil} %global grublegacyarch %{nil} %global grubelfname %{nil} +%global xen_package_arch %{nil} +%global xen_pvh_package_arch %{nil} # sparc is always compiled 64 bit %ifarch %{sparc} @@ -131,6 +143,24 @@ %global efi_modules " efi_netfs efifwsetup efinet lsefi lsefimmap connectefi " %endif +%global xen_arch x86_64 +%ifarch %{xen_arch} +%global with_xen_arch 1 +%else +%global with_xen_arch 0 +%endif +%{!?with_xen_arch:%global without_xen_arch 0} +%{?with_xen_arch:%global without_xen_arch 1} + +%global xen_pvh_arch x86_64 +%ifarch %{xen_pvh_arch} +%global with_xen_pvh_arch 1 +%else +%global with_xen_pvh_arch 0 +%endif +%{!?with_xen_pvh_arch:%global without_xen_pvh_arch 0} +%{?with_xen_pvh_arch:%global without_xen_pvh_arch 1} + %ifarch x86_64 %{ix86} %global platform_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard " %endif @@ -163,11 +193,18 @@ %global target_cpu_name %{_arch} %global grub_target_name %{_arch}-efi %global package_arch efi-x64 +%global xen_package_arch xen-x64 +%global xen_pvh_package_arch xen_pvh-i386 %global legacy_target_cpu_name i386 %global legacy_package_arch pc %global platform pc +%global xen_grub_target_name %{_arch}-xen +%global xen_pvh_grub_target_name i386-xen_pvh +%global grubxenarch %{xen_grub_target_name} +%global grubxenpvharch %{xen_pvh_grub_target_name} + %global alt_efi_arch ia32 %global alt_target_cpu_name i386 %global alt_grub_target_name i386-efi @@ -333,6 +370,32 @@ Provides: grub2-efi-cdboot = %{evr} \ This subpackage provides optional components of grub used with removeable media on %{1} systems.\ %{nil} +%define define_xen_variant(o) \ +%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\ +%{expand:%%package %{1}-modules} \ +Summary: Modules used to build custom grub-%{xen_grub_target_name}.bin images \ +BuildArch: noarch \ +Requires: grub2-tools = %{evr} \ +Provides: grub2-xen-modules = %{evr} \ +Obsoletes: grub2-xen-modules < %{evr} \ +%{expand:%%description %{1}-modules} \ +%{desc} \ +This subpackage provides support for rebuilding your own grub-%{xen_grub_target_name}.bin. \ +%{nil} + +%define define_xen_pvh_variant(o) \ +%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\ +%{expand:%%package %{1}-modules} \ +Summary: Modules used to build custom grub-%{xen_pvh_grub_target_name}.bin images \ +BuildArch: noarch \ +Requires: grub2-tools = %{evr} \ +Provides: grub2-xen_pvh-modules = %{evr} \ +Obsoletes: grub2-xen_pvh-modules < %{evr} \ +%{expand:%%description %{1}-modules} \ +%{desc} \ +This subpackage provides support for rebuilding your own grub-%{xen_pvh_grub_target_name}.bin. \ +%{nil} + %global do_common_setup() \ %setup -q -n grub-%{tarversion} \ rm -fv docs/*.info \ @@ -378,6 +441,46 @@ git add . \ git commit -m "After efi configure" \ %{nil} +%define do_xen_configure() \ +%configure \\\ + %{cc_equals} \\\ + HOST_CFLAGS="%{3}" \\\ + HOST_CPPFLAGS="-I$(pwd)" \\\ + HOST_LDFLAGS="%{xen_host_ldflags}" \\\ + TARGET_CFLAGS="%{2}" \\\ + TARGET_CPPFLAGS="-I$(pwd)" \\\ + TARGET_LDFLAGS="%{xen_target_ldflags}" \\\ + --with-rpm-version=%{version}-%{release} \\\ + --with-platform=xen \\\ + --with-utils=host \\\ + --target=%{1} \\\ + --with-grubdir=grub2 \\\ + --program-transform-name=s,grub,grub2, \\\ + --disable-werror || ( cat config.log ; exit 1 ) \ +git add . \ +git commit -m "After xen configure" \ +%{nil} + +%define do_xen_pvh_configure() \ +%configure \\\ + %{cc_equals} \\\ + HOST_CFLAGS="%{3}" \\\ + HOST_CPPFLAGS="-I$(pwd)" \\\ + HOST_LDFLAGS="%{xen_pvh_host_ldflags}" \\\ + TARGET_CFLAGS="%{2}" \\\ + TARGET_CPPFLAGS="-I$(pwd)" \\\ + TARGET_LDFLAGS="%{xen_pvh_target_ldflags}" \\\ + --with-rpm-version=%{version}-%{release} \\\ + --with-platform=xen_pvh \\\ + --with-utils=host \\\ + --target=%{1} \\\ + --with-grubdir=grub2 \\\ + --program-transform-name=s,grub,grub2, \\\ + --disable-werror || ( cat config.log ; exit 1 ) \ +git add . \ +git commit -m "After xen_pvh configure" \ +%{nil} + %define do_efi_build_modules() \ make %{?_smp_mflags} ascii.h widthspec.h \ make %{?_smp_mflags} -C grub-core \ @@ -393,6 +496,16 @@ for x in grub-mkimage ; do \\\ done \ %{nil} +%define do_xen_build_modules() \ +make %{?_smp_mflags} ascii.h widthspec.h \ +make %{?_smp_mflags} -C grub-core \ +%{nil} + +%define do_xen_pvh_build_modules() \ +make %{?_smp_mflags} ascii.h widthspec.h \ +make %{?_smp_mflags} -C grub-core \ +%{nil} + %define do_install_protected_file() \ touch %{1}.conf \ echo %{1} > %{1}.conf \ @@ -563,6 +676,20 @@ make %{?_smp_mflags} -C grub-core \ cd .. \ %{nil} +%define do_xen_build() \ +cd grub-%{1}-%{tarversion} \ +%{expand:%%do_xen_configure %%{2} %%{3} %%{4}} \ +%do_xen_build_modules \ +cd .. \ +%{nil} + +%define do_xen_pvh_build() \ +cd grub-%{1}-%{tarversion} \ +%{expand:%%do_xen_pvh_configure %%{2} %%{3} %%{4}} \ +%do_xen_pvh_build_modules \ +cd .. \ +%{nil} + %define do_alt_efi_install() \ cd grub-%{1}-%{tarversion} \ install -d -m 755 $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \ @@ -660,6 +787,32 @@ fi \ cd .. \ %{nil} +%define do_xen_install() \ +cd grub-%{1}-%{tarversion} \ +make DESTDIR=$RPM_BUILD_ROOT install \ +if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \ + rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \ +fi \ +if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ + rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ +fi \ +find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \ +cd .. \ +%{nil} + +%define do_xen_pvh_install() \ +cd grub-%{1}-%{tarversion} \ +make DESTDIR=$RPM_BUILD_ROOT install \ +if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \ + rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \ +fi \ +if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \ + rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \ +fi \ +find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \ +cd .. \ +%{nil} + %define do_common_install() \ install -d -m 0755 \\\ $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\ @@ -746,3 +899,19 @@ ln -s ../boot/grub2/grub.cfg \\\ %attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \ %attr(0700,root,root)/boot/grub2/fonts \ %{nil} + +%define define_xen_variant_files() \ +%{expand:%%files %{1}-modules} \ +%defattr(-,root,root,-) \ +%dir %{_libdir}/grub/%{2}/ \ +%{_libdir}/grub/%{2}/* \ +%exclude %{_libdir}/grub/%{2}/*.module \ +%{nil} + +%define define_xen_pvh_variant_files() \ +%{expand:%%files %{1}-modules} \ +%defattr(-,root,root,-) \ +%dir %{_libdir}/grub/%{2}/ \ +%{_libdir}/grub/%{2}/* \ +%exclude %{_libdir}/grub/%{2}/*.module \ +%{nil} diff --git a/grub.patches b/grub.patches index 23f1ac19..ec798db4 100644 --- a/grub.patches +++ b/grub.patches @@ -277,3 +277,4 @@ Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch Patch0277: 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch Patch0278: 0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch Patch0279: 0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch +Patch0280: 0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch diff --git a/grub2.spec b/grub2.spec index 5c76835a..bdcdccd1 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -160,6 +160,12 @@ This subpackage provides tools for support of all platforms. %if 0%{with_legacy_arch} %{expand:%define_legacy_variant %%{legacy_package_arch}} %endif +%if 0%{with_xen_arch} +%{expand:%define_xen_variant %%{xen_package_arch} -o} +%endif +%if 0%{with_xen_pvh_arch} +%{expand:%define_xen_pvh_variant %%{xen_pvh_package_arch} -o} +%endif %if 0%{with_emu_arch} %package emu @@ -207,6 +213,22 @@ grep -A100000 '# stuff "make" creates' .gitignore > grub-emu-%{tarversion}/.giti cp %{SOURCE4} grub-emu-%{tarversion}/unifont.pcf.gz git add grub-emu-%{tarversion} %endif +%if 0%{with_xen_arch} +mkdir grub-%{grubxenarch}-%{tarversion} +grep -A100000 '# stuff "make" creates' .gitignore > grub-%{grubxenarch}-%{tarversion}/.gitignore +cp %{SOURCE4} grub-%{grubxenarch}-%{tarversion}/unifont.pcf.gz +sed -e "s,@@VERSION@@,%{version},g" -e "s,@@VERSION_RELEASE@@,%{version}-%{release},g" \ + %{SOURCE12} > grub-%{grubxenarch}-%{tarversion}/sbat.csv +git add grub-%{grubxenarch}-%{tarversion} +%endif +%if 0%{with_xen_pvh_arch} +mkdir grub-%{grubxenpvharch}-%{tarversion} +grep -A100000 '# stuff "make" creates' .gitignore > grub-%{grubxenpvharch}-%{tarversion}/.gitignore +cp %{SOURCE4} grub-%{grubxenpvharch}-%{tarversion}/unifont.pcf.gz +sed -e "s,@@VERSION@@,%{version},g" -e "s,@@VERSION_RELEASE@@,%{version}-%{release},g" \ + %{SOURCE12} > grub-%{grubxenpvharch}-%{tarversion}/sbat.csv +git add grub-%{grubxenpvharch}-%{tarversion} +%endif git commit -m "After making subdirs" %build @@ -222,6 +244,12 @@ git commit -m "After making subdirs" %if 0%{with_emu_arch} %{expand:%do_emu_build} %endif +%if 0%{with_xen_arch} +%{expand:%do_xen_build %%{grubxenarch} %%{_target_platform} %%{xen_target_cflags} %%{xen_host_cflags}} +%endif +%if 0%{with_xen_pvh_arch} +%{expand:%do_xen_pvh_build %%{grubxenpvharch} %%{_target_platform} %%{xen_pvh_target_cflags} %%{xen_pvh_host_cflags}} +%endif %ifarch ppc64le %{expand:%do_ieee1275_build_images %%{grublegacyarch} %{grubelfname} %{sb_cer} %{sb_key}} %endif @@ -251,6 +279,12 @@ rm -fr $RPM_BUILD_ROOT %if 0%{with_emu_arch} %{expand:%do_emu_install %%{package_arch}} %endif +%if 0%{with_xen_arch} +%{expand:%do_xen_install %%{grubxenarch}} +%endif +%if 0%{with_xen_pvh_arch} +%{expand:%do_xen_pvh_install %%{grubxenpvharch}} +%endif rm -f $RPM_BUILD_ROOT%{_infodir}/dir ln -s grub2-set-password ${RPM_BUILD_ROOT}/%{_sbindir}/grub2-setpassword echo '.so man8/grub2-set-password.8' > ${RPM_BUILD_ROOT}/%{_datadir}/man/man8/grub2-setpassword.8 @@ -550,6 +584,12 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %if 0%{with_legacy_arch} %{expand:%define_legacy_variant_files %%{legacy_package_arch} %%{grublegacyarch}} %endif +%if 0%{with_xen_arch} +%{expand:%define_xen_variant_files %%{xen_package_arch} %%{xen_grub_target_name}} +%endif +%if 0%{with_xen_pvh_arch} +%{expand:%define_xen_pvh_variant_files %%{xen_pvh_package_arch} %%{xen_pvh_grub_target_name}} +%endif %if 0%{with_emu_arch} %files emu @@ -562,6 +602,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Nov 20 2024 Nicolas Frayer 2.12-14 +- Build modules for Xen PV and PVH + * Fri Nov 15 2024 Nicolas Frayer 2.12-13 - posttrans: added check for efi_home/grub.cfg - Resolves: #2326502 From 5ce10e3473f03396c9f0af614b6a53ad462d4b8f Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Thu, 14 Nov 2024 22:49:18 +0100 Subject: [PATCH 249/294] Add riscv64 support Signed-off-by: Andrea Bolognani --- 0281-loader-efi-Fix-RISC-V-build.patch | 72 +++++++++++++++++++ ...nit-Use-time-register-in-grub_efi_ge.patch | 44 ++++++++++++ ...any-instead-of-large-model-for-RISCV.patch | 36 ++++++++++ grub.patches | 3 + grub2.spec | 5 +- 5 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 0281-loader-efi-Fix-RISC-V-build.patch create mode 100644 0282-kern-riscv-efi-init-Use-time-register-in-grub_efi_ge.patch create mode 100644 0283-Use-medany-instead-of-large-model-for-RISCV.patch diff --git a/0281-loader-efi-Fix-RISC-V-build.patch b/0281-loader-efi-Fix-RISC-V-build.patch new file mode 100644 index 00000000..91ccb602 --- /dev/null +++ b/0281-loader-efi-Fix-RISC-V-build.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Andrea Bolognani +Date: Tue, 19 Nov 2024 15:42:01 +0000 +Subject: [PATCH] loader/efi: Fix RISC-V build + +Some struct definitions are currently limited to 32-bit and +64-bit Arm architectures, but they actually apply to other +architectures as well, specifically 32-bit and 64-bit RISC-V +respectively. + +Update the preprocessor checks guarding their definition, and +change their names to make them more accurate by replacing the +word "arm" with the word "efi". + +Signed-off-by: Andrea Bolognani +--- + grub-core/loader/efi/linux.c | 2 +- + include/grub/efi/efi.h | 12 ++++++------ + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index 5889e3f36f8..ef55556f2d9 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -684,7 +684,7 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size, + grub_uint32_t *alignment, grub_uint32_t *code_size) + { + struct linux_arch_kernel_header *lh = kernel; +- struct grub_armxx_linux_pe_header *pe; ++ struct grub_efixx_linux_pe_header *pe; + grub_uint16_t i; + struct grub_pe32_section_table *sections; + +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 7eed1bd791d..81daf6bead1 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -36,28 +36,28 @@ struct linux_arch_kernel_header { + struct grub_pe_image_header pe_image_header; + }; + +-struct grub_arm_linux_pe_header ++struct grub_efi32_linux_pe_header + { + grub_uint32_t magic; + struct grub_pe32_coff_header coff; + struct grub_pe32_optional_header opt; + }; + +-struct grub_arm64_linux_pe_header ++struct grub_efi64_linux_pe_header + { + grub_uint32_t magic; + struct grub_pe32_coff_header coff; + struct grub_pe64_optional_header opt; + }; + +-#if defined(__arm__) ++#if defined(__arm__) || (defined(__riscv) && (__riscv_xlen == 32)) + # define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE32_MAGIC +-# define grub_armxx_linux_pe_header grub_arm_linux_pe_header ++# define grub_efixx_linux_pe_header grub_efi32_linux_pe_header + #endif + +-#if defined(__aarch64__) ++#if defined(__aarch64__) || (defined(__riscv) && (__riscv_xlen == 64)) + # define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE64_MAGIC +-# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header ++# define grub_efixx_linux_pe_header grub_efi64_linux_pe_header + #endif + + #define GRUB_EFI_GRUB_VARIABLE_GUID \ diff --git a/0282-kern-riscv-efi-init-Use-time-register-in-grub_efi_ge.patch b/0282-kern-riscv-efi-init-Use-time-register-in-grub_efi_ge.patch new file mode 100644 index 00000000..c38e333c --- /dev/null +++ b/0282-kern-riscv-efi-init-Use-time-register-in-grub_efi_ge.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Heinrich Schuchardt +Date: Mon, 12 Aug 2024 16:13:18 +0200 +Subject: [PATCH] kern/riscv/efi/init: Use time register in + grub_efi_get_time_ms() + +The cycle register is not guaranteed to count at constant frequency. +If it is counting at all depends on the state the performance monitoring +unit. Use the time register to measure time. + +Signed-off-by: Heinrich Schuchardt +Reviewed-by: Daniel Kiper +--- + grub-core/kern/riscv/efi/init.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/grub-core/kern/riscv/efi/init.c b/grub-core/kern/riscv/efi/init.c +index 38795fe6741..0d7de4f541a 100644 +--- a/grub-core/kern/riscv/efi/init.c ++++ b/grub-core/kern/riscv/efi/init.c +@@ -33,16 +33,15 @@ grub_efi_get_time_ms (void) + grub_uint64_t tmr; + + #if __riscv_xlen == 64 +- asm volatile ("rdcycle %0" : "=r" (tmr)); ++ asm volatile ("rdtime %0" : "=r"(tmr)); + #else + grub_uint32_t lo, hi, tmp; +- asm volatile ( +- "1:\n" +- "rdcycleh %0\n" +- "rdcycle %1\n" +- "rdcycleh %2\n" +- "bne %0, %2, 1b" +- : "=&r" (hi), "=&r" (lo), "=&r" (tmp)); ++ asm volatile ("1:\n" ++ "rdtimeh %0\n" ++ "rdtime %1\n" ++ "rdtimeh %2\n" ++ "bne %0, %2, 1b" ++ : "=&r" (hi), "=&r" (lo), "=&r" (tmp)); + tmr = ((grub_uint64_t)hi << 32) | lo; + #endif + diff --git a/0283-Use-medany-instead-of-large-model-for-RISCV.patch b/0283-Use-medany-instead-of-large-model-for-RISCV.patch new file mode 100644 index 00000000..37540c47 --- /dev/null +++ b/0283-Use-medany-instead-of-large-model-for-RISCV.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Montleon +Date: Fri, 3 May 2024 13:18:37 -0400 +Subject: [PATCH] Use medany instead of large model for RISCV + +Signed-off-by: Jason Montleon +--- + configure.ac | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 4788f3d6adc..a6a6957fbdb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1313,7 +1313,7 @@ AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) + + LDFLAGS="$TARGET_LDFLAGS" + +-if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 ; then ++if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 ; then + # Use large model to support 4G memory + AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ + CFLAGS="$TARGET_CFLAGS -mcmodel=large" +@@ -1323,9 +1323,11 @@ if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_ + ]) + if test "x$grub_cv_cc_mcmodel" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" +- elif test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64; then ++ elif test "$target_cpu" = sparc64; then + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany" + fi ++elif test "$target_cpu" = riscv64 ; then ++ TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany" + fi + + if test "$target_cpu"-"$platform" = x86_64-efi; then diff --git a/grub.patches b/grub.patches index ec798db4..45df8060 100644 --- a/grub.patches +++ b/grub.patches @@ -278,3 +278,6 @@ Patch0277: 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch Patch0278: 0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch Patch0279: 0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch Patch0280: 0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch +Patch0281: 0281-loader-efi-Fix-RISC-V-build.patch +Patch0282: 0282-kern-riscv-efi-init-Use-time-register-in-grub_efi_ge.patch +Patch0283: 0283-Use-medany-instead-of-large-model-for-RISCV.patch diff --git a/grub2.spec b/grub2.spec index bdcdccd1..01a889b4 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -602,6 +602,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Nov 21 2024 Andrea Bolognani 2.12-15 +- Add riscv64 support (thanks Jason Montleon) + * Wed Nov 20 2024 Nicolas Frayer 2.12-14 - Build modules for Xen PV and PVH From 0148405edfe1aafbda7284d10775379a0c5caf69 Mon Sep 17 00:00:00 2001 From: Marta Lewandowska Date: Wed, 27 Nov 2024 11:03:43 -0600 Subject: [PATCH 250/294] 99-grub-mkconfig.install: Disable BLS and run grub2-mkconfig when GRUB_ENABLE_BLSCFG is disable Resolves: #2325960 Signed-off-by: Marta Lewandowska Reviewed-by: Leo Sandoval --- 99-grub-mkconfig.install | 6 ++++++ grub2.spec | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index 1411f6ac..8048648c 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -4,6 +4,12 @@ if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then exit 0 fi +# Run grub2-mkconfig if ENABLE_BLSCFG is false +if grep -q '^GRUB_ENABLE_BLSCFG="*false"*\s*$' /etc/default/grub; then + RUN_MKCONFIG=true + DISABLE_BLS=true +fi + # PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support, # also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from # 10_linux. So BLS support needs to be disabled for both Xen Dom0 and DomU. diff --git a/grub2.spec b/grub2.spec index 01a889b4..3ed24660 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 15%{?dist} +Release: 16%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -602,6 +602,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Nov 27 2024 Marta Lewandowska - 2.12-16 +- 99-grub-mkconfig.install: Disable BLS and run grub2-mkconfig when GRUB_ENABLE_BLSCFG is disable +- Resolves: #2325960 + * Thu Nov 21 2024 Andrea Bolognani 2.12-15 - Add riscv64 support (thanks Jason Montleon) From 5c68e667c71cbab5ae9b850340b3cbc416dc1bf1 Mon Sep 17 00:00:00 2001 From: Marta Lewandowska Date: Wed, 27 Nov 2024 11:10:45 -0600 Subject: [PATCH 251/294] 99-grub-mkconfig.install: on PPC systems, remove petiboot's version checks On PPC systems, there is no need to check petiboot's version, so remove all related lines and unconditionally turn on the corresponding flag. Signed-off-by: Marta Lewandowska Reviewed-by: Leo Sandoval --- 99-grub-mkconfig.install | 21 +++------------------ grub2.spec | 5 ++++- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index 8048648c..a14f5fd8 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -21,25 +21,10 @@ if [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then fi ARCH=$(uname -m) -# Older ppc64le OPAL firmware (petitboot version < 1.8.0) don't have BLS support -# so grub2-mkconfig has to be run to generate a config with menuentry commands. +# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to be +# run to generate a config with menuentry commands. if [[ $ARCH = "ppc64le" ]] && [ -d /sys/firmware/opal ]; then - - petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" - - if test -e ${petitboot_path}; then - read -r -d '' petitboot_version < ${petitboot_path} - petitboot_version="$(echo ${petitboot_version//v})" - major_version="$(echo ${petitboot_version} | cut -d . -f1)" - minor_version="$(echo ${petitboot_version} | cut -d . -f2)" - - if test -z ${petitboot_version} || test ${major_version} -lt 1 || \ - test ${major_version} -eq 1 -a ${minor_version} -lt 8; then - RUN_MKCONFIG=true - fi - else - RUN_MKCONFIG=true - fi + RUN_MKCONFIG=true fi if [[ $DISABLE_BLS = "true" ]]; then diff --git a/grub2.spec b/grub2.spec index 3ed24660..55879ec3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 16%{?dist} +Release: 17%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -602,6 +602,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Nov 27 2024 Marta Lewandowska - 2.12-17 +- 99-grub-mkconfig.install: on PPC systems, remove petiboot's version checks + * Wed Nov 27 2024 Marta Lewandowska - 2.12-16 - 99-grub-mkconfig.install: Disable BLS and run grub2-mkconfig when GRUB_ENABLE_BLSCFG is disable - Resolves: #2325960 From 86c2c3cc6da0255bf19e3f9154781864016d6548 Mon Sep 17 00:00:00 2001 From: Peter Georg Date: Mon, 9 Dec 2024 21:57:30 +0100 Subject: [PATCH 252/294] Really allow xz'd symvers file Fixes: 78d64adfbe3cd089df8e41166c3688f026acdad1 Signed-off-by: Peter Georg --- 20-grub.install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/20-grub.install b/20-grub.install index d9d1d1d7..d5ab5875 100755 --- a/20-grub.install +++ b/20-grub.install @@ -96,12 +96,12 @@ case "$COMMAND" in command -v restorecon &>/dev/null && \ restorecon "/boot/symvers-${KERNEL_VERSION}.gz" fi - # symvers is symvers-.bz symlink, needs a special treatment - i="$KERNEL_DIR/symvers.bz" + # symvers is symvers-.xz symlink, needs a special treatment + i="$KERNEL_DIR/symvers.xz" if [[ -e "$i" ]]; then - ln -fs "$i" "/boot/symvers-${KERNEL_VERSION}.bz" + ln -fs "$i" "/boot/symvers-${KERNEL_VERSION}.xz" command -v restorecon &>/dev/null && \ - restorecon "/boot/symvers-${KERNEL_VERSION}.bz" + restorecon "/boot/symvers-${KERNEL_VERSION}.xz" fi fi From 0083b9609af3989a23943df6c2d03ba7e332dd21 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 19 Dec 2024 10:20:31 +0100 Subject: [PATCH 253/294] add bli (boot loader info) module to efi modules Signed-off-by: Gerd Hoffmann --- grub.macros | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index ba7ff0f5..417b3649 100644 --- a/grub.macros +++ b/grub.macros @@ -140,7 +140,7 @@ %{?with_efi_only:%global without_efi_only 1} %ifarch %{efi_arch} -%global efi_modules " efi_netfs efifwsetup efinet lsefi lsefimmap connectefi " +%global efi_modules " efi_netfs efifwsetup efinet lsefi lsefimmap connectefi bli " %endif %global xen_arch x86_64 From cd9f78bd4d7806cf8a8565a9466cfc687149c3c3 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Thu, 9 Jan 2025 17:15:07 +0100 Subject: [PATCH 254/294] fs/xfs: fix large extent counters incompat feature support Signed-off-by: Nicolas Frayer --- ...-extent-counters-incompat-feature-su.patch | 44 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 0284-fs-xfs-Fix-large-extent-counters-incompat-feature-su.patch diff --git a/0284-fs-xfs-Fix-large-extent-counters-incompat-feature-su.patch b/0284-fs-xfs-Fix-large-extent-counters-incompat-feature-su.patch new file mode 100644 index 00000000..ba641630 --- /dev/null +++ b/0284-fs-xfs-Fix-large-extent-counters-incompat-feature-su.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Wed, 4 Dec 2024 07:50:28 -0600 +Subject: [PATCH] fs/xfs: fix large extent counters incompat feature support + +When large extent counter / NREXT64 support was added to grub, it missed +a couple of direct reads of nextents which need to be changed to the new +NREXT64-aware helper as well. Without this, we'll have mis-reads of some +directories with this feature enabled. + +(The large extent counter fix likely raced on merge with +07318ee7e ("fs/xfs: Fix XFS directory extent parsing") which added the new +direct nextents reads just prior, causing this issue.) + +Fixes: aa7c1322671e ("fs/xfs: Add large extent counters incompat feature support") +Signed-off-by: Eric Sandeen +Reviewed-by: Anthony Iliopoulos +Reviewed-by: Jon DeVree +--- + grub-core/fs/xfs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 8e02ab4a3014..92046f9bdf49 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -926,7 +926,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + * Leaf and tail information are only in the data block if the number + * of extents is 1. + */ +- if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) ++ if (grub_xfs_get_inode_nextents(&dir->inode) == 1) + { + struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock); + +@@ -980,7 +980,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, + * The expected number of directory entries is only tracked for the + * single extent case. + */ +- if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1)) ++ if (grub_xfs_get_inode_nextents(&dir->inode) == 1) + { + /* Check if last direntry in this block is reached. */ + entries--; diff --git a/grub.patches b/grub.patches index 45df8060..bec34840 100644 --- a/grub.patches +++ b/grub.patches @@ -281,3 +281,4 @@ Patch0280: 0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch Patch0281: 0281-loader-efi-Fix-RISC-V-build.patch Patch0282: 0282-kern-riscv-efi-init-Use-time-register-in-grub_efi_ge.patch Patch0283: 0283-Use-medany-instead-of-large-model-for-RISCV.patch +Patch0284: 0284-fs-xfs-Fix-large-extent-counters-incompat-feature-su.patch diff --git a/grub2.spec b/grub2.spec index 55879ec3..1467c697 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 17%{?dist} +Release: 18%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -602,6 +602,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Jan 9 2025 Nicolas Frayer - 2.12-18 +- fs/xfs: fix large extent counters incompat feature support + * Wed Nov 27 2024 Marta Lewandowska - 2.12-17 - 99-grub-mkconfig.install: on PPC systems, remove petiboot's version checks From 40c3b05654e7f4389f9b2c8e1d41a3eac77e4207 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Mon, 13 Jan 2025 18:50:21 -0600 Subject: [PATCH 255/294] term/nns8250-spcr: return if redirection is disabled Signed-off-by: Leo Sandoval --- ...cr-return-if-redirection-is-disabled.patch | 34 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch diff --git a/0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch b/0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch new file mode 100644 index 00000000..4e5cdc1c --- /dev/null +++ b/0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Herrenschmidt +Date: Thu, 16 Jan 2025 10:22:48 -0600 +Subject: [PATCH] term/nns8250-spcr: return if redirection is disabled + +The Microsoft spec for SPCR says "The base address of the Serial Port register +set described using the ACPI Generic Address Structure, or 0 if console +redirection is disabled." so return if disable (base address = 0). If this check +is not done, we may get invalid ports for those particular machines that +redirection is disabled and at some point hanging the booting execution when +reading the grub.cfg configuration file. + +Signed-off-by: Benjamin Herrenschmidt +Reviewed-by: Leo Sandoval +--- + grub-core/term/ns8250-spcr.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/grub-core/term/ns8250-spcr.c b/grub-core/term/ns8250-spcr.c +index d52b52c26..86f1aa078 100644 +--- a/grub-core/term/ns8250-spcr.c ++++ b/grub-core/term/ns8250-spcr.c +@@ -75,6 +75,11 @@ grub_ns8250_spcr_init (void) + config.speed = 115200; + break; + }; ++ ++ /* if base address is 0, it means redirection is disable, so return it */ ++ if (spcr->base_addr.addr == 0) ++ return NULL; ++ + switch (spcr->base_addr.space_id) + { + case GRUB_ACPI_GENADDR_MEM_SPACE: diff --git a/grub.patches b/grub.patches index bec34840..8c659db2 100644 --- a/grub.patches +++ b/grub.patches @@ -282,3 +282,4 @@ Patch0281: 0281-loader-efi-Fix-RISC-V-build.patch Patch0282: 0282-kern-riscv-efi-init-Use-time-register-in-grub_efi_ge.patch Patch0283: 0283-Use-medany-instead-of-large-model-for-RISCV.patch Patch0284: 0284-fs-xfs-Fix-large-extent-counters-incompat-feature-su.patch +Patch0285: 0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch \ No newline at end of file diff --git a/grub2.spec b/grub2.spec index 1467c697..2ba6bb63 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 18%{?dist} +Release: 19%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -602,6 +602,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Mon Jan 13 2025 Leo Sandoval 2.12-19 +- term/nns8250-spcr: return if redirection is disabled + * Thu Jan 9 2025 Nicolas Frayer - 2.12-18 - fs/xfs: fix large extent counters incompat feature support From 5ad3db94861fd165d88dcf9cdbaff40309100852 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Wed, 22 Jan 2025 14:36:40 -0600 Subject: [PATCH 256/294] fix pending SAST issues Related: #RHEL-50504 Signed-off-by: Leo Sandoval --- ...s-legacycfg-Avoid-closing-file-twice.patch | 37 +++++++++++++++++++ ...ove-conditional-operator-for-endtime.patch | 27 ++++++++++++++ grub.patches | 4 +- grub2.spec | 6 ++- 4 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 0286-commands-legacycfg-Avoid-closing-file-twice.patch create mode 100644 0287-disk-ahci.c-remove-conditional-operator-for-endtime.patch diff --git a/0286-commands-legacycfg-Avoid-closing-file-twice.patch b/0286-commands-legacycfg-Avoid-closing-file-twice.patch new file mode 100644 index 00000000..2e126ab3 --- /dev/null +++ b/0286-commands-legacycfg-Avoid-closing-file-twice.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 16 Oct 2024 11:54:38 -0600 +Subject: [PATCH] commands/legacycfg: Avoid closing file twice + +An internal (at Red Hat) static soure code scan detected an +use-after-free scenario: + + Error: USE_AFTER_FREE (CWE-416): + grub-2.06/grub-core/commands/legacycfg.c:194: freed_arg: "grub_file_close" frees "file". + grub-2.06/grub-core/commands/legacycfg.c:201: deref_arg: Calling "grub_file_close" dereferences freed pointer "file". + # 199| if (!args) + # 200| { + # 201|-> grub_file_close (file); + # 202| grub_free (suffix); + # 203| grub_free (entrysrc); + +So, remove the extra file close call. + +Signed-off-by: Leo Sandoval +Reviewed-by: Daniel Kiper +--- + grub-core/commands/legacycfg.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c +index 2c5d1a0ef..86bcda695 100644 +--- a/grub-core/commands/legacycfg.c ++++ b/grub-core/commands/legacycfg.c +@@ -198,7 +198,6 @@ legacy_file (const char *filename) + const char **args = grub_malloc (sizeof (args[0])); + if (!args) + { +- grub_file_close (file); + grub_free (suffix); + grub_free (entrysrc); + return grub_errno; diff --git a/0287-disk-ahci.c-remove-conditional-operator-for-endtime.patch b/0287-disk-ahci.c-remove-conditional-operator-for-endtime.patch new file mode 100644 index 00000000..759cd4f9 --- /dev/null +++ b/0287-disk-ahci.c-remove-conditional-operator-for-endtime.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 22 Jan 2025 13:37:42 -0600 +Subject: [PATCH] disk/ahci.c: remove conditional operator for endtime + +The conditional makes no sense when the two possible expressions have the same +value, so remove it (perhaps the compiler does it for us but better to remove +it). + +Signed-off-by: Leo Sandoval +--- + grub-core/disk/ahci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c +index e7b5dc5f2..b247161b9 100644 +--- a/grub-core/disk/ahci.c ++++ b/grub-core/disk/ahci.c +@@ -1038,7 +1038,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, + grub_dprintf ("ahci", "AHCI tfd = %x\n", + dev->hba->ports[dev->port].task_file_data); + +- endtime = grub_get_time_ms () + (spinup ? 20000 : 20000); ++ endtime = grub_get_time_ms () + 20000; + while ((dev->hba->ports[dev->port].command_issue & 1)) + if (grub_get_time_ms () > endtime || + (dev->hba->ports[dev->port].intstatus & GRUB_AHCI_HBA_PORT_IS_FATAL_MASK)) diff --git a/grub.patches b/grub.patches index 8c659db2..18818609 100644 --- a/grub.patches +++ b/grub.patches @@ -282,4 +282,6 @@ Patch0281: 0281-loader-efi-Fix-RISC-V-build.patch Patch0282: 0282-kern-riscv-efi-init-Use-time-register-in-grub_efi_ge.patch Patch0283: 0283-Use-medany-instead-of-large-model-for-RISCV.patch Patch0284: 0284-fs-xfs-Fix-large-extent-counters-incompat-feature-su.patch -Patch0285: 0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch \ No newline at end of file +Patch0285: 0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch +Patch0286: 0286-commands-legacycfg-Avoid-closing-file-twice.patch +Patch0287: 0287-disk-ahci.c-remove-conditional-operator-for-endtime.patch \ No newline at end of file diff --git a/grub2.spec b/grub2.spec index 2ba6bb63..081b321e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 19%{?dist} +Release: 20%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -602,6 +602,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Wed Jan 22 2025 Leo Sandoval 2.12-20 +- fix pending SAST issues +- Related: #RHEL-50504 + * Mon Jan 13 2025 Leo Sandoval 2.12-19 - term/nns8250-spcr: return if redirection is disabled From 60fc42215c66c26657581ca2bac0da40d2b4883b Mon Sep 17 00:00:00 2001 From: josef radinger Date: Sun, 19 Jan 2025 19:41:52 +0000 Subject: [PATCH 257/294] Update 0055-Add-grub2-switch-to-blscfg.patch fix small typo, which is visible in the Description in man page signed-off-by: josef radinger --- 0055-Add-grub2-switch-to-blscfg.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0055-Add-grub2-switch-to-blscfg.patch b/0055-Add-grub2-switch-to-blscfg.patch index cb97a284..76732205 100644 --- a/0055-Add-grub2-switch-to-blscfg.patch +++ b/0055-Add-grub2-switch-to-blscfg.patch @@ -129,7 +129,7 @@ index 00000000000..a851424beb2 +# Print the usage. +usage () { + gettext_printf "Usage: %s\n" "$self" -+ gettext "Switch to BLS config files.\n"; echo ++ gettext "Switch to BLS config files."; echo + echo + print_option_help "-h, --help" "$(gettext "print this message and exit")" + print_option_help "-V, --version" "$(gettext "print the version information and exit")" From 20db2b22d863543f0f31b4c54cc7e65923473f62 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 28 Jan 2025 18:21:48 +0100 Subject: [PATCH 258/294] commands/bli: Fix crash in get_part_uuid() Resolves: #2339164 Signed-off-by: Nicolas Frayer --- ...mands-bli-Fix-crash-in-get_part_uuid.patch | 80 +++++++++++++++++++ grub.patches | 3 +- grub2.spec | 6 +- 3 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 0288-commands-bli-Fix-crash-in-get_part_uuid.patch diff --git a/0288-commands-bli-Fix-crash-in-get_part_uuid.patch b/0288-commands-bli-Fix-crash-in-get_part_uuid.patch new file mode 100644 index 00000000..fe26cecb --- /dev/null +++ b/0288-commands-bli-Fix-crash-in-get_part_uuid.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Wed, 17 Jul 2024 14:46:46 +0800 +Subject: [PATCH] commands/bli: Fix crash in get_part_uuid() + +The get_part_uuid() function made an assumption that the target GRUB +device is a partition device and accessed device->disk->partition +without checking for NULL. There are four situations where this +assumption is problematic: + +1. The device is a net device instead of a disk. +2. The device is an abstraction device, like LVM, RAID, or CRYPTO, which + is mostly logical "disk" ((lvmid/) and so on). +3. Firmware RAID may present the ESP to GRUB as an EFI disk (hd0) device + if it is contained within a Linux software RAID. +4. When booting from a CD-ROM, the ESP is a VFAT image indexed by the El + Torito boot catalog. The boot device is set to (cd0), corresponding + to the CD-ROM image mounted as an ISO 9660 filesystem. + +As a result, get_part_uuid() could lead to a NULL pointer dereference +and trigger a synchronous exception during boot if the ESP falls into +one of these categories. This patch fixes the problem by adding the +necessary checks to handle cases where the ESP is not a partition device. + +Additionally, to avoid disrupting the boot process, this patch relaxes +the severity of the errors in this context to non-critical. Errors will +be logged, but they will not prevent the boot process from continuing. + +Fixes: e0fa7dc84 (bli: Add a module for the Boot Loader Interface) + +Signed-off-by: Michael Chang +Reviewed-By: Oliver Steffen +Reviewed-by: Daniel Kiper +--- + grub-core/commands/bli.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/bli.c b/grub-core/commands/bli.c +index e0d8a54f7bea..298c5f70a876 100644 +--- a/grub-core/commands/bli.c ++++ b/grub-core/commands/bli.c +@@ -48,6 +48,22 @@ get_part_uuid (const char *device_name, char **part_uuid) + if (device == NULL) + return grub_error (grub_errno, N_("cannot open device: %s"), device_name); + ++ if (device->disk == NULL) ++ { ++ grub_dprintf ("bli", "%s is not a disk device, partuuid skipped\n", device_name); ++ *part_uuid = NULL; ++ grub_device_close (device); ++ return GRUB_ERR_NONE; ++ } ++ ++ if (device->disk->partition == NULL) ++ { ++ grub_dprintf ("bli", "%s has no partition, partuuid skipped\n", device_name); ++ *part_uuid = NULL; ++ grub_device_close (device); ++ return GRUB_ERR_NONE; ++ } ++ + disk = grub_disk_open (device->disk->name); + if (disk == NULL) + { +@@ -99,7 +115,7 @@ set_loader_device_part_uuid (void) + + status = get_part_uuid (device_name, &part_uuid); + +- if (status == GRUB_ERR_NONE) ++ if (status == GRUB_ERR_NONE && part_uuid) + status = grub_efi_set_variable_to_string ("LoaderDevicePartUUID", &bli_vendor_guid, part_uuid, + GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS | + GRUB_EFI_VARIABLE_RUNTIME_ACCESS); +@@ -117,4 +133,6 @@ GRUB_MOD_INIT (bli) + GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS | + GRUB_EFI_VARIABLE_RUNTIME_ACCESS); + set_loader_device_part_uuid (); ++ /* No error here is critical, other than being logged */ ++ grub_print_error (); + } diff --git a/grub.patches b/grub.patches index 18818609..2cd34418 100644 --- a/grub.patches +++ b/grub.patches @@ -284,4 +284,5 @@ Patch0283: 0283-Use-medany-instead-of-large-model-for-RISCV.patch Patch0284: 0284-fs-xfs-Fix-large-extent-counters-incompat-feature-su.patch Patch0285: 0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch Patch0286: 0286-commands-legacycfg-Avoid-closing-file-twice.patch -Patch0287: 0287-disk-ahci.c-remove-conditional-operator-for-endtime.patch \ No newline at end of file +Patch0287: 0287-disk-ahci.c-remove-conditional-operator-for-endtime.patch +Patch0288: 0288-commands-bli-Fix-crash-in-get_part_uuid.patch diff --git a/grub2.spec b/grub2.spec index 081b321e..d8499ae7 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 20%{?dist} +Release: 21%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -602,6 +602,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Jan 28 2025 Nicolas Frayer 2.12-21 +- commands/bli: Fix crash in get_part_uuid() +- Resolves: #2339164 + * Wed Jan 22 2025 Leo Sandoval 2.12-20 - fix pending SAST issues - Related: #RHEL-50504 From a60abb0cdcbf28619ffd9f40e520e289f74bd373 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 4 Feb 2025 15:10:22 +0100 Subject: [PATCH 259/294] Phase 1 of the bootloader updates proposal implementation https://fedoraproject.org/wiki/Changes/BootLoaderUpdatesPhase1 Signed-off-by: Marta Lewandoska Signed-off-by: Nicolas Frayer Signed-off-by: Leo Sandoval --- grub.macros | 24 ++++++++++++++++-------- grub2.spec | 18 ++++++++++++++---- install_bootloader | 11 +++++++++++ 3 files changed, 41 insertions(+), 12 deletions(-) create mode 100755 install_bootloader diff --git a/grub.macros b/grub.macros index 417b3649..ec5f08c3 100644 --- a/grub.macros +++ b/grub.macros @@ -1,6 +1,10 @@ # vim:filetype=spec # Modules always contain just 32-bit code +%global efidir %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')) %global _libdir %{_exec_prefix}/lib +%global grub_root_dir %{_libdir}/grub2 +%global grub_version_dir %{grub_root_dir}/%{version}-%{release} +%global grub_efi_dir %{grub_version_dir}/EFI/%{efidir} %global _binaries_in_noarch_packages_terminate_build 0 #%%undefine _missing_build_ids_terminate_build %{expand:%%{!?buildsubdir:%%global buildsubdir grub-%{tarversion}}} @@ -704,8 +708,9 @@ find . '(' -iname gdb_grub \\\ ')' \\\ -exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \ find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \ -install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ -install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ +install -m 700 %{2} $RPM_BUILD_ROOT%{grub_efi_dir}/%{2} \ +install -m 700 %{3} $RPM_BUILD_ROOT%{grub_efi_dir}/%{3} \ +install -m 0755 %{SOURCE21} $RPM_BUILD_ROOT%{_prefix}/lib/bootloader/ \ %{expand:%%do_install_protected_file grub2-%{alt_package_arch}} \ cd .. \ %{nil} @@ -722,8 +727,9 @@ fi \ find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \ ln -s ../boot/grub2/grub.cfg \\\ $RPM_BUILD_ROOT%{_sysconfdir}/grub2-efi.cfg \ -install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ -install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ +install -m 700 %{2} $RPM_BUILD_ROOT%{grub_efi_dir}/%{2} \ +install -m 700 %{3} $RPM_BUILD_ROOT%{grub_efi_dir}/%{3} \ +install -m 0755 %{SOURCE21} $RPM_BUILD_ROOT%{_prefix}/lib/bootloader/ \ %ifarch %{arm} \ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ %endif \ @@ -823,7 +829,8 @@ cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/grub2.info \ cp docs/grub-dev.info \\\ $RPM_BUILD_ROOT%{_infodir}/grub2-dev.info \ -install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \ +install -d -m 0700 ${RPM_BUILD_ROOT}%{grub_efi_dir}/ \ +install -D -d -m 0700 $RPM_BUILD_ROOT%{_prefix}/lib/bootloader/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/themes/system \ @@ -871,14 +878,15 @@ ln -s ../boot/grub2/grub.cfg \\\ %defattr(-,root,root,-) \ %config(noreplace) %{_sysconfdir}/grub2.cfg \ %config(noreplace) %{_sysconfdir}/grub2-efi.cfg \ -%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{2} \ +%attr(0700,root,root) %verify(not mtime) %{grub_efi_dir}/%{2} \ +%{_prefix}/lib/bootloader/install_bootloader \ %ifarch %{arm} \ %attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \ %endif \ %attr(0700,root,root)/boot/grub2/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0600,root,root)/boot/grub2/grub.cfg \ -%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ +%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{grub_efi_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ @@ -896,7 +904,7 @@ ln -s ../boot/grub2/grub.cfg \\\ \ %{expand:%%files %{1}-cdboot} \ %defattr(-,root,root,-) \ -%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \ +%attr(0700,root,root) %verify(not mtime) %{grub_efi_dir}/%{3} \ %attr(0700,root,root)/boot/grub2/fonts \ %{nil} diff --git a/grub2.spec b/grub2.spec index d8499ae7..5f55cb78 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 21%{?dist} +Release: 22%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -35,6 +35,7 @@ Source9: strtoull_test.c Source10: 20-grub.install Source11: grub.patches Source12: sbat.csv.in +Source21: install_bootloader %include %{SOURCE1} @@ -382,7 +383,7 @@ fi %posttrans common set -eu -EFI_HOME=%{efi_esp_dir} +EFI_HOME=%{grub_efi_dir} GRUB_HOME=/boot/grub2 ESP_PATH=/boot/efi @@ -426,6 +427,11 @@ fi mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg +%if 0%{with_efi_arch} +%posttrans efi-%{efiarch} +/usr/lib/bootloader/install_bootloader %{grub_efi_dir} %{efi_esp_dir} +%endif + %files common -f grub.lang %dir %{_libdir}/grub/ %dir %{_datarootdir}/grub/ @@ -439,8 +445,8 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %dir /boot/grub2/themes/system %attr(0700,root,root) %dir /boot/grub2 %exclude /boot/grub2/* -%dir %attr(0700,root,root) %{efi_esp_dir} -%exclude %{efi_esp_dir}/* +%dir %attr(0700,root,root) %{grub_version_dir} +%exclude %{grub_version_dir}/* %ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv %license COPYING %doc THANKS @@ -602,6 +608,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Feb 4 2025 Marta Lewandowska - 2.12-22 +- Phase 1 of the bootloader updates proposal implementation +- https://fedoraproject.org/wiki/Changes/BootLoaderUpdatesPhase1 + * Tue Jan 28 2025 Nicolas Frayer 2.12-21 - commands/bli: Fix crash in get_part_uuid() - Resolves: #2339164 diff --git a/install_bootloader b/install_bootloader new file mode 100755 index 00000000..1560e8b0 --- /dev/null +++ b/install_bootloader @@ -0,0 +1,11 @@ +#!/bin/bash + +if [[ $# -lt 2 ]]; then + echo "usage: $0 from_dir efi_dir" + exit 1 +fi + +from_dir=${1} +efi_dir=${2} + +cp ${from_dir}/* ${efi_dir}/ From ecd705e766c25c9150ce2e7afd72e67164ddcee4 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 7 Feb 2025 15:43:55 -0800 Subject: [PATCH 260/294] Ensure all scriptlets always exit 0, per guidelines Fedora package scriptlets are required to always exit 0. grub2's do not currently ensure this, and especially the new %posttrans scriptlet for grub2-efi actually exits non-zero during ostree builds, causing them to fail: https://bodhi.fedoraproject.org/updates/FEDORA-2025-5a25808a78#comment-3947404 This should fix that, and also make sure we never get the same problem with the other scriptlets in the package. Signed-off-by: Adam Williamson --- grub2.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/grub2.spec b/grub2.spec index 5f55cb78..d55f9d13 100644 --- a/grub2.spec +++ b/grub2.spec @@ -365,6 +365,8 @@ elif [ -f /etc/grub.d/01_users ] && \ > /boot/grub2/user.cfg fi fi +# ensure we exit 0 +: %post tools %systemd_user_post grub-boot-success.timer @@ -425,11 +427,12 @@ if test -f ${EFI_HOME}/grubenv; then mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv fi -mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg +# ensure we exit 0 +mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %if 0%{with_efi_arch} %posttrans efi-%{efiarch} -/usr/lib/bootloader/install_bootloader %{grub_efi_dir} %{efi_esp_dir} +/usr/lib/bootloader/install_bootloader %{grub_efi_dir} %{efi_esp_dir} || : %endif %files common -f grub.lang From d03bbec7353787233039acc57fa9e8039f32a10e Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 11 Feb 2025 16:10:24 +0100 Subject: [PATCH 261/294] Revert "Phase 1 of the bootloader updates proposal implementation" This reverts commit a60abb0cdcbf28619ffd9f40e520e289f74bd373. Revert as not all components are ready for this change. Signed-off-by: Nicolas Frayer --- grub.macros | 24 ++++++++---------------- grub2.spec | 17 +++++++---------- install_bootloader | 11 ----------- 3 files changed, 15 insertions(+), 37 deletions(-) delete mode 100755 install_bootloader diff --git a/grub.macros b/grub.macros index ec5f08c3..417b3649 100644 --- a/grub.macros +++ b/grub.macros @@ -1,10 +1,6 @@ # vim:filetype=spec # Modules always contain just 32-bit code -%global efidir %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')) %global _libdir %{_exec_prefix}/lib -%global grub_root_dir %{_libdir}/grub2 -%global grub_version_dir %{grub_root_dir}/%{version}-%{release} -%global grub_efi_dir %{grub_version_dir}/EFI/%{efidir} %global _binaries_in_noarch_packages_terminate_build 0 #%%undefine _missing_build_ids_terminate_build %{expand:%%{!?buildsubdir:%%global buildsubdir grub-%{tarversion}}} @@ -708,9 +704,8 @@ find . '(' -iname gdb_grub \\\ ')' \\\ -exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \ find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \ -install -m 700 %{2} $RPM_BUILD_ROOT%{grub_efi_dir}/%{2} \ -install -m 700 %{3} $RPM_BUILD_ROOT%{grub_efi_dir}/%{3} \ -install -m 0755 %{SOURCE21} $RPM_BUILD_ROOT%{_prefix}/lib/bootloader/ \ +install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ +install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ %{expand:%%do_install_protected_file grub2-%{alt_package_arch}} \ cd .. \ %{nil} @@ -727,9 +722,8 @@ fi \ find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \ ln -s ../boot/grub2/grub.cfg \\\ $RPM_BUILD_ROOT%{_sysconfdir}/grub2-efi.cfg \ -install -m 700 %{2} $RPM_BUILD_ROOT%{grub_efi_dir}/%{2} \ -install -m 700 %{3} $RPM_BUILD_ROOT%{grub_efi_dir}/%{3} \ -install -m 0755 %{SOURCE21} $RPM_BUILD_ROOT%{_prefix}/lib/bootloader/ \ +install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ +install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ %ifarch %{arm} \ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ %endif \ @@ -829,8 +823,7 @@ cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/grub2.info \ cp docs/grub-dev.info \\\ $RPM_BUILD_ROOT%{_infodir}/grub2-dev.info \ -install -d -m 0700 ${RPM_BUILD_ROOT}%{grub_efi_dir}/ \ -install -D -d -m 0700 $RPM_BUILD_ROOT%{_prefix}/lib/bootloader/ \ +install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/themes/system \ @@ -878,15 +871,14 @@ ln -s ../boot/grub2/grub.cfg \\\ %defattr(-,root,root,-) \ %config(noreplace) %{_sysconfdir}/grub2.cfg \ %config(noreplace) %{_sysconfdir}/grub2-efi.cfg \ -%attr(0700,root,root) %verify(not mtime) %{grub_efi_dir}/%{2} \ -%{_prefix}/lib/bootloader/install_bootloader \ +%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{2} \ %ifarch %{arm} \ %attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \ %endif \ %attr(0700,root,root)/boot/grub2/fonts \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0600,root,root)/boot/grub2/grub.cfg \ -%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{grub_efi_dir}/grub.cfg \ +%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ @@ -904,7 +896,7 @@ ln -s ../boot/grub2/grub.cfg \\\ \ %{expand:%%files %{1}-cdboot} \ %defattr(-,root,root,-) \ -%attr(0700,root,root) %verify(not mtime) %{grub_efi_dir}/%{3} \ +%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \ %attr(0700,root,root)/boot/grub2/fonts \ %{nil} diff --git a/grub2.spec b/grub2.spec index d55f9d13..852a6783 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 22%{?dist} +Release: 23%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -35,7 +35,6 @@ Source9: strtoull_test.c Source10: 20-grub.install Source11: grub.patches Source12: sbat.csv.in -Source21: install_bootloader %include %{SOURCE1} @@ -385,7 +384,7 @@ fi %posttrans common set -eu -EFI_HOME=%{grub_efi_dir} +EFI_HOME=%{efi_esp_dir} GRUB_HOME=/boot/grub2 ESP_PATH=/boot/efi @@ -430,11 +429,6 @@ fi # ensure we exit 0 mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : -%if 0%{with_efi_arch} -%posttrans efi-%{efiarch} -/usr/lib/bootloader/install_bootloader %{grub_efi_dir} %{efi_esp_dir} || : -%endif - %files common -f grub.lang %dir %{_libdir}/grub/ %dir %{_datarootdir}/grub/ @@ -448,8 +442,8 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %dir /boot/grub2/themes/system %attr(0700,root,root) %dir /boot/grub2 %exclude /boot/grub2/* -%dir %attr(0700,root,root) %{grub_version_dir} -%exclude %{grub_version_dir}/* +%dir %attr(0700,root,root) %{efi_esp_dir} +%exclude %{efi_esp_dir}/* %ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv %license COPYING %doc THANKS @@ -611,6 +605,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Tue Feb 11 2025 Nicolas Frayer 2.12-23 +- Revert commit for bootloader update proposal for now as not all components are ready + * Tue Feb 4 2025 Marta Lewandowska - 2.12-22 - Phase 1 of the bootloader updates proposal implementation - https://fedoraproject.org/wiki/Changes/BootLoaderUpdatesPhase1 diff --git a/install_bootloader b/install_bootloader deleted file mode 100755 index 1560e8b0..00000000 --- a/install_bootloader +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -if [[ $# -lt 2 ]]; then - echo "usage: $0 from_dir efi_dir" - exit 1 -fi - -from_dir=${1} -efi_dir=${2} - -cp ${from_dir}/* ${efi_dir}/ From 5427c3632868bc051345101af544c831c4619dcd Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Thu, 13 Feb 2025 11:35:06 -0600 Subject: [PATCH 262/294] Add Several CVE fixes Resolves: CVE-2024-45781 CVE-2024-45783 CVE-2024-45778 Resolves: CVE-2024-45775 CVE-2024-45780 CVE-2024-45774 Resolves: CVE-2025-0690 CVE-2025-1118 CVE-2024-45782 Resolves: CVE-2025-0624 CVE-2024-45779 CVE-2024-45776 Resolves: CVE-2025-0622 CVE-2025-0677 Signed-off-by: Leo Sandoval --- 0289-misc-Implement-grub_strlcpy.patch | 65 +++ 0290-fs-ufs-Fix-a-heap-OOB-write.patch | 31 + ...Fix-stack-OOB-write-with-grub_strcpy.patch | 31 + ...itialize-name-in-grub_cpio_find_file.patch | 40 ++ ...ger-overflow-leads-to-heap-OOB-write.patch | 89 +++ ...f2fs-Set-a-grub_errno-if-mount-fails.patch | 31 + ...plus-Set-a-grub_errno-if-mount-fails.patch | 35 ++ ...9660-Set-a-grub_errno-if-mount-fails.patch | 33 ++ 0297-fs-iso9660-Fix-invalid-free.patch | 50 ++ 0298-fs-jfs-Fix-OOB-read-in-jfs_getent.patch | 63 ++ ...ead-caused-by-invalid-dir-slot-index.patch | 64 +++ ...40-bits-offset-and-address-for-a-dat.patch | 128 +++++ ...ent-signed-unsigned-types-usage-in-r.patch | 85 +++ ...ut-of-bounds-read-for-inline-extents.patch | 46 ++ 0303-fs-ntfs-Fix-out-of-bounds-read.patch | 47 ++ ...-the-end-of-the-MFT-attribute-buffer.patch | 141 +++++ ...helper-function-to-access-attributes.patch | 183 ++++++ ...tfs-Implement-attribute-verification.patch | 245 ++++++++ 0307-fs-xfs-Fix-out-of-bounds-read.patch | 43 ++ ...g-failing-to-mount-sets-a-grub_errno.patch | 42 ++ 0309-kern-file-Ensure-file-data-is-set.patch | 32 ++ ...lement-filesystem-reference-counting.patch | 440 ++++++++++++++ ...ld-option-to-block-command-line-inte.patch | 366 ++++++++++++ ...Require-authentication-after-TPM-unl.patch | 337 +++++++++++ ...-Reference-tracking-for-the-loopback.patch | 108 ++++ 0314-kern-disk-Limit-recursion-depth.patch | 120 ++++ ...tion-Limit-recursion-in-part_iterate.patch | 44 ++ ...pt-execute-Limit-the-recursion-depth.patch | 55 ++ ...et_default_ip-and-net_default_mac-va.patch | 29 + ...bles-hooks-when-interface-is-unregis.patch | 84 +++ ...write-in-grub_net_search_config_file.patch | 79 +++ ...x-stack-buffer-overflow-in-tftp_open.patch | 115 ++++ ...eg-Do-not-permit-duplicate-SOF0-mark.patch | 33 ++ ...r-an-integer-overflow-in-grub_dl_ref.patch | 138 +++++ ...r-the-SHF_INFO_LINK-flag-in-grub_dl_.patch | 34 ++ ...-Missing-check-for-failed-allocation.patch | 34 ++ 0325-commands-ls-Fix-NULL-dereference.patch | 32 ++ ...egister-the-check_signatures-hooks-o.patch | 31 + ...ove-variables-hooks-on-module-unload.patch | 37 ++ ...ove-variables-hooks-on-module-unload.patch | 34 ++ ...overflow-leads-to-heap-OOB-write-or-.patch | 35 ++ ...ger-overflow-leads-to-heap-OOB-write.patch | 53 ++ ...x-an-integer-overflow-when-supplying.patch | 69 +++ ...ack-overflow-due-to-unlimited-recurs.patch | 83 +++ ...-Block-the-dump-command-in-lockdown-.patch | 33 ++ ...isable-memory-reading-in-lockdown-mo.patch | 50 ++ ...-Disable-memory-reading-in-lockdown-.patch | 37 ++ 0336-fs-bfs-Disable-under-lockdown.patch | 52 ++ ...able-many-filesystems-under-lockdown.patch | 391 +++++++++++++ ...afe-math-macros-to-prevent-overflows.patch | 543 ++++++++++++++++++ ...rflows-when-allocating-memory-for-ar.patch | 38 ++ ...turned-pointer-for-allocated-memory-.patch | 152 +++++ ...disk-Call-grub_ieee1275_close-when-g.patch | 31 + ...afe-math-macros-to-prevent-overflows.patch | 353 ++++++++++++ ...lows-when-allocating-memory-for-arra.patch | 82 +++ ...lows-when-assigning-returned-values-.patch | 105 ++++ ...afe-math-macros-to-prevent-overflows.patch | 138 +++++ ...verflows-when-allocating-memory-for-.patch | 40 ++ ...returned-pointer-for-allocated-memor.patch | 88 +++ ...ng-NULL-check-after-grub_strdup-call.patch | 24 + ...afe-math-macros-to-prevent-overflows.patch | 240 ++++++++ ...flows-when-allocating-memory-for-arr.patch | 45 ++ ...urned-pointer-for-allocated-memory-i.patch | 31 + ...fs-Check-if-allocated-memory-is-NULL.patch | 32 ++ ...ix-potential-underflow-and-NULL-dere.patch | 32 ++ ...unix-getroot-Fix-potential-underflow.patch | 35 ++ ...e-consistent-overflow-error-messages.patch | 55 ++ ...ine-GRUB_EHCI_TOGGLE-as-grub_uint32_.patch | 30 + ...safe-math-to-avoid-an-integer-overfl.patch | 41 ++ ...dd-sanity-check-after-grub_strtoul-c.patch | 46 ++ ...sanity-check-after-grub_strtoul-call.patch | 57 ++ ...nux-Cast-left-shift-to-grub_uint32_t.patch | 30 + ...bsd-Use-safe-math-to-avoid-underflow.patch | 56 ++ grub.patches | 73 +++ grub2.spec | 24 +- 75 files changed, 6897 insertions(+), 1 deletion(-) create mode 100644 0289-misc-Implement-grub_strlcpy.patch create mode 100644 0290-fs-ufs-Fix-a-heap-OOB-write.patch create mode 100644 0291-fs-hfs-Fix-stack-OOB-write-with-grub_strcpy.patch create mode 100644 0292-fs-tar-Initialize-name-in-grub_cpio_find_file.patch create mode 100644 0293-fs-tar-Integer-overflow-leads-to-heap-OOB-write.patch create mode 100644 0294-fs-f2fs-Set-a-grub_errno-if-mount-fails.patch create mode 100644 0295-fs-hfsplus-Set-a-grub_errno-if-mount-fails.patch create mode 100644 0296-fs-iso9660-Set-a-grub_errno-if-mount-fails.patch create mode 100644 0297-fs-iso9660-Fix-invalid-free.patch create mode 100644 0298-fs-jfs-Fix-OOB-read-in-jfs_getent.patch create mode 100644 0299-fs-jfs-Fix-OOB-read-caused-by-invalid-dir-slot-index.patch create mode 100644 0300-fs-jfs-Use-full-40-bits-offset-and-address-for-a-dat.patch create mode 100644 0301-fs-jfs-Inconsistent-signed-unsigned-types-usage-in-r.patch create mode 100644 0302-fs-ext2-Fix-out-of-bounds-read-for-inline-extents.patch create mode 100644 0303-fs-ntfs-Fix-out-of-bounds-read.patch create mode 100644 0304-fs-ntfs-Track-the-end-of-the-MFT-attribute-buffer.patch create mode 100644 0305-fs-ntfs-Use-a-helper-function-to-access-attributes.patch create mode 100644 0306-fs-ntfs-Implement-attribute-verification.patch create mode 100644 0307-fs-xfs-Fix-out-of-bounds-read.patch create mode 100644 0308-fs-xfs-Ensuring-failing-to-mount-sets-a-grub_errno.patch create mode 100644 0309-kern-file-Ensure-file-data-is-set.patch create mode 100644 0310-kern-file-Implement-filesystem-reference-counting.patch create mode 100644 0311-cli_lock-Add-build-option-to-block-command-line-inte.patch create mode 100644 0312-disk-cryptodisk-Require-authentication-after-TPM-unl.patch create mode 100644 0313-disk-loopback-Reference-tracking-for-the-loopback.patch create mode 100644 0314-kern-disk-Limit-recursion-depth.patch create mode 100644 0315-kern-partition-Limit-recursion-in-part_iterate.patch create mode 100644 0316-script-execute-Limit-the-recursion-depth.patch create mode 100644 0317-net-Unregister-net_default_ip-and-net_default_mac-va.patch create mode 100644 0318-net-Remove-variables-hooks-when-interface-is-unregis.patch create mode 100644 0319-net-Fix-OOB-write-in-grub_net_search_config_file.patch create mode 100644 0320-net-tftp-Fix-stack-buffer-overflow-in-tftp_open.patch create mode 100644 0321-video-readers-jpeg-Do-not-permit-duplicate-SOF0-mark.patch create mode 100644 0322-kern-dl-Fix-for-an-integer-overflow-in-grub_dl_ref.patch create mode 100644 0323-kern-dl-Check-for-the-SHF_INFO_LINK-flag-in-grub_dl_.patch create mode 100644 0324-commands-extcmd-Missing-check-for-failed-allocation.patch create mode 100644 0325-commands-ls-Fix-NULL-dereference.patch create mode 100644 0326-commands-pgp-Unregister-the-check_signatures-hooks-o.patch create mode 100644 0327-normal-Remove-variables-hooks-on-module-unload.patch create mode 100644 0328-gettext-Remove-variables-hooks-on-module-unload.patch create mode 100644 0329-gettext-Integer-overflow-leads-to-heap-OOB-write-or-.patch create mode 100644 0330-gettext-Integer-overflow-leads-to-heap-OOB-write.patch create mode 100644 0331-commands-read-Fix-an-integer-overflow-when-supplying.patch create mode 100644 0332-commands-test-Stack-overflow-due-to-unlimited-recurs.patch create mode 100644 0333-commands-minicmd-Block-the-dump-command-in-lockdown-.patch create mode 100644 0334-commands-memrw-Disable-memory-reading-in-lockdown-mo.patch create mode 100644 0335-commands-hexdump-Disable-memory-reading-in-lockdown-.patch create mode 100644 0336-fs-bfs-Disable-under-lockdown.patch create mode 100644 0337-fs-Disable-many-filesystems-under-lockdown.patch create mode 100644 0338-disk-Use-safe-math-macros-to-prevent-overflows.patch create mode 100644 0339-disk-Prevent-overflows-when-allocating-memory-for-ar.patch create mode 100644 0340-disk-Check-if-returned-pointer-for-allocated-memory-.patch create mode 100644 0341-disk-ieee1275-ofdisk-Call-grub_ieee1275_close-when-g.patch create mode 100644 0342-fs-Use-safe-math-macros-to-prevent-overflows.patch create mode 100644 0343-fs-Prevent-overflows-when-allocating-memory-for-arra.patch create mode 100644 0344-fs-Prevent-overflows-when-assigning-returned-values-.patch create mode 100644 0345-fs-zfs-Use-safe-math-macros-to-prevent-overflows.patch create mode 100644 0346-fs-zfs-Prevent-overflows-when-allocating-memory-for-.patch create mode 100644 0347-fs-zfs-Check-if-returned-pointer-for-allocated-memor.patch create mode 100644 0348-fs-zfs-Add-missing-NULL-check-after-grub_strdup-call.patch create mode 100644 0349-net-Use-safe-math-macros-to-prevent-overflows.patch create mode 100644 0350-net-Prevent-overflows-when-allocating-memory-for-arr.patch create mode 100644 0351-net-Check-if-returned-pointer-for-allocated-memory-i.patch create mode 100644 0352-fs-sfs-Check-if-allocated-memory-is-NULL.patch create mode 100644 0353-script-execute-Fix-potential-underflow-and-NULL-dere.patch create mode 100644 0354-osdep-unix-getroot-Fix-potential-underflow.patch create mode 100644 0355-misc-Ensure-consistent-overflow-error-messages.patch create mode 100644 0356-bus-usb-ehci-Define-GRUB_EHCI_TOGGLE-as-grub_uint32_.patch create mode 100644 0357-normal-menu-Use-safe-math-to-avoid-an-integer-overfl.patch create mode 100644 0358-kern-partition-Add-sanity-check-after-grub_strtoul-c.patch create mode 100644 0359-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch create mode 100644 0360-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch create mode 100644 0361-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch diff --git a/0289-misc-Implement-grub_strlcpy.patch b/0289-misc-Implement-grub_strlcpy.patch new file mode 100644 index 00000000..d6932f2e --- /dev/null +++ b/0289-misc-Implement-grub_strlcpy.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sat, 15 Jun 2024 02:33:08 +0100 +Subject: [PATCH] misc: Implement grub_strlcpy() + +grub_strlcpy() acts the same way as strlcpy() does on most *NIX, +returning the length of src and ensuring dest is always NUL +terminated except when size is 0. + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + include/grub/misc.h | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/include/grub/misc.h b/include/grub/misc.h +index db517acd5..6b1e084af 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -72,6 +72,45 @@ grub_stpcpy (char *dest, const char *src) + return d - 1; + } + ++static inline grub_size_t ++grub_strlcpy (char *dest, const char *src, grub_size_t size) ++{ ++ char *d = dest; ++ grub_size_t res = 0; ++ /* ++ * We do not subtract one from size here to avoid dealing with underflowing ++ * the value, which is why to_copy is always checked to be greater than one ++ * throughout this function. ++ */ ++ grub_size_t to_copy = size; ++ ++ /* Copy size - 1 bytes to dest. */ ++ if (to_copy > 1) ++ while ((*d++ = *src++) != '\0' && ++res && --to_copy > 1) ++ ; ++ ++ /* ++ * NUL terminate if size != 0. The previous step may have copied a NUL byte ++ * if it reached the end of the string, but we know dest[size - 1] must always ++ * be a NUL byte. ++ */ ++ if (size != 0) ++ dest[size - 1] = '\0'; ++ ++ /* If there is still space in dest, but are here, we reached the end of src. */ ++ if (to_copy > 1) ++ return res; ++ ++ /* ++ * If we haven't reached the end of the string, iterate through to determine ++ * the strings total length. ++ */ ++ while (*src++ != '\0' && ++res) ++ ; ++ ++ return res; ++} ++ + /* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ + static inline void * + grub_memcpy (void *dest, const void *src, grub_size_t n) diff --git a/0290-fs-ufs-Fix-a-heap-OOB-write.patch b/0290-fs-ufs-Fix-a-heap-OOB-write.patch new file mode 100644 index 00000000..ed1be4cb --- /dev/null +++ b/0290-fs-ufs-Fix-a-heap-OOB-write.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 02:03:33 +0100 +Subject: [PATCH] fs/ufs: Fix a heap OOB write + +grub_strcpy() was used to copy a symlink name from the filesystem +image to a heap allocated buffer. This led to a OOB write to adjacent +heap allocations. Fix by using grub_strlcpy(). + +Fixes: CVE-2024-45781 + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ufs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c +index a354c92d9..01235101b 100644 +--- a/grub-core/fs/ufs.c ++++ b/grub-core/fs/ufs.c +@@ -463,7 +463,7 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino) + /* Check against zero is paylindromic, no need to swap. */ + if (data->inode.nblocks == 0 + && INODE_SIZE (data) <= sizeof (data->inode.symlink)) +- grub_strcpy (symlink, (char *) data->inode.symlink); ++ grub_strlcpy (symlink, (char *) data->inode.symlink, sz); + else + { + if (grub_ufs_read_file (data, 0, 0, 0, sz, symlink) < 0) diff --git a/0291-fs-hfs-Fix-stack-OOB-write-with-grub_strcpy.patch b/0291-fs-hfs-Fix-stack-OOB-write-with-grub_strcpy.patch new file mode 100644 index 00000000..5a836725 --- /dev/null +++ b/0291-fs-hfs-Fix-stack-OOB-write-with-grub_strcpy.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 02:48:33 +0100 +Subject: [PATCH] fs/hfs: Fix stack OOB write with grub_strcpy() + +Replaced with grub_strlcpy(). + +Fixes: CVE-2024-45782 +Fixes: CVE-2024-56737 +Fixes: https://savannah.gnu.org/bugs/?66599 + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/hfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c +index 91dc0e69c..920112b03 100644 +--- a/grub-core/fs/hfs.c ++++ b/grub-core/fs/hfs.c +@@ -379,7 +379,7 @@ grub_hfs_mount (grub_disk_t disk) + volume name. */ + key.parent_dir = grub_cpu_to_be32_compile_time (1); + key.strlen = data->sblock.volname[0]; +- grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1)); ++ grub_strlcpy ((char *) key.str, (char *) (data->sblock.volname + 1), sizeof (key.str)); + + if (grub_hfs_find_node (data, (char *) &key, data->cat_root, + 0, (char *) &dir, sizeof (dir)) == 0) diff --git a/0292-fs-tar-Initialize-name-in-grub_cpio_find_file.patch b/0292-fs-tar-Initialize-name-in-grub_cpio_find_file.patch new file mode 100644 index 00000000..6433d2d5 --- /dev/null +++ b/0292-fs-tar-Initialize-name-in-grub_cpio_find_file.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 02:47:54 +0100 +Subject: [PATCH] fs/tar: Initialize name in grub_cpio_find_file() + +It was possible to iterate through grub_cpio_find_file() without +allocating name and not setting mode to GRUB_ARCHELP_ATTR_END, which +would cause the uninitialized value for name to be used as an argument +for canonicalize() in grub_archelp_dir(). + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/tar.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/grub-core/fs/tar.c b/grub-core/fs/tar.c +index c551ed6b5..646bce5eb 100644 +--- a/grub-core/fs/tar.c ++++ b/grub-core/fs/tar.c +@@ -78,6 +78,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + int reread = 0, have_longname = 0, have_longlink = 0; + + data->hofs = data->next_hofs; ++ *name = NULL; + + for (reread = 0; reread < 3; reread++) + { +@@ -202,6 +203,10 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + } + return GRUB_ERR_NONE; + } ++ ++ if (*name == NULL) ++ return grub_error (GRUB_ERR_BAD_FS, "invalid tar archive"); ++ + return GRUB_ERR_NONE; + } + diff --git a/0293-fs-tar-Integer-overflow-leads-to-heap-OOB-write.patch b/0293-fs-tar-Integer-overflow-leads-to-heap-OOB-write.patch new file mode 100644 index 00000000..b059e496 --- /dev/null +++ b/0293-fs-tar-Integer-overflow-leads-to-heap-OOB-write.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Fri, 22 Nov 2024 06:27:58 +0000 +Subject: [PATCH] fs/tar: Integer overflow leads to heap OOB write + +Both namesize and linksize are derived from hd.size, a 12-digit octal +number parsed by read_number(). Later direct arithmetic calculation like +"namesize + 1" and "linksize + 1" may exceed the maximum value of +grub_size_t leading to heap OOB write. This patch fixes the issue by +using grub_add() and checking for an overflow. + +Fixes: CVE-2024-45780 + +Reported-by: Nils Langius +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +Reviewed-by: Alec Brown +--- + grub-core/fs/tar.c | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/grub-core/fs/tar.c b/grub-core/fs/tar.c +index 646bce5eb..386c09022 100644 +--- a/grub-core/fs/tar.c ++++ b/grub-core/fs/tar.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -76,6 +77,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + { + struct head hd; + int reread = 0, have_longname = 0, have_longlink = 0; ++ grub_size_t sz; + + data->hofs = data->next_hofs; + *name = NULL; +@@ -98,7 +100,11 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + { + grub_err_t err; + grub_size_t namesize = read_number (hd.size, sizeof (hd.size)); +- *name = grub_malloc (namesize + 1); ++ ++ if (grub_add (namesize, 1, &sz)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("name size overflow")); ++ ++ *name = grub_malloc (sz); + if (*name == NULL) + return grub_errno; + err = grub_disk_read (data->disk, 0, +@@ -118,15 +124,19 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + { + grub_err_t err; + grub_size_t linksize = read_number (hd.size, sizeof (hd.size)); +- if (data->linkname_alloc < linksize + 1) ++ ++ if (grub_add (linksize, 1, &sz)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("link size overflow")); ++ ++ if (data->linkname_alloc < sz) + { + char *n; +- n = grub_calloc (2, linksize + 1); ++ n = grub_calloc (2, sz); + if (!n) + return grub_errno; + grub_free (data->linkname); + data->linkname = n; +- data->linkname_alloc = 2 * (linksize + 1); ++ data->linkname_alloc = 2 * (sz); + } + + err = grub_disk_read (data->disk, 0, +@@ -149,7 +159,10 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + while (extra_size < sizeof (hd.prefix) + && hd.prefix[extra_size]) + extra_size++; +- *name = grub_malloc (sizeof (hd.name) + extra_size + 2); ++ ++ if (grub_add (sizeof (hd.name) + 2, extra_size, &sz)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("long name size overflow")); ++ *name = grub_malloc (sz); + if (*name == NULL) + return grub_errno; + if (hd.prefix[0]) diff --git a/0294-fs-f2fs-Set-a-grub_errno-if-mount-fails.patch b/0294-fs-f2fs-Set-a-grub_errno-if-mount-fails.patch new file mode 100644 index 00000000..0b72b727 --- /dev/null +++ b/0294-fs-f2fs-Set-a-grub_errno-if-mount-fails.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 06:15:03 +0100 +Subject: [PATCH] fs/f2fs: Set a grub_errno if mount fails + +It was previously possible for grub_errno to not be set when +grub_f2fs_mount() failed if nat_bitmap_ptr() returned NULL. + +This issue is solved by ensuring a grub_errno is set in the fail case. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/f2fs.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c +index 855e24618..db8a65f8d 100644 +--- a/grub-core/fs/f2fs.c ++++ b/grub-core/fs/f2fs.c +@@ -872,6 +872,9 @@ grub_f2fs_mount (grub_disk_t disk) + return data; + + fail: ++ if (grub_errno == GRUB_ERR_NONE) ++ grub_error (GRUB_ERR_BAD_FS, "not a F2FS filesystem"); ++ + grub_free (data); + + return NULL; diff --git a/0295-fs-hfsplus-Set-a-grub_errno-if-mount-fails.patch b/0295-fs-hfsplus-Set-a-grub_errno-if-mount-fails.patch new file mode 100644 index 00000000..eb36c019 --- /dev/null +++ b/0295-fs-hfsplus-Set-a-grub_errno-if-mount-fails.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 06:22:51 +0100 +Subject: [PATCH] fs/hfsplus: Set a grub_errno if mount fails + +It was possible for mount to fail but not set grub_errno. This led to +a possible double decrement of the module reference count if the NULL +page was mapped. + +Fixing in general as a similar bug was fixed in commit 61b13c187 +(fs/hfsplus: Set grub_errno to prevent NULL pointer access) and there +are likely more variants around. + +Fixes: CVE-2024-45783 + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/hfsplus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c +index 295822f69..de71fd486 100644 +--- a/grub-core/fs/hfsplus.c ++++ b/grub-core/fs/hfsplus.c +@@ -405,7 +405,7 @@ grub_hfsplus_mount (grub_disk_t disk) + + fail: + +- if (grub_errno == GRUB_ERR_OUT_OF_RANGE) ++ if (grub_errno == GRUB_ERR_OUT_OF_RANGE || grub_errno == GRUB_ERR_NONE) + grub_error (GRUB_ERR_BAD_FS, "not a HFS+ filesystem"); + + grub_free (data); diff --git a/0296-fs-iso9660-Set-a-grub_errno-if-mount-fails.patch b/0296-fs-iso9660-Set-a-grub_errno-if-mount-fails.patch new file mode 100644 index 00000000..69470f69 --- /dev/null +++ b/0296-fs-iso9660-Set-a-grub_errno-if-mount-fails.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 06:37:08 +0100 +Subject: [PATCH] fs/iso9660: Set a grub_errno if mount fails + +It was possible for a grub_errno to not be set if mount of an ISO 9660 +filesystem failed when set_rockridge() returned 0. + +This isn't known to be exploitable as the other filesystems due to +filesystem helper checking the requested file type. Though fixing +as a precaution. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/iso9660.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index 8c348b59a..8d480e602 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -551,6 +551,9 @@ grub_iso9660_mount (grub_disk_t disk) + return data; + + fail: ++ if (grub_errno == GRUB_ERR_NONE) ++ grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem"); ++ + grub_free (data); + return 0; + } diff --git a/0297-fs-iso9660-Fix-invalid-free.patch b/0297-fs-iso9660-Fix-invalid-free.patch new file mode 100644 index 00000000..61bd5cce --- /dev/null +++ b/0297-fs-iso9660-Fix-invalid-free.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Fri, 31 May 2024 15:14:42 +0800 +Subject: [PATCH] fs/iso9660: Fix invalid free + +The ctx->filename can point to either a string literal or a dynamically +allocated string. The ctx->filename_alloc field is used to indicate the +type of allocation. + +An issue has been identified where ctx->filename is reassigned to +a string literal in susp_iterate_dir() but ctx->filename_alloc is not +correctly handled. This oversight causes a memory leak and an invalid +free operation later. + +The fix involves checking ctx->filename_alloc, freeing the allocated +string if necessary and clearing ctx->filename_alloc for string literals. + +Reported-by: Daniel Axtens +Signed-off-by: Michael Chang +Reviewed-by: Daniel Kiper +--- + grub-core/fs/iso9660.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index 8d480e602..8e3c95c4f 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -628,9 +628,19 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry, + filename type is stored. */ + /* FIXME: Fix this slightly improper cast. */ + if (entry->data[0] & GRUB_ISO9660_RR_DOT) +- ctx->filename = (char *) "."; ++ { ++ if (ctx->filename_alloc) ++ grub_free (ctx->filename); ++ ctx->filename_alloc = 0; ++ ctx->filename = (char *) "."; ++ } + else if (entry->data[0] & GRUB_ISO9660_RR_DOTDOT) +- ctx->filename = (char *) ".."; ++ { ++ if (ctx->filename_alloc) ++ grub_free (ctx->filename); ++ ctx->filename_alloc = 0; ++ ctx->filename = (char *) ".."; ++ } + else if (entry->len >= 5) + { + grub_size_t off = 0, csize = 1; diff --git a/0298-fs-jfs-Fix-OOB-read-in-jfs_getent.patch b/0298-fs-jfs-Fix-OOB-read-in-jfs_getent.patch new file mode 100644 index 00000000..49464e74 --- /dev/null +++ b/0298-fs-jfs-Fix-OOB-read-in-jfs_getent.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Fri, 22 Nov 2024 06:27:59 +0000 +Subject: [PATCH] fs/jfs: Fix OOB read in jfs_getent() + +The JFS fuzzing revealed an OOB read in grub_jfs_getent(). The crash +was caused by an invalid leaf nodes count, diro->dirpage->header.count, +which was larger than the maximum number of leaf nodes allowed in an +inode. This fix is to ensure that the leaf nodes count is validated in +grub_jfs_opendir() before calling grub_jfs_getent(). + +On the occasion replace existing raw numbers with newly defined constant. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +Reviewed-by: Alec Brown +--- + grub-core/fs/jfs.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c +index 6f7c43904..32dec7fb7 100644 +--- a/grub-core/fs/jfs.c ++++ b/grub-core/fs/jfs.c +@@ -41,6 +41,12 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + #define GRUB_JFS_TREE_LEAF 2 + ++/* ++ * Define max entries stored in-line in an inode. ++ * https://jfs.sourceforge.net/project/pub/jfslayout.pdf ++ */ ++#define GRUB_JFS_INODE_INLINE_ENTRIES 8 ++ + struct grub_jfs_sblock + { + /* The magic for JFS. It should contain the string "JFS1". */ +@@ -203,9 +209,9 @@ struct grub_jfs_inode + grub_uint8_t freecnt; + grub_uint8_t freelist; + grub_uint32_t idotdot; +- grub_uint8_t sorted[8]; ++ grub_uint8_t sorted[GRUB_JFS_INODE_INLINE_ENTRIES]; + } header; +- struct grub_jfs_leaf_dirent dirents[8]; ++ struct grub_jfs_leaf_dirent dirents[GRUB_JFS_INODE_INLINE_ENTRIES]; + } GRUB_PACKED dir; + /* Fast symlink. */ + struct +@@ -453,6 +459,13 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode) + /* Check if the entire tree is contained within the inode. */ + if (inode->file.tree.flags & GRUB_JFS_TREE_LEAF) + { ++ if (inode->dir.header.count > GRUB_JFS_INODE_INLINE_ENTRIES) ++ { ++ grub_free (diro); ++ grub_error (GRUB_ERR_BAD_FS, N_("invalid JFS inode")); ++ return 0; ++ } ++ + diro->leaf = inode->dir.dirents; + diro->next_leaf = (struct grub_jfs_leaf_next_dirent *) de; + diro->sorted = inode->dir.header.sorted; diff --git a/0299-fs-jfs-Fix-OOB-read-caused-by-invalid-dir-slot-index.patch b/0299-fs-jfs-Fix-OOB-read-caused-by-invalid-dir-slot-index.patch new file mode 100644 index 00000000..029e8485 --- /dev/null +++ b/0299-fs-jfs-Fix-OOB-read-caused-by-invalid-dir-slot-index.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Fri, 22 Nov 2024 06:28:00 +0000 +Subject: [PATCH] fs/jfs: Fix OOB read caused by invalid dir slot index + +While fuzz testing JFS with ASAN enabled an OOB read was detected in +grub_jfs_opendir(). The issue occurred due to an invalid directory slot +index in the first entry of the sorted directory slot array in the inode +directory header. The fix ensures the slot index is validated before +accessing it. Given that an internal or a leaf node in a directory B+ +tree is a 4 KiB in size and each directory slot is always 32 bytes, the +max number of slots in a node is 128. The validation ensures that the +slot index doesn't exceed this limit. + +[1] https://jfs.sourceforge.net/project/pub/jfslayout.pdf + + JFS will allocate 4K of disk space for an internal node of the B+ tree. + An internal node looks the same as a leaf node. + - page 10 + + Fixed number of Directory Slots depending on the size of the node. These are + the slots to be used for storing the directory slot array and the directory + entries or router entries. A directory slot is always 32 bytes. + ... + A Directory Slot Array which is a sorted array of indices to the directory + slots that are currently in use. + ... + An internal or a leaf node in the directory B+ tree is a 4K page. + - page 25 + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +Reviewed-by: Alec Brown +--- + grub-core/fs/jfs.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c +index 32dec7fb7..88fb884df 100644 +--- a/grub-core/fs/jfs.c ++++ b/grub-core/fs/jfs.c +@@ -46,6 +46,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); + * https://jfs.sourceforge.net/project/pub/jfslayout.pdf + */ + #define GRUB_JFS_INODE_INLINE_ENTRIES 8 ++#define GRUB_JFS_DIR_MAX_SLOTS 128 + + struct grub_jfs_sblock + { +@@ -481,6 +482,14 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode) + return 0; + } + ++ if (inode->dir.header.sorted[0] >= GRUB_JFS_DIR_MAX_SLOTS) ++ { ++ grub_error (GRUB_ERR_BAD_FS, N_("invalid directory slot index")); ++ grub_free (diro->dirpage); ++ grub_free (diro); ++ return 0; ++ } ++ + blk = grub_le_to_cpu32 (de[inode->dir.header.sorted[0]].ex.blk2); + blk <<= (grub_le_to_cpu16 (data->sblock.log2_blksz) - GRUB_DISK_SECTOR_BITS); + diff --git a/0300-fs-jfs-Use-full-40-bits-offset-and-address-for-a-dat.patch b/0300-fs-jfs-Use-full-40-bits-offset-and-address-for-a-dat.patch new file mode 100644 index 00000000..ed387aeb --- /dev/null +++ b/0300-fs-jfs-Use-full-40-bits-offset-and-address-for-a-dat.patch @@ -0,0 +1,128 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Mon, 16 Dec 2024 20:22:39 +0000 +Subject: [PATCH] fs/jfs: Use full 40 bits offset and address for a data extent + +An extent's logical offset and address are represented as a 40-bit value +split into two parts: the most significant 8 bits and the least +significant 32 bits. Currently the JFS code uses only the least +significant 32 bits value for offsets and addresses assuming the data +size will never exceed the 32-bit range. This approach ignores the most +significant 8 bits potentially leading to incorrect offsets and +addresses for larger values. The patch fixes it by incorporating the +most significant 8 bits into the calculation to get the full 40-bits +value for offsets and addresses. + +https://jfs.sourceforge.net/project/pub/jfslayout.pdf + + "off1,off2 is a 40-bit field, containing the logical offset of the first + block in the extent. + ... + addr1,addr2 is a 40-bit field, containing the address of the extent." + +Signed-off-by: Lidong Chen +Reviewed-by: Alec Brown +Reviewed-by: Ross Philipson +Reviewed-by: Daniel Kiper +--- + grub-core/fs/jfs.c | 41 +++++++++++++++++++++++++++++------------ + 1 file changed, 29 insertions(+), 12 deletions(-) + +diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c +index 88fb884df..2bde48d45 100644 +--- a/grub-core/fs/jfs.c ++++ b/grub-core/fs/jfs.c +@@ -265,6 +265,20 @@ static grub_dl_t my_mod; + + static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino); + ++/* ++ * An extent's offset, physical and logical, is represented as a 40-bit value. ++ * This 40-bit value is split into two parts: ++ * - offset1: the most signficant 8 bits of the offset, ++ * - offset2: the least significant 32 bits of the offset. ++ * ++ * This function calculates and returns the 64-bit offset of an extent. ++ */ ++static grub_uint64_t ++get_ext_offset (grub_uint8_t offset1, grub_uint32_t offset2) ++{ ++ return (((grub_uint64_t) offset1 << 32) | grub_le_to_cpu32 (offset2)); ++} ++ + static grub_int64_t + getblk (struct grub_jfs_treehead *treehead, + struct grub_jfs_tree_extent *extents, +@@ -274,22 +288,25 @@ getblk (struct grub_jfs_treehead *treehead, + { + int found = -1; + int i; ++ grub_uint64_t ext_offset, ext_blk; + + for (i = 0; i < grub_le_to_cpu16 (treehead->count) - 2 && + i < max_extents; i++) + { ++ ext_offset = get_ext_offset (extents[i].offset1, extents[i].offset2); ++ ext_blk = get_ext_offset (extents[i].extent.blk1, extents[i].extent.blk2); ++ + if (treehead->flags & GRUB_JFS_TREE_LEAF) + { + /* Read the leafnode. */ +- if (grub_le_to_cpu32 (extents[i].offset2) <= blk ++ if (ext_offset <= blk + && ((grub_le_to_cpu16 (extents[i].extent.length)) + + (extents[i].extent.length2 << 16) +- + grub_le_to_cpu32 (extents[i].offset2)) > blk) +- return (blk - grub_le_to_cpu32 (extents[i].offset2) +- + grub_le_to_cpu32 (extents[i].extent.blk2)); ++ + ext_offset) > blk) ++ return (blk - ext_offset + ext_blk); + } + else +- if (blk >= grub_le_to_cpu32 (extents[i].offset2)) ++ if (blk >= ext_offset) + found = i; + } + +@@ -307,10 +324,9 @@ getblk (struct grub_jfs_treehead *treehead, + return -1; + + if (!grub_disk_read (data->disk, +- ((grub_disk_addr_t) grub_le_to_cpu32 (extents[found].extent.blk2)) +- << (grub_le_to_cpu16 (data->sblock.log2_blksz) +- - GRUB_DISK_SECTOR_BITS), 0, +- sizeof (*tree), (char *) tree)) ++ (grub_disk_addr_t) ext_blk ++ << (grub_le_to_cpu16 (data->sblock.log2_blksz) - GRUB_DISK_SECTOR_BITS), ++ 0, sizeof (*tree), (char *) tree)) + { + if (grub_memcmp (&tree->treehead, treehead, sizeof (struct grub_jfs_treehead)) || + grub_memcmp (&tree->extents, extents, 254 * sizeof (struct grub_jfs_tree_extent))) +@@ -361,7 +377,7 @@ grub_jfs_read_inode (struct grub_jfs_data *data, grub_uint32_t ino, + sizeof (iag_inodes), &iag_inodes)) + return grub_errno; + +- inoblk = grub_le_to_cpu32 (iag_inodes[inoext].blk2); ++ inoblk = get_ext_offset (iag_inodes[inoext].blk1, iag_inodes[inoext].blk2); + inoblk <<= (grub_le_to_cpu16 (data->sblock.log2_blksz) + - GRUB_DISK_SECTOR_BITS); + inoblk += inonum; +@@ -490,7 +506,8 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode) + return 0; + } + +- blk = grub_le_to_cpu32 (de[inode->dir.header.sorted[0]].ex.blk2); ++ blk = get_ext_offset (de[inode->dir.header.sorted[0]].ex.blk1, ++ de[inode->dir.header.sorted[0]].ex.blk2); + blk <<= (grub_le_to_cpu16 (data->sblock.log2_blksz) - GRUB_DISK_SECTOR_BITS); + + /* Read in the nodes until we are on the leaf node level. */ +@@ -508,7 +525,7 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode) + + de = (struct grub_jfs_internal_dirent *) diro->dirpage->dirent; + index = diro->dirpage->sorted[diro->dirpage->header.sindex * 32]; +- blk = (grub_le_to_cpu32 (de[index].ex.blk2) ++ blk = (get_ext_offset (de[index].ex.blk1, de[index].ex.blk2) + << (grub_le_to_cpu16 (data->sblock.log2_blksz) + - GRUB_DISK_SECTOR_BITS)); + } while (!(diro->dirpage->header.flags & GRUB_JFS_TREE_LEAF)); diff --git a/0301-fs-jfs-Inconsistent-signed-unsigned-types-usage-in-r.patch b/0301-fs-jfs-Inconsistent-signed-unsigned-types-usage-in-r.patch new file mode 100644 index 00000000..33c684b2 --- /dev/null +++ b/0301-fs-jfs-Inconsistent-signed-unsigned-types-usage-in-r.patch @@ -0,0 +1,85 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Mon, 16 Dec 2024 20:22:40 +0000 +Subject: [PATCH] fs/jfs: Inconsistent signed/unsigned types usage in return + values + +The getblk() returns a value of type grub_int64_t which is assigned to +iagblk and inoblk, both of type grub_uint64_t, in grub_jfs_read_inode() +via grub_jfs_blkno(). This patch fixes the type mismatch in the +functions. Additionally, the getblk() will return 0 instead of -1 on +failure cases. This change is safe because grub_errno is always set in +getblk() to indicate errors and it is later checked in the callers. + +Signed-off-by: Lidong Chen +Reviewed-by: Alec Brown +Reviewed-by: Ross Philipson +Reviewed-by: Daniel Kiper +--- + grub-core/fs/jfs.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c +index 2bde48d45..70a2f4947 100644 +--- a/grub-core/fs/jfs.c ++++ b/grub-core/fs/jfs.c +@@ -279,7 +279,7 @@ get_ext_offset (grub_uint8_t offset1, grub_uint32_t offset2) + return (((grub_uint64_t) offset1 << 32) | grub_le_to_cpu32 (offset2)); + } + +-static grub_int64_t ++static grub_uint64_t + getblk (struct grub_jfs_treehead *treehead, + struct grub_jfs_tree_extent *extents, + int max_extents, +@@ -290,6 +290,8 @@ getblk (struct grub_jfs_treehead *treehead, + int i; + grub_uint64_t ext_offset, ext_blk; + ++ grub_errno = GRUB_ERR_NONE; ++ + for (i = 0; i < grub_le_to_cpu16 (treehead->count) - 2 && + i < max_extents; i++) + { +@@ -312,7 +314,7 @@ getblk (struct grub_jfs_treehead *treehead, + + if (found != -1) + { +- grub_int64_t ret = -1; ++ grub_uint64_t ret = 0; + struct + { + struct grub_jfs_treehead treehead; +@@ -321,7 +323,7 @@ getblk (struct grub_jfs_treehead *treehead, + + tree = grub_zalloc (sizeof (*tree)); + if (!tree) +- return -1; ++ return 0; + + if (!grub_disk_read (data->disk, + (grub_disk_addr_t) ext_blk +@@ -334,19 +336,20 @@ getblk (struct grub_jfs_treehead *treehead, + else + { + grub_error (GRUB_ERR_BAD_FS, "jfs: infinite recursion detected"); +- ret = -1; ++ ret = 0; + } + } + grub_free (tree); + return ret; + } + +- return -1; ++ grub_error (GRUB_ERR_READ_ERROR, "jfs: block %" PRIuGRUB_UINT64_T " not found", blk); ++ return 0; + } + + /* Get the block number for the block BLK in the node INODE in the + mounted filesystem DATA. */ +-static grub_int64_t ++static grub_uint64_t + grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode, + grub_uint64_t blk) + { diff --git a/0302-fs-ext2-Fix-out-of-bounds-read-for-inline-extents.patch b/0302-fs-ext2-Fix-out-of-bounds-read-for-inline-extents.patch new file mode 100644 index 00000000..880ef764 --- /dev/null +++ b/0302-fs-ext2-Fix-out-of-bounds-read-for-inline-extents.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Fri, 31 May 2024 15:14:23 +0800 +Subject: [PATCH] fs/ext2: Fix out-of-bounds read for inline extents + +When inline extents are used, i.e. the extent tree depth equals zero, +a maximum of four entries can fit into the inode's data block. If the +extent header states a number of entries greater than four the current +ext2 implementation causes an out-of-bounds read. Fix this issue by +capping the number of extents to four when reading inline extents. + +Reported-by: Daniel Axtens +Signed-off-by: Michael Chang +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ext2.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index e1cc5e62a..3f9f6b208 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -495,6 +495,8 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + struct grub_ext4_extent *ext; + int i; + grub_disk_addr_t ret; ++ grub_uint16_t nent; ++ const grub_uint16_t max_inline_ext = sizeof (inode->blocks) / sizeof (*ext) - 1; /* Minus 1 extent header. */ + + if (grub_ext4_find_leaf (data, (struct grub_ext4_extent_header *) inode->blocks.dir_blocks, + fileblock, &leaf) != GRUB_ERR_NONE) +@@ -508,7 +510,13 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + return 0; + + ext = (struct grub_ext4_extent *) (leaf + 1); +- for (i = 0; i < grub_le_to_cpu16 (leaf->entries); i++) ++ ++ nent = grub_le_to_cpu16 (leaf->entries); ++ ++ if (leaf->depth == 0) ++ nent = grub_min (nent, max_inline_ext); ++ ++ for (i = 0; i < nent; i++) + { + if (fileblock < grub_le_to_cpu32 (ext[i].block)) + break; diff --git a/0303-fs-ntfs-Fix-out-of-bounds-read.patch b/0303-fs-ntfs-Fix-out-of-bounds-read.patch new file mode 100644 index 00000000..4d4acdce --- /dev/null +++ b/0303-fs-ntfs-Fix-out-of-bounds-read.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Mon, 3 Jun 2024 12:12:06 +0800 +Subject: [PATCH] fs/ntfs: Fix out-of-bounds read + +When parsing NTFS file records the presence of the 0xFF marker indicates +the end of the attribute list. This value signifies that there are no +more attributes to process. + +However, when the end marker is missing due to corrupted metadata the +loop continues to read beyond the attribute list resulting in out-of-bounds +reads and potentially entering an infinite loop. + +This patch adds a check to provide a stop condition for the loop ensuring +it stops at the end of the attribute list or at the end of the Master File +Table. This guards against out-of-bounds reads and prevents infinite loops. + +Reported-by: Daniel Axtens +Signed-off-by: Michael Chang +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index de435aa14..8a5384247 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -139,6 +139,8 @@ free_attr (struct grub_ntfs_attr *at) + static grub_uint8_t * + find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + { ++ grub_uint8_t *mft_end; ++ + if (at->flags & GRUB_NTFS_AF_ALST) + { + retry: +@@ -191,7 +193,8 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + return NULL; + } + at->attr_cur = at->attr_nxt; +- while (*at->attr_cur != 0xFF) ++ mft_end = at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); ++ while (at->attr_cur < mft_end && *at->attr_cur != 0xFF) + { + at->attr_nxt += u16at (at->attr_cur, 4); + if (*at->attr_cur == GRUB_NTFS_AT_ATTRIBUTE_LIST) diff --git a/0304-fs-ntfs-Track-the-end-of-the-MFT-attribute-buffer.patch b/0304-fs-ntfs-Track-the-end-of-the-MFT-attribute-buffer.patch new file mode 100644 index 00000000..e6a5c144 --- /dev/null +++ b/0304-fs-ntfs-Track-the-end-of-the-MFT-attribute-buffer.patch @@ -0,0 +1,141 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 7 Jan 2025 11:38:34 +0000 +Subject: [PATCH] fs/ntfs: Track the end of the MFT attribute buffer + +The end of the attribute buffer should be stored alongside the rest of +the attribute struct as right now it is not possible to implement bounds +checking when accessing attributes sequentially. + +This is done via: + - updating init_attr() to set at->end and check is is not initially out of bounds, + - implementing checks as init_attr() had its type change in its callers, + - updating the value of at->end when needed. + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 34 ++++++++++++++++++++++++++++------ + include/grub/ntfs.h | 1 + + 2 files changed, 29 insertions(+), 6 deletions(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 8a5384247..dbda720e1 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -119,13 +119,20 @@ static grub_err_t read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, + grub_disk_read_hook_t read_hook, + void *read_hook_data); + +-static void ++static grub_err_t + init_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft) + { + at->mft = mft; + at->flags = (mft == &mft->data->mmft) ? GRUB_NTFS_AF_MMFT : 0; + at->attr_nxt = mft->buf + first_attr_off (mft->buf); ++ at->end = mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR); ++ ++ if (at->attr_nxt > at->end) ++ return grub_error (GRUB_ERR_BAD_FS, "attributes start outside the MFT"); ++ + at->attr_end = at->emft_buf = at->edat_buf = at->sbuf = NULL; ++ ++ return GRUB_ERR_NONE; + } + + static void +@@ -239,6 +246,10 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + pa_end = at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); + } + at->flags |= GRUB_NTFS_AF_ALST; ++ ++ /* From this point on pa_end is the end of the buffer */ ++ at->end = pa_end; ++ + while (at->attr_nxt < at->attr_end) + { + if ((*at->attr_nxt == attr) || (attr == 0)) +@@ -298,7 +309,9 @@ locate_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft, + { + grub_uint8_t *pa; + +- init_attr (at, mft); ++ if (init_attr (at, mft) != GRUB_ERR_NONE) ++ return NULL; ++ + pa = find_attr (at, attr); + if (pa == NULL) + return NULL; +@@ -314,7 +327,8 @@ locate_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft, + } + grub_errno = GRUB_ERR_NONE; + free_attr (at); +- init_attr (at, mft); ++ if (init_attr (at, mft) != GRUB_ERR_NONE) ++ return NULL; + pa = find_attr (at, attr); + } + return pa; +@@ -585,7 +599,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint64_t mftno) + mft->attr.attr_end = 0; /* Don't jump to attribute list */ + } + else +- init_attr (&mft->attr, mft); ++ return init_attr (&mft->attr, mft); + + return 0; + } +@@ -811,7 +825,9 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, + bmp = NULL; + + at = &attr; +- init_attr (at, mft); ++ if (init_attr (at, mft) != GRUB_ERR_NONE) ++ return 0; ++ + while (1) + { + cur_pos = find_attr (at, GRUB_NTFS_AT_INDEX_ROOT); +@@ -842,7 +858,9 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, + bitmap = NULL; + bitmap_len = 0; + free_attr (at); ++ /* No need to check errors here, as it will already be fine */ + init_attr (at, mft); ++ + while ((cur_pos = find_attr (at, GRUB_NTFS_AT_BITMAP)) != NULL) + { + int ofs; +@@ -1207,6 +1225,7 @@ grub_ntfs_label (grub_device_t device, char **label) + struct grub_ntfs_data *data = 0; + struct grub_fshelp_node *mft = 0; + grub_uint8_t *pa; ++ grub_err_t err; + + grub_dl_ref (my_mod); + +@@ -1232,7 +1251,10 @@ grub_ntfs_label (grub_device_t device, char **label) + goto fail; + } + +- init_attr (&mft->attr, mft); ++ err = init_attr (&mft->attr, mft); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ + pa = find_attr (&mft->attr, GRUB_NTFS_AT_VOLUME_NAME); + + if (pa >= mft->buf + (mft->data->mft_size << GRUB_NTFS_BLK_SHR)) +diff --git a/include/grub/ntfs.h b/include/grub/ntfs.h +index d1a6af696..ec1c4db38 100644 +--- a/include/grub/ntfs.h ++++ b/include/grub/ntfs.h +@@ -134,6 +134,7 @@ struct grub_ntfs_attr + grub_uint8_t *attr_cur, *attr_nxt, *attr_end; + grub_uint32_t save_pos; + grub_uint8_t *sbuf; ++ grub_uint8_t *end; + struct grub_ntfs_file *mft; + }; + diff --git a/0305-fs-ntfs-Use-a-helper-function-to-access-attributes.patch b/0305-fs-ntfs-Use-a-helper-function-to-access-attributes.patch new file mode 100644 index 00000000..aede4b40 --- /dev/null +++ b/0305-fs-ntfs-Use-a-helper-function-to-access-attributes.patch @@ -0,0 +1,183 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 14 May 2024 12:39:56 +0100 +Subject: [PATCH] fs/ntfs: Use a helper function to access attributes + +Right now to access the next attribute the code reads the length of the +current attribute and adds that to the current pointer. This is error +prone as bounds checking needs to be performed all over the place. So, +implement a helper and ensure its used across find_attr() and read_attr(). + +This commit does *not* implement full bounds checking. It is just the +preparation work for this to be added into the helper. + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 69 +++++++++++++++++++++++++++++++++++++++++++---------- + include/grub/ntfs.h | 2 ++ + 2 files changed, 58 insertions(+), 13 deletions(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index dbda720e1..1c678f3d0 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -70,6 +70,25 @@ res_attr_data_len (void *res_attr_ptr) + return u32at (res_attr_ptr, 0x10); + } + ++/* Return the next attribute if it exists, otherwise return NULL. */ ++static grub_uint8_t * ++next_attribute (grub_uint8_t *curr_attribute, void *end) ++{ ++ grub_uint8_t *next = curr_attribute; ++ ++ /* ++ * Need to verify we aren't exceeding the end of the buffer by reading the ++ * header for the current attribute ++ */ ++ if (curr_attribute + GRUB_NTFS_ATTRIBUTE_HEADER_SIZE >= (grub_uint8_t *) end) ++ return NULL; ++ ++ next += u16at (curr_attribute, 4); ++ ++ return next; ++} ++ ++ + grub_ntfscomp_func_t grub_ntfscomp_func; + + static grub_err_t +@@ -151,13 +170,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + if (at->flags & GRUB_NTFS_AF_ALST) + { + retry: +- while (at->attr_nxt < at->attr_end) ++ while (at->attr_nxt) + { + at->attr_cur = at->attr_nxt; +- at->attr_nxt += u16at (at->attr_cur, 4); ++ at->attr_nxt = next_attribute (at->attr_cur, at->attr_end); + if ((*at->attr_cur == attr) || (attr == 0)) + { +- grub_uint8_t *new_pos; ++ grub_uint8_t *new_pos, *end; + + if (at->flags & GRUB_NTFS_AF_MMFT) + { +@@ -181,15 +200,36 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + return NULL; + } + ++ /* ++ * Only time emft_bufs is defined is in this function, with this ++ * size. ++ */ ++ grub_size_t emft_buf_size = ++ at->mft->data->mft_size << GRUB_NTFS_BLK_SHR; ++ ++ /* ++ * Needs to be enough space for the successful case to even ++ * bother. ++ */ ++ if (first_attr_off (at->emft_buf) >= (emft_buf_size - 0x18 - 2)) ++ { ++ grub_error (GRUB_ERR_BAD_FS, ++ "can\'t find 0x%X in attribute list", ++ (unsigned char) *at->attr_cur); ++ return NULL; ++ } ++ + new_pos = &at->emft_buf[first_attr_off (at->emft_buf)]; +- while (*new_pos != 0xFF) ++ end = &at->emft_buf[emft_buf_size]; ++ ++ while (new_pos && *new_pos != 0xFF) + { + if ((*new_pos == *at->attr_cur) + && (u16at (new_pos, 0xE) == u16at (at->attr_cur, 0x18))) + { + return new_pos; + } +- new_pos += u16at (new_pos, 4); ++ new_pos = next_attribute (new_pos, end); + } + grub_error (GRUB_ERR_BAD_FS, + "can\'t find 0x%X in attribute list", +@@ -203,7 +243,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + mft_end = at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR); + while (at->attr_cur < mft_end && *at->attr_cur != 0xFF) + { +- at->attr_nxt += u16at (at->attr_cur, 4); ++ at->attr_nxt = next_attribute (at->attr_cur, at->end); + if (*at->attr_cur == GRUB_NTFS_AT_ATTRIBUTE_LIST) + at->attr_end = at->attr_cur; + if ((*at->attr_cur == attr) || (attr == 0)) +@@ -250,13 +290,14 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + /* From this point on pa_end is the end of the buffer */ + at->end = pa_end; + +- while (at->attr_nxt < at->attr_end) ++ while (at->attr_nxt) + { + if ((*at->attr_nxt == attr) || (attr == 0)) + break; +- at->attr_nxt += u16at (at->attr_nxt, 4); ++ at->attr_nxt = next_attribute (at->attr_nxt, pa_end); + } +- if (at->attr_nxt >= at->attr_end) ++ ++ if (at->attr_nxt >= at->attr_end || at->attr_nxt == NULL) + return NULL; + + if ((at->flags & GRUB_NTFS_AF_MMFT) && (attr == GRUB_NTFS_AT_DATA)) +@@ -277,7 +318,8 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + grub_cpu_to_le32 (at->mft->data->mft_start + + 1)); + pa = at->attr_nxt + u16at (pa, 4); +- while (pa < at->attr_end) ++ ++ while (pa) + { + if (*pa != attr) + break; +@@ -293,7 +335,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + u32at (pa, 0x10) * (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR), + at->mft->data->mft_size << GRUB_NTFS_BLK_SHR, 0, 0, 0)) + return NULL; +- pa += u16at (pa, 4); ++ pa = next_attribute (pa, pa_end); + } + at->attr_nxt = at->attr_cur; + at->flags &= ~GRUB_NTFS_AF_GPOS; +@@ -530,14 +572,15 @@ read_attr (struct grub_ntfs_attr *at, grub_uint8_t *dest, grub_disk_addr_t ofs, + else + vcn = ofs >> (at->mft->data->log_spc + GRUB_NTFS_BLK_SHR); + pa = at->attr_nxt + u16at (at->attr_nxt, 4); +- while (pa < at->attr_end) ++ ++ while (pa) + { + if (*pa != attr) + break; + if (u32at (pa, 8) > vcn) + break; + at->attr_nxt = pa; +- pa += u16at (pa, 4); ++ pa = next_attribute (pa, at->attr_end); + } + } + pp = find_attr (at, attr); +diff --git a/include/grub/ntfs.h b/include/grub/ntfs.h +index ec1c4db38..2c8078403 100644 +--- a/include/grub/ntfs.h ++++ b/include/grub/ntfs.h +@@ -89,6 +89,8 @@ enum + #define GRUB_NTFS_COM_SEC (GRUB_NTFS_COM_LEN >> GRUB_NTFS_BLK_SHR) + #define GRUB_NTFS_LOG_COM_SEC (GRUB_NTFS_COM_LOG_LEN - GRUB_NTFS_BLK_SHR) + ++#define GRUB_NTFS_ATTRIBUTE_HEADER_SIZE 16 ++ + enum + { + GRUB_NTFS_AF_ALST = 1, diff --git a/0306-fs-ntfs-Implement-attribute-verification.patch b/0306-fs-ntfs-Implement-attribute-verification.patch new file mode 100644 index 00000000..4ee1c392 --- /dev/null +++ b/0306-fs-ntfs-Implement-attribute-verification.patch @@ -0,0 +1,245 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 14 May 2024 12:39:56 +0100 +Subject: [PATCH] fs/ntfs: Implement attribute verification + +It was possible to read OOB when an attribute had a size that exceeded +the allocated buffer. This resolves that by making sure all attributes +that get read are fully in the allocated space by implementing +a function to validate them. + +Defining the offsets in include/grub/ntfs.h but they are only used in +the validation function and not across the rest of the NTFS code. + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + include/grub/ntfs.h | 22 ++++++++ + 2 files changed, 175 insertions(+) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 1c678f3d0..64f4f2221 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -70,6 +70,149 @@ res_attr_data_len (void *res_attr_ptr) + return u32at (res_attr_ptr, 0x10); + } + ++/* ++ * Check if the attribute is valid and doesn't exceed the allocated region. ++ * This accounts for resident and non-resident data. ++ * ++ * This is based off the documentation from the linux-ntfs project: ++ * https://flatcap.github.io/linux-ntfs/ntfs/concepts/attribute_header.html ++ */ ++static bool ++validate_attribute (grub_uint8_t *attr, void *end) ++{ ++ grub_size_t attr_size = 0; ++ grub_size_t min_size = 0; ++ grub_size_t spare = (grub_uint8_t *) end - attr; ++ /* ++ * Just used as a temporary variable to try and deal with cases where someone ++ * tries to overlap fields. ++ */ ++ grub_size_t curr = 0; ++ ++ /* Need verify we can entirely read the attributes header. */ ++ if (attr + GRUB_NTFS_ATTRIBUTE_HEADER_SIZE >= (grub_uint8_t *) end) ++ goto fail; ++ ++ /* ++ * So, the rest of this code uses a 16bit int for the attribute length but ++ * from reading the all the documentation I could find it says this field is ++ * actually 32bit. But let's be consistent with the rest of the code. ++ * ++ * https://elixir.bootlin.com/linux/v6.10.7/source/fs/ntfs3/ntfs.h#L370 ++ */ ++ attr_size = u16at (attr, GRUB_NTFS_ATTRIBUTE_LENGTH); ++ ++ if (attr_size > spare) ++ goto fail; ++ ++ /* Not an error case, just reached the end of the attributes. */ ++ if (attr_size == 0) ++ return false; ++ ++ /* ++ * Extra validation by trying to calculate a minimum possible size for this ++ * attribute. +8 from the size of the resident data struct which is the ++ * minimum that can be added. ++ */ ++ min_size = GRUB_NTFS_ATTRIBUTE_HEADER_SIZE + 8; ++ ++ if (min_size > attr_size) ++ goto fail; ++ ++ /* Is the data is resident (0) or not (1). */ ++ if (attr[GRUB_NTFS_ATTRIBUTE_RESIDENT] == 0) ++ { ++ /* Read the offset and size of the attribute. */ ++ curr = u16at (attr, GRUB_NTFS_ATTRIBUTE_RES_OFFSET); ++ curr += u32at (attr, GRUB_NTFS_ATTRIBUTE_RES_LENGTH); ++ if (curr > min_size) ++ min_size = curr; ++ } ++ else ++ { ++ /* ++ * If the data is non-resident, the minimum size is 64 which is where ++ * the data runs start. We already have a minimum size of 24. So, just ++ * adding 40 to get to the real value. ++ */ ++ min_size += 40; ++ if (min_size > attr_size) ++ goto fail; ++ /* If the compression unit size is > 0, +8 bytes*/ ++ if (u16at (attr, GRUB_NTFS_ATTRIBUTE_COMPRESSION_UNIT_SIZE) > 0) ++ min_size += 8; ++ ++ /* ++ * Need to consider the data runs now. Each member of the run has byte ++ * that describes the size of the data length and offset. Each being ++ * 4 bits in the byte. ++ */ ++ curr = u16at (attr, GRUB_NTFS_ATTRIBUTE_DATA_RUNS); ++ ++ if (curr + 1 > min_size) ++ min_size = curr + 1; ++ ++ if (min_size > attr_size) ++ goto fail; ++ ++ /* ++ * Each attribute can store multiple data runs which are stored ++ * continuously in the attribute. They exist as one header byte ++ * with up to 14 bytes following it depending on the lengths. ++ * We stop when we hit a header that is just a NUL byte. ++ * ++ * https://flatcap.github.io/linux-ntfs/ntfs/concepts/data_runs.html ++ */ ++ while (attr[curr] != 0) ++ { ++ /* ++ * We stop when we hit a header that is just a NUL byte. The data ++ * run header is stored as a single byte where the top 4 bits refer ++ * to the number of bytes used to store the total length of the ++ * data run, and the number of bytes used to store the offset. ++ * These directly follow the header byte, so we use them to update ++ * the minimum size. ++ */ ++ min_size += (attr[curr] & 0x7) + ((attr[curr] >> 4) & 0x7); ++ curr += min_size; ++ min_size++; ++ if (min_size > attr_size) ++ goto fail; ++ } ++ } ++ ++ /* Name offset, doing this after data residence checks. */ ++ if (u16at (attr, GRUB_NTFS_ATTRIBUTE_NAME_OFFSET) != 0) ++ { ++ curr = u16at (attr, GRUB_NTFS_ATTRIBUTE_NAME_OFFSET); ++ /* ++ * Multiple the name length by 2 as its UTF-16. Can be zero if this in an ++ * unamed attribute. ++ */ ++ curr += attr[GRUB_NTFS_ATTRIBUTE_NAME_LENGTH] * 2; ++ if (curr > min_size) ++ min_size = curr; ++ } ++ ++ /* Padded to 8 bytes. */ ++ if (min_size % 8 != 0) ++ min_size += 8 - (min_size % 8); ++ ++ /* ++ * At this point min_size should be exactly attr_size but being flexible ++ * here to avoid any issues. ++ */ ++ if (min_size > attr_size) ++ goto fail; ++ ++ return true; ++ ++ fail: ++ grub_dprintf ("ntfs", "spare=%" PRIuGRUB_SIZE " min_size=%" PRIuGRUB_SIZE " attr_size=%" PRIuGRUB_SIZE "\n", ++ spare, min_size, attr_size); ++ return false; ++} ++ + /* Return the next attribute if it exists, otherwise return NULL. */ + static grub_uint8_t * + next_attribute (grub_uint8_t *curr_attribute, void *end) +@@ -84,6 +227,8 @@ next_attribute (grub_uint8_t *curr_attribute, void *end) + return NULL; + + next += u16at (curr_attribute, 4); ++ if (validate_attribute (next, end) == false) ++ return NULL; + + return next; + } +@@ -290,6 +435,9 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + /* From this point on pa_end is the end of the buffer */ + at->end = pa_end; + ++ if (validate_attribute (at->attr_nxt, pa_end) == false) ++ return NULL; ++ + while (at->attr_nxt) + { + if ((*at->attr_nxt == attr) || (attr == 0)) +@@ -319,6 +467,9 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) + + 1)); + pa = at->attr_nxt + u16at (pa, 4); + ++ if (validate_attribute (pa, pa_end) == true) ++ pa = NULL; ++ + while (pa) + { + if (*pa != attr) +@@ -572,6 +723,8 @@ read_attr (struct grub_ntfs_attr *at, grub_uint8_t *dest, grub_disk_addr_t ofs, + else + vcn = ofs >> (at->mft->data->log_spc + GRUB_NTFS_BLK_SHR); + pa = at->attr_nxt + u16at (at->attr_nxt, 4); ++ if (validate_attribute (pa, at->attr_end) == false) ++ pa = NULL; + + while (pa) + { +diff --git a/include/grub/ntfs.h b/include/grub/ntfs.h +index 2c8078403..77b182acf 100644 +--- a/include/grub/ntfs.h ++++ b/include/grub/ntfs.h +@@ -91,6 +91,28 @@ enum + + #define GRUB_NTFS_ATTRIBUTE_HEADER_SIZE 16 + ++/* ++ * To make attribute validation clearer the offsets for each value in the ++ * attribute headers are defined as macros. ++ * ++ * These offsets are all from: ++ * https://flatcap.github.io/linux-ntfs/ntfs/concepts/attribute_header.html ++ */ ++ ++/* These offsets are part of the attribute header. */ ++#define GRUB_NTFS_ATTRIBUTE_LENGTH 4 ++#define GRUB_NTFS_ATTRIBUTE_RESIDENT 8 ++#define GRUB_NTFS_ATTRIBUTE_NAME_LENGTH 9 ++#define GRUB_NTFS_ATTRIBUTE_NAME_OFFSET 10 ++ ++/* Offsets for values needed for resident data. */ ++#define GRUB_NTFS_ATTRIBUTE_RES_LENGTH 16 ++#define GRUB_NTFS_ATTRIBUTE_RES_OFFSET 20 ++ ++/* Offsets for values needed for non-resident data. */ ++#define GRUB_NTFS_ATTRIBUTE_DATA_RUNS 32 ++#define GRUB_NTFS_ATTRIBUTE_COMPRESSION_UNIT_SIZE 34 ++ + enum + { + GRUB_NTFS_AF_ALST = 1, diff --git a/0307-fs-xfs-Fix-out-of-bounds-read.patch b/0307-fs-xfs-Fix-out-of-bounds-read.patch new file mode 100644 index 00000000..a71ff511 --- /dev/null +++ b/0307-fs-xfs-Fix-out-of-bounds-read.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Fri, 31 May 2024 15:14:57 +0800 +Subject: [PATCH] fs/xfs: Fix out-of-bounds read + +The number of records in the root key array read from disk was not being +validated against the size of the root node. This could lead to an +out-of-bounds read. + +This patch adds a check to ensure that the number of records in the root +key array does not exceed the expected size of a root node read from +disk. If this check detects an out-of-bounds condition the operation is +aborted to prevent random errors due to metadata corruption. + +Reported-by: Daniel Axtens +Signed-off-by: Michael Chang +Reviewed-by: Daniel Kiper +--- + grub-core/fs/xfs.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 92046f9bd..96f62c5a4 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -595,6 +595,17 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + do + { + grub_uint64_t i; ++ grub_addr_t keys_end, data_end; ++ ++ if (grub_mul (sizeof (grub_uint64_t), nrec, &keys_end) || ++ grub_add ((grub_addr_t) keys, keys_end, &keys_end) || ++ grub_add ((grub_addr_t) node->data, node->data->data_size, &data_end) || ++ keys_end > data_end) ++ { ++ grub_error (GRUB_ERR_BAD_FS, "invalid number of XFS root keys"); ++ grub_free (leaf); ++ return 0; ++ } + + for (i = 0; i < nrec; i++) + { diff --git a/0308-fs-xfs-Ensuring-failing-to-mount-sets-a-grub_errno.patch b/0308-fs-xfs-Ensuring-failing-to-mount-sets-a-grub_errno.patch new file mode 100644 index 00000000..39f0adaa --- /dev/null +++ b/0308-fs-xfs-Ensuring-failing-to-mount-sets-a-grub_errno.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 06:03:58 +0100 +Subject: [PATCH] fs/xfs: Ensuring failing to mount sets a grub_errno + +It was previously possible for grub_xfs_mount() to return NULL without +setting grub_errno if the XFS version was invalid. This resulted in it +being possible for grub_dl_unref() to be called twice allowing the XFS +module to be unloaded while there were still references to it. + +Fixing this problem in general by ensuring a grub_errno is set if the +fail label is reached. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/xfs.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 96f62c5a4..a837f9824 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -327,6 +327,8 @@ static int grub_xfs_sb_valid(struct grub_xfs_data *data) + } + return 1; + } ++ ++ grub_error (GRUB_ERR_BAD_FS, "unsupported XFS filesystem version"); + return 0; + } + +@@ -1068,7 +1070,7 @@ grub_xfs_mount (grub_disk_t disk) + return data; + fail: + +- if (grub_errno == GRUB_ERR_OUT_OF_RANGE) ++ if (grub_errno == GRUB_ERR_OUT_OF_RANGE || grub_errno == GRUB_ERR_NONE) + grub_error (GRUB_ERR_BAD_FS, "not an XFS filesystem"); + + grub_free (data); diff --git a/0309-kern-file-Ensure-file-data-is-set.patch b/0309-kern-file-Ensure-file-data-is-set.patch new file mode 100644 index 00000000..260d1b08 --- /dev/null +++ b/0309-kern-file-Ensure-file-data-is-set.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 03:01:40 +0100 +Subject: [PATCH] kern/file: Ensure file->data is set + +This is to avoid a generic issue were some filesystems would not set +data and also not set a grub_errno. This meant it was possible for many +filesystems to grub_dl_unref() themselves multiple times resulting in +it being possible to unload the filesystems while there were still +references to them, e.g., via a loopback. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/kern/file.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c +index 75510df7c..85e832bd8 100644 +--- a/grub-core/kern/file.c ++++ b/grub-core/kern/file.c +@@ -124,6 +124,9 @@ grub_file_open (const char *name, enum grub_file_type type) + if ((file->fs->fs_open) (file, file_name) != GRUB_ERR_NONE) + goto fail; + ++ if (file->data == NULL) ++ goto fail; ++ + file->name = grub_strdup (name); + grub_errno = GRUB_ERR_NONE; + diff --git a/0310-kern-file-Implement-filesystem-reference-counting.patch b/0310-kern-file-Implement-filesystem-reference-counting.patch new file mode 100644 index 00000000..348bebed --- /dev/null +++ b/0310-kern-file-Implement-filesystem-reference-counting.patch @@ -0,0 +1,440 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 11 Feb 2025 13:44:25 -0600 +Subject: [PATCH] kern/file: Implement filesystem reference counting + +The grub_file_open() and grub_file_close() should be the only places +that allow a reference to a filesystem to stay open. So, add grub_dl_t +to grub_fs_t and set this in the GRUB_MOD_INIT() for each filesystem to +avoid issues when filesystems forget to do it themselves or do not track +their own references, e.g. squash4. + +The fs_label(), fs_uuid(), fs_mtime() and fs_read() should all ref and +unref in the same function but it is essentially redundant in GRUB +single threaded model. + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/fs/affs.c | 1 + + grub-core/fs/bfs.c | 1 + + grub-core/fs/btrfs.c | 1 + + grub-core/fs/cbfs.c | 1 + + grub-core/fs/cpio.c | 1 + + grub-core/fs/cpio_be.c | 1 + + grub-core/fs/ext2.c | 1 + + grub-core/fs/f2fs.c | 1 + + grub-core/fs/fat.c | 1 + + grub-core/fs/hfs.c | 1 + + grub-core/fs/hfsplus.c | 1 + + grub-core/fs/iso9660.c | 1 + + grub-core/fs/jfs.c | 1 + + grub-core/fs/minix.c | 1 + + grub-core/fs/newc.c | 1 + + grub-core/fs/nilfs2.c | 1 + + grub-core/fs/ntfs.c | 1 + + grub-core/fs/odc.c | 1 + + grub-core/fs/proc.c | 1 + + grub-core/fs/reiserfs.c | 1 + + grub-core/fs/romfs.c | 1 + + grub-core/fs/sfs.c | 1 + + grub-core/fs/squash4.c | 1 + + grub-core/fs/tar.c | 1 + + grub-core/fs/udf.c | 1 + + grub-core/fs/ufs.c | 1 + + grub-core/fs/xfs.c | 1 + + grub-core/fs/zfs/zfs.c | 1 + + grub-core/kern/file.c | 7 +++++++ + include/grub/fs.h | 4 ++++ + 30 files changed, 39 insertions(+) + +diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c +index ed606b3f1..9b0afb954 100644 +--- a/grub-core/fs/affs.c ++++ b/grub-core/fs/affs.c +@@ -703,6 +703,7 @@ static struct grub_fs grub_affs_fs = + + GRUB_MOD_INIT(affs) + { ++ grub_affs_fs.mod = mod; + grub_fs_register (&grub_affs_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/bfs.c b/grub-core/fs/bfs.c +index 07cb3e3ac..f37b16895 100644 +--- a/grub-core/fs/bfs.c ++++ b/grub-core/fs/bfs.c +@@ -1106,6 +1106,7 @@ GRUB_MOD_INIT (bfs) + { + COMPILE_TIME_ASSERT (1 << LOG_EXTENT_SIZE == + sizeof (struct grub_bfs_extent)); ++ grub_bfs_fs.mod = mod; + grub_fs_register (&grub_bfs_fs); + } + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index ad35e7575..6593f5175 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -3402,6 +3402,7 @@ subvol_get_env (struct grub_env_var *var __attribute__ ((unused)), + + GRUB_MOD_INIT (btrfs) + { ++ grub_btrfs_fs.mod = mod; + grub_fs_register (&grub_btrfs_fs); + cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, + "DEVICE", +diff --git a/grub-core/fs/cbfs.c b/grub-core/fs/cbfs.c +index 8ab7106af..2332745fe 100644 +--- a/grub-core/fs/cbfs.c ++++ b/grub-core/fs/cbfs.c +@@ -390,6 +390,7 @@ GRUB_MOD_INIT (cbfs) + #if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) && !defined (GRUB_MACHINE_XEN) + init_cbfsdisk (); + #endif ++ grub_cbfs_fs.mod = mod; + grub_fs_register (&grub_cbfs_fs); + } + +diff --git a/grub-core/fs/cpio.c b/grub-core/fs/cpio.c +index dab5f9898..1799f7ff5 100644 +--- a/grub-core/fs/cpio.c ++++ b/grub-core/fs/cpio.c +@@ -52,6 +52,7 @@ read_number (const grub_uint16_t *arr, grub_size_t size) + + GRUB_MOD_INIT (cpio) + { ++ grub_cpio_fs.mod = mod; + grub_fs_register (&grub_cpio_fs); + } + +diff --git a/grub-core/fs/cpio_be.c b/grub-core/fs/cpio_be.c +index 846548892..7bed1b848 100644 +--- a/grub-core/fs/cpio_be.c ++++ b/grub-core/fs/cpio_be.c +@@ -52,6 +52,7 @@ read_number (const grub_uint16_t *arr, grub_size_t size) + + GRUB_MOD_INIT (cpio_be) + { ++ grub_cpio_fs.mod = mod; + grub_fs_register (&grub_cpio_fs); + } + +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index 3f9f6b208..c3058f7e7 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -1131,6 +1131,7 @@ static struct grub_fs grub_ext2_fs = + + GRUB_MOD_INIT(ext2) + { ++ grub_ext2_fs.mod = mod; + grub_fs_register (&grub_ext2_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c +index db8a65f8d..f6d6beaa5 100644 +--- a/grub-core/fs/f2fs.c ++++ b/grub-core/fs/f2fs.c +@@ -1353,6 +1353,7 @@ static struct grub_fs grub_f2fs_fs = { + + GRUB_MOD_INIT (f2fs) + { ++ grub_f2fs_fs.mod = mod; + grub_fs_register (&grub_f2fs_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c +index c5efed724..6e62b915d 100644 +--- a/grub-core/fs/fat.c ++++ b/grub-core/fs/fat.c +@@ -1312,6 +1312,7 @@ GRUB_MOD_INIT(fat) + #endif + { + COMPILE_TIME_ASSERT (sizeof (struct grub_fat_dir_entry) == 32); ++ grub_fat_fs.mod = mod; + grub_fs_register (&grub_fat_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c +index 920112b03..ce7581dd5 100644 +--- a/grub-core/fs/hfs.c ++++ b/grub-core/fs/hfs.c +@@ -1434,6 +1434,7 @@ static struct grub_fs grub_hfs_fs = + + GRUB_MOD_INIT(hfs) + { ++ grub_hfs_fs.mod = mod; + if (!grub_is_lockdown ()) + grub_fs_register (&grub_hfs_fs); + my_mod = mod; +diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c +index de71fd486..3f203abcc 100644 +--- a/grub-core/fs/hfsplus.c ++++ b/grub-core/fs/hfsplus.c +@@ -1176,6 +1176,7 @@ static struct grub_fs grub_hfsplus_fs = + + GRUB_MOD_INIT(hfsplus) + { ++ grub_hfsplus_fs.mod = mod; + grub_fs_register (&grub_hfsplus_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c +index 8e3c95c4f..c73cb9ce0 100644 +--- a/grub-core/fs/iso9660.c ++++ b/grub-core/fs/iso9660.c +@@ -1260,6 +1260,7 @@ static struct grub_fs grub_iso9660_fs = + + GRUB_MOD_INIT(iso9660) + { ++ grub_iso9660_fs.mod = mod; + grub_fs_register (&grub_iso9660_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c +index 70a2f4947..b0283ac00 100644 +--- a/grub-core/fs/jfs.c ++++ b/grub-core/fs/jfs.c +@@ -1005,6 +1005,7 @@ static struct grub_fs grub_jfs_fs = + + GRUB_MOD_INIT(jfs) + { ++ grub_jfs_fs.mod = mod; + grub_fs_register (&grub_jfs_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c +index 5354951d1..b7679c3e2 100644 +--- a/grub-core/fs/minix.c ++++ b/grub-core/fs/minix.c +@@ -734,6 +734,7 @@ GRUB_MOD_INIT(minix) + #endif + #endif + { ++ grub_minix_fs.mod = mod; + grub_fs_register (&grub_minix_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/newc.c b/grub-core/fs/newc.c +index 4fb8b2e3d..43b7f8b64 100644 +--- a/grub-core/fs/newc.c ++++ b/grub-core/fs/newc.c +@@ -64,6 +64,7 @@ read_number (const char *str, grub_size_t size) + + GRUB_MOD_INIT (newc) + { ++ grub_cpio_fs.mod = mod; + grub_fs_register (&grub_cpio_fs); + } + +diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c +index fc7374ead..4e1e71738 100644 +--- a/grub-core/fs/nilfs2.c ++++ b/grub-core/fs/nilfs2.c +@@ -1231,6 +1231,7 @@ GRUB_MOD_INIT (nilfs2) + grub_nilfs2_dat_entry)); + COMPILE_TIME_ASSERT (1 << LOG_INODE_SIZE + == sizeof (struct grub_nilfs2_inode)); ++ grub_nilfs2_fs.mod = mod; + grub_fs_register (&grub_nilfs2_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 64f4f2221..4e144cc3c 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -1541,6 +1541,7 @@ static struct grub_fs grub_ntfs_fs = + + GRUB_MOD_INIT (ntfs) + { ++ grub_ntfs_fs.mod = mod; + grub_fs_register (&grub_ntfs_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/odc.c b/grub-core/fs/odc.c +index 790000622..8e4e8aeac 100644 +--- a/grub-core/fs/odc.c ++++ b/grub-core/fs/odc.c +@@ -52,6 +52,7 @@ read_number (const char *str, grub_size_t size) + + GRUB_MOD_INIT (odc) + { ++ grub_cpio_fs.mod = mod; + grub_fs_register (&grub_cpio_fs); + } + +diff --git a/grub-core/fs/proc.c b/grub-core/fs/proc.c +index 5f516502d..bcde43349 100644 +--- a/grub-core/fs/proc.c ++++ b/grub-core/fs/proc.c +@@ -192,6 +192,7 @@ static struct grub_fs grub_procfs_fs = + + GRUB_MOD_INIT (procfs) + { ++ grub_procfs_fs.mod = mod; + grub_disk_dev_register (&grub_procfs_dev); + grub_fs_register (&grub_procfs_fs); + } +diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c +index 42818c376..e8b0b6383 100644 +--- a/grub-core/fs/reiserfs.c ++++ b/grub-core/fs/reiserfs.c +@@ -1407,6 +1407,7 @@ static struct grub_fs grub_reiserfs_fs = + + GRUB_MOD_INIT(reiserfs) + { ++ grub_reiserfs_fs.mod = mod; + grub_fs_register (&grub_reiserfs_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/romfs.c b/grub-core/fs/romfs.c +index 1f7dcfca1..56b0b2b2f 100644 +--- a/grub-core/fs/romfs.c ++++ b/grub-core/fs/romfs.c +@@ -475,6 +475,7 @@ static struct grub_fs grub_romfs_fs = + + GRUB_MOD_INIT(romfs) + { ++ grub_romfs_fs.mod = mod; + grub_fs_register (&grub_romfs_fs); + } + +diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c +index 983e88008..f0d7cac43 100644 +--- a/grub-core/fs/sfs.c ++++ b/grub-core/fs/sfs.c +@@ -779,6 +779,7 @@ static struct grub_fs grub_sfs_fs = + + GRUB_MOD_INIT(sfs) + { ++ grub_sfs_fs.mod = mod; + grub_fs_register (&grub_sfs_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c +index a30e6ebe1..6e9d63874 100644 +--- a/grub-core/fs/squash4.c ++++ b/grub-core/fs/squash4.c +@@ -1044,6 +1044,7 @@ static struct grub_fs grub_squash_fs = + + GRUB_MOD_INIT(squash4) + { ++ grub_squash_fs.mod = mod; + grub_fs_register (&grub_squash_fs); + } + +diff --git a/grub-core/fs/tar.c b/grub-core/fs/tar.c +index 386c09022..fd2ec1f74 100644 +--- a/grub-core/fs/tar.c ++++ b/grub-core/fs/tar.c +@@ -354,6 +354,7 @@ static struct grub_fs grub_cpio_fs = { + + GRUB_MOD_INIT (tar) + { ++ grub_cpio_fs.mod = mod; + grub_fs_register (&grub_cpio_fs); + } + +diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c +index b836e6107..8765c633c 100644 +--- a/grub-core/fs/udf.c ++++ b/grub-core/fs/udf.c +@@ -1455,6 +1455,7 @@ static struct grub_fs grub_udf_fs = { + + GRUB_MOD_INIT (udf) + { ++ grub_udf_fs.mod = mod; + grub_fs_register (&grub_udf_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c +index 01235101b..e82d9356d 100644 +--- a/grub-core/fs/ufs.c ++++ b/grub-core/fs/ufs.c +@@ -899,6 +899,7 @@ GRUB_MOD_INIT(ufs1) + #endif + #endif + { ++ grub_ufs_fs.mod = mod; + grub_fs_register (&grub_ufs_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index a837f9824..6c952aef1 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -1304,6 +1304,7 @@ static struct grub_fs grub_xfs_fs = + + GRUB_MOD_INIT(xfs) + { ++ grub_xfs_fs.mod = mod; + grub_fs_register (&grub_xfs_fs); + my_mod = mod; + } +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index b5453e006..a497b1869 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -4424,6 +4424,7 @@ static struct grub_fs grub_zfs_fs = { + GRUB_MOD_INIT (zfs) + { + COMPILE_TIME_ASSERT (sizeof (zap_leaf_chunk_t) == ZAP_LEAF_CHUNKSIZE); ++ grub_zfs_fs.mod = mod; + grub_fs_register (&grub_zfs_fs); + #ifndef GRUB_UTIL + my_mod = mod; +diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c +index 85e832bd8..ec90a26ba 100644 +--- a/grub-core/kern/file.c ++++ b/grub-core/kern/file.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + void (*EXPORT_VAR (grub_grubnet_fini)) (void); + +@@ -127,6 +128,9 @@ grub_file_open (const char *name, enum grub_file_type type) + if (file->data == NULL) + goto fail; + ++ if (file->fs->mod) ++ grub_dl_ref (file->fs->mod); ++ + file->name = grub_strdup (name); + grub_errno = GRUB_ERR_NONE; + +@@ -219,6 +223,9 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) + grub_err_t + grub_file_close (grub_file_t file) + { ++ if (file->fs->mod) ++ grub_dl_unref (file->fs->mod); ++ + grub_dprintf ("file", "Closing `%s' ...\n", file->name); + if (file->fs->fs_close) + (file->fs->fs_close) (file); +diff --git a/include/grub/fs.h b/include/grub/fs.h +index 026bc3bb8..df4c93b16 100644 +--- a/include/grub/fs.h ++++ b/include/grub/fs.h +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #include + /* For embedding types. */ +@@ -57,6 +58,9 @@ struct grub_fs + /* My name. */ + const char *name; + ++ /* My module */ ++ grub_dl_t mod; ++ + /* Call HOOK with each file under DIR. */ + grub_err_t (*fs_dir) (grub_device_t device, const char *path, + grub_fs_dir_hook_t hook, void *hook_data); diff --git a/0311-cli_lock-Add-build-option-to-block-command-line-inte.patch b/0311-cli_lock-Add-build-option-to-block-command-line-inte.patch new file mode 100644 index 00000000..3c7d6414 --- /dev/null +++ b/0311-cli_lock-Add-build-option-to-block-command-line-inte.patch @@ -0,0 +1,366 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Wed, 24 Jan 2024 06:26:37 +0000 +Subject: [PATCH] cli_lock: Add build option to block command line interface + +Add functionality to disable command line interface access and editing of GRUB +menu entries if GRUB image is built with --disable-cli. + +Signed-off-by: Alec Brown +Reviewed-by: Vladimir Serbinenko +Reviewed-by: Daniel Kiper +--- + docs/grub.texi | 6 ++++-- + grub-core/kern/main.c | 28 ++++++++++++++++++++++++++++ + grub-core/kern/rescue_reader.c | 13 +++++++++++++ + grub-core/normal/auth.c | 3 +++ + grub-core/normal/menu_text.c | 31 +++++++++++++++++-------------- + include/grub/kernel.h | 1 + + include/grub/misc.h | 2 ++ + include/grub/util/install.h | 8 ++++++-- + util/grub-install-common.c | 10 ++++++++-- + util/grub-mkimage.c | 9 ++++++++- + util/mkimage.c | 15 ++++++++++++++- + 11 files changed, 104 insertions(+), 22 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 096a3cde0..9ce9c5b82 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -6520,8 +6520,10 @@ the GRUB command line, edit menu entries, and execute any menu entry. If + @samp{superusers} is set, then use of the command line and editing of menu + entries are automatically restricted to superusers. Setting @samp{superusers} + to empty string effectively disables both access to CLI and editing of menu +-entries. Note: The environment variable needs to be exported to also affect +-the section defined by the @samp{submenu} command (@pxref{submenu}). ++entries. Building a grub image with @samp{--disable-cli} option will also ++disable access to CLI and editing of menu entries, as well as disabling rescue ++mode. Note: The environment variable needs to be exported to also affect the ++section defined by the @samp{submenu} command (@pxref{submenu}). + + Other users may be allowed to execute specific menu entries by giving a list of + usernames (as above) using the @option{--users} option to the +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index 8e89763f4..0d6b8138d 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -30,11 +30,14 @@ + #include + #include + #include ++#include + + #ifdef GRUB_MACHINE_PCBIOS + #include + #endif + ++static bool cli_disabled = false; ++ + grub_addr_t + grub_modules_get_end (void) + { +@@ -299,6 +302,28 @@ grub_load_normal_mode (void) + grub_command_execute ("normal", 0, 0); + } + ++bool ++grub_is_cli_disabled (void) ++{ ++ return cli_disabled; ++} ++ ++static void ++check_is_cli_disabled (void) ++{ ++ struct grub_module_header *header; ++ header = 0; ++ ++ FOR_MODULES (header) ++ { ++ if (header->type == OBJ_TYPE_DISABLE_CLI) ++ { ++ cli_disabled = true; ++ return; ++ } ++ } ++} ++ + static void + reclaim_module_space (void) + { +@@ -356,6 +381,9 @@ grub_main (void) + + grub_boot_time ("After loading embedded modules."); + ++ /* Check if the CLI should be disabled */ ++ check_is_cli_disabled (); ++ + /* It is better to set the root device as soon as possible, + for convenience. */ + grub_set_prefix_and_root (); +diff --git a/grub-core/kern/rescue_reader.c b/grub-core/kern/rescue_reader.c +index dcd7d4439..4259857ba 100644 +--- a/grub-core/kern/rescue_reader.c ++++ b/grub-core/kern/rescue_reader.c +@@ -78,6 +78,19 @@ grub_rescue_read_line (char **line, int cont, + void __attribute__ ((noreturn)) + grub_rescue_run (void) + { ++ /* Stall if the CLI has been disabled */ ++ if (grub_is_cli_disabled ()) ++ { ++ grub_printf ("Rescue mode has been disabled...\n"); ++ ++ do ++ { ++ /* Do not optimize out the loop. */ ++ asm volatile (""); ++ } ++ while (1); ++ } ++ + grub_printf ("Entering rescue mode...\n"); + + while (1) +diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c +index 517fc623f..d94020186 100644 +--- a/grub-core/normal/auth.c ++++ b/grub-core/normal/auth.c +@@ -209,6 +209,9 @@ grub_auth_check_authentication (const char *userlist) + char entered[GRUB_AUTH_MAX_PASSLEN]; + struct grub_auth_user *user; + ++ if (grub_is_cli_disabled ()) ++ return GRUB_ACCESS_DENIED; ++ + grub_memset (login, 0, sizeof (login)); + + if (is_authenticated (userlist)) +diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c +index b1321eb26..9c383e64a 100644 +--- a/grub-core/normal/menu_text.c ++++ b/grub-core/normal/menu_text.c +@@ -178,21 +178,24 @@ command-line or ESC to discard edits and return to the GRUB menu."), + + grub_free (msg_translated); + +- if (nested) ++ if (!grub_is_cli_disabled ()) + { +- ret += grub_print_message_indented_real +- (_("Press enter to boot the selected OS, " +- "`e' to edit the commands before booting " +- "or `c' for a command-line. ESC to return previous menu."), +- STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); +- } +- else +- { +- ret += grub_print_message_indented_real +- (_("Press enter to boot the selected OS, " +- "`e' to edit the commands before booting " +- "or `c' for a command-line."), +- STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); ++ if (nested) ++ { ++ ret += grub_print_message_indented_real ++ (_("Press enter to boot the selected OS, " ++ "`e' to edit the commands before booting " ++ "or `c' for a command-line. ESC to return previous menu."), ++ STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); ++ } ++ else ++ { ++ ret += grub_print_message_indented_real ++ (_("Press enter to boot the selected OS, " ++ "`e' to edit the commands before booting " ++ "or `c' for a command-line."), ++ STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); ++ } + } + } + return ret; +diff --git a/include/grub/kernel.h b/include/grub/kernel.h +index 98edc0863..f98a780da 100644 +--- a/include/grub/kernel.h ++++ b/include/grub/kernel.h +@@ -33,6 +33,7 @@ enum + OBJ_TYPE_DISABLE_SHIM_LOCK, + OBJ_TYPE_GPG_PUBKEY, + OBJ_TYPE_X509_PUBKEY, ++ OBJ_TYPE_DISABLE_CLI + }; + + /* The module header. */ +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 6b1e084af..d6e9bae8e 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -442,6 +442,8 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, + grub_uint64_t d, + grub_uint64_t *r); + ++extern bool EXPORT_FUNC(grub_is_cli_disabled) (void); ++ + /* Must match softdiv group in gentpl.py. */ + #if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__ia64__) || \ + (defined(__riscv) && (__riscv_xlen == 32))) +diff --git a/include/grub/util/install.h b/include/grub/util/install.h +index 59eabb9bb..dbf3c216d 100644 +--- a/include/grub/util/install.h ++++ b/include/grub/util/install.h +@@ -72,6 +72,8 @@ + { "appended-signature-size", GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE,\ + "SIZE", 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), \ + 1}, \ ++ { "disable-cli", GRUB_INSTALL_OPTIONS_DISABLE_CLI, 0, 0, \ ++ N_("disabled command line interface access"), 0 }, \ + { "verbose", 'v', 0, 0, \ + N_("print verbose messages."), 1 } + +@@ -135,7 +137,8 @@ enum grub_install_options { + GRUB_INSTALL_OPTIONS_DTB, + GRUB_INSTALL_OPTIONS_SBAT, + GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, +- GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE ++ GRUB_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE, ++ GRUB_INSTALL_OPTIONS_DISABLE_CLI + }; + + extern char *grub_install_source_directory; +@@ -198,7 +201,8 @@ grub_install_generate_image (const char *dir, const char *prefix, + const struct grub_install_image_target_desc *image_target, + int note, size_t appsig_size, + grub_compression_t comp, const char *dtb_file, +- const char *sbat_path, const int disable_shim_lock); ++ const char *sbat_path, const int disable_shim_lock, ++ const int disable_cli); + + const struct grub_install_image_target_desc * + grub_install_get_image_target (const char *arg); +diff --git a/util/grub-install-common.c b/util/grub-install-common.c +index 67afc2eed..42aec141e 100644 +--- a/util/grub-install-common.c ++++ b/util/grub-install-common.c +@@ -469,6 +469,7 @@ static char **x509keys; + static size_t nx509keys; + static grub_compression_t compression; + static size_t appsig_size; ++static int disable_cli; + + int + grub_install_parse (int key, char *arg) +@@ -514,6 +515,9 @@ grub_install_parse (int key, char *arg) + * (nx509keys + 1)); + x509keys[nx509keys++] = xstrdup (arg); + return 1; ++ case GRUB_INSTALL_OPTIONS_DISABLE_CLI: ++ disable_cli = 1; ++ return 1; + + case GRUB_INSTALL_OPTIONS_VERBOSITY: + verbosity++; +@@ -708,11 +712,13 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + grub_util_info ("grub-mkimage --directory '%s' --prefix '%s' --output '%s'" + " --format '%s' --compression '%s'" + " --appended-signture-size %zu %s%s%s\n", ++ " --format '%s' --compression '%s'%s%s%s%s\n", + dir, prefix, outname, + mkimage_target, compnames[compression], + appsig_size, + note ? " --note" : "", +- disable_shim_lock ? " --disable-shim-lock" : "", s); ++ disable_shim_lock ? " --disable-shim-lock" : "", ++ disable_cli ? " --disable-cli" : "", s); + free (s); + + tgt = grub_install_get_image_target (mkimage_target); +@@ -725,7 +731,7 @@ grub_install_make_image_wrap_file (const char *dir, const char *prefix, + x509keys, nx509keys, + config_path, tgt, + note, appsig_size, compression, dtb, sbat, +- disable_shim_lock); ++ disable_shim_lock, disable_cli); + while (dc--) + grub_install_pop_module (); + } +diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c +index e1f111278..13bdc6cf0 100644 +--- a/util/grub-mkimage.c ++++ b/util/grub-mkimage.c +@@ -84,6 +84,7 @@ static struct argp_option options[] = { + {"compression", 'C', "(xz|none|auto)", 0, N_("choose the compression to use for core image"), 0}, + {"sbat", 's', N_("FILE"), 0, N_("SBAT metadata"), 0}, + {"disable-shim-lock", GRUB_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, 0, 0, N_("disable shim_lock verifier"), 0}, ++ {"disable-cli", GRUB_INSTALL_OPTIONS_DISABLE_CLI, 0, 0, N_("disable command line interface access"), 0}, + {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, + {"appended-signature-size", 'S', N_("SIZE"), 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), 0}, + { 0, 0, 0, 0, 0, 0 } +@@ -133,6 +134,7 @@ struct arguments + int note; + int disable_shim_lock; + size_t appsig_size; ++ int disable_cli; + const struct grub_install_image_target_desc *image_target; + grub_compression_t comp; + }; +@@ -259,6 +261,10 @@ argp_parser (int key, char *arg, struct argp_state *state) + arguments->disable_shim_lock = 1; + break; + ++ case GRUB_INSTALL_OPTIONS_DISABLE_CLI: ++ arguments->disable_cli = 1; ++ break; ++ + case 'v': + verbosity++; + break; +@@ -347,7 +353,8 @@ main (int argc, char *argv[]) + arguments.image_target, arguments.note, + arguments.appsig_size, arguments.comp, + arguments.dtb, arguments.sbat, +- arguments.disable_shim_lock); ++ arguments.disable_shim_lock, ++ arguments.disable_cli); + + if (grub_util_file_sync (fp) < 0) + grub_util_error (_("cannot sync `%s': %s"), arguments.output ? : "stdout", +diff --git a/util/mkimage.c b/util/mkimage.c +index 425d920ff..f31fdefa8 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -888,7 +888,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + const struct grub_install_image_target_desc *image_target, + int note, size_t appsig_size, grub_compression_t comp, + const char *dtb_path, const char *sbat_path, +- int disable_shim_lock) ++ int disable_shim_lock, int disable_cli) + { + char *kernel_img, *core_img; + size_t total_module_size, core_size; +@@ -963,6 +963,9 @@ grub_install_generate_image (const char *dir, const char *prefix, + if (disable_shim_lock) + total_module_size += sizeof (struct grub_module_header); + ++ if (disable_cli) ++ total_module_size += sizeof (struct grub_module_header); ++ + if (config_path) + { + config_size = ALIGN_ADDR (grub_util_get_image_size (config_path) + 1); +@@ -1129,6 +1132,16 @@ grub_install_generate_image (const char *dir, const char *prefix, + offset += sizeof (*header); + } + ++ if (disable_cli) ++ { ++ struct grub_module_header *header; ++ ++ header = (struct grub_module_header *) (kernel_img + offset); ++ header->type = grub_host_to_target32 (OBJ_TYPE_DISABLE_CLI); ++ header->size = grub_host_to_target32 (sizeof (*header)); ++ offset += sizeof (*header); ++ } ++ + if (config_path) + { + struct grub_module_header *header; diff --git a/0312-disk-cryptodisk-Require-authentication-after-TPM-unl.patch b/0312-disk-cryptodisk-Require-authentication-after-TPM-unl.patch new file mode 100644 index 00000000..2c2396ad --- /dev/null +++ b/0312-disk-cryptodisk-Require-authentication-after-TPM-unl.patch @@ -0,0 +1,337 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Tue, 11 Feb 2025 15:08:06 -0600 +Subject: [PATCH] disk/cryptodisk: Require authentication after TPM unlock for + CLI access + +The GRUB may use TPM to verify the integrity of boot components and the +result can determine whether a previously sealed key can be released. If +everything checks out, showing nothing has been tampered with, the key +is released and GRUB unlocks the encrypted root partition for the next +stage of booting. + +However, the liberal Command Line Interface (CLI) can be misused by +anyone in this case to access files in the encrypted partition one way +or another. Despite efforts to keep the CLI secure by preventing utility +command output from leaking file content, many techniques in the wild +could still be used to exploit the CLI, enabling attacks or learning +methods to attack. It's nearly impossible to account for all scenarios +where a hack could be applied. + +Therefore, to mitigate potential misuse of the CLI after the root device +has been successfully unlocked via TPM, the user should be required to +authenticate using the LUKS password. This added layer of security +ensures that only authorized users can access the CLI reducing the risk +of exploitation or unauthorized access to the encrypted partition. + +Fixes: CVE-2024-49504 + +Signed-off-by: Michael Chang +Reviewed-by: Daniel Kiper +--- + docs/grub.texi | 29 +++++++++++++++ + grub-core/disk/cryptodisk.c | 87 ++++++++++++++++++++++++++++++++++++++++++- + grub-core/kern/main.c | 12 ++++++ + grub-core/normal/auth.c | 30 +++++++++++++++ + grub-core/normal/main.c | 4 ++ + grub-core/normal/menu_entry.c | 4 ++ + include/grub/auth.h | 1 + + include/grub/cryptodisk.h | 3 ++ + include/grub/misc.h | 2 + + 9 files changed, 171 insertions(+), 1 deletion(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 9ce9c5b82..2d6d73a78 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -6882,6 +6882,35 @@ sign-file SHA256 grub.key certificate.der core.elf.unsigned core.elf.signed + As with UEFI secure boot, it is necessary to build in the required modules, + or sign them separately. + ++@subsection Command line and menuentry editor protection ++ ++The TPM key protector provides full disk encryption support on servers or ++virtual machine images, meanwhile keeping the boot process unattended. This ++prevents service disruptions by eliminating the need for manual password input ++during startup, improving system uptime and continuity. It is achieved by TPM, ++which verifies the integrity of boot components by checking cryptographic ++hashes against securely stored values, to confirm the disks are unlocked in a ++trusted state. ++ ++However, for users to access the system interactively, some form of ++authentication is still required, as the disks are not unlocked by an ++authorized user. This raised concerns about using an unprotected ++@samp{command-line interface} (@pxref{Command-line interface}), as anyone could ++execute commands to access decrypted data. To address this issue, the LUKS ++password is used to ensure that only authorized users are granted access to the ++interface. Additionally, the @samp{menu entry editor} (@pxref{Menu entry ++editor}) is also safeguarded by the LUKS password, as modifying a boot entry is ++effectively the same as altering the @file{grub.cfg} file read from encrypted ++files. ++ ++It is worth mentioning that the built-in password support, as described in ++@samp{Authentication and Authorization in GRUB} (@pxref{Authentication and ++authorisation}), can also be used to protect the command-line interface from ++unauthorized access. However, it is not recommended to rely on this approach as ++it is an optional step. Setting it up requires additional manual intervention, ++which increases the risk of password leakage during the process. Moreover, the ++superuser list must be well maintained, and the password used cannot be ++synchronized with LUKS key rotation. + + @node Platform limitations + @chapter Platform limitations +diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c +index 98e176a13..06a42b2d7 100644 +--- a/grub-core/disk/cryptodisk.c ++++ b/grub-core/disk/cryptodisk.c +@@ -1144,7 +1144,9 @@ grub_cryptodisk_scan_device_real (const char *name, + ret = grub_cryptodisk_insert (dev, name, source); + if (ret != GRUB_ERR_NONE) + goto error; +- ++#ifndef GRUB_UTIL ++ grub_cli_set_auth_needed (); ++#endif + goto cleanup; + } + grub_error (GRUB_ERR_BAD_MODULE, "no cryptodisk module can handle this device"); +@@ -1576,6 +1578,89 @@ luks_script_get (grub_size_t *sz) + return ret; + } + ++#ifdef GRUB_MACHINE_EFI ++grub_err_t ++grub_cryptodisk_challenge_password (void) ++{ ++ grub_cryptodisk_t cr_dev; ++ ++ for (cr_dev = cryptodisk_list; cr_dev != NULL; cr_dev = cr_dev->next) ++ { ++ grub_cryptodisk_dev_t cr; ++ grub_disk_t source = NULL; ++ grub_err_t ret = GRUB_ERR_NONE; ++ grub_cryptodisk_t dev = NULL; ++ char *part = NULL; ++ struct grub_cryptomount_args cargs = {0}; ++ ++ cargs.check_boot = 0; ++ cargs.search_uuid = cr_dev->uuid; ++ ++ source = grub_disk_open (cr_dev->source); ++ ++ if (source == NULL) ++ { ++ ret = grub_errno; ++ goto error_out; ++ } ++ ++ FOR_CRYPTODISK_DEVS (cr) ++ { ++ dev = cr->scan (source, &cargs); ++ if (grub_errno) ++ { ++ ret = grub_errno; ++ goto error_out; ++ } ++ if (dev == NULL) ++ continue; ++ break; ++ } ++ ++ if (dev == NULL) ++ { ++ ret = grub_error (GRUB_ERR_BAD_MODULE, "no cryptodisk module can handle this device"); ++ goto error_out; ++ } ++ ++ part = grub_partition_get_name (source->partition); ++ grub_printf_ (N_("Enter passphrase for %s%s%s (%s): "), source->name, ++ source->partition != NULL ? "," : "", ++ part != NULL ? part : N_("UNKNOWN"), cr_dev->uuid); ++ grub_free (part); ++ ++ cargs.key_data = grub_malloc (GRUB_CRYPTODISK_MAX_PASSPHRASE); ++ if (cargs.key_data == NULL) ++ { ++ ret = grub_errno; ++ goto error_out; ++ } ++ ++ if (!grub_password_get ((char *) cargs.key_data, GRUB_CRYPTODISK_MAX_PASSPHRASE)) ++ { ++ ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "passphrase not supplied"); ++ goto error_out; ++ } ++ cargs.key_len = grub_strlen ((char *) cargs.key_data); ++ ret = cr->recover_key (source, dev, &cargs); ++ ++ error_out: ++ grub_disk_close (source); ++ if (dev != NULL) ++ cryptodisk_close (dev); ++ if (cargs.key_data) ++ { ++ grub_memset (cargs.key_data, 0, cargs.key_len); ++ grub_free (cargs.key_data); ++ } ++ ++ return ret; ++ } ++ ++ return GRUB_ERR_NONE; ++} ++#endif /* GRUB_MACHINE_EFI */ ++ + struct grub_procfs_entry luks_script = + { + .name = "luks_script", +diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c +index 0d6b8138d..2e6b79ee3 100644 +--- a/grub-core/kern/main.c ++++ b/grub-core/kern/main.c +@@ -37,6 +37,7 @@ + #endif + + static bool cli_disabled = false; ++static bool cli_need_auth = false; + + grub_addr_t + grub_modules_get_end (void) +@@ -308,6 +309,17 @@ grub_is_cli_disabled (void) + return cli_disabled; + } + ++bool ++grub_is_cli_need_auth (void) ++{ ++ return cli_need_auth; ++} ++ ++void grub_cli_set_auth_needed (void) ++{ ++ cli_need_auth = true; ++} ++ + static void + check_is_cli_disabled (void) + { +diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c +index d94020186..71b361bc0 100644 +--- a/grub-core/normal/auth.c ++++ b/grub-core/normal/auth.c +@@ -25,6 +25,10 @@ + #include + #include + ++#ifdef GRUB_MACHINE_EFI ++#include ++#endif ++ + struct grub_auth_user + { + struct grub_auth_user *next; +@@ -200,6 +204,32 @@ grub_username_get (char buf[], unsigned buf_size) + return (key != GRUB_TERM_ESC); + } + ++grub_err_t ++grub_auth_check_cli_access (void) ++{ ++ if (grub_is_cli_need_auth () == true) ++ { ++#ifdef GRUB_MACHINE_EFI ++ static bool authenticated = false; ++ ++ if (authenticated == false) ++ { ++ grub_err_t ret; ++ ++ ret = grub_cryptodisk_challenge_password (); ++ if (ret == GRUB_ERR_NONE) ++ authenticated = true; ++ return ret; ++ } ++ return GRUB_ERR_NONE; ++#else ++ return GRUB_ACCESS_DENIED; ++#endif ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ + grub_err_t + grub_auth_check_authentication (const char *userlist) + { +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index 26872ce94..86ffb388d 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -557,9 +557,13 @@ grub_cmdline_run (int nested, int force_auth) + } + while (err && force_auth); + ++ if (err == GRUB_ERR_NONE) ++ err = grub_auth_check_cli_access (); ++ + if (err) + { + grub_print_error (); ++ grub_wait_after_message (); + grub_errno = GRUB_ERR_NONE; + return; + } +diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c +index ade56be2b..8b0d17e3f 100644 +--- a/grub-core/normal/menu_entry.c ++++ b/grub-core/normal/menu_entry.c +@@ -1255,9 +1255,13 @@ grub_menu_entry_run (grub_menu_entry_t entry) + + err = grub_auth_check_authentication (NULL); + ++ if (err == GRUB_ERR_NONE) ++ err = grub_auth_check_cli_access (); ++ + if (err) + { + grub_print_error (); ++ grub_wait_after_message (); + grub_errno = GRUB_ERR_NONE; + return; + } +diff --git a/include/grub/auth.h b/include/grub/auth.h +index 747334451..21d5190f0 100644 +--- a/include/grub/auth.h ++++ b/include/grub/auth.h +@@ -33,5 +33,6 @@ grub_err_t grub_auth_unregister_authentication (const char *user); + grub_err_t grub_auth_authenticate (const char *user); + grub_err_t grub_auth_deauthenticate (const char *user); + grub_err_t grub_auth_check_authentication (const char *userlist); ++grub_err_t grub_auth_check_cli_access (void); + + #endif /* ! GRUB_AUTH_HEADER */ +diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h +index d94df68b6..d2572f8b0 100644 +--- a/include/grub/cryptodisk.h ++++ b/include/grub/cryptodisk.h +@@ -187,4 +187,7 @@ grub_util_get_geli_uuid (const char *dev); + grub_cryptodisk_t grub_cryptodisk_get_by_uuid (const char *uuid); + grub_cryptodisk_t grub_cryptodisk_get_by_source_disk (grub_disk_t disk); + ++#ifdef GRUB_MACHINE_EFI ++grub_err_t grub_cryptodisk_challenge_password (void); ++#endif + #endif +diff --git a/include/grub/misc.h b/include/grub/misc.h +index d6e9bae8e..0429339ef 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -443,6 +443,8 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, + grub_uint64_t *r); + + extern bool EXPORT_FUNC(grub_is_cli_disabled) (void); ++extern bool EXPORT_FUNC(grub_is_cli_need_auth) (void); ++extern void EXPORT_FUNC(grub_cli_set_auth_needed) (void); + + /* Must match softdiv group in gentpl.py. */ + #if !defined(GRUB_MACHINE_EMU) && (defined(__arm__) || defined(__ia64__) || \ diff --git a/0313-disk-loopback-Reference-tracking-for-the-loopback.patch b/0313-disk-loopback-Reference-tracking-for-the-loopback.patch new file mode 100644 index 00000000..5f6cd3af --- /dev/null +++ b/0313-disk-loopback-Reference-tracking-for-the-loopback.patch @@ -0,0 +1,108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 11 Feb 2025 15:22:28 -0600 +Subject: [PATCH] disk/loopback: Reference tracking for the loopback + +It was possible to delete a loopback while there were still references +to it. This led to an exploitable use-after-free. + +Fixed by implementing a reference counting in the grub_loopback struct. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/disk/loopback.c | 17 +++++++++++++++++ + include/grub/err.h | 3 ++- + include/grub/loopback.h | 1 + + 3 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/grub-core/disk/loopback.c b/grub-core/disk/loopback.c +index 11a5e0cbd..f39281323 100644 +--- a/grub-core/disk/loopback.c ++++ b/grub-core/disk/loopback.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -57,6 +58,8 @@ delete_loopback (const char *name) + if (! dev) + return grub_error (GRUB_ERR_BAD_DEVICE, "device not found"); + ++ if (dev->refcnt > 0) ++ return grub_error (GRUB_ERR_STILL_REFERENCED, "device still referenced"); + /* Remove the device from the list. */ + *prev = dev->next; + +@@ -113,6 +116,7 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args) + + newdev->file = file; + newdev->id = last_id++; ++ newdev->refcnt = 0; + + /* Add the new entry to the list. */ + newdev->next = loopback_list; +@@ -154,6 +158,9 @@ grub_loopback_open (const char *name, grub_disk_t disk) + if (! dev) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); + ++ if (grub_add (dev->refcnt, 1, &dev->refcnt)) ++ grub_fatal ("Reference count overflow"); ++ + /* Use the filesize for the disk size, round up to a complete sector. */ + if (dev->file->size != GRUB_FILE_SIZE_UNKNOWN) + disk->total_sectors = ((dev->file->size + GRUB_DISK_SECTOR_SIZE - 1) +@@ -171,6 +178,15 @@ grub_loopback_open (const char *name, grub_disk_t disk) + return 0; + } + ++static void ++grub_loopback_close (grub_disk_t disk) ++{ ++ struct grub_loopback *dev = disk->data; ++ ++ if (grub_sub (dev->refcnt, 1, &dev->refcnt)) ++ grub_fatal ("Reference count underflow"); ++} ++ + static grub_err_t + grub_loopback_read (grub_disk_t disk, grub_disk_addr_t sector, + grub_size_t size, char *buf) +@@ -213,6 +229,7 @@ static struct grub_disk_dev grub_loopback_dev = + .id = GRUB_DISK_DEVICE_LOOPBACK_ID, + .disk_iterate = grub_loopback_iterate, + .disk_open = grub_loopback_open, ++ .disk_close = grub_loopback_close, + .disk_read = grub_loopback_read, + .disk_write = grub_loopback_write, + .next = 0 +diff --git a/include/grub/err.h b/include/grub/err.h +index 3c587b9b8..29f1a73c5 100644 +--- a/include/grub/err.h ++++ b/include/grub/err.h +@@ -73,7 +73,8 @@ typedef enum + GRUB_ERR_NET_NO_DOMAIN, + GRUB_ERR_EOF, + GRUB_ERR_BAD_SIGNATURE, +- GRUB_ERR_BAD_FIRMWARE ++ GRUB_ERR_BAD_FIRMWARE, ++ GRUB_ERR_STILL_REFERENCED + } + grub_err_t; + +diff --git a/include/grub/loopback.h b/include/grub/loopback.h +index 3b9a9e32e..915ef65fc 100644 +--- a/include/grub/loopback.h ++++ b/include/grub/loopback.h +@@ -25,6 +25,7 @@ struct grub_loopback + grub_file_t file; + struct grub_loopback *next; + unsigned long id; ++ grub_uint64_t refcnt; + }; + + #endif /* ! GRUB_LOOPBACK_HEADER */ diff --git a/0314-kern-disk-Limit-recursion-depth.patch b/0314-kern-disk-Limit-recursion-depth.patch new file mode 100644 index 00000000..eba37f97 --- /dev/null +++ b/0314-kern-disk-Limit-recursion-depth.patch @@ -0,0 +1,120 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 04:09:24 +0100 +Subject: [PATCH] kern/disk: Limit recursion depth + +The grub_disk_read() may trigger other disk reads, e.g. via loopbacks. +This may lead to very deep recursion which can corrupt the heap. So, fix +the issue by limiting reads depth. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/kern/disk.c | 27 ++++++++++++++++++++------- + include/grub/err.h | 3 ++- + 2 files changed, 22 insertions(+), 8 deletions(-) + +diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c +index 355b6579d..5747ad85c 100644 +--- a/grub-core/kern/disk.c ++++ b/grub-core/kern/disk.c +@@ -28,6 +28,10 @@ + + #define GRUB_CACHE_TIMEOUT 2 + ++/* Disk reads may trigger other disk reads. So, limit recursion depth. */ ++#define MAX_READ_RECURSION_DEPTH 16 ++static unsigned int read_recursion_depth = 0; ++ + /* The last time the disk was used. */ + static grub_uint64_t grub_last_time = 0; + +@@ -421,6 +425,8 @@ grub_err_t + grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, + grub_off_t offset, grub_size_t size, void *buf) + { ++ grub_err_t err = GRUB_ERR_NONE; ++ + /* First of all, check if the region is within the disk. */ + if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE) + { +@@ -431,12 +437,17 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, + return grub_errno; + } + ++ if (++read_recursion_depth >= MAX_READ_RECURSION_DEPTH) ++ { ++ grub_error (GRUB_ERR_RECURSION_DEPTH, "grub_disk_read(): Maximum recursion depth exceeded"); ++ goto error; ++ } ++ + /* First read until first cache boundary. */ + if (offset || (sector & (GRUB_DISK_CACHE_SIZE - 1))) + { + grub_disk_addr_t start_sector; + grub_size_t pos; +- grub_err_t err; + grub_size_t len; + + start_sector = sector & ~((grub_disk_addr_t) GRUB_DISK_CACHE_SIZE - 1); +@@ -448,7 +459,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, + err = grub_disk_read_small (disk, start_sector, + offset + pos, len, buf); + if (err) +- return err; ++ goto error; + buf = (char *) buf + len; + size -= len; + offset += len; +@@ -461,7 +472,6 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, + { + char *data = NULL; + grub_disk_addr_t agglomerate; +- grub_err_t err; + + /* agglomerate read until we find a first cached entry. */ + for (agglomerate = 0; agglomerate +@@ -497,7 +507,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, + - disk->log_sector_size), + buf); + if (err) +- return err; ++ goto error; + + for (i = 0; i < agglomerate; i ++) + grub_disk_cache_store (disk->dev->id, disk->id, +@@ -531,13 +541,16 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, + /* And now read the last part. */ + if (size) + { +- grub_err_t err; + err = grub_disk_read_small (disk, sector, 0, size, buf); + if (err) +- return err; ++ goto error; + } + +- return grub_errno; ++ err = grub_errno; ++ ++ error: ++ read_recursion_depth--; ++ return err; + } + + grub_uint64_t +diff --git a/include/grub/err.h b/include/grub/err.h +index 29f1a73c5..7530f58b2 100644 +--- a/include/grub/err.h ++++ b/include/grub/err.h +@@ -74,7 +74,8 @@ typedef enum + GRUB_ERR_EOF, + GRUB_ERR_BAD_SIGNATURE, + GRUB_ERR_BAD_FIRMWARE, +- GRUB_ERR_STILL_REFERENCED ++ GRUB_ERR_STILL_REFERENCED, ++ GRUB_ERR_RECURSION_DEPTH + } + grub_err_t; + diff --git a/0315-kern-partition-Limit-recursion-in-part_iterate.patch b/0315-kern-partition-Limit-recursion-in-part_iterate.patch new file mode 100644 index 00000000..f51ff967 --- /dev/null +++ b/0315-kern-partition-Limit-recursion-in-part_iterate.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sat, 16 Nov 2024 21:24:19 +0000 +Subject: [PATCH] kern/partition: Limit recursion in part_iterate() + +The part_iterate() is used by grub_partition_iterate() as a callback in +the partition iterate functions. However, part_iterate() may also call +the partition iterate functions which may lead to recursion. Fix potential +issue by limiting the recursion depth. + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/kern/partition.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/partition.c b/grub-core/kern/partition.c +index edad9f9e4..704512a20 100644 +--- a/grub-core/kern/partition.c ++++ b/grub-core/kern/partition.c +@@ -28,6 +28,9 @@ + + grub_partition_map_t grub_partition_map_list; + ++#define MAX_RECURSION_DEPTH 32 ++static unsigned int recursion_depth = 0; ++ + /* + * Checks that disk->partition contains part. This function assumes that the + * start of part is relative to the start of disk->partition. Returns 1 if +@@ -208,7 +211,12 @@ part_iterate (grub_disk_t dsk, const grub_partition_t partition, void *data) + FOR_PARTITION_MAPS(partmap) + { + grub_err_t err; +- err = partmap->iterate (dsk, part_iterate, ctx); ++ recursion_depth++; ++ if (recursion_depth <= MAX_RECURSION_DEPTH) ++ err = partmap->iterate (dsk, part_iterate, ctx); ++ else ++ err = grub_error (GRUB_ERR_RECURSION_DEPTH, "maximum recursion depth exceeded"); ++ recursion_depth--; + if (err) + grub_errno = GRUB_ERR_NONE; + if (ctx->ret) diff --git a/0316-script-execute-Limit-the-recursion-depth.patch b/0316-script-execute-Limit-the-recursion-depth.patch new file mode 100644 index 00000000..6bf1d092 --- /dev/null +++ b/0316-script-execute-Limit-the-recursion-depth.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Thu, 18 Apr 2024 19:04:13 +0100 +Subject: [PATCH] script/execute: Limit the recursion depth + +If unbounded recursion is allowed it becomes possible to collide the +stack with the heap. As UEFI firmware often lacks guard pages this +becomes an exploitable issue as it is possible in some cases to do +a controlled overwrite of a section of this heap region with +arbitrary data. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/script/execute.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c +index c19b4bf70..7ed3a1a03 100644 +--- a/grub-core/script/execute.c ++++ b/grub-core/script/execute.c +@@ -36,10 +36,18 @@ + is sizeof (int) * 3, and one extra for a possible -ve sign. */ + #define ERRNO_DIGITS_MAX (sizeof (int) * 3 + 1) + ++/* ++ * A limit on recursion, to avoid colliding with the heap. UEFI defines a baseline ++ * stack size of 128 KiB. So, assuming at most 1-2 KiB per iteration this should ++ * keep us safe. ++ */ ++#define MAX_RECURSION_DEPTH 64 ++ + static unsigned long is_continue; + static unsigned long active_loops; + static unsigned long active_breaks; + static unsigned long function_return; ++static unsigned long recursion_depth; + + #define GRUB_SCRIPT_SCOPE_MALLOCED 1 + #define GRUB_SCRIPT_SCOPE_ARGS_MALLOCED 2 +@@ -850,7 +858,13 @@ grub_script_execute_cmd (struct grub_script_cmd *cmd) + if (cmd == 0) + return 0; + ++ recursion_depth++; ++ ++ if (recursion_depth >= MAX_RECURSION_DEPTH) ++ return grub_error (GRUB_ERR_RECURSION_DEPTH, N_("maximum recursion depth exceeded")); ++ + ret = cmd->exec (cmd); ++ recursion_depth--; + + grub_snprintf (errnobuf, sizeof (errnobuf), "%d", ret); + grub_env_set ("?", errnobuf); diff --git a/0317-net-Unregister-net_default_ip-and-net_default_mac-va.patch b/0317-net-Unregister-net_default_ip-and-net_default_mac-va.patch new file mode 100644 index 00000000..c3f5636c --- /dev/null +++ b/0317-net-Unregister-net_default_ip-and-net_default_mac-va.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 11 Feb 2025 15:27:10 -0600 +Subject: [PATCH] net: Unregister net_default_ip and net_default_mac variables + hooks on unload + +The net module is a dependency of normal. So, it shouldn't be possible +to unload the net. Though unregister variables hooks as a precaution. +It also gets in line with unregistering the other net module hooks. + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/net/net.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index fdec64d55..9959a2ae8 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -2221,6 +2221,8 @@ GRUB_MOD_FINI(net) + + grub_register_variable_hook ("net_default_server", 0, 0); + grub_register_variable_hook ("pxe_default_server", 0, 0); ++ grub_register_variable_hook ("net_default_ip", 0, 0); ++ grub_register_variable_hook ("net_default_mac", 0, 0); + + grub_bootp_fini (); + grub_dns_fini (); diff --git a/0318-net-Remove-variables-hooks-when-interface-is-unregis.patch b/0318-net-Remove-variables-hooks-when-interface-is-unregis.patch new file mode 100644 index 00000000..c7b25c19 --- /dev/null +++ b/0318-net-Remove-variables-hooks-when-interface-is-unregis.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 11 Feb 2025 15:42:44 -0600 +Subject: [PATCH] net: Remove variables hooks when interface is unregisted + +The grub_net_network_level_interface_unregister(), previously +implemented in a header, did not remove the variables hooks that +were registered in grub_net_network_level_interface_register(). +Fix this by implementing the same logic used to register the +variables and move the function into the grub-core/net/net.c. + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/net/net.c | 33 +++++++++++++++++++++++++++++++++ + include/grub/net.h | 11 +---------- + 2 files changed, 34 insertions(+), 10 deletions(-) + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 9959a2ae8..22d5cc3ba 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -1066,6 +1066,39 @@ grub_net_add_ipv6_local (struct grub_net_network_level_interface *inter, + return 0; + } + ++void ++grub_net_network_level_interface_unregister (struct grub_net_network_level_interface *inter) ++{ ++ char *name; ++ ++ { ++ char buf[GRUB_NET_MAX_STR_HWADDR_LEN]; ++ ++ grub_net_hwaddr_to_str (&inter->hwaddress, buf); ++ name = grub_xasprintf ("net_%s_mac", inter->name); ++ if (name != NULL) ++ grub_register_variable_hook (name, NULL, NULL); ++ grub_free (name); ++ } ++ ++ { ++ char buf[GRUB_NET_MAX_STR_ADDR_LEN]; ++ ++ grub_net_addr_to_str (&inter->address, buf); ++ name = grub_xasprintf ("net_%s_ip", inter->name); ++ if (name != NULL) ++ grub_register_variable_hook (name, NULL, NULL); ++ grub_free (name); ++ } ++ ++ inter->card->num_ifaces--; ++ *inter->prev = inter->next; ++ if (inter->next) ++ inter->next->prev = inter->prev; ++ inter->next = 0; ++ inter->prev = 0; ++} ++ + grub_err_t + grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter, + int mask) +diff --git a/include/grub/net.h b/include/grub/net.h +index 868c9a2ef..273afbddf 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -625,16 +625,7 @@ void grub_bootp_fini (void); + void grub_dns_init (void); + void grub_dns_fini (void); + +-static inline void +-grub_net_network_level_interface_unregister (struct grub_net_network_level_interface *inter) +-{ +- inter->card->num_ifaces--; +- *inter->prev = inter->next; +- if (inter->next) +- inter->next->prev = inter->prev; +- inter->next = 0; +- inter->prev = 0; +-} ++void grub_net_network_level_interface_unregister (struct grub_net_network_level_interface *inter); + + void + grub_net_tcp_retransmit (void); diff --git a/0319-net-Fix-OOB-write-in-grub_net_search_config_file.patch b/0319-net-Fix-OOB-write-in-grub_net_search_config_file.patch new file mode 100644 index 00000000..d0830c83 --- /dev/null +++ b/0319-net-Fix-OOB-write-in-grub_net_search_config_file.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 11 Feb 2025 16:38:44 -0600 +Subject: [PATCH] net: Fix OOB write in grub_net_search_config_file() + +The function included a call to grub_strcpy() which copied data from an +environment variable to a buffer allocated in grub_cmd_normal(). The +grub_cmd_normal() didn't consider the length of the environment variable. +So, the copy operation could exceed the allocation and lead to an OOB +write. Fix the issue by replacing grub_strcpy() with grub_strlcpy() and +pass the underlying buffers size to the grub_net_search_config_file(). + +Fixes: CVE-2025-0624 + +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/net/net.c | 7 ++++--- + grub-core/normal/main.c | 2 +- + include/grub/net.h | 2 +- + 3 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 22d5cc3ba..6c8dfcba2 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -2023,14 +2023,15 @@ grub_config_search_through (char *config, char *suffix, + } + + grub_err_t +-grub_net_search_config_file (char *config) ++grub_net_search_config_file (char *config, grub_size_t config_buf_len) + { +- grub_size_t config_len; ++ grub_size_t config_len, suffix_len; + char *suffix; + + config_len = grub_strlen (config); + config[config_len] = '-'; + suffix = config + config_len + 1; ++ suffix_len = config_buf_len - (config_len + 1); + + struct grub_net_network_level_interface *inf; + FOR_NET_NETWORK_LEVEL_INTERFACES (inf) +@@ -2056,7 +2057,7 @@ grub_net_search_config_file (char *config) + + if (client_uuid) + { +- grub_strcpy (suffix, client_uuid); ++ grub_strlcpy (suffix, client_uuid, suffix_len); + if (grub_config_search_through (config, suffix, 1, 0) == 0) + return GRUB_ERR_NONE; + } +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index 86ffb388d..cad840e06 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -360,7 +360,7 @@ grub_try_normal_prefix (const char *prefix) + return err; + + grub_snprintf (config, config_len, "%s/grub.cfg", prefix); +- err = grub_net_search_config_file (config); ++ err = grub_net_search_config_file (config, config_len); + } + + if (err != GRUB_ERR_NONE) +diff --git a/include/grub/net.h b/include/grub/net.h +index 273afbddf..d280acd72 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -655,7 +655,7 @@ void + grub_net_remove_dns_server (const struct grub_net_network_level_address *s); + + grub_err_t +-grub_net_search_config_file (char *config); ++grub_net_search_config_file (char *config, grub_size_t config_buf_len); + + extern char *grub_net_default_server; + diff --git a/0320-net-tftp-Fix-stack-buffer-overflow-in-tftp_open.patch b/0320-net-tftp-Fix-stack-buffer-overflow-in-tftp_open.patch new file mode 100644 index 00000000..91b857d8 --- /dev/null +++ b/0320-net-tftp-Fix-stack-buffer-overflow-in-tftp_open.patch @@ -0,0 +1,115 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Thu, 18 Apr 2024 17:32:34 +0100 +Subject: [PATCH] net/tftp: Fix stack buffer overflow in tftp_open() + +An overly long filename can be passed to tftp_open() which would cause +grub_normalize_filename() to write out of bounds. + +Fixed by adding an extra argument to grub_normalize_filename() for the +space available, making it act closer to a strlcpy(). As several fixed +strings are strcpy()'d after into the same buffer, their total length is +checked to see if they exceed the remaining space in the buffer. If so, +return an error. + +On the occasion simplify code a bit by removing unneeded rrqlen zeroing. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/net/tftp.c | 38 ++++++++++++++++++++++++-------------- + 1 file changed, 24 insertions(+), 14 deletions(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index f300a9d40..3d96e50f4 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -266,17 +266,19 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), + * forward slashes to a single forward slash. + */ + static void +-grub_normalize_filename (char *normalized, const char *filename) ++grub_normalize_filename (char *normalized, const char *filename, int c) + { + char *dest = normalized; + const char *src = filename; + +- while (*src != '\0') ++ while (*src != '\0' && c > 0) + { + if (src[0] == '/' && src[1] == '/') + src++; +- else ++ else { ++ c--; + *dest++ = *src++; ++ } + } + *dest = '\0'; + } +@@ -287,7 +289,7 @@ tftp_open (struct grub_file *file, const char *filename) + struct tftphdr *tftph; + char *rrq; + int i; +- int rrqlen; ++ int rrqlen, rrqsize; + int hdrlen; + grub_uint8_t open_data[1500]; + struct grub_net_buff nb; +@@ -315,37 +317,45 @@ tftp_open (struct grub_file *file, const char *filename) + + tftph = (struct tftphdr *) nb.data; + +- rrq = (char *) tftph->u.rrq; +- rrqlen = 0; +- + tftph->opcode = grub_cpu_to_be16_compile_time (TFTP_RRQ); + ++ rrq = (char *) tftph->u.rrq; ++ rrqsize = sizeof (tftph->u.rrq); ++ + /* + * Copy and normalize the filename to work-around issues on some TFTP + * servers when file names are being matched for remapping. + */ +- grub_normalize_filename (rrq, filename); +- rrqlen += grub_strlen (rrq) + 1; ++ grub_normalize_filename (rrq, filename, rrqsize); ++ ++ rrqlen = grub_strlen (rrq) + 1; + rrq += grub_strlen (rrq) + 1; + +- grub_strcpy (rrq, "octet"); ++ /* Verify there is enough space for the remaining components. */ + rrqlen += grub_strlen ("octet") + 1; ++ rrqlen += grub_strlen ("blksize") + 1; ++ rrqlen += grub_strlen ("1024") + 1; ++ rrqlen += grub_strlen ("tsize") + 1; ++ rrqlen += grub_strlen ("0") + 1; ++ ++ if (rrqlen >= rrqsize) { ++ grub_free (data); ++ return grub_error (GRUB_ERR_BAD_FILENAME, N_("filename too long")); ++ } ++ ++ grub_strcpy (rrq, "octet"); + rrq += grub_strlen ("octet") + 1; + + grub_strcpy (rrq, "blksize"); +- rrqlen += grub_strlen ("blksize") + 1; + rrq += grub_strlen ("blksize") + 1; + + grub_strcpy (rrq, "1024"); +- rrqlen += grub_strlen ("1024") + 1; + rrq += grub_strlen ("1024") + 1; + + grub_strcpy (rrq, "tsize"); +- rrqlen += grub_strlen ("tsize") + 1; + rrq += grub_strlen ("tsize") + 1; + + grub_strcpy (rrq, "0"); +- rrqlen += grub_strlen ("0") + 1; + rrq += grub_strlen ("0") + 1; + hdrlen = sizeof (tftph->opcode) + rrqlen; + diff --git a/0321-video-readers-jpeg-Do-not-permit-duplicate-SOF0-mark.patch b/0321-video-readers-jpeg-Do-not-permit-duplicate-SOF0-mark.patch new file mode 100644 index 00000000..848d527f --- /dev/null +++ b/0321-video-readers-jpeg-Do-not-permit-duplicate-SOF0-mark.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 8 Mar 2024 22:47:20 +1100 +Subject: [PATCH] video/readers/jpeg: Do not permit duplicate SOF0 markers in + JPEG + +Otherwise a subsequent header could change the height and width +allowing future OOB writes. + +Fixes: CVE-2024-45774 + +Reported-by: Nils Langius +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +--- + grub-core/video/readers/jpeg.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c +index ae634fd41..631a89356 100644 +--- a/grub-core/video/readers/jpeg.c ++++ b/grub-core/video/readers/jpeg.c +@@ -339,6 +339,10 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data) + if (grub_errno != GRUB_ERR_NONE) + return grub_errno; + ++ if (data->image_height != 0 || data->image_width != 0) ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "jpeg: cannot have duplicate SOF0 markers"); ++ + if (grub_jpeg_get_byte (data) != 8) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: only 8-bit precision is supported"); diff --git a/0322-kern-dl-Fix-for-an-integer-overflow-in-grub_dl_ref.patch b/0322-kern-dl-Fix-for-an-integer-overflow-in-grub_dl_ref.patch new file mode 100644 index 00000000..1fee4bf0 --- /dev/null +++ b/0322-kern-dl-Fix-for-an-integer-overflow-in-grub_dl_ref.patch @@ -0,0 +1,138 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 11 Feb 2025 16:41:57 -0600 +Subject: [PATCH] kern/dl: Fix for an integer overflow in grub_dl_ref() + +It was possible to overflow the value of mod->ref_count, a signed +integer, by repeatedly invoking insmod on an already loaded module. +This led to a use-after-free. As once ref_count was overflowed it became +possible to unload the module while there was still references to it. + +This resolves the issue by using grub_add() to check if the ref_count +will overflow and then stops further increments. Further changes were +also made to grub_dl_unref() to check for the underflow condition and +the reference count was changed to an unsigned 64-bit integer. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/commands/minicmd.c | 2 +- + grub-core/kern/dl.c | 17 ++++++++++++----- + include/grub/dl.h | 8 ++++---- + util/misc.c | 4 ++-- + 4 files changed, 19 insertions(+), 12 deletions(-) + +diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c +index 2bd3ac76f..2001043cf 100644 +--- a/grub-core/commands/minicmd.c ++++ b/grub-core/commands/minicmd.c +@@ -167,7 +167,7 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), + { + grub_dl_dep_t dep; + +- grub_printf ("%s\t%d\t\t", mod->name, mod->ref_count); ++ grub_printf ("%s\t%" PRIuGRUB_UINT64_T "\t\t", mod->name, mod->ref_count); + for (dep = mod->dep; dep; dep = dep->next) + { + if (dep != mod->dep) +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index 2eaef7150..fe7c3b940 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + + /* Platforms where modules are in a readonly area of memory. */ +@@ -613,7 +614,7 @@ grub_dl_resolve_dependencies (grub_dl_t mod, Elf_Ehdr *e) + return GRUB_ERR_NONE; + } + +-int ++grub_uint64_t + grub_dl_ref (grub_dl_t mod) + { + grub_dl_dep_t dep; +@@ -624,10 +625,13 @@ grub_dl_ref (grub_dl_t mod) + for (dep = mod->dep; dep; dep = dep->next) + grub_dl_ref (dep->mod); + +- return ++mod->ref_count; ++ if (grub_add (mod->ref_count, 1, &mod->ref_count)) ++ grub_fatal ("Module reference count overflow"); ++ ++ return mod->ref_count; + } + +-int ++grub_uint64_t + grub_dl_unref (grub_dl_t mod) + { + grub_dl_dep_t dep; +@@ -638,10 +642,13 @@ grub_dl_unref (grub_dl_t mod) + for (dep = mod->dep; dep; dep = dep->next) + grub_dl_unref (dep->mod); + +- return --mod->ref_count; ++ if (grub_sub (mod->ref_count, 1, &mod->ref_count)) ++ grub_fatal ("Module reference count underflow"); ++ ++ return mod->ref_count; + } + +-int ++grub_uint64_t + grub_dl_ref_count (grub_dl_t mod) + { + if (mod == NULL) +diff --git a/include/grub/dl.h b/include/grub/dl.h +index 1e1262a28..055bb564e 100644 +--- a/include/grub/dl.h ++++ b/include/grub/dl.h +@@ -177,7 +177,7 @@ typedef struct grub_dl_dep *grub_dl_dep_t; + struct grub_dl + { + char *name; +- int ref_count; ++ grub_uint64_t ref_count; + int persistent; + grub_dl_dep_t dep; + grub_dl_segment_t segment; +@@ -206,9 +206,9 @@ grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name); + grub_dl_t grub_dl_load_core (void *addr, grub_size_t size); + grub_dl_t EXPORT_FUNC(grub_dl_load_core_noinit) (void *addr, grub_size_t size); + int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod); +-extern int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); +-extern int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); +-extern int EXPORT_FUNC(grub_dl_ref_count) (grub_dl_t mod); ++extern grub_uint64_t EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); ++extern grub_uint64_t EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); ++extern grub_uint64_t EXPORT_FUNC(grub_dl_ref_count) (grub_dl_t mod); + + extern grub_dl_t EXPORT_VAR(grub_dl_head); + +diff --git a/util/misc.c b/util/misc.c +index d545212d9..0f928e5b4 100644 +--- a/util/misc.c ++++ b/util/misc.c +@@ -190,14 +190,14 @@ grub_xputs_real (const char *str) + + void (*grub_xputs) (const char *str) = grub_xputs_real; + +-int ++grub_uint64_t + grub_dl_ref (grub_dl_t mod) + { + (void) mod; + return 0; + } + +-int ++grub_uint64_t + grub_dl_unref (grub_dl_t mod) + { + (void) mod; diff --git a/0323-kern-dl-Check-for-the-SHF_INFO_LINK-flag-in-grub_dl_.patch b/0323-kern-dl-Check-for-the-SHF_INFO_LINK-flag-in-grub_dl_.patch new file mode 100644 index 00000000..213ef199 --- /dev/null +++ b/0323-kern-dl-Check-for-the-SHF_INFO_LINK-flag-in-grub_dl_.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 11 Feb 2025 17:01:26 -0600 +Subject: [PATCH] kern/dl: Check for the SHF_INFO_LINK flag in + grub_dl_relocate_symbols() + +The grub_dl_relocate_symbols() iterates through the sections in +an ELF looking for relocation sections. According to the spec [1] +the SHF_INFO_LINK flag should be set if the sh_info field is meant +to be a section index. + +[1] https://refspecs.linuxbase.org/elf/gabi4+/ch4.sheader.html + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/kern/dl.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c +index fe7c3b940..cb49bdc4b 100644 +--- a/grub-core/kern/dl.c ++++ b/grub-core/kern/dl.c +@@ -681,6 +681,9 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr) + grub_dl_segment_t seg; + grub_err_t err; + ++ if (!(s->sh_flags & SHF_INFO_LINK)) ++ continue; ++ + seg = grub_dl_find_segment(mod, s->sh_info); + if (!seg) + continue; diff --git a/0324-commands-extcmd-Missing-check-for-failed-allocation.patch b/0324-commands-extcmd-Missing-check-for-failed-allocation.patch new file mode 100644 index 00000000..44e8c915 --- /dev/null +++ b/0324-commands-extcmd-Missing-check-for-failed-allocation.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Fri, 22 Nov 2024 06:27:55 +0000 +Subject: [PATCH] commands/extcmd: Missing check for failed allocation + +The grub_extcmd_dispatcher() calls grub_arg_list_alloc() to allocate +a grub_arg_list struct but it does not verify the allocation was successful. +In case of failed allocation the NULL state pointer can be accessed in +parse_option() through grub_arg_parse() which may lead to a security issue. + +Fixes: CVE-2024-45775 + +Reported-by: Nils Langius +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +Reviewed-by: Alec Brown +--- + grub-core/commands/extcmd.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/commands/extcmd.c b/grub-core/commands/extcmd.c +index 90a5ca24a..c236be13a 100644 +--- a/grub-core/commands/extcmd.c ++++ b/grub-core/commands/extcmd.c +@@ -49,6 +49,9 @@ grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args, + } + + state = grub_arg_list_alloc (ext, argc, args); ++ if (state == NULL) ++ return grub_errno; ++ + if (grub_arg_parse (ext, argc, args, state, &new_args, &new_argc)) + { + context.state = state; diff --git a/0325-commands-ls-Fix-NULL-dereference.patch b/0325-commands-ls-Fix-NULL-dereference.patch new file mode 100644 index 00000000..c58177b7 --- /dev/null +++ b/0325-commands-ls-Fix-NULL-dereference.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Sun, 12 May 2024 11:08:23 +0100 +Subject: [PATCH] commands/ls: Fix NULL dereference + +The grub_strrchr() may return NULL when the dirname do not contain "/". +This can happen on broken filesystems. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/commands/ls.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c +index 6a1c7f5d3..f660946a2 100644 +--- a/grub-core/commands/ls.c ++++ b/grub-core/commands/ls.c +@@ -241,7 +241,11 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human) + + grub_file_close (file); + +- p = grub_strrchr (dirname, '/') + 1; ++ p = grub_strrchr (dirname, '/'); ++ if (p == NULL) ++ goto fail; ++ ++p; ++ + ctx.dirname = grub_strndup (dirname, p - dirname); + if (ctx.dirname == NULL) + goto fail; diff --git a/0326-commands-pgp-Unregister-the-check_signatures-hooks-o.patch b/0326-commands-pgp-Unregister-the-check_signatures-hooks-o.patch new file mode 100644 index 00000000..8305f909 --- /dev/null +++ b/0326-commands-pgp-Unregister-the-check_signatures-hooks-o.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Fri, 1 Nov 2024 19:24:29 +0000 +Subject: [PATCH] commands/pgp: Unregister the "check_signatures" hooks on + module unload + +If the hooks are not removed they can be called after the module has +been unloaded leading to an use-after-free. + +Fixes: CVE-2025-0622 + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/commands/pgp.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/commands/pgp.c b/grub-core/commands/pgp.c +index 847a5046a..fa3ef5c75 100644 +--- a/grub-core/commands/pgp.c ++++ b/grub-core/commands/pgp.c +@@ -982,6 +982,8 @@ GRUB_MOD_INIT(pgp) + + GRUB_MOD_FINI(pgp) + { ++ grub_register_variable_hook ("check_signatures", NULL, NULL); ++ grub_env_unset ("check_signatures"); + grub_verifier_unregister (&grub_pubkey_verifier); + grub_unregister_extcmd (cmd); + grub_unregister_extcmd (cmd_trust); diff --git a/0327-normal-Remove-variables-hooks-on-module-unload.patch b/0327-normal-Remove-variables-hooks-on-module-unload.patch new file mode 100644 index 00000000..d730194a --- /dev/null +++ b/0327-normal-Remove-variables-hooks-on-module-unload.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Fri, 1 Nov 2024 23:46:55 +0000 +Subject: [PATCH] normal: Remove variables hooks on module unload + +The normal module does not entirely cleanup after itself in +its GRUB_MOD_FINI() leaving a few variables hooks in place. +It is not possible to unload normal module now but fix the +issues for completeness. + +On the occasion replace 0s with NULLs for "pager" variable +hooks unregister. + +Fixes: CVE-2025-0622 + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/normal/main.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index cad840e06..dd20e5129 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -690,7 +690,9 @@ GRUB_MOD_FINI(normal) + grub_xputs = grub_xputs_saved; + + grub_set_history (0); +- grub_register_variable_hook ("pager", 0, 0); ++ grub_register_variable_hook ("pager", NULL, NULL); ++ grub_register_variable_hook ("color_normal", NULL, NULL); ++ grub_register_variable_hook ("color_highlight", NULL, NULL); + grub_fs_autoload_hook = 0; + grub_unregister_command (cmd_clear); + } diff --git a/0328-gettext-Remove-variables-hooks-on-module-unload.patch b/0328-gettext-Remove-variables-hooks-on-module-unload.patch new file mode 100644 index 00000000..9cc952ee --- /dev/null +++ b/0328-gettext-Remove-variables-hooks-on-module-unload.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Fri, 1 Nov 2024 23:52:06 +0000 +Subject: [PATCH] gettext: Remove variables hooks on module unload + +The gettext module does not entirely cleanup after itself in +its GRUB_MOD_FINI() leaving a few variables hooks in place. +It is not possible to unload gettext module because normal +module depends on it. Though fix the issues for completeness. + +Fixes: CVE-2025-0622 + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/gettext/gettext.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c +index 631af7a94..465143cb6 100644 +--- a/grub-core/gettext/gettext.c ++++ b/grub-core/gettext/gettext.c +@@ -542,6 +542,10 @@ GRUB_MOD_INIT (gettext) + + GRUB_MOD_FINI (gettext) + { ++ grub_register_variable_hook ("locale_dir", NULL, NULL); ++ grub_register_variable_hook ("secondary_locale_dir", NULL, NULL); ++ grub_register_variable_hook ("lang", NULL, NULL); ++ + grub_gettext_delete_list (&main_context); + grub_gettext_delete_list (&secondary_context); + diff --git a/0329-gettext-Integer-overflow-leads-to-heap-OOB-write-or-.patch b/0329-gettext-Integer-overflow-leads-to-heap-OOB-write-or-.patch new file mode 100644 index 00000000..d8db5c15 --- /dev/null +++ b/0329-gettext-Integer-overflow-leads-to-heap-OOB-write-or-.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Fri, 22 Nov 2024 06:27:56 +0000 +Subject: [PATCH] gettext: Integer overflow leads to heap OOB write or read + +Calculation of ctx->grub_gettext_msg_list size in grub_mofile_open() may +overflow leading to subsequent OOB write or read. This patch fixes the +issue by replacing grub_zalloc() and explicit multiplication with +grub_calloc() which does the same thing in safe manner. + +Fixes: CVE-2024-45776 + +Reported-by: Nils Langius +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +Reviewed-by: Alec Brown +--- + grub-core/gettext/gettext.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c +index 465143cb6..c17040269 100644 +--- a/grub-core/gettext/gettext.c ++++ b/grub-core/gettext/gettext.c +@@ -323,8 +323,8 @@ grub_mofile_open (struct grub_gettext_context *ctx, + for (ctx->grub_gettext_max_log = 0; ctx->grub_gettext_max >> ctx->grub_gettext_max_log; + ctx->grub_gettext_max_log++); + +- ctx->grub_gettext_msg_list = grub_zalloc (ctx->grub_gettext_max +- * sizeof (ctx->grub_gettext_msg_list[0])); ++ ctx->grub_gettext_msg_list = grub_calloc (ctx->grub_gettext_max, ++ sizeof (ctx->grub_gettext_msg_list[0])); + if (!ctx->grub_gettext_msg_list) + { + grub_file_close (fd); diff --git a/0330-gettext-Integer-overflow-leads-to-heap-OOB-write.patch b/0330-gettext-Integer-overflow-leads-to-heap-OOB-write.patch new file mode 100644 index 00000000..5b22d585 --- /dev/null +++ b/0330-gettext-Integer-overflow-leads-to-heap-OOB-write.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Fri, 22 Nov 2024 06:27:57 +0000 +Subject: [PATCH] gettext: Integer overflow leads to heap OOB write + +The size calculation of the translation buffer in +grub_gettext_getstr_from_position() may overflow +to 0 leading to heap OOB write. This patch fixes +the issue by using grub_add() and checking for +an overflow. + +Fixes: CVE-2024-45777 + +Reported-by: Nils Langius +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +Reviewed-by: Alec Brown +--- + grub-core/gettext/gettext.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c +index c17040269..fffe3a054 100644 +--- a/grub-core/gettext/gettext.c ++++ b/grub-core/gettext/gettext.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -99,6 +100,7 @@ grub_gettext_getstr_from_position (struct grub_gettext_context *ctx, + char *translation; + struct string_descriptor desc; + grub_err_t err; ++ grub_size_t alloc_sz; + + internal_position = (off + position * sizeof (desc)); + +@@ -109,7 +111,10 @@ grub_gettext_getstr_from_position (struct grub_gettext_context *ctx, + length = grub_cpu_to_le32 (desc.length); + offset = grub_cpu_to_le32 (desc.offset); + +- translation = grub_malloc (length + 1); ++ if (grub_add (length, 1, &alloc_sz)) ++ return NULL; ++ ++ translation = grub_malloc (alloc_sz); + if (!translation) + return NULL; + diff --git a/0331-commands-read-Fix-an-integer-overflow-when-supplying.patch b/0331-commands-read-Fix-an-integer-overflow-when-supplying.patch new file mode 100644 index 00000000..33ea08dd --- /dev/null +++ b/0331-commands-read-Fix-an-integer-overflow-when-supplying.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonathan Bar Or +Date: Thu, 23 Jan 2025 19:17:05 +0100 +Subject: [PATCH] commands/read: Fix an integer overflow when supplying more + than 2^31 characters + +The grub_getline() function currently has a signed integer variable "i" +that can be overflown when user supplies more than 2^31 characters. +It results in a memory corruption of the allocated line buffer as well +as supplying large negative values to grub_realloc(). + +Fixes: CVE-2025-0690 + +Reported-by: Jonathan Bar Or +Signed-off-by: Jonathan Bar Or +Reviewed-by: Daniel Kiper +--- + grub-core/commands/read.c | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +diff --git a/grub-core/commands/read.c b/grub-core/commands/read.c +index 597c90706..8d72e45c9 100644 +--- a/grub-core/commands/read.c ++++ b/grub-core/commands/read.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -37,13 +38,14 @@ static const struct grub_arg_option options[] = + static char * + grub_getline (int silent) + { +- int i; ++ grub_size_t i; + char *line; + char *tmp; + int c; ++ grub_size_t alloc_size; + + i = 0; +- line = grub_malloc (1 + i + sizeof('\0')); ++ line = grub_malloc (1 + sizeof('\0')); + if (! line) + return NULL; + +@@ -59,8 +61,17 @@ grub_getline (int silent) + line[i] = (char) c; + if (!silent) + grub_printf ("%c", c); +- i++; +- tmp = grub_realloc (line, 1 + i + sizeof('\0')); ++ if (grub_add (i, 1, &i)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ return NULL; ++ } ++ if (grub_add (i, 1 + sizeof('\0'), &alloc_size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ return NULL; ++ } ++ tmp = grub_realloc (line, alloc_size); + if (! tmp) + { + grub_free (line); diff --git a/0332-commands-test-Stack-overflow-due-to-unlimited-recurs.patch b/0332-commands-test-Stack-overflow-due-to-unlimited-recurs.patch new file mode 100644 index 00000000..3dc101b1 --- /dev/null +++ b/0332-commands-test-Stack-overflow-due-to-unlimited-recurs.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Mon, 16 Dec 2024 20:22:41 +0000 +Subject: [PATCH] commands/test: Stack overflow due to unlimited recursion + depth + +The test_parse() evaluates test expression recursively. Due to lack of +recursion depth check a specially crafted expression may cause a stack +overflow. The recursion is only triggered by the parentheses usage and +it can be unlimited. However, sensible expressions are unlikely to +contain more than a few parentheses. So, this patch limits the recursion +depth to 100, which should be sufficient. + +Reported-by: Nils Langius +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/commands/test.c | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/grub-core/commands/test.c b/grub-core/commands/test.c +index 62d3fb398..b585c3d70 100644 +--- a/grub-core/commands/test.c ++++ b/grub-core/commands/test.c +@@ -29,6 +29,9 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + ++/* Set a limit on recursion to avoid stack overflow. */ ++#define MAX_TEST_RECURSION_DEPTH 100 ++ + /* A simple implementation for signed numbers. */ + static int + grub_strtosl (char *arg, const char ** const end, int base) +@@ -150,7 +153,7 @@ get_fileinfo (char *path, struct test_parse_ctx *ctx) + + /* Parse a test expression starting from *argn. */ + static int +-test_parse (char **args, int *argn, int argc) ++test_parse (char **args, int *argn, int argc, int *depth) + { + struct test_parse_ctx ctx = { + .and = 1, +@@ -387,13 +390,24 @@ test_parse (char **args, int *argn, int argc) + if (grub_strcmp (args[*argn], ")") == 0) + { + (*argn)++; ++ if (*depth > 0) ++ (*depth)--; ++ + return ctx.or || ctx.and; + } + /* Recursively invoke if parenthesis. */ + if (grub_strcmp (args[*argn], "(") == 0) + { + (*argn)++; +- update_val (test_parse (args, argn, argc), &ctx); ++ ++ if (++(*depth) > MAX_TEST_RECURSION_DEPTH) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("max recursion depth exceeded")); ++ depth--; ++ return ctx.or || ctx.and; ++ } ++ ++ update_val (test_parse (args, argn, argc, depth), &ctx); + continue; + } + +@@ -428,11 +442,12 @@ grub_cmd_test (grub_command_t cmd __attribute__ ((unused)), + int argc, char **args) + { + int argn = 0; ++ int depth = 0; + + if (argc >= 1 && grub_strcmp (args[argc - 1], "]") == 0) + argc--; + +- return test_parse (args, &argn, argc) ? GRUB_ERR_NONE ++ return test_parse (args, &argn, argc, &depth) ? GRUB_ERR_NONE + : grub_error (GRUB_ERR_TEST_FAILURE, N_("false")); + } + diff --git a/0333-commands-minicmd-Block-the-dump-command-in-lockdown-.patch b/0333-commands-minicmd-Block-the-dump-command-in-lockdown-.patch new file mode 100644 index 00000000..a9991461 --- /dev/null +++ b/0333-commands-minicmd-Block-the-dump-command-in-lockdown-.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Thu, 18 Apr 2024 20:29:39 +0100 +Subject: [PATCH] commands/minicmd: Block the dump command in lockdown mode + +The dump enables a user to read memory which should not be possible +in lockdown mode. + +Fixes: CVE-2025-1118 + +Reported-by: B Horn +Reported-by: Jonathan Bar Or +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/commands/minicmd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c +index 2001043cf..9efb7718c 100644 +--- a/grub-core/commands/minicmd.c ++++ b/grub-core/commands/minicmd.c +@@ -215,8 +215,8 @@ GRUB_MOD_INIT(minicmd) + grub_register_command ("help", grub_mini_cmd_help, + 0, N_("Show this message.")); + cmd_dump = +- grub_register_command ("dump", grub_mini_cmd_dump, +- N_("ADDR [SIZE]"), N_("Show memory contents.")); ++ grub_register_command_lockdown ("dump", grub_mini_cmd_dump, ++ N_("ADDR [SIZE]"), N_("Show memory contents.")); + cmd_rmmod = + grub_register_command ("rmmod", grub_mini_cmd_rmmod, + N_("MODULE"), N_("Remove a module.")); diff --git a/0334-commands-memrw-Disable-memory-reading-in-lockdown-mo.patch b/0334-commands-memrw-Disable-memory-reading-in-lockdown-mo.patch new file mode 100644 index 00000000..e787d6f7 --- /dev/null +++ b/0334-commands-memrw-Disable-memory-reading-in-lockdown-mo.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Tue, 11 Feb 2025 17:12:29 -0600 +Subject: [PATCH] commands/memrw: Disable memory reading in lockdown mode + +With the rest of module being blocked in lockdown mode it does not make +a lot of sense to leave memory reading enabled. This also goes in par +with disabling the dump command. + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/commands/memrw.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/grub-core/commands/memrw.c b/grub-core/commands/memrw.c +index 39cf3a06d..9d8a54a4b 100644 +--- a/grub-core/commands/memrw.c ++++ b/grub-core/commands/memrw.c +@@ -126,17 +126,20 @@ GRUB_MOD_INIT(memrw) + return; + + cmd_read_byte = +- grub_register_extcmd ("read_byte", grub_cmd_read, 0, +- N_("ADDR"), N_("Read 8-bit value from ADDR."), +- options); ++ grub_register_extcmd_lockdown ("read_byte", grub_cmd_read, 0, ++ N_("ADDR"), ++ N_("Read 8-bit value from ADDR."), ++ options); + cmd_read_word = +- grub_register_extcmd ("read_word", grub_cmd_read, 0, +- N_("ADDR"), N_("Read 16-bit value from ADDR."), +- options); ++ grub_register_extcmd_lockdown ("read_word", grub_cmd_read, 0, ++ N_("ADDR"), ++ N_("Read 16-bit value from ADDR."), ++ options); + cmd_read_dword = +- grub_register_extcmd ("read_dword", grub_cmd_read, 0, +- N_("ADDR"), N_("Read 32-bit value from ADDR."), +- options); ++ grub_register_extcmd_lockdown ("read_dword", grub_cmd_read, 0, ++ N_("ADDR"), ++ N_("Read 32-bit value from ADDR."), ++ options); + cmd_write_byte = + grub_register_command_lockdown ("write_byte", grub_cmd_write, + N_("ADDR VALUE [MASK]"), diff --git a/0335-commands-hexdump-Disable-memory-reading-in-lockdown-.patch b/0335-commands-hexdump-Disable-memory-reading-in-lockdown-.patch new file mode 100644 index 00000000..ae523f80 --- /dev/null +++ b/0335-commands-hexdump-Disable-memory-reading-in-lockdown-.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: B Horn +Date: Fri, 19 Apr 2024 22:31:45 +0100 +Subject: [PATCH] commands/hexdump: Disable memory reading in lockdown mode + +Reported-by: B Horn +Signed-off-by: B Horn +Reviewed-by: Daniel Kiper +--- + grub-core/commands/hexdump.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/hexdump.c b/grub-core/commands/hexdump.c +index eaa12465b..d6f61d98a 100644 +--- a/grub-core/commands/hexdump.c ++++ b/grub-core/commands/hexdump.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -51,7 +52,11 @@ grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args) + length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256; + + if (!grub_strcmp (args[0], "(mem)")) +- hexdump (skip, (char *) (grub_addr_t) skip, length); ++ { ++ if (grub_is_lockdown() == GRUB_LOCKDOWN_ENABLED) ++ return grub_error (GRUB_ERR_ACCESS_DENIED, N_("memory reading is disabled in lockdown mode")); ++ hexdump (skip, (char *) (grub_addr_t) skip, length); ++ } + else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')')) + { + grub_disk_t disk; diff --git a/0336-fs-bfs-Disable-under-lockdown.patch b/0336-fs-bfs-Disable-under-lockdown.patch new file mode 100644 index 00000000..c8364628 --- /dev/null +++ b/0336-fs-bfs-Disable-under-lockdown.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Sat, 23 Mar 2024 15:59:43 +1100 +Subject: [PATCH] fs/bfs: Disable under lockdown + +The BFS is not fuzz-clean. Don't allow it to be loaded under lockdown. +This will also disable the AFS. + +Fixes: CVE-2024-45778 +Fixes: CVE-2024-45779 + +Reported-by: Nils Langius +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +--- + grub-core/fs/bfs.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/grub-core/fs/bfs.c b/grub-core/fs/bfs.c +index f37b16895..c92fd7916 100644 +--- a/grub-core/fs/bfs.c ++++ b/grub-core/fs/bfs.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -1106,8 +1107,11 @@ GRUB_MOD_INIT (bfs) + { + COMPILE_TIME_ASSERT (1 << LOG_EXTENT_SIZE == + sizeof (struct grub_bfs_extent)); +- grub_bfs_fs.mod = mod; +- grub_fs_register (&grub_bfs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_bfs_fs.mod = mod; ++ grub_fs_register (&grub_bfs_fs); ++ } + } + + #ifdef MODE_AFS +@@ -1116,5 +1120,6 @@ GRUB_MOD_FINI (afs) + GRUB_MOD_FINI (bfs) + #endif + { +- grub_fs_unregister (&grub_bfs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_bfs_fs); + } diff --git a/0337-fs-Disable-many-filesystems-under-lockdown.patch b/0337-fs-Disable-many-filesystems-under-lockdown.patch new file mode 100644 index 00000000..edd6c407 --- /dev/null +++ b/0337-fs-Disable-many-filesystems-under-lockdown.patch @@ -0,0 +1,391 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Sat, 23 Mar 2024 16:20:45 +1100 +Subject: [PATCH] fs: Disable many filesystems under lockdown + +The idea is to permit the following: btrfs, cpio, exfat, ext, f2fs, fat, +hfsplus, iso9660, squash4, tar, xfs and zfs. + +The JFS, ReiserFS, romfs, UDF and UFS security vulnerabilities were +reported by Jonathan Bar Or . + +Fixes: CVE-2025-0677 +Fixes: CVE-2025-0684 +Fixes: CVE-2025-0685 +Fixes: CVE-2025-0686 +Fixes: CVE-2025-0689 + +Suggested-by: Daniel Axtens +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper +--- + grub-core/fs/affs.c | 11 ++++++++--- + grub-core/fs/cbfs.c | 11 ++++++++--- + grub-core/fs/jfs.c | 11 ++++++++--- + grub-core/fs/minix.c | 11 ++++++++--- + grub-core/fs/nilfs2.c | 11 ++++++++--- + grub-core/fs/ntfs.c | 11 ++++++++--- + grub-core/fs/reiserfs.c | 11 ++++++++--- + grub-core/fs/romfs.c | 11 ++++++++--- + grub-core/fs/sfs.c | 11 ++++++++--- + grub-core/fs/udf.c | 11 ++++++++--- + grub-core/fs/ufs.c | 11 ++++++++--- + 11 files changed, 88 insertions(+), 33 deletions(-) + +diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c +index 9b0afb954..520a001c7 100644 +--- a/grub-core/fs/affs.c ++++ b/grub-core/fs/affs.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -703,12 +704,16 @@ static struct grub_fs grub_affs_fs = + + GRUB_MOD_INIT(affs) + { +- grub_affs_fs.mod = mod; +- grub_fs_register (&grub_affs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_affs_fs.mod = mod; ++ grub_fs_register (&grub_affs_fs); ++ } + my_mod = mod; + } + + GRUB_MOD_FINI(affs) + { +- grub_fs_unregister (&grub_affs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_affs_fs); + } +diff --git a/grub-core/fs/cbfs.c b/grub-core/fs/cbfs.c +index 2332745fe..b62c8777c 100644 +--- a/grub-core/fs/cbfs.c ++++ b/grub-core/fs/cbfs.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -390,13 +391,17 @@ GRUB_MOD_INIT (cbfs) + #if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) && !defined (GRUB_MACHINE_XEN) + init_cbfsdisk (); + #endif +- grub_cbfs_fs.mod = mod; +- grub_fs_register (&grub_cbfs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_cbfs_fs.mod = mod; ++ grub_fs_register (&grub_cbfs_fs); ++ } + } + + GRUB_MOD_FINI (cbfs) + { +- grub_fs_unregister (&grub_cbfs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_cbfs_fs); + #if (defined (__i386__) || defined (__x86_64__)) && !defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU) && !defined (GRUB_MACHINE_XEN) + fini_cbfsdisk (); + #endif +diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c +index b0283ac00..ab175c7f1 100644 +--- a/grub-core/fs/jfs.c ++++ b/grub-core/fs/jfs.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -1005,12 +1006,16 @@ static struct grub_fs grub_jfs_fs = + + GRUB_MOD_INIT(jfs) + { +- grub_jfs_fs.mod = mod; +- grub_fs_register (&grub_jfs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_jfs_fs.mod = mod; ++ grub_fs_register (&grub_jfs_fs); ++ } + my_mod = mod; + } + + GRUB_MOD_FINI(jfs) + { +- grub_fs_unregister (&grub_jfs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_jfs_fs); + } +diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c +index b7679c3e2..4440fcca8 100644 +--- a/grub-core/fs/minix.c ++++ b/grub-core/fs/minix.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -734,8 +735,11 @@ GRUB_MOD_INIT(minix) + #endif + #endif + { +- grub_minix_fs.mod = mod; +- grub_fs_register (&grub_minix_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_minix_fs.mod = mod; ++ grub_fs_register (&grub_minix_fs); ++ } + my_mod = mod; + } + +@@ -757,5 +761,6 @@ GRUB_MOD_FINI(minix) + #endif + #endif + { +- grub_fs_unregister (&grub_minix_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_minix_fs); + } +diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c +index 4e1e71738..26e6077ff 100644 +--- a/grub-core/fs/nilfs2.c ++++ b/grub-core/fs/nilfs2.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -1231,12 +1232,16 @@ GRUB_MOD_INIT (nilfs2) + grub_nilfs2_dat_entry)); + COMPILE_TIME_ASSERT (1 << LOG_INODE_SIZE + == sizeof (struct grub_nilfs2_inode)); +- grub_nilfs2_fs.mod = mod; +- grub_fs_register (&grub_nilfs2_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_nilfs2_fs.mod = mod; ++ grub_fs_register (&grub_nilfs2_fs); ++ } + my_mod = mod; + } + + GRUB_MOD_FINI (nilfs2) + { +- grub_fs_unregister (&grub_nilfs2_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_nilfs2_fs); + } +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index 4e144cc3c..e00349b1d 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -1541,12 +1542,16 @@ static struct grub_fs grub_ntfs_fs = + + GRUB_MOD_INIT (ntfs) + { +- grub_ntfs_fs.mod = mod; +- grub_fs_register (&grub_ntfs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_ntfs_fs.mod = mod; ++ grub_fs_register (&grub_ntfs_fs); ++ } + my_mod = mod; + } + + GRUB_MOD_FINI (ntfs) + { +- grub_fs_unregister (&grub_ntfs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_ntfs_fs); + } +diff --git a/grub-core/fs/reiserfs.c b/grub-core/fs/reiserfs.c +index e8b0b6383..ca47e0a43 100644 +--- a/grub-core/fs/reiserfs.c ++++ b/grub-core/fs/reiserfs.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -1407,12 +1408,16 @@ static struct grub_fs grub_reiserfs_fs = + + GRUB_MOD_INIT(reiserfs) + { +- grub_reiserfs_fs.mod = mod; +- grub_fs_register (&grub_reiserfs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_reiserfs_fs.mod = mod; ++ grub_fs_register (&grub_reiserfs_fs); ++ } + my_mod = mod; + } + + GRUB_MOD_FINI(reiserfs) + { +- grub_fs_unregister (&grub_reiserfs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_reiserfs_fs); + } +diff --git a/grub-core/fs/romfs.c b/grub-core/fs/romfs.c +index 56b0b2b2f..eafab03b2 100644 +--- a/grub-core/fs/romfs.c ++++ b/grub-core/fs/romfs.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -475,11 +476,15 @@ static struct grub_fs grub_romfs_fs = + + GRUB_MOD_INIT(romfs) + { +- grub_romfs_fs.mod = mod; +- grub_fs_register (&grub_romfs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_romfs_fs.mod = mod; ++ grub_fs_register (&grub_romfs_fs); ++ } + } + + GRUB_MOD_FINI(romfs) + { +- grub_fs_unregister (&grub_romfs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_romfs_fs); + } +diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c +index f0d7cac43..88705b3a2 100644 +--- a/grub-core/fs/sfs.c ++++ b/grub-core/fs/sfs.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + + GRUB_MOD_LICENSE ("GPLv3+"); +@@ -779,12 +780,16 @@ static struct grub_fs grub_sfs_fs = + + GRUB_MOD_INIT(sfs) + { +- grub_sfs_fs.mod = mod; +- grub_fs_register (&grub_sfs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_sfs_fs.mod = mod; ++ grub_fs_register (&grub_sfs_fs); ++ } + my_mod = mod; + } + + GRUB_MOD_FINI(sfs) + { +- grub_fs_unregister (&grub_sfs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_sfs_fs); + } +diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c +index 8765c633c..3d5ee5af5 100644 +--- a/grub-core/fs/udf.c ++++ b/grub-core/fs/udf.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -1455,12 +1456,16 @@ static struct grub_fs grub_udf_fs = { + + GRUB_MOD_INIT (udf) + { +- grub_udf_fs.mod = mod; +- grub_fs_register (&grub_udf_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_udf_fs.mod = mod; ++ grub_fs_register (&grub_udf_fs); ++ } + my_mod = mod; + } + + GRUB_MOD_FINI (udf) + { +- grub_fs_unregister (&grub_udf_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_udf_fs); + } +diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c +index e82d9356d..8b5adbd48 100644 +--- a/grub-core/fs/ufs.c ++++ b/grub-core/fs/ufs.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -899,8 +900,11 @@ GRUB_MOD_INIT(ufs1) + #endif + #endif + { +- grub_ufs_fs.mod = mod; +- grub_fs_register (&grub_ufs_fs); ++ if (!grub_is_lockdown ()) ++ { ++ grub_ufs_fs.mod = mod; ++ grub_fs_register (&grub_ufs_fs); ++ } + my_mod = mod; + } + +@@ -914,6 +918,7 @@ GRUB_MOD_FINI(ufs1) + #endif + #endif + { +- grub_fs_unregister (&grub_ufs_fs); ++ if (!grub_is_lockdown ()) ++ grub_fs_unregister (&grub_ufs_fs); + } + diff --git a/0338-disk-Use-safe-math-macros-to-prevent-overflows.patch b/0338-disk-Use-safe-math-macros-to-prevent-overflows.patch new file mode 100644 index 00000000..db3d9371 --- /dev/null +++ b/0338-disk-Use-safe-math-macros-to-prevent-overflows.patch @@ -0,0 +1,543 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Tue, 11 Feb 2025 17:59:04 -0600 +Subject: [PATCH] disk: Use safe math macros to prevent overflows + +Replace direct arithmetic operations with macros from include/grub/safemath.h +to prevent potential overflow issues when calculating the memory sizes. + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/disk/cryptodisk.c | 36 ++++++++++++++++++------ + grub-core/disk/diskfilter.c | 9 ++++-- + grub-core/disk/ieee1275/obdisk.c | 43 ++++++++++++++++++++++++---- + grub-core/disk/ieee1275/ofdisk.c | 60 ++++++++++++++++++++++++++++++++++------ + grub-core/disk/ldm.c | 36 ++++++++++++++++++++---- + grub-core/disk/luks2.c | 7 ++++- + grub-core/disk/memdisk.c | 7 ++++- + grub-core/disk/plainmount.c | 9 ++++-- + 8 files changed, 172 insertions(+), 35 deletions(-) + +diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c +index 06a42b2d7..872776010 100644 +--- a/grub-core/disk/cryptodisk.c ++++ b/grub-core/disk/cryptodisk.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #ifdef GRUB_UTIL + #include +@@ -1475,7 +1476,7 @@ static char * + luks_script_get (grub_size_t *sz) + { + grub_cryptodisk_t i; +- grub_size_t size = 0; ++ grub_size_t size = 0, mul; + char *ptr, *ret; + + *sz = 0; +@@ -1484,10 +1485,6 @@ luks_script_get (grub_size_t *sz) + if (grub_strcmp (i->modname, "luks") == 0 || + grub_strcmp (i->modname, "luks2") == 0) + { +- size += grub_strlen (i->modname); +- size += sizeof ("_mount"); +- size += grub_strlen (i->uuid); +- size += grub_strlen (i->cipher->cipher->name); + /* + * Add space in the line for (in order) spaces, cipher mode, cipher IV + * mode, sector offset, sector size and the trailing newline. This is +@@ -1495,14 +1492,35 @@ luks_script_get (grub_size_t *sz) + * in an earlier version of this code that are unaccounted for. It is + * left in the calculations in case it is needed. At worst, its short- + * lived wasted space. ++ * ++ * 60 = 5 + 5 + 8 + 20 + 6 + 1 + 15 + */ +- size += 5 + 5 + 8 + 20 + 6 + 1 + 15; ++ if (grub_add (size, grub_strlen (i->modname), &size) || ++ grub_add (size, sizeof ("_mount") + 60, &size) || ++ grub_add (size, grub_strlen (i->uuid), &size) || ++ grub_add (size, grub_strlen (i->cipher->cipher->name), &size) || ++ grub_mul (i->keysize, 2, &mul) || ++ grub_add (size, mul, &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while obtaining size of luks script"); ++ return 0; ++ } + if (i->essiv_hash) +- size += grub_strlen (i->essiv_hash->name); +- size += i->keysize * 2; ++ { ++ if (grub_add (size, grub_strlen (i->essiv_hash->name), &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while obtaining size of luks script"); ++ return 0; ++ } ++ } + } ++ if (grub_add (size, 1, &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while obtaining size of luks script"); ++ return 0; ++ } + +- ret = grub_malloc (size + 1); ++ ret = grub_malloc (size); + if (!ret) + return 0; + +diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c +index c35ce8915..fef0b815a 100644 +--- a/grub-core/disk/diskfilter.c ++++ b/grub-core/disk/diskfilter.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #ifdef GRUB_UTIL + #include + #include +@@ -1041,7 +1042,7 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + { + struct grub_diskfilter_vg *array; + int i; +- grub_size_t j; ++ grub_size_t j, sz; + grub_uint64_t totsize; + struct grub_diskfilter_pv *pv; + grub_err_t err; +@@ -1142,7 +1143,11 @@ grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb, + } + array->lvs->vg = array; + +- array->lvs->idname = grub_malloc (sizeof ("mduuid/") + 2 * uuidlen); ++ if (grub_mul (uuidlen, 2, &sz) || ++ grub_add (sz, sizeof ("mduuid/"), &sz)) ++ goto fail; ++ ++ array->lvs->idname = grub_malloc (sz); + if (!array->lvs->idname) + goto fail; + +diff --git a/grub-core/disk/ieee1275/obdisk.c b/grub-core/disk/ieee1275/obdisk.c +index cd923b90f..9d4c42665 100644 +--- a/grub-core/disk/ieee1275/obdisk.c ++++ b/grub-core/disk/ieee1275/obdisk.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -128,9 +129,17 @@ count_commas (const char *src) + static char * + decode_grub_devname (const char *name) + { +- char *devpath = grub_malloc (grub_strlen (name) + 1); ++ char *devpath; + char *p, c; ++ grub_size_t sz; + ++ if (grub_add (grub_strlen (name), 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obtaining size of device name")); ++ return NULL; ++ } ++ ++ devpath = grub_malloc (sz); + if (devpath == NULL) + return NULL; + +@@ -156,12 +165,20 @@ static char * + encode_grub_devname (const char *path) + { + char *encoding, *optr; ++ grub_size_t sz; + + if (path == NULL) + return NULL; + +- encoding = grub_malloc (sizeof (IEEE1275_DEV) + count_commas (path) + +- grub_strlen (path) + 1); ++ if (grub_add (sizeof (IEEE1275_DEV) + 1, count_commas (path), &sz) || ++ grub_add (sz, grub_strlen (path), &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obtaining encoding size")); ++ grub_print_error (); ++ return NULL; ++ } ++ ++ encoding = grub_malloc (sz); + + if (encoding == NULL) + { +@@ -396,6 +413,14 @@ canonicalise_disk (const char *devname) + + real_unit_str_len = grub_strlen (op->name) + sizeof (IEEE1275_DISK_ALIAS) + + grub_strlen (real_unit_address); ++ if (grub_add (grub_strlen (op->name), sizeof (IEEE1275_DISK_ALIAS), &real_unit_str_len) || ++ grub_add (real_unit_str_len, grub_strlen (real_unit_address), &real_unit_str_len)) ++ { ++ grub_free (parent); ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obtaining size of canonical name")); ++ grub_print_error (); ++ return NULL; ++ } + + real_canon = grub_malloc (real_unit_str_len); + +@@ -413,6 +438,7 @@ canonicalise_disk (const char *devname) + static struct disk_dev * + add_canon_disk (const char *cname) + { ++ grub_size_t sz; + struct disk_dev *dev; + + dev = grub_zalloc (sizeof (struct disk_dev)); +@@ -428,13 +454,18 @@ add_canon_disk (const char *cname) + * arguments and allows a client program to open + * the entire (raw) disk. Any disk label is ignored. + */ +- dev->raw_name = grub_malloc (grub_strlen (cname) + sizeof (":nolabel")); ++ if (grub_add (grub_strlen (cname), sizeof (":nolabel"), &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while appending :nolabel to end of canonical name"); ++ goto failed; ++ } ++ ++ dev->raw_name = grub_malloc (sz); + + if (dev->raw_name == NULL) + goto failed; + +- grub_snprintf (dev->raw_name, grub_strlen (cname) + sizeof (":nolabel"), +- "%s:nolabel", cname); ++ grub_snprintf (dev->raw_name, sz, "%s:nolabel", cname); + } + + /* +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index 57624fde5..6c628635f 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + static char *last_devpath; + static grub_ieee1275_ihandle_t last_ihandle; +@@ -81,6 +82,7 @@ ofdisk_hash_add_real (char *devpath) + struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)]; + const char *iptr; + char *optr; ++ grub_size_t sz; + + p = grub_zalloc (sizeof (*p)); + if (!p) +@@ -88,8 +90,14 @@ ofdisk_hash_add_real (char *devpath) + + p->devpath = devpath; + +- p->grub_devpath = grub_malloc (sizeof ("ieee1275/") +- + 2 * grub_strlen (p->devpath)); ++ if (grub_mul (grub_strlen (p->devpath), 2, &sz) || ++ grub_add (sz, sizeof ("ieee1275/"), &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obtaining size of device path")); ++ return NULL; ++ } ++ ++ p->grub_devpath = grub_malloc (sz); + + if (!p->grub_devpath) + { +@@ -99,7 +107,13 @@ ofdisk_hash_add_real (char *devpath) + + if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_PARTITION_0)) + { +- p->open_path = grub_malloc (grub_strlen (p->devpath) + 3); ++ if (grub_add (grub_strlen (p->devpath), 3, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obtaining size of an open path")); ++ return NULL; ++ } ++ ++ p->open_path = grub_malloc (sz); + if (!p->open_path) + { + grub_free (p->grub_devpath); +@@ -225,7 +239,7 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) + args; + char *buf, *bufptr; + unsigned i; +- ++ grub_size_t sz; + + RETRY_IEEE1275_OFDISK_OPEN(alias->path, &ihandle) + if (! ihandle) +@@ -246,7 +260,14 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) + return; + } + +- buf = grub_malloc (grub_strlen (alias->path) + 32); ++ if (grub_add (grub_strlen (alias->path), 32, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while creating buffer for vscsi"); ++ grub_ieee1275_close (ihandle); ++ return; ++ } ++ ++ buf = grub_malloc (sz); + if (!buf) + return; + bufptr = grub_stpcpy (buf, alias->path); +@@ -290,9 +311,15 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) + grub_uint64_t *table; + grub_uint16_t table_size; + grub_ieee1275_ihandle_t ihandle; ++ grub_size_t sz; + +- buf = grub_malloc (grub_strlen (alias->path) + +- sizeof ("/disk@7766554433221100")); ++ if (grub_add (grub_strlen (alias->path), sizeof ("/disk@7766554433221100"), &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while creating buffer for sas_ioa"); ++ return; ++ } ++ ++ buf = grub_malloc (sz); + if (!buf) + return; + bufptr = grub_stpcpy (buf, alias->path); +@@ -432,9 +459,17 @@ grub_ofdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, + static char * + compute_dev_path (const char *name) + { +- char *devpath = grub_malloc (grub_strlen (name) + 3); ++ char *devpath; + char *p, c; ++ grub_size_t sz; + ++ if (grub_add (grub_strlen (name), 3, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obtaining size of device path")); ++ return NULL; ++ } ++ ++ devpath = grub_malloc (sz); + if (!devpath) + return NULL; + +@@ -657,6 +692,7 @@ insert_bootpath (void) + char *bootpath; + grub_ssize_t bootpath_size; + char *type; ++ grub_size_t sz; + + if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath", + &bootpath_size) +@@ -667,7 +703,13 @@ insert_bootpath (void) + return; + } + +- bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64); ++ if (grub_add (bootpath_size, 64, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obtaining bootpath size")); ++ return; ++ } ++ ++ bootpath = (char *) grub_malloc (sz); + if (! bootpath) + { + grub_print_error (); +diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c +index 34bfe6bd1..4101b15d8 100644 +--- a/grub-core/disk/ldm.c ++++ b/grub-core/disk/ldm.c +@@ -220,6 +220,7 @@ make_vg (grub_disk_t disk, + struct grub_ldm_vblk vblk[GRUB_DISK_SECTOR_SIZE + / sizeof (struct grub_ldm_vblk)]; + unsigned i; ++ grub_size_t sz; + err = grub_disk_read (disk, cursec, 0, + sizeof(vblk), &vblk); + if (err) +@@ -251,7 +252,13 @@ make_vg (grub_disk_t disk, + grub_free (pv); + goto fail2; + } +- pv->internal_id = grub_malloc (ptr[0] + 2); ++ if (grub_add (ptr[0], 2, &sz)) ++ { ++ grub_free (pv); ++ goto fail2; ++ } ++ ++ pv->internal_id = grub_malloc (sz); + if (!pv->internal_id) + { + grub_free (pv); +@@ -276,7 +283,15 @@ make_vg (grub_disk_t disk, + goto fail2; + } + pv->id.uuidlen = *ptr; +- pv->id.uuid = grub_malloc (pv->id.uuidlen + 1); ++ ++ if (grub_add (pv->id.uuidlen, 1, &sz)) ++ { ++ grub_free (pv->internal_id); ++ grub_free (pv); ++ goto fail2; ++ } ++ ++ pv->id.uuid = grub_malloc (sz); + grub_memcpy (pv->id.uuid, ptr + 1, pv->id.uuidlen); + pv->id.uuid[pv->id.uuidlen] = 0; + +@@ -343,7 +358,13 @@ make_vg (grub_disk_t disk, + grub_free (lv); + goto fail2; + } +- lv->internal_id = grub_malloc ((grub_size_t) ptr[0] + 2); ++ if (grub_add (ptr[0], 2, &sz)) ++ { ++ grub_free (lv->segments); ++ grub_free (lv); ++ goto fail2; ++ } ++ lv->internal_id = grub_malloc (sz); + if (!lv->internal_id) + { + grub_free (lv); +@@ -455,6 +476,7 @@ make_vg (grub_disk_t disk, + struct grub_ldm_vblk vblk[GRUB_DISK_SECTOR_SIZE + / sizeof (struct grub_ldm_vblk)]; + unsigned i; ++ grub_size_t sz; + err = grub_disk_read (disk, cursec, 0, + sizeof(vblk), &vblk); + if (err) +@@ -490,7 +512,12 @@ make_vg (grub_disk_t disk, + grub_free (comp); + goto fail2; + } +- comp->internal_id = grub_malloc ((grub_size_t) ptr[0] + 2); ++ if (grub_add (ptr[0], 2, &sz)) ++ { ++ grub_free (comp); ++ goto fail2; ++ } ++ comp->internal_id = grub_malloc (sz); + if (!comp->internal_id) + { + grub_free (comp); +@@ -640,7 +667,6 @@ make_vg (grub_disk_t disk, + if (lv->segments->node_alloc == lv->segments->node_count) + { + void *t; +- grub_size_t sz; + + if (grub_mul (lv->segments->node_alloc, 2, &lv->segments->node_alloc) || + grub_mul (lv->segments->node_alloc, sizeof (*lv->segments->nodes), &sz)) +diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c +index d5106402f..8036d76ff 100644 +--- a/grub-core/disk/luks2.c ++++ b/grub-core/disk/luks2.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -569,6 +570,7 @@ luks2_recover_key (grub_disk_t source, + gcry_err_code_t gcry_ret; + grub_json_t *json = NULL, keyslots; + grub_err_t ret; ++ grub_size_t sz; + + if (cargs->key_data == NULL || cargs->key_len == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no key data"); +@@ -577,7 +579,10 @@ luks2_recover_key (grub_disk_t source, + if (ret) + return ret; + +- json_header = grub_zalloc (grub_be_to_cpu64 (header.hdr_size) - sizeof (header)); ++ if (grub_sub (grub_be_to_cpu64 (header.hdr_size), sizeof (header), &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, "underflow detected while calculating json header size"); ++ ++ json_header = grub_zalloc (sz); + if (!json_header) + return GRUB_ERR_OUT_OF_MEMORY; + +diff --git a/grub-core/disk/memdisk.c b/grub-core/disk/memdisk.c +index 613779cf3..36de3bfab 100644 +--- a/grub-core/disk/memdisk.c ++++ b/grub-core/disk/memdisk.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -96,7 +97,11 @@ GRUB_MOD_INIT(memdisk) + + grub_dprintf ("memdisk", "Found memdisk image at %p\n", memdisk_orig_addr); + +- memdisk_size = header->size - sizeof (struct grub_module_header); ++ if (grub_sub (header->size, sizeof (struct grub_module_header), &memdisk_size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "underflow detected while obtaining memdisk size"); ++ return; ++ } + memdisk_addr = grub_malloc (memdisk_size); + + grub_dprintf ("memdisk", "Copying memdisk image to dynamic memory\n"); +diff --git a/grub-core/disk/plainmount.c b/grub-core/disk/plainmount.c +index 47e64805f..21ec4072c 100644 +--- a/grub-core/disk/plainmount.c ++++ b/grub-core/disk/plainmount.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -126,7 +127,7 @@ plainmount_configure_password (grub_cryptodisk_t dev, const char *hash, + grub_uint8_t *derived_hash, *dh; + char *p; + unsigned int round, i, len, size; +- grub_size_t alloc_size; ++ grub_size_t alloc_size, sz; + grub_err_t err = GRUB_ERR_NONE; + + /* Support none (plain) hash */ +@@ -145,7 +146,11 @@ plainmount_configure_password (grub_cryptodisk_t dev, const char *hash, + * Allocate buffer for the password and for an added prefix character + * for each hash round ('alloc_size' may not be a multiple of 'len'). + */ +- p = grub_zalloc (alloc_size + (alloc_size / len) + 1); ++ if (grub_add (alloc_size, (alloc_size / len), &sz) || ++ grub_add (sz, 1, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while allocating size of password buffer")); ++ ++ p = grub_zalloc (sz); + derived_hash = grub_zalloc (GRUB_CRYPTODISK_MAX_KEYLEN * 2); + if (p == NULL || derived_hash == NULL) + { diff --git a/0339-disk-Prevent-overflows-when-allocating-memory-for-ar.patch b/0339-disk-Prevent-overflows-when-allocating-memory-for-ar.patch new file mode 100644 index 00000000..15a916f2 --- /dev/null +++ b/0339-disk-Prevent-overflows-when-allocating-memory-for-ar.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Wed, 12 Feb 2025 10:26:44 -0600 +Subject: [PATCH] disk: Prevent overflows when allocating memory for arrays + +Use grub_calloc() when allocating memory for arrays to ensure proper +overflow checks are in place. + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/disk/lvm.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c +index 794248540..a395b200d 100644 +--- a/grub-core/disk/lvm.c ++++ b/grub-core/disk/lvm.c +@@ -671,8 +671,7 @@ grub_lvm_detect (grub_disk_t disk, + goto lvs_segment_fail; + } + +- seg->nodes = grub_zalloc (sizeof (seg->nodes[0]) +- * seg->node_count); ++ seg->nodes = grub_calloc (seg->node_count, sizeof (seg->nodes[0])); + + p = grub_strstr (p, "mirrors = ["); + if (p == NULL) +@@ -760,8 +759,7 @@ grub_lvm_detect (grub_disk_t disk, + } + } + +- seg->nodes = grub_zalloc (sizeof (seg->nodes[0]) +- * seg->node_count); ++ seg->nodes = grub_calloc (seg->node_count, sizeof (seg->nodes[0])); + + p = grub_strstr (p, "raids = ["); + if (p == NULL) diff --git a/0340-disk-Check-if-returned-pointer-for-allocated-memory-.patch b/0340-disk-Check-if-returned-pointer-for-allocated-memory-.patch new file mode 100644 index 00000000..efb631e9 --- /dev/null +++ b/0340-disk-Check-if-returned-pointer-for-allocated-memory-.patch @@ -0,0 +1,152 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Wed, 22 Jan 2025 02:55:11 +0000 +Subject: [PATCH] disk: Check if returned pointer for allocated memory is NULL + +When using grub_malloc(), grub_zalloc() or grub_calloc(), these functions can +fail if we are out of memory. After allocating memory we should check if these +functions returned NULL and handle this error if they did. + +On the occasion make a NULL check in ATA code more obvious. + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/disk/ata.c | 4 ++-- + grub-core/disk/ieee1275/obdisk.c | 6 ++++++ + grub-core/disk/ldm.c | 6 ++++++ + grub-core/disk/lvm.c | 14 ++++++++++++++ + grub-core/disk/memdisk.c | 2 ++ + 5 files changed, 30 insertions(+), 2 deletions(-) + +diff --git a/grub-core/disk/ata.c b/grub-core/disk/ata.c +index 7b6ac7bfc..a2433e29e 100644 +--- a/grub-core/disk/ata.c ++++ b/grub-core/disk/ata.c +@@ -112,10 +112,10 @@ grub_ata_identify (struct grub_ata *dev) + return grub_atapi_identify (dev); + + info64 = grub_malloc (GRUB_DISK_SECTOR_SIZE); ++ if (info64 == NULL) ++ return grub_errno; + info32 = (grub_uint32_t *) info64; + info16 = (grub_uint16_t *) info64; +- if (! info16) +- return grub_errno; + + grub_memset (&parms, 0, sizeof (parms)); + parms.buffer = info16; +diff --git a/grub-core/disk/ieee1275/obdisk.c b/grub-core/disk/ieee1275/obdisk.c +index 9d4c42665..fcc39e0a2 100644 +--- a/grub-core/disk/ieee1275/obdisk.c ++++ b/grub-core/disk/ieee1275/obdisk.c +@@ -423,6 +423,12 @@ canonicalise_disk (const char *devname) + } + + real_canon = grub_malloc (real_unit_str_len); ++ if (real_canon == NULL) ++ { ++ grub_free (parent); ++ grub_print_error (); ++ return NULL; ++ } + + grub_snprintf (real_canon, real_unit_str_len, "%s/disk@%s", + op->name, real_unit_address); +diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c +index 4101b15d8..048e29cd0 100644 +--- a/grub-core/disk/ldm.c ++++ b/grub-core/disk/ldm.c +@@ -292,6 +292,12 @@ make_vg (grub_disk_t disk, + } + + pv->id.uuid = grub_malloc (sz); ++ if (pv->id.uuid == NULL) ++ { ++ grub_free (pv->internal_id); ++ grub_free (pv); ++ goto fail2; ++ } + grub_memcpy (pv->id.uuid, ptr + 1, pv->id.uuidlen); + pv->id.uuid[pv->id.uuidlen] = 0; + +diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c +index a395b200d..b2dff76d1 100644 +--- a/grub-core/disk/lvm.c ++++ b/grub-core/disk/lvm.c +@@ -370,6 +370,8 @@ grub_lvm_detect (grub_disk_t disk, + break; + + pv = grub_zalloc (sizeof (*pv)); ++ if (pv == NULL) ++ goto fail4; + q = p; + while (*q != ' ' && q < mda_end) + q++; +@@ -379,6 +381,8 @@ grub_lvm_detect (grub_disk_t disk, + + s = q - p; + pv->name = grub_malloc (s + 1); ++ if (pv->name == NULL) ++ goto pvs_fail_noname; + grub_memcpy (pv->name, p, s); + pv->name[s] = '\0'; + +@@ -451,6 +455,8 @@ grub_lvm_detect (grub_disk_t disk, + break; + + lv = grub_zalloc (sizeof (*lv)); ++ if (lv == NULL) ++ goto fail4; + + q = p; + while (*q != ' ' && q < mda_end) +@@ -545,6 +551,8 @@ grub_lvm_detect (grub_disk_t disk, + goto lvs_fail; + } + lv->segments = grub_calloc (lv->segment_count, sizeof (*seg)); ++ if (lv->segments == NULL) ++ goto lvs_fail; + seg = lv->segments; + + for (i = 0; i < lv->segment_count; i++) +@@ -612,6 +620,8 @@ grub_lvm_detect (grub_disk_t disk, + + seg->nodes = grub_calloc (seg->node_count, + sizeof (*stripe)); ++ if (seg->nodes == NULL) ++ goto lvs_segment_fail; + stripe = seg->nodes; + + p = grub_strstr (p, "stripes = ["); +@@ -672,6 +682,8 @@ grub_lvm_detect (grub_disk_t disk, + } + + seg->nodes = grub_calloc (seg->node_count, sizeof (seg->nodes[0])); ++ if (seg->nodes == NULL) ++ goto lvs_segment_fail; + + p = grub_strstr (p, "mirrors = ["); + if (p == NULL) +@@ -760,6 +772,8 @@ grub_lvm_detect (grub_disk_t disk, + } + + seg->nodes = grub_calloc (seg->node_count, sizeof (seg->nodes[0])); ++ if (seg->nodes == NULL) ++ goto lvs_segment_fail; + + p = grub_strstr (p, "raids = ["); + if (p == NULL) +diff --git a/grub-core/disk/memdisk.c b/grub-core/disk/memdisk.c +index 36de3bfab..2d7afaea3 100644 +--- a/grub-core/disk/memdisk.c ++++ b/grub-core/disk/memdisk.c +@@ -103,6 +103,8 @@ GRUB_MOD_INIT(memdisk) + return; + } + memdisk_addr = grub_malloc (memdisk_size); ++ if (memdisk_addr == NULL) ++ return; + + grub_dprintf ("memdisk", "Copying memdisk image to dynamic memory\n"); + grub_memmove (memdisk_addr, memdisk_orig_addr, memdisk_size); diff --git a/0341-disk-ieee1275-ofdisk-Call-grub_ieee1275_close-when-g.patch b/0341-disk-ieee1275-ofdisk-Call-grub_ieee1275_close-when-g.patch new file mode 100644 index 00000000..2836631a --- /dev/null +++ b/0341-disk-ieee1275-ofdisk-Call-grub_ieee1275_close-when-g.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Wed, 22 Jan 2025 02:55:12 +0000 +Subject: [PATCH] disk/ieee1275/ofdisk: Call grub_ieee1275_close() when + grub_malloc() fails + +In the dev_iterate() function a handle is opened but isn't closed when +grub_malloc() returns NULL. We should fix this by closing it on error. + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/disk/ieee1275/ofdisk.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index 6c628635f..71237b256 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -269,7 +269,10 @@ dev_iterate (const struct grub_ieee1275_devalias *alias) + + buf = grub_malloc (sz); + if (!buf) +- return; ++ { ++ grub_ieee1275_close (ihandle); ++ return; ++ } + bufptr = grub_stpcpy (buf, alias->path); + + for (i = 0; i < args.nentries; i++) diff --git a/0342-fs-Use-safe-math-macros-to-prevent-overflows.patch b/0342-fs-Use-safe-math-macros-to-prevent-overflows.patch new file mode 100644 index 00000000..43eb12c7 --- /dev/null +++ b/0342-fs-Use-safe-math-macros-to-prevent-overflows.patch @@ -0,0 +1,353 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 12 Feb 2025 10:33:31 -0600 +Subject: [PATCH] fs: Use safe math macros to prevent overflows + +Replace direct arithmetic operations with macros from include/grub/safemath.h +to prevent potential overflow issues when calculating the memory sizes. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/archelp.c | 9 ++++++++- + grub-core/fs/btrfs.c | 34 ++++++++++++++++++++++++++++------ + grub-core/fs/cpio_common.c | 16 ++++++++++++++-- + grub-core/fs/f2fs.c | 17 +++++++++++++++-- + grub-core/fs/ntfscomp.c | 9 ++++++++- + grub-core/fs/squash4.c | 12 +++++++++--- + grub-core/fs/xfs.c | 17 +++++++++++++++-- + 7 files changed, 97 insertions(+), 17 deletions(-) + +diff --git a/grub-core/fs/archelp.c b/grub-core/fs/archelp.c +index c1dcc6285..0816b28de 100644 +--- a/grub-core/fs/archelp.c ++++ b/grub-core/fs/archelp.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -68,6 +69,7 @@ handle_symlink (struct grub_archelp_data *data, + char *rest; + char *linktarget; + grub_size_t linktarget_len; ++ grub_size_t sz; + + *restart = 0; + +@@ -98,7 +100,12 @@ handle_symlink (struct grub_archelp_data *data, + if (linktarget[0] == '\0') + return GRUB_ERR_NONE; + linktarget_len = grub_strlen (linktarget); +- target = grub_malloc (linktarget_len + grub_strlen (*name) + 2); ++ ++ if (grub_add (linktarget_len, grub_strlen (*name), &sz) || ++ grub_add (sz, 2, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("link target length overflow")); ++ ++ target = grub_malloc (sz); + if (!target) + return grub_errno; + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 6593f5175..3e4924b65 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -2031,6 +2031,7 @@ find_path (struct grub_btrfs_data *data, + char *origpath = NULL; + unsigned symlinks_max = 32; + const char *relpath = grub_env_get ("btrfs_relative_path"); ++ grub_size_t sz; + + follow_default = 0; + origpath = grub_strdup (path); +@@ -2157,9 +2158,15 @@ find_path (struct grub_btrfs_data *data, + struct grub_btrfs_dir_item *cdirel; + if (elemsize > allocated) + { +- allocated = 2 * elemsize; ++ if (grub_mul (2, elemsize, &allocated) || ++ grub_add (allocated, 1, &sz)) ++ { ++ grub_free (path_alloc); ++ grub_free (origpath); ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("directory item size overflow")); ++ } + grub_free (direl); +- direl = grub_malloc (allocated + 1); ++ direl = grub_malloc (sz); + if (!direl) + { + grub_free (path_alloc); +@@ -2223,8 +2230,16 @@ find_path (struct grub_btrfs_data *data, + grub_free (origpath); + return err; + } +- tmp = grub_malloc (grub_le_to_cpu64 (inode.size) +- + grub_strlen (path) + 1); ++ ++ if (grub_add (grub_le_to_cpu64 (inode.size), grub_strlen (path), &sz) || ++ grub_add (sz, 1, &sz)) ++ { ++ grub_free (direl); ++ grub_free (path_alloc); ++ grub_free (origpath); ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("buffer size overflow")); ++ } ++ tmp = grub_malloc (sz); + if (!tmp) + { + grub_free (direl); +@@ -2371,6 +2386,7 @@ grub_btrfs_dir (grub_device_t device, const char *path, + grub_uint8_t type; + grub_size_t est_size = 0; + char *new_path = NULL; ++ grub_size_t sz; + + if (!data) + return grub_errno; +@@ -2420,9 +2436,15 @@ grub_btrfs_dir (grub_device_t device, const char *path, + } + if (elemsize > allocated) + { +- allocated = 2 * elemsize; ++ if (grub_mul (2, elemsize, &allocated) || ++ grub_add (allocated, 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("directory element size overflow")); ++ r = -grub_errno; ++ break; ++ } + grub_free (direl); +- direl = grub_malloc (allocated + 1); ++ direl = grub_malloc (sz); + if (!direl) + { + r = -grub_errno; +diff --git a/grub-core/fs/cpio_common.c b/grub-core/fs/cpio_common.c +index 5d41b6fdb..6ba58b354 100644 +--- a/grub-core/fs/cpio_common.c ++++ b/grub-core/fs/cpio_common.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -48,6 +49,7 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + struct head hd; + grub_size_t namesize; + grub_uint32_t modeval; ++ grub_size_t sz; + + data->hofs = data->next_hofs; + +@@ -76,7 +78,10 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + + *mode = modeval; + +- *name = grub_malloc (namesize + 1); ++ if (grub_add (namesize, 1, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("file name size overflow")); ++ ++ *name = grub_malloc (sz); + if (*name == NULL) + return grub_errno; + +@@ -110,10 +115,17 @@ grub_cpio_get_link_target (struct grub_archelp_data *data) + { + char *ret; + grub_err_t err; ++ grub_size_t sz; + + if (data->size == 0) + return grub_strdup (""); +- ret = grub_malloc (data->size + 1); ++ ++ if (grub_add (data->size, 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("target data size overflow")); ++ return NULL; ++ } ++ ret = grub_malloc (sz); + if (!ret) + return NULL; + +diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c +index f6d6beaa5..72b4aa1e6 100644 +--- a/grub-core/fs/f2fs.c ++++ b/grub-core/fs/f2fs.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -958,6 +959,7 @@ grub_f2fs_read_symlink (grub_fshelp_node_t node) + char *symlink; + struct grub_fshelp_node *diro = node; + grub_uint64_t filesize; ++ grub_size_t sz; + + if (!diro->inode_read) + { +@@ -968,7 +970,12 @@ grub_f2fs_read_symlink (grub_fshelp_node_t node) + + filesize = grub_f2fs_file_size(&diro->inode.i); + +- symlink = grub_malloc (filesize + 1); ++ if (grub_add (filesize, 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("symlink size overflow")); ++ return 0; ++ } ++ symlink = grub_malloc (sz); + if (!symlink) + return 0; + +@@ -997,6 +1004,7 @@ grub_f2fs_check_dentries (struct grub_f2fs_dir_iter_ctx *ctx) + enum FILE_TYPE ftype; + int name_len; + int ret; ++ int sz; + + if (grub_f2fs_test_bit_le (i, ctx->bitmap) == 0) + { +@@ -1010,7 +1018,12 @@ grub_f2fs_check_dentries (struct grub_f2fs_dir_iter_ctx *ctx) + if (name_len >= F2FS_NAME_LEN) + return 0; + +- filename = grub_malloc (name_len + 1); ++ if (grub_add (name_len, 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("directory entry name length overflow")); ++ return 0; ++ } ++ filename = grub_malloc (sz); + if (!filename) + return 0; + +diff --git a/grub-core/fs/ntfscomp.c b/grub-core/fs/ntfscomp.c +index a009f2c2d..f168a318e 100644 +--- a/grub-core/fs/ntfscomp.c ++++ b/grub-core/fs/ntfscomp.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -310,6 +311,7 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs, + { + grub_err_t ret; + grub_disk_addr_t vcn; ++ int log_sz; + + if (ctx->attr->sbuf) + { +@@ -349,7 +351,12 @@ ntfscomp (grub_uint8_t *dest, grub_disk_addr_t ofs, + } + + ctx->comp.comp_head = ctx->comp.comp_tail = 0; +- ctx->comp.cbuf = grub_malloc (1 << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR)); ++ if (grub_add (ctx->comp.log_spc, GRUB_NTFS_BLK_SHR, &log_sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("compression buffer size overflow")); ++ return 0; ++ } ++ ctx->comp.cbuf = grub_malloc (1 << log_sz); + if (!ctx->comp.cbuf) + return 0; + +diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c +index 6e9d63874..f91ff3bfa 100644 +--- a/grub-core/fs/squash4.c ++++ b/grub-core/fs/squash4.c +@@ -460,11 +460,11 @@ grub_squash_read_symlink (grub_fshelp_node_t node) + { + char *ret; + grub_err_t err; +- grub_size_t sz; ++ grub_uint32_t sz; + + if (grub_add (grub_le_to_cpu32 (node->ino.symlink.namelen), 1, &sz)) + { +- grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected")); ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("symlink name length overflow")); + return NULL; + } + +@@ -580,6 +580,7 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, + struct grub_squash_dirent di; + struct grub_squash_inode ino; + grub_size_t sz; ++ grub_uint16_t nlen; + + err = read_chunk (dir->data, &di, sizeof (di), + grub_le_to_cpu64 (dir->data->sb.diroffset) +@@ -595,7 +596,12 @@ grub_squash_iterate_dir (grub_fshelp_node_t dir, + if (err) + return 0; + +- buf = grub_malloc (grub_le_to_cpu16 (di.namelen) + 2); ++ if (grub_add (grub_le_to_cpu16 (di.namelen), 2, &nlen)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("name length overflow")); ++ return 0; ++ } ++ buf = grub_malloc (nlen); + if (!buf) + return 0; + err = read_chunk (dir->data, buf, +diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c +index 6c952aef1..c60db7361 100644 +--- a/grub-core/fs/xfs.c ++++ b/grub-core/fs/xfs.c +@@ -718,6 +718,7 @@ static char * + grub_xfs_read_symlink (grub_fshelp_node_t node) + { + grub_ssize_t size = grub_be_to_cpu64 (node->inode.size); ++ grub_size_t sz; + + if (size < 0) + { +@@ -739,7 +740,12 @@ grub_xfs_read_symlink (grub_fshelp_node_t node) + if (node->data->hascrc) + off = 56; + +- symlink = grub_malloc (size + 1); ++ if (grub_add (size, 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("symlink size overflow")); ++ return 0; ++ } ++ symlink = grub_malloc (sz); + if (!symlink) + return 0; + +@@ -789,8 +795,15 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename, + { + struct grub_fshelp_node *fdiro; + grub_err_t err; ++ grub_size_t sz; + +- fdiro = grub_malloc (grub_xfs_fshelp_size(ctx->diro->data) + 1); ++ if (grub_add (grub_xfs_fshelp_size(ctx->diro->data), 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("directory data size overflow")); ++ grub_print_error (); ++ return 0; ++ } ++ fdiro = grub_malloc (sz); + if (!fdiro) + { + grub_print_error (); diff --git a/0343-fs-Prevent-overflows-when-allocating-memory-for-arra.patch b/0343-fs-Prevent-overflows-when-allocating-memory-for-arra.patch new file mode 100644 index 00000000..936c2f87 --- /dev/null +++ b/0343-fs-Prevent-overflows-when-allocating-memory-for-arra.patch @@ -0,0 +1,82 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Tue, 21 Jan 2025 19:02:37 +0000 +Subject: [PATCH] fs: Prevent overflows when allocating memory for arrays + +Use grub_calloc() when allocating memory for arrays to ensure proper +overflow checks are in place. + +The HFS+ and squash4 security vulnerabilities were reported by +Jonathan Bar Or . + +Fixes: CVE-2025-0678 +Fixes: CVE-2025-1125 + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/btrfs.c | 4 ++-- + grub-core/fs/hfspluscomp.c | 9 +++++++-- + grub-core/fs/squash4.c | 8 ++++---- + 3 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 3e4924b65..3228e1788 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -1409,8 +1409,8 @@ grub_btrfs_mount (grub_device_t dev) + } + + data->n_devices_allocated = 16; +- data->devices_attached = grub_malloc (sizeof (data->devices_attached[0]) +- * data->n_devices_allocated); ++ data->devices_attached = grub_calloc (data->n_devices_allocated, ++ sizeof (data->devices_attached[0])); + if (!data->devices_attached) + { + grub_free (data); +diff --git a/grub-core/fs/hfspluscomp.c b/grub-core/fs/hfspluscomp.c +index 48ae438d8..a80954ee6 100644 +--- a/grub-core/fs/hfspluscomp.c ++++ b/grub-core/fs/hfspluscomp.c +@@ -244,14 +244,19 @@ hfsplus_open_compressed_real (struct grub_hfsplus_file *node) + return 0; + } + node->compress_index_size = grub_le_to_cpu32 (index_size); +- node->compress_index = grub_malloc (node->compress_index_size +- * sizeof (node->compress_index[0])); ++ node->compress_index = grub_calloc (node->compress_index_size, ++ sizeof (node->compress_index[0])); + if (!node->compress_index) + { + node->compressed = 0; + grub_free (attr_node); + return grub_errno; + } ++ ++ /* ++ * The node->compress_index_size * sizeof (node->compress_index[0]) is safe here ++ * due to relevant checks done in grub_calloc() above. ++ */ + if (grub_hfsplus_read_file (node, 0, 0, + 0x104 + sizeof (index_size), + node->compress_index_size +diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c +index f91ff3bfa..cf2bca822 100644 +--- a/grub-core/fs/squash4.c ++++ b/grub-core/fs/squash4.c +@@ -822,10 +822,10 @@ direct_read (struct grub_squash_data *data, + break; + } + total_blocks = ((total_size + data->blksz - 1) >> data->log2_blksz); +- ino->block_sizes = grub_malloc (total_blocks +- * sizeof (ino->block_sizes[0])); +- ino->cumulated_block_sizes = grub_malloc (total_blocks +- * sizeof (ino->cumulated_block_sizes[0])); ++ ino->block_sizes = grub_calloc (total_blocks, ++ sizeof (ino->block_sizes[0])); ++ ino->cumulated_block_sizes = grub_calloc (total_blocks, ++ sizeof (ino->cumulated_block_sizes[0])); + if (!ino->block_sizes || !ino->cumulated_block_sizes) + { + grub_free (ino->block_sizes); diff --git a/0344-fs-Prevent-overflows-when-assigning-returned-values-.patch b/0344-fs-Prevent-overflows-when-assigning-returned-values-.patch new file mode 100644 index 00000000..97f8098f --- /dev/null +++ b/0344-fs-Prevent-overflows-when-assigning-returned-values-.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Tue, 21 Jan 2025 19:02:38 +0000 +Subject: [PATCH] fs: Prevent overflows when assigning returned values from + read_number() + +The direct assignment of the unsigned long long value returned by +read_number() can potentially lead to an overflow on a 32-bit systems. +The fix replaces the direct assignments with calls to grub_cast() +which detects the overflows and safely assigns the values if no +overflow is detected. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/cpio_common.c | 18 ++++++++++++++---- + grub-core/fs/tar.c | 23 ++++++++++++++++------- + 2 files changed, 30 insertions(+), 11 deletions(-) + +diff --git a/grub-core/fs/cpio_common.c b/grub-core/fs/cpio_common.c +index 6ba58b354..45ac119a8 100644 +--- a/grub-core/fs/cpio_common.c ++++ b/grub-core/fs/cpio_common.c +@@ -62,11 +62,21 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + #endif + ) + return grub_error (GRUB_ERR_BAD_FS, "invalid cpio archive"); +- data->size = read_number (hd.filesize, ARRAY_SIZE (hd.filesize)); ++ ++ if (grub_cast (read_number (hd.filesize, ARRAY_SIZE (hd.filesize)), &data->size)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("data size overflow")); ++ + if (mtime) +- *mtime = read_number (hd.mtime, ARRAY_SIZE (hd.mtime)); +- modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode)); +- namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize)); ++ { ++ if (grub_cast (read_number (hd.mtime, ARRAY_SIZE (hd.mtime)), mtime)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("mtime overflow")); ++ } ++ ++ if (grub_cast (read_number (hd.mode, ARRAY_SIZE (hd.mode)), &modeval)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("mode overflow")); ++ ++ if (grub_cast (read_number (hd.namesize, ARRAY_SIZE (hd.namesize)), &namesize)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("namesize overflow")); + + /* Don't allow negative numbers. */ + if (namesize >= 0x80000000) +diff --git a/grub-core/fs/tar.c b/grub-core/fs/tar.c +index fd2ec1f74..1eaa5349f 100644 +--- a/grub-core/fs/tar.c ++++ b/grub-core/fs/tar.c +@@ -99,9 +99,10 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + if (hd.typeflag == 'L') + { + grub_err_t err; +- grub_size_t namesize = read_number (hd.size, sizeof (hd.size)); ++ grub_size_t namesize; + +- if (grub_add (namesize, 1, &sz)) ++ if (grub_cast (read_number (hd.size, sizeof (hd.size)), &namesize) || ++ grub_add (namesize, 1, &sz)) + return grub_error (GRUB_ERR_BAD_FS, N_("name size overflow")); + + *name = grub_malloc (sz); +@@ -123,9 +124,10 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + if (hd.typeflag == 'K') + { + grub_err_t err; +- grub_size_t linksize = read_number (hd.size, sizeof (hd.size)); ++ grub_size_t linksize; + +- if (grub_add (linksize, 1, &sz)) ++ if (grub_cast (read_number (hd.size, sizeof (hd.size)), &linksize) || ++ grub_add (linksize, 1, &sz)) + return grub_error (GRUB_ERR_BAD_FS, N_("link size overflow")); + + if (data->linkname_alloc < sz) +@@ -174,15 +176,22 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, + (*name)[extra_size + sizeof (hd.name)] = 0; + } + +- data->size = read_number (hd.size, sizeof (hd.size)); ++ if (grub_cast (read_number (hd.size, sizeof (hd.size)), &data->size)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("data size overflow")); ++ + data->dofs = data->hofs + GRUB_DISK_SECTOR_SIZE; + data->next_hofs = data->dofs + ((data->size + GRUB_DISK_SECTOR_SIZE - 1) & + ~(GRUB_DISK_SECTOR_SIZE - 1)); + if (mtime) +- *mtime = read_number (hd.mtime, sizeof (hd.mtime)); ++ { ++ if (grub_cast (read_number (hd.mtime, sizeof (hd.mtime)), mtime)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("mtime overflow")); ++ } + if (mode) + { +- *mode = read_number (hd.mode, sizeof (hd.mode)); ++ if (grub_cast (read_number (hd.mode, sizeof (hd.mode)), mode)) ++ return grub_error (GRUB_ERR_BAD_FS, N_("mode overflow")); ++ + switch (hd.typeflag) + { + /* Hardlink. */ diff --git a/0345-fs-zfs-Use-safe-math-macros-to-prevent-overflows.patch b/0345-fs-zfs-Use-safe-math-macros-to-prevent-overflows.patch new file mode 100644 index 00000000..427877de --- /dev/null +++ b/0345-fs-zfs-Use-safe-math-macros-to-prevent-overflows.patch @@ -0,0 +1,138 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 22 Jan 2025 07:17:02 +0000 +Subject: [PATCH] fs/zfs: Use safe math macros to prevent overflows + +Replace direct arithmetic operations with macros from include/grub/safemath.h +to prevent potential overflow issues when calculating the memory sizes. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/zfs/zfs.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 44 insertions(+), 6 deletions(-) + +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index a497b1869..2f303d655 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -2387,6 +2387,7 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap, + zap_dnode->endian) << DNODE_SHIFT); + grub_err_t err; + grub_zfs_endian_t endian; ++ grub_size_t sz; + + if (zap_verify (zap, zap_dnode->endian)) + return 0; +@@ -2448,8 +2449,14 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap, + if (le->le_type != ZAP_CHUNK_ENTRY) + continue; + +- buf = grub_malloc (grub_zfs_to_cpu16 (le->le_name_length, endian) +- * name_elem_length + 1); ++ if (grub_mul (grub_zfs_to_cpu16 (le->le_name_length, endian), name_elem_length, &sz) || ++ grub_add (sz, 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("buffer size overflow")); ++ grub_free (l); ++ return grub_errno; ++ } ++ buf = grub_malloc (sz); + if (zap_leaf_array_get (l, endian, blksft, + grub_zfs_to_cpu16 (le->le_name_chunk, + endian), +@@ -2872,6 +2879,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + && ((grub_zfs_to_cpu64(((znode_phys_t *) DN_BONUS (&dnode_path->dn.dn))->zp_mode, dnode_path->dn.endian) >> 12) & 0xf) == 0xa) + { + char *sym_value; ++ grub_size_t sz; + grub_size_t sym_sz; + int free_symval = 0; + char *oldpath = path, *oldpathbuf = path_buf; +@@ -2923,7 +2931,18 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + break; + free_symval = 1; + } +- path = path_buf = grub_malloc (sym_sz + grub_strlen (oldpath) + 1); ++ ++ if (grub_add (sym_sz, grub_strlen (oldpath), &sz) || ++ grub_add (sz, 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("path buffer size overflow")); ++ grub_free (oldpathbuf); ++ if (free_symval) ++ grub_free (sym_value); ++ err = grub_errno; ++ break; ++ } ++ path = path_buf = grub_malloc (sz); + if (!path_buf) + { + grub_free (oldpathbuf); +@@ -2960,6 +2979,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + { + void *sahdrp; + int hdrsize; ++ grub_size_t sz; + + if (dnode_path->dn.dn.dn_bonuslen != 0) + { +@@ -2993,7 +3013,15 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn, + + SA_SIZE_OFFSET), + dnode_path->dn.endian); + char *oldpath = path, *oldpathbuf = path_buf; +- path = path_buf = grub_malloc (sym_sz + grub_strlen (oldpath) + 1); ++ if (grub_add (sym_sz, grub_strlen (oldpath), &sz) || ++ grub_add (sz, 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("path buffer size overflow")); ++ grub_free (oldpathbuf); ++ err = grub_errno; ++ break; ++ } ++ path = path_buf = grub_malloc (sz); + if (!path_buf) + { + grub_free (oldpathbuf); +@@ -3568,6 +3596,7 @@ grub_zfs_nvlist_lookup_nvlist_array (const char *nvlist, const char *name, + unsigned i; + grub_size_t nelm; + int elemsize = 0; ++ int sz; + + found = nvlist_find_value (nvlist, name, DATA_TYPE_NVLIST_ARRAY, &nvpair, + &size, &nelm); +@@ -3602,7 +3631,12 @@ grub_zfs_nvlist_lookup_nvlist_array (const char *nvlist, const char *name, + return 0; + } + +- ret = grub_zalloc (elemsize + sizeof (grub_uint32_t)); ++ if (grub_add (elemsize, sizeof (grub_uint32_t), &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("elemsize overflow")); ++ return 0; ++ } ++ ret = grub_zalloc (sz); + if (!ret) + return 0; + grub_memcpy (ret, nvlist, sizeof (grub_uint32_t)); +@@ -4193,6 +4227,7 @@ iterate_zap_snap (const char *name, grub_uint64_t val, + struct grub_dirhook_info info; + char *name2; + int ret; ++ grub_size_t sz; + + dnode_end_t mdn; + +@@ -4213,7 +4248,10 @@ iterate_zap_snap (const char *name, grub_uint64_t val, + return 0; + } + +- name2 = grub_malloc (grub_strlen (name) + 2); ++ if (grub_add (grub_strlen (name), 2, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("name length overflow")); ++ ++ name2 = grub_malloc (sz); + name2[0] = '@'; + grub_memcpy (name2 + 1, name, grub_strlen (name) + 1); + ret = ctx->hook (name2, &info, ctx->hook_data); diff --git a/0346-fs-zfs-Prevent-overflows-when-allocating-memory-for-.patch b/0346-fs-zfs-Prevent-overflows-when-allocating-memory-for-.patch new file mode 100644 index 00000000..64c0e286 --- /dev/null +++ b/0346-fs-zfs-Prevent-overflows-when-allocating-memory-for-.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 22 Jan 2025 07:17:03 +0000 +Subject: [PATCH] fs/zfs: Prevent overflows when allocating memory for arrays + +Use grub_calloc() when allocating memory for arrays to ensure proper +overflow checks are in place. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/zfs/zfs.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index 2f303d655..9ab7bf319 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -723,8 +723,8 @@ fill_vdev_info_real (struct grub_zfs_data *data, + { + fill->n_children = nelm; + +- fill->children = grub_zalloc (fill->n_children +- * sizeof (fill->children[0])); ++ fill->children = grub_calloc (fill->n_children, ++ sizeof (fill->children[0])); + } + + for (i = 0; i < nelm; i++) +@@ -3712,8 +3712,8 @@ zfs_mount (grub_device_t dev) + #endif + + data->n_devices_allocated = 16; +- data->devices_attached = grub_malloc (sizeof (data->devices_attached[0]) +- * data->n_devices_allocated); ++ data->devices_attached = grub_calloc (data->n_devices_allocated, ++ sizeof (data->devices_attached[0])); + data->n_devices_attached = 0; + err = scan_disk (dev, data, 1, &inserted); + if (err) diff --git a/0347-fs-zfs-Check-if-returned-pointer-for-allocated-memor.patch b/0347-fs-zfs-Check-if-returned-pointer-for-allocated-memor.patch new file mode 100644 index 00000000..7870587f --- /dev/null +++ b/0347-fs-zfs-Check-if-returned-pointer-for-allocated-memor.patch @@ -0,0 +1,88 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 22 Jan 2025 07:17:01 +0000 +Subject: [PATCH] fs/zfs: Check if returned pointer for allocated memory is + NULL + +When using grub_malloc() or grub_zalloc(), these functions can fail if +we are out of memory. After allocating memory we should check if these +functions returned NULL and handle this error if they did. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/zfs/zfs.c | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index 9ab7bf319..6e6d1c921 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -614,6 +614,8 @@ zfs_fetch_nvlist (struct grub_zfs_device_desc *diskdesc, char **nvlist) + return grub_error (GRUB_ERR_BUG, "member drive unknown"); + + *nvlist = grub_malloc (VDEV_PHYS_SIZE); ++ if (!*nvlist) ++ return grub_errno; + + /* Read in the vdev name-value pair list (112K). */ + err = grub_disk_read (diskdesc->dev->disk, diskdesc->vdev_phys_sector, 0, +@@ -725,6 +727,11 @@ fill_vdev_info_real (struct grub_zfs_data *data, + + fill->children = grub_calloc (fill->n_children, + sizeof (fill->children[0])); ++ if (!fill->children) ++ { ++ grub_free (type); ++ return grub_errno; ++ } + } + + for (i = 0; i < nelm; i++) +@@ -2457,6 +2464,11 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap, + return grub_errno; + } + buf = grub_malloc (sz); ++ if (!buf) ++ { ++ grub_free (l); ++ return grub_errno; ++ } + if (zap_leaf_array_get (l, endian, blksft, + grub_zfs_to_cpu16 (le->le_name_chunk, + endian), +@@ -2472,6 +2484,12 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap, + val_length = ((int) le->le_value_length + * (int) le->le_int_size); + val = grub_malloc (grub_zfs_to_cpu16 (val_length, endian)); ++ if (!val) ++ { ++ grub_free (l); ++ grub_free (buf); ++ return grub_errno; ++ } + if (zap_leaf_array_get (l, endian, blksft, + grub_zfs_to_cpu16 (le->le_value_chunk, + endian), +@@ -3714,6 +3732,11 @@ zfs_mount (grub_device_t dev) + data->n_devices_allocated = 16; + data->devices_attached = grub_calloc (data->n_devices_allocated, + sizeof (data->devices_attached[0])); ++ if (!data->devices_attached) ++ { ++ grub_free (data); ++ return NULL; ++ } + data->n_devices_attached = 0; + err = scan_disk (dev, data, 1, &inserted); + if (err) +@@ -4252,6 +4275,9 @@ iterate_zap_snap (const char *name, grub_uint64_t val, + return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("name length overflow")); + + name2 = grub_malloc (sz); ++ if (!name2) ++ return grub_errno; ++ + name2[0] = '@'; + grub_memcpy (name2 + 1, name, grub_strlen (name) + 1); + ret = ctx->hook (name2, &info, ctx->hook_data); diff --git a/0348-fs-zfs-Add-missing-NULL-check-after-grub_strdup-call.patch b/0348-fs-zfs-Add-missing-NULL-check-after-grub_strdup-call.patch new file mode 100644 index 00000000..988bcbe7 --- /dev/null +++ b/0348-fs-zfs-Add-missing-NULL-check-after-grub_strdup-call.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 22 Jan 2025 07:17:04 +0000 +Subject: [PATCH] fs/zfs: Add missing NULL check after grub_strdup() call + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/zfs/zfs.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c +index 6e6d1c921..5ff647ffb 100644 +--- a/grub-core/fs/zfs/zfs.c ++++ b/grub-core/fs/zfs/zfs.c +@@ -3309,6 +3309,8 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol, + filename = 0; + snapname = 0; + fsname = grub_strdup (fullpath); ++ if (!fsname) ++ return grub_errno; + } + else + { diff --git a/0349-net-Use-safe-math-macros-to-prevent-overflows.patch b/0349-net-Use-safe-math-macros-to-prevent-overflows.patch new file mode 100644 index 00000000..60ebaf63 --- /dev/null +++ b/0349-net-Use-safe-math-macros-to-prevent-overflows.patch @@ -0,0 +1,240 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 12 Feb 2025 10:38:17 -0600 +Subject: [PATCH] net: Use safe math macros to prevent overflows + +Replace direct arithmetic operations with macros from include/grub/safemath.h +to prevent potential overflow issues when calculating the memory sizes. + +Signed-off-by: Lidong Chen +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/net/bootp.c | 16 +++++++++++-- + grub-core/net/dns.c | 9 ++++++- + grub-core/net/drivers/ieee1275/ofnet.c | 20 ++++++++++++++-- + grub-core/net/net.c | 43 +++++++++++++++++++++++++++------- + 4 files changed, 75 insertions(+), 13 deletions(-) + +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index 9cbdc2264..bed70c0b2 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + static int + dissect_url (const char *url, char **proto, char **host, char **path) +@@ -1479,6 +1480,7 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), + unsigned num; + const grub_uint8_t *ptr; + grub_uint8_t taglength; ++ grub_uint8_t len; + + if (argc < 4) + return grub_error (GRUB_ERR_BAD_ARGUMENT, +@@ -1520,7 +1522,12 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), + if (grub_strcmp (args[3], "string") == 0) + { + grub_err_t err = GRUB_ERR_NONE; +- char *val = grub_malloc (taglength + 1); ++ char *val; ++ ++ if (grub_add (taglength, 1, &len)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("tag length overflow")); ++ ++ val = grub_malloc (len); + if (!val) + return grub_errno; + grub_memcpy (val, ptr, taglength); +@@ -1553,7 +1560,12 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), + if (grub_strcmp (args[3], "hex") == 0) + { + grub_err_t err = GRUB_ERR_NONE; +- char *val = grub_malloc (2 * taglength + 1); ++ char *val; ++ ++ if (grub_mul (taglength, 2, &len) || grub_add (len, 1, &len)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("tag length overflow")); ++ ++ val = grub_malloc (len); + int i; + if (!val) + return grub_errno; +diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c +index fcc09aa65..39b0c46cf 100644 +--- a/grub-core/net/dns.c ++++ b/grub-core/net/dns.c +@@ -224,10 +224,17 @@ get_name (const grub_uint8_t *name_at, const grub_uint8_t *head, + { + int length; + char *ret; ++ int len; + + if (!check_name_real (name_at, head, tail, NULL, &length, NULL)) + return NULL; +- ret = grub_malloc (length + 1); ++ ++ if (grub_add (length, 1, &len)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("name length overflow")); ++ return NULL; ++ } ++ ret = grub_malloc (len); + if (!ret) + return NULL; + if (!check_name_real (name_at, head, tail, NULL, NULL, ret)) +diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c +index c56461ff1..b5336dfbb 100644 +--- a/grub-core/net/drivers/ieee1275/ofnet.c ++++ b/grub-core/net/drivers/ieee1275/ofnet.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -392,6 +393,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias) + grub_uint8_t *pprop; + char *shortname; + char need_suffix = 1; ++ grub_size_t sz; + + if (grub_strcmp (alias->type, "network") != 0) + return 0; +@@ -449,9 +451,23 @@ search_net_devices (struct grub_ieee1275_devalias *alias) + } + + if (need_suffix) +- ofdata->path = grub_malloc (grub_strlen (alias->path) + sizeof (SUFFIX)); ++ { ++ if (grub_add (grub_strlen (alias->path), sizeof (SUFFIX), &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obatining size of ofdata path")); ++ grub_print_error (); ++ return 0; ++ } ++ } + else +- ofdata->path = grub_malloc (grub_strlen (alias->path) + 1); ++ { ++ if (grub_add (grub_strlen (alias->path), 1, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obatining size of ofdata path")); ++ grub_print_error (); ++ return 0; ++ } ++ } + if (!ofdata->path) + { + grub_print_error (); +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 6c8dfcba2..22224453f 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #ifdef GRUB_MACHINE_EFI + #include + #endif +@@ -211,6 +212,7 @@ grub_net_ipv6_get_slaac (struct grub_net_card *card, + { + struct grub_net_slaac_mac_list *slaac; + char *ptr; ++ grub_size_t sz; + + for (slaac = card->slaac_list; slaac; slaac = slaac->next) + if (grub_net_hwaddr_cmp (&slaac->address, hwaddr) == 0) +@@ -220,9 +222,16 @@ grub_net_ipv6_get_slaac (struct grub_net_card *card, + if (!slaac) + return NULL; + +- slaac->name = grub_malloc (grub_strlen (card->name) +- + GRUB_NET_MAX_STR_HWADDR_LEN +- + sizeof (":slaac")); ++ if (grub_add (grub_strlen (card->name), ++ (GRUB_NET_MAX_STR_HWADDR_LEN + sizeof (":slaac")), &sz)) ++ { ++ grub_free (slaac); ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "overflow detected while obtaining size of slaac name"); ++ return NULL; ++ } ++ ++ slaac->name = grub_malloc (sz); + ptr = grub_stpcpy (slaac->name, card->name); + if (grub_net_hwaddr_cmp (&card->default_address, hwaddr) != 0) + { +@@ -293,6 +302,7 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card, + char *name; + char *ptr; + grub_net_network_level_address_t addr; ++ grub_size_t sz; + + addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; + addr.ipv6[0] = grub_cpu_to_be64_compile_time (0xfe80ULL << 48); +@@ -307,9 +317,14 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card, + return inf; + } + +- name = grub_malloc (grub_strlen (card->name) +- + GRUB_NET_MAX_STR_HWADDR_LEN +- + sizeof (":link")); ++ if (grub_add (grub_strlen (card->name), ++ (GRUB_NET_MAX_STR_HWADDR_LEN + sizeof (":link")), &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, ++ "overflow detected while obtaining size of link name"); ++ return NULL; ++ } ++ name = grub_malloc (sz); + if (!name) + return NULL; + +@@ -1516,9 +1531,15 @@ grub_net_open_real (const char *name) + if (grub_strchr (port_start + 1, ':')) + { + int iplen = grub_strlen (server); ++ grub_size_t sz; + + /* Bracket bare IPv6 addr. */ +- host = grub_malloc (iplen + 3); ++ if (grub_add (iplen, 3, &sz)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected while obtaining length of host")); ++ return NULL; ++ } ++ host = grub_malloc (sz); + if (!host) + return NULL; + +@@ -1773,6 +1794,7 @@ grub_env_set_net_property (const char *intername, const char *suffix, + { + char *varname, *varvalue; + char *ptr; ++ grub_size_t sz; + + varname = grub_xasprintf ("net_%s_%s", intername, suffix); + if (!varname) +@@ -1780,7 +1802,12 @@ grub_env_set_net_property (const char *intername, const char *suffix, + for (ptr = varname; *ptr; ptr++) + if (*ptr == ':') + *ptr = '_'; +- varvalue = grub_malloc (len + 1); ++ if (grub_add (len, 1, &sz)) ++ { ++ grub_free (varname); ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while obtaining the size of an env variable"); ++ } ++ varvalue = grub_malloc (sz); + if (!varvalue) + { + grub_free (varname); diff --git a/0350-net-Prevent-overflows-when-allocating-memory-for-arr.patch b/0350-net-Prevent-overflows-when-allocating-memory-for-arr.patch new file mode 100644 index 00000000..c6619d2f --- /dev/null +++ b/0350-net-Prevent-overflows-when-allocating-memory-for-arr.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 22 Jan 2025 18:04:43 +0000 +Subject: [PATCH] net: Prevent overflows when allocating memory for arrays + +Use grub_calloc() when allocating memory for arrays to ensure proper +overflow checks are in place. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/net/dns.c | 4 ++-- + grub-core/net/net.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c +index 39b0c46cf..f20cd6f83 100644 +--- a/grub-core/net/dns.c ++++ b/grub-core/net/dns.c +@@ -470,8 +470,8 @@ grub_net_dns_lookup (const char *name, + && grub_get_time_ms () < dns_cache[h].limit_time) + { + grub_dprintf ("dns", "retrieved from cache\n"); +- *addresses = grub_malloc (dns_cache[h].naddresses +- * sizeof ((*addresses)[0])); ++ *addresses = grub_calloc (dns_cache[h].naddresses, ++ sizeof ((*addresses)[0])); + if (!*addresses) + return grub_errno; + *naddresses = dns_cache[h].naddresses; +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 22224453f..d426ad2c4 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -91,8 +91,8 @@ grub_net_link_layer_add_address (struct grub_net_card *card, + /* Add sender to cache table. */ + if (card->link_layer_table == NULL) + { +- card->link_layer_table = grub_zalloc (LINK_LAYER_CACHE_SIZE +- * sizeof (card->link_layer_table[0])); ++ card->link_layer_table = grub_calloc (LINK_LAYER_CACHE_SIZE, ++ sizeof (card->link_layer_table[0])); + if (card->link_layer_table == NULL) + return; + } diff --git a/0351-net-Check-if-returned-pointer-for-allocated-memory-i.patch b/0351-net-Check-if-returned-pointer-for-allocated-memory-i.patch new file mode 100644 index 00000000..7b5b647b --- /dev/null +++ b/0351-net-Check-if-returned-pointer-for-allocated-memory-i.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Wed, 22 Jan 2025 18:04:44 +0000 +Subject: [PATCH] net: Check if returned pointer for allocated memory is NULL + +When using grub_malloc(), the function can fail if we are out of memory. +After allocating memory we should check if this function returned NULL +and handle this error if it did. + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/net/net.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index d426ad2c4..bec297cb6 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -232,6 +232,11 @@ grub_net_ipv6_get_slaac (struct grub_net_card *card, + } + + slaac->name = grub_malloc (sz); ++ if (slaac->name == NULL) ++ { ++ grub_free (slaac); ++ return NULL; ++ } + ptr = grub_stpcpy (slaac->name, card->name); + if (grub_net_hwaddr_cmp (&card->default_address, hwaddr) != 0) + { diff --git a/0352-fs-sfs-Check-if-allocated-memory-is-NULL.patch b/0352-fs-sfs-Check-if-allocated-memory-is-NULL.patch new file mode 100644 index 00000000..57d2960b --- /dev/null +++ b/0352-fs-sfs-Check-if-allocated-memory-is-NULL.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Tue, 28 Jan 2025 05:15:50 +0000 +Subject: [PATCH] fs/sfs: Check if allocated memory is NULL + +When using grub_zalloc(), if we are out of memory, this function can fail. +After allocating memory, we should check if grub_zalloc() returns NULL. +If so, we should handle this error. + +Fixes: CID 473856 + +Signed-off-by: Alec Brown +Reviewed-by: Ross Philipson +Reviewed-by: Daniel Kiper +--- + grub-core/fs/sfs.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/fs/sfs.c b/grub-core/fs/sfs.c +index 88705b3a2..bad4ae8d1 100644 +--- a/grub-core/fs/sfs.c ++++ b/grub-core/fs/sfs.c +@@ -429,6 +429,9 @@ grub_sfs_mount (grub_disk_t disk) + - 24 /* offsetof (struct grub_sfs_objc, objects) */ + - 25); /* offsetof (struct grub_sfs_obj, filename) */ + data->label = grub_zalloc (max_len + 1); ++ if (data->label == NULL) ++ goto fail; ++ + grub_strncpy (data->label, (char *) rootobjc->objects[0].filename, max_len); + + grub_free (rootobjc_data); diff --git a/0353-script-execute-Fix-potential-underflow-and-NULL-dere.patch b/0353-script-execute-Fix-potential-underflow-and-NULL-dere.patch new file mode 100644 index 00000000..575c81a9 --- /dev/null +++ b/0353-script-execute-Fix-potential-underflow-and-NULL-dere.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 29 Jan 2025 06:48:37 +0000 +Subject: [PATCH] script/execute: Fix potential underflow and NULL dereference + +The result is initialized to 0 in grub_script_arglist_to_argv(). +If the for loop condition is not met both result.args and result.argc +remain 0 causing result.argc - 1 to underflow and/or result.args NULL +dereference. Fix the issues by adding relevant checks. + +Fixes: CID 473880 + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/script/execute.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c +index 7ed3a1a03..014132703 100644 +--- a/grub-core/script/execute.c ++++ b/grub-core/script/execute.c +@@ -794,6 +794,9 @@ cleanup: + } + } + ++ if (result.args == NULL || result.argc == 0) ++ goto fail; ++ + if (! result.args[result.argc - 1]) + result.argc--; + diff --git a/0354-osdep-unix-getroot-Fix-potential-underflow.patch b/0354-osdep-unix-getroot-Fix-potential-underflow.patch new file mode 100644 index 00000000..09c223ea --- /dev/null +++ b/0354-osdep-unix-getroot-Fix-potential-underflow.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Wed, 29 Jan 2025 06:48:38 +0000 +Subject: [PATCH] osdep/unix/getroot: Fix potential underflow + +The entry_len is initialized in grub_find_root_devices_from_mountinfo() +to 0 before the while loop iterates through /proc/self/mountinfo. If the +file is empty or contains only invalid entries entry_len remains +0 causing entry_len - 1 in the subsequent for loop initialization +to underflow. To prevent this add a check to ensure entry_len > 0 before +entering the for loop. + +Fixes: CID 473877 + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +Reviewed-by: Ross Philipson +--- + grub-core/osdep/linux/getroot.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index b32582eb3..b83259321 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -596,6 +596,9 @@ again: + } + } + ++ if (!entry_len) ++ goto out; ++ + /* Now scan visible mounts for the ones we're interested in. */ + for (i = entry_len - 1; i >= 0; i--) + { diff --git a/0355-misc-Ensure-consistent-overflow-error-messages.patch b/0355-misc-Ensure-consistent-overflow-error-messages.patch new file mode 100644 index 00000000..411a4fbc --- /dev/null +++ b/0355-misc-Ensure-consistent-overflow-error-messages.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Tue, 21 Jan 2025 19:02:39 +0000 +Subject: [PATCH] misc: Ensure consistent overflow error messages + +Update the overflow error messages to make them consistent +across the GRUB code. + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ntfs.c | 2 +- + grub-core/fs/ntfscomp.c | 2 +- + grub-core/video/readers/png.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c +index e00349b1d..960833a34 100644 +--- a/grub-core/fs/ntfs.c ++++ b/grub-core/fs/ntfs.c +@@ -574,7 +574,7 @@ retry: + goto retry; + } + } +- return grub_error (GRUB_ERR_BAD_FS, "run list overflown"); ++ return grub_error (GRUB_ERR_BAD_FS, "run list overflow"); + } + ctx->curr_vcn = ctx->next_vcn; + ctx->next_vcn += read_run_data (run, c1, 0); /* length of current VCN */ +diff --git a/grub-core/fs/ntfscomp.c b/grub-core/fs/ntfscomp.c +index f168a318e..b68bf5e40 100644 +--- a/grub-core/fs/ntfscomp.c ++++ b/grub-core/fs/ntfscomp.c +@@ -30,7 +30,7 @@ static grub_err_t + decomp_nextvcn (struct grub_ntfs_comp *cc) + { + if (cc->comp_head >= cc->comp_tail) +- return grub_error (GRUB_ERR_BAD_FS, "compression block overflown"); ++ return grub_error (GRUB_ERR_BAD_FS, "compression block overflow"); + if (grub_disk_read + (cc->disk, + (cc->comp_table[cc->comp_head].next_lcn - +diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c +index 3163e97bf..aa7524b7d 100644 +--- a/grub-core/video/readers/png.c ++++ b/grub-core/video/readers/png.c +@@ -626,7 +626,7 @@ static grub_err_t + grub_png_output_byte (struct grub_png_data *data, grub_uint8_t n) + { + if (--data->raw_bytes < 0) +- return grub_error (GRUB_ERR_BAD_FILE_TYPE, "image size overflown"); ++ return grub_error (GRUB_ERR_BAD_FILE_TYPE, "image size overflow"); + + if (data->cur_column == 0) + { diff --git a/0356-bus-usb-ehci-Define-GRUB_EHCI_TOGGLE-as-grub_uint32_.patch b/0356-bus-usb-ehci-Define-GRUB_EHCI_TOGGLE-as-grub_uint32_.patch new file mode 100644 index 00000000..70342514 --- /dev/null +++ b/0356-bus-usb-ehci-Define-GRUB_EHCI_TOGGLE-as-grub_uint32_.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Tue, 4 Feb 2025 15:11:10 +0000 +Subject: [PATCH] bus/usb/ehci: Define GRUB_EHCI_TOGGLE as grub_uint32_t + +The Coverity indicates that GRUB_EHCI_TOGGLE is an int that contains +a negative value and we are using it for the variable token which is +grub_uint32_t. To remedy this we can cast the definition to grub_uint32_t. + +Fixes: CID 473851 + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/bus/usb/ehci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c +index 9abebc6bd..2db07c7c0 100644 +--- a/grub-core/bus/usb/ehci.c ++++ b/grub-core/bus/usb/ehci.c +@@ -218,7 +218,7 @@ enum + + #define GRUB_EHCI_TERMINATE (1<<0) + +-#define GRUB_EHCI_TOGGLE (1<<31) ++#define GRUB_EHCI_TOGGLE ((grub_uint32_t) 1<<31) + + enum + { diff --git a/0357-normal-menu-Use-safe-math-to-avoid-an-integer-overfl.patch b/0357-normal-menu-Use-safe-math-to-avoid-an-integer-overfl.patch new file mode 100644 index 00000000..2ae5ec6f --- /dev/null +++ b/0357-normal-menu-Use-safe-math-to-avoid-an-integer-overfl.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Tue, 4 Feb 2025 15:11:11 +0000 +Subject: [PATCH] normal/menu: Use safe math to avoid an integer overflow + +The Coverity indicates that the variable current_entry might overflow. +To prevent this use safe math when adding GRUB_MENU_PAGE_SIZE to current_entry. + +On the occasion fix limiting condition which was broken. + +Fixes: CID 473853 + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/normal/menu.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +index cda10fa8b..97687013c 100644 +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + /* Time to delay after displaying an error message about a default/fallback + entry failing to boot. */ +@@ -784,9 +785,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot, int *notify_boot) + + case GRUB_TERM_CTRL | 'c': + case GRUB_TERM_KEY_NPAGE: +- if (current_entry + GRUB_MENU_PAGE_SIZE < menu->size) +- current_entry += GRUB_MENU_PAGE_SIZE; +- else ++ if (grub_add (current_entry, GRUB_MENU_PAGE_SIZE, ¤t_entry) || current_entry >= menu->size) + current_entry = menu->size - 1; + menu_set_chosen_entry (current_entry); + break; diff --git a/0358-kern-partition-Add-sanity-check-after-grub_strtoul-c.patch b/0358-kern-partition-Add-sanity-check-after-grub_strtoul-c.patch new file mode 100644 index 00000000..a170fa95 --- /dev/null +++ b/0358-kern-partition-Add-sanity-check-after-grub_strtoul-c.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Thu, 6 Feb 2025 18:16:56 +0000 +Subject: [PATCH] kern/partition: Add sanity check after grub_strtoul() call + +The current code incorrectly assumes that both the input and the values +returned by grub_strtoul() are always valid which can lead to potential +errors. This fix ensures proper validation to prevent any unintended issues. + +Fixes: CID 473843 + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/kern/partition.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/partition.c b/grub-core/kern/partition.c +index 704512a20..c6a578cf4 100644 +--- a/grub-core/kern/partition.c ++++ b/grub-core/kern/partition.c +@@ -125,14 +125,22 @@ grub_partition_probe (struct grub_disk *disk, const char *str) + for (ptr = str; *ptr;) + { + grub_partition_map_t partmap; +- int num; ++ unsigned long num; + const char *partname, *partname_end; + + partname = ptr; + while (*ptr && grub_isalpha (*ptr)) + ptr++; + partname_end = ptr; +- num = grub_strtoul (ptr, &ptr, 0) - 1; ++ ++ num = grub_strtoul (ptr, &ptr, 0); ++ if (*ptr != '\0' || num == 0 || num > GRUB_INT_MAX) ++ { ++ grub_error (GRUB_ERR_BAD_NUMBER, N_("invalid partition number")); ++ return 0; ++ } ++ ++ num -= 1; + + curpart = 0; + /* Use the first partition map type found. */ diff --git a/0359-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch b/0359-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch new file mode 100644 index 00000000..7af2fd0b --- /dev/null +++ b/0359-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lidong Chen +Date: Thu, 6 Feb 2025 18:16:57 +0000 +Subject: [PATCH] kern/misc: Add sanity check after grub_strtoul() call + +When the format string, fmt0, includes a positional argument +grub_strtoul() or grub_strtoull() is called to extract the argument +position. However, the returned argument position isn't fully validated. +If the format is something like "%0$x" then these functions return +0 which leads to an underflow in the calculation of the args index, curn. +The fix is to add a check to ensure the extracted argument position is +greater than 0 before computing curn. Additionally, replace one +grub_strtoull() with grub_strtoul() and change curn type to make code +more correct. + +Fixes: CID 473841 + +Signed-off-by: Lidong Chen +Reviewed-by: Daniel Kiper +--- + grub-core/kern/misc.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 98700423d..69bd655f3 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -912,7 +912,7 @@ parse_printf_arg_fmt (const char *fmt0, struct printf_args *args, + while ((c = *fmt++) != 0) + { + int longfmt = 0; +- grub_size_t curn; ++ unsigned long curn; + const char *p; + + if (c != '%') +@@ -930,7 +930,10 @@ parse_printf_arg_fmt (const char *fmt0, struct printf_args *args, + + if (*fmt == '$') + { +- curn = grub_strtoull (p, 0, 10) - 1; ++ curn = grub_strtoul (p, 0, 10); ++ if (curn == 0) ++ continue; ++ curn--; + fmt++; + } + +@@ -1116,6 +1119,8 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, + + if (*fmt == '$') + { ++ if (format1 == 0) ++ continue; + curn = format1 - 1; + fmt++; + format1 = 0; diff --git a/0360-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch b/0360-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch new file mode 100644 index 00000000..9c8819bb --- /dev/null +++ b/0360-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Wed, 12 Feb 2025 10:56:13 -0600 +Subject: [PATCH] loader/i386/linux: Cast left shift to grub_uint32_t + +The Coverity complains that we might overflow into a negative value when +setting linux_params.kernel_alignment to (1 << align). We can remedy +this by casting it to grub_uint32_t. + +Fixes: CID 473876 + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/loader/i386/linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c +index 90121e9bc..33a852197 100644 +--- a/grub-core/loader/i386/linux.c ++++ b/grub-core/loader/i386/linux.c +@@ -823,7 +823,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + GRUB_MEM_ATTR_R|GRUB_MEM_ATTR_W, GRUB_MEM_ATTR_X); + + linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR; +- linux_params.kernel_alignment = (1 << align); ++ linux_params.kernel_alignment = ((grub_uint32_t)1 << align); + linux_params.ps_mouse = linux_params.padding11 = 0; + linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; + diff --git a/0361-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch b/0361-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch new file mode 100644 index 00000000..272293b2 --- /dev/null +++ b/0361-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Wed, 5 Feb 2025 22:04:08 +0000 +Subject: [PATCH] loader/i386/bsd: Use safe math to avoid underflow + +The operation kern_end - kern_start may underflow when we input it into +grub_relocator_alloc_chunk_addr() call. To avoid this we can use safe +math for this subtraction. + +Fixes: CID 73845 + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/loader/i386/bsd.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c +index 8075ac9b0..50f96ea7a 100644 +--- a/grub-core/loader/i386/bsd.c ++++ b/grub-core/loader/i386/bsd.c +@@ -1341,6 +1341,7 @@ static grub_err_t + grub_bsd_load_elf (grub_elf_t elf, const char *filename) + { + grub_err_t err; ++ grub_size_t sz; + + kern_end = 0; + kern_start = ~0; +@@ -1371,8 +1372,11 @@ grub_bsd_load_elf (grub_elf_t elf, const char *filename) + + if (grub_errno) + return grub_errno; +- err = grub_relocator_alloc_chunk_addr (relocator, &ch, +- kern_start, kern_end - kern_start); ++ ++ if (grub_sub (kern_end, kern_start, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, "underflow detected while determining size of kernel for relocator"); ++ ++ err = grub_relocator_alloc_chunk_addr (relocator, &ch, kern_start, sz); + if (err) + return err; + +@@ -1432,8 +1436,10 @@ grub_bsd_load_elf (grub_elf_t elf, const char *filename) + { + grub_relocator_chunk_t ch; + +- err = grub_relocator_alloc_chunk_addr (relocator, &ch, kern_start, +- kern_end - kern_start); ++ if (grub_sub (kern_end, kern_start, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, "underflow detected while determining size of kernel for relocator"); ++ ++ err = grub_relocator_alloc_chunk_addr (relocator, &ch, kern_start, sz); + if (err) + return err; + kern_chunk_src = get_virtual_current_address (ch); diff --git a/grub.patches b/grub.patches index 2cd34418..80d9622e 100644 --- a/grub.patches +++ b/grub.patches @@ -286,3 +286,76 @@ Patch0285: 0285-term-nns8250-spcr-return-if-redirection-is-disabled.patch Patch0286: 0286-commands-legacycfg-Avoid-closing-file-twice.patch Patch0287: 0287-disk-ahci.c-remove-conditional-operator-for-endtime.patch Patch0288: 0288-commands-bli-Fix-crash-in-get_part_uuid.patch +Patch0289: 0289-misc-Implement-grub_strlcpy.patch +Patch0290: 0290-fs-ufs-Fix-a-heap-OOB-write.patch +Patch0291: 0291-fs-hfs-Fix-stack-OOB-write-with-grub_strcpy.patch +Patch0292: 0292-fs-tar-Initialize-name-in-grub_cpio_find_file.patch +Patch0293: 0293-fs-tar-Integer-overflow-leads-to-heap-OOB-write.patch +Patch0294: 0294-fs-f2fs-Set-a-grub_errno-if-mount-fails.patch +Patch0295: 0295-fs-hfsplus-Set-a-grub_errno-if-mount-fails.patch +Patch0296: 0296-fs-iso9660-Set-a-grub_errno-if-mount-fails.patch +Patch0297: 0297-fs-iso9660-Fix-invalid-free.patch +Patch0298: 0298-fs-jfs-Fix-OOB-read-in-jfs_getent.patch +Patch0299: 0299-fs-jfs-Fix-OOB-read-caused-by-invalid-dir-slot-index.patch +Patch0300: 0300-fs-jfs-Use-full-40-bits-offset-and-address-for-a-dat.patch +Patch0301: 0301-fs-jfs-Inconsistent-signed-unsigned-types-usage-in-r.patch +Patch0302: 0302-fs-ext2-Fix-out-of-bounds-read-for-inline-extents.patch +Patch0303: 0303-fs-ntfs-Fix-out-of-bounds-read.patch +Patch0304: 0304-fs-ntfs-Track-the-end-of-the-MFT-attribute-buffer.patch +Patch0305: 0305-fs-ntfs-Use-a-helper-function-to-access-attributes.patch +Patch0306: 0306-fs-ntfs-Implement-attribute-verification.patch +Patch0307: 0307-fs-xfs-Fix-out-of-bounds-read.patch +Patch0308: 0308-fs-xfs-Ensuring-failing-to-mount-sets-a-grub_errno.patch +Patch0309: 0309-kern-file-Ensure-file-data-is-set.patch +Patch0310: 0310-kern-file-Implement-filesystem-reference-counting.patch +Patch0311: 0311-cli_lock-Add-build-option-to-block-command-line-inte.patch +Patch0312: 0312-disk-cryptodisk-Require-authentication-after-TPM-unl.patch +Patch0313: 0313-disk-loopback-Reference-tracking-for-the-loopback.patch +Patch0314: 0314-kern-disk-Limit-recursion-depth.patch +Patch0315: 0315-kern-partition-Limit-recursion-in-part_iterate.patch +Patch0316: 0316-script-execute-Limit-the-recursion-depth.patch +Patch0317: 0317-net-Unregister-net_default_ip-and-net_default_mac-va.patch +Patch0318: 0318-net-Remove-variables-hooks-when-interface-is-unregis.patch +Patch0319: 0319-net-Fix-OOB-write-in-grub_net_search_config_file.patch +Patch0320: 0320-net-tftp-Fix-stack-buffer-overflow-in-tftp_open.patch +Patch0321: 0321-video-readers-jpeg-Do-not-permit-duplicate-SOF0-mark.patch +Patch0322: 0322-kern-dl-Fix-for-an-integer-overflow-in-grub_dl_ref.patch +Patch0323: 0323-kern-dl-Check-for-the-SHF_INFO_LINK-flag-in-grub_dl_.patch +Patch0324: 0324-commands-extcmd-Missing-check-for-failed-allocation.patch +Patch0325: 0325-commands-ls-Fix-NULL-dereference.patch +Patch0326: 0326-commands-pgp-Unregister-the-check_signatures-hooks-o.patch +Patch0327: 0327-normal-Remove-variables-hooks-on-module-unload.patch +Patch0328: 0328-gettext-Remove-variables-hooks-on-module-unload.patch +Patch0329: 0329-gettext-Integer-overflow-leads-to-heap-OOB-write-or-.patch +Patch0330: 0330-gettext-Integer-overflow-leads-to-heap-OOB-write.patch +Patch0331: 0331-commands-read-Fix-an-integer-overflow-when-supplying.patch +Patch0332: 0332-commands-test-Stack-overflow-due-to-unlimited-recurs.patch +Patch0333: 0333-commands-minicmd-Block-the-dump-command-in-lockdown-.patch +Patch0334: 0334-commands-memrw-Disable-memory-reading-in-lockdown-mo.patch +Patch0335: 0335-commands-hexdump-Disable-memory-reading-in-lockdown-.patch +Patch0336: 0336-fs-bfs-Disable-under-lockdown.patch +Patch0337: 0337-fs-Disable-many-filesystems-under-lockdown.patch +Patch0338: 0338-disk-Use-safe-math-macros-to-prevent-overflows.patch +Patch0339: 0339-disk-Prevent-overflows-when-allocating-memory-for-ar.patch +Patch0340: 0340-disk-Check-if-returned-pointer-for-allocated-memory-.patch +Patch0341: 0341-disk-ieee1275-ofdisk-Call-grub_ieee1275_close-when-g.patch +Patch0342: 0342-fs-Use-safe-math-macros-to-prevent-overflows.patch +Patch0343: 0343-fs-Prevent-overflows-when-allocating-memory-for-arra.patch +Patch0344: 0344-fs-Prevent-overflows-when-assigning-returned-values-.patch +Patch0345: 0345-fs-zfs-Use-safe-math-macros-to-prevent-overflows.patch +Patch0346: 0346-fs-zfs-Prevent-overflows-when-allocating-memory-for-.patch +Patch0347: 0347-fs-zfs-Check-if-returned-pointer-for-allocated-memor.patch +Patch0348: 0348-fs-zfs-Add-missing-NULL-check-after-grub_strdup-call.patch +Patch0349: 0349-net-Use-safe-math-macros-to-prevent-overflows.patch +Patch0350: 0350-net-Prevent-overflows-when-allocating-memory-for-arr.patch +Patch0351: 0351-net-Check-if-returned-pointer-for-allocated-memory-i.patch +Patch0352: 0352-fs-sfs-Check-if-allocated-memory-is-NULL.patch +Patch0353: 0353-script-execute-Fix-potential-underflow-and-NULL-dere.patch +Patch0354: 0354-osdep-unix-getroot-Fix-potential-underflow.patch +Patch0355: 0355-misc-Ensure-consistent-overflow-error-messages.patch +Patch0356: 0356-bus-usb-ehci-Define-GRUB_EHCI_TOGGLE-as-grub_uint32_.patch +Patch0357: 0357-normal-menu-Use-safe-math-to-avoid-an-integer-overfl.patch +Patch0358: 0358-kern-partition-Add-sanity-check-after-grub_strtoul-c.patch +Patch0359: 0359-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch +Patch0360: 0360-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch +Patch0361: 0361-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch diff --git a/grub2.spec b/grub2.spec index 852a6783..18afc754 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 23%{?dist} +Release: 24%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,28 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Tue Feb 18 2025 Leo Sandoval - 2.02-24 +- Add Several CVE fixes +- Resolves: CVE-2024-45781 CVE-2024-45783 CVE-2024-45778 +- Resolves: CVE-2024-45775 CVE-2024-45780 CVE-2024-45774 +- Resolves: CVE-2025-0690 CVE-2025-1118 CVE-2024-45782 +- Resolves: CVE-2025-0624 CVE-2024-45779 CVE-2024-45776 +- Resolves: CVE-2025-0622 CVE-2025-0677 +- Related: #RHEL-79703 +- Related: #RHEL-79708 +- Related: #RHEL-79340 +- Related: #RHEL-73786 +- Related: #RHEL-79701 +- Related: #RHEL-73784 +- Related: #RHEL-79856 +- Related: #RHEL-79874 +- Related: #RHEL-79706 +- Related: #RHEL-79836 +- Related: #RHEL-79699 +- Related: #RHEL-75736 +- Related: #RHEL-79712 +- Related: #RHEL-79848 + * Tue Feb 11 2025 Nicolas Frayer 2.12-23 - Revert commit for bootloader update proposal for now as not all components are ready From 0c53016c97b7083b94c0986d1dbcfe782f6b98df Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 25 Feb 2025 16:15:57 +0100 Subject: [PATCH 263/294] fs/ext2: Rework out-of-bounds read for inline and external extents Resolves: #2346804 Signed-off-by: Nicolas Frayer --- ...ut-of-bounds-read-for-inline-and-ext.patch | 65 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 +- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 0362-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch diff --git a/0362-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch b/0362-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch new file mode 100644 index 00000000..c237f462 --- /dev/null +++ b/0362-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 21 Feb 2025 09:06:12 +0800 +Subject: [PATCH] fs/ext2: Rework out-of-bounds read for inline and external + extents + +Previously, the number of extent entries was not properly capped based +on the actual available space. This could lead to insufficient reads for +external extents, since the computation was based solely on the inline +extent layout. + +In this patch, when processing the extent header, we determine whether +the header is stored inline (i.e., at inode->blocks.dir_blocks) or in an +external extent block. We then clamp the number of entries accordingly +(using max_inline_ext for inline extents and max_external_ext for +external extent blocks). + +This change ensures that only the valid number of extent entries is +processed, preventing out-of-bound reads and potential filesystem +corruption. + +Fixes: 7e2f750f0a (fs/ext2: Fix out-of-bounds read for inline extents) + +Signed-off-by: Michael Chang +Tested-by: Christian Hesse +Reviewed-by: Daniel Kiper +--- + grub-core/fs/ext2.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c +index c3058f7..a5650c3 100644 +--- a/grub-core/fs/ext2.c ++++ b/grub-core/fs/ext2.c +@@ -496,7 +496,10 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + int i; + grub_disk_addr_t ret; + grub_uint16_t nent; ++ /* maximum number of extent entries in the inode's inline extent area */ + const grub_uint16_t max_inline_ext = sizeof (inode->blocks) / sizeof (*ext) - 1; /* Minus 1 extent header. */ ++ /* maximum number of extent entries in the external extent block */ ++ const grub_uint16_t max_external_ext = EXT2_BLOCK_SIZE(data) / sizeof (*ext) - 1; /* Minus 1 extent header. */ + + if (grub_ext4_find_leaf (data, (struct grub_ext4_extent_header *) inode->blocks.dir_blocks, + fileblock, &leaf) != GRUB_ERR_NONE) +@@ -513,8 +516,18 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) + + nent = grub_le_to_cpu16 (leaf->entries); + +- if (leaf->depth == 0) ++ /* ++ * Determine the effective number of extent entries (nent) to process: ++ * If the extent header (leaf) is stored inline in the inode’s block ++ * area (i.e. at inode->blocks.dir_blocks), then only max_inline_ext ++ * entries can fit. ++ * Otherwise, if the header was read from an external extent block, use ++ * the larger limit, max_external_ext, based on the full block size. ++ */ ++ if (leaf == (struct grub_ext4_extent_header *) inode->blocks.dir_blocks) + nent = grub_min (nent, max_inline_ext); ++ else ++ nent = grub_min (nent, max_external_ext); + + for (i = 0; i < nent; i++) + { diff --git a/grub.patches b/grub.patches index 80d9622e..c526e11f 100644 --- a/grub.patches +++ b/grub.patches @@ -359,3 +359,4 @@ Patch0358: 0358-kern-partition-Add-sanity-check-after-grub_strtoul-c.patch Patch0359: 0359-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch Patch0360: 0360-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch Patch0361: 0361-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch +Patch0362: 0362-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch diff --git a/grub2.spec b/grub2.spec index 18afc754..daa2987e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 24%{?dist} +Release: 25%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Tue Feb 25 2025 Nicolas Frayer 2.12-25 +- fs/ext2: Rework out-of-bounds read for inline and external extents +- Resolves: #2346804 + * Tue Feb 18 2025 Leo Sandoval - 2.02-24 - Add Several CVE fixes - Resolves: CVE-2024-45781 CVE-2024-45783 CVE-2024-45778 From b04ed232e2addec2fbae39dfb4af4f560607a007 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Mon, 10 Mar 2025 13:08:41 -0600 Subject: [PATCH 264/294] Remove NTFS attribute verification patch The removed patch was part of the CVE patches ported recently into Fedora but unfortunately this is causing segfaults when generating the grub configuration file. At some point the same patch will come back with the corresponding fix but for the time being, it is removed. Note that patch numeration did not change on purpose: patch will be introduced again so need to mess with the numeration. Resolves: #2350327 Signed-off-by: Leo Sandoval --- ...tfs-Implement-attribute-verification.patch | 245 ------------------ grub.patches | 1 - grub2.spec | 6 +- 3 files changed, 5 insertions(+), 247 deletions(-) delete mode 100644 0306-fs-ntfs-Implement-attribute-verification.patch diff --git a/0306-fs-ntfs-Implement-attribute-verification.patch b/0306-fs-ntfs-Implement-attribute-verification.patch deleted file mode 100644 index 4ee1c392..00000000 --- a/0306-fs-ntfs-Implement-attribute-verification.patch +++ /dev/null @@ -1,245 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: B Horn -Date: Tue, 14 May 2024 12:39:56 +0100 -Subject: [PATCH] fs/ntfs: Implement attribute verification - -It was possible to read OOB when an attribute had a size that exceeded -the allocated buffer. This resolves that by making sure all attributes -that get read are fully in the allocated space by implementing -a function to validate them. - -Defining the offsets in include/grub/ntfs.h but they are only used in -the validation function and not across the rest of the NTFS code. - -Signed-off-by: B Horn -Reviewed-by: Daniel Kiper ---- - grub-core/fs/ntfs.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - include/grub/ntfs.h | 22 ++++++++ - 2 files changed, 175 insertions(+) - -diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c -index 1c678f3d0..64f4f2221 100644 ---- a/grub-core/fs/ntfs.c -+++ b/grub-core/fs/ntfs.c -@@ -70,6 +70,149 @@ res_attr_data_len (void *res_attr_ptr) - return u32at (res_attr_ptr, 0x10); - } - -+/* -+ * Check if the attribute is valid and doesn't exceed the allocated region. -+ * This accounts for resident and non-resident data. -+ * -+ * This is based off the documentation from the linux-ntfs project: -+ * https://flatcap.github.io/linux-ntfs/ntfs/concepts/attribute_header.html -+ */ -+static bool -+validate_attribute (grub_uint8_t *attr, void *end) -+{ -+ grub_size_t attr_size = 0; -+ grub_size_t min_size = 0; -+ grub_size_t spare = (grub_uint8_t *) end - attr; -+ /* -+ * Just used as a temporary variable to try and deal with cases where someone -+ * tries to overlap fields. -+ */ -+ grub_size_t curr = 0; -+ -+ /* Need verify we can entirely read the attributes header. */ -+ if (attr + GRUB_NTFS_ATTRIBUTE_HEADER_SIZE >= (grub_uint8_t *) end) -+ goto fail; -+ -+ /* -+ * So, the rest of this code uses a 16bit int for the attribute length but -+ * from reading the all the documentation I could find it says this field is -+ * actually 32bit. But let's be consistent with the rest of the code. -+ * -+ * https://elixir.bootlin.com/linux/v6.10.7/source/fs/ntfs3/ntfs.h#L370 -+ */ -+ attr_size = u16at (attr, GRUB_NTFS_ATTRIBUTE_LENGTH); -+ -+ if (attr_size > spare) -+ goto fail; -+ -+ /* Not an error case, just reached the end of the attributes. */ -+ if (attr_size == 0) -+ return false; -+ -+ /* -+ * Extra validation by trying to calculate a minimum possible size for this -+ * attribute. +8 from the size of the resident data struct which is the -+ * minimum that can be added. -+ */ -+ min_size = GRUB_NTFS_ATTRIBUTE_HEADER_SIZE + 8; -+ -+ if (min_size > attr_size) -+ goto fail; -+ -+ /* Is the data is resident (0) or not (1). */ -+ if (attr[GRUB_NTFS_ATTRIBUTE_RESIDENT] == 0) -+ { -+ /* Read the offset and size of the attribute. */ -+ curr = u16at (attr, GRUB_NTFS_ATTRIBUTE_RES_OFFSET); -+ curr += u32at (attr, GRUB_NTFS_ATTRIBUTE_RES_LENGTH); -+ if (curr > min_size) -+ min_size = curr; -+ } -+ else -+ { -+ /* -+ * If the data is non-resident, the minimum size is 64 which is where -+ * the data runs start. We already have a minimum size of 24. So, just -+ * adding 40 to get to the real value. -+ */ -+ min_size += 40; -+ if (min_size > attr_size) -+ goto fail; -+ /* If the compression unit size is > 0, +8 bytes*/ -+ if (u16at (attr, GRUB_NTFS_ATTRIBUTE_COMPRESSION_UNIT_SIZE) > 0) -+ min_size += 8; -+ -+ /* -+ * Need to consider the data runs now. Each member of the run has byte -+ * that describes the size of the data length and offset. Each being -+ * 4 bits in the byte. -+ */ -+ curr = u16at (attr, GRUB_NTFS_ATTRIBUTE_DATA_RUNS); -+ -+ if (curr + 1 > min_size) -+ min_size = curr + 1; -+ -+ if (min_size > attr_size) -+ goto fail; -+ -+ /* -+ * Each attribute can store multiple data runs which are stored -+ * continuously in the attribute. They exist as one header byte -+ * with up to 14 bytes following it depending on the lengths. -+ * We stop when we hit a header that is just a NUL byte. -+ * -+ * https://flatcap.github.io/linux-ntfs/ntfs/concepts/data_runs.html -+ */ -+ while (attr[curr] != 0) -+ { -+ /* -+ * We stop when we hit a header that is just a NUL byte. The data -+ * run header is stored as a single byte where the top 4 bits refer -+ * to the number of bytes used to store the total length of the -+ * data run, and the number of bytes used to store the offset. -+ * These directly follow the header byte, so we use them to update -+ * the minimum size. -+ */ -+ min_size += (attr[curr] & 0x7) + ((attr[curr] >> 4) & 0x7); -+ curr += min_size; -+ min_size++; -+ if (min_size > attr_size) -+ goto fail; -+ } -+ } -+ -+ /* Name offset, doing this after data residence checks. */ -+ if (u16at (attr, GRUB_NTFS_ATTRIBUTE_NAME_OFFSET) != 0) -+ { -+ curr = u16at (attr, GRUB_NTFS_ATTRIBUTE_NAME_OFFSET); -+ /* -+ * Multiple the name length by 2 as its UTF-16. Can be zero if this in an -+ * unamed attribute. -+ */ -+ curr += attr[GRUB_NTFS_ATTRIBUTE_NAME_LENGTH] * 2; -+ if (curr > min_size) -+ min_size = curr; -+ } -+ -+ /* Padded to 8 bytes. */ -+ if (min_size % 8 != 0) -+ min_size += 8 - (min_size % 8); -+ -+ /* -+ * At this point min_size should be exactly attr_size but being flexible -+ * here to avoid any issues. -+ */ -+ if (min_size > attr_size) -+ goto fail; -+ -+ return true; -+ -+ fail: -+ grub_dprintf ("ntfs", "spare=%" PRIuGRUB_SIZE " min_size=%" PRIuGRUB_SIZE " attr_size=%" PRIuGRUB_SIZE "\n", -+ spare, min_size, attr_size); -+ return false; -+} -+ - /* Return the next attribute if it exists, otherwise return NULL. */ - static grub_uint8_t * - next_attribute (grub_uint8_t *curr_attribute, void *end) -@@ -84,6 +227,8 @@ next_attribute (grub_uint8_t *curr_attribute, void *end) - return NULL; - - next += u16at (curr_attribute, 4); -+ if (validate_attribute (next, end) == false) -+ return NULL; - - return next; - } -@@ -290,6 +435,9 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) - /* From this point on pa_end is the end of the buffer */ - at->end = pa_end; - -+ if (validate_attribute (at->attr_nxt, pa_end) == false) -+ return NULL; -+ - while (at->attr_nxt) - { - if ((*at->attr_nxt == attr) || (attr == 0)) -@@ -319,6 +467,9 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr) - + 1)); - pa = at->attr_nxt + u16at (pa, 4); - -+ if (validate_attribute (pa, pa_end) == true) -+ pa = NULL; -+ - while (pa) - { - if (*pa != attr) -@@ -572,6 +723,8 @@ read_attr (struct grub_ntfs_attr *at, grub_uint8_t *dest, grub_disk_addr_t ofs, - else - vcn = ofs >> (at->mft->data->log_spc + GRUB_NTFS_BLK_SHR); - pa = at->attr_nxt + u16at (at->attr_nxt, 4); -+ if (validate_attribute (pa, at->attr_end) == false) -+ pa = NULL; - - while (pa) - { -diff --git a/include/grub/ntfs.h b/include/grub/ntfs.h -index 2c8078403..77b182acf 100644 ---- a/include/grub/ntfs.h -+++ b/include/grub/ntfs.h -@@ -91,6 +91,28 @@ enum - - #define GRUB_NTFS_ATTRIBUTE_HEADER_SIZE 16 - -+/* -+ * To make attribute validation clearer the offsets for each value in the -+ * attribute headers are defined as macros. -+ * -+ * These offsets are all from: -+ * https://flatcap.github.io/linux-ntfs/ntfs/concepts/attribute_header.html -+ */ -+ -+/* These offsets are part of the attribute header. */ -+#define GRUB_NTFS_ATTRIBUTE_LENGTH 4 -+#define GRUB_NTFS_ATTRIBUTE_RESIDENT 8 -+#define GRUB_NTFS_ATTRIBUTE_NAME_LENGTH 9 -+#define GRUB_NTFS_ATTRIBUTE_NAME_OFFSET 10 -+ -+/* Offsets for values needed for resident data. */ -+#define GRUB_NTFS_ATTRIBUTE_RES_LENGTH 16 -+#define GRUB_NTFS_ATTRIBUTE_RES_OFFSET 20 -+ -+/* Offsets for values needed for non-resident data. */ -+#define GRUB_NTFS_ATTRIBUTE_DATA_RUNS 32 -+#define GRUB_NTFS_ATTRIBUTE_COMPRESSION_UNIT_SIZE 34 -+ - enum - { - GRUB_NTFS_AF_ALST = 1, diff --git a/grub.patches b/grub.patches index c526e11f..a34bf7ac 100644 --- a/grub.patches +++ b/grub.patches @@ -303,7 +303,6 @@ Patch0302: 0302-fs-ext2-Fix-out-of-bounds-read-for-inline-extents.patch Patch0303: 0303-fs-ntfs-Fix-out-of-bounds-read.patch Patch0304: 0304-fs-ntfs-Track-the-end-of-the-MFT-attribute-buffer.patch Patch0305: 0305-fs-ntfs-Use-a-helper-function-to-access-attributes.patch -Patch0306: 0306-fs-ntfs-Implement-attribute-verification.patch Patch0307: 0307-fs-xfs-Fix-out-of-bounds-read.patch Patch0308: 0308-fs-xfs-Ensuring-failing-to-mount-sets-a-grub_errno.patch Patch0309: 0309-kern-file-Ensure-file-data-is-set.patch diff --git a/grub2.spec b/grub2.spec index daa2987e..4c1ebbcb 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 25%{?dist} +Release: 26%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Mon Mar 10 2025 Leo Sandoval 2.12-26 +- Remove 'fs/ntfs: Implement attribute verification' patch +- Resolves: #2350327 + * Tue Feb 25 2025 Nicolas Frayer 2.12-25 - fs/ext2: Rework out-of-bounds read for inline and external extents - Resolves: #2346804 From 50b73378ce59ba59030e03631cf6dca0841e7509 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Wed, 19 Mar 2025 17:59:28 +0100 Subject: [PATCH 265/294] powerpc: increase MIN RMA size for CAS negotiation Signed-off-by: Nicolas Frayer --- ...ase-MIN-RMA-size-for-CAS-negotiation.patch | 117 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 0363-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch diff --git a/0363-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch b/0363-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch new file mode 100644 index 00000000..1e7dc90d --- /dev/null +++ b/0363-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch @@ -0,0 +1,117 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Avnish Chouhan +Date: Thu, 13 Mar 2025 19:45:50 +0530 +Subject: [PATCH] powerpc: increase MIN RMA size for CAS negotiation + +Change RMA size from 512 MB to 768 MB which will result +in more memory at boot time for PowerPC. When vTPM, Secure Boot or +FADump are enabled on PowerPC, the 512 MB RMA memory is not sufficient for +booting. With this 512 MB RMA, GRUB2 runs out of memory and fails to +boot the machine. Sometimes even usage of CDROM requires more memory +for installation and along with the options mentioned above exhausts +the boot memory which results in boot failures. Increasing the RMA size +will resolves multiple out of memory issues observed in PowerPC. + +Failure details (GRUB2 debugs): + + kern/ieee1275/init.c:550: mm requested region of size 8513000, flags 1 + kern/ieee1275/init.c:563: Cannot satisfy allocation and retain minimum runtime space + kern/ieee1275/init.c:550: mm requested region of size 8513000, flags 0 + kern/ieee1275/init.c:563: Cannot satisfy allocation and retain minimum runtime space + kern/file.c:215: Closing `/ppc/ppc64/initrd.img' ... + kern/disk.c:297: Closing `ieee1275//vdevice/v-scsi@30000067/disk@8300000000000000'... + kern/disk.c:311: Closing `ieee1275//vdevice/v-scsi@30000067/disk@8300000000000000' succeeded. + kern/file.c:225: Closing `/ppc/ppc64/initrd.img' failed with 3. + kern/file.c:148: Opening `/ppc/ppc64/initrd.img' succeeded. + error: ../../grub-core/kern/mm.c:552:out of memory. + +Signed-off-by: Avnish Chouhan +--- + grub-core/kern/ieee1275/init.c | 51 +++++++++++++++++++++++++++++++++++++----- + 1 file changed, 46 insertions(+), 5 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 4ec6598cfbb8..bb791f80f41c 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -737,7 +737,7 @@ struct cas_vector + + /* + * Call ibm,client-architecture-support to try to get more RMA. +- * We ask for 512MB which should be enough to verify a distro kernel. ++ * We ask for 768MB which should be enough to verify a distro kernel. + * We ignore most errors: if we don't succeed we'll proceed with whatever + * memory we have. + */ +@@ -809,7 +809,7 @@ grub_ieee1275_ibm_cas (void) + .vec1 = 0x80, /* ignore */ + .vec2_size = 1 + sizeof (struct option_vector2) - 2, + .vec2 = { +- 0, 0, -1, -1, -1, -1, -1, 512, -1, 0, 48 ++ 0, 0, -1, -1, -1, -1, -1, 768, -1, 0, 48 + }, + .vec3_size = 2 - 1, + .vec3 = 0x00e0, /* ask for FP + VMX + DFP but don't halt if unsatisfied */ +@@ -846,6 +846,10 @@ grub_claim_heap (void) + { + grub_err_t err; + grub_uint32_t total = HEAP_MAX_SIZE; ++#if defined(__powerpc__) ++ grub_uint32_t ibm_ca_support_reboot = 0; ++ grub_ssize_t actual; ++#endif + + err = grub_ieee1275_total_mem (&rmo_top); + +@@ -858,11 +862,48 @@ grub_claim_heap (void) + grub_mm_add_region_fn = grub_ieee1275_mm_add_region; + + #if defined(__powerpc__) ++ /* Check if it's a CAS reboot with below property. If so, we will skip CAS call */ ++ if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, ++ "ibm,client-architecture-support-reboot", ++ &ibm_ca_support_reboot, ++ sizeof (ibm_ca_support_reboot), ++ &actual) >= 0) ++ grub_dprintf ("ieee1275", "ibm,client-architecture-support-reboot: %" PRIuGRUB_UINT32_T "\n", ++ ibm_ca_support_reboot); ++ + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY)) + { +- /* if we have an error, don't call CAS, just hope for the best */ +- if (err == GRUB_ERR_NONE && rmo_top < (512 * 1024 * 1024)) +- grub_ieee1275_ibm_cas (); ++ /* ++ * If we have an error, don't call CAS. Just hope for the best. ++ * Along with the above, if the rmo_top is 512 MB or above. We ++ * will skip the CAS call. However, if we call CAS, the rmo_top ++ * will be set to 768 MB via CAS Vector2. But we need to call ++ * CAS with "rmo_top < 512 MB" to avoid the issue on the older ++ * Linux kernel, which still uses rmo_top as 512 MB. If we call ++ * CAS with a condition "rmo_top < 768 MB", it will result in an ++ * issue due to the IBM CAS reboot feature and we won't be able ++ * to boot the newer kernel. Whenever a reboot is detected as ++ * the CAS reboot by GRUB. It will boot the machine with the ++ * last booted kernel by reading the variable "boot-last-label" ++ * which has the info related to the last boot and it's specific ++ * to IBM PowerPC. Due to this, the machine will boot with the ++ * last booted kernel which has rmo_top as 512 MB. Also, if the ++ * reboot is detected as a CAS reboot, the GRUB will skip the CAS ++ * call. As the CAS has already been called earlier, so it is ++ * not required to call CAS even if the other conditions are met. ++ * This condition will also prevent a scenario where the machine ++ * get stuck in the CAS reboot loop while booting. A machine with ++ * an older kernel, having option_vector2 MIN_RMA as 512 MB in ++ * Linux prom_init.c and GRUB uses "rmo_top < 768 MB" condition ++ * for calling CAS. Due to their respective conditions, linux ++ * CAS and GRUB CAS will keep doing the CAS calls and change ++ * the MIN_RMA from 768(changed by GRUB) to 512(changed by Linux) ++ * to 768(changed by GRUB) to 512(changed by Linux) and so on, ++ * and the machine will stuck in this CAS reboot loop forever. ++ * IBM PAPR : https://openpower.foundation/specifications/linuxonpower/ ++ */ ++ if (!ibm_ca_support_reboot && err == GRUB_ERR_NONE && rmo_top < (512 * 1024 * 1024)) ++ grub_ieee1275_ibm_cas (); + } + #endif + diff --git a/grub.patches b/grub.patches index a34bf7ac..1c9cbf18 100644 --- a/grub.patches +++ b/grub.patches @@ -359,3 +359,4 @@ Patch0359: 0359-kern-misc-Add-sanity-check-after-grub_strtoul-call.patch Patch0360: 0360-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch Patch0361: 0361-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch Patch0362: 0362-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch +Patch0363: 0363-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch diff --git a/grub2.spec b/grub2.spec index 4c1ebbcb..df46e8cd 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 26%{?dist} +Release: 27%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Wed Mar 19 2025 Nicolas Frayer 2.12-27 +- powerpc: increase MIN RMA size for CAS negotiation + * Mon Mar 10 2025 Leo Sandoval 2.12-26 - Remove 'fs/ntfs: Implement attribute verification' patch - Resolves: #2350327 From c48d4f67195675dbfbcdfd8406e61ac1a9aef2f5 Mon Sep 17 00:00:00 2001 From: Nils Kattenbeck Date: Fri, 14 Mar 2025 19:15:04 +0000 Subject: [PATCH 266/294] Drop 'which' requirement Since 28a7e597de0d5584f65e36f9588ff9041936e617, occurrences of 'which' were replaced by 'command -v' Signed-off-by: Nils Kattenbeck --- grub.macros | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub.macros b/grub.macros index 417b3649..ee1687aa 100644 --- a/grub.macros +++ b/grub.macros @@ -323,7 +323,7 @@ This subpackage provides support for rebuilding your own grub.efi. \ %{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\ %{expand:%%package %%{1}-tools} \ Summary: Support tools for GRUB. \ -Requires: gettext-runtime os-prober which file system-logos \ +Requires: gettext-runtime os-prober file system-logos \ Requires: grub2-common = %{evr} \ Requires: grub2-tools-minimal = %{evr} \ Requires: os-prober >= 1.58-11 \ From 42b2a048bf4e6497046ac6e96896d97d7957d898 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Mon, 24 Mar 2025 15:54:10 +0000 Subject: [PATCH 267/294] Fix the fallback mechanism when menu entries fail to boot Patch 0098 accidentally broke the fallback mechanism, although it also exposed another bug in upstream GRUB. The first of these new patches fixes the upstream bug. It has already been merged there. The second patch deals with the main issue. Signed-off-by: James Le Cuirot --- ...on-t-let-trailing-blank-lines-determ.patch | 66 +++++++++++++++++++ ...k-return-code-of-the-script-when-exe.patch | 45 +++++++++++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 0364-script-execute-Don-t-let-trailing-blank-lines-determ.patch create mode 100644 0365-normal-menu-Check-return-code-of-the-script-when-exe.patch diff --git a/0364-script-execute-Don-t-let-trailing-blank-lines-determ.patch b/0364-script-execute-Don-t-let-trailing-blank-lines-determ.patch new file mode 100644 index 00000000..fd2eb2bf --- /dev/null +++ b/0364-script-execute-Don-t-let-trailing-blank-lines-determ.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +Date: Thu, 24 Oct 2024 14:42:46 +0100 +Subject: [PATCH] script/execute: Don't let trailing blank lines determine the + return code + +grub_script_execute_sourcecode() parses and executes code one line at a +time, updating the return code each time because only the last line +determines the final status. However, trailing new lines were also +executed, masking any failure on the previous line. Fix this by only +trying to execute the command when there is actually one present. + +This has presumably never been noticed because this code is not used by +regular functions, only in special cases like eval and menu entries. The +latter generally don't return at all, having booted an OS. When failing +to boot, upstream GRUB triggers the fallback mechanism regardless of the +return code. + +We noticed the problem while using Red Hat's patches, which change this +behaviour to take account of the return code. In that case, a failure +takes you back to the menu rather than triggering a fallback. + +Signed-off-by: James Le Cuirot +--- + grub-core/script/execute.c | 5 ++++- + tests/grub_script_eval.in | 10 +++++++++- + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c +index 014132703..3d26a3fe4 100644 +--- a/grub-core/script/execute.c ++++ b/grub-core/script/execute.c +@@ -952,7 +952,10 @@ grub_script_execute_sourcecode (const char *source) + break; + } + +- ret = grub_script_execute (parsed_script); ++ /* Don't let trailing blank lines determine the return code. */ ++ if (parsed_script->cmd) ++ ret = grub_script_execute (parsed_script); ++ + grub_script_free (parsed_script); + grub_free (line); + } +diff --git a/tests/grub_script_eval.in b/tests/grub_script_eval.in +index c97b78d77..9c6211042 100644 +--- a/tests/grub_script_eval.in ++++ b/tests/grub_script_eval.in +@@ -3,4 +3,12 @@ + eval echo "Hello world" + valname=tst + eval $valname=hi +-echo $tst +\ No newline at end of file ++echo $tst ++ ++if eval " ++false ++"; then ++ echo should have failed ++else ++ echo failed as expected ++fi +-- +2.48.1 + diff --git a/0365-normal-menu-Check-return-code-of-the-script-when-exe.patch b/0365-normal-menu-Check-return-code-of-the-script-when-exe.patch new file mode 100644 index 00000000..3ce0eec3 --- /dev/null +++ b/0365-normal-menu-Check-return-code-of-the-script-when-exe.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +Date: Thu, 24 Oct 2024 15:00:26 +0100 +Subject: [PATCH] normal/menu: Check return code of the script when executing a + menu entry + +Don't rely on grub_errno here because grub_script_execute_new_scope() +calls grub_print_error(), which always resets grub_errno back to +GRUB_ERR_NONE. It may also get reset by grub_wait_after_message(). + +This problem was observed when a "bad signature" error resulted in the +menu being redisplayed rather than the fallback mechanism being +triggered, although another change was also needed to fix it. This only +happens with Red Hat's patches because upstream GRUB triggers the +fallback mechanism regardless of the return code. + +Signed-off-by: James Le Cuirot +--- + grub-core/normal/menu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c +index 97687013c..a2703dabb 100644 +--- a/grub-core/normal/menu.c ++++ b/grub-core/normal/menu.c +@@ -377,14 +377,14 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot) + if (ptr && ptr[0] && ptr[1]) + grub_env_set ("default", ptr + 1); + +- grub_script_execute_new_scope (entry->sourcecode, entry->argc, entry->args); ++ err = grub_script_execute_new_scope (entry->sourcecode, entry->argc, entry->args); + + if (errs_before != grub_err_printed_errors) + grub_wait_after_message (); + + errs_before = grub_err_printed_errors; + +- if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ()) ++ if (err == GRUB_ERR_NONE && grub_loader_is_loaded ()) + /* Implicit execution of boot, only if something is loaded. */ + err = grub_command_execute ("boot", 0, 0); + +-- +2.48.1 + diff --git a/grub.patches b/grub.patches index 1c9cbf18..b2beb130 100644 --- a/grub.patches +++ b/grub.patches @@ -360,3 +360,5 @@ Patch0360: 0360-loader-i386-linux-Cast-left-shift-to-grub_uint32_t.patch Patch0361: 0361-loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch Patch0362: 0362-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch Patch0363: 0363-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch +Patch0364: 0364-script-execute-Don-t-let-trailing-blank-lines-determ.patch +Patch0365: 0365-normal-menu-Check-return-code-of-the-script-when-exe.patch diff --git a/grub2.spec b/grub2.spec index df46e8cd..61e883cf 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 27%{?dist} +Release: 28%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Tue Mar 25 2025 Nicolas Frayer 2.12-28 +- Fix the fallback mechanism when menu entries fail to boot + * Wed Mar 19 2025 Nicolas Frayer 2.12-27 - powerpc: increase MIN RMA size for CAS negotiation From cbf45b1f246d8ce54cb403866569b021caafb882 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 25 Mar 2025 19:17:46 +0100 Subject: [PATCH 268/294] ieee1275/ofnet: Fix grub_malloc() removed after added safe Signed-off-by: Nicolas Frayer --- ...ix-grub_malloc-removed-after-added-s.patch | 32 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 ++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 0366-ieee1275-ofnet-Fix-grub_malloc-removed-after-added-s.patch diff --git a/0366-ieee1275-ofnet-Fix-grub_malloc-removed-after-added-s.patch b/0366-ieee1275-ofnet-Fix-grub_malloc-removed-after-added-s.patch new file mode 100644 index 00000000..92da0261 --- /dev/null +++ b/0366-ieee1275-ofnet-Fix-grub_malloc-removed-after-added-s.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Frayer +Date: Wed, 19 Mar 2025 17:39:41 +0100 +Subject: [PATCH] ieee1275/ofnet: Fix grub_malloc() removed after added safe + math functions + +grub_malloc() has been inadvertently removed from the ieee1275/ofnet +code after it has been modified to use safe match function. + +Fixes: 4beeff8a (net: Use safe math macros to prevent overflows) + +Tested-by: Marta Lewandowska +Reviewed-by: Daniel Kiper +Signed-off-by: Nicolas Frayer +--- + grub-core/net/drivers/ieee1275/ofnet.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c +index 3e1b9094e2ab..37bc82467f60 100644 +--- a/grub-core/net/drivers/ieee1275/ofnet.c ++++ b/grub-core/net/drivers/ieee1275/ofnet.c +@@ -463,6 +463,9 @@ search_net_devices (struct grub_ieee1275_devalias *alias) + return 0; + } + } ++ ++ ofdata->path = grub_malloc(sz); ++ + if (!ofdata->path) + { + grub_print_error (); diff --git a/grub.patches b/grub.patches index b2beb130..f66be291 100644 --- a/grub.patches +++ b/grub.patches @@ -362,3 +362,4 @@ Patch0362: 0362-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch Patch0363: 0363-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch Patch0364: 0364-script-execute-Don-t-let-trailing-blank-lines-determ.patch Patch0365: 0365-normal-menu-Check-return-code-of-the-script-when-exe.patch +Patch0366: 0366-ieee1275-ofnet-Fix-grub_malloc-removed-after-added-s.patch diff --git a/grub2.spec b/grub2.spec index 61e883cf..fd57f0a2 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 28%{?dist} +Release: 29%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Tue Mar 25 2025 Nicolas Frayer 2.12-29 +- ieee1275/ofnet: Fix grub_malloc() removed after added safe + * Tue Mar 25 2025 Nicolas Frayer 2.12-28 - Fix the fallback mechanism when menu entries fail to boot From 439310c622c2e8b6f8485c438741098f61aca61f Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Tue, 25 Mar 2025 13:12:15 -0600 Subject: [PATCH 269/294] do-sync: helper script to sync dist-git and git branches The bootloader team manually synchronizes several git branches on the rhboot/grub (git) repository based on dist-git (dist-git) repository. Although this task is simple, it is a maintenance burden, usually done much after the dist-git repository is updated, having out-of-sync git branches most of the time. The goal of the included script is to create a temporal branch based on latest git branch then include those possible missing dist-git patches and finally push it. Signed-off-by: Leo Sandoval --- do-sync | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 do-sync diff --git a/do-sync b/do-sync new file mode 100755 index 00000000..bfb2371c --- /dev/null +++ b/do-sync @@ -0,0 +1,89 @@ +#!/bin/bash + +set -o nounset +set -o errexit + +usage() { + echo "Usage $0 :::" + echo "Generates a (rhboot) grub2 branch which contains latest patches from dist-git based on specific Fedora/RHEL version" + echo "Command expects a single parameter delimited with colons, with the following meanings:" + echo " pkgtool: Package tool, e.g. fedpkg, rhpkg, etc." + echo " dist_git_branch: The dist-git branch/release to sync" + echo " git_branch: The git branch/release to sync" + echo " git_base_commit: base commit where git_branch is based on" + echo + echo "Examples:" + echo + echo " $0 fedpkg:rawhide:fedora-43:grub-2.12" + echo " $0 fedpkg:f42:fedora-42:grub-2.12" + echo " $0 fedpkg:f41:fedora-41:grub-2.12" + echo " $0 fedpkg:f40:fedora-40:grub-2.12" + echo + echo "Also handles RHEL branches:" + echo + echo " $0 rhpkg:rhel-10-main:rhel-10-main:grub-2.12" + echo " $0 rhpkg:rhel-9-main:rhel-9-main:grub-2.06" + echo " $0 rhpkg:rhel-8-main:rhel-8-main:f28-branchpoint" + exit 1 +} + +# check params +[ $# -eq 1 ] || usage + +args=$1 + +pkgtool=$(echo "$args" | awk -F ':' '{print $1}') +dist_git_branch=$(echo "$args" | awk -F ':' '{print $2}') +git_branch=$(echo "$args" | awk -F ':' '{print $3}') +git_base_commit=$(echo "$args" | awk -F ':' '{print $4}') + +# working dirs +dist_git_dir=/tmp/grub/dist-git +git_dir=/tmp/grub/git + +rm -rf $dist_git_dir $git_dir +mkdir -p $dist_git_dir $git_dir + + +pushd $dist_git_dir > /dev/null +{ + # clone grub2 package anonymously + $pkgtool clone -a grub2 . 2>/dev/null + + # create a local branch, all fine if already exists + git checkout -q -b "$dist_git_branch" origin/"$dist_git_branch" 2> /dev/null || true +} +popd > /dev/null + + +pushd $git_dir > /dev/null +{ + git clone -q git@github.com:rhboot/grub2.git . 2>/dev/null + + dist_git_sync_branch=${git_branch}-dist-git-$(date +"%Y-%m-%d-%H_%M_%S") + git checkout -q -b "$dist_git_sync_branch" "$git_base_commit" + while read -r line; do + p=$(echo "$line" | awk '{print $2}') + git am -q "$dist_git_dir/$p" 2>/dev/null + done < $dist_git_dir/grub.patches + + # brach current git_branch based on upstream git_branch + git branch -D "$git_branch" 2>/dev/null || true + git checkout -q -b "$git_branch" origin/"$git_branch" + + missing_commits=$(git cherry "${git_branch}" "${dist_git_sync_branch}" | grep ^+ | wc -l) + if [[ $missing_commits -eq 0 ]]; then + echo "Branch $git_branch is up-to-date, no need to sync" + else + echo "Missing commits ($missing_commits) which would be integrated in final branch" + git cherry "$git_branch" "$dist_git_sync_branch" -v | grep ^+ + # finally cherry pick those missing patches + git cherry "$git_branch" "$dist_git_sync_branch" 2>/dev/null | grep ^+ | sed 's/\+ //' | xargs git cherry-pick 2>/dev/null + + echo "Pushing latest commits" + cd "$git_dir" + git push -v origin "$git_branch" + fi +} +popd > /dev/null + From 5c361bf70675268ba79cc904eaa601e3b3470a99 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 18 Apr 2025 16:42:30 +0200 Subject: [PATCH 270/294] ppc/mkimage: SBAT support on powerpc Signed-off-by: Nicolas Frayer --- ...mkimage-Create-new-ELF-note-for-SBAT.patch | 167 ++++++++++++++++++ ...-SBAT-metadata-into-ELF-note-for-Pow.patch | 45 +++++ grub.patches | 2 + grub2.spec | 5 +- 4 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 0367-grub-mkimage-Create-new-ELF-note-for-SBAT.patch create mode 100644 0368-grub-mkimage-Add-SBAT-metadata-into-ELF-note-for-Pow.patch diff --git a/0367-grub-mkimage-Create-new-ELF-note-for-SBAT.patch b/0367-grub-mkimage-Create-new-ELF-note-for-SBAT.patch new file mode 100644 index 00000000..25023c80 --- /dev/null +++ b/0367-grub-mkimage-Create-new-ELF-note-for-SBAT.patch @@ -0,0 +1,167 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sudhakar Kuppusamy +Date: Wed, 23 Oct 2024 17:54:32 +0530 +Subject: [PATCH] grub-mkimage: Create new ELF note for SBAT + +In order to store the SBAT data we create a new ELF note. The string +".sbat", zero-padded to 4 byte alignment, shall be entered in the name +field. The string "SBAT"'s ASCII values, 0x53424154, should be entered +in the type field. + +Signed-off-by: Daniel Axtens +Signed-off-by: Sudhakar Kuppusamy +Reviewed-by: Daniel Kiper +--- + include/grub/util/mkimage.h | 4 ++-- + util/grub-mkimagexx.c | 48 +++++++++++++++++++++++++++++++++++++++++++-- + util/mkimage.c | 5 +++-- + 3 files changed, 51 insertions(+), 6 deletions(-) + +diff --git a/include/grub/util/mkimage.h b/include/grub/util/mkimage.h +index 6f1da89b9b65..881e3031f41f 100644 +--- a/include/grub/util/mkimage.h ++++ b/include/grub/util/mkimage.h +@@ -51,12 +51,12 @@ grub_mkimage_load_image64 (const char *kernel_path, + const struct grub_install_image_target_desc *image_target); + void + grub_mkimage_generate_elf32 (const struct grub_install_image_target_desc *image_target, +- int note, size_t appsig_size, char **core_img, size_t *core_size, ++ int note, size_t appsig_size, char *sbat, char **core_img, size_t *core_size, + Elf32_Addr target_addr, + struct grub_mkimage_layout *layout); + void + grub_mkimage_generate_elf64 (const struct grub_install_image_target_desc *image_target, +- int note, size_t appsig_size, char **core_img, size_t *core_size, ++ int note, size_t appsig_size, char *sbat, char **core_img, size_t *core_size, + Elf64_Addr target_addr, + struct grub_mkimage_layout *layout); + +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index 9488f052510a..b9930544889d 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -116,6 +116,14 @@ struct section_metadata + const char *strtab; + }; + ++#define GRUB_SBAT_NOTE_NAME ".sbat" ++#define GRUB_SBAT_NOTE_TYPE 0x53424154 /* "SBAT" */ ++ ++struct grub_sbat_note { ++ Elf32_Nhdr header; ++ char name[ALIGN_UP(sizeof(GRUB_SBAT_NOTE_NAME), 4)]; ++}; ++ + static int + is_relocatable (const struct grub_install_image_target_desc *image_target) + { +@@ -217,7 +225,7 @@ grub_arm_reloc_jump24 (grub_uint32_t *target, Elf32_Addr sym_addr) + + void + SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc *image_target, +- int note, size_t appsig_size, char **core_img, size_t *core_size, ++ int note, size_t appsig_size, char *sbat, char **core_img, size_t *core_size, + Elf_Addr target_addr, + struct grub_mkimage_layout *layout) + { +@@ -226,10 +234,17 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + Elf_Ehdr *ehdr; + Elf_Phdr *phdr; + Elf_Shdr *shdr; +- int header_size, footer_size = 0; ++ int header_size, footer_size = 0, footer_offset = 0; + int phnum = 1; + int shnum = 4; + int string_size = sizeof (".text") + sizeof ("mods") + 1; ++ char *footer; ++ ++ if (sbat) ++ { ++ phnum++; ++ footer_size += ALIGN_UP (sizeof (struct grub_sbat_note) + layout->sbat_size, 4); ++ } + + if (appsig_size) + { +@@ -263,6 +278,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + ehdr = (void *) elf_img; + phdr = (void *) (elf_img + sizeof (*ehdr)); + shdr = (void *) (elf_img + sizeof (*ehdr) + phnum * sizeof (*phdr)); ++ footer = elf_img + program_size + header_size; + memcpy (ehdr->e_ident, ELFMAG, SELFMAG); + ehdr->e_ident[EI_CLASS] = ELFCLASSXX; + if (!image_target->bigendian) +@@ -435,6 +451,8 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + phdr->p_filesz = grub_host_to_target32 (XEN_NOTE_SIZE); + phdr->p_memsz = 0; + phdr->p_offset = grub_host_to_target32 (header_size + program_size); ++ footer = ptr; ++ footer_offset = XEN_NOTE_SIZE; + } + + if (image_target->id == IMAGE_XEN_PVH) +@@ -468,6 +486,8 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + phdr->p_filesz = grub_host_to_target32 (XEN_PVH_NOTE_SIZE); + phdr->p_memsz = 0; + phdr->p_offset = grub_host_to_target32 (header_size + program_size); ++ footer = ptr; ++ footer_offset = XEN_PVH_NOTE_SIZE; + } + + if (note) +@@ -498,6 +518,30 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + phdr->p_filesz = grub_host_to_target32 (note_size); + phdr->p_memsz = 0; + phdr->p_offset = grub_host_to_target32 (header_size + program_size); ++ footer = (elf_img + program_size + header_size + note_size); ++ footer_offset += note_size; ++ } ++ ++ if (sbat) ++ { ++ int note_size = ALIGN_UP (sizeof (struct grub_sbat_note) + layout->sbat_size, 4); ++ struct grub_sbat_note *note_ptr = (struct grub_sbat_note *) footer; ++ ++ note_ptr->header.n_namesz = grub_host_to_target32 (sizeof (GRUB_SBAT_NOTE_NAME)); ++ note_ptr->header.n_descsz = grub_host_to_target32 (ALIGN_UP(layout->sbat_size, 4)); ++ note_ptr->header.n_type = grub_host_to_target32 (GRUB_SBAT_NOTE_TYPE); ++ memcpy (note_ptr->name, GRUB_SBAT_NOTE_NAME, sizeof (GRUB_SBAT_NOTE_NAME)); ++ memcpy ((char *)(note_ptr + 1), sbat, layout->sbat_size); ++ ++ phdr++; ++ phdr->p_type = grub_host_to_target32 (PT_NOTE); ++ phdr->p_flags = grub_host_to_target32 (PF_R); ++ phdr->p_align = grub_host_to_target32 (image_target->voidp_sizeof); ++ phdr->p_vaddr = 0; ++ phdr->p_paddr = 0; ++ phdr->p_filesz = grub_host_to_target32 (note_size); ++ phdr->p_memsz = 0; ++ phdr->p_offset = grub_host_to_target32 (header_size + program_size + footer_offset); + } + + if (appsig_size) { +diff --git a/util/mkimage.c b/util/mkimage.c +index f31fdefa814a..7fa6a7b21954 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -1848,6 +1848,7 @@ grub_install_generate_image (const char *dir, const char *prefix, + case IMAGE_I386_IEEE1275: + { + grub_uint64_t target_addr; ++ char *sbat = NULL; + if (image_target->id == IMAGE_LOONGSON_ELF) + { + if (comp == GRUB_COMPRESSION_NONE) +@@ -1859,10 +1860,10 @@ grub_install_generate_image (const char *dir, const char *prefix, + else + target_addr = image_target->link_addr; + if (image_target->voidp_sizeof == 4) +- grub_mkimage_generate_elf32 (image_target, note, appsig_size, &core_img, ++ grub_mkimage_generate_elf32 (image_target, note, appsig_size, sbat, &core_img, + &core_size, target_addr, &layout); + else +- grub_mkimage_generate_elf64 (image_target, note, appsig_size, &core_img, ++ grub_mkimage_generate_elf64 (image_target, note, appsig_size, sbat, &core_img, + &core_size, target_addr, &layout); + } + break; diff --git a/0368-grub-mkimage-Add-SBAT-metadata-into-ELF-note-for-Pow.patch b/0368-grub-mkimage-Add-SBAT-metadata-into-ELF-note-for-Pow.patch new file mode 100644 index 00000000..1ce74aed --- /dev/null +++ b/0368-grub-mkimage-Add-SBAT-metadata-into-ELF-note-for-Pow.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sudhakar Kuppusamy +Date: Wed, 23 Oct 2024 17:54:33 +0530 +Subject: [PATCH] grub-mkimage: Add SBAT metadata into ELF note for PowerPC + targets + +The SBAT metadata is read from CSV file and transformed into an ELF note +with the -s option. + +Signed-off-by: Daniel Axtens +Signed-off-by: Sudhakar Kuppusamy +Reviewed-by: Daniel Kiper +--- + util/mkimage.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/util/mkimage.c b/util/mkimage.c +index 7fa6a7b21954..f92949d1df25 100644 +--- a/util/mkimage.c ++++ b/util/mkimage.c +@@ -957,8 +957,8 @@ grub_install_generate_image (const char *dir, const char *prefix, + total_module_size += dtb_size + sizeof (struct grub_module_header); + } + +- if (sbat_path != NULL && image_target->id != IMAGE_EFI) +- grub_util_error (_(".sbat section can be embedded into EFI images only")); ++ if (sbat_path != NULL && (image_target->id != IMAGE_EFI && image_target->id != IMAGE_PPC)) ++ grub_util_error (_("SBAT data can be added only to EFI or powerpc-ieee1275 images")); + + if (disable_shim_lock) + total_module_size += sizeof (struct grub_module_header); +@@ -1849,6 +1849,13 @@ grub_install_generate_image (const char *dir, const char *prefix, + { + grub_uint64_t target_addr; + char *sbat = NULL; ++ if (sbat_path != NULL) ++ { ++ sbat_size = grub_util_get_image_size (sbat_path); ++ sbat = xmalloc (sbat_size); ++ grub_util_load_image (sbat_path, sbat); ++ layout.sbat_size = sbat_size; ++ } + if (image_target->id == IMAGE_LOONGSON_ELF) + { + if (comp == GRUB_COMPRESSION_NONE) diff --git a/grub.patches b/grub.patches index f66be291..84b88325 100644 --- a/grub.patches +++ b/grub.patches @@ -363,3 +363,5 @@ Patch0363: 0363-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch Patch0364: 0364-script-execute-Don-t-let-trailing-blank-lines-determ.patch Patch0365: 0365-normal-menu-Check-return-code-of-the-script-when-exe.patch Patch0366: 0366-ieee1275-ofnet-Fix-grub_malloc-removed-after-added-s.patch +Patch0367: 0367-grub-mkimage-Create-new-ELF-note-for-SBAT.patch +Patch0368: 0368-grub-mkimage-Add-SBAT-metadata-into-ELF-note-for-Pow.patch diff --git a/grub2.spec b/grub2.spec index fd57f0a2..80339324 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 29%{?dist} +Release: 30%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Fri Apr 18 2025 Nicolas Frayer - 2.12-30 +- ppc/mkimage: SBAT support on powerpc + * Tue Mar 25 2025 Nicolas Frayer 2.12-29 - ieee1275/ofnet: Fix grub_malloc() removed after added safe From ffc692d90ebf145f491a91deb22fb715cd699ec4 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Wed, 7 May 2025 14:03:06 -0600 Subject: [PATCH 271/294] Handle special kernel parameter characters properly Resolves: #2362821 Signed-off-by: Leo Sandoval --- ...pe-kernel-option-characters-properly.patch | 47 +++++++++++++++++++ ...variable-is-escaped-before-consideri.patch | 26 ++++++++++ grub.patches | 2 + grub2.spec | 6 ++- 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 0369-10_linux.in-escape-kernel-option-characters-properly.patch create mode 100644 0370-blscfg-check-if-variable-is-escaped-before-consideri.patch diff --git a/0369-10_linux.in-escape-kernel-option-characters-properly.patch b/0369-10_linux.in-escape-kernel-option-characters-properly.patch new file mode 100644 index 00000000..fe245e8e --- /dev/null +++ b/0369-10_linux.in-escape-kernel-option-characters-properly.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 7 May 2025 13:23:37 -0600 +Subject: [PATCH] 10_linux.in: escape kernel option characters properly + +This handles cases where kernel options, specifically the values, +contain special characters, in this case ';', '&' and '$'. + +For example, the user defines the following GRUB_CMDLINE_LINUX on the +default grub file /etc/default/grub, note the dolar sign on the 'memmap' +option + + GRUB_CMDLINE_LINUX="console=ttyS0 memmap=32g\\\$0x2000000000" + +then regenerating the grub cfg and BLS options line with the +grub2-mkconfig command, resulting into + + options root=UUID=6baedf23-2510-499a-815d-48b58cf6e619 ro + rootflags=subvol=root console=ttyS0 memmap=32g\$0x2000000000 + +without this patch, we would end up with + + options root=UUID=6baedf23-2510-499a-815d-48b58cf6e619 ro + rootflags=subvol=root console=ttyS0 memmap=32g$0x2000000000 + +Note the missing '\' which is required to escape the '$', otherwise +it would be consider a variable by blscfg parser which is not the case. + +Signed-off-by: Leo Sandoval +--- + util/grub.d/10_linux.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 11c19304f8..cdfb72a1e3 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -178,6 +178,9 @@ update_bls_cmdline() + options="${options} ${GRUB_CMDLINE_LINUX_DEBUG}" + fi + options="$(echo "${options}" | sed -e 's/\//\\\//g')" ++ options="$(echo "${options}" | sed -e 's/\;/\\\;/g')" ++ options="$(echo "${options}" | sed -e 's/\\&/\\\\&/g')" ++ options="$(echo "${options}" | sed -e 's/\$/\\\$/g')" + sed -i -e "s/^options.*/options ${options}/" "${blsdir}/${bls}.conf" + done + } diff --git a/0370-blscfg-check-if-variable-is-escaped-before-consideri.patch b/0370-blscfg-check-if-variable-is-escaped-before-consideri.patch new file mode 100644 index 00000000..fba69064 --- /dev/null +++ b/0370-blscfg-check-if-variable-is-escaped-before-consideri.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Wed, 7 May 2025 13:49:47 -0600 +Subject: [PATCH] blscfg: check if variable is escaped before considering one + +Otherwise escaped variables are considered real variables. + +Signed-off-by: Leo Sandoval +--- + grub-core/commands/blscfg.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 6e398fc175..5d931b0c9b 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -695,7 +695,8 @@ static char *expand_val(const char *value) + return NULL; + + while (*value) { +- if (*value == '$') { ++ /* It's a variable only when *value is '$' and it is not escaped with '\'*/ ++ if (*value == '$' && *end != '\\') { + if (start != end) { + buffer = field_append(is_var, buffer, start, end); + if (!buffer) diff --git a/grub.patches b/grub.patches index 84b88325..35da1c35 100644 --- a/grub.patches +++ b/grub.patches @@ -365,3 +365,5 @@ Patch0365: 0365-normal-menu-Check-return-code-of-the-script-when-exe.patch Patch0366: 0366-ieee1275-ofnet-Fix-grub_malloc-removed-after-added-s.patch Patch0367: 0367-grub-mkimage-Create-new-ELF-note-for-SBAT.patch Patch0368: 0368-grub-mkimage-Add-SBAT-metadata-into-ELF-note-for-Pow.patch +Patch0369: 0369-10_linux.in-escape-kernel-option-characters-properly.patch +Patch0370: 0370-blscfg-check-if-variable-is-escaped-before-consideri.patch diff --git a/grub2.spec b/grub2.spec index 80339324..24a99e05 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 30%{?dist} +Release: 31%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Tue May 6 2025 Leo Sandoval 2.12-31 +- Handle special kernel parameter characters properly +- Resolves: #2362821 + * Fri Apr 18 2025 Nicolas Frayer - 2.12-30 - ppc/mkimage: SBAT support on powerpc From 9fa1c31cb25091d51f93d1b0104eb0ebf2e3ca08 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Tue, 6 May 2025 12:50:25 -0600 Subject: [PATCH 272/294] Fix cryptodisk vulnerabilities Resolves: CVE-2025-4382 Signed-off-by: Leo Sandoval --- ...er-Block-the-rescue-mode-until-the-C.patch | 30 ++++ ...Introduce-the-cryptodisk-only-argume.patch | 133 ++++++++++++++++ ...er-Introduce-the-cryptocheck-command.patch | 133 ++++++++++++++++ ...ds-search-Add-the-diskfilter-support.patch | 67 ++++++++ ...cument-available-crypto-disks-checks.patch | 68 ++++++++ ...odisk-Add-the-erase-secrets-function.patch | 147 ++++++++++++++++++ ...disk-Wipe-the-passphrase-from-memory.patch | 29 ++++ 0378-cryptocheck-Add-quiet-option.patch | 114 ++++++++++++++ grub.patches | 8 + grub2.spec | 6 +- 10 files changed, 734 insertions(+), 1 deletion(-) create mode 100644 0371-kern-rescue_reader-Block-the-rescue-mode-until-the-C.patch create mode 100644 0372-commands-search-Introduce-the-cryptodisk-only-argume.patch create mode 100644 0373-disk-diskfilter-Introduce-the-cryptocheck-command.patch create mode 100644 0374-commands-search-Add-the-diskfilter-support.patch create mode 100644 0375-docs-Document-available-crypto-disks-checks.patch create mode 100644 0376-disk-cryptodisk-Add-the-erase-secrets-function.patch create mode 100644 0377-disk-cryptodisk-Wipe-the-passphrase-from-memory.patch create mode 100644 0378-cryptocheck-Add-quiet-option.patch diff --git a/0371-kern-rescue_reader-Block-the-rescue-mode-until-the-C.patch b/0371-kern-rescue_reader-Block-the-rescue-mode-until-the-C.patch new file mode 100644 index 00000000..5d588b1c --- /dev/null +++ b/0371-kern-rescue_reader-Block-the-rescue-mode-until-the-C.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Fri, 28 Feb 2025 17:00:53 +0300 +Subject: [PATCH] kern/rescue_reader: Block the rescue mode until the CLI + authentication + +This further mitigates potential misuse of the CLI after the +root device has been successfully unlocked via TPM. + +Fixes: CVE-2025-4382 + +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/kern/rescue_reader.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/rescue_reader.c b/grub-core/kern/rescue_reader.c +index 4259857ba9..a71ada8fb7 100644 +--- a/grub-core/kern/rescue_reader.c ++++ b/grub-core/kern/rescue_reader.c +@@ -79,7 +79,7 @@ void __attribute__ ((noreturn)) + grub_rescue_run (void) + { + /* Stall if the CLI has been disabled */ +- if (grub_is_cli_disabled ()) ++ if (grub_is_cli_disabled () || grub_is_cli_need_auth ()) + { + grub_printf ("Rescue mode has been disabled...\n"); + diff --git a/0372-commands-search-Introduce-the-cryptodisk-only-argume.patch b/0372-commands-search-Introduce-the-cryptodisk-only-argume.patch new file mode 100644 index 00000000..53e7eaae --- /dev/null +++ b/0372-commands-search-Introduce-the-cryptodisk-only-argume.patch @@ -0,0 +1,133 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Sat, 1 Mar 2025 14:16:48 +0300 +Subject: [PATCH] commands/search: Introduce the --cryptodisk-only argument + +This allows users to restrict the "search" command's scope to +encrypted disks only. + +Typically, this command is used to "rebase" $root and $prefix +before loading additional configuration files via "source" or +"configfile". Unfortunately, this leads to security problems, +like CVE-2023-4001, when an unexpected, attacker-controlled +device is chosen by the "search" command. + +The --cryptodisk-only argument allows users to ensure that the +file system picked is encrypted. + +This feature supports the CLI authentication, blocking bypass +attempts. + +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/commands/search.c | 20 ++++++++++++++++++++ + grub-core/commands/search_wrap.c | 7 ++++++- + grub-core/normal/main.c | 3 ++- + include/grub/search.h | 9 +++++---- + 4 files changed, 33 insertions(+), 6 deletions(-) + +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index d538b36219..84362b54b3 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -182,6 +182,26 @@ iterate_device (const char *name, void *data) + grub_device_close (dev); + } + ++ /* Limit to encrypted disks when requested. */ ++ if (ctx->flags & SEARCH_FLAGS_CRYPTODISK_ONLY) ++ { ++ grub_device_t dev; ++ ++ dev = grub_device_open (name); ++ if (dev == NULL) ++ { ++ grub_errno = GRUB_ERR_NONE; ++ return 0; ++ } ++ if (dev->disk == NULL || dev->disk->dev->id != GRUB_DISK_DEVICE_CRYPTODISK_ID) ++ { ++ grub_device_close (dev); ++ grub_errno = GRUB_ERR_NONE; ++ return 0; ++ } ++ grub_device_close (dev); ++ } ++ + /* Skip it if it's not the root device when requested. */ + if (ctx->flags & SEARCH_FLAGS_ROOTDEV_ONLY) + { +diff --git a/grub-core/commands/search_wrap.c b/grub-core/commands/search_wrap.c +index 4fe6440c65..ec2fb638f1 100644 +--- a/grub-core/commands/search_wrap.c ++++ b/grub-core/commands/search_wrap.c +@@ -41,6 +41,7 @@ static const struct grub_arg_option options[] = + ARG_TYPE_STRING}, + {"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0}, + {"efidisk-only", 0, 0, N_("Only probe EFI disks."), 0, 0}, ++ {"cryptodisk-only", 0, 0, N_("Only probe encrypted disks."), 0, 0}, + {"root-dev-only", 'r', 0, N_("Only probe root device."), 0, 0}, + {"hint", 'h', GRUB_ARG_OPTION_REPEATABLE, + N_("First try the device HINT. If HINT ends in comma, " +@@ -76,6 +77,7 @@ enum options + SEARCH_SET, + SEARCH_NO_FLOPPY, + SEARCH_EFIDISK_ONLY, ++ SEARCH_CRYPTODISK_ONLY, + SEARCH_ROOTDEV_ONLY, + SEARCH_HINT, + SEARCH_HINT_IEEE1275, +@@ -191,6 +193,9 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args) + if (state[SEARCH_EFIDISK_ONLY].set) + flags |= SEARCH_FLAGS_EFIDISK_ONLY; + ++ if (state[SEARCH_CRYPTODISK_ONLY].set) ++ flags |= SEARCH_FLAGS_CRYPTODISK_ONLY; ++ + if (state[SEARCH_ROOTDEV_ONLY].set) + flags |= SEARCH_FLAGS_ROOTDEV_ONLY; + +@@ -215,7 +220,7 @@ GRUB_MOD_INIT(search) + cmd = + grub_register_extcmd ("search", grub_cmd_search, + GRUB_COMMAND_FLAG_EXTRACTOR | GRUB_COMMAND_ACCEPT_DASH, +- N_("[-f|-l|-u|-s|-n] [--hint HINT [--hint HINT] ...]" ++ N_("[-f|-l|-u|-s|-n] [--cryptodisk-only] [--hint HINT [--hint HINT] ...]" + " NAME"), + N_("Search devices by file, filesystem label" + " or filesystem UUID." +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index dd20e51290..6f7290a897 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -615,7 +615,8 @@ static const char *features[] = { + "feature_chainloader_bpb", "feature_ntldr", "feature_platform_search_hint", + "feature_default_font_path", "feature_all_video_module", + "feature_menuentry_id", "feature_menuentry_options", "feature_200_final", +- "feature_nativedisk_cmd", "feature_timeout_style" ++ "feature_nativedisk_cmd", "feature_timeout_style", ++ "feature_search_cryptodisk_only" + }; + + GRUB_MOD_INIT(normal) +diff --git a/include/grub/search.h b/include/grub/search.h +index 9343c66b13..b6b5c8be1f 100644 +--- a/include/grub/search.h ++++ b/include/grub/search.h +@@ -21,10 +21,11 @@ + + enum search_flags + { +- SEARCH_FLAGS_NONE = 0, +- SEARCH_FLAGS_NO_FLOPPY = 1, +- SEARCH_FLAGS_EFIDISK_ONLY = 2, +- SEARCH_FLAGS_ROOTDEV_ONLY = 4 ++ SEARCH_FLAGS_NONE = 0, ++ SEARCH_FLAGS_NO_FLOPPY = 1, ++ SEARCH_FLAGS_EFIDISK_ONLY = 2, ++ SEARCH_FLAGS_ROOTDEV_ONLY = 4, ++ SEARCH_FLAGS_CRYPTODISK_ONLY = 8 + }; + + void grub_search_fs_file (const char *key, const char *var, diff --git a/0373-disk-diskfilter-Introduce-the-cryptocheck-command.patch b/0373-disk-diskfilter-Introduce-the-cryptocheck-command.patch new file mode 100644 index 00000000..a56fc858 --- /dev/null +++ b/0373-disk-diskfilter-Introduce-the-cryptocheck-command.patch @@ -0,0 +1,133 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Sun, 2 Mar 2025 18:08:22 +0300 +Subject: [PATCH] disk/diskfilter: Introduce the "cryptocheck" command + +This command examines a given diskfilter device, e.g., an LVM disk, +and checks if underlying disks, physical volumes, are cryptodisks, +e.g., LUKS disks, this layout is called "LVM-on-LUKS". + +The return value is 0 when all underlying disks (of a given device) +are cryptodisks (1 if at least one disk is unencrypted or in an +unknown state). + +Users are encouraged to include the relevant check before loading +anything from an LVM disk that is supposed to be encrypted. + +This further supports the CLI authentication, blocking bypass +attempts when booting from an encrypted LVM disk. + +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/disk/diskfilter.c | 75 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 75 insertions(+) + +diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c +index fef0b815ab..216be6a782 100644 +--- a/grub-core/disk/diskfilter.c ++++ b/grub-core/disk/diskfilter.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1365,6 +1366,73 @@ grub_diskfilter_get_pv_from_disk (grub_disk_t disk, + } + #endif + ++static int ++grub_diskfilter_check_pvs_encrypted (grub_disk_t disk, int *pvs_cnt) ++{ ++ struct grub_diskfilter_lv *lv = disk->data; ++ struct grub_diskfilter_pv *pv; ++ ++ *pvs_cnt = 0; ++ ++ if (lv->vg->pvs) ++ for (pv = lv->vg->pvs; pv; pv = pv->next) ++ { ++ (*pvs_cnt)++; ++ ++ if (pv->disk == NULL) ++ { ++ /* Can be a partially activated VG, bail out. */ ++ return GRUB_ERR_TEST_FAILURE; ++ } ++ ++ if (pv->disk->dev->id != GRUB_DISK_DEVICE_CRYPTODISK_ID) ++ { ++ /* All backing devices must be cryptodisks, stop. */ ++ return GRUB_ERR_TEST_FAILURE; ++ } ++ } ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_cmd_cryptocheck (grub_command_t cmd __attribute__ ((unused)), ++ int argc, char **args) ++{ ++ grub_disk_t disk; ++ int check_pvs_res; ++ int namelen; ++ int pvs_cnt; ++ ++ if (argc != 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("disk name expected")); ++ ++ namelen = grub_strlen (args[0]); ++ if (namelen > 2 && (args[0][0] == '(') && (args[0][namelen - 1] == ')')) ++ args[0][namelen - 1] = 0; ++ else ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("invalid disk: %s"), ++ args[0]); ++ ++ if (!is_valid_diskfilter_name (&args[0][1])) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("unrecognized disk: %s"), ++ &args[0][1]); ++ ++ disk = grub_disk_open (&args[0][1]); ++ if (disk == NULL) ++ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("no such disk: %s"), ++ &args[0][1]); ++ ++ check_pvs_res = grub_diskfilter_check_pvs_encrypted (disk, &pvs_cnt); ++ grub_disk_close (disk); ++ ++ grub_printf("%s is %sencrypted (%d pv%s examined)\n", &args[0][1], ++ (check_pvs_res == GRUB_ERR_NONE) ? "" : "un", ++ pvs_cnt, ++ (pvs_cnt > 1) ? "s" : ""); ++ ++ return check_pvs_res; ++} ++ + static struct grub_disk_dev grub_diskfilter_dev = + { + .name = "diskfilter", +@@ -1381,14 +1449,21 @@ static struct grub_disk_dev grub_diskfilter_dev = + .next = 0 + }; + ++static grub_command_t cmd; ++ + + GRUB_MOD_INIT(diskfilter) + { + grub_disk_dev_register (&grub_diskfilter_dev); ++ cmd = grub_register_command ("cryptocheck", grub_cmd_cryptocheck, ++ N_("DEVICE"), ++ N_("Check if a logical volume resides on encrypted disks.")); + } + + GRUB_MOD_FINI(diskfilter) + { + grub_disk_dev_unregister (&grub_diskfilter_dev); ++ if (cmd != NULL) ++ grub_unregister_command (cmd); + free_array (); + } diff --git a/0374-commands-search-Add-the-diskfilter-support.patch b/0374-commands-search-Add-the-diskfilter-support.patch new file mode 100644 index 00000000..5edb3ea8 --- /dev/null +++ b/0374-commands-search-Add-the-diskfilter-support.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Sun, 2 Mar 2025 23:32:43 +0300 +Subject: [PATCH] commands/search: Add the diskfilter support + +When the --cryptodisk-only argument is given, also check the target +device using the "cryptocheck" command, if available. + +This extends the checks to common layouts like LVM-on-LUKS, so the +--cryptodisk-only argument transparently handles such setups. + +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/commands/search.c | 32 +++++++++++++++++++++++++++++++- + 1 file changed, 31 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index 84362b54b3..1cf714ad7d 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -150,6 +150,36 @@ check_for_duplicate (const char *name, void *data) + return ret; + } + ++static bool ++is_unencrypted_disk (grub_disk_t disk) ++{ ++ grub_command_t cmd; ++ char *disk_str; ++ int disk_str_len; ++ int res; ++ ++ if (disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) ++ return false; /* This is (crypto) disk. */ ++ ++ if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID) ++ { ++ cmd = grub_command_find ("cryptocheck"); ++ if (cmd == NULL) /* No diskfilter module loaded for some reason. */ ++ return true; ++ ++ disk_str_len = grub_strlen (disk->name) + 2 + 1; ++ disk_str = grub_malloc (disk_str_len); ++ if (disk_str == NULL) /* Something is wrong, better report as unencrypted. */ ++ return true; ++ ++ grub_snprintf (disk_str, disk_str_len, "(%s)", disk->name); ++ res = cmd->func (cmd, 1, &disk_str); ++ grub_free (disk_str); ++ return (res != GRUB_ERR_NONE) ? true : false; /* GRUB_ERR_NONE for encrypted. */ ++ } ++ return true; ++} ++ + /* Helper for FUNC_NAME. */ + static int + iterate_device (const char *name, void *data) +@@ -193,7 +223,7 @@ iterate_device (const char *name, void *data) + grub_errno = GRUB_ERR_NONE; + return 0; + } +- if (dev->disk == NULL || dev->disk->dev->id != GRUB_DISK_DEVICE_CRYPTODISK_ID) ++ if (dev->disk == NULL || is_unencrypted_disk (dev->disk) == true) + { + grub_device_close (dev); + grub_errno = GRUB_ERR_NONE; diff --git a/0375-docs-Document-available-crypto-disks-checks.patch b/0375-docs-Document-available-crypto-disks-checks.patch new file mode 100644 index 00000000..ac22920f --- /dev/null +++ b/0375-docs-Document-available-crypto-disks-checks.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Mon, 10 Mar 2025 15:33:46 +0300 +Subject: [PATCH] docs: Document available crypto disks checks + +Document the --cryptodisk-only argument. Also, document the +"cryptocheck" command invoked when that argument is processed. + +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + docs/grub.texi | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 2d6d73a78d..93e23be99d 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -4365,6 +4365,7 @@ you forget a command, you can run the command @command{help} + * configfile:: Load a configuration file + * cpuid:: Check for CPU features + * crc:: Compute or check CRC32 checksums ++* cryptocheck:: Check if a device is encrypted + * cryptomount:: Mount a crypto device + * cutmem:: Remove memory regions + * date:: Display or set current date and time +@@ -4674,6 +4675,16 @@ Alias for @code{hashsum --hash crc32 arg @dots{}}. See command @command{hashsum} + (@pxref{hashsum}) for full description. + @end deffn + ++@node cryptocheck ++@subsection cryptocheck ++ ++@deffn Command cryptocheck device ++Check if a given diskfilter device is backed by encrypted devices ++(@pxref{cryptomount} for additional information). ++ ++The command examines all backing devices, physical volumes, of a specified ++logical volume, like LVM2, and fails when at least one of them is unencrypted. ++@end deffn + + @node cryptomount + @subsection cryptomount +@@ -5522,7 +5533,8 @@ unbootable. @xref{Using GPG-style digital signatures}, for more information. + + @deffn Command search @ + [@option{--file}|@option{--label}|@option{--fs-uuid}] @ +- [@option{--set} [var]] [@option{--no-floppy}|@option{--efidisk-only}] name ++ [@option{--set} [var]] [@option{--no-floppy}|@option{--efidisk-only}|@option{--cryptodisk-only}] @ ++ name + Search devices by file (@option{-f}, @option{--file}), filesystem label + (@option{-l}, @option{--label}), or filesystem UUID (@option{-u}, + @option{--fs-uuid}). +@@ -5537,6 +5549,14 @@ devices, which can be slow. + The (@option{--efidisk-only}) option prevents searching any other devices then + EFI disks. This is typically used when chainloading to local EFI partition. + ++The (@option{--cryptodisk-only}) option prevents searching any devices other ++than encrypted disks. This is typically used when booting from an encrypted ++file system to ensure that no code gets executed from an unencrypted device ++having the same filesystem UUID or label. ++ ++This option implicitly invokes the command @command{cryptocheck}, if it is ++available (@pxref{cryptocheck} for additional information). ++ + The @samp{search.file}, @samp{search.fs_label}, and @samp{search.fs_uuid} + commands are aliases for @samp{search --file}, @samp{search --label}, and + @samp{search --fs-uuid} respectively. diff --git a/0376-disk-cryptodisk-Add-the-erase-secrets-function.patch b/0376-disk-cryptodisk-Add-the-erase-secrets-function.patch new file mode 100644 index 00000000..5a995cf3 --- /dev/null +++ b/0376-disk-cryptodisk-Add-the-erase-secrets-function.patch @@ -0,0 +1,147 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Tue, 6 May 2025 12:25:20 -0600 +Subject: [PATCH] disk/cryptodisk: Add the "erase secrets" function + +This commit adds the grub_cryptodisk_erasesecrets() function to wipe +master keys from all cryptodisks. This function is EFI-only. + +Since there is no easy way to "force unmount" a given encrypted disk, +this function renders all mounted cryptodisks unusable. An attempt to +read them will return garbage. + +This is why this function must be used in "no way back" conditions. + +Currently, it is used when unloading the cryptodisk module and when +performing the "exit" command (it is often used to switch to the next +EFI application). This function is not called when performing the +"chainloader" command, because the callee may return to GRUB. For this +reason, users are encouraged to use "exit" instead of "chainloader" to +execute third-party boot applications. + +This function does not guarantee that all secrets are wiped from RAM. +Console output, chunks from disk read requests and other may remain. + +This function does not clear the IV prefix and rekey key for geli disks. + +Also, this commit adds the relevant documentation improvements. + +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + docs/grub.texi | 6 ++++++ + grub-core/commands/minicmd.c | 11 +++++++++++ + grub-core/disk/cryptodisk.c | 28 ++++++++++++++++++++++++++++ + include/grub/cryptodisk.h | 1 + + 4 files changed, 46 insertions(+) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 93e23be99d..0af47b5ade 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -4721,6 +4721,11 @@ namespace in addition to the cryptodisk namespace. + + Support for plain encryption mode (plain dm-crypt) is provided via separate + @command{@pxref{plainmount}} command. ++ ++On the EFI platform, GRUB tries to erase master keys from memory when the cryptodisk ++module is unloaded or the command @command{exit} is executed. All secrets remain in ++memory when the command @command{chainloader} is issued, because execution can ++return to GRUB on the EFI platform. + @end deffn + + @node cutmem +@@ -6982,6 +6987,7 @@ USB support provides benefits similar to ATA (for USB disks) or AT (for USB + keyboards). In addition it allows USBserial. + + Chainloading refers to the ability to load another bootloader through the same protocol ++and on some platforms, like EFI, allow that bootloader to return to the GRUB. + + Hints allow faster disk discovery by already knowing in advance which is the disk in + question. On some platforms hints are correct unless you move the disk between boots. +diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c +index 9efb7718c3..eb786766a8 100644 +--- a/grub-core/commands/minicmd.c ++++ b/grub-core/commands/minicmd.c +@@ -29,6 +29,10 @@ + #include + #include + ++#ifdef GRUB_MACHINE_EFI ++#include ++#endif ++ + GRUB_MOD_LICENSE ("GPLv3+"); + + /* cat FILE */ +@@ -199,6 +203,13 @@ grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)), + retval = n; + } + ++#ifdef GRUB_MACHINE_EFI ++ /* ++ * The "exit" command is often used to launch the next boot application. ++ * So, erase the secrets. ++ */ ++ grub_cryptodisk_erasesecrets (); ++#endif + grub_exit (retval); + /* Not reached. */ + } +diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c +index 8727760100..9597d2d3bd 100644 +--- a/grub-core/disk/cryptodisk.c ++++ b/grub-core/disk/cryptodisk.c +@@ -1677,6 +1677,31 @@ grub_cryptodisk_challenge_password (void) + + return GRUB_ERR_NONE; + } ++ ++void ++grub_cryptodisk_erasesecrets (void) ++{ ++ grub_cryptodisk_t i; ++ grub_uint8_t *buf; ++ ++ buf = grub_zalloc (GRUB_CRYPTODISK_MAX_KEYLEN); ++ if (buf == NULL) ++ grub_fatal ("grub_cryptodisk_erasesecrets: cannot allocate memory"); ++ ++ for (i = cryptodisk_list; i != NULL; i = i->next) ++ if (grub_cryptodisk_setkey (i, buf, i->keysize)) ++ grub_fatal ("grub_cryptodisk_erasesecrets: cannot erase secrets for %s", i->source); ++ else ++ grub_printf ("Erased crypto secrets for %s\n", i->source); ++ /* ++ * Unfortunately, there is no way to "force unmount" a given disk, it may ++ * have mounted "child" disks as well, e.g., an LVM volume. So, this ++ * function MUST be called when there is no way back, e.g., when exiting. ++ * Otherwise, subsequent read calls for a cryptodisk will return garbage. ++ */ ++ ++ grub_free (buf); ++} + #endif /* GRUB_MACHINE_EFI */ + + struct grub_procfs_entry luks_script = +@@ -1700,6 +1725,9 @@ GRUB_MOD_INIT (cryptodisk) + + GRUB_MOD_FINI (cryptodisk) + { ++#ifdef GRUB_MACHINE_EFI ++ grub_cryptodisk_erasesecrets (); ++#endif + grub_disk_dev_unregister (&grub_cryptodisk_dev); + cryptodisk_cleanup (); + grub_unregister_extcmd (cmd); +diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h +index d2572f8b05..ef307dfd5d 100644 +--- a/include/grub/cryptodisk.h ++++ b/include/grub/cryptodisk.h +@@ -189,5 +189,6 @@ grub_cryptodisk_t grub_cryptodisk_get_by_source_disk (grub_disk_t disk); + + #ifdef GRUB_MACHINE_EFI + grub_err_t grub_cryptodisk_challenge_password (void); ++void grub_cryptodisk_erasesecrets (void); + #endif + #endif diff --git a/0377-disk-cryptodisk-Wipe-the-passphrase-from-memory.patch b/0377-disk-cryptodisk-Wipe-the-passphrase-from-memory.patch new file mode 100644 index 00000000..17405318 --- /dev/null +++ b/0377-disk-cryptodisk-Wipe-the-passphrase-from-memory.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maxim Suhanov +Date: Tue, 4 Mar 2025 15:27:59 +0300 +Subject: [PATCH] disk/cryptodisk: Wipe the passphrase from memory + +Switching to another EFI boot application while there are secrets in +RAM is dangerous, because not all firmware is wiping memory on free. + +To reduce the attack surface, wipe the passphrase acquired when +unlocking an encrypted volume. + +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + grub-core/disk/cryptodisk.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c +index 9597d2d3bd..26457095d3 100644 +--- a/grub-core/disk/cryptodisk.c ++++ b/grub-core/disk/cryptodisk.c +@@ -1164,6 +1164,7 @@ grub_cryptodisk_scan_device_real (const char *name, + + if (askpass) + { ++ grub_memset (cargs->key_data, 0, cargs->key_len); + cargs->key_len = 0; + grub_free (cargs->key_data); + } diff --git a/0378-cryptocheck-Add-quiet-option.patch b/0378-cryptocheck-Add-quiet-option.patch new file mode 100644 index 00000000..b62c6403 --- /dev/null +++ b/0378-cryptocheck-Add-quiet-option.patch @@ -0,0 +1,114 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Fri, 14 Mar 2025 19:03:39 +0800 +Subject: [PATCH] cryptocheck: Add --quiet option + +The option can be used to suppress output if we only want to test the +return value of the command. + +Also, mention this option in the documentation. + +Signed-off-by: Michael Chang +Signed-off-by: Maxim Suhanov +Reviewed-by: Daniel Kiper +--- + docs/grub.texi | 4 +++- + grub-core/commands/search.c | 7 ++++++- + grub-core/disk/diskfilter.c | 25 +++++++++++++++++++------ + 3 files changed, 28 insertions(+), 8 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 0af47b5ade..ae01e8c994 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -4678,12 +4678,14 @@ Alias for @code{hashsum --hash crc32 arg @dots{}}. See command @command{hashsum} + @node cryptocheck + @subsection cryptocheck + +-@deffn Command cryptocheck device ++@deffn Command cryptocheck [ @option{--quiet} ] device + Check if a given diskfilter device is backed by encrypted devices + (@pxref{cryptomount} for additional information). + + The command examines all backing devices, physical volumes, of a specified + logical volume, like LVM2, and fails when at least one of them is unencrypted. ++ ++The option @option{--quiet} can be given to suppress the output. + @end deffn + + @node cryptomount +diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c +index 1cf714ad7d..c432c0ac6f 100644 +--- a/grub-core/commands/search.c ++++ b/grub-core/commands/search.c +@@ -163,6 +163,9 @@ is_unencrypted_disk (grub_disk_t disk) + + if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID) + { ++ char opt[] = "--quiet"; ++ char *args[2]; ++ + cmd = grub_command_find ("cryptocheck"); + if (cmd == NULL) /* No diskfilter module loaded for some reason. */ + return true; +@@ -173,7 +176,9 @@ is_unencrypted_disk (grub_disk_t disk) + return true; + + grub_snprintf (disk_str, disk_str_len, "(%s)", disk->name); +- res = cmd->func (cmd, 1, &disk_str); ++ args[0] = opt; ++ args[1] = disk_str; ++ res = cmd->func (cmd, 2, args); + grub_free (disk_str); + return (res != GRUB_ERR_NONE) ? true : false; /* GRUB_ERR_NONE for encrypted. */ + } +diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c +index 216be6a782..04b64aebc6 100644 +--- a/grub-core/disk/diskfilter.c ++++ b/grub-core/disk/diskfilter.c +@@ -1402,6 +1402,19 @@ grub_cmd_cryptocheck (grub_command_t cmd __attribute__ ((unused)), + int check_pvs_res; + int namelen; + int pvs_cnt; ++ int opt_quiet = 0; ++ ++ if (argc == 2) ++ { ++ if (grub_strcmp (args[0], "--quiet") == 0) ++ { ++ opt_quiet = 1; ++ argc--; ++ args++; ++ } ++ else ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unrecognized option: %s"), args[0]); ++ } + + if (argc != 1) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("disk name expected")); +@@ -1424,11 +1437,11 @@ grub_cmd_cryptocheck (grub_command_t cmd __attribute__ ((unused)), + + check_pvs_res = grub_diskfilter_check_pvs_encrypted (disk, &pvs_cnt); + grub_disk_close (disk); +- +- grub_printf("%s is %sencrypted (%d pv%s examined)\n", &args[0][1], +- (check_pvs_res == GRUB_ERR_NONE) ? "" : "un", +- pvs_cnt, +- (pvs_cnt > 1) ? "s" : ""); ++ if (!opt_quiet) ++ grub_printf ("%s is %sencrypted (%d pv%s examined)\n", &args[0][1], ++ (check_pvs_res == GRUB_ERR_NONE) ? "" : "un", ++ pvs_cnt, ++ (pvs_cnt > 1) ? "s" : ""); + + return check_pvs_res; + } +@@ -1456,7 +1469,7 @@ GRUB_MOD_INIT(diskfilter) + { + grub_disk_dev_register (&grub_diskfilter_dev); + cmd = grub_register_command ("cryptocheck", grub_cmd_cryptocheck, +- N_("DEVICE"), ++ N_("[--quiet] DEVICE"), + N_("Check if a logical volume resides on encrypted disks.")); + } + diff --git a/grub.patches b/grub.patches index 35da1c35..099a466a 100644 --- a/grub.patches +++ b/grub.patches @@ -367,3 +367,11 @@ Patch0367: 0367-grub-mkimage-Create-new-ELF-note-for-SBAT.patch Patch0368: 0368-grub-mkimage-Add-SBAT-metadata-into-ELF-note-for-Pow.patch Patch0369: 0369-10_linux.in-escape-kernel-option-characters-properly.patch Patch0370: 0370-blscfg-check-if-variable-is-escaped-before-consideri.patch +Patch0371: 0371-kern-rescue_reader-Block-the-rescue-mode-until-the-C.patch +Patch0372: 0372-commands-search-Introduce-the-cryptodisk-only-argume.patch +Patch0373: 0373-disk-diskfilter-Introduce-the-cryptocheck-command.patch +Patch0374: 0374-commands-search-Add-the-diskfilter-support.patch +Patch0375: 0375-docs-Document-available-crypto-disks-checks.patch +Patch0376: 0376-disk-cryptodisk-Add-the-erase-secrets-function.patch +Patch0377: 0377-disk-cryptodisk-Wipe-the-passphrase-from-memory.patch +Patch0378: 0378-cryptocheck-Add-quiet-option.patch diff --git a/grub2.spec b/grub2.spec index 24a99e05..6e47a6f2 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 31%{?dist} +Release: 32%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Tue May 06 2025 Leo Sandoval - 2.12-32 +- Fix several cryptodisk vulnerabilities +- Resolves: CVE-2025-4382 + * Tue May 6 2025 Leo Sandoval 2.12-31 - Handle special kernel parameter characters properly - Resolves: #2362821 From 90894071215470197c875b23b79e9b1306e4243e Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 16 May 2025 11:35:27 +0200 Subject: [PATCH 273/294] sbat: bump grub sbat Signed-off-by: Nicolas Frayer --- grub2.spec | 5 ++++- sbat.csv.in | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/grub2.spec b/grub2.spec index 6e47a6f2..ec8c3015 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 32%{?dist} +Release: 33%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Fri May 16 2025 Nicolas Frayer - 2.12-33 +- sbat: bump grub sbat + * Tue May 06 2025 Leo Sandoval - 2.12-32 - Fix several cryptodisk vulnerabilities - Resolves: CVE-2025-4382 diff --git a/sbat.csv.in b/sbat.csv.in index b338b5f5..f8372dfd 100755 --- a/sbat.csv.in +++ b/sbat.csv.in @@ -1,3 +1,3 @@ sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md -grub,3,Free Software Foundation,grub,@@VERSION@@,https//www.gnu.org/software/grub/ +grub,5,Free Software Foundation,grub,@@VERSION@@,https//www.gnu.org/software/grub/ grub.rh,2,Red Hat,grub2,@@VERSION_RELEASE@@,mailto:secalert@redhat.com From 9400ee8e83f5b78ad1ec6d0a74381caa0109f9eb Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Wed, 28 May 2025 18:23:00 +0200 Subject: [PATCH 274/294] Some fixes addressing memory freeing and dereferencing Resolves: #2368939 Resolves: #2368945 Signed-off-by: Nicolas Frayer --- ...ader-efi-chainloader-Fix-double-free.patch | 25 +++++++++++++++ ...nloader-Fix-null-pointer-dereference.patch | 31 +++++++++++++++++++ grub.patches | 2 ++ grub2.spec | 7 ++++- 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0379-loader-efi-chainloader-Fix-double-free.patch create mode 100644 0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch diff --git a/0379-loader-efi-chainloader-Fix-double-free.patch b/0379-loader-efi-chainloader-Fix-double-free.patch new file mode 100644 index 00000000..ae51483b --- /dev/null +++ b/0379-loader-efi-chainloader-Fix-double-free.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Frauendorfer | Miray Software +Date: Wed, 21 May 2025 10:56:19 +0200 +Subject: [PATCH] loader/efi/chainloader: Fix double free + +Signed-off-by: Thomas Frauendorfer | Miray Software +Reviewed-by: Nicolas Frayer +--- + grub-core/loader/efi/chainloader.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 7652f5a..0a78d0d 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -1193,9 +1193,6 @@ fail: + if (address) + grub_efi_free_pages (address, pages); + +- if (cmdline) +- grub_free (cmdline); +- + if (image_handle != NULL) + grub_efi_unload_image (image_handle); + diff --git a/0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch b/0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch new file mode 100644 index 00000000..1a5048ab --- /dev/null +++ b/0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Frauendorfer | Miray Software +Date: Tue, 20 May 2025 09:20:46 +0200 +Subject: [PATCH] loader/efi/chainloader: Fix null pointer dereference + +This fixes a null pointer access during netboot +introduced in +* Allow chainloading EFI apps from loop mounts. + +The commit accesses dev->disk without testing it. +But when booting through network dev->disk will be NULL + +Signed-off-by: Thomas Frauendorfer | Miray Software +Reviewed-by: Nicolas Frayer +--- + grub-core/loader/efi/chainloader.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 0a78d0d..a004020 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -1006,7 +1006,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_free (devname); + + /* if device is loopback, use underlying dev */ +- if (dev && dev->disk->dev->id == GRUB_DISK_DEVICE_LOOPBACK_ID) ++ if (dev && dev->disk && dev->disk->dev->id == GRUB_DISK_DEVICE_LOOPBACK_ID) + { + struct grub_loopback *d; + orig_dev = dev; diff --git a/grub.patches b/grub.patches index 099a466a..3601fbc0 100644 --- a/grub.patches +++ b/grub.patches @@ -375,3 +375,5 @@ Patch0375: 0375-docs-Document-available-crypto-disks-checks.patch Patch0376: 0376-disk-cryptodisk-Add-the-erase-secrets-function.patch Patch0377: 0377-disk-cryptodisk-Wipe-the-passphrase-from-memory.patch Patch0378: 0378-cryptocheck-Add-quiet-option.patch +Patch0379: 0379-loader-efi-chainloader-Fix-double-free.patch +Patch0380: 0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch diff --git a/grub2.spec b/grub2.spec index ec8c3015..f253bd9c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 33%{?dist} +Release: 34%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Wed May 28 2025 Nicolas Frayer - 2.12-34 +- Some fixes addressing memory freeing and dereferencing +- Resolves: #2368939 +- Resolves: #2368945 + * Fri May 16 2025 Nicolas Frayer - 2.12-33 - sbat: bump grub sbat From 0e28d5ff185ac8a0e5ecd3a8417af7c0b5c39766 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Thu, 5 Jun 2025 10:56:47 +0200 Subject: [PATCH 275/294] osdep/linux/getroot: Detect DDF container similar to IMSM Signed-off-by: Nicolas Frayer --- ...oot-Detect-DDF-container-similar-to-.patch | 86 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch diff --git a/0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch b/0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch new file mode 100644 index 00000000..95628b3b --- /dev/null +++ b/0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch @@ -0,0 +1,86 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Thu, 24 Apr 2025 11:43:28 +0200 +Subject: [PATCH] osdep/linux/getroot: Detect DDF container similar to IMSM +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Similarly to Intel IMSM, there are BIOS and UEFI implementations that +support DDF containers natively. + +DDF and IMSM are very similar in handling, especially these should not +be considered as RAID abstraction. This fixes the requirement of having +a device map when probing DDF containers. + +Fixes: https://issues.redhat.com/browse/RHEL-44336 + +Signed-off-by: Renaud Métrich +Reviewed-by: Daniel Kiper +--- + grub-core/osdep/linux/getroot.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index b832593213e6..4bf386b590b5 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -127,7 +127,7 @@ struct btrfs_ioctl_search_args { + struct btrfs_ioctl_fs_info_args) + + static int +-grub_util_is_imsm (const char *os_dev); ++grub_util_is_imsm_or_ddf (const char *os_dev); + + + #define ESCAPED_PATH_MAX (4 * PATH_MAX) +@@ -759,10 +759,10 @@ out: + } + + static int +-grub_util_is_imsm (const char *os_dev) ++grub_util_is_imsm_or_ddf (const char *os_dev) + { + int retry; +- int is_imsm = 0; ++ int is_imsm_or_ddf = 0; + int container_seen = 0; + const char *dev = os_dev; + +@@ -823,10 +823,17 @@ grub_util_is_imsm (const char *os_dev) + if (strncmp (buf, "MD_METADATA=imsm", + sizeof ("MD_METADATA=imsm") - 1) == 0) + { +- is_imsm = 1; ++ is_imsm_or_ddf = 1; + grub_util_info ("%s is imsm", dev); + break; + } ++ if (strncmp (buf, "MD_METADATA=ddf", ++ sizeof ("MD_METADATA=ddf") - 1) == 0) ++ { ++ is_imsm_or_ddf = 1; ++ grub_util_info ("%s is ddf", dev); ++ break; ++ } + } + + free (buf); +@@ -837,7 +844,7 @@ grub_util_is_imsm (const char *os_dev) + + if (dev != os_dev) + free ((void *) dev); +- return is_imsm; ++ return is_imsm_or_ddf; + } + + char * +@@ -1202,7 +1209,7 @@ grub_util_get_dev_abstraction_os (const char *os_dev) + + /* Check for RAID. */ + if (!strncmp (os_dev, "/dev/md", 7) && ! grub_util_device_is_mapped (os_dev) +- && !grub_util_is_imsm (os_dev)) ++ && !grub_util_is_imsm_or_ddf (os_dev)) + return GRUB_DEV_ABSTRACTION_RAID; + return GRUB_DEV_ABSTRACTION_NONE; + } diff --git a/grub.patches b/grub.patches index 3601fbc0..c3e7abee 100644 --- a/grub.patches +++ b/grub.patches @@ -377,3 +377,4 @@ Patch0377: 0377-disk-cryptodisk-Wipe-the-passphrase-from-memory.patch Patch0378: 0378-cryptocheck-Add-quiet-option.patch Patch0379: 0379-loader-efi-chainloader-Fix-double-free.patch Patch0380: 0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch +Patch0381: 0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch diff --git a/grub2.spec b/grub2.spec index f253bd9c..41ead8a7 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 34%{?dist} +Release: 35%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -605,6 +605,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Thu Jun 5 2025 Nicolas Frayer - 2.12-35 +- osdep/linux/getroot: Detect DDF container similar to IMSM + * Wed May 28 2025 Nicolas Frayer - 2.12-34 - Some fixes addressing memory freeing and dereferencing - Resolves: #2368939 From 828e1c5448e998fff63625b2bac192bfaa17f356 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Fri, 30 May 2025 08:26:25 +0200 Subject: [PATCH 276/294] spec/posttrans: move grub config stub creation out of spec Signed-off-by: Nicolas Frayer --- gen_grub_cfgstub | 28 ++++++++++++++++++++++++++++ grub.macros | 3 +++ grub2.spec | 16 ++++++---------- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 gen_grub_cfgstub diff --git a/gen_grub_cfgstub b/gen_grub_cfgstub new file mode 100644 index 00000000..c1d061d4 --- /dev/null +++ b/gen_grub_cfgstub @@ -0,0 +1,28 @@ +#!/bin/sh +set -eu + +if [ $# -ne 2 ] + then + echo "Missing argument" + echo "Usage: script.sh GRUB_HOME EFI_HOME" + exit 1 +fi + +GRUB_HOME=$1 +EFI_HOME=$2 + +# create a stub grub2 config in EFI +BOOT_UUID=$(grub2-probe --target=fs_uuid "${GRUB_HOME}") +GRUB_DIR=$(grub2-mkrelpath "${GRUB_HOME}") + +echo "Generating grub stub config for drive " "${BOOT_UUID}" +echo "GRUB_DIR=" "${GRUB_DIR}" +echo "EFI_HOME=" "${EFI_HOME}" + +cat << EOF > "${EFI_HOME}"/grub.cfg.stb +search --no-floppy --root-dev-only --fs-uuid --set=dev ${BOOT_UUID} +set prefix=(\$dev)${GRUB_DIR} +export \$prefix +configfile \$prefix/grub.cfg +EOF + diff --git a/grub.macros b/grub.macros index ee1687aa..a2cab587 100644 --- a/grub.macros +++ b/grub.macros @@ -727,6 +727,8 @@ install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ %ifarch %{arm} \ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ %endif \ +install -D -m 700 %{SOURCE13} \\\ + ${RPM_BUILD_ROOT}/usr/bin/gen_grub_cfgstub \ install -D -m 700 unicode.pf2 \\\ ${RPM_BUILD_ROOT}/boot/grub2/fonts/unicode.pf2 \ ${RPM_BUILD_ROOT}/%{_bindir}/grub2-editenv \\\ @@ -876,6 +878,7 @@ ln -s ../boot/grub2/grub.cfg \\\ %attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \ %endif \ %attr(0700,root,root)/boot/grub2/fonts \ +%attr(0700,root,root)/usr/bin/gen_grub_cfgstub \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0600,root,root)/boot/grub2/grub.cfg \ %ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ diff --git a/grub2.spec b/grub2.spec index 41ead8a7..21cf5096 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 35%{?dist} +Release: 36%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -35,6 +35,7 @@ Source9: strtoull_test.c Source10: 20-grub.install Source11: grub.patches Source12: sbat.csv.in +Source13: gen_grub_cfgstub %include %{SOURCE1} @@ -411,15 +412,7 @@ if test -f ${EFI_HOME}/grub.cfg; then fi # create a stub grub2 config in EFI -BOOT_UUID=$(grub2-probe --target=fs_uuid ${GRUB_HOME}) -GRUB_DIR=$(grub2-mkrelpath ${GRUB_HOME}) - -cat << EOF > ${EFI_HOME}/grub.cfg.stb -search --no-floppy --root-dev-only --fs-uuid --set=dev ${BOOT_UUID} -set prefix=(\$dev)${GRUB_DIR} -export \$prefix -configfile \$prefix/grub.cfg -EOF +gen_grub_cfgstub $GRUB_HOME $EFI_HOME || : if test -f ${EFI_HOME}/grubenv; then cp -a ${EFI_HOME}/grubenv ${EFI_HOME}/grubenv.rpmsave @@ -605,6 +598,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog +* Fri Jun 12 2025 Nicolas Frayer - 2.12-36 +- spec: moved grub stub cfg creation into a script + * Thu Jun 5 2025 Nicolas Frayer - 2.12-35 - osdep/linux/getroot: Detect DDF container similar to IMSM From 159b7b546ad6cc11dfea800213712e465257b997 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 20 Jun 2025 16:14:57 -0400 Subject: [PATCH 277/294] Remove package.cfg This did not consistently work as intended, and the ELN automation can now build this properly. Signed-off-by: Yaakov Selkowitz --- package.cfg | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 package.cfg diff --git a/package.cfg b/package.cfg deleted file mode 100644 index 0cf8855f..00000000 --- a/package.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[koji] -targets = rawhide eln - From 01b420564214242141779b584270b996eda5d964 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 8 Jul 2025 11:42:50 +0200 Subject: [PATCH 278/294] spec: fix grub stub cfg creation script Signed-off-by: Nicolas Frayer --- gen_grub_cfgstub | 1 + grub2.spec | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gen_grub_cfgstub b/gen_grub_cfgstub index c1d061d4..c73ee533 100644 --- a/gen_grub_cfgstub +++ b/gen_grub_cfgstub @@ -26,3 +26,4 @@ export \$prefix configfile \$prefix/grub.cfg EOF +mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg diff --git a/grub2.spec b/grub2.spec index 21cf5096..15e9d404 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 36%{?dist} +Release: 37%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -419,9 +419,6 @@ if test -f ${EFI_HOME}/grubenv; then mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv fi -# ensure we exit 0 -mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : - %files common -f grub.lang %dir %{_libdir}/grub/ %dir %{_datarootdir}/grub/ @@ -598,7 +595,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg || : %endif %changelog -* Fri Jun 12 2025 Nicolas Frayer - 2.12-36 +* Tue Jul 8 2025 Nicolas Frayer - 2.12-37 +- spec: fix grub stub cfg creation script + +* Thu Jun 12 2025 Nicolas Frayer - 2.12-36 - spec: moved grub stub cfg creation into a script * Thu Jun 5 2025 Nicolas Frayer - 2.12-35 From 42ca1a56a1744939603b11a1dbb0c722ee1bd88b Mon Sep 17 00:00:00 2001 From: Jan Stancek Date: Mon, 14 Jul 2025 06:28:03 -0400 Subject: [PATCH 279/294] more robust kernel updates Set boot entry only after sucessful ramdisk creation to prevent booting into broken environments in cases where ramdisk is corrupt or missing. Signed-off-by: Jan Stancek --- 20-grub.install | 2 +- 55-set-boot-entry.install | 44 +++++++++++++++++++++++++++++++++++++++ grub2.spec | 3 +++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 55-set-boot-entry.install diff --git a/20-grub.install b/20-grub.install index d5ab5875..52992c54 100755 --- a/20-grub.install +++ b/20-grub.install @@ -174,7 +174,7 @@ case "$COMMAND" in fi fi if [ -n "$NEWDEFAULT" ]; then - grub2-editenv - set "saved_entry=${NEWDEFAULT}" + grub2-editenv - set "tmp_saved_entry=${NEWDEFAULT}" fi # this probably isn't the best place to do this, but it will do for now. diff --git a/55-set-boot-entry.install b/55-set-boot-entry.install new file mode 100755 index 00000000..196edd8c --- /dev/null +++ b/55-set-boot-entry.install @@ -0,0 +1,44 @@ +#!/bin/bash + +[[ -f /etc/default/grub ]] && . /etc/default/grub +[[ -f /etc/os-release ]] && . /etc/os-release + +COMMAND="$1" +KERNEL_VERSION="$2" +BOOT_DIR_ABS="$3" +KERNEL_IMAGE="$4" + +case "$COMMAND" in + add) + if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then + entry=$(grub2-editenv list | grep tmp_saved_entry) + if [ -n "$entry" ]; then + BLS_ID=${entry##tmp_saved_entry=} + BLS_DIR="/boot/loader/entries" + BLS_TARGET="${BLS_DIR}/${BLS_ID}.conf" + + LINUX="$(grep '^linux[ \t]' "${BLS_TARGET}" | sed -e 's,^linux[ \t]*,,')" + INITRD="$(grep '^initrd[ \t]' "${BLS_TARGET}" | sed -e 's,^initrd[ \t]*,,')" + ROOTPREFIX="$(dirname "/boot${LINUX}")" + + if [ ! -e "${ROOTPREFIX}${INITRD}" ]; then + echo "${INITRD} not found" + exit 1 + fi + if ! lsinitrd ${ROOTPREFIX}${INITRD} > /dev/null; then + echo "Error: ${INITRD} appears to be corrupt." + exit 1 + fi + if [ ! -e "${ROOTPREFIX}${LINUX}" ]; then + echo "Error: ${LINUX} not found." + exit 1 + fi + + grub2-editenv - unset "tmp_saved_entry" + grub2-editenv - set "saved_entry=$BLS_ID" + fi + fi + ;; + *) + ;; +esac diff --git a/grub2.spec b/grub2.spec index 15e9d404..fd13f4a1 100644 --- a/grub2.spec +++ b/grub2.spec @@ -36,6 +36,7 @@ Source10: 20-grub.install Source11: grub.patches Source12: sbat.csv.in Source13: gen_grub_cfgstub +Source14: 55-set-boot-entry.install %include %{SOURCE1} @@ -301,6 +302,7 @@ rm -vf ${RPM_BUILD_ROOT}/%{_sbindir}/grub2-macbless # Install kernel-install scripts install -d -m 0755 %{buildroot}%{_prefix}/lib/kernel/install.d/ install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE10} +install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE14} install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE3} install -d -m 0755 %{buildroot}%{_sysconfdir}/kernel/install.d/ # Install systemd user service to set the boot_success flag @@ -424,6 +426,7 @@ fi %dir %{_datarootdir}/grub/ %attr(0700,root,root) %dir %{_sysconfdir}/grub.d %{_prefix}/lib/kernel/install.d/20-grub.install +%{_prefix}/lib/kernel/install.d/55-set-boot-entry.install %{_prefix}/lib/kernel/install.d/99-grub-mkconfig.install %dir %{_datarootdir}/grub %exclude %{_datarootdir}/grub/* From 8f843cc6efed887f8dbfd25005553dc666c303c9 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Tue, 29 Jul 2025 09:53:33 -0600 Subject: [PATCH 280/294] Set correctly the memory attributes for the kernel PE sections Signed-off-by: Leo Sandoval --- ...e-memory-attributes-for-the-kernel-P.patch | 291 ++++++++++++++++++ grub.patches | 1 + grub2.spec | 5 +- 3 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch diff --git a/0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch b/0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch new file mode 100644 index 00000000..6fe22da7 --- /dev/null +++ b/0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch @@ -0,0 +1,291 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Tue, 29 Jul 2025 09:43:37 -0600 +Subject: [PATCH] Set correctly the memory attributes for the kernel PE + sections + +Currently the whole kernel memory region is set to RO, so at some +point when execution is passed to the kernel, the latter faults on a +memory write access, e.g. zeroing .bss section. The proposed change +sets the memory attribute appropriately for each kernel PE section. + +Signed-off-by: Leo Sandoval +--- + grub-core/loader/efi/linux.c | 170 +++++++++++++++++++++++++++----------- + grub-core/loader/i386/efi/linux.c | 5 +- + include/grub/efi/linux.h | 6 ++ + 3 files changed, 134 insertions(+), 47 deletions(-) + +diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c +index ef55556f2d..111edf0e1d 100644 +--- a/grub-core/loader/efi/linux.c ++++ b/grub-core/loader/efi/linux.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + #include + + GRUB_MOD_LICENSE ("GPLv3+"); +@@ -202,22 +203,133 @@ grub_efi_check_nx_required (int *nx_required) + typedef void (*handover_func) (void *, grub_efi_system_table_t *, void *); + + grub_err_t +-grub_efi_linux_boot (grub_addr_t k_address, grub_size_t k_size, ++grub_efi_mem_set_att(grub_addr_t k_address, grub_size_t k_size, ++ grub_size_t k_start, int nx_supported) ++{ ++ grub_addr_t k_start_address = k_address + k_start; ++ ++ grub_uint64_t default_set_attrs = GRUB_MEM_ATTR_R | GRUB_MEM_ATTR_W | GRUB_MEM_ATTR_X; ++ grub_uint64_t default_clear_attrs = 0; ++ grub_uint64_t stack_set_attrs = default_set_attrs; ++ grub_uint64_t stack_clear_attrs = default_clear_attrs; ++ grub_uint64_t kernel_set_attrs = default_set_attrs; ++ grub_uint64_t kernel_clear_attrs = default_clear_attrs; ++ grub_uint64_t attrs; ++ ++ struct grub_msdos_image_header *header; ++ struct grub_pe_image_header *pe_image_header; ++ struct grub_pe32_coff_header *coff_header; ++ struct grub_pe32_section_table *section, *sections; ++ grub_uint16_t i; ++ grub_size_t sz; ++ ++ header = (struct grub_msdos_image_header *)k_address; ++ ++ if (grub_add ((grub_addr_t) header, header->pe_image_header_offset, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("Error on PE image header address calculation")); ++ ++ pe_image_header = (struct grub_pe_image_header *) (sz); ++ ++ if (pe_image_header > (k_address + k_size)) ++ return grub_error (GRUB_ERR_BAD_OS, N_("PE image header address is invalid")); ++ ++ if (grub_memcmp (pe_image_header->signature, GRUB_PE32_SIGNATURE, ++ GRUB_PE32_SIGNATURE_SIZE) != 0) ++ return grub_error (GRUB_ERR_BAD_OS, N_("kernel PE magic is invalid")); ++ ++ coff_header = &(pe_image_header->coff_header); ++ grub_dprintf ("nx", "coff_header 0x%"PRIxGRUB_ADDR" machine %08x\n", (grub_addr_t)coff_header, coff_header->machine); ++ ++ if (grub_add ((grub_addr_t) coff_header, sizeof (*coff_header), &sz) || ++ grub_add (sz, coff_header->optional_header_size, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("Error on PE sections calculation")); ++ ++ sections = (struct grub_pe32_section_table *) (sz); ++ ++ if (sections > (k_address + k_size)) ++ return grub_error (GRUB_ERR_BAD_OS, N_("Section address is invalid")); ++ ++ /* Parse the PE, remove W for code section, remove X for data sections, RO for the rest */ ++ for (i = 0, section = sections; i < coff_header->num_sections; i++, section++) ++ { ++ kernel_set_attrs = default_set_attrs; ++ kernel_clear_attrs = default_clear_attrs; ++ ++ if (nx_supported) ++ { ++ if (section->characteristics & GRUB_PE32_SCN_MEM_EXECUTE) ++ { ++ /* RX section */ ++ kernel_set_attrs &= ~GRUB_MEM_ATTR_W; ++ kernel_clear_attrs |= GRUB_MEM_ATTR_W; ++ } ++ else if (section->characteristics & GRUB_PE32_SCN_MEM_WRITE) ++ { ++ /* RW section */ ++ kernel_set_attrs &= ~GRUB_MEM_ATTR_X; ++ kernel_clear_attrs |= GRUB_MEM_ATTR_X; ++ } ++ else ++ { ++ /* RO section */ ++ kernel_set_attrs &= ~GRUB_MEM_ATTR_W & ~GRUB_MEM_ATTR_X; ++ kernel_clear_attrs |= GRUB_MEM_ATTR_X | GRUB_MEM_ATTR_W ; ++ } ++ } ++ ++ /* Make sure we are inside range */ ++ if (grub_add ((grub_addr_t) k_address, section->raw_data_offset, &sz)) ++ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("Error on PE Executable section calculation")); ++ ++ grub_update_mem_attrs (sz, section->raw_data_size, kernel_set_attrs, kernel_clear_attrs); ++ ++ grub_get_mem_attrs (sz, 4096, &attrs); ++ grub_dprintf ("nx", "permissions for section %s 0x%"PRIxGRUB_ADDR" are %s%s%s\n", ++ section->name, ++ (grub_addr_t)sz, ++ (attrs & GRUB_MEM_ATTR_R) ? "r" : "-", ++ (attrs & GRUB_MEM_ATTR_W) ? "w" : "-", ++ (attrs & GRUB_MEM_ATTR_X) ? "x" : "-"); ++ } ++ ++ if (grub_stack_addr != (grub_addr_t)-1ll) ++ { ++ if (nx_supported) ++ { ++ stack_set_attrs &= ~GRUB_MEM_ATTR_X; ++ stack_clear_attrs |= GRUB_MEM_ATTR_X; ++ } ++ ++ grub_dprintf ("nx", "Setting attributes for stack at 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" to rw%c\n", ++ grub_stack_addr, grub_stack_addr + grub_stack_size - 1, ++ (stack_set_attrs & GRUB_MEM_ATTR_X) ? 'x' : '-'); ++ ++ grub_update_mem_attrs (grub_stack_addr, grub_stack_size, ++ stack_set_attrs, stack_clear_attrs); ++ ++ grub_get_mem_attrs (grub_stack_addr, 4096, &attrs); ++ grub_dprintf ("nx", "permissions for 0x%"PRIxGRUB_ADDR" are %s%s%s\n", ++ grub_stack_addr, ++ (attrs & GRUB_MEM_ATTR_R) ? "r" : "-", ++ (attrs & GRUB_MEM_ATTR_W) ? "w" : "-", ++ (attrs & GRUB_MEM_ATTR_X) ? "x" : "-"); ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++ ++grub_err_t ++grub_efi_linux_boot (grub_addr_t k_address, grub_size_t k_size, grub_size_t k_start, + grub_off_t h_offset, void *k_params, + int nx_supported) + { ++ grub_addr_t k_start_address = k_address + k_start; + grub_efi_loaded_image_t *loaded_image = NULL; + handover_func hf; + int offset = 0; +- grub_uint64_t stack_set_attrs = GRUB_MEM_ATTR_R | +- GRUB_MEM_ATTR_W | +- GRUB_MEM_ATTR_X; +- grub_uint64_t stack_clear_attrs = 0; +- grub_uint64_t kernel_set_attrs = stack_set_attrs; +- grub_uint64_t kernel_clear_attrs = stack_clear_attrs; +- grub_uint64_t attrs; + int nx_required = 0; +- ++ + #ifdef __x86_64__ + offset = 512; + #endif +@@ -241,47 +353,13 @@ grub_efi_linux_boot (grub_addr_t k_address, grub_size_t k_size, + if (nx_required && !nx_supported) + return grub_error (GRUB_ERR_BAD_OS, N_("kernel does not support NX loading required by policy")); + +- if (nx_supported) +- { +- kernel_set_attrs &= ~GRUB_MEM_ATTR_W; +- kernel_clear_attrs |= GRUB_MEM_ATTR_W; +- stack_set_attrs &= ~GRUB_MEM_ATTR_X; +- stack_clear_attrs |= GRUB_MEM_ATTR_X; +- } +- +- grub_dprintf ("nx", "Setting attributes for 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" to r%cx\n", +- k_address, k_address + k_size - 1, +- (kernel_set_attrs & GRUB_MEM_ATTR_W) ? 'w' : '-'); +- grub_update_mem_attrs (k_address, k_size, +- kernel_set_attrs, kernel_clear_attrs); +- +- grub_get_mem_attrs (k_address, 4096, &attrs); +- grub_dprintf ("nx", "permissions for 0x%"PRIxGRUB_ADDR" are %s%s%s\n", +- (grub_addr_t)k_address, +- (attrs & GRUB_MEM_ATTR_R) ? "r" : "-", +- (attrs & GRUB_MEM_ATTR_W) ? "w" : "-", +- (attrs & GRUB_MEM_ATTR_X) ? "x" : "-"); +- if (grub_stack_addr != (grub_addr_t)-1ll) +- { +- grub_dprintf ("nx", "Setting attributes for stack at 0x%"PRIxGRUB_ADDR"-0x%"PRIxGRUB_ADDR" to rw%c\n", +- grub_stack_addr, grub_stack_addr + grub_stack_size - 1, +- (stack_set_attrs & GRUB_MEM_ATTR_X) ? 'x' : '-'); +- grub_update_mem_attrs (grub_stack_addr, grub_stack_size, +- stack_set_attrs, stack_clear_attrs); +- +- grub_get_mem_attrs (grub_stack_addr, 4096, &attrs); +- grub_dprintf ("nx", "permissions for 0x%"PRIxGRUB_ADDR" are %s%s%s\n", +- grub_stack_addr, +- (attrs & GRUB_MEM_ATTR_R) ? "r" : "-", +- (attrs & GRUB_MEM_ATTR_W) ? "w" : "-", +- (attrs & GRUB_MEM_ATTR_X) ? "x" : "-"); +- } ++ grub_efi_mem_set_att (k_address, k_size, k_start, nx_supported); + + #if defined(__i386__) || defined(__x86_64__) + asm volatile ("cli"); + #endif + +- hf = (handover_func)((char *)k_address + h_offset + offset); ++ hf = (handover_func)((char *)k_start_address + h_offset + offset); + hf (grub_efi_image_handle, grub_efi_system_table, k_params); + + return GRUB_ERR_BUG; +@@ -451,7 +529,7 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args, + + grub_dprintf ("linux", "linux command line: '%s'\n", args); + +- retval = grub_efi_linux_boot (addr, size, handover_offset, ++ retval = grub_efi_linux_boot (addr, size, 0, handover_offset, + (void *)addr, nx_supported); + + /* Never reached... */ +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index abbf6b24f5..6c310d9879 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -41,6 +41,7 @@ static grub_command_t cmd_linuxefi, cmd_initrdefi; + struct grub_linuxefi_context { + void *kernel_mem; + grub_uint64_t kernel_size; ++ grub_uint64_t kernel_start; + grub_uint32_t handover_offset; + struct linux_kernel_params *params; + char *cmdline; +@@ -169,6 +170,7 @@ grub_linuxefi_boot (void *data) + + return grub_efi_linux_boot ((grub_addr_t)context->kernel_mem, + context->kernel_size, ++ context->kernel_start, + context->handover_offset, + context->params, + context->nx_supported); +@@ -527,7 +529,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + LOW_U32(kernel_mem)); + lh->code32_start = LOW_U32(kernel_mem); + +- grub_memcpy (kernel_mem, (char *)kernel + start, filelen - start); ++ grub_memcpy (kernel_mem, (char *)kernel, filelen); + + lh->type_of_loader = 0x6; + grub_dprintf ("linux", "setting lh->type_of_loader = 0x%02x\n", +@@ -544,6 +546,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + goto fail; + context->kernel_mem = kernel_mem; + context->kernel_size = kernel_size; ++ context->kernel_start = start; + context->handover_offset = handover_offset; + context->params = params; + context->cmdline = cmdline; +diff --git a/include/grub/efi/linux.h b/include/grub/efi/linux.h +index 5b4e626c37..cd17be506a 100644 +--- a/include/grub/efi/linux.h ++++ b/include/grub/efi/linux.h +@@ -27,6 +27,7 @@ + grub_err_t + EXPORT_FUNC(grub_efi_linux_boot) (grub_addr_t kernel_address, + grub_size_t kernel_size, ++ grub_size_t kernel_start, + grub_off_t handover_offset, + void *kernel_param, int nx_enabled); + +@@ -38,4 +39,9 @@ EXPORT_FUNC(grub_efi_check_nx_image_support) (grub_addr_t kernel_addr, + grub_err_t + EXPORT_FUNC(grub_efi_check_nx_required) (int *nx_required); + ++grub_err_t ++EXPORT_FUNC(grub_efi_mem_set_att) (grub_addr_t k_address, ++ grub_size_t k_size, ++ grub_size_t k_start, int nx_supported); ++ + #endif /* ! GRUB_EFI_LINUX_HEADER */ diff --git a/grub.patches b/grub.patches index c3e7abee..f236c38a 100644 --- a/grub.patches +++ b/grub.patches @@ -378,3 +378,4 @@ Patch0378: 0378-cryptocheck-Add-quiet-option.patch Patch0379: 0379-loader-efi-chainloader-Fix-double-free.patch Patch0380: 0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch Patch0381: 0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch +Patch0382: 0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch \ No newline at end of file diff --git a/grub2.spec b/grub2.spec index fd13f4a1..2bb1ad43 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 37%{?dist} +Release: 38%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -598,6 +598,9 @@ fi %endif %changelog +* Tue Jul 29 2025 Leo Sandoval 2.12-38 +- Set correctly the memory attributes for the kernel PE sections + * Tue Jul 8 2025 Nicolas Frayer - 2.12-37 - spec: fix grub stub cfg creation script From 06e458e5ebdfb50d01e7b9cd766d05587d73de90 Mon Sep 17 00:00:00 2001 From: Yuxin Sun Date: Thu, 17 Jul 2025 10:47:47 +0800 Subject: [PATCH 281/294] 20-grub.install: Skip BLS removal when entry type is type2 UKI(package is kernel-uki-virt) is a single, bootable file that bundles everything needed to start a Linux system. It contains its own bootable stub and bypasses GRUB2 completely. The kernel-core and kernel-uki-virt can coexist in one machine. And both of them call kernel-install remove upon package removal and this leads to the complete removal of both the traditional kernel & its artifacts(initramfs, BLS entry file,...). For example, if the customer remove kernel-uki-virt, currently it also removes BLS entry which causes the regular kernel fails to boot up. In https://github.com/systemd/systemd/pull/37897 it added --entry-type=type1|type2 option to kernel-install. type1 stands for normal kernel, type2 stands for uki. When kernel-install is invoked with --entry-type=type2 which is for UKI, we should not remove the BLS entry. Signed-off-by: Yuxin Sun --- 20-grub.install | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/20-grub.install b/20-grub.install index 52992c54..e402a4ce 100755 --- a/20-grub.install +++ b/20-grub.install @@ -193,7 +193,11 @@ case "$COMMAND" in exit 77 ;; remove) - + # If the boot entry type is type2, we are not removing the BLS entry + if [[ "x${KERNEL_INSTALL_BOOT_ENTRY_TYPE}" = "xtype2" ]]; then + [ "${KERNEL_INSTALL_VERBOSE}" -gt 0 ] && echo "The boot entry type is type2. Skip removing BLS entry." + exit 0 + fi if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" From 8f6e9e55c19c21032133cdb4def20e03d31fb463 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Tue, 15 Jul 2025 19:56:55 -0400 Subject: [PATCH 282/294] Suppress warnings about missing /etc/default/grub Signed-off-by: FeRD (Frank Dana) --- 99-grub-mkconfig.install | 4 ++-- grub2.spec | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index a14f5fd8..1a5fed8c 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -5,7 +5,7 @@ if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then fi # Run grub2-mkconfig if ENABLE_BLSCFG is false -if grep -q '^GRUB_ENABLE_BLSCFG="*false"*\s*$' /etc/default/grub; then +if grep -sq '^GRUB_ENABLE_BLSCFG="*false"*\s*$' /etc/default/grub; then RUN_MKCONFIG=true DISABLE_BLS=true fi @@ -28,7 +28,7 @@ if [[ $ARCH = "ppc64le" ]] && [ -d /sys/firmware/opal ]; then fi if [[ $DISABLE_BLS = "true" ]]; then - if grep -q '^GRUB_ENABLE_BLSCFG="*true"*\s*$' /etc/default/grub; then + if grep -sq '^GRUB_ENABLE_BLSCFG="*true"*\s*$' /etc/default/grub; then sed -i 's/^GRUB_ENABLE_BLSCFG=.*/GRUB_ENABLE_BLSCFG=false/' /etc/default/grub fi fi diff --git a/grub2.spec b/grub2.spec index 2bb1ad43..839607d6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 38%{?dist} +Release: 39%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -598,6 +598,10 @@ fi %endif %changelog +* Tue Jul 15 2025 FeRD (Frank Dana) - 2.12-39 +- kernel-install: Suppress warnings about missing /etc/default/grub + file when attempting to grep its contents + * Tue Jul 29 2025 Leo Sandoval 2.12-38 - Set correctly the memory attributes for the kernel PE sections From 354c77b195316a4aa09979793a73ea4485217769 Mon Sep 17 00:00:00 2001 From: Jan Stancek Date: Wed, 6 Aug 2025 10:11:49 +0200 Subject: [PATCH 283/294] 55-set-boot-entry.install: fix initrd check Fix where to look for initrd file, as /boot may not be a separate partition, in which case adding /boot unconditionally leads to a duplicate "/boot/boot/...". Fix initrd line parsing to take only first word - it can contain extra parameters, e.g. "$tuned_initrd", which are not part of initrd filename. Resolves: #2386118 Reported-by: Mikhail Gavrilov Tested-by: Mikhail Gavrilov Signed-off-by: Jan Stancek --- 55-set-boot-entry.install | 28 ++++++++++++++-------------- grub2.spec | 6 +++++- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/55-set-boot-entry.install b/55-set-boot-entry.install index 196edd8c..be505e30 100755 --- a/55-set-boot-entry.install +++ b/55-set-boot-entry.install @@ -17,21 +17,21 @@ case "$COMMAND" in BLS_DIR="/boot/loader/entries" BLS_TARGET="${BLS_DIR}/${BLS_ID}.conf" - LINUX="$(grep '^linux[ \t]' "${BLS_TARGET}" | sed -e 's,^linux[ \t]*,,')" - INITRD="$(grep '^initrd[ \t]' "${BLS_TARGET}" | sed -e 's,^initrd[ \t]*,,')" - ROOTPREFIX="$(dirname "/boot${LINUX}")" + LINUX="$(grep '^linux[ \t]' "${BLS_TARGET}" | sed -e 's,^linux[ \t]*,,' | awk '{print $1}')" + INITRD="$(grep '^initrd[ \t]' "${BLS_TARGET}" | sed -e 's,^initrd[ \t]*,,' | awk '{print $1}')" - if [ ! -e "${ROOTPREFIX}${INITRD}" ]; then - echo "${INITRD} not found" - exit 1 - fi - if ! lsinitrd ${ROOTPREFIX}${INITRD} > /dev/null; then - echo "Error: ${INITRD} appears to be corrupt." - exit 1 - fi - if [ ! -e "${ROOTPREFIX}${LINUX}" ]; then - echo "Error: ${LINUX} not found." - exit 1 + ROOTPREFIX="" + [ -z "$(grub2-mkrelpath /boot)" ] && ROOTPREFIX="/boot" + + if [ -e "${ROOTPREFIX}${LINUX}" -a -n "${INITRD}" ]; then + if [ ! -e "${ROOTPREFIX}${INITRD}" ]; then + echo "Error: ${INITRD} not found" + exit 1 + fi + if ! lsinitrd ${ROOTPREFIX}${INITRD} > /dev/null; then + echo "Error: ${INITRD} appears to be corrupt." + exit 1 + fi fi grub2-editenv - unset "tmp_saved_entry" diff --git a/grub2.spec b/grub2.spec index 839607d6..edd26b40 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 39%{?dist} +Release: 40%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -598,6 +598,10 @@ fi %endif %changelog +* Wed Aug 6 2025 Jan Stancek - 2.12-40 +- 55-set-boot-entry.install: fix initrd check +- Resolves: #2386118 + * Tue Jul 15 2025 FeRD (Frank Dana) - 2.12-39 - kernel-install: Suppress warnings about missing /etc/default/grub file when attempting to grep its contents From e02b6e88c71642ecc063ae7aefbd09b9be80d50e Mon Sep 17 00:00:00 2001 From: Marta Lewandowska Date: Mon, 19 May 2025 13:21:50 -0600 Subject: [PATCH 284/294] Phase 1 of the bootloader updates proposal implementation https://fedoraproject.org/wiki/Changes/BootLoaderUpdatesPhase1 Signed-off-by: Marta Lewandoska Signed-off-by: Nicolas Frayer Signed-off-by: Leo Sandoval --- gen_grub_cfgstub | 1 + grub.macros | 26 +++++++++++++++++--------- grub2.spec | 25 ++++++++++++++++++++----- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/gen_grub_cfgstub b/gen_grub_cfgstub index c73ee533..a6a97123 100644 --- a/gen_grub_cfgstub +++ b/gen_grub_cfgstub @@ -27,3 +27,4 @@ configfile \$prefix/grub.cfg EOF mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg +chmod 0600 ${EFI_HOME}/grub.cfg diff --git a/grub.macros b/grub.macros index a2cab587..dfc9707d 100644 --- a/grub.macros +++ b/grub.macros @@ -1,6 +1,12 @@ # vim:filetype=spec # Modules always contain just 32-bit code +%global evr %{epoch}:%{version}-%{release} %global _libdir %{_exec_prefix}/lib + +%global os_id %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')) +%global grub_evr_dir %{_libdir}/efi/grub2/%{evr} +%global grub_efi_dir %{grub_evr_dir}/EFI/%{os_id} + %global _binaries_in_noarch_packages_terminate_build 0 #%%undefine _missing_build_ids_terminate_build %{expand:%%{!?buildsubdir:%%global buildsubdir grub-%{tarversion}}} @@ -280,8 +286,6 @@ %global grubelfname core.elf %endif -%global evr %{epoch}:%{version}-%{release} - %ifarch x86_64 %global with_efi_common 1 %global with_legacy_modules 1 @@ -704,8 +708,8 @@ find . '(' -iname gdb_grub \\\ ')' \\\ -exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \ find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \ -install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ -install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ +install -m 700 %{2} $RPM_BUILD_ROOT%{grub_efi_dir}/%{2} \ +install -m 700 %{3} $RPM_BUILD_ROOT%{grub_efi_dir}/%{3} \ %{expand:%%do_install_protected_file grub2-%{alt_package_arch}} \ cd .. \ %{nil} @@ -722,8 +726,8 @@ fi \ find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \ ln -s ../boot/grub2/grub.cfg \\\ $RPM_BUILD_ROOT%{_sysconfdir}/grub2-efi.cfg \ -install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \ -install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \ +install -m 700 %{2} $RPM_BUILD_ROOT%{grub_efi_dir}/%{2} \ +install -m 700 %{3} $RPM_BUILD_ROOT%{grub_efi_dir}/%{3} \ %ifarch %{arm} \ install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \ %endif \ @@ -826,6 +830,7 @@ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/grub2.info \ cp docs/grub-dev.info \\\ $RPM_BUILD_ROOT%{_infodir}/grub2-dev.info \ install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \ +install -d -m 0700 ${RPM_BUILD_ROOT}%{grub_efi_dir}/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/themes/system \ @@ -873,7 +878,8 @@ ln -s ../boot/grub2/grub.cfg \\\ %defattr(-,root,root,-) \ %config(noreplace) %{_sysconfdir}/grub2.cfg \ %config(noreplace) %{_sysconfdir}/grub2-efi.cfg \ -%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{2} \ +%ghost %attr(0700,root,root) %{efi_esp_dir}/%{2} \ +%attr(0700,root,root) %{grub_efi_dir}/%{2} \ %ifarch %{arm} \ %attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \ %endif \ @@ -881,7 +887,8 @@ ln -s ../boot/grub2/grub.cfg \\\ %attr(0700,root,root)/usr/bin/gen_grub_cfgstub \ %dir %attr(0700,root,root)/boot/loader/entries \ %ghost %config(noreplace) %attr(0600,root,root)/boot/grub2/grub.cfg \ -%ghost %config(noreplace) %verify(not mtime) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ +%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \ +%ghost %config(noreplace) %attr(0600,root,root)%{grub_efi_dir}/grub.cfg \ %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \ %attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/grub2-%{1}.conf \ %{expand:%if 0%{?without_efi_modules} \ @@ -899,7 +906,8 @@ ln -s ../boot/grub2/grub.cfg \\\ \ %{expand:%%files %{1}-cdboot} \ %defattr(-,root,root,-) \ -%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \ +%ghost %attr(0700,root,root) %{efi_esp_dir}/%{3} \ +%attr(0700,root,root) %{grub_efi_dir}/%{3} \ %attr(0700,root,root)/boot/grub2/fonts \ %{nil} diff --git a/grub2.spec b/grub2.spec index edd26b40..3d9b3d2a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 40%{?dist} +Release: 41%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -387,7 +387,7 @@ fi %posttrans common set -eu -EFI_HOME=%{efi_esp_dir} +EFI_HOME=%{grub_efi_dir} GRUB_HOME=/boot/grub2 ESP_PATH=/boot/efi @@ -421,6 +421,17 @@ if test -f ${EFI_HOME}/grubenv; then mv --force ${EFI_HOME}/grubenv ${GRUB_HOME}/grubenv fi +%if 0%{with_efi_arch} +%posttrans efi-%{efiarch} +set -eu + +# On image mode, bootupd takes care of installing bootloader updates to the ESP +if [[ ! -e "/run/ostree-booted" ]]; then + cp -a %{grub_efi_dir}/. %{efi_esp_dir} || : +fi + +%endif + %files common -f grub.lang %dir %{_libdir}/grub/ %dir %{_datarootdir}/grub/ @@ -435,8 +446,8 @@ fi %dir /boot/grub2/themes/system %attr(0700,root,root) %dir /boot/grub2 %exclude /boot/grub2/* -%dir %attr(0700,root,root) %{efi_esp_dir} -%exclude %{efi_esp_dir}/* +%dir %attr(0700,root,root) %{grub_efi_dir} +%exclude %{grub_efi_dir}/* %ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv %license COPYING %doc THANKS @@ -598,11 +609,15 @@ fi %endif %changelog +* Mon Aug 11 2025 Marta Lewandowska - 2.12-41 +- Phase 1 of the bootloader updates proposal implementation +- https://fedoraproject.org/wiki/Changes/BootLoaderUpdatesPhase1 + * Wed Aug 6 2025 Jan Stancek - 2.12-40 - 55-set-boot-entry.install: fix initrd check - Resolves: #2386118 -* Tue Jul 15 2025 FeRD (Frank Dana) - 2.12-39 +* Fri Aug 1 2025 FeRD (Frank Dana) - 2.12-39 - kernel-install: Suppress warnings about missing /etc/default/grub file when attempting to grep its contents From f6bc25c3e72a962cb59f568ec5fcc4dd374a9be2 Mon Sep 17 00:00:00 2001 From: Jan Stancek Date: Mon, 18 Aug 2025 15:56:46 +0200 Subject: [PATCH 285/294] 55-set-boot-entry.install: move to 95 When KERNEL_INSTALL_STAGING_AREA is used (for example with initrd_generator=mkosi-initrd), initrd gets installed to /boot only later at 90-loaderentry.install. Move the plugin to 95 so it runs after. Related: #2389020 Signed-off-by: Jan Stancek --- 55-set-boot-entry.install => 95-set-boot-entry.install | 4 ++-- grub2.spec | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) rename 55-set-boot-entry.install => 95-set-boot-entry.install (89%) diff --git a/55-set-boot-entry.install b/95-set-boot-entry.install similarity index 89% rename from 55-set-boot-entry.install rename to 95-set-boot-entry.install index be505e30..9f92f9f4 100755 --- a/55-set-boot-entry.install +++ b/95-set-boot-entry.install @@ -25,11 +25,11 @@ case "$COMMAND" in if [ -e "${ROOTPREFIX}${LINUX}" -a -n "${INITRD}" ]; then if [ ! -e "${ROOTPREFIX}${INITRD}" ]; then - echo "Error: ${INITRD} not found" + echo "Error: ${ROOTPREFIX}${INITRD} not found." exit 1 fi if ! lsinitrd ${ROOTPREFIX}${INITRD} > /dev/null; then - echo "Error: ${INITRD} appears to be corrupt." + echo "Error: ${ROOTPREFIX}${INITRD} appears to be corrupt." exit 1 fi fi diff --git a/grub2.spec b/grub2.spec index 3d9b3d2a..a1a7400c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 41%{?dist} +Release: 42%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -36,7 +36,7 @@ Source10: 20-grub.install Source11: grub.patches Source12: sbat.csv.in Source13: gen_grub_cfgstub -Source14: 55-set-boot-entry.install +Source14: 95-set-boot-entry.install %include %{SOURCE1} @@ -437,7 +437,7 @@ fi %dir %{_datarootdir}/grub/ %attr(0700,root,root) %dir %{_sysconfdir}/grub.d %{_prefix}/lib/kernel/install.d/20-grub.install -%{_prefix}/lib/kernel/install.d/55-set-boot-entry.install +%{_prefix}/lib/kernel/install.d/95-set-boot-entry.install %{_prefix}/lib/kernel/install.d/99-grub-mkconfig.install %dir %{_datarootdir}/grub %exclude %{_datarootdir}/grub/* @@ -609,6 +609,10 @@ fi %endif %changelog +* Wed Aug 20 2025 Jan Stancek - 2.12-42 +- move 55-set-boot-entry.install to 95 +- Related: #2389020 + * Mon Aug 11 2025 Marta Lewandowska - 2.12-41 - Phase 1 of the bootloader updates proposal implementation - https://fedoraproject.org/wiki/Changes/BootLoaderUpdatesPhase1 From 730ce277473cc673793f79437426c1403ea47621 Mon Sep 17 00:00:00 2001 From: Nicolas Frayer Date: Tue, 19 Aug 2025 12:05:25 +0200 Subject: [PATCH 286/294] gen_grub_cfgstub: Removed output messages Signed-off-by: Nicolas Frayer --- gen_grub_cfgstub | 4 ---- grub2.spec | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gen_grub_cfgstub b/gen_grub_cfgstub index a6a97123..8f77c0f5 100644 --- a/gen_grub_cfgstub +++ b/gen_grub_cfgstub @@ -15,10 +15,6 @@ EFI_HOME=$2 BOOT_UUID=$(grub2-probe --target=fs_uuid "${GRUB_HOME}") GRUB_DIR=$(grub2-mkrelpath "${GRUB_HOME}") -echo "Generating grub stub config for drive " "${BOOT_UUID}" -echo "GRUB_DIR=" "${GRUB_DIR}" -echo "EFI_HOME=" "${EFI_HOME}" - cat << EOF > "${EFI_HOME}"/grub.cfg.stb search --no-floppy --root-dev-only --fs-uuid --set=dev ${BOOT_UUID} set prefix=(\$dev)${GRUB_DIR} diff --git a/grub2.spec b/grub2.spec index a1a7400c..0e804eac 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 42%{?dist} +Release: 43%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -609,6 +609,9 @@ fi %endif %changelog +* Tue Aug 19 2025 Nicolas Frayer - 2.12-43 +- gen_grub_cfgstub: Removed output messages + * Wed Aug 20 2025 Jan Stancek - 2.12-42 - move 55-set-boot-entry.install to 95 - Related: #2389020 From b9b1d1e384bc49e29f4398d0e3ac176c584684a0 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Mon, 15 Sep 2025 14:06:19 -0600 Subject: [PATCH 287/294] Include function name on debug and error print functions With the following change, we see standard (grub_dprintf) and error (grub_error) logs with the function name embedded (see below) into the log which is particular useful when debugging commands/efi/tpm.c:grub_tpm_measure:281:tpm: log_event, pcr = 8, size = 0xb, Including one more field on the print log impacts the binary sizes and in turn their respective packages, the latter with an increase of 20k approximately (compared to 2.12-43) for most the the packages. Signed-off-by: Leo Sandoval --- ...unction-name-on-debug-print-function.patch | 102 ++++++++++++++++++ grub.patches | 3 +- grub2.spec | 7 +- 3 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 0383-Include-function-name-on-debug-print-function.patch diff --git a/0383-Include-function-name-on-debug-print-function.patch b/0383-Include-function-name-on-debug-print-function.patch new file mode 100644 index 00000000..e38ad7f3 --- /dev/null +++ b/0383-Include-function-name-on-debug-print-function.patch @@ -0,0 +1,102 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Fri, 11 Apr 2025 15:31:53 -0600 +Subject: [PATCH] Include function name on debug and error print functions + +Together with the line number, the debug log gives more context when +debugging. + +Signed-off-by: Leo Sandoval +--- + grub-core/kern/err.c | 4 ++-- + grub-core/kern/misc.c | 4 ++-- + include/grub/err.h | 6 +++--- + include/grub/misc.h | 5 +++-- + 4 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c +index aebfe0cf83..ba04b57fb7 100644 +--- a/grub-core/kern/err.c ++++ b/grub-core/kern/err.c +@@ -38,14 +38,14 @@ static int grub_error_stack_assert; + #endif + + grub_err_t +-grub_error (grub_err_t n, const char *file, const int line, const char *fmt, ...) ++grub_error (grub_err_t n, const char *file, const char *function, const int line, const char *fmt, ...) + { + va_list ap; + int m; + + grub_errno = n; + +- m = grub_snprintf (grub_errmsg, sizeof (grub_errmsg), "%s:%d:", file, line); ++ m = grub_snprintf (grub_errmsg, sizeof (grub_errmsg), "%s:%s:%d:", file, function, line); + if (m < 0) + m = 0; + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 69bd655f3d..541c7bb80c 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -248,7 +248,7 @@ grub_debug_enabled (const char * condition) + } + + void +-grub_real_dprintf (const char *file, const int line, const char *condition, ++grub_real_dprintf (const char *file, const char *function, const int line, const char *condition, + const char *fmt, ...) + { + va_list args; +@@ -272,7 +272,7 @@ grub_real_dprintf (const char *file, const int line, const char *condition, + else + last_had_cr = 0; + #endif +- grub_printf ("%s:%d:%s: ", file, line, condition); ++ grub_printf ("%s:%s:%d:%s: ", file, function, line, condition); + va_start (args, fmt); + grub_vprintf (fmt, args); + va_end (args); +diff --git a/include/grub/err.h b/include/grub/err.h +index 7530f58b29..6379a6baf8 100644 +--- a/include/grub/err.h ++++ b/include/grub/err.h +@@ -88,10 +88,10 @@ struct grub_error_saved + extern grub_err_t EXPORT_VAR(grub_errno); + extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG]; + +-grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const int line, const char *fmt, ...) +- __attribute__ ((format (GNU_PRINTF, 4, 5))); ++grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const char *function, const int line, const char *fmt, ...) ++ __attribute__ ((format (GNU_PRINTF, 5, 6))); + +-#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __LINE__, fmt, ##__VA_ARGS__) ++#define grub_error(n, fmt, ...) grub_error (n, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) + + + void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn)); +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 0429339ef3..2b9096a0b3 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -43,7 +43,7 @@ + #define CONCAT(a, b) CONCAT_(a, b) + #endif + +-#define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, __VA_ARGS__) ++#define grub_dprintf(condition, ...) grub_real_dprintf(GRUB_FILE, __FUNCTION__, __LINE__, condition, __VA_ARGS__) + + void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n); + char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src); +@@ -420,9 +420,10 @@ int EXPORT_FUNC(grub_puts_) (const char *s); + int EXPORT_FUNC(grub_debug_is_enabled) (void); + int EXPORT_FUNC(grub_debug_enabled) (const char *condition); + void EXPORT_FUNC(grub_real_dprintf) (const char *file, ++ const char *function, + const int line, + const char *condition, +- const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5))); ++ const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 5, 6))); + int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); + int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); + void EXPORT_FUNC(grub_qdprintf) (const char *condition, diff --git a/grub.patches b/grub.patches index f236c38a..66e0b693 100644 --- a/grub.patches +++ b/grub.patches @@ -378,4 +378,5 @@ Patch0378: 0378-cryptocheck-Add-quiet-option.patch Patch0379: 0379-loader-efi-chainloader-Fix-double-free.patch Patch0380: 0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch Patch0381: 0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch -Patch0382: 0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch \ No newline at end of file +Patch0382: 0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch +Patch0383: 0383-Include-function-name-on-debug-print-function.patch \ No newline at end of file diff --git a/grub2.spec b/grub2.spec index 0e804eac..4563828d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 43%{?dist} +Release: 44%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -609,7 +609,10 @@ fi %endif %changelog -* Tue Aug 19 2025 Nicolas Frayer - 2.12-43 +* Mon Sep 15 2025 Leo Sandoval - 2.12-44 +- Include function name on debug print function + +* Fri Aug 29 2025 Nicolas Frayer - 2.12-43 - gen_grub_cfgstub: Removed output messages * Wed Aug 20 2025 Jan Stancek - 2.12-42 From 4614a09b9fba8c2ebd3f52f39d9a49ecb12c4c59 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Wed, 15 Oct 2025 15:11:39 -0600 Subject: [PATCH 288/294] Include upstream blsuki related patches Signed-off-by: Leo Sandoval --- 0001-kern-misc-Implement-grub_strtok.patch | 109 ++ ...g-command-to-parse-Boot-Loader-Speci.patch | 1354 +++++++++++++++++ ...ge-offset-type-for-grub_util_write_i.patch | 43 + ...blsuki-Check-for-mounted-boot-in-emu.patch | 342 +++++ ...ommand-to-load-Unified-Kernel-Image-.patch | 822 ++++++++++ ...p-Tweaks-in-preparation-for-libtasn1.patch | 168 ++ grub.macros | 2 +- grub.patches | 9 +- grub2.spec | 5 +- 9 files changed, 2851 insertions(+), 3 deletions(-) create mode 100644 0001-kern-misc-Implement-grub_strtok.patch create mode 100644 0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch create mode 100644 0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch create mode 100644 0004-blsuki-Check-for-mounted-boot-in-emu.patch create mode 100644 0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch create mode 100644 0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch diff --git a/0001-kern-misc-Implement-grub_strtok.patch b/0001-kern-misc-Implement-grub_strtok.patch new file mode 100644 index 00000000..e9e0e1ec --- /dev/null +++ b/0001-kern-misc-Implement-grub_strtok.patch @@ -0,0 +1,109 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Tue, 12 Aug 2025 03:45:32 +0000 +Subject: [PATCH] kern/misc: Implement grub_strtok() + +Add the functions grub_strtok() and grub_strtok_r() to help parse strings into +tokens separated by characters in the "delim" parameter. These functions are +present in gnulib but calling them directly from the gnulib code is quite +challenging since the call "#include " would include the header file +grub-core/lib/posix_wrap/string.h instead of grub-core/lib/gnulib/string.h, +where strtok() and strtok_r() are declared. Since this overlap is quite +problematic, the simpler solution was to implement the code in the GRUB based +on gnulib's implementation. For more information on these functions, visit the +Linux Programmer's Manual, man strtok. + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/kern/misc.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ + include/grub/misc.h | 3 +++ + 2 files changed, 65 insertions(+) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 69bd655f3d..c69fe7fb19 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -453,6 +453,68 @@ grub_strword (const char *haystack, const char *needle) + return 0; + } + ++char * ++grub_strtok_r (char *s, const char *delim, char **save_ptr) ++{ ++ char *token; ++ const char *c; ++ bool is_delim; ++ ++ if (s == NULL) ++ s = *save_ptr; ++ ++ /* Scan leading delimiters. */ ++ while (*s != '\0') ++ { ++ is_delim = false; ++ for (c = delim; *c != '\0'; c++) ++ { ++ if (*s == *c) ++ { ++ is_delim = true; ++ break; ++ } ++ } ++ if (is_delim == true) ++ s++; ++ else ++ break; ++ } ++ ++ if (*s == '\0') ++ { ++ *save_ptr = s; ++ return NULL; ++ } ++ ++ /* Find the end of the token. */ ++ token = s; ++ while (*s != '\0') ++ { ++ for (c = delim; *c != '\0'; c++) ++ { ++ if (*s == *c) ++ { ++ *s = '\0'; ++ *save_ptr = s + 1; ++ return token; ++ } ++ } ++ s++; ++ } ++ ++ *save_ptr = s; ++ return token; ++} ++ ++char * ++grub_strtok (char *s, const char *delim) ++{ ++ static char *last; ++ ++ return grub_strtok_r (s, delim, &last); ++} ++ + int + grub_isspace (int c) + { +diff --git a/include/grub/misc.h b/include/grub/misc.h +index 0429339ef3..626f0c3535 100644 +--- a/include/grub/misc.h ++++ b/include/grub/misc.h +@@ -134,6 +134,9 @@ char *EXPORT_FUNC(grub_strchr) (const char *s, int c); + char *EXPORT_FUNC(grub_strrchr) (const char *s, int c); + int EXPORT_FUNC(grub_strword) (const char *s, const char *w); + ++char *EXPORT_FUNC(grub_strtok_r) (char *s, const char *delim, char **save_ptr); ++char *EXPORT_FUNC(grub_strtok) (char *s, const char *delim); ++ + /* Copied from gnulib. + Written by Bruno Haible , 2005. */ + static inline char * diff --git a/0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch b/0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch new file mode 100644 index 00000000..e2bf790a --- /dev/null +++ b/0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch @@ -0,0 +1,1354 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 12 Aug 2025 03:45:33 +0000 +Subject: [PATCH] blsuki: Add blscfg command to parse Boot Loader Specification + snippets + +The BootLoaderSpec (BLS) defines a scheme where different bootloaders can +share a format for boot items and a configuration directory that accepts +these common configurations as drop-in files. + +The BLS Specification: https://uapi-group.org/specifications/specs/boot_loader_specification/ + +Signed-off-by: Peter Jones +Signed-off-by: Javier Martinez Canillas +Signed-off-by: Will Thompson +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + bootstrap.conf | 1 + + docs/grub.texi | 74 ++- + grub-core/Makefile.core.def | 12 + + grub-core/commands/blscfg.c | 2 +- + grub-core/commands/blsuki.c | 1028 ++++++++++++++++++++++++++++++++++++++++ + grub-core/commands/legacycfg.c | 4 +- + grub-core/commands/menuentry.c | 7 +- + grub-core/normal/main.c | 4 + + include/grub/menu.h | 14 + + include/grub/normal.h | 2 +- + 10 files changed, 1140 insertions(+), 8 deletions(-) + create mode 100644 grub-core/commands/blsuki.c + +diff --git a/bootstrap.conf b/bootstrap.conf +index 60de0597c5..799cdb1a35 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -24,6 +24,7 @@ gnulib_modules=" + argp + base64 + error ++ filevercmp + fnmatch + getdelim + getline +diff --git a/docs/grub.texi b/docs/grub.texi +index ae01e8c994..336f8e87ed 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -3275,6 +3275,7 @@ These variables have special meaning to GRUB. + + @menu + * biosnum:: ++* blsuki_save_default:: + * check_appended_signatures:: + * check_signatures:: + * chosen:: +@@ -3339,6 +3340,11 @@ this. + For an alternative approach which also changes BIOS drive mappings for the + chain-loaded system, @pxref{drivemap}. + ++@node blsuki_save_default ++@subsection blsuki_save_default ++ ++If this variable is set, menu entries generated from BLS config files ++(@pxref{blscfg}) will be set as the default boot entry when selected. + + @node check_appended_signatures + @subsection check_appended_signatures +@@ -3346,7 +3352,6 @@ chain-loaded system, @pxref{drivemap}. + This variable controls whether GRUB enforces appended signature validation on + certain loaded files. @xref{Using appended signatures}. + +- + @node check_signatures + @subsection check_signatures + +@@ -4355,6 +4360,7 @@ you forget a command, you can run the command @command{help} + * background_image:: Load background image for active terminal + * badram:: Filter out bad regions of RAM + * blocklist:: Print a block list ++* blscfg:: Load Boot Loader Specification menu entries + * boot:: Start up your operating system + * cat:: Show the contents of a file + * clear:: Clear the screen +@@ -4542,6 +4548,72 @@ Print a block list (@pxref{Block list syntax}) for @var{file}. + @end deffn + + ++@node blscfg ++@subsection blscfg ++ ++@deffn Command blscfg [@option{-p|--path} dir] [@option{-f|--enable-fallback}] [@option{-d|--show-default}] [@option{-n|--show-non-default}] [@option{-e|--entry} file] ++Load Boot Loader Specification (BLS) entries into the GRUB menu. Boot entries ++generated from @command{blscfg} won't interfere with entries from @file{grub.cfg} appearing in ++the GRUB menu. Also, entries generated from @command{blscfg} exists only in memory and ++don't update @file{grub.cfg}. ++ ++By default, the BLS entries are stored in the @file{/loader/entries} directory in the ++boot partition. If BLS entries are stored elsewhere, the @option{--path} option can be ++used to check a different directory instead of the default location. If no BLS ++entries are found while using the @option{--path} option, the @option{--enable-fallback} option ++can be used to check for entries in the default location. ++ ++The @option{--show-default} option allows the default boot entry to be added to the ++GRUB menu from the BLS entries. ++ ++The @option{--show-non-default} option allows non-default boot entries to be added to ++the GRUB menu from the BLS entries. ++ ++The @option{--entry} option allows specific boot entries to be added to the GRUB menu ++from the BLS entries. ++ ++The @option{--entry}, @option{--show-default}, and @option{--show-non-default} options ++are used to filter which BLS entries are added to the GRUB menu. If none are ++used, all entries in the default location or the location specified by @option{--path} ++will be added to the GRUB menu. ++ ++A BLS config file example: ++@example ++# /boot/loader/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf ++title Fedora 19 (Rawhide) ++sort-key fedora ++machine-id 6a9857a393724b7a981ebb5b8495b9ea ++version 3.8.0-2.fc19.x86_64 ++options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 quiet ++architecture x64 ++linux /6a9857a393724b7a981ebb5b8495b9ea/3.8.0-2.fc19.x86_64/linux ++initrd /6a9857a393724b7a981ebb5b8495b9ea/3.8.0-2.fc19.x86_64/initrd ++@end example ++ ++For more information on BLS entry keys as well as other information on BLS, ++see: @uref{https://uapi-group.org/specifications/specs/boot_loader_specification/, The Boot Loader Specification}. For the GRUB, there are a few additional ++BLS entry keys based on the @command{menuentry} command (@pxref{menuentry}). ++ ++The @code{grub_class} key may be used any number of times to group menu entries into ++classes. Menu themes may display different classes using different styles. ++ ++The @code{grub_users} key grants specific users access to specific menu ++entries. @xref{Security}. ++ ++The @code{grub_hotkey} key associates a hotkey with a menu entry. ++@var{key} may be a single letter, or one of the aliases @samp{backspace}, ++@samp{tab}, or @samp{delete}. ++ ++The @code{grub_args} key can be used for any other argument to be passed as positonal ++parameters when the list of commands generated from the BLS config file are ++executed. ++ ++Variable expansion using the @samp{$} character (@xref{Shell-like scripting}) may be ++used with BLS config files for the GRUB but might not be compatible with other ++bootloaders. ++@end deffn ++ ++ + @node boot + @subsection boot + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 95fd18d2dd..5e0e757344 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -884,6 +884,18 @@ module = { + enable = i386_xen_pvh; + }; + ++module = { ++ name = blsuki; ++ common = commands/blsuki.c; ++ common = lib/gnulib/filevercmp.c; ++ enable = powerpc_ieee1275; ++ enable = efi; ++ enable = i386_pc; ++ enable = emu; ++ cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; ++ cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; ++}; ++ + module = { + name = boot; + common = commands/boot.c; +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 5d931b0c9b..38913d6964 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -955,7 +955,7 @@ static void create_entry (struct bls_entry *entry) + clinux, options ? " " : "", options ? options : "", + initrd ? initrd : "", dt ? dt : ""); + +- grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry); ++ grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry, NULL); + grub_dprintf ("blscfg", "Added entry %d id:\"%s\"\n", index, id); + + finish: +diff --git a/grub-core/commands/blsuki.c b/grub-core/commands/blsuki.c +new file mode 100644 +index 0000000000..9440adb100 +--- /dev/null ++++ b/grub-core/commands/blsuki.c +@@ -0,0 +1,1028 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2025 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++#define GRUB_BLS_CONFIG_PATH "/loader/entries/" ++ ++#define BLS_EXT_LEN (sizeof (".conf") - 1) ++ ++/* ++ * It is highly unlikely to ever receive a large amount of keyval pairs. A ++ * limit of 10000 is more than enough. ++ */ ++#define BLSUKI_KEYVALS_MAX 10000 ++ ++static const struct grub_arg_option bls_opt[] = ++ { ++ {"path", 'p', 0, "Specify path to find BLS entries.", N_("DIR"), ARG_TYPE_PATHNAME}, ++ {"enable-fallback", 'f', 0, "Fallback to the default BLS path if --path fails to find BLS entries.", 0, ARG_TYPE_NONE}, ++ {"show-default", 'd', 0, "Allow the default BLS entry to be added to the GRUB menu.", 0, ARG_TYPE_NONE}, ++ {"show-non-default", 'n', 0, "Allow the non-default BLS entries to be added to the GRUB menu.", 0, ARG_TYPE_NONE}, ++ {"entry", 'e', 0, "Allow specific BLS entries to be added to the GRUB menu.", N_("FILE"), ARG_TYPE_FILE}, ++ {0, 0, 0, 0, 0, 0} ++ }; ++ ++struct keyval ++{ ++ const char *key; ++ char *val; ++}; ++ ++struct read_entry_info ++{ ++ const char *devid; ++ const char *dirname; ++ grub_file_t file; ++}; ++ ++struct find_entry_info ++{ ++ const char *dirname; ++ const char *devid; ++ grub_device_t dev; ++ grub_fs_t fs; ++}; ++ ++static grub_blsuki_entry_t *entries; ++ ++#define FOR_BLSUKI_ENTRIES(var) FOR_LIST_ELEMENTS (var, entries) ++ ++/* ++ * This function will add a new keyval pair to a list of keyvals stored in the ++ * entry parameter. ++ */ ++static grub_err_t ++blsuki_add_keyval (grub_blsuki_entry_t *entry, char *key, char *val) ++{ ++ char *k, *v; ++ struct keyval **kvs, *kv; ++ grub_size_t size; ++ int new_n = entry->nkeyvals + 1; ++ ++ if (new_n > BLSUKI_KEYVALS_MAX) ++ return grub_error (GRUB_ERR_BAD_NUMBER, "too many keyval pairs"); ++ ++ if (entry->keyvals_size == 0) ++ { ++ size = sizeof (struct keyval *); ++ kvs = grub_malloc (size); ++ if (kvs == NULL) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't allocate space for BLS key values"); ++ ++ entry->keyvals = kvs; ++ entry->keyvals_size = size; ++ } ++ else if (entry->keyvals_size < new_n * sizeof (struct keyval *)) ++ { ++ size = entry->keyvals_size * 2; ++ kvs = grub_realloc (entry->keyvals, size); ++ if (kvs == NULL) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't reallocate space for BLS key values"); ++ ++ entry->keyvals = kvs; ++ entry->keyvals_size = size; ++ } ++ ++ kv = grub_malloc (sizeof (struct keyval)); ++ if (kv == NULL) ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't find space for new BLS key value"); ++ ++ k = grub_strdup (key); ++ if (k == NULL) ++ { ++ grub_free (kv); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't find space for new BLS key value"); ++ } ++ ++ v = grub_strdup (val); ++ if (v == NULL) ++ { ++ grub_free (k); ++ grub_free (kv); ++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't find space for new BLS key value"); ++ } ++ ++ kv->key = k; ++ kv->val = v; ++ entry->keyvals[entry->nkeyvals] = kv; ++ entry->nkeyvals = new_n; ++ ++ return GRUB_ERR_NONE; ++} ++ ++/* ++ * Find the value of the key named by keyname. If there are allowed to be ++ * more than one, pass a pointer set to -1 to the last parameter the first ++ * time, and pass the same pointer through each time after, and it'll return ++ * them in sorted order as defined in the BLS fragment file. ++ */ ++static char * ++blsuki_get_val (grub_blsuki_entry_t *entry, const char *keyname, int *last) ++{ ++ int idx, start = (last != NULL) ? (*last + 1) : 0; ++ struct keyval *kv = NULL; ++ char *ret = NULL; ++ ++ for (idx = start; idx < entry->nkeyvals; idx++) ++ { ++ kv = entry->keyvals[idx]; ++ ++ if (grub_strcmp (keyname, kv->key) == 0) ++ { ++ ret = kv->val; ++ break; ++ } ++ } ++ ++ if (last != NULL) ++ { ++ if (idx == entry->nkeyvals) ++ *last = -1; ++ else ++ *last = idx; ++ } ++ ++ return ret; ++} ++ ++/* ++ * Add a new grub_blsuki_entry_t struct to the entries list and sort it's ++ * position on the list. ++ */ ++static grub_err_t ++blsuki_add_entry (grub_blsuki_entry_t *entry) ++{ ++ grub_blsuki_entry_t *e, *last = NULL; ++ int rc; ++ ++ if (entries == NULL) ++ { ++ grub_dprintf ("blsuki", "Add entry with id \"%s\"\n", entry->filename); ++ entries = entry; ++ return GRUB_ERR_NONE; ++ } ++ ++ FOR_BLSUKI_ENTRIES (e) ++ { ++ rc = filevercmp (entry->filename, e->filename); ++ if (rc == 0) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("duplicate file: `%s'"), entry->filename); ++ ++ if (rc > 0) ++ { ++ grub_dprintf ("blsuki", "Add entry with id \"%s\"\n", entry->filename); ++ grub_list_push (GRUB_AS_LIST_P (&e), GRUB_AS_LIST (entry)); ++ if (entry->next == entries) ++ { ++ entries = entry; ++ entry->prev = NULL; ++ } ++ else if (last != NULL) ++ last->next = entry; ++ ++ return GRUB_ERR_NONE; ++ } ++ last = e; ++ } ++ ++ if (last != NULL) ++ { ++ grub_dprintf ("blsuki", "Add entry with id \"%s\"\n", entry->filename); ++ last->next = entry; ++ entry->prev = &last; ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++/* ++ * This function parses each line of a BLS config file to obtain the key value ++ * pairs that will be used to setup the GRUB menu entries. The key value pair ++ * will be stored in a list in the entry parameter. ++ */ ++static grub_err_t ++bls_parse_keyvals (grub_file_t f, grub_blsuki_entry_t *entry) ++{ ++ grub_err_t err = GRUB_ERR_NONE; ++ ++ for (;;) ++ { ++ char *line, *key, *val; ++ ++ line = grub_file_getline (f); ++ if (line == NULL) ++ break; ++ ++ key = grub_strtok_r (line, " \t", &val); ++ if (key == NULL) ++ { ++ grub_free (line); ++ break; ++ } ++ if (*key == '#') ++ { ++ grub_free (line); ++ continue; ++ } ++ ++ while (*val == ' ' || *val == '\t') ++ val++; ++ ++ if (*val == '\0') ++ { ++ grub_free (line); ++ break; ++ } ++ ++ err = blsuki_add_keyval (entry, key, val); ++ grub_free (line); ++ if (err != GRUB_ERR_NONE) ++ break; ++ } ++ ++ return err; ++} ++ ++/* ++ * If a file hasn't already been opened, this function opens a BLS config file ++ * and initializes entry data before parsing keyvals and adding the entry to ++ * the list of BLS entries. ++ */ ++static int ++blsuki_read_entry (const char *filename, ++ const struct grub_dirhook_info *dirhook_info __attribute__ ((__unused__)), ++ void *data) ++{ ++ grub_size_t path_len = 0, filename_len; ++ grub_err_t err; ++ char *p = NULL; ++ grub_file_t f = NULL; ++ grub_blsuki_entry_t *entry; ++ struct read_entry_info *info = (struct read_entry_info *) data; ++ ++ grub_dprintf ("blsuki", "filename: \"%s\"\n", filename); ++ ++ filename_len = grub_strlen (filename); ++ ++ if (info->file != NULL) ++ f = info->file; ++ else ++ { ++ if (filename_len < BLS_EXT_LEN || ++ grub_strcmp (filename + filename_len - BLS_EXT_LEN, ".conf") != 0) ++ return 0; ++ ++ p = grub_xasprintf ("(%s)%s/%s", info->devid, info->dirname, filename); ++ ++ f = grub_file_open (p, GRUB_FILE_TYPE_CONFIG); ++ grub_free (p); ++ if (f == NULL) ++ goto finish; ++ } ++ ++ entry = grub_zalloc (sizeof (*entry)); ++ if (entry == NULL) ++ goto finish; ++ ++ /* ++ * If a file is opened before this function, the filename may have a path. ++ * Since the filename is used for the ID of the GRUB menu entry, we can ++ * remove the path. ++ */ ++ if (info->file != NULL) ++ { ++ char *slash; ++ ++ slash = grub_strrchr (filename, '/'); ++ if (slash != NULL) ++ path_len = slash - filename + 1; ++ } ++ filename_len -= path_len; ++ ++ entry->filename = grub_strndup (filename + path_len, filename_len); ++ if (entry->filename == NULL) ++ { ++ grub_free (entry); ++ goto finish; ++ } ++ ++ err = bls_parse_keyvals (f, entry); ++ ++ if (err == GRUB_ERR_NONE) ++ blsuki_add_entry (entry); ++ else ++ grub_free (entry); ++ ++ finish: ++ if (f != NULL) ++ grub_file_close (f); ++ ++ return 0; ++} ++ ++/* ++ * This function returns a list of values that had the same key in the BLS ++ * config file. The number of entries in this list is returned by the len ++ * parameter. ++ */ ++static char ** ++blsuki_make_list (grub_blsuki_entry_t *entry, const char *key, int *len) ++{ ++ int last = -1; ++ char *val; ++ int nlist = 0; ++ char **list; ++ ++ list = grub_zalloc (sizeof (char *)); ++ if (list == NULL) ++ return NULL; ++ ++ while (1) ++ { ++ char **new; ++ ++ /* ++ * Since the same key might appear more than once, the 'last' variable ++ * starts at -1 and increments to indicate the last index in the list ++ * we obtained from blsuki_get_val(). ++ */ ++ val = blsuki_get_val (entry, key, &last); ++ if (val == NULL) ++ break; ++ ++ new = grub_realloc (list, (nlist + 2) * sizeof (char *)); ++ if (new == NULL) ++ break; ++ ++ list = new; ++ list[nlist++] = val; ++ list[nlist] = NULL; ++ } ++ ++ if (nlist == 0) ++ { ++ grub_free (list); ++ return NULL; ++ } ++ ++ if (len != NULL) ++ *len = nlist; ++ ++ return list; ++} ++ ++/* ++ * This function appends a field to the end of a buffer. If the field given is ++ * an enviornmental variable, it gets the value stored for that variable and ++ * appends that to the buffer instead. ++ */ ++static char * ++blsuki_field_append (bool is_env_var, char *buffer, const char *start, const char *end) ++{ ++ char *tmp; ++ const char *field; ++ grub_size_t size = 0; ++ ++ tmp = grub_strndup (start, end - start + 1); ++ if (tmp == NULL) ++ return NULL; ++ ++ field = tmp; ++ ++ if (is_env_var == true) ++ { ++ field = grub_env_get (tmp); ++ if (field == NULL) ++ return buffer; ++ } ++ ++ if (grub_add (grub_strlen (field), 1, &size)) ++ return NULL; ++ ++ if (buffer == NULL) ++ buffer = grub_zalloc (size); ++ else ++ { ++ if (grub_add (size, grub_strlen (buffer), &size)) ++ return NULL; ++ ++ buffer = grub_realloc (buffer, size); ++ } ++ ++ if (buffer == NULL) ++ return NULL; ++ ++ tmp = buffer + grub_strlen (buffer); ++ tmp = grub_stpcpy (tmp, field); ++ ++ if (is_env_var == true) ++ tmp = grub_stpcpy (tmp, " "); ++ ++ return buffer; ++} ++ ++/* ++ * This function takes a value string, checks for environmental variables, and ++ * returns the value string with all environmental variables replaced with the ++ * value stored in the variable. ++ */ ++static char * ++blsuki_expand_val (const char *value) ++{ ++ char *buffer = NULL; ++ const char *start = value; ++ const char *end = value; ++ bool is_env_var = false; ++ ++ if (value == NULL) ++ return NULL; ++ ++ while (*value != '\0') ++ { ++ if (*value == '$') ++ { ++ if (start != end) ++ { ++ buffer = blsuki_field_append (is_env_var, buffer, start, end); ++ if (buffer == NULL) ++ return NULL; ++ } ++ ++ is_env_var = true; ++ start = value + 1; ++ } ++ else if (is_env_var == true) ++ { ++ if (grub_isalnum (*value) == 0 && *value != '_') ++ { ++ buffer = blsuki_field_append (is_env_var, buffer, start, end); ++ is_env_var = false; ++ start = value; ++ if (*start == ' ') ++ start++; ++ } ++ } ++ ++ end = value; ++ value++; ++ } ++ ++ if (start != end) ++ { ++ buffer = blsuki_field_append (is_env_var, buffer, start, end); ++ if (buffer == NULL) ++ return NULL; ++ } ++ ++ return buffer; ++} ++ ++/* ++ * This function returns a string with the command to load a linux kernel with ++ * kernel command-line options based on what was specified in the BLS config ++ * file. ++ */ ++static char * ++bls_get_linux (grub_blsuki_entry_t *entry) ++{ ++ char *linux_path; ++ char *linux_cmd = NULL; ++ char *options = NULL; ++ char *tmp; ++ grub_size_t size; ++ ++ linux_path = blsuki_get_val (entry, "linux", NULL); ++ options = blsuki_expand_val (blsuki_get_val (entry, "options", NULL)); ++ ++ if (grub_add (sizeof ("linux "), grub_strlen (linux_path), &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while calculating linux buffer size"); ++ goto finish; ++ } ++ ++ if (options != NULL) ++ { ++ if (grub_add (size, grub_strlen (options), &size) || ++ grub_add (size, 1, &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while calculating linux buffer size"); ++ goto finish; ++ } ++ } ++ ++ linux_cmd = grub_malloc (size); ++ if (linux_cmd == NULL) ++ goto finish; ++ ++ tmp = linux_cmd; ++ tmp = grub_stpcpy (tmp, "linux "); ++ tmp = grub_stpcpy (tmp, linux_path); ++ if (options != NULL) ++ { ++ tmp = grub_stpcpy (tmp, " "); ++ tmp = grub_stpcpy (tmp, options); ++ } ++ ++ tmp = grub_stpcpy (tmp, "\n"); ++ ++ finish: ++ grub_free (options); ++ return linux_cmd; ++} ++ ++/* ++ * This function returns a string with the command to load all initrds for a ++ * linux kernel image based on the list provided by the BLS config file. ++ */ ++static char * ++bls_get_initrd (grub_blsuki_entry_t *entry) ++{ ++ char **initrd_list; ++ char *initrd_cmd = NULL; ++ char *tmp; ++ grub_size_t size; ++ int i; ++ ++ initrd_list = blsuki_make_list (entry, "initrd", NULL); ++ if (initrd_list != NULL) ++ { ++ size = sizeof ("initrd"); ++ ++ for (i = 0; initrd_list != NULL && initrd_list[i] != NULL; i++) ++ { ++ if (grub_add (size, 1, &size) || ++ grub_add (size, grub_strlen (initrd_list[i]), &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected calculating initrd buffer size"); ++ goto finish; ++ } ++ } ++ ++ if (grub_add (size, 1, &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected calculating initrd buffer size"); ++ goto finish; ++ } ++ ++ initrd_cmd = grub_malloc (size); ++ if (initrd_cmd == NULL) ++ goto finish; ++ ++ tmp = grub_stpcpy (initrd_cmd, "initrd"); ++ for (i = 0; initrd_list != NULL && initrd_list[i] != NULL; i++) ++ { ++ grub_dprintf ("blsuki", "adding initrd %s\n", initrd_list[i]); ++ tmp = grub_stpcpy (tmp, " "); ++ tmp = grub_stpcpy (tmp, initrd_list[i]); ++ } ++ tmp = grub_stpcpy (tmp, "\n"); ++ } ++ ++ finish: ++ grub_free (initrd_list); ++ return initrd_cmd; ++} ++ ++/* ++ * This function returns a string with the command to load a device tree blob ++ * from the BLS config file. ++ */ ++static char * ++bls_get_devicetree (grub_blsuki_entry_t *entry) ++{ ++ char *dt_path; ++ char *dt_cmd = NULL; ++ char *tmp; ++ grub_size_t size; ++ ++ dt_path = blsuki_expand_val (blsuki_get_val (entry, "devicetree", NULL)); ++ if (dt_path != NULL) ++ { ++ if (grub_add (sizeof ("devicetree "), grub_strlen (dt_path), &size) || ++ grub_add (size, 1, &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected calculating device tree buffer size"); ++ return NULL; ++ } ++ ++ dt_cmd = grub_malloc (size); ++ if (dt_cmd == NULL) ++ return NULL; ++ ++ tmp = dt_cmd; ++ tmp = grub_stpcpy (dt_cmd, "devicetree "); ++ tmp = grub_stpcpy (tmp, dt_path); ++ tmp = grub_stpcpy (tmp, "\n"); ++ } ++ ++ return dt_cmd; ++} ++ ++/* ++ * This function puts together all of the commands generated from the contents ++ * of the BLS config file and creates a new entry in the GRUB boot menu. ++ */ ++static void ++bls_create_entry (grub_blsuki_entry_t *entry) ++{ ++ int argc = 0; ++ const char **argv = NULL; ++ char *title = NULL; ++ char *linux_path = NULL; ++ char *linux_cmd = NULL; ++ char *initrd_cmd = NULL; ++ char *dt_cmd = NULL; ++ char *id = entry->filename; ++ grub_size_t id_len; ++ char *hotkey = NULL; ++ char *users = NULL; ++ char **classes = NULL; ++ char **args = NULL; ++ char *src = NULL; ++ int i; ++ grub_size_t size; ++ bool blsuki_save_default; ++ ++ linux_path = blsuki_get_val (entry, "linux", NULL); ++ if (linux_path == NULL) ++ { ++ grub_dprintf ("blsuki", "Skipping file %s with no 'linux' key.\n", entry->filename); ++ goto finish; ++ } ++ ++ id_len = grub_strlen (id); ++ if (id_len >= BLS_EXT_LEN && grub_strcmp (id + id_len - BLS_EXT_LEN, ".conf") == 0) ++ id[id_len - BLS_EXT_LEN] = '\0'; ++ ++ title = blsuki_get_val (entry, "title", NULL); ++ hotkey = blsuki_get_val (entry, "grub_hotkey", NULL); ++ users = blsuki_expand_val (blsuki_get_val (entry, "grub_users", NULL)); ++ classes = blsuki_make_list (entry, "grub_class", NULL); ++ args = blsuki_make_list (entry, "grub_arg", &argc); ++ ++ argc++; ++ if (grub_mul (argc + 1, sizeof (char *), &size)) ++ { ++ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow detected creating argv list")); ++ goto finish; ++ } ++ ++ argv = grub_malloc (size); ++ if (argv == NULL) ++ goto finish; ++ ++ argv[0] = (title != NULL) ? title : linux_path; ++ for (i = 1; i < argc; i++) ++ argv[i] = args[i - 1]; ++ argv[argc] = NULL; ++ ++ linux_cmd = bls_get_linux (entry); ++ if (linux_cmd == NULL) ++ goto finish; ++ ++ initrd_cmd = bls_get_initrd (entry); ++ if (grub_errno != GRUB_ERR_NONE) ++ goto finish; ++ ++ dt_cmd = bls_get_devicetree (entry); ++ if (grub_errno != GRUB_ERR_NONE) ++ goto finish; ++ ++ blsuki_save_default = grub_env_get_bool ("blsuki_save_default", false); ++ src = grub_xasprintf ("%s%s%s%s", ++ blsuki_save_default ? "savedefault\n" : "", ++ linux_cmd, initrd_cmd ? initrd_cmd : "", ++ dt_cmd ? dt_cmd : ""); ++ ++ grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, entry); ++ ++ finish: ++ grub_free (linux_cmd); ++ grub_free (dt_cmd); ++ grub_free (initrd_cmd); ++ grub_free (classes); ++ grub_free (args); ++ grub_free (argv); ++ grub_free (src); ++} ++ ++/* ++ * This function fills a find_entry_info struct passed in by the info parameter. ++ * If the dirname or devid parameters are set to NULL, the dirname and devid ++ * fields in the info parameter will be set to default values. If info already ++ * has a value in the dev fields, we can compare it to the value passed in by ++ * the devid parameter or the default devid to see if we need to open a new ++ * device. ++ */ ++static grub_err_t ++blsuki_set_find_entry_info (struct find_entry_info *info, const char *dirname, const char *devid) ++{ ++ grub_device_t dev; ++ grub_fs_t fs; ++ ++ if (info == NULL) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "info parameter is not set"); ++ ++ if (devid == NULL) ++ { ++ devid = grub_env_get ("root"); ++ if (devid == NULL) ++ return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable '%s' isn't set"), "root"); ++ } ++ ++ /* Check that we aren't closing and opening the same device. */ ++ if (info->dev != NULL && grub_strcmp (info->devid, devid) != 0) ++ { ++ grub_device_close (info->dev); ++ info->dev = NULL; ++ } ++ /* If we are using the same device, then we can skip this step and only set the directory. */ ++ if (info->dev == NULL) ++ { ++ grub_dprintf ("blsuki", "opening %s\n", devid); ++ dev = grub_device_open (devid); ++ if (dev == NULL) ++ return grub_errno; ++ ++ grub_dprintf ("blsuki", "probing fs\n"); ++ fs = grub_fs_probe (dev); ++ if (fs == NULL) ++ { ++ grub_device_close (dev); ++ return grub_errno; ++ } ++ ++ info->devid = devid; ++ info->dev = dev; ++ info->fs = fs; ++ } ++ ++ info->dirname = dirname; ++ ++ return GRUB_ERR_NONE; ++} ++ ++/* ++ * This function searches for BLS config files based on the data in the info ++ * parameter. If the fallback option is enabled, the default location will be ++ * checked for BLS config files if the first attempt fails. ++ */ ++static void ++blsuki_find_entry (struct find_entry_info *info, bool enable_fallback) ++{ ++ struct read_entry_info read_entry_info; ++ grub_fs_t dir_fs = NULL; ++ grub_device_t dir_dev = NULL; ++ bool fallback = false; ++ int r; ++ ++ do ++ { ++ read_entry_info.file = NULL; ++ read_entry_info.dirname = info->dirname; ++ ++ grub_dprintf ("blsuki", "scanning dir: %s\n", info->dirname); ++ dir_dev = info->dev; ++ dir_fs = info->fs; ++ read_entry_info.devid = info->devid; ++ ++ r = dir_fs->fs_dir (dir_dev, read_entry_info.dirname, blsuki_read_entry, ++ &read_entry_info); ++ if (r != 0) ++ { ++ grub_dprintf ("blsuki", "blsuki_read_entry returned error\n"); ++ grub_errno = GRUB_ERR_NONE; ++ } ++ ++ /* ++ * If we aren't able to find BLS entries in the directory given by info->dirname, ++ * we can fallback to the default location "/boot/loader/entries/" and see if we ++ * can find the files there. ++ */ ++ if (entries == NULL && fallback == false && enable_fallback == true) ++ { ++ blsuki_set_find_entry_info (info, GRUB_BLS_CONFIG_PATH, NULL); ++ grub_dprintf ("blsuki", "Entries weren't found in %s, fallback to %s\n", ++ read_entry_info.dirname, info->dirname); ++ fallback = true; ++ } ++ else ++ fallback = false; ++ } ++ while (fallback == true); ++} ++ ++static grub_err_t ++blsuki_load_entries (char *path, bool enable_fallback) ++{ ++ grub_size_t len; ++ static grub_err_t r; ++ const char *devid = NULL; ++ char *dir = NULL; ++ struct find_entry_info info = { ++ .dev = NULL, ++ .fs = NULL, ++ .dirname = NULL, ++ }; ++ struct read_entry_info rei = { ++ .devid = NULL, ++ .dirname = NULL, ++ }; ++ ++ if (path != NULL) ++ { ++ len = grub_strlen (path); ++ if (len >= BLS_EXT_LEN && grub_strcmp (path + len - BLS_EXT_LEN, ".conf") == 0) ++ { ++ rei.file = grub_file_open (path, GRUB_FILE_TYPE_CONFIG); ++ if (rei.file == NULL) ++ return grub_errno; ++ ++ /* blsuki_read_entry() closes the file. */ ++ return blsuki_read_entry (path, NULL, &rei); ++ } ++ else if (path[0] == '(') ++ { ++ devid = path + 1; ++ ++ dir = grub_strchr (path, ')'); ++ if (dir == NULL) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid file name `%s'"), path); ++ ++ *dir = '\0'; ++ ++ /* Check if there is more than the devid in the path. */ ++ if (dir + 1 < path + len) ++ dir = dir + 1; ++ } ++ else if (path[0] == '/') ++ dir = path; ++ } ++ ++ if (dir == NULL) ++ dir = (char *) GRUB_BLS_CONFIG_PATH; ++ ++ r = blsuki_set_find_entry_info (&info, dir, devid); ++ if (r == GRUB_ERR_NONE) ++ blsuki_find_entry (&info, enable_fallback); ++ ++ if (info.dev != NULL) ++ grub_device_close (info.dev); ++ ++ return r; ++} ++ ++static bool ++blsuki_is_default_entry (const char *def_entry, grub_blsuki_entry_t *entry, int idx) ++{ ++ const char *title; ++ const char *def_entry_end; ++ long def_idx; ++ ++ if (def_entry == NULL || *def_entry == '\0') ++ return false; ++ ++ if (grub_strcmp (def_entry, entry->filename) == 0) ++ return true; ++ ++ title = blsuki_get_val (entry, "title", NULL); ++ ++ if (title != NULL && grub_strcmp (def_entry, title) == 0) ++ return true; ++ ++ def_idx = grub_strtol (def_entry, &def_entry_end, 0); ++ if (*def_entry_end != '\0' || def_idx < 0 || def_idx > GRUB_INT_MAX) ++ return false; ++ ++ if ((int) def_idx == idx) ++ return true; ++ ++ return false; ++} ++ ++/* ++ * This function creates a GRUB boot menu entry for each BLS entry in the ++ * entries list. ++ */ ++static grub_err_t ++blsuki_create_entries (bool show_default, bool show_non_default, char *entry_id) ++{ ++ const char *def_entry = NULL; ++ grub_blsuki_entry_t *entry = NULL; ++ int idx = 0; ++ ++ def_entry = grub_env_get ("default"); ++ ++ FOR_BLSUKI_ENTRIES(entry) ++ { ++ if (entry->visible == true) ++ { ++ idx++; ++ continue; ++ } ++ if ((show_default == true && blsuki_is_default_entry (def_entry, entry, idx) == true) || ++ (show_non_default == true && blsuki_is_default_entry (def_entry, entry, idx) == false) || ++ (entry_id != NULL && grub_strcmp (entry_id, entry->filename) == 0)) ++ { ++ bls_create_entry (entry); ++ entry->visible = true; ++ } ++ ++ idx++; ++ } ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)), ++ char **args __attribute__ ((unused))) ++{ ++ grub_err_t err; ++ struct grub_arg_list *state = ctxt->state; ++ char *path = NULL; ++ char *entry_id = NULL; ++ bool enable_fallback = false; ++ bool show_default = false; ++ bool show_non_default = false; ++ bool all = true; ++ entries = NULL; ++ ++ if (state[0].set) ++ path = state[0].arg; ++ if (state[1].set) ++ enable_fallback = true; ++ if (state[2].set) ++ { ++ show_default = true; ++ all = false; ++ } ++ if (state[3].set) ++ { ++ show_non_default = true; ++ all = false; ++ } ++ if (state[4].set) ++ { ++ entry_id = state[4].arg; ++ all = false; ++ } ++ if (all == true) ++ { ++ show_default = true; ++ show_non_default = true; ++ } ++ ++ err = blsuki_load_entries (path, enable_fallback); ++ if (err != GRUB_ERR_NONE) ++ return err; ++ ++ return blsuki_create_entries (show_default, show_non_default, entry_id); ++} ++ ++static grub_extcmd_t bls_cmd; ++ ++GRUB_MOD_INIT(blsuki) ++{ ++ bls_cmd = grub_register_extcmd ("blscfg", grub_cmd_blscfg, 0, ++ N_("[-p|--path] [-f|--enable-fallback] DIR [-d|--show-default] [-n|--show-non-default] [-e|--entry] FILE"), ++ N_("Import Boot Loader Specification snippets."), ++ bls_opt); ++} ++ ++GRUB_MOD_FINI(blsuki) ++{ ++ grub_unregister_extcmd (bls_cmd); ++} +diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c +index 86bcda6954..a5d296769e 100644 +--- a/grub-core/commands/legacycfg.c ++++ b/grub-core/commands/legacycfg.c +@@ -143,7 +143,7 @@ legacy_file (const char *filename) + args[0] = oldname; + grub_normal_add_menu_entry (1, args, NULL, NULL, "legacy", + NULL, NULL, +- entrysrc, 0, NULL, NULL); ++ entrysrc, 0, NULL, NULL, NULL); + grub_free (args); + entrysrc[0] = 0; + grub_free (oldname); +@@ -205,7 +205,7 @@ legacy_file (const char *filename) + args[0] = entryname; + grub_normal_add_menu_entry (1, args, NULL, NULL, NULL, + NULL, NULL, entrysrc, 0, NULL, +- NULL); ++ NULL, NULL); + grub_free (args); + } + +diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c +index b175a1b43b..d6cf329203 100644 +--- a/grub-core/commands/menuentry.c ++++ b/grub-core/commands/menuentry.c +@@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args, + char **classes, const char *id, + const char *users, const char *hotkey, + const char *prefix, const char *sourcecode, +- int submenu, int *index, struct bls_entry *bls) ++ int submenu, int *index, struct bls_entry *bls, grub_blsuki_entry_t *blsuki) + { + int menu_hotkey = 0; + char **menu_args = NULL; +@@ -196,6 +196,7 @@ grub_normal_add_menu_entry (int argc, const char **args, + (*last)->sourcecode = menu_sourcecode; + (*last)->submenu = submenu; + (*last)->bls = bls; ++ (*last)->blsuki = blsuki; + + menu->size++; + if (index) +@@ -297,7 +298,7 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args) + ctxt->state[2].arg, 0, + ctxt->state[3].arg, + ctxt->extcmd->cmd->name[0] == 's', +- NULL, NULL); ++ NULL, NULL, NULL); + + src = args[argc - 1]; + args[argc - 1] = NULL; +@@ -315,7 +316,7 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args) + users, + ctxt->state[2].arg, prefix, src + 1, + ctxt->extcmd->cmd->name[0] == 's', NULL, +- NULL); ++ NULL, NULL); + + src[len - 1] = ch; + args[argc - 1] = src; +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index 6f7290a897..e038ed14b8 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -75,6 +75,10 @@ grub_normal_free_menu (grub_menu_t menu) + { + entry->bls->visible = 0; + } ++ if (entry->blsuki) ++ { ++ entry->blsuki->visible = 0; ++ } + + grub_free ((void *) entry->id); + grub_free ((void *) entry->users); +diff --git a/include/grub/menu.h b/include/grub/menu.h +index 0acdc2aa6b..43a3c5809b 100644 +--- a/include/grub/menu.h ++++ b/include/grub/menu.h +@@ -20,6 +20,7 @@ + #ifndef GRUB_MENU_HEADER + #define GRUB_MENU_HEADER 1 + ++ + struct bls_entry + { + struct bls_entry *next; +@@ -30,6 +31,18 @@ struct bls_entry + int visible; + }; + ++struct grub_blsuki_entry ++{ ++ struct grub_blsuki_entry *next; ++ struct grub_blsuki_entry **prev; ++ struct keyval **keyvals; ++ grub_size_t keyvals_size; ++ int nkeyvals; ++ char *filename; ++ bool visible; ++}; ++typedef struct grub_blsuki_entry grub_blsuki_entry_t; ++ + struct grub_menu_entry_class + { + char *name; +@@ -73,6 +86,7 @@ struct grub_menu_entry + + /* BLS used to populate the entry */ + struct bls_entry *bls; ++ grub_blsuki_entry_t *blsuki; + }; + typedef struct grub_menu_entry *grub_menu_entry_t; + +diff --git a/include/grub/normal.h b/include/grub/normal.h +index 8839ad85a1..6d2b59db88 100644 +--- a/include/grub/normal.h ++++ b/include/grub/normal.h +@@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes, + const char *id, + const char *users, const char *hotkey, + const char *prefix, const char *sourcecode, +- int submenu, int *index, struct bls_entry *bls); ++ int submenu, int *index, struct bls_entry *bls, grub_blsuki_entry_t *blsuki); + + grub_err_t + grub_normal_set_password (const char *user, const char *password); diff --git a/0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch b/0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch new file mode 100644 index 00000000..f80fb5c9 --- /dev/null +++ b/0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Tue, 12 Aug 2025 03:45:34 +0000 +Subject: [PATCH] util/misc.c: Change offset type for + grub_util_write_image_at() + +Adding filevercmp support to grub-core/commands/blsuki.c from gnulib will cause +issues with the type of the offset parameter for grub_util_write_image_at() for +emu builds. To fix this issue, we can change the type from off_t to grub_off_t. + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + include/grub/util/misc.h | 2 +- + util/misc.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h +index e9e0a6724a..bfce065583 100644 +--- a/include/grub/util/misc.h ++++ b/include/grub/util/misc.h +@@ -36,7 +36,7 @@ char *grub_util_read_image (const char *path); + void grub_util_load_image (const char *path, char *buf); + void grub_util_write_image (const char *img, size_t size, FILE *out, + const char *name); +-void grub_util_write_image_at (const void *img, size_t size, off_t offset, ++void grub_util_write_image_at (const void *img, size_t size, grub_off_t offset, + FILE *out, const char *name); + + char *make_system_path_relative_to_its_root (const char *path); +diff --git a/util/misc.c b/util/misc.c +index 0f928e5b49..6e16a68d9a 100644 +--- a/util/misc.c ++++ b/util/misc.c +@@ -101,7 +101,7 @@ grub_util_read_image (const char *path) + } + + void +-grub_util_write_image_at (const void *img, size_t size, off_t offset, FILE *out, ++grub_util_write_image_at (const void *img, size_t size, grub_off_t offset, FILE *out, + const char *name) + { + grub_util_info ("writing 0x%" GRUB_HOST_PRIxLONG_LONG " bytes at offset 0x%" diff --git a/0004-blsuki-Check-for-mounted-boot-in-emu.patch b/0004-blsuki-Check-for-mounted-boot-in-emu.patch new file mode 100644 index 00000000..3f207333 --- /dev/null +++ b/0004-blsuki-Check-for-mounted-boot-in-emu.patch @@ -0,0 +1,342 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Tue, 12 Aug 2025 03:45:35 +0000 +Subject: [PATCH] blsuki: Check for mounted /boot in emu + +Irritatingly, BLS defines paths relative to the mountpoint of the +filesystem which contains its snippets, not / or any other fixed +location. So grub-emu needs to know whether /boot is a separate +filesystem from / and conditionally prepend a path. + +Signed-off-by: Robbie Harwood +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + grub-core/Makefile.core.def | 3 ++ + grub-core/commands/blsuki.c | 83 +++++++++++++++++++++++++++++++++++++---- + grub-core/osdep/linux/getroot.c | 8 ++++ + grub-core/osdep/unix/getroot.c | 4 +- + include/grub/emu/misc.h | 2 +- + 5 files changed, 91 insertions(+), 9 deletions(-) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 5e0e757344..885dd436de 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -376,6 +376,9 @@ kernel = { + emu = kern/emu/cache_s.S; + emu = kern/emu/hostdisk.c; + emu = osdep/unix/hostdisk.c; ++ emu = osdep/relpath.c; ++ emu = osdep/getroot.c; ++ emu = osdep/unix/getroot.c; + emu = osdep/exec.c; + extra_dist = osdep/unix/exec.c; + emu = osdep/devmapper/hostdisk.c; +diff --git a/grub-core/commands/blsuki.c b/grub-core/commands/blsuki.c +index 9440adb100..ed93a150b1 100644 +--- a/grub-core/commands/blsuki.c ++++ b/grub-core/commands/blsuki.c +@@ -32,6 +32,13 @@ + #include + #include + ++#ifdef GRUB_MACHINE_EMU ++#include ++#define GRUB_BOOT_DEVICE "/boot" ++#else ++#define GRUB_BOOT_DEVICE "" ++#endif ++ + GRUB_MOD_LICENSE ("GPLv3+"); + + #define GRUB_BLS_CONFIG_PATH "/loader/entries/" +@@ -79,6 +86,34 @@ static grub_blsuki_entry_t *entries; + + #define FOR_BLSUKI_ENTRIES(var) FOR_LIST_ELEMENTS (var, entries) + ++/* ++ * BLS appears to make paths relative to the filesystem that snippets are ++ * on, not /. Attempt to cope. ++ */ ++static char *blsuki_update_boot_device (char *tmp) ++{ ++#ifdef GRUB_MACHINE_EMU ++ static int separate_boot = -1; ++ char *ret; ++ ++ if (separate_boot != -1) ++ goto probed; ++ ++ separate_boot = 0; ++ ++ ret = grub_make_system_path_relative_to_its_root (GRUB_BOOT_DEVICE); ++ ++ if (ret != NULL && ret[0] == '\0') ++ separate_boot = 1; ++ ++ probed: ++ if (separate_boot == 0) ++ return tmp; ++#endif ++ ++ return grub_stpcpy (tmp, GRUB_BOOT_DEVICE); ++} ++ + /* + * This function will add a new keyval pair to a list of keyvals stored in the + * entry parameter. +@@ -526,7 +561,7 @@ bls_get_linux (grub_blsuki_entry_t *entry) + linux_path = blsuki_get_val (entry, "linux", NULL); + options = blsuki_expand_val (blsuki_get_val (entry, "options", NULL)); + +- if (grub_add (sizeof ("linux "), grub_strlen (linux_path), &size)) ++ if (grub_add (sizeof ("linux " GRUB_BOOT_DEVICE), grub_strlen (linux_path), &size)) + { + grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected while calculating linux buffer size"); + goto finish; +@@ -548,6 +583,7 @@ bls_get_linux (grub_blsuki_entry_t *entry) + + tmp = linux_cmd; + tmp = grub_stpcpy (tmp, "linux "); ++ tmp = blsuki_update_boot_device (tmp); + tmp = grub_stpcpy (tmp, linux_path); + if (options != NULL) + { +@@ -582,7 +618,7 @@ bls_get_initrd (grub_blsuki_entry_t *entry) + + for (i = 0; initrd_list != NULL && initrd_list[i] != NULL; i++) + { +- if (grub_add (size, 1, &size) || ++ if (grub_add (size, sizeof (" " GRUB_BOOT_DEVICE) - 1, &size) || + grub_add (size, grub_strlen (initrd_list[i]), &size)) + { + grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected calculating initrd buffer size"); +@@ -605,6 +641,7 @@ bls_get_initrd (grub_blsuki_entry_t *entry) + { + grub_dprintf ("blsuki", "adding initrd %s\n", initrd_list[i]); + tmp = grub_stpcpy (tmp, " "); ++ tmp = blsuki_update_boot_device (tmp); + tmp = grub_stpcpy (tmp, initrd_list[i]); + } + tmp = grub_stpcpy (tmp, "\n"); +@@ -630,7 +667,7 @@ bls_get_devicetree (grub_blsuki_entry_t *entry) + dt_path = blsuki_expand_val (blsuki_get_val (entry, "devicetree", NULL)); + if (dt_path != NULL) + { +- if (grub_add (sizeof ("devicetree "), grub_strlen (dt_path), &size) || ++ if (grub_add (sizeof ("devicetree " GRUB_BOOT_DEVICE), grub_strlen (dt_path), &size) || + grub_add (size, 1, &size)) + { + grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow detected calculating device tree buffer size"); +@@ -643,6 +680,7 @@ bls_get_devicetree (grub_blsuki_entry_t *entry) + + tmp = dt_cmd; + tmp = grub_stpcpy (dt_cmd, "devicetree "); ++ tmp = blsuki_update_boot_device (tmp); + tmp = grub_stpcpy (tmp, dt_path); + tmp = grub_stpcpy (tmp, "\n"); + } +@@ -757,7 +795,11 @@ blsuki_set_find_entry_info (struct find_entry_info *info, const char *dirname, c + + if (devid == NULL) + { ++#ifdef GRUB_MACHINE_EMU ++ devid = "host"; ++#else + devid = grub_env_get ("root"); ++#endif + if (devid == NULL) + return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable '%s' isn't set"), "root"); + } +@@ -799,10 +841,13 @@ blsuki_set_find_entry_info (struct find_entry_info *info, const char *dirname, c + * parameter. If the fallback option is enabled, the default location will be + * checked for BLS config files if the first attempt fails. + */ +-static void ++static grub_err_t + blsuki_find_entry (struct find_entry_info *info, bool enable_fallback) + { + struct read_entry_info read_entry_info; ++ char *default_dir = NULL; ++ char *tmp; ++ grub_size_t default_size; + grub_fs_t dir_fs = NULL; + grub_device_t dir_dev = NULL; + bool fallback = false; +@@ -833,7 +878,15 @@ blsuki_find_entry (struct find_entry_info *info, bool enable_fallback) + */ + if (entries == NULL && fallback == false && enable_fallback == true) + { +- blsuki_set_find_entry_info (info, GRUB_BLS_CONFIG_PATH, NULL); ++ default_size = sizeof (GRUB_BOOT_DEVICE) + sizeof (GRUB_BLS_CONFIG_PATH) - 1; ++ default_dir = grub_malloc (default_size); ++ if (default_dir == NULL) ++ return grub_errno; ++ ++ tmp = blsuki_update_boot_device (default_dir); ++ tmp = grub_stpcpy (tmp, GRUB_BLS_CONFIG_PATH); ++ ++ blsuki_set_find_entry_info (info, default_dir, NULL); + grub_dprintf ("blsuki", "Entries weren't found in %s, fallback to %s\n", + read_entry_info.dirname, info->dirname); + fallback = true; +@@ -842,6 +895,9 @@ blsuki_find_entry (struct find_entry_info *info, bool enable_fallback) + fallback = false; + } + while (fallback == true); ++ ++ grub_free (default_dir); ++ return GRUB_ERR_NONE; + } + + static grub_err_t +@@ -851,6 +907,9 @@ blsuki_load_entries (char *path, bool enable_fallback) + static grub_err_t r; + const char *devid = NULL; + char *dir = NULL; ++ char *default_dir = NULL; ++ char *tmp; ++ grub_size_t dir_size; + struct find_entry_info info = { + .dev = NULL, + .fs = NULL, +@@ -892,15 +951,25 @@ blsuki_load_entries (char *path, bool enable_fallback) + } + + if (dir == NULL) +- dir = (char *) GRUB_BLS_CONFIG_PATH; ++ { ++ dir_size = sizeof (GRUB_BOOT_DEVICE) + sizeof (GRUB_BLS_CONFIG_PATH) - 2; ++ default_dir = grub_malloc (dir_size); ++ if (default_dir == NULL) ++ return grub_errno; ++ ++ tmp = blsuki_update_boot_device (default_dir); ++ tmp = grub_stpcpy (tmp, GRUB_BLS_CONFIG_PATH); ++ dir = default_dir; ++ } + + r = blsuki_set_find_entry_info (&info, dir, devid); + if (r == GRUB_ERR_NONE) +- blsuki_find_entry (&info, enable_fallback); ++ r = blsuki_find_entry (&info, enable_fallback); + + if (info.dev != NULL) + grub_device_close (info.dev); + ++ grub_free (default_dir); + return r; + } + +diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c +index 4bf386b590..8bf281c1d8 100644 +--- a/grub-core/osdep/linux/getroot.c ++++ b/grub-core/osdep/linux/getroot.c +@@ -139,6 +139,7 @@ struct mountinfo_entry + char fstype[ESCAPED_PATH_MAX + 1], device[ESCAPED_PATH_MAX + 1]; + }; + ++#ifdef GRUB_UTIL + static char ** + grub_util_raid_getmembers (const char *name, int bootable) + { +@@ -199,6 +200,7 @@ grub_util_raid_getmembers (const char *name, int bootable) + + return devicelist; + } ++#endif + + /* Statting something on a btrfs filesystem always returns a virtual device + major/minor pair rather than the real underlying device, because btrfs +@@ -700,6 +702,7 @@ out: + return ret; + } + ++#ifdef GRUB_UTIL + static char * + get_mdadm_uuid (const char *os_dev) + { +@@ -757,6 +760,7 @@ out: + + return name; + } ++#endif + + static int + grub_util_is_imsm_or_ddf (const char *os_dev) +@@ -1096,6 +1100,7 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st, + return path; + } + ++#ifdef GRUB_UTIL + static char * + grub_util_get_raid_grub_dev (const char *os_dev) + { +@@ -1198,6 +1203,7 @@ grub_util_get_raid_grub_dev (const char *os_dev) + } + return grub_dev; + } ++#endif + + enum grub_dev_abstraction_types + grub_util_get_dev_abstraction_os (const char *os_dev) +@@ -1214,6 +1220,7 @@ grub_util_get_dev_abstraction_os (const char *os_dev) + return GRUB_DEV_ABSTRACTION_NONE; + } + ++#ifdef GRUB_UTIL + int + grub_util_pull_device_os (const char *os_dev, + enum grub_dev_abstraction_types ab) +@@ -1270,6 +1277,7 @@ grub_util_get_grub_dev_os (const char *os_dev) + + return grub_dev; + } ++#endif + + static void *mp = NULL; + static void +diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c +index ee11b02fb6..62581ba601 100644 +--- a/grub-core/osdep/unix/getroot.c ++++ b/grub-core/osdep/unix/getroot.c +@@ -16,8 +16,8 @@ + * along with GRUB. If not, see . + */ + +-#include + #include ++#include + + #include + #include +@@ -567,6 +567,7 @@ grub_guess_root_devices (const char *dir_in) + + #endif + ++#ifdef GRUB_UTIL + void + grub_util_pull_lvm_by_command (const char *os_dev) + { +@@ -663,6 +664,7 @@ out: + free (buf); + free (vgid); + } ++#endif + + /* ZFS has similar problems to those of btrfs (see above). */ + void +diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h +index f3a712a8b2..59b8038c60 100644 +--- a/include/grub/emu/misc.h ++++ b/include/grub/emu/misc.h +@@ -39,7 +39,7 @@ void grub_fini_all (void); + void grub_find_zpool_from_dir (const char *dir, + char **poolname, char **poolfs); + +-char *grub_make_system_path_relative_to_its_root (const char *path) ++char *EXPORT_FUNC (grub_make_system_path_relative_to_its_root) (const char *path) + WARN_UNUSED_RESULT; + int + grub_util_device_is_mapped (const char *dev); diff --git a/0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch b/0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch new file mode 100644 index 00000000..fe91d9e4 --- /dev/null +++ b/0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch @@ -0,0 +1,822 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alec Brown +Date: Tue, 12 Aug 2025 03:45:36 +0000 +Subject: [PATCH] blsuki: Add uki command to load Unified Kernel Image entries + +A Unified Kernel Image (UKI) is a single UEFI PE file that combines +a UEFI boot stub, a Linux kernel image, an initrd, and further resources. +The uki command will locate where the UKI file is and create a GRUB menu +entry to load it. + +The Unified Kernel Image Specification: https://uapi-group.org/specifications/specs/unified_kernel_image/ + +Signed-off-by: Alec Brown +Reviewed-by: Daniel Kiper +--- + docs/grub.texi | 36 +++- + grub-core/commands/blsuki.c | 476 ++++++++++++++++++++++++++++++++++++++++---- + include/grub/menu.h | 2 + + 3 files changed, 474 insertions(+), 40 deletions(-) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 336f8e87ed..531e847f32 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -3344,7 +3344,8 @@ chain-loaded system, @pxref{drivemap}. + @subsection blsuki_save_default + + If this variable is set, menu entries generated from BLS config files +-(@pxref{blscfg}) will be set as the default boot entry when selected. ++(@pxref{blscfg}) or UKI files (@pxref{uki}) will be set as the default boot ++entry when selected. + + @node check_appended_signatures + @subsection check_appended_signatures +@@ -4434,6 +4435,7 @@ you forget a command, you can run the command @command{help} + * true:: Do nothing, successfully + * trust:: Add public key to list of trusted keys + * trust_certificate:: Add an x509 certificate to the list of trusted certificates ++* uki:: Load Unified Kernel Image menu entries + * unset:: Unset an environment variable + @comment * vbeinfo:: List available video modes + * verify_appended:: Verify appended digital signature +@@ -6062,6 +6064,38 @@ Unset the environment variable @var{envvar}. + @end deffn + + ++@node uki ++@subsection uki ++ ++@deffn Command uki [@option{-p|--path} dir] [@option{-f|--enable-fallback}] [@option{-d|--show-default}] [@option{-n|--show-non-default}] [@option{-e|--entry} file] ++Load Unified Kernel Image (UKI) files into the GRUB menu. Boot entries ++generated from @command{uki} won't interfere with entries from @file{grub.cfg} appearing in the ++GRUB menu. Also, entries generated from @command{uki} exists only in memory and don't ++update @file{grub.cfg}. ++ ++By default, the UKI files are stored in the @file{/EFI/Linux} directory in the EFI ++system partition. If UKI files are stored elsewhere, the @option{--path} option can be ++used to check a different directory instead of the default location. If no UKI ++files are found while using the @option{--path} option, the @option{--enable-fallback} option can ++be used to check for files in the default location. ++ ++The @option{--show-default} option allows the default boot entry to be added to the ++GRUB menu from the UKI files. ++ ++The @option{--show-non-default} option allows non-default boot entries to be added to ++the GRUB menu from the UKI files. ++ ++The @option{--entry} option allows specific boot entries to be added to the GRUB menu ++from the UKI files. ++ ++The @option{--entry}, @option{--show-default}, and @option{--show-non-default} options ++are used to filter which UKI files are added to the GRUB menu. If none are ++used, all files in the default location or the location specified by @option{--path} ++will be added to the GRUB menu. ++ ++For more information on UKI, see: @uref{https://uapi-group.org/specifications/specs/unified_kernel_image/, The Unified Kernel Image Specification} ++@end deffn ++ + @ignore + @node vbeinfo + @subsection vbeinfo +diff --git a/grub-core/commands/blsuki.c b/grub-core/commands/blsuki.c +index ed93a150b1..cb00f936a7 100644 +--- a/grub-core/commands/blsuki.c ++++ b/grub-core/commands/blsuki.c +@@ -32,6 +32,12 @@ + #include + #include + ++#ifdef GRUB_MACHINE_EFI ++#include ++#include ++#include ++#endif ++ + #ifdef GRUB_MACHINE_EMU + #include + #define GRUB_BOOT_DEVICE "/boot" +@@ -42,14 +48,28 @@ + GRUB_MOD_LICENSE ("GPLv3+"); + + #define GRUB_BLS_CONFIG_PATH "/loader/entries/" ++#define GRUB_UKI_CONFIG_PATH "/EFI/Linux" + + #define BLS_EXT_LEN (sizeof (".conf") - 1) ++#define UKI_EXT_LEN (sizeof (".efi") - 1) + + /* + * It is highly unlikely to ever receive a large amount of keyval pairs. A + * limit of 10000 is more than enough. + */ + #define BLSUKI_KEYVALS_MAX 10000 ++/* ++ * The only sections we read are ".cmdline" and ".osrel". The ".cmdline" ++ * section has a size limit of 4096 and it would be very unlikely for the size ++ * of the ".osrel" section to be 5 times larger than 4096. ++ */ ++#define UKI_SECTION_SIZE_MAX (5 * 4096) ++ ++enum blsuki_cmd_type ++ { ++ BLSUKI_BLS_CMD, ++ BLSUKI_UKI_CMD, ++ }; + + static const struct grub_arg_option bls_opt[] = + { +@@ -61,6 +81,18 @@ static const struct grub_arg_option bls_opt[] = + {0, 0, 0, 0, 0, 0} + }; + ++#ifdef GRUB_MACHINE_EFI ++static const struct grub_arg_option uki_opt[] = ++ { ++ {"path", 'p', 0, N_("Specify path to find UKI entries."), N_("DIR"), ARG_TYPE_PATHNAME}, ++ {"enable-fallback", 'f', 0, "Fallback to the default BLS path if --path fails to find UKI entries.", 0, ARG_TYPE_NONE}, ++ {"show-default", 'd', 0, N_("Allow the default UKI entry to be added to the GRUB menu."), 0, ARG_TYPE_NONE}, ++ {"show-non-default", 'n', 0, N_("Allow the non-default UKI entries to be added to the GRUB menu."), 0, ARG_TYPE_NONE}, ++ {"entry", 'e', 0, N_("Allow specificUKII entries to be added to the GRUB menu."), N_("FILE"), ARG_TYPE_FILE}, ++ {0, 0, 0, 0, 0, 0} ++ }; ++#endif ++ + struct keyval + { + const char *key; +@@ -71,6 +103,7 @@ struct read_entry_info + { + const char *devid; + const char *dirname; ++ enum blsuki_cmd_type cmd_type; + grub_file_t file; + }; + +@@ -82,7 +115,7 @@ struct find_entry_info + grub_fs_t fs; + }; + +-static grub_blsuki_entry_t *entries; ++static grub_blsuki_entry_t *entries = NULL; + + #define FOR_BLSUKI_ENTRIES(var) FOR_LIST_ELEMENTS (var, entries) + +@@ -181,7 +214,7 @@ blsuki_add_keyval (grub_blsuki_entry_t *entry, char *key, char *val) + * Find the value of the key named by keyname. If there are allowed to be + * more than one, pass a pointer set to -1 to the last parameter the first + * time, and pass the same pointer through each time after, and it'll return +- * them in sorted order as defined in the BLS fragment file. ++ * them in sorted order. + */ + static char * + blsuki_get_val (grub_blsuki_entry_t *entry, const char *keyname, int *last) +@@ -310,20 +343,212 @@ bls_parse_keyvals (grub_file_t f, grub_blsuki_entry_t *entry) + return err; + } + ++#ifdef GRUB_MACHINE_EFI ++/* ++ * This function searches for the .cmdline, .osrel, and .linux sections of a ++ * UKI. We only need to store the data for the .cmdline and .osrel sections, ++ * but we also need to verify that the .linux section exists. ++ */ ++static grub_err_t ++uki_parse_keyvals (grub_file_t f, grub_blsuki_entry_t *entry) ++{ ++ struct grub_msdos_image_header *dos = NULL; ++ struct grub_pe_image_header *pe = NULL; ++ grub_off_t section_offset = 0; ++ struct grub_pe32_section_table *section = NULL; ++ struct grub_pe32_coff_header *coff_header = NULL; ++ char *val = NULL; ++ char *key = NULL; ++ const char *target[] = {".cmdline", ".osrel", ".linux", NULL}; ++ bool has_linux = false; ++ grub_err_t err = GRUB_ERR_NONE; ++ ++ dos = grub_zalloc (sizeof (*dos)); ++ if (dos == NULL) ++ return grub_errno; ++ if (grub_file_read (f, dos, sizeof (*dos)) < (grub_ssize_t) sizeof (*dos)) ++ { ++ err = grub_error (GRUB_ERR_FILE_READ_ERROR, "failed to read UKI image header"); ++ goto finish; ++ } ++ if (dos->msdos_magic != GRUB_DOS_MAGIC) ++ { ++ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "plain image kernel is not supported"); ++ goto finish; ++ } ++ ++ grub_dprintf ("blsuki", "PE/COFF header @ %08x\n", dos->pe_image_header_offset); ++ pe = grub_zalloc (sizeof (*pe)); ++ if (pe == NULL) ++ { ++ err = grub_errno; ++ goto finish; ++ } ++ if (grub_file_seek (f, dos->pe_image_header_offset) == (grub_off_t) -1 || ++ grub_file_read (f, pe, sizeof (*pe)) != sizeof (*pe)) ++ { ++ err = grub_error (GRUB_ERR_FILE_READ_ERROR, "failed to read COFF image header"); ++ goto finish; ++ } ++ if (pe->optional_header.magic != GRUB_PE32_NATIVE_MAGIC) ++ { ++ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "non-native image not supported"); ++ goto finish; ++ } ++ ++ coff_header = &(pe->coff_header); ++ section_offset = dos->pe_image_header_offset + sizeof (*pe); ++ ++ for (int i = 0; i < coff_header->num_sections; i++) ++ { ++ section = grub_zalloc (sizeof (*section)); ++ if (section == NULL) ++ { ++ err = grub_errno; ++ goto finish; ++ } ++ ++ if (grub_file_seek (f, section_offset) == (grub_off_t) -1 || ++ grub_file_read (f, section, sizeof (*section)) != sizeof (*section)) ++ { ++ err = grub_error (GRUB_ERR_FILE_READ_ERROR, "failed to read section header"); ++ goto finish; ++ } ++ ++ key = grub_strndup (section->name, 8); ++ if (key == NULL) ++ { ++ err = grub_errno; ++ goto finish; ++ } ++ ++ for (int j = 0; target[j] != NULL; j++) ++ { ++ if (grub_strcmp (key, target[j]) == 0) ++ { ++ /* ++ * We don't need to read the contents of the .linux PE section, but we ++ * should verify that the section exists. ++ */ ++ if (grub_strcmp (key, ".linux") == 0) ++ { ++ has_linux = true; ++ break; ++ } ++ ++ if (section->raw_data_size > UKI_SECTION_SIZE_MAX) ++ { ++ err = grub_error (GRUB_ERR_BAD_NUMBER, "UKI section size is larger than expected"); ++ goto finish; ++ } ++ ++ val = grub_zalloc (section->raw_data_size); ++ if (val == NULL) ++ { ++ err = grub_errno; ++ goto finish; ++ } ++ ++ if (grub_file_seek (f, section->raw_data_offset) == (grub_off_t) -1 || ++ grub_file_read (f, val, section->raw_data_size) != (grub_ssize_t) section->raw_data_size) ++ { ++ err = grub_error (GRUB_ERR_FILE_READ_ERROR, "failed to read section"); ++ goto finish; ++ } ++ ++ err = blsuki_add_keyval (entry, key, val); ++ if (err != GRUB_ERR_NONE) ++ goto finish; ++ ++ break; ++ } ++ } ++ ++ section_offset += sizeof (*section); ++ grub_free (section); ++ grub_free (val); ++ grub_free (key); ++ section = NULL; ++ val = NULL; ++ key = NULL; ++ } ++ ++ if (has_linux == false) ++ err = grub_error (GRUB_ERR_NO_KERNEL, "UKI is missing the '.linux' section"); ++ ++ finish: ++ grub_free (dos); ++ grub_free (pe); ++ grub_free (section); ++ grub_free (val); ++ grub_free (key); ++ return err; ++} ++ ++/* ++ * This function obtains the keyval pairs when the .osrel data is input into ++ * the osrel_ptr parameter and returns the keyval pair. Since we are using ++ * grub_strtok_r(), the osrel_ptr will be updated to the following line of ++ * osrel. This function returns NULL when it reaches the end of osrel. ++ */ ++static char * ++uki_read_osrel (char **osrel_ptr, char **val_ret) ++{ ++ char *key, *val; ++ grub_size_t val_size; ++ ++ for (;;) ++ { ++ key = grub_strtok_r (NULL, "\n\r", osrel_ptr); ++ if (key == NULL) ++ return NULL; ++ ++ /* Remove leading white space */ ++ while (*key == ' ' || *key == '\t') ++ key++; ++ ++ /* Skip commented lines */ ++ if (*key == '#') ++ continue; ++ ++ /* Split key/value */ ++ key = grub_strtok_r (key, "=", &val); ++ if (key == NULL || *val == '\0') ++ continue; ++ ++ /* Remove quotes from value */ ++ val_size = grub_strlen (val); ++ if ((*val == '\"' && val[val_size - 1] == '\"') || ++ (*val == '\'' && val[val_size - 1] == '\'')) ++ { ++ val[val_size - 1] = '\0'; ++ val++; ++ } ++ ++ *val_ret = val; ++ break; ++ } ++ ++ return key; ++} ++#endif ++ + /* + * If a file hasn't already been opened, this function opens a BLS config file +- * and initializes entry data before parsing keyvals and adding the entry to +- * the list of BLS entries. ++ * or UKI and initializes entry data before parsing keyvals and adding the entry ++ * to the list of BLS or UKI entries. + */ + static int + blsuki_read_entry (const char *filename, + const struct grub_dirhook_info *dirhook_info __attribute__ ((__unused__)), + void *data) + { +- grub_size_t path_len = 0, filename_len; +- grub_err_t err; ++ grub_size_t path_len = 0, ext_len = 0, filename_len; ++ grub_err_t err = GRUB_ERR_NONE; + char *p = NULL; ++ const char *ext = NULL; + grub_file_t f = NULL; ++ enum grub_file_type file_type = 0; + grub_blsuki_entry_t *entry; + struct read_entry_info *info = (struct read_entry_info *) data; + +@@ -331,17 +556,31 @@ blsuki_read_entry (const char *filename, + + filename_len = grub_strlen (filename); + ++ if (info->cmd_type == BLSUKI_BLS_CMD) ++ { ++ ext = ".conf"; ++ ext_len = BLS_EXT_LEN; ++ file_type = GRUB_FILE_TYPE_CONFIG; ++ } ++#ifdef GRUB_MACHINE_EFI ++ else if (info->cmd_type == BLSUKI_UKI_CMD) ++ { ++ ext = ".efi"; ++ ext_len = UKI_EXT_LEN; ++ file_type = GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE; ++ } ++#endif ++ + if (info->file != NULL) + f = info->file; + else + { +- if (filename_len < BLS_EXT_LEN || +- grub_strcmp (filename + filename_len - BLS_EXT_LEN, ".conf") != 0) ++ if (filename_len < ext_len || ++ grub_strcmp (filename + filename_len - ext_len, ext) != 0) + return 0; + + p = grub_xasprintf ("(%s)%s/%s", info->devid, info->dirname, filename); +- +- f = grub_file_open (p, GRUB_FILE_TYPE_CONFIG); ++ f = grub_file_open (p, file_type); + grub_free (p); + if (f == NULL) + goto finish; +@@ -373,7 +612,26 @@ blsuki_read_entry (const char *filename, + goto finish; + } + +- err = bls_parse_keyvals (f, entry); ++ entry->dirname = grub_strdup (info->dirname); ++ if (entry->dirname == NULL) ++ { ++ grub_free (entry); ++ goto finish; ++ } ++ ++ entry->devid = grub_strdup (info->devid); ++ if (entry->devid == NULL) ++ { ++ grub_free (entry); ++ goto finish; ++ } ++ ++ if (info->cmd_type == BLSUKI_BLS_CMD) ++ err = bls_parse_keyvals (f, entry); ++#ifdef GRUB_MACHINE_EFI ++ else if (info->cmd_type == BLSUKI_UKI_CMD) ++ err = uki_parse_keyvals (f, entry); ++#endif + + if (err == GRUB_ERR_NONE) + blsuki_add_entry (entry); +@@ -389,7 +647,7 @@ blsuki_read_entry (const char *filename, + + /* + * This function returns a list of values that had the same key in the BLS +- * config file. The number of entries in this list is returned by the len ++ * config file or UKI. The number of entries in this list is returned by the len + * parameter. + */ + static char ** +@@ -764,7 +1022,7 @@ bls_create_entry (grub_blsuki_entry_t *entry) + linux_cmd, initrd_cmd ? initrd_cmd : "", + dt_cmd ? dt_cmd : ""); + +- grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, entry); ++ grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, NULL, NULL, entry); + + finish: + grub_free (linux_cmd); +@@ -776,6 +1034,70 @@ bls_create_entry (grub_blsuki_entry_t *entry) + grub_free (src); + } + ++#ifdef GRUB_MACHINE_EFI ++/* ++ * This function puts together the section data received from the UKI and ++ * generates a new entry in the GRUB boot menu. ++ */ ++static void ++uki_create_entry (grub_blsuki_entry_t *entry) ++{ ++ const char **argv = NULL; ++ char *id = entry->filename; ++ char *title = NULL; ++ char *options = NULL; ++ char *osrel, *osrel_line; ++ char *key = NULL; ++ char *value = NULL; ++ char *src = NULL; ++ bool blsuki_save_default; ++ ++ /* ++ * Although .osrel is listed as optional in the UKI specification, the .osrel ++ * section is needed to generate the GRUB menu entry title. ++ */ ++ osrel = blsuki_get_val (entry, ".osrel", NULL); ++ if (osrel == NULL) ++ { ++ grub_dprintf ("blsuki", "Skipping file %s with no '.osrel' key.\n", entry->filename); ++ goto finish; ++ } ++ ++ osrel_line = osrel; ++ while ((key = uki_read_osrel (&osrel_line, &value)) != NULL) ++ { ++ if (grub_strcmp ("PRETTY_NAME", key) == 0) ++ { ++ title = value; ++ break; ++ } ++ } ++ ++ options = blsuki_get_val (entry, ".cmdline", NULL); ++ ++ argv = grub_zalloc (2 * sizeof (char *)); ++ if (argv == NULL) ++ goto finish; ++ argv[0] = title; ++ ++ blsuki_save_default = grub_env_get_bool ("blsuki_save_default", false); ++ src = grub_xasprintf ("%schainloader (%s)%s/%s%s%s\n", ++ blsuki_save_default ? "savedefault\n" : "", ++ entry->devid, entry->dirname, ++ entry->filename, ++ (options != NULL) ? " " : "", ++ (options != NULL) ? options : ""); ++ ++ grub_normal_add_menu_entry (1, argv, NULL, id, NULL, NULL, NULL, src, 0, NULL, NULL, entry); ++ ++ finish: ++ grub_free (argv); ++ grub_free (src); ++ grub_free (options); ++ grub_free (osrel); ++} ++#endif ++ + /* + * This function fills a find_entry_info struct passed in by the info parameter. + * If the dirname or devid parameters are set to NULL, the dirname and devid +@@ -785,7 +1107,7 @@ bls_create_entry (grub_blsuki_entry_t *entry) + * device. + */ + static grub_err_t +-blsuki_set_find_entry_info (struct find_entry_info *info, const char *dirname, const char *devid) ++blsuki_set_find_entry_info (struct find_entry_info *info, const char *dirname, const char *devid, enum blsuki_cmd_type cmd_type) + { + grub_device_t dev; + grub_fs_t fs; +@@ -795,10 +1117,23 @@ blsuki_set_find_entry_info (struct find_entry_info *info, const char *dirname, c + + if (devid == NULL) + { ++ if (cmd_type == BLSUKI_BLS_CMD) ++ { + #ifdef GRUB_MACHINE_EMU +- devid = "host"; ++ devid = "host"; + #else +- devid = grub_env_get ("root"); ++ devid = grub_env_get ("root"); ++#endif ++ } ++#ifdef GRUB_MACHINE_EFI ++ else if (cmd_type == BLSUKI_UKI_CMD) ++ { ++ grub_efi_loaded_image_t *image = grub_efi_get_loaded_image (grub_efi_image_handle); ++ ++ if (image == NULL) ++ return grub_error (GRUB_ERR_BAD_DEVICE, N_("unable to find boot device")); ++ devid = grub_efidisk_get_device_name (image->device_handle); ++ } + #endif + if (devid == NULL) + return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable '%s' isn't set"), "root"); +@@ -837,15 +1172,16 @@ blsuki_set_find_entry_info (struct find_entry_info *info, const char *dirname, c + } + + /* +- * This function searches for BLS config files based on the data in the info +- * parameter. If the fallback option is enabled, the default location will be +- * checked for BLS config files if the first attempt fails. ++ * This function searches for BLS config files and UKIs based on the data in the ++ * info parameter. If the fallback option is enabled, the default location will ++ * be checked for BLS config files or UKIs if the first attempt fails. + */ + static grub_err_t +-blsuki_find_entry (struct find_entry_info *info, bool enable_fallback) ++blsuki_find_entry (struct find_entry_info *info, bool enable_fallback, enum blsuki_cmd_type cmd_type) + { + struct read_entry_info read_entry_info; + char *default_dir = NULL; ++ const char *cmd_dir = NULL; + char *tmp; + grub_size_t default_size; + grub_fs_t dir_fs = NULL; +@@ -862,6 +1198,7 @@ blsuki_find_entry (struct find_entry_info *info, bool enable_fallback) + dir_dev = info->dev; + dir_fs = info->fs; + read_entry_info.devid = info->devid; ++ read_entry_info.cmd_type = cmd_type; + + r = dir_fs->fs_dir (dir_dev, read_entry_info.dirname, blsuki_read_entry, + &read_entry_info); +@@ -874,19 +1211,27 @@ blsuki_find_entry (struct find_entry_info *info, bool enable_fallback) + /* + * If we aren't able to find BLS entries in the directory given by info->dirname, + * we can fallback to the default location "/boot/loader/entries/" and see if we +- * can find the files there. ++ * can find the files there. If we can't find UKI entries, fallback to ++ * "/EFI/Linux" on the EFI system partition. + */ + if (entries == NULL && fallback == false && enable_fallback == true) + { +- default_size = sizeof (GRUB_BOOT_DEVICE) + sizeof (GRUB_BLS_CONFIG_PATH) - 1; ++ if (cmd_type == BLSUKI_BLS_CMD) ++ cmd_dir = GRUB_BLS_CONFIG_PATH; ++#ifdef GRUB_MACHINE_EFI ++ else if (cmd_type == BLSUKI_UKI_CMD) ++ cmd_dir = GRUB_UKI_CONFIG_PATH; ++#endif ++ ++ default_size = sizeof (GRUB_BOOT_DEVICE) + grub_strlen (cmd_dir); + default_dir = grub_malloc (default_size); + if (default_dir == NULL) + return grub_errno; + + tmp = blsuki_update_boot_device (default_dir); +- tmp = grub_stpcpy (tmp, GRUB_BLS_CONFIG_PATH); ++ tmp = grub_stpcpy (tmp, cmd_dir); + +- blsuki_set_find_entry_info (info, default_dir, NULL); ++ blsuki_set_find_entry_info (info, default_dir, NULL, cmd_type); + grub_dprintf ("blsuki", "Entries weren't found in %s, fallback to %s\n", + read_entry_info.dirname, info->dirname); + fallback = true; +@@ -901,15 +1246,17 @@ blsuki_find_entry (struct find_entry_info *info, bool enable_fallback) + } + + static grub_err_t +-blsuki_load_entries (char *path, bool enable_fallback) ++blsuki_load_entries (char *path, bool enable_fallback, enum blsuki_cmd_type cmd_type) + { +- grub_size_t len; ++ grub_size_t len, ext_len = 0; + static grub_err_t r; + const char *devid = NULL; + char *dir = NULL; + char *default_dir = NULL; + char *tmp; ++ const char *cmd_dir = NULL; + grub_size_t dir_size; ++ const char *ext = NULL; + struct find_entry_info info = { + .dev = NULL, + .fs = NULL, +@@ -918,12 +1265,26 @@ blsuki_load_entries (char *path, bool enable_fallback) + struct read_entry_info rei = { + .devid = NULL, + .dirname = NULL, ++ .cmd_type = cmd_type, + }; + + if (path != NULL) + { ++ if (cmd_type == BLSUKI_BLS_CMD) ++ { ++ ext = ".conf"; ++ ext_len = BLS_EXT_LEN; ++ } ++#ifdef GRUB_MACHINE_EFI ++ else if (cmd_type == BLSUKI_UKI_CMD) ++ { ++ ext = ".efi"; ++ ext_len = UKI_EXT_LEN; ++ } ++#endif ++ + len = grub_strlen (path); +- if (len >= BLS_EXT_LEN && grub_strcmp (path + len - BLS_EXT_LEN, ".conf") == 0) ++ if (len >= ext_len && grub_strcmp (path + len - ext_len, ext) == 0) + { + rei.file = grub_file_open (path, GRUB_FILE_TYPE_CONFIG); + if (rei.file == NULL) +@@ -952,19 +1313,26 @@ blsuki_load_entries (char *path, bool enable_fallback) + + if (dir == NULL) + { +- dir_size = sizeof (GRUB_BOOT_DEVICE) + sizeof (GRUB_BLS_CONFIG_PATH) - 2; ++ if (cmd_type == BLSUKI_BLS_CMD) ++ cmd_dir = GRUB_BLS_CONFIG_PATH; ++#ifdef GRUB_MACHINE_EFI ++ else if (cmd_type == BLSUKI_UKI_CMD) ++ cmd_dir = GRUB_UKI_CONFIG_PATH; ++#endif ++ ++ dir_size = sizeof (GRUB_BOOT_DEVICE) + grub_strlen (cmd_dir); + default_dir = grub_malloc (dir_size); + if (default_dir == NULL) + return grub_errno; + + tmp = blsuki_update_boot_device (default_dir); +- tmp = grub_stpcpy (tmp, GRUB_BLS_CONFIG_PATH); ++ tmp = grub_stpcpy (tmp, cmd_dir); + dir = default_dir; + } + +- r = blsuki_set_find_entry_info (&info, dir, devid); ++ r = blsuki_set_find_entry_info (&info, dir, devid, cmd_type); + if (r == GRUB_ERR_NONE) +- r = blsuki_find_entry (&info, enable_fallback); ++ r = blsuki_find_entry (&info, enable_fallback, cmd_type); + + if (info.dev != NULL) + grub_device_close (info.dev); +@@ -1002,11 +1370,11 @@ blsuki_is_default_entry (const char *def_entry, grub_blsuki_entry_t *entry, int + } + + /* +- * This function creates a GRUB boot menu entry for each BLS entry in the +- * entries list. ++ * This function creates a GRUB boot menu entry for each BLS or UKI entry in ++ * the entries list. + */ + static grub_err_t +-blsuki_create_entries (bool show_default, bool show_non_default, char *entry_id) ++blsuki_create_entries (bool show_default, bool show_non_default, char *entry_id, enum blsuki_cmd_type cmd_type) + { + const char *def_entry = NULL; + grub_blsuki_entry_t *entry = NULL; +@@ -1025,7 +1393,12 @@ blsuki_create_entries (bool show_default, bool show_non_default, char *entry_id) + (show_non_default == true && blsuki_is_default_entry (def_entry, entry, idx) == false) || + (entry_id != NULL && grub_strcmp (entry_id, entry->filename) == 0)) + { +- bls_create_entry (entry); ++ if (cmd_type == BLSUKI_BLS_CMD) ++ bls_create_entry (entry); ++#ifdef GRUB_MACHINE_EFI ++ else if (cmd_type == BLSUKI_UKI_CMD) ++ uki_create_entry (entry); ++#endif + entry->visible = true; + } + +@@ -1036,8 +1409,7 @@ blsuki_create_entries (bool show_default, bool show_non_default, char *entry_id) + } + + static grub_err_t +-grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)), +- char **args __attribute__ ((unused))) ++blsuki_cmd (grub_extcmd_context_t ctxt, enum blsuki_cmd_type cmd_type) + { + grub_err_t err; + struct grub_arg_list *state = ctxt->state; +@@ -1074,24 +1446,50 @@ grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)), + show_non_default = true; + } + +- err = blsuki_load_entries (path, enable_fallback); ++ err = blsuki_load_entries (path, enable_fallback, cmd_type); + if (err != GRUB_ERR_NONE) + return err; + +- return blsuki_create_entries (show_default, show_non_default, entry_id); ++ return blsuki_create_entries (show_default, show_non_default, entry_id, cmd_type); ++} ++ ++static grub_err_t ++grub_cmd_blscfg (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)), ++ char **args __attribute__ ((unused))) ++{ ++ return blsuki_cmd (ctxt, BLSUKI_BLS_CMD); + } + + static grub_extcmd_t bls_cmd; + ++#ifdef GRUB_MACHINE_EFI ++static grub_err_t ++grub_cmd_uki (grub_extcmd_context_t ctxt, int argc __attribute__ ((unused)), ++ char **args __attribute__ ((unused))) ++{ ++ return blsuki_cmd (ctxt, BLSUKI_UKI_CMD); ++} ++ ++static grub_extcmd_t uki_cmd; ++#endif ++ + GRUB_MOD_INIT(blsuki) + { + bls_cmd = grub_register_extcmd ("blscfg", grub_cmd_blscfg, 0, + N_("[-p|--path] [-f|--enable-fallback] DIR [-d|--show-default] [-n|--show-non-default] [-e|--entry] FILE"), + N_("Import Boot Loader Specification snippets."), + bls_opt); ++#ifdef GRUB_MACHINE_EFI ++ uki_cmd = grub_register_extcmd ("uki", grub_cmd_uki, 0, ++ N_("[-p|--path] DIR [-f|--enable-fallback] [-d|--show-default] [-n|--show-non-default] [-e|--entry] FILE"), ++ N_("Import Unified Kernel Images"), uki_opt); ++#endif + } + + GRUB_MOD_FINI(blsuki) + { + grub_unregister_extcmd (bls_cmd); ++#ifdef GRUB_MACHINE_EFI ++ grub_unregister_extcmd (uki_cmd); ++#endif + } +diff --git a/include/grub/menu.h b/include/grub/menu.h +index 43a3c5809b..0e4978dc3b 100644 +--- a/include/grub/menu.h ++++ b/include/grub/menu.h +@@ -39,6 +39,8 @@ struct grub_blsuki_entry + grub_size_t keyvals_size; + int nkeyvals; + char *filename; ++ char *dirname; ++ char *devid; + bool visible; + }; + typedef struct grub_blsuki_entry grub_blsuki_entry_t; diff --git a/0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch b/0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch new file mode 100644 index 00000000..d5932723 --- /dev/null +++ b/0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch @@ -0,0 +1,168 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Fri, 15 Nov 2024 15:34:29 +0800 +Subject: [PATCH] posix_wrap: Tweaks in preparation for libtasn1 + +Cc: Vladimir Serbinenko +Signed-off-by: Daniel Axtens +Signed-off-by: Gary Lin +Reviewed-by: Daniel Kiper +Tested-by: Stefan Berger +--- + grub-core/lib/posix_wrap/c-ctype.h | 114 +++++++++++++++++++++++++++++++++++++ + grub-core/lib/posix_wrap/string.h | 21 +++++++ + 2 files changed, 135 insertions(+) + create mode 100644 grub-core/lib/posix_wrap/c-ctype.h + +diff --git a/grub-core/lib/posix_wrap/c-ctype.h b/grub-core/lib/posix_wrap/c-ctype.h +new file mode 100644 +index 0000000000..5f8fc8ce3f +--- /dev/null ++++ b/grub-core/lib/posix_wrap/c-ctype.h +@@ -0,0 +1,114 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2024 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#ifndef GRUB_POSIX_C_CTYPE_H ++#define GRUB_POSIX_C_CTYPE_H 1 ++ ++#include ++ ++static inline bool ++c_isspace (int c) ++{ ++ return !!grub_isspace (c); ++} ++ ++static inline bool ++c_isdigit (int c) ++{ ++ return !!grub_isdigit (c); ++} ++ ++static inline bool ++c_islower (int c) ++{ ++ return !!grub_islower (c); ++} ++ ++static inline bool ++c_isascii (int c) ++{ ++ return !(c & ~0x7f); ++} ++ ++static inline bool ++c_isupper (int c) ++{ ++ return !!grub_isupper (c); ++} ++ ++static inline bool ++c_isxdigit (int c) ++{ ++ return !!grub_isxdigit (c); ++} ++ ++static inline bool ++c_isprint (int c) ++{ ++ return !!grub_isprint (c); ++} ++ ++static inline bool ++c_iscntrl (int c) ++{ ++ return !grub_isprint (c); ++} ++ ++static inline bool ++c_isgraph (int c) ++{ ++ return grub_isprint (c) && !grub_isspace (c); ++} ++ ++static inline bool ++c_isalnum (int c) ++{ ++ return grub_isalpha (c) || grub_isdigit (c); ++} ++ ++static inline bool ++c_ispunct (int c) ++{ ++ return grub_isprint (c) && !grub_isspace (c) && !c_isalnum (c); ++} ++ ++static inline bool ++c_isalpha (int c) ++{ ++ return !!grub_isalpha (c); ++} ++ ++static inline bool ++c_isblank (int c) ++{ ++ return c == ' ' || c == '\t'; ++} ++ ++static inline int ++c_tolower (int c) ++{ ++ return grub_tolower (c); ++} ++ ++static inline int ++c_toupper (int c) ++{ ++ return grub_toupper (c); ++} ++ ++#endif +diff --git a/grub-core/lib/posix_wrap/string.h b/grub-core/lib/posix_wrap/string.h +index 1adb450b5a..d3e400d500 100644 +--- a/grub-core/lib/posix_wrap/string.h ++++ b/grub-core/lib/posix_wrap/string.h +@@ -84,6 +84,27 @@ memchr (const void *s, int c, grub_size_t n) + return grub_memchr (s, c, n); + } + ++static inline char * ++strncat (char *dest, const char *src, grub_size_t n) ++{ ++ const char *end; ++ char *str = dest; ++ grub_size_t src_len; ++ ++ dest += grub_strlen (dest); ++ ++ end = grub_memchr (src, '\0', n); ++ if (end != NULL) ++ src_len = (grub_size_t) (end - src); ++ else ++ src_len = n; ++ ++ dest[src_len] = '\0'; ++ grub_memcpy (dest, src, src_len); ++ ++ return str; ++} ++ + #define memcmp grub_memcmp + #define memcpy grub_memcpy + #define memmove grub_memmove diff --git a/grub.macros b/grub.macros index dfc9707d..f6455473 100644 --- a/grub.macros +++ b/grub.macros @@ -518,7 +518,7 @@ install -m 644 %{1}.conf ${RPM_BUILD_ROOT}/etc/dnf/protected.d/ \ rm -f %{1}.conf \ %{nil} -%global grub_modules " all_video boot blscfg btrfs \\\ +%global grub_modules " all_video boot blscfg btrfs blsuki \\\ cat configfile cryptodisk \\\ echo ext2 f2fs fat font \\\ gcry_rijndael gcry_rsa gcry_serpent \\\ diff --git a/grub.patches b/grub.patches index 66e0b693..330fb13a 100644 --- a/grub.patches +++ b/grub.patches @@ -379,4 +379,11 @@ Patch0379: 0379-loader-efi-chainloader-Fix-double-free.patch Patch0380: 0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch Patch0381: 0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch Patch0382: 0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch -Patch0383: 0383-Include-function-name-on-debug-print-function.patch \ No newline at end of file +Patch0383: 0383-Include-function-name-on-debug-print-function.patch +Patch0384: 0001-kern-misc-Implement-grub_strtok.patch +Patch0385: 0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch +Patch0386: 0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch +Patch0387: 0004-blsuki-Check-for-mounted-boot-in-emu.patch +Patch0388: 0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch +Patch0389: 0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch + diff --git a/grub2.spec b/grub2.spec index 4563828d..c63f940a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 44%{?dist} +Release: 45%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -609,6 +609,9 @@ fi %endif %changelog +* Wed Oct 15 2025 Leo Sandoval - 2.12-45 +- Include upstream blsuki related patches + * Mon Sep 15 2025 Leo Sandoval - 2.12-44 - Include function name on debug print function From f4663b0ddc6e7b05b81bff630061838b77e725bc Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Mon, 27 Oct 2025 11:37:40 -0600 Subject: [PATCH 289/294] Fix blsuki patch enumeration Signed-off-by: Leo Sandoval --- ...tch => 0384-kern-misc-Implement-grub_strtok.patch | 0 ...d-blscfg-command-to-parse-Boot-Loader-Speci.patch | 0 ....c-Change-offset-type-for-grub_util_write_i.patch | 0 ...> 0387-blsuki-Check-for-mounted-boot-in-emu.patch | 0 ...d-uki-command-to-load-Unified-Kernel-Image-.patch | 0 ...six_wrap-Tweaks-in-preparation-for-libtasn1.patch | 0 grub.patches | 12 ++++++------ 7 files changed, 6 insertions(+), 6 deletions(-) rename 0001-kern-misc-Implement-grub_strtok.patch => 0384-kern-misc-Implement-grub_strtok.patch (100%) rename 0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch => 0385-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch (100%) rename 0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch => 0386-util-misc.c-Change-offset-type-for-grub_util_write_i.patch (100%) rename 0004-blsuki-Check-for-mounted-boot-in-emu.patch => 0387-blsuki-Check-for-mounted-boot-in-emu.patch (100%) rename 0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch => 0388-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch (100%) rename 0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch => 0389-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch (100%) diff --git a/0001-kern-misc-Implement-grub_strtok.patch b/0384-kern-misc-Implement-grub_strtok.patch similarity index 100% rename from 0001-kern-misc-Implement-grub_strtok.patch rename to 0384-kern-misc-Implement-grub_strtok.patch diff --git a/0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch b/0385-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch similarity index 100% rename from 0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch rename to 0385-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch diff --git a/0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch b/0386-util-misc.c-Change-offset-type-for-grub_util_write_i.patch similarity index 100% rename from 0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch rename to 0386-util-misc.c-Change-offset-type-for-grub_util_write_i.patch diff --git a/0004-blsuki-Check-for-mounted-boot-in-emu.patch b/0387-blsuki-Check-for-mounted-boot-in-emu.patch similarity index 100% rename from 0004-blsuki-Check-for-mounted-boot-in-emu.patch rename to 0387-blsuki-Check-for-mounted-boot-in-emu.patch diff --git a/0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch b/0388-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch similarity index 100% rename from 0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch rename to 0388-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch diff --git a/0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch b/0389-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch similarity index 100% rename from 0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch rename to 0389-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch diff --git a/grub.patches b/grub.patches index 330fb13a..98c50a8b 100644 --- a/grub.patches +++ b/grub.patches @@ -380,10 +380,10 @@ Patch0380: 0380-loader-efi-chainloader-Fix-null-pointer-dereference.patch Patch0381: 0381-osdep-linux-getroot-Detect-DDF-container-similar-to-.patch Patch0382: 0382-Set-correctly-the-memory-attributes-for-the-kernel-P.patch Patch0383: 0383-Include-function-name-on-debug-print-function.patch -Patch0384: 0001-kern-misc-Implement-grub_strtok.patch -Patch0385: 0002-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch -Patch0386: 0003-util-misc.c-Change-offset-type-for-grub_util_write_i.patch -Patch0387: 0004-blsuki-Check-for-mounted-boot-in-emu.patch -Patch0388: 0005-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch -Patch0389: 0006-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch +Patch0384: 0384-kern-misc-Implement-grub_strtok.patch +Patch0385: 0385-blsuki-Add-blscfg-command-to-parse-Boot-Loader-Speci.patch +Patch0386: 0386-util-misc.c-Change-offset-type-for-grub_util_write_i.patch +Patch0387: 0387-blsuki-Check-for-mounted-boot-in-emu.patch +Patch0388: 0388-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch +Patch0389: 0389-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch From 6467d85178d4ce4522a126aee3ba0e8ea27adf4c Mon Sep 17 00:00:00 2001 From: Tom spot Callaway Date: Tue, 4 Nov 2025 16:20:54 -0500 Subject: [PATCH 290/294] rebuild for new fuse3 --- grub2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub2.spec b/grub2.spec index c63f940a..0730550e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 45%{?dist} +Release: 46%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -609,6 +609,9 @@ fi %endif %changelog +* Tue Nov 4 2025 Tom Callaway - 2.12-46 +- rebuild for new fuse3 + * Wed Oct 15 2025 Leo Sandoval - 2.12-45 - Include upstream blsuki related patches From a4ec822e7e93aa93bbcfda5719036b7467f3e2a6 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Thu, 13 Nov 2025 12:06:23 -0600 Subject: [PATCH 291/294] blsuki: do not register blscfg command Otherwise the blsuki.c blscfg cmd version replaces the one defined on blscfg.c and the latter is the version we want to use. Signed-off-by: Leo Sandoval --- ...lsuki-do-not-register-blscfg-command.patch | 43 +++++++++++++++++++ grub.patches | 2 +- grub2.spec | 5 ++- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 0390-blsuki-do-not-register-blscfg-command.patch diff --git a/0390-blsuki-do-not-register-blscfg-command.patch b/0390-blsuki-do-not-register-blscfg-command.patch new file mode 100644 index 00000000..3fd4fa59 --- /dev/null +++ b/0390-blsuki-do-not-register-blscfg-command.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Thu, 13 Nov 2025 11:57:52 -0600 +Subject: [PATCH] blsuki: do not register blscfg command + +The blscfg command is already defined on commands/blscfg.c so do not +register it on blsuki.c. Also, the 'uki' command is only intended for +EFI system so remove the other platforms from the module. + +Signed-off-by: Leo Sandoval +--- + grub-core/Makefile.core.def | 2 -- + grub-core/commands/blsuki.c | 4 ---- + 2 files changed, 6 deletions(-) + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 885dd436de..a545ee430b 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -893,8 +893,6 @@ module = { + common = lib/gnulib/filevercmp.c; + enable = powerpc_ieee1275; + enable = efi; +- enable = i386_pc; +- enable = emu; + cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; + }; +diff --git a/grub-core/commands/blsuki.c b/grub-core/commands/blsuki.c +index cb00f936a7..bcd0114d85 100644 +--- a/grub-core/commands/blsuki.c ++++ b/grub-core/commands/blsuki.c +@@ -1475,10 +1475,6 @@ static grub_extcmd_t uki_cmd; + + GRUB_MOD_INIT(blsuki) + { +- bls_cmd = grub_register_extcmd ("blscfg", grub_cmd_blscfg, 0, +- N_("[-p|--path] [-f|--enable-fallback] DIR [-d|--show-default] [-n|--show-non-default] [-e|--entry] FILE"), +- N_("Import Boot Loader Specification snippets."), +- bls_opt); + #ifdef GRUB_MACHINE_EFI + uki_cmd = grub_register_extcmd ("uki", grub_cmd_uki, 0, + N_("[-p|--path] DIR [-f|--enable-fallback] [-d|--show-default] [-n|--show-non-default] [-e|--entry] FILE"), diff --git a/grub.patches b/grub.patches index 98c50a8b..af74d2e3 100644 --- a/grub.patches +++ b/grub.patches @@ -386,4 +386,4 @@ Patch0386: 0386-util-misc.c-Change-offset-type-for-grub_util_write_i.patch Patch0387: 0387-blsuki-Check-for-mounted-boot-in-emu.patch Patch0388: 0388-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch Patch0389: 0389-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch - +Patch0390: 0390-blsuki-do-not-register-blscfg-command.patch diff --git a/grub2.spec b/grub2.spec index 0730550e..bde96ec1 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 46%{?dist} +Release: 47%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -609,6 +609,9 @@ fi %endif %changelog +* Thu Nov 13 2025 Leo Sandoval - 2.12-47 +- blsuki: do not register blscfg command + * Tue Nov 4 2025 Tom Callaway - 2.12-46 - rebuild for new fuse3 From 70c5e629500a7364b805759ab649547f627e4ba8 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Mon, 27 Oct 2025 11:55:32 -0600 Subject: [PATCH 292/294] Add support for external environment block on Btrfs Signed-off-by: Leo Sandoval Tested-by: Neal Gompa --- 0391-misc-add-z-length-modifier-support.patch | 81 +++++++ 0392-tests-add-z-modifier-printf-tests.patch | 43 ++++ ...ub-editenv-add-fs_envblk-open-helper.patch | 219 ++++++++++++++++++ ...b-editenv-add-fs_envblk-write-helper.patch | 91 ++++++++ ...v-wire-set_variables-to-optional-fs_.patch | 118 ++++++++++ ...v-wire-unset_variables-to-optional-f.patch | 56 +++++ ...v-wire-list_variables-to-optional-fs.patch | 45 ++++ ...v-add-probe-call-for-external-envblk.patch | 176 ++++++++++++++ ...onment-block-to-reserved-header-area.patch | 93 ++++++++ ...e-grub.cfg-to-use-env_block-when-pre.patch | 82 +++++++ ...date-doc-link-for-bootloader-support.patch | 29 +++ ...Btrfs-env-block-and-special-env-vars.patch | 93 ++++++++ ...ile-read_hook-in-grub_fs_blocklist_r.patch | 73 ++++++ ...eader.in-Prefer-dev-instead-of-root-.patch | 44 ++++ ...he-external-environment-block-for-au.patch | 89 +++++++ ...e-automatic-hidden-menu-and-boot-cou.patch | 36 +++ grub.patches | 16 ++ grub2.spec | 5 +- 18 files changed, 1388 insertions(+), 1 deletion(-) create mode 100644 0391-misc-add-z-length-modifier-support.patch create mode 100644 0392-tests-add-z-modifier-printf-tests.patch create mode 100644 0393-util-grub-editenv-add-fs_envblk-open-helper.patch create mode 100644 0394-util-grub-editenv-add-fs_envblk-write-helper.patch create mode 100644 0395-util-grub-editenv-wire-set_variables-to-optional-fs_.patch create mode 100644 0396-util-grub-editenv-wire-unset_variables-to-optional-f.patch create mode 100644 0397-util-grub-editenv-wire-list_variables-to-optional-fs.patch create mode 100644 0398-util-grub-editenv-add-probe-call-for-external-envblk.patch create mode 100644 0399-btrfs-add-environment-block-to-reserved-header-area.patch create mode 100644 0400-00_header.in-wire-grub.cfg-to-use-env_block-when-pre.patch create mode 100644 0401-btrfs-update-doc-link-for-bootloader-support.patch create mode 100644 0402-docs-add-Btrfs-env-block-and-special-env-vars.patch create mode 100644 0403-kern-fs-Honour-file-read_hook-in-grub_fs_blocklist_r.patch create mode 100644 0404-util-grub.d-00_header.in-Prefer-dev-instead-of-root-.patch create mode 100644 0405-grub.d-Support-the-external-environment-block-for-au.patch create mode 100644 0406-grub-editenv-Make-automatic-hidden-menu-and-boot-cou.patch diff --git a/0391-misc-add-z-length-modifier-support.patch b/0391-misc-add-z-length-modifier-support.patch new file mode 100644 index 00000000..2fdcd77c --- /dev/null +++ b/0391-misc-add-z-length-modifier-support.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:32 +0800 +Subject: [PATCH] misc: add z length modifier support + +Add support for the 'z' length modifier in the printf code. This allows +printing of size_t and ssize_t values using %zu, %zd and related +formats. The parser maps 'z' to the correct integer width based on +sizeof (size_t). + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Daniel Kiper +--- + grub-core/kern/misc.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index c1c77c300c..2568a5489b 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -30,6 +30,7 @@ + #if DEBUG_WITH_TIMESTAMPS + #include + #endif ++#include + + union printf_arg + { +@@ -883,6 +884,9 @@ parse_printf_arg_fmt (const char *fmt0, struct printf_args *args, + COMPILE_TIME_ASSERT (sizeof (long) <= sizeof (long long)); + COMPILE_TIME_ASSERT (sizeof (long long) == sizeof (void *) + || sizeof (int) == sizeof (void *)); ++ COMPILE_TIME_ASSERT (sizeof (size_t) == sizeof (unsigned) ++ || sizeof (size_t) == sizeof (unsigned long) ++ || sizeof (size_t) == sizeof (unsigned long long)); + + fmt = fmt0; + while ((c = *fmt++) != 0) +@@ -917,11 +921,17 @@ parse_printf_arg_fmt (const char *fmt0, struct printf_args *args, + fmt++; + + c = *fmt++; ++ if (c == 'z') ++ { ++ c = *fmt++; ++ goto do_count; ++ } + if (c == 'l') + c = *fmt++; + if (c == 'l') + c = *fmt++; + ++ do_count: + switch (c) + { + case 'p': +@@ -1018,6 +1028,14 @@ parse_printf_arg_fmt (const char *fmt0, struct printf_args *args, + continue; + } + ++ if (c == 'z') ++ { ++ c = *fmt++; ++ if (sizeof (size_t) == sizeof (unsigned long)) ++ longfmt = 1; ++ else if (sizeof (size_t) == sizeof (unsigned long long)) ++ longfmt = 2; ++ } + if (c == 'l') + { + c = *fmt++; +@@ -1194,6 +1212,8 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, + } + + c = *fmt++; ++ if (c == 'z') ++ c = *fmt++; + if (c == 'l') + c = *fmt++; + if (c == 'l') diff --git a/0392-tests-add-z-modifier-printf-tests.patch b/0392-tests-add-z-modifier-printf-tests.patch new file mode 100644 index 00000000..ce86dc4a --- /dev/null +++ b/0392-tests-add-z-modifier-printf-tests.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:33 +0800 +Subject: [PATCH] tests: add z modifier printf tests + +Add unit tests for %zd, %zu and %zx to verify size_t and ssize_t +formatting matches system snprintf. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Daniel Kiper +--- + tests/printf_unit_test.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/tests/printf_unit_test.c b/tests/printf_unit_test.c +index 098c29fd9c..f2de187b03 100644 +--- a/tests/printf_unit_test.c ++++ b/tests/printf_unit_test.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #define MSG "printf test failed: %s, %s", real, expected + +@@ -73,6 +74,15 @@ printf_test (void) + grub_snprintf (real, sizeof (real), "%%0%dd ", 1); + snprintf (expected, sizeof (expected), "%%0%dd ", 1); + grub_test_assert (strcmp (real, expected) == 0, MSG); ++ grub_snprintf (real, sizeof (real), "%zd %zd %zd", (ssize_t) -1, (ssize_t) (SIZE_MAX >> 1), (ssize_t) 42); ++ snprintf (expected, sizeof (expected), "%zd %zd %zd", (ssize_t) -1, (ssize_t) (SIZE_MAX >> 1), (ssize_t) 42); ++ grub_test_assert (strcmp (real, expected) == 0, MSG); ++ grub_snprintf (real, sizeof (real), "%zu %zu %zu", (size_t) 0, (size_t) SIZE_MAX, (size_t) 42); ++ snprintf (expected, sizeof (expected), "%zu %zu %zu", (size_t) 0, (size_t) SIZE_MAX, (size_t) 42); ++ grub_test_assert (strcmp (real, expected) == 0, MSG); ++ grub_snprintf (real, sizeof (real), "%zx %zx %zx", (ssize_t) (SIZE_MAX >> 1), (size_t) SIZE_MAX, (size_t) 0xdeadbeefU); ++ snprintf (expected, sizeof (expected), "%zx %zx %zx", (ssize_t) (SIZE_MAX >> 1), (size_t) SIZE_MAX, (size_t) 0xdeadbeefU); ++ grub_test_assert (strcmp (real, expected) == 0, MSG); + } + + GRUB_UNIT_TEST ("printf_unit_test", printf_test); diff --git a/0393-util-grub-editenv-add-fs_envblk-open-helper.patch b/0393-util-grub-editenv-add-fs_envblk-open-helper.patch new file mode 100644 index 00000000..893c4c71 --- /dev/null +++ b/0393-util-grub-editenv-add-fs_envblk-open-helper.patch @@ -0,0 +1,219 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:34 +0800 +Subject: [PATCH] util/grub-editenv: add fs_envblk open helper + +This patch adds the logic to locate and open an environment block that +is stored in a reserved area on the device. It introduces the function +fs_envblk_open() together with helper routines to read the block pointed +to by the env_block variable, and to create the block on disk when it +does not exist yet. When a block is created, the code records its +location inside the file based envblk by setting env_block in block list +syntax of offset plus size in sectors. + +The env_block variable acts as a link from the file envblk to the raw +disk region so that later runs of grub-editenv can follow it and access +the external block. The helper is exposed through a small ops table +attached to fs_envblk so that later patches can call +fs_envblk->ops->open() without touching core code again. At this stage +variables are still stored in the file envblk and no redirection has +been applied. + +In relation to this, the fs_envblk_spec table defines the file-system +specific layout of the reserved raw blocks used for environment storage. +It is prepared to facilitate integration in grub-editenv, with Btrfs to +be added in the future once its reserved area is defined. + +An fs_envblk_init() helper is added to prepare it for using the ops with +its associated data context if the feature is available. It is not used +yet, but will be used later when a filesystem and its device are probed +to initialize the fs_envblk handle and enable access to the feature. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Avnish Chouhan +--- + util/grub-editenv.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 170 insertions(+) + +diff --git a/util/grub-editenv.c b/util/grub-editenv.c +index 948eec8a11..a544452e78 100644 +--- a/util/grub-editenv.c ++++ b/util/grub-editenv.c +@@ -123,6 +123,176 @@ block, use `rm %s'."), + NULL, help_filter, NULL + }; + ++struct fs_envblk_spec { ++ const char *fs_name; ++ off_t offset; ++ size_t size; ++}; ++typedef struct fs_envblk_spec fs_envblk_spec_t; ++ ++static grub_envblk_t fs_envblk_open (grub_envblk_t envblk); ++ ++struct fs_envblk_ops { ++ grub_envblk_t (*open) (grub_envblk_t); ++}; ++typedef struct fs_envblk_ops fs_envblk_ops_t; ++ ++struct fs_envblk { ++ fs_envblk_spec_t *spec; ++ fs_envblk_ops_t *ops; ++ const char *dev; ++}; ++typedef struct fs_envblk *fs_envblk_t; ++ ++static fs_envblk_ops_t fs_envblk_ops = { ++ .open = fs_envblk_open ++}; ++ ++/* ++ * fs_envblk_spec describes the file-system specific layout of reserved raw ++ * blocks used as environment blocks. ++ */ ++static fs_envblk_spec_t fs_envblk_spec[] = { ++ { NULL, 0, 0 } ++}; ++ ++static fs_envblk_t fs_envblk = NULL; ++ ++static void __attribute__ ((unused)) ++fs_envblk_init (const char *fs_name, const char *dev) ++{ ++ fs_envblk_spec_t *p; ++ ++ if (fs_name == NULL || dev == NULL) ++ return; ++ ++ for (p = fs_envblk_spec; p->fs_name != NULL; p++) ++ { ++ if (strcmp (fs_name, p->fs_name) == 0) ++ { ++ if (fs_envblk == NULL) ++ fs_envblk = xmalloc (sizeof (*fs_envblk)); ++ fs_envblk->spec = p; ++ fs_envblk->dev = xstrdup (dev); ++ fs_envblk->ops = &fs_envblk_ops; ++ break; ++ } ++ } ++} ++ ++static int ++read_env_block_var (const char *varname, const char *value, void *hook_data) ++{ ++ grub_envblk_t *p_envblk = (grub_envblk_t *) hook_data; ++ off_t off; ++ size_t sz; ++ char *p, *buf; ++ FILE *fp; ++ ++ if (p_envblk == NULL || fs_envblk == NULL) ++ return 1; ++ ++ if (strcmp (varname, "env_block") != 0) ++ return 0; ++ ++ off = strtol (value, &p, 10); ++ if (*p == '+') ++ sz = strtol (p + 1, &p, 10); ++ else ++ return 0; ++ ++ if (*p != '\0' || sz == 0) ++ return 0; ++ ++ off <<= GRUB_DISK_SECTOR_BITS; ++ sz <<= GRUB_DISK_SECTOR_BITS; ++ ++ fp = grub_util_fopen (fs_envblk->dev, "rb"); ++ if (fp == NULL) ++ grub_util_error (_("cannot open `%s': %s"), fs_envblk->dev, strerror (errno)); ++ ++ if (fseek (fp, off, SEEK_SET) < 0) ++ grub_util_error (_("cannot seek `%s': %s"), fs_envblk->dev, strerror (errno)); ++ ++ buf = xmalloc (sz); ++ if ((fread (buf, 1, sz, fp)) != sz) ++ grub_util_error (_("cannot read `%s': %s"), fs_envblk->dev, strerror (errno)); ++ ++ fclose (fp); ++ ++ *p_envblk = grub_envblk_open (buf, sz); ++ ++ return 1; ++} ++ ++static void ++create_env_on_block (void) ++{ ++ FILE *fp; ++ char *buf; ++ const char *device; ++ off_t offset; ++ size_t size; ++ ++ if (fs_envblk == NULL) ++ return; ++ ++ device = fs_envblk->dev; ++ offset = fs_envblk->spec->offset; ++ size = fs_envblk->spec->size; ++ ++ fp = grub_util_fopen (device, "r+b"); ++ if (fp == NULL) ++ grub_util_error (_("cannot open `%s': %s"), device, strerror (errno)); ++ ++ buf = xmalloc (size); ++ memcpy (buf, GRUB_ENVBLK_SIGNATURE, sizeof (GRUB_ENVBLK_SIGNATURE) - 1); ++ memset (buf + sizeof (GRUB_ENVBLK_SIGNATURE) - 1, '#', size - sizeof (GRUB_ENVBLK_SIGNATURE) + 1); ++ ++ if (fseek (fp, offset, SEEK_SET) < 0) ++ grub_util_error (_("cannot seek `%s': %s"), device, strerror (errno)); ++ ++ if (fwrite (buf, 1, size, fp) != size) ++ grub_util_error (_("cannot write to `%s': %s"), device, strerror (errno)); ++ ++ grub_util_file_sync (fp); ++ free (buf); ++ fclose (fp); ++} ++ ++static grub_envblk_t ++fs_envblk_open (grub_envblk_t envblk) ++{ ++ grub_envblk_t envblk_on_block = NULL; ++ char *val; ++ off_t offset; ++ size_t size; ++ ++ if (envblk == NULL) ++ return NULL; ++ ++ offset = fs_envblk->spec->offset; ++ size = fs_envblk->spec->size; ++ ++ grub_envblk_iterate (envblk, &envblk_on_block, read_env_block_var); ++ ++ if (envblk_on_block != NULL && grub_envblk_size (envblk_on_block) == size) ++ return envblk_on_block; ++ ++ create_env_on_block (); ++ ++ offset = offset >> GRUB_DISK_SECTOR_BITS; ++ size = (size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS; ++ ++ val = xasprintf ("%lld+%zu", (long long) offset, size); ++ if (grub_envblk_set (envblk, "env_block", val) == 0) ++ grub_util_error ("%s", _("environment block too small")); ++ grub_envblk_iterate (envblk, &envblk_on_block, read_env_block_var); ++ free (val); ++ ++ return envblk_on_block; ++} ++ + static grub_envblk_t + open_envblk_file (const char *name) + { diff --git a/0394-util-grub-editenv-add-fs_envblk-write-helper.patch b/0394-util-grub-editenv-add-fs_envblk-write-helper.patch new file mode 100644 index 00000000..f94f747e --- /dev/null +++ b/0394-util-grub-editenv-add-fs_envblk-write-helper.patch @@ -0,0 +1,91 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:35 +0800 +Subject: [PATCH] util/grub-editenv: add fs_envblk write helper + +This patch adds the function fs_envblk_write to update the reserved +environment block on disk. The helper takes an in memory envblk buffer +and writes it back to the device at the location defined by the +fs_envblk specification. It performs size checks and uses file sync to +ensure that the updated data is flushed. + +The helper is also added into the fs_envblk ops table, together with the +open helper from the previous patch. With this change the basic input +and output path for an external environment block is complete. The +choice of which variables should be written externally will be handled +by later patches. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Avnish Chouhan +Reviewed-by: Daniel Kiper +--- + util/grub-editenv.c | 38 +++++++++++++++++++++++++++++++++++++- + 1 file changed, 37 insertions(+), 1 deletion(-) + +diff --git a/util/grub-editenv.c b/util/grub-editenv.c +index a544452e78..f4b69bb19f 100644 +--- a/util/grub-editenv.c ++++ b/util/grub-editenv.c +@@ -131,9 +131,11 @@ struct fs_envblk_spec { + typedef struct fs_envblk_spec fs_envblk_spec_t; + + static grub_envblk_t fs_envblk_open (grub_envblk_t envblk); ++static void fs_envblk_write (grub_envblk_t envblk); + + struct fs_envblk_ops { + grub_envblk_t (*open) (grub_envblk_t); ++ void (*write) (grub_envblk_t); + }; + typedef struct fs_envblk_ops fs_envblk_ops_t; + +@@ -145,7 +147,8 @@ struct fs_envblk { + typedef struct fs_envblk *fs_envblk_t; + + static fs_envblk_ops_t fs_envblk_ops = { +- .open = fs_envblk_open ++ .open = fs_envblk_open, ++ .write = fs_envblk_write + }; + + /* +@@ -381,6 +384,39 @@ write_envblk (const char *name, grub_envblk_t envblk) + fclose (fp); + } + ++static void ++fs_envblk_write (grub_envblk_t envblk) ++{ ++ FILE *fp; ++ const char *device; ++ off_t offset; ++ size_t size; ++ ++ if (envblk == NULL) ++ return; ++ ++ device = fs_envblk->dev; ++ offset = fs_envblk->spec->offset; ++ size = fs_envblk->spec->size; ++ ++ if (grub_envblk_size (envblk) > size) ++ grub_util_error ("%s", _("environment block too small")); ++ ++ fp = grub_util_fopen (device, "r+b"); ++ ++ if (fp == NULL) ++ grub_util_error (_("cannot open `%s': %s"), device, strerror (errno)); ++ ++ if (fseek (fp, offset, SEEK_SET) < 0) ++ grub_util_error (_("cannot seek `%s': %s"), device, strerror (errno)); ++ ++ if (fwrite (grub_envblk_buffer (envblk), 1, grub_envblk_size (envblk), fp) != grub_envblk_size (envblk)) ++ grub_util_error (_("cannot write to `%s': %s"), device, strerror (errno)); ++ ++ grub_util_file_sync (fp); ++ fclose (fp); ++} ++ + static void + set_variables (const char *name, int argc, char *argv[]) + { diff --git a/0395-util-grub-editenv-wire-set_variables-to-optional-fs_.patch b/0395-util-grub-editenv-wire-set_variables-to-optional-fs_.patch new file mode 100644 index 00000000..bf9820a3 --- /dev/null +++ b/0395-util-grub-editenv-wire-set_variables-to-optional-fs_.patch @@ -0,0 +1,118 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:36 +0800 +Subject: [PATCH] util/grub-editenv: wire set_variables to optional fs_envblk + +This patch changes set_variables() so that it can use an external +environment block when one is present. The variable next_entry is +written into the external block, env_block is treated as read only, and +all other variables are written into the normal file based envblk. + +A cleanup step is added to handle cases where GRUB at runtime writes +variables into the external block because file based updates are not +safe on a copy on write filesystem such as Btrfs. For example, the +savedefault command can update saved_entry, and on Btrfs GRUB will place +that update in the external block instead of the file envblk. If an +older copy remains in the external block, it would override the newer +value from the file envblk when GRUB first loads the file and then +applies the external block on top of it. To avoid this, whenever a +variable is updated in the file envblk, any same named key in the +external block is deleted. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Avnish Chouhan +Reviewed-by: Daniel Kiper +--- + util/grub-editenv.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 56 insertions(+), 2 deletions(-) + +diff --git a/util/grub-editenv.c b/util/grub-editenv.c +index f4b69bb19f..be844bf902 100644 +--- a/util/grub-editenv.c ++++ b/util/grub-editenv.c +@@ -417,12 +417,35 @@ fs_envblk_write (grub_envblk_t envblk) + fclose (fp); + } + ++struct var_lookup_ctx { ++ const char *varname; ++ bool found; ++}; ++typedef struct var_lookup_ctx var_lookup_ctx_t; ++ ++static int ++var_lookup_iter (const char *varname, const char *value __attribute__ ((unused)), void *hook_data) ++{ ++ var_lookup_ctx_t *ctx = (var_lookup_ctx_t *) hook_data; ++ ++ if (grub_strcmp (ctx->varname, varname) == 0) ++ { ++ ctx->found = true; ++ return 1; ++ } ++ return 0; ++} ++ + static void + set_variables (const char *name, int argc, char *argv[]) + { + grub_envblk_t envblk; ++ grub_envblk_t envblk_on_block = NULL; + + envblk = open_envblk_file (name); ++ if (fs_envblk != NULL) ++ envblk_on_block = fs_envblk->ops->open (envblk); ++ + while (argc) + { + char *p; +@@ -433,15 +456,46 @@ set_variables (const char *name, int argc, char *argv[]) + + *(p++) = 0; + +- if (! grub_envblk_set (envblk, argv[0], p)) +- grub_util_error ("%s", _("environment block too small")); ++ if ((strcmp (argv[0], "next_entry") == 0) && envblk_on_block != NULL) ++ { ++ if (grub_envblk_set (envblk_on_block, argv[0], p) == 0) ++ grub_util_error ("%s", _("environment block too small")); ++ goto next; ++ } + ++ if (strcmp (argv[0], "env_block") == 0) ++ { ++ grub_util_warn (_("can't set env_block as it's read-only")); ++ goto next; ++ } ++ ++ if (grub_envblk_set (envblk, argv[0], p) == 0) ++ grub_util_error ("%s", _("environment block too small")); ++ ++ if (envblk_on_block != NULL) ++ { ++ var_lookup_ctx_t ctx = { ++ .varname = argv[0], ++ .found = false ++ }; ++ ++ grub_envblk_iterate (envblk_on_block, &ctx, var_lookup_iter); ++ if (ctx.found == true) ++ grub_envblk_delete (envblk_on_block, argv[0]); ++ } ++ next: + argc--; + argv++; + } + + write_envblk (name, envblk); + grub_envblk_close (envblk); ++ ++ if (envblk_on_block != NULL) ++ { ++ fs_envblk->ops->write (envblk_on_block); ++ grub_envblk_close (envblk_on_block); ++ } + } + + static void diff --git a/0396-util-grub-editenv-wire-unset_variables-to-optional-f.patch b/0396-util-grub-editenv-wire-unset_variables-to-optional-f.patch new file mode 100644 index 00000000..4b517b39 --- /dev/null +++ b/0396-util-grub-editenv-wire-unset_variables-to-optional-f.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:37 +0800 +Subject: [PATCH] util/grub-editenv: wire unset_variables to optional fs_envblk + +This patch updates unset_variables() so that removals are also applied +to the external environment block when it is present. The code opens the +external block, deletes the same named keys there, and then writes the +external block back using fs_envblk_write(). The file based envblk is +still updated and written as before. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Avnish Chouhan +Reviewed-by: Daniel Kiper +--- + util/grub-editenv.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/util/grub-editenv.c b/util/grub-editenv.c +index be844bf902..7ff1da9b40 100644 +--- a/util/grub-editenv.c ++++ b/util/grub-editenv.c +@@ -502,18 +502,32 @@ static void + unset_variables (const char *name, int argc, char *argv[]) + { + grub_envblk_t envblk; ++ grub_envblk_t envblk_on_block = NULL; + + envblk = open_envblk_file (name); ++ ++ if (fs_envblk != NULL) ++ envblk_on_block = fs_envblk->ops->open (envblk); ++ + while (argc) + { + grub_envblk_delete (envblk, argv[0]); + ++ if (envblk_on_block != NULL) ++ grub_envblk_delete (envblk_on_block, argv[0]); ++ + argc--; + argv++; + } + + write_envblk (name, envblk); + grub_envblk_close (envblk); ++ ++ if (envblk_on_block != NULL) ++ { ++ fs_envblk->ops->write (envblk_on_block); ++ grub_envblk_close (envblk_on_block); ++ } + } + + struct get_int_value_params { diff --git a/0397-util-grub-editenv-wire-list_variables-to-optional-fs.patch b/0397-util-grub-editenv-wire-list_variables-to-optional-fs.patch new file mode 100644 index 00000000..5687886d --- /dev/null +++ b/0397-util-grub-editenv-wire-list_variables-to-optional-fs.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:38 +0800 +Subject: [PATCH] util/grub-editenv: wire list_variables to optional fs_envblk + +This patch updates list_variables() so that it also prints entries from +the external environment block when one is present. The function first +lists all variables from the file based envblk, then iterates over the +external envblk and prints those as well. + +The output format remains the same as before. The change makes it +possible to inspect variables regardless of whether they are stored in +the file envblk or in the reserved block. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Avnish Chouhan +Reviewed-by: Sudhakar Kuppusamy +Reviewed-by: Daniel Kiper +--- + util/grub-editenv.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/util/grub-editenv.c b/util/grub-editenv.c +index 7ff1da9b40..170d8f139a 100644 +--- a/util/grub-editenv.c ++++ b/util/grub-editenv.c +@@ -358,10 +358,17 @@ static void + list_variables (const char *name) + { + grub_envblk_t envblk; ++ grub_envblk_t envblk_on_block = NULL; + + envblk = open_envblk_file (name); ++ grub_envblk_iterate (envblk, &envblk_on_block, read_env_block_var); + grub_envblk_iterate (envblk, NULL, print_var); + grub_envblk_close (envblk); ++ if (envblk_on_block != NULL) ++ { ++ grub_envblk_iterate (envblk_on_block, NULL, print_var); ++ grub_envblk_close (envblk_on_block); ++ } + } + + static void diff --git a/0398-util-grub-editenv-add-probe-call-for-external-envblk.patch b/0398-util-grub-editenv-add-probe-call-for-external-envblk.patch new file mode 100644 index 00000000..9d583168 --- /dev/null +++ b/0398-util-grub-editenv-add-probe-call-for-external-envblk.patch @@ -0,0 +1,176 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:39 +0800 +Subject: [PATCH] util/grub-editenv: add probe call for external envblk + +This patch adds the probe_fs_envblk() function to identify the root +filesystem and invoke fs_envblk_init() with the probed filesystem type +and device. This checks if the feature is available and initializes the +handle, fs_envblk, to access the external environment block. It avoids +configurations with diskfilter or cryptodisk where filesystem blocks may +be remapped or encrypted. + +The probe is only invoked when grub-editenv is working on the default +environment file path. This restriction ensures that probing and +possible raw device access are not triggered for arbitrary user supplied +paths, but only for the standard grubenv file. In that case the code +checks if the filename equals DEFAULT_ENVBLK_PATH and then calls +probe_fs_envblk with fs_envblk_spec. The result is stored in the global +fs_envblk handle. At this stage the external environment block is only +detected and recorded, and the behavior of grub-editenv is unchanged. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Avnish Chouhan +--- + util/grub-editenv.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 113 insertions(+), 2 deletions(-) + +diff --git a/util/grub-editenv.c b/util/grub-editenv.c +index 170d8f139a..201dc7ccd4 100644 +--- a/util/grub-editenv.c ++++ b/util/grub-editenv.c +@@ -23,8 +23,11 @@ + #include + #include + #include +-#include ++#include + #include ++#include ++#include ++#include + + #include + #include +@@ -161,7 +164,7 @@ static fs_envblk_spec_t fs_envblk_spec[] = { + + static fs_envblk_t fs_envblk = NULL; + +-static void __attribute__ ((unused)) ++static void + fs_envblk_init (const char *fs_name, const char *dev) + { + fs_envblk_spec_t *p; +@@ -582,6 +585,111 @@ incr_variables (const char *name, int argc, char *argv[]) + grub_envblk_close (envblk); + } + ++static bool ++is_abstraction (grub_device_t dev) ++{ ++ if (dev == NULL || dev->disk == NULL) ++ return false; ++ ++ if (dev->disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID || ++ dev->disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) ++ return true; ++ ++ return false; ++} ++ ++static void ++probe_fs_envblk (fs_envblk_spec_t *spec) ++{ ++ char **grub_devices = NULL; ++ char **curdev, **curdrive; ++ size_t ndev = 0; ++ char **grub_drives = NULL; ++ grub_device_t grub_dev = NULL; ++ grub_fs_t grub_fs = NULL; ++ bool have_abstraction = false; ++ ++ grub_util_biosdisk_init (DEFAULT_DEVICE_MAP); ++ grub_init_all (); ++ grub_gcry_init_all (); ++ ++ grub_lvm_fini (); ++ grub_mdraid09_fini (); ++ grub_mdraid1x_fini (); ++ grub_diskfilter_fini (); ++ grub_diskfilter_init (); ++ grub_mdraid09_init (); ++ grub_mdraid1x_init (); ++ grub_lvm_init (); ++ ++ grub_devices = grub_guess_root_devices (DEFAULT_DIRECTORY); ++ ++ if (grub_devices == NULL || grub_devices[0] == NULL) ++ { ++ grub_util_warn (_("cannot find a device for %s (is /dev mounted?)"), DEFAULT_DIRECTORY); ++ goto cleanup; ++ } ++ ++ for (curdev = grub_devices; *curdev != NULL; curdev++, ndev++) ++ grub_util_pull_device (*curdev); ++ ++ grub_drives = xcalloc ((ndev + 1), sizeof (grub_drives[0])); ++ ++ for (curdev = grub_devices, curdrive = grub_drives; *curdev != NULL; curdev++, ++ curdrive++) ++ { ++ *curdrive = grub_util_get_grub_dev (*curdev); ++ if (*curdrive == NULL) ++ { ++ grub_util_warn (_("cannot find a GRUB drive for %s. Check your device.map"), ++ *curdev); ++ goto cleanup; ++ } ++ } ++ *curdrive = NULL; ++ ++ grub_dev = grub_device_open (grub_drives[0]); ++ if (grub_dev == NULL) ++ { ++ grub_util_warn (_("cannot open device %s: %s"), grub_drives[0], grub_errmsg); ++ grub_errno = GRUB_ERR_NONE; ++ goto cleanup; ++ } ++ ++ grub_fs = grub_fs_probe (grub_dev); ++ if (grub_fs == NULL) ++ { ++ grub_util_warn (_("cannot probe fs for %s: %s"), grub_drives[0], grub_errmsg); ++ grub_errno = GRUB_ERR_NONE; ++ goto cleanup; ++ } ++ ++ have_abstraction = is_abstraction (grub_dev); ++ for (curdrive = grub_drives + 1; *curdrive != NULL && have_abstraction == false; curdrive++) ++ { ++ grub_device_t dev = grub_device_open (*curdrive); ++ ++ if (dev == NULL) ++ continue; ++ have_abstraction = is_abstraction (dev); ++ grub_device_close (dev); ++ } ++ ++ if (have_abstraction == false) ++ fs_envblk_init (grub_fs->name, grub_devices[0]); ++ ++ cleanup: ++ if (grub_devices != NULL) ++ for (curdev = grub_devices; *curdev != NULL; curdev++) ++ free (*curdev); ++ free (grub_devices); ++ free (grub_drives); ++ grub_device_close (grub_dev); ++ grub_gcry_fini_all (); ++ grub_fini_all (); ++ grub_util_biosdisk_fini (); ++} ++ + int + main (int argc, char *argv[]) + { +@@ -613,6 +721,9 @@ main (int argc, char *argv[]) + command = argv[curindex++]; + } + ++ if (strcmp (filename, DEFAULT_ENVBLK_PATH) == 0) ++ probe_fs_envblk (fs_envblk_spec); ++ + if (strcmp (command, "create") == 0) + grub_util_create_envblk_file (filename); + else if (strcmp (command, "list") == 0) diff --git a/0399-btrfs-add-environment-block-to-reserved-header-area.patch b/0399-btrfs-add-environment-block-to-reserved-header-area.patch new file mode 100644 index 00000000..dd877089 --- /dev/null +++ b/0399-btrfs-add-environment-block-to-reserved-header-area.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:40 +0800 +Subject: [PATCH] btrfs: add environment block to reserved header area + +This patch reserves space for the GRUB environment block inside the +Btrfs header. The block is placed at an offset of GRUB_ENV_BTRFS_OFFSET +, 256 KiB from the start of the device, and occupies one sector. To +protect the space, overflow guard sectors are placed before and after +the reserved block. + +The Btrfs header already defines regions for bootloader use. By adding +this entry, GRUB gains a fixed and safe location to store the +environment block without conflicting with other structures in the +header. + +Add Btrfs and its reserved area information to the fs_envblk_spec table. +With the groundworks done in previous patches, the function is now +complete and working in grub-editenv. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +--- + grub-core/fs/btrfs.c | 10 +++++++++- + include/grub/fs.h | 2 ++ + util/grub-editenv.c | 9 ++++++++- + 3 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 3228e17886..261c413e9f 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -2650,11 +2650,16 @@ struct embed_region { + * https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#BOOTLOADER_SUPPORT + * The first 1 MiB on each device is unused with the exception of primary + * superblock that is on the offset 64 KiB and spans 4 KiB. ++ * ++ * Note: If this table is modified, also update ++ * util/grub-editenv.c::fs_envblk_spec, which describes the file-system ++ * specific layout of reserved raw blocks used as environment blocks so that ++ * both stay consistent. + */ + + static const struct { + struct embed_region available; +- struct embed_region used[6]; ++ struct embed_region used[9]; + } btrfs_head = { + .available = {0, GRUB_DISK_KiB_TO_SECTORS (1024)}, /* The first 1 MiB. */ + .used = { +@@ -2662,6 +2667,9 @@ static const struct { + {GRUB_DISK_KiB_TO_SECTORS (64) - 1, 1}, /* Overflow guard. */ + {GRUB_DISK_KiB_TO_SECTORS (64), GRUB_DISK_KiB_TO_SECTORS (4)}, /* 4 KiB superblock. */ + {GRUB_DISK_KiB_TO_SECTORS (68), 1}, /* Overflow guard. */ ++ {(GRUB_ENV_BTRFS_OFFSET >> GRUB_DISK_SECTOR_BITS) - 1, 1}, /* Overflow guard. */ ++ {(GRUB_ENV_BTRFS_OFFSET >> GRUB_DISK_SECTOR_BITS), 1}, /* Environment Block. */ ++ {(GRUB_ENV_BTRFS_OFFSET >> GRUB_DISK_SECTOR_BITS) + 1, 1}, /* Overflow guard. */ + {GRUB_DISK_KiB_TO_SECTORS (1024) - 1, 1}, /* Overflow guard. */ + {0, 0} /* Array terminator. */ + } +diff --git a/include/grub/fs.h b/include/grub/fs.h +index df4c93b16f..89e4d2b9bc 100644 +--- a/include/grub/fs.h ++++ b/include/grub/fs.h +@@ -132,4 +132,6 @@ grub_fs_unregister (grub_fs_t fs) + + grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device); + ++#define GRUB_ENV_BTRFS_OFFSET (256 * 1024) ++ + #endif /* ! GRUB_FS_HEADER */ +diff --git a/util/grub-editenv.c b/util/grub-editenv.c +index 201dc7ccd4..3c3f9d09f3 100644 +--- a/util/grub-editenv.c ++++ b/util/grub-editenv.c +@@ -156,9 +156,16 @@ static fs_envblk_ops_t fs_envblk_ops = { + + /* + * fs_envblk_spec describes the file-system specific layout of reserved raw +- * blocks used as environment blocks. ++ * blocks used as environment blocks. At present only Btrfs is supported. Other ++ * file-systems may be added if they provide a similar facility and avoid the ++ * limitation of writing to COW. ++ * ++ * Note: If this table is modified, also update ++ * grub-core/fs/btrfs.c::btrfs_head, which defines the layout in the Btrfs ++ * header and exports GRUB_ENV_BTRFS_OFFSET, so that both stay consistent. + */ + static fs_envblk_spec_t fs_envblk_spec[] = { ++ { "btrfs", GRUB_ENV_BTRFS_OFFSET, GRUB_DISK_SECTOR_SIZE }, + { NULL, 0, 0 } + }; + diff --git a/0400-00_header.in-wire-grub.cfg-to-use-env_block-when-pre.patch b/0400-00_header.in-wire-grub.cfg-to-use-env_block-when-pre.patch new file mode 100644 index 00000000..a807bb91 --- /dev/null +++ b/0400-00_header.in-wire-grub.cfg-to-use-env_block-when-pre.patch @@ -0,0 +1,82 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Michael Chang via Grub-devel +Date: Fri, 17 Oct 2025 17:01:41 +0800 +Subject: [PATCH] 00_header.in: wire grub.cfg to use env_block when present + +This patch extends the generated grub.cfg so that it can use the +external environment block when the variable env_block is defined. +During boot, if env_block is set, grub.cfg builds a device path for it, +exports the variable, and then loads its contents in addition to the +normal grubenv file. + +When GRUB writes variables such as next_entry or saved_entry, the save +commands are changed to write into env_block if it is set, and to fall +back to the grubenv file otherwise. In this way the external environment +block is used automatically, and existing commands like savedefault or +save_env do not need to change. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Daniel Kiper +--- + util/grub.d/00_header.in | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) + +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index 3e1b77265d..a5d43929b8 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -58,6 +58,13 @@ if [ -f \${config_directory}/grubenv ]; then + elif [ -s \$prefix/grubenv ]; then + load_env + fi ++ ++if [ "\${env_block}" ] ; then ++ set env_block="(\${root})\${env_block}" ++ export env_block ++ load_env -f "\${env_block}" ++fi ++ + EOF + if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then + cat < +Date: Fri, 17 Oct 2025 17:01:43 +0800 +Subject: [PATCH] btrfs: update doc link for bootloader support + +The old wiki link is obsolete and no longer updated, change it to the +current documentation. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Daniel Kiper +--- + grub-core/fs/btrfs.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c +index 261c413e9f..2222c57abd 100644 +--- a/grub-core/fs/btrfs.c ++++ b/grub-core/fs/btrfs.c +@@ -2647,7 +2647,8 @@ struct embed_region { + }; + + /* +- * https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#BOOTLOADER_SUPPORT ++ * https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#man-btrfs5-bootloader-support ++ * or invoke "man 5 btrfs" and visit the "bootloader support" subsection. + * The first 1 MiB on each device is unused with the exception of primary + * superblock that is on the offset 64 KiB and spans 4 KiB. + * diff --git a/0402-docs-add-Btrfs-env-block-and-special-env-vars.patch b/0402-docs-add-Btrfs-env-block-and-special-env-vars.patch new file mode 100644 index 00000000..11cf789d --- /dev/null +++ b/0402-docs-add-Btrfs-env-block-and-special-env-vars.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Mon, 27 Oct 2025 11:18:45 -0600 +Subject: [PATCH] docs: add Btrfs env block and special env vars + +Update grub.texi to describe the external environment block in the +reserved area of Btrfs header used for grub-reboot and savedefault, +and add a section documenting the saved_entry, next_entry, and +env_block variables. + +Signed-off-by: Michael Chang +Reviewed-by: Neal Gompa +Reviewed-by: Daniel Kiper +--- + docs/grub.texi | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 55 insertions(+) + +diff --git a/docs/grub.texi b/docs/grub.texi +index 531e847f32..d669972337 100644 +--- a/docs/grub.texi ++++ b/docs/grub.texi +@@ -3265,6 +3265,7 @@ GRUB. Others may be used freely in GRUB configuration files. + @menu + * Special environment variables:: + * Environment block:: ++* Special environment block variables:: + @end menu + + +@@ -3881,9 +3882,63 @@ For safety reasons, this storage is only available when installed on a plain + disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and + using BIOS or EFI functions (no ATA, USB or IEEE1275). + ++On Btrfs filesystems, a reserved area in the filesystem header may be used to ++store the environment block. This static block avoids the problems of updating ++a normal file on a copy-on-write filesystem, where writing raw block is not ++stable and requires metadata update. The reserved area provides a fixed ++location that GRUB can update directly, allowing commands such as ++@command{grub-reboot} and @samp{GRUB_SAVEDEFAULT} to function correctly on ++Btrfs volumes. ++ + @command{grub2-mkconfig} uses this facility to implement + @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}). + ++@node Special environment block variables ++@section Special environment block variables ++ ++These special variables are usually written to the environment block ++(@pxref{Environment block}) to customize the behavior of @file{grub.cfg} ++generated by @command{grub-mkconfig}. ++ ++@menu ++* saved_entry:: ++* next_entry:: ++* env_block:: ++@end menu ++ ++@node saved_entry ++@subsection saved_entry ++ ++The @var{saved_entry} variable sets the default boot entry in @file{grub.cfg} ++created by @command{grub-mkconfig}. It can be set with ++@command{grub-set-default} to choose a default entry, or at runtime with the ++@code{savedefault} function in grub.cfg to save the current entry as the new ++default. This may require write access by GRUB. ++ ++@node next_entry ++@subsection next_entry ++ ++The @var{next_entry} variable sets the boot entry for the next boot only. After ++it is used, GRUB clears the value so it is not reused. This requires write ++access to the environment block (@pxref{Environment block}) at runtime. The ++@command{grub-reboot} command is usually used instead of changing this variable ++directly. ++ ++@node env_block ++@subsection env_block ++ ++If the filesystem is Btrfs and the disk is not an abstracted device such as ++LVM, RAID, or encryption, the reserved space in the Btrfs header can be used as ++the environment block (@pxref{Environment block}). This provides a fixed raw ++block that GRUB can reliably write to. The @var{env_block} records this ++location in GRUB blocklist syntax (@pxref{Block list syntax}) so that ++@command{grub-editenv} and @file{grub.cfg} know how to access and use the ++external raw block. ++ ++This variable is initialized when @file{grubenv} is first created by ++@command{grub-editenv} and is treated as read-only to avoid being overwritten ++with an unpredictable value. ++ + @node Modules + @chapter Modules + diff --git a/0403-kern-fs-Honour-file-read_hook-in-grub_fs_blocklist_r.patch b/0403-kern-fs-Honour-file-read_hook-in-grub_fs_blocklist_r.patch new file mode 100644 index 00000000..6aa5d83e --- /dev/null +++ b/0403-kern-fs-Honour-file-read_hook-in-grub_fs_blocklist_r.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Rasmus Villemoes +Date: Thu, 29 Aug 2024 13:01:02 +0200 +Subject: [PATCH] kern/fs: Honour file->read_hook() in grub_fs_blocklist_read() + +Unlike files accessed via a normal file system, the file->read_hook() is +not honoured when using blocklist notation. + +This means that when trying to use a dedicated, 1 KiB, raw partition +for the environment block and hence does something like + + save_env --file=(hd0,gpt9)0+2 X Y Z + +this fails with "sparse file not allowed", which is rather unexpected, +as I've explicitly said exactly which blocks should be used. Adding +a little debugging reveals that grub_file_size(file) is 1024 as expected, +but total_length is 0, simply because the callback was never invoked, so +blocklists is an empty list. + +Fix that by honouring the ->read_hook() set by the caller, also when +a "file" is specified with blocklist notation. + +Signed-off-by: Rasmus Villemoes +Reviewed-by: Vladimir Serbinenko +Reviewed-by: Daniel Kiper +--- + grub-core/kern/fs.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c +index f25bace620..9f6f4ef9da 100644 +--- a/grub-core/kern/fs.c ++++ b/grub-core/kern/fs.c +@@ -216,12 +216,15 @@ grub_fs_blocklist_read (grub_file_t file, char *buf, grub_size_t len) + grub_disk_addr_t sector; + grub_off_t offset; + grub_ssize_t ret = 0; ++ grub_disk_t disk = file->device->disk; + + if (len > file->size - file->offset) + len = file->size - file->offset; + + sector = (file->offset >> GRUB_DISK_SECTOR_BITS); + offset = (file->offset & (GRUB_DISK_SECTOR_SIZE - 1)); ++ disk->read_hook = file->read_hook; ++ disk->read_hook_data = file->read_hook_data; + for (p = file->data; p->length && len > 0; p++) + { + if (sector < p->length) +@@ -233,9 +236,12 @@ grub_fs_blocklist_read (grub_file_t file, char *buf, grub_size_t len) + >> GRUB_DISK_SECTOR_BITS) > p->length - sector) + size = ((p->length - sector) << GRUB_DISK_SECTOR_BITS) - offset; + +- if (grub_disk_read (file->device->disk, p->offset + sector, offset, ++ if (grub_disk_read (disk, p->offset + sector, offset, + size, buf) != GRUB_ERR_NONE) +- return -1; ++ { ++ ret = -1; ++ break; ++ } + + ret += size; + len -= size; +@@ -245,6 +251,8 @@ grub_fs_blocklist_read (grub_file_t file, char *buf, grub_size_t len) + else + sector -= p->length; + } ++ disk->read_hook = NULL; ++ disk->read_hook_data = NULL; + + return ret; + } diff --git a/0404-util-grub.d-00_header.in-Prefer-dev-instead-of-root-.patch b/0404-util-grub.d-00_header.in-Prefer-dev-instead-of-root-.patch new file mode 100644 index 00000000..efe9389e --- /dev/null +++ b/0404-util-grub.d-00_header.in-Prefer-dev-instead-of-root-.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Wed, 26 Nov 2025 08:20:26 -0500 +Subject: [PATCH] util/grub.d/00_header.in: Prefer $dev instead of $root for + $env_block + +In UEFI environments where GRUB loads a stub grub.cfg on the EFI +System Partition (ESP) that points to the real one on the operating +system volume, the $root value is set to the ESP instead of the +operating system volume. + +This is particularly problematic for setups where the operating +system boot data is on a Btrfs volume and the external environment +block in the Btrfs bootloader space is used for grubenv data. + +Using $dev in its place resolves this problem, since the stub +grub.cfg populates this variable. Use it if it exists, and +fall back to $root accordingly. + +This is unlikely to be upstreamable, as it depends on the method +Fedora Linux and derivatives use to load the GRUB configuration. + +Signed-off-by: Neal Gompa +--- + util/grub.d/00_header.in | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in +index a5d43929b8..01f1f4144e 100644 +--- a/util/grub.d/00_header.in ++++ b/util/grub.d/00_header.in +@@ -60,7 +60,11 @@ elif [ -s \$prefix/grubenv ]; then + fi + + if [ "\${env_block}" ] ; then +- set env_block="(\${root})\${env_block}" ++ if [ "\${dev}" ]; then ++ set env_block="(\${dev})\${env_block}" ++ else ++ set env_block="(\${root})\${env_block}" ++ fi + export env_block + load_env -f "\${env_block}" + fi diff --git a/0405-grub.d-Support-the-external-environment-block-for-au.patch b/0405-grub.d-Support-the-external-environment-block-for-au.patch new file mode 100644 index 00000000..c75926a0 --- /dev/null +++ b/0405-grub.d-Support-the-external-environment-block-for-au.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Wed, 26 Nov 2025 08:37:57 -0500 +Subject: [PATCH] grub.d: Support the external environment block for automatic + hidden menu + +This allows the automatic hidden menu (and boot counting) mechanism +to use an external environment block if it exists and is configured +to be used. + +This is particularly important for supporting this mechanism on +systems with the operating system boot data on a Btrfs volume. + +This is unlikely to be upstreamable, as it depends on Fedora's GRUB +hidden menu and boot counting patch sets. + +Signed-off-by: Neal Gompa +--- + util/grub.d/08_fallback_counting.in | 6 +++++- + util/grub.d/10_reset_boot_success.in | 6 +++++- + util/grub.d/12_menu_auto_hide.in | 6 +++++- + util/grub.d/14_menu_show_once.in | 6 +++++- + 4 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/util/grub.d/08_fallback_counting.in b/util/grub.d/08_fallback_counting.in +index 2e2c3ff7d3..272cdb6533 100644 +--- a/util/grub.d/08_fallback_counting.in ++++ b/util/grub.d/08_fallback_counting.in +@@ -19,6 +19,10 @@ if [ -n "\${boot_counter}" -a "\${boot_success}" = "0" ]; then + else + decrement boot_counter + fi +- save_env boot_counter ++ if [ "\${env_block}" ]; then ++ save_env -f "\${env_block}" boot_counter ++ else ++ save_env boot_counter ++ fi + fi + EOF +diff --git a/util/grub.d/10_reset_boot_success.in b/util/grub.d/10_reset_boot_success.in +index e73f4137b3..ca04f9b699 100644 +--- a/util/grub.d/10_reset_boot_success.in ++++ b/util/grub.d/10_reset_boot_success.in +@@ -21,5 +21,9 @@ elif [ "\${boot_indeterminate}" = "1" ]; then + fi + # Reset boot_success for current boot + set boot_success=0 +-save_env boot_success boot_indeterminate ++if [ "\${env_block}" ]; then ++ save_env -f "\${env_block}" boot_success boot_indeterminate ++else ++ save_env boot_success boot_indeterminate ++fi + EOF +diff --git a/util/grub.d/12_menu_auto_hide.in b/util/grub.d/12_menu_auto_hide.in +index 6a7c0fa0d4..c2c207232e 100644 +--- a/util/grub.d/12_menu_auto_hide.in ++++ b/util/grub.d/12_menu_auto_hide.in +@@ -16,7 +16,11 @@ cat << EOF + if [ x\$feature_timeout_style = xy ] ; then + if [ "\${menu_show_once}" ]; then + unset menu_show_once +- save_env menu_show_once ++ if [ "\${env_block}" ]; then ++ save_env -f "\${env_block}" menu_show_once ++ else ++ save_env menu_show_once ++ fi + set timeout_style=menu + set timeout=60 + elif [ "\${menu_auto_hide}" -a "\${menu_hide_ok}" = "1" ]; then +diff --git a/util/grub.d/14_menu_show_once.in b/util/grub.d/14_menu_show_once.in +index 1cd7f36142..41b37b5ec7 100755 +--- a/util/grub.d/14_menu_show_once.in ++++ b/util/grub.d/14_menu_show_once.in +@@ -7,7 +7,11 @@ if [ x\$feature_timeout_style = xy ]; then + set timeout_style=menu + set timeout="\${menu_show_once_timeout}" + unset menu_show_once_timeout +- save_env menu_show_once_timeout ++ if [ "\${env_block}" ]; then ++ save_env -f "\${env_block}" menu_show_once_timeout ++ else ++ save_env menu_show_once_timeout ++ fi + fi + fi + EOF diff --git a/0406-grub-editenv-Make-automatic-hidden-menu-and-boot-cou.patch b/0406-grub-editenv-Make-automatic-hidden-menu-and-boot-cou.patch new file mode 100644 index 00000000..92b053bf --- /dev/null +++ b/0406-grub-editenv-Make-automatic-hidden-menu-and-boot-cou.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Wed, 26 Nov 2025 08:48:10 -0500 +Subject: [PATCH] grub-editenv: Make automatic hidden menu and boot counting + use envblk when available + +This ensures the automatic hidden menu and boot counting settings +are set in the right place when an external environment block is used. + +This is unlikely to be upstreamable, as it depends on Fedora's GRUB +hidden menu and boot counting patch sets. + +Signed-off-by: Neal Gompa +--- + util/grub-editenv.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/util/grub-editenv.c b/util/grub-editenv.c +index 3c3f9d09f3..48611e4e17 100644 +--- a/util/grub-editenv.c ++++ b/util/grub-editenv.c +@@ -473,7 +473,13 @@ set_variables (const char *name, int argc, char *argv[]) + + *(p++) = 0; + +- if ((strcmp (argv[0], "next_entry") == 0) && envblk_on_block != NULL) ++ if (((strcmp (argv[0], "next_entry") == 0) || ++ (strcmp (argv[0], "boot_counter") == 0) || ++ (strcmp (argv[0], "boot_indeterminate") == 0) || ++ (strcmp (argv[0], "boot_success") == 0) || ++ (strcmp (argv[0], "menu_show_once") == 0) || ++ (strcmp (argv[0], "menu_show_once_timeout") == 0)) ++ && envblk_on_block != NULL) + { + if (grub_envblk_set (envblk_on_block, argv[0], p) == 0) + grub_util_error ("%s", _("environment block too small")); diff --git a/grub.patches b/grub.patches index af74d2e3..8598a2de 100644 --- a/grub.patches +++ b/grub.patches @@ -387,3 +387,19 @@ Patch0387: 0387-blsuki-Check-for-mounted-boot-in-emu.patch Patch0388: 0388-blsuki-Add-uki-command-to-load-Unified-Kernel-Image-.patch Patch0389: 0389-posix_wrap-Tweaks-in-preparation-for-libtasn1.patch Patch0390: 0390-blsuki-do-not-register-blscfg-command.patch +Patch0391: 0391-misc-add-z-length-modifier-support.patch +Patch0392: 0392-tests-add-z-modifier-printf-tests.patch +Patch0393: 0393-util-grub-editenv-add-fs_envblk-open-helper.patch +Patch0394: 0394-util-grub-editenv-add-fs_envblk-write-helper.patch +Patch0395: 0395-util-grub-editenv-wire-set_variables-to-optional-fs_.patch +Patch0396: 0396-util-grub-editenv-wire-unset_variables-to-optional-f.patch +Patch0397: 0397-util-grub-editenv-wire-list_variables-to-optional-fs.patch +Patch0398: 0398-util-grub-editenv-add-probe-call-for-external-envblk.patch +Patch0399: 0399-btrfs-add-environment-block-to-reserved-header-area.patch +Patch0400: 0400-00_header.in-wire-grub.cfg-to-use-env_block-when-pre.patch +Patch0401: 0401-btrfs-update-doc-link-for-bootloader-support.patch +Patch0402: 0402-docs-add-Btrfs-env-block-and-special-env-vars.patch +Patch0403: 0403-kern-fs-Honour-file-read_hook-in-grub_fs_blocklist_r.patch +Patch0404: 0404-util-grub.d-00_header.in-Prefer-dev-instead-of-root-.patch +Patch0405: 0405-grub.d-Support-the-external-environment-block-for-au.patch +Patch0406: 0406-grub-editenv-Make-automatic-hidden-menu-and-boot-cou.patch diff --git a/grub2.spec b/grub2.spec index bde96ec1..3faf555e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 47%{?dist} +Release: 48%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -609,6 +609,9 @@ fi %endif %changelog +* Fri Nov 21 2025 Leo Sandoval - 2.12-48 +- Add support for external environment block on Btrfs + * Thu Nov 13 2025 Leo Sandoval - 2.12-47 - blsuki: do not register blscfg command From 16cb5b303d06825e8b36b5ca5e195e811d047bd1 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Fri, 28 Nov 2025 11:37:28 -0600 Subject: [PATCH 293/294] Increase EFI max allocation to max usable address Resolves: #2263643 Signed-off-by: Nicolas Frayer Signed-off-by: Leo Sandoval --- ...max-allocation-to-max-usable-address.patch | 23 +++++++++++++++++++ grub.patches | 1 + grub2.spec | 6 ++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 0407-Increase-EFI-max-allocation-to-max-usable-address.patch diff --git a/0407-Increase-EFI-max-allocation-to-max-usable-address.patch b/0407-Increase-EFI-max-allocation-to-max-usable-address.patch new file mode 100644 index 00000000..a1297e44 --- /dev/null +++ b/0407-Increase-EFI-max-allocation-to-max-usable-address.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Leo Sandoval +Date: Fri, 28 Nov 2025 11:30:19 -0600 +Subject: [PATCH] Increase EFI max allocation to max usable address + +Signed-off-by: Leo Sandoval +--- + include/grub/x86_64/efi/memory.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h +index e81cfb3221..547e3f82f8 100644 +--- a/include/grub/x86_64/efi/memory.h ++++ b/include/grub/x86_64/efi/memory.h +@@ -3,7 +3,7 @@ + + #if defined (__code_model_large__) + #define GRUB_EFI_MAX_USABLE_ADDRESS __UINTPTR_MAX__ +-#define GRUB_EFI_MAX_ALLOCATION_ADDRESS 0x7fffffff ++#define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS + #else + #define GRUB_EFI_MAX_USABLE_ADDRESS 0x7fffffff + #define GRUB_EFI_MAX_ALLOCATION_ADDRESS GRUB_EFI_MAX_USABLE_ADDRESS diff --git a/grub.patches b/grub.patches index 8598a2de..67c06e16 100644 --- a/grub.patches +++ b/grub.patches @@ -403,3 +403,4 @@ Patch0403: 0403-kern-fs-Honour-file-read_hook-in-grub_fs_blocklist_r.patch Patch0404: 0404-util-grub.d-00_header.in-Prefer-dev-instead-of-root-.patch Patch0405: 0405-grub.d-Support-the-external-environment-block-for-au.patch Patch0406: 0406-grub-editenv-Make-automatic-hidden-menu-and-boot-cou.patch +Patch0407: 0407-Increase-EFI-max-allocation-to-max-usable-address.patch diff --git a/grub2.spec b/grub2.spec index 3faf555e..552df8d3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 48%{?dist} +Release: 49%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -609,6 +609,10 @@ fi %endif %changelog +* Thu Nov 27 2025 Leo Sandoval - 2.12-49 +- Increase EFI max allocation to max usable address +- Resolves: #2263643 + * Fri Nov 21 2025 Leo Sandoval - 2.12-48 - Add support for external environment block on Btrfs From 85de859da1331046d29ffda9f1aac33d93da8457 Mon Sep 17 00:00:00 2001 From: Joel Capitao Date: Wed, 10 Dec 2025 12:02:40 +0100 Subject: [PATCH 294/294] Do not include EFI dir in common subpackage This fixes [1] which is part of [2]. We cannot ship /usr/lib/efi/* in -common subpackage as bootupd does not expect this directory for ppc64le arch. We are moving the creation and configuration of the directory into specific EFI macros only. [1] e02b6e88c71642ecc063ae7aefbd09b9be80d50e [2] https://fedoraproject.org/wiki/Changes/BootLoaderUpdatesPhase1 Signed-off-by: Joel Capitao --- grub.macros | 4 +++- grub2.spec | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/grub.macros b/grub.macros index f6455473..dd06d94c 100644 --- a/grub.macros +++ b/grub.macros @@ -708,6 +708,7 @@ find . '(' -iname gdb_grub \\\ ')' \\\ -exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \ find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \ +install -d -m 0700 ${RPM_BUILD_ROOT}%{grub_efi_dir}/ \ install -m 700 %{2} $RPM_BUILD_ROOT%{grub_efi_dir}/%{2} \ install -m 700 %{3} $RPM_BUILD_ROOT%{grub_efi_dir}/%{3} \ %{expand:%%do_install_protected_file grub2-%{alt_package_arch}} \ @@ -726,6 +727,7 @@ fi \ find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \ ln -s ../boot/grub2/grub.cfg \\\ $RPM_BUILD_ROOT%{_sysconfdir}/grub2-efi.cfg \ +install -d -m 0700 ${RPM_BUILD_ROOT}%{grub_efi_dir}/ \ install -m 700 %{2} $RPM_BUILD_ROOT%{grub_efi_dir}/%{2} \ install -m 700 %{3} $RPM_BUILD_ROOT%{grub_efi_dir}/%{3} \ %ifarch %{arm} \ @@ -830,7 +832,6 @@ cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/grub2.info \ cp docs/grub-dev.info \\\ $RPM_BUILD_ROOT%{_infodir}/grub2-dev.info \ install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \ -install -d -m 0700 ${RPM_BUILD_ROOT}%{grub_efi_dir}/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \ install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/themes/system \ @@ -879,6 +880,7 @@ ln -s ../boot/grub2/grub.cfg \\\ %config(noreplace) %{_sysconfdir}/grub2.cfg \ %config(noreplace) %{_sysconfdir}/grub2-efi.cfg \ %ghost %attr(0700,root,root) %{efi_esp_dir}/%{2} \ +%dir %attr(0700,root,root) %{grub_efi_dir} \ %attr(0700,root,root) %{grub_efi_dir}/%{2} \ %ifarch %{arm} \ %attr(0700,root,root) %verify(not mtime) %{efi_esp_boot}/BOOTARM.EFI \ diff --git a/grub2.spec b/grub2.spec index 552df8d3..8f73768c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 49%{?dist} +Release: 50%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -446,7 +446,6 @@ fi %dir /boot/grub2/themes/system %attr(0700,root,root) %dir /boot/grub2 %exclude /boot/grub2/* -%dir %attr(0700,root,root) %{grub_efi_dir} %exclude %{grub_efi_dir}/* %ghost %config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv %license COPYING @@ -609,6 +608,10 @@ fi %endif %changelog +* Wed Dec 10 2025 Joel Capitao - 2.12-50 +- Do not include EFI dir in common subpackage +- Resolves: rhbz#2420430 + * Thu Nov 27 2025 Leo Sandoval - 2.12-49 - Increase EFI max allocation to max usable address - Resolves: #2263643